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

fail to reduce imported functions when name could be ambiguous #116

Open
abailly opened this issue Oct 5, 2019 · 1 comment
Open

fail to reduce imported functions when name could be ambiguous #116

abailly opened this issue Oct 5, 2019 · 1 comment

Comments

@abailly
Copy link
Contributor

abailly commented Oct 5, 2019

If possible, please include complete self contained source files (for example by uploading to https://gist.github.com) that exhibit the issue in addition to quoting from them here. The smaller the example the better!

Steps to Reproduce

Create file Data/List/Extra.idr containing:

module Data.List.Extra

public export
find : (a -> Bool) -> List a -> Maybe a
find p []      = Nothing
find p (x::xs) =
  if p x then
    Just x
  else
    find p xs

create a test.idr file with:

module test

import Data.List.Extra as E

foo : List Nat -> Nat -> Maybe Nat
foo list bound = E.find (\ n => n < bound) list

Load test.idr in the real and evaluate call to foo [0 .. 5 ] 2

Expected Behavior

Should output Just Z

Observed Behavior

outputs:

> foo [ 0 .. 5 ] 2
find Nat (\n => (== (compare n (S (S Z))) LT)) [Z, S Z, S (S Z), S (S (S Z)), S (S (S (S Z))), S (S (S (S (S Z))))]

When inlining the find function in the test.idr file, it works as expected.

@edwinb
Copy link
Owner

edwinb commented Feb 22, 2020

This is (probably) because import ... as doesn't actually do anything yet. Really it should complain about two things: firstly, import...as not doing anything yet, and E.find not existing. I don't know why it doesn't complaim about the latter.

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