I am trying to write an fmap for this type
data Triangle a = Triangle {t0 :: Point a, t1 :: Point a, t2 :: Point a}
where Point is defined as
data Point a = Point {px :: a, py :: a, pz :: a}
And my instance def is
instance Functor Triangle where
fmap f (Triangle v0 v1 v2) = Triangle (f v0) (f v1) (f v2)
I am getting the following compliation error and I can't figure out why
C:\Scripts\Haskell\Geometry.hs:88:1: Occurs check: cannot construct the infinite type: a = Point a When generalising the type(s) for `fmap' In the instance declaration for `Functor Triangle'
Any ideas?