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: more than 1000

4Blocks-0.2
4 matches
Core/ColouredPoint.hs
getLinesOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getLinesOfColouredPoints colouredPoints = linesOfColouredPoints
  where 
    sortedByYColouredPoints = sortBy (compare `on` getColouredPointY) colouredPoints
    groupedColouredPoints = groupBy (\(x1,y1,c1) (x2,y2,c2) -> (y1==y2)) sortedByYColouredPoints
    reversedGroupedColouredPoints = reverse groupedColouredPoints
    linesOfColouredPoints = reversedGroupedColouredPoints

getSortedLinesOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getSortedLinesOfColouredPoints colouredPoints = linesOfColouredPoints

            
Core/ColouredPoint.hs
getSortedLinesOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getSortedLinesOfColouredPoints colouredPoints = linesOfColouredPoints
  where 
    sortedByYColouredPoints = sortBy (compare `on` getColouredPointY) colouredPoints
    groupedColouredPoints = groupBy (\(x1,y1,c1) (x2,y2,c2) -> (y1==y2)) sortedByYColouredPoints
    sortedByXYColouredPointsLines = map (sortBy (compare `on` getColouredPointX)) groupedColouredPoints
    reversedGroupedColouredPoints = reverse sortedByXYColouredPointsLines
    linesOfColouredPoints = reversedGroupedColouredPoints
    
getColumnsOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getColumnsOfColouredPoints colouredPoints = columnsOfColouredPoints
  where

            
Core/ColouredPoint.hs
getColumnsOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getColumnsOfColouredPoints colouredPoints = columnsOfColouredPoints
  where
    sortedByXColouredPoints = sortBy (compare `on` getColouredPointX) colouredPoints
    groupedColouredPoints = groupBy (\(x1,y1,c1) (x2,y2,c2) -> (x1==x2)) sortedByXColouredPoints    
    columnsOfColouredPoints = groupedColouredPoints
    
getSortedColumnsOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getSortedColumnsOfColouredPoints colouredPoints = columnsOfColouredPoints
  where

            
Core/ColouredPoint.hs
getSortedColumnsOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getSortedColumnsOfColouredPoints colouredPoints = columnsOfColouredPoints
  where
    sortedByXColouredPoints = sortBy (compare `on` getColouredPointX) colouredPoints
    groupedColouredPoints = groupBy (\(x1,y1,c1) (x2,y2,c2) -> (x1==x2)) sortedByXColouredPoints
    sortedByXYColouredPointsLines = map (sortBy (compare `on` getColouredPointY)) groupedColouredPoints
    columnsOfColouredPoints = sortedByXYColouredPointsLines
    
getColouredPointsFromLines :: [[ColouredPoint]] -> [ColouredPoint]
getColouredPointsFromLines = concat

convertAllColouredPointsToColour :: Colour -> [ColouredPoint] -> [ColouredPoint]

            
ADPfusion-0.5.2.2
3 matches
ADP/Fusion/SynVar/Fill.hs
import qualified Data.Vector.Fusion.Stream.Monadic as SM
import           System.IO.Unsafe
import           Control.Monad (when,forM_)
import           Data.List (nub,sort,group)
import qualified Data.Vector.Unboxed as VU
import           Data.Proxy
import qualified GHC.Generics as G
import qualified Data.Typeable as T
import qualified Data.Data as D

            
ADP/Fusion/SynVar/Fill.hs
  mutateTables h mrph tt@(_:.TW (ITbl _ _ _ arr) _) = do
    let (from,to) = bounds arr
    -- TODO (1) find the set of orders for the synvars
    let !tbos = VU.fromList . nub . sort $ tableBigOrder tt
    let !tlos = VU.fromList . nub . sort $ tableLittleOrder tt
    VU.forM_ tbos $ \bo ->
      case (VU.length tlos) of
        1 -> let lo = VU.head tlos
             in  flip SM.mapM_ (streamUp from to) $ \k ->
                  mutateCell h bo lo (inline mrph) tt to k

            
ADP/Fusion/SynVar/Fill.hs
  => t
  -> m t
