1-----------------------------------------------------------------------------
4-- Copyright : (c) Phil Freeman 2013
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
13-----------------------------------------------------------------------------
17import qualified Language.PureScript as P
18import Data.Maybe (mapMaybe)
19import Data.List (intercalate)
20import System.Console.CmdTheLine
21import Control.Applicative
22import Control.Monad (forM)
23import System.Exit (exitSuccess, exitFailure)
24import qualified Text.Parsec as P
25import qualified System.IO.UTF8 as U
26import qualified Data.Map as M
28compile :: [FilePath] -> Maybe FilePath -> Maybe FilePath -> IO ()
29compile inputFiles outputFile externsFile = do
30 asts <- fmap (fmap concat . sequence) $ forM inputFiles $ \inputFile -> do
31 text <- U.readFile inputFile
32 return $ P.runIndentParser P.parseDeclarations text
38 case P.compile decls of
42 Right (js, exts, _) -> do
44 Just path -> U.writeFile path js
45 Nothing -> U.putStrLn js
48 Just filePath -> U.writeFile filePath exts
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