Skip to content

Commit

Permalink
Merge pull request #63 from clash-lang/bump-ghc-dep
Browse files Browse the repository at this point in the history
Support GHC 9.2, 9.4, and 9.6
  • Loading branch information
martijnbastiaan authored Feb 19, 2024
2 parents 401ad10 + f58eef0 commit eb76cd1
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 13 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Stack / GHC
uses: haskell/actions/setup@v1
uses: haskell-actions/setup@v2
with:
ghc-version: '8.10.7' # Exact version of ghc to use
ghc-version: '8.10.7'
cabal-version: '3.10.2.1'
enable-stack: true
stack-version: 'latest'

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.stack
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }}
Expand Down Expand Up @@ -56,20 +57,28 @@ jobs:
- "1.6.1"
- "1.8.1"
cabal:
- "3.6"
- "3.10"
ghc:
- "8.10.7"
- "9.0.2"
- "9.2.8"
- "9.4.8"
- "9.6.4"
exclude:
# Clash 1.6 doesn't support latest GHCs
- {clash: "1.6.1", ghc: "9.2.8"}
- {clash: "1.6.1", ghc: "9.4.8"}
- {clash: "1.6.1", ghc: "9.6.4"}

env:
clash_version: ${{ matrix.clash }}

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Haskell
uses: haskell/actions/setup@v1
uses: haskell-actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
Expand All @@ -85,7 +94,7 @@ jobs:
mv cabal.project.freeze frozen
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
Expand All @@ -111,7 +120,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Whitespace
run: |
Expand Down
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package clash-prelude
source-repository-package
type: git
location: https://github.com/cchalmers/circuit-notation.git
tag: 565d4811cff6a597ee577dabd81b460e941fcb14
tag: 19b386c4aa3ff690758ae089c7754303f3500cc9

package clash-protocols
-- Reduces compile times by ~20%
Expand Down
2 changes: 1 addition & 1 deletion clash-protocols.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ library
, data-default
, deepseq
, extra
, ghc >= 8.7
, ghc >= 8.7 && < 9.7
, hashable
, hedgehog >= 1.0.2
, mtl
Expand Down
8 changes: 7 additions & 1 deletion src/Protocols/Df.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ carries data, no metadata. For documentation see:

{-# OPTIONS_GHC -fno-warn-orphans #-}

-- TODO: Fix warnings introduced by GHC 9.2 w.r.t. incomplete lazy pattern matches
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}

module Protocols.Df
( -- * Types
Df, Data(..)
Expand Down Expand Up @@ -59,7 +62,10 @@ module Protocols.Df
) where

-- base
import Control.Applicative (Alternative((<|>)), Applicative(liftA2))
#if !MIN_VERSION_base(4,18,0)
import Control.Applicative (Applicative(liftA2))
#endif
import Control.Applicative (Alternative((<|>)))
import Control.DeepSeq (NFData)
import GHC.Generics (Generic)
import GHC.Stack (HasCallStack)
Expand Down
1 change: 1 addition & 0 deletions src/Protocols/Plugin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ plugin = CN.mkPlugin $ CN.ExternalNames
, CN.tagName = CN.thName 'Tagged
, CN.tagTName = CN.thName ''Tagged
, CN.trivialBwd = CN.thName 'units
, CN.consPat = CN.thName '(:>!)
}
11 changes: 11 additions & 0 deletions src/Protocols/Plugin/Internal.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE PatternSynonyms #-}

{-# OPTIONS_HADDOCK hide #-}

module Protocols.Plugin.Internal where

import Clash.Explicit.Prelude

import Data.Tagged
import Protocols.Internal

Expand All @@ -30,3 +33,11 @@ taggedCircuit (Circuit c) (aFwd, bBwd) =
pattern TaggedCircuit :: TaggedCircuitT a b -> Circuit a b
pattern TaggedCircuit f <- (taggedCircuit -> f) where
TaggedCircuit f = unTaggedCircuit f

-- | Unsafe version of ':>'. Will fail if applied to empty vectors. This is used to
-- work around spurious incomplete pattern match warnings generated in newer GHC
-- versions.
pattern (:>!) :: a -> Vec n a -> Vec (n + 1) a
pattern (:>!) x xs <- (\ys -> (head ys, tail ys) -> (x,xs))
{-# COMPLETE (:>!) #-}
infixr 5 :>!
3 changes: 3 additions & 0 deletions src/Protocols/Wishbone/Standard/Hedgehog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE MultiWayIf #-}

-- TODO: Fix warnings introduced by GHC 9.2 w.r.t. incomplete lazy pattern matches
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}

-- |
-- Types and functions to aid with testing Wishbone circuits.
--
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ packages:

extra-deps:
- git: https://github.com/cchalmers/circuit-notation.git
commit: 565d4811cff6a597ee577dabd81b460e941fcb14
commit: 19b386c4aa3ff690758ae089c7754303f3500cc9
- tasty-hedgehog-1.2.0.0
- clash-prelude-1.6.3
- clash-prelude-hedgehog-1.6.3
3 changes: 3 additions & 0 deletions tests/Tests/Protocols/Df.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
{-# LANGUAGE MonomorphismRestriction #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} -- Hashable (Index n)

-- TODO: Fix warnings introduced by GHC 9.2 w.r.t. incomplete lazy pattern matches
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}

module Tests.Protocols.Df where

-- base
Expand Down
3 changes: 3 additions & 0 deletions tests/Tests/Protocols/DfConv.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{-# LANGUAGE NumericUnderscores #-}

-- TODO: Fix warnings introduced by GHC 9.2 w.r.t. incomplete lazy pattern matches
{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}

module Tests.Protocols.DfConv where

-- base
Expand Down

0 comments on commit eb76cd1

Please sign in to comment.