From bd73b0ef48c71d0f21486dedabefaaea7f913ad6 Mon Sep 17 00:00:00 2001 From: ners Date: Sat, 14 Oct 2023 17:43:59 +0200 Subject: [PATCH] release 0.17.0 --- .github/workflows/Cabal-Linux.yml | 1 + .github/workflows/Cabal-macOS.yml | 2 +- hnix.cabal | 30 +++++++++++++++--------------- src/Nix/Expr/Types.hs | 2 +- src/Nix/Fresh.hs | 2 +- src/Nix/Standard.hs | 2 +- src/Nix/Type/Infer.hs | 4 ++-- src/Nix/Utils.hs | 4 ++-- src/Nix/Value.hs | 20 ++++++++++++++++++-- 9 files changed, 42 insertions(+), 25 deletions(-) diff --git a/.github/workflows/Cabal-Linux.yml b/.github/workflows/Cabal-Linux.yml index c78c98e53..aa6d575e9 100644 --- a/.github/workflows/Cabal-Linux.yml +++ b/.github/workflows/Cabal-Linux.yml @@ -24,6 +24,7 @@ jobs: , "9.0" , "9.2" , "9.4" + , "9.6" ] steps: diff --git a/.github/workflows/Cabal-macOS.yml b/.github/workflows/Cabal-macOS.yml index 713edab61..6d4ca8b3a 100644 --- a/.github/workflows/Cabal-macOS.yml +++ b/.github/workflows/Cabal-macOS.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: # It is dev env, so trying to stick to last GHC. - ghc: [ "9.4" ] + ghc: [ "9.6" ] steps: - name: "Git checkout" diff --git a/hnix.cabal b/hnix.cabal index cba3b098d..67fee02a9 100644 --- a/hnix.cabal +++ b/hnix.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: hnix -version: 0.16.0 +version: 0.17.0 synopsis: Haskell implementation of the Nix language description: Haskell implementation of the Nix language. category: System, Data, Nix @@ -351,14 +351,14 @@ common shared , BangPatterns , ViewPatterns build-depends: - base >= 4.12 && < 4.18 + base >= 4.12 && < 5 , data-fix >= 0.3.0 && < 0.4 , exceptions >= 0.10.0 && < 0.11 , filepath >= 1.4.2 && < 1.5 - , optparse-applicative >= 0.14.3 && < 0.17 - , relude >= 1.0.0 && < 1.2 + , optparse-applicative >= 0.14.3 && < 0.19 + , relude >= 1.0.0 && < 1.3 , serialise >= 0.2.1 && < 0.3 - , template-haskell >= 2.13 && < 2.20 + , template-haskell >= 2.13 && < 2.22 , time >= 1.8.0 && < 1.9 || >= 1.9.3 && < 1.13 ghc-options: -Wall @@ -444,7 +444,7 @@ library , cryptonite , comonad >= 5.0.4 && < 5.1 , containers >= 0.5.11.0 && < 0.7 - , deepseq >= 1.4.3 && <1.5 + , deepseq >= 1.4.3 && <1.6 , deriving-compat >= 0.3 && < 0.7 , directory >= 1.3.1 && < 1.4 , extra >= 1.7 && < 1.8 @@ -460,11 +460,11 @@ library , lens-family >= 1.2.2 && < 2.2 , lens-family-core >= 1.2.2 && < 2.2 , lens-family-th >= 0.5.0 && < 0.6 - , logict >= 0.6.0 && < 0.7 || >= 0.7.0.2 && < 0.8 - , megaparsec >= 7.0 && < 9.3 + , logict >= 0.6.0 && < 0.7 || >= 0.7.0.2 && < 0.9 + , megaparsec >= 7.0 && < 9.6 , monad-control >= 1.0.2 && < 1.1 , monadlist >= 0.0.2 && < 0.1 - , mtl >= 2.2.2 && < 2.3 + , mtl >= 2.2.2 && < 2.4 , neat-interpolation >= 0.4 && < 0.6 , parser-combinators >= 1.0.1 && < 1.4 , pretty-show >= 1.9.5 && < 1.11 @@ -473,7 +473,7 @@ library , ref-tf >= 0.5 && < 0.6 , regex-tdfa >= 1.2.3 && < 1.4 , scientific >= 0.3.6 && < 0.4 - , semialign >= 1.2 && < 1.3 + , semialign >= 1.2 && < 1.4 , some >= 1.0.1 && < 1.1 , split >= 0.2.3 && < 0.3 , syb >= 0.7 && < 0.8 @@ -483,13 +483,13 @@ library -- aka Lift Text, Bytestring, Vector, Containers, -- we use Lift Text particulrarly for GHC 8.6 , th-lift-instances >= 0.1 && < 0.2 - , text >= 1.2.3 && < 2.1 - , these >= 1.0.1 && < 1.2 - , transformers >= 0.5.5 && < 0.6 + , text >= 1.2.3 && < 2.2 + , these >= 1.0.1 && < 1.3 + , transformers >= 0.5.5 && < 0.7 , transformers-base >= 0.4.5 && < 0.5 - , unix-compat >= 0.4.3 && < 0.6 + , unix-compat >= 0.4.3 && < 0.8 , unordered-containers >= 0.2.14 && < 0.3 - , vector >= 0.12.0 && < 0.13 + , vector >= 0.12.0 && < 0.14 , xml >= 1.3.14 && < 1.4 executable hnix diff --git a/src/Nix/Expr/Types.hs b/src/Nix/Expr/Types.hs index 27d9e7c19..05dc6ab7d 100644 --- a/src/Nix/Expr/Types.hs +++ b/src/Nix/Expr/Types.hs @@ -224,7 +224,7 @@ data Params r ( Eq, Ord, Generic, Generic1 , Typeable, Data, NFData, NFData1, Serialise, Binary, ToJSON, ToJSON1, FromJSON, FromJSON1 , Functor, Foldable, Traversable - , Show, Hashable + , Show, Read, Hashable ) instance IsString (Params r) where diff --git a/src/Nix/Fresh.hs b/src/Nix/Fresh.hs index fdd20c4a9..4b55de4e5 100644 --- a/src/Nix/Fresh.hs +++ b/src/Nix/Fresh.hs @@ -14,7 +14,7 @@ import Control.Monad.Catch ( MonadCatch , MonadMask , MonadThrow ) -import Control.Monad.Except ( MonadFix ) +import Control.Monad.Fix ( MonadFix ) import Control.Monad.Ref ( MonadAtomicRef(..) , MonadRef(Ref) ) diff --git a/src/Nix/Standard.hs b/src/Nix/Standard.hs index 846283a45..4065f57f8 100644 --- a/src/Nix/Standard.hs +++ b/src/Nix/Standard.hs @@ -19,7 +19,7 @@ import Control.Monad.Catch ( MonadThrow import Control.Monad.Fail ( MonadFail ) #endif import Control.Monad.Free ( Free(Free) ) -import Control.Monad.Reader ( MonadFix ) +import Control.Monad.Fix ( MonadFix ) import Control.Monad.Ref ( MonadRef(newRef) , MonadAtomicRef ) diff --git a/src/Nix/Type/Infer.hs b/src/Nix/Type/Infer.hs index 77d07795c..9796a0c34 100644 --- a/src/Nix/Type/Infer.hs +++ b/src/Nix/Type/Infer.hs @@ -26,8 +26,8 @@ import Control.Monad.Catch ( MonadThrow(..) , MonadCatch(..) ) import Control.Monad.Except ( MonadError(throwError,catchError) ) -import Control.Monad.Logic hiding ( fail ) -import Control.Monad.Reader ( MonadFix ) +import Control.Monad.Logic +import Control.Monad.Fix ( MonadFix ) import Control.Monad.Ref ( MonadAtomicRef(..) , MonadRef(..) ) diff --git a/src/Nix/Utils.hs b/src/Nix/Utils.hs index fdb2fb612..c01f3a481 100644 --- a/src/Nix/Utils.hs +++ b/src/Nix/Utils.hs @@ -68,6 +68,7 @@ import Relude hiding ( pass import Data.Binary ( Binary ) import Data.Data ( Data ) import Codec.Serialise ( Serialise ) +import Control.Monad ( foldM ) import Control.Monad.Fix ( MonadFix(..) ) import Control.Monad.Free ( Free(..) ) import Control.Monad.Trans.Control ( MonadTransControl(..) ) @@ -84,7 +85,6 @@ import Lens.Family2.Stock ( _1 , _2 ) import qualified System.FilePath as FilePath -import Control.Monad.List (foldM) #if ENABLE_TRACING import qualified Relude.Debug as X @@ -310,7 +310,7 @@ replaceExtension = coerce FilePath.replaceExtension -- | 'Path's 'FilePath.readFile'. readFile :: MonadIO m => Path -> m Text -readFile = readFileText . coerce +readFile = fmap decodeUtf8 . readFileBS . coerce -- * Recursion scheme diff --git a/src/Nix/Value.hs b/src/Nix/Value.hs index 927bdedce..01784cb3a 100644 --- a/src/Nix/Value.hs +++ b/src/Nix/Value.hs @@ -27,7 +27,6 @@ import Data.Functor.Classes ( Show1 , liftShowsPrec , showsUnaryWith , Eq1(liftEq) ) -import Data.Eq.Deriving import qualified Text.Show import Text.Show ( showsPrec , showString @@ -140,6 +139,16 @@ data NValueF p m r deriving (Generic, Typeable, Functor) +-- ** Eq + +instance Eq r => Eq (NValueF p m r) where + (==) (NVConstantF x) (NVConstantF y) = x == y + (==) (NVStrF x) (NVStrF y) = x == y + (==) (NVPathF x) (NVPathF y) = x == y + (==) (NVListF x) (NVListF y) = x == y + (==) (NVSetF _ x) (NVSetF _ y) = x == y + (==) _ _ = False + -- ** Eq1 instance Eq1 (NValueF p m) where @@ -715,10 +724,17 @@ type MonadDataErrorContext t f m instance MonadDataErrorContext t f m => Exception (ValueFrame t f m) + +-- * @instance Eq NValue'@ + +instance (Eq a, Comonad f) => Eq (NValue' t f m a) where + (==) (NValue' (extract -> x)) (NValue' (extract -> y)) = x == y + -- * @instance Eq1 NValue'@ -- TH derivable works only after MonadDataContext -$(deriveEq1 ''NValue') +instance Comonad f => Eq1 (NValue' t f m) where + liftEq eq (NValue' (extract -> x)) (NValue' (extract -> y)) = liftEq eq x y -- * @NValueF@ traversals, getter & setters