unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.82k stars 272 forks source link

Normalize flags/ghc-options across packages #3723

Open ChrisPenner opened 1 year ago

ChrisPenner commented 1 year ago

Looking through all the package.yamls and our optimization flags are all over the place;

ghc-options:
 # All packages
 "$locals": -Wall -Werror -Wno-name-shadowing -Wno-missing-pattern-synonym-signatures -fprint-expanded-synonyms -fwrite-ide-info #-freverse-errors

We should decide how we want to arrange this and make everything consistent, I'm pretty confident we're not building with all the desired flags all the time, and things get more complex when we depend on these packages from Enlil because we can't override flags using $locals since unison isn't considered local in this case (I think, documentation for this sort of behaviour is scant at best).

Goals:

philderbeast commented 1 year ago

I'm the maintainer of hpack-dhall and this tool (a lightweight dhall layer on top of hpack) could help here as it makes it very easy to import common items you might want in every (or some) generated .cabal file like ghc-options. If the imported item is a list you can append items and if a record then fields can be picked off or merged with another record.

It would be a bit of leg work converting package.yaml to package.dhall as there are 26 of them but if you have a set of 2 or 3 that you'd like me to convert as a proof of concept then I'd be willing to do that.

$ tree --prune -P '*.cabal'
.
├── codebase2
│   ├── codebase
│   │   └── unison-codebase.cabal
│   ├── codebase-sqlite
│   │   └── unison-codebase-sqlite.cabal
│   ├── codebase-sqlite-hashing-v2
│   │   └── unison-codebase-sqlite-hashing-v2.cabal
│   ├── codebase-sync
│   │   └── unison-codebase-sync.cabal
│   ├── core
│   │   └── unison-core.cabal
│   ├── util-serialization
│   │   └── unison-util-serialization.cabal
│   └── util-term
│       └── unison-util-term.cabal
├── lib
│   ├── unison-hash
│   │   └── unison-hash.cabal
│   ├── unison-hashing
│   │   └── unison-hashing.cabal
│   ├── unison-hash-orphans-aeson
│   │   └── unison-hash-orphans-aeson.cabal
│   ├── unison-hash-orphans-sqlite
│   │   └── unison-hash-orphans-sqlite.cabal
│   ├── unison-prelude
│   │   └── unison-prelude.cabal
│   ├── unison-pretty-printer
│   │   └── unison-pretty-printer.cabal
│   ├── unison-sqlite
│   │   └── unison-sqlite.cabal
│   ├── unison-util-base32hex
│   │   └── unison-util-base32hex.cabal
│   ├── unison-util-bytes
│   │   └── unison-util-bytes.cabal
│   ├── unison-util-cache
│   │   └── unison-util-cache.cabal
│   ├── unison-util-relation
│   │   └── unison-util-relation.cabal
│   └── unison-util-rope
│       └── unison-util-rope.cabal
├── parser-typechecker
│   └── unison-parser-typechecker.cabal
├── unison-cli
│   └── unison-cli.cabal
├── unison-core
│   └── unison-core1.cabal
├── unison-hashing-v2
│   └── unison-hashing-v2.cabal
├── unison-share-api
│   └── unison-share-api.cabal
├── unison-syntax
│   └── unison-syntax.cabal
└── yaks
    └── easytest
        └── easytest.cabal

29 directories, 26 files