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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
edsko/hackage-server
|
exes/Main.hs
|
bsd-3-clause
|
checkTmpDir :: FilePath -> IO ()
checkTmpDir tmpDir = do
exists <- doesDirectoryExist tmpDir
when (not exists) $ fail $ "The temporary directory " ++ tmpDir ++ " does not exist. Create the directory or use --tmp-dir to specify an alternate location."
perms <- getPermissions tmpDir
when (not $ readable perms) $
fail $ "The temporary directory " ++ tmpDir ++ " is not readable by the server. Fix the permissions or use --tmp-dir to specify an alternate location."
when (not $ writable perms) $
fail $ "The temporary directory " ++ tmpDir ++ " is not writable by the server. Fix the permissions or use --tmp-dir to specify an alternate location."
-- Check that staticDir exists and is readable
| 711
|
checkTmpDir :: FilePath -> IO ()
checkTmpDir tmpDir = do
exists <- doesDirectoryExist tmpDir
when (not exists) $ fail $ "The temporary directory " ++ tmpDir ++ " does not exist. Create the directory or use --tmp-dir to specify an alternate location."
perms <- getPermissions tmpDir
when (not $ readable perms) $
fail $ "The temporary directory " ++ tmpDir ++ " is not readable by the server. Fix the permissions or use --tmp-dir to specify an alternate location."
when (not $ writable perms) $
fail $ "The temporary directory " ++ tmpDir ++ " is not writable by the server. Fix the permissions or use --tmp-dir to specify an alternate location."
-- Check that staticDir exists and is readable
| 711
|
checkTmpDir tmpDir = do
exists <- doesDirectoryExist tmpDir
when (not exists) $ fail $ "The temporary directory " ++ tmpDir ++ " does not exist. Create the directory or use --tmp-dir to specify an alternate location."
perms <- getPermissions tmpDir
when (not $ readable perms) $
fail $ "The temporary directory " ++ tmpDir ++ " is not readable by the server. Fix the permissions or use --tmp-dir to specify an alternate location."
when (not $ writable perms) $
fail $ "The temporary directory " ++ tmpDir ++ " is not writable by the server. Fix the permissions or use --tmp-dir to specify an alternate location."
-- Check that staticDir exists and is readable
| 678
| false
| true
| 0
| 14
| 138
| 141
| 64
| 77
| null | null |
bartoszw/yelca
|
Handler/Loan.hs
|
gpl-2.0
|
renderFoldedInstalmentPlan :: InstPlan -> [Double] -> [Double] -> Widget
renderFoldedInstalmentPlan ip rs ers = do
let fip = zip3 ip rs ers
[whamlet|
<h2>_{MsgFIP}
<table .table .table-hover>
<tr>
<th .my-text-right>_{MsgInstallment}
<th .my-text-right>_{MsgNbrInst}
<th .my-text-right>_{MsgNomRate}
<th .my-text-right>_{MsgRecEffRate}
$forall (fipl,rN, rE) <- fip
<tr>
<td .my-text-amount>#{showAmtWithLen 10 (snd fipl)}
<td .my-text-amount>#{show $ fst fipl}
<td .my-text-amount>#{showWithLenDec 13 9 $ (rN * 100)} %
<td .my-text-amount>#{showWithLenDec 7 3 $ (cN2E rE * 100)} %
|]
-- | Render a form into a series of tr tags. Note that, in order to allow
-- you to add extra rows to the table, this function does /not/ wrap up
-- the resulting HTML in a table tag; you must do that yourself.
| 1,020
|
renderFoldedInstalmentPlan :: InstPlan -> [Double] -> [Double] -> Widget
renderFoldedInstalmentPlan ip rs ers = do
let fip = zip3 ip rs ers
[whamlet|
<h2>_{MsgFIP}
<table .table .table-hover>
<tr>
<th .my-text-right>_{MsgInstallment}
<th .my-text-right>_{MsgNbrInst}
<th .my-text-right>_{MsgNomRate}
<th .my-text-right>_{MsgRecEffRate}
$forall (fipl,rN, rE) <- fip
<tr>
<td .my-text-amount>#{showAmtWithLen 10 (snd fipl)}
<td .my-text-amount>#{show $ fst fipl}
<td .my-text-amount>#{showWithLenDec 13 9 $ (rN * 100)} %
<td .my-text-amount>#{showWithLenDec 7 3 $ (cN2E rE * 100)} %
|]
-- | Render a form into a series of tr tags. Note that, in order to allow
-- you to add extra rows to the table, this function does /not/ wrap up
-- the resulting HTML in a table tag; you must do that yourself.
| 1,020
|
renderFoldedInstalmentPlan ip rs ers = do
let fip = zip3 ip rs ers
[whamlet|
<h2>_{MsgFIP}
<table .table .table-hover>
<tr>
<th .my-text-right>_{MsgInstallment}
<th .my-text-right>_{MsgNbrInst}
<th .my-text-right>_{MsgNomRate}
<th .my-text-right>_{MsgRecEffRate}
$forall (fipl,rN, rE) <- fip
<tr>
<td .my-text-amount>#{showAmtWithLen 10 (snd fipl)}
<td .my-text-amount>#{show $ fst fipl}
<td .my-text-amount>#{showWithLenDec 13 9 $ (rN * 100)} %
<td .my-text-amount>#{showWithLenDec 7 3 $ (cN2E rE * 100)} %
|]
-- | Render a form into a series of tr tags. Note that, in order to allow
-- you to add extra rows to the table, this function does /not/ wrap up
-- the resulting HTML in a table tag; you must do that yourself.
| 947
| false
| true
| 0
| 10
| 342
| 62
| 34
| 28
| null | null |
Mattiemus/LaneWars
|
Game/Shared/Object.hs
|
mit
|
filterObjByType :: [ObjectType] -- ^List of object types to keep
-> [GameObject] -- ^List of game objects to filter
-> [GameObject] -- ^List of game objects that are one of the specified types
filterObjByType types objs = filter (\obj -> (goType obj) `elem` types) objs
| 301
|
filterObjByType :: [ObjectType] -- ^List of object types to keep
-> [GameObject] -- ^List of game objects to filter
-> [GameObject]
filterObjByType types objs = filter (\obj -> (goType obj) `elem` types) objs
| 240
|
filterObjByType types objs = filter (\obj -> (goType obj) `elem` types) objs
| 76
| true
| true
| 0
| 10
| 76
| 61
| 35
| 26
| null | null |
phaazon/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
|
bsd-3-clause
|
gl_PROGRAM_ATTRIBS_ARB :: GLenum
gl_PROGRAM_ATTRIBS_ARB = 0x88AC
| 64
|
gl_PROGRAM_ATTRIBS_ARB :: GLenum
gl_PROGRAM_ATTRIBS_ARB = 0x88AC
| 64
|
gl_PROGRAM_ATTRIBS_ARB = 0x88AC
| 31
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
nevrenato/Hets_Fork
|
SoftFOL/ParseTPTP.hs
|
gpl-2.0
|
unitary :: Parser SPTerm
unitary = parens form <|> quantForm <|> unaryForm <|> atomicForm
| 89
|
unitary :: Parser SPTerm
unitary = parens form <|> quantForm <|> unaryForm <|> atomicForm
| 89
|
unitary = parens form <|> quantForm <|> unaryForm <|> atomicForm
| 64
| false
| true
| 0
| 7
| 13
| 35
| 15
| 20
| null | null |
weiningl/SFTypes
|
Parser.hs
|
bsd-3-clause
|
eval (Nat 1) = Variable "1"
| 27
|
eval (Nat 1) = Variable "1"
| 27
|
eval (Nat 1) = Variable "1"
| 27
| false
| false
| 0
| 7
| 5
| 18
| 8
| 10
| null | null |
takoeight0821/malgo
|
src/Malgo/Refine/Space.hs
|
bsd-3-clause
|
subtract (Constructor k1 ss) (Constructor k2 ws)
| k1 == k2 = subtract' (Constructor k1) ss ws
| 96
|
subtract (Constructor k1 ss) (Constructor k2 ws)
| k1 == k2 = subtract' (Constructor k1) ss ws
| 96
|
subtract (Constructor k1 ss) (Constructor k2 ws)
| k1 == k2 = subtract' (Constructor k1) ss ws
| 96
| false
| false
| 0
| 8
| 18
| 50
| 23
| 27
| null | null |
siddhanathan/ghc
|
compiler/typecheck/TcRnTypes.hs
|
bsd-3-clause
|
pprEvVars :: [EvVar] -> SDoc -- Print with their types
pprEvVars ev_vars = vcat (map pprEvVarWithType ev_vars)
| 113
|
pprEvVars :: [EvVar] -> SDoc
pprEvVars ev_vars = vcat (map pprEvVarWithType ev_vars)
| 84
|
pprEvVars ev_vars = vcat (map pprEvVarWithType ev_vars)
| 55
| true
| true
| 0
| 7
| 19
| 33
| 17
| 16
| null | null |
gabesoft/kapi
|
test/PersistenceUserPostsSpec.hs
|
bsd-3-clause
|
replaceUpdatedAt :: Record -> Record
replaceUpdatedAt = replaceUTCDate updatedAtLabel
| 85
|
replaceUpdatedAt :: Record -> Record
replaceUpdatedAt = replaceUTCDate updatedAtLabel
| 85
|
replaceUpdatedAt = replaceUTCDate updatedAtLabel
| 48
| false
| true
| 0
| 5
| 8
| 18
| 9
| 9
| null | null |
contivero/hasmin
|
src/Hasmin/Types/Dimension.hs
|
bsd-3-clause
|
toGradians d Grad = d
| 21
|
toGradians d Grad = d
| 21
|
toGradians d Grad = d
| 21
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
michalt/cvector
|
Data/CVector.hs
|
bsd-3-clause
|
zip4 :: CVector a -> CVector b -> CVector c -> CVector d -> CVector (a, b, c, d)
zip4 = G.zip4
| 94
|
zip4 :: CVector a -> CVector b -> CVector c -> CVector d -> CVector (a, b, c, d)
zip4 = G.zip4
| 94
|
zip4 = G.zip4
| 13
| false
| true
| 0
| 11
| 21
| 62
| 29
| 33
| null | null |
ocean0yohsuke/Scheme
|
src/Scheme/Evaluator/Chaitin.hs
|
bsd-3-clause
|
{-
-- capture
evalCapture :: Proc
evalCapture (CELL (STR x) NIL _) = do
capture $ STR x
(*:) $ RETURN $ STR x
evalCapture (CELL expr NIL _) = do
capture expr
(*:) $ RETURN $ expr
evalCapture e = throwEvalError $ INVALIDForm $ show (cell (sym "capture") e)
-}
--------------------------------------------------
-- read
--------------------------------------------------
-- read-bit
evalReadBit :: AFunc
evalReadBit NIL = do
mtry <- popTry
case mtry of
Nothing -> throwTryError OUTOFDATA
Just try -> do
let bits = binary try
case bits of
NIL -> do
pushTry try
throwTryError OUTOFDATA
CELL _ _ _ -> do
(bit, rest) <- readBit bits try
pushTry $ setBinary rest try
(*:) bit
e -> do
pushTry try
throwEvalError $ INVALIDValue $ show (cell (sym "read-bit") e)
where
readBit (CELL (INT 0) rest _) _ = (*:) (INT 0, rest)
readBit (CELL (INT 1) rest _) _ = (*:) (INT 1, rest)
readBit e try = do
pushTry try
throwEvalError $ INVALIDValue $ show (cell (sym "read-bit") e)
| 1,204
|
evalReadBit :: AFunc
evalReadBit NIL = do
mtry <- popTry
case mtry of
Nothing -> throwTryError OUTOFDATA
Just try -> do
let bits = binary try
case bits of
NIL -> do
pushTry try
throwTryError OUTOFDATA
CELL _ _ _ -> do
(bit, rest) <- readBit bits try
pushTry $ setBinary rest try
(*:) bit
e -> do
pushTry try
throwEvalError $ INVALIDValue $ show (cell (sym "read-bit") e)
where
readBit (CELL (INT 0) rest _) _ = (*:) (INT 0, rest)
readBit (CELL (INT 1) rest _) _ = (*:) (INT 1, rest)
readBit e try = do
pushTry try
throwEvalError $ INVALIDValue $ show (cell (sym "read-bit") e)
| 800
|
evalReadBit NIL = do
mtry <- popTry
case mtry of
Nothing -> throwTryError OUTOFDATA
Just try -> do
let bits = binary try
case bits of
NIL -> do
pushTry try
throwTryError OUTOFDATA
CELL _ _ _ -> do
(bit, rest) <- readBit bits try
pushTry $ setBinary rest try
(*:) bit
e -> do
pushTry try
throwEvalError $ INVALIDValue $ show (cell (sym "read-bit") e)
where
readBit (CELL (INT 0) rest _) _ = (*:) (INT 0, rest)
readBit (CELL (INT 1) rest _) _ = (*:) (INT 1, rest)
readBit e try = do
pushTry try
throwEvalError $ INVALIDValue $ show (cell (sym "read-bit") e)
| 779
| true
| true
| 2
| 22
| 413
| 304
| 146
| 158
| null | null |
pparkkin/eta
|
compiler/ETA/Utils/Util.hs
|
bsd-3-clause
|
thirdOf3 :: (a,b,c) -> c
fstOf3 (a,_,_) = a
| 49
|
thirdOf3 :: (a,b,c) -> c
fstOf3 (a,_,_) = a
| 49
|
fstOf3 (a,_,_) = a
| 24
| false
| true
| 0
| 6
| 14
| 40
| 22
| 18
| null | null |
mattgreen/hython
|
src/Hython/Class.hs
|
gpl-3.0
|
c3Merge [[c]] = [c]
| 19
|
c3Merge [[c]] = [c]
| 19
|
c3Merge [[c]] = [c]
| 19
| false
| false
| 0
| 6
| 3
| 19
| 10
| 9
| null | null |
shlevy/ghc
|
compiler/simplCore/OccurAnal.hs
|
bsd-3-clause
|
markNonTailCalled occ = occ { occ_tail = NoTailCallInfo }
| 61
|
markNonTailCalled occ = occ { occ_tail = NoTailCallInfo }
| 61
|
markNonTailCalled occ = occ { occ_tail = NoTailCallInfo }
| 61
| false
| false
| 0
| 6
| 12
| 17
| 9
| 8
| null | null |
apyrgio/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
ldpPool :: String
ldpPool = "pool"
| 34
|
ldpPool :: String
ldpPool = "pool"
| 34
|
ldpPool = "pool"
| 16
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
frontrowed/stratosphere
|
library-gen/Stratosphere/Resources/DynamoDBTable.hs
|
mit
|
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-keyschema
ddbtKeySchema :: Lens' DynamoDBTable [DynamoDBTableKeySchema]
ddbtKeySchema = lens _dynamoDBTableKeySchema (\s a -> s { _dynamoDBTableKeySchema = a })
| 279
|
ddbtKeySchema :: Lens' DynamoDBTable [DynamoDBTableKeySchema]
ddbtKeySchema = lens _dynamoDBTableKeySchema (\s a -> s { _dynamoDBTableKeySchema = a })
| 150
|
ddbtKeySchema = lens _dynamoDBTableKeySchema (\s a -> s { _dynamoDBTableKeySchema = a })
| 88
| true
| true
| 1
| 9
| 20
| 48
| 24
| 24
| null | null |
ghc-android/ghc
|
libraries/template-haskell/Language/Haskell/TH/Lib.hs
|
bsd-3-clause
|
asP :: Name -> PatQ -> PatQ
asP n p = do p' <- p
return (AsP n p')
| 79
|
asP :: Name -> PatQ -> PatQ
asP n p = do p' <- p
return (AsP n p')
| 79
|
asP n p = do p' <- p
return (AsP n p')
| 51
| false
| true
| 0
| 10
| 31
| 51
| 22
| 29
| null | null |
bus000/Dikunt
|
test/Types/Internal/HostnameTest.hs
|
bsd-3-clause
|
startsWith :: Hostname -> Bool
startsWith host = Char.isAlphaNum $ (head . getHostname) host
| 92
|
startsWith :: Hostname -> Bool
startsWith host = Char.isAlphaNum $ (head . getHostname) host
| 92
|
startsWith host = Char.isAlphaNum $ (head . getHostname) host
| 61
| false
| true
| 0
| 8
| 13
| 39
| 18
| 21
| null | null |
castaway/pandoc
|
src/Text/Pandoc/Writers/Man.hs
|
gpl-2.0
|
blockToMan opts (Plain inlines) =
liftM vcat $ mapM (inlineListToMan opts) $ splitSentences inlines
| 102
|
blockToMan opts (Plain inlines) =
liftM vcat $ mapM (inlineListToMan opts) $ splitSentences inlines
| 102
|
blockToMan opts (Plain inlines) =
liftM vcat $ mapM (inlineListToMan opts) $ splitSentences inlines
| 102
| false
| false
| 0
| 9
| 16
| 40
| 18
| 22
| null | null |
jorsn/blackknight
|
blackknight.hs
|
bsd-3-clause
|
defaultIOSettings lockh = do
tty <- getTerminalName stdInput
return $ Settings True $ Just $ (drop 5 tty) ++ " locked by " ++ user lockh ++ "."
| 159
|
defaultIOSettings lockh = do
tty <- getTerminalName stdInput
return $ Settings True $ Just $ (drop 5 tty) ++ " locked by " ++ user lockh ++ "."
| 159
|
defaultIOSettings lockh = do
tty <- getTerminalName stdInput
return $ Settings True $ Just $ (drop 5 tty) ++ " locked by " ++ user lockh ++ "."
| 159
| false
| false
| 0
| 13
| 43
| 60
| 27
| 33
| null | null |
ezyang/ghc
|
testsuite/tests/typecheck/should_fail/T11274.hs
|
bsd-3-clause
|
missingInstance :: Asd -> Asd -> Bool
missingInstance x y = x == y
| 66
|
missingInstance :: Asd -> Asd -> Bool
missingInstance x y = x == y
| 66
|
missingInstance x y = x == y
| 28
| false
| true
| 0
| 6
| 13
| 28
| 14
| 14
| null | null |
egaburov/funstuff
|
Haskell/dsl_fold/free_monad.hs
|
apache-2.0
|
showProgram (Free (Bell x)) = "bell\n" ++ showProgram x
| 55
|
showProgram (Free (Bell x)) = "bell\n" ++ showProgram x
| 55
|
showProgram (Free (Bell x)) = "bell\n" ++ showProgram x
| 55
| false
| false
| 0
| 9
| 8
| 28
| 13
| 15
| null | null |
aisamanra/config-ini
|
src/Data/Ini/Config/Raw.hs
|
bsd-3-clause
|
-- | Look up an Ini key's value in a given section by the key. Returns
-- the sequence of matches.
lookupValue ::
-- | The key. Will be normalized prior to comparison.
Text ->
-- | The section to search.
IniSection ->
Seq.Seq IniValue
lookupValue name section =
snd <$> Seq.filter ((== normalize name) . fst) (isVals section)
| 337
|
lookupValue ::
-- | The key. Will be normalized prior to comparison.
Text ->
-- | The section to search.
IniSection ->
Seq.Seq IniValue
lookupValue name section =
snd <$> Seq.filter ((== normalize name) . fst) (isVals section)
| 238
|
lookupValue name section =
snd <$> Seq.filter ((== normalize name) . fst) (isVals section)
| 92
| true
| true
| 0
| 10
| 70
| 64
| 34
| 30
| null | null |
josefs/RangeProve
|
SBV.hs
|
bsd-3-clause
|
-- ------------------------------------------------------------
-- Xor
-- ------------------------------------------------------------
rangeXorUnsigned :: Range SWord8 -> Range SWord8 -> Range SWord8
rangeXorUnsigned (Range l1 u1) (Range l2 u2) = range 0 (maxPlus u1 u2)
| 271
|
rangeXorUnsigned :: Range SWord8 -> Range SWord8 -> Range SWord8
rangeXorUnsigned (Range l1 u1) (Range l2 u2) = range 0 (maxPlus u1 u2)
| 135
|
rangeXorUnsigned (Range l1 u1) (Range l2 u2) = range 0 (maxPlus u1 u2)
| 70
| true
| true
| 0
| 7
| 29
| 65
| 32
| 33
| null | null |
abhin4v/hask-irc
|
hask-irc-core/Network/IRC/Util.hs
|
apache-2.0
|
mapKeys :: IsMap map => map -> [ContainerKey map]
mapKeys = map fst . mapToList
| 79
|
mapKeys :: IsMap map => map -> [ContainerKey map]
mapKeys = map fst . mapToList
| 79
|
mapKeys = map fst . mapToList
| 29
| false
| true
| 0
| 8
| 14
| 35
| 17
| 18
| null | null |
ksaveljev/hNES
|
NES/VM.hs
|
mit
|
new :: ROM -> ST s (VM s)
new catridge = do
mapper' <- loadMapper catridge
VM catridge mapper' <$> MemoryMap.new catridge <*> CPU.new <*> PPU.new
| 153
|
new :: ROM -> ST s (VM s)
new catridge = do
mapper' <- loadMapper catridge
VM catridge mapper' <$> MemoryMap.new catridge <*> CPU.new <*> PPU.new
| 153
|
new catridge = do
mapper' <- loadMapper catridge
VM catridge mapper' <$> MemoryMap.new catridge <*> CPU.new <*> PPU.new
| 127
| false
| true
| 0
| 11
| 33
| 72
| 32
| 40
| null | null |
VyacheslavHashov/servant-auth-token
|
servant-auth-token-acid/src/Servant/Server/Auth/Token/Acid/Schema.hs
|
bsd-3-clause
|
modifyM :: HasModelWrite a => (Model -> Model) -> Update a ()
modifyM f = modify' (\a -> putModel a . f . askModel $ a)
| 119
|
modifyM :: HasModelWrite a => (Model -> Model) -> Update a ()
modifyM f = modify' (\a -> putModel a . f . askModel $ a)
| 119
|
modifyM f = modify' (\a -> putModel a . f . askModel $ a)
| 57
| false
| true
| 0
| 11
| 25
| 70
| 33
| 37
| null | null |
chetant/rbm
|
Test/Test1.hs
|
bsd-3-clause
|
main = do
let cdn = 20
e = 0.07
numSamples = 100
numTrainExs = 4
nh = 50
trainSet <- map fst . (filter ((==8) . snd)) . flattenSet <$> getTrainingSet "/saiko/data/digits"
let batch = force $ transpose $ foldr1 (R.++) $ take numTrainExs trainSet
(Z :. _ :. nv) = extent batch
rbm <- mkRBM nv nh
rbm' <- trainBatch cdn numSamples e rbm batch
return ()
-- print rbm'
| 407
|
main = do
let cdn = 20
e = 0.07
numSamples = 100
numTrainExs = 4
nh = 50
trainSet <- map fst . (filter ((==8) . snd)) . flattenSet <$> getTrainingSet "/saiko/data/digits"
let batch = force $ transpose $ foldr1 (R.++) $ take numTrainExs trainSet
(Z :. _ :. nv) = extent batch
rbm <- mkRBM nv nh
rbm' <- trainBatch cdn numSamples e rbm batch
return ()
-- print rbm'
| 407
|
main = do
let cdn = 20
e = 0.07
numSamples = 100
numTrainExs = 4
nh = 50
trainSet <- map fst . (filter ((==8) . snd)) . flattenSet <$> getTrainingSet "/saiko/data/digits"
let batch = force $ transpose $ foldr1 (R.++) $ take numTrainExs trainSet
(Z :. _ :. nv) = extent batch
rbm <- mkRBM nv nh
rbm' <- trainBatch cdn numSamples e rbm batch
return ()
-- print rbm'
| 407
| false
| false
| 0
| 15
| 115
| 169
| 83
| 86
| null | null |
RobertFischer/pong-server
|
src/Network/Pong.hs
|
unlicense
|
defaultPongConfig :: (Monad m) => PongConfig m
-- ^ Default config that runs on port @10411@ and just prints out the four characters @pong@.
defaultPongConfig = PongConfig 10411 message
where
message = pongActionFromStatus defaultStatus
defaultStatus = status200 { statusMessage = C.pack "pong" }
| 306
|
defaultPongConfig :: (Monad m) => PongConfig m
defaultPongConfig = PongConfig 10411 message
where
message = pongActionFromStatus defaultStatus
defaultStatus = status200 { statusMessage = C.pack "pong" }
| 212
|
defaultPongConfig = PongConfig 10411 message
where
message = pongActionFromStatus defaultStatus
defaultStatus = status200 { statusMessage = C.pack "pong" }
| 165
| true
| true
| 2
| 9
| 52
| 74
| 32
| 42
| null | null |
np/ling
|
Ling/Fmt/Albert/Migrate.hs
|
bsd-3-clause
|
transNewPatt :: NewPatt -> L.NewPatt
transNewPatt (TenNewPatt chandecs) = L.TenNewPatt (L.ChaPatt . transChanDec <$> chandecs)
| 126
|
transNewPatt :: NewPatt -> L.NewPatt
transNewPatt (TenNewPatt chandecs) = L.TenNewPatt (L.ChaPatt . transChanDec <$> chandecs)
| 126
|
transNewPatt (TenNewPatt chandecs) = L.TenNewPatt (L.ChaPatt . transChanDec <$> chandecs)
| 89
| false
| true
| 0
| 9
| 14
| 44
| 22
| 22
| null | null |
hvr/cassava
|
src/Data/Csv/Conversion/Internal.hs
|
bsd-3-clause
|
-- Exponentiation with a cache for the most common numbers.
minExpt, maxExpt :: Int
minExpt = 0
| 95
|
minExpt, maxExpt :: Int
minExpt = 0
| 35
|
minExpt = 0
| 11
| true
| true
| 0
| 4
| 16
| 14
| 9
| 5
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/HsSyn/HsExpr.hs
|
bsd-3-clause
|
pprMatchContext :: Outputable id => HsMatchContext id -> SDoc
pprMatchContext ctxt
| want_an ctxt = ptext (sLit "an") <+> pprMatchContextNoun ctxt
| otherwise = ptext (sLit "a") <+> pprMatchContextNoun ctxt
where
want_an (FunRhs {}) = True -- Use "an" in front
want_an ProcExpr = True
want_an _ = False
| 338
|
pprMatchContext :: Outputable id => HsMatchContext id -> SDoc
pprMatchContext ctxt
| want_an ctxt = ptext (sLit "an") <+> pprMatchContextNoun ctxt
| otherwise = ptext (sLit "a") <+> pprMatchContextNoun ctxt
where
want_an (FunRhs {}) = True -- Use "an" in front
want_an ProcExpr = True
want_an _ = False
| 338
|
pprMatchContext ctxt
| want_an ctxt = ptext (sLit "an") <+> pprMatchContextNoun ctxt
| otherwise = ptext (sLit "a") <+> pprMatchContextNoun ctxt
where
want_an (FunRhs {}) = True -- Use "an" in front
want_an ProcExpr = True
want_an _ = False
| 276
| false
| true
| 1
| 9
| 84
| 115
| 52
| 63
| null | null |
locaweb/leela
|
src/warpdrive/src/Leela/Data/LQL/Show.hs
|
apache-2.0
|
renderGrep (GrepKillVertex mguid) = L.concat [ "grep kill "
, maybe "*" renderGUID mguid
]
| 234
|
renderGrep (GrepKillVertex mguid) = L.concat [ "grep kill "
, maybe "*" renderGUID mguid
]
| 234
|
renderGrep (GrepKillVertex mguid) = L.concat [ "grep kill "
, maybe "*" renderGUID mguid
]
| 234
| false
| false
| 0
| 7
| 158
| 33
| 16
| 17
| null | null |
HairyDude/heal
|
EveApi/Types.hs
|
bsd-2-clause
|
hiSlot HiSlot3 = Just 3
| 23
|
hiSlot HiSlot3 = Just 3
| 23
|
hiSlot HiSlot3 = Just 3
| 23
| false
| false
| 1
| 5
| 4
| 16
| 5
| 11
| null | null |
brendanhay/gogol
|
gogol-books/gen/Network/Google/Books/Types/Product.hs
|
mpl-2.0
|
dddwisisiSource :: Lens' DictlayerDataDictWordsItemSensesItemSynonymsItem (Maybe DictlayerDataDictWordsItemSensesItemSynonymsItemSource)
dddwisisiSource
= lens _dddwisisiSource
(\ s a -> s{_dddwisisiSource = a})
| 219
|
dddwisisiSource :: Lens' DictlayerDataDictWordsItemSensesItemSynonymsItem (Maybe DictlayerDataDictWordsItemSensesItemSynonymsItemSource)
dddwisisiSource
= lens _dddwisisiSource
(\ s a -> s{_dddwisisiSource = a})
| 219
|
dddwisisiSource
= lens _dddwisisiSource
(\ s a -> s{_dddwisisiSource = a})
| 82
| false
| true
| 0
| 8
| 24
| 48
| 24
| 24
| null | null |
synsem/texhs
|
src/Text/Doc/Types.hs
|
gpl-3.0
|
-- Helper for showing raw citations.
plainCites :: [SingleCite] -> Text
plainCites = T.intercalate ";" . map plainCite
| 118
|
plainCites :: [SingleCite] -> Text
plainCites = T.intercalate ";" . map plainCite
| 81
|
plainCites = T.intercalate ";" . map plainCite
| 46
| true
| true
| 0
| 7
| 17
| 31
| 16
| 15
| null | null |
kmerz/the_sword
|
src/Sword/ViewPorter.hs
|
bsd-3-clause
|
insideViewPort :: ViewPort -> Coord -> Bool
insideViewPort ((x1, y1), (x2, y2)) (x, y) = xinside && yinside
where xinside = (x1 <= x) && (x < x2)
yinside = (y1 <= y) && (y < y2)
| 187
|
insideViewPort :: ViewPort -> Coord -> Bool
insideViewPort ((x1, y1), (x2, y2)) (x, y) = xinside && yinside
where xinside = (x1 <= x) && (x < x2)
yinside = (y1 <= y) && (y < y2)
| 187
|
insideViewPort ((x1, y1), (x2, y2)) (x, y) = xinside && yinside
where xinside = (x1 <= x) && (x < x2)
yinside = (y1 <= y) && (y < y2)
| 143
| false
| true
| 6
| 10
| 46
| 115
| 58
| 57
| null | null |
srijs/haskell-aeson-functor
|
src/Data/Aeson/Functor.hs
|
mit
|
fromM :: Aeson.ToJSON a => ValueM a -> Value
fromM = iter Value . unM . fmap toValue
| 84
|
fromM :: Aeson.ToJSON a => ValueM a -> Value
fromM = iter Value . unM . fmap toValue
| 84
|
fromM = iter Value . unM . fmap toValue
| 39
| false
| true
| 0
| 7
| 17
| 41
| 19
| 22
| null | null |
kmels/dart-haskell
|
src/Language/Core/Interpreter/Structures.hs
|
bsd-3-clause
|
getSetting :: (DARTSettings -> a) -> IM a
getSetting f = gets settings >>= return . f
| 86
|
getSetting :: (DARTSettings -> a) -> IM a
getSetting f = gets settings >>= return . f
| 85
|
getSetting f = gets settings >>= return . f
| 43
| false
| true
| 0
| 7
| 17
| 39
| 19
| 20
| null | null |
NorfairKing/the-notes
|
src/MachineLearning/SupervisedLearning/Main.hs
|
gpl-2.0
|
costFunctionSS :: Note
costFunctionSS = subsection "Cost functions" $ do
costFunctionDefinition
costFunctionExamples
| 124
|
costFunctionSS :: Note
costFunctionSS = subsection "Cost functions" $ do
costFunctionDefinition
costFunctionExamples
| 124
|
costFunctionSS = subsection "Cost functions" $ do
costFunctionDefinition
costFunctionExamples
| 101
| false
| true
| 0
| 7
| 19
| 24
| 11
| 13
| null | null |
ekr/tamarin-prover
|
lib/theory/src/Theory.hs
|
gpl-3.0
|
addIntrRuleLabels:: OpenDiffTheory -> OpenDiffTheory
addIntrRuleLabels thy =
modify diffThyCacheLeft (map addRuleLabel) $ modify diffThyDiffCacheLeft (map addRuleLabel) $ modify diffThyDiffCacheRight (map addRuleLabel) $ modify diffThyCacheRight (map addRuleLabel) thy
where
addRuleLabel :: IntrRuleAC -> IntrRuleAC
addRuleLabel rule = addDiffLabel rule ("DiffIntr" ++ (getRuleName rule))
-- Add the rule labels to an Open Diff Theory
| 449
|
addIntrRuleLabels:: OpenDiffTheory -> OpenDiffTheory
addIntrRuleLabels thy =
modify diffThyCacheLeft (map addRuleLabel) $ modify diffThyDiffCacheLeft (map addRuleLabel) $ modify diffThyDiffCacheRight (map addRuleLabel) $ modify diffThyCacheRight (map addRuleLabel) thy
where
addRuleLabel :: IntrRuleAC -> IntrRuleAC
addRuleLabel rule = addDiffLabel rule ("DiffIntr" ++ (getRuleName rule))
-- Add the rule labels to an Open Diff Theory
| 449
|
addIntrRuleLabels thy =
modify diffThyCacheLeft (map addRuleLabel) $ modify diffThyDiffCacheLeft (map addRuleLabel) $ modify diffThyDiffCacheRight (map addRuleLabel) $ modify diffThyCacheRight (map addRuleLabel) thy
where
addRuleLabel :: IntrRuleAC -> IntrRuleAC
addRuleLabel rule = addDiffLabel rule ("DiffIntr" ++ (getRuleName rule))
-- Add the rule labels to an Open Diff Theory
| 396
| false
| true
| 0
| 10
| 66
| 127
| 58
| 69
| null | null |
phadej/range-set-list
|
src/Data/RangeSet/IntMap.hs
|
mit
|
{- Query -}
-- | /O(1)/. Is this the empty set?
null :: RIntSet -> Bool
null (RSet m) = Map.null m
| 99
|
null :: RIntSet -> Bool
null (RSet m) = Map.null m
| 50
|
null (RSet m) = Map.null m
| 26
| true
| true
| 0
| 7
| 22
| 31
| 16
| 15
| null | null |
josuf107/H
|
H/Data.hs
|
gpl-2.0
|
hours :: Int -> DiffTime
hours n = timeOfDayToTime $ TimeOfDay n 0 0
| 68
|
hours :: Int -> DiffTime
hours n = timeOfDayToTime $ TimeOfDay n 0 0
| 68
|
hours n = timeOfDayToTime $ TimeOfDay n 0 0
| 43
| false
| true
| 0
| 6
| 13
| 29
| 14
| 15
| null | null |
enolan/Idris-dev
|
src/Idris/REPL.hs
|
bsd-3-clause
|
idemodeProcess fn (UnsetOpt ShowImpl) = do process fn (UnsetOpt ShowImpl)
iPrintResult ""
| 132
|
idemodeProcess fn (UnsetOpt ShowImpl) = do process fn (UnsetOpt ShowImpl)
iPrintResult ""
| 132
|
idemodeProcess fn (UnsetOpt ShowImpl) = do process fn (UnsetOpt ShowImpl)
iPrintResult ""
| 132
| false
| false
| 0
| 9
| 54
| 37
| 16
| 21
| null | null |
PipocaQuemada/ermine
|
src/Ermine/Pretty/Type.hs
|
bsd-2-clause
|
prettyHardType (Con (Global _ (Postfix _) _ n) _) = parens ("postfix" <+> text (unpack n))
| 90
|
prettyHardType (Con (Global _ (Postfix _) _ n) _) = parens ("postfix" <+> text (unpack n))
| 90
|
prettyHardType (Con (Global _ (Postfix _) _ n) _) = parens ("postfix" <+> text (unpack n))
| 90
| false
| false
| 0
| 11
| 15
| 54
| 26
| 28
| null | null |
DanGrayson/cubicaltt
|
Resolver.hs
|
mit
|
resolveFormula (Disj phi psi) =
orFormula <$> resolveFormula phi <*> resolveFormula psi
| 93
|
resolveFormula (Disj phi psi) =
orFormula <$> resolveFormula phi <*> resolveFormula psi
| 93
|
resolveFormula (Disj phi psi) =
orFormula <$> resolveFormula phi <*> resolveFormula psi
| 93
| false
| false
| 0
| 7
| 17
| 31
| 14
| 17
| null | null |
ekmett/concurrent
|
src/Concurrent/Primitive/Ref.hs
|
bsd-2-clause
|
-- | Create a pinned primitive reference.
newPinnedPrimRef :: (PrimMonad m, Prim a) => a -> m (PrimRef (PrimState m) a)
newPinnedPrimRef a = do
m <- newPinnedByteArray (sizeOf a)
writeByteArray m 0 a
return (PrimRef m)
| 225
|
newPinnedPrimRef :: (PrimMonad m, Prim a) => a -> m (PrimRef (PrimState m) a)
newPinnedPrimRef a = do
m <- newPinnedByteArray (sizeOf a)
writeByteArray m 0 a
return (PrimRef m)
| 183
|
newPinnedPrimRef a = do
m <- newPinnedByteArray (sizeOf a)
writeByteArray m 0 a
return (PrimRef m)
| 105
| true
| true
| 0
| 12
| 43
| 93
| 43
| 50
| null | null |
coghex/abridgefaraway
|
src/GLUtil/Font.hs
|
bsd-3-clause
|
findLetter DCFONT 'h' = ( 7, 6)
| 33
|
findLetter DCFONT 'h' = ( 7, 6)
| 33
|
findLetter DCFONT 'h' = ( 7, 6)
| 33
| false
| false
| 0
| 5
| 8
| 19
| 9
| 10
| null | null |
rueshyna/gogol
|
gogol-analytics/gen/Network/Google/Resource/Analytics/Management/Filters/List.hs
|
mpl-2.0
|
-- | An index of the first entity to retrieve. Use this parameter as a
-- pagination mechanism along with the max-results parameter.
mflStartIndex :: Lens' ManagementFiltersList (Maybe Int32)
mflStartIndex
= lens _mflStartIndex
(\ s a -> s{_mflStartIndex = a})
. mapping _Coerce
| 292
|
mflStartIndex :: Lens' ManagementFiltersList (Maybe Int32)
mflStartIndex
= lens _mflStartIndex
(\ s a -> s{_mflStartIndex = a})
. mapping _Coerce
| 159
|
mflStartIndex
= lens _mflStartIndex
(\ s a -> s{_mflStartIndex = a})
. mapping _Coerce
| 100
| true
| true
| 0
| 10
| 56
| 56
| 29
| 27
| null | null |
brendanhay/gogol
|
gogol-android-publisher/gen/Network/Google/Resource/AndroidPublisher/Edits/Images/Deleteall.hs
|
mpl-2.0
|
-- | OAuth access token.
ediAccessToken :: Lens' EditsImagesDeleteall (Maybe Text)
ediAccessToken
= lens _ediAccessToken
(\ s a -> s{_ediAccessToken = a})
| 162
|
ediAccessToken :: Lens' EditsImagesDeleteall (Maybe Text)
ediAccessToken
= lens _ediAccessToken
(\ s a -> s{_ediAccessToken = a})
| 137
|
ediAccessToken
= lens _ediAccessToken
(\ s a -> s{_ediAccessToken = a})
| 79
| true
| true
| 1
| 9
| 29
| 51
| 25
| 26
| null | null |
yamadapc/general-roman2decimal
|
haskell/Roman2Decimal.hs
|
mit
|
romanStrToDecimal :: String -> Int
romanStrToDecimal = romanToDecimal . strToRoman
| 82
|
romanStrToDecimal :: String -> Int
romanStrToDecimal = romanToDecimal . strToRoman
| 82
|
romanStrToDecimal = romanToDecimal . strToRoman
| 47
| false
| true
| 0
| 7
| 9
| 26
| 11
| 15
| null | null |
drpowell/XMPP
|
Network/XMPP/Stanzas.hs
|
bsd-3-clause
|
-- |Return true if the stanza is a \"get\" request in the given namespace.
iqGet :: Text -> StanzaPredicate
iqGet xmlns = (attributeMatches "type" (=="get")) `conj` (iqXmlns xmlns)
| 180
|
iqGet :: Text -> StanzaPredicate
iqGet xmlns = (attributeMatches "type" (=="get")) `conj` (iqXmlns xmlns)
| 105
|
iqGet xmlns = (attributeMatches "type" (=="get")) `conj` (iqXmlns xmlns)
| 72
| true
| true
| 0
| 8
| 27
| 49
| 25
| 24
| null | null |
snapframework/snap-loader-dynamic
|
src/Snap/Loader/Dynamic/Evaluator.hs
|
bsd-3-clause
|
------------------------------------------------------------------------------
-- | Convert an action to generate 'HintLoadable's into Snap and IO actions
-- that handle periodic reloading. The resulting action will share initialized
-- state until the next execution of the input action. At this time, the
-- cleanup action will be executed.
--
-- The first two arguments control when recompiles are done. The first argument
-- is an action that is executed when compilation starts. The second is a
-- function from the result of the first action to an action that determines
-- whether the value from the previous compilation is still good. This
-- abstracts out the strategy for determining when a cached result is no longer
-- valid.
--
-- If an exception is raised during the processing of the action, it will be
-- thrown to all waiting threads, and for all requests made before the
-- recompile condition is reached.
protectedHintEvaluator :: forall a.
IO a
-> (a -> IO Bool)
-> IO HintLoadable
-> IO (Snap (), IO ())
protectedHintEvaluator start test getInternals = do
-- The list of requesters waiting for a result. Contains the ThreadId in
-- case of exceptions, and an empty MVar awaiting a successful result.
readerContainer <- newReaderContainer
-- Contains the previous result and initialization value, and the time it
-- was stored, if a previous result has been computed. The result stored is
-- either the actual result and initialization result, or the exception
-- thrown by the calculation.
resultContainer <- newResultContainer
-- The model used for the above MVars in the returned action is "keep them
-- full, unless updating them." In every case, when one of those MVars is
-- emptied, the next action is to fill that same MVar. This makes
-- deadlocking on MVar wait impossible.
let snap = do
let waitForNewResult :: IO (Snap ())
waitForNewResult = do
-- Need to calculate a new result
tid <- myThreadId
reader <- newEmptyMVar
readers <- takeMVar readerContainer
-- Some strictness is employed to ensure the MVar
-- isn't holding on to a chain of unevaluated thunks.
let pair = (tid, reader)
newReaders = readers `seq` pair `seq` (pair : readers)
putMVar readerContainer $! newReaders
-- If this is the first reader to queue, clean up the
-- previous state, if there was any, and then begin
-- evaluation of the new code and state.
when (null readers) $ do
let runAndFill = Ex.mask $ \unmask -> do
-- run the cleanup action
previous <- readMVar resultContainer
unmask $ cleanup previous
-- compile the new internals and initialize
stateInitializer <- unmask getInternals
res <- unmask stateInitializer
let a = fst res
clearAndNotify unmask (Right res)
(flip putMVar a . snd)
killWaiting :: Ex.SomeException -> IO ()
killWaiting e = Ex.mask $ \unmask -> do
clearAndNotify unmask (Left e)
(flip Ex.throwTo e . fst)
Ex.throwIO e
clearAndNotify unmask r f = do
a <- unmask start
_ <- swapMVar resultContainer $ Just (r, a)
allReaders <- swapMVar readerContainer []
mapM_ f allReaders
_ <- forkIO $ runAndFill `Ex.catch` killWaiting
return ()
-- Wait for the evaluation of the action to complete,
-- and return its result.
takeMVar reader
existingResult <- liftIO $ readMVar resultContainer
getResult <- liftIO $ case existingResult of
Just (res, a) -> do
-- There's an existing result. Check for validity
valid <- test a
case (valid, res) of
(True, Right (x, _)) -> return x
(True, Left e) -> Ex.throwIO e
(False, _) -> waitForNewResult
Nothing -> waitForNewResult
getResult
clean = do
let msg = "invalid dynamic loader state. " ++
"The cleanup action has been executed"
contents <- swapMVar resultContainer $ error msg
cleanup contents
return (snap, clean)
where
newReaderContainer :: IO (MVar [(ThreadId, MVar (Snap ()))])
newReaderContainer = newMVar []
newResultContainer :: IO (MVar (Maybe (Either Ex.SomeException
(Snap (), IO ()), a)))
newResultContainer = newMVar Nothing
cleanup (Just (Right (_, clean), _)) = clean
cleanup _ = return ()
| 5,578
|
protectedHintEvaluator :: forall a.
IO a
-> (a -> IO Bool)
-> IO HintLoadable
-> IO (Snap (), IO ())
protectedHintEvaluator start test getInternals = do
-- The list of requesters waiting for a result. Contains the ThreadId in
-- case of exceptions, and an empty MVar awaiting a successful result.
readerContainer <- newReaderContainer
-- Contains the previous result and initialization value, and the time it
-- was stored, if a previous result has been computed. The result stored is
-- either the actual result and initialization result, or the exception
-- thrown by the calculation.
resultContainer <- newResultContainer
-- The model used for the above MVars in the returned action is "keep them
-- full, unless updating them." In every case, when one of those MVars is
-- emptied, the next action is to fill that same MVar. This makes
-- deadlocking on MVar wait impossible.
let snap = do
let waitForNewResult :: IO (Snap ())
waitForNewResult = do
-- Need to calculate a new result
tid <- myThreadId
reader <- newEmptyMVar
readers <- takeMVar readerContainer
-- Some strictness is employed to ensure the MVar
-- isn't holding on to a chain of unevaluated thunks.
let pair = (tid, reader)
newReaders = readers `seq` pair `seq` (pair : readers)
putMVar readerContainer $! newReaders
-- If this is the first reader to queue, clean up the
-- previous state, if there was any, and then begin
-- evaluation of the new code and state.
when (null readers) $ do
let runAndFill = Ex.mask $ \unmask -> do
-- run the cleanup action
previous <- readMVar resultContainer
unmask $ cleanup previous
-- compile the new internals and initialize
stateInitializer <- unmask getInternals
res <- unmask stateInitializer
let a = fst res
clearAndNotify unmask (Right res)
(flip putMVar a . snd)
killWaiting :: Ex.SomeException -> IO ()
killWaiting e = Ex.mask $ \unmask -> do
clearAndNotify unmask (Left e)
(flip Ex.throwTo e . fst)
Ex.throwIO e
clearAndNotify unmask r f = do
a <- unmask start
_ <- swapMVar resultContainer $ Just (r, a)
allReaders <- swapMVar readerContainer []
mapM_ f allReaders
_ <- forkIO $ runAndFill `Ex.catch` killWaiting
return ()
-- Wait for the evaluation of the action to complete,
-- and return its result.
takeMVar reader
existingResult <- liftIO $ readMVar resultContainer
getResult <- liftIO $ case existingResult of
Just (res, a) -> do
-- There's an existing result. Check for validity
valid <- test a
case (valid, res) of
(True, Right (x, _)) -> return x
(True, Left e) -> Ex.throwIO e
(False, _) -> waitForNewResult
Nothing -> waitForNewResult
getResult
clean = do
let msg = "invalid dynamic loader state. " ++
"The cleanup action has been executed"
contents <- swapMVar resultContainer $ error msg
cleanup contents
return (snap, clean)
where
newReaderContainer :: IO (MVar [(ThreadId, MVar (Snap ()))])
newReaderContainer = newMVar []
newResultContainer :: IO (MVar (Maybe (Either Ex.SomeException
(Snap (), IO ()), a)))
newResultContainer = newMVar Nothing
cleanup (Just (Right (_, clean), _)) = clean
cleanup _ = return ()
| 4,654
|
protectedHintEvaluator start test getInternals = do
-- The list of requesters waiting for a result. Contains the ThreadId in
-- case of exceptions, and an empty MVar awaiting a successful result.
readerContainer <- newReaderContainer
-- Contains the previous result and initialization value, and the time it
-- was stored, if a previous result has been computed. The result stored is
-- either the actual result and initialization result, or the exception
-- thrown by the calculation.
resultContainer <- newResultContainer
-- The model used for the above MVars in the returned action is "keep them
-- full, unless updating them." In every case, when one of those MVars is
-- emptied, the next action is to fill that same MVar. This makes
-- deadlocking on MVar wait impossible.
let snap = do
let waitForNewResult :: IO (Snap ())
waitForNewResult = do
-- Need to calculate a new result
tid <- myThreadId
reader <- newEmptyMVar
readers <- takeMVar readerContainer
-- Some strictness is employed to ensure the MVar
-- isn't holding on to a chain of unevaluated thunks.
let pair = (tid, reader)
newReaders = readers `seq` pair `seq` (pair : readers)
putMVar readerContainer $! newReaders
-- If this is the first reader to queue, clean up the
-- previous state, if there was any, and then begin
-- evaluation of the new code and state.
when (null readers) $ do
let runAndFill = Ex.mask $ \unmask -> do
-- run the cleanup action
previous <- readMVar resultContainer
unmask $ cleanup previous
-- compile the new internals and initialize
stateInitializer <- unmask getInternals
res <- unmask stateInitializer
let a = fst res
clearAndNotify unmask (Right res)
(flip putMVar a . snd)
killWaiting :: Ex.SomeException -> IO ()
killWaiting e = Ex.mask $ \unmask -> do
clearAndNotify unmask (Left e)
(flip Ex.throwTo e . fst)
Ex.throwIO e
clearAndNotify unmask r f = do
a <- unmask start
_ <- swapMVar resultContainer $ Just (r, a)
allReaders <- swapMVar readerContainer []
mapM_ f allReaders
_ <- forkIO $ runAndFill `Ex.catch` killWaiting
return ()
-- Wait for the evaluation of the action to complete,
-- and return its result.
takeMVar reader
existingResult <- liftIO $ readMVar resultContainer
getResult <- liftIO $ case existingResult of
Just (res, a) -> do
-- There's an existing result. Check for validity
valid <- test a
case (valid, res) of
(True, Right (x, _)) -> return x
(True, Left e) -> Ex.throwIO e
(False, _) -> waitForNewResult
Nothing -> waitForNewResult
getResult
clean = do
let msg = "invalid dynamic loader state. " ++
"The cleanup action has been executed"
contents <- swapMVar resultContainer $ error msg
cleanup contents
return (snap, clean)
where
newReaderContainer :: IO (MVar [(ThreadId, MVar (Snap ()))])
newReaderContainer = newMVar []
newResultContainer :: IO (MVar (Maybe (Either Ex.SomeException
(Snap (), IO ()), a)))
newResultContainer = newMVar Nothing
cleanup (Just (Right (_, clean), _)) = clean
cleanup _ = return ()
| 4,458
| true
| true
| 5
| 31
| 2,262
| 847
| 426
| 421
| null | null |
urbanslug/ghc
|
compiler/typecheck/TcRnTypes.hs
|
bsd-3-clause
|
pprCtO (ScOrigin n) = ptext (sLit "the superclasses of an instance declaration")
<> ifPprDebug (parens (ppr n))
| 151
|
pprCtO (ScOrigin n) = ptext (sLit "the superclasses of an instance declaration")
<> ifPprDebug (parens (ppr n))
| 151
|
pprCtO (ScOrigin n) = ptext (sLit "the superclasses of an instance declaration")
<> ifPprDebug (parens (ppr n))
| 151
| false
| false
| 0
| 10
| 56
| 44
| 20
| 24
| null | null |
sarahn/ganeti
|
src/Ganeti/OpParams.hs
|
gpl-2.0
|
-- | 'OpTestDummy' submit_jobs field.
pTestDummySubmitJobs :: Field
pTestDummySubmitJobs =
renameField "TestDummySubmitJobs" $
simpleField "submit_jobs" [t| UncheckedValue |]
| 178
|
pTestDummySubmitJobs :: Field
pTestDummySubmitJobs =
renameField "TestDummySubmitJobs" $
simpleField "submit_jobs" [t| UncheckedValue |]
| 140
|
pTestDummySubmitJobs =
renameField "TestDummySubmitJobs" $
simpleField "submit_jobs" [t| UncheckedValue |]
| 110
| true
| true
| 0
| 6
| 21
| 28
| 16
| 12
| null | null |
nushio3/ghc
|
libraries/base/Foreign/C/Error.hs
|
bsd-3-clause
|
ePROGMISMATCH = Errno (CONST_EPROGMISMATCH)
| 45
|
ePROGMISMATCH = Errno (CONST_EPROGMISMATCH)
| 45
|
ePROGMISMATCH = Errno (CONST_EPROGMISMATCH)
| 45
| false
| false
| 0
| 6
| 5
| 12
| 6
| 6
| null | null |
izgzhen/hadrian
|
src/Rules/Wrappers.hs
|
mit
|
-- | List of wrappers for inplace artefacts
inplaceWrappers :: [(Context, Wrapper)]
inplaceWrappers = wrappersCommon ++
[ (vanillaContext Stage0 ghcPkg, inplaceGhcPkgWrapper)
, (vanillaContext Stage1 runGhc, inplaceRunGhcWrapper) ]
| 267
|
inplaceWrappers :: [(Context, Wrapper)]
inplaceWrappers = wrappersCommon ++
[ (vanillaContext Stage0 ghcPkg, inplaceGhcPkgWrapper)
, (vanillaContext Stage1 runGhc, inplaceRunGhcWrapper) ]
| 223
|
inplaceWrappers = wrappersCommon ++
[ (vanillaContext Stage0 ghcPkg, inplaceGhcPkgWrapper)
, (vanillaContext Stage1 runGhc, inplaceRunGhcWrapper) ]
| 183
| true
| true
| 0
| 8
| 62
| 53
| 31
| 22
| null | null |
lostbean/DeUni
|
src/DeUni/GeometricTools.hs
|
gpl-3.0
|
whichSideOfPlane :: (PointND a, Norm Double a) => Plane a -> a Double -> Position
whichSideOfPlane plane p
| onPlane = OnPlane
| projection > dist = B1
| otherwise = B2
where
projection = p &. (normalize . planeNormal) plane
dist = planeDist plane
onPlane = isMainlyZero (projection - dist)
-- | Project a vector-point on the plane that goes throw the oringe.
-- It discard the distance on Plane data. It assumes that the plane pass throw the oringe
| 499
|
whichSideOfPlane :: (PointND a, Norm Double a) => Plane a -> a Double -> Position
whichSideOfPlane plane p
| onPlane = OnPlane
| projection > dist = B1
| otherwise = B2
where
projection = p &. (normalize . planeNormal) plane
dist = planeDist plane
onPlane = isMainlyZero (projection - dist)
-- | Project a vector-point on the plane that goes throw the oringe.
-- It discard the distance on Plane data. It assumes that the plane pass throw the oringe
| 499
|
whichSideOfPlane plane p
| onPlane = OnPlane
| projection > dist = B1
| otherwise = B2
where
projection = p &. (normalize . planeNormal) plane
dist = planeDist plane
onPlane = isMainlyZero (projection - dist)
-- | Project a vector-point on the plane that goes throw the oringe.
-- It discard the distance on Plane data. It assumes that the plane pass throw the oringe
| 417
| false
| true
| 4
| 8
| 130
| 120
| 60
| 60
| null | null |
dkandalov/katas
|
haskell/p99/src/p9x/p00/P00.hs
|
unlicense
|
flatten (x:xs) = case x of
Value it -> it : flatten xs
AList it -> flatten it ++ flatten xs
-- P08
| 115
|
flatten (x:xs) = case x of
Value it -> it : flatten xs
AList it -> flatten it ++ flatten xs
-- P08
| 115
|
flatten (x:xs) = case x of
Value it -> it : flatten xs
AList it -> flatten it ++ flatten xs
-- P08
| 115
| false
| false
| 0
| 9
| 39
| 56
| 26
| 30
| null | null |
dkensinger/haskell
|
haskellbook/mystandardfunctions.hs
|
gpl-3.0
|
squish :: [[a]] -> [a]
squish [] = []
| 37
|
squish :: [[a]] -> [a]
squish [] = []
| 37
|
squish [] = []
| 14
| false
| true
| 0
| 8
| 8
| 37
| 18
| 19
| null | null |
ckaestne/CIDE
|
CIDE_Language_Haskell/test/FGL-layout/Graph/Inductive/Graph.hs
|
gpl-3.0
|
-- graph equality
--
nodeComp :: Eq b => LNode b -> LNode b -> Ordering
nodeComp n@(v,_) n'@(w,_) | n == n' = EQ
| v<w = LT
| otherwise = GT
| 205
|
nodeComp :: Eq b => LNode b -> LNode b -> Ordering
nodeComp n@(v,_) n'@(w,_) | n == n' = EQ
| v<w = LT
| otherwise = GT
| 181
|
nodeComp n@(v,_) n'@(w,_) | n == n' = EQ
| v<w = LT
| otherwise = GT
| 130
| true
| true
| 12
| 5
| 97
| 88
| 47
| 41
| null | null |
Arguggi/documentator
|
src/Documentator/Descriptors.hs
|
gpl-3.0
|
argumentsTyCon t@(TyApp _ _ _) = [t]
| 36
|
argumentsTyCon t@(TyApp _ _ _) = [t]
| 36
|
argumentsTyCon t@(TyApp _ _ _) = [t]
| 36
| false
| false
| 0
| 8
| 6
| 25
| 13
| 12
| null | null |
charlydagos/haskell-sql-edsl-demo
|
code/hrr/src/HRR/Commands.hs
|
mit
|
printTodo :: (IConnection conn) => conn -> T.Todo -> IO ()
printTodo conn t = do
hashtags <- let tid = T.id t in
runQuery conn (relationalQuery findHashtagsForTodo) tid
putStrLn $ intercalate "\n"
[
"Title: " ++ T.title t
, "Due by: " ++ show (T.dueDate t)
, "Priority: " ++ maybe "-" show (T.prio t)
, "Hashtags: " ++ intercalate ", " (map H.hashtagStr hashtags)
]
| 445
|
printTodo :: (IConnection conn) => conn -> T.Todo -> IO ()
printTodo conn t = do
hashtags <- let tid = T.id t in
runQuery conn (relationalQuery findHashtagsForTodo) tid
putStrLn $ intercalate "\n"
[
"Title: " ++ T.title t
, "Due by: " ++ show (T.dueDate t)
, "Priority: " ++ maybe "-" show (T.prio t)
, "Hashtags: " ++ intercalate ", " (map H.hashtagStr hashtags)
]
| 445
|
printTodo conn t = do
hashtags <- let tid = T.id t in
runQuery conn (relationalQuery findHashtagsForTodo) tid
putStrLn $ intercalate "\n"
[
"Title: " ++ T.title t
, "Due by: " ++ show (T.dueDate t)
, "Priority: " ++ maybe "-" show (T.prio t)
, "Hashtags: " ++ intercalate ", " (map H.hashtagStr hashtags)
]
| 386
| false
| true
| 0
| 14
| 146
| 162
| 78
| 84
| null | null |
swift-nav/wolf
|
src/Network/AWS/Wolf/Ctx.hs
|
mit
|
botErrorCatch :: MonadCtx c m => Error -> m a
botErrorCatch ex = do
case ex of
TransportError _ ->
pure ()
_ ->
traceError "exception" [ "error" .= displayException ex ]
throwIO ex
-- | Catcher for exceptions, emits stats and rethrows.
--
| 263
|
botErrorCatch :: MonadCtx c m => Error -> m a
botErrorCatch ex = do
case ex of
TransportError _ ->
pure ()
_ ->
traceError "exception" [ "error" .= displayException ex ]
throwIO ex
-- | Catcher for exceptions, emits stats and rethrows.
--
| 263
|
botErrorCatch ex = do
case ex of
TransportError _ ->
pure ()
_ ->
traceError "exception" [ "error" .= displayException ex ]
throwIO ex
-- | Catcher for exceptions, emits stats and rethrows.
--
| 217
| false
| true
| 0
| 13
| 68
| 80
| 37
| 43
| null | null |
tjakway/ghcjvm
|
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
|
bsd-3-clause
|
occString :: OccName -> String
occString (OccName occ) = occ
| 60
|
occString :: OccName -> String
occString (OccName occ) = occ
| 60
|
occString (OccName occ) = occ
| 29
| false
| true
| 0
| 7
| 9
| 24
| 12
| 12
| null | null |
ktvoelker/boron
|
src/Slave.hs
|
gpl-3.0
|
makeMetaFile :: Integer -> UTCTime -> UTCTime -> ExitCode -> JSObject JSValue
makeMetaFile num startTime endTime result =
toJSObject
$ [ ("number", showJSON num)
, ("start", timeToJSValue startTime)
, ("end", timeToJSValue endTime)
, ("status", showJSON $ if result == ExitSuccess then "pass" :: T.Text else "fail")
]
++ code
where
code = case result of
ExitSuccess -> []
ExitFailure code -> [("code", showJSON code)]
| 457
|
makeMetaFile :: Integer -> UTCTime -> UTCTime -> ExitCode -> JSObject JSValue
makeMetaFile num startTime endTime result =
toJSObject
$ [ ("number", showJSON num)
, ("start", timeToJSValue startTime)
, ("end", timeToJSValue endTime)
, ("status", showJSON $ if result == ExitSuccess then "pass" :: T.Text else "fail")
]
++ code
where
code = case result of
ExitSuccess -> []
ExitFailure code -> [("code", showJSON code)]
| 457
|
makeMetaFile num startTime endTime result =
toJSObject
$ [ ("number", showJSON num)
, ("start", timeToJSValue startTime)
, ("end", timeToJSValue endTime)
, ("status", showJSON $ if result == ExitSuccess then "pass" :: T.Text else "fail")
]
++ code
where
code = case result of
ExitSuccess -> []
ExitFailure code -> [("code", showJSON code)]
| 379
| false
| true
| 4
| 11
| 103
| 157
| 83
| 74
| null | null |
olsner/ghc
|
compiler/hsSyn/HsDecls.hs
|
bsd-3-clause
|
-- | open type family info
isOpenTypeFamilyInfo :: FamilyInfo name -> Bool
isOpenTypeFamilyInfo OpenTypeFamily = True
| 117
|
isOpenTypeFamilyInfo :: FamilyInfo name -> Bool
isOpenTypeFamilyInfo OpenTypeFamily = True
| 90
|
isOpenTypeFamilyInfo OpenTypeFamily = True
| 42
| true
| true
| 0
| 7
| 15
| 28
| 12
| 16
| null | null |
vikraman/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
wayTag WayProf = "p"
| 24
|
wayTag WayProf = "p"
| 24
|
wayTag WayProf = "p"
| 24
| false
| false
| 1
| 5
| 7
| 13
| 4
| 9
| null | null |
Chasego/nie
|
proj/lang/C++/cpp_primer_5th/[SUPPORT] learning-master/real-world-haskell/ch4/myListFunctions.hs
|
gpl-3.0
|
:: [Bool] -> Bool
myOr = foldl (||) False
| 41
|
:: [Bool] -> Bool
myOr = foldl (||) False
| 41
|
:: [Bool] -> Bool
myOr = foldl (||) False
| 41
| false
| false
| 0
| 7
| 8
| 28
| 14
| 14
| null | null |
D4r1/project-euler
|
Euler/E49.hs
|
mit
|
main :: IO ()
main = print $ euler49 4
| 38
|
main :: IO ()
main = print $ euler49 4
| 38
|
main = print $ euler49 4
| 24
| false
| true
| 0
| 6
| 9
| 23
| 11
| 12
| null | null |
benkolera/haskell-ldap-classy
|
tests/Test/LDAP/Classy/Dn.hs
|
mit
|
parseDnStringOk :: Assertion
parseDnStringOk = parserTest dnString "benkolera" (Right "benkolera")
| 98
|
parseDnStringOk :: Assertion
parseDnStringOk = parserTest dnString "benkolera" (Right "benkolera")
| 98
|
parseDnStringOk = parserTest dnString "benkolera" (Right "benkolera")
| 69
| false
| true
| 0
| 7
| 9
| 24
| 12
| 12
| null | null |
denibertovic/haskell
|
kubernetes/lib/Kubernetes/OpenAPI/ModelLens.hs
|
bsd-3-clause
|
-- | 'v1SubjectAccessReviewMetadata' Lens
v1SubjectAccessReviewMetadataL :: Lens_' V1SubjectAccessReview (Maybe V1ObjectMeta)
v1SubjectAccessReviewMetadataL f V1SubjectAccessReview{..} = (\v1SubjectAccessReviewMetadata -> V1SubjectAccessReview { v1SubjectAccessReviewMetadata, ..} ) <$> f v1SubjectAccessReviewMetadata
| 318
|
v1SubjectAccessReviewMetadataL :: Lens_' V1SubjectAccessReview (Maybe V1ObjectMeta)
v1SubjectAccessReviewMetadataL f V1SubjectAccessReview{..} = (\v1SubjectAccessReviewMetadata -> V1SubjectAccessReview { v1SubjectAccessReviewMetadata, ..} ) <$> f v1SubjectAccessReviewMetadata
| 276
|
v1SubjectAccessReviewMetadataL f V1SubjectAccessReview{..} = (\v1SubjectAccessReviewMetadata -> V1SubjectAccessReview { v1SubjectAccessReviewMetadata, ..} ) <$> f v1SubjectAccessReviewMetadata
| 192
| true
| true
| 0
| 8
| 23
| 57
| 30
| 27
| null | null |
the-real-blackh/sodium-2d-game-engine
|
FRP/Sodium/GameEngine2D/GLUT.hs
|
bsd-3-clause
|
appendCache ja@(Just _) _ = ja
| 37
|
appendCache ja@(Just _) _ = ja
| 37
|
appendCache ja@(Just _) _ = ja
| 37
| false
| false
| 0
| 8
| 12
| 20
| 10
| 10
| null | null |
thiagoarrais/gtk2hs
|
tools/apiGen/src/Utils.hs
|
lgpl-2.1
|
splitBy :: Eq a => a -> [a] -> [[a]]
splitBy sep xs = split xs
where split xs = case break (==sep) xs of
(chunk,[]) -> chunk : []
(chunk,_:rest) -> chunk : split rest
| 192
|
splitBy :: Eq a => a -> [a] -> [[a]]
splitBy sep xs = split xs
where split xs = case break (==sep) xs of
(chunk,[]) -> chunk : []
(chunk,_:rest) -> chunk : split rest
| 192
|
splitBy sep xs = split xs
where split xs = case break (==sep) xs of
(chunk,[]) -> chunk : []
(chunk,_:rest) -> chunk : split rest
| 155
| false
| true
| 0
| 9
| 61
| 109
| 57
| 52
| null | null |
alexvong1995/pandoc
|
src/Text/Pandoc/Readers/LaTeX.hs
|
gpl-2.0
|
blockCommands :: M.Map String (LP Blocks)
blockCommands = M.fromList $
[ ("par", mempty <$ skipopts)
, ("title", mempty <$ (skipopts *>
(grouped inline >>= addMeta "title")
<|> (grouped block >>= addMeta "title")))
, ("subtitle", mempty <$ (skipopts *> tok >>= addMeta "subtitle"))
, ("author", mempty <$ (skipopts *> authors))
-- -- in letter class, temp. store address & sig as title, author
, ("address", mempty <$ (skipopts *> tok >>= addMeta "address"))
, ("signature", mempty <$ (skipopts *> authors))
, ("date", mempty <$ (skipopts *> tok >>= addMeta "date"))
-- sectioning
, ("chapter", updateState (\s -> s{ stateHasChapters = True })
*> section nullAttr 0)
, ("chapter*", updateState (\s -> s{ stateHasChapters = True })
*> section ("",["unnumbered"],[]) 0)
, ("section", section nullAttr 1)
, ("section*", section ("",["unnumbered"],[]) 1)
, ("subsection", section nullAttr 2)
, ("subsection*", section ("",["unnumbered"],[]) 2)
, ("subsubsection", section nullAttr 3)
, ("subsubsection*", section ("",["unnumbered"],[]) 3)
, ("paragraph", section nullAttr 4)
, ("paragraph*", section ("",["unnumbered"],[]) 4)
, ("subparagraph", section nullAttr 5)
, ("subparagraph*", section ("",["unnumbered"],[]) 5)
-- beamer slides
, ("frametitle", section nullAttr 3)
, ("framesubtitle", section nullAttr 4)
-- letters
, ("opening", (para . trimInlines) <$> (skipopts *> tok))
, ("closing", skipopts *> closing)
--
, ("hrule", pure horizontalRule)
, ("rule", skipopts *> tok *> tok *> pure horizontalRule)
, ("item", skipopts *> looseItem)
, ("documentclass", skipopts *> braced *> preamble)
, ("centerline", (para . trimInlines) <$> (skipopts *> tok))
, ("caption", skipopts *> setCaption)
, ("PandocStartInclude", startInclude)
, ("PandocEndInclude", endInclude)
, ("bibliography", mempty <$ (skipopts *> braced >>=
addMeta "bibliography" . splitBibs))
, ("addbibresource", mempty <$ (skipopts *> braced >>=
addMeta "bibliography" . splitBibs))
] ++ map ignoreBlocks
-- these commands will be ignored unless --parse-raw is specified,
-- in which case they will appear as raw latex blocks
[ "newcommand", "renewcommand", "newenvironment", "renewenvironment"
-- newcommand, etc. should be parsed by macro, but we need this
-- here so these aren't parsed as inline commands to ignore
, "special", "pdfannot", "pdfstringdef"
, "bibliographystyle"
, "maketitle", "makeindex", "makeglossary"
, "addcontentsline", "addtocontents", "addtocounter"
-- \ignore{} is used conventionally in literate haskell for definitions
-- that are to be processed by the compiler but not printed.
, "ignore"
, "hyperdef"
, "markboth", "markright", "markleft"
, "hspace", "vspace"
, "newpage"
]
| 2,949
|
blockCommands :: M.Map String (LP Blocks)
blockCommands = M.fromList $
[ ("par", mempty <$ skipopts)
, ("title", mempty <$ (skipopts *>
(grouped inline >>= addMeta "title")
<|> (grouped block >>= addMeta "title")))
, ("subtitle", mempty <$ (skipopts *> tok >>= addMeta "subtitle"))
, ("author", mempty <$ (skipopts *> authors))
-- -- in letter class, temp. store address & sig as title, author
, ("address", mempty <$ (skipopts *> tok >>= addMeta "address"))
, ("signature", mempty <$ (skipopts *> authors))
, ("date", mempty <$ (skipopts *> tok >>= addMeta "date"))
-- sectioning
, ("chapter", updateState (\s -> s{ stateHasChapters = True })
*> section nullAttr 0)
, ("chapter*", updateState (\s -> s{ stateHasChapters = True })
*> section ("",["unnumbered"],[]) 0)
, ("section", section nullAttr 1)
, ("section*", section ("",["unnumbered"],[]) 1)
, ("subsection", section nullAttr 2)
, ("subsection*", section ("",["unnumbered"],[]) 2)
, ("subsubsection", section nullAttr 3)
, ("subsubsection*", section ("",["unnumbered"],[]) 3)
, ("paragraph", section nullAttr 4)
, ("paragraph*", section ("",["unnumbered"],[]) 4)
, ("subparagraph", section nullAttr 5)
, ("subparagraph*", section ("",["unnumbered"],[]) 5)
-- beamer slides
, ("frametitle", section nullAttr 3)
, ("framesubtitle", section nullAttr 4)
-- letters
, ("opening", (para . trimInlines) <$> (skipopts *> tok))
, ("closing", skipopts *> closing)
--
, ("hrule", pure horizontalRule)
, ("rule", skipopts *> tok *> tok *> pure horizontalRule)
, ("item", skipopts *> looseItem)
, ("documentclass", skipopts *> braced *> preamble)
, ("centerline", (para . trimInlines) <$> (skipopts *> tok))
, ("caption", skipopts *> setCaption)
, ("PandocStartInclude", startInclude)
, ("PandocEndInclude", endInclude)
, ("bibliography", mempty <$ (skipopts *> braced >>=
addMeta "bibliography" . splitBibs))
, ("addbibresource", mempty <$ (skipopts *> braced >>=
addMeta "bibliography" . splitBibs))
] ++ map ignoreBlocks
-- these commands will be ignored unless --parse-raw is specified,
-- in which case they will appear as raw latex blocks
[ "newcommand", "renewcommand", "newenvironment", "renewenvironment"
-- newcommand, etc. should be parsed by macro, but we need this
-- here so these aren't parsed as inline commands to ignore
, "special", "pdfannot", "pdfstringdef"
, "bibliographystyle"
, "maketitle", "makeindex", "makeglossary"
, "addcontentsline", "addtocontents", "addtocounter"
-- \ignore{} is used conventionally in literate haskell for definitions
-- that are to be processed by the compiler but not printed.
, "ignore"
, "hyperdef"
, "markboth", "markright", "markleft"
, "hspace", "vspace"
, "newpage"
]
| 2,949
|
blockCommands = M.fromList $
[ ("par", mempty <$ skipopts)
, ("title", mempty <$ (skipopts *>
(grouped inline >>= addMeta "title")
<|> (grouped block >>= addMeta "title")))
, ("subtitle", mempty <$ (skipopts *> tok >>= addMeta "subtitle"))
, ("author", mempty <$ (skipopts *> authors))
-- -- in letter class, temp. store address & sig as title, author
, ("address", mempty <$ (skipopts *> tok >>= addMeta "address"))
, ("signature", mempty <$ (skipopts *> authors))
, ("date", mempty <$ (skipopts *> tok >>= addMeta "date"))
-- sectioning
, ("chapter", updateState (\s -> s{ stateHasChapters = True })
*> section nullAttr 0)
, ("chapter*", updateState (\s -> s{ stateHasChapters = True })
*> section ("",["unnumbered"],[]) 0)
, ("section", section nullAttr 1)
, ("section*", section ("",["unnumbered"],[]) 1)
, ("subsection", section nullAttr 2)
, ("subsection*", section ("",["unnumbered"],[]) 2)
, ("subsubsection", section nullAttr 3)
, ("subsubsection*", section ("",["unnumbered"],[]) 3)
, ("paragraph", section nullAttr 4)
, ("paragraph*", section ("",["unnumbered"],[]) 4)
, ("subparagraph", section nullAttr 5)
, ("subparagraph*", section ("",["unnumbered"],[]) 5)
-- beamer slides
, ("frametitle", section nullAttr 3)
, ("framesubtitle", section nullAttr 4)
-- letters
, ("opening", (para . trimInlines) <$> (skipopts *> tok))
, ("closing", skipopts *> closing)
--
, ("hrule", pure horizontalRule)
, ("rule", skipopts *> tok *> tok *> pure horizontalRule)
, ("item", skipopts *> looseItem)
, ("documentclass", skipopts *> braced *> preamble)
, ("centerline", (para . trimInlines) <$> (skipopts *> tok))
, ("caption", skipopts *> setCaption)
, ("PandocStartInclude", startInclude)
, ("PandocEndInclude", endInclude)
, ("bibliography", mempty <$ (skipopts *> braced >>=
addMeta "bibliography" . splitBibs))
, ("addbibresource", mempty <$ (skipopts *> braced >>=
addMeta "bibliography" . splitBibs))
] ++ map ignoreBlocks
-- these commands will be ignored unless --parse-raw is specified,
-- in which case they will appear as raw latex blocks
[ "newcommand", "renewcommand", "newenvironment", "renewenvironment"
-- newcommand, etc. should be parsed by macro, but we need this
-- here so these aren't parsed as inline commands to ignore
, "special", "pdfannot", "pdfstringdef"
, "bibliographystyle"
, "maketitle", "makeindex", "makeglossary"
, "addcontentsline", "addtocontents", "addtocounter"
-- \ignore{} is used conventionally in literate haskell for definitions
-- that are to be processed by the compiler but not printed.
, "ignore"
, "hyperdef"
, "markboth", "markright", "markleft"
, "hspace", "vspace"
, "newpage"
]
| 2,907
| false
| true
| 0
| 15
| 649
| 853
| 501
| 352
| null | null |
zhiyuanshi/fcore
|
examples/case_studies/ParBalance.hs
|
bsd-2-clause
|
prop_reverse_tail_equivalence :: [Int] -> Bool
prop_reverse_tail_equivalence [] = True
| 86
|
prop_reverse_tail_equivalence :: [Int] -> Bool
prop_reverse_tail_equivalence [] = True
| 86
|
prop_reverse_tail_equivalence [] = True
| 39
| false
| true
| 0
| 6
| 8
| 23
| 12
| 11
| null | null |
ayu-mushi/scientific-ants
|
ALife/ScientificAnts/Instruct.hs
|
mit
|
pushA :: Instruction
pushA world =
if (length xs) >= 10
then err world
else world & ((ants <<< focus <<< stack) %~ ((:) ax))
where
ax = world ^. (ants <<< focus <<< register <<< _1)
xs = world ^. (ants <<< focus <<< stack)
| 243
|
pushA :: Instruction
pushA world =
if (length xs) >= 10
then err world
else world & ((ants <<< focus <<< stack) %~ ((:) ax))
where
ax = world ^. (ants <<< focus <<< register <<< _1)
xs = world ^. (ants <<< focus <<< stack)
| 243
|
pushA world =
if (length xs) >= 10
then err world
else world & ((ants <<< focus <<< stack) %~ ((:) ax))
where
ax = world ^. (ants <<< focus <<< register <<< _1)
xs = world ^. (ants <<< focus <<< stack)
| 222
| false
| true
| 3
| 11
| 66
| 122
| 60
| 62
| null | null |
sdiehl/ghc
|
compiler/llvmGen/LlvmCodeGen/CodeGen.hs
|
bsd-3-clause
|
allocReg _ = panic $ "allocReg: Global reg encountered! Global registers should"
++ " have been handled elsewhere!"
| 135
|
allocReg _ = panic $ "allocReg: Global reg encountered! Global registers should"
++ " have been handled elsewhere!"
| 135
|
allocReg _ = panic $ "allocReg: Global reg encountered! Global registers should"
++ " have been handled elsewhere!"
| 135
| false
| false
| 0
| 6
| 37
| 17
| 8
| 9
| null | null |
Cahu/krpc-hs
|
src/KRPCHS/InfernalRobotics.hs
|
gpl-3.0
|
getServoIsFreeMovingStream :: KRPCHS.InfernalRobotics.Servo -> RPCContext (KRPCStream (Bool))
getServoIsFreeMovingStream thisArg = requestStream $ getServoIsFreeMovingStreamReq thisArg
| 184
|
getServoIsFreeMovingStream :: KRPCHS.InfernalRobotics.Servo -> RPCContext (KRPCStream (Bool))
getServoIsFreeMovingStream thisArg = requestStream $ getServoIsFreeMovingStreamReq thisArg
| 184
|
getServoIsFreeMovingStream thisArg = requestStream $ getServoIsFreeMovingStreamReq thisArg
| 90
| false
| true
| 0
| 9
| 13
| 40
| 20
| 20
| null | null |
jff/TeLLer
|
src/Parser.hs
|
gpl-3.0
|
run p input = run' p print input
| 32
|
run p input = run' p print input
| 32
|
run p input = run' p print input
| 32
| false
| false
| 0
| 5
| 7
| 18
| 8
| 10
| null | null |
MateVM/harpy
|
Harpy/X86CodeGen.hs
|
gpl-2.0
|
x86_prefetchnta_membase :: Word8 -> Word32 -> CodeGen e s ()
x86_prefetchnta_membase r m = x86_prefetch_membase 0 r m
| 117
|
x86_prefetchnta_membase :: Word8 -> Word32 -> CodeGen e s ()
x86_prefetchnta_membase r m = x86_prefetch_membase 0 r m
| 117
|
x86_prefetchnta_membase r m = x86_prefetch_membase 0 r m
| 56
| false
| true
| 0
| 8
| 17
| 40
| 19
| 21
| null | null |
jberryman/wai
|
warp/test/RunSpec.hs
|
mit
|
doubleConnect :: CounterApplication
doubleConnect icount req f = do
_ <- consumeBody $ requestBody req
_ <- consumeBody $ requestBody req
incr icount
f $ responseLBS status200 [] "double connect"
| 211
|
doubleConnect :: CounterApplication
doubleConnect icount req f = do
_ <- consumeBody $ requestBody req
_ <- consumeBody $ requestBody req
incr icount
f $ responseLBS status200 [] "double connect"
| 211
|
doubleConnect icount req f = do
_ <- consumeBody $ requestBody req
_ <- consumeBody $ requestBody req
incr icount
f $ responseLBS status200 [] "double connect"
| 175
| false
| true
| 0
| 9
| 45
| 68
| 30
| 38
| null | null |
ku-fpg/aframe
|
src/Text/AFrame.hs
|
bsd-3-clause
|
resolveScript :: Monad m => (Text -> m LT.Text) -> AFrame -> m AFrame
resolveScript rf = preOrderFrame fn
where
fn af@(AFrame "script" attrs aframes) = case lookup "src" attrs of
Nothing -> return af
Just (Property path) ->
do txt <- rf path
return $ AFrame "script"
((Label "text",Property (LT.toStrict txt))
: [(l,p) | (l,p) <- attrs, l `notElem` ["src","text"]]
)
aframes
fn af = return af
| 548
|
resolveScript :: Monad m => (Text -> m LT.Text) -> AFrame -> m AFrame
resolveScript rf = preOrderFrame fn
where
fn af@(AFrame "script" attrs aframes) = case lookup "src" attrs of
Nothing -> return af
Just (Property path) ->
do txt <- rf path
return $ AFrame "script"
((Label "text",Property (LT.toStrict txt))
: [(l,p) | (l,p) <- attrs, l `notElem` ["src","text"]]
)
aframes
fn af = return af
| 548
|
resolveScript rf = preOrderFrame fn
where
fn af@(AFrame "script" attrs aframes) = case lookup "src" attrs of
Nothing -> return af
Just (Property path) ->
do txt <- rf path
return $ AFrame "script"
((Label "text",Property (LT.toStrict txt))
: [(l,p) | (l,p) <- attrs, l `notElem` ["src","text"]]
)
aframes
fn af = return af
| 478
| false
| true
| 0
| 18
| 223
| 205
| 102
| 103
| null | null |
haroldcarr/learn-haskell-coq-ml-etc
|
haskell/course/2013-11-nicta/src/Course/List.hs
|
unlicense
|
seqOptionalC :: List (Optional a) -> Optional (List a)
seqOptionalC = foldRight (twiceOptional (:.)) (Full Nil)
| 111
|
seqOptionalC :: List (Optional a) -> Optional (List a)
seqOptionalC = foldRight (twiceOptional (:.)) (Full Nil)
| 111
|
seqOptionalC = foldRight (twiceOptional (:.)) (Full Nil)
| 56
| false
| true
| 0
| 9
| 15
| 58
| 27
| 31
| null | null |
rueshyna/gogol
|
gogol-dataproc/gen/Network/Google/Resource/Dataproc/Projects/Regions/Operations/Get.hs
|
mpl-2.0
|
-- | OAuth bearer token.
progBearerToken :: Lens' ProjectsRegionsOperationsGet (Maybe Text)
progBearerToken
= lens _progBearerToken
(\ s a -> s{_progBearerToken = a})
| 174
|
progBearerToken :: Lens' ProjectsRegionsOperationsGet (Maybe Text)
progBearerToken
= lens _progBearerToken
(\ s a -> s{_progBearerToken = a})
| 149
|
progBearerToken
= lens _progBearerToken
(\ s a -> s{_progBearerToken = a})
| 82
| true
| true
| 1
| 9
| 29
| 51
| 25
| 26
| null | null |
chadbrewbaker/shellcheck
|
ShellCheck/Analytics.hs
|
gpl-3.0
|
prop_checkForInQuoted2b = verify checkForInQuoted "for f in \"*.mp3\"; do echo foo; done"
| 89
|
prop_checkForInQuoted2b = verify checkForInQuoted "for f in \"*.mp3\"; do echo foo; done"
| 89
|
prop_checkForInQuoted2b = verify checkForInQuoted "for f in \"*.mp3\"; do echo foo; done"
| 89
| false
| false
| 0
| 5
| 11
| 11
| 5
| 6
| null | null |
allanderek/ipclib
|
Language/Ptrees/Print.hs
|
gpl-2.0
|
-- pprintPtree (Pmap Pfunction Ptree)
pprintPtree (Pexperiment var values ptree) =
Pretty.sep [ Pretty.text "Experiment"
, pprintVariable var
, Pretty.brackets $ Pretty.sep valueDocs
, pprintPtree ptree
]
where
valueDocs = Pretty.punctuate Pretty.comma $ map pprintNameValue values
pprintNameValue :: (String, Value) -> Doc
pprintNameValue (name, value) =
Pretty.hsep [ Pretty.text name
, Pretty.comma
, pprintValue value
]
| 546
|
pprintPtree (Pexperiment var values ptree) =
Pretty.sep [ Pretty.text "Experiment"
, pprintVariable var
, Pretty.brackets $ Pretty.sep valueDocs
, pprintPtree ptree
]
where
valueDocs = Pretty.punctuate Pretty.comma $ map pprintNameValue values
pprintNameValue :: (String, Value) -> Doc
pprintNameValue (name, value) =
Pretty.hsep [ Pretty.text name
, Pretty.comma
, pprintValue value
]
| 501
|
pprintPtree (Pexperiment var values ptree) =
Pretty.sep [ Pretty.text "Experiment"
, pprintVariable var
, Pretty.brackets $ Pretty.sep valueDocs
, pprintPtree ptree
]
where
valueDocs = Pretty.punctuate Pretty.comma $ map pprintNameValue values
pprintNameValue :: (String, Value) -> Doc
pprintNameValue (name, value) =
Pretty.hsep [ Pretty.text name
, Pretty.comma
, pprintValue value
]
| 501
| true
| false
| 1
| 8
| 178
| 140
| 69
| 71
| null | null |
zalora/journal-mailer
|
src/Process.hs
|
bsd-3-clause
|
ioJournal :: MonadIO m => GetsJournal m
ioJournal (Unit source) start end = do
let args = [ "-u", source
, "--since=" ++ formatUTCTimeForJournalCtl start
, "--until=" ++ formatUTCTimeForJournalCtl end
, "--no-pager"
]
output <- liftIO $ readProcessWithExitCode "journalctl" args ""
return $ case output of
(ExitSuccess, stdout, _) -> Just stdout
_ -> Nothing
| 428
|
ioJournal :: MonadIO m => GetsJournal m
ioJournal (Unit source) start end = do
let args = [ "-u", source
, "--since=" ++ formatUTCTimeForJournalCtl start
, "--until=" ++ formatUTCTimeForJournalCtl end
, "--no-pager"
]
output <- liftIO $ readProcessWithExitCode "journalctl" args ""
return $ case output of
(ExitSuccess, stdout, _) -> Just stdout
_ -> Nothing
| 428
|
ioJournal (Unit source) start end = do
let args = [ "-u", source
, "--since=" ++ formatUTCTimeForJournalCtl start
, "--until=" ++ formatUTCTimeForJournalCtl end
, "--no-pager"
]
output <- liftIO $ readProcessWithExitCode "journalctl" args ""
return $ case output of
(ExitSuccess, stdout, _) -> Just stdout
_ -> Nothing
| 388
| false
| true
| 0
| 13
| 124
| 131
| 63
| 68
| null | null |
frontrowed/stratosphere
|
library-gen/Stratosphere/Resources/DAXSubnetGroup.hs
|
mit
|
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html#cfn-dax-subnetgroup-description
daxsgDescription :: Lens' DAXSubnetGroup (Maybe (Val Text))
daxsgDescription = lens _dAXSubnetGroupDescription (\s a -> s { _dAXSubnetGroupDescription = a })
| 290
|
daxsgDescription :: Lens' DAXSubnetGroup (Maybe (Val Text))
daxsgDescription = lens _dAXSubnetGroupDescription (\s a -> s { _dAXSubnetGroupDescription = a })
| 157
|
daxsgDescription = lens _dAXSubnetGroupDescription (\s a -> s { _dAXSubnetGroupDescription = a })
| 97
| true
| true
| 0
| 9
| 22
| 52
| 28
| 24
| null | null |
craigbilner/advent-of-code-2016
|
day-8.hs
|
apache-2.0
|
makeColumn :: X -> Y -> [CoOrd] -> [CoOrd]
makeColumn x y cells = (x, y) : cells
| 80
|
makeColumn :: X -> Y -> [CoOrd] -> [CoOrd]
makeColumn x y cells = (x, y) : cells
| 80
|
makeColumn x y cells = (x, y) : cells
| 37
| false
| true
| 0
| 10
| 17
| 52
| 26
| 26
| null | null |
sdiehl/ghc
|
compiler/GHC/Hs/Decls.hs
|
bsd-3-clause
|
pprTyClDeclFlavour (FamDecl { tcdFam = FamilyDecl { fdInfo = info }})
= pprFlavour info <+> text "family"
| 107
|
pprTyClDeclFlavour (FamDecl { tcdFam = FamilyDecl { fdInfo = info }})
= pprFlavour info <+> text "family"
| 107
|
pprTyClDeclFlavour (FamDecl { tcdFam = FamilyDecl { fdInfo = info }})
= pprFlavour info <+> text "family"
| 107
| false
| false
| 0
| 12
| 18
| 40
| 20
| 20
| null | null |
copumpkin/picklers
|
src/Data/Pickler/Types.hs
|
bsd-3-clause
|
assemble (R p) ls (r :> rs) = r :> assemble p ls rs
| 51
|
assemble (R p) ls (r :> rs) = r :> assemble p ls rs
| 51
|
assemble (R p) ls (r :> rs) = r :> assemble p ls rs
| 51
| false
| false
| 0
| 6
| 13
| 40
| 18
| 22
| null | null |
geophf/1HaskellADay
|
exercises/HAD/Y2017/M09/D25/Solution.hs
|
mit
|
section dl (h:t) =
if BL.length h == 0 then dlToList dl : section emptyDL t
else section (dl <| h) t
| 126
|
section dl (h:t) =
if BL.length h == 0 then dlToList dl : section emptyDL t
else section (dl <| h) t
| 126
|
section dl (h:t) =
if BL.length h == 0 then dlToList dl : section emptyDL t
else section (dl <| h) t
| 126
| false
| false
| 0
| 8
| 47
| 59
| 29
| 30
| null | null |
steshaw/quickcheck-examples
|
src/Main.hs
|
bsd-2-clause
|
quickCheck1 :: [Double] -> Bool
quickCheck1 = \x -> absAverage1 x >= 0
| 70
|
quickCheck1 :: [Double] -> Bool
quickCheck1 = \x -> absAverage1 x >= 0
| 70
|
quickCheck1 = \x -> absAverage1 x >= 0
| 38
| false
| true
| 0
| 7
| 12
| 30
| 16
| 14
| null | null |
atodorov/bdcs
|
src/BDCS/RPM/Requirements.hs
|
lgpl-2.1
|
-- | Return a 'Requirements' record for the RPM package.
mkRequirement :: RT.ReqContext -> RT.ReqStrength -> T.Text -> Requirements
mkRequirement context strength expr =
Requirements RT.RPM context strength expr
| 215
|
mkRequirement :: RT.ReqContext -> RT.ReqStrength -> T.Text -> Requirements
mkRequirement context strength expr =
Requirements RT.RPM context strength expr
| 158
|
mkRequirement context strength expr =
Requirements RT.RPM context strength expr
| 83
| true
| true
| 0
| 8
| 32
| 48
| 24
| 24
| null | null |
ejlilley/AbstractMusic
|
LilyParse.hs
|
gpl-3.0
|
mapNotes f (Voice (LilyVoice s c e)) = Voice (LilyVoice s c (mapNotes f e))
| 75
|
mapNotes f (Voice (LilyVoice s c e)) = Voice (LilyVoice s c (mapNotes f e))
| 75
|
mapNotes f (Voice (LilyVoice s c e)) = Voice (LilyVoice s c (mapNotes f e))
| 75
| false
| false
| 0
| 9
| 14
| 50
| 23
| 27
| null | null |
kevinm416/sync
|
Sync/RSync.hs
|
bsd-3-clause
|
syncFile :: FilePath -> FilePath -> FilePath -> IO ()
syncFile basePath srcPath destPath = do
adjDestPath <- getAdjustedDestPath basePath srcPath destPath
syncCombined srcPath adjDestPath combinedOptions
| 211
|
syncFile :: FilePath -> FilePath -> FilePath -> IO ()
syncFile basePath srcPath destPath = do
adjDestPath <- getAdjustedDestPath basePath srcPath destPath
syncCombined srcPath adjDestPath combinedOptions
| 211
|
syncFile basePath srcPath destPath = do
adjDestPath <- getAdjustedDestPath basePath srcPath destPath
syncCombined srcPath adjDestPath combinedOptions
| 157
| false
| true
| 0
| 9
| 33
| 59
| 27
| 32
| null | null |
forked-upstream-packages-for-ghcjs/ghc
|
compiler/types/TypeRep.hs
|
bsd-3-clause
|
isLiftedTypeKind _ = False
| 41
|
isLiftedTypeKind _ = False
| 41
|
isLiftedTypeKind _ = False
| 41
| false
| false
| 0
| 4
| 18
| 10
| 4
| 6
| null | null |
peter-fogg/pardoc
|
src/Text/Pandoc/Writers/ICML.hs
|
gpl-2.0
|
superscriptName = "Superscript"
| 31
|
superscriptName = "Superscript"
| 31
|
superscriptName = "Superscript"
| 31
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.