{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
module Distribution.Types.ForeignLib(
ForeignLib(..),
emptyForeignLib,
foreignLibModules,
foreignLibIsShared,
foreignLibVersion,
LibVersionInfo,
mkLibVersionInfo,
libVersionInfoCRA,
libVersionNumber,
libVersionNumberShow,
libVersionMajor
) where
import Distribution.Compat.Prelude
import Prelude ()
import Distribution.ModuleName
import Distribution.Parsec
import Distribution.Pretty
import Distribution.System
import Distribution.Types.BuildInfo
import Distribution.Types.ForeignLibOption
import Distribution.Types.ForeignLibType
import Distribution.Types.UnqualComponentName
import Distribution.Version
import qualified Distribution.Compat.CharParsing as P
import qualified Text.PrettyPrint as Disp
import qualified Text.Read as Read
import qualified Distribution.Types.BuildInfo.Lens as L
data ForeignLib = ForeignLib {
ForeignLib -> UnqualComponentName
foreignLibName :: UnqualComponentName
, ForeignLib -> ForeignLibType
foreignLibType :: ForeignLibType
, ForeignLib -> [ForeignLibOption]
foreignLibOptions :: [ForeignLibOption]
, ForeignLib -> BuildInfo
foreignLibBuildInfo :: BuildInfo
, ForeignLib -> Maybe LibVersionInfo
foreignLibVersionInfo :: Maybe LibVersionInfo
, ForeignLib -> Maybe Version
foreignLibVersionLinux :: Maybe Version
, ForeignLib -> [FilePath]
foreignLibModDefFile :: [FilePath]
}
deriving (forall x. Rep ForeignLib x -> ForeignLib
forall x. ForeignLib -> Rep ForeignLib x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ForeignLib x -> ForeignLib
$cfrom :: forall x. ForeignLib -> Rep ForeignLib x
Generic, Int -> ForeignLib -> ShowS
[ForeignLib] -> ShowS
ForeignLib -> FilePath
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
showList :: [ForeignLib] -> ShowS
$cshowList :: [ForeignLib] -> ShowS
show :: ForeignLib -> FilePath
$cshow :: ForeignLib -> FilePath
showsPrec :: Int -> ForeignLib -> ShowS
$cshowsPrec :: Int -> ForeignLib -> ShowS
Show, ReadPrec [ForeignLib]
ReadPrec ForeignLib
Int -> ReadS ForeignLib
ReadS [ForeignLib]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ForeignLib]
$creadListPrec :: ReadPrec [ForeignLib]
readPrec :: ReadPrec ForeignLib
$creadPrec :: ReadPrec ForeignLib
readList :: ReadS [ForeignLib]
$creadList :: ReadS [ForeignLib]
readsPrec :: Int -> ReadS ForeignLib
$creadsPrec :: Int -> ReadS ForeignLib
Read, ForeignLib -> ForeignLib -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ForeignLib -> ForeignLib -> Bool
$c/= :: ForeignLib -> ForeignLib -> Bool
== :: ForeignLib -> ForeignLib -> Bool
$c== :: ForeignLib -> ForeignLib -> Bool
Eq, Eq ForeignLib
ForeignLib -> ForeignLib -> Bool
ForeignLib -> ForeignLib -> Ordering
ForeignLib -> ForeignLib -> ForeignLib
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ForeignLib -> ForeignLib -> ForeignLib
$cmin :: ForeignLib -> ForeignLib -> ForeignLib
max :: ForeignLib -> ForeignLib -> ForeignLib
$cmax :: ForeignLib -> ForeignLib -> ForeignLib
>= :: ForeignLib -> ForeignLib -> Bool
$c>= :: ForeignLib -> ForeignLib -> Bool
> :: ForeignLib -> ForeignLib -> Bool
$c> :: ForeignLib -> ForeignLib -> Bool
<= :: ForeignLib -> ForeignLib -> Bool
$c<= :: ForeignLib -> ForeignLib -> Bool
< :: ForeignLib -> ForeignLib -> Bool
$c< :: ForeignLib -> ForeignLib -> Bool
compare :: ForeignLib -> ForeignLib -> Ordering
$ccompare :: ForeignLib -> ForeignLib -> Ordering
Ord, Typeable, Typeable ForeignLib
ForeignLib -> DataType
ForeignLib -> Constr
(forall b. Data b => b -> b) -> ForeignLib -> ForeignLib
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ForeignLib -> u
forall u. (forall d. Data d => d -> u) -> ForeignLib -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLib -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLib -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ForeignLib -> m ForeignLib
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForeignLib -> m ForeignLib
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ForeignLib
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ForeignLib -> c ForeignLib
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ForeignLib)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ForeignLib)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForeignLib -> m ForeignLib
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForeignLib -> m ForeignLib
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForeignLib -> m ForeignLib
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ForeignLib -> m ForeignLib
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ForeignLib -> m ForeignLib
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ForeignLib -> m ForeignLib
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ForeignLib -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ForeignLib -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> ForeignLib -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ForeignLib -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLib -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLib -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLib -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLib -> r
gmapT :: (forall b. Data b => b -> b) -> ForeignLib -> ForeignLib
$cgmapT :: (forall b. Data b => b -> b) -> ForeignLib -> ForeignLib
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ForeignLib)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ForeignLib)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ForeignLib)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ForeignLib)
dataTypeOf :: ForeignLib -> DataType
$cdataTypeOf :: ForeignLib -> DataType
toConstr :: ForeignLib -> Constr
$ctoConstr :: ForeignLib -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ForeignLib
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ForeignLib
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ForeignLib -> c ForeignLib
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ForeignLib -> c ForeignLib
Data)
data LibVersionInfo = LibVersionInfo Int Int Int deriving (Typeable LibVersionInfo
LibVersionInfo -> DataType
LibVersionInfo -> Constr
(forall b. Data b => b -> b) -> LibVersionInfo -> LibVersionInfo
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> LibVersionInfo -> u
forall u. (forall d. Data d => d -> u) -> LibVersionInfo -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LibVersionInfo -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LibVersionInfo -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LibVersionInfo -> m LibVersionInfo
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibVersionInfo -> m LibVersionInfo
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LibVersionInfo
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LibVersionInfo -> c LibVersionInfo
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LibVersionInfo)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LibVersionInfo)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibVersionInfo -> m LibVersionInfo
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibVersionInfo -> m LibVersionInfo
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibVersionInfo -> m LibVersionInfo
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibVersionInfo -> m LibVersionInfo
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LibVersionInfo -> m LibVersionInfo
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LibVersionInfo -> m LibVersionInfo
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> LibVersionInfo -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> LibVersionInfo -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> LibVersionInfo -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LibVersionInfo -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LibVersionInfo -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LibVersionInfo -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LibVersionInfo -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LibVersionInfo -> r
gmapT :: (forall b. Data b => b -> b) -> LibVersionInfo -> LibVersionInfo
$cgmapT :: (forall b. Data b => b -> b) -> LibVersionInfo -> LibVersionInfo
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LibVersionInfo)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LibVersionInfo)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LibVersionInfo)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LibVersionInfo)
dataTypeOf :: LibVersionInfo -> DataType
$cdataTypeOf :: LibVersionInfo -> DataType
toConstr :: LibVersionInfo -> Constr
$ctoConstr :: LibVersionInfo -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LibVersionInfo
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LibVersionInfo
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LibVersionInfo -> c LibVersionInfo
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LibVersionInfo -> c LibVersionInfo
Data, LibVersionInfo -> LibVersionInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LibVersionInfo -> LibVersionInfo -> Bool
$c/= :: LibVersionInfo -> LibVersionInfo -> Bool
== :: LibVersionInfo -> LibVersionInfo -> Bool
$c== :: LibVersionInfo -> LibVersionInfo -> Bool
Eq, forall x. Rep LibVersionInfo x -> LibVersionInfo
forall x. LibVersionInfo -> Rep LibVersionInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LibVersionInfo x -> LibVersionInfo
$cfrom :: forall x. LibVersionInfo -> Rep LibVersionInfo x
Generic, Typeable)
instance Ord LibVersionInfo where
LibVersionInfo Int
c Int
r Int
_ compare :: LibVersionInfo -> LibVersionInfo -> Ordering
`compare` LibVersionInfo Int
c' Int
r' Int
_ =
case Int
c forall a. Ord a => a -> a -> Ordering
`compare` Int
c' of
Ordering
EQ -> Int
r forall a. Ord a => a -> a -> Ordering
`compare` Int
r'
Ordering
e -> Ordering
e
instance Show LibVersionInfo where
showsPrec :: Int -> LibVersionInfo -> ShowS
showsPrec Int
d (LibVersionInfo Int
c Int
r Int
a) = Bool -> ShowS -> ShowS
showParen (Int
d forall a. Ord a => a -> a -> Bool
> Int
10)
forall a b. (a -> b) -> a -> b
$ FilePath -> ShowS
showString FilePath
"mkLibVersionInfo "
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 (Int
c,Int
r,Int
a)
instance Read LibVersionInfo where
readPrec :: ReadPrec LibVersionInfo
readPrec = forall a. ReadPrec a -> ReadPrec a
Read.parens forall a b. (a -> b) -> a -> b
$ do
Read.Ident FilePath
"mkLibVersionInfo" <- ReadPrec Lexeme
Read.lexP
(Int, Int, Int)
t <- forall a. ReadPrec a -> ReadPrec a
Read.step forall a. Read a => ReadPrec a
Read.readPrec
forall (m :: * -> *) a. Monad m => a -> m a
return ((Int, Int, Int) -> LibVersionInfo
mkLibVersionInfo (Int, Int, Int)
t)
instance Binary LibVersionInfo
instance Structured LibVersionInfo
instance NFData LibVersionInfo where rnf :: LibVersionInfo -> ()
rnf = forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf
instance Pretty LibVersionInfo where
pretty :: LibVersionInfo -> Doc
pretty (LibVersionInfo Int
c Int
r Int
a)
= [Doc] -> Doc
Disp.hcat forall a b. (a -> b) -> a -> b
$ Doc -> [Doc] -> [Doc]
Disp.punctuate (Char -> Doc
Disp.char Char
':') forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map Int -> Doc
Disp.int [Int
c,Int
r,Int
a]
instance Parsec LibVersionInfo where
parsec :: forall (m :: * -> *). CabalParsing m => m LibVersionInfo
parsec = do
Int
c <- forall (m :: * -> *) a. (CharParsing m, Integral a) => m a
P.integral
(Int
r, Int
a) <- forall (m :: * -> *) a. Alternative m => a -> m a -> m a
P.option (Int
0,Int
0) forall a b. (a -> b) -> a -> b
$ do
Char
_ <- forall (m :: * -> *). CharParsing m => Char -> m Char
P.char Char
':'
Int
r <- forall (m :: * -> *) a. (CharParsing m, Integral a) => m a
P.integral
Int
a <- forall (m :: * -> *) a. Alternative m => a -> m a -> m a
P.option Int
0 forall a b. (a -> b) -> a -> b
$ do
Char
_ <- forall (m :: * -> *). CharParsing m => Char -> m Char
P.char Char
':'
forall (m :: * -> *) a. (CharParsing m, Integral a) => m a
P.integral
forall (m :: * -> *) a. Monad m => a -> m a
return (Int
r,Int
a)
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ (Int, Int, Int) -> LibVersionInfo
mkLibVersionInfo (Int
c,Int
r,Int
a)
mkLibVersionInfo :: (Int, Int, Int) -> LibVersionInfo
mkLibVersionInfo :: (Int, Int, Int) -> LibVersionInfo
mkLibVersionInfo (Int
c,Int
r,Int
a) = Int -> Int -> Int -> LibVersionInfo
LibVersionInfo Int
c Int
r Int
a
libVersionInfoCRA :: LibVersionInfo -> (Int, Int, Int)
libVersionInfoCRA :: LibVersionInfo -> (Int, Int, Int)
libVersionInfoCRA (LibVersionInfo Int
c Int
r Int
a) = (Int
c,Int
r,Int
a)
libVersionNumber :: LibVersionInfo -> (Int, Int, Int)
libVersionNumber :: LibVersionInfo -> (Int, Int, Int)
libVersionNumber (LibVersionInfo Int
c Int
r Int
a) = (Int
cforall a. Num a => a -> a -> a
-Int
a , Int
a , Int
r)
libVersionNumberShow :: LibVersionInfo -> String
libVersionNumberShow :: LibVersionInfo -> FilePath
libVersionNumberShow LibVersionInfo
v =
let (Int
major, Int
minor, Int
build) = LibVersionInfo -> (Int, Int, Int)
libVersionNumber LibVersionInfo
v
in forall a. Show a => a -> FilePath
show Int
major forall a. [a] -> [a] -> [a]
++ FilePath
"." forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> FilePath
show Int
minor forall a. [a] -> [a] -> [a]
++ FilePath
"." forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> FilePath
show Int
build
libVersionMajor :: LibVersionInfo -> Int
libVersionMajor :: LibVersionInfo -> Int
libVersionMajor (LibVersionInfo Int
c Int
_ Int
a) = Int
cforall a. Num a => a -> a -> a
-Int
a
instance L.HasBuildInfo ForeignLib where
buildInfo :: Lens' ForeignLib BuildInfo
buildInfo BuildInfo -> f BuildInfo
f ForeignLib
l = (\BuildInfo
x -> ForeignLib
l { foreignLibBuildInfo :: BuildInfo
foreignLibBuildInfo = BuildInfo
x }) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BuildInfo -> f BuildInfo
f (ForeignLib -> BuildInfo
foreignLibBuildInfo ForeignLib
l)
instance Binary ForeignLib
instance Structured ForeignLib
instance NFData ForeignLib where rnf :: ForeignLib -> ()
rnf = forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf
instance Semigroup ForeignLib where
ForeignLib
a <> :: ForeignLib -> ForeignLib -> ForeignLib
<> ForeignLib
b = ForeignLib {
foreignLibName :: UnqualComponentName
foreignLibName = (ForeignLib -> UnqualComponentName) -> UnqualComponentName
combine' ForeignLib -> UnqualComponentName
foreignLibName
, foreignLibType :: ForeignLibType
foreignLibType = forall {a}. Monoid a => (ForeignLib -> a) -> a
combine ForeignLib -> ForeignLibType
foreignLibType
, foreignLibOptions :: [ForeignLibOption]
foreignLibOptions = forall {a}. Monoid a => (ForeignLib -> a) -> a
combine ForeignLib -> [ForeignLibOption]
foreignLibOptions
, foreignLibBuildInfo :: BuildInfo
foreignLibBuildInfo = forall {a}. Monoid a => (ForeignLib -> a) -> a
combine ForeignLib -> BuildInfo
foreignLibBuildInfo
, foreignLibVersionInfo :: Maybe LibVersionInfo
foreignLibVersionInfo = forall {t}. (ForeignLib -> t) -> t
combine'' ForeignLib -> Maybe LibVersionInfo
foreignLibVersionInfo
, foreignLibVersionLinux :: Maybe Version
foreignLibVersionLinux = forall {t}. (ForeignLib -> t) -> t
combine'' ForeignLib -> Maybe Version
foreignLibVersionLinux
, foreignLibModDefFile :: [FilePath]
foreignLibModDefFile = forall {a}. Monoid a => (ForeignLib -> a) -> a
combine ForeignLib -> [FilePath]
foreignLibModDefFile
}
where combine :: (ForeignLib -> a) -> a
combine ForeignLib -> a
field = ForeignLib -> a
field ForeignLib
a forall a. Monoid a => a -> a -> a
`mappend` ForeignLib -> a
field ForeignLib
b
combine' :: (ForeignLib -> UnqualComponentName) -> UnqualComponentName
combine' ForeignLib -> UnqualComponentName
field = case ( UnqualComponentName -> FilePath
unUnqualComponentName forall a b. (a -> b) -> a -> b
$ ForeignLib -> UnqualComponentName
field ForeignLib
a
, UnqualComponentName -> FilePath
unUnqualComponentName forall a b. (a -> b) -> a -> b
$ ForeignLib -> UnqualComponentName
field ForeignLib
b) of
(FilePath
"", FilePath
_) -> ForeignLib -> UnqualComponentName
field ForeignLib
b
(FilePath
_, FilePath
"") -> ForeignLib -> UnqualComponentName
field ForeignLib
a
(FilePath
x, FilePath
y) -> forall a. HasCallStack => FilePath -> a
error forall a b. (a -> b) -> a -> b
$ FilePath
"Ambiguous values for executable field: '"
forall a. [a] -> [a] -> [a]
++ FilePath
x forall a. [a] -> [a] -> [a]
++ FilePath
"' and '" forall a. [a] -> [a] -> [a]
++ FilePath
y forall a. [a] -> [a] -> [a]
++ FilePath
"'"
combine'' :: (ForeignLib -> t) -> t
combine'' ForeignLib -> t
field = ForeignLib -> t
field ForeignLib
b
instance Monoid ForeignLib where
mempty :: ForeignLib
mempty = ForeignLib {
foreignLibName :: UnqualComponentName
foreignLibName = forall a. Monoid a => a
mempty
, foreignLibType :: ForeignLibType
foreignLibType = ForeignLibType
ForeignLibTypeUnknown
, foreignLibOptions :: [ForeignLibOption]
foreignLibOptions = []
, foreignLibBuildInfo :: BuildInfo
foreignLibBuildInfo = forall a. Monoid a => a
mempty
, foreignLibVersionInfo :: Maybe LibVersionInfo
foreignLibVersionInfo = forall a. Maybe a
Nothing
, foreignLibVersionLinux :: Maybe Version
foreignLibVersionLinux = forall a. Maybe a
Nothing
, foreignLibModDefFile :: [FilePath]
foreignLibModDefFile = []
}
mappend :: ForeignLib -> ForeignLib -> ForeignLib
mappend = forall a. Semigroup a => a -> a -> a
(<>)
emptyForeignLib :: ForeignLib
emptyForeignLib :: ForeignLib
emptyForeignLib = forall a. Monoid a => a
mempty
foreignLibModules :: ForeignLib -> [ModuleName]
foreignLibModules :: ForeignLib -> [ModuleName]
foreignLibModules = BuildInfo -> [ModuleName]
otherModules forall b c a. (b -> c) -> (a -> b) -> a -> c
. ForeignLib -> BuildInfo
foreignLibBuildInfo
foreignLibIsShared :: ForeignLib -> Bool
foreignLibIsShared :: ForeignLib -> Bool
foreignLibIsShared = ForeignLibType -> Bool
foreignLibTypeIsShared forall b c a. (b -> c) -> (a -> b) -> a -> c
. ForeignLib -> ForeignLibType
foreignLibType
foreignLibVersion :: ForeignLib -> OS -> [Int]
foreignLibVersion :: ForeignLib -> OS -> [Int]
foreignLibVersion ForeignLib
flib OS
Linux =
case ForeignLib -> Maybe Version
foreignLibVersionLinux ForeignLib
flib of
Just Version
v -> Version -> [Int]
versionNumbers Version
v
Maybe Version
Nothing ->
case ForeignLib -> Maybe LibVersionInfo
foreignLibVersionInfo ForeignLib
flib of
Just LibVersionInfo
v' ->
let (Int
major, Int
minor, Int
build) = LibVersionInfo -> (Int, Int, Int)
libVersionNumber LibVersionInfo
v'
in [Int
major, Int
minor, Int
build]
Maybe LibVersionInfo
Nothing -> []
foreignLibVersion ForeignLib
_ OS
_ = []