I wanted to use DotM to build up a transformer stack so I could do something like this:
newtype StashStore s a = StashStore { runStashStore :: ExceptT String (StateT s (DotM NodeId)) a }
deriving (Functor, Applicative, Monad, MonadState s, MonadFail, MonadError String)
I needed to throwError when graph could not be built for some reason. Sadly I was thwarted because I don't see a way to get the computation result out of DotM. runDot needs to be exposed for this. Relatedly, execDot uses snd which discards the computation result. This caused me some confusion because the change that introduced ExceptT wasn't broken by my failure to handle the error.
This patch is enough to solve my problem. I had to copy a bit of code from makeGraph into my program.
I wanted to use
DotM
to build up a transformer stack so I could do something like this:I needed to
throwError
when graph could not be built for some reason. Sadly I was thwarted because I don't see a way to get the computation result out ofDotM
. runDot needs to be exposed for this. Relatedly,execDot
usessnd
which discards the computation result. This caused me some confusion because the change that introducedExceptT
wasn't broken by my failure to handle the error.This patch is enough to solve my problem. I had to copy a bit of code from
makeGraph
into my program.