úÎq;dÜØ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒ Ó Ô Õ Ö × ,non-portable (FD and MPTC. empty data decls) experimentalEdward Kmett <ekmett@gmail.com>Type-Level: if t then x else y Type-Level: not a Type-Level: a implies b = c Qimplemented this way rather than directly so that Binary can extend it properly. C otherwise the normal form restriction makes that nigh impossible. Type-Level: a xor b = c  Type-Level a Ø b = c  Type-Level a Ù b = c %...and every boolean is in that set. : This lets us avoid carrying the closure parameter around ÚÛ*We have a closed set of possible booleans ÜÝ ÞLet them be shown     1non-portable (FD and MPTC, undecidable-instances) experimentalEdward Kmett <ekmett@gmail.com>ßàáâã   1non-portable (MPTC, FD, and missing constructors) experimentalEdward Kmett <ekmett@gmail.com>ä åæ   non-portable (FD and MPTC) experimentalEdward Kmett <ekmett@gmail.com>D!RCount the number of bits set. Since we may have an infinite tail of 1s, we return G a negative number in such cases indicating how many bits are NOT set. "SCount the number of bits set, but track whether the number is positive or negative T to simplify casing. Since we may have an infinite tail of 1s, we return a negative < number in such cases indicating how many bits are NOT set. #toggle the value of bit #b in a, yielding c $ change bit #"b in a to c in {T,F}, yielding d. %set bit #b in a to F, yielding c &set bit #b in a to T, yielding c. 'get bit #b in a as c in {T,F} (3Shift a right b places obtaining c in normal form. ( | If b is negative then we shift left. )IShift a right b places obtaining c. If b is negative then we shift left.  | TShift'% does not yield normal form answers. *Return the absolute value of a +BExponentiation: a^b = c (only defined for non-negative exponents) ,Multiplication: a * b = c -%Reversible adder with extra fundeps. .:Non-reversible subtraction. Kept for efficiency purposes. /7Non-reversible addition. Kept for efficiency purposes. 00Shed the additional reduction parameter from TNF' 1JTransform a number into normal form, but track whether further reductions = may be necessary if this number is extended for efficiency. 2CA symmetrical full adder, that does not yield normal form answers. 3/Returns true if the lsb of the number if false 4.Returns true if the lsb of the number is true 5,Returns true if the number is equal to zero 6-Returns true if the number is less than zero 70Returns true if the number is greater than zero ç^Express a corrolary to the trichotomy law, every number is either negative, positive or zero. 8=TNeg obtains the 2s complement of a number and is reversible 9We don'Rt want to have to carry the closure parameter around explicitly everywhere, so we  shed it here. :;[Our set of digits is closed to retain the properties needed for most of the classes herein <<Finds the unique successor for any normalized binary number =assert 2n+1 != n >assert 2n != n è"extract the lsb and assert we aren't at the long tail ?:Extracts the least significant bit of a as d and returns a'. ) Can also be used to prepend bit d onto a' obtaining a. éêInternal closure, not exposed @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\ëWe have a total order. ì<Equality comparison. Note this does not equate numbers that / are non-normalized with their normalized kin. í'TNot preserves normalization trivially î.Show should express a value as legal haskell. ? !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\?A@<DE;9:8F6H7G5I4J3K-QR,S+T(V'W&X$Z%Y#[!\*U0LMN )12/O.P"?BC=><!"#$%&'()*+,-./0123456789::;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\non-portable (Template Haskell) experimentalEdward Kmett <ekmett@gmail.com>]6$(binaryT n) returns the appropriate TBinary instance ^L$(binaryE n) returns an undefined value of the appropriate TBinary instance ]^^]]^ Lnon-portable (MPTC, FD, TH, undecidable instances, and missing constructors) experimentalEdward Kmett <ekmett@gmail.com>^  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^Hnon-portable (MPTC, FD, TH, undecidable instances, missing constructors) experimentalEdward Kmett <ekmett@gmail.com>,_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š,_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š,hijklmnopqrstuvwzyx{|}€~gfedcb`a_ˆ‡†…„ƒ‚‰Š,_`aabcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰ŠHnon-portable (MPTC, FD, TH, undecidable instances, missing constructors) experimentalEdward Kmett <ekmett@gmail.com>&‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ªï6extract the least signficant nybble from a hex number «¬­®¯%‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯%š™˜—–•”“’‘ŽŒ‹ª©¨§¦¥¤£¢¡ Ÿžœ›­®¬«¯%‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯Hnon-portable (MPTC, FD, TH, undecidable instances, missing constructors) experimentalEdward Kmett <ekmett@gmail.com>"°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅ0$(hexT n) returns the appropriate THex instance ÆF$(hexE n) returns an undefined value of the appropriate THex instance Çpeasant exponentiator È4peasant exponentiator with explicit binary exponent ÉÊËÌÍUA simple peasant multiplier. TODO: exploit 2s complement and reverse the worst cases ÎÏÐÑ"°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑ"±²°³¶·µ¸´¹¾¿½À¼Á»ÂºÃÄÅÆÍÎÌËÏÊÐÉÈÇÑ"°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑ Hnon-portable (MPTC, FD, TH, undecidable instances, missing constructors) experimentalEdward Kmett <ekmett@gmail.com>„ _`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º½ÀÃÄÅÆÇÉÍÎÑÆÅ´¶µ¹·¸°³±²ºÃÄÍÎÇѽÀÉ non-portable (MPTC) experimentalEdward Kmett <ekmett@gmail.com> ÒðÓÔñòÕÖ×ÒÓÔÕÖ×ÔÕÓÖ×ÒÒÓÔÕÖ×ó   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklm=>H@nopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶?DPQRABCSTU9:;<·¸X[\]^¹º7»¼½¾¿8_ÀÁ`  à Ä Å Æ ÇÈÉÊÈÉËÌÍÎÏÐÑÒÓÎÏÔÎÏnÕÎÏÖרÙÚ Û Î ÏÜtype-int-0.5.0.1Data.Type.Boolean Data.Type.OrdData.Type.SignData.Type.Binary.InternalsData.Type.Binary.THData.Type.Hex.Stage1Data.Type.Hex.Stage2Data.Type.Hex.Stage3Data.Type.MaybeData.Type.Binary Data.Type.HexTIftIfTNotTImpliesTXOrTXOr'TOrTAndTBoolFTtTtFtAndtOrtXOr'tXOrtImpliestNotTGtTLeTGeTLtTEqtEqtLttGetLetGtTSignPositiveSignZeroNegative TCountBits TCountBits'TComplementBit TChangeBit TUnSetBitTSetBitTGetBitTShiftTShift'TAbsTPowTMulTAddTSub'TAdd'TNFTNF'TAddC'TOddTEvenTIsZero TIsNegative TIsPositiveTNegTBinary fromTBinaryTCBinaryTSuccXIXOLSBIOtLSBtBSLtSucctPredtNeg tIsPositive tIsNegativetIsZerotEventOddtNFt2nt2np1tAdd'tSub'tAddtSubtMultPowtAbstShifttGetBittSetBit tUnSetBit tChangeBittComplementBit tCountBitsbinaryTbinaryESHR1THexfromTHex TrichotomyLSNtfhexxnhnxhxhx0h0xh0xFhFxhFx0FabcdmkXTmkHTtnotpositivenegativesignzerolsn trichotomyteventsucctaddc'tnf'thexshr1wrapI concatMapMDFDEDDDCDBDAD9D8D7D6D5D4D3D2D1D0HFHEHDHCHBHAH9H8H7H6H5H4H3H2H1H0ExtFExt0tLSNtNSLtAddC'tAddF'hexThexETPow' THexBinary TBinary2Hex THex2Binary THex2Binary' tHex2Binary tBinary2HexTMaybeTJustTNothingtNothingtJust tFromJustbaseGHC.Listorand fromTBoolTCBoolClosedClosure$fShowTTCGtTCLeTCGeTCSignX$fTLtabd$fTEqIOF$fTNotOI$fShowO $fLSNFH0FTCMaybe