Created
December 20, 2017 01:27
-
-
Save LeifW/ce871f491d2e9a22162c3e1e7e3cd813 to your computer and use it in GitHub Desktop.
Undefined in generating avro bytes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Data.Avro | |
import Data.Avro.Schema | |
data Thing = Thing { num :: Int } | |
thingSchema :: Schema | |
thingSchema = Record "Thing" Nothing [] Nothing Nothing | |
[fld "num" Int] | |
where fld nm ty = Field nm [] Nothing Nothing ty Nothing | |
instance HasAvroSchema Thing where | |
schema = pure thingSchema | |
instance ToAvro Thing where | |
toAvro p = record thingSchema | |
["num" .= num p] | |
dataset :: [Thing] | |
dataset = [Thing 5] | |
main :: IO () | |
main = do | |
bytes <- encodeContainer [dataset] | |
print bytes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When run, gives: | |
``` | |
Prelude.undefined | |
CallStack (from HasCallStack): | |
error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err | |
undefined, called at src/Data/Avro/Encode.hs:100:33 in avro-0.2.0.0-7D9gyFVmhinCwIHovPxGOA:Data.Avro.Encode | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment