Skip to content

Conversation

@LiamGoodacre
Copy link
Member

Fixes #3076

Example input:

x :: _
x = {x: @(@(@(Array Int))), x: @Int}

Output:

Label x appears more than once in a row type.
while inferring the type of

{ x: @(@(@(Array Int)))
, x: @Int
}

I originally also changed the parser so it treated @ as a prefix type operator that binds tighter than type application, but this caused problems with instances because @Int isn't a type-atom. E.g: instance foo :: Foo @t would have to have been written as instance foo :: Foo (@t). So I reverted this.

proxyType :: Pattern () Type (Type, Type)
proxyType = mkPattern match
where
match (ProxyType t) = Just (TypeConstructor (Qualified Nothing (ProperName "@")), t)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting trick :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should add Prefix to pattern-arrows going forward, but I'm fine with this in the meantime. Could you please add a comment though?

@LiamGoodacre
Copy link
Member Author

Rebased and commented. Let me know if you want it to say something else.

@paf31
Copy link
Contributor

paf31 commented Oct 21, 2017

👍 Sounds good, thanks!

@LiamGoodacre LiamGoodacre merged commit cfd1db3 into purescript:master Oct 22, 2017
@LiamGoodacre LiamGoodacre deleted the fix/proxy-syntax branch October 22, 2017 00:57
hdgarrood added a commit that referenced this pull request Dec 30, 2017
@hdgarrood hdgarrood mentioned this pull request Dec 30, 2017
hdgarrood added a commit that referenced this pull request Jan 3, 2018
* Revert "pretty print proxy types when rendering docs (#3144)"

This reverts commit 14227c7.

* Revert "Print proxy type as an operator (#3124)"

This reverts commit cfd1db3.

* Revert "Fix proxies: synonyms, inference, traversals, instances (#3095)"

This reverts commit fe0aa0d.

* Revert "Add proxies (#2846)"

This reverts commit 74bc4a9.

* Remove one last occurrence of the ProxyType constructor

* Update tests to not use new proxies
matthewleon pushed a commit to matthewleon/purescript that referenced this pull request Jan 6, 2018
* Revert "pretty print proxy types when rendering docs (purescript#3144)"

This reverts commit 14227c7.

* Revert "Print proxy type as an operator (purescript#3124)"

This reverts commit cfd1db3.

* Revert "Fix proxies: synonyms, inference, traversals, instances (purescript#3095)"

This reverts commit fe0aa0d.

* Revert "Add proxies (purescript#2846)"

This reverts commit 74bc4a9.

* Remove one last occurrence of the ProxyType constructor

* Update tests to not use new proxies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with pretty-printing nested proxies

2 participants