<div dir="ltr"><div>Hi,<br></div><div>I am trying to use Quickcheck to check that pushing an element increases the size of a stack.</div><div>Something like:</div><div>prop_size2 x s = (size (Push x s)) > (size s)</div><div><br></div><div>Is this possible? Below is my effort using an empty stack.</div><div>Thanks in advance,</div><div>Pat</div><div><br></div><div><br></div><div>module Stack (empty, push, pop, top, isEmpty) where</div><div>import Test.QuickCheck</div><div><br></div><div>data Stack a = Empty | Push a (Stack a) deriving  Show</div><div><br></div><div>empty :: Stack a</div><div>empty = Empty</div><div><br></div><div>push :: a -> Stack a -> Stack a</div><div>push x ss = Push x ss</div><div> </div><div>pop :: Stack a -> Stack a</div><div>pop Empty = error "pop emptyStack"</div><div>pop (Push x ss) = ss</div><div> </div><div>top :: Stack a -> a</div><div>top Empty = error "top emptyStack"</div><div>top (Push x ss) = x</div><div><br></div><div>isEmpty :: Stack a -> Bool</div><div>isEmpty Empty = True</div><div>isEmpty (Push x ss) = False</div><div><br></div><div><br></div><div>size :: (Stack a) -> Int</div><div>size Empty = 0 </div><div>size (Push x ss) = succ (size ss) </div><div><br></div><div><br></div><div>prop_size x  = (size (Push x Empty)) > (size Empty)</div></div>

<br>
<p><span lang="EN-GB"><font size="2">This email originated from DIT. If you received this email in error, please delete it from your system. Please note that if you are not the named addressee, disclosing, copying, distributing or taking any action based on the contents of this email or attachments is prohibited. <a href="http://www.dit.ie/" target="_blank">www.dit.ie</a></font></span></p><p><font size="2">Is ó ITBÁC
a tháinig an ríomhphost seo. Má fuair tú an ríomhphost seo trí earráid, scrios
de do chóras é le do thoil. Tabhair ar aird, mura tú an seolaí ainmnithe, go
bhfuil dianchosc ar aon nochtadh, aon chóipeáil, aon dáileadh nó ar aon ghníomh
a dhéanfar bunaithe ar an ábhar atá sa ríomhphost nó sna hiatáin seo. <a href="http://www.dit.ie/" target="_blank">www.dit.ie</a></font></p><p><a href="http://www.dit.ie/grangegorman" target="_blank"><font size="2">Tá ITBÁC ag aistriú go Gráinseach Ghormáin – DIT is on the move to Grangegorman</font></a></p>