Alex Ferguson wrote:

 | Frank A. Christoph:
 | > I hope that Either will be renamed to (+), or at
 | > least deprecated in favor of (+).
 | 
 | I'd basically agree with Frank here, though presumably for consistency
 | with Koen's (very reasonable) proposals, this would need to be the
 | symbol (:+:) -- or characters to that effect -- for consistency.

I agree.

Note that the symbol (+) as a type, would become a type _variable_. I
think, just as it is usefule to have (+) as a formal parameter of a
function, it is useful to have operators as type variables also.

See the following example (in an adapted Fudget library):

  class Fudget (-->) where
    makeFudget :: (a --> b) -> (a `F` b)

  instance Fudget F where
    makeFudget = id

  instance Fudget SP where
    makeFudget = absF

  instance Fudget (->) where
    makeFudget = mapF

We could even write:

  type a :=> b = F a b
  type a :-> b = SP a b

If class names are also subject to this convention, then we can write
things like:

  class a :< b where    -- subtyping
    coerce :: a -> b

  foo :: (a :< Int) => a -> a -> Int
  foo x y = coerce x + coerce y

I like it!

Regards,
Koen.

--
Koen Claessen,
[EMAIL PROTECTED],
http://www.cs.chalmers.se/~koen,
Chalmers University of Technology.


Reply via email to