Skip to content

Instantly share code, notes, and snippets.

@stedolan
Last active March 26, 2024 17:44
Show Gist options
  • Save stedolan/f2c58c02554cfe09afcf20e9dda843a3 to your computer and use it in GitHub Desktop.
Save stedolan/f2c58c02554cfe09afcf20e9dda843a3 to your computer and use it in GitHub Desktop.
{-# LANGUAGE GADTs #-}
-- nontermination without any recursion, even in types
-- possible because of impredicativity + injectivity
-- based on https://gist.github.com/leodemoura/0c88341bb585bf9a72e6
-- see also https://github.com/idris-lang/Idris-dev/issues/3687
data False
data I (f :: * -> *) where
data P (x :: *) where
MkP :: (a (I a) -> False) -> P (I a)
falsePIP :: P (I P) -> False
falsePIP h@(MkP np) = np h
false :: a
false = case falsePIP (MkP falsePIP) of {}
main = putStrLn false
@stedolan
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment