module Yesod.Core.Lens
  ( envL
  , siteL
  ) where

import Freckle.App.Prelude

import Control.Lens (Lens', lens)
import Yesod.Core.Types (HandlerData, RunHandlerEnv, handlerEnv, rheSite)

envL :: Lens' (HandlerData child site) (RunHandlerEnv child site)
envL :: forall child site.
Lens' (HandlerData child site) (RunHandlerEnv child site)
envL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall child site.
HandlerData child site -> RunHandlerEnv child site
handlerEnv forall a b. (a -> b) -> a -> b
$ \HandlerData child site
x RunHandlerEnv child site
y -> HandlerData child site
x { handlerEnv :: RunHandlerEnv child site
handlerEnv = RunHandlerEnv child site
y }

siteL :: Lens' (RunHandlerEnv child site) site
siteL :: forall child site. Lens' (RunHandlerEnv child site) site
siteL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall child site. RunHandlerEnv child site -> site
rheSite forall a b. (a -> b) -> a -> b
$ \RunHandlerEnv child site
x site
y -> RunHandlerEnv child site
x { rheSite :: site
rheSite = site
y }