module Lastik.Compile (
Compile,
compile,
environmentCommand
) where
import Control.Monad
import Data.List
import Data.Maybe
import System.Directory
import System.Cmd
import System.Exit
import System.Environment
import System.FilePath
class Compile c where
compile :: c -> [FilePath] -> String
instance Compile [Char] where
compile s _ = s
instance Compile ([FilePath] -> String) where
compile = id
environmentCommand :: String -> String -> IO String
environmentCommand v c = (\e -> (case lookup v e of Nothing -> c
Just k -> k </> c) ++ " ") `fmap` getEnvironment