mutateTablesNew ts = do
  -- sort the tables according to [bigorder,type,littleorder]. For each
  -- @bigorder@, we should have only one @type@ and can therefor do the
  -- following (i) get subset of the @ts@, (ii) use outermost of @ts@ to
  -- get bounds, (iii) fill these tables
  let !tbos = VU.fromList . nub . sort $ tableBigOrder ts
  let ds = L.sort $ asDyn ts
  let goM :: (Monad m, PrimMonad m) => [Q] -> m ()
      goM [] = return ()
      goM xs = do
        ys <- fillWithDyn xs ts
        if null ys

            
ADPfusionForest-0.0.0.1
10 matches
ADP/Fusion/Core/ForestAlign/PermuteRightLinear.hs
-- subset of children of each node with a linear index. The @mkLookUp@
-- function generates this.
--
-- TODO use 'sortedSubForests' such that the partial order matches the
-- linearized order.

mkLookUp :: Forest Pre v a -> LookUp
mkLookUp f = HM.fromList . flip P.zip [0..] $ sortedSubForests f
{-
mkLookUp f = HM.fromList . flip P.zip [0..] . go $ roots f : (VG.toList $ children f)
  where go :: [VU.Vector Int] -> [VU.Vector Int]
        go = P.map VG.fromList
           . S.toList . S.fromList

            
ADP/Fusion/Core/ForestAlign/PermuteRightLinear.hs

-- cull from p the non-needed parts via lf ht
streamUpMk p lf ht z =
      -- all sorted subsets of subforests in the forest (have a beer).
  let ssf = sortedSubForests p
      -- extract the highest possible index, which by definition is an
      -- @E index@.
      E ht' = ht
  in  {- trace ("XXX" P.++ show ssf) . -} return $ SE' ht' (z,ssf)
{-# Inline [0] streamUpMk #-}

            
ADP/Fusion/Core/ForestAlign/PermuteRightLinear.hs
{-# Inline [0] streamUpMk #-}

streamDownMk p lf ht z =
  let ssf = reverse $ VG.empty : sortedSubForests p
  in  return $ Stp (z,ssf)
{-# Inline [0] streamDownMk #-}

-- |


            
ADP/Fusion/Core/ForestAlign/PermuteRightLinear.hs
-- there is no subforest left to work with. We are done.
streamUpStep p lk lf ht (Stp (z,[]))
  = return $ SM.Done
-- We have at least one sorted subforest @x:@ to deal with. By definition,
-- sets of size 0 do not happen. This is enforced by @sortedSubForests@
-- which produces vectors of @size >= 1@.
streamUpStep p lk lf ht (Stp (z,x:xs))
  -- subsets of size one are trees. They first create an @E@psilon object.
  -- Then they create a @T@ree object, followed by a @F@orest with one tree.
  | sz == 1 = return $ SM.Yield (z:.TreeIxR p lk (E i)) (ST (z,x:xs))

            
ADP/Fusion/Core/ForestAlign/PermuteRightLinear.hs
          step (OIEE svS@(SvS s tt ii) (E i)) = return $ Skip (OIET svS (E i))
          step (OIET svS@(SvS s tt ii) (E i)) | Just l <- leftSibling (rightMostLeaf frst (getTFEIx utfe)) frst i =
            return $ Yield (SvS s (tt:.TreeIxR frst jl (T l)) (ii:.:RiTirO (T l))) 
                           (OIEF svS $ if i == (getTFEIx utfe) then (L.map F $ sortedSubForests frst) else [])
          step (OIET svS@(SvS s tt ii) (E i)) = return Done
          step (OIEF svS@(SvS s tt ii) []) = return Done
          step (OIEF svS@(SvS s tt ii) (x:xs)) =
            return $ Yield (SvS s (tt:.TreeIxR frst jl x) (ii:.:RiTirO x)) (OIEF svS xs) 
          step (OIT svS@(SvS s tt ii) (T i)) =

            
ADP/Fusion/SynVar/Indices/ForestEdit/LeftLinear.hs
import           Prelude hiding (map)
import qualified Data.Vector.Generic as VG
import           Debug.Trace
import           Data.List (sort,nub)

import           ADP.Fusion.Core
import           Data.Forest.Static
import           Data.PrimitiveArray hiding (map)


            
ADP/Fusion/SynVar/Indices/ForestEdit/LeftLinear.hs

allLeftBoundForests frst lc k = ls
  where rs = goR k
        ls = nub $ sort [ lc VG.! z | z <- rs ]
        goR (-1) = []
        goR k    = k : goR (parent frst VG.! k)

instance (MinSize c) => TableStaticVar (u I) c (TreeIxL Post v a O) where 
  tableStaticVar _ _ (OStatic  ())   _ = ORightOf   ()

            
src/AffineAlignNewickTreesSmall.hs
import           Control.Monad(forM_,unless)
import           Data.Char (toLower)
import           Data.List (nub,tails)
import           Data.List (sortBy)
import           Data.Ord (comparing)
import           Data.Vector.Fusion.Util
import           Debug.Trace
import           Numeric.Log
import qualified Data.Text as Text

            
src/AffineAlignNewickTreesSmall.hs
-- big orders.
--
-- The little-order influences per-cell calculations. Cells with the same
-- index are sorted by order and those with a smaller index calculated
-- first.
--
-- For this calculation we have the following:
--
-- @EE@ has only one rule: @EE -> ε@, the full table is filled before any

            
src/AlignNewickTrees.hs
import           Control.Monad(forM_, unless)
import           Data.Char (toLower)
import           Data.List (nub, tails)
import           Data.List (sortBy)
import           Data.Ord (comparing)
import           Data.Vector.Fusion.Util
import           Debug.Trace
import           Numeric.Log
import qualified Data.Text as Text

            
AERN-Basics-2011.1.0.1
4 matches
src/Numeric/AERN/Basics/NumericOrder/Arbitrary.hs
              do
              unambiguousConstraints <- elements consistentUnambiguousConstraints
              let cMap = Map.fromList unambiguousConstraints
              let sortedIndices = List.sortBy (turnIntoOrdering cMap) indices
              let sortedIndicesGrouped = List.groupBy (turnIntoEquality cMap) sortedIndices
              ds <- vectorOf (3 * (length sortedIndicesGrouped)) givenArbitrary
              seed <- arbitrary
              let dsDistinctSorted = getNDistinctSorted seed (length sortedIndicesGrouped) ds
                                      -- here we rely on the following property:
                                      -- it is very unlikely to get less than n distinct
                                      -- elements among 3*n elements generated by givenArbitrary 
              return $ 
                  map snd $ 

            
src/Numeric/AERN/Basics/NumericOrder/Arbitrary.hs
                                      -- elements among 3*n elements generated by givenArbitrary 
              return $ 
                  map snd $ 
                      List.sort $ 
                          concat $ 
                              zipWith zip sortedIndicesGrouped $ 
                                  map repeat dsDistinctSorted
       where
       consistentUnambiguousConstraints =
           pickConsistentOrderings permittedInLinearOrder indices constraints
       turnIntoOrdering cMap a b =

            
src/Numeric/AERN/Misc/List.hs
import qualified Data.Set as Set
import qualified Data.Map as Map

sortUsing :: (Ord b) => (a -> b) -> [a] -> [a]
sortUsing f =
    List.sortBy compareF
    where
    compareF a b = compare (f a) (f b)

{-|
    Eg: @combinations [[1,2,3],[4,5],[7]] = [[1,4,7], [1,5,7], [2,4,7], [2,5,7], [3,4,7], [3,5,7]]@

            
src/Numeric/AERN/Misc/QuickCheck.hs
    return $ permuteBy (nums :: [Int]) elems
    where
    permuteBy nums elems =
        map snd $ List.sort $ zip nums elems

            
AERN-RnToRm-0.5.0.1
1 matches
src/Data/Number/ER/RnToRm/UnitDom/ChebyshevBase/Polynom/Reduce.hs
        Map.fromList $ map snd $ largeCoeffTerms
    (smallCoeffTerms, largeCoeffTerms) = 
                splitAt (Map.size coeffs - maxTermCount) $
                    List.sort $ 
                        map (\(t,c)->(abs c, (t,c))) $ Map.toList coeffs

chplReduceTermCountDown m = fst . chplReduceTermCount m
chplReduceTermCountUp m = snd . chplReduceTermCount m


            
Agda-2.6.0.1
8 matches
src/full/Agda/Auto/Auto.hs
           Just score -> Just (prettyShow cn, score)
         ) modnames

      let sorthits = List.sortBy (\(_, (pa1, pb1)) (_, (pa2, pb2)) -> case compare pa2 pa1 of {EQ -> compare pb1 pb2; o -> o}) hits
      if listmode || pick == (-1) then
        let pick' = max 0 pick
        in if pick' >= length sorthits then
             stopWithMsg $ insuffcands $ length sorthits
            else
             let showhits = take 10 $ drop pick' sorthits
             in stopWithMsg $ "Listing candidate(s) " ++ show pick' ++ "-" ++ show (pick' + length showhits - 1) ++ " (found " ++ show (length sorthits) ++ " in total)\n" ++
                           unlines (map (\(i, (cn, _)) -> show i ++ "  " ++ cn) (zip [pick'..pick' + length showhits - 1] showhits))
       else
        if pick >= length sorthits then
         stopWithMsg $ insuffcands $ length sorthits
        else
         return $ AutoResult (Refinement $ fst $ sorthits !! pick) Nothing
  where
    agsyinfo ticks = ""

-- Get the functions and axioms defined in the same module as @def@.
autohints :: AutoHintMode -> I.MetaId -> Maybe AN.QName -> TCM [Hint]

            
src/full/Agda/Compiler/Backend.hs
      "No backend called '" ++ name ++ "' " ++
      "(installed backends: " ++
      List.intercalate ", "
        (List.sort $ otherBackends ++
                     [ backendName b | Backend b <- backends ]) ++
      ")"

-- | Backends that are not included in the state, but still available
--   to the user.

            
src/full/Agda/Compiler/Backend.hs
  case r of
    Skip m         -> return m
    Recompile menv -> do
      defs <- map snd . sortDefs <$> curDefs
      res  <- mapM (compileDef' backend env menv isMain <=< instantiateFull) defs
      postModule backend env menv isMain (iModuleName i) res

compileDef' :: Backend' opts env menv mod def -> env -> menv -> IsMain -> Definition -> TCM def
compileDef' backend env menv isMain def = setCurrentRange (defName def) $ compileDef backend env menv isMain def

            
src/full/Agda/Compiler/Common.hs
curDefs :: TCM Definitions
curDefs = fmap (HMap.filter (not . defNoCompilation)) $ (^. sigDefinitions) <$> curSig

sortDefs :: Definitions -> [(QName, Definition)]
sortDefs defs =
  -- The list is sorted to ensure that the order of the generated
  -- definitions does not depend on things like the number of bits
  -- in an Int (see Issue 1900).
  List.sortBy (compare `on` fst) $
  HMap.toList defs

sigMName :: Signature -> ModuleName
sigMName sig = case Map.keys (sig ^. sigSections) of
  []    -> __IMPOSSIBLE__

            
src/full/Agda/Compiler/Common.hs
  visited <- List.map (iModuleName . miInterface) . Map.elems <$>
    getVisitedModules
  -- find the module with the longest matching prefix to m
  let ms = sortBy (compare `on` (length . mnameToList)) $
       List.filter (\ m' -> mnameToList m' `isPrefixOf` mnameToList m) visited
  case ms of
    (m' : _) -> return m'
    -- if we did not get anything, it may be because m is a section
    -- (a module _ ), see e.g. #1866

            
src/full/Agda/Compiler/JS/Compiler.hs
  kit <- coinductionKit
  m <- (jsMod <$> curMName)
  is <- map jsMod <$> (map fst . iImportedModules <$> curIF)
  es <- catMaybes <$> (mapM (definition kit) =<< (sortDefs <$> curDefs))
  return $ Module m (reorder es) main
  where
    main = case isMain of
      IsMain -> Just $ Apply (Lookup Self $ MemberId "main") [Lambda 1 emp]
      NotMain -> Nothing

            
src/full/Agda/Compiler/MAlonzo/Compiler.hs
  mnames = Set.elems <$> useTC stImportedModules

  uniq :: [HS.ModuleName] -> [HS.ModuleName]
  uniq = List.map head . List.group . List.sort

--------------------------------------------------
-- Main compiling clauses
--------------------------------------------------


            
src/full/Agda/Compiler/MAlonzo/Pragmas.hs
        _ -> return Nothing
    _ -> return Nothing

-- | Get content of @FOREIGN GHC@ pragmas, sorted by 'KindOfForeignCode':
--   file header pragmas, import statements, rest.
foreignHaskell :: TCM ([String], [String], [String])
foreignHaskell = partitionByKindOfForeignCode classifyForeign
    . map getCode . fromMaybe [] . Map.lookup ghcBackendName . iForeignCode <$> curIF
  where getCode (ForeignCode _ code) = code