[Haskell-cafe] ANN: cmonad 0.1.1

Edward Kmett ekmett at gmail.com
Mon Mar 30 13:29:10 EDT 2009


First, BASIC, now C. What's next, Haskell?  =)

-Edward Kmett

On Sun, Mar 29, 2009 at 5:16 AM, Lennart Augustsson
<lennart at augustsson.net>wrote:

> 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-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090330/d88ac717/attachment.htm


More information about the Haskell-Cafe mailing list