I'm too Elm pilled or something, here's what I'm trying todo:
One file (Tensor) looks like:
module [
Number,
Expression,
]
import Math
# In order to control the precision of our calculations,
# I'm pinning our underlying data type here
Number: F64
Expression a: [
Value(Number, a),
Add(Expression a, Expression a, a),
Mul(Expression a, Expression a, a),
Div(Expression a, Expression a, a),
Pow(Expression a, Number, a), # For now, limit the power to a constant
Tanh(Expression a, a),
# Tensor([Expression a], a)
]
and in Neron.roc, I want effectively:
module [
Neuron
]
import Tensor
Neuron a : {
weights: List (Value(Number, a)),
bias: a
}
but the compiler doesn't like Value
appearing here (Value being a variant in Expression a
in the first file). Now, in Elm I'd "crack open" the union - but AFAICT, not an option here- what is the proposed pattern?
Note: I find the compiler error messages around mis-matched tag usage very unwieldy, so my preference is to carefully pin stuff down apriori as much as I can
Any advice appreciated
Value is supposed to be a tag?
Oh, I think you want that to be expression
Cause expression is the type
Value isn't a type
It's a specific tag
doh :man_facepalming: yes- you're right.
In this case, I _only_ want Value here (For now)
So I can pull Value out of expression- how can I create a shared 'tag' so to speak, or do I just do Value a: (Number, a)
first, and then inside Expression ValueCon(Value a)
?
That would work
gracias, señor, ty for catching my stupid oversight :pray:
Aaron White has marked this topic as resolved.
Last updated: Jul 06 2025 at 12:14 UTC