clash-prelude 0.10.11 → 0.10.13
raw patch · 11 files changed
+269/−142 lines, 11 files
Files
- CHANGELOG.md +11/−0
- README.md +1/−1
- clash-prelude.cabal +3/−2
- src/CLaSH/Signal/Bundle.hs +2/−2
- src/CLaSH/Signal/Delayed.hs +11/−100
- src/CLaSH/Signal/Delayed/Explicit.hs +198/−0
- src/CLaSH/Sized/Fixed.hs +8/−0
- src/CLaSH/Sized/Internal/BitVector.hs +8/−9
- src/CLaSH/Sized/Internal/Index.hs +9/−9
- src/CLaSH/Sized/Internal/Signed.hs +9/−9
- src/CLaSH/Sized/Internal/Unsigned.hs +9/−10
CHANGELOG.md view
@@ -1,5 +1,16 @@ # Changelog for [`clash-prelude` package](http://hackage.haskell.org/package/clash-prelude) +## 0.10.13 *August 18th 2016*+* New features:+ * Thanks to Joe Hermaszewski (@expipiplus1): Add an explicitly clocked `DSignal`+ * Add a `Real` instance for `Fixed` [#158](https://github.com/clash-lang/clash-compiler/issues/158)+* Fixes bugs:+ * {BitVector;Index;Signed;Unsigned} `enumFromTo` and friends overflowed on values outside `Int` range [#166](https://github.com/clash-lang/clash-compiler/issues/166)++## 0.10.12+* Fixes bugs:+ * `Vec`s `unbundle` is too strict, i.e. `register (undefined :: Vec 2 Int)` /= `bundle . unbundle . register (undefined :: Vec 2 Int)`+ ## 0.10.11 *August 3rd 2016* * New features: * Add strict version of: `sample`, `sampleN`, `fromList`, and `simulate`
README.md view
@@ -1,6 +1,6 @@ # CλaSH - A functional hardware description language -[](https://travis-ci.org/clash-lang/clash-prelude)+[](https://travis-ci.org/clash-lang/clash-prelude?branch=0.10) [](https://hackage.haskell.org/package/clash-prelude) [](http://packdeps.haskellers.com/feed?needle=exact%3Aclash-prelude)
clash-prelude.cabal view
@@ -1,5 +1,5 @@ Name: clash-prelude-Version: 0.10.11+Version: 0.10.13 Synopsis: CAES Language for Synchronous Hardware - Prelude library Description: CλaSH (pronounced ‘clash’) is a functional hardware description language that@@ -112,6 +112,7 @@ CLaSH.Signal CLaSH.Signal.Bundle CLaSH.Signal.Delayed+ CLaSH.Signal.Delayed.Explicit CLaSH.Signal.Explicit CLaSH.Signal.Internal @@ -159,7 +160,7 @@ 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,+ ghc-typelits-natnormalise >= 0.4.1 && < 0.6, lens >= 4.9 && < 4.15, QuickCheck >= 2.7 && < 2.10, reflection >= 2 && < 2.2,
src/CLaSH/Signal/Bundle.hs view
@@ -31,7 +31,7 @@ import CLaSH.Sized.Index (Index) import CLaSH.Sized.Signed (Signed) import CLaSH.Sized.Unsigned (Unsigned)-import CLaSH.Sized.Vector (Vec, traverse#)+import CLaSH.Sized.Vector (Vec, traverse#, lazyV) -- | Isomorphism between a 'CLaSH.Signal.Signal' of a product type (e.g. a tuple) and a -- product type of 'CLaSH.Signal.Signal''s.@@ -201,7 +201,7 @@ -- The 'Traversable' instance of 'Vec' is not synthesisable, so we must -- define 'bundle'' as a primitive. bundle' = vecBundle#- unbundle' _ = sequenceA+ unbundle' _ = sequenceA . fmap lazyV {-# NOINLINE vecBundle# #-} vecBundle# :: SClock t -> Vec n (Signal' t a) -> Signal' t (Vec n a)
src/CLaSH/Signal/Delayed.hs view
@@ -9,14 +9,8 @@ #if __GLASGOW_HASKELL__ > 710 {-# LANGUAGE DeriveLift #-} #endif-{-# LANGUAGE DeriveTraversable #-}-{-# LANGUAGE GADTs #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE KindSignatures #-}-{-# LANGUAGE MagicHash #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE Trustworthy #-}@@ -41,20 +35,15 @@ ) where -import Data.Bits (Bits, FiniteBits)-import Data.Coerce (coerce)-import Data.Default (Default(..))-import Control.Applicative (liftA2)-import GHC.TypeLits (KnownNat, Nat, type (+))-import Language.Haskell.TH.Syntax (Lift)-import Prelude hiding (head, length, repeat)-import Test.QuickCheck (Arbitrary, CoArbitrary)+import Data.Default (Default(..))+import GHC.TypeLits (KnownNat, Nat, type (+))+import Prelude hiding (head, length, repeat) -import CLaSH.Class.Num (ExtendingNum (..), SaturatingNum)-import CLaSH.Promoted.Nat (SNat)-import CLaSH.Sized.Vector (Vec, head, length, repeat, shiftInAt0,- singleton)-import CLaSH.Signal (Signal, fromList, register, bundle, unbundle)+import CLaSH.Sized.Vector (Vec)+import CLaSH.Signal.Explicit (SystemClock, systemClock)+import CLaSH.Signal.Delayed.Explicit (DSignal', dfromList, delay', delayI',+ feedback, fromSignal, toSignal,+ unsafeFromSignal, antiDelay) {- $setup >>> :set -XDataKinds@@ -77,32 +66,7 @@ -- | A synchronized signal with samples of type @a@, synchronized to \"system\" -- clock (period 1000), that has accumulated @delay@ amount of samples delay -- along its path.-newtype DSignal (delay :: Nat) a =- DSignal { -- | Strip a 'DSignal' from its delay information.- toSignal :: Signal a- }- deriving (Show,Default,Functor,Applicative,Num,Bounded,Fractional,- Real,Integral,SaturatingNum,Eq,Ord,Enum,Bits,FiniteBits,Foldable,- Traversable,Arbitrary,CoArbitrary,Lift)--instance ExtendingNum a b => ExtendingNum (DSignal n a) (DSignal n b) where- type AResult (DSignal n a) (DSignal n b) = DSignal n (AResult a b)- plus = liftA2 plus- minus = liftA2 minus- type MResult (DSignal n a) (DSignal n b) = DSignal n (MResult a b)- times = liftA2 times---- | Create a 'DSignal' from a list------ Every element in the list will correspond to a value of the signal for one--- clock cycle.------ >>> sampleN 2 (dfromList [1,2,3,4,5])--- [1,2]------ __NB__: This function is not synthesisable-dfromList :: [a] -> DSignal 0 a-dfromList = coerce . fromList+type DSignal (delay :: Nat) a = DSignal' SystemClock delay a -- | Delay a 'DSignal' for @d@ periods. --@@ -117,14 +81,7 @@ => Vec d a -> DSignal n a -> DSignal (n + d) a-delay m ds = coerce (delay' (coerce ds))- where- delay' :: Signal a -> Signal a- delay' s = case length m of- 0 -> s- _ -> let (r',o) = shiftInAt0 (unbundle r) (singleton s)- r = register m (bundle r')- in head o+delay = delay' systemClock -- | Delay a 'DSignal' for @m@ periods, where @m@ is derived from the context. --@@ -138,51 +95,5 @@ delayI :: (Default a, KnownNat d) => DSignal n a -> DSignal (n + d) a-delayI = delay (repeat def)---- | Feed the delayed result of a function back to its input:------ @--- mac :: 'DSignal' 0 Int -> 'DSignal' 0 Int -> 'DSignal' 0 Int--- mac x y = 'feedback' (mac' x y)--- where--- mac' :: 'DSignal' 0 Int -> 'DSignal' 0 Int -> 'DSignal' 0 Int--- -> ('DSignal' 0 Int, 'DSignal' 1 Int)--- mac' a b acc = let acc' = a * b + acc--- in (acc, 'delay' ('singleton' 0) acc')--- @------ >>> sampleN 6 (mac (dfromList [1..]) (dfromList [1..]))--- [0,1,5,14,30,55]-feedback :: (DSignal n a -> (DSignal n a,DSignal (n + m + 1) a))- -> DSignal n a-feedback f = let (o,r) = f (coerce r) in o---- | 'Signal's are not delayed------ > sample s == dsample (fromSignal s)-fromSignal :: Signal a -> DSignal 0 a-fromSignal = coerce---- | __EXPERIMENTAL__------ __Unsafely__ convert a 'Signal' to /any/ 'DSignal'.------ __NB__: Should only be used to interface with functions specified in terms of--- 'Signal'.-unsafeFromSignal :: Signal a -> DSignal n a-unsafeFromSignal = DSignal+delayI = delayI' systemClock --- | __EXPERIMENTAL__------ Access a /delayed/ signal in the present.------ @--- mac :: 'DSignal' 0 Int -> 'DSignal' 0 Int -> 'DSignal' 0 Int--- mac x y = acc'--- where--- acc' = (x * y) + 'antiDelay' d1 acc--- acc = 'delay' ('singleton' 0) acc'--- @-antiDelay :: SNat d -> DSignal (n + d) a -> DSignal n a-antiDelay _ = coerce
+ src/CLaSH/Signal/Delayed/Explicit.hs view
@@ -0,0 +1,198 @@+{-|+Copyright : (C) 2013-2016, University of Twente+License : BSD2 (see the file LICENSE)+Maintainer : Christiaan Baaij <christiaan.baaij@gmail.com>+-}++{-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-}+#if __GLASGOW_HASKELL__ > 710+{-# LANGUAGE DeriveLift #-}+#endif+{-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE MagicHash #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-}++{-# LANGUAGE Trustworthy #-}++{-# OPTIONS_GHC -fplugin GHC.TypeLits.Normalise #-}+{-# OPTIONS_HADDOCK show-extensions #-}++module CLaSH.Signal.Delayed.Explicit+ ( -- * Delay-annotated synchronous signals+ DSignal'+ , delay'+ , delayI'+ , feedback+ -- * Signal \<-\> DSignal conversion+ , fromSignal+ , toSignal+ -- * List \<-\> DSignal conversion (not synthesisable)+ , dfromList+ -- * Experimental+ , unsafeFromSignal+ , antiDelay+ )+where++import Data.Bits (Bits, FiniteBits)+import Data.Coerce (coerce)+import Data.Default (Default(..))+import Control.Applicative (liftA2)+import GHC.TypeLits (KnownNat, Nat, type (+))+import Language.Haskell.TH.Syntax (Lift)+import Prelude hiding (head, length, repeat)+import Test.QuickCheck (Arbitrary, CoArbitrary)++import CLaSH.Class.Num (ExtendingNum (..), SaturatingNum)+import CLaSH.Promoted.Nat (SNat)+import CLaSH.Sized.Vector (Vec, head, length, repeat, shiftInAt0,+ singleton)+import CLaSH.Signal (fromList)+import CLaSH.Signal.Explicit (Signal', Clock, SClock, register',+ bundle', unbundle')++{- $setup+>>> :set -XDataKinds+>>> :set -XTypeOperators+>>> import CLaSH.Prelude+>>> import CLaSH.Signal.Explicit (SystemClock, systemClock)+>>> let delay3 = delay' systemClock (0 :> 0 :> 0 :> Nil)+>>> let delay2 = delayI' systemClock :: DSignal' SystemClock n Int -> DSignal' SystemClock (n + 2) Int+>>> :{+let mac :: DSignal' SystemClock 0 Int -> DSignal' SystemClock 0 Int+ -> DSignal' SystemClock 0 Int+ mac x y = feedback (mac' x y)+ where+ mac' :: DSignal' SystemClock 0 Int -> DSignal' SystemClock 0 Int+ -> DSignal' SystemClock 0 Int+ -> (DSignal' SystemClock 0 Int, DSignal' SystemClock 1 Int)+ mac' a b acc = let acc' = a * b + acc+ in (acc, delay' systemClock (singleton 0) acc')+:}++-}++-- | A synchronized signal with samples of type @a@, synchronized to clock+-- @clk@, that has accumulated @delay@ amount of samples delay along its path.+newtype DSignal' (clk :: Clock) (delay :: Nat) a =+ DSignal' { -- | Strip a 'DSignal' from its delay information.+ toSignal :: Signal' clk a+ }+ deriving (Show,Default,Functor,Applicative,Num,Bounded,Fractional,+ Real,Integral,SaturatingNum,Eq,Ord,Enum,Bits,FiniteBits,Foldable,+ Traversable,Arbitrary,CoArbitrary,Lift)++instance ExtendingNum a b+ => ExtendingNum (DSignal' clk n a) (DSignal' clk n b) where+ type AResult (DSignal' clk n a) (DSignal' clk n b) =+ DSignal' clk n (AResult a b)+ plus = liftA2 plus+ minus = liftA2 minus+ type MResult (DSignal' clk n a) (DSignal' clk n b) =+ DSignal' clk n (MResult a b)+ times = liftA2 times++-- | Create a 'DSignal'' from a list+--+-- Every element in the list will correspond to a value of the signal for one+-- clock cycle.+--+-- >>> sampleN 2 (dfromList [1,2,3,4,5])+-- [1,2]+--+-- __NB__: This function is not synthesisable+dfromList :: [a] -> DSignal' clk 0 a+dfromList = coerce . fromList++-- | Delay a 'DSignal'' for @d@ periods.+--+-- @+-- delay3 :: 'DSignal'' clk n Int -> 'DSignal'' clk (n + 3) Int+-- delay3 = 'delay' (0 ':>' 0 ':>' 0 ':>' 'Nil')+-- @+--+-- >>> sampleN 6 (delay3 (dfromList [1..]))+-- [0,0,0,1,2,3]+delay' :: forall clk a n d . KnownNat d+ => SClock clk+ -> Vec d a+ -> DSignal' clk n a+ -> DSignal' clk (n + d) a+delay' clk m ds = coerce (delaySignal (coerce ds))+ where+ delaySignal :: Signal' clk a -> Signal' clk a+ delaySignal s = case length m of+ 0 -> s+ _ -> let (r',o) = shiftInAt0 (unbundle' clk r) (singleton s)+ r = register' clk m (bundle' clk r')+ in head o++-- | Delay a 'DSignal' clk' for @m@ periods, where @m@ is derived from the+-- context.+--+-- @+-- delay2 :: 'DSignal'' clk n Int -> 'DSignal'' clk (n + 2) Int+-- delay2 = 'delayI'+-- @+--+-- >>> sampleN 6 (delay2 (dfromList [1..]))+-- [0,0,1,2,3,4]+delayI' :: (Default a, KnownNat d)+ => SClock clk+ -> DSignal' clk n a+ -> DSignal' clk (n + d) a+delayI' clk = delay' clk (repeat def)++-- | Feed the delayed result of a function back to its input:+--+-- @+-- mac :: 'DSignal'' clk 0 Int -> 'DSignal'' clk 0 Int -> 'DSignal'' clk 0 Int+-- mac x y = 'feedback' (mac' x y)+-- where+-- mac' :: 'DSignal'' clk 0 Int -> 'DSignal'' clk 0 Int -> 'DSignal'' clk 0 Int+-- -> ('DSignal'' clk 0 Int, 'DSignal'' clk 1 Int)+-- mac' a b acc = let acc' = a * b + acc+-- in (acc, 'delay' ('singleton' 0) acc')+-- @+--+-- >>> sampleN 6 (mac (dfromList [1..]) (dfromList [1..]))+-- [0,1,5,14,30,55]+feedback :: (DSignal' clk n a -> (DSignal' clk n a,DSignal' clk (n + m + 1) a))+ -> DSignal' clk n a+feedback f = let (o,r) = f (coerce r) in o++-- | 'Signal's are not delayed+--+-- > sample s == dsample (fromSignal s)+fromSignal :: Signal' clk a -> DSignal' clk 0 a+fromSignal = coerce++-- | __EXPERIMENTAL__+--+-- __Unsafely__ convert a 'Signal' to /any/ 'DSignal' clk'.+--+-- __NB__: Should only be used to interface with functions specified in terms of+-- 'Signal'.+unsafeFromSignal :: Signal' clk a -> DSignal' clk n a+unsafeFromSignal = DSignal'++-- | __EXPERIMENTAL__+--+-- Access a /delayed/ signal in the present.+--+-- @+-- mac :: 'DSignal' clk' 0 Int -> 'DSignal' clk' 0 Int -> 'DSignal' clk' 0 Int+-- mac x y = acc'+-- where+-- acc' = (x * y) + 'antiDelay' d1 acc+-- acc = 'delay' ('singleton' 0) acc'+-- @+antiDelay :: SNat d -> DSignal' clk (n + d) a -> DSignal' clk n a+antiDelay _ = coerce
src/CLaSH/Sized/Fixed.hs view
@@ -885,3 +885,11 @@ frac = fromInteger (natVal res) n = numerator r `shiftL` (2 * frac) d = denominator r `shiftL` frac++instance (NumFixedC rep int frac, Integral (rep (int + frac))) =>+ Real (Fixed rep int frac) where+ toRational f@(Fixed fRep) = nom % denom+ where+ nF = fracShift f+ denom = 1 `shiftL` nF+ nom = toInteger fRep
src/CLaSH/Sized/Internal/BitVector.hs view
@@ -236,15 +236,14 @@ {-# NOINLINE enumFromThen# #-} {-# NOINLINE enumFromTo# #-} {-# NOINLINE enumFromThenTo# #-}-enumFrom# :: KnownNat n => BitVector n -> [BitVector n]-enumFromThen# :: KnownNat n => BitVector n -> BitVector n -> [BitVector n]-enumFromTo# :: KnownNat n => BitVector n -> BitVector n -> [BitVector n]-enumFromThenTo# :: KnownNat n => BitVector n -> BitVector n -> BitVector n- -> [BitVector n]-enumFrom# x = map toEnum [fromEnum x ..]-enumFromThen# x y = map toEnum [fromEnum x, fromEnum y ..]-enumFromTo# x y = map toEnum [fromEnum x .. fromEnum y]-enumFromThenTo# x1 x2 y = map toEnum [fromEnum x1, fromEnum x2 .. fromEnum y]+enumFrom# :: BitVector n -> [BitVector n]+enumFromThen# :: BitVector n -> BitVector n -> [BitVector n]+enumFromTo# :: BitVector n -> BitVector n -> [BitVector n]+enumFromThenTo# :: BitVector n -> BitVector n -> BitVector n -> [BitVector n]+enumFrom# x = map BV [unsafeToInteger x ..]+enumFromThen# x y = map BV [unsafeToInteger x, unsafeToInteger y ..]+enumFromTo# x y = map BV [unsafeToInteger x .. unsafeToInteger y]+enumFromThenTo# x1 x2 y = map BV [unsafeToInteger x1, unsafeToInteger x2 .. unsafeToInteger y] instance KnownNat n => Bounded (BitVector n) where minBound = minBound#
src/CLaSH/Sized/Internal/Index.hs view
@@ -76,7 +76,7 @@ import CLaSH.Class.BitPack (BitPack (..)) import CLaSH.Class.Num (ExtendingNum (..)) import CLaSH.Class.Resize (Resize (..))-import {-# SOURCE #-} CLaSH.Sized.Internal.BitVector (BitVector (..))+import {-# SOURCE #-} CLaSH.Sized.Internal.BitVector (BitVector (BV)) -- | Arbitrary-bounded unsigned integer represented by @ceil(log_2(n))@ bits. --@@ -167,14 +167,14 @@ {-# NOINLINE enumFromThen# #-} {-# NOINLINE enumFromTo# #-} {-# NOINLINE enumFromThenTo# #-}-enumFrom# :: KnownNat n => Index n -> [Index n]-enumFromThen# :: KnownNat n => Index n -> Index n -> [Index n]-enumFromTo# :: KnownNat n => Index n -> Index n -> [Index n]-enumFromThenTo# :: KnownNat n => Index n -> Index n -> Index n -> [Index n]-enumFrom# x = map toEnum [fromEnum x ..]-enumFromThen# x y = map toEnum [fromEnum x, fromEnum y ..]-enumFromTo# x y = map toEnum [fromEnum x .. fromEnum y]-enumFromThenTo# x1 x2 y = map toEnum [fromEnum x1, fromEnum x2 .. fromEnum y]+enumFrom# :: Index n -> [Index n]+enumFromThen# :: Index n -> Index n -> [Index n]+enumFromTo# :: Index n -> Index n -> [Index n]+enumFromThenTo# :: Index n -> Index n -> Index n -> [Index n]+enumFrom# x = map I [unsafeToInteger x ..]+enumFromThen# x y = map I [unsafeToInteger x, unsafeToInteger y ..]+enumFromTo# x y = map I [unsafeToInteger x .. unsafeToInteger y]+enumFromThenTo# x1 x2 y = map I [unsafeToInteger x1, unsafeToInteger x2 .. unsafeToInteger y] instance KnownNat n => Bounded (Index n) where minBound = fromInteger# 0
src/CLaSH/Sized/Internal/Signed.hs view
@@ -101,7 +101,7 @@ import CLaSH.Prelude.BitIndex ((!), msb, replaceBit, split) import CLaSH.Prelude.BitReduction (reduceAnd, reduceOr) import CLaSH.Promoted.Ord (Max)-import CLaSH.Sized.Internal.BitVector (BitVector (..), Bit, (++#), high, low)+import CLaSH.Sized.Internal.BitVector (BitVector (BV), Bit, (++#), high, low) import qualified CLaSH.Sized.Internal.BitVector as BV -- | Arbitrary-width signed integer represented by @n@ bits, including the sign@@ -222,14 +222,14 @@ {-# NOINLINE enumFromThen# #-} {-# NOINLINE enumFromTo# #-} {-# NOINLINE enumFromThenTo# #-}-enumFrom# :: KnownNat n => Signed n -> [Signed n]-enumFromThen# :: KnownNat n => Signed n -> Signed n -> [Signed n]-enumFromTo# :: KnownNat n => Signed n -> Signed n -> [Signed n]-enumFromThenTo# :: KnownNat n => Signed n -> Signed n -> Signed n -> [Signed n]-enumFrom# x = map toEnum [fromEnum x ..]-enumFromThen# x y = map toEnum [fromEnum x, fromEnum y ..]-enumFromTo# x y = map toEnum [fromEnum x .. fromEnum y]-enumFromThenTo# x1 x2 y = map toEnum [fromEnum x1, fromEnum x2 .. fromEnum y]+enumFrom# :: Signed n -> [Signed n]+enumFromThen# :: Signed n -> Signed n -> [Signed n]+enumFromTo# :: Signed n -> Signed n -> [Signed n]+enumFromThenTo# :: Signed n -> Signed n -> Signed n -> [Signed n]+enumFrom# x = map S [unsafeToInteger x ..]+enumFromThen# x y = map S [unsafeToInteger x, unsafeToInteger y ..]+enumFromTo# x y = map S [unsafeToInteger x .. unsafeToInteger y]+enumFromThenTo# x1 x2 y = map S [unsafeToInteger x1, unsafeToInteger x2 .. unsafeToInteger y] instance KnownNat n => Bounded (Signed n) where
src/CLaSH/Sized/Internal/Unsigned.hs view
@@ -94,7 +94,7 @@ import CLaSH.Prelude.BitIndex ((!), msb, replaceBit, split) import CLaSH.Prelude.BitReduction (reduceOr) import CLaSH.Promoted.Ord (Max)-import CLaSH.Sized.Internal.BitVector (BitVector (..), Bit, high, low)+import CLaSH.Sized.Internal.BitVector (BitVector (BV), Bit, high, low) import qualified CLaSH.Sized.Internal.BitVector as BV -- | Arbitrary-width unsigned integer represented by @n@ bits@@ -209,15 +209,14 @@ {-# NOINLINE enumFromThen# #-} {-# NOINLINE enumFromTo# #-} {-# NOINLINE enumFromThenTo# #-}-enumFrom# :: KnownNat n => Unsigned n -> [Unsigned n]-enumFromThen# :: KnownNat n => Unsigned n -> Unsigned n -> [Unsigned n]-enumFromTo# :: KnownNat n => Unsigned n -> Unsigned n -> [Unsigned n]-enumFromThenTo# :: KnownNat n => Unsigned n -> Unsigned n -> Unsigned n- -> [Unsigned n]-enumFrom# x = map toEnum [fromEnum x ..]-enumFromThen# x y = map toEnum [fromEnum x, fromEnum y ..]-enumFromTo# x y = map toEnum [fromEnum x .. fromEnum y]-enumFromThenTo# x1 x2 y = map toEnum [fromEnum x1, fromEnum x2 .. fromEnum y]+enumFrom# :: Unsigned n -> [Unsigned n]+enumFromThen# :: Unsigned n -> Unsigned n -> [Unsigned n]+enumFromTo# :: Unsigned n -> Unsigned n -> [Unsigned n]+enumFromThenTo# :: Unsigned n -> Unsigned n -> Unsigned n -> [Unsigned n]+enumFrom# x = map U [unsafeToInteger x ..]+enumFromThen# x y = map U [unsafeToInteger x, unsafeToInteger y ..]+enumFromTo# x y = map U [unsafeToInteger x .. unsafeToInteger y]+enumFromThenTo# x1 x2 y = map U [unsafeToInteger x1, unsafeToInteger x2 .. unsafeToInteger y] instance KnownNat n => Bounded (Unsigned n) where minBound = minBound#