Conversation
| let fields = zipWith (\name (TypedValue _ _ t) -> (Label name, t)) (map fst ps) ts | ||
| ty = TypeApp tyRecord $ rowFromList (fields, REmpty) | ||
| return $ TypedValue True (Literal (ObjectLiteral (zip (map fst ps) ts))) ty | ||
| -- We make a special case for Vars in record labels, since there are the |
There was a problem hiding this comment.
I think you meant "these".
|
@LiamGoodacre Would you mind reviewing this one, please? |
|
Will do, I'll have a look through this tonight :) |
|
What would you expect to happen in this code: type Z t = forall x. t x -> (forall a. t a) -> t x
class C t where c :: Z t
instance cA :: C Array where c x _ = x
test2 :: forall m. Monad m => m { ccc :: Z Array }
test2 = pure { ccc: c } |
|
I'm not sure, but I could try it. Why do you ask about that snippet specifically? |
|
Sorry, I forgot to add an explanation. I tried added the above code to your test file. The idea was to also test a polymorphic var with a constraint and also a quantified argument. I probably shouldn't have lumped them together, but anyway: the test failed with an escaped skolem. I would have expected it to succeed, so I was wondering if you thought the same. |
|
Constrained functions in record literals are still a bit of a pain. Does it work if you annotate the property? |
|
With an annotation it still fails in the same way: test2 :: forall m. Monad m => m { ccc :: Z Array }
test2 = pure { ccc: (c :: Z Array) } |
|
Oh, then that's a bug. Thanks. |
|
I think it's easily fixed, thankfully. I'll add a test for this. |
|
@LiamGoodacre How's this? |
|
The whole package set continues to compile with this change, so it seems safe enough. |
|
This looks good :) - although I'm not an expert on this part of the code. |
Fixes #1110 and #2312. Replaces #2367.
I'm not really very happy with this fix, but I've been stuck thinking about this for a long time now, and it's been difficult to fix this and keep Halogen compiling as-is. So this is a compromise, and I've added a note in a comment to explain the fix.