
11 Mar
2011
11 Mar
'11
4:28 a.m.
On Thu, Mar 10, 2011 at 13:34, Lyndon Maydwell
Will methods explained here work for boolean expressions?
The convenience of defining using specialised datatypes for serialising numeric operations comes from Num being a typeclass. This is not the case for Bool:
Prelude> :info Num class (Eq a, Show a) => Num a where (+) :: a -> a -> a ... -- Defined in GHC.Num
Prelude> :info Bool data Bool = False | True -- Defined in GHC.Bool
If you want something like this for Bool (and other standard data types) have a look at the Awesome Prelude [1]. It is an implementation of the prelude where each data type is a type class. Erik [1] http://tom.lokhorst.eu/2010/02/awesomeprelude-presentation-video