[Ur] Looking for an example of a common pattern
Adam Chlipala
adamc at csail.mit.edu
Sat Apr 20 08:25:21 EDT 2013
On 04/19/2013 10:25 PM, David Snider wrote:
> There is a common pattern in web development of redirecting a user to
> a login page when their login cookie can not be found. If the login is
> invalid it regenerates the page with an error message, otherwise it
> generates the requested page. Could someone show me an example of how
> to use a functor to generate this functionality for any page?
It's not obvious that there's any particular reason to use a functor here.
> I tried this myself and ran into issues like having the Login and
> HomePage module be mutually dependent on each other. I am not sure
> what the correct way to do this is.
For mutual recursion across modules, I use URLs built by reference to
string paths directly. It forfeits some of the nice static guarantees
of Ur/Web, but it's not obvious to me what the right alternate language
feature would be.
More information about the Ur
mailing list