Please, what is wrong here?

-------------------------------------------
class Project a b where  prj :: b -> a -> b

data Pol a = Pol [(a,Int)] Char

instance Project (a,Int) (Pol a) where
                                 prj (Pol _ c) (a,p) = Pol [(a,p)] c

f :: a -> Pol a -> Pol a
f    a    g@(Pol ms _) =  prj g (head ms)

f' :: a -> Pol a -> Pol a
f'    a    g     =  prj g (a,1)
-------------------------------------------


ghc-4.02  -c  -fglasgow-exts -optC-fallow-overlapping-instances
                             -optC-fallow-undecidable-instances

understands f, but does not understand f'.


Probably, there is something about a constant type Int placed in the 
instance. Changing it to 
                         instance Integral i => Project (a,i) (Pol a)
                           where
                           prj (Pol _ c) (a,p) = Pol [(a,toInt p)] c

removes the compiler error message.

But has  ghc  to allow the initial declarations?


------------------
Sergey Mechveliani
[EMAIL PROTECTED]

Reply via email to