Improve type system
This commit is contained in:
26
core/values.go
Normal file
26
core/values.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package elm
|
||||
|
||||
import (
|
||||
"golang.org/x/exp/constraints"
|
||||
)
|
||||
|
||||
type INumber interface {
|
||||
constraints.Float | constraints.Integer
|
||||
}
|
||||
|
||||
type ElmValueType int32
|
||||
|
||||
const (
|
||||
NULLPTR ElmValueType = 0
|
||||
NUMBER ElmValueType = 1
|
||||
)
|
||||
|
||||
type ElmValue struct {
|
||||
Type ElmValueType
|
||||
Number int64
|
||||
Null int64
|
||||
}
|
||||
|
||||
func Number(val int64) ElmValue {
|
||||
return ElmValue{Type: NUMBER, Number: val }
|
||||
}
|
||||
Reference in New Issue
Block a user