[ketil@ii.uib.no: Re: Enum class]

Dylan Thurston dpt@math.harvard.edu
Thu, 25 Oct 2001 18:16:09 +0900


--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

(I want to trim the headers, but don't know the history of this
thread.  Also cc:ed back to the Haskell list.)

On Thu, Oct 25, 2001 at 11:11:42AM +0200, Ketil Malde wrote:
> Dylan Thurston <dpt@math.harvard.edu> writes:
> > I agree that Enum instances for Float/Double are not likely to be
> > useful.
>=20
> From a gut feeling, I could see a use for expressions like
>=20
>         [1.5, 1.6..] and [1.5, 1.6..2.0]
>=20
> (i.e. enumFromThen and enumFromThenTo) but enumFrom and enumFromTo
> making list of rounded integers seems strange to me.
>=20
> It seems to me that enumFromThen and -To could be implemented
> something like:
>=20
>         enumFromThen beg next =3D beg : enumFromThen next (next+delta)
>                 where delta =3D next-beg
>=20
> similarly for enumFromThenTo, of course.
>=20
> i.e. depending only on functionality found in Num.  Why not put these
> functions there, and remove Float and Double as Enum instances?
>=20
> What am I missing?

Currently you can write

data Day =3D Sunday | Monday | Tuesday | Wednesday | Thursday | Friday |
           Saturday

weekdays =3D [Monday..Friday]

which has nothing to do with Num.

Best,
	Dylan Thurston

--FCuugMFkClbJLl1L
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE719hZVeybfhaa3tcRAggcAJ4mfPz4dzRyJioGPrD86X3ihq4eWQCfesXf
dGNWhJbdhtZKpU3mQLqQ79I=
=mEFc
-----END PGP SIGNATURE-----

--FCuugMFkClbJLl1L--