From 6c7f4c7f433322e8dbeff0ab33df0026265a16ac Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Sun, 11 Jun 2023 13:21:14 +0200 Subject: [PATCH 1/2] Updated Stack setup to LTS 19 (GHC 9.0.2) --- dhall/src/Dhall/TH.hs | 27 +++++++++++++++++---------- stack.yaml | 14 +++++++------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/dhall/src/Dhall/TH.hs b/dhall/src/Dhall/TH.hs index ed08d0334..1584398bd 100644 --- a/dhall/src/Dhall/TH.hs +++ b/dhall/src/Dhall/TH.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} @@ -60,7 +61,7 @@ import qualified Numeric.Natural import qualified Prettyprinter.Render.String as Pretty import qualified System.IO - + {-| This fully resolves, type checks, and normalizes the expression, so the resulting AST is self-contained. @@ -160,9 +161,9 @@ toNestedHaskellType typeParams haskellTypes = loop , " \n" , "... which did not fit any of the above criteria." ] - + message dhallType = Pretty.renderString (Dhall.Pretty.layout (document dhallType)) - + loop dhallType = case dhallType of Bool -> return (ConT ''Bool) @@ -203,7 +204,7 @@ toNestedHaskellType typeParams haskellTypes = loop haskellElementType <- loop dhallElementType return (AppT haskellAppType haskellElementType) - + Var v | Just (V param index) <- List.find (v ==) typeParams -> do let name = Syntax.mkName $ (Text.unpack param) ++ (show index) @@ -255,7 +256,7 @@ toDeclaration generateOptions@GenerateOptions{..} haskellTypes typ = MultipleConstructors{..} -> uncurry (fromMulti typeName) $ getTypeParams code where getTypeParams = first numberConsecutive . getTypeParams_ [] - + getTypeParams_ acc (Lam _ (FunctionBinding _ v _ _ _) rest) = getTypeParams_ (v:acc) rest getTypeParams_ acc rest = (acc, rest) @@ -263,7 +264,13 @@ toDeclaration generateOptions@GenerateOptions{..} haskellTypes typ = interpretOptions = generateToInterpretOptions generateOptions typ - toTypeVar (V n i) = Syntax.PlainTV $ Syntax.mkName (Text.unpack n ++ show i) +#if MIN_VERSION_template_haskell(2,17,0) + toTypeVar :: Var -> Syntax.TyVarBndr () + toTypeVar (V n i) = Syntax.PlainTV (Syntax.mkName (Text.unpack n ++ show i)) () +#else + toTypeVar :: Var -> Syntax.TyVarBndr + toTypeVar (V n i) = Syntax.PlainTV (Syntax.mkName (Text.unpack n ++ show i)) +#endif toDataD typeName typeParams constructors = do let name = Syntax.mkName (Text.unpack typeName) @@ -277,16 +284,16 @@ toDeclaration generateOptions@GenerateOptions{..} haskellTypes typ = fromSingle typeName constructorName typeParams dhallType = do constructor <- toConstructor typeParams generateOptions haskellTypes typeName (constructorName, Just dhallType) - + toDataD typeName typeParams [constructor] - + fromMulti typeName typeParams dhallType = case dhallType of Union kts -> do constructors <- traverse (toConstructor typeParams generateOptions haskellTypes typeName) (Dhall.Map.toList kts) toDataD typeName typeParams constructors - - _ -> fail $ message dhallType + + _ -> fail $ message dhallType message dhallType = Pretty.renderString (Dhall.Pretty.layout $ document dhallType) diff --git a/stack.yaml b/stack.yaml index 887dcd8a3..51cf88999 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-18.18 +resolver: lts-19.33 packages: - dhall - dhall-bash @@ -11,12 +11,12 @@ packages: - dhall-toml - dhall-yaml extra-deps: - - hnix-0.16.0 - - hnix-store-core-0.5.0.0 - - hnix-store-remote-0.5.0.0 - - lucid-2.11.0 - - relude-1.0.0.1@sha256:35bcdaf14018e79f11e712b0e2314c1aac79976f28f4adc179985457493557d5,11569 - - semialign-1.2@sha256:9afb6eb7e50db7ca34d7c4108aec0f643dae2caaaa80394b44ffdd643315685c,2721 + - github: haskell-nix/hnix + commit: 2adbc502e62e755ca0372c913e6278ebe564d7d2 + - hnix-store-core-0.6.1.0 + - hnix-store-remote-0.6.0.0 + - tomland-1.3.3.2 + - validation-selective-0.1.0.2 nix: packages: - ncurses From 576721f50c6d6a89ae29624c5edaf05a3868bab7 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Sun, 11 Jun 2023 13:54:25 +0200 Subject: [PATCH 2/2] Updated GitHub Actions --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a9ef6421a..56bc5a5aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,16 +26,16 @@ jobs: runs-on: ${{ matrix.os.runner }} steps: - name: "Checkout repository" - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: submodules: true - id: setup-haskell-cabal name: "Setup Haskell environment" - uses: haskell/actions/setup@v1.2.1 + uses: haskell/actions/setup@v2 with: enable-stack: true - name: "Cache" - uses: actions/cache@v2 + uses: actions/cache@v3 with: key: ${{ matrix.os.runner }}-${{ hashFiles('stack.yaml') }}-${{ env.cache_generation }} restore-keys: | @@ -143,7 +143,7 @@ jobs: package 'dhall-toml' "bin/dhall-to-toml${exe}" "bin/toml-to-dhall${exe}" package 'dhall-yaml' "bin/dhall-to-yaml-ng${exe}" "bin/yaml-to-dhall${exe}" - name: "Upload package" - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: 'dhall-${{runner.os}}.${{matrix.os.file-extension}}' path: 'dhall-*${{runner.os}}.${{matrix.os.file-extension}}'