Skip to content

Instantly share code, notes, and snippets.

@lmarburger
Created June 17, 2014 15:56
Show Gist options
  • Save lmarburger/13b949894dd488c93360 to your computer and use it in GitHub Desktop.
Save lmarburger/13b949894dd488c93360 to your computer and use it in GitHub Desktop.
Idris unit tests using the type checker
{-
From the Prelude: https://github.com/idris-lang/Idris-dev/blob/master/libs/prelude/Prelude/Bool.idr#L18-L27
data so : Bool -> Type where oh : so True
-}
-- Type checks fine
passTest : so (1 < 2)
passTest = oh
-- Fails to type check
failTest : so (2 < 1)
failTest = oh
{-
Type checking ./test.idr
test.idr:5:12:When elaborating right hand side of failTest:
Can't unify
so True
with
so False
Specifically:
Can't unify
True
with
False
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment