I'm using Hugs March 1999 version, with extensions (-98).
With extensions turned on, Hugs does not enforce the restriction against
type synonyms in instance declarations.  I was exploring a possible way of
implementing Kevin Atkinson's goals, and thought this might work.

    import Array

    -- one of the multi-parameter type classes suggested by Kevin Atkinson
    class Find c i e where
      find :: i -> c i e -> Maybe e

    -- using a type constructor to shoehorn [(i,e)] into the class Find
    data Cont3 i e = Cont3 [(i,e)]
    instance Eq i => Find Cont3 i e where
      find i (Cont3 ls) = lookup i ls

    -- Array types can be put into Find more easily.
    type Y = Array 
    instance Ix a => Find Y a b where  -- non-Haskell-98, but Hugs accepts.
      find i a = if i `elem` (indices a) then Just (a ! i) else Nothing

    -- a synonym for [(i,e)]
    type X i e = [(i,e)]
    -- The synonym X is meaningful, and can be used to define a function.
    foo :: Ix i => i -> X i e -> Maybe e
    foo i ls = lookup i ls

    -- This is what we _really_ want X for:
    instance Ix i => Find X i e where
      find = foo

The last instance declaration has the same explicit structure as the
instance declaration for Y, but it is rejected by Hugs with the error message:
  Not enough arguments for type synonym "X"

I believe that if nothing else, the error message is wrong.
-----------------
Apologies if this is a duplicate.  I submitted a similar report to the bug
form at http://www.haskell.org/hugs/bug-reports.html last night, and
haven't seen a report come through the mailing list.

--
Scott Turner
[EMAIL PROTECTED]       http://www.ma.ultranet.com/~pkturner

Reply via email to