kazu-yamamoto/ghc-mod — pull request #244 by DanielG (2014-05-03 03:08:11+00:00)
Title: ghc-mod deserves it's own monad

Having to call `findCradle` and `initializeFlagsWithCradle` everywhere
we interact with ghc-mod's API doesn't seem very Haskell-like to me I
think we should provide a Monad that has a run function that already
does all those tedious tasks for us.

The `GhcMod` monad is basically a wrapper around `RWST r w s IO` with an
instance for `GhcMonad`

Having a `Reader` allows us to pass `Options` to runGhcMod and not have
to worry about passing it everywhere, `Cradle` is also stored in the
reader environment on initialization.

Writer and State are just there for future use.

I've included a `toGhcMod` function that turns a `Ghc a` into a `GhcMod a`
this will make it easy to transition everyting to using the `GhcMod`
monad instead of `Ghc` without breaking the build or test suite for
extended periods of time.

This pull request depends on #233 so ignore all commits below up to 743aeda