Whoa. I was far too confident that wouldn't work! On Sep 2, 2016 12:39 PM, "Richard Eisenberg" <r...@cs.brynmawr.edu> wrote:
> I feel like I must be missing something, but what's wrong with > > class Semigroup1 f where > op :: f a -> f a -> f a > > default op :: Monoid (f a) => f a -> f a -> f a > op = (<>) > > > ? Does that do what you like? > > Richard > > > On Sep 1, 2016, at 11:15 PM, David Feuer <david.fe...@gmail.com> wrote: > > On occasion, it can be useful to have default definitions that don't > typecheck even with DefaultSignatures. It would be nice to be able to use > them anyway. For example, if we have > > class Semigroup1 f where > op :: f a -> f a -> f a > > then we could, hypothetically, give a default definition for (<>): > > default (<>) :: Semigroup1 f => f a -> f a -> f a > (<>) = op > > But we can't give a default definition > > op = (<>) > > because there's no way to write its signature. However, for any F with > > instance Semigroup (F a) where ... > > the definition op = (<>) is perfectly fine. > > Would it be possible to offer a completely wild defaulting mechanism > allowing *any expression* as a default, and only checking its type and > compiling it when it's actually used? > _______________________________________________ > ghc-devs mailing list > ghc-devs@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > > >
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs