summaryrefslogtreecommitdiff
path: root/default.nix
blob: b496745e490b5ab431b8b82b64e625cbde20865c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{ pkgs ? (import <nixpkgs> {})
, compilerName ? "ghc801"
}:

rec {
  # haskellPackages = pkgs.haskell.packages."${compilerName}";
  haskellPackages = pkgs.haskell.packages."${compilerName}".override {
    overrides = self: super: {
      Shellac = pkgs.haskell.lib.appendPatch super.Shellac (pkgs.writeText "build.patch" ''
        From 29c78ed6549525fefb04ae6f7cab8316ac59f3c4 Mon Sep 17 00:00:00 2001
        From: Gregor Kleen <gkleen@yggdrasil.li>
        Date: Thu, 2 Jun 2016 17:14:15 +0200
        Subject: [PATCH 1/2] Hiding <$> provided by newer versions of Prelude
        
        ---
         src/System/Console/Shell/PPrint.hs | 1 +
         1 file changed, 1 insertion(+)
        
        diff --git a/src/System/Console/Shell/PPrint.hs b/src/System/Console/Shell/PPrint.hs
        index e8ec520..8d271e1 100644
        --- a/src/System/Console/Shell/PPrint.hs
        +++ b/src/System/Console/Shell/PPrint.hs
        @@ -48,6 +48,7 @@ module System.Console.Shell.PPrint
                 ) where
         
         import System.IO      (Handle,hPutStr,hPutChar,stdout)
        +import Prelude hiding ((<$>))
         
         infixr 5 </>,<//>,<$>,<$$>
         infixr 6 <>,<+>
        -- 
        2.8.0
        
        
        From 74cb07ccfa92fdcdd6eb3c5871289796ea4981d5 Mon Sep 17 00:00:00 2001
        From: Gregor Kleen <gkleen@yggdrasil.li>
        Date: Thu, 2 Jun 2016 17:28:17 +0200
        Subject: [PATCH 2/2] Applicative instance for Sh
        
        ---
         src/System/Console/Shell/Types.hs | 2 +-
         1 file changed, 1 insertion(+), 1 deletion(-)
        
        diff --git a/src/System/Console/Shell/Types.hs b/src/System/Console/Shell/Types.hs
        index 4ec47a9..9efe4b4 100644
        --- a/src/System/Console/Shell/Types.hs
        +++ b/src/System/Console/Shell/Types.hs
        @@ -74,7 +74,7 @@ type OutputCommand = BackendOutput -> IO ()
         --   The type parameter @st@ allows the monad to carry around a package of
         --   user-defined state.
         newtype Sh st a = Sh { unSh :: StateT (CommandResult st) (ReaderT OutputCommand IO) a }
        -   deriving (Monad, MonadIO, MonadFix, Functor)
        +   deriving (Monad, MonadIO, MonadFix, Functor, Applicative)
         
         ------------------------------------------------------------------------
         -- The shell description and utility functions
        -- 
        2.8.0


        From 20e394aa3ea287fcaacde9c076c9f49929b28ece Mon Sep 17 00:00:00 2001
        From: Gregor Kleen <gkleen@yggdrasil.li>
        Date: Sat, 11 Jun 2016 22:06:36 +0200
        Subject: [PATCH] Allow modification of state in beforePrompt

        ---
         src/System/Console/Shell/RunShell.hs | 6 ++++--
         1 file changed, 4 insertions(+), 2 deletions(-)

        diff --git a/src/System/Console/Shell/RunShell.hs b/src/System/Console/Shell/RunShell.hs
        index 79ffb54..3e0b95b 100644
        --- a/src/System/Console/Shell/RunShell.hs
        +++ b/src/System/Console/Shell/RunShell.hs
        @@ -217,9 +217,11 @@ shellLoop desc backend iss = loop
            bst = backendState iss
 
            loop st = do
        -        flushOutput backend bst
        +     flushOutput backend bst
        +     
        +     runSh st (outputString backend bst) (beforePrompt desc) >>= loop' . fst
 
        -        runSh st (outputString backend bst) (beforePrompt desc)
        +   loop' st = do
                 setAttemptedCompletionFunction backend bst
                  (completionFunction desc backend bst st)
 
        -- 
        2.8.3
      '');
    };
  };
  sequence = haskellPackages.callPackage ./sequence.nix {};
}