-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generic programming without too many type classes -- -- This library provides a representation build on top of -- GHC.Generics, which can be used to describe generic operations -- on a single function, instead of having each case defined in an -- instance of a type class. @package simplistic-generics @version 0.1.0.0 module Data.Constraints class (c => d) => Implies c d class Trivial c instance forall k (c :: k). Data.Constraints.Trivial c instance (c => d) => Data.Constraints.Implies c d module Generics.Simplistic -- | Representable types of kind *. This class is derivable in GHC -- with the DeriveGeneric flag on. -- -- A Generic instance must satisfy the following laws: -- --
-- from . to ≡ id -- to . from ≡ id --class Generic a -- | Generic representation type type family Rep a :: Type -> Type -- | Representable types of kind * -> * (or kind k -> -- *, when PolyKinds is enabled). This class is derivable -- in GHC with the DeriveGeneric flag on. -- -- A Generic1 instance must satisfy the following laws: -- --
-- from1 . to1 ≡ id -- to1 . from1 ≡ id --class Generic1 (f :: k -> Type) -- | Generic representation type type family Rep1 (f :: k -> Type) :: k -> Type -- | Void: used for datatypes without constructors data V1 (p :: k) :: forall k. () => k -> Type -- | Unit: used for constructors without arguments data U1 (p :: k) :: forall k. () => k -> Type -- | Sums: encode choice between constructors data (:+:) (f :: k -> Type) (g :: k -> Type) (p :: k) :: forall k. () => k -> Type -> k -> Type -> k -> Type infixr 5 :+: -- | Products: encode multiple arguments to constructors data (:*:) (f :: k -> Type) (g :: k -> Type) (p :: k) :: forall k. () => k -> Type -> k -> Type -> k -> Type infixr 6 :*: -- | Constants, additional parameters and recursion of kind * data K1 i c (p :: k) :: forall k. () => Type -> Type -> k -> Type -- | Meta-information (constructor names, etc.) data M1 i (c :: Meta) (f :: k -> Type) (p :: k) :: forall k. () => Type -> Meta -> k -> Type -> k -> Type data (:=>:) c (f :: k -> Type) (a :: k) :: forall k. () => Constraint -> k -> Type -> k -> Type data SMeta i t [SM_D] :: Datatype d => SMeta D d [SM_C] :: Constructor c => SMeta C c [SM_S] :: Selector s => SMeta S s data SRep w f [S_U1] :: SRep w U1 [S_L1] :: SRep w f -> SRep w (f :+: g) [S_R1] :: SRep w g -> SRep w (f :+: g) [:**:] :: SRep w f -> SRep w g -> SRep w (f :*: g) [S_K1] :: w a -> SRep w (K1 i a) [S_M1] :: SMeta i t -> SRep w f -> SRep w (M1 i t f) [S_ST] :: c => SRep w f -> SRep w (c :=>: f) infixr 5 :**: type GenericSy a = (Generic a, Sy (Rep a)) fromS :: (GenericSy a, Applicative w) => a -> SRep w (Rep a) toS :: (GenericSy a, Comonad w) => SRep w (Rep a) -> a fromI :: GenericSy a => a -> SRep Identity (Rep a) toI :: GenericSy a => SRep Identity (Rep a) -> a type family OnLeaves (c :: * -> Constraint) (f :: * -> *) :: Constraint data SRep1 f x [S1_U1] :: SRep1 U1 x [S1_L1] :: SRep1 f x -> SRep1 (f :+: g) x [S1_R1] :: SRep1 g x -> SRep1 (f :+: g) x [:***:] :: SRep1 f x -> SRep1 g x -> SRep1 (f :*: g) x [S1_K1] :: a -> SRep1 (K1 i a) x [S1_M1] :: SMeta i t -> SRep1 f x -> SRep1 (M1 i t f) x [S1_ST] :: c => SRep1 f x -> SRep1 (c :=>: f) x [S1_Par] :: x -> SRep1 Par1 x [S1_Rec] :: f x -> SRep1 (Rec1 f) x [S1_Comp] :: f (SRep1 g x) -> SRep1 (f :.: g) x infixr 5 :***: type GenericSy1 f = (Generic1 f, Sy1 (Rep1 f)) fromS1 :: GenericSy1 f => f a -> SRep1 (Rep1 f) a toS1 :: GenericSy1 f => SRep1 (Rep1 f) a -> f a type family OnLeaves1 (c :: * -> Constraint) (r :: (* -> *) -> Constraint) (f :: * -> *) :: Constraint class (c => d) => Implies c d class Trivial c instance Generics.Simplistic.Sy1 GHC.Generics.V1 instance Generics.Simplistic.Sy1 GHC.Generics.U1 instance (Generics.Simplistic.Sy1 f, Generics.Simplistic.Sy1 g) => Generics.Simplistic.Sy1 (f GHC.Generics.:+: g) instance (Generics.Simplistic.Sy1 f, Generics.Simplistic.Sy1 g) => Generics.Simplistic.Sy1 (f GHC.Generics.:*: g) instance Generics.Simplistic.Sy1 (GHC.Generics.K1 i a) instance (Generics.Simplistic.SMety i t, Generics.Simplistic.Sy1 f) => Generics.Simplistic.Sy1 (GHC.Generics.M1 i t f) instance (c => Generics.Simplistic.Sy1 f) => Generics.Simplistic.Sy1 (c GHC.Generics.Extra.:=>: f) instance Generics.Simplistic.Sy1 GHC.Generics.Par1 instance Generics.Simplistic.Sy1 (GHC.Generics.Rec1 f) instance (GHC.Base.Functor f, Generics.Simplistic.Sy1 g) => Generics.Simplistic.Sy1 (f GHC.Generics.:.: g) instance Generics.Simplistic.Sy GHC.Generics.V1 instance Generics.Simplistic.Sy GHC.Generics.U1 instance forall k (f :: k -> *) (g :: k -> *). (Generics.Simplistic.Sy f, Generics.Simplistic.Sy g) => Generics.Simplistic.Sy (f GHC.Generics.:+: g) instance forall k (f :: k -> *) (g :: k -> *). (Generics.Simplistic.Sy f, Generics.Simplistic.Sy g) => Generics.Simplistic.Sy (f GHC.Generics.:*: g) instance Generics.Simplistic.Sy (GHC.Generics.K1 i a) instance forall k i (t :: GHC.Generics.Meta) (f :: k -> *). (Generics.Simplistic.SMety i t, Generics.Simplistic.Sy f) => Generics.Simplistic.Sy (GHC.Generics.M1 i t f) instance forall k (c :: GHC.Types.Constraint) (f :: k -> *). (c => Generics.Simplistic.Sy f) => Generics.Simplistic.Sy (c GHC.Generics.Extra.:=>: f) instance forall k (d :: k). GHC.Generics.Datatype d => Generics.Simplistic.SMety GHC.Generics.D d instance forall k (c :: k). GHC.Generics.Constructor c => Generics.Simplistic.SMety GHC.Generics.C c instance forall k (s :: k). GHC.Generics.Selector s => Generics.Simplistic.SMety GHC.Generics.S s module Generics.Simplistic.Derive.Eq geq :: (Applicative w, OnLeaves Eq f) => SRep w f -> SRep w f -> w Bool geq' :: (GenericSy a, OnLeaves Eq (Rep a)) => a -> a -> Bool module Generics.Simplistic.Derive.Functor gfmap :: OnLeaves1 Trivial Functor f => (a -> b) -> SRep1 f a -> SRep1 f b gfmap' :: (GenericSy1 f, OnLeaves1 Trivial Functor (Rep1 f)) => (a -> b) -> f a -> f b module Generics.Simplistic.Derive.Show data MyList a MyNil :: MyList a MyCons :: a -> MyList a -> MyList a [hd] :: MyList a -> a [tl] :: MyList a -> MyList a myListValue :: MyList Integer appPrec :: Int data Type Rec :: Type Tup :: Type Pref :: Type Inf :: String -> Type gshow :: (GenericSy t, OnLeaves Show (Rep t)) => t -> String gshowsPrec :: (GenericSy t, OnLeaves Show (Rep t)) => Type -> Int -> t -> ShowS gshowsPrec' :: OnLeaves Show f => Type -> Int -> SRep Identity f -> ShowS isNullary :: SRep Identity a -> Bool instance GHC.Generics.Generic (Generics.Simplistic.Derive.Show.MyList a) instance GHC.Show.Show a => GHC.Show.Show (Generics.Simplistic.Derive.Show.MyList a)