// Path: app/src/main/java/com/annimon/hotarufx/exceptions/TypeException.java
// public class TypeException extends HotaruRuntimeException {
// 
//     public TypeException(String message) {
//         super(message);
//     }
// 
//     public TypeException(String message, SourcePosition start, SourcePosition end) {
//         super(message, start, end);
//     }
// }


import com.annimon.hotarufx.exceptions.TypeException;
import java.util.Objects;
package com.annimon.hotarufx.lib;


public class FunctionValue implements Value {

    public static final FunctionValue EMPTY = new FunctionValue(args -> NumberValue.ZERO);

    private final Function value;

    public FunctionValue(Function value) {
        this.value = value;
    }

    public Function getValue() {
        return value;
    }

    @Override
    public int type() {
        return Types.FUNCTION;
    }

    @Override
    public Object raw() {
        return value;
    }

    @Override
    public Number asNumber() {
// Path: app/src/main/java/com/annimon/hotarufx/exceptions/TypeException.java
// public class TypeException extends HotaruRuntimeException {
// 
//     public TypeException(String message) {
//         super(message);
//     }
// 
//     public TypeException(String message, SourcePosition start, SourcePosition end) {
//         super(message, start, end);
//     }
// }


// Path: app/src/main/java/com/annimon/hotarufx/lib/FunctionValue.java
import com.annimon.hotarufx.exceptions.TypeException;
import java.util.Objects;

package com.annimon.hotarufx.lib;


public class FunctionValue implements Value {

    public static final FunctionValue EMPTY = new FunctionValue(args -> NumberValue.ZERO);

    private final Function value;

    public FunctionValue(Function value) {
        this.value = value;
    }

    public Function getValue() {
        return value;
    }

    @Override
    public int type() {
        return Types.FUNCTION;
    }

    @Override
    public Object raw() {
        return value;
    }

    @Override
    public Number asNumber() {
        throw new TypeException("Cannot cast function to number");