core-typed

2024-03-27T18:34:59.421029Z

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")))

2024-03-27T18:53:29.241529Z

Should be able to quote the string value for a singleton type.

2024-03-27T18:54:32.704019Z

But that does the same thing as t/Val

2024-03-27T18:54:41.302949Z

what's the issue?

2024-03-27T19:03:47.353859Z

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

2024-03-27T19:04:16.303849Z

Using a Role type as shown above nested in a HMap as a value for a :role key

2024-03-28T01:59:07.897119Z

I will add a case for it.

2024-03-28T02:47:02.338869Z

t/Str works for me, could not reproduce?

2024-03-29T15:00:41.430979Z

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?

2024-03-29T16:33:52.277809Z

Oh, no I meant just (t/defalias Role t/Str) .

2024-03-29T16:34:14.055959Z

(t/Val "role1") should work now.

2024-03-29T16:34:38.049569Z

Ah ok let me try

2024-03-29T16:41:04.248559Z

Works perfectly now thanks!

🎉 1
2024-03-29T00:45:02.214779Z

Ok cool I’ll try it again