[Haskell-cafe] How to "instance MonadIO Identity"?

Michael Snoyman michael at snoyman.com
Tue Dec 28 06:32:35 CET 2010


The only way to create such an instance would be with unsafePerformIO,
which in this case would be a Very Bad Idea (tm).

Michael

On Tue, Dec 28, 2010 at 7:29 AM, Magicloud Magiclouds
<magicloud.magiclouds at gmail.com> wrote:
> Hi,
>  From another thread in this list, I got code as:
>> instance MonadIO Identity where
>>     liftIO = id
>  Well, it does not work for me as:
> Message.hs:22:12:
>    Couldn't match expected type `Identity a' with actual type `IO a'
>    Expected type: IO a -> Identity a
>      Actual type: IO a -> IO a
>    In the expression: id
>    In an equation for `liftIO': liftIO = id
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list