I've uploaded my CMonad package to Hackage.  It allows you to write
Haskell code in a C style.
Unfortunately, GHC lacks certain optimizations to make efficient code
when using CMonad,
so instead of C speed you get low speed.

Example: Computing some Fibonacci numbers:
fib = do {
    a <- arrayU[40];
    i <- auto 0;
    a[0] =: 1;
    a[1] =: 1;
    for (i =: 2, (i :: EIO Int) < 40, i += 1) $ do {
        a[i] =: a[i-1] + a[i-2];
    };
    retrn (a[39]);
  }


Example: Copying stdin to stdout:
cat = do {
    c <- auto 0;

    while ((c =: getchar()) >= 0) $ do {
        putchar(c);
    };
    return ();
  }

    -- Lennart
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to