{-# LANGUAGE PackageImports #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
module Data.Generics.Product.Fields
(
HasField (..)
, HasField' (..)
, HasField_ (..)
, getField
, setField
) where
import "this" Data.Generics.Internal.VL.Lens as VL
import "generic-lens-core" Data.Generics.Internal.Void
import qualified "generic-lens-core" Data.Generics.Product.Internal.Fields as Core
import GHC.TypeLits (Symbol)
class HasField (field :: Symbol) s t a b | s field -> a, t field -> b, s field b -> t, t field a -> s where
field :: VL.Lens s t a b
class HasField_ (field :: Symbol) s t a b where
field_ :: VL.Lens s t a b
class HasField' (field :: Symbol) s a | s field -> a where
field' :: VL.Lens s s a a
class HasField0 (field :: Symbol) s t a b where
field0 :: VL.Lens s t a b
getField :: forall f a s. HasField' f s a => s -> a
getField :: forall (f :: Symbol) a s. HasField' f s a => s -> a
getField = forall a s. ((a -> Const a a) -> s -> Const a s) -> s -> a
VL.view (forall (field :: Symbol) s a. HasField' field s a => Lens s s a a
field' @f)
setField :: forall f s a. HasField' f s a => a -> s -> s
setField :: forall (f :: Symbol) s a. HasField' f s a => a -> s -> s
setField = forall s t a b. Lens s t a b -> b -> s -> t
VL.set (forall (field :: Symbol) s a. HasField' field s a => Lens s s a a
field' @f)
instance Core.Context' field s a => HasField' field s a where
field' :: Lens s s a a
field' a -> f a
f s
s = forall (field :: Symbol) s t a b.
HasField0 field s t a b =>
Lens s t a b
field0 @field a -> f a
f s
s
instance (Core.Context field s t a b , HasField0 field s t a b) => HasField field s t a b where
field :: Lens s t a b
field a -> f b
f s
s = forall (field :: Symbol) s t a b.
HasField0 field s t a b =>
Lens s t a b
field0 @field a -> f b
f s
s
instance {-# OVERLAPPING #-} HasField f (Void1 a) (Void1 b) a b where
field :: Lens (Void1 a) (Void1 b) a b
field = forall a. HasCallStack => a
undefined
instance {-# OVERLAPPING #-} HasField' f (Void1 a) a where
field' :: Lens (Void1 a) (Void1 a) a a
field' = forall a. HasCallStack => a
undefined
instance (Core.Context_ field s t a b , HasField0 field s t a b) => HasField_ field s t a b where
field_ :: Lens s t a b
field_ a -> f b
f s
s = forall (field :: Symbol) s t a b.
HasField0 field s t a b =>
Lens s t a b
field0 @field a -> f b
f s
s
instance {-# OVERLAPPING #-} HasField_ f (Void1 a) (Void1 b) a b where
field_ :: Lens (Void1 a) (Void1 b) a b
field_ = forall a. HasCallStack => a
undefined
instance Core.Context0 field s t a b => HasField0 field s t a b where
field0 :: Lens s t a b
field0 = forall a b i s t.
(ALens a b i a b -> ALens a b i s t) -> Lens s t a b
VL.ravel (forall (field :: Symbol) s t a b.
Context0 field s t a b =>
Lens s t a b
Core.derived @field)
{-# INLINE field0 #-}