diff options
-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)) |