Re: [Haskell-cafe] Basic binary IO

2008-01-20 Thread Jamie Love
Ah, thanks Don, Brandon, I looked at this but neglected to read through and understand the example enough. Thanks for the tips, they're a great help. Don Stewart wrote: jamie.love: bmpHeader = runPut $ do put 'B' put 'M' put (0 :: Int32) put (0 ::

[Haskell-cafe] bytea decoding

2008-01-20 Thread Bryan Green
Does anyone know of a library that will handle bytea encodings from postgres? The bytea field that I need to access contains a jpg file. I want to retrieve it from the database and write it out for an image display program. bytea: Bytea octets are also escaped in the output. In general, each

[Haskell-cafe] bug in all about monads tutorial

2008-01-20 Thread Peter Hercek
Hi, About 3 weeks ago I reported this bug to Jeff Newbern. But I got no response - maybe I got filtered out as spam :) Since it was not fixed I'm trying once more here. Maybe there is somebody here who has access to the web site http://www.haskell.org/all_about_monads and cares enough to

[Haskell-cafe] Need help with Parsec

2008-01-20 Thread Nicu Ionita
Hi, I'm playing since a few hours with Parsec and trying to write a small html (fragment) parser, but I'm stuck in a point which I really can't understand. The problem seem to be either in parseProperCont or in closing (see code below). It looks like closing does not work (but it is a very

[Haskell-cafe] Type issues for a foldable trie in Haskell

2008-01-20 Thread Brad Larsen
Hello there, I have written a trie in Haskell generalized to Eq a = [a] rather than simply String. I want to make this type an instance of Foldable, but I've run into a type dilemma. My datatypes look like this: data TrieElem a = Elem a | Start | End deriving (Read, Show, Eq, Ord)

Re: [Haskell-cafe] Need help with Parsec

2008-01-20 Thread Sterling Clover
Here's a handy simple function I've found very useful. You'll obviously also need to import Debug.Trace: pTrace s = pt | return () where pt = try $ do x - try $ many1 anyChar trace (s++: ++x) $ try $ char 'z' fail x It

Re: [Haskell-cafe] Hangman game

2008-01-20 Thread Paul Johnson
Ronald Guida wrote: Hi, I'm interested in learning how to program games. Since I have to start somewhere, I decided to write a simple Hangman game. I'm wondering if anyone can look at my code and give me some feedback. Nicely written. The design reads very much like a straight translation

Re: [Haskell-cafe] bytea decoding

2008-01-20 Thread Adam Langley
2008/1/20 Bryan Green [EMAIL PROTECTED]: Does anyone know of a library that will handle bytea encodings from postgres? The bytea field that I need to access contains a jpg file. I want to retrieve it from the database and write it out for an image display program. I'd love to see Don give

[Haskell-cafe] Data.Binary questions

2008-01-20 Thread Lauri Pesonen
Hi, I'm relatively new to Haskell so please bear with me. I'm trying to parse Java class files with Data.Binary and I'm having a few problems: (The class file format is described here: http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html and the bytecode instructions are

Re: [Haskell-cafe] Data.Binary questions

2008-01-20 Thread Derek Elkins
On Sun, 2008-01-20 at 18:18 +, Lauri Pesonen wrote: Hi, I'm relatively new to Haskell so please bear with me. I'm trying to parse Java class files with Data.Binary and I'm having a few problems: (The class file format is described here:

[Haskell-cafe] CPP and INLINE pragmas

2008-01-20 Thread Adam Langley
Since CPP mode removes newlines in the out macro expansion. It appears to be impossible to have a macro expand to a function with an INLINE pragma since it appears to need to be in its own line. For example: #define GETHOSTWORD(name, m, type) \ {-# INLINE name #-} \ name :: m type ; \ name =

Re: [Haskell-cafe] Hangman game

2008-01-20 Thread Yitzchak Gale
Hi Paul, You gave some suggestions of other styles of Haskell programming that Ronald could try for his program. These styles are definitely worth knowing, so if Ronald is not familiar with them, he may want to try them out. However, in most cases, I think what Ronald already did is nicer than

Re: [Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world

2008-01-20 Thread Adam Langley
On Jan 15, 2008 7:33 PM, Adam Langley [EMAIL PROTECTED] wrote: Ok, no TH ;) I've just uploaded binary-strict 0.2.2 to Hackage which factors most of the common code out via CPP. Hopefully I didn't break anything. AGL -- Adam Langley [EMAIL PROTECTED]

Re: [Haskell-cafe] Throwback of inferred types

2008-01-20 Thread Jon Harrop
On Sunday 20 January 2008 21:02:04 [EMAIL PROTECTED] wrote: On 2008.01.19 19:11:13 +0100, Peter Verswyvelen [EMAIL PROTECTED] scribbled 1.4K characters: I would find it most useful to get type inference information on the fly, even when not all of the code compiles correctly yet. Does that

[Haskell-cafe] Parsec benchmarks

2008-01-20 Thread Jon Harrop
I'd like to compare the performance of Parsec to other parsers but the only reference to a benchmark I have found is a dead link from one of the papers about Parsec: http://research.microsoft.com/users/daan/download/parsec/parsec.pdf Are there any surviving Parsec benchmarks? -- Dr Jon D

Re: [Haskell-cafe] Throwback of inferred types

2008-01-20 Thread gwern0
On 2008.01.19 19:11:13 +0100, Peter Verswyvelen [EMAIL PROTECTED] scribbled 1.4K characters: The problem is that this only works when the complete source file compiles correctly no? Yes. As I said, it's a very hackish solution - think of it as proof-of-concept. I would find it most useful to

Re: [Haskell-cafe] Parsec benchmarks

2008-01-20 Thread Johan Tibell
On Jan 20, 2008 9:54 PM, Jon Harrop [EMAIL PROTECTED] wrote: I'd like to compare the performance of Parsec to other parsers but the only reference to a benchmark I have found is a dead link from one of the papers about Parsec:

[Haskell-cafe] Re: Throwback of inferred types

2008-01-20 Thread Achim Schneider
[EMAIL PROTECTED] wrote: Does that make sense? If the code doesn't compile, then how could any type-inference be trustable? Why, of course it is trustable, because it's going to fail, and that means that the code has type a - _|_. -- (c) this sig last receiving data processing entity.

Re: [Haskell-cafe] Throwback of inferred types

2008-01-20 Thread Jon Harrop
On Sunday 20 January 2008 22:06:04 Duncan Coutts wrote: On Sun, 2008-01-20 at 21:02 +, Jon Harrop wrote: On Sunday 20 January 2008 21:02:04 [EMAIL PROTECTED] wrote: On 2008.01.19 19:11:13 +0100, Peter Verswyvelen [EMAIL PROTECTED] scribbled 1.4K characters: I would find it

Re: [Haskell-cafe] Throwback of inferred types

2008-01-20 Thread Duncan Coutts
On Sun, 2008-01-20 at 21:02 +, Jon Harrop wrote: On Sunday 20 January 2008 21:02:04 [EMAIL PROTECTED] wrote: On 2008.01.19 19:11:13 +0100, Peter Verswyvelen [EMAIL PROTECTED] scribbled 1.4K characters: I would find it most useful to get type inference information on the fly,

Re: [Haskell-cafe] CPP and INLINE pragmas

2008-01-20 Thread Isaac Dupree
Adam Langley wrote: Since CPP mode removes newlines in the out macro expansion. It appears to be impossible to have a macro expand to a function with an INLINE pragma since it appears to need to be in its own line. that's because INLINE uses layout like everything else, so you can use

Re: [Haskell-cafe] Throwback of inferred types

2008-01-20 Thread Jonathan Cast
On 20 Jan 2008, at 1:02 PM, [EMAIL PROTECTED] wrote: On 2008.01.19 19:11:13 +0100, Peter Verswyvelen [EMAIL PROTECTED] scribbled 1.4K characters: The problem is that this only works when the complete source file compiles correctly no? Yes. As I said, it's a very hackish solution - think

Re: [Haskell-cafe] CPP and INLINE pragmas

2008-01-20 Thread Malcolm Wallace
Adam Langley [EMAIL PROTECTED] writes: Has anyone a workaround for this, or a way to get the preprocessor to output a newline? You can use cpphs with the --layout flag, to preserve newlines in macro expansion. http://haskell.org/cpphs For instance, with ghc you need to add the following

Re: [Haskell-cafe] CPP and INLINE pragmas

2008-01-20 Thread Adam Langley
Thanks Isaac and Malcolm. That neatly solves all my problems! AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] First go at reactive programming

2008-01-20 Thread Steve Lihn
This fixed the second example. Thanks. I think handleConnection should be handleConnection :: RequestHandler - Handle - IO () handleConnection r h = handleToRequest h = responseSend h . runRequestHandler r Levi ___ Haskell-Cafe mailing

Re: [Haskell-cafe] bug in all about monads tutorial

2008-01-20 Thread Benjamin L. Russell
Since nobody with write access to that page seems to be responding here, you may wish to try reporting this bug to the main Haskell mailing list ([EMAIL PROTECTED]). Posting to that list may get the attention of some Haskell users who may not regularly read this mailing list. Benjamin L. Russell

[Haskell-cafe] Invitation for MathematiKa '08 : projectEuler format

2008-01-20 Thread anshuman
Hello Math Enthusiast, IIIT-Hyderabad, India cordially invites you to be a part of Mathematika '08, an online competition that emphasizes on fusion of mathematics and computing. Where: http://felicity.iiit.ac.in/~math When: 4th February, 2008 This