h&ID      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe-Inferred 0:? refined/A refinement type, which wraps a value of type x.refinedrefinedrefinedrefinedrefinedrefinedrefinedrefined Safe-Inferred"01;@refinedA Tree which is a bit easier to pretty-print TODO: get rid of this refined)An exception encoding the way in which a J failed. refinedA   for failures involving the F predicate. refinedA   for failures involving the D predicate. refinedA   for failures involving the A predicate. refinedA   for failures involving the > predicate.refinedA   for failures involving all other predicates with custom exception.refinedA  - for failures involving all other predicates.refinedThe  of the F p type.refinedA " encoding which branch(es) of the D failed: if the   came from the l! predicate, then this will be , if it came from the r predicate, this will be , and if it came from both l and r, this will be .refinedThe   for the l failure.refinedThe   for the l failure.refinedA custom exception.refinedA custom message to display.refinedA typeclass containing "safe" conversions between refined predicates where the target is weaker than the source: that is, all values that satisfy the first predicate will be guaranteed to satisfy the second.Take care: writing an instance declaration for your custom predicates is the same as an assertion that  is safe to use:  instance  Pred1 Pred2 For most of the instances, explicit type annotations for the result value's type might be required.refinedrefinedA J% ensuring that the type is non-empty.refinedA J! ensuring that the type is empty.refinedA J. ensuring that the value is not equal to zero.refined.An inclusive range of values from zero to one.refinedA J: ensuring that the value is greater than or equal to zero.refinedA J+ ensuring that the value is less than zero.refinedA J7 ensuring that the value is less than or equal to zero.refinedA J. ensuring that the value is greater than zero.refinedA J! ensuring that the value is even.isRight (refine @Even @Int 32)TrueisLeft (refine @Even @Int 33)TruerefinedrefinedA J? ensuring that the value is IEEE infinity or negative infinity.(isRight (refine @Infinite @Double (1/0))True)isRight (refine @Infinite @Double (-1/0))True'isLeft (refine @Infinite @Double 13.20)TruerefinedrefinedA J6 ensuring that the value is IEEE "not-a-number" (NaN).#isRight (refine @NaN @Double (0/0))True!isLeft (refine @NaN @Double 13.9)Truerefined refinedA J ensuring that the value is odd.isRight (refine @Odd @Int 33)TrueisLeft (refine @Odd @Int 32)True!refined"refinedA J) ensuring that the value is divisible by n.)isRight (refine @(DivisibleBy 3) @Int 12)True(isLeft (refine @(DivisibleBy 2) @Int 37)True#refined$refinedA J ensuring that the value is greater or equal than a negative number specified as a type-level (positive) number n1 and less than a type-level (positive) number m.1isRight (refine @(NegativeFromTo 5 12) @Int (-3))True/isLeft (refine @(NegativeFromTo 4 3) @Int (-5))True%refined&refinedA J ensuring that the value is not equal to the specified type-level number n.'isRight (refine @(NotEqualTo 6) @Int 5)True&isLeft (refine @(NotEqualTo 5) @Int 5)True'refined(refinedA J ensuring that the value is equal to the specified type-level number n.$isRight (refine @(EqualTo 5) @Int 5)True#isLeft (refine @(EqualTo 6) @Int 5)True)refined*refinedA J6 ensuring that the value is within an inclusive range.'isRight (refine @(FromTo 0 16) @Int 13)True(isRight (refine @(FromTo 13 15) @Int 13)True(isRight (refine @(FromTo 13 15) @Int 15)True'isLeft (refine @(FromTo 13 15) @Int 12)True+refined,refinedA J ensuring that the value is less than or equal to the specified type-level number.!isRight (refine @(To 23) @Int 17)True isLeft (refine @(To 17) @Int 23)True-refined.refinedA J ensuring that the value is greater than or equal to the specified type-level number."isRight (refine @(From 9) @Int 10)True#isRight (refine @(From 10) @Int 10)True"isLeft (refine @(From 11) @Int 10)True/refined0refinedA J ensuring that the value is greater than the specified type-level number.*isRight (refine @(GreaterThan 65) @Int 67)True)isLeft (refine @(GreaterThan 65) @Int 65)True1refined2refinedA J ensuring that the value is less than the specified type-level number.'isRight (refine @(LessThan 12) @Int 11)True&isLeft (refine @(LessThan 12) @Int 12)True3refined4refinedA J ensuring that the 3 contains elements in a strictly descending order.6isRight (refine @Descending @[Int] [34, 21, 13, 8, 5])True5isLeft (refine @Descending @[Int] [5, 8, 13, 21, 34])True5refined6refinedA J ensuring that the 2 contains elements in a strictly ascending order.5isRight (refine @Ascending @[Int] [5, 8, 13, 21, 34])True4isLeft (refine @Ascending @[Int] [34, 21, 13, 8, 5])True7refined8refinedA J ensuring that the value has a length which is equal to the specified type-level number.2isRight (refine @(SizeEqualTo 4) @[Int] [1,2,3,4])True2isLeft (refine @(SizeEqualTo 35) @[Int] [1,2,3,4])True.isRight (refine @(SizeEqualTo 4) @Text "four")True.isLeft (refine @(SizeEqualTo 35) @Text "four")True9refined:refinedA J ensuring that the value has a length which is greater than the specified type-level number.4isLeft (refine @(SizeGreaterThan 3) @[Int] [1,2,3])True8isRight (refine @(SizeGreaterThan 3) @[Int] [1,2,3,4,5])True/isLeft (refine @(SizeGreaterThan 4) @Text "Hi")True3isRight (refine @(SizeGreaterThan 4) @Text "Hello")True;refined<refinedA J ensuring that the value has a length which is less than the specified type-level number.1isRight (refine @(SizeLessThan 4) @[Int] [1,2,3])True4isLeft (refine @(SizeLessThan 5) @[Int] [1,2,3,4,5])True-isRight (refine @(SizeLessThan 4) @Text "Hi")True/isLeft (refine @(SizeLessThan 4) @Text "Hello")True=refined>refined,The exclusive disjunction of two predicates.'isRight (refine @(Xor Even Odd) @Int 3)True6isLeft (refine @(Xor (LessThan 3) (EqualTo 2)) @Int 2)True'isLeft (refine @(Xor Even Even) @Int 2)True?refined@refined"The disjunction of two predicates.Arefined"The disjunction of two predicates.&isRight (refine @(Or Even Odd) @Int 3)True:isRight (refine @(Or (LessThan 3) (GreaterThan 3)) @Int 2)True'isRight (refine @(Or Even Even) @Int 4)TrueBrefinedCrefined"The conjunction of two predicates.Drefined"The conjunction of two predicates./isLeft (refine @(And Positive Negative) @Int 3)True-isRight (refine @(And Positive Odd) @Int 203)TrueErefinedFrefinedThe negation of a predicate.*isRight (refine @(Not NonEmpty) @[Int] [])True,isLeft (refine @(Not NonEmpty) @[Int] [1,2])TrueGrefinedHrefinedA predicate which is satisfied for all types. Arguments passed to K in K H x are not evaluated.'isRight (refine @IdPred @Int undefined)True&isLeft (refine @IdPred @Int undefined)FalseIrefinedJrefinedA typeclass which defines a runtime interpretation of a type-level predicate p for type x.KrefinedCheck the value x according to the predicate p, producing an error  " if the value does not satisfy.Note: K is not intended to be used directly; instead, it is intended to provide the minimal means necessary for other utilities to be derived. As such, the  here should be interpreted to mean the presence or absence of a  , and nothing else.refined FIXME: docrefined.Helper function, stolen from the flow package.refined.Helper function, stolen from the flow package.refined FIXME: docrefined FIXME: docLrefinedA smart constructor of a - value. Checks the input value at runtime.MrefinedLike L, but discards the refinement. This _can_ be useful when you only need to validate that some value at runtime satisfies some predicate. See also U.Nrefined Constructs a  value at run-time, calling 0 if the value does not satisfy the predicate.Orefined Constructs a  value at run-time, calling 0 if the value does not satisfy the predicate.Prefined Constructs a  value at run-time, calling  0 if the value does not satisfy the predicate.QrefinedLike L, but, when the value doesn't satisfy the predicate, returns a ; value with the predicate negated, instead of returning  .$isRight (refineEither @Even @Int 42)True#isLeft (refineEither @Even @Int 43)TrueRrefined Constructs a  value at compile-time using -XTemplateHaskell. For example: 2$$(refineTH 23) :: Refined Positive Int Refined 23&Here's an example of an invalid value: $$(refineTH 0) :: Refined Positive Int :6:4: Value is not greater than 0 In the Template Haskell splice $$(refineTH 0) In the expression: $$(refineTH 0) :: Refined Positive Int In an equation for @it@: it = $$(refineTH 0) :: Refined Positive IntThe example above indicates a compile-time failure, which means that the checking was done at compile-time, thus introducing a zero-runtime overhead compared to a plain value construction.Note4: It may be useful to use this function with the  6https://hackage.haskell.org/package/th-lift-instances/th-lift-instances package.SrefinedLike R, but immediately unrefines the value. This is useful when some value need only be refined at compile-time.TrefinedExtracts the refined value.UrefinedReify a J, by turning it into a value-level predicate.VrefinedThis function helps type inference. It is equivalent to the following: instance Weaken (And l r) l WrefinedThis function helps type inference. It is equivalent to the following: instance Weaken (And l r) r XrefinedThis function helps type inference. It is equivalent to the following: instance Weaken l (Or l r) YrefinedThis function helps type inference. It is equivalent to the following: instance Weaken r (Or l r) Zrefined5Strengthen a refinement by composing it with another.refinedpretty-print an , contains a hack to work differently whether or not you are "inGhc", i.e. inside of refineTH/refineTH_ (because GHC messes with the indentation)[refined Display a   as 7This function can be extremely useful for debugging  s , especially deeply nested ones. Consider:  myRefinement = refine @(And (Not (LessThan 5)) (Xor (DivisibleBy 10) (And (EqualTo 4) (EqualTo 3) ) ) ) @Int 3 This function will show the following tree structure, recursively breaking down every issue:  And (Not (LessThan 5)) (Xor (EqualTo 4) (And (EqualTo 4) (EqualTo 3))) JJJ The predicate (Not (LessThan 5)) does not hold. JJJ Xor (DivisibleBy 10) (And (EqualTo 4) (EqualTo 3)) JJJ The predicate (DivisibleBy 10) failed with the message: Value is not divisible by 10 JJJ And (EqualTo 4) (EqualTo 3) JJJ The predicate (EqualTo 4) failed with the message: Value does not equal 4 Note: Equivalent to  @ \refinedA handler for a  .\* is useful for defining what behaviour K1 should have in the event of a predicate failure.Typically the first argument passed to this function will be the result of applying  to the first argument of K.]refinedA handler for a  .]* is useful for defining what behaviour K should have in the event of a predicate failure with a specific exception.^refinedAn implementation of K that always succeeds.Examples  data ContainsLetterE = ContainsLetterE instance Predicate ContainsLetterE  where validate p t |   (== 'e') t = ^ | otherwise = Just $ throwRefineException2 (typeRep p) "Text doesn't contain letter 'e'". refined%Helper function for sized predicates._refined`refinedarefinedbrefinedcrefineddrefinederefinedfrefinedgrefinedhrefined Encode a   for use with Control.Exception.Note: Equivalent to [.irefinedNote: Equivalent to [.jrefinedkrefinedlrefinedmrefinednrefinedorefinedprefinedqrefinedrrefinedsrefinedtrefinedurefinedvrefinedwrefinedxrefinedyrefinedzrefined{refined|refined}refined~refinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefined1This instance makes sure to check the refinement.refinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefined\refinedThe  of the J%. This can usually be given by using .refinedA    Void6 encoding a custom error message to be pretty-printed.]refinedThe  of the J%. This can usually be given by using .refinedA custom exception.refined predicaterefined (value, type)refinedlength of valuerefined:(compare :: Length -> KnownNat -> Bool, comparison string)  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^LMNOPQRSTJKUFGDECAB@>?HI2301./,-*+$%()&' !"#<=:;896745VWXYZ [\]^@2C309  Safe-Inferred0Drefined Constructs a  value at run-time, calling 0 if the value does not satisfy the predicate.$WARNING: this function is not total!refined Constructs a  value, completely ignoring any refinements! Use this only when you can manually prove that the refinement holds.refinedA coercion between a type and any refinement of that type. See Data.Type.Coercion) for functions manipulating coercions.refinedA coercion between two  types, magicking up the claim that one predicate is entirely equivalent to another.refined Reveal that x and  p x are  for all x and p simultaneously.Example reallyUnsafePredEquiv :: Coercion (Refined p x) (Refined q x) reallyUnsafePredEquiv = reallyUnsafeAllUnderlyingRefined Coercion  !"#$%&&''(())**++,,--..//0011223344556677889::;<<==>>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"refined-0.8-9TA3woZhXpDB2B45J5vFIARefined.Unsafe.TypeRefinedRefined.UnsafeControl.Monad.CatchthrowMControl.Monad.FailfailControl.Monad.Error throwError Data.TextanyPPDoc$fLiftBoxedRepRefined $fEqRefined $fOrdRefined$fHashableRefined$fNFDataRefined $fShowRefined$fFoldableRefinedRefineExceptionRefineNotExceptionRefineAndExceptionRefineOrExceptionRefineXorExceptionRefineSomeExceptionRefineOtherExceptionWeakenweakenNonEmptyEmptyNonZero ZeroToOne NonNegativeNegative NonPositivePositiveEvenInfiniteNaNOdd DivisibleByNegativeFromTo NotEqualToEqualToFromToToFrom GreaterThanLessThan Descending Ascending SizeEqualToSizeGreaterThan SizeLessThanXor||Or&&AndNotIdPred Predicatevalidaterefinerefine_ refineThrow refineFail refineError refineEitherrefineTH refineTH_unrefinereifyPredicateandLeftandRightleftOrrightOr strengthendisplayRefineExceptionthrowRefineOtherExceptionthrowRefineSomeExceptionsuccess$fWeakenTYPETYPEFromToTo$fWeakenTYPETYPEFromToFrom$fWeakenTYPETYPEFromToFromTo$fWeakenTYPETYPEFromFrom$fWeakenTYPETYPEGreaterThanFrom&$fWeakenTYPETYPEGreaterThanGreaterThan$fWeakenTYPETYPEToTo$fWeakenTYPETYPELessThanTo $fWeakenTYPETYPELessThanLessThan$fExceptionRefineException$fShowRefineException$fPredicateTYPEEvenx$fPredicateTYPEInfinitex$fPredicateTYPENaNx$fPredicateTYPEOddx$fPredicateTYPEDivisibleByx$fPredicateTYPENegativeFromTox$fPredicateTYPENotEqualTox$fPredicateTYPEEqualTox$fPredicateTYPEFromTox$fPredicateTYPETox$fPredicateTYPEFromx$fPredicateTYPEGreaterThanx$fPredicateTYPELessThanx$fPredicateTYPEDescendingt$fPredicateTYPEAscendingt$$fPredicateTYPESizeEqualToByteString%$fPredicateTYPESizeEqualToByteString0$fPredicateTYPESizeEqualToText$fPredicateTYPESizeEqualTot($fPredicateTYPESizeGreaterThanByteString)$fPredicateTYPESizeGreaterThanByteString0"$fPredicateTYPESizeGreaterThanText$fPredicateTYPESizeGreaterThant%$fPredicateTYPESizeLessThanByteString&$fPredicateTYPESizeLessThanByteString0$fPredicateTYPESizeLessThanText$fPredicateTYPESizeLessThant$fPredicateTYPEXorx$fPredicateTYPEOrx$fPredicateTYPEAndx$fPredicateTYPENotx$fPredicateTYPEIdPredx$fArbitraryRefined$fToJSONKeyRefined$fToJSONRefined$fFromJSONKeyRefined$fFromJSONRefined $fReadRefined$fGenericRefineException $fGenericEven$fGenericInfinite $fGenericNaN $fGenericOdd$fGenericDivisibleBy$fGenericNegativeFromTo$fGenericNotEqualTo$fGenericEqualTo$fGenericFromTo $fGenericTo $fGenericFrom$fGenericGreaterThan$fGenericLessThan$fGenericDescending$fGenericAscending$fGenericSizeEqualTo$fGenericSizeGreaterThan$fGenericSizeLessThan $fGenericXor$fGeneric1kXor $fGenericOr $fGeneric1kOr $fGenericAnd$fGeneric1kAnd $fGenericNot$fGeneric1kNot$fGenericIdPred unsafeRefinereallyUnsafeRefinereallyUnsafeUnderlyingRefinedreallyUnsafePredEquiv reallyUnsafeAllUnderlyingRefined ExceptionTree_RefineException_typeRepbase Data.TypeableTypeRep_RefineException_andChild)these-skinny-0.7.5-LG75UUK5JZzIP7Vfl0lqur Data.TheseTheseThisThat_RefineException_orLChild_RefineException_orRChild_RefineException_Exception_RefineException_message Data.FoldableFoldable GHC.MaybeMaybeOrdered|>.>incdecshowTreeGHC.BaseStringGHC.ShowshowtypeRep text-1.2.5.0Data.Text.InternalTextsizedRep_RefineExceptionRep_Even Rep_InfiniteRep_NaNRep_OddRep_DivisibleByRep_NegativeFromToRep_NotEqualTo Rep_EqualTo Rep_FromToRep_ToRep_FromRep_GreaterThan Rep_LessThanRep_Descending Rep_AscendingRep_SizeEqualToRep_SizeGreaterThanRep_SizeLessThanRep_XorRep1_XorRep_OrRep1_OrRep_AndRep1_AndRep_NotRep1_Not Rep_IdPredGHC.Errerrorghc-prim GHC.Types Coercible