hs-git icon indicating copy to clipboard operation
hs-git copied to clipboard

Build error - ‘fail’ is not a (visible) method of class ‘Monad’

Open ketzacoatl opened this issue 4 years ago • 4 comments

I created a test project with stack new git-test simple. I then added the git to my project cabal file, and an entry in stack.yaml so the package could be used:

extra-deps: 
- git-0.3.0@sha256:dc070840ab24792c9664b9e3e69c9d55d30fc36fee41049c548bb0e8ec83c919,3448

stack build then fails with:

git                    > /run/user/1020/stack-d922b28e78b92425/git-0.3.0/Data/Git/Monad.hs:243:5: error:
git                    >     ‘fail’ is not a (visible) method of class ‘Monad’
git                    >     |
git                    > 243 |     fail   = failGitM
git                    >     |     ^^^^
git                    > 
git                    > /run/user/1020/stack-d922b28e78b92425/git-0.3.0/Data/Git/Monad.hs:316:5: error:
git                    >     ‘fail’ is not a (visible) method of class ‘Monad’
git                    >     |
git                    > 316 |     fail   = failCommitAccessM
git                    >     |     ^^^^
git                    > 
git                    > /run/user/1020/stack-d922b28e78b92425/git-0.3.0/Data/Git/Monad.hs:477:5: error:
git                    >     ‘fail’ is not a (visible) method of class ‘Monad’
git                    >     |
git                    > 477 |     fail   = failCommitM
git                    >     |     ^^^^

Am I doing something obviously incorrect?

ketzacoatl avatar May 05 '21 12:05 ketzacoatl

https://gitlab.haskell.org/ghc/ghc/-/issues/16849 seems related.

That makes me wonder if the fix is to update this package to either use/include an instance when it's missing from GHC, or to skip that, when the GHC version has it, but IDK if that is even the right thing to do here (nor how to do it).

ketzacoatl avatar May 05 '21 13:05 ketzacoatl

I'm learning more about this topic here - https://github.com/quchen/articles/blob/master/monad_fail.md - thanks to @norfairking for the pointer.

ketzacoatl avatar May 06 '21 18:05 ketzacoatl

After some digging, I see that 0.3.0 is the "latest" release, except it's quite old, and there have been a couple updates since then. I believe this would be resolved with a new version being tagged/released.

ketzacoatl avatar May 08 '21 00:05 ketzacoatl

The underlying issue was resolved in #18, but that hasn't been been released, so users who see 0.3.0 on hackage will run into this issue with current GHC versions and stackage LTS. I've created #24 for that.

ketzacoatl avatar May 08 '21 00:05 ketzacoatl