1-----------------------------------------------------------------------------
3-- Module : Language.PureScript
4-- Copyright : (c) Phil Freeman 2013
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
13-----------------------------------------------------------------------------
15module Language.PureScript (module P, compile) where
17import Language.PureScript.Values as P
18import Language.PureScript.Types as P
19import Language.PureScript.Kinds as P
20import Language.PureScript.Declarations as P
21import Language.PureScript.Names as P
22import Language.PureScript.Parser as P
23import Language.PureScript.CodeGen as P
24import Language.PureScript.TypeChecker as P
25import Language.PureScript.Pretty as P
26import Language.PureScript.Sugar as P
27import Language.PureScript.Options as P
29import Data.List (intercalate)
30import Control.Monad (when, forM)
31import Control.Applicative ((<$>))
32import qualified Data.Map as M
34compile :: Options -> [Module] -> Either String (String, String, Environment)
36 desugared <- desugar ms
37 (elaborated, env) <- runCheck $ forM desugared $ \(Module moduleName decls) -> Module moduleName <$> typeCheckAll (ModuleName moduleName) decls
38 let js = concatMap (flip (moduleToJs opts) env) $ elaborated
39 let exts = intercalate "\n" . map (flip moduleToPs env) $ elaborated
41 _ | optionsRunMain opts -> do
42 when ((ModuleName (ProperName "Main"), Ident "main") `M.notMember` (names env)) $
43 Left "Main.main is undefined"
44 return $ js ++ [JSApp (JSAccessor "main" (JSVar (Ident "Main"))) []]
45 | otherwise -> return js
46 return (prettyPrintJS js', exts, env)
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