[Haskell-cafe] Avoiding undecidables
daniel.is.fischer at web.de
Sat Dec 5 16:43:03 EST 2009
Am Samstag 05 Dezember 2009 21:51:26 schrieb Michael Snoyman:
> On Sat, Dec 5, 2009 at 10:33 PM, José Iborra <pepeiborra at 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
> and explain why undecidables here will get me gored to death by a raptor
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
> 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
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
> > Cheers,
> > pepe
>  http://xkcd.com/292/
More information about the Haskell-Cafe