Skip to content

Instantly share code, notes, and snippets.

@Gabriella439
Created January 3, 2021 16:28
Show Gist options
  • Save Gabriella439/aef53d16d7418ba34b16aded0795333f to your computer and use it in GitHub Desktop.
Save Gabriella439/aef53d16d7418ba34b16aded0795333f to your computer and use it in GitHub Desktop.
Church-encoding of Bool type
{-# LANGUAGE RankNTypes #-}
import Prelude hiding (Bool(..))
type Bool = forall a . a -> a -> a
false :: Bool
false = \true_ false_ -> false_
true :: Bool
true = \true_ false_ -> true_
ifThenElse :: Bool -> a -> a -> a
ifThenElse b = b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment