module Feldspar.Compiler.Frontend.CommandLine.API.Library where import qualified Feldspar.Compiler.Backend.C.Options as CoreOptions import Feldspar.Compiler.Backend.C.Platforms import Data.Char import Language.Haskell.Interpreter lowerFirst :: String -> String lowerFirst (first:rest) = (toLower first : rest) upperFirst :: String -> String upperFirst (first:rest) = (toUpper first : rest) formatStringListCore :: [String] -> String formatStringListCore [] = "" formatStringListCore [x] = x formatStringListCore (x:xs) = x ++ " | " ++ (formatStringListCore xs) formatStringList :: [String] -> String formatStringList list | length list > 0 = "(" ++ (formatStringListCore list) ++ ")" formatStringList _ = error "This list should not be empty." rpad :: Int -> String -> String rpad target s = rpadWith target ' ' s rpadWith :: Int -> Char -> String -> String rpadWith target padchar s | length s >= target = s | otherwise = rpadWith target padchar (s ++ [padchar]) iPutStrLn :: String -> Interpreter () iPutStrLn = liftIO . putStrLn iPutStr :: String -> Interpreter () iPutStr = liftIO . putStr