Skip to content

Commit

Permalink
Merge pull request #26 from input-output-hk/nc/ghc810
Browse files Browse the repository at this point in the history
Support compilation under GHC8.10
  • Loading branch information
nc6 authored Apr 23, 2024
2 parents 2e044c1 + a851663 commit c43f828
Show file tree
Hide file tree
Showing 13 changed files with 200 additions and 254 deletions.
3 changes: 2 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
use flake . --impure
watch_file project.ncl
use flake
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ghc: ["9.2.8", "9.6.3", "9.8.1"]
ghc: ["8.10.7", "9.2.8", "9.6.4", "9.8.1"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 2 additions & 4 deletions bin/Main.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE NoFieldSelectors #-}

module Main (main) where

Expand Down Expand Up @@ -131,8 +129,8 @@ run (Opts cmd cddlFile) = do
Left err -> putStrLnErr (show err) >> exitFailure
Right mt -> do
stdGen <- getStdGen
let term = generateCBORTerm mt (Name x.itemName) stdGen
in case x.outputFormat of
let term = generateCBORTerm mt (Name $ itemName x) stdGen
in case outputFormat x of
AsTerm -> print term
AsFlatTerm -> print $ toFlatTerm (encodeTerm term)
AsCBOR -> print . toStrictByteString $ encodeTerm term
Expand Down
45 changes: 33 additions & 12 deletions cuddle.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,29 @@ extra-doc-files: CHANGELOG.md
common warnings
ghc-options: -Wall

common ghc2021
-- These options are all on by default in GHC2021, so once we drop GHC8 we
-- can remove this section.
default-extensions:
DataKinds
DeriveGeneric
DeriveTraversable
FlexibleContexts
FlexibleInstances
GeneralizedNewtypeDeriving
ImportQualifiedPost
InstanceSigs
MultiParamTypeClasses
NamedFieldPuns
PolyKinds
RankNTypes
ScopedTypeVariables
StandaloneDeriving
TypeApplications
TypeSynonymInstances

library
import: warnings
import: warnings, ghc2021
exposed-modules:
Codec.CBOR.Cuddle.CBOR.Gen
Codec.CBOR.Cuddle.CDDL
Expand All @@ -36,7 +57,7 @@ library

-- other-extensions:
build-depends:
, base ^>=4.16.3.0 || ^>=4.18.1.0 || ^>=4.19.0.0
, base ^>=4.14.3.0 || ^>=4.16.3.0 || ^>=4.18.1.0 || ^>=4.19.0.0
, bytestring
, capability
, cborg
Expand All @@ -54,31 +75,31 @@ library
, text

hs-source-dirs: src
default-language: GHC2021
default-language: Haskell2010

executable example
import: warnings
default-language: GHC2021
import: warnings, ghc2021
default-language: Haskell2010
other-modules: Conway

-- other-extensions:
hs-source-dirs: example
main-is: Main.hs
build-depends:
, base ^>=4.16.3.0 || ^>=4.18.1.0 || ^>=4.19.0.0
, base ^>=4.14.3.0 || ^>=4.16.3.0 || ^>=4.18.1.0 || ^>=4.19.0.0
, cuddle
, megaparsec
, prettyprinter
, random
, text

executable cuddle
import: warnings
default-language: GHC2021
import: warnings, ghc2021
default-language: Haskell2010
hs-source-dirs: ./bin/
main-is: Main.hs
build-depends:
, base ^>=4.16.3.0 || ^>=4.18.1.0 || ^>=4.19.0.0
, base ^>=4.14.3.0 || ^>=4.16.3.0 || ^>=4.18.1.0 || ^>=4.19.0.0
, cborg
, cuddle
, megaparsec
Expand All @@ -88,8 +109,8 @@ executable cuddle
, text

test-suite cuddle-test
import: warnings
default-language: GHC2021
import: warnings, ghc2021
default-language: Haskell2010
other-modules:
Test.Codec.CBOR.Cuddle.CDDL.Gen
Test.Codec.CBOR.Cuddle.CDDL.Parser
Expand All @@ -100,7 +121,7 @@ test-suite cuddle-test
hs-source-dirs: test
main-is: Main.hs
build-depends:
, base ^>=4.16.3.0 || ^>=4.18.1.0 || ^>=4.19.0.0
, base ^>=4.14.3.0 || ^>=4.16.3.0 || ^>=4.18.1.0 || ^>=4.19.0.0
, cuddle
, hspec
, hspec-megaparsec
Expand Down
Loading

0 comments on commit c43f828

Please sign in to comment.