 
            
            
            
            
                30 Jun
                
                    2011
                
            
            
                30 Jun
                
                '11
                
            
            
            
        
    
                9:35 p.m.
            
        On Fri, Jul 01, 2011 at 09:05:05AM +1000, Ivan Lazar Miljenovic wrote:
On 1 July 2011 08:58, Joshua Ball
wrote: GHCi seems to be clever about some things:
If I try to print the empty list in ghci, I encounter no problems:
Prelude> [] [] Prelude> show [] "[]" Prelude> print [] []
Even though the type of the list is clearly unknown, it must be picking SOME type. (why does it print [] instead of "")?
Type defaulting: if you don't specify a type, then ghci makes it [Integer].
In this case I'm pretty sure it is [()] since there is only a Show constraint. If there were a Num constraint it would pick Integer. Prelude> sum [] 0 Prelude> :t it it :: Integer -Brent