cvs commit: hugs98/src type.c

Jeff Lewis lewie@glass.cse.ogi.edu
Mon, 8 Apr 2002 07:41:29 -0700


lewie       2002/04/08 07:41:29 PDT

  Modified files:
    src                  type.c 
  Log:
  Revert the dictionary constructing code to only use evidence from the
  "parameter" classes (those to the left of =>) in constructing a dictionary.
  This undoes a patch which added self to the list of evids, which purportedly
  helped in some cases when you have overlapping instances.  Unfortunately,
  adding self here can lead to unintentional data recursion in the dictionary
  definition.  Further, I can't reconstruct how adding self helps with
  overlapping instances.  This commit will help us found out again, I'm sure ;-)
  (but in which case, a different fix will have to be found).
  
  Here's example which demonstrates the problem:
  
  class Monad m => C1 m x
  
  -- Monad m is implied by C1 but test diverges if constraint not present
  class ({-Monad m, -} C1 m x) => C2 m x
    where
      c2 :: x -> m x
  
  instance Monad m => C1 m Bool
  instance C2 Maybe Bool
    where
      c2 = return
  
  test :: Maybe Bool
  test = c2 True
  
  Revision  Changes    Path
  1.41      +8 -19     hugs98/src/type.c