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
keithodulaigh/Hets
CSL/SMTComparison.hs
gpl-2.0
smtDisjStmt :: VarEnv -> String -> String -> String smtDisjStmt m a b = let vl = concatMap (" " ++) $ smtVars m "x" in concat ["(assert+ (and (", a, vl, ") (", b, vl, ")))"]
181
smtDisjStmt :: VarEnv -> String -> String -> String smtDisjStmt m a b = let vl = concatMap (" " ++) $ smtVars m "x" in concat ["(assert+ (and (", a, vl, ") (", b, vl, ")))"]
181
smtDisjStmt m a b = let vl = concatMap (" " ++) $ smtVars m "x" in concat ["(assert+ (and (", a, vl, ") (", b, vl, ")))"]
129
false
true
0
11
44
81
43
38
null
null
vikraman/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
ctLocTypeOrKind_maybe :: CtLoc -> Maybe TypeOrKind ctLocTypeOrKind_maybe = ctl_t_or_k
85
ctLocTypeOrKind_maybe :: CtLoc -> Maybe TypeOrKind ctLocTypeOrKind_maybe = ctl_t_or_k
85
ctLocTypeOrKind_maybe = ctl_t_or_k
34
false
true
0
7
8
24
10
14
null
null
vituscze/logic
src/Logic/Checked/Spec.hs
bsd-3-clause
bothMax BothS = BothBoth
30
bothMax BothS = BothBoth
30
bothMax BothS = BothBoth
30
false
false
0
4
9
10
4
6
null
null
kamilc/Snaplet-Tasks
src/Snap/Snaplet/Tasks.hs
bsd-3-clause
-- | This method spawns a new thread that waits till -- server is ready and then fires given task. tasksInit :: SnapletInit b TasksSnaplet tasksInit = makeSnaplet "tasks" "Snap Tasks" Nothing $ do liftIO $ do mtask <- taskFromCommandLine case mtask of Nothing -> return () Just task -> (forkIO $ runTask task) >> return () return $ TasksSnaplet
372
tasksInit :: SnapletInit b TasksSnaplet tasksInit = makeSnaplet "tasks" "Snap Tasks" Nothing $ do liftIO $ do mtask <- taskFromCommandLine case mtask of Nothing -> return () Just task -> (forkIO $ runTask task) >> return () return $ TasksSnaplet
271
tasksInit = makeSnaplet "tasks" "Snap Tasks" Nothing $ do liftIO $ do mtask <- taskFromCommandLine case mtask of Nothing -> return () Just task -> (forkIO $ runTask task) >> return () return $ TasksSnaplet
231
true
true
1
17
87
100
45
55
null
null
clample/lamdabtc
backend/src/General/Config.hs
bsd-3-clause
getOptions :: Config -> Options getOptions config = def { settings = getSettings (config^.port) , verbose = case config^.environment of Development -> 1 Production -> 0 Test -> 0 }
254
getOptions :: Config -> Options getOptions config = def { settings = getSettings (config^.port) , verbose = case config^.environment of Development -> 1 Production -> 0 Test -> 0 }
254
getOptions config = def { settings = getSettings (config^.port) , verbose = case config^.environment of Development -> 1 Production -> 0 Test -> 0 }
222
false
true
0
9
103
68
36
32
null
null
haskoin/secp256k1-haskell
src/Crypto/Secp256k1.hs
unlicense
signMsg :: SecKey -> Msg -> Sig signMsg (SecKey sec_key) (Msg m) = unsafePerformIO $ unsafeUseByteString sec_key $ \(sec_key_ptr, _) -> unsafeUseByteString m $ \(msg_ptr, _) -> do sig_ptr <- mallocBytes 64 ret <- ecdsaSign ctx sig_ptr msg_ptr sec_key_ptr nullFunPtr nullPtr unless (isSuccess ret) $ do free sig_ptr error "could not sign message" Sig <$> unsafePackByteString (sig_ptr, 64)
428
signMsg :: SecKey -> Msg -> Sig signMsg (SecKey sec_key) (Msg m) = unsafePerformIO $ unsafeUseByteString sec_key $ \(sec_key_ptr, _) -> unsafeUseByteString m $ \(msg_ptr, _) -> do sig_ptr <- mallocBytes 64 ret <- ecdsaSign ctx sig_ptr msg_ptr sec_key_ptr nullFunPtr nullPtr unless (isSuccess ret) $ do free sig_ptr error "could not sign message" Sig <$> unsafePackByteString (sig_ptr, 64)
428
signMsg (SecKey sec_key) (Msg m) = unsafePerformIO $ unsafeUseByteString sec_key $ \(sec_key_ptr, _) -> unsafeUseByteString m $ \(msg_ptr, _) -> do sig_ptr <- mallocBytes 64 ret <- ecdsaSign ctx sig_ptr msg_ptr sec_key_ptr nullFunPtr nullPtr unless (isSuccess ret) $ do free sig_ptr error "could not sign message" Sig <$> unsafePackByteString (sig_ptr, 64)
396
false
true
2
12
97
157
73
84
null
null
roman/Haskell-Reactive-Extensions
rx-core/test/Rx/Observable/FirstTest.hs
mit
tests :: Spec tests = do describe "Rx.Observable.once" $ do it "succeeds when source emits an element once" $ do let source = Rx.once $ return (10 :: Int) result <- Rx.toList source case result of Right v -> assertEqual "Expecting single element" [10] v Left err -> assertFailure $ "unexpected error: " ++ show err it "emits OnError when source emits more than one element" $ do let source = Rx.once $ Rx.fromList Rx.newThread ([1..10] :: [Int]) result <- Rx.toList source case result of Right v -> assertFailure $ "expected failure but didn't happen: " ++ show v Left (_, err) -> assertEqual "expecting once error but didn't receive it" (Just $ ErrorCall "once: expected to receive one element") (fromException err)
904
tests :: Spec tests = do describe "Rx.Observable.once" $ do it "succeeds when source emits an element once" $ do let source = Rx.once $ return (10 :: Int) result <- Rx.toList source case result of Right v -> assertEqual "Expecting single element" [10] v Left err -> assertFailure $ "unexpected error: " ++ show err it "emits OnError when source emits more than one element" $ do let source = Rx.once $ Rx.fromList Rx.newThread ([1..10] :: [Int]) result <- Rx.toList source case result of Right v -> assertFailure $ "expected failure but didn't happen: " ++ show v Left (_, err) -> assertEqual "expecting once error but didn't receive it" (Just $ ErrorCall "once: expected to receive one element") (fromException err)
904
tests = do describe "Rx.Observable.once" $ do it "succeeds when source emits an element once" $ do let source = Rx.once $ return (10 :: Int) result <- Rx.toList source case result of Right v -> assertEqual "Expecting single element" [10] v Left err -> assertFailure $ "unexpected error: " ++ show err it "emits OnError when source emits more than one element" $ do let source = Rx.once $ Rx.fromList Rx.newThread ([1..10] :: [Int]) result <- Rx.toList source case result of Right v -> assertFailure $ "expected failure but didn't happen: " ++ show v Left (_, err) -> assertEqual "expecting once error but didn't receive it" (Just $ ErrorCall "once: expected to receive one element") (fromException err)
890
false
true
0
20
309
245
113
132
null
null
nikita-volkov/hasql
library/Hasql/Private/Decoders.hs
mit
{-| Given a partial mapping from text to value, produces a decoder of that value. -} enum :: (Text -> Maybe a) -> Value a enum mapping = Value (Value.decoder (const (A.enum mapping)))
183
enum :: (Text -> Maybe a) -> Value a enum mapping = Value (Value.decoder (const (A.enum mapping)))
98
enum mapping = Value (Value.decoder (const (A.enum mapping)))
61
true
true
0
12
32
57
28
29
null
null
wavewave/lhc-analysis-collection
exe/2013-07-22-SimplifiedSUSYlep.hs
gpl-3.0
mprocs = mkMultiProc pdir [sproc]
33
mprocs = mkMultiProc pdir [sproc]
33
mprocs = mkMultiProc pdir [sproc]
33
false
false
0
6
4
14
7
7
null
null
snoyberg/data-object-json
runtests.hs
bsd-2-clause
main :: IO () main = defaultMain [ testCase "caseInputOutput" caseInputOutput , testProperty "propInputOutput" propInputOutput , testProperty "propShowSignedInt" propShowSignedInt ]
197
main :: IO () main = defaultMain [ testCase "caseInputOutput" caseInputOutput , testProperty "propInputOutput" propInputOutput , testProperty "propShowSignedInt" propShowSignedInt ]
197
main = defaultMain [ testCase "caseInputOutput" caseInputOutput , testProperty "propInputOutput" propInputOutput , testProperty "propShowSignedInt" propShowSignedInt ]
183
false
true
0
6
35
43
21
22
null
null
mdsteele/fallback
src/Fallback/State/Item.hs
gpl-3.0
getAccessoryData GroundedCharm = ArmorData { adBonuses = sumBonuses [ResistEnergy +% 25], adUsableBy = anyone }
117
getAccessoryData GroundedCharm = ArmorData { adBonuses = sumBonuses [ResistEnergy +% 25], adUsableBy = anyone }
117
getAccessoryData GroundedCharm = ArmorData { adBonuses = sumBonuses [ResistEnergy +% 25], adUsableBy = anyone }
117
false
false
1
10
20
40
19
21
null
null
wavewave/madgraph-auto-dataset
src/HEP/Automation/MadGraph/Dataset/Set20110702set3.hs
gpl-3.0
psetuplist :: [ProcessSetup ZpH ] psetuplist = [ psetup_zph_TTBar0or1J ]
72
psetuplist :: [ProcessSetup ZpH ] psetuplist = [ psetup_zph_TTBar0or1J ]
72
psetuplist = [ psetup_zph_TTBar0or1J ]
38
false
true
0
6
9
20
11
9
null
null
jaspervdj/b-tree
src/Data/BTree/Internal.hs
bsd-3-clause
-- | Maximum number of keys per node maxNodeSize :: Int maxNodeSize = 8
71
maxNodeSize :: Int maxNodeSize = 8
34
maxNodeSize = 8
15
true
true
0
4
13
12
7
5
null
null
haskell-distributed/distributed-process-platform
src/Control/Distributed/Process/Platform/Execution/Exchange/Internal.hs
bsd-3-clause
-- | Utility for custom exchange type authors - evaluates a set of primitive -- message handlers from left to right, returning the first which evaluates -- to @Just a@, or the initial @e@ value if all the handlers yield @Nothing@. applyHandlers :: a -> P.Message -> [P.Message -> Process (Maybe a)] -> Process a applyHandlers e _ [] = return e
389
applyHandlers :: a -> P.Message -> [P.Message -> Process (Maybe a)] -> Process a applyHandlers e _ [] = return e
158
applyHandlers e _ [] = return e
35
true
true
0
13
107
66
32
34
null
null
mightymoose/liquidhaskell
tests/pos/RBTree-height.hs
bsd-3-clause
-------------------------------------------------------------------------- -- | Delete Minimum Element ----------------------------------------------- --------------------------------------------------------------------------- {-@ deleteMin :: RBT a -> RBT a @-} deleteMin (Leaf) = Leaf
307
deleteMin (Leaf) = Leaf
31
deleteMin (Leaf) = Leaf
31
true
false
0
6
41
16
10
6
null
null
stevely/DumpTruck
src/Web/DumpTruck/RequestData.hs
bsd-3-clause
parserToReqData :: Parser a -> RequestData a parserToReqData p = RequestData go where go _ _ _ = Incomplete (resultToReqData . parse p) resultToReqData :: Result a -> RequestData a resultToReqData res = case res of Fail _ _ _ -> empty Done _ a -> pure a Partial c -> RequestData (\_ _ _ -> Incomplete (resultToReqData . c)) -- | Given a 'Request', runs a 'RequestData' action. If the 'RequestData' action -- fails then it will return 'Nothing', otherwise it will produce a value of the -- appropriate type.
545
parserToReqData :: Parser a -> RequestData a parserToReqData p = RequestData go where go _ _ _ = Incomplete (resultToReqData . parse p) resultToReqData :: Result a -> RequestData a resultToReqData res = case res of Fail _ _ _ -> empty Done _ a -> pure a Partial c -> RequestData (\_ _ _ -> Incomplete (resultToReqData . c)) -- | Given a 'Request', runs a 'RequestData' action. If the 'RequestData' action -- fails then it will return 'Nothing', otherwise it will produce a value of the -- appropriate type.
545
parserToReqData p = RequestData go where go _ _ _ = Incomplete (resultToReqData . parse p) resultToReqData :: Result a -> RequestData a resultToReqData res = case res of Fail _ _ _ -> empty Done _ a -> pure a Partial c -> RequestData (\_ _ _ -> Incomplete (resultToReqData . c)) -- | Given a 'Request', runs a 'RequestData' action. If the 'RequestData' action -- fails then it will return 'Nothing', otherwise it will produce a value of the -- appropriate type.
500
false
true
6
8
129
135
70
65
null
null
cauterize-tools/caut-ghc7-ref
lib/Cauterize/GHC7/Support/Result.hs
bsd-3-clause
withTrace :: (MonadTrans t, Monad (t CautResult), MFunctor t) => Trace -> t CautResult a -> t CautResult a withTrace trace = hoist (CautResult . local (trace:) . unCautResult)
185
withTrace :: (MonadTrans t, Monad (t CautResult), MFunctor t) => Trace -> t CautResult a -> t CautResult a withTrace trace = hoist (CautResult . local (trace:) . unCautResult)
185
withTrace trace = hoist (CautResult . local (trace:) . unCautResult)
68
false
true
0
10
38
83
41
42
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/book/2021-05-06-Algebra_Driven_Design-Sandy_Maguire/src/Lib.hs
unlicense
{- each color should be in closed interval [0,1]. nothing in the typesystem requires this to be the case, so we will need to constrain it with a law: ∀ (r :: Double) (g :: Double) (b :: Double) (a :: Double). color r g b a = color (clamp 0 1 r) (clamp 0 1 g) (clamp 0 1 b) (clamp 0 1 a) All terms in an algebra are built from - terminal constructors, and - inductive constructors - ones which "derive" new terms based on existing terms -} -- inductive -- rotate 90 degress C(lock)W(ise) cw :: Tile -> Tile cw = undefined
568
cw :: Tile -> Tile cw = undefined
34
cw = undefined
15
true
true
0
7
153
25
12
13
null
null
trbauer/hrun
HRun.hs
mit
-- TODO: -- * control-break kills the child, need to block that signal somehow -- - Print better process info (memory, dlls, etc...) -- - Use dbghelp.dll to walk the stacks -- * take snapshots as the process runs and record process info every few seconds -- emit a console graph of the memory usage etc... printUsage = putStrLn usage
359
printUsage = putStrLn usage
27
printUsage = putStrLn usage
27
true
false
1
5
85
19
10
9
null
null
nbrunt/JSHOP
src/old/ver2/Test.hs
mit
parseProgram :: String -> Either String (Program, LexerState) parseProgram str = runIdentity $ runErrorT $ runStateT parse (startState str)
143
parseProgram :: String -> Either String (Program, LexerState) parseProgram str = runIdentity $ runErrorT $ runStateT parse (startState str)
143
parseProgram str = runIdentity $ runErrorT $ runStateT parse (startState str)
81
false
true
0
8
22
48
24
24
null
null
achernyak/stack
src/Stack/BuildPlan.hs
bsd-3-clause
checkSnapBuildPlan :: ( MonadIO m, MonadCatch m, MonadLogger m, MonadReader env m , HasHttpManager env, HasConfig env, HasGHCVariant env , MonadBaseControl IO m) => [GenericPackageDescription] -> Maybe (Map PackageName (Map FlagName Bool)) -> SnapName -> m BuildPlanCheck checkSnapBuildPlan gpds flags snap = do platform <- asks (configPlatform . getConfig) mbp <- loadMiniBuildPlan snap let compiler = mbpCompilerVersion mbp snapPkgs = fmap mpiVersion $ mbpPackages mbp (f, errs) = checkBundleBuildPlan platform compiler snapPkgs flags gpds cerrs = compilerErrors compiler errs if Map.null errs then return $ BuildPlanCheckOk f else if Map.null cerrs then do return $ BuildPlanCheckPartial f errs else return $ BuildPlanCheckFail f cerrs compiler where compilerErrors compiler errs | whichCompiler compiler == Ghc = ghcErrors errs -- FIXME not sure how to handle ghcjs boot packages | otherwise = Map.empty isGhcWiredIn p _ = p `HashSet.member` wiredInPackages ghcErrors = Map.filterWithKey isGhcWiredIn -- | Find a snapshot and set of flags that is compatible with and matches as -- best as possible with the given 'GenericPackageDescription's. Returns -- 'Nothing' if no such snapshot is found.
1,391
checkSnapBuildPlan :: ( MonadIO m, MonadCatch m, MonadLogger m, MonadReader env m , HasHttpManager env, HasConfig env, HasGHCVariant env , MonadBaseControl IO m) => [GenericPackageDescription] -> Maybe (Map PackageName (Map FlagName Bool)) -> SnapName -> m BuildPlanCheck checkSnapBuildPlan gpds flags snap = do platform <- asks (configPlatform . getConfig) mbp <- loadMiniBuildPlan snap let compiler = mbpCompilerVersion mbp snapPkgs = fmap mpiVersion $ mbpPackages mbp (f, errs) = checkBundleBuildPlan platform compiler snapPkgs flags gpds cerrs = compilerErrors compiler errs if Map.null errs then return $ BuildPlanCheckOk f else if Map.null cerrs then do return $ BuildPlanCheckPartial f errs else return $ BuildPlanCheckFail f cerrs compiler where compilerErrors compiler errs | whichCompiler compiler == Ghc = ghcErrors errs -- FIXME not sure how to handle ghcjs boot packages | otherwise = Map.empty isGhcWiredIn p _ = p `HashSet.member` wiredInPackages ghcErrors = Map.filterWithKey isGhcWiredIn -- | Find a snapshot and set of flags that is compatible with and matches as -- best as possible with the given 'GenericPackageDescription's. Returns -- 'Nothing' if no such snapshot is found.
1,391
checkSnapBuildPlan gpds flags snap = do platform <- asks (configPlatform . getConfig) mbp <- loadMiniBuildPlan snap let compiler = mbpCompilerVersion mbp snapPkgs = fmap mpiVersion $ mbpPackages mbp (f, errs) = checkBundleBuildPlan platform compiler snapPkgs flags gpds cerrs = compilerErrors compiler errs if Map.null errs then return $ BuildPlanCheckOk f else if Map.null cerrs then do return $ BuildPlanCheckPartial f errs else return $ BuildPlanCheckFail f cerrs compiler where compilerErrors compiler errs | whichCompiler compiler == Ghc = ghcErrors errs -- FIXME not sure how to handle ghcjs boot packages | otherwise = Map.empty isGhcWiredIn p _ = p `HashSet.member` wiredInPackages ghcErrors = Map.filterWithKey isGhcWiredIn -- | Find a snapshot and set of flags that is compatible with and matches as -- best as possible with the given 'GenericPackageDescription's. Returns -- 'Nothing' if no such snapshot is found.
1,085
false
true
0
12
368
327
160
167
null
null
karamellpelle/grid
source/Game/Grid/Modify.hs
gpl-3.0
inputCamera :: GridWorld -> MEnv' GridWorld inputCamera grid = do gridModifyCameraM grid $ \camera -> do -- save current view camera' <- keysTouchHandleCircleTouched camera $ \_ _ -> let View a b c = cameraCurrentView camera in camera { -- current view cameraView = View a b c, cameraViewIdeal = View (a + 1.0) (b + 1.0) (c + 1.0), cameraViewAAlpha = 0.0, cameraViewAAlphaIdeal = 0.0, cameraViewASpeed = valueGridCameraViewASpeed, cameraViewBAlpha = 0.0, cameraViewBAlphaIdeal = 0.0, cameraViewBSpeed = valueGridCameraViewBSpeed, cameraViewCAlpha = 0.0, cameraViewCAlphaIdeal = 0.0, cameraViewCSpeed = valueGridCameraViewCSpeed } -- move camera keysTouchHandleCircleDrag camera' $ \ticks (x, y) r (x', y') r' -> let View a b c = cameraView camera' aAlphaIdeal = (x' - x) * valueGridCameraViewASens bAlphaIdeal = keepInside (bMin - b) (bMax - b) ((y' - y) * valueGridCameraViewBSens) cAlphaIdeal = keepInside (valueGridCameraViewCMin - c) (valueGridCameraViewCMax - c) ((r - r') * valueGridCameraViewCSens) in camera' { cameraViewAAlphaIdeal = aAlphaIdeal, cameraViewBAlphaIdeal = bAlphaIdeal, cameraViewCAlphaIdeal = cAlphaIdeal } where gridModifyCameraM grid f = do cam' <- f $ gridCamera grid return grid { gridCamera = cam' } bMin = (-0.249 * tau) bMax = 0.249 * tau -- | input for a Path waiting at each Node
2,005
inputCamera :: GridWorld -> MEnv' GridWorld inputCamera grid = do gridModifyCameraM grid $ \camera -> do -- save current view camera' <- keysTouchHandleCircleTouched camera $ \_ _ -> let View a b c = cameraCurrentView camera in camera { -- current view cameraView = View a b c, cameraViewIdeal = View (a + 1.0) (b + 1.0) (c + 1.0), cameraViewAAlpha = 0.0, cameraViewAAlphaIdeal = 0.0, cameraViewASpeed = valueGridCameraViewASpeed, cameraViewBAlpha = 0.0, cameraViewBAlphaIdeal = 0.0, cameraViewBSpeed = valueGridCameraViewBSpeed, cameraViewCAlpha = 0.0, cameraViewCAlphaIdeal = 0.0, cameraViewCSpeed = valueGridCameraViewCSpeed } -- move camera keysTouchHandleCircleDrag camera' $ \ticks (x, y) r (x', y') r' -> let View a b c = cameraView camera' aAlphaIdeal = (x' - x) * valueGridCameraViewASens bAlphaIdeal = keepInside (bMin - b) (bMax - b) ((y' - y) * valueGridCameraViewBSens) cAlphaIdeal = keepInside (valueGridCameraViewCMin - c) (valueGridCameraViewCMax - c) ((r - r') * valueGridCameraViewCSens) in camera' { cameraViewAAlphaIdeal = aAlphaIdeal, cameraViewBAlphaIdeal = bAlphaIdeal, cameraViewCAlphaIdeal = cAlphaIdeal } where gridModifyCameraM grid f = do cam' <- f $ gridCamera grid return grid { gridCamera = cam' } bMin = (-0.249 * tau) bMax = 0.249 * tau -- | input for a Path waiting at each Node
2,005
inputCamera grid = do gridModifyCameraM grid $ \camera -> do -- save current view camera' <- keysTouchHandleCircleTouched camera $ \_ _ -> let View a b c = cameraCurrentView camera in camera { -- current view cameraView = View a b c, cameraViewIdeal = View (a + 1.0) (b + 1.0) (c + 1.0), cameraViewAAlpha = 0.0, cameraViewAAlphaIdeal = 0.0, cameraViewASpeed = valueGridCameraViewASpeed, cameraViewBAlpha = 0.0, cameraViewBAlphaIdeal = 0.0, cameraViewBSpeed = valueGridCameraViewBSpeed, cameraViewCAlpha = 0.0, cameraViewCAlphaIdeal = 0.0, cameraViewCSpeed = valueGridCameraViewCSpeed } -- move camera keysTouchHandleCircleDrag camera' $ \ticks (x, y) r (x', y') r' -> let View a b c = cameraView camera' aAlphaIdeal = (x' - x) * valueGridCameraViewASens bAlphaIdeal = keepInside (bMin - b) (bMax - b) ((y' - y) * valueGridCameraViewBSens) cAlphaIdeal = keepInside (valueGridCameraViewCMin - c) (valueGridCameraViewCMax - c) ((r - r') * valueGridCameraViewCSens) in camera' { cameraViewAAlphaIdeal = aAlphaIdeal, cameraViewBAlphaIdeal = bAlphaIdeal, cameraViewCAlphaIdeal = cAlphaIdeal } where gridModifyCameraM grid f = do cam' <- f $ gridCamera grid return grid { gridCamera = cam' } bMin = (-0.249 * tau) bMax = 0.249 * tau -- | input for a Path waiting at each Node
1,961
false
true
3
21
889
435
230
205
null
null
basvandijk/binary
src/Data/Binary/Builder/Base.hs
bsd-3-clause
shiftr_w16 (W16# w) (I# i) = W16# (w `uncheckedShiftRL#` i)
61
shiftr_w16 (W16# w) (I# i) = W16# (w `uncheckedShiftRL#` i)
61
shiftr_w16 (W16# w) (I# i) = W16# (w `uncheckedShiftRL#` i)
61
false
false
0
7
11
35
18
17
null
null
jac3km4/haskit
src/Haskit/CodeGen.hs
mit
expr :: P.Expr -> CodeGen Var expr (P.Constant (P.Ident ident)) = getSym ident
78
expr :: P.Expr -> CodeGen Var expr (P.Constant (P.Ident ident)) = getSym ident
78
expr (P.Constant (P.Ident ident)) = getSym ident
48
false
true
0
10
12
42
20
22
null
null
cleichner/gitit
src/Network/Gitit/Feed.hs
gpl-2.0
formatFeedTime :: UTCTime -> String formatFeedTime = formatTime defaultTimeLocale "%FT%TZ"
90
formatFeedTime :: UTCTime -> String formatFeedTime = formatTime defaultTimeLocale "%FT%TZ"
90
formatFeedTime = formatTime defaultTimeLocale "%FT%TZ"
54
false
true
0
7
9
26
11
15
null
null
Blaisorblade/pts
src-lib/PTS/Options.hs
bsd-3-clause
processFlags opt (Flag f : flags) = processFlags (f opt) flags
66
processFlags opt (Flag f : flags) = processFlags (f opt) flags
66
processFlags opt (Flag f : flags) = processFlags (f opt) flags
66
false
false
0
8
14
32
15
17
null
null
colah/ImplicitCAD
programs/docgen.hs
agpl-3.0
getArgParserDocs (APExample str child) = do childResults <- getArgParserDocs child return $ ExampleDoc (unpack str):childResults -- We try to look at as little as possible, to avoid the risk of triggering an error. -- Yay laziness!
236
getArgParserDocs (APExample str child) = do childResults <- getArgParserDocs child return $ ExampleDoc (unpack str):childResults -- We try to look at as little as possible, to avoid the risk of triggering an error. -- Yay laziness!
236
getArgParserDocs (APExample str child) = do childResults <- getArgParserDocs child return $ ExampleDoc (unpack str):childResults -- We try to look at as little as possible, to avoid the risk of triggering an error. -- Yay laziness!
236
false
false
0
11
40
50
23
27
null
null
rickyhan/rbtree
src/rbtree.hs
mit
showSet' pref (Node k h l x r) = show k ++ " " ++ show x ++ " (" ++ show h ++ ")\n" ++ pref ++ "+ " ++ showSet' pref' l ++ pref ++ "+ " ++ showSet' pref' r where pref' = " " ++ pref
248
showSet' pref (Node k h l x r) = show k ++ " " ++ show x ++ " (" ++ show h ++ ")\n" ++ pref ++ "+ " ++ showSet' pref' l ++ pref ++ "+ " ++ showSet' pref' r where pref' = " " ++ pref
248
showSet' pref (Node k h l x r) = show k ++ " " ++ show x ++ " (" ++ show h ++ ")\n" ++ pref ++ "+ " ++ showSet' pref' l ++ pref ++ "+ " ++ showSet' pref' r where pref' = " " ++ pref
248
false
false
0
16
116
100
47
53
null
null
acowley/ghc
compiler/main/DynFlags.hs
bsd-3-clause
checkOptLevel :: Int -> DynFlags -> Either String DynFlags checkOptLevel n dflags | hscTarget dflags == HscInterpreted && n > 0 = Left "-O conflicts with --interactive; -O ignored." | otherwise = Right dflags
224
checkOptLevel :: Int -> DynFlags -> Either String DynFlags checkOptLevel n dflags | hscTarget dflags == HscInterpreted && n > 0 = Left "-O conflicts with --interactive; -O ignored." | otherwise = Right dflags
224
checkOptLevel n dflags | hscTarget dflags == HscInterpreted && n > 0 = Left "-O conflicts with --interactive; -O ignored." | otherwise = Right dflags
165
false
true
0
11
49
72
31
41
null
null
sdiehl/protolude
src/Protolude/Functor.hs
mit
foreach :: Functor f => f a -> (a -> b) -> f b foreach = flip fmap
66
foreach :: Functor f => f a -> (a -> b) -> f b foreach = flip fmap
66
foreach = flip fmap
19
false
true
0
10
17
48
21
27
null
null
xmonad/xmonad-contrib
XMonad/Prompt/Window.hs
bsd-3-clause
windowMultiPrompt :: XPConfig -> [(WindowPrompt, XWindowMap)] -> X () windowMultiPrompt c modes = do modes' <- forM modes $ \(t, wm) -> do wm' <- wm return . XPT $ WindowModePrompt t wm' (searchPredicate c) mkXPromptWithModes modes' c -- | Brings a copy of the specified window into the current workspace.
319
windowMultiPrompt :: XPConfig -> [(WindowPrompt, XWindowMap)] -> X () windowMultiPrompt c modes = do modes' <- forM modes $ \(t, wm) -> do wm' <- wm return . XPT $ WindowModePrompt t wm' (searchPredicate c) mkXPromptWithModes modes' c -- | Brings a copy of the specified window into the current workspace.
319
windowMultiPrompt c modes = do modes' <- forM modes $ \(t, wm) -> do wm' <- wm return . XPT $ WindowModePrompt t wm' (searchPredicate c) mkXPromptWithModes modes' c -- | Brings a copy of the specified window into the current workspace.
249
false
true
0
15
64
103
51
52
null
null
piyush-kurur/shakespeare
shakespeare-css/test/ShakespeareCssTest.hs
bsd-2-clause
encodeUrlChar c@'.' = [c]
25
encodeUrlChar c@'.' = [c]
25
encodeUrlChar c@'.' = [c]
25
false
false
1
5
3
20
8
12
null
null
haskell-distributed/distributed-process
src/Control/Distributed/Process/Management/Internal/Trace/Primitives.hs
bsd-3-clause
withLocalTracer :: (MxEventBus -> Process ()) -> Process () withLocalTracer act = do node <- processNode <$> ask act (localEventBus node)
141
withLocalTracer :: (MxEventBus -> Process ()) -> Process () withLocalTracer act = do node <- processNode <$> ask act (localEventBus node)
141
withLocalTracer act = do node <- processNode <$> ask act (localEventBus node)
81
false
true
0
9
24
58
27
31
null
null
HIPERFIT/futhark
src/Futhark/CodeGen/ImpGen/Multicore/SegScan.hs
isc
yParams scan = drop (length (segBinOpNeutral scan)) (lambdaParams (segBinOpLambda scan))
90
yParams scan = drop (length (segBinOpNeutral scan)) (lambdaParams (segBinOpLambda scan))
90
yParams scan = drop (length (segBinOpNeutral scan)) (lambdaParams (segBinOpLambda scan))
90
false
false
1
9
11
42
18
24
null
null
JacquesCarette/literate-scientific-software
code/drasil-printers/Language/Drasil/TeX/Print.hs
bsd-2-clause
------------------ Spec ----------------------------------- needs :: Spec -> MathContext needs (a :+: b) = needs a `lub` needs b
129
needs :: Spec -> MathContext needs (a :+: b) = needs a `lub` needs b
68
needs (a :+: b) = needs a `lub` needs b
39
true
true
0
9
18
43
21
22
null
null
spinda/liquidhaskell
src/Language/Haskell/Liquid/DiffCheck.hs
bsd-3-clause
exprSpans (Var x) = [getSrcSpan x]
42
exprSpans (Var x) = [getSrcSpan x]
42
exprSpans (Var x) = [getSrcSpan x]
42
false
false
0
7
13
21
10
11
null
null
vincenthz/hs-crypto-numbers
Tests/RNG.hs
bsd-2-clause
getByte :: Rng -> (Word8, Rng) getByte (Rng (mz, mw)) = (r, g) where mz2 = 36969 * (mz `mod` 65536) mw2 = 18070 * (mw `mod` 65536) r = fromIntegral (mz2 + mw2) g = Rng (mz2, mw2)
216
getByte :: Rng -> (Word8, Rng) getByte (Rng (mz, mw)) = (r, g) where mz2 = 36969 * (mz `mod` 65536) mw2 = 18070 * (mw `mod` 65536) r = fromIntegral (mz2 + mw2) g = Rng (mz2, mw2)
216
getByte (Rng (mz, mw)) = (r, g) where mz2 = 36969 * (mz `mod` 65536) mw2 = 18070 * (mw `mod` 65536) r = fromIntegral (mz2 + mw2) g = Rng (mz2, mw2)
185
false
true
6
10
76
129
64
65
null
null
gbataille/pandoc
src/Text/Pandoc/Writers/ConTeXt.hs
gpl-2.0
-- | Sanitize labels toLabel :: String -> String toLabel z = concatMap go z where go x | elem x ("\\#[]\",{}%()|=" :: String) = "ux" ++ printf "%x" (ord x) | otherwise = [x] -- | Convert Elements to ConTeXt
226
toLabel :: String -> String toLabel z = concatMap go z where go x | elem x ("\\#[]\",{}%()|=" :: String) = "ux" ++ printf "%x" (ord x) | otherwise = [x] -- | Convert Elements to ConTeXt
205
toLabel z = concatMap go z where go x | elem x ("\\#[]\",{}%()|=" :: String) = "ux" ++ printf "%x" (ord x) | otherwise = [x] -- | Convert Elements to ConTeXt
177
true
true
0
9
60
79
39
40
null
null
simpss/hirc
ConvertConf.hs
gpl-3.0
str [] = "[]"
13
str [] = "[]"
13
str [] = "[]"
13
false
false
1
5
3
15
5
10
null
null
ganeti/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
-- | Parameters that should be protected -- -- Python does not have a type system and can't automatically infer what should -- be the resulting type of a JSON request. As a result, it must rely on this -- list of parameter names to protect values correctly. -- -- Names ending in _cluster will be treated as dicts of dicts of private values. -- Otherwise they are considered dicts of private values. privateParametersBlacklist :: [String] privateParametersBlacklist = [ "osparams_private" , "osparams_secret" , "osparams_private_cluster" ]
626
privateParametersBlacklist :: [String] privateParametersBlacklist = [ "osparams_private" , "osparams_secret" , "osparams_private_cluster" ]
226
privateParametersBlacklist = [ "osparams_private" , "osparams_secret" , "osparams_private_cluster" ]
187
true
true
0
5
171
31
22
9
null
null
tomahawkins/afv
src/Compile.hs
bsd-3-clause
initMDB :: MDB initMDB = MDB { nextId' = 0 , stage = Init , stack = [] , model = Model { initActions = [], loopActions = [] } }
143
initMDB :: MDB initMDB = MDB { nextId' = 0 , stage = Init , stack = [] , model = Model { initActions = [], loopActions = [] } }
143
initMDB = MDB { nextId' = 0 , stage = Init , stack = [] , model = Model { initActions = [], loopActions = [] } }
128
false
true
0
10
46
67
37
30
null
null
dimitri-xyz/mercado-bitcoin
src/Mercado/Internal/HMAC_SHA2.hs
bsd-3-clause
hexcharsToOctets (_a:[]) = Nothing
34
hexcharsToOctets (_a:[]) = Nothing
34
hexcharsToOctets (_a:[]) = Nothing
34
false
false
0
8
3
18
9
9
null
null
three/codeworld
funblocks-client/src/Blocks/Types.hs
apache-2.0
txtUppercase = standardFunction "txtUppercase" "uppercase" Nothing [typeText, typeText] ["TEXT"] colorText "The text in uppercase"
146
txtUppercase = standardFunction "txtUppercase" "uppercase" Nothing [typeText, typeText] ["TEXT"] colorText "The text in uppercase"
146
txtUppercase = standardFunction "txtUppercase" "uppercase" Nothing [typeText, typeText] ["TEXT"] colorText "The text in uppercase"
146
false
false
0
6
29
30
16
14
null
null
kim/amazonka
amazonka-opsworks/gen/Network/AWS/OpsWorks/UpdateStack.hs
mpl-2.0
-- | The stack ID. usStackId :: Lens' UpdateStack Text usStackId = lens _usStackId (\s a -> s { _usStackId = a })
113
usStackId :: Lens' UpdateStack Text usStackId = lens _usStackId (\s a -> s { _usStackId = a })
94
usStackId = lens _usStackId (\s a -> s { _usStackId = a })
58
true
true
0
9
22
40
22
18
null
null
olsner/ghc
compiler/cmm/CmmExpr.hs
bsd-3-clause
sizeRegSet = Set.size
27
sizeRegSet = Set.size
27
sizeRegSet = Set.size
27
false
false
0
5
8
8
4
4
null
null
lamefun/haddock
haddock-api/src/Haddock/Interface/Specialize.hs
bsd-2-clause
getNameRep :: NamedThing name => name -> NameRep getNameRep = occNameFS . getOccName
84
getNameRep :: NamedThing name => name -> NameRep getNameRep = occNameFS . getOccName
84
getNameRep = occNameFS . getOccName
35
false
true
0
6
12
26
13
13
null
null
brendanhay/gogol
gogol-androidmanagement/gen/Network/Google/AndroidManagement/Types/Product.hs
mpl-2.0
-- | The app version code, which can be used to determine whether one version -- is more recent than another. arVersionCode :: Lens' ApplicationReport (Maybe Int32) arVersionCode = lens _arVersionCode (\ s a -> s{_arVersionCode = a}) . mapping _Coerce
265
arVersionCode :: Lens' ApplicationReport (Maybe Int32) arVersionCode = lens _arVersionCode (\ s a -> s{_arVersionCode = a}) . mapping _Coerce
155
arVersionCode = lens _arVersionCode (\ s a -> s{_arVersionCode = a}) . mapping _Coerce
100
true
true
2
8
54
60
29
31
null
null
yoo-e/hs-tar-conduit
Codec/Archive/Tar/Types.hs
bsd-3-clause
-- | A tar 'Entry' for a file. -- -- Entry fields such as file permissions and ownership have default values. -- -- You can use this as a basis and override specific fields. For example if you -- need an executable file you could use: -- -- > (fileEntry name content) { fileMode = executableFileMode } -- fileEntry :: TarPath -> ByteString -> Entry fileEntry name fileContent = simpleEntry name (NormalFile fileContent (BS.length fileContent))
446
fileEntry :: TarPath -> ByteString -> Entry fileEntry name fileContent = simpleEntry name (NormalFile fileContent (BS.length fileContent))
140
fileEntry name fileContent = simpleEntry name (NormalFile fileContent (BS.length fileContent))
96
true
true
0
10
77
59
32
27
null
null
mlang/haskore-braille
src/Haskore/Interface/Braille.hs
gpl-3.0
savePitch :: Pitch.T -> Parser Pitch.T savePitch = (*>) . putState . Just <*> pure
82
savePitch :: Pitch.T -> Parser Pitch.T savePitch = (*>) . putState . Just <*> pure
82
savePitch = (*>) . putState . Just <*> pure
43
false
true
5
8
14
47
22
25
null
null
DanielSchuessler/hstri
Util.hs
gpl-3.0
fi :: (Integral a, Num b) => a -> b fi = fromIntegral
53
fi :: (Integral a, Num b) => a -> b fi = fromIntegral
53
fi = fromIntegral
17
false
true
0
8
12
37
17
20
null
null
GaloisInc/saw-script
intTests/IntegrationTest.hs
bsd-3-clause
updEnvVars n v (ev : evs) = ev : updEnvVars n v evs
51
updEnvVars n v (ev : evs) = ev : updEnvVars n v evs
51
updEnvVars n v (ev : evs) = ev : updEnvVars n v evs
51
false
false
0
7
12
31
15
16
null
null
ksaveljev/hake-2
src/Game/Monsters/MBoss32.hs
bsd-3-clause
framePain601 :: Int framePain601 = 387
38
framePain601 :: Int framePain601 = 387
38
framePain601 = 387
18
false
true
0
4
5
11
6
5
null
null
spacekitteh/smcghc
libraries/base/Control/Exception/Base.hs
bsd-3-clause
-- | A version of 'catchJust' with the arguments swapped around (see -- 'handle'). handleJust :: Exception e => (e -> Maybe b) -> (b -> IO a) -> IO a -> IO a handleJust p = flip (catchJust p)
192
handleJust :: Exception e => (e -> Maybe b) -> (b -> IO a) -> IO a -> IO a handleJust p = flip (catchJust p)
109
handleJust p = flip (catchJust p)
34
true
true
0
11
40
74
35
39
null
null
christiaanb/Idris-dev
src/Idris/ElabTerm.hs
bsd-3-clause
pruneByType t _ as = as
23
pruneByType t _ as = as
23
pruneByType t _ as = as
23
false
false
0
5
5
13
6
7
null
null
athanclark/composition-extra
src/Data/Function/Syntax.hs
bsd-3-clause
(****.) :: (a -> b -> c -> d -> f -> g) -> (e -> f) -> a -> b -> c -> d -> e -> g (****.) = flip (-.****)
105
(****.) :: (a -> b -> c -> d -> f -> g) -> (e -> f) -> a -> b -> c -> d -> e -> g (****.) = flip (-.****)
105
(****.) = flip (-.****)
23
false
true
0
11
32
78
43
35
null
null
shlevy/ghc
compiler/iface/ToIface.hs
bsd-3-clause
--------------------- toIfaceVar :: Id -> IfaceExpr toIfaceVar v | Just fcall <- isFCallId_maybe v = IfaceFCall fcall (toIfaceType (idType v)) -- Foreign calls have special syntax | isBootUnfolding (idUnfolding v) = IfaceApp (IfaceApp (IfaceExt noinlineIdName) (IfaceType (toIfaceType (idType v)))) (IfaceExt name) -- don't use mkIfaceApps, or infinite loop -- See Note [Inlining and hs-boot files] | isExternalName name = IfaceExt name | otherwise = IfaceLcl (getOccFS name) where name = idName v {- Note [Inlining and hs-boot files] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider this example (Trac #10083, #12789): ---------- RSR.hs-boot ------------ module RSR where data RSR eqRSR :: RSR -> RSR -> Bool ---------- SR.hs ------------ module SR where import {-# SOURCE #-} RSR data SR = MkSR RSR eqSR (MkSR r1) (MkSR r2) = eqRSR r1 r2 ---------- RSR.hs ------------ module RSR where import SR data RSR = MkRSR SR -- deriving( Eq ) eqRSR (MkRSR s1) (MkRSR s2) = (eqSR s1 s2) foo x y = not (eqRSR x y) When compiling RSR we get this code RSR.eqRSR :: RSR -> RSR -> Bool RSR.eqRSR = \ (ds1 :: RSR.RSR) (ds2 :: RSR.RSR) -> case ds1 of _ { RSR.MkRSR s1 -> case ds2 of _ { RSR.MkRSR s2 -> SR.eqSR s1 s2 }} RSR.foo :: RSR -> RSR -> Bool RSR.foo = \ (x :: RSR) (y :: RSR) -> not (RSR.eqRSR x y) Now, when optimising foo: Inline eqRSR (small, non-rec) Inline eqSR (small, non-rec) but the result of inlining eqSR from SR is another call to eqRSR, so everything repeats. Neither eqSR nor eqRSR are (apparently) loop breakers. Solution: in the unfolding of eqSR in SR.hi, replace `eqRSR` in SR with `noinline eqRSR`, so that eqRSR doesn't get inlined. This means that when GHC inlines `eqSR`, it will not also inline `eqRSR`, exactly as would have been the case if `foo` had been defined in SR.hs (and marked as a loop-breaker). But how do we arrange for this to happen? There are two ingredients: 1. When we serialize out unfoldings to IfaceExprs (toIfaceVar), for every variable reference we see if we are referring to an 'Id' that came from an hs-boot file. If so, we add a `noinline` to the reference. 2. But how do we know if a reference came from an hs-boot file or not? We could record this directly in the 'IdInfo', but actually we deduce this by looking at the unfolding: 'Id's that come from boot files are given a special unfolding (upon typechecking) 'BootUnfolding' which say that there is no unfolding, and the reason is because the 'Id' came from a boot file. Here is a solution that doesn't work: when compiling RSR, add a NOINLINE pragma to every function exported by the boot-file for RSR (if it exists). Doing so makes the bootstrapped GHC itself slower by 8% overall (on Trac #9872a-d, and T1969: the reason is that these NOINLINE'd functions now can't be profitably inlined outside of the hs-boot loop. -}
3,151
toIfaceVar :: Id -> IfaceExpr toIfaceVar v | Just fcall <- isFCallId_maybe v = IfaceFCall fcall (toIfaceType (idType v)) -- Foreign calls have special syntax | isBootUnfolding (idUnfolding v) = IfaceApp (IfaceApp (IfaceExt noinlineIdName) (IfaceType (toIfaceType (idType v)))) (IfaceExt name) -- don't use mkIfaceApps, or infinite loop -- See Note [Inlining and hs-boot files] | isExternalName name = IfaceExt name | otherwise = IfaceLcl (getOccFS name) where name = idName v {- Note [Inlining and hs-boot files] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider this example (Trac #10083, #12789): ---------- RSR.hs-boot ------------ module RSR where data RSR eqRSR :: RSR -> RSR -> Bool ---------- SR.hs ------------ module SR where import {-# SOURCE #-} RSR data SR = MkSR RSR eqSR (MkSR r1) (MkSR r2) = eqRSR r1 r2 ---------- RSR.hs ------------ module RSR where import SR data RSR = MkRSR SR -- deriving( Eq ) eqRSR (MkRSR s1) (MkRSR s2) = (eqSR s1 s2) foo x y = not (eqRSR x y) When compiling RSR we get this code RSR.eqRSR :: RSR -> RSR -> Bool RSR.eqRSR = \ (ds1 :: RSR.RSR) (ds2 :: RSR.RSR) -> case ds1 of _ { RSR.MkRSR s1 -> case ds2 of _ { RSR.MkRSR s2 -> SR.eqSR s1 s2 }} RSR.foo :: RSR -> RSR -> Bool RSR.foo = \ (x :: RSR) (y :: RSR) -> not (RSR.eqRSR x y) Now, when optimising foo: Inline eqRSR (small, non-rec) Inline eqSR (small, non-rec) but the result of inlining eqSR from SR is another call to eqRSR, so everything repeats. Neither eqSR nor eqRSR are (apparently) loop breakers. Solution: in the unfolding of eqSR in SR.hi, replace `eqRSR` in SR with `noinline eqRSR`, so that eqRSR doesn't get inlined. This means that when GHC inlines `eqSR`, it will not also inline `eqRSR`, exactly as would have been the case if `foo` had been defined in SR.hs (and marked as a loop-breaker). But how do we arrange for this to happen? There are two ingredients: 1. When we serialize out unfoldings to IfaceExprs (toIfaceVar), for every variable reference we see if we are referring to an 'Id' that came from an hs-boot file. If so, we add a `noinline` to the reference. 2. But how do we know if a reference came from an hs-boot file or not? We could record this directly in the 'IdInfo', but actually we deduce this by looking at the unfolding: 'Id's that come from boot files are given a special unfolding (upon typechecking) 'BootUnfolding' which say that there is no unfolding, and the reason is because the 'Id' came from a boot file. Here is a solution that doesn't work: when compiling RSR, add a NOINLINE pragma to every function exported by the boot-file for RSR (if it exists). Doing so makes the bootstrapped GHC itself slower by 8% overall (on Trac #9872a-d, and T1969: the reason is that these NOINLINE'd functions now can't be profitably inlined outside of the hs-boot loop. -}
3,129
toIfaceVar v | Just fcall <- isFCallId_maybe v = IfaceFCall fcall (toIfaceType (idType v)) -- Foreign calls have special syntax | isBootUnfolding (idUnfolding v) = IfaceApp (IfaceApp (IfaceExt noinlineIdName) (IfaceType (toIfaceType (idType v)))) (IfaceExt name) -- don't use mkIfaceApps, or infinite loop -- See Note [Inlining and hs-boot files] | isExternalName name = IfaceExt name | otherwise = IfaceLcl (getOccFS name) where name = idName v {- Note [Inlining and hs-boot files] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider this example (Trac #10083, #12789): ---------- RSR.hs-boot ------------ module RSR where data RSR eqRSR :: RSR -> RSR -> Bool ---------- SR.hs ------------ module SR where import {-# SOURCE #-} RSR data SR = MkSR RSR eqSR (MkSR r1) (MkSR r2) = eqRSR r1 r2 ---------- RSR.hs ------------ module RSR where import SR data RSR = MkRSR SR -- deriving( Eq ) eqRSR (MkRSR s1) (MkRSR s2) = (eqSR s1 s2) foo x y = not (eqRSR x y) When compiling RSR we get this code RSR.eqRSR :: RSR -> RSR -> Bool RSR.eqRSR = \ (ds1 :: RSR.RSR) (ds2 :: RSR.RSR) -> case ds1 of _ { RSR.MkRSR s1 -> case ds2 of _ { RSR.MkRSR s2 -> SR.eqSR s1 s2 }} RSR.foo :: RSR -> RSR -> Bool RSR.foo = \ (x :: RSR) (y :: RSR) -> not (RSR.eqRSR x y) Now, when optimising foo: Inline eqRSR (small, non-rec) Inline eqSR (small, non-rec) but the result of inlining eqSR from SR is another call to eqRSR, so everything repeats. Neither eqSR nor eqRSR are (apparently) loop breakers. Solution: in the unfolding of eqSR in SR.hi, replace `eqRSR` in SR with `noinline eqRSR`, so that eqRSR doesn't get inlined. This means that when GHC inlines `eqSR`, it will not also inline `eqRSR`, exactly as would have been the case if `foo` had been defined in SR.hs (and marked as a loop-breaker). But how do we arrange for this to happen? There are two ingredients: 1. When we serialize out unfoldings to IfaceExprs (toIfaceVar), for every variable reference we see if we are referring to an 'Id' that came from an hs-boot file. If so, we add a `noinline` to the reference. 2. But how do we know if a reference came from an hs-boot file or not? We could record this directly in the 'IdInfo', but actually we deduce this by looking at the unfolding: 'Id's that come from boot files are given a special unfolding (upon typechecking) 'BootUnfolding' which say that there is no unfolding, and the reason is because the 'Id' came from a boot file. Here is a solution that doesn't work: when compiling RSR, add a NOINLINE pragma to every function exported by the boot-file for RSR (if it exists). Doing so makes the bootstrapped GHC itself slower by 8% overall (on Trac #9872a-d, and T1969: the reason is that these NOINLINE'd functions now can't be profitably inlined outside of the hs-boot loop. -}
3,099
true
true
2
12
823
171
78
93
null
null
robeverest/accelerate
Data/Array/Accelerate/Trafo/Algebra.hs
bsd-3-clause
evalRecip :: Elt a => FloatingType a -> a :-> a evalRecip ty | FloatingDict <- floatingDict ty = eval1 recip
108
evalRecip :: Elt a => FloatingType a -> a :-> a evalRecip ty | FloatingDict <- floatingDict ty = eval1 recip
108
evalRecip ty | FloatingDict <- floatingDict ty = eval1 recip
60
false
true
0
9
20
48
21
27
null
null
ekmett/hmpfr
src/Data/Number/MPFR/Arithmetic.hs
bsd-3-clause
isub :: RoundMode -> Precision -> Int -> MPFR -> MPFR isub r p d = fst . isub_ r p d
90
isub :: RoundMode -> Precision -> Int -> MPFR -> MPFR isub r p d = fst . isub_ r p d
90
isub r p d = fst . isub_ r p d
30
false
true
1
10
27
51
23
28
null
null
sthiele/hasple
Assignment.hs
gpl-3.0
unassigned :: Assignment -> [SVar] -- return a list of unassigned variables unassigned a = if UVec.null a then [] else UVec.toList (UVec.findIndices (==0) a)
164
unassigned :: Assignment -> [SVar] unassigned a = if UVec.null a then [] else UVec.toList (UVec.findIndices (==0) a)
123
unassigned a = if UVec.null a then [] else UVec.toList (UVec.findIndices (==0) a)
88
true
true
0
9
31
56
30
26
null
null
petester42/haskell-hockey
src/Hockey/Types.hs
mit
fromSeason Playoffs = 3
23
fromSeason Playoffs = 3
23
fromSeason Playoffs = 3
23
false
false
0
5
3
9
4
5
null
null
bens/libmpd-haskell
src/Network/MPD/Commands/CurrentPlaylist.hs
lgpl-2.1
-- | Move a song to a given position in the current playlist. move :: MonadMPD m => Position -> Position -> m () move pos = A.runCommand . A.move pos
149
move :: MonadMPD m => Position -> Position -> m () move pos = A.runCommand . A.move pos
87
move pos = A.runCommand . A.move pos
36
true
true
0
10
30
50
23
27
null
null
themattchan/core
src/Core/Parser.hs
mit
int = read <$> many1 digit
26
int = read <$> many1 digit
26
int = read <$> many1 digit
26
false
false
3
5
5
17
6
11
null
null
emilaxelsson/ag-graph
bench/Bench.hs
bsd-3-clause
repminDoubleG' :: Dag IntTreeF -> Dag IntTreeF repminDoubleG' = snd . runRewriteDag const minS minI repDouble' init where init (MinS i) = MinI i
146
repminDoubleG' :: Dag IntTreeF -> Dag IntTreeF repminDoubleG' = snd . runRewriteDag const minS minI repDouble' init where init (MinS i) = MinI i
146
repminDoubleG' = snd . runRewriteDag const minS minI repDouble' init where init (MinS i) = MinI i
99
false
true
0
7
25
55
26
29
null
null
syanidar/Sophy
src/Foundation/BitBoard.hs
bsd-3-clause
attack SouthEast x y = (y''.|.y''`shiftR`36.&.x''.&.onBoard'')`shiftR`9.&.onBoard where onBoard = complement aFile y' = y.|.y`shiftR`9.&.x.&.onBoard x' = x.&.x`shiftR`9.&.onBoard onBoard' = onBoard.&.onBoard`shiftR`9 y'' = y'.|.y'`shiftR`18.&.x'.&.onBoard' x'' = x'.&.x'`shiftR`18.&.onBoard' onBoard'' = onBoard'.&.onBoard'`shiftR`18
458
attack SouthEast x y = (y''.|.y''`shiftR`36.&.x''.&.onBoard'')`shiftR`9.&.onBoard where onBoard = complement aFile y' = y.|.y`shiftR`9.&.x.&.onBoard x' = x.&.x`shiftR`9.&.onBoard onBoard' = onBoard.&.onBoard`shiftR`9 y'' = y'.|.y'`shiftR`18.&.x'.&.onBoard' x'' = x'.&.x'`shiftR`18.&.onBoard' onBoard'' = onBoard'.&.onBoard'`shiftR`18
458
attack SouthEast x y = (y''.|.y''`shiftR`36.&.x''.&.onBoard'')`shiftR`9.&.onBoard where onBoard = complement aFile y' = y.|.y`shiftR`9.&.x.&.onBoard x' = x.&.x`shiftR`9.&.onBoard onBoard' = onBoard.&.onBoard`shiftR`9 y'' = y'.|.y'`shiftR`18.&.x'.&.onBoard' x'' = x'.&.x'`shiftR`18.&.onBoard' onBoard'' = onBoard'.&.onBoard'`shiftR`18
458
false
false
6
23
153
181
95
86
null
null
GaloisInc/pads-haskell
Examples/First.hs
bsd-3-clause
test_voidEntry3 = mkTestCase "VoidEntry3" expect_voidEntry3 result_voidEntry3
77
test_voidEntry3 = mkTestCase "VoidEntry3" expect_voidEntry3 result_voidEntry3
77
test_voidEntry3 = mkTestCase "VoidEntry3" expect_voidEntry3 result_voidEntry3
77
false
false
0
5
5
13
6
7
null
null
michaelbjames/ecma6-parser
Parse/Language.hs
bsd-2-clause
braces = T.braces lexer
23
braces = T.braces lexer
23
braces = T.braces lexer
23
false
false
0
6
3
11
5
6
null
null
pacak/sqroll
tests/Database/Sqroll/Pure/Tests.hs
bsd-3-clause
testRunLog :: Assertion testRunLog = withTmpSqroll $ \sqroll -> do cache <- newIORef [] runLog sqroll cache [ LogKey (Generation 1 "testgen") $ \genKey -> [ writeInstrument (Instrument "cookies") $ \instrKey -> [ Log (Bid genKey instrKey 10) , Log (Bid genKey instrKey 12) ] ] ] runLog sqroll cache [ LogKey (Generation 4 "alexgen") $ \genKey -> [ writeInstrument (Instrument "cookies") $ \instrKey -> [ Log (Bid genKey instrKey 20) , Log (Bid genKey instrKey 22) ] ] ] -- Check that there's only one item in the cache cache' <- readIORef cache 1 @=? length cache' generations <- sqrollTailList sqroll generations @?= [ Generation 1 "testgen" , Generation 4 "alexgen" ] instruments <- sqrollTailList sqroll instruments @?= [ Instrument "cookies" ] bids <- sqrollTailList sqroll bids @?= [ Bid (Key 1) (Key 1) 10 , Bid (Key 1) (Key 1) 12 , Bid (Key 2) (Key 1) 20 , Bid (Key 2) (Key 1) 22 ]
1,198
testRunLog :: Assertion testRunLog = withTmpSqroll $ \sqroll -> do cache <- newIORef [] runLog sqroll cache [ LogKey (Generation 1 "testgen") $ \genKey -> [ writeInstrument (Instrument "cookies") $ \instrKey -> [ Log (Bid genKey instrKey 10) , Log (Bid genKey instrKey 12) ] ] ] runLog sqroll cache [ LogKey (Generation 4 "alexgen") $ \genKey -> [ writeInstrument (Instrument "cookies") $ \instrKey -> [ Log (Bid genKey instrKey 20) , Log (Bid genKey instrKey 22) ] ] ] -- Check that there's only one item in the cache cache' <- readIORef cache 1 @=? length cache' generations <- sqrollTailList sqroll generations @?= [ Generation 1 "testgen" , Generation 4 "alexgen" ] instruments <- sqrollTailList sqroll instruments @?= [ Instrument "cookies" ] bids <- sqrollTailList sqroll bids @?= [ Bid (Key 1) (Key 1) 10 , Bid (Key 1) (Key 1) 12 , Bid (Key 2) (Key 1) 20 , Bid (Key 2) (Key 1) 22 ]
1,198
testRunLog = withTmpSqroll $ \sqroll -> do cache <- newIORef [] runLog sqroll cache [ LogKey (Generation 1 "testgen") $ \genKey -> [ writeInstrument (Instrument "cookies") $ \instrKey -> [ Log (Bid genKey instrKey 10) , Log (Bid genKey instrKey 12) ] ] ] runLog sqroll cache [ LogKey (Generation 4 "alexgen") $ \genKey -> [ writeInstrument (Instrument "cookies") $ \instrKey -> [ Log (Bid genKey instrKey 20) , Log (Bid genKey instrKey 22) ] ] ] -- Check that there's only one item in the cache cache' <- readIORef cache 1 @=? length cache' generations <- sqrollTailList sqroll generations @?= [ Generation 1 "testgen" , Generation 4 "alexgen" ] instruments <- sqrollTailList sqroll instruments @?= [ Instrument "cookies" ] bids <- sqrollTailList sqroll bids @?= [ Bid (Key 1) (Key 1) 10 , Bid (Key 1) (Key 1) 12 , Bid (Key 2) (Key 1) 20 , Bid (Key 2) (Key 1) 22 ]
1,174
false
true
0
19
467
386
187
199
null
null
jasonzoladz/yesod-auth-account-fork
tests/BasicTests.hs
mit
basicSpecs :: YesodSpec MyApp basicSpecs = ydescribe "Basic tests" $ do yit "checks the home page is not logged in" $ do get' "/" statusIs 200 bodyContains "Please visit the <a href=\"/auth/login\">Login page" yit "tests an invalid login" $ do get' "/auth/login" statusIs 200 post' "/auth/page/account/login" $ do byLabel "Username" "abc" byLabel "Password" "xxx" statusIs redirectCode get' "/auth/login" statusIs 200 bodyContains "Invalid username/password combination" yit "new account page looks ok" $ do get' "/auth/page/account/newaccount" statusIs 200 htmlAllContain "title" "Register a new account" bodyContains "Register" yit "reset password page looks ok" $ do get' "/auth/page/account/resetpassword" statusIs 200 bodyContains "Send password reset email" post' "/auth/page/account/resetpassword" $ do byLabel "Username" "abc" addNonce statusIs redirectCode get' "/" statusIs 200 bodyContains "Invalid username" yit "verify page returns an error" $ do get' "/auth/page/account/verify/abc/xxxxxx" statusIs redirectCode get' "/" statusIs 200 bodyContains "invalid verification key" yit "new password returns an error" $ do get' "/auth/page/account/newpassword/abc/xxxxxx" statusIs redirectCode get' "/" statusIs 200 bodyContains "invalid verification key" yit "set password returns an error" $ do post' "/auth/page/account/setpassword" $ do addPostParam "f1" "xxx" addPostParam "f2" "xxx" addPostParam "f3" "xxx" addPostParam "f4" "xxx" addPostParam "f5" "xxx" statusIs redirectCode get' "/" statusIs 200 bodyContains "As a protection against cross-site" yit "resend verify email returns an error" $ do post' "/auth/page/account/resendverifyemail" $ do addPostParam "f1" "xxx" addPostParam "f2" "xxx" statusIs 400 bodyContains "As a protection against cross-site"
2,506
basicSpecs :: YesodSpec MyApp basicSpecs = ydescribe "Basic tests" $ do yit "checks the home page is not logged in" $ do get' "/" statusIs 200 bodyContains "Please visit the <a href=\"/auth/login\">Login page" yit "tests an invalid login" $ do get' "/auth/login" statusIs 200 post' "/auth/page/account/login" $ do byLabel "Username" "abc" byLabel "Password" "xxx" statusIs redirectCode get' "/auth/login" statusIs 200 bodyContains "Invalid username/password combination" yit "new account page looks ok" $ do get' "/auth/page/account/newaccount" statusIs 200 htmlAllContain "title" "Register a new account" bodyContains "Register" yit "reset password page looks ok" $ do get' "/auth/page/account/resetpassword" statusIs 200 bodyContains "Send password reset email" post' "/auth/page/account/resetpassword" $ do byLabel "Username" "abc" addNonce statusIs redirectCode get' "/" statusIs 200 bodyContains "Invalid username" yit "verify page returns an error" $ do get' "/auth/page/account/verify/abc/xxxxxx" statusIs redirectCode get' "/" statusIs 200 bodyContains "invalid verification key" yit "new password returns an error" $ do get' "/auth/page/account/newpassword/abc/xxxxxx" statusIs redirectCode get' "/" statusIs 200 bodyContains "invalid verification key" yit "set password returns an error" $ do post' "/auth/page/account/setpassword" $ do addPostParam "f1" "xxx" addPostParam "f2" "xxx" addPostParam "f3" "xxx" addPostParam "f4" "xxx" addPostParam "f5" "xxx" statusIs redirectCode get' "/" statusIs 200 bodyContains "As a protection against cross-site" yit "resend verify email returns an error" $ do post' "/auth/page/account/resendverifyemail" $ do addPostParam "f1" "xxx" addPostParam "f2" "xxx" statusIs 400 bodyContains "As a protection against cross-site"
2,506
basicSpecs = ydescribe "Basic tests" $ do yit "checks the home page is not logged in" $ do get' "/" statusIs 200 bodyContains "Please visit the <a href=\"/auth/login\">Login page" yit "tests an invalid login" $ do get' "/auth/login" statusIs 200 post' "/auth/page/account/login" $ do byLabel "Username" "abc" byLabel "Password" "xxx" statusIs redirectCode get' "/auth/login" statusIs 200 bodyContains "Invalid username/password combination" yit "new account page looks ok" $ do get' "/auth/page/account/newaccount" statusIs 200 htmlAllContain "title" "Register a new account" bodyContains "Register" yit "reset password page looks ok" $ do get' "/auth/page/account/resetpassword" statusIs 200 bodyContains "Send password reset email" post' "/auth/page/account/resetpassword" $ do byLabel "Username" "abc" addNonce statusIs redirectCode get' "/" statusIs 200 bodyContains "Invalid username" yit "verify page returns an error" $ do get' "/auth/page/account/verify/abc/xxxxxx" statusIs redirectCode get' "/" statusIs 200 bodyContains "invalid verification key" yit "new password returns an error" $ do get' "/auth/page/account/newpassword/abc/xxxxxx" statusIs redirectCode get' "/" statusIs 200 bodyContains "invalid verification key" yit "set password returns an error" $ do post' "/auth/page/account/setpassword" $ do addPostParam "f1" "xxx" addPostParam "f2" "xxx" addPostParam "f3" "xxx" addPostParam "f4" "xxx" addPostParam "f5" "xxx" statusIs redirectCode get' "/" statusIs 200 bodyContains "As a protection against cross-site" yit "resend verify email returns an error" $ do post' "/auth/page/account/resendverifyemail" $ do addPostParam "f1" "xxx" addPostParam "f2" "xxx" statusIs 400 bodyContains "As a protection against cross-site"
2,476
false
true
0
14
960
442
162
280
null
null
termite2/tsl
Abstract/BFormula.hs
bsd-3-clause
fRelAddrOf (ESlice e1 s1) (ESlice e2 s2) | s1 == s2 = fRelAddrOf e1 e2 | s1 /= s2 = FFalse
131
fRelAddrOf (ESlice e1 s1) (ESlice e2 s2) | s1 == s2 = fRelAddrOf e1 e2 | s1 /= s2 = FFalse
131
fRelAddrOf (ESlice e1 s1) (ESlice e2 s2) | s1 == s2 = fRelAddrOf e1 e2 | s1 /= s2 = FFalse
131
false
false
4
9
61
56
25
31
null
null
achirkin/easytensor
easytensor/test/Numeric/MatrixDoubleTest.hs
bsd-3-clause
prop_translate4 :: Vector TestElem 4 -> Vector TestElem 3 -> Bool prop_translate4 a b = toHomPoint b %* translate4 a == toHomPoint (dropW a + b)
144
prop_translate4 :: Vector TestElem 4 -> Vector TestElem 3 -> Bool prop_translate4 a b = toHomPoint b %* translate4 a == toHomPoint (dropW a + b)
144
prop_translate4 a b = toHomPoint b %* translate4 a == toHomPoint (dropW a + b)
78
false
true
0
9
25
61
28
33
null
null
urbanslug/ghc
compiler/llvmGen/LlvmCodeGen/CodeGen.hs
bsd-3-clause
genCallExtract _ _ _ _ = panic "genCallExtract: unsupported ForeignTarget"
78
genCallExtract _ _ _ _ = panic "genCallExtract: unsupported ForeignTarget"
78
genCallExtract _ _ _ _ = panic "genCallExtract: unsupported ForeignTarget"
78
false
false
1
5
13
18
7
11
null
null
chreekat/yesod
yesod-core/test/YesodCoreTest/Links.hs
bsd-2-clause
linksTest :: [Spec] linksTest = describe "Test.Links" [ it "linkToHome" case_linkToHome ]
97
linksTest :: [Spec] linksTest = describe "Test.Links" [ it "linkToHome" case_linkToHome ]
97
linksTest = describe "Test.Links" [ it "linkToHome" case_linkToHome ]
77
false
true
0
6
19
28
14
14
null
null
shlevy/ghc
compiler/types/OptCoercion.hs
bsd-3-clause
opt_trans_rule is in_co1@(UnivCo p1 r1 tyl1 _tyr1) in_co2@(UnivCo p2 r2 _tyl2 tyr2) | Just prov' <- opt_trans_prov p1 p2 = ASSERT( r1 == r2 ) fireTransRule "UnivCo" in_co1 in_co2 $ mkUnivCo prov' r1 tyl1 tyr2 where -- if the provenances are different, opt'ing will be very confusing opt_trans_prov UnsafeCoerceProv UnsafeCoerceProv = Just UnsafeCoerceProv opt_trans_prov (PhantomProv kco1) (PhantomProv kco2) = Just $ PhantomProv $ opt_trans is kco1 kco2 opt_trans_prov (ProofIrrelProv kco1) (ProofIrrelProv kco2) = Just $ ProofIrrelProv $ opt_trans is kco1 kco2 opt_trans_prov (PluginProv str1) (PluginProv str2) | str1 == str2 = Just p1 opt_trans_prov _ _ = Nothing -- Push transitivity down through matching top-level constructors.
824
opt_trans_rule is in_co1@(UnivCo p1 r1 tyl1 _tyr1) in_co2@(UnivCo p2 r2 _tyl2 tyr2) | Just prov' <- opt_trans_prov p1 p2 = ASSERT( r1 == r2 ) fireTransRule "UnivCo" in_co1 in_co2 $ mkUnivCo prov' r1 tyl1 tyr2 where -- if the provenances are different, opt'ing will be very confusing opt_trans_prov UnsafeCoerceProv UnsafeCoerceProv = Just UnsafeCoerceProv opt_trans_prov (PhantomProv kco1) (PhantomProv kco2) = Just $ PhantomProv $ opt_trans is kco1 kco2 opt_trans_prov (ProofIrrelProv kco1) (ProofIrrelProv kco2) = Just $ ProofIrrelProv $ opt_trans is kco1 kco2 opt_trans_prov (PluginProv str1) (PluginProv str2) | str1 == str2 = Just p1 opt_trans_prov _ _ = Nothing -- Push transitivity down through matching top-level constructors.
824
opt_trans_rule is in_co1@(UnivCo p1 r1 tyl1 _tyr1) in_co2@(UnivCo p2 r2 _tyl2 tyr2) | Just prov' <- opt_trans_prov p1 p2 = ASSERT( r1 == r2 ) fireTransRule "UnivCo" in_co1 in_co2 $ mkUnivCo prov' r1 tyl1 tyr2 where -- if the provenances are different, opt'ing will be very confusing opt_trans_prov UnsafeCoerceProv UnsafeCoerceProv = Just UnsafeCoerceProv opt_trans_prov (PhantomProv kco1) (PhantomProv kco2) = Just $ PhantomProv $ opt_trans is kco1 kco2 opt_trans_prov (ProofIrrelProv kco1) (ProofIrrelProv kco2) = Just $ ProofIrrelProv $ opt_trans is kco1 kco2 opt_trans_prov (PluginProv str1) (PluginProv str2) | str1 == str2 = Just p1 opt_trans_prov _ _ = Nothing -- Push transitivity down through matching top-level constructors.
824
false
false
0
9
195
231
110
121
null
null
fmapfmapfmap/amazonka
amazonka-swf/gen/Network/AWS/SWF/Types/Product.hs
mpl-2.0
-- | Creates a value of 'TagFilter' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'tfTag' tagFilter :: Text -- ^ 'tfTag' -> TagFilter tagFilter pTag_ = TagFilter' { _tfTag = pTag_ }
288
tagFilter :: Text -- ^ 'tfTag' -> TagFilter tagFilter pTag_ = TagFilter' { _tfTag = pTag_ }
111
tagFilter pTag_ = TagFilter' { _tfTag = pTag_ }
59
true
true
0
6
70
32
20
12
null
null
ezyang/ghc
compiler/main/TidyPgm.hs
bsd-3-clause
cafRefsL _ _ = False
52
cafRefsL _ _ = False
52
cafRefsL _ _ = False
52
false
false
0
5
36
11
5
6
null
null
svenssonjoel/GCDObsidian
Obsidian/GCDObsidian/CodeGen/Common.hs
bsd-3-clause
genOp Gt [a,b] = oper ">" a b
34
genOp Gt [a,b] = oper ">" a b
34
genOp Gt [a,b] = oper ">" a b
34
false
false
0
6
12
24
12
12
null
null
uuhan/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LSGe (ATInt ITChar)) [l, r] = doOp v (LSGe (ATInt ITNative)) [l, r]
75
doOp v (LSGe (ATInt ITChar)) [l, r] = doOp v (LSGe (ATInt ITNative)) [l, r]
75
doOp v (LSGe (ATInt ITChar)) [l, r] = doOp v (LSGe (ATInt ITNative)) [l, r]
75
false
false
1
9
14
59
29
30
null
null
bhurt/webbench
haskell/client/Main.hs
bsd-2-clause
optDesc :: [ OptDescr (Arg -> Arg) ] optDesc = [ Option ['u'] ["url"] (ReqArg (\s a -> a { url = s }) "URL") "URL of the server to test", Option ['d'] ["deepcheck"] (NoArg (\a -> a { deepcheck = True })) "Perform deeper testing of results", Option ['s'] ["numsecs"] (ReqArg (\s a -> a { numSecs = read s }) "INT") "Number of seconds to test the program", Option ['n'] ["numclients"] (ReqArg (\s a -> a { numThreads = read s }) "INT") "Number of concurrent clients to run", Option ['h', '?'] ["help"] (NoArg (\a -> a { help = True })) "Print out help message", Option ['f'] ["file"] (ReqArg (\s a -> a { filepath = s}) "FILE") "File to write the data to", Option ['m'] ["maxoffset"] (ReqArg (\s a -> a { maxoffset = Just (read s)}) "INT") "Maximum offset to generate (useful for debugging)" ]
995
optDesc :: [ OptDescr (Arg -> Arg) ] optDesc = [ Option ['u'] ["url"] (ReqArg (\s a -> a { url = s }) "URL") "URL of the server to test", Option ['d'] ["deepcheck"] (NoArg (\a -> a { deepcheck = True })) "Perform deeper testing of results", Option ['s'] ["numsecs"] (ReqArg (\s a -> a { numSecs = read s }) "INT") "Number of seconds to test the program", Option ['n'] ["numclients"] (ReqArg (\s a -> a { numThreads = read s }) "INT") "Number of concurrent clients to run", Option ['h', '?'] ["help"] (NoArg (\a -> a { help = True })) "Print out help message", Option ['f'] ["file"] (ReqArg (\s a -> a { filepath = s}) "FILE") "File to write the data to", Option ['m'] ["maxoffset"] (ReqArg (\s a -> a { maxoffset = Just (read s)}) "INT") "Maximum offset to generate (useful for debugging)" ]
991
optDesc = [ Option ['u'] ["url"] (ReqArg (\s a -> a { url = s }) "URL") "URL of the server to test", Option ['d'] ["deepcheck"] (NoArg (\a -> a { deepcheck = True })) "Perform deeper testing of results", Option ['s'] ["numsecs"] (ReqArg (\s a -> a { numSecs = read s }) "INT") "Number of seconds to test the program", Option ['n'] ["numclients"] (ReqArg (\s a -> a { numThreads = read s }) "INT") "Number of concurrent clients to run", Option ['h', '?'] ["help"] (NoArg (\a -> a { help = True })) "Print out help message", Option ['f'] ["file"] (ReqArg (\s a -> a { filepath = s}) "FILE") "File to write the data to", Option ['m'] ["maxoffset"] (ReqArg (\s a -> a { maxoffset = Just (read s)}) "INT") "Maximum offset to generate (useful for debugging)" ]
954
false
true
0
15
353
345
192
153
null
null
mbakke/ganeti
test/hs/Test/Ganeti/Types.hs
bsd-2-clause
-- | Test 'StorageType' serialisation. prop_StorageType_serialisation :: StorageType -> Property prop_StorageType_serialisation = testSerialisation
147
prop_StorageType_serialisation :: StorageType -> Property prop_StorageType_serialisation = testSerialisation
108
prop_StorageType_serialisation = testSerialisation
50
true
true
0
5
12
16
9
7
null
null
adgalad/Epilog
src/Haskell/Language/Epilog/MIPS/MIPS.hs
bsd-3-clause
generalRegs, floatRegs, scratchRegs, scratchFloatRegs :: [Text] generalRegs = ("$" <>) <$> [ "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6" , "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "t8" , "t9" ]
227
generalRegs, floatRegs, scratchRegs, scratchFloatRegs :: [Text] generalRegs = ("$" <>) <$> [ "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6" , "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "t8" , "t9" ]
227
generalRegs = ("$" <>) <$> [ "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6" , "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "t8" , "t9" ]
163
false
true
3
7
41
99
61
38
null
null
Sgoettschkes/learning
haskell/ProjectEuler/src/Problems/Problem047.hs
mit
main = print p47
16
main = print p47
16
main = print p47
16
false
false
0
5
3
9
4
5
null
null
kawamuray/ganeti
src/Ganeti/OpParams.hs
gpl-2.0
pForce :: Field pForce = withDoc "Whether to force the operation" $ defaultFalse "force"
92
pForce :: Field pForce = withDoc "Whether to force the operation" $ defaultFalse "force"
92
pForce = withDoc "Whether to force the operation" $ defaultFalse "force"
76
false
true
0
6
17
21
10
11
null
null
shlevy/ghc
compiler/ghci/ByteCodeGen.hs
bsd-3-clause
unboxedTupleReturn :: StackDepth -> Sequel -> BCEnv -> AnnExpr' Id DVarSet -> BcM BCInstrList unboxedTupleReturn d s p arg = returnUnboxedAtom d s p arg (atomRep arg)
170
unboxedTupleReturn :: StackDepth -> Sequel -> BCEnv -> AnnExpr' Id DVarSet -> BcM BCInstrList unboxedTupleReturn d s p arg = returnUnboxedAtom d s p arg (atomRep arg)
170
unboxedTupleReturn d s p arg = returnUnboxedAtom d s p arg (atomRep arg)
72
false
true
0
9
30
61
29
32
null
null
green-haskell/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
ctPred :: Ct -> PredType -- See Note [Ct/evidence invariant] ctPred ct = ctEvPred (cc_ev ct)
92
ctPred :: Ct -> PredType ctPred ct = ctEvPred (cc_ev ct)
56
ctPred ct = ctEvPred (cc_ev ct)
31
true
true
0
7
15
28
14
14
null
null
plumlife/cabal
Cabal/Distribution/Simple/BuildTarget.hs
bsd-3-clause
checkTargetExistsAsFile :: UserBuildTarget -> IO (UserBuildTarget, Bool) checkTargetExistsAsFile t = do fexists <- existsAsFile (fileComponentOfTarget t) return (t, fexists) where existsAsFile f = do exists <- doesFileExist f case splitPath f of (d:_) | hasTrailingPathSeparator d -> doesDirectoryExist d (d:_:_) | not exists -> doesDirectoryExist d _ -> return exists fileComponentOfTarget (UserBuildTargetSingle s1) = s1 fileComponentOfTarget (UserBuildTargetDouble _ s2) = s2 fileComponentOfTarget (UserBuildTargetTriple _ _ s3) = s3 -- ------------------------------------------------------------ -- * Parsing user targets -- ------------------------------------------------------------
815
checkTargetExistsAsFile :: UserBuildTarget -> IO (UserBuildTarget, Bool) checkTargetExistsAsFile t = do fexists <- existsAsFile (fileComponentOfTarget t) return (t, fexists) where existsAsFile f = do exists <- doesFileExist f case splitPath f of (d:_) | hasTrailingPathSeparator d -> doesDirectoryExist d (d:_:_) | not exists -> doesDirectoryExist d _ -> return exists fileComponentOfTarget (UserBuildTargetSingle s1) = s1 fileComponentOfTarget (UserBuildTargetDouble _ s2) = s2 fileComponentOfTarget (UserBuildTargetTriple _ _ s3) = s3 -- ------------------------------------------------------------ -- * Parsing user targets -- ------------------------------------------------------------
815
checkTargetExistsAsFile t = do fexists <- existsAsFile (fileComponentOfTarget t) return (t, fexists) where existsAsFile f = do exists <- doesFileExist f case splitPath f of (d:_) | hasTrailingPathSeparator d -> doesDirectoryExist d (d:_:_) | not exists -> doesDirectoryExist d _ -> return exists fileComponentOfTarget (UserBuildTargetSingle s1) = s1 fileComponentOfTarget (UserBuildTargetDouble _ s2) = s2 fileComponentOfTarget (UserBuildTargetTriple _ _ s3) = s3 -- ------------------------------------------------------------ -- * Parsing user targets -- ------------------------------------------------------------
742
false
true
3
14
201
200
95
105
null
null
MasseR/xmonadcontrib
XMonad/Util/XSelection.hs
bsd-3-clause
unsafePromptSelection app = join $ io $ liftM unsafeSpawn $ fmap (\x -> app ++ " " ++ x) getSelection
101
unsafePromptSelection app = join $ io $ liftM unsafeSpawn $ fmap (\x -> app ++ " " ++ x) getSelection
101
unsafePromptSelection app = join $ io $ liftM unsafeSpawn $ fmap (\x -> app ++ " " ++ x) getSelection
101
false
false
0
10
19
45
22
23
null
null
sdiehl/ghc
compiler/coreSyn/CoreSyn.hs
bsd-3-clause
mkConApp2 :: DataCon -> [Type] -> [Var] -> Expr b mkConApp2 con tys arg_ids = Var (dataConWorkId con) `mkApps` map Type tys `mkApps` map varToCoreExpr arg_ids
214
mkConApp2 :: DataCon -> [Type] -> [Var] -> Expr b mkConApp2 con tys arg_ids = Var (dataConWorkId con) `mkApps` map Type tys `mkApps` map varToCoreExpr arg_ids
214
mkConApp2 con tys arg_ids = Var (dataConWorkId con) `mkApps` map Type tys `mkApps` map varToCoreExpr arg_ids
164
false
true
0
9
81
75
37
38
null
null
zaxtax/hakaru
haskell/Tests/RoundTrip.hs
bsd-3-clause
t53' = lam $ \x -> unsafeSuperpose [ (one, if_ (zero < x) (if_ (x < one) (dirac unit) (reject sing)) (reject sing)) , (one, if_ false (dirac unit) (reject sing)) ]
239
t53' = lam $ \x -> unsafeSuperpose [ (one, if_ (zero < x) (if_ (x < one) (dirac unit) (reject sing)) (reject sing)) , (one, if_ false (dirac unit) (reject sing)) ]
239
t53' = lam $ \x -> unsafeSuperpose [ (one, if_ (zero < x) (if_ (x < one) (dirac unit) (reject sing)) (reject sing)) , (one, if_ false (dirac unit) (reject sing)) ]
239
false
false
3
12
107
109
55
54
null
null
leshchevds/ganeti
src/Ganeti/HTools/Loader.hs
bsd-2-clause
eitherLive False def_data _ = return def_data
45
eitherLive False def_data _ = return def_data
45
eitherLive False def_data _ = return def_data
45
false
false
0
5
6
16
7
9
null
null
mbakke/ganeti
src/Ganeti/OpCodes.hs
bsd-2-clause
opSummaryVal OpNetworkSetParams { opNetworkName = s} = Just (fromNonEmpty s)
76
opSummaryVal OpNetworkSetParams { opNetworkName = s} = Just (fromNonEmpty s)
76
opSummaryVal OpNetworkSetParams { opNetworkName = s} = Just (fromNonEmpty s)
76
false
false
0
8
9
27
13
14
null
null
elieux/ghc
libraries/base/Text/ParserCombinators/ReadPrec.hs
bsd-3-clause
choice :: [ReadPrec a] -> ReadPrec a -- ^ Combines all parsers in the specified list. choice ps = foldr (+++) pfail ps
118
choice :: [ReadPrec a] -> ReadPrec a choice ps = foldr (+++) pfail ps
69
choice ps = foldr (+++) pfail ps
32
true
true
0
7
22
37
19
18
null
null
scott-fleischman/greek-grammar
haskell/greek-grammar/src/Text/Greek/Phonology/Contractions.hs
mit
forwardMap' :: forall s a1 a2 a3. (Ord a1, Ord a2) => (s -> a1) -> (s -> a2) -> (s -> a3) -> [s] -> Map a1 (Map a2 [a3]) forwardMap' f1 f2 f3 ss = fmap (fromListWith (++) . fmap makeSndList) outerMap where makeSndList (a, b) = (a, [b]) outerMap = fromListWith (++) nestedPairs nestedPairs = fmap nestedPair ss nestedPair c = (f1 c, [(f2 c, f3 c)])
365
forwardMap' :: forall s a1 a2 a3. (Ord a1, Ord a2) => (s -> a1) -> (s -> a2) -> (s -> a3) -> [s] -> Map a1 (Map a2 [a3]) forwardMap' f1 f2 f3 ss = fmap (fromListWith (++) . fmap makeSndList) outerMap where makeSndList (a, b) = (a, [b]) outerMap = fromListWith (++) nestedPairs nestedPairs = fmap nestedPair ss nestedPair c = (f1 c, [(f2 c, f3 c)])
365
forwardMap' f1 f2 f3 ss = fmap (fromListWith (++) . fmap makeSndList) outerMap where makeSndList (a, b) = (a, [b]) outerMap = fromListWith (++) nestedPairs nestedPairs = fmap nestedPair ss nestedPair c = (f1 c, [(f2 c, f3 c)])
244
false
true
0
14
87
199
108
91
null
null
jwiegley/ghc-release
libraries/binary/src/Data/Binary/Builder/Base.hs
gpl-3.0
-- | Write a Word16 in little endian format putWord16le :: Word16 -> Builder putWord16le w = writeN 2 $ \p -> do poke p (fromIntegral (w) :: Word8) poke (p `plusPtr` 1) (fromIntegral (shiftr_w16 w 8) :: Word8)
245
putWord16le :: Word16 -> Builder putWord16le w = writeN 2 $ \p -> do poke p (fromIntegral (w) :: Word8) poke (p `plusPtr` 1) (fromIntegral (shiftr_w16 w 8) :: Word8)
201
putWord16le w = writeN 2 $ \p -> do poke p (fromIntegral (w) :: Word8) poke (p `plusPtr` 1) (fromIntegral (shiftr_w16 w 8) :: Word8)
168
true
true
0
13
74
85
44
41
null
null
ku-fpg/kansas-amber
legacy/Parts/LCD.hs
bsd-3-clause
lcdScrollDisplayLeft :: LCD -> Arduino () lcdScrollDisplayLeft lcd = withLCD lcd "Scrolling display to the left by 1" $ \c -> sendCmd lcd c (LCD_CURSORSHIFT lcdMoveLeft) where lcdMoveLeft = 0x00 -- | Scroll the display to the right by 1 character
249
lcdScrollDisplayLeft :: LCD -> Arduino () lcdScrollDisplayLeft lcd = withLCD lcd "Scrolling display to the left by 1" $ \c -> sendCmd lcd c (LCD_CURSORSHIFT lcdMoveLeft) where lcdMoveLeft = 0x00 -- | Scroll the display to the right by 1 character
249
lcdScrollDisplayLeft lcd = withLCD lcd "Scrolling display to the left by 1" $ \c -> sendCmd lcd c (LCD_CURSORSHIFT lcdMoveLeft) where lcdMoveLeft = 0x00 -- | Scroll the display to the right by 1 character
207
false
true
0
9
43
59
29
30
null
null
mightymoose/liquidhaskell
benchmarks/llrbtree-0.1.1/Data/Set/BUSplay.hs
bsd-3-clause
delete x t = case member x t of (True, Node l _ r) -> merge l r (False, s) -> s _ -> error "delete" ---------------------------------------------------------------- {-| Creating a union set from two sets. >>> union (fromList [5,3]) (fromList [5,7]) == fromList [3,5,7] True -}
319
delete x t = case member x t of (True, Node l _ r) -> merge l r (False, s) -> s _ -> error "delete" ---------------------------------------------------------------- {-| Creating a union set from two sets. >>> union (fromList [5,3]) (fromList [5,7]) == fromList [3,5,7] True -}
319
delete x t = case member x t of (True, Node l _ r) -> merge l r (False, s) -> s _ -> error "delete" ---------------------------------------------------------------- {-| Creating a union set from two sets. >>> union (fromList [5,3]) (fromList [5,7]) == fromList [3,5,7] True -}
319
false
false
1
9
88
71
34
37
null
null
balez/ag-a-la-carte
Language/Grammars/AGalacarte/Prelude.hs
gpl-3.0
-- ** Lists single x = [x]
26
single x = [x]
14
single x = [x]
14
true
false
0
5
6
13
7
6
null
null
diku-dk/futhark
src/Futhark/Optimise/Fusion/LoopKernel.hs
isc
inputToOutput :: SOAC.Input -> Maybe (SOAC.ArrayTransform, SOAC.Input) inputToOutput (SOAC.Input ts ia iat) = case SOAC.viewf ts of t SOAC.:< ts' -> Just (t, SOAC.Input ts' ia iat) SOAC.EmptyF -> Nothing
213
inputToOutput :: SOAC.Input -> Maybe (SOAC.ArrayTransform, SOAC.Input) inputToOutput (SOAC.Input ts ia iat) = case SOAC.viewf ts of t SOAC.:< ts' -> Just (t, SOAC.Input ts' ia iat) SOAC.EmptyF -> Nothing
213
inputToOutput (SOAC.Input ts ia iat) = case SOAC.viewf ts of t SOAC.:< ts' -> Just (t, SOAC.Input ts' ia iat) SOAC.EmptyF -> Nothing
142
false
true
0
11
39
92
46
46
null
null
josefs/autosar
oldARSim/ARComp.hs
bsd-3-clause
rteCall (Result (RO (_,n))) a = [cexp| Rte_Result( $args:([fromIntegral n]++a) ) |]
87
rteCall (Result (RO (_,n))) a = [cexp| Rte_Result( $args:([fromIntegral n]++a) ) |]
87
rteCall (Result (RO (_,n))) a = [cexp| Rte_Result( $args:([fromIntegral n]++a) ) |]
87
false
false
1
10
15
36
19
17
null
null
hibou107/algocpp
arithmetic.hs
mit
primesR a b = [n | n <- [a..b], (isPrime n)]
44
primesR a b = [n | n <- [a..b], (isPrime n)]
44
primesR a b = [n | n <- [a..b], (isPrime n)]
44
false
false
0
8
10
37
19
18
null
null
thielema/wxhaskell
wxdirect/src/MultiSet.hs
lgpl-2.1
-- | /O(log n)/. Delete all occurrences of the maximal element. deleteMaxAll :: MultiSet a -> MultiSet a deleteMaxAll (MultiSet m) = MultiSet (M.deleteMax m)
159
deleteMaxAll :: MultiSet a -> MultiSet a deleteMaxAll (MultiSet m) = MultiSet (M.deleteMax m)
95
deleteMaxAll (MultiSet m) = MultiSet (M.deleteMax m)
54
true
true
0
8
26
47
21
26
null
null