{-# LANGUAGE OverloadedStrings #-} module Funcons.Core.Values.Primitive.IntegersBuiltin where import Funcons.EDSL hiding (integers_) import qualified Funcons.Operations as VAL import Funcons.Core.Values.Primitive.BoolBuiltin library :: FunconLibrary library = [(Name, EvalFunction)] -> FunconLibrary libFromList [ (Name "integer-add", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_add_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_add_) , (Name "int-add", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_add_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_add_) , (Name "int-mul", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_multiply_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_multiply_) , (Name "integer-multiply", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_multiply_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_multiply_) , (Name "integer-divide", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_divide_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_divide_) , (Name "int-div", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_divide_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_divide_) , (Name "integer-subtract", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_subtract_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_subtract_) , (Name "integer-sub", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_subtract_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_subtract_) , (Name "integer-power", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_power_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_power_) , (Name "int-pow", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_power_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_power_) , (Name "integer-list", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_list_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_list_) , (Name "integer-modulo", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_modulo_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_modulo_) , (Name "int-mod", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_modulo_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_modulo_) , (Name "integer-absolute-value", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_absolute_value_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_absolute_value_) , (Name "integer-abs", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integer_absolute_value_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integer_absolute_value_) , (Name "decimal-natural", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons decimal_natural_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.decimal_natural_) , (Name "decimal", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons decimal_natural_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.decimal_natural_) , (Name "hexadecimal-natural", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons hexadecimal_natural_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.hexadecimal_natural_) , (Name "hexadecimal", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons hexadecimal_natural_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.hexadecimal_natural_) , (Name "octal-natural", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons octal_natural_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.octal_natural_) , (Name "octal", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons octal_natural_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.octal_natural_) , (Name "binary-natural", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons binary_natural_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.binary_natural_) , (Name "binary", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons binary_natural_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.binary_natural_) , (Name "natural-predecessor", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons natural_predecessor_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.natural_predecessor_) , (Name "nat-pred", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons natural_predecessor_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.natural_predecessor_) , (Name "natural-successor", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons natural_successor_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.natural_successor_) , (Name "nat-succ", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons natural_successor_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.natural_successor_) , (Name "integer-is-less", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons is_less_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.is_less_) , (Name "is-less", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons is_less_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.is_less_) , (Name "integer-is-greater", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons is_greater_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.is_greater_) , (Name "is-greater", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons is_greater_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.is_greater_) , (Name "integer-is-greater-or-equal", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons is_greater_or_equal_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.is_greater_or_equal_) , (Name "is-greater-or-equal", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons is_greater_or_equal_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.is_greater_or_equal_) , (Name "integer-is-less-or-equal", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons is_less_or_equal_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.is_less_or_equal_) , (Name "is-less-or-equal", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons is_less_or_equal_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.is_less_or_equal_) , (Name "integers", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromNullaryValOp [Funcons] -> Funcons integers_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integers_) , (Name "ints", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromNullaryValOp [Funcons] -> Funcons integers_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integers_) , (Name "integers-from", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integers_from_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integers_from_) , (Name "from", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integers_from_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integers_from_) , (Name "integers-up-to", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integers_up_to_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integers_up_to_) , (Name "up-to", ([Funcons] -> Funcons) -> ([OpExpr Funcons] -> OpExpr Funcons) -> EvalFunction fromValOp [Funcons] -> Funcons integers_up_to_ [OpExpr Funcons] -> OpExpr Funcons forall t. HasValues t => [OpExpr t] -> OpExpr t VAL.integers_up_to_) ] ints_ :: [Funcons] -> Funcons ints_ = [Funcons] -> Funcons integers_ integers_ :: [Funcons] -> Funcons integers_ = Name -> [Funcons] -> Funcons applyFuncon Name "integers" integers_from_ :: [Funcons] -> Funcons integers_from_ = Name -> [Funcons] -> Funcons applyFuncon Name "integers-from" from_ :: [Funcons] -> Funcons from_ = Name -> [Funcons] -> Funcons applyFuncon Name "from" integers_up_to_ :: [Funcons] -> Funcons integers_up_to_ = Name -> [Funcons] -> Funcons applyFuncon Name "integers-up-to" up_to_ :: [Funcons] -> Funcons up_to_ = Name -> [Funcons] -> Funcons applyFuncon Name "up-to" natural_predecessor_, nat_pred_ :: [Funcons] -> Funcons natural_predecessor_ :: [Funcons] -> Funcons natural_predecessor_ = Name -> [Funcons] -> Funcons applyFuncon Name "natural-predecessor" nat_pred_ :: [Funcons] -> Funcons nat_pred_ = Name -> [Funcons] -> Funcons applyFuncon Name "nat-pred" natural_successor_, nat_succ_ :: [Funcons] -> Funcons natural_successor_ :: [Funcons] -> Funcons natural_successor_ = Name -> [Funcons] -> Funcons applyFuncon Name "natural-successor" nat_succ_ :: [Funcons] -> Funcons nat_succ_ = Name -> [Funcons] -> Funcons applyFuncon Name "nat-succ" int_add_ :: [Funcons] -> Funcons int_add_ = Name -> [Funcons] -> Funcons FApp Name "integer-add" integer_add_ :: [Funcons] -> Funcons integer_add_ = Name -> [Funcons] -> Funcons FApp Name "integer-add" integer_multiply_ :: [Funcons] -> Funcons integer_multiply_ = Name -> [Funcons] -> Funcons FApp Name "integer-multiply" integer_divide_ :: [Funcons] -> Funcons integer_divide_ = Name -> [Funcons] -> Funcons FApp Name "integer-divide" integer_subtract_ :: [Funcons] -> Funcons integer_subtract_ = Name -> [Funcons] -> Funcons applyFuncon Name "integer-subtract" integer_power_ :: [Funcons] -> Funcons integer_power_ = Name -> [Funcons] -> Funcons applyFuncon Name "integer-power" integer_power_op :: [Values] -> Rewrite a integer_power_op [Values] vx = Funcons -> String -> Rewrite a forall a. Funcons -> String -> Rewrite a sortErr (Name -> [Funcons] -> Funcons applyFuncon Name "integer-power" ([Values] -> [Funcons] fvalues [Values] vx)) String "integer-power not applied to two integers" integer_list_ :: [Funcons] -> Funcons integer_list_ = Name -> [Funcons] -> Funcons applyFuncon Name "integer-list" integer_modulo_ :: [Funcons] -> Funcons integer_modulo_ = Name -> [Funcons] -> Funcons applyFuncon Name "integer-modulo" int_mod_ :: [Funcons] -> Funcons int_mod_ = Name -> [Funcons] -> Funcons applyFuncon Name "int-mod" integer_mod_ :: [Funcons] -> Funcons integer_mod_ = Name -> [Funcons] -> Funcons applyFuncon Name "integer-modulo" integer_absolute_value_ :: [Funcons] -> Funcons integer_absolute_value_ = Name -> [Funcons] -> Funcons applyFuncon Name "integer-absolute-value" decimal_natural_ :: [Funcons] -> Funcons decimal_natural_ = Name -> [Funcons] -> Funcons FApp Name "decimal-natural" decimal_ :: [Funcons] -> Funcons decimal_ = Name -> [Funcons] -> Funcons FApp Name "decimal" octal_natural_ :: [Funcons] -> Funcons octal_natural_ = Name -> [Funcons] -> Funcons FApp Name "octal-natural" octal_ :: [Funcons] -> Funcons octal_ = Name -> [Funcons] -> Funcons FApp Name "octal" binary_natural_ :: [Funcons] -> Funcons binary_natural_ = Name -> [Funcons] -> Funcons FApp Name "binary-natural" binary_ :: [Funcons] -> Funcons binary_ = Name -> [Funcons] -> Funcons FApp Name "binary" hexadecimal_natural_ :: [Funcons] -> Funcons hexadecimal_natural_ = Name -> [Funcons] -> Funcons FApp Name "hexadecimal-natural" hexadecimal_ :: [Funcons] -> Funcons hexadecimal_ = Name -> [Funcons] -> Funcons FApp Name "hexadecimal" is_less_ :: [Funcons] -> Funcons is_less_ = Name -> [Funcons] -> Funcons applyFuncon Name "is-less" integer_is_less_ :: [Funcons] -> Funcons integer_is_less_ = Name -> [Funcons] -> Funcons applyFuncon Name "is-less" is_less_or_equal_ :: [Funcons] -> Funcons is_less_or_equal_ = Name -> [Funcons] -> Funcons FApp Name "is-less-or-equal" integer_is_less_or_equal_ :: [Funcons] -> Funcons integer_is_less_or_equal_ = Name -> [Funcons] -> Funcons FApp Name "is-less-or-equal" is_greater_ :: [Funcons] -> Funcons is_greater_ = Name -> [Funcons] -> Funcons FApp Name "is-greater" integer_is_greater_ :: [Funcons] -> Funcons integer_is_greater_ = Name -> [Funcons] -> Funcons FApp Name "is-greater" is_greater_or_equal_ :: [Funcons] -> Funcons is_greater_or_equal_ = Name -> [Funcons] -> Funcons FApp Name "is-greater-or-equal" integer_is_greater_or_equal_ :: [Funcons] -> Funcons integer_is_greater_or_equal_ = Name -> [Funcons] -> Funcons FApp Name "is-greater-or-equal"