~gdanix/telegram-bot-simple

da3e0b34ed10c92eb8694a2af7e6f722099ebcb0 — Alexander Vershilov 2 years ago 11b6c5e
Support backwards compatibility with older ghc.

For base<4.13 there is a method fail, that was is equal to
`error` call unless overriden. This commit reintroduces
method overriding so parser will not exit with exception on
the call to fail.
1 files changed, 3 insertions(+), 0 deletions(-)

M src/Telegram/Bot/Simple/UpdateParser.hs
M src/Telegram/Bot/Simple/UpdateParser.hs => src/Telegram/Bot/Simple/UpdateParser.hs +3 -0
@@ 27,6 27,9 @@ instance Alternative UpdateParser where
instance Monad UpdateParser where
  return = pure
  UpdateParser x >>= f = UpdateParser (\u -> x u >>= flip runUpdateParser u . f)
#if !MIN_VERSION_base(4,13,0)
  fail _ = empty
#endif

#if MIN_VERSION_base(4,13,0)
instance MonadFail UpdateParser where