Commit 98ff1a56 authored by Krzysztof Gogolewski's avatar Krzysztof Gogolewski Committed by Marge Bot

Replace nOfThem by replicate

parent 89a201e8
......@@ -456,7 +456,7 @@ nlNullaryConPat con = noLoc (ConPatIn (noLoc con) (PrefixCon []))
nlWildConPat :: DataCon -> LPat GhcPs
nlWildConPat con = noLoc (ConPatIn (noLoc (getRdrName con))
(PrefixCon (nOfThem (dataConSourceArity con)
(PrefixCon (replicate (dataConSourceArity con)
nlWildPat)))
nlWildPat :: LPat GhcPs
......
......@@ -870,7 +870,7 @@ mk_tuple Boxed arity = (tycon, tuple_con)
tycon = mkTupleTyCon tc_name tc_binders tc_res_kind tc_arity tuple_con
BoxedTuple flavour
tc_binders = mkTemplateAnonTyConBinders (nOfThem arity liftedTypeKind)
tc_binders = mkTemplateAnonTyConBinders (replicate arity liftedTypeKind)
tc_res_kind = liftedTypeKind
tc_arity = arity
flavour = VanillaAlgTyCon (mkPrelTyConRepName tc_name)
......@@ -895,7 +895,7 @@ mk_tuple Unboxed arity = (tycon, tuple_con)
-- See Note [Unboxed tuple RuntimeRep vars] in TyCon
-- Kind: forall (k1:RuntimeRep) (k2:RuntimeRep). TYPE k1 -> TYPE k2 -> #
tc_binders = mkTemplateTyConBinders (nOfThem arity runtimeRepTy)
tc_binders = mkTemplateTyConBinders (replicate arity runtimeRepTy)
(\ks -> map tYPE ks)
tc_res_kind = unboxedTupleKind rr_tys
......@@ -1015,7 +1015,7 @@ mk_sum arity = (tycon, sum_cons)
-- Unboxed sums are currently not Typeable due to efficiency concerns. See #13276.
rep_name = Nothing -- Just $ mkPrelTyConRepName tc_name
tc_binders = mkTemplateTyConBinders (nOfThem arity runtimeRepTy)
tc_binders = mkTemplateTyConBinders (replicate arity runtimeRepTy)
(\ks -> map tYPE ks)
tyvars = binderVars tc_binders
......
......@@ -687,9 +687,9 @@ gen_Bounded_binds loc tycon
arity = dataConSourceArity data_con_1
min_bound_1con = mkHsVarBind loc minBound_RDR $
nlHsVarApps data_con_1_RDR (nOfThem arity minBound_RDR)
nlHsVarApps data_con_1_RDR (replicate arity minBound_RDR)
max_bound_1con = mkHsVarBind loc maxBound_RDR $
nlHsVarApps data_con_1_RDR (nOfThem arity maxBound_RDR)
nlHsVarApps data_con_1_RDR (replicate arity maxBound_RDR)
{-
************************************************************************
......
......@@ -889,9 +889,9 @@ tupKindSort_maybe k
tc_tuple :: HsType GhcRn -> TcTyMode -> TupleSort -> [LHsType GhcRn] -> TcKind -> TcM TcType
tc_tuple rn_ty mode tup_sort tys exp_kind
= do { arg_kinds <- case tup_sort of
BoxedTuple -> return (nOfThem arity liftedTypeKind)
UnboxedTuple -> mapM (\_ -> newOpenTypeKind) tys
ConstraintTuple -> return (nOfThem arity constraintKind)
BoxedTuple -> return (replicate arity liftedTypeKind)
UnboxedTuple -> replicateM arity newOpenTypeKind
ConstraintTuple -> return (replicate arity constraintKind)
; tau_tys <- zipWithM (tc_lhs_type mode) tys arg_kinds
; finish_tuple rn_ty tup_sort tau_tys arg_kinds exp_kind }
where
......
......@@ -148,7 +148,7 @@ newMetaKindVar
; return (mkTyVarTy kv) }
newMetaKindVars :: Int -> TcM [TcKind]
newMetaKindVars n = mapM (\ _ -> newMetaKindVar) (nOfThem n ())
newMetaKindVars n = replicateM n newMetaKindVar
{-
************************************************************************
......@@ -944,7 +944,7 @@ newFlexiTyVarTy kind = do
return (mkTyVarTy tc_tyvar)
newFlexiTyVarTys :: Int -> Kind -> TcM [TcType]
newFlexiTyVarTys n kind = mapM newFlexiTyVarTy (nOfThem n kind)
newFlexiTyVarTys n kind = replicateM n (newFlexiTyVarTy kind)
newOpenTypeKind :: TcM TcKind
newOpenTypeKind
......
......@@ -26,7 +26,7 @@ module Util (
mapFst, mapSnd, chkAppend,
mapAndUnzip, mapAndUnzip3, mapAccumL2,
nOfThem, filterOut, partitionWith,
filterOut, partitionWith,
dropWhileEndLE, spanEnd, last2, lastMaybe,
......@@ -458,9 +458,6 @@ mapAccumL2 f s1 s2 xs = (s1', s2', ys)
(s1', s2', y) -> ((s1', s2'), y))
(s1, s2) xs
nOfThem :: Int -> a -> [a]
nOfThem n thing = replicate n thing
-- | @atLength atLen atEnd ls n@ unravels list @ls@ to position @n@. Precisely:
--
-- @
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment