[Haskell-cafe] ANNOUNCE slot-lambda

adam vogt vogt.adam at gmail.com
Mon Apr 7 20:28:40 UTC 2014


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 <ducis_cn at 126.com> wrote:
> 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list