[Haskell-cafe] Proposal: New syntax for Haskell

AlanKim Zimmerman alan.zimm at gmail.com
Tue Sep 10 11:54:32 CEST 2013


I think the normal motivation for cucumber syntax is that it is a way to
communicate requirements with non-technical people.


On Tue, Sep 10, 2013 at 11:48 AM, John Wiegley <johnw at fpcomplete.com> wrote:

> >>>>> 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?
>
> --
> John Wiegley
> FP Complete                         Haskell tools, training and consulting
> http://fpcomplete.com               johnw on #haskell/irc.freenode.net
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130910/7705fc6a/attachment.htm>


More information about the Haskell-Cafe mailing list