Skip to content

Instantly share code, notes, and snippets.

@copumpkin
Created July 15, 2012 05:08
Show Gist options
  • Save copumpkin/3115103 to your computer and use it in GitHub Desktop.
Save copumpkin/3115103 to your computer and use it in GitHub Desktop.
Unit is not ()
{-# LANGUAGE TypeFamilies, GADTs, EmptyDataDecls #-}
data Empty
data Unit = Unit
data Equal a b where
Refl :: Equal a a
type family F a :: *
type instance F Unit = Unit
type instance F () = Empty
newtype Wrap a = Wrap { unwrap :: F a }
subst :: Equal a b -> p a -> p b
subst Refl = id
proof :: Equal Unit () -> Empty
proof eq = unwrap . subst eq . Wrap $ Unit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment