[Haskell-beginners] Stack implementation

Imants Cekusins imantc at gmail.com
Sat Sep 10 21:47:43 UTC 2016


Hello Uneeb,

instances of class Stack are defined for *s*. empty's *return* type is *s a*


*empty* does not take any arguments. GHCi is confused about *empty*'s
*return* type.

option 1:
try adding *return* type at prompt e.g.:
empty::ListStack Int
instead of just empty


option 2:
​add *a* as Stack class parameter i.e.:
class Stack s *a* where
   ...

then if you define only 1 instance, interactive will probably assume that
you expect *empty* to return that (the only one defined) type

see if this works
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160910/239e24d4/attachment.html>


More information about the Beginners mailing list