Re: [Haskell-cafe] GHC API question: Getting access to cpp processed source

2013-09-10 Thread AlanKim Zimmerman
Thanks for the reference, but GHC already invokes the CPP.

I think I am going to have to invoke a load of the module with ghc flags
set to keep the output of the CPP phase, and then re-invoke it on that
output to get the tokens.

My question is more whether this CPP output can be kept in the GHC session
for re-use, or whether I will have to mess around on the file system.

Alan


On Wed, Sep 11, 2013 at 12:56 AM, Henk-Jan van Tuyl wrote:

> On Wed, 11 Sep 2013 00:54:07 +0200, Henk-Jan van Tuyl 
> wrote:
>
>  Another option could be the cpphs package; the documentation has
>> disappeared from haskell.org, but can be found in the Web Archive[0].
>>
>
> I just found the latest documentation at
> http://code.haskell.org/cpphs/**docs/
>
> Regards,
> Henk-Jan van Tuyl
>
>
>
> --
> Folding@home
> What if you could share your unused computer power to help find a cure? In
> just 5 minutes you can join the world's biggest networked computer and get
> us closer sooner. Watch the video.
> http://folding.stanford.edu/
>
>
> http://Van.Tuyl.eu/
> http://members.chello.nl/**hjgtuyl/tourdemonad.html
> Haskell programming
> --
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GLFW not working in Cabal 1.18

2013-09-10 Thread Carter Schonwald
the work around i did for cabal 1.18 compatibility for llvm-base can be
found here:

https://github.com/bos/llvm/blob/master/base/Setup.hs#L116-L144
this used the fact that cabal exposes the cabal version as a library value
to generate a correct wrapper for either API version

alternatively, you can change your setup.hs so that api isn't needed.

also: before emailing cafe, its always good to email the listed maintainers
first! (i've included them on CC for this email)



On Tue, Sep 10, 2013 at 9:27 PM, Thiago Negri  wrote:

> The package GLFW is not building in Cabal 1.18.
>
> Setup.hs [1] depends on `rawSystemStdInOut` [2] that changed signature
> between 1.16 and 1.18.
>
> Is this considered a public API of Cabal?
>
>
> Cabal 1.16
> rawSystemStdInOut
>  :: Verbosity
>  -> FilePath
>  -> [String]
>  -> Maybe (String, Bool)
>  -> Bool
>  -> IO (String, String, ExitCode)
>
>
> Cabal 1.18
> rawSystemStdInOut
>  :: Verbosity
>  -> FilePath
>  -> [String]
>  -> Maybe FilePath -- new arg
>  -> Maybe [(String, String)] -- new arg
>  -> Maybe (String, Bool)
>  -> Bool
>  -> IO (String, String, ExitCode)
>
>
>
> Compilation output:
>
> [1 of 1] Compiling Main (
> /tmp/GLFW-0.5.1.0-4035/GLFW-0.5.1.0/Setup.hs,
> /tmp/GLFW-0.5.1.0-4035/GLFW-0.5.1.0/dist/setup/Main.o )
>
> /tmp/GLFW-0.5.1.0-4035/GLFW-0.5.1.0/Setup.hs:167:33:
> Couldn't match expected type `IO (t0, t1, ExitCode)'
> with actual type `Maybe (String, Bool)
>   -> Bool -> IO (String, String, ExitCode)'
> In the return type of a call of `rawSystemStdInOut'
> Probable cause: `rawSystemStdInOut' is applied to too few arguments
> In a stmt of a 'do' block:
>   (out, err, exitCode) <- rawSystemStdInOut
> verbosity "cc" (["-c", path, "-o",
> objPath] ++ flags) Nothing False
> In the expression:
>   do { hClose outHandle;
>hPutStr inHandle contents;
>hClose inHandle;
>(out, err, exitCode) <- rawSystemStdInOut
>  verbosity "cc" (["-c", path, ] ++
> flags) Nothing False;
> }
>
> /tmp/GLFW-0.5.1.0-4035/GLFW-0.5.1.0/Setup.hs:167:113:
> Couldn't match expected type `Maybe [(String, String)]'
> with actual type `Bool'
> In the fifth argument of `rawSystemStdInOut', namely `False'
> In a stmt of a 'do' block:
>   (out, err, exitCode) <- rawSystemStdInOut
> verbosity "cc" (["-c", path, "-o",
> objPath] ++ flags) Nothing False
> In the expression:
>   do { hClose outHandle;
>hPutStr inHandle contents;
>hClose inHandle;
>(out, err, exitCode) <- rawSystemStdInOut
>  verbosity "cc" (["-c", path, ] ++
> flags) Nothing False;
> }
> Failed to install GLFW-0.5.1.0
>
>
> [1] http://code.haskell.org/GLFW/Setup.hs
> [2]
> https://github.com/haskell/cabal/blob/d16c307c33fb7af19d8f17a2ad8be4902a3af21e/Cabal/Distribution/Simple/Utils.hs#L454
>
>
> ___
> 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


Re: [Haskell-cafe] Lenses: Should I declare Getters?

2013-09-10 Thread Oliver Charles
On 09/10/2013 06:31 AM, Charlie Paul wrote:
> I've been looking through Edward Kmett's lens library, and I'm a bit
> befuddled about Getters. In my own code, why would I want to have
> something be a Getter instead of a plain function? As far as I can see,
> a plain function is simpler to use, and can be converted to a Getter
> with "to" if we want to use it as a Fold. Is there a situation where
> writing a Getter is superior than writing a function, then lifting it as
> needed?

Generally, you don't provide 'Getter's because people can always lift a
function with "to" - as you said. This is mentioned in the lens FAQ at:

https://github.com/ekmett/lens/wiki/FAQ#wiki-using-getters

- ocharles




signature.asc
Description: OpenPGP digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC API question: Getting access to cpp processed source

2013-09-10 Thread Henk-Jan van Tuyl
On Wed, 11 Sep 2013 00:54:07 +0200, Henk-Jan van Tuyl   
wrote:


Another option could be the cpphs package; the documentation has  
disappeared from haskell.org, but can be found in the Web Archive[0].


I just found the latest documentation at
http://code.haskell.org/cpphs/docs/

Regards,
Henk-Jan van Tuyl


--
Folding@home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.

http://folding.stanford.edu/


http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] GHC API question: Getting access to cpp processed source

2013-09-10 Thread AlanKim Zimmerman
Hi Cafe

I have just discovered that GHC.getTokenStream fails if it is used on a
module with CPP directives in it.

This is reported in http://ghc.haskell.org/trac/ghc/ticket/8265

Is there an easy way to get access to the pre-processed source, without
having to explicitly write it to an output file in a temporary location?

In other words an equivalent to getModuleSourceAndFlags that does the right
thing.

This currently prevents HaRe from processing files with preprocessor
directives in them, I would like to come up with a workaround for current
GHC versions, rather than having to wait for a future one.

Regards
  Alan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Transforming AST parametrized with type

2013-09-10 Thread Sergey Mironov
Hi. Pat asked a question [1] about AST parametrized with types. People
suggest to use Functor machinery if possible. Have anything changed
since them? Do we have a way to safely transform the tree like

data Expr a = Id { id :: Id a } | Op { op :: Char, expra :: (Expr a) ,
exprb :: (Expr a) }

data Id a = Id { name :: a }

from Expr String to, say, Expr Int where Int names may represent some
keys in the hash map?

Regards,
Sergey

[1] -  
http://stackoverflow.com/questions/5434889/is-it-possible-to-use-syb-to-transform-the-type

PS sclv suggested to use synthesize from SYB to solve the problem.
Could anyone provide me with example of this method?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Artyom Kazak

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 

Re: [Haskell-cafe] GHC API question: Getting access to cpp processed source

2013-09-10 Thread Henk-Jan van Tuyl
On Tue, 10 Sep 2013 22:03:16 +0200, AlanKim Zimmerman  
 wrote:



Is there an easy way to get access to the pre-processed source, without
having to explicitly write it to an output file in a temporary location?


You can run cpp with function readProcess, as done in function  
readHeaderFile in

https://github.com/wxHaskell/wxHaskell/blob/master/wxdirect/src/ParseC.hs

Windows does not come with cpp; one can install MinGW for this purpose.

Another option could be the cpphs package; the documentation has  
disappeared from haskell.org, but can be found in the Web Archive[0].


Regards,
Henk-Jan van Tuyl


[0] http://web.archive.org/web/20100620174616/http://haskell.org/cpphs/


--
Folding@home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.

http://folding.stanford.edu/


http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Reasoning about performance

2013-09-10 Thread Scott Pakin

On 09/03/2013 06:09 PM, Dan Burton wrote:

Here's a fun alternative for you to benchmark, using an old trick. I kind of 
doubt that this one will optimize as nicely as the others, but I am by no means 
an optimization guru:

allPairsS :: [a] -> [(a, a)]
allPairsS xs = go xs [] where
   go [] = id
   go (y:ys) = (map (\a -> (y, a)) ys ++) . go xs


Ummm...it loops forever.  Oh wait; I see it now: The final token
should be "ys", not "xs".  With this modification the code
unfortunately uses both a lot of time and a lot of memory.  For
reference, here was my original, naive version (using what we now know
to be a flawed way to measure execution time in a non-strict
language):

Prelude Control.DeepSeq AllPairs> deepseq (allPairs1 [1..1]) True
True
(4.85 secs, 4004173984 bytes)

And here's the resource usage of the difference-list implementation:

Prelude Control.DeepSeq AllPairs> deepseq (allPairs4 [1..1]) True
True
(11.34 secs, 8404906432 bytes)


Further reading:
http://www.haskell.org/haskellwiki/Difference_list


Thanks for the pointer.  I don't see why it's called a "difference
list", but I get the basic idea.

-- Scott
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] GLFW not working in Cabal 1.18

2013-09-10 Thread Thiago Negri
The package GLFW is not building in Cabal 1.18.

Setup.hs [1] depends on `rawSystemStdInOut` [2] that changed signature
between 1.16 and 1.18.

Is this considered a public API of Cabal?


Cabal 1.16
rawSystemStdInOut
 :: Verbosity
 -> FilePath
 -> [String]
 -> Maybe (String, Bool)
 -> Bool
 -> IO (String, String, ExitCode)


Cabal 1.18
rawSystemStdInOut
 :: Verbosity
 -> FilePath
 -> [String]
 -> Maybe FilePath -- new arg
 -> Maybe [(String, String)] -- new arg
 -> Maybe (String, Bool)
 -> Bool
 -> IO (String, String, ExitCode)



Compilation output:

[1 of 1] Compiling Main (
/tmp/GLFW-0.5.1.0-4035/GLFW-0.5.1.0/Setup.hs,
/tmp/GLFW-0.5.1.0-4035/GLFW-0.5.1.0/dist/setup/Main.o )

/tmp/GLFW-0.5.1.0-4035/GLFW-0.5.1.0/Setup.hs:167:33:
Couldn't match expected type `IO (t0, t1, ExitCode)'
with actual type `Maybe (String, Bool)
  -> Bool -> IO (String, String, ExitCode)'
In the return type of a call of `rawSystemStdInOut'
Probable cause: `rawSystemStdInOut' is applied to too few arguments
In a stmt of a 'do' block:
  (out, err, exitCode) <- rawSystemStdInOut
verbosity "cc" (["-c", path, "-o", objPath]
++ flags) Nothing False
In the expression:
  do { hClose outHandle;
   hPutStr inHandle contents;
   hClose inHandle;
   (out, err, exitCode) <- rawSystemStdInOut
 verbosity "cc" (["-c", path, ] ++
flags) Nothing False;
    }

/tmp/GLFW-0.5.1.0-4035/GLFW-0.5.1.0/Setup.hs:167:113:
Couldn't match expected type `Maybe [(String, String)]'
with actual type `Bool'
In the fifth argument of `rawSystemStdInOut', namely `False'
In a stmt of a 'do' block:
  (out, err, exitCode) <- rawSystemStdInOut
verbosity "cc" (["-c", path, "-o", objPath]
++ flags) Nothing False
In the expression:
  do { hClose outHandle;
   hPutStr inHandle contents;
   hClose inHandle;
   (out, err, exitCode) <- rawSystemStdInOut
 verbosity "cc" (["-c", path, ] ++
flags) Nothing False;
    }
Failed to install GLFW-0.5.1.0


[1] http://code.haskell.org/GLFW/Setup.hs
[2]
https://github.com/haskell/cabal/blob/d16c307c33fb7af19d8f17a2ad8be4902a3af21e/Cabal/Distribution/Simple/Utils.hs#L454
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Mistakes in documentation for weak pointers?

2013-09-10 Thread Heinrich Apfelmus

Dear café,

I'm currently studying weak pointers in order to implement garbage 
collection for a small JavaScript FFI used by the threepenny-gui library 
[1].


While the paper [2] is fairly clear, it seems that the documentation in 
System.Mem.Weak [3] differs in certain aspects. Could someone help me 
and clarify this? I have two questions:



1. The sentence in the documentation

"References from the finalizer to the key are treated in the same way as 
references from the value to the key: they do not keep the key alive."


seems incorrect in the subordinate clause. Namely, the paper only states 
that the weak pointer object does not keep the key alive. However, I 
understood that it is perfectly acceptable for the value to keep the key 
alive, and that this relation is not changed by  mkWeak . Is this still 
correct?


(The memo table example in the paper never stores the value itself, only 
a weak pointer to it, so it doesn't matter whether the value is 
reachable from the key or not.)



2. The sentence in the documentation

"A heap object is reachable if: ... It is a weak pointer object whose 
key is reachable."


seems to differ from the paper, which states that while weak pointers 
are always retained if their keys are alive, they can very much be 
unreachable. But if I think about it, the formulation in the 
documentation seems to be equivalent to the paper (as far as the 
semantics are concerned, it does not matter whether unreachable weak 
pointers are tombstoned or not.). Is that correct?



  [1]: http://www.haskell.org/haskellwiki/Threepenny-gui
  [2]: http://community.haskell.org/~simonmar/papers/weak.pdf
  [3]: 
http://hackage.haskell.org/packages/archive/base/latest/doc/html/System-Mem-Weak.html



Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Lenses: Should I declare Getters?

2013-09-10 Thread David Menendez
On Tue, Sep 10, 2013 at 1:31 AM, Charlie Paul  wrote:

> I've been looking through Edward Kmett's lens library, and I'm a bit
> befuddled about Getters. In my own code, why would I want to have something
> be a Getter instead of a plain function? As far as I can see, a plain
> function is simpler to use, and can be converted to a Getter with "to" if
> we want to use it as a Fold. Is there a situation where writing a Getter is
> superior than writing a function, then lifting it as needed?
>

 As I understand it, you'd be better off declaring a function and then
using "to".

Getters are a midpoint between a Lens and a Fold. With a lens, you can read
and write a single value in a larger structure. With a fold, you can read a
sequence of values in a larger structure.

The need for getters comes from to. "myLens . to f" cannot be a lens,
because modifying the value it points to would require an inverse for "f",
but if making it a fold would lose the property that it points to exactly
one value. So a getter lets you read a single value in a larger structure.

That being said, "view (myLens . to f)" is isomorphic to "f . view myLens".

-- 
Dave Menendez 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] Hackage 2 now available for beta testing

2013-09-10 Thread Duncan Coutts
On Tue, 2013-09-10 at 12:10 +0100, Ross Paterson wrote:
> On Mon, Sep 09, 2013 at 07:23:59PM +0100, Duncan Coutts wrote:
> > Well-Typed and the Industrial Haskell Group (IHG) are very pleased to
> > announce that Hackage 2 is now available for public beta testing. The
> > plan is to do the final switchover in late September, to coincide
> > with ICFP.
> > 
> > http://beta.hackage.haskell.org/
> 
> What's the story with haddock documentation?  I see that some packages
> have docs imported from the old server, some have newly generated docs,
> and some have none, but no indication whether a bot has tried to build
> it or not. 

Right, for old docs we imported it (building the really old packages is
rather tricky). The doc builder (hackage-build) is a client included in
the hackage-server package.

The doc builder does keep track of which packages it cannot build. That
information is reported via the build report mechanism, so we can
actually end up with many reports (from different clients) that a
package failed to build. Currently we do not present any of the build
report info on the site. While we can link to the raw build results,
what we really need is a way to digest the build reports and turn it
into useful info.

> There's mention of maintainer uploads of docs as a fallback,
> but I couldn't find where one would do that.  (It would also need to
> document the flags needed to get the links right.)

It's not yet well documented, but one can figure it out from the API
page:

http://beta.hackage.haskell.org/api#documentation-core

/package/:package/docs
  * GET: tar -- Download documentation
  * PUT: tar -- Upload documentation

That is, you can currently upload the doc tarball using a client like
curl -X PUT.

Yes, we'd need documentation to tell maintainers how to get the links
set up right.

-- 
Duncan Coutts, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Artyom Kazak

On Wed, 11 Sep 2013 00:20:26 +0400, Thiago Negri  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


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Timon Gehr

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.





___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC API question: Getting access to cpp processed source

2013-09-10 Thread Carter Schonwald
you need to run a preprocessor on it to remove the directives


On Tue, Sep 10, 2013 at 4:03 PM, AlanKim Zimmerman wrote:

> Hi Cafe
>
> I have just discovered that GHC.getTokenStream fails if it is used on a
> module with CPP directives in it.
>
> This is reported in http://ghc.haskell.org/trac/ghc/ticket/8265
>
> Is there an easy way to get access to the pre-processed source, without
> having to explicitly write it to an output file in a temporary location?
>
> In other words an equivalent to getModuleSourceAndFlags that does the
> right thing.
>
> This currently prevents HaRe from processing files with preprocessor
> directives in them, I would like to come up with a workaround for current
> GHC versions, rather than having to wait for a future one.
>
> Regards
>   Alan
>
> ___
> 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


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Thiago Negri
I hope these jokes do not cause people to be afraid to post new ideas.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Looking for GUI examples

2013-09-10 Thread Sergey Mironov
Wow. Thanks! Looks impressive.

Regards,
Sergey

2013/9/10 Ivan Perez :
> You may want to check one of Keera Studios' apps. All four of these do what
> you want:
>
> https://github.com/ivanperez-keera/haskellifi-trayicon
> https://github.com/ivanperez-keera/keera-diamondcard-sms-trayicon
> https://github.com/ivanperez-keera/keera-three-balance-checker
> https://github.com/keera-studios/keera-posture
>
> The code is well organised, each module tries to implement only one feature.
> The part that adds the tray icon, menus and modifies the image is in the
> Controller; usually you'd be looking for files with the names Icon*,
> Status*, Tray* or *Menu*
>
> One example:
> https://github.com/ivanperez-keera/haskellifi-trayicon/blob/master/src/Controller/Conditions/WifiListMenu.hs
> https://github.com/ivanperez-keera/haskellifi-trayicon/blob/master/src/Controller/Conditions/Icon.hs
>
> Note that the first module adds the menu to the icon, and the second one
> changes the icon.
>
> There are more complex examples in the other programs.
>
> Let me know if you have any questions.
>
> Cheers
>
> Ivan
>
>
> On 9 September 2013 15:23, Henk-Jan van Tuyl  wrote:
>>
>> On Mon, 09 Sep 2013 11:48:42 +0200, Sergey Mironov 
>> wrote:
>>
>>> Hi, Cafe. I'd like to write simple GUI utility containing tray icon
>>> and the menu. Could you please suggest Haskell example to make my
>>> start easier?
>>
>>
>> There is a simple wxHaskell program for this:
>>
>> https://github.com/wxHaskell/wxHaskell/blob/master/samples/wx/TestTaskBarIcon.hs
>>
>> There is however a problem with this (maybe just on Windows), see the bug
>> report I just entered:
>> http://sourceforge.net/p/wxhaskell/bugs/71/
>>
>> Regards,
>> Henk-Jan van Tuyl
>>
>>
>> --
>> Folding@home
>> What if you could share your unused computer power to help find a cure? In
>> just 5 minutes you can join the world's biggest networked computer and get
>> us closer sooner. Watch the video.
>> http://folding.stanford.edu/
>>
>>
>> http://Van.Tuyl.eu/
>> http://members.chello.nl/hjgtuyl/tourdemonad.html
>> Haskell programming
>> --
>>
>>
>> ___
>> 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


Re: [Haskell-cafe] resources on static analysis

2013-09-10 Thread Alejandro Serrano Mena
If you are interested in general program analysis, I recommend you the book
"Principles of Program Analysis" ]
http://www.amazon.com/Principles-Program-Analysis-Flemming-Nielson/dp/3540654100].
It's very complete, and covers the most important kind of analyses that you
can do (data-flow, constraint-based, abstract interpretation and
type-and-effect systems - the latter is the nearest to Haskell).

If you are interested in analyses that infer relations such as the one
shown above, you can check at size and cost analyses. Here are some
pointers:
- RAML [http://raml.tcs.ifi.lmu.de/] is based on ML, and includes in its
types information about the memory used by each function,
- The PhD thesis of Vasconcelos [
http://www.ncc.up.pt/~pbv/research/PB_Vasconcelos_PhD_thesis.pdf] uses
types with sizes to infer relations between the sizes of the arguments in a
call. It uses Haskell, so it may be the most relevant one,
- In my group we've done some work about size and resource analysis [
http://arxiv.org/abs/1308.3940]. It's Prolog-based, but the ideas are
general and could be applied to your case.


2013/9/10 Ian Ross 

> Not specifically about Haskell, but I read some lecture notes on this
> topic yesterday (by Michael Schwartzbach, PDF here:
> http://lara.epfl.ch/web2010/_media/sav08:schwartzbach.pdf).  The notes do
> a good job of explaining how you set up lattices for various kinds of
> analyses, and how calculating fixed points over those lattices can yield
> various sorts of interesting information.  Most of the examples are based
> on a simple imperative language, but much of the analysis is applicable to
> Haskell as well.
>
>
> On 10 September 2013 13:15, Maarten Faddegon <
> haskell-c...@maartenfaddegon.nl> wrote:
>
>> Dear list,
>>
>> I am interested in learning more about static analysis of Haskell code.
>> Specifically of the relation between arguments of recursive and
>> non-recursive calls.
>>
>> For example if we look at the ++ function from Prelude:
>>
>> (++) [] ys = ys
>> (++) (x:xs) ys = x : xs ++ ys
>>
>> amongst others, we could infer the relations:
>>
>> ys_i+1 = ys_i
>> (x:xs)_i+1 = xs_i
>>
>> Searching the web I found several tools (HLint, Haskabelle, Sourcegraph),
>> but I am interested in the theory behind this. If you could recommend a
>> paper or a book on this topic I would be grateful.
>>
>> Thanks,
>>   Maarten Faddegon
>> __**_
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/**mailman/listinfo/haskell-cafe
>>
>
>
>
> --
> Ian Ross   Tel: +43(0)6804451378   i...@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


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Thiago Negri
"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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Alberto G. Corona
That was done around 100 years ago with COBOL.


2013/9/10 Vo Minh Thu 

> 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 :
> > 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  wrote:
> >>
> >> * John Wiegley  [2013-09-10 04:48:36-0500]
> >> > > Niklas Hambüchen  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   i...@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.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Vo Minh Thu
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 :
> 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  wrote:
>>
>> * John Wiegley  [2013-09-10 04:48:36-0500]
>> > > Niklas Hambüchen  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   i...@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


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Michael Snoyman
I'll admit, I also thought it was a joke.


On Tue, Sep 10, 2013 at 2:34 PM, Ian Ross  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  wrote:
>
>> * John Wiegley  [2013-09-10 04:48:36-0500]
>> > > Niklas Hambüchen  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   i...@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


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Ian Ross
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  wrote:

> * John Wiegley  [2013-09-10 04:48:36-0500]
> > > Niklas Hambüchen  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   i...@skybluetrades.net
www.skybluetrades.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Roman Cheplyaka
* John Wiegley  [2013-09-10 04:48:36-0500]
> > Niklas Hambüchen  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


signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] resources on static analysis

2013-09-10 Thread Ian Ross
Not specifically about Haskell, but I read some lecture notes on this topic
yesterday (by Michael Schwartzbach, PDF here:
http://lara.epfl.ch/web2010/_media/sav08:schwartzbach.pdf).  The notes do a
good job of explaining how you set up lattices for various kinds of
analyses, and how calculating fixed points over those lattices can yield
various sorts of interesting information.  Most of the examples are based
on a simple imperative language, but much of the analysis is applicable to
Haskell as well.


On 10 September 2013 13:15, Maarten Faddegon <
haskell-c...@maartenfaddegon.nl> wrote:

> Dear list,
>
> I am interested in learning more about static analysis of Haskell code.
> Specifically of the relation between arguments of recursive and
> non-recursive calls.
>
> For example if we look at the ++ function from Prelude:
>
> (++) [] ys = ys
> (++) (x:xs) ys = x : xs ++ ys
>
> amongst others, we could infer the relations:
>
> ys_i+1 = ys_i
> (x:xs)_i+1 = xs_i
>
> Searching the web I found several tools (HLint, Haskabelle, Sourcegraph),
> but I am interested in the theory behind this. If you could recommend a
> paper or a book on this topic I would be grateful.
>
> Thanks,
>   Maarten Faddegon
> __**_
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/**mailman/listinfo/haskell-cafe
>



-- 
Ian Ross   Tel: +43(0)6804451378   i...@skybluetrades.net
www.skybluetrades.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] resources on static analysis

2013-09-10 Thread Maarten Faddegon

Dear list,

I am interested in learning more about static analysis of Haskell code. 
Specifically of the relation between arguments of recursive and 
non-recursive calls.


For example if we look at the ++ function from Prelude:

(++) [] ys = ys
(++) (x:xs) ys = x : xs ++ ys

amongst others, we could infer the relations:

ys_i+1 = ys_i
(x:xs)_i+1 = xs_i

Searching the web I found several tools (HLint, Haskabelle, 
Sourcegraph), but I am interested in the theory behind this. If you 
could recommend a paper or a book on this topic I would be grateful.


Thanks,
  Maarten Faddegon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] Hackage 2 now available for beta testing

2013-09-10 Thread Ross Paterson
On Mon, Sep 09, 2013 at 07:23:59PM +0100, Duncan Coutts wrote:
> Well-Typed and the Industrial Haskell Group (IHG) are very pleased to
> announce that Hackage 2 is now available for public beta testing. The
> plan is to do the final switchover in late September, to coincide
> with ICFP.
> 
> http://beta.hackage.haskell.org/

What's the story with haddock documentation?  I see that some packages
have docs imported from the old server, some have newly generated docs,
and some have none, but no indication whether a bot has tried to build
it or not.  There's mention of maintainer uploads of docs as a fallback,
but I couldn't find where one would do that.  (It would also need to
document the flags needed to get the links right.)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread sumit mahamuni
On Sep 10, 2013 3:25 PM, "AlanKim Zimmerman"  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 
wrote:
>>
>> > Niklas Hambüchen  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
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Daisuke Fujimura
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  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
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread Edward Z. Yang
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


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread AlanKim Zimmerman
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  wrote:

> > Niklas Hambüchen  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


Re: [Haskell-cafe] Proposal: New syntax for Haskell

2013-09-10 Thread John Wiegley
> Niklas Hambüchen  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] Please excuse brief service disruption

2013-09-10 Thread John Wiegley
The e-mail services at haskell.org were switched from exim4 to postfix
tonight, please excuse the service disruption.  For about one hour e-mails
were not being accepted to the mailing lists.  All should be resolved now.

-- 
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] This is a mail system test, please ignore

2013-09-10 Thread John Wiegley
Testing the new e-mail services at haskell.org.

-- 
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] Proposal: New syntax for Haskell

2013-09-10 Thread Niklas Hambüchen
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