Last active
March 17, 2019 01:16
-
-
Save jjant/7f77fb276e3e71ecb3b88659e67dc517 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 TypeOperators, GADTs, DataKinds, KindSignatures #-} | |
import Data.Kind (Type) | |
data HList :: [Type] -> Type where | |
Empty :: HList [] | |
HCons :: t -> HList ts -> HList (t ': ts) | |
myTuple2 :: HList '[Int, String] -- Analogous to (Int, String) | |
myTuple2 = HCons 2 (HCons "Hi!" Empty) | |
myTuple3 :: HList '[Bool, Int, Int -> Int] -- Analogous to (Bool, Int, Int -> Int) | |
myTuple3 = HCons True (HCons 1 (HCons (\x -> x + 2) Empty)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment