On Thu, Mar 10, 2011 at 13:34, Lyndon Maydwell <maydw...@gmail.com> wrote:
>> 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

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to