Oh, and by the way functions specialized on values can be emulated, e.g.

type plusN{N}
    plusN(x) = x+N
end
plus{10}(1)

And writing a constrained function can be slightly simpler than in my
previous post:

# constrained function:
f{F<:BinaryFunctor}(::Type{F}, x) = F(x, x)
f(plus, 1)

Or, as a functor:

type f{F<:BinaryFunctor}
    f(x) = F(x, x)
end
f{plus}(1)

 I just hope that someone can assert this is a safe abuse of constructors.

Reply via email to