diff options
author | stuebinm | 2022-01-15 00:46:30 +0100 |
---|---|---|
committer | stuebinm | 2022-01-15 00:47:41 +0100 |
commit | 868194be1f8da4d434498247dea715c2aa5ff869 (patch) | |
tree | 12bd386b6c05a61fec32836fc808d3d0d2e919a2 /lib/Uris.hs | |
parent | 98faf732052c24766b0abfc38ce6b7178c226a61 (diff) |
use hpack and clean up modules
as annoying as yaml is, cabal's package format is somehow worse, apparently
Diffstat (limited to '')
-rw-r--r-- | lib/Uris.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/Uris.hs b/lib/Uris.hs index 22b36eb..00f86a4 100644 --- a/lib/Uris.hs +++ b/lib/Uris.hs @@ -22,12 +22,12 @@ import Data.Text (Text, pack, unpack) import qualified Data.Text as T import GHC.Generics (Generic) import GHC.TypeLits (KnownSymbol, symbolVal) +import Network.URI.Encode as URI import Text.Regex.TDFA ((=~)) -import Witherable (mapMaybe) -import Network.URI.Encode as URI +import Witherable (mapMaybe) -import Network.URI as NativeUri -import Data.String +import Data.String +import Network.URI as NativeUri data Substitution = Prefixed { prefix :: Text, blocked :: [Text], allowed :: [Text], scope :: [String] } @@ -48,7 +48,7 @@ type SchemaSet = [(Text, Substitution)] extractDomain :: Text -> Maybe Text extractDomain url = case parseUri url of - Nothing -> Nothing + Nothing -> Nothing Just (_,domain,_) -> Just domain @@ -60,13 +60,13 @@ parseUri uri = Nothing -> Nothing Just parsedUri -> case uriAuthority parsedUri of Nothing -> Nothing - -- https: + -- https: Just uriAuth -> Just (T.replace (fromString ":") (fromString "") (fromString (uriScheme parsedUri )), - -- //anonymous@ www.haskell.org :42 + -- //anonymous@ www.haskell.org :42 fromString(uriUserInfo uriAuth++uriRegName uriAuth ++ uriPort uriAuth), -- /ghc ?query #frag fromString(uriPath parsedUri ++ uriQuery parsedUri ++ uriFragment parsedUri)) - + data SubstError = SchemaDoesNotExist Text @@ -94,7 +94,7 @@ applySubsts s substs uri = do [] -> Left (SchemaDoesNotExist schema) results@(_:_) -> case mapMaybe rightToMaybe results of suc:_ -> Right suc - _ -> minimum results + _ -> minimum results where note = maybeToRight |