Skip to content

Instantly share code, notes, and snippets.

@ramirez7
Last active February 5, 2024 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramirez7/fc91fb05f20dddb6011d68b4f67a1d12 to your computer and use it in GitHub Desktop.
Save ramirez7/fc91fb05f20dddb6011d68b4f67a1d12 to your computer and use it in GitHub Desktop.
G X XX
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE LambdaCase #-}
import Data.Kind
data I a
data X a
data XX
type F :: (Type -> Type) -> Type -> Type
type family F f a where
F X a = XX
F I a = a
F f a = f a
data G f a where
GU :: G f (F f ())
gx :: forall a. G X a -> G X XX
gx = \case
GU -> GU
{-
-- Does not typecheck:
gx2 :: forall a. G X a -> a
gx2 = \case
GU -> ()
-}
gi :: forall a. G I a -> a
gi = \case
GU -> ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment