[Haskell-cafe] FreeSect -- generalised sections syntax extension

Ras Far rasfar at gmail.com
Fri Mar 2 14:39:49 CET 2012

Hi John,

Thanks for your feedback.  It would be preferable to use regular
parentheses to delimit the section, but it could only work in special
cases.  Consider this expression using free sections:

map  _[ f (g __ y) ]_  bs

If that were written "map (f (g __ y)) bs" and parentheses used to
delimit the freesect, that would give you the equivalent of

map  ( f _[ g __ y ]_ )  bs

which is incorrect (doesn't type).

Also, one may want more than a single free section in a RHS, which
would not be possible without distinct grouping syntax.

I looked into some sort of default context inference (like, the
tighest grouping which passes the type check), but that gets fairly
complicated and might still result in ambiguity, in case more than one
possible grouping types correctly.

I also set out originally to overload the single-underscore for
wildcard, but was unsuccessful (reduce/reduce conflicts in the HSE
parser), so I settled on double-underscore which I've come to think

As I said on the linked web page, I'm still exploring default context
inference (for interest's sake), and if anyone can suggest a nice way
to use SYB to compute the join (in the semilattice sense) of all terms
in a constructed tree which have type T, I'd really like to see


On Thu, Mar 1, 2012 at 10:01 PM, John Lask <jvlask at hotmail.com> wrote:
>> On Wed, Feb 29, 2012 at 9:27 PM, Ras Far<rasfar at gmail.com>  wrote:
>>> Hello,
>>> I bit premature perhaps but I wanted to post it on a leap day...
>>> http://fremissant.net/freesect
>>> Thanks for eyebloom on #haskell for motivating me to finally implement
>>> an old idea.  Thanks to the rest on #haskell for doing their best to
>>> talk me out of it. ;)
>>> I make no claims regarding the usefulness of the extension, but some
>>> folks might find it interesting, or may just appreciate additional
>>> examples of using HSE and SYB.  I regret that I am not a better
>>> Haskell coder, but it is what it is!
>>> Kind Reg'ds,
>>> Andrew Seniuk (rasfar)
> why couldn't you use standard brackets ( to delimit the extent ? I suppose
> that would have added complexity to the syntax analysis, however I think it
> would have been (in my mind) neater.

More information about the Haskell-Cafe mailing list