[Haskell-cafe] Comments requested: succ Java
Tom Davies
tgdavies at gmail.com
Mon Sep 28 02:14:38 EDT 2009
On 28/09/2009, at 7:38 AM, Peter Verswyvelen wrote:
> That's not really true. Just use CAL from the Open Quark
> framework... It's almost Haskell 98, with some extras, and compiles
> to fast JVM code.
>
> http://openquark.org/Open_Quark/Welcome.html
>
> They even seem to do all kinds of advanced optimizations - like
> converting tail calls to loops - to get good Java performance.
>
> And they have a better record system, a graphical environment to
> learn it, etc.
>
> So I think CAL should be in the list, and since it's basically
> Haskell...
Liking CAL, I suggested it be included in a comment when the original
post was made, but I never made the time to write up a matching set of
examples myself.
Curt, your first blog post is almost compatible with CAL -- you don't
need to use a record type to get named accessors, CAL doesn't support
list comprehension syntax, and the isBlank implementation would be
different.
Obviously the Java interop capabilities of CAL are very different to
Haskell (and a bit verbose, though quite extensive).
Dispatch comes out more-or-less the same -- although CAL doesn't do
equational style function defs or comprehensive pattern matching like
Haskell. In CAL I'd write letter_grade something like (untested):
letter_grade :: Num a => a -> Maybe Char;
letter_grade val =
find (\pair -> fst pair $ val) [(> 90, 'A'), ... )] `bind` (\p ->
return $ snd p);
where bind is >>=
Tom
More information about the Haskell-Cafe
mailing list