> 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

> Is there a way to extract parameter names from function definition to
> use them in Show instance? Or should I just use same names everywhere?

The only kind of introspection I know comes from Template Haskell, but
I'm sure there are other methods that I'm not aware of available.

On Sun, Mar 6, 2011 at 7:28 AM, Evgeny Grablyk <evgeny.grab...@gmail.com> wrote:
> Many thanks for your help! Seems to be what I need. Two more related 
> questions:
>
> Will methods explained here work for boolean expressions?
> Is there a way to extract parameter names from function definition to
> use them in Show instance? Or should I just use same names everywhere?
>
> In case  that helps, here's the code I need to convert (the code in
> where part of solveScheme): http://npaste.de/aKY3cn0xZf/
>
> --
> Evgeny
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

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

Reply via email to