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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NicolasDP/hitolite
|
GitBunker/Hitolite.hs
|
bsd-3-clause
|
main = do
s <- openlog "Hitolite" [PID] USER DEBUG
updateGlobalLogger rootLoggerName (addHandler s)
userName <- getArgs
envs <- getEnvironment
case findIn "SSH_ORIGINAL_COMMAND" envs of
Nothing -> Prelude.putStrLn "error, command not found"
Just ocmd -> do let theCmd = commandLineParser ocmd
warningM
("user(" ++ (unpack $ Prelude.head userName) ++ ")")
(show theCmd)
executeFile (gitCmd theCmd) True (gitCmdArgs theCmd) (Just envs)
| 573
|
main = do
s <- openlog "Hitolite" [PID] USER DEBUG
updateGlobalLogger rootLoggerName (addHandler s)
userName <- getArgs
envs <- getEnvironment
case findIn "SSH_ORIGINAL_COMMAND" envs of
Nothing -> Prelude.putStrLn "error, command not found"
Just ocmd -> do let theCmd = commandLineParser ocmd
warningM
("user(" ++ (unpack $ Prelude.head userName) ++ ")")
(show theCmd)
executeFile (gitCmd theCmd) True (gitCmdArgs theCmd) (Just envs)
| 573
|
main = do
s <- openlog "Hitolite" [PID] USER DEBUG
updateGlobalLogger rootLoggerName (addHandler s)
userName <- getArgs
envs <- getEnvironment
case findIn "SSH_ORIGINAL_COMMAND" envs of
Nothing -> Prelude.putStrLn "error, command not found"
Just ocmd -> do let theCmd = commandLineParser ocmd
warningM
("user(" ++ (unpack $ Prelude.head userName) ++ ")")
(show theCmd)
executeFile (gitCmd theCmd) True (gitCmdArgs theCmd) (Just envs)
| 573
| false
| false
| 0
| 19
| 199
| 164
| 75
| 89
| null | null |
bgamari/shaking-up-ghc
|
src/Rules/Documentation.hs
|
bsd-3-clause
|
buildPdfDocumentation :: Rules ()
buildPdfDocumentation = mapM_ buildSphinxPdf docPaths
| 87
|
buildPdfDocumentation :: Rules ()
buildPdfDocumentation = mapM_ buildSphinxPdf docPaths
| 87
|
buildPdfDocumentation = mapM_ buildSphinxPdf docPaths
| 53
| false
| true
| 0
| 6
| 8
| 21
| 10
| 11
| null | null |
arekfu/project_euler
|
p0028/p0028.hs
|
mit
|
sumDiagonals n = sumDiagonals (n-2) + 4*((n-2)^2) + 10*step
where k = (n+1) `div` 2
step = n-1
| 116
|
sumDiagonals n = sumDiagonals (n-2) + 4*((n-2)^2) + 10*step
where k = (n+1) `div` 2
step = n-1
| 116
|
sumDiagonals n = sumDiagonals (n-2) + 4*((n-2)^2) + 10*step
where k = (n+1) `div` 2
step = n-1
| 116
| false
| false
| 0
| 11
| 39
| 78
| 42
| 36
| null | null |
soumith/fbthrift
|
thrift/lib/hs/Thrift/Protocol/Compact.hs
|
apache-2.0
|
parseCompactValue T_DOUBLE = TDouble . bsToFloating byteSwap64 <$> P.take 8
| 75
|
parseCompactValue T_DOUBLE = TDouble . bsToFloating byteSwap64 <$> P.take 8
| 75
|
parseCompactValue T_DOUBLE = TDouble . bsToFloating byteSwap64 <$> P.take 8
| 75
| false
| false
| 2
| 7
| 9
| 29
| 11
| 18
| null | null |
phischu/fragnix
|
builtins/base/Foreign.C.Error.hs
|
bsd-3-clause
|
eCONNREFUSED = Errno (111)
| 29
|
eCONNREFUSED = Errno (111)
| 29
|
eCONNREFUSED = Errno (111)
| 29
| false
| false
| 0
| 6
| 6
| 12
| 6
| 6
| null | null |
recursion-ninja/SecretSanta
|
Constraint/Solver.hs
|
gpl-3.0
|
-- | Recursively relaxes the history requirements,
-- | Returning the first feasible arrangment subject to maximal history constraints
solveConstraints :: [Participant] -> [Arrangement] -> Maybe Arrangement -> IO (Maybe Arrangement)
solveConstraints people archive prev
| isJust prev = return prev
| null archive = result
| otherwise = result >>= solveConstraints people (tail archive)
where
constraints = constraintMap people archive
result = getArrangement constraints
-- | Maybe select a uniformly random arrangement
| 545
|
solveConstraints :: [Participant] -> [Arrangement] -> Maybe Arrangement -> IO (Maybe Arrangement)
solveConstraints people archive prev
| isJust prev = return prev
| null archive = result
| otherwise = result >>= solveConstraints people (tail archive)
where
constraints = constraintMap people archive
result = getArrangement constraints
-- | Maybe select a uniformly random arrangement
| 410
|
solveConstraints people archive prev
| isJust prev = return prev
| null archive = result
| otherwise = result >>= solveConstraints people (tail archive)
where
constraints = constraintMap people archive
result = getArrangement constraints
-- | Maybe select a uniformly random arrangement
| 312
| true
| true
| 2
| 10
| 98
| 116
| 57
| 59
| null | null |
ulricha/algebra-sql
|
src/Database/Algebra/SQL/Tile.hs
|
bsd-3-clause
|
translateFrameStart (A.FSValPrec i) = Q.FSValPrec i
| 51
|
translateFrameStart (A.FSValPrec i) = Q.FSValPrec i
| 51
|
translateFrameStart (A.FSValPrec i) = Q.FSValPrec i
| 51
| false
| false
| 0
| 8
| 5
| 22
| 10
| 12
| null | null |
apyrgio/snf-ganeti
|
src/Ganeti/Common.hs
|
bsd-2-clause
|
complToText compl =
let show_compl = show compl
stripped = stripPrefix "OptCompl" show_compl
in map toLower $ fromMaybe show_compl stripped
| 149
|
complToText compl =
let show_compl = show compl
stripped = stripPrefix "OptCompl" show_compl
in map toLower $ fromMaybe show_compl stripped
| 149
|
complToText compl =
let show_compl = show compl
stripped = stripPrefix "OptCompl" show_compl
in map toLower $ fromMaybe show_compl stripped
| 149
| false
| false
| 0
| 9
| 29
| 45
| 20
| 25
| null | null |
ghcjs/jsaddle-dom
|
src/JSDOM/Generated/HTMLObjectElement.hs
|
mit
|
-- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement.width Mozilla HTMLObjectElement.width documentation>
setWidth ::
(MonadDOM m, ToJSString val) => HTMLObjectElement -> val -> m ()
setWidth self val = liftDOM (self ^. jss "width" (toJSVal val))
| 276
|
setWidth ::
(MonadDOM m, ToJSString val) => HTMLObjectElement -> val -> m ()
setWidth self val = liftDOM (self ^. jss "width" (toJSVal val))
| 149
|
setWidth self val = liftDOM (self ^. jss "width" (toJSVal val))
| 63
| true
| true
| 0
| 10
| 39
| 66
| 33
| 33
| null | null |
GaloisInc/halvm-ghc
|
compiler/simplCore/SetLevels.hs
|
bsd-3-clause
|
lvlLamBndrs :: LevelEnv -> Level -> [OutVar] -> (LevelEnv, [LevelledBndr])
-- Compute the levels for the binders of a lambda group
lvlLamBndrs env lvl bndrs
= lvlBndrs env new_lvl bndrs
where
new_lvl | any is_major bndrs = incMajorLvl lvl
| otherwise = incMinorLvl lvl
is_major bndr = isId bndr && not (isProbablyOneShotLambda bndr)
-- The "probably" part says "don't float things out of a
-- probable one-shot lambda"
-- See Note [Computing one-shot info] in Demand.hs
| 524
|
lvlLamBndrs :: LevelEnv -> Level -> [OutVar] -> (LevelEnv, [LevelledBndr])
lvlLamBndrs env lvl bndrs
= lvlBndrs env new_lvl bndrs
where
new_lvl | any is_major bndrs = incMajorLvl lvl
| otherwise = incMinorLvl lvl
is_major bndr = isId bndr && not (isProbablyOneShotLambda bndr)
-- The "probably" part says "don't float things out of a
-- probable one-shot lambda"
-- See Note [Computing one-shot info] in Demand.hs
| 468
|
lvlLamBndrs env lvl bndrs
= lvlBndrs env new_lvl bndrs
where
new_lvl | any is_major bndrs = incMajorLvl lvl
| otherwise = incMinorLvl lvl
is_major bndr = isId bndr && not (isProbablyOneShotLambda bndr)
-- The "probably" part says "don't float things out of a
-- probable one-shot lambda"
-- See Note [Computing one-shot info] in Demand.hs
| 393
| true
| true
| 1
| 9
| 130
| 110
| 55
| 55
| null | null |
rfranek/duckling
|
Duckling/Time/RO/Rules.hs
|
bsd-3-clause
|
ruleBetweenTimeofdayAndTimeofdayInterval :: Rule
ruleBetweenTimeofdayAndTimeofdayInterval = Rule
{ name = "between <time-of-day> and <time-of-day> (interval)"
, pattern =
[ regex "(i|\x00ee)ntre"
, Predicate isATimeOfDay
, regex "(s|\x0219)i"
, Predicate isATimeOfDay
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
Token Time <$> interval TTime.Closed td1 td2
_ -> Nothing
}
| 453
|
ruleBetweenTimeofdayAndTimeofdayInterval :: Rule
ruleBetweenTimeofdayAndTimeofdayInterval = Rule
{ name = "between <time-of-day> and <time-of-day> (interval)"
, pattern =
[ regex "(i|\x00ee)ntre"
, Predicate isATimeOfDay
, regex "(s|\x0219)i"
, Predicate isATimeOfDay
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
Token Time <$> interval TTime.Closed td1 td2
_ -> Nothing
}
| 453
|
ruleBetweenTimeofdayAndTimeofdayInterval = Rule
{ name = "between <time-of-day> and <time-of-day> (interval)"
, pattern =
[ regex "(i|\x00ee)ntre"
, Predicate isATimeOfDay
, regex "(s|\x0219)i"
, Predicate isATimeOfDay
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
Token Time <$> interval TTime.Closed td1 td2
_ -> Nothing
}
| 404
| false
| true
| 0
| 17
| 102
| 125
| 64
| 61
| null | null |
aztek/voogie
|
src/Voogie/Executable/CmdArgs.hs
|
gpl-3.0
|
banner :: Doc
banner = vsep $ fmap text [
" _ ",
" __ _____ ___ __ _(_) ___ ",
" \\ \\ / / _ \\ / _ \\ / _` | |/ _ \\",
" \\ V / (_) | (_) | (_| | | __/",
" \\_/ \\___/ \\___/ \\__, |_|\\___|",
" |___/ ",
"",
"Voogie - a verification conditions generator for simple Boogie programs"
]
| 382
|
banner :: Doc
banner = vsep $ fmap text [
" _ ",
" __ _____ ___ __ _(_) ___ ",
" \\ \\ / / _ \\ / _ \\ / _` | |/ _ \\",
" \\ V / (_) | (_) | (_| | | __/",
" \\_/ \\___/ \\___/ \\__, |_|\\___|",
" |___/ ",
"",
"Voogie - a verification conditions generator for simple Boogie programs"
]
| 382
|
banner = vsep $ fmap text [
" _ ",
" __ _____ ___ __ _(_) ___ ",
" \\ \\ / / _ \\ / _ \\ / _` | |/ _ \\",
" \\ V / (_) | (_) | (_| | | __/",
" \\_/ \\___/ \\___/ \\__, |_|\\___|",
" |___/ ",
"",
"Voogie - a verification conditions generator for simple Boogie programs"
]
| 368
| false
| true
| 0
| 7
| 167
| 44
| 26
| 18
| null | null |
ekr/tamarin-prover
|
lib/utils/src/Extension/Prelude.hs
|
gpl-3.0
|
-- | Gather all error free computations and ensure that at least one was error
-- free.
errorFree1 :: MonadPlus m => [m a] -> m [a]
errorFree1 ms = do
ms' <- errorFree ms
if null ms' then mzero else return ms'
-- Error reporting
------------------
-- | Mark a part of the code as unreachable.
| 302
|
errorFree1 :: MonadPlus m => [m a] -> m [a]
errorFree1 ms = do
ms' <- errorFree ms
if null ms' then mzero else return ms'
-- Error reporting
------------------
-- | Mark a part of the code as unreachable.
| 214
|
errorFree1 ms = do
ms' <- errorFree ms
if null ms' then mzero else return ms'
-- Error reporting
------------------
-- | Mark a part of the code as unreachable.
| 170
| true
| true
| 0
| 9
| 66
| 74
| 36
| 38
| null | null |
uduki/hsQt
|
Qtc/Gui/QCompleter.hs
|
bsd-2-clause
|
setCompletionPrefix :: QCompleter a -> ((String)) -> IO ()
setCompletionPrefix x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withCWString x1 $ \cstr_x1 ->
qtc_QCompleter_setCompletionPrefix cobj_x0 cstr_x1
| 210
|
setCompletionPrefix :: QCompleter a -> ((String)) -> IO ()
setCompletionPrefix x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withCWString x1 $ \cstr_x1 ->
qtc_QCompleter_setCompletionPrefix cobj_x0 cstr_x1
| 210
|
setCompletionPrefix x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withCWString x1 $ \cstr_x1 ->
qtc_QCompleter_setCompletionPrefix cobj_x0 cstr_x1
| 151
| false
| true
| 4
| 8
| 35
| 76
| 36
| 40
| null | null |
telser/keter
|
Keter/LabelMap.hs
|
mit
|
insertTree ("*":ls) e (WildcardExcept w t) = WildcardExcept (lemap (insertTree ls e) w) t
| 89
|
insertTree ("*":ls) e (WildcardExcept w t) = WildcardExcept (lemap (insertTree ls e) w) t
| 89
|
insertTree ("*":ls) e (WildcardExcept w t) = WildcardExcept (lemap (insertTree ls e) w) t
| 89
| false
| false
| 0
| 9
| 13
| 49
| 24
| 25
| null | null |
HJvT/hdirect
|
src/Parser.hs
|
bsd-3-clause
|
action_476 (114#) = happyGoto action_498
| 40
|
action_476 (114#) = happyGoto action_498
| 40
|
action_476 (114#) = happyGoto action_498
| 40
| false
| false
| 0
| 6
| 4
| 15
| 7
| 8
| null | null |
maple-shaft/HaskellTetris
|
src/HConsole.hs
|
mit
|
scorePaneBorderColor = makeColorI 0xFF 0xFF 0xFF 0xFF
| 53
|
scorePaneBorderColor = makeColorI 0xFF 0xFF 0xFF 0xFF
| 53
|
scorePaneBorderColor = makeColorI 0xFF 0xFF 0xFF 0xFF
| 53
| false
| false
| 1
| 5
| 6
| 18
| 7
| 11
| null | null |
bartoszw/yhaslo
|
Handler/Util.hs
|
bsd-3-clause
|
isBalloon l = l `elem` balloonsList
| 35
|
isBalloon l = l `elem` balloonsList
| 35
|
isBalloon l = l `elem` balloonsList
| 35
| false
| false
| 0
| 5
| 5
| 15
| 8
| 7
| null | null |
ellej/mire
|
test/Mire/Test/Mxp.hs
|
bsd-3-clause
|
mxpUnknownEntityTest :: Assertion
mxpUnknownEntityTest = mxpEqTest
"\ESC[0z&unknownEntity;"
[flowWarning "MXP" "entity not found: unknownEntity"]
| 151
|
mxpUnknownEntityTest :: Assertion
mxpUnknownEntityTest = mxpEqTest
"\ESC[0z&unknownEntity;"
[flowWarning "MXP" "entity not found: unknownEntity"]
| 151
|
mxpUnknownEntityTest = mxpEqTest
"\ESC[0z&unknownEntity;"
[flowWarning "MXP" "entity not found: unknownEntity"]
| 117
| false
| true
| 0
| 7
| 18
| 24
| 12
| 12
| null | null |
hguenther/nbis
|
TypeDesc.hs
|
agpl-3.0
|
indexType _ tp idx = error $ "Can't index type "++show tp
| 57
|
indexType _ tp idx = error $ "Can't index type "++show tp
| 57
|
indexType _ tp idx = error $ "Can't index type "++show tp
| 57
| false
| false
| 0
| 6
| 11
| 24
| 11
| 13
| null | null |
Helium4Haskell/helium
|
test/exports/Qual2.hs
|
gpl-3.0
|
f :: Int
f = 2
| 14
|
f :: Int
f = 2
| 14
|
f = 2
| 5
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
diku-dk/futhark
|
src/Futhark/CodeGen/Backends/COpenCL.hs
|
isc
|
callKernel (CmpSizeLe v key x) = do
x' <- GC.compileExp x
GC.stm [C.cstm|$id:v = *ctx->tuning_params.$id:key <= $exp:x';|]
sizeLoggingCode v key x'
| 153
|
callKernel (CmpSizeLe v key x) = do
x' <- GC.compileExp x
GC.stm [C.cstm|$id:v = *ctx->tuning_params.$id:key <= $exp:x';|]
sizeLoggingCode v key x'
| 153
|
callKernel (CmpSizeLe v key x) = do
x' <- GC.compileExp x
GC.stm [C.cstm|$id:v = *ctx->tuning_params.$id:key <= $exp:x';|]
sizeLoggingCode v key x'
| 153
| false
| false
| 0
| 9
| 26
| 55
| 26
| 29
| null | null |
strager/b-shake
|
B/Shake/Core/Action.hs
|
bsd-3-clause
|
apply1 :: (Rule key value) => key -> Action value
apply1 key = Action $ B.need (RuleKey key)
| 92
|
apply1 :: (Rule key value) => key -> Action value
apply1 key = Action $ B.need (RuleKey key)
| 92
|
apply1 key = Action $ B.need (RuleKey key)
| 42
| false
| true
| 2
| 8
| 17
| 52
| 24
| 28
| null | null |
VirtualForgeGmbH/hascar
|
src/Codec/Archive/SAPCAR/Pat.hs
|
gpl-2.0
|
-- getChunkType' x = show x `trace` UnknownPatChunk
getChunkType' _ = UnknownPatChunk
| 91
|
getChunkType' _ = UnknownPatChunk
| 36
|
getChunkType' _ = UnknownPatChunk
| 36
| true
| false
| 0
| 5
| 17
| 10
| 5
| 5
| null | null |
todays-mitsui/discussion
|
src/Discussion/Bool.hs
|
mit
|
isClosed' :: [Var] -> Term -> Bool
isClosed' vs (App ts) = all (isClosed' vs) ts
| 86
|
isClosed' :: [Var] -> Term -> Bool
isClosed' vs (App ts) = all (isClosed' vs) ts
| 86
|
isClosed' vs (App ts) = all (isClosed' vs) ts
| 51
| false
| true
| 0
| 7
| 21
| 44
| 22
| 22
| null | null |
eddysystems/quibble
|
Util.hs
|
bsd-2-clause
|
foldM1 _ [] = error "foldM1 applied to an empty list"
| 53
|
foldM1 _ [] = error "foldM1 applied to an empty list"
| 53
|
foldM1 _ [] = error "foldM1 applied to an empty list"
| 53
| false
| false
| 1
| 5
| 10
| 18
| 7
| 11
| null | null |
AndreasVoellmy/openflow
|
src/Network/Data/IPv4/IPPacket.hs
|
bsd-3-clause
|
getIPBody :: (IPHeader, IPProtocol) -> Get IPPacket
getIPBody (hdr@(IPHeader {..}), nwproto)
| nwproto == ipTypeTcp = do (s,d) <- getTCPHeader (ipBodyLength hdr)
return (hdr, TCPInIP s d)
| nwproto == ipTypeUdp = do (s,d) <- getUDPHeader
skip $ ipBodyLength hdr - 4
let bdy = UDPInIP s d
return (hdr, bdy)
| nwproto == ipTypeIcmp = do (icmpHdr, bs, check) <- getICMP (ipBodyLength hdr)
return (hdr, ICMPInIP icmpHdr bs check)
| otherwise = return (hdr, UninterpretedIPBody nwproto)
{-# INLINE getIPBody #-}
-- ipChecksum_ :: IPHeader -> Word8 -> Word16
-- ipChecksum_ hdr nwproto = csum16 $ runPut $ putIPHeader hdr nwproto 0
csum16 :: L.ByteString -> Word16
csum16 bs = complement $ x + y
where
x, y :: Word16
x = fromIntegral (shiftR (z .&. 0xff00) 8)
y = fromIntegral (z .&. 0x00ff)
z :: Word32
z = foldl (+) 0 ws
ws :: [Word32]
ws = runGet (sequence $ replicate (fromIntegral (L.length bs) `div` 4) getWord32be) bs
putIP :: IPPacket -> Put
putIP (hdr, body) = do
let nwproto = ipProtocol body
putIPHeader hdr nwproto $ ipChecksum hdr --(ipChecksum hdr nwproto)
putIPBody (ipBodyLength hdr) body
putIPHeader :: IPHeader -> Word8 -> Word16 -> Put
putIPHeader (IPHeader {..}) nwproto chksum = do
putWord8 b1
putWord8 diffServ
putWord16be $ fromIntegral totalLength
putWord16be ident -- identification
putWord16be flags -- flags and offset
putWord8 ttl
putWord8 nwproto
putWord16be chksum
putIPAddress ipSrcAddress
putIPAddress ipDstAddress
-- assume no options.
where
b1 = shiftL vERSION_4 4 .|. fromIntegral headerLength
diffServ = shiftL dscp 2 .|. ecn
vERSION_4 :: Word8
vERSION_4 = 4
putIPBody :: Int -> IPBody -> Put
putIPBody _ (ICMPInIP (icmpType, icmpCode) bs check) = do
putWord8 icmpType
putWord8 icmpCode
putWord16be check -- $ csum16 $ L.fromStrict bs to L.pack [icmpType, icmpCode]
-- putWord16be $ csum16 $ L.append (L.pack [icmpType, icmpCode]) (L.fromStrict bs)
-- L.fromStrict bs to L.pack [icmpType, icmpCode]
putByteString bs
putIPBody _ body = error $ "putIPBody: not yet handling IP body: " ++ show body
-- Transport Header
type ICMPHeader = (ICMPType, ICMPCode)
type ICMPType = Word8
type ICMPCode = Word8
getICMP :: Int -> Get (ICMPHeader, B.ByteString, Word16)
getICMP len = do
icmp_type <- getWord8
icmp_code <- getWord8
check <- getWord16be
bs <- getByteString $ len - 4
return ((icmp_type, icmp_code), bs, check)
{-# INLINE getICMP #-}
type TCPHeader = (TCPPortNumber, TCPPortNumber)
type TCPPortNumber = Word16
getTCPHeader :: Int -> Get TCPHeader
getTCPHeader len = do
srcp <- getWord16be
dstp <- getWord16be
skip $ len - 4
return (srcp,dstp)
{-# INLINE getTCPHeader #-}
| 2,896
|
getIPBody :: (IPHeader, IPProtocol) -> Get IPPacket
getIPBody (hdr@(IPHeader {..}), nwproto)
| nwproto == ipTypeTcp = do (s,d) <- getTCPHeader (ipBodyLength hdr)
return (hdr, TCPInIP s d)
| nwproto == ipTypeUdp = do (s,d) <- getUDPHeader
skip $ ipBodyLength hdr - 4
let bdy = UDPInIP s d
return (hdr, bdy)
| nwproto == ipTypeIcmp = do (icmpHdr, bs, check) <- getICMP (ipBodyLength hdr)
return (hdr, ICMPInIP icmpHdr bs check)
| otherwise = return (hdr, UninterpretedIPBody nwproto)
{-# INLINE getIPBody #-}
-- ipChecksum_ :: IPHeader -> Word8 -> Word16
-- ipChecksum_ hdr nwproto = csum16 $ runPut $ putIPHeader hdr nwproto 0
csum16 :: L.ByteString -> Word16
csum16 bs = complement $ x + y
where
x, y :: Word16
x = fromIntegral (shiftR (z .&. 0xff00) 8)
y = fromIntegral (z .&. 0x00ff)
z :: Word32
z = foldl (+) 0 ws
ws :: [Word32]
ws = runGet (sequence $ replicate (fromIntegral (L.length bs) `div` 4) getWord32be) bs
putIP :: IPPacket -> Put
putIP (hdr, body) = do
let nwproto = ipProtocol body
putIPHeader hdr nwproto $ ipChecksum hdr --(ipChecksum hdr nwproto)
putIPBody (ipBodyLength hdr) body
putIPHeader :: IPHeader -> Word8 -> Word16 -> Put
putIPHeader (IPHeader {..}) nwproto chksum = do
putWord8 b1
putWord8 diffServ
putWord16be $ fromIntegral totalLength
putWord16be ident -- identification
putWord16be flags -- flags and offset
putWord8 ttl
putWord8 nwproto
putWord16be chksum
putIPAddress ipSrcAddress
putIPAddress ipDstAddress
-- assume no options.
where
b1 = shiftL vERSION_4 4 .|. fromIntegral headerLength
diffServ = shiftL dscp 2 .|. ecn
vERSION_4 :: Word8
vERSION_4 = 4
putIPBody :: Int -> IPBody -> Put
putIPBody _ (ICMPInIP (icmpType, icmpCode) bs check) = do
putWord8 icmpType
putWord8 icmpCode
putWord16be check -- $ csum16 $ L.fromStrict bs to L.pack [icmpType, icmpCode]
-- putWord16be $ csum16 $ L.append (L.pack [icmpType, icmpCode]) (L.fromStrict bs)
-- L.fromStrict bs to L.pack [icmpType, icmpCode]
putByteString bs
putIPBody _ body = error $ "putIPBody: not yet handling IP body: " ++ show body
-- Transport Header
type ICMPHeader = (ICMPType, ICMPCode)
type ICMPType = Word8
type ICMPCode = Word8
getICMP :: Int -> Get (ICMPHeader, B.ByteString, Word16)
getICMP len = do
icmp_type <- getWord8
icmp_code <- getWord8
check <- getWord16be
bs <- getByteString $ len - 4
return ((icmp_type, icmp_code), bs, check)
{-# INLINE getICMP #-}
type TCPHeader = (TCPPortNumber, TCPPortNumber)
type TCPPortNumber = Word16
getTCPHeader :: Int -> Get TCPHeader
getTCPHeader len = do
srcp <- getWord16be
dstp <- getWord16be
skip $ len - 4
return (srcp,dstp)
{-# INLINE getTCPHeader #-}
| 2,896
|
getIPBody (hdr@(IPHeader {..}), nwproto)
| nwproto == ipTypeTcp = do (s,d) <- getTCPHeader (ipBodyLength hdr)
return (hdr, TCPInIP s d)
| nwproto == ipTypeUdp = do (s,d) <- getUDPHeader
skip $ ipBodyLength hdr - 4
let bdy = UDPInIP s d
return (hdr, bdy)
| nwproto == ipTypeIcmp = do (icmpHdr, bs, check) <- getICMP (ipBodyLength hdr)
return (hdr, ICMPInIP icmpHdr bs check)
| otherwise = return (hdr, UninterpretedIPBody nwproto)
{-# INLINE getIPBody #-}
-- ipChecksum_ :: IPHeader -> Word8 -> Word16
-- ipChecksum_ hdr nwproto = csum16 $ runPut $ putIPHeader hdr nwproto 0
csum16 :: L.ByteString -> Word16
csum16 bs = complement $ x + y
where
x, y :: Word16
x = fromIntegral (shiftR (z .&. 0xff00) 8)
y = fromIntegral (z .&. 0x00ff)
z :: Word32
z = foldl (+) 0 ws
ws :: [Word32]
ws = runGet (sequence $ replicate (fromIntegral (L.length bs) `div` 4) getWord32be) bs
putIP :: IPPacket -> Put
putIP (hdr, body) = do
let nwproto = ipProtocol body
putIPHeader hdr nwproto $ ipChecksum hdr --(ipChecksum hdr nwproto)
putIPBody (ipBodyLength hdr) body
putIPHeader :: IPHeader -> Word8 -> Word16 -> Put
putIPHeader (IPHeader {..}) nwproto chksum = do
putWord8 b1
putWord8 diffServ
putWord16be $ fromIntegral totalLength
putWord16be ident -- identification
putWord16be flags -- flags and offset
putWord8 ttl
putWord8 nwproto
putWord16be chksum
putIPAddress ipSrcAddress
putIPAddress ipDstAddress
-- assume no options.
where
b1 = shiftL vERSION_4 4 .|. fromIntegral headerLength
diffServ = shiftL dscp 2 .|. ecn
vERSION_4 :: Word8
vERSION_4 = 4
putIPBody :: Int -> IPBody -> Put
putIPBody _ (ICMPInIP (icmpType, icmpCode) bs check) = do
putWord8 icmpType
putWord8 icmpCode
putWord16be check -- $ csum16 $ L.fromStrict bs to L.pack [icmpType, icmpCode]
-- putWord16be $ csum16 $ L.append (L.pack [icmpType, icmpCode]) (L.fromStrict bs)
-- L.fromStrict bs to L.pack [icmpType, icmpCode]
putByteString bs
putIPBody _ body = error $ "putIPBody: not yet handling IP body: " ++ show body
-- Transport Header
type ICMPHeader = (ICMPType, ICMPCode)
type ICMPType = Word8
type ICMPCode = Word8
getICMP :: Int -> Get (ICMPHeader, B.ByteString, Word16)
getICMP len = do
icmp_type <- getWord8
icmp_code <- getWord8
check <- getWord16be
bs <- getByteString $ len - 4
return ((icmp_type, icmp_code), bs, check)
{-# INLINE getICMP #-}
type TCPHeader = (TCPPortNumber, TCPPortNumber)
type TCPPortNumber = Word16
getTCPHeader :: Int -> Get TCPHeader
getTCPHeader len = do
srcp <- getWord16be
dstp <- getWord16be
skip $ len - 4
return (srcp,dstp)
{-# INLINE getTCPHeader #-}
| 2,844
| false
| true
| 6
| 18
| 709
| 909
| 445
| 464
| null | null |
haskell-streaming/streaming
|
benchmarks/old/Stream/Prelude.hs
|
bsd-3-clause
|
-- ---------------
-- take
-- ---------------
take :: (Monad m, Functor f) => Int -> Stream f m r -> Stream f m ()
take n = buildStream . F.take n . foldStream
| 161
|
take :: (Monad m, Functor f) => Int -> Stream f m r -> Stream f m ()
take n = buildStream . F.take n . foldStream
| 113
|
take n = buildStream . F.take n . foldStream
| 44
| true
| true
| 2
| 10
| 34
| 76
| 36
| 40
| null | null |
UCSD-PL/nano-js
|
Language/Nano/SSA/SSA.hs
|
bsd-3-clause
|
ssaExpr (CallExpr l e es)
= CallExpr l <$> ssaExpr e <*> mapM ssaExpr es
| 74
|
ssaExpr (CallExpr l e es)
= CallExpr l <$> ssaExpr e <*> mapM ssaExpr es
| 74
|
ssaExpr (CallExpr l e es)
= CallExpr l <$> ssaExpr e <*> mapM ssaExpr es
| 74
| false
| false
| 2
| 6
| 16
| 40
| 17
| 23
| null | null |
codygman/Frames
|
benchmarks/InsuranceBench.hs
|
bsd-3-clause
|
pipeBenchInCore' :: IO (P Double)
pipeBenchInCore' =
do tbl <- inCore $ P.for tblP (P.yield . rcast)
:: IO (P.Producer TinyIns Identity ())
let Identity (n,sumLat) =
P.fold (\ !(!i, !s) r -> (i+1, s+rget pointLatitude r))
(0::Int,0)
id
tbl
Identity sumLong =
P.fold (\s r -> (s + rget pointLongitude r)) 0 id tbl
return $! P (sumLat / fromIntegral n) (sumLong / fromIntegral n)
-- | Perform two consecutive folds after projecting a subset of an
-- in-memory reprsentation.
| 579
|
pipeBenchInCore' :: IO (P Double)
pipeBenchInCore' =
do tbl <- inCore $ P.for tblP (P.yield . rcast)
:: IO (P.Producer TinyIns Identity ())
let Identity (n,sumLat) =
P.fold (\ !(!i, !s) r -> (i+1, s+rget pointLatitude r))
(0::Int,0)
id
tbl
Identity sumLong =
P.fold (\s r -> (s + rget pointLongitude r)) 0 id tbl
return $! P (sumLat / fromIntegral n) (sumLong / fromIntegral n)
-- | Perform two consecutive folds after projecting a subset of an
-- in-memory reprsentation.
| 579
|
pipeBenchInCore' =
do tbl <- inCore $ P.for tblP (P.yield . rcast)
:: IO (P.Producer TinyIns Identity ())
let Identity (n,sumLat) =
P.fold (\ !(!i, !s) r -> (i+1, s+rget pointLatitude r))
(0::Int,0)
id
tbl
Identity sumLong =
P.fold (\s r -> (s + rget pointLongitude r)) 0 id tbl
return $! P (sumLat / fromIntegral n) (sumLong / fromIntegral n)
-- | Perform two consecutive folds after projecting a subset of an
-- in-memory reprsentation.
| 545
| false
| true
| 0
| 15
| 187
| 220
| 111
| 109
| null | null |
sdiehl/ghc
|
libraries/base/GHC/List.hs
|
bsd-3-clause
|
-- See Note [Inline FB functions]
scanlFB :: (b -> a -> b) -> (b -> c -> c) -> a -> (b -> c) -> b -> c
scanlFB f c = \b g -> oneShot (\x -> let b' = f x b in b' `c` g b')
| 170
|
scanlFB :: (b -> a -> b) -> (b -> c -> c) -> a -> (b -> c) -> b -> c
scanlFB f c = \b g -> oneShot (\x -> let b' = f x b in b' `c` g b')
| 136
|
scanlFB f c = \b g -> oneShot (\x -> let b' = f x b in b' `c` g b')
| 67
| true
| true
| 0
| 13
| 49
| 113
| 58
| 55
| null | null |
spechub/Hets
|
Maude/Symbol.hs
|
gpl-2.0
|
kindSym2sortSym :: Symbol -> Symbol
kindSym2sortSym (Kind q) = Sort q
| 69
|
kindSym2sortSym :: Symbol -> Symbol
kindSym2sortSym (Kind q) = Sort q
| 69
|
kindSym2sortSym (Kind q) = Sort q
| 33
| false
| true
| 0
| 7
| 10
| 27
| 13
| 14
| null | null |
modeswitch/barrelfish
|
hake/RuleDefs.hs
|
mit
|
libvfs_deps_all = LibDeps $ vfsdeps [VFS_NFS, VFS_RamFS]
| 58
|
libvfs_deps_all = LibDeps $ vfsdeps [VFS_NFS, VFS_RamFS]
| 58
|
libvfs_deps_all = LibDeps $ vfsdeps [VFS_NFS, VFS_RamFS]
| 58
| false
| false
| 0
| 7
| 8
| 19
| 10
| 9
| null | null |
brendanhay/gogol
|
gogol-deploymentmanager/gen/Network/Google/DeploymentManager/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'ResourceUpdate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ruState'
--
-- * 'ruError'
--
-- * 'ruAccessControl'
--
-- * 'ruWarnings'
--
-- * 'ruIntent'
--
-- * 'ruManifest'
--
-- * 'ruFinalProperties'
--
-- * 'ruProperties'
resourceUpdate
:: ResourceUpdate
resourceUpdate =
ResourceUpdate'
{ _ruState = Nothing
, _ruError = Nothing
, _ruAccessControl = Nothing
, _ruWarnings = Nothing
, _ruIntent = Nothing
, _ruManifest = Nothing
, _ruFinalProperties = Nothing
, _ruProperties = Nothing
}
| 647
|
resourceUpdate
:: ResourceUpdate
resourceUpdate =
ResourceUpdate'
{ _ruState = Nothing
, _ruError = Nothing
, _ruAccessControl = Nothing
, _ruWarnings = Nothing
, _ruIntent = Nothing
, _ruManifest = Nothing
, _ruFinalProperties = Nothing
, _ruProperties = Nothing
}
| 307
|
resourceUpdate =
ResourceUpdate'
{ _ruState = Nothing
, _ruError = Nothing
, _ruAccessControl = Nothing
, _ruWarnings = Nothing
, _ruIntent = Nothing
, _ruManifest = Nothing
, _ruFinalProperties = Nothing
, _ruProperties = Nothing
}
| 270
| true
| true
| 1
| 7
| 142
| 87
| 59
| 28
| null | null |
rueshyna/gogol
|
gogol-webmaster-tools/gen/Network/Google/Resource/Webmasters/Sites/Delete.hs
|
mpl-2.0
|
-- | The URI of the property as defined in Search Console. Examples:
-- http:\/\/www.example.com\/ or android-app:\/\/com.example\/
sSiteURL :: Lens' SitesDelete Text
sSiteURL = lens _sSiteURL (\ s a -> s{_sSiteURL = a})
| 220
|
sSiteURL :: Lens' SitesDelete Text
sSiteURL = lens _sSiteURL (\ s a -> s{_sSiteURL = a})
| 88
|
sSiteURL = lens _sSiteURL (\ s a -> s{_sSiteURL = a})
| 53
| true
| true
| 1
| 9
| 32
| 46
| 23
| 23
| null | null |
text-utf8/text
|
tests/Tests/Properties.hs
|
bsd-2-clause
|
t_head = head `eqP` T.head
| 39
|
t_head = head `eqP` T.head
| 39
|
t_head = head `eqP` T.head
| 39
| false
| false
| 0
| 6
| 17
| 14
| 8
| 6
| null | null |
haskoin/haskoin
|
src/Haskoin/Address/Bech32.hs
|
unlicense
|
yesPadding _ _ padValue result = return $ [padValue] : result
| 61
|
yesPadding _ _ padValue result = return $ [padValue] : result
| 61
|
yesPadding _ _ padValue result = return $ [padValue] : result
| 61
| false
| false
| 0
| 7
| 10
| 26
| 13
| 13
| null | null |
pparkkin/eta
|
compiler/ETA/CodeGen/Prim.hs
|
bsd-3-clause
|
mkRtsPrimOp ReadMVarOp = (concGroup, "readMVar")
| 61
|
mkRtsPrimOp ReadMVarOp = (concGroup, "readMVar")
| 61
|
mkRtsPrimOp ReadMVarOp = (concGroup, "readMVar")
| 61
| false
| false
| 0
| 5
| 17
| 15
| 8
| 7
| null | null |
ku-fpg/kansas-amber
|
System/Hardware/Haskino/Compiler.hs
|
bsd-3-clause
|
bindName :: String
bindName = "bind"
| 36
|
bindName :: String
bindName = "bind"
| 36
|
bindName = "bind"
| 17
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
z0isch/reddit-dailyprogrammer
|
Challenge260/src/Easy.hs
|
mit
|
processCommand StoppedClosing Click = Opening
| 46
|
processCommand StoppedClosing Click = Opening
| 46
|
processCommand StoppedClosing Click = Opening
| 46
| false
| false
| 0
| 5
| 5
| 11
| 5
| 6
| null | null |
mparusinski/Haskell-number-theory-library
|
AbstractAlgebra/ModularRings.hs
|
gpl-3.0
|
mod_pow mantissa 1 = mantissa
| 29
|
mod_pow mantissa 1 = mantissa
| 29
|
mod_pow mantissa 1 = mantissa
| 29
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
beni55/fay
|
tests/Compile/StrictWrapper.hs
|
bsd-3-clause
|
r :: R
r = R 2
| 14
|
r :: R
r = R 2
| 14
|
r = R 2
| 7
| false
| true
| 0
| 6
| 6
| 21
| 8
| 13
| null | null |
energyflowanalysis/efa-2.1
|
src/EFA/Data/Axis/Mono.hs
|
bsd-3-clause
|
len ::
(DV.Storage vec a, DV.Length vec)=>
Axis typ label vec a -> Int
len (Axis _ vec) = DV.length vec
| 107
|
len ::
(DV.Storage vec a, DV.Length vec)=>
Axis typ label vec a -> Int
len (Axis _ vec) = DV.length vec
| 107
|
len (Axis _ vec) = DV.length vec
| 32
| false
| true
| 0
| 7
| 24
| 65
| 31
| 34
| null | null |
rbonifacio/funsat
|
etc/bitset/tests/Properties.hs
|
bsd-3-clause
|
prop_insDelIdempotent x s =
classify (not (xa `member` s)) "passed guard" $
not (xa `member` s) ==>
s == (delete xa . insert xa) s
where xa = abs x :: Int
| 168
|
prop_insDelIdempotent x s =
classify (not (xa `member` s)) "passed guard" $
not (xa `member` s) ==>
s == (delete xa . insert xa) s
where xa = abs x :: Int
| 168
|
prop_insDelIdempotent x s =
classify (not (xa `member` s)) "passed guard" $
not (xa `member` s) ==>
s == (delete xa . insert xa) s
where xa = abs x :: Int
| 168
| false
| false
| 2
| 10
| 45
| 79
| 41
| 38
| null | null |
robdockins/edison
|
test/src/Data/Edison/Test/FM.hs
|
mit
|
prop_filterLT :: OrdFMTest k Int fm =>
fm Int -> k -> fm Int -> Bool
prop_filterLT fm k xs =
filterLT k xs === filterWithKey (\k' _ -> k' < k) xs
| 163
|
prop_filterLT :: OrdFMTest k Int fm =>
fm Int -> k -> fm Int -> Bool
prop_filterLT fm k xs =
filterLT k xs === filterWithKey (\k' _ -> k' < k) xs
| 163
|
prop_filterLT fm k xs =
filterLT k xs === filterWithKey (\k' _ -> k' < k) xs
| 84
| false
| true
| 1
| 10
| 50
| 81
| 38
| 43
| null | null |
phaazon/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
|
bsd-3-clause
|
gl_TEXTURE_1D_STACK_MESAX :: GLenum
gl_TEXTURE_1D_STACK_MESAX = 0x8759
| 70
|
gl_TEXTURE_1D_STACK_MESAX :: GLenum
gl_TEXTURE_1D_STACK_MESAX = 0x8759
| 70
|
gl_TEXTURE_1D_STACK_MESAX = 0x8759
| 34
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
cryptica/slapnet
|
src/Solver/Formula.hs
|
gpl-3.0
|
evaluateFormula :: (Ord a, Show a) => Formula a -> SIMap a -> SBool
evaluateFormula FTrue _ = true
| 98
|
evaluateFormula :: (Ord a, Show a) => Formula a -> SIMap a -> SBool
evaluateFormula FTrue _ = true
| 98
|
evaluateFormula FTrue _ = true
| 30
| false
| true
| 0
| 8
| 18
| 45
| 22
| 23
| null | null |
DavidAlphaFox/darcs
|
src/Darcs/UI/Commands.hs
|
gpl-2.0
|
usage :: [CommandControl] -> String
usage cs = unlines
[ "Usage: darcs COMMAND ..."
, ""
, "Commands:"
, usageHelper cs
, "Use 'darcs COMMAND --help' for help on a single command."
, "Use 'darcs --version' to see the darcs version number."
, "Use 'darcs --exact-version' to see a detailed darcs version."
, "Use 'darcs help patterns' for help on patch matching."
, "Use 'darcs help environment' for help on environment variables."
, "Use 'darcs help manpage' to display help in the manpage format."
, "Use 'darcs help markdown' to display help in the markdown format."
, ""
, "Check bug reports at http://bugs.darcs.net/"
]
| 679
|
usage :: [CommandControl] -> String
usage cs = unlines
[ "Usage: darcs COMMAND ..."
, ""
, "Commands:"
, usageHelper cs
, "Use 'darcs COMMAND --help' for help on a single command."
, "Use 'darcs --version' to see the darcs version number."
, "Use 'darcs --exact-version' to see a detailed darcs version."
, "Use 'darcs help patterns' for help on patch matching."
, "Use 'darcs help environment' for help on environment variables."
, "Use 'darcs help manpage' to display help in the manpage format."
, "Use 'darcs help markdown' to display help in the markdown format."
, ""
, "Check bug reports at http://bugs.darcs.net/"
]
| 679
|
usage cs = unlines
[ "Usage: darcs COMMAND ..."
, ""
, "Commands:"
, usageHelper cs
, "Use 'darcs COMMAND --help' for help on a single command."
, "Use 'darcs --version' to see the darcs version number."
, "Use 'darcs --exact-version' to see a detailed darcs version."
, "Use 'darcs help patterns' for help on patch matching."
, "Use 'darcs help environment' for help on environment variables."
, "Use 'darcs help manpage' to display help in the manpage format."
, "Use 'darcs help markdown' to display help in the markdown format."
, ""
, "Check bug reports at http://bugs.darcs.net/"
]
| 643
| false
| true
| 0
| 7
| 160
| 66
| 39
| 27
| null | null |
antivo/Playground
|
Haskell/Crossing puzzle/a_star_h2.hs
|
gpl-2.0
|
unif :: [Node] -> [NodeThunk] -> Int -> (Node, Int) -- informacije kako doc do cvora i kolko je napravia iteracija
unif open closed acc | (goal $ state chosen) == True = (chosen, acc)
| otherwise = unif (newOpen ++ tp) newClosed (acc + 1)
where (chosen,tp) = minimize open
(newOpen, newClosed) = expand chosen closed
| 349
|
unif :: [Node] -> [NodeThunk] -> Int -> (Node, Int)
unif open closed acc | (goal $ state chosen) == True = (chosen, acc)
| otherwise = unif (newOpen ++ tp) newClosed (acc + 1)
where (chosen,tp) = minimize open
(newOpen, newClosed) = expand chosen closed
| 286
|
unif open closed acc | (goal $ state chosen) == True = (chosen, acc)
| otherwise = unif (newOpen ++ tp) newClosed (acc + 1)
where (chosen,tp) = minimize open
(newOpen, newClosed) = expand chosen closed
| 234
| true
| true
| 2
| 11
| 89
| 143
| 73
| 70
| null | null |
badp/ganeti
|
src/Ganeti/Constants.hs
|
gpl-2.0
|
ssNetworks :: String
ssNetworks = "networks"
| 44
|
ssNetworks :: String
ssNetworks = "networks"
| 44
|
ssNetworks = "networks"
| 23
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
mudphone/HaskellBook
|
src/Seventeen.hs
|
mit
|
max' :: Int -> Int -> Int
max' = max
| 36
|
max' :: Int -> Int -> Int
max' = max
| 36
|
max' = max
| 10
| false
| true
| 0
| 8
| 9
| 26
| 11
| 15
| null | null |
tylerkahn/dcpu16-haskell
|
DCPU16/Assembler.hs
|
mit
|
secondPass stmts = concatMap (\(Statement _ d) -> directiveCodeGen m d) stmts
where m = firstPass stmts
| 107
|
secondPass stmts = concatMap (\(Statement _ d) -> directiveCodeGen m d) stmts
where m = firstPass stmts
| 107
|
secondPass stmts = concatMap (\(Statement _ d) -> directiveCodeGen m d) stmts
where m = firstPass stmts
| 107
| false
| false
| 0
| 9
| 20
| 45
| 22
| 23
| null | null |
spechub/Hets
|
OWL2/XML.hs
|
gpl-2.0
|
getClassAssertion :: GA.PrefixMap -> XMLBase -> Element -> Axiom
getClassAssertion pm b e = case getName e of
"ClassAssertion" ->
let as = getAllAnnos pm b e
ce = getClassExpression pm b $ filterCL classExpressionList e
ind = getIRI pm b $ filterCL individualList e
in Assertion $ ClassAssertion as ce ind
_ -> getAnnoAxiom pm b e
| 378
|
getClassAssertion :: GA.PrefixMap -> XMLBase -> Element -> Axiom
getClassAssertion pm b e = case getName e of
"ClassAssertion" ->
let as = getAllAnnos pm b e
ce = getClassExpression pm b $ filterCL classExpressionList e
ind = getIRI pm b $ filterCL individualList e
in Assertion $ ClassAssertion as ce ind
_ -> getAnnoAxiom pm b e
| 378
|
getClassAssertion pm b e = case getName e of
"ClassAssertion" ->
let as = getAllAnnos pm b e
ce = getClassExpression pm b $ filterCL classExpressionList e
ind = getIRI pm b $ filterCL individualList e
in Assertion $ ClassAssertion as ce ind
_ -> getAnnoAxiom pm b e
| 313
| false
| true
| 0
| 13
| 105
| 125
| 59
| 66
| null | null |
tolysz/prepare-ghcjs
|
spec-lts8/aeson/Data/Aeson/TH.hs
|
bsd-3-clause
|
jsonFunValName ToJSON Arity1 = 'liftToJSON
| 46
|
jsonFunValName ToJSON Arity1 = 'liftToJSON
| 46
|
jsonFunValName ToJSON Arity1 = 'liftToJSON
| 46
| false
| false
| 0
| 5
| 8
| 12
| 6
| 6
| null | null |
josuf107/Adverb
|
Adverb/Common.hs
|
gpl-3.0
|
mirthfully = id
| 15
|
mirthfully = id
| 15
|
mirthfully = id
| 15
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
mdietz94/MAAX
|
app/src/NeuralNetwork.hs
|
gpl-2.0
|
crossover :: Genome -> Genome -> [Float] -> (Genome, [Float])
crossover genome1 genome2 rs = (genes .~ genes2 ++ genes1 $ genome1, drop (genome2^.genes.to length) rs)
where
innovationNums = map (^.innovation) $ genome1^.genes
genes2 = map snd . filter (\(r,g)-> r < 0.5 && g^.innovation `elem` innovationNums) . zip rs $ genome2^.genes
genes1 = deleteFirstsBy (\a b -> a^.innovation == b^.innovation) (genome1^.genes) genes2
-- just gets an element, convenient for using randoms
| 509
|
crossover :: Genome -> Genome -> [Float] -> (Genome, [Float])
crossover genome1 genome2 rs = (genes .~ genes2 ++ genes1 $ genome1, drop (genome2^.genes.to length) rs)
where
innovationNums = map (^.innovation) $ genome1^.genes
genes2 = map snd . filter (\(r,g)-> r < 0.5 && g^.innovation `elem` innovationNums) . zip rs $ genome2^.genes
genes1 = deleteFirstsBy (\a b -> a^.innovation == b^.innovation) (genome1^.genes) genes2
-- just gets an element, convenient for using randoms
| 509
|
crossover genome1 genome2 rs = (genes .~ genes2 ++ genes1 $ genome1, drop (genome2^.genes.to length) rs)
where
innovationNums = map (^.innovation) $ genome1^.genes
genes2 = map snd . filter (\(r,g)-> r < 0.5 && g^.innovation `elem` innovationNums) . zip rs $ genome2^.genes
genes1 = deleteFirstsBy (\a b -> a^.innovation == b^.innovation) (genome1^.genes) genes2
-- just gets an element, convenient for using randoms
| 447
| false
| true
| 0
| 17
| 102
| 203
| 109
| 94
| null | null |
benjaminselfridge/logix
|
src/Parse.hs
|
bsd-3-clause
|
char :: Char -> Parser Char
char c = Parser (\cs -> case cs of
(c':cs') | c == c' -> [(c,cs')]
_ -> [])
| 160
|
char :: Char -> Parser Char
char c = Parser (\cs -> case cs of
(c':cs') | c == c' -> [(c,cs')]
_ -> [])
| 160
|
char c = Parser (\cs -> case cs of
(c':cs') | c == c' -> [(c,cs')]
_ -> [])
| 132
| false
| true
| 0
| 14
| 81
| 81
| 40
| 41
| null | null |
kmyk/proof-haskell
|
Data/UpperBoundedPred.hs
|
mit
|
fromInterval :: Ord a => Interval a -> UpperBoundedPred a
fromInterval x = UpperBoundedPred (`isIn` x) (intervalUpperBound x)
| 125
|
fromInterval :: Ord a => Interval a -> UpperBoundedPred a
fromInterval x = UpperBoundedPred (`isIn` x) (intervalUpperBound x)
| 125
|
fromInterval x = UpperBoundedPred (`isIn` x) (intervalUpperBound x)
| 67
| false
| true
| 0
| 8
| 17
| 53
| 25
| 28
| null | null |
exercism/xhaskell
|
exercises/practice/matrix/src/Matrix.hs
|
mit
|
transpose :: Matrix a -> Matrix a
transpose matrix = error "You need to implement this function."
| 97
|
transpose :: Matrix a -> Matrix a
transpose matrix = error "You need to implement this function."
| 97
|
transpose matrix = error "You need to implement this function."
| 63
| false
| true
| 0
| 7
| 16
| 31
| 13
| 18
| null | null |
copumpkin/vector-static
|
Data/Vector/Static.hs
|
bsd-3-clause
|
reverse (Vec vs) = Vec (G.reverse vs)
| 37
|
reverse (Vec vs) = Vec (G.reverse vs)
| 37
|
reverse (Vec vs) = Vec (G.reverse vs)
| 37
| false
| false
| 0
| 8
| 6
| 26
| 12
| 14
| null | null |
maciasoft/wc
|
src/TextStatistics.hs
|
mit
|
mostCommonLetter :: TextStatistics (Maybe Char)
mostCommonLetter = fmap fst <$> ((HM.foldlWithKey' maxChar Nothing) <$> lettersMap)
where
lettersMap :: TextStatistics (HM.HashMap Char Int)
lettersMap = S.filter isWordChar $ S.fold (\hm c -> if HM.member c hm then HM.insertWith (+) c 1 hm else HM.insert c 1 hm) HM.empty
maxChar Nothing c n = Just (c, n)
maxChar (Just (c0, n0)) c n = if n > n0 then Just (c, n) else Just (c0, n0)
| 466
|
mostCommonLetter :: TextStatistics (Maybe Char)
mostCommonLetter = fmap fst <$> ((HM.foldlWithKey' maxChar Nothing) <$> lettersMap)
where
lettersMap :: TextStatistics (HM.HashMap Char Int)
lettersMap = S.filter isWordChar $ S.fold (\hm c -> if HM.member c hm then HM.insertWith (+) c 1 hm else HM.insert c 1 hm) HM.empty
maxChar Nothing c n = Just (c, n)
maxChar (Just (c0, n0)) c n = if n > n0 then Just (c, n) else Just (c0, n0)
| 466
|
mostCommonLetter = fmap fst <$> ((HM.foldlWithKey' maxChar Nothing) <$> lettersMap)
where
lettersMap :: TextStatistics (HM.HashMap Char Int)
lettersMap = S.filter isWordChar $ S.fold (\hm c -> if HM.member c hm then HM.insertWith (+) c 1 hm else HM.insert c 1 hm) HM.empty
maxChar Nothing c n = Just (c, n)
maxChar (Just (c0, n0)) c n = if n > n0 then Just (c, n) else Just (c0, n0)
| 418
| false
| true
| 3
| 11
| 109
| 221
| 109
| 112
| null | null |
Proclivis/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxSTC_CHARSET_SHIFTJIS :: Int
wxSTC_CHARSET_SHIFTJIS = 128
| 58
|
wxSTC_CHARSET_SHIFTJIS :: Int
wxSTC_CHARSET_SHIFTJIS = 128
| 58
|
wxSTC_CHARSET_SHIFTJIS = 128
| 28
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
jmgimeno/haskell-playground
|
src/FingerTrees.hs
|
unlicense
|
(<|) :: a -> FingerTree a -> FingerTree a
a <| Empty = Single a
| 77
|
(<|) :: a -> FingerTree a -> FingerTree a
a <| Empty = Single a
| 77
|
a <| Empty = Single a
| 35
| false
| true
| 0
| 9
| 28
| 39
| 18
| 21
| null | null |
switchface/helm
|
src/Helm/Engine/SDL/Keyboard.hs
|
mit
|
mapKey Codes.KeycodeNumLockClear = NumLockClearKey
| 50
|
mapKey Codes.KeycodeNumLockClear = NumLockClearKey
| 50
|
mapKey Codes.KeycodeNumLockClear = NumLockClearKey
| 50
| false
| false
| 0
| 6
| 3
| 11
| 5
| 6
| null | null |
fizruk/demarcate
|
src/Control/Monad/Trans/Demarcate/Internal.hs
|
bsd-3-clause
|
transformDemarcateM :: (forall b. m b -> Demarcate t m b) -> Demarcate t m a -> Demarcate t m a
transformDemarcateM phi = iterM transformF . unDemarcate
where
transformF (DemarcateMonad m next) = phi m >>= next
transformF (DemarcateTrans m next) = demarcateT m >>= next
-- | Substitute free monad actions with demarcated monad computations.
| 351
|
transformDemarcateM :: (forall b. m b -> Demarcate t m b) -> Demarcate t m a -> Demarcate t m a
transformDemarcateM phi = iterM transformF . unDemarcate
where
transformF (DemarcateMonad m next) = phi m >>= next
transformF (DemarcateTrans m next) = demarcateT m >>= next
-- | Substitute free monad actions with demarcated monad computations.
| 351
|
transformDemarcateM phi = iterM transformF . unDemarcate
where
transformF (DemarcateMonad m next) = phi m >>= next
transformF (DemarcateTrans m next) = demarcateT m >>= next
-- | Substitute free monad actions with demarcated monad computations.
| 255
| false
| true
| 0
| 9
| 67
| 115
| 55
| 60
| null | null |
AubreyEAnderson/shellcheck
|
ShellCheck/Analytics.hs
|
gpl-3.0
|
prop_checkArithmeticOpCommand3 = verifyNot checkArithmeticOpCommand "foo + opts"
| 80
|
prop_checkArithmeticOpCommand3 = verifyNot checkArithmeticOpCommand "foo + opts"
| 80
|
prop_checkArithmeticOpCommand3 = verifyNot checkArithmeticOpCommand "foo + opts"
| 80
| false
| false
| 0
| 5
| 6
| 11
| 5
| 6
| null | null |
Teaspot-Studio/gore-and-ash-lambdacube
|
src/Game/GoreAndAsh/LambdaCube/Module.hs
|
bsd-3-clause
|
-- | Puts storage at end of rendering queue
renderStorageLastInternal :: StorageId -> LambdaCubeEnv t -> IO ()
renderStorageLastInternal i LambdaCubeEnv{..} = atomicModifyIORef lambdaEnvRenderOrder $ \m ->
(, ()) $ S.filter (/= i) m S.|> i
| 241
|
renderStorageLastInternal :: StorageId -> LambdaCubeEnv t -> IO ()
renderStorageLastInternal i LambdaCubeEnv{..} = atomicModifyIORef lambdaEnvRenderOrder $ \m ->
(, ()) $ S.filter (/= i) m S.|> i
| 197
|
renderStorageLastInternal i LambdaCubeEnv{..} = atomicModifyIORef lambdaEnvRenderOrder $ \m ->
(, ()) $ S.filter (/= i) m S.|> i
| 130
| true
| true
| 0
| 10
| 37
| 78
| 40
| 38
| null | null |
disnet/jscheck
|
src/HJS/Parser/Prim.hs
|
bsd-3-clause
|
otherOne "(" = Just ")"
| 23
|
otherOne "(" = Just ")"
| 23
|
otherOne "(" = Just ")"
| 23
| false
| false
| 0
| 5
| 4
| 12
| 5
| 7
| null | null |
wxwxwwxxx/ghc
|
testsuite/tests/codeGen/should_run/CopySmallArrayStressTest.hs
|
bsd-3-clause
|
test_copyMutableArray :: Int -> String
test_copyMutableArray numMods = runST $ run $ do
marr <- local setup
marrRef <- setup
let go i
| i >= numMods = return "test_copyMutableArray: OK"
| otherwise = do
-- Either allocate or copy
alloc <- rnd (True, False)
if alloc then doAlloc else doCopy
go (i+1)
doAlloc = do
local $ allocate marr
allocate marrRef
doCopy = do
inp <- liftST $ asList marr
_ <- local $ copy marr copyMArray
(six, dix, srcOff, dstOff, n) <- copy marrRef copyMArraySlow
el <- liftST $ asList marr
elRef <- liftST $ asList marrRef
when (el /= elRef) $
fail inp el elRef six dix srcOff dstOff n
go 0
where
fail inp el elRef six dix srcOff dstOff n =
error $ "test_copyMutableArray: FAIL\n"
++ " Input: " ++ unlinesShow inp
++ " Copy: six: " ++ show six ++ " dix: " ++ show dix ++ " srcOff: "
++ show srcOff ++ " dstOff: " ++ show dstOff ++ " n: " ++ show n ++ "\n"
++ "Expected: " ++ unlinesShow elRef
++ " Actual: " ++ unlinesShow el
| 1,243
|
test_copyMutableArray :: Int -> String
test_copyMutableArray numMods = runST $ run $ do
marr <- local setup
marrRef <- setup
let go i
| i >= numMods = return "test_copyMutableArray: OK"
| otherwise = do
-- Either allocate or copy
alloc <- rnd (True, False)
if alloc then doAlloc else doCopy
go (i+1)
doAlloc = do
local $ allocate marr
allocate marrRef
doCopy = do
inp <- liftST $ asList marr
_ <- local $ copy marr copyMArray
(six, dix, srcOff, dstOff, n) <- copy marrRef copyMArraySlow
el <- liftST $ asList marr
elRef <- liftST $ asList marrRef
when (el /= elRef) $
fail inp el elRef six dix srcOff dstOff n
go 0
where
fail inp el elRef six dix srcOff dstOff n =
error $ "test_copyMutableArray: FAIL\n"
++ " Input: " ++ unlinesShow inp
++ " Copy: six: " ++ show six ++ " dix: " ++ show dix ++ " srcOff: "
++ show srcOff ++ " dstOff: " ++ show dstOff ++ " n: " ++ show n ++ "\n"
++ "Expected: " ++ unlinesShow elRef
++ " Actual: " ++ unlinesShow el
| 1,243
|
test_copyMutableArray numMods = runST $ run $ do
marr <- local setup
marrRef <- setup
let go i
| i >= numMods = return "test_copyMutableArray: OK"
| otherwise = do
-- Either allocate or copy
alloc <- rnd (True, False)
if alloc then doAlloc else doCopy
go (i+1)
doAlloc = do
local $ allocate marr
allocate marrRef
doCopy = do
inp <- liftST $ asList marr
_ <- local $ copy marr copyMArray
(six, dix, srcOff, dstOff, n) <- copy marrRef copyMArraySlow
el <- liftST $ asList marr
elRef <- liftST $ asList marrRef
when (el /= elRef) $
fail inp el elRef six dix srcOff dstOff n
go 0
where
fail inp el elRef six dix srcOff dstOff n =
error $ "test_copyMutableArray: FAIL\n"
++ " Input: " ++ unlinesShow inp
++ " Copy: six: " ++ show six ++ " dix: " ++ show dix ++ " srcOff: "
++ show srcOff ++ " dstOff: " ++ show dstOff ++ " n: " ++ show n ++ "\n"
++ "Expected: " ++ unlinesShow elRef
++ " Actual: " ++ unlinesShow el
| 1,204
| false
| true
| 0
| 22
| 481
| 390
| 181
| 209
| null | null |
SneakingCat/fay-ticker
|
test/TestRunner.hs
|
gpl-3.0
|
main :: IO ()
main = defaultMain tests
| 38
|
main :: IO ()
main = defaultMain tests
| 38
|
main = defaultMain tests
| 24
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
ctford/Idris-Elba-dev
|
src/Idris/Core/TT.hs
|
bsd-3-clause
|
showEnv :: (Eq n, Show n) => EnvTT n -> TT n -> String
showEnv env t = showEnv' env t False
| 91
|
showEnv :: (Eq n, Show n) => EnvTT n -> TT n -> String
showEnv env t = showEnv' env t False
| 91
|
showEnv env t = showEnv' env t False
| 36
| false
| true
| 0
| 9
| 21
| 60
| 26
| 34
| null | null |
vikraman/ghc
|
compiler/simplCore/CoreMonad.hs
|
bsd-3-clause
|
tickString BottomFound = "BottomFound"
| 55
|
tickString BottomFound = "BottomFound"
| 55
|
tickString BottomFound = "BottomFound"
| 55
| false
| false
| 0
| 5
| 20
| 9
| 4
| 5
| null | null |
asztal/transact-sql
|
Language/TransactSql/Types.hs
|
bsd-3-clause
|
scale TinyInt = Just 0
| 22
|
scale TinyInt = Just 0
| 22
|
scale TinyInt = Just 0
| 22
| false
| false
| 0
| 5
| 4
| 13
| 5
| 8
| null | null |
tjakway/ghcjvm
|
compiler/cmm/CLabel.hs
|
bsd-3-clause
|
-- | Check whether a label corresponds to a C function that has
-- a prototype in a system header somehere, or is built-in
-- to the C compiler. For these labels we avoid generating our
-- own C prototypes.
isMathFun :: CLabel -> Bool
isMathFun (ForeignLabel fs _ _ _) = fs `elementOfUniqSet` math_funs
| 323
|
isMathFun :: CLabel -> Bool
isMathFun (ForeignLabel fs _ _ _) = fs `elementOfUniqSet` math_funs
| 101
|
isMathFun (ForeignLabel fs _ _ _) = fs `elementOfUniqSet` math_funs
| 73
| true
| true
| 0
| 7
| 75
| 40
| 23
| 17
| null | null |
edsko/hackage-server
|
Distribution/Server/Pages/Template.hs
|
bsd-3-clause
|
-- URL about user accounts, including the form to change passwords
accountsURL :: URL
accountsURL = "/accounts"
| 111
|
accountsURL :: URL
accountsURL = "/accounts"
| 44
|
accountsURL = "/accounts"
| 25
| true
| true
| 0
| 4
| 16
| 12
| 7
| 5
| null | null |
li-zhirui/EoplLangs
|
src/NamelessIntp/Parser.hs
|
bsd-3-clause
|
unaryOpExpr :: Parser Expression
unaryOpExpr = do
op <- unaryOp
expr <- parens expression
return $ UnaryOpExpr op expr
-- | IfExpr ::= if Expression then Expression
| 171
|
unaryOpExpr :: Parser Expression
unaryOpExpr = do
op <- unaryOp
expr <- parens expression
return $ UnaryOpExpr op expr
-- | IfExpr ::= if Expression then Expression
| 171
|
unaryOpExpr = do
op <- unaryOp
expr <- parens expression
return $ UnaryOpExpr op expr
-- | IfExpr ::= if Expression then Expression
| 138
| false
| true
| 0
| 8
| 33
| 44
| 20
| 24
| null | null |
opensuse-haskell/configuration
|
src/cabal2obs/Config/Ghc810x.hs
|
gpl-3.0
|
ghc810x :: Action PackageSetConfig
ghc810x = do
let compiler = "ghc-8.10.7"
flagAssignments = fromList (readFlagAssignents flagList)
forcedExectables = forcedExectableNames
corePackages = ghcCorePackages
packageSet <- fromList <$>
forM (toList constraintList) (\(pn,vr) ->
(,) pn <$> askOracle (PackageVersionConstraint pn vr))
checkConsistency (PackageSetConfig {..})
{-
targetPackages :: ConstraintSet
targetPackages = [ "alex >=3.2.5"
, "cabal-install ==3.2.*"
, "cabal2spec >=2.6"
, "cabal-plan"
, "distribution-opensuse >= 1.1.1"
, "git-annex"
, "happy >=1.19.12"
, "hledger", "hledger-ui", "hledger-interest"
, "hlint"
, "ghcid"
, "pandoc >=2.9.2.1"
, "citeproc >=0.17"
, "postgresql-simple" -- needed by emu-incident-report
, "SDL >=0.6.6.0" -- Dmitriy Perlow <dap.darkness@gmail.com> needs the
, "SDL-image >=0.6.2.0" -- SDL packages for games/raincat.
, "SDL-mixer >=0.6.3.0"
, "shake"
, "ShellCheck >=0.7.1"
, "weeder"
, "xmobar >= 0.33"
, "xmonad >= 0.15"
, "xmonad-contrib >= 0.16"
]
resolveConstraints :: String
resolveConstraints = unwords ["cabal", "install", "--dry-run", "--minimize-conflict-set", constraints, flags, pkgs]
where
pkgs = intercalate " " (display <$> keys targetPackages)
constraints = "--constraint=" <> intercalate " --constraint=" (show <$> environment)
environment = display . (\(n,v) -> PackageVersionConstraint n v) <$> toList (corePackages `union` targetPackages)
flags = unwords [ "--constraint=" <> show (unwords [unPackageName pn, flags'])
| pn <- keys targetPackages
, Just flags' <- [lookup (unPackageName pn) flagList]
]
-}
| 2,142
|
ghc810x :: Action PackageSetConfig
ghc810x = do
let compiler = "ghc-8.10.7"
flagAssignments = fromList (readFlagAssignents flagList)
forcedExectables = forcedExectableNames
corePackages = ghcCorePackages
packageSet <- fromList <$>
forM (toList constraintList) (\(pn,vr) ->
(,) pn <$> askOracle (PackageVersionConstraint pn vr))
checkConsistency (PackageSetConfig {..})
{-
targetPackages :: ConstraintSet
targetPackages = [ "alex >=3.2.5"
, "cabal-install ==3.2.*"
, "cabal2spec >=2.6"
, "cabal-plan"
, "distribution-opensuse >= 1.1.1"
, "git-annex"
, "happy >=1.19.12"
, "hledger", "hledger-ui", "hledger-interest"
, "hlint"
, "ghcid"
, "pandoc >=2.9.2.1"
, "citeproc >=0.17"
, "postgresql-simple" -- needed by emu-incident-report
, "SDL >=0.6.6.0" -- Dmitriy Perlow <dap.darkness@gmail.com> needs the
, "SDL-image >=0.6.2.0" -- SDL packages for games/raincat.
, "SDL-mixer >=0.6.3.0"
, "shake"
, "ShellCheck >=0.7.1"
, "weeder"
, "xmobar >= 0.33"
, "xmonad >= 0.15"
, "xmonad-contrib >= 0.16"
]
resolveConstraints :: String
resolveConstraints = unwords ["cabal", "install", "--dry-run", "--minimize-conflict-set", constraints, flags, pkgs]
where
pkgs = intercalate " " (display <$> keys targetPackages)
constraints = "--constraint=" <> intercalate " --constraint=" (show <$> environment)
environment = display . (\(n,v) -> PackageVersionConstraint n v) <$> toList (corePackages `union` targetPackages)
flags = unwords [ "--constraint=" <> show (unwords [unPackageName pn, flags'])
| pn <- keys targetPackages
, Just flags' <- [lookup (unPackageName pn) flagList]
]
-}
| 2,142
|
ghc810x = do
let compiler = "ghc-8.10.7"
flagAssignments = fromList (readFlagAssignents flagList)
forcedExectables = forcedExectableNames
corePackages = ghcCorePackages
packageSet <- fromList <$>
forM (toList constraintList) (\(pn,vr) ->
(,) pn <$> askOracle (PackageVersionConstraint pn vr))
checkConsistency (PackageSetConfig {..})
{-
targetPackages :: ConstraintSet
targetPackages = [ "alex >=3.2.5"
, "cabal-install ==3.2.*"
, "cabal2spec >=2.6"
, "cabal-plan"
, "distribution-opensuse >= 1.1.1"
, "git-annex"
, "happy >=1.19.12"
, "hledger", "hledger-ui", "hledger-interest"
, "hlint"
, "ghcid"
, "pandoc >=2.9.2.1"
, "citeproc >=0.17"
, "postgresql-simple" -- needed by emu-incident-report
, "SDL >=0.6.6.0" -- Dmitriy Perlow <dap.darkness@gmail.com> needs the
, "SDL-image >=0.6.2.0" -- SDL packages for games/raincat.
, "SDL-mixer >=0.6.3.0"
, "shake"
, "ShellCheck >=0.7.1"
, "weeder"
, "xmobar >= 0.33"
, "xmonad >= 0.15"
, "xmonad-contrib >= 0.16"
]
resolveConstraints :: String
resolveConstraints = unwords ["cabal", "install", "--dry-run", "--minimize-conflict-set", constraints, flags, pkgs]
where
pkgs = intercalate " " (display <$> keys targetPackages)
constraints = "--constraint=" <> intercalate " --constraint=" (show <$> environment)
environment = display . (\(n,v) -> PackageVersionConstraint n v) <$> toList (corePackages `union` targetPackages)
flags = unwords [ "--constraint=" <> show (unwords [unPackageName pn, flags'])
| pn <- keys targetPackages
, Just flags' <- [lookup (unPackageName pn) flagList]
]
-}
| 2,107
| false
| true
| 1
| 12
| 773
| 120
| 61
| 59
| null | null |
kvanberendonck/monad-chrono
|
src/Control/Monad/Chrono.hs
|
bsd-3-clause
|
mkChronoS :: Keystone s e => s -> ChronoS s e
mkChronoS s = ChronoS [] s []
| 75
|
mkChronoS :: Keystone s e => s -> ChronoS s e
mkChronoS s = ChronoS [] s []
| 75
|
mkChronoS s = ChronoS [] s []
| 29
| false
| true
| 0
| 7
| 17
| 43
| 20
| 23
| null | null |
alasconnect/auth0
|
src/Auth0/Management/Rules.hs
|
apache-2.0
|
rulesGet
:<|> ruleCreate
:<|> ruleGet
:<|> ruleDelete
:<|> ruleUpdate
= client rulesApi
| 97
|
rulesGet
:<|> ruleCreate
:<|> ruleGet
:<|> ruleDelete
:<|> ruleUpdate
= client rulesApi
| 97
|
rulesGet
:<|> ruleCreate
:<|> ruleGet
:<|> ruleDelete
:<|> ruleUpdate
= client rulesApi
| 97
| false
| false
| 13
| 5
| 21
| 41
| 20
| 21
| null | null |
gnn/Hets
|
OWL2/Morphism.hs
|
gpl-2.0
|
statSymbItems :: Sign -> [SymbItems] -> [RawSymb]
statSymbItems sig = map (function Expand . StringMap $ prefixMap sig)
. concatMap
(\ (SymbItems m us) -> case m of
AnyEntity -> map AnUri us
EntityType ty -> map (ASymbol . mkEntity ty) us
PrefixO -> map (APrefix . showQN) us)
| 325
|
statSymbItems :: Sign -> [SymbItems] -> [RawSymb]
statSymbItems sig = map (function Expand . StringMap $ prefixMap sig)
. concatMap
(\ (SymbItems m us) -> case m of
AnyEntity -> map AnUri us
EntityType ty -> map (ASymbol . mkEntity ty) us
PrefixO -> map (APrefix . showQN) us)
| 325
|
statSymbItems sig = map (function Expand . StringMap $ prefixMap sig)
. concatMap
(\ (SymbItems m us) -> case m of
AnyEntity -> map AnUri us
EntityType ty -> map (ASymbol . mkEntity ty) us
PrefixO -> map (APrefix . showQN) us)
| 275
| false
| true
| 1
| 14
| 97
| 130
| 63
| 67
| null | null |
sol/aeson
|
Data/Aeson/TH.hs
|
bsd-3-clause
|
-- Generate a list of fresh names with a common prefix, and numbered suffixes.
newNameList :: String -> Int -> Q [Name]
newNameList prefix len = mapM newName [prefix ++ show n | n <- [1..len]]
| 192
|
newNameList :: String -> Int -> Q [Name]
newNameList prefix len = mapM newName [prefix ++ show n | n <- [1..len]]
| 113
|
newNameList prefix len = mapM newName [prefix ++ show n | n <- [1..len]]
| 72
| true
| true
| 0
| 9
| 35
| 59
| 30
| 29
| null | null |
byorgey/Idris-dev
|
src/Idris/Completion.hs
|
bsd-3-clause
|
nameString (UN n) = Just n
| 32
|
nameString (UN n) = Just n
| 32
|
nameString (UN n) = Just n
| 32
| false
| false
| 0
| 7
| 11
| 18
| 8
| 10
| null | null |
janm399/equationsolver
|
src/EquationSolver/ManualParser.hs
|
apache-2.0
|
-- prepares syntax error
syntaxError :: (Show a) => a -> Flow b
syntaxError x = throwError $ "Bad syntax near " ++ (show x)
| 127
|
syntaxError :: (Show a) => a -> Flow b
syntaxError x = throwError $ "Bad syntax near " ++ (show x)
| 98
|
syntaxError x = throwError $ "Bad syntax near " ++ (show x)
| 59
| true
| true
| 0
| 8
| 28
| 50
| 24
| 26
| null | null |
elitak/hs-datahand
|
stm32f10x/hs_src/Foreign/Storable/Traversable.hs
|
gpl-3.0
|
peekApplicative ::
(App.Applicative f, Trav.Traversable f, Storable a) =>
Ptr (f a) -> IO (f a)
peekApplicative =
evalStateT (Trav.sequence (App.pure peekState)) . castPtr
| 180
|
peekApplicative ::
(App.Applicative f, Trav.Traversable f, Storable a) =>
Ptr (f a) -> IO (f a)
peekApplicative =
evalStateT (Trav.sequence (App.pure peekState)) . castPtr
| 180
|
peekApplicative =
evalStateT (Trav.sequence (App.pure peekState)) . castPtr
| 78
| false
| true
| 0
| 11
| 32
| 81
| 40
| 41
| null | null |
snoyberg/ghc
|
compiler/typecheck/TcRnTypes.hs
|
bsd-3-clause
|
addSimples :: WantedConstraints -> Bag Ct -> WantedConstraints
addSimples wc cts
= wc { wc_simple = wc_simple wc `unionBags` cts }
| 132
|
addSimples :: WantedConstraints -> Bag Ct -> WantedConstraints
addSimples wc cts
= wc { wc_simple = wc_simple wc `unionBags` cts }
| 132
|
addSimples wc cts
= wc { wc_simple = wc_simple wc `unionBags` cts }
| 69
| false
| true
| 0
| 9
| 22
| 53
| 25
| 28
| null | null |
rpglover64/lens
|
experimental/Control/Lens/Format.hs
|
bsd-3-clause
|
-- Monoid m => ((b -> b) -> m -> t) -> t
format :: Monoid m => Formatting b m s t a b -> t
format l = (runMutator #. runFormatted (l (Formatted Mutator))) mempty
| 161
|
format :: Monoid m => Formatting b m s t a b -> t
format l = (runMutator #. runFormatted (l (Formatted Mutator))) mempty
| 120
|
format l = (runMutator #. runFormatted (l (Formatted Mutator))) mempty
| 70
| true
| true
| 0
| 12
| 36
| 64
| 31
| 33
| null | null |
Mokosha/Lambency
|
lib/Lambency/Shader/OpenGL.hs
|
mit
|
buildDeclarations :: [Declaration] -> BS.ByteString
buildDeclarations decls' =
let groupDecls x y = getDeclType x == getDeclType y
decls = concat $ List.groupBy groupDecls decls'
in BS.concat $ map buildDeclaration decls ++ [BS.singleton '\n']
| 253
|
buildDeclarations :: [Declaration] -> BS.ByteString
buildDeclarations decls' =
let groupDecls x y = getDeclType x == getDeclType y
decls = concat $ List.groupBy groupDecls decls'
in BS.concat $ map buildDeclaration decls ++ [BS.singleton '\n']
| 253
|
buildDeclarations decls' =
let groupDecls x y = getDeclType x == getDeclType y
decls = concat $ List.groupBy groupDecls decls'
in BS.concat $ map buildDeclaration decls ++ [BS.singleton '\n']
| 201
| false
| true
| 0
| 11
| 43
| 88
| 42
| 46
| null | null |
lesguillemets/rainfall-vim-hs
|
src/YOLP/Geocoder/Result.hs
|
bsd-3-clause
|
getFirstCandidate :: ByteString -> Maybe GeoResp
getFirstCandidate txt = do
firstCand <- txt ^? key "Feature" . nth 0
name <- firstCand ^? key "Name" . _String
-- TODO : probably a better way
coords <- (firstCand ^? key "Geometry")
>>= (^? key "Coordinates" . _String)
>>= parseCoords
return $ GeoResp name coords
| 370
|
getFirstCandidate :: ByteString -> Maybe GeoResp
getFirstCandidate txt = do
firstCand <- txt ^? key "Feature" . nth 0
name <- firstCand ^? key "Name" . _String
-- TODO : probably a better way
coords <- (firstCand ^? key "Geometry")
>>= (^? key "Coordinates" . _String)
>>= parseCoords
return $ GeoResp name coords
| 370
|
getFirstCandidate txt = do
firstCand <- txt ^? key "Feature" . nth 0
name <- firstCand ^? key "Name" . _String
-- TODO : probably a better way
coords <- (firstCand ^? key "Geometry")
>>= (^? key "Coordinates" . _String)
>>= parseCoords
return $ GeoResp name coords
| 320
| false
| true
| 0
| 12
| 109
| 109
| 51
| 58
| null | null |
m-alvarez/jhc
|
src/Util/Histogram.hs
|
mit
|
keys :: Histogram a -> [a]
keys (Histogram m) = Map.keys m
| 58
|
keys :: Histogram a -> [a]
keys (Histogram m) = Map.keys m
| 58
|
keys (Histogram m) = Map.keys m
| 31
| false
| true
| 0
| 9
| 11
| 40
| 18
| 22
| null | null |
SimSaladin/haikubot
|
Haikubot/Plugins/MPlay.hs
|
bsd-3-clause
|
handleUni :: Shared Env -> IrcMessage -> Handler Result
handleUni env message
| mcode == "PRIVMSG" && prefixed = handleCommand message
| otherwise = none
where mmsg = decodeUtf8 $ mMsg message
mcode = mCode message
prefixed = "\\" `isPrefixOf` mmsg
| 298
|
handleUni :: Shared Env -> IrcMessage -> Handler Result
handleUni env message
| mcode == "PRIVMSG" && prefixed = handleCommand message
| otherwise = none
where mmsg = decodeUtf8 $ mMsg message
mcode = mCode message
prefixed = "\\" `isPrefixOf` mmsg
| 298
|
handleUni env message
| mcode == "PRIVMSG" && prefixed = handleCommand message
| otherwise = none
where mmsg = decodeUtf8 $ mMsg message
mcode = mCode message
prefixed = "\\" `isPrefixOf` mmsg
| 242
| false
| true
| 3
| 9
| 90
| 90
| 43
| 47
| null | null |
hferreiro/replay
|
compiler/cmm/CLabel.hs
|
bsd-3-clause
|
labelType (CmmLabel _ _ CmmPrimCall) = CodeLabel
| 59
|
labelType (CmmLabel _ _ CmmPrimCall) = CodeLabel
| 59
|
labelType (CmmLabel _ _ CmmPrimCall) = CodeLabel
| 59
| false
| false
| 0
| 6
| 17
| 20
| 9
| 11
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/Main/StaticFlags.hs
|
bsd-3-clause
|
isStaticFlag :: String -> Bool
isStaticFlag f = f `elem` flagsStaticNames
| 73
|
isStaticFlag :: String -> Bool
isStaticFlag f = f `elem` flagsStaticNames
| 73
|
isStaticFlag f = f `elem` flagsStaticNames
| 42
| false
| true
| 0
| 5
| 10
| 24
| 13
| 11
| null | null |
rueshyna/gogol
|
gogol-games/gen/Network/Google/Resource/Games/TurnBasedMatches/Rematch.hs
|
mpl-2.0
|
-- | The last-seen mutation timestamp.
tbmrConsistencyToken :: Lens' TurnBasedMatchesRematch (Maybe Int64)
tbmrConsistencyToken
= lens _tbmrConsistencyToken
(\ s a -> s{_tbmrConsistencyToken = a})
. mapping _Coerce
| 228
|
tbmrConsistencyToken :: Lens' TurnBasedMatchesRematch (Maybe Int64)
tbmrConsistencyToken
= lens _tbmrConsistencyToken
(\ s a -> s{_tbmrConsistencyToken = a})
. mapping _Coerce
| 189
|
tbmrConsistencyToken
= lens _tbmrConsistencyToken
(\ s a -> s{_tbmrConsistencyToken = a})
. mapping _Coerce
| 121
| true
| true
| 0
| 10
| 39
| 55
| 28
| 27
| null | null |
codemac/yi-editor
|
src/Yi/Buffer/Undo.hs
|
gpl-2.0
|
isAtSavedFilePointU :: URList -> Bool
isAtSavedFilePointU (URList us _) = isUnchanged us
where
isUnchanged cs = case cs of
[] -> False
(SavedFilePoint : _) -> True
(InteractivePoint : cs') -> isUnchanged cs'
_ -> False
| 297
|
isAtSavedFilePointU :: URList -> Bool
isAtSavedFilePointU (URList us _) = isUnchanged us
where
isUnchanged cs = case cs of
[] -> False
(SavedFilePoint : _) -> True
(InteractivePoint : cs') -> isUnchanged cs'
_ -> False
| 297
|
isAtSavedFilePointU (URList us _) = isUnchanged us
where
isUnchanged cs = case cs of
[] -> False
(SavedFilePoint : _) -> True
(InteractivePoint : cs') -> isUnchanged cs'
_ -> False
| 259
| false
| true
| 0
| 9
| 114
| 86
| 43
| 43
| null | null |
narurien/ganeti-ceph
|
src/Ganeti/HTools/Cluster.hs
|
gpl-2.0
|
-- | Reverses an evacuation solution.
--
-- Rationale: we always concat the results to the top of the lists, so
-- for proper jobset execution, we should reverse all lists.
reverseEvacSolution :: EvacSolution -> EvacSolution
reverseEvacSolution (EvacSolution f m o) =
EvacSolution (reverse f) (reverse m) (reverse o)
| 318
|
reverseEvacSolution :: EvacSolution -> EvacSolution
reverseEvacSolution (EvacSolution f m o) =
EvacSolution (reverse f) (reverse m) (reverse o)
| 145
|
reverseEvacSolution (EvacSolution f m o) =
EvacSolution (reverse f) (reverse m) (reverse o)
| 93
| true
| true
| 0
| 9
| 50
| 65
| 31
| 34
| null | null |
phaazon/Idris-dev
|
src/IRTS/CodegenJavaScript.hs
|
bsd-3-clause
|
jsPOP :: JS
jsPOP = JSApp (JSProj jsCALLSTACK "pop") []
| 55
|
jsPOP :: JS
jsPOP = JSApp (JSProj jsCALLSTACK "pop") []
| 55
|
jsPOP = JSApp (JSProj jsCALLSTACK "pop") []
| 43
| false
| true
| 0
| 7
| 9
| 26
| 13
| 13
| null | null |
artuuge/IHaskell
|
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Output.hs
|
mit
|
appendOutput :: IHaskellDisplay a => OutputWidget -> a -> IO ()
appendOutput widget out = do
disp <- display out
widgetPublishDisplay widget disp
-- | Clear the output widget immediately
| 191
|
appendOutput :: IHaskellDisplay a => OutputWidget -> a -> IO ()
appendOutput widget out = do
disp <- display out
widgetPublishDisplay widget disp
-- | Clear the output widget immediately
| 191
|
appendOutput widget out = do
disp <- display out
widgetPublishDisplay widget disp
-- | Clear the output widget immediately
| 127
| false
| true
| 0
| 10
| 34
| 60
| 26
| 34
| null | null |
freevoid/rwh-exercises
|
ch03.hs
|
mit
|
-- ex. 1
fromList' :: List a -> [a]
fromList' (Cons x xs) = x:(fromList' xs)
| 76
|
fromList' :: List a -> [a]
fromList' (Cons x xs) = x:(fromList' xs)
| 67
|
fromList' (Cons x xs) = x:(fromList' xs)
| 40
| true
| true
| 0
| 7
| 15
| 43
| 22
| 21
| null | null |
kadena-io/pact
|
src-tool/Pact/Analyze/Eval/Core.hs
|
bsd-3-clause
|
evalCore (Numerical a) = evalNumerical a
| 60
|
evalCore (Numerical a) = evalNumerical a
| 60
|
evalCore (Numerical a) = evalNumerical a
| 60
| false
| false
| 0
| 7
| 25
| 18
| 8
| 10
| null | null |
minad/writer-cps-transformers
|
src/Control/Monad/Trans/Writer/CPS/Internal.hs
|
bsd-3-clause
|
-- | Extract the output from a writer computation.
--
-- * @'execWriter' m = 'snd' ('runWriter' m)@
execWriter :: Monoid w => Writer w a -> w
execWriter = runIdentity . execWriterT
| 180
|
execWriter :: Monoid w => Writer w a -> w
execWriter = runIdentity . execWriterT
| 80
|
execWriter = runIdentity . execWriterT
| 38
| true
| true
| 0
| 7
| 32
| 34
| 18
| 16
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.