Skip to content

ApplicativeDo Fails to Desugar 'return True'

ApplicativeDo correctly infers Functor if I bind an unused variable:

Prelude> :t \m -> do { x <- m; return True; }
\m -> do { x <- m; return True; } :: Functor f => f t -> f Bool

Prelude> :t \m -> do { m; return True; }
\m -> do { m; return True; } :: Monad m => m a -> m Bool

It seems like if 'x' is unused, then 'x <- m' and 'm' should be equivalent.

And maybe 'return True' should be Monad, but 'do { return True; }' should be Applicative?

Edited by MichaelBurge
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information