diff options
author | Austin Seipp <austin@well-typed.com> | 2014-01-13 19:00:47 -0600 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-01-14 03:46:08 -0600 |
commit | 0537cb7e35995cbfb7de2da4b742816328bb71ab (patch) | |
tree | f6bf4959ea7498b2e5c906c0db2cabd243784763 | |
parent | 10d36f3cb20a85a5cf7f11ba1d6a0ac1bb6b1a7f (diff) | |
download | haskell-0537cb7e35995cbfb7de2da4b742816328bb71ab.tar.gz |
Another AMP fix for Stream
Signed-off-by: Austin Seipp <austin@well-typed.com>
-rw-r--r-- | compiler/utils/Stream.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/utils/Stream.hs b/compiler/utils/Stream.hs index bfc6f939b5..47cdee0789 100644 --- a/compiler/utils/Stream.hs +++ b/compiler/utils/Stream.hs @@ -11,6 +11,8 @@ module Stream ( collect, fromList, Stream.map, Stream.mapM, Stream.mapAccumL ) where +import Control.Monad +import Control.Applicative -- | -- @Stream m a b@ is a computation in some Monad @m@ that delivers a sequence @@ -37,6 +39,13 @@ module Stream ( -- newtype Stream m a b = Stream { runStream :: m (Either b (a, Stream m a b)) } +instance Monad f => Functor (Stream f a) where + fmap = liftM + +instance Monad m => Applicative (Stream m a) where + pure = return + (<*>) = ap + instance Monad m => Monad (Stream m a) where return a = Stream (return (Left a)) |