úÎA)?Ü     "SubZero type and related functions(c) Tristan Wibberley, 2017GPL-2tristan.wibberley@gmail.com experimentalNone9;<=I !collapse f empty = simplify empty'collapse f (pure x) = simplify (pure x)#collapse f (x <|> y) = pure (f x y)g must form a monoid under f when   is the monoid's identity.0Tries to convert from one alternative to anotherFCombines many alternatives into one using a function parameter.   stays  è. This is quite free in the type of the result so the user can choose whether to keep the same type to re-expand the structure or to transform to a smaller type to avoid relying on instances for certain behaviours.EConverts a functor so that each point at the source has alternatives.±It's just like Compose but the applicative instance appends new alternative values in the rightmost (inner/minor) functor instead of in the leftmost (outer/major) functor.The result is that two Hs of alternatives zip together, providing alternatives to each point.8Given the immediate utility of this, I do wonder if the  instance of  is the wrong one. f'The major functor, overall mapping/viewg^This has a a few key useful interpretations depending on its instances, examples below.a!Transformed/contained value type.;Some example instances that you might want to rely on from g: Superposition functor.6How do individual items have a set of possible values?AHow do those possible values collapse to form one optional value?etc.etc1There are a lot of other utilities for this type.4Provides structure for values at the other end of a iTurns a container of values to a container of either retained or destroyed values based on a predicate¯The type constraint allows us to model possible outcomes so destroyed values are just "no possible outcomes" while retained values represent "the only possible outcome".4To represent that "no value" is a possible outcome, a should be some type like ( a) or (  a). fThis 3 defines the broad scale behaviours but its i instance is overridden. This in particular might change during upcoming design validation.gThis  supplies the supercedent / instance and thus the finer behaviours.8If the type constructor of the possibilities concept is  then you can use 5 to provide default values for impossible points.NOTE@: This uses the applicative instance of the broad scale G which means exact behaviour can vary depending on the type of  f[ because each has a different technique to ensure a value is found for every point:  list of aDCross-product; Providing all default values once for all points. a{zipWith; Providing one default value for each point until there are either no defaults remaining or no more points. aPOne default must surely be provided and it is used if a default is required. a%Not sure exactly what this does, TBC. a%Not sure exactly what this does, TBC.fmap below the zeropoint.fmap below the zeropoint, function variant of  operatorAlternative below the zeropoint Turns a value "a" to  a or E based on a predicate assuming you use it in a context that wants  a) instead of some other representation of s Does the same as   for values at the other end of ."keep = (keepIdentity . Identity) f Superposition within  * g XSuperposition within a nondeterminism list (ie, []) This is roughly the same as  SuperPosition (  []) h¨ but of course they have different instances of other typeclasses and if that were really true then it would be SuperPositions of Identity all the way down. Initial flat structure*enhanced structure, albeit with no changesYA predicate that indicates whether a point is occupied by its original value or vacant."The seed points with their values.The constructed SubZero value.Default valuesStructured containerDestructured container          !&subzero-0.1.0.4-9uh3XgZr9bl9C97lilhYIIControl.Applicative.SubZero Superpositionsimplifycollapserevealpointsflatten<-$> universal<-|>keep keepIdentity$fSuperpositionComposeCompose$fSuperposition[]hbaseGHC.BaseemptyControl.ApplicativeZipList AlternativeData.Functor.ComposeComposeFunctorMaybe Data.EitherEitherString ApplicativeData.Functor.IdentityIdentityJustNothing