{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE StandaloneDeriving #-}

-- | Cabal-like file AST types: 'Field', 'Section' etc
--
-- These types are parametrized by an annotation.
module Distribution.Fields.Field
  ( -- * Cabal file
    Field (..)
  , fieldName
  , fieldAnn
  , fieldUniverse
  , FieldLine (..)
  , fieldLineAnn
  , fieldLineBS
  , SectionArg (..)
  , sectionArgAnn

    -- * Name
  , FieldName
  , Name (..)
  , mkName
  , getName
  , nameAnn

    -- * Conversions to String
  , sectionArgsToString
  , fieldLinesToString
  ) where

import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as B
import qualified Data.Char as Char
import Distribution.Compat.Prelude
import Distribution.Pretty (showTokenStr)
import Distribution.Utils.Generic (fromUTF8BS)
import Prelude ()
#if MIN_VERSION_base(4,18,0)
import qualified Data.Foldable1 as F1
#endif

-------------------------------------------------------------------------------
-- Cabal file
-------------------------------------------------------------------------------

-- | A Cabal-like file consists of a series of fields (@foo: bar@) and sections (@library ...@).
data Field ann
  = Field !(Name ann) [FieldLine ann]
  | Section !(Name ann) [SectionArg ann] [Field ann]
  deriving (Field ann -> Field ann -> Bool
(Field ann -> Field ann -> Bool)
-> (Field ann -> Field ann -> Bool) -> Eq (Field ann)
forall ann. Eq ann => Field ann -> Field ann -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall ann. Eq ann => Field ann -> Field ann -> Bool
== :: Field ann -> Field ann -> Bool
$c/= :: forall ann. Eq ann => Field ann -> Field ann -> Bool
/= :: Field ann -> Field ann -> Bool
Eq, Int -> Field ann -> ShowS
[Field ann] -> ShowS
Field ann -> String
(Int -> Field ann -> ShowS)
-> (Field ann -> String)
-> ([Field ann] -> ShowS)
-> Show (Field ann)
forall ann. Show ann => Int -> Field ann -> ShowS
forall ann. Show ann => [Field ann] -> ShowS
forall ann. Show ann => Field ann -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall ann. Show ann => Int -> Field ann -> ShowS
showsPrec :: Int -> Field ann -> ShowS
$cshow :: forall ann. Show ann => Field ann -> String
show :: Field ann -> String
$cshowList :: forall ann. Show ann => [Field ann] -> ShowS
showList :: [Field ann] -> ShowS
Show, (forall a b. (a -> b) -> Field a -> Field b)
-> (forall a b. a -> Field b -> Field a) -> Functor Field
forall a b. a -> Field b -> Field a
forall a b. (a -> b) -> Field a -> Field b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> Field a -> Field b
fmap :: forall a b. (a -> b) -> Field a -> Field b
$c<$ :: forall a b. a -> Field b -> Field a
<$ :: forall a b. a -> Field b -> Field a
Functor, (forall m. Monoid m => Field m -> m)
-> (forall m a. Monoid m => (a -> m) -> Field a -> m)
-> (forall m a. Monoid m => (a -> m) -> Field a -> m)
-> (forall a b. (a -> b -> b) -> b -> Field a -> b)
-> (forall a b. (a -> b -> b) -> b -> Field a -> b)
-> (forall b a. (b -> a -> b) -> b -> Field a -> b)
-> (forall b a. (b -> a -> b) -> b -> Field a -> b)
-> (forall a. (a -> a -> a) -> Field a -> a)
-> (forall a. (a -> a -> a) -> Field a -> a)
-> (forall a. Field a -> [a])
-> (forall a. Field a -> Bool)
-> (forall a. Field a -> Int)
-> (forall a. Eq a => a -> Field a -> Bool)
-> (forall a. Ord a => Field a -> a)
-> (forall a. Ord a => Field a -> a)
-> (forall a. Num a => Field a -> a)
-> (forall a. Num a => Field a -> a)
-> Foldable Field
forall a. Eq a => a -> Field a -> Bool
forall a. Num a => Field a -> a
forall a. Ord a => Field a -> a
forall m. Monoid m => Field m -> m
forall a. Field a -> Bool
forall a. Field a -> Int
forall a. Field a -> [a]
forall a. (a -> a -> a) -> Field a -> a
forall m a. Monoid m => (a -> m) -> Field a -> m
forall b a. (b -> a -> b) -> b -> Field a -> b
forall a b. (a -> b -> b) -> b -> Field a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => Field m -> m
fold :: forall m. Monoid m => Field m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Field a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Field a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Field a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> Field a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> Field a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Field a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Field a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Field a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Field a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Field a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Field a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> Field a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> Field a -> a
foldr1 :: forall a. (a -> a -> a) -> Field a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Field a -> a
foldl1 :: forall a. (a -> a -> a) -> Field a -> a
$ctoList :: forall a. Field a -> [a]
toList :: forall a. Field a -> [a]
$cnull :: forall a. Field a -> Bool
null :: forall a. Field a -> Bool
$clength :: forall a. Field a -> Int
length :: forall a. Field a -> Int
$celem :: forall a. Eq a => a -> Field a -> Bool
elem :: forall a. Eq a => a -> Field a -> Bool
$cmaximum :: forall a. Ord a => Field a -> a
maximum :: forall a. Ord a => Field a -> a
$cminimum :: forall a. Ord a => Field a -> a
minimum :: forall a. Ord a => Field a -> a
$csum :: forall a. Num a => Field a -> a
sum :: forall a. Num a => Field a -> a
$cproduct :: forall a. Num a => Field a -> a
product :: forall a. Num a => Field a -> a
Foldable, Functor Field
Foldable Field
(Functor Field, Foldable Field) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> Field a -> f (Field b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Field (f a) -> f (Field a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Field a -> m (Field b))
-> (forall (m :: * -> *) a. Monad m => Field (m a) -> m (Field a))
-> Traversable Field
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Field (m a) -> m (Field a)
forall (f :: * -> *) a. Applicative f => Field (f a) -> f (Field a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Field a -> m (Field b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Field a -> f (Field b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Field a -> f (Field b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Field a -> f (Field b)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Field (f a) -> f (Field a)
sequenceA :: forall (f :: * -> *) a. Applicative f => Field (f a) -> f (Field a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Field a -> m (Field b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Field a -> m (Field b)
$csequence :: forall (m :: * -> *) a. Monad m => Field (m a) -> m (Field a)
sequence :: forall (m :: * -> *) a. Monad m => Field (m a) -> m (Field a)
Traversable)

-- | @since 3.12.0.0
deriving instance Ord ann => Ord (Field ann)

-- | Section of field name
fieldName :: Field ann -> Name ann
fieldName :: forall ann. Field ann -> Name ann
fieldName (Field Name ann
n [FieldLine ann]
_) = Name ann
n
fieldName (Section Name ann
n [SectionArg ann]
_ [Field ann]
_) = Name ann
n

fieldAnn :: Field ann -> ann
fieldAnn :: forall ann. Field ann -> ann
fieldAnn = Name ann -> ann
forall ann. Name ann -> ann
nameAnn (Name ann -> ann) -> (Field ann -> Name ann) -> Field ann -> ann
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Field ann -> Name ann
forall ann. Field ann -> Name ann
fieldName

-- | All transitive descendants of 'Field', including itself.
--
-- /Note:/ the resulting list is never empty.
fieldUniverse :: Field ann -> [Field ann]
fieldUniverse :: forall ann. Field ann -> [Field ann]
fieldUniverse f :: Field ann
f@(Section Name ann
_ [SectionArg ann]
_ [Field ann]
fs) = Field ann
f Field ann -> [Field ann] -> [Field ann]
forall a. a -> [a] -> [a]
: (Field ann -> [Field ann]) -> [Field ann] -> [Field ann]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Field ann -> [Field ann]
forall ann. Field ann -> [Field ann]
fieldUniverse [Field ann]
fs
fieldUniverse f :: Field ann
f@(Field Name ann
_ [FieldLine ann]
_) = [Field ann
f]

-- | A line of text representing the value of a field from a Cabal file.
-- A field may contain multiple lines.
--
-- /Invariant:/ 'ByteString' has no newlines.
data FieldLine ann = FieldLine !ann !ByteString
  deriving (FieldLine ann -> FieldLine ann -> Bool
(FieldLine ann -> FieldLine ann -> Bool)
-> (FieldLine ann -> FieldLine ann -> Bool) -> Eq (FieldLine ann)
forall ann. Eq ann => FieldLine ann -> FieldLine ann -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall ann. Eq ann => FieldLine ann -> FieldLine ann -> Bool
== :: FieldLine ann -> FieldLine ann -> Bool
$c/= :: forall ann. Eq ann => FieldLine ann -> FieldLine ann -> Bool
/= :: FieldLine ann -> FieldLine ann -> Bool
Eq, Int -> FieldLine ann -> ShowS
[FieldLine ann] -> ShowS
FieldLine ann -> String
(Int -> FieldLine ann -> ShowS)
-> (FieldLine ann -> String)
-> ([FieldLine ann] -> ShowS)
-> Show (FieldLine ann)
forall ann. Show ann => Int -> FieldLine ann -> ShowS
forall ann. Show ann => [FieldLine ann] -> ShowS
forall ann. Show ann => FieldLine ann -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall ann. Show ann => Int -> FieldLine ann -> ShowS
showsPrec :: Int -> FieldLine ann -> ShowS
$cshow :: forall ann. Show ann => FieldLine ann -> String
show :: FieldLine ann -> String
$cshowList :: forall ann. Show ann => [FieldLine ann] -> ShowS
showList :: [FieldLine ann] -> ShowS
Show, (forall a b. (a -> b) -> FieldLine a -> FieldLine b)
-> (forall a b. a -> FieldLine b -> FieldLine a)
-> Functor FieldLine
forall a b. a -> FieldLine b -> FieldLine a
forall a b. (a -> b) -> FieldLine a -> FieldLine b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> FieldLine a -> FieldLine b
fmap :: forall a b. (a -> b) -> FieldLine a -> FieldLine b
$c<$ :: forall a b. a -> FieldLine b -> FieldLine a
<$ :: forall a b. a -> FieldLine b -> FieldLine a
Functor, (forall m. Monoid m => FieldLine m -> m)
-> (forall m a. Monoid m => (a -> m) -> FieldLine a -> m)
-> (forall m a. Monoid m => (a -> m) -> FieldLine a -> m)
-> (forall a b. (a -> b -> b) -> b -> FieldLine a -> b)
-> (forall a b. (a -> b -> b) -> b -> FieldLine a -> b)
-> (forall b a. (b -> a -> b) -> b -> FieldLine a -> b)
-> (forall b a. (b -> a -> b) -> b -> FieldLine a -> b)
-> (forall a. (a -> a -> a) -> FieldLine a -> a)
-> (forall a. (a -> a -> a) -> FieldLine a -> a)
-> (forall a. FieldLine a -> [a])
-> (forall a. FieldLine a -> Bool)
-> (forall a. FieldLine a -> Int)
-> (forall a. Eq a => a -> FieldLine a -> Bool)
-> (forall a. Ord a => FieldLine a -> a)
-> (forall a. Ord a => FieldLine a -> a)
-> (forall a. Num a => FieldLine a -> a)
-> (forall a. Num a => FieldLine a -> a)
-> Foldable FieldLine
forall a. Eq a => a -> FieldLine a -> Bool
forall a. Num a => FieldLine a -> a
forall a. Ord a => FieldLine a -> a
forall m. Monoid m => FieldLine m -> m
forall a. FieldLine a -> Bool
forall a. FieldLine a -> Int
forall a. FieldLine a -> [a]
forall a. (a -> a -> a) -> FieldLine a -> a
forall m a. Monoid m => (a -> m) -> FieldLine a -> m
forall b a. (b -> a -> b) -> b -> FieldLine a -> b
forall a b. (a -> b -> b) -> b -> FieldLine a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => FieldLine m -> m
fold :: forall m. Monoid m => FieldLine m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> FieldLine a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> FieldLine a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> FieldLine a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> FieldLine a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> FieldLine a -> b
foldr :: forall a b. (a -> b -> b) -> b -> FieldLine a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> FieldLine a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> FieldLine a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> FieldLine a -> b
foldl :: forall b a. (b -> a -> b) -> b -> FieldLine a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> FieldLine a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> FieldLine a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> FieldLine a -> a
foldr1 :: forall a. (a -> a -> a) -> FieldLine a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> FieldLine a -> a
foldl1 :: forall a. (a -> a -> a) -> FieldLine a -> a
$ctoList :: forall a. FieldLine a -> [a]
toList :: forall a. FieldLine a -> [a]
$cnull :: forall a. FieldLine a -> Bool
null :: forall a. FieldLine a -> Bool
$clength :: forall a. FieldLine a -> Int
length :: forall a. FieldLine a -> Int
$celem :: forall a. Eq a => a -> FieldLine a -> Bool
elem :: forall a. Eq a => a -> FieldLine a -> Bool
$cmaximum :: forall a. Ord a => FieldLine a -> a
maximum :: forall a. Ord a => FieldLine a -> a
$cminimum :: forall a. Ord a => FieldLine a -> a
minimum :: forall a. Ord a => FieldLine a -> a
$csum :: forall a. Num a => FieldLine a -> a
sum :: forall a. Num a => FieldLine a -> a
$cproduct :: forall a. Num a => FieldLine a -> a
product :: forall a. Num a => FieldLine a -> a
Foldable, Functor FieldLine
Foldable FieldLine
(Functor FieldLine, Foldable FieldLine) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> FieldLine a -> f (FieldLine b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    FieldLine (f a) -> f (FieldLine a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> FieldLine a -> m (FieldLine b))
-> (forall (m :: * -> *) a.
    Monad m =>
    FieldLine (m a) -> m (FieldLine a))
-> Traversable FieldLine
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
FieldLine (m a) -> m (FieldLine a)
forall (f :: * -> *) a.
Applicative f =>
FieldLine (f a) -> f (FieldLine a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> FieldLine a -> m (FieldLine b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> FieldLine a -> f (FieldLine b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> FieldLine a -> f (FieldLine b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> FieldLine a -> f (FieldLine b)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
FieldLine (f a) -> f (FieldLine a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
FieldLine (f a) -> f (FieldLine a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> FieldLine a -> m (FieldLine b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> FieldLine a -> m (FieldLine b)
$csequence :: forall (m :: * -> *) a.
Monad m =>
FieldLine (m a) -> m (FieldLine a)
sequence :: forall (m :: * -> *) a.
Monad m =>
FieldLine (m a) -> m (FieldLine a)
Traversable)

-- | @since 3.12.0.0
deriving instance Ord ann => Ord (FieldLine ann)

-- | @since 3.0.0.0
fieldLineAnn :: FieldLine ann -> ann
fieldLineAnn :: forall ann. FieldLine ann -> ann
fieldLineAnn (FieldLine ann
ann ByteString
_) = ann
ann

-- | @since 3.0.0.0
fieldLineBS :: FieldLine ann -> ByteString
fieldLineBS :: forall ann. FieldLine ann -> ByteString
fieldLineBS (FieldLine ann
_ ByteString
bs) = ByteString
bs

-- | Section arguments, e.g. name of the library
data SectionArg ann
  = -- | identifier, or something which looks like number. Also many dot numbers, i.e. "7.6.3"
    SecArgName !ann !ByteString
  | -- | quoted string
    SecArgStr !ann !ByteString
  | -- | everything else, mm. operators (e.g. in if-section conditionals)
    SecArgOther !ann !ByteString
  deriving (SectionArg ann -> SectionArg ann -> Bool
(SectionArg ann -> SectionArg ann -> Bool)
-> (SectionArg ann -> SectionArg ann -> Bool)
-> Eq (SectionArg ann)
forall ann. Eq ann => SectionArg ann -> SectionArg ann -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall ann. Eq ann => SectionArg ann -> SectionArg ann -> Bool
== :: SectionArg ann -> SectionArg ann -> Bool
$c/= :: forall ann. Eq ann => SectionArg ann -> SectionArg ann -> Bool
/= :: SectionArg ann -> SectionArg ann -> Bool
Eq, Int -> SectionArg ann -> ShowS
[SectionArg ann] -> ShowS
SectionArg ann -> String
(Int -> SectionArg ann -> ShowS)
-> (SectionArg ann -> String)
-> ([SectionArg ann] -> ShowS)
-> Show (SectionArg ann)
forall ann. Show ann => Int -> SectionArg ann -> ShowS
forall ann. Show ann => [SectionArg ann] -> ShowS
forall ann. Show ann => SectionArg ann -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall ann. Show ann => Int -> SectionArg ann -> ShowS
showsPrec :: Int -> SectionArg ann -> ShowS
$cshow :: forall ann. Show ann => SectionArg ann -> String
show :: SectionArg ann -> String
$cshowList :: forall ann. Show ann => [SectionArg ann] -> ShowS
showList :: [SectionArg ann] -> ShowS
Show, (forall a b. (a -> b) -> SectionArg a -> SectionArg b)
-> (forall a b. a -> SectionArg b -> SectionArg a)
-> Functor SectionArg
forall a b. a -> SectionArg b -> SectionArg a
forall a b. (a -> b) -> SectionArg a -> SectionArg b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> SectionArg a -> SectionArg b
fmap :: forall a b. (a -> b) -> SectionArg a -> SectionArg b
$c<$ :: forall a b. a -> SectionArg b -> SectionArg a
<$ :: forall a b. a -> SectionArg b -> SectionArg a
Functor, (forall m. Monoid m => SectionArg m -> m)
-> (forall m a. Monoid m => (a -> m) -> SectionArg a -> m)
-> (forall m a. Monoid m => (a -> m) -> SectionArg a -> m)
-> (forall a b. (a -> b -> b) -> b -> SectionArg a -> b)
-> (forall a b. (a -> b -> b) -> b -> SectionArg a -> b)
-> (forall b a. (b -> a -> b) -> b -> SectionArg a -> b)
-> (forall b a. (b -> a -> b) -> b -> SectionArg a -> b)
-> (forall a. (a -> a -> a) -> SectionArg a -> a)
-> (forall a. (a -> a -> a) -> SectionArg a -> a)
-> (forall a. SectionArg a -> [a])
-> (forall a. SectionArg a -> Bool)
-> (forall a. SectionArg a -> Int)
-> (forall a. Eq a => a -> SectionArg a -> Bool)
-> (forall a. Ord a => SectionArg a -> a)
-> (forall a. Ord a => SectionArg a -> a)
-> (forall a. Num a => SectionArg a -> a)
-> (forall a. Num a => SectionArg a -> a)
-> Foldable SectionArg
forall a. Eq a => a -> SectionArg a -> Bool
forall a. Num a => SectionArg a -> a
forall a. Ord a => SectionArg a -> a
forall m. Monoid m => SectionArg m -> m
forall a. SectionArg a -> Bool
forall a. SectionArg a -> Int
forall a. SectionArg a -> [a]
forall a. (a -> a -> a) -> SectionArg a -> a
forall m a. Monoid m => (a -> m) -> SectionArg a -> m
forall b a. (b -> a -> b) -> b -> SectionArg a -> b
forall a b. (a -> b -> b) -> b -> SectionArg a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => SectionArg m -> m
fold :: forall m. Monoid m => SectionArg m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> SectionArg a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> SectionArg a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> SectionArg a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> SectionArg a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> SectionArg a -> b
foldr :: forall a b. (a -> b -> b) -> b -> SectionArg a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> SectionArg a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> SectionArg a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> SectionArg a -> b
foldl :: forall b a. (b -> a -> b) -> b -> SectionArg a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> SectionArg a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> SectionArg a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> SectionArg a -> a
foldr1 :: forall a. (a -> a -> a) -> SectionArg a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> SectionArg a -> a
foldl1 :: forall a. (a -> a -> a) -> SectionArg a -> a
$ctoList :: forall a. SectionArg a -> [a]
toList :: forall a. SectionArg a -> [a]
$cnull :: forall a. SectionArg a -> Bool
null :: forall a. SectionArg a -> Bool
$clength :: forall a. SectionArg a -> Int
length :: forall a. SectionArg a -> Int
$celem :: forall a. Eq a => a -> SectionArg a -> Bool
elem :: forall a. Eq a => a -> SectionArg a -> Bool
$cmaximum :: forall a. Ord a => SectionArg a -> a
maximum :: forall a. Ord a => SectionArg a -> a
$cminimum :: forall a. Ord a => SectionArg a -> a
minimum :: forall a. Ord a => SectionArg a -> a
$csum :: forall a. Num a => SectionArg a -> a
sum :: forall a. Num a => SectionArg a -> a
$cproduct :: forall a. Num a => SectionArg a -> a
product :: forall a. Num a => SectionArg a -> a
Foldable, Functor SectionArg
Foldable SectionArg
(Functor SectionArg, Foldable SectionArg) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> SectionArg a -> f (SectionArg b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    SectionArg (f a) -> f (SectionArg a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> SectionArg a -> m (SectionArg b))
-> (forall (m :: * -> *) a.
    Monad m =>
    SectionArg (m a) -> m (SectionArg a))
-> Traversable SectionArg
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
SectionArg (m a) -> m (SectionArg a)
forall (f :: * -> *) a.
Applicative f =>
SectionArg (f a) -> f (SectionArg a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> SectionArg a -> m (SectionArg b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> SectionArg a -> f (SectionArg b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> SectionArg a -> f (SectionArg b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> SectionArg a -> f (SectionArg b)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
SectionArg (f a) -> f (SectionArg a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
SectionArg (f a) -> f (SectionArg a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> SectionArg a -> m (SectionArg b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> SectionArg a -> m (SectionArg b)
$csequence :: forall (m :: * -> *) a.
Monad m =>
SectionArg (m a) -> m (SectionArg a)
sequence :: forall (m :: * -> *) a.
Monad m =>
SectionArg (m a) -> m (SectionArg a)
Traversable)

-- | @since 3.12.0.0
deriving instance Ord ann => Ord (SectionArg ann)

-- | Extract annotation from 'SectionArg'.
sectionArgAnn :: SectionArg ann -> ann
sectionArgAnn :: forall ann. SectionArg ann -> ann
sectionArgAnn (SecArgName ann
ann ByteString
_) = ann
ann
sectionArgAnn (SecArgStr ann
ann ByteString
_) = ann
ann
sectionArgAnn (SecArgOther ann
ann ByteString
_) = ann
ann

-------------------------------------------------------------------------------
-- Name
-------------------------------------------------------------------------------

type FieldName = ByteString

-- | A field name.
--
-- /Invariant/: 'ByteString' is lower-case ASCII.
data Name ann = Name !ann !FieldName
  deriving (Name ann -> Name ann -> Bool
(Name ann -> Name ann -> Bool)
-> (Name ann -> Name ann -> Bool) -> Eq (Name ann)
forall ann. Eq ann => Name ann -> Name ann -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall ann. Eq ann => Name ann -> Name ann -> Bool
== :: Name ann -> Name ann -> Bool
$c/= :: forall ann. Eq ann => Name ann -> Name ann -> Bool
/= :: Name ann -> Name ann -> Bool
Eq, Int -> Name ann -> ShowS
[Name ann] -> ShowS
Name ann -> String
(Int -> Name ann -> ShowS)
-> (Name ann -> String) -> ([Name ann] -> ShowS) -> Show (Name ann)
forall ann. Show ann => Int -> Name ann -> ShowS
forall ann. Show ann => [Name ann] -> ShowS
forall ann. Show ann => Name ann -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall ann. Show ann => Int -> Name ann -> ShowS
showsPrec :: Int -> Name ann -> ShowS
$cshow :: forall ann. Show ann => Name ann -> String
show :: Name ann -> String
$cshowList :: forall ann. Show ann => [Name ann] -> ShowS
showList :: [Name ann] -> ShowS
Show, (forall a b. (a -> b) -> Name a -> Name b)
-> (forall a b. a -> Name b -> Name a) -> Functor Name
forall a b. a -> Name b -> Name a
forall a b. (a -> b) -> Name a -> Name b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> Name a -> Name b
fmap :: forall a b. (a -> b) -> Name a -> Name b
$c<$ :: forall a b. a -> Name b -> Name a
<$ :: forall a b. a -> Name b -> Name a
Functor, (forall m. Monoid m => Name m -> m)
-> (forall m a. Monoid m => (a -> m) -> Name a -> m)
-> (forall m a. Monoid m => (a -> m) -> Name a -> m)
-> (forall a b. (a -> b -> b) -> b -> Name a -> b)
-> (forall a b. (a -> b -> b) -> b -> Name a -> b)
-> (forall b a. (b -> a -> b) -> b -> Name a -> b)
-> (forall b a. (b -> a -> b) -> b -> Name a -> b)
-> (forall a. (a -> a -> a) -> Name a -> a)
-> (forall a. (a -> a -> a) -> Name a -> a)
-> (forall a. Name a -> [a])
-> (forall a. Name a -> Bool)
-> (forall a. Name a -> Int)
-> (forall a. Eq a => a -> Name a -> Bool)
-> (forall a. Ord a => Name a -> a)
-> (forall a. Ord a => Name a -> a)
-> (forall a. Num a => Name a -> a)
-> (forall a. Num a => Name a -> a)
-> Foldable Name
forall a. Eq a => a -> Name a -> Bool
forall a. Num a => Name a -> a
forall a. Ord a => Name a -> a
forall m. Monoid m => Name m -> m
forall a. Name a -> Bool
forall a. Name a -> Int
forall a. Name a -> [a]
forall a. (a -> a -> a) -> Name a -> a
forall m a. Monoid m => (a -> m) -> Name a -> m
forall b a. (b -> a -> b) -> b -> Name a -> b
forall a b. (a -> b -> b) -> b -> Name a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => Name m -> m
fold :: forall m. Monoid m => Name m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Name a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Name a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Name a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> Name a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> Name a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Name a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Name a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Name a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Name a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Name a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Name a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> Name a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> Name a -> a
foldr1 :: forall a. (a -> a -> a) -> Name a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Name a -> a
foldl1 :: forall a. (a -> a -> a) -> Name a -> a
$ctoList :: forall a. Name a -> [a]
toList :: forall a. Name a -> [a]
$cnull :: forall a. Name a -> Bool
null :: forall a. Name a -> Bool
$clength :: forall a. Name a -> Int
length :: forall a. Name a -> Int
$celem :: forall a. Eq a => a -> Name a -> Bool
elem :: forall a. Eq a => a -> Name a -> Bool
$cmaximum :: forall a. Ord a => Name a -> a
maximum :: forall a. Ord a => Name a -> a
$cminimum :: forall a. Ord a => Name a -> a
minimum :: forall a. Ord a => Name a -> a
$csum :: forall a. Num a => Name a -> a
sum :: forall a. Num a => Name a -> a
$cproduct :: forall a. Num a => Name a -> a
product :: forall a. Num a => Name a -> a
Foldable, Functor Name
Foldable Name
(Functor Name, Foldable Name) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> Name a -> f (Name b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Name (f a) -> f (Name a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Name a -> m (Name b))
-> (forall (m :: * -> *) a. Monad m => Name (m a) -> m (Name a))
-> Traversable Name
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Name (m a) -> m (Name a)
forall (f :: * -> *) a. Applicative f => Name (f a) -> f (Name a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Name a -> m (Name b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Name a -> f (Name b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Name a -> f (Name b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Name a -> f (Name b)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Name (f a) -> f (Name a)
sequenceA :: forall (f :: * -> *) a. Applicative f => Name (f a) -> f (Name a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Name a -> m (Name b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Name a -> m (Name b)
$csequence :: forall (m :: * -> *) a. Monad m => Name (m a) -> m (Name a)
sequence :: forall (m :: * -> *) a. Monad m => Name (m a) -> m (Name a)
Traversable)

-- | @since 3.12.0.0
deriving instance Ord ann => Ord (Name ann)

mkName :: ann -> FieldName -> Name ann
mkName :: forall ann. ann -> ByteString -> Name ann
mkName ann
ann ByteString
bs = ann -> ByteString -> Name ann
forall ann. ann -> ByteString -> Name ann
Name ann
ann ((Char -> Char) -> ByteString -> ByteString
B.map Char -> Char
Char.toLower ByteString
bs)

getName :: Name ann -> FieldName
getName :: forall ann. Name ann -> ByteString
getName (Name ann
_ ByteString
bs) = ByteString
bs

nameAnn :: Name ann -> ann
nameAnn :: forall ann. Name ann -> ann
nameAnn (Name ann
ann ByteString
_) = ann
ann

-------------------------------------------------------------------------------
-- To Strings
-------------------------------------------------------------------------------

-- |
--
-- @since 3.6.0.0
sectionArgsToString :: [SectionArg ann] -> String
sectionArgsToString :: forall ann. [SectionArg ann] -> String
sectionArgsToString = [String] -> String
unwords ([String] -> String)
-> ([SectionArg ann] -> [String]) -> [SectionArg ann] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SectionArg ann -> String) -> [SectionArg ann] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map SectionArg ann -> String
forall ann. SectionArg ann -> String
toStr
  where
    toStr :: SectionArg ann -> String
    toStr :: forall ann. SectionArg ann -> String
toStr (SecArgName ann
_ ByteString
bs) = ShowS
showTokenStr (ByteString -> String
fromUTF8BS ByteString
bs)
    toStr (SecArgStr ann
_ ByteString
bs) = ShowS
showTokenStr (ByteString -> String
fromUTF8BS ByteString
bs)
    toStr (SecArgOther ann
_ ByteString
bs) = ByteString -> String
fromUTF8BS ByteString
bs

-- | Convert @['FieldLine']@ into String.
--
-- /Note:/ this doesn't preserve indentation or empty lines,
-- as the annotations (e.g. positions) are ignored.
--
-- @since 3.6.0.0
fieldLinesToString :: [FieldLine ann] -> String
fieldLinesToString :: forall ann. [FieldLine ann] -> String
fieldLinesToString =
  -- intercalate to avoid trailing newline.
  String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\n" ([String] -> String)
-> ([FieldLine ann] -> [String]) -> [FieldLine ann] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (FieldLine ann -> String) -> [FieldLine ann] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map FieldLine ann -> String
forall {ann}. FieldLine ann -> String
toStr
  where
    toStr :: FieldLine ann -> String
toStr (FieldLine ann
_ ByteString
bs) = ByteString -> String
fromUTF8BS ByteString
bs

-------------------------------------------------------------------------------
-- Foldable1
-------------------------------------------------------------------------------

#if MIN_VERSION_base(4,18,0)

-- | @since 3.12.0.0
instance F1.Foldable1 Field where
  foldMap1 :: forall m a. Semigroup m => (a -> m) -> Field a -> m
foldMap1 a -> m
f (Field Name a
x [FieldLine a]
ys) =
    NonEmpty m -> m
forall m. Semigroup m => NonEmpty m -> m
forall (t :: * -> *) m. (Foldable1 t, Semigroup m) => t m -> m
F1.fold1 ((a -> m) -> Name a -> m
forall m a. Semigroup m => (a -> m) -> Name a -> m
forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
F1.foldMap1 a -> m
f Name a
x m -> [m] -> NonEmpty m
forall a. a -> [a] -> NonEmpty a
:| (FieldLine a -> m) -> [FieldLine a] -> [m]
forall a b. (a -> b) -> [a] -> [b]
map ((a -> m) -> FieldLine a -> m
forall m a. Semigroup m => (a -> m) -> FieldLine a -> m
forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
F1.foldMap1 a -> m
f) [FieldLine a]
ys)
  foldMap1 a -> m
f (Section Name a
x [SectionArg a]
ys [Field a]
zs) =
    NonEmpty m -> m
forall m. Semigroup m => NonEmpty m -> m
forall (t :: * -> *) m. (Foldable1 t, Semigroup m) => t m -> m
F1.fold1 ((a -> m) -> Name a -> m
forall m a. Semigroup m => (a -> m) -> Name a -> m
forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
F1.foldMap1 a -> m
f Name a
x m -> [m] -> NonEmpty m
forall a. a -> [a] -> NonEmpty a
:| (SectionArg a -> m) -> [SectionArg a] -> [m]
forall a b. (a -> b) -> [a] -> [b]
map ((a -> m) -> SectionArg a -> m
forall m a. Semigroup m => (a -> m) -> SectionArg a -> m
forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
F1.foldMap1 a -> m
f) [SectionArg a]
ys [m] -> [m] -> [m]
forall a. [a] -> [a] -> [a]
++ (Field a -> m) -> [Field a] -> [m]
forall a b. (a -> b) -> [a] -> [b]
map ((a -> m) -> Field a -> m
forall m a. Semigroup m => (a -> m) -> Field a -> m
forall (t :: * -> *) m a.
(Foldable1 t, Semigroup m) =>
(a -> m) -> t a -> m
F1.foldMap1 a -> m
f) [Field a]
zs)

-- | @since 3.12.0.0
instance F1.Foldable1 FieldLine where
  foldMap1 :: forall m a. Semigroup m => (a -> m) -> FieldLine a -> m
foldMap1 = ((a -> m) -> (FieldLine a -> a) -> FieldLine a -> m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FieldLine a -> a
forall ann. FieldLine ann -> ann
fieldLineAnn)

-- | @since 3.12.0.0
instance F1.Foldable1 SectionArg where
  foldMap1 :: forall m a. Semigroup m => (a -> m) -> SectionArg a -> m
foldMap1 = ((a -> m) -> (SectionArg a -> a) -> SectionArg a -> m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SectionArg a -> a
forall ann. SectionArg ann -> ann
sectionArgAnn)

-- | @since 3.12.0.0
instance F1.Foldable1 Name where
  foldMap1 :: forall m a. Semigroup m => (a -> m) -> Name a -> m
foldMap1 = ((a -> m) -> (Name a -> a) -> Name a -> m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name a -> a
forall ann. Name ann -> ann
nameAnn)

#endif