From 527bc7626561c0c949c3dac10cfaf49045da492d Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Wed, 13 Mar 2024 22:46:57 +0000 Subject: [PATCH 1/2] Add defaults stanza --- skeleton/backend/backend.cabal | 31 ++++++++++++++----------------- skeleton/common/common.cabal | 22 +++++++++++++--------- skeleton/frontend/frontend.cabal | 31 ++++++++++++++----------------- 3 files changed, 41 insertions(+), 43 deletions(-) diff --git a/skeleton/backend/backend.cabal b/skeleton/backend/backend.cabal index 46c0548ae..9d1ef47e3 100644 --- a/skeleton/backend/backend.cabal +++ b/skeleton/backend/backend.cabal @@ -1,9 +1,21 @@ +cabal-version: 2.2 name: backend version: 0.1 -cabal-version: >= 1.8 build-type: Simple +common defaults + default-language: Haskell2010 + ghc-options: -Wall -O -fno-show-valid-hole-fits + -- unsafe code + -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields + -- unneeded code + -Widentities -Wredundant-constraints + if impl(ghc >= 8.8) + ghc-options: + -Wmissing-deriving-strategies + library + import: defaults hs-source-dirs: src if impl(ghcjs) buildable: False @@ -14,26 +26,11 @@ library , obelisk-route exposed-modules: Backend - ghc-options: -Wall -O -fno-show-valid-hole-fits - -- unsafe code - -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields - -- unneeded code - -Widentities -Wredundant-constraints - if impl(ghc >= 8.8) - ghc-options: - -Wmissing-deriving-strategies executable backend + import: defaults main-is: main.hs hs-source-dirs: src-bin - ghc-options: -Wall -O -fno-show-valid-hole-fits -threaded - -- unsafe code - -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields - -- unneeded code - -Widentities -Wredundant-constraints - if impl(ghc >= 8.8) - ghc-options: - -Wmissing-deriving-strategies if impl(ghcjs) buildable: False build-depends: base diff --git a/skeleton/common/common.cabal b/skeleton/common/common.cabal index 931ff5d02..415f011d8 100644 --- a/skeleton/common/common.cabal +++ b/skeleton/common/common.cabal @@ -1,16 +1,10 @@ +cabal-version: 2.2 name: common version: 0.1 -cabal-version: >= 1.2 build-type: Simple -library - hs-source-dirs: src - build-depends: base - , obelisk-route - , text - exposed-modules: - Common.Api - Common.Route +common defaults + default-language: Haskell2010 ghc-options: -Wall -O -fno-show-valid-hole-fits -- unsafe code -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields @@ -19,3 +13,13 @@ library if impl(ghc >= 8.8) ghc-options: -Wmissing-deriving-strategies + +library + import: defaults + hs-source-dirs: src + build-depends: base + , obelisk-route + , text + exposed-modules: + Common.Api + Common.Route diff --git a/skeleton/frontend/frontend.cabal b/skeleton/frontend/frontend.cabal index 29c64b373..dde6ba187 100644 --- a/skeleton/frontend/frontend.cabal +++ b/skeleton/frontend/frontend.cabal @@ -1,9 +1,21 @@ +cabal-version: 2.2 name: frontend version: 0.1 -cabal-version: >= 1.8 build-type: Simple +common defaults + default-language: Haskell2010 + ghc-options: -Wall -O -fno-show-valid-hole-fits + -- unsafe code + -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields + -- unneeded code + -Widentities -Wredundant-constraints + if impl(ghc >= 8.8) + ghc-options: + -Wmissing-deriving-strategies + library + import: defaults hs-source-dirs: src build-depends: base , common @@ -17,16 +29,9 @@ library , text exposed-modules: Frontend - ghc-options: -Wall -O -fno-show-valid-hole-fits - -- unsafe code - -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields - -- unneeded code - -Widentities -Wredundant-constraints - if impl(ghc >= 8.8) - ghc-options: - -Wmissing-deriving-strategies executable frontend + import: defaults main-is: main.hs hs-source-dirs: src-bin build-depends: base @@ -35,14 +40,6 @@ executable frontend , obelisk-frontend , obelisk-route , reflex-dom - ghc-options: -Wall -O -fno-show-valid-hole-fits -threaded - -- unsafe code - -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields - -- unneeded code - -Widentities -Wredundant-constraints - if impl(ghc >= 8.8) - ghc-options: - -Wmissing-deriving-strategies if impl(ghcjs) ghc-options: -dedupe cpp-options: -DGHCJS_BROWSER From 31f093acb6e2bf84147108e7c4a966878aec4646 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Sun, 6 Oct 2024 21:03:28 +0100 Subject: [PATCH 2/2] Stanza polyfill for GHC2024 --- skeleton/backend/backend.cabal | 54 ++++++++++++++++++++++++++++- skeleton/common/common.cabal | 54 ++++++++++++++++++++++++++++- skeleton/common/src/Common/Route.hs | 9 ----- skeleton/frontend/frontend.cabal | 54 ++++++++++++++++++++++++++++- skeleton/frontend/src/Frontend.hs | 1 - 5 files changed, 159 insertions(+), 13 deletions(-) diff --git a/skeleton/backend/backend.cabal b/skeleton/backend/backend.cabal index 9d1ef47e3..33d01ec2d 100644 --- a/skeleton/backend/backend.cabal +++ b/skeleton/backend/backend.cabal @@ -3,8 +3,60 @@ name: backend version: 0.1 build-type: Simple -common defaults +common ghc2021 default-language: Haskell2010 + default-extensions: + BangPatterns + BinaryLiterals + ConstraintKinds + DeriveDataTypeable + DeriveGeneric + DeriveLift + DeriveTraversable + DoAndIfThenElse + EmptyCase + EmptyDataDecls + EmptyDataDeriving + ExistentialQuantification + FlexibleContexts + FlexibleInstances + ForeignFunctionInterface + GADTSyntax + GeneralisedNewtypeDeriving + HexFloatLiterals + ImportQualifiedPost + InstanceSigs + MonoLocalBinds + MultiParamTypeClasses + NamedFieldPuns + NamedWildCards + NumericUnderscores + PatternGuards + PolyKinds + PostfixOperators + RankNTypes + RelaxedPolyRec + ScopedTypeVariables + StandaloneDeriving + StandaloneKindSignatures + StarIsType + TraditionalRecordSyntax + TupleSections + TypeApplications + TypeOperators + +common ghc2024 + import: ghc2021 + default-extensions: + DataKinds + DerivingStrategies + DisambiguateRecordFields + GADTs + LambdaCase + RoleAnnotations + +common defaults + import: ghc2024 ghc-options: -Wall -O -fno-show-valid-hole-fits -- unsafe code -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields diff --git a/skeleton/common/common.cabal b/skeleton/common/common.cabal index 415f011d8..387ff63e1 100644 --- a/skeleton/common/common.cabal +++ b/skeleton/common/common.cabal @@ -3,8 +3,60 @@ name: common version: 0.1 build-type: Simple -common defaults +common ghc2021 default-language: Haskell2010 + default-extensions: + BangPatterns + BinaryLiterals + ConstraintKinds + DeriveDataTypeable + DeriveGeneric + DeriveLift + DeriveTraversable + DoAndIfThenElse + EmptyCase + EmptyDataDecls + EmptyDataDeriving + ExistentialQuantification + FlexibleContexts + FlexibleInstances + ForeignFunctionInterface + GADTSyntax + GeneralisedNewtypeDeriving + HexFloatLiterals + ImportQualifiedPost + InstanceSigs + MonoLocalBinds + MultiParamTypeClasses + NamedFieldPuns + NamedWildCards + NumericUnderscores + PatternGuards + PolyKinds + PostfixOperators + RankNTypes + RelaxedPolyRec + ScopedTypeVariables + StandaloneDeriving + StandaloneKindSignatures + StarIsType + TraditionalRecordSyntax + TupleSections + TypeApplications + TypeOperators + +common ghc2024 + import: ghc2021 + default-extensions: + DataKinds + DerivingStrategies + DisambiguateRecordFields + GADTs + LambdaCase + RoleAnnotations + +common defaults + import: ghc2024 ghc-options: -Wall -O -fno-show-valid-hole-fits -- unsafe code -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields diff --git a/skeleton/common/src/Common/Route.hs b/skeleton/common/src/Common/Route.hs index 17dadaee5..7e6f2f367 100644 --- a/skeleton/common/src/Common/Route.hs +++ b/skeleton/common/src/Common/Route.hs @@ -1,13 +1,4 @@ -{-# LANGUAGE ConstraintKinds #-} -{-# LANGUAGE EmptyCase #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RankNTypes #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} module Common.Route where diff --git a/skeleton/frontend/frontend.cabal b/skeleton/frontend/frontend.cabal index dde6ba187..a3176422f 100644 --- a/skeleton/frontend/frontend.cabal +++ b/skeleton/frontend/frontend.cabal @@ -3,8 +3,60 @@ name: frontend version: 0.1 build-type: Simple -common defaults +common ghc2021 default-language: Haskell2010 + default-extensions: + BangPatterns + BinaryLiterals + ConstraintKinds + DeriveDataTypeable + DeriveGeneric + DeriveLift + DeriveTraversable + DoAndIfThenElse + EmptyCase + EmptyDataDecls + EmptyDataDeriving + ExistentialQuantification + FlexibleContexts + FlexibleInstances + ForeignFunctionInterface + GADTSyntax + GeneralisedNewtypeDeriving + HexFloatLiterals + ImportQualifiedPost + InstanceSigs + MonoLocalBinds + MultiParamTypeClasses + NamedFieldPuns + NamedWildCards + NumericUnderscores + PatternGuards + PolyKinds + PostfixOperators + RankNTypes + RelaxedPolyRec + ScopedTypeVariables + StandaloneDeriving + StandaloneKindSignatures + StarIsType + TraditionalRecordSyntax + TupleSections + TypeApplications + TypeOperators + +common ghc2024 + import: ghc2021 + default-extensions: + DataKinds + DerivingStrategies + DisambiguateRecordFields + GADTs + LambdaCase + RoleAnnotations + +common defaults + import: ghc2024 ghc-options: -Wall -O -fno-show-valid-hole-fits -- unsafe code -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields diff --git a/skeleton/frontend/src/Frontend.hs b/skeleton/frontend/src/Frontend.hs index 896bff765..3b865b12f 100644 --- a/skeleton/frontend/src/Frontend.hs +++ b/skeleton/frontend/src/Frontend.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE TemplateHaskell #-} module Frontend where