a parse error....i can't fix it
sorry and please forget the name and what it is meaning for. just look at in syntax aspect the error : "parse error on input `|' Failed, modules loaded: none." linerFind :: [Int] -> Int -> MaxSA -> MaxSA --MaxSA is MaximumSubarray linerFind xs len ms1@(MaxSA l h m) -- (MaxSA leftPosition rightPosition maxsum) | h<len = keepFind ms1 where keepFind ms'@(MaxSA l' h' m')= let ms2@(MaxSA l2 h2 m2)= find' xs l' (h'+1) in if m < m2 then linerFind xs len ms2 else keepFind ms2 |otherwise = ms1 --compiler say error is in this line
On Friday 09 September 2011, 16:53:06, anyzhen wrote:
sorry and please forget the name and what it is meaning for. just look at in syntax aspect
the error : "parse error on input `|' Failed, modules loaded: none."
linerFind :: [Int] -> Int -> MaxSA -> MaxSA --MaxSA is MaximumSubarray linerFind xs len ms1@(MaxSA l h m) -- (MaxSA leftPosition rightPosition maxsum)
| h<len = keepFind ms1
where keepFind ms'@(MaxSA l' h' m')= let ms2@(MaxSA l2 h2 m2)= find' xs l' (h'+1) in if m < m2 then linerFind xs len ms2 else keepFind ms2
|otherwise = ms1 --compiler say |error is in this line
You must have the where clause after the guards, linerFind ... | h < len = keepFind ms1 | otherwise = ms1 where ...
Formatted in this way should be compile: linerFind :: [Int] -> Int -> MaxSA -> MaxSA --MaxSA is MaximumSubarray linerFind xs len ms1@(MaxSA l h m) -- (MaxSA leftPosition rightPosition maxsum) | h<len = keepFind ms1 | otherwise = ms1 where keepFind ms'@(MaxSA l' h' m') = let ms2@(MaxSA l2 h2 m2)= find' xs l' (h'+1) in if m < m2 then linerFind xs len ms2 else keepFind ms2 Bye Luca. On Sep 9, 2011, at 4:53 PM, anyzhen wrote:
sorry and please forget the name and what it is meaning for. just look at in syntax aspect
the error : "parse error on input `|' Failed, modules loaded: none."
linerFind :: [Int] -> Int -> MaxSA -> MaxSA --MaxSA is MaximumSubarray linerFind xs len ms1@(MaxSA l h m) -- (MaxSA leftPosition rightPosition maxsum) | h<len = keepFind ms1 where keepFind ms'@(MaxSA l' h' m')= let ms2@(MaxSA l2 h2 m2)= find' xs l' (h'+1) in if m < m2 then linerFind xs len ms2 else keepFind ms2 |otherwise = ms1 --compiler say error is in this line
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (3)
-
anyzhen -
Daniel Fischer -
Luca Ciciriello