[Haskell-cafe] Proposal: New syntax for Haskell

Roman Cheplyaka roma at ro-che.info
Tue Sep 10 13:33:13 CEST 2013


* John Wiegley <johnw at fpcomplete.com> [2013-09-10 04:48:36-0500]
> >>>>> Niklas Hambüchen <mail at nh2.me> writes:
> 
> > Code written in cucumber syntax is concise and easy to read
> 
>     concise |kənˈsīs|, adj.
> 
>     giving a lot of information clearly and in a few words; brief but
>     comprehensive.
> 
> Compare:
> 
>     Scenario: Defining the function foldl
>       Given I want do define foldl
>       Which has the type (in brackets) a to b to a (end of brackets),
>                          to a, to list of b, to a
>       And my arguments are called f, acc, and l
>       When l is empty
>       Then the result better be acc
>       Otherwise l is x cons xs
>       Then the result should be foldl f (in brackets) f acc x
>                                 (end of brackets) xs
> 
> To:
> 
>     foldl :: (a -> b -> a) -> a -> [b] -> a
>     foldl f z []     = z
>     foldl f z (x:xs) = foldl f (f z x) xs
> 
> How is that more concise or preferable?

I thought it was a joke.

Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130910/ba6b06ed/attachment.pgp>


More information about the Haskell-Cafe mailing list