Skip to content

Commit dd92324

Browse files
committed
add atKey convenience function
1 parent 7bb8ef7 commit dd92324

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/JSONPointer/Model.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module JSONPointer.Model
22
( JSONPointer
33
, run
44
, atIndexOrKey
5+
, atKey
56
)
67
where
78

@@ -46,3 +47,9 @@ run (JSONPointer fn) = fn
4647
{-# INLINE atIndexOrKey #-}
4748
atIndexOrKey :: Maybe Int -> T.Text -> JSONPointer
4849
atIndexOrKey index key = JSONPointer $ \handler -> handler index key
50+
51+
-- |
52+
-- Constructs JSON Pointer from a textual key.
53+
{-# INLINE atKey #-}
54+
atKey :: T.Text -> JSONPointer
55+
atKey = atIndexOrKey Nothing

0 commit comments

Comments
 (0)