[Haskell-cafe] instance Enum Double considered not entirely great?

roconnor at theorem.ca roconnor at theorem.ca
Wed Sep 21 05:33:58 CEST 2011


On Tue, 20 Sep 2011, Alexander Solla wrote:

> 
> 
> On Tue, Sep 20, 2011 at 1:22 PM, Jake McArthur <jake.mcarthur at gmail.com> wrote:
>       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*.
> 
> 
> Enum is the class that represents enumerable types.  In other words, the class of things that can be injected into the natural numbers.  These types
> inherit an order from the natural numbers, ordering by images under this injection.
> 
> Now, we might not like that order, and it might not agree with an Ord instance, but it exists.

For what it's worth, at some point in time I was sketching a proposal to 
split the Enum class into two classes because I felt that two distinct 
ideas were being conflated.  Unfortunately this was years ago and I have 
forgotten what the details I was thinking.  Perhaps someone can 
reconstruct a proposal along these lines.

-- 
Russell O'Connor                                      <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''


More information about the Haskell-Cafe mailing list