[Haskell-beginners] Re: testing and the culture of Haskell

Isaac Dupree ml at isaac.cedarswampstudios.org
Wed Jan 20 18:13:07 EST 2010

Heinrich Apfelmus wrote:
> However, in a sense, one can interpret the pure in purely functional as
> a property of the type constructor (->) , i.e. a function of type  (a ->
> b)  is guaranteed to not have side effects. In this light, ML and Scheme
> are lacking a very important type: they only have functions with side
> effects.

> Or more precisely, their type system does not distinguish
> between functions with and without side effects.

that's not actually more precise! Haskell doesn't entirely do that 
either. consider:
f :: Int -> IO Int
f x = return (x + 1)
No side effects! But other ->IO typed values do yield side-effects.

It is exactly as if ML and Scheme contain only the type of (->) composed 
with IO.  (Well, actually Scheme is dynamically typed so it's a bit 
silly to say so..)  (and Scheme allows functions with zero arguments, 
which are different from its non-side-effecting values.. not sure about ML)


More information about the Beginners mailing list