Like others, Haskell functions are automatically polymorphic by default if they do not use any specific properties of the base type. If you open ghci and type:
>>> let fx = x
... then ask its type f , it will automatically infer that f completely polymorphic:
>>> :type f f :: t -> t
Same thing if you use a file. You can simply define:
fx = x
... and the compiler concludes that f is of type a -> a . You can also explicitly annotate f too:
f :: a -> a fx = x
source share