-- 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.3.0.1


-- | 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..)', which is 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>.
--   
--   <pre>
--   &gt;&gt;&gt; 5 &amp; (+1) &amp; show
--   "6"
--   </pre>
(&) :: () => a -> (a -> b) -> b
infixl 1 &

-- | morphism composition
(.) :: Category cat => 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
type Lens' s a = Lens s s a a

-- | 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# a

-- | A type class for lens fields.
class HasLens' s (x :: Symbol) a | s x -> a
lensOf' :: (HasLens' s x a, Functor f) => Proxy# x -> (a -> f a) -> s -> f s
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 a (b :: k) :: forall k. () => Type -> k -> Type
Const :: a -> Const a
[getConst] :: Const 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 :: Getting a s t a b -> s -> a
instance Control.Category.Category Lens.Labels.LensFn
instance (GHC.Base.Functor f, p Data.Type.Equality.~ (a -> f b), q Data.Type.Equality.~ (s -> f t), s Data.Type.Equality.~ t, a Data.Type.Equality.~ b, Lens.Labels.HasLens' s x a) => GHC.OverloadedLabels.IsLabel x (Lens.Labels.LensFn p q)


-- | This module defines the <a>Prism</a> type and combinators. Used for
--   building <a>Prism</a>s for oneof fields.
module Lens.Labels.Prism
type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t)
type Prism' s a = Prism s s a a
type AReview t b = Optic' Tagged Identity t b

-- | Used for constructing <a>Prism</a> values.
--   
--   <pre>
--   <a>_Just</a> <a>#</a> 5 == <a>Just</a> 5
--   </pre>
(#) :: AReview t b -> b -> t
infixr 8 #

-- | Build a <a>Prism</a>.
--   
--   <tt><a>Either</a> t a</tt> is used instead of <tt><a>Maybe</a> a</tt>
--   to permit the types of <tt>s</tt> and <tt>t</tt> to differ.
prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b

-- | This is usually used to build a <a>Prism'</a>, when you have to use an
--   operation like <a>cast</a> which already returns a <a>Maybe</a>.
prism' :: (b -> s) -> (s -> Maybe a) -> Prism s s a b
_Left :: Prism (Either a c) (Either b c) a b
_Right :: Prism (Either c a) (Either c b) a b
_Just :: Prism (Maybe a) (Maybe b) a b
_Nothing :: Prism' (Maybe a) ()


-- | This module provides OverloadedLabels <a>IsLabel</a> support via an
--   orphan instance. This means a <tt>Lens.Family.Lens</tt> can be
--   referenced as <tt>#foo</tt> whenever we have an instance of
--   <tt>Lens.Labels.HasLens</tt> with the label <tt>"foo"</tt>."
--   
--   This can eliminate the need to call <a>runLens</a> when working with
--   libraries like <tt>lens</tt>, <tt>microlens</tt>, or
--   <tt>lens-family</tt>.
module Lens.Labels.Unwrapped
instance GHC.OverloadedLabels.IsLabel x (Lens.Labels.LensFn p q) => GHC.OverloadedLabels.IsLabel x (p -> q)
