thautwarm/CanonicalTraits.jl

flexible instances and flexible classes

Closed this issue · 0 comments

@trait Add1{T} begin
   add1 :: [T] => T
end
@trait Add1{T} >: Addn{T} begin
           addn :: [Int, T] => T
           addn(n, x) = let s = x; for i in 1:n; s = add1(x) end; s; end
 end
@implement Add1{T} >: Add1{Vector{T}} where T begin
     add1(xs) = add1.(xs)
end