hgeometry-combinatorial-0.12.0.0: Data structures, and Data types.
Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageHaskell2010

Data.RealNumber.Rational

Description

 
Synopsis

Documentation

newtype RealNumber (p :: Nat) Source #

Real Numbers represented using Rational numbers. The number type itself is exact in the sense that we can represent any rational number.

The parameter, a natural number, represents the precision (in number of decimals behind the period) with which we display the numbers when printing them (using Show).

If the number cannot be displayed exactly a '~' is printed after the number.

Constructors

RealNumber Rational 

Instances

Instances details
Eq (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Methods

(==) :: RealNumber p -> RealNumber p -> Bool #

(/=) :: RealNumber p -> RealNumber p -> Bool #

Fractional (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

KnownNat p => Data (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RealNumber p -> c (RealNumber p) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (RealNumber p) #

toConstr :: RealNumber p -> Constr #

dataTypeOf :: RealNumber p -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (RealNumber p)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (RealNumber p)) #

gmapT :: (forall b. Data b => b -> b) -> RealNumber p -> RealNumber p #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RealNumber p -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RealNumber p -> r #

gmapQ :: (forall d. Data d => d -> u) -> RealNumber p -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RealNumber p -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RealNumber p -> m (RealNumber p) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RealNumber p -> m (RealNumber p) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RealNumber p -> m (RealNumber p) #

Num (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Ord (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

KnownNat p => Read (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Real (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

RealFrac (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Methods

properFraction :: Integral b => RealNumber p -> (b, RealNumber p) #

truncate :: Integral b => RealNumber p -> b #

round :: Integral b => RealNumber p -> b #

ceiling :: Integral b => RealNumber p -> b #

floor :: Integral b => RealNumber p -> b #

KnownNat p => Show (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Generic (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Associated Types

type Rep (RealNumber p) :: Type -> Type #

Methods

from :: RealNumber p -> Rep (RealNumber p) x #

to :: Rep (RealNumber p) x -> RealNumber p #

Random (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Methods

randomR :: RandomGen g => (RealNumber p, RealNumber p) -> g -> (RealNumber p, g) #

random :: RandomGen g => g -> (RealNumber p, g) #

randomRs :: RandomGen g => (RealNumber p, RealNumber p) -> g -> [RealNumber p] #

randoms :: RandomGen g => g -> [RealNumber p] #

KnownNat p => Arbitrary (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Hashable (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Methods

hashWithSalt :: Int -> RealNumber p -> Int #

hash :: RealNumber p -> Int #

ToJSON (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

FromJSON (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

NFData (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Methods

rnf :: RealNumber p -> () #

type Rep (RealNumber p) Source # 
Instance details

Defined in Data.RealNumber.Rational

type Rep (RealNumber p) = D1 ('MetaData "RealNumber" "Data.RealNumber.Rational" "hgeometry-combinatorial-0.12.0.0-VIzkyOvE5y1mf3MPLhQ6V" 'True) (C1 ('MetaCons "RealNumber" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Rational)))

Converting to and from RealNumber's

data AsFixed p Source #

Fixed-precision representation of a RealNumber. If there's insufficient precision to accurately represent the RealNumber then the Lossy constructor will be used.

Constructors

Exact !(Fixed p) 
Lossy !(Fixed p) 

Instances

Instances details
Eq (AsFixed p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Methods

(==) :: AsFixed p -> AsFixed p -> Bool #

(/=) :: AsFixed p -> AsFixed p -> Bool #

HasResolution p => Show (AsFixed p) Source # 
Instance details

Defined in Data.RealNumber.Rational

Methods

showsPrec :: Int -> AsFixed p -> ShowS #

show :: AsFixed p -> String #

showList :: [AsFixed p] -> ShowS #

asFixed :: KnownNat p => RealNumber p -> AsFixed (NatPrec p) Source #

Cast RealNumber to a fixed-precision number. Data-loss caused by insufficient precision will be marked by the Lossy constructor.

toFixed :: KnownNat p => RealNumber p -> Fixed (NatPrec p) Source #

Cast RealNumber to a fixed-precision number. Data is silently lost if there's insufficient precision.

fromFixed :: KnownNat p => Fixed (NatPrec p) -> RealNumber p Source #

Cast a fixed-precision number to a RealNumber.

data Nat #

(Kind) This is the kind of type-level natural numbers.

Instances

Instances details
KnownNat n => HasResolution (n :: Nat)

For example, Fixed 1000 will give you a Fixed with a resolution of 1000.

Instance details

Defined in Data.Fixed

Methods

resolution :: p n -> Integer #

KnownNat n => Dim (n :: Nat) 
Instance details

Defined in Linear.V

Methods

reflectDim :: p n -> Int #

KnownNat n => Reifies (n :: Nat) Integer 
Instance details

Defined in Data.Reflection

Methods

reflect :: proxy n -> Integer #

Finite (V n) 
Instance details

Defined in Linear.V

Associated Types

type Size (V n) :: Nat #

Methods

toV :: V n a -> V (Size (V n)) a #

fromV :: V (Size (V n)) a -> V n a #

1 <= n => Field1 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_1 :: Lens (V n a) (V n a) a a #

2 <= n => Field2 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_2 :: Lens (V n a) (V n a) a a #

3 <= n => Field3 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_3 :: Lens (V n a) (V n a) a a #

4 <= n => Field4 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_4 :: Lens (V n a) (V n a) a a #

5 <= n => Field5 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_5 :: Lens (V n a) (V n a) a a #

6 <= n => Field6 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_6 :: Lens (V n a) (V n a) a a #

7 <= n => Field7 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_7 :: Lens (V n a) (V n a) a a #

8 <= n => Field8 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_8 :: Lens (V n a) (V n a) a a #

9 <= n => Field9 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_9 :: Lens (V n a) (V n a) a a #

10 <= n => Field10 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_10 :: Lens (V n a) (V n a) a a #

11 <= n => Field11 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_11 :: Lens (V n a) (V n a) a a #

12 <= n => Field12 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_12 :: Lens (V n a) (V n a) a a #

13 <= n => Field13 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_13 :: Lens (V n a) (V n a) a a #

14 <= n => Field14 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_14 :: Lens (V n a) (V n a) a a #

15 <= n => Field15 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_15 :: Lens (V n a) (V n a) a a #

16 <= n => Field16 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_16 :: Lens (V n a) (V n a) a a #

17 <= n => Field17 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_17 :: Lens (V n a) (V n a) a a #

18 <= n => Field18 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_18 :: Lens (V n a) (V n a) a a #

19 <= n => Field19 (V n a) (V n a) a a 
Instance details

Defined in Linear.V

Methods

_19 :: Lens (V n a) (V n a) a a #

type Size (V n) 
Instance details

Defined in Linear.V

type Size (V n) = n