Closed jwaldmann closed 3 years ago
Looks good! I only know about :script for loading scripts and :{ and :} for denoting blocks of code in ghci.
I can make a PR.
It should be tested for other ways of installing tidal (and ghc) -- I am only doing cabal (user) install from source.
(note to self: cabal install --lib --allow-newer tidal hosc
. Hosc also needed since BootTidal.hs wants it.)
About avoiding the extra call to ghc
in tidal.el
, see https://mail.haskell.org/pipermail/haskell-cafe/2021-January/133291.html
This isn't working for me. The shell command looks fine:
alex@olga:~/.cabal$ echo -n data-dir: && ghc -e 'import Paths_tidal' -e 'getDataDir>>=putStr'
data-dir:/home/alex/.cabal/share/x86_64-linux-ghc-8.6.5/tidal-1.7.1alex@olga:~/.cabal$
However when I try to start tidal:
GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help
Prelude> syntax: :script <filename>
Prelude>
<interactive>:2:1: error: parse error on input ‘/’
Sorry I'm not sure how to debug elisp..
Argh. Confirm that I am seeing the same error with ghc-8.6.5 (which I normally don't use).
One guess is:
with ghc-8.10:
ghc -e 'import Paths_tidal' -e 'getDataDir>>=putStr'
/home/waldmann/.cabal/store/ghc-8.10.3/tidal-1.6.2-6d47fb8d7a858c825ee58ca869fc2c9f7b20f4d009fb4f4d2883608472ade267/share
with ghc-8.6.5:
ghc -e 'import Paths_tidal' -e 'getDataDir>>=putStr'
Loaded package environment from /home/waldmann/.ghc/x86_64-linux-8.6.5/environments/default
/home/waldmann/.cabal/store/ghc-8.6.5/tidal-1.7.1-415583b1d5b261ccff892c702f2432479edb8562bafff8b3e97a6ed2cc0e55a1/share
note: two lines
This extra line can be toggled with ghc -v0 -e 0
(the last 0
here is just a simple expression to evaluate, as a test case) in ghc-8.10.3 (see also https://club.tidalcycles.org/t/learning-tidal-course-week-zero-installation-and-exploration/37/93) but not in ghc-8.8 or ghc-8.6.
I think this helps (re-direct stderr)
diff .emacs.d/lisp/tidal.el .emacs.d/lisp/tidal.el~
69c69
< '(("path" . "echo -n data-dir: && ghc -e 'import Paths_tidal' -e 'getDataDir>>=putStr' 2>/dev/null")
---
> '(("path" . "echo -n data-dir: && ghc -e 'import Paths_tidal' -e 'getDataDir>>=putStr'")
perhaps elisp has a better way of ignoring stderr.
perhaps elisp has a better way of ignoring stderr.
apparently, it does not: https://emacs.stackexchange.com/questions/21422/how-to-discard-stderr-when-running-a-shell-function
primary source: https://www.gnu.org/software/emacs/manual/html_node/elisp/Synchronous-Processes.html#Synchronous-Processes
then 2>/dev/null
seems easier.
How to proceed? I can make a PR, perhaps someone can test and confirm?
Yes that sounds like a good plan, thanks!
Hi.
This is another way of finding
BootTidal.hs
, avoiding gymnastics withghc-pkg field
andghc --numeric-version
. Might help with #583 #615. Worksforme, and I can make a PR.Put this in
tidal.cabal
then after installing (
cabal install --lib
)So put these lines in
tidal.el
:where I need to add "data-dir:" artifically but the next part of the code expects it.
I like this because it is just calling
ghc
, andghci
is needed anyway for running tidal. (Current solution callsghc-pkg
and runs into its inconsistent (withghc(i)
) handling of env files.)Features used:
-e
two times seems undocumented, cf. https://gitlab.haskell.org/ghc/ghc/-/issues/19122)One could probably avoid the extra call of
ghc
and instead load the boot file as the very first command of Tidal's ghci session. This would require some contraption - does ghci allow bash-like "HERE scripts"? [EDIT] not HERE scripts but "command substitution" https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html#Command-Substitution