A type checker plugin for row types

Matthew Pickering matthewtpickering at gmail.com
Mon Sep 18 11:11:11 UTC 2017


Hi Nicolas, I briefly tried out the plugin this morning and have a few comments.

1. The example file on the wiki page fails to compile. I needed to
modify two of the constraints on `getName` and `getPos` to get it to
work.

2. I was inspecting how well the compiler optimises your
representation and came across from very strange core that I didn't
understand.

https://gist.github.com/mpickering/6ec5501400e103d64284701d7537f223

Notice how there is a case on a lambda which binds an unused kind
variable. But I can't understand how this works at all as I can't see
where the lambda is applied.

3. Running -dcore-lint on the example file quickly complains.  I think
making sure that core-lint passes can be quite an important sanity
check, is a fundamental reason which makes core lint work poorly with
type checker plugins? If there is then we should perhaps fix this.

I also packaged up the project for nix if that is useful to anyone else.

https://gist.github.com/2a4b2fa25351bd900052d955a00ace6a

Matt

On Sat, Sep 16, 2017 at 11:00 PM, Nicolas Frisby
<nicolas.frisby at gmail.com> wrote:
> If you'd like to see how exactly the plugin manipulates constraints, I
> suggest using the `summarize` and `trace` options that are discussed here:
>
> https://ghc.haskell.org/trac/ghc/wiki/Plugins/TypeChecker/RowTypes/Coxswain#PluginDebugOptions
>
> Also, the `sculls/Examples.hs` and `sculls/Elm.hs` files contain my only
> test cases involving records and variants. Also see `coxswain/test/README`.
>
> I'm kind of spent from rushing towards this "release", so I might be a bit
> less productive for a while. But I'll be generally responsive about it if
> others are spending time on it.
>
> In particular: any advice for how to share the generated Haddock
> documentation without uploading to Hackage/Stackage?
>
> And thanks to all for responding to my questions. I'll have to think harder
> about the answers given. At least for Derived constraints, in particular, I
> still don't think we have all of the relevant information in one place. For
> example, I recalling thinking that I was seeing some Derived constraints
> that seemed to arise from the unifier "giving up" on a complicated equality
> and emitting a Given equality instead, and nobody mentioned that in their
> answers here. I'll try to suss out a repro of that exactly.
>
> Thanks. -Nick
>
> On Sat, Sep 16, 2017 at 2:27 PM Nicolas Frisby <nicolas.frisby at gmail.com>
> wrote:
>>
>> I've uploaded the code to GitHub.
>>
>> https://github.com/nfrisby/coxswain
>>
>> I went with a BSD3 licence.
>>
>> It's still very much a work in progress, so I only recommend using it for
>> experimentation for now.
>>
>> Thanks. -Nick
>>
>>
>> On Sun, Sep 10, 2017 at 3:24 PM Nicolas Frisby <nicolas.frisby at gmail.com>
>> wrote:
>>>
>>> Hi all. I've been spending my free time for the last couple months on a
>>> type checker plugin for row types. The free time waxes and wanes; sending an
>>> email like this one was my primary goal for the past couple weeks.
>>>
>>> At the very least, I hoped this project would let me finally get some
>>> hands on experience with OutsideIn. And I definitely have. But I've also
>>> made more progress than I anticipated, and I think the plugin is starting to
>>> have legs!
>>>
>>> I haven't uploaded the code yet to github -- it's not quite ready to
>>> share. But I did do a write up on the dev wiki.
>>>
>>>
>>> https://ghc.haskell.org/trac/ghc/wiki/Plugins/TypeChecker/RowTypes/Coxswain
>>>
>>> I would really appreciate and questions, comments, and --- boy, oh boy
>>> --- answers.
>>>
>>> I hope to upload within a week or so, and I'll update that wiki page and
>>> reply to this email when I do.
>>>
>>> Thanks very much. -Nick
>>>
>>> P.S. -- I've CC'd and BCC'd people who I anticipate would be specifically
>>> interested in this (e.g. plugins, row types, etc). Please feel free to
>>> forward to others that come to mind; I know some inboxes abjectly can't
>>> afford default list traffic.
>>>
>>> P.P.S. -- One hold up for the upload is: which license? I intend to
>>> release under BSD3, mainly to match GHC since one ideal scenario would
>>> involve being packaged with/integrated into GHC. But my brief recent
>>> research suggests that the Apache license might be more conducive to
>>> eventual widespread adoption. If you'd be willing to advise or even just
>>> refer me to other write ups, please feel free to email me directly or to
>>> start a separate thread on a more appropriate distribution list (CC'ing me,
>>> please). Thanks again.
>
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>


More information about the ghc-devs mailing list