avro 0.3.1.0 → 0.3.1.1
raw patch · 2 files changed
+16/−3 lines, 2 files
Files
- avro.cabal +2/−2
- src/Data/Avro/Deriving.hs +14/−1
avro.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: d96fb3f751e7082ce82dad5a68e5c9c64c853adfcdba51ba55c807b50491045b+-- hash: 639a04c94ec3749a4ac9ddc59885f5313d5d0a1220120baff521a3e36fc8d362 name: avro-version: 0.3.1.0+version: 0.3.1.1 synopsis: Avro serialization support for Haskell description: Avro serialization and deserialization support for Haskell category: Data
src/Data/Avro/Deriving.hs view
@@ -12,6 +12,7 @@ , mkPrefixedFieldName, mkAsIsFieldName -- * Deriving Haskell types from Avro schema+, makeSchema , deriveAvroWithOptions , deriveAvroWithOptions' , deriveFromAvroWithOptions@@ -141,6 +142,16 @@ deriveFromAvro :: FilePath -> Q [Dec] deriveFromAvro = deriveFromAvroWithOptions defaultDeriveOptions +-- | Generates the value of type 'Schema' that it can later be used with+-- 'deriveAvro'' or 'deriveAvroWithOptions''.+--+-- @+-- mySchema :: Schema+-- mySchema = $(makeSchema "schemas/my-schema.avsc")+-- @+makeSchema :: FilePath -> Q Exp+makeSchema p = readSchema p >>= schemaDef'+ readSchema :: FilePath -> Q Schema readSchema p = do qAddDependentFile p@@ -229,8 +240,10 @@ schemaDef sname sch = setName sname $ [d| x :: Schema- x = $(mkSchema sch)+ x = $(schemaDef' sch) |]++schemaDef' sch = mkSchema sch where mkSchema = \case Null -> [e| Null |] Boolean -> [e| Boolean |]