@@ -7,6 +7,7 @@
8module Distribution.Nixpkgs.Haskell.FromCabal.Configuration ( Configuration(..), readConfiguration, assertConsistency ) where
8module Distribution.Nixpkgs.Haskell.FromCabal.Configuration ( Configuration(..), readConfiguration, assertConsistency ) where
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))
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
99assertConsistency :: Monad m => Configuration -> m Configuration
100assertConsistency :: Monad m => Configuration -> m Configuration
100assertConsistency cfg@Configuration {..} = do
101assertConsistency cfg@Configuration {..} = do