On Thu, May 8, 2014, at 01:26 AM, Dimitri DeFigueiredo wrote:
Now, I have to convert this (if possible) into an OrderBook type. An orderbook is basically two lists. One list of the orders placed by people who want to buy, the "bids", and the other with the orders of people who want to sell, the "asks". Each order specifies what price should be paid and how many bitcoins to buy/sell (the volume).
There are more representations you could choose.
One example, if you want bids and asks to have the same type:
data OrderType = Bid | Ask
data Order = Order OrderType Price Volume
And if you don't want them to have the same type:
data BidType -- requires -XEmptyDataDecls
data AskType
data Order a = Order Price Volume
type Bid = Order BidType
type Ask = Order AskType
-Karl