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
conal/hermit-extras
src/HERMIT/Extras.hs
bsd-3-clause
externC :: Injection a Core => ExternalName -> RewriteH a -> String -> External externC name rew help = external name (promoteR rew :: ReCore) [help]
162
externC :: Injection a Core => ExternalName -> RewriteH a -> String -> External externC name rew help = external name (promoteR rew :: ReCore) [help]
162
externC name rew help = external name (promoteR rew :: ReCore) [help]
71
false
true
0
8
38
68
31
37
null
null
ownclo/alohas
src/Signals.hs
bsd-3-clause
toDb :: Double -> Double toDb x = 10 * logBase 10 x
51
toDb :: Double -> Double toDb x = 10 * logBase 10 x
51
toDb x = 10 * logBase 10 x
26
false
true
0
6
12
27
13
14
null
null
Chobbes/BatchMTLR
BatchMTLR/Main.hs
mit
proc' = proc
12
proc' = proc
12
proc' = proc
12
false
false
1
5
2
10
3
7
null
null
glennrfisher/cis194-haskell
04 Higher Order Programming/homework4.hs
mit
-- Reimplement `fun2` using wholemeal programming. fun2 :: Integer -> Integer fun2 1 = 0
89
fun2 :: Integer -> Integer fun2 1 = 0
37
fun2 1 = 0
10
true
true
0
7
15
25
11
14
null
null
lukexi/ghc-7.8-arm64
includes/CodeGen.Platform.hs
bsd-3-clause
globalRegMaybe (VanillaReg 9 _) = Just (RealRegSingle REG_R9)
69
globalRegMaybe (VanillaReg 9 _) = Just (RealRegSingle REG_R9)
69
globalRegMaybe (VanillaReg 9 _) = Just (RealRegSingle REG_R9)
69
false
false
0
7
15
26
12
14
null
null
brendanhay/gogol
gogol-servicemanagement/gen/Network/Google/ServiceManagement/Types/Product.hs
mpl-2.0
-- | Token that can be passed to \`ListServices\` to resume a paginated -- query. lsrNextPageToken :: Lens' ListServicesResponse (Maybe Text) lsrNextPageToken = lens _lsrNextPageToken (\ s a -> s{_lsrNextPageToken = a})
227
lsrNextPageToken :: Lens' ListServicesResponse (Maybe Text) lsrNextPageToken = lens _lsrNextPageToken (\ s a -> s{_lsrNextPageToken = a})
145
lsrNextPageToken = lens _lsrNextPageToken (\ s a -> s{_lsrNextPageToken = a})
85
true
true
0
9
39
49
26
23
null
null
gridaphobe/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
tcIdSigBndrName (PartialSig { sig_name = n }) = n
49
tcIdSigBndrName (PartialSig { sig_name = n }) = n
49
tcIdSigBndrName (PartialSig { sig_name = n }) = n
49
false
false
0
9
8
21
11
10
null
null
haskell-faceted/haskell-faceted
Faceted/Pure.hs
apache-2.0
-- | < k ? x : bottom > ====> makePrivate k x makePrivate :: Label -> a -> Faceted a makePrivate k x = Faceted k (Raw x) (bottom)
133
makePrivate :: Label -> a -> Faceted a makePrivate k x = Faceted k (Raw x) (bottom)
83
makePrivate k x = Faceted k (Raw x) (bottom)
44
true
true
0
7
33
44
22
22
null
null
fmapfmapfmap/amazonka
amazonka-autoscaling/gen/Network/AWS/AutoScaling/ExitStandby.hs
mpl-2.0
-- | The response status code. esrsResponseStatus :: Lens' ExitStandbyResponse Int esrsResponseStatus = lens _esrsResponseStatus (\ s a -> s{_esrsResponseStatus = a})
166
esrsResponseStatus :: Lens' ExitStandbyResponse Int esrsResponseStatus = lens _esrsResponseStatus (\ s a -> s{_esrsResponseStatus = a})
135
esrsResponseStatus = lens _esrsResponseStatus (\ s a -> s{_esrsResponseStatus = a})
83
true
true
0
9
21
40
22
18
null
null
vincenthz/hs-crypto-pubkey
Tests/Tests.hs
bsd-2-clause
assertEq (Right got) (Right exp) = if got == exp then True else error ("got: " ++ show got ++ "\nexp: " ++ show exp)
116
assertEq (Right got) (Right exp) = if got == exp then True else error ("got: " ++ show got ++ "\nexp: " ++ show exp)
116
assertEq (Right got) (Right exp) = if got == exp then True else error ("got: " ++ show got ++ "\nexp: " ++ show exp)
116
false
false
0
11
24
61
29
32
null
null
brendanhay/gogol
gogol-android-enterprise/gen/Network/Google/Resource/AndroidEnterprise/ManagedConfigurationsforDevice/Get.hs
mpl-2.0
-- | Creates a value of 'ManagedConfigurationsforDeviceGet' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'mcdgXgafv' -- -- * 'mcdgUploadProtocol' -- -- * 'mcdgEnterpriseId' -- -- * 'mcdgAccessToken' -- -- * 'mcdgUploadType' -- -- * 'mcdgUserId' -- -- * 'mcdgDeviceId' -- -- * 'mcdgManagedConfigurationForDeviceId' -- -- * 'mcdgCallback' managedConfigurationsforDeviceGet :: Text -- ^ 'mcdgEnterpriseId' -> Text -- ^ 'mcdgUserId' -> Text -- ^ 'mcdgDeviceId' -> Text -- ^ 'mcdgManagedConfigurationForDeviceId' -> ManagedConfigurationsforDeviceGet managedConfigurationsforDeviceGet pMcdgEnterpriseId_ pMcdgUserId_ pMcdgDeviceId_ pMcdgManagedConfigurationForDeviceId_ = ManagedConfigurationsforDeviceGet' { _mcdgXgafv = Nothing , _mcdgUploadProtocol = Nothing , _mcdgEnterpriseId = pMcdgEnterpriseId_ , _mcdgAccessToken = Nothing , _mcdgUploadType = Nothing , _mcdgUserId = pMcdgUserId_ , _mcdgDeviceId = pMcdgDeviceId_ , _mcdgManagedConfigurationForDeviceId = pMcdgManagedConfigurationForDeviceId_ , _mcdgCallback = Nothing }
1,180
managedConfigurationsforDeviceGet :: Text -- ^ 'mcdgEnterpriseId' -> Text -- ^ 'mcdgUserId' -> Text -- ^ 'mcdgDeviceId' -> Text -- ^ 'mcdgManagedConfigurationForDeviceId' -> ManagedConfigurationsforDeviceGet managedConfigurationsforDeviceGet pMcdgEnterpriseId_ pMcdgUserId_ pMcdgDeviceId_ pMcdgManagedConfigurationForDeviceId_ = ManagedConfigurationsforDeviceGet' { _mcdgXgafv = Nothing , _mcdgUploadProtocol = Nothing , _mcdgEnterpriseId = pMcdgEnterpriseId_ , _mcdgAccessToken = Nothing , _mcdgUploadType = Nothing , _mcdgUserId = pMcdgUserId_ , _mcdgDeviceId = pMcdgDeviceId_ , _mcdgManagedConfigurationForDeviceId = pMcdgManagedConfigurationForDeviceId_ , _mcdgCallback = Nothing }
755
managedConfigurationsforDeviceGet pMcdgEnterpriseId_ pMcdgUserId_ pMcdgDeviceId_ pMcdgManagedConfigurationForDeviceId_ = ManagedConfigurationsforDeviceGet' { _mcdgXgafv = Nothing , _mcdgUploadProtocol = Nothing , _mcdgEnterpriseId = pMcdgEnterpriseId_ , _mcdgAccessToken = Nothing , _mcdgUploadType = Nothing , _mcdgUserId = pMcdgUserId_ , _mcdgDeviceId = pMcdgDeviceId_ , _mcdgManagedConfigurationForDeviceId = pMcdgManagedConfigurationForDeviceId_ , _mcdgCallback = Nothing }
527
true
true
0
10
202
126
82
44
null
null
brendanhay/gogol
gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs
mpl-2.0
-- | Creates a value of 'ClearValuesResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'cvrClearedRange' -- -- * 'cvrSpreadsheetId' clearValuesResponse :: ClearValuesResponse clearValuesResponse = ClearValuesResponse' {_cvrClearedRange = Nothing, _cvrSpreadsheetId = Nothing}
373
clearValuesResponse :: ClearValuesResponse clearValuesResponse = ClearValuesResponse' {_cvrClearedRange = Nothing, _cvrSpreadsheetId = Nothing}
149
clearValuesResponse = ClearValuesResponse' {_cvrClearedRange = Nothing, _cvrSpreadsheetId = Nothing}
102
true
true
0
7
55
42
24
18
null
null
bitemyapp/varying
src/Example.hs
mit
-- Our time signal. time :: Var IO a Float time = deltaUTC
58
time :: Var IO a Float time = deltaUTC
38
time = deltaUTC
15
true
true
0
6
12
25
11
14
null
null
pellagic-puffbomb/simpleservantblog
app/Main.hs
bsd-3-clause
main :: IO () main = do port' <- lookupEnv "SERVER_PORT" port <- case port' of Nothing -> pure 9005 Just p -> pure $ read p environ <- lookupEnv "ENVIRONMENT" environment <- case environ of Nothing -> pure Production Just env -> pure (read env :: Environment) rs <- mkRandomSource drgNew 1000 sk <- generateRandomBytes 24 let key = mkPersistentServerKey sk pool <- makePool cookieSettings <- case environment of Local -> pure localCookieSettings _ -> def -- From Default Library, uses Default instance let stdErrLog = withFastLogger (LogStderr defaultBufSize) let stdOutLog = withFastLogger (LogStdout defaultBufSize) let loggers = AppLoggers { _stdErrLogger = stdErrLog , _stdOutLogger = stdOutLog } let security = AppSecurity { _cookieSettings = cookieSettings , _randomSource = rs , _serverKey = key } let cfg = SimpleAppConfig { _getEnv = environment , _getSecurity = security } let simpleApp = SimpleApp { _getPool = pool , _getConfig = cfg , _getLoggers = loggers } withResource pool housekeepBackend -- Housekeeping: eliminate old sessions let app = if environment == Local then A.withAssetsApp else A.withoutAssetsApp putStrLn $ "SimpleServantBlog up on port " ++ show port ++ " and ready to accept requests" app simpleApp >>= Warp.run port <$> setRequestLogger environment
1,491
main :: IO () main = do port' <- lookupEnv "SERVER_PORT" port <- case port' of Nothing -> pure 9005 Just p -> pure $ read p environ <- lookupEnv "ENVIRONMENT" environment <- case environ of Nothing -> pure Production Just env -> pure (read env :: Environment) rs <- mkRandomSource drgNew 1000 sk <- generateRandomBytes 24 let key = mkPersistentServerKey sk pool <- makePool cookieSettings <- case environment of Local -> pure localCookieSettings _ -> def -- From Default Library, uses Default instance let stdErrLog = withFastLogger (LogStderr defaultBufSize) let stdOutLog = withFastLogger (LogStdout defaultBufSize) let loggers = AppLoggers { _stdErrLogger = stdErrLog , _stdOutLogger = stdOutLog } let security = AppSecurity { _cookieSettings = cookieSettings , _randomSource = rs , _serverKey = key } let cfg = SimpleAppConfig { _getEnv = environment , _getSecurity = security } let simpleApp = SimpleApp { _getPool = pool , _getConfig = cfg , _getLoggers = loggers } withResource pool housekeepBackend -- Housekeeping: eliminate old sessions let app = if environment == Local then A.withAssetsApp else A.withoutAssetsApp putStrLn $ "SimpleServantBlog up on port " ++ show port ++ " and ready to accept requests" app simpleApp >>= Warp.run port <$> setRequestLogger environment
1,491
main = do port' <- lookupEnv "SERVER_PORT" port <- case port' of Nothing -> pure 9005 Just p -> pure $ read p environ <- lookupEnv "ENVIRONMENT" environment <- case environ of Nothing -> pure Production Just env -> pure (read env :: Environment) rs <- mkRandomSource drgNew 1000 sk <- generateRandomBytes 24 let key = mkPersistentServerKey sk pool <- makePool cookieSettings <- case environment of Local -> pure localCookieSettings _ -> def -- From Default Library, uses Default instance let stdErrLog = withFastLogger (LogStderr defaultBufSize) let stdOutLog = withFastLogger (LogStdout defaultBufSize) let loggers = AppLoggers { _stdErrLogger = stdErrLog , _stdOutLogger = stdOutLog } let security = AppSecurity { _cookieSettings = cookieSettings , _randomSource = rs , _serverKey = key } let cfg = SimpleAppConfig { _getEnv = environment , _getSecurity = security } let simpleApp = SimpleApp { _getPool = pool , _getConfig = cfg , _getLoggers = loggers } withResource pool housekeepBackend -- Housekeeping: eliminate old sessions let app = if environment == Local then A.withAssetsApp else A.withoutAssetsApp putStrLn $ "SimpleServantBlog up on port " ++ show port ++ " and ready to accept requests" app simpleApp >>= Warp.run port <$> setRequestLogger environment
1,477
false
true
0
14
409
401
192
209
null
null
ComputationWithBoundedResources/tct-core
src/Tct/Core/Data/Declaration.hs
bsd-3-clause
declare :: (ToHList a, HListOf a ~ args, Uncurry (ArgsType args :-> Ret (ArgsType args) f) ~ f) => String -- ^ name/identifuer -> [String] -- ^ description -> a -- ^ heterogenous list of arguments -> f -- ^ function -> Declaration (args :-> Ret (ArgsType args) f) declare n desc as p = Decl n desc p (toHList as)
353
declare :: (ToHList a, HListOf a ~ args, Uncurry (ArgsType args :-> Ret (ArgsType args) f) ~ f) => String -- ^ name/identifuer -> [String] -- ^ description -> a -- ^ heterogenous list of arguments -> f -- ^ function -> Declaration (args :-> Ret (ArgsType args) f) declare n desc as p = Decl n desc p (toHList as)
353
declare n desc as p = Decl n desc p (toHList as)
48
false
true
0
15
101
131
66
65
null
null
ailiev/faerieplay-compiler
Faerieplay/HoistStms.hs
bsd-3-clause
flatAss :: Stm -> [Stm] flatAss s@(SAss lval val) = let val_h = hoist val in case val_h of (ESeq stms e) -> stms ++ [(SAss lval e)] _ -> [s]
255
flatAss :: Stm -> [Stm] flatAss s@(SAss lval val) = let val_h = hoist val in case val_h of (ESeq stms e) -> stms ++ [(SAss lval e)] _ -> [s]
255
flatAss s@(SAss lval val) = let val_h = hoist val in case val_h of (ESeq stms e) -> stms ++ [(SAss lval e)] _ -> [s]
231
false
true
0
13
145
88
45
43
null
null
sordina/uniqhash
Text/UniqhashLazyIO.hs
mit
blank (' ':xs) = blank xs
25
blank (' ':xs) = blank xs
25
blank (' ':xs) = blank xs
25
false
false
0
7
5
19
9
10
null
null
mpickering/slack-api
example/ReactionBot.hs
mit
reactionBot :: SlackHandle -> IO () reactionBot h = forever $ do getNextEvent h >>= \case (Message cid _ _ ts _ _) -> void . runExceptT $ addReaction h cid "thumbsup" ts _ -> return ()
214
reactionBot :: SlackHandle -> IO () reactionBot h = forever $ do getNextEvent h >>= \case (Message cid _ _ ts _ _) -> void . runExceptT $ addReaction h cid "thumbsup" ts _ -> return ()
214
reactionBot h = forever $ do getNextEvent h >>= \case (Message cid _ _ ts _ _) -> void . runExceptT $ addReaction h cid "thumbsup" ts _ -> return ()
178
false
true
0
13
66
89
42
47
null
null
pjones/xmonad-test
vendor/xmonad-contrib/XMonad/Layout/PerWorkspace.hs
bsd-2-clause
-- | Specify a layout modifier to apply to a particular workspace; layouts -- on all other workspaces will remain unmodified. modWorkspace :: (LayoutClass l1 a, LayoutClass l2 a) => WorkspaceId -- ^ tag of the workspace to match -> (l2 a -> l1 a) -- ^ the modifier to apply on the matching workspace -> l2 a -- ^ the base layout -> PerWorkspace l1 l2 a modWorkspace wsId = modWorkspaces [wsId]
461
modWorkspace :: (LayoutClass l1 a, LayoutClass l2 a) => WorkspaceId -- ^ tag of the workspace to match -> (l2 a -> l1 a) -- ^ the modifier to apply on the matching workspace -> l2 a -- ^ the base layout -> PerWorkspace l1 l2 a modWorkspace wsId = modWorkspaces [wsId]
333
modWorkspace wsId = modWorkspaces [wsId]
40
true
true
0
10
140
79
41
38
null
null
3of8/heap
Test/Heap.hs
bsd-2-clause
splitAtProperty :: (HeapItem pol item, Ord (Val pol item)) => Int -> Heap pol item -> Bool splitAtProperty n heap = let (before, after) = splitAt n heap in n < 0 || length before == n || isEmpty after && heap == fromAscList before `union` after
264
splitAtProperty :: (HeapItem pol item, Ord (Val pol item)) => Int -> Heap pol item -> Bool splitAtProperty n heap = let (before, after) = splitAt n heap in n < 0 || length before == n || isEmpty after && heap == fromAscList before `union` after
264
splitAtProperty n heap = let (before, after) = splitAt n heap in n < 0 || length before == n || isEmpty after && heap == fromAscList before `union` after
169
false
true
0
13
66
116
57
59
null
null
sherwoodwang/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_REBOL_FILE :: Int wxSTC_REBOL_FILE = 15
45
wxSTC_REBOL_FILE :: Int wxSTC_REBOL_FILE = 15
45
wxSTC_REBOL_FILE = 15
21
false
true
0
6
5
18
7
11
null
null
ml9951/ghc
compiler/nativeGen/SPARC/CodeGen.hs
bsd-3-clause
genJump :: CmmExpr{-the branch target-} -> NatM InstrBlock genJump (CmmLit (CmmLabel lbl)) = return (toOL [CALL (Left target) 0 True, NOP]) where target = ImmCLbl lbl
175
genJump :: CmmExpr{-the branch target-} -> NatM InstrBlock genJump (CmmLit (CmmLabel lbl)) = return (toOL [CALL (Left target) 0 True, NOP]) where target = ImmCLbl lbl
174
genJump (CmmLit (CmmLabel lbl)) = return (toOL [CALL (Left target) 0 True, NOP]) where target = ImmCLbl lbl
115
false
true
0
11
34
73
36
37
null
null
mettekou/ghc
compiler/ghci/GHCi.hs
bsd-3-clause
-- | loadDLL loads a dynamic library using the OS's native linker -- (i.e. dlopen() on Unix, LoadLibrary() on Windows). It takes either -- an absolute pathname to the file, or a relative filename -- (e.g. "libfoo.so" or "foo.dll"). In the latter case, loadDLL -- searches the standard locations for the appropriate library. -- -- Returns: -- -- Nothing => success -- Just err_msg => failure loadDLL :: HscEnv -> String -> IO (Maybe String) loadDLL hsc_env str = iservCmd hsc_env (LoadDLL str)
499
loadDLL :: HscEnv -> String -> IO (Maybe String) loadDLL hsc_env str = iservCmd hsc_env (LoadDLL str)
101
loadDLL hsc_env str = iservCmd hsc_env (LoadDLL str)
52
true
true
0
9
89
54
31
23
null
null
urv/fixhs
src/Data/FIX/Spec/FIX42.hs
lgpl-2.1
mSettlementInstructions :: FIXMessageSpec mSettlementInstructions = FMSpec { msName = "SettlementInstructions" , msType = C.pack "T" , msHeader = headerFIX42 , msBody = mSettlementInstructionsBody , msTrailer = trailerFIX42 } where mSettlementInstructionsBody = LT.insert (tnum tSettlInstID) tSettlInstID $ LT.insert (tnum tSettlInstTransType) tSettlInstTransType $ LT.insert (tnum tSettlInstRefID) tSettlInstRefID $ LT.insert (tnum tSettlInstMode) tSettlInstMode $ LT.insert (tnum tSettlInstSource) tSettlInstSource $ LT.insert (tnum tAllocAccount) tAllocAccount $ LT.insert (tnum tSettlLocation) tSettlLocation $ LT.insert (tnum tTradeDate) tTradeDate $ LT.insert (tnum tAllocID) tAllocID $ LT.insert (tnum tLastMkt) tLastMkt $ LT.insert (tnum tTradingSessionID) tTradingSessionID $ LT.insert (tnum tSide) tSide $ LT.insert (tnum tSecurityType) tSecurityType $ LT.insert (tnum tEffectiveTime) tEffectiveTime $ LT.insert (tnum tTransactTime) tTransactTime $ LT.insert (tnum tClientID) tClientID $ LT.insert (tnum tExecBroker) tExecBroker $ LT.insert (tnum tStandInstDbType) tStandInstDbType $ LT.insert (tnum tStandInstDbName) tStandInstDbName $ LT.insert (tnum tStandInstDbID) tStandInstDbID $ LT.insert (tnum tSettlDeliveryType) tSettlDeliveryType $ LT.insert (tnum tSettlDepositoryCode) tSettlDepositoryCode $ LT.insert (tnum tSettlBrkrCode) tSettlBrkrCode $ LT.insert (tnum tSettlInstCode) tSettlInstCode $ LT.insert (tnum tSecuritySettlAgentName) tSecuritySettlAgentName $ LT.insert (tnum tSecuritySettlAgentCode) tSecuritySettlAgentCode $ LT.insert (tnum tSecuritySettlAgentAcctNum) tSecuritySettlAgentAcctNum $ LT.insert (tnum tSecuritySettlAgentAcctName) tSecuritySettlAgentAcctName $ LT.insert (tnum tSecuritySettlAgentContactName) tSecuritySettlAgentContactName $ LT.insert (tnum tSecuritySettlAgentContactPhone) tSecuritySettlAgentContactPhone $ LT.insert (tnum tCashSettlAgentName) tCashSettlAgentName $ LT.insert (tnum tCashSettlAgentCode) tCashSettlAgentCode $ LT.insert (tnum tCashSettlAgentAcctNum) tCashSettlAgentAcctNum $ LT.insert (tnum tCashSettlAgentAcctName) tCashSettlAgentAcctName $ LT.insert (tnum tCashSettlAgentContactName) tCashSettlAgentContactName $ LT.insert (tnum tCashSettlAgentContactPhone) tCashSettlAgentContactPhone LT.new
2,504
mSettlementInstructions :: FIXMessageSpec mSettlementInstructions = FMSpec { msName = "SettlementInstructions" , msType = C.pack "T" , msHeader = headerFIX42 , msBody = mSettlementInstructionsBody , msTrailer = trailerFIX42 } where mSettlementInstructionsBody = LT.insert (tnum tSettlInstID) tSettlInstID $ LT.insert (tnum tSettlInstTransType) tSettlInstTransType $ LT.insert (tnum tSettlInstRefID) tSettlInstRefID $ LT.insert (tnum tSettlInstMode) tSettlInstMode $ LT.insert (tnum tSettlInstSource) tSettlInstSource $ LT.insert (tnum tAllocAccount) tAllocAccount $ LT.insert (tnum tSettlLocation) tSettlLocation $ LT.insert (tnum tTradeDate) tTradeDate $ LT.insert (tnum tAllocID) tAllocID $ LT.insert (tnum tLastMkt) tLastMkt $ LT.insert (tnum tTradingSessionID) tTradingSessionID $ LT.insert (tnum tSide) tSide $ LT.insert (tnum tSecurityType) tSecurityType $ LT.insert (tnum tEffectiveTime) tEffectiveTime $ LT.insert (tnum tTransactTime) tTransactTime $ LT.insert (tnum tClientID) tClientID $ LT.insert (tnum tExecBroker) tExecBroker $ LT.insert (tnum tStandInstDbType) tStandInstDbType $ LT.insert (tnum tStandInstDbName) tStandInstDbName $ LT.insert (tnum tStandInstDbID) tStandInstDbID $ LT.insert (tnum tSettlDeliveryType) tSettlDeliveryType $ LT.insert (tnum tSettlDepositoryCode) tSettlDepositoryCode $ LT.insert (tnum tSettlBrkrCode) tSettlBrkrCode $ LT.insert (tnum tSettlInstCode) tSettlInstCode $ LT.insert (tnum tSecuritySettlAgentName) tSecuritySettlAgentName $ LT.insert (tnum tSecuritySettlAgentCode) tSecuritySettlAgentCode $ LT.insert (tnum tSecuritySettlAgentAcctNum) tSecuritySettlAgentAcctNum $ LT.insert (tnum tSecuritySettlAgentAcctName) tSecuritySettlAgentAcctName $ LT.insert (tnum tSecuritySettlAgentContactName) tSecuritySettlAgentContactName $ LT.insert (tnum tSecuritySettlAgentContactPhone) tSecuritySettlAgentContactPhone $ LT.insert (tnum tCashSettlAgentName) tCashSettlAgentName $ LT.insert (tnum tCashSettlAgentCode) tCashSettlAgentCode $ LT.insert (tnum tCashSettlAgentAcctNum) tCashSettlAgentAcctNum $ LT.insert (tnum tCashSettlAgentAcctName) tCashSettlAgentAcctName $ LT.insert (tnum tCashSettlAgentContactName) tCashSettlAgentContactName $ LT.insert (tnum tCashSettlAgentContactPhone) tCashSettlAgentContactPhone LT.new
2,504
mSettlementInstructions = FMSpec { msName = "SettlementInstructions" , msType = C.pack "T" , msHeader = headerFIX42 , msBody = mSettlementInstructionsBody , msTrailer = trailerFIX42 } where mSettlementInstructionsBody = LT.insert (tnum tSettlInstID) tSettlInstID $ LT.insert (tnum tSettlInstTransType) tSettlInstTransType $ LT.insert (tnum tSettlInstRefID) tSettlInstRefID $ LT.insert (tnum tSettlInstMode) tSettlInstMode $ LT.insert (tnum tSettlInstSource) tSettlInstSource $ LT.insert (tnum tAllocAccount) tAllocAccount $ LT.insert (tnum tSettlLocation) tSettlLocation $ LT.insert (tnum tTradeDate) tTradeDate $ LT.insert (tnum tAllocID) tAllocID $ LT.insert (tnum tLastMkt) tLastMkt $ LT.insert (tnum tTradingSessionID) tTradingSessionID $ LT.insert (tnum tSide) tSide $ LT.insert (tnum tSecurityType) tSecurityType $ LT.insert (tnum tEffectiveTime) tEffectiveTime $ LT.insert (tnum tTransactTime) tTransactTime $ LT.insert (tnum tClientID) tClientID $ LT.insert (tnum tExecBroker) tExecBroker $ LT.insert (tnum tStandInstDbType) tStandInstDbType $ LT.insert (tnum tStandInstDbName) tStandInstDbName $ LT.insert (tnum tStandInstDbID) tStandInstDbID $ LT.insert (tnum tSettlDeliveryType) tSettlDeliveryType $ LT.insert (tnum tSettlDepositoryCode) tSettlDepositoryCode $ LT.insert (tnum tSettlBrkrCode) tSettlBrkrCode $ LT.insert (tnum tSettlInstCode) tSettlInstCode $ LT.insert (tnum tSecuritySettlAgentName) tSecuritySettlAgentName $ LT.insert (tnum tSecuritySettlAgentCode) tSecuritySettlAgentCode $ LT.insert (tnum tSecuritySettlAgentAcctNum) tSecuritySettlAgentAcctNum $ LT.insert (tnum tSecuritySettlAgentAcctName) tSecuritySettlAgentAcctName $ LT.insert (tnum tSecuritySettlAgentContactName) tSecuritySettlAgentContactName $ LT.insert (tnum tSecuritySettlAgentContactPhone) tSecuritySettlAgentContactPhone $ LT.insert (tnum tCashSettlAgentName) tCashSettlAgentName $ LT.insert (tnum tCashSettlAgentCode) tCashSettlAgentCode $ LT.insert (tnum tCashSettlAgentAcctNum) tCashSettlAgentAcctNum $ LT.insert (tnum tCashSettlAgentAcctName) tCashSettlAgentAcctName $ LT.insert (tnum tCashSettlAgentContactName) tCashSettlAgentContactName $ LT.insert (tnum tCashSettlAgentContactPhone) tCashSettlAgentContactPhone LT.new
2,462
false
true
0
44
454
667
321
346
null
null
facebookincubator/duckling
tests/Duckling/Duration/GA/Tests.hs
bsd-3-clause
tests :: TestTree tests = testGroup "GA Tests" [ makeCorpusTest [Seal Duration] corpus ]
92
tests :: TestTree tests = testGroup "GA Tests" [ makeCorpusTest [Seal Duration] corpus ]
92
tests = testGroup "GA Tests" [ makeCorpusTest [Seal Duration] corpus ]
74
false
true
0
8
17
31
15
16
null
null
brendanhay/gogol
gogol-youtube/gen/Network/Google/Resource/YouTube/PlayLists/List.hs
mpl-2.0
-- | Return the playlists with the given IDs for Stubby or Apiary. pllId :: Lens' PlayListsList [Text] pllId = lens _pllId (\ s a -> s{_pllId = a}) . _Default . _Coerce
176
pllId :: Lens' PlayListsList [Text] pllId = lens _pllId (\ s a -> s{_pllId = a}) . _Default . _Coerce
109
pllId = lens _pllId (\ s a -> s{_pllId = a}) . _Default . _Coerce
73
true
true
0
11
40
53
28
25
null
null
meiersi-11ce/stack
src/Stack/Docker.hs
bsd-3-clause
-- | Subdirectories of the home directory to sandbox between GHC/Stackage versions. sandboxedHomeSubdirectories :: [Path Rel Dir] sandboxedHomeSubdirectories = [$(mkRelDir ".ghc/") ,$(mkRelDir ".cabal/") ,$(mkRelDir ".ghcjs/")]
233
sandboxedHomeSubdirectories :: [Path Rel Dir] sandboxedHomeSubdirectories = [$(mkRelDir ".ghc/") ,$(mkRelDir ".cabal/") ,$(mkRelDir ".ghcjs/")]
149
sandboxedHomeSubdirectories = [$(mkRelDir ".ghc/") ,$(mkRelDir ".cabal/") ,$(mkRelDir ".ghcjs/")]
103
true
true
0
8
30
50
26
24
null
null
phaul/chess
Chess/UCI.hs
bsd-3-clause
execute CmdStop st = do s <- readIORef st atomically $ writeTVar (s^.aborted) True
96
execute CmdStop st = do s <- readIORef st atomically $ writeTVar (s^.aborted) True
96
execute CmdStop st = do s <- readIORef st atomically $ writeTVar (s^.aborted) True
96
false
false
0
10
27
42
18
24
null
null
greydot/dns
Network/DNS/Decode.hs
bsd-3-clause
getResourceRecords :: Int -> SGet [ResourceRecord] getResourceRecords n = replicateM n getResourceRecord
104
getResourceRecords :: Int -> SGet [ResourceRecord] getResourceRecords n = replicateM n getResourceRecord
104
getResourceRecords n = replicateM n getResourceRecord
53
false
true
0
7
11
29
14
15
null
null
snapframework/snap-server
src/Snap/Internal/Http/Server/Socket.hs
bsd-3-clause
sendFileFunc sock !_ builder fPath offset nbytes = bracket acquire closeFd go where acquire = openFd fPath ReadOnly Nothing defaultFileFlags #if MIN_VERSION_network(3,0,0) go fileFd = do sockFd <- Fd `fmap` fdSocket sock sendHeaders builder sockFd sendFile sockFd fileFd offset nbytes #else go fileFd = do let sockFd = Fd $ fdSocket sock sendHeaders builder sockFd sendFile sockFd fileFd offset nbytes #endif #else sendFileFunc sock buffer builder fPath offset nbytes = Streams.unsafeWithFileAsInputStartingAt (fromIntegral offset) fPath $ \fileInput0 -> do fileInput <- Streams.takeBytes (fromIntegral nbytes) fileInput0 >>= Streams.map byteString input <- Streams.fromList [builder] >>= flip Streams.appendInputStream fileInput output <- Streams.makeOutputStream sendChunk >>= Streams.unsafeBuilderStream (return buffer) Streams.supply input output Streams.write (Just flush) output where sendChunk (Just s) = sendAll sock s sendChunk Nothing = return $! () #endif
1,197
sendFileFunc sock !_ builder fPath offset nbytes = bracket acquire closeFd go where acquire = openFd fPath ReadOnly Nothing defaultFileFlags #if MIN_VERSION_network(3,0,0) go fileFd = do sockFd <- Fd `fmap` fdSocket sock sendHeaders builder sockFd sendFile sockFd fileFd offset nbytes #else go fileFd = do let sockFd = Fd $ fdSocket sock sendHeaders builder sockFd sendFile sockFd fileFd offset nbytes #endif #else sendFileFunc sock buffer builder fPath offset nbytes = Streams.unsafeWithFileAsInputStartingAt (fromIntegral offset) fPath $ \fileInput0 -> do fileInput <- Streams.takeBytes (fromIntegral nbytes) fileInput0 >>= Streams.map byteString input <- Streams.fromList [builder] >>= flip Streams.appendInputStream fileInput output <- Streams.makeOutputStream sendChunk >>= Streams.unsafeBuilderStream (return buffer) Streams.supply input output Streams.write (Just flush) output where sendChunk (Just s) = sendAll sock s sendChunk Nothing = return $! () #endif
1,197
sendFileFunc sock !_ builder fPath offset nbytes = bracket acquire closeFd go where acquire = openFd fPath ReadOnly Nothing defaultFileFlags #if MIN_VERSION_network(3,0,0) go fileFd = do sockFd <- Fd `fmap` fdSocket sock sendHeaders builder sockFd sendFile sockFd fileFd offset nbytes #else go fileFd = do let sockFd = Fd $ fdSocket sock sendHeaders builder sockFd sendFile sockFd fileFd offset nbytes #endif #else sendFileFunc sock buffer builder fPath offset nbytes = Streams.unsafeWithFileAsInputStartingAt (fromIntegral offset) fPath $ \fileInput0 -> do fileInput <- Streams.takeBytes (fromIntegral nbytes) fileInput0 >>= Streams.map byteString input <- Streams.fromList [builder] >>= flip Streams.appendInputStream fileInput output <- Streams.makeOutputStream sendChunk >>= Streams.unsafeBuilderStream (return buffer) Streams.supply input output Streams.write (Just flush) output where sendChunk (Just s) = sendAll sock s sendChunk Nothing = return $! () #endif
1,197
false
false
0
9
355
92
44
48
null
null
cgag/selecth
src/Score.hs
mit
-- penalize longer choice strings -- TODO: matchlenghts could probably be a fold over the chars -- instead of using tails score :: Text -> Text -> Double score q choice | T.null q = 1 | T.null choice = 0 | otherwise = let minLength = minMatchLength q choice in normalizeScore minLength q choice where minMatchLength :: Text -> Text -> Int minMatchLength (T.uncons -> Nothing) _ = 1 minMatchLength _ (T.uncons -> Nothing) = 0 minMatchLength (T.uncons -> Just (qHead, rest)) choice = let matchLengths = filter (>0) . map (\t -> endMatch rest (T.drop 1 t) 1) . filter ((== qHead) . T.head) . filter (not . T.null) $ T.tails choice in if null matchLengths then 0 else minimum matchLengths where endMatch :: Text -> Text -> Int -> Int endMatch (T.uncons -> Nothing) _ lastIndex = lastIndex endMatch (T.uncons -> Just (q, qs)) s lastIndex = case T.findIndex (== q) s of Just i -> endMatch qs (T.drop (i + 1) s) (i + 1 + lastIndex) Nothing -> 0
1,224
score :: Text -> Text -> Double score q choice | T.null q = 1 | T.null choice = 0 | otherwise = let minLength = minMatchLength q choice in normalizeScore minLength q choice where minMatchLength :: Text -> Text -> Int minMatchLength (T.uncons -> Nothing) _ = 1 minMatchLength _ (T.uncons -> Nothing) = 0 minMatchLength (T.uncons -> Just (qHead, rest)) choice = let matchLengths = filter (>0) . map (\t -> endMatch rest (T.drop 1 t) 1) . filter ((== qHead) . T.head) . filter (not . T.null) $ T.tails choice in if null matchLengths then 0 else minimum matchLengths where endMatch :: Text -> Text -> Int -> Int endMatch (T.uncons -> Nothing) _ lastIndex = lastIndex endMatch (T.uncons -> Just (q, qs)) s lastIndex = case T.findIndex (== q) s of Just i -> endMatch qs (T.drop (i + 1) s) (i + 1 + lastIndex) Nothing -> 0
1,100
score q choice | T.null q = 1 | T.null choice = 0 | otherwise = let minLength = minMatchLength q choice in normalizeScore minLength q choice where minMatchLength :: Text -> Text -> Int minMatchLength (T.uncons -> Nothing) _ = 1 minMatchLength _ (T.uncons -> Nothing) = 0 minMatchLength (T.uncons -> Just (qHead, rest)) choice = let matchLengths = filter (>0) . map (\t -> endMatch rest (T.drop 1 t) 1) . filter ((== qHead) . T.head) . filter (not . T.null) $ T.tails choice in if null matchLengths then 0 else minimum matchLengths where endMatch :: Text -> Text -> Int -> Int endMatch (T.uncons -> Nothing) _ lastIndex = lastIndex endMatch (T.uncons -> Just (q, qs)) s lastIndex = case T.findIndex (== q) s of Just i -> endMatch qs (T.drop (i + 1) s) (i + 1 + lastIndex) Nothing -> 0
1,068
true
true
1
19
460
411
208
203
null
null
nullobject/flatland-haskell
src/Collision.hs
bsd-3-clause
newBody :: Body newBody = Body { bodyPosition = zeroV , bodyVelocity = zeroV , bodyRotation = 0.0 , bodyInverseMass = 1.0 , bodyExtents = (0.5, 0.5) }
238
newBody :: Body newBody = Body { bodyPosition = zeroV , bodyVelocity = zeroV , bodyRotation = 0.0 , bodyInverseMass = 1.0 , bodyExtents = (0.5, 0.5) }
238
newBody = Body { bodyPosition = zeroV , bodyVelocity = zeroV , bodyRotation = 0.0 , bodyInverseMass = 1.0 , bodyExtents = (0.5, 0.5) }
222
false
true
0
8
115
59
33
26
null
null
IreneKnapp/Faction
faction/Distribution/Client/Dependency/Modular/Dependency.hs
bsd-3-clause
goalReasonsToVars :: Ord qpn => GoalReasons qpn -> ConflictSet qpn goalReasonsToVars = S.unions . L.map goalReasonToVars
120
goalReasonsToVars :: Ord qpn => GoalReasons qpn -> ConflictSet qpn goalReasonsToVars = S.unions . L.map goalReasonToVars
120
goalReasonsToVars = S.unions . L.map goalReasonToVars
53
false
true
0
7
15
39
18
21
null
null
davmre/matrizer
web/Application.hs
gpl-2.0
shutdownApp :: App -> IO () shutdownApp _ = return ()
53
shutdownApp :: App -> IO () shutdownApp _ = return ()
53
shutdownApp _ = return ()
25
false
true
0
8
10
32
14
18
null
null
zcourts/Stasis
src/Control/Unsafe/Stasis.hs
bsd-3-clause
stasis :: a -> Pod a stasis v = let p = unsafePerformIO $ newIORef M.empty c = unsafePerformIO $ newIORef Content { contentVal = v, stasisVersion = 1} in Stasis{val = c, frozenVersions = p }
244
stasis :: a -> Pod a stasis v = let p = unsafePerformIO $ newIORef M.empty c = unsafePerformIO $ newIORef Content { contentVal = v, stasisVersion = 1} in Stasis{val = c, frozenVersions = p }
244
stasis v = let p = unsafePerformIO $ newIORef M.empty c = unsafePerformIO $ newIORef Content { contentVal = v, stasisVersion = 1} in Stasis{val = c, frozenVersions = p }
223
false
true
0
12
90
90
45
45
null
null
bgamari/pandoc
src/Text/Pandoc/Writers/Docx.hs
gpl-2.0
getParaProps :: Bool -> WS [Element] getParaProps displayMathPara = do props <- gets stParaProperties listLevel <- gets stListLevel numid <- gets stListNumId let listPr = if listLevel >= 0 && not displayMathPara then [ mknode "w:numPr" [] [ mknode "w:numId" [("w:val",show numid)] () , mknode "w:ilvl" [("w:val",show listLevel)] () ] ] else [] return $ case props ++ listPr of [] -> [] ps -> [mknode "w:pPr" [] ps]
565
getParaProps :: Bool -> WS [Element] getParaProps displayMathPara = do props <- gets stParaProperties listLevel <- gets stListLevel numid <- gets stListNumId let listPr = if listLevel >= 0 && not displayMathPara then [ mknode "w:numPr" [] [ mknode "w:numId" [("w:val",show numid)] () , mknode "w:ilvl" [("w:val",show listLevel)] () ] ] else [] return $ case props ++ listPr of [] -> [] ps -> [mknode "w:pPr" [] ps]
565
getParaProps displayMathPara = do props <- gets stParaProperties listLevel <- gets stListLevel numid <- gets stListNumId let listPr = if listLevel >= 0 && not displayMathPara then [ mknode "w:numPr" [] [ mknode "w:numId" [("w:val",show numid)] () , mknode "w:ilvl" [("w:val",show listLevel)] () ] ] else [] return $ case props ++ listPr of [] -> [] ps -> [mknode "w:pPr" [] ps]
528
false
true
0
17
219
187
92
95
null
null
LambdaHack/LambdaHack
engine-src/Game/LambdaHack/Common/Item.hs
bsd-3-clause
strongestSlot :: DiscoveryBenefit -> Ability.EqpSlot -> [(ItemId, ItemFullKit)] -> [(Int, (ItemId, ItemFullKit))] strongestSlot discoBenefit eqpSlot is = let f (iid, (itemFull, kit)) = let Benefit{benInEqp, benPickup, benMelee} = discoBenefit EM.! iid in if not benInEqp then Nothing else Just $ let ben = case eqpSlot of EqpSlotWeaponFast -> -- For equipping/unequipping the main reliable weapon, -- we take into account not only melee damage, -- but also timeout, aspects, etc. ceiling benPickup EqpSlotWeaponBig -> -- For equipping/unequipping the one-shot big hitter -- weapon, we take into account only melee damage -- and we don't even care if it's durable. -- The backup is ready in the slot above, after all. ceiling (- benMelee) _ -> valueAtEqpSlot eqpSlot $ aspectRecordFull itemFull idBonus = if itemSuspect itemFull then 1000 else 0 arItem = aspectRecordFull itemFull -- Equip good uniques for flavour and fun from unique effects. uniqueBonus = if IA.checkFlag Ability.Unique arItem && ben > 20 then 1000 else 0 in (ben + idBonus + uniqueBonus, (iid, (itemFull, kit))) in sortBy (flip $ comparing fst) $ mapMaybe f is
1,605
strongestSlot :: DiscoveryBenefit -> Ability.EqpSlot -> [(ItemId, ItemFullKit)] -> [(Int, (ItemId, ItemFullKit))] strongestSlot discoBenefit eqpSlot is = let f (iid, (itemFull, kit)) = let Benefit{benInEqp, benPickup, benMelee} = discoBenefit EM.! iid in if not benInEqp then Nothing else Just $ let ben = case eqpSlot of EqpSlotWeaponFast -> -- For equipping/unequipping the main reliable weapon, -- we take into account not only melee damage, -- but also timeout, aspects, etc. ceiling benPickup EqpSlotWeaponBig -> -- For equipping/unequipping the one-shot big hitter -- weapon, we take into account only melee damage -- and we don't even care if it's durable. -- The backup is ready in the slot above, after all. ceiling (- benMelee) _ -> valueAtEqpSlot eqpSlot $ aspectRecordFull itemFull idBonus = if itemSuspect itemFull then 1000 else 0 arItem = aspectRecordFull itemFull -- Equip good uniques for flavour and fun from unique effects. uniqueBonus = if IA.checkFlag Ability.Unique arItem && ben > 20 then 1000 else 0 in (ben + idBonus + uniqueBonus, (iid, (itemFull, kit))) in sortBy (flip $ comparing fst) $ mapMaybe f is
1,605
strongestSlot discoBenefit eqpSlot is = let f (iid, (itemFull, kit)) = let Benefit{benInEqp, benPickup, benMelee} = discoBenefit EM.! iid in if not benInEqp then Nothing else Just $ let ben = case eqpSlot of EqpSlotWeaponFast -> -- For equipping/unequipping the main reliable weapon, -- we take into account not only melee damage, -- but also timeout, aspects, etc. ceiling benPickup EqpSlotWeaponBig -> -- For equipping/unequipping the one-shot big hitter -- weapon, we take into account only melee damage -- and we don't even care if it's durable. -- The backup is ready in the slot above, after all. ceiling (- benMelee) _ -> valueAtEqpSlot eqpSlot $ aspectRecordFull itemFull idBonus = if itemSuspect itemFull then 1000 else 0 arItem = aspectRecordFull itemFull -- Equip good uniques for flavour and fun from unique effects. uniqueBonus = if IA.checkFlag Ability.Unique arItem && ben > 20 then 1000 else 0 in (ben + idBonus + uniqueBonus, (iid, (itemFull, kit))) in sortBy (flip $ comparing fst) $ mapMaybe f is
1,477
false
true
0
22
652
296
158
138
null
null
ekmett/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_ASN1_SCALAR :: Int wxSTC_ASN1_SCALAR = 5
46
wxSTC_ASN1_SCALAR :: Int wxSTC_ASN1_SCALAR = 5
46
wxSTC_ASN1_SCALAR = 5
21
false
true
0
6
5
18
7
11
null
null
andir/ganeti
src/Ganeti/THH/HsRPC.hs
bsd-2-clause
mkRpcCall :: Name -> Q [Dec] mkRpcCall name = do let bname = nameBase name fname = mkName bname -- the name of the generated function (args, rtype) <- funArgs <$> typeOfFun name rarg <- argumentType rtype let ftype = foldr (\a t -> AppT (AppT ArrowT a) t) (AppT (ConT ''RpcClientMonad) rarg) args body <- [| $(curryN $ length args) (callMethod $(stringE bname)) |] return [ SigD fname ftype , ValD (VarP fname) (NormalB body) [] ] -- Given a list of server RPC functions creates the corresponding client -- RPC functions. -- -- See 'mkRpcCall'
601
mkRpcCall :: Name -> Q [Dec] mkRpcCall name = do let bname = nameBase name fname = mkName bname -- the name of the generated function (args, rtype) <- funArgs <$> typeOfFun name rarg <- argumentType rtype let ftype = foldr (\a t -> AppT (AppT ArrowT a) t) (AppT (ConT ''RpcClientMonad) rarg) args body <- [| $(curryN $ length args) (callMethod $(stringE bname)) |] return [ SigD fname ftype , ValD (VarP fname) (NormalB body) [] ] -- Given a list of server RPC functions creates the corresponding client -- RPC functions. -- -- See 'mkRpcCall'
601
mkRpcCall name = do let bname = nameBase name fname = mkName bname -- the name of the generated function (args, rtype) <- funArgs <$> typeOfFun name rarg <- argumentType rtype let ftype = foldr (\a t -> AppT (AppT ArrowT a) t) (AppT (ConT ''RpcClientMonad) rarg) args body <- [| $(curryN $ length args) (callMethod $(stringE bname)) |] return [ SigD fname ftype , ValD (VarP fname) (NormalB body) [] ] -- Given a list of server RPC functions creates the corresponding client -- RPC functions. -- -- See 'mkRpcCall'
572
false
true
0
16
154
187
92
95
null
null
diagrams/diagrams-contrib
src/Diagrams/Color/XKCD.hs
bsd-3-clause
clayBrown = fromJust $ readHexColor "#b2713d"
57
clayBrown = fromJust $ readHexColor "#b2713d"
57
clayBrown = fromJust $ readHexColor "#b2713d"
57
false
false
0
6
17
13
6
7
null
null
simonmichael/hledger
hledger-lib/Text/Megaparsec/Custom.hs
gpl-3.0
-- | Like megaparsec's 'customFailure', but as a "final" parse error. finalCustomFailure :: (MonadParsec e s m, MonadError (FinalParseError' e) m) => e -> m a finalCustomFailure = finalFancyFailure . S.singleton . ErrorCustom
228
finalCustomFailure :: (MonadParsec e s m, MonadError (FinalParseError' e) m) => e -> m a finalCustomFailure = finalFancyFailure . S.singleton . ErrorCustom
157
finalCustomFailure = finalFancyFailure . S.singleton . ErrorCustom
66
true
true
0
8
35
60
30
30
null
null
HIPERFIT/futhark
src/Futhark/CLI/Bench.hs
isc
initialBenchOptions :: BenchOptions initialBenchOptions = BenchOptions "c" Nothing "" 10 [] [] Nothing (-1) False ["nobench", "disable"] [] Nothing (Just "tuning") Nothing 0 Nothing
247
initialBenchOptions :: BenchOptions initialBenchOptions = BenchOptions "c" Nothing "" 10 [] [] Nothing (-1) False ["nobench", "disable"] [] Nothing (Just "tuning") Nothing 0 Nothing
247
initialBenchOptions = BenchOptions "c" Nothing "" 10 [] [] Nothing (-1) False ["nobench", "disable"] [] Nothing (Just "tuning") Nothing 0 Nothing
211
false
true
0
6
89
89
36
53
null
null
urbanslug/ghc
libraries/template-haskell/Language/Haskell/TH/Lib.hs
bsd-3-clause
conT :: Name -> TypeQ conT = return . ConT
42
conT :: Name -> TypeQ conT = return . ConT
42
conT = return . ConT
20
false
true
0
5
9
19
10
9
null
null
creichert/wai
wai/Network/Wai.hs
mit
mapResponseHeaders f (ResponseBuilder s h b) = ResponseBuilder s (f h) b
72
mapResponseHeaders f (ResponseBuilder s h b) = ResponseBuilder s (f h) b
72
mapResponseHeaders f (ResponseBuilder s h b) = ResponseBuilder s (f h) b
72
false
false
0
7
11
36
16
20
null
null
jeffchao/hedgewars-accessible
gameServer/RoomsAndClients.hs
gpl-2.0
lobbyId :: RoomIndex lobbyId = RoomIndex firstIndex
51
lobbyId :: RoomIndex lobbyId = RoomIndex firstIndex
51
lobbyId = RoomIndex firstIndex
30
false
true
0
6
6
21
8
13
null
null
ninedotnine/bugfree-computing-machine
src/ObjParser.hs
gpl-3.0
-- FIXME : this discards the name of the entry. is that okay? entry :: MyParser () entry = do ent <- string "ENTRY " *> label *> skipSpaces *> readNum <* skipToEOL info <- getState when (getEntry info /= Nothing) $ fail "multiple ENTRY" putState $ setEntry (Just ent) info
290
entry :: MyParser () entry = do ent <- string "ENTRY " *> label *> skipSpaces *> readNum <* skipToEOL info <- getState when (getEntry info /= Nothing) $ fail "multiple ENTRY" putState $ setEntry (Just ent) info
227
entry = do ent <- string "ENTRY " *> label *> skipSpaces *> readNum <* skipToEOL info <- getState when (getEntry info /= Nothing) $ fail "multiple ENTRY" putState $ setEntry (Just ent) info
206
true
true
0
13
68
97
43
54
null
null
R-Morgan/NGramCrackers
src/NGramCrackers/Ops/Pretty.hs
agpl-3.0
typeTokenRatio :: T.Text -> T.Text typeTokenRatio string = typeStr <#> ps types <#> tokStr <#> ps tokens <#> ttrStr <#> ratio where types = (fromIntegral . length . nub . T.words) string tokens = (fromIntegral . length . T.words) string ratio = (T.pack . show) $ types / tokens typeStr = T.pack "Types: " tokStr = T.pack ", Tokens: " ttrStr = T.pack ", TTR: " ps = T.pack . show
615
typeTokenRatio :: T.Text -> T.Text typeTokenRatio string = typeStr <#> ps types <#> tokStr <#> ps tokens <#> ttrStr <#> ratio where types = (fromIntegral . length . nub . T.words) string tokens = (fromIntegral . length . T.words) string ratio = (T.pack . show) $ types / tokens typeStr = T.pack "Types: " tokStr = T.pack ", Tokens: " ttrStr = T.pack ", TTR: " ps = T.pack . show
615
typeTokenRatio string = typeStr <#> ps types <#> tokStr <#> ps tokens <#> ttrStr <#> ratio where types = (fromIntegral . length . nub . T.words) string tokens = (fromIntegral . length . T.words) string ratio = (T.pack . show) $ types / tokens typeStr = T.pack "Types: " tokStr = T.pack ", Tokens: " ttrStr = T.pack ", TTR: " ps = T.pack . show
579
false
true
0
11
307
159
81
78
null
null
brendanhay/gogol
gogol-apps-tasks/gen/Network/Google/Resource/Tasks/Tasks/Insert.hs
mpl-2.0
-- | Parent task identifier. If the task is created at the top level, this -- parameter is omitted. Optional. tiParent :: Lens' TasksInsert (Maybe Text) tiParent = lens _tiParent (\ s a -> s{_tiParent = a})
206
tiParent :: Lens' TasksInsert (Maybe Text) tiParent = lens _tiParent (\ s a -> s{_tiParent = a})
96
tiParent = lens _tiParent (\ s a -> s{_tiParent = a})
53
true
true
0
9
36
47
26
21
null
null
letsbreelhere/egg
src/Unification/TyContext.hs
bsd-3-clause
addContext :: (String, Scheme) -> TyContext -> TyContext addContext (x, t) (TyContext env) = TyContext $ Map.insert x t env
123
addContext :: (String, Scheme) -> TyContext -> TyContext addContext (x, t) (TyContext env) = TyContext $ Map.insert x t env
123
addContext (x, t) (TyContext env) = TyContext $ Map.insert x t env
66
false
true
0
7
19
60
30
30
null
null
brendanhay/gogol
gogol-tagmanager/gen/Network/Google/Resource/TagManager/Accounts/Containers/Workspaces/Zones/Revert.hs
mpl-2.0
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\"). acwzrUploadType :: Lens' AccountsContainersWorkspacesZonesRevert (Maybe Text) acwzrUploadType = lens _acwzrUploadType (\ s a -> s{_acwzrUploadType = a})
231
acwzrUploadType :: Lens' AccountsContainersWorkspacesZonesRevert (Maybe Text) acwzrUploadType = lens _acwzrUploadType (\ s a -> s{_acwzrUploadType = a})
160
acwzrUploadType = lens _acwzrUploadType (\ s a -> s{_acwzrUploadType = a})
82
true
true
0
9
34
48
25
23
null
null
gridaphobe/liquid-fixpoint
src/Language/Fixpoint/Solver/Monad.hs
bsd-3-clause
progIter :: Bool -> SolveM () progIter newScc = lift $ when newScc progressTick
79
progIter :: Bool -> SolveM () progIter newScc = lift $ when newScc progressTick
79
progIter newScc = lift $ when newScc progressTick
49
false
true
0
7
13
32
15
17
null
null
diku-dk/futhark
src/Futhark/Analysis/MemAlias.hs
isc
analyzeHostOp m (SegOp (SegRed _ _ _ _ kbody)) = analyzeStms (kernelBodyStms kbody) m
87
analyzeHostOp m (SegOp (SegRed _ _ _ _ kbody)) = analyzeStms (kernelBodyStms kbody) m
87
analyzeHostOp m (SegOp (SegRed _ _ _ _ kbody)) = analyzeStms (kernelBodyStms kbody) m
87
false
false
0
9
15
42
20
22
null
null
stain/jdk8u
src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
gpl-2.0
ffitypeVal nt = archExpr (ffitype2js $ ffitype W32 nt) (ffitype2js $ ffitype W64 nt)
109
ffitypeVal nt = archExpr (ffitype2js $ ffitype W32 nt) (ffitype2js $ ffitype W64 nt)
109
ffitypeVal nt = archExpr (ffitype2js $ ffitype W32 nt) (ffitype2js $ ffitype W64 nt)
109
false
false
1
8
38
43
18
25
null
null
nevrenato/HetsAlloy
CMDL/Utils.hs
gpl-2.0
safeTail :: [a] -> [a] safeTail = drop 1
40
safeTail :: [a] -> [a] safeTail = drop 1
40
safeTail = drop 1
17
false
true
0
6
8
24
13
11
null
null
ekmett/ansi-terminal
System/Console/ANSI/Unix.hs
bsd-3-clause
-- | Thanks to Brandon S. Allbery and Curt Sampson for pointing me in the right direction on xterm title setting on haskell-cafe. -- The "0" signifies that both the title and "icon" text should be set: i.e. the text for the window in the Start bar (or similar) -- as well as that in the actual window title. This is chosen for consistent behaviour between Unixes and Windows. setTitleCode title = "\ESC]0;" ++ filter (/= '\007') title ++ "\007"
445
setTitleCode title = "\ESC]0;" ++ filter (/= '\007') title ++ "\007"
68
setTitleCode title = "\ESC]0;" ++ filter (/= '\007') title ++ "\007"
68
true
false
1
8
80
33
16
17
null
null
mgeorgoulopoulos/TetrisHaskellWeekend
Logic.hs
mit
canPieceBeAt :: Piece -> (Int, Int) -> Well -> Bool canPieceBeAt piece coord well = insidePlayfield && (not colliding) where insidePlayfield = validPos coord piece colliding = pieceCollides piece coord well -- Moves the current piece one cell down
264
canPieceBeAt :: Piece -> (Int, Int) -> Well -> Bool canPieceBeAt piece coord well = insidePlayfield && (not colliding) where insidePlayfield = validPos coord piece colliding = pieceCollides piece coord well -- Moves the current piece one cell down
263
canPieceBeAt piece coord well = insidePlayfield && (not colliding) where insidePlayfield = validPos coord piece colliding = pieceCollides piece coord well -- Moves the current piece one cell down
211
false
true
1
7
55
72
37
35
null
null
swamp-agr/carbuyer-advisor
Handler/Search.hs
mit
choosePriceAdvice :: Score -> Text choosePriceAdvice OutLeft = "9"
67
choosePriceAdvice :: Score -> Text choosePriceAdvice OutLeft = "9"
67
choosePriceAdvice OutLeft = "9"
32
false
true
0
5
9
18
9
9
null
null
himura/ghc-mod
Gap.hs
bsd-3-clause
getSrcSpan _ = Nothing
22
getSrcSpan _ = Nothing
22
getSrcSpan _ = Nothing
22
false
false
0
5
3
9
4
5
null
null
prb/perpubplat
src/Blog/Widgets/StreamOfConsciousness/RssUtilities.hs
bsd-3-clause
rss1_pfx :: Maybe String rss1_pfx = Just "rss"
46
rss1_pfx :: Maybe String rss1_pfx = Just "rss"
46
rss1_pfx = Just "rss"
21
false
true
0
6
7
23
9
14
null
null
Mathnerd314/lamdu
bottlelib/Graphics/UI/Bottle/Widgets/FlyNav.hs
gpl-3.0
cap :: Size -> Vector2 Widget.R -> Vector2 Widget.R cap size = liftA2 max 0 . liftA2 min size
93
cap :: Size -> Vector2 Widget.R -> Vector2 Widget.R cap size = liftA2 max 0 . liftA2 min size
93
cap size = liftA2 max 0 . liftA2 min size
41
false
true
1
9
18
53
22
31
null
null
egaburov/funstuff
Haskell/parsec/PutJSON.hs
apache-2.0
renderJValue (JNumber n) = show n
35
renderJValue (JNumber n) = show n
35
renderJValue (JNumber n) = show n
35
false
false
0
6
7
19
8
11
null
null
trbauer/hrun
HRun.hs
mit
defaultArgs = Args False False False "" []
42
defaultArgs = Args False False False "" []
42
defaultArgs = Args False False False "" []
42
false
false
1
6
7
23
9
14
null
null
mietek/experiment-floyd-warshall
src/RegExp.hs
mit
eval _ (RegExp Empty) = one
33
eval _ (RegExp Empty) = one
33
eval _ (RegExp Empty) = one
33
false
false
0
7
11
17
8
9
null
null
atsukotakahashi/wi
src/library/Yi/Keymap/Vim/Ex/Commands/Cabal.hs
gpl-2.0
-- TODO: Either hack Text into these parsec parsers or use Attoparsec. -- Attoparsec is faster anyway and backtracks by default so we may -- want to use that anyway. parse :: EventString -> Maybe ExCommand parse = Common.parse $ do void $ P.try (P.string "cabal build") <|> P.try (P.string "cabal") args <- Common.commandArgs return $ Common.impureExCommand { cmdShow = T.pack "cabal build" , cmdAction = YiA $ cabalBuildE $ CommandArguments args }
481
parse :: EventString -> Maybe ExCommand parse = Common.parse $ do void $ P.try (P.string "cabal build") <|> P.try (P.string "cabal") args <- Common.commandArgs return $ Common.impureExCommand { cmdShow = T.pack "cabal build" , cmdAction = YiA $ cabalBuildE $ CommandArguments args }
314
parse = Common.parse $ do void $ P.try (P.string "cabal build") <|> P.try (P.string "cabal") args <- Common.commandArgs return $ Common.impureExCommand { cmdShow = T.pack "cabal build" , cmdAction = YiA $ cabalBuildE $ CommandArguments args }
274
true
true
0
13
105
112
56
56
null
null
tomahawkins/powerpc
Language/PowerPC/Simulator.hs
bsd-3-clause
step :: Memory a => a -> Word32 -> Machine -> IO Machine step memory instr m = do (m, env) <- evalStmt (m, []) $ snd $ rtl (pc m) instr return m { pc = fromInteger $ lookup' "NIA" env } where evalStmt :: (Machine, [(String, Integer)]) -> Stmt -> IO (Machine, [(String, Integer)]) evalStmt (m, env) a = case a of Seq a -> foldM evalStmt (m, env) a If a b c -> do a <- evalExpr (m, env) a if a /= 0 then evalStmt (m, env) b else evalStmt (m, env) c While cond stmt -> do cond' <- evalExpr (m, env) cond if cond' == 0 then return (m, env) else do (m, env) <- evalStmt (m, env) stmt evalStmt (m, env) $ While cond stmt Assign cond a b -> do b <- evalExpr (m, env) b m <- conditions (m, env) b cond let b64 = fromIntegral b :: Word64 b32 = fromIntegral b :: Word32 case a of V n -> return (m, (n, b) : env) --CR CRField i -> do i <- evalExpr (m, env) i return (m { cr = shiftL (b32 .&. 0xFF) (fromIntegral $ (7 - i) * 4) .|. complement (shiftL 0xFF (fromIntegral $ (7 - i) * 4)) .&. (cr m) }, env) CTR -> return (m { ctr = b64 }, env) EA -> return (m, ("EA", b) : env) LR -> return (m { lr = b64 }, env) GPR n -> do n <- evalExpr (m, env) n return (m { gprs = replace (fromIntegral n) b64 (gprs m) }, env) MEM addr bytes -> do addr <- evalExpr (m, env) addr store memory (fromIntegral addr) $ toBytes bytes b return (m, env) MSR -> writeMSR memory b64 >> return (m, env) NIA -> return (m, ("NIA", b) : env) RA -> return (m { gprs = replace (ufield 11 15) b64 (gprs m) }, env) RT -> return (m { gprs = replace (ufield 6 10) b64 (gprs m) }, env) SPR -> case spr of 1 -> return (m { xer = b64 }, env) 8 -> return (m { lr = b64 }, env) 9 -> return (m { ctr = b64 }, env) n -> writeSPR memory n b64 >> return (m, env) XER -> return (m { xer = b64 }, env) Null -> return (m, env) _ -> error $ "Invalid assignment target: " ++ show a evalExpr :: (Machine, [(String, Integer)]) -> E -> IO Integer evalExpr (m, env) a = case a of V n -> return $ lookup' n env C a -> return $ a Add a b -> binop (+) a b Sub a b -> binop (-) a b Mul a b -> binop (*) a b Div a b -> binop div a b Not a -> uniop (toBool . (== 0)) a And a b -> binop (\ a b -> toBool $ a /= 0 && b /= 0) a b Or a b -> binop (\ a b -> toBool $ a /= 0 || b /= 0) a b BWNot a -> uniop complement a BWAnd a b -> binop (.&.) a b BWOr a b -> binop (.|.) a b Shift a b -> binop (\ a b -> shift a $ fromIntegral b) a b Eq a b -> binop (\ a b -> toBool $ a == b) a b Lt a b -> binop (\ a b -> toBool $ (fromIntegral a :: Word64) < (fromIntegral b :: Word64)) a b Null -> error "Invalid expressions: Null" Bit a w i -> binop (\ a i -> if i >= fromIntegral w then error "Bit: bit index greater than width" else toBool $ testBit a $ w - 1 - fromIntegral i) a i AA -> return $ bool 30 BA -> return $ ufield 11 15 BB -> return $ ufield 16 20 BD -> return $ clearBits (sfield 16 31) [1, 0] BF -> return $ ufield 6 8 BI -> return $ ufield 11 15 BO -> return $ ufield 6 10 BT -> return $ ufield 6 10 CA' -> return $ toBool $ testBit (xer m) (63 - 34) CIA -> return $ fromIntegral $ pc m CR' -> return $ fromIntegral $ cr m CRField i -> uniop (\ i -> fromIntegral $ shiftR (cr m) ((7 - fromIntegral i) * 4) .&. 0xFF) i CTR -> return $ fromIntegral $ ctr m D -> return $ sfield 16 31 EA -> return $ lookup' "EA" env EXTS n a -> uniop (\ a -> if testBit a (63 - n) then a .|. complement (setBits 0 [0 .. 63 - n]) else a .&. setBits 0 [0 .. 63 - n]) a GPR a -> uniop (\ a -> fromIntegral $ gprs m !! fromIntegral a) a L10 -> return $ bool 10 L15 -> return $ bool 15 LI -> return $ clearBits (sfield 6 31) [1, 0] LK -> return $ bool 31 LR -> return $ fromIntegral $ lr m MASK start stop -> binop (\ start stop -> setBits 0 [63 - fromIntegral stop .. 63 - fromIntegral start]) start stop MB5 -> return $ ufield 21 25 MB6 -> return $ ufield 21 26 ME5 -> return $ ufield 26 30 ME6 -> return $ ufield 21 26 MEM addr bytes -> do addr <- evalExpr (m, env) addr value <- load memory (fromIntegral addr) bytes return $ fromBytes value MSR -> readMSR memory >>= return . fromIntegral NIA -> return $ lookup' "NIA" env OE -> return $ bool 21 RAI -> return $ ufield 11 15 RA -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 11 15) RB -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 16 20) Rc -> return $ bool 31 ROTL32 a n -> binop (rotateLN 32) a n ROTL64 a n -> binop (rotateLN 64) a n RS -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 6 10) RSI -> return $ ufield 6 10 RT -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 6 10) RTI -> return $ ufield 6 10 SH5 -> return $ ufield 16 20 SH6 -> return $ shiftL (ufield 30 30) 5 .|. ufield 16 20 SI -> return $ sfield 16 31 SPR -> case spr of 1 -> return $ fromIntegral $ xer m 8 -> return $ fromIntegral $ lr m 9 -> return $ fromIntegral $ ctr m n -> readSPR memory n >>= return . fromIntegral UI -> return $ ufield 16 31 XER -> return $ fromIntegral $ xer m where binop :: (Integer -> Integer -> Integer) -> E -> E -> IO Integer binop f a b = do a <- evalExpr (m, env) a b <- evalExpr (m, env) b return $ f a b uniop :: (Integer -> Integer) -> E -> IO Integer uniop f a = do a <- evalExpr (m, env) a return $ f a spr :: Int spr = fromIntegral $ shiftL (ufield 16 20) 5 .|. ufield 11 15 toBool :: Bool -> Integer toBool True = 1 toBool False = 0 ufield :: Int -> Int -> Integer ufield h l = shiftR (fromIntegral instr) (31 - l) .&. setBits 0 [0 .. l - h] sfield :: Int -> Int -> Integer sfield h l = ufield h l .|. (if testBit instr (31 - h) then complement $ setBits 0 [0 .. l - h] else 0) bool :: Int -> Integer bool n = toBool $ testBit instr (31 - n) conditions :: (Machine, [(String, Integer)]) -> Integer -> [Cond] -> IO Machine conditions (m, env) value conds = do m <- foldM condition m $ sort conds return m where condition :: Machine -> Cond -> IO Machine condition n cond = case cond of CA c -> on c $ return n { xer = if isCA value then setBit (xer n) 29 else clearBit (xer n) 29 } OV c -> on c $ return n { xer = if isOV value then setBits (xer n) [31, 30] else clearBit (xer n) 30 } CR field c -> on c $ do field <- evalExpr (m, env) field let bits = [(0, isLT value), (1, isGT value), (2, isEQ value), (3, testBit (xer n) 31)] bitsToSet = map f [ n | (n, a) <- bits, a ] bitsToClear = map f [ n | (n, a) <- bits, not a ] f i = 31 - (i + 4 * fromIntegral field) return n { cr = clearBits (setBits (cr n) bitsToSet) bitsToClear } where on :: E -> IO Machine -> IO Machine on c action = do c <- evalExpr (m, env) c if c /= 0 then action else return n
7,797
step :: Memory a => a -> Word32 -> Machine -> IO Machine step memory instr m = do (m, env) <- evalStmt (m, []) $ snd $ rtl (pc m) instr return m { pc = fromInteger $ lookup' "NIA" env } where evalStmt :: (Machine, [(String, Integer)]) -> Stmt -> IO (Machine, [(String, Integer)]) evalStmt (m, env) a = case a of Seq a -> foldM evalStmt (m, env) a If a b c -> do a <- evalExpr (m, env) a if a /= 0 then evalStmt (m, env) b else evalStmt (m, env) c While cond stmt -> do cond' <- evalExpr (m, env) cond if cond' == 0 then return (m, env) else do (m, env) <- evalStmt (m, env) stmt evalStmt (m, env) $ While cond stmt Assign cond a b -> do b <- evalExpr (m, env) b m <- conditions (m, env) b cond let b64 = fromIntegral b :: Word64 b32 = fromIntegral b :: Word32 case a of V n -> return (m, (n, b) : env) --CR CRField i -> do i <- evalExpr (m, env) i return (m { cr = shiftL (b32 .&. 0xFF) (fromIntegral $ (7 - i) * 4) .|. complement (shiftL 0xFF (fromIntegral $ (7 - i) * 4)) .&. (cr m) }, env) CTR -> return (m { ctr = b64 }, env) EA -> return (m, ("EA", b) : env) LR -> return (m { lr = b64 }, env) GPR n -> do n <- evalExpr (m, env) n return (m { gprs = replace (fromIntegral n) b64 (gprs m) }, env) MEM addr bytes -> do addr <- evalExpr (m, env) addr store memory (fromIntegral addr) $ toBytes bytes b return (m, env) MSR -> writeMSR memory b64 >> return (m, env) NIA -> return (m, ("NIA", b) : env) RA -> return (m { gprs = replace (ufield 11 15) b64 (gprs m) }, env) RT -> return (m { gprs = replace (ufield 6 10) b64 (gprs m) }, env) SPR -> case spr of 1 -> return (m { xer = b64 }, env) 8 -> return (m { lr = b64 }, env) 9 -> return (m { ctr = b64 }, env) n -> writeSPR memory n b64 >> return (m, env) XER -> return (m { xer = b64 }, env) Null -> return (m, env) _ -> error $ "Invalid assignment target: " ++ show a evalExpr :: (Machine, [(String, Integer)]) -> E -> IO Integer evalExpr (m, env) a = case a of V n -> return $ lookup' n env C a -> return $ a Add a b -> binop (+) a b Sub a b -> binop (-) a b Mul a b -> binop (*) a b Div a b -> binop div a b Not a -> uniop (toBool . (== 0)) a And a b -> binop (\ a b -> toBool $ a /= 0 && b /= 0) a b Or a b -> binop (\ a b -> toBool $ a /= 0 || b /= 0) a b BWNot a -> uniop complement a BWAnd a b -> binop (.&.) a b BWOr a b -> binop (.|.) a b Shift a b -> binop (\ a b -> shift a $ fromIntegral b) a b Eq a b -> binop (\ a b -> toBool $ a == b) a b Lt a b -> binop (\ a b -> toBool $ (fromIntegral a :: Word64) < (fromIntegral b :: Word64)) a b Null -> error "Invalid expressions: Null" Bit a w i -> binop (\ a i -> if i >= fromIntegral w then error "Bit: bit index greater than width" else toBool $ testBit a $ w - 1 - fromIntegral i) a i AA -> return $ bool 30 BA -> return $ ufield 11 15 BB -> return $ ufield 16 20 BD -> return $ clearBits (sfield 16 31) [1, 0] BF -> return $ ufield 6 8 BI -> return $ ufield 11 15 BO -> return $ ufield 6 10 BT -> return $ ufield 6 10 CA' -> return $ toBool $ testBit (xer m) (63 - 34) CIA -> return $ fromIntegral $ pc m CR' -> return $ fromIntegral $ cr m CRField i -> uniop (\ i -> fromIntegral $ shiftR (cr m) ((7 - fromIntegral i) * 4) .&. 0xFF) i CTR -> return $ fromIntegral $ ctr m D -> return $ sfield 16 31 EA -> return $ lookup' "EA" env EXTS n a -> uniop (\ a -> if testBit a (63 - n) then a .|. complement (setBits 0 [0 .. 63 - n]) else a .&. setBits 0 [0 .. 63 - n]) a GPR a -> uniop (\ a -> fromIntegral $ gprs m !! fromIntegral a) a L10 -> return $ bool 10 L15 -> return $ bool 15 LI -> return $ clearBits (sfield 6 31) [1, 0] LK -> return $ bool 31 LR -> return $ fromIntegral $ lr m MASK start stop -> binop (\ start stop -> setBits 0 [63 - fromIntegral stop .. 63 - fromIntegral start]) start stop MB5 -> return $ ufield 21 25 MB6 -> return $ ufield 21 26 ME5 -> return $ ufield 26 30 ME6 -> return $ ufield 21 26 MEM addr bytes -> do addr <- evalExpr (m, env) addr value <- load memory (fromIntegral addr) bytes return $ fromBytes value MSR -> readMSR memory >>= return . fromIntegral NIA -> return $ lookup' "NIA" env OE -> return $ bool 21 RAI -> return $ ufield 11 15 RA -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 11 15) RB -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 16 20) Rc -> return $ bool 31 ROTL32 a n -> binop (rotateLN 32) a n ROTL64 a n -> binop (rotateLN 64) a n RS -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 6 10) RSI -> return $ ufield 6 10 RT -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 6 10) RTI -> return $ ufield 6 10 SH5 -> return $ ufield 16 20 SH6 -> return $ shiftL (ufield 30 30) 5 .|. ufield 16 20 SI -> return $ sfield 16 31 SPR -> case spr of 1 -> return $ fromIntegral $ xer m 8 -> return $ fromIntegral $ lr m 9 -> return $ fromIntegral $ ctr m n -> readSPR memory n >>= return . fromIntegral UI -> return $ ufield 16 31 XER -> return $ fromIntegral $ xer m where binop :: (Integer -> Integer -> Integer) -> E -> E -> IO Integer binop f a b = do a <- evalExpr (m, env) a b <- evalExpr (m, env) b return $ f a b uniop :: (Integer -> Integer) -> E -> IO Integer uniop f a = do a <- evalExpr (m, env) a return $ f a spr :: Int spr = fromIntegral $ shiftL (ufield 16 20) 5 .|. ufield 11 15 toBool :: Bool -> Integer toBool True = 1 toBool False = 0 ufield :: Int -> Int -> Integer ufield h l = shiftR (fromIntegral instr) (31 - l) .&. setBits 0 [0 .. l - h] sfield :: Int -> Int -> Integer sfield h l = ufield h l .|. (if testBit instr (31 - h) then complement $ setBits 0 [0 .. l - h] else 0) bool :: Int -> Integer bool n = toBool $ testBit instr (31 - n) conditions :: (Machine, [(String, Integer)]) -> Integer -> [Cond] -> IO Machine conditions (m, env) value conds = do m <- foldM condition m $ sort conds return m where condition :: Machine -> Cond -> IO Machine condition n cond = case cond of CA c -> on c $ return n { xer = if isCA value then setBit (xer n) 29 else clearBit (xer n) 29 } OV c -> on c $ return n { xer = if isOV value then setBits (xer n) [31, 30] else clearBit (xer n) 30 } CR field c -> on c $ do field <- evalExpr (m, env) field let bits = [(0, isLT value), (1, isGT value), (2, isEQ value), (3, testBit (xer n) 31)] bitsToSet = map f [ n | (n, a) <- bits, a ] bitsToClear = map f [ n | (n, a) <- bits, not a ] f i = 31 - (i + 4 * fromIntegral field) return n { cr = clearBits (setBits (cr n) bitsToSet) bitsToClear } where on :: E -> IO Machine -> IO Machine on c action = do c <- evalExpr (m, env) c if c /= 0 then action else return n
7,797
step memory instr m = do (m, env) <- evalStmt (m, []) $ snd $ rtl (pc m) instr return m { pc = fromInteger $ lookup' "NIA" env } where evalStmt :: (Machine, [(String, Integer)]) -> Stmt -> IO (Machine, [(String, Integer)]) evalStmt (m, env) a = case a of Seq a -> foldM evalStmt (m, env) a If a b c -> do a <- evalExpr (m, env) a if a /= 0 then evalStmt (m, env) b else evalStmt (m, env) c While cond stmt -> do cond' <- evalExpr (m, env) cond if cond' == 0 then return (m, env) else do (m, env) <- evalStmt (m, env) stmt evalStmt (m, env) $ While cond stmt Assign cond a b -> do b <- evalExpr (m, env) b m <- conditions (m, env) b cond let b64 = fromIntegral b :: Word64 b32 = fromIntegral b :: Word32 case a of V n -> return (m, (n, b) : env) --CR CRField i -> do i <- evalExpr (m, env) i return (m { cr = shiftL (b32 .&. 0xFF) (fromIntegral $ (7 - i) * 4) .|. complement (shiftL 0xFF (fromIntegral $ (7 - i) * 4)) .&. (cr m) }, env) CTR -> return (m { ctr = b64 }, env) EA -> return (m, ("EA", b) : env) LR -> return (m { lr = b64 }, env) GPR n -> do n <- evalExpr (m, env) n return (m { gprs = replace (fromIntegral n) b64 (gprs m) }, env) MEM addr bytes -> do addr <- evalExpr (m, env) addr store memory (fromIntegral addr) $ toBytes bytes b return (m, env) MSR -> writeMSR memory b64 >> return (m, env) NIA -> return (m, ("NIA", b) : env) RA -> return (m { gprs = replace (ufield 11 15) b64 (gprs m) }, env) RT -> return (m { gprs = replace (ufield 6 10) b64 (gprs m) }, env) SPR -> case spr of 1 -> return (m { xer = b64 }, env) 8 -> return (m { lr = b64 }, env) 9 -> return (m { ctr = b64 }, env) n -> writeSPR memory n b64 >> return (m, env) XER -> return (m { xer = b64 }, env) Null -> return (m, env) _ -> error $ "Invalid assignment target: " ++ show a evalExpr :: (Machine, [(String, Integer)]) -> E -> IO Integer evalExpr (m, env) a = case a of V n -> return $ lookup' n env C a -> return $ a Add a b -> binop (+) a b Sub a b -> binop (-) a b Mul a b -> binop (*) a b Div a b -> binop div a b Not a -> uniop (toBool . (== 0)) a And a b -> binop (\ a b -> toBool $ a /= 0 && b /= 0) a b Or a b -> binop (\ a b -> toBool $ a /= 0 || b /= 0) a b BWNot a -> uniop complement a BWAnd a b -> binop (.&.) a b BWOr a b -> binop (.|.) a b Shift a b -> binop (\ a b -> shift a $ fromIntegral b) a b Eq a b -> binop (\ a b -> toBool $ a == b) a b Lt a b -> binop (\ a b -> toBool $ (fromIntegral a :: Word64) < (fromIntegral b :: Word64)) a b Null -> error "Invalid expressions: Null" Bit a w i -> binop (\ a i -> if i >= fromIntegral w then error "Bit: bit index greater than width" else toBool $ testBit a $ w - 1 - fromIntegral i) a i AA -> return $ bool 30 BA -> return $ ufield 11 15 BB -> return $ ufield 16 20 BD -> return $ clearBits (sfield 16 31) [1, 0] BF -> return $ ufield 6 8 BI -> return $ ufield 11 15 BO -> return $ ufield 6 10 BT -> return $ ufield 6 10 CA' -> return $ toBool $ testBit (xer m) (63 - 34) CIA -> return $ fromIntegral $ pc m CR' -> return $ fromIntegral $ cr m CRField i -> uniop (\ i -> fromIntegral $ shiftR (cr m) ((7 - fromIntegral i) * 4) .&. 0xFF) i CTR -> return $ fromIntegral $ ctr m D -> return $ sfield 16 31 EA -> return $ lookup' "EA" env EXTS n a -> uniop (\ a -> if testBit a (63 - n) then a .|. complement (setBits 0 [0 .. 63 - n]) else a .&. setBits 0 [0 .. 63 - n]) a GPR a -> uniop (\ a -> fromIntegral $ gprs m !! fromIntegral a) a L10 -> return $ bool 10 L15 -> return $ bool 15 LI -> return $ clearBits (sfield 6 31) [1, 0] LK -> return $ bool 31 LR -> return $ fromIntegral $ lr m MASK start stop -> binop (\ start stop -> setBits 0 [63 - fromIntegral stop .. 63 - fromIntegral start]) start stop MB5 -> return $ ufield 21 25 MB6 -> return $ ufield 21 26 ME5 -> return $ ufield 26 30 ME6 -> return $ ufield 21 26 MEM addr bytes -> do addr <- evalExpr (m, env) addr value <- load memory (fromIntegral addr) bytes return $ fromBytes value MSR -> readMSR memory >>= return . fromIntegral NIA -> return $ lookup' "NIA" env OE -> return $ bool 21 RAI -> return $ ufield 11 15 RA -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 11 15) RB -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 16 20) Rc -> return $ bool 31 ROTL32 a n -> binop (rotateLN 32) a n ROTL64 a n -> binop (rotateLN 64) a n RS -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 6 10) RSI -> return $ ufield 6 10 RT -> return $ fromIntegral $ gprs m !! fromIntegral (ufield 6 10) RTI -> return $ ufield 6 10 SH5 -> return $ ufield 16 20 SH6 -> return $ shiftL (ufield 30 30) 5 .|. ufield 16 20 SI -> return $ sfield 16 31 SPR -> case spr of 1 -> return $ fromIntegral $ xer m 8 -> return $ fromIntegral $ lr m 9 -> return $ fromIntegral $ ctr m n -> readSPR memory n >>= return . fromIntegral UI -> return $ ufield 16 31 XER -> return $ fromIntegral $ xer m where binop :: (Integer -> Integer -> Integer) -> E -> E -> IO Integer binop f a b = do a <- evalExpr (m, env) a b <- evalExpr (m, env) b return $ f a b uniop :: (Integer -> Integer) -> E -> IO Integer uniop f a = do a <- evalExpr (m, env) a return $ f a spr :: Int spr = fromIntegral $ shiftL (ufield 16 20) 5 .|. ufield 11 15 toBool :: Bool -> Integer toBool True = 1 toBool False = 0 ufield :: Int -> Int -> Integer ufield h l = shiftR (fromIntegral instr) (31 - l) .&. setBits 0 [0 .. l - h] sfield :: Int -> Int -> Integer sfield h l = ufield h l .|. (if testBit instr (31 - h) then complement $ setBits 0 [0 .. l - h] else 0) bool :: Int -> Integer bool n = toBool $ testBit instr (31 - n) conditions :: (Machine, [(String, Integer)]) -> Integer -> [Cond] -> IO Machine conditions (m, env) value conds = do m <- foldM condition m $ sort conds return m where condition :: Machine -> Cond -> IO Machine condition n cond = case cond of CA c -> on c $ return n { xer = if isCA value then setBit (xer n) 29 else clearBit (xer n) 29 } OV c -> on c $ return n { xer = if isOV value then setBits (xer n) [31, 30] else clearBit (xer n) 30 } CR field c -> on c $ do field <- evalExpr (m, env) field let bits = [(0, isLT value), (1, isGT value), (2, isEQ value), (3, testBit (xer n) 31)] bitsToSet = map f [ n | (n, a) <- bits, a ] bitsToClear = map f [ n | (n, a) <- bits, not a ] f i = 31 - (i + 4 * fromIntegral field) return n { cr = clearBits (setBits (cr n) bitsToSet) bitsToClear } where on :: E -> IO Machine -> IO Machine on c action = do c <- evalExpr (m, env) c if c /= 0 then action else return n
7,740
false
true
0
28
2,833
3,679
1,841
1,838
null
null
li-zhirui/EoplLangs
src/ImplicitRefs/Data.hs
bsd-3-clause
initEnvironment :: [(String, DenotedValue)] -> Environment initEnvironment = M.fromList
87
initEnvironment :: [(String, DenotedValue)] -> Environment initEnvironment = M.fromList
87
initEnvironment = M.fromList
28
false
true
0
7
8
26
15
11
null
null
seizans/ppl
Handler/Tag.hs
bsd-2-clause
putTagR :: TagId -> Handler () putTagR tagid = do param1 <- lookupPostParams "name" param2 <- lookupPostParams "location" liftIO $ do print param1 print param2 sendResponse ()
207
putTagR :: TagId -> Handler () putTagR tagid = do param1 <- lookupPostParams "name" param2 <- lookupPostParams "location" liftIO $ do print param1 print param2 sendResponse ()
207
putTagR tagid = do param1 <- lookupPostParams "name" param2 <- lookupPostParams "location" liftIO $ do print param1 print param2 sendResponse ()
176
false
true
0
10
58
70
29
41
null
null
teleshoes/taffybar
src/System/Taffybar/Widget/FreedesktopNotifications.hs
bsd-3-clause
startTimeoutThread :: NotifyState -> Notification -> IO () startTimeoutThread s Notification {..} = case noteExpireTimeout of Nothing -> return () Just timeout -> void $ forkIO $ do threadDelay (fromIntegral timeout * 10^(3 :: Int)) notePurge s noteId wakeupDisplayThread s --------------------------------------------------------------------------------
371
startTimeoutThread :: NotifyState -> Notification -> IO () startTimeoutThread s Notification {..} = case noteExpireTimeout of Nothing -> return () Just timeout -> void $ forkIO $ do threadDelay (fromIntegral timeout * 10^(3 :: Int)) notePurge s noteId wakeupDisplayThread s --------------------------------------------------------------------------------
371
startTimeoutThread s Notification {..} = case noteExpireTimeout of Nothing -> return () Just timeout -> void $ forkIO $ do threadDelay (fromIntegral timeout * 10^(3 :: Int)) notePurge s noteId wakeupDisplayThread s --------------------------------------------------------------------------------
312
false
true
4
12
57
111
51
60
null
null
TomMD/irc-core
driver/Main.hs
bsd-3-clause
doKnock :: Identifier {- ^ channel -} -> ClientState -> IO ClientState doKnock chan st | not available || not isChannel || inChannel = return st | otherwise = do clientSend (knockCmd chan) st return (clearInput st) where conn = view (clientServer0 . ccConnection) st available = view connKnock conn inChannel = has (connChannels . ix chan) conn isChannel = isChannelName chan conn
418
doKnock :: Identifier {- ^ channel -} -> ClientState -> IO ClientState doKnock chan st | not available || not isChannel || inChannel = return st | otherwise = do clientSend (knockCmd chan) st return (clearInput st) where conn = view (clientServer0 . ccConnection) st available = view connKnock conn inChannel = has (connChannels . ix chan) conn isChannel = isChannelName chan conn
418
doKnock chan st | not available || not isChannel || inChannel = return st | otherwise = do clientSend (knockCmd chan) st return (clearInput st) where conn = view (clientServer0 . ccConnection) st available = view connKnock conn inChannel = has (connChannels . ix chan) conn isChannel = isChannelName chan conn
342
false
true
1
10
100
144
68
76
null
null
osa1/chsc
Core/Prettify.hs
bsd-3-clause
prettifyTerm :: IdSupply -> InlineEnv -> In FVedTerm -> (OccursEnv, Out FVedTerm) prettifyTerm ids inline (rn, e) = second fvedTerm $ prettifyTerm' ids inline (rn, fvee e)
171
prettifyTerm :: IdSupply -> InlineEnv -> In FVedTerm -> (OccursEnv, Out FVedTerm) prettifyTerm ids inline (rn, e) = second fvedTerm $ prettifyTerm' ids inline (rn, fvee e)
171
prettifyTerm ids inline (rn, e) = second fvedTerm $ prettifyTerm' ids inline (rn, fvee e)
89
false
true
0
9
26
71
36
35
null
null
anttisalonen/freekick2
src/Match/State/MatchState.hs
gpl-3.0
homeplayers :: MatchState -> PlayerMap homeplayers = players . hometeam
71
homeplayers :: MatchState -> PlayerMap homeplayers = players . hometeam
71
homeplayers = players . hometeam
32
false
true
0
5
9
19
10
9
null
null
brendanhay/gogol
gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs
mpl-2.0
-- | List of detected click tags for assets. This is a read-only, -- auto-generated field. This field is empty for a rich media asset. camaClickTags :: Lens' CreativeAssetMetadata [ClickTag] camaClickTags = lens _camaClickTags (\ s a -> s{_camaClickTags = a}) . _Default . _Coerce
300
camaClickTags :: Lens' CreativeAssetMetadata [ClickTag] camaClickTags = lens _camaClickTags (\ s a -> s{_camaClickTags = a}) . _Default . _Coerce
165
camaClickTags = lens _camaClickTags (\ s a -> s{_camaClickTags = a}) . _Default . _Coerce
109
true
true
0
11
64
52
29
23
null
null
alephcloud/hs-connectivity-test
src/Network/ConnectivityTest.hs
mit
-- -------------------------------------------------------------------------- -- -- Connectivity Test -- TCP checkConnection ∷ ConnectionParams β†’ EitherT ConnectionFailure IO ConnectionResult checkConnection params@ConnectionParams{ cpTrace = True } = go mempty (Just 1) where go e ttl = catchT (run e ttl) $ \e0 β†’ if ttl == cpTtl params then left (e βŠ• e0) else go (e βŠ• e0) ((+ 1) <$> ttl) run e ttl = do result ← checkConnection params { cpTtl = ttl , cpTrace = False } return $ result { crTrace = Just e }
552
checkConnection ∷ ConnectionParams β†’ EitherT ConnectionFailure IO ConnectionResult checkConnection params@ConnectionParams{ cpTrace = True } = go mempty (Just 1) where go e ttl = catchT (run e ttl) $ \e0 β†’ if ttl == cpTtl params then left (e βŠ• e0) else go (e βŠ• e0) ((+ 1) <$> ttl) run e ttl = do result ← checkConnection params { cpTtl = ttl , cpTrace = False } return $ result { crTrace = Just e }
441
checkConnection params@ConnectionParams{ cpTrace = True } = go mempty (Just 1) where go e ttl = catchT (run e ttl) $ \e0 β†’ if ttl == cpTtl params then left (e βŠ• e0) else go (e βŠ• e0) ((+ 1) <$> ttl) run e ttl = do result ← checkConnection params { cpTtl = ttl , cpTrace = False } return $ result { crTrace = Just e }
358
true
true
3
11
129
200
97
103
null
null
luisnavarrodelangel/InnerEar
src/InnerEar/Exercises/OddEvenAll.hs
gpl-3.0
displayEval :: MonadWidget t m => Dynamic t (Map Answer Score) -> Dynamic t (MultipleChoiceStore Config Answer) -> m () displayEval e _ = displayMultipleChoiceEvaluationGraph ("scoreBarWrapperThreeBars","svgBarContainerThreeBars","svgFaintedLineThreeBars","xLabelThreeBars") "Session Performance" "" answers e
310
displayEval :: MonadWidget t m => Dynamic t (Map Answer Score) -> Dynamic t (MultipleChoiceStore Config Answer) -> m () displayEval e _ = displayMultipleChoiceEvaluationGraph ("scoreBarWrapperThreeBars","svgBarContainerThreeBars","svgFaintedLineThreeBars","xLabelThreeBars") "Session Performance" "" answers e
310
displayEval e _ = displayMultipleChoiceEvaluationGraph ("scoreBarWrapperThreeBars","svgBarContainerThreeBars","svgFaintedLineThreeBars","xLabelThreeBars") "Session Performance" "" answers e
190
false
true
0
10
31
87
43
44
null
null
energyflowanalysis/efa-2.1
src/EFA/Flow/EquationSystem.hs
bsd-3-clause
globalVariableFromResult :: (Verify.GlobalVar mode a (RecIdx.Record (Record.ToIndex rec) var), Sum a, Record rec, FormatValue var) => var -> rec (Result a) -> Writer mode s (SysRecord.Variable mode rec s a) globalVariableFromResult varIdx val = do var <- globalVariable varIdx tell (SysRecord.equalResult var val) return var
346
globalVariableFromResult :: (Verify.GlobalVar mode a (RecIdx.Record (Record.ToIndex rec) var), Sum a, Record rec, FormatValue var) => var -> rec (Result a) -> Writer mode s (SysRecord.Variable mode rec s a) globalVariableFromResult varIdx val = do var <- globalVariable varIdx tell (SysRecord.equalResult var val) return var
346
globalVariableFromResult varIdx val = do var <- globalVariable varIdx tell (SysRecord.equalResult var val) return var
126
false
true
0
11
66
137
65
72
null
null
olsner/ghc
compiler/cmm/PprC.hs
bsd-3-clause
isStrangeTypeReg (CmmGlobal g) = isStrangeTypeGlobal g
55
isStrangeTypeReg (CmmGlobal g) = isStrangeTypeGlobal g
55
isStrangeTypeReg (CmmGlobal g) = isStrangeTypeGlobal g
55
false
false
0
7
6
18
8
10
null
null
harendra-kumar/asyncly
test/Prop.hs
bsd-3-clause
singleton :: IsStream t => a -> t m a singleton a = a .: nil
60
singleton :: IsStream t => a -> t m a singleton a = a .: nil
60
singleton a = a .: nil
22
false
true
2
8
15
41
18
23
null
null
vikraman/ghc
compiler/prelude/THNames.hs
bsd-3-clause
valDIdKey = mkPreludeMiscIdUnique 321
53
valDIdKey = mkPreludeMiscIdUnique 321
53
valDIdKey = mkPreludeMiscIdUnique 321
53
false
false
0
5
19
9
4
5
null
null
flocknroll/haskell_cis194
H12/Risk.hs
mit
battle :: Battlefield -> Rand StdGen Battlefield battle bf = do let atk = maxAtk bf def = maxDef bf rollsAtk <- makeRolls atk rollsDef <- makeRolls def let res = calcDiff rollsAtk rollsDef return $ bf `mappend` res ----------------------------------------------------------
362
battle :: Battlefield -> Rand StdGen Battlefield battle bf = do let atk = maxAtk bf def = maxDef bf rollsAtk <- makeRolls atk rollsDef <- makeRolls def let res = calcDiff rollsAtk rollsDef return $ bf `mappend` res ----------------------------------------------------------
362
battle bf = do let atk = maxAtk bf def = maxDef bf rollsAtk <- makeRolls atk rollsDef <- makeRolls def let res = calcDiff rollsAtk rollsDef return $ bf `mappend` res ----------------------------------------------------------
313
false
true
0
10
128
96
43
53
null
null
nomeata/ghc
compiler/cmm/CLabel.hs
bsd-3-clause
isGcPtrLabel :: CLabel -> Bool isGcPtrLabel lbl = case labelType lbl of GcPtrLabel -> True _other -> False -- | Work out the general type of data at the address of this label -- whether it be code, data, or static GC object.
281
isGcPtrLabel :: CLabel -> Bool isGcPtrLabel lbl = case labelType lbl of GcPtrLabel -> True _other -> False -- | Work out the general type of data at the address of this label -- whether it be code, data, or static GC object.
281
isGcPtrLabel lbl = case labelType lbl of GcPtrLabel -> True _other -> False -- | Work out the general type of data at the address of this label -- whether it be code, data, or static GC object.
250
false
true
0
7
99
39
20
19
null
null
hargettp/courier
tests/TestUtils.hs
mit
newTCPAddress :: IO Name newTCPAddress = do NS.SockAddrInet p _ <- availablePort NS.AF_INET NS.Stream return $ Name $ "localhost:" ++ show p
144
newTCPAddress :: IO Name newTCPAddress = do NS.SockAddrInet p _ <- availablePort NS.AF_INET NS.Stream return $ Name $ "localhost:" ++ show p
144
newTCPAddress = do NS.SockAddrInet p _ <- availablePort NS.AF_INET NS.Stream return $ Name $ "localhost:" ++ show p
119
false
true
0
9
25
55
25
30
null
null
pranjaltale16/codeworld
codeworld-game-server/src/CodeWorld/GameServer.hs
apache-2.0
wsApp :: ServerState -> WS.ServerApp wsApp state pending = do conn <- WS.acceptRequest pending WS.forkPingThread conn 30 welcome conn state
151
wsApp :: ServerState -> WS.ServerApp wsApp state pending = do conn <- WS.acceptRequest pending WS.forkPingThread conn 30 welcome conn state
151
wsApp state pending = do conn <- WS.acceptRequest pending WS.forkPingThread conn 30 welcome conn state
114
false
true
0
10
31
58
24
34
null
null
beni55/haste-compiler
libraries/ghc-7.10/ghc-prim/GHC/Prim.hs
bsd-3-clause
-- | Reads vector; offset in scalar elements. readWord32OffAddrAsWord32X4# :: Addr# -> Int# -> State# s -> (# State# s,Word32X4# #) readWord32OffAddrAsWord32X4# = let x = x in x
179
readWord32OffAddrAsWord32X4# :: Addr# -> Int# -> State# s -> (# State# s,Word32X4# #) readWord32OffAddrAsWord32X4# = let x = x in x
131
readWord32OffAddrAsWord32X4# = let x = x in x
45
true
true
0
11
30
53
24
29
null
null
florianpilz/autotool
src/Rewriting/Check.hs
gpl-2.0
linear name t = do let vs = mehrfache_variablen t when ( not $ null vs ) $ reject $ vcat [ text "in diesem Term" <+> parens name , nest 4 $ toDoc t , text "kommen diese Variablen mehrfach vor:" , nest 4 $ toDoc vs ]
263
linear name t = do let vs = mehrfache_variablen t when ( not $ null vs ) $ reject $ vcat [ text "in diesem Term" <+> parens name , nest 4 $ toDoc t , text "kommen diese Variablen mehrfach vor:" , nest 4 $ toDoc vs ]
263
linear name t = do let vs = mehrfache_variablen t when ( not $ null vs ) $ reject $ vcat [ text "in diesem Term" <+> parens name , nest 4 $ toDoc t , text "kommen diese Variablen mehrfach vor:" , nest 4 $ toDoc vs ]
263
false
false
0
12
96
95
43
52
null
null
ryantm/ghc
compiler/main/DynFlags.hs
bsd-3-clause
noArg :: (DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags) noArg fn = NoArg (upd fn)
88
noArg :: (DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags) noArg fn = NoArg (upd fn)
88
noArg fn = NoArg (upd fn)
25
false
true
0
9
14
48
22
26
null
null
anton-k/language-css
src/Language/Css/Build/Idents.hs
bsd-3-clause
-- | margin-width marginWidth :: Idents a => a marginWidth = ident "margin-width"
81
marginWidth :: Idents a => a marginWidth = ident "margin-width"
63
marginWidth = ident "margin-width"
34
true
true
0
6
12
22
11
11
null
null
pascal-knodel/haskell-craft
_/links/E'6'23.hs
mit
------------ -- invertColour -- invertColour'R :: Picture'R -> Picture'R invertColour'R picture'R = map (map invert'R) picture'R
135
invertColour'R :: Picture'R -> Picture'R invertColour'R picture'R = map (map invert'R) picture'R
99
invertColour'R picture'R = map (map invert'R) picture'R
58
true
true
0
7
22
38
17
21
null
null
wei2912/counter
src/Data/Counter.hs
mit
union :: (Ord k, Num v) => Counter k v -- ^ First counter. -> Counter k v -- ^ Second counter. -> Counter k v -- ^ Union of both counters. union = M.unionWith (+)
178
union :: (Ord k, Num v) => Counter k v -- ^ First counter. -> Counter k v -- ^ Second counter. -> Counter k v union = M.unionWith (+)
149
union = M.unionWith (+)
23
true
true
0
9
51
61
31
30
null
null
melted/idris-java
src/IRTS/Java/JTypes.hs
bsd-3-clause
shortType :: J.Type shortType = PrimType ShortT
47
shortType :: J.Type shortType = PrimType ShortT
47
shortType = PrimType ShortT
27
false
true
0
7
6
23
9
14
null
null
keitax/lupo
src/Lupo/View.hs
lgpl-3.0
singleDayView :: E.Page -> N.Navigation (H.HeistT h h) -> E.Comment -> [T.Text] -> [T.Text] -> Getter (ViewFactory h) (View h) singleDayView p n c notice errs = to $ \self -> _singleDayView self p n c notice errs
214
singleDayView :: E.Page -> N.Navigation (H.HeistT h h) -> E.Comment -> [T.Text] -> [T.Text] -> Getter (ViewFactory h) (View h) singleDayView p n c notice errs = to $ \self -> _singleDayView self p n c notice errs
214
singleDayView p n c notice errs = to $ \self -> _singleDayView self p n c notice errs
87
false
true
0
12
39
110
55
55
null
null
bhamrick/HSS
HSS/Color.hs
mit
fireBrick = RGB 0xB2 0x22 0x22
44
fireBrick = RGB 0xB2 0x22 0x22
44
fireBrick = RGB 0xB2 0x22 0x22
44
false
false
0
5
19
13
6
7
null
null
davmre/matrizer
src/Matrizer/Derivatives.hs
gpl-2.0
reduceDifferential v (Branch2 MDiff a b) = let d1 = (reduceDifferential v a) d2 = (reduceDifferential v b) in case (d1, d2) of ( _, (ZeroLeaf _ _)) -> d1 ( (ZeroLeaf _ _), _) -> (Branch2 MScalarProduct (LiteralScalar (-1)) d2) ( _, _) -> (Branch2 MDiff d1 d2)
382
reduceDifferential v (Branch2 MDiff a b) = let d1 = (reduceDifferential v a) d2 = (reduceDifferential v b) in case (d1, d2) of ( _, (ZeroLeaf _ _)) -> d1 ( (ZeroLeaf _ _), _) -> (Branch2 MScalarProduct (LiteralScalar (-1)) d2) ( _, _) -> (Branch2 MDiff d1 d2)
382
reduceDifferential v (Branch2 MDiff a b) = let d1 = (reduceDifferential v a) d2 = (reduceDifferential v b) in case (d1, d2) of ( _, (ZeroLeaf _ _)) -> d1 ( (ZeroLeaf _ _), _) -> (Branch2 MScalarProduct (LiteralScalar (-1)) d2) ( _, _) -> (Branch2 MDiff d1 d2)
382
false
false
0
15
171
146
77
69
null
null
k16shikano/hpdft
hpdft.hs
mit
pageorder :: Int -> [PDFObj] -> PageTree pageorder parent objs = case findObjsByRef parent objs of Just os -> case findDictOfType "/Catalog" os of Just dict -> case findPages dict of Just pr -> pageorder pr objs Nothing -> Nop Nothing -> case findDictOfType "/Pages" os of Just dict -> case findKids dict of Just kidsrefs -> Pages $ map (\f -> f objs) (map pageorder kidsrefs) Nothing -> Nop Nothing -> case findDictOfType "/Page" os of Just dict -> Page parent Nothing -> Nop Nothing -> Nop
587
pageorder :: Int -> [PDFObj] -> PageTree pageorder parent objs = case findObjsByRef parent objs of Just os -> case findDictOfType "/Catalog" os of Just dict -> case findPages dict of Just pr -> pageorder pr objs Nothing -> Nop Nothing -> case findDictOfType "/Pages" os of Just dict -> case findKids dict of Just kidsrefs -> Pages $ map (\f -> f objs) (map pageorder kidsrefs) Nothing -> Nop Nothing -> case findDictOfType "/Page" os of Just dict -> Page parent Nothing -> Nop Nothing -> Nop
587
pageorder parent objs = case findObjsByRef parent objs of Just os -> case findDictOfType "/Catalog" os of Just dict -> case findPages dict of Just pr -> pageorder pr objs Nothing -> Nop Nothing -> case findDictOfType "/Pages" os of Just dict -> case findKids dict of Just kidsrefs -> Pages $ map (\f -> f objs) (map pageorder kidsrefs) Nothing -> Nop Nothing -> case findDictOfType "/Page" os of Just dict -> Page parent Nothing -> Nop Nothing -> Nop
546
false
true
0
21
183
209
96
113
null
null
brendanhay/gogol
gogol-iap/gen/Network/Google/IAP/Types/Product.hs
mpl-2.0
-- | Creates a value of 'IapSettings' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'isApplicationSettings' -- -- * 'isAccessSettings' -- -- * 'isName' iapSettings :: IapSettings iapSettings = IapSettings' { _isApplicationSettings = Nothing , _isAccessSettings = Nothing , _isName = Nothing }
401
iapSettings :: IapSettings iapSettings = IapSettings' { _isApplicationSettings = Nothing , _isAccessSettings = Nothing , _isName = Nothing }
162
iapSettings = IapSettings' { _isApplicationSettings = Nothing , _isAccessSettings = Nothing , _isName = Nothing }
131
true
true
0
6
82
40
28
12
null
null
ku-fpg/html-kure
Text/HTML/KURE.hs
bsd-3-clause
--------------------------------------- -- | Flatten into singleton HTMLs. The opposite of mconcat. unconcatHTML :: HTML -> [HTML] unconcatHTML (HTML ts) = map (\ t -> HTML [t]) ts
181
unconcatHTML :: HTML -> [HTML] unconcatHTML (HTML ts) = map (\ t -> HTML [t]) ts
80
unconcatHTML (HTML ts) = map (\ t -> HTML [t]) ts
49
true
true
0
9
27
52
27
25
null
null
albertov/hs-mapnik
bindings/src/Mapnik/Bindings/Symbolizer.hs
bsd-3-clause
defFromName "PolygonPatternSymbolizer" = Just Mapnik.polygonPatternSym
70
defFromName "PolygonPatternSymbolizer" = Just Mapnik.polygonPatternSym
70
defFromName "PolygonPatternSymbolizer" = Just Mapnik.polygonPatternSym
70
false
false
0
6
4
15
6
9
null
null
facebookincubator/duckling
Duckling/Time/KA/Corpus.hs
bsd-3-clause
latentCorpus :: Corpus latentCorpus = (testContext {locale = makeLocale KA Nothing}, testOptions {withLatent = True}, xs) where xs = concat [ examples (datetime (2013, 2, 24, 0, 0, 0) Day) [ "24 αƒ—αƒ”αƒ‘αƒ”αƒ αƒ•αƒαƒšαƒ‘" ] , examples (datetime (2013, 2, 12, 7, 0, 0) Hour) [ "7 ბაათზე" ] , examples (datetime (2013, 5, 1, 0, 0, 0) Month) [ "αƒ›αƒαƒ˜αƒ‘αƒ˜" ] ]
470
latentCorpus :: Corpus latentCorpus = (testContext {locale = makeLocale KA Nothing}, testOptions {withLatent = True}, xs) where xs = concat [ examples (datetime (2013, 2, 24, 0, 0, 0) Day) [ "24 αƒ—αƒ”αƒ‘αƒ”αƒ αƒ•αƒαƒšαƒ‘" ] , examples (datetime (2013, 2, 12, 7, 0, 0) Hour) [ "7 ბაათზე" ] , examples (datetime (2013, 5, 1, 0, 0, 0) Month) [ "αƒ›αƒαƒ˜αƒ‘αƒ˜" ] ]
470
latentCorpus = (testContext {locale = makeLocale KA Nothing}, testOptions {withLatent = True}, xs) where xs = concat [ examples (datetime (2013, 2, 24, 0, 0, 0) Day) [ "24 αƒ—αƒ”αƒ‘αƒ”αƒ αƒ•αƒαƒšαƒ‘" ] , examples (datetime (2013, 2, 12, 7, 0, 0) Hour) [ "7 ბაათზე" ] , examples (datetime (2013, 5, 1, 0, 0, 0) Month) [ "αƒ›αƒαƒ˜αƒ‘αƒ˜" ] ]
447
false
true
0
10
195
163
95
68
null
null
castaway/pandoc
src/Text/Pandoc/Pretty.hs
gpl-2.0
char :: Char -> Doc char c = text [c]
37
char :: Char -> Doc char c = text [c]
37
char c = text [c]
17
false
true
0
7
9
29
13
16
null
null
gnn/Hets
Maude/Maude2DG.hs
gpl-2.0
{- | instantiate a sort Params: Parameterized sort -> Parameter to be replaced -> New name of the parameter -} instantiateSort :: ParamSort -> [Token] -> [Token] -> ParamSort instantiateSort sp@(Sort tok, tok_params) (p : ps) (v : vs) = if notElem p tok_params then instantiateSort sp ps vs else let tok' = mkSimpleId $ instantiateSortString (show tok) (show p) (show v) in instantiateSort (Sort tok', tok_params) ps vs
429
instantiateSort :: ParamSort -> [Token] -> [Token] -> ParamSort instantiateSort sp@(Sort tok, tok_params) (p : ps) (v : vs) = if notElem p tok_params then instantiateSort sp ps vs else let tok' = mkSimpleId $ instantiateSortString (show tok) (show p) (show v) in instantiateSort (Sort tok', tok_params) ps vs
318
instantiateSort sp@(Sort tok, tok_params) (p : ps) (v : vs) = if notElem p tok_params then instantiateSort sp ps vs else let tok' = mkSimpleId $ instantiateSortString (show tok) (show p) (show v) in instantiateSort (Sort tok', tok_params) ps vs
254
true
true
1
13
78
149
73
76
null
null
cjp256/manager
xenmgr/Vm/React.hs
gpl-2.0
whenE :: VmEvent -> Vm () -> React whenE e f = mkReact $ \e' -> if (e == e') then f else return ()
100
whenE :: VmEvent -> Vm () -> React whenE e f = mkReact $ \e' -> if (e == e') then f else return ()
100
whenE e f = mkReact $ \e' -> if (e == e') then f else return ()
65
false
true
0
9
26
63
31
32
null
null