concrete syntax for role annotations

Simon Peyton-Jones simonpj at microsoft.com
Fri Aug 23 10:23:30 CEST 2013


(Adding ghc-devs, who will, I hope, have opinions)

I'm sympathetic to this.  In general our story for pragmas {-# blah #-} is that they affect only optimisation (eg INLINE) or warnings (eg DEPRECATED).  You can ignore/leave them out. But here you really can't.  Well, I suppose leaving out the annotation does not risk soundness (as in run-time seg-fault); it just risks sets being ordered wrong.

I don't have a strong opinion here.

You could also imagine other syntaxes e.g.
                data Set a(role N) = ...
I suppose.

You are right that we need to get this nailed for 7.8, so we don't end up changing it later.

Simon



From: Richard Eisenberg [mailto:eir at cis.upenn.edu]
Sent: 23 August 2013 05:52
To: Simon Peyton-Jones; Dimitrios Vytiniotis; Stephanie Weirich
Subject: concrete syntax for role annotations

Hi all,

On a Reddit discussion of my recent blog post on roles (http://www.reddit.com/r/haskell/comments/1kgivs/roles_a_new_feature_of_ghc_patch_gnd_type_families/), it was suggested that a better syntax is available for specifying role annotations.

Currently, I've implemented

> data Set a at N = ...

to mark Set's parameter's role as N. The suggested syntax is

> data Set a {-# ROLE N #-} = ...

This suggested syntax is certainly much more verbose, but it's fully backwards-compatible, avoiding the need for preprocessing statements in libraries. These annotations should hopefully be few and far between, and I just think it's worth considering the backwards-compatible syntax before 7.8 is released and we're stuck.

What do we think? Should I forward the question to glasgow-haskell-users, perhaps?

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130823/f592eec2/attachment.htm>


More information about the ghc-devs mailing list