MonadFail "fails" to work - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

TheMatten

How can I get:

*** Exception: src/Language/Hask/Compiler/Monad.hs:23:10-31: No instance nor default method for class operation message

when using fail derived using newtype strategy, when I'm sure underlying monad provides working one?

TheMatten

I've even tried implementing it myself... like, it works just fine when I try it with monad inside...

TheMatten
newtype Parser a
  = Parser{ unParser :: ReaderT Options (M.Parsec Void Text) a }
  deriving newtype
    ( Alternative, Applicative, Functor, Monad, M.MonadParsec Void Text
    , MonadPlus
    )

instance MonadFail Parser where
  fail = Parser . fail
TheMatten

Oh, wait a second, I misread the error :sweat_smile:

Georgi Lyubenov // googleson78

do you have -fdefer-type-errors on?

TheMatten

I'm tired and stupid - it's different module and just happens to point to my deriving clause!
I'm missing method definitions in unrelated code :joy:

Georgi Lyubenov // googleson78

and I just took your word for what the problem was :sweat_smile:

TheMatten

And I omitted part of relevant context, sorry for that :sweat_smile: