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
brendanhay/gogol
gogol-firestore/gen/Network/Google/Resource/FireStore/Projects/Databases/Documents/Commit.hs
mpl-2.0
-- | Required. The database name. In the format: -- \`projects\/{project_id}\/databases\/{database_id}\`. pddcDatabase :: Lens' ProjectsDatabasesDocumentsCommit Text pddcDatabase = lens _pddcDatabase (\ s a -> s{_pddcDatabase = a})
233
pddcDatabase :: Lens' ProjectsDatabasesDocumentsCommit Text pddcDatabase = lens _pddcDatabase (\ s a -> s{_pddcDatabase = a})
127
pddcDatabase = lens _pddcDatabase (\ s a -> s{_pddcDatabase = a})
67
true
true
0
9
28
43
23
20
null
null
phaul/chess
Chess/TimeControl.hs
bsd-3-clause
------------------------------------------------------------------------------ -- | Creates an empty 'TimeStats' instance mkTimeStats :: TimeStats mkTimeStats = TimeStats []
173
mkTimeStats :: TimeStats mkTimeStats = TimeStats []
51
mkTimeStats = TimeStats []
26
true
true
0
6
14
24
11
13
null
null
tolysz/prepare-ghcjs
spec-lts8/cabal/Cabal/tests/PackageTests/BenchmarkStanza/Check.hs
bsd-3-clause
suite :: TestM () suite = do assertOutputDoesNotContain "unknown section type" =<< cabal' "configure" [] dist_dir <- distDir lbi <- liftIO $ getPersistBuildConfig dist_dir let anticipatedBenchmark = emptyBenchmark { benchmarkName = "dummy" , benchmarkInterface = BenchmarkExeV10 (Version [1,0] []) "dummy.hs" , benchmarkBuildInfo = emptyBuildInfo { targetBuildDepends = [ Dependency (PackageName "base") anyVersion ] , hsSourceDirs = ["."] } , benchmarkEnabled = False } gotBenchmark = head $ benchmarks (localPkgDescr lbi) assertEqual "parsed benchmark stanza does not match anticipated" anticipatedBenchmark gotBenchmark return ()
899
suite :: TestM () suite = do assertOutputDoesNotContain "unknown section type" =<< cabal' "configure" [] dist_dir <- distDir lbi <- liftIO $ getPersistBuildConfig dist_dir let anticipatedBenchmark = emptyBenchmark { benchmarkName = "dummy" , benchmarkInterface = BenchmarkExeV10 (Version [1,0] []) "dummy.hs" , benchmarkBuildInfo = emptyBuildInfo { targetBuildDepends = [ Dependency (PackageName "base") anyVersion ] , hsSourceDirs = ["."] } , benchmarkEnabled = False } gotBenchmark = head $ benchmarks (localPkgDescr lbi) assertEqual "parsed benchmark stanza does not match anticipated" anticipatedBenchmark gotBenchmark return ()
899
suite = do assertOutputDoesNotContain "unknown section type" =<< cabal' "configure" [] dist_dir <- distDir lbi <- liftIO $ getPersistBuildConfig dist_dir let anticipatedBenchmark = emptyBenchmark { benchmarkName = "dummy" , benchmarkInterface = BenchmarkExeV10 (Version [1,0] []) "dummy.hs" , benchmarkBuildInfo = emptyBuildInfo { targetBuildDepends = [ Dependency (PackageName "base") anyVersion ] , hsSourceDirs = ["."] } , benchmarkEnabled = False } gotBenchmark = head $ benchmarks (localPkgDescr lbi) assertEqual "parsed benchmark stanza does not match anticipated" anticipatedBenchmark gotBenchmark return ()
881
false
true
0
18
348
183
91
92
null
null
Proclivis/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxTEXT_ATTR_FONT_POINT_SIZE :: Int wxTEXT_ATTR_FONT_POINT_SIZE = 0x00000008
85
wxTEXT_ATTR_FONT_POINT_SIZE :: Int wxTEXT_ATTR_FONT_POINT_SIZE = 0x00000008
85
wxTEXT_ATTR_FONT_POINT_SIZE = 0x00000008
45
false
true
0
4
15
11
6
5
null
null
MichaeGon/cgi
src/index.hs
mit
html :: Html -> Html -> Html -> Html -> Html html title' msg links apachev = htmlHeader +++ htmlBody where htmlHeader = header . concatHtml $ [meta', title', css] meta' = meta ! [strAttr "charset" "UTF-8"] css = itag "LINK" ! [rel "stylesheet", strAttr "type" "text/css", href "basic.css"] htmlBody = body . concatHtml $ [links, br, msg, br, hr, div'] div' = tag "DIV" (apachev +++ br) ! [identifier "body_second"]
458
html :: Html -> Html -> Html -> Html -> Html html title' msg links apachev = htmlHeader +++ htmlBody where htmlHeader = header . concatHtml $ [meta', title', css] meta' = meta ! [strAttr "charset" "UTF-8"] css = itag "LINK" ! [rel "stylesheet", strAttr "type" "text/css", href "basic.css"] htmlBody = body . concatHtml $ [links, br, msg, br, hr, div'] div' = tag "DIV" (apachev +++ br) ! [identifier "body_second"]
458
html title' msg links apachev = htmlHeader +++ htmlBody where htmlHeader = header . concatHtml $ [meta', title', css] meta' = meta ! [strAttr "charset" "UTF-8"] css = itag "LINK" ! [rel "stylesheet", strAttr "type" "text/css", href "basic.css"] htmlBody = body . concatHtml $ [links, br, msg, br, hr, div'] div' = tag "DIV" (apachev +++ br) ! [identifier "body_second"]
413
false
true
1
8
114
181
93
88
null
null
hguenther/smtlib2
extras/composite/Language/SMTLib2/Composite/Lens.hs
gpl-3.0
liftLens :: Monad m => Lens' a b -> LensM' m a b liftLens l = lensM (\st -> return (st ^. l)) (\st el -> return (st & l .~ el))
140
liftLens :: Monad m => Lens' a b -> LensM' m a b liftLens l = lensM (\st -> return (st ^. l)) (\st el -> return (st & l .~ el))
140
liftLens l = lensM (\st -> return (st ^. l)) (\st el -> return (st & l .~ el))
91
false
true
0
11
44
84
42
42
null
null
mdsteele/fallback
src/Fallback/Data/Point.hs
gpl-3.0
isCardinal DirW = True
22
isCardinal DirW = True
22
isCardinal DirW = True
22
false
false
0
5
3
9
4
5
null
null
mattrrichard/darwin
src/Evolution.hs
bsd-3-clause
uncache = fst . getCached
25
uncache = fst . getCached
25
uncache = fst . getCached
25
false
false
2
5
4
15
5
10
null
null
songpp/pcs-cli
src/Api.hs
apache-2.0
handleResult (Left e) = handleErr e
35
handleResult (Left e) = handleErr e
35
handleResult (Left e) = handleErr e
35
false
false
0
7
5
18
8
10
null
null
themoritz/cabal
Cabal/Distribution/Simple/GHC.hs
bsd-3-clause
gbuildIsRepl (GReplFLib _) = True
34
gbuildIsRepl (GReplFLib _) = True
34
gbuildIsRepl (GReplFLib _) = True
34
false
false
0
7
5
15
7
8
null
null
juanpaucar/vcf
src/Bio/VCF/Parser/Helpers.hs
mit
-- '.' isBase :: Word8 -> Bool isBase c = c == 65 || c == 97 || -- A or a c == 67 || c == 99 || -- C or c c == 71 || c == 103 || -- G or g c == 84 || c == 116 || -- T or t c == 78 || c == 110
238
isBase :: Word8 -> Bool isBase c = c == 65 || c == 97 || -- A or a c == 67 || c == 99 || -- C or c c == 71 || c == 103 || -- G or g c == 84 || c == 116 || -- T or t c == 78 || c == 110
230
isBase c = c == 65 || c == 97 || -- A or a c == 67 || c == 99 || -- C or c c == 71 || c == 103 || -- G or g c == 84 || c == 116 || -- T or t c == 78 || c == 110
206
true
true
0
23
111
99
52
47
null
null
schernichkin/exchange
src/Finance/Exchange/AlfaDirect/Types.hs
bsd-3-clause
matchPaperByCode :: PaperCode -> Paper -> Bool matchPaperByCode c p = on (==) T.toLower (p^.pCode) (c^.paperCode) && case c^.marketCode of Just m -> on (==) T.toLower (p^.placeCode) m Nothing -> True
220
matchPaperByCode :: PaperCode -> Paper -> Bool matchPaperByCode c p = on (==) T.toLower (p^.pCode) (c^.paperCode) && case c^.marketCode of Just m -> on (==) T.toLower (p^.placeCode) m Nothing -> True
220
matchPaperByCode c p = on (==) T.toLower (p^.pCode) (c^.paperCode) && case c^.marketCode of Just m -> on (==) T.toLower (p^.placeCode) m Nothing -> True
173
false
true
0
11
51
104
52
52
null
null
threetreeslight/learning-haskell
practice/old/20151004.hs
mit
concatRaw, concatF :: [[a]] -> [a] concatRaw (xs : xss) = xs ++ concatRaw xss
77
concatRaw, concatF :: [[a]] -> [a] concatRaw (xs : xss) = xs ++ concatRaw xss
77
concatRaw (xs : xss) = xs ++ concatRaw xss
42
false
true
0
7
14
43
24
19
null
null
sacundim/tau-sigma
src/TauSigma/Statistics/Total.hs
bsd-3-clause
totvar tau0 m xs = sumsq 0 (V.length xs - 1) term / divisor where divisor = 2 * m'^2 * tau0^2 * (len - 2) where m' = fromIntegral m len = fromIntegral (V.length xs) term notI = xs!*(i-m) - 2*xs!*i + xs!*(i+m) where i = notI+1 -- | Overlapped estimator of Allan deviation at one sampling interval.
343
totvar tau0 m xs = sumsq 0 (V.length xs - 1) term / divisor where divisor = 2 * m'^2 * tau0^2 * (len - 2) where m' = fromIntegral m len = fromIntegral (V.length xs) term notI = xs!*(i-m) - 2*xs!*i + xs!*(i+m) where i = notI+1 -- | Overlapped estimator of Allan deviation at one sampling interval.
343
totvar tau0 m xs = sumsq 0 (V.length xs - 1) term / divisor where divisor = 2 * m'^2 * tau0^2 * (len - 2) where m' = fromIntegral m len = fromIntegral (V.length xs) term notI = xs!*(i-m) - 2*xs!*i + xs!*(i+m) where i = notI+1 -- | Overlapped estimator of Allan deviation at one sampling interval.
343
false
false
1
12
105
163
79
84
null
null
timmytofu/graphql-haskell
Data/GraphQL/Encoder.hs
bsd-3-clause
nonNullType :: NonNullType -> Text nonNullType (NonNullTypeNamed (NamedType x)) = x <> "!"
90
nonNullType :: NonNullType -> Text nonNullType (NonNullTypeNamed (NamedType x)) = x <> "!"
90
nonNullType (NonNullTypeNamed (NamedType x)) = x <> "!"
55
false
true
0
9
12
34
17
17
null
null
madjestic/b1
src/B1/Program/Chart/SideBar.hs
bsd-3-clause
scrollIncrement = 25::GLfloat
29
scrollIncrement = 25::GLfloat
29
scrollIncrement = 25::GLfloat
29
false
false
0
4
2
9
5
4
null
null
alexander-at-github/eta
compiler/ETA/DeSugar/DsArrows.hs
bsd-3-clause
foldb f xs = foldb f (fold_pairs xs) where fold_pairs [] = [] fold_pairs [x] = [x] fold_pairs (x1:x2:xs) = f x1 x2:fold_pairs xs {- Note [Dictionary binders in ConPatOut] See also same Note in HsUtils ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following functions to collect value variables from patterns are copied from HsUtils, with one change: we also collect the dictionary bindings (pat_binds) from ConPatOut. We need them for cases like h :: Arrow a => Int -> a (Int,Int) Int h x = proc (y,z) -> case compare x y of GT -> returnA -< z+x The type checker turns the case into case compare x y of GT { p77 = plusInt } -> returnA -< p77 z x Here p77 is a local binding for the (+) operation. See comments in HsUtils for why the other version does not include these bindings. -}
850
foldb f xs = foldb f (fold_pairs xs) where fold_pairs [] = [] fold_pairs [x] = [x] fold_pairs (x1:x2:xs) = f x1 x2:fold_pairs xs {- Note [Dictionary binders in ConPatOut] See also same Note in HsUtils ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following functions to collect value variables from patterns are copied from HsUtils, with one change: we also collect the dictionary bindings (pat_binds) from ConPatOut. We need them for cases like h :: Arrow a => Int -> a (Int,Int) Int h x = proc (y,z) -> case compare x y of GT -> returnA -< z+x The type checker turns the case into case compare x y of GT { p77 = plusInt } -> returnA -< p77 z x Here p77 is a local binding for the (+) operation. See comments in HsUtils for why the other version does not include these bindings. -}
850
foldb f xs = foldb f (fold_pairs xs) where fold_pairs [] = [] fold_pairs [x] = [x] fold_pairs (x1:x2:xs) = f x1 x2:fold_pairs xs {- Note [Dictionary binders in ConPatOut] See also same Note in HsUtils ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following functions to collect value variables from patterns are copied from HsUtils, with one change: we also collect the dictionary bindings (pat_binds) from ConPatOut. We need them for cases like h :: Arrow a => Int -> a (Int,Int) Int h x = proc (y,z) -> case compare x y of GT -> returnA -< z+x The type checker turns the case into case compare x y of GT { p77 = plusInt } -> returnA -< p77 z x Here p77 is a local binding for the (+) operation. See comments in HsUtils for why the other version does not include these bindings. -}
850
false
false
2
7
213
93
41
52
null
null
robstewart57/bindings-dc1394
Bindings/DC1394/Camera.hs
bsd-3-clause
-- | Set the video transmission on startVideoTransmission :: Camera -> IO () startVideoTransmission c = withCameraPtr c $ \camera -> checking $ c'dc1394_video_set_transmission camera c'DC1394_ON
194
startVideoTransmission :: Camera -> IO () startVideoTransmission c = withCameraPtr c $ \camera -> checking $ c'dc1394_video_set_transmission camera c'DC1394_ON
159
startVideoTransmission c = withCameraPtr c $ \camera -> checking $ c'dc1394_video_set_transmission camera c'DC1394_ON
117
true
true
0
8
25
45
22
23
null
null
flocc-net/flocc
v0.1/Compiler/Tests/BackEnd1/NodeLayouts.hs
apache-2.0
getLayoutVar :: Monad m => Ty -> GenM1 m (Maybe (Val m)) getLayoutVar nsTy = do maybeVar <- getGlobal "nodeLayouts" (Lf $ TyOV nsTy) return maybeVar -- |getNodeSetVar nsVarName nsTy. Queries the globals to find the -- |nodeset var associated with nsTy, and binds it to nsVarName -- |in the local environment.
316
getLayoutVar :: Monad m => Ty -> GenM1 m (Maybe (Val m)) getLayoutVar nsTy = do maybeVar <- getGlobal "nodeLayouts" (Lf $ TyOV nsTy) return maybeVar -- |getNodeSetVar nsVarName nsTy. Queries the globals to find the -- |nodeset var associated with nsTy, and binds it to nsVarName -- |in the local environment.
315
getLayoutVar nsTy = do maybeVar <- getGlobal "nodeLayouts" (Lf $ TyOV nsTy) return maybeVar -- |getNodeSetVar nsVarName nsTy. Queries the globals to find the -- |nodeset var associated with nsTy, and binds it to nsVarName -- |in the local environment.
258
false
true
0
11
59
73
35
38
null
null
pbrisbin/hgdata
src/Network/Google/FusionTables.hs
mit
parseTable oth = Error$ "parseTable: Expected JSObject, got "++show oth
71
parseTable oth = Error$ "parseTable: Expected JSObject, got "++show oth
71
parseTable oth = Error$ "parseTable: Expected JSObject, got "++show oth
71
false
false
3
6
9
25
9
16
null
null
brendanhay/gogol
gogol-vision/gen/Network/Google/Resource/Vision/Projects/Images/AsyncBatchAnnotate.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). piabaUploadProtocol :: Lens' ProjectsImagesAsyncBatchAnnotate (Maybe Text) piabaUploadProtocol = lens _piabaUploadProtocol (\ s a -> s{_piabaUploadProtocol = a})
231
piabaUploadProtocol :: Lens' ProjectsImagesAsyncBatchAnnotate (Maybe Text) piabaUploadProtocol = lens _piabaUploadProtocol (\ s a -> s{_piabaUploadProtocol = a})
169
piabaUploadProtocol = lens _piabaUploadProtocol (\ s a -> s{_piabaUploadProtocol = a})
94
true
true
0
9
33
48
25
23
null
null
dorchard/gram_lang
interpreter/tests/Golden.hs
bsd-3-clause
grGolden :: (Either InterpreterError InterpreterResult -> String) -> FilePath -> TestTree grGolden formatResult file = goldenTest file (Strict.readFile outfile) (formatResult <$> runGr file) checkDifference (\actual -> unless (null actual) (writeFile outfile actual)) where outfile = file <> ".output" checkDifference :: String -> String -> IO (Maybe String) checkDifference exp act = if exp == act then return Nothing else return . Just $ unlines [ "Contents of " <> outfile <> " (<) and actual output (>) differ:" , ppDiff $ getGroupedDiff (lines exp) (lines act) ] runGr :: FilePath -> IO (Either InterpreterError InterpreterResult) runGr fp = do src <- readFile fp let ?globals = goldenGlobals { globalsSourceFilePath = Just fp } Interpreter.run src
856
grGolden :: (Either InterpreterError InterpreterResult -> String) -> FilePath -> TestTree grGolden formatResult file = goldenTest file (Strict.readFile outfile) (formatResult <$> runGr file) checkDifference (\actual -> unless (null actual) (writeFile outfile actual)) where outfile = file <> ".output" checkDifference :: String -> String -> IO (Maybe String) checkDifference exp act = if exp == act then return Nothing else return . Just $ unlines [ "Contents of " <> outfile <> " (<) and actual output (>) differ:" , ppDiff $ getGroupedDiff (lines exp) (lines act) ] runGr :: FilePath -> IO (Either InterpreterError InterpreterResult) runGr fp = do src <- readFile fp let ?globals = goldenGlobals { globalsSourceFilePath = Just fp } Interpreter.run src
856
grGolden formatResult file = goldenTest file (Strict.readFile outfile) (formatResult <$> runGr file) checkDifference (\actual -> unless (null actual) (writeFile outfile actual)) where outfile = file <> ".output" checkDifference :: String -> String -> IO (Maybe String) checkDifference exp act = if exp == act then return Nothing else return . Just $ unlines [ "Contents of " <> outfile <> " (<) and actual output (>) differ:" , ppDiff $ getGroupedDiff (lines exp) (lines act) ] runGr :: FilePath -> IO (Either InterpreterError InterpreterResult) runGr fp = do src <- readFile fp let ?globals = goldenGlobals { globalsSourceFilePath = Just fp } Interpreter.run src
760
false
true
13
13
217
262
131
131
null
null
brendanhay/gogol
gogol-admin-directory/gen/Network/Google/Resource/Directory/Users/Get.hs
mpl-2.0
-- | A comma-separated list of schema names. All fields from these schemas -- are fetched. This should only be set when \`projection=custom\`. ugCustomFieldMask :: Lens' UsersGet (Maybe Text) ugCustomFieldMask = lens _ugCustomFieldMask (\ s a -> s{_ugCustomFieldMask = a})
280
ugCustomFieldMask :: Lens' UsersGet (Maybe Text) ugCustomFieldMask = lens _ugCustomFieldMask (\ s a -> s{_ugCustomFieldMask = a})
137
ugCustomFieldMask = lens _ugCustomFieldMask (\ s a -> s{_ugCustomFieldMask = a})
88
true
true
0
9
47
49
26
23
null
null
nevrenato/Hets_Fork
CSL/InteractiveTests.hs
gpl-2.0
mlTestEnv :: Pretty a => String -> ML a -> IO a mlTestEnv s act = do let mN = if null s then Nothing else Just s eRes <- runLink (Just "/tmp/mi.txt") 2 mN act case eRes of Left eid -> putStrLn ("Error " ++ show eid) >> error "ml-test" Right res -> putStrLn ("OK: " ++ (show $ pretty res)) >> return res
316
mlTestEnv :: Pretty a => String -> ML a -> IO a mlTestEnv s act = do let mN = if null s then Nothing else Just s eRes <- runLink (Just "/tmp/mi.txt") 2 mN act case eRes of Left eid -> putStrLn ("Error " ++ show eid) >> error "ml-test" Right res -> putStrLn ("OK: " ++ (show $ pretty res)) >> return res
316
mlTestEnv s act = do let mN = if null s then Nothing else Just s eRes <- runLink (Just "/tmp/mi.txt") 2 mN act case eRes of Left eid -> putStrLn ("Error " ++ show eid) >> error "ml-test" Right res -> putStrLn ("OK: " ++ (show $ pretty res)) >> return res
268
false
true
0
17
78
159
72
87
null
null
eryx67/haskell-libtorrent
src/Network/Libtorrent/TH.hs
bsd-3-clause
-- | Create type classes for C++ container type -- -- @ -- $(defineVectorLike "string" "VectorString" ''C'String| ''C'VectorString ''StdString ''StdVector) -- @ defineVectorLike :: String -- ^ C type name -> String -- ^ std::vector alias created by typedef -> Name -- ^ c-inline element type -> Name -- ^ c-inline vector type -> Name -- ^ element type, must be instance of 'Inlinable' and 'FromPtr' -> Name -- ^ container type -> DecsQ defineVectorLike c_el_type_name c_arr_type_name c'elType c'arrType elType arrType = do let typeInfo tc = do TyConI ty <- reify tc case ty of (DataD _ n _ cs _) -> return (n, cs) (NewtypeD _ n _ c _) -> return (n, [c]) _ -> error $ "type of " ++ (show tc) ++ " must be data or newtype type " constrName _ [(RecC n [_])] = n constrName _ [(NormalC n [_])] = n constrName tc _ = error $ (show tc) ++ " must have only one constructor with one argument" (c'elTypeName, _) <- typeInfo c'elType (c'arrTypeName, _) <- typeInfo c'arrType (elTypeName, _) <- typeInfo elType (arrTypeName, arrConstrs) <- typeInfo arrType let arrConstrName = constrName arrType arrConstrs destrFname <- cName ("delete_" ++ c_arr_type_name) elemFname <- cName ("get_elem_" ++ c_arr_type_name) constrFname <- cName ("new_" ++ c_arr_type_name) addElemFname <- cName ("add_elem_" ++ c_arr_type_name) fptr <- newName "fptr" let destrCode = Code Safe destrFtype destrFname ("void " ++ destrFname ++ "(" ++ c_arr_type_name ++ "* ptr) { delete ptr; }") elemCode = Code Safe elemFtype elemFname (c_el_type_name ++ " * " ++ elemFname ++ "(" ++ c_arr_type_name ++ " *ptr, size_t i) {\n" ++ c_arr_type_name ++" v = *ptr;\n" ++ "if (i >= v.size()) \n" ++ " return NULL;\n" ++ "else\n" ++ "return new " ++ c_el_type_name ++ "(v[i]);\n" ++ "}\n") constrCode = Code Safe constrFtype constrFname (c_arr_type_name ++ " * "++ constrFname ++ "()" ++ " { return new " ++ c_arr_type_name ++"(); }") addelemCode = Code Safe addElemFtype addElemFname ("void " ++ addElemFname ++ "(" ++ c_arr_type_name ++ " * vPtr, " ++ c_el_type_name ++ " *ePtr) { vPtr->push_back(*ePtr); }") destrFtype = [t| Ptr $(conT c'arrTypeName) -> IO () |] elemFtype = [t| Ptr $(conT c'arrTypeName) -> C.CSize -> IO (Ptr $(conT c'elTypeName)) |] constrFtype = [t| IO (Ptr $(conT c'arrTypeName)) |] addElemFtype = [t| Ptr $(conT c'arrTypeName) -> Ptr $(conT c'elTypeName) -> IO ()|] [d| instance Inlinable $(appT (conT arrTypeName) $ conT elTypeName) where type (CType $(appT (conT arrTypeName) $ conT elTypeName)) = $(conT c'arrTypeName) instance FromPtr $(appT (conT arrTypeName) $ conT elTypeName) where fromPtr = objFromPtr $(conE arrConstrName) $(inlineCode destrCode) instance WithPtr $(appT (conT arrTypeName) $ conT elTypeName) where withPtr $(conP arrConstrName [varP fptr]) = withForeignPtr $(varE fptr) instance ArrayLike $(appT (conT arrTypeName) $ conT elTypeName) where type ElemType $(appT (conT arrTypeName) $ conT elTypeName) = $(conT elTypeName) getElem v i = withPtr v $ \vPtr -> do ptr <- $(inlineCode elemCode) vPtr i if ptr == nullPtr then return Nothing else Just <$> fromPtr (pure ptr) instance VectorLike $(appT (conT arrTypeName) $ conT elTypeName) where newVector = fromPtr $(inlineCode constrCode) addElem v e = withPtr v $ \vPtr -> withPtr e $ \ePtr -> $(inlineCode addelemCode) vPtr ePtr |] -- From c-inline
3,958
defineVectorLike :: String -- ^ C type name -> String -- ^ std::vector alias created by typedef -> Name -- ^ c-inline element type -> Name -- ^ c-inline vector type -> Name -- ^ element type, must be instance of 'Inlinable' and 'FromPtr' -> Name -- ^ container type -> DecsQ defineVectorLike c_el_type_name c_arr_type_name c'elType c'arrType elType arrType = do let typeInfo tc = do TyConI ty <- reify tc case ty of (DataD _ n _ cs _) -> return (n, cs) (NewtypeD _ n _ c _) -> return (n, [c]) _ -> error $ "type of " ++ (show tc) ++ " must be data or newtype type " constrName _ [(RecC n [_])] = n constrName _ [(NormalC n [_])] = n constrName tc _ = error $ (show tc) ++ " must have only one constructor with one argument" (c'elTypeName, _) <- typeInfo c'elType (c'arrTypeName, _) <- typeInfo c'arrType (elTypeName, _) <- typeInfo elType (arrTypeName, arrConstrs) <- typeInfo arrType let arrConstrName = constrName arrType arrConstrs destrFname <- cName ("delete_" ++ c_arr_type_name) elemFname <- cName ("get_elem_" ++ c_arr_type_name) constrFname <- cName ("new_" ++ c_arr_type_name) addElemFname <- cName ("add_elem_" ++ c_arr_type_name) fptr <- newName "fptr" let destrCode = Code Safe destrFtype destrFname ("void " ++ destrFname ++ "(" ++ c_arr_type_name ++ "* ptr) { delete ptr; }") elemCode = Code Safe elemFtype elemFname (c_el_type_name ++ " * " ++ elemFname ++ "(" ++ c_arr_type_name ++ " *ptr, size_t i) {\n" ++ c_arr_type_name ++" v = *ptr;\n" ++ "if (i >= v.size()) \n" ++ " return NULL;\n" ++ "else\n" ++ "return new " ++ c_el_type_name ++ "(v[i]);\n" ++ "}\n") constrCode = Code Safe constrFtype constrFname (c_arr_type_name ++ " * "++ constrFname ++ "()" ++ " { return new " ++ c_arr_type_name ++"(); }") addelemCode = Code Safe addElemFtype addElemFname ("void " ++ addElemFname ++ "(" ++ c_arr_type_name ++ " * vPtr, " ++ c_el_type_name ++ " *ePtr) { vPtr->push_back(*ePtr); }") destrFtype = [t| Ptr $(conT c'arrTypeName) -> IO () |] elemFtype = [t| Ptr $(conT c'arrTypeName) -> C.CSize -> IO (Ptr $(conT c'elTypeName)) |] constrFtype = [t| IO (Ptr $(conT c'arrTypeName)) |] addElemFtype = [t| Ptr $(conT c'arrTypeName) -> Ptr $(conT c'elTypeName) -> IO ()|] [d| instance Inlinable $(appT (conT arrTypeName) $ conT elTypeName) where type (CType $(appT (conT arrTypeName) $ conT elTypeName)) = $(conT c'arrTypeName) instance FromPtr $(appT (conT arrTypeName) $ conT elTypeName) where fromPtr = objFromPtr $(conE arrConstrName) $(inlineCode destrCode) instance WithPtr $(appT (conT arrTypeName) $ conT elTypeName) where withPtr $(conP arrConstrName [varP fptr]) = withForeignPtr $(varE fptr) instance ArrayLike $(appT (conT arrTypeName) $ conT elTypeName) where type ElemType $(appT (conT arrTypeName) $ conT elTypeName) = $(conT elTypeName) getElem v i = withPtr v $ \vPtr -> do ptr <- $(inlineCode elemCode) vPtr i if ptr == nullPtr then return Nothing else Just <$> fromPtr (pure ptr) instance VectorLike $(appT (conT arrTypeName) $ conT elTypeName) where newVector = fromPtr $(inlineCode constrCode) addElem v e = withPtr v $ \vPtr -> withPtr e $ \ePtr -> $(inlineCode addelemCode) vPtr ePtr |] -- From c-inline
3,797
defineVectorLike c_el_type_name c_arr_type_name c'elType c'arrType elType arrType = do let typeInfo tc = do TyConI ty <- reify tc case ty of (DataD _ n _ cs _) -> return (n, cs) (NewtypeD _ n _ c _) -> return (n, [c]) _ -> error $ "type of " ++ (show tc) ++ " must be data or newtype type " constrName _ [(RecC n [_])] = n constrName _ [(NormalC n [_])] = n constrName tc _ = error $ (show tc) ++ " must have only one constructor with one argument" (c'elTypeName, _) <- typeInfo c'elType (c'arrTypeName, _) <- typeInfo c'arrType (elTypeName, _) <- typeInfo elType (arrTypeName, arrConstrs) <- typeInfo arrType let arrConstrName = constrName arrType arrConstrs destrFname <- cName ("delete_" ++ c_arr_type_name) elemFname <- cName ("get_elem_" ++ c_arr_type_name) constrFname <- cName ("new_" ++ c_arr_type_name) addElemFname <- cName ("add_elem_" ++ c_arr_type_name) fptr <- newName "fptr" let destrCode = Code Safe destrFtype destrFname ("void " ++ destrFname ++ "(" ++ c_arr_type_name ++ "* ptr) { delete ptr; }") elemCode = Code Safe elemFtype elemFname (c_el_type_name ++ " * " ++ elemFname ++ "(" ++ c_arr_type_name ++ " *ptr, size_t i) {\n" ++ c_arr_type_name ++" v = *ptr;\n" ++ "if (i >= v.size()) \n" ++ " return NULL;\n" ++ "else\n" ++ "return new " ++ c_el_type_name ++ "(v[i]);\n" ++ "}\n") constrCode = Code Safe constrFtype constrFname (c_arr_type_name ++ " * "++ constrFname ++ "()" ++ " { return new " ++ c_arr_type_name ++"(); }") addelemCode = Code Safe addElemFtype addElemFname ("void " ++ addElemFname ++ "(" ++ c_arr_type_name ++ " * vPtr, " ++ c_el_type_name ++ " *ePtr) { vPtr->push_back(*ePtr); }") destrFtype = [t| Ptr $(conT c'arrTypeName) -> IO () |] elemFtype = [t| Ptr $(conT c'arrTypeName) -> C.CSize -> IO (Ptr $(conT c'elTypeName)) |] constrFtype = [t| IO (Ptr $(conT c'arrTypeName)) |] addElemFtype = [t| Ptr $(conT c'arrTypeName) -> Ptr $(conT c'elTypeName) -> IO ()|] [d| instance Inlinable $(appT (conT arrTypeName) $ conT elTypeName) where type (CType $(appT (conT arrTypeName) $ conT elTypeName)) = $(conT c'arrTypeName) instance FromPtr $(appT (conT arrTypeName) $ conT elTypeName) where fromPtr = objFromPtr $(conE arrConstrName) $(inlineCode destrCode) instance WithPtr $(appT (conT arrTypeName) $ conT elTypeName) where withPtr $(conP arrConstrName [varP fptr]) = withForeignPtr $(varE fptr) instance ArrayLike $(appT (conT arrTypeName) $ conT elTypeName) where type ElemType $(appT (conT arrTypeName) $ conT elTypeName) = $(conT elTypeName) getElem v i = withPtr v $ \vPtr -> do ptr <- $(inlineCode elemCode) vPtr i if ptr == nullPtr then return Nothing else Just <$> fromPtr (pure ptr) instance VectorLike $(appT (conT arrTypeName) $ conT elTypeName) where newVector = fromPtr $(inlineCode constrCode) addElem v e = withPtr v $ \vPtr -> withPtr e $ \ePtr -> $(inlineCode addelemCode) vPtr ePtr |] -- From c-inline
3,412
true
true
0
25
1,193
640
335
305
null
null
holzensp/ghc
compiler/cmm/CmmMachOp.hs
bsd-3-clause
mo_wordNe dflags = MO_Ne (wordWidth dflags)
50
mo_wordNe dflags = MO_Ne (wordWidth dflags)
50
mo_wordNe dflags = MO_Ne (wordWidth dflags)
50
false
false
1
7
12
21
8
13
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 7517179 = 2648
34
getValueFromProduct 7517179 = 2648
34
getValueFromProduct 7517179 = 2648
34
false
false
0
5
3
9
4
5
null
null
maxsnew/TAPL
SimplyTyped/Lambda/Implementation/Interpreter.hs
bsd-3-clause
evals :: Term -> [Term] evals = map fromJust . takeWhile isJust . iterate (eval1 =<<) . Just
92
evals :: Term -> [Term] evals = map fromJust . takeWhile isJust . iterate (eval1 =<<) . Just
92
evals = map fromJust . takeWhile isJust . iterate (eval1 =<<) . Just
68
false
true
1
8
17
51
23
28
null
null
jamshidh/webdavServer
src/Network/WebDav/Server.hs
bsd-3-clause
doMove urlPath (Just destination) = liftIO $ do fromPath <- getSafePath urlPath toPath <- getSafePath2 destination renamePath fromPath toPath
147
doMove urlPath (Just destination) = liftIO $ do fromPath <- getSafePath urlPath toPath <- getSafePath2 destination renamePath fromPath toPath
147
doMove urlPath (Just destination) = liftIO $ do fromPath <- getSafePath urlPath toPath <- getSafePath2 destination renamePath fromPath toPath
147
false
false
0
9
24
49
21
28
null
null
overminder/punch-forward
src/Network/Punch/Peer/Reliable/Types.hs
bsd-3-clause
foldFlags :: Enum a => [a] -> Int foldFlags = foldr (flip setFlag) 0
68
foldFlags :: Enum a => [a] -> Int foldFlags = foldr (flip setFlag) 0
68
foldFlags = foldr (flip setFlag) 0
34
false
true
0
7
13
36
18
18
null
null
hsavit1/structures
src/Data/Vector/Map/Ephemeral.hs
bsd-2-clause
-- | /O(log^2 N)/ persistently amortized, /O(N)/ worst case. Lookup an element. lookup :: (Ord k, Arrayed k, Arrayed v) => k -> Map k v -> Maybe v lookup !k m0 = go m0 where {-# INLINE go #-} go Nil = Nothing go (One i a m) | k == i = Just a | otherwise = go m go (Map n ks vs m) | j <- search (\i -> ks G.! i >= k) 0 (n-1) , ks G.! j == k = Just $ vs G.! j | otherwise = go m
408
lookup :: (Ord k, Arrayed k, Arrayed v) => k -> Map k v -> Maybe v lookup !k m0 = go m0 where {-# INLINE go #-} go Nil = Nothing go (One i a m) | k == i = Just a | otherwise = go m go (Map n ks vs m) | j <- search (\i -> ks G.! i >= k) 0 (n-1) , ks G.! j == k = Just $ vs G.! j | otherwise = go m
328
lookup !k m0 = go m0 where {-# INLINE go #-} go Nil = Nothing go (One i a m) | k == i = Just a | otherwise = go m go (Map n ks vs m) | j <- search (\i -> ks G.! i >= k) 0 (n-1) , ks G.! j == k = Just $ vs G.! j | otherwise = go m
261
true
true
0
15
128
210
101
109
null
null
nushio3/ghc
compiler/utils/Outputable.hs
bsd-3-clause
-- a bit frightening, but there you are plural _ = char 's'
61
plural _ = char 's'
21
plural _ = char 's'
21
true
false
0
5
14
14
6
8
null
null
bitemyapp/hdph-rs
src/Control/Parallel/HdpH/Strategies.hs
bsd-3-clause
----------------------------------------------------------------------------- -- Basic sequential strategies (polymorphic); -- these are exactly as in the "Seq no more" paper. -- | /Do Nothing/ strategy. r0 :: Strategy a r0 = return
233
r0 :: Strategy a r0 = return
28
r0 = return
11
true
true
1
5
29
22
11
11
null
null
dnaq/crypto-sodium
src/Crypto/Sodium/SecureMem.hs
mit
length :: SecureMem -> Int length (SecureMem _ i) = i
53
length :: SecureMem -> Int length (SecureMem _ i) = i
53
length (SecureMem _ i) = i
26
false
true
0
6
10
30
14
16
null
null
NerdGGuy/wai-middleware-cookie
test/Cookie.hs
isc
prop_noCookies = Nothing == cookies noCookie
45
prop_noCookies = Nothing == cookies noCookie
45
prop_noCookies = Nothing == cookies noCookie
45
false
false
0
6
6
13
6
7
null
null
AndrewRademacher/stack
src/Stack/Build/Execute.hs
bsd-3-clause
toActions :: M env m => InstalledMap -> (m () -> IO ()) -> ExecuteEnv -> (Maybe Task, Maybe Task) -- build and final -> [Action] toActions installedMap runInBase ee (mbuild, mfinal) = abuild ++ afinal where abuild = case mbuild of Nothing -> [] Just task@Task {..} -> [ Action { actionId = ActionId taskProvides ATBuild , actionDeps = (Set.map (\ident -> ActionId ident ATBuild) (tcoMissing taskConfigOpts)) , actionDo = \ac -> runInBase $ singleBuild runInBase ac ee task installedMap False } ] afinal = case mfinal of Nothing -> [] Just task@Task {..} -> (if taskAllInOne then [] else [Action { actionId = ActionId taskProvides ATBuildFinal , actionDeps = addBuild ATBuild (Set.map (\ident -> ActionId ident ATBuild) (tcoMissing taskConfigOpts)) , actionDo = \ac -> runInBase $ singleBuild runInBase ac ee task installedMap True }]) ++ [ Action { actionId = ActionId taskProvides ATFinal , actionDeps = addBuild (if taskAllInOne then ATBuild else ATBuildFinal) Set.empty , actionDo = \ac -> runInBase $ do let comps = taskComponents task tests = testComponents comps benches = benchComponents comps unless (Set.null tests) $ do singleTest runInBase topts (Set.toList tests) ac ee task installedMap unless (Set.null benches) $ do singleBench runInBase beopts (Set.toList benches) ac ee task installedMap } ] where addBuild aty = case mbuild of Nothing -> id Just _ -> Set.insert $ ActionId taskProvides aty bopts = eeBuildOpts ee topts = boptsTestOpts bopts beopts = boptsBenchmarkOpts bopts -- | Generate the ConfigCache
2,353
toActions :: M env m => InstalledMap -> (m () -> IO ()) -> ExecuteEnv -> (Maybe Task, Maybe Task) -- build and final -> [Action] toActions installedMap runInBase ee (mbuild, mfinal) = abuild ++ afinal where abuild = case mbuild of Nothing -> [] Just task@Task {..} -> [ Action { actionId = ActionId taskProvides ATBuild , actionDeps = (Set.map (\ident -> ActionId ident ATBuild) (tcoMissing taskConfigOpts)) , actionDo = \ac -> runInBase $ singleBuild runInBase ac ee task installedMap False } ] afinal = case mfinal of Nothing -> [] Just task@Task {..} -> (if taskAllInOne then [] else [Action { actionId = ActionId taskProvides ATBuildFinal , actionDeps = addBuild ATBuild (Set.map (\ident -> ActionId ident ATBuild) (tcoMissing taskConfigOpts)) , actionDo = \ac -> runInBase $ singleBuild runInBase ac ee task installedMap True }]) ++ [ Action { actionId = ActionId taskProvides ATFinal , actionDeps = addBuild (if taskAllInOne then ATBuild else ATBuildFinal) Set.empty , actionDo = \ac -> runInBase $ do let comps = taskComponents task tests = testComponents comps benches = benchComponents comps unless (Set.null tests) $ do singleTest runInBase topts (Set.toList tests) ac ee task installedMap unless (Set.null benches) $ do singleBench runInBase beopts (Set.toList benches) ac ee task installedMap } ] where addBuild aty = case mbuild of Nothing -> id Just _ -> Set.insert $ ActionId taskProvides aty bopts = eeBuildOpts ee topts = boptsTestOpts bopts beopts = boptsBenchmarkOpts bopts -- | Generate the ConfigCache
2,353
toActions installedMap runInBase ee (mbuild, mfinal) = abuild ++ afinal where abuild = case mbuild of Nothing -> [] Just task@Task {..} -> [ Action { actionId = ActionId taskProvides ATBuild , actionDeps = (Set.map (\ident -> ActionId ident ATBuild) (tcoMissing taskConfigOpts)) , actionDo = \ac -> runInBase $ singleBuild runInBase ac ee task installedMap False } ] afinal = case mfinal of Nothing -> [] Just task@Task {..} -> (if taskAllInOne then [] else [Action { actionId = ActionId taskProvides ATBuildFinal , actionDeps = addBuild ATBuild (Set.map (\ident -> ActionId ident ATBuild) (tcoMissing taskConfigOpts)) , actionDo = \ac -> runInBase $ singleBuild runInBase ac ee task installedMap True }]) ++ [ Action { actionId = ActionId taskProvides ATFinal , actionDeps = addBuild (if taskAllInOne then ATBuild else ATBuildFinal) Set.empty , actionDo = \ac -> runInBase $ do let comps = taskComponents task tests = testComponents comps benches = benchComponents comps unless (Set.null tests) $ do singleTest runInBase topts (Set.toList tests) ac ee task installedMap unless (Set.null benches) $ do singleBench runInBase beopts (Set.toList benches) ac ee task installedMap } ] where addBuild aty = case mbuild of Nothing -> id Just _ -> Set.insert $ ActionId taskProvides aty bopts = eeBuildOpts ee topts = boptsTestOpts bopts beopts = boptsBenchmarkOpts bopts -- | Generate the ConfigCache
2,174
false
true
0
22
1,072
577
297
280
null
null
runjak/projectEuler
src/Problem47.hs
mit
isPrime :: N -> Bool isPrime x | x <= 1 = False | otherwise = notElem 0 . fmap (mod x) $ takeWhile (<= root x) primes
121
isPrime :: N -> Bool isPrime x | x <= 1 = False | otherwise = notElem 0 . fmap (mod x) $ takeWhile (<= root x) primes
121
isPrime x | x <= 1 = False | otherwise = notElem 0 . fmap (mod x) $ takeWhile (<= root x) primes
100
false
true
1
9
31
67
32
35
null
null
DavidAlphaFox/ghc
libraries/Cabal/Cabal/Distribution/Simple/Register.hs
bsd-3-clause
initPackageDB :: Verbosity -> Compiler -> ProgramConfiguration -> FilePath -> IO () initPackageDB verbosity comp conf dbPath = case compilerFlavor comp of HaskellSuite {} -> HaskellSuite.initPackageDB verbosity conf dbPath _ -> withHcPkg "Distribution.Simple.Register.initPackageDB: \ \not implemented for this compiler" comp conf (\hpi -> HcPkg.init hpi verbosity dbPath) -- | Run @hc-pkg@ using a given package DB stack, directly forwarding the -- provided command-line arguments to it.
596
initPackageDB :: Verbosity -> Compiler -> ProgramConfiguration -> FilePath -> IO () initPackageDB verbosity comp conf dbPath = case compilerFlavor comp of HaskellSuite {} -> HaskellSuite.initPackageDB verbosity conf dbPath _ -> withHcPkg "Distribution.Simple.Register.initPackageDB: \ \not implemented for this compiler" comp conf (\hpi -> HcPkg.init hpi verbosity dbPath) -- | Run @hc-pkg@ using a given package DB stack, directly forwarding the -- provided command-line arguments to it.
596
initPackageDB verbosity comp conf dbPath = case compilerFlavor comp of HaskellSuite {} -> HaskellSuite.initPackageDB verbosity conf dbPath _ -> withHcPkg "Distribution.Simple.Register.initPackageDB: \ \not implemented for this compiler" comp conf (\hpi -> HcPkg.init hpi verbosity dbPath) -- | Run @hc-pkg@ using a given package DB stack, directly forwarding the -- provided command-line arguments to it.
495
false
true
0
12
173
105
51
54
null
null
nushio3/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
ppr_expr (HsTickPragma _ externalSrcLoc _ exp) = pprTicks (ppr exp) $ hcat [text "tickpragma<", pprExternalSrcLoc externalSrcLoc, text ">(", ppr exp, text ")"]
205
ppr_expr (HsTickPragma _ externalSrcLoc _ exp) = pprTicks (ppr exp) $ hcat [text "tickpragma<", pprExternalSrcLoc externalSrcLoc, text ">(", ppr exp, text ")"]
205
ppr_expr (HsTickPragma _ externalSrcLoc _ exp) = pprTicks (ppr exp) $ hcat [text "tickpragma<", pprExternalSrcLoc externalSrcLoc, text ">(", ppr exp, text ")"]
205
false
false
0
8
67
67
32
35
null
null
juhp/stack
src/Stack/Types/Config.hs
bsd-3-clause
configMonoidCompilerCheckName :: Text configMonoidCompilerCheckName = "compiler-check"
86
configMonoidCompilerCheckName :: Text configMonoidCompilerCheckName = "compiler-check"
86
configMonoidCompilerCheckName = "compiler-check"
48
false
true
0
4
5
11
6
5
null
null
ytsunetsune/dotfiles
xmonad.hs
mit
myBorderWidth = 2
17
myBorderWidth = 2
17
myBorderWidth = 2
17
false
false
0
4
2
6
3
3
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/Node.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/Node.textContent Mozilla Node.textContent documentation> getTextContent :: (MonadDOM m, IsNode self, FromJSString result) => self -> m (Maybe result) getTextContent self = liftDOM (((toNode self) ^. js "textContent") >>= fromMaybeJSString)
335
getTextContent :: (MonadDOM m, IsNode self, FromJSString result) => self -> m (Maybe result) getTextContent self = liftDOM (((toNode self) ^. js "textContent") >>= fromMaybeJSString)
222
getTextContent self = liftDOM (((toNode self) ^. js "textContent") >>= fromMaybeJSString)
97
true
true
0
10
71
75
38
37
null
null
isido/functional-morphology-for-koine-greek
lib/Util.hs
gpl-3.0
sort_length l = sortBy f where check xs = or [Set.member s l | s <- xs] f x y = case (length x, length y) of (n1,n2) | check x && not (check y) -> LT | not (check x) && check y -> GT | n1 < n2 -> LT | n1 > n2 -> GT _ -> EQ
357
sort_length l = sortBy f where check xs = or [Set.member s l | s <- xs] f x y = case (length x, length y) of (n1,n2) | check x && not (check y) -> LT | not (check x) && check y -> GT | n1 < n2 -> LT | n1 > n2 -> GT _ -> EQ
357
sort_length l = sortBy f where check xs = or [Set.member s l | s <- xs] f x y = case (length x, length y) of (n1,n2) | check x && not (check y) -> LT | not (check x) && check y -> GT | n1 < n2 -> LT | n1 > n2 -> GT _ -> EQ
357
false
false
3
14
195
172
75
97
null
null
hguenther/smtlib2
extras/composite/Language/SMTLib2/Composite/Domains.hs
gpl-3.0
asFiniteRange :: Range tp -> Maybe [Value tp] asFiniteRange (BoolRange f t) = Just $ (if f then [BoolValue False] else [])++ (if t then [BoolValue True] else [])
167
asFiniteRange :: Range tp -> Maybe [Value tp] asFiniteRange (BoolRange f t) = Just $ (if f then [BoolValue False] else [])++ (if t then [BoolValue True] else [])
167
asFiniteRange (BoolRange f t) = Just $ (if f then [BoolValue False] else [])++ (if t then [BoolValue True] else [])
121
false
true
2
10
34
90
45
45
null
null
music-suite/music-score
src/Music/Score/Internal/Export.hs
bsd-3-clause
-- TODO remove prime from name -- | Basic spelling for integral types. spellPitch :: Integral a => a -> (a, a, a) spellPitch p = ( pitchClass, alteration, octave ) where octave = (p `div` 12) - 1 semitone = p `mod` 12 pitchClass = fromStep major semitone alteration = semitone - step major pitchClass step xs p = xs !! (fromIntegral p `mod` length xs) fromStep xs p = fromIntegral $ fromMaybe (length xs - 1) $ List.findIndex (>= p) xs scaleFromSteps = snd . List.mapAccumL add 0 where add a x = (a + x, a + x) major = scaleFromSteps [0,2,2,1,2,2,2,1]
671
spellPitch :: Integral a => a -> (a, a, a) spellPitch p = ( pitchClass, alteration, octave ) where octave = (p `div` 12) - 1 semitone = p `mod` 12 pitchClass = fromStep major semitone alteration = semitone - step major pitchClass step xs p = xs !! (fromIntegral p `mod` length xs) fromStep xs p = fromIntegral $ fromMaybe (length xs - 1) $ List.findIndex (>= p) xs scaleFromSteps = snd . List.mapAccumL add 0 where add a x = (a + x, a + x) major = scaleFromSteps [0,2,2,1,2,2,2,1]
599
spellPitch p = ( pitchClass, alteration, octave ) where octave = (p `div` 12) - 1 semitone = p `mod` 12 pitchClass = fromStep major semitone alteration = semitone - step major pitchClass step xs p = xs !! (fromIntegral p `mod` length xs) fromStep xs p = fromIntegral $ fromMaybe (length xs - 1) $ List.findIndex (>= p) xs scaleFromSteps = snd . List.mapAccumL add 0 where add a x = (a + x, a + x) major = scaleFromSteps [0,2,2,1,2,2,2,1]
556
true
true
0
12
224
245
135
110
null
null
bergmark/hlint
data/Default.hs
bsd-3-clause
warn = flip (catchJust p) ==> handleJust p
42
warn = flip (catchJust p) ==> handleJust p
42
warn = flip (catchJust p) ==> handleJust p
42
false
false
0
8
7
22
10
12
null
null
AndrasKovacs/trie-vector
Data/TrieVector/Array.hs
mit
index :: Array a -> Int# -> a index arr i = case A.index arr i of (# a #) -> a
84
index :: Array a -> Int# -> a index arr i = case A.index arr i of (# a #) -> a
84
index arr i = case A.index arr i of (# a #) -> a
54
false
true
0
8
27
46
22
24
null
null
gleachkr/Carnap
Carnap/src/Carnap/Languages/PurePropositional/Logic/Carnap.hs
gpl-3.0
propCalc = mkNDCalc { ndRenderer = MontagueStyle , ndParseProof = parsePropLogicProof , ndProcessLine = processLineMontague , ndProcessLineMemo = Nothing }
176
propCalc = mkNDCalc { ndRenderer = MontagueStyle , ndParseProof = parsePropLogicProof , ndProcessLine = processLineMontague , ndProcessLineMemo = Nothing }
176
propCalc = mkNDCalc { ndRenderer = MontagueStyle , ndParseProof = parsePropLogicProof , ndProcessLine = processLineMontague , ndProcessLineMemo = Nothing }
176
false
false
1
7
40
39
21
18
null
null
mitchellwrosen/json-validation
src/internal/Data/Aeson/Validation/Internal/Schema.hs
bsd-3-clause
validateNotTuple :: (Applicative m, MonadReader Context m) => [Schema] -> Value -> m (Seq Text) validateNotTuple ss val = do errs <- validateTuple ss val if null errs then err "passed tuple schema" else pure mempty
230
validateNotTuple :: (Applicative m, MonadReader Context m) => [Schema] -> Value -> m (Seq Text) validateNotTuple ss val = do errs <- validateTuple ss val if null errs then err "passed tuple schema" else pure mempty
230
validateNotTuple ss val = do errs <- validateTuple ss val if null errs then err "passed tuple schema" else pure mempty
130
false
true
0
11
51
90
42
48
null
null
osa1/sequent-core
src/Language/SequentCore/Syntax.hs
bsd-3-clause
commandOkForSideEffects = commOk primOpOkForSideEffects
55
commandOkForSideEffects = commOk primOpOkForSideEffects
55
commandOkForSideEffects = commOk primOpOkForSideEffects
55
false
false
1
5
3
12
4
8
null
null
ggkitsas/HaLVM
src/HALVMCore/Hypervisor/Control.hs
bsd-3-clause
unpauseDomain :: DomId -> IO () unpauseDomain dom = domainControlOp DomCtlUnpauseDomain (fromDomId dom) (\ _ -> return ()) (\ _ _ _ -> return ())
155
unpauseDomain :: DomId -> IO () unpauseDomain dom = domainControlOp DomCtlUnpauseDomain (fromDomId dom) (\ _ -> return ()) (\ _ _ _ -> return ())
155
unpauseDomain dom = domainControlOp DomCtlUnpauseDomain (fromDomId dom) (\ _ -> return ()) (\ _ _ _ -> return ())
123
false
true
0
8
34
70
34
36
null
null
Kyly/liquidhaskell
src/Language/Haskell/Liquid/CmdLine.hs
bsd-3-clause
fixCabalDirs' :: Config -> Info -> Config fixCabalDirs' cfg i = cfg { idirs = nub $ idirs cfg ++ sourceDirs i ++ buildDirs i } { ghcOptions = ghcOptions cfg ++ dbOpts ++ pkOpts ++ ["-optP-include", "-optP" ++ macroPath i]} where dbOpts = ["-package-db " ++ db | db <- packageDbs i] pkOpts = ["-package " ++ n | n <- packageDeps i] -- SPEED HIT for smaller benchmarks --------------------------------------------------------------------------------------- -- | Monoid instances for updating options ---------------------------------------------------------------------------------------
692
fixCabalDirs' :: Config -> Info -> Config fixCabalDirs' cfg i = cfg { idirs = nub $ idirs cfg ++ sourceDirs i ++ buildDirs i } { ghcOptions = ghcOptions cfg ++ dbOpts ++ pkOpts ++ ["-optP-include", "-optP" ++ macroPath i]} where dbOpts = ["-package-db " ++ db | db <- packageDbs i] pkOpts = ["-package " ++ n | n <- packageDeps i] -- SPEED HIT for smaller benchmarks --------------------------------------------------------------------------------------- -- | Monoid instances for updating options ---------------------------------------------------------------------------------------
692
fixCabalDirs' cfg i = cfg { idirs = nub $ idirs cfg ++ sourceDirs i ++ buildDirs i } { ghcOptions = ghcOptions cfg ++ dbOpts ++ pkOpts ++ ["-optP-include", "-optP" ++ macroPath i]} where dbOpts = ["-package-db " ++ db | db <- packageDbs i] pkOpts = ["-package " ++ n | n <- packageDeps i] -- SPEED HIT for smaller benchmarks --------------------------------------------------------------------------------------- -- | Monoid instances for updating options ---------------------------------------------------------------------------------------
650
false
true
0
11
185
142
74
68
null
null
josuf107/Slash
Test.hs
gpl-3.0
testPutStrings :: Test testPutStrings = labeled "put strings" $ "string" @=? visibleContent (putString "ing" . putString "str" $ fakeSlash)
143
testPutStrings :: Test testPutStrings = labeled "put strings" $ "string" @=? visibleContent (putString "ing" . putString "str" $ fakeSlash)
143
testPutStrings = labeled "put strings" $ "string" @=? visibleContent (putString "ing" . putString "str" $ fakeSlash)
120
false
true
2
9
22
52
23
29
null
null
Teaspot-Studio/Urho3D-Haskell
src/Graphics/Urho3D/Input/Internal/Input.hs
mit
fromSDLJoystick :: SDL.Joystick -> Ptr SDL_Joystick fromSDLJoystick = castPtr
77
fromSDLJoystick :: SDL.Joystick -> Ptr SDL_Joystick fromSDLJoystick = castPtr
77
fromSDLJoystick = castPtr
25
false
true
0
7
8
26
11
15
null
null
FeodorM/some_code
haskell/stuff_from_stepic/some_monads.hs
mit
purchase :: String -> Integer -> Shopping purchase str int = tell (Sum int, [str])
82
purchase :: String -> Integer -> Shopping purchase str int = tell (Sum int, [str])
82
purchase str int = tell (Sum int, [str])
40
false
true
0
7
14
43
21
22
null
null
rcallahan/thermonuc
ThermoNuc/Dat.hs
bsd-3-clause
dgd_tstacki :: Ptr Double dgd_tstacki = $(embedDoubleArray "dat/tstacki.DGD")
77
dgd_tstacki :: Ptr Double dgd_tstacki = $(embedDoubleArray "dat/tstacki.DGD")
77
dgd_tstacki = $(embedDoubleArray "dat/tstacki.DGD")
51
false
true
0
8
7
27
11
16
null
null
Alaya-in-Matrix/Anjelica
src/Language/BrainFuck.hs
mit
eval :: MoveList -> BrainFuck -> IO MoveList eval env RightMove = return $ next env
90
eval :: MoveList -> BrainFuck -> IO MoveList eval env RightMove = return $ next env
89
eval env RightMove = return $ next env
43
false
true
0
7
22
34
16
18
null
null
beni55/hscurses
UI/HSCurses/Widgets.hs
lgpl-2.1
isActive :: TableCell -> Bool isActive (TableCell _) = False
60
isActive :: TableCell -> Bool isActive (TableCell _) = False
60
isActive (TableCell _) = False
30
false
true
0
7
9
24
12
12
null
null
crufter/haquery
src/Haquery.hs
bsd-3-clause
innerText (Text _ text) = text
30
innerText (Text _ text) = text
30
innerText (Text _ text) = text
30
false
false
0
6
5
18
8
10
null
null
JohnLato/dlist-test
Dlist-test.hs
unlicense
baselineList :: [a] -> Int baselineList = length
48
baselineList :: [a] -> Int baselineList = length
48
baselineList = length
21
false
true
0
6
7
18
10
8
null
null
ulan/hisp
level1/Hisp1.hs
unlicense
quote env [expr] = return (quoteEval expr)
42
quote env [expr] = return (quoteEval expr)
42
quote env [expr] = return (quoteEval expr)
42
false
false
0
7
6
25
11
14
null
null
chrisdone/make-package
src/Github.hs
bsd-3-clause
-- | Check whether a repository with the given name exists on the users github -- accoutn and suggest cloning it maybeClone :: T.Text -> T.Text -> MakePackage () maybeClone repo dir = unlessConf "github.enable" (== False) $ unlessConf "github.never-clone" (== True) $ do uname <- confOrPrompt "github.username" "Github Username" "" liftIO $ putStrLn "Checking github for preexisting repos" timeoutDelay <- toSeconds <$> confLookup "github.timeout" mbRepoUrl <- liftIO . timeout timeoutDelay $ getRepo uname case mbRepoUrl of Nothing -> return () Just (Left _) -> return () Just (Right rUrl) -> do cloneP <- promptYesNo "clone" "A repository with this name already exists\ \in your github account. Clone it instead?" when cloneP $ do run "git" ["clone", rUrl, T.unpack dir] liftIO exitSuccess where toSeconds Nothing = 5 * 10^(6::Int) toSeconds (Just t) = t * 10^(6::Int) getRepo uname = fmap repoSshUrl <$> userRepo (T.unpack uname) (T.unpack repo) -- | Create a github repository in the users account and set it as origin if -- permitted by configuration
1,269
maybeClone :: T.Text -> T.Text -> MakePackage () maybeClone repo dir = unlessConf "github.enable" (== False) $ unlessConf "github.never-clone" (== True) $ do uname <- confOrPrompt "github.username" "Github Username" "" liftIO $ putStrLn "Checking github for preexisting repos" timeoutDelay <- toSeconds <$> confLookup "github.timeout" mbRepoUrl <- liftIO . timeout timeoutDelay $ getRepo uname case mbRepoUrl of Nothing -> return () Just (Left _) -> return () Just (Right rUrl) -> do cloneP <- promptYesNo "clone" "A repository with this name already exists\ \in your github account. Clone it instead?" when cloneP $ do run "git" ["clone", rUrl, T.unpack dir] liftIO exitSuccess where toSeconds Nothing = 5 * 10^(6::Int) toSeconds (Just t) = t * 10^(6::Int) getRepo uname = fmap repoSshUrl <$> userRepo (T.unpack uname) (T.unpack repo) -- | Create a github repository in the users account and set it as origin if -- permitted by configuration
1,156
maybeClone repo dir = unlessConf "github.enable" (== False) $ unlessConf "github.never-clone" (== True) $ do uname <- confOrPrompt "github.username" "Github Username" "" liftIO $ putStrLn "Checking github for preexisting repos" timeoutDelay <- toSeconds <$> confLookup "github.timeout" mbRepoUrl <- liftIO . timeout timeoutDelay $ getRepo uname case mbRepoUrl of Nothing -> return () Just (Left _) -> return () Just (Right rUrl) -> do cloneP <- promptYesNo "clone" "A repository with this name already exists\ \in your github account. Clone it instead?" when cloneP $ do run "git" ["clone", rUrl, T.unpack dir] liftIO exitSuccess where toSeconds Nothing = 5 * 10^(6::Int) toSeconds (Just t) = t * 10^(6::Int) getRepo uname = fmap repoSshUrl <$> userRepo (T.unpack uname) (T.unpack repo) -- | Create a github repository in the users account and set it as origin if -- permitted by configuration
1,107
true
true
2
19
380
314
150
164
null
null
FranklinChen/Haskell-Pipes-Library
src/Pipes/Prelude.hs
bsd-3-clause
{-| @(take n)@ only allows @n@ values to pass through > take 0 = return () > > take (m + n) = take m >> take n > take <infinity> = cat > > take (min m n) = take m >-> take n -} take :: Monad m => Int -> Pipe a a m () take n = replicateM_ n $ do a <- await yield a
274
take :: Monad m => Int -> Pipe a a m () take n = replicateM_ n $ do a <- await yield a
95
take n = replicateM_ n $ do a <- await yield a
55
true
true
2
9
80
62
27
35
null
null
roberth/uu-helium
test/typeerrors/Examples/TypeBug2.hs
gpl-3.0
f :: a -> [a] -> [a] f sep (x:xs) = x:sep++f xs
47
f :: a -> [a] -> [a] f sep (x:xs) = x:sep++f xs
47
f sep (x:xs) = x:sep++f xs
26
false
true
0
7
12
52
26
26
null
null
allanderek/ipclib
Language/Pepa/Probes/Syntax.hs
gpl-2.0
endsInReplicatorProbe (SPzom _ ) = True
43
endsInReplicatorProbe (SPzom _ ) = True
43
endsInReplicatorProbe (SPzom _ ) = True
43
false
false
0
6
9
16
7
9
null
null
brendanhay/gogol
gogol-genomics/gen/Network/Google/Genomics/Types/Product.hs
mpl-2.0
-- | Creates a value of 'DelayedEvent' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'deMetrics' -- -- * 'deCause' delayedEvent :: DelayedEvent delayedEvent = DelayedEvent' {_deMetrics = Nothing, _deCause = Nothing}
306
delayedEvent :: DelayedEvent delayedEvent = DelayedEvent' {_deMetrics = Nothing, _deCause = Nothing}
104
delayedEvent = DelayedEvent' {_deMetrics = Nothing, _deCause = Nothing}
71
true
true
1
7
53
36
22
14
null
null
slpopejoy/fadno-xml
src/Fadno/MusicXml/MusicXml20.hs
bsd-2-clause
-- | Smart constructor for 'TupletPortion' mkTupletPortion :: TupletPortion mkTupletPortion = TupletPortion Nothing Nothing []
126
mkTupletPortion :: TupletPortion mkTupletPortion = TupletPortion Nothing Nothing []
83
mkTupletPortion = TupletPortion Nothing Nothing []
50
true
true
0
6
14
27
12
15
null
null
GaloisInc/cryfsm
numfsm.hs
bsd-3-clause
main :: IO () main = do opts <- Opt.execParser optionsInfo >>= loadTarget case rebase opts of Left missing -> die $ "The following positions were found in the target but not in the source:\n" ++ unlines (map unpack missing) Right (warning, result) -> do traverse_ (hPutStrLn stderr . showWarning) warning LBS.putStr (encode result)
369
main :: IO () main = do opts <- Opt.execParser optionsInfo >>= loadTarget case rebase opts of Left missing -> die $ "The following positions were found in the target but not in the source:\n" ++ unlines (map unpack missing) Right (warning, result) -> do traverse_ (hPutStrLn stderr . showWarning) warning LBS.putStr (encode result)
369
main = do opts <- Opt.execParser optionsInfo >>= loadTarget case rebase opts of Left missing -> die $ "The following positions were found in the target but not in the source:\n" ++ unlines (map unpack missing) Right (warning, result) -> do traverse_ (hPutStrLn stderr . showWarning) warning LBS.putStr (encode result)
355
false
true
0
15
91
117
54
63
null
null
ddssff/lens
src/Control/Lens/Tuple.hs
bsd-3-clause
proxyN9 :: Proxy N9 proxyN9 = Proxy
35
proxyN9 :: Proxy N9 proxyN9 = Proxy
35
proxyN9 = Proxy
15
false
true
0
6
6
20
8
12
null
null
rueshyna/gogol
gogol-shopping-content/gen/Network/Google/Resource/Content/Products/Get.hs
mpl-2.0
-- | The ID of the managing account. pggMerchantId :: Lens' ProductsGet Word64 pggMerchantId = lens _pggMerchantId (\ s a -> s{_pggMerchantId = a}) . _Coerce
171
pggMerchantId :: Lens' ProductsGet Word64 pggMerchantId = lens _pggMerchantId (\ s a -> s{_pggMerchantId = a}) . _Coerce
134
pggMerchantId = lens _pggMerchantId (\ s a -> s{_pggMerchantId = a}) . _Coerce
92
true
true
0
10
39
46
24
22
null
null
treeowl/bound
examples/Deriving.hs
bsd-3-clause
-- | smart let constructor let_ :: Eq a => [(a, Exp a)] -> Exp a -> Exp a let_ bs b = Let (length bs) (map (abstr . snd) bs) (abstr b) where vs = map fst bs abstr = abstract (`elemIndex` vs) -- | smart alt constructor -- -- >>> lam (varp "x") $ Case (V "x") [alt (conp "Hello" [varp "z",wildp]) (V "x"), alt (varp "y") (V "y")] -- Lam 1 VarP (Scope (Case (V (B 0)) [Alt 1 (ConP "Hello" [VarP,WildP]) (Scope (V (F (V (B 0))))),Alt 1 VarP (Scope (V (B 0)))]))
469
let_ :: Eq a => [(a, Exp a)] -> Exp a -> Exp a let_ bs b = Let (length bs) (map (abstr . snd) bs) (abstr b) where vs = map fst bs abstr = abstract (`elemIndex` vs) -- | smart alt constructor -- -- >>> lam (varp "x") $ Case (V "x") [alt (conp "Hello" [varp "z",wildp]) (V "x"), alt (varp "y") (V "y")] -- Lam 1 VarP (Scope (Case (V (B 0)) [Alt 1 (ConP "Hello" [VarP,WildP]) (Scope (V (F (V (B 0))))),Alt 1 VarP (Scope (V (B 0)))]))
442
let_ bs b = Let (length bs) (map (abstr . snd) bs) (abstr b) where vs = map fst bs abstr = abstract (`elemIndex` vs) -- | smart alt constructor -- -- >>> lam (varp "x") $ Case (V "x") [alt (conp "Hello" [varp "z",wildp]) (V "x"), alt (varp "y") (V "y")] -- Lam 1 VarP (Scope (Case (V (B 0)) [Alt 1 (ConP "Hello" [VarP,WildP]) (Scope (V (F (V (B 0))))),Alt 1 VarP (Scope (V (B 0)))]))
395
true
true
1
9
108
115
61
54
null
null
myfreeweb/http-link-header
test-suite/Network/HTTP/Link/ParserSpec.hs
unlicense
spec ∷ Spec spec = do describe "linkHeader" $ do let l u r = fromJust $ lnk u r it "parses a single link" $ do ("<http://example.com>; rel=\"example\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "example")] ] it "parses empty attributes" $ do ("<http://example.com>; title=\"\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title, "")] ] it "parses custom attributes" $ do ("<http://example.com>; weirdThingy=\"something\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Other "weirdThingy", "something")] ] it "parses backslash escaped attributes" $ do ("<http://example.com>; title=\"some \\\" thing \\\"\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title, "some \" thing \"")] ] it "parses escaped attributes" $ do ("<http://example.com>; title=\"some %22 thing %22\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title, "some \" thing \"")] ] it "parses multiple attributes" $ do ("<http://example.com>; rel=\"example\"; title=\"example dot com\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "example"), (Title, "example dot com")] ] it "parses custom attributes named similarly to standard ones" $ do -- this was caught by QuickCheck! <3 ("<http://example.com>; rel=hello; relAtion=\"something\"; rev=next" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "hello"), (Other "relAtion", "something"), (Rev, "next")] ] it "parses unquoted rel, rev attributes" $ do ("<http://example.com>; rel=next; rev=prev" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "next"), (Rev, "prev")] ] it "does not blow up on title*" $ do ("<http://example.com>; title*=UTF-8'de'n%c3%a4chstes%20Kapitel" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title', "UTF-8'de'n%c3%a4chstes%20Kapitel")] ] it "parses weird whitespace all over the place" $ do ("\n\t < http://example.com\t>;rel=\t\"example\"; \ttitle =\"example dot com\" \n " ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "example"), (Title, "example dot com")] ] where linkHeaderURI = linkHeader :: Parser [Link URI]
2,401
spec ∷ Spec spec = do describe "linkHeader" $ do let l u r = fromJust $ lnk u r it "parses a single link" $ do ("<http://example.com>; rel=\"example\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "example")] ] it "parses empty attributes" $ do ("<http://example.com>; title=\"\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title, "")] ] it "parses custom attributes" $ do ("<http://example.com>; weirdThingy=\"something\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Other "weirdThingy", "something")] ] it "parses backslash escaped attributes" $ do ("<http://example.com>; title=\"some \\\" thing \\\"\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title, "some \" thing \"")] ] it "parses escaped attributes" $ do ("<http://example.com>; title=\"some %22 thing %22\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title, "some \" thing \"")] ] it "parses multiple attributes" $ do ("<http://example.com>; rel=\"example\"; title=\"example dot com\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "example"), (Title, "example dot com")] ] it "parses custom attributes named similarly to standard ones" $ do -- this was caught by QuickCheck! <3 ("<http://example.com>; rel=hello; relAtion=\"something\"; rev=next" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "hello"), (Other "relAtion", "something"), (Rev, "next")] ] it "parses unquoted rel, rev attributes" $ do ("<http://example.com>; rel=next; rev=prev" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "next"), (Rev, "prev")] ] it "does not blow up on title*" $ do ("<http://example.com>; title*=UTF-8'de'n%c3%a4chstes%20Kapitel" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title', "UTF-8'de'n%c3%a4chstes%20Kapitel")] ] it "parses weird whitespace all over the place" $ do ("\n\t < http://example.com\t>;rel=\t\"example\"; \ttitle =\"example dot com\" \n " ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "example"), (Title, "example dot com")] ] where linkHeaderURI = linkHeader :: Parser [Link URI]
2,401
spec = do describe "linkHeader" $ do let l u r = fromJust $ lnk u r it "parses a single link" $ do ("<http://example.com>; rel=\"example\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "example")] ] it "parses empty attributes" $ do ("<http://example.com>; title=\"\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title, "")] ] it "parses custom attributes" $ do ("<http://example.com>; weirdThingy=\"something\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Other "weirdThingy", "something")] ] it "parses backslash escaped attributes" $ do ("<http://example.com>; title=\"some \\\" thing \\\"\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title, "some \" thing \"")] ] it "parses escaped attributes" $ do ("<http://example.com>; title=\"some %22 thing %22\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title, "some \" thing \"")] ] it "parses multiple attributes" $ do ("<http://example.com>; rel=\"example\"; title=\"example dot com\"" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "example"), (Title, "example dot com")] ] it "parses custom attributes named similarly to standard ones" $ do -- this was caught by QuickCheck! <3 ("<http://example.com>; rel=hello; relAtion=\"something\"; rev=next" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "hello"), (Other "relAtion", "something"), (Rev, "next")] ] it "parses unquoted rel, rev attributes" $ do ("<http://example.com>; rel=next; rev=prev" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "next"), (Rev, "prev")] ] it "does not blow up on title*" $ do ("<http://example.com>; title*=UTF-8'de'n%c3%a4chstes%20Kapitel" ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Title', "UTF-8'de'n%c3%a4chstes%20Kapitel")] ] it "parses weird whitespace all over the place" $ do ("\n\t < http://example.com\t>;rel=\t\"example\"; \ttitle =\"example dot com\" \n " ∷ Text) ~> linkHeaderURI `shouldParse` [ l "http://example.com" [(Rel, "example"), (Title, "example dot com")] ] where linkHeaderURI = linkHeader :: Parser [Link URI]
2,389
false
true
0
18
494
582
314
268
null
null
tolysz/hs-tls
core/Network/TLS/Struct.hs
bsd-3-clause
numericalVer SSL3 = (3, 0)
27
numericalVer SSL3 = (3, 0)
27
numericalVer SSL3 = (3, 0)
27
false
false
0
5
5
15
8
7
null
null
nytopop/silver
src/Network/Silver/Blob.hs
bsd-3-clause
fSplit _ _ _ = []
17
fSplit _ _ _ = []
17
fSplit _ _ _ = []
17
false
false
0
5
5
15
7
8
null
null
brendanhay/gogol
gogol-fitness/gen/Network/Google/Resource/Fitness/Users/DataSet/Aggregate.hs
mpl-2.0
-- | V1 error format. udsaXgafv :: Lens' UsersDataSetAggregate (Maybe Xgafv) udsaXgafv = lens _udsaXgafv (\ s a -> s{_udsaXgafv = a})
135
udsaXgafv :: Lens' UsersDataSetAggregate (Maybe Xgafv) udsaXgafv = lens _udsaXgafv (\ s a -> s{_udsaXgafv = a})
113
udsaXgafv = lens _udsaXgafv (\ s a -> s{_udsaXgafv = a})
58
true
true
0
9
23
48
25
23
null
null
kongra/kask-base
src/Kask/Logic/Kleene.hs
bsd-3-clause
and :: Value -> Value -> Value and False _ = False
56
and :: Value -> Value -> Value and False _ = False
56
and False _ = False
25
false
true
0
6
17
29
13
16
null
null
Oblosys/webviews
src/lib/WebViewPrim.hs
mit
jsVar vid name = name++viewIdSuffix vid
39
jsVar vid name = name++viewIdSuffix vid
39
jsVar vid name = name++viewIdSuffix vid
39
false
false
0
6
5
19
8
11
null
null
sdiehl/ghc
testsuite/tests/primops/should_run/CmpInt16.hs
bsd-3-clause
mkT16 :: Int -> TestInt16 mkT16 (I# a) = T16 (narrowInt16# a)
61
mkT16 :: Int -> TestInt16 mkT16 (I# a) = T16 (narrowInt16# a)
61
mkT16 (I# a) = T16 (narrowInt16# a)
35
false
true
0
7
11
33
16
17
null
null
erochest/todotxt
Gtd.hs
apache-2.0
process :: GtdArgs -> TimeInfo -> Text -> Text process cli ti@(tz, _) t = either T.pack id . runIdentity . runEitherT $ generateOutput cli ti =<< transform <$> parse where parse = hoistEither $ parseTodos tz t transform = doPending (pending cli) . doArchive (archive cli)
309
process :: GtdArgs -> TimeInfo -> Text -> Text process cli ti@(tz, _) t = either T.pack id . runIdentity . runEitherT $ generateOutput cli ti =<< transform <$> parse where parse = hoistEither $ parseTodos tz t transform = doPending (pending cli) . doArchive (archive cli)
309
process cli ti@(tz, _) t = either T.pack id . runIdentity . runEitherT $ generateOutput cli ti =<< transform <$> parse where parse = hoistEither $ parseTodos tz t transform = doPending (pending cli) . doArchive (archive cli)
262
false
true
0
11
84
114
57
57
null
null
TomMD/commsec
Network/CommSec/Package.hs
bsd-3-clause
peekBE32 :: Ptr Word8 -> IO Word32 peekBE32 p = do let op n = fromIntegral `fmap` peekElemOff p n as <- mapM op [0..3] return (foldl1' (\r a -> (r `shiftL` 8) .|. a) as)
182
peekBE32 :: Ptr Word8 -> IO Word32 peekBE32 p = do let op n = fromIntegral `fmap` peekElemOff p n as <- mapM op [0..3] return (foldl1' (\r a -> (r `shiftL` 8) .|. a) as)
182
peekBE32 p = do let op n = fromIntegral `fmap` peekElemOff p n as <- mapM op [0..3] return (foldl1' (\r a -> (r `shiftL` 8) .|. a) as)
147
false
true
0
14
48
105
51
54
null
null
green-haskell/ghc
compiler/basicTypes/Var.hs
bsd-3-clause
isTKVar (TcTyVar {}) = True
27
isTKVar (TcTyVar {}) = True
27
isTKVar (TcTyVar {}) = True
27
false
false
0
7
4
16
8
8
null
null
backofhan/HaskellExercises
CH20/src/Lib.hs
bsd-3-clause
--9 fold' :: (Foldable t, Monoid m) => t m -> m fold' = foldMap id
66
fold' :: (Foldable t, Monoid m) => t m -> m fold' = foldMap id
62
fold' = foldMap id
18
true
true
0
8
15
44
20
24
null
null
shayan-najd/HsParser
Language/Haskell/Utility/Bag.hs
gpl-3.0
snocBag :: Bag a -> a -> Bag a consBag elt bag = (unitBag elt) `unionBags` bag
79
snocBag :: Bag a -> a -> Bag a consBag elt bag = (unitBag elt) `unionBags` bag
78
consBag elt bag = (unitBag elt) `unionBags` bag
47
false
true
0
8
17
49
23
26
null
null
urbanslug/ghc
compiler/main/BreakArray.hs
bsd-3-clause
readBreakArray :: BreakArray -> Int -> IO Word readBreakArray (BA array) (I# i) = readBA# array i
97
readBreakArray :: BreakArray -> Int -> IO Word readBreakArray (BA array) (I# i) = readBA# array i
97
readBreakArray (BA array) (I# i) = readBA# array i
50
false
true
0
7
16
44
21
23
null
null
jsavatgy/hatupist
hatupist-103.hs
gpl-2.0
timeUTC date = case (parseTime defaultTimeLocale "%Y-%m-%d %H:%M:%S" date) of Just x -> zonedTimeToUTC x Nothing -> posixSecondsToUTCTime (doubleToPt 0.0)
159
timeUTC date = case (parseTime defaultTimeLocale "%Y-%m-%d %H:%M:%S" date) of Just x -> zonedTimeToUTC x Nothing -> posixSecondsToUTCTime (doubleToPt 0.0)
159
timeUTC date = case (parseTime defaultTimeLocale "%Y-%m-%d %H:%M:%S" date) of Just x -> zonedTimeToUTC x Nothing -> posixSecondsToUTCTime (doubleToPt 0.0)
159
false
false
1
10
24
53
23
30
null
null
GaloisInc/halvm-ghc
compiler/ghci/ByteCodeGen.hs
bsd-3-clause
findPushSeq (P: P: P: P: P: rest) = (PUSH_APPLY_PPPPP, 5, rest)
65
findPushSeq (P: P: P: P: P: rest) = (PUSH_APPLY_PPPPP, 5, rest)
65
findPushSeq (P: P: P: P: P: rest) = (PUSH_APPLY_PPPPP, 5, rest)
65
false
false
0
11
12
41
22
19
null
null
Sahil-yerawar/IRChbot
src/Write.hs
bsd-3-clause
msgPrivate :: String->String->Net () msgPrivate str sender = write "PRIVMSG" (sender ++ " :" ++ str)
100
msgPrivate :: String->String->Net () msgPrivate str sender = write "PRIVMSG" (sender ++ " :" ++ str)
100
msgPrivate str sender = write "PRIVMSG" (sender ++ " :" ++ str)
63
false
true
0
9
15
49
23
26
null
null
pepeiborra/narradar
src/Narradar/Processor/Aprove.hs
bsd-3-clause
proofP = tag "<?xml>" >> ( someTagP "<proof-obligation>" $ someTagP "<proposition>" $ do skipTagNameP "<basic-obligation>" tagP "<proof>" (skipTagNameP "<qdp-reduction-pair-proof>") skipTagNameP "<implication value='equivalent'>" tagP "<proof-obligation>" $ tagP "<proposition>" $ tagP "<basic-obligation>" $ tagP "<qdp-termination-obligation>" $ tagP "<qdp>" $ someTagP "<dps>" $ do dps <- many (do {r<-ruleP;return[r]} <|> do{skipTagP;return[]}) return (concat dps) )
652
proofP = tag "<?xml>" >> ( someTagP "<proof-obligation>" $ someTagP "<proposition>" $ do skipTagNameP "<basic-obligation>" tagP "<proof>" (skipTagNameP "<qdp-reduction-pair-proof>") skipTagNameP "<implication value='equivalent'>" tagP "<proof-obligation>" $ tagP "<proposition>" $ tagP "<basic-obligation>" $ tagP "<qdp-termination-obligation>" $ tagP "<qdp>" $ someTagP "<dps>" $ do dps <- many (do {r<-ruleP;return[r]} <|> do{skipTagP;return[]}) return (concat dps) )
652
proofP = tag "<?xml>" >> ( someTagP "<proof-obligation>" $ someTagP "<proposition>" $ do skipTagNameP "<basic-obligation>" tagP "<proof>" (skipTagNameP "<qdp-reduction-pair-proof>") skipTagNameP "<implication value='equivalent'>" tagP "<proof-obligation>" $ tagP "<proposition>" $ tagP "<basic-obligation>" $ tagP "<qdp-termination-obligation>" $ tagP "<qdp>" $ someTagP "<dps>" $ do dps <- many (do {r<-ruleP;return[r]} <|> do{skipTagP;return[]}) return (concat dps) )
652
false
false
0
20
234
163
73
90
null
null
nfjinjing/moe
src/Text/HTML/Moe2/DSL/HTML.hs
bsd-3-clause
meta = sc "meta"
22
meta = sc "meta"
22
meta = sc "meta"
22
false
false
0
5
9
9
4
5
null
null
rodrigogribeiro/mptc
src/Language/Haskell/Exts/Annotated/Simplify.hs
bsd-3-clause
sXName :: XName l -> S.XName sXName (XName _ str) = S.XName str
63
sXName :: XName l -> S.XName sXName (XName _ str) = S.XName str
63
sXName (XName _ str) = S.XName str
34
false
true
0
7
12
36
17
19
null
null
tomgr/webcspm
src/Text/XML/Plist/PlObject.hs
bsd-3-clause
fromPlDict o = fail $ "not a dictionary: " ++ show o
52
fromPlDict o = fail $ "not a dictionary: " ++ show o
52
fromPlDict o = fail $ "not a dictionary: " ++ show o
52
false
false
0
6
11
20
9
11
null
null
phadej/hpack
src/Hpack/Util.hs
mit
lexicographically :: String -> (String, String) lexicographically x = (map toLower x, x)
88
lexicographically :: String -> (String, String) lexicographically x = (map toLower x, x)
88
lexicographically x = (map toLower x, x)
40
false
true
0
6
12
35
19
16
null
null
danidiaz/free
src/Control/Comonad/Trans/Cofree.hs
bsd-3-clause
cofreeTTyCon = mkTyCon "Control.Comonad.Trans.Cofree.CofreeT"
61
cofreeTTyCon = mkTyCon "Control.Comonad.Trans.Cofree.CofreeT"
61
cofreeTTyCon = mkTyCon "Control.Comonad.Trans.Cofree.CofreeT"
61
false
false
0
5
3
9
4
5
null
null
alexbaluta/courseography
dependencies/HaXml-1.25.3/src/Text/XML/HaXml/XmlContent.hs
gpl-3.0
-- | Convert a fully-typed XML document to a string (without DTD). showXml :: XmlContent a => Bool -> a -> String showXml dtd x = case toContents x of [CElem _ _] -> (render . document . toXml dtd) x _ -> "" -- | Convert a fully-typed XML document to a ByteString (without DTD).
295
showXml :: XmlContent a => Bool -> a -> String showXml dtd x = case toContents x of [CElem _ _] -> (render . document . toXml dtd) x _ -> "" -- | Convert a fully-typed XML document to a ByteString (without DTD).
228
showXml dtd x = case toContents x of [CElem _ _] -> (render . document . toXml dtd) x _ -> "" -- | Convert a fully-typed XML document to a ByteString (without DTD).
181
true
true
0
11
72
83
39
44
null
null
mitsuji/paprika
src/System/Paprika.hs
bsd-3-clause
stop = leftOff >> rightOff
26
stop = leftOff >> rightOff
26
stop = leftOff >> rightOff
26
false
false
0
5
4
10
5
5
null
null
beni55/haste-compiler
libraries/ghc-7.10/base/GHC/IO/Handle.hs
bsd-3-clause
hGetEcho :: Handle -> IO Bool hGetEcho handle = do isT <- hIsTerminalDevice handle if not isT then return False else withHandle_ "hGetEcho" handle $ \ Handle__{..} -> do case haType of ClosedHandle -> ioe_closedHandle _ -> IODevice.getEcho haDevice -- | Is the handle connected to a terminal?
356
hGetEcho :: Handle -> IO Bool hGetEcho handle = do isT <- hIsTerminalDevice handle if not isT then return False else withHandle_ "hGetEcho" handle $ \ Handle__{..} -> do case haType of ClosedHandle -> ioe_closedHandle _ -> IODevice.getEcho haDevice -- | Is the handle connected to a terminal?
356
hGetEcho handle = do isT <- hIsTerminalDevice handle if not isT then return False else withHandle_ "hGetEcho" handle $ \ Handle__{..} -> do case haType of ClosedHandle -> ioe_closedHandle _ -> IODevice.getEcho haDevice -- | Is the handle connected to a terminal?
326
false
true
0
16
111
93
44
49
null
null
vlopezj/genifunctors
Data/Generics/Genifunctors.hs
bsd-3-clause
expandSyn :: Type -> Q Type expandSyn (ForallT tvs ctx t) = liftM (ForallT tvs ctx) $ expandSyn t
98
expandSyn :: Type -> Q Type expandSyn (ForallT tvs ctx t) = liftM (ForallT tvs ctx) $ expandSyn t
98
expandSyn (ForallT tvs ctx t) = liftM (ForallT tvs ctx) $ expandSyn t
69
false
true
0
8
19
49
23
26
null
null
brendanhay/gogol
gogol-healthcare/gen/Network/Google/Resource/Healthcare/Projects/Locations/DataSets/Hl7V2Stores/Messages/List.hs
mpl-2.0
-- | Creates a value of 'ProjectsLocationsDataSetsHl7V2StoresMessagesList' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'pldshvsmlParent' -- -- * 'pldshvsmlXgafv' -- -- * 'pldshvsmlUploadProtocol' -- -- * 'pldshvsmlOrderBy' -- -- * 'pldshvsmlAccessToken' -- -- * 'pldshvsmlUploadType' -- -- * 'pldshvsmlView' -- -- * 'pldshvsmlFilter' -- -- * 'pldshvsmlPageToken' -- -- * 'pldshvsmlPageSize' -- -- * 'pldshvsmlCallback' projectsLocationsDataSetsHl7V2StoresMessagesList :: Text -- ^ 'pldshvsmlParent' -> ProjectsLocationsDataSetsHl7V2StoresMessagesList projectsLocationsDataSetsHl7V2StoresMessagesList pPldshvsmlParent_ = ProjectsLocationsDataSetsHl7V2StoresMessagesList' { _pldshvsmlParent = pPldshvsmlParent_ , _pldshvsmlXgafv = Nothing , _pldshvsmlUploadProtocol = Nothing , _pldshvsmlOrderBy = Nothing , _pldshvsmlAccessToken = Nothing , _pldshvsmlUploadType = Nothing , _pldshvsmlView = Nothing , _pldshvsmlFilter = Nothing , _pldshvsmlPageToken = Nothing , _pldshvsmlPageSize = Nothing , _pldshvsmlCallback = Nothing }
1,169
projectsLocationsDataSetsHl7V2StoresMessagesList :: Text -- ^ 'pldshvsmlParent' -> ProjectsLocationsDataSetsHl7V2StoresMessagesList projectsLocationsDataSetsHl7V2StoresMessagesList pPldshvsmlParent_ = ProjectsLocationsDataSetsHl7V2StoresMessagesList' { _pldshvsmlParent = pPldshvsmlParent_ , _pldshvsmlXgafv = Nothing , _pldshvsmlUploadProtocol = Nothing , _pldshvsmlOrderBy = Nothing , _pldshvsmlAccessToken = Nothing , _pldshvsmlUploadType = Nothing , _pldshvsmlView = Nothing , _pldshvsmlFilter = Nothing , _pldshvsmlPageToken = Nothing , _pldshvsmlPageSize = Nothing , _pldshvsmlCallback = Nothing }
661
projectsLocationsDataSetsHl7V2StoresMessagesList pPldshvsmlParent_ = ProjectsLocationsDataSetsHl7V2StoresMessagesList' { _pldshvsmlParent = pPldshvsmlParent_ , _pldshvsmlXgafv = Nothing , _pldshvsmlUploadProtocol = Nothing , _pldshvsmlOrderBy = Nothing , _pldshvsmlAccessToken = Nothing , _pldshvsmlUploadType = Nothing , _pldshvsmlView = Nothing , _pldshvsmlFilter = Nothing , _pldshvsmlPageToken = Nothing , _pldshvsmlPageSize = Nothing , _pldshvsmlCallback = Nothing }
521
true
true
0
6
188
112
80
32
null
null
kmate/HaRe
old/testing/asPatterns/A6_TokOut.hs
bsd-3-clause
buildtree :: Ord a => [a] -> BTree a buildtree [] = Empty
57
buildtree :: Ord a => [a] -> BTree a buildtree [] = Empty
57
buildtree [] = Empty
20
false
true
0
7
12
33
16
17
null
null
kadena-io/pact
src/Pact/Native/Keysets.hs
bsd-3-clause
readKeysetDef :: NativeDef readKeysetDef = defRNative "read-keyset" readKeySet (funType tTyKeySet [("key",tTyString)]) [LitExample "(read-keyset \"admin-keyset\")"] $ "Read KEY from message data body as keyset ({ \"keys\": KEYLIST, \"pred\": PREDFUN }). " <> "PREDFUN should resolve to a keys predicate." where readKeySet :: RNativeFun e readKeySet i [TLiteral (LString key) ki] = ((`TGuard` ki) . GKeySet) <$> readKeySet' i key readKeySet i as = argsError i as
489
readKeysetDef :: NativeDef readKeysetDef = defRNative "read-keyset" readKeySet (funType tTyKeySet [("key",tTyString)]) [LitExample "(read-keyset \"admin-keyset\")"] $ "Read KEY from message data body as keyset ({ \"keys\": KEYLIST, \"pred\": PREDFUN }). " <> "PREDFUN should resolve to a keys predicate." where readKeySet :: RNativeFun e readKeySet i [TLiteral (LString key) ki] = ((`TGuard` ki) . GKeySet) <$> readKeySet' i key readKeySet i as = argsError i as
489
readKeysetDef = defRNative "read-keyset" readKeySet (funType tTyKeySet [("key",tTyString)]) [LitExample "(read-keyset \"admin-keyset\")"] $ "Read KEY from message data body as keyset ({ \"keys\": KEYLIST, \"pred\": PREDFUN }). " <> "PREDFUN should resolve to a keys predicate." where readKeySet :: RNativeFun e readKeySet i [TLiteral (LString key) ki] = ((`TGuard` ki) . GKeySet) <$> readKeySet' i key readKeySet i as = argsError i as
462
false
true
2
11
92
121
64
57
null
null