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
codemac/yi-editor
src/Yi/UI/Cocoa/TextStorage.hs
gpl-2.0
sSplitAt :: Int -> SplitRope -> SplitRope sSplitAt n s = SplitRope done next n' (if n' >= off then L.drop (n' - off) cs else L.drop n' acs) acs where n' = n - R.length done SplitRope done next off cs acs = sSplitAtChunkBefore n s
239
sSplitAt :: Int -> SplitRope -> SplitRope sSplitAt n s = SplitRope done next n' (if n' >= off then L.drop (n' - off) cs else L.drop n' acs) acs where n' = n - R.length done SplitRope done next off cs acs = sSplitAtChunkBefore n s
239
sSplitAt n s = SplitRope done next n' (if n' >= off then L.drop (n' - off) cs else L.drop n' acs) acs where n' = n - R.length done SplitRope done next off cs acs = sSplitAtChunkBefore n s
197
false
true
0
10
56
110
54
56
null
null
pyr/warp-agent
System/Warp/Match.hs
isc
runMatch host _ (MatchHost candidate) = (host == candidate)
59
runMatch host _ (MatchHost candidate) = (host == candidate)
59
runMatch host _ (MatchHost candidate) = (host == candidate)
59
false
false
1
7
8
30
13
17
null
null
dysinger/amazonka
amazonka-storagegateway/gen/Network/AWS/StorageGateway/DescribeTapes.hs
mpl-2.0
-- | Specifies that the number of virtual tapes described be limited to the -- specified number. -- -- Amazon Web Services may impose its own limit, if this field is not set. dtLimit :: Lens' DescribeTapes (Maybe Natural) dtLimit = lens _dtLimit (\s a -> s { _dtLimit = a }) . mapping _Nat
289
dtLimit :: Lens' DescribeTapes (Maybe Natural) dtLimit = lens _dtLimit (\s a -> s { _dtLimit = a }) . mapping _Nat
114
dtLimit = lens _dtLimit (\s a -> s { _dtLimit = a }) . mapping _Nat
67
true
true
1
10
54
61
31
30
null
null
cordawyn/rdf4h
src/Text/RDF/RDF4H/Interact.hs
bsd-3-clause
-- |Parse a Turtle document from the given 'T.Text' using the given @baseUrl@ and -- @docUri@, which have the same semantics as in the loadTurtle* functions. parseTurtleString :: forall rdf. (RDF rdf) => Maybe String -> Maybe String -> T.Text -> rdf parseTurtleString baseUrl docUri = _parse parseString (mkTurtleParser baseUrl docUri)
336
parseTurtleString :: forall rdf. (RDF rdf) => Maybe String -> Maybe String -> T.Text -> rdf parseTurtleString baseUrl docUri = _parse parseString (mkTurtleParser baseUrl docUri)
177
parseTurtleString baseUrl docUri = _parse parseString (mkTurtleParser baseUrl docUri)
85
true
true
0
10
51
69
34
35
null
null
siddhanathan/yi
yi-core/src/Yi/Buffer/Implementation.hs
gpl-2.0
applyUpdateI :: Update -> BufferImpl syntax -> BufferImpl syntax applyUpdateI u fb = touchSyntax (updatePoint u) $ fb {mem = p', marks = M.map shift (marks fb), overlays = Set.map (mapOvlMarks shift) (overlays fb)} -- FIXME: this is inefficient; find a way to use mapMonotonic -- (problem is that marks can have different gravities) where (p', amount) = case u of Insert pnt _ cs -> (insertChars p cs pnt, sz) Delete pnt _ _ -> (deleteChars p pnt sz, negate sz) sz = updateSize u shift = shiftMarkValue (updatePoint u) amount p = mem fb -- FIXME: remove collapsed overlays -- | Reverse the given update
827
applyUpdateI :: Update -> BufferImpl syntax -> BufferImpl syntax applyUpdateI u fb = touchSyntax (updatePoint u) $ fb {mem = p', marks = M.map shift (marks fb), overlays = Set.map (mapOvlMarks shift) (overlays fb)} -- FIXME: this is inefficient; find a way to use mapMonotonic -- (problem is that marks can have different gravities) where (p', amount) = case u of Insert pnt _ cs -> (insertChars p cs pnt, sz) Delete pnt _ _ -> (deleteChars p pnt sz, negate sz) sz = updateSize u shift = shiftMarkValue (updatePoint u) amount p = mem fb -- FIXME: remove collapsed overlays -- | Reverse the given update
827
applyUpdateI u fb = touchSyntax (updatePoint u) $ fb {mem = p', marks = M.map shift (marks fb), overlays = Set.map (mapOvlMarks shift) (overlays fb)} -- FIXME: this is inefficient; find a way to use mapMonotonic -- (problem is that marks can have different gravities) where (p', amount) = case u of Insert pnt _ cs -> (insertChars p cs pnt, sz) Delete pnt _ _ -> (deleteChars p pnt sz, negate sz) sz = updateSize u shift = shiftMarkValue (updatePoint u) amount p = mem fb -- FIXME: remove collapsed overlays -- | Reverse the given update
762
false
true
2
10
331
215
106
109
null
null
TimLuq/sqrl-auth-client-hs
src/Web/Authenticate/SQRL/Client/Simple.hs
mit
-- | Imports a SQRL file to the profile storage. mainImport :: [String] -> IO () mainImport args = case take 3 args of [] -> importHelp ("help":_) -> importHelp [f] -> getLine >>= importFileAs f [f,"as",n] -> importFileAs f n ["-name",n,f] -> importFileAs f n ["-name",n] -> importFileAs "-" n _ -> importHelp where importHelp = do putStrLn " usage: sqrl-auth-client-simple import <FILE> [as <PROFILE_NAME>]" putStrLn " sqrl-auth-client-simple import -name <PROFILE_NAME> <FILE>" putStrLn " Tries to import an existing SQRL identity contained in FILE by asking for a new profile name if none is provided." importFileAs f n = (if f == "-" then openSecureStorage' "/dev/null" <$> (IO.hSetBinaryMode IO.stdin True >> LBS.hGetContents IO.stdin) else openSecureStorage f) >>= \mss -> case mss of Left err -> IO.hPutStrLn IO.stderr err Right ss -> profilePath (T.pack n) >>= \ep -> case ep of Right _ -> IO.hPutStrLn IO.stderr $ "The profile " ++ show n ++ " already exists." Left p -> saveSecureStorage (copySecureStorage p ss) >> putStrLn ("Profile " ++ show n ++ " has been imported with your previous password.")
1,265
mainImport :: [String] -> IO () mainImport args = case take 3 args of [] -> importHelp ("help":_) -> importHelp [f] -> getLine >>= importFileAs f [f,"as",n] -> importFileAs f n ["-name",n,f] -> importFileAs f n ["-name",n] -> importFileAs "-" n _ -> importHelp where importHelp = do putStrLn " usage: sqrl-auth-client-simple import <FILE> [as <PROFILE_NAME>]" putStrLn " sqrl-auth-client-simple import -name <PROFILE_NAME> <FILE>" putStrLn " Tries to import an existing SQRL identity contained in FILE by asking for a new profile name if none is provided." importFileAs f n = (if f == "-" then openSecureStorage' "/dev/null" <$> (IO.hSetBinaryMode IO.stdin True >> LBS.hGetContents IO.stdin) else openSecureStorage f) >>= \mss -> case mss of Left err -> IO.hPutStrLn IO.stderr err Right ss -> profilePath (T.pack n) >>= \ep -> case ep of Right _ -> IO.hPutStrLn IO.stderr $ "The profile " ++ show n ++ " already exists." Left p -> saveSecureStorage (copySecureStorage p ss) >> putStrLn ("Profile " ++ show n ++ " has been imported with your previous password.")
1,216
mainImport args = case take 3 args of [] -> importHelp ("help":_) -> importHelp [f] -> getLine >>= importFileAs f [f,"as",n] -> importFileAs f n ["-name",n,f] -> importFileAs f n ["-name",n] -> importFileAs "-" n _ -> importHelp where importHelp = do putStrLn " usage: sqrl-auth-client-simple import <FILE> [as <PROFILE_NAME>]" putStrLn " sqrl-auth-client-simple import -name <PROFILE_NAME> <FILE>" putStrLn " Tries to import an existing SQRL identity contained in FILE by asking for a new profile name if none is provided." importFileAs f n = (if f == "-" then openSecureStorage' "/dev/null" <$> (IO.hSetBinaryMode IO.stdin True >> LBS.hGetContents IO.stdin) else openSecureStorage f) >>= \mss -> case mss of Left err -> IO.hPutStrLn IO.stderr err Right ss -> profilePath (T.pack n) >>= \ep -> case ep of Right _ -> IO.hPutStrLn IO.stderr $ "The profile " ++ show n ++ " already exists." Left p -> saveSecureStorage (copySecureStorage p ss) >> putStrLn ("Profile " ++ show n ++ " has been imported with your previous password.")
1,184
true
true
9
20
334
362
174
188
null
null
Helkafen/haddock
haddock-api/src/Haddock/Backends/Xhtml/Names.hs
bsd-2-clause
ppQualName :: Notation -> ModuleName -> Name -> Html ppQualName notation mdlName name = wrapInfix notation (getOccName name) qname where qname = toHtml $ moduleNameString mdlName ++ '.' : getOccString name
211
ppQualName :: Notation -> ModuleName -> Name -> Html ppQualName notation mdlName name = wrapInfix notation (getOccName name) qname where qname = toHtml $ moduleNameString mdlName ++ '.' : getOccString name
211
ppQualName notation mdlName name = wrapInfix notation (getOccName name) qname where qname = toHtml $ moduleNameString mdlName ++ '.' : getOccString name
158
false
true
3
7
36
77
34
43
null
null
xmonad/xmonad-contrib
XMonad/Hooks/DynamicIcons.hs
bsd-3-clause
wrapUnwords l r xs = wrap l r (unwords xs)
43
wrapUnwords l r xs = wrap l r (unwords xs)
43
wrapUnwords l r xs = wrap l r (unwords xs)
43
false
false
0
7
10
26
12
14
null
null
danieldietrich/llrbtree
Data/Set/WBTree.hs
bsd-3-clause
difference t1 (Node _ l x r) = merge (difference l' l) (difference r' r) where (l',r') = split x t1 ----------------------------------------------------------------
171
difference t1 (Node _ l x r) = merge (difference l' l) (difference r' r) where (l',r') = split x t1 ----------------------------------------------------------------
171
difference t1 (Node _ l x r) = merge (difference l' l) (difference r' r) where (l',r') = split x t1 ----------------------------------------------------------------
171
false
false
0
7
28
68
32
36
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 14060 = 6049
32
getValueFromProduct 14060 = 6049
32
getValueFromProduct 14060 = 6049
32
false
false
0
5
3
9
4
5
null
null
frasertweedale/hs-jose
src/Crypto/JOSE/JWE.hs
apache-2.0
wrapAESGCM _ _ _ _ = return $ Left $ AlgorithmMismatch "Cannot use AESGCMKW with non-Oct key"
93
wrapAESGCM _ _ _ _ = return $ Left $ AlgorithmMismatch "Cannot use AESGCMKW with non-Oct key"
93
wrapAESGCM _ _ _ _ = return $ Left $ AlgorithmMismatch "Cannot use AESGCMKW with non-Oct key"
93
false
false
0
6
16
26
12
14
null
null
J2RGEZ/haskell-do
src/common/HaskellDo/Toolbar/State.hs
apache-2.0
update :: Action -> State -> Cloud State update OpenProject state = do localIO $ openModal "#openProjectModal" update (NewPath (projectPath state)) state
161
update :: Action -> State -> Cloud State update OpenProject state = do localIO $ openModal "#openProjectModal" update (NewPath (projectPath state)) state
161
update OpenProject state = do localIO $ openModal "#openProjectModal" update (NewPath (projectPath state)) state
120
false
true
0
11
29
57
26
31
null
null
judah/haskeline
System/Console/Haskeline/Backend/Terminfo.hs
bsd-3-clause
right = flip rightA
19
right = flip rightA
19
right = flip rightA
19
false
false
0
5
3
9
4
5
null
null
quchen/fgl
Data/Graph/Inductive/Query/GVD.hs
bsd-3-clause
maybePath :: (Real b) => Node -> Voronoi b -> Maybe (LPath b) maybePath v = listToMaybe . filter (\(LP ((w,_):_))->w==v)
120
maybePath :: (Real b) => Node -> Voronoi b -> Maybe (LPath b) maybePath v = listToMaybe . filter (\(LP ((w,_):_))->w==v)
120
maybePath v = listToMaybe . filter (\(LP ((w,_):_))->w==v)
58
false
true
0
13
20
81
42
39
null
null
quchen/fgl
Data/Graph/Inductive/Query/Monad.hs
bsd-3-clause
recMGT :: (Monad m) => (m s -> m Bool) -> GT m s a -> (a -> b -> b) -> b -> GT m s b recMGT p mg f u = condMGT p (return u) (do {x<-mg;y<-recMGT p mg f u;return (f x y)})
196
recMGT :: (Monad m) => (m s -> m Bool) -> GT m s a -> (a -> b -> b) -> b -> GT m s b recMGT p mg f u = condMGT p (return u) (do {x<-mg;y<-recMGT p mg f u;return (f x y)})
196
recMGT p mg f u = condMGT p (return u) (do {x<-mg;y<-recMGT p mg f u;return (f x y)})
111
false
true
0
11
72
140
69
71
null
null
Drezil/hgraph
src/Util.hs
agpl-3.0
-- | Move fourth argument to first place flip4 :: (a -> b -> c -> d -> e) -> d -> a -> b -> c -> e flip4 fun d a b c = fun a b c d
130
flip4 :: (a -> b -> c -> d -> e) -> d -> a -> b -> c -> e flip4 fun d a b c = fun a b c d
89
flip4 fun d a b c = fun a b c d
31
true
true
0
10
40
71
36
35
null
null
amccausl/Swish
Swish/HaskellRDF/RDFDatatypeXsdIntegerTest.hs
lgpl-2.1
testVarModifySum02 = testVmod3 "testVarModifySum02" (getDTMod dmodXsdIntegerSum rdfDatatypeValXsdInteger) [makeBVI [("b","22"),("c","11")]] [makeBVI [("a","33"),("b","22"),("c","11")]]
248
testVarModifySum02 = testVmod3 "testVarModifySum02" (getDTMod dmodXsdIntegerSum rdfDatatypeValXsdInteger) [makeBVI [("b","22"),("c","11")]] [makeBVI [("a","33"),("b","22"),("c","11")]]
248
testVarModifySum02 = testVmod3 "testVarModifySum02" (getDTMod dmodXsdIntegerSum rdfDatatypeValXsdInteger) [makeBVI [("b","22"),("c","11")]] [makeBVI [("a","33"),("b","22"),("c","11")]]
248
false
false
0
9
74
80
47
33
null
null
matterhorn-chat/matterhorn
src/Matterhorn/Types/Users.hs
bsd-3-clause
findUserByNickname:: Text -> Users -> Maybe (UserId, UserInfo) findUserByNickname nick us = case filter ((== (Just $ trimUserSigil nick)) . _uiNickName . snd) $ HM.toList $ _ofUsers us of (pair : []) -> Just pair _ -> Nothing
235
findUserByNickname:: Text -> Users -> Maybe (UserId, UserInfo) findUserByNickname nick us = case filter ((== (Just $ trimUserSigil nick)) . _uiNickName . snd) $ HM.toList $ _ofUsers us of (pair : []) -> Just pair _ -> Nothing
235
findUserByNickname nick us = case filter ((== (Just $ trimUserSigil nick)) . _uiNickName . snd) $ HM.toList $ _ofUsers us of (pair : []) -> Just pair _ -> Nothing
172
false
true
2
15
47
95
51
44
null
null
danchoi/HaskellNet
src/Network/HaskellNet/IMAP.hs
bsd-3-clause
append :: BSStream s => IMAPConnection s -> MailboxName -> ByteString -> IO () append conn mbox mailData = appendFull conn mbox mailData [] Nothing
147
append :: BSStream s => IMAPConnection s -> MailboxName -> ByteString -> IO () append conn mbox mailData = appendFull conn mbox mailData [] Nothing
147
append conn mbox mailData = appendFull conn mbox mailData [] Nothing
68
false
true
0
10
24
63
28
35
null
null
woufrous/hoton
test/Hoton/TestUtils.hs
mit
shouldBeApproxV :: Cartesian -> Cartesian -> Assertion a `shouldBeApproxV` b = maxDiffs `shouldSatisfy` (< 0.1^8) where ok = maximum diffs < 0.1^8 maxDiffs = if ok then maximum diffs else traceShow b $ traceShow a $ maximum diffs Cartesian a1 a2 a3 = a Cartesian b1 b2 b3 = b diffs = [(a1-b1),(a2-b2),(a3-b3)]
353
shouldBeApproxV :: Cartesian -> Cartesian -> Assertion a `shouldBeApproxV` b = maxDiffs `shouldSatisfy` (< 0.1^8) where ok = maximum diffs < 0.1^8 maxDiffs = if ok then maximum diffs else traceShow b $ traceShow a $ maximum diffs Cartesian a1 a2 a3 = a Cartesian b1 b2 b3 = b diffs = [(a1-b1),(a2-b2),(a3-b3)]
353
a `shouldBeApproxV` b = maxDiffs `shouldSatisfy` (< 0.1^8) where ok = maximum diffs < 0.1^8 maxDiffs = if ok then maximum diffs else traceShow b $ traceShow a $ maximum diffs Cartesian a1 a2 a3 = a Cartesian b1 b2 b3 = b diffs = [(a1-b1),(a2-b2),(a3-b3)]
298
false
true
4
12
96
158
82
76
null
null
romanb/amazonka
amazonka-directconnect/gen/Network/AWS/DirectConnect/AllocateConnectionOnInterconnect.hs
mpl-2.0
acoirOwnerAccount :: Lens' AllocateConnectionOnInterconnectResponse (Maybe Text) acoirOwnerAccount = lens _acoirOwnerAccount (\s a -> s { _acoirOwnerAccount = a })
167
acoirOwnerAccount :: Lens' AllocateConnectionOnInterconnectResponse (Maybe Text) acoirOwnerAccount = lens _acoirOwnerAccount (\s a -> s { _acoirOwnerAccount = a })
167
acoirOwnerAccount = lens _acoirOwnerAccount (\s a -> s { _acoirOwnerAccount = a })
86
false
true
0
9
22
45
24
21
null
null
lpsmith/postgresql-simple-streams
src/Database/PostgreSQL/Simple/Streams/LargeObjects.hs
bsd-3-clause
loImportWithOid :: DB.Connection -> DB.Oid -> IO (OutputStream ByteString) loImportWithOid conn oid = do lofd <- DB.loOpen conn oid DB.WriteMode loWriteStream conn lofd -- | @'loReadStream' conn lofd bufferSize@ returns an 'InputStream' that -- reads chunks of size @bufferSize@ from the large object descriptor. -- -- This stream may only be used in the context of a single explicit -- transaction block.
420
loImportWithOid :: DB.Connection -> DB.Oid -> IO (OutputStream ByteString) loImportWithOid conn oid = do lofd <- DB.loOpen conn oid DB.WriteMode loWriteStream conn lofd -- | @'loReadStream' conn lofd bufferSize@ returns an 'InputStream' that -- reads chunks of size @bufferSize@ from the large object descriptor. -- -- This stream may only be used in the context of a single explicit -- transaction block.
420
loImportWithOid conn oid = do lofd <- DB.loOpen conn oid DB.WriteMode loWriteStream conn lofd -- | @'loReadStream' conn lofd bufferSize@ returns an 'InputStream' that -- reads chunks of size @bufferSize@ from the large object descriptor. -- -- This stream may only be used in the context of a single explicit -- transaction block.
345
false
true
0
10
76
73
35
38
null
null
michaelt/series
Series/FreeT/Prelude.hs
bsd-3-clause
-- --------------- -- replicate -- --------------- replicate :: Monad m => Int -> a -> FreeT (Of a) m () replicate n = take n . repeat
136
replicate :: Monad m => Int -> a -> FreeT (Of a) m () replicate n = take n . repeat
83
replicate n = take n . repeat
29
true
true
1
11
28
60
28
32
null
null
stevenarnold/pwgen-hs
pwgen.hs
mit
specialNotCharClass = mkCharsetPredicate False
46
specialNotCharClass = mkCharsetPredicate False
46
specialNotCharClass = mkCharsetPredicate False
46
false
false
0
5
3
9
4
5
null
null
josefs/autosar
oldARSim/ARSim.hs
bsd-3-clause
say (DELTA d) (Run a x t act n s) = [Run a x (t-d) act n s]
85
say (DELTA d) (Run a x t act n s) = [Run a x (t-d) act n s]
85
say (DELTA d) (Run a x t act n s) = [Run a x (t-d) act n s]
85
false
false
0
8
43
58
28
30
null
null
romanb/amazonka
amazonka-s3/gen/Network/AWS/S3/GetObjectTorrent.hs
mpl-2.0
gotRequestPayer :: Lens' GetObjectTorrent (Maybe RequestPayer) gotRequestPayer = lens _gotRequestPayer (\s a -> s { _gotRequestPayer = a })
139
gotRequestPayer :: Lens' GetObjectTorrent (Maybe RequestPayer) gotRequestPayer = lens _gotRequestPayer (\s a -> s { _gotRequestPayer = a })
139
gotRequestPayer = lens _gotRequestPayer (\s a -> s { _gotRequestPayer = a })
76
false
true
0
9
18
45
24
21
null
null
NorfairKing/the-notes
src/MachineLearning/SupervisedLearning/Main.hs
gpl-2.0
lossFunctionDefinition :: Note lossFunctionDefinition = de $ do s ["Given a", learningProblem, with , measurementSpace, m mms_] s ["A", lossFunction', "is a", binaryFunction_, "where the one of the arguments is an element of the", outputSpace] let a = "A" ma $ fun2 lf_ mmos_ a realsp s ["It is used to measure how far any single prediction is off from the real label"] newline s ["Often, given a", hypothesis, m hyp_, ", ", m $ lf_ !: hyp_, " is used to denote the distance between the cost of labeling a given ", dataPoint, "given its actual label"] s ["Usually loss functions are symmetric in their arguments but in general they are not"]
675
lossFunctionDefinition :: Note lossFunctionDefinition = de $ do s ["Given a", learningProblem, with , measurementSpace, m mms_] s ["A", lossFunction', "is a", binaryFunction_, "where the one of the arguments is an element of the", outputSpace] let a = "A" ma $ fun2 lf_ mmos_ a realsp s ["It is used to measure how far any single prediction is off from the real label"] newline s ["Often, given a", hypothesis, m hyp_, ", ", m $ lf_ !: hyp_, " is used to denote the distance between the cost of labeling a given ", dataPoint, "given its actual label"] s ["Usually loss functions are symmetric in their arguments but in general they are not"]
675
lossFunctionDefinition = de $ do s ["Given a", learningProblem, with , measurementSpace, m mms_] s ["A", lossFunction', "is a", binaryFunction_, "where the one of the arguments is an element of the", outputSpace] let a = "A" ma $ fun2 lf_ mmos_ a realsp s ["It is used to measure how far any single prediction is off from the real label"] newline s ["Often, given a", hypothesis, m hyp_, ", ", m $ lf_ !: hyp_, " is used to denote the distance between the cost of labeling a given ", dataPoint, "given its actual label"] s ["Usually loss functions are symmetric in their arguments but in general they are not"]
644
false
true
0
11
146
150
78
72
null
null
raventid/coursera_learning
haskell/will_kurt/capstone_mark_to_html.hs
mit
book3 :: Book book3 = Book { title = "Coq cookbook" , author = "Ante, Julian" }
93
book3 :: Book book3 = Book { title = "Coq cookbook" , author = "Ante, Julian" }
93
book3 = Book { title = "Coq cookbook" , author = "Ante, Julian" }
79
false
true
0
6
30
25
15
10
null
null
bruno-cadorette/AdventOfCode
Day 5/Day5.hs
mit
isNiceStringPt2 str = containsPair str && containsTrio str
58
isNiceStringPt2 str = containsPair str && containsTrio str
58
isNiceStringPt2 str = containsPair str && containsTrio str
58
false
false
1
6
7
22
8
14
null
null
brendanhay/gogol
gogol-containerbuilder/gen/Network/Google/ContainerBuilder/Types/Product.hs
mpl-2.0
-- | Output only. Server-defined resource path for the target of the -- operation. gdcvomTarget :: Lens' GoogleDevtoolsCloudbuildV2OperationMetadata (Maybe Text) gdcvomTarget = lens _gdcvomTarget (\ s a -> s{_gdcvomTarget = a})
229
gdcvomTarget :: Lens' GoogleDevtoolsCloudbuildV2OperationMetadata (Maybe Text) gdcvomTarget = lens _gdcvomTarget (\ s a -> s{_gdcvomTarget = a})
146
gdcvomTarget = lens _gdcvomTarget (\ s a -> s{_gdcvomTarget = a})
67
true
true
0
9
32
49
26
23
null
null
meiersi/bytestring
Data/ByteString/Lazy.hs
bsd-3-clause
take i cs0 = take' i cs0 where take' 0 _ = Empty take' _ Empty = Empty take' n (Chunk c cs) = if n < fromIntegral (S.length c) then Chunk (S.take (fromIntegral n) c) Empty else Chunk c (take' (n - fromIntegral (S.length c)) cs) -- | /O(n\/c)/ 'drop' @n xs@ returns the suffix of @xs@ after the first @n@ -- elements, or @[]@ if @n > 'length' xs@.
425
take i cs0 = take' i cs0 where take' 0 _ = Empty take' _ Empty = Empty take' n (Chunk c cs) = if n < fromIntegral (S.length c) then Chunk (S.take (fromIntegral n) c) Empty else Chunk c (take' (n - fromIntegral (S.length c)) cs) -- | /O(n\/c)/ 'drop' @n xs@ returns the suffix of @xs@ after the first @n@ -- elements, or @[]@ if @n > 'length' xs@.
425
take i cs0 = take' i cs0 where take' 0 _ = Empty take' _ Empty = Empty take' n (Chunk c cs) = if n < fromIntegral (S.length c) then Chunk (S.take (fromIntegral n) c) Empty else Chunk c (take' (n - fromIntegral (S.length c)) cs) -- | /O(n\/c)/ 'drop' @n xs@ returns the suffix of @xs@ after the first @n@ -- elements, or @[]@ if @n > 'length' xs@.
425
false
false
2
15
149
134
66
68
null
null
mathologist/hTestMaker
testmaker/src/TestMaker/SageTex.hs
gpl-3.0
-- | Splices two [T.Text] into a single T.Text. I made my own to deal with the infinite lists that I have. splice :: [T.Text] -> [T.Text] -> T.Text splice = splice' ""
167
splice :: [T.Text] -> [T.Text] -> T.Text splice = splice' ""
60
splice = splice' ""
19
true
true
0
9
32
42
20
22
null
null
Gabriel439/Haskell-RCPL-Library
src/RCPL/Core.hs
bsd-3-clause
cursorRight n = if n > 0 then [CursorRight n] else []
53
cursorRight n = if n > 0 then [CursorRight n] else []
53
cursorRight n = if n > 0 then [CursorRight n] else []
53
false
false
0
7
11
29
15
14
null
null
tr00per/adventure
src/main/haskell/Rooms.hs
bsd-2-clause
mkEncounter :: [Creature] -> [RoomExit] -> Maybe RoomExit -> Room mkEncounter ms = Room "This chamber is infested with monsters" ms []
134
mkEncounter :: [Creature] -> [RoomExit] -> Maybe RoomExit -> Room mkEncounter ms = Room "This chamber is infested with monsters" ms []
134
mkEncounter ms = Room "This chamber is infested with monsters" ms []
68
false
true
0
8
21
44
22
22
null
null
jdnavarro/graphql-haskell
Data/GraphQL/Encoder.hs
bsd-3-clause
-- * Values value :: Value -> Text value (ValueVariable x) = variable x
72
value :: Value -> Text value (ValueVariable x) = variable x
59
value (ValueVariable x) = variable x
36
true
true
0
9
14
34
15
19
null
null
ml9951/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
monadClassKey = mkPreludeClassUnique 8
48
monadClassKey = mkPreludeClassUnique 8
48
monadClassKey = mkPreludeClassUnique 8
48
false
false
0
5
13
9
4
5
null
null
michaelbeaumont/pandoc
src/Text/Pandoc/Writers/Markdown.hs
gpl-2.0
blockToMarkdown opts (OrderedList (start,sty,delim) items) = do let start' = if isEnabled Ext_startnum opts then start else 1 let sty' = if isEnabled Ext_fancy_lists opts then sty else DefaultStyle let delim' = if isEnabled Ext_fancy_lists opts then delim else DefaultDelim let attribs = (start', sty', delim') let markers = orderedListMarkers attribs let markers' = map (\m -> if length m < 3 then m ++ replicate (3 - length m) ' ' else m) markers contents <- inList $ mapM (\(item, num) -> orderedListItemToMarkdown opts item num) $ zip markers' items return $ cat contents <> blankline
697
blockToMarkdown opts (OrderedList (start,sty,delim) items) = do let start' = if isEnabled Ext_startnum opts then start else 1 let sty' = if isEnabled Ext_fancy_lists opts then sty else DefaultStyle let delim' = if isEnabled Ext_fancy_lists opts then delim else DefaultDelim let attribs = (start', sty', delim') let markers = orderedListMarkers attribs let markers' = map (\m -> if length m < 3 then m ++ replicate (3 - length m) ' ' else m) markers contents <- inList $ mapM (\(item, num) -> orderedListItemToMarkdown opts item num) $ zip markers' items return $ cat contents <> blankline
697
blockToMarkdown opts (OrderedList (start,sty,delim) items) = do let start' = if isEnabled Ext_startnum opts then start else 1 let sty' = if isEnabled Ext_fancy_lists opts then sty else DefaultStyle let delim' = if isEnabled Ext_fancy_lists opts then delim else DefaultDelim let attribs = (start', sty', delim') let markers = orderedListMarkers attribs let markers' = map (\m -> if length m < 3 then m ++ replicate (3 - length m) ' ' else m) markers contents <- inList $ mapM (\(item, num) -> orderedListItemToMarkdown opts item num) $ zip markers' items return $ cat contents <> blankline
697
false
false
0
18
205
238
119
119
null
null
JoeyEremondi/haskelm-old
src/Language/Elm/TH/HToE.hs
bsd-3-clause
translateRange _ = unImplemented "Infinite ranges, or ranges with steps not equal to 1"
87
translateRange _ = unImplemented "Infinite ranges, or ranges with steps not equal to 1"
87
translateRange _ = unImplemented "Infinite ranges, or ranges with steps not equal to 1"
87
false
false
0
5
13
12
5
7
null
null
GaloisInc/mistral
src/Mistral/TypeCheck/Solver.hs
bsd-3-clause
-- | Simplify internal constraints. simplifyConstraints :: TC () simplifyConstraints = localAssumps $ do gs <- applySubst =<< getGoals solve (nub gs) where solve goals = do goals' <- concat `fmap` mapM simplify goals if null goals' then return () else solve goals' -- attempt to solve a single goal simplify g = do traceMsg $ hang (text "trying to solve:") 2 (pp g) (r,assumps) <- collectGoals (trySolve g) case r of -- Solved, given these assumptions. HasInstance -> do traceMsg $ if | null assumps -> empty | otherwise -> hang (text "subgoals generated:") 2 (vcat (map pp assumps)) return (map (subGoalOf g) assumps) -- Unable to solve right now. emit, and continue solving. Skipped -> do traceMsg (text "skipping goal") addGoal g return []
1,013
simplifyConstraints :: TC () simplifyConstraints = localAssumps $ do gs <- applySubst =<< getGoals solve (nub gs) where solve goals = do goals' <- concat `fmap` mapM simplify goals if null goals' then return () else solve goals' -- attempt to solve a single goal simplify g = do traceMsg $ hang (text "trying to solve:") 2 (pp g) (r,assumps) <- collectGoals (trySolve g) case r of -- Solved, given these assumptions. HasInstance -> do traceMsg $ if | null assumps -> empty | otherwise -> hang (text "subgoals generated:") 2 (vcat (map pp assumps)) return (map (subGoalOf g) assumps) -- Unable to solve right now. emit, and continue solving. Skipped -> do traceMsg (text "skipping goal") addGoal g return []
977
simplifyConstraints = localAssumps $ do gs <- applySubst =<< getGoals solve (nub gs) where solve goals = do goals' <- concat `fmap` mapM simplify goals if null goals' then return () else solve goals' -- attempt to solve a single goal simplify g = do traceMsg $ hang (text "trying to solve:") 2 (pp g) (r,assumps) <- collectGoals (trySolve g) case r of -- Solved, given these assumptions. HasInstance -> do traceMsg $ if | null assumps -> empty | otherwise -> hang (text "subgoals generated:") 2 (vcat (map pp assumps)) return (map (subGoalOf g) assumps) -- Unable to solve right now. emit, and continue solving. Skipped -> do traceMsg (text "skipping goal") addGoal g return []
948
true
true
0
19
396
274
128
146
null
null
athanclark/clash
src/Main.hs
bsd-3-clause
main :: IO () main = do (commandConfig :: App) <- execParser opts let yamlConfigPath = fromMaybe "config/config.yaml" $ configLocation commandConfig yamlConfigExist <- doesFileExist yamlConfigPath yamlConfigContent <- if yamlConfigExist then readFile yamlConfigPath else return "" (mYamlConfig :: Maybe AppOpts) <- if yamlConfigExist && yamlConfigContent /= "" then Y.decodeFile yamlConfigPath else return Nothing let yamlConfig = fromMaybe mempty mYamlConfig runReader entry $ makeEnv $ yamlConfig <> options commandConfig where opts :: ParserInfo App opts = info (helper <*> app) ( fullDesc <> progDesc "Print out STRING" <> header "clash - a haskell application" ) -- | Entry point, post options parsing
810
main :: IO () main = do (commandConfig :: App) <- execParser opts let yamlConfigPath = fromMaybe "config/config.yaml" $ configLocation commandConfig yamlConfigExist <- doesFileExist yamlConfigPath yamlConfigContent <- if yamlConfigExist then readFile yamlConfigPath else return "" (mYamlConfig :: Maybe AppOpts) <- if yamlConfigExist && yamlConfigContent /= "" then Y.decodeFile yamlConfigPath else return Nothing let yamlConfig = fromMaybe mempty mYamlConfig runReader entry $ makeEnv $ yamlConfig <> options commandConfig where opts :: ParserInfo App opts = info (helper <*> app) ( fullDesc <> progDesc "Print out STRING" <> header "clash - a haskell application" ) -- | Entry point, post options parsing
810
main = do (commandConfig :: App) <- execParser opts let yamlConfigPath = fromMaybe "config/config.yaml" $ configLocation commandConfig yamlConfigExist <- doesFileExist yamlConfigPath yamlConfigContent <- if yamlConfigExist then readFile yamlConfigPath else return "" (mYamlConfig :: Maybe AppOpts) <- if yamlConfigExist && yamlConfigContent /= "" then Y.decodeFile yamlConfigPath else return Nothing let yamlConfig = fromMaybe mempty mYamlConfig runReader entry $ makeEnv $ yamlConfig <> options commandConfig where opts :: ParserInfo App opts = info (helper <*> app) ( fullDesc <> progDesc "Print out STRING" <> header "clash - a haskell application" ) -- | Entry point, post options parsing
796
false
true
1
11
203
210
96
114
null
null
TC1211/TCP
src/3a/tester-src/Data/IterIO/Zlib.hs
apache-2.0
newZStream :: (Ptr ZStream -> IO CInt) -> IO (ForeignPtr ZStream) newZStream initfn = do zs <- mallocForeignPtrBytes z_stream_size withForeignPtr zs $ \ptr -> do _ <- S.memset (castPtr ptr) 0 z_stream_size err <- initfn ptr when (err /= z_OK) $ throwIO $ ErrorCall "newZStream: init failed" return zs -- | Create a 'ZState' for compression. See the description of -- @deflateInit2@ in the zlib.h C header file for a more detailed -- description of the arguments. Note in particular that the value of -- @windowBits@ determines the encapsulation format of the compressed -- data: -- -- * 8..15 = zlib format -- -- * 24..31 = gzip format -- -- * -8..-15 = means raw zlib format with no header
732
newZStream :: (Ptr ZStream -> IO CInt) -> IO (ForeignPtr ZStream) newZStream initfn = do zs <- mallocForeignPtrBytes z_stream_size withForeignPtr zs $ \ptr -> do _ <- S.memset (castPtr ptr) 0 z_stream_size err <- initfn ptr when (err /= z_OK) $ throwIO $ ErrorCall "newZStream: init failed" return zs -- | Create a 'ZState' for compression. See the description of -- @deflateInit2@ in the zlib.h C header file for a more detailed -- description of the arguments. Note in particular that the value of -- @windowBits@ determines the encapsulation format of the compressed -- data: -- -- * 8..15 = zlib format -- -- * 24..31 = gzip format -- -- * -8..-15 = means raw zlib format with no header
732
newZStream initfn = do zs <- mallocForeignPtrBytes z_stream_size withForeignPtr zs $ \ptr -> do _ <- S.memset (castPtr ptr) 0 z_stream_size err <- initfn ptr when (err /= z_OK) $ throwIO $ ErrorCall "newZStream: init failed" return zs -- | Create a 'ZState' for compression. See the description of -- @deflateInit2@ in the zlib.h C header file for a more detailed -- description of the arguments. Note in particular that the value of -- @windowBits@ determines the encapsulation format of the compressed -- data: -- -- * 8..15 = zlib format -- -- * 24..31 = gzip format -- -- * -8..-15 = means raw zlib format with no header
666
false
true
0
15
162
138
68
70
null
null
fizruk/ghcjs
src/Gen2/Foreign.hs
mit
fun_type_arg_stdcall_info :: DynFlags -> CCallConv -> Type -> Maybe Int fun_type_arg_stdcall_info _ _other_conv _ = Nothing
123
fun_type_arg_stdcall_info :: DynFlags -> CCallConv -> Type -> Maybe Int fun_type_arg_stdcall_info _ _other_conv _ = Nothing
123
fun_type_arg_stdcall_info _ _other_conv _ = Nothing
51
false
true
0
8
15
33
16
17
null
null
cdosborn/lit
src/Types.hs
gpl-2.0
getParts chunk = case chunk of Def _ _ parts -> parts _ -> error "cannot retrieve parts, not a def"
111
getParts chunk = case chunk of Def _ _ parts -> parts _ -> error "cannot retrieve parts, not a def"
111
getParts chunk = case chunk of Def _ _ parts -> parts _ -> error "cannot retrieve parts, not a def"
111
false
false
3
5
32
34
16
18
null
null
michalkonecny/polypaver
src/Numeric/ER/RnToRm/UnitDom/ChebyshevBase/Polynom/EnclosureInner.hs
bsd-3-clause
-- {- -- formula: -- (ln, h)^2 = -- ( minUp( 0, maxUp( - ln *. ln, - h *. h)), maxUp(ln *^ ln, h *^ h) ) -- -} ---- | minZeroHelps = -- = (minZeroMaxNegSq, maxSq) ---- | otherwise = ---- (maxNegSq, maxSq) -- where -- maxSq = maxP ln2Up h2Up -- maxNegSq = maxP (chplNeg ln2Down) (chplNeg h2Down) -- minZeroMaxNegSq = chplNonposUp maxDegr maxSize maxNegSq ---- minZeroHelps = ---- (maxNegSqUpperB > 0) && (minZeroMaxNegSqUpperB / maxNegSqUpperB < 1/2) ---- maxNegSqUpperB = chplUpperBound 10 maxNegSq ---- minZeroMaxNegSqUpperB = chplUpperBound 10 minZeroMaxNegSq -- -- (ln2Down, ln2Up, _) = chplMultiply ln ln -- (h2Down, h2Up, _) = chplMultiply h h -- ---- reduceDegrSize = reduceSize maxSize . reduceDegree maxDegr -- maxP = chplMaxUp maxDegr maxSize {-| Multiply an enclosure by a scalar assuming the enclosure is non-negative on the whole unit domain. -} ienclScaleNonneg :: (B.ERRealBase b, DomainBox box varid Int, Ord box) => b {-^ ratio to scale by -} -> ((ERChebPoly box b, ERChebPoly box b), Bool) -> ((ERChebPoly box b, ERChebPoly box b), Bool) ienclScaleNonneg ratio pEncl@((ln, h), isAC) = ((ln *. pRatio, h *. pRatio), isAC) where pRatio = chplConst ratio {-| Multiply an enclosure by a scalar. -}
1,365
ienclScaleNonneg :: (B.ERRealBase b, DomainBox box varid Int, Ord box) => b {-^ ratio to scale by -} -> ((ERChebPoly box b, ERChebPoly box b), Bool) -> ((ERChebPoly box b, ERChebPoly box b), Bool) ienclScaleNonneg ratio pEncl@((ln, h), isAC) = ((ln *. pRatio, h *. pRatio), isAC) where pRatio = chplConst ratio {-| Multiply an enclosure by a scalar. -}
389
ienclScaleNonneg ratio pEncl@((ln, h), isAC) = ((ln *. pRatio, h *. pRatio), isAC) where pRatio = chplConst ratio {-| Multiply an enclosure by a scalar. -}
174
true
true
0
10
357
166
103
63
null
null
phischu/fragnix
tests/packages/scotty/Data.Word8.hs
bsd-3-clause
_F = 0x46
9
_F = 0x46
9
_F = 0x46
9
false
false
1
5
2
10
3
7
null
null
nomeata/ghc
compiler/nativeGen/PPC/Regs.hs
bsd-3-clause
addrOffset :: AddrMode -> Int -> Maybe AddrMode addrOffset addr off = case addr of AddrRegImm r (ImmInt n) | fits16Bits n2 -> Just (AddrRegImm r (ImmInt n2)) | otherwise -> Nothing where n2 = n + off AddrRegImm r (ImmInteger n) | fits16Bits n2 -> Just (AddrRegImm r (ImmInt (fromInteger n2))) | otherwise -> Nothing where n2 = n + toInteger off _ -> Nothing -- registers ------------------------------------------------------------------- -- @spRel@ gives us a stack relative addressing mode for volatile -- temporaries and for excess call arguments. @fpRel@, where -- applicable, is the same but for the frame pointer.
694
addrOffset :: AddrMode -> Int -> Maybe AddrMode addrOffset addr off = case addr of AddrRegImm r (ImmInt n) | fits16Bits n2 -> Just (AddrRegImm r (ImmInt n2)) | otherwise -> Nothing where n2 = n + off AddrRegImm r (ImmInteger n) | fits16Bits n2 -> Just (AddrRegImm r (ImmInt (fromInteger n2))) | otherwise -> Nothing where n2 = n + toInteger off _ -> Nothing -- registers ------------------------------------------------------------------- -- @spRel@ gives us a stack relative addressing mode for volatile -- temporaries and for excess call arguments. @fpRel@, where -- applicable, is the same but for the frame pointer.
694
addrOffset addr off = case addr of AddrRegImm r (ImmInt n) | fits16Bits n2 -> Just (AddrRegImm r (ImmInt n2)) | otherwise -> Nothing where n2 = n + off AddrRegImm r (ImmInteger n) | fits16Bits n2 -> Just (AddrRegImm r (ImmInt (fromInteger n2))) | otherwise -> Nothing where n2 = n + toInteger off _ -> Nothing -- registers ------------------------------------------------------------------- -- @spRel@ gives us a stack relative addressing mode for volatile -- temporaries and for excess call arguments. @fpRel@, where -- applicable, is the same but for the frame pointer.
646
false
true
0
15
173
181
85
96
null
null
heades/Agda-LLS
Source/ALL/Languages/ILL/Parser/Parser.hs
bsd-3-clause
-- unfoldTermParser = replTermCmdParser "u" "unfold" Unfold expr -- dumpStateParser = replIntCmdParser "d" "dump" DumpState -- loadFileParser = replFileCmdParser "l" "load" LoadFile -- decvarParser = repl2TermCmdParser "dv" "decvar" DecVar typeParser -- lineParser = try letParser -- <|> try loadFileParser -- <|> try decvarParser -- <|> try typeCheckParser -- <|> try showASTParser -- <|> try unfoldTermParser -- <|> try dumpStateParser -- <|> evalParser lineParser = try typeCheckParser <|> try showASTParser
626
lineParser = try typeCheckParser <|> try showASTParser
64
lineParser = try typeCheckParser <|> try showASTParser
64
true
false
0
6
184
28
19
9
null
null
romanb/amazonka
amazonka-rds/gen/Network/AWS/RDS/ModifyDBInstance.hs
mpl-2.0
-- | The version number of the database engine to upgrade to. Changing this -- parameter results in an outage and the change is applied during the next -- maintenance window unless the 'ApplyImmediately' parameter is set to 'true' for -- this request. -- -- For major version upgrades, if a non-default DB parameter group is -- currently in use, a new DB parameter group in the DB parameter group family -- for the new engine version must be specified. The new DB parameter group can -- be the default for that DB parameter group family. -- -- For a list of valid engine versions, see 'CreateDBInstance'. mdbiEngineVersion :: Lens' ModifyDBInstance (Maybe Text) mdbiEngineVersion = lens _mdbiEngineVersion (\s a -> s { _mdbiEngineVersion = a })
748
mdbiEngineVersion :: Lens' ModifyDBInstance (Maybe Text) mdbiEngineVersion = lens _mdbiEngineVersion (\s a -> s { _mdbiEngineVersion = a })
143
mdbiEngineVersion = lens _mdbiEngineVersion (\s a -> s { _mdbiEngineVersion = a })
86
true
true
0
9
129
56
35
21
null
null
froozen/kademlia
test/Networking.hs
bsd-3-clause
valueSet :: (Monad m) => PropertyM m (Peer, Peer, IdType, IdType) valueSet = do let pA = Peer "127.0.0.1" 1122 pB = Peer "127.0.0.1" 1123 idA <- pick (arbitrary :: Gen IdType) idB <- pick (arbitrary :: Gen IdType) return (pA, pB, idA, idB) -- | Make sure sending and receiving works
309
valueSet :: (Monad m) => PropertyM m (Peer, Peer, IdType, IdType) valueSet = do let pA = Peer "127.0.0.1" 1122 pB = Peer "127.0.0.1" 1123 idA <- pick (arbitrary :: Gen IdType) idB <- pick (arbitrary :: Gen IdType) return (pA, pB, idA, idB) -- | Make sure sending and receiving works
309
valueSet = do let pA = Peer "127.0.0.1" 1122 pB = Peer "127.0.0.1" 1123 idA <- pick (arbitrary :: Gen IdType) idB <- pick (arbitrary :: Gen IdType) return (pA, pB, idA, idB) -- | Make sure sending and receiving works
243
false
true
0
10
78
118
61
57
null
null
recursion-ninja/megaparsec
Text/Megaparsec/Byte.hs
bsd-2-clause
---------------------------------------------------------------------------- -- Categories of characters -- | Parse a control character. controlChar :: (MonadParsec e s m, Token s ~ Word8) => m (Token s) controlChar = C.satisfy (isControl . toChar) <?> "control character"
274
controlChar :: (MonadParsec e s m, Token s ~ Word8) => m (Token s) controlChar = C.satisfy (isControl . toChar) <?> "control character"
135
controlChar = C.satisfy (isControl . toChar) <?> "control character"
68
true
true
0
8
35
63
33
30
null
null
vigoo/stack
src/Stack/Types/Package.hs
bsd-3-clause
renderComponent (CTest x) = "test:" <> encodeUtf8 x
51
renderComponent (CTest x) = "test:" <> encodeUtf8 x
51
renderComponent (CTest x) = "test:" <> encodeUtf8 x
51
false
false
0
6
7
23
10
13
null
null
JohnLato/iteratee
src/Data/Iteratee/IO/Fd.hs
bsd-3-clause
enumFile' :: (MonadBaseControl IO m, ReadableChunk s el) => (Int -> Fd -> Enumerator s m a) -> Int -- ^Buffer size -> FilePath -> Enumerator s m a enumFile' enumf bufsize filepath iter = bracket (liftBase $ openFd filepath ReadOnly Nothing defaultFileFlags) (liftBase . closeFd) (flip (enumf bufsize) iter)
320
enumFile' :: (MonadBaseControl IO m, ReadableChunk s el) => (Int -> Fd -> Enumerator s m a) -> Int -- ^Buffer size -> FilePath -> Enumerator s m a enumFile' enumf bufsize filepath iter = bracket (liftBase $ openFd filepath ReadOnly Nothing defaultFileFlags) (liftBase . closeFd) (flip (enumf bufsize) iter)
320
enumFile' enumf bufsize filepath iter = bracket (liftBase $ openFd filepath ReadOnly Nothing defaultFileFlags) (liftBase . closeFd) (flip (enumf bufsize) iter)
165
false
true
0
11
63
124
61
63
null
null
ekmett/search
src/Data/Search.hs
bsd-2-clause
-- | 'Search' is more powerful than 'Cont'. -- -- This provides a canonical monad homomorphism into 'Cont'. cps :: Search a b -> Cont a b cps = cont . optimalScore
163
cps :: Search a b -> Cont a b cps = cont . optimalScore
55
cps = cont . optimalScore
25
true
true
0
7
31
38
18
20
null
null
scsibug/hS3
Network/AWS/Authentication.hs
bsd-3-clause
-- | Add an expiration date to a request. addExpirationToReq :: HTTP.HTTPRequest L.ByteString -> String -> HTTP.HTTPRequest L.ByteString addExpirationToReq r = addHeaderToReq r . HTTP.Header HTTP.HdrExpires
206
addExpirationToReq :: HTTP.HTTPRequest L.ByteString -> String -> HTTP.HTTPRequest L.ByteString addExpirationToReq r = addHeaderToReq r . HTTP.Header HTTP.HdrExpires
164
addExpirationToReq r = addHeaderToReq r . HTTP.Header HTTP.HdrExpires
69
true
true
0
9
25
55
25
30
null
null
geekingfrog/advent-of-code
src/Y2018/Day13.hs
bsd-3-clause
step :: Grid -> [Cart] -> [Cart] step grid = fmap (stepCart grid)
65
step :: Grid -> [Cart] -> [Cart] step grid = fmap (stepCart grid)
65
step grid = fmap (stepCart grid)
32
false
true
0
7
12
37
19
18
null
null
andreasabel/helf
src/HerBruijn.hs
mit
abs x e = A.Lam (hash x) Nothing e
34
abs x e = A.Lam (hash x) Nothing e
34
abs x e = A.Lam (hash x) Nothing e
34
false
false
1
7
8
31
12
19
null
null
flipstone/redcard
src/Data/Validation/Aeson.hs
mit
decodeValidJSONT :: Applicative m => ValidatorT m a -> LazyBS.ByteString -> m (ValidationResult a) decodeValidJSONT validator input = case eitherDecode input of Left err -> pure $ Invalid (errMessage $ Text.pack err) Right value -> runValidatorT validator (value :: Value)
295
decodeValidJSONT :: Applicative m => ValidatorT m a -> LazyBS.ByteString -> m (ValidationResult a) decodeValidJSONT validator input = case eitherDecode input of Left err -> pure $ Invalid (errMessage $ Text.pack err) Right value -> runValidatorT validator (value :: Value)
295
decodeValidJSONT validator input = case eitherDecode input of Left err -> pure $ Invalid (errMessage $ Text.pack err) Right value -> runValidatorT validator (value :: Value)
179
false
true
3
12
62
104
48
56
null
null
dylanmc/cryptol
sbv/Data/SBV/Provers/Prover.hs
bsd-3-clause
callSolver :: Bool -> String -> (SMTResult -> b) -> SMTConfig -> SMTProblem -> IO b callSolver isSat checkMsg wrap config (qinps, modelMap, skolemMap, _, smtLibPgm) = do let msg = when (verbose config) . putStrLn . ("** " ++) msg checkMsg let finalPgm = intercalate "\n" (pre ++ post) where SMTLibPgm _ (_, pre, post) = smtLibPgm msg $ "Generated SMTLib program:\n" ++ finalPgm smtAnswer <- engine (solver config) config isSat qinps modelMap skolemMap finalPgm msg "Done.." return $ wrap smtAnswer
546
callSolver :: Bool -> String -> (SMTResult -> b) -> SMTConfig -> SMTProblem -> IO b callSolver isSat checkMsg wrap config (qinps, modelMap, skolemMap, _, smtLibPgm) = do let msg = when (verbose config) . putStrLn . ("** " ++) msg checkMsg let finalPgm = intercalate "\n" (pre ++ post) where SMTLibPgm _ (_, pre, post) = smtLibPgm msg $ "Generated SMTLib program:\n" ++ finalPgm smtAnswer <- engine (solver config) config isSat qinps modelMap skolemMap finalPgm msg "Done.." return $ wrap smtAnswer
546
callSolver isSat checkMsg wrap config (qinps, modelMap, skolemMap, _, smtLibPgm) = do let msg = when (verbose config) . putStrLn . ("** " ++) msg checkMsg let finalPgm = intercalate "\n" (pre ++ post) where SMTLibPgm _ (_, pre, post) = smtLibPgm msg $ "Generated SMTLib program:\n" ++ finalPgm smtAnswer <- engine (solver config) config isSat qinps modelMap skolemMap finalPgm msg "Done.." return $ wrap smtAnswer
462
false
true
0
15
130
206
100
106
null
null
Pold87/Haggressive
testsuite/tests/My.hs
gpl-2.0
vec3 = V.fromList list3
23
vec3 = V.fromList list3
23
vec3 = V.fromList list3
23
false
false
0
6
3
11
5
6
null
null
sdiehl/ghc
testsuite/tests/pmcheck/should_compile/T17096.hs
bsd-3-clause
isNormalized :: Eq a => Expr s a -> Bool isNormalized = loop where loop e = case e of Const _ -> True Var _ -> True Lam _ a b -> loop a && loop b Pi _ a b -> loop a && loop b App f a -> loop f && loop a && case App f a of App (Lam _ _ _) _ -> False App (App ListBuild _) (App (App ListFold _) _) -> False App NaturalBuild (App NaturalFold _) -> False App (App OptionalBuild _) (App (App OptionalFold _) _) -> False App (App (App (App NaturalFold (NaturalLit _)) _) _) _ -> False App NaturalFold (NaturalLit _) -> False App NaturalBuild _ -> False App NaturalIsZero (NaturalLit _) -> False App NaturalEven (NaturalLit _) -> False App NaturalOdd (NaturalLit _) -> False App NaturalShow (NaturalLit _) -> False App (App NaturalSubtract (NaturalLit _)) (NaturalLit _) -> False App (App NaturalSubtract (NaturalLit 0)) _ -> False App (App NaturalSubtract _) (NaturalLit 0) -> False App (App NaturalSubtract x) y -> not (undefined x y) App NaturalToInteger (NaturalLit _) -> False App IntegerShow (IntegerLit _) -> False App IntegerToDouble (IntegerLit _) -> False App DoubleShow (DoubleLit _) -> False App (App OptionalBuild _) _ -> False App (App ListBuild _) _ -> False App (App (App (App (App ListFold _) (ListLit _ _)) _) _) _ -> False App (App ListLength _) (ListLit _ _) -> False App (App ListHead _) (ListLit _ _) -> False App (App ListLast _) (ListLit _ _) -> False App (App ListIndexed _) (ListLit _ _) -> False App (App ListReverse _) (ListLit _ _) -> False App (App (App (App (App OptionalFold _) (Some _)) _) _) _ -> False App (App (App (App (App OptionalFold _) (App None _)) _) _) _ -> False App StringShow (StringLit _) -> False _ -> True Let _ _ _ _ -> False Annot _ _ -> False Bool -> True BoolLit _ -> True BoolAnd x y -> loop x && loop y && decide x y where decide (BoolLit _) _ = False decide _ (BoolLit _) = False decide l r = not (undefined l r) BoolOr x y -> loop x && loop y && decide x y where decide (BoolLit _) _ = False decide _ (BoolLit _) = False decide l r = not (undefined l r) BoolEQ x y -> loop x && loop y && decide x y where decide (BoolLit True) _ = False decide _ (BoolLit True) = False decide l r = not (undefined l r) BoolNE x y -> loop x && loop y && decide x y where decide (BoolLit False) _ = False decide _ (BoolLit False ) = False decide l r = not (undefined l r) BoolIf x y z -> loop x && loop y && loop z && decide x y z where decide (BoolLit _) _ _ = False decide _ (BoolLit True) (BoolLit False) = False decide _ l r = not (undefined l r) Natural -> True NaturalLit _ -> True NaturalFold -> True NaturalBuild -> True NaturalIsZero -> True NaturalEven -> True NaturalOdd -> True NaturalShow -> True NaturalSubtract -> True NaturalToInteger -> True NaturalPlus x y -> loop x && loop y && decide x y where decide (NaturalLit 0) _ = False decide _ (NaturalLit 0) = False decide (NaturalLit _) (NaturalLit _) = False decide _ _ = True NaturalTimes x y -> loop x && loop y && decide x y where decide (NaturalLit 0) _ = False decide _ (NaturalLit 0) = False decide (NaturalLit 1) _ = False decide _ (NaturalLit 1) = False decide (NaturalLit _) (NaturalLit _) = False decide _ _ = True Integer -> True IntegerLit _ -> True IntegerShow -> True IntegerToDouble -> True Double -> True DoubleLit _ -> True DoubleShow -> True String -> True StringLit _ -> False StringAppend _ _ -> False StringShow -> True List -> True ListLit t es -> all loop t && all loop es ListAppend x y -> loop x && loop y && decide x y where decide (ListLit _ m) _ | null m = False decide _ (ListLit _ n) | null n = False decide (ListLit _ _) (ListLit _ _) = False decide _ _ = True ListBuild -> True ListFold -> True ListLength -> True ListHead -> True ListLast -> True ListIndexed -> True ListReverse -> True Optional -> True Some a -> loop a None -> True OptionalFold -> True OptionalBuild -> True Record kts -> undefined kts && all loop (map snd kts) RecordLit kvs -> undefined kvs && all loop (map snd kvs) Union kts -> undefined kts && all (all loop) (map snd kts) Combine x y -> loop x && loop y && decide x y where decide (RecordLit m) _ | null m = False decide _ (RecordLit n) | null n = False decide (RecordLit _) (RecordLit _) = False decide _ _ = True CombineTypes x y -> loop x && loop y && decide x y where decide (Record m) _ | null m = False decide _ (Record n) | null n = False decide (Record _) (Record _) = False decide _ _ = True Prefer x y -> loop x && loop y && decide x y where decide (RecordLit m) _ | null m = False decide _ (RecordLit n) | null n = False decide (RecordLit _) (RecordLit _) = False decide l r = not (undefined l r) Merge x y t -> loop x && loop y && all loop t ToMap x t -> case x of RecordLit _ -> False _ -> loop x && all loop t Field r k -> case r of RecordLit _ -> False Project _ _ -> False Prefer (RecordLit m) _ -> map fst m == [k] && loop r Prefer _ (RecordLit _) -> False Combine (RecordLit m) _ -> map fst m == [k] && loop r Combine _ (RecordLit m) -> map fst m == [k] && loop r _ -> loop r Project r p -> loop r && case p of Left s -> case r of RecordLit _ -> False _ -> not (null s) && undefined s Right e' -> case e' of Record _ -> False _ -> loop e' Assert t -> loop t Equivalent l r -> loop l && loop r Note _ e' -> loop e' ImportAlt l _r -> loop l Embed _ -> True {-# COMPLETE Let' , Const , Var , Lam , Pi , App , Annot , Bool , BoolLit , BoolAnd , BoolOr , BoolEQ , BoolNE , BoolIf , Natural , NaturalLit , NaturalFold , NaturalBuild , NaturalIsZero , NaturalEven , NaturalOdd , NaturalToInteger , NaturalShow , NaturalSubtract , NaturalPlus , NaturalTimes , Integer , IntegerLit , IntegerShow , IntegerToDouble , Double , DoubleLit , DoubleShow , String , StringLit , StringAppend , StringShow , List , ListLit , ListAppend , ListBuild , ListFold , ListLength , ListHead , ListLast , ListIndexed , ListReverse , Optional , Some , None , OptionalFold , OptionalBuild , Record , RecordLit , Union , Combine , CombineTypes , Prefer , Merge , ToMap , Field , Project , Assert , Equivalent , Note , ImportAlt , Embed #-} pattern Let' x mA a b = Let x mA a b
8,235
isNormalized :: Eq a => Expr s a -> Bool isNormalized = loop where loop e = case e of Const _ -> True Var _ -> True Lam _ a b -> loop a && loop b Pi _ a b -> loop a && loop b App f a -> loop f && loop a && case App f a of App (Lam _ _ _) _ -> False App (App ListBuild _) (App (App ListFold _) _) -> False App NaturalBuild (App NaturalFold _) -> False App (App OptionalBuild _) (App (App OptionalFold _) _) -> False App (App (App (App NaturalFold (NaturalLit _)) _) _) _ -> False App NaturalFold (NaturalLit _) -> False App NaturalBuild _ -> False App NaturalIsZero (NaturalLit _) -> False App NaturalEven (NaturalLit _) -> False App NaturalOdd (NaturalLit _) -> False App NaturalShow (NaturalLit _) -> False App (App NaturalSubtract (NaturalLit _)) (NaturalLit _) -> False App (App NaturalSubtract (NaturalLit 0)) _ -> False App (App NaturalSubtract _) (NaturalLit 0) -> False App (App NaturalSubtract x) y -> not (undefined x y) App NaturalToInteger (NaturalLit _) -> False App IntegerShow (IntegerLit _) -> False App IntegerToDouble (IntegerLit _) -> False App DoubleShow (DoubleLit _) -> False App (App OptionalBuild _) _ -> False App (App ListBuild _) _ -> False App (App (App (App (App ListFold _) (ListLit _ _)) _) _) _ -> False App (App ListLength _) (ListLit _ _) -> False App (App ListHead _) (ListLit _ _) -> False App (App ListLast _) (ListLit _ _) -> False App (App ListIndexed _) (ListLit _ _) -> False App (App ListReverse _) (ListLit _ _) -> False App (App (App (App (App OptionalFold _) (Some _)) _) _) _ -> False App (App (App (App (App OptionalFold _) (App None _)) _) _) _ -> False App StringShow (StringLit _) -> False _ -> True Let _ _ _ _ -> False Annot _ _ -> False Bool -> True BoolLit _ -> True BoolAnd x y -> loop x && loop y && decide x y where decide (BoolLit _) _ = False decide _ (BoolLit _) = False decide l r = not (undefined l r) BoolOr x y -> loop x && loop y && decide x y where decide (BoolLit _) _ = False decide _ (BoolLit _) = False decide l r = not (undefined l r) BoolEQ x y -> loop x && loop y && decide x y where decide (BoolLit True) _ = False decide _ (BoolLit True) = False decide l r = not (undefined l r) BoolNE x y -> loop x && loop y && decide x y where decide (BoolLit False) _ = False decide _ (BoolLit False ) = False decide l r = not (undefined l r) BoolIf x y z -> loop x && loop y && loop z && decide x y z where decide (BoolLit _) _ _ = False decide _ (BoolLit True) (BoolLit False) = False decide _ l r = not (undefined l r) Natural -> True NaturalLit _ -> True NaturalFold -> True NaturalBuild -> True NaturalIsZero -> True NaturalEven -> True NaturalOdd -> True NaturalShow -> True NaturalSubtract -> True NaturalToInteger -> True NaturalPlus x y -> loop x && loop y && decide x y where decide (NaturalLit 0) _ = False decide _ (NaturalLit 0) = False decide (NaturalLit _) (NaturalLit _) = False decide _ _ = True NaturalTimes x y -> loop x && loop y && decide x y where decide (NaturalLit 0) _ = False decide _ (NaturalLit 0) = False decide (NaturalLit 1) _ = False decide _ (NaturalLit 1) = False decide (NaturalLit _) (NaturalLit _) = False decide _ _ = True Integer -> True IntegerLit _ -> True IntegerShow -> True IntegerToDouble -> True Double -> True DoubleLit _ -> True DoubleShow -> True String -> True StringLit _ -> False StringAppend _ _ -> False StringShow -> True List -> True ListLit t es -> all loop t && all loop es ListAppend x y -> loop x && loop y && decide x y where decide (ListLit _ m) _ | null m = False decide _ (ListLit _ n) | null n = False decide (ListLit _ _) (ListLit _ _) = False decide _ _ = True ListBuild -> True ListFold -> True ListLength -> True ListHead -> True ListLast -> True ListIndexed -> True ListReverse -> True Optional -> True Some a -> loop a None -> True OptionalFold -> True OptionalBuild -> True Record kts -> undefined kts && all loop (map snd kts) RecordLit kvs -> undefined kvs && all loop (map snd kvs) Union kts -> undefined kts && all (all loop) (map snd kts) Combine x y -> loop x && loop y && decide x y where decide (RecordLit m) _ | null m = False decide _ (RecordLit n) | null n = False decide (RecordLit _) (RecordLit _) = False decide _ _ = True CombineTypes x y -> loop x && loop y && decide x y where decide (Record m) _ | null m = False decide _ (Record n) | null n = False decide (Record _) (Record _) = False decide _ _ = True Prefer x y -> loop x && loop y && decide x y where decide (RecordLit m) _ | null m = False decide _ (RecordLit n) | null n = False decide (RecordLit _) (RecordLit _) = False decide l r = not (undefined l r) Merge x y t -> loop x && loop y && all loop t ToMap x t -> case x of RecordLit _ -> False _ -> loop x && all loop t Field r k -> case r of RecordLit _ -> False Project _ _ -> False Prefer (RecordLit m) _ -> map fst m == [k] && loop r Prefer _ (RecordLit _) -> False Combine (RecordLit m) _ -> map fst m == [k] && loop r Combine _ (RecordLit m) -> map fst m == [k] && loop r _ -> loop r Project r p -> loop r && case p of Left s -> case r of RecordLit _ -> False _ -> not (null s) && undefined s Right e' -> case e' of Record _ -> False _ -> loop e' Assert t -> loop t Equivalent l r -> loop l && loop r Note _ e' -> loop e' ImportAlt l _r -> loop l Embed _ -> True {-# COMPLETE Let' , Const , Var , Lam , Pi , App , Annot , Bool , BoolLit , BoolAnd , BoolOr , BoolEQ , BoolNE , BoolIf , Natural , NaturalLit , NaturalFold , NaturalBuild , NaturalIsZero , NaturalEven , NaturalOdd , NaturalToInteger , NaturalShow , NaturalSubtract , NaturalPlus , NaturalTimes , Integer , IntegerLit , IntegerShow , IntegerToDouble , Double , DoubleLit , DoubleShow , String , StringLit , StringAppend , StringShow , List , ListLit , ListAppend , ListBuild , ListFold , ListLength , ListHead , ListLast , ListIndexed , ListReverse , Optional , Some , None , OptionalFold , OptionalBuild , Record , RecordLit , Union , Combine , CombineTypes , Prefer , Merge , ToMap , Field , Project , Assert , Equivalent , Note , ImportAlt , Embed #-} pattern Let' x mA a b = Let x mA a b
8,235
isNormalized = loop where loop e = case e of Const _ -> True Var _ -> True Lam _ a b -> loop a && loop b Pi _ a b -> loop a && loop b App f a -> loop f && loop a && case App f a of App (Lam _ _ _) _ -> False App (App ListBuild _) (App (App ListFold _) _) -> False App NaturalBuild (App NaturalFold _) -> False App (App OptionalBuild _) (App (App OptionalFold _) _) -> False App (App (App (App NaturalFold (NaturalLit _)) _) _) _ -> False App NaturalFold (NaturalLit _) -> False App NaturalBuild _ -> False App NaturalIsZero (NaturalLit _) -> False App NaturalEven (NaturalLit _) -> False App NaturalOdd (NaturalLit _) -> False App NaturalShow (NaturalLit _) -> False App (App NaturalSubtract (NaturalLit _)) (NaturalLit _) -> False App (App NaturalSubtract (NaturalLit 0)) _ -> False App (App NaturalSubtract _) (NaturalLit 0) -> False App (App NaturalSubtract x) y -> not (undefined x y) App NaturalToInteger (NaturalLit _) -> False App IntegerShow (IntegerLit _) -> False App IntegerToDouble (IntegerLit _) -> False App DoubleShow (DoubleLit _) -> False App (App OptionalBuild _) _ -> False App (App ListBuild _) _ -> False App (App (App (App (App ListFold _) (ListLit _ _)) _) _) _ -> False App (App ListLength _) (ListLit _ _) -> False App (App ListHead _) (ListLit _ _) -> False App (App ListLast _) (ListLit _ _) -> False App (App ListIndexed _) (ListLit _ _) -> False App (App ListReverse _) (ListLit _ _) -> False App (App (App (App (App OptionalFold _) (Some _)) _) _) _ -> False App (App (App (App (App OptionalFold _) (App None _)) _) _) _ -> False App StringShow (StringLit _) -> False _ -> True Let _ _ _ _ -> False Annot _ _ -> False Bool -> True BoolLit _ -> True BoolAnd x y -> loop x && loop y && decide x y where decide (BoolLit _) _ = False decide _ (BoolLit _) = False decide l r = not (undefined l r) BoolOr x y -> loop x && loop y && decide x y where decide (BoolLit _) _ = False decide _ (BoolLit _) = False decide l r = not (undefined l r) BoolEQ x y -> loop x && loop y && decide x y where decide (BoolLit True) _ = False decide _ (BoolLit True) = False decide l r = not (undefined l r) BoolNE x y -> loop x && loop y && decide x y where decide (BoolLit False) _ = False decide _ (BoolLit False ) = False decide l r = not (undefined l r) BoolIf x y z -> loop x && loop y && loop z && decide x y z where decide (BoolLit _) _ _ = False decide _ (BoolLit True) (BoolLit False) = False decide _ l r = not (undefined l r) Natural -> True NaturalLit _ -> True NaturalFold -> True NaturalBuild -> True NaturalIsZero -> True NaturalEven -> True NaturalOdd -> True NaturalShow -> True NaturalSubtract -> True NaturalToInteger -> True NaturalPlus x y -> loop x && loop y && decide x y where decide (NaturalLit 0) _ = False decide _ (NaturalLit 0) = False decide (NaturalLit _) (NaturalLit _) = False decide _ _ = True NaturalTimes x y -> loop x && loop y && decide x y where decide (NaturalLit 0) _ = False decide _ (NaturalLit 0) = False decide (NaturalLit 1) _ = False decide _ (NaturalLit 1) = False decide (NaturalLit _) (NaturalLit _) = False decide _ _ = True Integer -> True IntegerLit _ -> True IntegerShow -> True IntegerToDouble -> True Double -> True DoubleLit _ -> True DoubleShow -> True String -> True StringLit _ -> False StringAppend _ _ -> False StringShow -> True List -> True ListLit t es -> all loop t && all loop es ListAppend x y -> loop x && loop y && decide x y where decide (ListLit _ m) _ | null m = False decide _ (ListLit _ n) | null n = False decide (ListLit _ _) (ListLit _ _) = False decide _ _ = True ListBuild -> True ListFold -> True ListLength -> True ListHead -> True ListLast -> True ListIndexed -> True ListReverse -> True Optional -> True Some a -> loop a None -> True OptionalFold -> True OptionalBuild -> True Record kts -> undefined kts && all loop (map snd kts) RecordLit kvs -> undefined kvs && all loop (map snd kvs) Union kts -> undefined kts && all (all loop) (map snd kts) Combine x y -> loop x && loop y && decide x y where decide (RecordLit m) _ | null m = False decide _ (RecordLit n) | null n = False decide (RecordLit _) (RecordLit _) = False decide _ _ = True CombineTypes x y -> loop x && loop y && decide x y where decide (Record m) _ | null m = False decide _ (Record n) | null n = False decide (Record _) (Record _) = False decide _ _ = True Prefer x y -> loop x && loop y && decide x y where decide (RecordLit m) _ | null m = False decide _ (RecordLit n) | null n = False decide (RecordLit _) (RecordLit _) = False decide l r = not (undefined l r) Merge x y t -> loop x && loop y && all loop t ToMap x t -> case x of RecordLit _ -> False _ -> loop x && all loop t Field r k -> case r of RecordLit _ -> False Project _ _ -> False Prefer (RecordLit m) _ -> map fst m == [k] && loop r Prefer _ (RecordLit _) -> False Combine (RecordLit m) _ -> map fst m == [k] && loop r Combine _ (RecordLit m) -> map fst m == [k] && loop r _ -> loop r Project r p -> loop r && case p of Left s -> case r of RecordLit _ -> False _ -> not (null s) && undefined s Right e' -> case e' of Record _ -> False _ -> loop e' Assert t -> loop t Equivalent l r -> loop l && loop r Note _ e' -> loop e' ImportAlt l _r -> loop l Embed _ -> True {-# COMPLETE Let' , Const , Var , Lam , Pi , App , Annot , Bool , BoolLit , BoolAnd , BoolOr , BoolEQ , BoolNE , BoolIf , Natural , NaturalLit , NaturalFold , NaturalBuild , NaturalIsZero , NaturalEven , NaturalOdd , NaturalToInteger , NaturalShow , NaturalSubtract , NaturalPlus , NaturalTimes , Integer , IntegerLit , IntegerShow , IntegerToDouble , Double , DoubleLit , DoubleShow , String , StringLit , StringAppend , StringShow , List , ListLit , ListAppend , ListBuild , ListFold , ListLength , ListHead , ListLast , ListIndexed , ListReverse , Optional , Some , None , OptionalFold , OptionalBuild , Record , RecordLit , Union , Combine , CombineTypes , Prefer , Merge , ToMap , Field , Project , Assert , Equivalent , Note , ImportAlt , Embed #-} pattern Let' x mA a b = Let x mA a b
8,194
false
true
0
22
3,476
2,884
1,351
1,533
null
null
DavidAlphaFox/ghc
libraries/Cabal/cabal-install/Distribution/Client/Dependency/TopDown.hs
bsd-3-clause
explore pref (ChoiceNode _ choices) = case [ choice | [choice] <- choices ] of ((_, node'):_) -> Step (logInfo node') (explore pref node') [] -> Step (logInfo node') (explore pref node') where choice = minimumBy (comparing topSortNumber) choices pkgname = packageName . fst . head $ choice (_, node') = maximumBy (bestByPref pkgname) choice where topSortNumber choice = case fst (head choice) of InstalledOnly (InstalledPackageEx _ i _) -> i SourceOnly (UnconfiguredPackage _ i _ _) -> i InstalledAndSource _ (UnconfiguredPackage _ i _ _) -> i bestByPref pkgname = case packageInstalledPreference of PreferLatest -> comparing (\(p,_) -> ( isPreferred p, packageId p)) PreferInstalled -> comparing (\(p,_) -> (isInstalled p, isPreferred p, packageId p)) where isInstalled (SourceOnly _) = False isInstalled _ = True isPreferred p = packageVersion p `withinRange` preferredVersions (PackagePreferences preferredVersions packageInstalledPreference) = pref pkgname logInfo node = Select selected discarded where (selected, discarded) = case node of Failure _ -> ([], []) ChoiceNode (_,_,changes) _ -> changes -- ------------------------------------------------------------ -- * Generate a search tree -- ------------------------------------------------------------
1,538
explore pref (ChoiceNode _ choices) = case [ choice | [choice] <- choices ] of ((_, node'):_) -> Step (logInfo node') (explore pref node') [] -> Step (logInfo node') (explore pref node') where choice = minimumBy (comparing topSortNumber) choices pkgname = packageName . fst . head $ choice (_, node') = maximumBy (bestByPref pkgname) choice where topSortNumber choice = case fst (head choice) of InstalledOnly (InstalledPackageEx _ i _) -> i SourceOnly (UnconfiguredPackage _ i _ _) -> i InstalledAndSource _ (UnconfiguredPackage _ i _ _) -> i bestByPref pkgname = case packageInstalledPreference of PreferLatest -> comparing (\(p,_) -> ( isPreferred p, packageId p)) PreferInstalled -> comparing (\(p,_) -> (isInstalled p, isPreferred p, packageId p)) where isInstalled (SourceOnly _) = False isInstalled _ = True isPreferred p = packageVersion p `withinRange` preferredVersions (PackagePreferences preferredVersions packageInstalledPreference) = pref pkgname logInfo node = Select selected discarded where (selected, discarded) = case node of Failure _ -> ([], []) ChoiceNode (_,_,changes) _ -> changes -- ------------------------------------------------------------ -- * Generate a search tree -- ------------------------------------------------------------
1,538
explore pref (ChoiceNode _ choices) = case [ choice | [choice] <- choices ] of ((_, node'):_) -> Step (logInfo node') (explore pref node') [] -> Step (logInfo node') (explore pref node') where choice = minimumBy (comparing topSortNumber) choices pkgname = packageName . fst . head $ choice (_, node') = maximumBy (bestByPref pkgname) choice where topSortNumber choice = case fst (head choice) of InstalledOnly (InstalledPackageEx _ i _) -> i SourceOnly (UnconfiguredPackage _ i _ _) -> i InstalledAndSource _ (UnconfiguredPackage _ i _ _) -> i bestByPref pkgname = case packageInstalledPreference of PreferLatest -> comparing (\(p,_) -> ( isPreferred p, packageId p)) PreferInstalled -> comparing (\(p,_) -> (isInstalled p, isPreferred p, packageId p)) where isInstalled (SourceOnly _) = False isInstalled _ = True isPreferred p = packageVersion p `withinRange` preferredVersions (PackagePreferences preferredVersions packageInstalledPreference) = pref pkgname logInfo node = Select selected discarded where (selected, discarded) = case node of Failure _ -> ([], []) ChoiceNode (_,_,changes) _ -> changes -- ------------------------------------------------------------ -- * Generate a search tree -- ------------------------------------------------------------
1,538
false
false
0
12
448
468
239
229
null
null
wfaler/mywai
src/Web/Mail.hs
bsd-3-clause
mkMail :: Address -> [Address] -> Text -> TL.Text -> Mail mkMail from to subject body = ML.simpleMail from to [] [] subject [ML.plainTextPart body, ML.htmlPart body]
165
mkMail :: Address -> [Address] -> Text -> TL.Text -> Mail mkMail from to subject body = ML.simpleMail from to [] [] subject [ML.plainTextPart body, ML.htmlPart body]
165
mkMail from to subject body = ML.simpleMail from to [] [] subject [ML.plainTextPart body, ML.htmlPart body]
107
false
true
0
9
26
76
38
38
null
null
apyrgio/ganeti
src/Ganeti/UDSServer.hs
bsd-2-clause
handleRawMessage :: (J.JSON o, MonadLog m) => Handler i m o -- ^ handler -> String -- ^ raw unparsed input -> m (Bool, String) handleRawMessage handler payload = case parseCall payload >>= uncurry (hParse handler) of Bad err -> do let errmsg = "Failed to parse request: " ++ err logWarning errmsg return (False, buildResponse False (J.showJSON errmsg)) Ok req -> do logDebug $ "Request: " ++ hInputLogLong handler req (close, call_result_json) <- handleJsonMessage handler req logMsg handler req call_result_json let (status, response) = prepareMsg call_result_json return (close, buildResponse status response)
733
handleRawMessage :: (J.JSON o, MonadLog m) => Handler i m o -- ^ handler -> String -- ^ raw unparsed input -> m (Bool, String) handleRawMessage handler payload = case parseCall payload >>= uncurry (hParse handler) of Bad err -> do let errmsg = "Failed to parse request: " ++ err logWarning errmsg return (False, buildResponse False (J.showJSON errmsg)) Ok req -> do logDebug $ "Request: " ++ hInputLogLong handler req (close, call_result_json) <- handleJsonMessage handler req logMsg handler req call_result_json let (status, response) = prepareMsg call_result_json return (close, buildResponse status response)
733
handleRawMessage handler payload = case parseCall payload >>= uncurry (hParse handler) of Bad err -> do let errmsg = "Failed to parse request: " ++ err logWarning errmsg return (False, buildResponse False (J.showJSON errmsg)) Ok req -> do logDebug $ "Request: " ++ hInputLogLong handler req (close, call_result_json) <- handleJsonMessage handler req logMsg handler req call_result_json let (status, response) = prepareMsg call_result_json return (close, buildResponse status response)
561
false
true
0
15
213
221
105
116
null
null
Sapiens-OpenSource/webbench
haskell/client/src/Main.hs
bsd-2-clause
clientThread :: IO () -> Int -> Bool -> Request -> TVar Bool -> StdGen -> IO [ Call ] clientThread barrier userCnt doDeepCheck basereq flag rgen = do manager <- newManager defaultManagerSettings barrier go manager rgen [] where go manager r res = do let (r2, req) = makeReq r s <- getTime Monotonic resp <- httpLbs req manager _ <- evaluate $ force $ responseBody resp e <- getTime Monotonic let c = Call s e (checkResp resp) cont <- readTVarIO flag if cont then go manager r2 (c:res) else return (c:res) makeReq rand = (rand4, basereq { queryString = qstring, requestBody = reqbody }) where reqbody = RequestBodyLBS $ encode sorts qstring = QString.toString $ QString.queryString [ ("limit", Char8.pack (show limit)), ("offset", Char8.pack (show offset)) ] (limit, rand1) = randomR (10, 100::Int) rand (offset, rand2) = randomR (0, (userCnt - limit)) rand1 (numsorts, rand3) = randomR (1, 3::Int) rand2 (sorts, rand4) = makeSorts numsorts rand3 makeSorts n r | n < 0 = ([], r) | otherwise = let (sb, r2) = randomBounded r in let (dir, r3) = randomBounded r2 in let (tl, r4) = makeSorts (n-1) r3 in ((Sorting sb dir : tl), r4) checkResp resp = ((statusCode (responseStatus resp)) == 200) && (not doDeepCheck || (isJust (decodeBody resp))) decodeBody :: Response ByteString -> Maybe [ User ] decodeBody = decode' . responseBody
2,174
clientThread :: IO () -> Int -> Bool -> Request -> TVar Bool -> StdGen -> IO [ Call ] clientThread barrier userCnt doDeepCheck basereq flag rgen = do manager <- newManager defaultManagerSettings barrier go manager rgen [] where go manager r res = do let (r2, req) = makeReq r s <- getTime Monotonic resp <- httpLbs req manager _ <- evaluate $ force $ responseBody resp e <- getTime Monotonic let c = Call s e (checkResp resp) cont <- readTVarIO flag if cont then go manager r2 (c:res) else return (c:res) makeReq rand = (rand4, basereq { queryString = qstring, requestBody = reqbody }) where reqbody = RequestBodyLBS $ encode sorts qstring = QString.toString $ QString.queryString [ ("limit", Char8.pack (show limit)), ("offset", Char8.pack (show offset)) ] (limit, rand1) = randomR (10, 100::Int) rand (offset, rand2) = randomR (0, (userCnt - limit)) rand1 (numsorts, rand3) = randomR (1, 3::Int) rand2 (sorts, rand4) = makeSorts numsorts rand3 makeSorts n r | n < 0 = ([], r) | otherwise = let (sb, r2) = randomBounded r in let (dir, r3) = randomBounded r2 in let (tl, r4) = makeSorts (n-1) r3 in ((Sorting sb dir : tl), r4) checkResp resp = ((statusCode (responseStatus resp)) == 200) && (not doDeepCheck || (isJust (decodeBody resp))) decodeBody :: Response ByteString -> Maybe [ User ] decodeBody = decode' . responseBody
2,170
clientThread barrier userCnt doDeepCheck basereq flag rgen = do manager <- newManager defaultManagerSettings barrier go manager rgen [] where go manager r res = do let (r2, req) = makeReq r s <- getTime Monotonic resp <- httpLbs req manager _ <- evaluate $ force $ responseBody resp e <- getTime Monotonic let c = Call s e (checkResp resp) cont <- readTVarIO flag if cont then go manager r2 (c:res) else return (c:res) makeReq rand = (rand4, basereq { queryString = qstring, requestBody = reqbody }) where reqbody = RequestBodyLBS $ encode sorts qstring = QString.toString $ QString.queryString [ ("limit", Char8.pack (show limit)), ("offset", Char8.pack (show offset)) ] (limit, rand1) = randomR (10, 100::Int) rand (offset, rand2) = randomR (0, (userCnt - limit)) rand1 (numsorts, rand3) = randomR (1, 3::Int) rand2 (sorts, rand4) = makeSorts numsorts rand3 makeSorts n r | n < 0 = ([], r) | otherwise = let (sb, r2) = randomBounded r in let (dir, r3) = randomBounded r2 in let (tl, r4) = makeSorts (n-1) r3 in ((Sorting sb dir : tl), r4) checkResp resp = ((statusCode (responseStatus resp)) == 200) && (not doDeepCheck || (isJust (decodeBody resp))) decodeBody :: Response ByteString -> Maybe [ User ] decodeBody = decode' . responseBody
2,060
false
true
8
16
1,075
678
327
351
null
null
xmonad/xmonad-contrib
XMonad/Actions/TagWindows.hs
bsd-3-clause
unTag :: Window -> X () unTag = setTag ""
41
unTag :: Window -> X () unTag = setTag ""
41
unTag = setTag ""
17
false
true
0
7
9
23
11
12
null
null
haslab/SecreC
src/Main.hs
gpl-3.0
pruneModuleFiles (m:ms) = do m' <- pruneModuleFile m ms' <- pruneModuleFiles ms returnS (m':ms')
108
pruneModuleFiles (m:ms) = do m' <- pruneModuleFile m ms' <- pruneModuleFiles ms returnS (m':ms')
108
pruneModuleFiles (m:ms) = do m' <- pruneModuleFile m ms' <- pruneModuleFiles ms returnS (m':ms')
108
false
false
0
9
25
50
22
28
null
null
mchakravarty/lets-program
step1/Game.hs
bsd-3-clause
-- This starts our gamein a window with a give size, running at 30 frames per second. -- -- The argument 'World (0, 0)' is the initial state of our game world, where our character is at the centre of the -- window. -- main = play (InWindow "Slime is here!" (600, 400) (50, 50)) white 30 (World (0, 0)) draw handle []
317
main = play (InWindow "Slime is here!" (600, 400) (50, 50)) white 30 (World (0, 0)) draw handle []
98
main = play (InWindow "Slime is here!" (600, 400) (50, 50)) white 30 (World (0, 0)) draw handle []
98
true
false
0
8
63
62
36
26
null
null
sweirich/hs-inferno
src/Language/Inferno/Generic/SolverHi.hs
bsd-3-clause
-------------------------------------------------------------------------- -- Equations -- an equality constraint on the type variables v1 and v2 -- (-=-) :: Monad m => Var m (Src t) -> Var m (Src t) -> Co m t () v1 -=- v2 = Co (Lo.CEq v1 v2) (\env -> return ())
263
v1 -=- v2 = Co (Lo.CEq v1 v2) (\env -> return ())
49
v1 -=- v2 = Co (Lo.CEq v1 v2) (\env -> return ())
49
true
false
0
9
46
44
23
21
null
null
ikirill/ComputationalMathematics
Cube/CubeGL.hs
gpl-3.0
getRot :: RotSpec -> (VV -> VV) getRot rot@RotSpec{rotElt = SiderotElt side _, ..} = let (degrees, axis) = degAxis rot in rotVertex (realToFrac degrees) axis
159
getRot :: RotSpec -> (VV -> VV) getRot rot@RotSpec{rotElt = SiderotElt side _, ..} = let (degrees, axis) = degAxis rot in rotVertex (realToFrac degrees) axis
159
getRot rot@RotSpec{rotElt = SiderotElt side _, ..} = let (degrees, axis) = degAxis rot in rotVertex (realToFrac degrees) axis
127
false
true
1
9
27
84
40
44
null
null
romanb/amazonka
amazonka-elastictranscoder/gen/Network/AWS/ElasticTranscoder/ListPipelines.hs
mpl-2.0
-- | To list pipelines in chronological order by the date and time that they were -- created, enter 'true'. To list pipelines in reverse chronological order, enter 'false'. lpAscending :: Lens' ListPipelines (Maybe Text) lpAscending = lens _lpAscending (\s a -> s { _lpAscending = a })
285
lpAscending :: Lens' ListPipelines (Maybe Text) lpAscending = lens _lpAscending (\s a -> s { _lpAscending = a })
112
lpAscending = lens _lpAscending (\s a -> s { _lpAscending = a })
64
true
true
1
9
47
50
26
24
null
null
brendanhay/gogol
gogol-testing/gen/Network/Google/Testing/Types/Product.hs
mpl-2.0
-- | Required. The id of the Android OS version to be used. Use the -- TestEnvironmentDiscoveryService to get supported options. adAndroidVersionId :: Lens' AndroidDevice (Maybe Text) adAndroidVersionId = lens _adAndroidVersionId (\ s a -> s{_adAndroidVersionId = a})
275
adAndroidVersionId :: Lens' AndroidDevice (Maybe Text) adAndroidVersionId = lens _adAndroidVersionId (\ s a -> s{_adAndroidVersionId = a})
146
adAndroidVersionId = lens _adAndroidVersionId (\ s a -> s{_adAndroidVersionId = a})
91
true
true
0
8
45
50
26
24
null
null
jamessanders/Push
src/Main.hs
bsd-3-clause
getSubProcess "init" = Just Push.Command.Init.main
51
getSubProcess "init" = Just Push.Command.Init.main
51
getSubProcess "init" = Just Push.Command.Init.main
51
false
false
1
6
5
20
8
12
null
null
fmapfmapfmap/amazonka
amazonka-opsworks/gen/Network/AWS/OpsWorks/UpdateApp.hs
mpl-2.0
-- | Creates a value of 'UpdateAppResponse' with the minimum fields required to make a request. -- updateAppResponse :: UpdateAppResponse updateAppResponse = UpdateAppResponse'
180
updateAppResponse :: UpdateAppResponse updateAppResponse = UpdateAppResponse'
81
updateAppResponse = UpdateAppResponse'
38
true
true
0
6
26
20
9
11
null
null
fmapfmapfmap/amazonka
amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs
mpl-2.0
-- | A unique ID for the Reserved Instance modification. rimReservedInstancesModificationId :: Lens' ReservedInstancesModification (Maybe Text) rimReservedInstancesModificationId = lens _rimReservedInstancesModificationId (\ s a -> s{_rimReservedInstancesModificationId = a})
275
rimReservedInstancesModificationId :: Lens' ReservedInstancesModification (Maybe Text) rimReservedInstancesModificationId = lens _rimReservedInstancesModificationId (\ s a -> s{_rimReservedInstancesModificationId = a})
218
rimReservedInstancesModificationId = lens _rimReservedInstancesModificationId (\ s a -> s{_rimReservedInstancesModificationId = a})
131
true
true
0
9
26
46
25
21
null
null
siddhanathan/ghc
compiler/typecheck/TcGenDeriv.hs
bsd-3-clause
constr_RDR = tcQual_RDR gENERICS (fsLit "Constr")
55
constr_RDR = tcQual_RDR gENERICS (fsLit "Constr")
55
constr_RDR = tcQual_RDR gENERICS (fsLit "Constr")
55
false
false
1
7
11
20
8
12
null
null
RossMeikleham/GPC
tests/GPC/TypeTests.hs
bsd-2-clause
methodCalls = map programTempl [[AssignStmt $ Assign intTypeNK (Ident srcPos "i") (ExpMethodCall (MethodCall (VarIdent $ Ident srcPos "obj") (Ident srcPos "m1") [intConst 5])) ,MethodStmt $ MethodCall (VarIdent $ Ident srcPos "obj") (Ident srcPos "m1") [intConst 32] ] ]
299
methodCalls = map programTempl [[AssignStmt $ Assign intTypeNK (Ident srcPos "i") (ExpMethodCall (MethodCall (VarIdent $ Ident srcPos "obj") (Ident srcPos "m1") [intConst 5])) ,MethodStmt $ MethodCall (VarIdent $ Ident srcPos "obj") (Ident srcPos "m1") [intConst 32] ] ]
299
methodCalls = map programTempl [[AssignStmt $ Assign intTypeNK (Ident srcPos "i") (ExpMethodCall (MethodCall (VarIdent $ Ident srcPos "obj") (Ident srcPos "m1") [intConst 5])) ,MethodStmt $ MethodCall (VarIdent $ Ident srcPos "obj") (Ident srcPos "m1") [intConst 32] ] ]
299
false
false
0
16
66
118
59
59
null
null
anchor/gearman-haskell
src/System/Gearman/Protocol.hs
mit
-- |Construct a CAN_DO request packet (workers send these to register -- functions with the server). buildCanDoReq :: L.ByteString -> L.ByteString buildCanDoReq = L.append (renderHeader canDo) . packData . (:[])
223
buildCanDoReq :: L.ByteString -> L.ByteString buildCanDoReq = L.append (renderHeader canDo) . packData . (:[])
122
buildCanDoReq = L.append (renderHeader canDo) . packData . (:[])
70
true
true
0
9
41
46
25
21
null
null
shlevy/ghc
compiler/deSugar/DsForeign.hs
bsd-3-clause
dsCImport id co CWrapper cconv _ _ = dsFExportDynamic id co cconv
67
dsCImport id co CWrapper cconv _ _ = dsFExportDynamic id co cconv
67
dsCImport id co CWrapper cconv _ _ = dsFExportDynamic id co cconv
67
false
false
0
5
13
26
12
14
null
null
josuf107/Adverb
Adverb/Common.hs
gpl-3.0
excusingly = id
15
excusingly = id
15
excusingly = id
15
false
false
0
4
2
6
3
3
null
null
frontrowed/stratosphere
library-gen/Stratosphere/Resources/CognitoUserPool.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-policies cupPolicies :: Lens' CognitoUserPool (Maybe CognitoUserPoolPolicies) cupPolicies = lens _cognitoUserPoolPolicies (\s a -> s { _cognitoUserPoolPolicies = a })
289
cupPolicies :: Lens' CognitoUserPool (Maybe CognitoUserPoolPolicies) cupPolicies = lens _cognitoUserPoolPolicies (\s a -> s { _cognitoUserPoolPolicies = a })
157
cupPolicies = lens _cognitoUserPoolPolicies (\s a -> s { _cognitoUserPoolPolicies = a })
88
true
true
2
9
21
54
25
29
null
null
phischu/fragnix
tests/packages/scotty/Control.Concurrent.Lifted.hs
bsd-3-clause
-- | Generalized version of 'C.killThread'. killThread :: MonadBase IO m => ThreadId -> m () killThread = liftBase . C.killThread
129
killThread :: MonadBase IO m => ThreadId -> m () killThread = liftBase . C.killThread
85
killThread = liftBase . C.killThread
36
true
true
0
9
20
42
19
23
null
null
Heather/Idris-dev
src/Idris/Core/ProofTerm.hs
bsd-3-clause
updateSolvedPath ns (AppL s p r) = AppL s (updateSolvedPath ns p) (updateSolvedTerm ns r)
89
updateSolvedPath ns (AppL s p r) = AppL s (updateSolvedPath ns p) (updateSolvedTerm ns r)
89
updateSolvedPath ns (AppL s p r) = AppL s (updateSolvedPath ns p) (updateSolvedTerm ns r)
89
false
false
0
7
14
44
21
23
null
null
JohnLato/jaek
src/Jaek/Tree.hs
lgpl-3.0
mkCut :: [ClipRef] -> TreeZip -> TreeZip mkCut sels = mod1 "mkCut" (map sel1 sels) $ \cn -> map (\(_,off,dur) -> Cut cn off dur) $ filter (\i -> sel1 i == cn) sels
165
mkCut :: [ClipRef] -> TreeZip -> TreeZip mkCut sels = mod1 "mkCut" (map sel1 sels) $ \cn -> map (\(_,off,dur) -> Cut cn off dur) $ filter (\i -> sel1 i == cn) sels
165
mkCut sels = mod1 "mkCut" (map sel1 sels) $ \cn -> map (\(_,off,dur) -> Cut cn off dur) $ filter (\i -> sel1 i == cn) sels
124
false
true
0
12
35
98
51
47
null
null
shlevy/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
cgOpApp :: StgOp -- The op -> [StgArg] -- Arguments -> Type -- Result type (always an unboxed tuple) -> FCode ReturnKind -- Foreign calls cgOpApp (StgFCallOp fcall _) stg_args res_ty = cgForeignCall fcall stg_args res_ty
266
cgOpApp :: StgOp -- The op -> [StgArg] -- Arguments -> Type -- Result type (always an unboxed tuple) -> FCode ReturnKind cgOpApp (StgFCallOp fcall _) stg_args res_ty = cgForeignCall fcall stg_args res_ty
248
cgOpApp (StgFCallOp fcall _) stg_args res_ty = cgForeignCall fcall stg_args res_ty
84
true
true
0
11
81
61
30
31
null
null
fmthoma/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
append_RDR = varQual_RDR gHC_BASE (fsLit "++")
59
append_RDR = varQual_RDR gHC_BASE (fsLit "++")
59
append_RDR = varQual_RDR gHC_BASE (fsLit "++")
59
false
false
0
7
18
17
8
9
null
null
tismith/tlisp
write-yourself-a-scheme/listings/listing9.hs
mit
evalString :: Env -> String -> IO String evalString env expr = runIOThrows $ liftM show $ (liftThrows $ readExpr expr) >>= eval env
131
evalString :: Env -> String -> IO String evalString env expr = runIOThrows $ liftM show $ (liftThrows $ readExpr expr) >>= eval env
131
evalString env expr = runIOThrows $ liftM show $ (liftThrows $ readExpr expr) >>= eval env
90
false
true
0
9
23
55
26
29
null
null
ocharles/hackage-server
Distribution/Server/Packages/PackageIndex.hs
bsd-3-clause
insertWith :: Package pkg => (pkg -> pkg -> pkg) -> pkg -> PackageIndex pkg -> PackageIndex pkg insertWith mergeFunc pkg (PackageIndex index) = mkPackageIndex $ Map.insertWith (\_ -> insertMerge) (packageName pkg) [pkg] index where pkgid = packageId pkg insertMerge [] = [pkg] insertMerge pkgs@(pkg':pkgs') = case compare pkgid (packageId pkg') of LT -> pkg : pkgs EQ -> let merged = mergeFunc pkg pkg' in if packageId merged == pkgid then merged : pkgs' else pkg : pkgs' GT -> pkg' : insertMerge pkgs' -- | Internal delete helper. --
634
insertWith :: Package pkg => (pkg -> pkg -> pkg) -> pkg -> PackageIndex pkg -> PackageIndex pkg insertWith mergeFunc pkg (PackageIndex index) = mkPackageIndex $ Map.insertWith (\_ -> insertMerge) (packageName pkg) [pkg] index where pkgid = packageId pkg insertMerge [] = [pkg] insertMerge pkgs@(pkg':pkgs') = case compare pkgid (packageId pkg') of LT -> pkg : pkgs EQ -> let merged = mergeFunc pkg pkg' in if packageId merged == pkgid then merged : pkgs' else pkg : pkgs' GT -> pkg' : insertMerge pkgs' -- | Internal delete helper. --
634
insertWith mergeFunc pkg (PackageIndex index) = mkPackageIndex $ Map.insertWith (\_ -> insertMerge) (packageName pkg) [pkg] index where pkgid = packageId pkg insertMerge [] = [pkg] insertMerge pkgs@(pkg':pkgs') = case compare pkgid (packageId pkg') of LT -> pkg : pkgs EQ -> let merged = mergeFunc pkg pkg' in if packageId merged == pkgid then merged : pkgs' else pkg : pkgs' GT -> pkg' : insertMerge pkgs' -- | Internal delete helper. --
538
false
true
0
12
190
219
110
109
null
null
unisonweb/platform
parser-typechecker/src/Unison/Util/Pretty.hs
mit
parenthesizeIf :: IsString s => Bool -> Pretty s -> Pretty s parenthesizeIf False s = s
87
parenthesizeIf :: IsString s => Bool -> Pretty s -> Pretty s parenthesizeIf False s = s
87
parenthesizeIf False s = s
26
false
true
0
8
16
37
17
20
null
null
heathweiss/Tricad
src/Examples/ShoeLift/SandalsHeel.hs
gpl-2.0
strapTopFaceDebug = [CubeName "strapCube" | x <- [1..]] +++^? [strapCube]
82
strapTopFaceDebug = [CubeName "strapCube" | x <- [1..]] +++^? [strapCube]
82
strapTopFaceDebug = [CubeName "strapCube" | x <- [1..]] +++^? [strapCube]
82
false
false
3
8
18
34
16
18
null
null
forste/haReFork
tools/hs2html/HLexTagModuleNames.hs
bsd-3-clause
convi' ts = conv ts
19
convi' ts = conv ts
19
convi' ts = conv ts
19
false
false
0
5
4
12
5
7
null
null
btipling/machine-vm
test/VMTest/Machine/Gates.hs
bsd-3-clause
testGatesXor :: HUnit.Test testGatesXor = testTwoInputGate "Xor" Gates.xor [(0, 0, 0) ,(1, 0, 1) ,(0, 1, 1) ,(1, 1, 0)]
263
testGatesXor :: HUnit.Test testGatesXor = testTwoInputGate "Xor" Gates.xor [(0, 0, 0) ,(1, 0, 1) ,(0, 1, 1) ,(1, 1, 0)]
263
testGatesXor = testTwoInputGate "Xor" Gates.xor [(0, 0, 0) ,(1, 0, 1) ,(0, 1, 1) ,(1, 1, 0)]
236
false
true
0
7
163
78
44
34
null
null
sergv/vector
Data/Vector/Fusion/Stream/Monadic.hs
bsd-3-clause
length = foldl' (\n _ -> n+1) 0
31
length = foldl' (\n _ -> n+1) 0
31
length = foldl' (\n _ -> n+1) 0
31
false
false
1
8
7
29
13
16
null
null
kawu/crf-chain1-constrained
src/Data/CRF/Chain1/Constrained/Train.hs
bsd-2-clause
-- | Collect interpretations (also labels assigned) of words in a dataset. anyInterps :: Ord b => [SentL a b] -> S.Set b anyInterps = S.union <$> collect (S.toList . lbs . word) <*> anyChosen
199
anyInterps :: Ord b => [SentL a b] -> S.Set b anyInterps = S.union <$> collect (S.toList . lbs . word) <*> anyChosen
124
anyInterps = S.union <$> collect (S.toList . lbs . word) <*> anyChosen
78
true
true
5
9
42
72
34
38
null
null
ezyang/ghc
compiler/basicTypes/PatSyn.hs
bsd-3-clause
patSynMatcher :: PatSyn -> (Id,Bool) patSynMatcher = psMatcher
62
patSynMatcher :: PatSyn -> (Id,Bool) patSynMatcher = psMatcher
62
patSynMatcher = psMatcher
25
false
true
0
6
7
21
12
9
null
null
scslab/hails
examples/hails-rock/HailsRock/MP.hs
mit
maybeRead :: Read a => String -> Maybe a maybeRead = fmap fst . listToMaybe . reads
83
maybeRead :: Read a => String -> Maybe a maybeRead = fmap fst . listToMaybe . reads
83
maybeRead = fmap fst . listToMaybe . reads
42
false
true
0
7
16
36
17
19
null
null
rCEx/feldspar-lang-small
src/Feldspar/Core/Types.hs
bsd-3-clause
widthEq _ _ = Nothing
21
widthEq _ _ = Nothing
21
widthEq _ _ = Nothing
21
false
false
1
5
4
12
5
7
null
null
alphalambda/k12math
prog/graph/graph08poly.hs
mit
prepare_odd f = (guess (-1) (-1),guess 1 1) where guess s x | signum (f x) == s = x | otherwise = guess s (2*x)
141
prepare_odd f = (guess (-1) (-1),guess 1 1) where guess s x | signum (f x) == s = x | otherwise = guess s (2*x)
141
prepare_odd f = (guess (-1) (-1),guess 1 1) where guess s x | signum (f x) == s = x | otherwise = guess s (2*x)
141
false
false
0
11
55
87
42
45
null
null
facebookincubator/duckling
Duckling/Email/IS/Rules.hs
bsd-3-clause
rules :: [Rule] rules = [ ruleEmailSpelledOut ]
51
rules :: [Rule] rules = [ ruleEmailSpelledOut ]
51
rules = [ ruleEmailSpelledOut ]
35
false
true
0
7
11
24
11
13
null
null
lordi/jazzmate
src/Core.hs
gpl-2.0
toPitch :: Note -> V.Pitch toPitch k = V.toPitch (fromEnum k)
61
toPitch :: Note -> V.Pitch toPitch k = V.toPitch (fromEnum k)
61
toPitch k = V.toPitch (fromEnum k)
34
false
true
0
7
10
31
15
16
null
null
olorin/amazonka
amazonka-config/test/Test/AWS/Gen/Config.hs
mpl-2.0
testDescribeDeliveryChannelsResponse :: DescribeDeliveryChannelsResponse -> TestTree testDescribeDeliveryChannelsResponse = res "DescribeDeliveryChannelsResponse" "fixture/DescribeDeliveryChannelsResponse.proto" config (Proxy :: Proxy DescribeDeliveryChannels)
276
testDescribeDeliveryChannelsResponse :: DescribeDeliveryChannelsResponse -> TestTree testDescribeDeliveryChannelsResponse = res "DescribeDeliveryChannelsResponse" "fixture/DescribeDeliveryChannelsResponse.proto" config (Proxy :: Proxy DescribeDeliveryChannels)
276
testDescribeDeliveryChannelsResponse = res "DescribeDeliveryChannelsResponse" "fixture/DescribeDeliveryChannelsResponse.proto" config (Proxy :: Proxy DescribeDeliveryChannels)
191
false
true
0
6
30
36
17
19
null
null