haskell / haskell/haskell-language-server
Hovering has no effect on `pure` in the presence of `ApplicativeDo`
- Dominant language
- Haskell
- Stars
- 3k
- Forks
- 455
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 13
Description
### Your environment
Which OS do you use? up-to-date ArchLinux
Which version of GHC do you use and how did you install it? 9.14.1 via ghcup
How is your project built (alternative: link to the project)? See steps to reproduce.
Which LSP client (editor/plugin) do you use? terminal Vim + YCM
Which version of HLS do you use and how did you install it? 2.14.0.0 via ghcup
Have you configured HLS in any way (especially: a `hie.yaml` file)? No
### Steps to reproduce
Hover with the mouse on `pure` in the code below (or equivalent interaction)
```haskell
{-# LANGUAGE ApplicativeDo #-}
import Control.Applicative (ZipList (ZipList))
nonDetMonadic :: Num a => [a] -> [a] -> [a] -> [a]
nonDetMonadic xs ys zs = do
x <- xs
y <- ys
z <- zs
pure $ x + y + z
zippyMonadic :: Num a => ZipList a -> ZipList a -> ZipList a -> ZipList a
zippyMonadic xs ys zs = do
x <- xs
y <- ys
z <- zs
pure $ x + y + z
main :: IO ()
main = do
print $ nonDetMonadic [1..3] [1..3] [1..3]
print $ zippyMonadic (ZipList [1..3]) (ZipList [1..3]) (ZipList [1..3])
```
```cabal.project
packages: .
with-compiler: ghc-9.14.1
```
```cabal
cabal-version: 3.0
name: app
version: 0.1.0.0
executable app
main-is: Main.hs
build-depends: base
hs-source-dirs: .
default-language: GHC2024
```
### Expected behaviour
`pure`'s (or `return`'s) doc should be shown upon hovering on it.
### Actual behaviour
Hovering doesn't result in any doc pop-up (not even a wrong one).
### Debug information
1. `pure` and `return` equally suffer the bug.
2. Removing the line
```haskell
{-# LANGUAGE ApplicativeDo #-}
```
fixes the issue (yeah, clearly the `zippyMonadic` fails to type-check, but that's expected).
3. According to [this comment](https://github.com/haskell/haskell-language-server/issues/4777#issuecomment-4083596434) a possibly related issue is #4777.
4. This part of the log might be relevant:
```log
2026-08-07 12:06:37,390 - DEBUG - TX: Sending message: b'Content-Length: 167\r\n\r\n{"id":2,"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":2,"line":9},"textDocument":{"uri":"file:///home/enrico/deleteme/app/Main.hs"}}}'
2026-08-07 12:06:37,395 - DEBUG - RX: Received message: b'{"id":2,"jsonrpc":"2.0","result":{"contents":{"kind":"markdown","value":""},"range":{"end":{"character":18,"line":9},"start":{"character":2,"line":9}}}}'
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the empty hover response in Main.hs using the cabal.project and cabal files, then trace the textDocument/hover handling for symbols in an ApplicativeDo block. Compare the behavior with the related discussion in issue #4777. Done means hovering over pure and return shows their documentation while ApplicativeDo is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100