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

Reasoning about return types?

Open cscherrer opened this issue 4 years ago • 8 comments

Hi Taine,

In one of your example, you have

@trait Addable{L, R} begin
    (+) :: [L, R] => Any
    (+) = Base.:+
end

I'd like to do something like this, but avoid the Any. I was thinking something like

@trait Addable{L, R, X} where {X = inferAddable(L,R)} begin
    (+) :: [L, R] => X
    (+) = Base.:+
end

But then I'm having trouble getting the @implement to work out. Is this currently possible?

cscherrer avatar Jan 26 '20 23:01 cscherrer