Would like to declare
data (Coord a) => Triangle a = Triangle{t0 :: a, t1 :: a, t2 :: a}
However I am getting
Geometry.hs:15:19:Kind mis-match Expected kind
* -> *', but
p' has kind*' In the class declaration for
Coord'
where Coord is defined as
class (Traversable p, Functor p, Foldable p, Applicative p) => Coord p where
getComponents :: Num a => p a -> [a]
getComponents = toList
fromComponents :: Num a => [a] -> p a
magSq :: Num a => p a -> a
magSq = Prelude.sum . map (\x -> x * x) . getComponents
dotProduct :: Num a => p a -> p a -> a
dotProduct a b = Prelude.sum $ zipWith (*) (getComponents a) (getComponents b)
Any ideas?
PS. Code is a slightly modified version of what is found in the Data.SG package