git.iko.soy/rowtype-yoga/purescript-native
on a23d2a0 help sign in
91 lines 2.5 kB history raw
1-----------------------------------------------------------------------------
2--
3-- Module : Language.PureScript.Options
4-- Copyright : (c) Phil Freeman 2013
5-- License : MIT
6--
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
9-- Portability :
10--
11-- |
12-- The data type of compiler options
13--
14-----------------------------------------------------------------------------
16{-# LANGUAGE GADTs, DataKinds, StandaloneDeriving #-}
18module Language.PureScript.Options where
20-- |
21-- Indicates the mode of the compiler. Lifted using DataKinds to refine the Options type.
22--
23data Mode = Compile | Make
25-- |
26-- Per-mode options
27--
28data ModeOptions mode where
29 CompileOptions :: String -> [String] -> [String] -> ModeOptions Compile
30 MakeOptions :: Maybe FilePath -> ModeOptions Make
32browserNamespace :: ModeOptions Compile -> String
33browserNamespace (CompileOptions ns _ _) = ns
35entryPointModules :: ModeOptions Compile -> [String]
36entryPointModules (CompileOptions _ ms _) = ms
38codeGenModules :: ModeOptions Compile -> [String]
39codeGenModules (CompileOptions _ _ ms) = ms
41requirePath :: ModeOptions Make -> Maybe FilePath
42requirePath (MakeOptions mp) = mp
44deriving instance Show (ModeOptions mode)
46-- |
47-- The data type of compiler options
48--
49data Options mode = Options {
50 -- |
51 -- Disable tail-call elimination
52 --
53 optionsNoTco :: Bool
54 -- |
55 -- Disable inlining of calls to return and bind for the Eff monad
56 --
57 , optionsNoMagicDo :: Bool
58 -- |
59 -- When specified, checks the type of `main` in the module, and generate a call to run main
60 -- after the module definitions.
61 --
62 , optionsMain :: Maybe String
63 -- |
64 -- Skip all optimizations
65 --
66 , optionsNoOptimizations :: Bool
67 -- |
68 -- Verbose error message
69 --
70 , optionsVerboseErrors :: Bool
71 -- |
72 -- Remove the comments from the generated js
73 , optionsNoComments :: Bool
74 -- |
75 -- Specify the namespace that PureScript modules will be exported to when running in the
76 -- browser.
77 --
78 , optionsAdditional :: ModeOptions mode
79 } deriving Show
81-- |
82-- Default compiler options
83--
84defaultCompileOptions :: Options Compile
85defaultCompileOptions = Options False False Nothing False False False (CompileOptions "PS" [] [])
87-- |
88-- Default make options
89--
90defaultMakeOptions :: Options Make
91defaultMakeOptions = Options False False Nothing False False False (MakeOptions Nothing)