I feel one of the mind hurdles in learning haskell is that data sometimes defines functions as data.
data Person = Person { name :: String, age :: Int } This is intuitive and resembles other languages. But in
newtype StateT s m a = StateT { runStateT :: s -> m (a,s) } This is basically calling a function s->m (a,s) "data"
I can readily understand that in higher order functions, "functions" are indeed passed around as data. But in type definitions, using functions to define types, that's quite surprising.
So my question is: will this bring expressiveness to Haskell type system? What is the theory behind all this?