# How to distinguish between UnionAll and DataType of the same type?

**URL:** <https://discourse.julialang.org/t/how-to-distinguish-between-unionall-and-datatype-of-the-same-type/31165>\
**Category:** General Usage\
**Created:** [November 17, 2019, 6:10am UTC](https://discourse.julialang.org/t/how-to-distinguish-between-unionall-and-datatype-of-the-same-type/31165 "2019-11-17T06:10:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [November 17, 2019, 6:10am UTC](https://discourse.julialang.org/t/how-to-distinguish-between-unionall-and-datatype-of-the-same-type/31165/1 "2019-11-17T06:10:41Z")

</div>

Hi,  
let’s assume that I have a struct like

```nohighlight
julia> struct MM{T}
           x::T
       end

julia> const TypeGen{T} = MM{M} where M<:T
MM{M} where M<:T where T

julia> TypeGen{Int}
MM{M} where M<:Int64

julia> f(::Type{T}) where T<:MM = :A
f (generic function with 1 method)

julia> f(TypeGen{Int})
:A

julia> f(MM{Int})
:A

julia> typeof(MM{Int})
DataType

julia> typeof(TypeGen{Int})
UnionAll

```

is there a way to come up with a function signature for multi dispatch that differentiates between two types shown above?

Thanks

---

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [November 17, 2019, 6:49am UTC](https://discourse.julialang.org/t/how-to-distinguish-between-unionall-and-datatype-of-the-same-type/31165/2 "2019-11-17T06:49:05Z")

</div>

Solved  
f(::Type{M{T}}) where T = :B
