Skip to content

Instantly share code, notes, and snippets.

@singpolyma
Created September 3, 2012 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save singpolyma/3613673 to your computer and use it in GitHub Desktop.
Save singpolyma/3613673 to your computer and use it in GitHub Desktop.
Scripting with Haskell
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
(\printer ->
printer "hello"
) :: (String -> IO ()) -> IO ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment