r/purescript • • Mar 02 '18

SubRecords in Purescript

https://rubenpieters.github.io/programming/purescript/2018/03/02/subrecord-purescript.html
3 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/xalyama Mar 03 '18

Hmm, but surely just adding the inferred signature shouldn't make the code not compile anymore?

I have the function:

-- has inferred type forall t10 t5. { | t10 } -> SubRecord t5 -> { | t5 }
withDefaults defaults = unSubRecord (\r -> Record.build (Record.merge defaults) r)

Then, I get a 'no type declaration' warning. If I then just add the inferred type (which shouldn't change anything?):

withDefaults :: forall t10 t5. { | t10 } -> SubRecord t5 -> { | t5 }
withDefaults defaults = unSubRecord (\r -> Record.build (Record.merge defaults) r)

Then it doesn't compile anymore.

1

u/natefaubion Mar 04 '18

It wouldn't surprise me if the printed inferred type doesn't work. I think it's a known issue. I don't see how that "inferred" type would ever work since it doesn't carry any constraints.

1

u/paf31 Mar 05 '18

I'm pretty sure it's an escaped skolem issue.