Am Samstag 05 Dezember 2009 21:51:26 schrieb Michael Snoyman: > On Sat, Dec 5, 2009 at 10:33 PM, José Iborra <pepeibo...@gmail.com> wrote: > > Since you have already decided MPTCs are ok, in my opinion undecidable > > instances are fine here. > > But I realize this is not the usual stance, so I might be wrong. > >
As far as I understand, all UndecidableInstances does is tell the compiler "Maybe instance checking won't terminate, try anyway", so they're dangerous *only during compilation*, once things compile, everything's dandy. > Sounds reasonable to me. I'm waiting for the boogey man to jump out > though > > and explain why undecidables here will get me gored to death by a raptor > [1]. They won't. They might suck you into a black hole, but raptors are very specialised. > > > > instance Convert Integer Double where convert = Just . fromIntegral > > instance TotalConvert Double -- that's all instance TotalConvert Integer Double > > > Interestng approach. The current approach is *almost* the same, just > leaves > > off the default definition. I'd be wary of putting in a definition like > that; although it saves a line of typing, it let's a partial function get > in which could cause trouble for unsuspecting users. But it is a > possibility. But only if they declare misbehaved instances of TotalConvert. Whenever a reasonable instance TotalConvert x y exists, the Convert instance should satisfy the demands of the default definition. > > > Cheers, > > pepe > > [1] http://xkcd.com/292/ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe