File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Revision history for json-syntax
22
3+ ## 0.1.2.0 -- 2020-??-??
4+
5+ * Add infix pattern synonym for ` Member ` .
6+
37## 0.1.1.0 -- 2020-05-01
48
59* Add ` encode ` .
Original file line number Diff line number Diff line change 11cabal-version : 2.2
22name : json-syntax
3- version : 0.1.1 .0
3+ version : 0.1.2 .0
44synopsis : High-performance JSON parser and encoder
55description :
66 This library parses JSON into a @Value@ type that is consistent with the
Original file line number Diff line number Diff line change 66{-# language LambdaCase #-}
77{-# language MagicHash #-}
88{-# language NamedFieldPuns #-}
9+ {-# language PatternSynonyms #-}
910{-# language TypeApplications #-}
1011{-# language UnboxedTuples #-}
1112
@@ -17,6 +18,8 @@ module Json
1718 -- * Functions
1819 , decode
1920 , encode
21+ -- * Infix Synonyms
22+ , pattern (:->)
2023 ) where
2124
2225import Prelude hiding (Bool (True ,False ))
@@ -127,6 +130,7 @@ decode = P.parseBytesEither do
127130 P. endOfInput UnexpectedLeftovers
128131 pure result
129132
133+ -- | Encode a JSON syntax tree.
130134encode :: Value -> BLDR. Builder
131135encode = \ case
132136 True -> BLDR. ascii4 ' t' ' r' ' u' ' e'
@@ -410,3 +414,7 @@ byteArrayToShortByteString (PM.ByteArray x) = BSS.SBS x
410414-- Precondition: Not in the range [U+D800 .. U+DFFF]
411415w16ToChar :: Word16 -> Char
412416w16ToChar (W16 # w) = C # (chr# (word2Int# w))
417+
418+ -- | Infix pattern synonym for 'Member'.
419+ pattern (:->) :: ShortText -> Value -> Member
420+ pattern key :-> value = Member {key,value}
You can’t perform that action at this time.
0 commit comments