Error in Linux but not MacOS

The plyWith function can accept a pattern of numbers for its first argument:

d1 $ plyWith 5 id $ s "bd"
d1 $ plyWith "5" id $ s "bd"
d1 $ plyWith "<5>" id $ s "bd"
d1 $ plyWith "<5 10 15>" id $ s "bd"

This has been working fine for me for many months on MacOS. I tried running the same code on a Linux Mint distro today and I get the following error:

<interactive>:99:14: error:
    • Overlapping instances for Data.String.IsString (Pattern t0)
        arising from the literal ‘"5"’
      Matching instances:
        instance (Enumerable a, Parseable a) =>
                 Data.String.IsString (Pattern a)
          -- Defined in ‘Sound.Tidal.ParseBP’
        ...plus one instance involving out-of-scope types
        (use -fprint-potential-instances to see them all)
      (The choice depends on the instantiation of ‘t0’
       To pick the first instance above, use IncoherentInstances
       when compiling the other instance declarations)
    • In the first argument of ‘plyWith’, namely ‘"5"’
      In the expression: plyWith "5" (# gain 0.8)
      In the second argument of ‘($)’, namely
        ‘plyWith "5" (# gain 0.8) $ s "bd"’

I tried downgrading to earlier versions of Tidal that I know worked before, but I still get the error. I've tried 1.6.1 and 1.4.9. Any ideas?

Hi @kindohm, that's interesting.. This is probably a difference between ghc versions, rather than o/s - which are you using for each system?

Mint is on 8.0.2, while MacOS is 8.4.3. I'll try upgrading on the Linux side.

EDIT: I already performed a sudo apt update / sudo apt upgrade today, so if there is a new ghc version it isn't coming through. Will see what else I can find out...

EDIT2: pretty sure I installed ghc originall with the cabal-install package. Updating it, and also installing haskell-platform on linux did not fix it. Still showing 8.0.2.

EDIT3: installing with ghcup, which appears to be downloading v8.8.4. will try and get my Haskell paths cleared up and see if ghcup helps.

well, I've managed to install the latest ghc by using ghcup, and I've removed my old Haskell installation.

But, now ghci cannot find Tidal.Sound.Context, even after wiping out my ~/.cabal and ~/.ghc folders and doing a fresh cabal update / cabal install tidal.

I suppose the ghc in ~/.ghcup/bin is looking for packages in one path, when in fact they are located somewhere else. I'm all ears for ideas, but otherwise I'll research.

@kindohm hm, you can do which cabal and which ghci to find what's being run

Usually running this sets up the paths correctly (including the leading .):

. ~/.ghcup/env

I'm on linux mint 20 and have ghc 8.6.5 from the repo

Here's the output. I think I have the default .ghcup paths set already. Cabal config and packages are located under ~/.cabal/. Does that seem like the right path when cabal is being run from ~/.ghcup/bin/cabal?

➜  ~ which cabal
/home/kindohm/.ghcup/bin/cabal
➜  ~ which ghci
/home/kindohm/.ghcup/bin/ghci
➜  ~ . ~/.ghcup/env
➜  ~ ghci
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
Prelude> import Tidal.Sound.Context

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

For what it's worth, I'm on Mint 19.3. I'm OK doing a full system upgrade or wipe but am also very curious about what is going on.

Ah in recent versions of haskell/cabal you need to do cabal install tidal --lib . I've not been able to get to the bottom of why..

Still no difference, unfortunately:

➜  ~ rm -rf ~/.cabal          
➜  ~ cabal update
Config file path source is default config file.
Config file /home/kindohm/.cabal/config not found.
Writing default configuration to /home/kindohm/.cabal/config
Downloading the latest package list from hackage.haskell.org
➜  ~ cabal install tidal --lib
...
Starting     tidal-1.6.1 (lib)
Building     tidal-1.6.1 (lib)
Installing   tidal-1.6.1 (lib)
Completed    tidal-1.6.1 (lib)
➜  ~ ghci
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
Loaded package environment from /home/kindohm/.ghc/x86_64-linux-8.8.4/environments/default
Prelude> import Tidal.Sound.Context

<no location info>: error:
    Could not find module ‘Tidal.Sound.Context’
    It is not a module in the current program, or in any known package.
Prelude> import Tidal.Context.Sound

Bah! Try removing /home/kindohm/.ghc/x86_64-linux-8.8.4/environments/default and try the install again?

Or try again with cabal v1-update; cabal v1-install tidal..

Neither approach worked.

Hm, import Tidal.Sound.Context should be import Sound.Tidal.Context

:man_facepalming:

works, thank you for all of the suggestions!

no doubt it would have worked much earlier in my troubleshooting had I typed the right name.

1 Like