I was surprised that the GHC.Base module has no RULES for the laws governing the Functor, Applicative and Monad classes. Does GHC use the laws in other ways to optimize code? For example, is `m >>= return`

optimized to `m`

and if yes, by what mechanism? Judging from the Core output of a small program involving the expression `Just "hello, world" >>= return`

this is in fact optimized away, but that might be special to `Maybe`

.

In another discussion examples of rank-1 types `m`

came up that are monads but only up to some semantics: Suppose for each type `a`

there is a context `semantics :: m a -> s a`

so that for example the right identity law holds only in this context:

```
semantics m ≡ semantics (m >>= return)
m ≢ m >>= return
```

I wonder whether it is safe to use monad combinators for such types or whether there is the danger that GHC might employ `semantics`

-changing optimizations.