clash-prelude 0.10.10 → 0.10.11
raw patch · 11 files changed
+205/−54 lines, 11 filesdep +deepseqdep ~ghc-typelits-natnormalise
Dependencies added: deepseq
Dependency ranges changed: ghc-typelits-natnormalise
Files
- CHANGELOG.md +11/−0
- clash-prelude.cabal +2/−1
- src/CLaSH/Signal.hs +23/−3
- src/CLaSH/Signal/Explicit.hs +17/−1
- src/CLaSH/Signal/Internal.hs +72/−1
- src/CLaSH/Sized/Fixed.hs +2/−0
- src/CLaSH/Sized/Internal/BitVector.hs +17/−4
- src/CLaSH/Sized/Internal/Index.hs +20/−16
- src/CLaSH/Sized/Internal/Signed.hs +19/−17
- src/CLaSH/Sized/Internal/Unsigned.hs +17/−11
- src/CLaSH/Sized/Vector.hs +5/−0
CHANGELOG.md view
@@ -1,5 +1,16 @@ # Changelog for [`clash-prelude` package](http://hackage.haskell.org/package/clash-prelude) +## 0.10.11 *August 3rd 2016*+* New features:+ * Add strict version of: `sample`, `sampleN`, `fromList`, and `simulate`+ * Make `Signal`s `<*>` slightly stricter:+ * Feedback loops still work with this new implementation+ * No more space-leaks when used in combination with the strict version of `sample`, `sampleN`, and `simulate`+ * Add `NFData` instances for the numeric types+* Speed up arithmetic operations of `Signed`, `Unsigned` and `BitVector`+* Fixes bugs:+ * CLaSH compiler sees internals of numeric types in their `Lift` functions+ ## 0.10.10 *July 15th 2016* * Fixes bugs: * `shrink` functions for numeric types throw exceptions [#153](https://github.com/clash-lang/clash-compiler/issues/153)
clash-prelude.cabal view
@@ -1,5 +1,5 @@ Name: clash-prelude-Version: 0.10.10+Version: 0.10.11 Synopsis: CAES Language for Synchronous Hardware - Prelude library Description: CλaSH (pronounced ‘clash’) is a functional hardware description language that@@ -156,6 +156,7 @@ base >= 4.8.0.0 && < 5, data-default >= 0.5.3 && < 0.8, integer-gmp >= 0.5.1.0 && < 1.1,+ deepseq >= 1.4.1.0 && < 1.5, ghc-prim >= 0.3.1.0 && < 0.6, ghc-typelits-extra >= 0.1 && < 0.2, ghc-typelits-natnormalise >= 0.4.1 && < 0.5,
src/CLaSH/Signal.hs view
@@ -8,7 +8,7 @@ {-# LANGUAGE Trustworthy #-} -{-# OPTIONS_GHC -fno-warn-unused-imports #-}+{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-deprecations #-} {-# OPTIONS_HADDOCK show-extensions #-} module CLaSH.Signal@@ -29,10 +29,17 @@ -- * Simulation functions (not synthesisable) , simulate , simulateB+ -- * Strict versions+ , simulate_strict+ , simulateB_strict -- * List \<-\> Signal conversion (not synthesisable) , sample , sampleN , fromList+ -- ** Strict versions+ , sample_strict+ , sampleN_strict+ , fromList_strict -- * QuickCheck combinators , testFor -- * Type classes@@ -62,6 +69,7 @@ ) where +import Control.DeepSeq (NFData) import Data.Bits (Bits) -- Haddock only import CLaSH.Signal.Internal (Signal', register#, regEn#, (.==.), (./=.),@@ -70,8 +78,11 @@ shift1, rotate1, setBit1, clearBit1, shiftL1, unsafeShiftL1, shiftR1, unsafeShiftR1, rotateL1, rotateR1, (.||.), (.&&.), not1, mux, sample,- sampleN, fromList, simulate, signal, testFor)-import CLaSH.Signal.Explicit (SystemClock, systemClock, simulateB')+ sampleN, fromList, simulate, signal, testFor,+ sample_strict, sampleN_strict, simulate_strict,+ fromList_strict)+import CLaSH.Signal.Explicit (SystemClock, systemClock, simulateB',+ simulateB'_strict) import CLaSH.Signal.Bundle (Bundle (..), Unbundled') {- $setup@@ -159,3 +170,12 @@ -- __NB__: This function is not synthesisable simulateB :: (Bundle a, Bundle b) => (Unbundled a -> Unbundled b) -> [a] -> [b] simulateB = simulateB' systemClock systemClock++-- | Version of 'simulateB' that strictly evaluates the input elements and the+-- output elements+--+-- __N.B:__ Exceptions are lazily rethrown+simulateB_strict :: (Bundle a, Bundle b, NFData a, NFData b)+ => (Unbundled a -> Unbundled b) -> [a] -> [b]+simulateB_strict = simulateB'_strict systemClock systemClock+{-# DEPRECATED simulateB_strict "'simulateB will be strict in CLaSH 1.0, and 'simulateB_strict' will be removed" #-}
src/CLaSH/Signal/Explicit.hs view
@@ -10,6 +10,7 @@ {-# LANGUAGE Trustworthy #-} +{-# OPTIONS_GHC -fno-warn-deprecations #-} {-# OPTIONS_HADDOCK show-extensions #-} module CLaSH.Signal.Explicit@@ -34,15 +35,18 @@ , Bundle (..) -- * Simulation functions (not synthesisable) , simulateB'+ -- ** Strict version+ , simulateB'_strict ) where +import Control.DeepSeq (NFData) import GHC.TypeLits (KnownNat, KnownSymbol) import CLaSH.Promoted.Nat (snat, snatToInteger) import CLaSH.Promoted.Symbol (ssymbol) import CLaSH.Signal.Internal (Signal' (..), Clock (..), SClock (..), register#,- regEn#, simulate)+ regEn#, simulate, simulate_strict) import CLaSH.Signal.Bundle (Bundle (..), Unbundled') {- $setup@@ -341,3 +345,15 @@ -> (Unbundled' clk1 a -> Unbundled' clk2 b) -- ^ Function to simulate -> [a] -> [b] simulateB' clk1 clk2 f = simulate (bundle' clk2 . f . unbundle' clk1)++-- | Version of 'simulateB'' that strictly evaluates the input elements and the+-- output elements+--+-- __N.B:__ Exceptions are lazily rethrown+simulateB'_strict :: (Bundle a, Bundle b, NFData a, NFData b)+ => SClock clk1 -- ^ 'Clock' of the incoming signal+ -> SClock clk2 -- ^ 'Clock' of the outgoing signal+ -> (Unbundled' clk1 a -> Unbundled' clk2 b) -- ^ Function to simulate+ -> [a] -> [b]+simulateB'_strict clk1 clk2 f = simulate_strict (bundle' clk2 . f . unbundle' clk1)+{-# DEPRECATED simulateB'_strict "'simulateB'' will be strict in CLaSH 1.0, and 'simulateB'_strict' will be removed" #-}
src/CLaSH/Signal/Internal.hs view
@@ -39,10 +39,16 @@ , (.&&.), (.||.), not1 -- * Simulation functions (not synthesisable) , simulate+ -- ** strict versions+ , simulate_strict -- * List \<-\> Signal conversion (not synthesisable) , sample , sampleN , fromList+ -- ** strict versions+ , sample_strict+ , sampleN_strict+ , fromList_strict -- * QuickCheck combinators , testFor -- * Type classes@@ -84,10 +90,13 @@ where import Control.Applicative (liftA2, liftA3)+import Control.DeepSeq (NFData,force)+import Control.Exception (SomeException,catch,evaluate,throw) import Data.Bits (Bits (..), FiniteBits (..)) import Data.Default (Default (..)) import GHC.TypeLits (Nat, Symbol) import Language.Haskell.TH.Syntax (Lift (..))+import System.IO.Unsafe (unsafeDupablePerformIO) import Test.QuickCheck (Arbitrary (..), CoArbitrary(..), Property, property) @@ -149,8 +158,30 @@ {-# NOINLINE appSignal# #-} appSignal# :: Signal' clk (a -> b) -> Signal' clk a -> Signal' clk b-appSignal# (f :- fs) ~(a :- as) = f a :- appSignal# fs as+appSignal# (f :- fs) xs@(~(a :- as)) = f a :- (xs `seq` appSignal# fs as) -- See [NOTE: Lazy ap] +{- NOTE: Lazy ap+Signal's ap, i.e (Applicative.<*>), must be lazy in it's second argument:++> appSignal :: Signal' clk (a -> b) -> Signal' clk a -> Signal' clk b+> appSignal (f :- fs) ~(a :- as) = f a :- appSignal fs as++because some feedback loops, such as the loop described in 'system' in the+example at http://hackage.haskell.org/package/clash-prelude-0.10.10/docs/CLaSH-Prelude-BlockRam.html,+will lead to "Exception <<loop>>".++However, this "naive" lazy version is _too_ lazy and induces spaceleaks.+The current version:++> appSignal# :: Signal' clk (a -> b) -> Signal' clk a -> Signal' clk b+> appSignal# (f :- fs) xs@(~(a :- as)) = f a :- (xs `seq` appSignal# fs as)++Is lazy enough to handle the earlier mentioned feedback loops, but doesn't leak+(as much) memory like the "naive" lazy version, because the Signal constructor+of the second argument is evaluated as soon as the tail of the result is evaluated.+-}++ {-# NOINLINE joinSignal# #-} -- | __WARNING: EXTREMELY EXPERIMENTAL__ --@@ -663,3 +694,43 @@ -- __NB__: This function is not synthesisable simulate :: (Signal' clk1 a -> Signal' clk2 b) -> [a] -> [b] simulate f = sample . f . fromList++-- | A 'force' that lazily returns exceptions+forceNoException :: NFData a => a -> IO a+forceNoException x = catch (evaluate (force x)) (\(e :: SomeException) -> return (throw e))++headStrictCons :: NFData a => a -> [a] -> [a]+headStrictCons x xs = unsafeDupablePerformIO ((:) <$> forceNoException x <*> pure xs)++headStrictSignal :: NFData a => a -> Signal' clk a -> Signal' clk a+headStrictSignal x xs = unsafeDupablePerformIO ((:-) <$> forceNoException x <*> pure xs)++-- | Version of 'sample' that strictly evaluates the samples+--+-- __N.B:__ Exceptions are lazily rethrown+sample_strict :: (Foldable f, NFData a) => f a -> [a]+sample_strict = foldr headStrictCons []+{-# DEPRECATED sample_strict "'sample' will be strict in CLaSH 1.0, and 'sample_strict' will be removed" #-}++-- | Version of 'sampleN' that strictly evaluates the samples+--+-- __N.B:__ Exceptions are lazily rethrown+sampleN_strict :: (Foldable f, NFData a) => Int -> f a -> [a]+sampleN_strict n = take n . sample_strict+{-# DEPRECATED sampleN_strict "'sampleN' will be strict in CLaSH 1.0, and 'sampleN_strict' will be removed" #-}++-- | Version of 'fromList' that strictly evaluates the elements of the list+--+-- __N.B:__ Exceptions are lazily rethrown+fromList_strict :: NFData a => [a] -> Signal' clk a+fromList_strict = foldr headStrictSignal (error "finite list")+{-# DEPRECATED fromList_strict "'fromList' will be strict in CLaSH 1.0, and 'fromList_strict' will be removed" #-}++-- | Version of 'simulate' that strictly evaluates the input elements and the+-- output elements+--+-- __N.B:__ Exceptions are lazily rethrown+simulate_strict :: (NFData a, NFData b)+ => (Signal' clk1 a -> Signal' clk2 b) -> [a] -> [b]+simulate_strict f = sample_strict . f . fromList_strict+{-# DEPRECATED simulate_strict "'simulate' will be strict in CLaSH 1.0, and 'simulate_strict' will be removed" #-}
src/CLaSH/Sized/Fixed.hs view
@@ -67,6 +67,7 @@ ) where +import Control.DeepSeq (NFData) import Control.Arrow ((***), second) import Data.Bits (Bits (..), FiniteBits) import Data.Data (Data)@@ -115,6 +116,7 @@ newtype Fixed (rep :: Nat -> *) (int :: Nat) (frac :: Nat) = Fixed { unFixed :: rep (int + frac) } +deriving instance NFData (rep (int + frac)) => NFData (Fixed rep int frac) deriving instance (Typeable rep, Typeable int, Typeable frac , Data (rep (int + frac))) => Data (Fixed rep int frac) deriving instance Eq (rep (int + frac)) => Eq (Fixed rep int frac)
src/CLaSH/Sized/Internal/BitVector.hs view
@@ -10,6 +10,7 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -94,12 +95,14 @@ ) where +import Control.DeepSeq (NFData (..)) import Control.Lens (Index, Ixed (..), IxValue) import Data.Bits (Bits (..), FiniteBits (..)) import Data.Char (digitToInt) import Data.Data (Data) import Data.Default (Default (..)) import Data.Maybe (listToMaybe)+import Data.Proxy (Proxy (..)) import GHC.Integer (smallInteger) import GHC.Prim (dataToTag#) import GHC.TypeLits (KnownNat, Nat, type (+), type (-), natVal)@@ -140,8 +143,14 @@ type Bit = BitVector 1 -- * Instances+instance NFData (BitVector n) where+ rnf (BV i) = rnf i `seq` ()+ {-# NOINLINE rnf #-}+ -- NOINLINE is needed so that CLaSH doesn't trip on the "BitVector ~# Integer"+ -- coercion+ instance KnownNat n => Show (BitVector n) where- show bv = reverse . underScore . reverse $ showBV (natVal bv) (toInteger# bv) []+ show bv@(BV i) = reverse . underScore . reverse $ showBV (natVal bv) i [] where showBV 0 _ s = s showBV n v s = let (a,b) = divMod v 2@@ -152,6 +161,7 @@ underScore xs = case splitAt 5 xs of ([a,b,c,d,e],rest) -> [a,b,c,d,'_'] ++ underScore (e:rest) (rest,_) -> rest+ {-# NOINLINE show #-} -- | Create a binary literal --@@ -269,7 +279,7 @@ {-# NOINLINE negate# #-} negate# :: KnownNat n => BitVector n -> BitVector n-negate# bv@(BV i) = BV (sz - i)+negate# bv@(BV i) = sz `seq` BV (sz - i) where sz = 2 ^ natVal bv @@ -278,8 +288,10 @@ fromInteger# = fromInteger_INLINE {-# INLINE fromInteger_INLINE #-}-fromInteger_INLINE :: KnownNat n => Integer -> BitVector n-fromInteger_INLINE i = let res = BV (i `mod` (2 ^ natVal res)) in res+fromInteger_INLINE :: forall n . KnownNat n => Integer -> BitVector n+fromInteger_INLINE i = sz `seq` BV (i `mod` (shiftL 1 sz))+ where+ sz = fromInteger (natVal (Proxy :: Proxy n)) instance (KnownNat (Max m n + 1), KnownNat (m + n)) => ExtendingNum (BitVector m) (BitVector n) where@@ -541,6 +553,7 @@ instance KnownNat n => Lift (BitVector n) where lift bv@(BV i) = sigE [| fromInteger# i |] (decBitVector (natVal bv))+ {-# NOINLINE lift #-} decBitVector :: Integer -> TypeQ decBitVector n = appT (conT ''BitVector) (litT $ numTyLit n)
src/CLaSH/Sized/Internal/Index.hs view
@@ -8,6 +8,7 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MagicHash #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-}@@ -58,8 +59,10 @@ ) where +import Control.DeepSeq (NFData (..)) import Data.Data (Data) import Data.Default (Default (..))+import Data.Proxy (Proxy (..)) import Text.Read (Read (..), ReadPrec) import Language.Haskell.TH (TypeQ, appT, conT, litT, numTyLit, sigE) import Language.Haskell.TH.Syntax (Lift(..))@@ -101,6 +104,12 @@ I { unsafeToInteger :: Integer } deriving Data +instance NFData (Index n) where+ rnf (I i) = rnf i `seq` ()+ {-# NOINLINE rnf #-}+ -- NOINLINE is needed so that CLaSH doesn't trip on the "Index ~# Integer"+ -- coercion+ instance KnownNat n => BitPack (Index n) where type BitSize (Index n) = CLog 2 n pack = pack#@@ -195,17 +204,17 @@ {-# NOINLINE (*#) #-} (*#) (I a) (I b) = fromInteger_INLINE $ a * b -fromInteger#,fromInteger_INLINE :: KnownNat n => Integer -> Index n+fromInteger# :: KnownNat n => Integer -> Index n {-# NOINLINE fromInteger# #-} fromInteger# = fromInteger_INLINE {-# INLINE fromInteger_INLINE #-}-fromInteger_INLINE i =- let bound = natVal res- i' = i `mod` bound- err = error ("CLaSH.Sized.Index: result " ++ show i ++- " is out of bounds: [0.." ++ show (bound - 1) ++ "]")- res = if i' /= i then err else I i- in res+fromInteger_INLINE :: forall n . KnownNat n => Integer -> Index n+fromInteger_INLINE i = bound `seq` if i' == i then I i else err+ where+ bound = natVal (Proxy :: Proxy n)+ i' = i `mod` bound+ err = error ("CLaSH.Sized.Index: result " ++ show i +++ " is out of bounds: [0.." ++ show (bound - 1) ++ "]") instance ExtendingNum (Index m) (Index n) where type AResult (Index m) (Index n) = Index (m + n - 1)@@ -264,19 +273,14 @@ instance KnownNat n => Lift (Index n) where lift u@(I i) = sigE [| fromInteger# i |] (decIndex (natVal u))+ {-# NOINLINE lift #-} decIndex :: Integer -> TypeQ decIndex n = appT (conT ''Index) (litT $ numTyLit n) instance Show (Index n) where- showsPrec p ix = showsPrec p (toInteger# ix)- show ix = show (toInteger# ix)- -- We cannot say:- --- -- > show (I i) = show i- --- -- Because GHC translates that to a cast from Index to Integer,- -- which the CLaSH compiler can (currently) not handle.+ show (I i) = show i+ {-# NOINLINE show #-} -- | None of the 'Read' class' methods are synthesisable. instance KnownNat n => Read (Index n) where
src/CLaSH/Sized/Internal/Signed.hs view
@@ -10,6 +10,7 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -79,10 +80,12 @@ ) where +import Control.DeepSeq (NFData (..)) import Control.Lens (Index, Ixed (..), IxValue) import Data.Bits (Bits (..), FiniteBits (..)) import Data.Data (Data) import Data.Default (Default (..))+import Data.Proxy (Proxy (..)) import Text.Read (Read (..), ReadPrec) import GHC.TypeLits (KnownNat, Nat, type (+), natVal) import Language.Haskell.TH (TypeQ, appT, conT, litT, numTyLit, sigE)@@ -146,15 +149,15 @@ size# :: KnownNat n => Signed n -> Int size# bv = fromInteger (natVal bv) +instance NFData (Signed n) where+ rnf (S i) = rnf i `seq` ()+ {-# NOINLINE rnf #-}+ -- NOINLINE is needed so that CLaSH doesn't trip on the "Signed ~# Integer"+ -- coercion+ instance Show (Signed n) where- showsPrec p s = showsPrec p (toInteger# s)- show s = show (toInteger# s)- -- We cannot say:- --- -- > show (S i) = show i- --- -- Because GHC translates that to a cast from Signed to Integer,- -- which the CLaSH compiler can (currently) not handle.+ show (S i) = show i+ {-# NOINLINE show #-} -- | None of the 'Read' class' methods are synthesisable. instance KnownNat n => Read (Signed n) where@@ -272,16 +275,14 @@ fromInteger# = fromInteger_INLINE {-# INLINE fromInteger_INLINE #-}-fromInteger_INLINE :: KnownNat n => Integer -> Signed n-fromInteger_INLINE i- | n == 0 = S 0- | otherwise = res+fromInteger_INLINE :: forall n . KnownNat n => Integer -> Signed n+fromInteger_INLINE i = sz `seq` if sz == 0 then S 0 else S res where- n = natVal res- sz = 2 ^ (n - 1)- res = case divMod i sz of- (s,i') | even s -> S i'- | otherwise -> S (i' - sz)+ sz = natVal (Proxy :: Proxy n)+ mask = shiftL 1 (fromInteger sz - 1)+ res = case divMod i mask of+ (s,i') | even s -> i'+ | otherwise -> i' - mask instance (KnownNat (1 + Max m n), KnownNat (m + n)) => ExtendingNum (Signed m) (Signed n) where@@ -430,6 +431,7 @@ instance KnownNat n => Lift (Signed n) where lift s@(S i) = sigE [| fromInteger# i |] (decSigned (natVal s))+ {-# NOINLINE lift #-} decSigned :: Integer -> TypeQ decSigned n = appT (conT ''Signed) (litT $ numTyLit n)
src/CLaSH/Sized/Internal/Unsigned.hs view
@@ -9,6 +9,7 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -72,10 +73,12 @@ ) where +import Control.DeepSeq (NFData (..)) import Control.Lens (Index, Ixed (..), IxValue) import Data.Bits (Bits (..), FiniteBits (..)) import Data.Data (Data) import Data.Default (Default (..))+import Data.Proxy (Proxy (..)) import Text.Read (Read (..), ReadPrec) import GHC.TypeLits (KnownNat, Nat, type (+), natVal) import Language.Haskell.TH (TypeQ, appT, conT, litT, numTyLit, sigE)@@ -135,15 +138,15 @@ size# :: KnownNat n => Unsigned n -> Int size# u = fromInteger (natVal u) +instance NFData (Unsigned n) where+ rnf (U i) = rnf i `seq` ()+ {-# NOINLINE rnf #-}+ -- NOINLINE is needed so that CLaSH doesn't trip on the "Unsigned ~# Integer"+ -- coercion+ instance Show (Unsigned n) where- showsPrec p u = showsPrec p (toInteger# u)- show u = show (toInteger# u)- -- We cannot say:- --- -- > show (U i) = show i- --- -- Because GHC translates that to a cast from Unsigned to Integer,- -- which the CLaSH compiler can (currently) not handle+ show (U i) = show i+ {-# NOINLINE show #-} -- | None of the 'Read' class' methods are synthesisable. instance KnownNat n => Read (Unsigned n) where@@ -249,7 +252,7 @@ {-# NOINLINE negate# #-} negate# :: KnownNat n => Unsigned n -> Unsigned n-negate# u@(U i) = U (sz - i)+negate# u@(U i) = sz `seq` U (sz - i) where sz = 2 ^ natVal u @@ -258,8 +261,10 @@ fromInteger# = fromInteger_INLINE {-# INLINE fromInteger_INLINE #-}-fromInteger_INLINE :: KnownNat n => Integer -> Unsigned n-fromInteger_INLINE i = let res = U (i `mod` (2 ^ natVal res)) in res+fromInteger_INLINE :: forall n . KnownNat n => Integer -> Unsigned n+fromInteger_INLINE i = sz `seq` U (i `mod` (shiftL 1 sz))+ where+ sz = fromInteger (natVal (Proxy :: Proxy n)) instance (KnownNat (1 + Max m n), KnownNat (m + n)) => ExtendingNum (Unsigned m) (Unsigned n) where@@ -393,6 +398,7 @@ instance KnownNat n => Lift (Unsigned n) where lift u@(U i) = sigE [| fromInteger# i |] (decUnsigned (natVal u))+ {-# NOINLINE lift #-} decUnsigned :: Integer -> TypeQ decUnsigned n = appT (conT ''Unsigned) (litT $ numTyLit n)
src/CLaSH/Sized/Vector.hs view
@@ -97,6 +97,7 @@ ) where +import Control.DeepSeq (NFData (..)) import qualified Control.Lens as Lens import Data.Default (Default (..)) import qualified Data.Foldable as F@@ -179,6 +180,10 @@ Nil :: Vec 0 a Cons :: a -> Vec n a -> Vec (n + 1) a {-# WARNING Cons "Use ':>' instead of 'Cons'" #-}++instance NFData a => NFData (Vec n a) where+ rnf Nil = ()+ rnf (Cons x xs) = rnf x `seq` rnf xs -- | Add an element to the head of a vector. --