Skip to content

Commit 7183677

Browse files
committed
Expand README examples
1 parent 69ee759 commit 7183677

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ and you get a de/serializer for the whole structure. The type system ensures tha
1010
every record exactly once. It also includes a library for general record construction in an Applicative context,
1111
of which creating codecs is just one application.
1212

13-
JSON!
13+
JSON! ([full example](https://github.com/chpatrick/codec/blob/master/Examples/JSON.hs))
14+
15+
data User = User
16+
{ username :: Text
17+
, userEmail :: Text
18+
, userLanguages :: [ Text ]
19+
, userReferrer :: Maybe User
20+
} deriving Show
21+
22+
genFields ''User
1423

1524
userCodec :: JSONCodec User
1625
userCodec = obj "user object" $
@@ -26,7 +35,7 @@ JSON!
2635
instance ToJSON User where
2736
toJSON = produceVal userCodec
2837

29-
Bit fields!
38+
Bit fields! ([full example](https://github.com/chpatrick/codec/blob/master/Examples/IP.hs))
3039

3140
ipv4Codec :: BinaryCodec IPv4
3241
ipv4Codec = toBytes $
@@ -49,7 +58,7 @@ Bit fields!
4958
get = parse ipv4Codec
5059
put = produce ipv4Codec
5160

52-
Storable!
61+
Storable! ([full example](https://github.com/chpatrick/codec/blob/master/Examples/Foreign.hsc))
5362

5463
timeSpecCodec :: ForeignCodec TimeSpec
5564
timeSpecCodec =

0 commit comments

Comments
 (0)