Hi folks,
I have a question to the State Monad or Monads in general - I'am not sure.
Lets assume I have functions to transform strings. I can use the State
Monad as follows:
strTrans :: String - String
strTrans s = s ++ s
f :: State String ()
f = do put hallo
modify strTrans
Am Mittwoch, 3. Mrz 2004 14:44 schrieb Georg Martius:
[...]
Now I have also functions to map from (a, String) - (a,String). I could
write:
modifyT :: ((a, String) - (a, String)) - a - State String a
modifyT trans a = do str - get
let (a', str') = trans (a, str)
hi,
Georg Martius wrote:
Now I have also functions to map from (a, String) - (a,String).
I could write:
modifyT :: ((a, String) - (a, String)) - a - State String a
modifyT trans a = do str - get
let (a', str') = trans (a, str)
put str'
return a'
f ::
Am Mittwoch, 3. Mrz 2004 18:15 schrieb Georg Martius:
Thanks for your answer. I got it now.
It works with lift instead of liftM.
Yes, of course.
Georg
Wolfgang
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
Georg Martius wrote:
[...]
I could write:
modifyT :: ((a, String) - (a, String)) - a - State String a
modifyT trans a = do str - get
let (a', str') = trans (a, str)
put str'
return a'
f :: State String ()
f = do put hallo
modify strTrans
i -
i want to start off by apologizing. im lonely. i dont know anyone.
anyone at all who is liek me. im different. everyone else is content to
just watch tv all the time and then on weekends go and get drunk. im
not.
i am not threatening anything here when i say waht i am about to say.
i know that
There are a lot of hoaxes on the internet, but just in case you're for
real, here's an idea...
Step 1: Take 20 minutes to get some fresh air.
Step 2: When you get back to your computer, take 5 minutes to read
Desiderata (http://shell.world-net.co.nz/~unikorn/desiderata.htm),
especially the