Your use GADTwith implicit forallcauses you grief. This is a good time to mention the "existential quantification using typeclass" anti-pattern
Since you included the restriction RealFrac ain the definition PointSet, you are implicitly using the forallfollowing:
data PointSet a where
Halfplane :: forall a. RealFrac a => a -> a -> a -> (a -> a -> Bool) -> a -> PointSet HalfPlane
Ellipsoid :: forall a. RealFrac a => ...
TestFunc:
type TestFunc = forall a. RealFrac a => a -> a -> a -> Bool
GHC RankNTypes.
- forall a PointSet a TestFunc, a in PointSet RealFrac, TestFunc - , a.
a forall a. a GHC a a1.
? . , , :
{-# LANGUAGE DataKinds, GADTs, KindSignatures #-}
data Shape = Halfplane | Ellipsoid -- promoted via DataKinds
data PointSet (s :: Shape) a where
Halfplane :: a -> a -> a -> (a -> a -> Bool) -> a -> PointSet Halfplane a
Ellipsoid :: ...
type TestFunc a = a -> a -> a -> Bool
ellipsoid :: RealFrac a => PointSet Ellipsoid a -> TestFunc a
ellipsoid (Ellipsoid a b c f r) = f' where f' = ...
PointSet 2 : phantom s :: Shape, Shape ( - ) a, , PointSet, .
, a a1 " RealFrac. RealFrac , . a a1 , RealFrac.
, PointSet, .
data PointSet a
= Halfplane a a a (a -> a -> Bool) a
| Ellipsoid a a a (a -> a -> Bool) a
testFunc :: RealFrac a => PointSet a -> TestFunc a
testFunc (Ellipsoid a b c f r) = f' where f' = ...
testFunc (Halfplane a b c f t) = f' where f' = ...