# Talk:Haskell Quiz/Bytecode Compiler/Solution Justin Bailey

From HaskellWiki

```
eval (Statement op left right)
| op == Mult = eval left * eval right
| op == Minus = eval left - eval right
| op == Plus = eval left + eval right
| op == Div = eval left `div` eval right
| op == Pow = eval left ^ eval right
| op == Mod = eval left `mod` eval right
<haskell>
Maybe better written as:
<haskell>
eval (Statement op left right) = eval left `f` eval right
where f Mult = (*)
f Minus = (-)
f Plus = (+)
f Div = div
f Pow = (^)
f Mod = mod
<haskell>
```