Re: [Haskell-cafe] want to start a page of Haskell examples to go with Skiena's book The Algorithm Design Manual and also tie in Bird's equational reasoning for functional programming; ...

2011-05-01 Thread Henk-Jan van Tuyl

On Sun, 01 May 2011 03:23:03 +0200, cas...@istar.ca wrote:

I want to start a page of Haskell examples to go with Skiena's book The  
Algorithm Design Manual and also tie in Bird's equational reasoning for  
functional programming; where is a good place for such examples.


I think HaskellWiki is the best place for this, see for example:
  http://www.haskell.org/haskellwiki/99_questions/1_to_10
The page:
  http://www.haskell.org/haskellwiki/HaskellWiki:Contributing
describes how to write wiki pages.

Regards,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--

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


Re: [Haskell-cafe] Binary and Serialize classes

2011-05-01 Thread Johan Tibell
On Fri, Apr 29, 2011 at 10:25 AM, Evan Laforge qdun...@gmail.com wrote:
 Indeed, and I was starting to do that... well, I would make my own
 project specific Serialize class, since the type dispatch is useful.
 But copy pasting a UTF8 encoder, or the variable length Integer
 encoder, or whatever seemed kinda unpleasant.  Surely we could expose
 that stuff in a library, whose explicit goal was that they *would*
 remain compatible ways to serialize various basic types, and then just
 reuse those functions?  E.g. that is already done for words with the
 putWordN{be,le} functions, and is available separately for UTF8.

I intend to add support for different UTF encodings to
Data.Binary.Builder for this very reason. I also intend to add two
functions to Data.Binary.Builder.Internal that lets you implement
variable length encoding as efficiently as possible.

I'm a bit skeptical of adding builders for different variable length
encodings to the library, simply because there are so many
possibilities. I think creating a binary-vle (for variable length
encoding) package would be worthwhile. I have an implementation of the
VLE used in protocol buffers.

Johan

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


Re: [Haskell-cafe] Wai and http-enumerator not as lazy as I'd like

2011-05-01 Thread Erik de Castro Lopo
Michael Snoyman wrote:

 On Fri, Apr 29, 2011 at 2:49 AM, Erik de Castro Lopo

  Has anyone done anything like this and care to shed some light?
 
 It's a little bit complicated, but hopefully this should help out:

Thats Michael. I've tried it and it works. Now to study it
and figure out how :-)
 
Cheers,
Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/

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


Re: [Haskell-cafe] [web-devel] Odd Ambiguous type variable `a0' in the constraint: error (with Yesod)

2011-05-01 Thread Michael Snoyman
Without seeing the actual code that's causing the breakage, there's
not much I can tell you. (If you'd like me to take a look off-list,
feel free to send me a private email.) My best recommendation is to
try putting a type signature on getRootR.

As a general issue: polymorphic Hamlet is a very convenient feature,
but I think it leads to too much complexity in the type system. I've
added some code for non-polymorphic Hamlet to the Github repo and will
be releasing it as its own module (Text.Hamlet.NonPoly) in the next
release. Assuming all goes well, it will be replacing the current
Hamlet. That essentially means that you'll need to replace your code
with something like:

getRootR = defaultLayout $ do
setTitle Polymorphic Hamlet
addHtml [$html|pI was added with addHtml|]
addHamlet [$hamlet|pI was added with addHamlet|]
addWidget [$whamlet|pI was added with addWidget|]

And just to make everyone curious: I've also added i18n support to
non-poly Hamlet. I've got a long train ride on Tuesday, and I'm
planning on documenting it then.

Michael

On Sun, May 1, 2011 at 6:50 AM, Mathew de Detrich dete...@gmail.com wrote:
 Ok so I have a problem that was described here
 (http://permalink.gmane.org/gmane.comp.lang.haskell.web/1431) in regards to
 returning a  Ambiguous type variable `a0' in the constraint error when
 compiling. Originally I thought it was due to the way I was coding that part
 of the code (or to be more accurate the code specifically for creating the
 so called widgets with addHTML/addWidget,addHamlet). So I copied the example
 code given here exactly (http://www.yesodweb.com/book/example-widgets).
 Compiling this worked fine, so at the next point I changed the definition
 of getRootR to
 getRootR = defaultLayout $ wrapper $ do
     setTitle Polymorphic Hamlet
     addHtml [$hamlet|pI was added with addHtml|]
     addHamlet [$hamlet|pI was added with addHamlet|]
     addWidget [$hamlet|pI was added with addWidget|]
 and then to
 getRootR = defaultLayout $ do
     setTitle Polymorphic Hamlet
     addHtml [$hamlet|pI was added with addHtml|]
     addHamlet [$hamlet|pI was added with addHamlet|]
     addWidget [$hamlet|pI was added with addWidget|]
 Both times compiled fine, so the issue wasn't what I originally thought that
 it was (as described
 in http://permalink.gmane.org/gmane.comp.lang.haskell.web/1431). The problem
 is, that when I use the above example code in my WebServer, I get this
 Ambigious type error when compiling (even though I have set up the route the
 exact same way). Unfortunatley I can't provide the code for my webserver,
 since its commercially owned (and it would be pointless because its just
 renamed variables, but otherwise its the same), so does anyone have any
 ideas what could possibly cause such an error (such as a missing/extra
 import or some package or something), or possibly some missing instances?
 Also sorry for creating another mailing list, but its a different issue then
 what I thought it was originally (and I also wanted to put it on
 haskell-cafe since its a more general issue)
 ___
 web-devel mailing list
 web-de...@haskell.org
 http://www.haskell.org/mailman/listinfo/web-devel



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


Re: [Haskell-cafe] Posix IO Unicode lookup exception

2011-05-01 Thread Mark Lentczner
My guess is that you are closing the file descriptor out from under the
handle. It is probably the handle that has the open iconv connection, and
since it is never closed, you run out of memory.

Why not just interact with the handle? Use hPutStr instead of fdWrite, and
hClose instead of closeFd.

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


Re: [Haskell-cafe] ANN: timeplot-0.3.0 - the analyst's swiss army knife for visualizing ad-hoc log files

2011-05-01 Thread Eugene Kirpichov
Hello,

Sorry for the broken link: the correct link to the presentation is:

http://jkff.info/presentations/two-visualization-tools.pdf

2011/4/30 Eugene Kirpichov ekirpic...@gmail.com:
  Hello fellow haskellers,

 I announce the release of timeplot-0.3.0, the analyst's swiss army
 knife for visualizing ad-hoc log files.

 Links:
  * http://jkff.info/presentation/two-visualization-tools - a
 presentation saying what the tools are all about and giving plenty of
 graphical examples on cluster computing use cases. At the end of the
 presentation there's also a couple of slides about installation. It is
 a little bit outdated, it corresponds to versions just before 0.3.0.
  * http://hackage.haskell.org/package/timeplot
  * http://github.com/jkff/timeplot
  * The sibling tool, splot - for visualizing the activity of many
 concurrent processes - http://hackage.haskell.org/package/splot and
 http://github.com/jkff/splot . It has also gotten a couple of new
 features since my last announcement.

 The major new feature of tplot is the introduction of subplots, the
 'within' plots.
 It allows one to plot data from several sub-tracks on one track of the graph:
  - several line- or dot-plots
  - several plots of sums or cumulative sums, perhaps stacked (to see
 how the sub-tracks contribute to the total sum - e.g. if your log
 speaks about different types of overhead and you wish to see how they
 contribute to the total)
  - stacked activity count plot - a generalization of the previous
 activity count plot, which allows you to, given a log saying like
 Machine started servicing job JOB1 ... Machine finished servicing job
 JOB1 etc, plot how many machines are servicing each job at any
 moment, in a stacked fashion - so, how loads by different jobs
 contribute to the whole cluster's load. The activity frequency plot
 plots the same on a relative scale.

 The syntax is, for example: within[.] dots or within[.] acount or
 even within[.] duration cumsum stacked etc.

 Note that these are of course just example use cases and the tool is
 universal, it is not in any sense specialized to clusters, jobs,
 overheads or actually even to logs.
 I'd like to encourage you to give it a try and look around for a use case :)

 If you do give the tool a try, please tell me if something goes wrong,
 be it an installation problem or a bug (the version is fresh released,
 so this is quite possible).

 --
 Eugene Kirpichov
 Principal Engineer, Mirantis Inc. http://www.mirantis.com/
 Editor, http://fprog.ru/




-- 
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/

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


[Haskell-cafe] [ANN] mysql-simple - your go-to package for talking to MySQL

2011-05-01 Thread Bryan O'Sullivan
Hi, folks -

Over the past few days, I've released two MySQL-related packages on Hackage
that I think should be pretty useful.

The first is mysql-simple: http://hackage.haskell.org/package/mysql-simple

This is a mid-level binding to the MySQL client API. I aimed it squarely at
being both fast and easy to use, and I'm very pleased with the results so
far.

   - Performance: compared to HDBC-mysql, mysql-simple yields a 60%
   performance improvement on my real-world application.
   - Ease of use: compared again to HDBC, my real-world application's
   DB-specific code shrunk by 50% while achieving the above performance
   increase.
   - Type safety: it's intentionally hard to construct SQL queries by string
   concatenation, but of course I provide some nice safe APIs for formatting
   queries and converting results. That safety does not come at the expense of
   performance or expressive bloat, as the above results indicate.

Because I know that some people favour interacting with their databases via
a model such as iteratees, the mysql-simple library is built on top of a
very lightweight library.

That lower-level library is named mysql:
http://hackage.haskell.org/package/mysql

This is a low-level binding to the MySQL client API. It is aimed at high
performance and simplicity, but more specifically for consumption by authors
of higher-level database libraries. It is bare enough of features that it
doesn't even perform conversion between Haskell and SQL types, but at the
same time it uses bytestrings sensibly, cheaply avoids some nasty signal
interruption problems with the MySQL client library, and abstracts some of
the tiresome details of memory management. It gives a higher-level library
complete control over result conversion, how to fetch results, and all that,
so you can focus purely on building iteratees and not the lower-level gunk.

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