-- XXX: Only integers and booleans, OK?
binOpScalExp :: BinOp -> Maybe (ScalExp -> ScalExp -> ScalExp)
binOpScalExp bop = fmap snd . find ((==bop) . fst) $
                   concatMap intOps allIntTypes ++
                   [ (LogAnd, SLogAnd), (LogOr, SLogOr) ]
  where intOps t = [ (Add t, SPlus)
                   , (Sub t, SMinus)
                   , (Mul t, STimes)
                   , (AST.SDiv t, SDiv)
                   , (AST.Pow t, SPow)
                   ]
binOpScalExp :: BinOp -> Maybe (ScalExp -> ScalExp -> ScalExp)
binOpScalExp bop = fmap snd . find ((==bop) . fst) $
                   concatMap intOps allIntTypes ++
                   [ (LogAnd, SLogAnd), (LogOr, SLogOr) ]
  where intOps t = [ (Add t, SPlus)
                   , (Sub t, SMinus)
                   , (Mul t, STimes)
                   , (AST.SDiv t, SDiv)
                   , (AST.Pow t, SPow)
                   ]
binOpScalExp bop = fmap snd . find ((==bop) . fst) $
                   concatMap intOps allIntTypes ++
                   [ (LogAnd, SLogAnd), (LogOr, SLogOr) ]
  where intOps t = [ (Add t, SPlus)
                   , (Sub t, SMinus)
                   , (Mul t, STimes)
                   , (AST.SDiv t, SDiv)
                   , (AST.Pow t, SPow)
                   ]