From 083fc185a0b457885376927884c94ea2c92216b1 Mon Sep 17 00:00:00 2001 From: Alex McKenna Date: Thu, 11 Mar 2021 13:30:24 +0100 Subject: [PATCH] Fix papercuts in clash-prelude (#1702) Fixes for recent small papercuts in clash-prelude, hopefully in time for the 1.4 release. Fixes #1692 and #1700. --- clash-prelude/src/Clash/Prelude.hs | 2 ++ clash-prelude/src/Clash/Sized/Internal/Index.hs | 2 +- testsuite/src/Test/Tasty/Clash/NetlistTest.hs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/clash-prelude/src/Clash/Prelude.hs b/clash-prelude/src/Clash/Prelude.hs index 6701215900..97b036e5bb 100644 --- a/clash-prelude/src/Clash/Prelude.hs +++ b/clash-prelude/src/Clash/Prelude.hs @@ -140,6 +140,7 @@ module Clash.Prelude , module Control.Applicative , module Data.Bits , module Data.Default.Class + , module Data.Kind -- ** Exceptions , module Clash.XException -- ** Named types @@ -157,6 +158,7 @@ where import Control.Applicative import Data.Bits import Data.Default.Class +import Data.Kind (Type, Constraint) import GHC.Stack (HasCallStack) import GHC.TypeLits import GHC.TypeLits.Extra diff --git a/clash-prelude/src/Clash/Sized/Internal/Index.hs b/clash-prelude/src/Clash/Sized/Internal/Index.hs index f5fae75051..a4f53304fb 100644 --- a/clash-prelude/src/Clash/Sized/Internal/Index.hs +++ b/clash-prelude/src/Clash/Sized/Internal/Index.hs @@ -179,7 +179,7 @@ instance (KnownNat n, 1 <= n) => BitPack (Index n) where unpack = unpack# -- | Safely convert an `SNat` value to an `Index` -fromSNat :: (KnownNat m, n <= m + 1) => SNat n -> Index m +fromSNat :: (KnownNat m, n + 1 <= m) => SNat n -> Index m fromSNat = snatToNum {-# NOINLINE pack# #-} diff --git a/testsuite/src/Test/Tasty/Clash/NetlistTest.hs b/testsuite/src/Test/Tasty/Clash/NetlistTest.hs index 7a56761ed3..318b553154 100644 --- a/testsuite/src/Test/Tasty/Clash/NetlistTest.hs +++ b/testsuite/src/Test/Tasty/Clash/NetlistTest.hs @@ -19,7 +19,7 @@ module Test.Tasty.Clash.NetlistTest ) where import qualified Prelude as P -import Clash.Prelude +import Clash.Prelude hiding (Type) import Clash.Annotations.Primitive (HDL(..)) import Clash.Annotations.BitRepresentation.Internal