Aelve Codesearch

grep over package repositories
Please provide a string to search for.
3+ characters are required.
Index updated 2 hours ago

total matches: 210

Cabal-3.0.0.0
17 matches
Distribution/Backpack/ConfiguredComponent.hs
    -- duplicates (see #4986).  (NB: This is not needed for lib_deps,
    -- since those elaborate into includes, for which there explicitly
    -- may be multiple instances of a package)
    exe_deps = ordNub $
        [ exe
        | ExeDependency pn cn _ <- getAllToolDependencies pkg_descr bi
        -- The error suppression here is important, because in general
        -- we won't know about external dependencies (e.g., 'happy')
        -- which the package is attempting to use (those deps are only

            
Distribution/Backpack/ReadyComponent.hs
-- | Compute the dependencies of a 'ReadyComponent' that should
-- be recorded in the @depends@ field of 'InstalledPackageInfo'.
rc_depends :: ReadyComponent -> [(UnitId, MungedPackageId)]
rc_depends rc = ordNub $
    case rc_i rc of
        Left indefc ->
            map (\ci -> (abstractUnitId $ ci_id ci, toMungedPackageId ci))
                (indefc_includes indefc)
        Right instc ->

            
Distribution/Backpack/ReadyComponent.hs
                   | otherwise
                   -> [newSimpleUnitId (rc_cid rc)]
        _ -> []) ++
      ordNub (map fst (rc_depends rc)) ++
      map ann_id (rc_exe_deps rc)

dispReadyComponent :: ReadyComponent -> Doc
dispReadyComponent rc =
    hang (text (case rc_i rc of

            
Distribution/Simple/Configure.hs
                     ++ [ "-I" ++ buildDir lbi </> "autogen" ]
                     -- `configure' may generate headers in the build directory
                     ++ [ "-I" ++ buildDir lbi </> dir
                        | dir <- ordNub (collectField PD.includeDirs)
                        , not (isAbsolute dir)]
                     -- we might also reference headers from the
                     -- packages directory.
                     ++ [ "-I" ++ baseDir lbi </> dir
                        | dir <- ordNub (collectField PD.includeDirs)

            
Distribution/Simple/Configure.hs
                     -- we might also reference headers from the
                     -- packages directory.
                     ++ [ "-I" ++ baseDir lbi </> dir
                        | dir <- ordNub (collectField PD.includeDirs)
                        , not (isAbsolute dir)]
                     ++ [ "-I" ++ dir | dir <- ordNub (collectField PD.includeDirs)
                                      , isAbsolute dir]
                     ++ ["-I" ++ baseDir lbi]
                     ++ collectField PD.cppOptions
                     ++ collectField PD.ccOptions
                     ++ [ "-I" ++ dir

            
Distribution/Simple/Configure.hs
                     ++ collectField PD.cppOptions
                     ++ collectField PD.ccOptions
                     ++ [ "-I" ++ dir
                        | dir <- ordNub [ dir
                                        | dep <- deps
                                        , dir <- Installed.includeDirs dep ]
                                 -- dedupe include dirs of dependencies
                                 -- to prevent quadratic blow-up
                        ]

            
Distribution/Simple/Configure.hs
                        , opt <- Installed.ccOptions dep ]

        commonLdArgs  = [ "-L" ++ dir
                        | dir <- ordNub (collectField PD.extraLibDirs) ]
                     ++ collectField PD.ldOptions
                     ++ [ "-L" ++ dir
                        | dir <- ordNub [ dir
                                        | dep <- deps
                                        , dir <- Installed.libraryDirs dep ]
                        ]
                     --TODO: do we also need dependent packages' ld options?
        makeLdArgs libs = [ "-l"++lib | lib <- libs ] ++ commonLdArgs

            
Distribution/Simple/LocalBuildInfo.hs
-- that need to be installed.
allLibModules :: Library -> ComponentLocalBuildInfo -> [ModuleName]
allLibModules lib clbi =
    ordNub $
    explicitLibModules lib ++
    case clbi of
        LibComponentLocalBuildInfo { componentInstantiatedWith = insts } -> map fst insts
        _ -> []


            
Distribution/Simple/Register.hs
    bi = libBuildInfo lib
    --TODO: unclear what the root cause of the
    -- duplication is, but we nub it here for now:
    depends = ordNub $ map fst (componentPackageDeps clbi)
    (absinc, relinc) = partition isAbsolute (includeDirs bi)
    hasModules = not $ null (allLibModules lib clbi)
    comp = compiler lbi
    hasLibrary = (hasModules || not (null (cSources bi))
                             || not (null (asmSources bi))

            
Distribution/Simple/Utils.hs
        lowercase,
        listUnion,
        listUnionRight,
        ordNub,
        ordNubBy,
        ordNubRight,
        safeTail,
        unintersperse,
        wrapText,
        wrapLine,


            
Distribution/Utils/Generic.hs
        isAsciiAlphaNum,
        listUnion,
        listUnionRight,
        ordNub,
        ordNubBy,
        ordNubRight,
        safeTail,
        unintersperse,
        wrapText,
        wrapLine,
        unfoldrM,

            
Distribution/Utils/Generic.hs
      | otherwise = (rest, True)

-- | Like 'Data.List.nub', but has @O(n log n)@ complexity instead of
-- @O(n^2)@. Code for 'ordNub' and 'listUnion' taken from Niklas Hambüchen's
-- <http://github.com/nh2/haskell-ordnub ordnub> package.
ordNub :: Ord a => [a] -> [a]
ordNub = ordNubBy id

-- | Like 'ordNub' and 'Data.List.nubBy'. Selects a key for each element and
-- takes the nub based on that key.
ordNubBy :: Ord b => (a -> b) -> [a] -> [a]
ordNubBy f l = go Set.empty l
  where
    go !_ [] = []
    go !s (x:xs)
      | y `Set.member` s = go s xs
      | otherwise        = let !s' = Set.insert y s

            
Distribution/Utils/Generic.hs
-- | Like "Data.List.union", but has @O(n log n)@ complexity instead of
-- @O(n^2)@.
listUnion :: (Ord a) => [a] -> [a] -> [a]
listUnion a b = a ++ ordNub (filter (`Set.notMember` aSet) b)
  where
    aSet = Set.fromList a

-- | A right-biased version of 'ordNub'.
--
-- Example:
--
-- >>> ordNub [1,2,1] :: [Int]
-- [1,2]
--
-- >>> ordNubRight [1,2,1] :: [Int]
-- [2,1]
--
ordNubRight :: (Ord a) => [a] -> [a]
ordNubRight = fst . foldr go ([], Set.empty)
  where
    go x p@(l, s) = if x `Set.member` s then p
                                        else (x:l, Set.insert x s)

-- | A right-biased version of 'listUnion'.

            
Distribution/Utils/Generic.hs
-- [4,3,2,1,1]
--
listUnionRight :: (Ord a) => [a] -> [a] -> [a]
listUnionRight a b = ordNubRight (filter (`Set.notMember` bSet) a) ++ b
  where
    bSet = Set.fromList b

-- | A total variant of 'tail'.
safeTail :: [a] -> [a]

            
Distribution/Utils/NubList.hs

-- | Smart constructor for the NubList type.
toNubList :: Ord a => [a] -> NubList a
toNubList list = NubList $ ordNub list

-- | Lift a function over lists to a function over NubLists.
overNubList :: Ord a => ([a] -> [a]) -> NubList a -> NubList a
overNubList f (NubList list) = toNubList . f $ list


            
Distribution/Utils/NubList.hs
-- | NubListR : A right-biased version of 'NubList'. That is @toNubListR
-- ["-XNoFoo", "-XFoo", "-XNoFoo"]@ will result in @["-XFoo", "-XNoFoo"]@,
-- unlike the normal 'NubList', which is left-biased. Built on top of
-- 'ordNubRight' and 'listUnionRight'.
newtype NubListR a =
    NubListR { fromNubListR :: [a] }
    deriving Eq

-- | Smart constructor for the NubListR type.

            
Distribution/Utils/NubList.hs

-- | Smart constructor for the NubListR type.
toNubListR :: Ord a => [a] -> NubListR a
toNubListR list = NubListR $ ordNubRight list

-- | Lift a function over lists to a function over NubListRs.
overNubListR :: Ord a => ([a] -> [a]) -> NubListR a -> NubListR a
overNubListR f (NubListR list) = toNubListR . f $ list


            
Cabal-ide-backend-1.23.0.0
9 matches
Distribution/Simple/Utils.hs
        lowercase,
        listUnion,
        listUnionRight,
        ordNub,
        ordNubRight,
        wrapText,
        wrapLine,
  ) where

import Control.Monad

            
Distribution/Simple/Utils.hs
      | otherwise = (rest, True)

-- | Like "Data.List.nub", but has @O(n log n)@ complexity instead of
-- @O(n^2)@. Code for 'ordNub' and 'listUnion' taken from Niklas Hambüchen's
-- <http://github.com/nh2/haskell-ordnub ordnub> package.
ordNub :: (Ord a) => [a] -> [a]
ordNub l = go Set.empty l
  where
    go _ [] = []
    go s (x:xs) = if x `Set.member` s then go s xs
                                      else x : go (Set.insert x s) xs


            
Distribution/Simple/Utils.hs
-- | Like "Data.List.union", but has @O(n log n)@ complexity instead of
-- @O(n^2)@.
listUnion :: (Ord a) => [a] -> [a] -> [a]
listUnion a b = a ++ ordNub (filter (`Set.notMember` aSet) b)
  where
    aSet = Set.fromList a

-- | A right-biased version of 'ordNub'.
--
-- Example:
--
-- @
-- > ordNub [1,2,1]

            
Distribution/Simple/Utils.hs
-- Example:
--
-- @
-- > ordNub [1,2,1]
-- [1,2]
-- > ordNubRight [1,2,1]
-- [2,1]
-- @
ordNubRight :: (Ord a) => [a] -> [a]
ordNubRight = fst . foldr go ([], Set.empty)
  where
    go x p@(l, s) = if x `Set.member` s then p
                                        else (x:l, Set.insert x s)

-- | A right-biased version of 'listUnion'.

            
Distribution/Simple/Utils.hs
-- [4,3,2,1,1]
-- @
listUnionRight :: (Ord a) => [a] -> [a] -> [a]
listUnionRight a b = ordNubRight (filter (`Set.notMember` bSet) a) ++ b
  where
    bSet = Set.fromList b

equating :: Eq a => (b -> a) -> b -> b -> Bool
equating p x y = p x == p y

            
Distribution/Utils/NubList.hs
import Data.Monoid
#endif

import Distribution.Simple.Utils (ordNub, listUnion, ordNubRight, listUnionRight)

import qualified Text.Read as R

-- | NubList : A de-duplicated list that maintains the original order.
newtype NubList a =

            
Distribution/Utils/NubList.hs

-- | Smart constructor for the NubList type.
toNubList :: Ord a => [a] -> NubList a
toNubList list = NubList $ ordNub list

-- | Lift a function over lists to a function over NubLists.
overNubList :: Ord a => ([a] -> [a]) -> NubList a -> NubList a
overNubList f (NubList list) = toNubList . f $ list


            
Distribution/Utils/NubList.hs
-- | NubListR : A right-biased version of 'NubList'. That is @toNubListR
-- ["-XNoFoo", "-XFoo", "-XNoFoo"]@ will result in @["-XFoo", "-XNoFoo"]@,
-- unlike the normal 'NubList', which is left-biased. Built on top of
-- 'ordNubRight' and 'listUnionRight'.
newtype NubListR a =
    NubListR { fromNubListR :: [a] }
    deriving Eq

-- | Smart constructor for the NubListR type.

            
Distribution/Utils/NubList.hs

-- | Smart constructor for the NubListR type.
toNubListR :: Ord a => [a] -> NubListR a
toNubListR list = NubListR $ ordNubRight list

-- | Lift a function over lists to a function over NubListRs.
overNubListR :: Ord a => ([a] -> [a]) -> NubListR a -> NubListR a
overNubListR f (NubListR list) = toNubListR . f $ list


            
alms-0.6.9
4 matches
src/Statics/Constraint.hs
                            | (α, var) ← M.toList τftv
                            , var == 1 || var == -1 ]
        siblings g τftv (lnode@(n,_), var) pres (gpre, gsuc) = do
          lnodes ← liftM ordNub . runListT $ do
            pre ← ListT (return pres)
            sib ← ListT (return (gsuc g pre))
            guard $ sib /= n
            Just β ← return (Gr.lab g sib)
            guard $ M.lookup β τftv == Just var

            
src/Statics/Rename.hs
repeatedTVs :: Bogus b => [TyVar i] -> String -> R b
repeatedTVs []  _             = renameBug "repatedTVs" "got empty list"
repeatedTVs tvs@(tv:_) inwhat =
  let quals  = ordNub (tvqual <$> tvs)
      name   = tvname tv
      bothQs = length quals > 1
      callIt = if bothQs then [msg| `$name / '$name |] else [msg| $tv |]
      msg0   = repeatedMsg "Type variable" callIt inwhat (getLoc <$> tvs)
   in renameError $

            
src/Statics/Rename.hs
    td'  <- case td of
      TdAbs _ _ variances gs qe -> do
        qe' <- renameQExp qe
        gs' <- ordNub <$> mapM getTyvar gs
        return (tdAbs l' tvs' variances gs' qe')
      TdSyn _ _ -> renameBug "renameTyDec" "unexpected TdSyn"
      TdDat _ _ cons -> do
        case unique fst cons of
          Nothing -> return ()

            
src/Util.hs
  zip4, unzip4, zip5, unzip5,
  -- ** List operations
  mapCons, foldM1,
  lookupWithIndex, listNth, ordNub, partitionJust,
  -- *** Unfold with an accumulator
  unscanr, unscanl,
  -- *** Map in CPS
  mapCont, mapCont_,