I have the following code:

```
abstract type TypedFun end
abstract type ReturnFun{R} <: TypedFun end
abstract type NoArgFun{R} <: ReturnFun{R} end
abstract type FullFun{Tuple,R} <: ReturnFun{R} end
#single argument function
struct SAFun{T,R} <: FullFun{Tuple{T},R}
fn::Function
end
(⇒)(::Type{T}, ::Type{R}) where {T,R} = SAFun{T, R}
(⇒)(::Nothing, ::Type{R}) where {R} = NoArgFun{R}
struct MM{T}
x::T
end
f(fun::(Any ⇒ MM{T})) where T = fun(3)
```

the function f definition gives the following error

ERROR: UndefVarError: R not defined

However this doesn’t give the same error:

```
f(fun::(Any ⇒ MM)) = fun(3)
```

Why is this happening…

Thanks, and how can I fix it?