[Haskell-cafe] Using stack outside the project box

Galaxy Being borgauf at gmail.com
Sun Jun 6 21:08:42 UTC 2021


I could use some examples maybe. So I do

Prelude> :show paths
current working directory:
  /home/galaxybeing/Dropbox/org/RealWorldHaskell
module import search paths:
  .

...and there is no *.yaml file in this directory. I'm saying there's a
disjoint between where my ghci REPL inside of Emacs is working and the
actual :! pwd. And I when I do find the appropriate yaml I'd need some
examples on the way to add the correct lines to get the packages, the
ghc/ghci platform. I've tried just a generic stack command from the command
prompt, which I assumed would apply to wherever my "global" Haskell is --
to no avail, just cryptic errors talking about downloaded code examples.

On Sun, Jun 6, 2021 at 4:01 PM Jeff Clites via Haskell-Cafe <
haskell-cafe at haskell.org> wrote:

> 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.
>
> _______________________________________________
> 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.



-- 
⨽
Lawrence Bottorff
Grand Marais, MN, USA
borgauf at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210606/35e2321e/attachment.html>


More information about the Haskell-Cafe mailing list