yellowbean / Hastructure

ABS/MBS cashflow engine written in Haskell, with API to Python and C/Java (on the way)
https://deal-bench.xyz
Other
16 stars 4 forks source link

Moniod/Semigroup refactor #31

Open yellowbean opened 1 year ago

yellowbean commented 1 year ago

the code base should be more rely on the Haskell type system.

there is duplicate code like :

combine -> CashflowFrame -> CashflowFrame -> CashflowFrame

which is just a <> in semigroup..

We should refactor these code and mark these type as instance of Monoid/Semigroup

https://typeclasses.com/monoid

Semigroup

A -> A -> A

(A-> A) -> A === A-> (A -> A )

Moniod

mempty -> A mconcat :: [A] -> A

yellowbean commented 2 months ago

row <> row -> row cashflow frame <> cashflow frame -> cashflow frame