Establish host properties and isolated kind matrix
This commit is contained in:
parent
84ccfdb445
commit
06d1383456
1 changed files with 1076 additions and 120 deletions
|
|
@ -14,17 +14,21 @@ import Data.Char (isControl)
|
|||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.Encoding as TE
|
||||
import qualified Data.Text.Normalize as TN
|
||||
import Nuthatch.Types
|
||||
|
||||
validateRelativePath :: Text -> Either Text RelativePath
|
||||
validateRelativePath raw = do
|
||||
let path = T.dropWhile (== '/') raw
|
||||
if T.null path
|
||||
if T.null raw
|
||||
then Left "path must not be empty"
|
||||
else if T.head raw == '/' || T.last raw == '/'
|
||||
then Left "path must not begin or end with a separator"
|
||||
else if TN.normalize TN.NFC raw /= raw
|
||||
then Left "path must be NFC-normalized"
|
||||
else do
|
||||
let segments = T.splitOn "/" path
|
||||
let segments = T.splitOn "/" raw
|
||||
mapM_ validateSegment segments
|
||||
pure (RelativePath path)
|
||||
pure (RelativePath raw)
|
||||
where
|
||||
validateSegment seg
|
||||
| T.null seg = Left "empty path segment"
|
||||
|
|
|
|||
Loading…
Reference in a new issue