• simonpj@microsoft.com's avatar
    Make the type-defaulting in GHCi use () as the first default type · d4b95ea9
    simonpj@microsoft.com authored
    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.  
    
    d4b95ea9
TcRnMonad.lhs 30.6 KB