-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | JSON Pointer library
--
-- JSON Pointer library
@package hjsonpointer
@version 1.1.0.1
module JSONPointer
data ResolutionError
ObjectLookupFailed :: ResolutionError
ArrayIndexInvalid :: ResolutionError
ArrayElemNotFound :: ResolutionError
ExpectedObjectOrArray :: ResolutionError
resolve :: Pointer -> Value -> Either ResolutionError Value
newtype Pointer
Pointer :: [Token] -> Pointer
[_unPointer] :: Pointer -> [Token]
-- | We don't try to distinguish between integer tokens and string tokens
-- since all tokens start as strings, and all tokens can be used to
-- resolve JSON objects.
--
-- Since these are unescaped you can write "/" and "~"
-- normally. (e.g. if you're referencing a key such as
-- "abc/123", go ahead and write that exactly.
newtype Token
Token :: Text -> Token
[_unToken] :: Token -> Text
-- | This escapes "/" (because it's the token separator
-- character).
--
-- It also escapes "~" (because it's the escape character).
escape :: Pointer -> Text
data FormatError
-- | JSON Pointers must either be empty or start with a /.
InvalidFirstChar :: FormatError
UnescapedTilde :: FormatError
-- | JSON Pointers must either be empty or start with a /. This
-- means that if you're turning a URI Fragment into a JSON Pointer you
-- must drop the initial #.
--
-- Note that the unescaping happening here is not the same as URI
-- decoding. If you are turning a URI fragment into a JSON Pointer you
-- must URI decode the Text before using it as an argument to this
-- function. There's an example of how to do this in the tests using
-- "Network.HTTP.Types.URI.urlDecode" from http-types.
unescape :: Text -> Either FormatError Pointer
-- | A glorified type alias. If you need to do JSON Pointer
-- operations you're looking for Token instead.
--
-- NOTE: Unlike Token this is escaped.
newtype Key
Key :: Text -> Key
[_unKey] :: Key -> Text
-- | A glorified type alias. If you need to do JSON Pointer
-- operations you're looking for Token instead.
newtype Index
Index :: Int -> Index
[_unIndex] :: Index -> Int
-- | For internal use (by unescape).
unescapeToken :: Text -> Maybe Token
-- | For internal use (by resolve).
--
-- Might also be useful for specialized applications that don't want to
-- resolve an entire pointer at once.
resolveToken :: Token -> Value -> Either ResolutionError Value
instance GHC.Generics.Generic JSONPointer.Index
instance GHC.Show.Show JSONPointer.Index
instance GHC.Classes.Eq JSONPointer.Index
instance GHC.Generics.Generic JSONPointer.Key
instance GHC.Show.Show JSONPointer.Key
instance GHC.Classes.Eq JSONPointer.Key
instance GHC.Show.Show JSONPointer.FormatError
instance GHC.Classes.Eq JSONPointer.FormatError
instance Test.QuickCheck.Arbitrary.Arbitrary JSONPointer.Pointer
instance GHC.Generics.Generic JSONPointer.Pointer
instance GHC.Base.Monoid JSONPointer.Pointer
instance Data.Semigroup.Semigroup JSONPointer.Pointer
instance GHC.Show.Show JSONPointer.Pointer
instance GHC.Classes.Eq JSONPointer.Pointer
instance GHC.Generics.Generic JSONPointer.Token
instance GHC.Show.Show JSONPointer.Token
instance GHC.Classes.Eq JSONPointer.Token
instance GHC.Show.Show JSONPointer.ResolutionError
instance GHC.Classes.Eq JSONPointer.ResolutionError
instance Data.Hashable.Class.Hashable JSONPointer.Pointer
instance Data.Aeson.Types.FromJSON.FromJSON JSONPointer.Pointer
instance Data.Aeson.Types.ToJSON.ToJSON JSONPointer.Pointer
instance Data.Hashable.Class.Hashable JSONPointer.Token
instance Test.QuickCheck.Arbitrary.Arbitrary JSONPointer.Token
instance Data.Hashable.Class.Hashable JSONPointer.Key
instance Data.Hashable.Class.Hashable JSONPointer.Index