[Haskell-cafe] Problem with forall type in type declaration
Yves Parès
yves.pares at gmail.com
Fri May 4 10:32:37 CEST 2012
run :: Monad IO a -> IO a
Actually this type is wrong. Monad has to appear as a class constraint, for
instance :
run :: Monad m => m a -> IO a
Are you trying to make:
run :: IO a -> IO a
??
2012/5/4 Magicloud Magiclouds <magicloud.magiclouds at gmail.com>
> Hi,
> Assuming this:
> run :: Monad IO a -> IO a
> data Test = Test { f }
>
> Here I'd like to set f to run, like "Test run". Then what is the type of
> f?
> The confusing (me) part is that, the argument pass to f is not fixed
> on return type, like "f1 :: Monad IO ()", "f2 :: Monad IO Int". So
> "data Test a = Test { f :: Monad IO a -> IO a} does not work.
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>
> And for G+, please use magiclouds#gmail.com.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120504/f6d4eda6/attachment.htm>
More information about the Haskell-Cafe
mailing list