This might be a bit confusing since there are some type aliases involved. You are basically within the Server monad (or actually Handler monad or something like that, I don't quite remember). Since you are within another monad you can't just freely execute actions that are available in another monad (which is why we use monads, to limit what can be done within given context). However, this particular monad actually implements `MonadIO` type class which allows us to convert IO action into some other action. So import `liftIO` which will enable you to convert IO action to another action like this :
import Control.Monad.IO.Class ( liftIO )
And than instead of `server = indexIO` write
Since you are within a different monad you are actually returning something like :
Instead of just
And even if Server was an IO monad, using return on something of type `IO Html` would give you
You can read more about executing IO in servant over here :