On Thu, 28 May 2009, Bulat Ziganshin wrote:
i use another approach which imho is somewhat closer to interpretation
of logical operations in dynamic languages (lua, ruby, perl):
a ||| b | isDefaultValue a = b
| otherwise = a
a &&& b | isDefaultValue a = defaultValue
| otherwise = b
-- Class of types having default value:
class Defaults a where defaultValue :: a
instance Defaults () where defaultValue = ()
instance Defaults Bool where defaultValue = False
instance Defaults [a] where defaultValue = []
The absence of such interpretations and thus the increased type safety was
one of the major the reasons for me to move from scripting languages to
Haskell.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe