!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ (C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone '(=JK"Is an element contained in a list?"Is one list a subset of the other?-Are two lists equal, when considered as sets?(C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone!"'(=JKMW%The datatype for type-level integers.Less-than comparisonHelper function for divisionDivide two integersNegate an integerMultiply two integersSubtract two integersAdd two integersSubtract one from an integerAdd one to an integer Convert a  to an  )This is the singleton value representing Zero\ at the term level and at the type level, simultaneously. Used for raising units to powers.+Add one to a singleton Z.,Subtract one from a singleton Z.-Convert a singleton Z to an Int.,  !"#$%&'()*+,-.+  !"#$%&'()*+,-H........  !"#$%&'()*+,-&  !"#$%&'()*+,-.None(=JK/4Division of the exponents in a dimension by a scalar0:Multiplication of the exponents in a dimension by a scalar1negate a list of Factors2negate a single Factor3$Subtract exponents in two dimensions4PSubtract exponents in two dimensions, assuming the lists are ordered similarly.5-Adds corresponding exponents in two dimension6YAdds corresponding exponents in two dimension, assuming the lists are ordered similarly.7Take a  [Factor *] and remove any Factors with an exponent of 08 Check if two  [Factor *]"s should be considered to be equal9Helper function in ::PReorders a to be the in the same order as b, putting entries not in b at the end Reorder [A 1, B 2] [B 5, A 2] ==> [B 2, A 1] Reorder [A 1, B 2, C 3] [C 2, A 8] ==> [C 3, A 1, B 2] Reorder [A 1, B 2] [B 4, C 1, A 9] ==> [B 2, A 1] Reorder x x ==> x Reorder x [] ==> x Reorder [] x ==> [] ;(Extract s lst)p pulls the Factor that matches s out of lst, returning a diminished list and, possibly, the extracted Factor. UExtract A [A, B, C] ==> ([B, C], Just A Extract F [A, B, C] ==> ([A, B, C], Nothing) <.Do these Factors represent the same dimension?=ZThis will only be used at the kind level. It holds a dimension or unit with its exponent./0123456789:;<=>/0123456789:;<=>/0123456789:;<=>/034568<None '(=JK?Make a local consistent set of units. The argument is a type-level list of tuple types, to be interpreted as an association list from dimensions to units. For example: Btype MyLCSU = MkLCSU '[(Length, Foot), (Mass, Gram), (Time, Year)]@PAssign a default unit for a dimension. Necessary only when using default LCSUs.?@ABCD?@ABCD?@ABCD None&(12346=JKME8This class is used to mark abstract dimensions, such as Length, or Mass.FRetrieve a list of Factorus representing the given dimension. Overriding the default of this type family should not be necessary in user code.EFEFEF None&'(12346=JKM G~Classifies well-formed list of unit factors, and permits calculating a conversion ratio for the purposes of LCSU conversions. This is like M, but deals with R(. It is necessary to be able to define  in the right way.HUEssentially, a constraint that checks if a conversion ratio can be calculated for a BaseUnit of a unit.IHelper function in JJ8Get the canonical unit from a given unit. For example: CanonicalUnit Foot = MeterKIs this unit a canonical unit?LPCheck to make sure that a unit has the same dimension as its base unit, if any.NThe base unit of this unit: what this unit is defined in terms of. For units that are not defined in terms of anything else, the base unit should be R.OThe dimension that this unit is associated with. This needs to be defined only for canonical units; other units are necessarily of the same dimension as their base.P~The internal list of canonical units corresponding to this unit. Overriding the default should not be necessary in user code.QThe conversion ratio from the base unit to= this unit. If left out, a conversion ratio of 1 is assumed. For example: Rinstance Unit Foot where type BaseUnit Foot = Meter conversionRatio _ = 0.3048Implementations should never examine their argument!Compute the conversion from the underlying canonical unit to this one. A default is provided that multiplies together the ratios of all units between this one and the canonical one.R6Dummy type use just to label canonical units. It does not have a M instance.GHIJKLMNOPQRGHIJKLMNOPQR GHIJKLMNOQPR None&(*24=>BJKS*Exponentiate a quantity type to an integerT.Divide two quantity types to produce a new oneU>Multiply two quantity types to produce a new one. For example: type Velocity = Length %/ TimeVMake a quantity type with a unit and LCSU with custom numerical type. The quantity will have the dimension corresponding to the unit.W?Make a quantity type with a given unit. It will be stored as a ). Note that the corresponding dimension must# have an appropriate instance for @ for this to work.X;Make a quantity type with a custom numerical type and LCSU.YNMake a quantity type capable of storing a value of a given unit. This uses a ' for storage of the value. For example: data LengthDim = LengthDim instance Dimension LengthDim data Meter = Meter instance Unit Meter where type BaseUnit Meter = Canonical type DimOfUnit Meter = LengthDim type instance DefaultUnitOfDim LengthDim = Meter type Length = MkQu_D LengthDimNote that the dimension must' have an instance for the type family @ for this to work.ZZ< adds a dimensional annotation to its numerical value type n0. This is the representation for all quantities.\Add two compatible quantities]"Subtract two compatible quantities^Multiply two quantities_Divide two quantities`-Multiply a quantity by a scalar from the lefta.Multiply a quantity by a scalar from the rightbDivide a scalar by a quantitycDivide a quantity by a scalard^Raise a quantity to a integer power, knowing at compile time that the integer is non-negative.e9Raise a quantity to a integer power known at compile timefCTake the n'th root of a quantity, where n is known at compile timeg3Check if one quantity is less than a compatible oneh6Check if one quantity is greater than a compatible onei?Check if one quantity is less than or equal to a compatible onejBCheck if one quantity is greater than or equal to a compatible onekVCheck if two quantities are equal (uses the equality of the underlying numerical type)l%Check if two quantities are not equalmCompare two compatible quantities for approximate equality. If the difference between the left hand side and the right hand side arguments are less than the epsilon, they are considered equal.nACompare two compatible quantities for approixmate inequality. $qNapprox e a b = not $ qApprox e a boSquare a quantitypCube a quantityq"Take the square root of a quantityr!Take the cubic root of a quantity#STUVWXYZ[\]^_`abcdefghijklmepsilonleft hand sideright hand sidenepsilon left hand side right hand sideopqr STUVWXYZ[\]^_`abcdefghijklmnopqr"STUVWXYZ[\]^_`abcdefghijklmnopqrSTU\]^_`abcdeghijklmn(C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableUnsafeZ[Z[ None &(24=JKMs!A class for user-defined prefixest\This should return the desired multiplier for the prefix being defined. This function must not inspect its argument.uIMultiply a conversion ratio by some constant. Used for defining prefixes.w.Raise a unit to a power, known at compile timey$Divide two units to get another unit{6Multiply two units to get another unit. For example: #type MetersSquared = Meter :* Meterstuvwxyz{| stuvwxyz{|stuvwxyz{|u v wxyz{| None '(=JK } Check if the D4 can convert into the given one, at the given unit.~ Check if the D9 can convert into the given one, at the given dimension.0Check if an LCSU can express the given dimensioncCheck if an LCSU has consistent entries for the given unit. i.e. can the lcsu describe the unit?QGiven a list of unit factors, extract out the canonical units they are based on. Check if two  [Factor *]s, representing units#, should be considered to be equalLike 1, but takes a dimension, not a dimension factors.7Are two LCSUs inter-convertible at the given dimension?Check if a (dimension factors, LCSU) pair are valid to be used together. This checks that each dimension maps to a unit of the correct dimension.TCheck if a (dimension factors, LCSU, unit) triple are all valid to be used together. }~ }~ }~(C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNoneK"/0123456789:;<=>ABFGHIJKLPBALKJIHG=><;:9876543210/(C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone &(234=JKMEThe type of unitless dimensioned quantities. This is an instance of Num/, though Haddock doesn't show it. This uses a Double$ internally and uses a default LCSU.,The unit for unitless dimensioned quantitiesgThe dimension for the dimensionless quantities. It is also called "quantities of dimension one", but One. is confusing with the type-level integer One.dExtracts a numerical value from a dimensioned quantity, expressed in the given unit. For example: 7inMeters :: Length -> Double inMeters x = numIn x Meteror inMeters x = x # Meter Infix synonym for mLike '#', but uses a default LCSU. This operator is recommended for users who wish not to worry about LCSUs.>Creates a dimensioned quantity in the given unit. For example: (height :: Length height = quOf 2.0 Meteror height = 2.0 % MeterInfix synonym for Like e, but uses a default LCSU. This operator is recommended for users who wish not to worry about LCSUs.YUse this to choose a default LCSU for a dimensioned quantity. The default LCSU uses the @$ representation for each dimension.;The number 1, expressed as a unitless dimensioned quantity.^The number 0, polymorphic in its dimension. Use of this will often require a type annotation.yCast between equivalent dimension within the same CSU. for example [kg m s] and [s m kg]. See the README for more info..Dimension-keeping cast between different CSUs.qCompute the argument in the DefaultLCSU, and present the result as lcsu-polymorphic dimension-polymorphic value. A synonym of l, for one of its dominant usecase is to inject constant quantities into dimension-polymorphic expressions.9Convert a raw number into a unitless dimensioned quantity  !"#$%&'()*+,/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\]^_`abcdefghijklmnopqrstuvwxyz{|}~o\]^_`abcdeghijklmnopqrf{|yzwxuvstUTSZYXWVEFMNOQPR?CD@~}  !"#$%&'()*+,  (C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone &'(234=JKM:Show a dimensioned quantity in a given unit. (The default Show( instance always uses canonical units.)   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h h i j k l m n o p q r s t u v w x y z { | } ~                              units-2.0Data.Metrology.ZData.Metrology.SetData.Metrology.InternalData.MetrologyData.Metrology.UnsafeData.Metrology.ShowData.Metrology.FactorData.Metrology.LCSUData.Metrology.DimensionsData.Metrology.UnitsData.Metrology.QuantityData.Metrology.CombinatorsData.Metrology.ValidityZPSZeroElemSubsetSetEqualMFiveMFourMThreeMTwoMOneFiveFourThreeTwoOne<ZDiv#/NegZ#*#-#+PredSuccSZEquals_1627415457SPSSSZerozToIntpZeropOnepTwopThreepFourpFivepMOnepMTwopMThreepMFourpMFivepSuccpPredszToIntTFCo:R:DemoteRepZKProxy@/@*NegListNegDim@-@@-@+@@+ Normalize@~Reorder'ReorderExtract$=FactorFMkLCSUDefaultUnitOfDim LookupListLookupLCSU DefaultLCSU Dimension DimFactorsOf UnitFactorBaseHasConvRatioCanonicalUnit' CanonicalUnit IsCanonicalDimOfUnitIsConsistentUnitBaseUnit DimOfUnit UnitFactorsOfconversionRatio Canonical%^%/%*MkQu_ULNMkQu_UMkQu_DLNMkQu_DQu|+||-||*||/|*||*/||/|^|^^nthRoot|<||>||<=||>=||==||/=|qApproxqNapproxqSqqCubeqSqrt qCubeRoot UnitPrefix multiplier:@:^:/:*DefaultConvertibleLCSU_UDefaultConvertibleLCSU_D CompatibleDimCompatibleUnitCanonicalUnitsOfFactors*~ConvertibleLCSUs_DConvertibleLCSUsValidDLValidDLUScalarNumber DimensionlessnumIn###quOf%%% defaultLCSUunityzeroredimconvertfromDefaultLCSUconstantscalarshowInghc-prim GHC.TypesIntUsePromotedTuplesMkLCSU_ HasConvRatiocanonicalConvRatiocanonicalConvRatioSpec baseUnitRatio $fUnitFactor:$fUnitFactor[]$$fHasConvRatioFalsenoncanonical_unit $fHasConvRatioTruecanonical_unitDouble TFCo:R:%^Quz TFCo:R:%/QuQu TFCo:R:%*QuQu$fUnit:@TFCo:R:DefaultUnitOfDim:^$fUnit:^ $fDimension:^TFCo:R:DefaultUnitOfDim:/$fUnit:/ $fDimension:/TFCo:R:DefaultUnitOfDim:*$fUnit:* $fDimension:* $fUnitNumber$TFCo:R:DefaultUnitOfDimDimensionless$fDimensionDimensionlessShowUnitFactorshowDims showFactor$fShowQu$fShow:@$fShow:^$fShow:/$fShow:*$fShowUnitFactor:$fShowUnitFactor[]