
Template Haskell currently has runIO :: IO a -> Q a , which allows you to run IO actions with a guarantee of IO effects' ordering in a single splice (but not necessarily the order in which all the Q splices are run). If runIO is indeed a monad morphism, then there is a law-abiding MonadIO Q instance that could be added to transformers: instance MonadIO Q where liftIO = runIO This would be useful for dealing with monad transformer stacks with Q as the base monad (for an example, see genifunctors (https://github.com/danr/genifunctors/blob/4677bb57423b1b380ce9b50cc3d765a5c4...). The only catch is that transformers would have to depend on template-haskell. I think this would be okay since no quasiquotation is involved, but I wanted to hear others' opinions. Ryan

I'm very much in the "Damn the torpedoes; full speed ahead" camp most of
the time, but not here. Transformers is a tiny step up from base. Why would
you make it depend on template haskell rather than the other way around?
On Jul 23, 2015 12:17 PM, "Ryan Scott"
Template Haskell currently has runIO :: IO a -> Q a , which allows you to run IO actions with a guarantee of IO effects' ordering in a single splice (but not necessarily the order in which all the Q splices are run). If runIO is indeed a monad morphism, then there is a law-abiding MonadIO Q instance that could be added to transformers:
instance MonadIO Q where liftIO = runIO
This would be useful for dealing with monad transformer stacks with Q as the base monad (for an example, see genifunctors ( https://github.com/danr/genifunctors/blob/4677bb57423b1b380ce9b50cc3d765a5c4... ). The only catch is that transformers would have to depend on template-haskell. I think this would be okay since no quasiquotation is involved, but I wanted to hear others' opinions.
Ryan _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

I'd also like to mention that there's a camp of people who'd like to have a safe/pure version of TH that cannot do any IO - for changes like the proposed one we should check whether they'd make that more difficult. On 23/07/15 20:09, David Feuer wrote:
I'm very much in the "Damn the torpedoes; full speed ahead" camp most of the time, but not here. Transformers is a tiny step up from base. Why would you make it depend on template haskell rather than the other way around?

Alternately we could lift MonadIO into base.
This could be used eventually to lift more computations into MonadIO. Then
nobody incurs an extra dependency and we have a first step towards more
generic IO operations.
-Edward
On Thu, Jul 23, 2015 at 3:20 PM, Niklas Hambüchen
I'd also like to mention that there's a camp of people who'd like to have a safe/pure version of TH that cannot do any IO - for changes like the proposed one we should check whether they'd make that more difficult.
On 23/07/15 20:09, David Feuer wrote:
I'm very much in the "Damn the torpedoes; full speed ahead" camp most of the time, but not here. Transformers is a tiny step up from base. Why would you make it depend on template haskell rather than the other way around?
Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

Personally I'd think it sensible to push down Control.Monad.Trans.Class,
Control.Monad.Trans.Reader, and Control.Monad.Trans.State.Strict into base.
I don't know if any Writer or RWST variants are quite ready for that sort
of treatment, and ListT obviously isn't.
On Jul 23, 2015 3:55 PM, "Edward Kmett"
Alternately we could lift MonadIO into base.
This could be used eventually to lift more computations into MonadIO. Then nobody incurs an extra dependency and we have a first step towards more generic IO operations.
-Edward
On Thu, Jul 23, 2015 at 3:20 PM, Niklas Hambüchen
wrote: I'd also like to mention that there's a camp of people who'd like to have a safe/pure version of TH that cannot do any IO - for changes like the proposed one we should check whether they'd make that more difficult.
On 23/07/15 20:09, David Feuer wrote:
I'm very much in the "Damn the torpedoes; full speed ahead" camp most of the time, but not here. Transformers is a tiny step up from base. Why would you make it depend on template haskell rather than the other way around?
Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

I'd hesitate to bring in MonadTrans or the rest of transformers into base,
but MonadIO is fully non-controversial and fully Haskell 98.
Lifting up and dropping that *one* module into base is a fairly simple
change.
SPJ made a suggestion of adopting some more of the Data.Functor.* modules
into base a year or so back. We took him up on the idea of Identity, but
punted on the remainder. It may make sense to put together a separate
proposal for the integration of Data.Functor.{Sum, Product, Compose}.
I would only support either proposal if they brought the modules in
unmolested, without bikeshedding.
This would leave the "transformers" in the transformers package.
There are reasons not to like the existing MonadTrans class and reasons as
well not to change it. There is also no need for it in base, nothing in
base is set up in a fashion that it'd even be possible to make use of it to
generalize any existing signatures.
-Edward
On Thu, Jul 23, 2015 at 4:08 PM, David Feuer
Personally I'd think it sensible to push down Control.Monad.Trans.Class, Control.Monad.Trans.Reader, and Control.Monad.Trans.State.Strict into base. I don't know if any Writer or RWST variants are quite ready for that sort of treatment, and ListT obviously isn't. On Jul 23, 2015 3:55 PM, "Edward Kmett"
wrote: Alternately we could lift MonadIO into base.
This could be used eventually to lift more computations into MonadIO. Then nobody incurs an extra dependency and we have a first step towards more generic IO operations.
-Edward
On Thu, Jul 23, 2015 at 3:20 PM, Niklas Hambüchen
wrote: I'd also like to mention that there's a camp of people who'd like to have a safe/pure version of TH that cannot do any IO - for changes like the proposed one we should check whether they'd make that more difficult.
On 23/07/15 20:09, David Feuer wrote:
I'm very much in the "Damn the torpedoes; full speed ahead" camp most of the time, but not here. Transformers is a tiny step up from base. Why would you make it depend on template haskell rather than the other way around?
Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

On Thu, Jul 23, 2015 at 1:35 PM, Edward Kmett
I'd hesitate to bring in MonadTrans or the rest of transformers into base, but MonadIO is fully non-controversial and fully Haskell 98.
Doesn't GHC internally have its own MonadIO? I remember being really confused by type errors from the GHC API until I figured out that the MonadIO it used was not the one I was expecting. It would be nice to merge those.
participants (5)
-
David Feuer
-
Edward Kmett
-
Evan Laforge
-
Niklas Hambüchen
-
Ryan Scott