patch applied (ghc): Make the type-defaulting in GHCi use () as the
first default type
Simon Peyton Jones
simonpj at microsoft.com
Thu Mar 15 10:32:50 EDT 2007
Thu Mar 15 07:28:12 PDT 2007 simonpj at microsoft.com
* Make the type-defaulting in GHCi use () as the first default type
See Trac #1200
This is a somewhat experimental fix. I'm not sure we want it in 6.6.1
The idea is explained in Note [Default unitTy] in TcSimplify. In
interative mode (or with -fextended-default-rules) we add () as the
first type we try when defaulting. This has very little real impact,
except in the following case. Consider:
Text.Printf.printf "hello"
This has type (forall a. IO a); it prints "hello", and returns
'undefined'. We don't want the GHCi repl loop to try to print that
'undefined'. The neatest thing is to default the 'a' to (), rather
than to Integer (which is what would otherwise happen; and then GHCi
doesn't attempt to print the (). So in interactive mode, we add () to
the list of defaulting types.
M ./compiler/typecheck/TcDefaults.lhs -1 +1
M ./compiler/typecheck/TcRnMonad.lhs -2 +2
M ./compiler/typecheck/TcSimplify.lhs -11 +36
More information about the Cvs-ghc
mailing list