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


-- | Integration of lenses with OverloadedLabels.
--   
--   Provides a framework to integrate lenses with GHC's OverloadedLabels
--   extension.
@package lens-labels
@version 0.1.0.2


-- | A lens library that integrates with OverloadedLabels.
--   
--   Unlike the <tt>lens</tt> package (and others), lenses are defined as a
--   newtype instead of a type synonym, to avoid overlapping with other
--   IsLabel instances. However, the <a>LensFn</a> and <a>runLens</a>
--   functions allow converting between the two types; for example:
--   
--   <pre>
--   LensFn :: Control.Lens.LensLike f s t a b -&gt; Lens.Labels.LensLike f s t a b
--   runLens :: Lens.Labels.LensLike f s t a b -&gt; Control.Lens.LensLike f s t a b
--   </pre>
--   
--   TODO: support more general optic types (e.g., prisms).
module Lens.Labels

-- | A newtype for defining lenses. Can be composed using
--   `(Control.Category..)` (also exported from this module).
newtype LensFn a b
LensFn :: (a -> b) -> LensFn a b
[runLens] :: LensFn a b -> a -> b
type LensLike f s t a b = LensFn (a -> f b) (s -> f t)
type LensLike' f s a = LensLike f s s a a

-- | <a>&amp;</a> is a reverse application operator. This provides
--   notational convenience. Its precedence is one higher than that of the
--   forward application operator <a>$</a>, which allows <a>&amp;</a> to be
--   nested in <a>$</a>.
(&) :: () => a -> (a -> b) -> b
infixl 1 &

-- | morphism composition
(.) :: Category k cat => forall (b :: k) (c :: k) (a :: k). () => cat b c -> cat a b -> cat a c
infixr 9 .
type Lens s t a b = forall f. Functor f => LensLike f s t a b

-- | A type class for lens fields.
class HasLens (x :: Symbol) f s t a b | x s -> a, x t -> b, x s b -> t, x t a -> s
lensOf :: HasLens x f s t a b => Proxy# x -> (a -> f b) -> s -> f t

-- | The type constructor <tt>Proxy#</tt> is used to bear witness to some
--   type variable. It's used when you want to pass around proxy values for
--   doing things like modelling type applications. A <tt>Proxy#</tt> is
--   not only unboxed, it also has a polymorphic kind, and has no runtime
--   representation, being totally free.
data Proxy# :: forall k0. () => k0 -> TYPE TupleRep [] RuntimeRep

-- | Witness for an unboxed <tt>Proxy#</tt> value, which has no runtime
--   representation.
proxy# :: () => Proxy# k0 a
type ASetter s t a b = LensLike Identity s t a b
(.~) :: ASetter s t a b -> b -> s -> t
infixr 4 .~
(%~) :: ASetter s t a b -> (a -> b) -> s -> t
infixr 4 %~
set :: ASetter s t a b -> b -> s -> t
over :: ASetter s t a b -> (a -> b) -> s -> t

-- | The <a>Const</a> functor.
newtype Const k a (b :: k) :: forall k. () => * -> k -> *
Const :: a -> Const k a
[getConst] :: Const k a -> a
type Getting r s t a b = LensLike (Const r) s t a b
(^.) :: s -> Getting a s t a b -> a
infixl 8 ^.
view :: s -> Getting a s t a b -> a
instance Control.Category.Category Lens.Labels.LensFn
instance (p ~ (a -> f b), q ~ (s -> f t), Lens.Labels.HasLens x f s t a b) => GHC.OverloadedLabels.IsLabel x (Lens.Labels.LensFn p q)
