[Haskell-cafe] Parsing workflow

2010-10-31 Thread Nils Schweinsberg
Hi! I'm having a really hard time to write a correct parser for a small language I've developed. I have been trying to write a parser using parsec, but always get a lot of error messages like unexpected \n, expected ..., new-line or... when trying to run the parser. Then I read about the

[Haskell-cafe] ANN: network-2.2.3, merger with network-bytestring

2010-10-31 Thread Johan Tibell
Hi all, I like to announce a new version of the network package, network-2.2.3. You can install the latest version by running: cabal update cabal install network This version marks the end of the network-bytestring package, which has now been merged into the network package. This means

Re: [Haskell-cafe] Edit Hackage

2010-10-31 Thread Tillmann Rendel
Ketil Malde wrote: Most web-based email archives seem to suck - where can we point to a nice URL to get an overview of a -cafe thread? http://thread.gmane.org/gmane.comp.lang.haskell.cafe/82667 Tillmann ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Ozgur Akgun
I don't know if you've already used it, but Parsec includes some kind of a lexer through the Languagehttp://hackage.haskell.org/packages/archive/parsec/3.1.0/doc/html/Text-Parsec-Language.htmland Tokenhttp://hackage.haskell.org/packages/archive/parsec/3.1.0/doc/html/Text-Parsec-Token.htmlmodules.

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Vo Minh Thu
2010/10/31 Nils Schweinsberg m...@n-sch.de: Hi! I'm having a really hard time to write a correct parser for a small language I've developed. I have been trying to write a parser using parsec, but always get a lot of error messages like unexpected \n, expected ..., new-line or... when trying

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Stephen Tetley
If you use the Language and Token modules, Parsec gives you something close to a lexer / parser separation _but_ you can drop down to character level parsers if you want to - this is very handy. There are some caveats though - for instance, the number parsers from the Token module follow Haskell's

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Stephen Tetley
On 31 October 2010 15:55, Stephen Tetley stephen.tet...@gmail.com wrote: ecessary. You can also write separate parsers this is covered in the (pdf) Parsec manual available from Daan Leijen's old home page, however I usually avoid this as it seems rather cumbersome. D'oh. I meant separate

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Nils Schweinsberg
Am 31.10.2010 16:50, schrieb Ozgur Akgun: I don't know if you've already used it, but Parsec includes some kind of a lexer through the Language http://hackage.haskell.org/packages/archive/parsec/3.1.0/doc/html/Text-Parsec-Language.html and Token

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Nils Schweinsberg
Am 31.10.2010 16:53, schrieb Vo Minh Thu: I can't really tell from your description, but maybe this is because of the way Parsec works when it deals with alternatives. When you combine several parsers with e.g. '|' or 'choice', an alternative that can consume some input but fails will make the

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Ozgur Akgun
On 31 October 2010 16:15, Nils Schweinsberg m...@n-sch.de wrote: This is exactly what gives me headaches. It's hard to tell where you need try/lookAhead and where you don't need them. And I don't really feel comfortable wrapping everything into try blocks... I always thought this was an

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Stephen Tetley
On 31 October 2010 16:23, Ozgur Akgun ozgurak...@gmail.com wrote: Am I missing something? Left factoring! :-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] commutativity

2010-10-31 Thread Brent Yorgey
On Sat, Oct 30, 2010 at 11:55:48AM +0100, Patrick Browne wrote: Hi, Below are two questions on commutative operations in Haskell. infixl 5 `com` com :: Int - Int - Int x `com` y = (x + y) commutative com a b = (a `com` b) == (b`com`a) Note that the first parameter to commutative shadows

Re: [Haskell-cafe] Haskell meeting in Berlin

2010-10-31 Thread Sönke Hahn
On Friday, October 29, 2010 02:07:55 am Daniel van den Eijkel wrote: Hi, thanks to all participants for the funny meeting! I had a lot of fun and I'm looking forward to see you again. I had fun, too. There were twice as many people than I anticipated (4 instead of 2) and we outnumbered the

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Malcolm Wallace
On 31 Oct 2010, at 16:15, Nils Schweinsberg wrote: Am 31.10.2010 16:53, schrieb Vo Minh Thu: So you have to either factorize you parsers or use the 'try'. This is exactly what gives me headaches. It's hard to tell where you need try/lookAhead and where you don't need them. And I don't

