Created
July 15, 2015 17:43
-
-
Save edwinb/87ea863eb53b3cd7bbb5 to your computer and use it in GitHub Desktop.
Overenthusiastic erasure
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
-- This segfaults, due to an erased name being used in the case | |
-- block generated for the 'j'' binding | |
foo : Nat -> ((Int, String) -> Nat -> IO a) -> IO a | |
foo Z k = k (0, "End") Z | |
foo (S j) k = foo j (\(i', s'), j' => k (i'+1, s') j') | |
-- This doesn't segfault, since Idris treats the \j' as an ordinary binder | |
-- rather than a pattern matching one. | |
foo' : Nat -> ((Int, String) -> Nat -> IO a) -> IO a | |
foo' Z k = k (0, "End") Z | |
foo' (S j) k = foo j (\(i', s') => \ j' => k (i'+1, s') j') | |
main : IO () | |
main = foo 1 (\_, _ => putStrLn "End") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment