How to hack -- that is, run from a fork rather than Cabal?

In a nutshell

I found instructions for installing and using Tidal -- and they worked! -- but I've found no guidance for hacking it.

More detail

Tidal's installation instructions explain how to install Tidal via Cabal. I did that. As a result, my ~/.cabal store now has a copy of Tidal, which defines how it works whenever I run Tidal.

I don't just want to use Tidal. I want to change how it works -- but hacking the Cabal store is a bad idea. So instead I'd like to use my own fork of the Tidal repo, outside of the Cabal store. I know how to clone and alter the Tidal repo, but I don't know how to use the result -- every time I start Tidal it runs from the Cabal store.

What I tried

The bottom of the docs for using Tidal on Emacs mentions that one might need to replace tidal-boot-script-path "with the actual location of the BootTidal.hs file". Following that advice, I tried adding this line to my .emacs config:

(setq tidal-boot-script-path "~/code/music/Tidal/Tidal/BootTidal.hs")

To test whether that had worked, I added to "~/code/music/Tidal/Tidal/src/Sound/Tidal/Core.hs" a synonym for silence called turpa. When I reboot Emacs and restart Tidal, :i silence is defined but :i turpa is not. So that didn't work.

Next I tried simply replacing the complicated definition of tidal-boot-script-path in tidal.el with this:

(defvar tidal-boot-script-path
  "~/code/music/Tidal/Tidal/BootTidal.hs")

I repeated the turpa = silence test described above. Still not working.

I don't have any more ideas.

Here's what I do..

Start from a clean slate by deleting ~/.ghc and ~/.cabal

Change into the tidal folder cd ~/code/music/Tidal

Install it using the 'old-style' cabal commands:

cabal v1-update
cabal v1-install

Then it should work from ghci (or via the edit plugins which generally use ghci).

This probably isn't 'best practice' use of the new v2-install commands, but as far as I can tell they are not designed for live coding and (therefore?) break all the time. Would love to hear different!

Weird. What version of Cabal do you use? Mine, 3.6.2.0, does not provide cabal v1-update. I do have v1-install. When I tried doing what you said, but using cabal update instead of cabal v1-update, it didn't work -- it still put tidal into my new .cabal folder, and my mod still wasn't recognized.

OTOH I can run cabal repl from the root of the project, run :s BootTidal.hs from the repl, and then use Tidal from that repl. That's good enough that I might not try to improve it for a while.

I got it working! No need for v1 commands or a global install.

From bash, I wiped my .ghc and .cabal folders like you suggested.

Then, in Emacs, I didn't use tidal.el at all. Instead I opened a shell (M-x shell),navigated to the root of the project, and typed cabal repl.

Then I defined these functions:

;; source:
;; https://emacs.stackexchange.com/a/37889
(defun my-set-target ()
   (interactive)
   (setq my-target (buffer-name)))

(defun my-send (beg end)
  (interactive "r")
  (process-send-region my-target beg end)
  (process-send-string my-target "\n"))

and ran my-set-target from the shell in Emacs.

Once that's done, I can highlight text in any buffer (doesn't have to end in .tidal) and send it to the shell buffer with my-set-target.

Another advantage of doing it that way: Tab completion.