[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] A catch-all MonadIO instance
From:       Bas van Dijk <v.dijk.bas () gmail ! com>
Date:       2011-10-28 16:46:33
Message-ID: CADLz5wV7vMRXr6j-H57rwm19FHFDR_3v_jEdKuU4g-9R50aZeQ () mail ! gmail ! com
[Download RAW message or body]

On 28 October 2011 16:59, Ertugrul Soeylemez <es@ertes.de> wrote:
> I'm not sure whether this will work well.   You will get overlapping
> instances, and I don't see a way to hide instances when importing.
> Perhaps the OverlappingInstances extension could help here.

You're right.

I didn't get an overlapping instances error when building transformers
with this change (Note I didn't remove the custom MonadIO instances).

However when *using* liftIO I did get it:

> runReaderT (liftIO $ putStrLn "Hello World!") (10 :: Int)

<interactive>:0:13:
    Overlapping instances for MonadIO (ReaderT Int m0)
      arising from a use of `liftIO'
    Matching instances:
      instance MonadIO m => MonadIO (ReaderT r m)
        -- Defined at Control/Monad/Trans/Reader.hs:128:10-45
      instance (MonadTrans t, Monad (t m), MonadIO m) => MonadIO (t m)
        -- Defined at Control/Monad/IO/Class.hs:43:10-64

Enabling the OverlappingInstances extension does fix it. However I
don't want to force users to use it so I keep the custom instances.

Thanks,

Bas

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic