git.iko.soy/rowtype-yoga/purescript-native
on 73a023f help sign in
93 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 -- Perform type checks at runtime
57 --
58 , optionsPerformRuntimeTypeChecks :: Bool
59 -- |
60 -- Disable inlining of calls to return and bind for the Eff monad
61 --
62 , optionsNoMagicDo :: Bool
63 -- |
64 -- When specified, checks the type of `main` in the module, and generate a call to run main
65 -- after the module definitions.
66 --
67 , optionsMain :: Maybe String
68 -- |
69 -- Skip all optimizations
70 --
71 , optionsNoOptimizations :: Bool
72 -- |
73 -- Verbose error message
74 --
75 , optionsVerboseErrors :: Bool
76 -- |
77 -- Specify the namespace that PureScript modules will be exported to when running in the
78 -- browser.
79 --
80 , optionsAdditional :: ModeOptions mode
81 } deriving Show
83-- |
84-- Default compiler options
85--
86defaultCompileOptions :: Options Compile
87defaultCompileOptions = Options False False False False Nothing False False (CompileOptions "PS" [] [])
89-- |
90-- Default make options
91--
92defaultMakeOptions :: Options Make
93defaultMakeOptions = Options False False False False Nothing False False MakeOptions