[Haskell-cafe] ANN: cmonad 0.1.1
Miguel Mitrofanov
miguelimo38 at yandex.ru
Mon Mar 30 14:16:20 EDT 2009
As it goes, it'd probably be Forth.
On 30 Mar 2009, at 21:29, Edward Kmett wrote:
> 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
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list