# Is it possible to have struct to parametric with Val{}?

**URL:** <https://discourse.julialang.org/t/is-it-possible-to-have-struct-to-parametric-with-val/41707>\
**Category:** New to Julia\
**Created:** [June 19, 2020, 1:46am UTC](https://discourse.julialang.org/t/is-it-possible-to-have-struct-to-parametric-with-val/41707 "2020-06-19T01:46:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Chow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patrick_chow/32/10550_2.png) [@Patrick\_Chow](https://discourse.julialang.org/u/Patrick_Chow)\
**Post date:** [June 19, 2020, 1:46am UTC](https://discourse.julialang.org/t/is-it-possible-to-have-struct-to-parametric-with-val/41707/1 "2020-06-19T01:46:18Z")

</div>

Hi All,

I wonder if I could make a parametric type like this?

```julia
struct AAA{Val{a}} 
    aaa::Bool
end

b = AAA{Val{true}}(true)

```

I tried a few variants all doesn’t work. Perhaps I can specalized with Val{} in struct?

---

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [June 19, 2020, 2:09am UTC](https://discourse.julialang.org/t/is-it-possible-to-have-struct-to-parametric-with-val/41707/2 "2020-06-19T02:09:13Z")

</div>

Why not remove the `Val`?

```julia
struct AAA{B}
    aaa::Bool
end
b = AAA{true}(true)

```

---

<div class="post-metadata">

**Author:** ![Patrick\_Chow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patrick_chow/32/10550_2.png) [@Patrick\_Chow](https://discourse.julialang.org/u/Patrick_Chow)\
**Post date:** [June 19, 2020, 2:23am UTC](https://discourse.julialang.org/t/is-it-possible-to-have-struct-to-parametric-with-val/41707/3 "2020-06-19T02:23:07Z")

</div>

yes you are right, thanks

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [June 19, 2020, 4:25am UTC](https://discourse.julialang.org/t/is-it-possible-to-have-struct-to-parametric-with-val/41707/4 "2020-06-19T04:25:05Z")

</div>

You can also just do this if you wanted the `Val` for whatever reason:

```julia
julia> struct AAA{T}
           aaa :: Bool
       end

julia> b = AAA{Val{true}}(true)
AAA{Val{true}}(true)

```
