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
DominikDitoIvosevic/Uni
IRG/src/Irg/Lab1/Geometry/Shapes.hs
mit
myTrace :: Show a => a -> a myTrace x = if False then traceShowId x else x
74
myTrace :: Show a => a -> a myTrace x = if False then traceShowId x else x
74
myTrace x = if False then traceShowId x else x
46
false
true
0
6
17
36
18
18
null
null
Noeda/Megaman
src/NetHack/Data/Level.hs
mit
maybeMarkAsOpenDoor :: Level -> T.Terminal -> Coords -> Level maybeMarkAsOpenDoor level term coords | featureAt level coords /= Just ClosedDoor = level | featureByCh char attributes /= [] = level | otherwise = updateElement level coords (\elem -> setFeature elem (Just OpenedDoor)) where char = head $ T.strAt coords term attributes = T.attributesAt coords term
433
maybeMarkAsOpenDoor :: Level -> T.Terminal -> Coords -> Level maybeMarkAsOpenDoor level term coords | featureAt level coords /= Just ClosedDoor = level | featureByCh char attributes /= [] = level | otherwise = updateElement level coords (\elem -> setFeature elem (Just OpenedDoor)) where char = head $ T.strAt coords term attributes = T.attributesAt coords term
433
maybeMarkAsOpenDoor level term coords | featureAt level coords /= Just ClosedDoor = level | featureByCh char attributes /= [] = level | otherwise = updateElement level coords (\elem -> setFeature elem (Just OpenedDoor)) where char = head $ T.strAt coords term attributes = T.attributesAt coords term
371
false
true
1
10
126
136
65
71
null
null
andygill/er-systemf
Language/SystemF/Parser.hs
bsd-3-clause
parseContextName :: Parser String parseContextName = lexeme $ primParseContextName
82
parseContextName :: Parser String parseContextName = lexeme $ primParseContextName
82
parseContextName = lexeme $ primParseContextName
48
false
true
0
5
8
18
9
9
null
null
brendanhay/gogol
gogol-cloudsearch/gen/Network/Google/CloudSearch/Types/Product.hs
mpl-2.0
-- | Can this operator be used to get facets. qoIsFacetable :: Lens' QueryOperator (Maybe Bool) qoIsFacetable = lens _qoIsFacetable (\ s a -> s{_qoIsFacetable = a})
172
qoIsFacetable :: Lens' QueryOperator (Maybe Bool) qoIsFacetable = lens _qoIsFacetable (\ s a -> s{_qoIsFacetable = a})
126
qoIsFacetable = lens _qoIsFacetable (\ s a -> s{_qoIsFacetable = a})
76
true
true
1
9
34
52
25
27
null
null
cchalmers/geometry
src/Geometry/TwoD/Curvature.hs
bsd-3-clause
-- Package up problematic values with the appropriate infinity. toPosInf :: RealFloat a => V2 a -> PosInf a toPosInf (V2 _ 0) = Infinity
136
toPosInf :: RealFloat a => V2 a -> PosInf a toPosInf (V2 _ 0) = Infinity
72
toPosInf (V2 _ 0) = Infinity
28
true
true
0
10
24
45
20
25
null
null
mdsteele/fallback
src/Fallback/Test/Pathfind.hs
gpl-3.0
------------------------------------------------------------------------------- pathfindTest :: Int -> String -> Test pathfindTest limit terrain = let strings = lines terrain width = length (head strings) height = length strings arr = listArray ((0, 0), (width - 1, height - 1)) $ concat $ transpose strings get (Point x y) = arr ! (x, y) allPoints = range (Point 0 0, Point (width - 1) (height - 1)) isBlocked = ('O' ==) . get isGoal pt = let c = get pt in c == 'e' || c == 'g' goals = filter isGoal allPoints heuristic pos = minimum $ flip map goals $ \goal -> pDist (fromIntegral <$> pos) (fromIntegral <$> goal) start = head $ filter (('s' ==) . get) $ allPoints path = pathfind isBlocked isGoal heuristic limit start expected = Just $ let fn (mbCurrent, prev) = case mbCurrent of Nothing -> Nothing Just current -> let mbNext = listToMaybe $ filter (ok prev) $ map (current `plusDir`) allDirections in Just (current, (mbNext, current)) ok prev next = next /= prev && (let c = get next in c == '.' || c == 'e') in tail $ unfoldr fn (Just start, start) in insistEq expected path
1,347
pathfindTest :: Int -> String -> Test pathfindTest limit terrain = let strings = lines terrain width = length (head strings) height = length strings arr = listArray ((0, 0), (width - 1, height - 1)) $ concat $ transpose strings get (Point x y) = arr ! (x, y) allPoints = range (Point 0 0, Point (width - 1) (height - 1)) isBlocked = ('O' ==) . get isGoal pt = let c = get pt in c == 'e' || c == 'g' goals = filter isGoal allPoints heuristic pos = minimum $ flip map goals $ \goal -> pDist (fromIntegral <$> pos) (fromIntegral <$> goal) start = head $ filter (('s' ==) . get) $ allPoints path = pathfind isBlocked isGoal heuristic limit start expected = Just $ let fn (mbCurrent, prev) = case mbCurrent of Nothing -> Nothing Just current -> let mbNext = listToMaybe $ filter (ok prev) $ map (current `plusDir`) allDirections in Just (current, (mbNext, current)) ok prev next = next /= prev && (let c = get next in c == '.' || c == 'e') in tail $ unfoldr fn (Just start, start) in insistEq expected path
1,266
pathfindTest limit terrain = let strings = lines terrain width = length (head strings) height = length strings arr = listArray ((0, 0), (width - 1, height - 1)) $ concat $ transpose strings get (Point x y) = arr ! (x, y) allPoints = range (Point 0 0, Point (width - 1) (height - 1)) isBlocked = ('O' ==) . get isGoal pt = let c = get pt in c == 'e' || c == 'g' goals = filter isGoal allPoints heuristic pos = minimum $ flip map goals $ \goal -> pDist (fromIntegral <$> pos) (fromIntegral <$> goal) start = head $ filter (('s' ==) . get) $ allPoints path = pathfind isBlocked isGoal heuristic limit start expected = Just $ let fn (mbCurrent, prev) = case mbCurrent of Nothing -> Nothing Just current -> let mbNext = listToMaybe $ filter (ok prev) $ map (current `plusDir`) allDirections in Just (current, (mbNext, current)) ok prev next = next /= prev && (let c = get next in c == '.' || c == 'e') in tail $ unfoldr fn (Just start, start) in insistEq expected path
1,228
true
true
5
13
462
463
248
215
null
null
mumuki/mumuki-hspec-server
src/Server/Test/TestRunner.hs
mit
toTestResults :: [Maybe (String, String, String)] -> TestResults toTestResults = map (toTestResult.fromJust) . filter isJust
124
toTestResults :: [Maybe (String, String, String)] -> TestResults toTestResults = map (toTestResult.fromJust) . filter isJust
124
toTestResults = map (toTestResult.fromJust) . filter isJust
59
false
true
0
9
14
51
25
26
null
null
ddssff/pandoc
src/Text/Pandoc/Readers/LaTeX.hs
gpl-2.0
circ :: Char -> String circ 'A' = "Â"
37
circ :: Char -> String circ 'A' = "Â"
37
circ 'A' = "Â"
14
false
true
0
5
8
18
9
9
null
null
juodaspaulius/bclafer_old
src/Language/Clafer/Front/LayoutResolver.hs
mit
readC n = if n > 0 then getc else return '\n'
45
readC n = if n > 0 then getc else return '\n'
45
readC n = if n > 0 then getc else return '\n'
45
false
false
0
6
11
24
12
12
null
null
ozgurakgun/cmdargs
System/Console/CmdArgs/Test/Implicit/Tests.hs
bsd-3-clause
test10 = do let Tester{..} = tester "Test10" mode10 isHelp ["-?=one"] [" -f --food=INT"] isHelpNot ["-?=one"] [" -b --bard=INT"] -- test for GHC over-optimising
175
test10 = do let Tester{..} = tester "Test10" mode10 isHelp ["-?=one"] [" -f --food=INT"] isHelpNot ["-?=one"] [" -b --bard=INT"] -- test for GHC over-optimising
175
test10 = do let Tester{..} = tester "Test10" mode10 isHelp ["-?=one"] [" -f --food=INT"] isHelpNot ["-?=one"] [" -b --bard=INT"] -- test for GHC over-optimising
175
false
false
0
11
38
56
27
29
null
null
snapframework/snap-core
test/Snap/Internal/Routing/Tests.hs
bsd-3-clause
testRouting6 :: Test testRouting6 = testCase "route/6" $ do r5 <- go routes "foo/bar/sproing" assertEqual "/foo/bar/sproing" "fooBar" r5 ------------------------------------------------------------------------------
225
testRouting6 :: Test testRouting6 = testCase "route/6" $ do r5 <- go routes "foo/bar/sproing" assertEqual "/foo/bar/sproing" "fooBar" r5 ------------------------------------------------------------------------------
225
testRouting6 = testCase "route/6" $ do r5 <- go routes "foo/bar/sproing" assertEqual "/foo/bar/sproing" "fooBar" r5 ------------------------------------------------------------------------------
204
false
true
0
9
28
41
19
22
null
null
apunktbau/co4
test/CO4/Thesis/WCB_MatrixStandalone.hs
gpl-3.0
tail' :: List a -> List a tail' xs = case xs of Nill -> Nill Conss y ys -> ys
81
tail' :: List a -> List a tail' xs = case xs of Nill -> Nill Conss y ys -> ys
81
tail' xs = case xs of Nill -> Nill Conss y ys -> ys
55
false
true
0
8
24
49
22
27
null
null
GaloisInc/saw-script
heapster-saw/src/Verifier/SAW/Heapster/archival/Permissions.hs
bsd-3-clause
remLLVMFieldAt off (LLVMFieldShapePerm (LLVMFieldPerm off' spl p) : shapes) | off' == off = Just (spl, p, shapes)
115
remLLVMFieldAt off (LLVMFieldShapePerm (LLVMFieldPerm off' spl p) : shapes) | off' == off = Just (spl, p, shapes)
115
remLLVMFieldAt off (LLVMFieldShapePerm (LLVMFieldPerm off' spl p) : shapes) | off' == off = Just (spl, p, shapes)
115
false
false
0
10
19
53
26
27
null
null
prt2121/haskell-practice
parconc/distrib-db/DatabaseSample.hs
apache-2.0
loop :: [[ProcessId]] -> Int -> Process () loop worker_pairs n_slices = receiveWait [ match $ \req -> handleRequest req >> loop worker_pairs n_slices , match $ \(ProcessMonitorNotification _ pid reason) -> do say (printf "process %s died: %s" (show pid) (show reason)) loop (map (filter (/= pid)) worker_pairs) n_slices ] where workersForKey :: Key -> [ProcessId] workersForKey k = worker_pairs !! (ord (head k) `mod` n_slices) handleRequest :: Request -> Process () handleRequest r = case r of Set k _ -> mapM_ (! r) (workersForKey k) Get k _ -> mapM_ (! r) (workersForKey k)
665
loop :: [[ProcessId]] -> Int -> Process () loop worker_pairs n_slices = receiveWait [ match $ \req -> handleRequest req >> loop worker_pairs n_slices , match $ \(ProcessMonitorNotification _ pid reason) -> do say (printf "process %s died: %s" (show pid) (show reason)) loop (map (filter (/= pid)) worker_pairs) n_slices ] where workersForKey :: Key -> [ProcessId] workersForKey k = worker_pairs !! (ord (head k) `mod` n_slices) handleRequest :: Request -> Process () handleRequest r = case r of Set k _ -> mapM_ (! r) (workersForKey k) Get k _ -> mapM_ (! r) (workersForKey k)
665
loop worker_pairs n_slices = receiveWait [ match $ \req -> handleRequest req >> loop worker_pairs n_slices , match $ \(ProcessMonitorNotification _ pid reason) -> do say (printf "process %s died: %s" (show pid) (show reason)) loop (map (filter (/= pid)) worker_pairs) n_slices ] where workersForKey :: Key -> [ProcessId] workersForKey k = worker_pairs !! (ord (head k) `mod` n_slices) handleRequest :: Request -> Process () handleRequest r = case r of Set k _ -> mapM_ (! r) (workersForKey k) Get k _ -> mapM_ (! r) (workersForKey k)
622
false
true
0
16
185
265
133
132
null
null
urbanslug/nairobi-bot
tests/Bot/EchoSpec.hs
gpl-3.0
echoBotProperties :: Spec echoBotProperties = do describe "Echo property tests" $ do it "Echobot just echoes what it receives but escapes unsafe chars" $ do --property $ forAll (arbitrary :: Gen String) propEcho pendingWith "Fix propEcho"
256
echoBotProperties :: Spec echoBotProperties = do describe "Echo property tests" $ do it "Echobot just echoes what it receives but escapes unsafe chars" $ do --property $ forAll (arbitrary :: Gen String) propEcho pendingWith "Fix propEcho"
256
echoBotProperties = do describe "Echo property tests" $ do it "Echobot just echoes what it receives but escapes unsafe chars" $ do --property $ forAll (arbitrary :: Gen String) propEcho pendingWith "Fix propEcho"
230
false
true
0
13
53
38
17
21
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/enumFromThenTo_6.hs
mit
toEnum4 wx wy = toEnum3 wy
26
toEnum4 wx wy = toEnum3 wy
26
toEnum4 wx wy = toEnum3 wy
26
false
false
0
5
5
14
6
8
null
null
alphaHeavy/quickfix-hs
src/AlphaHeavy/QuickFIX.hs
bsd-3-clause
sourceQuickFIX :: (Generic a, GRecvMessage (Rep a), MonadIO m) => ConduitApp -> Source m a sourceQuickFIX ConduitApp{conduitAppRecv, conduitAppStatus} = step where step = do mval <- liftIO . atomically $ do mval <- Right <$> takeTMVar conduitAppRecv <|> Left <$> readTVar conduitAppStatus case mval of Left EngineRunning -> retry _ -> return mval case mval of Right (val, future) -> do -- the QuickFIX callbacks don't know the correct type, so we need to do -- the parsing with the GRecvMessage constraint in scope. The QuickFIX engine -- needs any parse related exceptions returned synchronously... this is -- done by passing a future for the exception along with the message pointer mmsg <- liftIO $ catch (receiveMessage val >>= \ !msg -> future Nothing >> return (Just msg)) (\ ex -> future (Just ex) >> return Nothing) case mmsg of Just msg -> yield msg Nothing -> return () step -- this should always be Left EngineStopped Left _ -> return ()
1,109
sourceQuickFIX :: (Generic a, GRecvMessage (Rep a), MonadIO m) => ConduitApp -> Source m a sourceQuickFIX ConduitApp{conduitAppRecv, conduitAppStatus} = step where step = do mval <- liftIO . atomically $ do mval <- Right <$> takeTMVar conduitAppRecv <|> Left <$> readTVar conduitAppStatus case mval of Left EngineRunning -> retry _ -> return mval case mval of Right (val, future) -> do -- the QuickFIX callbacks don't know the correct type, so we need to do -- the parsing with the GRecvMessage constraint in scope. The QuickFIX engine -- needs any parse related exceptions returned synchronously... this is -- done by passing a future for the exception along with the message pointer mmsg <- liftIO $ catch (receiveMessage val >>= \ !msg -> future Nothing >> return (Just msg)) (\ ex -> future (Just ex) >> return Nothing) case mmsg of Just msg -> yield msg Nothing -> return () step -- this should always be Left EngineStopped Left _ -> return ()
1,109
sourceQuickFIX ConduitApp{conduitAppRecv, conduitAppStatus} = step where step = do mval <- liftIO . atomically $ do mval <- Right <$> takeTMVar conduitAppRecv <|> Left <$> readTVar conduitAppStatus case mval of Left EngineRunning -> retry _ -> return mval case mval of Right (val, future) -> do -- the QuickFIX callbacks don't know the correct type, so we need to do -- the parsing with the GRecvMessage constraint in scope. The QuickFIX engine -- needs any parse related exceptions returned synchronously... this is -- done by passing a future for the exception along with the message pointer mmsg <- liftIO $ catch (receiveMessage val >>= \ !msg -> future Nothing >> return (Just msg)) (\ ex -> future (Just ex) >> return Nothing) case mmsg of Just msg -> yield msg Nothing -> return () step -- this should always be Left EngineStopped Left _ -> return ()
1,012
false
true
4
22
322
284
134
150
null
null
brendanhay/gogol
gogol-dlp/gen/Network/Google/Resource/DLP/Projects/JobTriggers/List.hs
mpl-2.0
-- | V1 error format. pjtlXgafv :: Lens' ProjectsJobTriggersList (Maybe Xgafv) pjtlXgafv = lens _pjtlXgafv (\ s a -> s{_pjtlXgafv = a})
137
pjtlXgafv :: Lens' ProjectsJobTriggersList (Maybe Xgafv) pjtlXgafv = lens _pjtlXgafv (\ s a -> s{_pjtlXgafv = a})
115
pjtlXgafv = lens _pjtlXgafv (\ s a -> s{_pjtlXgafv = a})
58
true
true
0
9
23
48
25
23
null
null
haskellbr/missingh
missingh-all/src/System/Path/WildMatch.hs
mit
convpat :: String -> String convpat ('\\':xs) = "\\\\" ++ convpat xs
68
convpat :: String -> String convpat ('\\':xs) = "\\\\" ++ convpat xs
68
convpat ('\\':xs) = "\\\\" ++ convpat xs
40
false
true
2
9
11
38
17
21
null
null
bergmark/clay
src/Clay/Text.hs
bsd-3-clause
preLine = WhiteSpace "pre-line"
31
preLine = WhiteSpace "pre-line"
31
preLine = WhiteSpace "pre-line"
31
false
false
0
5
3
9
4
5
null
null
daewon/til
exercism/haskell/raindrops/src/Raindrops.hs
mpl-2.0
toRainStr :: Int -> String toRainStr 3 = "Pling"
48
toRainStr :: Int -> String toRainStr 3 = "Pling"
48
toRainStr 3 = "Pling"
21
false
true
0
5
8
18
9
9
null
null
mightymoose/liquidhaskell
benchmarks/base-4.5.1.0/Foreign/C/Error.hs
bsd-3-clause
throwErrnoIf_ :: (a -> Bool) -> String -> IO a -> IO () throwErrnoIf_ pred loc f = void $ throwErrnoIf pred loc f
116
throwErrnoIf_ :: (a -> Bool) -> String -> IO a -> IO () throwErrnoIf_ pred loc f = void $ throwErrnoIf pred loc f
116
throwErrnoIf_ pred loc f = void $ throwErrnoIf pred loc f
58
false
true
0
9
26
56
27
29
null
null
ctford/Idris-Elba-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
getConsts :: [PArg] -> [PTerm] getConsts [] = []
48
getConsts :: [PArg] -> [PTerm] getConsts [] = []
48
getConsts [] = []
17
false
true
0
6
8
28
15
13
null
null
robdockins/edison
edison-core/src/Data/Edison/Seq/MyersStack.hs
mit
fold = foldr
13
fold = foldr
13
fold = foldr
13
false
false
0
4
3
6
3
3
null
null
Rydgel/advent-of-code
src/Day6.hs
bsd-3-clause
instruction :: Parser Instruction instruction = action <*> (char ' ' *> range)
78
instruction :: Parser Instruction instruction = action <*> (char ' ' *> range)
78
instruction = action <*> (char ' ' *> range)
44
false
true
0
8
12
28
14
14
null
null
ytakano/tsukuyomi
validator/lunar_lisp/lunar_lisp_parser.hs
bsd-3-clause
-- op ::= '+' | '/' | '~' | '!' | '@' | '#' | '$' | '%' | ':' | '?' -- '^' | '*' | '-' | '=' | '_' | '<' | '>' | '|' | '&' parseOp :: Parsec.Parsec String () Char parseOp = Parsec.oneOf "+/~!@#$%:?^*-=_<>|&"
224
parseOp :: Parsec.Parsec String () Char parseOp = Parsec.oneOf "+/~!@#$%:?^*-=_<>|&"
84
parseOp = Parsec.oneOf "+/~!@#$%:?^*-=_<>|&"
44
true
true
0
6
66
29
15
14
null
null
hvr/jhc
src/FrontEnd/KindInfer.hs
mit
hsAsstToPred' _ kt (HsAsstEq t1 t2) = IsEq (runIdentity $ hsTypeToType' kt t1) (runIdentity $ hsTypeToType' kt t2)
114
hsAsstToPred' _ kt (HsAsstEq t1 t2) = IsEq (runIdentity $ hsTypeToType' kt t1) (runIdentity $ hsTypeToType' kt t2)
114
hsAsstToPred' _ kt (HsAsstEq t1 t2) = IsEq (runIdentity $ hsTypeToType' kt t1) (runIdentity $ hsTypeToType' kt t2)
114
false
false
1
8
17
52
24
28
null
null
pparkkin/eta
compiler/ETA/Main/DynFlags.hs
bsd-3-clause
-- See Note [Supporting CLI completion] package_flags :: [Flag (CmdLineP DynFlags)] package_flags = [ ------- Packages ---------------------------------------------------- defFlag "package-db" (HasArg (addPkgConfRef . PkgConfFile)) , defFlag "clear-package-db" (NoArg clearPkgConf) , defFlag "no-global-package-db" (NoArg removeGlobalPkgConf) , defFlag "no-user-package-db" (NoArg removeUserPkgConf) , defFlag "global-package-db" (NoArg (addPkgConfRef GlobalPkgConf)) , defFlag "user-package-db" (NoArg (addPkgConfRef UserPkgConf)) -- backwards compat with GHC<=7.4 : , defFlag "package-conf" (HasArg $ \path -> do addPkgConfRef (PkgConfFile path) deprecate "Use -package-db instead") , defFlag "no-user-package-conf" (NoArg $ do removeUserPkgConf deprecate "Use -no-user-package-db instead") , defGhcFlag "package-name" (hasArg setUnitId) , defGhcFlag "this-package-key" (HasArg $ \uid -> do upd (setUnitId uid) deprecate "Use -this-unit-id instead") , defGhcFlag "this-unit-id" (hasArg setUnitId) , defFlag "package" (HasArg exposePackage) , defFlag "package-id" (HasArg exposePackageId) , defFlag "hide-package" (HasArg hidePackage) , defFlag "hide-all-packages" (NoArg (setGeneralFlag Opt_HideAllPackages)) , defFlag "package-env" (HasArg setPackageEnv) , defFlag "ignore-package" (HasArg ignorePackage) , defFlag "syslib" (HasArg (\s -> do exposePackage s deprecate "Use -package instead")) , defFlag "distrust-all-packages" (NoArg (setGeneralFlag Opt_DistrustAllPackages)) , defFlag "trust" (HasArg trustPackage) , defFlag "distrust" (HasArg distrustPackage) ] where setPackageEnv env = upd $ \s -> s { packageEnv = Just env } -- | Make a list of flags for shell completion. -- Filter all available flags into two groups, for interactive GHC vs all other.
2,183
package_flags :: [Flag (CmdLineP DynFlags)] package_flags = [ ------- Packages ---------------------------------------------------- defFlag "package-db" (HasArg (addPkgConfRef . PkgConfFile)) , defFlag "clear-package-db" (NoArg clearPkgConf) , defFlag "no-global-package-db" (NoArg removeGlobalPkgConf) , defFlag "no-user-package-db" (NoArg removeUserPkgConf) , defFlag "global-package-db" (NoArg (addPkgConfRef GlobalPkgConf)) , defFlag "user-package-db" (NoArg (addPkgConfRef UserPkgConf)) -- backwards compat with GHC<=7.4 : , defFlag "package-conf" (HasArg $ \path -> do addPkgConfRef (PkgConfFile path) deprecate "Use -package-db instead") , defFlag "no-user-package-conf" (NoArg $ do removeUserPkgConf deprecate "Use -no-user-package-db instead") , defGhcFlag "package-name" (hasArg setUnitId) , defGhcFlag "this-package-key" (HasArg $ \uid -> do upd (setUnitId uid) deprecate "Use -this-unit-id instead") , defGhcFlag "this-unit-id" (hasArg setUnitId) , defFlag "package" (HasArg exposePackage) , defFlag "package-id" (HasArg exposePackageId) , defFlag "hide-package" (HasArg hidePackage) , defFlag "hide-all-packages" (NoArg (setGeneralFlag Opt_HideAllPackages)) , defFlag "package-env" (HasArg setPackageEnv) , defFlag "ignore-package" (HasArg ignorePackage) , defFlag "syslib" (HasArg (\s -> do exposePackage s deprecate "Use -package instead")) , defFlag "distrust-all-packages" (NoArg (setGeneralFlag Opt_DistrustAllPackages)) , defFlag "trust" (HasArg trustPackage) , defFlag "distrust" (HasArg distrustPackage) ] where setPackageEnv env = upd $ \s -> s { packageEnv = Just env } -- | Make a list of flags for shell completion. -- Filter all available flags into two groups, for interactive GHC vs all other.
2,143
package_flags = [ ------- Packages ---------------------------------------------------- defFlag "package-db" (HasArg (addPkgConfRef . PkgConfFile)) , defFlag "clear-package-db" (NoArg clearPkgConf) , defFlag "no-global-package-db" (NoArg removeGlobalPkgConf) , defFlag "no-user-package-db" (NoArg removeUserPkgConf) , defFlag "global-package-db" (NoArg (addPkgConfRef GlobalPkgConf)) , defFlag "user-package-db" (NoArg (addPkgConfRef UserPkgConf)) -- backwards compat with GHC<=7.4 : , defFlag "package-conf" (HasArg $ \path -> do addPkgConfRef (PkgConfFile path) deprecate "Use -package-db instead") , defFlag "no-user-package-conf" (NoArg $ do removeUserPkgConf deprecate "Use -no-user-package-db instead") , defGhcFlag "package-name" (hasArg setUnitId) , defGhcFlag "this-package-key" (HasArg $ \uid -> do upd (setUnitId uid) deprecate "Use -this-unit-id instead") , defGhcFlag "this-unit-id" (hasArg setUnitId) , defFlag "package" (HasArg exposePackage) , defFlag "package-id" (HasArg exposePackageId) , defFlag "hide-package" (HasArg hidePackage) , defFlag "hide-all-packages" (NoArg (setGeneralFlag Opt_HideAllPackages)) , defFlag "package-env" (HasArg setPackageEnv) , defFlag "ignore-package" (HasArg ignorePackage) , defFlag "syslib" (HasArg (\s -> do exposePackage s deprecate "Use -package instead")) , defFlag "distrust-all-packages" (NoArg (setGeneralFlag Opt_DistrustAllPackages)) , defFlag "trust" (HasArg trustPackage) , defFlag "distrust" (HasArg distrustPackage) ] where setPackageEnv env = upd $ \s -> s { packageEnv = Just env } -- | Make a list of flags for shell completion. -- Filter all available flags into two groups, for interactive GHC vs all other.
2,099
true
true
0
14
628
461
231
230
null
null
a143753/AOJ
0087.hs
apache-2.0
op :: (Double -> Double -> Double) -> [String] -> [String] op e (s0:s1:ss) = let s0' = read s0 :: Double s1' = read s1 :: Double re = e s1' s0' r' = show re in r':ss
193
op :: (Double -> Double -> Double) -> [String] -> [String] op e (s0:s1:ss) = let s0' = read s0 :: Double s1' = read s1 :: Double re = e s1' s0' r' = show re in r':ss
193
op e (s0:s1:ss) = let s0' = read s0 :: Double s1' = read s1 :: Double re = e s1' s0' r' = show re in r':ss
134
false
true
2
9
66
109
54
55
null
null
lambdacms/lambdacms.org
lambdacmsorg-tutorial/LambdaCmsOrg/Tutorial/Foundation.hs
mit
defaultTutorialAdminMenu :: LambdaCmsOrgTutorial master => (Route TutorialAdmin -> Route master) -> [AdminMenuItem master] defaultTutorialAdminMenu tp = [ MenuItem (SomeMessage Msg.MenuTutorial) (tp TutorialAdminIndexR) "book" ]
228
defaultTutorialAdminMenu :: LambdaCmsOrgTutorial master => (Route TutorialAdmin -> Route master) -> [AdminMenuItem master] defaultTutorialAdminMenu tp = [ MenuItem (SomeMessage Msg.MenuTutorial) (tp TutorialAdminIndexR) "book" ]
228
defaultTutorialAdminMenu tp = [ MenuItem (SomeMessage Msg.MenuTutorial) (tp TutorialAdminIndexR) "book" ]
105
false
true
0
9
23
68
33
35
null
null
rsasse/tamarin-prover
lib/theory/src/Theory/Text/Parser/Token.hs
gpl-3.0
-- | Parse a graph node variable. nodevar :: Parser NodeId nodevar = asum [ sortedLVar [LSortNode] , (\(n, i) -> LVar n LSortNode i) <$> indexedIdentifier ] <?> "timepoint variable"
187
nodevar :: Parser NodeId nodevar = asum [ sortedLVar [LSortNode] , (\(n, i) -> LVar n LSortNode i) <$> indexedIdentifier ] <?> "timepoint variable"
153
nodevar = asum [ sortedLVar [LSortNode] , (\(n, i) -> LVar n LSortNode i) <$> indexedIdentifier ] <?> "timepoint variable"
128
true
true
2
9
36
61
32
29
null
null
sgillespie/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
callishOp _ = Nothing
21
callishOp _ = Nothing
21
callishOp _ = Nothing
21
false
false
0
5
3
9
4
5
null
null
armoredsoftware/protocol
tpm/mainline/protoMonad/ProtoActions.hs
bsd-3-clause
--mconcat bslist --where bslist = map tobs as --Concrete unpacking implementation unpackImpl :: Binary a => ByteString -> [a] unpackImpl bs = decode bs
153
unpackImpl :: Binary a => ByteString -> [a] unpackImpl bs = decode bs
69
unpackImpl bs = decode bs
25
true
true
0
9
25
40
19
21
null
null
antalsz/hs-to-coq
src/lib/HsToCoq/ConvertHaskell/Type.hs
mit
convertType (HsDocTy NOEXTP ty _doc) = convertLType ty
56
convertType (HsDocTy NOEXTP ty _doc) = convertLType ty
56
convertType (HsDocTy NOEXTP ty _doc) = convertLType ty
56
false
false
0
7
9
22
10
12
null
null
afiskon/simple-neural-networks
src/MainXorLogistic.hs
bsd-2-clause
calcXor net x y = let [r] = runNeuralNetwork net [x, y] in r
69
calcXor net x y = let [r] = runNeuralNetwork net [x, y] in r
69
calcXor net x y = let [r] = runNeuralNetwork net [x, y] in r
69
false
false
0
10
22
39
19
20
null
null
ony/Yampa-core
tests/AFRPTestsLaws.hs
bsd-3-clause
laws_t5_lhs :: [(Double, Double)] laws_t5_lhs = testSF1 (arr dup >>> (first (integral >>> arr (+3.0))))
103
laws_t5_lhs :: [(Double, Double)] laws_t5_lhs = testSF1 (arr dup >>> (first (integral >>> arr (+3.0))))
103
laws_t5_lhs = testSF1 (arr dup >>> (first (integral >>> arr (+3.0))))
69
false
true
0
13
14
53
29
24
null
null
ice1000/Kt2Dart
src/Statements.hs
agpl-3.0
-- declarationP :: Parser String declarationP = functionP <|> propertyP <|> classP <|> typeAliasP <|> objectP
118
declarationP :: Parser String declarationP = functionP <|> propertyP <|> classP <|> typeAliasP <|> objectP
114
declarationP = functionP <|> propertyP <|> classP <|> typeAliasP <|> objectP
84
true
true
12
5
24
44
24
20
null
null
GaloisInc/halvm-ghc
compiler/coreSyn/CoreSyn.hs
bsd-3-clause
-- | The number of argument expressions that are values rather than types at their top level valArgCount :: [Arg b] -> Int valArgCount = count isValArg
151
valArgCount :: [Arg b] -> Int valArgCount = count isValArg
58
valArgCount = count isValArg
28
true
true
0
8
26
32
14
18
null
null
fcostantini/QuickFuzz
src/DeriveMArbitrary.hs
gpl-3.0
compat tname (ConT c) = unqualify tname == unqualify c
54
compat tname (ConT c) = unqualify tname == unqualify c
54
compat tname (ConT c) = unqualify tname == unqualify c
54
false
false
0
7
9
27
12
15
null
null
bens/hurtle
test-src/Main.hs
apache-2.0
joinXs :: Int -> Hurtle s TestConn [Int] joinXs = makeGolden $ \xm xsm ysm -> do xs <- xsm return $ do x <- xm ys <- ysm return $ x : xs ++ ys
175
joinXs :: Int -> Hurtle s TestConn [Int] joinXs = makeGolden $ \xm xsm ysm -> do xs <- xsm return $ do x <- xm ys <- ysm return $ x : xs ++ ys
175
joinXs = makeGolden $ \xm xsm ysm -> do xs <- xsm return $ do x <- xm ys <- ysm return $ x : xs ++ ys
134
false
true
0
14
68
81
39
42
null
null
RossMeikleham/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LEq ATFloat) [l, r] = v ++ "FLOATBOP(==," ++ creg l ++ ", " ++ creg r ++ ")"
84
doOp v (LEq ATFloat) [l, r] = v ++ "FLOATBOP(==," ++ creg l ++ ", " ++ creg r ++ ")"
84
doOp v (LEq ATFloat) [l, r] = v ++ "FLOATBOP(==," ++ creg l ++ ", " ++ creg r ++ ")"
84
false
false
0
9
20
51
25
26
null
null
prl-tokyo/bigul-configuration-adaptation
Transformations/src/BiFlux/Trans/Translation.hs
mit
varPat2DirectionEnv (VarT var _) dynRPat@(DynR tv' ev' RVar) = return $ Map.singleton var (DynD tv' ev' tv' DVar RVar)
118
varPat2DirectionEnv (VarT var _) dynRPat@(DynR tv' ev' RVar) = return $ Map.singleton var (DynD tv' ev' tv' DVar RVar)
118
varPat2DirectionEnv (VarT var _) dynRPat@(DynR tv' ev' RVar) = return $ Map.singleton var (DynD tv' ev' tv' DVar RVar)
118
false
false
0
8
18
57
28
29
null
null
mightybyte/reflex-dom-stubs
src/GHCJS/DOM/HTMLElement.hs
bsd-3-clause
ghcjs_dom_html_element_get_webkitdropzone = undefined
53
ghcjs_dom_html_element_get_webkitdropzone = undefined
53
ghcjs_dom_html_element_get_webkitdropzone = undefined
53
false
false
0
4
2
6
3
3
null
null
blamario/incremental-parser
Test/TestIncrementalParser.hs
gpl-3.0
parser3l :: TestParser LeftBiasedLocal (String, String, String) parser3l = undefined
84
parser3l :: TestParser LeftBiasedLocal (String, String, String) parser3l = undefined
84
parser3l = undefined
20
false
true
0
6
9
25
14
11
null
null
alexander-at-github/eta
compiler/ETA/TypeCheck/TcType.hs
bsd-3-clause
----------------------- tcTyConAppTyCon :: Type -> TyCon tcTyConAppTyCon ty = case tcSplitTyConApp_maybe ty of Just (tc, _) -> tc Nothing -> pprPanic "tcTyConAppTyCon" (pprType ty)
233
tcTyConAppTyCon :: Type -> TyCon tcTyConAppTyCon ty = case tcSplitTyConApp_maybe ty of Just (tc, _) -> tc Nothing -> pprPanic "tcTyConAppTyCon" (pprType ty)
209
tcTyConAppTyCon ty = case tcSplitTyConApp_maybe ty of Just (tc, _) -> tc Nothing -> pprPanic "tcTyConAppTyCon" (pprType ty)
176
true
true
0
10
76
58
29
29
null
null
polux/snippets
Merge.hs
apache-2.0
lparen = symbol (char '(')
26
lparen = symbol (char '(')
26
lparen = symbol (char '(')
26
false
false
1
7
4
19
7
12
null
null
phadej/streaming-commons
test/Data/Streaming/ByteString/BuilderSpec.hs
mit
testerFlush :: StreamingBuilder b => BufferAllocStrategy -> [Maybe b] -> IO [Maybe S.ByteString] testerFlush strat builders0 = do (recv, finish) <- newBuilderRecv strat let loop front [] = do mbs <- finish return $ front $ maybe [] (return . Just) mbs loop front0 (mbu:bus) = do popper <- recv $ fromMaybe builderFlush mbu let go front = do bs <- popper if S.null bs then case mbu of Nothing -> loop (front . (Nothing:)) bus Just _ -> loop front bus else go (front . (Just bs:)) go front0 loop id builders0
778
testerFlush :: StreamingBuilder b => BufferAllocStrategy -> [Maybe b] -> IO [Maybe S.ByteString] testerFlush strat builders0 = do (recv, finish) <- newBuilderRecv strat let loop front [] = do mbs <- finish return $ front $ maybe [] (return . Just) mbs loop front0 (mbu:bus) = do popper <- recv $ fromMaybe builderFlush mbu let go front = do bs <- popper if S.null bs then case mbu of Nothing -> loop (front . (Nothing:)) bus Just _ -> loop front bus else go (front . (Just bs:)) go front0 loop id builders0
778
testerFlush strat builders0 = do (recv, finish) <- newBuilderRecv strat let loop front [] = do mbs <- finish return $ front $ maybe [] (return . Just) mbs loop front0 (mbu:bus) = do popper <- recv $ fromMaybe builderFlush mbu let go front = do bs <- popper if S.null bs then case mbu of Nothing -> loop (front . (Nothing:)) bus Just _ -> loop front bus else go (front . (Just bs:)) go front0 loop id builders0
669
false
true
0
24
364
253
120
133
null
null
suhailshergill/hakaru
Historical/Partial.hs
bsd-3-clause
toDynamic :: Partial repr a -> Maybe (repr a) toDynamic (Partial d _) = d
73
toDynamic :: Partial repr a -> Maybe (repr a) toDynamic (Partial d _) = d
73
toDynamic (Partial d _) = d
27
false
true
0
8
14
40
19
21
null
null
lih/Alpha
src/Context/Language.hs
bsd-2-clause
createSym l@(Language { maxIDL = m }) = (m,l { maxIDL = succ m })
65
createSym l@(Language { maxIDL = m }) = (m,l { maxIDL = succ m })
65
createSym l@(Language { maxIDL = m }) = (m,l { maxIDL = succ m })
65
false
false
7
6
14
46
23
23
null
null
geophf/1HaskellADay
exercises/HAD/Control/Map.hs
mit
{-- for example: to make a simple multimap from a [(k,v)] snarf return If we have something like: match :: Map Name Winery -> (Neo4jIxWinery, Country) -> Maybe (Country, IxWikiWinery) match m (neo, c) = (c,) . flip IxWiki (ix neo) <$> Map.lookup (namei neo) m see Y2021.M01.D29.Solution then snarf (match . byName) (translateByCountry) gets you WineriesByCountry (the ByCountry a map-type is used here) --} -- now when we which to preserve, say: two transactions that look the same, ... snarfL :: Ord c => (a -> Maybe (c,d)) -> [a] -> Map c [d] snarfL f = foldr inserterL Map.empty . mapMaybe f
605
snarfL :: Ord c => (a -> Maybe (c,d)) -> [a] -> Map c [d] snarfL f = foldr inserterL Map.empty . mapMaybe f
107
snarfL f = foldr inserterL Map.empty . mapMaybe f
49
true
true
0
10
114
72
37
35
null
null
spechub/Hets
CASL/Sign.hs
gpl-2.0
addSort :: SortsKind -> Annoted a -> SORT -> State.State (Sign f e) () addSort sk a s = do e <- State.get let r = sortRel e em = emptySortSet e known = Rel.memberKey s r if known then addDiags [mkDiag Hint "redeclared sort" s] else do State.put e { sortRel = Rel.insertKey s r } addDiags $ checkNamePrefix s case sk of NonEmptySorts -> when (Set.member s em) $ do e2 <- State.get State.put e2 { emptySortSet = Set.delete s em } addDiags [mkDiag Warning "redeclared sort as non-empty" s] PossiblyEmptySorts -> if known then addDiags [mkDiag Warning "non-empty sort remains non-empty" s] else do e2 <- State.get State.put e2 { emptySortSet = Set.insert s em } addAnnoSet a $ Symbol s SortAsItemType
794
addSort :: SortsKind -> Annoted a -> SORT -> State.State (Sign f e) () addSort sk a s = do e <- State.get let r = sortRel e em = emptySortSet e known = Rel.memberKey s r if known then addDiags [mkDiag Hint "redeclared sort" s] else do State.put e { sortRel = Rel.insertKey s r } addDiags $ checkNamePrefix s case sk of NonEmptySorts -> when (Set.member s em) $ do e2 <- State.get State.put e2 { emptySortSet = Set.delete s em } addDiags [mkDiag Warning "redeclared sort as non-empty" s] PossiblyEmptySorts -> if known then addDiags [mkDiag Warning "non-empty sort remains non-empty" s] else do e2 <- State.get State.put e2 { emptySortSet = Set.insert s em } addAnnoSet a $ Symbol s SortAsItemType
794
addSort sk a s = do e <- State.get let r = sortRel e em = emptySortSet e known = Rel.memberKey s r if known then addDiags [mkDiag Hint "redeclared sort" s] else do State.put e { sortRel = Rel.insertKey s r } addDiags $ checkNamePrefix s case sk of NonEmptySorts -> when (Set.member s em) $ do e2 <- State.get State.put e2 { emptySortSet = Set.delete s em } addDiags [mkDiag Warning "redeclared sort as non-empty" s] PossiblyEmptySorts -> if known then addDiags [mkDiag Warning "non-empty sort remains non-empty" s] else do e2 <- State.get State.put e2 { emptySortSet = Set.insert s em } addAnnoSet a $ Symbol s SortAsItemType
723
false
true
0
17
222
300
141
159
null
null
aszlig/language-javascript
src/Language/JavaScript/Parser/AST.hs
bsd-3-clause
showStrippedNode (JSLabelled x1 _c x2) = "JSLabelled (" ++ ss x1 ++ ") (" ++ ss x2 ++ ")"
89
showStrippedNode (JSLabelled x1 _c x2) = "JSLabelled (" ++ ss x1 ++ ") (" ++ ss x2 ++ ")"
89
showStrippedNode (JSLabelled x1 _c x2) = "JSLabelled (" ++ ss x1 ++ ") (" ++ ss x2 ++ ")"
89
false
false
0
9
18
42
19
23
null
null
ihc/futhark
src/Futhark/Pass/ExtractKernels.hs
isc
transformStm (Let pat _ (Op (Stream w (Parallel o comm red_fun nes) fold_fun arrs))) | Just fold_fun' <- extLambdaToLambda fold_fun = do -- Generate a kernel immediately. red_fun_sequential <- Kernelise.transformLambda red_fun fold_fun_sequential <- Kernelise.transformLambda fold_fun' blockedReductionStream pat w comm' red_fun_sequential fold_fun_sequential nes arrs where comm' | commutativeLambda red_fun, o /= InOrder = Commutative | otherwise = comm
542
transformStm (Let pat _ (Op (Stream w (Parallel o comm red_fun nes) fold_fun arrs))) | Just fold_fun' <- extLambdaToLambda fold_fun = do -- Generate a kernel immediately. red_fun_sequential <- Kernelise.transformLambda red_fun fold_fun_sequential <- Kernelise.transformLambda fold_fun' blockedReductionStream pat w comm' red_fun_sequential fold_fun_sequential nes arrs where comm' | commutativeLambda red_fun, o /= InOrder = Commutative | otherwise = comm
542
transformStm (Let pat _ (Op (Stream w (Parallel o comm red_fun nes) fold_fun arrs))) | Just fold_fun' <- extLambdaToLambda fold_fun = do -- Generate a kernel immediately. red_fun_sequential <- Kernelise.transformLambda red_fun fold_fun_sequential <- Kernelise.transformLambda fold_fun' blockedReductionStream pat w comm' red_fun_sequential fold_fun_sequential nes arrs where comm' | commutativeLambda red_fun, o /= InOrder = Commutative | otherwise = comm
542
false
false
1
12
143
145
65
80
null
null
unknownloner/calccomp
Asm/QQ.hs
mit
parseExp f s = case P.parseExp s of Left err -> fail err Right x -> f `appE` return x
119
parseExp f s = case P.parseExp s of Left err -> fail err Right x -> f `appE` return x
119
parseExp f s = case P.parseExp s of Left err -> fail err Right x -> f `appE` return x
119
false
false
0
9
53
50
23
27
null
null
thenaesh/SoCFault
src/Config.hs
gpl-3.0
loadConfig :: FilePath -> IO Config loadConfig fileName = do file <- B.readFile path case decode file of Nothing -> error errorMsg -- unrecoverable error, terminate the program Just config -> return config where path = mconcat [basePath, "/", fileName] basePath = "config" errorMsg = "Error reading " ++ fileName ++ "!"
371
loadConfig :: FilePath -> IO Config loadConfig fileName = do file <- B.readFile path case decode file of Nothing -> error errorMsg -- unrecoverable error, terminate the program Just config -> return config where path = mconcat [basePath, "/", fileName] basePath = "config" errorMsg = "Error reading " ++ fileName ++ "!"
371
loadConfig fileName = do file <- B.readFile path case decode file of Nothing -> error errorMsg -- unrecoverable error, terminate the program Just config -> return config where path = mconcat [basePath, "/", fileName] basePath = "config" errorMsg = "Error reading " ++ fileName ++ "!"
335
false
true
2
10
103
105
50
55
null
null
simonmichael/hledger
hledger-lib/Hledger/Read/CsvReader.hs
gpl-3.0
tests_CsvReader = testGroup "CsvReader" [ testGroup "parseCsvRules" [ testCase "empty file" $ parseCsvRules "unknown" "" @?= Right (mkrules defrules) ] ,testGroup "rulesp" [ testCase "trailing comments" $ parseWithState' defrules rulesp "skip\n# \n#\n" @?= Right (mkrules $ defrules{rdirectives = [("skip","")]}) ,testCase "trailing blank lines" $ parseWithState' defrules rulesp "skip\n\n \n" @?= (Right (mkrules $ defrules{rdirectives = [("skip","")]})) ,testCase "no final newline" $ parseWithState' defrules rulesp "skip" @?= (Right (mkrules $ defrules{rdirectives=[("skip","")]})) ,testCase "assignment with empty value" $ parseWithState' defrules rulesp "account1 \nif foo\n account2 foo\n" @?= (Right (mkrules $ defrules{rassignments = [("account1","")], rconditionalblocks = [CB{cbMatchers=[RecordMatcher None (toRegex' "foo")],cbAssignments=[("account2","foo")]}]})) ] ,testGroup "conditionalblockp" [ testCase "space after conditional" $ -- #1120 parseWithState' defrules conditionalblockp "if a\n account2 b\n \n" @?= (Right $ CB{cbMatchers=[RecordMatcher None $ toRegexCI' "a"],cbAssignments=[("account2","b")]}) ,testGroup "csvfieldreferencep" [ testCase "number" $ parseWithState' defrules csvfieldreferencep "%1" @?= (Right "%1") ,testCase "name" $ parseWithState' defrules csvfieldreferencep "%date" @?= (Right "%date") ,testCase "quoted name" $ parseWithState' defrules csvfieldreferencep "%\"csv date\"" @?= (Right "%\"csv date\"") ] ,testGroup "matcherp" [ testCase "recordmatcherp" $ parseWithState' defrules matcherp "A A\n" @?= (Right $ RecordMatcher None $ toRegexCI' "A A") ,testCase "recordmatcherp.starts-with-&" $ parseWithState' defrules matcherp "& A A\n" @?= (Right $ RecordMatcher And $ toRegexCI' "A A") ,testCase "fieldmatcherp.starts-with-%" $ parseWithState' defrules matcherp "description A A\n" @?= (Right $ RecordMatcher None $ toRegexCI' "description A A") ,testCase "fieldmatcherp" $ parseWithState' defrules matcherp "%description A A\n" @?= (Right $ FieldMatcher None "%description" $ toRegexCI' "A A") ,testCase "fieldmatcherp.starts-with-&" $ parseWithState' defrules matcherp "& %description A A\n" @?= (Right $ FieldMatcher And "%description" $ toRegexCI' "A A") -- ,testCase "fieldmatcherp with operator" $ -- parseWithState' defrules matcherp "%description ~ A A\n" @?= (Right $ FieldMatcher "%description" "A A") ] ,testGroup "getEffectiveAssignment" [ let rules = mkrules $ defrules {rcsvfieldindexes=[("csvdate",1)],rassignments=[("date","%csvdate")]} in testCase "toplevel" $ getEffectiveAssignment rules ["a","b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a"] [("date","%csvdate")]]} in testCase "conditional" $ getEffectiveAssignment rules ["a","b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher None "%description" $ toRegex' "b"] [("date","%csvdate")]]} in testCase "conditional-with-or-a" $ getEffectiveAssignment rules ["a"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher None "%description" $ toRegex' "b"] [("date","%csvdate")]]} in testCase "conditional-with-or-b" $ getEffectiveAssignment rules ["_", "b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher And "%description" $ toRegex' "b"] [("date","%csvdate")]]} in testCase "conditional.with-and" $ getEffectiveAssignment rules ["a", "b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher And "%description" $ toRegex' "b", FieldMatcher None "%description" $ toRegex' "c"] [("date","%csvdate")]]} in testCase "conditional.with-and-or" $ getEffectiveAssignment rules ["_", "c"] "date" @?= (Just "%csvdate") ] ] ]
4,472
tests_CsvReader = testGroup "CsvReader" [ testGroup "parseCsvRules" [ testCase "empty file" $ parseCsvRules "unknown" "" @?= Right (mkrules defrules) ] ,testGroup "rulesp" [ testCase "trailing comments" $ parseWithState' defrules rulesp "skip\n# \n#\n" @?= Right (mkrules $ defrules{rdirectives = [("skip","")]}) ,testCase "trailing blank lines" $ parseWithState' defrules rulesp "skip\n\n \n" @?= (Right (mkrules $ defrules{rdirectives = [("skip","")]})) ,testCase "no final newline" $ parseWithState' defrules rulesp "skip" @?= (Right (mkrules $ defrules{rdirectives=[("skip","")]})) ,testCase "assignment with empty value" $ parseWithState' defrules rulesp "account1 \nif foo\n account2 foo\n" @?= (Right (mkrules $ defrules{rassignments = [("account1","")], rconditionalblocks = [CB{cbMatchers=[RecordMatcher None (toRegex' "foo")],cbAssignments=[("account2","foo")]}]})) ] ,testGroup "conditionalblockp" [ testCase "space after conditional" $ -- #1120 parseWithState' defrules conditionalblockp "if a\n account2 b\n \n" @?= (Right $ CB{cbMatchers=[RecordMatcher None $ toRegexCI' "a"],cbAssignments=[("account2","b")]}) ,testGroup "csvfieldreferencep" [ testCase "number" $ parseWithState' defrules csvfieldreferencep "%1" @?= (Right "%1") ,testCase "name" $ parseWithState' defrules csvfieldreferencep "%date" @?= (Right "%date") ,testCase "quoted name" $ parseWithState' defrules csvfieldreferencep "%\"csv date\"" @?= (Right "%\"csv date\"") ] ,testGroup "matcherp" [ testCase "recordmatcherp" $ parseWithState' defrules matcherp "A A\n" @?= (Right $ RecordMatcher None $ toRegexCI' "A A") ,testCase "recordmatcherp.starts-with-&" $ parseWithState' defrules matcherp "& A A\n" @?= (Right $ RecordMatcher And $ toRegexCI' "A A") ,testCase "fieldmatcherp.starts-with-%" $ parseWithState' defrules matcherp "description A A\n" @?= (Right $ RecordMatcher None $ toRegexCI' "description A A") ,testCase "fieldmatcherp" $ parseWithState' defrules matcherp "%description A A\n" @?= (Right $ FieldMatcher None "%description" $ toRegexCI' "A A") ,testCase "fieldmatcherp.starts-with-&" $ parseWithState' defrules matcherp "& %description A A\n" @?= (Right $ FieldMatcher And "%description" $ toRegexCI' "A A") -- ,testCase "fieldmatcherp with operator" $ -- parseWithState' defrules matcherp "%description ~ A A\n" @?= (Right $ FieldMatcher "%description" "A A") ] ,testGroup "getEffectiveAssignment" [ let rules = mkrules $ defrules {rcsvfieldindexes=[("csvdate",1)],rassignments=[("date","%csvdate")]} in testCase "toplevel" $ getEffectiveAssignment rules ["a","b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a"] [("date","%csvdate")]]} in testCase "conditional" $ getEffectiveAssignment rules ["a","b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher None "%description" $ toRegex' "b"] [("date","%csvdate")]]} in testCase "conditional-with-or-a" $ getEffectiveAssignment rules ["a"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher None "%description" $ toRegex' "b"] [("date","%csvdate")]]} in testCase "conditional-with-or-b" $ getEffectiveAssignment rules ["_", "b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher And "%description" $ toRegex' "b"] [("date","%csvdate")]]} in testCase "conditional.with-and" $ getEffectiveAssignment rules ["a", "b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher And "%description" $ toRegex' "b", FieldMatcher None "%description" $ toRegex' "c"] [("date","%csvdate")]]} in testCase "conditional.with-and-or" $ getEffectiveAssignment rules ["_", "c"] "date" @?= (Just "%csvdate") ] ] ]
4,472
tests_CsvReader = testGroup "CsvReader" [ testGroup "parseCsvRules" [ testCase "empty file" $ parseCsvRules "unknown" "" @?= Right (mkrules defrules) ] ,testGroup "rulesp" [ testCase "trailing comments" $ parseWithState' defrules rulesp "skip\n# \n#\n" @?= Right (mkrules $ defrules{rdirectives = [("skip","")]}) ,testCase "trailing blank lines" $ parseWithState' defrules rulesp "skip\n\n \n" @?= (Right (mkrules $ defrules{rdirectives = [("skip","")]})) ,testCase "no final newline" $ parseWithState' defrules rulesp "skip" @?= (Right (mkrules $ defrules{rdirectives=[("skip","")]})) ,testCase "assignment with empty value" $ parseWithState' defrules rulesp "account1 \nif foo\n account2 foo\n" @?= (Right (mkrules $ defrules{rassignments = [("account1","")], rconditionalblocks = [CB{cbMatchers=[RecordMatcher None (toRegex' "foo")],cbAssignments=[("account2","foo")]}]})) ] ,testGroup "conditionalblockp" [ testCase "space after conditional" $ -- #1120 parseWithState' defrules conditionalblockp "if a\n account2 b\n \n" @?= (Right $ CB{cbMatchers=[RecordMatcher None $ toRegexCI' "a"],cbAssignments=[("account2","b")]}) ,testGroup "csvfieldreferencep" [ testCase "number" $ parseWithState' defrules csvfieldreferencep "%1" @?= (Right "%1") ,testCase "name" $ parseWithState' defrules csvfieldreferencep "%date" @?= (Right "%date") ,testCase "quoted name" $ parseWithState' defrules csvfieldreferencep "%\"csv date\"" @?= (Right "%\"csv date\"") ] ,testGroup "matcherp" [ testCase "recordmatcherp" $ parseWithState' defrules matcherp "A A\n" @?= (Right $ RecordMatcher None $ toRegexCI' "A A") ,testCase "recordmatcherp.starts-with-&" $ parseWithState' defrules matcherp "& A A\n" @?= (Right $ RecordMatcher And $ toRegexCI' "A A") ,testCase "fieldmatcherp.starts-with-%" $ parseWithState' defrules matcherp "description A A\n" @?= (Right $ RecordMatcher None $ toRegexCI' "description A A") ,testCase "fieldmatcherp" $ parseWithState' defrules matcherp "%description A A\n" @?= (Right $ FieldMatcher None "%description" $ toRegexCI' "A A") ,testCase "fieldmatcherp.starts-with-&" $ parseWithState' defrules matcherp "& %description A A\n" @?= (Right $ FieldMatcher And "%description" $ toRegexCI' "A A") -- ,testCase "fieldmatcherp with operator" $ -- parseWithState' defrules matcherp "%description ~ A A\n" @?= (Right $ FieldMatcher "%description" "A A") ] ,testGroup "getEffectiveAssignment" [ let rules = mkrules $ defrules {rcsvfieldindexes=[("csvdate",1)],rassignments=[("date","%csvdate")]} in testCase "toplevel" $ getEffectiveAssignment rules ["a","b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a"] [("date","%csvdate")]]} in testCase "conditional" $ getEffectiveAssignment rules ["a","b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher None "%description" $ toRegex' "b"] [("date","%csvdate")]]} in testCase "conditional-with-or-a" $ getEffectiveAssignment rules ["a"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher None "%description" $ toRegex' "b"] [("date","%csvdate")]]} in testCase "conditional-with-or-b" $ getEffectiveAssignment rules ["_", "b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher And "%description" $ toRegex' "b"] [("date","%csvdate")]]} in testCase "conditional.with-and" $ getEffectiveAssignment rules ["a", "b"] "date" @?= (Just "%csvdate") ,let rules = mkrules $ defrules{rcsvfieldindexes=[("csvdate",1),("description",2)], rconditionalblocks=[CB [FieldMatcher None "%csvdate" $ toRegex' "a", FieldMatcher And "%description" $ toRegex' "b", FieldMatcher None "%description" $ toRegex' "c"] [("date","%csvdate")]]} in testCase "conditional.with-and-or" $ getEffectiveAssignment rules ["_", "c"] "date" @?= (Just "%csvdate") ] ] ]
4,472
false
false
0
22
701
1,379
731
648
null
null
arne-schroppe/dash
src/Language/Dash/BuiltIn/BuiltInDefinitions.hs
mit
bifStringLengthName = "string_length"
37
bifStringLengthName = "string_length"
37
bifStringLengthName = "string_length"
37
false
false
0
4
2
6
3
3
null
null
nomeata/cryptonite
Crypto/PubKey/RSA.hs
bsd-3-clause
{- -- some bad implementation will not serialize ASN.1 integer properly, leading -- to negative modulus. -- TODO : Find a better place for this toPositive :: Integer -> Integer toPositive int | int < 0 = uintOfBytes $ bytesOfInt int | otherwise = int where uintOfBytes = foldl (\acc n -> (acc `shiftL` 8) + fromIntegral n) 0 bytesOfInt :: Integer -> [Word8] bytesOfInt n = if testBit (head nints) 7 then nints else 0xff : nints where nints = reverse $ plusOne $ reverse $ map complement $ bytesOfUInt (abs n) plusOne [] = [1] plusOne (x:xs) = if x == 0xff then 0 : plusOne xs else (x+1) : xs bytesOfUInt x = reverse (list x) where list i = if i <= 0xff then [fromIntegral i] else (fromIntegral i .&. 0xff) : list (i `shiftR` 8) -} -- | Generate a key pair given p and q. -- -- p and q need to be distinct prime numbers. -- -- e need to be coprime to phi=(p-1)*(q-1). If that's not the -- case, the function will not return a key pair. -- A small hamming weight results in better performance. -- -- * e=0x10001 is a popular choice -- -- * e=3 is popular as well, but proven to not be as secure for some cases. -- generateWith :: (Integer, Integer) -- ^ chosen distinct primes p and q -> Int -- ^ size in bytes -> Integer -- ^ RSA public exponant 'e' -> Maybe (PublicKey, PrivateKey) generateWith (p,q) size e = case inverse e phi of Nothing -> Nothing Just d -> Just (pub,priv d) where n = p*q phi = (p-1)*(q-1) -- q and p should be *distinct* *prime* numbers, hence always coprime qinv = inverseCoprimes q p pub = PublicKey { public_size = size , public_n = n , public_e = e } priv d = PrivateKey { private_pub = pub , private_d = d , private_p = p , private_q = q , private_dP = d `mod` (p-1) , private_dQ = d `mod` (q-1) , private_qinv = qinv } -- | generate a pair of (private, public) key of size in bytes.
2,338
generateWith :: (Integer, Integer) -- ^ chosen distinct primes p and q -> Int -- ^ size in bytes -> Integer -- ^ RSA public exponant 'e' -> Maybe (PublicKey, PrivateKey) generateWith (p,q) size e = case inverse e phi of Nothing -> Nothing Just d -> Just (pub,priv d) where n = p*q phi = (p-1)*(q-1) -- q and p should be *distinct* *prime* numbers, hence always coprime qinv = inverseCoprimes q p pub = PublicKey { public_size = size , public_n = n , public_e = e } priv d = PrivateKey { private_pub = pub , private_d = d , private_p = p , private_q = q , private_dP = d `mod` (p-1) , private_dQ = d `mod` (q-1) , private_qinv = qinv } -- | generate a pair of (private, public) key of size in bytes.
1,117
generateWith (p,q) size e = case inverse e phi of Nothing -> Nothing Just d -> Just (pub,priv d) where n = p*q phi = (p-1)*(q-1) -- q and p should be *distinct* *prime* numbers, hence always coprime qinv = inverseCoprimes q p pub = PublicKey { public_size = size , public_n = n , public_e = e } priv d = PrivateKey { private_pub = pub , private_d = d , private_p = p , private_q = q , private_dP = d `mod` (p-1) , private_dQ = d `mod` (q-1) , private_qinv = qinv } -- | generate a pair of (private, public) key of size in bytes.
882
true
true
7
10
888
284
155
129
null
null
mettekou/ghc
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprBasicBlock :: BlockEnv CmmStatics -> NatBasicBlock Instr -> SDoc pprBasicBlock info_env (BasicBlock blockid instrs) = maybe_infotable $$ pprLabel (mkAsmTempLabel (getUnique blockid)) $$ vcat (map pprInstr instrs) where maybe_infotable = case mapLookup blockid info_env of Nothing -> empty Just (Statics info_lbl info) -> pprAlignForSection Text $$ vcat (map pprData info) $$ pprLabel info_lbl
460
pprBasicBlock :: BlockEnv CmmStatics -> NatBasicBlock Instr -> SDoc pprBasicBlock info_env (BasicBlock blockid instrs) = maybe_infotable $$ pprLabel (mkAsmTempLabel (getUnique blockid)) $$ vcat (map pprInstr instrs) where maybe_infotable = case mapLookup blockid info_env of Nothing -> empty Just (Statics info_lbl info) -> pprAlignForSection Text $$ vcat (map pprData info) $$ pprLabel info_lbl
460
pprBasicBlock info_env (BasicBlock blockid instrs) = maybe_infotable $$ pprLabel (mkAsmTempLabel (getUnique blockid)) $$ vcat (map pprInstr instrs) where maybe_infotable = case mapLookup blockid info_env of Nothing -> empty Just (Statics info_lbl info) -> pprAlignForSection Text $$ vcat (map pprData info) $$ pprLabel info_lbl
392
false
true
0
12
116
141
65
76
null
null
fpco/cabal
Cabal/Distribution/Simple/Program/Db.hs
bsd-3-clause
-- ------------------------------- -- Managing unconfigured programs -- | Add a known program that we may configure later -- addKnownProgram :: Program -> ProgramDb -> ProgramDb addKnownProgram prog = updateUnconfiguredProgs $ Map.insertWith combine (programName prog) (prog, Nothing, []) where combine _ (_, path, args) = (prog, path, args)
346
addKnownProgram :: Program -> ProgramDb -> ProgramDb addKnownProgram prog = updateUnconfiguredProgs $ Map.insertWith combine (programName prog) (prog, Nothing, []) where combine _ (_, path, args) = (prog, path, args)
220
addKnownProgram prog = updateUnconfiguredProgs $ Map.insertWith combine (programName prog) (prog, Nothing, []) where combine _ (_, path, args) = (prog, path, args)
167
true
true
0
8
51
86
49
37
null
null
kelnage/tamarin-prover
lib/theory/src/Theory/Model/Rule.hs
gpl-3.0
unifiableRuleACInsts :: RuleACInst -> RuleACInst -> WithMaude Bool unifiableRuleACInsts ru1 ru2 = (not . null) <$> unifyRuleACInstEqs [Equal ru1 ru2]
153
unifiableRuleACInsts :: RuleACInst -> RuleACInst -> WithMaude Bool unifiableRuleACInsts ru1 ru2 = (not . null) <$> unifyRuleACInstEqs [Equal ru1 ru2]
153
unifiableRuleACInsts ru1 ru2 = (not . null) <$> unifyRuleACInstEqs [Equal ru1 ru2]
86
false
true
0
8
23
49
24
25
null
null
Icelandjack/lens
src/Control/Lens/Fold.hs
bsd-3-clause
-- | Return whether or not none of the elements viewed through an 'IndexedFold' or 'IndexedTraversal' -- satisfy a predicate, with access to the @i@. -- -- When you don't need access to the index then 'noneOf' is more flexible in what it accepts. -- -- @ -- 'noneOf' l ≡ 'inoneOf' l '.' 'const' -- @ -- -- @ -- 'inoneOf' :: 'IndexedGetter' i s a -> (i -> a -> 'Bool') -> s -> 'Bool' -- 'inoneOf' :: 'IndexedFold' i s a -> (i -> a -> 'Bool') -> s -> 'Bool' -- 'inoneOf' :: 'IndexedLens'' i s a -> (i -> a -> 'Bool') -> s -> 'Bool' -- 'inoneOf' :: 'IndexedTraversal'' i s a -> (i -> a -> 'Bool') -> s -> 'Bool' -- @ inoneOf :: IndexedGetting i Any s a -> (i -> a -> Bool) -> s -> Bool inoneOf l = noneOf l .# Indexed
729
inoneOf :: IndexedGetting i Any s a -> (i -> a -> Bool) -> s -> Bool inoneOf l = noneOf l .# Indexed
100
inoneOf l = noneOf l .# Indexed
31
true
true
2
10
168
76
43
33
null
null
mcschroeder/ghc
compiler/stgSyn/StgLint.hs
bsd-3-clause
addLoc :: LintLocInfo -> LintM a -> LintM a addLoc extra_loc m = LintM $ \loc scope errs -> unLintM m (extra_loc:loc) scope errs
131
addLoc :: LintLocInfo -> LintM a -> LintM a addLoc extra_loc m = LintM $ \loc scope errs -> unLintM m (extra_loc:loc) scope errs
131
addLoc extra_loc m = LintM $ \loc scope errs -> unLintM m (extra_loc:loc) scope errs
87
false
true
0
7
26
65
30
35
null
null
loganbraga/hunch
app/Hunch/Options/CommandLine.hs
mit
noChecksOpt :: Parser Bool noChecksOpt = switch $ long "no-check" <> short 'c' <> help "Do not check input for invalid names or not found templates"
165
noChecksOpt :: Parser Bool noChecksOpt = switch $ long "no-check" <> short 'c' <> help "Do not check input for invalid names or not found templates"
165
noChecksOpt = switch $ long "no-check" <> short 'c' <> help "Do not check input for invalid names or not found templates"
138
false
true
6
6
42
44
17
27
null
null
nushio3/ghc
libraries/base/Foreign/C/Error.hs
bsd-3-clause
eBUSY = Errno (CONST_EBUSY)
37
eBUSY = Errno (CONST_EBUSY)
37
eBUSY = Errno (CONST_EBUSY)
37
false
false
0
6
13
12
6
6
null
null
yav/monadlib
tests/DynamicScopeRW.hs
mit
testWStat = runId $ runContT return $ runWriterT $ testW ()
64
testWStat = runId $ runContT return $ runWriterT $ testW ()
64
testWStat = runId $ runContT return $ runWriterT $ testW ()
64
false
false
0
8
15
26
12
14
null
null
DavidAlphaFox/ghc
libraries/Cabal/Cabal/Distribution/Simple/Program/Builtin.hs
bsd-3-clause
ghcProgram :: Program ghcProgram = (simpleProgram "ghc") { programFindVersion = findProgramVersion "--numeric-version" id, -- Workaround for https://ghc.haskell.org/trac/ghc/ticket/8825 -- (spurious warning on non-english locales) programPostConf = \_verbosity ghcProg -> do let ghcProg' = ghcProg { programOverrideEnv = ("LANGUAGE", Just "en") : programOverrideEnv ghcProg } -- Only the 7.8 branch seems to be affected. Fixed in 7.8.4. affectedVersionRange = intersectVersionRanges (laterVersion $ Version [7,8,0] []) (earlierVersion $ Version [7,8,4] []) return $ maybe ghcProg (\v -> if withinRange v affectedVersionRange then ghcProg' else ghcProg) (programVersion ghcProg) }
898
ghcProgram :: Program ghcProgram = (simpleProgram "ghc") { programFindVersion = findProgramVersion "--numeric-version" id, -- Workaround for https://ghc.haskell.org/trac/ghc/ticket/8825 -- (spurious warning on non-english locales) programPostConf = \_verbosity ghcProg -> do let ghcProg' = ghcProg { programOverrideEnv = ("LANGUAGE", Just "en") : programOverrideEnv ghcProg } -- Only the 7.8 branch seems to be affected. Fixed in 7.8.4. affectedVersionRange = intersectVersionRanges (laterVersion $ Version [7,8,0] []) (earlierVersion $ Version [7,8,4] []) return $ maybe ghcProg (\v -> if withinRange v affectedVersionRange then ghcProg' else ghcProg) (programVersion ghcProg) }
898
ghcProgram = (simpleProgram "ghc") { programFindVersion = findProgramVersion "--numeric-version" id, -- Workaround for https://ghc.haskell.org/trac/ghc/ticket/8825 -- (spurious warning on non-english locales) programPostConf = \_verbosity ghcProg -> do let ghcProg' = ghcProg { programOverrideEnv = ("LANGUAGE", Just "en") : programOverrideEnv ghcProg } -- Only the 7.8 branch seems to be affected. Fixed in 7.8.4. affectedVersionRange = intersectVersionRanges (laterVersion $ Version [7,8,0] []) (earlierVersion $ Version [7,8,4] []) return $ maybe ghcProg (\v -> if withinRange v affectedVersionRange then ghcProg' else ghcProg) (programVersion ghcProg) }
876
false
true
0
17
303
176
96
80
null
null
aztek/voogie
src/Voogie/Boogie/Smart.hs
gpl-3.0
assume, assert :: Formula -> Property assume = Assume
53
assume, assert :: Formula -> Property assume = Assume
53
assume = Assume
15
false
true
0
5
8
17
10
7
null
null
text-utf8/text
Data/Text.hs
bsd-2-clause
-- | /O(1)/ Returns the last character of a 'Text', which must be -- non-empty. Subject to fusion. last :: Text -> Char last (Text arr off len) | len <= 0 = emptyError "last" | otherwise = U8.reverseDecodeCharIndex (\c _ -> c) idx (off + len - 1) where idx = A.unsafeIndex arr
308
last :: Text -> Char last (Text arr off len) | len <= 0 = emptyError "last" | otherwise = U8.reverseDecodeCharIndex (\c _ -> c) idx (off + len - 1) where idx = A.unsafeIndex arr
208
last (Text arr off len) | len <= 0 = emptyError "last" | otherwise = U8.reverseDecodeCharIndex (\c _ -> c) idx (off + len - 1) where idx = A.unsafeIndex arr
187
true
true
1
8
85
93
47
46
null
null
vTurbine/ghc
compiler/types/Type.hs
bsd-3-clause
seqTypes (ty:tys) = seqType ty `seq` seqTypes tys
49
seqTypes (ty:tys) = seqType ty `seq` seqTypes tys
49
seqTypes (ty:tys) = seqType ty `seq` seqTypes tys
49
false
false
0
7
7
28
14
14
null
null
svenssonjoel/MonadObsidian
Obsidian/MonadObsidian/GenCuda.hs
bsd-3-clause
-- ----------------------------------------------------------------------------- rename :: Name -> MemoryMap -> Name rename n mm = if (not ("source" `isPrefixOf` n)) then n' else n where (j,at) = case Map.lookup n mm of Nothing -> error $ "error: "++ n ++" not found in MemoryMap" Just a -> a n' = case at of Global_Array t -> "(("++ptrStr t++")(gbase+"++ show j++"))" Shared_Array t -> "(("++ptrStr t++")(sbase+"++ show j++"))" Constant_Array t -> "(("++ptrStr t++")(cbase+"++ show j++"))"
680
rename :: Name -> MemoryMap -> Name rename n mm = if (not ("source" `isPrefixOf` n)) then n' else n where (j,at) = case Map.lookup n mm of Nothing -> error $ "error: "++ n ++" not found in MemoryMap" Just a -> a n' = case at of Global_Array t -> "(("++ptrStr t++")(gbase+"++ show j++"))" Shared_Array t -> "(("++ptrStr t++")(sbase+"++ show j++"))" Constant_Array t -> "(("++ptrStr t++")(cbase+"++ show j++"))"
598
rename n mm = if (not ("source" `isPrefixOf` n)) then n' else n where (j,at) = case Map.lookup n mm of Nothing -> error $ "error: "++ n ++" not found in MemoryMap" Just a -> a n' = case at of Global_Array t -> "(("++ptrStr t++")(gbase+"++ show j++"))" Shared_Array t -> "(("++ptrStr t++")(sbase+"++ show j++"))" Constant_Array t -> "(("++ptrStr t++")(cbase+"++ show j++"))"
562
true
true
0
14
261
202
100
102
null
null
ambiata/zodiac
zodiac-http-client/src/Zodiac/HttpClient/Request.hs
bsd-3-clause
-- | Convert an http-client Request to canonical form for signing or -- verification. toCanonicalRequest :: Request -> Either RequestError CRequest toCanonicalRequest r = -- URI part and query string are both already URL-encoded in http-client. let uri = toCURI $ HC.path r qs = toCQueryString $ HC.queryString r in do method <- reqCMethod r payload <- reqCPayload r headers <- reqCHeaders r pure $ CRequest method uri qs headers payload -- | Canonicalise the request path. The paths "" and "/" are -- semantically identical in HTTP ("" is converted to "/" when -- building the request), so we don't differentiate between them.
646
toCanonicalRequest :: Request -> Either RequestError CRequest toCanonicalRequest r = -- URI part and query string are both already URL-encoded in http-client. let uri = toCURI $ HC.path r qs = toCQueryString $ HC.queryString r in do method <- reqCMethod r payload <- reqCPayload r headers <- reqCHeaders r pure $ CRequest method uri qs headers payload -- | Canonicalise the request path. The paths "" and "/" are -- semantically identical in HTTP ("" is converted to "/" when -- building the request), so we don't differentiate between them.
560
toCanonicalRequest r = -- URI part and query string are both already URL-encoded in http-client. let uri = toCURI $ HC.path r qs = toCQueryString $ HC.queryString r in do method <- reqCMethod r payload <- reqCPayload r headers <- reqCHeaders r pure $ CRequest method uri qs headers payload -- | Canonicalise the request path. The paths "" and "/" are -- semantically identical in HTTP ("" is converted to "/" when -- building the request), so we don't differentiate between them.
498
true
true
0
11
122
111
53
58
null
null
fmapfmapfmap/amazonka
amazonka-codepipeline/gen/Network/AWS/CodePipeline/Types/Product.hs
mpl-2.0
-- | The stage of the pipeline. pcStage :: Lens' PipelineContext (Maybe StageContext) pcStage = lens _pcStage (\ s a -> s{_pcStage = a})
136
pcStage :: Lens' PipelineContext (Maybe StageContext) pcStage = lens _pcStage (\ s a -> s{_pcStage = a})
104
pcStage = lens _pcStage (\ s a -> s{_pcStage = a})
50
true
true
0
9
23
46
25
21
null
null
Velro/sdl2
src/SDL/Raw/Filesystem.hs
bsd-3-clause
rwClose :: MonadIO m => Ptr RWops -> m CInt rwClose v1 = liftIO $ rwCloseFFI v1
79
rwClose :: MonadIO m => Ptr RWops -> m CInt rwClose v1 = liftIO $ rwCloseFFI v1
79
rwClose v1 = liftIO $ rwCloseFFI v1
35
false
true
2
8
16
44
18
26
null
null
flipstone/orville
orville-postgresql/test/WhereConditionTest.hs
mit
-- Order definitions orderTable :: O.TableDefinition Order Order OrderId orderTable = O.mkTableDefinition $ O.TableParams { O.tblName = "order" , O.tblPrimaryKey = O.primaryKey orderIdField , O.tblMapper = Order <$> O.attrField orderId orderIdField <*> O.attrField customerFkId customerFkIdField <*> O.attrField orderName orderNameField , O.tblGetKey = orderId , O.tblSafeToDelete = [] , O.tblComments = O.noComments }
474
orderTable :: O.TableDefinition Order Order OrderId orderTable = O.mkTableDefinition $ O.TableParams { O.tblName = "order" , O.tblPrimaryKey = O.primaryKey orderIdField , O.tblMapper = Order <$> O.attrField orderId orderIdField <*> O.attrField customerFkId customerFkIdField <*> O.attrField orderName orderNameField , O.tblGetKey = orderId , O.tblSafeToDelete = [] , O.tblComments = O.noComments }
453
orderTable = O.mkTableDefinition $ O.TableParams { O.tblName = "order" , O.tblPrimaryKey = O.primaryKey orderIdField , O.tblMapper = Order <$> O.attrField orderId orderIdField <*> O.attrField customerFkId customerFkIdField <*> O.attrField orderName orderNameField , O.tblGetKey = orderId , O.tblSafeToDelete = [] , O.tblComments = O.noComments }
401
true
true
0
12
107
121
65
56
null
null
nikai3d/ce-challenges
easy/sum_digits.hs
bsd-3-clause
main :: IO () main = do [inpFile] <- getArgs input <- readFile inpFile putStr . unlines . map (show . sum . map (read . (:[]))) $ lines input
153
main :: IO () main = do [inpFile] <- getArgs input <- readFile inpFile putStr . unlines . map (show . sum . map (read . (:[]))) $ lines input
153
main = do [inpFile] <- getArgs input <- readFile inpFile putStr . unlines . map (show . sum . map (read . (:[]))) $ lines input
139
false
true
0
16
41
84
41
43
null
null
nc6/cabin
Cabin/Package.hs
bsd-3-clause
findCabinByName :: String -> CabinDB -> Maybe Cabin findCabinByName name = findCabin (\(Cabin name' _) -> name == name')
120
findCabinByName :: String -> CabinDB -> Maybe Cabin findCabinByName name = findCabin (\(Cabin name' _) -> name == name')
120
findCabinByName name = findCabin (\(Cabin name' _) -> name == name')
68
false
true
0
9
18
48
24
24
null
null
vincenthz/hs-foundation
basement/Basement/BoxedArray.hs
bsd-3-clause
arrayType :: DataType arrayType = mkNoRepType "Foundation.Array"
64
arrayType :: DataType arrayType = mkNoRepType "Foundation.Array"
64
arrayType = mkNoRepType "Foundation.Array"
42
false
true
0
5
6
14
7
7
null
null
luzhuomi/cpp-obs
Language/C/Obfuscate/ASTUtils.hs
apache-2.0
endsWithBreak :: [AST.CCompoundBlockItem N.NodeInfo] -> Bool endsWithBreak [] = False
86
endsWithBreak :: [AST.CCompoundBlockItem N.NodeInfo] -> Bool endsWithBreak [] = False
85
endsWithBreak [] = False
24
false
true
0
8
10
30
15
15
null
null
narrative/stack
src/Stack/Init.hs
bsd-3-clause
checkBundleResolver :: ( MonadBaseControl IO m, MonadIO m, MonadLogger m, MonadMask m , MonadReader env m, HasConfig env , HasGHCVariant env , HasHttpManager env , HasLogLevel env , HasReExec env , HasTerminal env) => Path Abs File -- ^ stack.yaml -> InitOpts -> Map PackageName (Path Abs File, C.GenericPackageDescription) -- ^ Src package name: cabal dir, cabal package description -> Resolver -> m (Either [PackageName] ( Map PackageName (Map FlagName Bool) , Map PackageName Version)) checkBundleResolver stackYaml initOpts bundle resolver = do result <- checkResolverSpec gpds Nothing resolver case result of BuildPlanCheckOk f -> return $ Right (f, Map.empty) BuildPlanCheckPartial f e | needSolver resolver initOpts -> do warnPartial result solve f | omitPackages initOpts -> do warnPartial result $logWarn "*** Omitting packages with unsatisfied dependencies" return $ Left $ failedUserPkgs e | otherwise -> throwM $ ResolverPartial resolver (show result) BuildPlanCheckFail _ e _ | omitPackages initOpts -> do $logWarn $ "*** Resolver compiler mismatch: " <> resolverName resolver $logWarn $ indent $ T.pack $ show result return $ Left $ failedUserPkgs e | otherwise -> throwM $ ResolverMismatch resolver (show result) where indent t = T.unlines $ fmap (" " <>) (T.lines t) warnPartial res = do $logWarn $ "*** Resolver " <> resolverName resolver <> " will need external packages: " $logWarn $ indent $ T.pack $ show res failedUserPkgs e = Map.keys $ Map.unions (Map.elems (fmap deNeededBy e)) gpds = Map.elems (fmap snd bundle) solve flags = do let cabalDirs = map parent (Map.elems (fmap fst bundle)) srcConstraints = mergeConstraints (gpdPackages gpds) flags eresult <- solveResolverSpec stackYaml cabalDirs (resolver, srcConstraints, Map.empty) case eresult of Right (src, ext) -> return $ Right (fmap snd (Map.union src ext), fmap fst ext) Left packages | omitPackages initOpts, srcpkgs /= []-> do pkg <- findOneIndependent srcpkgs flags return $ Left [pkg] | otherwise -> throwM (SolverGiveUp giveUpMsg) where srcpkgs = intersect (Map.keys bundle) packages -- among a list of packages find one on which none among the rest of the -- packages depend. This package is a good candidate to be removed from -- the list of packages when there is conflict in dependencies among this -- set of packages. findOneIndependent packages flags = do platform <- asks (configPlatform . getConfig) (compiler, _) <- getResolverConstraints stackYaml resolver let getGpd pkg = snd (fromJust (Map.lookup pkg bundle)) getFlags pkg = fromJust (Map.lookup pkg flags) deps pkg = gpdPackageDeps (getGpd pkg) compiler platform (getFlags pkg) allDeps = concat $ map (Map.keys . deps) packages isIndependent pkg = not $ pkg `elem` allDeps -- prefer to reject packages in deeper directories path pkg = fst (fromJust (Map.lookup pkg bundle)) pathlen = length . FP.splitPath . toFilePath . path maxPathlen = maximumBy (compare `on` pathlen) return $ maxPathlen (filter isIndependent packages) giveUpMsg = concat [ " - Use '--omit-packages to exclude conflicting package(s).\n" , " - Tweak the generated " , toFilePath stackDotYaml <> " and then run 'stack solver':\n" , " - Add any missing remote packages.\n" , " - Add extra dependencies to guide solver.\n" , " - Update external packages with 'stack update' and try again.\n" ] needSolver _ (InitOpts {useSolver = True}) = True needSolver (ResolverCompiler _) _ = True needSolver _ _ = False
4,425
checkBundleResolver :: ( MonadBaseControl IO m, MonadIO m, MonadLogger m, MonadMask m , MonadReader env m, HasConfig env , HasGHCVariant env , HasHttpManager env , HasLogLevel env , HasReExec env , HasTerminal env) => Path Abs File -- ^ stack.yaml -> InitOpts -> Map PackageName (Path Abs File, C.GenericPackageDescription) -- ^ Src package name: cabal dir, cabal package description -> Resolver -> m (Either [PackageName] ( Map PackageName (Map FlagName Bool) , Map PackageName Version)) checkBundleResolver stackYaml initOpts bundle resolver = do result <- checkResolverSpec gpds Nothing resolver case result of BuildPlanCheckOk f -> return $ Right (f, Map.empty) BuildPlanCheckPartial f e | needSolver resolver initOpts -> do warnPartial result solve f | omitPackages initOpts -> do warnPartial result $logWarn "*** Omitting packages with unsatisfied dependencies" return $ Left $ failedUserPkgs e | otherwise -> throwM $ ResolverPartial resolver (show result) BuildPlanCheckFail _ e _ | omitPackages initOpts -> do $logWarn $ "*** Resolver compiler mismatch: " <> resolverName resolver $logWarn $ indent $ T.pack $ show result return $ Left $ failedUserPkgs e | otherwise -> throwM $ ResolverMismatch resolver (show result) where indent t = T.unlines $ fmap (" " <>) (T.lines t) warnPartial res = do $logWarn $ "*** Resolver " <> resolverName resolver <> " will need external packages: " $logWarn $ indent $ T.pack $ show res failedUserPkgs e = Map.keys $ Map.unions (Map.elems (fmap deNeededBy e)) gpds = Map.elems (fmap snd bundle) solve flags = do let cabalDirs = map parent (Map.elems (fmap fst bundle)) srcConstraints = mergeConstraints (gpdPackages gpds) flags eresult <- solveResolverSpec stackYaml cabalDirs (resolver, srcConstraints, Map.empty) case eresult of Right (src, ext) -> return $ Right (fmap snd (Map.union src ext), fmap fst ext) Left packages | omitPackages initOpts, srcpkgs /= []-> do pkg <- findOneIndependent srcpkgs flags return $ Left [pkg] | otherwise -> throwM (SolverGiveUp giveUpMsg) where srcpkgs = intersect (Map.keys bundle) packages -- among a list of packages find one on which none among the rest of the -- packages depend. This package is a good candidate to be removed from -- the list of packages when there is conflict in dependencies among this -- set of packages. findOneIndependent packages flags = do platform <- asks (configPlatform . getConfig) (compiler, _) <- getResolverConstraints stackYaml resolver let getGpd pkg = snd (fromJust (Map.lookup pkg bundle)) getFlags pkg = fromJust (Map.lookup pkg flags) deps pkg = gpdPackageDeps (getGpd pkg) compiler platform (getFlags pkg) allDeps = concat $ map (Map.keys . deps) packages isIndependent pkg = not $ pkg `elem` allDeps -- prefer to reject packages in deeper directories path pkg = fst (fromJust (Map.lookup pkg bundle)) pathlen = length . FP.splitPath . toFilePath . path maxPathlen = maximumBy (compare `on` pathlen) return $ maxPathlen (filter isIndependent packages) giveUpMsg = concat [ " - Use '--omit-packages to exclude conflicting package(s).\n" , " - Tweak the generated " , toFilePath stackDotYaml <> " and then run 'stack solver':\n" , " - Add any missing remote packages.\n" , " - Add extra dependencies to guide solver.\n" , " - Update external packages with 'stack update' and try again.\n" ] needSolver _ (InitOpts {useSolver = True}) = True needSolver (ResolverCompiler _) _ = True needSolver _ _ = False
4,425
checkBundleResolver stackYaml initOpts bundle resolver = do result <- checkResolverSpec gpds Nothing resolver case result of BuildPlanCheckOk f -> return $ Right (f, Map.empty) BuildPlanCheckPartial f e | needSolver resolver initOpts -> do warnPartial result solve f | omitPackages initOpts -> do warnPartial result $logWarn "*** Omitting packages with unsatisfied dependencies" return $ Left $ failedUserPkgs e | otherwise -> throwM $ ResolverPartial resolver (show result) BuildPlanCheckFail _ e _ | omitPackages initOpts -> do $logWarn $ "*** Resolver compiler mismatch: " <> resolverName resolver $logWarn $ indent $ T.pack $ show result return $ Left $ failedUserPkgs e | otherwise -> throwM $ ResolverMismatch resolver (show result) where indent t = T.unlines $ fmap (" " <>) (T.lines t) warnPartial res = do $logWarn $ "*** Resolver " <> resolverName resolver <> " will need external packages: " $logWarn $ indent $ T.pack $ show res failedUserPkgs e = Map.keys $ Map.unions (Map.elems (fmap deNeededBy e)) gpds = Map.elems (fmap snd bundle) solve flags = do let cabalDirs = map parent (Map.elems (fmap fst bundle)) srcConstraints = mergeConstraints (gpdPackages gpds) flags eresult <- solveResolverSpec stackYaml cabalDirs (resolver, srcConstraints, Map.empty) case eresult of Right (src, ext) -> return $ Right (fmap snd (Map.union src ext), fmap fst ext) Left packages | omitPackages initOpts, srcpkgs /= []-> do pkg <- findOneIndependent srcpkgs flags return $ Left [pkg] | otherwise -> throwM (SolverGiveUp giveUpMsg) where srcpkgs = intersect (Map.keys bundle) packages -- among a list of packages find one on which none among the rest of the -- packages depend. This package is a good candidate to be removed from -- the list of packages when there is conflict in dependencies among this -- set of packages. findOneIndependent packages flags = do platform <- asks (configPlatform . getConfig) (compiler, _) <- getResolverConstraints stackYaml resolver let getGpd pkg = snd (fromJust (Map.lookup pkg bundle)) getFlags pkg = fromJust (Map.lookup pkg flags) deps pkg = gpdPackageDeps (getGpd pkg) compiler platform (getFlags pkg) allDeps = concat $ map (Map.keys . deps) packages isIndependent pkg = not $ pkg `elem` allDeps -- prefer to reject packages in deeper directories path pkg = fst (fromJust (Map.lookup pkg bundle)) pathlen = length . FP.splitPath . toFilePath . path maxPathlen = maximumBy (compare `on` pathlen) return $ maxPathlen (filter isIndependent packages) giveUpMsg = concat [ " - Use '--omit-packages to exclude conflicting package(s).\n" , " - Tweak the generated " , toFilePath stackDotYaml <> " and then run 'stack solver':\n" , " - Add any missing remote packages.\n" , " - Add extra dependencies to guide solver.\n" , " - Update external packages with 'stack update' and try again.\n" ] needSolver _ (InitOpts {useSolver = True}) = True needSolver (ResolverCompiler _) _ = True needSolver _ _ = False
3,851
false
true
7
17
1,533
1,123
532
591
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_TRANSFORM_BIT :: GLbitfield gl_TRANSFORM_BIT = 0x00001000
60
gl_TRANSFORM_BIT :: GLbitfield gl_TRANSFORM_BIT = 0x00001000
60
gl_TRANSFORM_BIT = 0x00001000
29
false
true
0
4
5
11
6
5
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_445 x = happyTcHack x happyReduce_267
44
action_445 x = happyTcHack x happyReduce_267
44
action_445 x = happyTcHack x happyReduce_267
44
false
false
0
5
5
14
6
8
null
null
spechub/Hets
THF/Utils.hs
gpl-2.0
thfMappingTypeToType :: [THFUnitaryType] -> Maybe Type thfMappingTypeToType [] = Nothing
88
thfMappingTypeToType :: [THFUnitaryType] -> Maybe Type thfMappingTypeToType [] = Nothing
88
thfMappingTypeToType [] = Nothing
33
false
true
0
6
9
26
13
13
null
null
jacekszymanski/wxHaskell
samples/wx/TimeFlowsEx.hs
lgpl-2.1
-- | Return the mouse position at a certain time. posAtTime :: Time -> History -> Point posAtTime _time [(_t,pos)] = pos
122
posAtTime :: Time -> History -> Point posAtTime _time [(_t,pos)] = pos
72
posAtTime _time [(_t,pos)] = pos
34
true
true
0
7
23
34
19
15
null
null
flannelhead/flannelhead.github.io
site.hs
bsd-3-clause
main :: IO () main = hakyll $ do let pandocMathCompiler = let pandocOptions = defaultHakyllWriterOptions { writerHTMLMathMethod = MathJax "" } in pandocCompilerWith defaultHakyllReaderOptions pandocOptions match "images/*" $ do route idRoute compile copyFileCompiler match "css/*" $ do route idRoute compile compressCssCompiler match (fromList ["about.md"]) $ do route $ setExtension "html" compile $ pandocCompiler >>= loadAndApplyTemplate "templates/default.html" defaultContext >>= relativizeUrls match "posts/*" $ do route $ setExtension "html" compile $ pandocMathCompiler >>= loadAndApplyTemplate "templates/post.html" postCtx >>= loadAndApplyTemplate "templates/default.html" postCtx >>= relativizeUrls match "index.html" $ do route idRoute compile $ do posts <- recentFirst =<< loadAll "posts/*" let indexCtx = listField "posts" postCtx (return posts) <> defaultContext getResourceBody >>= applyAsTemplate indexCtx >>= loadAndApplyTemplate "templates/default.html" indexCtx >>= relativizeUrls match "templates/*" $ compile templateCompiler version "redirects" $ createRedirects brokenLinks
1,454
main :: IO () main = hakyll $ do let pandocMathCompiler = let pandocOptions = defaultHakyllWriterOptions { writerHTMLMathMethod = MathJax "" } in pandocCompilerWith defaultHakyllReaderOptions pandocOptions match "images/*" $ do route idRoute compile copyFileCompiler match "css/*" $ do route idRoute compile compressCssCompiler match (fromList ["about.md"]) $ do route $ setExtension "html" compile $ pandocCompiler >>= loadAndApplyTemplate "templates/default.html" defaultContext >>= relativizeUrls match "posts/*" $ do route $ setExtension "html" compile $ pandocMathCompiler >>= loadAndApplyTemplate "templates/post.html" postCtx >>= loadAndApplyTemplate "templates/default.html" postCtx >>= relativizeUrls match "index.html" $ do route idRoute compile $ do posts <- recentFirst =<< loadAll "posts/*" let indexCtx = listField "posts" postCtx (return posts) <> defaultContext getResourceBody >>= applyAsTemplate indexCtx >>= loadAndApplyTemplate "templates/default.html" indexCtx >>= relativizeUrls match "templates/*" $ compile templateCompiler version "redirects" $ createRedirects brokenLinks
1,454
main = hakyll $ do let pandocMathCompiler = let pandocOptions = defaultHakyllWriterOptions { writerHTMLMathMethod = MathJax "" } in pandocCompilerWith defaultHakyllReaderOptions pandocOptions match "images/*" $ do route idRoute compile copyFileCompiler match "css/*" $ do route idRoute compile compressCssCompiler match (fromList ["about.md"]) $ do route $ setExtension "html" compile $ pandocCompiler >>= loadAndApplyTemplate "templates/default.html" defaultContext >>= relativizeUrls match "posts/*" $ do route $ setExtension "html" compile $ pandocMathCompiler >>= loadAndApplyTemplate "templates/post.html" postCtx >>= loadAndApplyTemplate "templates/default.html" postCtx >>= relativizeUrls match "index.html" $ do route idRoute compile $ do posts <- recentFirst =<< loadAll "posts/*" let indexCtx = listField "posts" postCtx (return posts) <> defaultContext getResourceBody >>= applyAsTemplate indexCtx >>= loadAndApplyTemplate "templates/default.html" indexCtx >>= relativizeUrls match "templates/*" $ compile templateCompiler version "redirects" $ createRedirects brokenLinks
1,440
false
true
2
20
482
317
134
183
null
null
TomMD/ghc
utils/deriveConstants/DeriveConstants.hs
bsd-3-clause
getWanted :: Bool -> FilePath -> FilePath -> [String] -> FilePath -> IO Results getWanted verbose tmpdir gccProgram gccFlags nmProgram = do let cStuff = unlines (headers ++ concatMap (doWanted . snd) wanteds) cFile = tmpdir </> "tmp.c" oFile = tmpdir </> "tmp.o" writeFile cFile cStuff execute verbose gccProgram (gccFlags ++ ["-c", cFile, "-o", oFile]) xs <- case os of "openbsd" -> readProcess "/usr/bin/objdump" ["--syms", oFile] "" _ -> readProcess nmProgram ["-P", oFile] "" let ls = lines xs ms = map parseNmLine ls m = Map.fromList $ catMaybes ms rs <- mapM (lookupResult m) wanteds return rs where headers = ["#define IN_STG_CODE 0", "", "/*", " * We need offsets of profiled things...", " * better be careful that this doesn't", " * affect the offsets of anything else.", " */", "", "#define PROFILING", "#define THREADED_RTS", "", "#include \"PosixSource.h\"", "#include \"Rts.h\"", "#include \"Stable.h\"", "#include \"Capability.h\"", "", "#include <inttypes.h>", "#include <stddef.h>", "#include <stdio.h>", "#include <string.h>", "", "#define FIELD_SIZE(s_type, field) ((size_t)sizeof(((s_type*)0)->field))", "#define TYPE_SIZE(type) (sizeof(type))", "#define FUN_OFFSET(sym) (offsetof(Capability,f.sym) - offsetof(Capability,r))", "", "#pragma GCC poison sizeof" ] prefix = "derivedConstant" mkFullName name = prefix ++ name -- We add 1 to the value, as some platforms will make a symbol -- of size 1 when for -- char foo[0]; -- We then subtract 1 again when parsing. doWanted (GetFieldType name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "[1 + " ++ cExpr ++ "];"] doWanted (GetClosureSize name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "[1 + " ++ cExpr ++ "];"] doWanted (GetWord name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "[1 + " ++ cExpr ++ "];"] doWanted (GetInt name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "Mag[1 + ((intptr_t)(" ++ cExpr ++ ") >= 0 ? (" ++ cExpr ++ ") : -(" ++ cExpr ++ "))];", "char " ++ mkFullName name ++ "Sig[(intptr_t)(" ++ cExpr ++ ") >= 0 ? 3 : 1];"] doWanted (GetNatural name (Fst (CExpr cExpr))) = -- These casts fix "right shift count >= width of type" -- warnings let cExpr' = "(uint64_t)(size_t)(" ++ cExpr ++ ")" in ["char " ++ mkFullName name ++ "0[1 + ((" ++ cExpr' ++ ") & 0xFFFF)];", "char " ++ mkFullName name ++ "1[1 + (((" ++ cExpr' ++ ") >> 16) & 0xFFFF)];", "char " ++ mkFullName name ++ "2[1 + (((" ++ cExpr' ++ ") >> 32) & 0xFFFF)];", "char " ++ mkFullName name ++ "3[1 + (((" ++ cExpr' ++ ") >> 48) & 0xFFFF)];"] doWanted (GetBool name (Fst (CPPExpr cppExpr))) = ["#if " ++ cppExpr, "char " ++ mkFullName name ++ "[1];", "#else", "char " ++ mkFullName name ++ "[2];", "#endif"] doWanted (StructFieldMacro {}) = [] doWanted (ClosureFieldMacro {}) = [] doWanted (ClosurePayloadMacro {}) = [] doWanted (FieldTypeGcptrMacro {}) = [] -- parseNmLine parses "nm -P" output that looks like -- "derivedConstantMAX_Vanilla_REG C 0000000b 0000000b" (GNU nm) -- "_derivedConstantMAX_Vanilla_REG C b 0" (Mac OS X) -- "_derivedConstantMAX_Vanilla_REG C 000000b" (MinGW) -- "derivedConstantMAX_Vanilla_REG D 1 b" (Solaris) -- and returns ("MAX_Vanilla_REG", 11) parseNmLine line = case words line of ('_' : n) : "C" : s : _ -> mkP n s n : "C" : s : _ -> mkP n s [n, "D", _, s] -> mkP n s [s, "O", "*COM*", _, n] -> mkP n s _ -> Nothing where mkP r s = case (stripPrefix prefix r, readHex s) of (Just name, [(size, "")]) -> Just (name, size) _ -> Nothing -- If an Int value is larger than 2^28 or smaller -- than -2^28, then fail. -- This test is a bit conservative, but if any -- constants are roughly maxBound or minBound then -- we probably need them to be Integer rather than -- Int so that -- cross-compiling between 32bit and -- 64bit platforms works. lookupSmall :: Map String Integer -> Name -> IO Integer lookupSmall m name = case Map.lookup name m of Just v | v > 2^(28 :: Int) || v < -(2^(28 :: Int)) -> die ("Value too large for GetWord: " ++ show v) | otherwise -> return v Nothing -> die ("Can't find " ++ show name) lookupResult :: Map String Integer -> (Where, What Fst) -> IO (Where, What Snd) lookupResult m (w, GetWord name _) = do v <- lookupSmall m name return (w, GetWord name (Snd (v - 1))) lookupResult m (w, GetInt name _) = do mag <- lookupSmall m (name ++ "Mag") sig <- lookupSmall m (name ++ "Sig") return (w, GetWord name (Snd ((mag - 1) * (sig - 2)))) lookupResult m (w, GetNatural name _) = do v0 <- lookupSmall m (name ++ "0") v1 <- lookupSmall m (name ++ "1") v2 <- lookupSmall m (name ++ "2") v3 <- lookupSmall m (name ++ "3") let v = (v0 - 1) + shiftL (v1 - 1) 16 + shiftL (v2 - 1) 32 + shiftL (v3 - 1) 48 return (w, GetWord name (Snd v)) lookupResult m (w, GetBool name _) = do v <- lookupSmall m name case v of 1 -> return (w, GetBool name (Snd True)) 2 -> return (w, GetBool name (Snd False)) _ -> die ("Bad boolean: " ++ show v) lookupResult m (w, GetFieldType name _) = do v <- lookupSmall m name return (w, GetFieldType name (Snd (v - 1))) lookupResult m (w, GetClosureSize name _) = do v <- lookupSmall m name return (w, GetClosureSize name (Snd (v - 1))) lookupResult _ (w, StructFieldMacro name) = return (w, StructFieldMacro name) lookupResult _ (w, ClosureFieldMacro name) = return (w, ClosureFieldMacro name) lookupResult _ (w, ClosurePayloadMacro name) = return (w, ClosurePayloadMacro name) lookupResult _ (w, FieldTypeGcptrMacro name) = return (w, FieldTypeGcptrMacro name)
7,649
getWanted :: Bool -> FilePath -> FilePath -> [String] -> FilePath -> IO Results getWanted verbose tmpdir gccProgram gccFlags nmProgram = do let cStuff = unlines (headers ++ concatMap (doWanted . snd) wanteds) cFile = tmpdir </> "tmp.c" oFile = tmpdir </> "tmp.o" writeFile cFile cStuff execute verbose gccProgram (gccFlags ++ ["-c", cFile, "-o", oFile]) xs <- case os of "openbsd" -> readProcess "/usr/bin/objdump" ["--syms", oFile] "" _ -> readProcess nmProgram ["-P", oFile] "" let ls = lines xs ms = map parseNmLine ls m = Map.fromList $ catMaybes ms rs <- mapM (lookupResult m) wanteds return rs where headers = ["#define IN_STG_CODE 0", "", "/*", " * We need offsets of profiled things...", " * better be careful that this doesn't", " * affect the offsets of anything else.", " */", "", "#define PROFILING", "#define THREADED_RTS", "", "#include \"PosixSource.h\"", "#include \"Rts.h\"", "#include \"Stable.h\"", "#include \"Capability.h\"", "", "#include <inttypes.h>", "#include <stddef.h>", "#include <stdio.h>", "#include <string.h>", "", "#define FIELD_SIZE(s_type, field) ((size_t)sizeof(((s_type*)0)->field))", "#define TYPE_SIZE(type) (sizeof(type))", "#define FUN_OFFSET(sym) (offsetof(Capability,f.sym) - offsetof(Capability,r))", "", "#pragma GCC poison sizeof" ] prefix = "derivedConstant" mkFullName name = prefix ++ name -- We add 1 to the value, as some platforms will make a symbol -- of size 1 when for -- char foo[0]; -- We then subtract 1 again when parsing. doWanted (GetFieldType name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "[1 + " ++ cExpr ++ "];"] doWanted (GetClosureSize name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "[1 + " ++ cExpr ++ "];"] doWanted (GetWord name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "[1 + " ++ cExpr ++ "];"] doWanted (GetInt name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "Mag[1 + ((intptr_t)(" ++ cExpr ++ ") >= 0 ? (" ++ cExpr ++ ") : -(" ++ cExpr ++ "))];", "char " ++ mkFullName name ++ "Sig[(intptr_t)(" ++ cExpr ++ ") >= 0 ? 3 : 1];"] doWanted (GetNatural name (Fst (CExpr cExpr))) = -- These casts fix "right shift count >= width of type" -- warnings let cExpr' = "(uint64_t)(size_t)(" ++ cExpr ++ ")" in ["char " ++ mkFullName name ++ "0[1 + ((" ++ cExpr' ++ ") & 0xFFFF)];", "char " ++ mkFullName name ++ "1[1 + (((" ++ cExpr' ++ ") >> 16) & 0xFFFF)];", "char " ++ mkFullName name ++ "2[1 + (((" ++ cExpr' ++ ") >> 32) & 0xFFFF)];", "char " ++ mkFullName name ++ "3[1 + (((" ++ cExpr' ++ ") >> 48) & 0xFFFF)];"] doWanted (GetBool name (Fst (CPPExpr cppExpr))) = ["#if " ++ cppExpr, "char " ++ mkFullName name ++ "[1];", "#else", "char " ++ mkFullName name ++ "[2];", "#endif"] doWanted (StructFieldMacro {}) = [] doWanted (ClosureFieldMacro {}) = [] doWanted (ClosurePayloadMacro {}) = [] doWanted (FieldTypeGcptrMacro {}) = [] -- parseNmLine parses "nm -P" output that looks like -- "derivedConstantMAX_Vanilla_REG C 0000000b 0000000b" (GNU nm) -- "_derivedConstantMAX_Vanilla_REG C b 0" (Mac OS X) -- "_derivedConstantMAX_Vanilla_REG C 000000b" (MinGW) -- "derivedConstantMAX_Vanilla_REG D 1 b" (Solaris) -- and returns ("MAX_Vanilla_REG", 11) parseNmLine line = case words line of ('_' : n) : "C" : s : _ -> mkP n s n : "C" : s : _ -> mkP n s [n, "D", _, s] -> mkP n s [s, "O", "*COM*", _, n] -> mkP n s _ -> Nothing where mkP r s = case (stripPrefix prefix r, readHex s) of (Just name, [(size, "")]) -> Just (name, size) _ -> Nothing -- If an Int value is larger than 2^28 or smaller -- than -2^28, then fail. -- This test is a bit conservative, but if any -- constants are roughly maxBound or minBound then -- we probably need them to be Integer rather than -- Int so that -- cross-compiling between 32bit and -- 64bit platforms works. lookupSmall :: Map String Integer -> Name -> IO Integer lookupSmall m name = case Map.lookup name m of Just v | v > 2^(28 :: Int) || v < -(2^(28 :: Int)) -> die ("Value too large for GetWord: " ++ show v) | otherwise -> return v Nothing -> die ("Can't find " ++ show name) lookupResult :: Map String Integer -> (Where, What Fst) -> IO (Where, What Snd) lookupResult m (w, GetWord name _) = do v <- lookupSmall m name return (w, GetWord name (Snd (v - 1))) lookupResult m (w, GetInt name _) = do mag <- lookupSmall m (name ++ "Mag") sig <- lookupSmall m (name ++ "Sig") return (w, GetWord name (Snd ((mag - 1) * (sig - 2)))) lookupResult m (w, GetNatural name _) = do v0 <- lookupSmall m (name ++ "0") v1 <- lookupSmall m (name ++ "1") v2 <- lookupSmall m (name ++ "2") v3 <- lookupSmall m (name ++ "3") let v = (v0 - 1) + shiftL (v1 - 1) 16 + shiftL (v2 - 1) 32 + shiftL (v3 - 1) 48 return (w, GetWord name (Snd v)) lookupResult m (w, GetBool name _) = do v <- lookupSmall m name case v of 1 -> return (w, GetBool name (Snd True)) 2 -> return (w, GetBool name (Snd False)) _ -> die ("Bad boolean: " ++ show v) lookupResult m (w, GetFieldType name _) = do v <- lookupSmall m name return (w, GetFieldType name (Snd (v - 1))) lookupResult m (w, GetClosureSize name _) = do v <- lookupSmall m name return (w, GetClosureSize name (Snd (v - 1))) lookupResult _ (w, StructFieldMacro name) = return (w, StructFieldMacro name) lookupResult _ (w, ClosureFieldMacro name) = return (w, ClosureFieldMacro name) lookupResult _ (w, ClosurePayloadMacro name) = return (w, ClosurePayloadMacro name) lookupResult _ (w, FieldTypeGcptrMacro name) = return (w, FieldTypeGcptrMacro name)
7,649
getWanted verbose tmpdir gccProgram gccFlags nmProgram = do let cStuff = unlines (headers ++ concatMap (doWanted . snd) wanteds) cFile = tmpdir </> "tmp.c" oFile = tmpdir </> "tmp.o" writeFile cFile cStuff execute verbose gccProgram (gccFlags ++ ["-c", cFile, "-o", oFile]) xs <- case os of "openbsd" -> readProcess "/usr/bin/objdump" ["--syms", oFile] "" _ -> readProcess nmProgram ["-P", oFile] "" let ls = lines xs ms = map parseNmLine ls m = Map.fromList $ catMaybes ms rs <- mapM (lookupResult m) wanteds return rs where headers = ["#define IN_STG_CODE 0", "", "/*", " * We need offsets of profiled things...", " * better be careful that this doesn't", " * affect the offsets of anything else.", " */", "", "#define PROFILING", "#define THREADED_RTS", "", "#include \"PosixSource.h\"", "#include \"Rts.h\"", "#include \"Stable.h\"", "#include \"Capability.h\"", "", "#include <inttypes.h>", "#include <stddef.h>", "#include <stdio.h>", "#include <string.h>", "", "#define FIELD_SIZE(s_type, field) ((size_t)sizeof(((s_type*)0)->field))", "#define TYPE_SIZE(type) (sizeof(type))", "#define FUN_OFFSET(sym) (offsetof(Capability,f.sym) - offsetof(Capability,r))", "", "#pragma GCC poison sizeof" ] prefix = "derivedConstant" mkFullName name = prefix ++ name -- We add 1 to the value, as some platforms will make a symbol -- of size 1 when for -- char foo[0]; -- We then subtract 1 again when parsing. doWanted (GetFieldType name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "[1 + " ++ cExpr ++ "];"] doWanted (GetClosureSize name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "[1 + " ++ cExpr ++ "];"] doWanted (GetWord name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "[1 + " ++ cExpr ++ "];"] doWanted (GetInt name (Fst (CExpr cExpr))) = ["char " ++ mkFullName name ++ "Mag[1 + ((intptr_t)(" ++ cExpr ++ ") >= 0 ? (" ++ cExpr ++ ") : -(" ++ cExpr ++ "))];", "char " ++ mkFullName name ++ "Sig[(intptr_t)(" ++ cExpr ++ ") >= 0 ? 3 : 1];"] doWanted (GetNatural name (Fst (CExpr cExpr))) = -- These casts fix "right shift count >= width of type" -- warnings let cExpr' = "(uint64_t)(size_t)(" ++ cExpr ++ ")" in ["char " ++ mkFullName name ++ "0[1 + ((" ++ cExpr' ++ ") & 0xFFFF)];", "char " ++ mkFullName name ++ "1[1 + (((" ++ cExpr' ++ ") >> 16) & 0xFFFF)];", "char " ++ mkFullName name ++ "2[1 + (((" ++ cExpr' ++ ") >> 32) & 0xFFFF)];", "char " ++ mkFullName name ++ "3[1 + (((" ++ cExpr' ++ ") >> 48) & 0xFFFF)];"] doWanted (GetBool name (Fst (CPPExpr cppExpr))) = ["#if " ++ cppExpr, "char " ++ mkFullName name ++ "[1];", "#else", "char " ++ mkFullName name ++ "[2];", "#endif"] doWanted (StructFieldMacro {}) = [] doWanted (ClosureFieldMacro {}) = [] doWanted (ClosurePayloadMacro {}) = [] doWanted (FieldTypeGcptrMacro {}) = [] -- parseNmLine parses "nm -P" output that looks like -- "derivedConstantMAX_Vanilla_REG C 0000000b 0000000b" (GNU nm) -- "_derivedConstantMAX_Vanilla_REG C b 0" (Mac OS X) -- "_derivedConstantMAX_Vanilla_REG C 000000b" (MinGW) -- "derivedConstantMAX_Vanilla_REG D 1 b" (Solaris) -- and returns ("MAX_Vanilla_REG", 11) parseNmLine line = case words line of ('_' : n) : "C" : s : _ -> mkP n s n : "C" : s : _ -> mkP n s [n, "D", _, s] -> mkP n s [s, "O", "*COM*", _, n] -> mkP n s _ -> Nothing where mkP r s = case (stripPrefix prefix r, readHex s) of (Just name, [(size, "")]) -> Just (name, size) _ -> Nothing -- If an Int value is larger than 2^28 or smaller -- than -2^28, then fail. -- This test is a bit conservative, but if any -- constants are roughly maxBound or minBound then -- we probably need them to be Integer rather than -- Int so that -- cross-compiling between 32bit and -- 64bit platforms works. lookupSmall :: Map String Integer -> Name -> IO Integer lookupSmall m name = case Map.lookup name m of Just v | v > 2^(28 :: Int) || v < -(2^(28 :: Int)) -> die ("Value too large for GetWord: " ++ show v) | otherwise -> return v Nothing -> die ("Can't find " ++ show name) lookupResult :: Map String Integer -> (Where, What Fst) -> IO (Where, What Snd) lookupResult m (w, GetWord name _) = do v <- lookupSmall m name return (w, GetWord name (Snd (v - 1))) lookupResult m (w, GetInt name _) = do mag <- lookupSmall m (name ++ "Mag") sig <- lookupSmall m (name ++ "Sig") return (w, GetWord name (Snd ((mag - 1) * (sig - 2)))) lookupResult m (w, GetNatural name _) = do v0 <- lookupSmall m (name ++ "0") v1 <- lookupSmall m (name ++ "1") v2 <- lookupSmall m (name ++ "2") v3 <- lookupSmall m (name ++ "3") let v = (v0 - 1) + shiftL (v1 - 1) 16 + shiftL (v2 - 1) 32 + shiftL (v3 - 1) 48 return (w, GetWord name (Snd v)) lookupResult m (w, GetBool name _) = do v <- lookupSmall m name case v of 1 -> return (w, GetBool name (Snd True)) 2 -> return (w, GetBool name (Snd False)) _ -> die ("Bad boolean: " ++ show v) lookupResult m (w, GetFieldType name _) = do v <- lookupSmall m name return (w, GetFieldType name (Snd (v - 1))) lookupResult m (w, GetClosureSize name _) = do v <- lookupSmall m name return (w, GetClosureSize name (Snd (v - 1))) lookupResult _ (w, StructFieldMacro name) = return (w, StructFieldMacro name) lookupResult _ (w, ClosureFieldMacro name) = return (w, ClosureFieldMacro name) lookupResult _ (w, ClosurePayloadMacro name) = return (w, ClosurePayloadMacro name) lookupResult _ (w, FieldTypeGcptrMacro name) = return (w, FieldTypeGcptrMacro name)
7,569
false
true
0
17
3,179
1,954
1,003
951
null
null
bergmark/clay
src/Clay/Selector.hs
bsd-3-clause
-- | Named alias for `|>`. child :: Selector -> Selector -> Selector child a b = In (SelectorF (Refinement []) (Child a b))
124
child :: Selector -> Selector -> Selector child a b = In (SelectorF (Refinement []) (Child a b))
96
child a b = In (SelectorF (Refinement []) (Child a b))
54
true
true
0
9
24
57
27
30
null
null
RayRacine/aws
Aws/DynamoDb/Commands/Table.hs
bsd-3-clause
dropOpt :: Int -> A.Options dropOpt d = A.defaultOptions { A.fieldLabelModifier = drop d }
90
dropOpt :: Int -> A.Options dropOpt d = A.defaultOptions { A.fieldLabelModifier = drop d }
90
dropOpt d = A.defaultOptions { A.fieldLabelModifier = drop d }
62
false
true
0
7
14
35
18
17
null
null
mariefarrell/Hets
CspCASLProver/CspProverConsts.hs
gpl-2.0
cspProver_action_prefixAltArgPrios :: [Int] cspProver_action_prefixAltArgPrios = [150, 80]
90
cspProver_action_prefixAltArgPrios :: [Int] cspProver_action_prefixAltArgPrios = [150, 80]
90
cspProver_action_prefixAltArgPrios = [150, 80]
46
false
true
0
5
6
20
12
8
null
null
pack-it-forms/msgfmt
src/PackItForms/MsgFmt.hs
apache-2.0
-- | Accessor for the value of an envelope field getEnvVal :: MsgFmt -> String -> Maybe String getEnvVal (MsgFmt e _ _) k = M.lookup k e
136
getEnvVal :: MsgFmt -> String -> Maybe String getEnvVal (MsgFmt e _ _) k = M.lookup k e
87
getEnvVal (MsgFmt e _ _) k = M.lookup k e
41
true
true
0
7
27
45
22
23
null
null
mapinguari/SC_HS_Proxy
src/Proxy/Query/Unit.hs
mit
buildTime ZergNydusCanal = 600
30
buildTime ZergNydusCanal = 600
30
buildTime ZergNydusCanal = 600
30
false
false
0
5
3
9
4
5
null
null
agentm/project-m36
src/lib/ProjectM36/AtomType.hs
unlicense
atomTypeForAttributeExpr (AttributeAndTypeNameExpr _ tCons _) tConsMap tvMap = atomTypeForTypeConstructorValidate True tCons tConsMap tvMap
139
atomTypeForAttributeExpr (AttributeAndTypeNameExpr _ tCons _) tConsMap tvMap = atomTypeForTypeConstructorValidate True tCons tConsMap tvMap
139
atomTypeForAttributeExpr (AttributeAndTypeNameExpr _ tCons _) tConsMap tvMap = atomTypeForTypeConstructorValidate True tCons tConsMap tvMap
139
false
false
0
7
12
32
15
17
null
null
snoyberg/ghc
compiler/codeGen/StgCmmClosure.hs
bsd-3-clause
might_be_a_function :: Type -> Bool -- Return False only if we are *sure* it's a data type -- Look through newtypes etc as much as poss might_be_a_function ty | UnaryRep rep <- repType ty , Just tc <- tyConAppTyCon_maybe rep , isDataTyCon tc = False | otherwise = True
280
might_be_a_function :: Type -> Bool might_be_a_function ty | UnaryRep rep <- repType ty , Just tc <- tyConAppTyCon_maybe rep , isDataTyCon tc = False | otherwise = True
180
might_be_a_function ty | UnaryRep rep <- repType ty , Just tc <- tyConAppTyCon_maybe rep , isDataTyCon tc = False | otherwise = True
144
true
true
0
9
60
69
31
38
null
null
MichielDerhaeg/stack
src/Stack/Types/Package.hs
bsd-3-clause
isCExe :: NamedComponent -> Bool isCExe CExe{} = True
53
isCExe :: NamedComponent -> Bool isCExe CExe{} = True
53
isCExe CExe{} = True
20
false
true
0
6
8
22
11
11
null
null
JohnLato/jaek
src/Jaek/UI/Controllers/Base.hs
lgpl-3.0
aKeys :: ControlGraph (Event KeyVal) aKeys = (extract keysPass . last) <$> St.get
81
aKeys :: ControlGraph (Event KeyVal) aKeys = (extract keysPass . last) <$> St.get
81
aKeys = (extract keysPass . last) <$> St.get
44
false
true
0
8
12
36
18
18
null
null
reuleaux/pire
src/Pire/Parser/Decl.hs
bsd-3-clause
Def_ :: (TokenParsing m -- , Fresh m , LookAheadParsing m , DeltaParsing m , MonadState PiState m) => m (Decl T.Text T.Text) valDef_ = do -- (n, e) <- try (do {n <- var_; e <- eq_; return (n, e)}) -- val <- expr_ -- return $ Def_ n e val (n, ws, e) <- try (do {(n, ws) <- var2_; e <- eq_; return (n, ws, e)}) val <- expr_ return $ Def_ (Nm1_ n ws) e val -- for testing -- let natstr = unlines [ "data Nat : Type where", " Zero", " Succ of (Nat)" ] -- then -- nopos $ fromSuccess $ parseString (runInnerParser $ evalStateT (whiteSpace *> dataDef) piInit) beginning natstr -- datatype decls -- eg. -- -- data Nat : Type where -- Zero -- Succ of (Nat) -- da
728
valDef_ :: (TokenParsing m -- , Fresh m , LookAheadParsing m , DeltaParsing m , MonadState PiState m) => m (Decl T.Text T.Text) valDef_ = do -- (n, e) <- try (do {n <- var_; e <- eq_; return (n, e)}) -- val <- expr_ -- return $ Def_ n e val (n, ws, e) <- try (do {(n, ws) <- var2_; e <- eq_; return (n, ws, e)}) val <- expr_ return $ Def_ (Nm1_ n ws) e val -- for testing -- let natstr = unlines [ "data Nat : Type where", " Zero", " Succ of (Nat)" ] -- then -- nopos $ fromSuccess $ parseString (runInnerParser $ evalStateT (whiteSpace *> dataDef) piInit) beginning natstr -- datatype decls -- eg. -- -- data Nat : Type where -- Zero -- Succ of (Nat) --
728
valDef_ = do -- (n, e) <- try (do {n <- var_; e <- eq_; return (n, e)}) -- val <- expr_ -- return $ Def_ n e val (n, ws, e) <- try (do {(n, ws) <- var2_; e <- eq_; return (n, ws, e)}) val <- expr_ return $ Def_ (Nm1_ n ws) e val -- for testing -- let natstr = unlines [ "data Nat : Type where", " Zero", " Succ of (Nat)" ] -- then -- nopos $ fromSuccess $ parseString (runInnerParser $ evalStateT (whiteSpace *> dataDef) piInit) beginning natstr -- datatype decls -- eg. -- -- data Nat : Type where -- Zero -- Succ of (Nat) --
556
false
true
0
13
211
169
92
77
null
null
peterson/lets-tree
src/Lets/BinomialHeap.hs
bsd-3-clause
t2 = Node 1 1 [Node 0 5 []]
27
t2 = Node 1 1 [Node 0 5 []]
27
t2 = Node 1 1 [Node 0 5 []]
27
false
false
1
7
8
30
12
18
null
null
d0kt0r0/estuary
client/src/Estuary/Types/Terminal.hs
gpl-3.0
-- <?> "expecting view" identifierText :: H Text identifierText = do s <- identifier return $ T.pack s
107
identifierText :: H Text identifierText = do s <- identifier return $ T.pack s
82
identifierText = do s <- identifier return $ T.pack s
57
true
true
0
10
22
40
17
23
null
null
kapilash/dc
src/ccs2c/ccs2cs-lib/src/Language/CCS/Parser.hs
bsd-3-clause
enumValue = hashedEnumVal <|> enumComplex <?> "Enum Value"
70
enumValue = hashedEnumVal <|> enumComplex <?> "Enum Value"
70
enumValue = hashedEnumVal <|> enumComplex <?> "Enum Value"
70
false
false
0
6
19
14
7
7
null
null
IanConnolly/aws-sdk-fork
AWS/Lib/Parser.hs
bsd-3-clause
fromMaybeM :: Monad m => m a -> Maybe a -> m a fromMaybeM a Nothing = a
72
fromMaybeM :: Monad m => m a -> Maybe a -> m a fromMaybeM a Nothing = a
72
fromMaybeM a Nothing = a
25
false
true
0
8
18
40
18
22
null
null