is identity the only polymorphic function without typeclasses?

Bernard James POPE bjpop@cs.mu.OZ.AU
Mon, 3 Mar 2003 20:31:33 +1100 (EST)


> 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.

There is const:

   const ::  a -> b -> a 
   const x _ = x

And of course a family of const like functions:

   const' :: a -> b -> c -> a
   const' x _ _ = x

and so on...

Of course const is related to id.

There is also undefined:

   undefined :: a
   undefined = undefined

You can extend this with arguments:

   f :: a -> b
   f x = undefined

or even:

   f x = f x

and so on ...

Is this what you are looking for?

> In this setting could you give a few useful function signatures, and their
> explanation? How does "not" work polymorphically for example?

not isn't polymorphic in Haskell 98.

Cheers,
Bernie.