Trying to compile Haskell.Happy example here: http://www.haskell.org/happy/doc/html/sec-using.html#sec-other-datatypes, after generating .hs file with happy, I'm getting the
No instance for (Show ([String, Int)] -> Int
error, trying to compile it, while first part of the example compiled and run fine
what am I doing wrong?
Edit: Full error message
No instance for (Show ([(String, Int)] -> Int))
arising from a use of `print'
Possible fix:
add an instance declaration for (Show ([(String, Int)] -> Int))
In the first argument of `(.)', namely `print'
In the second argument of `(>>=)', namely `print . calc . lexer'
In the expression: getContents >>= print . calc . lexer
I'm running
ghc example.hs
and the line is
main = getContents >>= print . calc . lexer
The possible duplicate question's answer is to pass an environment, but how could I do it here?