{-# LANGUAGE PackageImports #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE TypeApplications #-}
{-# language ConstraintKinds #-}
{-# language DataKinds #-}
{-# language FlexibleContexts #-}
{-# language FlexibleInstances #-}
{-# language FunctionalDependencies #-}
{-# language MultiParamTypeClasses #-}
{-# language ScopedTypeVariables #-}
{-# language TypeFamilies #-}
{-# language TypeOperators #-}
{-# language UndecidableInstances #-}
module Data.Generics.Wrapped
( Wrapped (..)
, wrappedTo
, wrappedFrom
, _Unwrapped
, _Wrapped
)
where
import qualified "this" Data.Generics.Internal.VL.Iso as VL
import "generic-lens-core" Data.Generics.Internal.Wrapped (Context, derived)
import Control.Applicative (Const(..))
_Unwrapped :: Wrapped s t a b => VL.Iso s t a b
_Unwrapped :: forall s t a b. Wrapped s t a b => Iso s t a b
_Unwrapped = forall s t a b. Wrapped s t a b => Iso s t a b
wrappedIso
{-# inline _Unwrapped #-}
_Wrapped :: Wrapped s t a b => VL.Iso b a t s
_Wrapped :: forall s t a b. Wrapped s t a b => Iso b a t s
_Wrapped = forall s t a b. Iso s t a b -> Iso b a t s
VL.fromIso forall s t a b. Wrapped s t a b => Iso s t a b
wrappedIso
{-# inline _Wrapped #-}
class Wrapped s t a b | s -> a, t -> b where
wrappedIso :: VL.Iso s t a b
wrappedTo :: forall s t a b. Wrapped s t a b => s -> a
wrappedTo :: forall s t a b. Wrapped s t a b => s -> a
wrappedTo s
a = forall {a} {b} {t} {a} {b}.
((a -> Const a b) -> t -> Const a b) -> t -> a
view (forall s t a b. Wrapped s t a b => Iso s t a b
wrappedIso @s @t @a @b) s
a
where view :: ((a -> Const a b) -> t -> Const a b) -> t -> a
view (a -> Const a b) -> t -> Const a b
l t
s = forall {k} a (b :: k). Const a b -> a
getConst ((a -> Const a b) -> t -> Const a b
l forall {k} a (b :: k). a -> Const a b
Const t
s)
{-# INLINE wrappedTo #-}
wrappedFrom :: forall s t a b. Wrapped s t a b => b -> t
wrappedFrom :: forall s t a b. Wrapped s t a b => b -> t
wrappedFrom b
a = forall {a} {b} {t} {a} {b}.
((a -> Const a b) -> t -> Const a b) -> t -> a
view (forall s t a b. Iso s t a b -> Iso b a t s
VL.fromIso (forall s t a b. Wrapped s t a b => Iso s t a b
wrappedIso @s @t @a @b)) b
a
where view :: ((a -> Const a b) -> t -> Const a b) -> t -> a
view (a -> Const a b) -> t -> Const a b
l t
s = forall {k} a (b :: k). Const a b -> a
getConst ((a -> Const a b) -> t -> Const a b
l forall {k} a (b :: k). a -> Const a b
Const t
s)
{-# INLINE wrappedFrom #-}
instance Context s t a b => Wrapped s t a b where
wrappedIso :: Iso s t a b
wrappedIso = forall s t a b. Iso s t a b -> Iso s t a b
VL.iso2isovl forall s t a b. Context s t a b => Iso s t a b
derived
{-# INLINE wrappedIso #-}