Re: Fw: Modification of State Transformer

2002-08-12 Thread Shawn P. Garbett
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Monday 12 August 2002 02:08 pm, Scott J. wrote: > - Original Message - > From: "Scott J." <[EMAIL PROTECTED]> > > What I meant was discussion about the state transformer ST s a itself. > > And how it work

Fw: Modification of State Transformer

2002-08-12 Thread Scott J.
- Original Message - From: "Scott J." <[EMAIL PROTECTED]> To: "Shawn P. Garbett" <[EMAIL PROTECTED]> Sent: Monday, August 12, 2002 9:04 PM Subject: Re: Modification of State Transformer > I 'm sorry, > > What I meant was discussion about

Re: Modification of State Transformer

2002-08-12 Thread Shawn P. Garbett
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sunday 11 August 2002 07:26 pm, Scott J. wrote: > Hi, > > I invite you then to explain what happens with every step. > > The use of "forall" is misleading and fast to be misunderstood: I mention > here the inner forall's. > > Thx > > Scott > > This

Re: Modification of State Transformer

2002-08-11 Thread Scott J.
ast" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, August 09, 2002 3:16 AM Subject: Re: Modification of State Transformer > > Btw: This has already been done, in GHC: see the ST module in GHC's > > library > > <http://www.haskell.or

Re: Modification of State Transformer

2002-08-08 Thread Shawn P. Garbett
> Btw: This has already been done, in GHC: see the ST module in GHC's > library > . This list is great. The implementation in the ST module solves the problem and I understand how it works. Shawn -- You're in a maze of

Re: Modification of State Transformer

2002-08-08 Thread Jon Cast
"Shawn P. Garbett" <[EMAIL PROTECTED]> wrote: > I'm trying to modify Richard Bird's state transformer. The example > in his book (_Introduction_to_Functional_Programming_using_Haskell_) > has State defined as a explicit type. > I.e. Here's the relevant

Re: Modification of State Transformer

2002-08-08 Thread Ken Shan
On 2002-08-08T14:11:54-0500, Shawn P. Garbett wrote: > newtype St a s = MkSt (s -> (a, s)) > instance Monad St where This line should say instance Monad (St a) where because it is (St a) that is a Monad, not St by itself. -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ke

Modification of State Transformer

2002-08-08 Thread Tom Pledger
Tom Pledger writes: | Shawn P. Garbett writes: : | | Inferred kind: (* -> * -> *) -> * : | In turn, s corresponds to the third * in the inferred kind in the | error message. Oops! Sorry, the third * is the result of applying St to two types. The second of those two types, s, corre

Modification of State Transformer

2002-08-08 Thread Tom Pledger
Shawn P. Garbett writes: : | What I want is something like this, so that the state transformer has a | generic state type: | | newtype St a s = MkSt (s -> (a, s)) | | apply :: St a s -> s -> (a, s) | apply (MkSt f) s = f s | | instance Monad St where |

Re: State Transformer

2002-01-11 Thread Jorge Adriano
[Obs: most answers I got end up in my pvt e-mail and not in the mailing list... I replyed in pvt to those. I do feel it some cases that is probably accidental as I do it all the time :), and the discussion ends leaving the mailing list. So i'd just like to let you know that I for one am in favo

Re: State Transformer

2002-01-07 Thread Ketil Z Malde
Jorge Adriano <[EMAIL PROTECTED]> writes: > Anyway, I was coding some simple GA, and as you probably know I need to use > random values. The most elegant way I could think of was to generate some [...] > Monads! (right?) Well, I suppose so. Generally speaking. But, you might want to consid

Re: State Transformer

2002-01-07 Thread Remi Turk
Hi, I'm still learning Haskell too, but I recently wrote a small module which implements an infinite list of random Integers (it gets its random seed from /dev/random :) Using it means nothing more than: import DevRandom main= randomIntegers 100 >>= mapM_ print . take 10 Happy Hacking

State Transformer

2002-01-07 Thread Jorge Adriano
ead what I needed to be able to use the IO Monad. Seems to me like having a State Transformer monad its the best way to do it. Now I've read a great deal of Richard Birds Book chap 10 (Monads), as well as the "Monads for the Haskell Working Programmer"[1] by Theodore Norvell. I was

Re: newbie: running a state transformer in context of a state rea der

2001-02-20 Thread Marcin 'Qrczak' Kowalczyk
Tue, 20 Feb 2001 17:52:33 -0800, Konst Sushenko <[EMAIL PROTECTED]> pisze: > lookahead p = do { s <- fetch > ; lift (evalState p s) > } > > is typed as > > lookahead:: State MyState Maybe a -> State MyState Maybe (a,MyState) > > but i need > > lookahead:: Sta

RE: newbie: running a state transformer in context of a state reader

2001-02-20 Thread Konst Sushenko
yk [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 20, 2001 10:17 AM To: [EMAIL PROTECTED] Subject: Re: newbie: running a state transformer in context of a state reader Mon, 19 Feb 2001 18:07:17 -0800, Konst Sushenko <[EMAIL PROTECTED]> pisze: > now i am curious if it is possible to r

Re: newbie: running a state transformer in context of a state reader

2001-02-20 Thread Marcin 'Qrczak' Kowalczyk
Mon, 19 Feb 2001 18:07:17 -0800, Konst Sushenko <[EMAIL PROTECTED]> pisze: > now i am curious if it is possible to run the given parser (state > transformer) in a context of a state reader somehow, so as the state > gets preserved automatically. something that would let me omit

newbie: running a state transformer in context of a state reader

2001-02-19 Thread Konst Sushenko
hello,   i have a parser which is a state transformer monad, and i need to implement a lookahead function, which applies a given parser but does not change the parser state. so i wrote a function which reads the state, applies the parser and restores the state (the State monad is derived