-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Boring and Absurd types -- --
-- -- 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 ... ---- --
-- Cardinality (a -> b) ~ Exponent (Cardinality b) (Cardinality a) ---- -- or shortly |a -> b| = |b| ^ |a|. This gives us possible -- instances: -- --
-- 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
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 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.Absurd a => Data.Boring.Boring [a]
instance Data.Boring.Absurd a => Data.Boring.Boring (GHC.Base.Maybe a)
instance a ~ b => Data.Boring.Boring (a Data.Type.Equality.:~: b)
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.Functor.Identity.Identity a)