diff options
Diffstat (limited to 'src/Store/Query/Field.hs')
-rw-r--r-- | src/Store/Query/Field.hs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/Store/Query/Field.hs b/src/Store/Query/Field.hs index 69a0983..3078a34 100644 --- a/src/Store/Query/Field.hs +++ b/src/Store/Query/Field.hs @@ -9,23 +9,19 @@ import Data.Aeson qualified as J import Data.Aeson.Key qualified as JK import Data.Aeson.KeyMap qualified as JM import Data.List (intercalate) -import Data.List.NonEmpty qualified as N import Data.Text qualified as T data Field - = Qualified Collection (N.NonEmpty T.Text) - | Unqualified (N.NonEmpty T.Text) + = Field Collection [T.Text] deriving (Show) toString :: Field -> String -toString (Qualified c ks) = intercalate "." (c : map T.unpack (N.toList ks)) -toString (Unqualified ks) = intercalate "." (map T.unpack (N.toList ks)) +toString (Field c ks) = intercalate "." (c : map T.unpack ks) type Collection = FilePath prefix :: Field -> J.Value -> J.Value -prefix (Qualified c ks) = prefix' (T.pack c : N.toList ks) -prefix (Unqualified ks) = prefix' (N.toList ks) +prefix (Field c ks) = prefix' (T.pack c : ks) prefix' :: [T.Text] -> J.Value -> J.Value prefix' ks v = |