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

-- | Scrap Your Boilerplate
--   
--   This package contains the generics system described in the Scrap
--   Your Boilerplate papers (see
--   http://www.cs.uu.nl/wiki/GenericProgramming/SYB). It defines
--   the Data class of types permitting folding and unfolding of
--   constructor applications, instances of this class for primitive types,
--   and a variety of traversals.
@package syb
@version 0.7.2.4

-- | This module provides a number of declarations for typical generic
--   function types, corresponding type case, and others.
module Data.Generics.Aliases

-- | Extend the identity function with a type-specific transformation. The
--   function created by mkT ext behaves like the identity
--   function on all arguments which cannot be cast to type b, and
--   like the function ext otherwise. The name mkT is short
--   for "make transformation".
--   
--   
Examples
--   
--   
--   >>> mkT not True
--   False
--   
--   
--   
--   >>> mkT not 'a'
--   'a'
--   
mkT :: (Typeable a, Typeable b) => (b -> b) -> a -> a

-- | Extend a generic transformation by a type-specific transformation. The
--   function created by extT def ext behaves like the generic
--   transformation def if its argument cannot be cast to the type
--   b, and like the type-specific transformation ext
--   otherwise. The name extT is short for "extend transformation".
--   
--   
Examples
--   
--   
--   >>> extT id not True
--   False
--   
--   
--   
--   >>> extT id not 'a'
--   'a'
--   
extT :: (Typeable a, Typeable b) => (a -> a) -> (b -> b) -> a -> a

-- | The function created by mkQ def f returns the default result
--   def if its argument cannot be cast to type b,
--   otherwise it returns the result of applying f to its
--   argument. The name mkQ is short for "make query".
--   
--   
Examples
--   
--   
--   >>> mkQ "default" (show :: Bool -> String) True
--   "True"
--   
--   
--   
--   >>> mkQ "default" (show :: Bool -> String) ()
--   "default"
--   
mkQ :: (Typeable a, Typeable b) => r -> (b -> r) -> a -> r

-- | Extend a generic query by a type-specific query. The function created
--   by extQ def ext behaves like the generic query def
--   if its argument cannot be cast to the type b, and like the
--   type-specific query ext otherwise. The name extQ is
--   short for "extend query".
--   
--   
Examples
--   
--   
--   >>> extQ (const True) not True
--   False
--   
--   
--   
--   >>> extQ (const True) not 'a'
--   True
--   
extQ :: (Typeable a, Typeable b) => (a -> r) -> (b -> r) -> a -> r

-- | Extend the default monadic action pure :: Monad m => a -> m
--   a by a type-specific monadic action. The function created by
--   mkM act behaves like pure if its argument cannot be
--   cast to type b, and like the monadic action act
--   otherwise. The name mkM is short for "make monadic
--   transformation".
--   
--   
Examples
--   
--   
--   >>> mkM (\x -> [x, not x]) True
--   [True,False]
--   
--   
--   
--   >>> mkM (\x -> [x, not x]) (5 :: Int)
--   [5]
--   
mkM :: (Monad m, Typeable a, Typeable b) => (b -> m b) -> a -> m a

-- | Extend a generic monadic transformation by a type-specific case. The
--   function created by extM def ext behaves like the monadic
--   transformation def if its argument cannot be cast to type
--   b, and like the monadic transformation ext
--   otherwise. The name extM is short for "extend monadic
--   transformation".
--   
--   
Examples
--   
--   
--   >>> extM (\x -> [x,x])(\x -> [not x, x]) True
--   [False,True]
--   
--   
--   
--   >>> extM (\x -> [x,x])(\x -> [not x, x]) (5 :: Int)
--   [5,5]
--   
extM :: (Monad m, Typeable a, Typeable b) => (a -> m a) -> (b -> m b) -> a -> m a

-- | Extend the default MonadPlus action const mzero by a
--   type-specific MonadPlus action. The function created by
--   mkMp act behaves like const mzero if its argument
--   cannot be cast to type b, and like the monadic action
--   act otherwise. The name mkMp is short for "make
--   MonadPlus transformation".
--   
--   
Examples
--   
--   
--   >>> mkMp (\x -> Just (not x)) True
--   Just False
--   
--   
--   
--   >>> mkMp (\x -> Just (not x)) 'a'
--   Nothing
--   
mkMp :: (MonadPlus m, Typeable a, Typeable b) => (b -> m b) -> a -> m a

-- | Extend a generic MonadPlus transformation by a type-specific case. The
--   function created by extMp def ext behaves like
--   MonadPlus transformation def if its argument cannot be
--   cast to type b, and like the transformation ext
--   otherwise. Note that extMp behaves exactly like extM.
--   The name extMp is short for "extend MonadPlus transformation".
--   
--   
Examples
--   
--   
--   >>> extMp (\x -> [x,x])(\x -> [not x, x]) True
--   [False,True]
--   
--   
--   
--   >>> extMp (\x -> [x,x])(\x -> [not x, x]) (5 :: Int)
--   [5,5]
--   
extMp :: (MonadPlus m, Typeable a, Typeable b) => (a -> m a) -> (b -> m b) -> a -> m a

-- | Make a generic reader from a type-specific case. The function created
--   by mkR f behaves like the reader f if an expression
--   of type a can be cast to type b, and like the
--   expression mzero otherwise. The name mkR is short for
--   "make reader".
--   
--   
Examples
--   
--   
--   >>> mkR (Just True) :: Maybe Bool
--   Just True
--   
--   
--   
--   >>> mkR (Just True) :: Maybe Int
--   Nothing
--   
mkR :: (MonadPlus m, Typeable a, Typeable b) => m b -> m a

-- | Extend a generic reader by a type-specific case. The reader created by
--   extR def ext behaves like the reader def if
--   expressions of type b cannot be cast to type a, and
--   like the reader ext otherwise. The name extR is short
--   for "extend reader".
--   
--   
Examples
--   
--   
--   >>> extR (Just True) (Just 'a')
--   Just True
--   
--   
--   
--   >>> extR (Just True) (Just False)
--   Just False
--   
extR :: (Monad m, Typeable a, Typeable b) => m a -> m b -> m a

-- | Extend a generic builder by a type-specific case. The builder created
--   by extB def ext returns def if ext cannot
--   be cast to type a, and like ext otherwise. The name
--   extB is short for "extend builder".
--   
--   
Examples
--   
--   
--   >>> extB True 'a'
--   True
--   
--   
--   
--   >>> extB True False
--   False
--   
extB :: (Typeable a, Typeable b) => a -> b -> a

-- | Flexible type extension
--   
--   
Examples
--   
--   
--   >>> ext0 [1 :: Int, 2, 3] [True, False] :: [Int]
--   [1,2,3]
--   
--   
--   
--   >>> ext0 [1 :: Int, 2, 3] [4 :: Int, 5, 6] :: [Int]
--   [4,5,6]
--   
ext0 :: (Typeable a, Typeable b) => c a -> c b -> c a

-- | Generic transformations, i.e., take an "a" and return an "a"
type GenericT = forall a. Data a => a -> a

-- | The type synonym GenericT has a polymorphic type, and can
--   therefore not appear in places where monomorphic types are expected,
--   for example in a list. The newtype GenericT' wraps
--   GenericT in a newtype to lift this restriction.
newtype GenericT'
GT :: GenericT -> GenericT'
[unGT] :: GenericT' -> GenericT

-- | Generic queries of type "r", i.e., take any "a" and return an "r"
type GenericQ r = forall a. Data a => a -> r

-- | The type synonym GenericQ has a polymorphic type, and can
--   therefore not appear in places where monomorphic types are expected,
--   for example in a list. The newtype GenericQ' wraps
--   GenericQ in a newtype to lift this restriction.
newtype GenericQ' r
GQ :: GenericQ r -> GenericQ' r
[unGQ] :: GenericQ' r -> GenericQ r

-- | Generic monadic transformations, i.e., take an "a" and compute an "a"
type GenericM (m :: Type -> Type) = forall a. Data a => a -> m a

-- | The type synonym GenericM has a polymorphic type, and can
--   therefore not appear in places where monomorphic types are expected,
--   for example in a list. The newtype GenericM' wraps
--   GenericM in a newtype to lift this restriction.
newtype GenericM' (m :: Type -> Type)
GM :: GenericM m -> GenericM' (m :: Type -> Type)
[unGM] :: GenericM' (m :: Type -> Type) -> GenericM m

-- | Generic readers, say monadic builders, i.e., produce an "a" with the
--   help of a monad "m".
type GenericR (m :: Type -> Type) = forall a. Data a => m a

-- | Generic builders i.e., produce an "a".
type GenericB = forall a. Data a => a

-- | The general scheme underlying generic functions assumed by gfoldl;
--   there are isomorphisms such as GenericT = Generic T.
type Generic (c :: Type -> Type) = forall a. Data a => a -> c a

-- | The type synonym Generic has a polymorphic type, and can
--   therefore not appear in places where monomorphic types are expected,
--   for example in a list. The data type Generic' wraps
--   Generic in a data type to lift this restriction.
data Generic' (c :: Type -> Type)
Generic' :: Generic c -> Generic' (c :: Type -> Type)
[unGeneric'] :: Generic' (c :: Type -> Type) -> Generic c

-- | Left-biased choice on maybes
--   
--   
Examples
--   
--   
--   >>> orElse Nothing Nothing
--   Nothing
--   
--   
--   
--   >>> orElse Nothing (Just 'a')
--   Just 'a'
--   
--   
--   
--   >>> orElse (Just 'a') Nothing
--   Just 'a'
--   
--   
--   
--   >>> orElse (Just 'a') (Just 'b')
--   Just 'a'
--   
orElse :: Maybe a -> Maybe a -> Maybe a

-- | Recover from the failure of monadic transformation by identity
recoverMp :: forall (m :: Type -> Type). MonadPlus m => GenericM m -> GenericM m

-- | Recover from the failure of monadic query by a constant
recoverQ :: forall (m :: Type -> Type) r. MonadPlus m => r -> GenericQ (m r) -> GenericQ (m r)

-- | Choice for monadic transformations
choiceMp :: forall (m :: Type -> Type). MonadPlus m => GenericM m -> GenericM m -> GenericM m

-- | Choice for monadic queries
choiceQ :: forall (m :: Type -> Type) r. MonadPlus m => GenericQ (m r) -> GenericQ (m r) -> GenericQ (m r)

-- | Flexible type extension
ext1 :: (Data a, Typeable t) => c a -> (forall d. Data d => c (t d)) -> c a

-- | Type extension of transformations for unary type constructors
ext1T :: (Data d, Typeable t) => (forall e. Data e => e -> e) -> (forall f. Data f => t f -> t f) -> d -> d

-- | Type extension of monadic transformations for type constructors
ext1M :: (Monad m, Data d, Typeable t) => (forall e. Data e => e -> m e) -> (forall f. Data f => t f -> m (t f)) -> d -> m d

-- | Type extension of queries for type constructors
ext1Q :: (Data d, Typeable t) => (d -> q) -> (forall e. Data e => t e -> q) -> d -> q

-- | Type extension of readers for type constructors
ext1R :: (Monad m, Data d, Typeable t) => m d -> (forall e. Data e => m (t e)) -> m d

-- | Type extension of builders for type constructors
ext1B :: (Data a, Typeable t) => a -> (forall b. Data b => t b) -> a

-- | Flexible type extension
ext2 :: (Data a, Typeable t) => c a -> (forall d1 d2. (Data d1, Data d2) => c (t d1 d2)) -> c a

-- | Type extension of transformations for unary type constructors
ext2T :: (Data d, Typeable t) => (forall e. Data e => e -> e) -> (forall d1 d2. (Data d1, Data d2) => t d1 d2 -> t d1 d2) -> d -> d

-- | Type extension of monadic transformations for type constructors
ext2M :: (Monad m, Data d, Typeable t) => (forall e. Data e => e -> m e) -> (forall d1 d2. (Data d1, Data d2) => t d1 d2 -> m (t d1 d2)) -> d -> m d

-- | Type extension of queries for type constructors
ext2Q :: (Data d, Typeable t) => (d -> q) -> (forall d1 d2. (Data d1, Data d2) => t d1 d2 -> q) -> d -> q

-- | Type extension of readers for type constructors
ext2R :: (Monad m, Data d, Typeable t) => m d -> (forall d1 d2. (Data d1, Data d2) => m (t d1 d2)) -> m d

-- | Type extension of builders for type constructors
ext2B :: (Data a, Typeable t) => a -> (forall d1 d2. (Data d1, Data d2) => t d1 d2) -> a

-- | "Scrap your boilerplate" --- Generic programming in Haskell. See
--   http://www.cs.uu.nl/wiki/GenericProgramming/SYB. This module
--   provides the Data class with its primitives for generic
--   programming, which is now defined in Data.Data. Therefore
--   this module simply re-exports Data.Data.
module Data.Generics.Basics

-- | This module provides generic builder functions. These functions
--   construct values of a given type.
module Data.Generics.Builders

-- | Construct the empty value for a datatype. For algebraic datatypes, the
--   leftmost constructor is chosen.
empty :: Data a => a

-- | Return a list of values of a datatype. Each value is one of the
--   possible constructors of the datatype, populated with empty
--   values.
constrs :: Data a => [a]

-- | "Scrap your boilerplate" --- Generic programming in Haskell See
--   http://www.cs.uu.nl/wiki/GenericProgramming/SYB. The present
--   module contains thirteen Data instances which are considered
--   dubious (either because the types are abstract or just not meant to be
--   traversed). Instances in this module might change or disappear in
--   future releases of this package.
--   
--   (This module does not export anything. It really just defines
--   instances.)
module Data.Generics.Instances
instance GHC.Internal.Data.Data.Data GHC.Internal.Data.Data.DataType
instance (GHC.Internal.Data.Data.Data a, GHC.Internal.Data.Data.Data b) => GHC.Internal.Data.Data.Data (a -> b)
instance GHC.Internal.Data.Data.Data GHC.Internal.IO.Handle.Types.Handle
instance GHC.Internal.Data.Typeable.Internal.Typeable a => GHC.Internal.Data.Data.Data (GHC.Types.IO a)
instance GHC.Internal.Data.Typeable.Internal.Typeable a => GHC.Internal.Data.Data.Data (GHC.Internal.IORef.IORef a)
instance GHC.Internal.Data.Typeable.Internal.Typeable a => GHC.Internal.Data.Data.Data (GHC.Internal.MVar.MVar a)
instance (GHC.Internal.Data.Typeable.Internal.Typeable s, GHC.Internal.Data.Typeable.Internal.Typeable a) => GHC.Internal.Data.Data.Data (GHC.Internal.ST.ST s a)
instance GHC.Internal.Data.Typeable.Internal.Typeable a => GHC.Internal.Data.Data.Data (GHC.Internal.Conc.Sync.STM a)
instance GHC.Internal.Data.Typeable.Internal.Typeable a => GHC.Internal.Data.Data.Data (GHC.Internal.Stable.StablePtr a)
instance GHC.Internal.Data.Typeable.Internal.Typeable a => GHC.Internal.Data.Data.Data (GHC.Internal.Conc.Sync.TVar a)
instance GHC.Internal.Data.Data.Data GHC.Internal.Conc.Sync.ThreadId
instance GHC.Internal.Data.Data.Data GHC.Types.TyCon

-- | "Scrap your boilerplate" --- Generic programming in Haskell See
--   http://www.cs.uu.nl/wiki/GenericProgramming/SYB. The present
--   module provides frequently used generic traversal schemes.
module Data.Generics.Schemes

-- | Apply a transformation everywhere in bottom-up manner
everywhere :: (forall a. Data a => a -> a) -> forall a. Data a => a -> a

-- | Apply a transformation everywhere in top-down manner
everywhere' :: (forall a. Data a => a -> a) -> forall a. Data a => a -> a

-- | Variation on everywhere with an extra stop condition
everywhereBut :: GenericQ Bool -> GenericT -> GenericT

-- | Monadic variation on everywhere
everywhereM :: forall (m :: Type -> Type). Monad m => GenericM m -> GenericM m

-- | Apply a monadic transformation at least somewhere
somewhere :: forall (m :: Type -> Type). MonadPlus m => GenericM m -> GenericM m

-- | Summarise all nodes in top-down, left-to-right order
everything :: (r -> r -> r) -> GenericQ r -> GenericQ r

-- | Variation of "everything" with an added stop condition
everythingBut :: (r -> r -> r) -> GenericQ (r, Bool) -> GenericQ r

-- | Summarise all nodes in top-down, left-to-right order, carrying some
--   state down the tree during the computation, but not left-to-right to
--   siblings.
everythingWithContext :: s -> (r -> r -> r) -> GenericQ (s -> (r, s)) -> GenericQ r

-- | Get a list of all entities that meet a predicate
listify :: Typeable r => (r -> Bool) -> GenericQ [r]

-- | Look up a subterm by means of a maybe-typed filter
something :: GenericQ (Maybe u) -> GenericQ (Maybe u)

-- | Bottom-up synthesis of a data structure; 1st argument z is the initial
--   element for the synthesis; 2nd argument o is for reduction of results
--   from subterms; 3rd argument f updates the synthesised data according
--   to the given term
synthesize :: s -> (t -> s -> s) -> GenericQ (s -> t) -> GenericQ t

-- | Compute size of an arbitrary data structure
gsize :: Data a => a -> Int

-- | Count the number of immediate subterms of the given term
glength :: GenericQ Int

-- | Determine depth of the given term
gdepth :: GenericQ Int

-- | Determine the number of all suitable nodes in a given term
gcount :: GenericQ Bool -> GenericQ Int

-- | Determine the number of all nodes in a given term
gnodecount :: GenericQ Int

-- | Determine the number of nodes of a given type in a given term
gtypecount :: Typeable a => a -> GenericQ Int

-- | Find (unambiguously) an immediate subterm of a given type
gfindtype :: (Data x, Typeable y) => x -> Maybe y

-- | "Scrap your boilerplate" --- Generic programming in Haskell See
--   http://www.cs.uu.nl/wiki/GenericProgramming/SYB. The present
--   module provides generic operations for text serialisation of terms.
module Data.Generics.Text

-- | Generic show: an alternative to "deriving Show"
gshow :: Data a => a -> String

-- | Generic shows
gshows :: Data a => a -> ShowS

-- | Generic read: an alternative to "deriving Read"
gread :: Data a => ReadS a

-- | "Scrap your boilerplate" --- Generic programming in Haskell See
--   http://www.cs.uu.nl/wiki/GenericProgramming/SYB. The present
--   module provides support for multi-parameter traversal, which is also
--   demonstrated with generic operations like equality.
module Data.Generics.Twins

-- | gfoldl with accumulation
gfoldlAccum :: Data d => (forall e r. Data e => a -> c (e -> r) -> e -> (a, c r)) -> (forall g. () => a -> g -> (a, c g)) -> a -> d -> (a, c d)

-- | gmapT with accumulation
gmapAccumT :: Data d => (forall e. Data e => a -> e -> (a, e)) -> a -> d -> (a, d)

-- | gmapM with accumulation
gmapAccumM :: (Data d, Monad m) => (forall e. Data e => a -> e -> (a, m e)) -> a -> d -> (a, m d)

-- | gmapQl with accumulation
gmapAccumQl :: Data d => (r -> r' -> r) -> r -> (forall e. Data e => a -> e -> (a, r')) -> a -> d -> (a, r)

-- | gmapQr with accumulation
gmapAccumQr :: Data d => (r' -> r -> r) -> r -> (forall e. Data e => a -> e -> (a, r')) -> a -> d -> (a, r)

