<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt"><div>Hello,</div><div>I have this stack data structure : <br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><span>data Stack = Empty | Element Char Stack deriving Show</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><span>I want to check if it is equal to "Empty"</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;">When I try something like this : <br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier
New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;">"a = Empty" or "a = (Empty)" in a haskell file and then write this on ghci : "a = Empty"</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;">I get this : <br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;"><interactive>:1:0:<br> No instance for (Eq Stack)<br> arising from a use of `==' at <interactive>:1:0-11<br> Possible fix: add an instance declaration for (Eq Stack)<br> In the expression: a == (Empty)<br> In the definition of `it': it = a == (Empty)<br>I don't know how to fix this. Can you help me so that I can
check if a stack is Empty without getting this error? <br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: Courier New,courier,monaco,monospace,sans-serif; background-color: transparent; font-style: normal;">Thank you.<br><br><span></span></div></div></body></html>