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 Text.Parsec as P
24import qualified System.IO.UTF8 as U
25import qualified Data.Map as M
27compile :: [FilePath] -> Maybe FilePath -> Maybe FilePath -> IO ()
28compile inputFiles outputFile externsFile = do
29 asts <- fmap (fmap concat . sequence) $ flip mapM inputFiles $ \inputFile -> do
30 text <- U.readFile inputFile
31 return $ runIndentParser parseDeclarations text
37 case check (typeCheckAll decls) of
42 let js = intercalate "\n" $ mapMaybe declToJs decls
44 Just path -> U.writeFile path js
45 Nothing -> U.putStrLn js
48 Just filePath -> U.writeFile filePath $ intercalate "\n" $ mapMaybe (externToPs env) decls
51inputFiles :: Term [FilePath]
52inputFiles = nonEmpty $ posAny [] $ posInfo
53 { posDoc = "The input .ps files" }
55outputFile :: Term (Maybe FilePath)
56outputFile = value $ opt Nothing $ (optInfo [ "o", "output" ])
57 { optDoc = "The output .js file" }
59externsFile :: Term (Maybe FilePath)
60externsFile = value $ opt Nothing $ (optInfo [ "e", "externs" ])
61 { optDoc = "The output .e.ps file" }
64term = compile <$> inputFiles <*> outputFile <*> externsFile
70 , termDoc = "Compiles PureScript to Javascript"
73main = 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