-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Describe schemas for your Haskell data types.
--   
--   Please see the README on GitHub at
--   <a>https://github.com/alonsodomin/haskell-schema#readme</a>
@package hschema
@version 0.0.1.1

module Control.Functor.HigherOrder
type HAlgebra f g = f g :~> g
type HCoalgebra f g = g :~> f g
class HFunctor (f :: ((* -> *) -> * -> *))
hfmap :: HFunctor f => (m ~> n) -> f m ~> f n
class HFunctor f => HPointed f
hreturn :: (HPointed f, Functor g) => g a -> f g a
class HFunctor f => HCopointed f
hextract :: (HCopointed f, Functor g) => f g a -> g a
newtype HFix f a
HFix :: f (HFix f) a -> HFix f a
[unfix] :: HFix f a -> f (HFix f) a
data HEnvT (f :: ((* -> *) -> * -> *)) (e :: *) (g :: (* -> *)) (i :: *)
HEnvT :: !e -> f g i -> HEnvT
[hask] :: HEnvT -> !e
[hlocal] :: HEnvT -> f g i
newtype HMutu (f :: ((* -> *) -> * -> *)) (g :: ((* -> *) -> * -> *)) (a :: *)
HMutu :: f (g (HMutu f g)) a -> HMutu
[unmutu] :: HMutu -> f (g (HMutu f g)) a
type HCofree (f :: ((* -> *) -> * -> *)) (a :: *) = HFix (HEnvT f a)
hcofree :: a -> f (HCofree f a) b -> HCofree f a b
cataNT :: HFunctor f => HAlgebra f g -> HFix f ~> g
anaNT :: HFunctor f => HCoalgebra f g -> g ~> HFix f
hforgetAlg :: HAlgebra (HEnvT f a) (HFix f)
hforget :: HFunctor f => HCofree f a ~> HFix f
htagCoalg :: HFunctor f => a -> HCoalgebra (HEnvT f a) (HFix f)
htag :: HFunctor f => a -> HFix f ~> HCofree f a
instance Control.Functor.HigherOrder.HFunctor f => Control.Functor.HigherOrder.HFunctor (Control.Functor.HigherOrder.HEnvT f a)
instance GHC.Base.Functor (f g) => GHC.Base.Functor (Control.Functor.HigherOrder.HEnvT f e g)

module Data.Schema.Internal.Types

-- | Metadata for a field of type <tt>a</tt>, belonging to the data type
--   <tt>o</tt> and based on schema <tt>s</tt>
data FieldDef o s a
[RequiredField] :: Text -> s a -> Getter o a -> FieldDef o s a
[OptionalField] :: Text -> s a -> Getter o (Maybe a) -> FieldDef o s (Maybe a)
fieldName :: FieldDef o s a -> Text

-- | The type of a field of type <tt>a</tt>, belonging to the data type
--   <tt>o</tt> and based on schema <tt>s</tt>
newtype Field s o a
Field :: Ap (FieldDef o s) a -> Field s o a
[unwrapField] :: Field s o a -> Ap (FieldDef o s) a
hoistField :: (m ~> n) -> Field m o a -> Field n o a

-- | The set of fields for the data type <tt>o</tt> based on schema
--   <tt>s</tt>
type Fields s o = Field s o o

-- | Define a field
field :: Text -> s a -> Getter o a -> Field s o a
optional :: Text -> s a -> Getter o (Maybe a) -> Field s o (Maybe a)

-- | Metadata for an alternative of type <tt>a</tt> based on schema
--   <tt>s</tt>
data AltDef s a
AltDef :: Text -> s b -> Prism' a b -> AltDef s a
[altName] :: AltDef s a -> Text
[altSchema] :: AltDef s a -> s b
[altPrism] :: AltDef s a -> Prism' a b

-- | Metadata for a schema <tt>s</tt> based on primitives <tt>p</tt> and
--   representing type <tt>a</tt>
data SchemaF p s a
[PrimitiveSchema] :: p a -> SchemaF p s a
[RecordSchema] :: Fields s a -> SchemaF p s a
[UnionSchema] :: NonEmpty (AltDef s a) -> SchemaF p s a
[AliasSchema] :: s a -> Iso' a b -> SchemaF p s b

-- | The Schema type itself for a set of primitives <tt>p</tt>
newtype Schema p a
Schema :: HFix (SchemaF p) a -> Schema p a
[unwrapSchema] :: Schema p a -> HFix (SchemaF p) a
class HasSchema a where {
    type family PrimitivesOf a :: * -> *;
}
getSchema :: HasSchema a => Schema (PrimitivesOf a) a
instance Data.Functor.Invariant.Invariant (Data.Schema.Internal.Types.Schema p)
instance Control.Functor.HigherOrder.HFunctor Data.Schema.Internal.Types.Schema
instance Control.Functor.HigherOrder.HFunctor (Data.Schema.Internal.Types.SchemaF p)
instance Control.Functor.HigherOrder.HFunctor Data.Schema.Internal.Types.AltDef
instance GHC.Base.Functor (Data.Schema.Internal.Types.Field s o)
instance GHC.Base.Applicative (Data.Schema.Internal.Types.Field s o)
instance Data.Profunctor.Unsafe.Profunctor (Data.Schema.Internal.Types.Field s)
instance Control.Functor.HigherOrder.HFunctor (Data.Schema.Internal.Types.FieldDef o)

module Data.Schema

-- | The type of a field of type <tt>a</tt>, belonging to the data type
--   <tt>o</tt> and based on schema <tt>s</tt>
data Field s o a

-- | The set of fields for the data type <tt>o</tt> based on schema
--   <tt>s</tt>
type Fields s o = Field s o o

-- | Define a field
field :: Text -> s a -> Getter o a -> Field s o a
optional :: Text -> s a -> Getter o (Maybe a) -> Field s o (Maybe a)

-- | Define an alternative
alt :: Text -> s b -> Prism' a b -> AltDef s a

-- | The Schema type itself for a set of primitives <tt>p</tt>
data Schema p a
class HasSchema a where {
    type family PrimitivesOf a :: * -> *;
}
getSchema :: HasSchema a => Schema (PrimitivesOf a) a

-- | Define an annotated schema for primitives of type <tt>p</tt>
prim :: p a -> Schema p a

-- | Define a schema for a type that is always constant
const :: a -> Schema p a

-- | Define the schema of record using the given fields
record :: Fields (Schema p) a -> Schema p a

-- | Define the schema of a list based on the element type
asList :: Iso' (Vector a) [a]
toList :: Schema p (Vector a) -> Schema p [a]

-- | Define the schema of an union (coproduct) type based on the given
--   alternatives
oneOf :: [AltDef (Schema p) a] -> Schema p a

-- | Define an schema alias that is isomorphic to another one using the
--   given ISO transformation
alias :: Iso' a b -> Schema p a -> Schema p b
