Re: [Haskell-cafe] State separation/combination pattern question

2007-01-03 Thread Ian Lynagh
Hi Reto, On Thu, Dec 21, 2006 at 10:11:22PM -0800, Reto Kramer wrote: > > I've tried to thread the two states (StateA and StateB) using a chain > of StateT ... StateT ..., but couldn't really make that work. That is how I would write it; I have attached code for your example. > It > seems

Re: [Haskell-cafe] State separation/combination pattern question

2006-12-23 Thread Nicolas Frisby
Another option is to use the HList library (though this can involve a learning curve). Essentially your monad is a state monad and its state is a big tuple constrained to contain at least whichever types you ask of it. Consider foo :: (HOccurs StateA st, ...other HList properties..., MonadState

Re: [Haskell-cafe] State separation/combination pattern question

2006-12-23 Thread J. Garrett Morris
On 12/22/06, Reto Kramer <[EMAIL PROTECTED]> wrote: What I'm really looking for is not so much the chaining of StateT compositions, but rather the isolation of StateA from StateB while they both flow from the search loop into the respective library calls (foo, bar) transparently to the applicatio

Re: [Haskell-cafe] State separation/combination pattern question

2006-12-22 Thread Udo Stenzel
Reto Kramer wrote: > What I'm really looking for is not so much the chaining of StateT > compositions, but rather the isolation of StateA from StateB while > they both flow from the search loop into the respective library calls > (foo, bar) transparently to the application programmer. How ab

[Haskell-cafe] State separation/combination pattern question

2006-12-21 Thread Reto Kramer
I'm looking for a pattern to use for "state separation" in my application. I need to write two "stateful libraries". One is a partitioned in- memory store, the other a disk based store with an in-memory cache fronting it. Both store modules need the IO and State monad. My aim is to write t