Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-05 Thread Brian Hulley
Ooops - more bugs in my explanation... Brian Hulley wrote: -- from State.hs newtype State s a = S (s -> (a,s)) I used the source given in ghc-6.4.2\libraries\monads\Monad\State.hs but the version of state monad that comes with the hierarchical libs is in ghc-6.4.2\libraries\mtl\Control\

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-05 Thread Brian Hulley
Kaveh Shahbazian wrote: Very Thankyou I am starting to feel it. I think about it as a 'context' that wraps some computations, which are handled by compiler environment (please make me correct if I am wrong). Now I think I need to find out how this 'monads' fit in solving problems. And for that I

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-05 Thread Kaveh Shahbazian
Very Thankyou I am starting to feel it. I think about it as a 'context' that wraps some computations, which are handled by compiler environment (please make me correct if I am wrong). Now I think I need to find out how this 'monads' fit in solving problems. And for that I must go through bigger pr

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-05 Thread Brian Hulley
Brian Hulley wrote: q >>= (\x -> p) For example with the State monad, (q) must be some expression which evaluates to something of the form S fq where fq is a function with type s -> (a,s), and similarly, (\x -> p) must have type a ->S ( s -> (a,s)). If we choose names for these values which de

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-05 Thread Brian Hulley
Kaveh Shahbazian wrote: Thanks All This is about my tries to understand monads and handling state - as you perfectly know - is one of them. I have understood a little about monads but that knowledge does not satidfy me. Again Thankyou There are many tutorials available from the wiki at http://w

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-04 Thread Kaveh Shahbazian
Thanks All This is about my tries to understand monads and handling state - as you perfectly know - is one of them. I have understood a little about monads but that knowledge does not satidfy me. Again Thankyou On 8/2/06, Duncan Coutts <[EMAIL PROTECTED]> wrote: On Wed, 2006-08-02 at 13:26 +0330

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-04 Thread Kaveh Shahbazian
Thanks All This is about my tries to understand monads and handling state - as you perfectly know - is one of them. I have understood a little about monads but that knowledge does not satidfy me. Again Thankyou On 8/2/06, Donn Cave <[EMAIL PROTECTED]> wrote: On Wed, 2 Aug 2006, Donald Bruce Stew

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-02 Thread Duncan Coutts
On Wed, 2006-08-02 at 13:26 +0330, Kaveh Shahbazian wrote: > Haskell is the most powerfull and interesting "thing" I'v ever > encountered in IT world. But with an imparative background and lack of > understanding (because of any thing include that maybe I am not that > smart) has brought me problem

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-02 Thread Donn Cave
On Wed, 2 Aug 2006, Donald Bruce Stewart wrote: ... > Of course, if you're learning Haskell, you should probably try to > /avoid/ mutable variables for a while. Along the same line, I note that proposed solutions seem to use features relatively recently added to the language, is that true? StateT

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-02 Thread Bulat Ziganshin
Hello Kaveh, Wednesday, August 2, 2006, 1:56:10 PM, you wrote: > Question : Could anyone show me a sample of using a monad as a > statefull variable? monad is not an "stateful variable", it's the way to organize computations, rule to join them (as the Ring of Supreme Power ;) ). i recommend you

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-02 Thread Daniel Fischer
Am Mittwoch, 2. August 2006 11:56 schrieb Kaveh Shahbazian: > Haskell is the most powerfull and interesting "thing" I'v ever > encountered in IT world. But with an imparative background and lack of > understanding (because of any thing include that maybe I am not that > smart) has brought me proble

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-02 Thread Donald Bruce Stewart
kaveh.shahbazian: > Monad Imparative Usage Example > > Thanks for your replies. I have not haskell on this computer and I > will try this solutions tonight. > I must notice that IO computations is not the point here. My target is > to have this code for mutable variable 'var'. Still not entirely

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-02 Thread Chris Kuklewicz
Kaveh Shahbazian wrote: Haskell is the most powerfull and interesting "thing" I'v ever encountered in IT world. But with an imparative background and lack of understanding (because of any thing include that maybe I am not that smart) has brought me problems. I know this is an old issue. But pleas

[Haskell-cafe] Monad Imparative Usage Example

2006-08-02 Thread Kaveh Shahbazian
Monad Imparative Usage Example Thanks for your replies. I have not haskell on this computer and I will try this solutions tonight. I must notice that IO computations is not the point here. My target is to have this code for mutable variable 'var'.

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-02 Thread Sebastian Sylvan
On 8/2/06, Kaveh Shahbazian <[EMAIL PROTECTED]> wrote: Haskell is the most powerfull and interesting "thing" I'v ever encountered in IT world. But with an imparative background and lack of understanding (because of any thing include that maybe I am not that smart) has brought me problems. I know

Re: [Haskell-cafe] Monad Imparative Usage Example

2006-08-02 Thread Donald Bruce Stewart
kaveh.shahbazian: > Haskell is the most powerfull and interesting "thing" I'v ever > encountered in IT world. But with an imparative background and lack of > understanding (because of any thing include that maybe I am not that > smart) has brought me problems. I know this is an old issue. But > ple

[Haskell-cafe] Monad Imparative Usage Example

2006-08-02 Thread Kaveh Shahbazian
Haskell is the most powerfull and interesting "thing" I'v ever encountered in IT world. But with an imparative background and lack of understanding (because of any thing include that maybe I am not that smart) has brought me problems. I know this is an old issue. But please help it. Question : Cou