Changes between Initial Version and Version 8 of Ticket #589


Ignore:
Timestamp:
Jan 2, 2010 8:09:17 PM (4 years ago)
Author:
igloo
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #589

    • Property Type of failure changed from to None/Unknown
    • Property Cc ganesh.sittampalam@… added
    • Property Difficulty changed from to Unknown
    • Property Architecture changed from to Unknown/Multiple
    • Property Milestone changed from to _|_
    • Property Operating System changed from to Unknown/Multiple
  • Ticket #589 – Description

    initial v8  
    1 {{{ 
    21Hello, 
    32 
     
    76claims to be an HCI expert, just a mere mortal with an opinion. 
    87 
     8'''Type error 1''' 
     9 
    910Code: 
    10  
     11{{{ 
    11121 module Test2 where 
    12132 
    13143 fib n = if (3 > n) then 1 else (fib (n - 1) + fib (n - 2)) 
    14154 k = fib 's' 
    15  
     16}}} 
    1617Error message: 
    17  
     18{{{ 
    1819Test2.hs:4: 
    1920    No instance for (Num Char) 
    2021      arising from use of `fib' at Test2.hs:4 
    2122    In the definition of `k': k = fib 's' 
     23}}} 
    2224 
    2325This isn't a bad error message in my humble opinion, it does pinpoint 
     
    2729to a function which expected an (Ord a, Num a) => a as its parameter. 
    2830 
     31'''Type error 2''' 
     32 
    2933Code: 
    30  
     34{{{ 
    31351 module Test4 where 
    32362  
    33373 k :: Int -> Int 
    34384 k l = 2.0*l 
    35  
     39}}} 
    3640Error message: 
    37  
     41{{{ 
    3842Test4.hs:4: 
    3943    No instance for (Fractional Int) 
     
    4145    In the first argument of `(*)', namely `2.0' 
    4246    In the definition of `k': k l = 2.0 * l 
    43  
     47}}} 
    4448One reason this kind of error could happen is an inexperienced user 
    4549declaring the wrong type for his function, or not knowing that 2.0 
    4650would be interpreted as a Fractional. 
    4751 
     52'''Type error 3''' 
     53 
    4854Code: 
    49  
     55{{{ 
    50561 module Test7 where 
    51572 
    52583 len' xs = head (xs) + (length xs) 
    53594 o = len' "GH" 
    54  
     60}}} 
    5561Error message: 
    56  
     62{{{ 
    5763Test7.hs:4: 
    5864    Couldn't match `Int' against `Char' 
     
    6167    In the first argument of `len'', namely `"GH"' 
    6268    In the definition of `o': o = len' "GH" 
    63  
     69}}} 
    6470I ran this through Hugs version November 2002 and got this error 
    6571message: 
    66  
     72{{{ 
    6773ERROR "Test7.hs":4 - Type error in application 
    6874*** Expression     : len' "GH" 
     
    7076*** Type           : String 
    7177*** Does not match : [Int] 
    72  
     78}}} 
    7379I find the Hugs message more clear, but that might be my background. 
    7480 
     81'''Type error 4''' 
     82 
    7583Code: 
    76  
     84{{{ 
    77851 module Test8 where 
    78862 
    79873 f = head 3 
    80  
     88}}} 
    8189Error message: 
    82  
     90{{{ 
    8391Test8.hs:3: 
    8492    No instance for (Num [a]) 
     
    8997    In the first argument of `head', namely `3' 
    9098    In the definition of `f': f = head 3 
    91  
     99}}} 
    92100This one I find outright scary. For "wrong = div 3 8 + 1/2" it gives 
    93101an error message that somewhat helps me guess the error, but the above 
     
    95103 
    96104/ Peter 
    97 }}}