mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-12-01 06:12:57 +03:00
04e4ebf80e
It's a big patch, but the summary is that it's okay to use a pattern in an erased position if either: - the pattern can also be solved by unification (this is the same as 'dot patterns' for matching on non-constructor forms) - the argument position is detaggable w.r.t. non-erased arguments, which means we can tell which pattern it is without pattern matching The second case, in particular, means we can still pattern match on proof terms which turn out to be irrelevant, especially Refl. Fixes #178
16 lines
377 B
Idris
16 lines
377 B
Idris
data MyMaybe : (0 x : Type) -> Type where
|
|
MyNothing : MyMaybe a
|
|
MyJust : a -> MyMaybe a
|
|
|
|
-- Should fail since type argument is deleted
|
|
nameOf : Type -> String
|
|
nameOf (MyMaybe Bool) = "MyMaybe Bool"
|
|
nameOf (MyMaybe Int) = "MyMaybe Int"
|
|
nameOf _ = "Unknown"
|
|
|
|
main : IO ()
|
|
main = do
|
|
putStrLn (nameOf (MyMaybe Bool))
|
|
putStrLn (nameOf (MyMaybe Int))
|
|
putStrLn (nameOf Int)
|