-
-
Save JavierGelatti/3025938e81471b625c8276c49ab3614d to your computer and use it in GitHub Desktop.
Example of type checker not being able to unify stuff after inlining a function
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
data IsEmpty : List Char -> Type where | |
Empty : IsEmpty [] | |
Uninhabited (IsEmpty (x::xs)) where | |
uninhabited Empty impossible | |
decideIsEmpty : (cs : List Char) -> Dec (IsEmpty cs) | |
decideIsEmpty cs = case cs of | |
[] => Yes Empty | |
(x :: xs) => No uninhabited | |
decideIsEmptyString : (s : String) -> Dec (IsEmpty (unpack s)) | |
decideIsEmptyString s = decideIsEmpty (unpack s) | |
decideIsEmptyString' : (s : String) -> Dec (IsEmpty (unpack s)) | |
decideIsEmptyString' s = case unpack s of | |
[] => Yes Empty | |
(x :: xs) => No uninhabited | |
decideIsEmptyString'' : (s : String) -> Dec (IsEmpty (unpack s)) | |
decideIsEmptyString'' s = case unpack s of | |
[] => Yes Empty | |
(x :: xs) => No ?_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment