Re: [Haskell-cafe] Printing call site for partial functions

2012-04-30 Thread Ketil Malde
Michael Snoyman mich...@snoyman.com writes:

 I had a bug in a site of mine[1] for a few weeks, where it would just print:

 Prelude.head: empty list

 It took a long time to track down the problem

+1: I've been arguing this for something like ten years :-)

One half-baked quasi-solution is to use:

#define head (\xs - case xs of { (x:_) - x ; _ - error(head: empty list 
at++__FILE__++show __LINE__)})

Downsides are that it depends on CPP, and, CPP being a C preprocessor,
it doesn't blend well with lines with single apostrophes on them (e.g.:
head x') 

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants

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


Re: [Haskell-cafe] Printing call site for partial functions

2012-04-30 Thread Henk-Jan van Tuyl

On Mon, 30 Apr 2012 10:31:01 +0200, Ketil Malde ke...@malde.org wrote:


One half-baked quasi-solution is to use:

#define head (\xs - case xs of { (x:_) - x ; _ - error(head: empty  
list at++__FILE__++show __LINE__)})


Downsides are that it depends on CPP, and, CPP being a C preprocessor,
it doesn't blend well with lines with single apostrophes on them (e.g.:
head x')

-k


There is a Haskell solution: cpphs[0], you can invoke this preprocessor by  
specifying the flags

  -cpp  -pgmPcpphs  -optP--cpp
for GHC.

Regards,
Henk-Jan van Tuyl


[0] http://hackage.haskell.org/package/cpphs


--
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] Hong Kong Haskell hackathon - call for participation

2012-04-30 Thread Matthias Fischmann

Hi everybody,

if you are in or around Hong Kong in May and want to play, please check out 
this:

  http://www.haskell.org/haskellwiki/HkHac2012

Otherwise, any wider circulation or suggestion of channels / university people 
/ companies that I should invite directly is welcome.

cheers,
Matthias

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


Re: [Haskell-cafe] [Haskell] ANN: Portackage - a hackage portal

2012-04-30 Thread Simon Michael

Great work! Thanks.

Does it include only packages without executables ? Eg I see hledger-lib but not the hledger or gist packages. It would 
be nice to have all of hackage there.


Best - Simon


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


[Haskell-cafe] ANN: hflags-0.1, a command line flags library similar to Google's gflags

2012-04-30 Thread Gergely Risko
Hello,

I would like to announce the release of HFlags, a command line flags
library that makes it very easy to define and use flags.

The API is similar to Google's gflags, here is a very simple example
program:

-=-
#!/usr/bin/env runhaskell

{-# LANGUAGE TemplateHaskell #-}

import HFlags

defineFlag name Indiana Jones Who to greet.
defineFlag r:repeat (3 + 4 :: Int)
  Number of times to repeat the message.

main = do remainingArgs - $(initHFlags Simple program v0.1)
  sequence_ $ replicate flags_repeat greet
  where
greet = putStrLn $ Hello 
   ++ flags_name
   ++ , very nice to meet you!
-=-

As you can see, we have TemplateHaskell functions to help with the
definition (and initialization) of the flags, and the values themselves
are pure, no need for being in the IO monad to use the value of the
flags.

Also, the initHFlags function automagically gathers all the flags
defined anywhere in the whole program, so if a library defines flags,
you don't have to mention it in the main, but the user will still be
able to set those flags too.

More details behind this design and more example can be found in the
following post: http://blog.risko.hu/2012/04/ann-hflags-0.html

Comments and criticism is welcome.

Code: http://github.com/errge/hflags
Examples: https://github.com/errge/hflags/tree/master/examples
Hackage: http://hackage.haskell.org/package/hflags

Best regards,
Gergely Risko


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


Re: [Haskell-cafe] [Haskell] ANN: Portackage - a hackage portal

2012-04-30 Thread Andrew Seniuk
First let me mention, there is now a complete modules tree with API
links (in a very preliminary state), at
http://fremissant.net/portackage/modules.php and the package view is
still http://fremissant.net/portackage

On Mon, Apr 30, 2012 at 11:35 AM, Simon Michael si...@joyful.com wrote:
 Great work! Thanks.

 Does it include only packages without executables ? Eg I see
 hledger-lib but not the hledger or gist packages. It would be nice
 to have all of hackage there.

Simon, thank you. And, yes, as a temporary measure, I elided the
packages that expose no modules, to try to tame the slowness a bit. I
could provide them on a similar, separate page, until figure out some
optimisations.

Derek, if you're reading, sorry if I seemed defensive there before. :)

Okay, this bagel is screaming Eat Me!!...

Kind Reg'ds,
Andrew

On Mon, Apr 30, 2012 at 11:35 AM, Simon Michael si...@joyful.com wrote:
 Great work! Thanks.

 Does it include only packages without executables ? Eg I see hledger-lib but
 not the hledger or gist packages. It would be nice to have all of hackage
 there.

 Best - Simon


 ___
 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] [Haskell] ANN: Portackage - a hackage portal

2012-04-30 Thread Andrew Seniuk
...and the binary packages (those exposing no modules) are now up at
http://fremissant.net/portackage/binary.php

Not nice to have them in a separate table, but for now that's the case. :(

So the three links in summary:

module tree: http://fremissant.net/portackage/modules.php
library packages: http://fremissant.net/portackage/binary.php
other packages: http://fremissant.net/portackage/portackage.php

On Mon, Apr 30, 2012 at 1:42 PM, Andrew Seniuk ras...@gmail.com wrote:
 First let me mention, there is now a complete modules tree with API
 links (in a very preliminary state), at
 http://fremissant.net/portackage/modules.php and the package view is
 still http://fremissant.net/portackage

 On Mon, Apr 30, 2012 at 11:35 AM, Simon Michael si...@joyful.com wrote:
 Great work! Thanks.

 Does it include only packages without executables ? Eg I see
 hledger-lib but not the hledger or gist packages. It would be nice
 to have all of hackage there.

 Simon, thank you. And, yes, as a temporary measure, I elided the
 packages that expose no modules, to try to tame the slowness a bit. I
 could provide them on a similar, separate page, until figure out some
 optimisations.

 Derek, if you're reading, sorry if I seemed defensive there before. :)

 Okay, this bagel is screaming Eat Me!!...

 Kind Reg'ds,
 Andrew

 On Mon, Apr 30, 2012 at 11:35 AM, Simon Michael si...@joyful.com wrote:
 Great work! Thanks.

 Does it include only packages without executables ? Eg I see hledger-lib but
 not the hledger or gist packages. It would be nice to have all of hackage
 there.

 Best - Simon


 ___
 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] [Haskell] ANN: Portackage - a hackage portal

2012-04-30 Thread Andrew Seniuk
Oops, the three links in summary are:

module tree: http://fremissant.net/portackage/modules.php
library packages: http://fremissant.net/portackage/portackage.php
other packages: http://fremissant.net/portackage/binary.php

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


[Haskell-cafe] Darcs home page updated

2012-04-30 Thread Simon Michael
With 2.8 released, I felt Darcs deserves better presentation. After surveying other VCS sites I worked on an update to 
our home page layout and content over the last few days, with review and input from #darcs, and it went live last night. 
It's far from perfect but I hope it's a good step forward. Thanks for the input, and have at it:


http://darcs.net

-Simon

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


Re: [Haskell-cafe] Darcs home page updated

2012-04-30 Thread Paul R
On Mon, 30 Apr 2012 12:27:57 -0700, Simon Michael si...@joyful.com said:

Simon With 2.8 released, I felt Darcs deserves better presentation. After
Simon surveying other VCS sites I worked on an update to our home page
Simon layout and content over the last few days, with review and input from
Simon #darcs, and it went live last night. It's far from perfect but I hope
Simon it's a good step forward. Thanks for the input, and have at it:

Simon http://darcs.net


Hi, that looks good, thanks. Here are some ideas :

 - The purple color of titles is not very attractive, changing it to
   something more saturated would make it look fresher.

 - the purple color rounded box is not very attractive either :)

 - there is a video right on the first page, good ! Unfortunatly, it is
   not showing darcs but its cousin. Also, the title is why do we
   continue to develop ... [camp], which isn't the most positive
   approach one can expect on a start page

 - the compact tutorial is great, I love it. It deserves more poish. For
   inspiration, one can have a look at this website for example :
 
 http://gembundler.com/

 - underlined links looks a bit 90's. You can add a simple css rule to
   choose an other color and remove the underline (though it is good
   practice to set it on mouseover)

cheers,

-- 
  Paul

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


Re: [Haskell-cafe] Darcs home page updated

2012-04-30 Thread Michael Orlitzky
On 04/30/12 15:27, Simon Michael wrote:
 With 2.8 released, I felt Darcs deserves better presentation. After
 surveying other VCS sites I worked on an update to our home page layout
 and content over the last few days, with review and input from #darcs,
 and it went live last night. It's far from perfect but I hope it's a
 good step forward. Thanks for the input, and have at it:
 
 http://darcs.net
 


Maybe use some other repo for the hello world example?

  $ darcs get http://darcs.net darcs

is too many darc.

Using darcs to check out darcs and commit a file named darcs.cabal just
conflates too many things unnecessarily.

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


Re: [Haskell-cafe] Darcs home page updated

2012-04-30 Thread Simon Michael

Thanks for the feedback Paul (and Michael), all such is very useful.

Maybe I'll try Django-green... :)


  - there is a video right on the first page, good ! Unfortunatly, it is
not showing darcs but its cousin. Also, the title is why do we
continue to develop ... [camp], which isn't the most positive
approach one can expect on a start page


It does discuss both camp and darcs. I meant to say the following: I was happy to be able to use Ian Lynagh's video, 
which I have always felt strikes a very good tone - technical, concise, grounded and energising. I like listening to it. 
Thanks Ian!


Also, there isn't a lot out there to work with. Please let me know if I'm 
missing something else good.


  - the compact tutorial is great, I love it. It deserves more poish. For
inspiration, one can have a look at this website for example :


Good to hear, I have scheduled more polish.


  - underlined links looks a bit 90's. You can add a simple css rule to
choose an other color and remove the underline (though it is good
practice to set it on mouseover)


Oh I thought underline had come back in. Ok done.

A few more notes trimmed from the original mail:

- I've tried to emphasise the relative simplicity Darcs offers. I think this is a true strength and our biggest value 
proposition. (Aside: I think Haskell is another true strength, but a less obvious one, currently not mentioned.)


- You may notice my very swift description of patch dependencies. Though we are used to thinking of patch deps as 
painful, I think the text is a fair and accurate high-level description for newcomers. The video gives a little more 
insight.


- Like some other sites (I liked Mercurial's best), we have quick start examples right on the front page. This grew a 
bit long, but how handy to be able to jump to darcs.net and instantly see how to get stuff done.. and its basically *all 
you need to know* to use Darcs, correct me if I'm wrong.


- The colours are a bit anaemic. Needs more red and dark tones. The dark pres I 
tried gave less contrast..

- I use and occasionally hack on Alex Suraci's darcsden repo-hosting app. You can see my dev repo and changes at 
http://joyful.com/darcsden/simon/darcs-sm , and you might even be able to register, fork, show previews and send pull 
requests there - testers welcome. Perhaps one day this could be on darcs.net, or a reliable funded darcsden.com, or 
something.


Best - Simon


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


[Haskell-cafe] twitter election on favorite programming language

2012-04-30 Thread 山本和彦
Hello,

A twitter election on favorite programming language was held in Japan
and it appeared that Heskell is No. 10 loved language in Japan. :-)

http://twisen.com/election/index/654

Regards,

--Kazu

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


Re: [Haskell-cafe] ANN: HandsomeSoup-0.3: CSS selectors for HXT

2012-04-30 Thread aditya bhargava
Because I had the methods written for network and http already (this is
just old code of mine I'm open-sourcing), and I didn't want to bother with
reading the source for hxt-curl or hxt-http (since neither has
documentation and I'm not convinced that they can do exactly what I want).

If you feel strongly about hxt-curl or hxt-http I would love to hear why!
I'm not opposed to using those instead.


Adit




On Fri, Apr 27, 2012 at 1:30 AM, Yves Parès yves.pa...@gmail.com wrote:

 Why do you make your own overlay to download files via HTTP?
 HXT has backends (hxt-http or hxt-curl) to do that.

 Le 27 avril 2012 04:16, aditya bhargava bluemangrou...@gmail.com a
 écrit :

 *Homepage:* http://egonschiele.github.com/HandsomeSoup
 *On Hackage:* http://hackage.haskell.org/package/HandsomeSoup

 *Blurb:*

 HandsomeSoup is the library I wish I had when I started parsing HTML in
 Haskell.
 It is built on top of HXT and adds a few functions that make is easier to
 work with HTML.
 Most importantly, it adds CSS selectors to HXT. The goal of HandsomeSoup
 is to be a complete CSS2 parser for HXT (it is very close to this right
 now).



 --
 adit.io

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





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