Skip to content

Commit

Permalink
Clean up language extensions (#92)
Browse files Browse the repository at this point in the history
- Use GHC2021
- Set common language extensions in .cabal file
  • Loading branch information
9999years authored Oct 25, 2024
1 parent 049fb80 commit 6cc8559
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 69 deletions.
7 changes: 1 addition & 6 deletions app/Main.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE CPP #-}

module Main where

Expand Down
47 changes: 32 additions & 15 deletions nix-diff.cabal
Original file line number Diff line number Diff line change
@@ -1,29 +1,51 @@
cabal-version: 3.0
name: nix-diff
version: 1.0.20
synopsis: Explain why two Nix derivations differ
description: This package provides a @nix-diff@ executable which
explains why two Nix derivations (i.e. @*.drv@ files)
differ
homepage: https://github.com/Gabriella439/nix-diff
license: BSD3
license: BSD-3-Clause
license-file: LICENSE
author: Gabriella Gonzalez
maintainer: [email protected]
copyright: 2017 Gabriella Gonzalez
copyright: 2024 Gabriella Gonzalez
category: System
build-type: Simple
tested-with: GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.5, GHC == 9.4.4
cabal-version: >= 1.10
tested-with: GHC == 9.2.8,
GHC == 9.4.7,
GHC == 9.6.3
extra-source-files: README.md
CHANGELOG.md

common language
default-language: GHC2021
default-extensions:
ApplicativeDo,
BlockArguments,
DeriveAnyClass,
DerivingStrategies,
DerivingVia,
DuplicateRecordFields,
LambdaCase,
MultiWayIf,
NamedFieldPuns,
OverloadedStrings,
RecordWildCards,
ghc-options: -Wall

library
import: language
hs-source-dirs: src

exposed-modules:
Nix.Diff
Nix.Diff.Store
Nix.Diff.Types
Nix.Diff.Transformations
Nix.Diff.Render.HumanReadable

build-depends: base >= 4.9 && < 5
, attoparsec >= 0.13 && < 0.15
, aeson
Expand All @@ -42,11 +64,10 @@ library
, quickcheck-instances < 3.29
, generic-arbitrary < 1.1
, uniplate < 1.17
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall

executable nix-diff
import: language
hs-source-dirs: app
main-is: Main.hs

build-depends: base
Expand All @@ -58,11 +79,12 @@ executable nix-diff
, unix < 2.9
, containers
, mtl
hs-source-dirs: app
default-language: Haskell2010
ghc-options: -Wall

test-suite nix-diff-test
import: language
ghc-options: -Wall

hs-source-dirs: test
main-is: Main.hs

other-modules:
Expand All @@ -83,8 +105,3 @@ test-suite nix-diff-test
, tasty < 1.6
, tasty-quickcheck < 0.11
, tasty-silver < 3.4

hs-source-dirs: test

default-language: Haskell2010
ghc-options: -Wall
12 changes: 2 additions & 10 deletions src/Nix/Diff.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE CPP #-}

module Nix.Diff where

Expand All @@ -23,7 +16,6 @@ import Data.Vector (Vector)
import Nix.Derivation (Derivation, DerivationOutput)
import Prelude hiding (unzip)

import qualified Control.Monad.Reader
import qualified Data.Attoparsec.Text
import qualified Data.ByteString
import qualified Data.Char as Char
Expand Down Expand Up @@ -66,7 +58,7 @@ data Diffed = Diffed
} deriving (Eq, Ord)

newtype Diff a = Diff { unDiff :: ReaderT DiffContext (StateT Status IO) a }
deriving
deriving newtype
( Functor
, Applicative
, Monad
Expand Down
12 changes: 2 additions & 10 deletions src/Nix/Diff/Render/HumanReadable.hs
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE CPP #-}

module Nix.Diff.Render.HumanReadable where

Expand Down Expand Up @@ -39,7 +31,7 @@ data RenderContext = RenderContext
}

newtype Render a = Render { unRender :: ReaderT RenderContext (Writer Text) a}
deriving
deriving newtype
( Functor
, Applicative
, Monad
Expand Down
6 changes: 0 additions & 6 deletions src/Nix/Diff/Store.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE NoImportQualifiedPost #-}

-- | A crude implementation of the Nix store concept.
--
-- For anything fancier than this, it would be best to use FFI bindings instead,
Expand Down
6 changes: 0 additions & 6 deletions src/Nix/Diff/Transformations.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE FlexibleContexts #-}
module Nix.Diff.Transformations where

import qualified Patience
Expand Down
16 changes: 4 additions & 12 deletions src/Nix/Diff/Types.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# OPTIONS_GHC -Wno-orphans -fconstraint-solver-iterations=0 #-}
-- Needed for `deriving Arbitrary via GenericArbitrary DerivationDiff`:
{-# OPTIONS_GHC -fconstraint-solver-iterations=0 #-}
-- Needed for `deriving instance Data (DerivationOutput StorePath Text)`:
{-# OPTIONS_GHC -Wno-orphans #-}

module Nix.Diff.Types where

Expand Down
1 change: 0 additions & 1 deletion test/Golden/Tests.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE OverloadedStrings #-}
module Golden.Tests where

import qualified Data.Aeson
Expand Down
3 changes: 0 additions & 3 deletions test/Golden/Utils.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}

module Golden.Utils where

import qualified Data.ByteString.Lazy.Char8 as BS
Expand Down

0 comments on commit 6cc8559

Please sign in to comment.