Re: [Haskell-cafe] ANN: network-2.2.3, merger with network-bytestring

2010-10-31 Thread Christopher Done
On 31 October 2010 16:14, Johan Tibell johan.tib...@gmail.com wrote: This version marks the end of the network-bytestring package, which has now been merged into the network package. This means that efficient and correct networking using ByteStrings is available as part of the standard network

Re: [Haskell-cafe] Re: Current thinking on CompositionAsDot issue in haskell prime?

2010-10-31 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/29/10 20:33 , C. McCann wrote: I suggest U+2621. Did you mean U+2620 SKULL AND CROSSBONES there? - -- brandon s. allbery [linux,solaris,freebsd,perl] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats]

Re: [Haskell-cafe] Re: Current thinking on CompositionAsDot issue in haskell prime?

2010-10-31 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/29/10 22:30 , wren ng thornton wrote: On 10/29/10 8:33 PM, C. McCann wrote: I suggest U+2621. I'm not sure I'd've ever recognized a funny 'z' as caution sign... :) You'd have to be a TeX / Metafont user to get that one. (The LaTeX book

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Malcolm Wallace
- Is this a valid approach? It is possible that your Parsec lexer will need to see the entire input before it delivers any tokens at all to the Happy parser. This might cause a space problem, depending on how large your inputs are likely to be. - What is your workflow on parsing

Re: [Haskell-cafe] ANN: network-2.2.3, merger with network-bytestring

2010-10-31 Thread Christopher Done
(Er, that should be (speed/4), not (speed*4). x4 the block size should be x4 the delay.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Stephen Tetley
On 31 October 2010 16:53, Nils Schweinsberg m...@n-sch.de wrote: Am 31.10.2010 17:27, schrieb Stephen Tetley: Left factoring! :-) Stupid question: Whats that? :) Actually a good question... Its a standard grammar transformation - if you have two alternative productions that share a common

[Haskell-cafe] Generic traversals for GADTs

2010-10-31 Thread Ozgur Akgun
Café, SYB-style libraries (and especially Uniplate) make it very easy to run generic traversals (queries/transformations) on ADTs. data Expr = ... x :: Expr f :: Expr - Expr transform :: (Expr - Expr) - Expr - Expr transform f x :: Expr -- applies f to x (and its children) in a bottom-up

Re: [Haskell-cafe] type class design

2010-10-31 Thread Ivan Lazar Miljenovic
On 30 October 2010 22:44, Uwe Schmidt u...@fh-wedel.de wrote: Another possible argument: large type classes can look daunting for both implementors and users, even if only one or two methods need to be defined for a minimal instantiation (I'm tring to work out what to do here myself, as I have

Re: [Haskell-cafe] How can we make Haskell-Cafe scale? (was: Re: Edit Hackage)

2010-10-31 Thread Ivan Lazar Miljenovic
On 31 October 2010 04:08, Sterling Clover gersh...@gmail.com wrote: There's been some grumbling about users migrating from -cafe to Reddit and Stack Overflow in particular. First, as Don has pointed out, the fact is that people are moving away, and that's just the trend. But why are people

Re: [Haskell-cafe] Parsing workflow

2010-10-31 Thread Erik de Castro Lopo
Nils Schweinsberg wrote: This is exactly what gives me headaches. It's hard to tell where you need try/lookAhead and where you don't need them. And I don't really feel comfortable wrapping everything into try blocks... In my experience, try blocks should only be used at the very inner most

Re: [Haskell-cafe] vector-space and standard API for vectors

2010-10-31 Thread Alexey Khudyakov
On Sat, Oct 30, 2010 at 2:07 PM, Henning Thielemann schlepp...@henning-thielemann.de wrote: wren ng thornton schrieb: On 10/22/10 8:46 AM, Alexey Khudyakov wrote: Hello everyone! It's well known that Num Co type classes are not adequate for vectors (I don't mean arrays). I have an idea how

Re: [Haskell-cafe] who's in charge?

2010-10-31 Thread Richard O'Keefe
On 29/10/2010, at 7:33 PM, Gregory Crosswhite wrote: Also, this is a complete aside but what the heck. :-) Has anyone else been driven crazy by the way that Java code and libraries are documented? It seems like whenever I try to figure out how to use a piece of Java code, the

