
Hi all, It seems to me that UseSandbox is slightly strangely defined at the moment. It's currently defined as data UseSandbox = UseSandbox FilePath | NoSandbox but it seems to me that it would be better to define it such that it actually contains relevant information about the sandbox if the UseSandbox constructor case instead of just the filepath. On the one hand this would require a separate "read-the-sandbox-information-we-need" function somewhere before individual commands run, but that would give us the opportunity to actually give relevant warnings in various significant cases; see for example https://github.com/haskell/cabal/issues/2381 Am I missing something which necessitates using only the FilePath? (Perhaps some dependence on sub-command switches, or similar?) Any thoughts, comments...? Regards,

On 07/03/2015 04:00 PM, Mikhail Glushenkov wrote:
Hi,
On 3 July 2015 at 06:30, Bardur Arantsson
wrote: Hi all,
Am I missing something which necessitates using only the FilePath?
Adding extra info is absolutely fine, it's just that I never needed it. What do you want to add?
Well, I'd like to split up the "get all the information we need" bit from the individual commands. That would perhaps make it easier to validate things like "does GHC_PACKAGE_PATH [or whatever] point at an existing directory" in a consistent manner across all commands and thus hopefully provide better feedback for broken setups/environments. (I also tend to find it good "hygiene" to split things up this way, but that's perhaps more a matter of taste.) See e.g. the issue I pointed to: https://github.com/haskell/cabal/issues/2381 (I don't think a full solution is possible at this time due to the fact that the env variables are only retrieved in the "exec" subcommand). Regards,

On 07/03/2015 05:53 PM, Mikhail Glushenkov wrote:
Hi,
On 3 July 2015 at 16:47, Bardur Arantsson
wrote: Well, I'd like to split up the "get all the information we need" bit from the individual commands.
UseSandbox is produced by loadConfigOrSandboxConfig. Perhaps you can move your check there?
The checks rely on information which the sub-commands will use (or will have to look up a second time)... hence I want to store it in UseSandbox :). Regards,

Hi,
On 3 July 2015 at 18:09, Bardur Arantsson
The checks rely on information which the sub-commands will use (or will have to look up a second time)... hence I want to store it in UseSandbox :).
Yeah, so you can do the check in loadConfigOrSandboxConfig and then put the result of it in the UseSandbox value that you return.

On 07/03/2015 11:44 PM, Mikhail Glushenkov wrote:
Hi,
On 3 July 2015 at 18:09, Bardur Arantsson
wrote: The checks rely on information which the sub-commands will use (or will have to look up a second time)... hence I want to store it in UseSandbox :).
Yeah, so you can do the check in loadConfigOrSandboxConfig and then put the result of it in the UseSandbox value that you return.
(Sorry, think I did a personal reply instead of reply-to-list. Here it is again for the rest of you...) Exactamundo. I take it there's no objections on the ground of "but UseSandbox MUST ..."? I took that sentinment from your first post. It'll probably be easier to evaluate these things properly when I produce actual pull req's. Regards,
participants (2)
-
Bardur Arantsson
-
Mikhail Glushenkov