Skip to content

Commit cdb1112

Browse files
committed
document record
1 parent f7346fb commit cdb1112

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Data/Codec/Argonaut/Record.purs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ instance rowListCodecCons ∷
3434
tail = rowListCodec (R.RLProxy R.RLProxy rs) ((unsafeCoerce Record ri Record ri') codecs)
3535

3636
-- | Constructs a record codec from a record of codecs.
37+
-- |
38+
-- | ```purescript
39+
-- | type Person = { name ∷ String, age ∷ Int }
40+
-- |
41+
-- | personCodec ∷ CA.JsonCodec Person
42+
-- | personCodec = CA.object "Person" (record { name: CA.string, age: CA.int })
43+
-- |
44+
-- | decode personCodec "{ name: \"Carl\", age:\"25\" }" == Right { name: "Carl", age: 25 }
45+
-- | ```
46+
3747
record
3848
ri ro rl
3949
. R.RowToList ri rl

0 commit comments

Comments
 (0)