1-----------------------------------------------------------------------------
4-- Copyright : (c) Phil Freeman 2013
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
13-----------------------------------------------------------------------------
18import Data.Maybe (mapMaybe)
19import Data.List (intercalate)
20import System.Console.CmdTheLine
21import Control.Applicative
22import System.Exit (exitSuccess, exitFailure)
23import qualified System.IO.UTF8 as U
24import qualified Data.Map as M
26compile :: [FilePath] -> Maybe FilePath -> Maybe FilePath -> IO ()
27compile inputFiles outputFile externsFile = do
28 input <- fmap concat $ mapM U.readFile inputFiles
29 let ast = parseDeclarations input
35 case check (typeCheckAll decls) of
40 let js = intercalate "\n" $ mapMaybe declToJs decls
42 Just path -> U.writeFile path js
43 Nothing -> U.putStrLn js
46 Just filePath -> U.writeFile filePath $ intercalate "\n\n" $ map externToJs $ M.toList $ names env
49inputFiles :: Term [FilePath]
50inputFiles = nonEmpty $ posAny [] $ posInfo
51 { posDoc = "The input .ps files" }
53outputFile :: Term (Maybe FilePath)
54outputFile = value $ opt Nothing $ (optInfo [ "o", "output" ])
55 { optDoc = "The output .js file" }
57externsFile :: Term (Maybe FilePath)
58externsFile = value $ opt Nothing $ (optInfo [ "e", "externs" ])
59 { optDoc = "The output .e.ps file" }
62term = compile <$> inputFiles <*> outputFile <*> externsFile
68 , termDoc = "Compiles PureScript to Javascript"
71main = run (term, termInfo)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list