Question

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)
Was it helpful?

Solution 2

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).

OTHER TIPS

You have a mismatched parenthesis:

flpile (Pile (a,(b,c))) = ...
                      ^ this was missing

To avoid this problem in the future, I recommmend enabling the "highlight matching brackets" option in your editor, if there is one. If not, get a better editor.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top