Impressed by the productivity of my Ruby-writing friends, I have recently come across Cucumber: http://cukes.info It is a great tool for specifying tests and programs in natural language, and especially easy to learn for beginners. I propose that we add a Cucumber syntax for Haskell, with the extension ".chs", next to .hs and .lhs. Code written in cucumber syntax is concise and easy to read: You can find some example code in https://gist.github.com/nh2/6505995. Quoting from that: Feature: The Data.List module In order to be able to use lists As a programmer I want a module that defines list functions 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 PS: People even already started a testing framework for Haskell in it: https://github.com/sol/cucumber-haskell#cucumber-for-haskell
Niklas Hambüchen <mail@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
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@fpcomplete.com> wrote:
Niklas Hambüchen <mail@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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
On Sep 10, 2013 3:25 PM, "AlanKim Zimmerman" <alan.zimm@gmail.com> wrote:
I think the normal motivation for cucumber syntax is that it is a way to
communicate requirements with non-technical people. +1
On Tue, Sep 10, 2013 at 11:48 AM, John Wiegley <johnw@fpcomplete.com>
wrote:
> Niklas Hambüchen <mail@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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
* John Wiegley <johnw@fpcomplete.com> [2013-09-10 04:48:36-0500]
Niklas Hambüchen <mail@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
Me too, but I wasn't brave enough to say so after people seemed to be taking it seriously... On 10 September 2013 13:33, Roman Cheplyaka <roma@ro-che.info> wrote:
* John Wiegley <johnw@fpcomplete.com> [2013-09-10 04:48:36-0500]
> Niklas Hambüchen <mail@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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Ian Ross Tel: +43(0)6804451378 ian@skybluetrades.net www.skybluetrades.net
I'll admit, I also thought it was a joke. On Tue, Sep 10, 2013 at 2:34 PM, Ian Ross <ian@skybluetrades.net> wrote:
Me too, but I wasn't brave enough to say so after people seemed to be taking it seriously...
On 10 September 2013 13:33, Roman Cheplyaka <roma@ro-che.info> wrote:
* John Wiegley <johnw@fpcomplete.com> [2013-09-10 04:48:36-0500]
>> Niklas Hambüchen <mail@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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Ian Ross Tel: +43(0)6804451378 ian@skybluetrades.net www.skybluetrades.net
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
The syntax is actually used by non-technical people to write tests. Using it to write Haskell code is a joke. (Using it for business specification is not, even if for technical people this seems overkill.) Thu 2013/9/10 Ian Ross <ian@skybluetrades.net>:
Me too, but I wasn't brave enough to say so after people seemed to be taking it seriously...
On 10 September 2013 13:33, Roman Cheplyaka <roma@ro-che.info> wrote:
* John Wiegley <johnw@fpcomplete.com> [2013-09-10 04:48:36-0500]
>> Niklas Hambüchen <mail@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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Ian Ross Tel: +43(0)6804451378 ian@skybluetrades.net www.skybluetrades.net
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
That was done around 100 years ago with COBOL. 2013/9/10 Vo Minh Thu <noteed@gmail.com>
The syntax is actually used by non-technical people to write tests. Using it to write Haskell code is a joke. (Using it for business specification is not, even if for technical people this seems overkill.)
Thu
2013/9/10 Ian Ross <ian@skybluetrades.net>:
Me too, but I wasn't brave enough to say so after people seemed to be taking it seriously...
On 10 September 2013 13:33, Roman Cheplyaka <roma@ro-che.info> wrote:
* John Wiegley <johnw@fpcomplete.com> [2013-09-10 04:48:36-0500]
>>> Niklas Hambüchen <mail@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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Ian Ross Tel: +43(0)6804451378 ian@skybluetrades.net www.skybluetrades.net
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Alberto.
"Gherkin is the language that Cucumber understands. It is a Business Readable, Domain Specific Language that lets you describe software’s behaviour without detailing how that behaviour is implemented." [1] The example detailed how foldl is implemented. Also, as it is intended to be a DSL for *business*, I think it has nothing to do with Haskell (the *technology*), i.e. no need for a "hs" in the file extension, just call it "whatever.gherkin" and pass it to a Gherkin-interpreter or something. [1] https://github.com/cucumber/cucumber/wiki/Gherkin
This is completely irrelevant, but the .chs extension is already taken by the c2hs tool. Cheers, Edward Excerpts from Niklas Hambüchen's message of Tue Sep 10 00:30:41 -0700 2013:
Impressed by the productivity of my Ruby-writing friends, I have recently come across Cucumber: http://cukes.info
It is a great tool for specifying tests and programs in natural language, and especially easy to learn for beginners.
I propose that we add a Cucumber syntax for Haskell, with the extension ".chs", next to .hs and .lhs.
Code written in cucumber syntax is concise and easy to read: You can find some example code in https://gist.github.com/nh2/6505995. Quoting from that:
Feature: The Data.List module
In order to be able to use lists As a programmer I want a module that defines list functions
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
PS: People even already started a testing framework for Haskell in it: https://github.com/sol/cucumber-haskell#cucumber-for-haskell
To be exact, the syntax is Gherkin not cucumber. https://github.com/cucumber/cucumber/wiki/Gherkin And, there's already a library to run specs written in Gherkin. https://github.com/marcotmarcot/chuchu On Tue, Sep 10, 2013 at 7:08 PM, Edward Z. Yang <ezyang@mit.edu> wrote:
This is completely irrelevant, but the .chs extension is already taken by the c2hs tool.
Cheers, Edward
Excerpts from Niklas Hambüchen's message of Tue Sep 10 00:30:41 -0700 2013 :
Impressed by the productivity of my Ruby-writing friends, I have recently come across Cucumber: http://cukes.info
It is a great tool for specifying tests and programs in natural language, and especially easy to learn for beginners.
I propose that we add a Cucumber syntax for Haskell, with the extension ".chs", next to .hs and .lhs.
Code written in cucumber syntax is concise and easy to read: You can find some example code in https://gist.github.com/nh2/6505995. Quoting from that:
Feature: The Data.List module
In order to be able to use lists As a programmer I want a module that defines list functions
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
PS: People even already started a testing framework for Haskell in it: https://github.com/sol/cucumber-haskell#cucumber-for-haskell
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
On 09/10/2013 09:30 AM, Niklas Hambüchen wrote:
Impressed by the productivity of my Ruby-writing friends, I have recently come across Cucumber: http://cukes.info
It is a great tool for specifying tests and programs in natural language, and especially easy to learn for beginners.
I propose that we add a Cucumber syntax for Haskell, with the extension ".chs", next to .hs and .lhs.
Code written in cucumber syntax is concise and easy to read: You can find some example code in https://gist.github.com/nh2/6505995. Quoting from that:
Feature: The Data.List module
In order to be able to use lists As a programmer I want a module that defines list functions
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
PS: People even already started a testing framework for Haskell in it: https://github.com/sol/cucumber-haskell#cucumber-for-haskell
The above hardly is an acceptable state of affairs. While I appreciate the effort, clearly Cucumber is a rather limited tool and should be replaced by something more sophisticated that actually delivers the promises of conciseness and being easy to read. My first shot (this can probably be made even more concise and/or easier to read): Feature: The Data.List module In order to be able to use lists more conveniently As a programmer I want a module that defines some common operations on lists Scenario: Defining the function 'foldl' Given I want to define 'foldl' Which whenever given a thing that whenever given a thing of some first kind will give a thing that whenever given a thing of some second kind will give a thing of the first kind again, will give something that whenever given a thing of the first kind will give something that whenever given a list containing things of the second kind will give something of the first kind. When the list is empty Then the result better be the aforementioned thing of the first kind Otherwise the list has a first thing in it and the remaining things form a list again. Then we get the result by giving to 'foldl' the first thing mentioned and to the result we give the result we get by giving the first thing in the list to the thing we get by giving the thing of the first kind to the thing we already gave to 'foldl' and then give to what we get the list of remaining things.
This might do for businesses, but clearly not adequate if we want Haskell/Cucumber (ever) to be suitable for use in government. Here I’d like to suggest a more rigorous approach, which hopefully will be considered for implementation instead of the original proposal. MODULE Data.List 1st proposal To promote prosperity, creativity, entrepreneurship, and innovation by providing convenient functions operating on lists, and for other purposes. IN THE STANDARD LIBRARY OF HASKELL September 10, 2013 Mr. KAZAK of Russia, Saint-Petersburg (for himself and Mr. GEHR, Mr. HAMBÜCHEN, Mr. WIEGLEY, Mr. ZIMMERMAN, Mr. CHEPLYAKA, Mr. ROSS, Mr. SNOYMAN, Mr. NEGRI, Mr. YANG and Mr. FUJIMURA) introduced the following module; which was referred to the Café of Haskell. A MODULE Be it approved by the General Public and Maintainers of `base` package, SECTION ONE. SHORT TITLE; TABLE OF CONTENTS =========================================== (a) Short Title - This Module may be cited as the ‘Data.List module’. (b) Table of Contents - The table of contents of this Module is as follows: Sec. 1. Short title; table of contents. ... TITLE I - HISTORY AND BACKGROUND -------------------------------- Sec. 101. Definitions. Sec. 102. Action by Simon Peyton-Jones to protect Haskell users and prevent success at all costs¹. Sec. 103. Immunity for taking voluntary action against LANGUAGE pragmas dedicated to theft of syntax. Sec. 104. Immunity for taking voluntary action against libraries that make heavy use of unsafePerformIO. Sec. 105. Guidelines and study. Sec. 106. Denying `base` maintainership to notorious Applicative => Monad proposal supporters. TITLE II — THE ‘FOLDL’ FUNCTION ------------------------------- Sec. 201. Type of ‘foldl’. Sec. 202. Specification of ‘foldl’. Sec. 203. Implementation of ‘foldl’. END OF TABLE OF CONTENTS ------------------------ TITLE I — HISTORY AND DEFINITIONS SEC. 101. DEFINITIONS. In this title: (1) FUNCTION - The term ‘function’ has the meaning implied in the Haskell 98 Report, even though it isn’t actually given there. (2) LIST - The term ‘list’ means a datatype used to provide the means of accessing data stored in it sequentially, starting with the first element and moving to the next element without delay, i.e. in O(1) time. (3) EMPTY LIST — The term ‘empty list’ denotes a list which does not contain any data, explicitly or implicitly, and which restricts any of the attempts to obtain its first element through the well-defined mechanism of exceptions and compile-time pattern match failures. (3) NON-EMPTY LIST - The term ‘non-empty list’ means a list which is not an empty list. ... TITLE II — THE ‘FOLDL’ FUNCTION SEC. 201. TYPE OF ‘FOLDL’ For any types A and B, be they sum types, product types, a valid combination of sum and/or product types; types defined in the Standard Library, defined by users of Haskell or defined in one of the Imported Modules; resulting from execution of Template Haskell; from execution of a generator written in another programming language, not excluding Haskell; or written by human(s): (a) function ‘foldl’ requires an argument which itself must be a function: (1) which requires an argument of type A and shall produce a function: (2) which requires an argument of type B and shall produce a value of type A. (b) and shall produce a function: (1) which requires an argument of type A and shall produce a function: (2) which requires an argument of type, which denotes the set of all lists, empty or non-empty, together with bottom and further abominations, which shall contain elements of type B, and shall produce a value of type A. SEC. 202. SPECIFICATION OF ‘FOLDL’ Assuming the following: (a) the argument of ′foldl’ is denoted by ‘f’. (b) the argument of the produced function is denoted by ′acc’. (c) the argument of the function, produced by the produced function, is denoted by ‘l’. Then it shall be held that: (a) ‘foldl’ must be using ‘f’ while processing the elements of ‘l’, and it may not use any other function, either supplied to it implicitly or explicitly, defined in Data.List module, other modules included into Standard Library, Hackage or any other collection of modules. (1) Other functions may be defined for internal use by ‘foldl’, but they shall not be used to replace ‘f’, as it is deemed highly unlikely that any of such defined functions are adequate replacements of ‘f’ and do not attempt to invade any country through means of launching missiles. (b) ‘foldl’ must process ‘l’ as follows: (1) it shall not skip an element. (2) it shall process the elements in the sequential order enforced by structure of list datatype. (3) it shall process the first element. (4) it shall process the last element or never produce anything. (5) it shall not use any element twice or any higher number of times. (c) ‘foldl’ must not produce a function which would be capable of resorting to any of the abominations when processing ‘l’. (1) specifically, when an argument of type A is demanded, it is permitted to use ‘acc’. Any usage of ‘bottom’ is prohibited. SEC 203. IMPLEMENTATION OF ‘FOLDL’ The behaviour of function produced by ‘foldl’ when given a valid argument ‘f’ is described in this section. (a) Base case: ‘foldl’ shall produce a function which shall produce a function which, when it has been determined through pattern-matching or ‘null’ function, provided in Standard Library, that the list ‘l’ is empty, shall use provided to it ‘acc’ as its returned value, without any attempt of modifying it. (b) Recursive case: ‘foldl' shall produce a function which shall produce a function which, when it has been determined through pattern-matching or ‘null’ function, possibly using ‘not’ function, both provided in Standard Library, that the list ‘l’ is non-empty, shall: (1) represent it as a pair consisting of the first element of ‘l’ and the list containing all elements of ‘l’, necessarily excluding the first element, in order of their appearance in ′l’; for clarity, the first element of that pair may be denoted by ‘x’, and the other element — as ‘xs’. (2) apply the function, produced by ‘foldl’, to the result of applying the result of applying ‘f’ to ‘acc’ to ‘x’, and apply the produced function to ‘xs’. (3) return the produced value. ¹just kidding, sorry. On Tue, 10 Sep 2013 16:41:38 +0400, Timon Gehr <timon.gehr@gmx.ch> wrote:
The above hardly is an acceptable state of affairs. While I appreciate the effort, clearly Cucumber is a rather limited tool and should be replaced by something more sophisticated that actually delivers the promises of conciseness and being easy to read.
My first shot (this can probably be made even more concise and/or easier to read):
Feature: The Data.List module
In order to be able to use lists more conveniently As a programmer I want a module that defines some common operations on lists
Scenario: Defining the function 'foldl' Given I want to define 'foldl' Which whenever given a thing that whenever given a thing of some first kind will give a thing that whenever given a thing of some second kind will give a thing of the first kind again, will give something that whenever given a thing of the first kind will give something that whenever given a list containing things of the second kind will give something of the first kind. When the list is empty Then the result better be the aforementioned thing of the first kind Otherwise the list has a first thing in it and the remaining things form a list again. Then we get the result by giving to 'foldl' the first thing mentioned and to the result we give the result we get by giving the first thing in the list to the thing we get by giving the thing of the first kind to the thing we already gave to 'foldl' and then give to what we get the list of remaining things.
On Wed, 11 Sep 2013 00:20:26 +0400, Thiago Negri <evohunz@gmail.com> wrote:
I hope these jokes do not cause people to be afraid to post new ideas.
Agreed. I would also like to clarify that my message was much more a joke on the incomprehensibility of legal acts than on the original proposal. By the way, I am pretty impressed with this piece of Cucumber description/code: Scenario: Mislav creates a valid task with an upload When I go to the "Awesome Ruby Yahh" task list page of the "Ruby Rockstars" project When I follow "+ Add Task" And I fill in "Task title" with "Ohhh upload" And I follow "Attachment" When I attach the file "features/support/sample_files/dragon.jpg" to "upload_file" And I press "Add Task" And I wait for 1 second And I should see "Ohhh upload" as a task name I was much more sceptical when I had only seen the example in Niklas’s message.
+1 Cucumber seems to be great if you mainly want to read your code over the telephone, distribute it via national radio broadcast, or dictate it to your secretary or your voice recognition software. You can program thus without having to use you fingers. You can lie on your back on your sofa, close your eyes, and utter your programs... We could have blind Haskell/Cucumber programming contests... Tons of new possiblilities... Strongly support this proposal. ;-) Andreas On 2013-09-10 22:57, Artyom Kazak wrote:
On Wed, 11 Sep 2013 00:20:26 +0400, Thiago Negri <evohunz@gmail.com> wrote:
I hope these jokes do not cause people to be afraid to post new ideas.
Agreed. I would also like to clarify that my message was much more a joke on the incomprehensibility of legal acts than on the original proposal.
By the way, I am pretty impressed with this piece of Cucumber
description/code:
Scenario: Mislav creates a valid task with an
upload
When I go to the "Awesome Ruby Yahh" task list page of the "Ruby Rockstars" project When I follow "+ Add Task" And I fill in "Task title" with "Ohhh upload" And I follow "Attachment" When I attach the file "features/support/sample_files/dragon.jpg" to
"upload_file"
And I press "Add Task" And I wait for 1 second And I should see "Ohhh upload" as a task name
I was much more sceptical when I had only seen the example in Niklas's message.
_______________________________________________
Haskell-Cafe mailing list Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe [1] -- Andreas Abel <>< Du bist der geliebte Mensch. Theoretical Computer Science, University of Munich http://www.tcs.informatik.uni-muenchen.de/~abel/ Links: ------ [1] http://www.haskell.org/mailman/listinfo/haskell-cafe
I've long been interested in a scripting language designed to be spoken. Not interested enough to go about making it happen... but the idea is fascinating and possibly useful. On Thu, Sep 12, 2013 at 2:57 PM, Andreas Abel <andreas.abel@ifi.lmu.de>wrote:
**
+1
Cucumber seems to be great if you mainly want to read your code over the telephone, distribute it via national radio broadcast, or dictate it to your secretary or your voice recognition software. You can program thus without having to use you fingers. You can lie on your back on your sofa, close your eyes, and utter your programs...
We could have blind Haskell/Cucumber programming contests...
Tons of new possiblilities...
Strongly support this proposal. ;-)
Andreas
On 2013-09-10 22:57, Artyom Kazak wrote:
On Wed, 11 Sep 2013 00:20:26 +0400, Thiago Negri <evohunz@gmail.com> wrote:
I hope these jokes do not cause people to be afraid to post new ideas.
Agreed. I would also like to clarify that my message was much more a joke on the incomprehensibility of legal acts than on the original proposal.
By the way, I am pretty impressed with this piece of Cucumber description/code:
Scenario: Mislav creates a valid task with an upload When I go to the "Awesome Ruby Yahh" task list page of the "Ruby Rockstars" project When I follow "+ Add Task" And I fill in "Task title" with "Ohhh upload" And I follow "Attachment" When I attach the file "features/support/sample_files/dragon.jpg" to "upload_file" And I press "Add Task" And I wait for 1 second And I should see "Ohhh upload" as a task name
I was much more sceptical when I had only seen the example in Niklas’s message. _______________________________________________ Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe
-- Andreas Abel <>< Du bist der geliebte Mensch.
Theoretical Computer Science, University of Munich http://www.tcs.informatik.uni-muenchen.de/~abel/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
On Thu, Sep 12, 2013 at 6:00 PM, David Thomas <davidleothomas@gmail.com>wrote:
I've long been interested in a scripting language designed to be spoken. Not interested enough to go about making it happen... but the idea is fascinating and possibly useful.
http://en.wikipedia.org/wiki/Shakespeare_(programming_language) ? :) -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Have you tried AppleScript? I wouldn't say it's pleasant to use, but it's easy to read. On Thursday, September 12, 2013, David Thomas wrote:
I've long been interested in a scripting language designed to be spoken. Not interested enough to go about making it happen... but the idea is fascinating and possibly useful.
On Thu, Sep 12, 2013 at 2:57 PM, Andreas Abel <andreas.abel@ifi.lmu.de<javascript:_e({}, 'cvml', 'andreas.abel@ifi.lmu.de');>
wrote:
**
+1
Cucumber seems to be great if you mainly want to read your code over the telephone, distribute it via national radio broadcast, or dictate it to your secretary or your voice recognition software. You can program thus without having to use you fingers. You can lie on your back on your sofa, close your eyes, and utter your programs...
We could have blind Haskell/Cucumber programming contests...
Tons of new possiblilities...
Strongly support this proposal. ;-)
Andreas
On 2013-09-10 22:57, Artyom Kazak wrote:
On Wed, 11 Sep 2013 00:20:26 +0400, Thiago Negri <evohunz@gmail.com <javascript:_e({}, 'cvml', 'evohunz@gmail.com');>> wrote:
I hope these jokes do not cause people to be afraid to post new ideas.
Agreed. I would also like to clarify that my message was much more a joke on the incomprehensibility of legal acts than on the original proposal.
By the way, I am pretty impressed with this piece of Cucumber description/code:
Scenario: Mislav creates a valid task with an upload When I go to the "Awesome Ruby Yahh" task list page of the "Ruby Rockstars" project When I follow "+ Add Task" And I fill in "Task title" with "Ohhh upload" And I follow "Attachment" When I attach the file "features/support/sample_files/dragon.jpg" to "upload_file" And I press "Add Task" And I wait for 1 second And I should see "Ohhh upload" as a task name
I was much more sceptical when I had only seen the example in Niklas’s message. _______________________________________________ Haskell-Cafe mailing listHaskell-Cafe@haskell.org <javascript:_e({}, 'cvml', 'Haskell-Cafe@haskell.org');>http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Andreas Abel <>< Du bist der geliebte Mensch.
Theoretical Computer Science, University of Munich http://www.tcs.informatik.uni-muenchen.de/~abel/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org <javascript:_e({}, 'cvml', 'Haskell-Cafe@haskell.org');> http://www.haskell.org/mailman/listinfo/haskell-cafe
I just want to chime in to defend Cucumber, which I use in Ruby at my day job. I see a lot of people put up the strawman that it can only be used as a way for business people to write acceptance tests. That idea is questionable and I've never worked at a company big enough to require that, or with business people who have ever wanted to write my tests for me. In Ruby, I use Cucumber purely for myself to drive high level acceptance tests for products. I think the sweet spot for it is when you're starting work on a high level feature and you have NO idea how it will be implemented or even how it will work in detail. I find that writing in the limited language that Gherkin provides keeps my brain from going right to implementation details. I write out tests that explore how the system should work. I write them in the perspective of the user (which you should be doing in your head regardless because the user is the one who will actually interact with your program). I then read them back and make sure they make logical sense. Only then do I start hooking up the steps I wrote to code that drives integration/acceptance tests, via a browser for instance. At the end I have a failing cucumber test that describes the system in an intuitive manner with zero line noise (programming language syntax). I am now free to think about implementation details, write lower level unit tests and implement things that can be described in much less verbose fashion. I really like that process and if I ever had a job to develop products in Haskell, I'd probably take a similar approach. Do note that I advocate using Cucumber to create/drive user stories, not to unit test low level functions like folds. If you don't have a customer of a particular function who could describe how they interact with it in layman's term, then Cucumber is the wrong tool. Use quickcheck/hunit/hspec for that. On Thu, Sep 12, 2013 at 3:42 PM, Bob Ippolito <bob@redivi.com> wrote:
Have you tried AppleScript? I wouldn't say it's pleasant to use, but it's easy to read.
On Thursday, September 12, 2013, David Thomas wrote:
I've long been interested in a scripting language designed to be spoken. Not interested enough to go about making it happen... but the idea is fascinating and possibly useful.
On Thu, Sep 12, 2013 at 2:57 PM, Andreas Abel <andreas.abel@ifi.lmu.de>wrote:
**
+1
Cucumber seems to be great if you mainly want to read your code over the telephone, distribute it via national radio broadcast, or dictate it to your secretary or your voice recognition software. You can program thus without having to use you fingers. You can lie on your back on your sofa, close your eyes, and utter your programs...
We could have blind Haskell/Cucumber programming contests...
Tons of new possiblilities...
Strongly support this proposal. ;-)
Andreas
On 2013-09-10 22:57, Artyom Kazak wrote:
On Wed, 11 Sep 2013 00:20:26 +0400, Thiago Negri <evohunz@gmail.com> wrote:
I hope these jokes do not cause people to be afraid to post new ideas.
Agreed. I would also like to clarify that my message was much more a joke on the incomprehensibility of legal acts than on the original proposal.
By the way, I am pretty impressed with this piece of Cucumber description/code:
Scenario: Mislav creates a valid task with an upload When I go to the "Awesome Ruby Yahh" task list page of the "Ruby Rockstars" project When I follow "+ Add Task" And I fill in "Task title" with "Ohhh upload" And I follow "Attachment" When I attach the file "features/support/sample_files/dragon.jpg" to "upload_file" And I press "Add Task" And I wait for 1 second And I should see "Ohhh upload" as a task name
I was much more sceptical when I had only seen the example in Niklas’s message. _______________________________________________ Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe
-- Andreas Abel <>< Du bist der geliebte Mensch.
Theoretical Computer Science, University of Munich http://www.tcs.informatik.uni-muenchen.de/~abel/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Michael Xavier http://www.michaelxavier.net
My problem with cucumber is not the idea of a high-level DSL for tests. Au contraire--I think this is a perfect place for a little language. I could easily see a similar tool being useful for Haskell. Rather, my issue is with the syntax. Not gherkin in particular but rather languages that try to look like English in general. For one, these languages tend to hit the uncanny valley--they're somewhat natural, but not entirely. Perhaps the code reads like poorly written prose, but you certainly can't write it in a natural fashion! More importantly, I do not think prose is a good format for this sort of thing at all. It's good for reading code, but I almost never read code directly. Instead, I usually look over large parts of code at a time. I want code where I can get the structure at a glance and easily separate the parts that are specific to the current application from ones that aren't. With prose-like syntax, this is very difficult because everything is made of words. That programming language syntax you dismiss as line noise? It's actually the structure of the code, which makes it much *faster* to read! There's a reason mathematicians user equations and diagrams so much. A single equation can replace literally pages of text, and you can have a pretty good idea of what's going on without having to look too closely at all the details. Think about an integral, for example: from the equation, you can easily see what sort of equation it is (trigonometric, polynomial, exponential...), what domain you're integrating over, what the limits are and, very importantly, that it *is* an integral rather than something completely different. All just from what the equation looks like, before you've had to expend much attention on it. One way to think about it is that the notation factors out the repeated parts of an integral so that it's easy to visually separate from the "meat"--the function you're actually integrating. A good DSL uses symbols to do the same thing. The main cost, of course, is that you have to learn the notation. But this is really a one-time cost; if you're going to be seeing a lot of integrals, it's more than worth doing, especially because there's so much shared structure between them. Similarly, it's worth doing for tests, for the same reasons. There's a lot of shared structure--just look at how many relatively long phrases got repeated even in the simple examples given here--and you want to look over that structure without actually reading it. Much easier with actual syntax than prose. In any real app, you will have hundreds of tests, and learning to deal with the "line noise" gets amortized over all of them, whereas the benefits (shorter code that's easier to scan) scale at least linearly. So I think we should really avoid the faux-natural-language syntax as much as possible. I just want to chime in to defend Cucumber, which I use in Ruby at my day job. I see a lot of people put up the strawman that it can only be used as a way for business people to write acceptance tests. That idea is questionable and I've never worked at a company big enough to require that, or with business people who have ever wanted to write my tests for me. In Ruby, I use Cucumber purely for myself to drive high level acceptance tests for products. I think the sweet spot for it is when you're starting work on a high level feature and you have NO idea how it will be implemented or even how it will work in detail. I find that writing in the limited language that Gherkin provides keeps my brain from going right to implementation details. I write out tests that explore how the system should work. I write them in the perspective of the user (which you should be doing in your head regardless because the user is the one who will actually interact with your program). I then read them back and make sure they make logical sense. Only then do I start hooking up the steps I wrote to code that drives integration/acceptance tests, via a browser for instance. At the end I have a failing cucumber test that describes the system in an intuitive manner with zero line noise (programming language syntax). I am now free to think about implementation details, write lower level unit tests and implement things that can be described in much less verbose fashion. I really like that process and if I ever had a job to develop products in Haskell, I'd probably take a similar approach. Do note that I advocate using Cucumber to create/drive user stories, not to unit test low level functions like folds. If you don't have a customer of a particular function who could describe how they interact with it in layman's term, then Cucumber is the wrong tool. Use quickcheck/hunit/hspec for that. On Thu, Sep 12, 2013 at 3:42 PM, Bob Ippolito <bob@redivi.com> wrote:
Have you tried AppleScript? I wouldn't say it's pleasant to use, but it's easy to read.
On Thursday, September 12, 2013, David Thomas wrote:
I've long been interested in a scripting language designed to be spoken. Not interested enough to go about making it happen... but the idea is fascinating and possibly useful.
On Thu, Sep 12, 2013 at 2:57 PM, Andreas Abel <andreas.abel@ifi.lmu.de>wrote:
**
+1
Cucumber seems to be great if you mainly want to read your code over the telephone, distribute it via national radio broadcast, or dictate it to your secretary or your voice recognition software. You can program thus without having to use you fingers. You can lie on your back on your sofa, close your eyes, and utter your programs...
We could have blind Haskell/Cucumber programming contests...
Tons of new possiblilities...
Strongly support this proposal. ;-)
Andreas
On 2013-09-10 22:57, Artyom Kazak wrote:
On Wed, 11 Sep 2013 00:20:26 +0400, Thiago Negri <evohunz@gmail.com> wrote:
I hope these jokes do not cause people to be afraid to post new ideas.
Agreed. I would also like to clarify that my message was much more a joke on the incomprehensibility of legal acts than on the original proposal.
By the way, I am pretty impressed with this piece of Cucumber description/code:
Scenario: Mislav creates a valid task with an upload When I go to the "Awesome Ruby Yahh" task list page of the "Ruby Rockstars" project When I follow "+ Add Task" And I fill in "Task title" with "Ohhh upload" And I follow "Attachment" When I attach the file "features/support/sample_files/dragon.jpg" to "upload_file" And I press "Add Task" And I wait for 1 second And I should see "Ohhh upload" as a task name
I was much more sceptical when I had only seen the example in Niklas’s message. _______________________________________________ Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe
-- Andreas Abel <>< Du bist der geliebte Mensch.
Theoretical Computer Science, University of Munich http://www.tcs.informatik.uni-muenchen.de/~abel/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Michael Xavier http://www.michaelxavier.net _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
A specification language is desirable. (Test cases are special cases of specifications. Test-driven development is a revival of the waterfall process.) For specifying interactions (computer-computer or computer-human), I recommend "live sequence charts" of David Harel, or generally any one based on temporal logics. The problems with natural languages or sublanguages for anything from specification to implementation are: 0. You have to transit to formal languages at some point (the implementation is formal). The later you transit, the later you can use a computer to analyze and/or simulate for catching mistakes. You catch fewer mistakes, and later. 1. To re-gain the benefit of formality above, some people settle for restrictive sublanguages. Thus naturalness is lost anyway. The problems below, however, are still preserved. 2. Natural languages and sublanguages lack diagrams. For some specifications, formal diagrammatic languages are more suitable (e.g., live sequence charts). 3. Natural languages and sublanguages lack scoping and parenthesizing such as in mathematical notation and formal languages: sqrt (sin (x^2 + y) - 2) * z (forall r. (Int -> M r) -> M r) -> M Int forall r. ((Int -> M r) -> M r) -> M Int
Honestly, I've not. Worth looking at, probably. On Thu, Sep 12, 2013 at 3:42 PM, Bob Ippolito <bob@redivi.com> wrote:
Have you tried AppleScript? I wouldn't say it's pleasant to use, but it's easy to read.
On Thursday, September 12, 2013, David Thomas wrote:
I've long been interested in a scripting language designed to be spoken. Not interested enough to go about making it happen... but the idea is fascinating and possibly useful.
On Thu, Sep 12, 2013 at 2:57 PM, Andreas Abel <andreas.abel@ifi.lmu.de>wrote:
**
+1
Cucumber seems to be great if you mainly want to read your code over the telephone, distribute it via national radio broadcast, or dictate it to your secretary or your voice recognition software. You can program thus without having to use you fingers. You can lie on your back on your sofa, close your eyes, and utter your programs...
We could have blind Haskell/Cucumber programming contests...
Tons of new possiblilities...
Strongly support this proposal. ;-)
Andreas
On 2013-09-10 22:57, Artyom Kazak wrote:
On Wed, 11 Sep 2013 00:20:26 +0400, Thiago Negri <evohunz@gmail.com> wrote:
I hope these jokes do not cause people to be afraid to post new ideas.
Agreed. I would also like to clarify that my message was much more a joke on the incomprehensibility of legal acts than on the original proposal.
By the way, I am pretty impressed with this piece of Cucumber description/code:
Scenario: Mislav creates a valid task with an upload When I go to the "Awesome Ruby Yahh" task list page of the "Ruby Rockstars" project When I follow "+ Add Task" And I fill in "Task title" with "Ohhh upload" And I follow "Attachment" When I attach the file "features/support/sample_files/dragon.jpg" to "upload_file" And I press "Add Task" And I wait for 1 second And I should see "Ohhh upload" as a task name
I was much more sceptical when I had only seen the example in Niklas’s message. _______________________________________________ Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe
-- Andreas Abel <>< Du bist der geliebte Mensch.
Theoretical Computer Science, University of Munich http://www.tcs.informatik.uni-muenchen.de/~abel/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (21)
-
AlanKim Zimmerman -
Albert Y. C. Lai -
Alberto G. Corona -
Andreas Abel -
Artyom Kazak -
Bob Ippolito -
Brandon Allbery -
Daisuke Fujimura -
David Thomas -
Edward Z. Yang -
Ian Ross -
John Wiegley -
Michael Snoyman -
Michael Xavier -
Niklas Hambüchen -
Roman Cheplyaka -
sumit mahamuni -
Thiago Negri -
Tikhon Jelvis -
Timon Gehr -
Vo Minh Thu