[Haskell-beginners] typeOf raises Error

Frank Schwidom schwidom at gmx.net
Sun Jan 11 05:27:14 EST 2009


if im calling (on the console)

"typeOf 1"

after importing Data.Typeable, i will gain 

"Integer", as i expected, but if i do so in code which is 
to compile, then there raises an error

import Data.Typeable

 print (typeOf 1)

$ ghc -c DT.hs 

$ ghc -c DT.hs 

    Ambiguous type variable `t' in the constraints:
      `Num t' arising from the literal `1' at DT.hs:4:15
      `Typeable t' arising from a use of `typeOf' at DT.hs:4:8-15
    Probable fix: add a type signature that fixes these type variable(s)

what can i do, to solve this problem?


More information about the Beginners mailing list