Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Installation] error: ‘fail’ is not a (visible) method of class ‘Monad’ on Mac OS Mojave (10.14) #39

Open
pauloud opened this issue Apr 6, 2020 · 14 comments

Comments

@pauloud
Copy link

pauloud commented Apr 6, 2020

UPDATE 6/04 2020 14:20 : I haven't seen that the installation tutorial tells not to use latest version of ghc, and I've eventually managed to downgrade ghc and install Euterpea
Hello, I've tried several time to install Euterpea with cabal v1 commands, I have the issue mentionned here #36 (comment) by @andreatamez, who said below having fixed the issue downgrading GHCI. I'm a beginner and I don't know really how a simple way to do it. The shell print this

MacBook-Air:~ myname$ cabal v1-update
Downloading the latest package list from hackage.haskell.org
cabal v1-install Euterpea --allow-newer=process
To revert to previous state run:
    cabal update --index-state='2020-04-05T23:07:37Z'
MacBook-Air:~ myname$ cabal v1-install Euterpea --allow-newer=process **I've tried within and without that --allow-newer command for the same result**
Resolving dependencies...
Starting     HCodecs-0.5.1
Building     HCodecs-0.5.1
Failed to install HCodecs-0.5.1
Build log ( /Users/myname/.cabal/logs/ghc-8.8.3/HCodecs-0.5.1-IQAJZaK1RYKLSvGCdgJbmC.log ):
cabal: Entering directory '/var/folders/y2/0hb8j18x2mx699f66shljych0000gn/T/cabal-tmp-66223/HCodecs-0.5.1'
Configuring HCodecs-0.5.1...
Preprocessing library for HCodecs-0.5.1..
Building library for HCodecs-0.5.1..
[1 of 7] Compiling Codec.ByteString.Builder ( src/Codec/ByteString/Builder.hs, dist/build/Codec/ByteString/Builder.o )

src/Codec/ByteString/Builder.hs:79:1: warning: [-Wunused-imports]
    The import of ‘Data.Semigroup’ is redundant
      except perhaps to import instances from ‘Data.Semigroup’
    To import instances alone, use: import Data.Semigroup()
   |
79 | import Data.Semigroup
   | ^^^^^^^^^^^^^^^^^^^^^
[2 of 7] Compiling Codec.ByteString.Parser ( src/Codec/ByteString/Parser.hs, dist/build/Codec/ByteString/Parser.o )

src/Codec/ByteString/Parser.hs:143:5: error:
    ‘fail’ is not a (visible) method of class ‘Monad’
    |
143 |     fail  err  = Parser $ \(S _ _ bytes) ->
    |     ^^^^
cabal: Leaving directory '/var/folders/y2/0hb8j18x2mx699f66shljych0000gn/T/cabal-tmp-66223/HCodecs-0.5.1'
cabal: Error: some packages failed to install:
Euterpea-2.0.7-Kx4TpJzFbje3DPmYe0amyd depends on Euterpea-2.0.7 which failed
to install.
HCodecs-0.5.1-IQAJZaK1RYKLSvGCdgJbmC failed during the building phase. The
exception was:
ExitFailure 1

So could you tell me how to downgrade GHCI easily or if ther is a better way to resolve the problem ?
Thank you
Have a nice day

@pauloud
Copy link
Author

pauloud commented Apr 6, 2020

I haven't seen that the installation tutorial tells not to use latest version of ghc, and I've eventually managed to downgrade ghc and install Euterpea, so the topic can be locked

@carlca
Copy link

carlca commented Apr 15, 2020

Hi, @pauloud I'm getting exactly the same error on macOS 10.14.6. Can you tell me which version of GHCI you downgraded to and what steps did it take to do this? Did you have to uninstall the current version of GHCI first?

@pauloud
Copy link
Author

pauloud commented Apr 15, 2020

Yes, I have uninstalled GHC following the instructions here https://gist.github.com/begriffs/6408415
Then I've easily install the 8.4.3 version (but according Euterpea site 8.6.3 version "provides the simplest setup" and I haven't had problems using cabal v1 commands.

@carlca
Copy link

carlca commented Apr 15, 2020

Cool! I'll give that a go! Thanks for the swift reply!

@carlca
Copy link

carlca commented Apr 15, 2020

I uninstalled GHC using those instructions but I am stuck on the installation of 8.4.3, because I installed 8.8.3 using brew install ghc - I cannot work out how to get Homebrew to get an ealier version. Similarly, if I use the Euterpea website, all that is available there is 8.8.3. How did you get 8.4.3?

@carlca
Copy link

carlca commented Apr 15, 2020

Don't worry, I found it!

@tallpeak
Copy link

tallpeak commented Jun 28, 2020

FYI: I was able to "stack install" using ghc 8.10.1 with this stack.yaml. (I haven't figured out how to get a software synthesizer working on my Macbook, so I don't know if it works. But the play function is available for execution, just can't find a midi output. (Does Surge work? I installed it, but maybe it needs configuration? No support for AU/VST3?) )

Here's my stack.yaml, after running stack init in an empty directory and some editing (the package requests HCodecs == 0.5.1, hence the allow-newer: true) :

euterpea-install % cat stack.yaml | grep -v ^#
resolver: nightly-2020-06-27
packages: []
allow-newer: true
extra-deps:
- HCodecs-0.5.2
- PortMidi-0.2.0.0@sha256:0671e36ec72e95138bf396234b205864a8a6d0ee353e09e01cbfd57004c56f40,2383
- arrows-0.4.4.2@sha256:a260222b766da922657e302aa7c0409451913e1e503798a47a213a61ba382460,1235
- bytestring-0.10.8.2@sha256:0a58355cb91bc9930f951a6d14f5fb4a6022647c3aab2b7223e888843bb6a832,8921
- Stream-0.4.7.2@sha256:ed78165aa34c4e23dc53c9072f8715d414a585037f2145ea0eb2b38300354c53,1009
- lazysmallcheck-0.6@sha256:dac7a1e4877681f1260309e863e896674dd6efc1159897b7945893e693f2a6bc,1696

@sternenseemann
Copy link

@pauloud This is an issue with HCodecs, try reproducing it with their latest version (0.5.2) and reporting it to their maintainer.

@Mokosha
Copy link

Mokosha commented Jan 7, 2021

Hi -- going through my notifications. What exactly is the issue with HCodecs?

@sternenseemann
Copy link

@Mokosha I don't believe there is an issue with 0.5.2 anymore, hence I suggested upgrading. The build failure in the original issue is related to HCodecs 0.5.1 not compiling with the changes brought by the MonadFail proposal if I'm not mistaken.

@nxg
Copy link

nxg commented Dec 16, 2021

I think there is still some issue with recent Platform versions and HCodecs, but it might be merely a question of correctly specifying a dependency.

If I download using GHCup (onto macOS 11.6) I am given

% ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.7
% cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library 

I then try to install Euterpea (after cabal update):

% cabal v1-install Euterpea
Resolving dependencies...
Downloading  PortMidi-0.2.0.0
Downloading  bytestring-0.10.8.2
Downloaded   bytestring-0.10.8.2
Downloading  heap-1.0.4
Starting     bytestring-0.10.8.2
Downloaded   PortMidi-0.2.0.0
Downloading  random-1.1
Starting     PortMidi-0.2.0.0
Downloaded   heap-1.0.4
Downloading  semigroups-0.20
Starting     heap-1.0.4
Downloaded   random-1.1
Downloading  splitmix-0.1.0.4
Starting     random-1.1
Downloaded   semigroups-0.20
Downloading  lazysmallcheck-0.6
Starting     semigroups-0.20
Downloaded   splitmix-0.1.0.4
Starting     splitmix-0.1.0.4
Building     bytestring-0.10.8.2
Downloaded   lazysmallcheck-0.6
Starting     lazysmallcheck-0.6
Building     PortMidi-0.2.0.0
Building     heap-1.0.4
Building     random-1.1
Building     semigroups-0.20
Building     splitmix-0.1.0.4
Building     lazysmallcheck-0.6
Completed    heap-1.0.4
Completed    lazysmallcheck-0.6
Completed    semigroups-0.20
Completed    splitmix-0.1.0.4
Completed    random-1.1
Downloading  QuickCheck-2.14.2
Downloaded   QuickCheck-2.14.2
Starting     QuickCheck-2.14.2
Completed    PortMidi-0.2.0.0
Building     QuickCheck-2.14.2
Completed    bytestring-0.10.8.2
Completed    QuickCheck-2.14.2
Downloading  Stream-0.4.7.2
Downloading  HCodecs-0.5.1
Downloaded   Stream-0.4.7.2
Starting     Stream-0.4.7.2
Downloaded   HCodecs-0.5.1
Starting     HCodecs-0.5.1
Building     Stream-0.4.7.2
Building     HCodecs-0.5.1
Failed to install HCodecs-0.5.1
Build log ( /Users/norman/.cabal/logs/ghc-8.10.7/HCodecs-0.5.1-LR40TMwtcYApNXi3bo5eI.log ):
cabal: Entering directory '/var/folders/cq/46x6_ygx48g4fvtvtt_t4yjr0000gn/T/cabal-tmp-47541/HCodecs-0.5.1'
Configuring HCodecs-0.5.1...
Preprocessing library for HCodecs-0.5.1..
Building library for HCodecs-0.5.1..
[1 of 7] Compiling Codec.ByteString.Builder ( src/Codec/ByteString/Builder.hs, dist/build/Codec/ByteString/Builder.o, dist/build/Codec/ByteString/Builder.dyn_o )

src/Codec/ByteString/Builder.hs:79:1: warning: [-Wunused-imports]
    The import of ‘Data.Semigroup’ is redundant
      except perhaps to import instances from ‘Data.Semigroup’
    To import instances alone, use: import Data.Semigroup()
   |
79 | import Data.Semigroup
   | ^^^^^^^^^^^^^^^^^^^^^
[2 of 7] Compiling Codec.ByteString.Parser ( src/Codec/ByteString/Parser.hs, dist/build/Codec/ByteString/Parser.o, dist/build/Codec/ByteString/Parser.dyn_o )

src/Codec/ByteString/Parser.hs:143:5: error:
    ‘fail’ is not a (visible) method of class ‘Monad’
    |
143 |     fail  err  = Parser $ \(S _ _ bytes) ->
    |     ^^^^
cabal: Leaving directory '/var/folders/cq/46x6_ygx48g4fvtvtt_t4yjr0000gn/T/cabal-tmp-47541/HCodecs-0.5.1'
Completed    Stream-0.4.7.2
cabal: Error: some packages failed to install:
Euterpea-2.0.7-KdKX1MNm6oAIS9wE6s5abl depends on Euterpea-2.0.7 which failed
to install.
HCodecs-0.5.1-LR40TMwtcYApNXi3bo5eI failed during the building phase. The
exception was:
ExitFailure 1

I note that this is still trying to compile the failing HCodecs version 0.5.1, so it might be that this is now merely a an issue of correctly specifying dependencies.

Parenthetically, and for what it's worth, cabal v2-install Euterpea fails with a different error which doesn't mention HCodecs (I'm not sure if that's relevant), and the Nix build of Euterpea-2.0.7 fails because it can't build alsa (and I'm confused about whether that's a bug, or quite whose).

I do notice that the getting started instructions (a) mention an ALSA install as part of the Linux recommendations, so there's clearly an ALSA story here, and (b) recommend specifically the 8.6.3 .pkg at https://downloads.haskell.org/platform/8.6.3/ (broken link, by the way!), but that package installs to a fixed path, which I'd rather avoid if I can, hence the attempt to do the install using the current (relocatable) version.

Sorry if the remarks here are naive about ghc/cabal/stack: I'm using Euterpea as my most recent attempt to get to Hello World with Haskell (!), hence a fair amount of blundering around.

@sternenseemann
Copy link

I think there is still some issue with recent Platform versions and HCodecs, but it might be merely a question of correctly specifying a dependency.

HCodecs is fine, the problem is that Euterpea pins a too old version. Try configuring with --allow-newer.

@nxg
Copy link

nxg commented Dec 16, 2021

Gah -- that works! It even says that on the getting-started page! I must be blind....

@nik312123
Copy link

How does this differ if you are using stack (e.g. stack ghci)? Is there a way to do --allow-newer with Stack?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants