Search code examples
haskellimplementationhaskell-platform

Haskell: parse error on input '='


I keep gettin this message, what am i doing wrong?

data Pile a =  Pile [a] deriving  (Show,Eq,Ord)  

flpile:: (Eq a, Eq b, Eq c) => Pile (a,(b,c))-> Pile (a,b,c)
flpile (Pile (a,(b,c)) = Pile [asocr (a,(b,c))]

asocr :: (a,(b,c)) -> (a,b,c)
asocr (a,(b,c)) = (a,b,c)

Solution

  • in this line

    flpile (Pile (a,(b,c)) = Pile [asocr (a,(b,c))]
    

    you forgot a closing brace at ( Pile (a,(b,c)) )

    When you correct that, you'll get an error. That's because the (a,(b,c)) is not a list, as your data definition says. I don't know, what you want to achieve with your code, but you could change it to Pile [(a,(b,c))], so it will compile (if that makes any sense for your purpose).