is identity the only polymorphic function without typeclasses?
Mon, 3 Mar 2003 11:00:36 +0200
> Cagdas Ozgenc <firstname.lastname@example.org> wrote:
> > Greetings,
> > Is identity function the only meaningful function one can write
> > without constraining the type variable using a typeclass? If not,
> > could you please give a counter-example?
> Certainly you can write lots of ``meaningful function''s without type
> classes: not, (&&), (||), as well as many more complicated functions at
> more complicated types.
> You can also write useful polymorphic functions without type classes, as
> long as you specify at least one type. For example, you can write
> polymorphic functions over/yielding lists, such as repeat, cycle, map
> and its many relatives, foldr and its many relatives, take and its
> relatives, takeWhile and its relatives, etc. Similar functions often
> exist for other types.
> I'm somewhat curious, though: why do you ask this question? How do you
> expand your question that makes the answer seem to be ``no''?
I did not mean to include functions that take type constructors as
parameters (so lists are out of my discussion scope). I am only considering
functions that uses type variables that are not restricted by typeclasses.
In this setting could you give a few useful function signatures, and their
explanation? How does "not" work polymorphically for example?