From where can I get complete set of Indentation rules for Haskell code writing?
Past SO questions which are similar to my following question has led me to ask above question. What are the reasons behind the error message: parse error on input 'something'
?
Error message I got:
baby.hs:103:2: parse error on input `myList'(error in this line)
Code I am trying to compile:
myList = ["aeroplane", "Aeroplane", "AeRoPlAne", "helicopter", "HELICOPTER", "Zebra"]
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) =
let smallerSorted = quicksort [a | a <- xs, a <= x]
biggerSorted = quicksort [a | a <- xs, a > x]
in smallerSorted ++ [x] ++ biggerSorted
Edit by Optimight:
I shifted the code in the question to new .hs file and tried to compile it. Still similar error message remains. Details below:
Error
quickSort.hs:5:62: parse error on input `=' Failed, modules loaded: none. (0.02 secs, 0 bytes)Code quicksort :: (Ord a) => [a] -> [a]
quicksort [] = [] quicksort (x:xs) = let smallerSorted = quicksort [a | a <- xs, a <= x]
biggerSorted = quicksort [a | a <- xs, a > x]
in smallerSorted ++ [x] ++ biggerSorted
myList = ["aeroplane", "Aeroplane", "AeRoPlAne", "helicopter", "HELICOPTER", "Zebra", "America"]
myList
? What are the lines preceding it? – dave4420