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
mitar/etage
lib/Control/Etage/Sequence.hs
lgpl-3.0
defaultMaxInterval :: Int defaultMaxInterval = 1000000
54
defaultMaxInterval :: Int defaultMaxInterval = 1000000
54
defaultMaxInterval = 1000000
28
false
true
0
4
5
11
6
5
null
null
nejla/nejla-common
src/NejlaCommon/Helpers.hs
bsd-3-clause
-- | Lens' camelCaseFields code doesn't check for illegal names like "type" or -- "default". This function fixes them by looking them up in a map of -- replacements camelCaseFieldsReplacing :: HashMap String String -> LensRules camelCaseFieldsReplacing replacements = camelCaseFields & lensField %~ (\lf typeName fieldNames fieldName -> substNames <$> lf typeName fieldNames fieldName) where substNames (TopName name) = TopName (fixName replacements name) substNames (MethodName className methodName) = MethodName className (fixName replacements methodName)
583
camelCaseFieldsReplacing :: HashMap String String -> LensRules camelCaseFieldsReplacing replacements = camelCaseFields & lensField %~ (\lf typeName fieldNames fieldName -> substNames <$> lf typeName fieldNames fieldName) where substNames (TopName name) = TopName (fixName replacements name) substNames (MethodName className methodName) = MethodName className (fixName replacements methodName)
418
camelCaseFieldsReplacing replacements = camelCaseFields & lensField %~ (\lf typeName fieldNames fieldName -> substNames <$> lf typeName fieldNames fieldName) where substNames (TopName name) = TopName (fixName replacements name) substNames (MethodName className methodName) = MethodName className (fixName replacements methodName)
355
true
true
2
8
98
118
59
59
null
null
gscalzo/HaskellTheHardWay
gloss-try/gloss-master/gloss-examples/raster/Mandel/Main.hs
mit
defaultConfig :: Config defaultConfig = Config { configDisplay = InWindow "Mandelbrot" (800, 600) (10, 10) , configFileName = Nothing , configPreset = id , configPixelsDynamic = 4 , configSizeX = 800 , configSizeY = 600 }
324
defaultConfig :: Config defaultConfig = Config { configDisplay = InWindow "Mandelbrot" (800, 600) (10, 10) , configFileName = Nothing , configPreset = id , configPixelsDynamic = 4 , configSizeX = 800 , configSizeY = 600 }
324
defaultConfig = Config { configDisplay = InWindow "Mandelbrot" (800, 600) (10, 10) , configFileName = Nothing , configPreset = id , configPixelsDynamic = 4 , configSizeX = 800 , configSizeY = 600 }
300
false
true
0
8
138
68
42
26
null
null
exFalso/lambda
src/lib/Pretty/Pretty.hs
bsd-3-clause
prettyThunkValue :: Int -> Map.Map Addr Symbol -> Map.Map Addr Symbol -> Vector.Vector HeapCell -> Thunk -> String prettyThunkValue depth symbolMap codeAddrMap heap thunk = ("V>" <>) $ case thunk of ThunkClosure closure -> case closure of ClosurePartial headAddr args -> "(" <> intercalate " " (prettyAddr (depth - 1) symbolMap codeAddrMap heap <$> (headAddr : reverse args)) <> ")" ClosureRoot _ caddr -> prettyAddr (depth - 1) symbolMap codeAddrMap heap caddr ThunkPrimitive p -> show p
522
prettyThunkValue :: Int -> Map.Map Addr Symbol -> Map.Map Addr Symbol -> Vector.Vector HeapCell -> Thunk -> String prettyThunkValue depth symbolMap codeAddrMap heap thunk = ("V>" <>) $ case thunk of ThunkClosure closure -> case closure of ClosurePartial headAddr args -> "(" <> intercalate " " (prettyAddr (depth - 1) symbolMap codeAddrMap heap <$> (headAddr : reverse args)) <> ")" ClosureRoot _ caddr -> prettyAddr (depth - 1) symbolMap codeAddrMap heap caddr ThunkPrimitive p -> show p
522
prettyThunkValue depth symbolMap codeAddrMap heap thunk = ("V>" <>) $ case thunk of ThunkClosure closure -> case closure of ClosurePartial headAddr args -> "(" <> intercalate " " (prettyAddr (depth - 1) symbolMap codeAddrMap heap <$> (headAddr : reverse args)) <> ")" ClosureRoot _ caddr -> prettyAddr (depth - 1) symbolMap codeAddrMap heap caddr ThunkPrimitive p -> show p
407
false
true
0
19
110
184
89
95
null
null
alexander-at-github/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
primOpCanFail WriteOffAddrOp_Addr = True
40
primOpCanFail WriteOffAddrOp_Addr = True
40
primOpCanFail WriteOffAddrOp_Addr = True
40
false
false
0
5
3
9
4
5
null
null
brendanhay/gogol
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
mpl-2.0
-- | The status of the execution. Acceptable values are: - \"\`duplicate\`\" -- - \"\`executed\`\" oslimrExecutionStatus :: Lens' OrdersSetLineItemMetadataResponse (Maybe Text) oslimrExecutionStatus = lens _oslimrExecutionStatus (\ s a -> s{_oslimrExecutionStatus = a})
277
oslimrExecutionStatus :: Lens' OrdersSetLineItemMetadataResponse (Maybe Text) oslimrExecutionStatus = lens _oslimrExecutionStatus (\ s a -> s{_oslimrExecutionStatus = a})
178
oslimrExecutionStatus = lens _oslimrExecutionStatus (\ s a -> s{_oslimrExecutionStatus = a})
100
true
true
0
9
39
49
26
23
null
null
ghcjs/ghcjs
test/ghc/th/tH_unresolvedInfix.hs
mit
_t3 = (1 `Plus` 1) `Plus` 1 :: $( int $+? (int $+? int) )
59
_t3 = (1 `Plus` 1) `Plus` 1 :: $( int $+? (int $+? int) )
59
_t3 = (1 `Plus` 1) `Plus` 1 :: $( int $+? (int $+? int) )
59
false
false
0
9
16
39
23
16
null
null
freizl/hoauth2
hoauth2-example/src/IDP/Linkedin.hs
bsd-3-clause
linkedinIdp :: IDP Linkedin linkedinIdp = def { idpName = Linkedin, oauth2Config = linkedinKey, convertUserInfoToLoginUser = toLoginUser, oauth2UserInfoUri = [uri|https://api.linkedin.com/v2/me|] }
225
linkedinIdp :: IDP Linkedin linkedinIdp = def { idpName = Linkedin, oauth2Config = linkedinKey, convertUserInfoToLoginUser = toLoginUser, oauth2UserInfoUri = [uri|https://api.linkedin.com/v2/me|] }
225
linkedinIdp = def { idpName = Linkedin, oauth2Config = linkedinKey, convertUserInfoToLoginUser = toLoginUser, oauth2UserInfoUri = [uri|https://api.linkedin.com/v2/me|] }
197
false
true
0
6
48
44
28
16
null
null
antonlogvinenko/javelin
app/Main.hs
mit
main :: IO () main = javelinMain
32
main :: IO () main = javelinMain
32
main = javelinMain
18
false
true
0
6
6
16
8
8
null
null
langthom/data-structures
BinarySearchTrees/Haskell/BinTree.hs
bsd-3-clause
isEmpty _ = False
25
isEmpty _ = False
25
isEmpty _ = False
25
false
false
0
5
11
9
4
5
null
null
tsiliakis/xmobar
src/Plugins/Monitors/Top.hs
bsd-3-clause
combine :: Times -> Times -> Times combine _ [] = []
52
combine :: Times -> Times -> Times combine _ [] = []
52
combine _ [] = []
17
false
true
0
6
11
28
14
14
null
null
yurrriq/haskell-programming
src/ReaderPractice.hs
mit
xs :: Maybe Integer xs = lookup 3 $ zip x y
43
xs :: Maybe Integer xs = lookup 3 $ zip x y
43
xs = lookup 3 $ zip x y
23
false
true
1
6
11
29
12
17
null
null
portnov/yaledger
YaLedger/Reports/Common.hs
bsd-3-clause
checkExtEntry coa (Just grp) qry e = checkQuery qry e && checkEntryAccs [grp, coa] (getContent e)
97
checkExtEntry coa (Just grp) qry e = checkQuery qry e && checkEntryAccs [grp, coa] (getContent e)
97
checkExtEntry coa (Just grp) qry e = checkQuery qry e && checkEntryAccs [grp, coa] (getContent e)
97
false
false
0
8
15
47
23
24
null
null
sgillespie/ghc
compiler/basicTypes/Module.hs
bsd-3-clause
stableUnitIdCmp :: UnitId -> UnitId -> Ordering -- ^ Compares package ids lexically, rather than by their 'Unique's stableUnitIdCmp p1 p2 = unitIdFS p1 `compare` unitIdFS p2
173
stableUnitIdCmp :: UnitId -> UnitId -> Ordering stableUnitIdCmp p1 p2 = unitIdFS p1 `compare` unitIdFS p2
105
stableUnitIdCmp p1 p2 = unitIdFS p1 `compare` unitIdFS p2
57
true
true
0
6
26
37
19
18
null
null
rueshyna/gogol
gogol-dataflow/gen/Network/Google/Resource/Dataflow/Projects/Jobs/WorkItems/Lease.hs
mpl-2.0
-- | Pretty-print response. pjwilPp :: Lens' ProjectsJobsWorkItemsLease Bool pjwilPp = lens _pjwilPp (\ s a -> s{_pjwilPp = a})
127
pjwilPp :: Lens' ProjectsJobsWorkItemsLease Bool pjwilPp = lens _pjwilPp (\ s a -> s{_pjwilPp = a})
99
pjwilPp = lens _pjwilPp (\ s a -> s{_pjwilPp = a})
50
true
true
0
9
19
40
22
18
null
null
rueshyna/gogol
gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs
mpl-2.0
-- | DART ID of this country. This is the ID used for targeting and -- generating reports. cDartId :: Lens' Country (Maybe Int64) cDartId = lens _cDartId (\ s a -> s{_cDartId = a}) . mapping _Coerce
206
cDartId :: Lens' Country (Maybe Int64) cDartId = lens _cDartId (\ s a -> s{_cDartId = a}) . mapping _Coerce
115
cDartId = lens _cDartId (\ s a -> s{_cDartId = a}) . mapping _Coerce
76
true
true
1
10
45
60
29
31
null
null
rcampbell/vcard
VCard.hs
apache-2.0
{- | 3. vCard Format Specification -} -- | 3.2. Line Delimiting and Folding -- TODO should be octets, not chars, don't split a multibyte char.. fold :: String -> String fold s = concatMap foldLine (lines s) where foldLine l = if length l > limit then take limit l ++ "\r\n " ++ foldLine (drop limit l) else l ++ "\n" -- replace from lines limit = 75
474
fold :: String -> String fold s = concatMap foldLine (lines s) where foldLine l = if length l > limit then take limit l ++ "\r\n " ++ foldLine (drop limit l) else l ++ "\n" -- replace from lines limit = 75
328
fold s = concatMap foldLine (lines s) where foldLine l = if length l > limit then take limit l ++ "\r\n " ++ foldLine (drop limit l) else l ++ "\n" -- replace from lines limit = 75
303
true
true
1
9
194
96
48
48
null
null
momomimachli/Hedsql-tests
src/Database/Hedsql/Tests/Queries.hs
gpl-3.0
testExcept :: Test testExcept = testCase "SELECT EXCEPT" assertUnion where assertUnion :: Assertion assertUnion = assertEqual "SELECT EXCEPT is incorrect" ( "SELECT * FROM \"People\" " <> "EXCEPT SELECT * FROM \"People\" WHERE \"personId\" = 1" ) (S.codeGen exceptQuery)
351
testExcept :: Test testExcept = testCase "SELECT EXCEPT" assertUnion where assertUnion :: Assertion assertUnion = assertEqual "SELECT EXCEPT is incorrect" ( "SELECT * FROM \"People\" " <> "EXCEPT SELECT * FROM \"People\" WHERE \"personId\" = 1" ) (S.codeGen exceptQuery)
351
testExcept = testCase "SELECT EXCEPT" assertUnion where assertUnion :: Assertion assertUnion = assertEqual "SELECT EXCEPT is incorrect" ( "SELECT * FROM \"People\" " <> "EXCEPT SELECT * FROM \"People\" WHERE \"personId\" = 1" ) (S.codeGen exceptQuery)
332
false
true
0
8
119
67
28
39
null
null
tolysz/prepare-ghcjs
spec-lts8/base/GHC/IO/Encoding/Latin1.hs
bsd-3-clause
ascii_decode :: DecodeBuffer ascii_decode input@Buffer{ bufRaw=iraw, bufL=ir0, bufR=iw, bufSize=_ } output@Buffer{ bufRaw=oraw, bufL=_, bufR=ow0, bufSize=os } = let loop !ir !ow | ow >= os = done OutputUnderflow ir ow | ir >= iw = done InputUnderflow ir ow | otherwise = do c0 <- readWord8Buf iraw ir if c0 > 0x7f then invalid else do ow' <- writeCharBuf oraw ow (unsafeChr (fromIntegral c0)) loop (ir+1) ow' where invalid = done InvalidSequence ir ow -- lambda-lifted, to avoid thunks being built in the inner-loop: done why !ir !ow = return (why, if ir == iw then input{ bufL=0, bufR=0 } else input{ bufL=ir }, output{ bufR=ow }) in loop ir0 ow0
904
ascii_decode :: DecodeBuffer ascii_decode input@Buffer{ bufRaw=iraw, bufL=ir0, bufR=iw, bufSize=_ } output@Buffer{ bufRaw=oraw, bufL=_, bufR=ow0, bufSize=os } = let loop !ir !ow | ow >= os = done OutputUnderflow ir ow | ir >= iw = done InputUnderflow ir ow | otherwise = do c0 <- readWord8Buf iraw ir if c0 > 0x7f then invalid else do ow' <- writeCharBuf oraw ow (unsafeChr (fromIntegral c0)) loop (ir+1) ow' where invalid = done InvalidSequence ir ow -- lambda-lifted, to avoid thunks being built in the inner-loop: done why !ir !ow = return (why, if ir == iw then input{ bufL=0, bufR=0 } else input{ bufL=ir }, output{ bufR=ow }) in loop ir0 ow0
904
ascii_decode input@Buffer{ bufRaw=iraw, bufL=ir0, bufR=iw, bufSize=_ } output@Buffer{ bufRaw=oraw, bufL=_, bufR=ow0, bufSize=os } = let loop !ir !ow | ow >= os = done OutputUnderflow ir ow | ir >= iw = done InputUnderflow ir ow | otherwise = do c0 <- readWord8Buf iraw ir if c0 > 0x7f then invalid else do ow' <- writeCharBuf oraw ow (unsafeChr (fromIntegral c0)) loop (ir+1) ow' where invalid = done InvalidSequence ir ow -- lambda-lifted, to avoid thunks being built in the inner-loop: done why !ir !ow = return (why, if ir == iw then input{ bufL=0, bufR=0 } else input{ bufL=ir }, output{ bufR=ow }) in loop ir0 ow0
875
false
true
0
20
367
299
155
144
null
null
keitax/wikirick
src/Wikirick/AppHandler.hs
bsd-3-clause
handleArticle :: AppHandler () handleArticle = do title <- textParam "title" doHandleArticle title
102
handleArticle :: AppHandler () handleArticle = do title <- textParam "title" doHandleArticle title
102
handleArticle = do title <- textParam "title" doHandleArticle title
71
false
true
0
9
16
38
15
23
null
null
lensvol/hasfortune
src/Main.hs
mit
writeFortune :: [Fortune] -> Snap () writeFortune fortunes = do randomOne <- liftIO $ getRandomFortune fortunes writeBS (BSS.pack randomOne)
144
writeFortune :: [Fortune] -> Snap () writeFortune fortunes = do randomOne <- liftIO $ getRandomFortune fortunes writeBS (BSS.pack randomOne)
144
writeFortune fortunes = do randomOne <- liftIO $ getRandomFortune fortunes writeBS (BSS.pack randomOne)
107
false
true
0
10
22
54
25
29
null
null
GaloisInc/orc
src/Orc/Combinators.hs
bsd-3-clause
-------------------------------------------------------------------------- -- | Wait for a period of w seconds, then continue processing. delay :: (RealFrac a, Show a) => a -> Orc () delay w = (liftIO $ threadDelay (round (w * 1000000))) <|> (silent $ do guard (w>100) putStrLine ("Just checking you meant to wait " ++show w++" seconds"))
401
delay :: (RealFrac a, Show a) => a -> Orc () delay w = (liftIO $ threadDelay (round (w * 1000000))) <|> (silent $ do guard (w>100) putStrLine ("Just checking you meant to wait " ++show w++" seconds"))
261
delay w = (liftIO $ threadDelay (round (w * 1000000))) <|> (silent $ do guard (w>100) putStrLine ("Just checking you meant to wait " ++show w++" seconds"))
216
true
true
3
13
113
114
57
57
null
null
markflorisson/hpack
src/HPack/Iface/IfaceExtract.hs
bsd-3-clause
runExtractM :: Monad m => ExtractM m a -> IfaceRepoM m (Either ExtractErr a) runExtractM m = runHPackT m ()
107
runExtractM :: Monad m => ExtractM m a -> IfaceRepoM m (Either ExtractErr a) runExtractM m = runHPackT m ()
107
runExtractM m = runHPackT m ()
30
false
true
0
10
19
54
24
30
null
null
faylang/fay-server
src/Language/Fay/JQuery.hs
bsd-3-clause
wrapWith :: (Double -> Fay JQuery) -> JQuery -> Fay JQuery wrapWith = ffi "%2['wrap'](%1)"
90
wrapWith :: (Double -> Fay JQuery) -> JQuery -> Fay JQuery wrapWith = ffi "%2['wrap'](%1)"
90
wrapWith = ffi "%2['wrap'](%1)"
31
false
true
0
8
14
35
17
18
null
null
cies/htoml
src/Text/Toml/Parser.hs
bsd-3-clause
escSeq :: Parser Char escSeq = char '\\' *> escSeqChar where escSeqChar = try (char '"') *> return '"' <|> try (char '\\') *> return '\\' <|> try (char '/') *> return '/' <|> try (char 'b') *> return '\b' <|> try (char 't') *> return '\t' <|> try (char 'n') *> return '\n' <|> try (char 'f') *> return '\f' <|> try (char 'r') *> return '\r' <|> try (char 'u') *> unicodeHex 4 <|> try (char 'U') *> unicodeHex 8 <?> "escape character" -- | Parser for unicode hexadecimal values of representation length 'n'.
664
escSeq :: Parser Char escSeq = char '\\' *> escSeqChar where escSeqChar = try (char '"') *> return '"' <|> try (char '\\') *> return '\\' <|> try (char '/') *> return '/' <|> try (char 'b') *> return '\b' <|> try (char 't') *> return '\t' <|> try (char 'n') *> return '\n' <|> try (char 'f') *> return '\f' <|> try (char 'r') *> return '\r' <|> try (char 'u') *> unicodeHex 4 <|> try (char 'U') *> unicodeHex 8 <?> "escape character" -- | Parser for unicode hexadecimal values of representation length 'n'.
664
escSeq = char '\\' *> escSeqChar where escSeqChar = try (char '"') *> return '"' <|> try (char '\\') *> return '\\' <|> try (char '/') *> return '/' <|> try (char 'b') *> return '\b' <|> try (char 't') *> return '\t' <|> try (char 'n') *> return '\n' <|> try (char 'f') *> return '\f' <|> try (char 'r') *> return '\r' <|> try (char 'u') *> unicodeHex 4 <|> try (char 'U') *> unicodeHex 8 <?> "escape character" -- | Parser for unicode hexadecimal values of representation length 'n'.
642
false
true
0
27
253
230
105
125
null
null
rTreutlein/OpenCogLojbanToAtoms
Lib/OpenCog/Lojban/Util.hs
bsd-3-clause
cCN name tv = Node "ConceptNode" name tv
40
cCN name tv = Node "ConceptNode" name tv
40
cCN name tv = Node "ConceptNode" name tv
40
false
false
1
5
7
22
8
14
null
null
ben-schulz/Idris-dev
src/IRTS/Compiler.hs
bsd-3-clause
mkLDecl n (Function tm _) = declArgs [] True n <$> irTerm n M.empty [] tm
77
mkLDecl n (Function tm _) = declArgs [] True n <$> irTerm n M.empty [] tm
77
mkLDecl n (Function tm _) = declArgs [] True n <$> irTerm n M.empty [] tm
77
false
false
0
7
19
45
21
24
null
null
ajm188/advent_of_code
2016/17/Main.hs
mit
isGoal :: State -> Bool isGoal (State _ location _) = location == (3, 0)
72
isGoal :: State -> Bool isGoal (State _ location _) = location == (3, 0)
72
isGoal (State _ location _) = location == (3, 0)
48
false
true
0
7
14
38
20
18
null
null
zcesur/h99
src/Problems54Athru60.hs
gpl-3.0
-- | Given a number of nodes, make a perfect tree, if possible. mkPerfectTree :: Int -> Tree Char mkPerfectTree n | n == 0 = Nil | not $ powerOf2 (n + 1) = error "Not enough nodes." | otherwise = foldl insertAt Nil nodePaths where height = flg (n + 1) - 1 nodePaths = concatMap (flip replicateM [L,R]) [0 .. height] -- | Given a tree and a valid path, insert a new leaf node at the path.
439
mkPerfectTree :: Int -> Tree Char mkPerfectTree n | n == 0 = Nil | not $ powerOf2 (n + 1) = error "Not enough nodes." | otherwise = foldl insertAt Nil nodePaths where height = flg (n + 1) - 1 nodePaths = concatMap (flip replicateM [L,R]) [0 .. height] -- | Given a tree and a valid path, insert a new leaf node at the path.
375
mkPerfectTree n | n == 0 = Nil | not $ powerOf2 (n + 1) = error "Not enough nodes." | otherwise = foldl insertAt Nil nodePaths where height = flg (n + 1) - 1 nodePaths = concatMap (flip replicateM [L,R]) [0 .. height] -- | Given a tree and a valid path, insert a new leaf node at the path.
341
true
true
3
11
132
137
65
72
null
null
lukexi/gl-pal
src/Graphics/GL/Pal/AssignAttribute.hs
bsd-3-clause
assignFloatAttributeInstanced :: MonadIO m => Program -> String -> GLenum -> GLint -> m () assignFloatAttributeInstanced prog attributeName attributeType attributeLength = do attribute <- getShaderAttribute prog attributeName assignFloatAttributeFixed attribute attributeType attributeLength makeAttributeInstanced attribute -- Sets an attribute to support instancing. Be sure enableVertexAttribArray is called before this.
440
assignFloatAttributeInstanced :: MonadIO m => Program -> String -> GLenum -> GLint -> m () assignFloatAttributeInstanced prog attributeName attributeType attributeLength = do attribute <- getShaderAttribute prog attributeName assignFloatAttributeFixed attribute attributeType attributeLength makeAttributeInstanced attribute -- Sets an attribute to support instancing. Be sure enableVertexAttribArray is called before this.
440
assignFloatAttributeInstanced prog attributeName attributeType attributeLength = do attribute <- getShaderAttribute prog attributeName assignFloatAttributeFixed attribute attributeType attributeLength makeAttributeInstanced attribute -- Sets an attribute to support instancing. Be sure enableVertexAttribArray is called before this.
349
false
true
0
11
63
77
35
42
null
null
GaloisInc/saw-script
saw-core/src/Verifier/SAW/Term/CtxTerm.hs
bsd-3-clause
ctxTermsCtxHeadTail :: CtxTermsCtx ctx (as ::> a) -> (CtxTermsCtx ctx as, CtxTerm ctx a) ctxTermsCtxHeadTail (CtxTermsCtxCons as a) = (as, a)
164
ctxTermsCtxHeadTail :: CtxTermsCtx ctx (as ::> a) -> (CtxTermsCtx ctx as, CtxTerm ctx a) ctxTermsCtxHeadTail (CtxTermsCtxCons as a) = (as, a)
164
ctxTermsCtxHeadTail (CtxTermsCtxCons as a) = (as, a)
52
false
true
0
8
43
60
31
29
null
null
DavidAlphaFox/darcs
src/Darcs/Patch/Invert.hs
gpl-2.0
invertRL (x:<:xs) = invert x :>: invertRL xs
44
invertRL (x:<:xs) = invert x :>: invertRL xs
44
invertRL (x:<:xs) = invert x :>: invertRL xs
44
false
false
0
7
7
26
12
14
null
null
uduki/hsQt
Qtc/Enums/Core/QChar.hs
bsd-2-clause
eUnicode_1_1 :: UnicodeVersion eUnicode_1_1 = ieUnicodeVersion $ 1
68
eUnicode_1_1 :: UnicodeVersion eUnicode_1_1 = ieUnicodeVersion $ 1
68
eUnicode_1_1 = ieUnicodeVersion $ 1
37
false
true
0
6
9
18
8
10
null
null
vladfi1/game-ai
lib/Tree.hs
mit
adjust :: Monoid a => (a -> a) -> Int -> RangeTree a -> RangeTree a adjust f _ (Leaf a) = Leaf (f a)
100
adjust :: Monoid a => (a -> a) -> Int -> RangeTree a -> RangeTree a adjust f _ (Leaf a) = Leaf (f a)
100
adjust f _ (Leaf a) = Leaf (f a)
32
false
true
0
9
24
65
31
34
null
null
oldmanmike/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
leIntegerPrimIdKey = mkPreludeMiscIdUnique 74
56
leIntegerPrimIdKey = mkPreludeMiscIdUnique 74
56
leIntegerPrimIdKey = mkPreludeMiscIdUnique 74
56
false
false
0
5
14
9
4
5
null
null
DominikDitoIvosevic/Uni
IRG/src/Irg/Lab4/Shading2/Callbacks.hs
mit
dot4 = V4 3.5 2 0 1
19
dot4 = V4 3.5 2 0 1
19
dot4 = V4 3.5 2 0 1
19
false
false
0
5
6
15
7
8
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/topic/testing/2019-11-oskar-wickstrom-tt-and-fixing-bugs-with-property-based-testing/src/Lib.hs
unlicense
prop_two_different_failures_are_returned :: Property prop_two_different_failures_are_returned = property $ do let genForm = SignupForm <$> invalidName <*> invalidAge form <- forAll genForm case validateSignup form of Failure (failure1 :| [failure2]) -> failure1 /== failure2 other -> do annotateShow other failure {- λ> check prop_two_failures_are_returned ✓ <interactive> passed 100 tests. λ> check prop_two_different_failures_are_returned ✓ <interactive> passed 100 tests. ------------------------------------------------------------------------------ The Value of a Property weak property tests might catch a lot of mistakes, but not all weak properties better than no properties at all ------------------------------------------------------------------------------ Testing Generators above Negative Property Tests do not cover all validation rules problem in generator for invalidAge need to test generator define property testing the values it generates e.g., generate only positive integers -}
1,074
prop_two_different_failures_are_returned :: Property prop_two_different_failures_are_returned = property $ do let genForm = SignupForm <$> invalidName <*> invalidAge form <- forAll genForm case validateSignup form of Failure (failure1 :| [failure2]) -> failure1 /== failure2 other -> do annotateShow other failure {- λ> check prop_two_failures_are_returned ✓ <interactive> passed 100 tests. λ> check prop_two_different_failures_are_returned ✓ <interactive> passed 100 tests. ------------------------------------------------------------------------------ The Value of a Property weak property tests might catch a lot of mistakes, but not all weak properties better than no properties at all ------------------------------------------------------------------------------ Testing Generators above Negative Property Tests do not cover all validation rules problem in generator for invalidAge need to test generator define property testing the values it generates e.g., generate only positive integers -}
1,074
prop_two_different_failures_are_returned = property $ do let genForm = SignupForm <$> invalidName <*> invalidAge form <- forAll genForm case validateSignup form of Failure (failure1 :| [failure2]) -> failure1 /== failure2 other -> do annotateShow other failure {- λ> check prop_two_failures_are_returned ✓ <interactive> passed 100 tests. λ> check prop_two_different_failures_are_returned ✓ <interactive> passed 100 tests. ------------------------------------------------------------------------------ The Value of a Property weak property tests might catch a lot of mistakes, but not all weak properties better than no properties at all ------------------------------------------------------------------------------ Testing Generators above Negative Property Tests do not cover all validation rules problem in generator for invalidAge need to test generator define property testing the values it generates e.g., generate only positive integers -}
1,021
false
true
0
14
190
91
43
48
null
null
anton-dessiatov/stack
src/Stack/Types/BuildPlan.hs
bsd-3-clause
-- | A relative file path including a unique string for the given -- snapshot. sdRawPathName :: SnapshotDef -> String sdRawPathName sd = T.unpack $ go $ sdResolver sd where go (ResolverStackage name) = renderSnapName name go (ResolverCompiler version) = compilerVersionText version go (ResolverCustom _ hash) = "custom-" <> sdResolverName sd <> "-" <> trimmedSnapshotHash hash -- | Modify the wanted compiler version in this snapshot. This is used -- when overriding via the `compiler` value in a custom snapshot or -- stack.yaml file. We do _not_ need to modify the snapshot's hash for -- this: all binary caches of a snapshot are stored in a filepath that -- encodes the actual compiler version in addition to the -- hash. Therefore, modifications here will not lead to any invalid -- data.
811
sdRawPathName :: SnapshotDef -> String sdRawPathName sd = T.unpack $ go $ sdResolver sd where go (ResolverStackage name) = renderSnapName name go (ResolverCompiler version) = compilerVersionText version go (ResolverCustom _ hash) = "custom-" <> sdResolverName sd <> "-" <> trimmedSnapshotHash hash -- | Modify the wanted compiler version in this snapshot. This is used -- when overriding via the `compiler` value in a custom snapshot or -- stack.yaml file. We do _not_ need to modify the snapshot's hash for -- this: all binary caches of a snapshot are stored in a filepath that -- encodes the actual compiler version in addition to the -- hash. Therefore, modifications here will not lead to any invalid -- data.
732
sdRawPathName sd = T.unpack $ go $ sdResolver sd where go (ResolverStackage name) = renderSnapName name go (ResolverCompiler version) = compilerVersionText version go (ResolverCustom _ hash) = "custom-" <> sdResolverName sd <> "-" <> trimmedSnapshotHash hash -- | Modify the wanted compiler version in this snapshot. This is used -- when overriding via the `compiler` value in a custom snapshot or -- stack.yaml file. We do _not_ need to modify the snapshot's hash for -- this: all binary caches of a snapshot are stored in a filepath that -- encodes the actual compiler version in addition to the -- hash. Therefore, modifications here will not lead to any invalid -- data.
693
true
true
0
8
149
111
57
54
null
null
brendanhay/gogol
gogol-identity-toolkit/gen/Network/Google/IdentityToolkit/Types/Product.hs
mpl-2.0
-- | the iOS bundle id of iOS app to handle the action code rpIOSBundleId :: Lens' RelyingParty (Maybe Text) rpIOSBundleId = lens _rpIOSBundleId (\ s a -> s{_rpIOSBundleId = a})
185
rpIOSBundleId :: Lens' RelyingParty (Maybe Text) rpIOSBundleId = lens _rpIOSBundleId (\ s a -> s{_rpIOSBundleId = a})
125
rpIOSBundleId = lens _rpIOSBundleId (\ s a -> s{_rpIOSBundleId = a})
76
true
true
0
9
38
48
25
23
null
null
ezyang/ghc
compiler/nativeGen/X86/Instr.hs
bsd-3-clause
x86_takeRegRegMoveInstr _ = Nothing
36
x86_takeRegRegMoveInstr _ = Nothing
36
x86_takeRegRegMoveInstr _ = Nothing
36
false
false
0
4
4
10
4
6
null
null
zhensydow/ljcsandbox
edx/fp101x/lab2.hs
gpl-3.0
numValid :: [Integer] -> Integer numValid xs = sum . map (\_ -> 1) $ filter isValid xs
86
numValid :: [Integer] -> Integer numValid xs = sum . map (\_ -> 1) $ filter isValid xs
86
numValid xs = sum . map (\_ -> 1) $ filter isValid xs
53
false
true
1
8
17
51
24
27
null
null
bgamari/pandoc
src/Text/Pandoc/Writers/OpenDocument.hs
gpl-2.0
inHeaderTags :: Int -> Doc -> State WriterState Doc inHeaderTags i d = return $ inTags False "text:h" [ ("text:style-name", "Heading_20_" ++ show i) , ("text:outline-level", show i)] d
219
inHeaderTags :: Int -> Doc -> State WriterState Doc inHeaderTags i d = return $ inTags False "text:h" [ ("text:style-name", "Heading_20_" ++ show i) , ("text:outline-level", show i)] d
219
inHeaderTags i d = return $ inTags False "text:h" [ ("text:style-name", "Heading_20_" ++ show i) , ("text:outline-level", show i)] d
167
false
true
0
10
63
70
36
34
null
null
shirazb/orpiva-k-means
src/ARFFParser/BasicCombinators.hs
bsd-3-clause
-- POST: Generates error and terminates execution if parser fails require :: Parser Char a -> String -> Parser Char a require parser errorMessage = do p <- getPosition parser <|> throwError ("Syntax Error: " ++ errorMessage, updateRowPosition p) -- POST: Consumes a single character if it satisfies the predicate, fails -- otherwise (denoted by Nothing)
364
require :: Parser Char a -> String -> Parser Char a require parser errorMessage = do p <- getPosition parser <|> throwError ("Syntax Error: " ++ errorMessage, updateRowPosition p) -- POST: Consumes a single character if it satisfies the predicate, fails -- otherwise (denoted by Nothing)
298
require parser errorMessage = do p <- getPosition parser <|> throwError ("Syntax Error: " ++ errorMessage, updateRowPosition p) -- POST: Consumes a single character if it satisfies the predicate, fails -- otherwise (denoted by Nothing)
246
true
true
0
10
66
67
33
34
null
null
spockz/lhs2texhl
src/Data/List/Utils.hs
mit
spanList func list@(x:xs) = if func list then (x:ys,zs) else ([],list) where (ys,zs) = spanList func xs {- | Similar to Data.List.break, but performs the test on the entire remaining list instead of just one element. -}
244
spanList func list@(x:xs) = if func list then (x:ys,zs) else ([],list) where (ys,zs) = spanList func xs {- | Similar to Data.List.break, but performs the test on the entire remaining list instead of just one element. -}
244
spanList func list@(x:xs) = if func list then (x:ys,zs) else ([],list) where (ys,zs) = spanList func xs {- | Similar to Data.List.break, but performs the test on the entire remaining list instead of just one element. -}
244
false
false
0
8
61
70
39
31
null
null
alexbiehl/postie
src/Network/Mail/Postie/Address.hs
bsd-3-clause
quotedPair :: Parser BS.ByteString quotedPair = BS.cons '\\' . BS.singleton <$> (char '\\' *> (vchar <|> wsp <|> lf <|> cr <|> obsNoWsCtl <|> nullChar))
152
quotedPair :: Parser BS.ByteString quotedPair = BS.cons '\\' . BS.singleton <$> (char '\\' *> (vchar <|> wsp <|> lf <|> cr <|> obsNoWsCtl <|> nullChar))
152
quotedPair = BS.cons '\\' . BS.singleton <$> (char '\\' *> (vchar <|> wsp <|> lf <|> cr <|> obsNoWsCtl <|> nullChar))
117
false
true
0
13
24
64
32
32
null
null
green-haskell/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
memConstant :: Int -> CmmLit -> NatM Amode memConstant align lit = do lbl <- getNewLabelNat dflags <- getDynFlags (addr, addr_code) <- if target32Bit (targetPlatform dflags) then do dynRef <- cmmMakeDynamicReference dflags DataReference lbl Amode addr addr_code <- getAmode dynRef return (addr, addr_code) else return (ripRel (ImmCLbl lbl), nilOL) let code = LDATA ReadOnlyData (align, Statics lbl [CmmStaticLit lit]) `consOL` addr_code return (Amode addr code)
730
memConstant :: Int -> CmmLit -> NatM Amode memConstant align lit = do lbl <- getNewLabelNat dflags <- getDynFlags (addr, addr_code) <- if target32Bit (targetPlatform dflags) then do dynRef <- cmmMakeDynamicReference dflags DataReference lbl Amode addr addr_code <- getAmode dynRef return (addr, addr_code) else return (ripRel (ImmCLbl lbl), nilOL) let code = LDATA ReadOnlyData (align, Statics lbl [CmmStaticLit lit]) `consOL` addr_code return (Amode addr code)
730
memConstant align lit = do lbl <- getNewLabelNat dflags <- getDynFlags (addr, addr_code) <- if target32Bit (targetPlatform dflags) then do dynRef <- cmmMakeDynamicReference dflags DataReference lbl Amode addr addr_code <- getAmode dynRef return (addr, addr_code) else return (ripRel (ImmCLbl lbl), nilOL) let code = LDATA ReadOnlyData (align, Statics lbl [CmmStaticLit lit]) `consOL` addr_code return (Amode addr code)
687
false
true
0
16
333
186
88
98
null
null
dan3944/emojiscript
src/Transpile.hs
mit
parseFile "" = []
17
parseFile "" = []
17
parseFile "" = []
17
false
false
0
5
3
11
5
6
null
null
IxpertaSolutions/freer-effects
tests/Tests/State.hs
bsd-3-clause
testPutGet :: Int -> Int -> (Int, Int) testPutGet n start = run $ runState go start where go = put n >> get
113
testPutGet :: Int -> Int -> (Int, Int) testPutGet n start = run $ runState go start where go = put n >> get
113
testPutGet n start = run $ runState go start where go = put n >> get
74
false
true
4
9
29
61
28
33
null
null
douglas-larocca/contracts
Haskell/Contract/Type.hs
mit
transl 0 c = c
14
transl 0 c = c
14
transl 0 c = c
14
false
false
0
5
4
11
5
6
null
null
oldmanmike/ghc
compiler/iface/IfaceType.hs
bsd-3-clause
toIfaceCoercion (LRCo lr co) = IfaceLRCo lr (toIfaceCoercion co)
71
toIfaceCoercion (LRCo lr co) = IfaceLRCo lr (toIfaceCoercion co)
71
toIfaceCoercion (LRCo lr co) = IfaceLRCo lr (toIfaceCoercion co)
71
false
false
0
7
15
28
13
15
null
null
ingemaradahl/bilder
src/Compiler/Utils.hs
lgpl-3.0
declToName ∷ Decl → [String] declToName (Dec _ dp) = declPostToName dp
70
declToName ∷ Decl → [String] declToName (Dec _ dp) = declPostToName dp
70
declToName (Dec _ dp) = declPostToName dp
41
false
true
0
7
11
32
16
16
null
null
jaiyalas/haha
src/Lambda/Text/InputSet.hs
mit
in_Gamma (Abs _ m) = in_Lambda m
32
in_Gamma (Abs _ m) = in_Lambda m
32
in_Gamma (Abs _ m) = in_Lambda m
32
false
false
0
6
6
21
9
12
null
null
deciduously/Haskell-First-Principles-Exercises
4-Getting real/13-Building Projects/code/hangman/src/Main.hs
mit
renderPuzzleChar :: Maybe Char -> Char renderPuzzleChar Nothing = '_'
70
renderPuzzleChar :: Maybe Char -> Char renderPuzzleChar Nothing = '_'
70
renderPuzzleChar Nothing = '_'
31
false
true
0
7
10
27
11
16
null
null
massysett/penny
penny/lib/Penny/Copper/Grouping.hs
bsd-3-clause
ungroupDigitGroupRadCom :: DigitGroupRadCom t a -> NonEmpty (D0'9 t a) ungroupDigitGroupRadCom (DigitGroupRadCom _ d1 (D0'9'Star ds)) = NonEmpty d1 ds
152
ungroupDigitGroupRadCom :: DigitGroupRadCom t a -> NonEmpty (D0'9 t a) ungroupDigitGroupRadCom (DigitGroupRadCom _ d1 (D0'9'Star ds)) = NonEmpty d1 ds
152
ungroupDigitGroupRadCom (DigitGroupRadCom _ d1 (D0'9'Star ds)) = NonEmpty d1 ds
81
false
true
0
9
21
55
26
29
null
null
mcschroeder/ghc
compiler/prelude/THNames.hs
bsd-3-clause
litEIdKey = mkPreludeMiscIdUnique 272
45
litEIdKey = mkPreludeMiscIdUnique 272
45
litEIdKey = mkPreludeMiscIdUnique 272
45
false
false
0
5
11
9
4
5
null
null
apyrgio/snf-ganeti
src/Ganeti/Constants.hs
bsd-2-clause
-- * Instance creation modes instanceCreate :: String instanceCreate = Types.instCreateModeToRaw InstCreate
108
instanceCreate :: String instanceCreate = Types.instCreateModeToRaw InstCreate
78
instanceCreate = Types.instCreateModeToRaw InstCreate
53
true
true
0
6
12
17
9
8
null
null
glguy/simple-spreadsheet-tools
lib/Spreadsheet/Parser.hs
bsd-3-clause
-- | 'sortOrder' parses the ascending/descending indicator sortOrder :: Parsec String () SortOrder sortOrder = (Ascending <$ sortAscTok ) <|> (Descending <$ sortDescTok)
178
sortOrder :: Parsec String () SortOrder sortOrder = (Ascending <$ sortAscTok ) <|> (Descending <$ sortDescTok)
119
sortOrder = (Ascending <$ sortAscTok ) <|> (Descending <$ sortDescTok)
79
true
true
4
7
31
46
23
23
null
null
patperry/permutation
examples/Enumerate.hs
bsd-3-clause
countAllPermutes3 :: Int -> Int countAllPermutes3 n = length $ permutations [0 .. n-1]
86
countAllPermutes3 :: Int -> Int countAllPermutes3 n = length $ permutations [0 .. n-1]
86
countAllPermutes3 n = length $ permutations [0 .. n-1]
54
false
true
2
7
13
41
19
22
null
null
buckie/tsds
src/Tsds/SQL.hs
apache-2.0
sample_column :: (String, Col) sample_column = ("foo", sample_col)
66
sample_column :: (String, Col) sample_column = ("foo", sample_col)
66
sample_column = ("foo", sample_col)
35
false
true
0
5
7
23
14
9
null
null
MaxwellBo/Advent_Of_Code_2016
Day_3.hs
bsd-3-clause
main :: IO () main = do fileContents <- readFile "inputs/Day_3_input.txt" print ("Part 1", part 1 fileContents) -- 1032 print ("Part 2", part 2 fileContents) -- 1838
172
main :: IO () main = do fileContents <- readFile "inputs/Day_3_input.txt" print ("Part 1", part 1 fileContents) -- 1032 print ("Part 2", part 2 fileContents) -- 1838
172
main = do fileContents <- readFile "inputs/Day_3_input.txt" print ("Part 1", part 1 fileContents) -- 1032 print ("Part 2", part 2 fileContents) -- 1838
158
false
true
0
9
33
62
30
32
null
null
charlesrosenbauer/Bzo-Compiler
src/BzoPreprocessor.hs
gpl-3.0
wrappedLexerMap :: [(FilePath, Text)] -> Either [BzoErr] [(FilePath, [BzoToken])] wrappedLexerMap fs = let contents = parMap rpar (\(f, c) -> fileLexer c f) fs errors = L.concat $ lefts contents passes = rights contents ret = L.zip (L.map fst fs) passes in case errors of [] -> Right ret er -> Left er
345
wrappedLexerMap :: [(FilePath, Text)] -> Either [BzoErr] [(FilePath, [BzoToken])] wrappedLexerMap fs = let contents = parMap rpar (\(f, c) -> fileLexer c f) fs errors = L.concat $ lefts contents passes = rights contents ret = L.zip (L.map fst fs) passes in case errors of [] -> Right ret er -> Left er
345
wrappedLexerMap fs = let contents = parMap rpar (\(f, c) -> fileLexer c f) fs errors = L.concat $ lefts contents passes = rights contents ret = L.zip (L.map fst fs) passes in case errors of [] -> Right ret er -> Left er
263
false
true
2
12
96
145
77
68
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_333 (129#) = happyShift action_158
41
action_333 (129#) = happyShift action_158
41
action_333 (129#) = happyShift action_158
41
false
false
0
6
4
15
7
8
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/playpen/chris-forno-redo/redo.hs
unlicense
redoPath :: FilePath -> FilePath redoPath target = head [target ++ ".do"]
73
redoPath :: FilePath -> FilePath redoPath target = head [target ++ ".do"]
73
redoPath target = head [target ++ ".do"]
40
false
true
0
7
11
34
15
19
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
tcTyVarsOfType (ForAllTy tyvar ty) = tcTyVarsOfType ty `delVarSet` tyvar
73
tcTyVarsOfType (ForAllTy tyvar ty) = tcTyVarsOfType ty `delVarSet` tyvar
73
tcTyVarsOfType (ForAllTy tyvar ty) = tcTyVarsOfType ty `delVarSet` tyvar
73
false
false
0
6
9
27
13
14
null
null
brendanhay/gogol
gogol-containeranalysis/gen/Network/Google/ContainerAnalysis/Types/Product.hs
mpl-2.0
-- | The occurrences that were created. bOccurrences :: Lens' BatchCreateOccurrencesResponse [Occurrence] bOccurrences = lens _bOccurrences (\ s a -> s{_bOccurrences = a}) . _Default . _Coerce
206
bOccurrences :: Lens' BatchCreateOccurrencesResponse [Occurrence] bOccurrences = lens _bOccurrences (\ s a -> s{_bOccurrences = a}) . _Default . _Coerce
166
bOccurrences = lens _bOccurrences (\ s a -> s{_bOccurrences = a}) . _Default . _Coerce
100
true
true
2
9
40
56
28
28
null
null
jgoerzen/dtmconv
HaXml-1.12/src/Text/XML/HaXml/Html/Parse.hs
gpl-2.0
element :: Name -> HParser (Stack,Element) element ctx = do tok TokAnyOpen (ElemTag e avs) <- elemtag ( if e `closes` ctx then -- insert the missing close-tag, fail forward, and reparse. ( do debug ("/") unparse ([TokEndOpen, TokName ctx, TokAnyClose, TokAnyOpen, TokName e] ++ reformatAttrs avs) return ([], Elem "null" [] [])) else if e `elem` selfclosingtags then -- complete the parse straightaway. ( do tok TokEndClose -- self-closing <tag /> debug (e++"[+]") return ([], Elem e avs [])) +++ -- ( do tok TokAnyClose -- sequence <tag></tag> (**not HTML?**) -- debug (e++"[+") -- n <- bracket (tok TokEndOpen) name (tok TokAnyClose) -- debug "]" -- if e == (map toLower n :: Name) -- then return ([], Elem e avs []) -- else return (error "no nesting in empty tag")) +++ ( do tok TokAnyClose -- <tag> with no close (e.g. <IMG>) debug (e++"[+]") return ([], Elem e avs [])) else (( do tok TokEndClose debug (e++"[]") return ([], Elem e avs [])) +++ ( do tok TokAnyClose `elserror` "missing > or /> in element tag" debug (e++"[") zz <- many (content e) -- (if null zz then return (error ("empty content in context: "++e)) else return ()) let (ss,cs) = unzip zz let s = if null ss then [] else last ss n <- bracket (tok TokEndOpen) name (tok TokAnyClose) debug "]" ( if e == (map toLower n :: Name) then do unparse (reformatTags (closeInner e s)) debug "^" return ([], Elem e avs cs) else do unparse [TokEndOpen, TokName n, TokAnyClose] debug "-" return (((e,avs):s), Elem e avs cs)) ) `elserror` ("failed to repair non-matching tags in context: "++ctx)))
2,122
element :: Name -> HParser (Stack,Element) element ctx = do tok TokAnyOpen (ElemTag e avs) <- elemtag ( if e `closes` ctx then -- insert the missing close-tag, fail forward, and reparse. ( do debug ("/") unparse ([TokEndOpen, TokName ctx, TokAnyClose, TokAnyOpen, TokName e] ++ reformatAttrs avs) return ([], Elem "null" [] [])) else if e `elem` selfclosingtags then -- complete the parse straightaway. ( do tok TokEndClose -- self-closing <tag /> debug (e++"[+]") return ([], Elem e avs [])) +++ -- ( do tok TokAnyClose -- sequence <tag></tag> (**not HTML?**) -- debug (e++"[+") -- n <- bracket (tok TokEndOpen) name (tok TokAnyClose) -- debug "]" -- if e == (map toLower n :: Name) -- then return ([], Elem e avs []) -- else return (error "no nesting in empty tag")) +++ ( do tok TokAnyClose -- <tag> with no close (e.g. <IMG>) debug (e++"[+]") return ([], Elem e avs [])) else (( do tok TokEndClose debug (e++"[]") return ([], Elem e avs [])) +++ ( do tok TokAnyClose `elserror` "missing > or /> in element tag" debug (e++"[") zz <- many (content e) -- (if null zz then return (error ("empty content in context: "++e)) else return ()) let (ss,cs) = unzip zz let s = if null ss then [] else last ss n <- bracket (tok TokEndOpen) name (tok TokAnyClose) debug "]" ( if e == (map toLower n :: Name) then do unparse (reformatTags (closeInner e s)) debug "^" return ([], Elem e avs cs) else do unparse [TokEndOpen, TokName n, TokAnyClose] debug "-" return (((e,avs):s), Elem e avs cs)) ) `elserror` ("failed to repair non-matching tags in context: "++ctx)))
2,122
element ctx = do tok TokAnyOpen (ElemTag e avs) <- elemtag ( if e `closes` ctx then -- insert the missing close-tag, fail forward, and reparse. ( do debug ("/") unparse ([TokEndOpen, TokName ctx, TokAnyClose, TokAnyOpen, TokName e] ++ reformatAttrs avs) return ([], Elem "null" [] [])) else if e `elem` selfclosingtags then -- complete the parse straightaway. ( do tok TokEndClose -- self-closing <tag /> debug (e++"[+]") return ([], Elem e avs [])) +++ -- ( do tok TokAnyClose -- sequence <tag></tag> (**not HTML?**) -- debug (e++"[+") -- n <- bracket (tok TokEndOpen) name (tok TokAnyClose) -- debug "]" -- if e == (map toLower n :: Name) -- then return ([], Elem e avs []) -- else return (error "no nesting in empty tag")) +++ ( do tok TokAnyClose -- <tag> with no close (e.g. <IMG>) debug (e++"[+]") return ([], Elem e avs [])) else (( do tok TokEndClose debug (e++"[]") return ([], Elem e avs [])) +++ ( do tok TokAnyClose `elserror` "missing > or /> in element tag" debug (e++"[") zz <- many (content e) -- (if null zz then return (error ("empty content in context: "++e)) else return ()) let (ss,cs) = unzip zz let s = if null ss then [] else last ss n <- bracket (tok TokEndOpen) name (tok TokAnyClose) debug "]" ( if e == (map toLower n :: Name) then do unparse (reformatTags (closeInner e s)) debug "^" return ([], Elem e avs cs) else do unparse [TokEndOpen, TokName n, TokAnyClose] debug "-" return (((e,avs):s), Elem e avs cs)) ) `elserror` ("failed to repair non-matching tags in context: "++ctx)))
2,079
false
true
0
25
842
580
291
289
null
null
fffej/haskellprojects
newton/Orbit.hs
bsd-2-clause
gravity :: Double -> Double -> Double -> Double gravity m1 m2 r | r == 0 = 0 | otherwise = (m1 * m2) / (r * r)
126
gravity :: Double -> Double -> Double -> Double gravity m1 m2 r | r == 0 = 0 | otherwise = (m1 * m2) / (r * r)
126
gravity m1 m2 r | r == 0 = 0 | otherwise = (m1 * m2) / (r * r)
78
false
true
1
9
44
71
34
37
null
null
brendanhay/gogol
gogol-datastore/gen/Network/Google/Resource/Datastore/Projects/Export.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). peUploadProtocol :: Lens' ProjectsExport (Maybe Text) peUploadProtocol = lens _peUploadProtocol (\ s a -> s{_peUploadProtocol = a})
201
peUploadProtocol :: Lens' ProjectsExport (Maybe Text) peUploadProtocol = lens _peUploadProtocol (\ s a -> s{_peUploadProtocol = a})
139
peUploadProtocol = lens _peUploadProtocol (\ s a -> s{_peUploadProtocol = a})
85
true
true
0
8
33
49
25
24
null
null
vaibhav276/scheme-compiler
src/Parser.hs
mit
primitives :: [(String, [LispVal] -> ThrowsError LispVal)] primitives = [ ("+", numericBinOp (+)), ("-", numericBinOp (-)), ("*", numericBinOp (*)), ("/", numericBinOp div), ("mod", numericBinOp mod), ("quotient", numericBinOp quot), ("remainder", numericBinOp rem), ("=", numBoolBinop (==)), ("<", numBoolBinop (<)), (">", numBoolBinop (>)), ("/=", numBoolBinop (/=)), (">=", numBoolBinop (>=)), ("<=", numBoolBinop (<=)), ("&&", boolBoolBinop (&&)), ("||", boolBoolBinop (||)), ("string=?", strBoolBinop (==)), ("string?", strBoolBinop (>)), ("string<=?", strBoolBinop (<=)), ("string<?", strBoolBinop (<)), ("string>=?", strBoolBinop (>=)), ("string>?", strBoolBinop (>)), ("car", car), ("cdr", cdr), ("cons", cons), ("eq?", eqv), ("eqv?", eqv), ("equal?", equal) ]
880
primitives :: [(String, [LispVal] -> ThrowsError LispVal)] primitives = [ ("+", numericBinOp (+)), ("-", numericBinOp (-)), ("*", numericBinOp (*)), ("/", numericBinOp div), ("mod", numericBinOp mod), ("quotient", numericBinOp quot), ("remainder", numericBinOp rem), ("=", numBoolBinop (==)), ("<", numBoolBinop (<)), (">", numBoolBinop (>)), ("/=", numBoolBinop (/=)), (">=", numBoolBinop (>=)), ("<=", numBoolBinop (<=)), ("&&", boolBoolBinop (&&)), ("||", boolBoolBinop (||)), ("string=?", strBoolBinop (==)), ("string?", strBoolBinop (>)), ("string<=?", strBoolBinop (<=)), ("string<?", strBoolBinop (<)), ("string>=?", strBoolBinop (>=)), ("string>?", strBoolBinop (>)), ("car", car), ("cdr", cdr), ("cons", cons), ("eq?", eqv), ("eqv?", eqv), ("equal?", equal) ]
880
primitives = [ ("+", numericBinOp (+)), ("-", numericBinOp (-)), ("*", numericBinOp (*)), ("/", numericBinOp div), ("mod", numericBinOp mod), ("quotient", numericBinOp quot), ("remainder", numericBinOp rem), ("=", numBoolBinop (==)), ("<", numBoolBinop (<)), (">", numBoolBinop (>)), ("/=", numBoolBinop (/=)), (">=", numBoolBinop (>=)), ("<=", numBoolBinop (<=)), ("&&", boolBoolBinop (&&)), ("||", boolBoolBinop (||)), ("string=?", strBoolBinop (==)), ("string?", strBoolBinop (>)), ("string<=?", strBoolBinop (<=)), ("string<?", strBoolBinop (<)), ("string>=?", strBoolBinop (>=)), ("string>?", strBoolBinop (>)), ("car", car), ("cdr", cdr), ("cons", cons), ("eq?", eqv), ("eqv?", eqv), ("equal?", equal) ]
821
false
true
0
8
197
370
234
136
null
null
Lazersmoke/rhc
src/Old/ParseFEST.hs
bsd-3-clause
fracLiteral :: IParser Literal fracLiteral = lexeme $ FracLiteral . read <$> do w <- many1 digit _ <- char '.' f <- many1 digit return $ w ++ "." ++ f
158
fracLiteral :: IParser Literal fracLiteral = lexeme $ FracLiteral . read <$> do w <- many1 digit _ <- char '.' f <- many1 digit return $ w ++ "." ++ f
158
fracLiteral = lexeme $ FracLiteral . read <$> do w <- many1 digit _ <- char '.' f <- many1 digit return $ w ++ "." ++ f
127
false
true
0
10
39
71
32
39
null
null
rueshyna/gogol
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
mpl-2.0
-- | Creates a value of 'FanFundingEventSnippet' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ffesDisplayString' -- -- * 'ffesSupporterDetails' -- -- * 'ffesCreatedAt' -- -- * 'ffesAmountMicros' -- -- * 'ffesChannelId' -- -- * 'ffesCommentText' -- -- * 'ffesCurrency' fanFundingEventSnippet :: FanFundingEventSnippet fanFundingEventSnippet = FanFundingEventSnippet' { _ffesDisplayString = Nothing , _ffesSupporterDetails = Nothing , _ffesCreatedAt = Nothing , _ffesAmountMicros = Nothing , _ffesChannelId = Nothing , _ffesCommentText = Nothing , _ffesCurrency = Nothing }
700
fanFundingEventSnippet :: FanFundingEventSnippet fanFundingEventSnippet = FanFundingEventSnippet' { _ffesDisplayString = Nothing , _ffesSupporterDetails = Nothing , _ffesCreatedAt = Nothing , _ffesAmountMicros = Nothing , _ffesChannelId = Nothing , _ffesCommentText = Nothing , _ffesCurrency = Nothing }
343
fanFundingEventSnippet = FanFundingEventSnippet' { _ffesDisplayString = Nothing , _ffesSupporterDetails = Nothing , _ffesCreatedAt = Nothing , _ffesAmountMicros = Nothing , _ffesChannelId = Nothing , _ffesCommentText = Nothing , _ffesCurrency = Nothing }
290
true
true
0
6
132
72
52
20
null
null
Frefreak/solitaire-solver
src/Pretty.hs
bsd-3-clause
zhong :: String zhong = "\ESC[31;1m\x1f004\ESC[0m"
50
zhong :: String zhong = "\ESC[31;1m\x1f004\ESC[0m"
50
zhong = "\ESC[31;1m\x1f004\ESC[0m"
34
false
true
0
4
5
11
6
5
null
null
chreekat/snowdrift
SnowdriftEmailDaemon.hs
agpl-3.0
sendDeleteConfirmation :: ( MonadBaseControl IO m, MonadLogger m, MonadIO m) => FileName -> FileName -> PostgresConf -> ConnectionPool -> Email -> UserId -> Email -> Text -> m () sendDeleteConfirmation sendmail_exec sendmail_file dbConf poolConf notif_email user_id user_email uri = do let content = "Please open this link to delete your account: " <> uri handleSendmail sendmail_exec sendmail_file dbConf poolConf ("sending a delete confirmation message to " <> user_email <> "\n" <> content) notif_email user_email "Snowdrift.coop delete confirmation" content (markAsSentDeleteConfirmation user_id) ("sending the delete confirmation message to " <> user_email <> " failed; " <> "will try again later")
830
sendDeleteConfirmation :: ( MonadBaseControl IO m, MonadLogger m, MonadIO m) => FileName -> FileName -> PostgresConf -> ConnectionPool -> Email -> UserId -> Email -> Text -> m () sendDeleteConfirmation sendmail_exec sendmail_file dbConf poolConf notif_email user_id user_email uri = do let content = "Please open this link to delete your account: " <> uri handleSendmail sendmail_exec sendmail_file dbConf poolConf ("sending a delete confirmation message to " <> user_email <> "\n" <> content) notif_email user_email "Snowdrift.coop delete confirmation" content (markAsSentDeleteConfirmation user_id) ("sending the delete confirmation message to " <> user_email <> " failed; " <> "will try again later")
830
sendDeleteConfirmation sendmail_exec sendmail_file dbConf poolConf notif_email user_id user_email uri = do let content = "Please open this link to delete your account: " <> uri handleSendmail sendmail_exec sendmail_file dbConf poolConf ("sending a delete confirmation message to " <> user_email <> "\n" <> content) notif_email user_email "Snowdrift.coop delete confirmation" content (markAsSentDeleteConfirmation user_id) ("sending the delete confirmation message to " <> user_email <> " failed; " <> "will try again later")
605
false
true
0
15
224
163
81
82
null
null
LukaHorvat/Hibernate
dist/build/autogen/Paths_Hibernate.hs
mit
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a catchIO = Exception.catch
84
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a catchIO = Exception.catch
84
catchIO = Exception.catch
25
false
true
0
9
14
39
19
20
null
null
rueshyna/gogol
gogol-customsearch/gen/Network/Google/Resource/Search/CSE/List.hs
mpl-2.0
-- | Specifies that all search results should contain a link to a particular -- URL cselLinkSite :: Lens' CSEList (Maybe Text) cselLinkSite = lens _cselLinkSite (\ s a -> s{_cselLinkSite = a})
194
cselLinkSite :: Lens' CSEList (Maybe Text) cselLinkSite = lens _cselLinkSite (\ s a -> s{_cselLinkSite = a})
110
cselLinkSite = lens _cselLinkSite (\ s a -> s{_cselLinkSite = a})
67
true
true
1
9
34
51
26
25
null
null
rahulmutt/ghcvm
libraries/eta-meta/Language/Eta/Meta/Ppr.hs
bsd-3-clause
pprLit _ (CharL c) = text (show c)
40
pprLit _ (CharL c) = text (show c)
40
pprLit _ (CharL c) = text (show c)
40
false
false
1
7
13
29
12
17
null
null
Warbo/quickcheck
Test/QuickCheck/Function.hs
bsd-3-clause
table (Unit c) = [ ((), c) ]
31
table (Unit c) = [ ((), c) ]
31
table (Unit c) = [ ((), c) ]
31
false
false
0
7
10
26
14
12
null
null
jvilar/hrows
lib/Presenter/UpdateAuto.hs
gpl-2.0
update model (ImportFieldsFromRowStore m keys values, pos) = partialRefresh pos $ importFields m keys values `inside` model
127
update model (ImportFieldsFromRowStore m keys values, pos) = partialRefresh pos $ importFields m keys values `inside` model
127
update model (ImportFieldsFromRowStore m keys values, pos) = partialRefresh pos $ importFields m keys values `inside` model
127
false
false
2
6
20
48
22
26
null
null
taylor1791/adventofcode
2015/src/Day23.hs
bsd-2-clause
parseSign :: Parsec s u m (Int -> Int) parseSign = P.try (PC.char '+' >> return (1*)) P.<|> P.try (PC.char '-' >> return (0-))
126
parseSign :: Parsec s u m (Int -> Int) parseSign = P.try (PC.char '+' >> return (1*)) P.<|> P.try (PC.char '-' >> return (0-))
126
parseSign = P.try (PC.char '+' >> return (1*)) P.<|> P.try (PC.char '-' >> return (0-))
87
false
true
0
10
23
86
42
44
null
null
Changaco/haskell-plugins
src/System/Plugins/Utils.hs
lgpl-2.1
decode (c : rest) = c : decode rest
36
decode (c : rest) = c : decode rest
36
decode (c : rest) = c : decode rest
36
false
false
0
7
9
23
11
12
null
null
forked-upstream-packages-for-ghcjs/ghc
libraries/base/GHC/Event/Manager.hs
bsd-3-clause
finished :: EventManager -> IO Bool finished mgr = (== Finished) `liftM` readIORef (emState mgr)
96
finished :: EventManager -> IO Bool finished mgr = (== Finished) `liftM` readIORef (emState mgr)
96
finished mgr = (== Finished) `liftM` readIORef (emState mgr)
60
false
true
0
8
14
40
21
19
null
null
Fuuzetsu/yrc
src/Yi/YRC.hs
gpl-3.0
handleEvent :: MVar IrcMessage -> YiM () handleEvent m = do -- s <- withBuffer $ use bufferDynamicValueA e <- io . takeMVar $ m msgEditor $ show e
151
handleEvent :: MVar IrcMessage -> YiM () handleEvent m = do -- s <- withBuffer $ use bufferDynamicValueA e <- io . takeMVar $ m msgEditor $ show e
151
handleEvent m = do -- s <- withBuffer $ use bufferDynamicValueA e <- io . takeMVar $ m msgEditor $ show e
110
false
true
0
10
33
57
25
32
null
null
santolucito/ives
tests/benchmarks/custom_tree_max.hs
mit
accumTree f x (Branch b1 b2) = f (accumTree f x b1) (accumTree f x b2)
70
accumTree f x (Branch b1 b2) = f (accumTree f x b1) (accumTree f x b2)
70
accumTree f x (Branch b1 b2) = f (accumTree f x b1) (accumTree f x b2)
70
false
false
0
7
15
46
22
24
null
null
DronovIlya/filemanager-hs
src/GUI/MyView.hs
gpl-2.0
-- |Initialize base directory in case of unkhown previous state. Actual on first run initDirectory :: IO () initDirectory = do home <- Files.Manager.getHomeFolder setCurrentDirectory home return () -- | Create base container of 2 windows. Create it and set events callbacks
280
initDirectory :: IO () initDirectory = do home <- Files.Manager.getHomeFolder setCurrentDirectory home return () -- | Create base container of 2 windows. Create it and set events callbacks
195
initDirectory = do home <- Files.Manager.getHomeFolder setCurrentDirectory home return () -- | Create base container of 2 windows. Create it and set events callbacks
172
true
true
0
8
48
42
20
22
null
null
facebookincubator/duckling
Duckling/Rules/BG.hs
bsd-3-clause
langRules (Seal Email) = []
27
langRules (Seal Email) = []
27
langRules (Seal Email) = []
27
false
false
0
7
4
17
8
9
null
null
apyrgio/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
opsFinalized :: FrozenSet String opsFinalized = ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
120
opsFinalized :: FrozenSet String opsFinalized = ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
120
opsFinalized = ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
87
false
true
0
6
11
28
15
13
null
null
nushio3/ghc
compiler/prelude/TysPrim.hs
bsd-3-clause
openAlphaTy, openBetaTy :: Type openAlphaTy = mkTyVarTy openAlphaTyVar
70
openAlphaTy, openBetaTy :: Type openAlphaTy = mkTyVarTy openAlphaTyVar
70
openAlphaTy = mkTyVarTy openAlphaTyVar
38
false
true
2
6
7
27
10
17
null
null
Peaker/git-mediate
src/Resolution.hs
gpl-2.0
untabifyStr :: Int -> String -> String untabifyStr size = go 0 where cyclicInc col | col >= size - 1 = 0 | otherwise = col + 1 go !col ('\t':rest) = replicate (size - col) ' ' ++ go 0 rest go !col (x:rest) = x : go (cyclicInc col) rest go _ [] = []
312
untabifyStr :: Int -> String -> String untabifyStr size = go 0 where cyclicInc col | col >= size - 1 = 0 | otherwise = col + 1 go !col ('\t':rest) = replicate (size - col) ' ' ++ go 0 rest go !col (x:rest) = x : go (cyclicInc col) rest go _ [] = []
312
untabifyStr size = go 0 where cyclicInc col | col >= size - 1 = 0 | otherwise = col + 1 go !col ('\t':rest) = replicate (size - col) ' ' ++ go 0 rest go !col (x:rest) = x : go (cyclicInc col) rest go _ [] = []
273
false
true
3
12
121
152
73
79
null
null
bitemyapp/uri-bytestring
test/URI/ByteStringTests.hs
bsd-3-clause
------------------------------------------------------------------------------- lensTests :: TestTree lensTests = testGroup "lenses" [ testProperty "schemeBSL Lens" $ \bs bs' -> let wrapped = Scheme bs in (wrapped ^. schemeBSL) === schemeBS wrapped .&&. (wrapped & schemeBSL .~ bs') === wrapped { schemeBS = bs'} , testProperty "hostBSL Lens" $ \bs bs' -> let wrapped = Host bs in (wrapped ^. hostBSL) === hostBS wrapped .&&. (wrapped & hostBSL .~ bs') === wrapped { hostBS = bs'} , testProperty "portNumberL Lens" $ \n n' -> let wrapped = Port n in (wrapped ^. portNumberL) === portNumber wrapped .&&. (wrapped & portNumberL .~ n') === wrapped { portNumber = n'} , testProperty "queryPairsL Lens" $ \ps ps' -> let wrapped = Query ps in wrapped ^. queryPairsL === queryPairs wrapped .&&. (wrapped & queryPairsL .~ ps') === wrapped { queryPairs = ps'} , testProperty "authorityUserInfoL Lens" $ \a ui -> (a ^. authorityUserInfoL === authorityUserInfo a) .&&. ((a & authorityUserInfoL .~ ui) === a { authorityUserInfo = ui }) , testProperty "authorityHostL Lens" $ \a host -> (a ^. authorityHostL === authorityHost a) .&&. ((a & authorityHostL .~ host) === a { authorityHost = host }) , testProperty "authorityPortL Lens" $ \a port -> (a ^. authorityPortL === authorityPort a) .&&. ((a & authorityPortL .~ port) === a { authorityPort = port }) , testProperty "uiUsernameL Lens" $ \ui bs -> (ui ^. uiUsernameL === uiUsername ui) .&&. ((ui & uiUsernameL .~ bs) === ui { uiUsername = bs }) , testProperty "uiPasswordL Lens" $ \ui bs -> (ui ^. uiPasswordL === uiPassword ui) .&&. ((ui & uiPasswordL .~ bs) === ui { uiPassword = bs }) , testProperty "uriSchemeL Lens" $ \uri x -> (uri ^. uriSchemeL === uriScheme uri) .&&. ((uri & uriSchemeL .~ x) === uri { uriScheme = x }) , testProperty "uriAuthorityL Lens" $ \uri x -> (uri ^. uriAuthorityL === uriAuthority uri) .&&. ((uri & uriAuthorityL .~ x) === uri { uriAuthority = x }) , testProperty "uriPathL Lens" $ \uri x -> (uri ^. uriPathL === uriPath uri) .&&. ((uri & uriPathL .~ x) === uri { uriPath = x }) , testProperty "uriQueryL Lens" $ \uri x -> (uri ^. uriQueryL === uriQuery uri) .&&. ((uri & uriQueryL .~ x) === uri { uriQuery = x }) , testProperty "uriFragmentL Lens" $ \uri x -> (uri ^. uriFragmentL === uriFragment uri) .&&. ((uri & uriFragmentL .~ x) === uri { uriFragment = x }) , testProperty "rrAuthorityL Lens" $ \rr x -> (rr ^. rrAuthorityL === rrAuthority rr) .&&. ((rr & rrAuthorityL .~ x) === rr { rrAuthority = x }) , testProperty "rrPathL Lens" $ \rr x -> (rr ^. rrPathL === rrPath rr) .&&. ((rr & rrPathL .~ x) === rr { rrPath = x }) , testProperty "rrQueryL Lens" $ \rr x -> (rr ^. rrQueryL === rrQuery rr) .&&. ((rr & rrQueryL .~ x) === rr { rrQuery = x }) , testProperty "rrFragmentL Lens" $ \rr x -> (rr ^. rrFragmentL === rrFragment rr) .&&. ((rr & rrFragmentL .~ x) === rr { rrFragment = x }) ]
3,139
lensTests :: TestTree lensTests = testGroup "lenses" [ testProperty "schemeBSL Lens" $ \bs bs' -> let wrapped = Scheme bs in (wrapped ^. schemeBSL) === schemeBS wrapped .&&. (wrapped & schemeBSL .~ bs') === wrapped { schemeBS = bs'} , testProperty "hostBSL Lens" $ \bs bs' -> let wrapped = Host bs in (wrapped ^. hostBSL) === hostBS wrapped .&&. (wrapped & hostBSL .~ bs') === wrapped { hostBS = bs'} , testProperty "portNumberL Lens" $ \n n' -> let wrapped = Port n in (wrapped ^. portNumberL) === portNumber wrapped .&&. (wrapped & portNumberL .~ n') === wrapped { portNumber = n'} , testProperty "queryPairsL Lens" $ \ps ps' -> let wrapped = Query ps in wrapped ^. queryPairsL === queryPairs wrapped .&&. (wrapped & queryPairsL .~ ps') === wrapped { queryPairs = ps'} , testProperty "authorityUserInfoL Lens" $ \a ui -> (a ^. authorityUserInfoL === authorityUserInfo a) .&&. ((a & authorityUserInfoL .~ ui) === a { authorityUserInfo = ui }) , testProperty "authorityHostL Lens" $ \a host -> (a ^. authorityHostL === authorityHost a) .&&. ((a & authorityHostL .~ host) === a { authorityHost = host }) , testProperty "authorityPortL Lens" $ \a port -> (a ^. authorityPortL === authorityPort a) .&&. ((a & authorityPortL .~ port) === a { authorityPort = port }) , testProperty "uiUsernameL Lens" $ \ui bs -> (ui ^. uiUsernameL === uiUsername ui) .&&. ((ui & uiUsernameL .~ bs) === ui { uiUsername = bs }) , testProperty "uiPasswordL Lens" $ \ui bs -> (ui ^. uiPasswordL === uiPassword ui) .&&. ((ui & uiPasswordL .~ bs) === ui { uiPassword = bs }) , testProperty "uriSchemeL Lens" $ \uri x -> (uri ^. uriSchemeL === uriScheme uri) .&&. ((uri & uriSchemeL .~ x) === uri { uriScheme = x }) , testProperty "uriAuthorityL Lens" $ \uri x -> (uri ^. uriAuthorityL === uriAuthority uri) .&&. ((uri & uriAuthorityL .~ x) === uri { uriAuthority = x }) , testProperty "uriPathL Lens" $ \uri x -> (uri ^. uriPathL === uriPath uri) .&&. ((uri & uriPathL .~ x) === uri { uriPath = x }) , testProperty "uriQueryL Lens" $ \uri x -> (uri ^. uriQueryL === uriQuery uri) .&&. ((uri & uriQueryL .~ x) === uri { uriQuery = x }) , testProperty "uriFragmentL Lens" $ \uri x -> (uri ^. uriFragmentL === uriFragment uri) .&&. ((uri & uriFragmentL .~ x) === uri { uriFragment = x }) , testProperty "rrAuthorityL Lens" $ \rr x -> (rr ^. rrAuthorityL === rrAuthority rr) .&&. ((rr & rrAuthorityL .~ x) === rr { rrAuthority = x }) , testProperty "rrPathL Lens" $ \rr x -> (rr ^. rrPathL === rrPath rr) .&&. ((rr & rrPathL .~ x) === rr { rrPath = x }) , testProperty "rrQueryL Lens" $ \rr x -> (rr ^. rrQueryL === rrQuery rr) .&&. ((rr & rrQueryL .~ x) === rr { rrQuery = x }) , testProperty "rrFragmentL Lens" $ \rr x -> (rr ^. rrFragmentL === rrFragment rr) .&&. ((rr & rrFragmentL .~ x) === rr { rrFragment = x }) ]
3,059
lensTests = testGroup "lenses" [ testProperty "schemeBSL Lens" $ \bs bs' -> let wrapped = Scheme bs in (wrapped ^. schemeBSL) === schemeBS wrapped .&&. (wrapped & schemeBSL .~ bs') === wrapped { schemeBS = bs'} , testProperty "hostBSL Lens" $ \bs bs' -> let wrapped = Host bs in (wrapped ^. hostBSL) === hostBS wrapped .&&. (wrapped & hostBSL .~ bs') === wrapped { hostBS = bs'} , testProperty "portNumberL Lens" $ \n n' -> let wrapped = Port n in (wrapped ^. portNumberL) === portNumber wrapped .&&. (wrapped & portNumberL .~ n') === wrapped { portNumber = n'} , testProperty "queryPairsL Lens" $ \ps ps' -> let wrapped = Query ps in wrapped ^. queryPairsL === queryPairs wrapped .&&. (wrapped & queryPairsL .~ ps') === wrapped { queryPairs = ps'} , testProperty "authorityUserInfoL Lens" $ \a ui -> (a ^. authorityUserInfoL === authorityUserInfo a) .&&. ((a & authorityUserInfoL .~ ui) === a { authorityUserInfo = ui }) , testProperty "authorityHostL Lens" $ \a host -> (a ^. authorityHostL === authorityHost a) .&&. ((a & authorityHostL .~ host) === a { authorityHost = host }) , testProperty "authorityPortL Lens" $ \a port -> (a ^. authorityPortL === authorityPort a) .&&. ((a & authorityPortL .~ port) === a { authorityPort = port }) , testProperty "uiUsernameL Lens" $ \ui bs -> (ui ^. uiUsernameL === uiUsername ui) .&&. ((ui & uiUsernameL .~ bs) === ui { uiUsername = bs }) , testProperty "uiPasswordL Lens" $ \ui bs -> (ui ^. uiPasswordL === uiPassword ui) .&&. ((ui & uiPasswordL .~ bs) === ui { uiPassword = bs }) , testProperty "uriSchemeL Lens" $ \uri x -> (uri ^. uriSchemeL === uriScheme uri) .&&. ((uri & uriSchemeL .~ x) === uri { uriScheme = x }) , testProperty "uriAuthorityL Lens" $ \uri x -> (uri ^. uriAuthorityL === uriAuthority uri) .&&. ((uri & uriAuthorityL .~ x) === uri { uriAuthority = x }) , testProperty "uriPathL Lens" $ \uri x -> (uri ^. uriPathL === uriPath uri) .&&. ((uri & uriPathL .~ x) === uri { uriPath = x }) , testProperty "uriQueryL Lens" $ \uri x -> (uri ^. uriQueryL === uriQuery uri) .&&. ((uri & uriQueryL .~ x) === uri { uriQuery = x }) , testProperty "uriFragmentL Lens" $ \uri x -> (uri ^. uriFragmentL === uriFragment uri) .&&. ((uri & uriFragmentL .~ x) === uri { uriFragment = x }) , testProperty "rrAuthorityL Lens" $ \rr x -> (rr ^. rrAuthorityL === rrAuthority rr) .&&. ((rr & rrAuthorityL .~ x) === rr { rrAuthority = x }) , testProperty "rrPathL Lens" $ \rr x -> (rr ^. rrPathL === rrPath rr) .&&. ((rr & rrPathL .~ x) === rr { rrPath = x }) , testProperty "rrQueryL Lens" $ \rr x -> (rr ^. rrQueryL === rrQuery rr) .&&. ((rr & rrQueryL .~ x) === rr { rrQuery = x }) , testProperty "rrFragmentL Lens" $ \rr x -> (rr ^. rrFragmentL === rrFragment rr) .&&. ((rr & rrFragmentL .~ x) === rr { rrFragment = x }) ]
3,037
true
true
0
14
784
1,157
617
540
null
null
joozek78/stack
src/Stack/Docker.hs
bsd-3-clause
-- | Command-line option for @--internal-re-exec@. reExecArgName :: String reExecArgName = "internal-re-exec"
109
reExecArgName :: String reExecArgName = "internal-re-exec"
58
reExecArgName = "internal-re-exec"
34
true
true
0
4
11
12
7
5
null
null
ricardopenyamari/ir2haskell
clir-parser-haskell-master/src/Language/Clir.hs
gpl-2.0
-- | Constant nodes are used in different nodes of the grammar (case -- alternatives and constants). constantNode :: Grammar SexpGrammar (Sexp :- t) (ConstValue :- t) constantNode = match $ With (\str -> str . string') $ With (\int_ -> int_ . int) $ With (\real_ -> real_ . real) $ With (\bool_ -> bool_ . clirbool) $ End
396
constantNode :: Grammar SexpGrammar (Sexp :- t) (ConstValue :- t) constantNode = match $ With (\str -> str . string') $ With (\int_ -> int_ . int) $ With (\real_ -> real_ . real) $ With (\bool_ -> bool_ . clirbool) $ End
295
constantNode = match $ With (\str -> str . string') $ With (\int_ -> int_ . int) $ With (\real_ -> real_ . real) $ With (\bool_ -> bool_ . clirbool) $ End
229
true
true
11
7
134
124
61
63
null
null
oldmanmike/ghc
compiler/basicTypes/SrcLoc.hs
bsd-3-clause
{- ************************************************************************ * * \subsection[SrcSpan-access-fns]{Access functions} * * ************************************************************************ -} -- | Returns the location at the start of the 'SrcSpan' or a "bad" 'SrcSpan' if that is unavailable srcSpanStart :: SrcSpan -> SrcLoc srcSpanStart (UnhelpfulSpan str) = UnhelpfulLoc str
534
srcSpanStart :: SrcSpan -> SrcLoc srcSpanStart (UnhelpfulSpan str) = UnhelpfulLoc str
85
srcSpanStart (UnhelpfulSpan str) = UnhelpfulLoc str
51
true
true
0
7
178
29
15
14
null
null
ComputationWithBoundedResources/ara-inference
src/Data/Rewriting/ARA/Pretty/Pretty.hs
mit
prettyAraProblem :: (Show f, Show v, Show s, Show sDt, Show dt, Show cn) => ProblemSig f v s sDt dt cn -> Doc prettyAraProblem prob = printWhen' (sterms /= AllTerms) (block "STARTTERM" $ text "CONSTRUCTOR-BASED") $ printWhen' (strat /= Full) (block "STRATEGY" $ ppStrat strat) $ maybeblock "THEORY" theory ppTheories $+$ empty $+$ block "VAR" (ppTexts $ variables prob) $+$ empty $+$ maybeblock "DATATYPES" datatypes ppDatatypes $+$ empty $+$ maybeblock "SIGNATURES" signatures ppSigs $+$ empty $+$ block "RULES" (ppRules $ rules prob) $+$ empty $+$ maybeblock "COMMENT" comment text where block n pp = parens $ hang empty 3 $ text n $+$ empty $+$ pp maybeblock n f fpp = case f prob of Just e -> block n (fpp e) Nothing -> empty ppStrat Innermost = text "INNERMOST" ppStrat Outermost = text "OUTERMOST" ppStrat Full = error "Should not be possible." ppTexts vs = fsep [ text (show v) | v <- vs] ppTheories thys = vcat [ppThy thy | thy <- thys] where ppThy (SymbolProperty p fs) = block p (fsep [ text (show f) | f <- fs ]) ppThy (Equations rs) = block "EQUATIONS" $ vcat [ppRule "==" r | r <- rs] ppRules rp = vcat ([ppRule "->" r | r <- strictRules rp] ++ [ppRule "->=" r | r <- weakRules rp]) ppRule = prettyRule ppDatatypes dts' = vcat [ ppDatatype dt | dt <- dts' ] ppDatatype = prettyAraDatatype ppCost ppCost ppCost = const empty ppSigs sigs = vcat #ifdef DEBUG [ ppSig sig | sig <- sigs ] #else [ ppSig sig | sig <- filter ((\(_,_,r,_) -> not r) . lhsRootSym) sigs ] #endif ppSig = prettyAraSignature (text . show) ppCost (\(a,b) -> text (show a)) -- <> text ":" <> hcat (intersperse (text ",") $ -- map ppCost b)) dts = fromMaybe [] (datatypes prob) sterms = startTerms prob strat = strategy prob thry = theory prob
2,187
prettyAraProblem :: (Show f, Show v, Show s, Show sDt, Show dt, Show cn) => ProblemSig f v s sDt dt cn -> Doc prettyAraProblem prob = printWhen' (sterms /= AllTerms) (block "STARTTERM" $ text "CONSTRUCTOR-BASED") $ printWhen' (strat /= Full) (block "STRATEGY" $ ppStrat strat) $ maybeblock "THEORY" theory ppTheories $+$ empty $+$ block "VAR" (ppTexts $ variables prob) $+$ empty $+$ maybeblock "DATATYPES" datatypes ppDatatypes $+$ empty $+$ maybeblock "SIGNATURES" signatures ppSigs $+$ empty $+$ block "RULES" (ppRules $ rules prob) $+$ empty $+$ maybeblock "COMMENT" comment text where block n pp = parens $ hang empty 3 $ text n $+$ empty $+$ pp maybeblock n f fpp = case f prob of Just e -> block n (fpp e) Nothing -> empty ppStrat Innermost = text "INNERMOST" ppStrat Outermost = text "OUTERMOST" ppStrat Full = error "Should not be possible." ppTexts vs = fsep [ text (show v) | v <- vs] ppTheories thys = vcat [ppThy thy | thy <- thys] where ppThy (SymbolProperty p fs) = block p (fsep [ text (show f) | f <- fs ]) ppThy (Equations rs) = block "EQUATIONS" $ vcat [ppRule "==" r | r <- rs] ppRules rp = vcat ([ppRule "->" r | r <- strictRules rp] ++ [ppRule "->=" r | r <- weakRules rp]) ppRule = prettyRule ppDatatypes dts' = vcat [ ppDatatype dt | dt <- dts' ] ppDatatype = prettyAraDatatype ppCost ppCost ppCost = const empty ppSigs sigs = vcat #ifdef DEBUG [ ppSig sig | sig <- sigs ] #else [ ppSig sig | sig <- filter ((\(_,_,r,_) -> not r) . lhsRootSym) sigs ] #endif ppSig = prettyAraSignature (text . show) ppCost (\(a,b) -> text (show a)) -- <> text ":" <> hcat (intersperse (text ",") $ -- map ppCost b)) dts = fromMaybe [] (datatypes prob) sterms = startTerms prob strat = strategy prob thry = theory prob
2,187
prettyAraProblem prob = printWhen' (sterms /= AllTerms) (block "STARTTERM" $ text "CONSTRUCTOR-BASED") $ printWhen' (strat /= Full) (block "STRATEGY" $ ppStrat strat) $ maybeblock "THEORY" theory ppTheories $+$ empty $+$ block "VAR" (ppTexts $ variables prob) $+$ empty $+$ maybeblock "DATATYPES" datatypes ppDatatypes $+$ empty $+$ maybeblock "SIGNATURES" signatures ppSigs $+$ empty $+$ block "RULES" (ppRules $ rules prob) $+$ empty $+$ maybeblock "COMMENT" comment text where block n pp = parens $ hang empty 3 $ text n $+$ empty $+$ pp maybeblock n f fpp = case f prob of Just e -> block n (fpp e) Nothing -> empty ppStrat Innermost = text "INNERMOST" ppStrat Outermost = text "OUTERMOST" ppStrat Full = error "Should not be possible." ppTexts vs = fsep [ text (show v) | v <- vs] ppTheories thys = vcat [ppThy thy | thy <- thys] where ppThy (SymbolProperty p fs) = block p (fsep [ text (show f) | f <- fs ]) ppThy (Equations rs) = block "EQUATIONS" $ vcat [ppRule "==" r | r <- rs] ppRules rp = vcat ([ppRule "->" r | r <- strictRules rp] ++ [ppRule "->=" r | r <- weakRules rp]) ppRule = prettyRule ppDatatypes dts' = vcat [ ppDatatype dt | dt <- dts' ] ppDatatype = prettyAraDatatype ppCost ppCost ppCost = const empty ppSigs sigs = vcat #ifdef DEBUG [ ppSig sig | sig <- sigs ] #else [ ppSig sig | sig <- filter ((\(_,_,r,_) -> not r) . lhsRootSym) sigs ] #endif ppSig = prettyAraSignature (text . show) ppCost (\(a,b) -> text (show a)) -- <> text ":" <> hcat (intersperse (text ",") $ -- map ppCost b)) dts = fromMaybe [] (datatypes prob) sterms = startTerms prob strat = strategy prob thry = theory prob
2,057
false
true
14
13
781
711
344
367
null
null
GaloisInc/halvm-ghc
compiler/basicTypes/VarEnv.hs
bsd-3-clause
nukeRnEnvL, nukeRnEnvR :: RnEnv2 -> RnEnv2 -- ^ Wipe the left or right side renaming nukeRnEnvL env = env { envL = emptyVarEnv }
128
nukeRnEnvL, nukeRnEnvR :: RnEnv2 -> RnEnv2 nukeRnEnvL env = env { envL = emptyVarEnv }
86
nukeRnEnvL env = env { envL = emptyVarEnv }
43
true
true
0
6
23
29
17
12
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F18.hs
bsd-3-clause
ptr_glMultiTexGeniEXT :: FunPtr (GLenum -> GLenum -> GLenum -> GLint -> IO ()) ptr_glMultiTexGeniEXT = unsafePerformIO $ getCommand "glMultiTexGeniEXT"
151
ptr_glMultiTexGeniEXT :: FunPtr (GLenum -> GLenum -> GLenum -> GLint -> IO ()) ptr_glMultiTexGeniEXT = unsafePerformIO $ getCommand "glMultiTexGeniEXT"
151
ptr_glMultiTexGeniEXT = unsafePerformIO $ getCommand "glMultiTexGeniEXT"
72
false
true
0
12
18
45
22
23
null
null
prowdsponsor/country-codes
src/Data/CountryCodes/ISO31661.hs
bsd-3-clause
fromMText "NL" = Just NL
24
fromMText "NL" = Just NL
24
fromMText "NL" = Just NL
24
false
false
0
5
4
12
5
7
null
null
BurntSushi/erd
src/Erd/Config.hs
unlicense
-- | Reads and parses configuration file at default location: ~/.erd.yaml readGlobalConfigFile :: IO (Maybe ConfigFile) readGlobalConfigFile = do mHome <- tryJust (guard . isDoesNotExistError) getHomeDirectory case mHome of Left _ -> return Nothing Right home -> readConfigFile $ Just (home </> ".erd.yaml") -- | Reads and parses a configuration file, exceptions may come via -- AesonException.
411
readGlobalConfigFile :: IO (Maybe ConfigFile) readGlobalConfigFile = do mHome <- tryJust (guard . isDoesNotExistError) getHomeDirectory case mHome of Left _ -> return Nothing Right home -> readConfigFile $ Just (home </> ".erd.yaml") -- | Reads and parses a configuration file, exceptions may come via -- AesonException.
337
readGlobalConfigFile = do mHome <- tryJust (guard . isDoesNotExistError) getHomeDirectory case mHome of Left _ -> return Nothing Right home -> readConfigFile $ Just (home </> ".erd.yaml") -- | Reads and parses a configuration file, exceptions may come via -- AesonException.
291
true
true
0
13
73
84
41
43
null
null
joelburget/daily-typecheckers
src/Day22.hs
bsd-3-clause
runReflectM :: InferNom -> Hoas runReflectM iTm = runReader (reflectI iTm) []
77
runReflectM :: InferNom -> Hoas runReflectM iTm = runReader (reflectI iTm) []
77
runReflectM iTm = runReader (reflectI iTm) []
45
false
true
0
7
11
34
16
18
null
null
donatello/minio-hs
test/Network/Minio/Utils/Test.hs
apache-2.0
testLMC :: Assertion testLMC = do let maxNum = 50 -- test with thread count of 1 to 2*maxNum forM_ [1..(2*maxNum)] $ \threads -> do res <- limitedMapConcurrently threads compute [1..maxNum] sum res @?= overallResultCheck maxNum where -- simple function to run in each thread compute :: Int -> IO Int compute n = return $ sum [1..n] -- function to check overall result overallResultCheck n = sum $ map (\t -> (t * (t+1)) `div` 2) [1..n]
472
testLMC :: Assertion testLMC = do let maxNum = 50 -- test with thread count of 1 to 2*maxNum forM_ [1..(2*maxNum)] $ \threads -> do res <- limitedMapConcurrently threads compute [1..maxNum] sum res @?= overallResultCheck maxNum where -- simple function to run in each thread compute :: Int -> IO Int compute n = return $ sum [1..n] -- function to check overall result overallResultCheck n = sum $ map (\t -> (t * (t+1)) `div` 2) [1..n]
472
testLMC = do let maxNum = 50 -- test with thread count of 1 to 2*maxNum forM_ [1..(2*maxNum)] $ \threads -> do res <- limitedMapConcurrently threads compute [1..maxNum] sum res @?= overallResultCheck maxNum where -- simple function to run in each thread compute :: Int -> IO Int compute n = return $ sum [1..n] -- function to check overall result overallResultCheck n = sum $ map (\t -> (t * (t+1)) `div` 2) [1..n]
451
false
true
5
13
114
182
88
94
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
happyReduce_240 = happySpecReduce_3 68# happyReduction_240
58
happyReduce_240 = happySpecReduce_3 68# happyReduction_240
58
happyReduce_240 = happySpecReduce_3 68# happyReduction_240
58
false
false
0
5
4
11
5
6
null
null