summaryrefslogtreecommitdiff
path: root/lib/Uris.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Uris.hs')
-rw-r--r--lib/Uris.hs18
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