I have this custom types
data Stack a = Empty | a :<| (Stack a)
deriving (Show, Read, Eq)
type Value = Int
type ComputerStack = Stack.Stack (Either Address Value)
And when i want to do something like this
push :: a -> Stack a -> Stack a
push a b = a :<| b
runS :: Value -> ComputerStack -> Seq.Seq Value
runS value stack
| value == 0 = stack
| otherwise = runS 0 (Stack.push value stack)
I get this
* Couldn't match type `Int' with `Either Address Value'
Expected type: ComputerStack
Actual type: Stack.Stack Value
* In the second argument of `runS', namely
`(Stack.push value stack)'
In the expression: runS 0 (Stack.push value stack)
In an equation for `runS':
runS value stack
| value == 0 = stack
| otherwise = runS 0 (Stack.push value stack)
|
37 | | otherwise = runS 0 (Stack.push value stack)
My question is, why this is an error since computer stack can be Stack.Stack Value