haskell - how to break up the monolithic mkYesod block safely -


this question more understanding of yesod else. take example @ http://www.yesodweb.com/book/basics , in particular code generated mkyesod th function.

the problem perceive th generates both route data type (data route helloworld = homer) , yesoddispatch function calls gethomer etc.

the difficulty there in larger project can't split out definition of gethomer separate module because haskell's simple module system strictly hierarchical; if gethomer called gethomerimplementation defined in module (say homeimplementation) module need import definition of data route helloworld , there circular dependency.

it seems me avoided if renderroute, parseroute , yesoddispatch instances declared in separate modules; renderroute @ bottom of importation hierarchy, , yesoddispatch, @ top. make sense ? maybe fact ask question shows don't understand mkyesod th; e.g., there crucial interrelationship , should not separated.

you correct, point addressed in yesod book. example have @ http://www.yesodweb.com/book/scaffolding-and-the-site-template, section called "foundation , application modules". have foundation module defines route types , handler functions, , application module defines dispatching. handler modules import foundation, , application imports handle modules , foundation. no cycles!

you may interested in reading http://www.yesodweb.com/blog/2012/10/yesod-pure, using yesod without th.

look @ samples yesod applications in github. example, i've developed simple yesod app demonstrate electronic payments @ https://github.com/jpmoresmau/mangopay/tree/master/yesod-mangopay/app. you'll see multi module approach there.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -