DDC/EffectSystem

From HaskellWiki
< DDC
Revision as of 00:47, 19 March 2008 by Benl23 (talk | contribs)
Jump to navigation Jump to search

Effect typing

Instead of state monads (like IO), Disciple uses default strict evaluation and effect typing to deal with computational effects.

The main benefit of effect typing is that the types of functions that cause effects have the same shape as their 'pure' counterparts, which lets us re-use more code.

for example, in Haskell the 'pure' map function has type:

    map :: (a -> b) -> [a] -> [b]

but if we need to use an effectful function defined in terms of a state monad, we must use the monadic version, mapM instead.

    mapM :: Monad m => (a -> m b) -> [a] -> m [b]