Re: Parsing library

2004-01-02 Thread Derek Elkins
On Thu, 1 Jan 2004 23:19:26 + (GMT) James Ealing <[EMAIL PROTECTED]> wrote: > I'm trying to make use of the combinatorial parsing > library to process strings. However, I can't figure > out the correct syntax for the (|||) (^^^) (>>>) (<^^) > and (^^>) functions. Can anyone see how to do it?

Re: Perspectives on learning and using Haskell

2004-01-02 Thread Derek Elkins
On Thu, 1 Jan 2004 21:07:00 -0500 [EMAIL PROTECTED] wrote: > > (6) I have found that Haskell seems to a particularly effective > > platform for pursuing some ideas of extreme programming, > > There you go. :-) > > There is only one problem I've found with test-driven development in > Haskell.

Re: foldr

2004-01-02 Thread Tomasz Zielonka
On Fri, Jan 02, 2004 at 02:54:11AM +, James Ealing wrote: > Hi all, > > If I have a function: > > it f [a0, a1, a2, ...] = [a0, f a1, f (f a2), ...] > > Is there any way of expressing > > it f > > as an instance of foldr? You can write it as it1 f l = foldr (\x xs -> x : map f xs) [] l b

Limiting resources on a per-function basis?

2004-01-02 Thread Jeff Newbern
Hi all, I would really like to be able to set resource limits on a per-function basis. I am envisioning something like: limit :: l -> (a -> b) -> (a -> Maybe b) limit lim fn = ... which would convert a function so that it returns Nothing if a limit (on stack, heap, time, etc.) is exceeded durin

Re: Perspectives on learning and using Haskell

2004-01-02 Thread Jon Fairbairn
On 2004-01-01 at 21:07EST [EMAIL PROTECTED] wrote: > There is only one problem I've found with test-driven development in > Haskell. In C++, it's possible to break the "module" abstraction > (yes, I know, C++ doesn't have modules; it has classes, which are really > instantiable modules) by using

Re: Limiting resources on a per-function basis?

2004-01-02 Thread Andreas Bauer
On Fri, Jan 02, 2004 at 10:07:05PM +1000, Jeff Newbern wrote: > I would really like to be able to set resource limits on a per-function > basis. I am envisioning something like: > > limit :: l -> (a -> b) -> (a -> Maybe b) > limit lim fn = ... > > which would convert a function so that it retur

Re: Stack usage with a state monad

2004-01-02 Thread Graham Klyne
At 15:37 31/12/03 +, Joe Thornber wrote: On Wed, Dec 31, 2003 at 02:38:06PM +, Graham Klyne wrote: > getOrCachePositionValue pos = > do { mcache <- gets (findPos pos) -- Query cache for position >; case mcache of >Just cached -> return (cachedVal cached) -- Ret

Re: Limiting resources on a per-function basis?

2004-01-02 Thread Alastair Reid
> I would really like to be able to set resource limits on a per-function > basis. I am envisioning something like: > > limit :: l -> (a -> b) -> (a -> Maybe b) > limit lim fn = ... > > which would convert a function so that it returns Nothing if a limit > (on stack, heap, time, etc.) is exceeded

Re: Stack usage with a state monad

2004-01-02 Thread Joe Thornber
On Fri, Jan 02, 2004 at 02:46:04PM +, Graham Klyne wrote: > If your calculation really needs to update the cache state as it goes > along, then I agree that it needs to be run in the state monad. But even > then, I'd be inclined to look for sub-calculations that can be evaluated as > ordina

Re: Limiting resources on a per-function basis?

2004-01-02 Thread Jeff Newbern
Alastair, Thanks for your input. I am mainly interested in this functionality to enhance my unit tests. I want to be able to run test cases with limits on time, heap, stack, etc. and fail the test if it exceeds the limits. I think for this application it is acceptable for limit to introduce a st

Re: Limiting resources on a per-function basis?

2004-01-02 Thread Glynn Clements
Andreas Bauer wrote: > > I would really like to be able to set resource limits on a per-function > > basis. I am envisioning something like: > > > > limit :: l -> (a -> b) -> (a -> Maybe b) > > limit lim fn = ... > > > > which would convert a function so that it returns Nothing if a limit > >