File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -329,7 +329,7 @@ fix f =
329
329
-- |
330
330
-- | ```purescript
331
331
-- | nonEmptyString ∷ CA.JsonCodec NES.NonEmptyString
332
- -- | nonEmptyString = CA.prismaticCodec NES.fromString NES.toString CA.string
332
+ -- | nonEmptyString = CA.prismaticCodec "NonEmptyString" NES.fromString NES.toString CA.string
333
333
-- | ```
334
334
-- |
335
335
-- | Another example might be to handle a mapping from a small sum type to
@@ -339,7 +339,7 @@ fix f =
339
339
-- | data Direction = North | South | West | East
340
340
-- |
341
341
-- | directionCodec :: JsonCodec Direction
342
- -- | directionCodec = prismaticCodec dec enc string
342
+ -- | directionCodec = CA. prismaticCodec "Direction" dec enc string
343
343
-- | where
344
344
-- | dec = case _ of
345
345
-- | "N" -> Just North
@@ -357,8 +357,8 @@ fix f =
357
357
-- |
358
358
-- | Although for this latter case there are some other options too, in the form
359
359
-- | of `Data.Codec.Argonaut.Generic.nullarySum` and `Data.Codec.Argonaut.Sum.enumSum`.
360
- prismaticCodec ∷ ∀ a b . (a → Maybe b ) → (b → a ) → JsonCodec a → JsonCodec b
361
- prismaticCodec f g orig =
360
+ prismaticCodec ∷ ∀ a b . String → (a → Maybe b ) → (b → a ) → JsonCodec a → JsonCodec b
361
+ prismaticCodec name f g orig =
362
362
basicCodec
363
- (\json' → note (UnexpectedValue json') <<< f =<< decode orig json')
363
+ (\json' → note (Named name ( UnexpectedValue json') ) <<< f =<< decode orig json')
364
364
(encode orig <<< g)
You can’t perform that action at this time.
0 commit comments