Re: [Haskell-cafe] who's in charge?

2010-10-31 Thread Gaius Hammond
On 29 Oct 2010, at 07:33, Gregory Crosswhite wrote: Also, this is a complete aside but what the heck. :-) Has anyone else been driven crazy by the way that Java code and libraries are documented? It seems like whenever I try to figure out how to use a piece of Java code, the

Re: [Haskell-cafe] who's in charge?

2010-10-31 Thread Daniel Santa Cruz
Talking about documentation in the 3rd year software engineering paper I teach, I give JavaDoc as an example of what not to do.  I give R as an example of something that works quite well.  It's *examples* that make the difference. One thing I will say for the JavaMail specification is that

Re: [Haskell-cafe] vector-space and standard API for vectors

2010-10-31 Thread Alexey Khudyakov
On Wed, Oct 27, 2010 at 2:53 AM, wren ng thornton w...@freegeek.org wrote: On 10/26/10 8:51 AM, Alexey Khudyakov wrote: On 24.10.2010 03:38, wren ng thornton wrote: I don't care much about the name of the class, I'd just like support for monoids, semirings,... when they lack a group,

Re: [Haskell-cafe] How can we make Haskell-Cafe scale? (was: Re: Edit Hackage)

2010-10-31 Thread Christopher Done
On 31 October 2010 04:08, Sterling Clover gersh...@gmail.com wrote: How can we make Haskell-Cafe scale? There's been some grumbling about users migrating from -cafe to Reddit and Stack Overflow in particular. First, as Don has pointed out, the fact is that people are moving away, and that's

[Haskell-cafe] Reference for technique wanted

