Re: [Haskell-cafe] source code for haskell web server?

2006-08-29 Thread Jared Updike
This thread asks the same question and the answer may buried in there: http://www.haskell.org/pipermail/haskell/2006-March/thread.html#17665 I believe something of the code has been absorbed into something more recent... Jared. On 8/29/06, mvanier <[EMAIL PROTECTED]> wrote: Does anyone kno

[Haskell-cafe] 'Compiling' expression graph into Arrows

2006-08-29 Thread Daniel McAllansmith
Hello, I have a graph of function applications which I would like to 'compile' into an Arrow, specifically the SF Arrow from Yampa. I'd appreciate any advice on how I might go about this. The graphs, of which there will be many, will be constructed at runtime and will be executed for extended

[Haskell-cafe] source code for haskell web server?

2006-08-29 Thread mvanier
Does anyone know where I could find the source code for the Haskell web server described in the papers "Tackling the Awkward Squad" by SPJ and "Writing High-Performance Server Applications in Haskell, Case Study: A Haskell Web Server" by Simon Marlow? Thanks in advance, Mike

Re: [Haskell-cafe] [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Chris Kuklewicz
Udo Stenzel wrote: Chris Kuklewicz wrote: Again, Parsec requires you to put "try" where you need it I'm pretty sure it does, although this Udo Stenzel wrote: countBetween 0 n p = p <:> countBetween 0 (n-1) p <|> return [] is a place where it's not needed in general. No, see my exam

Re: [Haskell-cafe] [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Udo Stenzel
Chris Kuklewicz wrote: > Again, Parsec requires you to put "try" where you need it I'm pretty sure it does, although this > Udo Stenzel wrote: > >countBetween 0 n p = p <:> countBetween 0 (n-1) p <|> return [] is a place where it's not needed in general. You should know what you're doing, t

Re: [Haskell-cafe] state and exception or types again...

2006-08-29 Thread Andrea Rossato
Il Tue, Aug 29, 2006 at 10:02:38AM +0100, Brian Hulley ebbe a scrivere: > Yes I agree the StateT/monad transformer approach is probably best in the > long run, since by using the standard monad transformers, you will get code > that will scale better to handle more complexities later, and has the

Re: [Haskell-cafe] [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Chris Kuklewicz
Udo Stenzel wrote: Stephane Bortzmeyer wrote: Parsec provides "count n p" to run the parser p exactly n times. I'm looking for a combinator "countBetween m n p" which will run the parser between m and n times. It does not exist in Parsec. infixr 2 <:> (<:>) = ap . ap (return (:)) Again, Par

Re: [Haskell-cafe] [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Udo Stenzel
Stephane Bortzmeyer wrote: > Parsec provides "count n p" to run the parser p exactly n times. I'm > looking for a combinator "countBetween m n p" which will run the > parser between m and n times. It does not exist in Parsec. infixr 2 <:> (<:>) = ap . ap (return (:)) countBetween 0 0 _ = return [

[Haskell-cafe] Greedy Lazy Possessive

2006-08-29 Thread Chris Kuklewicz
How to use parsec to match optional things. Lets consider regex style matching of greedy a?b, lazy a??b, and possessive a?+b. And consider greedy a*b, lazy a*?b, and possessive a*+b. Then I think these examples (cribbed from my module) will work: -- Building blocks greedyOpt p contFail con

Re: [Haskell-cafe] [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Chris Kuklewicz
Robert Dockins wrote: On Aug 29, 2006, at 9:11 AM, Tomasz Zielonka wrote: On Tue, Aug 29, 2006 at 03:05:39PM +0200, Stephane Bortzmeyer wrote: Parsec provides "count n p" to run the parser p exactly n times. I'm looking for a combinator "countBetween m n p" which will run the parser between m

Re: [Haskell-cafe] [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Robert Dockins
On Aug 29, 2006, at 9:11 AM, Tomasz Zielonka wrote: On Tue, Aug 29, 2006 at 03:05:39PM +0200, Stephane Bortzmeyer wrote: Parsec provides "count n p" to run the parser p exactly n times. I'm looking for a combinator "countBetween m n p" which will run the parser between m and n times. It does n

Re: [Haskell-cafe] [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Chris Kuklewicz
I put the "try" in the wrong place. Silly me -- This also works and uses <|> directly instead of via option countBetween' m n p | m<=n = do xs <- count m p let loop 0 acc = return (acc []) loop i acc = (do x <- try p loop (pred i) (acc . (x:))) <|> (return

Re: [Haskell-cafe] [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Chris Kuklewicz
Stephane Bortzmeyer wrote: Parsec provides "count n p" to run the parser p exactly n times. I'm looking for a combinator "countBetween m n p" which will run the parser between m and n times. It does not exist in Parsec. Much to my surprise, it seems quite difficult to write it myself and, until

[Haskell-cafe] Re: [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Stephane Bortzmeyer
On Tue, Aug 29, 2006 at 03:11:09PM +0200, Tomasz Zielonka <[EMAIL PROTECTED]> wrote a message of 28 lines which said: > How about this? It works fine, many thanks. Here is the version rewritten according to my taste: import Text.ParserCombinators.Parsec import Data.Maybe (catMaybes) countBet

Re: [Haskell-cafe] [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Henning Thielemann
On Tue, 29 Aug 2006, Tomasz Zielonka wrote: > How about this? > > countBetween m n p = do > xs <- count m p > ys <- count (n - m) $ option Nothing $ do > y <- p > return (Just y) > return (xs ++ catMaybes ys) > > Assuming n >= m. > > > Does a

Re: [Haskell-cafe] [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Tomasz Zielonka
On Tue, Aug 29, 2006 at 03:05:39PM +0200, Stephane Bortzmeyer wrote: > Parsec provides "count n p" to run the parser p exactly n times. I'm > looking for a combinator "countBetween m n p" which will run the > parser between m and n times. It does not exist in Parsec. > Much to my surprise, it seem

[Haskell-cafe] [Parsec] A combinator to match between M and N times?

2006-08-29 Thread Stephane Bortzmeyer
Parsec provides "count n p" to run the parser p exactly n times. I'm looking for a combinator "countBetween m n p" which will run the parser between m and n times. It does not exist in Parsec. Much to my surprise, it seems quite difficult to write it myself and, until now, I failed (the best resul

Re: [Haskell-cafe] state and exception or types again...

2006-08-29 Thread Udo Stenzel
Andrea Rossato wrote: > Il Mon, Aug 28, 2006 at 09:28:02PM +0100, Brian Hulley ebbe a scrivere: > > data Eval_SOI a = SOIE {runSOIE :: State -> (a, State, Output, Bool)} > > well, I thought that this was not possible: > (>>=) :: m a -> (a -> m b) -> m b And you are right. In case of an exception

Re: [Haskell-cafe] state and exception or types again...

2006-08-29 Thread Brian Hulley
Andrea Rossato wrote: Il Tue, Aug 29, 2006 at 07:45:46AM +0100, Brian Hulley ebbe a scrivere: Andrea Rossato wrote: Il Mon, Aug 28, 2006 at 09:28:02PM +0100, Brian Hulley ebbe a scrivere: where the 4th element of the tuple is True iff we can continue or False iff an exception occurred. I'm s

Re: [Haskell-cafe] state and exception or types again...

2006-08-29 Thread Andrea Rossato
Il Tue, Aug 29, 2006 at 07:45:46AM +0100, Brian Hulley ebbe a scrivere: > Andrea Rossato wrote: > >Il Mon, Aug 28, 2006 at 09:28:02PM +0100, Brian Hulley ebbe a > >scrivere: > >>where the 4th element of the tuple is True iff we can continue or > >>False iff an exception occurred. > > > >I'm startin