FreeSect -- generalised sections syntax extension

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)

For anyone who tried building the implementation linked off the
fremissant page (see above email), there was a glitch or two and this
is fixed. The problem being simply the target path -- I build to a
ramdisk because, as is often the case, GHC produces a rather large
binary and I don't like to thrash my HDD during development. The
executable is now produced in the root directory of the distro.
Cheers,
Andrew
On Wed, Feb 29, 2012 at 9:27 PM, Ras Far
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)

On Wed, Feb 29, 2012 at 9:27 PM, Ras Far
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.

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
preferable.
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
that...
-Andrew
On Thu, Mar 1, 2012 at 10:01 PM, John Lask
On Wed, Feb 29, 2012 at 9:27 PM, Ras Far
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.

Ras Far
I bit premature perhaps but I wanted to post it on a leap day...
Lambda calculus (and therefore Haskell) has a term 'alpha-renaming' for this: f x y = x + y g z w = z + w `f` and `g` are equivalent "modulus alpha renaming", because the name of the dummy variables in the definition is entirely arbitrary -- they just stand for their position. So in: subtract y {- from -} x = x - y I want to say that `subtract` is equivalent to (-) "modulo ??? reordering". Since partial application and the need to reorder arguments is so frequent in Haskell (and lambda-calculus), Haskell defines a combinator `flip`, so: subtract = flip (-) -- equivalent definition for subtract So is there an arbitrary greek letter term for reordering? [Question prompted by a discussion on ghc-users re 'Records in Haskell'. There's a proposal using a typeclass with type arguments in a different order to the other proposals.] AntC

On 3/3/12 7:55 PM, AntC wrote:
So is there an arbitrary greek letter term for reordering?
I'm not aware of one, in part no doubt because it's not a semantics-preserving transformation (that is, not in the same sense as that used in defining alpha, beta, eta, delta,...). In the extension to lambda calculus I presented at NASSLLI a couple years back[1] it is indeed semantics-preserving. In that context I named it chi, because it's a chiastic transformation. Though do note that the calculus also supports an alternative interpretation of reordering, dubbed ksi (for, er, "ksiastic" transformations?). That is, when accounting for reordering we can either reorder the abstractions (chi) or we can reorder the applications (ksi); in many contexts it is impossible to distinguish them on pretheoretical grounds, though there are places where they diverge. For the record, renaming variables is usually called "alpha-variance" and the alpha-equivalence relation is "modulo alpha-variance". ("Modulus" is a noun; "modulo" is, in English, a preposition.) [1] http://llama.freegeek.org/~wren/pubs/ccgjp_nasslli2010.pdf -- Live well, ~wren

On 3/3/12 9:15 PM, wren ng thornton wrote:
In the extension to lambda calculus I presented at NASSLLI a couple years back[1] it is indeed semantics-preserving. In that context I named it chi, because it's a chiastic transformation.
In combinator calculi the name of `flip` is C, which gives an additional reason for that name (though that argument works better for gamma). -- Live well, ~wren
participants (4)
-
AntC
-
John Lask
-
Ras Far
-
wren ng thornton