Created
September 3, 2012 21:21
-
-
Save singpolyma/3613673 to your computer and use it in GitHub Desktop.
Scripting with Haskell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import System.Eval | |
runScript :: FilePath -> (String -> IO ()) -> IO () | |
runScript pth printer = do | |
codes <- readFile pth | |
Right (Just scriptMain) <- eval_ codes [] ["-O2", "-w"] [] [] | |
scriptMain printer | |
main :: IO () | |
main = runScript "./Script.hs" putStrLn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(\printer -> | |
printer "hello" | |
) :: (String -> IO ()) -> IO () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment