I’m trying to derive MonadFree
from a newtype
and I just can’t work it out. My current code is:
newtype ApplicationStack s r p m =
ApplicationStack { runApplication :: StateT s (ReaderT r p) m }
deriving (Functor, Applicative, Monad, MonadState s, MonadReader r)
deriving instance MonadFree f p => MonadFree f (ApplicationStack s r p)
and I get
• Could not deduce (transformers-0.5.5.0:Control.Monad.Trans.Class.MonadTrans
(ApplicationStack s r))
arising from a use of ‘Control.Monad.Free.Class.$dmwrap’
from the context: MonadFree f p
bound by the instance declaration
at src/Application/Commands/Base.hs:41:10-62
• In the expression:
Control.Monad.Free.Class.$dmwrap @(f) @(ApplicationStack s r p)
In an equation for ‘Control.Monad.Free.Class.wrap’:
Control.Monad.Free.Class.wrap
= Control.Monad.Free.Class.$dmwrap @(f) @(ApplicationStack s r p)
In the instance declaration for
‘MonadFree f (ApplicationStack s r p)’
|
41 | instance MonadFree f p => MonadFree f (ApplicationStack s r p)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If anyone has any suggestions that would be really appreciated.