-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy path0001-Fix-compiling-with-GHC-7.10.patch
63 lines (57 loc) · 1.99 KB
/
0001-Fix-compiling-with-GHC-7.10.patch
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
From c16ae8ee727d09ded02cd835f4726c6195104ad4 Mon Sep 17 00:00:00 2001
From: Paulo Lieuthier <[email protected]>
Date: Thu, 21 May 2015 16:01:51 -0300
Subject: [PATCH] Fix compiling with GHC 7.10
Add implementaion of Applicative's and Functor's functions for the
StateTransformer Monad, required after the Applicative-Monad proposal.
And make explicit use of FlexibleContexts as well, for GHC 7.10.
Applicative is now part of Prelude, but an import statement was added
for it to maitain compatibility with previous versions of GHC.
---
SSInterpreter.hs | 9 +++++++++
SSParser.hs | 3 ++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/SSInterpreter.hs b/SSInterpreter.hs
index 40b7670..f78c62f 100644
--- a/SSInterpreter.hs
+++ b/SSInterpreter.hs
@@ -31,6 +31,7 @@ Last update: December 17th 2012
module Main where
import System.Environment
import Control.Monad
+import Control.Monad hiding (empty)
import Data.Map as Map
import LispVal
import SSParser
@@ -243,7 +244,15 @@ instance Monad StateTransformer where
(ST resF) = f v
in resF newS
)
+
+instance Functor StateTransformer where
+ fmap = liftM
+
+instance Applicative StateTransformer where
+ pure = return
+ (<*>) = ap
+
-----------------------------------------------------------
-- HARDWIRED PREDEFINED LISP FUNCTIONS --
-----------------------------------------------------------
diff --git a/SSParser.hs b/SSParser.hs
index f072002..1846a31 100644
--- a/SSParser.hs
+++ b/SSParser.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE FlexibleContexts #-}
+
module SSParser(readExpr) where
import LispVal
import Text.ParserCombinators.Parsec hiding ( spaces )
@@ -111,4 +113,3 @@ readExpr input = case parse parseExpr "Scheme" input of
Left err -> Error (show err)
Right val -> val
-
\ No newline at end of file
--
2.4.1