Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data CharacterLen
- type Dimensions = Dims NonEmpty (Maybe Int)
- data SemType
- type Kind = Int
- dimensionsToTuples :: Dimensions -> Maybe [(Int, Int)]
- charLenSelector :: Maybe (Selector a) -> (Maybe CharacterLen, Maybe String)
- charLenSelector' :: Expression a -> CharacterLen
- charLenToValue :: CharacterLen -> Maybe (Value a)
- getTypeKind :: SemType -> Kind
- setTypeKind :: SemType -> Kind -> SemType
- charLenConcat :: CharacterLen -> CharacterLen -> CharacterLen
- recoverSemTypeTypeSpec :: forall a. a -> SrcSpan -> FortranVersion -> SemType -> TypeSpec a
- kindOfBaseType :: BaseType -> Int
- getTypeSize :: SemType -> Maybe Int
- setTypeSize :: SemType -> Maybe Int -> SemType
- module Language.Fortran.Common.Array
Documentation
data CharacterLen Source #
CharLenStar | specified with a * |
CharLenColon | specified with a : (Fortran2003) FIXME, possibly, with a more robust const-exp: |
CharLenExp | specified with a non-trivial expression |
CharLenInt Int | specified with a constant integer |
Instances
Semantic type assigned to variables.
BaseType
stores the "type tag" given in syntax. SemType
s add metadata
(kind and length), and resolve some "simple" types to a core type with a
preset kind (e.g. `DOUBLE PRECISION` -> `REAL(8)`).
Fortran 90 (and beyond) features may not be well supported.
TInteger Kind | |
TReal Kind | |
TComplex Kind | |
TLogical Kind | |
TByte Kind | |
TCharacter CharacterLen Kind | |
TArray SemType Dimensions | A Fortran array type is represented by a type and a set of dimensions. |
TCustom String | Constructor to use for F77 structures, F90 DDTs |
Instances
dimensionsToTuples :: Dimensions -> Maybe [(Int, Int)] Source #
Convert Dimensions
data type to its previous type synonym
(Maybe [(Int, Int)])
.
Drops all information for array dimensions that aren't fully static/known.
charLenSelector :: Maybe (Selector a) -> (Maybe CharacterLen, Maybe String) Source #
charLenSelector' :: Expression a -> CharacterLen Source #
charLenToValue :: CharacterLen -> Maybe (Value a) Source #
Attempt to recover the Value
that generated the given CharacterLen
.
getTypeKind :: SemType -> Kind Source #
charLenConcat :: CharacterLen -> CharacterLen -> CharacterLen Source #
recoverSemTypeTypeSpec :: forall a. a -> SrcSpan -> FortranVersion -> SemType -> TypeSpec a Source #
Recover the most appropriate TypeSpec
for the given SemType
, depending
on the given FortranVersion
.
Kinds weren't formalized as a syntactic feature until Fortran 90, so we ask
for a context. If possible (>=F90), we prefer the more explicit
representation e.g. REAL(8)
. For older versions, for specific type-kind
combinations, DOUBLE PRECISION
and DOUBLE COMPLEX
are used instead.
However, we otherwise don't shy away from adding kind info regardless of
theoretical version support.
Array types don't work properly, due to array type info being in a parent node that holds individual elements.
kindOfBaseType :: BaseType -> Int Source #
Given a BaseType
infer the "default" kind (or size of the
variable in memory).
Useful when you need a default kind, but gives you an unwrapped type. Consider using Analysis.deriveSemTypeFromBaseType also.
Further documentation: https://docs.oracle.com/cd/E19957-01/805-4939/c400041360f5/index.html