    {-# LANGUAGE CPP #-}

    module Web.Twitter.Types.Lens.TH where

    import Control.Lens hiding (makeLenses)
    import Language.Haskell.TH

    makeLenses :: Name -> Q [Dec]
    makeLenses :: Name -> Q [Dec]
    makeLenses = LensRules -> Name -> Q [Dec]
    makeLensesWith (LensRules -> Name -> Q [Dec]) -> LensRules -> Name -> Q [Dec]
    forall a b. (a -> b) -> a -> b
    $ LensRules
    lensRules LensRules -> (LensRules -> LensRules) -> LensRules
    forall a b. a -> (a -> b) -> b
    & (FieldNamer -> Identity FieldNamer)
    -> LensRules -> Identity LensRules
    Lens' LensRules FieldNamer
    lensField ((FieldNamer -> Identity FieldNamer)
     -> LensRules -> Identity LensRules)
    -> FieldNamer -> LensRules -> LensRules
    forall s t a b. ASetter s t a b -> b -> s -> t
    .~ FieldNamer
    forall {p} {p}. p -> p -> Name -> [DefName]
    nameF
      where

    #if MIN_VERSION_lens(4, 5, 0)
        nameF :: p -> p -> Name -> [DefName]
    nameF p
    _ p
    _ Name
    n = [Name -> DefName
    TopName (Name -> DefName) -> (Name -> Name) -> Name -> DefName
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Name
    mkName (String -> Name) -> (Name -> String) -> Name -> Name
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Name -> String
    nameBase (Name -> DefName) -> Name -> DefName
    forall a b. (a -> b) -> a -> b
    $ Name
    n]
    #elif MIN_VERSION_lens(4, 4, 0)
        nameF _ n = [TopName . mkName . nameBase $ n]
    #elif MIN_VERSION_lens(4, 0, 0)
        nameF = Just
    #endif