nat-sized-numbers-0.2.0.0: Variable-sized numbers from type-level nats.

Safe HaskellNone
LanguageHaskell2010

Numeric.Sized.WordOfSize

Description

This module exports the WordOfSize type and associated functions.

Synopsis

Documentation

newtype WordOfSize n Source #

An unsigned integer type with a size decided by a type-level nat. Numeric operations wraparound by default:

>>> (255 :: WordOfSize 8) + 1
0

Constructors

WordOfSize 

Instances

KnownNat n => Bounded (WordOfSize n) Source # 
KnownNat n => Enum (WordOfSize n) Source # 
KnownNat n => Eq (WordOfSize n) Source # 

Methods

(==) :: WordOfSize n -> WordOfSize n -> Bool #

(/=) :: WordOfSize n -> WordOfSize n -> Bool #

KnownNat n => Integral (WordOfSize n) Source # 
KnownNat n => Num (WordOfSize n) Source # 
KnownNat n => Ord (WordOfSize n) Source # 
KnownNat n => Real (WordOfSize n) Source # 
KnownNat n => Show (WordOfSize n) Source # 
KnownNat n => Ix (WordOfSize n) Source # 
Generic (WordOfSize n) Source # 

Associated Types

type Rep (WordOfSize n) :: * -> * #

Methods

from :: WordOfSize n -> Rep (WordOfSize n) x #

to :: Rep (WordOfSize n) x -> WordOfSize n #

KnownNat n => Bits (WordOfSize n) Source # 
KnownNat n => FiniteBits (WordOfSize n) Source # 
type Rep (WordOfSize n) Source # 
type Rep (WordOfSize n) = D1 (MetaData "WordOfSize" "Numeric.Sized.WordOfSize" "nat-sized-numbers-0.2.0.0-G32RKoDML39HRDzfqWsuNm" True) (C1 (MetaCons "WordOfSize" PrefixI True) (S1 (MetaSel (Just Symbol "getWordOfSize") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Natural)))

allWordsOfSize :: KnownNat n => [WordOfSize n] Source #

Generates all words of a given size

>>> allWordOfSize :: [WordOfSize 3]
[0,1,2,3,4,5,6,7]