projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9d48543
)
Add Applicative instances for ST monads (proposal #4455)
author
Ross Paterson
<ross@soi.city.ac.uk>
Mon, 3 Jan 2011 18:57:22 +0000
(18:57 +0000)
committer
Ross Paterson
<ross@soi.city.ac.uk>
Mon, 3 Jan 2011 18:57:22 +0000
(18:57 +0000)
patch from Bas van Dijk
Control/Applicative.hs
patch
|
blob
|
history
diff --git
a/Control/Applicative.hs
b/Control/Applicative.hs
index
154b591
..
ab6b365
100644
(file)
--- a/
Control/Applicative.hs
+++ b/
Control/Applicative.hs
@@
-42,6
+42,8
@@
import Control.Arrow
(Arrow(arr, (&&&)), ArrowZero(zeroArrow), ArrowPlus((<+>)))
import Control.Monad (liftM, ap, MonadPlus(..))
import Control.Monad.Instances ()
(Arrow(arr, (&&&)), ArrowZero(zeroArrow), ArrowPlus((<+>)))
import Control.Monad (liftM, ap, MonadPlus(..))
import Control.Monad.Instances ()
+import Control.Monad.ST (ST)
+import qualified Control.Monad.ST.Lazy as Lazy (ST)
import Data.Functor ((<$>), (<$))
import Data.Monoid (Monoid(..))
import Data.Functor ((<$>), (<$))
import Data.Monoid (Monoid(..))
@@
-149,6
+151,14
@@
instance Applicative IO where
pure = return
(<*>) = ap
pure = return
(<*>) = ap
+instance Applicative (ST s) where
+ pure = return
+ (<*>) = ap
+
+instance Applicative (Lazy.ST s) where
+ pure = return
+ (<*>) = ap
+
#ifdef __GLASGOW_HASKELL__
instance Applicative STM where
pure = return
#ifdef __GLASGOW_HASKELL__
instance Applicative STM where
pure = return