Currently, I am making program to help book appointments. Part of that includes making timeslots. In my program I have created the following instance for a selectField option in a form
instance CanSelect User where
type SelectValue User = Id User
selectValue user = get #id user
selectLabel user = get #displayName user
This is in Web/View/Timeslots/New.hs, but to limit the amount of duplication, I was advised to move this to Web/Types.hs. When I copy-paste this into Web/Types.hs, I get this error:
Web/Types.hs:17:10: error: Not in scope: type constructor or class `CanSelect' | 17 | instance CanSelect User where | ^^^^^^^^^
I have no idea how to fix this
Edit: I have fixed this by defining a class for CanSelect in the Web/Types.hs section, but have some type errors
class CanSelect model where
type SelectValue model :: Id model
selectLabel :: model -> Text
selectValue :: model -> Id model
instance CanSelect User where
type SelectValue User = Id User
selectValue user = get #id user
selectLabel user = get #displayName user
The error message reads:
- Couldn't match kind
*' with
Id' "users"' Expected kindId User', but
Id User' has kind `*'- In the type
Id User' In the type instance declaration for
SelectValue' In the instance declaration for `CanSelect User'
- In the type