fortran-src-0.11.0: Parsers and analyses for Fortran standards 66, 77, 90, 95 and 2003 (partial).
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Fortran.Repr.Value.Scalar.Int.Machine

Description

Machine Fortran INTEGER values.

This module stores Fortran INTEGER values in a matching Haskell machine integer type. For example, an INT(4) would be stored in an Int32. This way, we get both efficient operations and common overflow behaviour (which hopefully matches most Fortran compilers), and explicitly encode kinding semantics via promoting integral types.

Synopsis

Documentation

data FInt (k :: FTInt) where Source #

A Fortran integer value, tagged with its kind.

Constructors

FInt1 

Fields

FInt2 

Fields

FInt4 

Fields

FInt8 

Fields

Instances

Instances details
Show SomeFInt Source # 
Instance details

Defined in Language.Fortran.Repr.Value.Scalar.Int.Machine

Eq SomeFInt Source # 
Instance details

Defined in Language.Fortran.Repr.Value.Scalar.Int.Machine

Show (FInt k) Source # 
Instance details

Defined in Language.Fortran.Repr.Value.Scalar.Int.Machine

Methods

showsPrec :: Int -> FInt k -> ShowS #

show :: FInt k -> String #

showList :: [FInt k] -> ShowS #

Eq (FInt k) Source # 
Instance details

Defined in Language.Fortran.Repr.Value.Scalar.Int.Machine

Methods

(==) :: FInt k -> FInt k -> Bool #

(/=) :: FInt k -> FInt k -> Bool #

Ord (FInt k) Source # 
Instance details

Defined in Language.Fortran.Repr.Value.Scalar.Int.Machine

Methods

compare :: FInt k -> FInt k -> Ordering #

(<) :: FInt k -> FInt k -> Bool #

(<=) :: FInt k -> FInt k -> Bool #

(>) :: FInt k -> FInt k -> Bool #

(>=) :: FInt k -> FInt k -> Bool #

max :: FInt k -> FInt k -> FInt k #

min :: FInt k -> FInt k -> FInt k #

Show (SomeFVA FTInt FInt) Source # 
Instance details

Defined in Language.Fortran.Repr.Value.Array.Machine

type IsFInt a = (Integral a, Bits a) Source #

fIntUOp :: forall r k. (forall a. IsFInt a => a -> r) -> FInt k -> r Source #

Run an operation over some FInt.

fIntUOp' :: (Int8 -> r) -> (Int16 -> r) -> (Int32 -> r) -> (Int64 -> r) -> FInt k -> r Source #

Run an operation over some FInt, with a concrete function for each kind.

fIntUOpInplace :: (forall a. IsFInt a => a -> a) -> FInt k -> FInt k Source #

Run an inplace operation over some FInt.

fIntUOpInplace' :: (Int8 -> Int8) -> (Int16 -> Int16) -> (Int32 -> Int32) -> (Int64 -> Int64) -> FInt k -> FInt k Source #

Run an inplace operation over some FInt, with a concrete function for each kind.

fIntUOpInternal :: (Int8 -> ft 'FTInt1) -> (Int16 -> ft 'FTInt2) -> (Int32 -> ft 'FTInt4) -> (Int64 -> ft 'FTInt8) -> FInt k -> ft k Source #

Low-level FInt unary operator. Runs an operation over some FInt, and stores it kinded. The user gets to choose how the kind is used: it can be used to wrap the result back into an FInt, or ignored using Const.

Pattern matches are ordered to match more common ops earlier.

fIntBOp :: (forall a. IsFInt a => a -> a -> r) -> FInt kl -> FInt kr -> r Source #

fIntBOp' :: (Int8 -> Int8 -> r) -> (Int16 -> Int16 -> r) -> (Int32 -> Int32 -> r) -> (Int64 -> Int64 -> r) -> FInt kl -> FInt kr -> r Source #

fIntBOpInplace :: (forall a. IsFInt a => a -> a -> a) -> FInt kl -> FInt kr -> FInt (FTIntCombine kl kr) Source #

fIntBOpInplace' :: (Int8 -> Int8 -> Int8) -> (Int16 -> Int16 -> Int16) -> (Int32 -> Int32 -> Int32) -> (Int64 -> Int64 -> Int64) -> FInt kl -> FInt kr -> FInt (FTIntCombine kl kr) Source #

fIntBOpInternal :: (Int8 -> Int8 -> ft 'FTInt1) -> (Int16 -> Int16 -> ft 'FTInt2) -> (Int32 -> Int32 -> ft 'FTInt4) -> (Int64 -> Int64 -> ft 'FTInt8) -> FInt kl -> FInt kr -> ft (FTIntCombine kl kr) Source #

Low-level FInt binary operator. Combine two FInts, coercing different kinds, and store the result kinded.

Pattern matches are ordered to match more common ops earlier.

withFInt :: Num a => FInt k -> a Source #

Treat any FInt as a Num.

TODO remove. means being explicit with coercions to real in eval.