-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A total map datatype
--
-- Provides a datatype representing a total map using an enum type as
-- keys
@package TotalMap
@version 0.1.1.1
-- | A total map from an enum type. Consult the README for more information
module TotalMap
-- | A TotalMap is a total mapping from some enum type tag
-- to some value a: it is isomorphic to `tag -> a`. It uses a
-- generics-sop NP array to store all values, ensuring that every
-- value of tag must have a corresponding value.
data TotalMap (tag :: *) (a :: *)
[TotalMap] :: IsEnumType tag => NP (K a) (Code tag) -> TotalMap tag a
-- | Generate all constructors for some enum type.
--
-- TODO: This uses undefined internally as I can not convince the type
-- checker that every constructor has no arguments. This shouldn't be an
-- issue, but feels unsafe so probably should be changed
generateAllConstructors :: IsEnumType tag => NP (K tag) (Code tag)
-- | A TotalMap where each value is its own key. This is the
-- equivalent of id.
allTags :: IsEnumType tag => TotalMap tag tag
-- | Extract a value out of a TotalMap
getTotalMap :: TotalMap tag a -> tag -> a
-- | Replace a value inside a TotalMap
setTotalMap :: forall tag a. IsEnumType tag => TotalMap tag a -> tag -> a -> TotalMap tag a
-- | A Lens into a value of a TotalMap
ixTotal :: IsEnumType tag => tag -> Lens' (TotalMap tag a) a
-- | Constraint that captures that a datatype is an enumeration type, i.e.,
-- none of the constructors have any arguments.
type IsEnumType a = (Generic a, All [Type] ~ ([] :: [Type]) Code a)
instance GHC.Base.Functor (TotalMap.TotalMap tag)
instance Generics.SOP.Universe.IsEnumType tag => Control.Lens.Indexed.FunctorWithIndex tag (TotalMap.TotalMap tag)
instance Generics.SOP.Universe.IsEnumType tag => GHC.Base.Applicative (TotalMap.TotalMap tag)
instance Generics.SOP.Universe.IsEnumType tag => GHC.Base.Monad (TotalMap.TotalMap tag)
instance Data.Foldable.Foldable (TotalMap.TotalMap tag)
instance Generics.SOP.Universe.IsEnumType tag => Control.Lens.Indexed.FoldableWithIndex tag (TotalMap.TotalMap tag)
instance Data.Traversable.Traversable (TotalMap.TotalMap tag)
instance Generics.SOP.Universe.IsEnumType tag => Control.Lens.Indexed.TraversableWithIndex tag (TotalMap.TotalMap tag)
instance Generics.SOP.Universe.IsEnumType tag => Data.Distributive.Distributive (TotalMap.TotalMap tag)
instance Generics.SOP.Universe.IsEnumType tag => Data.Functor.Rep.Representable (TotalMap.TotalMap tag)
instance Generics.SOP.Universe.IsEnumType tag => Data.Functor.Classes.Eq1 (TotalMap.TotalMap tag)
instance (Generics.SOP.Universe.IsEnumType tag, GHC.Classes.Eq a) => GHC.Classes.Eq (TotalMap.TotalMap tag a)
instance (Generics.SOP.Universe.IsEnumType tag, GHC.Show.Show tag) => Data.Functor.Classes.Show1 (TotalMap.TotalMap tag)
instance (Generics.SOP.Universe.IsEnumType tag, GHC.Show.Show a, GHC.Show.Show tag) => GHC.Show.Show (TotalMap.TotalMap tag a)