{-# LANGUAGE CPP #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE PolyKinds #-}

#ifdef TRUSTWORTHY
{-# LANGUAGE Trustworthy #-}
#endif

#if __GLASGOW_HASKELL__ >= 710
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}
#endif

{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}

#include "lens-common.h"

-----------------------------------------------------------------------------
-- |
-- Module      :  Control.Lens.Wrapped
-- Copyright   :  (C) 2012-16 Edward Kmett, Michael Sloan
-- License     :  BSD-style (see the file LICENSE)
-- Maintainer  :  Edward Kmett <ekmett@gmail.com>
-- Stability   :  experimental
-- Portability :  Rank2, MPTCs, fundeps
--
-- The 'Wrapped' class provides similar functionality as @Control.Newtype@,
-- from the @newtype@ package, but in a more convenient and efficient form.
--
-- There are a few functions from @newtype@ that are not provided here, because
-- they can be done with the 'Iso' directly:
--
-- @
-- Control.Newtype.over 'Sum' f ≡ '_Unwrapping' 'Sum' 'Control.Lens.Setter.%~' f
-- Control.Newtype.under 'Sum' f ≡ '_Wrapping' 'Sum' 'Control.Lens.Setter.%~' f
-- Control.Newtype.overF 'Sum' f ≡ 'mapping' ('_Unwrapping' 'Sum') 'Control.Lens.Setter.%~' f
-- Control.Newtype.underF 'Sum' f ≡ 'mapping' ('_Wrapping' 'Sum') 'Control.Lens.Setter.%~' f
-- @
--
-- 'under' can also be used with '_Unwrapping' to provide the equivalent of
-- @Control.Newtype.under@.  Also, most use cases don't need full polymorphism,
-- so only the single constructor '_Wrapping' functions would be needed.
--
-- These equivalences aren't 100% honest, because @newtype@'s operators
-- need to rely on two @Newtype@ constraints.  This means that the wrapper used
-- for the output is not necessarily the same as the input.
--
----------------------------------------------------------------------------
module Control.Lens.Wrapped
  (
  -- * Wrapping and Unwrapping monomorphically
    Wrapped(..)
  , _Unwrapped'
  , _Wrapping', _Unwrapping'
  -- * Wrapping and unwrapping polymorphically
  , Rewrapped, Rewrapping
  , _Wrapped, _Unwrapped
  , _Wrapping, _Unwrapping
  -- * Operations
  , op
  , ala, alaf
#if __GLASGOW_HASKELL__ >= 710
  -- * Pattern Synonyms
  , pattern Wrapped
  , pattern Unwrapped
#endif
  -- * Generics
  , _GWrapped'
  ) where

#include "HsBaseConfig.h"

import qualified Control.Alternative.Free as Free
import qualified Control.Applicative as Applicative
import           Control.Applicative hiding (WrappedArrow(..))
import           Control.Applicative.Trans.Free
import           Control.Arrow
import           Control.Applicative.Backwards
import           Control.Comonad.Trans.Cofree
import           Control.Comonad.Trans.Coiter
import           Control.Comonad.Trans.Traced
import           Control.Exception
import           Control.Lens.Getter
import           Control.Lens.Internal.CTypes
import           Control.Lens.Iso
#if __GLASGOW_HASKELL__ >= 710
import           Control.Lens.Review
#endif
import           Control.Monad.Catch.Pure
import           Control.Monad.Trans.Cont
import           Control.Monad.Trans.Error
import           Control.Monad.Trans.Except
import           Control.Monad.Trans.Free
import           Control.Monad.Trans.Identity
import           Control.Monad.Trans.Iter
import           Control.Monad.Trans.List
import           Control.Monad.Trans.Maybe
import           Control.Monad.Trans.Reader
import qualified Control.Monad.Trans.RWS.Lazy      as Lazy
import qualified Control.Monad.Trans.RWS.Strict    as Strict
import qualified Control.Monad.Trans.State.Lazy    as Lazy
import qualified Control.Monad.Trans.State.Strict  as Strict
import qualified Control.Monad.Trans.Writer.Lazy   as Lazy
import qualified Control.Monad.Trans.Writer.Strict as Strict
import           Data.Bifunctor.Biff
import           Data.Bifunctor.Clown
import           Data.Bifunctor.Fix
import           Data.Bifunctor.Flip
import           Data.Bifunctor.Join
import           Data.Bifunctor.Joker
import           Data.Bifunctor.Tannen
import           Data.Bifunctor.Wrapped
import           Data.Foldable as Foldable
import           Data.Functor.Bind
import           Data.Functor.Compose
import           Data.Functor.Contravariant
import qualified Data.Functor.Contravariant.Compose as Contravariant
import           Data.Functor.Constant
import           Data.Functor.Identity
import           Data.Functor.Reverse
import           Data.Hashable
import qualified Data.IntSet as IntSet
import           Data.IntSet (IntSet)
import qualified Data.IntMap as IntMap
import           Data.IntMap (IntMap)
import qualified Data.HashSet as HashSet
import           Data.HashSet (HashSet)
import qualified Data.HashMap.Lazy as HashMap
import           Data.HashMap.Lazy (HashMap)
import           Data.List.NonEmpty (NonEmpty(..))
import qualified Data.Map as Map
import           Data.Map (Map)
import           Data.Monoid
import qualified Data.Profunctor as Profunctor
import           Data.Profunctor hiding (WrappedArrow(..))
import           Data.Profunctor.Cayley
import qualified Data.Semigroup as S
import           Data.Semigroupoid
import qualified Data.Semigroupoid.Dual as Semigroupoid
import           Data.Semigroupoid.Static
import qualified Data.Sequence as Seq
import           Data.Sequence (Seq)
import qualified Data.Set as Set
import           Data.Set (Set)
import           Data.Tagged
import qualified Data.Vector as Vector
import qualified Data.Vector.Primitive as Prim
import           Data.Vector.Primitive (Prim)
import qualified Data.Vector.Unboxed as Unboxed
import           Data.Vector.Unboxed (Unbox)
import qualified Data.Vector.Storable as Storable
import           Foreign.C.Error
import           Foreign.C.Types
import           Foreign.Storable (Storable)
import qualified GHC.Generics as Generic
import           GHC.Generics hiding (from, to)
import           System.Posix.Types
import           Data.Ord (Down(Down))

#if MIN_VERSION_base(4,8,0)
import qualified Data.Monoid as Monoid
#endif

-- $setup
-- >>> :set -XNoOverloadedStrings
-- >>> import Control.Lens
-- >>> import Data.Foldable (foldMap)
-- >>> import Data.Monoid (Sum (..), Product (..), All (..), Any (..))

-- | 'Wrapped' provides isomorphisms to wrap and unwrap newtypes or
-- data types with one constructor.
class Wrapped s where
  type Unwrapped s :: *
  type Unwrapped s = GUnwrapped (Rep s)

  -- | An isomorphism between @s@ and @a@.
  --
  -- If your type has a 'Generic' instance, '_Wrapped'' will default to '_GWrapped'',
  -- and you can choose to not override it with your own definition.
  _Wrapped' :: Iso' s (Unwrapped s)
  default _Wrapped' :: (Generic s, D1 d (C1 c (S1 s' (Rec0 a))) ~ Rep s, Unwrapped s ~ GUnwrapped (Rep s))
                    => Iso' s (Unwrapped s)
  _Wrapped' = p (Unwrapped s) (f (Unwrapped s)) -> p s (f s)
forall s (d :: Meta) (c :: Meta) (s' :: Meta) a.
(Generic s, D1 d (C1 c (S1 s' (Rec0 a))) ~ Rep s,
 Unwrapped s ~ GUnwrapped (Rep s)) =>
Iso' s (Unwrapped s)
_GWrapped'
  {-# INLINE _Wrapped' #-}

-- | Implement the '_Wrapped' operation for a type using its 'Generic' instance.
_GWrapped' :: (Generic s, D1 d (C1 c (S1 s' (Rec0 a))) ~ Rep s, Unwrapped s ~ GUnwrapped (Rep s))
           => Iso' s (Unwrapped s)
_GWrapped' :: Iso' s (Unwrapped s)
_GWrapped' = (s -> M1 D d (M1 C c (M1 S s' (K1 R a))) Any)
-> (M1 D d (M1 C c (M1 S s' (K1 R a))) Any -> s)
-> Iso
     s
     s
     (M1 D d (M1 C c (M1 S s' (K1 R a))) Any)
     (M1 D d (M1 C c (M1 S s' (K1 R a))) Any)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso s -> M1 D d (M1 C c (M1 S s' (K1 R a))) Any
forall a x. Generic a => a -> Rep a x
Generic.from M1 D d (M1 C c (M1 S s' (K1 R a))) Any -> s
forall a x. Generic a => Rep a x -> a
Generic.to (p (M1 D d (M1 C c (M1 S s' (K1 R a))) Any)
   (f (M1 D d (M1 C c (M1 S s' (K1 R a))) Any))
 -> p s (f s))
-> (p a (f a)
    -> p (M1 D d (M1 C c (M1 S s' (K1 R a))) Any)
         (f (M1 D d (M1 C c (M1 S s' (K1 R a))) Any)))
-> p a (f a)
-> p s (f s)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (M1 D d (M1 C c (M1 S s' (K1 R a))) Any -> a)
-> (a -> M1 D d (M1 C c (M1 S s' (K1 R a))) Any)
-> Iso
     (M1 D d (M1 C c (M1 S s' (K1 R a))) Any)
     (M1 D d (M1 C c (M1 S s' (K1 R a))) Any)
     a
     a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso M1 D d (M1 C c (M1 S s' (K1 R a))) Any -> a
forall k i (c :: Meta) i (c :: Meta) i (c :: Meta) i c (p :: k).
M1 i c (M1 i c (M1 i c (K1 i c))) p -> c
remitter a -> M1 D d (M1 C c (M1 S s' (K1 R a))) Any
forall k c i (c :: Meta) i (c :: Meta) i (c :: Meta) i (p :: k).
c -> M1 i c (M1 i c (M1 i c (K1 i c))) p
reviewer
  where
    remitter :: M1 i c (M1 i c (M1 i c (K1 i c))) p -> c
remitter (M1 (M1 (M1 (K1 c
x)))) = c
x
    reviewer :: c -> M1 i c (M1 i c (M1 i c (K1 i c))) p
reviewer c
x = M1 i c (M1 i c (K1 i c)) p -> M1 i c (M1 i c (M1 i c (K1 i c))) p
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1 (M1 i c (K1 i c) p -> M1 i c (M1 i c (K1 i c)) p
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1 (K1 i c p -> M1 i c (K1 i c) p
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1 (c -> K1 i c p
forall k i c (p :: k). c -> K1 i c p
K1 c
x)))
{-# INLINE _GWrapped' #-}

type family GUnwrapped (rep :: * -> *) :: *
type instance GUnwrapped (D1 d (C1 c (S1 s (Rec0 a)))) = a

#if __GLASGOW_HASKELL__ >= 710

pattern $bWrapped :: Unwrapped s -> s
$mWrapped :: forall r s.
Rewrapped s s =>
s -> (Unwrapped s -> r) -> (Void# -> r) -> r
Wrapped a <- (view _Wrapped -> a) where
  Wrapped Unwrapped s
a = AReview s (Unwrapped s) -> Unwrapped s -> s
forall b (m :: * -> *) t. MonadReader b m => AReview t b -> m t
review AReview s (Unwrapped s)
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped Unwrapped s
a

pattern $bUnwrapped :: t -> Unwrapped t
$mUnwrapped :: forall r t.
Rewrapped t t =>
Unwrapped t -> (t -> r) -> (Void# -> r) -> r
Unwrapped a <- (view _Unwrapped -> a) where
  Unwrapped t
a = AReview (Unwrapped t) t -> t -> Unwrapped t
forall b (m :: * -> *) t. MonadReader b m => AReview t b -> m t
review AReview (Unwrapped t) t
forall s t. Rewrapping s t => Iso (Unwrapped t) (Unwrapped s) t s
_Unwrapped t
a

#endif

-- This can be used to help inference between the wrappers
class Wrapped s => Rewrapped (s :: *) (t :: *)

class    (Rewrapped s t, Rewrapped t s) => Rewrapping s t
instance (Rewrapped s t, Rewrapped t s) => Rewrapping s t

_Unwrapped' :: Wrapped s => Iso' (Unwrapped s) s
_Unwrapped' :: Iso' (Unwrapped s) s
_Unwrapped' = AnIso s s (Unwrapped s) (Unwrapped s) -> Iso' (Unwrapped s) s
forall s t a b. AnIso s t a b -> Iso b a t s
from AnIso s s (Unwrapped s) (Unwrapped s)
forall s. Wrapped s => Iso' s (Unwrapped s)
_Wrapped'
{-# INLINE _Unwrapped' #-}

-- | Work under a newtype wrapper.
--
-- >>> Const "hello" & _Wrapped %~ Prelude.length & getConst
-- 5
--
-- @
-- '_Wrapped'   ≡ 'from' '_Unwrapped'
-- '_Unwrapped' ≡ 'from' '_Wrapped'
-- @
_Wrapped :: Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped :: Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped = AnIso s s (Unwrapped s) (Unwrapped s)
-> ((s -> Unwrapped s)
    -> (Unwrapped s -> s)
    -> p (Unwrapped s) (f (Unwrapped t))
    -> p s (f t))
-> p (Unwrapped s) (f (Unwrapped t))
-> p s (f t)
forall s t a b r. AnIso s t a b -> ((s -> a) -> (b -> t) -> r) -> r
withIso AnIso s s (Unwrapped s) (Unwrapped s)
forall s. Wrapped s => Iso' s (Unwrapped s)
_Wrapped' (((s -> Unwrapped s)
  -> (Unwrapped s -> s)
  -> p (Unwrapped s) (f (Unwrapped t))
  -> p s (f t))
 -> p (Unwrapped s) (f (Unwrapped t)) -> p s (f t))
-> ((s -> Unwrapped s)
    -> (Unwrapped s -> s)
    -> p (Unwrapped s) (f (Unwrapped t))
    -> p s (f t))
-> p (Unwrapped s) (f (Unwrapped t))
-> p s (f t)
forall a b. (a -> b) -> a -> b
$ \ s -> Unwrapped s
sa Unwrapped s -> s
_ -> AnIso t t (Unwrapped t) (Unwrapped t)
-> ((t -> Unwrapped t)
    -> (Unwrapped t -> t)
    -> p (Unwrapped s) (f (Unwrapped t))
    -> p s (f t))
-> p (Unwrapped s) (f (Unwrapped t))
-> p s (f t)
forall s t a b r. AnIso s t a b -> ((s -> a) -> (b -> t) -> r) -> r
withIso AnIso t t (Unwrapped t) (Unwrapped t)
forall s. Wrapped s => Iso' s (Unwrapped s)
_Wrapped' (((t -> Unwrapped t)
  -> (Unwrapped t -> t)
  -> p (Unwrapped s) (f (Unwrapped t))
  -> p s (f t))
 -> p (Unwrapped s) (f (Unwrapped t)) -> p s (f t))
-> ((t -> Unwrapped t)
    -> (Unwrapped t -> t)
    -> p (Unwrapped s) (f (Unwrapped t))
    -> p s (f t))
-> p (Unwrapped s) (f (Unwrapped t))
-> p s (f t)
forall a b. (a -> b) -> a -> b
$ \ t -> Unwrapped t
_ Unwrapped t -> t
bt -> (s -> Unwrapped s)
-> (Unwrapped t -> t) -> Iso s t (Unwrapped s) (Unwrapped t)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso s -> Unwrapped s
sa Unwrapped t -> t
bt
{-# INLINE _Wrapped #-}

_Unwrapped :: Rewrapping s t => Iso (Unwrapped t) (Unwrapped s) t s
_Unwrapped :: Iso (Unwrapped t) (Unwrapped s) t s
_Unwrapped = AnIso s t (Unwrapped s) (Unwrapped t)
-> Iso (Unwrapped t) (Unwrapped s) t s
forall s t a b. AnIso s t a b -> Iso b a t s
from AnIso s t (Unwrapped s) (Unwrapped t)
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped
{-# INLINE _Unwrapped #-}

-- * base

instance (t ~ All) => Rewrapped All t
instance Wrapped All where
  type Unwrapped All = Bool
  _Wrapped' :: p (Unwrapped All) (f (Unwrapped All)) -> p All (f All)
_Wrapped' = (All -> Bool) -> (Bool -> All) -> Iso All All Bool Bool
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso All -> Bool
getAll Bool -> All
All
  {-# INLINE _Wrapped' #-}

instance (t ~ Any) => Rewrapped Any t
instance Wrapped Any where
  type Unwrapped Any = Bool
  _Wrapped' :: p (Unwrapped Any) (f (Unwrapped Any)) -> p Any (f Any)
_Wrapped' = (Any -> Bool) -> (Bool -> Any) -> Iso Any Any Bool Bool
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Any -> Bool
getAny Bool -> Any
Any
  {-# INLINE _Wrapped' #-}

instance (t ~ Sum b) => Rewrapped (Sum a) t
instance Wrapped (Sum a) where
  type Unwrapped (Sum a) = a
  _Wrapped' :: p (Unwrapped (Sum a)) (f (Unwrapped (Sum a)))
-> p (Sum a) (f (Sum a))
_Wrapped' = (Sum a -> a) -> (a -> Sum a) -> Iso (Sum a) (Sum a) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Sum a -> a
forall a. Sum a -> a
getSum a -> Sum a
forall a. a -> Sum a
Sum
  {-# INLINE _Wrapped' #-}

instance (t ~ Product b) => Rewrapped (Product a) t
instance Wrapped (Product a) where
  type Unwrapped (Product a) = a
  _Wrapped' :: p (Unwrapped (Product a)) (f (Unwrapped (Product a)))
-> p (Product a) (f (Product a))
_Wrapped' = (Product a -> a)
-> (a -> Product a) -> Iso (Product a) (Product a) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Product a -> a
forall a. Product a -> a
getProduct a -> Product a
forall a. a -> Product a
Product
  {-# INLINE _Wrapped' #-}

instance (t ~ Kleisli m' a' b') => Rewrapped (Kleisli m a b) t
instance Wrapped (Kleisli m a b) where
  type Unwrapped (Kleisli m a b) = a -> m b
  _Wrapped' :: p (Unwrapped (Kleisli m a b)) (f (Unwrapped (Kleisli m a b)))
-> p (Kleisli m a b) (f (Kleisli m a b))
_Wrapped' = (Kleisli m a b -> a -> m b)
-> ((a -> m b) -> Kleisli m a b)
-> Iso (Kleisli m a b) (Kleisli m a b) (a -> m b) (a -> m b)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Kleisli m a b -> a -> m b
forall (m :: * -> *) a b. Kleisli m a b -> a -> m b
runKleisli (a -> m b) -> Kleisli m a b
forall (m :: * -> *) a b. (a -> m b) -> Kleisli m a b
Kleisli
  {-# INLINE _Wrapped' #-}

instance (t ~ WrappedMonad m' a') => Rewrapped (WrappedMonad m a) t
instance Wrapped (WrappedMonad m a) where
  type Unwrapped (WrappedMonad m a) = m a
  _Wrapped' :: p (Unwrapped (WrappedMonad m a)) (f (Unwrapped (WrappedMonad m a)))
-> p (WrappedMonad m a) (f (WrappedMonad m a))
_Wrapped' = (WrappedMonad m a -> m a)
-> (m a -> WrappedMonad m a)
-> Iso (WrappedMonad m a) (WrappedMonad m a) (m a) (m a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso WrappedMonad m a -> m a
forall (m :: * -> *) a. WrappedMonad m a -> m a
unwrapMonad m a -> WrappedMonad m a
forall (m :: * -> *) a. m a -> WrappedMonad m a
WrapMonad
  {-# INLINE _Wrapped' #-}

instance (t ~ Applicative.WrappedArrow a' b' c') => Rewrapped (Applicative.WrappedArrow a b c) t
instance Wrapped (Applicative.WrappedArrow a b c) where
  type Unwrapped (Applicative.WrappedArrow a b c) = a b c
  _Wrapped' :: p (Unwrapped (WrappedArrow a b c))
  (f (Unwrapped (WrappedArrow a b c)))
-> p (WrappedArrow a b c) (f (WrappedArrow a b c))
_Wrapped' = (WrappedArrow a b c -> a b c)
-> (a b c -> WrappedArrow a b c)
-> Iso (WrappedArrow a b c) (WrappedArrow a b c) (a b c) (a b c)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso WrappedArrow a b c -> a b c
forall (a :: * -> * -> *) b c. WrappedArrow a b c -> a b c
Applicative.unwrapArrow a b c -> WrappedArrow a b c
forall (a :: * -> * -> *) b c. a b c -> WrappedArrow a b c
Applicative.WrapArrow
  {-# INLINE _Wrapped' #-}

instance (t ~ ZipList b) => Rewrapped (ZipList a) t
instance Wrapped (ZipList a) where
  type Unwrapped (ZipList a) = [a]
  _Wrapped' :: p (Unwrapped (ZipList a)) (f (Unwrapped (ZipList a)))
-> p (ZipList a) (f (ZipList a))
_Wrapped' = (ZipList a -> [a])
-> ([a] -> ZipList a) -> Iso (ZipList a) (ZipList a) [a] [a]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ZipList a -> [a]
forall a. ZipList a -> [a]
getZipList [a] -> ZipList a
forall a. [a] -> ZipList a
ZipList
  {-# INLINE _Wrapped' #-}

instance (t ~ NonEmpty b) => Rewrapped (NonEmpty a) t
instance Wrapped (NonEmpty a) where
  type Unwrapped (NonEmpty a) = (a, [a])
  _Wrapped' :: p (Unwrapped (NonEmpty a)) (f (Unwrapped (NonEmpty a)))
-> p (NonEmpty a) (f (NonEmpty a))
_Wrapped' = (NonEmpty a -> (a, [a]))
-> ((a, [a]) -> NonEmpty a)
-> Iso (NonEmpty a) (NonEmpty a) (a, [a]) (a, [a])
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(a
a :| [a]
as) -> (a
a, [a]
as)) (\(a
a,[a]
as) -> a
a a -> [a] -> NonEmpty a
forall a. a -> [a] -> NonEmpty a
:| [a]
as)
  {-# INLINE _Wrapped' #-}

instance (t ~ Const a' x') => Rewrapped (Const a x) t
instance Wrapped (Const a x) where
  type Unwrapped (Const a x) = a
  _Wrapped' :: p (Unwrapped (Const a x)) (f (Unwrapped (Const a x)))
-> p (Const a x) (f (Const a x))
_Wrapped' = (Const a x -> a)
-> (a -> Const a x) -> Iso (Const a x) (Const a x) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Const a x -> a
forall a k (b :: k). Const a b -> a
getConst a -> Const a x
forall k a (b :: k). a -> Const a b
Const
  {-# INLINE _Wrapped' #-}

instance (t ~ Dual b) => Rewrapped (Dual a) t
instance Wrapped (Dual a) where
  type Unwrapped (Dual a) = a
  _Wrapped' :: p (Unwrapped (Dual a)) (f (Unwrapped (Dual a)))
-> p (Dual a) (f (Dual a))
_Wrapped' = (Dual a -> a) -> (a -> Dual a) -> Iso (Dual a) (Dual a) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Dual a -> a
forall a. Dual a -> a
getDual a -> Dual a
forall a. a -> Dual a
Dual
  {-# INLINE _Wrapped' #-}

instance (t ~ Endo b) => Rewrapped (Endo a) t
instance Wrapped (Endo a) where
  type Unwrapped (Endo a) = a -> a
  _Wrapped' :: p (Unwrapped (Endo a)) (f (Unwrapped (Endo a)))
-> p (Endo a) (f (Endo a))
_Wrapped' = (Endo a -> a -> a)
-> ((a -> a) -> Endo a) -> Iso (Endo a) (Endo a) (a -> a) (a -> a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Endo a -> a -> a
forall a. Endo a -> a -> a
appEndo (a -> a) -> Endo a
forall a. (a -> a) -> Endo a
Endo
  {-# INLINE _Wrapped' #-}

instance (t ~ First b) => Rewrapped (First a) t
instance Wrapped (First a) where
  type Unwrapped (First a) = Maybe a
  _Wrapped' :: p (Unwrapped (First a)) (f (Unwrapped (First a)))
-> p (First a) (f (First a))
_Wrapped' = (First a -> Maybe a)
-> (Maybe a -> First a)
-> Iso (First a) (First a) (Maybe a) (Maybe a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso First a -> Maybe a
forall a. First a -> Maybe a
getFirst Maybe a -> First a
forall a. Maybe a -> First a
First
  {-# INLINE _Wrapped' #-}

instance (t ~ Last b) => Rewrapped (Last a) t
instance Wrapped (Last a) where
  type Unwrapped (Last a) = Maybe a
  _Wrapped' :: p (Unwrapped (Last a)) (f (Unwrapped (Last a)))
-> p (Last a) (f (Last a))
_Wrapped' = (Last a -> Maybe a)
-> (Maybe a -> Last a) -> Iso (Last a) (Last a) (Maybe a) (Maybe a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Last a -> Maybe a
forall a. Last a -> Maybe a
getLast Maybe a -> Last a
forall a. Maybe a -> Last a
Last
  {-# INLINE _Wrapped' #-}

#if MIN_VERSION_base(4,8,0)
instance (t ~ Monoid.Alt g b) => Rewrapped (Monoid.Alt f a) t
instance Wrapped (Monoid.Alt f a) where
  type Unwrapped (Monoid.Alt f a) = f a
  _Wrapped' :: p (Unwrapped (Alt f a)) (f (Unwrapped (Alt f a)))
-> p (Alt f a) (f (Alt f a))
_Wrapped' = (Alt f a -> f a)
-> (f a -> Alt f a) -> Iso (Alt f a) (Alt f a) (f a) (f a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Alt f a -> f a
forall k (f :: k -> *) (a :: k). Alt f a -> f a
Monoid.getAlt f a -> Alt f a
forall k (f :: k -> *) (a :: k). f a -> Alt f a
Monoid.Alt
  {-# INLINE _Wrapped' #-}
#endif

#if MIN_VERSION_base(4,12,0)
instance (t ~ Monoid.Ap g b) => Rewrapped (Monoid.Ap f a) t
instance Wrapped (Monoid.Ap f a) where
  type Unwrapped (Monoid.Ap f a) = f a
  _Wrapped' :: p (Unwrapped (Ap f a)) (f (Unwrapped (Ap f a)))
-> p (Ap f a) (f (Ap f a))
_Wrapped' = (Ap f a -> f a)
-> (f a -> Ap f a) -> Iso (Ap f a) (Ap f a) (f a) (f a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Ap f a -> f a
forall k (f :: k -> *) (a :: k). Ap f a -> f a
Monoid.getAp f a -> Ap f a
forall k (f :: k -> *) (a :: k). f a -> Ap f a
Monoid.Ap
  {-# INLINE _Wrapped' #-}
#endif

instance t ~ ArrowMonad m' a' => Rewrapped (ArrowMonad m a) t
instance Wrapped (ArrowMonad m a) where
  type Unwrapped (ArrowMonad m a) = m () a
  _Wrapped' :: p (Unwrapped (ArrowMonad m a)) (f (Unwrapped (ArrowMonad m a)))
-> p (ArrowMonad m a) (f (ArrowMonad m a))
_Wrapped' = (ArrowMonad m a -> m () a)
-> (m () a -> ArrowMonad m a)
-> Iso (ArrowMonad m a) (ArrowMonad m a) (m () a) (m () a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ArrowMonad m a -> m () a
forall (m :: * -> * -> *) a. ArrowMonad m a -> m () a
getArrowMonad m () a -> ArrowMonad m a
forall (a :: * -> * -> *) b. a () b -> ArrowMonad a b
ArrowMonad
  {-# INLINE _Wrapped' #-}

instance t ~ Down b => Rewrapped (Down a) t
instance Wrapped (Down a) where
  type Unwrapped (Down a) = a
  _Wrapped' :: p (Unwrapped (Down a)) (f (Unwrapped (Down a)))
-> p (Down a) (f (Down a))
_Wrapped' = (Down a -> a) -> (a -> Down a) -> Iso (Down a) (Down a) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(Down a
a) -> a
a) a -> Down a
forall a. a -> Down a
Down
  {-# INLINE _Wrapped' #-}

instance Rewrapped Errno t
instance Wrapped Errno where
  type Unwrapped Errno = CInt
  _Wrapped' :: p (Unwrapped Errno) (f (Unwrapped Errno)) -> p Errno (f Errno)
_Wrapped' = (Errno -> CInt) -> (CInt -> Errno) -> Iso Errno Errno CInt CInt
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(Errno CInt
x) -> CInt
x) CInt -> Errno
Errno
  {-# INLINE _Wrapped' #-}

getArrowMonad :: ArrowMonad m a -> m () a
getArrowMonad :: ArrowMonad m a -> m () a
getArrowMonad (ArrowMonad m () a
x) = m () a
x
{-# INLINE getArrowMonad #-}

-- * transformers

instance (t ~ Backwards g b) => Rewrapped (Backwards f a) t
instance Wrapped (Backwards f a) where
  type Unwrapped (Backwards f a) = f a
  _Wrapped' :: p (Unwrapped (Backwards f a)) (f (Unwrapped (Backwards f a)))
-> p (Backwards f a) (f (Backwards f a))
_Wrapped' = (Backwards f a -> f a)
-> (f a -> Backwards f a)
-> Iso (Backwards f a) (Backwards f a) (f a) (f a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Backwards f a -> f a
forall k (f :: k -> *) (a :: k). Backwards f a -> f a
forwards f a -> Backwards f a
forall k (f :: k -> *) (a :: k). f a -> Backwards f a
Backwards

instance (t ~ Compose f' g' a') => Rewrapped (Compose f g a) t
instance Wrapped (Compose f g a) where
  type Unwrapped (Compose f g a) = f (g a)
  _Wrapped' :: p (Unwrapped (Compose f g a)) (f (Unwrapped (Compose f g a)))
-> p (Compose f g a) (f (Compose f g a))
_Wrapped' = (Compose f g a -> f (g a))
-> (f (g a) -> Compose f g a)
-> Iso (Compose f g a) (Compose f g a) (f (g a)) (f (g a))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Compose f g a -> f (g a)
forall k1 (f :: k1 -> *) k2 (g :: k2 -> k1) (a :: k2).
Compose f g a -> f (g a)
getCompose f (g a) -> Compose f g a
forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1).
f (g a) -> Compose f g a
Compose

instance (t ~ Constant a' b') => Rewrapped (Constant a b) t
instance Wrapped (Constant a b) where
  type Unwrapped (Constant a b) = a
  _Wrapped' :: p (Unwrapped (Constant a b)) (f (Unwrapped (Constant a b)))
-> p (Constant a b) (f (Constant a b))
_Wrapped' = (Constant a b -> a)
-> (a -> Constant a b) -> Iso (Constant a b) (Constant a b) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Constant a b -> a
forall a k (b :: k). Constant a b -> a
getConstant a -> Constant a b
forall k a (b :: k). a -> Constant a b
Constant

instance (t ~ ContT r' m' a') => Rewrapped (ContT r m a) t
instance Wrapped (ContT r m a) where
  type Unwrapped (ContT r m a) = (a -> m r) -> m r
  _Wrapped' :: p (Unwrapped (ContT r m a)) (f (Unwrapped (ContT r m a)))
-> p (ContT r m a) (f (ContT r m a))
_Wrapped' = (ContT r m a -> (a -> m r) -> m r)
-> (((a -> m r) -> m r) -> ContT r m a)
-> Iso
     (ContT r m a) (ContT r m a) ((a -> m r) -> m r) ((a -> m r) -> m r)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ContT r m a -> (a -> m r) -> m r
forall k (r :: k) (m :: k -> *) a. ContT r m a -> (a -> m r) -> m r
runContT ((a -> m r) -> m r) -> ContT r m a
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT

instance (t ~ ErrorT e' m' a') => Rewrapped (ErrorT e m a) t
instance Wrapped (ErrorT e m a) where
  type Unwrapped (ErrorT e m a) = m (Either e a)
  _Wrapped' :: p (Unwrapped (ErrorT e m a)) (f (Unwrapped (ErrorT e m a)))
-> p (ErrorT e m a) (f (ErrorT e m a))
_Wrapped' = (ErrorT e m a -> m (Either e a))
-> (m (Either e a) -> ErrorT e m a)
-> Iso
     (ErrorT e m a) (ErrorT e m a) (m (Either e a)) (m (Either e a))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ErrorT e m a -> m (Either e a)
forall e (m :: * -> *) a. ErrorT e m a -> m (Either e a)
runErrorT m (Either e a) -> ErrorT e m a
forall e (m :: * -> *) a. m (Either e a) -> ErrorT e m a
ErrorT
  {-# INLINE _Wrapped' #-}

instance (t ~ ExceptT e' m' a') => Rewrapped (ExceptT e m a) t
instance Wrapped (ExceptT e m a) where
  type Unwrapped (ExceptT e m a) = m (Either e a)
  _Wrapped' :: p (Unwrapped (ExceptT e m a)) (f (Unwrapped (ExceptT e m a)))
-> p (ExceptT e m a) (f (ExceptT e m a))
_Wrapped' = (ExceptT e m a -> m (Either e a))
-> (m (Either e a) -> ExceptT e m a)
-> Iso
     (ExceptT e m a) (ExceptT e m a) (m (Either e a)) (m (Either e a))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ExceptT e m a -> m (Either e a)
forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a)
runExceptT m (Either e a) -> ExceptT e m a
forall e (m :: * -> *) a. m (Either e a) -> ExceptT e m a
ExceptT
  {-# INLINE _Wrapped' #-}

instance (t ~ Identity b) => Rewrapped (Identity a) t
instance Wrapped (Identity a) where
  type Unwrapped (Identity a) = a
  _Wrapped' :: p (Unwrapped (Identity a)) (f (Unwrapped (Identity a)))
-> p (Identity a) (f (Identity a))
_Wrapped' = (Identity a -> a)
-> (a -> Identity a) -> Iso (Identity a) (Identity a) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Identity a -> a
forall a. Identity a -> a
runIdentity a -> Identity a
forall a. a -> Identity a
Identity
  {-# INLINE _Wrapped' #-}

instance (t ~ IdentityT n b) => Rewrapped (IdentityT m a) t
instance Wrapped (IdentityT m a) where
  type Unwrapped (IdentityT m a) = m a
  _Wrapped' :: p (Unwrapped (IdentityT m a)) (f (Unwrapped (IdentityT m a)))
-> p (IdentityT m a) (f (IdentityT m a))
_Wrapped' = (IdentityT m a -> m a)
-> (m a -> IdentityT m a)
-> Iso (IdentityT m a) (IdentityT m a) (m a) (m a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso IdentityT m a -> m a
forall k (f :: k -> *) (a :: k). IdentityT f a -> f a
runIdentityT m a -> IdentityT m a
forall k (f :: k -> *) (a :: k). f a -> IdentityT f a
IdentityT
  {-# INLINE _Wrapped' #-}

instance (t ~ ListT n b) => Rewrapped (ListT m a) t
instance Wrapped (ListT m a) where
  type Unwrapped (ListT m a) = m [a]
  _Wrapped' :: p (Unwrapped (ListT m a)) (f (Unwrapped (ListT m a)))
-> p (ListT m a) (f (ListT m a))
_Wrapped' = (ListT m a -> m [a])
-> (m [a] -> ListT m a)
-> Iso (ListT m a) (ListT m a) (m [a]) (m [a])
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ListT m a -> m [a]
forall (m :: * -> *) a. ListT m a -> m [a]
runListT m [a] -> ListT m a
forall (m :: * -> *) a. m [a] -> ListT m a
ListT
  {-# INLINE _Wrapped' #-}

instance (t ~ MaybeT n b) => Rewrapped (MaybeT m a) t
instance Wrapped (MaybeT m a) where
  type Unwrapped (MaybeT m a) = m (Maybe a)
  _Wrapped' :: p (Unwrapped (MaybeT m a)) (f (Unwrapped (MaybeT m a)))
-> p (MaybeT m a) (f (MaybeT m a))
_Wrapped' = (MaybeT m a -> m (Maybe a))
-> (m (Maybe a) -> MaybeT m a)
-> Iso (MaybeT m a) (MaybeT m a) (m (Maybe a)) (m (Maybe a))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso MaybeT m a -> m (Maybe a)
forall (m :: * -> *) a. MaybeT m a -> m (Maybe a)
runMaybeT m (Maybe a) -> MaybeT m a
forall (m :: * -> *) a. m (Maybe a) -> MaybeT m a
MaybeT
  {-# INLINE _Wrapped' #-}

instance (t ~ ReaderT s n b) => Rewrapped (ReaderT r m a) t
instance Wrapped (ReaderT r m a) where
  type Unwrapped (ReaderT r m a) = r -> m a
  _Wrapped' :: p (Unwrapped (ReaderT r m a)) (f (Unwrapped (ReaderT r m a)))
-> p (ReaderT r m a) (f (ReaderT r m a))
_Wrapped' = (ReaderT r m a -> r -> m a)
-> ((r -> m a) -> ReaderT r m a)
-> Iso (ReaderT r m a) (ReaderT r m a) (r -> m a) (r -> m a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ReaderT r m a -> r -> m a
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (r -> m a) -> ReaderT r m a
forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
ReaderT
  {-# INLINE _Wrapped' #-}

instance (t ~ Reverse g b) => Rewrapped (Reverse f a) t
instance Wrapped (Reverse f a) where
  type Unwrapped (Reverse f a) = f a
  _Wrapped' :: p (Unwrapped (Reverse f a)) (f (Unwrapped (Reverse f a)))
-> p (Reverse f a) (f (Reverse f a))
_Wrapped' = (Reverse f a -> f a)
-> (f a -> Reverse f a)
-> Iso (Reverse f a) (Reverse f a) (f a) (f a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Reverse f a -> f a
forall k (f :: k -> *) (a :: k). Reverse f a -> f a
getReverse f a -> Reverse f a
forall k (f :: k -> *) (a :: k). f a -> Reverse f a
Reverse
  {-# INLINE _Wrapped' #-}

instance (t ~ Lazy.RWST r' w' s' m' a') => Rewrapped (Lazy.RWST r w s m a) t
instance Wrapped (Lazy.RWST r w s m a) where
  type Unwrapped (Lazy.RWST r w s m a) = r -> s -> m (a, s, w)
  _Wrapped' :: p (Unwrapped (RWST r w s m a)) (f (Unwrapped (RWST r w s m a)))
-> p (RWST r w s m a) (f (RWST r w s m a))
_Wrapped' = (RWST r w s m a -> r -> s -> m (a, s, w))
-> ((r -> s -> m (a, s, w)) -> RWST r w s m a)
-> Iso
     (RWST r w s m a)
     (RWST r w s m a)
     (r -> s -> m (a, s, w))
     (r -> s -> m (a, s, w))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso RWST r w s m a -> r -> s -> m (a, s, w)
forall r w s (m :: * -> *) a.
RWST r w s m a -> r -> s -> m (a, s, w)
Lazy.runRWST (r -> s -> m (a, s, w)) -> RWST r w s m a
forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Lazy.RWST
  {-# INLINE _Wrapped' #-}

instance (t ~ Strict.RWST r' w' s' m' a') => Rewrapped (Strict.RWST r w s m a) t
instance Wrapped (Strict.RWST r w s m a) where
  type Unwrapped (Strict.RWST r w s m a) = r -> s -> m (a, s, w)
  _Wrapped' :: p (Unwrapped (RWST r w s m a)) (f (Unwrapped (RWST r w s m a)))
-> p (RWST r w s m a) (f (RWST r w s m a))
_Wrapped' = (RWST r w s m a -> r -> s -> m (a, s, w))
-> ((r -> s -> m (a, s, w)) -> RWST r w s m a)
-> Iso
     (RWST r w s m a)
     (RWST r w s m a)
     (r -> s -> m (a, s, w))
     (r -> s -> m (a, s, w))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso RWST r w s m a -> r -> s -> m (a, s, w)
forall r w s (m :: * -> *) a.
RWST r w s m a -> r -> s -> m (a, s, w)
Strict.runRWST (r -> s -> m (a, s, w)) -> RWST r w s m a
forall r w s (m :: * -> *) a.
(r -> s -> m (a, s, w)) -> RWST r w s m a
Strict.RWST
  {-# INLINE _Wrapped' #-}

instance (t ~ Lazy.StateT s' m' a') => Rewrapped (Lazy.StateT s m a) t
instance Wrapped (Lazy.StateT s m a) where
  type Unwrapped (Lazy.StateT s m a) = s -> m (a, s)
  _Wrapped' :: p (Unwrapped (StateT s m a)) (f (Unwrapped (StateT s m a)))
-> p (StateT s m a) (f (StateT s m a))
_Wrapped' = (StateT s m a -> s -> m (a, s))
-> ((s -> m (a, s)) -> StateT s m a)
-> Iso
     (StateT s m a) (StateT s m a) (s -> m (a, s)) (s -> m (a, s))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso StateT s m a -> s -> m (a, s)
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
Lazy.runStateT (s -> m (a, s)) -> StateT s m a
forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Lazy.StateT
  {-# INLINE _Wrapped' #-}

instance (t ~ Strict.StateT s' m' a') => Rewrapped (Strict.StateT s m a) t
instance Wrapped (Strict.StateT s m a) where
  type Unwrapped (Strict.StateT s m a) = s -> m (a, s)
  _Wrapped' :: p (Unwrapped (StateT s m a)) (f (Unwrapped (StateT s m a)))
-> p (StateT s m a) (f (StateT s m a))
_Wrapped' = (StateT s m a -> s -> m (a, s))
-> ((s -> m (a, s)) -> StateT s m a)
-> Iso
     (StateT s m a) (StateT s m a) (s -> m (a, s)) (s -> m (a, s))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso StateT s m a -> s -> m (a, s)
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
Strict.runStateT (s -> m (a, s)) -> StateT s m a
forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Strict.StateT
  {-# INLINE _Wrapped' #-}

instance (t ~ Lazy.WriterT w' m' a') => Rewrapped (Lazy.WriterT w m a) t
instance Wrapped (Lazy.WriterT w m a) where
  type Unwrapped (Lazy.WriterT w m a) = m (a, w)
  _Wrapped' :: p (Unwrapped (WriterT w m a)) (f (Unwrapped (WriterT w m a)))
-> p (WriterT w m a) (f (WriterT w m a))
_Wrapped' = (WriterT w m a -> m (a, w))
-> (m (a, w) -> WriterT w m a)
-> Iso (WriterT w m a) (WriterT w m a) (m (a, w)) (m (a, w))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso WriterT w m a -> m (a, w)
forall w (m :: * -> *) a. WriterT w m a -> m (a, w)
Lazy.runWriterT m (a, w) -> WriterT w m a
forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Lazy.WriterT
  {-# INLINE _Wrapped' #-}

instance (t ~ Strict.WriterT w' m' a') => Rewrapped (Strict.WriterT w m a) t
instance Wrapped (Strict.WriterT w m a) where
  type Unwrapped (Strict.WriterT w m a) = m (a, w)
  _Wrapped' :: p (Unwrapped (WriterT w m a)) (f (Unwrapped (WriterT w m a)))
-> p (WriterT w m a) (f (WriterT w m a))
_Wrapped' = (WriterT w m a -> m (a, w))
-> (m (a, w) -> WriterT w m a)
-> Iso (WriterT w m a) (WriterT w m a) (m (a, w)) (m (a, w))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso WriterT w m a -> m (a, w)
forall w (m :: * -> *) a. WriterT w m a -> m (a, w)
Strict.runWriterT m (a, w) -> WriterT w m a
forall w (m :: * -> *) a. m (a, w) -> WriterT w m a
Strict.WriterT
  {-# INLINE _Wrapped' #-}

-- * bifunctors

instance (t ~ Biff p' f' g' a' b') => Rewrapped (Biff p f g a b) t
instance Wrapped (Biff p f g a b) where
  type Unwrapped (Biff p f g a b) = p (f a) (g b)
  _Wrapped' :: p (Unwrapped (Biff p f g a b)) (f (Unwrapped (Biff p f g a b)))
-> p (Biff p f g a b) (f (Biff p f g a b))
_Wrapped' = (Biff p f g a b -> p (f a) (g b))
-> (p (f a) (g b) -> Biff p f g a b)
-> Iso
     (Biff p f g a b) (Biff p f g a b) (p (f a) (g b)) (p (f a) (g b))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Biff p f g a b -> p (f a) (g b)
forall k1 k2 (p :: k1 -> k2 -> *) k3 (f :: k3 -> k1) k4
       (g :: k4 -> k2) (a :: k3) (b :: k4).
Biff p f g a b -> p (f a) (g b)
runBiff p (f a) (g b) -> Biff p f g a b
forall k k1 k2 k3 (p :: k -> k1 -> *) (f :: k2 -> k)
       (g :: k3 -> k1) (a :: k2) (b :: k3).
p (f a) (g b) -> Biff p f g a b
Biff
  {-# INLINE _Wrapped' #-}

instance (t ~ Clown f' a' b') => Rewrapped (Clown f a b) t
instance Wrapped (Clown f a b) where
  type Unwrapped (Clown f a b) = f a
  _Wrapped' :: p (Unwrapped (Clown f a b)) (f (Unwrapped (Clown f a b)))
-> p (Clown f a b) (f (Clown f a b))
_Wrapped' = (Clown f a b -> f a)
-> (f a -> Clown f a b)
-> Iso (Clown f a b) (Clown f a b) (f a) (f a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Clown f a b -> f a
forall k1 (f :: k1 -> *) (a :: k1) k2 (b :: k2). Clown f a b -> f a
runClown f a -> Clown f a b
forall k k1 (f :: k -> *) (a :: k) (b :: k1). f a -> Clown f a b
Clown
  {-# INLINE _Wrapped' #-}

instance (t ~ Fix p' a') => Rewrapped (Fix p a) t
instance Wrapped (Fix p a) where
  type Unwrapped (Fix p a) = p (Fix p a) a
  _Wrapped' :: p (Unwrapped (Fix p a)) (f (Unwrapped (Fix p a)))
-> p (Fix p a) (f (Fix p a))
_Wrapped' = (Fix p a -> p (Fix p a) a)
-> (p (Fix p a) a -> Fix p a)
-> Iso (Fix p a) (Fix p a) (p (Fix p a) a) (p (Fix p a) a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Fix p a -> p (Fix p a) a
forall k (p :: * -> k -> *) (a :: k). Fix p a -> p (Fix p a) a
out p (Fix p a) a -> Fix p a
forall k (p :: * -> k -> *) (a :: k). p (Fix p a) a -> Fix p a
In
  {-# INLINE _Wrapped' #-}

instance (t ~ Flip p' a' b') => Rewrapped (Flip p a b) t
instance Wrapped (Flip p a b) where
  type Unwrapped (Flip p a b) = p b a
  _Wrapped' :: p (Unwrapped (Flip p a b)) (f (Unwrapped (Flip p a b)))
-> p (Flip p a b) (f (Flip p a b))
_Wrapped' = (Flip p a b -> p b a)
-> (p b a -> Flip p a b)
-> Iso (Flip p a b) (Flip p a b) (p b a) (p b a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Flip p a b -> p b a
forall k1 k2 (p :: k2 -> k1 -> *) (a :: k1) (b :: k2).
Flip p a b -> p b a
runFlip p b a -> Flip p a b
forall k k1 (p :: k -> k1 -> *) (a :: k1) (b :: k).
p b a -> Flip p a b
Flip
  {-# INLINE _Wrapped' #-}

instance (t ~ Join p' a') => Rewrapped (Join p a) t
instance Wrapped (Join p a) where
  type Unwrapped (Join p a) = p a a
  _Wrapped' :: p (Unwrapped (Join p a)) (f (Unwrapped (Join p a)))
-> p (Join p a) (f (Join p a))
_Wrapped' = (Join p a -> p a a)
-> (p a a -> Join p a) -> Iso (Join p a) (Join p a) (p a a) (p a a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Join p a -> p a a
forall k (p :: k -> k -> *) (a :: k). Join p a -> p a a
runJoin p a a -> Join p a
forall k (p :: k -> k -> *) (a :: k). p a a -> Join p a
Join
  {-# INLINE _Wrapped' #-}

instance (t ~ Joker g' a' b') => Rewrapped (Joker g a b) t
instance Wrapped (Joker g a b) where
  type Unwrapped (Joker g a b) = g b
  _Wrapped' :: p (Unwrapped (Joker g a b)) (f (Unwrapped (Joker g a b)))
-> p (Joker g a b) (f (Joker g a b))
_Wrapped' = (Joker g a b -> g b)
-> (g b -> Joker g a b)
-> Iso (Joker g a b) (Joker g a b) (g b) (g b)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Joker g a b -> g b
forall k1 (g :: k1 -> *) k2 (a :: k2) (b :: k1). Joker g a b -> g b
runJoker g b -> Joker g a b
forall k k1 (g :: k -> *) (a :: k1) (b :: k). g b -> Joker g a b
Joker
  {-# INLINE _Wrapped' #-}

instance (t ~ Tannen f' p' a' b') => Rewrapped (Tannen f p a b) t
instance Wrapped (Tannen f p a b) where
  type Unwrapped (Tannen f p a b) = f (p a b)
  _Wrapped' :: p (Unwrapped (Tannen f p a b)) (f (Unwrapped (Tannen f p a b)))
-> p (Tannen f p a b) (f (Tannen f p a b))
_Wrapped' = (Tannen f p a b -> f (p a b))
-> (f (p a b) -> Tannen f p a b)
-> Iso (Tannen f p a b) (Tannen f p a b) (f (p a b)) (f (p a b))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Tannen f p a b -> f (p a b)
forall k1 (f :: k1 -> *) k2 k3 (p :: k2 -> k3 -> k1) (a :: k2)
       (b :: k3).
Tannen f p a b -> f (p a b)
runTannen f (p a b) -> Tannen f p a b
forall k k1 k2 (f :: k -> *) (p :: k1 -> k2 -> k) (a :: k1)
       (b :: k2).
f (p a b) -> Tannen f p a b
Tannen
  {-# INLINE _Wrapped' #-}

instance (t ~ WrappedBifunctor p' a' b') => Rewrapped (WrappedBifunctor p a b) t
instance Wrapped (WrappedBifunctor p a b) where
  type Unwrapped (WrappedBifunctor p a b) = p a b
  _Wrapped' :: p (Unwrapped (WrappedBifunctor p a b))
  (f (Unwrapped (WrappedBifunctor p a b)))
-> p (WrappedBifunctor p a b) (f (WrappedBifunctor p a b))
_Wrapped' = (WrappedBifunctor p a b -> p a b)
-> (p a b -> WrappedBifunctor p a b)
-> Iso
     (WrappedBifunctor p a b) (WrappedBifunctor p a b) (p a b) (p a b)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso WrappedBifunctor p a b -> p a b
forall k1 k2 (p :: k1 -> k2 -> *) (a :: k1) (b :: k2).
WrappedBifunctor p a b -> p a b
unwrapBifunctor p a b -> WrappedBifunctor p a b
forall k k1 (p :: k -> k1 -> *) (a :: k) (b :: k1).
p a b -> WrappedBifunctor p a b
WrapBifunctor
  {-# INLINE _Wrapped' #-}

-- * comonad

instance (t ~ TracedT m' w' a') => Rewrapped (TracedT m w a) t
instance Wrapped (TracedT m w a) where
  type Unwrapped (TracedT m w a) = w (m -> a)
  _Wrapped' :: p (Unwrapped (TracedT m w a)) (f (Unwrapped (TracedT m w a)))
-> p (TracedT m w a) (f (TracedT m w a))
_Wrapped' = (TracedT m w a -> w (m -> a))
-> (w (m -> a) -> TracedT m w a)
-> Iso (TracedT m w a) (TracedT m w a) (w (m -> a)) (w (m -> a))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso TracedT m w a -> w (m -> a)
forall m (w :: * -> *) a. TracedT m w a -> w (m -> a)
runTracedT w (m -> a) -> TracedT m w a
forall m (w :: * -> *) a. w (m -> a) -> TracedT m w a
TracedT
  {-# INLINE _Wrapped' #-}

-- * exceptions

instance (t ~ CatchT m' a') => Rewrapped (CatchT m a) t
instance Wrapped (CatchT m a) where
  type Unwrapped (CatchT m a) = m (Either SomeException a)
  _Wrapped' :: p (Unwrapped (CatchT m a)) (f (Unwrapped (CatchT m a)))
-> p (CatchT m a) (f (CatchT m a))
_Wrapped' = (CatchT m a -> m (Either SomeException a))
-> (m (Either SomeException a) -> CatchT m a)
-> Iso
     (CatchT m a)
     (CatchT m a)
     (m (Either SomeException a))
     (m (Either SomeException a))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso CatchT m a -> m (Either SomeException a)
forall (m :: * -> *) a. CatchT m a -> m (Either SomeException a)
runCatchT m (Either SomeException a) -> CatchT m a
forall (m :: * -> *) a. m (Either SomeException a) -> CatchT m a
CatchT
  {-# INLINE _Wrapped' #-}

-- * free

instance (t ~ Free.Alt f' a') => Rewrapped (Free.Alt f a) t
instance Wrapped (Free.Alt f a) where
  type Unwrapped (Free.Alt f a) = [Free.AltF f a]
  _Wrapped' :: p (Unwrapped (Alt f a)) (f (Unwrapped (Alt f a)))
-> p (Alt f a) (f (Alt f a))
_Wrapped' = (Alt f a -> [AltF f a])
-> ([AltF f a] -> Alt f a)
-> Iso (Alt f a) (Alt f a) [AltF f a] [AltF f a]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Alt f a -> [AltF f a]
forall (f :: * -> *) a. Alt f a -> [AltF f a]
Free.alternatives [AltF f a] -> Alt f a
forall (f :: * -> *) a. [AltF f a] -> Alt f a
Free.Alt
  {-# INLINE _Wrapped' #-}

instance (t ~ ApT f' g' a') => Rewrapped (ApT f g a) t
instance Wrapped (ApT f g a) where
  type Unwrapped (ApT f g a) = g (ApF f g a)
  _Wrapped' :: p (Unwrapped (ApT f g a)) (f (Unwrapped (ApT f g a)))
-> p (ApT f g a) (f (ApT f g a))
_Wrapped' = (ApT f g a -> g (ApF f g a))
-> (g (ApF f g a) -> ApT f g a)
-> Iso (ApT f g a) (ApT f g a) (g (ApF f g a)) (g (ApF f g a))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ApT f g a -> g (ApF f g a)
forall (f :: * -> *) (g :: * -> *) a. ApT f g a -> g (ApF f g a)
getApT g (ApF f g a) -> ApT f g a
forall (f :: * -> *) (g :: * -> *) a. g (ApF f g a) -> ApT f g a
ApT
  {-# INLINE _Wrapped' #-}

instance (t ~ CofreeT f' w' a') => Rewrapped (CofreeT f w a) t
instance Wrapped (CofreeT f w a) where
  type Unwrapped (CofreeT f w a) = w (CofreeF f a (CofreeT f w a))
  _Wrapped' :: p (Unwrapped (CofreeT f w a)) (f (Unwrapped (CofreeT f w a)))
-> p (CofreeT f w a) (f (CofreeT f w a))
_Wrapped' = (CofreeT f w a -> w (CofreeF f a (CofreeT f w a)))
-> (w (CofreeF f a (CofreeT f w a)) -> CofreeT f w a)
-> Iso
     (CofreeT f w a)
     (CofreeT f w a)
     (w (CofreeF f a (CofreeT f w a)))
     (w (CofreeF f a (CofreeT f w a)))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso CofreeT f w a -> w (CofreeF f a (CofreeT f w a))
forall (f :: * -> *) (w :: * -> *) a.
CofreeT f w a -> w (CofreeF f a (CofreeT f w a))
runCofreeT w (CofreeF f a (CofreeT f w a)) -> CofreeT f w a
forall (f :: * -> *) (w :: * -> *) a.
w (CofreeF f a (CofreeT f w a)) -> CofreeT f w a
CofreeT
  {-# INLINE _Wrapped' #-}

instance (t ~ CoiterT w' a') => Rewrapped (CoiterT w a) t
instance Wrapped (CoiterT w a) where
  type Unwrapped (CoiterT w a) = w (a, CoiterT w a)
  _Wrapped' :: p (Unwrapped (CoiterT w a)) (f (Unwrapped (CoiterT w a)))
-> p (CoiterT w a) (f (CoiterT w a))
_Wrapped' = (CoiterT w a -> w (a, CoiterT w a))
-> (w (a, CoiterT w a) -> CoiterT w a)
-> Iso
     (CoiterT w a)
     (CoiterT w a)
     (w (a, CoiterT w a))
     (w (a, CoiterT w a))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso CoiterT w a -> w (a, CoiterT w a)
forall (w :: * -> *) a. CoiterT w a -> w (a, CoiterT w a)
runCoiterT w (a, CoiterT w a) -> CoiterT w a
forall (w :: * -> *) a. w (a, CoiterT w a) -> CoiterT w a
CoiterT
  {-# INLINE _Wrapped' #-}

instance (t ~ FreeT f' m' a') => Rewrapped (FreeT f m a) t
instance Wrapped (FreeT f m a) where
  type Unwrapped (FreeT f m a) = m (FreeF f a (FreeT f m a))
  _Wrapped' :: p (Unwrapped (FreeT f m a)) (f (Unwrapped (FreeT f m a)))
-> p (FreeT f m a) (f (FreeT f m a))
_Wrapped' = (FreeT f m a -> m (FreeF f a (FreeT f m a)))
-> (m (FreeF f a (FreeT f m a)) -> FreeT f m a)
-> Iso
     (FreeT f m a)
     (FreeT f m a)
     (m (FreeF f a (FreeT f m a)))
     (m (FreeF f a (FreeT f m a)))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso FreeT f m a -> m (FreeF f a (FreeT f m a))
forall (f :: * -> *) (m :: * -> *) a.
FreeT f m a -> m (FreeF f a (FreeT f m a))
runFreeT m (FreeF f a (FreeT f m a)) -> FreeT f m a
forall (f :: * -> *) (m :: * -> *) a.
m (FreeF f a (FreeT f m a)) -> FreeT f m a
FreeT
  {-# INLINE _Wrapped' #-}

instance (t ~ IterT m' a') => Rewrapped (IterT m a) t
instance Wrapped (IterT m a) where
  type Unwrapped (IterT m a) = m (Either a (IterT m a))
  _Wrapped' :: p (Unwrapped (IterT m a)) (f (Unwrapped (IterT m a)))
-> p (IterT m a) (f (IterT m a))
_Wrapped' = (IterT m a -> m (Either a (IterT m a)))
-> (m (Either a (IterT m a)) -> IterT m a)
-> Iso
     (IterT m a)
     (IterT m a)
     (m (Either a (IterT m a)))
     (m (Either a (IterT m a)))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso IterT m a -> m (Either a (IterT m a))
forall (m :: * -> *) a. IterT m a -> m (Either a (IterT m a))
runIterT m (Either a (IterT m a)) -> IterT m a
forall (m :: * -> *) a. m (Either a (IterT m a)) -> IterT m a
IterT
  {-# INLINE _Wrapped' #-}

-- * unordered-containers

-- | Use @'wrapping' 'HashMap.fromList'@. Unwrapping returns some permutation of the list.
instance (t ~ HashMap k' a', Hashable k, Eq k) => Rewrapped (HashMap k a) t
instance (Hashable k, Eq k) => Wrapped (HashMap k a) where
  type Unwrapped (HashMap k a) = [(k, a)]
  _Wrapped' :: p (Unwrapped (HashMap k a)) (f (Unwrapped (HashMap k a)))
-> p (HashMap k a) (f (HashMap k a))
_Wrapped' = (HashMap k a -> [(k, a)])
-> ([(k, a)] -> HashMap k a)
-> Iso (HashMap k a) (HashMap k a) [(k, a)] [(k, a)]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso HashMap k a -> [(k, a)]
forall k v. HashMap k v -> [(k, v)]
HashMap.toList [(k, a)] -> HashMap k a
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
HashMap.fromList
  {-# INLINE _Wrapped' #-}

-- | Use @'wrapping' 'HashSet.fromList'@. Unwrapping returns some permutation of the list.
instance (t ~ HashSet a', Hashable a, Eq a) => Rewrapped (HashSet a) t
instance (Hashable a, Eq a) => Wrapped (HashSet a) where
  type Unwrapped (HashSet a) = [a]
  _Wrapped' :: p (Unwrapped (HashSet a)) (f (Unwrapped (HashSet a)))
-> p (HashSet a) (f (HashSet a))
_Wrapped' = (HashSet a -> [a])
-> ([a] -> HashSet a) -> Iso (HashSet a) (HashSet a) [a] [a]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso HashSet a -> [a]
forall a. HashSet a -> [a]
HashSet.toList [a] -> HashSet a
forall a. (Eq a, Hashable a) => [a] -> HashSet a
HashSet.fromList
  {-# INLINE _Wrapped' #-}

-- * containers

-- | Use @'wrapping' 'IntMap.fromList'@. unwrapping returns a /sorted/ list.
instance (t ~ IntMap a') => Rewrapped (IntMap a) t
instance Wrapped (IntMap a) where
  type Unwrapped (IntMap a) = [(Int, a)]
  _Wrapped' :: p (Unwrapped (IntMap a)) (f (Unwrapped (IntMap a)))
-> p (IntMap a) (f (IntMap a))
_Wrapped' = (IntMap a -> [(Key, a)])
-> ([(Key, a)] -> IntMap a)
-> Iso (IntMap a) (IntMap a) [(Key, a)] [(Key, a)]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso IntMap a -> [(Key, a)]
forall a. IntMap a -> [(Key, a)]
IntMap.toAscList [(Key, a)] -> IntMap a
forall a. [(Key, a)] -> IntMap a
IntMap.fromList
  {-# INLINE _Wrapped' #-}

-- | Use @'wrapping' 'IntSet.fromList'@. unwrapping returns a /sorted/ list.
instance (t ~ IntSet) => Rewrapped IntSet t
instance Wrapped IntSet where
  type Unwrapped IntSet = [Int]
  _Wrapped' :: p (Unwrapped IntSet) (f (Unwrapped IntSet)) -> p IntSet (f IntSet)
_Wrapped' = (IntSet -> [Key])
-> ([Key] -> IntSet) -> Iso IntSet IntSet [Key] [Key]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso IntSet -> [Key]
IntSet.toAscList [Key] -> IntSet
IntSet.fromList
  {-# INLINE _Wrapped' #-}

-- | Use @'wrapping' 'Map.fromList'@. unwrapping returns a /sorted/ list.
instance (t ~ Map k' a', Ord k) => Rewrapped (Map k a) t
instance Ord k => Wrapped (Map k a) where
  type Unwrapped (Map k a) = [(k, a)]
  _Wrapped' :: p (Unwrapped (Map k a)) (f (Unwrapped (Map k a)))
-> p (Map k a) (f (Map k a))
_Wrapped' = (Map k a -> [(k, a)])
-> ([(k, a)] -> Map k a)
-> Iso (Map k a) (Map k a) [(k, a)] [(k, a)]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Map k a -> [(k, a)]
forall k a. Map k a -> [(k, a)]
Map.toAscList [(k, a)] -> Map k a
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
  {-# INLINE _Wrapped' #-}

-- | Use @'wrapping' 'Set.fromList'@. unwrapping returns a /sorted/ list.
instance (t ~ Set a', Ord a) => Rewrapped (Set a) t
instance Ord a => Wrapped (Set a) where
  type Unwrapped (Set a) = [a]
  _Wrapped' :: p (Unwrapped (Set a)) (f (Unwrapped (Set a)))
-> p (Set a) (f (Set a))
_Wrapped' = (Set a -> [a]) -> ([a] -> Set a) -> Iso (Set a) (Set a) [a] [a]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Set a -> [a]
forall a. Set a -> [a]
Set.toAscList [a] -> Set a
forall a. Ord a => [a] -> Set a
Set.fromList
  {-# INLINE _Wrapped' #-}

instance (t ~ Seq a') => Rewrapped (Seq a) t
instance Wrapped (Seq a) where
  type Unwrapped (Seq a) = [a]
  _Wrapped' :: p (Unwrapped (Seq a)) (f (Unwrapped (Seq a)))
-> p (Seq a) (f (Seq a))
_Wrapped' = (Seq a -> [a]) -> ([a] -> Seq a) -> Iso (Seq a) (Seq a) [a] [a]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
Foldable.toList [a] -> Seq a
forall a. [a] -> Seq a
Seq.fromList
  {-# INLINE _Wrapped' #-}

-- * profunctors

instance (t ~ Star f' d' c') => Rewrapped (Star f d c) t
instance Wrapped (Star f d c) where
  type Unwrapped (Star f d c) = d -> f c
  _Wrapped' :: p (Unwrapped (Star f d c)) (f (Unwrapped (Star f d c)))
-> p (Star f d c) (f (Star f d c))
_Wrapped' = (Star f d c -> d -> f c)
-> ((d -> f c) -> Star f d c)
-> Iso (Star f d c) (Star f d c) (d -> f c) (d -> f c)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Star f d c -> d -> f c
forall k (f :: k -> *) d (c :: k). Star f d c -> d -> f c
runStar (d -> f c) -> Star f d c
forall k (f :: k -> *) d (c :: k). (d -> f c) -> Star f d c
Star
  {-# INLINE _Wrapped' #-}

instance (t ~ Costar f' d' c') => Rewrapped (Costar f d c) t
instance Wrapped (Costar f d c) where
  type Unwrapped (Costar f d c) = f d -> c
  _Wrapped' :: p (Unwrapped (Costar f d c)) (f (Unwrapped (Costar f d c)))
-> p (Costar f d c) (f (Costar f d c))
_Wrapped' = (Costar f d c -> f d -> c)
-> ((f d -> c) -> Costar f d c)
-> Iso (Costar f d c) (Costar f d c) (f d -> c) (f d -> c)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Costar f d c -> f d -> c
forall k (f :: k -> *) (d :: k) c. Costar f d c -> f d -> c
runCostar (f d -> c) -> Costar f d c
forall k (f :: k -> *) (d :: k) c. (f d -> c) -> Costar f d c
Costar
  {-# INLINE _Wrapped' #-}

instance (t ~ Profunctor.WrappedArrow p' a' b') => Rewrapped (Profunctor.WrappedArrow p a b) t
instance Wrapped (Profunctor.WrappedArrow p a b) where
  type Unwrapped (Profunctor.WrappedArrow p a b) = p a b
  _Wrapped' :: p (Unwrapped (WrappedArrow p a b))
  (f (Unwrapped (WrappedArrow p a b)))
-> p (WrappedArrow p a b) (f (WrappedArrow p a b))
_Wrapped' = (WrappedArrow p a b -> p a b)
-> (p a b -> WrappedArrow p a b)
-> Iso (WrappedArrow p a b) (WrappedArrow p a b) (p a b) (p a b)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso WrappedArrow p a b -> p a b
forall k1 k2 (p :: k1 -> k2 -> *) (a :: k1) (b :: k2).
WrappedArrow p a b -> p a b
Profunctor.unwrapArrow p a b -> WrappedArrow p a b
forall k k1 (p :: k -> k1 -> *) (a :: k) (b :: k1).
p a b -> WrappedArrow p a b
Profunctor.WrapArrow
  {-# INLINE _Wrapped' #-}

instance (t ~ Forget r' a' b') => Rewrapped (Forget r a b) t
instance Wrapped (Forget r a b) where
  type Unwrapped (Forget r a b) = a -> r
  _Wrapped' :: p (Unwrapped (Forget r a b)) (f (Unwrapped (Forget r a b)))
-> p (Forget r a b) (f (Forget r a b))
_Wrapped' = (Forget r a b -> a -> r)
-> ((a -> r) -> Forget r a b)
-> Iso (Forget r a b) (Forget r a b) (a -> r) (a -> r)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Forget r a b -> a -> r
forall r a k (b :: k). Forget r a b -> a -> r
runForget (a -> r) -> Forget r a b
forall k r a (b :: k). (a -> r) -> Forget r a b
Forget
  {-# INLINE _Wrapped' #-}

instance (t ~ Cayley f' p' a' b') => Rewrapped (Cayley f p a b) t
instance Wrapped (Cayley f p a b) where
  type Unwrapped (Cayley f p a b) = f (p a b)
  _Wrapped' :: p (Unwrapped (Cayley f p a b)) (f (Unwrapped (Cayley f p a b)))
-> p (Cayley f p a b) (f (Cayley f p a b))
_Wrapped' = (Cayley f p a b -> f (p a b))
-> (f (p a b) -> Cayley f p a b)
-> Iso (Cayley f p a b) (Cayley f p a b) (f (p a b)) (f (p a b))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Cayley f p a b -> f (p a b)
forall k1 (f :: k1 -> *) k2 k3 (p :: k2 -> k3 -> k1) (a :: k2)
       (b :: k3).
Cayley f p a b -> f (p a b)
runCayley f (p a b) -> Cayley f p a b
forall k k1 k2 (f :: k -> *) (p :: k1 -> k2 -> k) (a :: k1)
       (b :: k2).
f (p a b) -> Cayley f p a b
Cayley
  {-# INLINE _Wrapped' #-}

-- * vector

instance (t ~ Vector.Vector a') => Rewrapped (Vector.Vector a) t
instance Wrapped (Vector.Vector a) where
  type Unwrapped (Vector.Vector a) = [a]
  _Wrapped' :: p (Unwrapped (Vector a)) (f (Unwrapped (Vector a)))
-> p (Vector a) (f (Vector a))
_Wrapped' = (Vector a -> [a])
-> ([a] -> Vector a) -> Iso (Vector a) (Vector a) [a] [a]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Vector a -> [a]
forall a. Vector a -> [a]
Vector.toList [a] -> Vector a
forall a. [a] -> Vector a
Vector.fromList
  {-# INLINE _Wrapped' #-}

instance (Prim a, t ~ Prim.Vector a') => Rewrapped (Prim.Vector a) t
instance Prim a => Wrapped (Prim.Vector a) where
  type Unwrapped (Prim.Vector a) = [a]
  _Wrapped' :: p (Unwrapped (Vector a)) (f (Unwrapped (Vector a)))
-> p (Vector a) (f (Vector a))
_Wrapped' = (Vector a -> [a])
-> ([a] -> Vector a) -> Iso (Vector a) (Vector a) [a] [a]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Vector a -> [a]
forall a. Prim a => Vector a -> [a]
Prim.toList [a] -> Vector a
forall a. Prim a => [a] -> Vector a
Prim.fromList
  {-# INLINE _Wrapped' #-}

instance (Unbox a, t ~ Unboxed.Vector a') => Rewrapped (Unboxed.Vector a) t
instance Unbox a => Wrapped (Unboxed.Vector a) where
  type Unwrapped (Unboxed.Vector a) = [a]
  _Wrapped' :: p (Unwrapped (Vector a)) (f (Unwrapped (Vector a)))
-> p (Vector a) (f (Vector a))
_Wrapped' = (Vector a -> [a])
-> ([a] -> Vector a) -> Iso (Vector a) (Vector a) [a] [a]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Vector a -> [a]
forall a. Unbox a => Vector a -> [a]
Unboxed.toList [a] -> Vector a
forall a. Unbox a => [a] -> Vector a
Unboxed.fromList
  {-# INLINE _Wrapped' #-}

instance (Storable a, t ~ Storable.Vector a') => Rewrapped (Storable.Vector a) t
instance Storable a => Wrapped (Storable.Vector a) where
  type Unwrapped (Storable.Vector a) = [a]
  _Wrapped' :: p (Unwrapped (Vector a)) (f (Unwrapped (Vector a)))
-> p (Vector a) (f (Vector a))
_Wrapped' = (Vector a -> [a])
-> ([a] -> Vector a) -> Iso (Vector a) (Vector a) [a] [a]
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Vector a -> [a]
forall a. Storable a => Vector a -> [a]
Storable.toList [a] -> Vector a
forall a. Storable a => [a] -> Vector a
Storable.fromList
  {-# INLINE _Wrapped' #-}

-- * semigroupoids

instance (t ~ WrappedApplicative f' a') => Rewrapped (WrappedApplicative f a) t
instance Wrapped (WrappedApplicative f a) where
  type Unwrapped (WrappedApplicative f a) = f a
  _Wrapped' :: p (Unwrapped (WrappedApplicative f a))
  (f (Unwrapped (WrappedApplicative f a)))
-> p (WrappedApplicative f a) (f (WrappedApplicative f a))
_Wrapped' = (WrappedApplicative f a -> f a)
-> (f a -> WrappedApplicative f a)
-> Iso
     (WrappedApplicative f a) (WrappedApplicative f a) (f a) (f a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso WrappedApplicative f a -> f a
forall (f :: * -> *) a. WrappedApplicative f a -> f a
unwrapApplicative f a -> WrappedApplicative f a
forall (f :: * -> *) a. f a -> WrappedApplicative f a
WrapApplicative
  {-# INLINE _Wrapped' #-}

instance (t ~ MaybeApply f' a') => Rewrapped (MaybeApply f a) t
instance Wrapped (MaybeApply f a) where
  type Unwrapped (MaybeApply f a) = Either (f a) a
  _Wrapped' :: p (Unwrapped (MaybeApply f a)) (f (Unwrapped (MaybeApply f a)))
-> p (MaybeApply f a) (f (MaybeApply f a))
_Wrapped' = (MaybeApply f a -> Either (f a) a)
-> (Either (f a) a -> MaybeApply f a)
-> Iso
     (MaybeApply f a) (MaybeApply f a) (Either (f a) a) (Either (f a) a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso MaybeApply f a -> Either (f a) a
forall (f :: * -> *) a. MaybeApply f a -> Either (f a) a
runMaybeApply Either (f a) a -> MaybeApply f a
forall (f :: * -> *) a. Either (f a) a -> MaybeApply f a
MaybeApply
  {-# INLINE _Wrapped' #-}

instance (t ~ WrappedCategory k' a' b') => Rewrapped (WrappedCategory k a b) t
instance Wrapped (WrappedCategory k a b) where
  type Unwrapped (WrappedCategory k a b) = k a b
  _Wrapped' :: p (Unwrapped (WrappedCategory k a b))
  (f (Unwrapped (WrappedCategory k a b)))
-> p (WrappedCategory k a b) (f (WrappedCategory k a b))
_Wrapped' = (WrappedCategory k a b -> k a b)
-> (k a b -> WrappedCategory k a b)
-> Iso
     (WrappedCategory k a b) (WrappedCategory k a b) (k a b) (k a b)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso WrappedCategory k a b -> k a b
forall k1 k2 (k3 :: k1 -> k2 -> *) (a :: k1) (b :: k2).
WrappedCategory k3 a b -> k3 a b
unwrapCategory k a b -> WrappedCategory k a b
forall k k1 (k2 :: k -> k1 -> *) (a :: k) (b :: k1).
k2 a b -> WrappedCategory k2 a b
WrapCategory
  {-# INLINE _Wrapped' #-}

instance (t ~ Semi m' a' b') => Rewrapped (Semi m a b) t
instance Wrapped (Semi m a b) where
  type Unwrapped (Semi m a b) = m
  _Wrapped' :: p (Unwrapped (Semi m a b)) (f (Unwrapped (Semi m a b)))
-> p (Semi m a b) (f (Semi m a b))
_Wrapped' = (Semi m a b -> m)
-> (m -> Semi m a b) -> Iso (Semi m a b) (Semi m a b) m m
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Semi m a b -> m
forall m k1 (a :: k1) k2 (b :: k2). Semi m a b -> m
getSemi m -> Semi m a b
forall k k1 m (a :: k) (b :: k1). m -> Semi m a b
Semi
  {-# INLINE _Wrapped' #-}

instance (t ~ Semigroupoid.Dual k' a' b') => Rewrapped (Semigroupoid.Dual k a b) t
instance Wrapped (Semigroupoid.Dual k a b) where
  type Unwrapped (Semigroupoid.Dual k a b) = k b a
  _Wrapped' :: p (Unwrapped (Dual k a b)) (f (Unwrapped (Dual k a b)))
-> p (Dual k a b) (f (Dual k a b))
_Wrapped' = (Dual k a b -> k b a)
-> (k b a -> Dual k a b)
-> Iso (Dual k a b) (Dual k a b) (k b a) (k b a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Dual k a b -> k b a
forall k1 k2 (k3 :: k2 -> k1 -> *) (a :: k1) (b :: k2).
Dual k3 a b -> k3 b a
Semigroupoid.getDual k b a -> Dual k a b
forall k k1 (k2 :: k -> k1 -> *) (a :: k1) (b :: k).
k2 b a -> Dual k2 a b
Semigroupoid.Dual
  {-# INLINE _Wrapped' #-}

instance (t ~ Static f' a' b') => Rewrapped (Static f a b) t
instance Wrapped (Static f a b) where
  type Unwrapped (Static f a b) = f (a -> b)
  _Wrapped' :: p (Unwrapped (Static f a b)) (f (Unwrapped (Static f a b)))
-> p (Static f a b) (f (Static f a b))
_Wrapped' = (Static f a b -> f (a -> b))
-> (f (a -> b) -> Static f a b)
-> Iso (Static f a b) (Static f a b) (f (a -> b)) (f (a -> b))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Static f a b -> f (a -> b)
forall (f :: * -> *) a b. Static f a b -> f (a -> b)
runStatic f (a -> b) -> Static f a b
forall (f :: * -> *) a b. f (a -> b) -> Static f a b
Static
  {-# INLINE _Wrapped' #-}

-- * semigroups

instance (t ~ S.Min b) => Rewrapped (S.Min a) t
instance Wrapped (S.Min a) where
  type Unwrapped (S.Min a) = a
  _Wrapped' :: p (Unwrapped (Min a)) (f (Unwrapped (Min a)))
-> p (Min a) (f (Min a))
_Wrapped' = (Min a -> a) -> (a -> Min a) -> Iso (Min a) (Min a) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Min a -> a
forall a. Min a -> a
S.getMin a -> Min a
forall a. a -> Min a
S.Min
  {-# INLINE _Wrapped' #-}

instance (t ~ S.Max b) => Rewrapped (S.Max a) t
instance Wrapped (S.Max a) where
  type Unwrapped (S.Max a) = a
  _Wrapped' :: p (Unwrapped (Max a)) (f (Unwrapped (Max a)))
-> p (Max a) (f (Max a))
_Wrapped' = (Max a -> a) -> (a -> Max a) -> Iso (Max a) (Max a) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Max a -> a
forall a. Max a -> a
S.getMax a -> Max a
forall a. a -> Max a
S.Max
  {-# INLINE _Wrapped' #-}

instance (t ~ S.First b) => Rewrapped (S.First a) t
instance Wrapped (S.First a) where
  type Unwrapped (S.First a) = a
  _Wrapped' :: p (Unwrapped (First a)) (f (Unwrapped (First a)))
-> p (First a) (f (First a))
_Wrapped' = (First a -> a) -> (a -> First a) -> Iso (First a) (First a) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso First a -> a
forall a. First a -> a
S.getFirst a -> First a
forall a. a -> First a
S.First
  {-# INLINE _Wrapped' #-}

instance (t ~ S.Last b) => Rewrapped (S.Last a) t
instance Wrapped (S.Last a) where
  type Unwrapped (S.Last a) = a
  _Wrapped' :: p (Unwrapped (Last a)) (f (Unwrapped (Last a)))
-> p (Last a) (f (Last a))
_Wrapped' = (Last a -> a) -> (a -> Last a) -> Iso (Last a) (Last a) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Last a -> a
forall a. Last a -> a
S.getLast a -> Last a
forall a. a -> Last a
S.Last
  {-# INLINE _Wrapped' #-}

instance (t ~ S.WrappedMonoid b) => Rewrapped (S.WrappedMonoid a) t
instance Wrapped (S.WrappedMonoid a) where
  type Unwrapped (S.WrappedMonoid a) = a
  _Wrapped' :: p (Unwrapped (WrappedMonoid a)) (f (Unwrapped (WrappedMonoid a)))
-> p (WrappedMonoid a) (f (WrappedMonoid a))
_Wrapped' = (WrappedMonoid a -> a)
-> (a -> WrappedMonoid a)
-> Iso (WrappedMonoid a) (WrappedMonoid a) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso WrappedMonoid a -> a
forall m. WrappedMonoid m -> m
S.unwrapMonoid a -> WrappedMonoid a
forall m. m -> WrappedMonoid m
S.WrapMonoid
  {-# INLINE _Wrapped' #-}

instance (t ~ S.Option b) => Rewrapped (S.Option a) t
instance Wrapped (S.Option a) where
  type Unwrapped (S.Option a) = Maybe a
  _Wrapped' :: p (Unwrapped (Option a)) (f (Unwrapped (Option a)))
-> p (Option a) (f (Option a))
_Wrapped' = (Option a -> Maybe a)
-> (Maybe a -> Option a)
-> Iso (Option a) (Option a) (Maybe a) (Maybe a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Option a -> Maybe a
forall a. Option a -> Maybe a
S.getOption Maybe a -> Option a
forall a. Maybe a -> Option a
S.Option
  {-# INLINE _Wrapped' #-}

-- * contravariant

instance (t ~ Predicate b) => Rewrapped (Predicate a) t
instance Wrapped (Predicate a) where
  type Unwrapped (Predicate a) = a -> Bool
  _Wrapped' :: p (Unwrapped (Predicate a)) (f (Unwrapped (Predicate a)))
-> p (Predicate a) (f (Predicate a))
_Wrapped' = (Predicate a -> a -> Bool)
-> ((a -> Bool) -> Predicate a)
-> Iso (Predicate a) (Predicate a) (a -> Bool) (a -> Bool)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Predicate a -> a -> Bool
forall a. Predicate a -> a -> Bool
getPredicate (a -> Bool) -> Predicate a
forall a. (a -> Bool) -> Predicate a
Predicate
  {-# INLINE _Wrapped' #-}

instance (t ~ Comparison b) => Rewrapped (Comparison a) t
instance Wrapped (Comparison a) where
  type Unwrapped (Comparison a) = a -> a -> Ordering
  _Wrapped' :: p (Unwrapped (Comparison a)) (f (Unwrapped (Comparison a)))
-> p (Comparison a) (f (Comparison a))
_Wrapped' = (Comparison a -> a -> a -> Ordering)
-> ((a -> a -> Ordering) -> Comparison a)
-> Iso
     (Comparison a)
     (Comparison a)
     (a -> a -> Ordering)
     (a -> a -> Ordering)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Comparison a -> a -> a -> Ordering
forall a. Comparison a -> a -> a -> Ordering
getComparison (a -> a -> Ordering) -> Comparison a
forall a. (a -> a -> Ordering) -> Comparison a
Comparison
  {-# INLINE _Wrapped' #-}

instance (t ~ Equivalence b) => Rewrapped (Equivalence a) t
instance Wrapped (Equivalence a) where
  type Unwrapped (Equivalence a) = a -> a -> Bool
  _Wrapped' :: p (Unwrapped (Equivalence a)) (f (Unwrapped (Equivalence a)))
-> p (Equivalence a) (f (Equivalence a))
_Wrapped' = (Equivalence a -> a -> a -> Bool)
-> ((a -> a -> Bool) -> Equivalence a)
-> Iso
     (Equivalence a) (Equivalence a) (a -> a -> Bool) (a -> a -> Bool)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Equivalence a -> a -> a -> Bool
forall a. Equivalence a -> a -> a -> Bool
getEquivalence (a -> a -> Bool) -> Equivalence a
forall a. (a -> a -> Bool) -> Equivalence a
Equivalence
  {-# INLINE _Wrapped' #-}

instance (t ~ Op a' b') => Rewrapped (Op a b) t
instance Wrapped (Op a b) where
  type Unwrapped (Op a b) = b -> a
  _Wrapped' :: p (Unwrapped (Op a b)) (f (Unwrapped (Op a b)))
-> p (Op a b) (f (Op a b))
_Wrapped' = (Op a b -> b -> a)
-> ((b -> a) -> Op a b) -> Iso (Op a b) (Op a b) (b -> a) (b -> a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Op a b -> b -> a
forall a b. Op a b -> b -> a
getOp (b -> a) -> Op a b
forall a b. (b -> a) -> Op a b
Op
  {-# INLINE _Wrapped' #-}

instance (t ~ Contravariant.Compose f' g' a') => Rewrapped (Contravariant.Compose f g a) t
instance Wrapped (Contravariant.Compose f g a) where
  type Unwrapped (Contravariant.Compose f g a) = f (g a)
  _Wrapped' :: p (Unwrapped (Compose f g a)) (f (Unwrapped (Compose f g a)))
-> p (Compose f g a) (f (Compose f g a))
_Wrapped' = (Compose f g a -> f (g a))
-> (f (g a) -> Compose f g a)
-> Iso (Compose f g a) (Compose f g a) (f (g a)) (f (g a))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Compose f g a -> f (g a)
forall (f :: * -> *) (g :: * -> *) a. Compose f g a -> f (g a)
Contravariant.getCompose f (g a) -> Compose f g a
forall (f :: * -> *) (g :: * -> *) a. f (g a) -> Compose f g a
Contravariant.Compose
  {-# INLINE _Wrapped' #-}

instance (t ~ Contravariant.ComposeFC f' g' a') => Rewrapped (Contravariant.ComposeFC f g a) t
instance Wrapped (Contravariant.ComposeFC f g a) where
  type Unwrapped (Contravariant.ComposeFC f g a) = f (g a)
  _Wrapped' :: p (Unwrapped (ComposeFC f g a)) (f (Unwrapped (ComposeFC f g a)))
-> p (ComposeFC f g a) (f (ComposeFC f g a))
_Wrapped' = (ComposeFC f g a -> f (g a))
-> (f (g a) -> ComposeFC f g a)
-> Iso (ComposeFC f g a) (ComposeFC f g a) (f (g a)) (f (g a))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ComposeFC f g a -> f (g a)
forall (f :: * -> *) (g :: * -> *) a. ComposeFC f g a -> f (g a)
Contravariant.getComposeFC f (g a) -> ComposeFC f g a
forall (f :: * -> *) (g :: * -> *) a. f (g a) -> ComposeFC f g a
Contravariant.ComposeFC
  {-# INLINE _Wrapped' #-}

instance (t ~ Contravariant.ComposeCF f' g' a') => Rewrapped (Contravariant.ComposeCF f g a) t
instance Wrapped (Contravariant.ComposeCF f g a) where
  type Unwrapped (Contravariant.ComposeCF f g a) = f (g a)
  _Wrapped' :: p (Unwrapped (ComposeCF f g a)) (f (Unwrapped (ComposeCF f g a)))
-> p (ComposeCF f g a) (f (ComposeCF f g a))
_Wrapped' = (ComposeCF f g a -> f (g a))
-> (f (g a) -> ComposeCF f g a)
-> Iso (ComposeCF f g a) (ComposeCF f g a) (f (g a)) (f (g a))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ComposeCF f g a -> f (g a)
forall (f :: * -> *) (g :: * -> *) a. ComposeCF f g a -> f (g a)
Contravariant.getComposeCF f (g a) -> ComposeCF f g a
forall (f :: * -> *) (g :: * -> *) a. f (g a) -> ComposeCF f g a
Contravariant.ComposeCF
  {-# INLINE _Wrapped' #-}

-- * tagged

instance (t ~ Tagged s' a') => Rewrapped (Tagged s a) t
instance Wrapped (Tagged s a) where
  type Unwrapped (Tagged s a) = a
  _Wrapped' :: p (Unwrapped (Tagged s a)) (f (Unwrapped (Tagged s a)))
-> p (Tagged s a) (f (Tagged s a))
_Wrapped' = (Tagged s a -> a)
-> (a -> Tagged s a) -> Iso (Tagged s a) (Tagged s a) a a
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Tagged s a -> a
forall k (s :: k) b. Tagged s b -> b
unTagged a -> Tagged s a
forall k (s :: k) b. b -> Tagged s b
Tagged
  {-# INLINE _Wrapped' #-}

-- * Control.Exception

instance (t ~ AssertionFailed) => Rewrapped AssertionFailed t
instance Wrapped AssertionFailed where
  type Unwrapped AssertionFailed = String
  _Wrapped' :: p (Unwrapped AssertionFailed) (f (Unwrapped AssertionFailed))
-> p AssertionFailed (f AssertionFailed)
_Wrapped' = (AssertionFailed -> String)
-> (String -> AssertionFailed)
-> Iso AssertionFailed AssertionFailed String String
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso AssertionFailed -> String
failedAssertion String -> AssertionFailed
AssertionFailed
  {-# INLINE _Wrapped' #-}

instance (t ~ NoMethodError) => Rewrapped NoMethodError t
instance Wrapped NoMethodError where
  type Unwrapped NoMethodError = String
  _Wrapped' :: p (Unwrapped NoMethodError) (f (Unwrapped NoMethodError))
-> p NoMethodError (f NoMethodError)
_Wrapped' = (NoMethodError -> String)
-> (String -> NoMethodError)
-> Iso NoMethodError NoMethodError String String
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso NoMethodError -> String
getNoMethodError String -> NoMethodError
NoMethodError
  {-# INLINE _Wrapped' #-}

instance (t ~ PatternMatchFail) => Rewrapped PatternMatchFail t
instance Wrapped PatternMatchFail where
  type Unwrapped PatternMatchFail = String
  _Wrapped' :: p (Unwrapped PatternMatchFail) (f (Unwrapped PatternMatchFail))
-> p PatternMatchFail (f PatternMatchFail)
_Wrapped' = (PatternMatchFail -> String)
-> (String -> PatternMatchFail)
-> Iso PatternMatchFail PatternMatchFail String String
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso PatternMatchFail -> String
getPatternMatchFail String -> PatternMatchFail
PatternMatchFail
  {-# INLINE _Wrapped' #-}

instance (t ~ RecConError) => Rewrapped RecConError t
instance Wrapped RecConError where
  type Unwrapped RecConError = String
  _Wrapped' :: p (Unwrapped RecConError) (f (Unwrapped RecConError))
-> p RecConError (f RecConError)
_Wrapped' = (RecConError -> String)
-> (String -> RecConError)
-> Iso RecConError RecConError String String
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso RecConError -> String
getRecConError String -> RecConError
RecConError
  {-# INLINE _Wrapped' #-}

instance (t ~ RecSelError) => Rewrapped RecSelError t
instance Wrapped RecSelError where
  type Unwrapped RecSelError = String
  _Wrapped' :: p (Unwrapped RecSelError) (f (Unwrapped RecSelError))
-> p RecSelError (f RecSelError)
_Wrapped' = (RecSelError -> String)
-> (String -> RecSelError)
-> Iso RecSelError RecSelError String String
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso RecSelError -> String
getRecSelError String -> RecSelError
RecSelError
  {-# INLINE _Wrapped' #-}

instance (t ~ RecUpdError) => Rewrapped RecUpdError t
instance Wrapped RecUpdError where
  type Unwrapped RecUpdError = String
  _Wrapped' :: p (Unwrapped RecUpdError) (f (Unwrapped RecUpdError))
-> p RecUpdError (f RecUpdError)
_Wrapped' = (RecUpdError -> String)
-> (String -> RecUpdError)
-> Iso RecUpdError RecUpdError String String
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso RecUpdError -> String
getRecUpdError String -> RecUpdError
RecUpdError
  {-# INLINE _Wrapped' #-}

instance (t ~ ErrorCall) => Rewrapped ErrorCall t
instance Wrapped ErrorCall where
  type Unwrapped ErrorCall = String
  _Wrapped' :: p (Unwrapped ErrorCall) (f (Unwrapped ErrorCall))
-> p ErrorCall (f ErrorCall)
_Wrapped' = (ErrorCall -> String)
-> (String -> ErrorCall) -> Iso ErrorCall ErrorCall String String
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso ErrorCall -> String
getErrorCall String -> ErrorCall
ErrorCall
  {-# INLINE _Wrapped' #-}

#if MIN_VERSION_base(4,9,0)
instance (t ~ TypeError) => Rewrapped TypeError t
instance Wrapped TypeError where
  type Unwrapped TypeError = String
  _Wrapped' :: p (Unwrapped TypeError) (f (Unwrapped TypeError))
-> p TypeError (f TypeError)
_Wrapped' = (TypeError -> String)
-> (String -> TypeError) -> Iso TypeError TypeError String String
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso TypeError -> String
getTypeError String -> TypeError
TypeError
  {-# INLINE _Wrapped' #-}

getTypeError :: TypeError -> String
getTypeError :: TypeError -> String
getTypeError (TypeError String
x) = String
x
{-# INLINE getTypeError #-}
#endif

#if MIN_VERSION_base(4,10,0)
instance (t ~ CompactionFailed) => Rewrapped CompactionFailed t
instance Wrapped CompactionFailed where
  type Unwrapped CompactionFailed = String
  _Wrapped' :: p (Unwrapped CompactionFailed) (f (Unwrapped CompactionFailed))
-> p CompactionFailed (f CompactionFailed)
_Wrapped' = (CompactionFailed -> String)
-> (String -> CompactionFailed)
-> Iso CompactionFailed CompactionFailed String String
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso CompactionFailed -> String
getCompactionFailed String -> CompactionFailed
CompactionFailed
  {-# INLINE _Wrapped' #-}

getCompactionFailed :: CompactionFailed -> String
getCompactionFailed :: CompactionFailed -> String
getCompactionFailed (CompactionFailed String
x) = String
x
{-# INLINE getCompactionFailed #-}
#endif

getErrorCall :: ErrorCall -> String
#if __GLASGOW_HASKELL__ < 800
getErrorCall (ErrorCall x) = x
#else
getErrorCall :: ErrorCall -> String
getErrorCall (ErrorCallWithLocation String
x String
_) = String
x
#endif
{-# INLINE getErrorCall #-}

getRecUpdError :: RecUpdError -> String
getRecUpdError :: RecUpdError -> String
getRecUpdError (RecUpdError String
x) = String
x
{-# INLINE getRecUpdError #-}

getRecSelError :: RecSelError -> String
getRecSelError :: RecSelError -> String
getRecSelError (RecSelError String
x) = String
x
{-# INLINE getRecSelError #-}

getRecConError :: RecConError -> String
getRecConError :: RecConError -> String
getRecConError (RecConError String
x) = String
x
{-# INLINE getRecConError #-}

getPatternMatchFail :: PatternMatchFail -> String
getPatternMatchFail :: PatternMatchFail -> String
getPatternMatchFail (PatternMatchFail String
x) = String
x
{-# INLINE getPatternMatchFail #-}

getNoMethodError :: NoMethodError -> String
getNoMethodError :: NoMethodError -> String
getNoMethodError (NoMethodError String
x) = String
x
{-# INLINE getNoMethodError #-}

failedAssertion :: AssertionFailed -> String
failedAssertion :: AssertionFailed -> String
failedAssertion (AssertionFailed String
x) = String
x
{-# INLINE failedAssertion #-}

-- * Foreign.C.Types

instance Rewrapped CChar t
instance Wrapped CChar where
  type Unwrapped CChar = HTYPE_CHAR
  _Wrapped' :: p (Unwrapped CChar) (f (Unwrapped CChar)) -> p CChar (f CChar)
_Wrapped' = (CChar -> Int8) -> (Int8 -> CChar) -> Iso CChar CChar Int8 Int8
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CChar Int8
x) -> Int8
x) Int8 -> CChar
CChar
  {-# INLINE _Wrapped' #-}

instance Rewrapped CSChar t
instance Wrapped CSChar where
  type Unwrapped CSChar = HTYPE_SIGNED_CHAR
  _Wrapped' :: p (Unwrapped CSChar) (f (Unwrapped CSChar)) -> p CSChar (f CSChar)
_Wrapped' = (CSChar -> Int8) -> (Int8 -> CSChar) -> Iso CSChar CSChar Int8 Int8
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CSChar Int8
x) -> Int8
x) Int8 -> CSChar
CSChar
  {-# INLINE _Wrapped' #-}

instance Rewrapped CUChar t
instance Wrapped CUChar where
  type Unwrapped CUChar = HTYPE_UNSIGNED_CHAR
  _Wrapped' :: p (Unwrapped CUChar) (f (Unwrapped CUChar)) -> p CUChar (f CUChar)
_Wrapped' = (CUChar -> Word8)
-> (Word8 -> CUChar) -> Iso CUChar CUChar Word8 Word8
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CUChar Word8
x) -> Word8
x) Word8 -> CUChar
CUChar
  {-# INLINE _Wrapped' #-}

instance Rewrapped CShort t
instance Wrapped CShort where
  type Unwrapped CShort = HTYPE_SHORT
  _Wrapped' :: p (Unwrapped CShort) (f (Unwrapped CShort)) -> p CShort (f CShort)
_Wrapped' = (CShort -> Int16)
-> (Int16 -> CShort) -> Iso CShort CShort Int16 Int16
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CShort Int16
x) -> Int16
x) Int16 -> CShort
CShort
  {-# INLINE _Wrapped' #-}

instance Rewrapped CUShort t
instance Wrapped CUShort where
  type Unwrapped CUShort = HTYPE_UNSIGNED_SHORT
  _Wrapped' :: p (Unwrapped CUShort) (f (Unwrapped CUShort))
-> p CUShort (f CUShort)
_Wrapped' = (CUShort -> Word16)
-> (Word16 -> CUShort) -> Iso CUShort CUShort Word16 Word16
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CUShort Word16
x) -> Word16
x) Word16 -> CUShort
CUShort
  {-# INLINE _Wrapped' #-}

instance Rewrapped CInt t
instance Wrapped CInt where
  type Unwrapped CInt = HTYPE_INT
  _Wrapped' :: p (Unwrapped CInt) (f (Unwrapped CInt)) -> p CInt (f CInt)
_Wrapped' = (CInt -> Int32) -> (Int32 -> CInt) -> Iso CInt CInt Int32 Int32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CInt Int32
x) -> Int32
x) Int32 -> CInt
CInt
  {-# INLINE _Wrapped' #-}

instance Rewrapped CUInt t
instance Wrapped CUInt where
  type Unwrapped CUInt = HTYPE_UNSIGNED_INT
  _Wrapped' :: p (Unwrapped CUInt) (f (Unwrapped CUInt)) -> p CUInt (f CUInt)
_Wrapped' = (CUInt -> Word32)
-> (Word32 -> CUInt) -> Iso CUInt CUInt Word32 Word32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CUInt Word32
x) -> Word32
x) Word32 -> CUInt
CUInt
  {-# INLINE _Wrapped' #-}

instance Rewrapped CLong t
instance Wrapped CLong where
  type Unwrapped CLong = HTYPE_LONG
  _Wrapped' :: p (Unwrapped CLong) (f (Unwrapped CLong)) -> p CLong (f CLong)
_Wrapped' = (CLong -> Int64) -> (Int64 -> CLong) -> Iso CLong CLong Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CLong Int64
x) -> Int64
x) Int64 -> CLong
CLong
  {-# INLINE _Wrapped' #-}

instance Rewrapped CULong t
instance Wrapped CULong where
  type Unwrapped CULong = HTYPE_UNSIGNED_LONG
  _Wrapped' :: p (Unwrapped CULong) (f (Unwrapped CULong)) -> p CULong (f CULong)
_Wrapped' = (CULong -> Word64)
-> (Word64 -> CULong) -> Iso CULong CULong Word64 Word64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CULong Word64
x) -> Word64
x) Word64 -> CULong
CULong
  {-# INLINE _Wrapped' #-}

instance Rewrapped CLLong t
instance Wrapped CLLong where
  type Unwrapped CLLong = HTYPE_LONG_LONG
  _Wrapped' :: p (Unwrapped CLLong) (f (Unwrapped CLLong)) -> p CLLong (f CLLong)
_Wrapped' = (CLLong -> Int64)
-> (Int64 -> CLLong) -> Iso CLLong CLLong Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CLLong Int64
x) -> Int64
x) Int64 -> CLLong
CLLong
  {-# INLINE _Wrapped' #-}

instance Rewrapped CULLong t
instance Wrapped CULLong where
  type Unwrapped CULLong = HTYPE_UNSIGNED_LONG_LONG
  _Wrapped' :: p (Unwrapped CULLong) (f (Unwrapped CULLong))
-> p CULLong (f CULLong)
_Wrapped' = (CULLong -> Word64)
-> (Word64 -> CULLong) -> Iso CULLong CULLong Word64 Word64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CULLong Word64
x) -> Word64
x) Word64 -> CULLong
CULLong
  {-# INLINE _Wrapped' #-}

instance Rewrapped CFloat t
instance Wrapped CFloat where
  type Unwrapped CFloat = HTYPE_FLOAT
  _Wrapped' :: p (Unwrapped CFloat) (f (Unwrapped CFloat)) -> p CFloat (f CFloat)
_Wrapped' = (CFloat -> Float)
-> (Float -> CFloat) -> Iso CFloat CFloat Float Float
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CFloat Float
x) -> Float
x) Float -> CFloat
CFloat
  {-# INLINE _Wrapped' #-}

instance Rewrapped CDouble t
instance Wrapped CDouble where
  type Unwrapped CDouble = HTYPE_DOUBLE
  _Wrapped' :: p (Unwrapped CDouble) (f (Unwrapped CDouble))
-> p CDouble (f CDouble)
_Wrapped' = (CDouble -> Double)
-> (Double -> CDouble) -> Iso CDouble CDouble Double Double
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CDouble Double
x) -> Double
x) Double -> CDouble
CDouble
  {-# INLINE _Wrapped' #-}

instance Rewrapped CPtrdiff t
instance Wrapped CPtrdiff where
  type Unwrapped CPtrdiff = HTYPE_PTRDIFF_T
  _Wrapped' :: p (Unwrapped CPtrdiff) (f (Unwrapped CPtrdiff))
-> p CPtrdiff (f CPtrdiff)
_Wrapped' = (CPtrdiff -> Int64)
-> (Int64 -> CPtrdiff) -> Iso CPtrdiff CPtrdiff Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CPtrdiff Int64
x) -> Int64
x) Int64 -> CPtrdiff
CPtrdiff
  {-# INLINE _Wrapped' #-}

instance Rewrapped CSize t
instance Wrapped CSize where
  type Unwrapped CSize = HTYPE_SIZE_T
  _Wrapped' :: p (Unwrapped CSize) (f (Unwrapped CSize)) -> p CSize (f CSize)
_Wrapped' = (CSize -> Word64)
-> (Word64 -> CSize) -> Iso CSize CSize Word64 Word64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CSize Word64
x) -> Word64
x) Word64 -> CSize
CSize
  {-# INLINE _Wrapped' #-}

instance Rewrapped CWchar t
instance Wrapped CWchar where
  type Unwrapped CWchar = HTYPE_WCHAR_T
  _Wrapped' :: p (Unwrapped CWchar) (f (Unwrapped CWchar)) -> p CWchar (f CWchar)
_Wrapped' = (CWchar -> Int32)
-> (Int32 -> CWchar) -> Iso CWchar CWchar Int32 Int32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CWchar Int32
x) -> Int32
x) Int32 -> CWchar
CWchar
  {-# INLINE _Wrapped' #-}

instance Rewrapped CSigAtomic t
instance Wrapped CSigAtomic where
  type Unwrapped CSigAtomic = HTYPE_SIG_ATOMIC_T
  _Wrapped' :: p (Unwrapped CSigAtomic) (f (Unwrapped CSigAtomic))
-> p CSigAtomic (f CSigAtomic)
_Wrapped' = (CSigAtomic -> Int32)
-> (Int32 -> CSigAtomic) -> Iso CSigAtomic CSigAtomic Int32 Int32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CSigAtomic Int32
x) -> Int32
x) Int32 -> CSigAtomic
CSigAtomic
  {-# INLINE _Wrapped' #-}

instance Rewrapped CClock t
instance Wrapped CClock where
  type Unwrapped CClock = HTYPE_CLOCK_T
  _Wrapped' :: p (Unwrapped CClock) (f (Unwrapped CClock)) -> p CClock (f CClock)
_Wrapped' = (CClock -> Int64)
-> (Int64 -> CClock) -> Iso CClock CClock Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CClock Int64
x) -> Int64
x) Int64 -> CClock
CClock
  {-# INLINE _Wrapped' #-}

instance Rewrapped CTime t
instance Wrapped CTime where
  type Unwrapped CTime = HTYPE_TIME_T
  _Wrapped' :: p (Unwrapped CTime) (f (Unwrapped CTime)) -> p CTime (f CTime)
_Wrapped' = (CTime -> Int64) -> (Int64 -> CTime) -> Iso CTime CTime Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CTime Int64
x) -> Int64
x) Int64 -> CTime
CTime
  {-# INLINE _Wrapped' #-}

instance Rewrapped CUSeconds t
instance Wrapped CUSeconds where
  type Unwrapped CUSeconds = HTYPE_USECONDS_T
  _Wrapped' :: p (Unwrapped CUSeconds) (f (Unwrapped CUSeconds))
-> p CUSeconds (f CUSeconds)
_Wrapped' = (CUSeconds -> Word32)
-> (Word32 -> CUSeconds) -> Iso CUSeconds CUSeconds Word32 Word32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CUSeconds Word32
x) -> Word32
x) Word32 -> CUSeconds
CUSeconds
  {-# INLINE _Wrapped' #-}

instance Rewrapped CSUSeconds t
instance Wrapped CSUSeconds where
  type Unwrapped CSUSeconds = HTYPE_SUSECONDS_T
  _Wrapped' :: p (Unwrapped CSUSeconds) (f (Unwrapped CSUSeconds))
-> p CSUSeconds (f CSUSeconds)
_Wrapped' = (CSUSeconds -> Int64)
-> (Int64 -> CSUSeconds) -> Iso CSUSeconds CSUSeconds Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CSUSeconds Int64
x) -> Int64
x) Int64 -> CSUSeconds
CSUSeconds
  {-# INLINE _Wrapped' #-}

instance Rewrapped CIntPtr t
instance Wrapped CIntPtr where
  type Unwrapped CIntPtr = HTYPE_INTPTR_T
  _Wrapped' :: p (Unwrapped CIntPtr) (f (Unwrapped CIntPtr))
-> p CIntPtr (f CIntPtr)
_Wrapped' = (CIntPtr -> Int64)
-> (Int64 -> CIntPtr) -> Iso CIntPtr CIntPtr Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CIntPtr Int64
x) -> Int64
x) Int64 -> CIntPtr
CIntPtr
  {-# INLINE _Wrapped' #-}

instance Rewrapped CUIntPtr t
instance Wrapped CUIntPtr where
  type Unwrapped CUIntPtr = HTYPE_UINTPTR_T
  _Wrapped' :: p (Unwrapped CUIntPtr) (f (Unwrapped CUIntPtr))
-> p CUIntPtr (f CUIntPtr)
_Wrapped' = (CUIntPtr -> Word64)
-> (Word64 -> CUIntPtr) -> Iso CUIntPtr CUIntPtr Word64 Word64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CUIntPtr Word64
x) -> Word64
x) Word64 -> CUIntPtr
CUIntPtr
  {-# INLINE _Wrapped' #-}

instance Rewrapped CIntMax t
instance Wrapped CIntMax where
  type Unwrapped CIntMax = HTYPE_INTMAX_T
  _Wrapped' :: p (Unwrapped CIntMax) (f (Unwrapped CIntMax))
-> p CIntMax (f CIntMax)
_Wrapped' = (CIntMax -> Int64)
-> (Int64 -> CIntMax) -> Iso CIntMax CIntMax Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CIntMax Int64
x) -> Int64
x) Int64 -> CIntMax
CIntMax
  {-# INLINE _Wrapped' #-}

instance Rewrapped CUIntMax t
instance Wrapped CUIntMax where
  type Unwrapped CUIntMax = HTYPE_UINTMAX_T
  _Wrapped' :: p (Unwrapped CUIntMax) (f (Unwrapped CUIntMax))
-> p CUIntMax (f CUIntMax)
_Wrapped' = (CUIntMax -> Word64)
-> (Word64 -> CUIntMax) -> Iso CUIntMax CUIntMax Word64 Word64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CUIntMax Word64
x) -> Word64
x) Word64 -> CUIntMax
CUIntMax
  {-# INLINE _Wrapped' #-}

-- * GHC.Generics

instance (t ~ Par1 p') => Rewrapped (Par1 p) t
instance Wrapped (Par1 p) where
  type Unwrapped (Par1 p) = p
  _Wrapped' :: p (Unwrapped (Par1 p)) (f (Unwrapped (Par1 p)))
-> p (Par1 p) (f (Par1 p))
_Wrapped' = (Par1 p -> p) -> (p -> Par1 p) -> Iso (Par1 p) (Par1 p) p p
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Par1 p -> p
forall p. Par1 p -> p
unPar1 p -> Par1 p
forall p. p -> Par1 p
Par1
  {-# INLINE _Wrapped' #-}

instance (t ~ Rec1 f' p') => Rewrapped (Rec1 f p) t
instance Wrapped (Rec1 f p) where
  type Unwrapped (Rec1 f p) = f p
  _Wrapped' :: p (Unwrapped (Rec1 f p)) (f (Unwrapped (Rec1 f p)))
-> p (Rec1 f p) (f (Rec1 f p))
_Wrapped' = (Rec1 f p -> f p)
-> (f p -> Rec1 f p) -> Iso (Rec1 f p) (Rec1 f p) (f p) (f p)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Rec1 f p -> f p
forall k (f :: k -> *) (p :: k). Rec1 f p -> f p
unRec1 f p -> Rec1 f p
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Rec1
  {-# INLINE _Wrapped' #-}

instance (t ~ K1 i' c' p') => Rewrapped (K1 i c p) t
instance Wrapped (K1 i c p) where
  type Unwrapped (K1 i c p) = c
  _Wrapped' :: p (Unwrapped (K1 i c p)) (f (Unwrapped (K1 i c p)))
-> p (K1 i c p) (f (K1 i c p))
_Wrapped' = (K1 i c p -> c) -> (c -> K1 i c p) -> Iso (K1 i c p) (K1 i c p) c c
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso K1 i c p -> c
forall i c k (p :: k). K1 i c p -> c
unK1 c -> K1 i c p
forall k i c (p :: k). c -> K1 i c p
K1
  {-# INLINE _Wrapped' #-}

instance (t ~ M1 i' c' f' p') => Rewrapped (M1 i c f p) t
instance Wrapped (M1 i c f p) where
  type Unwrapped (M1 i c f p) = f p
  _Wrapped' :: p (Unwrapped (M1 i c f p)) (f (Unwrapped (M1 i c f p)))
-> p (M1 i c f p) (f (M1 i c f p))
_Wrapped' = (M1 i c f p -> f p)
-> (f p -> M1 i c f p) -> Iso (M1 i c f p) (M1 i c f p) (f p) (f p)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso M1 i c f p -> f p
forall i (c :: Meta) k (f :: k -> *) (p :: k). M1 i c f p -> f p
unM1 f p -> M1 i c f p
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1
  {-# INLINE _Wrapped' #-}

instance (t ~ (f' :.: g') p') => Rewrapped ((f :.: g) p) t
instance Wrapped ((f :.: g) p) where
  type Unwrapped ((f :.: g) p) = f (g p)
  _Wrapped' :: p (Unwrapped ((:.:) f g p)) (f (Unwrapped ((:.:) f g p)))
-> p ((:.:) f g p) (f ((:.:) f g p))
_Wrapped' = ((:.:) f g p -> f (g p))
-> (f (g p) -> (:.:) f g p)
-> Iso ((:.:) f g p) ((:.:) f g p) (f (g p)) (f (g p))
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (:.:) f g p -> f (g p)
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
(:.:) f g p -> f (g p)
unComp1 f (g p) -> (:.:) f g p
forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
f (g p) -> (:.:) f g p
Comp1
  {-# INLINE _Wrapped' #-}

-- * System.Posix.Types

#if defined(HTYPE_DEV_T)
instance Rewrapped CDev t
instance Wrapped CDev where
  type Unwrapped CDev = HTYPE_DEV_T
  _Wrapped' :: p (Unwrapped CDev) (f (Unwrapped CDev)) -> p CDev (f CDev)
_Wrapped' = (CDev -> Word64) -> (Word64 -> CDev) -> Iso CDev CDev Word64 Word64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CDev Word64
x) -> Word64
x) Word64 -> CDev
CDev
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_INO_T)
instance Rewrapped CIno t
instance Wrapped CIno where
  type Unwrapped CIno = HTYPE_INO_T
  _Wrapped' :: p (Unwrapped CIno) (f (Unwrapped CIno)) -> p CIno (f CIno)
_Wrapped' = (CIno -> Word64) -> (Word64 -> CIno) -> Iso CIno CIno Word64 Word64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CIno Word64
x) -> Word64
x) Word64 -> CIno
CIno
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_MODE_T)
instance Rewrapped CMode t
instance Wrapped CMode where
  type Unwrapped CMode = HTYPE_MODE_T
  _Wrapped' :: p (Unwrapped CMode) (f (Unwrapped CMode)) -> p CMode (f CMode)
_Wrapped' = (CMode -> Word32)
-> (Word32 -> CMode) -> Iso CMode CMode Word32 Word32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CMode Word32
x) -> Word32
x) Word32 -> CMode
CMode
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_OFF_T)
instance Rewrapped COff t
instance Wrapped COff where
  type Unwrapped COff = HTYPE_OFF_T
  _Wrapped' :: p (Unwrapped COff) (f (Unwrapped COff)) -> p COff (f COff)
_Wrapped' = (COff -> Int64) -> (Int64 -> COff) -> Iso COff COff Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(COff Int64
x) -> Int64
x) Int64 -> COff
COff
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_PID_T)
instance Rewrapped CPid t
instance Wrapped CPid where
  type Unwrapped CPid = HTYPE_PID_T
  _Wrapped' :: p (Unwrapped CPid) (f (Unwrapped CPid)) -> p CPid (f CPid)
_Wrapped' = (CPid -> Int32) -> (Int32 -> CPid) -> Iso CPid CPid Int32 Int32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CPid Int32
x) -> Int32
x) Int32 -> CPid
CPid
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_SSIZE_T)
instance Rewrapped CSsize t
instance Wrapped CSsize where
  type Unwrapped CSsize = HTYPE_SSIZE_T
  _Wrapped' :: p (Unwrapped CSsize) (f (Unwrapped CSsize)) -> p CSsize (f CSsize)
_Wrapped' = (CSsize -> Int64)
-> (Int64 -> CSsize) -> Iso CSsize CSsize Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CSsize Int64
x) -> Int64
x) Int64 -> CSsize
CSsize
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_GID_T)
instance Rewrapped CGid t
instance Wrapped CGid where
  type Unwrapped CGid = HTYPE_GID_T
  _Wrapped' :: p (Unwrapped CGid) (f (Unwrapped CGid)) -> p CGid (f CGid)
_Wrapped' = (CGid -> Word32) -> (Word32 -> CGid) -> Iso CGid CGid Word32 Word32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CGid Word32
x) -> Word32
x) Word32 -> CGid
CGid
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_NLINK_T)
instance Rewrapped CNlink t
instance Wrapped CNlink where
  type Unwrapped CNlink = HTYPE_NLINK_T
  _Wrapped' :: p (Unwrapped CNlink) (f (Unwrapped CNlink)) -> p CNlink (f CNlink)
_Wrapped' = (CNlink -> Word64)
-> (Word64 -> CNlink) -> Iso CNlink CNlink Word64 Word64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CNlink Word64
x) -> Word64
x) Word64 -> CNlink
CNlink
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_UID_T)
instance Rewrapped CUid t
instance Wrapped CUid where
  type Unwrapped CUid = HTYPE_UID_T
  _Wrapped' :: p (Unwrapped CUid) (f (Unwrapped CUid)) -> p CUid (f CUid)
_Wrapped' = (CUid -> Word32) -> (Word32 -> CUid) -> Iso CUid CUid Word32 Word32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CUid Word32
x) -> Word32
x) Word32 -> CUid
CUid
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_CC_T)
instance Rewrapped CCc t
instance Wrapped CCc where
  type Unwrapped CCc = HTYPE_CC_T
  _Wrapped' :: p (Unwrapped CCc) (f (Unwrapped CCc)) -> p CCc (f CCc)
_Wrapped' = (CCc -> Word8) -> (Word8 -> CCc) -> Iso CCc CCc Word8 Word8
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CCc Word8
x) -> Word8
x) Word8 -> CCc
CCc
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_SPEED_T)
instance Rewrapped CSpeed t
instance Wrapped CSpeed where
  type Unwrapped CSpeed = HTYPE_SPEED_T
  _Wrapped' :: p (Unwrapped CSpeed) (f (Unwrapped CSpeed)) -> p CSpeed (f CSpeed)
_Wrapped' = (CSpeed -> Word32)
-> (Word32 -> CSpeed) -> Iso CSpeed CSpeed Word32 Word32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CSpeed Word32
x) -> Word32
x) Word32 -> CSpeed
CSpeed
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_TCFLAG_T)
instance Rewrapped CTcflag t
instance Wrapped CTcflag where
  type Unwrapped CTcflag = HTYPE_TCFLAG_T
  _Wrapped' :: p (Unwrapped CTcflag) (f (Unwrapped CTcflag))
-> p CTcflag (f CTcflag)
_Wrapped' = (CTcflag -> Word32)
-> (Word32 -> CTcflag) -> Iso CTcflag CTcflag Word32 Word32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CTcflag Word32
x) -> Word32
x) Word32 -> CTcflag
CTcflag
  {-# INLINE _Wrapped' #-}
#endif

#if defined(HTYPE_RLIM_T)
instance Rewrapped CRLim t
instance Wrapped CRLim where
  type Unwrapped CRLim = HTYPE_RLIM_T
  _Wrapped' :: p (Unwrapped CRLim) (f (Unwrapped CRLim)) -> p CRLim (f CRLim)
_Wrapped' = (CRLim -> Word64)
-> (Word64 -> CRLim) -> Iso CRLim CRLim Word64 Word64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CRLim Word64
x) -> Word64
x) Word64 -> CRLim
CRLim
  {-# INLINE _Wrapped' #-}
#endif

instance Rewrapped Fd t
instance Wrapped Fd where
  type Unwrapped Fd = CInt
  _Wrapped' :: p (Unwrapped Fd) (f (Unwrapped Fd)) -> p Fd (f Fd)
_Wrapped' = (Fd -> CInt) -> (CInt -> Fd) -> Iso Fd Fd CInt CInt
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(Fd CInt
x) -> CInt
x) CInt -> Fd
Fd
  {-# INLINE _Wrapped' #-}

#if MIN_VERSION_base(4,10,0)
instance Rewrapped CBool t
instance Wrapped CBool where
  type Unwrapped CBool = HTYPE_BOOL
  _Wrapped' :: p (Unwrapped CBool) (f (Unwrapped CBool)) -> p CBool (f CBool)
_Wrapped' = (CBool -> Word8) -> (Word8 -> CBool) -> Iso CBool CBool Word8 Word8
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CBool Word8
x) -> Word8
x) Word8 -> CBool
CBool
  {-# INLINE _Wrapped' #-}

# if defined(HTYPE_BLKSIZE_T)
instance Rewrapped CBlkSize t
instance Wrapped CBlkSize where
  type Unwrapped CBlkSize = HTYPE_BLKSIZE_T
  _Wrapped' :: p (Unwrapped CBlkSize) (f (Unwrapped CBlkSize))
-> p CBlkSize (f CBlkSize)
_Wrapped' = (CBlkSize -> Int64)
-> (Int64 -> CBlkSize) -> Iso CBlkSize CBlkSize Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CBlkSize Int64
x) -> Int64
x) Int64 -> CBlkSize
CBlkSize
  {-# INLINE _Wrapped' #-}
# endif

# if defined(HTYPE_BLKCNT_T)
instance Rewrapped CBlkCnt t
instance Wrapped CBlkCnt where
  type Unwrapped CBlkCnt = HTYPE_BLKCNT_T
  _Wrapped' :: p (Unwrapped CBlkCnt) (f (Unwrapped CBlkCnt))
-> p CBlkCnt (f CBlkCnt)
_Wrapped' = (CBlkCnt -> Int64)
-> (Int64 -> CBlkCnt) -> Iso CBlkCnt CBlkCnt Int64 Int64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CBlkCnt Int64
x) -> Int64
x) Int64 -> CBlkCnt
CBlkCnt
  {-# INLINE _Wrapped' #-}
# endif

# if defined(HTYPE_CLOCKID_T)
instance Rewrapped CClockId t
instance Wrapped CClockId where
  type Unwrapped CClockId = HTYPE_CLOCKID_T
  _Wrapped' :: p (Unwrapped CClockId) (f (Unwrapped CClockId))
-> p CClockId (f CClockId)
_Wrapped' = (CClockId -> Int32)
-> (Int32 -> CClockId) -> Iso CClockId CClockId Int32 Int32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CClockId Int32
x) -> Int32
x) Int32 -> CClockId
CClockId
  {-# INLINE _Wrapped' #-}
# endif

# if defined(HTYPE_FSBLKCNT_T)
instance Rewrapped CFsBlkCnt t
instance Wrapped CFsBlkCnt where
  type Unwrapped CFsBlkCnt = HTYPE_FSBLKCNT_T
  _Wrapped' :: p (Unwrapped CFsBlkCnt) (f (Unwrapped CFsBlkCnt))
-> p CFsBlkCnt (f CFsBlkCnt)
_Wrapped' = (CFsBlkCnt -> Word64)
-> (Word64 -> CFsBlkCnt) -> Iso CFsBlkCnt CFsBlkCnt Word64 Word64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CFsBlkCnt Word64
x) -> Word64
x) Word64 -> CFsBlkCnt
CFsBlkCnt
  {-# INLINE _Wrapped' #-}
# endif

# if defined(HTYPE_FSFILCNT_T)
instance Rewrapped CFsFilCnt t
instance Wrapped CFsFilCnt where
  type Unwrapped CFsFilCnt = HTYPE_FSFILCNT_T
  _Wrapped' :: p (Unwrapped CFsFilCnt) (f (Unwrapped CFsFilCnt))
-> p CFsFilCnt (f CFsFilCnt)
_Wrapped' = (CFsFilCnt -> Word64)
-> (Word64 -> CFsFilCnt) -> Iso CFsFilCnt CFsFilCnt Word64 Word64
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CFsFilCnt Word64
x) -> Word64
x) Word64 -> CFsFilCnt
CFsFilCnt
  {-# INLINE _Wrapped' #-}
# endif

# if defined(HTYPE_ID_T)
instance Rewrapped CId t
instance Wrapped CId where
  type Unwrapped CId = HTYPE_ID_T
  _Wrapped' :: p (Unwrapped CId) (f (Unwrapped CId)) -> p CId (f CId)
_Wrapped' = (CId -> Word32) -> (Word32 -> CId) -> Iso CId CId Word32 Word32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CId Word32
x) -> Word32
x) Word32 -> CId
CId
  {-# INLINE _Wrapped' #-}
# endif

# if defined(HTYPE_KEY_T)
instance Rewrapped CKey t
instance Wrapped CKey where
  type Unwrapped CKey = HTYPE_KEY_T
  _Wrapped' :: p (Unwrapped CKey) (f (Unwrapped CKey)) -> p CKey (f CKey)
_Wrapped' = (CKey -> Int32) -> (Int32 -> CKey) -> Iso CKey CKey Int32 Int32
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CKey Int32
x) -> Int32
x) Int32 -> CKey
CKey
  {-# INLINE _Wrapped' #-}
# endif

# if defined(HTYPE_TIMER_T)
instance Rewrapped CTimer t
instance Wrapped CTimer where
  type Unwrapped CTimer = HTYPE_TIMER_T
  _Wrapped' :: p (Unwrapped CTimer) (f (Unwrapped CTimer)) -> p CTimer (f CTimer)
_Wrapped' = (CTimer -> Ptr ())
-> (Ptr () -> CTimer) -> Iso CTimer CTimer (Ptr ()) (Ptr ())
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(CTimer Ptr ()
x) -> Ptr ()
x) Ptr () -> CTimer
CTimer
  {-# INLINE _Wrapped' #-}
# endif
#endif

-- | Given the constructor for a 'Wrapped' type, return a
-- deconstructor that is its inverse.
--
-- Assuming the 'Wrapped' instance is legal, these laws hold:
--
-- @
-- 'op' f '.' f ≡ 'id'
-- f '.' 'op' f ≡ 'id'
-- @
--
--
-- >>> op Identity (Identity 4)
-- 4
--
-- >>> op Const (Const "hello")
-- "hello"
op :: Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
op :: (Unwrapped s -> s) -> s -> Unwrapped s
op Unwrapped s -> s
_ = Getting (Unwrapped s) s (Unwrapped s) -> s -> Unwrapped s
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting (Unwrapped s) s (Unwrapped s)
forall s. Wrapped s => Iso' s (Unwrapped s)
_Wrapped'
{-# INLINE op #-}

-- | This is a convenient version of '_Wrapped' with an argument that's ignored.
--
-- The user supplied function is /ignored/, merely its type is used.
_Wrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' s (Unwrapped s)
_Wrapping' :: (Unwrapped s -> s) -> Iso' s (Unwrapped s)
_Wrapping' Unwrapped s -> s
_ = p (Unwrapped s) (f (Unwrapped s)) -> p s (f s)
forall s. Wrapped s => Iso' s (Unwrapped s)
_Wrapped'
{-# INLINE _Wrapping' #-}

-- | This is a convenient version of '_Wrapped' with an argument that's ignored.
--
-- The user supplied function is /ignored/, merely its type is used.
_Unwrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' (Unwrapped s) s
_Unwrapping' :: (Unwrapped s -> s) -> Iso' (Unwrapped s) s
_Unwrapping' Unwrapped s -> s
_ = AnIso s s (Unwrapped s) (Unwrapped s) -> Iso' (Unwrapped s) s
forall s t a b. AnIso s t a b -> Iso b a t s
from AnIso s s (Unwrapped s) (Unwrapped s)
forall s. Wrapped s => Iso' s (Unwrapped s)
_Wrapped'
{-# INLINE _Unwrapping' #-}

-- | This is a convenient version of '_Wrapped' with an argument that's ignored.
--
-- The user supplied function is /ignored/, merely its types are used.
_Wrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso s t (Unwrapped s) (Unwrapped t)
_Wrapping :: (Unwrapped s -> s) -> Iso s t (Unwrapped s) (Unwrapped t)
_Wrapping Unwrapped s -> s
_ = p (Unwrapped s) (f (Unwrapped t)) -> p s (f t)
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped
{-# INLINE _Wrapping #-}

-- | This is a convenient version of '_Unwrapped' with an argument that's ignored.
--
-- The user supplied function is /ignored/, merely its types are used.
_Unwrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso (Unwrapped t) (Unwrapped s) t s
_Unwrapping :: (Unwrapped s -> s) -> Iso (Unwrapped t) (Unwrapped s) t s
_Unwrapping Unwrapped s -> s
_ = AnIso s t (Unwrapped s) (Unwrapped t)
-> Iso (Unwrapped t) (Unwrapped s) t s
forall s t a b. AnIso s t a b -> Iso b a t s
from AnIso s t (Unwrapped s) (Unwrapped t)
forall s t. Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Wrapped
{-# INLINE _Unwrapping #-}

-- | This combinator is based on @ala@ from Conor McBride's work on Epigram.
--
-- As with '_Wrapping', the user supplied function for the newtype is /ignored/.
--
-- >>> ala Sum foldMap [1,2,3,4]
-- 10
--
-- >>> ala All foldMap [True,True]
-- True
--
-- >>> ala All foldMap [True,False]
-- False
--
-- >>> ala Any foldMap [False,False]
-- False
--
-- >>> ala Any foldMap [True,False]
-- True
--
-- >>> ala Product foldMap [1,2,3,4]
-- 24
--
--
-- You may want to think of this combinator as having the following, simpler, type.
--
-- @
-- ala :: Rewrapping s t => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> e -> s) -> e -> Unwrapped s
-- @

ala :: (Functor f, Rewrapping s t) => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s)
ala :: (Unwrapped s -> s)
-> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s)
ala Unwrapped s -> s
f = Optic
  (Costar ((->) (Unwrapped t))) f (Unwrapped t) (Unwrapped s) t s
-> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s)
forall k s (g :: k -> *) (t :: k) a (b :: k).
Optic (Costar ((->) s)) g s t a b -> ((s -> a) -> g b) -> g t
xplat (Optic
   (Costar ((->) (Unwrapped t))) f (Unwrapped t) (Unwrapped s) t s
 -> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s))
-> Optic
     (Costar ((->) (Unwrapped t))) f (Unwrapped t) (Unwrapped s) t s
-> ((Unwrapped t -> t) -> f s)
-> f (Unwrapped s)
forall a b. (a -> b) -> a -> b
$ (Unwrapped s -> s) -> Iso (Unwrapped t) (Unwrapped s) t s
forall s t.
Rewrapping s t =>
(Unwrapped s -> s) -> Iso (Unwrapped t) (Unwrapped s) t s
_Unwrapping Unwrapped s -> s
f
{-# INLINE ala #-}

-- | This combinator is based on @ala'@ from Conor McBride's work on Epigram.
--
-- As with '_Wrapping', the user supplied function for the newtype is /ignored/.
--
-- @
-- alaf :: Rewrapping s t => (Unwrapped s -> s) -> ((r -> t) -> e -> s) -> (r -> Unwrapped t) -> e -> Unwrapped s
-- @
--
-- >>> alaf Sum foldMap Prelude.length ["hello","world"]
-- 10
alaf :: (Functor f, Functor g, Rewrapping s t) => (Unwrapped s -> s) -> (f t -> g s) -> f (Unwrapped t) -> g (Unwrapped s)
alaf :: (Unwrapped s -> s)
-> (f t -> g s) -> f (Unwrapped t) -> g (Unwrapped s)
alaf Unwrapped s -> s
f = Optic (Costar f) g (Unwrapped t) (Unwrapped s) t s
-> (f t -> g s) -> f (Unwrapped t) -> g (Unwrapped s)
forall k1 k2 (f :: k1 -> *) (g :: k2 -> *) (s :: k1) (t :: k2)
       (a :: k1) (b :: k2).
Optic (Costar f) g s t a b -> (f a -> g b) -> f s -> g t
xplatf (Optic (Costar f) g (Unwrapped t) (Unwrapped s) t s
 -> (f t -> g s) -> f (Unwrapped t) -> g (Unwrapped s))
-> Optic (Costar f) g (Unwrapped t) (Unwrapped s) t s
-> (f t -> g s)
-> f (Unwrapped t)
-> g (Unwrapped s)
forall a b. (a -> b) -> a -> b
$ (Unwrapped s -> s) -> Iso (Unwrapped t) (Unwrapped s) t s
forall s t.
Rewrapping s t =>
(Unwrapped s -> s) -> Iso (Unwrapped t) (Unwrapped s) t s
_Unwrapping Unwrapped s -> s
f
{-# INLINE alaf #-}