Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Fortran.Repr.Value.Scalar.Machine
Synopsis
Note on type coercion implementation
When you run a binary operation on two Fortran values, type coercion may take place depending on the types of the values. This complicates evaluation code, because now we have to export two sets of functions for operating on values: one for returning a kinded value (e.g. addition returns the same type), and one for non-kinded values (e.g. equality returns a boolean).
On the lowest level, e.g. for operating over INTEGER(x)
and INTEGER(y)
, we
resolve this by doing the coercion in an internal function which is polymorphic
over the result type, and using that in both sets of functions. To operate
kinded, we use the relevant type. To operate unkinded, we use
, which ignores the kind and just stores a value of type
Const
rr
.
data FScalarValue Source #
A Fortran scalar value.
Constructors
FSVInt FInt | |
FSVReal FReal | |
FSVComplex FComplex | |
FSVLogical FInt | |
FSVString Text |
Instances
fScalarValueType :: FScalarValue -> FScalarType Source #
Recover a Fortran scalar value's type.