{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE CPP #-}
module Distribution.Nixpkgs.Meta
(
Meta, nullMeta
, homepage, description, license, platforms, badPlatforms, hydraPlatforms, mainProgram, maintainers, broken
, NixpkgsPlatform (..)
, nixpkgsPlatformFromString
) where
#if MIN_VERSION_base(4,11,0)
import Prelude hiding ( (<>) )
#endif
import Control.Applicative ( (<|>) )
import Control.DeepSeq
import Control.Lens hiding ( Strict )
import Data.List ( stripPrefix )
import Data.Set ( Set )
import qualified Data.Set as Set
import Distribution.Nixpkgs.License
import qualified Distribution.Pretty as CabalPretty
import Distribution.System
import GHC.Generics ( Generic )
import Language.Nix.Identifier
import Language.Nix.Path ( path )
import Language.Nix.PrettyPrinting
data NixpkgsPlatform
= NixpkgsPlatformSingle Platform
| NixpkgsPlatformGroup Identifier
deriving (Int -> NixpkgsPlatform -> ShowS
[NixpkgsPlatform] -> ShowS
NixpkgsPlatform -> String
(Int -> NixpkgsPlatform -> ShowS)
-> (NixpkgsPlatform -> String)
-> ([NixpkgsPlatform] -> ShowS)
-> Show NixpkgsPlatform
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NixpkgsPlatform] -> ShowS
$cshowList :: [NixpkgsPlatform] -> ShowS
show :: NixpkgsPlatform -> String
$cshow :: NixpkgsPlatform -> String
showsPrec :: Int -> NixpkgsPlatform -> ShowS
$cshowsPrec :: Int -> NixpkgsPlatform -> ShowS
Show, NixpkgsPlatform -> NixpkgsPlatform -> Bool
(NixpkgsPlatform -> NixpkgsPlatform -> Bool)
-> (NixpkgsPlatform -> NixpkgsPlatform -> Bool)
-> Eq NixpkgsPlatform
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
$c/= :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
== :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
$c== :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
Eq, Eq NixpkgsPlatform
Eq NixpkgsPlatform
-> (NixpkgsPlatform -> NixpkgsPlatform -> Ordering)
-> (NixpkgsPlatform -> NixpkgsPlatform -> Bool)
-> (NixpkgsPlatform -> NixpkgsPlatform -> Bool)
-> (NixpkgsPlatform -> NixpkgsPlatform -> Bool)
-> (NixpkgsPlatform -> NixpkgsPlatform -> Bool)
-> (NixpkgsPlatform -> NixpkgsPlatform -> NixpkgsPlatform)
-> (NixpkgsPlatform -> NixpkgsPlatform -> NixpkgsPlatform)
-> Ord NixpkgsPlatform
NixpkgsPlatform -> NixpkgsPlatform -> Bool
NixpkgsPlatform -> NixpkgsPlatform -> Ordering
NixpkgsPlatform -> NixpkgsPlatform -> NixpkgsPlatform
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 :: NixpkgsPlatform -> NixpkgsPlatform -> NixpkgsPlatform
$cmin :: NixpkgsPlatform -> NixpkgsPlatform -> NixpkgsPlatform
max :: NixpkgsPlatform -> NixpkgsPlatform -> NixpkgsPlatform
$cmax :: NixpkgsPlatform -> NixpkgsPlatform -> NixpkgsPlatform
>= :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
$c>= :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
> :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
$c> :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
<= :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
$c<= :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
< :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
$c< :: NixpkgsPlatform -> NixpkgsPlatform -> Bool
compare :: NixpkgsPlatform -> NixpkgsPlatform -> Ordering
$ccompare :: NixpkgsPlatform -> NixpkgsPlatform -> Ordering
$cp1Ord :: Eq NixpkgsPlatform
Ord, (forall x. NixpkgsPlatform -> Rep NixpkgsPlatform x)
-> (forall x. Rep NixpkgsPlatform x -> NixpkgsPlatform)
-> Generic NixpkgsPlatform
forall x. Rep NixpkgsPlatform x -> NixpkgsPlatform
forall x. NixpkgsPlatform -> Rep NixpkgsPlatform x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NixpkgsPlatform x -> NixpkgsPlatform
$cfrom :: forall x. NixpkgsPlatform -> Rep NixpkgsPlatform x
Generic)
nixpkgsPlatformFromCabal :: Platform -> String
nixpkgsPlatformFromCabal :: Platform -> String
nixpkgsPlatformFromCabal (Platform Arch
arch OS
os) = String
"\"" String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
nixArch String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"-" String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
nixOs String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"\""
where nixArch :: String
nixArch =
case Arch
arch of
Arch
I386 -> String
"i686"
Arch
PPC -> String
"powerpc"
Arch
PPC64 -> String
"powerpc64"
Arch
JavaScript -> String
"js"
Arch
_ -> Arch -> String
forall a. Pretty a => a -> String
CabalPretty.prettyShow Arch
arch
nixOs :: String
nixOs =
case OS
os of
OS
OSX -> String
"darwin"
OS
_ -> OS -> String
forall a. Pretty a => a -> String
CabalPretty.prettyShow OS
os
nixpkgsPlatformFromString :: String -> Maybe NixpkgsPlatform
nixpkgsPlatformFromString :: String -> Maybe NixpkgsPlatform
nixpkgsPlatformFromString String
s = Maybe NixpkgsPlatform
platformGroup Maybe NixpkgsPlatform
-> Maybe NixpkgsPlatform -> Maybe NixpkgsPlatform
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Maybe NixpkgsPlatform
singlePlatform
where platformGroup :: Maybe NixpkgsPlatform
platformGroup = do
String
name <- String -> String -> Maybe String
forall a. Eq a => [a] -> [a] -> Maybe [a]
stripPrefix String
"lib.platforms." String
s Maybe String -> Maybe String -> Maybe String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> String -> Maybe String
forall a. Eq a => [a] -> [a] -> Maybe [a]
stripPrefix String
"platforms." String
s
NixpkgsPlatform -> Maybe NixpkgsPlatform
forall a. a -> Maybe a
Just (NixpkgsPlatform -> Maybe NixpkgsPlatform)
-> NixpkgsPlatform -> Maybe NixpkgsPlatform
forall a b. (a -> b) -> a -> b
$ Identifier -> NixpkgsPlatform
NixpkgsPlatformGroup (Tagged String (Identity String)
-> Tagged Identifier (Identity Identifier)
Iso' Identifier String
ident (Tagged String (Identity String)
-> Tagged Identifier (Identity Identifier))
-> String -> Identifier
forall t b. AReview t b -> b -> t
# String
name)
singlePlatform :: Maybe NixpkgsPlatform
singlePlatform = Platform -> NixpkgsPlatform
NixpkgsPlatformSingle (Platform -> NixpkgsPlatform)
-> Maybe Platform -> Maybe NixpkgsPlatform
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> Maybe Platform
cabalPlatformFromSystem String
s
cabalPlatformFromSystem :: String -> Maybe Platform
cabalPlatformFromSystem :: String -> Maybe Platform
cabalPlatformFromSystem String
s =
case (Char -> Bool) -> String -> (String, String)
forall a. (a -> Bool) -> [a] -> ([a], [a])
break (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'-') String
s of
(String
arch, Char
'-':String
os) ->
if String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
arch Bool -> Bool -> Bool
|| String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
os
then Maybe Platform
forall a. Maybe a
Nothing
else Platform -> Maybe Platform
forall a. a -> Maybe a
Just (Platform -> Maybe Platform) -> Platform -> Maybe Platform
forall a b. (a -> b) -> a -> b
$ Arch -> OS -> Platform
Platform (String -> Arch
parseArch String
arch) (String -> OS
parseOS String
os)
(String, String)
_ -> Maybe Platform
forall a. Maybe a
Nothing
where
parseOS :: String -> OS
parseOS = ClassificationStrictness -> String -> OS
classifyOS ClassificationStrictness
Permissive
parseArch :: String -> Arch
parseArch String
as =
case ClassificationStrictness -> String -> Arch
classifyArch ClassificationStrictness
Strict String
as of
OtherArch String
"i686" -> Arch
I386
OtherArch String
"js" -> Arch
JavaScript
OtherArch String
"powerpc" -> Arch
PPC
OtherArch String
"powerpc64" -> Arch
PPC64
Arch
a -> Arch
a
instance Pretty NixpkgsPlatform where
pPrint :: NixpkgsPlatform -> Doc
pPrint (NixpkgsPlatformSingle Platform
p) = String -> Doc
text (String -> Doc) -> String -> Doc
forall a b. (a -> b) -> a -> b
$ Platform -> String
nixpkgsPlatformFromCabal Platform
p
pPrint (NixpkgsPlatformGroup Identifier
p) = Path -> Doc
forall a. Pretty a => a -> Doc
pPrint
(Path -> Doc) -> Path -> Doc
forall a b. (a -> b) -> a -> b
$ Tagged [Identifier] (Identity [Identifier])
-> Tagged Path (Identity Path)
Iso' Path [Identifier]
path (Tagged [Identifier] (Identity [Identifier])
-> Tagged Path (Identity Path))
-> [Identifier] -> Path
forall t b. AReview t b -> b -> t
# [ Tagged String (Identity String)
-> Tagged Identifier (Identity Identifier)
Iso' Identifier String
ident (Tagged String (Identity String)
-> Tagged Identifier (Identity Identifier))
-> String -> Identifier
forall t b. AReview t b -> b -> t
# String
"lib", Tagged String (Identity String)
-> Tagged Identifier (Identity Identifier)
Iso' Identifier String
ident (Tagged String (Identity String)
-> Tagged Identifier (Identity Identifier))
-> String -> Identifier
forall t b. AReview t b -> b -> t
# String
"platforms", Identifier
p ]
instance NFData NixpkgsPlatform
data Meta = Meta
{ Meta -> String
_homepage :: String
, Meta -> String
_description :: String
, Meta -> License
_license :: License
, Meta -> Maybe (Set NixpkgsPlatform)
_platforms :: Maybe (Set NixpkgsPlatform)
, Meta -> Maybe (Set NixpkgsPlatform)
_badPlatforms :: Maybe (Set NixpkgsPlatform)
, Meta -> Maybe (Set NixpkgsPlatform)
_hydraPlatforms :: Maybe (Set NixpkgsPlatform)
, Meta -> Maybe String
_mainProgram :: Maybe String
, Meta -> Set Identifier
_maintainers :: Set Identifier
, Meta -> Bool
_broken :: Bool
}
deriving (Int -> Meta -> ShowS
[Meta] -> ShowS
Meta -> String
(Int -> Meta -> ShowS)
-> (Meta -> String) -> ([Meta] -> ShowS) -> Show Meta
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Meta] -> ShowS
$cshowList :: [Meta] -> ShowS
show :: Meta -> String
$cshow :: Meta -> String
showsPrec :: Int -> Meta -> ShowS
$cshowsPrec :: Int -> Meta -> ShowS
Show, Meta -> Meta -> Bool
(Meta -> Meta -> Bool) -> (Meta -> Meta -> Bool) -> Eq Meta
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Meta -> Meta -> Bool
$c/= :: Meta -> Meta -> Bool
== :: Meta -> Meta -> Bool
$c== :: Meta -> Meta -> Bool
Eq, Eq Meta
Eq Meta
-> (Meta -> Meta -> Ordering)
-> (Meta -> Meta -> Bool)
-> (Meta -> Meta -> Bool)
-> (Meta -> Meta -> Bool)
-> (Meta -> Meta -> Bool)
-> (Meta -> Meta -> Meta)
-> (Meta -> Meta -> Meta)
-> Ord Meta
Meta -> Meta -> Bool
Meta -> Meta -> Ordering
Meta -> Meta -> Meta
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 :: Meta -> Meta -> Meta
$cmin :: Meta -> Meta -> Meta
max :: Meta -> Meta -> Meta
$cmax :: Meta -> Meta -> Meta
>= :: Meta -> Meta -> Bool
$c>= :: Meta -> Meta -> Bool
> :: Meta -> Meta -> Bool
$c> :: Meta -> Meta -> Bool
<= :: Meta -> Meta -> Bool
$c<= :: Meta -> Meta -> Bool
< :: Meta -> Meta -> Bool
$c< :: Meta -> Meta -> Bool
compare :: Meta -> Meta -> Ordering
$ccompare :: Meta -> Meta -> Ordering
$cp1Ord :: Eq Meta
Ord, (forall x. Meta -> Rep Meta x)
-> (forall x. Rep Meta x -> Meta) -> Generic Meta
forall x. Rep Meta x -> Meta
forall x. Meta -> Rep Meta x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Meta x -> Meta
$cfrom :: forall x. Meta -> Rep Meta x
Generic)
makeLenses ''Meta
instance NFData Meta
instance Pretty Meta where
pPrint :: Meta -> Doc
pPrint Meta {Bool
String
Maybe String
Maybe (Set NixpkgsPlatform)
Set Identifier
License
_broken :: Bool
_maintainers :: Set Identifier
_mainProgram :: Maybe String
_hydraPlatforms :: Maybe (Set NixpkgsPlatform)
_badPlatforms :: Maybe (Set NixpkgsPlatform)
_platforms :: Maybe (Set NixpkgsPlatform)
_license :: License
_description :: String
_homepage :: String
_broken :: Meta -> Bool
_maintainers :: Meta -> Set Identifier
_mainProgram :: Meta -> Maybe String
_hydraPlatforms :: Meta -> Maybe (Set NixpkgsPlatform)
_badPlatforms :: Meta -> Maybe (Set NixpkgsPlatform)
_platforms :: Meta -> Maybe (Set NixpkgsPlatform)
_license :: Meta -> License
_description :: Meta -> String
_homepage :: Meta -> String
..} = [Doc] -> Doc
vcat
[ Bool -> Doc -> Doc
onlyIf (Bool -> Bool
not (String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
_homepage)) (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ String -> Doc -> Doc
attr String
"homepage" (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ String -> Doc
string String
_homepage
, Bool -> Doc -> Doc
onlyIf (Bool -> Bool
not (String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
_description)) (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ String -> Doc -> Doc
attr String
"description" (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ String -> Doc
string String
_description
, String -> Doc -> Doc
attr String
"license" (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ License -> Doc
forall a. Pretty a => a -> Doc
pPrint License
_license
, Doc
-> (Set NixpkgsPlatform -> Doc)
-> Maybe (Set NixpkgsPlatform)
-> Doc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Doc
forall a. Monoid a => a
mempty (String -> Set NixpkgsPlatform -> Doc
renderPlatforms String
"platforms") Maybe (Set NixpkgsPlatform)
_platforms
, Doc
-> (Set NixpkgsPlatform -> Doc)
-> Maybe (Set NixpkgsPlatform)
-> Doc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Doc
forall a. Monoid a => a
mempty (String -> Set NixpkgsPlatform -> Doc
renderPlatforms String
"badPlatforms") Maybe (Set NixpkgsPlatform)
_badPlatforms
, Doc
-> (Set NixpkgsPlatform -> Doc)
-> Maybe (Set NixpkgsPlatform)
-> Doc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Doc
forall a. Monoid a => a
mempty (String -> Set NixpkgsPlatform -> Doc
renderPlatforms String
"hydraPlatforms") Maybe (Set NixpkgsPlatform)
_hydraPlatforms
, Doc -> (String -> Doc) -> Maybe String -> Doc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Doc
forall a. Monoid a => a
mempty (String -> Doc -> Doc
attr String
"mainProgram" (Doc -> Doc) -> (String -> Doc) -> String -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Doc
string) Maybe String
_mainProgram
, String -> Doc -> [Doc] -> Doc
listattrDoc String
"maintainers" Doc
forall a. Monoid a => a
mempty ([Doc] -> Doc) -> [Doc] -> Doc
forall a b. (a -> b) -> a -> b
$ Set Identifier -> [Doc]
renderMaintainers Set Identifier
_maintainers
, String -> Bool -> Bool -> Doc
boolattr String
"broken" Bool
_broken Bool
_broken
]
renderPlatforms :: String -> Set NixpkgsPlatform -> Doc
renderPlatforms :: String -> Set NixpkgsPlatform -> Doc
renderPlatforms String
field Set NixpkgsPlatform
ps
| Set NixpkgsPlatform -> Bool
forall a. Set a -> Bool
Set.null Set NixpkgsPlatform
ps = [Doc] -> Doc
sep [ String -> Doc
text String
field Doc -> Doc -> Doc
<+> Doc
equals Doc -> Doc -> Doc
<+> String -> Doc
text String
"lib.platforms.none" Doc -> Doc -> Doc
<> Doc
semi ]
| Bool
otherwise =
[Doc] -> Doc
sep [ String -> Doc
text String
field Doc -> Doc -> Doc
<+> Doc
equals Doc -> Doc -> Doc
<+> Bool -> Doc -> Doc
forall p. Monoid p => Bool -> p -> p
unless (Set NixpkgsPlatform -> Bool
forall a. Set a -> Bool
Set.null Set NixpkgsPlatform
cabalPs) Doc
lbrack
, Bool -> Doc -> Doc
forall p. Monoid p => Bool -> p -> p
unless (Set NixpkgsPlatform -> Bool
forall a. Set a -> Bool
Set.null Set NixpkgsPlatform
cabalPs) (Int -> Doc -> Doc
nest Int
2 (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ [Doc] -> Doc
fsep [Doc]
renderedCabalPs)
, Bool -> Doc -> Doc
forall p. Monoid p => Bool -> p -> p
unless (Set NixpkgsPlatform -> Bool
forall a. Set a -> Bool
Set.null Set NixpkgsPlatform
cabalPs) Doc
rbrack
, Bool -> Doc -> Doc
forall p. Monoid p => Bool -> p -> p
unless (Set NixpkgsPlatform -> Bool
forall a. Set a -> Bool
Set.null Set NixpkgsPlatform
nixpkgsPs) (Int -> Doc -> Doc
nest Int
2 Doc
renderedNixpkgsPs)
]
Doc -> Doc -> Doc
<> Doc
semi
where
(Set NixpkgsPlatform
cabalPs, Set NixpkgsPlatform
nixpkgsPs) = (NixpkgsPlatform -> Bool)
-> Set NixpkgsPlatform
-> (Set NixpkgsPlatform, Set NixpkgsPlatform)
forall a. (a -> Bool) -> Set a -> (Set a, Set a)
Set.partition NixpkgsPlatform -> Bool
isSinglePlatform Set NixpkgsPlatform
ps
isSinglePlatform :: NixpkgsPlatform -> Bool
isSinglePlatform (NixpkgsPlatformSingle Platform
_) = Bool
True
isSinglePlatform NixpkgsPlatform
_ = Bool
False
renderedCabalPs :: [Doc]
renderedCabalPs = (NixpkgsPlatform -> Doc) -> [NixpkgsPlatform] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map NixpkgsPlatform -> Doc
forall a. Pretty a => a -> Doc
pPrint ([NixpkgsPlatform] -> [Doc]) -> [NixpkgsPlatform] -> [Doc]
forall a b. (a -> b) -> a -> b
$ Set NixpkgsPlatform -> [NixpkgsPlatform]
forall a. Set a -> [a]
Set.toAscList Set NixpkgsPlatform
cabalPs
appendNixpkgsP :: Doc -> a -> Doc
appendNixpkgsP Doc
acc a
elem = Doc
acc Doc -> Doc -> Doc
$$
if Doc -> Bool
isEmpty Doc
acc Bool -> Bool -> Bool
&& Set NixpkgsPlatform -> Bool
forall a. Set a -> Bool
Set.null Set NixpkgsPlatform
cabalPs
then Int -> Doc -> Doc
nest Int
3 (Doc -> Doc) -> Doc -> Doc
forall a b. (a -> b) -> a -> b
$ a -> Doc
forall a. Pretty a => a -> Doc
pPrint a
elem
else String -> Doc
text String
"++" Doc -> Doc -> Doc
<+> a -> Doc
forall a. Pretty a => a -> Doc
pPrint a
elem
renderedNixpkgsPs :: Doc
renderedNixpkgsPs = (Doc -> NixpkgsPlatform -> Doc)
-> Doc -> Set NixpkgsPlatform -> Doc
forall a b. (a -> b -> a) -> a -> Set b -> a
Set.foldl' Doc -> NixpkgsPlatform -> Doc
forall a. Pretty a => Doc -> a -> Doc
appendNixpkgsP Doc
forall a. Monoid a => a
mempty Set NixpkgsPlatform
nixpkgsPs
unless :: Bool -> p -> p
unless Bool
False p
x = p
x
unless Bool
True p
_ = p
forall a. Monoid a => a
mempty
renderMaintainers :: Set Identifier -> [Doc]
renderMaintainers :: Set Identifier -> [Doc]
renderMaintainers = (Identifier -> Doc) -> [Identifier] -> [Doc]
forall a b. (a -> b) -> [a] -> [b]
map (Path -> Doc
forall a. Pretty a => a -> Doc
pPrint (Path -> Doc) -> (Identifier -> Path) -> Identifier -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Identifier -> Path
toPath) ([Identifier] -> [Doc])
-> (Set Identifier -> [Identifier]) -> Set Identifier -> [Doc]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Identifier -> String) -> Set Identifier -> [Identifier]
forall a. (a -> String) -> Set a -> [a]
toAscListSortedOn (Getting String Identifier String -> Identifier -> String
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting String Identifier String
Iso' Identifier String
ident)
where toPath :: Identifier -> Path
toPath Identifier
m = Tagged [Identifier] (Identity [Identifier])
-> Tagged Path (Identity Path)
Iso' Path [Identifier]
path (Tagged [Identifier] (Identity [Identifier])
-> Tagged Path (Identity Path))
-> [Identifier] -> Path
forall t b. AReview t b -> b -> t
# [ Tagged String (Identity String)
-> Tagged Identifier (Identity Identifier)
Iso' Identifier String
ident (Tagged String (Identity String)
-> Tagged Identifier (Identity Identifier))
-> String -> Identifier
forall t b. AReview t b -> b -> t
# String
"lib", Tagged String (Identity String)
-> Tagged Identifier (Identity Identifier)
Iso' Identifier String
ident (Tagged String (Identity String)
-> Tagged Identifier (Identity Identifier))
-> String -> Identifier
forall t b. AReview t b -> b -> t
# String
"maintainers", Identifier
m]
nullMeta :: Meta
nullMeta :: Meta
nullMeta = Meta :: String
-> String
-> License
-> Maybe (Set NixpkgsPlatform)
-> Maybe (Set NixpkgsPlatform)
-> Maybe (Set NixpkgsPlatform)
-> Maybe String
-> Set Identifier
-> Bool
-> Meta
Meta
{ _homepage :: String
_homepage = ShowS
forall a. HasCallStack => String -> a
error String
"undefined Meta.homepage"
, _description :: String
_description = ShowS
forall a. HasCallStack => String -> a
error String
"undefined Meta.description"
, _license :: License
_license = String -> License
forall a. HasCallStack => String -> a
error String
"undefined Meta.license"
, _platforms :: Maybe (Set NixpkgsPlatform)
_platforms = String -> Maybe (Set NixpkgsPlatform)
forall a. HasCallStack => String -> a
error String
"undefined Meta.platforms"
, _badPlatforms :: Maybe (Set NixpkgsPlatform)
_badPlatforms = String -> Maybe (Set NixpkgsPlatform)
forall a. HasCallStack => String -> a
error String
"undefined Meta.badPlatforms"
, _hydraPlatforms :: Maybe (Set NixpkgsPlatform)
_hydraPlatforms = String -> Maybe (Set NixpkgsPlatform)
forall a. HasCallStack => String -> a
error String
"undefined Meta.hydraPlatforms"
, _mainProgram :: Maybe String
_mainProgram = String -> Maybe String
forall a. HasCallStack => String -> a
error String
"undefined Meta.mainProgram"
, _maintainers :: Set Identifier
_maintainers = String -> Set Identifier
forall a. HasCallStack => String -> a
error String
"undefined Meta.maintainers"
, _broken :: Bool
_broken = String -> Bool
forall a. HasCallStack => String -> a
error String
"undefined Meta.broken"
}