Closed
Description
e.g. @jakobnissen was discussing on #helpdesk how to implement types for regex, and wrote the Rust version would look like
enum Re{
Empty,
Class(u8),
Rep(Box<Re>),
Alt(Box<Re>, Box<Re>),
Cat(Box<Re>, Box<Re>),
Diff(Box<Re>, Box<Re>),
And(Box<Re>, Box<Re>),
}
I wanted to try with SumTypes, but ran into the fact that you can't have recursive definitions:
julia> using SumTypes
julia> @sum_type Re begin
Empty()
Class(::UInt8)
Rep(::Re)
Alt(::Re, ::Re)
Cat(::Re, ::Re)
Diff(::Re, ::Re)
And(::Re, ::Re)
end
ERROR: UndefVarError: Re not defined
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/SumTypes/OTmhF/src/SumTypes.jl:92
[2] top-level scope
@ REPL[3]:1
Metadata
Metadata
Assignees
Labels
No labels