Skip to content

Instantly share code, notes, and snippets.

@Peaker
Last active August 29, 2015 14:25
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 Peaker/e1afbbcaf71b9c0cdb40 to your computer and use it in GitHub Desktop.
Save Peaker/e1afbbcaf71b9c0cdb40 to your computer and use it in GitHub Desktop.
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
module KTuple where
type family Fst (xs :: (a, b)) :: a where
Fst '(x, y) = x
type family Snd (xs :: (a, b)) :: a where
Snd '(x, y) = y
type T = '(Int, String)
data Foo a r = Pure a (Fst r) | Foo (Foo a r)
newtype Fix f = Fix { unFix :: f '(Fix f, Fix f) }
type Foo' a b = Fix (Foo a)
foo :: () -> Snd T
foo _ = "Hello"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment