# QualifiedDo + ApplicativeDo still requires \>\>=?

**URL:** <https://discourse.haskell.org/t/qualifieddo-applicativedo-still-requires/13491>\
**Category:** Uncategorized\
**Created:** [January 4, 2026, 10:59pm UTC](https://discourse.haskell.org/t/qualifieddo-applicativedo-still-requires/13491 "2026-01-04T22:59:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandonchinn178](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/brandonchinn178/32/5103_2.png) [@brandonchinn178](https://discourse.haskell.org/u/brandonchinn178)\
**Post date:** [January 4, 2026, 10:59pm UTC](https://discourse.haskell.org/t/qualifieddo-applicativedo-still-requires/13491/1 "2026-01-04T22:59:12Z")

</div>

According to the [QualifiedDo](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/qualified_do.html) docs, a qualified-do block with `-XApplicativeDo` enabled should translate to a pure applicative expression:

> ```haskell
> M.do { (x1 <- u1 | … | xn <- un); M.return e } =
> (\x1 … xn -> e) `M.fmap` u1 M.<*> … M.<*> un
> 
> ```

But this doesn’t seem to be working for a module that intentionally doesn’t provide `>>=`:

```haskell
-- Appl.hs
module Appl (
  (Prelude.<*>),
  (Prelude.>>),
  Prelude.pure,
  Prelude.return,
  Prelude.fmap,
) where

```

```haskell
-- Main.hs
{-# LANGUAGE QualifiedDo #-}
{-# LANGUAGE ApplicativeDo #-}

import Appl qualified

main = foo >>= print

foo :: IO Int
foo = Appl.do
  x <- pure 123
  pure x

```

```haskell
$ runghc Main.hs
Main.hs:10:3: error: [GHC-76037]
    Not in scope: ‘Appl.>>=’
    Note: The module ‘Appl’ does not export ‘>>=’.
   |
10 | x <- pure 123
   | ^^^^^^^^^^^^^

```

Is this a compiler bug?

---

<div class="post-metadata">

**Author:** ![brandonchinn178](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/brandonchinn178/32/5103_2.png) [@brandonchinn178](https://discourse.haskell.org/u/brandonchinn178)\
**Post date:** [January 4, 2026, 11:06pm UTC](https://discourse.haskell.org/t/qualifieddo-applicativedo-still-requires/13491/2 "2026-01-04T23:06:01Z")

</div>

Workaround:

```haskell
class NoBind a where
  (>>=) :: a
instance GHC.TypeError (GHC.Text ">>= is not allowed in a Appl.do block") => NoBind a where
  (>>=) = undefined

```

---

<div class="post-metadata">

**Author:** ![ashokkimmel](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/ashokkimmel/32/5111_2.png) [@ashokkimmel](https://discourse.haskell.org/u/ashokkimmel)\
**Post date:** [January 5, 2026, 5:13am UTC](https://discourse.haskell.org/t/qualifieddo-applicativedo-still-requires/13491/3 "2026-01-05T05:13:53Z")

</div>

Does using APPL.pure work?

---

<div class="post-metadata">

**Author:** ![ashokkimmel](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/ashokkimmel/32/5111_2.png) [@ashokkimmel](https://discourse.haskell.org/u/ashokkimmel)\
**Post date:** [January 5, 2026, 5:19am UTC](https://discourse.haskell.org/t/qualifieddo-applicativedo-still-requires/13491/4 "2026-01-05T05:19:36Z")

</div>

You might want to use `unsatisfiable` instead of undefined, not that it matters. Undefined is just a bit of a code smell.

---

<div class="post-metadata">

**Author:** ![brandonchinn178](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/brandonchinn178/32/5103_2.png) [@brandonchinn178](https://discourse.haskell.org/u/brandonchinn178)\
**Post date:** [January 5, 2026, 5:30am UTC](https://discourse.haskell.org/t/qualifieddo-applicativedo-still-requires/13491/5 "2026-01-05T05:30:39Z")

</div>

Nope

```haskell
Main.hs:10:3: error: [GHC-76037]
    Not in scope: ‘Appl.>>=’
    Note: The module ‘Appl’ does not export ‘>>=’.
   |
10 | x <- Appl.pure 123
   | ^^^^^^^^^^^^^^^^^^

```

* * *

Separately even if I use `pure` in the original code, `QualifiedDo` still looks for `Appl.return`. Seems like that’s wrong too?

---

<div class="post-metadata">

**Author:** ![andreasabel](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/andreasabel/32/1764_2.png) [@andreasabel](https://discourse.haskell.org/u/andreasabel)\
**Post date:** [January 5, 2026, 9:37am UTC](https://discourse.haskell.org/t/qualifieddo-applicativedo-still-requires/13491/6 "2026-01-05T09:37:48Z")

</div>

Maybe report this to the GHC issue tracker.

---

<div class="post-metadata">

**Author:** ![tomjaguarpaw](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/tomjaguarpaw/32/1230_2.png) [@tomjaguarpaw](https://discourse.haskell.org/u/tomjaguarpaw)\
**Post date:** [January 5, 2026, 12:28pm UTC](https://discourse.haskell.org/t/qualifieddo-applicativedo-still-requires/13491/7 "2026-01-05T12:28:35Z")

</div>

The desugaring uses `return` on the last line:

> [@brandonchinn178](#):
>
> ```haskell
> > M.do { (x1 <- u1 | … | xn <- un); M.return e } =
> (\x1 … xn -> e) `M.fmap` u1 M.<*> … M.<*> un
> 
> ```

Your code uses `pure`:

> [@brandonchinn178](#):
>
> ```haskell
> foo :: IO Int
> foo = Appl.do
> x <- pure 123
> pure x
> 
> ```

Is that the difference?

---

<div class="post-metadata">

**Author:** ![ashokkimmel](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/ashokkimmel/32/5111_2.png) [@ashokkimmel](https://discourse.haskell.org/u/ashokkimmel)\
**Post date:** [January 5, 2026, 9:42pm UTC](https://discourse.haskell.org/t/qualifieddo-applicativedo-still-requires/13491/8 "2026-01-05T21:42:47Z")

</div>

It’s definitely a bug. I just replicated it myself.

---

<div class="post-metadata">

**Author:** ![brandonchinn178](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/brandonchinn178/32/5103_2.png) [@brandonchinn178](https://discourse.haskell.org/u/brandonchinn178)\
**Post date:** [January 5, 2026, 11:25pm UTC](https://discourse.haskell.org/t/qualifieddo-applicativedo-still-requires/13491/9 "2026-01-05T23:25:36Z")

</div>

Nope, still repros with `return`.

Reported in GHC: [QualifiedDo + ApplicativeDo still requires \>\>= and return (#26723) · Issues · Glasgow Haskell Compiler / GHC · GitLab](https://gitlab.haskell.org/ghc/ghc/-/issues/26723)
