-- | Cabin color schemes---- Each element of a Cabin report identifies what it is--a debit on an-- even line, a credit on an odd line, etc. The user can have several-- color schemes; the scheme contains color assignments for 8 and 256-- color terminals. This allows the use of different schemes for light-- and dark terminals or for any other reason.modulePenny.Cabin.SchemewhereimportqualifiedPenny.Cabin.ChunkasCimportqualifiedPenny.Cabin.MetaasMimportqualifiedPenny.LincolnasLimportqualifiedData.TextasXdataLabel=Debit|Credit|Zero|Otherderiving(Eq,Ord,Show)dataEvenOdd=Even|Oddderiving(Eq,Ord,Show)dataLabelsa=Labels{debit::a,credit::a,zero::a,other::a}derivingShowgetLabelValue::Label->Labelsa->agetLabelValuells=caselofDebit->debitlsCredit->creditlsZero->zerolsOther->otherlsdataEvenAndOdda=EvenAndOdd{eoEven::a,eoOdd::a}derivingShowtypeTextSpecs=Labels(EvenAndOddC.TextSpec)dataScheme=Scheme{name::String-- ^ The name of this scheme. How it will be identified on the-- command line.,description::String-- ^ A brief (one-line) description of what this scheme is, such-- as @for dark background terminals@,textSpecs::TextSpecs}derivingShowgetEvenOdd::EvenOdd->EvenAndOdda->agetEvenOddeoeao=caseeoofEven->eoEveneaoOdd->eoOddeaogetEvenOddLabelValue::Label->EvenOdd->Labels(EvenAndOdda)->agetEvenOddLabelValueleols=getEvenOddeo(getLabelValuells)dataPreChunk=PreChunk{label::Label,evenOdd::EvenOdd,text::X.Text}deriving(Eq,Show)width::PreChunk->C.Widthwidth=C.Width.X.length.textmakeChunk::TextSpecs->PreChunk->C.ChunkmakeChunksp=C.chunk(getEvenOddLabelValue(labelp)(evenOddp)s)(textp)fromVisibleNum::M.VisibleNum->EvenOddfromVisibleNumvn=lets=M.unVisibleNumvninifeven.L.forward$sthenEvenelseOdddcToLbl::L.DrCr->LabeldcToLblL.Debit=DebitdcToLblL.Credit=CreditbottomLineToDrCr::L.BottomLine->EvenOdd->PreChunkbottomLineToDrCrbleo=PreChunklbleotwhere(lbl,t)=caseblofL.Zero->(Zero,X.pack"--")L.NonZero(L.ColumnclmDrCr_)->caseclmDrCrofL.Debit->(Debit,X.singleton'<')L.Credit->(Credit,X.singleton'>')balancesToCmdtys::EvenOdd->[(L.Commodity,L.BottomLine)]->[PreChunk]balancesToCmdtyseols=ifnulllsthen[PreChunkZeroeo(X.pack"--")]elsemap(bottomLineToCmdtyeo)lsbottomLineToCmdty::EvenOdd->(L.Commodity,L.BottomLine)->PreChunkbottomLineToCmdtyeo(cy,bl)=PreChunklbleotwheret=L.unCommoditycylbl=caseblofL.Zero->ZeroL.NonZero(L.ColumnclmDrCr_)->dcToLblclmDrCrbalanceToQtys::(L.Commodity->L.Qty->X.Text)->EvenOdd->[(L.Commodity,L.BottomLine)]->[PreChunk]balanceToQtysgetTxteols=ifnulllsthen[PreChunkZeroeo(X.pack"--")]elsemap(bottomLineToQtygetTxteo)lsbottomLineToQty::(L.Commodity->L.Qty->X.Text)->EvenOdd->(L.Commodity,L.BottomLine)->PreChunkbottomLineToQtygetTxteo(cy,bl)=PreChunklbleotwhere(lbl,t)=caseblofL.Zero->(Zero,X.pack"--")L.NonZero(L.ColumnclmDrCrqt)->(dcToLblclmDrCr,getTxtcyqt)