#ifdef TRUSTWORTHY
#endif
#ifndef MIN_VERSION_template_haskell
#define MIN_VERSION_template_haskell(x,y,z) (defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706)
#endif
#ifndef MIN_VERSION_containers
#define MIN_VERSION_containers(x,y,z) 1
#endif
module Control.Lens.Internal.TH where
import Language.Haskell.TH
import qualified Data.Map as Map
import qualified Data.Set as Set
tySynInstD' :: Name -> [TypeQ] -> TypeQ -> DecQ
#if MIN_VERSION_template_haskell(2,9,0)
tySynInstD' fam ts r = tySynInstD fam (tySynEqn ts r)
#else
tySynInstD' = tySynInstD
#endif
appsT :: TypeQ -> [TypeQ] -> TypeQ
appsT = foldl appT
appsE1 :: ExpQ -> [ExpQ] -> ExpQ
appsE1 = foldl appE
toTupleT :: [TypeQ] -> TypeQ
toTupleT [x] = x
toTupleT xs = appsT (tupleT (length xs)) xs
toTupleE :: [ExpQ] -> ExpQ
toTupleE [x] = x
toTupleE xs = tupE xs
toTupleP :: [PatQ] -> PatQ
toTupleP [x] = x
toTupleP xs = tupP xs
conAppsT :: Name -> [Type] -> Type
conAppsT conName = foldl AppT (ConT conName)
bndrName :: TyVarBndr -> Name
bndrName (PlainTV n ) = n
bndrName (KindedTV n _) = n
fromSet :: Ord k => (k -> v) -> Set.Set k -> Map.Map k v
#if MIN_VERSION_containers(0,5,0)
fromSet = Map.fromSet
#else
fromSet f x = Map.fromList [ (k,f k) | k <- Set.toList x ]
#endif