[Haskell-cafe] RealFloat constraint on Complex type
Bayley, Alistair
Alistair.Bayley at invesco.com
Wed May 21 04:57:29 EDT 2008
> From: haskell-cafe-bounces at haskell.org
> [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of
> Richard A. O'Keefe
>
> On 21 May 2008, at 9:25 am, Conal Elliott wrote:
> > I think the practice of constraint in type definitions is
> generally
> > discouraged,
>
> Is this true? If so, why?
> If I have a data type that simply doesn't make sense unless
> some of the
> type variables belong to certain classes, _shouldn't_ that be stated
> clearly in the declaration rather than hidden elsewhere?
I recall this from Graham Klyne, but I think his use case might be a bit
different:
http://www.ninebynine.org/Software/Learning-Haskell-Notes.html#type-clas
ses-and-data
I don't know all the pros and cons (are there pros, other than the
documentation argument you gave?). I think:
1. adding the constraint has some costs, and very few benefits
2. nobody does it much, if at all. Probably for the first reason.
Alistair
*****************************************************************
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*****************************************************************
More information about the Haskell-Cafe
mailing list