[Haskell-cafe] Re: Hot-Swap with Haskell

wren ng thornton wren at freegeek.org
Sat Jul 17 03:37:10 EDT 2010


Brandon S Allbery KF8NH wrote:
> On 7/16/10 05:21 , Andy Stewart wrote:
>> IMO, "haskell interpreter" is perfect solution for samll script job. But
>> i'm afraid "haskell interpreter" is slow for *large code*, i don't know,
>> i haven't try this way...
> 
> Hugs?

Or you can try implementing (or finding) a SASL interpreter[1]. SASL is 
just the untyped[2] lambda calculus with named functions. ADTs are 
implemented by function application, greatly simplifying the 
compiler/interpreter. On their benchmarks, the version presented in the 
paper is competitive with GHCi 6.4 and outperforms Hugs Jan2005.

Interpreting is always slower than compiled code. But how much that 
matters is a separate issue. Folks seem to like their Perl, Python, 
Ruby,... even for large projects.


[1] Jan Jansen (2005) /Data Types and Pattern Matching by Function 
Application/, Proc. 17th IFL.

[2] The version they present in the paper uses the untyped calculus 
since their pattern matching doesn't fit in Hindley--Milner. The problem 
is the need for a fixpoint type operator, and polymorphism under the 
fixpoint; thus, it fits perfectly fine in System F with iso-recursive 
types. So just turn on -XRankNTypes and use them directly:

     newtype List a = List { caseList
         :: forall r. r -> (a -> List a -> r) -> r }
     nil       = List (\n c -> n)
     cons x xs = List (\n c -> c x xs)

     length xs = caseList xs 0 (\x xs' -> 1 + length xs')

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list