[Haskell-cafe] language proposal: ad-hoc overloading

Jonathan Cast jonathanccast at fastmail.fm
Sun Aug 31 19:21:19 EDT 2008


On Sun, 2008-08-31 at 16:08 -0700, Ryan Ingram wrote:
> In particular I do NOT want each function in its own typeclass; the
> previous post saying:
> > foo x = map (bar x)
> should be rejected as ambiguous without a type signature somewhere

What type signature do you propose?

It seems as if you're proposing that 

  doubleSet :: Set.Set Int -> Set.Set Int
  doubleSet = map (*2)

  doubleList :: [Int] -> [Int]
  doubleList :: map (*2)

work, but that you not be allowed to notice that the definitions are
identical and substitute

  double = map (*2)

for both definitions.

Sorry, but I use Haskell specifically because I do *not* want to use C
++.

jcc




More information about the Haskell-Cafe mailing list