Repository navigation
Can't solve constraints in values which came from constructor binders where the constructor was polymorphic - #4196
Conversation
garyb
left a comment
There was a problem hiding this comment.
I can't think of a reason why there would be a problem doing this. Those revised error output seem like improvements too! 👍
Good point, originally I was just messing around with deferring execution of expressions automatically (similar to https://github.com/natefaubion/purescript-call-by-name I believe), and found it surprising that using Identity would not work. I was using FFI to construct these values which meant I never actually tested creating them in-language. I'll have a look to see if it makes sense to allow constructing such values naturally |
|
@rhendric It's possible, although you have to be explicit about the type of -- compiles fine in the pull req, with inferred type Con => Int
test2' = test2 ((Identity :: (Con => Int) -> Identity (Con => Int)) 10)The changes required to not need that hint are too great, I think It's actually possible to write the original test2 :: Con => Identity (Con => Int) -> Int
test2 (Identity (a :: Con => Int)) = a |

Before this change, you couldn't solve constraints in values which came from constructor binders where the constructor was polymorphic:
This is because we weren't applying substitutions when checking the types of 'Var' exprs before subsumption, and polymorphic types like Identity get instantiated with unknowns during binder inference. This change adds the substitution in.
Checklist: