Closed chshersh closed 1 year ago
Okay, I was thinking about the interface and here is the proposed solution:
cliEnvSettingsRequiredTools :: [Tool cmd]
field from the CliEnvSettings
optionsTool
to not have the cmd
type parameterneed :: Monad ... => [Tool] -> m ()
So, instead of specifying a global list of tools, users can call the need
function in the required commands:
app :: App ()
app = Iris.asksCliEnv Iris.cliEnvCmd >>= \case
Download url -> do
need ["curl"]
runDownload URL
Evaluate hs -> do
need ["ghc", "cabal"]
runEvaluate hs
Is anyone working on this? I can take a look otherwise 😄
@german1608 I believe no one is looking (or at least haven't written about this explicitly). So feel free to work on this 🙂
Currently, the
CliEnvSettings
data type is defined in the following way:https://github.com/chshersh/iris/blob/0b9c50da0a277b298c62064929eb2f875c902841/src/Iris/Env.hs#L53-L71
And
defaultCliEnvSettings
:https://github.com/chshersh/iris/blob/0b9c50da0a277b298c62064929eb2f875c902841/src/Iris/Env.hs#L78-L86
The idea of using
()
in the type signature was to rely on type-changing record updates. Unfortunately, the following code doesn't compile:It fails with the error:
The problem here because the
cliEnvSettingsRequiredTools
is also parametrised bycmd
. So to change the type, you need to update both fields like this:Which is a shame. You need to set an extra field you don't care about all the time because you want to change the type of the CLI command.
It would be great to improve this interface. However, I don't have ideas at the moment. This requires some thinking 🤔