[Haskell-cafe] Convert a function to a string of operators?
hesselink at gmail.com
Fri Mar 11 10:28:16 CET 2011
On Thu, Mar 10, 2011 at 13:34, Lyndon Maydwell <maydwell at 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 . It is an implementation
of the prelude where each data type is a type class.
More information about the Haskell-Cafe