Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- instance Hashable LeafExpr where
- hash (Var name) = hash "Leaf-Var" + 418871 * hash name
- hash Star = hash "Leaf-Star"
- hash (Const n) = hash "Leaf-Const" + 284551 * n
- instance Hashable UnaryOp where
- hash (Neg) = hash "Unary-Neg"
- hash (BinNot) = hash "Unary-BinNot"
- instance Hashable BinaryOp where
- hash (Plus) = hash "Binary-Plus"
- hash (Minus) = hash "Binary-Minus"
- hash (Times) = hash "Binary-Times"
- hash (Div) = hash "Binary-Div"
- hash (Mod) = hash "Binary-Mod"
- instance Hashable NodeExpr where
- hash (Leaf node) = hash "Leaf" + 770291 * hash node
- hash (Unary op node) = hash "Unary" +
- 246509 * hash op +
- 845723 * hash node
- hash (Binary op node node') = hash "Binary" +
- 1265233 * hash op +
- 511013 * hash node +
- 1296781 * hash node'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement