Restricted Data Types: A reformulation

John Meacham john at repetae.net
Tue Feb 7 23:20:36 EST 2006


I'll give the full desugaring, perhaps that will make it more clear:

>  foo :: (Monad m) => m Int
>  foo = return id >>= (\i -> return (i 7))
> 
>  fooSet :: Set Int
>  fooSet = foo

mkMonadDictSet :: EqDict a -> MonadDict Set
eqDictInt :: EqDict Int

return :: MoandDict m -> a -> m a

foo :: MonadDict m -> m Int
foo monadDict = (>>=) monadDict 
        (return monadDict id) 
        (\i -> return monadDict (i 7))


fooSet :: Set Int
fooSet = foo (mkMonadDictSet eqDictInt)

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-prime mailing list