[Haskell-cafe] instance Enum Double considered not entirely great?
jake.mcarthur at gmail.com
Tue Sep 20 22:22:03 CEST 2011
On Tue, Sep 20, 2011 at 3:48 PM, Chris Smith <cdsmith at gmail.com> wrote:
> But it would be the *wrong* thing to use as a desugaring for list range
> notation. List ranges are very unlikely to be useful or even meaningful
> for most such enumerations (what is [ Red, Green .. LightPurple]?); and
> conversely, as we've seen in this thread, list ranges *are* useful in
> situations where they are not a suitable way of enumerating all values
> of a type.
This makes me wonder if maybe the reason this discussion is happening
at all is that we don't have a well-defined meaning for what Enum
*is*. At this point, it seems like the only answer is that it's
whatever the instance says it is, which I find unsatisfying. What
exactly does Enum enumerate? To me, the list syntax sugar looks like
I'm specifying bounds, so it makes sense to include all values within
those bounds (and honestly, having instances for Float, Double, and
Rational sounds like a mistake, given this), but clearly that is not
what it means to everybody. What does it mean to you? What makes the
current behavior more useful than the proposed behavior? You say we've
seen that this behavior is useful in this thread, but I'm not sure
what it is we have seen.
More information about the Haskell-Cafe