pulsar-tidalcycles icon indicating copy to clipboard operation
pulsar-tidalcycles copied to clipboard

Switch to `cabal repl --build-depends=tidal` by default?

Open yaxu opened this issue 4 years ago • 5 comments

As per advice here: https://github.com/haskell/cabal-userguide/issues/1#issuecomment-862406613

This could work around the problems with the cabal install tidal --lib command.

To run a repl we could do: cabal repl --build-depends=tidal

It is a bit slower than running ghci and prints out some confusing things about fake packages but works.

If tidal isn't installed then it will install it first, but only if cabal update has already been run. To build everything in advance we can just do cabal install tidal but then there is a heavy warning that doesn't apply to us.

yaxu avatar Jun 16 '21 14:06 yaxu

Interesting. I tried to execute:

➜  cabal update
Downloading the latest package list from hackage.haskell.org
Updated package list of hackage.haskell.org to the index-state 2021-06-17T03:31:32Z
To revert to previous state run:
    cabal v2-update 'hackage.haskell.org,2021-06-11T10:10:37Z'

➜  cabal repl --build-depends=tidal              
Resolving dependencies...
Error:
    Dependency cycle between the following components: library
    In the inplace package 'tidal-1.7.7'

ndr-brt avatar Jun 17 '21 07:06 ndr-brt

ok, now it's working. Nice and clean, and all the output would be printed on the console inside atom. Just a question, can we assert that everyone has cabal installed and in $PATH? Or cabal path should be configurable as ghci?

ndr-brt avatar Jun 17 '21 11:06 ndr-brt

I think cabal has the same situation as ghci - it will either be in the path, or in same folder as ghci.

yaxu avatar Jun 17 '21 12:06 yaxu

Do you know what's the minimum cabal version needed for this command?

ndr-brt avatar Jun 17 '21 15:06 ndr-brt

It looks like it's been there many years, but originally as new-repl. E.g. in 2.0: https://cabal.readthedocs.io/en/2.0/nix-local-build.html?highlight=new-repl#cabal-new-repl

The build-depends option isn't mentioned in the new-repl section until 2.4, but it might have worked before: https://cabal.readthedocs.io/en/2.4/nix-local-build.html#cabal-new-repl

As it's still usable as new-repl we could use that in the editor plugins.

A downside is that if someone has installed a particular version of tidal with v1-install, then this would install a newer version, afresh..

In the nearish future hopefully we'll have a binary distribution of tidal and this will become largely moot..

yaxu avatar Jun 18 '21 12:06 yaxu