From 111581ef02b7e5721ee0ac37c03f853c2154b654 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Tue, 17 Jul 2018 21:55:24 +0800 Subject: [PATCH] Remove last remnants of OverloadedStrings --- src/HSFM/FileSystem/UtilTypes.hs | 1 - src/HSFM/GUI/Glib/GlibString.hs | 3 +-- src/HSFM/GUI/Gtk.hs | 11 +++++++---- src/HSFM/GUI/Gtk/Callbacks.hs | 1 - src/HSFM/GUI/Gtk/Callbacks/Utils.hs | 1 - src/HSFM/GUI/Gtk/Dialogs.hs | 6 +++--- src/HSFM/Settings.hs | 14 +++++++------- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/HSFM/FileSystem/UtilTypes.hs b/src/HSFM/FileSystem/UtilTypes.hs index 3500699..aea51be 100644 --- a/src/HSFM/FileSystem/UtilTypes.hs +++ b/src/HSFM/FileSystem/UtilTypes.hs @@ -16,7 +16,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --} -{-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_HADDOCK ignore-exports #-} diff --git a/src/HSFM/GUI/Glib/GlibString.hs b/src/HSFM/GUI/Glib/GlibString.hs index 384039b..dd2edbb 100644 --- a/src/HSFM/GUI/Glib/GlibString.hs +++ b/src/HSFM/GUI/Glib/GlibString.hs @@ -16,7 +16,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --} -{-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_HADDOCK ignore-exports #-} @@ -67,7 +66,7 @@ instance GlibString BS.ByteString where newUTFStringLen = newUTFStringLen . toString genUTFOfs = genUTFOfs . toString stringLength = BS.length - unPrintf s = BS.intercalate "%%" (BS.split _percent s) + unPrintf s = BS.intercalate (BS.pack [_percent, _percent]) (BS.split _percent s) foreign import ccall unsafe "string.h strlen" c_strlen diff --git a/src/HSFM/GUI/Gtk.hs b/src/HSFM/GUI/Gtk.hs index fe985d0..b9bae67 100644 --- a/src/HSFM/GUI/Gtk.hs +++ b/src/HSFM/GUI/Gtk.hs @@ -16,17 +16,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --} -{-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_HADDOCK ignore-exports #-} module Main where +import qualified Data.ByteString as BS import Data.Maybe ( fromJust , fromMaybe ) +import Data.Word8 import Graphics.UI.Gtk import qualified HPath as P import HSFM.FileSystem.FileType @@ -45,15 +46,17 @@ import System.IO.Error ) import qualified System.Posix.Env.ByteString as SPE +slash :: BS.ByteString +slash = BS.singleton _slash main :: IO () main = do args <- SPE.getArgs - let mdir = fromMaybe (fromJust $ P.parseAbs "/") - (P.parseAbs . headDef "/" $ args) + let mdir = fromMaybe (fromJust $ P.parseAbs slash) + (P.parseAbs . headDef slash $ args) file <- catchIOError (pathToFile getFileInfo mdir) $ - \_ -> pathToFile getFileInfo . fromJust $ P.parseAbs "/" + \_ -> pathToFile getFileInfo . fromJust $ P.parseAbs slash _ <- initGUI mygui <- createMyGUI diff --git a/src/HSFM/GUI/Gtk/Callbacks.hs b/src/HSFM/GUI/Gtk/Callbacks.hs index 6673618..6aba542 100644 --- a/src/HSFM/GUI/Gtk/Callbacks.hs +++ b/src/HSFM/GUI/Gtk/Callbacks.hs @@ -16,7 +16,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --} -{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TupleSections #-} {-# OPTIONS_HADDOCK ignore-exports #-} diff --git a/src/HSFM/GUI/Gtk/Callbacks/Utils.hs b/src/HSFM/GUI/Gtk/Callbacks/Utils.hs index bd27fc7..c973dab 100644 --- a/src/HSFM/GUI/Gtk/Callbacks/Utils.hs +++ b/src/HSFM/GUI/Gtk/Callbacks/Utils.hs @@ -16,7 +16,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --} -{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# OPTIONS_HADDOCK ignore-exports #-} diff --git a/src/HSFM/GUI/Gtk/Dialogs.hs b/src/HSFM/GUI/Gtk/Dialogs.hs index 99b3c10..6470ab5 100644 --- a/src/HSFM/GUI/Gtk/Dialogs.hs +++ b/src/HSFM/GUI/Gtk/Dialogs.hs @@ -254,9 +254,9 @@ withErrorDialog io = -- |Asks the user which directory copy mode he wants via dialog popup -- and returns 'DirCopyMode'. -textInputDialog :: GlibString string - => string -- ^ window title - -> string -- ^ initial text in input widget +textInputDialog :: (GlibString s1, GlibString s2) + => s1 -- ^ window title + -> s2 -- ^ initial text in input widget -> IO (Maybe String) textInputDialog title inittext = do chooserDialog <- messageDialogNew Nothing diff --git a/src/HSFM/Settings.hs b/src/HSFM/Settings.hs index 9e18886..9d3a9c7 100644 --- a/src/HSFM/Settings.hs +++ b/src/HSFM/Settings.hs @@ -16,7 +16,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --} -{-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_HADDOCK ignore-exports #-} @@ -27,6 +26,7 @@ import Data.ByteString ( ByteString ) +import qualified Data.ByteString.UTF8 as BU import Data.Maybe import System.Posix.Env.ByteString import System.Posix.Process.ByteString @@ -49,11 +49,11 @@ import System.Posix.Process.ByteString terminalCommand :: ByteString -- ^ current directory of the FM -> IO a terminalCommand cwd = - executeFile -- executes the given command - "sakura" -- the terminal command - True -- whether to search PATH - ["-d", cwd] -- arguments for the command - Nothing -- optional custom environment: `Just [(String, String)]` + executeFile -- executes the given command + (BU.fromString "sakura") -- the terminal command + True -- whether to search PATH + [BU.fromString "-d", cwd] -- arguments for the command + Nothing -- optional custom environment: `Just [(String, String)]` -- |The home directory. If you want to set it explicitly, you might @@ -63,5 +63,5 @@ terminalCommand cwd = -- home = return "\/home\/wurst" -- @ home :: IO ByteString -home = fromMaybe <$> return "/" <*> getEnv "HOME" +home = fromMaybe <$> return (BU.fromString "/") <*> getEnv (BU.fromString "HOME")