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

case in a lambda is broken #62

Open
edwinb opened this issue May 20, 2020 · 1 comment
Open

case in a lambda is broken #62

edwinb opened this issue May 20, 2020 · 1 comment

Comments

@edwinb
Copy link
Collaborator

edwinb commented May 20, 2020

Issue by MarcelineVQ
Saturday Apr 25, 2020 at 20:46 GMT
Originally opened as edwinb/Idris2-boot#324


Idris 2, version 0.1.0-19426ecd1
I've included a lambda of case and a lambdacase to show it's not specific to one.

Steps to Reproduce

foo1 : ()
foo1 = (\dx => case dx of () => ()) ()
foo2 : ()
foo2 = (\case () => ()) ()

Expected Behavior

Typechecking completes.

Observed Behavior

1/1: Building Case (Case.idr)
Case.idr:2:8--4:1:While processing right hand side of foo1 at Case.idr:2:1--4:1:
Can't solve constraint between:
	?delayTy [no locals in scope]
and
	()
Case.idr:5:8--11:1:While processing right hand side of foo2 at Case.idr:5:1--11:1:
Can't solve constraint between:
	?delayTy [no locals in scope]
and
	()
Error(s) building file tests/idris2/case001/Case.idr: tests/idris2/case001/Case.idr:2:1--4:1:When elaborating right hand side of Main.foo1:
tests/idris2/case001/Case.idr:2:8--4:1:?Main.{delayTy:170}_[$resolved1135] and $resolved1132 are not equal
tests/idris2/case001/Case.idr:5:1--11:1:When elaborating right hand side of Main.foo2:
tests/idris2/case001/Case.idr:5:8--11:1:?Main.{delayTy:181}_[$resolved1135] and $resolved1132 are not equal
@jdevuyst
Copy link

Not sure if this is a meaningful difference but I ran into a similar error with this example:

T : Bool -> Bool -> Type
T True  b = () -> if b then String else Double
T False _ = Int

f : (x : Bool ** (y : Bool) -> T x y)
f = (True ** \y => \() => case y of
                             True  => ""
                             False => 0)

The error is:

Can't solve constraint between:
	String
and
	?caseTy [no locals in scope]

The difference is that this message has a hole named ?caseTy rather than ?delayTy.

When I make T not return a function type, it works fine, so I was surprised to find this ticket with such a trivial example. :)

I have another, more complicated, example where there are names in scope. Let me know if it would be useful to have.

melted pushed a commit to melted/Idris2 that referenced this issue Jun 1, 2020
Names are saturated, so there might be a lambda in the term we're
optimising. Fixes idris-lang#62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants