primitive1 :: (b -> GMState -> GMState) -- boxing function
                -> (Addr -> GMState -> a) -- unboxing function
                -> (a -> b) -- operator
                -> (GMState -> GMState) -- state transition
primitive1 box unbox op state
    = box (op (unbox a state)) (putStack as state)
    where 
        (a:as) = getStack state
primitive1 :: (b -> GMState -> GMState) -- boxing function
                -> (Addr -> GMState -> a) -- unboxing function
                -> (a -> b) -- operator
                -> (GMState -> GMState)
primitive1 box unbox op state
    = box (op (unbox a state)) (putStack as state)
    where 
        (a:as) = getStack state
primitive1 box unbox op state
    = box (op (unbox a state)) (putStack as state)
    where 
        (a:as) = getStack state