Load Haskell code at Tidal start [Solved]

I am pretty sure that his has been described somewhere but I just can't find it. I am very happy just for a link if that can be found somewhere in the documentation:

I am trying to sort out my Tidal setup which - amongst other things - involves loading some additional synths (via including some synth definition files in my superdirt_startup.scd). This works well.

Now I would like to find out how to best load some additional Haskell code (like e. g. this code) to add configuration options and - probably later - some custom functions.

  • I reckon I can kind of include one or more Haskell code files in my BootTidal.hs. If yes, how do I do that? Is there an example setup somewhere online?
  • I find 4 BootTidal.hs files at .cabal/share/...; I assume I can find out which one is being used without changing them one by another, right?
  • Any further hints on best practices concerning a custom configuration layer for ones Tidal setup?
2 Likes

Take a look to the end of my boottidal: sc-adente/BootTidal.hs at master · ndr-brt/sc-adente · GitHub

You can use the :script directive

2 Likes

Thanks! Everything is now in place :slight_smile:

And, to answer my own question (just in case there is anyone besides me who is wondering): Tidal tells me the essentials in the Tidal buffer just after starting:

GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
Prelude> [TidalCycles version 1.7.2]
Installed in /home/marty/.cabal/share/x86_64-linux-ghc-8.8.4/tidal-1.7.2

So in my case the BootTidal.hs in use is here: .cabal/share/x86_64-linux-ghc-8.8.4/tidal-1.7.2/BootTidal.hs

Hi @ndr_brt - I wonder if you'd be kind enough to comment on the following:

Are you aware of any subtleties regarding the relative path to the Haskell file provided for the script?

For example, my Haskell file is named TidalStartup.hs and is in the same directory as BootTidal.hs, but the line:
:script ./TidalStartup.hs
results in the error
t> IO error: "TidalStartup.hs" does not exist
when any tidal command is first invoked from within Atom.

I'm a bit mystified by this, since it seems to me to be directly analogous to what you have in

Any comments appreciated.

Try using an absolute path to the file (ie /home/User/path/to/TidalStartup.hs)
Rather than the relative path

1 Like

Yes, that is, what I also ended up with.

Sincerely don't know...it always worked except for some days, don't know why, maybe the ghci version makes the difference. What version do you have installed?

OK, the absolute path works for me on Windows (but can't include any spaces).

Thanks for all responses.

Yeah, that is a ghci bug, should be fixed on the newest versions