Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration transition #130

Open
telser opened this issue Jul 10, 2023 · 1 comment
Open

Configuration transition #130

telser opened this issue Jul 10, 2023 · 1 comment

Comments

@telser
Copy link

telser commented Jul 10, 2023

Could we get a release that supports both the dhall or toml configurations to help transition?

Given that stackage only very recently moved to GHC-9.4.5, it seems likely that many users will not be able to upgrade to 2.6 soon. Would a branch from 2.5.0, be possible?

@ocharles
Copy link
Owner

Hi @telser. I'm reluctant to have weeder support two configuration formats - and we moved to toml-reader with the explicit goal to reduce the dependency graph. The good news is that migrating from Dhall can be done programmatically!

let concatSep = https://prelude.dhall-lang.org/v19.0.0/Text/concatSep.dhall

let map = https://prelude.dhall-lang.org/v19.0.0/List/map.dhall

let to-toml = \(config : {type-class-roots : Bool, roots : List Text}) ->
       "type-class-roots = " ++ (if config.type-class-roots then "true" else "false") ++ "\n" ++
       "roots = [" ++ concatSep ",\n" (map Text Text (\(t : Text) -> "'" ++ t ++ "'") config.roots)  ++ "]"

in to-toml

If you stick that in to-toml.dhall, you should then be able to run:

dhall-to-text <<< './to-toml.dhall weeder.dhall' > weeder.toml

Does that help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants