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
snoyberg/yackage
yackage-upload.hs
bsd-3-clause
bound = "YACKAGEUPLOAD"
23
bound = "YACKAGEUPLOAD"
23
bound = "YACKAGEUPLOAD"
23
false
false
0
4
2
6
3
3
null
null
beni55/haste-compiler
libraries/ghc-7.8/base/GHC/Float/ConversionUtils.hs
bsd-3-clause
elimZerosInt# :: Int# -> Int# -> (# Integer, Int# #) elimZerosInt# n e = case zeroCount (toByte# n) of t | isTrue# (e <=# t) -> (# smallInteger (uncheckedIShiftRA# n e), 0# #) | isTrue# (t <# 8#) -> (# smallInteger (uncheckedIShiftRA# n t), e -# t #) | otherwise -> elimZerosInt# (uncheckedIShiftRA# n 8#) (e -# 8#)
363
elimZerosInt# :: Int# -> Int# -> (# Integer, Int# #) elimZerosInt# n e = case zeroCount (toByte# n) of t | isTrue# (e <=# t) -> (# smallInteger (uncheckedIShiftRA# n e), 0# #) | isTrue# (t <# 8#) -> (# smallInteger (uncheckedIShiftRA# n t), e -# t #) | otherwise -> elimZerosInt# (uncheckedIShiftRA# n 8#) (e -# 8#)
363
elimZerosInt# n e = case zeroCount (toByte# n) of t | isTrue# (e <=# t) -> (# smallInteger (uncheckedIShiftRA# n e), 0# #) | isTrue# (t <# 8#) -> (# smallInteger (uncheckedIShiftRA# n t), e -# t #) | otherwise -> elimZerosInt# (uncheckedIShiftRA# n 8#) (e -# 8#)
310
false
true
0
13
105
148
72
76
null
null
raposalorx/mssbot
Text.hs
bsd-3-clause
youstr = (++) . googlestr $ "site%3Awww.youtube.com+"
53
youstr = (++) . googlestr $ "site%3Awww.youtube.com+"
53
youstr = (++) . googlestr $ "site%3Awww.youtube.com+"
53
false
false
0
6
6
16
9
7
null
null
brendanhay/gogol
gogol-dataflow/gen/Network/Google/Resource/Dataflow/Projects/Snapshots/Get.hs
mpl-2.0
-- | Creates a value of 'ProjectsSnapshotsGet' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'psgXgafv' -- -- * 'psgUploadProtocol' -- -- * 'psgLocation' -- -- * 'psgAccessToken' -- -- * 'psgUploadType' -- -- * 'psgProjectId' -- -- * 'psgCallback' -- -- * 'psgSnapshotId' projectsSnapshotsGet :: Text -- ^ 'psgProjectId' -> Text -- ^ 'psgSnapshotId' -> ProjectsSnapshotsGet projectsSnapshotsGet pPsgProjectId_ pPsgSnapshotId_ = ProjectsSnapshotsGet' { _psgXgafv = Nothing , _psgUploadProtocol = Nothing , _psgLocation = Nothing , _psgAccessToken = Nothing , _psgUploadType = Nothing , _psgProjectId = pPsgProjectId_ , _psgCallback = Nothing , _psgSnapshotId = pPsgSnapshotId_ }
814
projectsSnapshotsGet :: Text -- ^ 'psgProjectId' -> Text -- ^ 'psgSnapshotId' -> ProjectsSnapshotsGet projectsSnapshotsGet pPsgProjectId_ pPsgSnapshotId_ = ProjectsSnapshotsGet' { _psgXgafv = Nothing , _psgUploadProtocol = Nothing , _psgLocation = Nothing , _psgAccessToken = Nothing , _psgUploadType = Nothing , _psgProjectId = pPsgProjectId_ , _psgCallback = Nothing , _psgSnapshotId = pPsgSnapshotId_ }
455
projectsSnapshotsGet pPsgProjectId_ pPsgSnapshotId_ = ProjectsSnapshotsGet' { _psgXgafv = Nothing , _psgUploadProtocol = Nothing , _psgLocation = Nothing , _psgAccessToken = Nothing , _psgUploadType = Nothing , _psgProjectId = pPsgProjectId_ , _psgCallback = Nothing , _psgSnapshotId = pPsgSnapshotId_ }
341
true
true
0
6
162
95
66
29
null
null
ezyang/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
emitPrimOp _ [res] Ctz16Op [w] = emitCtzCall res w W16
59
emitPrimOp _ [res] Ctz16Op [w] = emitCtzCall res w W16
59
emitPrimOp _ [res] Ctz16Op [w] = emitCtzCall res w W16
59
false
false
1
6
14
32
14
18
null
null
diorge/challenge-attack-rooks
src/Rooks.hs
mit
positions :: Board -> Vec.Vector (Int, Int) positions b = Vec.map (\(x,y) -> (x+1, y+1)) $ Vec.generate (n*n) (\i -> (i `mod` n, i `div` n)) where n = nrows b
190
positions :: Board -> Vec.Vector (Int, Int) positions b = Vec.map (\(x,y) -> (x+1, y+1)) $ Vec.generate (n*n) (\i -> (i `mod` n, i `div` n)) where n = nrows b
190
positions b = Vec.map (\(x,y) -> (x+1, y+1)) $ Vec.generate (n*n) (\i -> (i `mod` n, i `div` n)) where n = nrows b
146
false
true
0
10
62
116
65
51
null
null
tanimoto/monadIO
src/Control/Concurrent/STM/MonadIO.hs
bsd-3-clause
newTMVar :: MonadIO io => a -> io (TMVar a) newTMVar x = liftIO $ S.newTMVarIO x
80
newTMVar :: MonadIO io => a -> io (TMVar a) newTMVar x = liftIO $ S.newTMVarIO x
80
newTMVar x = liftIO $ S.newTMVarIO x
36
false
true
2
10
16
49
21
28
null
null
frantisekfarka/ghc-dsi
testsuite/tests/codeGen/should_run/cgrun068.hs
bsd-3-clause
toListM :: MArray s e -> ST s [e] toListM marr = sequence [read marr i | i <- [0..(length marr)-1]]
103
toListM :: MArray s e -> ST s [e] toListM marr = sequence [read marr i | i <- [0..(length marr)-1]]
103
toListM marr = sequence [read marr i | i <- [0..(length marr)-1]]
69
false
true
0
12
24
70
33
37
null
null
tphyahoo/happs-tutorial
src/ControllerStressTests.hs
bsd-3-clause
stresstestdata jobsperU users = Users $ M.fromList $ map (stresstestUser jobsperU) users
88
stresstestdata jobsperU users = Users $ M.fromList $ map (stresstestUser jobsperU) users
88
stresstestdata jobsperU users = Users $ M.fromList $ map (stresstestUser jobsperU) users
88
false
false
0
8
11
32
15
17
null
null
acowley/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
readListPrecDefault_RDR = varQual_RDR gHC_READ (fsLit "readListPrecDefault")
76
readListPrecDefault_RDR = varQual_RDR gHC_READ (fsLit "readListPrecDefault")
76
readListPrecDefault_RDR = varQual_RDR gHC_READ (fsLit "readListPrecDefault")
76
false
false
0
7
5
17
8
9
null
null
brendanhay/gogol
gogol-books/gen/Network/Google/Resource/Books/Onboarding/ListCategoryVolumes.hs
mpl-2.0
-- | JSONP olcvCallback :: Lens' OnboardingListCategoryVolumes (Maybe Text) olcvCallback = lens _olcvCallback (\ s a -> s{_olcvCallback = a})
143
olcvCallback :: Lens' OnboardingListCategoryVolumes (Maybe Text) olcvCallback = lens _olcvCallback (\ s a -> s{_olcvCallback = a})
132
olcvCallback = lens _olcvCallback (\ s a -> s{_olcvCallback = a})
67
true
true
0
9
21
48
25
23
null
null
spechub/Hets
Common/ATerm/ATermLibTest.hs
gpl-2.0
testATC :: FilePath -> IO () testATC fp = do str <- readFile fp let att = readATerm str putStrLn ("Reading File " ++ fp ++ " ...") let fp' = fp ++ ".ttttt" putStrLn ("Writing File " ++ fp' ++ " ...") writeFileSDoc fp' (writeSharedATermSDoc att)
256
testATC :: FilePath -> IO () testATC fp = do str <- readFile fp let att = readATerm str putStrLn ("Reading File " ++ fp ++ " ...") let fp' = fp ++ ".ttttt" putStrLn ("Writing File " ++ fp' ++ " ...") writeFileSDoc fp' (writeSharedATermSDoc att)
256
testATC fp = do str <- readFile fp let att = readATerm str putStrLn ("Reading File " ++ fp ++ " ...") let fp' = fp ++ ".ttttt" putStrLn ("Writing File " ++ fp' ++ " ...") writeFileSDoc fp' (writeSharedATermSDoc att)
227
false
true
0
11
58
111
49
62
null
null
danr/hipspec
examples/old-examples/hip/Nat.hs
gpl-3.0
prop_assoc_mul :: Nat -> Nat -> Nat -> Prop Nat prop_assoc_mul x y z = x * (y * z) =:= (x * y) * z
98
prop_assoc_mul :: Nat -> Nat -> Nat -> Prop Nat prop_assoc_mul x y z = x * (y * z) =:= (x * y) * z
98
prop_assoc_mul x y z = x * (y * z) =:= (x * y) * z
50
false
true
0
9
25
59
30
29
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/topic/applicatives/mcbride-paterson-applicative-programming-with-effects/APWE.hs
unlicense
-- p. 4 -- hiding the environment using Applicative eval'' :: Ord v => Exp v -> Env v -> Int eval'' (Var x) = fetch x
124
eval'' :: Ord v => Exp v -> Env v -> Int eval'' (Var x) = fetch x
71
eval'' (Var x) = fetch x
30
true
true
0
11
33
51
23
28
null
null
snoyberg/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
exprCtOrigin (HsOverLabel l) = OverLabelOrigin l
51
exprCtOrigin (HsOverLabel l) = OverLabelOrigin l
51
exprCtOrigin (HsOverLabel l) = OverLabelOrigin l
51
false
false
0
6
8
19
8
11
null
null
iblech/blaze-html
src/Util/GenerateHtmlCombinators.hs
bsd-3-clause
-- | Generate a function for an HTML tag that can be a parent. -- makeParent :: String -> String makeParent tag = unlines [ DO_NOT_EDIT , "-- | Combinator for the @\\<" ++ tag ++ ">@ element." , "--" , "-- Example:" , "--" , "-- > " ++ function ++ " $ span $ toHtml \"foo\"" , "--" , "-- Result:" , "--" , "-- > <" ++ tag ++ "><span>foo</span></" ++ tag ++ ">" , "--" , function ++ " :: Html -- ^ Inner HTML." , spaces function ++ " -> Html -- ^ Resulting HTML." , function ++ " = Parent \"" ++ tag ++ "\" \"<" ++ tag ++ "\" \"</" ++ tag ++ ">\"" ++ modifier , "{-# INLINE " ++ function ++ " #-}" ] where function = sanitize tag modifier = if tag `elem` ["style", "script"] then " . external" else "" -- | Generate a function for an HTML tag that must be a leaf. --
878
makeParent :: String -> String makeParent tag = unlines [ DO_NOT_EDIT , "-- | Combinator for the @\\<" ++ tag ++ ">@ element." , "--" , "-- Example:" , "--" , "-- > " ++ function ++ " $ span $ toHtml \"foo\"" , "--" , "-- Result:" , "--" , "-- > <" ++ tag ++ "><span>foo</span></" ++ tag ++ ">" , "--" , function ++ " :: Html -- ^ Inner HTML." , spaces function ++ " -> Html -- ^ Resulting HTML." , function ++ " = Parent \"" ++ tag ++ "\" \"<" ++ tag ++ "\" \"</" ++ tag ++ ">\"" ++ modifier , "{-# INLINE " ++ function ++ " #-}" ] where function = sanitize tag modifier = if tag `elem` ["style", "script"] then " . external" else "" -- | Generate a function for an HTML tag that must be a leaf. --
812
makeParent tag = unlines [ DO_NOT_EDIT , "-- | Combinator for the @\\<" ++ tag ++ ">@ element." , "--" , "-- Example:" , "--" , "-- > " ++ function ++ " $ span $ toHtml \"foo\"" , "--" , "-- Result:" , "--" , "-- > <" ++ tag ++ "><span>foo</span></" ++ tag ++ ">" , "--" , function ++ " :: Html -- ^ Inner HTML." , spaces function ++ " -> Html -- ^ Resulting HTML." , function ++ " = Parent \"" ++ tag ++ "\" \"<" ++ tag ++ "\" \"</" ++ tag ++ ">\"" ++ modifier , "{-# INLINE " ++ function ++ " #-}" ] where function = sanitize tag modifier = if tag `elem` ["style", "script"] then " . external" else "" -- | Generate a function for an HTML tag that must be a leaf. --
781
true
true
1
13
278
197
107
90
null
null
DavidAlphaFox/ghc
compiler/utils/Maybes.hs
bsd-3-clause
whenIsJust :: Monad m => Maybe a -> (a -> m ()) -> m () whenIsJust (Just x) f = f x
83
whenIsJust :: Monad m => Maybe a -> (a -> m ()) -> m () whenIsJust (Just x) f = f x
83
whenIsJust (Just x) f = f x
27
false
true
0
12
21
65
29
36
null
null
23Skidoo/snap
src/Snap/Snaplet/Auth/SpliceHelpers.hs
bsd-3-clause
compiledAuthSplices :: SnapletLens b (AuthManager b) -> Splices (SnapletCSplice b) compiledAuthSplices auth = do "ifLoggedIn" ## cIfLoggedIn auth "ifLoggedOut" ## cIfLoggedOut auth "loggedInUser" ## cLoggedInUser auth ------------------------------------------------------------------------------ -- | Function to generate interpreted splices from an AuthUser.
397
compiledAuthSplices :: SnapletLens b (AuthManager b) -> Splices (SnapletCSplice b) compiledAuthSplices auth = do "ifLoggedIn" ## cIfLoggedIn auth "ifLoggedOut" ## cIfLoggedOut auth "loggedInUser" ## cLoggedInUser auth ------------------------------------------------------------------------------ -- | Function to generate interpreted splices from an AuthUser.
397
compiledAuthSplices auth = do "ifLoggedIn" ## cIfLoggedIn auth "ifLoggedOut" ## cIfLoggedOut auth "loggedInUser" ## cLoggedInUser auth ------------------------------------------------------------------------------ -- | Function to generate interpreted splices from an AuthUser.
294
false
true
0
8
73
70
32
38
null
null
leksah/leksah-diagrams-hello
src/Main.hs
mit
diagram = circle 1
18
diagram = circle 1
18
diagram = circle 1
18
false
false
1
5
3
12
4
8
null
null
mightymoose/liquidhaskell
benchmarks/xmonad-0.10/tests/Properties.hs
bsd-3-clause
-- insert when an item is a member should leave the stackset unchanged prop_insert_duplicate i (x :: T) = member i x ==> insertUp i x == x
138
prop_insert_duplicate i (x :: T) = member i x ==> insertUp i x == x
67
prop_insert_duplicate i (x :: T) = member i x ==> insertUp i x == x
67
true
false
0
7
27
37
18
19
null
null
hanshoglund/comb
comb2.hs
bsd-3-clause
random = Random
16
random = Random
16
random = Random
16
false
false
1
5
3
10
3
7
null
null
zachsully/hakaru
haskell/Language/Hakaru/Pretty/Maple.hs
bsd-3-clause
maplePrimOp :: (ABT Term abt, typs ~ UnLCs args, args ~ LCs typs) => PrimOp typs a -> SArgs abt args -> ShowS maplePrimOp Not (e1 :* End) = app1 "Not" e1
180
maplePrimOp :: (ABT Term abt, typs ~ UnLCs args, args ~ LCs typs) => PrimOp typs a -> SArgs abt args -> ShowS maplePrimOp Not (e1 :* End) = app1 "Not" e1
180
maplePrimOp Not (e1 :* End) = app1 "Not" e1
62
false
true
0
8
58
79
38
41
null
null
keithodulaigh/Hets
THF/ParseTHF.hs
gpl-2.0
{- THF: <plain_term> ::= <constant> | <functor>(<arguments>) -} plainTerm :: CharParser st PlainTerm plainTerm = try (do f <- tptpFunctor a <- parentheses arguments return $ PT_Plain_Term f a) <|> fmap PT_Constant constant
236
plainTerm :: CharParser st PlainTerm plainTerm = try (do f <- tptpFunctor a <- parentheses arguments return $ PT_Plain_Term f a) <|> fmap PT_Constant constant
172
plainTerm = try (do f <- tptpFunctor a <- parentheses arguments return $ PT_Plain_Term f a) <|> fmap PT_Constant constant
135
true
true
3
9
46
71
31
40
null
null
AjayRamanathan/plots
src/Plots/Types/Line.hs
bsd-3-clause
mkTrail :: (PointLike v n p, OrderedField n, Foldable f) => f p -> Located (Trail v n) mkTrail = mkTrailOf folded
113
mkTrail :: (PointLike v n p, OrderedField n, Foldable f) => f p -> Located (Trail v n) mkTrail = mkTrailOf folded
113
mkTrail = mkTrailOf folded
26
false
true
0
9
21
57
28
29
null
null
mathhun/stack
src/Stack/Build/Cache.hs
bsd-3-clause
writeBuildCache :: (MonadIO m, MonadReader env m, HasConfig env, MonadThrow m, MonadLogger m, HasEnvConfig env) => Path Abs Dir -> Map FilePath FileCacheInfo -> m () writeBuildCache dir times = writeCache dir buildCacheFile BuildCache { buildCacheTimes = times }
324
writeBuildCache :: (MonadIO m, MonadReader env m, HasConfig env, MonadThrow m, MonadLogger m, HasEnvConfig env) => Path Abs Dir -> Map FilePath FileCacheInfo -> m () writeBuildCache dir times = writeCache dir buildCacheFile BuildCache { buildCacheTimes = times }
324
writeBuildCache dir times = writeCache dir buildCacheFile BuildCache { buildCacheTimes = times }
142
false
true
0
9
100
95
47
48
null
null
brendanhay/gogol
gogol-identity-toolkit/gen/Network/Google/IdentityToolkit/Types/Product.hs
mpl-2.0
-- | Authorized domains. irpgpcrAuthorizedDomains :: Lens' IdentitytoolkitRelyingPartyGetProjectConfigResponse [Text] irpgpcrAuthorizedDomains = lens _irpgpcrAuthorizedDomains (\ s a -> s{_irpgpcrAuthorizedDomains = a}) . _Default . _Coerce
260
irpgpcrAuthorizedDomains :: Lens' IdentitytoolkitRelyingPartyGetProjectConfigResponse [Text] irpgpcrAuthorizedDomains = lens _irpgpcrAuthorizedDomains (\ s a -> s{_irpgpcrAuthorizedDomains = a}) . _Default . _Coerce
235
irpgpcrAuthorizedDomains = lens _irpgpcrAuthorizedDomains (\ s a -> s{_irpgpcrAuthorizedDomains = a}) . _Default . _Coerce
142
true
true
0
11
43
53
28
25
null
null
ezyang/ghc
testsuite/tests/codeGen/should_run/CmmSwitchTest64.hs
bsd-3-clause
ag 2# = 43#
11
ag 2# = 43#
11
ag 2# = 43#
11
false
false
0
5
3
9
4
5
null
null
brendanhay/gogol
gogol-monitoring/gen/Network/Google/Monitoring/Types/Product.hs
mpl-2.0
-- | The group of resources being monitored. Should be only the [GROUP_ID], -- and not the full-path -- projects\/[PROJECT_ID_OR_NUMBER]\/groups\/[GROUP_ID]. rgGroupId :: Lens' ResourceGroup (Maybe Text) rgGroupId = lens _rgGroupId (\ s a -> s{_rgGroupId = a})
262
rgGroupId :: Lens' ResourceGroup (Maybe Text) rgGroupId = lens _rgGroupId (\ s a -> s{_rgGroupId = a})
104
rgGroupId = lens _rgGroupId (\ s a -> s{_rgGroupId = a})
58
true
true
1
9
38
52
27
25
null
null
JacquesCarette/literate-scientific-software
code/drasil-example/Drasil/GamePhysics/Unitals.hs
bsd-2-clause
collisionImpulse = ucs' (dccWDS "collisionImp" (compoundPhrase' (cn "collision") (QP.impulseS ^. term)) (phrase QP.impulseS)) (eqSymb QP.impulseS) Real impulseU
194
collisionImpulse = ucs' (dccWDS "collisionImp" (compoundPhrase' (cn "collision") (QP.impulseS ^. term)) (phrase QP.impulseS)) (eqSymb QP.impulseS) Real impulseU
194
collisionImpulse = ucs' (dccWDS "collisionImp" (compoundPhrase' (cn "collision") (QP.impulseS ^. term)) (phrase QP.impulseS)) (eqSymb QP.impulseS) Real impulseU
194
false
false
0
12
50
66
32
34
null
null
DavidAlphaFox/darcs
src/Darcs/Repository/HashedIO.hs
gpl-2.0
makeThing :: FileName -> (ObjType,String) -> HashedIO p () makeThing fn (o,h) = mWithCurrentDirectory (superName $ normPath fn) $ seta o (ownName $ normPath fn) h `fmap` readroot >>= writeroot
213
makeThing :: FileName -> (ObjType,String) -> HashedIO p () makeThing fn (o,h) = mWithCurrentDirectory (superName $ normPath fn) $ seta o (ownName $ normPath fn) h `fmap` readroot >>= writeroot
213
makeThing fn (o,h) = mWithCurrentDirectory (superName $ normPath fn) $ seta o (ownName $ normPath fn) h `fmap` readroot >>= writeroot
154
false
true
0
11
50
87
45
42
null
null
haskell-infra/hackage-server
tests/HackageClientUtils.hs
bsd-3-clause
getUsers :: IO [UserInfo] getUsers = getUrl NoAuth "/users/.json" >>= decodeJSON
80
getUsers :: IO [UserInfo] getUsers = getUrl NoAuth "/users/.json" >>= decodeJSON
80
getUsers = getUrl NoAuth "/users/.json" >>= decodeJSON
54
false
true
0
6
10
26
13
13
null
null
trskop/cabal
Cabal/Distribution/Simple/Test/Log.hs
bsd-3-clause
countTestResults :: TestLogs -> (Int, Int, Int) -- ^ Passes, fails, and errors, -- respectively. countTestResults = go (0, 0, 0) where go (p, f, e) (TestLog { testResult = r }) = case r of Pass -> (p + 1, f, e) Fail _ -> (p, f + 1, e) Error _ -> (p, f, e + 1) go (p, f, e) (GroupLogs _ ts) = foldl go (p, f, e) ts -- | From a 'TestSuiteLog', determine if the test suite passed.
485
countTestResults :: TestLogs -> (Int, Int, Int) countTestResults = go (0, 0, 0) where go (p, f, e) (TestLog { testResult = r }) = case r of Pass -> (p + 1, f, e) Fail _ -> (p, f + 1, e) Error _ -> (p, f, e + 1) go (p, f, e) (GroupLogs _ ts) = foldl go (p, f, e) ts -- | From a 'TestSuiteLog', determine if the test suite passed.
400
countTestResults = go (0, 0, 0) where go (p, f, e) (TestLog { testResult = r }) = case r of Pass -> (p + 1, f, e) Fail _ -> (p, f + 1, e) Error _ -> (p, f, e + 1) go (p, f, e) (GroupLogs _ ts) = foldl go (p, f, e) ts -- | From a 'TestSuiteLog', determine if the test suite passed.
335
true
true
0
9
191
183
104
79
null
null
snapframework/io-streams
src/System/IO/Streams/Internal.hs
bsd-3-clause
------------------------------------------------------------------------------ -- | Connects an 'InputStream' to an 'OutputStream' without passing the -- end-of-stream notification through to the 'OutputStream'. -- -- Use this to supply an 'OutputStream' with multiple 'InputStream's and use -- 'connect' for the final 'InputStream' to finalize the 'OutputStream', like -- so: -- -- @ -- do Streams.'supply' input1 output -- Streams.'supply' input2 output -- Streams.'connect' input3 output -- @ -- supply :: InputStream a -> OutputStream a -> IO () supply p q = loop where loop = do m <- read p maybe (return $! ()) (const $ write m q >> loop) m
705
supply :: InputStream a -> OutputStream a -> IO () supply p q = loop where loop = do m <- read p maybe (return $! ()) (const $ write m q >> loop) m
198
supply p q = loop where loop = do m <- read p maybe (return $! ()) (const $ write m q >> loop) m
147
true
true
0
11
157
102
55
47
null
null
arekfu/grammar-haskell
src/Grammar/CFG.hs
bsd-3-clause
simplifyStringCFG :: StringCFG -- ^ the grammar to simplify -> StringCFG -- ^ the simplified grammar simplifyStringCFG (StringCFG g) = StringCFG $ simplifyCFG g
184
simplifyStringCFG :: StringCFG -- ^ the grammar to simplify -> StringCFG simplifyStringCFG (StringCFG g) = StringCFG $ simplifyCFG g
153
simplifyStringCFG (StringCFG g) = StringCFG $ simplifyCFG g
59
true
true
0
7
47
33
17
16
null
null
DrNico/rhodium
test/rhc-strap/TestRhodium/Context.hs
mit
genObN n = sized term' where term' 0 = oneof [ do i <- choose (1,n) return $ UpVar i , do letter <- choose ('a','f') return $ UpPred [letter] [] ] term' m = oneof [ do i <- choose (1,n) return $ UpVar i , do letter <- choose ('a','f') nargs <- choose (0, m `div` 2) ObC args <- resize nargs arbitrary -- ## BUG: carry 'n' return $ UpPred [letter] args ] {- instance Arbitrary HomC where arbitrary = sized $ \siz -> do srcsiz <- choose (0,siz) let tgtsiz = siz - srcsiz ObC src <- resize srcsiz arbitrary ObC tgt <- resize tgtsiz arbitrary ObC m <- resize tgtsiz arbitrary -- ## MOD: generate morphisms return $ HomC { source = src, target = tgt, morph = m -- ## TODO: build a type-correct morphism } -} -- generates two composable Morphisms -- instance Arbitrary Hom2C where
1,110
genObN n = sized term' where term' 0 = oneof [ do i <- choose (1,n) return $ UpVar i , do letter <- choose ('a','f') return $ UpPred [letter] [] ] term' m = oneof [ do i <- choose (1,n) return $ UpVar i , do letter <- choose ('a','f') nargs <- choose (0, m `div` 2) ObC args <- resize nargs arbitrary -- ## BUG: carry 'n' return $ UpPred [letter] args ] {- instance Arbitrary HomC where arbitrary = sized $ \siz -> do srcsiz <- choose (0,siz) let tgtsiz = siz - srcsiz ObC src <- resize srcsiz arbitrary ObC tgt <- resize tgtsiz arbitrary ObC m <- resize tgtsiz arbitrary -- ## MOD: generate morphisms return $ HomC { source = src, target = tgt, morph = m -- ## TODO: build a type-correct morphism } -} -- generates two composable Morphisms -- instance Arbitrary Hom2C where
1,110
genObN n = sized term' where term' 0 = oneof [ do i <- choose (1,n) return $ UpVar i , do letter <- choose ('a','f') return $ UpPred [letter] [] ] term' m = oneof [ do i <- choose (1,n) return $ UpVar i , do letter <- choose ('a','f') nargs <- choose (0, m `div` 2) ObC args <- resize nargs arbitrary -- ## BUG: carry 'n' return $ UpPred [letter] args ] {- instance Arbitrary HomC where arbitrary = sized $ \siz -> do srcsiz <- choose (0,siz) let tgtsiz = siz - srcsiz ObC src <- resize srcsiz arbitrary ObC tgt <- resize tgtsiz arbitrary ObC m <- resize tgtsiz arbitrary -- ## MOD: generate morphisms return $ HomC { source = src, target = tgt, morph = m -- ## TODO: build a type-correct morphism } -} -- generates two composable Morphisms -- instance Arbitrary Hom2C where
1,110
false
false
0
12
488
206
101
105
null
null
alekar/hugs
packages/Cabal/tests/HUnit-1.0/src/Example.hs
bsd-3-clause
tests' = test [ "test1" ~: "(foo 3)" ~: (1,2) ~=? (foo 3), "test2" ~: do (x, y) <- partA 3 assertEqual "for the first result of partA," 5 x partB y @? "(partB " ++ show y ++ ") failed" ]
262
tests' = test [ "test1" ~: "(foo 3)" ~: (1,2) ~=? (foo 3), "test2" ~: do (x, y) <- partA 3 assertEqual "for the first result of partA," 5 x partB y @? "(partB " ++ show y ++ ") failed" ]
262
tests' = test [ "test1" ~: "(foo 3)" ~: (1,2) ~=? (foo 3), "test2" ~: do (x, y) <- partA 3 assertEqual "for the first result of partA," 5 x partB y @? "(partB " ++ show y ++ ") failed" ]
262
false
false
0
13
117
90
44
46
null
null
ocharles/reactive-banana-gtk
src/Reactive/Banana/Gtk/Container.hs
bsd-3-clause
listenContainerSignals :: Gtk.ContainerClass widget => widget -> MomentIO ContainerSignals listenContainerSignals _ = return ContainerSignals
141
listenContainerSignals :: Gtk.ContainerClass widget => widget -> MomentIO ContainerSignals listenContainerSignals _ = return ContainerSignals
141
listenContainerSignals _ = return ContainerSignals
50
false
true
0
7
13
33
15
18
null
null
abooij/sudbury
Graphics/Sudbury/State.hs
mit
-- This should probably be populated initialCompositorState :: CompositorState initialCompositorState = CompositorState M.empty
127
initialCompositorState :: CompositorState initialCompositorState = CompositorState M.empty
90
initialCompositorState = CompositorState M.empty
48
true
true
0
6
12
17
9
8
null
null
a143753/AOJ
0012.hs
apache-2.0
ans (x1:y1:x2:y2:x3:y3:xp:yp:_) = let c1 = chk (x1,y1) (x2,y2) (x3,y3) (xp,yp) c2 = chk (x2,y2) (x3,y3) (x1,y1) (xp,yp) c3 = chk (x3,y3) (x1,y1) (x2,y2) (xp,yp) in if c1 && c2 && c3 then "YES" else "NO"
230
ans (x1:y1:x2:y2:x3:y3:xp:yp:_) = let c1 = chk (x1,y1) (x2,y2) (x3,y3) (xp,yp) c2 = chk (x2,y2) (x3,y3) (x1,y1) (xp,yp) c3 = chk (x3,y3) (x1,y1) (x2,y2) (xp,yp) in if c1 && c2 && c3 then "YES" else "NO"
230
ans (x1:y1:x2:y2:x3:y3:xp:yp:_) = let c1 = chk (x1,y1) (x2,y2) (x3,y3) (xp,yp) c2 = chk (x2,y2) (x3,y3) (x1,y1) (xp,yp) c3 = chk (x3,y3) (x1,y1) (x2,y2) (xp,yp) in if c1 && c2 && c3 then "YES" else "NO"
230
false
false
0
14
63
180
102
78
null
null
SimSaladin/rnfssp
rnfssp-util/Utils.hs
bsd-3-clause
-- * Conduit -- | Takes the difference between two sorted sources. Output values are wrapped -- in Either: unique values from first source are wrapped in Left and vice -- versa. differenceSortedE :: (Ord a, Monad m) => (b -> a) -> Source m a -- ^ Left values -> Source m b -- ^ Right values -> Source m (Either a b) differenceSortedE convert (ConduitM db0) (ConduitM git0) = ConduitM $ go db0 git0 where go (Done ()) right = CI.mapOutput Right right go left (Done ()) = CI.mapOutput Left left go (PipeM mx) (PipeM my) = PipeM (liftM2 go mx my) go (PipeM mx) y@HaveOutput{} = PipeM (liftM (`go` y) mx) go x@HaveOutput{} (PipeM my) = PipeM (liftM (go x) my) go xs@(HaveOutput srcx closex x) ys@(HaveOutput srcy closey y) = case compare x (convert y) of EQ -> go srcx srcy -- Non-unique entry, discard GT -> HaveOutput (go xs srcy) closey (Right y) -- Left (db) is ahead, LT -> HaveOutput (go srcx ys) closex (Left x) -- left (db) is behind: go (NeedInput _ c) right = go (c ()) right go left (NeedInput _ c) = go left (c ()) go (Leftover left ()) right = go left right go left (Leftover right ()) = go left right
1,306
differenceSortedE :: (Ord a, Monad m) => (b -> a) -> Source m a -- ^ Left values -> Source m b -- ^ Right values -> Source m (Either a b) differenceSortedE convert (ConduitM db0) (ConduitM git0) = ConduitM $ go db0 git0 where go (Done ()) right = CI.mapOutput Right right go left (Done ()) = CI.mapOutput Left left go (PipeM mx) (PipeM my) = PipeM (liftM2 go mx my) go (PipeM mx) y@HaveOutput{} = PipeM (liftM (`go` y) mx) go x@HaveOutput{} (PipeM my) = PipeM (liftM (go x) my) go xs@(HaveOutput srcx closex x) ys@(HaveOutput srcy closey y) = case compare x (convert y) of EQ -> go srcx srcy -- Non-unique entry, discard GT -> HaveOutput (go xs srcy) closey (Right y) -- Left (db) is ahead, LT -> HaveOutput (go srcx ys) closex (Left x) -- left (db) is behind: go (NeedInput _ c) right = go (c ()) right go left (NeedInput _ c) = go left (c ()) go (Leftover left ()) right = go left right go left (Leftover right ()) = go left right
1,127
differenceSortedE convert (ConduitM db0) (ConduitM git0) = ConduitM $ go db0 git0 where go (Done ()) right = CI.mapOutput Right right go left (Done ()) = CI.mapOutput Left left go (PipeM mx) (PipeM my) = PipeM (liftM2 go mx my) go (PipeM mx) y@HaveOutput{} = PipeM (liftM (`go` y) mx) go x@HaveOutput{} (PipeM my) = PipeM (liftM (go x) my) go xs@(HaveOutput srcx closex x) ys@(HaveOutput srcy closey y) = case compare x (convert y) of EQ -> go srcx srcy -- Non-unique entry, discard GT -> HaveOutput (go xs srcy) closey (Right y) -- Left (db) is ahead, LT -> HaveOutput (go srcx ys) closex (Left x) -- left (db) is behind: go (NeedInput _ c) right = go (c ()) right go left (NeedInput _ c) = go left (c ()) go (Leftover left ()) right = go left right go left (Leftover right ()) = go left right
945
true
true
0
11
410
501
251
250
null
null
DNoved1/distill
src/Distill/Expr/Representation.hs
mit
-- | Utility to split a forall into a list of its argument types and body. splitForall :: Type' b -> ([(b, Type' b)], Type' b) splitForall = \case Forall x t s -> first ((x,t):) (splitForall s) s -> ([], s) -- | Utility to create a forall from a list of its argument types and body.
302
splitForall :: Type' b -> ([(b, Type' b)], Type' b) splitForall = \case Forall x t s -> first ((x,t):) (splitForall s) s -> ([], s) -- | Utility to create a forall from a list of its argument types and body.
227
splitForall = \case Forall x t s -> first ((x,t):) (splitForall s) s -> ([], s) -- | Utility to create a forall from a list of its argument types and body.
175
true
true
0
10
77
91
50
41
null
null
spechub/Hets
Maude/Maude2DG.hs
gpl-2.0
qualifyType _ ty = ty
21
qualifyType _ ty = ty
21
qualifyType _ ty = ty
21
false
false
0
5
4
11
5
6
null
null
chiro/tchhh
src/TL.hs
mit
showEventTarget (ETStatus s) = putStrLn $ T.concat [user, ": ", text] where user = userScreenName . statusUser $ s text = statusText s
150
showEventTarget (ETStatus s) = putStrLn $ T.concat [user, ": ", text] where user = userScreenName . statusUser $ s text = statusText s
150
showEventTarget (ETStatus s) = putStrLn $ T.concat [user, ": ", text] where user = userScreenName . statusUser $ s text = statusText s
150
false
false
0
8
38
56
29
27
null
null
pgj/bead
test/Test/Property/Persistence.hs
bsd-3-clause
massPersistenceTest = do cs <- courses 100 gs <- groups 250 cs gas <- groupAssignmentGen 400 gs cas <- courseAssignmentGen 400 cs let as = gas ++ cas us <- users 300 ss <- infoListToSubmissionKeys <$> submissions 500 us as evaluations 400 ss return ()
269
massPersistenceTest = do cs <- courses 100 gs <- groups 250 cs gas <- groupAssignmentGen 400 gs cas <- courseAssignmentGen 400 cs let as = gas ++ cas us <- users 300 ss <- infoListToSubmissionKeys <$> submissions 500 us as evaluations 400 ss return ()
269
massPersistenceTest = do cs <- courses 100 gs <- groups 250 cs gas <- groupAssignmentGen 400 gs cas <- courseAssignmentGen 400 cs let as = gas ++ cas us <- users 300 ss <- infoListToSubmissionKeys <$> submissions 500 us as evaluations 400 ss return ()
269
false
false
0
10
62
109
46
63
null
null
arianvp/binary-serialise-cbor
bench/Macro/Load.hs
bsd-3-clause
mkField d (Node (n,_,l) ts) = case span (\c -> isAlphaNum c || c == '-') l of ([], _) -> syntaxError n $ "unrecognised field or section: " ++ show l (name, rest) -> case trimLeading rest of (':':rest') -> do let followingLines = concatMap Tree.flatten ts tabs = not (null [()| (_,True,_) <- followingLines ]) if tabs && d >= 1 then tabsError n else return $ F n (map toLower name) (fieldValue rest' followingLines) rest' -> do ts' <- mapM (mkField (d+1)) ts return (Section n (map toLower name) rest' ts') where fieldValue firstLine followingLines = let firstLine' = trimLeading firstLine followingLines' = map (\(_,_,s) -> stripDot s) followingLines allLines | null firstLine' = followingLines' | otherwise = firstLine' : followingLines' in intercalate "\n" allLines stripDot "." = "" stripDot s = s -- | Convert if/then/else 'Section's to 'IfBlock's
1,164
mkField d (Node (n,_,l) ts) = case span (\c -> isAlphaNum c || c == '-') l of ([], _) -> syntaxError n $ "unrecognised field or section: " ++ show l (name, rest) -> case trimLeading rest of (':':rest') -> do let followingLines = concatMap Tree.flatten ts tabs = not (null [()| (_,True,_) <- followingLines ]) if tabs && d >= 1 then tabsError n else return $ F n (map toLower name) (fieldValue rest' followingLines) rest' -> do ts' <- mapM (mkField (d+1)) ts return (Section n (map toLower name) rest' ts') where fieldValue firstLine followingLines = let firstLine' = trimLeading firstLine followingLines' = map (\(_,_,s) -> stripDot s) followingLines allLines | null firstLine' = followingLines' | otherwise = firstLine' : followingLines' in intercalate "\n" allLines stripDot "." = "" stripDot s = s -- | Convert if/then/else 'Section's to 'IfBlock's
1,164
mkField d (Node (n,_,l) ts) = case span (\c -> isAlphaNum c || c == '-') l of ([], _) -> syntaxError n $ "unrecognised field or section: " ++ show l (name, rest) -> case trimLeading rest of (':':rest') -> do let followingLines = concatMap Tree.flatten ts tabs = not (null [()| (_,True,_) <- followingLines ]) if tabs && d >= 1 then tabsError n else return $ F n (map toLower name) (fieldValue rest' followingLines) rest' -> do ts' <- mapM (mkField (d+1)) ts return (Section n (map toLower name) rest' ts') where fieldValue firstLine followingLines = let firstLine' = trimLeading firstLine followingLines' = map (\(_,_,s) -> stripDot s) followingLines allLines | null firstLine' = followingLines' | otherwise = firstLine' : followingLines' in intercalate "\n" allLines stripDot "." = "" stripDot s = s -- | Convert if/then/else 'Section's to 'IfBlock's
1,164
false
false
2
22
455
391
190
201
null
null
deweyvm/colorful
src/Graphics/Colorful/Utils.hs
mit
ple _ = []
13
triple _ = []
13
triple _ = []
13
false
false
0
5
6
12
5
7
null
null
purebred-mua/purebred
src/Purebred/Types/Mailcap.hs
agpl-3.0
ccAfterExit :: (MonadIO m, MonadError Error m) => Lens' (EntityCommand m a) ((ExitCode, Tainted L.ByteString) -> a -> m T.Text) ccAfterExit = lens _ccAfterExit (\cc x -> cc {_ccAfterExit = x})
199
ccAfterExit :: (MonadIO m, MonadError Error m) => Lens' (EntityCommand m a) ((ExitCode, Tainted L.ByteString) -> a -> m T.Text) ccAfterExit = lens _ccAfterExit (\cc x -> cc {_ccAfterExit = x})
199
ccAfterExit = lens _ccAfterExit (\cc x -> cc {_ccAfterExit = x})
64
false
true
2
9
37
88
48
40
null
null
fffej/haskellprojects
kata/Supermarket/Supermarket.hs
bsd-2-clause
cents :: Integer -> Money cents = Cents
39
cents :: Integer -> Money cents = Cents
39
cents = Cents
13
false
true
0
7
7
22
9
13
null
null
zhangjiji/real-world-haskell
ch4.hs
mit
main = mainWith myFunction where mainWith function = do args <- getArgs case args of [input, output] -> interactWith function input output _ -> putStrLn "error: exactly two arguments needed" myFunction = getFirstWords
272
main = mainWith myFunction where mainWith function = do args <- getArgs case args of [input, output] -> interactWith function input output _ -> putStrLn "error: exactly two arguments needed" myFunction = getFirstWords
272
main = mainWith myFunction where mainWith function = do args <- getArgs case args of [input, output] -> interactWith function input output _ -> putStrLn "error: exactly two arguments needed" myFunction = getFirstWords
272
false
false
2
10
87
74
32
42
null
null
Dronte/Operads
examples/example.hs
bsd-3-clause
oa2 = oet la2 :: OperadElement Integer Rational RPathPerm
57
oa2 = oet la2 :: OperadElement Integer Rational RPathPerm
57
oa2 = oet la2 :: OperadElement Integer Rational RPathPerm
57
false
false
0
5
8
19
9
10
null
null
nikki-and-the-robots/nikki
src/Base/Constants.hs
lgpl-3.0
-- * misc -- | initial window size, when not in fullscreen mode defaultWindowSize :: Size Int defaultWindowSize = Size 1024 640
128
defaultWindowSize :: Size Int defaultWindowSize = Size 1024 640
63
defaultWindowSize = Size 1024 640
33
true
true
0
5
22
21
11
10
null
null
mazuschlag/haskov
src/Haskov.hs
mit
insertWith :: (Ord a) => (Double -> Double -> Double) -> a -> a -> Double -> Markov a -> Markov a insertWith f i j d (Markov imap hmap) | hasI && (not hasJ) = Markov (Map.insert j s imap) (Map.insert (imap Map.! i, s) d hmap) | (not hasI) && hasJ = Markov (Map.insert i s imap) (Map.insert (s, imap Map.! j) d hmap) | (not hasI) && (not hasJ) && (i /= j) = Markov (Map.insert j (s+1) (Map.insert i s imap)) (Map.insert (s, (s+1)) d hmap) | (not hasI) && (not hasJ) && (i == j) = Markov (Map.insert i s imap) (Map.insert (s, s) d hmap) | otherwise = Markov imap (Map.insertWith f (imap Map.! i, imap Map.! j) d hmap) where hasI = Map.member i imap hasJ = Map.member j imap s = Map.size imap -------------------------------------------------------------------------------- -- Lists --
841
insertWith :: (Ord a) => (Double -> Double -> Double) -> a -> a -> Double -> Markov a -> Markov a insertWith f i j d (Markov imap hmap) | hasI && (not hasJ) = Markov (Map.insert j s imap) (Map.insert (imap Map.! i, s) d hmap) | (not hasI) && hasJ = Markov (Map.insert i s imap) (Map.insert (s, imap Map.! j) d hmap) | (not hasI) && (not hasJ) && (i /= j) = Markov (Map.insert j (s+1) (Map.insert i s imap)) (Map.insert (s, (s+1)) d hmap) | (not hasI) && (not hasJ) && (i == j) = Markov (Map.insert i s imap) (Map.insert (s, s) d hmap) | otherwise = Markov imap (Map.insertWith f (imap Map.! i, imap Map.! j) d hmap) where hasI = Map.member i imap hasJ = Map.member j imap s = Map.size imap -------------------------------------------------------------------------------- -- Lists --
841
insertWith f i j d (Markov imap hmap) | hasI && (not hasJ) = Markov (Map.insert j s imap) (Map.insert (imap Map.! i, s) d hmap) | (not hasI) && hasJ = Markov (Map.insert i s imap) (Map.insert (s, imap Map.! j) d hmap) | (not hasI) && (not hasJ) && (i /= j) = Markov (Map.insert j (s+1) (Map.insert i s imap)) (Map.insert (s, (s+1)) d hmap) | (not hasI) && (not hasJ) && (i == j) = Markov (Map.insert i s imap) (Map.insert (s, s) d hmap) | otherwise = Markov imap (Map.insertWith f (imap Map.! i, imap Map.! j) d hmap) where hasI = Map.member i imap hasJ = Map.member j imap s = Map.size imap -------------------------------------------------------------------------------- -- Lists --
743
false
true
3
11
203
474
230
244
null
null
mstksg/expr-gadt
src/Data/ExprGADT/Parse.hs
bsd-3-clause
etListAt :: ETList vs -> Int -> Maybe ETypeW etListAt ets n = do guard $ n >= 0 x :* xs <- Just ets if n == 0 then Just (ETW x) else etListAt xs (n - 1)
176
etListAt :: ETList vs -> Int -> Maybe ETypeW etListAt ets n = do guard $ n >= 0 x :* xs <- Just ets if n == 0 then Just (ETW x) else etListAt xs (n - 1)
176
etListAt ets n = do guard $ n >= 0 x :* xs <- Just ets if n == 0 then Just (ETW x) else etListAt xs (n - 1)
131
false
true
0
10
62
91
43
48
null
null
pernas/service-randombytes-haskell
src/Main.hs
unlicense
bsToBase64 :: BS.ByteString -> String bsToBase64 = bsToString . B64.encode
74
bsToBase64 :: BS.ByteString -> String bsToBase64 = bsToString . B64.encode
74
bsToBase64 = bsToString . B64.encode
36
false
true
0
6
9
23
12
11
null
null
ancientlanguage/haskell-analysis
prepare/src/Prepare/Decompose.hs
mit
decomposeChar '\xFB2F' = "\x05D0\x05B8"
39
decomposeChar '\xFB2F' = "\x05D0\x05B8"
39
decomposeChar '\xFB2F' = "\x05D0\x05B8"
39
false
false
1
5
3
13
4
9
null
null
haskell-fswatch/win32-notify
src/System/Win32/Notify.hs
bsd-3-clause
initWatchManager :: IO WatchManager initWatchManager = do mvarMap <- newMVar Map.empty return (WatchManager mvarMap)
124
initWatchManager :: IO WatchManager initWatchManager = do mvarMap <- newMVar Map.empty return (WatchManager mvarMap)
123
initWatchManager = do mvarMap <- newMVar Map.empty return (WatchManager mvarMap)
87
false
true
0
10
21
44
18
26
null
null
sol/pandoc
src/Text/Pandoc/Readers/Markdown.hs
gpl-2.0
normalCite :: GenParser Char ParserState [Citation] normalCite = try $ do char '[' spnl citations <- citeList spnl char ']' return citations
152
normalCite :: GenParser Char ParserState [Citation] normalCite = try $ do char '[' spnl citations <- citeList spnl char ']' return citations
152
normalCite = try $ do char '[' spnl citations <- citeList spnl char ']' return citations
100
false
true
0
8
33
56
24
32
null
null
Heather/Idris-dev
src/Idris/Error.hs
bsd-3-clause
ifail :: String -> Idris a ifail = throwError . Msg
51
ifail :: String -> Idris a ifail = throwError . Msg
51
ifail = throwError . Msg
24
false
true
0
7
10
28
12
16
null
null
DimaSamoz/mezzo
src/Mezzo/Compose/Builder.hs
mit
lus :: AMut Double Double plus i p = spec (i + p)
50
plus :: AMut Double Double plus i p = spec (i + p)
50
plus i p = spec (i + p)
23
false
true
1
7
13
35
15
20
null
null
bigs/7inch
src/Modules/CapsQuotes.hs
mit
capsQuotesHandler :: TVar [String] -> TChan String -> IrcMsg -> SocketHandler -> IO () capsQuotesHandler quoteRef chan (PubMsg _ (IrcUser nick _ _) c msg) cb = if nick == "lrts" then cb else do quotes <- atomically $ readTVar quoteRef index <- getStdRandom $ randomR (0, (length quotes) - 1) let response = quotes !! index atomically $ writeTVar quoteRef $ quotes ++ [msg] atomically $ sendCmd chan PRIVMSG [channelToString c, response] cb
467
capsQuotesHandler :: TVar [String] -> TChan String -> IrcMsg -> SocketHandler -> IO () capsQuotesHandler quoteRef chan (PubMsg _ (IrcUser nick _ _) c msg) cb = if nick == "lrts" then cb else do quotes <- atomically $ readTVar quoteRef index <- getStdRandom $ randomR (0, (length quotes) - 1) let response = quotes !! index atomically $ writeTVar quoteRef $ quotes ++ [msg] atomically $ sendCmd chan PRIVMSG [channelToString c, response] cb
467
capsQuotesHandler quoteRef chan (PubMsg _ (IrcUser nick _ _) c msg) cb = if nick == "lrts" then cb else do quotes <- atomically $ readTVar quoteRef index <- getStdRandom $ randomR (0, (length quotes) - 1) let response = quotes !! index atomically $ writeTVar quoteRef $ quotes ++ [msg] atomically $ sendCmd chan PRIVMSG [channelToString c, response] cb
380
false
true
0
14
101
188
91
97
null
null
Proclivis/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxTR_EXTENDED :: Int wxTR_EXTENDED = 64
39
wxTR_EXTENDED :: Int wxTR_EXTENDED = 64
39
wxTR_EXTENDED = 64
18
false
true
0
4
5
11
6
5
null
null
gcampax/ghc
compiler/utils/Outputable.hs
bsd-3-clause
double n = docToSDoc $ Pretty.double n
41
double n = docToSDoc $ Pretty.double n
41
double n = docToSDoc $ Pretty.double n
41
false
false
1
7
9
21
8
13
null
null
rul/lazymail
src/Lazymail/Handlers.hs
gpl-3.0
incrementSelectedRow st | (selectedRow st) < limit = case (mode st) of MaildirMode -> let sr = (selectedRowMD . maildirState) st maildirState' = (maildirState st) { selectedRowMD = sr + 1 } in st { maildirState = maildirState' } IndexMode -> let sr = (selectedRowIn . indexState) st indexState' = (indexState st) { selectedRowIn = sr + 1 } in st { indexState = indexState' } _ -> st | otherwise = st where scrRows = screenRows st curInLen = length $ selectedEmails . indexState $ st curMDLen = length $ detectedMDs . maildirState $ st limit' = case (mode st) of MaildirMode -> if curMDLen < scrRows then curMDLen - 1 else scrRows IndexMode -> if curInLen < scrRows then curInLen - 1 else scrRows limit = if (statusBar st) && (limit' == scrRows) then fromIntegral $ limit' - 2 else fromIntegral limit'
968
incrementSelectedRow st | (selectedRow st) < limit = case (mode st) of MaildirMode -> let sr = (selectedRowMD . maildirState) st maildirState' = (maildirState st) { selectedRowMD = sr + 1 } in st { maildirState = maildirState' } IndexMode -> let sr = (selectedRowIn . indexState) st indexState' = (indexState st) { selectedRowIn = sr + 1 } in st { indexState = indexState' } _ -> st | otherwise = st where scrRows = screenRows st curInLen = length $ selectedEmails . indexState $ st curMDLen = length $ detectedMDs . maildirState $ st limit' = case (mode st) of MaildirMode -> if curMDLen < scrRows then curMDLen - 1 else scrRows IndexMode -> if curInLen < scrRows then curInLen - 1 else scrRows limit = if (statusBar st) && (limit' == scrRows) then fromIntegral $ limit' - 2 else fromIntegral limit'
968
incrementSelectedRow st | (selectedRow st) < limit = case (mode st) of MaildirMode -> let sr = (selectedRowMD . maildirState) st maildirState' = (maildirState st) { selectedRowMD = sr + 1 } in st { maildirState = maildirState' } IndexMode -> let sr = (selectedRowIn . indexState) st indexState' = (indexState st) { selectedRowIn = sr + 1 } in st { indexState = indexState' } _ -> st | otherwise = st where scrRows = screenRows st curInLen = length $ selectedEmails . indexState $ st curMDLen = length $ detectedMDs . maildirState $ st limit' = case (mode st) of MaildirMode -> if curMDLen < scrRows then curMDLen - 1 else scrRows IndexMode -> if curInLen < scrRows then curInLen - 1 else scrRows limit = if (statusBar st) && (limit' == scrRows) then fromIntegral $ limit' - 2 else fromIntegral limit'
968
false
false
1
16
311
308
162
146
null
null
oldmanmike/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
bindIOIdKey = mkPreludeMiscIdUnique 34
56
bindIOIdKey = mkPreludeMiscIdUnique 34
56
bindIOIdKey = mkPreludeMiscIdUnique 34
56
false
false
0
5
21
9
4
5
null
null
james-ralston/project-euler
src/test.hs
mit
area :: Triangle -> Int area t@(Triangle a b c) | isInt area' 10 = floor $ area' | otherwise = 0 where p' = p t a' = fromIntegral a b' = fromIntegral b c' = fromIntegral c area' = sqrt $ p' * ( p' - a') * (p' - b') * (p' - c')
268
area :: Triangle -> Int area t@(Triangle a b c) | isInt area' 10 = floor $ area' | otherwise = 0 where p' = p t a' = fromIntegral a b' = fromIntegral b c' = fromIntegral c area' = sqrt $ p' * ( p' - a') * (p' - b') * (p' - c')
268
area t@(Triangle a b c) | isInt area' 10 = floor $ area' | otherwise = 0 where p' = p t a' = fromIntegral a b' = fromIntegral b c' = fromIntegral c area' = sqrt $ p' * ( p' - a') * (p' - b') * (p' - c')
244
false
true
15
7
98
133
67
66
null
null
gspia/reflex-dom-htmlea
lib/src/Reflex/Dom/HTML5/Attrs/Attrs.hs
bsd-3-clause
sbAllowPresentation = attrSetSandbox (Sandbox [SBAllowPresentation])
70
sbAllowPresentation = attrSetSandbox (Sandbox [SBAllowPresentation])
70
sbAllowPresentation = attrSetSandbox (Sandbox [SBAllowPresentation])
70
false
false
1
8
6
21
9
12
null
null
LukaHorvat/Halt
src/Halt/Printing/Pretty.hs
mit
parenthesesUnless :: Bool -> String -> String parenthesesUnless b = if not b then inParentheses else id
103
parenthesesUnless :: Bool -> String -> String parenthesesUnless b = if not b then inParentheses else id
103
parenthesesUnless b = if not b then inParentheses else id
57
false
true
0
6
16
33
17
16
null
null
tonyday567/pipes-extended
src/Pipes/Monoid.hs
mit
-- to feed into the route So we have a Consumer of a's and 2 producers in a three level transformer -- stack step2 :: (Monad m) => Consumer a (Producer a (Producer a m)) r step2 = doubler >-> routeCycle
202
step2 :: (Monad m) => Consumer a (Producer a (Producer a m)) r step2 = doubler >-> routeCycle
93
step2 = doubler >-> routeCycle
30
true
true
2
11
40
57
28
29
null
null
tanishiking/hscc
src/GenIntermed.hs
mit
isPointer :: CheckedExpr -> Bool isPointer (CheckedIdentExpr _ info) = case (getType $ snd info) of (ChPointer _) -> True (ChArray _ _) -> True _ -> False
180
isPointer :: CheckedExpr -> Bool isPointer (CheckedIdentExpr _ info) = case (getType $ snd info) of (ChPointer _) -> True (ChArray _ _) -> True _ -> False
180
isPointer (CheckedIdentExpr _ info) = case (getType $ snd info) of (ChPointer _) -> True (ChArray _ _) -> True _ -> False
147
false
true
2
8
53
61
36
25
null
null
gsdlab/clafer
src/Language/Clafer/Intermediate/Intclafer.hs
mit
unWrapIType :: Ir -> IType unWrapIType (IRIType x) = x
54
unWrapIType :: Ir -> IType unWrapIType (IRIType x) = x
54
unWrapIType (IRIType x) = x
27
false
true
0
7
9
24
12
12
null
null
vikraman/ghc
compiler/hsSyn/HsDecls.hs
bsd-3-clause
emptyTyClGroup :: TyClGroup name emptyTyClGroup = TyClGroup [] [] []
68
emptyTyClGroup :: TyClGroup name emptyTyClGroup = TyClGroup [] [] []
68
emptyTyClGroup = TyClGroup [] [] []
35
false
true
0
6
9
27
13
14
null
null
wellecks/coltrane
ColtraneTests.hs
bsd-3-clause
helloHandler :: Handler helloHandler = html "Hello World!"
58
helloHandler :: Handler helloHandler = html "Hello World!"
58
helloHandler = html "Hello World!"
34
false
true
0
6
7
21
8
13
null
null
jwiegley/lambdabot
Plugin/Pl/Names.hs
mit
oldlE = Quote $ Var Pref "foldl"
37
foldlE = Quote $ Var Pref "foldl"
37
foldlE = Quote $ Var Pref "foldl"
37
false
false
0
6
11
15
7
8
null
null
nickbart1980/pandoc
src/Text/Pandoc/Readers/Markdown.hs
gpl-2.0
citation :: MarkdownParser (F Citation) citation = try $ do pref <- prefix (suppress_author, key) <- citeKey suff <- suffix return $ do x <- pref y <- suff return $ Citation{ citationId = key , citationPrefix = B.toList x , citationSuffix = B.toList y , citationMode = if suppress_author then SuppressAuthor else NormalCitation , citationNoteNum = 0 , citationHash = 0 }
617
citation :: MarkdownParser (F Citation) citation = try $ do pref <- prefix (suppress_author, key) <- citeKey suff <- suffix return $ do x <- pref y <- suff return $ Citation{ citationId = key , citationPrefix = B.toList x , citationSuffix = B.toList y , citationMode = if suppress_author then SuppressAuthor else NormalCitation , citationNoteNum = 0 , citationHash = 0 }
617
citation = try $ do pref <- prefix (suppress_author, key) <- citeKey suff <- suffix return $ do x <- pref y <- suff return $ Citation{ citationId = key , citationPrefix = B.toList x , citationSuffix = B.toList y , citationMode = if suppress_author then SuppressAuthor else NormalCitation , citationNoteNum = 0 , citationHash = 0 }
577
false
true
0
15
309
135
71
64
null
null
jystic/river
src/River/Core/Transform/Rename.hs
bsd-3-clause
freshenConflict :: (Ord n, FreshName n, MonadFresh m) => Set n -> n -> m (Either (n, n) n) freshenConflict used n0 = if Set.member n0 used then do n <- freshen n0 pure $ Left (n0, n) else pure $ Right n0
219
freshenConflict :: (Ord n, FreshName n, MonadFresh m) => Set n -> n -> m (Either (n, n) n) freshenConflict used n0 = if Set.member n0 used then do n <- freshen n0 pure $ Left (n0, n) else pure $ Right n0
219
freshenConflict used n0 = if Set.member n0 used then do n <- freshen n0 pure $ Left (n0, n) else pure $ Right n0
128
false
true
0
11
58
113
56
57
null
null
haskell/haddock
haddock-api/src/Haddock.hs
bsd-2-clause
getBaseDir :: IO (Maybe FilePath) getBaseDir = do -- Getting executable path can fail. Turn that into 'Nothing' exec_path_opt <- catch (Just <$> getExecutablePath) (\(_ :: SomeException) -> pure Nothing) -- Check that the path we are about to return actually exists case exec_path_opt of Nothing -> pure Nothing Just exec_path -> do let base_dir = takeDirectory (takeDirectory exec_path) </> "lib" exists <- doesDirectoryExist base_dir pure (if exists then Just base_dir else Nothing) #endif
553
getBaseDir :: IO (Maybe FilePath) getBaseDir = do -- Getting executable path can fail. Turn that into 'Nothing' exec_path_opt <- catch (Just <$> getExecutablePath) (\(_ :: SomeException) -> pure Nothing) -- Check that the path we are about to return actually exists case exec_path_opt of Nothing -> pure Nothing Just exec_path -> do let base_dir = takeDirectory (takeDirectory exec_path) </> "lib" exists <- doesDirectoryExist base_dir pure (if exists then Just base_dir else Nothing) #endif
553
getBaseDir = do -- Getting executable path can fail. Turn that into 'Nothing' exec_path_opt <- catch (Just <$> getExecutablePath) (\(_ :: SomeException) -> pure Nothing) -- Check that the path we are about to return actually exists case exec_path_opt of Nothing -> pure Nothing Just exec_path -> do let base_dir = takeDirectory (takeDirectory exec_path) </> "lib" exists <- doesDirectoryExist base_dir pure (if exists then Just base_dir else Nothing) #endif
519
false
true
2
20
135
145
67
78
null
null
alokpndy/haskell-learn
src/folds/beautifulFold.hs
mit
main :: IO () main = print (fold (unique id) (take 10000 (cycle randomWord64)))
79
main :: IO () main = print (fold (unique id) (take 10000 (cycle randomWord64)))
79
main = print (fold (unique id) (take 10000 (cycle randomWord64)))
65
false
true
1
11
13
50
23
27
null
null
t00n/ProjectEuler
TP2.hs
epl-1.0
perimeter (Rectangle (a,b) (c,d)) = 2 * (abs $ a-c) + 2 * (abs $ b-d)
69
perimeter (Rectangle (a,b) (c,d)) = 2 * (abs $ a-c) + 2 * (abs $ b-d)
69
perimeter (Rectangle (a,b) (c,d)) = 2 * (abs $ a-c) + 2 * (abs $ b-d)
69
false
false
0
10
15
63
34
29
null
null
ekmett/ghc
compiler/cmm/PprC.hs
bsd-3-clause
pprHexVal w rep | w < 0 = parens (char '-' <> ptext (sLit "0x") <> go (-w) <> repsuffix rep) | otherwise = ptext (sLit "0x") <> go w <> repsuffix rep where -- type suffix for literals: -- Integer literals are unsigned in Cmm/C. We explicitly cast to -- signed values for doing signed operations, but at all other -- times values are unsigned. This also helps eliminate occasional -- warnings about integer overflow from gcc. repsuffix W64 = sdocWithDynFlags $ \dflags -> if cINT_SIZE dflags == 8 then char 'U' else if cLONG_SIZE dflags == 8 then ptext (sLit "UL") else if cLONG_LONG_SIZE dflags == 8 then ptext (sLit "ULL") else panic "pprHexVal: Can't find a 64-bit type" repsuffix _ = char 'U' go 0 = empty go w' = go q <> dig where (q,r) = w' `quotRem` 16 dig | r < 10 = char (chr (fromInteger r + ord '0')) | otherwise = char (chr (fromInteger r - 10 + ord 'a'))
1,057
pprHexVal w rep | w < 0 = parens (char '-' <> ptext (sLit "0x") <> go (-w) <> repsuffix rep) | otherwise = ptext (sLit "0x") <> go w <> repsuffix rep where -- type suffix for literals: -- Integer literals are unsigned in Cmm/C. We explicitly cast to -- signed values for doing signed operations, but at all other -- times values are unsigned. This also helps eliminate occasional -- warnings about integer overflow from gcc. repsuffix W64 = sdocWithDynFlags $ \dflags -> if cINT_SIZE dflags == 8 then char 'U' else if cLONG_SIZE dflags == 8 then ptext (sLit "UL") else if cLONG_LONG_SIZE dflags == 8 then ptext (sLit "ULL") else panic "pprHexVal: Can't find a 64-bit type" repsuffix _ = char 'U' go 0 = empty go w' = go q <> dig where (q,r) = w' `quotRem` 16 dig | r < 10 = char (chr (fromInteger r + ord '0')) | otherwise = char (chr (fromInteger r - 10 + ord 'a'))
1,057
pprHexVal w rep | w < 0 = parens (char '-' <> ptext (sLit "0x") <> go (-w) <> repsuffix rep) | otherwise = ptext (sLit "0x") <> go w <> repsuffix rep where -- type suffix for literals: -- Integer literals are unsigned in Cmm/C. We explicitly cast to -- signed values for doing signed operations, but at all other -- times values are unsigned. This also helps eliminate occasional -- warnings about integer overflow from gcc. repsuffix W64 = sdocWithDynFlags $ \dflags -> if cINT_SIZE dflags == 8 then char 'U' else if cLONG_SIZE dflags == 8 then ptext (sLit "UL") else if cLONG_LONG_SIZE dflags == 8 then ptext (sLit "ULL") else panic "pprHexVal: Can't find a 64-bit type" repsuffix _ = char 'U' go 0 = empty go w' = go q <> dig where (q,r) = w' `quotRem` 16 dig | r < 10 = char (chr (fromInteger r + ord '0')) | otherwise = char (chr (fromInteger r - 10 + ord 'a'))
1,057
false
false
6
12
358
336
156
180
null
null
paul-rouse/persistent
persistent-mongoDB/Database/Persist/MongoDB.hs
mit
-- | No intersection of lists: if no value in the field is found in the list. ninList :: PersistField typ => EntityField v [typ] -> [typ] -> Filter v f `ninList` a = Filter (unsafeCoerce f) (FilterValues a) NotIn
212
ninList :: PersistField typ => EntityField v [typ] -> [typ] -> Filter v f `ninList` a = Filter (unsafeCoerce f) (FilterValues a) NotIn
134
f `ninList` a = Filter (unsafeCoerce f) (FilterValues a) NotIn
62
true
true
0
8
39
71
35
36
null
null
rehno-lindeque/elm-reactor
src/backend/Main.hs
bsd-3-clause
socket :: Snap () socket = do file <- getSafePath guard =<< liftIO (doesFileExist file) WSS.runWebSocketsSnap (Socket.watchFile file)
148
socket :: Snap () socket = do file <- getSafePath guard =<< liftIO (doesFileExist file) WSS.runWebSocketsSnap (Socket.watchFile file)
148
socket = do file <- getSafePath guard =<< liftIO (doesFileExist file) WSS.runWebSocketsSnap (Socket.watchFile file)
130
false
true
0
11
32
61
26
35
null
null
DougBurke/swish
src/Swish/RDF/Vocabulary/SIOC.hs
lgpl-2.1
-- | @sioc:Usergroup@ from <http://rdfs.org/sioc/spec/#term_Usergroup>. siocUsergroup :: ScopedName siocUsergroup = toS "Usergroup"
132
siocUsergroup :: ScopedName siocUsergroup = toS "Usergroup"
59
siocUsergroup = toS "Usergroup"
31
true
true
0
5
12
15
8
7
null
null
MateVM/harpy
Harpy/X86CodeGen.hs
gpl-2.0
emit_sse X86_SSE_PS = return ()
31
emit_sse X86_SSE_PS = return ()
31
emit_sse X86_SSE_PS = return ()
31
false
false
0
6
4
14
6
8
null
null
ngzax/urbit
pkg/hs/terminal-progress-bar/test/test.hs
mit
renderDurationTest :: NominalDiffTime -> TL.Text -> Test renderDurationTest dt expected = testCase ("renderDuration " <> show dt) $ assertEqual expectationError expected $ renderDuration dt
193
renderDurationTest :: NominalDiffTime -> TL.Text -> Test renderDurationTest dt expected = testCase ("renderDuration " <> show dt) $ assertEqual expectationError expected $ renderDuration dt
193
renderDurationTest dt expected = testCase ("renderDuration " <> show dt) $ assertEqual expectationError expected $ renderDuration dt
136
false
true
0
10
27
55
26
29
null
null
silky/csound-expression
src/Csound/Air/Fx.hs
bsd-3-clause
fxEcho :: D -> Sig -> Sig -> Sig -> SE Sig fxEcho maxLen ktime fback = fvdelay (5 * maxLen) (sig maxLen * 0.95 * kTime) fback 1 where kporttime = linseg [0,0.001,0.1] kTime = portk ktime (kporttime*3) -- | Simplified stereo delay.
256
fxEcho :: D -> Sig -> Sig -> Sig -> SE Sig fxEcho maxLen ktime fback = fvdelay (5 * maxLen) (sig maxLen * 0.95 * kTime) fback 1 where kporttime = linseg [0,0.001,0.1] kTime = portk ktime (kporttime*3) -- | Simplified stereo delay.
256
fxEcho maxLen ktime fback = fvdelay (5 * maxLen) (sig maxLen * 0.95 * kTime) fback 1 where kporttime = linseg [0,0.001,0.1] kTime = portk ktime (kporttime*3) -- | Simplified stereo delay.
213
false
true
0
9
69
104
54
50
null
null
glutamate/ig
src/Instagram/Relationships.hs
bsd-3-clause
-- | Get the list of users this user is followed by. getFollowedBy :: (MonadBaseControl IO m, MonadResource m) => UserID -> Maybe Int -> Maybe OAuthToken -> InstagramT m (Envelope [User]) getFollowedBy uid Nothing token =getGetEnvelopeM ["/v1/users/",uid,"/followed-by"] token ([]::HT.Query)
302
getFollowedBy :: (MonadBaseControl IO m, MonadResource m) => UserID -> Maybe Int -> Maybe OAuthToken -> InstagramT m (Envelope [User]) getFollowedBy uid Nothing token =getGetEnvelopeM ["/v1/users/",uid,"/followed-by"] token ([]::HT.Query)
249
getFollowedBy uid Nothing token =getGetEnvelopeM ["/v1/users/",uid,"/followed-by"] token ([]::HT.Query)
104
true
true
0
13
50
95
49
46
null
null
erochest/taygeta-icu
src/Taygeta/Parser/Treebank.hs
apache-2.0
treebank :: PlainTokenizer treebank = T.words . foldRepl (stage2 ++ contractions) . flip (joinEnds ' ') ' ' . foldRepl stage1
152
treebank :: PlainTokenizer treebank = T.words . foldRepl (stage2 ++ contractions) . flip (joinEnds ' ') ' ' . foldRepl stage1
152
treebank = T.words . foldRepl (stage2 ++ contractions) . flip (joinEnds ' ') ' ' . foldRepl stage1
125
false
true
3
6
47
60
25
35
null
null
ezyang/ghc
testsuite/tests/pmcheck/should_compile/T11195.hs
bsd-3-clause
optForAllCoBndr :: LiftingContext -> Bool -> TyVar -> Coercion -> (LiftingContext, TyVar, Coercion) optForAllCoBndr = undefined
143
optForAllCoBndr :: LiftingContext -> Bool -> TyVar -> Coercion -> (LiftingContext, TyVar, Coercion) optForAllCoBndr = undefined
143
optForAllCoBndr = undefined
27
false
true
0
9
31
36
20
16
null
null
rahulmutt/ghcvm
compiler/Eta/StrAnal/DmdAnal.hs
bsd-3-clause
extendSigEnv :: TopLevelFlag -> SigEnv -> Id -> StrictSig -> SigEnv extendSigEnv top_lvl sigs var sig = extendVarEnv sigs var (sig, top_lvl)
140
extendSigEnv :: TopLevelFlag -> SigEnv -> Id -> StrictSig -> SigEnv extendSigEnv top_lvl sigs var sig = extendVarEnv sigs var (sig, top_lvl)
140
extendSigEnv top_lvl sigs var sig = extendVarEnv sigs var (sig, top_lvl)
72
false
true
0
8
21
49
25
24
null
null
beni55/cryptol
src/Cryptol/ModuleSystem/Env.hs
bsd-3-clause
dynamicEnv :: ModuleEnv -> (IfaceDecls,NameEnv) dynamicEnv me = unqualified (deIfaceDecls (meDynEnv me))
104
dynamicEnv :: ModuleEnv -> (IfaceDecls,NameEnv) dynamicEnv me = unqualified (deIfaceDecls (meDynEnv me))
104
dynamicEnv me = unqualified (deIfaceDecls (meDynEnv me))
56
false
true
0
9
11
39
20
19
null
null
cornell-pl/HsAdapton
stmshf/Main.hs
bsd-3-clause
diningPhilosophers i = do n <- do if null i then do putStrLn "==================================================" putStrLn "How many philosophers?" readLn else return (read $ head i) maxrounds <- do if null i || null (tail i) then do putStrLn "==================================================" putStrLn "How many rounds?" readLn else return (read $ head $ tail i) forks <- atomically $ sequence (replicate n (newTVar 0)) mv <- newEmptyMVar sequence_ [forkIO (philosopher maxrounds n i forks >> putMVar mv ()) | i <- [0..(n-1)]] sequence_ [takeMVar mv | i <- [0..(n-1)]] putStrLn "done"
646
diningPhilosophers i = do n <- do if null i then do putStrLn "==================================================" putStrLn "How many philosophers?" readLn else return (read $ head i) maxrounds <- do if null i || null (tail i) then do putStrLn "==================================================" putStrLn "How many rounds?" readLn else return (read $ head $ tail i) forks <- atomically $ sequence (replicate n (newTVar 0)) mv <- newEmptyMVar sequence_ [forkIO (philosopher maxrounds n i forks >> putMVar mv ()) | i <- [0..(n-1)]] sequence_ [takeMVar mv | i <- [0..(n-1)]] putStrLn "done"
646
diningPhilosophers i = do n <- do if null i then do putStrLn "==================================================" putStrLn "How many philosophers?" readLn else return (read $ head i) maxrounds <- do if null i || null (tail i) then do putStrLn "==================================================" putStrLn "How many rounds?" readLn else return (read $ head $ tail i) forks <- atomically $ sequence (replicate n (newTVar 0)) mv <- newEmptyMVar sequence_ [forkIO (philosopher maxrounds n i forks >> putMVar mv ()) | i <- [0..(n-1)]] sequence_ [takeMVar mv | i <- [0..(n-1)]] putStrLn "done"
646
false
false
0
14
146
252
115
137
null
null
olsner/ghc
compiler/prelude/THNames.hs
bsd-3-clause
instanceWithOverlapDIdKey = mkPreludeMiscIdUnique 326
61
instanceWithOverlapDIdKey = mkPreludeMiscIdUnique 326
61
instanceWithOverlapDIdKey = mkPreludeMiscIdUnique 326
61
false
false
0
5
11
9
4
5
null
null
marcelosousa/poet
src/Exploration/SUNF/API.hs
gpl-2.0
sep = "-----------------------------------------\n"
51
sep = "-----------------------------------------\n"
51
sep = "-----------------------------------------\n"
51
false
false
1
5
2
10
3
7
null
null
sixears/getopt
t/OptDescHelp.hs
mit
-------------------------------------------------------------------------------- p0 :: OptDesc p0 = read "z|y|xx>www::Double<1.1>"
131
p0 :: OptDesc p0 = read "z|y|xx>www::Double<1.1>"
49
p0 = read "z|y|xx>www::Double<1.1>"
35
true
true
0
5
8
15
8
7
null
null
Heather/Idris-dev
src/Idris/Output.hs
bsd-3-clause
iWarn :: FC -> Doc OutputAnnotation -> Idris () iWarn fc err = do i <- getIState case idris_outputmode i of RawOutput h -> do err' <- iRender . fmap (fancifyAnnots i True) $ case fc of FC fn _ _ | fn /= "" -> text (show fc) <> colon <//> err _ -> err hWriteDoc h i err' IdeMode n h -> do err' <- iRender . fmap (fancifyAnnots i True) $ err let (str, spans) = displaySpans err' runIO . hPutStrLn h $ convSExp "warning" (fc_fname fc, fc_start fc, fc_end fc, str, spans) n
628
iWarn :: FC -> Doc OutputAnnotation -> Idris () iWarn fc err = do i <- getIState case idris_outputmode i of RawOutput h -> do err' <- iRender . fmap (fancifyAnnots i True) $ case fc of FC fn _ _ | fn /= "" -> text (show fc) <> colon <//> err _ -> err hWriteDoc h i err' IdeMode n h -> do err' <- iRender . fmap (fancifyAnnots i True) $ err let (str, spans) = displaySpans err' runIO . hPutStrLn h $ convSExp "warning" (fc_fname fc, fc_start fc, fc_end fc, str, spans) n
628
iWarn fc err = do i <- getIState case idris_outputmode i of RawOutput h -> do err' <- iRender . fmap (fancifyAnnots i True) $ case fc of FC fn _ _ | fn /= "" -> text (show fc) <> colon <//> err _ -> err hWriteDoc h i err' IdeMode n h -> do err' <- iRender . fmap (fancifyAnnots i True) $ err let (str, spans) = displaySpans err' runIO . hPutStrLn h $ convSExp "warning" (fc_fname fc, fc_start fc, fc_end fc, str, spans) n
580
false
true
0
23
255
251
114
137
null
null
Saulzar/reflex-gloss-scene
src/Reflex/Gloss/Scene.hs
bsd-3-clause
-- | Mouse over event on a picking target, returns events for (entering, leaving) mouseOver :: (Reflex t) => Target t -> Scene t (Event t (), Event t ()) mouseOver target = do ov <- observeChanges (hovering target) return (match True ov, match False ov) -- | Mouse click event for picking target, returns click event and behavior indicating current clicking
362
mouseOver :: (Reflex t) => Target t -> Scene t (Event t (), Event t ()) mouseOver target = do ov <- observeChanges (hovering target) return (match True ov, match False ov) -- | Mouse click event for picking target, returns click event and behavior indicating current clicking
280
mouseOver target = do ov <- observeChanges (hovering target) return (match True ov, match False ov) -- | Mouse click event for picking target, returns click event and behavior indicating current clicking
208
true
true
0
11
66
100
47
53
null
null
djeik/goto
test/Gen/Literal.hs
mit
-- | Generates interpreted string literals -- A special generator is required to prevent generating invalid escape codes, -- or strings containing invalid characters. interpStringGen :: Gen String interpStringGen = (surroundWith "\"") . concat <$> listOf (frequency [(1, escape), (49, normal)]) where escape = (\c -> "\\" ++ [c]) <$> elements commonEscapes normal = suchThat (((:[]) . chr) <$> choose (33, 126)) (\c -> c /= "\n" && c /= "\"" && c /= "\\") -- We don't want to introduce illegal characters or escape codes -- | Generates identifiers.
631
interpStringGen :: Gen String interpStringGen = (surroundWith "\"") . concat <$> listOf (frequency [(1, escape), (49, normal)]) where escape = (\c -> "\\" ++ [c]) <$> elements commonEscapes normal = suchThat (((:[]) . chr) <$> choose (33, 126)) (\c -> c /= "\n" && c /= "\"" && c /= "\\") -- We don't want to introduce illegal characters or escape codes -- | Generates identifiers.
464
interpStringGen = (surroundWith "\"") . concat <$> listOf (frequency [(1, escape), (49, normal)]) where escape = (\c -> "\\" ++ [c]) <$> elements commonEscapes normal = suchThat (((:[]) . chr) <$> choose (33, 126)) (\c -> c /= "\n" && c /= "\"" && c /= "\\") -- We don't want to introduce illegal characters or escape codes -- | Generates identifiers.
434
true
true
5
12
172
169
88
81
null
null
wavewave/MSSMType
src/HEP/Physics/MSSM/OutputPhys.hs
bsd-2-clause
isNonSM _ = True
20
isNonSM _ = True
20
isNonSM _ = True
20
false
false
0
5
7
9
4
5
null
null
mrakgr/futhark
src/Futhark/Representation/AST/Traversals.hs
bsd-3-clause
-- | As 'foldExpM', but in the 'Identity' monad. foldExp :: Folder a lore Identity -> a -> Exp lore -> a foldExp m x = runIdentity . foldExpM m x
145
foldExp :: Folder a lore Identity -> a -> Exp lore -> a foldExp m x = runIdentity . foldExpM m x
96
foldExp m x = runIdentity . foldExpM m x
40
true
true
0
9
30
53
24
29
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F22.hs
bsd-3-clause
-- glProgramUniformMatrix2x4dvEXT ---------------------------------------------- glProgramUniformMatrix2x4dvEXT :: MonadIO m => GLuint -- ^ @program@. -> GLint -- ^ @location@. -> GLsizei -- ^ @count@. -> GLboolean -- ^ @transpose@ of type [Boolean](Graphics-GL-Groups.html#Boolean). -> Ptr GLdouble -- ^ @value@ pointing to @count*8@ elements of type @GLdouble@. -> m () glProgramUniformMatrix2x4dvEXT v1 v2 v3 v4 v5 = liftIO $ dyn704 ptr_glProgramUniformMatrix2x4dvEXT v1 v2 v3 v4 v5
500
glProgramUniformMatrix2x4dvEXT :: MonadIO m => GLuint -- ^ @program@. -> GLint -- ^ @location@. -> GLsizei -- ^ @count@. -> GLboolean -- ^ @transpose@ of type [Boolean](Graphics-GL-Groups.html#Boolean). -> Ptr GLdouble -- ^ @value@ pointing to @count*8@ elements of type @GLdouble@. -> m () glProgramUniformMatrix2x4dvEXT v1 v2 v3 v4 v5 = liftIO $ dyn704 ptr_glProgramUniformMatrix2x4dvEXT v1 v2 v3 v4 v5
418
glProgramUniformMatrix2x4dvEXT v1 v2 v3 v4 v5 = liftIO $ dyn704 ptr_glProgramUniformMatrix2x4dvEXT v1 v2 v3 v4 v5
113
true
true
0
13
76
84
42
42
null
null