I have this statement:
newtype State st a = State (st -> (st, a))
Hence the type of State
is:
State :: (st -> (st, a)) -> State st a
I cannot understand the meaning:
- Are
st
anda
just placeholder of two data-type? Right? - Does the statement means that State is a function that take as argument a function?
Yes and yes. The
st
is the state type and thea
is the answer type.