[Haskell-cafe] Polymorphism overhead

2009-02-17 Thread Louis Wasserman
I have (roughly) the following code: data Foo e type MFoo e = Maybe (Foo e) instance Ord e = Monoid (Foo e) where f1 `mappend` f2 = code invoking the mappend instance from Maybe (Foo e) I'd expect this to optimize to the same thing as if I had implemented: meld :: Ord e = Foo e - Foo e - Foo e

Re: [Haskell-cafe] Polymorphism overhead

2009-02-17 Thread Don Stewart
wasserman.louis: I have (roughly) the following code: data Foo e type MFoo e = Maybe (Foo e) instance Ord e = Monoid (Foo e) where f1 `mappend` f2 = code invoking the mappend instance from Maybe (Foo e) I'd expect this to optimize to the same thing as if I had implemented: meld :: Ord