module Reflex.Dom.Builder.Class.TH where

import Control.Lens
import Language.Haskell.TH.Lib (DecsQ)
import Language.Haskell.TH.Syntax (Name, nameBase)

namer :: [String] -> Name -> [Name] -> Name -> [DefName]
namer :: [String] -> Name -> [Name] -> Name -> [DefName]
namer s :: [String]
s n :: Name
n ks :: [Name]
ks t :: Name
t | Name -> String
nameBase Name
t String -> [String] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [String]
s = []
               | Bool
otherwise = Name -> [Name] -> Name -> [DefName]
underscoreNoPrefixNamer Name
n [Name]
ks Name
t

makeLensesWithoutField :: [String] -> Name -> DecsQ
makeLensesWithoutField :: [String] -> Name -> DecsQ
makeLensesWithoutField s :: [String]
s = LensRules -> Name -> DecsQ
makeLensesWith (LensRules
lensRules LensRules -> (LensRules -> LensRules) -> LensRules
forall a b. a -> (a -> b) -> b
& ((Name -> [Name] -> Name -> [DefName])
 -> Identity (Name -> [Name] -> Name -> [DefName]))
-> LensRules -> Identity LensRules
Lens' LensRules (Name -> [Name] -> Name -> [DefName])
lensField (((Name -> [Name] -> Name -> [DefName])
  -> Identity (Name -> [Name] -> Name -> [DefName]))
 -> LensRules -> Identity LensRules)
-> (Name -> [Name] -> Name -> [DefName]) -> LensRules -> LensRules
forall s t a b. ASetter s t a b -> b -> s -> t
.~ [String] -> Name -> [Name] -> Name -> [DefName]
namer [String]
s)