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

Add MonadFail instance for UpdateParser #27

Merged
merged 2 commits into from
Jul 8, 2020

Conversation

vyorkin
Copy link
Contributor

@vyorkin vyorkin commented Apr 28, 2020

fixes #26

@swamp-agr
Copy link
Collaborator

swamp-agr commented Jul 7, 2020

✅ 8.10.1 build successful.
✅ 8.8.3 build successful.
❌ 8.6.5 build failed:

src/Telegram/Bot/Simple/UpdateParser.hs:30:10: error:
    Not in scope: type constructor or class ‘MonadFail’
    Perhaps you meant ‘MonadFix’ (imported from Control.Monad.Reader)
   |
30 | instance MonadFail UpdateParser where
   |          ^^^^^^^^^
cabal: Failed to build telegram-bot-simple-0.3.0 (which is required by
exe:example-todo-bot from telegram-bot-simple-0.3.0 and exe:example-echo-bot
from telegram-bot-simple-0.3.0).

@vyorkin could you please fix the build by adding {-# LANGUAGE CPP #-} on top of the file and replacing your code with something like this (see below)?

instance Monad UpdateParser where
  return = pure
  UpdateParser x >>= f = UpdateParser (\u -> x u >>= flip runUpdateParser u . f)

#if MIN_VERSION_base(4,13,0)
instance MonadFail UpdateParser where
  fail _ = empty
#endif

@swamp-agr swamp-agr merged commit eb4f9ae into fizruk:master Jul 8, 2020
@swamp-agr
Copy link
Collaborator

@vyorkin thank you for contribution!

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

Successfully merging this pull request may close these issues.

stack build fails with No instance for (MonadFail UpdateParser)
2 participants