<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Out of curiosity, why do you require the `MonadIO` on the `Monad`
      instance?<br>
    </p>
    <div class="moz-cite-prefix">On 4/12/23 12:42, Harendra Kumar wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAPW+kkZn-XsESj6GmzQxMP5J4gTp3+TNSuz_AAvpqpwOCa073A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Thanks Tom and Rodrigo.</div>
        <div><br>
        </div>
        <div>That clarifies the problem. We will need to think which
          solution makes better sense.<br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, 12 Apr 2023 at 15:01,
          Rodrigo Mesquita <<a
            href="mailto:rodrigo.m.mesquita@gmail.com"
            moz-do-not-send="true" class="moz-txt-link-freetext">rodrigo.m.mesquita@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div>Indeed, this is <a
href="https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.6#transformers-06-new-monadtrans-quantified-context"
              target="_blank" moz-do-not-send="true">included in the GHC
              9.6.x Migration Guide</a>.
            <div><br>
            </div>
            <div>Unfortunately, I’m also not sure there is a solution
              for this particular where (T m) is only a Monad if m
              instances MonadIO.</div>
            <div>As Tom explained, under transformers 0.6 `T` no longer
              is a monad transformer.</div>
            <div><br>
            </div>
            <div>A few workarounds I can think of:</div>
            <div><br>
            </div>
            <div>- No longer instance `MonadTrans T`, and use a instance
              `MonadIO m => MonadIO (T m)` instead.</div>
            <div>  Rationale: if you always require `m` to be `MonadIO`,
              perhaps the ability to always lift an `m` to `T m` with
              `liftIO` is sufficient.</div>
            <div><br>
            </div>
            <div>- Add the `MonadIO` instance to the `m` field of `T`,
              GADT style, `data T m a where T :: MonadIO m => m ->
              T m a`</div>
            <div>  Rational: You would no longer need `MonadIO` in the
              `Monad` instance, which will make it possible to instance
              `MonadTrans`.</div>
            <div><br>
            </div>
            <div>- Redefine your own `lift` regardless of `MonadTrans`</div>
            <div><br>
            </div>
            <div>Good luck!</div>
            <div>Rodrigo</div>
            <div>
              <div>
                <div><br>
                  <blockquote type="cite">
                    <div>On 12 Apr 2023, at 10:10, Tom Ellis <<a
                        href="mailto:tom-lists-haskell-cafe-2017@jaguarpaw.co.uk"
                        target="_blank" moz-do-not-send="true"
                        class="moz-txt-link-freetext">tom-lists-haskell-cafe-2017@jaguarpaw.co.uk</a>>
                      wrote:</div>
                    <br>
                    <div>
                      <div>On Wed, Apr 12, 2023 at 02:32:43PM +0530,
                        Harendra Kumar wrote:<br>
                        <blockquote type="cite">instance MonadIO m =>
                          Monad (T m) where<br>
                             return = pure<br>
                             (>>=) = undefined<br>
                          <br>
                          instance MonadTrans T where<br>
                             lift = undefined<br>
                        </blockquote>
                        <br>
                        I guess it's nothing to do with 9.6 per se, but
                        rather the difference<br>
                        between<br>
                        <br>
                        * <a
href="https://hackage.haskell.org/package/transformers-0.5.6.2/docs/Control-Monad-Trans-Class.html#t:MonadTrans"
                          target="_blank" moz-do-not-send="true"
                          class="moz-txt-link-freetext">https://hackage.haskell.org/package/transformers-0.5.6.2/docs/Control-Monad-Trans-Class.html#t:MonadTrans</a><br>
                        <br>
                        * <a
href="https://hackage.haskell.org/package/transformers-0.6.1.0/docs/Control-Monad-Trans-Class.html#t:MonadTrans"
                          target="_blank" moz-do-not-send="true"
                          class="moz-txt-link-freetext">https://hackage.haskell.org/package/transformers-0.6.1.0/docs/Control-Monad-Trans-Class.html#t:MonadTrans</a><br>
                        <br>
                        I'm not sure I can see any solution for this.  A
                        monad transformer `T`<br>
                        must give rise to a monad `T m` regardless of
                        what `m` is.  If `T m`<br>
                        is only a monad when `MonadIO m` then `T` can't
                        be a monad transformer<br>
                        (under transformers 0.6).<br>
                        <br>
                        Tom<br>
                        _______________________________________________<br>
                        ghc-devs mailing list<br>
                        <a href="mailto:ghc-devs@haskell.org"
                          target="_blank" moz-do-not-send="true"
                          class="moz-txt-link-freetext">ghc-devs@haskell.org</a><br>
                        <a
                          href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs"
                          target="_blank" moz-do-not-send="true"
                          class="moz-txt-link-freetext">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
                      </div>
                    </div>
                  </blockquote>
                </div>
                <br>
              </div>
            </div>
          </div>
          _______________________________________________<br>
          ghc-devs mailing list<br>
          <a href="mailto:ghc-devs@haskell.org" target="_blank"
            moz-do-not-send="true" class="moz-txt-link-freetext">ghc-devs@haskell.org</a><br>
          <a
            href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
ghc-devs mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a>
</pre>
    </blockquote>
  </body>
</html>