[Haskell-cafe] Problem with forall type in type declaration

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Fri May 4 10:34:42 CEST 2012


Sorry, it was just a persudo code. This might be more clear:

run :: (Monad m) => m IO a -> IO a

On Fri, May 4, 2012 at 4:32 PM, Yves Parès <yves.pares at gmail.com> wrote:
> 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
>
>



-- 
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.



More information about the Haskell-Cafe mailing list