Skip to content

Only make composition suggestion on object . app function#1284

Merged
paf31 merged 1 commit intopurescript:masterfrom
mjgpy3:1272_reduce_false_positives_comp_sugg
Jul 18, 2015
Merged

Only make composition suggestion on object . app function#1284
paf31 merged 1 commit intopurescript:masterfrom
mjgpy3:1272_reduce_false_positives_comp_sugg

Conversation

@mjgpy3
Copy link
Copy Markdown
Contributor

@mjgpy3 mjgpy3 commented Jul 18, 2015

Seems to fix the cases given by @hdgarrood in #1272. I'm not sure it's totally done, but is more restrictive, I'd like to throw more cases at it if someone can come up some that are interesting.

@mjgpy3 mjgpy3 force-pushed the 1272_reduce_false_positives_comp_sugg branch from 940b63a to 9c61180 Compare July 18, 2015 21:35
@mjgpy3
Copy link
Copy Markdown
Contributor Author

mjgpy3 commented Jul 18, 2015

(removed a debug trace)

@mjgpy3
Copy link
Copy Markdown
Contributor Author

mjgpy3 commented Jul 18, 2015

Here are the outputs

SuggestComposition.purs:

Writing output/Prelude/index.js
Writing output/Prelude/foreign.js
Writing output/Prelude/externs.purs
Compiling SuggestComposition
Error:
Error in module SuggestComposition:
Error in value declaration f:
Error checking that type
  _0 -> _1
subsumes type
  { g :: _2 | _3 }
Error checking that type
  { g :: _2 | _3 }
subsumes type
  _0 -> _1
Error at /home/michael/dev/contrib/purescript/examples/failing/SuggestComposition.purs line 5, column 5 - line 5, column 11:
  Cannot unify type
    Prim.Object
  with type
    Prim.Function _0
Note that function composition in PureScript is defined using (<<<)
See https://github.com/purescript/purescript/wiki/Error-Code-TypesDoNotUnify for more information, or to contribute content related to this error.

DoNotSuggestComposition.purs:

Compiling DoNotSuggestComposition
Error:
Error in module DoNotSuggestComposition:
Error in value declaration bar:
Error checking that type
  { y :: Prim.Int }
subsumes type
  Prim.String
Error at /home/michael/dev/contrib/purescript/examples/failing/DoNotSuggestComposition.purs line 10, column 7 - line 10, column 11:
  Cannot unify type
    { y :: Prim.Int }
  with type
    Prim.String
See https://github.com/purescript/purescript/wiki/Error-Code-TypesDoNotUnify for more information, or to contribute content related to this error.

DoNotSuggestComposition2.purs:

Compiling DoNotSuggestComposition2
Error:
Error in module DoNotSuggestComposition2:
Error in value declaration foo:
Error at /home/michael/dev/contrib/purescript/examples/failing/DoNotSuggestComposition2.purs line 3, column 27 - line 3, column 29:
  Cannot apply function of type
    { y :: Prim.Int }
  to argument
    2
See https://github.com/purescript/purescript/wiki/Error-Code-CannotApplyFunction for more information, or to contribute content related to this error.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We need to test the other way round too, don't we?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Honestly, I'm not really sure. Can you give me a code example of what that might look like?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As in, a PureScript example of code that might indicate a misuse of .

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Jul 18, 2015

Thanks for working on this!

paf31 added a commit that referenced this pull request Jul 18, 2015
…_sugg

Only make composition suggestion on `object . app function`
@paf31 paf31 merged commit c25d2f8 into purescript:master Jul 18, 2015
@mjgpy3
Copy link
Copy Markdown
Contributor Author

mjgpy3 commented Jul 18, 2015

@paf31 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants