module Language.Fortran.Repr.Value.Machine where

import Language.Fortran.Repr.Value.Scalar.Machine
import Language.Fortran.Repr.Value.Array.Machine
import Language.Fortran.Repr.Type

-- | A Fortran value (scalar or array).
data FValue = MkFArrayValue FArrayValue | MkFScalarValue FScalarValue
    deriving stock Int -> FValue -> ShowS
[FValue] -> ShowS
FValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FValue] -> ShowS
$cshowList :: [FValue] -> ShowS
show :: FValue -> String
$cshow :: FValue -> String
showsPrec :: Int -> FValue -> ShowS
$cshowsPrec :: Int -> FValue -> ShowS
Show

fValueType :: FValue -> FType
fValueType :: FValue -> FType
fValueType = \case
  MkFScalarValue FScalarValue
a -> FScalarType -> FType
MkFScalarType forall a b. (a -> b) -> a -> b
$ FScalarValue -> FScalarType
fScalarValueType FScalarValue
a
  MkFArrayValue  FArrayValue
a -> FArrayType -> FType
MkFArrayType  forall a b. (a -> b) -> a -> b
$ FArrayValue -> FArrayType
fArrayValueType  FArrayValue
a