on master help sign in
Avoid maybe in ob profile rts-flags
42524b0Matthew Bauer
lib/command/src/Obelisk/Command.hs+2−2
@@ -89,7 +89,7 @@ data ObCommand
89 = ObCommand_Init InitSource Bool
89 = ObCommand_Init InitSource Bool
90 | ObCommand_Deploy DeployCommand
90 | ObCommand_Deploy DeployCommand
91 | ObCommand_Run
91 | ObCommand_Run
92− | ObCommand_Profile (Maybe FilePath) (Maybe String)
92+ | ObCommand_Profile (Maybe FilePath) String
93 | ObCommand_Thunk ThunkCommand
93 | ObCommand_Thunk ThunkCommand
94 | ObCommand_Repl
94 | ObCommand_Repl
95 | ObCommand_Watch
95 | ObCommand_Watch
@@ -111,7 +111,7 @@ obCommand cfg = hsubparser
111 [ command "init" $ info (ObCommand_Init <$> initSource <*> initForce) $ progDesc "Initialize an Obelisk project"
111 [ command "init" $ info (ObCommand_Init <$> initSource <*> initForce) $ progDesc "Initialize an Obelisk project"
112 , command "deploy" $ info (ObCommand_Deploy <$> deployCommand cfg) $ progDesc "Prepare a deployment for an Obelisk project"
112 , command "deploy" $ info (ObCommand_Deploy <$> deployCommand cfg) $ progDesc "Prepare a deployment for an Obelisk project"
113 , command "run" $ info (pure ObCommand_Run) $ progDesc "Run current project in development mode"
113 , command "run" $ info (pure ObCommand_Run) $ progDesc "Run current project in development mode"
114− , command "profile" $ info (ObCommand_Profile <$> (optional (strOption (long "output" <> short 'o' <> help "Base output to use for profiling output. Suffixes are added to this based on the profiling type. Defaults to a timestamped path in the profile/ directory in the project's root." <> metavar "PATH"))) <*> (optional (strOption (long "rts-flags" <> help "RTS Flags to pass to the executable" <> metavar "FLAGS")))) $ progDesc "Run current project with profiling enabled"
114+ , command "profile" $ info (ObCommand_Profile <$> (optional (strOption (long "output" <> short 'o' <> help "Base output to use for profiling output. Suffixes are added to this based on the profiling type. Defaults to a timestamped path in the profile/ directory in the project's root." <> metavar "PATH"))) <*> (strOption (long "rts-flags" <> help "RTS Flags to pass to the executable." <> value "-p -hc" <> metavar "FLAGS" <> showDefault))) $ progDesc "Run current project with profiling enabled"
115 , command "thunk" $ info (ObCommand_Thunk <$> thunkCommand) $ progDesc "Manipulate thunk directories"
115 , command "thunk" $ info (ObCommand_Thunk <$> thunkCommand) $ progDesc "Manipulate thunk directories"
116 , command "repl" $ info (pure ObCommand_Repl) $ progDesc "Open an interactive interpreter"
116 , command "repl" $ info (pure ObCommand_Repl) $ progDesc "Open an interactive interpreter"
117 , command "watch" $ info (pure ObCommand_Watch) $ progDesc "Watch current project for errors and warnings"
117 , command "watch" $ info (pure ObCommand_Watch) $ progDesc "Watch current project for errors and warnings"
lib/command/src/Obelisk/Command/Run.hs+6−10
@@ -78,16 +78,12 @@ preprocessorIdentifier = "__preprocessor-apply-packages"
78profile
78profile
79 :: MonadObelisk m
79 :: MonadObelisk m
80 => FilePath
80 => FilePath
81− -> Maybe String
81+ -> String
82 -> m ()
82 -> m ()
83−profile profileBaseName mRtsFlags = withProjectRoot "." $ \root -> do
83+profile profileBaseName rtsFlags = withProjectRoot "." $ \root -> do
84 putLog Debug "Using profiled build of project."
84 putLog Debug "Using profiled build of project."
85 liftIO $ createDirectoryIfMissing False $ takeDirectory profileBaseName
85 liftIO $ createDirectoryIfMissing False $ takeDirectory profileBaseName
86− let -- Sane flags to enable by default, enable time profiling +
87− -- closure heap profiling.
88− defaultRtsFlags = [ "-p", "-hc" ]
89− rtsFlags = maybe defaultRtsFlags words mRtsFlags
90− nixBuildExpr = [hereLit|
86+ let nixBuildExpr = [hereLit|
91with (import ./. {});
87with (import ./. {});
92let
88let
93 exeSource = obelisk.nixpkgs.writeText "ob-run" ''
89 exeSource = obelisk.nixpkgs.writeText "ob-run" ''
@@ -127,9 +123,9 @@ in obelisk.nixpkgs.runCommand "ob-run" {
127 , T.unpack assets
123 , T.unpack assets
128 , profileBaseName
124 , profileBaseName
129 , "+RTS"
125 , "+RTS"
130− , "-po" <> profileBaseName ]
126+ , "-po" <> profileBaseName
131− <> rtsFlags
127+ ] <> words rtsFlags
132− <> ["-RTS"]
128+ <> [ "-RTS" ]
133 _ <- liftIO $ waitForProcess ph
129 _ <- liftIO $ waitForProcess ph
134 pure ()
130 pure ()
135
131