
I’m using GHCi in a Haskell version 7.10.2 and using this fragmente of coding: data ArvBinA t = Folha t | No Int (ArvBinA t) (ArvBinA t) deriving (Eq, Ord, Show) arvbina = No 4 (No 2 (Folha 14) (Folha 09)) (No 2 (Folha 19) (Folha 51)) tamArvBinA :: ArvBinA t -> Int tamArvBinA (Folha x) = 1 tamArvBinA (No n xt yt) = n rotula :: ArvBinA t -> ArvBinA t -> ArvBinA t rotula ae ad = No n ae ad where n = (tamArvBinA ae) + (tamArvBinA ad) listoArvBinA :: (Eq t) => [t] -> ArvBinA t listoArvBinA xs |m == 0 = Folha (head xs) |otherwise = rotula (listoArvBinA xse) (listoArvBinA xsd) where m = (length xs) `div` 2 (xse, xsd) = (take m xs, drop m xs) After compiling there is this message: parse error on input ‘=’. There is someone that he/she can help me? I think that’is na error by clause where and the offside rule, or so, but I’m not right of this. Thanks in advance for some help Francisco Vieira Enviado do Email do Windows

Hello, try changing this: rotula ae ad = No n ae ad where n = (tamArvBinA ae) + (tamArvBinA ad) to rotula ae ad = No n ae ad where n = (tamArvBinA ae) + (tamArvBinA ad)

On 2015-12-19 08:45 AM, vieira.ufpi@gmail.com wrote:
where m = (length xs) `div` 2 (xse, xsd) = (take m xs, drop m xs)
These two lines are misaligned. Proof: paste them to an honest pastebin such as lpaste.net to see: http://lpaste.net/147461

If it is right, what should I do to correct the problem?
Thanks in advance
Vieira
2015-12-19 15:14 GMT-02:00 Albert Y. C. Lai
On 2015-12-19 08:45 AM, vieira.ufpi@gmail.com wrote:
where m = (length xs) `div` 2 (xse, xsd) = (take m xs, drop m xs)
These two lines are misaligned. Proof: paste them to an honest pastebin such as lpaste.net to see: http://lpaste.net/147461
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- "Embora ninguém possa voltar atrás e fazer um novo começo, qualquer um pode começar agora e fazer um novo fim". (Chico Xavier)

what should I do to correct the problem?
try to align "m" and "(xse,xsd)": indent "(" to the same number of spaces as "m" where m = (length xs) `div` 2 (xse, xsd) = (take m xs, drop m xs) indents are important. Also check if you use tab character. It is safer to use spaces.
participants (4)
-
Albert Y. C. Lai
-
Francisco Vieira de Souza
-
Imants Cekusins
-
vieira.ufpi@gmail.com