is identity the only polymorphic function without typeclasses?

Cagdas Ozgenc co19@cornell.edu
Mon, 3 Mar 2003 11:49:29 +0200



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

Yes, I thought about these too. Do you find these functions practically
useful? Can you give an example where I can utilize these functions?

Thanks for the response