Skip to content

Instantly share code, notes, and snippets.

@channingwalton
Created September 29, 2014 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save channingwalton/ddcba133f3896781ce7c to your computer and use it in GitHub Desktop.
Save channingwalton/ddcba133f3896781ce7c to your computer and use it in GitHub Desktop.
Reverse an Idris Vect
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