Snippet saved on:
4/5/2025, 3:38:18 PM (raw)
4/5/2025, 3:38:18 PM (raw)
LANGUAGE
moduleMainwhere
importData.KindType
data Tag = A | B | C
data STag tag where
SA :: STag A
SB :: STag B
SC :: STag C
-- class Fam (tag :: Tag) (t :: Type) | tag -> t where
-- instance {-# OVERLAPPABLE #-} Fam a Bool where
-- instance {-# INCOHERENT #-} Fam A Int where
type family Fam tag where
Fam A = Int
Fam _ = Bool
classFootagTagwhere
foo::STagtag->Famtag
instanceFamtagBool=>Footagwhere
foo _ = True
instanceFooAwhere
foo _ = 42
main = print "hello"
-- foo :: forall tag a. STag tag -> Fam tag
-- foo SA = 42 :: Int
-- foo _ = True :: Bool
GHC output
Errors
Output