sandbox hashcode in dist directory

2013-11-10 Thread Tim Docker
I'm attempting to use ghc-mod and emacs to get on the fly compiling 
working again. This is always pleasing when it works,
but it seems a never ending challenge to get it to find all my 
dependences :-(


Several of my cabal packages require autogenerated code which used to 
end up in dist/build/autogen. ghc-mod is configured to

search this directory, as per:

https://github.com/kazu-yamamoto/ghc-mod/blob/169069f6232c617f06f24b9caa40f8f967c1cbf5/Language/Haskell/GhcMod/CabalApi.hs#L71

However since starting to use cabal sandboxes, the generated code ends 
up in a directory like this:


dist/dist-sandbox-c4c8b1d4/build/autogen/

What is this hashcode for? Is it always generated when using a sandbox? 
If I have code (like ghc-mod) that needs to access the

build directory, how do I work out the value of the hashcode?

Thanks,

Tim

___
cabal-devel mailing list
cabal-devel@haskell.org
http://www.haskell.org/mailman/listinfo/cabal-devel


Re: sandbox hashcode in dist directory

2013-11-10 Thread Tim Docker
Thanks for the quick reply - I'll make an attempt to get ghc-mod to be 
compatible with this.


Tim

On 11/11/13 11:26, Mikhail Glushenkov wrote:

Hi,

On Sun, Nov 10, 2013 at 11:26 PM, Tim Docker t...@dockerz.net wrote:

However since starting to use cabal sandboxes, the generated code ends up in
a directory like this:

 dist/dist-sandbox-c4c8b1d4/build/autogen/

What is this hashcode for? Is it always generated when using a sandbox? If I
have code (like ghc-mod) that needs to access the
build directory, how do I work out the value of the hashcode?

So that you can use the same add-source dependency with several
different sandboxes and also build it standalone. See discussion in
https://github.com/haskell/cabal/issues/1281

As to how generate the hash code yourself, the relevant part of the
source code is 
https://github.com/haskell/cabal/blob/master/cabal-install/Distribution/Client/Sandbox.hs#L129
That function takes the absolute path to the current sandbox
('/path/to/.cabal-sandbox') as input.




___
cabal-devel mailing list
cabal-devel@haskell.org
http://www.haskell.org/mailman/listinfo/cabal-devel