Skip to content

Commit 72b0cbd

Browse files
authored
Merge pull request #37 from serokell/gromak/#36-new-resolver
[#36] Switch to lts-15.13
2 parents 2a29c79 + 4f94e4a commit 72b0cbd

7 files changed

Lines changed: 31 additions & 25 deletions

File tree

nix/sources.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"homepage": "https://input-output-hk.github.io/haskell.nix",
66
"owner": "input-output-hk",
77
"repo": "haskell.nix",
8-
"rev": "0933c58908816bca525fbf8873abdbc3e072a87e",
9-
"sha256": "1shgaaqj0j2d5f7967xssp69nn6dv34dfvkvqkiakb99ggycgdyg",
8+
"rev": "db409cf3a0b10a7309a8102bb6a00d8870b9c67e",
9+
"sha256": "0j4grhzfrd966cwni9glycdjivzmb45dga4hqhwniajc6kdyj0h4",
1010
"type": "tarball",
11-
"url": "https://github.com/input-output-hk/haskell.nix/archive/0933c58908816bca525fbf8873abdbc3e072a87e.tar.gz",
11+
"url": "https://github.com/input-output-hk/haskell.nix/archive/db409cf3a0b10a7309a8102bb6a00d8870b9c67e.tar.gz",
1212
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
1313
},
1414
"nixpkgs": {

package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ default-extensions:
3333
- FunctionalDependencies
3434
- GeneralizedNewtypeDeriving
3535
- LambdaCase
36-
- MonadFailDesugaring
3736
- MultiParamTypeClasses
3837
- MultiWayIf
3938
- NamedFieldPuns
@@ -74,6 +73,7 @@ dependencies:
7473
- http-types
7574
- lens
7675
- pretty-terminal
76+
- modern-uri
7777
- mtl
7878
- o-clock
7979
- optparse-applicative

src/Xrefcheck/Core.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{- SPDX-FileCopyrightText: 2018-2019 Serokell <https://serokell.io>
1+
{- SPDX-FileCopyrightText: 2018-2020 Serokell <https://serokell.io>
22
-
33
- SPDX-License-Identifier: MPL-2.0
44
-}
@@ -9,7 +9,6 @@
99

1010
module Xrefcheck.Core where
1111

12-
import Control.DeepSeq (NFData)
1312
import Control.Lens (makeLenses, (%=))
1413
import Data.Char (isAlphaNum)
1514
import qualified Data.Char as C

src/Xrefcheck/Verify.hs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,21 @@ module Xrefcheck.Verify
2323
) where
2424

2525
import Control.Concurrent.Async (forConcurrently, withAsync)
26-
import Control.Monad.Except (ExceptT, MonadError (..))
26+
import Control.Monad.Except (MonadError (..))
2727
import qualified Data.Map as M
2828
import qualified Data.Text as T
2929
import Data.Text.Metrics (damerauLevenshteinNorm)
3030
import Fmt (Buildable (..), blockListF', listF, (+|), (|+))
3131
import qualified GHC.Exts as Exts
3232
import Network.HTTP.Client (HttpException (..), HttpExceptionContent (..), responseStatus)
3333
import Network.HTTP.Req (GET (..), HEAD (..), HttpException (..), NoReqBody (..), defaultHttpConfig,
34-
ignoreResponse, parseUrl, req, runReq)
34+
ignoreResponse, req, runReq, useURI)
3535
import Network.HTTP.Types.Status (Status, statusCode, statusMessage)
3636
import System.Console.Pretty (Style (..), style)
3737
import System.Directory (canonicalizePath, doesDirectoryExist, doesFileExist)
3838
import System.FilePath (takeDirectory, (</>))
3939
import qualified System.FilePath.Glob as Glob
40+
import Text.URI (mkURI)
4041
import Time (RatioNat, Second, Time (..), ms, threadDelay, timeout)
4142

4243
import Xrefcheck.Config
@@ -94,6 +95,7 @@ data VerifyError
9495
| AnchorDoesNotExist Text [Anchor]
9596
| AmbiguousAnchorRef FilePath Text (NonEmpty Anchor)
9697
| ExternalResourceInvalidUri
98+
| ExternalResourceUnknownProtocol
9799
| ExternalResourceUnavailable Status
98100
| ExternalResourceSomeError Text
99101
deriving (Show)
@@ -113,6 +115,8 @@ instance Buildable VerifyError where
113115
" Use of such anchors is discouraged because referenced object\n\
114116
\ can change silently whereas the document containing it evolves.\n"
115117
ExternalResourceInvalidUri ->
118+
"⛂ Invalid url\n"
119+
ExternalResourceUnknownProtocol ->
116120
"⛂ Bad url (expected 'http' or 'https')\n"
117121
ExternalResourceUnavailable status ->
118122
"⛂ Resource unavailable (" +| statusCode status |+ " " +|
@@ -257,8 +261,10 @@ checkExternalResource VerifyConfig{..} link
257261

258262
makeRequest :: _ => method -> RatioNat -> IO (Either VerifyError ())
259263
makeRequest method timeoutFrac = runExceptT $ do
260-
parsedUrl <- parseUrl (encodeUtf8 link)
261-
& maybe (throwError ExternalResourceInvalidUri) pure
264+
uri <- mkURI link
265+
& maybe (throwError ExternalResourceInvalidUri) pure
266+
parsedUrl <- useURI uri
267+
& maybe (throwError ExternalResourceUnknownProtocol) pure
262268
let reqLink = case parsedUrl of
263269
Left (url, option) ->
264270
runReq defaultHttpConfig $

stack.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# SPDX-FileCopyrightText: 2018-2019 Serokell <https://serokell.io>
1+
# SPDX-FileCopyrightText: 2018-2020 Serokell <https://serokell.io>
22
#
33
# SPDX-License-Identifier: MPL-2.0
44

5-
resolver: lts-14.16
5+
resolver: lts-15.13
66

77
packages:
88
- .
@@ -11,5 +11,5 @@ extra-deps:
1111
- pretty-terminal-0.1.0.0
1212
- roman-numerals-0.5.1.5
1313
- aeson-options-0.1.0
14-
- o-clock-1.1.0
1514
- with-utf8-1.0.0.0
15+
- th-utilities-0.2.4.0@sha256:ba19cd8441aa43dbaed40e9055bb5a7cbd7cf9e154f5253c6bf9293af8b1f96b,1869

stack.yaml.lock

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ packages:
2525
sha256: 4a3ddbdaa61d788155aac6e7601d429a8820441f7b5e31d417b2dbdbf9748be2
2626
original:
2727
hackage: aeson-options-0.1.0
28-
- completed:
29-
hackage: o-clock-1.1.0@sha256:941ac2bc1732e6622b165831c4badb1a8e846f451620bd028064339f5b284224,5043
30-
pantry-tree:
31-
size: 1043
32-
sha256: 177f9923edf9494c6a1bb1c02bbf38e6bd3675e2245effaeaa9a7f76c893d7a6
33-
original:
34-
hackage: o-clock-1.1.0
3528
- completed:
3629
hackage: with-utf8-1.0.0.0@sha256:686e47588986d8080451b4e617118b579487dd4e085bba7bb36fac4198c90ae6,2480
3730
pantry-tree:
3831
size: 905
3932
sha256: 39176872f0dde9f9e09c9cb9496e2b7b10fa17cb9a6eca8d40ca4b2dcaaacc11
4033
original:
4134
hackage: with-utf8-1.0.0.0
35+
- completed:
36+
hackage: th-utilities-0.2.4.0@sha256:ba19cd8441aa43dbaed40e9055bb5a7cbd7cf9e154f5253c6bf9293af8b1f96b,1869
37+
pantry-tree:
38+
size: 882
39+
sha256: 8c577d112a8398a5542aa4205b2e8a470a66d57590e6606d752d71e75d7425ea
40+
original:
41+
hackage: th-utilities-0.2.4.0@sha256:ba19cd8441aa43dbaed40e9055bb5a7cbd7cf9e154f5253c6bf9293af8b1f96b,1869
4242
snapshots:
4343
- completed:
44-
size: 524804
45-
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/16.yaml
46-
sha256: 4d1519a4372d051d47a5eae2241cf3fb54e113d7475f89707ddb6ec06add2888
47-
original: lts-14.16
44+
size: 496112
45+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/13.yaml
46+
sha256: 75a1a0f870e1876898b117b0e443f911b3fa2985bfabb53158c81ab5765beda5
47+
original: lts-15.13

xrefcheck.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{ static ? false }:
66
let
77
sources = import ./nix/sources.nix;
8-
nixpkgs = import sources.nixpkgs (import sources."haskell.nix");
8+
nixpkgs = import sources.nixpkgs (import sources."haskell.nix" {}).nixpkgsArgs;
99
pkgs = if static then nixpkgs.pkgsCross.musl64 else nixpkgs;
1010
project = pkgs.haskell-nix.stackProject {
1111
src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
@@ -15,6 +15,7 @@ let
1515
configureFlags = with pkgs;
1616
lib.optionals static [
1717
"--ghc-option=-optl=-L${zlib.static}/lib"
18+
"--ghc-option=-optl=-L${nixpkgs.pkgsStatic.numactl}/lib"
1819
];
1920
};
2021
}];

0 commit comments

Comments
 (0)