Tidal in Emacs Running Error

I have followed the Emacs help guide, but I get some errors.

To reproduce the error:

Boot tidal C-c C-s (tidal-start-haskell).
->

GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help Prelude> IO error: "~/Library/Haskell/share/ghc-8.4.3-x86_64/tidal-1.6.1" inappropriate type Prelude> <interactive>:2:5: error: Malformed head of type or class declaration: - dir / Prelude>

Evaluate a line in an opened .tidal file (ensuring buffer is in tidal mode).

<interactive>:35:3: error: Variable not in scope: (#) :: t1 -> t65 -> t0

For what's worth, it is working in Atom just fine.

I have read this alas didn't do the trick for me.

MacOS:10.15.7
Emacs 28.0.50

EDIT: 2020-12-11T21:00:00Z

I figured out this needed update so now it is @The Glorious Glasgow Haskell Compilation System, version 8.10.1. So basically, this solves the first error, however, the "Variable not in scope" when evaluating a line still persists.

KonVas

Variable not in scope: (#)

then the boot file was not read on startup?

Can you try to execute the commands that emacs is supposed to do, on the command line? This depends on the contents of tidal.el. The version that I use, which may not be current, contains this:

ghc-pkg field -f ~/.cabal/store/ghc-$(ghc --numeric-version)/package.db tidal data-dir

and the output is

data-dir: /home/waldmann/.cabal/store/ghc-8.10.2/tidal-1.6.1-e21b98c7bc89043091c9109da54371cb785ef29af4ba3dda3ccfd8fc49884e55/share

Then start ghci, using that directory (and append BootTidal.hs)

ghci -ghci-script /home/waldmann/.cabal/store/ghc-8.10.2/tidal-1.6.1-e21b98c7bc89043091c9109da54371cb785ef29af4ba3dda3ccfd8fc49884e55/share/BootTidal.hs

if all is well, you should get a prompt, and can type and execute commands

tidal> :t d1
d1 :: Pattern ControlMap -> IO ()

Else, hopefully you get some error message that helps in analyzing the problem.

All good until it runs tidal I guess?

`~/ ghci -ghci-script /Users/konstantinos/.cabal/store/ghc-8.10.1/tdl-1.6.1-53057d88/share/BootTidal.hs
GHCi, version 8.8.4: https://www.haskell.org/ghc/ :? for help

: error:
Could not find module ‘Sound.Tidal.Context’
It is not a module in the current program, or in any known package.

:11:39: error: Not in scope: ‘oLatency’

:11:55: error: Not in scope: ‘oAddress’

:11:79: error: Not in scope: ‘oPort’

:11:111: error: Not in scope: ‘cFrameTimespan’

:32:38: error:
Not in scope: ‘Sound.Tidal.Transition.xfadeIn’
No module named ‘Sound.Tidal.Transition’ is imported.

:33:42: error:
Not in scope: ‘Sound.Tidal.Transition.xfadeIn’
No module named ‘Sound.Tidal.Transition’ is imported.

:34:42: error:
Not in scope: ‘Sound.Tidal.Transition.histpan’
No module named ‘Sound.Tidal.Transition’ is imported.

:35:39: error:
Not in scope: ‘Sound.Tidal.Transition.wait’
No module named ‘Sound.Tidal.Transition’ is imported.

:36:42: error:
Not in scope: ‘Sound.Tidal.Transition.waitT’
No module named ‘Sound.Tidal.Transition’ is imported.

:37:37: error:
Not in scope: ‘Sound.Tidal.Transition.jump’
No module named ‘Sound.Tidal.Transition’ is imported.

:38:41: error:
Not in scope: ‘Sound.Tidal.Transition.jumpIn’
No module named ‘Sound.Tidal.Transition’ is imported.

:39:42: error:
Not in scope: ‘Sound.Tidal.Transition.jumpIn'’
No module named ‘Sound.Tidal.Transition’ is imported.

:40:42: error:
Not in scope: ‘Sound.Tidal.Transition.jumpMod’
No module named ‘Sound.Tidal.Transition’ is imported.

:41:56: error:
Not in scope: ‘Sound.Tidal.Transition.mortal’
No module named ‘Sound.Tidal.Transition’ is imported.

:42:44: error:
Not in scope: ‘Sound.Tidal.Transition.interpolate’
No module named ‘Sound.Tidal.Transition’ is imported.

:43:48: error:
Not in scope: ‘Sound.Tidal.Transition.interpolateIn’
No module named ‘Sound.Tidal.Transition’ is imported.

:44:39: error:
Not in scope: ‘Sound.Tidal.Transition.clutch’
No module named ‘Sound.Tidal.Transition’ is imported.

:45:43: error:
Not in scope: ‘Sound.Tidal.Transition.clutchIn’
No module named ‘Sound.Tidal.Transition’ is imported.

:46:43: error:
Not in scope: ‘Sound.Tidal.Transition.anticipate’
No module named ‘Sound.Tidal.Transition’ is imported.

:47:47: error:
Not in scope: ‘Sound.Tidal.Transition.anticipateIn’
No module named ‘Sound.Tidal.Transition’ is imported.

:48:41: error:
Not in scope: ‘Sound.Tidal.Transition.mortalOverlay’
No module named ‘Sound.Tidal.Transition’ is imported.

:68:12: error:
Variable not in scope: streamSetI :: t4 -> t

:68:23: error: Variable not in scope: tidal

:69:12: error:
Variable not in scope: streamSetF :: t3 -> t

:69:23: error: Variable not in scope: tidal

:70:12: error:
Variable not in scope: streamSetS :: t2 -> t

:70:23: error: Variable not in scope: tidal

:71:12: error:
Variable not in scope: streamSetR :: t1 -> t

:71:23: error: Variable not in scope: tidal

:72:12: error:
Variable not in scope: streamSetB :: t0 -> t

:72:23: error: Variable not in scope: tidal
Loaded GHCi configuration from /Users/konstantinos/.cabal/store/ghc-8.10.1/tdl-1.6.1-53057d88/share/BootTidal.hs
tidal> :t d1

:1:1: error: Variable not in scope: d1
tidal>
`

Seems like the boot file of tidal is not exposed to Emacs (tidal.el file), right?

this indicates a problem:

as the versions are different. Looks like Tidal was installed for ghc-8.10.1 but ghci is from ghc-8.8.4.

There was a messed xcode config, uninstalled and updated ghci again. On my config file (init.el) I have added this to explicitly target this:

(setq tidal-boot-script-path
       "/Users/konstantinos/.cabal/store/ghc-8.10.1/tdl-1.6.1-53057d88/share/BootTidal.hs")

You think this is necessary, or redundant on your opinion?

This is hard-coding a value that is quite certain to change when you update tidal or ghc. That's why ghc --numeric version and ghc-pkg field -f was used in tidal.el. This commit changed it: https://github.com/tidalcycles/Tidal/pull/652/commits/8c0e362fb4b9e4f9b4987b707db6b7c07fea2e5e See discussion at https://github.com/tidalcycles/Tidal/issues/615 . Perhaps there's something in there that you can use.

See discussion at https://github.com/tidalcycles/Tidal/issues/615

Will have a look, but for now this seems to be necessary. If not executed the tidal process stays here:
GHCi, version 8.10.1: https://www.haskell.org/ghc/ :? for help
Loaded package environment from /Users/konstantinos/.ghc/x86_64-darwin-8.10.1/environments/default
Prelude> Listening for controls on 127.0.0.1:6010

And throws same error: variable not in scope. But after I do execute and reboot tidal this boots properly:

GHCi, version 8.10.1: https://www.haskell.org/ghc/  :? for help
    Loaded package environment from /Users/konstantinos/.ghc/x86_64-darwin-8.10.1/environments/default
    Prelude> Listening for controls on 127.0.0.1:6010
    tidal>