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
nomeata/ghc
compiler/cmm/CmmType.hs
bsd-3-clause
-- CmmTypes of native word widths bWord, bHalfWord, gcWord :: CmmType bWord = cmmBits wordWidth
99
bWord, bHalfWord, gcWord :: CmmType bWord = cmmBits wordWidth
65
bWord = cmmBits wordWidth
29
true
true
4
6
18
34
13
21
null
null
mbernat/aoc16-haskell
src/Day4.hs
bsd-3-clause
shift :: Int -> Char -> Char shift n c = c' where c' = chr $ ((ord c - ord 'a' + n ) `mod` 26) + ord 'a'
110
shift :: Int -> Char -> Char shift n c = c' where c' = chr $ ((ord c - ord 'a' + n ) `mod` 26) + ord 'a'
110
shift n c = c' where c' = chr $ ((ord c - ord 'a' + n ) `mod` 26) + ord 'a'
81
false
true
0
12
35
69
35
34
null
null
spatial-reasoning/zeno
src/Helpful/General.hs
bsd-2-clause
subsetsSmallToLarge :: (Ord a) => Set.Set a -> [Set.Set a] subsetsSmallToLarge s = concatMap (subsetsN s) [0..n] where n = Set.size s -- return subsets of s, in decreasing order of size
190
subsetsSmallToLarge :: (Ord a) => Set.Set a -> [Set.Set a] subsetsSmallToLarge s = concatMap (subsetsN s) [0..n] where n = Set.size s -- return subsets of s, in decreasing order of size
190
subsetsSmallToLarge s = concatMap (subsetsN s) [0..n] where n = Set.size s -- return subsets of s, in decreasing order of size
131
false
true
1
9
36
73
35
38
null
null
josefs/sbv
Data/SBV/Utils/PrettyNum.hs
bsd-3-clause
showSMTDouble :: RoundingMode -> Double -> String showSMTDouble rm d | isNaN d = as "NaN" | isInfinite d, d < 0 = as "-oo" | isInfinite d = as "+oo" | isNegativeZero d = as "-zero" | d == 0 = as "+zero" | True = "((_ to_fp 11 53) " ++ smtRoundingMode rm ++ " " ++ toSMTLibRational (toRational d) ++ ")" where as s = "(_ " ++ s ++ " 11 53)" -- | Show a rational in SMTLib format
449
showSMTDouble :: RoundingMode -> Double -> String showSMTDouble rm d | isNaN d = as "NaN" | isInfinite d, d < 0 = as "-oo" | isInfinite d = as "+oo" | isNegativeZero d = as "-zero" | d == 0 = as "+zero" | True = "((_ to_fp 11 53) " ++ smtRoundingMode rm ++ " " ++ toSMTLibRational (toRational d) ++ ")" where as s = "(_ " ++ s ++ " 11 53)" -- | Show a rational in SMTLib format
449
showSMTDouble rm d | isNaN d = as "NaN" | isInfinite d, d < 0 = as "-oo" | isInfinite d = as "+oo" | isNegativeZero d = as "-zero" | d == 0 = as "+zero" | True = "((_ to_fp 11 53) " ++ smtRoundingMode rm ++ " " ++ toSMTLibRational (toRational d) ++ ")" where as s = "(_ " ++ s ++ " 11 53)" -- | Show a rational in SMTLib format
399
false
true
3
10
155
181
78
103
null
null
entropia/tip-toi-reveng
src/GMEWriter.hs
mit
putSubGame :: SubGame -> SPut putSubGame (SubGame {..}) = mdo putBS sgUnknown putArray putWord16 $ map putWord16 sgOids1 putArray putWord16 $ map putWord16 sgOids2 putArray putWord16 $ map putWord16 sgOids3 mapM_ putWord32 pll pll <- mapM (getAddress . putPlayListList) sgPlaylist return ()
320
putSubGame :: SubGame -> SPut putSubGame (SubGame {..}) = mdo putBS sgUnknown putArray putWord16 $ map putWord16 sgOids1 putArray putWord16 $ map putWord16 sgOids2 putArray putWord16 $ map putWord16 sgOids3 mapM_ putWord32 pll pll <- mapM (getAddress . putPlayListList) sgPlaylist return ()
320
putSubGame (SubGame {..}) = mdo putBS sgUnknown putArray putWord16 $ map putWord16 sgOids1 putArray putWord16 $ map putWord16 sgOids2 putArray putWord16 $ map putWord16 sgOids3 mapM_ putWord32 pll pll <- mapM (getAddress . putPlayListList) sgPlaylist return ()
290
false
true
0
10
71
113
49
64
null
null
sharpjs/haskell-learning
src/Aex/Types.hs
gpl-3.0
u64 = IntT (Just (64, 64, False))
33
u64 = IntT (Just (64, 64, False))
33
u64 = IntT (Just (64, 64, False))
33
false
false
1
7
6
27
13
14
null
null
kim/amazonka
amazonka-cloudformation/gen/Network/AWS/CloudFormation/GetTemplateSummary.hs
mpl-2.0
-- | The name or the unique identifier associated with the stack, which are not -- always interchangeable. For running stacks, you can specify either the -- stack's name or its unique stack ID. For deleted stack, you must specify the -- unique stack ID. -- -- Conditional: You must specify only one of the following parameters: 'StackName' -- , 'TemplateBody', or 'TemplateURL'. gtsStackName :: Lens' GetTemplateSummary (Maybe Text) gtsStackName = lens _gtsStackName (\s a -> s { _gtsStackName = a })
500
gtsStackName :: Lens' GetTemplateSummary (Maybe Text) gtsStackName = lens _gtsStackName (\s a -> s { _gtsStackName = a })
121
gtsStackName = lens _gtsStackName (\s a -> s { _gtsStackName = a })
67
true
true
0
9
81
52
31
21
null
null
wavewave/hoodle-core
src/Hoodle/Type/Window.hs
gpl-3.0
splitWindow :: CanvasId -- ^ old window -> (CanvasId, SplitType) -- ^ new additional window -> WindowConfig -- ^ old WindowConfig -> Either WindowConfig WindowConfig -- ^ new WindowConfig splitWindow cidold (cidnew,stype) (Node cid) = if cid == cidold then case stype of SplitHorizontal -> Right (HSplit (Node cid) (Node cidnew)) SplitVertical -> Right (VSplit (Node cid) (Node cidnew)) else Left (Node cid)
490
splitWindow :: CanvasId -- ^ old window -> (CanvasId, SplitType) -- ^ new additional window -> WindowConfig -- ^ old WindowConfig -> Either WindowConfig WindowConfig splitWindow cidold (cidnew,stype) (Node cid) = if cid == cidold then case stype of SplitHorizontal -> Right (HSplit (Node cid) (Node cidnew)) SplitVertical -> Right (VSplit (Node cid) (Node cidnew)) else Left (Node cid)
468
splitWindow cidold (cidnew,stype) (Node cid) = if cid == cidold then case stype of SplitHorizontal -> Right (HSplit (Node cid) (Node cidnew)) SplitVertical -> Right (VSplit (Node cid) (Node cidnew)) else Left (Node cid)
255
true
true
0
13
145
140
73
67
null
null
ku-fpg/ldpc
src/Data/BitMatrix/Sparse.hs
bsd-2-clause
sizeBM (BitMatrixCCS s _) = s
29
sizeBM (BitMatrixCCS s _) = s
29
sizeBM (BitMatrixCCS s _) = s
29
false
false
0
6
5
18
8
10
null
null
CloudI/CloudI
src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Char8.hs
mit
-- | 'foldr'' is a strict variant of foldr foldr' :: (Char -> a -> a) -> a -> ByteString -> a foldr' f = B.foldr' (\c a -> f (w2c c) a)
135
foldr' :: (Char -> a -> a) -> a -> ByteString -> a foldr' f = B.foldr' (\c a -> f (w2c c) a)
92
foldr' f = B.foldr' (\c a -> f (w2c c) a)
41
true
true
0
10
32
64
33
31
null
null
kmate/imperative-edsl
tests/Imperative.hs
bsd-3-clause
testSwap1 :: Prog () testSwap1 = do arr1 :: Arr Word32 Int32 <- constArr [1,2,3,4] arr2 :: Arr Word32 Int32 <- constArr [11,12,13,14] unsafeSwap arr1 arr2 sequence_ [getArr arr1 i >>= printf "%d " | i <- map fromInteger [0..3]] printf "\n"
259
testSwap1 :: Prog () testSwap1 = do arr1 :: Arr Word32 Int32 <- constArr [1,2,3,4] arr2 :: Arr Word32 Int32 <- constArr [11,12,13,14] unsafeSwap arr1 arr2 sequence_ [getArr arr1 i >>= printf "%d " | i <- map fromInteger [0..3]] printf "\n"
259
testSwap1 = do arr1 :: Arr Word32 Int32 <- constArr [1,2,3,4] arr2 :: Arr Word32 Int32 <- constArr [11,12,13,14] unsafeSwap arr1 arr2 sequence_ [getArr arr1 i >>= printf "%d " | i <- map fromInteger [0..3]] printf "\n"
238
false
true
0
12
61
131
63
68
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
2352 = 2351
11
2352 = 2351
11
2352 = 2351
11
false
false
1
5
2
10
3
7
null
null
kawu/factorized-tag-parser
src/NLP/Partage/AStar/Deriv.hs
bsd-2-clause
deriv4show :: Deriv c n t -> R.Tree (PrintNode (O.Node n (Maybe t))) deriv4show = go False where go isMod t = addDep isMod $ R.Node { R.rootLabel = Regular . node . R.rootLabel $ t , R.subForest = map (go False) (R.subForest t) ++ map (go True) (modif $ R.rootLabel t) } addDep isMod t | isMod == True = R.Node Dependent [t] | otherwise = t --------------------------- -- Parsed Trees --------------------------- -- | Convert the given derivation tree to a parsed tree. The second element of -- the reuslting tuple is `True` if the tree is a sister-adjunction tree.
625
deriv4show :: Deriv c n t -> R.Tree (PrintNode (O.Node n (Maybe t))) deriv4show = go False where go isMod t = addDep isMod $ R.Node { R.rootLabel = Regular . node . R.rootLabel $ t , R.subForest = map (go False) (R.subForest t) ++ map (go True) (modif $ R.rootLabel t) } addDep isMod t | isMod == True = R.Node Dependent [t] | otherwise = t --------------------------- -- Parsed Trees --------------------------- -- | Convert the given derivation tree to a parsed tree. The second element of -- the reuslting tuple is `True` if the tree is a sister-adjunction tree.
625
deriv4show = go False where go isMod t = addDep isMod $ R.Node { R.rootLabel = Regular . node . R.rootLabel $ t , R.subForest = map (go False) (R.subForest t) ++ map (go True) (modif $ R.rootLabel t) } addDep isMod t | isMod == True = R.Node Dependent [t] | otherwise = t --------------------------- -- Parsed Trees --------------------------- -- | Convert the given derivation tree to a parsed tree. The second element of -- the reuslting tuple is `True` if the tree is a sister-adjunction tree.
556
false
true
0
13
160
196
98
98
null
null
Heather/hackport
Portage/PackageId.hs
gpl-3.0
normalizeCabalPackageId :: Cabal.PackageIdentifier -> Cabal.PackageIdentifier normalizeCabalPackageId (Cabal.PackageIdentifier name version) = Cabal.PackageIdentifier (normalizeCabalPackageName name) version
209
normalizeCabalPackageId :: Cabal.PackageIdentifier -> Cabal.PackageIdentifier normalizeCabalPackageId (Cabal.PackageIdentifier name version) = Cabal.PackageIdentifier (normalizeCabalPackageName name) version
209
normalizeCabalPackageId (Cabal.PackageIdentifier name version) = Cabal.PackageIdentifier (normalizeCabalPackageName name) version
131
false
true
0
8
15
45
22
23
null
null
ekmett/ghc
compiler/cmm/CmmBuildInfoTables.hs
bsd-3-clause
foldSet :: (a -> b -> b) -> b -> Set a -> b foldSet = Set.foldr
63
foldSet :: (a -> b -> b) -> b -> Set a -> b foldSet = Set.foldr
63
foldSet = Set.foldr
19
false
true
0
8
16
39
20
19
null
null
alexander-at-github/eta
compiler/ETA/DeSugar/DsUtils.hs
bsd-3-clause
alwaysFailMatchResult :: MatchResult alwaysFailMatchResult = MatchResult CanFail (\fail -> return fail)
103
alwaysFailMatchResult :: MatchResult alwaysFailMatchResult = MatchResult CanFail (\fail -> return fail)
103
alwaysFailMatchResult = MatchResult CanFail (\fail -> return fail)
66
false
true
0
8
10
27
14
13
null
null
ulricha/dsh-tpc-h
Queries/AQuery/Trades.hs
bsd-3-clause
-- our profit is the maximum margin obtainable profit :: (Ord a, Num a, Num (Q a), QA a, TA a) => Q [a] -> Q a profit xs = maximum (margins xs)
143
profit :: (Ord a, Num a, Num (Q a), QA a, TA a) => Q [a] -> Q a profit xs = maximum (margins xs)
96
profit xs = maximum (margins xs)
32
true
true
0
9
32
81
39
42
null
null
raventid/coursera_learning
haskell/will_kurt/21_pizza.hs
mit
comparePizzas :: Pizza -> Pizza -> Pizza comparePizzas p1 p2 = if costP1 < costP2 then p1 else p2 where costP1 = costPerInch p1 costP2 = costPerInch p2
205
comparePizzas :: Pizza -> Pizza -> Pizza comparePizzas p1 p2 = if costP1 < costP2 then p1 else p2 where costP1 = costPerInch p1 costP2 = costPerInch p2
205
comparePizzas p1 p2 = if costP1 < costP2 then p1 else p2 where costP1 = costPerInch p1 costP2 = costPerInch p2
164
false
true
0
6
81
55
28
27
null
null
Courseography/courseography
app/Response/Export.hs
gpl-3.0
returnPdfBS :: String -> IO Response returnPdfBS pdfFilename = do pdfData <- BS.readFile pdfFilename _ <- removeFile pdfFilename return $ toResponseBS "application/pdf" $ BEnc.encode $ L.fromStrict pdfData -- | Returns the name of a generated pdf that contains graphImg and timetableImg -- and deletes all of the img and svg files passed as arguments
363
returnPdfBS :: String -> IO Response returnPdfBS pdfFilename = do pdfData <- BS.readFile pdfFilename _ <- removeFile pdfFilename return $ toResponseBS "application/pdf" $ BEnc.encode $ L.fromStrict pdfData -- | Returns the name of a generated pdf that contains graphImg and timetableImg -- and deletes all of the img and svg files passed as arguments
363
returnPdfBS pdfFilename = do pdfData <- BS.readFile pdfFilename _ <- removeFile pdfFilename return $ toResponseBS "application/pdf" $ BEnc.encode $ L.fromStrict pdfData -- | Returns the name of a generated pdf that contains graphImg and timetableImg -- and deletes all of the img and svg files passed as arguments
326
false
true
0
11
66
75
33
42
null
null
jjingram/satori
src/Codegen.hs
bsd-3-clause
store :: Operand -> Operand -> Codegen Operand store ptr val = instr T.void $ Store False ptr val Nothing 0 []
110
store :: Operand -> Operand -> Codegen Operand store ptr val = instr T.void $ Store False ptr val Nothing 0 []
110
store ptr val = instr T.void $ Store False ptr val Nothing 0 []
63
false
true
0
7
21
51
24
27
null
null
mcschroeder/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
{- ************************************************************************ * * Predicates * * ************************************************************************ -} isTouchableOrFmv :: TcLevel -> TcTyVar -> Bool isTouchableOrFmv ctxt_tclvl tv = ASSERT2( isTcTyVar tv, ppr tv ) case tcTyVarDetails tv of MetaTv { mtv_tclvl = tv_tclvl, mtv_info = info } -> ASSERT2( checkTcLevelInvariant ctxt_tclvl tv_tclvl, ppr tv $$ ppr tv_tclvl $$ ppr ctxt_tclvl ) case info of FlatMetaTv -> True _ -> tv_tclvl `sameDepthAs` ctxt_tclvl _ -> False
793
isTouchableOrFmv :: TcLevel -> TcTyVar -> Bool isTouchableOrFmv ctxt_tclvl tv = ASSERT2( isTcTyVar tv, ppr tv ) case tcTyVarDetails tv of MetaTv { mtv_tclvl = tv_tclvl, mtv_info = info } -> ASSERT2( checkTcLevelInvariant ctxt_tclvl tv_tclvl, ppr tv $$ ppr tv_tclvl $$ ppr ctxt_tclvl ) case info of FlatMetaTv -> True _ -> tv_tclvl `sameDepthAs` ctxt_tclvl _ -> False
467
isTouchableOrFmv ctxt_tclvl tv = ASSERT2( isTcTyVar tv, ppr tv ) case tcTyVarDetails tv of MetaTv { mtv_tclvl = tv_tclvl, mtv_info = info } -> ASSERT2( checkTcLevelInvariant ctxt_tclvl tv_tclvl, ppr tv $$ ppr tv_tclvl $$ ppr ctxt_tclvl ) case info of FlatMetaTv -> True _ -> tv_tclvl `sameDepthAs` ctxt_tclvl _ -> False
420
true
true
0
12
322
132
66
66
null
null
wfleming/advent-of-code-2016
2017/D8/src/D8Lib/Data.hs
bsd-3-clause
registerNames :: [Rule] -> [Register] registerNames = map (\(Rule r _ _) -> r)
78
registerNames :: [Rule] -> [Register] registerNames = map (\(Rule r _ _) -> r)
78
registerNames = map (\(Rule r _ _) -> r)
40
false
true
0
9
13
49
24
25
null
null
derkyjadex/sudoku-solver
Main.hs
mit
boardStr board = boardStr' 0 board where boardStr' _ [] = "|\n+---+---+---+" boardStr' i (v:vs) = decorationAt i ++ valueStr v ++ boardStr' (i + 1) vs valueStr 0 = " " valueStr v = show v
261
boardStr board = boardStr' 0 board where boardStr' _ [] = "|\n+---+---+---+" boardStr' i (v:vs) = decorationAt i ++ valueStr v ++ boardStr' (i + 1) vs valueStr 0 = " " valueStr v = show v
261
boardStr board = boardStr' 0 board where boardStr' _ [] = "|\n+---+---+---+" boardStr' i (v:vs) = decorationAt i ++ valueStr v ++ boardStr' (i + 1) vs valueStr 0 = " " valueStr v = show v
261
false
false
3
9
110
89
43
46
null
null
tlaitinen/yesod-datatables
example/Handler/Home.hs
bsd-2-clause
dataTablesWidget :: DataTable val -> Widget dataTablesWidget dt = do widgetId <- lift newIdent addStylesheet $ StaticR css_jquery_dataTables_css addScript $ StaticR js_jquery_1_9_0_min_js addScript $ StaticR js_datatables_js $(widgetFile "dataTablesWidget")
289
dataTablesWidget :: DataTable val -> Widget dataTablesWidget dt = do widgetId <- lift newIdent addStylesheet $ StaticR css_jquery_dataTables_css addScript $ StaticR js_jquery_1_9_0_min_js addScript $ StaticR js_datatables_js $(widgetFile "dataTablesWidget")
289
dataTablesWidget dt = do widgetId <- lift newIdent addStylesheet $ StaticR css_jquery_dataTables_css addScript $ StaticR js_jquery_1_9_0_min_js addScript $ StaticR js_datatables_js $(widgetFile "dataTablesWidget")
245
false
true
0
9
59
71
30
41
null
null
jean-edouard/manager
disksync/Types.hs
gpl-2.0
stringOfReason ImageFailLocalChecksumFailureDvd = "local-checksum-failure-dvd"
78
stringOfReason ImageFailLocalChecksumFailureDvd = "local-checksum-failure-dvd"
78
stringOfReason ImageFailLocalChecksumFailureDvd = "local-checksum-failure-dvd"
78
false
false
0
5
3
9
4
5
null
null
ssoudan/hsStruct
src/AVLTree.hs
apache-2.0
rightRotate (Node _ a (Leaf la) r) = trace "right" ( let nr = Node (1 + max 1 (getHeight r)) a EmptyTree r nh = 1 + getHeight nr in Node nh la EmptyTree nr)
302
rightRotate (Node _ a (Leaf la) r) = trace "right" ( let nr = Node (1 + max 1 (getHeight r)) a EmptyTree r nh = 1 + getHeight nr in Node nh la EmptyTree nr)
302
rightRotate (Node _ a (Leaf la) r) = trace "right" ( let nr = Node (1 + max 1 (getHeight r)) a EmptyTree r nh = 1 + getHeight nr in Node nh la EmptyTree nr)
302
false
false
0
16
181
95
45
50
null
null
FranklinChen/hugs98-plus-Sep2006
packages/network/tests/URITest.hs
bsd-3-clause
testURIRefSuite = TestLabel "Test URIrefs" testURIRefList
57
testURIRefSuite = TestLabel "Test URIrefs" testURIRefList
57
testURIRefSuite = TestLabel "Test URIrefs" testURIRefList
57
false
false
1
5
5
15
5
10
null
null
SwiftsNamesake/Southpaw
lib/Southpaw/Picasso/Shapes.hs
mit
--------------------------------------------------------------------------------------------------- -- Function --------------------------------------------------------------------------------------------------- -- Geometry --------------------------------------------------------------------------------------- -- | -- TODO: Start angle -- TODO: Invalid arguments (eg. sides < 3) (use Maybe?) -- TODO: Make polymorphic -- TODO: Move to geometry section -- polygon :: (Floating f, RealFloat f) => Int -> f -> Complex f -> [Complex f] polygon :: Integral int => int -> Double -> Complex Double -> [Complex Double] polygon sides radius origin = [ let θ = arg n in origin + ((radius * cos θ):+(radius * sin θ)) | n <- [1..sides]] where arg n = fromIntegral n * (2*π)/fromIntegral sides -- | -- TODO: Simplify and expound comments
833
polygon :: Integral int => int -> Double -> Complex Double -> [Complex Double] polygon sides radius origin = [ let θ = arg n in origin + ((radius * cos θ):+(radius * sin θ)) | n <- [1..sides]] where arg n = fromIntegral n * (2*π)/fromIntegral sides -- | -- TODO: Simplify and expound comments
299
polygon sides radius origin = [ let θ = arg n in origin + ((radius * cos θ):+(radius * sin θ)) | n <- [1..sides]] where arg n = fromIntegral n * (2*π)/fromIntegral sides -- | -- TODO: Simplify and expound comments
220
true
true
0
13
112
150
80
70
null
null
silver-lang/silver
src/Silver/Compiler/CodeGen.hs
bsd-3-clause
stringPtr :: Word64 -> T.Type stringPtr n = T.ptr $ string n
60
stringPtr :: Word64 -> T.Type stringPtr n = T.ptr $ string n
60
stringPtr n = T.ptr $ string n
30
false
true
0
6
11
29
14
15
null
null
Undeterminant/taffybar
src/System/Taffybar/FreedesktopNotifications.hs
bsd-3-clause
formatMessage :: NotifyState -> Notification -> String formatMessage s = fmt where fmt = notificationFormatter $ noteConfig s -- | The notificationDaemon thread looks at the notification queue. -- If the queue is empty and there is no current message, it sets the -- new message as the current message in a TVar (Just Notification) -- and displays the message itself and sets up a thread to remove the -- message after its timeout. -- -- If there is a current message, add the new message to the queue. -- -- The timeout thread just sleeps for its timeout and then atomically -- replaces the current message with the next one from the queue. It -- then displays the new current message. However, if the current -- message has changed (because of a user cancellation), the timer -- thread just exits. -- -- User cancellation atomically reads (and replaces) the current -- notification (if there is another in the queue). If it found a new -- notification, that node is then displayed.
993
formatMessage :: NotifyState -> Notification -> String formatMessage s = fmt where fmt = notificationFormatter $ noteConfig s -- | The notificationDaemon thread looks at the notification queue. -- If the queue is empty and there is no current message, it sets the -- new message as the current message in a TVar (Just Notification) -- and displays the message itself and sets up a thread to remove the -- message after its timeout. -- -- If there is a current message, add the new message to the queue. -- -- The timeout thread just sleeps for its timeout and then atomically -- replaces the current message with the next one from the queue. It -- then displays the new current message. However, if the current -- message has changed (because of a user cancellation), the timer -- thread just exits. -- -- User cancellation atomically reads (and replaces) the current -- notification (if there is another in the queue). If it found a new -- notification, that node is then displayed.
993
formatMessage s = fmt where fmt = notificationFormatter $ noteConfig s -- | The notificationDaemon thread looks at the notification queue. -- If the queue is empty and there is no current message, it sets the -- new message as the current message in a TVar (Just Notification) -- and displays the message itself and sets up a thread to remove the -- message after its timeout. -- -- If there is a current message, add the new message to the queue. -- -- The timeout thread just sleeps for its timeout and then atomically -- replaces the current message with the next one from the queue. It -- then displays the new current message. However, if the current -- message has changed (because of a user cancellation), the timer -- thread just exits. -- -- User cancellation atomically reads (and replaces) the current -- notification (if there is another in the queue). If it found a new -- notification, that node is then displayed.
938
false
true
0
6
181
54
35
19
null
null
bergmark/hlint
data/Default.hs
bsd-3-clause
warn "Use 1" = x ^ 0 ==> 1
27
warn "Use 1" = x ^ 0 ==> 1
27
warn "Use 1" = x ^ 0 ==> 1
27
false
false
0
6
9
17
8
9
null
null
ezyang/ghc
compiler/cmm/PprCmmExpr.hs
bsd-3-clause
infixMachOp8 (MO_U_Rem _) = Just (char '%')
44
infixMachOp8 (MO_U_Rem _) = Just (char '%')
44
infixMachOp8 (MO_U_Rem _) = Just (char '%')
44
false
false
0
7
7
24
11
13
null
null
copumpkin/macho
src/Data/Macho/Types.hs
bsd-3-clause
r_type 10 CPU_TYPE_POWERPC = PPC_RELOC_HI16_SECTDIFF
54
r_type 10 CPU_TYPE_POWERPC = PPC_RELOC_HI16_SECTDIFF
54
r_type 10 CPU_TYPE_POWERPC = PPC_RELOC_HI16_SECTDIFF
54
false
false
0
5
6
11
5
6
null
null
chrisdone/ircbrowse
src/Ircbrowse/View/Browse.hs
bsd-3-clause
pdfs :: Channel -> URI -> Maybe UTCTime -> [Event] -> PN -> Maybe Text -> Html pdfs channel = browser False ("PDFs linked in #" <> T.pack (showChan channel)) channel $ do p $ a ! A.href (toValue ("/pdfs/" ++ showChan channel ++ "/unique")) $ do "Show unique PDF links →"
276
pdfs :: Channel -> URI -> Maybe UTCTime -> [Event] -> PN -> Maybe Text -> Html pdfs channel = browser False ("PDFs linked in #" <> T.pack (showChan channel)) channel $ do p $ a ! A.href (toValue ("/pdfs/" ++ showChan channel ++ "/unique")) $ do "Show unique PDF links →"
276
pdfs channel = browser False ("PDFs linked in #" <> T.pack (showChan channel)) channel $ do p $ a ! A.href (toValue ("/pdfs/" ++ showChan channel ++ "/unique")) $ do "Show unique PDF links →"
197
false
true
0
16
57
127
58
69
null
null
GaloisInc/verification-game
web-prover/src/ProveBasics.hs
bsd-3-clause
names :: [Text] names = concatMap nameChunk [ (0::Integer) .. ] where toName 0 x = Text.pack [x] toName n x = Text.pack (x : show n) nameChunk n = map (toName n) [ 'a' .. 'z' ]
197
names :: [Text] names = concatMap nameChunk [ (0::Integer) .. ] where toName 0 x = Text.pack [x] toName n x = Text.pack (x : show n) nameChunk n = map (toName n) [ 'a' .. 'z' ]
197
names = concatMap nameChunk [ (0::Integer) .. ] where toName 0 x = Text.pack [x] toName n x = Text.pack (x : show n) nameChunk n = map (toName n) [ 'a' .. 'z' ]
181
false
true
0
8
58
106
53
53
null
null
WraithM/haskell-opaleye
src/Opaleye/Manipulation.hs
bsd-3-clause
arrangeInsertManySql :: T.Table columns a -> NEL.NonEmpty columns -> String arrangeInsertManySql t c = MI.arrangeInsertManySql t c Nothing
139
arrangeInsertManySql :: T.Table columns a -> NEL.NonEmpty columns -> String arrangeInsertManySql t c = MI.arrangeInsertManySql t c Nothing
139
arrangeInsertManySql t c = MI.arrangeInsertManySql t c Nothing
63
false
true
0
9
18
50
22
28
null
null
vluukkal/aspreify
testaspparse.hs
mit
targs2 = TestCase $ assertEqual "args 2" [Sym (Var "Foo"),Sym (Var "Bar"),Sym (Var "Goo")] (wrapparser_exp' args "" "(Foo,Bar, Goo)")
134
targs2 = TestCase $ assertEqual "args 2" [Sym (Var "Foo"),Sym (Var "Bar"),Sym (Var "Goo")] (wrapparser_exp' args "" "(Foo,Bar, Goo)")
134
targs2 = TestCase $ assertEqual "args 2" [Sym (Var "Foo"),Sym (Var "Bar"),Sym (Var "Goo")] (wrapparser_exp' args "" "(Foo,Bar, Goo)")
134
false
false
1
10
19
66
31
35
null
null
ssaavedra/liquidhaskell
benchmarks/esop2013-submission/Base.hs
bsd-3-clause
{-------------------------------------------------------------------- Intersection --------------------------------------------------------------------} -- | /O(n+m)/. Intersection of two maps. -- Return data in the first map for the keys existing in both maps. -- (@'intersection' m1 m2 == 'intersectionWith' 'const' m1 m2@). -- -- > intersection (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "a" {-@ intersection :: (Ord k) => OMap k a -> OMap k b -> OMap k a @-} intersection :: Ord k => Map k a -> Map k b -> Map k a intersection Tip _ = Tip
581
intersection :: Ord k => Map k a -> Map k b -> Map k a intersection Tip _ = Tip
79
intersection Tip _ = Tip
24
true
true
0
9
92
58
29
29
null
null
ivanperez-keera/Yampa
yampa/tests/TestsLoopPre.hs
bsd-3-clause
loopPre_t3 = testSF1 (loopPre 0 (first localTime))
50
loopPre_t3 = testSF1 (loopPre 0 (first localTime))
50
loopPre_t3 = testSF1 (loopPre 0 (first localTime))
50
false
false
0
9
6
23
11
12
null
null
beni55/LambdaHack
Game/LambdaHack/Client/AI/ConditionClient.hs
bsd-3-clause
condAnyFoeAdjM :: MonadStateRead m => ActorId -> m Bool condAnyFoeAdjM aid = do b <- getsState $ getActorBody aid fact <- getsState $ (EM.! bfid b) . sfactionD allFoes <- getsState $ actorRegularList (isAtWar fact) (blid b) return $ any (adjacent (bpos b) . bpos) allFoes -- keep it lazy -- | Require the actor's HP is low enough.
340
condAnyFoeAdjM :: MonadStateRead m => ActorId -> m Bool condAnyFoeAdjM aid = do b <- getsState $ getActorBody aid fact <- getsState $ (EM.! bfid b) . sfactionD allFoes <- getsState $ actorRegularList (isAtWar fact) (blid b) return $ any (adjacent (bpos b) . bpos) allFoes -- keep it lazy -- | Require the actor's HP is low enough.
340
condAnyFoeAdjM aid = do b <- getsState $ getActorBody aid fact <- getsState $ (EM.! bfid b) . sfactionD allFoes <- getsState $ actorRegularList (isAtWar fact) (blid b) return $ any (adjacent (bpos b) . bpos) allFoes -- keep it lazy -- | Require the actor's HP is low enough.
284
false
true
0
13
68
124
59
65
null
null
ganeti-github-testing/ganeti-test-1
src/Ganeti/Constants.hs
bsd-2-clause
oobHealth :: String oobHealth = Types.oobCommandToRaw OobHealth
63
oobHealth :: String oobHealth = Types.oobCommandToRaw OobHealth
63
oobHealth = Types.oobCommandToRaw OobHealth
43
false
true
0
6
6
16
8
8
null
null
ksaveljev/hake-2
src/Game/Monsters/MChick.hs
bsd-3-clause
spMonsterChick :: Ref EdictT -> Quake () spMonsterChick selfRef = do gameImport <- use $ gameBaseGlobals.gbGameImport let soundIndex = gameImport^.giSoundIndex modelIndex = gameImport^.giModelIndex linkEntity = gameImport^.giLinkEntity soundIndex (Just "chick/chkatck1.wav") >>= (mChickGlobals.mChickSoundMissilePrelaunch .=) soundIndex (Just "chick/chkatck2.wav") >>= (mChickGlobals.mChickSoundMissileLaunch .=) soundIndex (Just "chick/chkatck3.wav") >>= (mChickGlobals.mChickSoundMeleeSwing .=) soundIndex (Just "chick/chkatck4.wav") >>= (mChickGlobals.mChickSoundMeleeHit .=) soundIndex (Just "chick/chkatck5.wav") >>= (mChickGlobals.mChickSoundMissileReload .=) soundIndex (Just "chick/chkdeth1.wav") >>= (mChickGlobals.mChickSoundDeath1 .=) soundIndex (Just "chick/chkdeth2.wav") >>= (mChickGlobals.mChickSoundDeath2 .=) soundIndex (Just "chick/chkfall1.wav") >>= (mChickGlobals.mChickSoundFallDown .=) soundIndex (Just "chick/chkidle1.wav") >>= (mChickGlobals.mChickSoundIdle1 .=) soundIndex (Just "chick/chkidle2.wav") >>= (mChickGlobals.mChickSoundIdle2 .=) soundIndex (Just "chick/chkpain1.wav") >>= (mChickGlobals.mChickSoundPain1 .=) soundIndex (Just "chick/chkpain2.wav") >>= (mChickGlobals.mChickSoundPain2 .=) soundIndex (Just "chick/chkpain3.wav") >>= (mChickGlobals.mChickSoundPain3 .=) soundIndex (Just "chick/chksght1.wav") >>= (mChickGlobals.mChickSoundSight .=) soundIndex (Just "chick/chksrch1.wav") >>= (mChickGlobals.mChickSoundSearch .=) modelIdx <- modelIndex (Just "models/monsters/bitch/tris.md2") modifyRef selfRef (\v -> v & eMoveType .~ Constants.moveTypeStep & eSolid .~ Constants.solidBbox & eEntityState.esModelIndex .~ modelIdx & eMins .~ V3 (-16) (-16) 0 & eMaxs .~ V3 16 16 56 & eHealth .~ 175 & eGibHealth .~ (-70) & eMass .~ 200 & ePain .~ Just chickPain & eDie .~ Just chickDie & eMonsterInfo.miStand .~ Just chickStand & eMonsterInfo.miWalk .~ Just chickWalk & eMonsterInfo.miRun .~ Just chickRun & eMonsterInfo.miDodge .~ Just chickDodge & eMonsterInfo.miAttack .~ Just chickAttack & eMonsterInfo.miMelee .~ Just chickMelee & eMonsterInfo.miSight .~ Just chickSight) linkEntity selfRef modifyRef selfRef (\v -> v & eMonsterInfo.miCurrentMove .~ Just chickMoveStand & eMonsterInfo.miScale .~ modelScale) void $ think GameAI.walkMonsterStart selfRef
2,977
spMonsterChick :: Ref EdictT -> Quake () spMonsterChick selfRef = do gameImport <- use $ gameBaseGlobals.gbGameImport let soundIndex = gameImport^.giSoundIndex modelIndex = gameImport^.giModelIndex linkEntity = gameImport^.giLinkEntity soundIndex (Just "chick/chkatck1.wav") >>= (mChickGlobals.mChickSoundMissilePrelaunch .=) soundIndex (Just "chick/chkatck2.wav") >>= (mChickGlobals.mChickSoundMissileLaunch .=) soundIndex (Just "chick/chkatck3.wav") >>= (mChickGlobals.mChickSoundMeleeSwing .=) soundIndex (Just "chick/chkatck4.wav") >>= (mChickGlobals.mChickSoundMeleeHit .=) soundIndex (Just "chick/chkatck5.wav") >>= (mChickGlobals.mChickSoundMissileReload .=) soundIndex (Just "chick/chkdeth1.wav") >>= (mChickGlobals.mChickSoundDeath1 .=) soundIndex (Just "chick/chkdeth2.wav") >>= (mChickGlobals.mChickSoundDeath2 .=) soundIndex (Just "chick/chkfall1.wav") >>= (mChickGlobals.mChickSoundFallDown .=) soundIndex (Just "chick/chkidle1.wav") >>= (mChickGlobals.mChickSoundIdle1 .=) soundIndex (Just "chick/chkidle2.wav") >>= (mChickGlobals.mChickSoundIdle2 .=) soundIndex (Just "chick/chkpain1.wav") >>= (mChickGlobals.mChickSoundPain1 .=) soundIndex (Just "chick/chkpain2.wav") >>= (mChickGlobals.mChickSoundPain2 .=) soundIndex (Just "chick/chkpain3.wav") >>= (mChickGlobals.mChickSoundPain3 .=) soundIndex (Just "chick/chksght1.wav") >>= (mChickGlobals.mChickSoundSight .=) soundIndex (Just "chick/chksrch1.wav") >>= (mChickGlobals.mChickSoundSearch .=) modelIdx <- modelIndex (Just "models/monsters/bitch/tris.md2") modifyRef selfRef (\v -> v & eMoveType .~ Constants.moveTypeStep & eSolid .~ Constants.solidBbox & eEntityState.esModelIndex .~ modelIdx & eMins .~ V3 (-16) (-16) 0 & eMaxs .~ V3 16 16 56 & eHealth .~ 175 & eGibHealth .~ (-70) & eMass .~ 200 & ePain .~ Just chickPain & eDie .~ Just chickDie & eMonsterInfo.miStand .~ Just chickStand & eMonsterInfo.miWalk .~ Just chickWalk & eMonsterInfo.miRun .~ Just chickRun & eMonsterInfo.miDodge .~ Just chickDodge & eMonsterInfo.miAttack .~ Just chickAttack & eMonsterInfo.miMelee .~ Just chickMelee & eMonsterInfo.miSight .~ Just chickSight) linkEntity selfRef modifyRef selfRef (\v -> v & eMonsterInfo.miCurrentMove .~ Just chickMoveStand & eMonsterInfo.miScale .~ modelScale) void $ think GameAI.walkMonsterStart selfRef
2,977
spMonsterChick selfRef = do gameImport <- use $ gameBaseGlobals.gbGameImport let soundIndex = gameImport^.giSoundIndex modelIndex = gameImport^.giModelIndex linkEntity = gameImport^.giLinkEntity soundIndex (Just "chick/chkatck1.wav") >>= (mChickGlobals.mChickSoundMissilePrelaunch .=) soundIndex (Just "chick/chkatck2.wav") >>= (mChickGlobals.mChickSoundMissileLaunch .=) soundIndex (Just "chick/chkatck3.wav") >>= (mChickGlobals.mChickSoundMeleeSwing .=) soundIndex (Just "chick/chkatck4.wav") >>= (mChickGlobals.mChickSoundMeleeHit .=) soundIndex (Just "chick/chkatck5.wav") >>= (mChickGlobals.mChickSoundMissileReload .=) soundIndex (Just "chick/chkdeth1.wav") >>= (mChickGlobals.mChickSoundDeath1 .=) soundIndex (Just "chick/chkdeth2.wav") >>= (mChickGlobals.mChickSoundDeath2 .=) soundIndex (Just "chick/chkfall1.wav") >>= (mChickGlobals.mChickSoundFallDown .=) soundIndex (Just "chick/chkidle1.wav") >>= (mChickGlobals.mChickSoundIdle1 .=) soundIndex (Just "chick/chkidle2.wav") >>= (mChickGlobals.mChickSoundIdle2 .=) soundIndex (Just "chick/chkpain1.wav") >>= (mChickGlobals.mChickSoundPain1 .=) soundIndex (Just "chick/chkpain2.wav") >>= (mChickGlobals.mChickSoundPain2 .=) soundIndex (Just "chick/chkpain3.wav") >>= (mChickGlobals.mChickSoundPain3 .=) soundIndex (Just "chick/chksght1.wav") >>= (mChickGlobals.mChickSoundSight .=) soundIndex (Just "chick/chksrch1.wav") >>= (mChickGlobals.mChickSoundSearch .=) modelIdx <- modelIndex (Just "models/monsters/bitch/tris.md2") modifyRef selfRef (\v -> v & eMoveType .~ Constants.moveTypeStep & eSolid .~ Constants.solidBbox & eEntityState.esModelIndex .~ modelIdx & eMins .~ V3 (-16) (-16) 0 & eMaxs .~ V3 16 16 56 & eHealth .~ 175 & eGibHealth .~ (-70) & eMass .~ 200 & ePain .~ Just chickPain & eDie .~ Just chickDie & eMonsterInfo.miStand .~ Just chickStand & eMonsterInfo.miWalk .~ Just chickWalk & eMonsterInfo.miRun .~ Just chickRun & eMonsterInfo.miDodge .~ Just chickDodge & eMonsterInfo.miAttack .~ Just chickAttack & eMonsterInfo.miMelee .~ Just chickMelee & eMonsterInfo.miSight .~ Just chickSight) linkEntity selfRef modifyRef selfRef (\v -> v & eMonsterInfo.miCurrentMove .~ Just chickMoveStand & eMonsterInfo.miScale .~ modelScale) void $ think GameAI.walkMonsterStart selfRef
2,936
false
true
0
43
918
703
343
360
null
null
arthurmgo/regex-ftc
src/Regex.hs
bsd-3-clause
printRe (Lit '.') = "\\."
30
printRe (Lit '.') = "\\."
30
printRe (Lit '.') = "\\."
30
false
false
0
6
9
16
7
9
null
null
kolmodin/cabal
Cabal/Distribution/Simple/SrcDist.hs
bsd-3-clause
maybeCreateDefaultSetupScript :: FilePath -> IO () maybeCreateDefaultSetupScript targetDir = do mSetupFile <- findSetupFile targetDir case mSetupFile of Just _setupFile -> return () Nothing -> do writeUTF8File (targetDir </> "Setup.hs") $ unlines [ "import Distribution.Simple", "main = defaultMain"] -- | Find the main executable file.
379
maybeCreateDefaultSetupScript :: FilePath -> IO () maybeCreateDefaultSetupScript targetDir = do mSetupFile <- findSetupFile targetDir case mSetupFile of Just _setupFile -> return () Nothing -> do writeUTF8File (targetDir </> "Setup.hs") $ unlines [ "import Distribution.Simple", "main = defaultMain"] -- | Find the main executable file.
379
maybeCreateDefaultSetupScript targetDir = do mSetupFile <- findSetupFile targetDir case mSetupFile of Just _setupFile -> return () Nothing -> do writeUTF8File (targetDir </> "Setup.hs") $ unlines [ "import Distribution.Simple", "main = defaultMain"] -- | Find the main executable file.
328
false
true
0
15
86
87
41
46
null
null
Fermat/Gottlob
Language/ProofChecking.hs
bsd-3-clause
insertPrVar :: VName -> PreTerm -> PreTerm -> Global () insertPrVar x p f = do env <- lift get lift $ put $ extendLocalProof x p f env return () -- Check if the 'free' set variable in a preterm is -- previously defined.
226
insertPrVar :: VName -> PreTerm -> PreTerm -> Global () insertPrVar x p f = do env <- lift get lift $ put $ extendLocalProof x p f env return () -- Check if the 'free' set variable in a preterm is -- previously defined.
226
insertPrVar x p f = do env <- lift get lift $ put $ extendLocalProof x p f env return () -- Check if the 'free' set variable in a preterm is -- previously defined.
170
false
true
0
10
51
80
36
44
null
null
karamellpelle/grid
source/OpenGL/ES2/Values.hs
gpl-3.0
gl_SUBPIXEL_BITS :: GLenum gl_SUBPIXEL_BITS = 0x0D50
67
gl_SUBPIXEL_BITS :: GLenum gl_SUBPIXEL_BITS = 0x0D50
67
gl_SUBPIXEL_BITS = 0x0D50
40
false
true
0
4
20
11
6
5
null
null
briansteffens/basm
src/Parser.hs
gpl-2.0
disp rem = (NoDisplacement , rem)
71
disp rem = (NoDisplacement , rem)
71
disp rem = (NoDisplacement , rem)
71
false
false
1
5
43
18
8
10
null
null
xmonad/xmonad-contrib
XMonad/Layout/Magnifier.hs
bsd-3-clause
-- | Increase the size of the window that has focus, unless if it is one of the -- master windows. magnifier' :: l a -> ModifiedLayout Magnifier l a magnifier' = magnifiercz' 1.5
178
magnifier' :: l a -> ModifiedLayout Magnifier l a magnifier' = magnifiercz' 1.5
79
magnifier' = magnifiercz' 1.5
29
true
true
0
6
33
30
15
15
null
null
eijian/raytracer
test/Main-t7.hs
bsd-3-clause
nloop = 2000000 :: Int
22
nloop = 2000000 :: Int
22
nloop = 2000000 :: Int
22
false
false
0
4
4
9
5
4
null
null
Ongy/monky
Monky/MPD.hs
lgpl-3.0
parseStatusRec m [] = Status { volume = fromJust $ getInt "volume" , repeats = fromJust $ getBool "repeat" , random = fromJust $ getBool "random" , single = getBool "single" , consume = getBool "consume" , playlist = fromJust $ getInt "playlist" , playlistLength = fromJust $ getInt "playlistlength" , state = getState_ m , song = getInt "song" , songId = getInt "songid" , nextSong = getInt "nextsong" , nextSongId = getInt "nextsongid" , time = fmap (readText . T.takeWhile (/= ':')) $getVal "time" , elapsed = read . T.unpack <$> M.lookup "elapsed" m , duration = getInt "duration" , bitrate = getInt "bitrate" , xfade = getInt "xfade" , mixrAmpdb = fromJust . fmap readF $ getVal "mixrampdb" , mixrAmpDelay = getInt "mixrampdelay" , audio = getAudio m , updating = getInt "updating_db" , mpderror = M.lookup "error" m } where getVal = flip M.lookup m getBool = fmap (== ("1" :: Text)) . getVal getInt = fmap readText . getVal getState_ = getState . fromJust . M.lookup "state" getAudio = fmap getAudioTuple . M.lookup "audio" readF t = let (Right (x, _)) = R.rational t in x
1,314
parseStatusRec m [] = Status { volume = fromJust $ getInt "volume" , repeats = fromJust $ getBool "repeat" , random = fromJust $ getBool "random" , single = getBool "single" , consume = getBool "consume" , playlist = fromJust $ getInt "playlist" , playlistLength = fromJust $ getInt "playlistlength" , state = getState_ m , song = getInt "song" , songId = getInt "songid" , nextSong = getInt "nextsong" , nextSongId = getInt "nextsongid" , time = fmap (readText . T.takeWhile (/= ':')) $getVal "time" , elapsed = read . T.unpack <$> M.lookup "elapsed" m , duration = getInt "duration" , bitrate = getInt "bitrate" , xfade = getInt "xfade" , mixrAmpdb = fromJust . fmap readF $ getVal "mixrampdb" , mixrAmpDelay = getInt "mixrampdelay" , audio = getAudio m , updating = getInt "updating_db" , mpderror = M.lookup "error" m } where getVal = flip M.lookup m getBool = fmap (== ("1" :: Text)) . getVal getInt = fmap readText . getVal getState_ = getState . fromJust . M.lookup "state" getAudio = fmap getAudioTuple . M.lookup "audio" readF t = let (Right (x, _)) = R.rational t in x
1,314
parseStatusRec m [] = Status { volume = fromJust $ getInt "volume" , repeats = fromJust $ getBool "repeat" , random = fromJust $ getBool "random" , single = getBool "single" , consume = getBool "consume" , playlist = fromJust $ getInt "playlist" , playlistLength = fromJust $ getInt "playlistlength" , state = getState_ m , song = getInt "song" , songId = getInt "songid" , nextSong = getInt "nextsong" , nextSongId = getInt "nextsongid" , time = fmap (readText . T.takeWhile (/= ':')) $getVal "time" , elapsed = read . T.unpack <$> M.lookup "elapsed" m , duration = getInt "duration" , bitrate = getInt "bitrate" , xfade = getInt "xfade" , mixrAmpdb = fromJust . fmap readF $ getVal "mixrampdb" , mixrAmpDelay = getInt "mixrampdelay" , audio = getAudio m , updating = getInt "updating_db" , mpderror = M.lookup "error" m } where getVal = flip M.lookup m getBool = fmap (== ("1" :: Text)) . getVal getInt = fmap readText . getVal getState_ = getState . fromJust . M.lookup "state" getAudio = fmap getAudioTuple . M.lookup "audio" readF t = let (Right (x, _)) = R.rational t in x
1,314
false
false
0
11
426
408
214
194
null
null
ulricha/dsh
src/Database/DSH/CL/Typing.hs
bsd-3-clause
tyPrim1 Nub ty = catchError (listTy ty) (opTyErr "nub" [ty]) >> pure ty
79
tyPrim1 Nub ty = catchError (listTy ty) (opTyErr "nub" [ty]) >> pure ty
79
tyPrim1 Nub ty = catchError (listTy ty) (opTyErr "nub" [ty]) >> pure ty
79
false
false
0
9
20
40
19
21
null
null
nmk/Spock
src/Web/Spock/Internal/CoreAction.hs
bsd-3-clause
-- | Basic authentification -- provide a title for the prompt and a function to validate -- user and password. Usage example: -- -- > get "/my-secret-page" $ -- > requireBasicAuth "Secret Page" (\user pass -> return (user == "admin" && pass == "1234")) $ -- > do html "This is top secret content. Login using that secret code I provided ;-)" -- requireBasicAuth :: MonadIO m => T.Text -> (T.Text -> T.Text -> m Bool) -> ActionCtxT ctx m a -> ActionCtxT ctx m a requireBasicAuth realmTitle authFun cont = do mAuthHeader <- header "Authorization" case mAuthHeader of Nothing -> authFailed Just authHeader -> let (_, rawValue) = T.breakOn " " authHeader (user, rawPass) = (T.breakOn ":" . T.decodeUtf8 . B64.decodeLenient . T.encodeUtf8 . T.strip) rawValue pass = T.drop 1 rawPass in do isOk <- lift $ authFun user pass if isOk then cont else authFailed where authFailed = do setStatus status401 setMultiHeader MultiHeaderWWWAuth ("Basic realm=\"" <> realmTitle <> "\"") html "<h1>Authentication required.</h1>" -- | Get the context of the current request
1,304
requireBasicAuth :: MonadIO m => T.Text -> (T.Text -> T.Text -> m Bool) -> ActionCtxT ctx m a -> ActionCtxT ctx m a requireBasicAuth realmTitle authFun cont = do mAuthHeader <- header "Authorization" case mAuthHeader of Nothing -> authFailed Just authHeader -> let (_, rawValue) = T.breakOn " " authHeader (user, rawPass) = (T.breakOn ":" . T.decodeUtf8 . B64.decodeLenient . T.encodeUtf8 . T.strip) rawValue pass = T.drop 1 rawPass in do isOk <- lift $ authFun user pass if isOk then cont else authFailed where authFailed = do setStatus status401 setMultiHeader MultiHeaderWWWAuth ("Basic realm=\"" <> realmTitle <> "\"") html "<h1>Authentication required.</h1>" -- | Get the context of the current request
955
requireBasicAuth realmTitle authFun cont = do mAuthHeader <- header "Authorization" case mAuthHeader of Nothing -> authFailed Just authHeader -> let (_, rawValue) = T.breakOn " " authHeader (user, rawPass) = (T.breakOn ":" . T.decodeUtf8 . B64.decodeLenient . T.encodeUtf8 . T.strip) rawValue pass = T.drop 1 rawPass in do isOk <- lift $ authFun user pass if isOk then cont else authFailed where authFailed = do setStatus status401 setMultiHeader MultiHeaderWWWAuth ("Basic realm=\"" <> realmTitle <> "\"") html "<h1>Authentication required.</h1>" -- | Get the context of the current request
839
true
true
0
21
424
262
129
133
null
null
chetant/LibClang
src/Clang/Cursor.hs
bsd-3-clause
getResultType :: ClangBase m => FFI.Cursor s' -> ClangT s m (FFI.Type s) getResultType c = liftIO $ FFI.getCursorResultType mkProxy c
133
getResultType :: ClangBase m => FFI.Cursor s' -> ClangT s m (FFI.Type s) getResultType c = liftIO $ FFI.getCursorResultType mkProxy c
133
getResultType c = liftIO $ FFI.getCursorResultType mkProxy c
60
false
true
2
11
20
61
27
34
null
null
tolysz/prepare-ghcjs
spec-lts8/cabal/cabal-install/Distribution/Client/Dependency/TopDown.hs
bsd-3-clause
showFailure (DependencyConflict pkg dep installedConstraint conflicts) = "dependencies conflict: " ++ displayPkg pkg ++ " requires " ++ (if installedConstraint then "an installed instance of " else "") ++ displayDep dep ++ " however:\n" ++ unlines [ showExclusionReason (packageId pkg') reason | (pkg', reasons) <- conflicts, reason <- reasons ]
371
showFailure (DependencyConflict pkg dep installedConstraint conflicts) = "dependencies conflict: " ++ displayPkg pkg ++ " requires " ++ (if installedConstraint then "an installed instance of " else "") ++ displayDep dep ++ " however:\n" ++ unlines [ showExclusionReason (packageId pkg') reason | (pkg', reasons) <- conflicts, reason <- reasons ]
371
showFailure (DependencyConflict pkg dep installedConstraint conflicts) = "dependencies conflict: " ++ displayPkg pkg ++ " requires " ++ (if installedConstraint then "an installed instance of " else "") ++ displayDep dep ++ " however:\n" ++ unlines [ showExclusionReason (packageId pkg') reason | (pkg', reasons) <- conflicts, reason <- reasons ]
371
false
false
12
9
75
109
51
58
null
null
arybczak/happstack-server
src/Happstack/Server/Internal/Types.hs
bsd-3-clause
getHeader :: HasHeaders r => String -> r -> Maybe ByteString getHeader = getHeaderBS . pack
91
getHeader :: HasHeaders r => String -> r -> Maybe ByteString getHeader = getHeaderBS . pack
91
getHeader = getHeaderBS . pack
30
false
true
0
9
15
39
17
22
null
null
rrnewton/accelerate
Data/Array/Accelerate/Smart.hs
bsd-3-clause
-- Operators from Fractional mkFDiv :: (Elt t, IsFloating t) => Exp t -> Exp t -> Exp t mkFDiv x y = Exp $ PrimFDiv floatingType `PrimApp` tup2 (x, y)
151
mkFDiv :: (Elt t, IsFloating t) => Exp t -> Exp t -> Exp t mkFDiv x y = Exp $ PrimFDiv floatingType `PrimApp` tup2 (x, y)
121
mkFDiv x y = Exp $ PrimFDiv floatingType `PrimApp` tup2 (x, y)
62
true
true
0
8
31
71
36
35
null
null
expipiplus1/vulkan
generate-new/xr/XR/RenderParams.hs
bsd-3-clause
vulkanHaskellNames :: RenderParams -> Vector Name vulkanHaskellNames ps@RenderParams {..} = vulkanNewtypes ps <> fromList ( typeNameWithModule (ModName vulkanTypesModule) . mkEmptyDataName <$> vulkanDispatchableHandleNames )
236
vulkanHaskellNames :: RenderParams -> Vector Name vulkanHaskellNames ps@RenderParams {..} = vulkanNewtypes ps <> fromList ( typeNameWithModule (ModName vulkanTypesModule) . mkEmptyDataName <$> vulkanDispatchableHandleNames )
236
vulkanHaskellNames ps@RenderParams {..} = vulkanNewtypes ps <> fromList ( typeNameWithModule (ModName vulkanTypesModule) . mkEmptyDataName <$> vulkanDispatchableHandleNames )
186
false
true
0
10
34
60
29
31
null
null
elben/typing-haskell-in-haskell
StaticPrelude.hs
bsd-3-clause
hugs_ErrorCfun = "Hugs_Error" :>: (Forall [Star] ([] :=> (tIOError `fn` TAp tIOResult (TGen 0))))
139
hugs_ErrorCfun = "Hugs_Error" :>: (Forall [Star] ([] :=> (tIOError `fn` TAp tIOResult (TGen 0))))
139
hugs_ErrorCfun = "Hugs_Error" :>: (Forall [Star] ([] :=> (tIOError `fn` TAp tIOResult (TGen 0))))
139
false
false
0
14
55
50
27
23
null
null
trbauer/native-time
System/Time/Native.hs
mit
nowMicros :: IO Word64 nowMicros = fmap (`div`1000) getNanos
60
nowMicros :: IO Word64 nowMicros = fmap (`div`1000) getNanos
60
nowMicros = fmap (`div`1000) getNanos
37
false
true
0
6
8
25
14
11
null
null
Fuuzetsu/lens
src/Control/Lens/Fold.hs
bsd-3-clause
-- | Fold over the elements of a structure with an index, associating to the left, but /strictly/. -- -- When you don't need access to the index then 'foldlOf'' is more flexible in what it accepts. -- -- @ -- 'foldlOf'' l ≡ 'ifoldlOf'' l '.' 'const' -- @ -- -- @ -- 'ifoldlOf'' :: 'IndexedGetter' i s a -> (i -> r -> a -> r) -> r -> s -> r -- 'ifoldlOf'' :: 'IndexedFold' i s a -> (i -> r -> a -> r) -> r -> s -> r -- 'ifoldlOf'' :: 'IndexedLens'' i s a -> (i -> r -> a -> r) -> r -> s -> r -- 'ifoldlOf'' :: 'IndexedTraversal'' i s a -> (i -> r -> a -> r) -> r -> s -> r -- @ ifoldlOf' :: IndexedGetting i (Endo (r -> r)) s a -> (i -> r -> a -> r) -> r -> s -> r ifoldlOf' l f z0 xs = ifoldrOf l f' id xs z0 where f' i x k z = k $! f i z x
766
ifoldlOf' :: IndexedGetting i (Endo (r -> r)) s a -> (i -> r -> a -> r) -> r -> s -> r ifoldlOf' l f z0 xs = ifoldrOf l f' id xs z0 where f' i x k z = k $! f i z x
166
ifoldlOf' l f z0 xs = ifoldrOf l f' id xs z0 where f' i x k z = k $! f i z x
79
true
true
0
10
213
125
69
56
null
null
music-suite/music-score
src/Music/Time/Types.hs
bsd-3-clause
beforeOnset :: Time -> Span -> Bool t `beforeOnset` s = t <= _onsetS s
70
beforeOnset :: Time -> Span -> Bool t `beforeOnset` s = t <= _onsetS s
70
t `beforeOnset` s = t <= _onsetS s
34
false
true
3
8
14
37
17
20
null
null
bredelings/BAli-Phy
haskell/Data/ReadFile.hs
gpl-2.0
read_file_lines filename = list_from_vector $ builtin_read_file_lines (list_to_string filename)
95
read_file_lines filename = list_from_vector $ builtin_read_file_lines (list_to_string filename)
95
read_file_lines filename = list_from_vector $ builtin_read_file_lines (list_to_string filename)
95
false
false
0
8
7
22
10
12
null
null
wkoiking/my-parser
src/MyParser/Numeral.hs
bsd-3-clause
showHex :: (Integral a,Show a) => a -> String showHex x = showIntAtBase 16 intToDigit x ""
90
showHex :: (Integral a,Show a) => a -> String showHex x = showIntAtBase 16 intToDigit x ""
90
showHex x = showIntAtBase 16 intToDigit x ""
44
false
true
0
6
16
42
21
21
null
null
danr/hipspec
testsuite/prod/zeno_version/PropT01.hs
gpl-3.0
isort :: [Nat] -> [Nat] isort [] = []
37
isort :: [Nat] -> [Nat] isort [] = []
37
isort [] = []
13
false
true
0
6
8
28
15
13
null
null
michaxm/hadoop-rpc-exploration
app/Main.hs
bsd-3-clause
listFiles :: Maybe HadoopConfig -> String -> IO () listFiles config path = do files <- maybe runHdfs runHdfs' config $ getListing' $ BC.pack path print files
161
listFiles :: Maybe HadoopConfig -> String -> IO () listFiles config path = do files <- maybe runHdfs runHdfs' config $ getListing' $ BC.pack path print files
161
listFiles config path = do files <- maybe runHdfs runHdfs' config $ getListing' $ BC.pack path print files
110
false
true
0
11
30
70
30
40
null
null
mpickering/HaRe
old/testing/removeDef/D3_AstOut.hs
bsd-3-clause
sumSquares [] = 0
17
sumSquares [] = 0
17
sumSquares [] = 0
17
false
false
0
6
3
11
5
6
null
null
sidraval/pusher-haskell
src/Network/Pusher/Channel.hs
mit
queryParamForPrefix (Just p) = "&filter_by_prefix=" ++ p
56
queryParamForPrefix (Just p) = "&filter_by_prefix=" ++ p
56
queryParamForPrefix (Just p) = "&filter_by_prefix=" ++ p
56
false
false
0
7
6
19
9
10
null
null
HaskellDC/neo4j-cypher
tests/Language/cypher-test-suite.hs
bsd-3-clause
main :: IO () main = $defaultMainGenerator
42
main :: IO () main = $defaultMainGenerator
42
main = $defaultMainGenerator
28
false
true
0
6
6
17
8
9
null
null
kazu-yamamoto/word8
Data/Word8.hs
bsd-3-clause
isAsciiUpper :: Word8 -> Bool isAsciiUpper w = _A <= w && w <= _Z
65
isAsciiUpper :: Word8 -> Bool isAsciiUpper w = _A <= w && w <= _Z
65
isAsciiUpper w = _A <= w && w <= _Z
35
false
true
2
7
14
38
17
21
null
null
juhp/stack
test/integration/tests/no-rerun-tests/Main.hs
bsd-3-clause
main :: IO () main = do stack ["test"] exists1 <- doesFileExist "foo" unless exists1 $ error "exists1 should be True" removeFile "foo" stack ["test", "--no-rerun-tests"] exists2 <- doesFileExist "foo" when exists2 $ error "exists2 should be False"
261
main :: IO () main = do stack ["test"] exists1 <- doesFileExist "foo" unless exists1 $ error "exists1 should be True" removeFile "foo" stack ["test", "--no-rerun-tests"] exists2 <- doesFileExist "foo" when exists2 $ error "exists2 should be False"
261
main = do stack ["test"] exists1 <- doesFileExist "foo" unless exists1 $ error "exists1 should be True" removeFile "foo" stack ["test", "--no-rerun-tests"] exists2 <- doesFileExist "foo" when exists2 $ error "exists2 should be False"
247
false
true
0
8
51
89
38
51
null
null
sboosali/wagon-challenge
sources/Wagon/First.hs
mit
fTextualRowSummary :: F.Fold (Maybe' String) TextualRowSummary fTextualRowSummary = TextualRowSummary <$> fTextualCountShortest <*> fTextualCountLongest <*> fTextualAverageLength
181
fTextualRowSummary :: F.Fold (Maybe' String) TextualRowSummary fTextualRowSummary = TextualRowSummary <$> fTextualCountShortest <*> fTextualCountLongest <*> fTextualAverageLength
181
fTextualRowSummary = TextualRowSummary <$> fTextualCountShortest <*> fTextualCountLongest <*> fTextualAverageLength
118
false
true
8
7
17
44
22
22
null
null
mcschroeder/ghc
compiler/prelude/PrelRules.hs
bsd-3-clause
liftLitDynFlags :: (DynFlags -> Literal -> Literal) -> RuleM CoreExpr liftLitDynFlags f = do dflags <- getDynFlags [Lit lit] <- getArgs return $ Lit (f dflags lit)
169
liftLitDynFlags :: (DynFlags -> Literal -> Literal) -> RuleM CoreExpr liftLitDynFlags f = do dflags <- getDynFlags [Lit lit] <- getArgs return $ Lit (f dflags lit)
169
liftLitDynFlags f = do dflags <- getDynFlags [Lit lit] <- getArgs return $ Lit (f dflags lit)
99
false
true
0
10
32
70
33
37
null
null
beni55/text
tests/Tests/Properties.hs
bsd-2-clause
unf :: Int -> Char -> Maybe (Char, Char) unf n c | fromEnum c * 100 > n = Nothing | otherwise = Just (c, succ c)
131
unf :: Int -> Char -> Maybe (Char, Char) unf n c | fromEnum c * 100 > n = Nothing | otherwise = Just (c, succ c)
131
unf n c | fromEnum c * 100 > n = Nothing | otherwise = Just (c, succ c)
90
false
true
0
10
46
71
34
37
null
null
conal/hermit
src/HERMIT/Kure.hs
bsd-2-clause
-- | Rewrite all children of a coercion of the form: @AppCo@ 'Coercion' 'Coercion' appCoAllR :: (ExtendPath c Crumb, Monad m) => Rewrite c m Coercion -> Rewrite c m Coercion -> Rewrite c m Coercion appCoAllR r1 r2 = appCoT r1 r2 AppCo
234
appCoAllR :: (ExtendPath c Crumb, Monad m) => Rewrite c m Coercion -> Rewrite c m Coercion -> Rewrite c m Coercion appCoAllR r1 r2 = appCoT r1 r2 AppCo
151
appCoAllR r1 r2 = appCoT r1 r2 AppCo
36
true
true
0
8
43
70
34
36
null
null
nushio3/Paraiso
examples/Hydro/HydroMain.hs
bsd-3-clause
intGDV :: DynValue intGDV = DynValue{DVal.realm = Scalar, DVal.typeRep = typeOf (0::Int)}
89
intGDV :: DynValue intGDV = DynValue{DVal.realm = Scalar, DVal.typeRep = typeOf (0::Int)}
89
intGDV = DynValue{DVal.realm = Scalar, DVal.typeRep = typeOf (0::Int)}
70
false
true
0
9
11
49
24
25
null
null
mvoidex/data-serialization-postgresql
src/Data/Serialization/Postgresql.hs
bsd-3-clause
-- | Create table if not exists createIfNot :: (InTable a, Serializable Pgser a) => Connection -> Table a -> IO Int64 createIfNot = createCommand "create table if not exists"
174
createIfNot :: (InTable a, Serializable Pgser a) => Connection -> Table a -> IO Int64 createIfNot = createCommand "create table if not exists"
142
createIfNot = createCommand "create table if not exists"
56
true
true
0
8
29
46
23
23
null
null
jBugman/fun-lang
src/Fun/Desugar.hs
mit
addReturn (L [ KW "method" , recv , name , args , results , body ]) = L [ KW "method" , recv , name , args , results , withReturn body ]
140
addReturn (L [ KW "method" , recv , name , args , results , body ]) = L [ KW "method" , recv , name , args , results , withReturn body ]
140
addReturn (L [ KW "method" , recv , name , args , results , body ]) = L [ KW "method" , recv , name , args , results , withReturn body ]
140
false
false
0
8
36
64
35
29
null
null
trskop/cabal
Cabal/Distribution/System.hs
bsd-3-clause
-- Utils: ident :: Parse.ReadP r String ident = liftM2 (:) first rest where first = Parse.satisfy Char.isAlpha rest = Parse.munch (\c -> Char.isAlphaNum c || c == '_' || c == '-')
190
ident :: Parse.ReadP r String ident = liftM2 (:) first rest where first = Parse.satisfy Char.isAlpha rest = Parse.munch (\c -> Char.isAlphaNum c || c == '_' || c == '-')
179
ident = liftM2 (:) first rest where first = Parse.satisfy Char.isAlpha rest = Parse.munch (\c -> Char.isAlphaNum c || c == '_' || c == '-')
149
true
true
1
13
43
82
42
40
null
null
ivan-m/Graphalyze
Data/Graph/Analysis/Algorithms/Common.hs
bsd-2-clause
alsoRegular _ [n] = [[n]]
28
alsoRegular _ [n] = [[n]]
28
alsoRegular _ [n] = [[n]]
28
false
false
0
6
7
20
11
9
null
null
sgillespie/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
funEqCanDischargeFR :: CtFlavourRole -> CtFlavourRole -> Bool funEqCanDischargeFR (_, ReprEq) (_, NomEq) = False
115
funEqCanDischargeFR :: CtFlavourRole -> CtFlavourRole -> Bool funEqCanDischargeFR (_, ReprEq) (_, NomEq) = False
115
funEqCanDischargeFR (_, ReprEq) (_, NomEq) = False
53
false
true
0
6
16
36
20
16
null
null
thegreatpissant/haskell
LearnYouaHaskell/baby.hs
bsd-2-clause
sayMe x = "Not between 1 and 5"
31
sayMe x = "Not between 1 and 5"
31
sayMe x = "Not between 1 and 5"
31
false
false
0
4
7
9
4
5
null
null
wuzzeb/hs-webdriver
src/Test/WebDriver/Commands.hs
bsd-3-clause
-- |Get the current page source getSource :: WebDriver wd => wd Text getSource = doSessCommand methodGet "/source" Null
119
getSource :: WebDriver wd => wd Text getSource = doSessCommand methodGet "/source" Null
87
getSource = doSessCommand methodGet "/source" Null
50
true
true
0
6
18
29
14
15
null
null
jgoerzen/twidge
OAuth.hs
gpl-2.0
obfuscatedTwitterKeys = ("jRlf9pXnU7uEV5ZcxrJmc", "L17bXFykkLYz4TBCmet1wuX9VtXbLq8Xj4Lif42O4ew")
111
obfuscatedTwitterKeys = ("jRlf9pXnU7uEV5ZcxrJmc", "L17bXFykkLYz4TBCmet1wuX9VtXbLq8Xj4Lif42O4ew")
111
obfuscatedTwitterKeys = ("jRlf9pXnU7uEV5ZcxrJmc", "L17bXFykkLYz4TBCmet1wuX9VtXbLq8Xj4Lif42O4ew")
111
false
false
1
5
18
15
7
8
null
null
edsko/cabal
Cabal/src/Distribution/Version.hs
bsd-3-clause
nonEmpty :: VersionInterval -> Bool nonEmpty (_, NoUpperBound ) = True
86
nonEmpty :: VersionInterval -> Bool nonEmpty (_, NoUpperBound ) = True
86
nonEmpty (_, NoUpperBound ) = True
50
false
true
0
6
26
24
13
11
null
null
hakuch/Pulsar
src/Pulsar/Parse.hs
apache-2.0
reserved :: String -> Parser () reserved = Tok.reserved Asm.lexer
65
reserved :: String -> Parser () reserved = Tok.reserved Asm.lexer
65
reserved = Tok.reserved Asm.lexer
33
false
true
0
7
9
27
13
14
null
null
pparkkin/eta
compiler/ETA/DeSugar/DsUtils.hs
bsd-3-clause
mkPatSynCase :: Id -> Type -> CaseAlt PatSyn -> CoreExpr -> DsM CoreExpr mkPatSynCase var ty alt fail = do matcher <- dsLExpr $ mkLHsWrap wrapper $ nlHsTyApp matcher [ty] let MatchResult _ mkCont = match_result cont <- mkCoreLams bndrs <$> mkCont fail return $ mkCoreAppsDs matcher [Var var, ensure_unstrict cont, Lam voidArgId fail] where MkCaseAlt{ alt_pat = psyn, alt_bndrs = bndrs, alt_wrapper = wrapper, alt_result = match_result} = alt (matcher, needs_void_lam) = patSynMatcher psyn -- See Note [Matchers and builders for pattern synonyms] in PatSyns -- on these extra Void# arguments ensure_unstrict cont | needs_void_lam = Lam voidArgId cont | otherwise = cont
782
mkPatSynCase :: Id -> Type -> CaseAlt PatSyn -> CoreExpr -> DsM CoreExpr mkPatSynCase var ty alt fail = do matcher <- dsLExpr $ mkLHsWrap wrapper $ nlHsTyApp matcher [ty] let MatchResult _ mkCont = match_result cont <- mkCoreLams bndrs <$> mkCont fail return $ mkCoreAppsDs matcher [Var var, ensure_unstrict cont, Lam voidArgId fail] where MkCaseAlt{ alt_pat = psyn, alt_bndrs = bndrs, alt_wrapper = wrapper, alt_result = match_result} = alt (matcher, needs_void_lam) = patSynMatcher psyn -- See Note [Matchers and builders for pattern synonyms] in PatSyns -- on these extra Void# arguments ensure_unstrict cont | needs_void_lam = Lam voidArgId cont | otherwise = cont
782
mkPatSynCase var ty alt fail = do matcher <- dsLExpr $ mkLHsWrap wrapper $ nlHsTyApp matcher [ty] let MatchResult _ mkCont = match_result cont <- mkCoreLams bndrs <$> mkCont fail return $ mkCoreAppsDs matcher [Var var, ensure_unstrict cont, Lam voidArgId fail] where MkCaseAlt{ alt_pat = psyn, alt_bndrs = bndrs, alt_wrapper = wrapper, alt_result = match_result} = alt (matcher, needs_void_lam) = patSynMatcher psyn -- See Note [Matchers and builders for pattern synonyms] in PatSyns -- on these extra Void# arguments ensure_unstrict cont | needs_void_lam = Lam voidArgId cont | otherwise = cont
709
false
true
3
10
217
220
105
115
null
null
merijn/lambda-except
Eval.hs
bsd-3-clause
nf (Case (nf -> expr) alts _) = case mapMaybe (matchPatWithEval id expr) alts of [] -> error "Incomplete pattern!" (x:_) -> nf x
138
nf (Case (nf -> expr) alts _) = case mapMaybe (matchPatWithEval id expr) alts of [] -> error "Incomplete pattern!" (x:_) -> nf x
138
nf (Case (nf -> expr) alts _) = case mapMaybe (matchPatWithEval id expr) alts of [] -> error "Incomplete pattern!" (x:_) -> nf x
138
false
false
0
9
33
70
34
36
null
null
Proclivis/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxAUI_INSERT_ROW :: Int wxAUI_INSERT_ROW = 1
44
wxAUI_INSERT_ROW :: Int wxAUI_INSERT_ROW = 1
44
wxAUI_INSERT_ROW = 1
20
false
true
0
4
5
11
6
5
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/book/2007-Programming_in_Haskell-1st_Edition-Graham_Hutton/ch_08_10.hs
unlicense
pListOfNats :: Parser [Int] pListOfNats = do symbol "[" n <- natural ns <- many (do symbol "," natural) symbol "]" return (n:ns)
228
pListOfNats :: Parser [Int] pListOfNats = do symbol "[" n <- natural ns <- many (do symbol "," natural) symbol "]" return (n:ns)
228
pListOfNats = do symbol "[" n <- natural ns <- many (do symbol "," natural) symbol "]" return (n:ns)
200
false
true
0
12
122
71
31
40
null
null
beni55/scotty
Web/Scotty/Action.hs
bsd-3-clause
-- | Catch an exception thrown by 'raise'. -- -- > raise "just kidding" `rescue` (\msg -> text msg) rescue :: (ScottyError e, Monad m) => ActionT e m a -> (e -> ActionT e m a) -> ActionT e m a rescue action h = catchError action $ \e -> case e of ActionError err -> h err -- handle errors other -> throwError other -- rethrow internal error types -- | Like 'liftIO', but catch any IO exceptions and turn them into 'ScottyError's.
459
rescue :: (ScottyError e, Monad m) => ActionT e m a -> (e -> ActionT e m a) -> ActionT e m a rescue action h = catchError action $ \e -> case e of ActionError err -> h err -- handle errors other -> throwError other -- rethrow internal error types -- | Like 'liftIO', but catch any IO exceptions and turn them into 'ScottyError's.
359
rescue action h = catchError action $ \e -> case e of ActionError err -> h err -- handle errors other -> throwError other -- rethrow internal error types -- | Like 'liftIO', but catch any IO exceptions and turn them into 'ScottyError's.
266
true
true
0
11
114
114
57
57
null
null
4e6/sandbox
haskell/HackerRank/Algorithms/AcmIcpcTeam.hs
mit
mkBit _ c = error $ show c ++ " is not a valid binary Char"
61
mkBit _ c = error $ show c ++ " is not a valid binary Char"
61
mkBit _ c = error $ show c ++ " is not a valid binary Char"
61
false
false
1
7
17
23
10
13
null
null
hanshoglund/fluent
src/Sound/Fluent.hs
bsd-3-clause
startHandler :: Fluent -> Handler startHandler fluent m = when ("/fluent/play" `isPrefixOf` OSC.messageAddress m) $ go fluent m where go fluent (OSC.Message _ [OSC.Int32 genId, OSC.Int32 clipId]) = startPlayingClipNamed (T.pack $ show clipId) (T.pack $ show genId) fluent >> return () go fluent (OSC.Message _ [OSC.ASCII_String genId, OSC.ASCII_String clipId]) = startPlayingClipNamed (bs2t clipId) (bs2t genId) fluent >> return () go fluent (OSC.Message _ [OSC.ASCII_String genAndClipId]) = let (genId : clipId : _) = BS.words genAndClipId in -- TODO crashes on bad msg startPlayingClipNamed (bs2t clipId) (bs2t genId) fluent >> return () go fluent _ = putStrLn $ "Error: Bad message" ++ show m
756
startHandler :: Fluent -> Handler startHandler fluent m = when ("/fluent/play" `isPrefixOf` OSC.messageAddress m) $ go fluent m where go fluent (OSC.Message _ [OSC.Int32 genId, OSC.Int32 clipId]) = startPlayingClipNamed (T.pack $ show clipId) (T.pack $ show genId) fluent >> return () go fluent (OSC.Message _ [OSC.ASCII_String genId, OSC.ASCII_String clipId]) = startPlayingClipNamed (bs2t clipId) (bs2t genId) fluent >> return () go fluent (OSC.Message _ [OSC.ASCII_String genAndClipId]) = let (genId : clipId : _) = BS.words genAndClipId in -- TODO crashes on bad msg startPlayingClipNamed (bs2t clipId) (bs2t genId) fluent >> return () go fluent _ = putStrLn $ "Error: Bad message" ++ show m
756
startHandler fluent m = when ("/fluent/play" `isPrefixOf` OSC.messageAddress m) $ go fluent m where go fluent (OSC.Message _ [OSC.Int32 genId, OSC.Int32 clipId]) = startPlayingClipNamed (T.pack $ show clipId) (T.pack $ show genId) fluent >> return () go fluent (OSC.Message _ [OSC.ASCII_String genId, OSC.ASCII_String clipId]) = startPlayingClipNamed (bs2t clipId) (bs2t genId) fluent >> return () go fluent (OSC.Message _ [OSC.ASCII_String genAndClipId]) = let (genId : clipId : _) = BS.words genAndClipId in -- TODO crashes on bad msg startPlayingClipNamed (bs2t clipId) (bs2t genId) fluent >> return () go fluent _ = putStrLn $ "Error: Bad message" ++ show m
722
false
true
0
11
163
307
144
163
null
null
ndmitchell/shake
src/Test/Resources.hs
bsd-3-clause
main = testBuild test $ do -- test I have good Ord and Show do r1 <- newResource "test" 2 r2 <- newResource "special" 67 unless (r1 < r2 || r2 < r1) $ fail "Resources should have a good ordering" unless ("special" `isInfixOf` show r2) $ fail "Resource should contain their name when shown" -- test you are capped to a maximum value do let cap = 2 inside <- liftIO $ newIORef 0 res <- newResource "test" cap phony "cap" $ need ["c_file" ++ show i ++ ".txt" | i <- [1..4]] "c_*.txt" %> \out -> withResource res 1 $ do old <- liftIO $ atomicModifyIORef inside $ \i -> (i+1,i) when (old >= cap) $ fail "Too many resources in use at one time" liftIO $ sleep 0.1 liftIO $ atomicModifyIORef inside $ \i -> (i-1,i) writeFile' out "" -- test things can still run while you are blocked on a resource do done <- liftIO $ newIORef 0 lock <- newResource "lock" 1 phony "schedule" $ need $ map ("s_" ++) $ "lock1":"done":["free" ++ show i | i <- [1..10]] ++ ["lock2"] "s_done" %> \out -> do need ["s_lock1","s_lock2"] done <- liftIO $ readIORef done when (done < 10) $ fail "Not all managed to schedule while waiting" writeFile' out "" "s_lock*" %> \out -> do withResource lock 1 $ liftIO $ sleep 0.5 writeFile' out "" "s_free*" %> \out -> do liftIO $ atomicModifyIORef done $ \i -> (i+1,()) writeFile' out "" -- test that throttle works properly do res <- newThrottle "throttle" 2 0.4 phony "throttle" $ need ["t_file1.1","t_file2.1","t_file3.2","t_file4.1","t_file5.2"] "t_*.*" %> \out -> do withResource res (read $ drop1 $ takeExtension out) $ when (takeBaseName out == "t_file3") $ liftIO $ sleep 0.2 writeFile' out ""
2,028
main = testBuild test $ do -- test I have good Ord and Show do r1 <- newResource "test" 2 r2 <- newResource "special" 67 unless (r1 < r2 || r2 < r1) $ fail "Resources should have a good ordering" unless ("special" `isInfixOf` show r2) $ fail "Resource should contain their name when shown" -- test you are capped to a maximum value do let cap = 2 inside <- liftIO $ newIORef 0 res <- newResource "test" cap phony "cap" $ need ["c_file" ++ show i ++ ".txt" | i <- [1..4]] "c_*.txt" %> \out -> withResource res 1 $ do old <- liftIO $ atomicModifyIORef inside $ \i -> (i+1,i) when (old >= cap) $ fail "Too many resources in use at one time" liftIO $ sleep 0.1 liftIO $ atomicModifyIORef inside $ \i -> (i-1,i) writeFile' out "" -- test things can still run while you are blocked on a resource do done <- liftIO $ newIORef 0 lock <- newResource "lock" 1 phony "schedule" $ need $ map ("s_" ++) $ "lock1":"done":["free" ++ show i | i <- [1..10]] ++ ["lock2"] "s_done" %> \out -> do need ["s_lock1","s_lock2"] done <- liftIO $ readIORef done when (done < 10) $ fail "Not all managed to schedule while waiting" writeFile' out "" "s_lock*" %> \out -> do withResource lock 1 $ liftIO $ sleep 0.5 writeFile' out "" "s_free*" %> \out -> do liftIO $ atomicModifyIORef done $ \i -> (i+1,()) writeFile' out "" -- test that throttle works properly do res <- newThrottle "throttle" 2 0.4 phony "throttle" $ need ["t_file1.1","t_file2.1","t_file3.2","t_file4.1","t_file5.2"] "t_*.*" %> \out -> do withResource res (read $ drop1 $ takeExtension out) $ when (takeBaseName out == "t_file3") $ liftIO $ sleep 0.2 writeFile' out ""
2,028
main = testBuild test $ do -- test I have good Ord and Show do r1 <- newResource "test" 2 r2 <- newResource "special" 67 unless (r1 < r2 || r2 < r1) $ fail "Resources should have a good ordering" unless ("special" `isInfixOf` show r2) $ fail "Resource should contain their name when shown" -- test you are capped to a maximum value do let cap = 2 inside <- liftIO $ newIORef 0 res <- newResource "test" cap phony "cap" $ need ["c_file" ++ show i ++ ".txt" | i <- [1..4]] "c_*.txt" %> \out -> withResource res 1 $ do old <- liftIO $ atomicModifyIORef inside $ \i -> (i+1,i) when (old >= cap) $ fail "Too many resources in use at one time" liftIO $ sleep 0.1 liftIO $ atomicModifyIORef inside $ \i -> (i-1,i) writeFile' out "" -- test things can still run while you are blocked on a resource do done <- liftIO $ newIORef 0 lock <- newResource "lock" 1 phony "schedule" $ need $ map ("s_" ++) $ "lock1":"done":["free" ++ show i | i <- [1..10]] ++ ["lock2"] "s_done" %> \out -> do need ["s_lock1","s_lock2"] done <- liftIO $ readIORef done when (done < 10) $ fail "Not all managed to schedule while waiting" writeFile' out "" "s_lock*" %> \out -> do withResource lock 1 $ liftIO $ sleep 0.5 writeFile' out "" "s_free*" %> \out -> do liftIO $ atomicModifyIORef done $ \i -> (i+1,()) writeFile' out "" -- test that throttle works properly do res <- newThrottle "throttle" 2 0.4 phony "throttle" $ need ["t_file1.1","t_file2.1","t_file3.2","t_file4.1","t_file5.2"] "t_*.*" %> \out -> do withResource res (read $ drop1 $ takeExtension out) $ when (takeBaseName out == "t_file3") $ liftIO $ sleep 0.2 writeFile' out ""
2,028
false
false
0
20
710
659
309
350
null
null
edsko/cabal
cabal-install/tests/UnitTests/Distribution/Client/Dependency/Modular/DSL.hs
bsd-3-clause
exInstInfo :: ExampleInstalled -> C.InstalledPackageInfo exInstInfo ex = C.emptyInstalledPackageInfo { C.installedUnitId = C.mkUnitId (exInstHash ex) , C.sourcePackageId = exInstPkgId ex , C.depends = map (C.mkUnitId . exInstHash) (exInstBuildAgainst ex) }
324
exInstInfo :: ExampleInstalled -> C.InstalledPackageInfo exInstInfo ex = C.emptyInstalledPackageInfo { C.installedUnitId = C.mkUnitId (exInstHash ex) , C.sourcePackageId = exInstPkgId ex , C.depends = map (C.mkUnitId . exInstHash) (exInstBuildAgainst ex) }
324
exInstInfo ex = C.emptyInstalledPackageInfo { C.installedUnitId = C.mkUnitId (exInstHash ex) , C.sourcePackageId = exInstPkgId ex , C.depends = map (C.mkUnitId . exInstHash) (exInstBuildAgainst ex) }
267
false
true
0
10
97
82
43
39
null
null
mmarx/jebediah
src/Jebediah/MIDI/Nord/Electro4.hs
gpl-3.0
rotaryStopMode :: RotaryStop -> [Body] rotaryStopMode = en "Rotary Stop Mode"
77
rotaryStopMode :: RotaryStop -> [Body] rotaryStopMode = en "Rotary Stop Mode"
77
rotaryStopMode = en "Rotary Stop Mode"
38
false
true
0
6
10
21
11
10
null
null
jonaprieto/athena
src/Athena/Utils/PrettyPrint.hs
mit
-- | The @group@ combinator is used to specify alternative -- layouts. The document @(group x)@ undoes all line breaks in -- document @x@. The resulting line is added to the current line if -- that fits the page. Otherwise, the document @x@ is rendered -- without any changes. group ∷ Doc → Doc group x = Union (flatten x) x
332
group ∷ Doc → Doc group x = Union (flatten x) x
47
group x = Union (flatten x) x
29
true
true
0
7
68
40
20
20
null
null
vikraman/ghc
compiler/main/DynFlags.hs
bsd-3-clause
generateDynamicTooConditional :: MonadIO m => DynFlags -> m a -> m a -> m a -> m a generateDynamicTooConditional dflags canGen cannotGen notTryingToGen = if gopt Opt_BuildDynamicToo dflags then do let ref = canGenerateDynamicToo dflags b <- liftIO $ readIORef ref if b then canGen else cannotGen else notTryingToGen
389
generateDynamicTooConditional :: MonadIO m => DynFlags -> m a -> m a -> m a -> m a generateDynamicTooConditional dflags canGen cannotGen notTryingToGen = if gopt Opt_BuildDynamicToo dflags then do let ref = canGenerateDynamicToo dflags b <- liftIO $ readIORef ref if b then canGen else cannotGen else notTryingToGen
389
generateDynamicTooConditional dflags canGen cannotGen notTryingToGen = if gopt Opt_BuildDynamicToo dflags then do let ref = canGenerateDynamicToo dflags b <- liftIO $ readIORef ref if b then canGen else cannotGen else notTryingToGen
276
false
true
0
11
122
111
50
61
null
null
dysinger/amazonka
amazonka-glacier/gen/Network/AWS/Glacier/DescribeJob.hs
mpl-2.0
-- | 'DescribeJob' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'djAccountId' @::@ 'Text' -- -- * 'djJobId' @::@ 'Text' -- -- * 'djVaultName' @::@ 'Text' -- describeJob :: Text -- ^ 'djAccountId' -> Text -- ^ 'djVaultName' -> Text -- ^ 'djJobId' -> DescribeJob describeJob p1 p2 p3 = DescribeJob { _djAccountId = p1 , _djVaultName = p2 , _djJobId = p3 }
447
describeJob :: Text -- ^ 'djAccountId' -> Text -- ^ 'djVaultName' -> Text -- ^ 'djJobId' -> DescribeJob describeJob p1 p2 p3 = DescribeJob { _djAccountId = p1 , _djVaultName = p2 , _djJobId = p3 }
252
describeJob p1 p2 p3 = DescribeJob { _djAccountId = p1 , _djVaultName = p2 , _djJobId = p3 }
112
true
true
0
9
124
72
43
29
null
null
danplubell/dicom-network
library/Dicom/Network/TestHarness/TestAssociationSCU.hs
mit
sendAbortPDU::Socket-> IO() sendAbortPDU sock = do NSB.send sock $ packPDU $ buildAbortPDU AbortServiceUser AbortUnspecified return ()
157
sendAbortPDU::Socket-> IO() sendAbortPDU sock = do NSB.send sock $ packPDU $ buildAbortPDU AbortServiceUser AbortUnspecified return ()
157
sendAbortPDU sock = do NSB.send sock $ packPDU $ buildAbortPDU AbortServiceUser AbortUnspecified return ()
129
false
true
0
10
38
52
23
29
null
null
nicolasbrugneaux/redis-haskell
src/Main.hs
bsd-3-clause
runCommand handle (Just (Set key value)) db = do updateValue (insert key value) db S.hPutStr handle ok putStrLn $ S.concat ["set (", key, ", ", valStr value, ")"]
174
runCommand handle (Just (Set key value)) db = do updateValue (insert key value) db S.hPutStr handle ok putStrLn $ S.concat ["set (", key, ", ", valStr value, ")"]
174
runCommand handle (Just (Set key value)) db = do updateValue (insert key value) db S.hPutStr handle ok putStrLn $ S.concat ["set (", key, ", ", valStr value, ")"]
174
false
false
0
10
39
83
40
43
null
null