3 ms·
mtl has been around for a while now and using any the monads from the mtl transformers library is very inferrable, although like any inference it returns the mo
by freyrs3 12y ago
mtl has been around for a while now and using any the monads from the mtl transformers library is very inferrable, although like any inference it returns the most general type possible and it's generally just good practice to forward declare the type.
example = do
a <- ask
modify (+ a)
b <- get
tell [b]
GHC correctly infers:
example :: (Num s, MonadState s m, MonadReader s m, MonadWriter [s] m) => m ()