[Haskell-cafe] Re: State of OOP in Haskell
Al Falloon
afalloon at synopsys.com
Tue Jan 30 10:01:16 EST 2007
Alexy Khrabrov wrote:
> Well, I'm thinking in terms of OOD/OOA/OOP -- Design, Architecture,
> Programming. That's about the only way to model a bog system. Say I
> have a stock market model -- I'll have a database of tickers, a
> simulator to backtest things, a trading strategy, etc.
>
> Do Haskell modules provide enough encapsulation to design a system in
> terms of them? What are the design/architecture units in Haskell if
> not OO-based?
Design of functional programs is very bottom-up. The general plan is to
identify the primitives for your domain and embed them in the language,
then solve your problems using those primitives. Evolving your
primitives and program concurrently as you get a better understanding of
the problem/solution.
A good intro to this kind of programming is 'On Lisp' by Paul Graham
(http://www.paulgraham.com/onlisp.html). Of course, he is using Lisp
instead of Haskell so many of the concrete techniques for implementing
this method are different[*]. However, the first section of the book
that talks about how you build something "on Lisp" is equally applicable
to building software "on Haskell".
I expect that in your domain, the primitives are things like: currency,
time series data, trades, strategies, and so on. The primitive
operations would let you "perform a trade", "back-test a strategy" and
so on. Since it is close to your chosen domain, I highly recommend you
look at
http://research.microsoft.com/~simonpj/Papers/financial-contracts/contracts-icfp.htm
[*] On Lisp makes heavy use of macros in Lisp, which have no analog in
Haskell, but can usually be substituted for lazy-evaluation and/or monads
--
Alan Falloon
More information about the Haskell-Cafe
mailing list