Created
September 29, 2014 21:15
-
-
Save channingwalton/ddcba133f3896781ce7c to your computer and use it in GitHub Desktop.
Reverse an Idris Vect
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 Main | |
rev : Vect n a -> Vect n a | |
rev Nil = Nil | |
rev (x :: xs) = (rev xs) ++ (x :: Nil) | |
main : IO () | |
main = putStrLn $ show $ rev [1,2,3] | |
fails to compile with | |
hello.idr:5:5:When elaborating right hand side of rev: | |
Can't unify | |
Vect (n + 1) a | |
with | |
Vect (S n) a | |
Specifically: | |
Can't unify | |
plus n 1 | |
with | |
S n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment