git.iko.soy/typeable/cabal2nix
on master help sign in
hackage2nix: replace deprecated Aeson.decodeFile with decodeFileEither
143cae1Peter Simons
src/Distribution/Nixpkgs/Haskell/FromCabal/Configuration.hs+2−1
@@ -7,6 +7,7 @@
7
7
8module Distribution.Nixpkgs.Haskell.FromCabal.Configuration ( Configuration(..), readConfiguration, assertConsistency ) where
8module Distribution.Nixpkgs.Haskell.FromCabal.Configuration ( Configuration(..), readConfiguration, assertConsistency ) where
9
9
10+import Control.Exception ( throwIO )
10import Control.DeepSeq
11import Control.DeepSeq
11import Control.Lens
12import Control.Lens
12import Control.Monad
13import Control.Monad
@@ -94,7 +95,7 @@ parseKey s = either error id (parseEither parseJSON (String s))
94
95
95readConfiguration :: FilePath -> IO Configuration
96readConfiguration :: FilePath -> IO Configuration
96readConfiguration path =
97readConfiguration path =
97− decodeFile path >>= maybe (fail ("invalid config file at " ++ show path)) assertConsistency
98+ decodeFileEither path >>= either throwIO assertConsistency
98
99
99assertConsistency :: Monad m => Configuration -> m Configuration
100assertConsistency :: Monad m => Configuration -> m Configuration
100assertConsistency cfg@Configuration {..} = do
101assertConsistency cfg@Configuration {..} = do