[Haskell-cafe] Haskell/JS -- better through typeclasses?

John A. De Goes john at n-brain.net
Sun Apr 26 12:34:20 EDT 2009

On Apr 26, 2009, at 10:18 AM, Jason Dusek wrote:
>  This was what I was originally writing in about, yeah.
>  However, thinking it over I realize there are some serious
>  problems. We really do want to work with a restricted subset
>  of Haskell that is more amenable to translation -- one with
>  finite arrays and most every type translatable to JSON.

For purposes of cross-platform development, it's important the subset  
be minimally restricted (at least in my case).

>  I fear that requires us to know, statically, whether
>  potentially infinite structures like lists are finite or
>  infinite. I'm not sure about this but I suspect that's a major
>  stumbling block.

I think it's easy to determine if something is definitely finite  
(certainly any list passed into an exported Haskell function must be  
finite, since JS doesn't have infinite lists).

Determining if something is definitely infinite is not as easy, but it  
might be sufficient to use lazy evaluation whenever there is a  
possibility that a structure might be infinite. Any function exported  
to JavaScript must return a finite list.

Annotations would be another way of handling this.


John A. De Goes
The Evolution of Collaboration

http://www.n-brain.net    |    877-376-2724 x 101

More information about the Haskell-Cafe mailing list