jX      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  Safe3HMT VA "symbol table" for the parser, mapping prefixes and units to their representations.HA mapping from unit spellings to unit identifiers (of unspecified type u2). All unit spellings must be strictly alphabetic.LA mapping from prefix spellings to prefix identifiers (of unspecified type pre4). All prefix spellings must be strictly alphabetic.^Parsed unit expressions, parameterized by a prefix identifier type and a unit identifier type a unit with, perhaps, a prefix "1" experiment p runs p. If p succeeds,  experiment returns the result of running p. If p fails, then  experiment returns Nothing,. In either case, no input is consumed and  experiment never fails. Build a symbol table from prefix mappings and unit mappings. The prefix mapping can be empty. This function checks to make sure that the strings are not inherently ambiguous and are purely alphabetic. Parse a unit expression, interpreted with respect the given symbol table. Returns either an error message or the successfully-parsed unit expression.;       Association list of prefixesAssociation list of units  !   *         !(C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone!"'(=JKMW%The datatype for type-level integers.9Check if a type-level integer is in fact a natural numberLess-than comparison"Helper function for divisionDivide two integersNegate an integerMultiply two integersSubtract two integersAdd two integersSubtract one from an integer Add 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.3Add one to a singleton Z.4Subtract one from a singleton Z.5Negate a singleton Z.6Convert a singleton Z to an Int.B$" !"%#$&%&'()'()*+,-./0123456789:;<=>?@ABC*I+,-./012345 !"#$%&'()'()*+,-./0123456789:;<=>?@ABC;!&$%"#'6 345()*+,-./012789:;<=>?@ABC:$" !"%#$&%&'()*+,-./0123456789:;<=>?@ABC*)('(C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone'(=JKD"Is an element contained in a list?E"Is one list a subset of the other?F-Are two lists equal, when considered as sets?DEFDEFFEDDEF None(=JKG4Division of the exponents in a dimension by a scalarH:Multiplication of the exponents in a dimension by a scalarInegate a list of FactorsJnegate a single FactorK$Subtract exponents in two dimensionsLPSubtract exponents in two dimensions, assuming the lists are ordered similarly.M?Adds corresponding exponents in two dimension, preserving orderNYAdds corresponding exponents in two dimension, assuming the lists are ordered similarly.OTake a  [Factor *] and remove any Factors with an exponent of 0P Check if two  [Factor *]"s should be considered to be equalQHelper function in RRPReorders 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 ==> [] S(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) T.Do these Factors represent the same dimension?UZThis will only be used at the kind level. It holds a dimension or unit with its exponent.GHIJKLMNOPQRSTUVGHIJKLMNOPQRSTUVGHIJKLMNOPQRSTUVGHKLMNPT None'(=JKWMake 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)]XPAssign a default unit for a dimension. Necessary only when using default LCSUs.6WXYZ[\7WXYZ[\6WXYZ[7\None&(12346=JKM]8This class is used to mark abstract dimensions, such as Length, or Mass.^Retrieve a list of Factorus representing the given dimension. Overriding the default of this type family should not be necessary in user code.]^]^]^None&'(12346=JKM_,The unit for unitless dimensioned quantitiesagThe dimension for the dimensionless quantities. It is also called "quantities of dimension one", but One. is confusing with the type-level integer One.c~Classifies well-formed list of unit factors, and permits calculating a conversion ratio for the purposes of LCSU conversions.8 This is like i, but deals with n(. It is necessary to be able to define 9 in the right way.dUEssentially, a constraint that checks if a conversion ratio can be calculated for a BaseUnit of a unit.eHelper function in ff8Get the canonical unit from a given unit. For example: CanonicalUnit Foot = MetergIs this unit a canonical unit?hPCheck to make sure that a unit has the same dimension as its base unit, if any.jThe 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 n.kThe 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.l~The internal list of canonical units corresponding to this unit. Overriding the default should not be necessary in user code.mThe 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!9Compute 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.n6Dummy type use just to label canonical units. It does not have a i instance._`abc:8;defghijklm9n<=>?@AB_`abc:8;defghijklm9n_`abc:8;defghijkml9n<=>?@ABNone&(*234=>BJK oEThe type of unitless dimensioned quantities. This is an instance of Num`, though Haddock doesn't show it. This is parameterized by an LCSU and a number representation.p*Exponentiate a quantity type to an integerq.Divide two quantity types to produce a new oner>Multiply two quantity types to produce a new one. For example: type Velocity = Length %/ TimesMake a quantity type with a unit and LCSU with custom numerical type. The quantity will have the dimension corresponding to the unit.t?Make a quantity type with a given unit. It will be stored as a C). Note that the corresponding dimension must# have an appropriate instance for X for this to work.u;Make a quantity type with a custom numerical type and LCSU.vNMake a quantity type capable of storing a value of a given unit. This uses a C' 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 X for this to work.ww< adds a dimensional annotation to its numerical value type n0. This is the representation for all quantities.y9Convert a raw number into a unitless dimensioned quantityzMultiply two quantities{Divide two quantities|^Raise a quantity to a integer power, knowing at compile time that the integer is non-negative.}9Raise a quantity to a integer power known at compile time~CTake the n'th root of a quantity, where n is known at compile timeCompare two quantities3Check if one quantity is less than a compatible one6Check if one quantity is greater than a compatible one?Check if one quantity is less than or equal to a compatible oneBCheck if one quantity is greater than or equal to a compatible oneVCheck if two quantities are equal (uses the equality of the underlying numerical type)%Check if two quantities are not equalCompare two compatible quantities for approximate equality. If the difference between the left hand side and the right hand side arguments are less than or equal to the epsilon, they are considered equal.ACompare two compatible quantities for approixmate inequality. $qNapprox e a b = not $ qApprox e a bDivide a scalar by a quantitySquare a quantityCube a quantity"Take the square root of a quantity!Take the cubic root of a quantityYUse this to choose a default LCSU for a dimensioned quantity. The default LCSU uses the X$ representation for each dimension.;The number 1, expressed as a unitless dimensioned quantity.yCast between equivalent dimension within the same CSU. for example [kg m s] and [s m kg]. See the README for more info.$opqrstuvwxyz{|}~epsilonleft hand sideright hand sideepsilon left hand side right hand sideDEF!opqrstuvwxyz{|}~#opqrstuvwxyz{|}~DEFpqrz{|}(C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone &'(234=JKMGHIJKLGHIJKL(C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableUnsafewxwxNone &(24=JKM!A class for user-defined prefixes\This should return the desired multiplier for the prefix being defined. This function must not inspect its argument.IMultiply a conversion ratio by some constant. Used for defining prefixes..Raise a unit to a power, known at compile time$Divide two units to get another unit6Multiply two units to get another unit. For example: #type MetersSquared = Meter :* MeterMNOPQRSTUVWXYZ MNOPQRSTUVWXYZ  None'(=JK  Check if the \4 can convert into the given one, at the given unit. Check if the \9 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.7Extract a unit from a dimension factor list and an LCSU/Extract a unit specifier from a list of factors4Extract a dimension specifier from a list of factors  (C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNoneK"DEFGHIJKLMNOPQRSTUVYZ^cdefghlZYhgfedcUVTSRQPONMLKJIHG(C) 2014 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone &(3=BJKM 0Make a point quantity from a non-point quantity.A Point n is an affine space built over n. Two PointMs cannot be added, but they can be subtracted to yield a difference of type n.^The number 0, polymorphic in its dimension. Use of this will often require a type annotation.Add two compatible quantitiesNegate a quantity"Subtract two compatible quantities$Take the sum of a list of quantities/Multiply a scalar quantity by a vector quantity/Multiply a vector quantity by a scalar quantity-Divide a vector quantity by a scalar quantityDivide a quantity by a scalar-Multiply a quantity by a scalar from the left.Multiply a quantity by a scalar from the right2Take a inner (dot) product between two quantities.Square the length of a vector.Length of a vector.Vector in same direction as given one but with length of one. If given the zero vector, then return it. The returned vector is dimensionless. qProject u v computes the projection of v onto u.Cross product of 2D vectors.Cross product of 3D vectors.Subtract point quantities.Add a point to a vector.Subract a vector from a point.*Square of the distance between two points.Distance between two points.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 >Creates a dimensioned quantity in the given unit. For example: (height :: Length height = quOf 2.0 Meteror height = 2.0 % MeterInfix synonym for .Dimension-keeping cast between different CSUs.Compute the argument in the  DefaultLCSUQ, and present the result as lcsu-polymorphic dimension-polymorphic value. Named o because one of its dominant usecase is to inject constant quantities into dimension-polymorphic expressions.:Show a dimensioned quantity in a given unit. (The default Show7 instance always uses units as specified in the LCSU.)"[ ()*+,-./012345DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwyz{|}~džz{|}~rqpwvuts]^ijkmlnab_`oyW[\X ()*+,-./012345![ (C) 2013 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone &(234=JKMdExtracts 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 >Creates a dimensioned quantity in the given unit. For example: (height :: Length height = quOf 2.0 Meteror height = 2.0 % MeterInfix synonym for :Show a dimensioned quantity in a given unit. (The default Show7 instance always uses units as specified in the LCSU.).Dimension-keeping cast between different CSUs.Compute the argument in the  DefaultLCSUQ, and present the result as lcsu-polymorphic dimension-polymorphic value. Named o because one of its dominant usecase is to inject constant quantities into dimension-polymorphic expressions.^The number 0, polymorphic in its dimension. Use of this will often require a type annotation.Add two compatible quantities"Subtract two compatible quantities$Take the sum of a list of quantitiesNegate a quantity-Multiply a quantity by a scalar from the left.Multiply a quantity by a scalar from the rightDivide a quantity by a scalar ()*+,-./012345789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwyz{|}~ցz{|}~rqpwvuts]^ijkmlnab_`oyW[\X ()*+,-./012345789:;<=>?@ABC (C) 2014 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone EvaluatesI a type as far as it can. This is useful, say, in instance declarations: 1instance Show $(evalType [t| Length |]) where ... Without the ), the instance declaration fails because LengthG mentions type families, which can't be used in instance declarations.This function is somewhat experimental, and will likely not work with more polymorphic types. (If it doesn't work, not all of the type families will be evaluated, and the instance declaration will fail. This function should never cause  incorrect behavior.)*Declare a new dimension of the given name: $(declareDimension "Length")produces .data Length = Length instance Dimension Length\Conditionally generates a Show instance0declareCanonicalUnit unit_name dim (Just abbrev)a creates a new canonical unit (that is, it is not defined in terms of other known units) named  unit_name, measuring dimension dim. abbrev) will be the abbreviation in the unit's Show4 instance. If no abbraviation is supplied, then no Show instance will be generated.Example usage: 8$(declareCanonicalUnit "Meter" [t| Length |] (Just "m"))?declareDerivedUnit unit_name base_unit_type ratio (Just abbrev)4 creates a new derived unit, expressed in terms of base_unit_type. ratio> says how many base units are in the derived unit. (Thus, if  unit_name is Minute and base_unit_type is ''Second, then ratio would be 60.) abbrevB, if supplied, becomes the string produced in the derived unit's Show. instance. If no abbreviation is supplied, no Show instance is generated.Example usage: <$(declareDerivedUnit "Minute" [t| Second |] 60 (Just "min"))'declareMonoUnit unit_name (Just abbrev) creates a new derived unit, intended for use without unit polymorphism. The same type stands for both the unit and dimension, and the instance of X5 is set up accordingly. Use this function (with the T imports) if you don't want to bother with LCSUs and just want to get to work. The abbrev', if supplied, creates an appropriate Show instance. %$(declareMonoUnit "Meter" (Just "m"))produces all of the following data Meter = Meter instance Dimension Meter instance Unit Meter where type BaseUnit Meter = Canonical type DimOfUnit Meter = Meter type instance DefaultUnitOfDim Meter = Meter instance Show Meter where show _ = "m"0After a declaration like this, you probably want type Length = MkQu_U MeterThis last line is notP generated, as it is easy enough for you to write, and it involves a new name (Length).*declareConstant const_name value unit_type* creates a new numerical constant, named  const_name. Its numerical value is value expressed in units given by  unit_typeZ. The constant is polymorphic in both its LCSU and numerical representation. For example, AdeclareConstant "gravity_g" 9.80665 [t| Meter :/ Second :^ Two |]yields gravity_g :: ( Fractional n , CompatibleUnit lcsu (Meter :/ Second :^ Two) ) => MkQu_ULN (Meter :/ Second :^ Two) lcsu n gravity_g = 9.80665 % (undefined :: Meter :/ Second :^ Two)\\ (C) 2014 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone&(=KThe w& type associated with a member of the  class allows for easy conversions in and out of quantities. For example, say you are working with an outside library for time that defines UTCTime@, where that stores the time measured in seconds. You could say dinstance Quantity UTCTime where type QuantityUnit = Second fromQuantity = ... toQuantity = ...)Then, conversions are easy and unit-safe.The unit associated with t.The LCSU associated with t. Defaults to \.-The numerical representation associated with t. Defaults to C. (C) 2014 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone&(JKEThe type of unitless dimensioned quantities. This is an instance of Numa, though Haddock doesn't show it. This assumes a default LCSU and an internal representation of Double.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 >Creates a dimensioned quantity in the given unit. For example: (height :: Length height = quOf 2.0 Meteror height = 2.0 % MeterInfix synonym for  ()*+,-./012345789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnpqrstuvwyz{|}~ (C) 2014 Richard EisenbergBSD-style (see LICENSE)%Richard Eisenberg (eir@cis.upenn.edu) experimental non-portableNone#makeQuasiQuoter "qq" prefixes units makes a quasi-quoter named qqW that considers the prefixes and units provided. These are provided via names of the type constructors, notS the data constructors. See the module documentation for more info and an example.+Gets a list of the names of all units with Show$ instances in scope. Example usage: ?$( do units <- allUnits makeQuasiQuoter "unit" [] units )3Gets a list of the names of all unit prefixes with Show$ instances in scope. Example usage: f$( do units <- allUnits prefixes <- allPrefixes makeQuasiQuoter "unit" prefixes units )]^_    ]^_`     ! " # $ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^ _ ` a b c d e f g h i j k l m n o p q r s tuvwwxxyz{|}~"                                                       !"#$%&'(')'*'+','-'.'/'012 3 456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\] units-2.2Data.Metrology.ZData.Metrology.ParserData.Metrology.SetData.Metrology.InternalData.Metrology.VectorData.Metrology.UnsafeData.Metrology.PolyData.Metrology.THData.Metrology.QuantityData.MetrologyData.Metrology.Parser.InternalData.Metrology.FactorData.Metrology.LCSUData.Metrology.DimensionsData.Metrology.UnitsData.Metrology.QuData.Metrology.ShowData.Metrology.CombinatorsData.Metrology.ValidityData MetrologyZPSZerosingletons-1.0Data.SingletonsSing SymbolTableUnitExpPowDivMultUnitUnity mkSymbolTable parseUnitMFiveMFourMThreeMTwoMOneFiveFourThreeTwoOne NonNegative<#/Negate#*#-#+PredSuccSZPSym0PSym1SSym0SSym1ZeroSym0zToIntsZerosOnesTwosThreesFoursFivesMOnesMTwosMThreesMFoursMFivesSuccsPredsNegateszToIntpZeropOnepTwopThreepFourpFivepMOnepMTwopMThreepMFourpMFivepSuccpPredElemSubsetSetEqual@/@*NegListNegDim@-@@-@+@@+ Normalize@~Reorder'ReorderExtract$=FactorFMkLCSUDefaultUnitOfDim LookupListLookupLCSU DefaultLCSU Dimension DimFactorsOfNumber Dimensionless UnitFactorBaseHasConvRatioCanonicalUnit' CanonicalUnit IsCanonicalDimOfUnitIsConsistentBaseUnit DimOfUnit UnitFactorsOfconversionRatio CanonicalCount%^%/%*MkQu_ULNMkQu_UMkQu_DLNMkQu_DQuquantity|*||/||^|^^qNthRootqCompare|<||>||<=||>=||==||/=|qApproxqNapprox/|qSqqCubeqSqrt qCubeRoot defaultLCSUunityredim UnitPrefix multiplier:@:^:/:*DefaultConvertibleLCSU_UDefaultConvertibleLCSU_D CompatibleDimCompatibleUnitCanonicalUnitsOfFactors*~ConvertibleLCSUs_DConvertibleLCSUsValidDLValidDLUUnitOfDimFactorsMultUnitFactorsMultDimFactorsQPointPointzero|+|qNegate|-|qSum|*^||^*||^/||/*||*|.| qMagnitudeSq qMagnitude qNormalizedqProjectqCross2qCross3|.-.||.+^||.-^| qDistanceSq qDistancenumIn#quOf%convertconstantshowInevalType checkIsTypedeclareDimensiondeclareCanonicalUnitdeclareDerivedUnitdeclareMonoUnitdeclareConstant QuantityQuQuantity QuantityUnit QuantityLCSU QuantityRep fromQuantity toQuantity $fQuantityQu parseUnitExp parseUnitTypemakeQuasiQuoterallUnits allPrefixes UnitTable PrefixTable experimentUnitParser_UnitExp UnitParser GenUnitParserUnitStringParser_UnitExpGenUnitStringParser prefixTable unitTableLexerTokenOpTNumberTUnitTOpClosePOpenPPowODivOMultONegO partitionWith consumeAllnocharunitLopLnumberLlexer1lexerlex unambFromList justUnitP prefixUnitPunitStringParserupdatePosTokenuTokenlparenPrparenP unitStringPnumPpowPunitP unitFactorPopPparser $fShowUnitExp $fShowToken$fShowOpZDivghc-prim GHC.TypesIntEquals_1627427878PSym0KindInferenceSSym0KindInferenceSPSSSZeroTFCo:R:DemoteRepZKProxy!Data.Singletons.Prelude.InstancesSFalseSTrueSTuple0STuple2STuple3STuple4STuple5STuple6STuple7 applySingSLambdaUsePromotedTuplesMkLCSU_ HasConvRatiocanonicalConvRatiocanonicalConvRatioSpec baseUnitRatio $fUnitNumber$TFCo:R:DefaultUnitOfDimDimensionless$fDimensionDimensionless $fUnitFactor:$fUnitFactor[]$$fHasConvRatioFalsenoncanonical_unit $fHasConvRatioTruecanonical_unitDouble TFCo:R:%^Quz TFCo:R:%/QuQu TFCo:R:%*QuQuShowUnitFactorshowDims showFactor$fShowQu$fShowUnitFactor:$fShowUnitFactor[]$fShow:@$fUnit:@$fShow:^TFCo:R:DefaultUnitOfDim:^$fUnit:^ $fDimension:^$fShow:/TFCo:R:DefaultUnitOfDim:/$fUnit:/ $fDimension:/$fShow:*TFCo:R:DefaultUnitOfDim:*$fUnit:* $fDimension:*$fAffineSpacePointmaybeMkShowInstanceemptyQQerrorQQgetInstanceNames