git.iko.soy/rowtype-yoga/purescript-native
on 53359aa help sign in
92 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 :: 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
41deriving instance Show (ModeOptions mode)
43-- |
44-- The data type of compiler options
45--
46data Options mode = Options {
47 -- |
48 -- Disable inclusion of the built in Prelude
49 --
50 optionsNoPrelude :: Bool
51 -- |
52 -- Disable tail-call elimination
53 --
54 , optionsNoTco :: Bool
55 -- |
56 -- Disable inlining of calls to return and bind for the Eff monad
57 --
58 , optionsNoMagicDo :: Bool
59 -- |
60 -- When specified, checks the type of `main` in the module, and generate a call to run main
61 -- after the module definitions.
62 --
63 , optionsMain :: Maybe String
64 -- |
65 -- Skip all optimizations
66 --
67 , optionsNoOptimizations :: Bool
68 -- |
69 -- Verbose error message
70 --
71 , optionsVerboseErrors :: Bool
72 -- |
73 -- Remove the comments from the generated js
74 , optionsNoComments :: Bool
75 -- |
76 -- Specify the namespace that PureScript modules will be exported to when running in the
77 -- browser.
78 --
79 , optionsAdditional :: ModeOptions mode
80 } deriving Show
82-- |
83-- Default compiler options
84--
85defaultCompileOptions :: Options Compile
86defaultCompileOptions = Options False False False Nothing False False False (CompileOptions "PS" [] [])
88-- |
89-- Default make options
90--
91defaultMakeOptions :: Options Make
92defaultMakeOptions = Options False False False Nothing False False False MakeOptions