2010-10-31 Thread Richard O'Keefe
There's a long-known technique in functional languages where [x1,...,xn] = \tail - x1:...xn:tail xs ++ ys= f . g xs = f [] A correspondent mentioned to me that he couldn't find a reference to the idea (which I gather he had independently

Re: [Haskell-cafe] Reference for technique wanted

2010-10-31 Thread Gregory Collins
Richard O'Keefe o...@cs.otago.ac.nz writes: There's a long-known technique in functional languages where [x1,...,xn] = \tail - x1:...xn:tail xs ++ ys= f . g xs = f [] A correspondent mentioned to me that he couldn't find a reference to the idea

Re: [Haskell-cafe] Reference for technique wanted

2010-10-31 Thread Derek Elkins
Well, you can get A Novel Representation of Lists and Its Application to the Function 'Reverse' by John Hughes online published in 1986 which is referenced by Wadler's 1987 The Concatenate Vanishes and references Richard Bird's 1984 paper Transformational programming and the paragraph problem

Re: [Haskell-cafe] Reference for technique wanted

2010-10-31 Thread Richard O'Keefe
On 1/11/2010, at 12:10 PM, Derek Elkins wrote: Well, you can get A Novel Representation of Lists and Its Application to the Function 'Reverse' by John Hughes online published in 1986 which is referenced by Wadler's 1987 The Concatenate Vanishes and references Richard Bird's 1984 paper

Re: [Haskell-cafe] Reference for technique wanted

2010-10-31 Thread Richard O'Keefe
On 1/11/2010, at 12:05 PM, Gregory Collins wrote: They're called difference lists: As a matter of fact the original context was precisely difference lists in logic programming. http://hackage.haskell.org/packages/archive/dlist/latest/doc/html/Data-DList.html Thank you.

Re: [Haskell-cafe] Reference for technique wanted

2010-10-31 Thread Derek Elkins
On Sun, Oct 31, 2010 at 7:27 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On 1/11/2010, at 12:05 PM, Gregory Collins wrote: They're called difference lists: As a matter of fact the original context was precisely difference lists in logic programming.

[Haskell-cafe] Data records. Default values initialisation. Reading datatype from string.

2010-10-31 Thread Siim Haugas
Hello, I need some help with data records. Normally I can use a `read' function to convert string to some data type e.g. `(read somestring) :: Type'. However, sometimes I'd like to read a record with some uninitialised fields. I have also set up a default values for my data record, for example:

[Haskell-cafe] Re: Data records. Default values initialisation. Reading datatype from string.

2010-10-31 Thread Siim Haugas
Oh sorry, I had some mistakes in my previous mail.. `defrec = {a=0,b=1, ..., z=0}' should be `defrec = SomeDataConstructor{a=0,b=1, ..., z=0}' . Siim On Mon, Nov 1, 2010 at 2:31 AM, Siim Haugas hau...@gmail.com wrote: Hello, I need some help with data records. Normally I can use a `read'

[Haskell-cafe] Am I using type families well?

2010-10-31 Thread Yves Parès
Hello, I'm trying to make a simple monad (built on operational's ProgramT) for resource loading. I have classes featuring type families : {-# LANGUAGE TypeFamilies, FlexibleContexts, GADTs #-} -- | A ResourceId is something that identifies a resource. -- It should be unique for one resource,

Re: [Haskell-cafe] vector-space and standard API for vectors

2010-10-31 Thread wren ng thornton
On 10/31/10 6:36 PM, Alexey Khudyakov wrote: On Wed, Oct 27, 2010 at 2:53 AM, wren ng thornton wrote: Is there any good reason for forcing them together? Why not, use the hierarchy I proposed earlier? [...] Main reason is that it complicate creation of instances for types for which

Re: [Haskell-cafe] Reference for technique wanted

2010-10-31 Thread wren ng thornton
On 10/31/10 7:10 PM, Derek Elkins wrote: Well, you can get A Novel Representation of Lists and Its Application to the Function 'Reverse' by John Hughes online published in 1986 which is referenced by Wadler's 1987 The Concatenate Vanishes and references Richard Bird's 1984 paper Transformational

Re: [Haskell-cafe] Reference for technique wanted

2010-10-31 Thread Derek Elkins
On Sun, Oct 31, 2010 at 9:02 PM, wren ng thornton w...@freegeek.org wrote: On 10/31/10 7:10 PM, Derek Elkins wrote: Well, you can get A Novel Representation of Lists and Its Application to the Function 'Reverse' by John Hughes online published in 1986 which is referenced by Wadler's 1987 The

Re: [Haskell-cafe] Reference for technique wanted

2010-10-31 Thread Richard O'Keefe
On 1/11/2010, at 2:02 PM, wren ng thornton wrote: Barring the worse than useless appellation, the technique has been around in logic programming (and classic Lisp, IIRC) for a few decades longer. I've always heard it referred to as part of the folklore of logic/functional programming

[Haskell-cafe] Equivalent of withForeignPtr for System.Mem.Weak?

2010-10-31 Thread Matthew Steele
I have an object to which I have added one or more finalizers via addFinalizer from System.Mem.Weak. I would like to have a function that allows me to make use of the object within a block of IO code, and guarantee that the finalizer(s) will not be called during the code block -- sort of

[Haskell-cafe] Forall and type synonyms in GHC 7.0

2010-10-31 Thread Mario Blažević
Before uploading a new version of my project on Hackage, I decided to future-proof it against GHC 7.0. I ran into several compile errors caused by the changes in let generalization, but these were easy to fix by adding extra type annotations. But then I ran into another problem that I can't

Re: [Haskell-cafe] Equivalent of withForeignPtr for System.Mem.Weak?

2010-10-31 Thread Antoine Latter
On Sun, Oct 31, 2010 at 10:14 PM, Matthew Steele mdste...@alum.mit.edu wrote: I have an object to which I have added one or more finalizers via addFinalizer from System.Mem.Weak.  I would like to have a function that allows me to make use of the object within a block of IO code, and guarantee

[Haskell-cafe] Tsuru Capital Tokyo is looking for Southern Hemisphere summer (Dec 10 - Feb 11) interns

2010-10-31 Thread employment
We are looking for an intern that has experience programming in a functional language, and is familiar with Haskell and web development. Some experience with Linux/Unix system administration is preferred. Familiarity with Git would be useful. The position is in Tokyo in a small English speaking

Re: [Haskell-cafe] Reference for technique wanted

2010-10-31 Thread wren ng thornton
On 10/31/10 10:26 PM, Richard O'Keefe wrote: On 1/11/2010, at 2:02 PM, wren ng thornton wrote: (Though I find it curious that you think the logic version is so different...) The logic programming version uses a SINGLE data structure for lists and differences, so that + converting from