Solution (source code)

= Solution

Use a <sum type> whose two constructors distinguish a number from an operator:
``
data Elem = Number Int | Operator Op
``
Then the supplied `Polish` and `RPolish` aliases can both be <lists> of `Elem`. Constructor tags distinguish tokens without attempting to encode operators as special numeric values. The numeric type `Int` agrees with the supplied <abstract syntax tree>.