From 868194be1f8da4d434498247dea715c2aa5ff869 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sat, 15 Jan 2022 00:46:30 +0100 Subject: use hpack and clean up modules as annoying as yaml is, cabal's package format is somehow worse, apparently --- lib/Uris.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/Uris.hs') 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 -- cgit v1.2.3