Hi

A function inc5

  inc5 :: Float -> Float
  inc5 x = x + 5

can only be a member of a type class A, if we make all functions from
Float -> Float members of type class A. Thus, I assume, that _type_
class is named type class, as membership is decided by types.

However, it makes no sense to say that all functions from Float -> Float
are invertible or continuous. We would want to specifically say that
inc5 is continuous, not all Float -> Float functions. Thus, we could
have another abstraction, lets call it _value_ class, where we could say
that an individual value (function) could be member. We could say
something like:

  class Invertible (f :: a -> a) where
    invert :: f -> (a -> a)

  instance Invertible inc5 where
    invert _ = \x -> x - 5

In many cases this would be too specific. We would like to say, that
applying the first argument to `+` returns an invertible function.
Something like:

  instance Invertible (`+` x) where
    invert (x +) = \y -> y - x

We would properly also like to say, that composing two invertible
functions results in another invertible function. I guess there are many
more examples.

This idea, of value classes, do not feel all that novel. Somebody has
properly thought about it before, but gave it a different name. If
anybody has links to some papers it would be much appreciated. If
anybody has some thoughts of the desirability of value class it would
also be much appreciated.


/Mads Lindstrøm



Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to