push :: a -> Stack a -> Stack a
push a stack = MkStack a stack
pop :: Stack a -> Stack a
pop Null = Null
pop (MkStack a stacks) = stacks
instance Eq (Stack a) where
Null == Null = True
Null == (MkStack _1 _2) = False
(MkStack _1 _2) == Null = False
(MkStack x xs) == (MkStack y ys) = (x == y) && (xs == ys)
gives me
\home\anus\haskal\peyote-joints.hs:14:38:
Could not deduce (Eq a) from the context (Eq (Stack a))
arising from a use of `==' at C:\stack.hs:14:38-43
Possible fix: add (Eq a) to the context of the instance declaration
In the first argument of `(&&)', namely `(x == y)'
In the expression: (x == y) && (xs == ys)
In the definition of `==':
(MkStack x xs) == (MkStack y ys) = (x == y) && (xs == ys)
I don't see any other opportunity to "clear it up" using extra annotations or whatnot, so...
Name:
Anonymous2010-02-28 4:33
GHC uses faggot quotes, I see
Name:
Anonymous2010-02-28 4:50
>>1
I have no idea what you are trying to do, but try deriving Eq in Stack.
Name:
Anonymous2010-02-28 4:56
Deriving's no fun when you're trying to learn.
Name:
Anonymous2010-02-28 5:12
instance (Eq a) => (Eq (Stack a)) where
You need the as to be an instance of Eq themselves.
Riddle this!
sumstack :: (Num a) => Stack a -> a
sumstack Null = 0
sumstack (MkStack x xs) = x + (sumstack xs)
to
peyote-joints.hs:1:25:
`Stack' is not applied to enough type arguments
Expected kind `?', but `Stack' has kind `* -> *'
In the data type declaration for `Stack'
Failed, modules loaded: none.
Name:
Anonymous2010-02-28 6:54
M y a n u s f e e l s k i n d o f h a x e d n o w :(
______
If you believe in Anus Haxing and are 100% proud of it put this as your signature.
Name:
Anonymous2010-02-28 11:11
>>11
Youshouldfeelkindofbadaboutthat Also, I wish you get mechanically de-boned.
Name:
Anonymous2010-02-28 11:23
>>10
Is that really what Haskel debugging looks like?
Name:
Anonymous2010-02-28 11:30
>>13
There is no such thing as live debugging in Haskell
Name:
Anonymous2010-02-28 11:39
>>10
It works for me. Apparently your type constructor is fucked. Poast the whole file.
>>23
Scratch that, it's throwing a
ERROR file:peyote-joints.hs:22 - Syntax error in instance declaration (unexpected `(')
error. I love you too, hugs.
Name:
Anonymous2010-02-28 16:08
ghc -V
Name:
Anonymous2010-02-28 23:10
6-10-4.
Name:
Anonymous2010-02-28 23:12
>>26
I'm currently using the Platform, by the way.
Name:
Need advice!2010-03-01 15:21
I just finished HS last year with top grades. I didn't enter University/College.
I'm hoping of getting a coding job somewhere. Something with OOp/Functional programming. I have the knowledge but and the skill but not the experience. I want to avoid 4 years of University/College if possible. Also I mostly self teach so any courses are just for the certifications.