-- | Defines functions to read global arguments from the command line as macros with D flag.
module Csound.Typed.Control.MacrosArgs(
    readMacrosString, readMacrosDouble, readMacrosInt
) where

import Csound.Typed.Types
import qualified Csound.Typed.GlobalState as G(readMacrosString, readMacrosDouble, readMacrosInt)
import Data.Text (Text)

readMacrosString :: Text -> Text -> Str
readMacrosString :: Text -> Text -> Str
readMacrosString Text
name Text
value = GE E -> Str
forall a. Val a => GE E -> a
fromGE (GE E -> Str) -> GE E -> Str
forall a b. (a -> b) -> a -> b
$ Text -> Text -> GE E
G.readMacrosString Text
name Text
value

readMacrosDouble :: Text -> Double -> D
readMacrosDouble :: Text -> Double -> D
readMacrosDouble Text
name Double
value = GE E -> D
forall a. Val a => GE E -> a
fromGE (GE E -> D) -> GE E -> D
forall a b. (a -> b) -> a -> b
$ Text -> Double -> GE E
G.readMacrosDouble Text
name Double
value

readMacrosInt :: Text -> Int -> D
readMacrosInt :: Text -> Int -> D
readMacrosInt Text
name Int
value = GE E -> D
forall a. Val a => GE E -> a
fromGE (GE E -> D) -> GE E -> D
forall a b. (a -> b) -> a -> b
$ Text -> Int -> GE E
G.readMacrosInt  Text
name Int
value