[Haskell-cafe] Re: Should I step into a minefield? / Writing a trading studio in Haskell

apfelmus apfelmus at quantentunnel.de
Thu Nov 8 08:24:54 EST 2007

Manuel M T Chakravarty wrote:
> Joel Reymont:
>> I need to pick among the usual list of suspects for a commercial 
>> product that I'm writing. The suspects are OCaml, Haskell and Lisp and 
>> the product is a trading studio. My idea is to write something like 
>> TradeStation [1] or NinjaTrader, only for the Mac.
>> It would be quite nifty to use SPJ's financial combinator approach 
>> and, for example, embed Yi (Haskell editor).
>> One of the key features of the product would be the ability to model 
>> your trading logic using a trading DSL. I'm thinking that this DSL 
>> could well be Haskell but I'm concerned about stepping into a minefield.
>> [...]
>> I just can't see how laziness can help in processing real-time price data.
> Laziness, in particular, and Haskell, in 
> general, is going to help you with the EDSL (it's no coincidence that 
> most EDSL work was done in Haskell).

Yes, you definitively want a host language with non-strict semantics for 
EDSLs. For instance, custom control structures like

   if' p a b = if p then a else b
   when p m  = if p then m else return ()

loose lots of their usefulness in a strict language. Same for parser 
combinators, since you can't even define

   many :: Parser a -> Parser [a]
   many p = empty ||| (liftM2 (:) p (many p))

(Sooner or later, you probably want observable sharing for such 
recursive values, but that's another story.)

In any case, the problem of choosing a host language and achieving good 
user experience is probably negligible compared to the difficulty of 
designing a powerful trading DSL in the first place :)


More information about the Haskell-Cafe mailing list