[Haskell-beginners] expressing constraints 101

Karl Voelker karl at karlv.net
Wed Aug 13 07:15:07 UTC 2014


On Tue, Aug 12, 2014, at 11:11 PM, Dimitri DeFigueiredo wrote:

Hi G Akash,



Is that the only solution? I thought about that. The problem
with it is that it changes the Set type class. I want the Set
type class to be able to contain elements of any type, not just
members of Ord.



I think the type class represents a "Set" interface that is
general. It is the implementation using trees that is only
available for Ordered types. And there may be other
implementations that don't need this constraint. So, if
possible, I don't want to change the Set type class. Isn't
there another way to fix it?



There are a variety of ways to deal with this using language
extensions, such as:



[1]https://gist.github.com/ktvoelker/af613fe5308b748b4606



-Karl

References

1. https://gist.github.com/ktvoelker/af613fe5308b748b4606
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140813/5dc3e082/attachment-0001.html>


More information about the Beginners mailing list