[Haskell-cafe] instance for (Show ([(String, Int)] -> Int))

Aaron Gray aaronngray.lists at gmail.com
Fri Dec 24 19:17:51 CET 2010


How do I code an 'instance' declaration for '(Show ([(String, Int)] ->
Int))'.

I am new to instance declarations and am following the Happy examples :-

    http://www.haskell.org/happy/doc/html/sec-using.html#sec-other-datatypes

The compiler is requesting an instance declaration for Show :-

  expr-eval.hs:334:23:
      No instance for (Show ([(String, Int)] -> Int))
        arising from a use of `print' at expr-eval.hs:334:23-27
      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

Many thanks in advance,

Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101224/071a12f8/attachment.htm>


More information about the Haskell-Cafe mailing list