SumTypes.jl icon indicating copy to clipboard operation
SumTypes.jl copied to clipboard

An implementation of Sum types in Julia

Results 10 SumTypes.jl issues
Sort by recently updated
recently updated
newest added

e.g. this ```julia julia> using SumTypes julia> @sum_type A{X

I noticed this when developing https://github.com/JuliaDynamics/MixedStructTypes.jl e.g. ```julia using MixedStructTypes @sum_struct_type @kwdef A{X,Y} begin mutable struct B{X} a::Tuple{X, X} = (1,1) b::Tuple{Float64, Float64} = (1.0, 1.0) const c::Symbol = :s...

`@sum_type` is exported but has no docstring: ```jl help?> @sum_type No documentation found. ```

e.g. I imagine a syntax like ```julia @sum_type @kwdef AT begin A(common_field::Int = 3, a::Bool = true, b::Int) B(common_field::Int = 1, a::Int, b::Float64 = 4.0, d::Complex) end ``` and so...

I'm trying to use SumTypes to replicate Rust `Result` type, and I expected the `Result` type to be able to carry all types. Here's the example code: ``` using SumTypes...

```jl @cases (ox, oy) begin (Some(x), Some(y)) => x + y ... end ``` This would be useful.

I came here to ask if it would be possible to add names to the fields of sum types, but then, I noticed in #30 that it appears you've already...

As seen in discussions on slack and discourse: I want to be able to do: ``` for g in list_of_different_types_of_gates: apply!(state, g) end ``` without dynamic dispatch or allocations. `apply!`...

When defining sum types inside modules, arguably it would be desirable to be able to use the module prefix in order to make it clear where they are coming from....

Hi @MasonProtter, I remember that you pushed for a name like this in the past :-) [LightSumTypes.jl](https://github.com/JuliaDynamics/LightSumTypes.jl) is still named the same, but I created a new package (https://github.com/Tortar/WrappedUnions.jl) which...