Search is not available for this dataset
repo_name string | path string | license string | full_code string | full_size int64 | uncommented_code string | uncommented_size int64 | function_only_code string | function_only_size int64 | is_commented bool | is_signatured bool | n_ast_errors int64 | ast_max_depth int64 | n_whitespaces int64 | n_ast_nodes int64 | n_ast_terminals int64 | n_ast_nonterminals int64 | loc int64 | cycloplexity int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/truncate_1.hs | mit | primMinusNatS x Zero = x | 24 | primMinusNatS x Zero = x | 24 | primMinusNatS x Zero = x | 24 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
kawu/factorized-tag-parser | src/NLP/Partage/Format/Brackets.hs | bsd-2-clause | -- | Parse a supertagged file.
parseSuperProb :: L.Text -> Super
parseSuperProb
= map (parseSuperSentProb . L.toStrict)
. filter realSent
. L.splitOn "\n\n"
where
realSent = not . L.null | 198 | parseSuperProb :: L.Text -> Super
parseSuperProb
= map (parseSuperSentProb . L.toStrict)
. filter realSent
. L.splitOn "\n\n"
where
realSent = not . L.null | 167 | parseSuperProb
= map (parseSuperSentProb . L.toStrict)
. filter realSent
. L.splitOn "\n\n"
where
realSent = not . L.null | 133 | true | true | 2 | 8 | 40 | 66 | 30 | 36 | null | null |
erantapaa/tetris-packing | src/Lib.hs | bsd-3-clause | nCells :: Solution -> Int
nCells (Solution _ ps) = sum $ map (length . snd) ps | 78 | nCells :: Solution -> Int
nCells (Solution _ ps) = sum $ map (length . snd) ps | 78 | nCells (Solution _ ps) = sum $ map (length . snd) ps | 52 | false | true | 0 | 9 | 16 | 47 | 22 | 25 | null | null |
brendanhay/gogol | gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'VideoSettings' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'vsKind'
--
-- * 'vsCompanionSettings'
--
-- * 'vsObaSettings'
--
-- * 'vsObaEnabled'
--
-- * 'vsTranscodeSettings'
--
-- * 'vsDurationSeconds'
--
-- * 'vsOrientation'
--
-- * 'vsSkippableSettings'
videoSettings
:: VideoSettings
videoSettings =
VideoSettings'
{ _vsKind = Nothing
, _vsCompanionSettings = Nothing
, _vsObaSettings = Nothing
, _vsObaEnabled = Nothing
, _vsTranscodeSettings = Nothing
, _vsDurationSeconds = Nothing
, _vsOrientation = Nothing
, _vsSkippableSettings = Nothing
} | 706 | videoSettings
:: VideoSettings
videoSettings =
VideoSettings'
{ _vsKind = Nothing
, _vsCompanionSettings = Nothing
, _vsObaSettings = Nothing
, _vsObaEnabled = Nothing
, _vsTranscodeSettings = Nothing
, _vsDurationSeconds = Nothing
, _vsOrientation = Nothing
, _vsSkippableSettings = Nothing
} | 335 | videoSettings =
VideoSettings'
{ _vsKind = Nothing
, _vsCompanionSettings = Nothing
, _vsObaSettings = Nothing
, _vsObaEnabled = Nothing
, _vsTranscodeSettings = Nothing
, _vsDurationSeconds = Nothing
, _vsOrientation = Nothing
, _vsSkippableSettings = Nothing
} | 300 | true | true | 0 | 7 | 142 | 90 | 60 | 30 | null | null |
michaelt/streaming | src/Streaming/Internal.hs | bsd-3-clause | repeatsM :: (Monad m, Functor f) => m (f ()) -> Stream f m r
repeatsM mf = loop where
loop = Effect $ do
f <- mf
return $ Step $ fmap (\_ -> loop) f
{- | Repeat a functorial layer, command or instruction a fixed number of times.
> replicates n = takes n . repeats
-} | 280 | repeatsM :: (Monad m, Functor f) => m (f ()) -> Stream f m r
repeatsM mf = loop where
loop = Effect $ do
f <- mf
return $ Step $ fmap (\_ -> loop) f
{- | Repeat a functorial layer, command or instruction a fixed number of times.
> replicates n = takes n . repeats
-} | 280 | repeatsM mf = loop where
loop = Effect $ do
f <- mf
return $ Step $ fmap (\_ -> loop) f
{- | Repeat a functorial layer, command or instruction a fixed number of times.
> replicates n = takes n . repeats
-} | 219 | false | true | 0 | 13 | 73 | 94 | 47 | 47 | null | null |
f-me/carma-http | src/Carma/HTTP.hs | bsd-3-clause | deleteInstance :: String -> Int -> CarmaIO ()
deleteInstance model rid =
void $ instanceRequest model (Just rid) DELETE Nothing | 131 | deleteInstance :: String -> Int -> CarmaIO ()
deleteInstance model rid =
void $ instanceRequest model (Just rid) DELETE Nothing | 131 | deleteInstance model rid =
void $ instanceRequest model (Just rid) DELETE Nothing | 85 | false | true | 0 | 8 | 23 | 48 | 23 | 25 | null | null |
mightymoose/liquidhaskell | benchmarks/vector-0.10.0.1/Data/Vector/Unboxed/Base.hs | bsd-3-clause | primVector(Word16, V_Word16, MV_Word16)
newtype instance MVector s Word32 = MV_Word32 (P.MVector s Word32) | 107 | primVector(Word16, V_Word16, MV_Word16)
newtype instance MVector s Word32 = MV_Word32 (P.MVector s Word32) | 107 | primVector(Word16, V_Word16, MV_Word16)
newtype instance MVector s Word32 = MV_Word32 (P.MVector s Word32) | 107 | false | false | 0 | 8 | 13 | 41 | 21 | 20 | null | null |
dysinger/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types.hs | mpl-2.0 | -- | Indicates whether the offering is available through the Reserved Instance
-- Marketplace (resale) or AWS. If it's a Reserved Instance Marketplace
-- offering, this is 'true'.
rioMarketplace :: Lens' ReservedInstancesOffering (Maybe Bool)
rioMarketplace = lens _rioMarketplace (\s a -> s { _rioMarketplace = a }) | 316 | rioMarketplace :: Lens' ReservedInstancesOffering (Maybe Bool)
rioMarketplace = lens _rioMarketplace (\s a -> s { _rioMarketplace = a }) | 136 | rioMarketplace = lens _rioMarketplace (\s a -> s { _rioMarketplace = a }) | 73 | true | true | 0 | 9 | 46 | 48 | 27 | 21 | null | null |
sdiehl/ghc | compiler/utils/Outputable.hs | bsd-3-clause | pprSorry :: String -> SDoc -> a
-- ^ Throw an exception saying "this isn't finished yet"
pprSorry = sorryDoc | 111 | pprSorry :: String -> SDoc -> a
pprSorry = sorryDoc | 54 | pprSorry = sorryDoc | 22 | true | true | 0 | 6 | 22 | 20 | 11 | 9 | null | null |
shlevy/ghc | compiler/main/HscTypes.hs | bsd-3-clause | typeEnvIds env = [id | AnId id <- typeEnvElts env] | 59 | typeEnvIds env = [id | AnId id <- typeEnvElts env] | 59 | typeEnvIds env = [id | AnId id <- typeEnvElts env] | 59 | false | false | 0 | 8 | 18 | 26 | 12 | 14 | null | null |
sol/wai | warp/Network/Wai/Handler/Warp/Timeout.hs | mit | tickle :: Handle -> IO ()
tickle (Handle _ iactive) = I.writeIORef iactive Active | 81 | tickle :: Handle -> IO ()
tickle (Handle _ iactive) = I.writeIORef iactive Active | 81 | tickle (Handle _ iactive) = I.writeIORef iactive Active | 55 | false | true | 0 | 7 | 13 | 38 | 18 | 20 | null | null |
hungaikev/learning-haskell | RockPaperScissors.hs | apache-2.0 | shoot :: RPS -> RPS -> String
shoot Paper Rock = "Paper Beats Rock" | 69 | shoot :: RPS -> RPS -> String
shoot Paper Rock = "Paper Beats Rock" | 67 | shoot Paper Rock = "Paper Beats Rock" | 37 | false | true | 0 | 6 | 15 | 29 | 13 | 16 | null | null |
roldugin/LiveFusion | Data/LiveFusion.hs | bsd-3-clause | snds :: (Elt a, Elt b) => Array (a,b) -> Array b
snds = map snd | 63 | snds :: (Elt a, Elt b) => Array (a,b) -> Array b
snds = map snd | 63 | snds = map snd | 14 | false | true | 0 | 8 | 15 | 45 | 23 | 22 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-data/Data/Drasil/ExternalLibraries/ODELibraries.hs | bsd-2-clause | sol = codevar $ implCQD "sol_oslo" (nounPhrase "container for ODE information"
"containers for ODE information") Nothing solT (Label "sol") Nothing | 150 | sol = codevar $ implCQD "sol_oslo" (nounPhrase "container for ODE information"
"containers for ODE information") Nothing solT (Label "sol") Nothing | 150 | sol = codevar $ implCQD "sol_oslo" (nounPhrase "container for ODE information"
"containers for ODE information") Nothing solT (Label "sol") Nothing | 150 | false | false | 1 | 8 | 22 | 40 | 18 | 22 | null | null |
achirkin/qua-kit | services/siren/src/Lib.hs | mit | listScenariosF :: BS.ByteString
listScenariosF = $(embedFile "sql/list_scenarios.sql") | 86 | listScenariosF :: BS.ByteString
listScenariosF = $(embedFile "sql/list_scenarios.sql") | 86 | listScenariosF = $(embedFile "sql/list_scenarios.sql") | 54 | false | true | 0 | 7 | 6 | 20 | 10 | 10 | null | null |
donatello/minio-hs | src/Network/Minio/API.hs | apache-2.0 | mkStreamRequest :: RequestInfo
-> Minio (Response (C.ResumableSource Minio ByteString))
mkStreamRequest ri = do
req <- buildRequest ri
mgr <- asks mcConnManager
http req mgr
-- Bucket name validity check according to AWS rules. | 250 | mkStreamRequest :: RequestInfo
-> Minio (Response (C.ResumableSource Minio ByteString))
mkStreamRequest ri = do
req <- buildRequest ri
mgr <- asks mcConnManager
http req mgr
-- Bucket name validity check according to AWS rules. | 250 | mkStreamRequest ri = do
req <- buildRequest ri
mgr <- asks mcConnManager
http req mgr
-- Bucket name validity check according to AWS rules. | 146 | false | true | 0 | 12 | 55 | 71 | 31 | 40 | null | null |
pbl64k/WatLog | watlog.hs | bsd-2-clause | dispProp (Simple p) = disp p | 28 | dispProp (Simple p) = disp p | 28 | dispProp (Simple p) = disp p | 28 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
pxqr/regex-fuzzy | src/Text/Regex/Fuzzy/AST.hs | mit | maybeQ :: Quan
maybeQ = Quan 0 1 | 32 | maybeQ :: Quan
maybeQ = Quan 0 1 | 32 | maybeQ = Quan 0 1 | 17 | false | true | 0 | 6 | 7 | 24 | 9 | 15 | null | null |
supki/outdated | src/Main.hs | bsd-2-clause | main :: IO a
main = do
(confs, paths) <- Conf.cli
index <- Latest.gather
withTempDirectory minBound "/tmp" "outdated" $ \tmpDir ->
runConduit $
Wrong.produce tmpDir confs paths index =$= C.mapInput Wrong.prettify (const Nothing) printAndDie | 256 | main :: IO a
main = do
(confs, paths) <- Conf.cli
index <- Latest.gather
withTempDirectory minBound "/tmp" "outdated" $ \tmpDir ->
runConduit $
Wrong.produce tmpDir confs paths index =$= C.mapInput Wrong.prettify (const Nothing) printAndDie | 256 | main = do
(confs, paths) <- Conf.cli
index <- Latest.gather
withTempDirectory minBound "/tmp" "outdated" $ \tmpDir ->
runConduit $
Wrong.produce tmpDir confs paths index =$= C.mapInput Wrong.prettify (const Nothing) printAndDie | 243 | false | true | 0 | 13 | 49 | 99 | 46 | 53 | null | null |
petester42/haskell-hockey | src/Hockey/Processing.hs | mit | isLeagueLeaderSeed :: (StandingsType, StandingTeamRecord) -> Int -> Bool
isLeagueLeaderSeed x rank = divisionRank (snd x) == rank | 129 | isLeagueLeaderSeed :: (StandingsType, StandingTeamRecord) -> Int -> Bool
isLeagueLeaderSeed x rank = divisionRank (snd x) == rank | 129 | isLeagueLeaderSeed x rank = divisionRank (snd x) == rank | 56 | false | true | 0 | 8 | 16 | 43 | 22 | 21 | null | null |
kavigupta/N-programming-language | src/RegFile.hs | gpl-3.0 | interpretRegAct :: (Monad m, MonadState (e, RegFile o) m) => m o -> (o -> m a) -> RegisterIndex -> m ()
interpretRegAct pop push loc = do
file <- get
let reg = file ^. _2 . getReg loc
case reg of
Push o -> do
push o
_2 . getReg loc .= Pull
Pull -> case loc of
Alpha -> do
top <- pop
_2 . getReg loc .= Push top
Beta -> do
top <- pop
push top
_2 . getReg loc .= Push top
Gamma -> do
top <- pop
second <- pop
push top
_2 . getReg loc .= Push second
Delta -> do
top <- pop
second <- pop
push second
push top
_2 . getReg loc .= Push second | 859 | interpretRegAct :: (Monad m, MonadState (e, RegFile o) m) => m o -> (o -> m a) -> RegisterIndex -> m ()
interpretRegAct pop push loc = do
file <- get
let reg = file ^. _2 . getReg loc
case reg of
Push o -> do
push o
_2 . getReg loc .= Pull
Pull -> case loc of
Alpha -> do
top <- pop
_2 . getReg loc .= Push top
Beta -> do
top <- pop
push top
_2 . getReg loc .= Push top
Gamma -> do
top <- pop
second <- pop
push top
_2 . getReg loc .= Push second
Delta -> do
top <- pop
second <- pop
push second
push top
_2 . getReg loc .= Push second | 859 | interpretRegAct pop push loc = do
file <- get
let reg = file ^. _2 . getReg loc
case reg of
Push o -> do
push o
_2 . getReg loc .= Pull
Pull -> case loc of
Alpha -> do
top <- pop
_2 . getReg loc .= Push top
Beta -> do
top <- pop
push top
_2 . getReg loc .= Push top
Gamma -> do
top <- pop
second <- pop
push top
_2 . getReg loc .= Push second
Delta -> do
top <- pop
second <- pop
push second
push top
_2 . getReg loc .= Push second | 755 | false | true | 0 | 19 | 449 | 312 | 136 | 176 | null | null |
grnet/snf-ganeti | src/Ganeti/OpParams.hs | bsd-2-clause | pCommit :: Field
pCommit =
withDoc "Commit the already reserved instance" $
defaultFalse "commit" | 101 | pCommit :: Field
pCommit =
withDoc "Commit the already reserved instance" $
defaultFalse "commit" | 101 | pCommit =
withDoc "Commit the already reserved instance" $
defaultFalse "commit" | 84 | false | true | 0 | 6 | 17 | 27 | 11 | 16 | null | null |
Concomitant/LambdaHack | Game/LambdaHack/Common/ItemStrongest.hs | bsd-3-clause | unknownMelee :: [ItemFull] -> Bool
unknownMelee =
let p (AddHurtMelee k) = [k]
p _ = []
f itemFull b = b || unknownAspect p itemFull
in foldr f False | 165 | unknownMelee :: [ItemFull] -> Bool
unknownMelee =
let p (AddHurtMelee k) = [k]
p _ = []
f itemFull b = b || unknownAspect p itemFull
in foldr f False | 165 | unknownMelee =
let p (AddHurtMelee k) = [k]
p _ = []
f itemFull b = b || unknownAspect p itemFull
in foldr f False | 130 | false | true | 0 | 11 | 45 | 75 | 37 | 38 | null | null |
rvion/ride | jetpack/src/Data/Conduit/List/AsCl.hs | bsd-3-clause | -- cl_mapM_ :: forall a (m :: * -> *). Monad m => (a -> m ()) -> Consumer a m ()
cl_mapM_ = I.mapM_ | 99 | cl_mapM_ = I.mapM_ | 18 | cl_mapM_ = I.mapM_ | 18 | true | false | 0 | 5 | 24 | 9 | 5 | 4 | null | null |
frosch03/arrowVHDL | src/System/ArrowVHDL/Circuit/Defaults.hs | cc0-1.0 | aXor :: (Arrow a) => Grid a (Bool, Bool) (Bool)
aXor
= augment
emptyCircuit
{ nodeDesc = emptyNodeDesc
{ label = "XOR"
, sinks = mkPins 2
, sources = mkPins 1
}
, cycles = 1
, space = 4
}
$ arr (uncurry xor) | 322 | aXor :: (Arrow a) => Grid a (Bool, Bool) (Bool)
aXor
= augment
emptyCircuit
{ nodeDesc = emptyNodeDesc
{ label = "XOR"
, sinks = mkPins 2
, sources = mkPins 1
}
, cycles = 1
, space = 4
}
$ arr (uncurry xor) | 322 | aXor
= augment
emptyCircuit
{ nodeDesc = emptyNodeDesc
{ label = "XOR"
, sinks = mkPins 2
, sources = mkPins 1
}
, cycles = 1
, space = 4
}
$ arr (uncurry xor) | 274 | false | true | 2 | 10 | 160 | 101 | 55 | 46 | null | null |
ahodgen/archer-calc | src/Parser.hs | bsd-2-clause | val :: Parser Binding
val = do
ex <- expr
return ("it", ex) | 67 | val :: Parser Binding
val = do
ex <- expr
return ("it", ex) | 67 | val = do
ex <- expr
return ("it", ex) | 45 | false | true | 1 | 9 | 20 | 37 | 16 | 21 | null | null |
oldmanmike/ghc | compiler/hsSyn/HsBinds.hs | bsd-3-clause | noSpecPrags :: TcSpecPrags
noSpecPrags = SpecPrags [] | 53 | noSpecPrags :: TcSpecPrags
noSpecPrags = SpecPrags [] | 53 | noSpecPrags = SpecPrags [] | 26 | false | true | 0 | 6 | 6 | 23 | 9 | 14 | null | null |
exclipy/pdata | Data/BitUtil.hs | bsd-3-clause | bitCount8 148 = 3 | 17 | bitCount8 148 = 3 | 17 | bitCount8 148 = 3 | 17 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
codemac/yi-editor | src/Yi/Verifier/JavaScript.hs | gpl-2.0 | say :: MonadWriter (D.DList a) m => a -> m ()
say = tell . D.singleton | 70 | say :: MonadWriter (D.DList a) m => a -> m ()
say = tell . D.singleton | 70 | say = tell . D.singleton | 24 | false | true | 1 | 10 | 15 | 50 | 22 | 28 | null | null |
hiratara/doukaku-past-questions-advent-2013 | test/Doukaku/CrossCircleTest.hs | bsd-3-clause | tests :: IO [Test]
tests = createTests $ newDoukakuTest {
tsvPath = "test/Doukaku/crosscircle.tsv"
, solve = CrossCircle.solve
} | 134 | tests :: IO [Test]
tests = createTests $ newDoukakuTest {
tsvPath = "test/Doukaku/crosscircle.tsv"
, solve = CrossCircle.solve
} | 134 | tests = createTests $ newDoukakuTest {
tsvPath = "test/Doukaku/crosscircle.tsv"
, solve = CrossCircle.solve
} | 115 | false | true | 1 | 9 | 23 | 41 | 21 | 20 | null | null |
ggreif/clash-compiler | clash-lib/src/CLaSH/Netlist/Util.hs | bsd-2-clause | typeSize (Index u) = clog2 u | 28 | typeSize (Index u) = clog2 u | 28 | typeSize (Index u) = clog2 u | 28 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
nyirog/cis194 | lec04.hs | unlicense | appendList xs (Entry y ys) = appendList (Entry y xs) ys | 55 | appendList xs (Entry y ys) = appendList (Entry y xs) ys | 55 | appendList xs (Entry y ys) = appendList (Entry y xs) ys | 55 | false | false | 0 | 7 | 10 | 32 | 15 | 17 | null | null |
noteed/rescoyl | bin/rescoyl.hs | bsd-3-clause | -- | Create a 'Serve' command.
cmdServe :: Cmd
cmdServe = CmdServe
{ cmdServeEndpoint = "registry.local"
&= explicit
&= name "endpoint"
, cmdStore = "store"
&= explicit
&= name "store"
&= help "Path to the directory where to save files."
} &= help "Start the HTTP server."
&= explicit
&= name "serve" | 334 | cmdServe :: Cmd
cmdServe = CmdServe
{ cmdServeEndpoint = "registry.local"
&= explicit
&= name "endpoint"
, cmdStore = "store"
&= explicit
&= name "store"
&= help "Path to the directory where to save files."
} &= help "Start the HTTP server."
&= explicit
&= name "serve" | 303 | cmdServe = CmdServe
{ cmdServeEndpoint = "registry.local"
&= explicit
&= name "endpoint"
, cmdStore = "store"
&= explicit
&= name "store"
&= help "Path to the directory where to save files."
} &= help "Start the HTTP server."
&= explicit
&= name "serve" | 287 | true | true | 6 | 9 | 85 | 82 | 41 | 41 | null | null |
tolysz/prepare-ghcjs | spec-lts8/cabal/Cabal/Distribution/InstalledPackageInfo.hs | bsd-3-clause | -- -----------------------------------------------------------------------------
-- Parsing
parseInstalledPackageInfo :: String -> ParseResult InstalledPackageInfo
parseInstalledPackageInfo =
parseFieldsFlat (fieldsInstalledPackageInfo ++ deprecatedFieldDescrs)
emptyInstalledPackageInfo | 296 | parseInstalledPackageInfo :: String -> ParseResult InstalledPackageInfo
parseInstalledPackageInfo =
parseFieldsFlat (fieldsInstalledPackageInfo ++ deprecatedFieldDescrs)
emptyInstalledPackageInfo | 203 | parseInstalledPackageInfo =
parseFieldsFlat (fieldsInstalledPackageInfo ++ deprecatedFieldDescrs)
emptyInstalledPackageInfo | 131 | true | true | 0 | 7 | 25 | 39 | 18 | 21 | null | null |
david-caro/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | prop_checkOverridingPath1 = verify checkOverridingPath "PATH=\"$var/$foo\"" | 75 | prop_checkOverridingPath1 = verify checkOverridingPath "PATH=\"$var/$foo\"" | 75 | prop_checkOverridingPath1 = verify checkOverridingPath "PATH=\"$var/$foo\"" | 75 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
Ragnaroek/orwell | src/Orwell/Analyse.hs | gpl-3.0 | testFiles :: [FileChange] -> [FileChange]
testFiles = filter ((L.isPrefixOf "src/test").changeFile) | 99 | testFiles :: [FileChange] -> [FileChange]
testFiles = filter ((L.isPrefixOf "src/test").changeFile) | 99 | testFiles = filter ((L.isPrefixOf "src/test").changeFile) | 57 | false | true | 0 | 10 | 9 | 37 | 20 | 17 | null | null |
creichert/wai | warp/Network/Wai/Handler/Warp/HTTP2/Sender.hs | mit | fillBufBuilder :: Leftover -> DynaNext
fillBufBuilder leftover buf0 siz0 lim = do
let payloadBuf = buf0 `plusPtr` frameHeaderLength
room = min (siz0 - frameHeaderLength) lim
case leftover of
LZero -> error "fillBufBuilder: LZero"
LOne writer -> do
(len, signal) <- writer payloadBuf room
getNext len signal
LTwo bs writer
| BS.length bs <= room -> do
buf1 <- copy payloadBuf bs
let len1 = BS.length bs
(len2, signal) <- writer buf1 (room - len1)
getNext (len1 + len2) signal
| otherwise -> do
let (bs1,bs2) = BS.splitAt room bs
void $ copy payloadBuf bs1
getNext room (B.Chunk bs2 writer)
where
getNext l s = return $ nextForBuilder l s | 824 | fillBufBuilder :: Leftover -> DynaNext
fillBufBuilder leftover buf0 siz0 lim = do
let payloadBuf = buf0 `plusPtr` frameHeaderLength
room = min (siz0 - frameHeaderLength) lim
case leftover of
LZero -> error "fillBufBuilder: LZero"
LOne writer -> do
(len, signal) <- writer payloadBuf room
getNext len signal
LTwo bs writer
| BS.length bs <= room -> do
buf1 <- copy payloadBuf bs
let len1 = BS.length bs
(len2, signal) <- writer buf1 (room - len1)
getNext (len1 + len2) signal
| otherwise -> do
let (bs1,bs2) = BS.splitAt room bs
void $ copy payloadBuf bs1
getNext room (B.Chunk bs2 writer)
where
getNext l s = return $ nextForBuilder l s | 824 | fillBufBuilder leftover buf0 siz0 lim = do
let payloadBuf = buf0 `plusPtr` frameHeaderLength
room = min (siz0 - frameHeaderLength) lim
case leftover of
LZero -> error "fillBufBuilder: LZero"
LOne writer -> do
(len, signal) <- writer payloadBuf room
getNext len signal
LTwo bs writer
| BS.length bs <= room -> do
buf1 <- copy payloadBuf bs
let len1 = BS.length bs
(len2, signal) <- writer buf1 (room - len1)
getNext (len1 + len2) signal
| otherwise -> do
let (bs1,bs2) = BS.splitAt room bs
void $ copy payloadBuf bs1
getNext room (B.Chunk bs2 writer)
where
getNext l s = return $ nextForBuilder l s | 785 | false | true | 1 | 17 | 296 | 291 | 133 | 158 | null | null |
nomeata/ghc | compiler/cmm/CmmSink.hs | bsd-3-clause | shouldSink :: CmmNode e x -> Maybe Assignment
shouldSink (CmmAssign (CmmLocal r) e) | no_local_regs = Just (r, e, exprMem e)
where no_local_regs = True -- foldRegsUsed (\_ _ -> False) True e | 192 | shouldSink :: CmmNode e x -> Maybe Assignment
shouldSink (CmmAssign (CmmLocal r) e) | no_local_regs = Just (r, e, exprMem e)
where no_local_regs = True -- foldRegsUsed (\_ _ -> False) True e | 192 | shouldSink (CmmAssign (CmmLocal r) e) | no_local_regs = Just (r, e, exprMem e)
where no_local_regs = True -- foldRegsUsed (\_ _ -> False) True e | 146 | false | true | 1 | 11 | 34 | 77 | 35 | 42 | null | null |
jtapolczai/wumpus | World/Constants.hs | apache-2.0 | cDEFAULT_WUMPUS_HEALTH :: Fractional a => a
cDEFAULT_WUMPUS_HEALTH = 1 | 70 | cDEFAULT_WUMPUS_HEALTH :: Fractional a => a
cDEFAULT_WUMPUS_HEALTH = 1 | 70 | cDEFAULT_WUMPUS_HEALTH = 1 | 26 | false | true | 0 | 7 | 8 | 25 | 10 | 15 | null | null |
forsyde/forsyde-shallow | src/ForSyDe/Shallow/Utility/Queue.hs | bsd-3-clause | pushListFQ (FQ n q) xs = FQ n (take n (q ++ xs)) | 49 | pushListFQ (FQ n q) xs = FQ n (take n (q ++ xs)) | 49 | pushListFQ (FQ n q) xs = FQ n (take n (q ++ xs)) | 49 | false | false | 0 | 9 | 13 | 39 | 19 | 20 | null | null |
hvr/lens | src/Control/Lens/Indexed.hs | bsd-3-clause | -- | Run monadic actions for each target of an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal' with access to the index,
-- discarding the results (with the arguments flipped).
--
-- @
-- 'iforM_' ≡ 'flip' 'imapM_'
-- @
--
-- When you don't need access to the index then 'Control.Lens.Fold.forMOf_' is more flexible in what it accepts.
--
-- @
-- 'Control.Lens.Fold.forMOf_' l a ≡ 'iforMOf' l a '.' 'const'
-- @
iforM_ :: (FoldableWithIndex i t, Monad m) => t a -> (i -> a -> m b) -> m ()
iforM_ = flip imapM_ | 527 | iforM_ :: (FoldableWithIndex i t, Monad m) => t a -> (i -> a -> m b) -> m ()
iforM_ = flip imapM_ | 97 | iforM_ = flip imapM_ | 20 | true | true | 0 | 12 | 93 | 78 | 43 | 35 | null | null |
guibou/AdventOfCode2016 | src/Day15Extended.hs | bsd-3-clause | findIt :: Int -> [BS.ByteString] -> (Int, BS.ByteString)
findIt !time (x:xs) = let zeros = count0 x
others = take 7 xs
in if any (checkZeros others) zeros
then (time, x)
else findIt (time + 1) xs | 293 | findIt :: Int -> [BS.ByteString] -> (Int, BS.ByteString)
findIt !time (x:xs) = let zeros = count0 x
others = take 7 xs
in if any (checkZeros others) zeros
then (time, x)
else findIt (time + 1) xs | 293 | findIt !time (x:xs) = let zeros = count0 x
others = take 7 xs
in if any (checkZeros others) zeros
then (time, x)
else findIt (time + 1) xs | 236 | false | true | 0 | 10 | 134 | 106 | 55 | 51 | null | null |
tamarin-prover/tamarin-prover | lib/term/src/Term/Maude/Signature.hs | gpl-3.0 | -- essentially pairMaudeSig, but with the enableDiff flag set according to "flag"
-- -- MaudeSig False False False flag pairFunSig pairRules S.empty S.empty
-- | Signature with enableDiff set to True
enableDiffMaudeSig :: MaudeSig
enableDiffMaudeSig = maudeSig $ mempty {enableDiff=True} | 288 | enableDiffMaudeSig :: MaudeSig
enableDiffMaudeSig = maudeSig $ mempty {enableDiff=True} | 87 | enableDiffMaudeSig = maudeSig $ mempty {enableDiff=True} | 56 | true | true | 0 | 7 | 40 | 26 | 16 | 10 | null | null |
mlitchard/squanchy | src/Examples/Fib.hs | isc | fibStore :: M.Map Text Value
fibStore = M.fromList [("n", Value $ NumberConst (25 :: Int))] | 91 | fibStore :: M.Map Text Value
fibStore = M.fromList [("n", Value $ NumberConst (25 :: Int))] | 91 | fibStore = M.fromList [("n", Value $ NumberConst (25 :: Int))] | 62 | false | true | 0 | 10 | 14 | 45 | 24 | 21 | null | null |
sdiehl/ghc | libraries/base/GHC/Event/Internal.hs | bsd-3-clause | -- | Data is available to be read.
evtRead :: Event
evtRead = Event 1 | 69 | evtRead :: Event
evtRead = Event 1 | 34 | evtRead = Event 1 | 17 | true | true | 0 | 5 | 14 | 15 | 8 | 7 | null | null |
cirquit/quizlearner | quizlearner/Handler/Quizcreator.hs | mit | toExamAttributes _ = ExamAttributes msg 0.0 0
where msg = "Error in cookie" :: Text | 114 | toExamAttributes _ = ExamAttributes msg 0.0 0
where msg = "Error in cookie" :: Text | 114 | toExamAttributes _ = ExamAttributes msg 0.0 0
where msg = "Error in cookie" :: Text | 114 | false | false | 2 | 5 | 45 | 34 | 13 | 21 | null | null |
msakai/multiset-large | Data/MultiSet/Large.hs | bsd-3-clause | {--------------------------------------------------------------------
Subset
--------------------------------------------------------------------}
-- | /O(n+m)/. Is this a proper subset? (ie. a subset but not equal).
isProperSubsetOf :: Ord a => MultiSet a -> MultiSet a -> Bool
isProperSubsetOf (MS m1) (MS m2) = Map.isProperSubmapOfBy (<=) m1 m2 | 350 | isProperSubsetOf :: Ord a => MultiSet a -> MultiSet a -> Bool
isProperSubsetOf (MS m1) (MS m2) = Map.isProperSubmapOfBy (<=) m1 m2 | 130 | isProperSubsetOf (MS m1) (MS m2) = Map.isProperSubmapOfBy (<=) m1 m2 | 68 | true | true | 0 | 8 | 41 | 62 | 31 | 31 | null | null |
andreyk0/hs-send-gcode | send-gcode/App.hs | gpl-2.0 | generateMonitoringCommands :: App ()
generateMonitoringCommands = do
ps <- getPrinterState
ssmc <- liftSTM $ readTVar (shouldGenerateMonitoringCommands ps)
if (ssmc)
then do forM_ [ GCD.getExtruderTemperature
, GCD.getCurrentPosition
] (sendCommand . GCodeLine)
liftIO $ threadDelay 5000000
generateMonitoringCommands
else sendCommand EndOfStream | 420 | generateMonitoringCommands :: App ()
generateMonitoringCommands = do
ps <- getPrinterState
ssmc <- liftSTM $ readTVar (shouldGenerateMonitoringCommands ps)
if (ssmc)
then do forM_ [ GCD.getExtruderTemperature
, GCD.getCurrentPosition
] (sendCommand . GCodeLine)
liftIO $ threadDelay 5000000
generateMonitoringCommands
else sendCommand EndOfStream | 420 | generateMonitoringCommands = do
ps <- getPrinterState
ssmc <- liftSTM $ readTVar (shouldGenerateMonitoringCommands ps)
if (ssmc)
then do forM_ [ GCD.getExtruderTemperature
, GCD.getCurrentPosition
] (sendCommand . GCodeLine)
liftIO $ threadDelay 5000000
generateMonitoringCommands
else sendCommand EndOfStream | 383 | false | true | 0 | 12 | 111 | 98 | 47 | 51 | null | null |
jamesdabbs/keenser | src/Keenser.hs | bsd-3-clause | heartBeat :: MonadIO m => Manager -> m ()
heartBeat m@Manager{..} = liftIO $ do
runRedis managerRedis $ do
_ <- del ["queues"]
sadd "processes" [managerIdentity]
sadd "queues" managerQueues
forever $ do
now <- getCurrentTime
working <- workload m
stopping <- readTVarIO managerQuiet
dones <- atomically $ swapTVar managerComplete 0
fails <- atomically $ swapTVar managerFailed 0
-- For what it's worth, an abort between here and the end of the block could cause us to under-report stats
runRedis managerRedis $ do
hmset managerIdentity
[ ("beat", timestamp now)
, ("info", LBS.toStrict $ encode m)
, ("busy", BSC.pack . show $ length working)
, ("quiet", boolToRedis stopping)
]
_ <- del [managerIdentity <> ":workers"]
hmset (managerIdentity <> ":workers") $ map workToRedis working
incrby "stat:processed" dones
incrby ("stat:complete:" <> daystamp now) dones
incrby "stat:failed" fails
incrby ("stat:failed:" <> daystamp now) dones
expire managerIdentity 60
sleep heartBeatFreq | 1,135 | heartBeat :: MonadIO m => Manager -> m ()
heartBeat m@Manager{..} = liftIO $ do
runRedis managerRedis $ do
_ <- del ["queues"]
sadd "processes" [managerIdentity]
sadd "queues" managerQueues
forever $ do
now <- getCurrentTime
working <- workload m
stopping <- readTVarIO managerQuiet
dones <- atomically $ swapTVar managerComplete 0
fails <- atomically $ swapTVar managerFailed 0
-- For what it's worth, an abort between here and the end of the block could cause us to under-report stats
runRedis managerRedis $ do
hmset managerIdentity
[ ("beat", timestamp now)
, ("info", LBS.toStrict $ encode m)
, ("busy", BSC.pack . show $ length working)
, ("quiet", boolToRedis stopping)
]
_ <- del [managerIdentity <> ":workers"]
hmset (managerIdentity <> ":workers") $ map workToRedis working
incrby "stat:processed" dones
incrby ("stat:complete:" <> daystamp now) dones
incrby "stat:failed" fails
incrby ("stat:failed:" <> daystamp now) dones
expire managerIdentity 60
sleep heartBeatFreq | 1,135 | heartBeat m@Manager{..} = liftIO $ do
runRedis managerRedis $ do
_ <- del ["queues"]
sadd "processes" [managerIdentity]
sadd "queues" managerQueues
forever $ do
now <- getCurrentTime
working <- workload m
stopping <- readTVarIO managerQuiet
dones <- atomically $ swapTVar managerComplete 0
fails <- atomically $ swapTVar managerFailed 0
-- For what it's worth, an abort between here and the end of the block could cause us to under-report stats
runRedis managerRedis $ do
hmset managerIdentity
[ ("beat", timestamp now)
, ("info", LBS.toStrict $ encode m)
, ("busy", BSC.pack . show $ length working)
, ("quiet", boolToRedis stopping)
]
_ <- del [managerIdentity <> ":workers"]
hmset (managerIdentity <> ":workers") $ map workToRedis working
incrby "stat:processed" dones
incrby ("stat:complete:" <> daystamp now) dones
incrby "stat:failed" fails
incrby ("stat:failed:" <> daystamp now) dones
expire managerIdentity 60
sleep heartBeatFreq | 1,093 | false | true | 25 | 10 | 298 | 294 | 157 | 137 | null | null |
lukemaurer/sequent-core | src/Language/SequentCore/LiftLambdas.hs | bsd-3-clause | -- Can't float a join point
-- (and wouldn't want to!)
shouldLift recVars (fvs, AnnBindTerm bndr term)
= do
fids <- filter isId <$> localFreeVarsAfterLifts (fvs `delVarSetList` recVars)
return $ shouldLift' fids bndr term | 279 | shouldLift recVars (fvs, AnnBindTerm bndr term)
= do
fids <- filter isId <$> localFreeVarsAfterLifts (fvs `delVarSetList` recVars)
return $ shouldLift' fids bndr term | 176 | shouldLift recVars (fvs, AnnBindTerm bndr term)
= do
fids <- filter isId <$> localFreeVarsAfterLifts (fvs `delVarSetList` recVars)
return $ shouldLift' fids bndr term | 176 | true | false | 0 | 11 | 91 | 64 | 32 | 32 | null | null |
ezyang/ghc | compiler/prelude/THNames.hs | bsd-3-clause | mkNameG_tcIdKey = mkPreludeMiscIdUnique 208 | 48 | mkNameG_tcIdKey = mkPreludeMiscIdUnique 208 | 48 | mkNameG_tcIdKey = mkPreludeMiscIdUnique 208 | 48 | false | false | 0 | 5 | 8 | 9 | 4 | 5 | null | null |
LeoMingo/RPNMathParser | Functions/Test/T.hs | gpl-3.0 | makeTuple (x1:x2:xs) = ((x1,x2) : []) ++ (makeTuple xs) | 55 | makeTuple (x1:x2:xs) = ((x1,x2) : []) ++ (makeTuple xs) | 55 | makeTuple (x1:x2:xs) = ((x1,x2) : []) ++ (makeTuple xs) | 55 | false | false | 0 | 8 | 8 | 45 | 24 | 21 | null | null |
headprogrammingczar/cabal | cabal-install/Distribution/Client/List.hs | bsd-3-clause | latestWithPref pref pkgs = Just (maximumBy (comparing prefThenVersion) pkgs)
where
prefThenVersion pkg = let ver = packageVersion pkg
in (withinRange ver pref, ver)
-- | Rearrange installed and source packages into groups referring to the
-- same package by name. In the result pairs, the lists are guaranteed to not
-- both be empty.
-- | 372 | latestWithPref pref pkgs = Just (maximumBy (comparing prefThenVersion) pkgs)
where
prefThenVersion pkg = let ver = packageVersion pkg
in (withinRange ver pref, ver)
-- | Rearrange installed and source packages into groups referring to the
-- same package by name. In the result pairs, the lists are guaranteed to not
-- both be empty.
-- | 372 | latestWithPref pref pkgs = Just (maximumBy (comparing prefThenVersion) pkgs)
where
prefThenVersion pkg = let ver = packageVersion pkg
in (withinRange ver pref, ver)
-- | Rearrange installed and source packages into groups referring to the
-- same package by name. In the result pairs, the lists are guaranteed to not
-- both be empty.
-- | 372 | false | false | 0 | 9 | 89 | 67 | 34 | 33 | null | null |
nomeata/ghc | utils/ghc-cabal/Main.hs | bsd-3-clause | syntax_error :: [String]
syntax_error =
["syntax: ghc-cabal configure <configure-args> -- <distdir> <directory>...",
" ghc-cabal install <ghc-pkg> <directory> <distdir> <destdir> <prefix> <args>...",
" ghc-cabal hscolour <distdir> <directory> <args>..."] | 282 | syntax_error :: [String]
syntax_error =
["syntax: ghc-cabal configure <configure-args> -- <distdir> <directory>...",
" ghc-cabal install <ghc-pkg> <directory> <distdir> <destdir> <prefix> <args>...",
" ghc-cabal hscolour <distdir> <directory> <args>..."] | 282 | syntax_error =
["syntax: ghc-cabal configure <configure-args> -- <distdir> <directory>...",
" ghc-cabal install <ghc-pkg> <directory> <distdir> <destdir> <prefix> <args>...",
" ghc-cabal hscolour <distdir> <directory> <args>..."] | 257 | false | true | 0 | 7 | 54 | 30 | 15 | 15 | null | null |
kazu-yamamoto/dns | internal/Network/DNS/StateBinary.hs | bsd-3-clause | runSGet :: SGet a -> ByteString -> Either DNSError (a, PState)
runSGet = runSGetAt dnsTimeMid | 93 | runSGet :: SGet a -> ByteString -> Either DNSError (a, PState)
runSGet = runSGetAt dnsTimeMid | 93 | runSGet = runSGetAt dnsTimeMid | 30 | false | true | 0 | 9 | 14 | 42 | 19 | 23 | null | null |
wuzzeb/hs-webdriver | src/Test/WebDriver/Commands.hs | bsd-3-clause | -- |Grab a screenshot as a base-64 encoded PNG image. This is the protocol-defined format.
screenshotBase64 :: WebDriver wd => wd LBS.ByteString
screenshotBase64 = TL.encodeUtf8 <$> doSessCommand methodGet "/screenshot" Null | 224 | screenshotBase64 :: WebDriver wd => wd LBS.ByteString
screenshotBase64 = TL.encodeUtf8 <$> doSessCommand methodGet "/screenshot" Null | 133 | screenshotBase64 = TL.encodeUtf8 <$> doSessCommand methodGet "/screenshot" Null | 79 | true | true | 0 | 7 | 29 | 37 | 18 | 19 | null | null |
vladimir-ipatov/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | -- | KVM-specific statuses
--
-- FIXME: this constant seems unnecessary
hvKvmMigrationValidStatuses :: FrozenSet String
hvKvmMigrationValidStatuses = hvMigrationValidStatuses | 174 | hvKvmMigrationValidStatuses :: FrozenSet String
hvKvmMigrationValidStatuses = hvMigrationValidStatuses | 102 | hvKvmMigrationValidStatuses = hvMigrationValidStatuses | 54 | true | true | 1 | 5 | 17 | 21 | 10 | 11 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | orIntegerIdKey = mkPreludeMiscIdUnique 92 | 56 | orIntegerIdKey = mkPreludeMiscIdUnique 92 | 56 | orIntegerIdKey = mkPreludeMiscIdUnique 92 | 56 | false | false | 0 | 5 | 18 | 9 | 4 | 5 | null | null |
edom/ptt | src/Parse/Haskell/Lex/Token.hs | apache-2.0 | asLexeme _ = A.empty | 20 | asLexeme _ = A.empty | 20 | asLexeme _ = A.empty | 20 | false | false | 0 | 5 | 3 | 11 | 5 | 6 | null | null |
fabianbergmark/ECMA-262 | src/Language/JavaScript/URI.hs | bsd-2-clause | uriReserved =
choice $ char <$>
[ ';', '/', '?', ':'
, '@', '&', '=', '+', '$' ] | 86 | uriReserved =
choice $ char <$>
[ ';', '/', '?', ':'
, '@', '&', '=', '+', '$' ] | 86 | uriReserved =
choice $ char <$>
[ ';', '/', '?', ':'
, '@', '&', '=', '+', '$' ] | 86 | false | false | 5 | 5 | 23 | 46 | 25 | 21 | null | null |
nevrenato/Hets_Fork | Static/DGNavigation.hs | gpl-2.0 | linkLabel :: LEdge a -> a
linkSource (x,_,_) = x | 48 | linkLabel :: LEdge a -> a
linkSource (x,_,_) = x | 48 | linkSource (x,_,_) = x | 22 | false | true | 0 | 8 | 9 | 36 | 17 | 19 | null | null |
joom/civ | src/Drawing.hs | mit | resourceView txMap (Just r) =
case r of
Horses -> color (light $ makeColor (102/255) (51/255) (0/255) 1) $ thickCircle s s
Iron -> color (greyN 0.5) $ thickCircle s s
Coal -> color black $ thickCircle s s
Aluminum -> color white $ thickCircle s s
Oil -> color black $ thickCircle s s
Uranium -> color green $ thickCircle s s
_ -> Blank
where s = 12
-- | Basic drawing of an improvement. | 458 | resourceView txMap (Just r) =
case r of
Horses -> color (light $ makeColor (102/255) (51/255) (0/255) 1) $ thickCircle s s
Iron -> color (greyN 0.5) $ thickCircle s s
Coal -> color black $ thickCircle s s
Aluminum -> color white $ thickCircle s s
Oil -> color black $ thickCircle s s
Uranium -> color green $ thickCircle s s
_ -> Blank
where s = 12
-- | Basic drawing of an improvement. | 458 | resourceView txMap (Just r) =
case r of
Horses -> color (light $ makeColor (102/255) (51/255) (0/255) 1) $ thickCircle s s
Iron -> color (greyN 0.5) $ thickCircle s s
Coal -> color black $ thickCircle s s
Aluminum -> color white $ thickCircle s s
Oil -> color black $ thickCircle s s
Uranium -> color green $ thickCircle s s
_ -> Blank
where s = 12
-- | Basic drawing of an improvement. | 458 | false | false | 8 | 11 | 148 | 193 | 89 | 104 | null | null |
HairyDude/heal | EveApi/Types.hs | bsd-2-clause | argString :: IsString s => APIArgumentType -> s
argString ArgTIDs = "IDs" | 83 | argString :: IsString s => APIArgumentType -> s
argString ArgTIDs = "IDs" | 83 | argString ArgTIDs = "IDs" | 35 | false | true | 0 | 8 | 21 | 31 | 13 | 18 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs | mit | decomposeChar '\x2F9E3' = "\x90F1" | 34 | decomposeChar '\x2F9E3' = "\x90F1" | 34 | decomposeChar '\x2F9E3' = "\x90F1" | 34 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
tort/mud-drifter | src/Drifter.hs | mit | scanServerInput (ServerInput "") _ = ([], Nothing) | 50 | scanServerInput (ServerInput "") _ = ([], Nothing) | 50 | scanServerInput (ServerInput "") _ = ([], Nothing) | 50 | false | false | 1 | 7 | 6 | 28 | 13 | 15 | null | null |
TravisWhitaker/rdf | src/Data/RDF/Encoder/NQuads.hs | mit | encodeQuad (Quad (Triple s p o) (Just g)) = encodeSubject s
<> B.byteString " "
<> encodePredicate p
<> B.byteString " "
<> encodeObject o
<> B.byteString " "
<> encodeEscapedIRI g
<> B.byteString " .\n" | 490 | encodeQuad (Quad (Triple s p o) (Just g)) = encodeSubject s
<> B.byteString " "
<> encodePredicate p
<> B.byteString " "
<> encodeObject o
<> B.byteString " "
<> encodeEscapedIRI g
<> B.byteString " .\n" | 490 | encodeQuad (Quad (Triple s p o) (Just g)) = encodeSubject s
<> B.byteString " "
<> encodePredicate p
<> B.byteString " "
<> encodeObject o
<> B.byteString " "
<> encodeEscapedIRI g
<> B.byteString " .\n" | 490 | false | false | 0 | 13 | 322 | 93 | 42 | 51 | null | null |
vincenthz/hs-cryptohash | Crypto/MAC.hs | bsd-3-clause | -- | Initialize a new incremental HMAC context
hmacInit :: HashAlgorithm a
=> ByteString -- ^ Secret key
-> HMACContext a
hmacInit secret = HMACContext octx ictx
where ctxInit = hashInit
ictx = hashUpdates ctxInit [ipad]
octx = hashUpdates ctxInit [opad]
ipad = B.map (xor 0x36) k'
opad = B.map (xor 0x5c) k'
k' = B.append kt pad
kt = if B.length secret > fromIntegral blockSize then toBytes (hashF secret) else secret
pad = B.replicate (fromIntegral blockSize - B.length kt) 0
hashF = hashFinalize . hashUpdate ctxInit
blockSize = hashBlockSize ctxInit
-- | Initialize a new incremental HMAC context with a given hash algorithm. | 745 | hmacInit :: HashAlgorithm a
=> ByteString -- ^ Secret key
-> HMACContext a
hmacInit secret = HMACContext octx ictx
where ctxInit = hashInit
ictx = hashUpdates ctxInit [ipad]
octx = hashUpdates ctxInit [opad]
ipad = B.map (xor 0x36) k'
opad = B.map (xor 0x5c) k'
k' = B.append kt pad
kt = if B.length secret > fromIntegral blockSize then toBytes (hashF secret) else secret
pad = B.replicate (fromIntegral blockSize - B.length kt) 0
hashF = hashFinalize . hashUpdate ctxInit
blockSize = hashBlockSize ctxInit
-- | Initialize a new incremental HMAC context with a given hash algorithm. | 698 | hmacInit secret = HMACContext octx ictx
where ctxInit = hashInit
ictx = hashUpdates ctxInit [ipad]
octx = hashUpdates ctxInit [opad]
ipad = B.map (xor 0x36) k'
opad = B.map (xor 0x5c) k'
k' = B.append kt pad
kt = if B.length secret > fromIntegral blockSize then toBytes (hashF secret) else secret
pad = B.replicate (fromIntegral blockSize - B.length kt) 0
hashF = hashFinalize . hashUpdate ctxInit
blockSize = hashBlockSize ctxInit
-- | Initialize a new incremental HMAC context with a given hash algorithm. | 605 | true | true | 8 | 9 | 219 | 226 | 101 | 125 | null | null |
salamansar/GA-cube | src/GenAlg2.hs | mit | onesFirstGen :: Int -> Int -> (Int -> Int -> BSInd) -> GenAlgContext -> ([BSInd], GenAlgContext)
onesFirstGen bitNum size createFunc context = ([createFunc (powOfTwo bitNum - 1) bitNum | count <- [1..size]], context) | 217 | onesFirstGen :: Int -> Int -> (Int -> Int -> BSInd) -> GenAlgContext -> ([BSInd], GenAlgContext)
onesFirstGen bitNum size createFunc context = ([createFunc (powOfTwo bitNum - 1) bitNum | count <- [1..size]], context) | 216 | onesFirstGen bitNum size createFunc context = ([createFunc (powOfTwo bitNum - 1) bitNum | count <- [1..size]], context) | 119 | false | true | 0 | 10 | 33 | 93 | 50 | 43 | null | null |
romanb/amazonka | amazonka-elastictranscoder/gen/Network/AWS/ElasticTranscoder/Types.hs | mpl-2.0 | -- | The array of file formats for the output captions. If you leave this value
-- blank, Elastic Transcoder returns an error.
cCaptionFormats :: Lens' Captions [CaptionFormat]
cCaptionFormats = lens _cCaptionFormats (\s a -> s { _cCaptionFormats = a }) . _List | 261 | cCaptionFormats :: Lens' Captions [CaptionFormat]
cCaptionFormats = lens _cCaptionFormats (\s a -> s { _cCaptionFormats = a }) . _List | 134 | cCaptionFormats = lens _cCaptionFormats (\s a -> s { _cCaptionFormats = a }) . _List | 84 | true | true | 1 | 10 | 42 | 53 | 27 | 26 | null | null |
vdweegen/UvA-Software_Testing | Lab6/Lecture6.hs | gpl-3.0 | mrComposite :: Integer -> Integer -> Bool
mrComposite x n = let
(r,s) = decomp (n-1)
fs = takeWhile (/= 1)
(map (\ j -> Lecture6.exM x (2^j*s) n) [0..r])
in
Lecture6.exM x s n /= 1 && last fs /= (n-1) | 226 | mrComposite :: Integer -> Integer -> Bool
mrComposite x n = let
(r,s) = decomp (n-1)
fs = takeWhile (/= 1)
(map (\ j -> Lecture6.exM x (2^j*s) n) [0..r])
in
Lecture6.exM x s n /= 1 && last fs /= (n-1) | 226 | mrComposite x n = let
(r,s) = decomp (n-1)
fs = takeWhile (/= 1)
(map (\ j -> Lecture6.exM x (2^j*s) n) [0..r])
in
Lecture6.exM x s n /= 1 && last fs /= (n-1) | 184 | false | true | 2 | 17 | 67 | 148 | 73 | 75 | null | null |
kazu-yamamoto/static-hash | Data/StaticHash.hs | bsd-3-clause | ----------------------------------------------------------------
{-|
Creating 'StaticHash' from a list. A prime around the length of
the list x 2 is chosen for the size of array. This may prevent
collisions.
-}
fromList :: (Eq k, Ord k, Hashable k) => [(k,v)] -> StaticHash k v
fromList xs = fromList' (length xs) xs | 324 | fromList :: (Eq k, Ord k, Hashable k) => [(k,v)] -> StaticHash k v
fromList xs = fromList' (length xs) xs | 105 | fromList xs = fromList' (length xs) xs | 38 | true | true | 0 | 8 | 57 | 66 | 35 | 31 | null | null |
ocramz/petsc-hs | src/Numerical/PETSc/Internal/PutGet/Mat.hs | gpl-3.0 | -- | view Mat on stdout
matView0 :: Mat -> PetscViewer -> IO ()
matView0 m v = chk0 (matView' m v) | 99 | matView0 :: Mat -> PetscViewer -> IO ()
matView0 m v = chk0 (matView' m v) | 74 | matView0 m v = chk0 (matView' m v) | 34 | true | true | 0 | 9 | 22 | 46 | 21 | 25 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 3900 = 3899 | 11 | 3900 = 3899 | 11 | 3900 = 3899 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
lukexi/ghc-7.8-arm64 | compiler/main/HeaderInfo.hs | bsd-3-clause | unsupportedExtnError :: DynFlags -> SrcSpan -> String -> a
unsupportedExtnError dflags loc unsup =
throw $ mkSrcErr $ unitBag $
mkPlainErrMsg dflags loc $
text "Unsupported extension: " <> text unsup $$
if null suggestions then empty else text "Perhaps you meant" <+> quotedListWithOr (map text suggestions)
where
suggestions = fuzzyMatch unsup supportedLanguagesAndExtensions | 405 | unsupportedExtnError :: DynFlags -> SrcSpan -> String -> a
unsupportedExtnError dflags loc unsup =
throw $ mkSrcErr $ unitBag $
mkPlainErrMsg dflags loc $
text "Unsupported extension: " <> text unsup $$
if null suggestions then empty else text "Perhaps you meant" <+> quotedListWithOr (map text suggestions)
where
suggestions = fuzzyMatch unsup supportedLanguagesAndExtensions | 405 | unsupportedExtnError dflags loc unsup =
throw $ mkSrcErr $ unitBag $
mkPlainErrMsg dflags loc $
text "Unsupported extension: " <> text unsup $$
if null suggestions then empty else text "Perhaps you meant" <+> quotedListWithOr (map text suggestions)
where
suggestions = fuzzyMatch unsup supportedLanguagesAndExtensions | 346 | false | true | 0 | 10 | 81 | 107 | 51 | 56 | null | null |
alphaHeavy/alphaheavy-conduit | src/AlphaHeavy/Conduit.hs | bsd-3-clause | -- Reversing the arguments to compare sorts in the reverse order
mapAccum :: Monad m => (a -> b -> (a, c)) -> a -> GInfConduit b m c
mapAccum f inita = go inita where
go acc = awaitE >>= either return (\input -> let (acc', val) = f acc input in yield val >> go acc')
-- | Unique a sorted 'Source' | 300 | mapAccum :: Monad m => (a -> b -> (a, c)) -> a -> GInfConduit b m c
mapAccum f inita = go inita where
go acc = awaitE >>= either return (\input -> let (acc', val) = f acc input in yield val >> go acc')
-- | Unique a sorted 'Source' | 234 | mapAccum f inita = go inita where
go acc = awaitE >>= either return (\input -> let (acc', val) = f acc input in yield val >> go acc')
-- | Unique a sorted 'Source' | 166 | true | true | 3 | 12 | 67 | 131 | 62 | 69 | null | null |
nickbart1980/pandoc | src/Text/Pandoc/Pretty.hs | gpl-2.0 | renderList (BreakingSpace : BlankLine : xs) = renderList (BlankLine:xs) | 71 | renderList (BreakingSpace : BlankLine : xs) = renderList (BlankLine:xs) | 71 | renderList (BreakingSpace : BlankLine : xs) = renderList (BlankLine:xs) | 71 | false | false | 0 | 8 | 8 | 30 | 15 | 15 | null | null |
glguy/irc-core | src/Client/State.hs | isc | identIgnored ::
UserInfo {- ^ target user -} ->
ClientState {- ^ client state -} ->
Bool {- ^ is ignored -}
identIgnored who st = matchMask (view clientIgnoreMask st) who | 189 | identIgnored ::
UserInfo {- ^ target user -} ->
ClientState {- ^ client state -} ->
Bool
identIgnored who st = matchMask (view clientIgnoreMask st) who | 161 | identIgnored who st = matchMask (view clientIgnoreMask st) who | 62 | true | true | 0 | 8 | 49 | 45 | 22 | 23 | null | null |
matthewleon/libmpd-haskell | tests/CommandSpec.hs | mit | testPasswordFails =
testMPDWithPassword convo "foo" cmd_in `shouldBe` expected_resp
where
convo = [("play", Right "ACK [4@0] {play} you don't have \
\permission for \"play\"")
,("password foo",
Right "ACK [3@0] {password} incorrect password")]
expected_resp =
Left $ ACK InvalidPassword " incorrect password"
cmd_in = play Nothing | 440 | testPasswordFails =
testMPDWithPassword convo "foo" cmd_in `shouldBe` expected_resp
where
convo = [("play", Right "ACK [4@0] {play} you don't have \
\permission for \"play\"")
,("password foo",
Right "ACK [3@0] {password} incorrect password")]
expected_resp =
Left $ ACK InvalidPassword " incorrect password"
cmd_in = play Nothing | 440 | testPasswordFails =
testMPDWithPassword convo "foo" cmd_in `shouldBe` expected_resp
where
convo = [("play", Right "ACK [4@0] {play} you don't have \
\permission for \"play\"")
,("password foo",
Right "ACK [3@0] {password} incorrect password")]
expected_resp =
Left $ ACK InvalidPassword " incorrect password"
cmd_in = play Nothing | 440 | false | false | 0 | 9 | 153 | 72 | 39 | 33 | null | null |
cchens/courseography | hs/WebParsing/PrerequisiteParsing.hs | gpl-3.0 | -- |Splits a PrereqString by delimeters ';'' ','.
toPreExprs :: String -> String -> [String]
toPreExprs str expr =
let (before, delim, after) = matchDelim str
in case (before, delim, after) of
("","","") -> [] --if (expr == "") then [] else [expr]
(before, "", "") -> [before++expr]
(before, ",", after) -> if (isntDelim after)
then toPreExprs after (expr ++ before)
else (expr++before):(toPreExprs after "")
(before, ";", after) -> (expr++before):(toPreExprs after "")
-- | attempts to match a course in given string. returns (before, course, after)
-- if no match occurs (input, "", "") | 666 | toPreExprs :: String -> String -> [String]
toPreExprs str expr =
let (before, delim, after) = matchDelim str
in case (before, delim, after) of
("","","") -> [] --if (expr == "") then [] else [expr]
(before, "", "") -> [before++expr]
(before, ",", after) -> if (isntDelim after)
then toPreExprs after (expr ++ before)
else (expr++before):(toPreExprs after "")
(before, ";", after) -> (expr++before):(toPreExprs after "")
-- | attempts to match a course in given string. returns (before, course, after)
-- if no match occurs (input, "", "") | 616 | toPreExprs str expr =
let (before, delim, after) = matchDelim str
in case (before, delim, after) of
("","","") -> [] --if (expr == "") then [] else [expr]
(before, "", "") -> [before++expr]
(before, ",", after) -> if (isntDelim after)
then toPreExprs after (expr ++ before)
else (expr++before):(toPreExprs after "")
(before, ";", after) -> (expr++before):(toPreExprs after "")
-- | attempts to match a course in given string. returns (before, course, after)
-- if no match occurs (input, "", "") | 573 | true | true | 0 | 13 | 171 | 201 | 113 | 88 | null | null |
KeithKirk/haskell-ciphers | rotor.hs | mit | initRotor = [(x, charLimit - x)|x<-[0..charLimit]] | 50 | initRotor = [(x, charLimit - x)|x<-[0..charLimit]] | 50 | initRotor = [(x, charLimit - x)|x<-[0..charLimit]] | 50 | false | false | 0 | 8 | 5 | 32 | 18 | 14 | null | null |
robeverest/accelerate | Data/Array/Accelerate/Analysis/Match.hs | bsd-3-clause | matchPrimFun' (PrimAbs _) (PrimAbs _) = Just REFL | 71 | matchPrimFun' (PrimAbs _) (PrimAbs _) = Just REFL | 71 | matchPrimFun' (PrimAbs _) (PrimAbs _) = Just REFL | 71 | false | false | 0 | 7 | 29 | 26 | 12 | 14 | null | null |
ezyang/ghc | compiler/types/TyCoRep.hs | bsd-3-clause | tyCoFVsOfCo (SymCo co) fv_cand in_scope acc = tyCoFVsOfCo co fv_cand in_scope acc | 90 | tyCoFVsOfCo (SymCo co) fv_cand in_scope acc = tyCoFVsOfCo co fv_cand in_scope acc | 90 | tyCoFVsOfCo (SymCo co) fv_cand in_scope acc = tyCoFVsOfCo co fv_cand in_scope acc | 90 | false | false | 0 | 6 | 20 | 33 | 14 | 19 | null | null |
sergei-romanenko/sc-mini | src/TreeInterpreter.hs | unlicense | intTree (Node _ (EFold t ren)) env =
--intTree t $ map (\(k, v) -> (renKey k, v)) env where
intTree t $ map (first renKey) env where
renKey k = maybe k fst (find ((k ==) . snd) ren) | 198 | intTree (Node _ (EFold t ren)) env =
--intTree t $ map (\(k, v) -> (renKey k, v)) env where
intTree t $ map (first renKey) env where
renKey k = maybe k fst (find ((k ==) . snd) ren) | 198 | intTree (Node _ (EFold t ren)) env =
--intTree t $ map (\(k, v) -> (renKey k, v)) env where
intTree t $ map (first renKey) env where
renKey k = maybe k fst (find ((k ==) . snd) ren) | 198 | false | false | 0 | 12 | 56 | 82 | 41 | 41 | null | null |
ksaveljev/hake-2 | src/Game/GameSpawn.hs | bsd-3-clause | spTriggerMultiple :: EntThink
spTriggerMultiple =
GenericEntThink "SP_trigger_multiple" $ \edictRef -> do
GameTrigger.spTriggerMultiple edictRef
return True | 166 | spTriggerMultiple :: EntThink
spTriggerMultiple =
GenericEntThink "SP_trigger_multiple" $ \edictRef -> do
GameTrigger.spTriggerMultiple edictRef
return True | 166 | spTriggerMultiple =
GenericEntThink "SP_trigger_multiple" $ \edictRef -> do
GameTrigger.spTriggerMultiple edictRef
return True | 136 | false | true | 0 | 10 | 24 | 37 | 17 | 20 | null | null |
bartoszw/yelca | Handler/Util.hs | gpl-2.0 | fieldExtDur = "fieldExtDur" | 27 | fieldExtDur = "fieldExtDur" | 27 | fieldExtDur = "fieldExtDur" | 27 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
kawu/pedestrian-dag | src/Data/DAG_Backup.hs | bsd-2-clause | -- | Return DAG edges in a reverse topological order.
-- Similar to `nodeIDs'`.
edgeIDs' :: DAG a b -> [EdgeID]
edgeIDs' d = concatMap (out . node d) (nodeIDs' d) | 162 | edgeIDs' :: DAG a b -> [EdgeID]
edgeIDs' d = concatMap (out . node d) (nodeIDs' d) | 82 | edgeIDs' d = concatMap (out . node d) (nodeIDs' d) | 50 | true | true | 0 | 8 | 30 | 49 | 25 | 24 | null | null |
vigoo/snapshot-versions | src/SnapshotVersions/PackageIndex.hs | bsd-3-clause | toLightweightPackageDescription :: GenericPackageDescription -> LightweightPackageDescription
toLightweightPackageDescription pkgDesc =
let finalizeResult = finalizePackageDescription
[] -- TODO: configurable flags
(const True)
buildPlatform -- TODO: configurable platform
(unknownCompilerInfo
(CompilerId buildCompilerFlavor (Version [] [])) NoAbiTag)
[]
pkgDesc
in case finalizeResult of
Left missingDeps -> MissingDependencies missingDeps
Right (finalizedPkgDesc, _) ->
LightweightPackageDescription
{ lpdName = pkgName (package finalizedPkgDesc)
, lpdVersion = pkgVersion (package finalizedPkgDesc)
, lpdDependencies = buildDepends finalizedPkgDesc
} | 906 | toLightweightPackageDescription :: GenericPackageDescription -> LightweightPackageDescription
toLightweightPackageDescription pkgDesc =
let finalizeResult = finalizePackageDescription
[] -- TODO: configurable flags
(const True)
buildPlatform -- TODO: configurable platform
(unknownCompilerInfo
(CompilerId buildCompilerFlavor (Version [] [])) NoAbiTag)
[]
pkgDesc
in case finalizeResult of
Left missingDeps -> MissingDependencies missingDeps
Right (finalizedPkgDesc, _) ->
LightweightPackageDescription
{ lpdName = pkgName (package finalizedPkgDesc)
, lpdVersion = pkgVersion (package finalizedPkgDesc)
, lpdDependencies = buildDepends finalizedPkgDesc
} | 906 | toLightweightPackageDescription pkgDesc =
let finalizeResult = finalizePackageDescription
[] -- TODO: configurable flags
(const True)
buildPlatform -- TODO: configurable platform
(unknownCompilerInfo
(CompilerId buildCompilerFlavor (Version [] [])) NoAbiTag)
[]
pkgDesc
in case finalizeResult of
Left missingDeps -> MissingDependencies missingDeps
Right (finalizedPkgDesc, _) ->
LightweightPackageDescription
{ lpdName = pkgName (package finalizedPkgDesc)
, lpdVersion = pkgVersion (package finalizedPkgDesc)
, lpdDependencies = buildDepends finalizedPkgDesc
} | 812 | false | true | 0 | 16 | 316 | 154 | 78 | 76 | null | null |
nwf/trifecta | src/Text/Trifecta/Rendering.hs | bsd-3-clause | nullRendering _ = False | 23 | nullRendering _ = False | 23 | nullRendering _ = False | 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
michalkonecny/aern2 | aern2-mfun/src/AERN2/BoxFunMinMax/Expressions/Type.hs | bsd-3-clause | prettyShowE (Float m e) =
case m of
RNE -> "rnd_ne(" ++ prettyShowE e ++ ")"
RTP -> "rnd_tp(" ++ prettyShowE e ++ ")"
RTN -> "rnd_tn(" ++ prettyShowE e ++ ")"
RTZ -> "rnd_tz(" ++ prettyShowE e ++ ")"
-- |Show a conjunction of expressions in a human-readable format
-- This is shown as an AND with each disjunction tabbed in with an OR
-- If there is only one term in a disjunction, the expression is shown without an OR | 440 | prettyShowE (Float m e) =
case m of
RNE -> "rnd_ne(" ++ prettyShowE e ++ ")"
RTP -> "rnd_tp(" ++ prettyShowE e ++ ")"
RTN -> "rnd_tn(" ++ prettyShowE e ++ ")"
RTZ -> "rnd_tz(" ++ prettyShowE e ++ ")"
-- |Show a conjunction of expressions in a human-readable format
-- This is shown as an AND with each disjunction tabbed in with an OR
-- If there is only one term in a disjunction, the expression is shown without an OR | 440 | prettyShowE (Float m e) =
case m of
RNE -> "rnd_ne(" ++ prettyShowE e ++ ")"
RTP -> "rnd_tp(" ++ prettyShowE e ++ ")"
RTN -> "rnd_tn(" ++ prettyShowE e ++ ")"
RTZ -> "rnd_tz(" ++ prettyShowE e ++ ")"
-- |Show a conjunction of expressions in a human-readable format
-- This is shown as an AND with each disjunction tabbed in with an OR
-- If there is only one term in a disjunction, the expression is shown without an OR | 440 | false | false | 0 | 10 | 102 | 92 | 45 | 47 | null | null |
Numberartificial/workflow | haskell-first-principles/haskell-programming-from-first-principles-master/src/Cipher.hs | mit | shift f n c | c > 'z' = shift f n 'a'
| c < 'a' = shift f n 'z'
| otherwise = shift f (n - 1) (f c) | 127 | shift f n c | c > 'z' = shift f n 'a'
| c < 'a' = shift f n 'z'
| otherwise = shift f (n - 1) (f c) | 127 | shift f n c | c > 'z' = shift f n 'a'
| c < 'a' = shift f n 'z'
| otherwise = shift f (n - 1) (f c) | 127 | false | false | 3 | 7 | 59 | 80 | 36 | 44 | null | null |
ezyang/ghc | compiler/utils/Pretty.hs | bsd-3-clause | -- Arg of a TextBeside is always an RDoc
textBeside_ :: TextDetails -> Int -> RDoc -> RDoc
textBeside_ = TextBeside | 115 | textBeside_ :: TextDetails -> Int -> RDoc -> RDoc
textBeside_ = TextBeside | 74 | textBeside_ = TextBeside | 24 | true | true | 0 | 7 | 20 | 24 | 13 | 11 | null | null |
kawu/ltag | src/NLP/LTAG/Earley5.hs | bsd-2-clause | labEq'
:: forall n t i j f a
-- We have to use scoped type variables in order to be able
-- to refer to them from the internal functions. The usage
-- of the internal `nodeEq` is most likely responsible for
-- this.
. (Eq n, Eq t, Ord i, Ord j, Eq f, Eq a)
=> Lab n t i -- ^ First label `x`
-> FG.Graph i f a -- ^ Graph corresponding to `x`
-> Lab n t j -- ^ Second label `y`
-> FG.Graph j f a -- ^ Graph corresponding to `y`
-> Bool
labEq' p g q h =
eq p q
where
eq x@NonT{} y@NonT{}
= eqOn nonTerm x y
&& eqOn (isJust . labID) x y
&& nodeEqOn topID x y
&& nodeEqOn botID x y
eq (Term x) (Term y)
= x == y
eq x@AuxRoot{} y@AuxRoot{}
= eqOn nonTerm x y
&& nodeEqOn topID x y
&& nodeEqOn botID x y
&& nodeEqOn footTopID x y
&& nodeEqOn footBotID x y
eq (AuxFoot x) (AuxFoot y)
= x == y
eq x@AuxVert{} y@AuxVert{}
= eqOn nonTerm x y
-- && eqOn symID x y
&& nodeEqOn topID x y
&& nodeEqOn botID x y
eq _ _ = False
-- if we don't write `forall k.` then compiler tries to match
-- it with both `i` and `j` at the same time.
eqOn :: Eq z => (forall k . Lab n t k -> z)
-> Lab n t i -> Lab n t j -> Bool
eqOn f x y = f x == f y
nodeEqOn :: (forall k . Lab n t k -> k)
-> Lab n t i -> Lab n t j -> Bool
nodeEqOn f x y = nodeEq (f x) (f y)
-- assumption: the first index belongs to the first
-- graph, the second to the second graph.
nodeEq i j = FG.equal g i h j
-- | Label comparison within the context of corresponding
-- feature graphs. | 1,711 | labEq'
:: forall n t i j f a
-- We have to use scoped type variables in order to be able
-- to refer to them from the internal functions. The usage
-- of the internal `nodeEq` is most likely responsible for
-- this.
. (Eq n, Eq t, Ord i, Ord j, Eq f, Eq a)
=> Lab n t i -- ^ First label `x`
-> FG.Graph i f a -- ^ Graph corresponding to `x`
-> Lab n t j -- ^ Second label `y`
-> FG.Graph j f a -- ^ Graph corresponding to `y`
-> Bool
labEq' p g q h =
eq p q
where
eq x@NonT{} y@NonT{}
= eqOn nonTerm x y
&& eqOn (isJust . labID) x y
&& nodeEqOn topID x y
&& nodeEqOn botID x y
eq (Term x) (Term y)
= x == y
eq x@AuxRoot{} y@AuxRoot{}
= eqOn nonTerm x y
&& nodeEqOn topID x y
&& nodeEqOn botID x y
&& nodeEqOn footTopID x y
&& nodeEqOn footBotID x y
eq (AuxFoot x) (AuxFoot y)
= x == y
eq x@AuxVert{} y@AuxVert{}
= eqOn nonTerm x y
-- && eqOn symID x y
&& nodeEqOn topID x y
&& nodeEqOn botID x y
eq _ _ = False
-- if we don't write `forall k.` then compiler tries to match
-- it with both `i` and `j` at the same time.
eqOn :: Eq z => (forall k . Lab n t k -> z)
-> Lab n t i -> Lab n t j -> Bool
eqOn f x y = f x == f y
nodeEqOn :: (forall k . Lab n t k -> k)
-> Lab n t i -> Lab n t j -> Bool
nodeEqOn f x y = nodeEq (f x) (f y)
-- assumption: the first index belongs to the first
-- graph, the second to the second graph.
nodeEq i j = FG.equal g i h j
-- | Label comparison within the context of corresponding
-- feature graphs. | 1,711 | labEq' p g q h =
eq p q
where
eq x@NonT{} y@NonT{}
= eqOn nonTerm x y
&& eqOn (isJust . labID) x y
&& nodeEqOn topID x y
&& nodeEqOn botID x y
eq (Term x) (Term y)
= x == y
eq x@AuxRoot{} y@AuxRoot{}
= eqOn nonTerm x y
&& nodeEqOn topID x y
&& nodeEqOn botID x y
&& nodeEqOn footTopID x y
&& nodeEqOn footBotID x y
eq (AuxFoot x) (AuxFoot y)
= x == y
eq x@AuxVert{} y@AuxVert{}
= eqOn nonTerm x y
-- && eqOn symID x y
&& nodeEqOn topID x y
&& nodeEqOn botID x y
eq _ _ = False
-- if we don't write `forall k.` then compiler tries to match
-- it with both `i` and `j` at the same time.
eqOn :: Eq z => (forall k . Lab n t k -> z)
-> Lab n t i -> Lab n t j -> Bool
eqOn f x y = f x == f y
nodeEqOn :: (forall k . Lab n t k -> k)
-> Lab n t i -> Lab n t j -> Bool
nodeEqOn f x y = nodeEq (f x) (f y)
-- assumption: the first index belongs to the first
-- graph, the second to the second graph.
nodeEq i j = FG.equal g i h j
-- | Label comparison within the context of corresponding
-- feature graphs. | 1,208 | false | true | 14 | 17 | 621 | 576 | 297 | 279 | null | null |
edtsech/cassava | Data/Csv/Incremental.hs | bsd-3-clause | feedChunkH d@(DoneH _ _) _s = d | 33 | feedChunkH d@(DoneH _ _) _s = d | 33 | feedChunkH d@(DoneH _ _) _s = d | 33 | false | false | 0 | 8 | 8 | 22 | 11 | 11 | null | null |
gitpan/SMOP | m0ld/M0ld/Parser.hs | artistic-2.0 | declaration = do
symbol "my"
reg <- tok $ register
(defaultValue,action) <- option (None,[]) $ symbol "=" >> expression reg
return $ [Decl reg defaultValue] ++ action | 179 | declaration = do
symbol "my"
reg <- tok $ register
(defaultValue,action) <- option (None,[]) $ symbol "=" >> expression reg
return $ [Decl reg defaultValue] ++ action | 179 | declaration = do
symbol "my"
reg <- tok $ register
(defaultValue,action) <- option (None,[]) $ symbol "=" >> expression reg
return $ [Decl reg defaultValue] ++ action | 179 | false | false | 0 | 12 | 39 | 80 | 38 | 42 | null | null |
lukexi/ghc-7.8-arm64 | compiler/llvmGen/Llvm/PpLlvm.hs | bsd-3-clause | ppSyncOrdering SyncSeqCst = text "seq_cst" | 45 | ppSyncOrdering SyncSeqCst = text "seq_cst" | 45 | ppSyncOrdering SyncSeqCst = text "seq_cst" | 45 | false | false | 0 | 5 | 7 | 12 | 5 | 7 | null | null |
christiaanb/clash-compiler | clash-systemverilog/src/CLaSH/Backend/SystemVerilog.hs | bsd-2-clause | expr_ b (BlackBoxE _ bs bbCtx b') = do
t <- renderBlackBox bs bbCtx
parenIf (b || b') $ string t | 100 | expr_ b (BlackBoxE _ bs bbCtx b') = do
t <- renderBlackBox bs bbCtx
parenIf (b || b') $ string t | 100 | expr_ b (BlackBoxE _ bs bbCtx b') = do
t <- renderBlackBox bs bbCtx
parenIf (b || b') $ string t | 100 | false | false | 0 | 10 | 24 | 55 | 25 | 30 | null | null |
siddhanathan/ghc | compiler/utils/Binary.hs | bsd-3-clause | isEOFBin :: BinHandle -> IO Bool
isEOFBin (BinMem _ ix_r sz_r _) = do
ix <- readFastMutInt ix_r
sz <- readFastMutInt sz_r
return (ix >= sz) | 145 | isEOFBin :: BinHandle -> IO Bool
isEOFBin (BinMem _ ix_r sz_r _) = do
ix <- readFastMutInt ix_r
sz <- readFastMutInt sz_r
return (ix >= sz) | 145 | isEOFBin (BinMem _ ix_r sz_r _) = do
ix <- readFastMutInt ix_r
sz <- readFastMutInt sz_r
return (ix >= sz) | 112 | false | true | 0 | 9 | 31 | 70 | 31 | 39 | null | null |
Orvid/fbthrift | thrift/compiler/test/fixtures/service-fuzzer/gen-hs/TestService_Client.hs | apache-2.0 | send_init op arg_int1 arg_int2 arg_int3 arg_int4 arg_int5 arg_int6 arg_int7 arg_int8 arg_int9 arg_int10 arg_int11 arg_int12 arg_int13 arg_int14 arg_int15 arg_int16 = do
seq <- seqid
seqn <- readIORef seq
Thrift.writeMessage op ("init", Types.M_CALL, seqn) $
TestService.write_Init_args op (TestService.Init_args{TestService.init_args_int1=arg_int1,TestService.init_args_int2=arg_int2,TestService.init_args_int3=arg_int3,TestService.init_args_int4=arg_int4,TestService.init_args_int5=arg_int5,TestService.init_args_int6=arg_int6,TestService.init_args_int7=arg_int7,TestService.init_args_int8=arg_int8,TestService.init_args_int9=arg_int9,TestService.init_args_int10=arg_int10,TestService.init_args_int11=arg_int11,TestService.init_args_int12=arg_int12,TestService.init_args_int13=arg_int13,TestService.init_args_int14=arg_int14,TestService.init_args_int15=arg_int15,TestService.init_args_int16=arg_int16})
Thrift.tFlush (Thrift.getTransport op) | 954 | send_init op arg_int1 arg_int2 arg_int3 arg_int4 arg_int5 arg_int6 arg_int7 arg_int8 arg_int9 arg_int10 arg_int11 arg_int12 arg_int13 arg_int14 arg_int15 arg_int16 = do
seq <- seqid
seqn <- readIORef seq
Thrift.writeMessage op ("init", Types.M_CALL, seqn) $
TestService.write_Init_args op (TestService.Init_args{TestService.init_args_int1=arg_int1,TestService.init_args_int2=arg_int2,TestService.init_args_int3=arg_int3,TestService.init_args_int4=arg_int4,TestService.init_args_int5=arg_int5,TestService.init_args_int6=arg_int6,TestService.init_args_int7=arg_int7,TestService.init_args_int8=arg_int8,TestService.init_args_int9=arg_int9,TestService.init_args_int10=arg_int10,TestService.init_args_int11=arg_int11,TestService.init_args_int12=arg_int12,TestService.init_args_int13=arg_int13,TestService.init_args_int14=arg_int14,TestService.init_args_int15=arg_int15,TestService.init_args_int16=arg_int16})
Thrift.tFlush (Thrift.getTransport op) | 954 | send_init op arg_int1 arg_int2 arg_int3 arg_int4 arg_int5 arg_int6 arg_int7 arg_int8 arg_int9 arg_int10 arg_int11 arg_int12 arg_int13 arg_int14 arg_int15 arg_int16 = do
seq <- seqid
seqn <- readIORef seq
Thrift.writeMessage op ("init", Types.M_CALL, seqn) $
TestService.write_Init_args op (TestService.Init_args{TestService.init_args_int1=arg_int1,TestService.init_args_int2=arg_int2,TestService.init_args_int3=arg_int3,TestService.init_args_int4=arg_int4,TestService.init_args_int5=arg_int5,TestService.init_args_int6=arg_int6,TestService.init_args_int7=arg_int7,TestService.init_args_int8=arg_int8,TestService.init_args_int9=arg_int9,TestService.init_args_int10=arg_int10,TestService.init_args_int11=arg_int11,TestService.init_args_int12=arg_int12,TestService.init_args_int13=arg_int13,TestService.init_args_int14=arg_int14,TestService.init_args_int15=arg_int15,TestService.init_args_int16=arg_int16})
Thrift.tFlush (Thrift.getTransport op) | 954 | false | false | 0 | 11 | 50 | 241 | 134 | 107 | null | null |
bamos/snowglobe | analysis/SnowGlobe/EnrichedEvent.hs | apache-2.0 | prettyReferrer:: EnrichedEvent -> Maybe String
prettyReferrer e
| pageReferrer e == "" = Nothing
| otherwise = Just $ f (pageReferrer e) (refrMedium e)
(refrSource e) (refrTerm e)
where
f url "search" source "" = source ++ ": [Secure Search]"
f url "search" source term = concat [source, ": ", show term]
f url "social" source "" = concat [source, ": ", url]
f url "social" source term = concat [source, ": (TODO) ", url, ":", term]
f url "unknown" _ _ = url
f url "internal" _ _ = url
f url med source term = "TODO: prettyReferrer: " ++
intercalate " - " [url, med, source, term] | 676 | prettyReferrer:: EnrichedEvent -> Maybe String
prettyReferrer e
| pageReferrer e == "" = Nothing
| otherwise = Just $ f (pageReferrer e) (refrMedium e)
(refrSource e) (refrTerm e)
where
f url "search" source "" = source ++ ": [Secure Search]"
f url "search" source term = concat [source, ": ", show term]
f url "social" source "" = concat [source, ": ", url]
f url "social" source term = concat [source, ": (TODO) ", url, ":", term]
f url "unknown" _ _ = url
f url "internal" _ _ = url
f url med source term = "TODO: prettyReferrer: " ++
intercalate " - " [url, med, source, term] | 676 | prettyReferrer e
| pageReferrer e == "" = Nothing
| otherwise = Just $ f (pageReferrer e) (refrMedium e)
(refrSource e) (refrTerm e)
where
f url "search" source "" = source ++ ": [Secure Search]"
f url "search" source term = concat [source, ": ", show term]
f url "social" source "" = concat [source, ": ", url]
f url "social" source term = concat [source, ": (TODO) ", url, ":", term]
f url "unknown" _ _ = url
f url "internal" _ _ = url
f url med source term = "TODO: prettyReferrer: " ++
intercalate " - " [url, med, source, term] | 629 | false | true | 0 | 9 | 204 | 250 | 127 | 123 | null | null |
pscollins/Termonoid | src/Parser.hs | gpl-3.0 | primBody :: PrimDisplayExpr -> String
primBody (PrimText s) = s | 63 | primBody :: PrimDisplayExpr -> String
primBody (PrimText s) = s | 63 | primBody (PrimText s) = s | 25 | false | true | 0 | 7 | 9 | 24 | 12 | 12 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.