Reputation: 15872
If I have a bunch of modules in a directory called Views
, I'd like to import them all with import Views.*
. Instead, as far as I can tell the current haskell idiom is to create a file Views.hs
that imports all those files.
My use case:
I'm building a web app with Scotty. My views are written in blaze-html and I import and render them like this:
import Views.Posts.Index
scotty 3000 $ do
get "/" $ do
posts <- getPosts
blaze $ Views.Posts.Index.render posts
So if I have 10 views, I need to import each one explicitly...and when I create a view I need a new import before I can use it. Compare this to mustache:
scotty 3000 $ do
get "/" $ do
mustache "views/posts/index"
Upvotes: 3
Views: 783