Skip to content

Commit

Permalink
Support GHC 9.2, 9.4, and 9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnbastiaan committed Feb 15, 2024
1 parent 5d93772 commit 11f04ca
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ 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"

env:
clash_version: ${{ matrix.clash }}
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: f0c3c678326abf4907e875175632e826ad8fc866

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
3 changes: 3 additions & 0 deletions 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
13 changes: 13 additions & 0 deletions src/Protocols/Plugin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import Prelude
-- clash-protocols
import Protocols

-- clash-prelude
import Clash.Prelude (type (+))
import qualified Clash.Prelude as C

-- circuit-notation
import qualified CircuitNotation as CN

Expand Down Expand Up @@ -66,6 +70,14 @@ 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 -> C.Vec n a -> C.Vec (n + 1) a
pattern (:>!) x xs <- (\ys -> (C.head ys, C.tail ys) -> (x,xs))
{-# COMPLETE (:>!) #-}
infixr 5 :>!

-- | @circuit-notation@ plugin repurposed for "Protocols".
plugin :: GHC.Plugin
plugin = CN.mkPlugin $ CN.ExternalNames
Expand All @@ -79,4 +91,5 @@ plugin = CN.mkPlugin $ CN.ExternalNames
, CN.tagName = CN.thName 'Tagged
, CN.tagTName = CN.thName ''Tagged
, CN.trivialBwd = CN.thName 'units
, CN.unsafeConsPat = CN.thName '(:>!)
}
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: f0c3c678326abf4907e875175632e826ad8fc866
- 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 11f04ca

Please sign in to comment.