[Haskell-cafe] Parse error on input "|"

Dan Weston westondan at imageworks.com
Thu May 31 13:41:37 EDT 2007


The second argument of the second line of the definition does not match 
the expected type. (Polynom,Polynom) is a tuple, not a list, so 
[]::(a,a) is not well typed for any a.

Dan

Akijmo wrote:
> Hi everyone.
> I am new to this Forum, Haskell and i am german, so i am sorry for "noob"
> failures or spelling mistakes.
> 
> I am currently learning for an informatic exam (11th class) and i tried to
> code a function to sum a polynom with a pair of polynoms... (I actually want
> to to code a polynomdivision in which i need this)
> 
> But I get the parse error mentioned in the headline. It is referring to the
> first line of the case differentiation.
> Hopefully you can help me, here's the code:
> 
> polyplusd :: Polynom -> (Polynom, Polynom) -> Polynom
> polyplusd [] p = p
> polyplusd p [] = p
> polyplusd p@((g1,e1):p1) (n, (q@((g2,e2):p2))
> 				| g1>g2 = (g1,e1):(polyplusd p1 (n,q))
> 				| g2>g1 = (g2,e2):(polyplusd p (n,p2))
> 				| g1==g2 && e1+e2 /=0 =(g1, e1+e2):(polyplusd p1 (n,p2))
> 				| otherwise = polyplusd p1 (n,p2)




More information about the Haskell-Cafe mailing list