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: 193

algebraic-prelude-0.1.1.0
4 matches
src/AlgebraicPrelude.hs
  Add a <> Add b = Add (a NA.+ b)
  {-# INLINE (<>) #-}

  sconcat = Add . sum1 . map runAdd
  {-# INLINE sconcat #-}

  stimes n  = Add . sinnum1p (P.fromIntegral n P.- 1) . runAdd
  {-# INLINE stimes #-}


            
src/AlgebraicPrelude.hs
  {-# INLINE stimes #-}

instance Monoidal a => Monoid (Add a) where
  mappend = (Semi.<>)
  {-# INLINE mappend #-}
  mempty = Add zero
  {-# INLINE mempty #-}
  mconcat = Add . sum . map runAdd
  {-# INLINE mconcat #-}

-- | @'Monoid'@ instances for @'Additive'@s.
--   N.B. Unlike @'WrapNum'@, @'P.Num'@ instance is
--   just inhereted from the unwrapped data.

            
src/AlgebraicPrelude.hs
  Mult a <> Mult b = Mult (a NA.* b)
  {-# INLINE (<>) #-}

  sconcat = Mult . product1 . map runMult
  {-# INLINE sconcat #-}

  stimes n = Mult . flip pow1p (P.fromIntegral n P.- 1) . runMult
  {-# INLINE stimes #-}


            
src/AlgebraicPrelude.hs
  {-# INLINE stimes #-}

instance Unital a => Monoid (Mult a) where
  mappend = (Semi.<>)
  {-# INLINE mappend #-}
  mempty = Mult one
  {-# INLINE mempty #-}
  mconcat = Mult . product . map runMult
  {-# INLINE mconcat #-}

L.makeWrapped ''WrapNum
L.makeWrapped ''WrapIntegral
L.makeWrapped ''WrapFractional

            
android-lint-summary-0.2.1
2 matches
Main.hs
        let env = AppEnv args' size
        files <- Find.find Find.always (Find.filePath Find.~~? pattern args') dir
        lintIssues <- concat <$> forM files (openXMLFile >=> readLintIssues)
        mapM_ putChunk $ runReader (formatLintIssues (formatter args') lintIssues) env

            
src/AndroidLintSummary.hs

formatLintIssues :: LintFormatter -> [LintIssue] -> Reader AppEnv [Chunk T.Text]
formatLintIssues NullLintFormatter _ = pure mempty
formatLintIssues SimpleLintFormatter issues = concat <$> mapM fmt sortedIssues
    where
        sortedIssues = sortOn ((* (-1)) . priority) issues

        fmt :: LintIssue -> Reader AppEnv [Chunk T.Text]
        fmt i =

            
basic-prelude-0.7.0
6 matches
src/BasicPrelude.hs
    (
      traverse
    , sequenceA
    , mapM
    , sequence
    )
  , for

    -- * Enhanced exports

            
src/BasicPrelude.hs

    -- * Enhanced exports
    -- ** Simpler name for a typeclassed operation
  , map
  , empty
  , (++)
  , concat
  , intercalate
    -- ** Strict implementation

            
src/BasicPrelude.hs
  , words
  , unlines
  , unwords
    -- prefer map = fmap instead
  , map
    -- prefer strict versions
  , sum
  , product
    -- prefer Foldable versions
  , elem

            
src/BasicPrelude.hs
-- CorePrelude doesn't export
import Control.Monad hiding
  ( -- Also exported by Data.Traversable.
    mapM
  , sequence
  )


import Data.Foldable (Foldable(..), elem, maximum, minimum, traverse_, sequenceA_, for_)

            
src/BasicPrelude.hs
                     _  -> x
#endif

-- | > map = fmap
map :: (Functor f) => (a -> b) -> f a -> f b
map = fmap

-- | > empty = mempty
empty :: Monoid w => w
empty = mempty
{-# DEPRECATED empty "Use mempty" #-}

            
src/BasicPrelude.hs

infixr 5 ++

-- | > (++) = mappend
(++) :: Monoid w => w -> w -> w
(++) = mappend

-- | > concat = mconcat
concat :: Monoid w => [w] -> w
concat = mconcat


            
github-utils-0.1.0
2 matches
PullRequestFiles.hs
filesByPullRequest :: String -> String -> IO [(Int, [File])]
filesByPullRequest user repo = do
  pullReqs <- fromEither "pull requests" =<< pullRequestsFor user repo
  mapM (combine . pullRequestNumber) pullReqs
  where
        combine prNum = (prNum, ) <$> (fromEither ("files for " ++ unpack (show prNum)) =<< pullRequestFiles user repo prNum)

prsTouchingFile :: String -> String -> String -> IO [Int]
prsTouchingFile file user repo = map fst . filter (any ((== file) . fileFilename) . snd) <$> filesByPullRequest user repo

            
PullRequestFiles.hs
        combine prNum = (prNum, ) <$> (fromEither ("files for " ++ unpack (show prNum)) =<< pullRequestFiles user repo prNum)

prsTouchingFile :: String -> String -> String -> IO [Int]
prsTouchingFile file user repo = map fst . filter (any ((== file) . fileFilename) . snd) <$> filesByPullRequest user repo

            
gnss-converters-0.3.52
14 matches
src/Data/RTCM3/SBP/MSM.hs
import Data.Bits
import Data.Conduit
import Data.IORef
import Data.List.Extra      hiding (filter, map, null, zip)
import Data.RTCM3
import Data.RTCM3.SBP.Time
import Data.RTCM3.SBP.Types
import Data.Vector          hiding (filter, length, map, zip)
import Data.Word
import SwiftNav.SBP

-- | Derive sender from station.
--

            
src/Data/RTCM3/SBP/MSM.hs

toCells :: MsmHeader -> [((Int, Word8), (Int, Word8))]
toCells hdr =
  map (\(i, (sat, sig)) -> (sat, (i, sig))) $
    zip [0..] $ masks (popCount (hdr ^. msmHeader_satelliteMask) * popCount (hdr ^. msmHeader_signalMask)) (hdr ^. msmHeader_cellMask) $ do
      sat <- zip [0..] $ mask (hdr ^. msmHeader_satelliteMask)
      sig <- mask (hdr ^. msmHeader_signalMask)
      pure (sat, sig)


            
src/Data/RTCM3/SBP/SSR.hs
gpsOrbitClockConverter :: MonadStore e m => Msg1060 -> Conduit i m [SBPMsg]
gpsOrbitClockConverter m = do
  time <- toGpsTimeSec $ m ^. msg1060_header . gpsOrbitClockCorrectionHeader_epochs
  yield $ flip map (m ^. msg1060_corrections) $ \c -> do
    let m' = MsgSsrOrbitClock
             { _msgSsrOrbitClock_time            = time
             , _msgSsrOrbitClock_sid             = GnssSignal
               { _gnssSignal_sat  = c ^. gpsOrbitClockCorrection_sat
               , _gnssSignal_code = 0

            
src/Data/RTCM3/SBP/SSR.hs
glonassOrbitClockConverter :: MonadStore e m => Msg1066 -> Conduit i m [SBPMsg]
glonassOrbitClockConverter m = do
  time <- toGlonassTimeSec $ m ^. msg1066_header . glonassOrbitClockCorrectionHeader_epochs
  yield $ flip map (m ^. msg1066_corrections) $ \c -> do
    let m' = MsgSsrOrbitClock
             { _msgSsrOrbitClock_time            = time
             , _msgSsrOrbitClock_sid             = GnssSignal
               { _gnssSignal_sat  = c ^. glonassOrbitClockCorrection_sat
               , _gnssSignal_code = 3

            
src/Data/RTCM3/SBP/SSR.hs
gpsCodeBiasConverter :: MonadStore e m => Msg1059 -> Conduit i m [SBPMsg]
gpsCodeBiasConverter m = do
  time <- toGpsTimeSec $ m ^. msg1059_header . gpsCodeBiasCorrectionHeader_epochs
  yield $ flip map (m ^. msg1059_corrections) $ \c -> do
    let m' = MsgSsrCodeBiases
             { _msgSsrCodeBiases_time            = time
             , _msgSsrCodeBiases_sid             = GnssSignal
               { _gnssSignal_sat  = c ^. gpsCodeBiasCorrection_sat
               , _gnssSignal_code = 0

            
src/Data/RTCM3/SBP/SSR.hs
               }
             , _msgSsrCodeBiases_update_interval = m ^. msg1059_header . gpsCodeBiasCorrectionHeader_updateInterval
             , _msgSsrCodeBiases_iod_ssr         = m ^. msg1059_header . gpsCodeBiasCorrectionHeader_iod
             , _msgSsrCodeBiases_biases          = flip map (c ^. gpsCodeBiasCorrection_codeBiases) $ \b -> CodeBiasesContent
               { _codeBiasesContent_code  = b ^. gpsCodeBias_signal
               , _codeBiasesContent_value = b ^. gpsCodeBias_codeBias
               }
             }
    SBPMsgSsrCodeBiases m' $ toSBP m' 61568

            
src/Data/RTCM3/SBP/SSR.hs
glonassCodeBiasConverter :: MonadStore e m => Msg1065 -> Conduit i m [SBPMsg]
glonassCodeBiasConverter m = do
  time <- toGlonassTimeSec $ m ^. msg1065_header . glonassCodeBiasCorrectionHeader_epochs
  yield $ flip map (m ^. msg1065_corrections) $ \c -> do
    let m' = MsgSsrCodeBiases
             { _msgSsrCodeBiases_time            = time
             , _msgSsrCodeBiases_sid             = GnssSignal
               { _gnssSignal_sat  = c ^. glonassCodeBiasCorrection_sat
               , _gnssSignal_code = 3

            
src/Data/RTCM3/SBP/SSR.hs
               }
             , _msgSsrCodeBiases_update_interval = m ^. msg1065_header . glonassCodeBiasCorrectionHeader_updateInterval
             , _msgSsrCodeBiases_iod_ssr         = m ^. msg1065_header . glonassCodeBiasCorrectionHeader_iod
             , _msgSsrCodeBiases_biases          = flip map (c ^. glonassCodeBiasCorrection_codeBiases) $ \b -> CodeBiasesContent
               { _codeBiasesContent_code  = b ^. glonassCodeBias_signal
               , _codeBiasesContent_value = b ^. glonassCodeBias_codeBias
               }
             }
    SBPMsgSsrCodeBiases m' $ toSBP m' 61568

            
src/Data/RTCM3/SBP/SSR.hs
gpsPhaseBiasConverter :: MonadStore e m => Msg1265 -> Conduit i m [SBPMsg]
gpsPhaseBiasConverter m = do
  time <- toGpsTimeSec $ m ^. msg1265_header . gpsPhaseBiasCorrectionHeader_epochs
  yield $ flip map (m ^. msg1265_corrections) $ \c -> do
    let m' = MsgSsrPhaseBiases
             { _msgSsrPhaseBiases_time            = time
             , _msgSsrPhaseBiases_sid             = GnssSignal
               { _gnssSignal_sat  = c ^. gpsPhaseBiasCorrection_sat
               , _gnssSignal_code = 0

            
src/Data/RTCM3/SBP/SSR.hs
             , _msgSsrPhaseBiases_mw_consistency  = bool 0 1 $ m ^. msg1265_header . gpsPhaseBiasCorrectionHeader_mw
             , _msgSsrPhaseBiases_yaw             = c ^. gpsPhaseBiasCorrection_yawAngle
             , _msgSsrPhaseBiases_yaw_rate        = c ^. gpsPhaseBiasCorrection_yawRate
             , _msgSsrPhaseBiases_biases          = flip map (c ^. gpsPhaseBiasCorrection_phaseBiases) $ \b -> PhaseBiasesContent
               { _phaseBiasesContent_code                       = b ^. gpsPhaseBias_signal
               , _phaseBiasesContent_integer_indicator          = bool 0 1 $ b ^. gpsPhaseBias_integer
               , _phaseBiasesContent_widelane_integer_indicator = b ^. gpsPhaseBias_wideLaneInteger
               , _phaseBiasesContent_discontinuity_counter      = b ^. gpsPhaseBias_discontinuityCounter
               , _phaseBiasesContent_bias                       = b ^. gpsPhaseBias_phaseBias

            
src/Data/RTCM3/SBP/SSR.hs
glonassPhaseBiasConverter :: MonadStore e m => Msg1266 -> Conduit i m [SBPMsg]
glonassPhaseBiasConverter m = do
  time <- toGlonassTimeSec $ m ^. msg1266_header . glonassPhaseBiasCorrectionHeader_epochs
  yield $ flip map (m ^. msg1266_corrections) $ \c -> do
    let m' = MsgSsrPhaseBiases
             { _msgSsrPhaseBiases_time            = time
             , _msgSsrPhaseBiases_sid             = GnssSignal
               { _gnssSignal_sat  = c ^. glonassPhaseBiasCorrection_sat
               , _gnssSignal_code = 3

            
src/Data/RTCM3/SBP/SSR.hs
             , _msgSsrPhaseBiases_mw_consistency  = bool 0 1 $ m ^. msg1266_header . glonassPhaseBiasCorrectionHeader_mw
             , _msgSsrPhaseBiases_yaw             = c ^. glonassPhaseBiasCorrection_yawAngle
             , _msgSsrPhaseBiases_yaw_rate        = c ^. glonassPhaseBiasCorrection_yawRate
             , _msgSsrPhaseBiases_biases          = flip map (c ^. glonassPhaseBiasCorrection_phaseBiases) $ \b -> PhaseBiasesContent
               { _phaseBiasesContent_code                       = b ^. glonassPhaseBias_signal
               , _phaseBiasesContent_integer_indicator          = bool 0 1 $ b ^. glonassPhaseBias_integer
               , _phaseBiasesContent_widelane_integer_indicator = b ^. glonassPhaseBias_wideLaneInteger
               , _phaseBiasesContent_discontinuity_counter      = b ^. glonassPhaseBias_discontinuityCounter
               , _phaseBiasesContent_bias                       = b ^. glonassPhaseBias_phaseBias

            
test/Test/Data/RTCM3/SBP.hs
  ( tests
  ) where

import BasicPrelude                      hiding (map)
import Control.Lens
import Data.Aeson
import Data.Aeson.Encode.Pretty
import Data.ByteString.Lazy              hiding (ByteString, map)
import Data.Conduit
import Data.Conduit.Binary
import Data.Conduit.List
import Data.Conduit.Serialization.Binary
import Data.RTCM3.SBP

            
test/Test/Data/RTCM3/SBP.hs
    sourceFile f
      =$= conduitDecode
      =$= awaitForever converter
      =$= map encodeLine
      $$  sinkFile t

goldenFileTest :: TestName -> FilePath -> FilePath -> TestTree
goldenFileTest name s d = do
  let n = ("test/golden" </>)

            
hackage-proxy-0.3.0.1
2 matches
HackageProxy.hs
        src' <- if isTarball res
            then do
                lbs <- L.fromChunks <$> lazyConsume (src $= ungzip)
                entries <- mapEntries tweakEntry $ Tar.read lbs
                return $ yield $ Chunk $ fromLazyByteString $ compress $ Tar.write entries
            else return $ mapOutput (Chunk . fromByteString) src

        return (resStatus, resHeaders, src')
      where
        isTarball res =
            ".tar.gz" `S.isSuffixOf` rawPathInfo waiReq

            
HackageProxy.hs
        lbs' = tweakCabal tcs lbs
    tweakEntry e = e

    mapEntries f (Tar.Next entry rest) = (f entry:) <$> mapEntries f rest
    mapEntries _ Tar.Done = return []
    mapEntries _ (Tar.Fail e) = throwIO e

safeResponseHeaders :: HashSet (CI ByteString)
safeResponseHeaders = HashSet.fromList
    [ "content-type"
    , "etag"