Problem when trying to define Show for my Point3D type in Haskell

Posted by devoured elysium on Stack Overflow See other posts from Stack Overflow or by devoured elysium
Published on 2011-01-14T10:53:34Z Indexed on 2011/01/14 12:53 UTC
Read the original article Hit count: 170

I am trying to define Show for my Point3D type:

type Point3D = (Integer, Integer, Integer)

instance Show Point3D where
    show (x,y,z) = "<" ++ (show x) ++ "," ++ (show y) ++ "," ++ (show z) ++ ">"

yet I must be missing something in the sintax, as I am always getting an error:

Illegal instance declaration for `Show Point3D'

    (All instance types must be of the form (T t1 ... tn)
     where T is not a synonym.
     Use -XTypeSynonymInstances if you want to disable this.)
In the instance declaration for `Show Point3D'

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about haskell

Related posts about functional-programming