<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>I believe you wanted to be able to run code without having to set up a project. If you run a stack command from outside of a project, there is a default stack.yaml that it uses. (That corresponds to a default “global” project.) If you run ‘stack ghci’ (just that, from a directory that doesn’t have a stack.yaml file) then it will log a message that tells you where that stack.yaml file is. It will probably be inside $HOME/.stack/global-project.</div><div><br></div><div>You can also specify a stack.yaml at some other arbitrary path via the “—stack-yaml” argument to stack, or via the STACK_YAML environment variable.</div><div><br></div><div>So that’s step one.</div><div><br></div><div>I don’t know how emacs’ org-mode Babel is running code, but if you get it to use “stack ghci” instead of “ghci” then you will opt it into this ecosystem.</div><div><br></div><div>Jeff</div><div><br>On Jun 6, 2021, at 2:08 PM, Galaxy Being <<a href="mailto:borgauf@gmail.com">borgauf@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">I could use some examples maybe. So I do<br><br><font face="monospace">Prelude> :show paths<br>current working directory:<br>  /home/galaxybeing/Dropbox/org/RealWorldHaskell<br>module import search paths:<br>  .<br></font><br>...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.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 6, 2021 at 4:01 PM Jeff Clites via Haskell-Cafe <<a href="mailto:haskell-cafe@haskell.org">haskell-cafe@haskell.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><span></span></div><div><div></div><div>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’.)</div><div><br></div><div>Jeff</div><div><br>On Jun 6, 2021, at 12:45 PM, Galaxy Being <<a href="mailto:borgauf@gmail.com" target="_blank">borgauf@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">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<div><br></div><div><font face="monospace">#+begin_src haskell :results silent :exports code<br>data Peano = Zero | Succ Peano deriving (Show)<br>#+end_src</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">#+begin_src haskell :results silent :exports code<br>myThree = Succ (Succ (Succ Zero))<br>#+end_src<br><br>#+begin_src haskell :results verbatim :exports both<br>myThree<br>#+end_src<br><br>#+RESULTS:<br>: Succ (Succ (Succ Zero))</font><br></div><div><br></div><div>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.</div><div><br></div><div>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 <font face="monospace">Safe</font> installed. And all docs about editing some yaml stuff get me lost in the weeds quickly. What yaml where for my "global" situation?<br></div><div><br></div><div>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.</div><div><br></div><div>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!).</div><div><br></div><div>-<br></div><div><div dir="ltr"><div dir="ltr"><div>⨽<br></div>Lawrence Bottorff<div>Grand Marais, MN, USA</div><div><a href="mailto:borgauf@gmail.com" target="_blank">borgauf@gmail.com</a></div></div></div></div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Haskell-Cafe mailing list</span><br><span>To (un)subscribe, modify options or view archives go to:</span><br><span><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a></span><br><span>Only members subscribed via the mailman list are allowed to post.</span></div></blockquote></div></div>_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>⨽<br></div>Lawrence Bottorff<div>Grand Marais, MN, USA</div><div><a href="mailto:borgauf@gmail.com" target="_blank">borgauf@gmail.com</a></div></div></div>
</div></blockquote></body></html>