Skip to content

Commit

Permalink
Add Stack setup for GHC 9.6.5 (#2592)
Browse files Browse the repository at this point in the history
* Bumped upper version bounds of several packages in preperation for GHC 9.6.5 build

* Added some CPP to suppress redundant import warnings

* Added Stack setup for GHC 9.6.5
  • Loading branch information
mmhat committed Jun 17, 2024
1 parent edce221 commit 28d346f
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
- os:
runner: "ubuntu-latest"
stack-yaml: "stack.ghc-9.2.yaml"
- os:
runner: "ubuntu-latest"
stack-yaml: "stack.ghc-9.4.yaml"
fail-fast: false
name: ${{ matrix.os.runner }} - ${{ matrix.stack-yaml }}
runs-on: ${{ matrix.os.runner }}
Expand Down
2 changes: 1 addition & 1 deletion dhall-json/dhall-json.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Library
Hs-Source-Dirs: src
Build-Depends:
base >= 4.11.0.0 && < 5 ,
aeson >= 1.4.6.0 && < 2.2 ,
aeson >= 1.4.6.0 && < 2.3 ,
aeson-pretty >= 0.8.0 && < 0.9 ,
aeson-yaml >= 1.1.0 && < 1.2 ,
bytestring < 0.13,
Expand Down
8 changes: 4 additions & 4 deletions dhall-lsp-server/dhall-lsp-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ library
, dhall-json >= 1.4 && < 1.8
, filepath >= 1.4.2 && < 1.5
, lsp >= 2.1.0.0 && < 2.2
, lens >= 4.16.1 && < 5.3
, lens >= 4.16.1 && < 5.4
-- megaparsec follows SemVer: https://github.com/mrkkrp/megaparsec/issues/469#issuecomment-927918469
, megaparsec >= 7.0.2 && < 10
, mtl >= 2.2.2 && < 2.3
, mtl >= 2.2.2 && < 2.4
, network-uri >= 2.6.1.0 && < 2.7
, prettyprinter >= 1.7.0 && < 1.8
, text >= 1.2.3.0 && < 2.1
, text-rope >= 0.2 && < 0.3
, transformers >= 0.5.5.0 && < 0.6
, transformers >= 0.5.5.0 && < 0.7
, unordered-containers >= 0.2.9.0 && < 0.3
, uri-encode >= 1.5.0.5 && < 1.6
default-language: Haskell2010
Expand Down Expand Up @@ -105,7 +105,7 @@ Test-Suite tests
Build-Depends:
base ,
lsp-types >= 2.0.1 && < 2.1 ,
hspec >= 2.7 && < 2.11 ,
hspec >= 2.7 && < 2.12 ,
lsp-test >= 0.15.0.0 && < 0.16 ,
tasty >= 0.11.2 && < 1.5 ,
tasty-hspec >= 1.1 && < 1.3 ,
Expand Down
4 changes: 2 additions & 2 deletions dhall-nixpkgs/dhall-nixpkgs.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Build-Type: Simple
Executable dhall-to-nixpkgs
Main-Is: Main.hs
Build-Depends: base >= 4.11 && < 5
, aeson >= 1.0.0.0 && < 2.2
, aeson >= 1.0.0.0 && < 2.3
, base16-bytestring >= 1.0.0.0
, base64-bytestring >= 1.1.0.0
, bytestring < 0.12
Expand All @@ -33,7 +33,7 @@ Executable dhall-to-nixpkgs
, optparse-applicative >= 0.14.0.0 && < 0.19
, prettyprinter >= 1.7.0 && < 1.8
, text >= 0.11.1.0 && < 2.1
, transformers >= 0.2.0.0 && < 0.6
, transformers >= 0.2.0.0 && < 0.7
, turtle >= 1.6 && < 1.7
, network-uri < 2.8
Default-Language: Haskell2010
Expand Down
8 changes: 7 additions & 1 deletion dhall/src/Dhall/Import/Headers.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}
Expand All @@ -9,7 +10,12 @@ module Dhall.Import.Headers
, toOriginHeaders
) where

import Control.Applicative (Alternative (..), liftA2)
import Control.Applicative
( Alternative (..)
#if !MIN_VERSION_base(4,18,0)
, liftA2
#endif
)
import Control.Exception (SomeException)
import Control.Monad.Catch (handle, throwM)
import Data.Text (Text)
Expand Down
59 changes: 32 additions & 27 deletions dhall/src/Dhall/Marshal/Decode.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DerivingStrategies #-}
Expand Down Expand Up @@ -135,7 +136,12 @@ module Dhall.Marshal.Decode
) where


import Control.Applicative (empty, liftA2)
import Control.Applicative
( empty
#if !MIN_VERSION_base(4,18,0)
, liftA2
#endif
)
import Control.Exception (Exception)
import Control.Monad (guard)
import Control.Monad.Trans.State.Strict
Expand Down Expand Up @@ -1604,14 +1610,15 @@ data ExtractError s a =
instance (Pretty s, Pretty a, Typeable s, Typeable a) => Show (ExtractError s a) where
show (TypeMismatch e) = show e
show (ExpectedTypeError e) = show e
show (ExtractError es) =
_ERROR <> ": Failed extraction \n\
\ \n\
\The expression type-checked successfully but the transformation to the target \n\
\type failed with the following error: \n\
\ \n\
\" <> Data.Text.unpack es <> "\n\
\ \n"
show (ExtractError es) = unlines
[ _ERROR <> ": Failed extraction "
, " "
, "The expression type-checked successfully but the transformation to the target "
, "type failed with the following error: "
, " "
, Data.Text.unpack es
, " "
]

instance (Pretty s, Pretty a, Typeable s, Typeable a) => Exception (ExtractError s a)

Expand Down Expand Up @@ -1669,24 +1676,22 @@ data InvalidDecoder s a = InvalidDecoder
instance (Pretty s, Typeable s, Pretty a, Typeable a) => Exception (InvalidDecoder s a)

instance (Pretty s, Pretty a, Typeable s, Typeable a) => Show (InvalidDecoder s a) where
show InvalidDecoder { .. } =
_ERROR <> ": Invalid Dhall.Decoder \n\
\ \n\
\Every Decoder must provide an extract function that does not fail with a type \n\
\error if an expression matches the expected type. You provided a Decoder that \n\
\disobeys this contract \n\
\ \n\
\The Decoder provided has the expected dhall type: \n\
\ \n\
\" <> show txt0 <> "\n\
\ \n\
\and it threw a type error during extraction from the well-typed expression: \n\
\ \n\
\" <> show txt1 <> "\n\
\ \n"
where
txt0 = Dhall.Util.insert invalidDecoderExpected
txt1 = Dhall.Util.insert invalidDecoderExpression
show InvalidDecoder { .. } = unlines
[ _ERROR <> ": Invalid Dhall.Decoder "
, " "
, "Every Decoder must provide an extract function that does not fail with a type "
, "error if an expression matches the expected type. You provided a Decoder that "
, "disobeys this contract "
, " "
, "The Decoder provided has the expected dhall type: "
, " "
, show (Dhall.Util.insert invalidDecoderExpected)
, " "
, "and it threw a type error during extraction from the well-typed expression: "
, " "
, show (Dhall.Util.insert invalidDecoderExpression)
, " "
]

{-| Useful synonym for the `Validation` type used when marshalling Dhall
expressions.
Expand Down
7 changes: 6 additions & 1 deletion dhall/src/Dhall/Parser/Combinators.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ module Dhall.Parser.Combinators
) where


import Control.Applicative (Alternative (..), liftA2)
import Control.Applicative
( Alternative (..)
#if !MIN_VERSION_base(4,18,0)
, liftA2
#endif
)
import Control.Exception (Exception)
import Control.Monad (MonadPlus (..))
import Data.String (IsString (..))
Expand Down
9 changes: 8 additions & 1 deletion dhall/src/Dhall/Parser/Expression.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
Expand All @@ -7,7 +8,13 @@
-- | Parsing Dhall expressions.
module Dhall.Parser.Expression where

import Control.Applicative (Alternative (..), liftA2, optional)
import Control.Applicative
( Alternative (..)
#if !MIN_VERSION_base(4,18,0)
, liftA2
#endif
, optional
)
import Data.Foldable (foldl')
import Data.List.NonEmpty (NonEmpty (..))
import Data.Text (Text)
Expand Down
32 changes: 32 additions & 0 deletions stack.ghc-9.6.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
resolver: lts-22.23
packages:
- dhall
- dhall-bash
- dhall-csv
- dhall-docs
- dhall-json
- dhall-lsp-server
- dhall-nix
- dhall-openapi
- dhall-toml
- dhall-yaml
extra-deps:
- lsp-test-0.15.0.1
- algebraic-graphs-0.6.1@sha256:b0b0a916a74f9cba3e678cde25e27f045d7b026a8d0f1a55a05e86f2877fdfd2,8807
- free-5.1.10@sha256:58496bb68e5704be250ddc823622d50b5a3b8bdf0dc4f6539ecfde25bc4ef6e2,5169
- hnix-0.17.0@sha256:57e172f915d70be2dd88c6377caebe8bd63337123ffef42df49b05dc0b1f168b,19224
- hnix-store-core-0.6.1.0@sha256:0171c3a571ab263c3e3aa3e6daca15602f2030a6862cb032038017e6d0265898,3882
- hnix-store-remote-0.6.0.0@sha256:a8ea18bb355164bfd357fac12b0c5d32c95ffd455260f8b6c7fcaeddebf5918c,3270
- lens-family-th-0.5.3.1@sha256:725700a89f26f790ee7d6630a4fa394ac0305ae8d2cff06c037ee47cb3499654,1700
- lsp-2.1.0.0@sha256:ef6fc28eac6dc27672cd8471c9f83f14de646a9c1fcaf993a451d2ae4de274e8,3533
- lsp-types-2.0.2.0@sha256:a9a51c3cea0726d91fe63fa0670935ee720f7b31bc3f3b33b2483fc538152677,29421
- tomland-1.3.3.2@sha256:8dd15cd2e8178a9bc3c3db4ef53e706e36ee093417a98b1d26131524629c3c07,9483
- validation-selective-0.2.0.0@sha256:cc847f1a110e3b1bd437a5356f115881b61cafcb11781b570b180efd88bf0907,3917
nix:
packages:
- ncurses
- zlib
flags:
# https://github.com/RyanGlScott/mintty/issues/4
mintty:
Win32-2-13-1: false
2 changes: 1 addition & 1 deletion stack.yaml

0 comments on commit 28d346f

Please sign in to comment.