Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example from Idris TDD book does not work #4592

Open
roehst opened this issue Nov 17, 2018 · 2 comments
Open

Example from Idris TDD book does not work #4592

roehst opened this issue Nov 17, 2018 · 2 comments

Comments

@roehst
Copy link

roehst commented Nov 17, 2018

Please attach complete source files that exhibit the issue in addition
to quoting from them here.

Steps to Reproduce

I am at the matrix transpose exercise. (page 77)

module Main

import Data.Vect

createEmpties : Vect n (Vect 0 elem)
createEmpties = ?createEmpties_rhs1

transpose : Vect m (Vect n elem) -> Vect n (Vect m elem)
transpose [] = createEmpties
transpose (x :: xs) = let xsTrans = transpose xs in ?the_rest

Expected Behavior

The code should type check and I should be able to extract ?the_rest as a lemma and continue the exercise.

Observed Behavior

Idris can not infer type.

     When checking right hand side of Main.transpose with expected type
             Vect n (Vect (S len) elem)
     
     Can't infer type for {letval_612}

My idris version is 1.3.1

@workflow
Copy link

workflow commented Dec 9, 2018

Hi @roehst, it looks like this is some weird naming clash with the identifier transpose.

Try renaming transpose to something else, this code worked for me:

import Data.Vect

createEmpties : Vect n (Vect 0 elem)
createEmpties = ?createEmpties_rhs1

transposeMatrix : Vect m (Vect n elem) -> Vect n (Vect m elem)
transposeMatrix [] = createEmpties
transposeMatrix (x :: xs) = let xsTrans = transposeMatrix xs in
                          ?the_rest

@workflow
Copy link

workflow commented Dec 9, 2018

The error message should definitely improve here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants