Aelve Codesearch

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

total matches: 35

clash-ghc-0.99.3
2 matches
src-bin/Clash/Main.hs
  where
    oneError f =
        "unrecognised flag: " ++ f ++ "\n" ++
        (case match f (nubSort allNonDeprecatedFlags) of
            [] -> ""
            suggs -> "did you mean one of:\n" ++ unlines (map ("  " ++) suggs))
    -- fixes #11789
    -- If the flag contains '=',
    -- this uses both the whole and the left side of '=' for comparing.

            
src-bin-841/Clash/Main.hs
  where
    oneError f =
        "unrecognised flag: " ++ f ++ "\n" ++
        (case match f (nubSort allNonDeprecatedFlags) of
            [] -> ""
            suggs -> "did you mean one of:\n" ++ unlines (map ("  " ++) suggs))
    -- fixes #11789
    -- If the flag contains '=',
    -- this uses both the whole and the left side of '=' for comparing.

            
darcs-2.14.2
7 matches
src/Darcs/UI/Commands/Add.hs
import Control.Exception ( catch, IOException )
import Control.Monad ( when, unless )
import Data.List ( (\\), nub )
import Data.List.Ordered ( nubSort )
import Data.Maybe ( isNothing, maybeToList )
import Darcs.Util.Printer ( text )
import Darcs.Util.Tree ( Tree, findTree, expand )
import Darcs.Util.Path
    ( floatPath, anchorPath, parents

            
src/Darcs/UI/Commands/Add.hs
    flist' <- if parseFlags O.recursive opts
              then expandDirs (includeBoring opts) origfiles
              else return origfiles
    let flist = nubSort (parlist ++ toFilePath `map` flist')
    nboring <- if includeBoring opts
               then return darcsdirFilter
               else boringFileFilter
    mapM_ (putWarning opts . text . ((msgSkipping msgs ++ " boring file ")++)) $
        flist \\ nboring flist

            
src/Darcs/UI/Commands/MarkConflicts.hs
import Darcs.Prelude

import System.Exit ( exitSuccess )
import Data.List.Ordered ( nubSort, isect )
import Control.Monad ( when, unless )
import Control.Exception ( catch, IOException )

import Darcs.Util.Prompt ( promptYorn )
import Darcs.Util.SignalHandler ( withSignalsBlocked )

            
src/Darcs/UI/Commands/MarkConflicts.hs

-- | Convert a list of 'SubPath's to a 'PathSet'.
sps2ps :: [SubPath] -> PathSet
sps2ps = Only . nubSort

-- | Convert a list of repo paths to a 'PathSet'.
-- Partial function! Use only with repo paths.
fps2ps :: [FilePath] -> PathSet
fps2ps = sps2ps . map fp2sp

            
src/Darcs/UI/Commands/MarkConflicts.hs
-- | Lift a function transforming a list of 'FilePath' to one that
-- transforms a 'PathSet'.
liftToPathSet :: ([FilePath] -> [FilePath]) -> PathSet -> PathSet
liftToPathSet f = fmap (nubSort . map fp2sp . f . map sp2fp)

-- | Convert a 'FilePath' to a 'SubPath'.
--
-- Note: Should call this only with paths we get from the repository.
-- This guarantees that they are relative (to the repo dir).

            
src/Darcs/UI/Commands/WhatsNew.hs
import Control.Monad.State ( evalStateT, liftIO )
import Darcs.Util.Tree ( Tree )
import System.Exit ( ExitCode (..), exitSuccess, exitWith )
import Data.List.Ordered ( nubSort )

import Darcs.Patch
    ( PrimOf, PrimPatch, RepoPatch
    , applyToTree, plainSummaryPrims, primIsHunk
    )

            
src/Darcs/UI/Commands/WhatsNew.hs
    let scan = scanKnown (lookForAdds opts) (O.includeBoring ? opts)
    existing_files <- do
      files <- if null args then return Nothing
               else Just . nubSort <$> fixSubPaths fps args
      when (files == Just []) $ fail "No valid arguments were given."
      files' <- traverse
        (filterExistingPaths
          repo (verbosity ? opts) (useIndex ? opts) scan (lookForMoves opts))
        files

            
data-easy-0.7.0
3 matches
src/Data/Easy.hs

  -- ** List
  -- | Data.Maybe counterparts for List, plus some extra functions.
  -- One special note for 'nubSort': this is the only \'optimized\'
  -- function in this library, mainly because the original
  -- @nub . sort@ performance is so bad.
  -- Nevertheless, never forget that you should probably not be using
  -- lists anyhow:
  -- <http://www.haskell.org/haskellwiki/Performance>

            
src/Data/Easy.hs
  , mapList
  , singleton
  , mapV
  , nubSort
  , nubSort'
  , atLeast

  -- ** Tuple Pairs
  -- | Monoid class restriction will be used in tuple elements whenever
  -- necessary to create the concept of \'valid\' value.

            
src/Data/Easy.hs
--
-- /Note/: You shold probably be using "Data.Set".
--
-- > nubSort = Set.toAscList . Set.fromList
--
nubSort :: (Ord a) => [a] -> [a]
nubSort = Set.toAscList . Set.fromList

-- | Sort, nub (remove duplicates) and remove initial empty value, if it
-- exists. See 'nubSort'.
nubSort' :: (Ord a, Monoid a) => [a] -> [a]
nubSort' lst = case nubSort lst of
  []     -> []
  (x:xs) -> if isEmpty x then xs else x:xs

-- | Lazy length: determine if a list has a given size without computing
-- all of its elements.

            
extra-1.6.17
3 matches
src/Data/List/Extra.hs
    groupSort, groupSortOn, groupSortBy,
    nubOrd, nubOrdBy, nubOrdOn,
    nubOn, groupOn,
    nubSort, nubSortBy, nubSortOn,
    maximumOn, minimumOn,
    disjoint, allSame, anySame,
    repeatedly, for, firstJust,
    concatUnzip, concatUnzip3,
    zipFrom, zipWithFrom,

            
src/Data/List/Extra.hs
chunksOf i xs = repeatedly (splitAt i) xs


-- | /O(n log n)/. The 'nubSort' function sorts and removes duplicate elements from a list.
-- In particular, it keeps only the first occurrence of each element.
--
-- > nubSort "this is a test" == " aehist"
-- > \xs -> nubSort xs == nub (sort xs)
nubSort :: Ord a => [a] -> [a]
nubSort = nubSortBy compare

-- | A version of 'nubSort' which operates on a portion of the value.
--
-- > nubSortOn length ["a","test","of","this"] == ["a","of","test"]
nubSortOn :: Ord b => (a -> b) -> [a] -> [a]
nubSortOn f = nubSortBy (compare `on` f)

-- | A version of 'nubSort' with a custom predicate.
--
-- > nubSortBy (compare `on` length) ["a","test","of","this"] == ["a","of","test"]
nubSortBy :: (a -> a -> Ordering) -> [a] -> [a]
nubSortBy cmp = f . sortBy cmp
    where f (x1:x2:xs) | cmp x1 x2 == EQ = f (x1:xs)
          f (x:xs) = x : f xs
          f [] = []

-- | /O(n log n)/. The 'nubOrd' function removes duplicate elements from a list.

            
src/Extra.hs
    writeIORef', atomicWriteIORef', atomicModifyIORef_, atomicModifyIORef'_,
    -- * Data.List.Extra
    -- | Extra functions available in @"Data.List.Extra"@.
    lower, upper, trim, trimStart, trimEnd, word1, line1, escapeHTML, escapeJSON, unescapeHTML, unescapeJSON, dropEnd, takeEnd, splitAtEnd, breakEnd, spanEnd, dropWhileEnd', takeWhileEnd, stripSuffix, stripInfix, stripInfixEnd, dropPrefix, dropSuffix, wordsBy, linesBy, breakOn, breakOnEnd, splitOn, split, chunksOf, notNull, list, unsnoc, cons, snoc, drop1, mconcatMap, enumerate, groupSort, groupSortOn, groupSortBy, nubOrd, nubOrdBy, nubOrdOn, nubOn, groupOn, nubSort, nubSortBy, nubSortOn, maximumOn, minimumOn, disjoint, allSame, anySame, repeatedly, for, firstJust, concatUnzip, concatUnzip3, zipFrom, zipWithFrom, replace, merge, mergeBy,
    -- * Data.List.NonEmpty.Extra
    -- | Extra functions available in @"Data.List.NonEmpty.Extra"@.
    (|:), (|>), appendl, appendr, maximum1, minimum1, maximumBy1, minimumBy1, maximumOn1, minimumOn1,
    -- * Data.Tuple.Extra
    -- | Extra functions available in @"Data.Tuple.Extra"@.

            
filepattern-0.1.1
1 matches
test/Test/Util.hs

unsafeTestData :: IO TestData
unsafeTestData = atomicModifyIORef' testData $ \t -> (TestData 0 [] [], f t)
    where f TestData{..} = TestData testDataCases (nubSort $ reverse testDataPats) (nubSort $ reverse testDataPaths)


---------------------------------------------------------------------
-- TEST UTILITIES


            
ghc-lib-8.8.0.20190723
1 matches
compiler/main/GhcMake.hs

unitIdsToCheck :: DynFlags -> [UnitId]
unitIdsToCheck dflags =
  nubSort $ concatMap goUnitId (explicitPackages (pkgState dflags))
 where
  goUnitId uid =
    case splitUnitIdInsts uid of
      (_, Just indef) ->
        let insts = indefUnitIdInsts indef