| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Generics.Eot.Tutorial
- namesOfFields :: HasEot a => Proxy a -> [String]
- data A
- data B
- class EotSerialize eot where
- class Serialize a where
- genericSerialize :: (HasEot a, EotSerialize (Eot a)) => a -> [Int]
- class EotDeserialize eot where
- class Deserialize a where
- genericDeserialize :: (HasEot a, EotDeserialize (Eot a)) => [Int] -> a
- class EotCreateTableStatement meta eot where
- createTableStatement :: forall a. (HasEot a, EotCreateTableStatement Datatype (Eot a)) => Proxy a -> String
- data Person = Person {}
- data NoSelectors = NotSupported Int Bool
- class ToString a where
- class ToString2 a where
- data C = C1 Int String
Documentation
>>>namesOfFields (Proxy :: Proxy A)["foo","bar","baz"]
>>>:kind! Eot BEot B :: * = Either (Int, ()) (Either ([Char], (Bool, ())) (Either () Void))
class EotSerialize eot where Source #
Minimal complete definition
Methods
eotSerialize :: Int -> eot -> [Int] Source #
Instances
| EotSerialize () Source # | |
| EotSerialize Void Source # | |
| (EotSerialize this, EotSerialize next) => EotSerialize (Either this next) Source # | |
| (Serialize x, EotSerialize xs) => EotSerialize (x, xs) Source # | |
genericSerialize :: (HasEot a, EotSerialize (Eot a)) => a -> [Int] Source #
>>>genericSerialize (A1 "foo" 42)[0,3,102,111,111,1,42]>>>genericSerialize (A2 23 True)[1,1,23,1,1]
class EotDeserialize eot where Source #
Minimal complete definition
Methods
eotDeserialize :: [Int] -> eot Source #
Instances
| EotDeserialize () Source # | |
| EotDeserialize Void Source # | |
| (EotDeserialize this, EotDeserialize next) => EotDeserialize (Either this next) Source # | |
| (Deserialize x, EotDeserialize xs) => EotDeserialize (x, xs) Source # | |
class Deserialize a where Source #
Minimal complete definition
Methods
deserialize :: [Int] -> a Source #
Instances
genericDeserialize :: (HasEot a, EotDeserialize (Eot a)) => [Int] -> a Source #
>>>genericDeserialize [0,3,102,111,111,1,42] :: AA1 {foo = "foo", bar = 42}>>>genericDeserialize [1,1,23,1,1] :: AA2 {bar = 23, baz = True}
>>>(genericDeserialize $ genericSerialize $ A1 "foo" 42) :: AA1 {foo = "foo", bar = 42}
class EotCreateTableStatement meta eot where Source #
Minimal complete definition
Methods
eotCreateTableStatement :: meta -> Proxy eot -> [String] Source #
Instances
| EotCreateTableStatement [String] fields => EotCreateTableStatement Datatype (Either fields Void) Source # | |
| EotCreateTableStatement [String] () Source # | |
| (Typeable * x, EotCreateTableStatement [String] xs) => EotCreateTableStatement [String] (x, xs) Source # | |
createTableStatement :: forall a. (HasEot a, EotCreateTableStatement Datatype (Eot a)) => Proxy a -> String Source #
>>>putStrLn $ createTableStatement (Proxy :: Proxy Person)CREATE TABLE Person COLUMNS (name [Char], age Int);
>>>putStrLn $ createTableStatement (Proxy :: Proxy A)... • No instance for (EotCreateTableStatement Datatype (Either ([Char], (Int, ())) (Either (Int, (Bool, ())) Void))) arising from a use of ‘createTableStatement’ ...
data NoSelectors Source #
Constructors
| NotSupported Int Bool |
Instances
| Generic NoSelectors Source # | |
| type Rep NoSelectors Source # | |
>>>putStrLn $ createTableStatement (Proxy :: Proxy NoSelectors)*** Exception: constructor NotSupported has no selectors, this is not supported ...
>>>toString2 (42 :: Int)"42"
>>>serialize (C1 42 "yay!")[0,1,42,4,121,97,121,33]