Sunday, 11 August 2013

Show for a constructor

Show for a constructor

Why does it complain about this code:
data Point = Point {
x, y :: Int
} deriving (Show)
main = print $ Point (15 20)
by saying:
No instance for (Show (Int -> Point))
arising from a use of `print'
Possible fix: add an instance declaration for (Show (Int -> Point))

No comments:

Post a Comment