diff options
Diffstat (limited to 'Biz/Namespace.hs')
-rw-r--r-- | Biz/Namespace.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Biz/Namespace.hs b/Biz/Namespace.hs index cdc4464..72e3fa1 100644 --- a/Biz/Namespace.hs +++ b/Biz/Namespace.hs @@ -19,9 +19,11 @@ where import Alpha import qualified Data.Aeson as Aeson +import qualified Data.Aeson.Types as Aeson import qualified Data.Char as Char import qualified Data.List as List import qualified Data.List.Split as List +import qualified Data.Text as Text import qualified Text.Regex.Applicative as Regex data Ext @@ -43,6 +45,9 @@ data Ext data Namespace = Namespace {path :: [String], ext :: Ext} deriving (Eq, Show, Generic, Aeson.ToJSON, Ord) +instance Aeson.ToJSONKey Namespace where + toJSONKey = Aeson.toJSONKeyText (Text.pack <. toPath) + fromPath :: String -> String -> Maybe Namespace fromPath bizRoot absPath = List.stripPrefix bizRoot absPath |