Public
Authored by Yann Esposito

How to transform a Record type to a list `[(Text,Text)]` of fieldName, typeName.

This is the Haskell way to be able to access the type informations.

This use generic-sop package.

>>> data Foo = Foo { name :: Text, age :: Int } deriving (GHC.Generics.Generic)
>>> instance Generics.SOP.Generic Foo
>>> instance Generics.SOP.HasDatatypeInfo Foo
>>> instance SQLiteSchemas Foo
>>> sqlSchema (Proxy :: Proxy Foo)
[("foo","TEXT"),("fooint","INT")]
Edited
genericSQLite.hs 4.4 KB
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment