Skip to content

Commit

Permalink
Use type-level version of InType(::TypedTransducer)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Jan 18, 2019
1 parent 5ae826a commit 867bbc7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ TypedTransducer{intype}(xform::X) where {intype, X} =

Setfield.constructor_of(::Type{T}) where {T <: TypedTransducer} = T

InType(::TypedTransducer{intype}) where intype = intype
InType(::Type{<:TypedTransducer{intype}}) where intype = intype

# In clojure a reduction function is one of signature
# whatever, input -> whatever
Expand All @@ -101,8 +101,8 @@ struct Reduction{intype, T, F}
bottom::F
end

Reduction(xforms, bottom) =
Reduction{InType(xforms[1]), typeof(xforms), typeof(bottom)}(xforms, bottom)
@inline Reduction(xforms::T, bottom::F) where {X, T <: Tuple{X,Vararg}, F} =
Reduction{InType(X), T, F}(xforms, bottom)

InType(::T) where T = InType(T)
InType(::Type{<:Reduction{intype}}) where {intype} = intype
Expand Down

0 comments on commit 867bbc7

Please sign in to comment.