[CakeML-dev] Constructor syntax

Scott Owens S.A.Owens at kent.ac.uk
Tue May 9 21:43:10 UTC 2017


> On 2017/05/09, at 20:16, Magnus Myreen <magnus.myreen at gmail.com> wrote:
> 
> On 9 May 2017 at 10:13, Scott Owens <S.A.Owens at kent.ac.uk> wrote:
>> 
>>> On 2017/05/09, at 01:19, michael.norrish at data61.csiro.au wrote:
>>> 
>>> I don’t object too strongly to switching to Haskell syntax.
> 
> So you object a bit?

Even though I am advocating the switch, I am a little trepidatious about losing compatibility, since there is almost certainly no going back. So we do need to be sure that we aren’t overlooking any important reasons not to switch.

> 
>>> I’m curious as to how you will treat the Foo _ pattern though.  If Foo is really of arity 2, something presumably has to convert the convenient Foo _ syntax to the more accurate Foo _ _. Is this going to happen in the type inferencer?
>>> 
>>> Or is there a new constructor in the pat type called something like ConstructorPattern, which takes an id and whose semantics is to test for a constructor and not to care about the arguments?
>> 
>> We don’t support it at the moment. To add it, I think a new pattern AST for Ctor_any would be the cleanest.
> 
> Why would we allow Foo _ in the curried setting if Foo is of arity 2?
> I think that should be a type error. I read Scott's original reply as
> a response in the context of tupled constructors, where Foo _ makes
> sense.

I did mention that originally n terms of tupled constructors. Then I mentioned that we could support it with curried constructors. But maybe we don’t want to.

Scott


More information about the Developers mailing list