Search code examples
haskellnewtype

Meaning of a newtype statement


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 and a just placeholder of two data-type? Right?
  • Does the statement means that State is a function that take as argument a function?

Solution

  • Yes and yes. The st is the state type and the a is the answer type.