"ֳ      !"#$%&'()*+,-./ 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ 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 [ \ ] ^ _ ` 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 { | } ~  Safe+,DQR  The typelist xs without the type at Nat n. n must be within bounds of xs)Ensures two typelists are the same lengthIndexed access into the list Ensures that x only ever appears once in xs/Ensures that the type list contain unique types%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 *+,:DQR !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 last type in a typelist Get the first type in a typelistGet the typelist without the  typeGets the ength of a typelist The typelist xs without the type at Nat n. n must be within bounds of xs The typelist xs without x. It is okay for x not to exist in xs!Get the types at an list of index\It's actually ok for the position to be zero, but if it's not zero then the types must matchGet the type at an indexVGet the first index of a type (Indexed by 1) Will return 0 if x doesn't exists in xs.aGet the first index of a type (Indexed by 0) Will result in type error if x doesn't exist 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 Ensures that x is a member of xs at n if it exists, and that  can be used. Ensures that x is a member of xs at n , and that  can be used. Ensures that x is a unique member of xs if it exists, and that  can be used. Ensures that x is a unique member of xs , and that  can be used.    Safe+,<=DQR TAllows iterating over the types in a typelist, whilst also incrementing an Nat index!&Return the next iteration without the  type x in (x ': xs)"-Allows iterating over the types in a typelist#&Return the next iteration without the  type x in (x ': xs) !"# !"#"# ! !"#Safe,<=D$Reduce a polymorphic variant v xs into rg using handlers. This class is required in order to step through all the different types in a variant.$%$%$%$%Safe,&{This is used for the Generic D1 metadata. NB. package id is obtained by running `stack exec ghc-pkg describe data-diverse`&&&&Safe+,<=D''@ can generate a value, and is differentiated with an additional xs typelist'('('('(Safe,<=DQR)8This 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.CaseTypeable and Data.Diverse.Cases.*3Return the handler/continuation when x is observed.)*)*)*)*Safe ,9:;<=DOT+=This handler stores a polymorphic function for all Typeables. let y =  (5 :: Int) ::  '[Int, Bool]  y (+. (show . typeRep . (pure @Proxy))) `shouldBe` Int let x = (5 :: Int)  False  'X'  Just 'O'  (6 :: Int)  Just 'A'     (:) [] ( (+p (show . typeRep . (pure @Proxy))) x) `shouldBe` ["Int", "Bool", "Char", "Maybe Char", "Int", "Maybe Char"] +,-.+,+,.-+,-. Safe<=/@Constrained Foldable for a specified type instead for all types./01/01/01/01 Safe +,9:;<=DQR 2A variation of 6 which !s the xsH typelist. Undecidable instances! But this is safe since it's a wrapper4A variation of 8 which !s the xs- typelist. This version guarantees that the Emit (e n) '[]S is not instantiated. Undecidable instances! But this is safe since it's a wrapper6A variation of 8 which does require the  Emit e '[]_ instance for the empty typelist. Undecidable instances! But this is safe since it's a wrapper8Folds output from an 'ter of values while #ing the xs% typelist. This guarantees that the  Emit e '[]S is not instantiated. Undecidable instances! But this is safe since it's a wrapper:Folds values by !ing 'ters through the xs typelist.;terminating case that does use Emit (e n) '[]<Folds values by !ing 'ters through the xs typelist.= null case that doesn't even use (, so that an instance of Emit (e n) '[] is not needed.>Folds values by #ing 'ters through the xs typelist.?terminating case that does use  Emit e '[]@Folds values by #ing 'ters through the xs typelist.A null case that doesn't even use (, so that an instance of  Emit e '[] is not needed.23456789:;<=>?@A2345678989A@67?>45=<23;: 23456789:;<=>?@A None%&*+,-9:;<=DEIOQRTfCP avoids the following: Illegal type synonym family application in instance: AnyGInternally uses [Any] like Via, except also handle the empty type list.fStores the left & right Many and a list of Any which must be the same length and types in xs typelist.fStores the left & right Many and a list of Any which must be the same length and types in xs typelist.B)A friendlier type constraint synomyn for pC)A friendlier type constraint synomyn for nD)A friendlier type constraint synomyn for mFor each type x in larger, generate the (k, v) in smaller (if it exists)E)A friendlier type constraint synomyn for kFA variation of G which ! instead.GWraps a ) into an instance of ', #ing and feeding ) with the value from the K and (ting the results.@Internally, this holds the left-over [(k, v)] from the original K 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.HmThis instance allows converting to and from Many There are instances for converting tuples of up to size 15.KmA 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: ] and `#getter/setter for multiple fields: k and nfolds: f or gThese 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 b#getter/setter for multiple fields: m and pfolds: i or jEncoding: The record is encoded as (Offset, Map Int 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 S. (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 moduleM(Converts from a value (eg a tuple) to a K, via a  wrapperNBConverts from a Many to a value (eg a tuple), via a Tagged wrapperO _Many = iso fromMany toManyP _Many' = iso fromMany' toMany'6When appending two maps together, get the function to  the RightMap when adding RightMap into LeftMap. The existing contents of LeftMap will not be changed. LeftMap Offset will also not change. The desired key for element from the RightMap = RightIndex (of the element) + LeftOffset + LeftSize OldRightKey = RightIndex + RightOffset, therefore RightIndex = OldRightKey - RightOffset So we need to adjust the existing index on the RightMap by OldRightKey -> RightIndex + LeftOffset + LeftSize (as above) OldRightKey -> OldRightKey - RightOffset + LeftOffset + LeftSizeWhen appending two maps together, get the function to modify the RightMap's offset when adding LeftMap into RightMap. The existing contents of RightMap will not be changed. NewRightOffset = OldRightOffset - LeftSize6When appending two maps together, get the function to  the LeftMap when adding LeftMap into RightMap. The existing contents of RightMap will not be changed. The RightMap's offset will be adjusted using  rightOffsetWithRightMapUnchangedj The desired key for the elements in the the LeftMap = LeftIndex (of the element) + NewRightOffset OldLeftKey = LeftIndex + LeftOffset, therefore LeftIndex = OldLeftKey - LeftOffset So we need to adjust the existing index on the LeftMap by OldLeftKey -> LeftIndex + NewRightOffset (as above) OldLeftKey -> OldLeftKey - LeftOffset + NewRightOffset (as above)Q Analogous to . Named Q to avoid conflicting with .R0Create a Many from a single value. Analogous to S1Add an element to the left of a Many. Not named cons to avoid conflict with TInfix version of S.)Mnemonic: Element on the left is smaller T than the larger K to the right.U1Add an element to the right of a Many Not named  to avoid conflict with V mnemonic: Many is larger V than the smaller elementWX mnemonic:  T with an extra slash (meaning K ) in front.XAppends two Manys togetherYUExtract the first element of a Many, which guaranteed to be non-empty. Analogous to Z Extract the ZD element of a Many, which guaranteed to be non-empty. Analogous to [`Extract the elements after the front of a Many, which guaranteed to be non-empty. Analogous to \-Return all the elements of a Many except the Z6 one, which guaranteed to be non-empty. Analogous to ]/Getter by unique type. Get the field with type x. let x = (5 :: Int) T False T 'X' T Just 'O' T Q ] @Int x `shouldBe` 5 ^infix version of ]3, with a extra proxy to carry the destination type.5Mnemonic: Like 'Control.Lens.(^.)' but with an extra . in front. let x = (5 :: Int) T False T 'X' T Just 'O' T Q x ^ (Proxy @Int) `shouldBe` 5 _DGetter by index. Get the value of the field at index type-level Nat n getchN (Proxy @2) t`/Setter by unique type. Set the field with type x. let x = (5 :: Int) T False T 'X' T Just 'O' T Q ` @Int x 6 `shouldBe` (6 :: Int) T False T 'X' T Just 'O' T Q ainfix version of `AMnemonic: Like a back to front 'Control.Lens.(.~)' with an extra . in front. let x = (5 :: Int) T False T 'X' T Just 'O' T Q (x a# (6 :: Int)) `shouldBe` (6 :: Int) T False T 'X' T Just 'O' T Q bDSetter by index. Set the value of the field at index type-level Nat n let x = (5 :: Int) T False T 'X' T Just 'O' T Q b @0 Proxy x 7 shouldBe c] ( c) and ` ( c) in  form. let x = (5 :: Int) T False T 'X' T Just 'O' T Q x  c @Int `shouldBe` 5 (x  c" @Int .~ 6) `shouldBe` (6 :: Int) T False T 'X' T Just 'O' T Q d_ ( c) and b ( c) in  form. let x = (5 :: Int) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' ./ nul x  d (Proxy @0) `shouldBe` 5 (x  d (Proxy @0)  6) `shouldBe` (6 :: Int) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q 3Internal function for construction - do not expose!e Creates an GS safely, so that the invariant of "typelist to the value list type and size" holds.f Folds any K%, even with indistinct types. Given distinct handlers for the fields in K , create a 8< of the results of running the handlers over the fields in K.The 8 is / to combine the results. let x = (5 :: Int) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q y = show @Int T show @Char T show @(Maybe Char) T show @Bool T Q 0 (:) [] (f ( I y) x) `shouldBe` ["5", "False", "'X'", "Just 'O'", "6", "Just 'A'"] gThis is flip f let x = (5 :: Int) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q y = show @Int T show @Char T show @(Maybe Char) T show @Bool T Q 0 (:) [] (g x ( G y)) `shouldBe` ["5", "False", "'X'", "Just 'O'", "6", "Just 'A'"] h Creates an FS safely, so that the invariant of "typelist to the value list type and size" holds.i Folds any K%, even with indistinct types. Given index handlers for the fields in K , create a 4< of the results of running the handlers over the fields in K.The 4 is / to combine the results. let x = (5 :: Int) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q y = show @Int T show @Bool T show @Char T show @(Maybe Char) T show @Int T show @(Maybe Char) T Q 0 (:) [] (i ( I y) x) `shouldBe` ["5", "False", "'X'", "Just 'O'", "6", "Just 'A'"] jThis is flip i let x = (5 :: Int) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q y = show @Int T show @Bool T show @Char T show @(Maybe Char) T show @Int T show @(Maybe Char) T Q 0 (:) [] (j x ( G y)) `shouldBe` ["5", "False", "'X'", "Just 'O'", "6", "Just 'A'"] k Construct a KB with a smaller number of fields than the original. Analogous to ] getter but for multiple fields.8This can also be used to reorder fields in the original K. let x = (5 :: Int) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q k# @'[Bool, Char] x `shouldBe` False T 'X' T Q linfix version of k", with a extra proxy to carry the smaller type.5Mnemonic: Like 'Control.Lens.(^.)' but with an extra '\' (narrow to the right) in front. let x = (5 :: Int) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q x l) (Proxy @'[Bool, Char]) `shouldBe` False T 'X' T Q mA variation of k 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) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q m+ (Proxy @'[5, 4, 0]) x `shouldBe` Just 'A' T (6 :: Int) T (5 ::Int) T Q nSets the subset of K in the larger K. Analogous to ` setter but for multiple fields. let x = (5 :: Int) T False T 'X' T Just 'O' T Q n# @'[Int, Maybe Char] x ((6 :: Int) T Just 'P' T Q) `shouldBe` (6 :: Int) T False T 'X' T Just 'P' T Q oinfix version of n7. Mnemonic: Like 'Control.Lens.(.~)' but with an extra '\' (narrow to the right) in front.?Mnemonic: Like backwards 'Control.Lens.(^.)' but with an extra '\' (narrow to the right) in front. let x = (5 :: Int) T False T 'X' T Just 'O' T Q (x o (6 :: Int) T Just 'P' T Q) `shouldBe` (6 :: Int) T False T 'X' T Just 'P' T Q pA variation of n 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) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q p! (Proxy @'[5, 4, 0]) x (Just 'B' T (8 :: Int) T (4 ::Int) T Q) `shouldBe` (4 :: Int) T False T 'X' T Just 'O' T (8 :: Int) T Just 'B' T Q qk ( q) and n ( q) in  form. q =  k n let x = (5 :: Int) T False T 'X' T Just 'O' T Q x  (q, @'[Int, Maybe Char]) `shouldBe` (5 :: Int) T Just 'O' T Q (x  (q @'[Int, Maybe Char])  ((6 :: Int) T Just P T Q)) `shouldBe` (6 :: Int) T False T 'X' T Just 'P' T Q rm ( r) and p ( r) in  form. r =  m p let x = (5 :: Int) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q x  (r( @'[5, 4, 0] Proxy) `shouldBe` Just 'A' T (6 :: Int) T (5 ::Int) T Q (x  (r @'[5, 4, 0] Proxy)  (Just 'B' T (8 :: Int) T (4 ::Int) T! nul)) `shouldBe` (4 :: Int) T False T 'X' T Just 'O' T (8 :: Int) T Just 'B' T Q s  read "5 . False . X . Just O . nul" == (5 :: Int) T False T 'X' T Just 'O' T Qw  read "5 . False . X . Just O . nul" == (5 :: Int) T False T 'X' T Just 'O' T Q{Two Ks are ordered by ing their fields in index order~Two K%s are equal if all their fields equalfor 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  Many largerFor each type x in larger?, find the index in ys, and create an (incrementing key, value)XFor each type x in larger, find the index in ys, and create an (incrementing key, value)-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!A  instance encoded as the Y value  with the [ K. The  and  metadata are not encoded.+Inferred role is phantom which is incorrectA terminating  instance encoded as a Q.     BCDEFGHIJKL MNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr!"#$stuvwxyz{|}~1BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr1KLHIJNMOPQRSTUVXWYZ[\]^_`abcdEklDmCnoBpqrGefgFhijp     BCDEFGHIJKL MNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr!"#$stuvwxyz{|}~ Q5S5T5U5V5W5X5^8a1l8o1None0BCDEFGHIJKMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr0KHIJNMOPQRSTUVXWYZ[\]^_`abcdEklDmCnoBpqrGefgFhij None,9:;<=DQRTfA 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 K4 of handlers/continuations for all the types in the xs typelist. This uses ]/ to get the unique handler for the type at the  of xs.Use  to construct this with  ; constraint to reduce programming confusion. However, the A constructor is still exported to allow creating a master-of-all-).Create an instance of ) for either handling ing a Which. let y =  (5 :: Int) ::  '[Int, Bool]  y (  (show @Bool T show @Int T Q)) `shouldBe` "5" Or for handling g from a K. let x = (5 :: Int) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q y = show @Int T show @Char T show @(Maybe Char) T show @Bool T Q   (:) [] (g 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-).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 T show @Bool T show @Bool T show @Int T Q)) `shouldBe` "5" Or for handling j from a K. let x = (5 :: Int) T False T 'X' T Just 'O' T (6 :: Int) T Just 'A' T Q y = show @Int T show @Bool T show @Char T show @(Maybe Char) T show @Int T show @(Maybe Char) T Q   (:) [] (j x ($ y)) `shouldBe` ["5", "False", "X ", "Just 'O'", "6", "Just 'A'"] UndecidableInstances because fs appears more often.UndecidableInstances because fs appers more often. %% None%&*,9:;<=DEOQRTf1&&P avoids the following: Illegal type synonym family application in instance: Any'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 discovered is a variation of  which !!s through the possibilities in a , delegating work to CaseN, ensuring termination when  only contains one type. is an instance of $ for which #!s through the possibilities in a , delegating handling to ), ensuring termination when  only contains one type.$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 catamorphism:  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 moduleA 2 with no alternatives. You can't do anything with 6 except Eq, Read, and Show it. Using functions like  and  with  is a compile error.  is only useful as a ) -over from ing a  Which '[x] with one type.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 Q 'A' @'[Int, Bool, Char, Maybe String] :: Which '[Int, Bool, Char, Maybe String] 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. D (Proxy @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'  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 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]  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 Proxy x `shouldBe` Left ( 'A') ::  '[Int, Char, Maybe String] ,"Utility to convert Either to Maybe (- ) and  (. ) in / form.  = 0  (either (const Nothing) Just . ) let y = - ( @Int) (5 :: Int) :: # '[Bool, Int, Char, Bool, Char] --  x = . ( @Int) y --  x `shouldBe` (Just 5)  (- ) and  (. ) in / form.  p = 0 (# p) (either (const Nothing) Just .  p) let y = - ( (Proxy @4)) (5 :: Int) :: ( '[Bool, Int, Char, Bool, Int, Char] --  x = . ( (Proxy @4)) y --  x `shouldBe` (Just 5)  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. forall is used to tree> is ordered first, so TypeApplications can be used to specify tree first. 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 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. let y =  (5 :: Int) y' =  @[Int, Bool] y y'' =  @[Bool, Int] y'  y'' ("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] 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. (- ) and  (. ) in / form. let x =  (5 :: Int) ::  '[String, Int] y = - (% @_ @[Bool, Int, Char, String]) x -- ! y `shouldBe` pick (5 :: Int) :: % '[Bool, Int, Char, String] let y' = . ( @[String, Int]) y -- 0 y' `shouldBe` Just (pick (5 :: Int)) :: Maybe ( '[String, Int])  (- ) and  (. ) in / form. let x =  (5 :: Int) ::  '[String, Int] y = -< (injectN @[3, 1] @_ @[Bool, Int, Char, String] Proxy) x -- ! y `shouldBe` pick (5 :: Int) :: % '[Bool, Int, Char, String] let y' = . ($ @[3, 1] @[String, Int] Proxy) y --  reinterpertN' y' `shouldBe` Just ( (5 :: Int)) :: Maybe ( '[String, Int]) Catamorphism for . This is equivalent to flip .A switch/case statement for . This is equivalent to flip Use ) 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 "2 to apply a polymorphic function that work on all  Typeables. let y =  (5 :: Int) ::  '[Int, Bool]  y ( CaseTypeable. (show . typeRep . (pure @Proxy))) `shouldBe` Int +Or you may use your own custom instance of ).Catamorphism for . This is equivalent to flip .A switch/case statement for . This is equivalent to flip Use ) instances like  $ to apply a 5 of functions to a variant of values in index order. let y =  @0 Proxy (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 ). read "impossible" == This 1b instance tries to read using the each type in the typelist, using the first successful type read. read "impossible" ==  show (pick' 'A') == "pick 'A'" (  ) == EQA 9 with a type at smaller type index is considered smaller. ( ==  ) == TrueTwo Tes are only equal iff they both contain the equivalnet value at the same type index.:Terminating case of the loop, ensuring that a instance of Case '[]< with an empty typelist is not required. You can't reduce  each type in a , and either handle the * with value discovered, or ! trying the next type in the type list. This code will be efficiently compiled into a single case statement in GHC 8.2.1 See Jhttp://hsyl20.fr/home/posts/2016-12-12-control-flow-in-haskell-part-2.html:Terminating case of the loop, ensuring that a instance of Case '[]< with an empty typelist is not required. You can't reduce  each type in a , and either handle the * with value discovered, or # trying the next type in the type list. This code will be efficiently compiled into a single case statement in GHC 8.2.1 See Jhttp://hsyl20.fr/home/posts/2016-12-12-control-flow-in-haskell-part-2.htmlThe Unique x branch1 is important to get a compile error if the from branch doesn't have a unique xA  instance encoded as either the x value (2 ) or the ed remaining 'Which xs'. The  and  metadata are not encoded.A terminating $ instance for one type encoded with pick'. The  and  metadata are not encoded.A terminating $ instance for no types encoded as a . The  and  metadata are not encoded.S&34567'8(9:;<=>?@A,B G&34567'8(9:;<=>?@A,BNone%None  !"#$%'()*+,/0123456789BCDEFGHIJKMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrC&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO""PQ R  S T T U U V V W W X Y Z [ \ ] ^ _ ` a b c d e f g h i i j k l m  n o  p q r s t u v w x y z { | } ~   $ # #                                       !"!#!$!%  & &    ' ' ( ( ) )  d e * * + , , - - . . / / 0 1 2 3 $  4 5676869 : ;< => ? @ABC!D  E E F F 4 5 G G H H I I J J KL+data-diverse-0.1.0.0-15JNBdcTY3F9aOKAG5iNgeData.Diverse.Type.InternalData.Diverse.TypeData.Diverse.ReiterateData.Diverse.ReduceData.Diverse.PackageIdData.Diverse.EmitData.Diverse.CaseData.Diverse.CaseTypeableData.Diverse.AFoldableData.Diverse.CollectorData.Diverse.Many.InternalData.Diverse.CasesData.Diverse.Which.Internal ReiterateData.Diverse.WhichpickWhichswitchData.Diverse.Many./nulafoldrforManyPreludenulllastinitcasescasesNswitchNpickNDataDynamic CaseTypeableCasesCasesN Data.DiverseWithoutIndexImplSameLengthImplKindAtIndexImpl UniqueImplIsDistinctImpl MissingImpl DistinctImpl IndexOfImplPositionOfImplInitAppend Complement SameLengthLastHeadTailLength WithoutIndexWithoutKindsAtIndicesKindAtPositionIs KindAtIndex PositionOfIndexOfUniqueDistinct IsDistinctUniqueIfExists MaybeMemberAtMemberAtMaybeUniqueMember UniqueMember ReiterateN reiterateN reiterateReducereduce PackageIdEmitemitCasecase'$fCaseCaseTypeablexsr$fReiterateTYPECaseTypeablexs AFoldableafoldl' CollectorN0 CollectorN Collector0 Collector$fAFoldableCollectorN0r$fAFoldableCollectorN0r0$fAFoldableCollectorNr$fAFoldableCollectorNr0$fAFoldableCollector0r$fAFoldableCollector0r0$fAFoldableCollectorr$fAFoldableCollectorr0AmendNAmendNarrowNNarrowViaNViaIsManytoManyfromManyManytoMany' fromMany'_Many_Many'singleprefixpostfix\././appendfrontbackaftforefetch.^.fetchNreplace.~.replaceNitemitemNviacollectviaNforManyNcollectNnarrow\^.narrowNamend\~.amendNprojectprojectN $fReadMany$fEmitTYPEEmitReadMany:ReadPrec $fEmitTYPEEmitReadMany[]ReadPrec$fReiteratekEmitReadMany: $fShowMany$fEmitTYPEEmitShowMany:(->)$fEmitTYPEEmitShowMany[](->)$fReiteratekEmitShowMany: $fOrdMany$fEmitTYPEEmitOrdMany:Ordering$fReiteratekEmitOrdMany:$fEqMany$fEmitTYPEEmitEqMany:Bool$fReiteratekEmitEqMany:$fCaseCaseAmendN:(,)$fReiterateNkCaseAmendNn:$fCaseCaseAmend:(,)$fReiteratekCaseAmend:$fCaseCaseNarrowN:[]$fReiterateNkCaseNarrowNn:$fCaseCaseNarrow:[]$fReiteratekCaseNarrow:$fEmitTYPEViaN:r$fReiterateNkViaNn:$fEmitTYPEVia:r$fReiteratekVia:#$fIsManyTYPETagged:(,,,,,,,,,,,,,,)"$fIsManyTYPETagged:(,,,,,,,,,,,,,)!$fIsManyTYPETagged:(,,,,,,,,,,,,) $fIsManyTYPETagged:(,,,,,,,,,,,)$fIsManyTYPETagged:(,,,,,,,,,,)$fIsManyTYPETagged:(,,,,,,,,,)$fIsManyTYPETagged:(,,,,,,,,)$fIsManyTYPETagged:(,,,,,,,)$fIsManyTYPETagged:(,,,,,,)$fIsManyTYPETagged:(,,,,,)$fIsManyTYPETagged:(,,,,)$fIsManyTYPETagged:(,,,)$fIsManyTYPETagged:(,,)$fIsManyTYPETagged:(,)$fIsManyTYPETagged:a$fIsManyTYPETagged[]() $fGenericMany$fGenericMany0$fEqKey$fOrdKey $fShowKey$fCaseCasesNxsr$fReiterateNTYPECasesNnxs$fCaseCasesxsr$fReiterateTYPECasesxsSwitchNSwitch ReinterpretN Reinterpret DiversifyN Diversify impossiblepickOnlypick0obvioustrialtrial0trialNfacetfacetN diversify diversify0 diversifyN reinterpret reinterpretNinjectinjectNwhichwhichN $fReadWhich $fReadWhich0 $fEmitTYPEEmitReadWhich:ReadPrec$fReiterateTYPEEmitReadWhich:$fCaseCaseShowWhich:(->)$fReiterateTYPECaseShowWhich: $fShowWhich $fShowWhich0$fCaseCaseOrdWhich:Ordering$fReiterateTYPECaseOrdWhich: $fOrdWhich $fOrdWhich0$fCaseCaseEqWhich:Bool$fReiterateTYPECaseEqWhich: $fEqWhich $fEqWhich0$fReduceWhichSwitchN:r$fReduceWhichSwitchN:r0$fReduceWhichSwitch:r$fReduceWhichSwitch:r0$fCaseCaseReinterpretN:Maybe&$fReiterateNTYPECaseReinterpretNntree'$fCaseCaseReinterpret:Either#$fReiterateTYPECaseReinterprettree'$fCaseCaseDiversifyN:Which&$fReiterateNTYPECaseDiversifyNnbranch'$fCaseCaseDiversify:Which#$fReiterateTYPECaseDiversifybranch'$fGenericWhich$fGenericWhich0$fGenericWhich1base GHC.TypeLitsnatVal WrappedAny EmitShowMany EmitOrdMany EmitEqMany CaseNarrow#tagged-0.8.5-1mTloBSoUxv8dqUr8XBGBt Data.TaggedTaggedrightKeyForSnoccontainers-0.5.7.1 Data.Map.BasemapKeysrightOffsetForConsleftKeyForConsData.Map.Strict singleton!lens-4.15.1-8Uk4helmTKohz4c7lsvnBControl.Lens.ConsconssnocGHC.ListheadtailControl.Lens.GetterviewControl.Lens.SettersetControl.Lens.TypeLens'^. Data.Function&.~ fromList'Control.Lens.Lenslensghc-prim GHC.Classescompare GHC.GenericsGeneric:*:C1S1 EmitReadMany CaseAmendN CaseAmend CaseNarrowNNewRightOffsetunNewRightOffset RightOffsetLeftSize LeftOffsetKeyeqManyordManyshowManyreadMany CaseOrdWhich CaseEqWhich Data.EitherLeftEitherRighthushControl.Lens.ReviewreviewControl.Lens.FoldpreviewPrism'Control.Lens.Prismprism'GHC.ReadRead:+: EmitReadWhich CaseShowWhichCaseReinterpretNCaseReinterpretCaseDiversifyN CaseDiversify readWhich