
18 Jul
2011
18 Jul
'11
6:20 a.m.
I'm not sure I would model your datatype this way, I don't like the idea to put unnecessary undefined values in the case of subcontracts. I would instead data Contract = Contract { currency :: Currency, payments :: Double } | SubContract { contracts :: [Contract] } one c = Contract { currency = c, payments = 1 } and :: Contract -> Contract -> Contract (and) c1 c2 = Subcontract { contracts = [c1, c2] }