-- 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 -- https://github.com/jacobstanley/quiet#readme @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 Read / Show with no record labels. -- -- Often one wants to create a newtype which has a convenient -- field accessor like unUserId below, but that unfortunately -- makes the Show instance which is derived overly verbose. -- -- For example: -- --
--   newtype UserId = UserId { unUserId :: String }
--     deriving (Read, Show)
--   
-- --
--   >>> show (UserId "simon")
--   UserId {unUserId = "simon"}
--   
--   >>> read "UserId {unUserId = \"simon\"}" :: UserId
--   UserId {unUserId = "simon"}
--   
-- -- With DerivingVia Quiet you can have a Show -- instance which doesn't print the field labels. It will render as if -- the unUserId accessor wasn't present at all. -- --
--   newtype UserId = UserId { unUserId :: String }
--     deriving (Generic)
--     deriving (Read, Show) via (Quiet UserId)
--   
-- --
--   >>> show (UserId "simon")
--   UserId "simon"
--   
--   >>> read "UserId \"simon\"" :: UserId
--   UserId "simon"
--   
-- -- If you want to derive Read / Show without using -- DerivingVia then you can use qreadPrec and -- qshowsPrec directly. -- --
--   instance Read UserId where readPrec = qreadPrec
--   instance Show UserId where showsPrec = qshowsPrec
--   
module Quiet -- | Derive Read / Show using DerivingVia. newtype Quiet a Quiet :: a -> Quiet a [unQuiet] :: Quiet a -> a -- | This implements a quiet version of showsPrec which omits labels -- for record fields when rendering constructors. qshowsPrec :: (Generic a, QShow (Rep a)) => Int -> a -> ShowS -- | This implements a quiet version of readPrec 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)