Skip to content

Commit adaad0f

Browse files
Fix example in README
Fix example in README of writing a decodeJson instance, where I mistakenly treated the argument as a `String` instead of `Json`.
1 parent 1e5aeca commit adaad0f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,10 @@ Let's write the instance using `note` from `purescript-either`:
265265

266266
```purs
267267
instance decodeJsonTeam :: DecodeJson Team where
268-
decodeJson string = do
268+
decodeJson json = do
269+
string <- decodeJson json
269270
let decodeError = "Could not decode Team from " <> string
270-
decodeJson (note decodeError teamFromString string)
271+
note decodeError (teamFromString string)
271272
```
272273

273274
If your type can be represented easily with a `String`, `Number`, `Boolean`, or array of one of these types, then its `DecodeJson` will most likely look similar to this one.

0 commit comments

Comments
 (0)