-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Existential type that can be constrained -- -- This library provides utilities for working with existential types and -- type-level constraints. It allows you to enforce multiple constraints -- on polymorphic types and containers complementing the package some. @package constrained-some @version 0.1.2 module Data.Some.Constraint -- | AllC ensures that a list of Constraints is applied to a -- poly-kinded Type k. type family AllC cs k :: Constraint -- | Existential with Constraints. -- --
-- someShowableOrd :: Somes '[Show, Ord] -- someShowableOrd = Somes (mempty :: [Double]) --data Somes cs [Some] :: forall (cs :: [Type -> Constraint]) (a :: Type). AllC cs a => a -> Somes cs -- | Alias for Somes with just one Constraint. type Some c = Somes '[c] -- | Existential for containers with Constraints. -- --
-- someNumFunctor :: Somes1 '[Functor] '[Num] -- someNumFunctor = Somes1 $ [1, 2, 3 :: Int] --data Somes1 csf csa [Some1] :: forall k (csf :: [(k -> Type) -> Constraint]) (csa :: [k -> Constraint]) (f :: k -> Type) (a :: k). (AllC csf f, AllC csa a) => f a -> Somes1 csf csa -- | Alias for Somes1 with just one Constraint. type Some1 cf ca = Somes1 '[cf] '[ca] -- | Alias for Somes1 with a container f and multiple -- Constraints csa for its elements. type SomesF f csa = Somes1 '[(~) f] csa -- | Alias for SomeF with just one Constraint for its -- elements. type SomeF f c = SomesF f '[c] -- | Natural transformation of one container to another. mapSome :: (forall a. AllC csa a => f a -> g a) -> SomesF f csa -> SomesF g csa -- | Infix version of mapSome. (<~$>) :: (forall a. AllC csa a => f a -> g a) -> SomesF f csa -> SomesF g csa infixl 4 <~$> -- | Natural transformation of one container to another - with side effects -- in m. traverseSome :: Functor m => (forall a. AllC csa a => f a -> m (g a)) -> SomesF f csa -> m (SomesF g csa) -- | Infix version of traverseSome. (<~*>) :: Functor m => (forall a. AllC csa a => f a -> m (g a)) -> SomesF f csa -> m (SomesF g csa) infixl 4 <~*> instance (forall a. GHC.Show.Show a => GHC.Show.Show (f a)) => GHC.Show.Show (Data.Some.Constraint.SomesF f (GHC.Show.Show : cs)) instance forall k (f :: k -> *) (cs :: [k -> GHC.Types.Constraint]) (c :: k -> GHC.Types.Constraint). GHC.Show.Show (Data.Some.Constraint.SomesF f cs) => GHC.Show.Show (Data.Some.Constraint.SomesF f (c : cs)) instance GHC.Show.Show (Data.Some.Constraint.Somes (GHC.Show.Show : cs)) instance GHC.Show.Show (Data.Some.Constraint.Somes cs) => GHC.Show.Show (Data.Some.Constraint.Somes (c : cs))