[commit: ghc] master: Another AMP fix for Stream (0537cb7)

git at git.haskell.org git at git.haskell.org
Tue Jan 14 09:47:27 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/0537cb7e35995cbfb7de2da4b742816328bb71ab/ghc

>---------------------------------------------------------------

commit 0537cb7e35995cbfb7de2da4b742816328bb71ab
Author: Austin Seipp <austin at well-typed.com>
Date:   Mon Jan 13 19:00:47 2014 -0600

    Another AMP fix for Stream
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


>---------------------------------------------------------------

0537cb7e35995cbfb7de2da4b742816328bb71ab
 compiler/utils/Stream.hs |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/compiler/utils/Stream.hs b/compiler/utils/Stream.hs
index bfc6f93..47cdee0 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))
 



More information about the ghc-commits mailing list