!Z      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~None6;IM refined/A refinement type, which wraps a value of type x.refinedrefinedrefinedrefinedrefinedrefinedrefinedNone.7=>?@AFHIUVWX_k-refinedEA Tree which is a bit easier to pretty-print TODO: get rid of thisrefined)An exception encoding the way in which a I failed. refinedA  for failures involving the E predicate. refinedA  for failures involving the C predicate. refinedA  for failures involving the @ predicate. refinedA  for failures involving the = predicate. refinedA C for failures involving all other predicates with custom exception.refinedA - for failures involving all other predicates.refinedThe  of the E p type.refinedA " encoding which branch(es) of the C 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.refined\A typeclass containing "safe" conversions between refined predicates where the target is weakeru than the source: that is, all values that satisfy the first predicate will be guaranteed to satisy the second.jTake care: writing an instance declaration for your custom predicates is the same as an assertion that  is safe to use:  instance  Pred1 Pred2 fFor most of the instances, explicit type annotations for the result value's type might be required.refinedrefinedA I% ensuring that the type is non-empty.refinedA I% ensuring that the type is non-empty.refinedA I. ensuring that the value is not equal to zero.refined.An inclusive range of values from zero to one.refinedA I: ensuring that the value is greater than or equal to zero.refinedA I+ ensuring that the value is less than zero.refinedA I7 ensuring that the value is less than or equal to zero.refinedA I. ensuring that the value is greater than zero.refinedA I! ensuring that the value is even.isRight (refine @Even @Int 32)TrueisLeft (refine @Even @Int 33)TruerefinedrefinedA I? 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 I6 ensuring that the value is IEEE "not-a-number" (NaN).#isRight (refine @NaN @Double (0/0))True!isLeft (refine @NaN @Double 13.9)TruerefinedrefinedA I ensuring that the value is odd.isRight (refine @Odd @Int 33)TrueisLeft (refine @Odd @Int 32)True refined!refinedA I) ensuring that the value is divisible by n.)isRight (refine @(DivisibleBy 3) @Int 12)True(isLeft (refine @(DivisibleBy 2) @Int 37)True"refined#refinedA Is 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 IL 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 IH 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 I6 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 IU 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 IX 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.refined/refinedA IL 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)True0refined1refinedA II 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)True2refined3refinedA I 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])True4refined5refinedA I 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])True6refined7refinedA IY 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")True8refined9refinedA I] 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 IZ 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.@refined"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)TrueArefinedBrefined"The conjunction of two predicates.Crefined"The conjunction of two predicates./isLeft (refine @(And Positive Negative) @Int 3)True-isRight (refine @(And Positive Odd) @Int 203)TrueDrefinedErefinedThe negation of a predicate.*isRight (refine @(Not NonEmpty) @[Int] [])True,isLeft (refine @(Not NonEmpty) @[Int] [1,2])TrueFrefinedGrefinedEA predicate which is satisfied for all types. Arguments passed to J in J G x are not evaluated.'isRight (refine @IdPred @Int undefined)True&isLeft (refine @IdPred @Int undefined)FalseHrefinedIrefinedPA typeclass which defines a runtime interpretation of a type-level predicate p for type x.JrefinedCheck the value x according to the predicate p, producing an error " if the value does not satisfy.Note: J 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 D 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: docKrefinedA smart constructor of a - value. Checks the input value at runtime.LrefinedLike K, but discards the refinement. This _can_ be useful when you only need to validate that some value at runtime satisfies some predicate. See also S.Mrefined Constructs a  value at run-time, calling 0 if the value does not satisfy the predicate.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 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 <interactive>: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.QrefinedLike Pq, but immediately unrefines the value. This is useful when some value need only be refined at compile-time.RrefinedExtracts the refined value.SrefinedReify a I, by turning it into a value-level predicate.TrefinedIThis function helps type inference. It is equivalent to the following: instance Weaken (And l r) l UrefinedIThis function helps type inference. It is equivalent to the following: instance Weaken (And l r) r VrefinedIThis function helps type inference. It is equivalent to the following: instance Weaken l (Or l r) WrefinedIThis function helps type inference. It is equivalent to the following: instance Weaken r (Or l r) Xrefined5Strengthen 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)Yrefined 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))) %%% The predicate (Not (LessThan 5)) does not hold. %%% Xor (DivisibleBy 10) (And (EqualTo 4) (EqualTo 3)) %%% The predicate (DivisibleBy 10) failed with the message: Value is not divisible by 10 %%% And (EqualTo 4) (EqualTo 3) %%% The predicate (EqualTo 4) failed with the message: Value does not equal 4 Note: Equivalent to  @ZrefinedA handler for a .Z* is useful for defining what behaviour J1 should have in the event of a predicate failure.WTypically the first argument passed to this function will be the result of applying  to the first argument of J.[refinedA handler for a .[* is useful for defining what behaviour JN should have in the event of a predicate failure with a specific exception.\refinedAn implementation of J that always succeeds.Examples O data ContainsLetterE = ContainsLetterE instance Predicate ContainsLetterE & where validate _ t = do if   ( 'e') t then  else \ refined%Helper function for sized predicates.]refined^refined_refined`refinedarefinedbrefinedcrefineddrefinederefinedfrefined Encode a  for use with Control.Exception.Note: Equivalent to Y.grefinedNote: Equivalent to Y.hrefinedirefinedjrefinedkrefinedlrefinedmrefinednrefinedorefinedprefinedqrefinedrrefinedsrefinedtrefinedurefinedvrefinedwrefinedxrefinedyrefinedzrefined{refined|refined}refined~refinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefined1This instance makes sure to check the refinement.refinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedrefinedZrefinedThe  of the I%. This can usually be given by using .refinedA    Void6 encoding a custom error message to be pretty-printed.[refinedThe  of the I%. This can usually be given by using .refinedA custom exception.refined predicaterefined (value, type)refinedlength of valuerefined:(compare :: Length -> KnownNat -> Bool, comparison string)V   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\VKLMNOPQRIJSEFCDB@A?=>GH12/0-.+,)*#$'(%& !";<9:785634TUVWX  YZ[\?2B309 NoneSXq&refined 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 z value, completely ignoring any refinements! Use this only when you can manually prove that the refinement holds.refinedBA coercion between a type and any refinement of that type. See Data.Type.Coercion) for functions manipulating coercions.refinedA coercion between two W 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    !"##$$%%&&''(())**++,,--..//001122334455677899::;;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"refined-0.6-3zUanIaJhj9BfXTdmLZNr8Refined.Unsafe.TypeRefinedRefined.UnsafeControl.Monad.CatchthrowMControl.Monad.Error throwError Data.TextanyPPDoc $fLiftRefined $fEqRefined $fOrdRefined$fNFDataRefined $fShowRefined$fFoldableRefinedRefineExceptionRefineNotExceptionRefineAndExceptionRefineOrExceptionRefineXorExceptionRefineSomeExceptionRefineOtherExceptionWeakenweakenNonEmptyEmptyNonZero ZeroToOne NonNegativeNegative NonPositivePositiveEvenInfiniteNaNOdd DivisibleByNegativeFromTo NotEqualToEqualToFromToToFrom GreaterThanLessThan Descending Ascending SizeEqualToSizeGreaterThan SizeLessThanXor||Or&&AndNotIdPred Predicatevalidaterefinerefine_ refineThrow refineFail refineErrorrefineTH refineTH_unrefinereifyPredicateandLeftandRightleftOrrightOr strengthendisplayRefineExceptionthrowRefineOtherExceptionthrowRefineSomeExceptionsuccess$fWeakenFromToTo$fWeakenFromToFrom$fWeakenFromToFromTo$fWeakenFromFrom$fWeakenGreaterThanFrom$fWeakenGreaterThanGreaterThan $fWeakenToTo$fWeakenLessThanTo$fWeakenLessThanLessThan$fExceptionRefineException$fShowRefineException$fPredicateEvenx$fPredicateInfinitex$fPredicateNaNx$fPredicateOddx$fPredicateDivisibleByx$fPredicateNegativeFromTox$fPredicateNotEqualTox$fPredicateEqualTox$fPredicateFromTox$fPredicateTox$fPredicateFromx$fPredicateGreaterThanx$fPredicateLessThanx$fPredicateDescendingt$fPredicateAscendingt $fPredicateSizeEqualToByteString!$fPredicateSizeEqualToByteString0$fPredicateSizeEqualToText$fPredicateSizeEqualTot$$fPredicateSizeGreaterThanByteString%$fPredicateSizeGreaterThanByteString0$fPredicateSizeGreaterThanText$fPredicateSizeGreaterThant!$fPredicateSizeLessThanByteString"$fPredicateSizeLessThanByteString0$fPredicateSizeLessThanText$fPredicateSizeLessThant$fPredicateXorx$fPredicateOrx$fPredicateAndx$fPredicateNotx$fPredicateIdPredx$fArbitraryRefined$fToJSONRefined$fFromJSONRefined $fReadRefined$fGenericIdPred $fGenericNot $fGeneric1Not $fGenericAnd $fGeneric1And $fGenericOr $fGeneric1Or $fGenericXor $fGeneric1Xor$fGenericSizeLessThan$fGenericSizeGreaterThan$fGenericSizeEqualTo$fGenericAscending$fGenericDescending$fGenericLessThan$fGenericGreaterThan $fGenericFrom $fGenericTo$fGenericFromTo$fGenericEqualTo$fGenericNotEqualTo$fGenericNegativeFromTo$fGenericDivisibleBy $fGenericOdd $fGenericNaN$fGenericInfinite $fGenericEven$fGenericRefineException unsafeRefinereallyUnsafeRefinereallyUnsafeUnderlyingRefinedreallyUnsafePredEquiv reallyUnsafeAllUnderlyingRefined ExceptionTree_RefineException_typeRepbase Data.TypeableTypeRep_RefineException_andChild)these-skinny-0.7.4-KKhgIdFe9I8GolJEDfFTGo Data.TheseTheseThisThat_RefineException_orLChild_RefineException_orRChild_RefineException_Exception_RefineException_message Data.FoldableFoldable GHC.MaybeMaybeOrdered|>.>incdecControl.Monad.FailfailshowTreeGHC.BaseStringGHC.ShowshowtypeRep text-1.2.3.1Data.Text.InternalTextghc-prim GHC.Classes==Nothingsized Rep_IdPredRep_NotRep1_NotRep_AndRep1_AndRep_OrRep1_OrRep_XorRep1_XorRep_SizeLessThanRep_SizeGreaterThanRep_SizeEqualTo Rep_AscendingRep_Descending Rep_LessThanRep_GreaterThanRep_FromRep_To Rep_FromTo Rep_EqualToRep_NotEqualToRep_NegativeFromToRep_DivisibleByRep_OddRep_NaN Rep_InfiniteRep_EvenRep_RefineExceptionGHC.Errerror GHC.Types Coercible