ihp icon indicating copy to clipboard operation
ihp copied to clipboard

Use Enum types as route params

Open amitaibu opened this issue 11 months ago • 3 comments

We need to use Text and decode it in the action. We want to be able to define:

data PostController
    = PostController { someEnumType :: !SomeEnumType}

amitaibu avatar Jul 18 '23 14:07 amitaibu

@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.

s0kil avatar Jul 24 '23 02:07 s0kil

I don't have any ideas how this can be implemented right now, but I assume there's a way to get this working

mpscholten avatar Jul 24 '23 05:07 mpscholten

Maybe enumParamReader can help us here?

https://github.com/digitallyinduced/ihp/blob/a95e837e0aca4b80579a7dfeff84800ea0dc9123/IHP/Controller/Param.hs#L556-L566

amitaibu avatar Jul 24 '23 10:07 amitaibu