Title: RE: Help using a state monad

your pattern match
of (s:sx) seems to be the cause of the delay

try


--Process the input
mProcess :: String -> State String
mProcess sx     = do b <- isOn
                     if ( head sx == 't' )
                        then toggle
                        else return ()
                     appOut (tuUpper b (head sx)) (mProcess (tail sx))

instead

-----Original Message-----
From: Tom Bevan [mailto:[EMAIL PROTECTED]]
Sent: 14 January 2002 05:58
To: Haskell Cafe List
Subject: Help using a state monad


Hi all,

I'm trying to get a feel for how monads might be used in a Haskell
program and develop an approach that would be useful for larger
projects.
I have tried to model in miniture a programme which takes input from
'standard in' and processes it against an internal state and then
returns the processed result to 'standard out'.
My problem is that, becuase of the way I have constructed the programme
'standard out' lags behind by one character.
I'm hoping that someone might have a better design they could share with
me.

Tom.



Reply via email to