Numeric.Natural.Internal

nats-0.1: Haskell 98 natural numbers

Copyright | (C) 2011 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Numeric.Natural.Internal

Description

This module exposes the potentially unsafe operations that are sometimes needed for efficiency: The Natural data constructor and unsafePred.

Synopsis

- newtype Natural = Natural {
  - runNatural :: Integer
  }
- class Integral n => Whole n where

# Documentation

newtype Natural #

Constructors

Natural |
Fields runNatural :: Integer

Instances

Enum Natural # |
Methods succ :: Natural -> Natural # pred :: Natural -> Natural # toEnum :: Int -> Natural # fromEnum :: Natural -> Int # enumFrom :: Natural -> [Natural] # enumFromThen :: Natural -> Natural -> [Natural] # enumFromTo :: Natural -> Natural -> [Natural] # enumFromThenTo :: Natural -> Natural -> Natural -> [Natural] #
Eq Natural # |
Methods (==) :: Natural -> Natural -> Bool # (/=) :: Natural -> Natural -> Bool #
Integral Natural # |
Methods quot :: Natural -> Natural -> Natural # rem :: Natural -> Natural -> Natural # div :: Natural -> Natural -> Natural # mod :: Natural -> Natural -> Natural # quotRem :: Natural -> Natural -> (Natural, Natural) # divMod :: Natural -> Natural -> (Natural, Natural) # toInteger :: Natural -> Integer #
Num Natural # |
Methods (+) :: Natural -> Natural -> Natural # (-) :: Natural -> Natural -> Natural # (*) :: Natural -> Natural -> Natural # negate :: Natural -> Natural # abs :: Natural -> Natural # signum :: Natural -> Natural # fromInteger :: Integer -> Natural #
Ord Natural # |
Methods compare :: Natural -> Natural -> Ordering # (<) :: Natural -> Natural -> Bool # (<=) :: Natural -> Natural -> Bool # (>) :: Natural -> Natural -> Bool # (>=) :: Natural -> Natural -> Bool # max :: Natural -> Natural -> Natural # min :: Natural -> Natural -> Natural #
Read Natural # |
Methods readsPrec :: Int -> ReadS Natural # readList :: ReadS [Natural] # readPrec :: ReadPrec Natural # readListPrec :: ReadPrec [Natural] #
Real Natural # |
Methods toRational :: Natural -> Rational #
Show Natural # |
Methods showsPrec :: Int -> Natural -> ShowS # show :: Natural -> String # showList :: [Natural] -> ShowS #
Ix Natural # |
Methods range :: (Natural, Natural) -> [Natural] # index :: (Natural, Natural) -> Natural -> Int # unsafeIndex :: (Natural, Natural) -> Natural -> Int inRange :: (Natural, Natural) -> Natural -> Bool # rangeSize :: (Natural, Natural) -> Int # unsafeRangeSize :: (Natural, Natural) -> Int
Bits Natural # |
Methods (.&.) :: Natural -> Natural -> Natural # (.|.) :: Natural -> Natural -> Natural # xor :: Natural -> Natural -> Natural # complement :: Natural -> Natural # shift :: Natural -> Int -> Natural # rotate :: Natural -> Int -> Natural # zeroBits :: Natural # bit :: Int -> Natural # setBit :: Natural -> Int -> Natural # clearBit :: Natural -> Int -> Natural # complementBit :: Natural -> Int -> Natural # testBit :: Natural -> Int -> Bool # bitSizeMaybe :: Natural -> Maybe Int # bitSize :: Natural -> Int # isSigned :: Natural -> Bool # shiftL :: Natural -> Int -> Natural # unsafeShiftL :: Natural -> Int -> Natural # shiftR :: Natural -> Int -> Natural # unsafeShiftR :: Natural -> Int -> Natural # rotateL :: Natural -> Int -> Natural # rotateR :: Natural -> Int -> Natural # popCount :: Natural -> Int #
Whole Natural # |
Methods toNatural :: Natural -> Natural # unsafePred :: Natural -> Natural #

class Integral n => Whole n where #

A refinement of `Integral` to represent types that do not contain negative numbers.

Minimal complete definition

toNatural, unsafePred

Methods

toNatural :: n -> Natural #

unsafePred :: n -> n #

Instances

Whole Word # |
Methods toNatural :: Word -> Natural # unsafePred :: Word -> Word #
Whole Word8 # |
Methods toNatural :: Word8 -> Natural # unsafePred :: Word8 -> Word8 #
Whole Word16 # |
Methods toNatural :: Word16 -> Natural # unsafePred :: Word16 -> Word16 #
Whole Word32 # |
Methods toNatural :: Word32 -> Natural # unsafePred :: Word32 -> Word32 #
Whole Word64 # |
Methods toNatural :: Word64 -> Natural # unsafePred :: Word64 -> Word64 #
Whole Natural # |
Methods toNatural :: Natural -> Natural # unsafePred :: Natural -> Natural #