# How to improve type-inference in Folds.map?

**URL:** <https://discourse.julialang.org/t/how-to-improve-type-inference-in-folds-map/82040>\
**Category:** General Usage\
**Tags:** multithreading, type-stability, folds\
**Created:** [June 1, 2022, 8:59am UTC](https://discourse.julialang.org/t/how-to-improve-type-inference-in-folds-map/82040 "2022-06-01T08:59:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [June 1, 2022, 8:59am UTC](https://discourse.julialang.org/t/how-to-improve-type-inference-in-folds-map/82040/1 "2022-06-01T08:59:33Z")

</div>

Eg

```julia
julia> @code_warntype Folds.map(1:10) do i
       i^2
       end
MethodInstance for Folds.map(::var"#3#4", ::UnitRange{Int64})
  from map(f, itr; kwargs...) in Folds.Implementations at /home/jishnu/.julia/packages/Folds/ZayPF/src/collect.jl:83
Arguments
  #self#::Core.Const(Folds.map)
  f::Core.Const(var"#3#4"())
  itr::UnitRange{Int64}
Body::Any
1 ─ %1 = Core.NamedTuple()::Core.Const(NamedTuple())
│ %2 = Base.pairs(%1)::Core.Const(Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}())
│ %3 = Folds.Implementations.:(var"#map#50")(%2, #self#, f, itr)::Any
└── return %3

```

In this case, I know the return type of the function. Is there any way to convey this information to `Folds.map` to make this operation inferrable?
