{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
module GHC.Types.FieldLabel
( FieldLabelString
, FieldLabelEnv
, FieldLabel(..)
, fieldSelectorOccName
, fieldLabelPrintableName
, DuplicateRecordFields(..)
, FieldSelectors(..)
, flIsOverloaded
)
where
import GHC.Prelude
import {-# SOURCE #-} GHC.Types.Name.Occurrence
import {-# SOURCE #-} GHC.Types.Name
import GHC.Data.FastString
import GHC.Data.FastString.Env
import GHC.Utils.Outputable
import GHC.Utils.Binary
import Data.Bool
import Data.Data
type FieldLabelString = FastString
type FieldLabelEnv = DFastStringEnv FieldLabel
data FieldLabel = FieldLabel {
FieldLabel -> FieldLabelString
flLabel :: FieldLabelString,
FieldLabel -> DuplicateRecordFields
flHasDuplicateRecordFields :: DuplicateRecordFields,
FieldLabel -> FieldSelectors
flHasFieldSelector :: FieldSelectors,
FieldLabel -> Name
flSelector :: Name
}
deriving (Typeable FieldLabel
Typeable FieldLabel
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldLabel -> c FieldLabel)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldLabel)
-> (FieldLabel -> Constr)
-> (FieldLabel -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldLabel))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FieldLabel))
-> ((forall b. Data b => b -> b) -> FieldLabel -> FieldLabel)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldLabel -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldLabel -> r)
-> (forall u. (forall d. Data d => d -> u) -> FieldLabel -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> FieldLabel -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel)
-> Data FieldLabel
FieldLabel -> DataType
FieldLabel -> Constr
(forall b. Data b => b -> b) -> FieldLabel -> FieldLabel
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) -> FieldLabel -> u
forall u. (forall d. Data d => d -> u) -> FieldLabel -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldLabel -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldLabel -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldLabel
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldLabel -> c FieldLabel
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldLabel)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldLabel)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FieldLabel -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FieldLabel -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> FieldLabel -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FieldLabel -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldLabel -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldLabel -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldLabel -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldLabel -> r
gmapT :: (forall b. Data b => b -> b) -> FieldLabel -> FieldLabel
$cgmapT :: (forall b. Data b => b -> b) -> FieldLabel -> FieldLabel
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldLabel)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldLabel)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldLabel)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldLabel)
dataTypeOf :: FieldLabel -> DataType
$cdataTypeOf :: FieldLabel -> DataType
toConstr :: FieldLabel -> Constr
$ctoConstr :: FieldLabel -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldLabel
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldLabel
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldLabel -> c FieldLabel
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldLabel -> c FieldLabel
Data, FieldLabel -> FieldLabel -> Bool
(FieldLabel -> FieldLabel -> Bool)
-> (FieldLabel -> FieldLabel -> Bool) -> Eq FieldLabel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldLabel -> FieldLabel -> Bool
$c/= :: FieldLabel -> FieldLabel -> Bool
== :: FieldLabel -> FieldLabel -> Bool
$c== :: FieldLabel -> FieldLabel -> Bool
Eq)
instance HasOccName FieldLabel where
occName :: FieldLabel -> OccName
occName = FieldLabelString -> OccName
mkVarOccFS (FieldLabelString -> OccName)
-> (FieldLabel -> FieldLabelString) -> FieldLabel -> OccName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FieldLabel -> FieldLabelString
flLabel
instance Outputable FieldLabel where
ppr :: FieldLabel -> SDoc
ppr FieldLabel
fl = FieldLabelString -> SDoc
forall a. Outputable a => a -> SDoc
ppr (FieldLabel -> FieldLabelString
flLabel FieldLabel
fl) SDoc -> SDoc -> SDoc
<> SDoc -> SDoc
whenPprDebug (SDoc -> SDoc
braces (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr (FieldLabel -> Name
flSelector FieldLabel
fl))
SDoc -> SDoc -> SDoc
<> DuplicateRecordFields -> SDoc
forall a. Outputable a => a -> SDoc
ppr (FieldLabel -> DuplicateRecordFields
flHasDuplicateRecordFields FieldLabel
fl)
SDoc -> SDoc -> SDoc
<> FieldSelectors -> SDoc
forall a. Outputable a => a -> SDoc
ppr (FieldLabel -> FieldSelectors
flHasFieldSelector FieldLabel
fl))
data DuplicateRecordFields
= DuplicateRecordFields
| NoDuplicateRecordFields
deriving (Int -> DuplicateRecordFields -> ShowS
[DuplicateRecordFields] -> ShowS
DuplicateRecordFields -> String
(Int -> DuplicateRecordFields -> ShowS)
-> (DuplicateRecordFields -> String)
-> ([DuplicateRecordFields] -> ShowS)
-> Show DuplicateRecordFields
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DuplicateRecordFields] -> ShowS
$cshowList :: [DuplicateRecordFields] -> ShowS
show :: DuplicateRecordFields -> String
$cshow :: DuplicateRecordFields -> String
showsPrec :: Int -> DuplicateRecordFields -> ShowS
$cshowsPrec :: Int -> DuplicateRecordFields -> ShowS
Show, DuplicateRecordFields -> DuplicateRecordFields -> Bool
(DuplicateRecordFields -> DuplicateRecordFields -> Bool)
-> (DuplicateRecordFields -> DuplicateRecordFields -> Bool)
-> Eq DuplicateRecordFields
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DuplicateRecordFields -> DuplicateRecordFields -> Bool
$c/= :: DuplicateRecordFields -> DuplicateRecordFields -> Bool
== :: DuplicateRecordFields -> DuplicateRecordFields -> Bool
$c== :: DuplicateRecordFields -> DuplicateRecordFields -> Bool
Eq, Typeable, Typeable DuplicateRecordFields
Typeable DuplicateRecordFields
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DuplicateRecordFields
-> c DuplicateRecordFields)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DuplicateRecordFields)
-> (DuplicateRecordFields -> Constr)
-> (DuplicateRecordFields -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DuplicateRecordFields))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DuplicateRecordFields))
-> ((forall b. Data b => b -> b)
-> DuplicateRecordFields -> DuplicateRecordFields)
-> (forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> DuplicateRecordFields
-> r)
-> (forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> DuplicateRecordFields
-> r)
-> (forall u.
(forall d. Data d => d -> u) -> DuplicateRecordFields -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> DuplicateRecordFields -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DuplicateRecordFields -> m DuplicateRecordFields)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DuplicateRecordFields -> m DuplicateRecordFields)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DuplicateRecordFields -> m DuplicateRecordFields)
-> Data DuplicateRecordFields
DuplicateRecordFields -> DataType
DuplicateRecordFields -> Constr
(forall b. Data b => b -> b)
-> DuplicateRecordFields -> DuplicateRecordFields
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) -> DuplicateRecordFields -> u
forall u.
(forall d. Data d => d -> u) -> DuplicateRecordFields -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DuplicateRecordFields -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DuplicateRecordFields -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DuplicateRecordFields -> m DuplicateRecordFields
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DuplicateRecordFields -> m DuplicateRecordFields
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DuplicateRecordFields
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DuplicateRecordFields
-> c DuplicateRecordFields
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DuplicateRecordFields)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DuplicateRecordFields)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DuplicateRecordFields -> m DuplicateRecordFields
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DuplicateRecordFields -> m DuplicateRecordFields
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DuplicateRecordFields -> m DuplicateRecordFields
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DuplicateRecordFields -> m DuplicateRecordFields
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DuplicateRecordFields -> m DuplicateRecordFields
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DuplicateRecordFields -> m DuplicateRecordFields
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DuplicateRecordFields -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> DuplicateRecordFields -> u
gmapQ :: forall u.
(forall d. Data d => d -> u) -> DuplicateRecordFields -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> DuplicateRecordFields -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DuplicateRecordFields -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DuplicateRecordFields -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DuplicateRecordFields -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DuplicateRecordFields -> r
gmapT :: (forall b. Data b => b -> b)
-> DuplicateRecordFields -> DuplicateRecordFields
$cgmapT :: (forall b. Data b => b -> b)
-> DuplicateRecordFields -> DuplicateRecordFields
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DuplicateRecordFields)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DuplicateRecordFields)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DuplicateRecordFields)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DuplicateRecordFields)
dataTypeOf :: DuplicateRecordFields -> DataType
$cdataTypeOf :: DuplicateRecordFields -> DataType
toConstr :: DuplicateRecordFields -> Constr
$ctoConstr :: DuplicateRecordFields -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DuplicateRecordFields
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DuplicateRecordFields
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DuplicateRecordFields
-> c DuplicateRecordFields
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> DuplicateRecordFields
-> c DuplicateRecordFields
Data)
instance Binary DuplicateRecordFields where
put_ :: BinHandle -> DuplicateRecordFields -> IO ()
put_ BinHandle
bh DuplicateRecordFields
f = BinHandle -> Bool -> IO ()
forall a. Binary a => BinHandle -> a -> IO ()
put_ BinHandle
bh (DuplicateRecordFields
f DuplicateRecordFields -> DuplicateRecordFields -> Bool
forall a. Eq a => a -> a -> Bool
== DuplicateRecordFields
DuplicateRecordFields)
get :: BinHandle -> IO DuplicateRecordFields
get BinHandle
bh = DuplicateRecordFields
-> DuplicateRecordFields -> Bool -> DuplicateRecordFields
forall a. a -> a -> Bool -> a
bool DuplicateRecordFields
NoDuplicateRecordFields DuplicateRecordFields
DuplicateRecordFields (Bool -> DuplicateRecordFields)
-> IO Bool -> IO DuplicateRecordFields
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BinHandle -> IO Bool
forall a. Binary a => BinHandle -> IO a
get BinHandle
bh
instance Outputable DuplicateRecordFields where
ppr :: DuplicateRecordFields -> SDoc
ppr DuplicateRecordFields
DuplicateRecordFields = String -> SDoc
text String
"+dup"
ppr DuplicateRecordFields
NoDuplicateRecordFields = String -> SDoc
text String
"-dup"
data FieldSelectors
= FieldSelectors
| NoFieldSelectors
deriving (Int -> FieldSelectors -> ShowS
[FieldSelectors] -> ShowS
FieldSelectors -> String
(Int -> FieldSelectors -> ShowS)
-> (FieldSelectors -> String)
-> ([FieldSelectors] -> ShowS)
-> Show FieldSelectors
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldSelectors] -> ShowS
$cshowList :: [FieldSelectors] -> ShowS
show :: FieldSelectors -> String
$cshow :: FieldSelectors -> String
showsPrec :: Int -> FieldSelectors -> ShowS
$cshowsPrec :: Int -> FieldSelectors -> ShowS
Show, FieldSelectors -> FieldSelectors -> Bool
(FieldSelectors -> FieldSelectors -> Bool)
-> (FieldSelectors -> FieldSelectors -> Bool) -> Eq FieldSelectors
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldSelectors -> FieldSelectors -> Bool
$c/= :: FieldSelectors -> FieldSelectors -> Bool
== :: FieldSelectors -> FieldSelectors -> Bool
$c== :: FieldSelectors -> FieldSelectors -> Bool
Eq, Typeable, Typeable FieldSelectors
Typeable FieldSelectors
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldSelectors -> c FieldSelectors)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldSelectors)
-> (FieldSelectors -> Constr)
-> (FieldSelectors -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldSelectors))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FieldSelectors))
-> ((forall b. Data b => b -> b)
-> FieldSelectors -> FieldSelectors)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldSelectors -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldSelectors -> r)
-> (forall u.
(forall d. Data d => d -> u) -> FieldSelectors -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> FieldSelectors -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FieldSelectors -> m FieldSelectors)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FieldSelectors -> m FieldSelectors)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FieldSelectors -> m FieldSelectors)
-> Data FieldSelectors
FieldSelectors -> DataType
FieldSelectors -> Constr
(forall b. Data b => b -> b) -> FieldSelectors -> FieldSelectors
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) -> FieldSelectors -> u
forall u. (forall d. Data d => d -> u) -> FieldSelectors -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldSelectors -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldSelectors -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FieldSelectors -> m FieldSelectors
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FieldSelectors -> m FieldSelectors
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldSelectors
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldSelectors -> c FieldSelectors
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldSelectors)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FieldSelectors)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FieldSelectors -> m FieldSelectors
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FieldSelectors -> m FieldSelectors
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FieldSelectors -> m FieldSelectors
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FieldSelectors -> m FieldSelectors
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FieldSelectors -> m FieldSelectors
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FieldSelectors -> m FieldSelectors
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> FieldSelectors -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> FieldSelectors -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> FieldSelectors -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FieldSelectors -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldSelectors -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FieldSelectors -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldSelectors -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FieldSelectors -> r
gmapT :: (forall b. Data b => b -> b) -> FieldSelectors -> FieldSelectors
$cgmapT :: (forall b. Data b => b -> b) -> FieldSelectors -> FieldSelectors
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FieldSelectors)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FieldSelectors)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldSelectors)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FieldSelectors)
dataTypeOf :: FieldSelectors -> DataType
$cdataTypeOf :: FieldSelectors -> DataType
toConstr :: FieldSelectors -> Constr
$ctoConstr :: FieldSelectors -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldSelectors
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FieldSelectors
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldSelectors -> c FieldSelectors
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FieldSelectors -> c FieldSelectors
Data)
instance Binary FieldSelectors where
put_ :: BinHandle -> FieldSelectors -> IO ()
put_ BinHandle
bh FieldSelectors
f = BinHandle -> Bool -> IO ()
forall a. Binary a => BinHandle -> a -> IO ()
put_ BinHandle
bh (FieldSelectors
f FieldSelectors -> FieldSelectors -> Bool
forall a. Eq a => a -> a -> Bool
== FieldSelectors
FieldSelectors)
get :: BinHandle -> IO FieldSelectors
get BinHandle
bh = FieldSelectors -> FieldSelectors -> Bool -> FieldSelectors
forall a. a -> a -> Bool -> a
bool FieldSelectors
NoFieldSelectors FieldSelectors
FieldSelectors (Bool -> FieldSelectors) -> IO Bool -> IO FieldSelectors
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BinHandle -> IO Bool
forall a. Binary a => BinHandle -> IO a
get BinHandle
bh
instance Outputable FieldSelectors where
ppr :: FieldSelectors -> SDoc
ppr FieldSelectors
FieldSelectors = String -> SDoc
text String
"+sel"
ppr FieldSelectors
NoFieldSelectors = String -> SDoc
text String
"-sel"
instance Binary Name => Binary FieldLabel where
put_ :: BinHandle -> FieldLabel -> IO ()
put_ BinHandle
bh (FieldLabel FieldLabelString
aa DuplicateRecordFields
ab FieldSelectors
ac Name
ad) = do
BinHandle -> FieldLabelString -> IO ()
forall a. Binary a => BinHandle -> a -> IO ()
put_ BinHandle
bh FieldLabelString
aa
BinHandle -> DuplicateRecordFields -> IO ()
forall a. Binary a => BinHandle -> a -> IO ()
put_ BinHandle
bh DuplicateRecordFields
ab
BinHandle -> FieldSelectors -> IO ()
forall a. Binary a => BinHandle -> a -> IO ()
put_ BinHandle
bh FieldSelectors
ac
BinHandle -> Name -> IO ()
forall a. Binary a => BinHandle -> a -> IO ()
put_ BinHandle
bh Name
ad
get :: BinHandle -> IO FieldLabel
get BinHandle
bh = do
FieldLabelString
aa <- BinHandle -> IO FieldLabelString
forall a. Binary a => BinHandle -> IO a
get BinHandle
bh
DuplicateRecordFields
ab <- BinHandle -> IO DuplicateRecordFields
forall a. Binary a => BinHandle -> IO a
get BinHandle
bh
FieldSelectors
ac <- BinHandle -> IO FieldSelectors
forall a. Binary a => BinHandle -> IO a
get BinHandle
bh
Name
ad <- BinHandle -> IO Name
forall a. Binary a => BinHandle -> IO a
get BinHandle
bh
FieldLabel -> IO FieldLabel
forall (m :: * -> *) a. Monad m => a -> m a
return (FieldLabelString
-> DuplicateRecordFields -> FieldSelectors -> Name -> FieldLabel
FieldLabel FieldLabelString
aa DuplicateRecordFields
ab FieldSelectors
ac Name
ad)
fieldSelectorOccName :: FieldLabelString -> OccName -> DuplicateRecordFields -> FieldSelectors -> OccName
fieldSelectorOccName :: FieldLabelString
-> OccName -> DuplicateRecordFields -> FieldSelectors -> OccName
fieldSelectorOccName FieldLabelString
lbl OccName
dc DuplicateRecordFields
dup_fields_ok FieldSelectors
has_sel
| DuplicateRecordFields -> FieldSelectors -> Bool
shouldMangleSelectorNames DuplicateRecordFields
dup_fields_ok FieldSelectors
has_sel = String -> OccName
mkRecFldSelOcc String
str
| Bool
otherwise = FieldLabelString -> OccName
mkVarOccFS FieldLabelString
lbl
where
str :: String
str = String
":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ FieldLabelString -> String
unpackFS FieldLabelString
lbl String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
":" String -> ShowS
forall a. [a] -> [a] -> [a]
++ OccName -> String
occNameString OccName
dc
fieldLabelPrintableName :: FieldLabel -> Name
fieldLabelPrintableName :: FieldLabel -> Name
fieldLabelPrintableName FieldLabel
fl
| FieldLabel -> Bool
flIsOverloaded FieldLabel
fl = Name -> OccName -> Name
tidyNameOcc (FieldLabel -> Name
flSelector FieldLabel
fl) (FieldLabelString -> OccName
mkVarOccFS (FieldLabel -> FieldLabelString
flLabel FieldLabel
fl))
| Bool
otherwise = FieldLabel -> Name
flSelector FieldLabel
fl
shouldMangleSelectorNames :: DuplicateRecordFields -> FieldSelectors -> Bool
shouldMangleSelectorNames :: DuplicateRecordFields -> FieldSelectors -> Bool
shouldMangleSelectorNames DuplicateRecordFields
dup_fields_ok FieldSelectors
has_sel
= DuplicateRecordFields
dup_fields_ok DuplicateRecordFields -> DuplicateRecordFields -> Bool
forall a. Eq a => a -> a -> Bool
== DuplicateRecordFields
DuplicateRecordFields Bool -> Bool -> Bool
|| FieldSelectors
has_sel FieldSelectors -> FieldSelectors -> Bool
forall a. Eq a => a -> a -> Bool
== FieldSelectors
NoFieldSelectors
flIsOverloaded :: FieldLabel -> Bool
flIsOverloaded :: FieldLabel -> Bool
flIsOverloaded FieldLabel
fl =
DuplicateRecordFields -> FieldSelectors -> Bool
shouldMangleSelectorNames (FieldLabel -> DuplicateRecordFields
flHasDuplicateRecordFields FieldLabel
fl) (FieldLabel -> FieldSelectors
flHasFieldSelector FieldLabel
fl)