this code compiles correcly:

newtype State s a = State { runState :: s -> (a,s) }

instance Monad (State s) where
  --return :: a -> State s a
    return x = State (\st -> (x,st))

but this one doesn't compile:

newtype State s a = State { runState :: a -> (a,s) }

instance Monad (State s) where
  --return :: a -> State s a
    return x = State (\st -> (st,x))

Why is this happening?