Skip to content

Instantly share code, notes, and snippets.

@RubenAstudillo
Created September 9, 2021 14:56
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 RubenAstudillo/6fb47a6dfe9238987c292c1894e2bfbe to your computer and use it in GitHub Desktop.
Save RubenAstudillo/6fb47a6dfe9238987c292c1894e2bfbe to your computer and use it in GitHub Desktop.
Trying to encode a Sigma like type on haskell with StandaloneKindSignatures
{-# 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