Skip to content

Instantly share code, notes, and snippets.

@dmwit
Created September 14, 2018 20:59
Show Gist options
  • Save dmwit/cf9154e425665bac2516ccf847971f36 to your computer and use it in GitHub Desktop.
Save dmwit/cf9154e425665bac2516ccf847971f36 to your computer and use it in GitHub Desktop.
Foo ('A | 'B)
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE TypeApplications #-}
data K = A | B | C
data Foo a where
FooAny :: Foo a
FooAB :: Foo (Fam a)
FooC :: Foo C
type family Fam a where
Fam C = A
Fam x = x
example = FooAB @A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment