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