-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Helps when going "seed values" -> alternatives and optional -> answers
--
--
--
--
-- Types to support turning structured collections of seed values into
-- the same structures with alternatives along with some functions for
-- regular uses. Please see README.md for more information
@package subzero
@version 0.1.0.2
-- | Here is a longer description of this module, containing some
-- commentary with some markup.
module Control.Applicative.SubZero
-- | Converts 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 ZipLists of alternatives zip
-- together, providing alternatives to each point.
--
-- Given the immediate utility of this, I do wonder if the
-- Alternative instance of Compose is the
-- wrong one.
--
--
-- - f The major functor, overall mapping/view
-- - g 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:
--
--
-- - Alternative Superposition
-- functor.
- How do individual items have a set of possible
-- values?
- How do those possible values collapse to form one
-- optional value?
- etc.
-- - etc There are a lot of other utilities for this type.
--
data SubZero f g a
-- | Turns 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".
--
-- To represent that "no value" is a possible outcome, a should
-- be some type like (Maybe a) or (Either
-- String a).
--
--
-- - f This Functor defines the broad scale
-- behaviours but its Alternative instance is overridden. This in
-- particular might change during upcoming design validation.
-- - g This Functor supplies the supercedent
-- Alternative instance and thus the finer behaviours.
--
points :: (Functor f, Alternative g) => (a -> Bool) -> f a -> SubZero f g a
-- | Provides structure for values at the other end of a
-- Functor
reveal :: (Functor f, Applicative g) => f a -> SubZero f g a
-- | If the type constructor of the possibilities concept is
-- Maybe then you can use flatten to
-- provide default values for impossible points.
--
--
-- - NOTE: This uses the applicative instance of the broad scale
-- Functor which means exact behaviour can vary depending
-- on the type of Applicative f because each has a
-- different technique to ensure a value is found for every
-- point:
- list of a Cross-product; Providing all
-- default values once for all points.
- ZipList
-- a zipWith; Providing one default value for each point until
-- there are either no defaults remaining or no more
-- points.
- Identity a One default must
-- surely be provided and it is used if a default is
-- required.
- Maybe a Not sure exactly what
-- this does, TBC.
- Either a Not sure
-- exactly what this does, TBC.
--
flatten :: (Applicative f) => f a -> SubZero f Maybe a -> f a
-- | Take the alternatives embedded in the SubZero and
-- collapse them with a combining function to a single
-- Alternative value or empty which means no possible
-- outcomes. This is quite free in the type of the possibilities concept
-- of the result. It's compatible with Maybe for further
-- uses with flatten, but you can retain behaviours of
-- more sophisticated types. A consequence of this is that you will
-- probably need to state a type.
collapse :: (Functor f, Foldable g, Alternative h) => (a -> a -> a) -> SubZero f g a -> SubZero f h a
instance (GHC.Base.Applicative g, GHC.Base.Applicative f) => GHC.Base.Applicative (Control.Applicative.SubZero.SubZero f g)
instance (GHC.Base.Functor g, GHC.Base.Functor f) => GHC.Base.Functor (Control.Applicative.SubZero.SubZero f g)
instance (GHC.Classes.Ord a, Data.Functor.Classes.Ord1 g, Data.Functor.Classes.Ord1 f) => GHC.Classes.Ord (Control.Applicative.SubZero.SubZero f g a)
instance (GHC.Classes.Eq a, Data.Functor.Classes.Eq1 g, Data.Functor.Classes.Eq1 f) => GHC.Classes.Eq (Control.Applicative.SubZero.SubZero f g a)
instance (GHC.Read.Read a, Data.Functor.Classes.Read1 g, Data.Functor.Classes.Read1 f) => GHC.Read.Read (Control.Applicative.SubZero.SubZero f g a)
instance (GHC.Show.Show a, Data.Functor.Classes.Show1 g, Data.Functor.Classes.Show1 f) => GHC.Show.Show (Control.Applicative.SubZero.SubZero f g a)
instance (GHC.Base.Applicative f, GHC.Base.Alternative g) => GHC.Base.Alternative (Control.Applicative.SubZero.SubZero f g)