Open chessai opened 6 years ago
Apologies for the fact that I forgot to copy the error I was getting the other day. There's likely more than one place, the easiest way to see all of them is either with GHC 8.6 or setting default-extensions: MonadFailDesugaring
in your .cabal files
Just ran into this. I don't really have anything to add, except ftr this is the error output I got:
[33 of 70] Compiling Yi.Buffer.Misc ( src/Yi/Buffer/Misc.hs, dist/build/Yi/Buffer/Misc.o )
src/Yi/Buffer/Misc.hs:453:25-95: error:
• No instance for (Control.Monad.Fail.MonadFail BufferM)
arising from a do statement
with the failable pattern ‘Just mrks’
• In a stmt of a 'do' block:
Just mrks <- uses
winMarksA (M.lookup $ wkey (b ^. lastActiveWindowA))
In the expression:
do Just mrks <- uses
winMarksA (M.lookup $ wkey (b ^. lastActiveWindowA))
forM mrks getMarkValueB
In a stmt of a 'do' block:
newMarkValues <- if wkey (b ^. lastActiveWindowA) == def then
return
MarkSet
{insMark = MarkValue 0 Forward, selMark = MarkValue 0 Backward,
fromMark = MarkValue 0 Backward}
else
do Just mrks <- uses
winMarksA (M.lookup $ wkey (b ^. lastActiveWindowA))
forM mrks getMarkValueB
|
453 | Just mrks <- uses winMarksA (M.lookup $ wkey (b ^. lastActiveWindowA))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Yi/Buffer/Misc.hs:873:3-30: error:
• No instance for (Control.Monad.Fail.MonadFail BufferM)
arising from a do statement
with the failable pattern ‘Just !ms’
• In a stmt of a 'do' block: Just !ms <- getMarks =<< ask
In the expression:
do Just !ms <- getMarks =<< ask
return ms
In an equation for ‘askMarks’:
askMarks
= do Just !ms <- getMarks =<< ask
return ms
|
873 | Just !ms <- getMarks =<< ask
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build yi-core-0.18.0 (which is required by exe:yi from
yi-0.18.0). See the build log above for details.
I have a quick and dirty (may eat your data) patch here: https://github.com/xaverdh/yi/commits/monad-fail
Actually it probably won't eat your data.
Do we really want the possibility for 'error' to occur there? Is there not a way to just avoid the failable pattern?
Its not just failable patterns. printableChar for example calls fail
explicitly.
The implementation of MonadInteract
also has an Fails
constructor which deals with this.
Ah ok, you are probably referring to BufferM / EditorM. I don't know about that one.
I opened a pull request #1108 based on a different branch, where I attempt to do things properly. We can discuss details there.
-XMonadFailDesugaring
is enabled by default with GHC 8.6+. There are some failable patterns involving BufferM that cause Yi to fail to compile, because BufferM doesn't have a MonadFail instance.