[web-devel] web-routes-quasi gotcha

Michael Snoyman michael at snoyman.com
Fri Jan 21 10:16:29 CET 2011


Well, I wasn't able to reproduce the error message with the code
below. However, the error message you're getting is from GHC, not
web-routes-quasi. AFAICT, web-routes-quasi is generated the correct TH
code, and GHC is mis-diagnosing it as overlapping patterns. I think I
have had that problem before.

If you send me a test case, I can see if there is something wrong with
what web-routes-quasi is doing.

{-# LANGUAGE QuasiQuotes, TypeFamilies #-}
import Yesod.Dispatch
import Yesod.Core

data Overlap = Overlap

mkYesod "Overlap" [$parseRoutes|
/con/f Route1
/con/h Route2
/con/m/list Route3
/con/m/c Route4
|]

handleRoute1 = return ()
handleRoute2 = return ()
handleRoute3 = return ()
handleRoute4 = return ()


On Thu, Jan 20, 2011 at 7:12 PM, Nubis <nubis at woobiz.com.ar> wrote:
> Hi guys,
> I was just investigating an issue in my yesod app that prevented me from
> running the devel-server.
> It was a warning about route patterns overlapping
>
> S4M/Server/Controller.hs:33:0:
>     Warning: Pattern match(es) are overlapped
>              In the definition of `parse[awnQ]':
>                  parse[awnQ] : "con" : "f" [] = ...
>                  parse[awnQ] : "con" : "h" [] = ...
>                  parse[awnQ] : "con" : "m" : "list" [] = ...
>                  parse[awnQ] : "con" : "m" : "c" [] = ...
>
>
> The issue seems to come up when part of the route is a single character (in
> this case, f, h and m)
> like
> /con/f/
> /con/h/
> /con/m/list/
>
> I ended up just changing my routes to be more 'expressive' which is fine by
> me.
>
> Haven't looked at the source of the issue yet, I can reproduce it on 0.6.2
> but haven't tried 0.6.3 so I apologize in advance if it is already fixed :)
>
> Just wanted to get it out here so I don't forget to look into it later (I'm
> heading home now)
>
> Cheers!
> ----nubis :)
>
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel
>
>



More information about the web-devel mailing list