--------------------------------------------------------------------------------
module Console.Garepinoh.Calculate
    ( calculate
    , module Console.Garepinoh.Utils
    , module Console.Garepinoh.Types
    ) where


--------------------------------------------------------------------------------
import Console.Garepinoh.Types
import Console.Garepinoh.Utils


--------------------------------------------------------------------------------
-- |Given a 'Prelude', 'calculate' tries to calculate the value of the given
-- input and returns either the caused error message or the resulting stack.
calculate :: Read t => Prelude t -> [String] -> Result t
calculate fl = foldl (step fl) (Right [])