(Alice ML + monads - value cells) > Haskell?

Would a Alice-like language without value cells but with monadic state have any advantages over Haskell?

It seems that Alice's combination of strict, lazy, and lenient evaluation, coupled with transparent futures would make it more powerful than plain Haskell.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

In theory

In theory, such a language would probably subsume Haskell. In practice, though, it's all about the predominant style and what is used in the libraries. Since most functions can be written in either strict or lazy form, a library either has to choose one or provide both(*). In Haskell the default is laziness, which gives you quite a bit of additional flexibility, trading it for predictability. Alice ML takes the opposite choice.

Also, some optimisations may be easier with a more homogeneous evaluation semantics (we haven't investigated optimisations much for Alice ML). In general, what compiler and runtime optimise for might be quite relevant for making a certain style practical.

(*) In principle, Alice ML's future introspection (Future.status and friends) would allow you to write a single version that adapts to its operand:

  fun map f xs if (isLazy xs) = lazy map' f xs
    | map f xs  = map' f xs
  and map' f [] = []
    | map' f (x::xs) = f x :: map f xs

(Tim Sheard discusses something similar in this paper. He uses a specialised "mimic" combinator which easily is definable in Alice ML as follows: fun mimic f x = if isLazy x then lazy f x else f x)