I won't comment on what state exactly is, but you can read up on that and gain some intuition here:
https://en.wikibooks.org/wiki/Haskell/Understanding_monads/StateIt's helpful to implement it using a pen and paper, and consider how the state flows and gets transformed.
According to the below example,
stackManip stack =
let ((), newStack1) = push 3 stack
(a, newStack2) = pop newStack1
in pop newStack2
We get,
push :: a -> Stack a -> ((), Stack a) -- Assuming 'Stack a' is a defined datatype
pop :: Stack a -> (a, Stack a) -- Representing a stack with elements of type 'a'
Thus,
~~ (Stack a -> ((), Stack a)) >>= (Stack a -> (a, Stack a)) { Replacing by types }
Bind (>>=) has the type, (for "State s")
(>>=) :: State s a -> (a -> State s b) -> State s b
This is a type mismatch. The conversion to do syntax is at fault here.
First, you must write the computation using bind (>>=), and then convert to do-notation.