After reading a little, it seems that the current situation with writing to Haskell is a bit sticky.
Take for example a new type StateT. Both code
newtype StateT s m a = StateT { runStateT :: s -> m (a,s) }
and documents
Constructors
StateT
runStateT :: s -> m (a, s)
say the type runStateTis equal s -> m (a,s). However, GHCi shows that the type is indeed
> :t runStateT
runStateT :: StateT s m a -> s -> m (a,s)
Are there any explanations for this discrepancy? Record identifier and function relate to two different things that the GHC magically resolves behind the scenes? Although I understand why it's nice to write s -> m (a,s)in notes, it just seems wrong.
source
share