@@ -1,6 +1,7 @@
1{-# LANGUAGE DeriveGeneric #-}
1{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE RecordWildCards #-}
3{-# LANGUAGE TemplateHaskell #-}
3{-# LANGUAGE TemplateHaskell #-}
4+{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}
5module Distribution.Nixpkgs.Haskell
6module Distribution.Nixpkgs.Haskell
6 ( Derivation, nullDerivation, pkgid, revision, src, isLibrary, isExecutable
7 ( Derivation, nullDerivation, pkgid, revision, src, isLibrary, isExecutable
@@ -8,7 +9,7 @@ module Distribution.Nixpkgs.Haskell
8 , cabalFlags, runHaddock, jailbreak, doCheck, testTarget, hyperlinkSource, enableSplitObjs
9 , cabalFlags, runHaddock, jailbreak, doCheck, testTarget, hyperlinkSource, enableSplitObjs
9 , phaseOverrides, editedCabalFile, metaSection
10 , phaseOverrides, editedCabalFile, metaSection
10 , BuildInfo, haskell, pkgconfig, system, tool
11 , BuildInfo, haskell, pkgconfig, system, tool
11− , dependencies, anyDep
12+ , dependencies
@@ -37,7 +38,8 @@ data BuildInfo = BuildInfo
38makeLenses ''BuildInfo
39makeLenses ''BuildInfo
40−makeLensesFor [("_haskell", "anyDep"), ("_pkgconfig", "anyDep"), ("_system", "anyDep"), ("_tool", "anyDep")] ''BuildInfo
41+instance Each BuildInfo BuildInfo (Set Identifier) (Set Identifier) where
42+ each f (BuildInfo a b c d) = BuildInfo <$> f a <*> f b <*> f c <*> f d
42instance Monoid BuildInfo where
44instance Monoid BuildInfo where
43 mempty = BuildInfo mempty mempty mempty mempty
45 mempty = BuildInfo mempty mempty mempty mempty
@@ -46,9 +48,7 @@ instance Monoid BuildInfo where
46-- | A represtation of Nix expressions for building Haskell packages.
48-- | A represtation of Nix expressions for building Haskell packages.
47-- The data type correspond closely to the definition of
49-- The data type correspond closely to the definition of
48-- 'PackageDescription' from Cabal.
50-- 'PackageDescription' from Cabal.
50−-- Note that the "Text" instance definition provides pretty-printing,
51−-- but no parsing as of now!
52data Derivation = MkDerivation
52data Derivation = MkDerivation
53 { _pkgid :: PackageIdentifier
53 { _pkgid :: PackageIdentifier
54 , _revision :: Int
54 , _revision :: Int
@@ -137,7 +137,7 @@ instance Pretty Derivation where
138 inputs :: Set String
138 inputs :: Set String
139 inputs = Set.unions [ _extraFunctionArgs
139 inputs = Set.unions [ _extraFunctionArgs
140− , setOf (dependencies . anyDep . folded . ident) drv
140+ , setOf (dependencies . each . folded . ident) drv
141 , Set.fromList ["fetch" ++ derivKind _src | derivKind _src /= "" && not isHackagePackage]
141 , Set.fromList ["fetch" ++ derivKind _src | derivKind _src /= "" && not isHackagePackage]