module Spark.Core.Internal.AlgebraStructures where
data BinaryOpFun in1 in2 to = BinaryOpFun {
bodLift1 :: in1 -> to,
bodLift2 :: in2 -> to,
bodOp :: to -> to -> to
}
class HomoBinaryOp2 in1 in2 to | in1 in2 -> to where
_liftFun :: (to -> to -> to) -> BinaryOpFun in1 in2 to
_applyBinOp0 :: forall in1 in2 to. in1 -> in2 -> BinaryOpFun in1 in2 to -> to
_applyBinOp0 i1 i2 (BinaryOpFun l1 l2 bo) = bo (l1 i1) (l2 i2)
applyBinOp :: forall in1 in2 to. (HomoBinaryOp2 in1 in2 to) => (to -> to -> to) -> in1 -> in2 -> to
applyBinOp f i1 i2 =
_applyBinOp0 i1 i2 (_liftFun f)
(.-) :: (Num out, HomoBinaryOp2 a1 a2 out) => a1 -> a2 -> out
(.-) = applyBinOp ()
(.*) :: (Num out, HomoBinaryOp2 a1 a2 out) => a1 -> a2 -> out
(.*) = applyBinOp (*)
div' :: (Integral out, HomoBinaryOp2 a1 a2 out) => a1 -> a2 -> out
div' = applyBinOp div
(./) :: (Fractional out, HomoBinaryOp2 a1 a2 out) => a1 -> a2 -> out
(./) = applyBinOp (/)