1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-03-17 09:32:50 +00:00

mueval: add patch until release is pushed to Hackage

This commit is contained in:
Nikolay Amiantov 2015-06-12 03:22:50 +03:00
parent 2156937166
commit 6cc817cf51
3 changed files with 91 additions and 6 deletions

View file

@ -760,7 +760,7 @@ self: super: {
dyre = appendPatch super.dyre ./dyre-nix.patch;
# https://github.com/gwern/mueval/issues/9
mueval = markBrokenVersion "0.9.1.1" super.mueval;
mueval = appendPatch super.mueval ./mueval-fix.patch;
# Test suite won't compile against tasty-hunit 0.9.x.
zlib = dontCheck super.zlib;

View file

@ -116,11 +116,6 @@ self: super: {
# https://github.com/kazu-yamamoto/unix-time/issues/30
unix-time = dontCheck super.unix-time;
# Until the changes have been pushed to Hackage
mueval = appendPatch super.mueval (pkgs.fetchpatch {
url = "https://github.com/gwern/mueval/commit/c41aa40ed63b74c069d1e4e3caa8c8d890cde960.patch";
sha256 = "0h1lx4z15imq009k0qmwkn5l3hmigw463ahvwffdnszi2n618kpg";
});
present = appendPatch super.present (pkgs.fetchpatch {
url = "https://github.com/chrisdone/present/commit/6a61f099bf01e2127d0c68f1abe438cd3eaa15f7.patch";
sha256 = "1vn3xm38v2f4lzyzkadvq322f3s2yf8c88v56wpdpzfxmvlzaqr8";

View file

@ -0,0 +1,90 @@
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