The reason is the same as for
Prelude> show undefined "*** Exception: Prelude.undefined Prelude> fromEnum undefined <interactive>:0:1: Ambiguous type variable `a0' in the constraint: (Enum a0) arising from a use of `fromEnum' Probable fix: add a type signature that fixes these type variable(s) In the expression: fromEnum undefined In an equation for `it': it = fromEnum undefined
namely, the extended default rules of ghci allow ambiguity to be restricted for the Show restriction, but not for the Enum restriction. If you try to compile the source file using foo = polyTypeOf show , you will also get an ambiguous variable type error (unless you use {-# LANGUAGE ExtendedDefaultRules #-} ).
source share