[Haskell-cafe] Picking an architecture for a Haskell web app
Lennart Augustsson
lennart at augustsson.net
Thu May 10 18:00:10 EDT 2007
Parsing a very close approximation to what Haskell specifies isn't that
hard. You just need some mild interaction between the parser and lexer.
Executing Haskell is more difficult, since you can't execute Haskell
without first doing type checking.
-- Lennart
On Thu, 10 May 2007, Andrew Coppin wrote:
> Date: Thu, 10 May 2007 17:59:38 +0100
> From: Andrew Coppin <andrewcoppin at btinternet.com>
> To: haskell-cafe at haskell.org
> Subject: Re: [Haskell-cafe] Picking an architecture for a Haskell web app
>
>
>> 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.)
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-- Lennart
More information about the Haskell-Cafe
mailing list