I am dabbing with simple monad transformers as presented in http://www.cs.nott.ac.uk/~nhn/MGS2006/LectureNotes/lecture03-9up.pdf
My error-handling transformer has type
newtype ET m a = ET (m (Maybe a))
I have implemented all the necessary plumbing and I am able to couple it with the identity monad (which in my little sandbox is called I) and write/compile non trivial functions.
But I am unable to print any resulting value onscreen. Message is:
No instance for (Show (ET I Value)) arising from a use of ‘print’
Maybe is imported. Both I and Value derive Show and display on their own without problems. It is the mix with ET that won't show. I see two ways:
- try to insert
deriving Showin the declaration ofET m a(which I tried in many ways obtaining a lot of different error messages) - create a showable instance dabbing with "Stand-alone deriving declarations", as suggested by some web resources - tried with no success so far.
How can I show an ET I Value in my REPL?
One of the purposes of standalone deriving is that sometimes the compiler cannot infer the required constraint to make a certain instance, even though the actual code is still derived mechanically. So you just need to know what constraint to give it: