Created
September 9, 2021 14:56
-
-
Save RubenAstudillo/6fb47a6dfe9238987c292c1894e2bfbe to your computer and use it in GitHub Desktop.
Trying to encode a Sigma like type on haskell with StandaloneKindSignatures
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 RankNTypes, PolyKinds, TypeFamilies, GADTs, StandaloneKindSignatures, DataKinds #-} | |
module Main where | |
import Data.Kind (Type) | |
import Data.Functor.Identity | |
main :: IO () | |
main = return () | |
type Tag :: Bool -> Type | |
data Tag b where | |
STrue :: Tag True | |
SFalse :: Tag False | |
type ApplyTag :: Bool -> Type | |
type family ApplyTag t where | |
ApplyTag 'True = Int | |
ApplyTag 'False = Char | |
type Sigma :: forall k. (k -> Type) -> (k -> Type) -> Type | |
data Sigma t f where | |
(:&:) :: forall t f a. t a -> f a -> Sigma t f | |
ex :: Sigma Tag ApplyTag | |
ex = STrue :&: 27 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment