In the following example the selected BindSyntax instance is the one with aIxMonad constraint rather than the one with a Monad constraint.
{-# LANGUAGE RebindableSyntax #-}
module Scratch where
import Language.Haskell.DoNotation
import Prelude hiding (Monad (..), pure)
import Control.Monad.Writer.Class (MonadWriter, tell)
tell2 :: MonadWriter w m => w -> m ()
tell2 x = tell x >> tell x
{-
• Couldn't match type ‘m’ with ‘m0 i0 k20’
arising from a use of ‘>>’
‘m’ is a rigid type variable bound by
the type signature for:
tell2 :: forall w (m :: * -> *). MonadWriter w m => w -> m ()
at src/Scratch.hs:9:1-37
• In the expression: tell x >> tell x
In an equation for ‘tell2’: tell2 x = tell x >> tell x
• Relevant bindings include
tell2 :: w -> m () (bound at src/Scratch.hs:10:1)
-}
I think most mtl-style code won't compile with this syntax change.
In the following example the selected
BindSyntax
instance is the one with aIxMonad
constraint rather than the one with aMonad
constraint.I think most mtl-style code won't compile with this syntax change.