Whats the best way to define an enum? I was trying something like this but I don't think you can use t/Val like this. I also tried t/Str but that doesn't seem to work either.
(t/defalias Role (t/U (t/Val "role1")
(t/Val "role2")
(t/Val "role3")
(t/Val "role4")))Should be able to quote the string value for a singleton type.
But that does the same thing as t/Val
what's the issue?
I'm using the pred function on a HMap type that has a Role as one of the values and it is saying it cannot generate predicate for value type: role1
Using a Role type as shown above nested in a HMap as a value for a :role key
I will add a case for it.
https://github.com/typedclojure/typedclojure/commit/ee089e1c738ed46af64f06147c8f20ee084bd391
t/Str works for me, could not reproduce?
Were you able to do it like this?
(t/defalias Role (t/U (t/Str "role1")
(t/Str "role2")
(t/Str "role3")
(t/Str "role4")))
If not what did you mean when you said t/Str works for you?Oh, no I meant just (t/defalias Role t/Str) .
(t/Val "role1") should work now.
Ah ok let me try
Works perfectly now thanks!
Ok cool I’ll try it again