On Tue, 1 Mar 2016 16:27:41 -0800
Bryan Richter <[email protected]> wrote:

> ** Tech action items
> 
> - UserHandle should be redefined to Text
> - The existing route should be renamed getUserByIdR and should use
>   UserId instead of UserHandle
> - The new route should get the original name UserR

One thing I noticed when I started working on the code is that UserHandle is
confusing. I checked what that type is used for. And it's used exactly for one
thing: The type of the path piece in the routes file. Since the auth ID is
still the user ID (as it should be), I think UserHandle is just confusing and
we can safely remove that type.

Instead we can use Text directly.

Since changing from UserId to Text in the /u/<user> route also requires changes
in handlers and the DB queries they run, moving between types back and forth
isn't trivial anyway, I don't see a particular reason to use a type alias if we
do use plain Text for other things in the code. If you want to define a newtype
that wraps Text, that's a different story and a separate discussion.

For now I'm leaving UserHandle as-is in the code, waiting for your thoughts.
It's not a critical thing, just wanted to share what I feel about it (but as a
beginner Yesod user I may be wrong).

--fr33
_______________________________________________
Dev mailing list
[email protected]
https://lists.snowdrift.coop/mailman/listinfo/dev

Reply via email to