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


-- | A library for generic programming that aims to be easy to understand
--   
--   A library for generic programming that aims to be easy to understand
@package generics-eot
@version 0.2.1.2


-- | <tt>generics-eot</tt> tries to be a library for datatype generic
--   programming that is easy to understand. "eot" stands for "eithers of
--   tuples".
--   
--   A tutorial on how to use <tt>generics-eot</tt> can be found here:
--   <a>http://generics-eot.readthedocs.org/en/latest/</a>.
module Generics.Eot

-- | An instance (<tt><a>HasEot</a> a</tt>) allows us to
--   
--   <ul>
--   <li>convert values of an arbitrary algebraic datatype <tt>a</tt> to
--   and from a generic representation (<tt><a>Eot</a> a</tt>) (see
--   <a>toEot</a> and <a>fromEot</a>).</li>
--   <li>extract meta information about the type <tt>a</tt> (see
--   <a>datatype</a>).</li>
--   </ul>
--   
--   Once an algebraic datatype has an instance for <a>Generic</a> it
--   automatically gets one for <a>HasEot</a>.
class HasEot a where {
    type family Eot a :: *;
}

-- | Convert a value of type <tt>a</tt> to its generic representation.
toEot :: HasEot a => a -> Eot a

-- | Convert a value in a generic representation to <tt>a</tt> (inverse of
--   <a>toEot</a>).
fromEot :: HasEot a => Eot a -> a

-- | Extract meta information about the ADT.
datatype :: HasEot a => Proxy a -> Datatype

-- | Type for meta information about ADTs.
data Datatype
Datatype :: String -> [Constructor] -> Datatype

-- | unqualified name of the type
[datatypeName] :: Datatype -> String
[constructors] :: Datatype -> [Constructor]
data Constructor
Constructor :: String -> Fields -> Constructor
[constructorName] :: Constructor -> String
[fields] :: Constructor -> Fields

-- | Type that represents meta information about fields of one constructor.
data Fields

-- | Record constructor, containing the list of the selector names.
Selectors :: [String] -> Fields

-- | Constructor with fields, but without selector names. The argument
--   gives the number of fields.
NoSelectors :: Int -> Fields

-- | Constructor without fields.
NoFields :: Fields

-- | Uninhabited type.
data Void

-- | Representable types of kind *. This class is derivable in GHC with the
--   DeriveGeneric flag on.
class Generic a

-- | A concrete, poly-kinded proxy type
data Proxy k (t :: k) :: forall k. () => k -> *
Proxy :: Proxy k
instance (GHC.Generics.Generic a, Generics.Eot.ImpliedByGeneric a c f) => Generics.Eot.HasEot a

module Generics.Eot.Tutorial
namesOfFields :: HasEot a => Proxy a -> [String]
data A
A1 :: String -> Int -> A
[foo] :: A -> String
[bar] :: A -> Int
A2 :: Int -> Bool -> A
[bar] :: A -> Int
[baz] :: A -> Bool
data B
B1 :: Int -> B
B2 :: String -> Bool -> B
B3 :: B
class EotSerialize eot
eotSerialize :: EotSerialize eot => Int -> eot -> [Int]
class Serialize a
serialize :: Serialize a => a -> [Int]
serialize :: (Serialize a, HasEot a, EotSerialize (Eot a)) => a -> [Int]
genericSerialize :: (HasEot a, EotSerialize (Eot a)) => a -> [Int]
class EotDeserialize eot
eotDeserialize :: EotDeserialize eot => [Int] -> eot
class Deserialize a
deserialize :: Deserialize a => [Int] -> a
genericDeserialize :: (HasEot a, EotDeserialize (Eot a)) => [Int] -> a
class EotCreateTableStatement meta eot
eotCreateTableStatement :: EotCreateTableStatement meta eot => meta -> Proxy eot -> [String]
createTableStatement :: forall a. (HasEot a, EotCreateTableStatement Datatype (Eot a)) => Proxy a -> String
data Person
Person :: String -> Int -> Person
[name] :: Person -> String
[age] :: Person -> Int
data NoSelectors
NotSupported :: Int -> Bool -> NoSelectors
class ToString a
toString :: ToString a => a -> String
class ToString2 a
toString2 :: ToString2 a => a -> String
toString2 :: (ToString2 a, Show a) => a -> String
data C
C1 :: Int -> String -> C
instance GHC.Generics.Generic Generics.Eot.Tutorial.C
instance GHC.Generics.Generic Generics.Eot.Tutorial.NoSelectors
instance GHC.Generics.Generic Generics.Eot.Tutorial.Person
instance GHC.Generics.Generic Generics.Eot.Tutorial.B
instance GHC.Show.Show Generics.Eot.Tutorial.A
instance GHC.Generics.Generic Generics.Eot.Tutorial.A
instance Generics.Eot.Tutorial.Serialize Generics.Eot.Tutorial.C
instance Generics.Eot.Tutorial.ToString2 GHC.Types.Int
instance Generics.Eot.Tutorial.EotCreateTableStatement [GHC.Base.String] fields => Generics.Eot.Tutorial.EotCreateTableStatement Generics.Eot.Datatype.Datatype (Data.Either.Either fields Generics.Eot.Eot.Void)
instance (Data.Typeable.Internal.Typeable x, Generics.Eot.Tutorial.EotCreateTableStatement [GHC.Base.String] xs) => Generics.Eot.Tutorial.EotCreateTableStatement [GHC.Base.String] (x, xs)
instance Generics.Eot.Tutorial.EotCreateTableStatement [GHC.Base.String] ()
instance (Generics.Eot.Tutorial.Deserialize x, Generics.Eot.Tutorial.EotDeserialize xs) => Generics.Eot.Tutorial.EotDeserialize (x, xs)
instance Generics.Eot.Tutorial.Deserialize GHC.Types.Int
instance Generics.Eot.Tutorial.Deserialize GHC.Base.String
instance Generics.Eot.Tutorial.Deserialize ()
instance Generics.Eot.Tutorial.Deserialize GHC.Types.Bool
instance (Generics.Eot.Tutorial.EotDeserialize this, Generics.Eot.Tutorial.EotDeserialize next) => Generics.Eot.Tutorial.EotDeserialize (Data.Either.Either this next)
instance Generics.Eot.Tutorial.EotDeserialize Generics.Eot.Eot.Void
instance Generics.Eot.Tutorial.EotDeserialize ()
instance (Generics.Eot.Tutorial.Serialize x, Generics.Eot.Tutorial.EotSerialize xs) => Generics.Eot.Tutorial.EotSerialize (x, xs)
instance Generics.Eot.Tutorial.Serialize GHC.Types.Int
instance Generics.Eot.Tutorial.Serialize GHC.Base.String
instance Generics.Eot.Tutorial.Serialize GHC.Types.Bool
instance Generics.Eot.Tutorial.Serialize ()
instance (Generics.Eot.Tutorial.EotSerialize this, Generics.Eot.Tutorial.EotSerialize next) => Generics.Eot.Tutorial.EotSerialize (Data.Either.Either this next)
instance Generics.Eot.Tutorial.EotSerialize Generics.Eot.Eot.Void
instance Generics.Eot.Tutorial.EotSerialize ()
