clash-prelude 0.10.8 → 0.10.9
raw patch · 4 files changed
+23/−24 lines, 4 filesdep ~QuickCheckdep ~arraydep ~data-default
Dependency ranges changed: QuickCheck, array, data-default, ghc-prim, ghc-typelits-extra, ghc-typelits-natnormalise, integer-gmp, lens, reflection, template-haskell
Files
- CHANGELOG.md +4/−0
- clash-prelude.cabal +12/−12
- src/CLaSH/Sized/Vector.hs +6/−8
- src/CLaSH/Tutorial.hs +1/−4
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Changelog for [`clash-prelude` package](http://hackage.haskell.org/package/clash-prelude) +## 0.10.9 *June 9th 2016*+* Fixes bugs:+ * `Eq` instance of `Vec` sometimes not synthesisable+ ## 0.10.8 *June 7th 2016* * New features: * Instances of `Data` for numeric types.
clash-prelude.cabal view
@@ -1,5 +1,5 @@ Name: clash-prelude-Version: 0.10.8+Version: 0.10.9 Synopsis: CAES Language for Synchronous Hardware - Prelude library Description: CλaSH (pronounced ‘clash’) is a functional hardware description language that@@ -152,18 +152,18 @@ TypeOperators UndecidableInstances - Build-depends: array >= 0.5.1.0,+ Build-depends: array >= 0.5.1.0 && < 0.6, base >= 4.8.0.0 && < 5,- data-default >= 0.5.3,- integer-gmp >= 0.5.1.0,- ghc-prim >= 0.3.1.0,- ghc-typelits-extra >= 0.1,- ghc-typelits-natnormalise >= 0.4.1,- lens >= 4.9,- QuickCheck >= 2.7 && <2.9,- reflection >= 2,- singletons >= 1.0 && <3.0,- template-haskell >= 2.9.0.0+ data-default >= 0.5.3 && < 0.7,+ integer-gmp >= 0.5.1.0 && < 1.1,+ ghc-prim >= 0.3.1.0 && < 0.6,+ ghc-typelits-extra >= 0.1 && < 0.2,+ ghc-typelits-natnormalise >= 0.4.1 && < 0.5,+ lens >= 4.9 && < 4.15,+ QuickCheck >= 2.7 && < 2.9,+ reflection >= 2 && < 2.2,+ singletons >= 1.0 && < 3.0,+ template-haskell >= 2.9.0.0 && < 2.12 if impl(ghc<7.11) -- Newer GHCs have -XDeriveLift
src/CLaSH/Sized/Vector.hs view
@@ -218,9 +218,10 @@ punc (x `Cons` Nil) = show x punc (x `Cons` xs) = show x P.++ "," P.++ punc xs -instance Eq a => Eq (Vec n a) where- (==) Nil _ = True- (==) v1 v2 = fold (&&) (unsafeCoerce (zipWith (==) v1 v2))+instance (KnownNat n, Eq a) => Eq (Vec n a) where+ (==) v1 v2+ | length v1 == 0 = True+ | otherwise = fold (&&) (unsafeCoerce (zipWith (==) v1 v2)) -- FIXME: the `unsafeCoerce` is a hack because the CLaSH compiler cannot deal -- with the existential length of the 'xs' in "Cons x xs". --@@ -231,7 +232,7 @@ -- -- But the CLaSH compiler currently fails on that definition. -instance Ord a => Ord (Vec n a) where+instance (KnownNat n, Ord a) => Ord (Vec n a) where compare x y = foldr f EQ $ zipWith compare x y where f EQ keepGoing = keepGoing f done _ = done@@ -1578,10 +1579,7 @@ -- else (b,a) -- @ ----- Will not terminate because 'zipWith' is too strict in its second argument:------ >>> sortV (4 :> 1 :> 2 :> 3 :> Nil)--- <*** Exception: <<loop>>+-- Will not terminate because 'zipWith' is too strict in its second argument. -- -- In this case, adding 'lazyV' on 'zipWith's second argument: --
src/CLaSH/Tutorial.hs view
@@ -1672,10 +1672,7 @@ else (b,a) @ - Will not terminate because 'zipWith' is too strict in its second argument:-- >>> sortV (4 :> 1 :> 2 :> 3 :> Nil)- <*** Exception: <<loop>>+ Will not terminate because 'zipWith' is too strict in its second argument. In this case, adding 'lazyV' on 'zipWith's second argument: