Skip to content

Template Haskell support for generating the constructor routers #2

MedeaMelana opened this Issue Nov 23, 2010 · 1 comment

1 participant


Currently the constructor routers need to be written by hand. For example:

data Sitemap
  = Home
  | Echo String

home :: Router r (Sitemap :- r)
home = constr0 Home (\m -> do Home <- m; return ())

echo :: Router (String :- r) (Sitemap :- r)
echo = constr1 Echo (\m -> do Echo s <- m; return s)

This needs to be generated by Template Haskell so that for users this is replaced by:

$(routeConstructors ''Sitemap)

This has been fixed!

There is even a solution in terms of the generic programming package "regular".

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.