Created
November 17, 2016 21:00
-
-
Save mattyw/972cb3a002b01ed6dbbde6a473d9cecc to your computer and use it in GitHub Desktop.
Something wrong with my dependent types
This file contains hidden or 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
data Even = E Nat | |
data Odd = O Nat | |
data Num = Ev Nat | Od Nat | |
NumType : Num -> Type | |
NumType (Ev k) = Even | |
NumType (Od k) = Odd | |
mkEven : Nat -> Num | |
mkEven x = case (x `mod` 2) == 0 of | |
True => Ev x | |
False => Od x | |
thing : Nat -> Type | |
thing = NumType . mkEven | |
isEven: (x : Nat) -> thing x -> String | |
isEven Z y = "even" | |
isEven (S k) y = ?isEven_rhs_1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment