[Haskell-cafe] Picking an architecture for a Haskell web app

Andrew Coppin andrewcoppin at btinternet.com
Thu May 10 12:59:38 EDT 2007


> No, you can do the GHCi trick, converting it to Core, perform a small
> number of Core-to-Core transformations, convert it to bytecode,
> interpret the bytecode. Compare this to the programmer time to
> implement directly executing an interpetted expression, and it starts
> to get complex.

One of the things on the long list of questions I haven't got round to 
asking yet is "is there some library that lets you execute arbitrary 
Haskell code from a string?" Clearly GHCi manages to do it without 
difficulty. Apparently hs-plugins allows this too, but... surely this is 
a sledgehammer to crack a nut? A Haskell program is just a set of graph 
rewrite rules, after all...

> Also remember that evaluating an expression in Haskell is _really_
> hard!

Really? Looks pretty damn simple to me...

> The value depends on the types, there is loads of sugar, loads
> of libraries etc. A Haskell compiler is a very hard thing to write, an
> interepretter doesn't save much of that complexity.

Oh, yeah, well, definitely the hardest part is *parsing* Haskell. In 
particular, the fact that layout exists makes this problem essentually 
unsolvable. If I could figure out how to parse Haskell, executing it 
wouldn't be too hard. (Unless you wanted it to actually be capable of 
running *arbitrary* programs - ones that use FFI, concurrency, mutable 
state, exceptions, graphics, etc. Or if you want it to be *efficient*. 
If you just want to be able to run pure functional code and have it 
produce a correct result, that's quite easy.)



More information about the Haskell-Cafe mailing list