Changes between Initial Version and Version 1 of Ticket #5759


Ignore:
Timestamp:
Jan 10, 2012 7:59:24 AM (3 years ago)
Author:
simonpj
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5759

    • Property Difficulty changed from to Unknown
  • Ticket #5759 – Description

    initial v1  
    3333}}} 
    3434 
    35 Why I think this should work: my understanding is that in line "fromInteger x = make (fromInteger x)" compiler should take into account that[[BR]] 
    36 1) the signature for make is "make :: b -> a",[[BR]] 
    37 2) type b is known at the moment of creating instance (because a == Cont Integer, which is an instance of Container (Cont Integer) Integer),[[BR]] 
    38 and cast "fromInteger x" to type b and pass it to make. This seems to be fixed in 7.2.2 (where this code compiles and displays "Cont 3"), although I did not manage to find any related entry in the changelog. 
     35Why I think this should work: my understanding is that in line `fromInteger x = make (fromInteger x)` compiler should take into account that[[BR]] 
     36 1. the signature for make is `make :: b -> a`,[[BR]] 
     37 2. type b is known at the moment of creating instance (because `a == Cont Integer`, which is an instance of `Container (Cont Integer) Integer)`,[[BR]] 
     38and cast `fromInteger x` to type `b` and pass it to `make`. This seems to be fixed in 7.2.2 (where this code compiles and displays `Cont 3`), although I did not manage to find any related entry in the changelog. 
    3939 
    40 If one replaces the block "instance (Container a b, ..." with 
     40If one replaces the block `instance (Container a b, ...` with 
    4141{{{ 
    4242class NumEquiv a where 
     
    4949    fromInt x = make (fromInt x) 
    5050}}} 
    51 (which is the same as the initial code, the only difference being that the target typeclass --- NumEquiv --- is defined locally in the code), the code compiles successfully even on 7.0.4. 
     51(which is the same as the initial code, the only difference being that the target typeclass --- `NumEquiv` --- is defined locally in the code), the code compiles successfully even on 7.0.4.