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