On Sun, Aug 31, 2008 at 4:21 PM, Jonathan Cast
<[EMAIL PROTECTED]> wrote:
> 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.

Yes, that's exactly what I am suggesting.  This is especially
important because Set cannot be made an instance of Functor because of
the Ord restriction on the elements, so you can't generalize to fmap
without redefining Functor as RestrictedFunctor or some such, which
adds a ton of additional type-level programming that shouldn't be
required for day-to-day work.

I'm not against being able to use "double = map (*2)" generally, but
the evidence I've seen says that the PL theory isn't there yet to do
so without unacceptable performance penalties.  (That definition
violates the monomorphism restriction anyways).

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

I don't think "a language I dislike also has this feature" is a good
argument against a feature.  C++ also has named fields in records, and
a standard I/O library.  Should Haskell not have those either?

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

Reply via email to