Proposal: instance MonadIO Q

Ryan Scott at
Thu Jul 23 16:16:39 UTC 2015

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
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.


More information about the Libraries mailing list