Created
May 5, 2014 13:51
-
-
Save stew/11537219 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module natToBin | |
data Parity : Nat -> Type where | |
even : Parity (n + n) | |
odd : Parity (S (n + n)) | |
parity : (n:Nat) -> Parity n | |
natToBin : Nat -> List Bool | |
natToBin Z = Nil | |
natToBin k with (parity k) | |
natToBin (j + j) | even = False :: natToBin j | |
natToBin (S (j + j)) | odd = True :: natToBin j | |
-- - + Errors (1) | |
-- `-- foo.idr line 12 col 3: | |
-- j is not an accessible pattern variable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment