git-annex/doc/bugs/No_MonadFail_instance.mdwn
2019-01-16 15:08:35 -04:00

49 lines
2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### Please describe the problem.
### What steps will reproduce the problem?
Build git-annex with GHC 8.6.
### What version of git-annex are you using? On what operating system?
7.20181211, master
### Please provide any additional information below.
Following the implementation plan for the [MonadFail Proposal](https://wiki.haskell.org/MonadFail_Proposal), GHC 8.6 has enabled `-XMonadFailDesugaring` by default.
Some of the code in git-annex uses failable patterns in `do`-blocks, so it fails to compile starting from GHC 8.6, as there is no `MonadFail` instance for `Annex`. Here is an example of such an error:
Remote/Glacier.hs:165:17: error:
• No instance for (Control.Monad.Fail.MonadFail Annex)
arising from a do statement
with the failable pattern (_, Just h, _, pid)
• In a stmt of a 'do' block:
(_, Just h, _, pid) <- liftIO $ createProcess cmd
In the expression:
do let cmd = ...
(_, Just h, _, pid) <- liftIO $ createProcess cmd
ok <- ifM
(liftIO $ hIsEOF h)
(return False, sink =<< liftIO (L.hGetContents h))
liftIO $ hClose h
....
In an equation for go:
go (Just e)
= do let cmd = ...
(_, Just h, _, pid) <- liftIO $ createProcess cmd
ok <- ifM
(liftIO $ hIsEOF h)
(return False, sink =<< liftIO (L.hGetContents h))
....
|
165 | (_, Just h, _, pid) <- liftIO $ createProcess cmd
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Just trying to start using it. I have built it with `-XNoMonadFailDesugaring` for now.
> [[fixed|done]] (release soonish) --[[Joey]]