#ifdef TRUSTWORTHY
#endif
#ifdef HLINT
#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 Language.Haskell.TH.Syntax
import qualified Data.Map as Map
import qualified Data.Set as Set
import Data.Version (showVersion)
import Paths_lens (version)
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
mkLensName_tc :: String -> String -> Name
mkLensName_tc = mkNameG_tc ("lens-" ++ showVersion version)
mkLensName_v :: String -> String -> Name
mkLensName_v = mkNameG_v ("lens-" ++ showVersion version)
traversalTypeName :: Name
traversalTypeName = mkLensName_tc "Control.Lens.Type" "Traversal"
traversal'TypeName :: Name
traversal'TypeName = mkLensName_tc "Control.Lens.Type" "Traversal'"
lensTypeName :: Name
lensTypeName = mkLensName_tc "Control.Lens.Type" "Lens"
lens'TypeName :: Name
lens'TypeName = mkLensName_tc "Control.Lens.Type" "Lens'"
isoTypeName :: Name
isoTypeName = mkLensName_tc "Control.Lens.Type" "Iso"
iso'TypeName :: Name
iso'TypeName = mkLensName_tc "Control.Lens.Type" "Iso'"
getterTypeName :: Name
getterTypeName = mkLensName_tc "Control.Lens.Type" "Getter"
foldTypeName :: Name
foldTypeName = mkLensName_tc "Control.Lens.Type" "Fold"
prismTypeName :: Name
prismTypeName = mkLensName_tc "Control.Lens.Type" "Prism"
prism'TypeName :: Name
prism'TypeName = mkLensName_tc "Control.Lens.Type" "Prism'"
reviewTypeName :: Name
reviewTypeName = mkLensName_tc "Control.Lens.Type" "Review"
wrappedTypeName :: Name
wrappedTypeName = mkLensName_tc "Control.Lens.Wrapped" "Wrapped"
unwrappedTypeName :: Name
unwrappedTypeName = mkLensName_tc "Control.Lens.Wrapped" "Unwrapped"
rewrappedTypeName :: Name
rewrappedTypeName = mkLensName_tc "Control.Lens.Wrapped" "Rewrapped"
_wrapped'ValName :: Name
_wrapped'ValName = mkLensName_v "Control.Lens.Wrapped" "_Wrapped'"
isoValName :: Name
isoValName = mkLensName_v "Control.Lens.Iso" "iso"
prismValName :: Name
prismValName = mkLensName_v "Control.Lens.Prism" "prism"
untoValName :: Name
untoValName = mkLensName_v "Control.Lens.Review" "unto"
coerceValName :: Name
coerceValName = mkLensName_v "Control.Lens.Internal.Getter" "coerce"
composeValName :: Name
composeValName = mkNameG_v "base" "GHC.Base" "."
idValName :: Name
idValName = mkNameG_v "base" "GHC.Base" "id"
fmapValName :: Name
fmapValName = mkNameG_v "base" "GHC.Base" "fmap"
pureValName :: Name
pureValName = mkNameG_v "base" "Control.Applicative" "pure"
apValName :: Name
apValName = mkNameG_v "base" "Control.Applicative" "<*>"
rightDataName :: Name
rightDataName = mkNameG_d "base" "Data.Either" "Right"
leftDataName :: Name
leftDataName = mkNameG_d "base" "Data.Either" "Left"