Skip to content

Instantly share code, notes, and snippets.

@ion1
Created April 9, 2015 17:32
Show Gist options
  • Select an option

  • Save ion1/9803dbd77cf88147bde7 to your computer and use it in GitHub Desktop.

Select an option

Save ion1/9803dbd77cf88147bde7 to your computer and use it in GitHub Desktop.
Law of Excluded Middle in Cont
-- Law of Excluded Middle in Cont
import Data.Void
import Control.Monad.Cont
type Not f a = a -> f Void
type Either' r a b = (a -> r) -> (b -> r) -> r
hello :: String
hello =
(`runCont` id) $
lem (\f -> (vacuous . f) "hello")
pure
lem :: MonadCont f => Either' (f r) (Not f a) a
lem left right = callCC (\k -> left (k <=< right))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment