{-# LANGUAGE CPP                        #-}
{-# LANGUAGE DataKinds                  #-}
{-# LANGUAGE DeriveFunctor              #-}
{-# LANGUAGE DeriveGeneric              #-}
{-# LANGUAGE EmptyDataDeriving          #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE FlexibleInstances          #-}
{-# LANGUAGE GADTs                      #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MagicHash                  #-}
{-# LANGUAGE NoImplicitPrelude          #-}
{-# LANGUAGE PolyKinds                  #-}
{-# LANGUAGE ScopedTypeVariables        #-}
{-# LANGUAGE StandaloneDeriving         #-}
{-# LANGUAGE Trustworthy                #-}
{-# LANGUAGE TypeFamilies               #-}
{-# LANGUAGE TypeOperators              #-}
{-# LANGUAGE UndecidableInstances       #-}

-----------------------------------------------------------------------------
-- |
-- Module      :  GHC.Generics
-- Copyright   :  (c) Universiteit Utrecht 2010-2011, University of Oxford 2012-2014
-- License     :  see libraries/base/LICENSE
--
-- Maintainer  :  libraries@haskell.org
-- Stability   :  internal
-- Portability :  non-portable
--
-- @since 4.6.0.0
--
-- If you're using @GHC.Generics@, you should consider using the
-- <http://hackage.haskell.org/package/generic-deriving> package, which
-- contains many useful generic functions.

module GHC.Generics  (
-- * Introduction
--
-- |
--
-- Datatype-generic functions are based on the idea of converting values of
-- a datatype @T@ into corresponding values of a (nearly) isomorphic type @'Rep' T@.
-- The type @'Rep' T@ is
-- built from a limited set of type constructors, all provided by this module. A
-- datatype-generic function is then an overloaded function with instances
-- for most of these type constructors, together with a wrapper that performs
-- the mapping between @T@ and @'Rep' T@. By using this technique, we merely need
-- a few generic instances in order to implement functionality that works for any
-- representable type.
--
-- Representable types are collected in the 'Generic' class, which defines the
-- associated type 'Rep' as well as conversion functions 'from' and 'to'.
-- Typically, you will not define 'Generic' instances by hand, but have the compiler
-- derive them for you.

-- ** Representing datatypes
--
-- |
--
-- The key to defining your own datatype-generic functions is to understand how to
-- represent datatypes using the given set of type constructors.
--
-- Let us look at an example first:
--
-- @
-- data Tree a = Leaf a | Node (Tree a) (Tree a)
--   deriving 'Generic'
-- @
--
-- The above declaration (which requires the language pragma @DeriveGeneric@)
-- causes the following representation to be generated:
--
-- @
-- instance 'Generic' (Tree a) where
--   type 'Rep' (Tree a) =
--     'D1' ('MetaData \"Tree\" \"Main\" \"package-name\" 'False)
--       ('C1' ('MetaCons \"Leaf\" 'PrefixI 'False)
--          ('S1' ('MetaSel 'Nothing
--                          'NoSourceUnpackedness
--                          'NoSourceStrictness
--                          'DecidedLazy)
--                 ('Rec0' a))
--        ':+:'
--        'C1' ('MetaCons \"Node\" 'PrefixI 'False)
--          ('S1' ('MetaSel 'Nothing
--                          'NoSourceUnpackedness
--                          'NoSourceStrictness
--                          'DecidedLazy)
--                ('Rec0' (Tree a))
--           ':*:'
--           'S1' ('MetaSel 'Nothing
--                          'NoSourceUnpackedness
--                          'NoSourceStrictness
--                          'DecidedLazy)
--                ('Rec0' (Tree a))))
--   ...
-- @
--
-- /Hint:/ You can obtain information about the code being generated from GHC by passing
-- the @-ddump-deriv@ flag. In GHCi, you can expand a type family such as 'Rep' using
-- the @:kind!@ command.
--
-- This is a lot of information! However, most of it is actually merely meta-information
-- that makes names of datatypes and constructors and more available on the type level.
--
-- Here is a reduced representation for @Tree@ with nearly all meta-information removed,
-- for now keeping only the most essential aspects:
--
-- @
-- instance 'Generic' (Tree a) where
--   type 'Rep' (Tree a) =
--     'Rec0' a
--     ':+:'
--     ('Rec0' (Tree a) ':*:' 'Rec0' (Tree a))
-- @
--
-- The @Tree@ datatype has two constructors. The representation of individual constructors
-- is combined using the binary type constructor ':+:'.
--
-- The first constructor consists of a single field, which is the parameter @a@. This is
-- represented as @'Rec0' a@.
--
-- The second constructor consists of two fields. Each is a recursive field of type @Tree a@,
-- represented as @'Rec0' (Tree a)@. Representations of individual fields are combined using
-- the binary type constructor ':*:'.
--
-- Now let us explain the additional tags being used in the complete representation:
--
--    * The @'S1' ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness
--      'DecidedLazy)@ tag indicates several things. The @'Nothing@ indicates
--      that there is no record field selector associated with this field of
--      the constructor (if there were, it would have been marked @'Just
--      \"recordName\"@ instead). The other types contain meta-information on
--      the field's strictness:
--
--      * There is no @{\-\# UNPACK \#-\}@ or @{\-\# NOUNPACK \#-\}@ annotation
--        in the source, so it is tagged with @'NoSourceUnpackedness@.
--
--      * There is no strictness (@!@) or laziness (@~@) annotation in the
--        source, so it is tagged with @'NoSourceStrictness@.
--
--      * The compiler infers that the field is lazy, so it is tagged with
--        @'DecidedLazy@. Bear in mind that what the compiler decides may be
--        quite different from what is written in the source. See
--        'DecidedStrictness' for a more detailed explanation.
--
--      The @'MetaSel@ type is also an instance of the type class 'Selector',
--      which can be used to obtain information about the field at the value
--      level.
--
--    * The @'C1' ('MetaCons \"Leaf\" 'PrefixI 'False)@ and
--      @'C1' ('MetaCons \"Node\" 'PrefixI 'False)@ invocations indicate that the enclosed part is
--      the representation of the first and second constructor of datatype @Tree@, respectively.
--      Here, the meta-information regarding constructor names, fixity and whether
--      it has named fields or not is encoded at the type level. The @'MetaCons@
--      type is also an instance of the type class 'Constructor'. This type class can be used
--      to obtain information about the constructor at the value level.
--
--    * The @'D1' ('MetaData \"Tree\" \"Main\" \"package-name\" 'False)@ tag
--      indicates that the enclosed part is the representation of the
--      datatype @Tree@. Again, the meta-information is encoded at the type level.
--      The @'MetaData@ type is an instance of class 'Datatype', which
--      can be used to obtain the name of a datatype, the module it has been
--      defined in, the package it is located under, and whether it has been
--      defined using @data@ or @newtype@ at the value level.

-- ** Derived and fundamental representation types
--
-- |
--
-- There are many datatype-generic functions that do not distinguish between positions that
-- are parameters or positions that are recursive calls. There are also many datatype-generic
-- functions that do not care about the names of datatypes and constructors at all. To keep
-- the number of cases to consider in generic functions in such a situation to a minimum,
-- it turns out that many of the type constructors introduced above are actually synonyms,
-- defining them to be variants of a smaller set of constructors.

-- *** Individual fields of constructors: 'K1'
--
-- |
--
-- The type constructor 'Rec0' is a variant of 'K1':
--
-- @
-- type 'Rec0' = 'K1' 'R'
-- @
--
-- Here, 'R' is a type-level proxy that does not have any associated values.
--
-- There used to be another variant of 'K1' (namely @Par0@), but it has since
-- been deprecated.

-- *** Meta information: 'M1'
--
-- |
--
-- The type constructors 'S1', 'C1' and 'D1' are all variants of 'M1':
--
-- @
-- type 'S1' = 'M1' 'S'
-- type 'C1' = 'M1' 'C'
-- type 'D1' = 'M1' 'D'
-- @
--
-- The types 'S', 'C' and 'D' are once again type-level proxies, just used to create
-- several variants of 'M1'.

-- *** Additional generic representation type constructors
--
-- |
--
-- Next to 'K1', 'M1', ':+:' and ':*:' there are a few more type constructors that occur
-- in the representations of other datatypes.

-- **** Empty datatypes: 'V1'
--
-- |
--
-- For empty datatypes, 'V1' is used as a representation. For example,
--
-- @
-- data Empty deriving 'Generic'
-- @
--
-- yields
--
-- @
-- instance 'Generic' Empty where
--   type 'Rep' Empty =
--     'D1' ('MetaData \"Empty\" \"Main\" \"package-name\" 'False) 'V1'
-- @

-- **** Constructors without fields: 'U1'
--
-- |
--
-- If a constructor has no arguments, then 'U1' is used as its representation. For example
-- the representation of 'Bool' is
--
-- @
-- instance 'Generic' Bool where
--   type 'Rep' Bool =
--     'D1' ('MetaData \"Bool\" \"Data.Bool\" \"package-name\" 'False)
--       ('C1' ('MetaCons \"False\" 'PrefixI 'False) 'U1' ':+:' 'C1' ('MetaCons \"True\" 'PrefixI 'False) 'U1')
-- @

-- *** Representation of types with many constructors or many fields
--
-- |
--
-- As ':+:' and ':*:' are just binary operators, one might ask what happens if the
-- datatype has more than two constructors, or a constructor with more than two
-- fields. The answer is simple: the operators are used several times, to combine
-- all the constructors and fields as needed. However, users /should not rely on
-- a specific nesting strategy/ for ':+:' and ':*:' being used. The compiler is
-- free to choose any nesting it prefers. (In practice, the current implementation
-- tries to produce a more-or-less balanced nesting, so that the traversal of
-- the structure of the datatype from the root to a particular component can be
-- performed in logarithmic rather than linear time.)

-- ** Defining datatype-generic functions
--
-- |
--
-- A datatype-generic function comprises two parts:
--
--    1. /Generic instances/ for the function, implementing it for most of the representation
--       type constructors introduced above.
--
--    2. A /wrapper/ that for any datatype that is in `Generic`, performs the conversion
--       between the original value and its `Rep`-based representation and then invokes the
--       generic instances.
--
-- As an example, let us look at a function @encode@ that produces a naive, but lossless
-- bit encoding of values of various datatypes. So we are aiming to define a function
--
-- @
-- encode :: 'Generic' a => a -> [Bool]
-- @
--
-- where we use 'Bool' as our datatype for bits.
--
-- For part 1, we define a class @Encode'@. Perhaps surprisingly, this class is parameterized
-- over a type constructor @f@ of kind @* -> *@. This is a technicality: all the representation
-- type constructors operate with kind @* -> *@ as base kind. But the type argument is never
-- being used. This may be changed at some point in the future. The class has a single method,
-- and we use the type we want our final function to have, but we replace the occurrences of
-- the generic type argument @a@ with @f p@ (where the @p@ is any argument; it will not be used).
--
-- > class Encode' f where
-- >   encode' :: f p -> [Bool]
--
-- With the goal in mind to make @encode@ work on @Tree@ and other datatypes, we now define
-- instances for the representation type constructors 'V1', 'U1', ':+:', ':*:', 'K1', and 'M1'.

-- *** Definition of the generic representation types
--
-- |
--
-- In order to be able to do this, we need to know the actual definitions of these types:
--
-- @
-- data    'V1'        p                       -- lifted version of Empty
-- data    'U1'        p = 'U1'                  -- lifted version of ()
-- data    (':+:') f g p = 'L1' (f p) | 'R1' (g p) -- lifted version of 'Either'
-- data    (':*:') f g p = (f p) ':*:' (g p)     -- lifted version of (,)
-- newtype 'K1'    i c p = 'K1' { 'unK1' :: c }    -- a container for a c
-- newtype 'M1'  i t f p = 'M1' { 'unM1' :: f p }  -- a wrapper
-- @
--
-- So, 'U1' is just the unit type, ':+:' is just a binary choice like 'Either',
-- ':*:' is a binary pair like the pair constructor @(,)@, and 'K1' is a value
-- of a specific type @c@, and 'M1' wraps a value of the generic type argument,
-- which in the lifted world is an @f p@ (where we do not care about @p@).

-- *** Generic instances
--
-- |
--
-- To deal with the 'V1' case, we use the following code (which requires the pragma @EmptyCase@):
--
-- @
-- instance Encode' 'V1' where
--   encode' x = case x of { }
-- @
--
-- There are no values of type @V1 p@ to pass, so it is impossible for this
-- function to be invoked. One can ask why it is useful to define an instance
-- for 'V1' at all in this case? Well, an empty type can be used as an argument
-- to a non-empty type, and you might still want to encode the resulting type.
-- As a somewhat contrived example, consider @[Empty]@, which is not an empty
-- type, but contains just the empty list. The 'V1' instance ensures that we
-- can call the generic function on such types.
--
-- There is exactly one value of type 'U1', so encoding it requires no
-- knowledge, and we can use zero bits:
--
-- @
-- instance Encode' 'U1' where
--   encode' 'U1' = []
-- @
--
-- In the case for ':+:', we produce 'False' or 'True' depending on whether
-- the constructor of the value provided is located on the left or on the right:
--
-- @
-- instance (Encode' f, Encode' g) => Encode' (f ':+:' g) where
--   encode' ('L1' x) = False : encode' x
--   encode' ('R1' x) = True  : encode' x
-- @
--
-- (Note that this encoding strategy may not be reliable across different
-- versions of GHC. Recall that the compiler is free to choose any nesting
-- of ':+:' it chooses, so if GHC chooses @(a ':+:' b) ':+:' c@, then the
-- encoding for @a@ would be @[False, False]@, @b@ would be @[False, True]@,
-- and @c@ would be @[True]@. However, if GHC chooses @a ':+:' (b ':+:' c)@,
-- then the encoding for @a@ would be @[False]@, @b@ would be @[True, False]@,
-- and @c@ would be @[True, True]@.)
--
-- In the case for ':*:', we append the encodings of the two subcomponents:
--
-- @
-- instance (Encode' f, Encode' g) => Encode' (f ':*:' g) where
--   encode' (x ':*:' y) = encode' x ++ encode' y
-- @
--
-- The case for 'K1' is rather interesting. Here, we call the final function
-- @encode@ that we yet have to define, recursively. We will use another type
-- class @Encode@ for that function:
--
-- @
-- instance (Encode c) => Encode' ('K1' i c) where
--   encode' ('K1' x) = encode x
-- @
--
-- Note how we can define a uniform instance for 'M1', because we completely
-- disregard all meta-information:
--
-- @
-- instance (Encode' f) => Encode' ('M1' i t f) where
--   encode' ('M1' x) = encode' x
-- @
--
-- Unlike in 'K1', the instance for 'M1' refers to @encode'@, not @encode@.

-- *** The wrapper and generic default
--
-- |
--
-- We now define class @Encode@ for the actual @encode@ function:
--
-- @
-- class Encode a where
--   encode :: a -> [Bool]
--   default encode :: (Generic a, Encode' (Rep a)) => a -> [Bool]
--   encode x = encode' ('from' x)
-- @
--
-- The incoming @x@ is converted using 'from', then we dispatch to the
-- generic instances using @encode'@. We use this as a default definition
-- for @encode@. We need the @default encode@ signature because ordinary
-- Haskell default methods must not introduce additional class constraints,
-- but our generic default does.
--
-- Defining a particular instance is now as simple as saying
--
-- @
-- instance (Encode a) => Encode (Tree a)
-- @
--
#if 0
-- /TODO:/ Add usage example?
--
#endif
-- The generic default is being used. In the future, it will hopefully be
-- possible to use @deriving Encode@ as well, but GHC does not yet support
-- that syntax for this situation.
--
-- Having @Encode@ as a class has the advantage that we can define
-- non-generic special cases, which is particularly useful for abstract
-- datatypes that have no structural representation. For example, given
-- a suitable integer encoding function @encodeInt@, we can define
--
-- @
-- instance Encode Int where
--   encode = encodeInt
-- @

-- *** Omitting generic instances
--
-- |
--
-- It is not always required to provide instances for all the generic
-- representation types, but omitting instances restricts the set of
-- datatypes the functions will work for:
--
--    * If no ':+:' instance is given, the function may still work for
--      empty datatypes or datatypes that have a single constructor,
--      but will fail on datatypes with more than one constructor.
--
--    * If no ':*:' instance is given, the function may still work for
--      datatypes where each constructor has just zero or one field,
--      in particular for enumeration types.
--
--    * If no 'K1' instance is given, the function may still work for
--      enumeration types, where no constructor has any fields.
--
--    * If no 'V1' instance is given, the function may still work for
--      any datatype that is not empty.
--
--    * If no 'U1' instance is given, the function may still work for
--      any datatype where each constructor has at least one field.
--
-- An 'M1' instance is always required (but it can just ignore the
-- meta-information, as is the case for @encode@ above).
#if 0
-- *** Using meta-information
--
-- |
--
-- TODO
#endif
-- ** Generic constructor classes
--
-- |
--
-- Datatype-generic functions as defined above work for a large class
-- of datatypes, including parameterized datatypes. (We have used @Tree@
-- as our example above, which is of kind @* -> *@.) However, the
-- 'Generic' class ranges over types of kind @*@, and therefore, the
-- resulting generic functions (such as @encode@) must be parameterized
-- by a generic type argument of kind @*@.
--
-- What if we want to define generic classes that range over type
-- constructors (such as 'Data.Functor.Functor',
-- 'Data.Traversable.Traversable', or 'Data.Foldable.Foldable')?

-- *** The 'Generic1' class
--
-- |
--
-- Like 'Generic', there is a class 'Generic1' that defines a
-- representation 'Rep1' and conversion functions 'from1' and 'to1',
-- only that 'Generic1' ranges over types of kind @* -> *@. (More generally,
-- it can range over types of kind @k -> *@, for any kind @k@, if the
-- @PolyKinds@ extension is enabled. More on this later.)
-- The 'Generic1' class is also derivable.
--
-- The representation 'Rep1' is ever so slightly different from 'Rep'.
-- Let us look at @Tree@ as an example again:
--
-- @
-- data Tree a = Leaf a | Node (Tree a) (Tree a)
--   deriving 'Generic1'
-- @
--
-- The above declaration causes the following representation to be generated:
--
-- @
-- instance 'Generic1' Tree where
--   type 'Rep1' Tree =
--     'D1' ('MetaData \"Tree\" \"Main\" \"package-name\" 'False)
--       ('C1' ('MetaCons \"Leaf\" 'PrefixI 'False)
--          ('S1' ('MetaSel 'Nothing
--                          'NoSourceUnpackedness
--                          'NoSourceStrictness
--                          'DecidedLazy)
--                'Par1')
--        ':+:'
--        'C1' ('MetaCons \"Node\" 'PrefixI 'False)
--          ('S1' ('MetaSel 'Nothing
--                          'NoSourceUnpackedness
--                          'NoSourceStrictness
--                          'DecidedLazy)
--                ('Rec1' Tree)
--           ':*:'
--           'S1' ('MetaSel 'Nothing
--                          'NoSourceUnpackedness
--                          'NoSourceStrictness
--                          'DecidedLazy)
--                ('Rec1' Tree)))
--   ...
-- @
--
-- The representation reuses 'D1', 'C1', 'S1' (and thereby 'M1') as well
-- as ':+:' and ':*:' from 'Rep'. (This reusability is the reason that we
-- carry around the dummy type argument for kind-@*@-types, but there are
-- already enough different names involved without duplicating each of
-- these.)
--
-- What's different is that we now use 'Par1' to refer to the parameter
-- (and that parameter, which used to be @a@), is not mentioned explicitly
-- by name anywhere; and we use 'Rec1' to refer to a recursive use of @Tree a@.

-- *** Representation of @* -> *@ types
--
-- |
--
-- Unlike 'Rec0', the 'Par1' and 'Rec1' type constructors do not
-- map to 'K1'. They are defined directly, as follows:
--
-- @
-- newtype 'Par1'   p = 'Par1' { 'unPar1' ::   p } -- gives access to parameter p
-- newtype 'Rec1' f p = 'Rec1' { 'unRec1' :: f p } -- a wrapper
-- @
--
-- In 'Par1', the parameter @p@ is used for the first time, whereas 'Rec1' simply
-- wraps an application of @f@ to @p@.
--
-- Note that 'K1' (in the guise of 'Rec0') can still occur in a 'Rep1' representation,
-- namely when the datatype has a field that does not mention the parameter.
--
-- The declaration
--
-- @
-- data WithInt a = WithInt Int a
--   deriving 'Generic1'
-- @
--
-- yields
--
-- @
-- instance 'Generic1' WithInt where
--   type 'Rep1' WithInt =
--     'D1' ('MetaData \"WithInt\" \"Main\" \"package-name\" 'False)
--       ('C1' ('MetaCons \"WithInt\" 'PrefixI 'False)
--         ('S1' ('MetaSel 'Nothing
--                         'NoSourceUnpackedness
--                         'NoSourceStrictness
--                         'DecidedLazy)
--               ('Rec0' Int)
--          ':*:'
--          'S1' ('MetaSel 'Nothing
--                          'NoSourceUnpackedness
--                          'NoSourceStrictness
--                          'DecidedLazy)
--               'Par1'))
-- @
--
-- If the parameter @a@ appears underneath a composition of other type constructors,
-- then the representation involves composition, too:
--
-- @
-- data Rose a = Fork a [Rose a]
-- @
--
-- yields
--
-- @
-- instance 'Generic1' Rose where
--   type 'Rep1' Rose =
--     'D1' ('MetaData \"Rose\" \"Main\" \"package-name\" 'False)
--       ('C1' ('MetaCons \"Fork\" 'PrefixI 'False)
--         ('S1' ('MetaSel 'Nothing
--                         'NoSourceUnpackedness
--                         'NoSourceStrictness
--                         'DecidedLazy)
--               'Par1'
--          ':*:'
--          'S1' ('MetaSel 'Nothing
--                          'NoSourceUnpackedness
--                          'NoSourceStrictness
--                          'DecidedLazy)
--               ([] ':.:' 'Rec1' Rose)))
-- @
--
-- where
--
-- @
-- newtype (':.:') f g p = 'Comp1' { 'unComp1' :: f (g p) }
-- @

-- *** Representation of @k -> *@ types
--
-- |
--
-- The 'Generic1' class can be generalized to range over types of kind
-- @k -> *@, for any kind @k@. To do so, derive a 'Generic1' instance with the
-- @PolyKinds@ extension enabled. For example, the declaration
--
-- @
-- data Proxy (a :: k) = Proxy deriving 'Generic1'
-- @
--
-- yields a slightly different instance depending on whether @PolyKinds@ is
-- enabled. If compiled without @PolyKinds@, then @'Rep1' Proxy :: * -> *@, but
-- if compiled with @PolyKinds@, then @'Rep1' Proxy :: k -> *@.

-- *** Representation of unlifted types
--
-- |
--
-- If one were to attempt to derive a Generic instance for a datatype with an
-- unlifted argument (for example, 'Int#'), one might expect the occurrence of
-- the 'Int#' argument to be marked with @'Rec0' 'Int#'@. This won't work,
-- though, since 'Int#' is of an unlifted kind, and 'Rec0' expects a type of
-- kind @*@.
--
-- One solution would be to represent an occurrence of 'Int#' with 'Rec0 Int'
-- instead. With this approach, however, the programmer has no way of knowing
-- whether the 'Int' is actually an 'Int#' in disguise.
--
-- Instead of reusing 'Rec0', a separate data family 'URec' is used to mark
-- occurrences of common unlifted types:
--
-- @
-- data family URec a p
--
-- data instance 'URec' ('Ptr' ()) p = 'UAddr'   { 'uAddr#'   :: 'Addr#'   }
-- data instance 'URec' 'Char'     p = 'UChar'   { 'uChar#'   :: 'Char#'   }
-- data instance 'URec' 'Double'   p = 'UDouble' { 'uDouble#' :: 'Double#' }
-- data instance 'URec' 'Int'      p = 'UFloat'  { 'uFloat#'  :: 'Float#'  }
-- data instance 'URec' 'Float'    p = 'UInt'    { 'uInt#'    :: 'Int#'    }
-- data instance 'URec' 'Word'     p = 'UWord'   { 'uWord#'   :: 'Word#'   }
-- @
--
-- Several type synonyms are provided for convenience:
--
-- @
-- type 'UAddr'   = 'URec' ('Ptr' ())
-- type 'UChar'   = 'URec' 'Char'
-- type 'UDouble' = 'URec' 'Double'
-- type 'UFloat'  = 'URec' 'Float'
-- type 'UInt'    = 'URec' 'Int'
-- type 'UWord'   = 'URec' 'Word'
-- @
--
-- The declaration
--
-- @
-- data IntHash = IntHash Int#
--   deriving 'Generic'
-- @
--
-- yields
--
-- @
-- instance 'Generic' IntHash where
--   type 'Rep' IntHash =
--     'D1' ('MetaData \"IntHash\" \"Main\" \"package-name\" 'False)
--       ('C1' ('MetaCons \"IntHash\" 'PrefixI 'False)
--         ('S1' ('MetaSel 'Nothing
--                         'NoSourceUnpackedness
--                         'NoSourceStrictness
--                         'DecidedLazy)
--               'UInt'))
-- @
--
-- Currently, only the six unlifted types listed above are generated, but this
-- may be extended to encompass more unlifted types in the future.
#if 0
-- *** Limitations
--
-- |
--
-- /TODO/
--
-- /TODO:/ Also clear up confusion about 'Rec0' and 'Rec1' not really indicating recursion.
--
#endif
-----------------------------------------------------------------------------

  -- * Generic representation types
    V1, U1(..), Par1(..), Rec1(..), K1(..), M1(..)
  , (:+:)(..), (:*:)(..), (:.:)(..)

  -- ** Unboxed representation types
  , URec(..)
  , type UAddr, type UChar, type UDouble
  , type UFloat, type UInt, type UWord

  -- ** Synonyms for convenience
  , Rec0, R
  , D1, C1, S1, D, C, S

  -- * Meta-information
  , Datatype(..), Constructor(..), Selector(..)
  , Fixity(..), FixityI(..), Associativity(..), prec
  , SourceUnpackedness(..), SourceStrictness(..), DecidedStrictness(..)
  , Meta(..)

  -- * Generic type classes
  , Generic(..), Generic1(..)

  ) where

-- We use some base types
import Data.Either ( Either (..) )
import Data.Maybe  ( Maybe(..), fromMaybe )
import Data.Ord    ( Down(..) )
import GHC.Num.Integer ( Integer, integerToInt )
import GHC.Prim    ( Addr#, Char#, Double#, Float#, Int#, Word# )
import GHC.Ptr     ( Ptr )
import GHC.Types

-- Needed for instances
import GHC.Ix      ( Ix )
import GHC.Base    ( Alternative(..), Applicative(..), Functor(..)
                   , Monad(..), MonadPlus(..), NonEmpty(..), String, coerce
                   , Semigroup(..), Monoid(..) )
import GHC.Classes ( Eq(..), Ord(..) )
import GHC.Enum    ( Bounded, Enum )
import GHC.Read    ( Read(..) )
import GHC.Show    ( Show(..), showString )
import GHC.Stack.Types ( SrcLoc(..) )
import GHC.Tuple   (Solo (..))
import GHC.Unicode ( GeneralCategory(..) )
import GHC.Fingerprint.Type ( Fingerprint(..) )

-- Needed for metadata
import Data.Proxy   ( Proxy(..) )
import GHC.TypeLits ( KnownSymbol, KnownNat, Nat, symbolVal, natVal )

--------------------------------------------------------------------------------
-- Representation types
--------------------------------------------------------------------------------

-- | Void: used for datatypes without constructors
data V1 (p :: k)
  deriving ( V1 p -> V1 p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (p :: k). V1 p -> V1 p -> Bool
/= :: V1 p -> V1 p -> Bool
$c/= :: forall k (p :: k). V1 p -> V1 p -> Bool
== :: V1 p -> V1 p -> Bool
$c== :: forall k (p :: k). V1 p -> V1 p -> Bool
Eq       -- ^ @since 4.9.0.0
           , V1 p -> V1 p -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall k (p :: k). Eq (V1 p)
forall k (p :: k). V1 p -> V1 p -> Bool
forall k (p :: k). V1 p -> V1 p -> Ordering
forall k (p :: k). V1 p -> V1 p -> V1 p
min :: V1 p -> V1 p -> V1 p
$cmin :: forall k (p :: k). V1 p -> V1 p -> V1 p
max :: V1 p -> V1 p -> V1 p
$cmax :: forall k (p :: k). V1 p -> V1 p -> V1 p
>= :: V1 p -> V1 p -> Bool
$c>= :: forall k (p :: k). V1 p -> V1 p -> Bool
> :: V1 p -> V1 p -> Bool
$c> :: forall k (p :: k). V1 p -> V1 p -> Bool
<= :: V1 p -> V1 p -> Bool
$c<= :: forall k (p :: k). V1 p -> V1 p -> Bool
< :: V1 p -> V1 p -> Bool
$c< :: forall k (p :: k). V1 p -> V1 p -> Bool
compare :: V1 p -> V1 p -> Ordering
$ccompare :: forall k (p :: k). V1 p -> V1 p -> Ordering
Ord      -- ^ @since 4.9.0.0
           , ReadPrec [V1 p]
ReadPrec (V1 p)
ReadS [V1 p]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k (p :: k). ReadPrec [V1 p]
forall k (p :: k). ReadPrec (V1 p)
forall k (p :: k). Int -> ReadS (V1 p)
forall k (p :: k). ReadS [V1 p]
readListPrec :: ReadPrec [V1 p]
$creadListPrec :: forall k (p :: k). ReadPrec [V1 p]
readPrec :: ReadPrec (V1 p)
$creadPrec :: forall k (p :: k). ReadPrec (V1 p)
readList :: ReadS [V1 p]
$creadList :: forall k (p :: k). ReadS [V1 p]
readsPrec :: Int -> ReadS (V1 p)
$creadsPrec :: forall k (p :: k). Int -> ReadS (V1 p)
Read     -- ^ @since 4.9.0.0
           , Int -> V1 p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k). Int -> V1 p -> ShowS
forall k (p :: k). [V1 p] -> ShowS
forall k (p :: k). V1 p -> String
showList :: [V1 p] -> ShowS
$cshowList :: forall k (p :: k). [V1 p] -> ShowS
show :: V1 p -> String
$cshow :: forall k (p :: k). V1 p -> String
showsPrec :: Int -> V1 p -> ShowS
$cshowsPrec :: forall k (p :: k). Int -> V1 p -> ShowS
Show     -- ^ @since 4.9.0.0
           , forall a b. a -> V1 b -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> V1 b -> V1 a
$c<$ :: forall a b. a -> V1 b -> V1 a
fmap :: forall a b. (a -> b) -> V1 a -> V1 b
$cfmap :: forall a b. (a -> b) -> V1 a -> V1 b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (p :: k) x. V1 p -> Rep (V1 p) x
forall k (p :: k) x. Rep (V1 p) x -> V1 p
$cto :: forall k (p :: k) x. Rep (V1 p) x -> V1 p
$cfrom :: forall k (p :: k) x. V1 p -> Rep (V1 p) x
Generic  -- ^ @since 4.9.0.0
           , forall k (a :: k). V1 a -> Rep1 V1 a
forall k (a :: k). Rep1 V1 a -> V1 a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall k (a :: k). Rep1 V1 a -> V1 a
$cfrom1 :: forall k (a :: k). V1 a -> Rep1 V1 a
Generic1 -- ^ @since 4.9.0.0
           )

-- | @since 4.12.0.0
instance Semigroup (V1 p) where
  V1 p
v <> :: V1 p -> V1 p -> V1 p
<> V1 p
_ = V1 p
v

-- | Unit: used for constructors without arguments
data U1 (p :: k) = U1
  deriving ( forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (p :: k) x. U1 p -> Rep (U1 p) x
forall k (p :: k) x. Rep (U1 p) x -> U1 p
$cto :: forall k (p :: k) x. Rep (U1 p) x -> U1 p
$cfrom :: forall k (p :: k) x. U1 p -> Rep (U1 p) x
Generic  -- ^ @since 4.7.0.0
           , forall k (a :: k). U1 a -> Rep1 U1 a
forall k (a :: k). Rep1 U1 a -> U1 a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall k (a :: k). Rep1 U1 a -> U1 a
$cfrom1 :: forall k (a :: k). U1 a -> Rep1 U1 a
Generic1 -- ^ @since 4.9.0.0
           )

-- | @since 4.9.0.0
instance Eq (U1 p) where
  U1 p
_ == :: U1 p -> U1 p -> Bool
== U1 p
_ = Bool
True

-- | @since 4.7.0.0
instance Ord (U1 p) where
  compare :: U1 p -> U1 p -> Ordering
compare U1 p
_ U1 p
_ = Ordering
EQ

-- | @since 4.9.0.0
deriving instance Read (U1 p)

-- | @since 4.9.0.0
instance Show (U1 p) where
  showsPrec :: Int -> U1 p -> ShowS
showsPrec Int
_ U1 p
_ = String -> ShowS
showString String
"U1"

-- | @since 4.9.0.0
instance Functor U1 where
  fmap :: forall a b. (a -> b) -> U1 a -> U1 b
fmap a -> b
_ U1 a
_ = forall k (p :: k). U1 p
U1

-- | @since 4.9.0.0
instance Applicative U1 where
  pure :: forall a. a -> U1 a
pure a
_ = forall k (p :: k). U1 p
U1
  U1 (a -> b)
_ <*> :: forall a b. U1 (a -> b) -> U1 a -> U1 b
<*> U1 a
_ = forall k (p :: k). U1 p
U1
  liftA2 :: forall a b c. (a -> b -> c) -> U1 a -> U1 b -> U1 c
liftA2 a -> b -> c
_ U1 a
_ U1 b
_ = forall k (p :: k). U1 p
U1

-- | @since 4.9.0.0
instance Alternative U1 where
  empty :: forall a. U1 a
empty = forall k (p :: k). U1 p
U1
  U1 a
_ <|> :: forall a. U1 a -> U1 a -> U1 a
<|> U1 a
_ = forall k (p :: k). U1 p
U1

-- | @since 4.9.0.0
instance Monad U1 where
  U1 a
_ >>= :: forall a b. U1 a -> (a -> U1 b) -> U1 b
>>= a -> U1 b
_ = forall k (p :: k). U1 p
U1

-- | @since 4.9.0.0
instance MonadPlus U1

-- | @since 4.12.0.0
instance Semigroup (U1 p) where
  U1 p
_ <> :: U1 p -> U1 p -> U1 p
<> U1 p
_ = forall k (p :: k). U1 p
U1

-- | @since 4.12.0.0
instance Monoid (U1 p) where
  mempty :: U1 p
mempty = forall k (p :: k). U1 p
U1

-- | Used for marking occurrences of the parameter
newtype Par1 p = Par1 { forall p. Par1 p -> p
unPar1 :: p }
  deriving ( Par1 p -> Par1 p -> Bool
forall p. Eq p => Par1 p -> Par1 p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Par1 p -> Par1 p -> Bool
$c/= :: forall p. Eq p => Par1 p -> Par1 p -> Bool
== :: Par1 p -> Par1 p -> Bool
$c== :: forall p. Eq p => Par1 p -> Par1 p -> Bool
Eq       -- ^ @since 4.7.0.0
           , Par1 p -> Par1 p -> Bool
Par1 p -> Par1 p -> Ordering
Par1 p -> Par1 p -> Par1 p
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {p}. Ord p => Eq (Par1 p)
forall p. Ord p => Par1 p -> Par1 p -> Bool
forall p. Ord p => Par1 p -> Par1 p -> Ordering
forall p. Ord p => Par1 p -> Par1 p -> Par1 p
min :: Par1 p -> Par1 p -> Par1 p
$cmin :: forall p. Ord p => Par1 p -> Par1 p -> Par1 p
max :: Par1 p -> Par1 p -> Par1 p
$cmax :: forall p. Ord p => Par1 p -> Par1 p -> Par1 p
>= :: Par1 p -> Par1 p -> Bool
$c>= :: forall p. Ord p => Par1 p -> Par1 p -> Bool
> :: Par1 p -> Par1 p -> Bool
$c> :: forall p. Ord p => Par1 p -> Par1 p -> Bool
<= :: Par1 p -> Par1 p -> Bool
$c<= :: forall p. Ord p => Par1 p -> Par1 p -> Bool
< :: Par1 p -> Par1 p -> Bool
$c< :: forall p. Ord p => Par1 p -> Par1 p -> Bool
compare :: Par1 p -> Par1 p -> Ordering
$ccompare :: forall p. Ord p => Par1 p -> Par1 p -> Ordering
Ord      -- ^ @since 4.7.0.0
           , ReadPrec [Par1 p]
ReadPrec (Par1 p)
ReadS [Par1 p]
forall p. Read p => ReadPrec [Par1 p]
forall p. Read p => ReadPrec (Par1 p)
forall p. Read p => Int -> ReadS (Par1 p)
forall p. Read p => ReadS [Par1 p]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Par1 p]
$creadListPrec :: forall p. Read p => ReadPrec [Par1 p]
readPrec :: ReadPrec (Par1 p)
$creadPrec :: forall p. Read p => ReadPrec (Par1 p)
readList :: ReadS [Par1 p]
$creadList :: forall p. Read p => ReadS [Par1 p]
readsPrec :: Int -> ReadS (Par1 p)
$creadsPrec :: forall p. Read p => Int -> ReadS (Par1 p)
Read     -- ^ @since 4.7.0.0
           , Int -> Par1 p -> ShowS
forall p. Show p => Int -> Par1 p -> ShowS
forall p. Show p => [Par1 p] -> ShowS
forall p. Show p => Par1 p -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Par1 p] -> ShowS
$cshowList :: forall p. Show p => [Par1 p] -> ShowS
show :: Par1 p -> String
$cshow :: forall p. Show p => Par1 p -> String
showsPrec :: Int -> Par1 p -> ShowS
$cshowsPrec :: forall p. Show p => Int -> Par1 p -> ShowS
Show     -- ^ @since 4.7.0.0
           , forall a b. a -> Par1 b -> Par1 a
forall a b. (a -> b) -> Par1 a -> Par1 b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Par1 b -> Par1 a
$c<$ :: forall a b. a -> Par1 b -> Par1 a
fmap :: forall a b. (a -> b) -> Par1 a -> Par1 b
$cfmap :: forall a b. (a -> b) -> Par1 a -> Par1 b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall p x. Par1 p -> Rep (Par1 p) x
forall p x. Rep (Par1 p) x -> Par1 p
$cto :: forall p x. Rep (Par1 p) x -> Par1 p
$cfrom :: forall p x. Par1 p -> Rep (Par1 p) x
Generic  -- ^ @since 4.7.0.0
           , forall a. Par1 a -> Rep1 Par1 a
forall a. Rep1 Par1 a -> Par1 a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 Par1 a -> Par1 a
$cfrom1 :: forall a. Par1 a -> Rep1 Par1 a
Generic1 -- ^ @since 4.9.0.0
           )

-- | @since 4.9.0.0
instance Applicative Par1 where
  pure :: forall a. a -> Par1 a
pure = forall a. a -> Par1 a
Par1
  <*> :: forall a b. Par1 (a -> b) -> Par1 a -> Par1 b
(<*>) = coerce :: forall a b. Coercible a b => a -> b
coerce
  liftA2 :: forall a b c. (a -> b -> c) -> Par1 a -> Par1 b -> Par1 c
liftA2 = coerce :: forall a b. Coercible a b => a -> b
coerce

-- | @since 4.9.0.0
instance Monad Par1 where
  Par1 a
x >>= :: forall a b. Par1 a -> (a -> Par1 b) -> Par1 b
>>= a -> Par1 b
f = a -> Par1 b
f a
x

-- | @since 4.12.0.0
deriving instance Semigroup p => Semigroup (Par1 p)

-- | @since 4.12.0.0
deriving instance Monoid p => Monoid (Par1 p)

-- | Recursive calls of kind @* -> *@ (or kind @k -> *@, when @PolyKinds@
-- is enabled)
newtype Rec1 (f :: k -> Type) (p :: k) = Rec1 { forall k (f :: k -> *) (p :: k). Rec1 f p -> f p
unRec1 :: f p }
  deriving ( Rec1 f p -> Rec1 f p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (f :: k -> *) (p :: k).
Eq (f p) =>
Rec1 f p -> Rec1 f p -> Bool
/= :: Rec1 f p -> Rec1 f p -> Bool
$c/= :: forall k (f :: k -> *) (p :: k).
Eq (f p) =>
Rec1 f p -> Rec1 f p -> Bool
== :: Rec1 f p -> Rec1 f p -> Bool
$c== :: forall k (f :: k -> *) (p :: k).
Eq (f p) =>
Rec1 f p -> Rec1 f p -> Bool
Eq       -- ^ @since 4.7.0.0
           , Rec1 f p -> Rec1 f p -> Bool
Rec1 f p -> Rec1 f p -> Ordering
Rec1 f p -> Rec1 f p -> Rec1 f p
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {k} {f :: k -> *} {p :: k}. Ord (f p) => Eq (Rec1 f p)
forall k (f :: k -> *) (p :: k).
Ord (f p) =>
Rec1 f p -> Rec1 f p -> Bool
forall k (f :: k -> *) (p :: k).
Ord (f p) =>
Rec1 f p -> Rec1 f p -> Ordering
forall k (f :: k -> *) (p :: k).
Ord (f p) =>
Rec1 f p -> Rec1 f p -> Rec1 f p
min :: Rec1 f p -> Rec1 f p -> Rec1 f p
$cmin :: forall k (f :: k -> *) (p :: k).
Ord (f p) =>
Rec1 f p -> Rec1 f p -> Rec1 f p
max :: Rec1 f p -> Rec1 f p -> Rec1 f p
$cmax :: forall k (f :: k -> *) (p :: k).
Ord (f p) =>
Rec1 f p -> Rec1 f p -> Rec1 f p
>= :: Rec1 f p -> Rec1 f p -> Bool
$c>= :: forall k (f :: k -> *) (p :: k).
Ord (f p) =>
Rec1 f p -> Rec1 f p -> Bool
> :: Rec1 f p -> Rec1 f p -> Bool
$c> :: forall k (f :: k -> *) (p :: k).
Ord (f p) =>
Rec1 f p -> Rec1 f p -> Bool
<= :: Rec1 f p -> Rec1 f p -> Bool
$c<= :: forall k (f :: k -> *) (p :: k).
Ord (f p) =>
Rec1 f p -> Rec1 f p -> Bool
< :: Rec1 f p -> Rec1 f p -> Bool
$c< :: forall k (f :: k -> *) (p :: k).
Ord (f p) =>
Rec1 f p -> Rec1 f p -> Bool
compare :: Rec1 f p -> Rec1 f p -> Ordering
$ccompare :: forall k (f :: k -> *) (p :: k).
Ord (f p) =>
Rec1 f p -> Rec1 f p -> Ordering
Ord      -- ^ @since 4.7.0.0
           , ReadPrec [Rec1 f p]
ReadPrec (Rec1 f p)
ReadS [Rec1 f p]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k (f :: k -> *) (p :: k). Read (f p) => ReadPrec [Rec1 f p]
forall k (f :: k -> *) (p :: k). Read (f p) => ReadPrec (Rec1 f p)
forall k (f :: k -> *) (p :: k).
Read (f p) =>
Int -> ReadS (Rec1 f p)
forall k (f :: k -> *) (p :: k). Read (f p) => ReadS [Rec1 f p]
readListPrec :: ReadPrec [Rec1 f p]
$creadListPrec :: forall k (f :: k -> *) (p :: k). Read (f p) => ReadPrec [Rec1 f p]
readPrec :: ReadPrec (Rec1 f p)
$creadPrec :: forall k (f :: k -> *) (p :: k). Read (f p) => ReadPrec (Rec1 f p)
readList :: ReadS [Rec1 f p]
$creadList :: forall k (f :: k -> *) (p :: k). Read (f p) => ReadS [Rec1 f p]
readsPrec :: Int -> ReadS (Rec1 f p)
$creadsPrec :: forall k (f :: k -> *) (p :: k).
Read (f p) =>
Int -> ReadS (Rec1 f p)
Read     -- ^ @since 4.7.0.0
           , Int -> Rec1 f p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (f :: k -> *) (p :: k).
Show (f p) =>
Int -> Rec1 f p -> ShowS
forall k (f :: k -> *) (p :: k). Show (f p) => [Rec1 f p] -> ShowS
forall k (f :: k -> *) (p :: k). Show (f p) => Rec1 f p -> String
showList :: [Rec1 f p] -> ShowS
$cshowList :: forall k (f :: k -> *) (p :: k). Show (f p) => [Rec1 f p] -> ShowS
show :: Rec1 f p -> String
$cshow :: forall k (f :: k -> *) (p :: k). Show (f p) => Rec1 f p -> String
showsPrec :: Int -> Rec1 f p -> ShowS
$cshowsPrec :: forall k (f :: k -> *) (p :: k).
Show (f p) =>
Int -> Rec1 f p -> ShowS
Show     -- ^ @since 4.7.0.0
           , forall a b. a -> Rec1 f b -> Rec1 f a
forall a b. (a -> b) -> Rec1 f a -> Rec1 f b
forall (f :: * -> *) a b. Functor f => a -> Rec1 f b -> Rec1 f a
forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Rec1 f a -> Rec1 f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Rec1 f b -> Rec1 f a
$c<$ :: forall (f :: * -> *) a b. Functor f => a -> Rec1 f b -> Rec1 f a
fmap :: forall a b. (a -> b) -> Rec1 f a -> Rec1 f b
$cfmap :: forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Rec1 f a -> Rec1 f b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (f :: k -> *) (p :: k) x. Rec1 f p -> Rep (Rec1 f p) x
forall k (f :: k -> *) (p :: k) x. Rep (Rec1 f p) x -> Rec1 f p
$cto :: forall k (f :: k -> *) (p :: k) x. Rep (Rec1 f p) x -> Rec1 f p
$cfrom :: forall k (f :: k -> *) (p :: k) x. Rec1 f p -> Rep (Rec1 f p) x
Generic  -- ^ @since 4.7.0.0
           , forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
forall k (f :: k -> *) (a :: k). Rec1 f a -> Rep1 (Rec1 f) a
forall k (f :: k -> *) (a :: k). Rep1 (Rec1 f) a -> Rec1 f a
$cto1 :: forall k (f :: k -> *) (a :: k). Rep1 (Rec1 f) a -> Rec1 f a
$cfrom1 :: forall k (f :: k -> *) (a :: k). Rec1 f a -> Rep1 (Rec1 f) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | @since 4.9.0.0
deriving instance Applicative f => Applicative (Rec1 f)

-- | @since 4.9.0.0
deriving instance Alternative f => Alternative (Rec1 f)

-- | @since 4.9.0.0
instance Monad f => Monad (Rec1 f) where
  Rec1 f a
x >>= :: forall a b. Rec1 f a -> (a -> Rec1 f b) -> Rec1 f b
>>= a -> Rec1 f b
f = forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Rec1 (f a
x forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \a
a -> forall k (f :: k -> *) (p :: k). Rec1 f p -> f p
unRec1 (a -> Rec1 f b
f a
a))

-- | @since 4.9.0.0
deriving instance MonadPlus f => MonadPlus (Rec1 f)

-- | @since 4.12.0.0
deriving instance Semigroup (f p) => Semigroup (Rec1 f p)

-- | @since 4.12.0.0
deriving instance Monoid (f p) => Monoid (Rec1 f p)

-- | Constants, additional parameters and recursion of kind @*@
newtype K1 (i :: Type) c (p :: k) = K1 { forall k i c (p :: k). K1 i c p -> c
unK1 :: c }
  deriving ( K1 i c p -> K1 i c p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall i c k (p :: k). Eq c => K1 i c p -> K1 i c p -> Bool
/= :: K1 i c p -> K1 i c p -> Bool
$c/= :: forall i c k (p :: k). Eq c => K1 i c p -> K1 i c p -> Bool
== :: K1 i c p -> K1 i c p -> Bool
$c== :: forall i c k (p :: k). Eq c => K1 i c p -> K1 i c p -> Bool
Eq       -- ^ @since 4.7.0.0
           , K1 i c p -> K1 i c p -> Bool
K1 i c p -> K1 i c p -> Ordering
K1 i c p -> K1 i c p -> K1 i c p
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {i} {c} {k} {p :: k}. Ord c => Eq (K1 i c p)
forall i c k (p :: k). Ord c => K1 i c p -> K1 i c p -> Bool
forall i c k (p :: k). Ord c => K1 i c p -> K1 i c p -> Ordering
forall i c k (p :: k). Ord c => K1 i c p -> K1 i c p -> K1 i c p
min :: K1 i c p -> K1 i c p -> K1 i c p
$cmin :: forall i c k (p :: k). Ord c => K1 i c p -> K1 i c p -> K1 i c p
max :: K1 i c p -> K1 i c p -> K1 i c p
$cmax :: forall i c k (p :: k). Ord c => K1 i c p -> K1 i c p -> K1 i c p
>= :: K1 i c p -> K1 i c p -> Bool
$c>= :: forall i c k (p :: k). Ord c => K1 i c p -> K1 i c p -> Bool
> :: K1 i c p -> K1 i c p -> Bool
$c> :: forall i c k (p :: k). Ord c => K1 i c p -> K1 i c p -> Bool
<= :: K1 i c p -> K1 i c p -> Bool
$c<= :: forall i c k (p :: k). Ord c => K1 i c p -> K1 i c p -> Bool
< :: K1 i c p -> K1 i c p -> Bool
$c< :: forall i c k (p :: k). Ord c => K1 i c p -> K1 i c p -> Bool
compare :: K1 i c p -> K1 i c p -> Ordering
$ccompare :: forall i c k (p :: k). Ord c => K1 i c p -> K1 i c p -> Ordering
Ord      -- ^ @since 4.7.0.0
           , ReadPrec [K1 i c p]
ReadPrec (K1 i c p)
ReadS [K1 i c p]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall i c k (p :: k). Read c => ReadPrec [K1 i c p]
forall i c k (p :: k). Read c => ReadPrec (K1 i c p)
forall i c k (p :: k). Read c => Int -> ReadS (K1 i c p)
forall i c k (p :: k). Read c => ReadS [K1 i c p]
readListPrec :: ReadPrec [K1 i c p]
$creadListPrec :: forall i c k (p :: k). Read c => ReadPrec [K1 i c p]
readPrec :: ReadPrec (K1 i c p)
$creadPrec :: forall i c k (p :: k). Read c => ReadPrec (K1 i c p)
readList :: ReadS [K1 i c p]
$creadList :: forall i c k (p :: k). Read c => ReadS [K1 i c p]
readsPrec :: Int -> ReadS (K1 i c p)
$creadsPrec :: forall i c k (p :: k). Read c => Int -> ReadS (K1 i c p)
Read     -- ^ @since 4.7.0.0
           , Int -> K1 i c p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall i c k (p :: k). Show c => Int -> K1 i c p -> ShowS
forall i c k (p :: k). Show c => [K1 i c p] -> ShowS
forall i c k (p :: k). Show c => K1 i c p -> String
showList :: [K1 i c p] -> ShowS
$cshowList :: forall i c k (p :: k). Show c => [K1 i c p] -> ShowS
show :: K1 i c p -> String
$cshow :: forall i c k (p :: k). Show c => K1 i c p -> String
showsPrec :: Int -> K1 i c p -> ShowS
$cshowsPrec :: forall i c k (p :: k). Show c => Int -> K1 i c p -> ShowS
Show     -- ^ @since 4.7.0.0
           , forall a b. (a -> b) -> K1 i c a -> K1 i c b
forall i c a b. a -> K1 i c b -> K1 i c a
forall i c a b. (a -> b) -> K1 i c a -> K1 i c b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> K1 i c b -> K1 i c a
$c<$ :: forall i c a b. a -> K1 i c b -> K1 i c a
fmap :: forall a b. (a -> b) -> K1 i c a -> K1 i c b
$cfmap :: forall i c a b. (a -> b) -> K1 i c a -> K1 i c b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall i c k (p :: k) x. K1 i c p -> Rep (K1 i c p) x
forall i c k (p :: k) x. Rep (K1 i c p) x -> K1 i c p
$cto :: forall i c k (p :: k) x. Rep (K1 i c p) x -> K1 i c p
$cfrom :: forall i c k (p :: k) x. K1 i c p -> Rep (K1 i c p) x
Generic  -- ^ @since 4.7.0.0
           , forall k i c (a :: k). K1 i c a -> Rep1 (K1 i c) a
forall k i c (a :: k). Rep1 (K1 i c) a -> K1 i c a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall k i c (a :: k). Rep1 (K1 i c) a -> K1 i c a
$cfrom1 :: forall k i c (a :: k). K1 i c a -> Rep1 (K1 i c) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | @since 4.12.0.0
instance Monoid c => Applicative (K1 i c) where
  pure :: forall a. a -> K1 i c a
pure a
_ = forall k i c (p :: k). c -> K1 i c p
K1 forall a. Monoid a => a
mempty
  liftA2 :: forall a b c. (a -> b -> c) -> K1 i c a -> K1 i c b -> K1 i c c
liftA2 = \a -> b -> c
_ -> coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Monoid a => a -> a -> a
mappend :: c -> c -> c)
  <*> :: forall a b. K1 i c (a -> b) -> K1 i c a -> K1 i c b
(<*>) = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a. Monoid a => a -> a -> a
mappend :: c -> c -> c)

-- | @since 4.12.0.0
deriving instance Semigroup c => Semigroup (K1 i c p)

-- | @since 4.12.0.0
deriving instance Monoid c => Monoid (K1 i c p)

-- | @since 4.9.0.0
deriving instance Applicative f => Applicative (M1 i c f)

-- | @since 4.9.0.0
deriving instance Alternative f => Alternative (M1 i c f)

-- | @since 4.9.0.0
deriving instance Monad f => Monad (M1 i c f)

-- | @since 4.9.0.0
deriving instance MonadPlus f => MonadPlus (M1 i c f)

-- | @since 4.12.0.0
deriving instance Semigroup (f p) => Semigroup (M1 i c f p)

-- | @since 4.12.0.0
deriving instance Monoid (f p) => Monoid (M1 i c f p)

-- | Meta-information (constructor names, etc.)
newtype M1 (i :: Type) (c :: Meta) (f :: k -> Type) (p :: k) =
    M1 { forall k i (c :: Meta) (f :: k -> *) (p :: k). M1 i c f p -> f p
unM1 :: f p }
  deriving ( M1 i c f p -> M1 i c f p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall i (c :: Meta) k (f :: k -> *) (p :: k).
Eq (f p) =>
M1 i c f p -> M1 i c f p -> Bool
/= :: M1 i c f p -> M1 i c f p -> Bool
$c/= :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Eq (f p) =>
M1 i c f p -> M1 i c f p -> Bool
== :: M1 i c f p -> M1 i c f p -> Bool
$c== :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Eq (f p) =>
M1 i c f p -> M1 i c f p -> Bool
Eq       -- ^ @since 4.7.0.0
           , M1 i c f p -> M1 i c f p -> Bool
M1 i c f p -> M1 i c f p -> Ordering
M1 i c f p -> M1 i c f p -> M1 i c f p
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {i} {c :: Meta} {k} {f :: k -> *} {p :: k}.
Ord (f p) =>
Eq (M1 i c f p)
forall i (c :: Meta) k (f :: k -> *) (p :: k).
Ord (f p) =>
M1 i c f p -> M1 i c f p -> Bool
forall i (c :: Meta) k (f :: k -> *) (p :: k).
Ord (f p) =>
M1 i c f p -> M1 i c f p -> Ordering
forall i (c :: Meta) k (f :: k -> *) (p :: k).
Ord (f p) =>
M1 i c f p -> M1 i c f p -> M1 i c f p
min :: M1 i c f p -> M1 i c f p -> M1 i c f p
$cmin :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Ord (f p) =>
M1 i c f p -> M1 i c f p -> M1 i c f p
max :: M1 i c f p -> M1 i c f p -> M1 i c f p
$cmax :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Ord (f p) =>
M1 i c f p -> M1 i c f p -> M1 i c f p
>= :: M1 i c f p -> M1 i c f p -> Bool
$c>= :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Ord (f p) =>
M1 i c f p -> M1 i c f p -> Bool
> :: M1 i c f p -> M1 i c f p -> Bool
$c> :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Ord (f p) =>
M1 i c f p -> M1 i c f p -> Bool
<= :: M1 i c f p -> M1 i c f p -> Bool
$c<= :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Ord (f p) =>
M1 i c f p -> M1 i c f p -> Bool
< :: M1 i c f p -> M1 i c f p -> Bool
$c< :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Ord (f p) =>
M1 i c f p -> M1 i c f p -> Bool
compare :: M1 i c f p -> M1 i c f p -> Ordering
$ccompare :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Ord (f p) =>
M1 i c f p -> M1 i c f p -> Ordering
Ord      -- ^ @since 4.7.0.0
           , ReadPrec [M1 i c f p]
ReadPrec (M1 i c f p)
ReadS [M1 i c f p]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall i (c :: Meta) k (f :: k -> *) (p :: k).
Read (f p) =>
ReadPrec [M1 i c f p]
forall i (c :: Meta) k (f :: k -> *) (p :: k).
Read (f p) =>
ReadPrec (M1 i c f p)
forall i (c :: Meta) k (f :: k -> *) (p :: k).
Read (f p) =>
Int -> ReadS (M1 i c f p)
forall i (c :: Meta) k (f :: k -> *) (p :: k).
Read (f p) =>
ReadS [M1 i c f p]
readListPrec :: ReadPrec [M1 i c f p]
$creadListPrec :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Read (f p) =>
ReadPrec [M1 i c f p]
readPrec :: ReadPrec (M1 i c f p)
$creadPrec :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Read (f p) =>
ReadPrec (M1 i c f p)
readList :: ReadS [M1 i c f p]
$creadList :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Read (f p) =>
ReadS [M1 i c f p]
readsPrec :: Int -> ReadS (M1 i c f p)
$creadsPrec :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Read (f p) =>
Int -> ReadS (M1 i c f p)
Read     -- ^ @since 4.7.0.0
           , Int -> M1 i c f p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall i (c :: Meta) k (f :: k -> *) (p :: k).
Show (f p) =>
Int -> M1 i c f p -> ShowS
forall i (c :: Meta) k (f :: k -> *) (p :: k).
Show (f p) =>
[M1 i c f p] -> ShowS
forall i (c :: Meta) k (f :: k -> *) (p :: k).
Show (f p) =>
M1 i c f p -> String
showList :: [M1 i c f p] -> ShowS
$cshowList :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Show (f p) =>
[M1 i c f p] -> ShowS
show :: M1 i c f p -> String
$cshow :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Show (f p) =>
M1 i c f p -> String
showsPrec :: Int -> M1 i c f p -> ShowS
$cshowsPrec :: forall i (c :: Meta) k (f :: k -> *) (p :: k).
Show (f p) =>
Int -> M1 i c f p -> ShowS
Show     -- ^ @since 4.7.0.0
           , forall a b. a -> M1 i c f b -> M1 i c f a
forall a b. (a -> b) -> M1 i c f a -> M1 i c f b
forall i (c :: Meta) (f :: * -> *) a b.
Functor f =>
a -> M1 i c f b -> M1 i c f a
forall i (c :: Meta) (f :: * -> *) a b.
Functor f =>
(a -> b) -> M1 i c f a -> M1 i c f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> M1 i c f b -> M1 i c f a
$c<$ :: forall i (c :: Meta) (f :: * -> *) a b.
Functor f =>
a -> M1 i c f b -> M1 i c f a
fmap :: forall a b. (a -> b) -> M1 i c f a -> M1 i c f b
$cfmap :: forall i (c :: Meta) (f :: * -> *) a b.
Functor f =>
(a -> b) -> M1 i c f a -> M1 i c f b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall i (c :: Meta) k (f :: k -> *) (p :: k) x.
M1 i c f p -> Rep (M1 i c f p) x
forall i (c :: Meta) k (f :: k -> *) (p :: k) x.
Rep (M1 i c f p) x -> M1 i c f p
$cto :: forall i (c :: Meta) k (f :: k -> *) (p :: k) x.
Rep (M1 i c f p) x -> M1 i c f p
$cfrom :: forall i (c :: Meta) k (f :: k -> *) (p :: k) x.
M1 i c f p -> Rep (M1 i c f p) x
Generic  -- ^ @since 4.7.0.0
           , forall i (c :: Meta) k (f :: k -> *) (a :: k).
M1 i c f a -> Rep1 (M1 i c f) a
forall i (c :: Meta) k (f :: k -> *) (a :: k).
Rep1 (M1 i c f) a -> M1 i c f a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall i (c :: Meta) k (f :: k -> *) (a :: k).
Rep1 (M1 i c f) a -> M1 i c f a
$cfrom1 :: forall i (c :: Meta) k (f :: k -> *) (a :: k).
M1 i c f a -> Rep1 (M1 i c f) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | Sums: encode choice between constructors
infixr 5 :+:
data (:+:) (f :: k -> Type) (g :: k -> Type) (p :: k) = L1 (f p) | R1 (g p)
  deriving ( (:+:) f g p -> (:+:) f g p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Eq (f p), Eq (g p)) =>
(:+:) f g p -> (:+:) f g p -> Bool
/= :: (:+:) f g p -> (:+:) f g p -> Bool
$c/= :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Eq (f p), Eq (g p)) =>
(:+:) f g p -> (:+:) f g p -> Bool
== :: (:+:) f g p -> (:+:) f g p -> Bool
$c== :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Eq (f p), Eq (g p)) =>
(:+:) f g p -> (:+:) f g p -> Bool
Eq       -- ^ @since 4.7.0.0
           , (:+:) f g p -> (:+:) f g p -> Bool
(:+:) f g p -> (:+:) f g p -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {k} {f :: k -> *} {g :: k -> *} {p :: k}.
(Ord (f p), Ord (g p)) =>
Eq ((:+:) f g p)
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:+:) f g p -> (:+:) f g p -> Bool
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:+:) f g p -> (:+:) f g p -> Ordering
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:+:) f g p -> (:+:) f g p -> (:+:) f g p
min :: (:+:) f g p -> (:+:) f g p -> (:+:) f g p
$cmin :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:+:) f g p -> (:+:) f g p -> (:+:) f g p
max :: (:+:) f g p -> (:+:) f g p -> (:+:) f g p
$cmax :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:+:) f g p -> (:+:) f g p -> (:+:) f g p
>= :: (:+:) f g p -> (:+:) f g p -> Bool
$c>= :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:+:) f g p -> (:+:) f g p -> Bool
> :: (:+:) f g p -> (:+:) f g p -> Bool
$c> :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:+:) f g p -> (:+:) f g p -> Bool
<= :: (:+:) f g p -> (:+:) f g p -> Bool
$c<= :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:+:) f g p -> (:+:) f g p -> Bool
< :: (:+:) f g p -> (:+:) f g p -> Bool
$c< :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:+:) f g p -> (:+:) f g p -> Bool
compare :: (:+:) f g p -> (:+:) f g p -> Ordering
$ccompare :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:+:) f g p -> (:+:) f g p -> Ordering
Ord      -- ^ @since 4.7.0.0
           , ReadPrec [(:+:) f g p]
ReadPrec ((:+:) f g p)
ReadS [(:+:) f g p]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadPrec [(:+:) f g p]
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadPrec ((:+:) f g p)
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
Int -> ReadS ((:+:) f g p)
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadS [(:+:) f g p]
readListPrec :: ReadPrec [(:+:) f g p]
$creadListPrec :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadPrec [(:+:) f g p]
readPrec :: ReadPrec ((:+:) f g p)
$creadPrec :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadPrec ((:+:) f g p)
readList :: ReadS [(:+:) f g p]
$creadList :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadS [(:+:) f g p]
readsPrec :: Int -> ReadS ((:+:) f g p)
$creadsPrec :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
Int -> ReadS ((:+:) f g p)
Read     -- ^ @since 4.7.0.0
           , Int -> (:+:) f g p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
Int -> (:+:) f g p -> ShowS
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
[(:+:) f g p] -> ShowS
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
(:+:) f g p -> String
showList :: [(:+:) f g p] -> ShowS
$cshowList :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
[(:+:) f g p] -> ShowS
show :: (:+:) f g p -> String
$cshow :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
(:+:) f g p -> String
showsPrec :: Int -> (:+:) f g p -> ShowS
$cshowsPrec :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
Int -> (:+:) f g p -> ShowS
Show     -- ^ @since 4.7.0.0
           , forall a b. a -> (:+:) f g b -> (:+:) f g a
forall a b. (a -> b) -> (:+:) f g a -> (:+:) f g b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
a -> (:+:) f g b -> (:+:) f g a
forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
(a -> b) -> (:+:) f g a -> (:+:) f g b
<$ :: forall a b. a -> (:+:) f g b -> (:+:) f g a
$c<$ :: forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
a -> (:+:) f g b -> (:+:) f g a
fmap :: forall a b. (a -> b) -> (:+:) f g a -> (:+:) f g b
$cfmap :: forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
(a -> b) -> (:+:) f g a -> (:+:) f g b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (f :: k -> *) (g :: k -> *) (p :: k) x.
(:+:) f g p -> Rep ((:+:) f g p) x
forall k (f :: k -> *) (g :: k -> *) (p :: k) x.
Rep ((:+:) f g p) x -> (:+:) f g p
$cto :: forall k (f :: k -> *) (g :: k -> *) (p :: k) x.
Rep ((:+:) f g p) x -> (:+:) f g p
$cfrom :: forall k (f :: k -> *) (g :: k -> *) (p :: k) x.
(:+:) f g p -> Rep ((:+:) f g p) x
Generic  -- ^ @since 4.7.0.0
           , forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
forall k (f :: k -> *) (g :: k -> *) (a :: k).
(:+:) f g a -> Rep1 (f :+: g) a
forall k (f :: k -> *) (g :: k -> *) (a :: k).
Rep1 (f :+: g) a -> (:+:) f g a
$cto1 :: forall k (f :: k -> *) (g :: k -> *) (a :: k).
Rep1 (f :+: g) a -> (:+:) f g a
$cfrom1 :: forall k (f :: k -> *) (g :: k -> *) (a :: k).
(:+:) f g a -> Rep1 (f :+: g) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | Products: encode multiple arguments to constructors
infixr 6 :*:
data (:*:) (f :: k -> Type) (g :: k -> Type) (p :: k) = f p :*: g p
  deriving ( (:*:) f g p -> (:*:) f g p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Eq (f p), Eq (g p)) =>
(:*:) f g p -> (:*:) f g p -> Bool
/= :: (:*:) f g p -> (:*:) f g p -> Bool
$c/= :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Eq (f p), Eq (g p)) =>
(:*:) f g p -> (:*:) f g p -> Bool
== :: (:*:) f g p -> (:*:) f g p -> Bool
$c== :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Eq (f p), Eq (g p)) =>
(:*:) f g p -> (:*:) f g p -> Bool
Eq       -- ^ @since 4.7.0.0
           , (:*:) f g p -> (:*:) f g p -> Bool
(:*:) f g p -> (:*:) f g p -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {k} {f :: k -> *} {g :: k -> *} {p :: k}.
(Ord (f p), Ord (g p)) =>
Eq ((:*:) f g p)
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:*:) f g p -> (:*:) f g p -> Bool
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:*:) f g p -> (:*:) f g p -> Ordering
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:*:) f g p -> (:*:) f g p -> (:*:) f g p
min :: (:*:) f g p -> (:*:) f g p -> (:*:) f g p
$cmin :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:*:) f g p -> (:*:) f g p -> (:*:) f g p
max :: (:*:) f g p -> (:*:) f g p -> (:*:) f g p
$cmax :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:*:) f g p -> (:*:) f g p -> (:*:) f g p
>= :: (:*:) f g p -> (:*:) f g p -> Bool
$c>= :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:*:) f g p -> (:*:) f g p -> Bool
> :: (:*:) f g p -> (:*:) f g p -> Bool
$c> :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:*:) f g p -> (:*:) f g p -> Bool
<= :: (:*:) f g p -> (:*:) f g p -> Bool
$c<= :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:*:) f g p -> (:*:) f g p -> Bool
< :: (:*:) f g p -> (:*:) f g p -> Bool
$c< :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:*:) f g p -> (:*:) f g p -> Bool
compare :: (:*:) f g p -> (:*:) f g p -> Ordering
$ccompare :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Ord (f p), Ord (g p)) =>
(:*:) f g p -> (:*:) f g p -> Ordering
Ord      -- ^ @since 4.7.0.0
           , ReadPrec [(:*:) f g p]
ReadPrec ((:*:) f g p)
ReadS [(:*:) f g p]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadPrec [(:*:) f g p]
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadPrec ((:*:) f g p)
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
Int -> ReadS ((:*:) f g p)
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadS [(:*:) f g p]
readListPrec :: ReadPrec [(:*:) f g p]
$creadListPrec :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadPrec [(:*:) f g p]
readPrec :: ReadPrec ((:*:) f g p)
$creadPrec :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadPrec ((:*:) f g p)
readList :: ReadS [(:*:) f g p]
$creadList :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
ReadS [(:*:) f g p]
readsPrec :: Int -> ReadS ((:*:) f g p)
$creadsPrec :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Read (f p), Read (g p)) =>
Int -> ReadS ((:*:) f g p)
Read     -- ^ @since 4.7.0.0
           , Int -> (:*:) f g p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
Int -> (:*:) f g p -> ShowS
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
[(:*:) f g p] -> ShowS
forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
(:*:) f g p -> String
showList :: [(:*:) f g p] -> ShowS
$cshowList :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
[(:*:) f g p] -> ShowS
show :: (:*:) f g p -> String
$cshow :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
(:*:) f g p -> String
showsPrec :: Int -> (:*:) f g p -> ShowS
$cshowsPrec :: forall k (f :: k -> *) (g :: k -> *) (p :: k).
(Show (f p), Show (g p)) =>
Int -> (:*:) f g p -> ShowS
Show     -- ^ @since 4.7.0.0
           , forall a b. a -> (:*:) f g b -> (:*:) f g a
forall a b. (a -> b) -> (:*:) f g a -> (:*:) f g b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
a -> (:*:) f g b -> (:*:) f g a
forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
(a -> b) -> (:*:) f g a -> (:*:) f g b
<$ :: forall a b. a -> (:*:) f g b -> (:*:) f g a
$c<$ :: forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
a -> (:*:) f g b -> (:*:) f g a
fmap :: forall a b. (a -> b) -> (:*:) f g a -> (:*:) f g b
$cfmap :: forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
(a -> b) -> (:*:) f g a -> (:*:) f g b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (f :: k -> *) (g :: k -> *) (p :: k) x.
(:*:) f g p -> Rep ((:*:) f g p) x
forall k (f :: k -> *) (g :: k -> *) (p :: k) x.
Rep ((:*:) f g p) x -> (:*:) f g p
$cto :: forall k (f :: k -> *) (g :: k -> *) (p :: k) x.
Rep ((:*:) f g p) x -> (:*:) f g p
$cfrom :: forall k (f :: k -> *) (g :: k -> *) (p :: k) x.
(:*:) f g p -> Rep ((:*:) f g p) x
Generic  -- ^ @since 4.7.0.0
           , forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
forall k (f :: k -> *) (g :: k -> *) (a :: k).
(:*:) f g a -> Rep1 (f :*: g) a
forall k (f :: k -> *) (g :: k -> *) (a :: k).
Rep1 (f :*: g) a -> (:*:) f g a
$cto1 :: forall k (f :: k -> *) (g :: k -> *) (a :: k).
Rep1 (f :*: g) a -> (:*:) f g a
$cfrom1 :: forall k (f :: k -> *) (g :: k -> *) (a :: k).
(:*:) f g a -> Rep1 (f :*: g) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | @since 4.9.0.0
instance (Applicative f, Applicative g) => Applicative (f :*: g) where
  pure :: forall a. a -> (:*:) f g a
pure a
a = forall (f :: * -> *) a. Applicative f => a -> f a
pure a
a forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: forall (f :: * -> *) a. Applicative f => a -> f a
pure a
a
  (f (a -> b)
f :*: g (a -> b)
g) <*> :: forall a b. (:*:) f g (a -> b) -> (:*:) f g a -> (:*:) f g b
<*> (f a
x :*: g a
y) = (f (a -> b)
f forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> f a
x) forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: (g (a -> b)
g forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> g a
y)
  liftA2 :: forall a b c.
(a -> b -> c) -> (:*:) f g a -> (:*:) f g b -> (:*:) f g c
liftA2 a -> b -> c
f (f a
a :*: g a
b) (f b
x :*: g b
y) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 a -> b -> c
f f a
a f b
x forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 a -> b -> c
f g a
b g b
y

-- | @since 4.9.0.0
instance (Alternative f, Alternative g) => Alternative (f :*: g) where
  empty :: forall a. (:*:) f g a
empty = forall (f :: * -> *) a. Alternative f => f a
empty forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: forall (f :: * -> *) a. Alternative f => f a
empty
  (f a
x1 :*: g a
y1) <|> :: forall a. (:*:) f g a -> (:*:) f g a -> (:*:) f g a
<|> (f a
x2 :*: g a
y2) = (f a
x1 forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> f a
x2) forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: (g a
y1 forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> g a
y2)

-- | @since 4.9.0.0
instance (Monad f, Monad g) => Monad (f :*: g) where
  (f a
m :*: g a
n) >>= :: forall a b. (:*:) f g a -> (a -> (:*:) f g b) -> (:*:) f g b
>>= a -> (:*:) f g b
f = (f a
m forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \a
a -> forall {k} {f :: k -> *} {g :: k -> *} {p :: k}. (:*:) f g p -> f p
fstP (a -> (:*:) f g b
f a
a)) forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: (g a
n forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \a
a -> forall {k} {f :: k -> *} {g :: k -> *} {p :: k}. (:*:) f g p -> g p
sndP (a -> (:*:) f g b
f a
a))
    where
      fstP :: (:*:) f g p -> f p
fstP (f p
a :*: g p
_) = f p
a
      sndP :: (:*:) f g p -> g p
sndP (f p
_ :*: g p
b) = g p
b

-- | @since 4.9.0.0
instance (MonadPlus f, MonadPlus g) => MonadPlus (f :*: g)

-- | @since 4.12.0.0
instance (Semigroup (f p), Semigroup (g p)) => Semigroup ((f :*: g) p) where
  (f p
x1 :*: g p
y1) <> :: (:*:) f g p -> (:*:) f g p -> (:*:) f g p
<> (f p
x2 :*: g p
y2) = (f p
x1 forall a. Semigroup a => a -> a -> a
<> f p
x2) forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: (g p
y1 forall a. Semigroup a => a -> a -> a
<> g p
y2)

-- | @since 4.12.0.0
instance (Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p) where
  mempty :: (:*:) f g p
mempty = forall a. Monoid a => a
mempty forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: forall a. Monoid a => a
mempty

-- | Composition of functors
infixr 7 :.:
newtype (:.:) (f :: k2 -> Type) (g :: k1 -> k2) (p :: k1) =
    Comp1 { forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
(:.:) f g p -> f (g p)
unComp1 :: f (g p) }
  deriving ( (:.:) f g p -> (:.:) f g p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Eq (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> Bool
/= :: (:.:) f g p -> (:.:) f g p -> Bool
$c/= :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Eq (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> Bool
== :: (:.:) f g p -> (:.:) f g p -> Bool
$c== :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Eq (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> Bool
Eq       -- ^ @since 4.7.0.0
           , (:.:) f g p -> (:.:) f g p -> Bool
(:.:) f g p -> (:.:) f g p -> Ordering
(:.:) f g p -> (:.:) f g p -> (:.:) f g p
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {k2} {f :: k2 -> *} {k1} {g :: k1 -> k2} {p :: k1}.
Ord (f (g p)) =>
Eq ((:.:) f g p)
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Ord (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> Bool
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Ord (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> Ordering
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Ord (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> (:.:) f g p
min :: (:.:) f g p -> (:.:) f g p -> (:.:) f g p
$cmin :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Ord (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> (:.:) f g p
max :: (:.:) f g p -> (:.:) f g p -> (:.:) f g p
$cmax :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Ord (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> (:.:) f g p
>= :: (:.:) f g p -> (:.:) f g p -> Bool
$c>= :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Ord (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> Bool
> :: (:.:) f g p -> (:.:) f g p -> Bool
$c> :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Ord (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> Bool
<= :: (:.:) f g p -> (:.:) f g p -> Bool
$c<= :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Ord (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> Bool
< :: (:.:) f g p -> (:.:) f g p -> Bool
$c< :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Ord (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> Bool
compare :: (:.:) f g p -> (:.:) f g p -> Ordering
$ccompare :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Ord (f (g p)) =>
(:.:) f g p -> (:.:) f g p -> Ordering
Ord      -- ^ @since 4.7.0.0
           , ReadPrec [(:.:) f g p]
ReadPrec ((:.:) f g p)
ReadS [(:.:) f g p]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Read (f (g p)) =>
ReadPrec [(:.:) f g p]
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Read (f (g p)) =>
ReadPrec ((:.:) f g p)
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Read (f (g p)) =>
Int -> ReadS ((:.:) f g p)
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Read (f (g p)) =>
ReadS [(:.:) f g p]
readListPrec :: ReadPrec [(:.:) f g p]
$creadListPrec :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Read (f (g p)) =>
ReadPrec [(:.:) f g p]
readPrec :: ReadPrec ((:.:) f g p)
$creadPrec :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Read (f (g p)) =>
ReadPrec ((:.:) f g p)
readList :: ReadS [(:.:) f g p]
$creadList :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Read (f (g p)) =>
ReadS [(:.:) f g p]
readsPrec :: Int -> ReadS ((:.:) f g p)
$creadsPrec :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Read (f (g p)) =>
Int -> ReadS ((:.:) f g p)
Read     -- ^ @since 4.7.0.0
           , Int -> (:.:) f g p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Show (f (g p)) =>
Int -> (:.:) f g p -> ShowS
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Show (f (g p)) =>
[(:.:) f g p] -> ShowS
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Show (f (g p)) =>
(:.:) f g p -> String
showList :: [(:.:) f g p] -> ShowS
$cshowList :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Show (f (g p)) =>
[(:.:) f g p] -> ShowS
show :: (:.:) f g p -> String
$cshow :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Show (f (g p)) =>
(:.:) f g p -> String
showsPrec :: Int -> (:.:) f g p -> ShowS
$cshowsPrec :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
Show (f (g p)) =>
Int -> (:.:) f g p -> ShowS
Show     -- ^ @since 4.7.0.0
           , forall a b. a -> (:.:) f g b -> (:.:) f g a
forall a b. (a -> b) -> (:.:) f g a -> (:.:) f g b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
a -> (:.:) f g b -> (:.:) f g a
forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
(a -> b) -> (:.:) f g a -> (:.:) f g b
<$ :: forall a b. a -> (:.:) f g b -> (:.:) f g a
$c<$ :: forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
a -> (:.:) f g b -> (:.:) f g a
fmap :: forall a b. (a -> b) -> (:.:) f g a -> (:.:) f g b
$cfmap :: forall (f :: * -> *) (g :: * -> *) a b.
(Functor f, Functor g) =>
(a -> b) -> (:.:) f g a -> (:.:) f g b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1) x.
(:.:) f g p -> Rep ((:.:) f g p) x
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1) x.
Rep ((:.:) f g p) x -> (:.:) f g p
$cto :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1) x.
Rep ((:.:) f g p) x -> (:.:) f g p
$cfrom :: forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1) x.
(:.:) f g p -> Rep ((:.:) f g p) x
Generic  -- ^ @since 4.7.0.0
           , forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
forall (f :: * -> *) k (g :: k -> *) (a :: k).
Functor f =>
(:.:) f g a -> Rep1 (f :.: g) a
forall (f :: * -> *) k (g :: k -> *) (a :: k).
Functor f =>
Rep1 (f :.: g) a -> (:.:) f g a
$cto1 :: forall (f :: * -> *) k (g :: k -> *) (a :: k).
Functor f =>
Rep1 (f :.: g) a -> (:.:) f g a
$cfrom1 :: forall (f :: * -> *) k (g :: k -> *) (a :: k).
Functor f =>
(:.:) f g a -> Rep1 (f :.: g) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | @since 4.9.0.0
instance (Applicative f, Applicative g) => Applicative (f :.: g) where
  pure :: forall a. a -> (:.:) f g a
pure a
x = forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
f (g p) -> (:.:) f g p
Comp1 (forall (f :: * -> *) a. Applicative f => a -> f a
pure (forall (f :: * -> *) a. Applicative f => a -> f a
pure a
x))
  Comp1 f (g (a -> b))
f <*> :: forall a b. (:.:) f g (a -> b) -> (:.:) f g a -> (:.:) f g b
<*> Comp1 f (g a)
x = forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
f (g p) -> (:.:) f g p
Comp1 (forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
(<*>) f (g (a -> b))
f f (g a)
x)
  liftA2 :: forall a b c.
(a -> b -> c) -> (:.:) f g a -> (:.:) f g b -> (:.:) f g c
liftA2 a -> b -> c
f (Comp1 f (g a)
x) (Comp1 f (g b)
y) = forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
f (g p) -> (:.:) f g p
Comp1 (forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 a -> b -> c
f) f (g a)
x f (g b)
y)

-- | @since 4.9.0.0
instance (Alternative f, Applicative g) => Alternative (f :.: g) where
  empty :: forall a. (:.:) f g a
empty = forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
f (g p) -> (:.:) f g p
Comp1 forall (f :: * -> *) a. Alternative f => f a
empty
  <|> :: forall a. (:.:) f g a -> (:.:) f g a -> (:.:) f g a
(<|>) = coerce :: forall a b. Coercible a b => a -> b
coerce (forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
(<|>) :: f (g a) -> f (g a) -> f (g a)) ::
    forall a . (f :.: g) a -> (f :.: g) a -> (f :.: g) a

-- | @since 4.12.0.0
deriving instance Semigroup (f (g p)) => Semigroup ((f :.: g) p)

-- | @since 4.12.0.0
deriving instance Monoid (f (g p)) => Monoid ((f :.: g) p)

-- | Constants of unlifted kinds
--
-- @since 4.9.0.0
data family URec (a :: Type) (p :: k)

-- | Used for marking occurrences of 'Addr#'
--
-- @since 4.9.0.0
data instance URec (Ptr ()) (p :: k) = UAddr { forall k (p :: k). URec (Ptr ()) p -> Addr#
uAddr# :: Addr# }
  deriving ( URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (p :: k). URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
/= :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
$c/= :: forall k (p :: k). URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
== :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
$c== :: forall k (p :: k). URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
Eq       -- ^ @since 4.9.0.0
           , URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall k (p :: k). Eq (URec (Ptr ()) p)
forall k (p :: k). URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
forall k (p :: k). URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering
forall k (p :: k).
URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p
min :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p
$cmin :: forall k (p :: k).
URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p
max :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p
$cmax :: forall k (p :: k).
URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p
>= :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
$c>= :: forall k (p :: k). URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
> :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
$c> :: forall k (p :: k). URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
<= :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
$c<= :: forall k (p :: k). URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
< :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
$c< :: forall k (p :: k). URec (Ptr ()) p -> URec (Ptr ()) p -> Bool
compare :: URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering
$ccompare :: forall k (p :: k). URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering
Ord      -- ^ @since 4.9.0.0
           , forall a b. a -> URec (Ptr ()) b -> URec (Ptr ()) a
forall a b. (a -> b) -> URec (Ptr ()) a -> URec (Ptr ()) b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> URec (Ptr ()) b -> URec (Ptr ()) a
$c<$ :: forall a b. a -> URec (Ptr ()) b -> URec (Ptr ()) a
fmap :: forall a b. (a -> b) -> URec (Ptr ()) a -> URec (Ptr ()) b
$cfmap :: forall a b. (a -> b) -> URec (Ptr ()) a -> URec (Ptr ()) b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (p :: k) x. Rep (URec (Ptr ()) p) x -> URec (Ptr ()) p
forall k (p :: k) x. URec (Ptr ()) p -> Rep (URec (Ptr ()) p) x
$cto :: forall k (p :: k) x. Rep (URec (Ptr ()) p) x -> URec (Ptr ()) p
$cfrom :: forall k (p :: k) x. URec (Ptr ()) p -> Rep (URec (Ptr ()) p) x
Generic  -- ^ @since 4.9.0.0
           , forall k (a :: k). Rep1 (URec (Ptr ())) a -> URec (Ptr ()) a
forall k (a :: k). URec (Ptr ()) a -> Rep1 (URec (Ptr ())) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall k (a :: k). Rep1 (URec (Ptr ())) a -> URec (Ptr ()) a
$cfrom1 :: forall k (a :: k). URec (Ptr ()) a -> Rep1 (URec (Ptr ())) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | Used for marking occurrences of 'Char#'
--
-- @since 4.9.0.0
data instance URec Char (p :: k) = UChar { forall k (p :: k). URec Char p -> Char#
uChar# :: Char# }
  deriving ( URec Char p -> URec Char p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (p :: k). URec Char p -> URec Char p -> Bool
/= :: URec Char p -> URec Char p -> Bool
$c/= :: forall k (p :: k). URec Char p -> URec Char p -> Bool
== :: URec Char p -> URec Char p -> Bool
$c== :: forall k (p :: k). URec Char p -> URec Char p -> Bool
Eq       -- ^ @since 4.9.0.0
           , URec Char p -> URec Char p -> Bool
URec Char p -> URec Char p -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall k (p :: k). Eq (URec Char p)
forall k (p :: k). URec Char p -> URec Char p -> Bool
forall k (p :: k). URec Char p -> URec Char p -> Ordering
forall k (p :: k). URec Char p -> URec Char p -> URec Char p
min :: URec Char p -> URec Char p -> URec Char p
$cmin :: forall k (p :: k). URec Char p -> URec Char p -> URec Char p
max :: URec Char p -> URec Char p -> URec Char p
$cmax :: forall k (p :: k). URec Char p -> URec Char p -> URec Char p
>= :: URec Char p -> URec Char p -> Bool
$c>= :: forall k (p :: k). URec Char p -> URec Char p -> Bool
> :: URec Char p -> URec Char p -> Bool
$c> :: forall k (p :: k). URec Char p -> URec Char p -> Bool
<= :: URec Char p -> URec Char p -> Bool
$c<= :: forall k (p :: k). URec Char p -> URec Char p -> Bool
< :: URec Char p -> URec Char p -> Bool
$c< :: forall k (p :: k). URec Char p -> URec Char p -> Bool
compare :: URec Char p -> URec Char p -> Ordering
$ccompare :: forall k (p :: k). URec Char p -> URec Char p -> Ordering
Ord      -- ^ @since 4.9.0.0
           , Int -> URec Char p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k). Int -> URec Char p -> ShowS
forall k (p :: k). [URec Char p] -> ShowS
forall k (p :: k). URec Char p -> String
showList :: [URec Char p] -> ShowS
$cshowList :: forall k (p :: k). [URec Char p] -> ShowS
show :: URec Char p -> String
$cshow :: forall k (p :: k). URec Char p -> String
showsPrec :: Int -> URec Char p -> ShowS
$cshowsPrec :: forall k (p :: k). Int -> URec Char p -> ShowS
Show     -- ^ @since 4.9.0.0
           , forall a b. a -> URec Char b -> URec Char a
forall a b. (a -> b) -> URec Char a -> URec Char b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> URec Char b -> URec Char a
$c<$ :: forall a b. a -> URec Char b -> URec Char a
fmap :: forall a b. (a -> b) -> URec Char a -> URec Char b
$cfmap :: forall a b. (a -> b) -> URec Char a -> URec Char b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (p :: k) x. Rep (URec Char p) x -> URec Char p
forall k (p :: k) x. URec Char p -> Rep (URec Char p) x
$cto :: forall k (p :: k) x. Rep (URec Char p) x -> URec Char p
$cfrom :: forall k (p :: k) x. URec Char p -> Rep (URec Char p) x
Generic  -- ^ @since 4.9.0.0
           , forall k (a :: k). Rep1 (URec Char) a -> URec Char a
forall k (a :: k). URec Char a -> Rep1 (URec Char) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall k (a :: k). Rep1 (URec Char) a -> URec Char a
$cfrom1 :: forall k (a :: k). URec Char a -> Rep1 (URec Char) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | Used for marking occurrences of 'Double#'
--
-- @since 4.9.0.0
data instance URec Double (p :: k) = UDouble { forall k (p :: k). URec Double p -> Double#
uDouble# :: Double# }
  deriving ( URec Double p -> URec Double p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (p :: k). URec Double p -> URec Double p -> Bool
/= :: URec Double p -> URec Double p -> Bool
$c/= :: forall k (p :: k). URec Double p -> URec Double p -> Bool
== :: URec Double p -> URec Double p -> Bool
$c== :: forall k (p :: k). URec Double p -> URec Double p -> Bool
Eq       -- ^ @since 4.9.0.0
           , URec Double p -> URec Double p -> Bool
URec Double p -> URec Double p -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall k (p :: k). Eq (URec Double p)
forall k (p :: k). URec Double p -> URec Double p -> Bool
forall k (p :: k). URec Double p -> URec Double p -> Ordering
forall k (p :: k). URec Double p -> URec Double p -> URec Double p
min :: URec Double p -> URec Double p -> URec Double p
$cmin :: forall k (p :: k). URec Double p -> URec Double p -> URec Double p
max :: URec Double p -> URec Double p -> URec Double p
$cmax :: forall k (p :: k). URec Double p -> URec Double p -> URec Double p
>= :: URec Double p -> URec Double p -> Bool
$c>= :: forall k (p :: k). URec Double p -> URec Double p -> Bool
> :: URec Double p -> URec Double p -> Bool
$c> :: forall k (p :: k). URec Double p -> URec Double p -> Bool
<= :: URec Double p -> URec Double p -> Bool
$c<= :: forall k (p :: k). URec Double p -> URec Double p -> Bool
< :: URec Double p -> URec Double p -> Bool
$c< :: forall k (p :: k). URec Double p -> URec Double p -> Bool
compare :: URec Double p -> URec Double p -> Ordering
$ccompare :: forall k (p :: k). URec Double p -> URec Double p -> Ordering
Ord      -- ^ @since 4.9.0.0
           , Int -> URec Double p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k). Int -> URec Double p -> ShowS
forall k (p :: k). [URec Double p] -> ShowS
forall k (p :: k). URec Double p -> String
showList :: [URec Double p] -> ShowS
$cshowList :: forall k (p :: k). [URec Double p] -> ShowS
show :: URec Double p -> String
$cshow :: forall k (p :: k). URec Double p -> String
showsPrec :: Int -> URec Double p -> ShowS
$cshowsPrec :: forall k (p :: k). Int -> URec Double p -> ShowS
Show     -- ^ @since 4.9.0.0
           , forall a b. a -> URec Double b -> URec Double a
forall a b. (a -> b) -> URec Double a -> URec Double b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> URec Double b -> URec Double a
$c<$ :: forall a b. a -> URec Double b -> URec Double a
fmap :: forall a b. (a -> b) -> URec Double a -> URec Double b
$cfmap :: forall a b. (a -> b) -> URec Double a -> URec Double b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (p :: k) x. Rep (URec Double p) x -> URec Double p
forall k (p :: k) x. URec Double p -> Rep (URec Double p) x
$cto :: forall k (p :: k) x. Rep (URec Double p) x -> URec Double p
$cfrom :: forall k (p :: k) x. URec Double p -> Rep (URec Double p) x
Generic  -- ^ @since 4.9.0.0
           , forall k (a :: k). Rep1 (URec Double) a -> URec Double a
forall k (a :: k). URec Double a -> Rep1 (URec Double) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall k (a :: k). Rep1 (URec Double) a -> URec Double a
$cfrom1 :: forall k (a :: k). URec Double a -> Rep1 (URec Double) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | Used for marking occurrences of 'Float#'
--
-- @since 4.9.0.0
data instance URec Float (p :: k) = UFloat { forall k (p :: k). URec Float p -> Float#
uFloat# :: Float# }
  deriving ( URec Float p -> URec Float p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (p :: k). URec Float p -> URec Float p -> Bool
/= :: URec Float p -> URec Float p -> Bool
$c/= :: forall k (p :: k). URec Float p -> URec Float p -> Bool
== :: URec Float p -> URec Float p -> Bool
$c== :: forall k (p :: k). URec Float p -> URec Float p -> Bool
Eq, URec Float p -> URec Float p -> Bool
URec Float p -> URec Float p -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall k (p :: k). Eq (URec Float p)
forall k (p :: k). URec Float p -> URec Float p -> Bool
forall k (p :: k). URec Float p -> URec Float p -> Ordering
forall k (p :: k). URec Float p -> URec Float p -> URec Float p
min :: URec Float p -> URec Float p -> URec Float p
$cmin :: forall k (p :: k). URec Float p -> URec Float p -> URec Float p
max :: URec Float p -> URec Float p -> URec Float p
$cmax :: forall k (p :: k). URec Float p -> URec Float p -> URec Float p
>= :: URec Float p -> URec Float p -> Bool
$c>= :: forall k (p :: k). URec Float p -> URec Float p -> Bool
> :: URec Float p -> URec Float p -> Bool
$c> :: forall k (p :: k). URec Float p -> URec Float p -> Bool
<= :: URec Float p -> URec Float p -> Bool
$c<= :: forall k (p :: k). URec Float p -> URec Float p -> Bool
< :: URec Float p -> URec Float p -> Bool
$c< :: forall k (p :: k). URec Float p -> URec Float p -> Bool
compare :: URec Float p -> URec Float p -> Ordering
$ccompare :: forall k (p :: k). URec Float p -> URec Float p -> Ordering
Ord, Int -> URec Float p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k). Int -> URec Float p -> ShowS
forall k (p :: k). [URec Float p] -> ShowS
forall k (p :: k). URec Float p -> String
showList :: [URec Float p] -> ShowS
$cshowList :: forall k (p :: k). [URec Float p] -> ShowS
show :: URec Float p -> String
$cshow :: forall k (p :: k). URec Float p -> String
showsPrec :: Int -> URec Float p -> ShowS
$cshowsPrec :: forall k (p :: k). Int -> URec Float p -> ShowS
Show
           , forall a b. a -> URec Float b -> URec Float a
forall a b. (a -> b) -> URec Float a -> URec Float b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> URec Float b -> URec Float a
$c<$ :: forall a b. a -> URec Float b -> URec Float a
fmap :: forall a b. (a -> b) -> URec Float a -> URec Float b
$cfmap :: forall a b. (a -> b) -> URec Float a -> URec Float b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (p :: k) x. Rep (URec Float p) x -> URec Float p
forall k (p :: k) x. URec Float p -> Rep (URec Float p) x
$cto :: forall k (p :: k) x. Rep (URec Float p) x -> URec Float p
$cfrom :: forall k (p :: k) x. URec Float p -> Rep (URec Float p) x
Generic
           , forall k (a :: k). Rep1 (URec Float) a -> URec Float a
forall k (a :: k). URec Float a -> Rep1 (URec Float) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall k (a :: k). Rep1 (URec Float) a -> URec Float a
$cfrom1 :: forall k (a :: k). URec Float a -> Rep1 (URec Float) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | Used for marking occurrences of 'Int#'
--
-- @since 4.9.0.0
data instance URec Int (p :: k) = UInt { forall k (p :: k). URec Int p -> Int#
uInt# :: Int# }
  deriving ( URec Int p -> URec Int p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (p :: k). URec Int p -> URec Int p -> Bool
/= :: URec Int p -> URec Int p -> Bool
$c/= :: forall k (p :: k). URec Int p -> URec Int p -> Bool
== :: URec Int p -> URec Int p -> Bool
$c== :: forall k (p :: k). URec Int p -> URec Int p -> Bool
Eq       -- ^ @since 4.9.0.0
           , URec Int p -> URec Int p -> Bool
URec Int p -> URec Int p -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall k (p :: k). Eq (URec Int p)
forall k (p :: k). URec Int p -> URec Int p -> Bool
forall k (p :: k). URec Int p -> URec Int p -> Ordering
forall k (p :: k). URec Int p -> URec Int p -> URec Int p
min :: URec Int p -> URec Int p -> URec Int p
$cmin :: forall k (p :: k). URec Int p -> URec Int p -> URec Int p
max :: URec Int p -> URec Int p -> URec Int p
$cmax :: forall k (p :: k). URec Int p -> URec Int p -> URec Int p
>= :: URec Int p -> URec Int p -> Bool
$c>= :: forall k (p :: k). URec Int p -> URec Int p -> Bool
> :: URec Int p -> URec Int p -> Bool
$c> :: forall k (p :: k). URec Int p -> URec Int p -> Bool
<= :: URec Int p -> URec Int p -> Bool
$c<= :: forall k (p :: k). URec Int p -> URec Int p -> Bool
< :: URec Int p -> URec Int p -> Bool
$c< :: forall k (p :: k). URec Int p -> URec Int p -> Bool
compare :: URec Int p -> URec Int p -> Ordering
$ccompare :: forall k (p :: k). URec Int p -> URec Int p -> Ordering
Ord      -- ^ @since 4.9.0.0
           , Int -> URec Int p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k). Int -> URec Int p -> ShowS
forall k (p :: k). [URec Int p] -> ShowS
forall k (p :: k). URec Int p -> String
showList :: [URec Int p] -> ShowS
$cshowList :: forall k (p :: k). [URec Int p] -> ShowS
show :: URec Int p -> String
$cshow :: forall k (p :: k). URec Int p -> String
showsPrec :: Int -> URec Int p -> ShowS
$cshowsPrec :: forall k (p :: k). Int -> URec Int p -> ShowS
Show     -- ^ @since 4.9.0.0
           , forall a b. a -> URec Int b -> URec Int a
forall a b. (a -> b) -> URec Int a -> URec Int b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> URec Int b -> URec Int a
$c<$ :: forall a b. a -> URec Int b -> URec Int a
fmap :: forall a b. (a -> b) -> URec Int a -> URec Int b
$cfmap :: forall a b. (a -> b) -> URec Int a -> URec Int b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (p :: k) x. Rep (URec Int p) x -> URec Int p
forall k (p :: k) x. URec Int p -> Rep (URec Int p) x
$cto :: forall k (p :: k) x. Rep (URec Int p) x -> URec Int p
$cfrom :: forall k (p :: k) x. URec Int p -> Rep (URec Int p) x
Generic  -- ^ @since 4.9.0.0
           , forall k (a :: k). Rep1 (URec Int) a -> URec Int a
forall k (a :: k). URec Int a -> Rep1 (URec Int) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall k (a :: k). Rep1 (URec Int) a -> URec Int a
$cfrom1 :: forall k (a :: k). URec Int a -> Rep1 (URec Int) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | Used for marking occurrences of 'Word#'
--
-- @since 4.9.0.0
data instance URec Word (p :: k) = UWord { forall k (p :: k). URec Word p -> Word#
uWord# :: Word# }
  deriving ( URec Word p -> URec Word p -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall k (p :: k). URec Word p -> URec Word p -> Bool
/= :: URec Word p -> URec Word p -> Bool
$c/= :: forall k (p :: k). URec Word p -> URec Word p -> Bool
== :: URec Word p -> URec Word p -> Bool
$c== :: forall k (p :: k). URec Word p -> URec Word p -> Bool
Eq       -- ^ @since 4.9.0.0
           , URec Word p -> URec Word p -> Bool
URec Word p -> URec Word p -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall k (p :: k). Eq (URec Word p)
forall k (p :: k). URec Word p -> URec Word p -> Bool
forall k (p :: k). URec Word p -> URec Word p -> Ordering
forall k (p :: k). URec Word p -> URec Word p -> URec Word p
min :: URec Word p -> URec Word p -> URec Word p
$cmin :: forall k (p :: k). URec Word p -> URec Word p -> URec Word p
max :: URec Word p -> URec Word p -> URec Word p
$cmax :: forall k (p :: k). URec Word p -> URec Word p -> URec Word p
>= :: URec Word p -> URec Word p -> Bool
$c>= :: forall k (p :: k). URec Word p -> URec Word p -> Bool
> :: URec Word p -> URec Word p -> Bool
$c> :: forall k (p :: k). URec Word p -> URec Word p -> Bool
<= :: URec Word p -> URec Word p -> Bool
$c<= :: forall k (p :: k). URec Word p -> URec Word p -> Bool
< :: URec Word p -> URec Word p -> Bool
$c< :: forall k (p :: k). URec Word p -> URec Word p -> Bool
compare :: URec Word p -> URec Word p -> Ordering
$ccompare :: forall k (p :: k). URec Word p -> URec Word p -> Ordering
Ord      -- ^ @since 4.9.0.0
           , Int -> URec Word p -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall k (p :: k). Int -> URec Word p -> ShowS
forall k (p :: k). [URec Word p] -> ShowS
forall k (p :: k). URec Word p -> String
showList :: [URec Word p] -> ShowS
$cshowList :: forall k (p :: k). [URec Word p] -> ShowS
show :: URec Word p -> String
$cshow :: forall k (p :: k). URec Word p -> String
showsPrec :: Int -> URec Word p -> ShowS
$cshowsPrec :: forall k (p :: k). Int -> URec Word p -> ShowS
Show     -- ^ @since 4.9.0.0
           , forall a b. a -> URec Word b -> URec Word a
forall a b. (a -> b) -> URec Word a -> URec Word b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> URec Word b -> URec Word a
$c<$ :: forall a b. a -> URec Word b -> URec Word a
fmap :: forall a b. (a -> b) -> URec Word a -> URec Word b
$cfmap :: forall a b. (a -> b) -> URec Word a -> URec Word b
Functor  -- ^ @since 4.9.0.0
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k (p :: k) x. Rep (URec Word p) x -> URec Word p
forall k (p :: k) x. URec Word p -> Rep (URec Word p) x
$cto :: forall k (p :: k) x. Rep (URec Word p) x -> URec Word p
$cfrom :: forall k (p :: k) x. URec Word p -> Rep (URec Word p) x
Generic  -- ^ @since 4.9.0.0
           , forall k (a :: k). Rep1 (URec Word) a -> URec Word a
forall k (a :: k). URec Word a -> Rep1 (URec Word) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall k (a :: k). Rep1 (URec Word) a -> URec Word a
$cfrom1 :: forall k (a :: k). URec Word a -> Rep1 (URec Word) a
Generic1 -- ^ @since 4.9.0.0
           )

-- | Type synonym for @'URec' 'Addr#'@
--
-- @since 4.9.0.0
type UAddr   = URec (Ptr ())
-- | Type synonym for @'URec' 'Char#'@
--
-- @since 4.9.0.0
type UChar   = URec Char

-- | Type synonym for @'URec' 'Double#'@
--
-- @since 4.9.0.0
type UDouble = URec Double

-- | Type synonym for @'URec' 'Float#'@
--
-- @since 4.9.0.0
type UFloat  = URec Float

-- | Type synonym for @'URec' 'Int#'@
--
-- @since 4.9.0.0
type UInt    = URec Int

-- | Type synonym for @'URec' 'Word#'@
--
-- @since 4.9.0.0
type UWord   = URec Word

-- | Tag for K1: recursion (of kind @Type@)
data R

-- | Type synonym for encoding recursion (of kind @Type@)
type Rec0  = K1 R

-- | Tag for M1: datatype
data D
-- | Tag for M1: constructor
data C
-- | Tag for M1: record selector
data S

-- | Type synonym for encoding meta-information for datatypes
type D1 = M1 D

-- | Type synonym for encoding meta-information for constructors
type C1 = M1 C

-- | Type synonym for encoding meta-information for record selectors
type S1 = M1 S

-- | Class for datatypes that represent datatypes
class Datatype d where
  -- | The name of the datatype (unqualified)
  datatypeName :: t d (f :: k -> Type) (a :: k) -> [Char]
  -- | The fully-qualified name of the module where the type is declared
  moduleName   :: t d (f :: k -> Type) (a :: k) -> [Char]
  -- | The package name of the module where the type is declared
  --
  -- @since 4.9.0.0
  packageName :: t d (f :: k -> Type) (a :: k) -> [Char]
  -- | Marks if the datatype is actually a newtype
  --
  -- @since 4.7.0.0
  isNewtype    :: t d (f :: k -> Type) (a :: k) -> Bool
  isNewtype t d f a
_ = Bool
False

-- | @since 4.9.0.0
instance (KnownSymbol n, KnownSymbol m, KnownSymbol p, SingI nt)
    => Datatype ('MetaData n m p nt) where
  datatypeName :: forall k (t :: Meta -> (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t ('MetaData n m p nt) f a -> String
datatypeName t ('MetaData n m p nt) f a
_ = forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (forall {k} (t :: k). Proxy t
Proxy :: Proxy n)
  moduleName :: forall k (t :: Meta -> (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t ('MetaData n m p nt) f a -> String
moduleName   t ('MetaData n m p nt) f a
_ = forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (forall {k} (t :: k). Proxy t
Proxy :: Proxy m)
  packageName :: forall k (t :: Meta -> (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t ('MetaData n m p nt) f a -> String
packageName  t ('MetaData n m p nt) f a
_ = forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (forall {k} (t :: k). Proxy t
Proxy :: Proxy p)
  isNewtype :: forall k (t :: Meta -> (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t ('MetaData n m p nt) f a -> Bool
isNewtype    t ('MetaData n m p nt) f a
_ = forall k (a :: k). SingKind k => Sing a -> DemoteRep k
fromSing  (forall k (a :: k). SingI a => Sing a
sing  :: Sing nt)

-- | Class for datatypes that represent data constructors
class Constructor c where
  -- | The name of the constructor
  conName :: t c (f :: k -> Type) (a :: k) -> [Char]

  -- | The fixity of the constructor
  conFixity :: t c (f :: k -> Type) (a :: k) -> Fixity
  conFixity t c f a
_ = Fixity
Prefix

  -- | Marks if this constructor is a record
  conIsRecord :: t c (f :: k -> Type) (a :: k) -> Bool
  conIsRecord t c f a
_ = Bool
False

-- | @since 4.9.0.0
instance (KnownSymbol n, SingI f, SingI r)
    => Constructor ('MetaCons n f r) where
  conName :: forall k (t :: Meta -> (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t ('MetaCons n f r) f a -> String
conName     t ('MetaCons n f r) f a
_ = forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (forall {k} (t :: k). Proxy t
Proxy :: Proxy n)
  conFixity :: forall k (t :: Meta -> (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t ('MetaCons n f r) f a -> Fixity
conFixity   t ('MetaCons n f r) f a
_ = forall k (a :: k). SingKind k => Sing a -> DemoteRep k
fromSing  (forall k (a :: k). SingI a => Sing a
sing  :: Sing f)
  conIsRecord :: forall k (t :: Meta -> (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t ('MetaCons n f r) f a -> Bool
conIsRecord t ('MetaCons n f r) f a
_ = forall k (a :: k). SingKind k => Sing a -> DemoteRep k
fromSing  (forall k (a :: k). SingI a => Sing a
sing  :: Sing r)

-- | Datatype to represent the fixity of a constructor. An infix
-- | declaration directly corresponds to an application of 'Infix'.
data Fixity = Prefix | Infix Associativity Int
  deriving ( Fixity -> Fixity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Fixity -> Fixity -> Bool
$c/= :: Fixity -> Fixity -> Bool
== :: Fixity -> Fixity -> Bool
$c== :: Fixity -> Fixity -> Bool
Eq       -- ^ @since 4.6.0.0
           , Int -> Fixity -> ShowS
[Fixity] -> ShowS
Fixity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Fixity] -> ShowS
$cshowList :: [Fixity] -> ShowS
show :: Fixity -> String
$cshow :: Fixity -> String
showsPrec :: Int -> Fixity -> ShowS
$cshowsPrec :: Int -> Fixity -> ShowS
Show     -- ^ @since 4.6.0.0
           , Eq Fixity
Fixity -> Fixity -> Bool
Fixity -> Fixity -> Ordering
Fixity -> Fixity -> Fixity
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Fixity -> Fixity -> Fixity
$cmin :: Fixity -> Fixity -> Fixity
max :: Fixity -> Fixity -> Fixity
$cmax :: Fixity -> Fixity -> Fixity
>= :: Fixity -> Fixity -> Bool
$c>= :: Fixity -> Fixity -> Bool
> :: Fixity -> Fixity -> Bool
$c> :: Fixity -> Fixity -> Bool
<= :: Fixity -> Fixity -> Bool
$c<= :: Fixity -> Fixity -> Bool
< :: Fixity -> Fixity -> Bool
$c< :: Fixity -> Fixity -> Bool
compare :: Fixity -> Fixity -> Ordering
$ccompare :: Fixity -> Fixity -> Ordering
Ord      -- ^ @since 4.6.0.0
           , ReadPrec [Fixity]
ReadPrec Fixity
Int -> ReadS Fixity
ReadS [Fixity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Fixity]
$creadListPrec :: ReadPrec [Fixity]
readPrec :: ReadPrec Fixity
$creadPrec :: ReadPrec Fixity
readList :: ReadS [Fixity]
$creadList :: ReadS [Fixity]
readsPrec :: Int -> ReadS Fixity
$creadsPrec :: Int -> ReadS Fixity
Read     -- ^ @since 4.6.0.0
           , forall x. Rep Fixity x -> Fixity
forall x. Fixity -> Rep Fixity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Fixity x -> Fixity
$cfrom :: forall x. Fixity -> Rep Fixity x
Generic  -- ^ @since 4.7.0.0
           )

-- | This variant of 'Fixity' appears at the type level.
--
-- @since 4.9.0.0
data FixityI = PrefixI | InfixI Associativity Nat

-- | Get the precedence of a fixity value.
prec :: Fixity -> Int
prec :: Fixity -> Int
prec Fixity
Prefix      = Int
10
prec (Infix Associativity
_ Int
n) = Int
n

-- | Datatype to represent the associativity of a constructor
data Associativity = LeftAssociative
                   | RightAssociative
                   | NotAssociative
  deriving ( Associativity -> Associativity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Associativity -> Associativity -> Bool
$c/= :: Associativity -> Associativity -> Bool
== :: Associativity -> Associativity -> Bool
$c== :: Associativity -> Associativity -> Bool
Eq       -- ^ @since 4.6.0.0
           , Int -> Associativity -> ShowS
[Associativity] -> ShowS
Associativity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Associativity] -> ShowS
$cshowList :: [Associativity] -> ShowS
show :: Associativity -> String
$cshow :: Associativity -> String
showsPrec :: Int -> Associativity -> ShowS
$cshowsPrec :: Int -> Associativity -> ShowS
Show     -- ^ @since 4.6.0.0
           , Eq Associativity
Associativity -> Associativity -> Bool
Associativity -> Associativity -> Ordering
Associativity -> Associativity -> Associativity
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Associativity -> Associativity -> Associativity
$cmin :: Associativity -> Associativity -> Associativity
max :: Associativity -> Associativity -> Associativity
$cmax :: Associativity -> Associativity -> Associativity
>= :: Associativity -> Associativity -> Bool
$c>= :: Associativity -> Associativity -> Bool
> :: Associativity -> Associativity -> Bool
$c> :: Associativity -> Associativity -> Bool
<= :: Associativity -> Associativity -> Bool
$c<= :: Associativity -> Associativity -> Bool
< :: Associativity -> Associativity -> Bool
$c< :: Associativity -> Associativity -> Bool
compare :: Associativity -> Associativity -> Ordering
$ccompare :: Associativity -> Associativity -> Ordering
Ord      -- ^ @since 4.6.0.0
           , ReadPrec [Associativity]
ReadPrec Associativity
Int -> ReadS Associativity
ReadS [Associativity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Associativity]
$creadListPrec :: ReadPrec [Associativity]
readPrec :: ReadPrec Associativity
$creadPrec :: ReadPrec Associativity
readList :: ReadS [Associativity]
$creadList :: ReadS [Associativity]
readsPrec :: Int -> ReadS Associativity
$creadsPrec :: Int -> ReadS Associativity
Read     -- ^ @since 4.6.0.0
           , Int -> Associativity
Associativity -> Int
Associativity -> [Associativity]
Associativity -> Associativity
Associativity -> Associativity -> [Associativity]
Associativity -> Associativity -> Associativity -> [Associativity]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Associativity -> Associativity -> Associativity -> [Associativity]
$cenumFromThenTo :: Associativity -> Associativity -> Associativity -> [Associativity]
enumFromTo :: Associativity -> Associativity -> [Associativity]
$cenumFromTo :: Associativity -> Associativity -> [Associativity]
enumFromThen :: Associativity -> Associativity -> [Associativity]
$cenumFromThen :: Associativity -> Associativity -> [Associativity]
enumFrom :: Associativity -> [Associativity]
$cenumFrom :: Associativity -> [Associativity]
fromEnum :: Associativity -> Int
$cfromEnum :: Associativity -> Int
toEnum :: Int -> Associativity
$ctoEnum :: Int -> Associativity
pred :: Associativity -> Associativity
$cpred :: Associativity -> Associativity
succ :: Associativity -> Associativity
$csucc :: Associativity -> Associativity
Enum     -- ^ @since 4.9.0.0
           , Associativity
forall a. a -> a -> Bounded a
maxBound :: Associativity
$cmaxBound :: Associativity
minBound :: Associativity
$cminBound :: Associativity
Bounded  -- ^ @since 4.9.0.0
           , Ord Associativity
(Associativity, Associativity) -> Int
(Associativity, Associativity) -> [Associativity]
(Associativity, Associativity) -> Associativity -> Bool
(Associativity, Associativity) -> Associativity -> Int
forall a.
Ord a
-> ((a, a) -> [a])
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Bool)
-> ((a, a) -> Int)
-> ((a, a) -> Int)
-> Ix a
unsafeRangeSize :: (Associativity, Associativity) -> Int
$cunsafeRangeSize :: (Associativity, Associativity) -> Int
rangeSize :: (Associativity, Associativity) -> Int
$crangeSize :: (Associativity, Associativity) -> Int
inRange :: (Associativity, Associativity) -> Associativity -> Bool
$cinRange :: (Associativity, Associativity) -> Associativity -> Bool
unsafeIndex :: (Associativity, Associativity) -> Associativity -> Int
$cunsafeIndex :: (Associativity, Associativity) -> Associativity -> Int
index :: (Associativity, Associativity) -> Associativity -> Int
$cindex :: (Associativity, Associativity) -> Associativity -> Int
range :: (Associativity, Associativity) -> [Associativity]
$crange :: (Associativity, Associativity) -> [Associativity]
Ix       -- ^ @since 4.9.0.0
           , forall x. Rep Associativity x -> Associativity
forall x. Associativity -> Rep Associativity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Associativity x -> Associativity
$cfrom :: forall x. Associativity -> Rep Associativity x
Generic  -- ^ @since 4.7.0.0
           )

-- | The unpackedness of a field as the user wrote it in the source code. For
-- example, in the following data type:
--
-- @
-- data E = ExampleConstructor     Int
--            {\-\# NOUNPACK \#-\} Int
--            {\-\#   UNPACK \#-\} Int
-- @
--
-- The fields of @ExampleConstructor@ have 'NoSourceUnpackedness',
-- 'SourceNoUnpack', and 'SourceUnpack', respectively.
--
-- @since 4.9.0.0
data SourceUnpackedness = NoSourceUnpackedness
                        | SourceNoUnpack
                        | SourceUnpack
  deriving ( SourceUnpackedness -> SourceUnpackedness -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceUnpackedness -> SourceUnpackedness -> Bool
$c/= :: SourceUnpackedness -> SourceUnpackedness -> Bool
== :: SourceUnpackedness -> SourceUnpackedness -> Bool
$c== :: SourceUnpackedness -> SourceUnpackedness -> Bool
Eq      -- ^ @since 4.9.0.0
           , Int -> SourceUnpackedness -> ShowS
[SourceUnpackedness] -> ShowS
SourceUnpackedness -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceUnpackedness] -> ShowS
$cshowList :: [SourceUnpackedness] -> ShowS
show :: SourceUnpackedness -> String
$cshow :: SourceUnpackedness -> String
showsPrec :: Int -> SourceUnpackedness -> ShowS
$cshowsPrec :: Int -> SourceUnpackedness -> ShowS
Show    -- ^ @since 4.9.0.0
           , Eq SourceUnpackedness
SourceUnpackedness -> SourceUnpackedness -> Bool
SourceUnpackedness -> SourceUnpackedness -> Ordering
SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness
$cmin :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness
max :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness
$cmax :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness
>= :: SourceUnpackedness -> SourceUnpackedness -> Bool
$c>= :: SourceUnpackedness -> SourceUnpackedness -> Bool
> :: SourceUnpackedness -> SourceUnpackedness -> Bool
$c> :: SourceUnpackedness -> SourceUnpackedness -> Bool
<= :: SourceUnpackedness -> SourceUnpackedness -> Bool
$c<= :: SourceUnpackedness -> SourceUnpackedness -> Bool
< :: SourceUnpackedness -> SourceUnpackedness -> Bool
$c< :: SourceUnpackedness -> SourceUnpackedness -> Bool
compare :: SourceUnpackedness -> SourceUnpackedness -> Ordering
$ccompare :: SourceUnpackedness -> SourceUnpackedness -> Ordering
Ord     -- ^ @since 4.9.0.0
           , ReadPrec [SourceUnpackedness]
ReadPrec SourceUnpackedness
Int -> ReadS SourceUnpackedness
ReadS [SourceUnpackedness]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceUnpackedness]
$creadListPrec :: ReadPrec [SourceUnpackedness]
readPrec :: ReadPrec SourceUnpackedness
$creadPrec :: ReadPrec SourceUnpackedness
readList :: ReadS [SourceUnpackedness]
$creadList :: ReadS [SourceUnpackedness]
readsPrec :: Int -> ReadS SourceUnpackedness
$creadsPrec :: Int -> ReadS SourceUnpackedness
Read    -- ^ @since 4.9.0.0
           , Int -> SourceUnpackedness
SourceUnpackedness -> Int
SourceUnpackedness -> [SourceUnpackedness]
SourceUnpackedness -> SourceUnpackedness
SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness]
SourceUnpackedness
-> SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: SourceUnpackedness
-> SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness]
$cenumFromThenTo :: SourceUnpackedness
-> SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness]
enumFromTo :: SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness]
$cenumFromTo :: SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness]
enumFromThen :: SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness]
$cenumFromThen :: SourceUnpackedness -> SourceUnpackedness -> [SourceUnpackedness]
enumFrom :: SourceUnpackedness -> [SourceUnpackedness]
$cenumFrom :: SourceUnpackedness -> [SourceUnpackedness]
fromEnum :: SourceUnpackedness -> Int
$cfromEnum :: SourceUnpackedness -> Int
toEnum :: Int -> SourceUnpackedness
$ctoEnum :: Int -> SourceUnpackedness
pred :: SourceUnpackedness -> SourceUnpackedness
$cpred :: SourceUnpackedness -> SourceUnpackedness
succ :: SourceUnpackedness -> SourceUnpackedness
$csucc :: SourceUnpackedness -> SourceUnpackedness
Enum    -- ^ @since 4.9.0.0
           , SourceUnpackedness
forall a. a -> a -> Bounded a
maxBound :: SourceUnpackedness
$cmaxBound :: SourceUnpackedness
minBound :: SourceUnpackedness
$cminBound :: SourceUnpackedness
Bounded -- ^ @since 4.9.0.0
           , Ord SourceUnpackedness
(SourceUnpackedness, SourceUnpackedness) -> Int
(SourceUnpackedness, SourceUnpackedness) -> [SourceUnpackedness]
(SourceUnpackedness, SourceUnpackedness)
-> SourceUnpackedness -> Bool
(SourceUnpackedness, SourceUnpackedness)
-> SourceUnpackedness -> Int
forall a.
Ord a
-> ((a, a) -> [a])
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Bool)
-> ((a, a) -> Int)
-> ((a, a) -> Int)
-> Ix a
unsafeRangeSize :: (SourceUnpackedness, SourceUnpackedness) -> Int
$cunsafeRangeSize :: (SourceUnpackedness, SourceUnpackedness) -> Int
rangeSize :: (SourceUnpackedness, SourceUnpackedness) -> Int
$crangeSize :: (SourceUnpackedness, SourceUnpackedness) -> Int
inRange :: (SourceUnpackedness, SourceUnpackedness)
-> SourceUnpackedness -> Bool
$cinRange :: (SourceUnpackedness, SourceUnpackedness)
-> SourceUnpackedness -> Bool
unsafeIndex :: (SourceUnpackedness, SourceUnpackedness)
-> SourceUnpackedness -> Int
$cunsafeIndex :: (SourceUnpackedness, SourceUnpackedness)
-> SourceUnpackedness -> Int
index :: (SourceUnpackedness, SourceUnpackedness)
-> SourceUnpackedness -> Int
$cindex :: (SourceUnpackedness, SourceUnpackedness)
-> SourceUnpackedness -> Int
range :: (SourceUnpackedness, SourceUnpackedness) -> [SourceUnpackedness]
$crange :: (SourceUnpackedness, SourceUnpackedness) -> [SourceUnpackedness]
Ix      -- ^ @since 4.9.0.0
           , forall x. Rep SourceUnpackedness x -> SourceUnpackedness
forall x. SourceUnpackedness -> Rep SourceUnpackedness x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceUnpackedness x -> SourceUnpackedness
$cfrom :: forall x. SourceUnpackedness -> Rep SourceUnpackedness x
Generic -- ^ @since 4.9.0.0
           )

-- | The strictness of a field as the user wrote it in the source code. For
-- example, in the following data type:
--
-- @
-- data E = ExampleConstructor Int ~Int !Int
-- @
--
-- The fields of @ExampleConstructor@ have 'NoSourceStrictness',
-- 'SourceLazy', and 'SourceStrict', respectively.
--
-- @since 4.9.0.0
data SourceStrictness = NoSourceStrictness
                      | SourceLazy
                      | SourceStrict
  deriving ( SourceStrictness -> SourceStrictness -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceStrictness -> SourceStrictness -> Bool
$c/= :: SourceStrictness -> SourceStrictness -> Bool
== :: SourceStrictness -> SourceStrictness -> Bool
$c== :: SourceStrictness -> SourceStrictness -> Bool
Eq      -- ^ @since 4.9.0.0
           , Int -> SourceStrictness -> ShowS
[SourceStrictness] -> ShowS
SourceStrictness -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceStrictness] -> ShowS
$cshowList :: [SourceStrictness] -> ShowS
show :: SourceStrictness -> String
$cshow :: SourceStrictness -> String
showsPrec :: Int -> SourceStrictness -> ShowS
$cshowsPrec :: Int -> SourceStrictness -> ShowS
Show    -- ^ @since 4.9.0.0
           , Eq SourceStrictness
SourceStrictness -> SourceStrictness -> Bool
SourceStrictness -> SourceStrictness -> Ordering
SourceStrictness -> SourceStrictness -> SourceStrictness
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: SourceStrictness -> SourceStrictness -> SourceStrictness
$cmin :: SourceStrictness -> SourceStrictness -> SourceStrictness
max :: SourceStrictness -> SourceStrictness -> SourceStrictness
$cmax :: SourceStrictness -> SourceStrictness -> SourceStrictness
>= :: SourceStrictness -> SourceStrictness -> Bool
$c>= :: SourceStrictness -> SourceStrictness -> Bool
> :: SourceStrictness -> SourceStrictness -> Bool
$c> :: SourceStrictness -> SourceStrictness -> Bool
<= :: SourceStrictness -> SourceStrictness -> Bool
$c<= :: SourceStrictness -> SourceStrictness -> Bool
< :: SourceStrictness -> SourceStrictness -> Bool
$c< :: SourceStrictness -> SourceStrictness -> Bool
compare :: SourceStrictness -> SourceStrictness -> Ordering
$ccompare :: SourceStrictness -> SourceStrictness -> Ordering
Ord     -- ^ @since 4.9.0.0
           , ReadPrec [SourceStrictness]
ReadPrec SourceStrictness
Int -> ReadS SourceStrictness
ReadS [SourceStrictness]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceStrictness]
$creadListPrec :: ReadPrec [SourceStrictness]
readPrec :: ReadPrec SourceStrictness
$creadPrec :: ReadPrec SourceStrictness
readList :: ReadS [SourceStrictness]
$creadList :: ReadS [SourceStrictness]
readsPrec :: Int -> ReadS SourceStrictness
$creadsPrec :: Int -> ReadS SourceStrictness
Read    -- ^ @since 4.9.0.0
           , Int -> SourceStrictness
SourceStrictness -> Int
SourceStrictness -> [SourceStrictness]
SourceStrictness -> SourceStrictness
SourceStrictness -> SourceStrictness -> [SourceStrictness]
SourceStrictness
-> SourceStrictness -> SourceStrictness -> [SourceStrictness]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: SourceStrictness
-> SourceStrictness -> SourceStrictness -> [SourceStrictness]
$cenumFromThenTo :: SourceStrictness
-> SourceStrictness -> SourceStrictness -> [SourceStrictness]
enumFromTo :: SourceStrictness -> SourceStrictness -> [SourceStrictness]
$cenumFromTo :: SourceStrictness -> SourceStrictness -> [SourceStrictness]
enumFromThen :: SourceStrictness -> SourceStrictness -> [SourceStrictness]
$cenumFromThen :: SourceStrictness -> SourceStrictness -> [SourceStrictness]
enumFrom :: SourceStrictness -> [SourceStrictness]
$cenumFrom :: SourceStrictness -> [SourceStrictness]
fromEnum :: SourceStrictness -> Int
$cfromEnum :: SourceStrictness -> Int
toEnum :: Int -> SourceStrictness
$ctoEnum :: Int -> SourceStrictness
pred :: SourceStrictness -> SourceStrictness
$cpred :: SourceStrictness -> SourceStrictness
succ :: SourceStrictness -> SourceStrictness
$csucc :: SourceStrictness -> SourceStrictness
Enum    -- ^ @since 4.9.0.0
           , SourceStrictness
forall a. a -> a -> Bounded a
maxBound :: SourceStrictness
$cmaxBound :: SourceStrictness
minBound :: SourceStrictness
$cminBound :: SourceStrictness
Bounded -- ^ @since 4.9.0.0
           , Ord SourceStrictness
(SourceStrictness, SourceStrictness) -> Int
(SourceStrictness, SourceStrictness) -> [SourceStrictness]
(SourceStrictness, SourceStrictness) -> SourceStrictness -> Bool
(SourceStrictness, SourceStrictness) -> SourceStrictness -> Int
forall a.
Ord a
-> ((a, a) -> [a])
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Bool)
-> ((a, a) -> Int)
-> ((a, a) -> Int)
-> Ix a
unsafeRangeSize :: (SourceStrictness, SourceStrictness) -> Int
$cunsafeRangeSize :: (SourceStrictness, SourceStrictness) -> Int
rangeSize :: (SourceStrictness, SourceStrictness) -> Int
$crangeSize :: (SourceStrictness, SourceStrictness) -> Int
inRange :: (SourceStrictness, SourceStrictness) -> SourceStrictness -> Bool
$cinRange :: (SourceStrictness, SourceStrictness) -> SourceStrictness -> Bool
unsafeIndex :: (SourceStrictness, SourceStrictness) -> SourceStrictness -> Int
$cunsafeIndex :: (SourceStrictness, SourceStrictness) -> SourceStrictness -> Int
index :: (SourceStrictness, SourceStrictness) -> SourceStrictness -> Int
$cindex :: (SourceStrictness, SourceStrictness) -> SourceStrictness -> Int
range :: (SourceStrictness, SourceStrictness) -> [SourceStrictness]
$crange :: (SourceStrictness, SourceStrictness) -> [SourceStrictness]
Ix      -- ^ @since 4.9.0.0
           , forall x. Rep SourceStrictness x -> SourceStrictness
forall x. SourceStrictness -> Rep SourceStrictness x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceStrictness x -> SourceStrictness
$cfrom :: forall x. SourceStrictness -> Rep SourceStrictness x
Generic -- ^ @since 4.9.0.0
           )

-- | The strictness that GHC infers for a field during compilation. Whereas
-- there are nine different combinations of 'SourceUnpackedness' and
-- 'SourceStrictness', the strictness that GHC decides will ultimately be one
-- of lazy, strict, or unpacked. What GHC decides is affected both by what the
-- user writes in the source code and by GHC flags. As an example, consider
-- this data type:
--
-- @
-- data E = ExampleConstructor {\-\# UNPACK \#-\} !Int !Int Int
-- @
--
-- * If compiled without optimization or other language extensions, then the
--   fields of @ExampleConstructor@ will have 'DecidedStrict', 'DecidedStrict',
--   and 'DecidedLazy', respectively.
--
-- * If compiled with @-XStrictData@ enabled, then the fields will have
--   'DecidedStrict', 'DecidedStrict', and 'DecidedStrict', respectively.
--
-- * If compiled with @-O2@ enabled, then the fields will have 'DecidedUnpack',
--   'DecidedStrict', and 'DecidedLazy', respectively.
--
-- @since 4.9.0.0
data DecidedStrictness = DecidedLazy
                       | DecidedStrict
                       | DecidedUnpack
  deriving ( DecidedStrictness -> DecidedStrictness -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecidedStrictness -> DecidedStrictness -> Bool
$c/= :: DecidedStrictness -> DecidedStrictness -> Bool
== :: DecidedStrictness -> DecidedStrictness -> Bool
$c== :: DecidedStrictness -> DecidedStrictness -> Bool
Eq      -- ^ @since 4.9.0.0
           , Int -> DecidedStrictness -> ShowS
[DecidedStrictness] -> ShowS
DecidedStrictness -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecidedStrictness] -> ShowS
$cshowList :: [DecidedStrictness] -> ShowS
show :: DecidedStrictness -> String
$cshow :: DecidedStrictness -> String
showsPrec :: Int -> DecidedStrictness -> ShowS
$cshowsPrec :: Int -> DecidedStrictness -> ShowS
Show    -- ^ @since 4.9.0.0
           , Eq DecidedStrictness
DecidedStrictness -> DecidedStrictness -> Bool
DecidedStrictness -> DecidedStrictness -> Ordering
DecidedStrictness -> DecidedStrictness -> DecidedStrictness
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness
$cmin :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness
max :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness
$cmax :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness
>= :: DecidedStrictness -> DecidedStrictness -> Bool
$c>= :: DecidedStrictness -> DecidedStrictness -> Bool
> :: DecidedStrictness -> DecidedStrictness -> Bool
$c> :: DecidedStrictness -> DecidedStrictness -> Bool
<= :: DecidedStrictness -> DecidedStrictness -> Bool
$c<= :: DecidedStrictness -> DecidedStrictness -> Bool
< :: DecidedStrictness -> DecidedStrictness -> Bool
$c< :: DecidedStrictness -> DecidedStrictness -> Bool
compare :: DecidedStrictness -> DecidedStrictness -> Ordering
$ccompare :: DecidedStrictness -> DecidedStrictness -> Ordering
Ord     -- ^ @since 4.9.0.0
           , ReadPrec [DecidedStrictness]
ReadPrec DecidedStrictness
Int -> ReadS DecidedStrictness
ReadS [DecidedStrictness]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DecidedStrictness]
$creadListPrec :: ReadPrec [DecidedStrictness]
readPrec :: ReadPrec DecidedStrictness
$creadPrec :: ReadPrec DecidedStrictness
readList :: ReadS [DecidedStrictness]
$creadList :: ReadS [DecidedStrictness]
readsPrec :: Int -> ReadS DecidedStrictness
$creadsPrec :: Int -> ReadS DecidedStrictness
Read    -- ^ @since 4.9.0.0
           , Int -> DecidedStrictness
DecidedStrictness -> Int
DecidedStrictness -> [DecidedStrictness]
DecidedStrictness -> DecidedStrictness
DecidedStrictness -> DecidedStrictness -> [DecidedStrictness]
DecidedStrictness
-> DecidedStrictness -> DecidedStrictness -> [DecidedStrictness]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: DecidedStrictness
-> DecidedStrictness -> DecidedStrictness -> [DecidedStrictness]
$cenumFromThenTo :: DecidedStrictness
-> DecidedStrictness -> DecidedStrictness -> [DecidedStrictness]
enumFromTo :: DecidedStrictness -> DecidedStrictness -> [DecidedStrictness]
$cenumFromTo :: DecidedStrictness -> DecidedStrictness -> [DecidedStrictness]
enumFromThen :: DecidedStrictness -> DecidedStrictness -> [DecidedStrictness]
$cenumFromThen :: DecidedStrictness -> DecidedStrictness -> [DecidedStrictness]
enumFrom :: DecidedStrictness -> [DecidedStrictness]
$cenumFrom :: DecidedStrictness -> [DecidedStrictness]
fromEnum :: DecidedStrictness -> Int
$cfromEnum :: DecidedStrictness -> Int
toEnum :: Int -> DecidedStrictness
$ctoEnum :: Int -> DecidedStrictness
pred :: DecidedStrictness -> DecidedStrictness
$cpred :: DecidedStrictness -> DecidedStrictness
succ :: DecidedStrictness -> DecidedStrictness
$csucc :: DecidedStrictness -> DecidedStrictness
Enum    -- ^ @since 4.9.0.0
           , DecidedStrictness
forall a. a -> a -> Bounded a
maxBound :: DecidedStrictness
$cmaxBound :: DecidedStrictness
minBound :: DecidedStrictness
$cminBound :: DecidedStrictness
Bounded -- ^ @since 4.9.0.0
           , Ord DecidedStrictness
(DecidedStrictness, DecidedStrictness) -> Int
(DecidedStrictness, DecidedStrictness) -> [DecidedStrictness]
(DecidedStrictness, DecidedStrictness) -> DecidedStrictness -> Bool
(DecidedStrictness, DecidedStrictness) -> DecidedStrictness -> Int
forall a.
Ord a
-> ((a, a) -> [a])
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Bool)
-> ((a, a) -> Int)
-> ((a, a) -> Int)
-> Ix a
unsafeRangeSize :: (DecidedStrictness, DecidedStrictness) -> Int
$cunsafeRangeSize :: (DecidedStrictness, DecidedStrictness) -> Int
rangeSize :: (DecidedStrictness, DecidedStrictness) -> Int
$crangeSize :: (DecidedStrictness, DecidedStrictness) -> Int
inRange :: (DecidedStrictness, DecidedStrictness) -> DecidedStrictness -> Bool
$cinRange :: (DecidedStrictness, DecidedStrictness) -> DecidedStrictness -> Bool
unsafeIndex :: (DecidedStrictness, DecidedStrictness) -> DecidedStrictness -> Int
$cunsafeIndex :: (DecidedStrictness, DecidedStrictness) -> DecidedStrictness -> Int
index :: (DecidedStrictness, DecidedStrictness) -> DecidedStrictness -> Int
$cindex :: (DecidedStrictness, DecidedStrictness) -> DecidedStrictness -> Int
range :: (DecidedStrictness, DecidedStrictness) -> [DecidedStrictness]
$crange :: (DecidedStrictness, DecidedStrictness) -> [DecidedStrictness]
Ix      -- ^ @since 4.9.0.0
           , forall x. Rep DecidedStrictness x -> DecidedStrictness
forall x. DecidedStrictness -> Rep DecidedStrictness x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DecidedStrictness x -> DecidedStrictness
$cfrom :: forall x. DecidedStrictness -> Rep DecidedStrictness x
Generic -- ^ @since 4.9.0.0
           )

-- | Class for datatypes that represent records
class Selector s where
  -- | The name of the selector
  selName :: t s (f :: k -> Type) (a :: k) -> [Char]
  -- | The selector's unpackedness annotation (if any)
  --
  -- @since 4.9.0.0
  selSourceUnpackedness :: t s (f :: k -> Type) (a :: k) -> SourceUnpackedness
  -- | The selector's strictness annotation (if any)
  --
  -- @since 4.9.0.0
  selSourceStrictness :: t s (f :: k -> Type) (a :: k) -> SourceStrictness
  -- | The strictness that the compiler inferred for the selector
  --
  -- @since 4.9.0.0
  selDecidedStrictness :: t s (f :: k -> Type) (a :: k) -> DecidedStrictness

-- | @since 4.9.0.0
instance (SingI mn, SingI su, SingI ss, SingI ds)
    => Selector ('MetaSel mn su ss ds) where
  selName :: forall k (t :: Meta -> (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t ('MetaSel mn su ss ds) f a -> String
selName t ('MetaSel mn su ss ds) f a
_ = forall a. a -> Maybe a -> a
fromMaybe String
"" (forall k (a :: k). SingKind k => Sing a -> DemoteRep k
fromSing (forall k (a :: k). SingI a => Sing a
sing :: Sing mn))
  selSourceUnpackedness :: forall k (t :: Meta -> (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t ('MetaSel mn su ss ds) f a -> SourceUnpackedness
selSourceUnpackedness t ('MetaSel mn su ss ds) f a
_ = forall k (a :: k). SingKind k => Sing a -> DemoteRep k
fromSing (forall k (a :: k). SingI a => Sing a
sing :: Sing su)
  selSourceStrictness :: forall k (t :: Meta -> (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t ('MetaSel mn su ss ds) f a -> SourceStrictness
selSourceStrictness   t ('MetaSel mn su ss ds) f a
_ = forall k (a :: k). SingKind k => Sing a -> DemoteRep k
fromSing (forall k (a :: k). SingI a => Sing a
sing :: Sing ss)
  selDecidedStrictness :: forall k (t :: Meta -> (k -> *) -> k -> *) (f :: k -> *) (a :: k).
t ('MetaSel mn su ss ds) f a -> DecidedStrictness
selDecidedStrictness  t ('MetaSel mn su ss ds) f a
_ = forall k (a :: k). SingKind k => Sing a -> DemoteRep k
fromSing (forall k (a :: k). SingI a => Sing a
sing :: Sing ds)

-- | Representable types of kind @*@.
-- This class is derivable in GHC with the @DeriveGeneric@ flag on.
--
-- A 'Generic' instance must satisfy the following laws:
--
-- @
-- 'from' . 'to' ≡ 'Prelude.id'
-- 'to' . 'from' ≡ 'Prelude.id'
-- @
class Generic a where
  -- | Generic representation type
  type Rep a :: Type -> Type
  -- | Convert from the datatype to its representation
  from  :: a -> (Rep a) x
  -- | Convert from the representation to the datatype
  to    :: (Rep a) x -> a


-- | Representable types of kind @* -> *@ (or kind @k -> *@, when @PolyKinds@
-- is enabled).
-- This class is derivable in GHC with the @DeriveGeneric@ flag on.
--
-- A 'Generic1' instance must satisfy the following laws:
--
-- @
-- 'from1' . 'to1' ≡ 'Prelude.id'
-- 'to1' . 'from1' ≡ 'Prelude.id'
-- @
class Generic1 (f :: k -> Type) where
  -- | Generic representation type
  type Rep1 f :: k -> Type
  -- | Convert from the datatype to its representation
  from1  :: f a -> (Rep1 f) a
  -- | Convert from the representation to the datatype
  to1    :: (Rep1 f) a -> f a

--------------------------------------------------------------------------------
-- Meta-data
--------------------------------------------------------------------------------

-- | Datatype to represent metadata associated with a datatype (@MetaData@),
-- constructor (@MetaCons@), or field selector (@MetaSel@).
--
-- * In @MetaData n m p nt@, @n@ is the datatype's name, @m@ is the module in
--   which the datatype is defined, @p@ is the package in which the datatype
--   is defined, and @nt@ is @'True@ if the datatype is a @newtype@.
--
-- * In @MetaCons n f s@, @n@ is the constructor's name, @f@ is its fixity,
--   and @s@ is @'True@ if the constructor contains record selectors.
--
-- * In @MetaSel mn su ss ds@, if the field uses record syntax, then @mn@ is
--   'Just' the record name. Otherwise, @mn@ is 'Nothing'. @su@ and @ss@ are
--   the field's unpackedness and strictness annotations, and @ds@ is the
--   strictness that GHC infers for the field.
--
-- @since 4.9.0.0
data Meta = MetaData Symbol Symbol Symbol Bool
          | MetaCons Symbol FixityI Bool
          | MetaSel  (Maybe Symbol)
                     SourceUnpackedness SourceStrictness DecidedStrictness

--------------------------------------------------------------------------------
-- Derived instances
--------------------------------------------------------------------------------

-- | @since 4.6.0.0
deriving instance Generic [a]

-- | @since 4.6.0.0
deriving instance Generic (NonEmpty a)

-- | @since 4.6.0.0
deriving instance Generic (Maybe a)

-- | @since 4.6.0.0
deriving instance Generic (Either a b)

-- | @since 4.6.0.0
deriving instance Generic Bool

-- | @since 4.6.0.0
deriving instance Generic Ordering

-- | @since 4.6.0.0
deriving instance Generic (Proxy t)

-- | @since 4.6.0.0
deriving instance Generic ()

-- | @since 4.15
deriving instance Generic (Solo a)

-- | @since 4.6.0.0
deriving instance Generic ((,) a b)

-- | @since 4.6.0.0
deriving instance Generic ((,,) a b c)

-- | @since 4.6.0.0
deriving instance Generic ((,,,) a b c d)

-- | @since 4.6.0.0
deriving instance Generic ((,,,,) a b c d e)

-- | @since 4.6.0.0
deriving instance Generic ((,,,,,) a b c d e f)

-- | @since 4.6.0.0
deriving instance Generic ((,,,,,,) a b c d e f g)

-- | @since 4.16.0.0
deriving instance Generic ((,,,,,,,) a b c d e f g h)

-- | @since 4.16.0.0
deriving instance Generic ((,,,,,,,,) a b c d e f g h i)

-- | @since 4.16.0.0
deriving instance Generic ((,,,,,,,,,) a b c d e f g h i j)

-- | @since 4.16.0.0
deriving instance Generic ((,,,,,,,,,,) a b c d e f g h i j k)

-- | @since 4.16.0.0
deriving instance Generic ((,,,,,,,,,,,) a b c d e f g h i j k l)

-- | @since 4.16.0.0
deriving instance Generic ((,,,,,,,,,,,,) a b c d e f g h i j k l m)

-- | @since 4.16.0.0
deriving instance Generic ((,,,,,,,,,,,,,) a b c d e f g h i j k l m n)

-- | @since 4.16.0.0
deriving instance Generic ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o)

-- | @since 4.12.0.0
deriving instance Generic (Down a)

-- | @since 4.15.0.0
deriving instance Generic SrcLoc

-- | @since 4.15.0.0
deriving instance Generic GeneralCategory

-- | @since 4.15.0.0
deriving instance Generic Fingerprint

-- | @since 4.6.0.0
deriving instance Generic1 []

-- | @since 4.6.0.0
deriving instance Generic1 NonEmpty

-- | @since 4.6.0.0
deriving instance Generic1 Maybe

-- | @since 4.6.0.0
deriving instance Generic1 (Either a)

-- | @since 4.6.0.0
deriving instance Generic1 Proxy

-- | @since 4.15
deriving instance Generic1 Solo

-- | @since 4.6.0.0
deriving instance Generic1 ((,) a)

-- | @since 4.6.0.0
deriving instance Generic1 ((,,) a b)

-- | @since 4.6.0.0
deriving instance Generic1 ((,,,) a b c)

-- | @since 4.6.0.0
deriving instance Generic1 ((,,,,) a b c d)

-- | @since 4.6.0.0
deriving instance Generic1 ((,,,,,) a b c d e)

-- | @since 4.6.0.0
deriving instance Generic1 ((,,,,,,) a b c d e f)

-- | @since 4.16.0.0
deriving instance Generic1 ((,,,,,,,) a b c d e f g)

-- | @since 4.16.0.0
deriving instance Generic1 ((,,,,,,,,) a b c d e f g h)

-- | @since 4.16.0.0
deriving instance Generic1 ((,,,,,,,,,) a b c d e f g h i)

-- | @since 4.16.0.0
deriving instance Generic1 ((,,,,,,,,,,) a b c d e f g h i j)

-- | @since 4.16.0.0
deriving instance Generic1 ((,,,,,,,,,,,) a b c d e f g h i j k)

-- | @since 4.16.0.0
deriving instance Generic1 ((,,,,,,,,,,,,) a b c d e f g h i j k l)

-- | @since 4.16.0.0
deriving instance Generic1 ((,,,,,,,,,,,,,) a b c d e f g h i j k l m)

-- | @since 4.16.0.0
deriving instance Generic1 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n)

-- | @since 4.12.0.0
deriving instance Generic1 Down

--------------------------------------------------------------------------------
-- Copied from the singletons package
--------------------------------------------------------------------------------

-- | The singleton kind-indexed data family.
data family Sing (a :: k)

-- | A 'SingI' constraint is essentially an implicitly-passed singleton.
class SingI (a :: k) where
  -- | Produce the singleton explicitly. You will likely need the @ScopedTypeVariables@
  -- extension to use this method the way you want.
  sing :: Sing a

-- | The 'SingKind' class is essentially a /kind/ class. It classifies all kinds
-- for which singletons are defined. The class supports converting between a singleton
-- type and the base (unrefined) type which it is built from.
class SingKind k where
  -- | Get a base type from a proxy for the promoted kind. For example,
  -- @DemoteRep Bool@ will be the type @Bool@.
  type DemoteRep k :: Type

  -- | Convert a singleton to its unrefined version.
  fromSing :: Sing (a :: k) -> DemoteRep k

-- Singleton symbols
data instance Sing (s :: Symbol) where
  SSym :: KnownSymbol s => Sing s

-- | @since 4.9.0.0
instance KnownSymbol a => SingI a where sing :: Sing a
sing = forall (a :: Symbol). KnownSymbol a => Sing a
SSym

-- | @since 4.9.0.0
instance SingKind Symbol where
  type DemoteRep Symbol = String
  fromSing :: forall (a :: Symbol). Sing a -> DemoteRep Symbol
fromSing (Sing a
R:SingSymbols a
SSym :: Sing s) = forall (n :: Symbol) (proxy :: Symbol -> *).
KnownSymbol n =>
proxy n -> String
symbolVal (forall {k} (t :: k). Proxy t
Proxy :: Proxy s)

-- Singleton booleans
data instance Sing (a :: Bool) where
  STrue  :: Sing 'True
  SFalse :: Sing 'False

-- | @since 4.9.0.0
instance SingI 'True  where sing :: Sing 'True
sing = Sing 'True
STrue

-- | @since 4.9.0.0
instance SingI 'False where sing :: Sing 'False
sing = Sing 'False
SFalse

-- | @since 4.9.0.0
instance SingKind Bool where
  type DemoteRep Bool = Bool
  fromSing :: forall (a :: Bool). Sing a -> DemoteRep Bool
fromSing Sing a
R:SingBoola a
STrue  = Bool
True
  fromSing Sing a
R:SingBoola a
SFalse = Bool
False

-- Singleton Maybe
data instance Sing (b :: Maybe a) where
  SNothing :: Sing 'Nothing
  SJust    :: Sing a -> Sing ('Just a)

-- | @since 4.9.0.0
instance            SingI 'Nothing  where sing :: Sing 'Nothing
sing = forall a. Sing 'Nothing
SNothing

-- | @since 4.9.0.0
instance SingI a => SingI ('Just a) where sing :: Sing ('Just a)
sing = forall {k} (a :: k). Sing a -> Sing ('Just a)
SJust forall k (a :: k). SingI a => Sing a
sing

-- | @since 4.9.0.0
instance SingKind a => SingKind (Maybe a) where
  type DemoteRep (Maybe a) = Maybe (DemoteRep a)
  fromSing :: forall (a :: Maybe a). Sing a -> DemoteRep (Maybe a)
fromSing Sing a
R:SingMaybeb a a
SNothing  = forall a. Maybe a
Nothing
  fromSing (SJust Sing a
a) = forall a. a -> Maybe a
Just (forall k (a :: k). SingKind k => Sing a -> DemoteRep k
fromSing Sing a
a)

-- Singleton Fixity
data instance Sing (a :: FixityI) where
  SPrefix :: Sing 'PrefixI
  SInfix  :: Sing a -> Integer -> Sing ('InfixI a n)

-- | @since 4.9.0.0
instance SingI 'PrefixI where sing :: Sing 'PrefixI
sing = Sing 'PrefixI
SPrefix

-- | @since 4.9.0.0
instance (SingI a, KnownNat n) => SingI ('InfixI a n) where
  sing :: Sing ('InfixI a n)
sing = forall (a :: Associativity) (n :: Nat).
Sing a -> Integer -> Sing ('InfixI a n)
SInfix (forall k (a :: k). SingI a => Sing a
sing :: Sing a) (forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Integer
natVal (forall {k} (t :: k). Proxy t
Proxy :: Proxy n))

-- | @since 4.9.0.0
instance SingKind FixityI where
  type DemoteRep FixityI = Fixity
  fromSing :: forall (a :: FixityI). Sing a -> DemoteRep FixityI
fromSing Sing a
R:SingFixityIa a
SPrefix      = Fixity
Prefix
  fromSing (SInfix Sing a
a Integer
n) = Associativity -> Int -> Fixity
Infix (forall k (a :: k). SingKind k => Sing a -> DemoteRep k
fromSing Sing a
a) (Integer -> Int
integerToInt Integer
n)

-- Singleton Associativity
data instance Sing (a :: Associativity) where
  SLeftAssociative  :: Sing 'LeftAssociative
  SRightAssociative :: Sing 'RightAssociative
  SNotAssociative   :: Sing 'NotAssociative

-- | @since 4.9.0.0
instance SingI 'LeftAssociative  where sing :: Sing 'LeftAssociative
sing = Sing 'LeftAssociative
SLeftAssociative

-- | @since 4.9.0.0
instance SingI 'RightAssociative where sing :: Sing 'RightAssociative
sing = Sing 'RightAssociative
SRightAssociative

-- | @since 4.9.0.0
instance SingI 'NotAssociative   where sing :: Sing 'NotAssociative
sing = Sing 'NotAssociative
SNotAssociative

-- | @since 4.0.0.0
instance SingKind Associativity where
  type DemoteRep Associativity = Associativity
  fromSing :: forall (a :: Associativity). Sing a -> DemoteRep Associativity
fromSing Sing a
R:SingAssociativitya a
SLeftAssociative  = Associativity
LeftAssociative
  fromSing Sing a
R:SingAssociativitya a
SRightAssociative = Associativity
RightAssociative
  fromSing Sing a
R:SingAssociativitya a
SNotAssociative   = Associativity
NotAssociative

-- Singleton SourceUnpackedness
data instance Sing (a :: SourceUnpackedness) where
  SNoSourceUnpackedness :: Sing 'NoSourceUnpackedness
  SSourceNoUnpack       :: Sing 'SourceNoUnpack
  SSourceUnpack         :: Sing 'SourceUnpack

-- | @since 4.9.0.0
instance SingI 'NoSourceUnpackedness where sing :: Sing 'NoSourceUnpackedness
sing = Sing 'NoSourceUnpackedness
SNoSourceUnpackedness

-- | @since 4.9.0.0
instance SingI 'SourceNoUnpack       where sing :: Sing 'SourceNoUnpack
sing = Sing 'SourceNoUnpack
SSourceNoUnpack

-- | @since 4.9.0.0
instance SingI 'SourceUnpack         where sing :: Sing 'SourceUnpack
sing = Sing 'SourceUnpack
SSourceUnpack

-- | @since 4.9.0.0
instance SingKind SourceUnpackedness where
  type DemoteRep SourceUnpackedness = SourceUnpackedness
  fromSing :: forall (a :: SourceUnpackedness).
Sing a -> DemoteRep SourceUnpackedness
fromSing Sing a
R:SingSourceUnpackednessa a
SNoSourceUnpackedness = SourceUnpackedness
NoSourceUnpackedness
  fromSing Sing a
R:SingSourceUnpackednessa a
SSourceNoUnpack       = SourceUnpackedness
SourceNoUnpack
  fromSing Sing a
R:SingSourceUnpackednessa a
SSourceUnpack         = SourceUnpackedness
SourceUnpack

-- Singleton SourceStrictness
data instance Sing (a :: SourceStrictness) where
  SNoSourceStrictness :: Sing 'NoSourceStrictness
  SSourceLazy         :: Sing 'SourceLazy
  SSourceStrict       :: Sing 'SourceStrict

-- | @since 4.9.0.0
instance SingI 'NoSourceStrictness where sing :: Sing 'NoSourceStrictness
sing = Sing 'NoSourceStrictness
SNoSourceStrictness

-- | @since 4.9.0.0
instance SingI 'SourceLazy         where sing :: Sing 'SourceLazy
sing = Sing 'SourceLazy
SSourceLazy

-- | @since 4.9.0.0
instance SingI 'SourceStrict       where sing :: Sing 'SourceStrict
sing = Sing 'SourceStrict
SSourceStrict

-- | @since 4.9.0.0
instance SingKind SourceStrictness where
  type DemoteRep SourceStrictness = SourceStrictness
  fromSing :: forall (a :: SourceStrictness).
Sing a -> DemoteRep SourceStrictness
fromSing Sing a
R:SingSourceStrictnessa a
SNoSourceStrictness = SourceStrictness
NoSourceStrictness
  fromSing Sing a
R:SingSourceStrictnessa a
SSourceLazy         = SourceStrictness
SourceLazy
  fromSing Sing a
R:SingSourceStrictnessa a
SSourceStrict       = SourceStrictness
SourceStrict

-- Singleton DecidedStrictness
data instance Sing (a :: DecidedStrictness) where
  SDecidedLazy   :: Sing 'DecidedLazy
  SDecidedStrict :: Sing 'DecidedStrict
  SDecidedUnpack :: Sing 'DecidedUnpack

-- | @since 4.9.0.0
instance SingI 'DecidedLazy   where sing :: Sing 'DecidedLazy
sing = Sing 'DecidedLazy
SDecidedLazy

-- | @since 4.9.0.0
instance SingI 'DecidedStrict where sing :: Sing 'DecidedStrict
sing = Sing 'DecidedStrict
SDecidedStrict

-- | @since 4.9.0.0
instance SingI 'DecidedUnpack where sing :: Sing 'DecidedUnpack
sing = Sing 'DecidedUnpack
SDecidedUnpack

-- | @since 4.9.0.0
instance SingKind DecidedStrictness where
  type DemoteRep DecidedStrictness = DecidedStrictness
  fromSing :: forall (a :: DecidedStrictness).
Sing a -> DemoteRep DecidedStrictness
fromSing Sing a
R:SingDecidedStrictnessa a
SDecidedLazy   = DecidedStrictness
DecidedLazy
  fromSing Sing a
R:SingDecidedStrictnessa a
SDecidedStrict = DecidedStrictness
DecidedStrict
  fromSing Sing a
R:SingDecidedStrictnessa a
SDecidedUnpack = DecidedStrictness
DecidedUnpack