Curious as to what the more experienced Haskellers here think about this article.
I’m a total Haskell novice, but when I read this a while ago I was left pretty underwhelmed.
I prefer to pull configuration together in one place. I’ll usually use RecordWildCards for the actual settings record construction. I want to know statically that it’s all there.
data App = App { appSettings :: !AppSettings , appStatic :: !Static -- ^ Settings for static file serving. , appConnPool :: !ConnectionPool -- ^ Database connection pool. , appHttpManager :: !Manager , appLogger :: !Logger , appPostmark :: !PostmarkSettings } makeFoundation :: AppSettings -> IO App makeFoundation appSettings = do appHttpManager <- newManager appLogger <- newStdoutLoggerSet defaultBufSize >>= makeYesodLogger appStatic <- (if appMutableStatic appSettings then staticDevel else static) (appStaticDir appSettings) let appPostmark = postmarkSettings (appPostmarkToken appSettings) let mkFoundation appConnPool = App {..} {... etc ...}
You can be cleverer than PartialOptions/Options and turn that into a type argument but it’s not worth it.
Curious as to what the more experienced Haskellers here think about this article.
I’m a total Haskell novice, but when I read this a while ago I was left pretty underwhelmed.
I prefer to pull configuration together in one place. I’ll usually use RecordWildCards for the actual settings record construction. I want to know statically that it’s all there.
You can be cleverer than PartialOptions/Options and turn that into a type argument but it’s not worth it.