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

Weird error message "no such variable" when function is defined outside #4587

Open
Ptival opened this issue Nov 7, 2018 · 1 comment
Open

Comments

@Ptival
Copy link

Ptival commented Nov 7, 2018

I know there are a lot of "no such variable" errors on the issue tracker already, but the first few I looked at seemed unrelated to what I am experiencing. Here is a very minimized version of the problem I encouter:

Steps to Reproduce

In Foo.idr

module Foo

import Data.List

public export
data Foo : Nat -> Type where
  Zero : Elem n [ 0 ] -> Foo n

a : Foo 0 -> Bool
a foo = case foo of
  Zero e => True

Definition a is happily accepted. Now in file Bar.idr:

module Bar

import Data.List
import Foo

b : Foo 0 -> Bool
b foo = case foo of
  Zero e => True

yields the following error:

Bar.idr:10:3-8:
   |
10 |   Zero e => True
   |   ~~~~~~
When checking left hand side of Bar.case block in b at Bar.idr:9:14-16:
No such variable Data.List.Elem

This error message seems really fishy to me.

@dmalikov
Copy link
Contributor

Most likely you need to import public Data.List in Foo.idr.

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