packages feed

hix 0.5.6 → 0.5.7

raw patch · 4 files changed

+70/−17 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Hix.Options: ExtraGhciOptions :: Text -> ExtraGhciOptions
+ Hix.Options: ExtraGhcidOptions :: Text -> ExtraGhcidOptions
+ Hix.Options: GhcidOptions :: GhciOptions -> Maybe ExtraGhcidOptions -> GhcidOptions
+ Hix.Options: [$sel:extra:GhciOptions] :: GhciOptions -> Maybe ExtraGhciOptions
+ Hix.Options: [$sel:extra:GhcidOptions] :: GhcidOptions -> Maybe ExtraGhcidOptions
+ Hix.Options: [$sel:ghci:GhcidOptions] :: GhcidOptions -> GhciOptions
+ Hix.Options: data GhcidOptions
+ Hix.Options: extraGhciParser :: Parser (Maybe ExtraGhciOptions)
+ Hix.Options: extraGhcidParser :: Parser (Maybe ExtraGhcidOptions)
+ Hix.Options: ghcidParser :: Parser GhcidOptions
+ Hix.Options: instance Data.String.IsString Hix.Options.ExtraGhciOptions
+ Hix.Options: instance Data.String.IsString Hix.Options.ExtraGhcidOptions
+ Hix.Options: instance GHC.Classes.Eq Hix.Options.ExtraGhciOptions
+ Hix.Options: instance GHC.Classes.Eq Hix.Options.ExtraGhcidOptions
+ Hix.Options: instance GHC.Generics.Generic Hix.Options.ExtraGhciOptions
+ Hix.Options: instance GHC.Generics.Generic Hix.Options.ExtraGhcidOptions
+ Hix.Options: instance GHC.Generics.Generic Hix.Options.GhcidOptions
+ Hix.Options: instance GHC.Show.Show Hix.Options.ExtraGhciOptions
+ Hix.Options: instance GHC.Show.Show Hix.Options.ExtraGhcidOptions
+ Hix.Options: instance GHC.Show.Show Hix.Options.GhcidOptions
+ Hix.Options: newtype ExtraGhciOptions
+ Hix.Options: newtype ExtraGhcidOptions
- Hix.Ghci: ghciCmdline :: GhciTest -> Path Abs File -> Maybe (Path Abs File) -> GhciRun
+ Hix.Ghci: ghciCmdline :: GhciTest -> Maybe ExtraGhciOptions -> Path Abs File -> Maybe (Path Abs File) -> GhciRun
- Hix.Ghci: ghcidCmdlineFromOptions :: Path Abs Dir -> GhciOptions -> M GhcidRun
+ Hix.Ghci: ghcidCmdlineFromOptions :: Path Abs Dir -> GhcidOptions -> M GhcidRun
- Hix.Ghci: printGhcidCmdline :: GhciOptions -> M ()
+ Hix.Ghci: printGhcidCmdline :: GhcidOptions -> M ()
- Hix.Options: GhciOptions :: Either GhciConfig JsonConfig -> Maybe (Path Abs Dir) -> TargetSpec -> TestOptions -> GhciOptions
+ Hix.Options: GhciOptions :: Either GhciConfig JsonConfig -> Maybe (Path Abs Dir) -> TargetSpec -> TestOptions -> Maybe ExtraGhciOptions -> GhciOptions
- Hix.Options: GhcidCmd :: GhciOptions -> Command
+ Hix.Options: GhcidCmd :: GhcidOptions -> Command

Files

hix.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           hix-version:        0.5.6+version:        0.5.7 synopsis:       Haskell/Nix development build tools description:    See https://hackage.haskell.org/package/hix/docs/Hix.html category:       Build
lib/Hix/Ghci.hs view
@@ -31,7 +31,14 @@ import Hix.Json (jsonConfig) import Hix.Monad (M, noteGhci) import qualified Hix.Options as Options-import Hix.Options (GhciOptions (GhciOptions), TargetSpec (TargetForFile), TestOptions (TestOptions))+import Hix.Options (+  ExtraGhciOptions,+  ExtraGhcidOptions (ExtraGhcidOptions),+  GhciOptions (GhciOptions),+  GhcidOptions,+  TargetSpec (TargetForFile),+  TestOptions (TestOptions),+  ) import Hix.Path (rootDir)  relativeToComponent ::@@ -134,21 +141,24 @@  searchPathArg :: NonEmpty (Path Abs Dir) -> Text searchPathArg paths =-  [exon|-i#{colonSeparated}|]+  [exon| -i#{colonSeparated}|]   where     colonSeparated = Text.intercalate ":" (pathText <$> toList paths)  ghciCmdline ::   GhciTest ->+  Maybe ExtraGhciOptions ->   Path Abs File ->   Maybe (Path Abs File) ->   GhciRun-ghciCmdline test scriptFile runScriptFile =+ghciCmdline test extra scriptFile runScriptFile =   GhciRun {..}   where-    shell = [exon|##{Text.unwords (coerce test.args)} #{sp} -ghci-script=##{toFilePath scriptFile}|]+    shell = [exon|##{Text.unwords (coerce test.args)}#{sp} -ghci-script=##{toFilePath scriptFile}#{extraOpts}|]     run = runScriptFile <&> \ f -> [exon|-ghci-script=##{toFilePath f}|]     sp = foldMap searchPathArg (nonEmpty test.searchPath)+    extraOpts | Just o <- extra = [exon| ##{o}|]+              | otherwise = ""  ghciCmdlineFromOptions ::   Path Abs Dir ->@@ -158,15 +168,19 @@   conf <- assemble opt   shellScriptFile <- lift (ghciScriptFile tmp conf.script)   runScriptFile <- lift (traverse (ghciScriptFile tmp) conf.test)-  pure (ghciCmdline conf shellScriptFile runScriptFile)+  pure (ghciCmdline conf opt.extra shellScriptFile runScriptFile)  ghcidCmdlineFromOptions ::   Path Abs Dir ->-  GhciOptions ->+  GhcidOptions ->   M GhcidRun ghcidCmdlineFromOptions tmp opt = do-  ghci <- ghciCmdlineFromOptions tmp opt-  pure (GhcidRun [exon|ghcid --command="ghci #{ghci.shell}" --test='##{fromMaybe "main" ghci.test.test}'|] ghci)+  ghci <- ghciCmdlineFromOptions tmp opt.ghci+  let+    test = fromMaybe "main" ghci.test.test+  pure (GhcidRun [exon|ghcid --command="ghci #{ghci.shell}" --test='##{test}'#{foldMap extra opt.extra}|] ghci)+  where+    extra (ExtraGhcidOptions o) = [exon| ##{o}|]  printGhciCmdline ::   GhciOptions ->@@ -177,7 +191,7 @@   liftIO (Text.putStrLn [exon|ghci #{cmd.shell} #{fold cmd.run}|])  printGhcidCmdline ::-  GhciOptions ->+  GhcidOptions ->   M () printGhcidCmdline opt = do   tmp <- lift hixTempDir
lib/Hix/Options.hs view
@@ -98,15 +98,33 @@   }   deriving stock (Show, Generic) +newtype ExtraGhciOptions =+  ExtraGhciOptions Text+  deriving stock (Eq, Show, Generic)+  deriving newtype (IsString)++newtype ExtraGhcidOptions =+  ExtraGhcidOptions Text+  deriving stock (Eq, Show, Generic)+  deriving newtype (IsString)+ data GhciOptions =   GhciOptions {     config :: Either GhciConfig JsonConfig,     root :: Maybe (Path Abs Dir),     component :: TargetSpec,-    test :: TestOptions+    test :: TestOptions,+    extra :: Maybe ExtraGhciOptions   }   deriving stock (Show, Generic) +data GhcidOptions =+  GhcidOptions {+    ghci :: GhciOptions,+    extra :: Maybe ExtraGhcidOptions+  }+  deriving stock (Show, Generic)+ data NewOptions =   NewOptions {     config :: NewProjectConfig@@ -131,7 +149,7 @@   |   EnvRunner EnvRunnerCommandOptions   |-  GhcidCmd GhciOptions+  GhcidCmd GhcidOptions   |   GhciCmd GhciOptions   |@@ -250,6 +268,14 @@   cd <- cdParser   pure TestOptions {..} +extraGhciParser :: Parser (Maybe ExtraGhciOptions)+extraGhciParser =+  optional (strOption (long "ghci-options" <> help "Additional command line options to pass to ghci"))++extraGhcidParser :: Parser (Maybe ExtraGhcidOptions)+extraGhcidParser =+  optional (strOption (long "ghcid-options" <> help "Additional command line options to pass to ghcid"))+ envParser :: Parser EnvRunnerCommandOptions envParser = do   options <- do@@ -266,8 +292,15 @@   root <- rootParser   component <- targetSpecParser   test <- testOptionsParser+  extra <- extraGhciParser   pure GhciOptions {..} +ghcidParser :: Parser GhcidOptions+ghcidParser = do+  ghci <- ghciParser+  extra <- extraGhcidParser+  pure GhcidOptions {..}+ newParser :: Parser NewOptions newParser = do   name <- strOption (long "name" <> short 'n' <> help "The name of the new project and its main package")@@ -289,7 +322,7 @@   <>   command "ghci-cmd" (GhciCmd <$> info ghciParser (progDesc "Print a ghci cmdline to load a module in a Hix env"))   <>-  command "ghcid-cmd" (GhcidCmd <$> info ghciParser (progDesc "Print a ghcid cmdline to run a function in a Hix env"))+  command "ghcid-cmd" (GhcidCmd <$> info ghcidParser (progDesc "Print a ghcid cmdline to run a function in a Hix env"))   <>   command "new" (NewCmd <$> info newParser (progDesc "Create a new Hix project in the current directory"))   <>
test/Hix/Test/GhciTest.hs view
@@ -27,6 +27,7 @@   ComponentSpec (ComponentSpec),   EnvRunnerOptions (EnvRunnerOptions),   GhciOptions (GhciOptions, component),+  GhcidOptions (GhcidOptions),   PackageSpec (PackageSpec),   TargetSpec (TargetForComponent, TargetForFile),   TestOptions (TestOptions),@@ -89,8 +90,8 @@     component = Just (ComponentSpec "test" (Just (SourceDir [reldir|test|])))   } -options :: GhciOptions-options =+ghciOptions :: GhciOptions+ghciOptions =   GhciOptions {     config = Left GhciConfig {       packages,@@ -105,9 +106,14 @@       test = Just "test_server",       runner = Just "generic",       cd = ChangeDir True-    }+    },+    extra = Nothing   } +options :: GhcidOptions+options =+  GhcidOptions {ghci = ghciOptions, extra = Nothing}+ ghcidTarget ::   Path Abs Dir ->   Path Abs File ->@@ -165,5 +171,5 @@  test_moduleName :: TestT IO () test_moduleName = do-  conf <- evalEither =<< liftIO (runM root (assemble options { component = spec4 }))+  conf <- evalEither =<< liftIO (runM root (assemble options.ghci { component = spec4 }))   target_moduleName === conf.script