Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  cabal sandbox add-source + cabal repl (for       tracking Idris
      git version) (Andreas Reuleaux)
   2. Re:  cabal sandbox add-source + cabal repl (for tracking
      Idris git version) (Karl Voelker)
   3. Re:  cabal sandbox add-source + cabal repl (for   tracking
      Idris git version) (Andreas Reuleaux)


----------------------------------------------------------------------

Message: 1
Date: Mon, 14 Jul 2014 05:25:27 +0100
From: Andreas Reuleaux <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] cabal sandbox add-source + cabal repl
        (for    tracking Idris git version)
Message-ID: <[email protected]>
Content-Type: text/plain

Being somehow new to cabal sandboxes, I would expect that sources that I
add with

  cabal sandbox add-source /some/path

are available to me in my local (sandbox aware) cabal repl, this is
however not the case, or at least I haven't figured out how to make this
this work.

I am trying to use Idris as a library - roughly as described in
http://brianmckenna.org/blog/idris_library, (and in particular the
"cabal sandbox add-source..." step, described there) but my question is
really more Haskell and cabal sandbox than Idris related, therefore I am
asking here.

I have successfully installed Idris from git in a sandbox (For
completeness's sake here are the individual steps, including some test
steps with highlight-versions, that are not strictly necessary). I
install only the idris deps via cabal (i.e. from hackage), idris itself
via make from its git sources:
--------------------

(within my dir ~/idr, i.e. creating ~/idr/dev here)
git clone git://github.com/idris-lang/Idris-dev dev
cd dev
cabal sandbox init
cabal update
cabal install highlight-versions

(activate my sandbox with some bash magic, i.e. include
/home/reuleaux/idr/dev/.cabal-sandbox/bin
in my PATH, so that the command highlight-versions is found:)

cabal install --dry-run --only-dependencies idris | highlight-versions

(now the wet run:)
cabal install --only-dependencies idris

make
(which installs idris from its git sources)
I have two more wrappers in my sandbox for that purpose:
(really some bash magic...)

* ghc:
  exec "/usr/bin/ghc" -no-user-package-db 
-package-db=/home/reuleaux/idr/dev/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d
 "$@"

* ghc-pkg:
  exec "/usr/bin/ghc-pkg" --no-user-package-db 
--package-db=/home/reuleaux/idr/dev/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d
 "$@"

  I know that "cabal sandbox hc-pkg" is the regular wrapper for
  ghc-pkg, but idris make expects a ghc-pkg command (not cabal sandbox hc-pkg)


Now within ~/dev I can e.g. call

* "idris" or 

* cabal repl
  and then

  > :m +Idris.Parser

  i.e. load some idris modules on the repl
--------------------

So far, so good.

Now I would like to track that dev version of idris in a separate
directory / sandbox, I am therefore using "cabal sandbox add-source...":

mkdir ~/foo
cd foo
cabal sandbox init
cabal sandbox add-source ~/idr/dev
cabal update

(I don't mind reinstalling the deps, not sure if this is really
necessary:)

cabal install --only-dependencies idris


I would think that within foo, I should be able to
just do e.g.

cabal repl
> :m +Idris.Parser


(as cabal repl is sandbox aware, as I learned) but nope !?

    Prelude > :m +Idris.Parser

    <no location info>:
        Could not find module `Idris.Parser'
        It is not a module in the current program, or in any known package.
    Prelude >

Well I can see the sources with

    [sb] reuleaux@mirabelle ~/foo $ cabal sandbox list-sources
    Source dependencies registered in the current sandbox
    ('/home/reuleaux/foo/.cabal-sandbox'):

    /home/reuleaux/idr/dev

    To unregister source dependencies, use the 'sandbox delete-source' command.
    [sb] reuleaux@mirabelle ~/foo $

But that's about it. 

Similarly: How would I use these added sources with ghc? Do I have to
use both:

* /home/reuleaux/idr/dev/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d

* and 
  /home/reuleaux/idr/foo/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d

in my -package-db ?


I am happy to give more details of my installation, if
necessary (I am on debian jessie, my cabal is v 1.20)


Thanks in advance.

-Andreas


------------------------------

Message: 2
Date: Sun, 13 Jul 2014 22:12:18 -0700
From: Karl Voelker <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] cabal sandbox add-source + cabal repl
        (for tracking Idris git version)
Message-ID:
        <[email protected]>
Content-Type: text/plain

On Sun, Jul 13, 2014, at 09:25 PM, Andreas Reuleaux wrote:
> mkdir ~/foo
> cd foo
> cabal sandbox init
> cabal sandbox add-source ~/idr/dev
> cabal update
> cabal install --only-dependencies idris
> 
> 
> I would think that within foo, I should be able to
> just do e.g.
> 
> cabal repl
> > :m +Idris.Parser
> 
> 

I think you just need to "cabal install idris" in this sandbox. The
add-source command just tells cabal to use those sources instead of
downloading sources from Hackage -- when you ask it to install that
package.

-Karl


------------------------------

Message: 3
Date: Mon, 14 Jul 2014 10:33:37 +0100
From: Andreas Reuleaux <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] cabal sandbox add-source + cabal repl
        (for    tracking Idris git version)
Message-ID: <[email protected]>
Content-Type: text/plain

OK, I see, thanks a lot, and yes: that seems to work fine.

When calling
  cabal install idris 
in my sandbox, I can see in the beginning of the compilation
messages, that it's using my idr/dev now:

Resolving dependencies...
[1 of 1] Compiling Main             ( 
/home/reuleaux/idr/dev/dist/dist-sandbox-b7fec085/setup/setup.hs, 
/home/reuleaux/idr/dev/dist/dist-sandbox-b7fec085/setup/Main.o )


Is there a better way to verify though (apart from looking at
these compilation messages, in the cabal repl maybe),
that cabal is indeed using my other idr/dev sandbox
(and not Idris from hackage) ?

-Andreas


>
> I think you just need to "cabal install idris" in this sandbox. The
> add-source command just tells cabal to use those sources instead of
> downloading sources from Hackage -- when you ask it to install that
> package.
>
> -Karl
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners


------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 73, Issue 10
*****************************************

Reply via email to