Last active
February 5, 2024 21:19
-
-
Save ramirez7/fc91fb05f20dddb6011d68b4f67a1d12 to your computer and use it in GitHub Desktop.
G X XX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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