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'.
#############################################################################
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 : Could anyone show me a sample of using a monad as a
statefull variable?
For example see this code in C# :
//
public class Test
{
int var;
static void Fun1() { var = 0; Console.Write(var); }
static void Fun2() { var = var + 4; Console.Write(var); }
static void Main() { Fun1(); Fun2(); var = 10; Console.Write("var
= " + var.ToString()); }
}
//
I want to see this code in haskell.
Thankyou
#############################################################################