Re: [Haskell-cafe] Delaling with State StateT and IO in the same function

2007-02-27 Thread Andrew Wagner
I don't know if this will help or not, but there's a basic StateT example on the haskell wiki that you could look at, to see how to deal with State in general. The code is at http://www.haskell.org/haskellwiki/Simple_StateT_use and is thanks to Don Stewart. Maybe I'll just paste the code with a fe

Re: [Haskell-cafe] Delaling with State StateT and IO in the same function

2007-02-26 Thread Alfonso Acosta
On 2/27/07, Kirsten Chevalier <[EMAIL PROTECTED]> wrote: So what if you changed your netlist function so that the type sig would be: netlist :: DT.Traversable f => (State s (S HDPrimSignal) -> State s v ) -> -- new (State s (Type,v) -> S v -> State s ()) -> -- define

Re: [Haskell-cafe] Delaling with State StateT and IO in the same function

2007-02-26 Thread Kirsten Chevalier
On 2/26/07, Alfonso Acosta <[EMAIL PROTECTED]> wrote: On 2/27/07, Kirsten Chevalier <[EMAIL PROTECTED]> wrote: > I may be missing something, but why are you using both State and > StateT? Maybe I don't understand your code, but it seems like you > could be using StateT everywhere you're currentl

Re: [Haskell-cafe] Delaling with State StateT and IO in the same function

2007-02-26 Thread Alfonso Acosta
On 2/27/07, Kirsten Chevalier <[EMAIL PROTECTED]> wrote: I may be missing something, but why are you using both State and StateT? Maybe I don't understand your code, but it seems like you could be using StateT everywhere you're currently using State. Well, as far as I know using "StateT s IO a

Re: [Haskell-cafe] Delaling with State StateT and IO in the same function

2007-02-26 Thread Kirsten Chevalier
On 2/26/07, Alfonso Acosta <[EMAIL PROTECTED]> wrote: The returned type is a StateT and the only way in which I succesfully managed to internally work with both State and StateT is converting from the former to the later one using this function (not elegant at all) I may be missing something,

[Haskell-cafe] Delaling with State StateT and IO in the same function

2007-02-26 Thread Alfonso Acosta
Hello, I know StateT is exactly aimed at dealing with a state and an inner monad but I have an example in which I have to mix State and IO and in which I didn't get to an elegant solution using StateT. I have a higher order function which gets some State processing functions as input, makes som