3      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                   ! " # $ % & ' ( ) * + , - . / 0 1 2 Safe>?@Constrained Foldable for a specified type instead for all types.Safe->?FTConvert something v into rg using handlers. This class is required in order to step through all the different types in a variant.Safe,-FST)Zips up xs and ys, which must be the same length The typelist xs replaced by ys at the indices ns. ns and ys must be the same length. ns must be within bounds of xs The type x replaced by an y if an n matches i.  The typelist zs with the first xs replaced by ys. xs must be the same size as ys  The typelist xs with the first x replaced by y. It is okay for x not to exist in xs  The typelist xs without the type at Nat n replaced by y. n must be within bounds of xs  The typelist xs without the type at Nat n. n must be within bounds of xs )Ensures two typelists are the same lengthLabelled access into the listIndexed access into the listEnsures that the label in tagged label v only ever appears once in xs. Ensures that x only ever appears once in xsEEnsures that the type list contain unique types. Not implemented as  (xs ~ Nub xs) for better type error messages.&Errors if a label exists in a typelist%Errors if a type exists in a typelistSearches for y in ys if not found, than use y, and repeat search with next (y ': ys) in ctx else if found, then don't use y, then repeat search with next (y ': ys) in ctx)Get the first index of a type from a listBGet the first position of a type (indexed by 1) Will return 0 if x doesn't exists in xs.  Safe +,-<FST^$-9Tests if all the types in a typelist satisfy a constraint'Return a list of results from applying  to every type in the xs typelist.The result from evaluating a Case with a type from a typelist.XTakes two lists which must be the same length and returns a list of corresponding pairs.!Returns the typelist without the ! type Returns a xs appended with ys-Set complement. Returns the set of things in xs that are not in ys.)Ensures two typelists are the same length" Get the first type in a typelist#Get the typelist without the " type$0Returns the typelist from (and including) index n. If n is larger then the xs% size, then an empty '[] is returned.%0Returns the typelist after (and exluding) index n. If n is larger then the xs% size, then an empty '[] is returned.&1Returns the typelist up to (and including) index n. If n is larger then the xs size, then the original xs is returned.'1Returns the typelist before (and exluding) index n. If n is larger then the xs size, then the original xs is returned.()Returns the typelist after and including x. If x. doesn't exist, then an empty '[] is returned.))Returns the typelist after and excluding x. If x. doesn't exist, then an empty '[] is returned.*)Returns the typelist up to and including x. If x" doesn't exist, then the original xs is returned.+)Returns the typelist up to and excluding x. If x" doesn't exist, then the original xs is returned., The typelist xs replaced by ys at the indices ns. ns and ys must be the same length. ns must be within bounds of xs- The typelist xs without the type at Nat n replaced by y. n must be within bounds of xs. The typelist xs without the type at Nat n. n must be within bounds of xs/ The typelist zs with the first xs replaced by ys. xs must be the same size as ys0 The typelist xs with the first x replaced by y. It is okay for x not to exist in xs1 The typelist xs without first x. It is okay for x not to exist in xs2Get the types with labels ls from xs3!Get the types at an list of index4\It's actually ok for the position to be zero, but if it's not zero then the types must match5Get the type at a label6Get the type at an index7VGet the first index of a type (Indexed by 1) Will return 0 if x doesn't exists in xs.8aGet the first index of a type (Indexed by 0) Will result in type error if x doesn't exist in xs.9Ensures that the label list all :s:Ensures that the label in tagged label v only ever appears once in xs.; Ensures that x only ever appears once in xs</Return the list of distinct types in a typelist=/Ensures that the type list contain unique types> Ensures x is a unique member in xs iff it exists in ys? For each y in ys, snocs them to end of xs if y doesn't already exist in xs@Snoc x to end of xs if x doesn't already exist in xsA Ensures that x is a member of xs at n if it exists, and that 3 can be used.B Ensures that x is a member of xs at n , and that 3 can be used.C Ensures that x is a unique member of xs if it exists, and that 3 can be used.D Ensures that x is a unique member of xs , and that 3 can be used.E Every x in xs is a `UniqueMember x ys`F Ensures that x is a unique member of xs , and that 3 can be used./ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF/FEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! Safe,->?FSTdGTAllows iterating over the types in a typelist, whilst also incrementing an Nat indexH&Return the next iteration without the " type x in (x ': xs)I-Allows iterating over the types in a typelistJ&Return the next iteration without the " type x in (x ': xs)GHIJIJGHGHIJSafe->?FSTVi]K8This class allows defining handlers that can handle the " type in the xs typelist. In conjunction with  @, you can define handlers that can handle all the types in the xs typelist.See Data.Diverse.CaseFunc and Data.Diverse.Cases.L3Return the handler/continuation when x is observed.KLKLKLSafe+-;<=>?FQSTVtMHThis handler stores a polymorphic function that doesn't change the type. let x = (5 :: Int)   (6 :: Int8)   (7 :: Int16)   (8 :: Int32)     y = (15 :: Int)   (16 :: Int8)   (17 :: Int16)   (18 :: Int32)      (M @4 (+10)) x `shouldBe` y OIThis handler stores a polymorphic function that returns a different type. let y =  (5 :: Int) ::  '[Int, Bool]  y (O @. (show . typeRep . (pure @Proxy))) `shouldBe` Int let x = (5 :: Int)   False   'X'   Just 'O'   (6 :: Int)   Just 'A'      (:) [] (  (O @p (show . typeRep . (pure @Proxy))) x) `shouldBe` ["Int", "Bool", "Char", "Maybe Char", "Int", "Maybe Char"] MNOPOPRQMNTSMNOPSafe>?vUGiven a 7 that transforms each type in the typelist, convert a f xs to f (CasesResult2 c xs)UVUVUV None&'+,-.;<=>?FGQSTVh5!U55P avoids the following: Illegal type synonym family application in instance: AnyW)A friendlier type constraint synomyn for X)A friendlier type constraint synomyn for Y)A friendlier type constraint synomyn for Z)A friendlier type constraint synomyn for [)A friendlier type constraint synomyn for 6For each type x in larger, generate the (k, v) in smaller (if it exists)\)A friendlier type constraint synomyn for ])A friendlier type constraint synomyn for  and ^A variation of ` which uses G instead of I_)A friendlier type constraint synomyn for  and `Collects the output from Ling each field in a f. Uses I to prepare the K to accept the next type in the xs typelist.@Internally, this holds the left-over [(k, v)] from the original f for the remaining typelist xs..That is, the first v in the (k, v) is of type x7, and the length of the list is equal to the length of xs.7A variation of ^ which uses 8 instead of K9 Variation of ` which uses 8 instead of K:3Return the handler/continuation when x is observed.b;Appends the unique fields fields from the right Many using ocmThis instance allows converting to and from Many There are instances for converting tuples of up to size 15.;8Many stored as a list. This is useful when folding over f= efficienty so that the conversion to List is only done oncefmA Many is an anonymous product type (also know as polymorphic record), with no limit on the number of fields.MThe following functions are available can be used to manipulate unique fields getter/setter for single field: y and ~#getter/setter for multiple fields:  and folds:  or These functions are type specified. This means labels are not required because the types themselves can be used to access the 'Many. It is a compile error to use those functions for duplicate fields.JFor duplicate fields, Nat-indexed versions of the functions are available: getter/setter for single field: | and #getter/setter for multiple fields:  and folds:  or uEncoding: The record is encoded as (S.Seq Any). This encoding should reasonabily efficient for any number of fields.gThe map Key is index + offset of the type in the typelist. The Offset is used to allow efficient cons l. (Key = Index of type in typelist + OffsetvThe constructor will guarantee the correct number and types of the elements. The constructor is only exported in the Data.Diverse.Many.Internal moduleh(Converts from a value (eg a tuple) to a f, via a < wrapperiBConverts from a Many to a value (eg a tuple), via a Tagged wrapperj Analogous to . Named j to avoid conflicting with .k0Create a Many from a single value. Analogous to =l1Add an element to the left of a Many. Not named cons to avoid conflict with mInfix version of l.)Mnemonic: Element on the left is smaller m than the larger f to the right.n1Add an element to the right of a Many Not named snoc to avoid conflict with  oJAdd an element to the right of a Many iff the field doesn't already exist.pInfix version of n.Mnemonic: Many is larger p than the smaller elementqInfix version of r. Mnemonic: l m with an extra slash (meaning f ) in front.rAppends two Manys togethersXSplit a non-empty Many into the first element, then the rest of the Many. Analogous to >tVSplit a non-empty Many into initial part of Many, and the last element. Analogous to ?uUExtract the first element of a Many, which guaranteed to be non-empty. Analogous to @v Extract the vD element of a Many, which guaranteed to be non-empty. Analogous to !w`Extract the elements after the front of a Many, which guaranteed to be non-empty. Analogous to Ax-Return all the elements of a Many except the v6 one, which guaranteed to be non-empty. Analogous to "y/Getter by unique type. Get the field with type x. let x = (5 :: Int) m False m 'X' m Just 'O' m j y @Int x `shouldBe` 5 z5Getter by label. Get the value of the field with tag label! which can be any type not just  KnownSymbol. let y = False m Tagged @Foo 'X' m Tagged @Hi True m j z# @Foo y `shouldBe` Tagged @Foo 'X' z @Hi y `shouldBe` Tagged @Hi True { Variation of z specialized for < that untags the field.|DGetter by index. Get the value of the field at index type-level Nat n let x = (5 :: Int) m False m 'X' m Just 'O' m j | @1 x `shouldBe` False }/Setter by unique type. Set the field with type x. let x = (5 :: Int) m False m 'X' m Just 'O' m j } @Int x 6 `shouldBe` (6 :: Int) m False m 'X' m Just 'O' m j ~;Polymorphic setter by unique type. Set the field with type x, and replace with type y let x = (5 :: Int) m False m 'X' m Just 'O' m j ~) @Int x (Just True) `shouldBe` Just True m False m 'X' m Just 'O' m j 1Setter by unique label. Set the field with label l. let y = (5 :: Int) m False m Tagged @Foo 'X' m Tagged @"Hello" (6 :: Int) m j 4 @Foo y (Tagged @Foo 'Y') `shouldBe` (5 :: Int) m False m Tagged @Foo 'Y' m Tagged @"Hello" (6 :: Int) m j : @"Hello" y (Tagged @"Hello" 7) `shouldBe` (5 :: Int) m False m Tagged @Foo 'X' m Tagged @"Hello" (7 :: Int) m j ;Polymorphic setter by unique type. Set the field with type x, and replace with type y let y = (5 :: Int) m False m Tagged @Foo 'X' m Tagged @"Hello" (6 :: Int) m j# replaceL @Foo y (Tagged @Bar 'Y') shouldBe (5 :: Int) m False m Tagged Bar Y m Tagged Hello (6 :: Int) m jG replaceL @"Hello" y (Tagged @"Hello" False) `shouldBe` (5 :: Int) m False m Tagged @Foo 'X' m Tagged @"Hello" False m j  Variation of  specialized to <2 that automatically tags the value to be replaced. Variation of  specialized to <2 that automatically tags the value to be replaced.DSetter by index. Set the value of the field at index type-level Nat n let x = (5 :: Int) m False m 'X' m Just 'O' m j  @0 x 7 shouldBe Polymorphic version of B3Internal function for construction - do not expose! Folds any f%, even with indistinct types. Given distinct handlers for the fields in f , create < of the results of running the handlers over the fields in f. let x = (5 :: Int) m False m 'X' m Just 'O' m (6 :: Int) m Just 'A' m j y = show @Int m show @Char m show @(Maybe Char) m show @Bool m j  (:) [] ( ( #I y) x) `shouldBe` ["5", "False", "'X'", "Just 'O'", "6", "Just 'A'"] This is flip  let x = (5 :: Int) m False m 'X' m Just 'O' m (6 :: Int) m Just 'A' m j y = show @Int m show @Char m show @(Maybe Char) m show @Bool m j  (:) [] ( x ( #G y)) `shouldBe` ["5", "False", "'X'", "Just 'O'", "6", "Just 'A'"]  Folds any f%, even with indistinct types. Given index handlers for the fields in f , create < of the results of running the handlers over the fields in f. let x = (5 :: Int) m False m 'X' m Just 'O' m (6 :: Int) m Just 'A' m j y = show @Int m show @Bool m show @Char m show @(Maybe Char) m show @Int m show @(Maybe Char) m j  (:) [] ( ( $I y) x) `shouldBe` ["5", "False", "'X'", "Just 'O'", "6", "Just 'A'"] This is flip  let x = (5 :: Int) m False m 'X' m Just 'O' m (6 :: Int) m Just 'A' m j y = show @Int m show @Bool m show @Char m show @(Maybe Char) m show @Int m show @(Maybe Char) m j  (:) [] ( x ( $G y)) `shouldBe` ["5", "False", "'X'", "Just 'O'", "6", "Just 'A'"]  Construct a fB with a smaller number of fields than the original. Analogous to y getter but for multiple fields.8This can also be used to reorder fields in the original f. let x = (5 :: Int) m False m 'X' m Just 'O' m (6 :: Int) m Just 'A' m j # @'[Bool, Char] x `shouldBe` False m 'X' m j A variation of  which selects by labels let x = False m Tagged @"Hi" (5 :: Int) m Tagged @Foo False m Tagged @Bar 'X' m Tagged @"Bye" O m j - @'[Foo, Bar] x `shouldBe` Tagged @Foo False m Tagged @Bar 'X' m j 6 @'["Hi", "Bye"] x `shouldBe` Tagged @"Hi" (5 :: Int) m Tagged @"Bye" 'O' m j A variation of  which uses a Nat list n, to specify how to reorder the fields, where  indices[branch_idx] = tree_idx@ This variation allows smaller or larger: to contain indistinct since the mapping is specified by indicies. let x = (5 :: Int) m False m 'X' m Just 'O' m (6 :: Int) m Just 'A' m j # @'[5, 4, 0] x `shouldBe` Just 'A' m (6 :: Int) m (5 ::Int) m j Sets the subset of f in the larger f. Analogous to ~ setter but for multiple fields. let x = (5 :: Int) m False m 'X' m Just 'O' m j # @'[Int, Maybe Char] x ((6 :: Int) m Just 'P' m j) `shouldBe` (6 :: Int) m False m 'X' m Just 'P' m j A variation of  which amends via labels. let x = False . Tagged @"Hi" (5 :: Int) . Tagged @Foo False . Tagged @Bar 'X' . Tagged @"Bye" 'O' ./ j # @'[Foo, Bar] x (Tagged @Foo True . Tagged @Bar 'Y' . nil) shouldBe False . Tagged @"Hi" (5 :: Int) . Tagged @Foo True . Tagged @Bar 'Y' . Tagged @"Bye" 'O' ./ j - @'["Hi", "Bye"] x (Tagged @"Hi" (6 :: Int) . Tagged @"Bye" 'P' . nil) shouldBe False . Tagged @"Hi" (6 :: Int) . Tagged @Foo False . Tagged @Bar 'X' . Tagged @"Bye" 'P' ./ j Polymorphic version of . Analogous to ~ setter but for multiple fields.A variation of  which amends via labels. let x = False m Tagged @"Hi" (5 :: Int) m Tagged @Foo False m Tagged @Bar X m Tagged @"Bye" 'O' m j  @'[Foo, Bar] x ('Y' m True m nil) `shouldBe` False m Tagged @"Hi" (5 :: Int) m 'Y' m True m Tagged @"Bye" 'O' m j  @'["Hi", "Bye"] x (True m Tagged @"Changed" True m j) `shouldBe` False m True m Tagged @Foo False m Tagged @Bar 'X' m Tagged @"Changed" True m j A variation of  which uses a Nat list n, to specify how to reorder the fields, where  indices[branch_idx] = tree_idx@ This variation allows smaller or larger: to contain indistinct since the mapping is specified by indicies. let x = (5 :: Int) m False m 'X' m Just 'O' m (6 :: Int) m Just 'A' m j  @'[5, 4, 0] x (Just 'B' m (8 :: Int) m (4 ::Int) m j) `shouldBe` (4 :: Int) m False m 'X' m Just 'O' m (8 :: Int) m Just 'B' m j A polymorphic variation of A C instance encoded as the u value D with the w f. The E and F metadata are not encoded.A terminating C instance encoded as a j.  read "5 . False . X . Just O . nil" == (5 :: Int) m False m 'X' m Just 'O' m j show (5 :: Int) m False m 'X' m Just 'O' m j == "5 . False . X . Just O . nil" ==Two fs are ordered by Ging their fields in index orderTwo f%s are equal if all their fields equalGiven a 7 that transforms each type in the typelist, convert a Many xs to Many (CaseResults c xs)Recursive AFunctor instance for non empty type list delegate afmap'ing the remainder to an instance of Collector' with one less type in the type list1Terminating AFunctor instance for empty type list-This single field instance is the reason for <0 wrapper. Otherwise this instance will overlap.8These instances add about 7 seconds to the compile time! nill case that doesn't even use :, so that an instance of  CaseAny '[] is not needed. nill case that doesn't even use caseAnyN, so that an instance of  CaseAnyN '[] is not needed.Folds values by Jing Ks through the xs typelist. nill case that doesn't even use L, so that an instance of Case '[] is not needed.Folds values by Jing Emitters through the xs typelist. nill case that doesn't even use L, so that an instance of Case '[] is not needed.for each x in smaller1, convert it to a (k, v) to insert into the x in largerfor each x in smaller1, convert it to a (k, v) to insert into the x in largerfor each y in smaller1, convert it to a (k, v) to insert into the x in  Many largerfor each x in smaller1, convert it to a (k, v) to insert into the x in  Many largerFor each type x in larger?, find the index in ys, and create an (incrementing key, value)JFor each type x in larger, find the index in ys, and create a (key, value);WXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~;fgcdeihjklmnoprabqstuvwxyz{|~}\[YZWX_`]^5HIJKLMNOPQR6S^T`U7V9W8:abcde;XYfgb5l5m5n5o5p5q5r5 None8i:WXYZ[\]^_`abcdefhijklmnopqrstuvwxyz{|}~:fcdeihjklmnoprabqstuvwxyz{|~}\[YZWX_`]^ None+-;<=>?FSTVh\A variation of  which uses | to get the handler by index. There may be different handlers for the same type, but the handlers must be in the same order as the input xs typelist. Use # to construct this safely ensuring n starts at 0. Contains a f4 of handlers/continuations for all the types in the xs typelist. This uses y/ to get the unique handler for the type at the " of xs.Use  to construct this with , constraint to reduce programming confusion.Create an instance of K for either handling ing a Which. let y =  (5 :: Int) ::  '[Int, Bool]  y (  (show @Bool m show @Int m nul)) `shouldBe` "5" Or for handling  from a f. let x = (5 :: Int) m False m 'X' m Just 'O' m (6 :: Int) m Just 'A' m nul y = show @Int m show @Char m show @(Maybe Char) m show @Bool m nul  (:) [] ( x ($ y)) `shouldBe` ["5", "False", "X ", "Just 'O'", "6", "Just 'A'"] !This function imposes additional  SameLength! constraints than when using the 5 constructor directly. It is better practice to use @ to prevent programming confusion with dead code. However, the A constructor is still exported to allow creating a master-of-all-K.A variation of  without the  SameLength. constraint to allow creating a master-of-all-K.Safe Constructor for  ensuring that the n( Nat starts at 0. It is an instance of CaseN for either handling %ing a Which in index order. let y = &6 @0 Proxy (5 :: Int) :: Which '[Int, Bool, Bool, Int] % y (  (show @Int m show @Bool m show @Bool m show @Int m nul)) `shouldBe` "5" Or for handling  from a f. let x = (5 :: Int) m False m 'X' m Just 'O' m (6 :: Int) m Just 'A' m nul y = show @Int m show @Bool m show @Char m show @(Maybe Char) m show @Int m show @(Maybe Char) m nul  (:) [] ( x ($ y)) `shouldBe` ["5", "False", "X ", "Just 'O'", "6", "Just 'A'"] A variation of  without the  SameLength. constraint to allow creating a master-of-all-K.UndecidableInstances because fs appers more often.UndecidableInstances because fs appears more often.Z[ None&'+,-;<=>?AFGQSTVch@\bDo not export constructor Stores the right Any to be compared when the correct type is discovered]bDo not export constructor Stores the right Any to be compared when the correct type is discoveredA switch/case statement for . This is equivalent to flip  Use K instances like  ' to apply a 5 of functions to a variant of values in index order. let y =  @0 (5 :: Int) ::  '[Int, Bool, Bool, Int]  y (  $ (show @Int   show @Bool   show @Bool   show @Int    )) `shouldBe` "5" +Or you may use your own custom instance of K. is a variation of  which H!s through the possibilities in a , delegating work to CaseN, ensuring termination when  only contains one type.$A friendlier constraint synonym for  reinterpretN. is an instance of  for which J!s through the possibilities in a , delegating handling to K, ensuring termination when  only contains one type.$A friendlier constraint synonym for  reinterpretN.$A friendlier constraint synonym for .A variation of  that exposes 'branchlessTree ~ Complement tree branch$A friendlier constraint synonym for .$A friendlier constraint synonym for .A variation of  that exposes 'branchlessTree ~ Complement tree branch$A friendlier constraint synonym for .$A friendlier constraint synonym for .$A friendlier constraint synonym for .$A friendlier constraint synonym for .A  is an anonymous sum type (also known as a polymorphic variant, or co-record) which can only contain one of the types in the typelist. This is essentially a typed version of ().\The following functions are available can be used to manipulate unique types in the typelist constructor:  destructor:  injection:  and catamorphism:   or  ~These functions are type specified. This means labels are not required because the types themselves can be used to access the E. It is a compile error to use those functions for duplicate fields.fFor duplicate types in the list of possible types, Nat-indexed version of the functions are available: constructor:  destructor:  inejction:  and  reinterpretNcatamorphism:   or {Encoding: The variant contains a value whose type is at the given position in the type list. This is the same encoding as  Rhttps://github.com/haskus/haskus-utils/blob/master/src/lib/Haskus/Utils/Variant.hsHaskus.Util.Variant and  Rhttps://hackage.haskell.org/package/HList-0.4.1.0/docs/src/Data-HList-Variant.htmlData.Hlist.Variant.(The constructor is only exported in the Data.Diverse.Which.Internal module Analogous to *+ . Renamed  to avoid conflicts.Since 'Which '[]' values logically don't exist, this witnesses the logical reasoning tool of "ex falso quodlibet", ie "from falsehood, anything follows".A 'Which '[]' is a , with no alternatives, which may occur as a ^ -over from ing a  Which '[x]6 with one type. It is an uninhabited type, just like *,Lift a value into a  of possibly other types xs. xsT can be inferred or specified with TypeApplications. NB. forall is used to specify xs3 first, so TypeApplications can be used to specify xs first T 'A' @_ @'[Int, Bool, Char, Maybe String] :: Which '[Int, Bool, Char, Maybe String] A variation of  where x is specified via a label let y = T @Foo (Tagged (5 :: Int)) :: Which '[Bool, Tagged Foo Int, Tagged Bar Char] x =  @Foo y x shouldBe (Right (Tagged 5))  Variation of  specialized to <# that automatically tags the value.A variation of  into a  of a single type.  'A' :: Which '[Char] A variation of  into a  where x is the first type. ! 'A' :: Which '[Char, Int, Bool] Lift a value into a H of possibly other (possibley indistinct) types, where the value is the n -th type. < @4 (5 :: Int) :: Which '[Bool, Int, Char, Bool, Int, Char] It is  what value is inside a  of one type. let x = pick' 'A' :: Which '[Char]  x `shouldBe` 'A'  the n-th type of a  , and get _ the ` value or the ^-over possibilities. let x = - 'A' @_ @'[Int, Bool, Char, Maybe String] :: " '[Int, Bool, Char, Maybe String]  @1 x `shouldBe` Left ( 'A') ::  '[Int, Char, Maybe String]  a type in a  and _ get the ` value or the ^-over possibilities. let x = * 'A' @'[Int, Bool, Char, Maybe String] :: " '[Int, Bool, Char, Maybe String]  @Char x `shouldBe` Right 'A'  @Int x `shouldBe` Left ( 'A') ::  '[Bool, Char, Maybe String] A variation of ! where x is specified via a label let y = T @Foo (Tagged (5 :: Int)) :: Which '[Bool, Tagged Foo Int, Tagged Bar Char] x =  @Foo Proxy y x shouldBe (Right (Tagged 5))  Variation of  specialized to < which untags the field. Variation of  which returns a Maybe Variation of  which returns a Maybe Variation of  which returns a Maybe Variation of  specialized to < which untags the field.A variation of a   which "s the first type in the type list. let x = * 'A' @'[Int, Bool, Char, Maybe String] :: " '[Int, Bool, Char, Maybe String]  x `shouldBe` Left ( 'A') ::  '[Bool, Char, Maybe String]  Variation of  which returns a Maybe Convert a  to another 1 that may include other possibilities. That is, branch is equal or is a subset of tree.AThis can also be used to rearrange the order of the types in the .It is a compile error if tree has duplicate types with branch.NB. Use TypeApplications with  _ to specify tree@. let a = pick' (5 :: Int) ::  '[Int] b =  @_ @[Int, Bool] a ::  '[Int, Bool] c =  @_ @[Bool, Int] b ::  '[Bool, Int] A simple version of 5 which add another type to the front of the typelist.A restricted version of  which only rearranges the typesA variation of  where branch+is additionally specified by a labels list. let y =  (5 :: Tagged Bar Int) y' =  @'[Bar] y :: . '[Tagged Bar Int, Tagged Foo Bool] y'' =  @'[Bar, Foo] y' :: $ '[Tagged Foo Bool, Tagged Bar Int]   y'' (O @A (show . typeRep . (pure @Proxy))) `shouldBe` "Tagged * Bar Int" A variation of  which uses a Nat list indices, to specify how to reorder the fields, where indices[branch_idx] = tree_idx This variation allows tree! to contain duplicate types with branch$ since the mapping is specified by indicies. let y =  (5 :: Int) y' = # @'[0] @_ @[Int, Bool] y y'' =  @[1,0] @_ @[Bool, Int] y'   y'' (O @4 (show . typeRep . (pure @Proxy))) `shouldBe` "Int"  Convert a  into possibly another 6 with a totally different typelist. Returns either a  with the ` value, or a  with the ^over  compliment types.It is a compile error if branch or  compliment has duplicate types with tree.NB. forall used to specify branch3 first, so TypeApplications can be used to specify branch first.  let a = " @[Int, Char, Bool] (5 :: Int) :: ! '[Int, Char, Bool] let b =  ([String, Char] y b `shouldBe` Left ( (5 :: Int)) ::  '[Int, Bool] let c =  ([String, Int] a c `shouldBe` Right ( (5 :: Int)) ::  '[String, Int]  Variation of  which returns a Maybe.A variation of  where the branch. is additionally specified with a labels list. let y = d @[Tagged Bar Int, Tagged Foo Bool, Tagged Hi Char, Tagged Bye Bool] (5 :: Tagged Bar Int) y' =  @[Foo, Bar] y x = P @[Tagged Foo Bool, Tagged Bar Int] (5 :: Tagged Bar Int) y' `shouldBe` Right x  Variation of  which returns a Maybe. A limited variation of  which uses a Nat list n, to specify how to reorder the fields, where indices[branch_idx] = tree_idx This variation allows tree! to contain duplicate types with branch$ since the mapping is specified by indicies.However, unlike  reinterpert, in this variation, branch must be a subset of treeL instead of any arbitrary Which. Also it returns a Maybe instead of Either.This is so that the same indices can be used in narrowN. A switch/case statement for . This is equivalent to flip  Use K instances like  - to apply a % of functions to a variant of values. let y =  (5 :: Int) ::  '[Int, Bool]  y (  # (show @Bool   show @Int    )) `shouldBe` "5" Or O @2 to apply a polymorphic function that work on all Typeables. let y =  (5 :: Int) ::  '[Int, Bool]  y (O @. (show . typeRep . (pure @Proxy))) `shouldBe` Int +Or you may use your own custom instance of K. Catamorphism for  . This is flip  . Catamorphism for . This is equivalent to flip .rReading a 'Which '[]' value is always a parse error, considering 'Which '[]' as a data type with no constructors. (G zilch zilch) == EQ (zilch == zilch ) == TrueA C instance encoded as either the x value (a ) or the ed remaining 'Which xs'. The E and F metadata are not encoded.A terminating C$ instance for one type encoded with pick'. The E and F metadata are not encoded.A terminating C$ instance for no types encoded as a zilch. The E and F metadata are not encoded.The Unique x branch1 is important to get a compile error if the from branch doesn't have a unique x!Allow 'Which '[]' to be ed or ,ed into anything else This is safe because  Which '[]F is uninhabited, and this is already something that can be done with ":Terminating case of the loop, ensuring that a instance of Case '[]) with an empty typelist is not required.# each type in a , and either handle the L with value discovered, or J( trying the next type in the type list.$:Terminating case of the loop, ensuring that a instance of Case '[]< with an empty typelist is not required. You can't reduce zilch% each type in a , and either handle the L with value discovered, or H( trying the next type in the type list.)Two Tes are only equal iff they both contain the equivalnet value at the same type index.,A 9 with a type at smaller type index is considered smaller./ show (pick' 'A') == "pick 'A'"0This bb instance tries to read using the each type in the typelist, using the first successful type read.2    3    cdefgh\i]jklmnopqrstNone1    2    None !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPUVWXYZ[\]^_`abcdefhijklmnopqrstuvwxyz{|}~    u./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu vwxxyyz{|}~                  ' - # $  %                        &                    ! "  # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I JKLMKNO P Q R S T U VWXYZ[\Z[]Z[^K_`K_a bKcdKceKcfKcghij P k k l l m m n n o o Q   R T V p ' - q rKstKsuKsvKcwKxy z z { | } } q r ~ ~        *data-diverse-2.0.1.0-yHFShBn2NdHHfPimlpqbUData.Diverse.AFoldableData.Diverse.ReduceData.Diverse.TypeLevel.InternalData.Diverse.TypeLevelData.Diverse.ReiterateData.Diverse.CaseData.Diverse.CaseFuncData.Diverse.AFunctorData.Diverse.Many.InternalData.Diverse.CasesData.Diverse.Which.Internal ReiterateData.Diverse.Many./nilafmapData.Diverse.WhichpickWhichswitch Data.TypeableTypeablenulafoldrforMany Data.DiverseCasePreludenull Control.LensconssnoclastinitcasescasesNswitchNpickNCasesNDataDynamic Data.VoidabsurdVoidCases AFoldableafoldl'ReducereduceReducedZipImplReplacesIndexImplReplaceIfIndex ReplacesImpl ReplaceImplReplaceIndexImplRemoveIndexImplSameLengthImplKindAtLabelImplKindAtIndexImplUniqueLabelImpl UniqueImplIsDistinctImplIsUniqueLabelImpl IsUniqueImplNubImpl IndexOfImplPositionOfImplAllConstrained CaseResults CaseResultZipInitAppend Complement SameLengthLengthLastHeadTail FromIndex AfterIndexToIndex BeforeIndexFromAfterToBefore ReplacesIndex ReplaceIndex RemoveIndexReplacesReplaceRemove KindsAtLabelsKindsAtIndicesKindAtPositionIs KindAtLabel KindAtIndex PositionOfIndexOf UniqueLabels UniqueLabelUniqueNub IsDistinctUniqueIfExists AppendUnique SnocUnique MaybeMemberAtMemberAtMaybeUniqueMemberUniqueLabelMember UniqueMembers UniqueMember ReiterateN reiterateN reiteratecase' CaseFunc'CaseFunc$fCaseCaseFunc:$fReiterateCaseFuncxs$fCaseCaseFunc':$fReiterateCaseFunc'xsAFunctorAmendNAmendN'AmendAmend'SelectNSelectCollectN CollectorNCollect CollectorCanAppendUniqueappend'IsManytoManyfromManyManytoMany' fromMany'singleprefixpostfixpostfix'\././appendviewfviewbfrontbackaftforefetchfetchLfetchTagfetchNreplace'replace replaceL'replaceL replaceTag' replaceTag replaceN'replaceNcollectforManyNcollectNselectselectLselectNamend'amendL'amendamendLamendN'amendN $fNFDataMany $fNFDataMany0 $fGenericMany$fGenericMany0 $fReadMany $fReadMany_ $fReadMany_0 $fShowMany $fShowMany_ $fShowMany_0 $fMonoidMany $fMonoidMany_$fMonoidMany_0$fSemigroupMany$fSemigroupMany_$fSemigroupMany_0 $fOrdMany $fOrdMany_ $fOrdMany_0$fEqMany $fEqMany_ $fEqMany_0$fAFunctorManycas$fAFunctorMany_c:$fAFunctorMany_c[]#$fIsManyTYPETagged:(,,,,,,,,,,,,,,)"$fIsManyTYPETagged:(,,,,,,,,,,,,,)!$fIsManyTYPETagged:(,,,,,,,,,,,,) $fIsManyTYPETagged:(,,,,,,,,,,,)$fIsManyTYPETagged:(,,,,,,,,,,)$fIsManyTYPETagged:(,,,,,,,,,)$fIsManyTYPETagged:(,,,,,,,,)$fIsManyTYPETagged:(,,,,,,,)$fIsManyTYPETagged:(,,,,,,)$fIsManyTYPETagged:(,,,,,)$fIsManyTYPETagged:(,,,,)$fIsManyTYPETagged:(,,,)$fIsManyTYPETagged:(,,)$fIsManyTYPETagged:(,)$fIsManyTYPETagged:a$fIsManyTYPETagged[]()$fCanAppendUniquexs:$fCanAppendUniquexs[]$fAFoldableCollectorAnyr$fAFoldableCollectorAnyr0$fAFoldableCollectorAnyNr$fAFoldableCollectorAnyNr0$fAFoldableCollectorr$fAFoldableCollectorr0$fAFoldableCollectorNr$fAFoldableCollectorNr0$fReiterateCaseSelect:$fReiterateNCaseSelectNn:$fReiterateCaseAmend':$fReiterateCaseAmend:$fReiterateNCaseAmendN'n:$fReiterateNCaseAmendNn:$fCaseAnyCaseAmendN:$fCaseAnyCaseAmendN':$fCaseAnyCaseAmend:$fCaseAnyCaseAmend':$fCaseAnyCaseSelectN:$fCaseAnyCaseSelect:cases'casesN' $fCaseCasesxs$fReiterateCasesxs$fCaseCasesNxs$fReiterateNCasesNnxsSwitchN SwitcherNSwitchSwitcher ReinterpretN' ReinterpretL'ReinterpretedL ReinterpretL Reinterpret' Reinterpreted Reinterpret DiversifyN DiversifyL Diversify impossiblepickLpickTagpickOnlypick0obvioustrialNtrialtrialLtrialTagtrialN'trial'trialL' trialTag'trial0trial0' diversify diversify0 diversify' diversifyL diversifyN reinterpret reinterpret' reinterpretL reinterpretL' reinterpretN'whichwhichN $fNFDataWhich $fReadWhich $fShowWhich $fOrdWhich $fEqWhich$fSemigroupWhich$fGenericWhich$fGenericWhich0$fGenericWhich1$fCaseCaseDiversify:$fReiterateCaseDiversifybranch'$fCaseCaseDiversifyN:"$fReiterateNCaseDiversifyNnbranch'$fCaseCaseReinterpret:$fReiterateCaseReinterprettree'$fCaseCaseReinterpret': $fReiterateCaseReinterpret'tree'$fCaseCaseReinterpretN':#$fReiterateNCaseReinterpretN'ntree'$fNFDataWhich0$fReduceWhichSwitcher$fReduceWhichSwitcher0$fReduceWhichSwitcher1$fReduceWhichSwitcherN$fReduceWhichSwitcherN0$fSwitchN[]Whichcrnxs$fCaseCaseEqWhich:$fReiterateCaseEqWhich: $fEqWhich0$fCaseCaseOrdWhich:$fReiterateCaseOrdWhich: $fOrdWhich0$fCaseCaseShowWhich:$fReiterateCaseShowWhich: $fShowWhich0 $fReadWhich0$fWhichReadWhich_$fWhichReadWhich_0base GHC.TypeLitsnatValGHC.NumNum WrappedAny CaseSelect CollectorAnyNCaseAny CollectorAnycaseAnyMany_#tagged-0.8.5-8i4yEdVmPnc52Vc955f6BG Data.TaggedTaggedcontainers-0.5.10.2Data.Sequence.Internal singletonviewlviewrGHC.Listheadtail fromList' GHC.GenericsGeneric:*:C1S1ghc-prim GHC.Classescompare CaseAmendN CaseAmendN' CaseAmend CaseAmend' CaseSelectNrunMany_ CaseOrdWhich CaseEqWhich Data.EitherLeftEitherRight:+:GHC.ReadReadWhich_ WhichRead whichReadPrec CaseShowWhichCaseReinterpretN'CaseReinterpret'CaseReinterpretCaseDiversifyN CaseDiversify