/usr/share/doc/libghc-syb-with-class-doc/html/syb-with-class.txt is in libghc-syb-with-class-doc 0.6.1.7-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | -- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Scrap Your Boilerplate With Class
--
-- Classes, and Template Haskell code to generate instances, for the
-- Scrap Your Boilerplate With Class system.
@package syb-with-class
@version 0.6.1.7
module Data.Generics.SYB.WithClass.Context
class Sat a
dict :: Sat a => a
data NoCtx a
noCtx :: NoCtx ()
data PairCtx l r a
PairCtx :: l a -> r a -> PairCtx l r a
[leftCtx] :: PairCtx l r a -> l a
[rightCtx] :: PairCtx l r a -> r a
pairCtx :: l () -> r () -> PairCtx l r ()
instance Data.Generics.SYB.WithClass.Context.Sat (Data.Generics.SYB.WithClass.Context.NoCtx a)
instance (Data.Generics.SYB.WithClass.Context.Sat (l a), Data.Generics.SYB.WithClass.Context.Sat (r a)) => Data.Generics.SYB.WithClass.Context.Sat (Data.Generics.SYB.WithClass.Context.PairCtx l r a)
module Data.Generics.SYB.WithClass.Basics
data Proxy (a :: * -> *)
class (Typeable a, Sat (ctx a)) => Data ctx a where gfoldl _ _ z = z gunfold _ _ _ _ = undefined dataTypeOf _ _ = undefined dataCast1 _ _ = Nothing dataCast2 _ _ = Nothing
gfoldl :: Data ctx a => Proxy ctx -> (forall b c. Data ctx b => w (b -> c) -> b -> w c) -> (forall g. g -> w g) -> a -> w a
gunfold :: Data ctx a => Proxy ctx -> (forall b r. Data ctx b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c a
toConstr :: Data ctx a => Proxy ctx -> a -> Constr
dataTypeOf :: Data ctx a => Proxy ctx -> a -> DataType
-- | Mediate types and unary type constructors
dataCast1 :: (Data ctx a, Typeable1 t) => Proxy ctx -> (forall b. Data ctx b => w (t b)) -> Maybe (w a)
-- | Mediate types and binary type constructors
dataCast2 :: (Data ctx a, Typeable2 t) => Proxy ctx -> (forall b c. (Data ctx b, Data ctx c) => w (t b c)) -> Maybe (w a)
type GenericT ctx = forall a. Data ctx a => a -> a
gmapT :: Proxy ctx -> GenericT ctx -> GenericT ctx
newtype ID x
ID :: x -> ID x
[unID] :: ID x -> x
type GenericM m ctx = forall a. Data ctx a => a -> m a
gmapM :: Monad m => Proxy ctx -> GenericM m ctx -> GenericM m ctx
type GenericQ ctx r = forall a. Data ctx a => a -> r
gmapQ :: Proxy ctx -> GenericQ ctx r -> GenericQ ctx [r]
gmapQr :: Data ctx a => Proxy ctx -> (r' -> r -> r) -> r -> GenericQ ctx r' -> a -> r
newtype Qr r a
Qr :: (r -> r) -> Qr r a
[unQr] :: Qr r a -> r -> r
-- | Build a term skeleton
fromConstr :: Data ctx a => Proxy ctx -> Constr -> a
-- | Build a term and use a generic function for subterms
fromConstrB :: Data ctx a => Proxy ctx -> (forall b. Data ctx b => b) -> Constr -> a
-- | Monadic variation on "fromConstrB"
fromConstrM :: (Monad m, Data ctx a) => Proxy ctx -> (forall b. Data ctx b => m b) -> Constr -> m a
-- | Representation of datatypes. | A package of constructor
-- representations with names of type and module. | The list of
-- constructors could be an array, a balanced tree, or others.
data DataType
DataType :: String -> DataRep -> DataType
[tycon] :: DataType -> String
[datarep] :: DataType -> DataRep
-- | Representation of constructors
data Constr
Constr :: ConstrRep -> String -> [String] -> Fixity -> DataType -> Constr
[conrep] :: Constr -> ConstrRep
[constring] :: Constr -> String
[confields] :: Constr -> [String]
[confixity] :: Constr -> Fixity
[datatype] :: Constr -> DataType
-- | Equality of constructors
-- | Public representation of datatypes
data DataRep
AlgRep :: [Constr] -> DataRep
IntRep :: DataRep
FloatRep :: DataRep
StringRep :: DataRep
NoRep :: DataRep
-- | Public representation of constructors
data ConstrRep
AlgConstr :: ConIndex -> ConstrRep
IntConstr :: Integer -> ConstrRep
FloatConstr :: Double -> ConstrRep
StringConstr :: String -> ConstrRep
-- | Unique index for datatype constructors. | Textual order is respected.
-- Starts at 1.
type ConIndex = Int
-- | Fixity of constructors
data Fixity
Prefix :: Fixity
Infix :: Fixity
-- | Gets the type constructor including the module
dataTypeName :: DataType -> String
-- | Gets the public presentation of datatypes
dataTypeRep :: DataType -> DataRep
-- | Gets the datatype of a constructor
constrType :: Constr -> DataType
-- | Gets the public presentation of constructors
constrRep :: Constr -> ConstrRep
-- | Look up a constructor by its representation
repConstr :: DataType -> ConstrRep -> Constr
-- | Constructs an algebraic datatype
mkDataType :: String -> [Constr] -> DataType
-- | Constructs a constructor
mkConstr :: DataType -> String -> [String] -> Fixity -> Constr
-- | Gets the constructors
dataTypeConstrs :: DataType -> [Constr]
-- | Gets the field labels of a constructor
constrFields :: Constr -> [String]
-- | Gets the fixity of a constructor
constrFixity :: Constr -> Fixity
-- | Gets the string for a constructor
showConstr :: Constr -> String
-- | Lookup a constructor via a string
readConstr :: DataType -> String -> Maybe Constr
-- | Test for an algebraic type
isAlgType :: DataType -> Bool
-- | Gets the constructor for an index
indexConstr :: DataType -> ConIndex -> Constr
-- | Gets the index of a constructor
constrIndex :: Constr -> ConIndex
-- | Gets the maximum constructor index
maxConstrIndex :: DataType -> ConIndex
-- | Constructs the Int type
mkIntType :: String -> DataType
-- | Constructs the Float type
mkFloatType :: String -> DataType
-- | Constructs the String type
mkStringType :: String -> DataType
-- | Helper for mkIntType, mkFloatType, mkStringType
mkPrimType :: DataRep -> String -> DataType
mkPrimCon :: DataType -> String -> ConstrRep -> Constr
mkIntConstr :: DataType -> Integer -> Constr
mkFloatConstr :: DataType -> Double -> Constr
mkStringConstr :: DataType -> String -> Constr
-- | Constructs a non-representation
mkNorepType :: String -> DataType
-- | Test for a non-representable type
isNorepType :: DataType -> Bool
instance GHC.Show.Show Data.Generics.SYB.WithClass.Basics.DataRep
instance GHC.Classes.Eq Data.Generics.SYB.WithClass.Basics.DataRep
instance GHC.Show.Show Data.Generics.SYB.WithClass.Basics.DataType
instance GHC.Show.Show Data.Generics.SYB.WithClass.Basics.Fixity
instance GHC.Classes.Eq Data.Generics.SYB.WithClass.Basics.Fixity
instance GHC.Show.Show Data.Generics.SYB.WithClass.Basics.ConstrRep
instance GHC.Classes.Eq Data.Generics.SYB.WithClass.Basics.ConstrRep
instance GHC.Show.Show Data.Generics.SYB.WithClass.Basics.Constr
instance GHC.Classes.Eq Data.Generics.SYB.WithClass.Basics.Constr
module Data.Generics.SYB.WithClass.Derive
-- | Takes the name of an algebraic data type, the number of type
-- parameters it has and creates a Typeable instance for it.
deriveTypeablePrim :: Name -> Int -> Q [Dec]
type Constructor = (Name, Int, Maybe [Name], [Type])
escape :: String -> String
-- | Takes a name of a algebraic data type, the number of parameters it has
-- and a list of constructor pairs. Each one of these constructor pairs
-- consists of a constructor name and the number of type parameters it
-- has. The function returns an automatically generated instance
-- declaration for the Data class.
--
-- Doesn't do gunfold, dataCast1 or dataCast2
deriveDataPrim :: Name -> [Type] -> [Constructor] -> Q [Dec]
deriveMinimalData :: Name -> Int -> Q [Dec]
typeInfo :: Dec -> Q (Name, [Name], [Constructor])
-- | Derives the Data and Typeable instances for a single given data type.
deriveOne :: Name -> Q [Dec]
deriveOneDec :: Dec -> Q [Dec]
deriveOneData :: Name -> Q [Dec]
-- | Derives Data and Typeable instances for a list of data types. Order is
-- irrelevant. This should be used in favour of deriveOne since Data and
-- Typeable instances can often depend on other Data and Typeable
-- instances - e.g. if you are deriving a large, mutually recursive data
-- type. If you splice the derived instances in one by one you will need
-- to do it in depedency order which is difficult in most cases and
-- impossible in the mutually recursive case. It is better to bring all
-- the instances into scope at once.
--
-- e.g. if data Foo = Foo Int is declared in an imported module then
-- $(derive [''Foo]) will derive the instances for it
derive :: [Name] -> Q [Dec]
deriveDec :: [Dec] -> Q [Dec]
deriveData :: [Name] -> Q [Dec]
deriveTypeable :: [Name] -> Q [Dec]
deriveOneTypeable :: Name -> Q [Dec]
-- | This function is much like deriveOne except that it brings into scope
-- an instance of Data with minimal definitions. gfoldl will essentially
-- leave a data structure untouched while gunfoldl, toConstr and
-- dataTypeOf will yield errors.
--
-- This function is useful when you are certain that you will never wish
-- to transform a particular data type. For instance you may be
-- transforming another data type that contains other data types, some of
-- which you wish to transform (perhaps recursively) and some which you
-- just wish to return unchanged.
--
-- Sometimes you will be forced to use deriveMinimalOne because you do
-- not have access to the contructors of the data type (perhaps because
-- it is an Abstract Data Type). However, should the interface to the ADT
-- be sufficiently rich it is possible to define you're own Data and
-- Typeable instances.
deriveMinimalOne :: Name -> Q [Dec]
deriveMinimal :: [Name] -> Q [Dec]
module Data.Generics.SYB.WithClass.Instances
instance (Data.Generics.SYB.WithClass.Basics.Data ctx Data.ByteString.Internal.ByteString, Data.Generics.SYB.WithClass.Context.Sat (ctx Data.ByteString.Lazy.Internal.ByteString), Data.Generics.SYB.WithClass.Context.Sat (ctx Data.ByteString.Internal.ByteString)) => Data.Generics.SYB.WithClass.Basics.Data ctx Data.ByteString.Lazy.Internal.ByteString
instance (Data.Generics.SYB.WithClass.Basics.Data ctx (GHC.ForeignPtr.ForeignPtr GHC.Word.Word8), Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Types.Int, Data.Generics.SYB.WithClass.Context.Sat (ctx Data.ByteString.Internal.ByteString), Data.Generics.SYB.WithClass.Context.Sat (ctx (GHC.ForeignPtr.ForeignPtr GHC.Word.Word8)), Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Types.Int)) => Data.Generics.SYB.WithClass.Basics.Data ctx Data.ByteString.Internal.ByteString
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Types.Bool) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Types.Bool
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Types.Char) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Types.Char
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Types.Float) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Types.Float
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Types.Double) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Types.Double
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Types.Int) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Types.Int
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Integer.Type.Integer) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Integer.Type.Integer
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Int.Int8) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Int.Int8
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Int.Int16) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Int.Int16
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Int.Int32) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Int.Int32
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Int.Int64) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Int.Int64
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Types.Word) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Types.Word
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Word.Word8) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Word.Word8
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Word.Word16) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Word.Word16
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Word.Word32) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Word.Word32
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Word.Word64) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Word.Word64
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (GHC.Real.Ratio a)), Data.Generics.SYB.WithClass.Basics.Data ctx a, GHC.Real.Integral a) => Data.Generics.SYB.WithClass.Basics.Data ctx (GHC.Real.Ratio a)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx [a]), Data.Generics.SYB.WithClass.Basics.Data ctx a) => Data.Generics.SYB.WithClass.Basics.Data ctx [a]
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (GHC.Base.Maybe a)), Data.Generics.SYB.WithClass.Basics.Data ctx a) => Data.Generics.SYB.WithClass.Basics.Data ctx (GHC.Base.Maybe a)
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Types.Ordering) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Types.Ordering
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (Data.Either.Either a b)), Data.Generics.SYB.WithClass.Basics.Data ctx a, Data.Generics.SYB.WithClass.Basics.Data ctx b) => Data.Generics.SYB.WithClass.Basics.Data ctx (Data.Either.Either a b)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (a -> b)), Data.Generics.SYB.WithClass.Basics.Data ctx a, Data.Generics.SYB.WithClass.Basics.Data ctx b) => Data.Generics.SYB.WithClass.Basics.Data ctx (a -> b)
instance Data.Generics.SYB.WithClass.Context.Sat (ctx ()) => Data.Generics.SYB.WithClass.Basics.Data ctx ()
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (a, b)), Data.Generics.SYB.WithClass.Basics.Data ctx a, Data.Generics.SYB.WithClass.Basics.Data ctx b) => Data.Generics.SYB.WithClass.Basics.Data ctx (a, b)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (a, b, c)), Data.Generics.SYB.WithClass.Basics.Data ctx a, Data.Generics.SYB.WithClass.Basics.Data ctx b, Data.Generics.SYB.WithClass.Basics.Data ctx c) => Data.Generics.SYB.WithClass.Basics.Data ctx (a, b, c)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (a, b, c, d)), Data.Generics.SYB.WithClass.Basics.Data ctx a, Data.Generics.SYB.WithClass.Basics.Data ctx b, Data.Generics.SYB.WithClass.Basics.Data ctx c, Data.Generics.SYB.WithClass.Basics.Data ctx d) => Data.Generics.SYB.WithClass.Basics.Data ctx (a, b, c, d)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (a, b, c, d, e)), Data.Generics.SYB.WithClass.Basics.Data ctx a, Data.Generics.SYB.WithClass.Basics.Data ctx b, Data.Generics.SYB.WithClass.Basics.Data ctx c, Data.Generics.SYB.WithClass.Basics.Data ctx d, Data.Generics.SYB.WithClass.Basics.Data ctx e) => Data.Generics.SYB.WithClass.Basics.Data ctx (a, b, c, d, e)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (a, b, c, d, e, f)), Data.Generics.SYB.WithClass.Basics.Data ctx a, Data.Generics.SYB.WithClass.Basics.Data ctx b, Data.Generics.SYB.WithClass.Basics.Data ctx c, Data.Generics.SYB.WithClass.Basics.Data ctx d, Data.Generics.SYB.WithClass.Basics.Data ctx e, Data.Generics.SYB.WithClass.Basics.Data ctx f) => Data.Generics.SYB.WithClass.Basics.Data ctx (a, b, c, d, e, f)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (a, b, c, d, e, f, g)), Data.Generics.SYB.WithClass.Basics.Data ctx a, Data.Generics.SYB.WithClass.Basics.Data ctx b, Data.Generics.SYB.WithClass.Basics.Data ctx c, Data.Generics.SYB.WithClass.Basics.Data ctx d, Data.Generics.SYB.WithClass.Basics.Data ctx e, Data.Generics.SYB.WithClass.Basics.Data ctx f, Data.Generics.SYB.WithClass.Basics.Data ctx g) => Data.Generics.SYB.WithClass.Basics.Data ctx (a, b, c, d, e, f, g)
instance Data.Generics.SYB.WithClass.Context.Sat (ctx Data.Typeable.Internal.TypeRep) => Data.Generics.SYB.WithClass.Basics.Data ctx Data.Typeable.Internal.TypeRep
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.Types.TyCon) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.Types.TyCon
instance Data.Generics.SYB.WithClass.Context.Sat (ctx Data.Generics.SYB.WithClass.Basics.DataType) => Data.Generics.SYB.WithClass.Basics.Data ctx Data.Generics.SYB.WithClass.Basics.DataType
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (GHC.Types.IO a)), Data.Typeable.Internal.Typeable a) => Data.Generics.SYB.WithClass.Basics.Data ctx (GHC.Types.IO a)
instance Data.Generics.SYB.WithClass.Context.Sat (ctx GHC.IO.Handle.Types.Handle) => Data.Generics.SYB.WithClass.Basics.Data ctx GHC.IO.Handle.Types.Handle
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (GHC.Ptr.Ptr a)), Data.Typeable.Internal.Typeable a) => Data.Generics.SYB.WithClass.Basics.Data ctx (GHC.Ptr.Ptr a)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (GHC.Stable.StablePtr a)), Data.Typeable.Internal.Typeable a) => Data.Generics.SYB.WithClass.Basics.Data ctx (GHC.Stable.StablePtr a)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (GHC.IORef.IORef a)), Data.Typeable.Internal.Typeable a) => Data.Generics.SYB.WithClass.Basics.Data ctx (GHC.IORef.IORef a)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (GHC.ForeignPtr.ForeignPtr a)), Data.Typeable.Internal.Typeable a) => Data.Generics.SYB.WithClass.Basics.Data ctx (GHC.ForeignPtr.ForeignPtr a)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (GHC.ST.ST s a)), Data.Typeable.Internal.Typeable s, Data.Typeable.Internal.Typeable a) => Data.Generics.SYB.WithClass.Basics.Data ctx (GHC.ST.ST s a)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (GHC.MVar.MVar a)), Data.Typeable.Internal.Typeable a) => Data.Generics.SYB.WithClass.Basics.Data ctx (GHC.MVar.MVar a)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx [b]), Data.Generics.SYB.WithClass.Context.Sat (ctx (GHC.Arr.Array a b)), Data.Typeable.Internal.Typeable a, Data.Generics.SYB.WithClass.Basics.Data ctx b, Data.Generics.SYB.WithClass.Basics.Data ctx [b], GHC.Arr.Ix a) => Data.Generics.SYB.WithClass.Basics.Data ctx (GHC.Arr.Array a b)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (Data.Map.Base.Map a b)), Data.Generics.SYB.WithClass.Basics.Data ctx a, Data.Generics.SYB.WithClass.Basics.Data ctx b, GHC.Classes.Ord a) => Data.Generics.SYB.WithClass.Basics.Data ctx (Data.Map.Base.Map a b)
instance (Data.Generics.SYB.WithClass.Context.Sat (ctx (Data.Set.Base.Set a)), Data.Generics.SYB.WithClass.Basics.Data ctx a, GHC.Classes.Ord a) => Data.Generics.SYB.WithClass.Basics.Data ctx (Data.Set.Base.Set a)
|