
Hello fellow hackers. Here is a helpful package I wrote to ease the development of projects using cabal. It includes a :cabalset ghci command to set ghci options for your project, and a cabal-ghci executable to launch ghci with those options. Do you get errors when loading your project into ghci? Prelude> a ← return 1 <interactive>:1:3: Not in scope: `←' Prelude> :load Main Could not find module `Main': it is not a module in the current program, or in any known package. cabalset fixes these problems for you. Prelude> :cabalset :set "-i/home/atnnn/up1/src/dist/build/autogen" :set "-i/home/atnnn/up1/src/web" :set "-XUnicodeSyntax" :set "-Wall" Prelude> a ← return 1 <interactive>:1:12: Warning: Defaulting the following constraint(s) to type `Integer' (Num t0) arising from the literal `1' Prelude> :load Main Ok, modules loaded: Main, Application, Handlers. This works from any sub-directory of your project and accepts the following arguments: -fflag enable flag -f-flag disable flag exec load options for the exec executable To install: $ cabal update $ cabal install cabal-ghci $ cat >> ~/.ghci :m + Distribution.Dev.Interactive :def cabalset cabalSet :cabalset :m - Distribution.Dev.Interactive ^D Etienne Laurin

Hi Etienne,
Here is a helpful package I wrote to ease the development of projects using cabal.
thank you very much for this helpful tool! I notice that Haddock has trouble parsing the documentation: http://hackage.haskell.org/packages/archive/cabal-ghci/0.1/logs/failure/ghc-... Is that error hard to fix? Take care, Peter

thank you very much for this helpful tool!
:)
I notice that Haddock has trouble parsing the documentation:
http://hackage.haskell.org/packages/archive/cabal-ghci/0.1/logs/failure/ghc-...
Is that error hard to fix?
I have uploaded a new version of the source with haddock documentation. Etienne Laurin

On Thu, Sep 8, 2011 at 11:06 PM, Etienne Laurin
Hello fellow hackers.
Here is a helpful package I wrote to ease the development of projects using cabal.
It includes a :cabalset ghci command to set ghci options for your project, and a cabal-ghci executable to launch ghci with those options.
Is :cabalset custom per project or could I put the same things in my ~/.ghci? Did you know that cabal-dev supports loading your project into ghci? (I'm trying to understand how cabal-ghci is different than existing tools.) Jason

Here is a helpful package I wrote to ease the development of projects using cabal.
Is :cabalset custom per project or could I put the same things in my ~/.ghci?
Everytime I run :cabalset or cabal-ghci, it looks for a .cabal file in my current directory or any of its parents, it loads the cabal file and it generates a list of ghci options for that project.
Did you know that cabal-dev supports loading your project into ghci?
Yes :) Sadly, some of my test and build scripts don't yet work with cabal-dev.
(I'm trying to understand how cabal-ghci is different than existing tools.)

On Fri, Sep 9, 2011 at 2:44 PM, Etienne Laurin
Here is a helpful package I wrote to ease the development of projects using cabal.
Is :cabalset custom per project or could I put the same things in my ~/.ghci?
Everytime I run :cabalset or cabal-ghci, it looks for a .cabal file in my current directory or any of its parents, it loads the cabal file and it generates a list of ghci options for that project.
Did you know that cabal-dev supports loading your project into ghci?
Yes :)
Sadly, some of my test and build scripts don't yet work with cabal-dev.
It sounds like the two projects (cabal-ghci and cabal-dev) should get merged. It sounds like the cabal-ghci features would compliment the other cabal-dev features. Or maybe cabal should support "plugins" in the way hledger and git supports them. Food for thought. Thanks for explaining the difference! Jason

On Fri, Sep 9, 2011 at 22:17, Jason Dagit
On Thu, Sep 8, 2011 at 11:06 PM, Etienne Laurin
wrote: Hello fellow hackers.
Here is a helpful package I wrote to ease the development of projects using cabal.
It includes a :cabalset ghci command to set ghci options for your project, and a cabal-ghci executable to launch ghci with those options.
Is :cabalset custom per project or could I put the same things in my ~/.ghci?
Did you know you can also put a .ghci file in your project dir, and if you start ghci from that dir, it will also load that file? I think that allows you to replicate some of the functionality of this tool, since it allows per project ghci options. Erik

Hi, Am Samstag, den 10.09.2011, 11:26 +0200 schrieb Erik Hesselink:
On Fri, Sep 9, 2011 at 22:17, Jason Dagit
wrote: On Thu, Sep 8, 2011 at 11:06 PM, Etienne Laurin
wrote: Hello fellow hackers.
Here is a helpful package I wrote to ease the development of projects using cabal.
It includes a :cabalset ghci command to set ghci options for your project, and a cabal-ghci executable to launch ghci with those options.
Is :cabalset custom per project or could I put the same things in my ~/.ghci?
Did you know you can also put a .ghci file in your project dir, and if you start ghci from that dir, it will also load that file? I think that allows you to replicate some of the functionality of this tool, since it allows per project ghci options.
is this well known and documented enough? It seems to me that most people would not expect that running "ghci" in a directory can cause arbitrary commands to be executed. This could be a security issue, e.g. running ghci in a just downloaded software package with a rouge .ghci file... but I am not sure what can or should be done about it. Greetings, Joachim -- Joachim "nomeata" Breitner mail@joachim-breitner.de | nomeata@debian.org | GPG: 0x4743206C xmpp: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/

On Sat, Sep 10, 2011 at 18:51, Joachim Breitner
Am Samstag, den 10.09.2011, 11:26 +0200 schrieb Erik Hesselink:
Did you know you can also put a .ghci file in your project dir, and if you start ghci from that dir, it will also load that file? I think that allows you to replicate some of the functionality of this tool, since it allows per project ghci options.
is this well known and documented enough? It seems to me that most people would not expect that running "ghci" in a directory can cause arbitrary commands to be executed. This could be a security issue, e.g. running ghci in a just downloaded software package with a rouge .ghci file... but I am not sure what can or should be done about it.
Running ghci runs template haskell, which can already run arbitrary code. Not that that fact makes this more secure, but if you don't trust the Haskell packages you're installing, there are larger security issues than .ghci files. Erik

Hi, Am Samstag, den 10.09.2011, 19:34 +0200 schrieb Erik Hesselink:
On Sat, Sep 10, 2011 at 18:51, Joachim Breitner
wrote: Am Samstag, den 10.09.2011, 11:26 +0200 schrieb Erik Hesselink:
Did you know you can also put a .ghci file in your project dir, and if you start ghci from that dir, it will also load that file? I think that allows you to replicate some of the functionality of this tool, since it allows per project ghci options.
is this well known and documented enough? It seems to me that most people would not expect that running "ghci" in a directory can cause arbitrary commands to be executed. This could be a security issue, e.g. running ghci in a just downloaded software package with a rouge .ghci file... but I am not sure what can or should be done about it.
Running ghci runs template haskell, which can already run arbitrary code. Not that that fact makes this more secure, but if you don't trust the Haskell packages you're installing, there are larger security issues than .ghci files.
yes, but this requires actively loading a file. Executing arbitrary commads when someone starts ghci in a rouge folder (consider an examiner on a multi-user machine at a university) is of a different quality. Especially as the file is hidden – TH code can easily be checked for before. Also it affects invocations "ghc -e", which conceivably could be used in aliases for some action unrelated to running a ghci session, as in http://www.joachim-breitner.de/blog/archives/156-Haskell-on-the-Command-Line... Maybe the file shouldn’t be hidden, this would give some protection. Alternatively, ghci could keep a white-list of files somewhere ~/.ghci and ask if it should execute a .ghci file that has not been encountered before. I just noticed that it will not read files in directories not owned by you and warn you about it (e.g. in /tmp), which is a good start. But this does not help against files in packaged repositories. Greetings, Joachim -- Joachim "nomeata" Breitner mail@joachim-breitner.de | nomeata@debian.org | GPG: 0x4743206C xmpp: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/
participants (5)
-
Erik Hesselink
-
Etienne Laurin
-
Jason Dagit
-
Joachim Breitner
-
Peter Simons