Haskell home-made monad transformer unable to Show itself in GHCi -
i dabbing simple monad transformers presented in http://www.cs.nott.ac.uk/~nhn/mgs2006/lecturenotes/lecture03-9up.pdf
my error-handling transformer has type
newtype et m = et (m (maybe a))
i have implemented necessary plumbing , able couple identity monad (which in little sandbox called i
) , write/compile non trivial functions.
but unable print resulting value onscreen. message is:
no instance (show (et value)) arising use of ‘print’
maybe
imported. both i
, value
derive show
, display on own without problems. mix et
won't show. see 2 ways:
- try insert
deriving show
in declaration ofet m a
(which tried in many ways obtaining lot of different error messages) - create showable instance dabbing "stand-alone deriving declarations", suggested web resources - tried no success far.
how can show et value
in repl?
one of purposes of standalone deriving compiler cannot infer required constraint make instance, though actual code still derived mechanically. need know constraint give it:
{-# language standalonederiving, undecidableinstances #-} newtype et m = et (m (maybe a)) deriving instance show (m (maybe a)) => show (et m a)
Comments
Post a Comment