forked from purescript/purescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptions.hs
More file actions
92 lines (81 loc) · 2.39 KB
/
Options.hs
File metadata and controls
92 lines (81 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
-----------------------------------------------------------------------------
--
-- Module : Language.PureScript.Options
-- Copyright : (c) Phil Freeman 2013
-- License : MIT
--
-- Maintainer : Phil Freeman <paf31@cantab.net>
-- Stability : experimental
-- Portability :
--
-- |
-- The data type of compiler options
--
-----------------------------------------------------------------------------
{-# LANGUAGE GADTs, DataKinds, StandaloneDeriving #-}
module Language.PureScript.Options where
-- |
-- Indicates the mode of the compiler. Lifted using DataKinds to refine the Options type.
--
data Mode = Compile | Make
-- |
-- Per-mode options
--
data ModeOptions mode where
CompileOptions :: String -> [String] -> [String] -> ModeOptions Compile
MakeOptions :: ModeOptions Make
browserNamespace :: ModeOptions Compile -> String
browserNamespace (CompileOptions ns _ _) = ns
entryPointModules :: ModeOptions Compile -> [String]
entryPointModules (CompileOptions _ ms _) = ms
codeGenModules :: ModeOptions Compile -> [String]
codeGenModules (CompileOptions _ _ ms) = ms
deriving instance Show (ModeOptions mode)
-- |
-- The data type of compiler options
--
data Options mode = Options {
-- |
-- Disable inclusion of the built in Prelude
--
optionsNoPrelude :: Bool
-- |
-- Disable tail-call elimination
--
, optionsNoTco :: Bool
-- |
-- Disable inlining of calls to return and bind for the Eff monad
--
, optionsNoMagicDo :: Bool
-- |
-- When specified, checks the type of `main` in the module, and generate a call to run main
-- after the module definitions.
--
, optionsMain :: Maybe String
-- |
-- Skip all optimizations
--
, optionsNoOptimizations :: Bool
-- |
-- Verbose error message
--
, optionsVerboseErrors :: Bool
-- |
-- Remove the comments from the generated js
, optionsNoComments :: Bool
-- |
-- Specify the namespace that PureScript modules will be exported to when running in the
-- browser.
--
, optionsAdditional :: ModeOptions mode
} deriving Show
-- |
-- Default compiler options
--
defaultCompileOptions :: Options Compile
defaultCompileOptions = Options False False False Nothing False False False (CompileOptions "PS" [] [])
-- |
-- Default make options
--
defaultMakeOptions :: Options Make
defaultMakeOptions = Options False False False Nothing False False False MakeOptions