
Hi. Just a brief question. System.IO functions are defined in IO monad and have signatures like Foo -> IO Bar. Would it be better to have all of them defined as (MonadIO m) => Foo -> m Bar? What are the problems that would arise? Sergey

On 12 September 2012 18:24, Sergey Mironov
Hi. Just a brief question. System.IO functions are defined in IO monad and have signatures like Foo -> IO Bar. Would it be better to have all of them defined as (MonadIO m) => Foo -> m Bar? What are the problems that would arise?
That would require MonadIO being defined in base, and might make some existing code fail due to lack of type signatures (though I suppose you could specify a default). -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com

On 12 September 2012 19:55, Ivan Lazar Miljenovic
On 12 September 2012 18:24, Sergey Mironov
wrote: Hi. Just a brief question. System.IO functions are defined in IO monad and have signatures like Foo -> IO Bar. Would it be better to have all of them defined as (MonadIO m) => Foo -> m Bar? What are the problems that would arise?
That would require MonadIO being defined in base, and might make some existing code fail due to lack of type signatures (though I suppose you could specify a default).
Oh, and you'd still need to define them all somewhere to work _for_ IO so you can then have the liftIO variants anyway.
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com
participants (2)
-
Ivan Lazar Miljenovic
-
Sergey Mironov