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
orclev/sprint-logic-rest
Main.hs
gpl-3.0
main :: IO () main = do pool <- createSqlitePool "test.db3" 10 flip runSqlPool pool $ do runResourceT $ runStderrLoggingT $ flip runSqlPool pool $ do runMigration migrateAll run 3000 $ W.cors (const $ Just corsPolicy) $ application (ServerData pool)
267
main :: IO () main = do pool <- createSqlitePool "test.db3" 10 flip runSqlPool pool $ do runResourceT $ runStderrLoggingT $ flip runSqlPool pool $ do runMigration migrateAll run 3000 $ W.cors (const $ Just corsPolicy) $ application (ServerData pool)
267
main = do pool <- createSqlitePool "test.db3" 10 flip runSqlPool pool $ do runResourceT $ runStderrLoggingT $ flip runSqlPool pool $ do runMigration migrateAll run 3000 $ W.cors (const $ Just corsPolicy) $ application (ServerData pool)
253
false
true
1
16
57
109
46
63
null
null
ndmitchell/firstify
Yhc/Core/Firstify/Super.hs
bsd-3-clause
-- invariant: all CoreFun's must be inside a CoreApp funInsideApp = transform f where f (CoreFun x) = CoreApp (CoreFun x) [] f (CoreApp (CoreApp x y) z) = CoreApp x (y++z) f x = x
207
funInsideApp = transform f where f (CoreFun x) = CoreApp (CoreFun x) [] f (CoreApp (CoreApp x y) z) = CoreApp x (y++z) f x = x
154
funInsideApp = transform f where f (CoreFun x) = CoreApp (CoreFun x) [] f (CoreApp (CoreApp x y) z) = CoreApp x (y++z) f x = x
154
true
false
2
9
63
82
41
41
null
null
brendanhay/gogol
gogol-adexchangebuyer2/gen/Network/Google/AdExchangeBuyer2/Types/Product.hs
mpl-2.0
-- | Output only. Tracks which parties (if any) have paused a deal. dsmDealPauseStatus :: Lens' DealServingMetadata (Maybe DealPauseStatus) dsmDealPauseStatus = lens _dsmDealPauseStatus (\ s a -> s{_dsmDealPauseStatus = a})
231
dsmDealPauseStatus :: Lens' DealServingMetadata (Maybe DealPauseStatus) dsmDealPauseStatus = lens _dsmDealPauseStatus (\ s a -> s{_dsmDealPauseStatus = a})
163
dsmDealPauseStatus = lens _dsmDealPauseStatus (\ s a -> s{_dsmDealPauseStatus = a})
91
true
true
1
9
37
52
25
27
null
null
dflemstr/monad-presentation
src/cloudeval.hs
gpl-3.0
postEvaluateR :: [String] -> ByteString -> MVar () -> AppMonad postEvaluateR exprs body lock = do interpreterResult <- liftIO . -- Save the POST body to a temp file and use it withSourceAsTempFile "cloudeval.hs" body $ \ moduleFile -> -- Only one user can use the interpreter at once withMVar lock $ const . -- Catch all exceptions, and convert them to error messages catchExceptions . -- You get max 10s limitTime 10000000 . -- This happens sometimes... basically use a spinlock to wait -- until ready. TODO: figure out why this exception is thrown retryOn MultipleInstancesNotAllowed . -- Start the hint interpreter unsafeRunInterpreterWithArgs ["-XSafe", "-XNoMonomorphismRestriction", "-trust vector", "-trust MonadRandom"] $ do loadModules [moduleFile] loadedModules <- getLoadedModules setTopLevelModules loadedModules moduleScopes <- forM loadedModules $ \ m -> do exports <- getModuleExports m return [ScopeVar m var | Fun var <- exports] -- TODO: apply timeout per expression evals <- forM exprs $ \ expr -> (expr,) <$> (EvaluationSuccess <$> eval expr <*> typeOf expr) `catchError` (return . EvaluationError . parseError) return (evals, concat moduleScopes) let result = either ResultError (either (ResultError . parseError) (uncurry ResultSuccess . first HashMap.fromList)) interpreterResult json . toStrict . encode $ result
1,564
postEvaluateR :: [String] -> ByteString -> MVar () -> AppMonad postEvaluateR exprs body lock = do interpreterResult <- liftIO . -- Save the POST body to a temp file and use it withSourceAsTempFile "cloudeval.hs" body $ \ moduleFile -> -- Only one user can use the interpreter at once withMVar lock $ const . -- Catch all exceptions, and convert them to error messages catchExceptions . -- You get max 10s limitTime 10000000 . -- This happens sometimes... basically use a spinlock to wait -- until ready. TODO: figure out why this exception is thrown retryOn MultipleInstancesNotAllowed . -- Start the hint interpreter unsafeRunInterpreterWithArgs ["-XSafe", "-XNoMonomorphismRestriction", "-trust vector", "-trust MonadRandom"] $ do loadModules [moduleFile] loadedModules <- getLoadedModules setTopLevelModules loadedModules moduleScopes <- forM loadedModules $ \ m -> do exports <- getModuleExports m return [ScopeVar m var | Fun var <- exports] -- TODO: apply timeout per expression evals <- forM exprs $ \ expr -> (expr,) <$> (EvaluationSuccess <$> eval expr <*> typeOf expr) `catchError` (return . EvaluationError . parseError) return (evals, concat moduleScopes) let result = either ResultError (either (ResultError . parseError) (uncurry ResultSuccess . first HashMap.fromList)) interpreterResult json . toStrict . encode $ result
1,564
postEvaluateR exprs body lock = do interpreterResult <- liftIO . -- Save the POST body to a temp file and use it withSourceAsTempFile "cloudeval.hs" body $ \ moduleFile -> -- Only one user can use the interpreter at once withMVar lock $ const . -- Catch all exceptions, and convert them to error messages catchExceptions . -- You get max 10s limitTime 10000000 . -- This happens sometimes... basically use a spinlock to wait -- until ready. TODO: figure out why this exception is thrown retryOn MultipleInstancesNotAllowed . -- Start the hint interpreter unsafeRunInterpreterWithArgs ["-XSafe", "-XNoMonomorphismRestriction", "-trust vector", "-trust MonadRandom"] $ do loadModules [moduleFile] loadedModules <- getLoadedModules setTopLevelModules loadedModules moduleScopes <- forM loadedModules $ \ m -> do exports <- getModuleExports m return [ScopeVar m var | Fun var <- exports] -- TODO: apply timeout per expression evals <- forM exprs $ \ expr -> (expr,) <$> (EvaluationSuccess <$> eval expr <*> typeOf expr) `catchError` (return . EvaluationError . parseError) return (evals, concat moduleScopes) let result = either ResultError (either (ResultError . parseError) (uncurry ResultSuccess . first HashMap.fromList)) interpreterResult json . toStrict . encode $ result
1,501
false
true
0
22
423
338
165
173
null
null
nh2/haskell-ordnub
Okasaki.hs
mit
balance a x (T R b y (T R c z d)) = T R (T B a x b) y (T B c z d)
65
balance a x (T R b y (T R c z d)) = T R (T B a x b) y (T B c z d)
65
balance a x (T R b y (T R c z d)) = T R (T B a x b) y (T B c z d)
65
false
false
0
9
25
70
34
36
null
null
ArnoVanLumig/indexedset
Benchmark.hs
bsd-3-clause
benchIndexQuery db = queryIndex (ageindex db) 20
48
benchIndexQuery db = queryIndex (ageindex db) 20
48
benchIndexQuery db = queryIndex (ageindex db) 20
48
false
false
0
7
6
20
9
11
null
null
wavewave/madgraph-auto-dataset
src/HEP/Automation/MadGraph/Dataset/Set20110413set1.hs
gpl-3.0
psetuplist :: [ProcessSetup AxiGluon] psetuplist = [ psetup_axi_ttbar ]
71
psetuplist :: [ProcessSetup AxiGluon] psetuplist = [ psetup_axi_ttbar ]
71
psetuplist = [ psetup_axi_ttbar ]
33
false
true
0
6
8
20
11
9
null
null
tchagnon/cs636-raytracer
a6/Mesh.hs
apache-2.0
-- Average vectors avgVecs :: [Vec3f] -> Vec3f avgVecs vs = norm ((1/(fromIntegral $ length vs)) `svMul` (foldl1 (+) vs))
121
avgVecs :: [Vec3f] -> Vec3f avgVecs vs = norm ((1/(fromIntegral $ length vs)) `svMul` (foldl1 (+) vs))
102
avgVecs vs = norm ((1/(fromIntegral $ length vs)) `svMul` (foldl1 (+) vs))
74
true
true
0
12
19
64
35
29
null
null
narurien/ganeti-ceph
src/Ganeti/JSON.hs
gpl-2.0
loadJSArray :: (Monad m) => String -- ^ Operation description (for error reporting) -> String -- ^ Input message -> m [J.JSObject J.JSValue] loadJSArray s = fromJResult s . J.decodeStrict
232
loadJSArray :: (Monad m) => String -- ^ Operation description (for error reporting) -> String -- ^ Input message -> m [J.JSObject J.JSValue] loadJSArray s = fromJResult s . J.decodeStrict
232
loadJSArray s = fromJResult s . J.decodeStrict
46
false
true
0
11
74
55
28
27
null
null
glguy/advent2015
Day4.hs
isc
-- | Extract the final MD5 digest from a context finish :: Context -> L.ByteString finish (Context a b c d) = toFixedByteString 16 $ word32LE a <> word32LE b <> word32LE c <> word32LE d
189
finish :: Context -> L.ByteString finish (Context a b c d) = toFixedByteString 16 $ word32LE a <> word32LE b <> word32LE c <> word32LE d
140
finish (Context a b c d) = toFixedByteString 16 $ word32LE a <> word32LE b <> word32LE c <> word32LE d
106
true
true
2
8
39
69
31
38
null
null
cdornan/keystore
src/Data/KeyStore/PasswordManager.hs
bsd-3-clause
login :: PW p => PMConfig p -> Bool -> Maybe PasswordText -> IO () login pmc y mb = do pwt <- maybe (get_pw True pmc) return mb ok <- passwordValid pmc pwt case ok of True -> bindMasterPassword pmc pwt >> good >> _pmc_shell pmc False -> bad >> login pmc y Nothing where good = putStr "*** Login Successful ***\n" bad = bad_f "*** Password Invalid ***\n" bad_f = if y then putStr else error -- | is this the correct master password?
497
login :: PW p => PMConfig p -> Bool -> Maybe PasswordText -> IO () login pmc y mb = do pwt <- maybe (get_pw True pmc) return mb ok <- passwordValid pmc pwt case ok of True -> bindMasterPassword pmc pwt >> good >> _pmc_shell pmc False -> bad >> login pmc y Nothing where good = putStr "*** Login Successful ***\n" bad = bad_f "*** Password Invalid ***\n" bad_f = if y then putStr else error -- | is this the correct master password?
497
login pmc y mb = do pwt <- maybe (get_pw True pmc) return mb ok <- passwordValid pmc pwt case ok of True -> bindMasterPassword pmc pwt >> good >> _pmc_shell pmc False -> bad >> login pmc y Nothing where good = putStr "*** Login Successful ***\n" bad = bad_f "*** Password Invalid ***\n" bad_f = if y then putStr else error -- | is this the correct master password?
430
false
true
2
12
151
162
76
86
null
null
metabrainz/musicbrainz-data-service
src/MusicBrainz/API/Artist.hs
gpl-2.0
-------------------------------------------------------------------------------- tree :: Form Text MusicBrainz (Tree Artist) tree = ArtistTree <$> "artist" .: artist <*> relationships <*> aliases <*> ipiCodes <*> annotation
295
tree :: Form Text MusicBrainz (Tree Artist) tree = ArtistTree <$> "artist" .: artist <*> relationships <*> aliases <*> ipiCodes <*> annotation
214
tree = ArtistTree <$> "artist" .: artist <*> relationships <*> aliases <*> ipiCodes <*> annotation
170
true
true
0
10
94
49
25
24
null
null
music-suite/music-preludes
src/Music/Prelude/CmdLine.hs
bsd-3-clause
-- | -- Generates a basic converter program such as @music2ly@, @music2musicxml@ etc. -- converterMain :: String -- ^ Name of converter function. -> String -- ^ Extension of generated file. -> IO () converterMain func ext = do pgmName <- getProgName options <- execParser (opts pgmName) runConverter func ext options where opts pgmName = info (helper <*> converterOptions) (fullDesc <> header (pgmName ++ "-" ++ versionString)) runConverter func ext (ConverterOptions prelude outFile inFile) = translateFile func ext prelude (Just inFile) outFile -- A converter program that invokes Lilypond -- Used for music2pdf, music2svg et al
683
converterMain :: String -- ^ Name of converter function. -> String -- ^ Extension of generated file. -> IO () converterMain func ext = do pgmName <- getProgName options <- execParser (opts pgmName) runConverter func ext options where opts pgmName = info (helper <*> converterOptions) (fullDesc <> header (pgmName ++ "-" ++ versionString)) runConverter func ext (ConverterOptions prelude outFile inFile) = translateFile func ext prelude (Just inFile) outFile -- A converter program that invokes Lilypond -- Used for music2pdf, music2svg et al
593
converterMain func ext = do pgmName <- getProgName options <- execParser (opts pgmName) runConverter func ext options where opts pgmName = info (helper <*> converterOptions) (fullDesc <> header (pgmName ++ "-" ++ versionString)) runConverter func ext (ConverterOptions prelude outFile inFile) = translateFile func ext prelude (Just inFile) outFile -- A converter program that invokes Lilypond -- Used for music2pdf, music2svg et al
473
true
true
1
10
148
161
77
84
null
null
ezyang/ghc
compiler/cmm/Hoopl/Block.hs
bsd-3-clause
lastNode :: Block n x C -> n O C lastNode (BlockOC _ n) = n
61
lastNode :: Block n x C -> n O C lastNode (BlockOC _ n) = n
61
lastNode (BlockOC _ n) = n
28
false
true
0
9
17
43
19
24
null
null
mariefarrell/Hets
DFOL/Morphism.hs
gpl-2.0
{- generated and cogenerated signatures Algorithm description: FOR GENERATED SIGNATURES Input : a signature "sig" and a set of symbols "syms" Output : an inclusion morphism 1 : Check if all symbols in syms occur in sig; if not, output Nothing 2 : Initialize the set of symbols "incl" which necessarily must be included in the generated signature to syms Initialize the set "done" of analyzed symbols to empty Initialize the set "todo" of symbols to be analyzed to syms 3 : Check if todo is empty 3.1 : If yes, go to 5 3.2 : If not, go to 4 4 : Pick a symbol "s" from todo 4.1 : Get the type "t" of s in sig 4.2 : Get the set "vars" of free variables in t, i.e. the symbols of sig that t depends on 4.3 : For each "v" in vars : 4.3.1 : Add v to incl 4.3.2 : If v does not occur in done, add it to todo 4.4 : Remove v from todo and add it to done 4.5 : Go to 3 5 : Let "sig1" be the subsignature of sig containing only the symbols in incl and output the inclusion morphism m : sig1 -> sig FOR COGENERATED SIGNATURES Input : a signature "sig" and a set of symbols "syms" Output : an inclusion morphism 1 : Check if all symbols in syms occur in sig; if not, output Nothing 2 : Initialize the set of symbols "excl" which necessarily must be excluded from the cogenerated signature to syms 3 : For each symbol "s" in sig (keeping the order in which they are defined) : 3.1 : If s does not occur in excl : 4.1 : Get the type "t" of s in sig 4.2 : Get the set "vars" of free variables in t, i.e. the symbols of sig that t depends on 4.3 : If any of the symbols in vars occurs in excl, add s to excl 4 : Let "sig1" be the subsignature of sig containing all the symbols not occurring in excl and output the inclusion morphism m : sig1 -> sig -} coGenSig :: Bool -> Set.Set Symbol -> Sign -> Result Morphism coGenSig flag syms sig@(Sign ds) = let names = Set.map name syms ds1 = expandDecls ds in if Set.isSubsetOf names (getSymbols sig) then let incl = if flag then cogSig names ds1 sig else genSig names Set.empty names sig ds2 = map (\ (n, t) -> ([n], t)) $ filter (\ (n, _) -> Set.member n incl) ds1 in inclusionMorph (Sign ds2) sig else Result.Result [symsNotInSigError names sig] Nothing
2,496
coGenSig :: Bool -> Set.Set Symbol -> Sign -> Result Morphism coGenSig flag syms sig@(Sign ds) = let names = Set.map name syms ds1 = expandDecls ds in if Set.isSubsetOf names (getSymbols sig) then let incl = if flag then cogSig names ds1 sig else genSig names Set.empty names sig ds2 = map (\ (n, t) -> ([n], t)) $ filter (\ (n, _) -> Set.member n incl) ds1 in inclusionMorph (Sign ds2) sig else Result.Result [symsNotInSigError names sig] Nothing
616
coGenSig flag syms sig@(Sign ds) = let names = Set.map name syms ds1 = expandDecls ds in if Set.isSubsetOf names (getSymbols sig) then let incl = if flag then cogSig names ds1 sig else genSig names Set.empty names sig ds2 = map (\ (n, t) -> ([n], t)) $ filter (\ (n, _) -> Set.member n incl) ds1 in inclusionMorph (Sign ds2) sig else Result.Result [symsNotInSigError names sig] Nothing
554
true
true
0
17
754
219
112
107
null
null
ssaavedra/liquidhaskell
benchmarks/base-4.5.1.0/Control/OldException.hs
bsd-3-clause
----------------------------------------------------------------------------- -- 'try' and variations. -- | Similar to 'catch', but returns an 'Either' result which is -- @('Right' a)@ if no exception was raised, or @('Left' e)@ if an -- exception was raised and its value is @e@. -- -- > try a = catch (Right `liftM` a) (return . Left) -- -- Note: as with 'catch', it is only polite to use this variant if you intend -- to re-throw the exception after performing whatever cleanup is needed. -- Otherwise, 'tryJust' is generally considered to be better. -- -- Also note that "System.IO.Error" also exports a function called -- 'System.IO.Error.try' with a similar type to 'Control.OldException.try', -- except that it catches only the IO and user families of exceptions -- (as required by the Haskell 98 @IO@ module). try :: IO a -> IO (Either Exception a) try a = catch (a >>= \ v -> return (Right v)) (\e -> return (Left e))
929
try :: IO a -> IO (Either Exception a) try a = catch (a >>= \ v -> return (Right v)) (\e -> return (Left e))
108
try a = catch (a >>= \ v -> return (Right v)) (\e -> return (Left e))
69
true
true
0
11
158
91
53
38
null
null
stgm/prac-testing
week5/Week5Sol_Q4_RandomSudokuNRC.hs
mit
test = do [r] <- rsolveNs [emptyN] showNode r s <- genProblem r showNode s solveShowNs [s]
131
test = do [r] <- rsolveNs [emptyN] showNode r s <- genProblem r showNode s solveShowNs [s]
131
test = do [r] <- rsolveNs [emptyN] showNode r s <- genProblem r showNode s solveShowNs [s]
131
false
false
1
10
57
57
23
34
null
null
coreyoconnor/ansi-terminal
System/Console/ANSI/Windows/Emulator.hs
bsd-3-clause
setCursorColumnCode _ = ""
26
setCursorColumnCode _ = ""
26
setCursorColumnCode _ = ""
26
false
false
0
5
3
9
4
5
null
null
mightymoose/liquidhaskell
tests/pos/meas1.hs
bsd-3-clause
nullity (x:_) = 1
17
nullity (x:_) = 1
17
nullity (x:_) = 1
17
false
false
0
7
3
16
8
8
null
null
ideas-edu/ideas
src/Ideas/Common/Strategy/Legacy.hs
apache-2.0
(<%>), (<@>), (<|>), (>|>), (<*>) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a (<%>) = (.%.)
114
(<%>), (<@>), (<|>), (>|>), (<*>) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a (<%>) = (.%.)
111
(<%>) = (.%.)
13
false
true
0
8
28
65
43
22
null
null
ekmett/prelude-extras
src/Prelude/Extras.hs
bsd-3-clause
(/=#) :: (Eq1 f, Eq a) => f a -> f a -> Bool a /=# b = not (a ==# b)
68
(/=#) :: (Eq1 f, Eq a) => f a -> f a -> Bool a /=# b = not (a ==# b)
68
a /=# b = not (a ==# b)
23
false
true
0
10
21
63
30
33
null
null
jeffwheeler/pointedlist
Data/List/PointedList.hs
bsd-3-clause
-- | Whether the focus is the last element. atEnd :: PointedList a -> Bool atEnd (PointedList _ _ []) = True
108
atEnd :: PointedList a -> Bool atEnd (PointedList _ _ []) = True
64
atEnd (PointedList _ _ []) = True
33
true
true
0
7
21
38
18
20
null
null
ardumont/hWifi
Network/HWifi.hs
gpl-2.0
unsafeElect (Right []) _ = Left NoWifiAvailable
67
unsafeElect (Right []) _ = Left NoWifiAvailable
67
unsafeElect (Right []) _ = Left NoWifiAvailable
67
false
false
0
8
26
22
10
12
null
null
romanb/amazonka
amazonka-ec2/gen/Network/AWS/EC2/Types.hs
mpl-2.0
-- | Indicates whether the VPC is enabled for ClassicLink. vclClassicLinkEnabled :: Lens' VpcClassicLink (Maybe Bool) vclClassicLinkEnabled = lens _vclClassicLinkEnabled (\s a -> s { _vclClassicLinkEnabled = a })
216
vclClassicLinkEnabled :: Lens' VpcClassicLink (Maybe Bool) vclClassicLinkEnabled = lens _vclClassicLinkEnabled (\s a -> s { _vclClassicLinkEnabled = a })
157
vclClassicLinkEnabled = lens _vclClassicLinkEnabled (\s a -> s { _vclClassicLinkEnabled = a })
98
true
true
1
9
32
51
25
26
null
null
romanb/amazonka
amazonka-cloudformation/gen/Network/AWS/CloudFormation/Types.hs
mpl-2.0
-- | /Required/. A string containing the value for this tag. You can specify a -- maximum of 256 characters for a tag value. tagValue :: Lens' Tag (Maybe Text) tagValue = lens _tagValue (\s a -> s { _tagValue = a })
215
tagValue :: Lens' Tag (Maybe Text) tagValue = lens _tagValue (\s a -> s { _tagValue = a })
90
tagValue = lens _tagValue (\s a -> s { _tagValue = a })
55
true
true
1
9
42
52
26
26
null
null
ku-fpg/kansas-amber
System/Hardware/Haskino/ShallowDeepPlugin/RepConstrPushPass.hs
bsd-3-clause
repConstrPushExpr' ((b, e) : bs) = do e' <- repConstrPushExpr e bs' <- repConstrPushExpr' bs return $ (b, e') : bs'
121
repConstrPushExpr' ((b, e) : bs) = do e' <- repConstrPushExpr e bs' <- repConstrPushExpr' bs return $ (b, e') : bs'
121
repConstrPushExpr' ((b, e) : bs) = do e' <- repConstrPushExpr e bs' <- repConstrPushExpr' bs return $ (b, e') : bs'
121
false
false
0
9
26
59
29
30
null
null
mightymoose/liquidhaskell
tests/neg/ConstraintsAppend.hs
bsd-3-clause
takeGE x (y:ys) = if (y>=x) then y:(takeGE x ys) else takeGE x ys
65
takeGE x (y:ys) = if (y>=x) then y:(takeGE x ys) else takeGE x ys
65
takeGE x (y:ys) = if (y>=x) then y:(takeGE x ys) else takeGE x ys
65
false
false
0
8
13
50
26
24
null
null
ezyang/ghc
testsuite/tests/simplCore/should_run/T13429a.hs
bsd-3-clause
addDigits3 m1 (One a) b c d (Three e f g) m2 = appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2
106
addDigits3 m1 (One a) b c d (Three e f g) m2 = appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2
106
addDigits3 m1 (One a) b c d (Three e f g) m2 = appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2
106
false
false
0
7
29
80
36
44
null
null
lukexi/ghc-7.8-arm64
compiler/nativeGen/RegAlloc/Liveness.hs
bsd-3-clause
emptyRegMap :: UniqFM a emptyRegMap = emptyUFM
46
emptyRegMap :: UniqFM a emptyRegMap = emptyUFM
46
emptyRegMap = emptyUFM
22
false
true
0
5
6
14
7
7
null
null
rvion/lamdu
Lamdu/GUI/ExpressionGui.hs
gpl-3.0
verticalSpace :: MonadA m => ExprGuiM m (ExpressionGui f) verticalSpace = ExprGuiM.widgetEnv BWidgets.verticalSpace <&> Layout.fromCenteredWidget
145
verticalSpace :: MonadA m => ExprGuiM m (ExpressionGui f) verticalSpace = ExprGuiM.widgetEnv BWidgets.verticalSpace <&> Layout.fromCenteredWidget
145
verticalSpace = ExprGuiM.widgetEnv BWidgets.verticalSpace <&> Layout.fromCenteredWidget
87
false
true
0
8
14
42
20
22
null
null
plow-technologies/template-service
master/src/Data/Master/Template.hs
bsd-3-clause
eqHelper _ _ = False
20
eqHelper _ _ = False
20
eqHelper _ _ = False
20
false
false
0
5
4
11
5
6
null
null
ismailmustafa/handwriting-haskell
app/Main.hs
bsd-3-clause
main :: IO () main = do -- Credentials creds <- Credentials <$> getEnv "KEY" <*> getEnv "SECRET" -- Get all handwritings handwritings <- getHandwritings creds -- Generate random number in range of handwritings g <- newStdGen let rand = randomR (0, length handwritings - 1) g -- Select random handwriting font let id = unpack $ handwritingId $ handwritings !! fst rand handwriting <- getHandwriting creds id print handwriting -- Generate image let params = defaultImageParams { format = PNG , hId = Just "31SB2CWG00DZ" , size = Just 205 , lineSpacing = Just 2 , lineSpacingVariance = Just 0.2 , wordSpacingVariance = Just 0.4 , width = Just 800 , color = Just (0, 0, 0) , randomSeed = Randomize } imageByteString <- renderImage creds params "Hello World!" -- Write image to current directory writeHandwritingFile imageByteString "image.png"
1,291
main :: IO () main = do -- Credentials creds <- Credentials <$> getEnv "KEY" <*> getEnv "SECRET" -- Get all handwritings handwritings <- getHandwritings creds -- Generate random number in range of handwritings g <- newStdGen let rand = randomR (0, length handwritings - 1) g -- Select random handwriting font let id = unpack $ handwritingId $ handwritings !! fst rand handwriting <- getHandwriting creds id print handwriting -- Generate image let params = defaultImageParams { format = PNG , hId = Just "31SB2CWG00DZ" , size = Just 205 , lineSpacing = Just 2 , lineSpacingVariance = Just 0.2 , wordSpacingVariance = Just 0.4 , width = Just 800 , color = Just (0, 0, 0) , randomSeed = Randomize } imageByteString <- renderImage creds params "Hello World!" -- Write image to current directory writeHandwritingFile imageByteString "image.png"
1,291
main = do -- Credentials creds <- Credentials <$> getEnv "KEY" <*> getEnv "SECRET" -- Get all handwritings handwritings <- getHandwritings creds -- Generate random number in range of handwritings g <- newStdGen let rand = randomR (0, length handwritings - 1) g -- Select random handwriting font let id = unpack $ handwritingId $ handwritings !! fst rand handwriting <- getHandwriting creds id print handwriting -- Generate image let params = defaultImageParams { format = PNG , hId = Just "31SB2CWG00DZ" , size = Just 205 , lineSpacing = Just 2 , lineSpacingVariance = Just 0.2 , wordSpacingVariance = Just 0.4 , width = Just 800 , color = Just (0, 0, 0) , randomSeed = Randomize } imageByteString <- renderImage creds params "Hello World!" -- Write image to current directory writeHandwritingFile imageByteString "image.png"
1,277
false
true
0
14
590
252
125
127
null
null
dillonhuff/Proper
src/Proper/Formula.hs
bsd-3-clause
removeBiconditional (Con s1 s2) = Con (removeBiconditional s1) (removeBiconditional s2)
87
removeBiconditional (Con s1 s2) = Con (removeBiconditional s1) (removeBiconditional s2)
87
removeBiconditional (Con s1 s2) = Con (removeBiconditional s1) (removeBiconditional s2)
87
false
false
0
7
9
35
16
19
null
null
printedheart/Dao
src/Dao/Tree.hs
agpl-3.0
mergeWith :: Ord p => (Maybe a -> Maybe b -> Maybe c) -> (Tree p a -> Tree p c) -> (Tree p b -> Tree p c) -> Tree p a -> Tree p b -> Tree p c mergeWith f = mergeWithKey (const f)
188
mergeWith :: Ord p => (Maybe a -> Maybe b -> Maybe c) -> (Tree p a -> Tree p c) -> (Tree p b -> Tree p c) -> Tree p a -> Tree p b -> Tree p c mergeWith f = mergeWithKey (const f)
188
mergeWith f = mergeWithKey (const f)
36
false
true
0
12
56
124
56
68
null
null
scslab/iterIO
Data/IterIO/Iter.hs
bsd-3-clause
-- | Simlar to 'tryI', but saves all data that has been fed to the -- 'Iter', and rewinds the input if the 'Iter' fails. (The @B@ in -- @tryBI@ stands for \"backtracking\".) Thus, if @tryBI@ returns -- @'Left' exception@, the next 'Iter' to be invoked will see the same -- input that caused the previous 'Iter' to fail. (For this reason, -- it makes no sense ever to call @'resumeI'@ on the 'Iter' you get -- back from @tryBI@, which is why @tryBI@ does not return the failing -- Iteratee the way 'tryI' does.) -- -- Because @tryBI@ saves a copy of all input, it can consume a lot of -- memory and should only be used when the 'Iter' argument is known to -- consume a bounded amount of data. tryBI :: (ChunkData t, Monad m, Exception e) => Iter t m a -> Iter t m (Either e a) tryBI = onDoneInput errToEither where errToEither (Done a c) _ = Done (Right a) c errToEither r@(Fail ie _ _) c = case fromException $ toException ie of Just e -> Done (Left e) c Nothing -> Right <$> r errToEither _ _ = error "tryBI" -- | A variant of 'tryBI' that, also rewinds input on failure, but -- returns the raw 'IterFail' structure, rather than mapping it to a -- particular exception. This is much faster because it requires no -- dynamic casts. However, the same warning applies that @tryFBI@ -- should not be applied to 'Iter's that could take unbounded input.
1,434
tryBI :: (ChunkData t, Monad m, Exception e) => Iter t m a -> Iter t m (Either e a) tryBI = onDoneInput errToEither where errToEither (Done a c) _ = Done (Right a) c errToEither r@(Fail ie _ _) c = case fromException $ toException ie of Just e -> Done (Left e) c Nothing -> Right <$> r errToEither _ _ = error "tryBI" -- | A variant of 'tryBI' that, also rewinds input on failure, but -- returns the raw 'IterFail' structure, rather than mapping it to a -- particular exception. This is much faster because it requires no -- dynamic casts. However, the same warning applies that @tryFBI@ -- should not be applied to 'Iter's that could take unbounded input.
739
tryBI = onDoneInput errToEither where errToEither (Done a c) _ = Done (Right a) c errToEither r@(Fail ie _ _) c = case fromException $ toException ie of Just e -> Done (Left e) c Nothing -> Right <$> r errToEither _ _ = error "tryBI" -- | A variant of 'tryBI' that, also rewinds input on failure, but -- returns the raw 'IterFail' structure, rather than mapping it to a -- particular exception. This is much faster because it requires no -- dynamic casts. However, the same warning applies that @tryFBI@ -- should not be applied to 'Iter's that could take unbounded input.
646
true
true
0
12
341
186
99
87
null
null
perryleo/sicp
ch1/sicpc1e39.hs
mit
-- The recursive process to rewrite the tangent function using Lambert's -- formula (called `tan-cf` procedure) tan_cf :: (Fractional a, Integral b) => a -> b -> a tan_cf x k = let nseq i = x * x dseq i = if mod i 2 == 0 then tmp else (-tmp) where tmp = fromIntegral (i * 2 + 1) in x / (1 + contFrac nseq dseq k)
339
tan_cf :: (Fractional a, Integral b) => a -> b -> a tan_cf x k = let nseq i = x * x dseq i = if mod i 2 == 0 then tmp else (-tmp) where tmp = fromIntegral (i * 2 + 1) in x / (1 + contFrac nseq dseq k)
227
tan_cf x k = let nseq i = x * x dseq i = if mod i 2 == 0 then tmp else (-tmp) where tmp = fromIntegral (i * 2 + 1) in x / (1 + contFrac nseq dseq k)
175
true
true
0
14
96
128
66
62
null
null
d0kt0r0/InnerEar
src/InnerEar/Types/Utility.hs
gpl-3.0
-- replaces b in [b] at the same index that a is in [a] replaceAtSameIndex::(Eq a) => a -> [a] -> b -> [b] -> [b] replaceAtSameIndex k l mode = maybe id (\x->replaceAt x mode) index where index = elemIndex k l replaceAt n item ls = a ++ (item:b) where (a, (_:b)) = splitAt n ls
297
replaceAtSameIndex::(Eq a) => a -> [a] -> b -> [b] -> [b] replaceAtSameIndex k l mode = maybe id (\x->replaceAt x mode) index where index = elemIndex k l replaceAt n item ls = a ++ (item:b) where (a, (_:b)) = splitAt n ls
241
replaceAtSameIndex k l mode = maybe id (\x->replaceAt x mode) index where index = elemIndex k l replaceAt n item ls = a ++ (item:b) where (a, (_:b)) = splitAt n ls
183
true
true
0
11
77
134
71
63
null
null
trenta3/zeno-0.2.0.1
src/Zeno/Utils.hs
mit
nubAndDelete :: Ord a => a -> [a] -> [a] nubAndDelete n = Set.toList . Set.delete n . Set.fromList
99
nubAndDelete :: Ord a => a -> [a] -> [a] nubAndDelete n = Set.toList . Set.delete n . Set.fromList
98
nubAndDelete n = Set.toList . Set.delete n . Set.fromList
57
false
true
0
8
19
52
26
26
null
null
prasmussen/magmod
Magento/Controller.hs
mit
insertCtrlXmlIfMissing :: ModuleInfo -> String -> IO () insertCtrlXmlIfMissing info scope = do xml <- controllerXml (lowercase $ getName info) (getFullName info) (router scope) scope insertXmlIfMissing (getConfigXml info) (xpath scope) xml
255
insertCtrlXmlIfMissing :: ModuleInfo -> String -> IO () insertCtrlXmlIfMissing info scope = do xml <- controllerXml (lowercase $ getName info) (getFullName info) (router scope) scope insertXmlIfMissing (getConfigXml info) (xpath scope) xml
255
insertCtrlXmlIfMissing info scope = do xml <- controllerXml (lowercase $ getName info) (getFullName info) (router scope) scope insertXmlIfMissing (getConfigXml info) (xpath scope) xml
199
false
true
0
11
46
89
42
47
null
null
maxking/cs583-project
src/Config.hs
gpl-3.0
port :: Int port = 3000
23
port :: Int port = 3000
23
port = 3000
11
false
true
0
4
5
11
6
5
null
null
abhinav/tbr
app/main.hs
mit
argumentParser :: Parser Argument argumentParser = Argument <$> switch (long "dry-run" <> short 'n' <> help "Don't change the file.") <*> commandParser
159
argumentParser :: Parser Argument argumentParser = Argument <$> switch (long "dry-run" <> short 'n' <> help "Don't change the file.") <*> commandParser
159
argumentParser = Argument <$> switch (long "dry-run" <> short 'n' <> help "Don't change the file.") <*> commandParser
125
false
true
5
9
29
50
23
27
null
null
OS2World/DEV-UTIL-HUGS
oldlib/LeftistHeap.hs
bsd-3-clause
partitionLE_GT :: Ord a => a -> Heap a -> (Heap a, Heap a) partitionLE_GT y h = (h', C.unionList hs) where (h', hs) = collect h [] collect E hs = (E, hs) collect h@(L _ x a b) hs | x > y = (E, h:hs) | otherwise = let (a', hs') = collect a hs (b', hs'') = collect b hs' in (node x a' b', hs'')
383
partitionLE_GT :: Ord a => a -> Heap a -> (Heap a, Heap a) partitionLE_GT y h = (h', C.unionList hs) where (h', hs) = collect h [] collect E hs = (E, hs) collect h@(L _ x a b) hs | x > y = (E, h:hs) | otherwise = let (a', hs') = collect a hs (b', hs'') = collect b hs' in (node x a' b', hs'')
383
partitionLE_GT y h = (h', C.unionList hs) where (h', hs) = collect h [] collect E hs = (E, hs) collect h@(L _ x a b) hs | x > y = (E, h:hs) | otherwise = let (a', hs') = collect a hs (b', hs'') = collect b hs' in (node x a' b', hs'')
324
false
true
2
9
160
207
103
104
null
null
keithodulaigh/Hets
utils/DtdToHaskell-src/pre-1.22/TypeDef.hs
gpl-2.0
-- | Pretty print Haskell name. ppHName :: Name -> Doc ppHName (Name _ s) = text s
82
ppHName :: Name -> Doc ppHName (Name _ s) = text s
50
ppHName (Name _ s) = text s
27
true
true
0
7
17
30
15
15
null
null
ihc/futhark
src/Futhark/CodeGen/Backends/GenericC/Options.hs
isc
optionFields :: [Option] -> [C.Initializer] optionFields = zipWith field [(1::Int)..] where field i option = [C.cinit| { $string:(optionLongName option), $id:arg, NULL, $int:i } |] where arg = case optionArgument option of NoArgument -> "no_argument" RequiredArgument -> "required_argument" OptionalArgument -> "optional_argument"
430
optionFields :: [Option] -> [C.Initializer] optionFields = zipWith field [(1::Int)..] where field i option = [C.cinit| { $string:(optionLongName option), $id:arg, NULL, $int:i } |] where arg = case optionArgument option of NoArgument -> "no_argument" RequiredArgument -> "required_argument" OptionalArgument -> "optional_argument"
430
optionFields = zipWith field [(1::Int)..] where field i option = [C.cinit| { $string:(optionLongName option), $id:arg, NULL, $int:i } |] where arg = case optionArgument option of NoArgument -> "no_argument" RequiredArgument -> "required_argument" OptionalArgument -> "optional_argument"
386
false
true
0
9
139
87
48
39
null
null
ttuegel/nbody
nbody.hs
bsd-3-clause
dp = days_per_year
18
dp = days_per_year
18
dp = days_per_year
18
false
false
1
5
2
10
3
7
null
null
beni55/haste-compiler
libraries/ghc-7.10/base/GHC/Enum.hs
bsd-3-clause
succError :: String -> a succError inst_ty = error $ "Enum.succ{" ++ inst_ty ++ "}: tried to take `succ' of maxBound"
121
succError :: String -> a succError inst_ty = error $ "Enum.succ{" ++ inst_ty ++ "}: tried to take `succ' of maxBound"
121
succError inst_ty = error $ "Enum.succ{" ++ inst_ty ++ "}: tried to take `succ' of maxBound"
96
false
true
0
7
24
30
15
15
null
null
trskop/cabal
Cabal/Distribution/Simple/Program/Db.hs
bsd-3-clause
-- | Change the current 'ProgramSearchPath' used by the 'ProgramDb'. -- This will affect programs that are configured from here on, so you -- should usually set it before configuring any programs. -- setProgramSearchPath :: ProgramSearchPath -> ProgramDb -> ProgramDb setProgramSearchPath searchpath db = db { progSearchPath = searchpath }
339
setProgramSearchPath :: ProgramSearchPath -> ProgramDb -> ProgramDb setProgramSearchPath searchpath db = db { progSearchPath = searchpath }
139
setProgramSearchPath searchpath db = db { progSearchPath = searchpath }
71
true
true
0
7
49
41
22
19
null
null
federicotdn/hvc
src/Args.hs
gpl-3.0
parseArgs _ = return (HvcOperation Help)
40
parseArgs _ = return (HvcOperation Help)
40
parseArgs _ = return (HvcOperation Help)
40
false
false
0
6
5
19
8
11
null
null
bloomberg/blpapi-hs
src/Finance/Blpapi/Impl/DatetimeImpl.hs
mit
toDateTime :: BlpapiHPDatetime -> BlpDateTimeImpl toDateTime d = BlpLocalTimeImpl $ LocalTime day' time' where BlpDateImpl day' = toDay d BlpTimeImpl time' = toTime d
186
toDateTime :: BlpapiHPDatetime -> BlpDateTimeImpl toDateTime d = BlpLocalTimeImpl $ LocalTime day' time' where BlpDateImpl day' = toDay d BlpTimeImpl time' = toTime d
186
toDateTime d = BlpLocalTimeImpl $ LocalTime day' time' where BlpDateImpl day' = toDay d BlpTimeImpl time' = toTime d
136
false
true
0
7
43
57
25
32
null
null
benjijones/red
src/Red/Translate.hs
bsd-3-clause
translateAlt (LitAlt _literal, _vars, _expr) = error "LitAlt encountered in translateAlt"
90
translateAlt (LitAlt _literal, _vars, _expr) = error "LitAlt encountered in translateAlt"
90
translateAlt (LitAlt _literal, _vars, _expr) = error "LitAlt encountered in translateAlt"
90
false
false
0
6
11
25
12
13
null
null
prowdsponsor/country-codes
src/Data/CountryCodes/ISO31661.hs
bsd-3-clause
toText CA = "CA"
16
toText CA = "CA"
16
toText CA = "CA"
16
false
false
0
4
3
10
4
6
null
null
bos/text-icu
benchmarks/Breaker.hs
bsd-2-clause
cloneBreakers ts = do b <- IO.breakWord "en" "" forM_ ts $ \t -> do b' <- clone b setText b' t consume b'
121
cloneBreakers ts = do b <- IO.breakWord "en" "" forM_ ts $ \t -> do b' <- clone b setText b' t consume b'
121
cloneBreakers ts = do b <- IO.breakWord "en" "" forM_ ts $ \t -> do b' <- clone b setText b' t consume b'
121
false
false
1
13
39
66
26
40
null
null
seereason/HJScript
src/HJScript/Objects/Date.hs
bsd-3-clause
getUTCDate :: JObject Date -> JString getUTCDate = methodCallNoArgs "getUTCDate"
81
getUTCDate :: JObject Date -> JString getUTCDate = methodCallNoArgs "getUTCDate"
80
getUTCDate = methodCallNoArgs "getUTCDate"
42
false
true
0
6
10
21
10
11
null
null
nevrenato/HetsAlloy
Isabelle/IsaSign.hs
gpl-2.0
-- | the original (Haskell) name orig :: VName -> String orig = new
67
orig :: VName -> String orig = new
34
orig = new
10
true
true
0
7
13
23
10
13
null
null
vikraman/ghc
compiler/hsSyn/HsDecls.hs
bsd-3-clause
hsGroupInstDecls :: HsGroup id -> [LInstDecl id] hsGroupInstDecls = (=<<) group_instds . hs_tyclds
98
hsGroupInstDecls :: HsGroup id -> [LInstDecl id] hsGroupInstDecls = (=<<) group_instds . hs_tyclds
98
hsGroupInstDecls = (=<<) group_instds . hs_tyclds
49
false
true
0
7
12
33
17
16
null
null
forste/haReFork
refactorer/PwPf/GlobalPW.hs
bsd-3-clause
global2core (t1 :&: t2) = (global2core t1) :><: (global2core t2)
64
global2core (t1 :&: t2) = (global2core t1) :><: (global2core t2)
64
global2core (t1 :&: t2) = (global2core t1) :><: (global2core t2)
64
false
false
0
7
9
33
16
17
null
null
cgag/cis-194-solutions
src/HW11/AParser.hs
bsd-3-clause
char :: Char -> Parser Char char c = satisfy (== c)
51
char :: Char -> Parser Char char c = satisfy (== c)
51
char c = satisfy (== c)
23
false
true
0
6
11
28
14
14
null
null
beni55/haste-compiler
libraries/ghc-7.8/array/Data/Array/Base.hs
bsd-3-clause
bOOL_INDEX i# = i# `uncheckedIShiftRA#` 5#
42
bOOL_INDEX i# = i# `uncheckedIShiftRA#` 5#
42
bOOL_INDEX i# = i# `uncheckedIShiftRA#` 5#
42
false
false
0
5
5
15
8
7
null
null
cshung/MiscLab
Haskell99/AvlMap.hs
mit
getSize Node { size = size } = size
35
getSize Node { size = size } = size
35
getSize Node { size = size } = size
35
false
false
0
8
8
18
9
9
null
null
tpsinnem/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
reifyTTConstApp f v@(P _ _ _) = lift . tfail . Msg $ "Can't reify the variable " ++ show v ++ " as a constant, because its value is not statically known."
176
reifyTTConstApp f v@(P _ _ _) = lift . tfail . Msg $ "Can't reify the variable " ++ show v ++ " as a constant, because its value is not statically known."
176
reifyTTConstApp f v@(P _ _ _) = lift . tfail . Msg $ "Can't reify the variable " ++ show v ++ " as a constant, because its value is not statically known."
176
false
false
0
9
54
47
23
24
null
null
tjakway/ghcjvm
compiler/basicTypes/BasicTypes.hs
bsd-3-clause
negateFractionalLit (FL { fl_text = text, fl_value = value }) = FL { fl_text = '-':text, fl_value = negate value }
114
negateFractionalLit (FL { fl_text = text, fl_value = value }) = FL { fl_text = '-':text, fl_value = negate value }
114
negateFractionalLit (FL { fl_text = text, fl_value = value }) = FL { fl_text = '-':text, fl_value = negate value }
114
false
false
0
8
20
49
27
22
null
null
urbanslug/ghc
compiler/codeGen/StgCmmArgRep.hs
bsd-3-clause
argRepString V = "V"
20
argRepString V = "V"
20
argRepString V = "V"
20
false
false
0
5
3
9
4
5
null
null
laser/cis-194-spring-2017
src/Homework/Week07/Editor.hs
mit
doCommand Edit = do l <- getCurLine io $ putStr $ "Replace line " ++ show l ++ ": " new <- io getLine modBuffer $ replaceLine l new
139
doCommand Edit = do l <- getCurLine io $ putStr $ "Replace line " ++ show l ++ ": " new <- io getLine modBuffer $ replaceLine l new
139
doCommand Edit = do l <- getCurLine io $ putStr $ "Replace line " ++ show l ++ ": " new <- io getLine modBuffer $ replaceLine l new
139
false
false
0
10
36
60
26
34
null
null
soumith/fbthrift
thrift/lib/hs/Thrift/Protocol/Binary.hs
apache-2.0
parseBinaryValue ty = error $ "Cannot read value of type " ++ show ty
69
parseBinaryValue ty = error $ "Cannot read value of type " ++ show ty
69
parseBinaryValue ty = error $ "Cannot read value of type " ++ show ty
69
false
false
0
6
13
20
9
11
null
null
snoyberg/ghc
compiler/cmm/CmmType.hs
bsd-3-clause
widthInBytes W16 = 2
21
widthInBytes W16 = 2
21
widthInBytes W16 = 2
21
false
false
0
5
4
9
4
5
null
null
rueshyna/gogol
gogol-appengine/gen/Network/Google/Resource/AppEngine/Apps/Services/Versions/Delete.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). asvdUploadProtocol :: Lens' AppsServicesVersionsDelete (Maybe Text) asvdUploadProtocol = lens _asvdUploadProtocol (\ s a -> s{_asvdUploadProtocol = a})
221
asvdUploadProtocol :: Lens' AppsServicesVersionsDelete (Maybe Text) asvdUploadProtocol = lens _asvdUploadProtocol (\ s a -> s{_asvdUploadProtocol = a})
159
asvdUploadProtocol = lens _asvdUploadProtocol (\ s a -> s{_asvdUploadProtocol = a})
91
true
true
0
9
33
48
25
23
null
null
bitemyapp/ghc
compiler/cmm/CLabel.hs
bsd-3-clause
toEntryLbl :: CLabel -> CLabel toEntryLbl (IdLabel n c LocalInfoTable) = IdLabel n c LocalEntry
96
toEntryLbl :: CLabel -> CLabel toEntryLbl (IdLabel n c LocalInfoTable) = IdLabel n c LocalEntry
96
toEntryLbl (IdLabel n c LocalInfoTable) = IdLabel n c LocalEntry
65
false
true
0
7
15
35
17
18
null
null
mzero/plush
src/Plush/Job/StdIO.hs
apache-2.0
stdIOCloseMasters :: StdIOParts -> IO () stdIOCloseMasters StdIOParts {..} = do closeFd master1 closeFd master2 closeFd masterJ
139
stdIOCloseMasters :: StdIOParts -> IO () stdIOCloseMasters StdIOParts {..} = do closeFd master1 closeFd master2 closeFd masterJ
139
stdIOCloseMasters StdIOParts {..} = do closeFd master1 closeFd master2 closeFd masterJ
98
false
true
0
7
28
47
20
27
null
null
lamdu/lamdu
src/Lamdu/GUI/Annotation.hs
gpl-3.0
addAnnotationHoverBackground :: _ => m (a -> a) addAnnotationHoverBackground = addAnnotationBackgroundH ValAnnotation.valAnnotationHoverBGColor
143
addAnnotationHoverBackground :: _ => m (a -> a) addAnnotationHoverBackground = addAnnotationBackgroundH ValAnnotation.valAnnotationHoverBGColor
143
addAnnotationHoverBackground = addAnnotationBackgroundH ValAnnotation.valAnnotationHoverBGColor
95
false
true
0
8
11
31
15
16
null
null
mariefarrell/Hets
CASL/QuickCheck.hs
gpl-2.0
match2 (Sorted_term t1 _ _) t2 = match2 t1 t2
45
match2 (Sorted_term t1 _ _) t2 = match2 t1 t2
45
match2 (Sorted_term t1 _ _) t2 = match2 t1 t2
45
false
false
0
7
9
26
12
14
null
null
vikraman/ghc
libraries/base/Foreign/Ptr.hs
bsd-3-clause
-- | casts a @Ptr@ to an @IntPtr@ ptrToIntPtr :: Ptr a -> IntPtr ptrToIntPtr (Ptr a#) = IntPtr (I# (addr2Int# a#))
114
ptrToIntPtr :: Ptr a -> IntPtr ptrToIntPtr (Ptr a#) = IntPtr (I# (addr2Int# a#))
80
ptrToIntPtr (Ptr a#) = IntPtr (I# (addr2Int# a#))
49
true
true
0
9
21
43
21
22
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/book/2021-05-06-Algebra_Driven_Design-Sandy_Maguire/src/Lib.hs
unlicense
{- can derive it from cw, ccw and flipH -- its own inverse ∀ (t :: Tile). flipV (flipV t) = t -- can derive it from cw, ccw and flipH ∀ (t :: Tile). flipV t = ccw (flipH (cw t)) ∀ (t :: Tile). flipV (flipH t) = cw (cw t) Exercise Derive the fact that flipV is its own inverse, using any of the other laws we’ve given for our algebra. Solution flipV (flipV t) = (via flipV) flipV (ccw (flipH (cw t))) = (via flipV) ccw (flipH (cw (ccw (flipH (cw t))))) = (via cw/ccw) ccw (flipH (flipH (cw t))) = (via flipH/flipH) ccw (cw t) = (via ccw/cw) t Exercise Derive a proof that flipV . flipH = cw . cw Solution flipV (flipH t) = (via flipV) ccw (flipH (cw (flipH t))) = (via ccw) cw (cw (cw (flipH (cw (flipH t))))) = (via x-symmetry) cw (cw (flipH (ccw (cw (flipH t))))) = (via ccw/cw) cw (cw (flipH (flipH t))) = (via flipH/flipH) cw (cw t) composing multiple tiles together - every operation in algebra must take valid inputs to valid outputs - tiles are always square - Simply putting one square tile beside another would result in a rectangular image, INVALIDE - to maintain closure, must subdivide square into two rectangular halves, then fill each half, stretching tiles to cover space -} beside :: Tile -> Tile -> Tile beside = undefined
1,280
beside :: Tile -> Tile -> Tile beside = undefined
50
beside = undefined
19
true
true
0
6
280
20
11
9
null
null
conal/hermit
src/HERMIT/Dictionary/Local/Let.hs
bsd-2-clause
letNonRecElimR :: MonadCatch m => Rewrite c m CoreExpr letNonRecElimR = withPatFailMsg (wrongExprForm "Let (NonRec v e1) e2") $ do Let (NonRec v _) e <- idR guardMsg (v `notElemVarSet` freeVarsExpr e) "let-bound variable appears in the expression." return e -- | Remove all unused recursive let bindings in the current group.
380
letNonRecElimR :: MonadCatch m => Rewrite c m CoreExpr letNonRecElimR = withPatFailMsg (wrongExprForm "Let (NonRec v e1) e2") $ do Let (NonRec v _) e <- idR guardMsg (v `notElemVarSet` freeVarsExpr e) "let-bound variable appears in the expression." return e -- | Remove all unused recursive let bindings in the current group.
380
letNonRecElimR = withPatFailMsg (wrongExprForm "Let (NonRec v e1) e2") $ do Let (NonRec v _) e <- idR guardMsg (v `notElemVarSet` freeVarsExpr e) "let-bound variable appears in the expression." return e -- | Remove all unused recursive let bindings in the current group.
325
false
true
0
11
106
85
40
45
null
null
GaloisInc/pads-haskell
Examples/Regression.hs
bsd-3-clause
pt43 = testParsePadsDecls t43
29
pt43 = testParsePadsDecls t43
29
pt43 = testParsePadsDecls t43
29
false
false
0
5
3
9
4
5
null
null
brendanhay/gogol
gogol-storage/gen/Network/Google/Storage/Types/Product.hs
mpl-2.0
-- | Creates a value of 'ChannelParams' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'cpAddtional' channelParams :: HashMap Text Text -- ^ 'cpAddtional' -> ChannelParams channelParams pCpAddtional_ = ChannelParams' {_cpAddtional = _Coerce # pCpAddtional_}
353
channelParams :: HashMap Text Text -- ^ 'cpAddtional' -> ChannelParams channelParams pCpAddtional_ = ChannelParams' {_cpAddtional = _Coerce # pCpAddtional_}
166
channelParams pCpAddtional_ = ChannelParams' {_cpAddtional = _Coerce # pCpAddtional_}
87
true
true
0
7
62
41
24
17
null
null
haasn/vimus
src/Vimus/Widget/ListWidget.hs
mit
getElementsFormat :: ListWidget f a -> f getElementsFormat list = getFormat list
80
getElementsFormat :: ListWidget f a -> f getElementsFormat list = getFormat list
80
getElementsFormat list = getFormat list
39
false
true
0
6
11
26
12
14
null
null
unisonweb/platform
parser-typechecker/src/Unison/Util/Bytes.hs
mit
toBase16 :: Bytes -> Bytes toBase16 bs = foldl' step empty (chunks bs) where step bs b = snoc bs (BE.convertToBase BE.Base16 b :: ByteString)
143
toBase16 :: Bytes -> Bytes toBase16 bs = foldl' step empty (chunks bs) where step bs b = snoc bs (BE.convertToBase BE.Base16 b :: ByteString)
143
toBase16 bs = foldl' step empty (chunks bs) where step bs b = snoc bs (BE.convertToBase BE.Base16 b :: ByteString)
116
false
true
0
10
26
63
31
32
null
null
strager/b
B/Oracle/InMemory/Pure.hs
bsd-3-clause
empty :: State m empty = State [] []
36
empty :: State m empty = State [] []
36
empty = State [] []
19
false
true
0
6
8
23
11
12
null
null
cblp/graph-dsl-graphviz
examples/GraphVizPower.hs
gpl-3.0
edges' nodes = zipWithM_ (-->) nodes (tail nodes)
49
edges' nodes = zipWithM_ (-->) nodes (tail nodes)
49
edges' nodes = zipWithM_ (-->) nodes (tail nodes)
49
false
false
0
7
7
24
12
12
null
null
ssoudan/hsStruct
test/BSTreeTest.hs
apache-2.0
prop_insert_float :: [Float] -> Bool prop_insert_float (xs :: [Float]) = let t = buildTree xs in getAll $ F.foldMap (\x -> All $ x `elemTree` t) xs
166
prop_insert_float :: [Float] -> Bool prop_insert_float (xs :: [Float]) = let t = buildTree xs in getAll $ F.foldMap (\x -> All $ x `elemTree` t) xs
166
prop_insert_float (xs :: [Float]) = let t = buildTree xs in getAll $ F.foldMap (\x -> All $ x `elemTree` t) xs
129
false
true
2
10
45
79
40
39
null
null
ozgurakgun/Idris-dev
src/Idris/Core/Evaluate.hs
bsd-3-clause
-- | Reduce a term to head normal form hnf :: Context -> Env -> TT Name -> TT Name hnf ctxt env t = evalState (do val <- eval False ctxt [] (map finalEntry env) (finalise t) [HNF] quote 0 val) initEval
289
hnf :: Context -> Env -> TT Name -> TT Name hnf ctxt env t = evalState (do val <- eval False ctxt [] (map finalEntry env) (finalise t) [HNF] quote 0 val) initEval
250
hnf ctxt env t = evalState (do val <- eval False ctxt [] (map finalEntry env) (finalise t) [HNF] quote 0 val) initEval
206
true
true
0
12
130
97
45
52
null
null
mightymoose/liquidhaskell
benchmarks/hmatrix-0.15.0.1/examples/integrate.hs
bsd-3-clause
-- A multiple integral can be easily defined using partial application quad2 f y1 y2 g1 g2 = quad h y1 y2 where h y = quad (flip f y) (g1 y) (g2 y)
153
quad2 f y1 y2 g1 g2 = quad h y1 y2 where h y = quad (flip f y) (g1 y) (g2 y)
82
quad2 f y1 y2 g1 g2 = quad h y1 y2 where h y = quad (flip f y) (g1 y) (g2 y)
82
true
false
0
7
39
63
30
33
null
null
abakst/symmetry
checker/src/simple-parser/ConfigParser2.hs
mit
s_lvarP = LV <$> identifier
27
s_lvarP = LV <$> identifier
27
s_lvarP = LV <$> identifier
27
false
false
0
5
4
10
5
5
null
null
hellertime/proquint
src/Codec/Binary/Proquint/QuickChecks.hs
bsd-3-clause
prop_magic_proquints_are_roundtrippable :: (Eq a, ToProquint a) => a -> Property prop_magic_proquints_are_roundtrippable x = property $ fromProquint (toProquintWithMagic x) == x
177
prop_magic_proquints_are_roundtrippable :: (Eq a, ToProquint a) => a -> Property prop_magic_proquints_are_roundtrippable x = property $ fromProquint (toProquintWithMagic x) == x
177
prop_magic_proquints_are_roundtrippable x = property $ fromProquint (toProquintWithMagic x) == x
96
false
true
0
9
19
50
25
25
null
null
shayan-najd/HsParser
U/StringBuffer.hs
gpl-3.0
stepOn :: StringBuffer -> StringBuffer stepOn s = snd (nextChar s)
66
stepOn :: StringBuffer -> StringBuffer stepOn s = snd (nextChar s)
66
stepOn s = snd (nextChar s)
27
false
true
0
7
10
32
14
18
null
null
vTurbine/ghc
compiler/typecheck/TcGenDeriv.hs
bsd-3-clause
geFloat_RDR = varQual_RDR gHC_PRIM (fsLit "geFloat#")
57
geFloat_RDR = varQual_RDR gHC_PRIM (fsLit "geFloat#")
57
geFloat_RDR = varQual_RDR gHC_PRIM (fsLit "geFloat#")
57
false
false
0
7
9
17
8
9
null
null
DaMSL/K3
src/Language/K3/Core/Expression.hs
apache-2.0
ePropertyValue (Right (_,v)) = v
32
ePropertyValue (Right (_,v)) = v
32
ePropertyValue (Right (_,v)) = v
32
false
false
0
8
4
21
11
10
null
null
plow-technologies/live-vdom-todomvc
src/Lib.hs
bsd-3-clause
-- | Update the input box updateCurrentInput :: STMMailbox JSString -> JSString -> Message () updateCurrentInput mb input = modifyMailbox mb (const input)
154
updateCurrentInput :: STMMailbox JSString -> JSString -> Message () updateCurrentInput mb input = modifyMailbox mb (const input)
128
updateCurrentInput mb input = modifyMailbox mb (const input)
60
true
true
0
8
22
44
21
23
null
null
sdiehl/ghc
hadrian/src/Settings.hs
bsd-3-clause
-- | Interpret a 'builderSetting' as a 'Predicate' that -- potentially constrains on the stage, package or -- (ghc or cc) builder mode. -- -- For example, @stage1.base.ghc.link.opts@ gets mapped to -- a predicate that applies @'stage' 'Stage1'@, -- @'package' 'base'@ and @'builder' ('Ghc' 'LinkHs')@. builderPredicate :: SettingsM Predicate builderPredicate = builderSetting <&> (\(wstg, wpkg, builderMode) -> wildcard (pure True) stage wstg <&&> wildcard (pure True) package wpkg <&&> (case builderMode of Left ghcMode -> wildcard (builder Ghc) (builder . Ghc) ghcMode Right ccMode -> wildcard (builder Cc) (builder . Cc) ccMode)) where (<&&>) = liftA2 (&&) -- | Interpretation-agnostic description of the builder settings -- supported by Hadrian. -- -- Supported settings (to be kept in sync with the code): -- -- > (<stage> or *).(<package name> or *).ghc.(<ghc mode> or *).opts -- > (<stage> or *).(<package name> or *).cc.(<cc mode> or *).opts -- -- where: -- - @<stage>@ is one of @stage0@, @stage1@, @stage2@ or @stage3@; -- - @<package name>@ is the (Cabal) name of a package (@base@, -- @template-haskell@, ...); -- - @<ghc mode>@ is one of @c@ (building C files), @hs@ (building Haskell -- modules), @link@ (linking object files), @deps@ (finding Haskell -- dependencies with @ghc -M@) or @toolargs@ (getting necessary flags to -- make hadrian/ghci.sh work; -- - @<cc mode>@ is one of @c@ (building C files) or @deps@ (finding C -- dependencies); -- - locations that support a wildcard (@*@) entry are here to avoid -- repetition, a wildcard entry being equivalent to writing all the -- settings that the wildcard matches over; in our case, we can -- apply GHC or C compiler options uniformly over all stages, packages -- and compiler modes, if we so desire, by using a wildcard in the -- appropriate spot.
1,937
builderPredicate :: SettingsM Predicate builderPredicate = builderSetting <&> (\(wstg, wpkg, builderMode) -> wildcard (pure True) stage wstg <&&> wildcard (pure True) package wpkg <&&> (case builderMode of Left ghcMode -> wildcard (builder Ghc) (builder . Ghc) ghcMode Right ccMode -> wildcard (builder Cc) (builder . Cc) ccMode)) where (<&&>) = liftA2 (&&) -- | Interpretation-agnostic description of the builder settings -- supported by Hadrian. -- -- Supported settings (to be kept in sync with the code): -- -- > (<stage> or *).(<package name> or *).ghc.(<ghc mode> or *).opts -- > (<stage> or *).(<package name> or *).cc.(<cc mode> or *).opts -- -- where: -- - @<stage>@ is one of @stage0@, @stage1@, @stage2@ or @stage3@; -- - @<package name>@ is the (Cabal) name of a package (@base@, -- @template-haskell@, ...); -- - @<ghc mode>@ is one of @c@ (building C files), @hs@ (building Haskell -- modules), @link@ (linking object files), @deps@ (finding Haskell -- dependencies with @ghc -M@) or @toolargs@ (getting necessary flags to -- make hadrian/ghci.sh work; -- - @<cc mode>@ is one of @c@ (building C files) or @deps@ (finding C -- dependencies); -- - locations that support a wildcard (@*@) entry are here to avoid -- repetition, a wildcard entry being equivalent to writing all the -- settings that the wildcard matches over; in our case, we can -- apply GHC or C compiler options uniformly over all stages, packages -- and compiler modes, if we so desire, by using a wildcard in the -- appropriate spot.
1,625
builderPredicate = builderSetting <&> (\(wstg, wpkg, builderMode) -> wildcard (pure True) stage wstg <&&> wildcard (pure True) package wpkg <&&> (case builderMode of Left ghcMode -> wildcard (builder Ghc) (builder . Ghc) ghcMode Right ccMode -> wildcard (builder Cc) (builder . Cc) ccMode)) where (<&&>) = liftA2 (&&) -- | Interpretation-agnostic description of the builder settings -- supported by Hadrian. -- -- Supported settings (to be kept in sync with the code): -- -- > (<stage> or *).(<package name> or *).ghc.(<ghc mode> or *).opts -- > (<stage> or *).(<package name> or *).cc.(<cc mode> or *).opts -- -- where: -- - @<stage>@ is one of @stage0@, @stage1@, @stage2@ or @stage3@; -- - @<package name>@ is the (Cabal) name of a package (@base@, -- @template-haskell@, ...); -- - @<ghc mode>@ is one of @c@ (building C files), @hs@ (building Haskell -- modules), @link@ (linking object files), @deps@ (finding Haskell -- dependencies with @ghc -M@) or @toolargs@ (getting necessary flags to -- make hadrian/ghci.sh work; -- - @<cc mode>@ is one of @c@ (building C files) or @deps@ (finding C -- dependencies); -- - locations that support a wildcard (@*@) entry are here to avoid -- repetition, a wildcard entry being equivalent to writing all the -- settings that the wildcard matches over; in our case, we can -- apply GHC or C compiler options uniformly over all stages, packages -- and compiler modes, if we so desire, by using a wildcard in the -- appropriate spot.
1,585
true
true
0
15
412
180
108
72
null
null
pocket7878/mini-reg
src/EpsilonNFA.hs
gpl-3.0
mkEpsilonNFA :: (Eq a) => D.State a -> [Rule a b] -> [D.State a] -> EpsilonNFA a b mkEpsilonNFA s rs gs = EpsilonNFA { _fstState = s ,_currState = eclose [s] rs ,_rules = rs ,_goalState = gs }
272
mkEpsilonNFA :: (Eq a) => D.State a -> [Rule a b] -> [D.State a] -> EpsilonNFA a b mkEpsilonNFA s rs gs = EpsilonNFA { _fstState = s ,_currState = eclose [s] rs ,_rules = rs ,_goalState = gs }
272
mkEpsilonNFA s rs gs = EpsilonNFA { _fstState = s ,_currState = eclose [s] rs ,_rules = rs ,_goalState = gs }
189
false
true
0
11
119
105
54
51
null
null
icyfork/shellcheck
ShellCheck/Parser.hs
gpl-3.0
g_DSEMI = tryToken ";;" T_DSEMI
31
g_DSEMI = tryToken ";;" T_DSEMI
31
g_DSEMI = tryToken ";;" T_DSEMI
31
false
false
0
5
4
11
5
6
null
null
beni55/haste-compiler
libraries/ghc-7.10/base/Data/Data.hs
bsd-3-clause
-- | Constructs a constructor mkConstr :: DataType -> String -> [String] -> Fixity -> Constr mkConstr dt str fields fix = Constr { conrep = AlgConstr idx , constring = str , confields = fields , confixity = fix , datatype = dt } where idx = head [ i | (c,i) <- dataTypeConstrs dt `zip` [1..], showConstr c == str ] -- | Gets the constructors of an algebraic datatype
503
mkConstr :: DataType -> String -> [String] -> Fixity -> Constr mkConstr dt str fields fix = Constr { conrep = AlgConstr idx , constring = str , confields = fields , confixity = fix , datatype = dt } where idx = head [ i | (c,i) <- dataTypeConstrs dt `zip` [1..], showConstr c == str ] -- | Gets the constructors of an algebraic datatype
473
mkConstr dt str fields fix = Constr { conrep = AlgConstr idx , constring = str , confields = fields , confixity = fix , datatype = dt } where idx = head [ i | (c,i) <- dataTypeConstrs dt `zip` [1..], showConstr c == str ] -- | Gets the constructors of an algebraic datatype
410
true
true
1
10
208
130
71
59
null
null
5outh/textlunky
src/Control/Process/Show.hs
mit
-- | Print a string with a prompt token prefix putStrLnP = putStrLn . (token++) where token = ">> " -- process handling showing user commands
148
putStrLnP = putStrLn . (token++) where token = ">> " -- process handling showing user commands
97
putStrLnP = putStrLn . (token++) where token = ">> " -- process handling showing user commands
97
true
false
0
6
32
24
14
10
null
null
nevrenato/Hets_Fork
Comorphisms/Hs2HOLCF.hs
gpl-2.0
transClassInfo :: Continuity -> (Kind, HsTypeInfo) -> Maybe [IsaClass] transClassInfo c p = case snd p of TiTypes.Class _ _ _ _ -> Just $ remove_duplicates $ (case c of IsCont _ -> dom NotCont -> holType) ++ map transClass (extClassInfo $ snd p) _ -> Nothing ------------------- translation of Abbrs (from KEnv) --------------------
400
transClassInfo :: Continuity -> (Kind, HsTypeInfo) -> Maybe [IsaClass] transClassInfo c p = case snd p of TiTypes.Class _ _ _ _ -> Just $ remove_duplicates $ (case c of IsCont _ -> dom NotCont -> holType) ++ map transClass (extClassInfo $ snd p) _ -> Nothing ------------------- translation of Abbrs (from KEnv) --------------------
400
transClassInfo c p = case snd p of TiTypes.Class _ _ _ _ -> Just $ remove_duplicates $ (case c of IsCont _ -> dom NotCont -> holType) ++ map transClass (extClassInfo $ snd p) _ -> Nothing ------------------- translation of Abbrs (from KEnv) --------------------
329
false
true
0
14
121
121
59
62
null
null
alexander-at-github/eta
compiler/ETA/SimplCore/SAT.hs
bsd-3-clause
mergeSATInfo :: SATInfo -> SATInfo -> SATInfo mergeSATInfo l r = zipWith mergeSA l r where mergeSA NotStatic _ = NotStatic mergeSA _ NotStatic = NotStatic mergeSA (Static (VarApp v)) (Static (VarApp v')) | v == v' = Static (VarApp v) | otherwise = NotStatic mergeSA (Static (TypeApp t)) (Static (TypeApp t')) | t `eqType` t' = Static (TypeApp t) | otherwise = NotStatic mergeSA (Static (CoApp c)) (Static (CoApp c')) | c `coreEqCoercion` c' = Static (CoApp c) | otherwise = NotStatic mergeSA _ _ = pprPanic "mergeSATInfo" $ ptext (sLit "Left:") <> pprSATInfo l <> ptext (sLit ", ") <> ptext (sLit "Right:") <> pprSATInfo r
798
mergeSATInfo :: SATInfo -> SATInfo -> SATInfo mergeSATInfo l r = zipWith mergeSA l r where mergeSA NotStatic _ = NotStatic mergeSA _ NotStatic = NotStatic mergeSA (Static (VarApp v)) (Static (VarApp v')) | v == v' = Static (VarApp v) | otherwise = NotStatic mergeSA (Static (TypeApp t)) (Static (TypeApp t')) | t `eqType` t' = Static (TypeApp t) | otherwise = NotStatic mergeSA (Static (CoApp c)) (Static (CoApp c')) | c `coreEqCoercion` c' = Static (CoApp c) | otherwise = NotStatic mergeSA _ _ = pprPanic "mergeSATInfo" $ ptext (sLit "Left:") <> pprSATInfo l <> ptext (sLit ", ") <> ptext (sLit "Right:") <> pprSATInfo r
798
mergeSATInfo l r = zipWith mergeSA l r where mergeSA NotStatic _ = NotStatic mergeSA _ NotStatic = NotStatic mergeSA (Static (VarApp v)) (Static (VarApp v')) | v == v' = Static (VarApp v) | otherwise = NotStatic mergeSA (Static (TypeApp t)) (Static (TypeApp t')) | t `eqType` t' = Static (TypeApp t) | otherwise = NotStatic mergeSA (Static (CoApp c)) (Static (CoApp c')) | c `coreEqCoercion` c' = Static (CoApp c) | otherwise = NotStatic mergeSA _ _ = pprPanic "mergeSATInfo" $ ptext (sLit "Left:") <> pprSATInfo l <> ptext (sLit ", ") <> ptext (sLit "Right:") <> pprSATInfo r
752
false
true
4
12
283
328
152
176
null
null
merijn/GPU-benchmarks
benchmark-analysis/src/Sql/Core.hs
gpl-3.0
executeSqlSingleValueMaybe :: (MonadLogger m, MonadSql m, MonadThrow m, PersistField a) => Text -> Transaction m (Maybe a) executeSqlSingleValueMaybe query = Transaction $ do result <- Sqlite.rawSql query [] case result of [] -> return Nothing [Single v] -> return $ Just v _ -> logThrowM $ ExpectedSingleValue query
356
executeSqlSingleValueMaybe :: (MonadLogger m, MonadSql m, MonadThrow m, PersistField a) => Text -> Transaction m (Maybe a) executeSqlSingleValueMaybe query = Transaction $ do result <- Sqlite.rawSql query [] case result of [] -> return Nothing [Single v] -> return $ Just v _ -> logThrowM $ ExpectedSingleValue query
356
executeSqlSingleValueMaybe query = Transaction $ do result <- Sqlite.rawSql query [] case result of [] -> return Nothing [Single v] -> return $ Just v _ -> logThrowM $ ExpectedSingleValue query
225
false
true
0
13
87
131
61
70
null
null
markhibberd/numerus
src/main.hs
bsd-3-clause
main :: IO () main = do args <- getArgs case args of port : db : [] -> go (read port) db _ -> error "usage: numerus PORT DATABASE_URL"
155
main :: IO () main = do args <- getArgs case args of port : db : [] -> go (read port) db _ -> error "usage: numerus PORT DATABASE_URL"
155
main = do args <- getArgs case args of port : db : [] -> go (read port) db _ -> error "usage: numerus PORT DATABASE_URL"
141
false
true
0
13
50
72
32
40
null
null
ducis/flapjax-fixed
flapjax/trunk/compiler/src/Fxc.hs
bsd-3-clause
getFlapjaxPath :: [Option] -> IO (String,[Option]) getFlapjaxPath ((Flapjax s):rest) = return (s,rest)
102
getFlapjaxPath :: [Option] -> IO (String,[Option]) getFlapjaxPath ((Flapjax s):rest) = return (s,rest)
102
getFlapjaxPath ((Flapjax s):rest) = return (s,rest)
51
false
true
0
8
11
59
31
28
null
null
sinelaw/buildsome
src/Buildsome.hs
gpl-2.0
buildTargetHints :: BuildTargetEnv -> Parallelism.Entity -> TargetType FilePath FilePath -> IO (ExplicitPathsBuilt, BuiltTargets) buildTargetHints bte@BuildTargetEnv{..} entity target = do let parentPaths = parentDirs $ targetOutputs target targetParentsBuilt <- buildManyWithParReleased Db.BecauseContainerDirectoryOfOutput bte entity $ map SlaveRequestDirect parentPaths explicitParentsBuilt <- assertExplicitInputsExist bte parentPaths case explicitParentsBuilt of ExplicitPathsNotBuilt -> return (ExplicitPathsNotBuilt, targetParentsBuilt) ExplicitPathsBuilt -> do (explicitPathsBuilt, inputsBuilt) <- buildExplicitWithParReleased bte { bteReason = Db.BecauseHintFrom $ targetOutputs target } entity $ map SlaveRequestDirect $ targetAllInputs target return (explicitPathsBuilt, targetParentsBuilt <> inputsBuilt) where Color.Scheme{..} = Color.scheme
954
buildTargetHints :: BuildTargetEnv -> Parallelism.Entity -> TargetType FilePath FilePath -> IO (ExplicitPathsBuilt, BuiltTargets) buildTargetHints bte@BuildTargetEnv{..} entity target = do let parentPaths = parentDirs $ targetOutputs target targetParentsBuilt <- buildManyWithParReleased Db.BecauseContainerDirectoryOfOutput bte entity $ map SlaveRequestDirect parentPaths explicitParentsBuilt <- assertExplicitInputsExist bte parentPaths case explicitParentsBuilt of ExplicitPathsNotBuilt -> return (ExplicitPathsNotBuilt, targetParentsBuilt) ExplicitPathsBuilt -> do (explicitPathsBuilt, inputsBuilt) <- buildExplicitWithParReleased bte { bteReason = Db.BecauseHintFrom $ targetOutputs target } entity $ map SlaveRequestDirect $ targetAllInputs target return (explicitPathsBuilt, targetParentsBuilt <> inputsBuilt) where Color.Scheme{..} = Color.scheme
954
buildTargetHints bte@BuildTargetEnv{..} entity target = do let parentPaths = parentDirs $ targetOutputs target targetParentsBuilt <- buildManyWithParReleased Db.BecauseContainerDirectoryOfOutput bte entity $ map SlaveRequestDirect parentPaths explicitParentsBuilt <- assertExplicitInputsExist bte parentPaths case explicitParentsBuilt of ExplicitPathsNotBuilt -> return (ExplicitPathsNotBuilt, targetParentsBuilt) ExplicitPathsBuilt -> do (explicitPathsBuilt, inputsBuilt) <- buildExplicitWithParReleased bte { bteReason = Db.BecauseHintFrom $ targetOutputs target } entity $ map SlaveRequestDirect $ targetAllInputs target return (explicitPathsBuilt, targetParentsBuilt <> inputsBuilt) where Color.Scheme{..} = Color.scheme
822
false
true
0
19
180
219
106
113
null
null
wavewave/hoodle-core
src/Hoodle/Type/HoodleState.hs
gpl-3.0
-- | default hoodle state emptyHoodleState :: IO HoodleState emptyHoodleState = do hdl <- emptyGHoodle return $ HoodleState { _hoodleModeState = ViewAppendState hdl , _hoodleFileControl = emptyHoodleFileControl -- , _currFileName = Nothing , _cvsInfoMap = error "emptyHoodleState.cvsInfoMap" , _currentCanvas = error "emtpyHoodleState.currentCanvas" , _frameState = error "emptyHoodleState.frameState" , _rootWindow = error "emtpyHoodleState.rootWindow" , _rootContainer = error "emptyHoodleState.rootContainer" , _rootOfRootWindow = error "emptyHoodleState.rootOfRootWindow" , _currentPenDraw = emptyPenDraw -- , _clipboard = emptyClipboard , _callBack = error "emtpyHoodleState.callBack" , _deviceList = error "emtpyHoodleState.deviceList" , _penInfo = defaultPenInfo , _selectInfo = SelectInfo SelectLassoWork , _gtkUIManager = error "emptyHoodleState.gtkUIManager" , _isSaved = False , _undoTable = emptyUndo 1 -- , _isEventBlocked = False , _backgroundStyle = BkgStyleLined , _isFullScreen = False , _settings = defaultSettings , _uiComponentSignalHandler = defaultUIComponentSignalHandler , _isOneTimeSelectMode = NoOneTimeSelectMode -- , _pageModeSignal = Nothing -- , _penModeSignal = Nothing , _lastTimeCanvasConfigure = Nothing , _hookSet = Nothing , _tempQueue = emptyQueue , _tempLog = id , _statusBar = Nothing }
1,524
emptyHoodleState :: IO HoodleState emptyHoodleState = do hdl <- emptyGHoodle return $ HoodleState { _hoodleModeState = ViewAppendState hdl , _hoodleFileControl = emptyHoodleFileControl -- , _currFileName = Nothing , _cvsInfoMap = error "emptyHoodleState.cvsInfoMap" , _currentCanvas = error "emtpyHoodleState.currentCanvas" , _frameState = error "emptyHoodleState.frameState" , _rootWindow = error "emtpyHoodleState.rootWindow" , _rootContainer = error "emptyHoodleState.rootContainer" , _rootOfRootWindow = error "emptyHoodleState.rootOfRootWindow" , _currentPenDraw = emptyPenDraw -- , _clipboard = emptyClipboard , _callBack = error "emtpyHoodleState.callBack" , _deviceList = error "emtpyHoodleState.deviceList" , _penInfo = defaultPenInfo , _selectInfo = SelectInfo SelectLassoWork , _gtkUIManager = error "emptyHoodleState.gtkUIManager" , _isSaved = False , _undoTable = emptyUndo 1 -- , _isEventBlocked = False , _backgroundStyle = BkgStyleLined , _isFullScreen = False , _settings = defaultSettings , _uiComponentSignalHandler = defaultUIComponentSignalHandler , _isOneTimeSelectMode = NoOneTimeSelectMode -- , _pageModeSignal = Nothing -- , _penModeSignal = Nothing , _lastTimeCanvasConfigure = Nothing , _hookSet = Nothing , _tempQueue = emptyQueue , _tempLog = id , _statusBar = Nothing }
1,496
emptyHoodleState = do hdl <- emptyGHoodle return $ HoodleState { _hoodleModeState = ViewAppendState hdl , _hoodleFileControl = emptyHoodleFileControl -- , _currFileName = Nothing , _cvsInfoMap = error "emptyHoodleState.cvsInfoMap" , _currentCanvas = error "emtpyHoodleState.currentCanvas" , _frameState = error "emptyHoodleState.frameState" , _rootWindow = error "emtpyHoodleState.rootWindow" , _rootContainer = error "emptyHoodleState.rootContainer" , _rootOfRootWindow = error "emptyHoodleState.rootOfRootWindow" , _currentPenDraw = emptyPenDraw -- , _clipboard = emptyClipboard , _callBack = error "emtpyHoodleState.callBack" , _deviceList = error "emtpyHoodleState.deviceList" , _penInfo = defaultPenInfo , _selectInfo = SelectInfo SelectLassoWork , _gtkUIManager = error "emptyHoodleState.gtkUIManager" , _isSaved = False , _undoTable = emptyUndo 1 -- , _isEventBlocked = False , _backgroundStyle = BkgStyleLined , _isFullScreen = False , _settings = defaultSettings , _uiComponentSignalHandler = defaultUIComponentSignalHandler , _isOneTimeSelectMode = NoOneTimeSelectMode -- , _pageModeSignal = Nothing -- , _penModeSignal = Nothing , _lastTimeCanvasConfigure = Nothing , _hookSet = Nothing , _tempQueue = emptyQueue , _tempLog = id , _statusBar = Nothing }
1,461
true
true
0
11
358
234
137
97
null
null