nixpkgs/pkgs/development/haskell-modules/mueval-fix.patch
2015-06-12 03:42:29 +03:00

91 lines
3.4 KiB
Diff

diff --git a/Mueval/ArgsParse.hs b/Mueval/ArgsParse.hs
index 05c8fd9..0c32e27 100644
--- a/Mueval/ArgsParse.hs
+++ b/Mueval/ArgsParse.hs
@@ -1,10 +1,9 @@
+{-# LANGUAGE CPP #-}
module Mueval.ArgsParse (Options(..), interpreterOpts, getOptions) where
import Control.Monad (liftM)
import System.Console.GetOpt
-import qualified Codec.Binary.UTF8.String as Codec (decodeString)
-
import Mueval.Context (defaultModules, defaultPackages)
-- | See the results of --help for information on what each option means.
@@ -98,4 +97,11 @@ header = "Usage: mueval [OPTION...] --expression EXPRESSION..."
-- | Just give us the end result options; this parsing for
-- us. Bonus points for handling UTF.
getOptions :: [String] -> Either (Bool, String) Options
-getOptions = interpreterOpts . map Codec.decodeString
\ No newline at end of file
+getOptions = interpreterOpts . map decodeString
+
+decodeString :: String -> String
+#if __GLASGOW_HASKELL__ >= 702
+decodeString = id
+#else
+decodeString = Codec.decodeString
+#endif
diff --git a/Mueval/Context.hs b/Mueval/Context.hs
index 78925cf..548514c 100644
--- a/Mueval/Context.hs
+++ b/Mueval/Context.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
module Mueval.Context (
cleanModules,
defaultModules,
@@ -32,7 +33,9 @@ defaultModules = ["Prelude",
"Control.Monad.Error",
"Control.Monad.Fix",
"Control.Monad.Identity",
+#if !MIN_VERSION_base(4,7,0)
"Control.Monad.Instances",
+#endif
"Control.Monad.RWS",
"Control.Monad.Reader",
"Control.Monad.State",
diff --git a/Mueval/Interpreter.hs b/Mueval/Interpreter.hs
index 29b771f..6c39482 100644
--- a/Mueval/Interpreter.hs
+++ b/Mueval/Interpreter.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE PatternGuards #-}
+{-# LANGUAGE FlexibleContexts #-}
-- TODO: suggest the convenience functions be put into Hint proper?
module Mueval.Interpreter where
@@ -12,8 +13,6 @@ import System.Exit (exitFailure)
import System.FilePath.Posix (takeFileName)
import qualified Control.Exception.Extensible as E (evaluate,catch,SomeException(..))
-import qualified System.IO.UTF8 as UTF (putStrLn)
-
import Language.Haskell.Interpreter (eval, set, reset, setImportsQ, loadModules, liftIO,
installedModulesInScope, languageExtensions,
typeOf, setTopLevelModules, runInterpreter, glasgowExtensions,
@@ -100,7 +99,7 @@ mvload lfl = do canonfile <- makeRelativeToCurrentDirectory lfl
-- flooding. Lambdabot has a similar limit.
sayIO :: String -> IO ()
sayIO str = do (out,b) <- render 1024 str
- UTF.putStrLn out
+ putStrLn out
when b exitFailure
-- | Oh no, something has gone wrong. If it's a compilation error pretty print
diff --git a/mueval.cabal b/mueval.cabal
index 3f9406d..b86d796 100644
--- a/mueval.cabal
+++ b/mueval.cabal
@@ -32,7 +32,7 @@ library
exposed-modules: Mueval.Parallel, Mueval.Context, Mueval.Interpreter,
Mueval.ArgsParse, Mueval.Resources
build-depends: base>=4 && < 5, containers, directory, mtl>2, filepath, unix, process,
- hint>=0.3.1, show>=0.3, utf8-string, Cabal, extensible-exceptions, simple-reflect
+ hint>=0.3.1, show>=0.3, Cabal, extensible-exceptions, simple-reflect
ghc-options: -Wall -static
executable mueval-core