@bherd-rb Some tradable resources have quantities that are naturally discrete whilst other tradable resources have quantities that are natural continuous. I have been trying to come up with a solution to get this information into the type system. Getting this information into the type system is useful because it would allow us to restrict that types of orders that a particular auction can accept. For example, we might want to force market participants to only submit orders for discrete quantities (or continuous quantities).
I think that the Wurman et al (2001) paper provides a solution. Suppose that we have a trait Quantity that extends AnyVal and is parameterized on the type of value it contains. Then we can define two case classes for DiscreteQuantity and ContinuousQuantity as follows.
sealed trait Quantity[+T <: AnyVal] extends AnyVal {
def value: T
}
case class DiscreteQuantity(value: Long) extends Quantity[Long]
case class ContinuousQuantity(value: Double) extends Quantity[Double]
Thoughts?
@bherd-rb Some tradable resources have quantities that are naturally discrete whilst other tradable resources have quantities that are natural continuous. I have been trying to come up with a solution to get this information into the type system. Getting this information into the type system is useful because it would allow us to restrict that types of orders that a particular auction can accept. For example, we might want to force market participants to only submit orders for discrete quantities (or continuous quantities).
I think that the Wurman et al (2001) paper provides a solution. Suppose that we have a trait
Quantitythat extendsAnyValand is parameterized on the type of value it contains. Then we can define two case classes forDiscreteQuantityandContinuousQuantityas follows.Thoughts?