ihp
ihp copied to clipboard
Use Enum types as route params
We need to use Text
and decode it in the action. We want to be able to define:
data PostController
= PostController { someEnumType :: !SomeEnumType}
@mpscholten Is this even possible? Not sure if we can check if our custom Enum types are an instance of Enum type class in the routing code.
I don't have any ideas how this can be implemented right now, but I assume there's a way to get this working
Maybe enumParamReader can help us here?
https://github.com/digitallyinduced/ihp/blob/a95e837e0aca4b80579a7dfeff84800ea0dc9123/IHP/Controller/Param.hs#L556-L566