.

1
2
3
4
5
6
7
8
9
import Data.Complex

data SchemeNumber = Integer Int
                  | Real Double
                  | Complex Double

schemeBinaryOp :: (a -> a -> a) -> (SchemeNumber -> SchemeNumber -> SchemeNumber)
schemeBinaryOp op = go
    where go (Integer x) (Integer y) = Integer $ x `op` y