[Haskell-cafe] Using stack outside the project box

Jeff Clites jclites at mac.com
Sun Jun 6 20:55:56 UTC 2021


Run ‘stack ghci’ and it will log the path to the YAML file you can edit to customize what configuration it uses when run outside of a project. Here you can specify additional packages you want to be available, and you set the resolver version which controls the GHC version. (Then you configure emacs to run ‘stack ghci’ instead of ‘ghci’.)

Jeff

> On Jun 6, 2021, at 12:45 PM, Galaxy Being <borgauf at gmail.com> wrote:
> 
> As a beginner, I was told to use stack. And I seemed to get something Haskell installed initially on my Ubuntu 21.04. But stack seems to be geared toward projects and compiling executables with ghc, and not a global ghci REPL-based way. I'm using Emacs org mode "Babel" which allows for a very nice "literate" programming in tandem with a running REPL in many REPL-friendly languages, e.g., here are code blocks in an org-mode file
> 
> #+begin_src haskell :results silent :exports code
> data Peano = Zero | Succ Peano deriving (Show)
> #+end_src
> 
> #+begin_src haskell :results silent :exports code
> myThree = Succ (Succ (Succ Zero))
> #+end_src
> 
> #+begin_src haskell :results verbatim :exports both
> myThree
> #+end_src
> 
> #+RESULTS:
> : Succ (Succ (Succ Zero))
> 
> I simply hit Evaluate (Ctr-C Ctr-C) and the evaluation is handled by a running ghci REPL started up in another Emacs buffer. Supposedly, a haskell-mode and a specific Babel ob-haskell package are working together to enable this. And so it works okay, once quirks (must enclose multi-lined code in :{..:} and every REPL session seems to need a :set +m as well). I'm really quite happy with this way of doing things and have resisted the whole monolithic 1) create project in a directory, 2) put code into .hs file, 3) compile with ghc.
> 
> But what I'm constantly having problems with is getting additional packages beyond the Prelude basics. My org files are in various directories, but I want (like most languages offer) to simply interact with that language on a global level wherever I am, whatever files and directories and Haskell code I'm working on. Sometimes doing an import works; often enough not. Then I have to do something with stack -- hopefully globally . . . and there the confusion and inconsistencies begin. Lately I can't seem to get Safe installed. And all docs about editing some yaml stuff get me lost in the weeds quickly. What yaml where for my "global" situation?
> 
> If you simply say to me, Don't try to work outside of the project--hs files--compile to executable framework I'll say okay, then have to decide whether I want to stay within the org-mode world or leave Haskell for an org-mode friendlier language. And no, lhs and jupyter are primitive compared to org-mode literate programming. Both are a step backwards.
> 
> Any help on working outside the project box with stack, e.g., how to install and use packages (and even how to update/upgrade ghc and ghci would be a start!).
> 
> -
>> Lawrence Bottorff
> Grand Marais, MN, USA
> borgauf at gmail.com
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210606/b2d4c4aa/attachment.html>


More information about the Haskell-Cafe mailing list