let value_type = function
        | RIntegerValue(_) -> IntegerType
        | RFloatValue(_) -> FloatType
        | RBooleanValue(_) -> BooleanType
        | RStringValue(_) -> StringType
        | RFunctionValue(_, _, _, _, _, _, _) -> FunctionType
        | RLibraryFunction(_) -> LibraryCallType
        | RMapValue(_, MapSubtype-> MapType
        | RMapValue(_, ArraySubtype _) -> ArrayType
        | RVoid -> VoidType
        | RUndefined -> UndefinedType