문제

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)
도움이 되었습니까?

해결책 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).

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top