-- | gmapQ with accumulation
gmapAccumQ :: Data d => (forall e. Data e => a -> e -> (a, q)) -> a -> d -> (a, [q])

-- | Applicative version
gmapAccumA :: forall b d a. (Data d, Applicative a) => (forall e. Data e => b -> e -> (b, a e)) -> b -> d -> (b, a d)

-- | Twin map for transformation
gzipWithT :: GenericQ GenericT -> GenericQ GenericT

-- | Twin map for monadic transformation
gzipWithM :: forall (m :: Type -> Type). Monad m => GenericQ (GenericM m) -> GenericQ (GenericM m)

-- | Twin map for queries
gzipWithQ :: GenericQ (GenericQ r) -> GenericQ (GenericQ [r])

-- | Generic equality: an alternative to "deriving Eq"
geq :: Data a => a -> a -> Bool

-- | Generic zip controlled by a function with type-specific branches
gzip :: GenericQ (GenericM Maybe) -> GenericQ (GenericM Maybe)

-- | Generic comparison: an alternative to "deriving Ord"
gcompare :: Data a => a -> a -> Ordering

-- | "Scrap your boilerplate" --- Generic programming in Haskell See
--   http://www.cs.uu.nl/wiki/GenericProgramming/SYB. To scrap your
--   boilerplate it is sufficient to import the present module, which
--   simply re-exports all themes of the Data.Generics library.
module Data.Generics

-- | Convenience alias for Data.Generics.
module Generics.SYB

-- | Convenience alias for Data.Generics.Aliases.
module Generics.SYB.Aliases

-- | Convenience alias for Data.Generics.Basics.
module Generics.SYB.Basics

-- | Convenience alias for Data.Generics.Builders.
module Generics.SYB.Builders

-- | Convenience alias for Data.Generics.Instances.
module Generics.SYB.Instances

-- | Convenience alias for Data.Generics.Schemes.
module Generics.SYB.Schemes

-- | Convenience alias for Data.Generics.Text.
module Generics.SYB.Text

-- | Convenience alias for Data.Generics.Twins.
module Generics.SYB.Twins
