-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Boring and Absurd types -- -- -- -- See What does () mean in Haskell -answer by Conor McBride @package boring @version 0.1 -- | Boring and Absurd classes. One approach. -- -- Different approach would be to have -- --
--   -- none-one-tons semiring
--   data NOT = None | One | Tons
--   
--   type family Cardinality (a :: *) :: NOT
--   
--   class Cardinality a ~ None => Absurd a where ...
--   class Cardinality a ~ One  => Boring a where ...
--   
-- -- This would make possible to define more instances, e.g. -- --
--   instance (Mult (Cardinality a) (Cardinality b) ~ None) => Absurd (a, b) where ...
--   
-- --

Functions

-- -- Function is an exponential: -- --
--   Cardinality (a -> b) ~ Exponent (Cardinality b) (Cardinality a)
--   
-- -- or shortly |a -> b| = |b| ^ |a|. This gives us possible -- instances: -- -- -- -- Both instances are Boring, but we chose to define the latter. -- --

Note about adding instances

-- -- At this moment this module misses a lot of instances, please make a -- patch to add more. Especially, if the package is already in the -- transitive dependency closure. -- -- E.g. any possibly empty container f has Absurd a -- => Boring (f a) module Data.Boring -- | Boring types which contains one thing, also boring. -- There is nothing interesting to be gained by comparing one element of -- the boring type with another, because there is nothing to learn about -- an element of the boring type by giving it any of your attention. -- -- Boring Law: -- --
--   boring == x
--   
-- -- Note: This is different class from Default. -- Default gives you some value, Boring gives -- you an unique value. -- -- Also note, that we cannot have instances for e.g. Either, as -- both (Boring a, Absurd b) => Either a b and -- (Absurd a, Boring b) => Either a b would be -- valid instances. -- -- Another useful trick, is that you can rewrite computations with -- Boring results, for example foo :: Int -> (), -- if you are sure that foo is total. -- --
--   {-# RULES "less expensive" foo = boring #-}
--   
-- -- That's particularly useful with equality :~: proofs. class Boring a boring :: Boring a => a -- | The Absurd type is very exciting, because if somebody ever -- gives you a value belonging to it, you know that you are already dead -- and in Heaven and that anything you want is yours. -- -- Similarly as there are many Boring sums, there are many -- Absurd products, so we don't have Absurd instances for -- tuples. class Absurd a absurd :: Absurd a => a -> b -- | If Absurd is uninhabited then any Functor that holds -- only values of type Absurd is holding no values. vacuous :: (Functor f, Absurd a) => f a -> f b -- | If an index of Representable f is Absurd, f -- a is Boring. boringRep :: (Representable f, Absurd (Rep f)) => f a -- | If an index of Representable f is Boring, -- f is isomorphic to Identity. -- -- See also Settable class in lens. untainted :: (Representable f, Boring (Rep f)) => f a -> a -- | There is a field for every type in the Absurd. Very zen. -- --
--   devoid :: Absurd s => Over p f s s a b
--   
-- -- type Over p f s t a b = p a (f b) -> s -> f t devoid :: Absurd s => p a (f b) -> s -> f s -- | We can always retrieve a Boring value from any type. -- --
--   united :: Boring a => Lens' s a
--   
united :: (Boring a, Functor f) => (a -> f a) -> s -> f s instance Data.Boring.Absurd a => Data.Boring.Boring [a] instance Data.Boring.Absurd a => Data.Boring.Boring (GHC.Base.Maybe a) instance Data.Boring.Absurd Data.Void.Void instance (Data.Boring.Absurd a, Data.Boring.Absurd b) => Data.Boring.Absurd (Data.Either.Either a b) instance Data.Boring.Absurd a => Data.Boring.Absurd (Data.List.NonEmpty.NonEmpty a) instance Data.Boring.Absurd a => Data.Boring.Absurd (Data.Stream.Infinite.Stream a) instance Data.Boring.Absurd a => Data.Boring.Absurd (Data.Functor.Identity.Identity a) instance Data.Boring.Absurd (f (g a)) => Data.Boring.Absurd (Data.Functor.Compose.Compose f g a) instance (Data.Boring.Absurd (f a), Data.Boring.Absurd (g a)) => Data.Boring.Absurd (Data.Functor.Sum.Sum f g a) instance Data.Boring.Absurd b => Data.Boring.Absurd (Data.Functor.Const.Const b a) instance Data.Boring.Absurd a => Data.Boring.Absurd (Data.Tagged.Tagged b a) instance Data.Boring.Absurd a => Data.Boring.Absurd (Generics.SOP.BasicFunctors.I a) instance Data.Boring.Absurd b => Data.Boring.Absurd (Generics.SOP.BasicFunctors.K b a) instance n ~ 'Data.Nat.Z => Data.Boring.Absurd (Data.Fin.Fin n) instance Data.Boring.Boring () instance Data.Boring.Boring b => Data.Boring.Boring (a -> b) instance Data.Boring.Boring (Data.Proxy.Proxy a) instance Data.Boring.Boring a => Data.Boring.Boring (Data.Functor.Const.Const a b) instance Data.Boring.Boring b => Data.Boring.Boring (Data.Tagged.Tagged a b) instance Data.Boring.Boring a => Data.Boring.Boring (Data.Functor.Identity.Identity a) instance Data.Boring.Boring a => Data.Boring.Boring (Generics.SOP.BasicFunctors.I a) instance Data.Boring.Boring b => Data.Boring.Boring (Generics.SOP.BasicFunctors.K b a) instance Data.Boring.Boring (f (g a)) => Data.Boring.Boring (Data.Functor.Compose.Compose f g a) instance (Data.Boring.Boring (f a), Data.Boring.Boring (g a)) => Data.Boring.Boring (Data.Functor.Product.Product f g a) instance c => Data.Boring.Boring (Data.Constraint.Dict c) instance (Data.Boring.Boring a, Data.Boring.Boring b) => Data.Boring.Boring (a, b) instance (Data.Boring.Boring a, Data.Boring.Boring b, Data.Boring.Boring c) => Data.Boring.Boring (a, b, c) instance (Data.Boring.Boring a, Data.Boring.Boring b, Data.Boring.Boring c, Data.Boring.Boring d) => Data.Boring.Boring (a, b, c, d) instance (Data.Boring.Boring a, Data.Boring.Boring b, Data.Boring.Boring c, Data.Boring.Boring d, Data.Boring.Boring e) => Data.Boring.Boring (a, b, c, d, e) instance Data.Boring.Boring a => Data.Boring.Boring (Data.Stream.Infinite.Stream a) instance a ~ b => Data.Boring.Boring (a Data.Type.Equality.:~: b) instance n ~ 'Data.Nat.Z => Data.Boring.Boring (Data.Vec.Lazy.Vec n a) instance n ~ 'Data.Nat.Z => Data.Boring.Boring (Data.Vec.Pull.Vec n a) instance n ~ 'Data.Nat.S 'Data.Nat.Z => Data.Boring.Boring (Data.Fin.Fin n)