-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Generic deriving of Read/Show with no record labels.
--   
--   Please see the README on GitHub at
--   <a>https://github.com/jacobstanley/quiet#readme</a>
@package quiet
@version 0.2

module Quiet.Internal
data ConType
ConPrefix :: ConType
ConInfix :: String -> ConType
class QShow f
qshowsPrec_ :: QShow f => ConType -> Int -> f a -> ShowS
qshowsNullary :: QShow f => f a -> Bool
class QRead f
qreadPrec_ :: QRead f => ConType -> ReadPrec (f a)
qreadNullary :: QRead f => Proxy f -> Bool
expectInfix :: String -> ReadPrec ()
instance Quiet.Internal.QRead GHC.Generics.U1
instance GHC.Read.Read c => Quiet.Internal.QRead (GHC.Generics.K1 i c)
instance (Quiet.Internal.QRead a, GHC.Generics.Constructor c) => Quiet.Internal.QRead (GHC.Generics.M1 GHC.Generics.C c a)
instance Quiet.Internal.QRead a => Quiet.Internal.QRead (GHC.Generics.M1 GHC.Generics.S s a)
instance Quiet.Internal.QRead a => Quiet.Internal.QRead (GHC.Generics.M1 GHC.Generics.D d a)
instance (Quiet.Internal.QRead a, Quiet.Internal.QRead b) => Quiet.Internal.QRead (a GHC.Generics.:+: b)
instance (Quiet.Internal.QRead a, Quiet.Internal.QRead b) => Quiet.Internal.QRead (a GHC.Generics.:*: b)
instance Quiet.Internal.QShow GHC.Generics.U1
instance GHC.Show.Show c => Quiet.Internal.QShow (GHC.Generics.K1 i c)
instance (Quiet.Internal.QShow a, GHC.Generics.Constructor c) => Quiet.Internal.QShow (GHC.Generics.M1 GHC.Generics.C c a)
instance Quiet.Internal.QShow a => Quiet.Internal.QShow (GHC.Generics.M1 GHC.Generics.S s a)
instance Quiet.Internal.QShow a => Quiet.Internal.QShow (GHC.Generics.M1 GHC.Generics.D d a)
instance (Quiet.Internal.QShow a, Quiet.Internal.QShow b) => Quiet.Internal.QShow (a GHC.Generics.:+: b)
instance (Quiet.Internal.QShow a, Quiet.Internal.QShow b) => Quiet.Internal.QShow (a GHC.Generics.:*: b)


-- | Generic deriving of <a>Read</a> / <a>Show</a> with no record labels.
--   
--   Often one wants to create a <tt>newtype</tt> which has a convenient
--   field accessor like <tt>unUserId</tt> below, but that unfortunately
--   makes the <a>Show</a> instance which is derived overly verbose.
--   
--   For example:
--   
--   <pre>
--   newtype UserId = UserId { unUserId :: String }
--     deriving (Read, Show)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; show (UserId "simon")
--   UserId {unUserId = "simon"}
--   
--   &gt;&gt;&gt; read "UserId {unUserId = \"simon\"}" :: UserId
--   UserId {unUserId = "simon"}
--   </pre>
--   
--   With <tt>DerivingVia</tt> <a>Quiet</a> you can have a <a>Show</a>
--   instance which doesn't print the field labels. It will render as if
--   the <tt>unUserId</tt> accessor wasn't present at all.
--   
--   <pre>
--   newtype UserId = UserId { unUserId :: String }
--     deriving (Generic)
--     deriving (Read, Show) via (Quiet UserId)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; show (UserId "simon")
--   UserId "simon"
--   
--   &gt;&gt;&gt; read "UserId \"simon\"" :: UserId
--   UserId "simon"
--   </pre>
--   
--   If you want to derive <a>Read</a> / <a>Show</a> without using
--   <tt>DerivingVia</tt> then you can use <a>qreadPrec</a> and
--   <a>qshowsPrec</a> directly.
--   
--   <pre>
--   instance Read UserId where readPrec = qreadPrec
--   instance Show UserId where showsPrec = qshowsPrec
--   </pre>
module Quiet

-- | Derive <a>Read</a> / <a>Show</a> using <tt>DerivingVia</tt>.
newtype Quiet a
Quiet :: a -> Quiet a
[unQuiet] :: Quiet a -> a

-- | This implements a quiet version of <a>showsPrec</a> which omits labels
--   for record fields when rendering constructors.
qshowsPrec :: (Generic a, QShow (Rep a)) => Int -> a -> ShowS

-- | This implements a quiet version of <a>readPrec</a> which expects
--   labels for record fields to be omitted when parsing constructors.
qreadPrec :: (Generic a, QRead (Rep a)) => ReadPrec a
instance (GHC.Generics.Generic a, Quiet.Internal.QShow (GHC.Generics.Rep a)) => GHC.Show.Show (Quiet.Quiet a)
instance (GHC.Generics.Generic a, Quiet.Internal.QRead (GHC.Generics.Rep a)) => GHC.Read.Read (Quiet.Quiet a)
