Skip to content

Conversation

gelisam
Copy link
Contributor

@gelisam gelisam commented Jan 4, 2017

No description provided.

To demonstrate that it's now possible to define infix data constructors.
Note that infix pattern-matching is not supported yet, so we have to
write [(:: x xs) body].
I don't see any code in the prelude in which it would make sense to use
this yet, so I won't demonstrate it there, but here's a small program
demonstrating that it works:

    #lang rascal

    (data {a && b}
      {a & b})

    (def mypair : {String && String}
      {"foo" & "bar"})
@gelisam
Copy link
Contributor Author

gelisam commented Jan 4, 2017

I noticed that some infix applications use the infix operator more than once, as in {x <> y <> z}. I don't think this syntax make sense for either type constructors or data constructors, does it?

@lexi-lambda
Copy link
Owner

Neat! Could you add a small test to rascal-test/tests/rascal/integration.rkt? Eventually we’ll have to figure out a better story for a real test suite, but for now just including a simple thing in there is probably helpful. The example you included in your commit message seems like it would be sufficient for a test.

otherwise, the test is useless, because it passes even without the patch
to support infix type constructors: it simply parses {a && b} as
(a && b), a constructor "a" with arguments "&&" and "b".
@gelisam
Copy link
Contributor Author

gelisam commented Jan 4, 2017

Hmm, why does coveralls still complain? Three times, no less! It looks like the test I added had no effect?

@lexi-lambda
Copy link
Owner

Coveralls is obnoxious and overly loud. I’ve disabled it posting comments on PRs, and I’ve allowed coverage to drop a little bit without being considered a failure. In this case it decreased 0.09%, which is in the noise. I think this looks fine.

lexi-lambda added a commit that referenced this pull request Jan 4, 2017
@lexi-lambda
Copy link
Owner

Merged in 7add7bc.

@lexi-lambda lexi-lambda closed this Jan 4, 2017
@lexi-lambda lexi-lambda removed the todo label Jan 4, 2017
@gelisam gelisam mentioned this pull request May 8, 2017
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