Monad fail errors

Simon Peyton Jones simonpj at microsoft.com
Tue Nov 24 14:07:50 UTC 2015


Herbert

In tests/monadfail/MonadFailErrors.stderr I see


MonadFailErrors.hs:59:5: error:

    No instance for (MonadFail Identity)

      arising from a do statement

                   with the failable pattern ‘Newtype x’

    In a stmt of a 'do' block: Newtype x <- undefined

    In the expression:

      do { Newtype x <- undefined;

           undefined }

    In an equation for ‘newtypeMatch’:

        newtypeMatch

          = do { Newtype x <- undefined;

                 undefined }



MonadFailErrors.hs:67:5: error:

    No instance for (MonadFail Identity)

      arising from a do statement

                   with the failable pattern ‘Data x’

    In a stmt of a 'do' block: Data x <- undefined

    In the expression:

      do { Data x <- undefined;

           undefined }

    In an equation for ‘singleConMatch’:

        singleConMatch

          = do { Data x <- undefined;

                 undefined }


But ‘Newtype’ and ‘Data’ are single constructor types and hence cannot fail.  So why are these errors happening?

I’m tiding up your implementation (deleting code!) and accidentally fixed this.  So I wanted to check that it is indeed wrong as-is.

Simon


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20151124/9f1fb3e1/attachment-0001.html>


More information about the ghc-devs mailing list