h*$"+      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr s t u v 0.7.1  Safe-Inferred )1=>(wxyz{|}~ Safe-Inferred )1=>i Safe-Inferred )1=> Safe-Inferred )1=> Safe-Inferred )1=> strongweakTrack multiple levels of weakening. Silly thought I had, don't think it's useful. strongweakGet either the strong or weak representation of a type, depending on the type-level "switch" provided.6This is intended to be used in data types that take a 7 type. Define your type using strong fields wrapped in SW s. You then get the weak representation for free, using the same definition. data A (s :: Strength) = A { a1 :: SW s Word8 , a2 :: String }  strongweak,Strength enumeration: is it strong, or weak?:Primarily interesting at the type level (using DataKinds). strongweak Weaken some a, relaxing certain invariants.See  Strongweak! for class design notes and laws.  strongweak The weakened type for some type.  strongweak Weaken some a to its associated weak type  a.  strongweakLift a function on a weak type to the associated strong type by weakening first.  strongweak%Decomposer. Weaken either side of an .  strongweak,Decomposer. Weaken both elements of a tuple. strongweak+Decomposer. Weaken every element in a list. strongweakStrip wrapper. strongweakStrip wrapper. strongweak&Weaken sized vectors into plain lists. strongweak(Weaken non-empty lists into plain lists. strongweak&Strip refined functor type refinement. strongweakStrip refined type refinement.     Safe-Inferred )1=>#  strongweakUnsafely transform a  a to an a, without asserting invariants.Naturally, you must only even consider using this if you have a guarantee that your value is safe to treat as strong..For example, you may unsafely strengthen some    n into a ? by unsafely coercing the value, ignoring the possibility that n >= 255.What happens if it turns out you're lying to the computer and your weak value doesn't fit in its strong counterpart? That depends on the strengthen.)Numeric coercions should safely overflow.Some will raise an error (e.g. ).0/ strongweak+A failure encountered during strengthening.1 strongweakDetail on strengthen failure.We use a list here for the cases where you want multiple lines of detail. Separating with a newline would make prettifying later harder, so we delay.2 strongweakIndexed.3 strongweakAttempt to strengthen some   a, asserting certain invariants.We take  as a superclass in order to maintain strong/weak type pair consistency. We choose this dependency direction because we treat the strong type as the "canonical" one, so  is the more natural (and straightforward) class to define. That does mean the instances for this class are a little confusingly worded. Alas.See  Strongweak! for class design notes and laws.4 strongweakAttempt to strengthen some   a" to its associated strong type a.6 strongweak0Weaken a strong value, then strengthen it again.0Potentially useful if you have previously used 4 and now wish to check the invariants. For example:7restrengthen $ unsafeStrengthen @(Vector 2 Natural) [0] Failure ...9 strongweak)Strengthen one numeric type into another.n must be "wider" than m. m and  n* are for error printing. We're forced to  n because linear-text-builder can't print unbounded integrals. PR: 2https://github.com/Bodigrim/linear-builder/pull/20: strongweak)Decomposer. Strengthen either side of an .; strongweak0Decomposer. Strengthen both elements of a tuple.< strongweak/Decomposer. Strengthen every element in a list.E strongweak Add wrapper.F strongweak Add wrapper.G strongweakStrengthen a plain list into a sized vector by asserting length.H strongweakStrengthen a plain list into a non-empty list by asserting non-emptiness.I strongweak:Strengthen a type by refining it with a functor predicate.J strongweak2Strengthen a type by refining it with a predicate. 34659/01287 34659/01287  Safe-Inferred")1=>O strongweak/Generic strengthening at the constructor level.S strongweak3Generic strengthening at the constructor sum level.U strongweak,Generic strengthening at the datatype level.W strongweakStrengthen a value generically."The weak and strong types must be  compatible. See 6 for the definition of compatibility in this context.Y strongweak?Strengthen sum types by casing and strengthening left or right.Z strongweak"Nothing to do for empty datatypes.[ strongweakStrengthen a generic data type, replacing its metadata wrapping.] strongweakSpecial case: data type and constructor names are equivalent: simplify^ strongweakSpecial case: if source and target types are equivalent, just replace meta.Note that we have to expand the metadata awkwardly for the overlapping instances to work correctly. (There should be a better way to write this, but it's purely style, so light TODO.)_ strongweak%Nothing to do for empty constructors.` strongweak4Enter a constructor, stripping its metadata wrapper.e strongweak=Special case: both types had a record name, and they're equalf strongweak&Strengthen a field using the existing 3 instance.g strongweak9Strengthen product types by strengthening left and right. LMNOPQRSTUVWX WUVSTQROPMNXL Safe-Inferred )1=>  34   34  Safe-Inferred )1=>j strongweakWeaken a value generically."The weak and strong types must be  compatible. See 6 for the definition of compatibility in this context.k strongweak7Weaken sum types by casing and weakening left or right.l strongweak1Weaken product types by weakening left and right.m strongweak"Weaken a field using the existing  instance.n strongweakSpecial case: if source and target types are equal, copy the value through.o strongweak%Nothing to do for empty constructors.p strongweak"Nothing to do for empty datatypes.q strongweakStrip all meta.hijjhi  Safe-Inferred )1=>"r strongweak DerivingVia" wrapper for strongweak instances. We can't use  conveniently because we need to talk about two data types, not one -- we would have to do something like  (Tagged w s), which is ugly. So we instead define our own adorable little "via type" here! Use like so: data XYZ (s :: Strength) = XYZ { xyz1 :: SW s Word8 , xyz2 :: Word8 , xyz3 :: () } deriving stock Generic deriving via (GenericallySW (XYZ 'Strong) (XYZ 'Weak)) instance Weaken (XYZ 'Strong) deriving via (GenericallySW (XYZ 'Strong) (XYZ 'Weak)) instance Strengthen (XYZ 'Strong) TODO can't figure out a way around multiple standalone deriving declarations :(TODO maybe GenericallySW1? but even so instances differ between weaken and strengthen (weaken needs nothing) so it's kinda better this way. :)jWrstjWrst !"#$%&'()*+,-./0123456789:;<=>>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~             strongweak-0.7.1-inplaceStrongweak.Util.TextStrongweak.Util.TypeNatsStrongweak.Util.TypeableStrongweak.WeakenStrongweak.Strengthen.UnsafeStrongweak.StrengthenStrongweak.Strengthen.GenericStrongweak.Weaken.GenericStrongweak.Generic strongweakPaths_strongweakNumeric.NaturalNaturalunsafeStrengthen StrongweakGenerictshownatVal''typeRep'SWDepthSWStrengthStrongWeakWeakenweaken liftWeakF$fWeakenEither $fWeaken(,) $fWeakenList $fWeakenInt64 $fWeakenInt32 $fWeakenInt16 $fWeakenInt8$fWeakenWord64$fWeakenWord32$fWeakenWord16 $fWeakenWord8 $fWeakenConst$fWeakenIdentity$fWeakenVector$fWeakenNonEmpty$fWeakenRefined1$fWeakenRefinedUnsafeStrengthen$fUnsafeStrengthenEither$fUnsafeStrengthen(,)$fUnsafeStrengthenList$fUnsafeStrengthenInt64$fUnsafeStrengthenInt32$fUnsafeStrengthenInt16$fUnsafeStrengthenInt8$fUnsafeStrengthenWord64$fUnsafeStrengthenWord32$fUnsafeStrengthenWord16$fUnsafeStrengthenWord8$fUnsafeStrengthenConst$fUnsafeStrengthenIdentity$fUnsafeStrengthenVector$fUnsafeStrengthenNonEmpty$fUnsafeStrengthenRefinedStrengthenFailurestrengthenFailDetailstrengthenFailInner Strengthen strengthenResult restrengthenfailStrengthenfailStrengthen1strengthenBounded$fStrengthenEither$fStrengthen(,)$fStrengthenList$fStrengthenInt64$fStrengthenInt32$fStrengthenInt16$fStrengthenInt8$fStrengthenWord64$fStrengthenWord32$fStrengthenWord16$fStrengthenWord8$fStrengthenConst$fStrengthenIdentity$fStrengthenVector$fStrengthenNonEmpty$fStrengthenRefined1$fStrengthenRefined$fShowStrengthenFailure ProdArity ReifySelector reifySelector GStrengthenS gstrengthenS ReifyCstrs reifyCstrs GStrengthenC gstrengthenC GStrengthenD gstrengthenDstrengthenGeneric.>$fGStrengthenCkwdnsdn:+::+:$fGStrengthenCkwdnsdnV1V1$fGStrengthenDkM1M1$fReifyCstrsldlcrdrc$fReifyCstrsdcdc$fGStrengthenSkiM1M1$fGStrengthenSkiU1U1$fGStrengthenCkwcdscdM1M1$fReifySelectoriNothingJust$fReifySelectoriJustNothing$fReifySelectoriNothingNothing$fReifySelectoriJustJust$fReifySelectoriJustJust0$fGStrengthenSkiM1M10$fGStrengthenSki:*::*:GWeakengweaken weakenGeneric$fGWeakenk:+::+:$fGWeakenk:*::*:$fGWeakenkK1K1$fGWeakenkK1K10$fGWeakenkU1U1$fGWeakenkV1V1$fGWeakenkM1M1 GenericallySWunGenericallySW$fStrengthenGenericallySW$fWeakenGenericallySWversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDirgetDataFileName getSysconfDirbase Data.EitherEitherGHC.WordWord8GHC.BaseNonEmptyGHC.Bits FiniteBitsGHC.ShowShow GHC.Generics Generically