ANNOUNCE slot-lambda

http://hackage.haskell.org/package/slot-lambda It lets your write lambdas with 'slots' without inventing names for the parameters. [s| ı + ı |] = \x y -> x+y The unicode character ı(305) representing a 'slot' can be input in vim with the digraph 'i.' . Use _ı to refer to the immediate left ı, and _0, _1, _2, ... to refer to the 1st, 2nd, 3rd, ... arguments respectively. e.g. [s| ı : ı : _ı : ı : _ı : _ı : _0 : [] |] 'a' 'b' 'c' = (\x y z -> x:y:y:z:z:z:x:[]) 'a' 'b' 'c' = "abbccca" I originally intended using '_' to represent the 'slots' but that doesn't parse as legal haskell. Actually I wonder how to achieve that without rolling my own haskell parser or forking haskell-src-exts.

Hi Ducis,
Maybe haskell-src-exts will follow ghc-7.8 and accept _ in expressions
as ghc-7.8 does (http://www.haskell.org/haskellwiki/GHC/TypedHoles).
Ideally there could be something like camlp4 for haskell, but as far
as I know there isn't such a thing.
Regards,
Adam
On Mon, Apr 7, 2014 at 12:02 PM, ducis
http://hackage.haskell.org/package/slot-lambda
It lets your write lambdas with 'slots' without inventing names for the parameters.
[s| ı + ı |] = \x y -> x+y
The unicode character ı(305) representing a 'slot' can be input in vim with the digraph 'i.' . Use _ı to refer to the immediate left ı, and _0, _1, _2, ... to refer to the 1st, 2nd, 3rd, ... arguments respectively. e.g. [s| ı : ı : _ı : ı : _ı : _ı : _0 : [] |] 'a' 'b' 'c' = (\x y z -> x:y:y:z:z:z:x:[]) 'a' 'b' 'c' = "abbccca" I originally intended using '_' to represent the 'slots' but that doesn't parse as legal haskell. Actually I wonder how to achieve that without rolling my own haskell parser or forking haskell-src-exts.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hi, Ducis wrote:
Actually I wonder how to achieve that without rolling my own haskell parser or forking haskell-src-exts.
Adam vogt wrote:
Ideally there could be something like camlp4 for haskell, but as far as I know there isn't such a thing.
We built SugarHaskell to explore that design space. See our paper at the Haskell Symposium 2012: http://sugarj.org/sugarhaskell.pdf While there is not much going on about SugarHaskell specifically, the underlying language-independent framework is still actively developed, in the https://github.com/sugar-lang organization. The eclipse plugin for SugarHaskell from http://update.sugarj.org/ should work. I don't know what the status of the command-line version is, though. Even if you don't want to use all of SugarHaskell, the underlying easily extensible grammar might still be a good starting point. It uses declarative layout constraints to specify Haskell's layout in a modular way. See our paper at the conference on software language engineering 2012: http://sugarj.org/layout-parsing.pdf Tillmann

Does it depend on Stratego/XT? As far as I know I have to live in the Eclipse environment to use anything depending on Stratego/XT.
At 2014-04-08 04:53:06,"Tillmann Rendel"
Hi,
Ducis wrote:
Actually I wonder how to achieve that without rolling my own haskell parser or forking haskell-src-exts.
Adam vogt wrote:
Ideally there could be something like camlp4 for haskell, but as far as I know there isn't such a thing.
We built SugarHaskell to explore that design space. See our paper at the Haskell Symposium 2012:
http://sugarj.org/sugarhaskell.pdf
While there is not much going on about SugarHaskell specifically, the underlying language-independent framework is still actively developed, in the https://github.com/sugar-lang organization. The eclipse plugin for SugarHaskell from http://update.sugarj.org/ should work. I don't know what the status of the command-line version is, though.
Even if you don't want to use all of SugarHaskell, the underlying easily extensible grammar might still be a good starting point. It uses declarative layout constraints to specify Haskell's layout in a modular way. See our paper at the conference on software language engineering 2012:
http://sugarj.org/layout-parsing.pdf
Tillmann

Hi, Ducis asked about SugarHaskell:
Does it depend on Stratego/XT?
SugarHaskell uses Stratego and SDF, but all necessary tools are bundled, so you only need a Java virtual machine (and maybe a Java compiler, not sure). Most of the tools are bundled as Java class files. Two tools (sdf2table and implodePT) are bundled as a statically linked executable for common platforms. On a non-common platform, you would have to compile these from their C sources. There is a release of SugarHaskell on hackage: http://hackage.haskell.org/package/sugarhaskell The tarball consists mostly of *.jar files and native executables. Looking at the timestamp, this is obviously outdated, but it should work and give you a first impression. I'm sure an updated release on Hackage could be provided. (Eclipse is the main platform for SugarHaskell and the other Sugar languages, because we want to provide extensible syntax highlighting and other editor features. The process for making the Hackage release was to write a simple driver for the command-line interface that essentially calls java with the right parameters, and figure out which *.jar files from an Eclipse installation we need to bundle to make it work. The latter was done manually, and could be done manually again for a more recent SugarHaskell-in-Eclipse installation). Tillmann

So, it means that using Stratego outside of Eclipse is not that hard? Cool. I've heard of Stratego before. It's time to try again.
Thanks for the information.
At 2014-04-08 20:37:04,"Tillmann Rendel"
Hi,
Ducis asked about SugarHaskell:
Does it depend on Stratego/XT?
SugarHaskell uses Stratego and SDF, but all necessary tools are bundled, so you only need a Java virtual machine (and maybe a Java compiler, not sure). Most of the tools are bundled as Java class files. Two tools (sdf2table and implodePT) are bundled as a statically linked executable for common platforms. On a non-common platform, you would have to compile these from their C sources.
There is a release of SugarHaskell on hackage:
http://hackage.haskell.org/package/sugarhaskell
The tarball consists mostly of *.jar files and native executables. Looking at the timestamp, this is obviously outdated, but it should work and give you a first impression. I'm sure an updated release on Hackage could be provided.
(Eclipse is the main platform for SugarHaskell and the other Sugar languages, because we want to provide extensible syntax highlighting and other editor features. The process for making the Hackage release was to write a simple driver for the command-line interface that essentially calls java with the right parameters, and figure out which *.jar files from an Eclipse installation we need to bundle to make it work. The latter was done manually, and could be done manually again for a more recent SugarHaskell-in-Eclipse installation).
Tillmann

On Mon, Apr 7, 2014 at 11:02 PM, ducis
It lets your write lambdas with 'slots' without inventing names for the parameters.
[s| ı + ı |] = \x y -> x+y
I have no background in this 'slot lambda' and a search reveals this package as the only hit. Which may explain why I find the example given confusing. Why would [s| 1+1 |] not be equivalent to \x->x+x ? -- Kim-Ee

I just want to add that I find the syntax extremely confusing and counter
intuitive.
I thought it was just me, or that I was missed something. But it looks like
I'm not the only one.
On 7 April 2014 21:58, Kim-Ee Yeoh
On Mon, Apr 7, 2014 at 11:02 PM, ducis
wrote: It lets your write lambdas with 'slots' without inventing names for the parameters.
[s| ı + ı |] = \x y -> x+y
I have no background in this 'slot lambda' and a search reveals this package as the only hit.
Which may explain why I find the example given confusing. Why would [s| 1+1 |] not be equivalent to \x->x+x ?
-- Kim-Ee
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- *Alois Cochard* http://aloiscochard.blogspot.com http://twitter.com/aloiscochard http://github.com/aloiscochard

In order to give a more constructive feedback, why not simply indexing
arguments by position and use the `_N` syntax?
The second example would be:
_0 : _1 : _1 : _2 : _2 : _2 : _0 : []
One could just use `_` if there is only one arg:
_ + _ (which mean what Kim thought it would mean)
and use:
_0 + _1 (for the case you wanted to support)
Cheers
On 7 April 2014 22:01, Alois Cochard
I just want to add that I find the syntax extremely confusing and counter intuitive.
I thought it was just me, or that I was missed something. But it looks like I'm not the only one.
On 7 April 2014 21:58, Kim-Ee Yeoh
wrote: On Mon, Apr 7, 2014 at 11:02 PM, ducis
wrote: It lets your write lambdas with 'slots' without inventing names for the parameters.
[s| ı + ı |] = \x y -> x+y
I have no background in this 'slot lambda' and a search reveals this package as the only hit.
Which may explain why I find the example given confusing. Why would [s| 1+1 |] not be equivalent to \x->x+x ?
-- Kim-Ee
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- *Alois Cochard* http://aloiscochard.blogspot.com http://twitter.com/aloiscochard http://github.com/aloiscochard
-- *Alois Cochard* http://aloiscochard.blogspot.com http://twitter.com/aloiscochard http://github.com/aloiscochard

Thanks. [s|_0 + _1|] = \x y->x+y is supported. I simply like [s|_+_|] better personally. And [s|_+_ı|] is for \x->x+x. I have to admit that 'ı' character is not very recognizable though. Any suggestions of another 'Letter, Lowercase' unicode character that no one would use as a variable name and can be easily input in vim are welcome.
At 2014-04-08 05:12:26,"Alois Cochard"

Hi, Am Dienstag, den 08.04.2014, 09:34 +0800 schrieb ducis:
Thanks. [s|_0 + _1|] = \x y->x+y is supported. I simply like [s|_+_|] better personally. And [s|_+_ı|] is for \x->x+x. I have to admit that 'ı' character is not very recognizable though. Any suggestions of another 'Letter, Lowercase' unicode character that no one would use as a variable name and can be easily input in vim are welcome.
not sure about vim-inputability, but from http://www.fileformat.info/info/unicode/category/Ll/list.htm these look like slots to me: ꙩ ʘ 𝝾 (But seriously, _ is nicer.) Greetings, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0x4743206C Debian Developer: nomeata@debian.org

On Tue, Apr 08, 2014 at 03:58:30AM +0700, Kim-Ee Yeoh wrote:
On Mon, Apr 7, 2014 at 11:02 PM, ducis
wrote: It lets your write lambdas with 'slots' without inventing names for the parameters.
[s| ı + ı |] = \x y -> x+y
I have no background in this 'slot lambda' and a search reveals this package as the only hit.
Which may explain why I find the example given confusing. Why would [s| 1+1 |] not be equivalent to \x->x+x ?
Because each slot stands for a new variable.

Understood and actually I forgot you can not use "_", so why not a symbol which don't look like a number? On 7 April 2014 22:16, Tom Ellis < tom-lists-haskell-cafe-2013@jaguarpaw.co.uk> wrote:
On Tue, Apr 08, 2014 at 03:58:30AM +0700, Kim-Ee Yeoh wrote:
On Mon, Apr 7, 2014 at 11:02 PM, ducis
wrote: It lets your write lambdas with 'slots' without inventing names for the parameters.
[s| ı + ı |] = \x y -> x+y
I have no background in this 'slot lambda' and a search reveals this package as the only hit.
Which may explain why I find the example given confusing. Why would [s| 1+1 |] not be equivalent to \x->x+x ?
Because each slot stands for a new variable. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- *Alois Cochard* http://aloiscochard.blogspot.com http://twitter.com/aloiscochard http://github.com/aloiscochard

On Mon, Apr 7, 2014 at 5:14 PM, Alois Cochard
Understood and actually I forgot you can not use "_", so why not a symbol which don't look like a number?
I was also wondering how Turkish speakers/writers would react to that notation.... -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Mon, Apr 7, 2014 at 2:26 PM, Brandon Allbery
On Mon, Apr 7, 2014 at 5:14 PM, Alois Cochard
wrote: Understood and actually I forgot you can not use "_", so why not a symbol which don't look like a number?
I was also wondering how Turkish speakers/writers would react to that notation....
Native English speaker here. My first thought was, "Oh, a iota. And he's using it as a definite descriptor/anonymous variable. Nice." But then again, I took too many classes on Frege and Russell.

:-)
Ok, nevermind. That's just me which is has no understanding of the context
then, like Kim.
I'm booking some classes with Frege and Russell, looks like they are pretty
busy atm.
On 7 April 2014 22:57, Alexander Solla
On Mon, Apr 7, 2014 at 2:26 PM, Brandon Allbery
wrote: On Mon, Apr 7, 2014 at 5:14 PM, Alois Cochard
wrote: Understood and actually I forgot you can not use "_", so why not a symbol which don't look like a number?
I was also wondering how Turkish speakers/writers would react to that notation....
Native English speaker here. My first thought was, "Oh, a iota. And he's using it as a definite descriptor/anonymous variable. Nice."
But then again, I took too many classes on Frege and Russell.
-- *Alois Cochard* http://aloiscochard.blogspot.com http://twitter.com/aloiscochard http://github.com/aloiscochard

On Mon, Apr 7, 2014 at 4:12 PM, Alois Cochard
:-)
Ok, nevermind. That's just me which is has no understanding of the context then, like Kim.
I wouldn't go that far. It's just that when you spend hundreds of hours naming "all of the possible kinds of things" in a formal language, notation kind of becomes transparent. And ducis says it's just a coincidence.

No, there is no theory behind it. I personally feel it convenient.
在 2014-04-08 04:58:30,"Kim-Ee Yeoh"
participants (9)
-
adam vogt
-
Alexander Solla
-
Alois Cochard
-
Brandon Allbery
-
ducis
-
Joachim Breitner
-
Kim-Ee Yeoh
-
Tillmann Rendel
-
Tom Ellis