1- {-# LANGUAGE UndecidableInstances, OverlappingInstances, FlexibleContexts, FlexibleInstances,
1+ {-# LANGUAGE UndecidableInstances, FlexibleContexts, FlexibleInstances,
22 MultiParamTypeClasses, TemplateHaskell, RankNTypes,
33 FunctionalDependencies, DeriveDataTypeable,
44 GADTs, CPP, ScopedTypeVariables #-}
@@ -86,7 +86,6 @@ module Data.IxSet
8686 -- * Set type
8787 IxSet ,
8888 Indexable (.. ),
89- Proxy (.. ),
9089 noCalcs ,
9190 inferIxSet ,
9291 ixSet ,
@@ -167,24 +166,33 @@ import qualified Data.List as List
167166import Data.Map (Map )
168167import qualified Data.Map as Map
169168import Data.Maybe (fromMaybe )
170- import Data.Monoid (Monoid (mempty , mappend ))
171169import Data.SafeCopy (SafeCopy (.. ), contain , safeGet , safePut )
172170import Data.Set (Set )
173171import qualified Data.Set as Set
174- import Data.Typeable (Typeable , cast , typeOf )
175- import Language.Haskell.TH as TH
176- import Data.Semigroup
177-
178- -------------------------------------------------
179- -- Type proxies
180-
181- data Proxy a = Proxy
182-
183- mkProxy :: a -> Proxy a
184- mkProxy _ = Proxy
185-
186- asProxyType :: a -> Proxy a -> a
187- asProxyType a _ = a
172+ import Data.Typeable (Typeable , cast , typeOf , Proxy )
173+ import Language.Haskell.TH as TH
174+ ( mkName ,
175+ varP ,
176+ varE ,
177+ conE ,
178+ appE ,
179+ listE ,
180+ sigE ,
181+ normalB ,
182+ valD ,
183+ varT ,
184+ conT ,
185+ appT ,
186+ Q ,
187+ Dec (TySynD , DataD , NewtypeD ),
188+ Name ,
189+ forallT ,
190+ tySynD ,
191+ instanceD ,
192+ reify ,
193+ Info (VarI , TyConI ),
194+ Specificity (SpecifiedSpec ),
195+ TyVarBndr (.. ) )
188196
189197-- the core datatypes
190198
@@ -345,30 +353,27 @@ inferIxSet ixset typeName calName entryPoints
345353 names = map tyVarBndrToName binders
346354
347355 typeCon = List. foldl' appT (conT typeName) (map varT names)
348- #if MIN_VERSION_template_haskell(2,4,0)
349- mkCtx = classP
350- #else
356+ #if MIN_VERSION_template_haskell(2,10,0)
351357 -- mkType :: Name -> [TypeQ] -> TypeQ
352358 mkType con = foldl appT (conT con)
353359
354360 mkCtx = mkType
361+ #else
362+ mkCtx = classP
355363#endif
356364 dataCtxConQ = [mkCtx ''Data [varT name] | name <- names]
357365 fullContext = do
358366 dataCtxCon <- sequence dataCtxConQ
359367 return (context ++ dataCtxCon)
360368 case calInfo of
361369#if MIN_VERSION_template_haskell(2,11,0)
362- VarI _ t _ ->
370+ VarI _ _ _ ->
363371#else
364372 VarI _ t _ _ ->
365373#endif
366- let calType = getCalType t
367- getCalType (ForallT _names _ t') = getCalType t'
368- getCalType (AppT (AppT ArrowT _) t') = t'
369- getCalType t' = error (" Unexpected type in getCalType: " ++ pprint t')
374+ let
370375#if MIN_VERSION_template_haskell(2,17,0)
371- binders' = map (fmap (\ () -> SpecifiedSpec )) ( binders :: [ TyVarBndr () ])
376+ binders' = map (fmap (\ _ -> SpecifiedSpec )) binders
372377#else
373378 binders' = binders
374379#endif
@@ -385,18 +390,7 @@ inferIxSet ixset typeName calName entryPoints
385390 return $ [i, ixType'] -- ++ d
386391 _ -> error " IxSet.inferIxSet calInfo unexpected match"
387392
388- -- | Version of 'instanceD' that takes in a Q [Dec] instead of a [Q Dec]
389- -- and filters out signatures from the list of declarations.
390- instanceD' :: CxtQ -> TypeQ -> Q [Dec ] -> DecQ
391- instanceD' ctxt ty decs =
392- do decs' <- decs
393- let decs'' = filter (not . isSigD) decs'
394- instanceD ctxt ty (map return decs'')
395393
396- -- | Returns true if the Dec matches a SigD constructor.
397- isSigD :: Dec -> Bool
398- isSigD (SigD _ _) = True
399- isSigD _ = False
400394
401395#if MIN_VERSION_template_haskell(2,17,0)
402396tyVarBndrToName :: TyVarBndr a -> Name
@@ -809,7 +803,6 @@ instance (Indexable a, Typeable a, Ord a) => Semigroup (IxSet a) where
809803
810804instance (Indexable a , Typeable a , Ord a ) => Monoid (IxSet a ) where
811805 mempty = empty
812- mappend = union
813806
814807-- | Statistics about 'IxSet'. This function returns quadruple
815808-- consisting of 1. total number of elements in the set 2. number of
0 commit comments