6.6 strikes me again :)

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Sep 20 14:41:42 EDT 2006


Hello Simon,

Wednesday, September 20, 2006, 7:35:39 PM, you wrote:

> Quite right; that's just as specified.  The coverage condition is
> documented in the manual.  (GHC 6.4 and Hugs are too liberal, and
> thereby risk divergence during type checking.)   If you want this
> program to work, use -fallow-undecidable-instances

let's look at the slightly modified program:

class (Monad m) =>  MRef m r | r->m, m->r
class (Monad m) =>  Stream m h | h->m
newtype StringReader r  =  StringReader r
instance (Monad m, MRef m r) =>  Stream m (StringReader r)

coverage condition requires that monad type 'm' should occur in stream
handle type 'StringReader r'. With MRef defined as bijective type
function between m and r that is, in fact, true. may be compiler is just not smart
enough to figure this?

is using -fallow-undecidable-instances safe in this situation?
what of MRef fundeps, r->m or m->r, is really necessary in this case -
i think it is r->m ?


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Glasgow-haskell-users mailing list