Conversation
| - '.' | ||
| # Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3) | ||
| extra-deps: [] | ||
| extra-deps: [aeson-0.11.0.0] |
There was a problem hiding this comment.
@TheJJ This is btw necessary for using aeson >= 0.11, because lts-5.9 provides aeson-0.9 by default and stack won't be able to pull in dependencies otherwise
There was a problem hiding this comment.
kay, but if you write it that way, sure it's >=?
There was a problem hiding this comment.
no it's actually 0.11.0.0, and as far as i know there's no way of saying >=0.11 in extra deps.
But i know that one is working for now and higher versions like 0.11.1.3 gave me some dependency conflict.
Edit: what i meant above was for using aeson >= 0.11 in the cabal file
There was a problem hiding this comment.
Mkay but if you have a dependency conflict then it's not an issue of the masterserver. Stack surely supports some notation for having a minimal version of some package, setting it to "we require exactly 0.11.0.0" is really not good.
There was a problem hiding this comment.
Right, the cleanest solution would be not using >=0.11 while it's not in the long term support package, a second possible way but still not too good would be using a nightly package set instead of lts, like this, which actually features aeson-0.11.1.4, but still needs to be updated with every new release.
There was a problem hiding this comment.
Why does stack suck and not support a dependency specification with >=, I mean we now do require at least aeson 0.11, stack must be able to represent that somehow.
Reader Monad
To be able to overwrite config settings with command line arguments i had to rethink the way we access the config file.
In the new solution i removed the now unnecessary getter functions like
getPort :: IO Intand instead made the Config globally accessible by using the monad transformer ReaderT and keeping the config in the Reader Monad.
Therefore all functions needing config acces now have a type signature of:
The config itself can now be loaded with Readers
askfunction.Single config records can be accessed via asks as in
myVersion <- asks acceptedVersionCommand line arguments
Command line arguments are parsed in a new File calles Args.hs.
it provides a function named
parseOptswhich if successful returns a Config object as loaded from the config file, where specially specified records like port are overwritten with the command line arguments.Usage info can be printed with
-hor--helpand looks like this: