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
arekfu/markov-chains
src/MarkovChain.hs
mit
actWhileM :: Monad m => a -> (a -> m (Maybe a)) -> m [a] actWhileM initialState act = do newState <- act initialState case newState of Nothing -> return [] Just s -> do rest <- actWhileM s act return (s:rest) -- | Take steps until we hit absorption
286
actWhileM :: Monad m => a -> (a -> m (Maybe a)) -> m [a] actWhileM initialState act = do newState <- act initialState case newState of Nothing -> return [] Just s -> do rest <- actWhileM s act return (s:rest) -- | Take steps until we hit absorption
286
actWhileM initialState act = do newState <- act initialState case newState of Nothing -> return [] Just s -> do rest <- actWhileM s act return (s:rest) -- | Take steps until we hit absorption
229
false
true
0
14
87
116
54
62
null
null
garetxe/cabal
cabal-install/Distribution/Client/Dependency/Modular/Preference.hs
bsd-3-clause
processPackageConstraintF :: Flag -> ConflictSet QPN -> Bool -> LabeledPackageConstraint -> Tree a -> Tree a processPackageConstraintF f c b' (LabeledPackageConstraint pc src) r = go pc where go (PackageConstraintFlags _ fa) = case L.lookup f fa of Nothing -> r Just b | b == b' -> r | otherwise -> Fail c (GlobalConstraintFlag src) go _ = r -- | Helper function that tries to enforce a single package constraint on a -- given flag setting for an F-node. Translates the constraint into a -- tree-transformer that either leaves the subtree untouched, or replaces it -- with an appropriate failure node.
828
processPackageConstraintF :: Flag -> ConflictSet QPN -> Bool -> LabeledPackageConstraint -> Tree a -> Tree a processPackageConstraintF f c b' (LabeledPackageConstraint pc src) r = go pc where go (PackageConstraintFlags _ fa) = case L.lookup f fa of Nothing -> r Just b | b == b' -> r | otherwise -> Fail c (GlobalConstraintFlag src) go _ = r -- | Helper function that tries to enforce a single package constraint on a -- given flag setting for an F-node. Translates the constraint into a -- tree-transformer that either leaves the subtree untouched, or replaces it -- with an appropriate failure node.
828
processPackageConstraintF f c b' (LabeledPackageConstraint pc src) r = go pc where go (PackageConstraintFlags _ fa) = case L.lookup f fa of Nothing -> r Just b | b == b' -> r | otherwise -> Fail c (GlobalConstraintFlag src) go _ = r -- | Helper function that tries to enforce a single package constraint on a -- given flag setting for an F-node. Translates the constraint into a -- tree-transformer that either leaves the subtree untouched, or replaces it -- with an appropriate failure node.
589
false
true
0
11
329
149
71
78
null
null
brendanhay/gogol
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
mpl-2.0
-- | Transit time range (min-max) in business days. 0 means same day -- delivery, 1 means next day delivery. ttttrttvMinTransitTimeInDays :: Lens' TransitTableTransitTimeRowTransitTimeValue (Maybe Word32) ttttrttvMinTransitTimeInDays = lens _ttttrttvMinTransitTimeInDays (\ s a -> s{_ttttrttvMinTransitTimeInDays = a}) . mapping _Coerce
350
ttttrttvMinTransitTimeInDays :: Lens' TransitTableTransitTimeRowTransitTimeValue (Maybe Word32) ttttrttvMinTransitTimeInDays = lens _ttttrttvMinTransitTimeInDays (\ s a -> s{_ttttrttvMinTransitTimeInDays = a}) . mapping _Coerce
241
ttttrttvMinTransitTimeInDays = lens _ttttrttvMinTransitTimeInDays (\ s a -> s{_ttttrttvMinTransitTimeInDays = a}) . mapping _Coerce
145
true
true
0
10
53
56
29
27
null
null
taktoa/ThermoCalc
src/System.hs
gpl-3.0
getMaxCOP :: System -> DimlessDouble getMaxCOP = copMax
55
getMaxCOP :: System -> DimlessDouble getMaxCOP = copMax
55
getMaxCOP = copMax
18
false
true
0
5
7
15
8
7
null
null
ribag/ganeti-experiments
src/Ganeti/Constants.hs
gpl-2.0
sshsSshHostKey :: String sshsSshHostKey = "ssh_host_key"
56
sshsSshHostKey :: String sshsSshHostKey = "ssh_host_key"
56
sshsSshHostKey = "ssh_host_key"
31
false
true
0
4
5
11
6
5
null
null
pharpend/eros
src/Text/Eros/Phrase.hs
bsd-3-clause
-- |The 'score' of the 'PhraseTree' is the sum of the 'score's of its 'Node's. treeScore :: PhraseTree -> Int treeScore = sum . map score . flatten
147
treeScore :: PhraseTree -> Int treeScore = sum . map score . flatten
68
treeScore = sum . map score . flatten
37
true
true
0
7
27
34
15
19
null
null
sdiehl/ghc
compiler/GHC/Hs/Utils.hs
bsd-3-clause
collectPatsBinders :: [LPat (GhcPass p)] -> [IdP (GhcPass p)] collectPatsBinders pats = foldr collect_lpat [] pats
114
collectPatsBinders :: [LPat (GhcPass p)] -> [IdP (GhcPass p)] collectPatsBinders pats = foldr collect_lpat [] pats
114
collectPatsBinders pats = foldr collect_lpat [] pats
52
false
true
0
9
15
51
25
26
null
null
nadavshemer/buildsome
src/Lib/Printer.hs
gpl-2.0
ignoreResourceVanished :: IO () -> IO () ignoreResourceVanished act = do res <- E.try act case res of Right x -> return x Left e@(G.IOError { G.ioe_type = t }) -> unless (t == G.ResourceVanished) $ E.throwIO e
227
ignoreResourceVanished :: IO () -> IO () ignoreResourceVanished act = do res <- E.try act case res of Right x -> return x Left e@(G.IOError { G.ioe_type = t }) -> unless (t == G.ResourceVanished) $ E.throwIO e
227
ignoreResourceVanished act = do res <- E.try act case res of Right x -> return x Left e@(G.IOError { G.ioe_type = t }) -> unless (t == G.ResourceVanished) $ E.throwIO e
186
false
true
0
16
55
113
52
61
null
null
rueshyna/gogol
gogol-firebase-dynamiclinks/gen/Network/Google/FirebaseDynamicLinks/Types/Product.hs
mpl-2.0
-- | Campaign name; used for keyword analysis to identify a specific product -- promotion or strategic campaign. gpaUtmCampaign :: Lens' GooglePlayAnalytics (Maybe Text) gpaUtmCampaign = lens _gpaUtmCampaign (\ s a -> s{_gpaUtmCampaign = a})
249
gpaUtmCampaign :: Lens' GooglePlayAnalytics (Maybe Text) gpaUtmCampaign = lens _gpaUtmCampaign (\ s a -> s{_gpaUtmCampaign = a})
136
gpaUtmCampaign = lens _gpaUtmCampaign (\ s a -> s{_gpaUtmCampaign = a})
79
true
true
0
8
42
50
26
24
null
null
geophf/1HaskellADay
exercises/HAD/Y2017/M03/D20/Solution.hs
mit
cpsb _ [] = []
51
cpsb _ [] = []
51
cpsb _ [] = []
51
false
false
0
6
41
15
7
8
null
null
lowasser/TrieMap
Data/TrieMap/Utils.hs
bsd-3-clause
unstreamM :: (Vector v a, PrimMonad m) => MStream m a -> m (v a) unstreamM strm = munstream strm >>= unsafeFreeze
113
unstreamM :: (Vector v a, PrimMonad m) => MStream m a -> m (v a) unstreamM strm = munstream strm >>= unsafeFreeze
113
unstreamM strm = munstream strm >>= unsafeFreeze
48
false
true
0
10
21
60
28
32
null
null
blast-hardcheese/git-dag-graph
src/Graph.hs
mit
fromTreeEntry :: GitTreeEntry -> DotNode String fromTreeEntry (GitTreeEntry _ o@(GitBlobObject h _) name) = objectToNode Box3D name o
133
fromTreeEntry :: GitTreeEntry -> DotNode String fromTreeEntry (GitTreeEntry _ o@(GitBlobObject h _) name) = objectToNode Box3D name o
133
fromTreeEntry (GitTreeEntry _ o@(GitBlobObject h _) name) = objectToNode Box3D name o
85
false
true
0
10
17
49
24
25
null
null
tobiasreinhardt/show
CLIArguments/src/Query.hs
apache-2.0
isOptionFlagged x (OnlyOption y:ys) = x == y || isOptionFlagged x ys
68
isOptionFlagged x (OnlyOption y:ys) = x == y || isOptionFlagged x ys
68
isOptionFlagged x (OnlyOption y:ys) = x == y || isOptionFlagged x ys
68
false
false
0
8
11
34
16
18
null
null
carlohamalainen/imagetrove-uploader
src/Data/Dicom.hs
bsd-2-clause
readSeriesDesc :: FilePath -> IO String readSeriesDesc f = do {- x <- runShellCommand (dropFileName f) "dcmdump" ["-s", "+P", "0020,000e", f] case x of Left e -> throwM $ ShellError e Right x' -> case (unescapeEntities <$> parseSingleMatch pSeriesInstanceUID x') of Nothing -> throwM $ DicomMissingSeriesInstanceUID f Just suid -> return suid -} seriesDesc <- runShellCommand (dropFileName f) "dcmdump" ["-s", "+P", "0008,103e", f] -- seriesNr <- runShellCommand (dropFileName f) "dcmdump" ["-s", "+P", "0020,0011", f] {- case (seriesDesc, seriesNr) of (Right seriesDesc', Right seriesNr') -> do let seriesDesc'' = unescapeEntities <$> parseSingleMatch pSeriesDescription seriesDesc' seriesNr'' = unescapeEntities <$> parseSingleMatch pSeriesNumber seriesNr' case (seriesDesc'', seriesNr'') of (Just seriesDesc''', Just seriesNr''') -> return $ seriesDesc''' ++ "_" ++ seriesNr''' _ -> throwM $ DicomMissingSeriesDescription f _ -> throwM $ DicomMissingSeriesDescription f -} case seriesDesc of Right seriesDesc' -> do let seriesDesc'' = unescapeEntities <$> parseSingleMatch pSeriesDescription seriesDesc' case seriesDesc'' of Just seriesDesc''' -> return seriesDesc''' _ -> throwM $ DicomMissingSeriesDescription f _ -> throwM $ DicomMissingSeriesDescription f
1,862
readSeriesDesc :: FilePath -> IO String readSeriesDesc f = do {- x <- runShellCommand (dropFileName f) "dcmdump" ["-s", "+P", "0020,000e", f] case x of Left e -> throwM $ ShellError e Right x' -> case (unescapeEntities <$> parseSingleMatch pSeriesInstanceUID x') of Nothing -> throwM $ DicomMissingSeriesInstanceUID f Just suid -> return suid -} seriesDesc <- runShellCommand (dropFileName f) "dcmdump" ["-s", "+P", "0008,103e", f] -- seriesNr <- runShellCommand (dropFileName f) "dcmdump" ["-s", "+P", "0020,0011", f] {- case (seriesDesc, seriesNr) of (Right seriesDesc', Right seriesNr') -> do let seriesDesc'' = unescapeEntities <$> parseSingleMatch pSeriesDescription seriesDesc' seriesNr'' = unescapeEntities <$> parseSingleMatch pSeriesNumber seriesNr' case (seriesDesc'', seriesNr'') of (Just seriesDesc''', Just seriesNr''') -> return $ seriesDesc''' ++ "_" ++ seriesNr''' _ -> throwM $ DicomMissingSeriesDescription f _ -> throwM $ DicomMissingSeriesDescription f -} case seriesDesc of Right seriesDesc' -> do let seriesDesc'' = unescapeEntities <$> parseSingleMatch pSeriesDescription seriesDesc' case seriesDesc'' of Just seriesDesc''' -> return seriesDesc''' _ -> throwM $ DicomMissingSeriesDescription f _ -> throwM $ DicomMissingSeriesDescription f
1,862
readSeriesDesc f = do {- x <- runShellCommand (dropFileName f) "dcmdump" ["-s", "+P", "0020,000e", f] case x of Left e -> throwM $ ShellError e Right x' -> case (unescapeEntities <$> parseSingleMatch pSeriesInstanceUID x') of Nothing -> throwM $ DicomMissingSeriesInstanceUID f Just suid -> return suid -} seriesDesc <- runShellCommand (dropFileName f) "dcmdump" ["-s", "+P", "0008,103e", f] -- seriesNr <- runShellCommand (dropFileName f) "dcmdump" ["-s", "+P", "0020,0011", f] {- case (seriesDesc, seriesNr) of (Right seriesDesc', Right seriesNr') -> do let seriesDesc'' = unescapeEntities <$> parseSingleMatch pSeriesDescription seriesDesc' seriesNr'' = unescapeEntities <$> parseSingleMatch pSeriesNumber seriesNr' case (seriesDesc'', seriesNr'') of (Just seriesDesc''', Just seriesNr''') -> return $ seriesDesc''' ++ "_" ++ seriesNr''' _ -> throwM $ DicomMissingSeriesDescription f _ -> throwM $ DicomMissingSeriesDescription f -} case seriesDesc of Right seriesDesc' -> do let seriesDesc'' = unescapeEntities <$> parseSingleMatch pSeriesDescription seriesDesc' case seriesDesc'' of Just seriesDesc''' -> return seriesDesc''' _ -> throwM $ DicomMissingSeriesDescription f _ -> throwM $ DicomMissingSeriesDescription f
1,822
false
true
0
17
763
140
66
74
null
null
wereHamster/yag
Git/Command/Status.hs
unlicense
run :: [String] -> IO () run args = return ()
45
run :: [String] -> IO () run args = return ()
45
run args = return ()
20
false
true
0
7
10
34
16
18
null
null
nevrenato/HetsAlloy
Syntax/Parse_AS_Structured.hs
gpl-2.0
parseItemsMap :: AnyLogic -> AParser st (G_symb_map_items_list, [Token]) parseItemsMap (Logic lid) = do (cs, ps) <- callSymParser False (parse_symb_map_items lid) (language_name lid) " maps" return (G_symb_map_items_list lid cs, ps)
262
parseItemsMap :: AnyLogic -> AParser st (G_symb_map_items_list, [Token]) parseItemsMap (Logic lid) = do (cs, ps) <- callSymParser False (parse_symb_map_items lid) (language_name lid) " maps" return (G_symb_map_items_list lid cs, ps)
262
parseItemsMap (Logic lid) = do (cs, ps) <- callSymParser False (parse_symb_map_items lid) (language_name lid) " maps" return (G_symb_map_items_list lid cs, ps)
189
false
true
0
10
58
89
45
44
null
null
glutamate/probably-baysig
src/Math/Probably/Utils.hs
bsd-3-clause
- | A target augmented by momentum auxilliary variables. auxilliaryTarget :: (ContinuousParams -> Double) -> Particle -> Double auxilliaryTarget lTarget (t, r) = lTarget t - 0.5 * innerProduct r r
199
auxilliaryTarget :: (ContinuousParams -> Double) -> Particle -> Double auxilliaryTarget lTarget (t, r) = lTarget t - 0.5 * innerProduct r r
141
auxilliaryTarget lTarget (t, r) = lTarget t - 0.5 * innerProduct r r
70
true
true
2
9
33
77
38
39
null
null
bigsleep/Wf
src/Wf/Web/Routing.hs
mit
matchRouteMethod (RouteMethodOneOf as) b = b `elem` as
54
matchRouteMethod (RouteMethodOneOf as) b = b `elem` as
54
matchRouteMethod (RouteMethodOneOf as) b = b `elem` as
54
false
false
1
8
7
27
12
15
null
null
frontrowed/stratosphere
library-gen/Stratosphere/Resources/ElastiCacheParameterGroup.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-parameter-group.html#cfn-elasticache-parametergroup-properties ecpgProperties :: Lens' ElastiCacheParameterGroup (Maybe Object) ecpgProperties = lens _elastiCacheParameterGroupProperties (\s a -> s { _elastiCacheParameterGroupProperties = a })
337
ecpgProperties :: Lens' ElastiCacheParameterGroup (Maybe Object) ecpgProperties = lens _elastiCacheParameterGroupProperties (\s a -> s { _elastiCacheParameterGroupProperties = a })
180
ecpgProperties = lens _elastiCacheParameterGroupProperties (\s a -> s { _elastiCacheParameterGroupProperties = a })
115
true
true
0
9
21
46
25
21
null
null
enolan/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
defined (PRecord _ _ _ _ n _ _ _ _ cn _ _) = n : map fst (maybeToList cn)
80
defined (PRecord _ _ _ _ n _ _ _ _ cn _ _) = n : map fst (maybeToList cn)
80
defined (PRecord _ _ _ _ n _ _ _ _ cn _ _) = n : map fst (maybeToList cn)
80
false
false
0
8
27
53
25
28
null
null
Mahdi89/eTeak
src/SimBuiltin.hs
bsd-3-clause
skipWS :: String -> String skipWS = dropWhile isSpace
57
skipWS :: String -> String skipWS = dropWhile isSpace
53
skipWS = dropWhile isSpace
26
false
true
0
7
12
21
9
12
null
null
f-me/avaya-ws
src/Main.hs
mit
rqHandler :: Config -> AvayaMap -> Request -> WebSockets Hybi00 () rqHandler cfg cMapVar rq = do (ext,pwd) <- chkRequestPath rq (h,m) <- getSession cMapVar cfg ext pwd >>= either (\err -> liftIO (syslog Warning err) >> rejectRequest rq "501") return acceptRequest rq s <- getSink o <- liftIO $ attachObserver h $ evHandler s let loop = receive >>= \case DataMessage (Text t) -> liftIO $ runCommand h m t _ -> return () -- FIXME: log let shutdown e = liftIO $ do syslog Notice $ "WsError catched: " ++ show e detachObserver h o catchWsError (forever loop) shutdown
656
rqHandler :: Config -> AvayaMap -> Request -> WebSockets Hybi00 () rqHandler cfg cMapVar rq = do (ext,pwd) <- chkRequestPath rq (h,m) <- getSession cMapVar cfg ext pwd >>= either (\err -> liftIO (syslog Warning err) >> rejectRequest rq "501") return acceptRequest rq s <- getSink o <- liftIO $ attachObserver h $ evHandler s let loop = receive >>= \case DataMessage (Text t) -> liftIO $ runCommand h m t _ -> return () -- FIXME: log let shutdown e = liftIO $ do syslog Notice $ "WsError catched: " ++ show e detachObserver h o catchWsError (forever loop) shutdown
656
rqHandler cfg cMapVar rq = do (ext,pwd) <- chkRequestPath rq (h,m) <- getSession cMapVar cfg ext pwd >>= either (\err -> liftIO (syslog Warning err) >> rejectRequest rq "501") return acceptRequest rq s <- getSink o <- liftIO $ attachObserver h $ evHandler s let loop = receive >>= \case DataMessage (Text t) -> liftIO $ runCommand h m t _ -> return () -- FIXME: log let shutdown e = liftIO $ do syslog Notice $ "WsError catched: " ++ show e detachObserver h o catchWsError (forever loop) shutdown
589
false
true
0
17
193
259
118
141
null
null
avh4/elm-compiler
src/Elm/Compiler/Module.hs
bsd-3-clause
dehyphenate :: String -> Maybe Name dehyphenate = fromString '-'
68
dehyphenate :: String -> Maybe Name dehyphenate = fromString '-'
68
dehyphenate = fromString '-'
32
false
true
0
6
13
21
10
11
null
null
alekar/hugs
packages/base/Data/Set.hs
bsd-3-clause
-- | /O(log n)/. The maximal element of a set. findMax :: Set a -> a findMax (Bin _ x l Tip) = x
97
findMax :: Set a -> a findMax (Bin _ x l Tip) = x
50
findMax (Bin _ x l Tip) = x
28
true
true
0
7
24
34
17
17
null
null
kawu/data-named
src/Data/Named/Tree.hs
bsd-2-clause
-- | Annotate forest nodes with spanning info. spanForest :: Ord w => Forest (Either n w) -> Forest (Either n w, Span w) spanForest = map spanTree
146
spanForest :: Ord w => Forest (Either n w) -> Forest (Either n w, Span w) spanForest = map spanTree
99
spanForest = map spanTree
25
true
true
0
9
27
54
26
28
null
null
GaloisInc/ivory
ivory/src/Ivory/Language/Loop.hs
bsd-3-clause
-- | Loop over the range of indexes @[end, end - 1 .. start]@. If -- @end > start@, the loop body will never execute. downTo :: ANat n => Ix n -> Ix n -> (Ix n -> Ivory (E.AllowBreak eff) a) -> Ivory eff () downTo from to = loop AST.DecrTo (fromIx from) (fromIx to)
272
downTo :: ANat n => Ix n -> Ix n -> (Ix n -> Ivory (E.AllowBreak eff) a) -> Ivory eff () downTo from to = loop AST.DecrTo (fromIx from) (fromIx to)
154
downTo from to = loop AST.DecrTo (fromIx from) (fromIx to)
58
true
true
0
14
63
94
45
49
null
null
nushio3/ghc
compiler/deSugar/Desugar.hs
bsd-3-clause
dsVect vd@(L _ (HsVectTypeIn _ _ _ _)) = pprPanic "Desugar.dsVect: unexpected 'HsVectTypeIn'" (ppr vd)
104
dsVect vd@(L _ (HsVectTypeIn _ _ _ _)) = pprPanic "Desugar.dsVect: unexpected 'HsVectTypeIn'" (ppr vd)
104
dsVect vd@(L _ (HsVectTypeIn _ _ _ _)) = pprPanic "Desugar.dsVect: unexpected 'HsVectTypeIn'" (ppr vd)
104
false
false
0
10
16
43
21
22
null
null
zombiecalypse/config-files
xmonad/xmonad.hs
apache-2.0
amarok = False
14
amarok = False
14
amarok = False
14
false
false
0
4
2
6
3
3
null
null
mgsloan/compconfig
env/src/Constants.hs
mit
browser, emacs :: String browser = "google-chrome"
50
browser, emacs :: String browser = "google-chrome"
50
browser = "google-chrome"
25
false
true
2
6
6
24
9
15
null
null
thomasjm/IHaskell
ipython-kernel/src/IHaskell/IPython/Types.hs
mit
replyType InspectRequestMessage = Just InspectReplyMessage
58
replyType InspectRequestMessage = Just InspectReplyMessage
58
replyType InspectRequestMessage = Just InspectReplyMessage
58
false
false
0
5
4
12
5
7
null
null
massysett/multiarg
lib/Multiarg/Examples/Grover.hs
bsd-3-clause
globalOptSpecs :: [OptSpec (Either String Global)] globalOptSpecs = [ optSpec "h" ["help"] . ZeroArg . return $ Help , optSpec "v" ["verbose"] . OneArg $ \s -> Verbose <$> readErr s , optSpec "" ["version"] . ZeroArg . return $ Version ]
249
globalOptSpecs :: [OptSpec (Either String Global)] globalOptSpecs = [ optSpec "h" ["help"] . ZeroArg . return $ Help , optSpec "v" ["verbose"] . OneArg $ \s -> Verbose <$> readErr s , optSpec "" ["version"] . ZeroArg . return $ Version ]
249
globalOptSpecs = [ optSpec "h" ["help"] . ZeroArg . return $ Help , optSpec "v" ["verbose"] . OneArg $ \s -> Verbose <$> readErr s , optSpec "" ["version"] . ZeroArg . return $ Version ]
198
false
true
0
10
53
102
53
49
null
null
wrengr/bytestring-trie
src/Data/Trie/Internal.hs
bsd-3-clause
mergeMaybe f (Just v0) (Just v1) = f v0 v1
44
mergeMaybe f (Just v0) (Just v1) = f v0 v1
44
mergeMaybe f (Just v0) (Just v1) = f v0 v1
44
false
false
0
7
11
30
14
16
null
null
vladimir-ipatov/ganeti
src/Ganeti/HTools/Node.hs
gpl-2.0
-- | Transform a Node + Instance list into a NodeGraph type. -- Returns Nothing if the node list is empty. mkNodeGraph :: List -> Instance.List -> Maybe Graph.Graph mkNodeGraph nl il = liftM (`Graph.buildG` (filterValid nl . instancesToEdges $ il)) (nodesToBounds nl)
271
mkNodeGraph :: List -> Instance.List -> Maybe Graph.Graph mkNodeGraph nl il = liftM (`Graph.buildG` (filterValid nl . instancesToEdges $ il)) (nodesToBounds nl)
164
mkNodeGraph nl il = liftM (`Graph.buildG` (filterValid nl . instancesToEdges $ il)) (nodesToBounds nl)
106
true
true
0
10
46
67
35
32
null
null
chadbrewbaker/shellcheck
ShellCheck/Parser.hs
gpl-3.0
readFilename = readNormalWord
29
readFilename = readNormalWord
29
readFilename = readNormalWord
29
false
false
1
5
2
10
3
7
null
null
nyson/haste-compiler
libraries/haste-lib/src/Haste/DOM/JSString.hs
bsd-3-clause
-- | Get the name of the currently selected file from a file input element. -- Any directory information is stripped, and only the actual file name is -- returned, as the directory information is useless (and faked) anyway. getFileName :: (IsElem e, MonadIO m) => e -> m JSString getFileName e = liftIO $ do fn <- fromJSStr `fmap` getProp e "value" return $ toJSStr $ reverse $ takeWhile (not . separator) $ reverse fn where separator '/' = True separator '\\' = True separator _ = False -- | Add or remove a class from an element's class list.
575
getFileName :: (IsElem e, MonadIO m) => e -> m JSString getFileName e = liftIO $ do fn <- fromJSStr `fmap` getProp e "value" return $ toJSStr $ reverse $ takeWhile (not . separator) $ reverse fn where separator '/' = True separator '\\' = True separator _ = False -- | Add or remove a class from an element's class list.
347
getFileName e = liftIO $ do fn <- fromJSStr `fmap` getProp e "value" return $ toJSStr $ reverse $ takeWhile (not . separator) $ reverse fn where separator '/' = True separator '\\' = True separator _ = False -- | Add or remove a class from an element's class list.
291
true
true
0
12
131
121
61
60
null
null
ambiata/highlighting-kate
Text/Highlighting/Kate/Syntax/Mandoc.hs
gpl-2.0
list_formatting = Set.fromList $ words $ "B BI BR I IB IR RB RI SM SB"
70
list_formatting = Set.fromList $ words $ "B BI BR I IB IR RB RI SM SB"
70
list_formatting = Set.fromList $ words $ "B BI BR I IB IR RB RI SM SB"
70
false
false
0
7
15
16
8
8
null
null
Mathnerd314/lamdu
src/Lamdu/Data/Ops.hs
gpl-3.0
lambdaWrap :: MonadA m => ExprIRef.ExpressionProperty m -> T m (Guid, ExprIRef.ExpressionI (Tag m)) lambdaWrap exprP = do newParamTypeI <- newHole (newParam, newExprI) <- ExprIRef.newLambda newParamTypeI $ Property.value exprP Property.set exprP newExprI return (newParam, newExprI)
300
lambdaWrap :: MonadA m => ExprIRef.ExpressionProperty m -> T m (Guid, ExprIRef.ExpressionI (Tag m)) lambdaWrap exprP = do newParamTypeI <- newHole (newParam, newExprI) <- ExprIRef.newLambda newParamTypeI $ Property.value exprP Property.set exprP newExprI return (newParam, newExprI)
300
lambdaWrap exprP = do newParamTypeI <- newHole (newParam, newExprI) <- ExprIRef.newLambda newParamTypeI $ Property.value exprP Property.set exprP newExprI return (newParam, newExprI)
194
false
true
0
12
52
113
52
61
null
null
sdiehl/ghc
testsuite/tests/typecheck/should_compile/Vta1.hs
bsd-3-clause
silly = quad @_ @Bool @Char @_ 5 True 'a' "Hello"
49
silly = quad @_ @Bool @Char @_ 5 True 'a' "Hello"
49
silly = quad @_ @Bool @Char @_ 5 True 'a' "Hello"
49
false
false
0
6
10
31
15
16
null
null
dysinger/amazonka
amazonka-datapipeline/gen/Network/AWS/DataPipeline/AddTags.hs
mpl-2.0
-- | The identifier of the pipeline to which you want to add the tags. atPipelineId :: Lens' AddTags Text atPipelineId = lens _atPipelineId (\s a -> s { _atPipelineId = a })
173
atPipelineId :: Lens' AddTags Text atPipelineId = lens _atPipelineId (\s a -> s { _atPipelineId = a })
102
atPipelineId = lens _atPipelineId (\s a -> s { _atPipelineId = a })
67
true
true
0
9
32
40
22
18
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/index_2.hs
mit
primMinusInt (Neg x) (Neg y) = primMinusNat y x
47
primMinusInt (Neg x) (Neg y) = primMinusNat y x
47
primMinusInt (Neg x) (Neg y) = primMinusNat y x
47
false
false
0
7
8
28
13
15
null
null
karamellpelle/grid
source/OpenAL/Values.hs
gpl-3.0
al_EXTENSIONS :: ALenum al_EXTENSIONS = 0xB004
72
al_EXTENSIONS :: ALenum al_EXTENSIONS = 0xB004
72
al_EXTENSIONS = 0xB004
48
false
true
0
4
31
11
6
5
null
null
martindavid/code-sandbox
comp90048/assignments/project1/attempt2/Proj1.hs
mit
countOctsNotes :: (Eq a) => [a] -> [a] -> Int countOctsNotes [] _ = 0
69
countOctsNotes :: (Eq a) => [a] -> [a] -> Int countOctsNotes [] _ = 0
69
countOctsNotes [] _ = 0
23
false
true
0
8
14
41
22
19
null
null
dgvncsz0f/nws
src/Jerimum/PostgreSQL/Introspect.hs
bsd-3-clause
readSchema :: PQ.Connection -> IO RawSchema readSchema conn = M.fromListWith (M.unionWith (flip (++))) . map fromRow <$> PQ.query_ conn query where query = "SELECT" <> " table_schema, table_name, column_name, data_type " <> " FROM information_schema.columns" <> " ORDER BY column_name" fromRow (schema, table, colName, colType) = (schema, M.singleton table [(colName, colType)])
416
readSchema :: PQ.Connection -> IO RawSchema readSchema conn = M.fromListWith (M.unionWith (flip (++))) . map fromRow <$> PQ.query_ conn query where query = "SELECT" <> " table_schema, table_name, column_name, data_type " <> " FROM information_schema.columns" <> " ORDER BY column_name" fromRow (schema, table, colName, colType) = (schema, M.singleton table [(colName, colType)])
416
readSchema conn = M.fromListWith (M.unionWith (flip (++))) . map fromRow <$> PQ.query_ conn query where query = "SELECT" <> " table_schema, table_name, column_name, data_type " <> " FROM information_schema.columns" <> " ORDER BY column_name" fromRow (schema, table, colName, colType) = (schema, M.singleton table [(colName, colType)])
372
false
true
3
10
88
135
66
69
null
null
rahulmutt/ghcvm
compiler/Eta/Prelude/TysWiredIn.hs
bsd-3-clause
-- build one specially parrFakeCon i = parrFakeConArr!i
77
parrFakeCon i = parrFakeConArr!i
54
parrFakeCon i = parrFakeConArr!i
54
true
false
0
5
29
14
7
7
null
null
flipstone/orville
orville-postgresql-libpq/src/Orville/PostgreSQL/Internal/Expr/Where/ComparisonOperator.hs
mit
equalsOp :: ComparisonOperator equalsOp = ComparisonOperator (RawSql.fromString "=")
86
equalsOp :: ComparisonOperator equalsOp = ComparisonOperator (RawSql.fromString "=")
86
equalsOp = ComparisonOperator (RawSql.fromString "=")
55
false
true
0
8
9
29
12
17
null
null
SWP-Ubau-SoSe2014-Haskell/SWPSoSe14
src/RailEditor/Interpreter.hs
mit
perform tac _ IDT.Breakup = do cnt <- readIORef (TAC.context tac) if null (TAC.dataStack cnt) then showError tac "Empty stack" else if not $ isList $ head $ TAC.dataStack cnt then showError tac "Wrong type on stack, list expected" else do let (TAC.RailList lst:xs) = TAC.dataStack cnt if null lst then showError tac "Empty list cannot be splitted" else do let (y:ys) = lst writeIORef (TAC.context tac) cnt{TAC.dataStack = y:TAC.RailList ys:xs}
529
perform tac _ IDT.Breakup = do cnt <- readIORef (TAC.context tac) if null (TAC.dataStack cnt) then showError tac "Empty stack" else if not $ isList $ head $ TAC.dataStack cnt then showError tac "Wrong type on stack, list expected" else do let (TAC.RailList lst:xs) = TAC.dataStack cnt if null lst then showError tac "Empty list cannot be splitted" else do let (y:ys) = lst writeIORef (TAC.context tac) cnt{TAC.dataStack = y:TAC.RailList ys:xs}
529
perform tac _ IDT.Breakup = do cnt <- readIORef (TAC.context tac) if null (TAC.dataStack cnt) then showError tac "Empty stack" else if not $ isList $ head $ TAC.dataStack cnt then showError tac "Wrong type on stack, list expected" else do let (TAC.RailList lst:xs) = TAC.dataStack cnt if null lst then showError tac "Empty list cannot be splitted" else do let (y:ys) = lst writeIORef (TAC.context tac) cnt{TAC.dataStack = y:TAC.RailList ys:xs}
529
false
false
0
20
156
192
91
101
null
null
headprogrammingczar/cabal
cabal-install/Distribution/Client/ProjectConfig/Legacy.hs
bsd-3-clause
packageRepoSectionDescr :: SectionDescr LegacyProjectConfig packageRepoSectionDescr = SectionDescr { sectionName = "source-repository-package", sectionFields = sourceRepoFieldDescrs, sectionSubsections = [], sectionGet = map (\x->("", x)) . legacyPackagesRepo, sectionSet = \lineno unused pkgrepo projconf -> do unless (null unused) $ syntaxError lineno "the section 'source-repository-package' takes no arguments" return projconf { legacyPackagesRepo = legacyPackagesRepo projconf ++ [pkgrepo] }, sectionEmpty = SourceRepo { repoKind = RepoThis, -- hopefully unused repoType = Nothing, repoLocation = Nothing, repoModule = Nothing, repoBranch = Nothing, repoTag = Nothing, repoSubdir = Nothing } }
1,112
packageRepoSectionDescr :: SectionDescr LegacyProjectConfig packageRepoSectionDescr = SectionDescr { sectionName = "source-repository-package", sectionFields = sourceRepoFieldDescrs, sectionSubsections = [], sectionGet = map (\x->("", x)) . legacyPackagesRepo, sectionSet = \lineno unused pkgrepo projconf -> do unless (null unused) $ syntaxError lineno "the section 'source-repository-package' takes no arguments" return projconf { legacyPackagesRepo = legacyPackagesRepo projconf ++ [pkgrepo] }, sectionEmpty = SourceRepo { repoKind = RepoThis, -- hopefully unused repoType = Nothing, repoLocation = Nothing, repoModule = Nothing, repoBranch = Nothing, repoTag = Nothing, repoSubdir = Nothing } }
1,112
packageRepoSectionDescr = SectionDescr { sectionName = "source-repository-package", sectionFields = sourceRepoFieldDescrs, sectionSubsections = [], sectionGet = map (\x->("", x)) . legacyPackagesRepo, sectionSet = \lineno unused pkgrepo projconf -> do unless (null unused) $ syntaxError lineno "the section 'source-repository-package' takes no arguments" return projconf { legacyPackagesRepo = legacyPackagesRepo projconf ++ [pkgrepo] }, sectionEmpty = SourceRepo { repoKind = RepoThis, -- hopefully unused repoType = Nothing, repoLocation = Nothing, repoModule = Nothing, repoBranch = Nothing, repoTag = Nothing, repoSubdir = Nothing } }
1,052
false
true
1
15
497
183
103
80
null
null
tismith/tlisp
write-yourself-a-scheme/listings/listing8.hs
mit
unwordsList :: [LispVal] -> String unwordsList = unwords . map showVal
70
unwordsList :: [LispVal] -> String unwordsList = unwords . map showVal
70
unwordsList = unwords . map showVal
35
false
true
0
7
10
31
14
17
null
null
Moskau/estuary
Estuary/WebDirt/Stream.hs
gpl-3.0
valueToJSVal :: Value -> T.JSVal valueToJSVal (VI x) = P.pToJSVal x
68
valueToJSVal :: Value -> T.JSVal valueToJSVal (VI x) = P.pToJSVal x
67
valueToJSVal (VI x) = P.pToJSVal x
34
false
true
0
7
11
31
15
16
null
null
reinh/CodeSearch
src/CodeSearch/Regex/Parser.hs
bsd-3-clause
concats = foldr1 Concat
23
concats = foldr1 Concat
23
concats = foldr1 Concat
23
false
false
0
5
3
9
4
5
null
null
stevezhee/ed
app/Main.hs
bsd-3-clause
upperTbl = zip "`1234567890-=[]\\;',./" "~!@#$%^&*()_+{}|:\"<>?"
64
upperTbl = zip "`1234567890-=[]\\;',./" "~!@#$%^&*()_+{}|:\"<>?"
64
upperTbl = zip "`1234567890-=[]\\;',./" "~!@#$%^&*()_+{}|:\"<>?"
64
false
false
0
5
4
11
5
6
null
null
erikd/yesod
yesod-core/Yesod/Core/Internal/Request.hs
mit
randomString :: PrimMonad m => Int -> MWC.Gen (PrimState m) -> m Text randomString len gen = liftM (decodeUtf8 . fromByteVector) $ V.replicateM len asciiChar where asciiChar = liftM toAscii $ MWC.uniformR (0, 61) gen toAscii i | i < 26 = i + Word8._A | i < 52 = i + Word8._a - 26 | otherwise = i + Word8._0 - 52
350
randomString :: PrimMonad m => Int -> MWC.Gen (PrimState m) -> m Text randomString len gen = liftM (decodeUtf8 . fromByteVector) $ V.replicateM len asciiChar where asciiChar = liftM toAscii $ MWC.uniformR (0, 61) gen toAscii i | i < 26 = i + Word8._A | i < 52 = i + Word8._a - 26 | otherwise = i + Word8._0 - 52
350
randomString len gen = liftM (decodeUtf8 . fromByteVector) $ V.replicateM len asciiChar where asciiChar = liftM toAscii $ MWC.uniformR (0, 61) gen toAscii i | i < 26 = i + Word8._A | i < 52 = i + Word8._a - 26 | otherwise = i + Word8._0 - 52
280
false
true
5
13
101
161
76
85
null
null
kmate/HaRe
old/refactorer/RefacSimplify.hs
bsd-3-clause
getPatBind pats e@(Exp (HsList es)) = concatMap (getPatBind pats) es
77
getPatBind pats e@(Exp (HsList es)) = concatMap (getPatBind pats) es
77
getPatBind pats e@(Exp (HsList es)) = concatMap (getPatBind pats) es
77
false
false
0
10
18
37
18
19
null
null
NunoEdgarGub1/hql
src/Hql/Time/Calendar.hs
bsd-3-clause
-- | Advances a date w.r.t. a given calendar and business day convention by a given period -- If end of month (eom) is set to True an end of month date will be also an end of month -- date after the shift. advanceByUnits :: Calendar -> Date -> Int -> Unit -> BusinessDayConvention -> Bool -> Date advanceByUnits calendar d 0 _ bdc _ = adjust calendar d bdc
360
advanceByUnits :: Calendar -> Date -> Int -> Unit -> BusinessDayConvention -> Bool -> Date advanceByUnits calendar d 0 _ bdc _ = adjust calendar d bdc
150
advanceByUnits calendar d 0 _ bdc _ = adjust calendar d bdc
59
true
true
0
10
74
58
30
28
null
null
sdiehl/ghc
compiler/GHC/StgToCmm/ArgRep.hs
bsd-3-clause
argRepString L = "L"
20
argRepString L = "L"
20
argRepString L = "L"
20
false
false
0
5
3
9
4
5
null
null
hpacheco/HAAP
examples/gameworker/li1g147/Bomberman/AI.hs
mit
compareMove x@(Just 'B') y = LT
31
compareMove x@(Just 'B') y = LT
31
compareMove x@(Just 'B') y = LT
31
false
false
0
8
5
20
10
10
null
null
Sgoettschkes/learning
haskell/ProjectEuler/src/Problems/Problem026.hs
mit
remainders d r rs = let r' = r `mod` d in case elemIndex r' rs of Just i -> i + 1 Nothing -> remainders d (10*r') (r':rs)
142
remainders d r rs = let r' = r `mod` d in case elemIndex r' rs of Just i -> i + 1 Nothing -> remainders d (10*r') (r':rs)
142
remainders d r rs = let r' = r `mod` d in case elemIndex r' rs of Just i -> i + 1 Nothing -> remainders d (10*r') (r':rs)
142
false
false
0
12
49
79
39
40
null
null
rawlep/EQS
sourceCode/NiceFork.hs
mit
keepChecking :: IORef Bool -> IO() -> IO() keepChecking trefRef io = do flag <- readIORef trefRef if flag then io else keepChecking trefRef io {-- modifyMVar takes the value from an MVar, and passes it to a function. This function can both generate a new value and return a result. If the function throws an exception, modifyMVar puts the original value back into the MVar, otherwise it puts the new value in. It returns the other element of the function as its own result. No comments When we use modifyMVar instead of manually managing an MVar with takeMVar and putMVar, we avoid two common kinds of concurrency bug. Forgetting to put a value back into an MVar. This can result in deadlock, in which some thread waits forever on an MVar that will never have a value put into it. No comments Failure to account for the possibility that an exception might be thrown, disrupting the flow of a piece of code. This can result in a call to putMVar that should occur not actually happening, again leading to deadlock. No comments Because of these nice safety properties, it's wise to use modifyMVar whenever possible -- } modifyMVar :: MVar a -> (a -> IO (a,b)) -> IO b modifyMVar m io = block $ do a <- takeMVar m (b,r) <- unblock (io a) `catch` \e -> putMVar m a >> throw e putMVar m b return r --} --- put a scroll bar in a window
1,362
keepChecking :: IORef Bool -> IO() -> IO() keepChecking trefRef io = do flag <- readIORef trefRef if flag then io else keepChecking trefRef io {-- modifyMVar takes the value from an MVar, and passes it to a function. This function can both generate a new value and return a result. If the function throws an exception, modifyMVar puts the original value back into the MVar, otherwise it puts the new value in. It returns the other element of the function as its own result. No comments When we use modifyMVar instead of manually managing an MVar with takeMVar and putMVar, we avoid two common kinds of concurrency bug. Forgetting to put a value back into an MVar. This can result in deadlock, in which some thread waits forever on an MVar that will never have a value put into it. No comments Failure to account for the possibility that an exception might be thrown, disrupting the flow of a piece of code. This can result in a call to putMVar that should occur not actually happening, again leading to deadlock. No comments Because of these nice safety properties, it's wise to use modifyMVar whenever possible -- } modifyMVar :: MVar a -> (a -> IO (a,b)) -> IO b modifyMVar m io = block $ do a <- takeMVar m (b,r) <- unblock (io a) `catch` \e -> putMVar m a >> throw e putMVar m b return r --} --- put a scroll bar in a window
1,362
keepChecking trefRef io = do flag <- readIORef trefRef if flag then io else keepChecking trefRef io {-- modifyMVar takes the value from an MVar, and passes it to a function. This function can both generate a new value and return a result. If the function throws an exception, modifyMVar puts the original value back into the MVar, otherwise it puts the new value in. It returns the other element of the function as its own result. No comments When we use modifyMVar instead of manually managing an MVar with takeMVar and putMVar, we avoid two common kinds of concurrency bug. Forgetting to put a value back into an MVar. This can result in deadlock, in which some thread waits forever on an MVar that will never have a value put into it. No comments Failure to account for the possibility that an exception might be thrown, disrupting the flow of a piece of code. This can result in a call to putMVar that should occur not actually happening, again leading to deadlock. No comments Because of these nice safety properties, it's wise to use modifyMVar whenever possible -- } modifyMVar :: MVar a -> (a -> IO (a,b)) -> IO b modifyMVar m io = block $ do a <- takeMVar m (b,r) <- unblock (io a) `catch` \e -> putMVar m a >> throw e putMVar m b return r --} --- put a scroll bar in a window
1,319
false
true
0
8
282
65
31
34
null
null
henrytill/hecate
src/Data/Multimap.hs
apache-2.0
lookup :: Ord k => k -> Multimap k v -> Set v lookup k (Multimap m) = Maybe.fromMaybe Set.empty (Map.lookup k m)
112
lookup :: Ord k => k -> Multimap k v -> Set v lookup k (Multimap m) = Maybe.fromMaybe Set.empty (Map.lookup k m)
112
lookup k (Multimap m) = Maybe.fromMaybe Set.empty (Map.lookup k m)
66
false
true
0
8
22
64
30
34
null
null
sdiehl/ghc
compiler/coreSyn/CoreSyn.hs
bsd-3-clause
flattenBinds (Rec prs1 : binds) = prs1 ++ flattenBinds binds
62
flattenBinds (Rec prs1 : binds) = prs1 ++ flattenBinds binds
62
flattenBinds (Rec prs1 : binds) = prs1 ++ flattenBinds binds
62
false
false
0
7
11
27
12
15
null
null
kojiromike/Idris-dev
src/Idris/Elab/Quasiquote.hs
bsd-3-clause
extract2 :: Int -> (PTerm -> PTerm -> a) -> PTerm -> PTerm -> Elab' aux (a, [(Name, PTerm)]) extract2 n c a b = do (a', ex1) <- extractUnquotes n a (b', ex2) <- extractUnquotes n b return (c a' b', ex1 ++ ex2)
253
extract2 :: Int -> (PTerm -> PTerm -> a) -> PTerm -> PTerm -> Elab' aux (a, [(Name, PTerm)]) extract2 n c a b = do (a', ex1) <- extractUnquotes n a (b', ex2) <- extractUnquotes n b return (c a' b', ex1 ++ ex2)
253
extract2 n c a b = do (a', ex1) <- extractUnquotes n a (b', ex2) <- extractUnquotes n b return (c a' b', ex1 ++ ex2)
160
false
true
0
12
88
124
64
60
null
null
achudnov/jespresso
test/UnitTest.hs
bsd-3-clause
verifyOutput :: String -> String -> IO (Maybe String) verifyOutput expected actual = return $ let fs = filter (not . isSpace) msg = "Failed to match expected output to normalized input:\n\ \Diff:\n" ++ ppDiff (getGroupedDiff (lines expected) (lines actual)) in if (fs expected == fs actual) then Nothing else Just msg
376
verifyOutput :: String -> String -> IO (Maybe String) verifyOutput expected actual = return $ let fs = filter (not . isSpace) msg = "Failed to match expected output to normalized input:\n\ \Diff:\n" ++ ppDiff (getGroupedDiff (lines expected) (lines actual)) in if (fs expected == fs actual) then Nothing else Just msg
376
verifyOutput expected actual = return $ let fs = filter (not . isSpace) msg = "Failed to match expected output to normalized input:\n\ \Diff:\n" ++ ppDiff (getGroupedDiff (lines expected) (lines actual)) in if (fs expected == fs actual) then Nothing else Just msg
322
false
true
0
15
110
114
56
58
null
null
uduki/hsQt
Qtc/Opengl/QGLFormat.hs
bsd-2-clause
setSamples :: QGLFormat a -> ((Int)) -> IO () setSamples x0 (x1) = withObjectPtr x0 $ \cobj_x0 -> qtc_QGLFormat_setSamples cobj_x0 (toCInt x1)
148
setSamples :: QGLFormat a -> ((Int)) -> IO () setSamples x0 (x1) = withObjectPtr x0 $ \cobj_x0 -> qtc_QGLFormat_setSamples cobj_x0 (toCInt x1)
148
setSamples x0 (x1) = withObjectPtr x0 $ \cobj_x0 -> qtc_QGLFormat_setSamples cobj_x0 (toCInt x1)
102
false
true
0
9
27
69
33
36
null
null
ndmitchell/qed
v1/Exp.hs
bsd-3-clause
fromDecl DataDecl{} = []
24
fromDecl DataDecl{} = []
24
fromDecl DataDecl{} = []
24
false
false
1
6
3
18
7
11
null
null
rueshyna/gogol
gogol-admin-emailmigration/gen/Network/Google/EmailMigration/Types/Product.hs
mpl-2.0
-- | Creates a value of 'MailItem' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'miIsDeleted' -- -- * 'miIsDraft' -- -- * 'miIsStarred' -- -- * 'miKind' -- -- * 'miIsUnread' -- -- * 'miLabels' -- -- * 'miIsInbox' -- -- * 'miIsTrash' -- -- * 'miIsSent' mailItem :: MailItem mailItem = MailItem' { _miIsDeleted = Nothing , _miIsDraft = Nothing , _miIsStarred = Nothing , _miKind = "mailItem" , _miIsUnread = Nothing , _miLabels = Nothing , _miIsInbox = Nothing , _miIsTrash = Nothing , _miIsSent = Nothing }
641
mailItem :: MailItem mailItem = MailItem' { _miIsDeleted = Nothing , _miIsDraft = Nothing , _miIsStarred = Nothing , _miKind = "mailItem" , _miIsUnread = Nothing , _miLabels = Nothing , _miIsInbox = Nothing , _miIsTrash = Nothing , _miIsSent = Nothing }
301
mailItem = MailItem' { _miIsDeleted = Nothing , _miIsDraft = Nothing , _miIsStarred = Nothing , _miKind = "mailItem" , _miIsUnread = Nothing , _miLabels = Nothing , _miIsInbox = Nothing , _miIsTrash = Nothing , _miIsSent = Nothing }
276
true
true
1
7
156
95
65
30
null
null
jmitchell/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LAnd (ITFixed ty)) [x, y] = bitOp v "And" ty [x, y]
59
doOp v (LAnd (ITFixed ty)) [x, y] = bitOp v "And" ty [x, y]
59
doOp v (LAnd (ITFixed ty)) [x, y] = bitOp v "And" ty [x, y]
59
false
false
0
9
13
46
24
22
null
null
xmonad/xmonad-contrib
XMonad/Util/Dzen.hs
bsd-3-clause
chomp :: String -> String chomp = (++"\n") . reverse . dropWhile ('\n' ==) . reverse
84
chomp :: String -> String chomp = (++"\n") . reverse . dropWhile ('\n' ==) . reverse
84
chomp = (++"\n") . reverse . dropWhile ('\n' ==) . reverse
58
false
true
0
8
15
38
21
17
null
null
jean-edouard/manager
xenmgr/Vm/Queries.hs
gpl-2.0
getCryptoKeyLookupPaths :: Uuid -> Rpc [FilePath] getCryptoKeyLookupPaths uuid = do user <- getVmCryptoUser uuid vm_dirs <- split ',' <$> getVmCryptoKeyDirs uuid platform_dirs <- split ',' <$> appGetPlatformCryptoKeyDirs let dirs = filter (not . null) $ [user_key_dir user] ++ vm_dirs ++ platform_dirs liftIO $ filterM doesDirectoryExist dirs where user_key_dir "" = "" user_key_dir user = "/config/sec/s-" ++ user
462
getCryptoKeyLookupPaths :: Uuid -> Rpc [FilePath] getCryptoKeyLookupPaths uuid = do user <- getVmCryptoUser uuid vm_dirs <- split ',' <$> getVmCryptoKeyDirs uuid platform_dirs <- split ',' <$> appGetPlatformCryptoKeyDirs let dirs = filter (not . null) $ [user_key_dir user] ++ vm_dirs ++ platform_dirs liftIO $ filterM doesDirectoryExist dirs where user_key_dir "" = "" user_key_dir user = "/config/sec/s-" ++ user
462
getCryptoKeyLookupPaths uuid = do user <- getVmCryptoUser uuid vm_dirs <- split ',' <$> getVmCryptoKeyDirs uuid platform_dirs <- split ',' <$> appGetPlatformCryptoKeyDirs let dirs = filter (not . null) $ [user_key_dir user] ++ vm_dirs ++ platform_dirs liftIO $ filterM doesDirectoryExist dirs where user_key_dir "" = "" user_key_dir user = "/config/sec/s-" ++ user
412
false
true
0
15
104
137
63
74
null
null
input-output-hk/pos-haskell-prototype
chain/test/Test/Pos/Chain/Txp/Bi.hs
mit
-------------------------------------------------------------------------------- -- TxAux -------------------------------------------------------------------------------- roundTripTxAux :: Property roundTripTxAux = eachOf 100 (feedPM genTxAux) roundTripsBiBuildable
266
roundTripTxAux :: Property roundTripTxAux = eachOf 100 (feedPM genTxAux) roundTripsBiBuildable
94
roundTripTxAux = eachOf 100 (feedPM genTxAux) roundTripsBiBuildable
67
true
true
0
7
14
27
15
12
null
null
Ongy/monky
Monky/CPU.hs
lgpl-3.0
getCPUTemp (TH (Just f)) = do temp <- readValue f return (temp `div` 1000)
78
getCPUTemp (TH (Just f)) = do temp <- readValue f return (temp `div` 1000)
78
getCPUTemp (TH (Just f)) = do temp <- readValue f return (temp `div` 1000)
78
false
false
0
9
17
47
22
25
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_COMPRESSED_SIGNED_RED_RGTC1_EXT :: GLenum gl_COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC
88
gl_COMPRESSED_SIGNED_RED_RGTC1_EXT :: GLenum gl_COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC
88
gl_COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC
43
false
true
0
4
5
11
6
5
null
null
Twinside/pandoc
src/Text/Pandoc/Writers/Docx.hs
gpl-2.0
listMarkerToId :: ListMarker -> String listMarkerToId NoMarker = "990"
70
listMarkerToId :: ListMarker -> String listMarkerToId NoMarker = "990"
70
listMarkerToId NoMarker = "990"
31
false
true
0
5
8
18
9
9
null
null
brendanhay/gogol
gogol-compute/gen/Network/Google/Resource/Compute/SecurityPolicies/PatchRule.hs
mpl-2.0
-- | Name of the security policy to update. spprSecurityPolicy :: Lens' SecurityPoliciesPatchRule Text spprSecurityPolicy = lens _spprSecurityPolicy (\ s a -> s{_spprSecurityPolicy = a})
194
spprSecurityPolicy :: Lens' SecurityPoliciesPatchRule Text spprSecurityPolicy = lens _spprSecurityPolicy (\ s a -> s{_spprSecurityPolicy = a})
150
spprSecurityPolicy = lens _spprSecurityPolicy (\ s a -> s{_spprSecurityPolicy = a})
91
true
true
0
8
32
43
22
21
null
null
ryantm/ghc
ghc/Main.hs
bsd-3-clause
printSetting :: String -> Mode printSetting k = mkPreLoadMode (PrintWithDynFlags f) where f dflags = fromMaybe (panic ("Setting not found: " ++ show k)) $ lookup k (compilerInfo dflags)
208
printSetting :: String -> Mode printSetting k = mkPreLoadMode (PrintWithDynFlags f) where f dflags = fromMaybe (panic ("Setting not found: " ++ show k)) $ lookup k (compilerInfo dflags)
208
printSetting k = mkPreLoadMode (PrintWithDynFlags f) where f dflags = fromMaybe (panic ("Setting not found: " ++ show k)) $ lookup k (compilerInfo dflags)
177
false
true
3
9
51
83
35
48
null
null
olsner/m3
TypeCheck.hs
bsd-3-clause
tcUnary LogicalNot = const (tcExprAsType TBool)
47
tcUnary LogicalNot = const (tcExprAsType TBool)
47
tcUnary LogicalNot = const (tcExprAsType TBool)
47
false
false
0
7
5
18
8
10
null
null
tjakway/ghcjvm
compiler/utils/Bag.hs
bsd-3-clause
mapAccumBagL f s (UnitBag x) = let (s1, x1) = f s x in (s1, UnitBag x1)
75
mapAccumBagL f s (UnitBag x) = let (s1, x1) = f s x in (s1, UnitBag x1)
75
mapAccumBagL f s (UnitBag x) = let (s1, x1) = f s x in (s1, UnitBag x1)
75
false
false
0
9
20
51
25
26
null
null
rueshyna/gogol
gogol-games/gen/Network/Google/Games/Types/Product.hs
mpl-2.0
-- | Token corresponding to the next page of results. qlrNextPageToken :: Lens' QuestListResponse (Maybe Text) qlrNextPageToken = lens _qlrNextPageToken (\ s a -> s{_qlrNextPageToken = a})
196
qlrNextPageToken :: Lens' QuestListResponse (Maybe Text) qlrNextPageToken = lens _qlrNextPageToken (\ s a -> s{_qlrNextPageToken = a})
142
qlrNextPageToken = lens _qlrNextPageToken (\ s a -> s{_qlrNextPageToken = a})
85
true
true
0
9
34
48
25
23
null
null
orbitgray/ProjectEuler
haskell/017.hs
lgpl-3.0
-- apply count_char to the range 1..N problem :: Int -> Int problem n = foldr (+) 0 (map count_chars [1..n])
108
problem :: Int -> Int problem n = foldr (+) 0 (map count_chars [1..n])
70
problem n = foldr (+) 0 (map count_chars [1..n])
48
true
true
0
8
20
41
22
19
null
null
choener/BiobaseBlast
Biobase/BLAST/Import.hs
gpl-3.0
aminoacidLetters = inClass "ARNDCQEGHILMFPSTWYVBZX-"
52
aminoacidLetters = inClass "ARNDCQEGHILMFPSTWYVBZX-"
52
aminoacidLetters = inClass "ARNDCQEGHILMFPSTWYVBZX-"
52
false
false
0
5
3
9
4
5
null
null
nkarag/haskell-CSVDB
src/Data/RTable.hs
bsd-3-clause
runUnaryROperation :: ROperation -- ^ input ROperation -> RTable -- ^ input RTable -> RTable -- ^ output RTable runUnaryROperation rop irtab = case rop of RFilter { fpred = rpredicate } -> runRfilter rpredicate irtab RPrj { colPrjList = colNames } -> runProjection colNames irtab RAggregate { aggList = aggFunctions } -> runAggregation aggFunctions irtab RGroupBy { gpred = groupingpred, aggList = aggFunctions, colGrByList = cols } -> runGroupBy groupingpred aggFunctions cols irtab RCombinedOp { rcombOp = comb } -> runCombinedROp comb irtab ROrderBy { colOrdList = colist } -> runOrderBy colist irtab -- | ropB operator executes a binary ROperation
980
runUnaryROperation :: ROperation -- ^ input ROperation -> RTable -- ^ input RTable -> RTable runUnaryROperation rop irtab = case rop of RFilter { fpred = rpredicate } -> runRfilter rpredicate irtab RPrj { colPrjList = colNames } -> runProjection colNames irtab RAggregate { aggList = aggFunctions } -> runAggregation aggFunctions irtab RGroupBy { gpred = groupingpred, aggList = aggFunctions, colGrByList = cols } -> runGroupBy groupingpred aggFunctions cols irtab RCombinedOp { rcombOp = comb } -> runCombinedROp comb irtab ROrderBy { colOrdList = colist } -> runOrderBy colist irtab -- | ropB operator executes a binary ROperation
959
runUnaryROperation rop irtab = case rop of RFilter { fpred = rpredicate } -> runRfilter rpredicate irtab RPrj { colPrjList = colNames } -> runProjection colNames irtab RAggregate { aggList = aggFunctions } -> runAggregation aggFunctions irtab RGroupBy { gpred = groupingpred, aggList = aggFunctions, colGrByList = cols } -> runGroupBy groupingpred aggFunctions cols irtab RCombinedOp { rcombOp = comb } -> runCombinedROp comb irtab ROrderBy { colOrdList = colist } -> runOrderBy colist irtab -- | ropB operator executes a binary ROperation
849
true
true
0
10
430
168
88
80
null
null
felipeZ/Dynamics
src/Molcas.hs
bsd-3-clause
parserInputMolcasQM :: FilePath -> MyParser MolState [AtomQM] -> IO [AtomQM] parserInputMolcasQM fileName parser = do input <- C.readFile fileName case runParser parser defaultParserState fileName input of Left msg -> error $ show msg Right xs -> return xs -- | Molcas .input File Parser
314
parserInputMolcasQM :: FilePath -> MyParser MolState [AtomQM] -> IO [AtomQM] parserInputMolcasQM fileName parser = do input <- C.readFile fileName case runParser parser defaultParserState fileName input of Left msg -> error $ show msg Right xs -> return xs -- | Molcas .input File Parser
314
parserInputMolcasQM fileName parser = do input <- C.readFile fileName case runParser parser defaultParserState fileName input of Left msg -> error $ show msg Right xs -> return xs -- | Molcas .input File Parser
237
false
true
0
12
70
100
45
55
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F03.hs
bsd-3-clause
-- glClearStencil -------------------------------------------------------------- -- | Manual pages for <https://www.opengl.org/sdk/docs/man2/xhtml/glClearStencil.xml OpenGL 2.x> or <https://www.opengl.org/sdk/docs/man3/xhtml/glClearStencil.xml OpenGL 3.x> or <https://www.opengl.org/sdk/docs/man4/html/glClearStencil.xhtml OpenGL 4.x>. glClearStencil :: MonadIO m => GLint -- ^ @s@ of type @StencilValue@. -> m () glClearStencil v1 = liftIO $ dyn13 ptr_glClearStencil v1
477
glClearStencil :: MonadIO m => GLint -- ^ @s@ of type @StencilValue@. -> m () glClearStencil v1 = liftIO $ dyn13 ptr_glClearStencil v1
140
glClearStencil v1 = liftIO $ dyn13 ptr_glClearStencil v1
56
true
true
0
9
48
46
22
24
null
null
brendanhay/gogol
gogol-slides/gen/Network/Google/Slides/Types/Product.hs
mpl-2.0
-- | The object ID for this page. Object IDs used by Page and PageElement -- share the same namespace. pObjectId :: Lens' Page (Maybe Text) pObjectId = lens _pObjectId (\ s a -> s{_pObjectId = a})
198
pObjectId :: Lens' Page (Maybe Text) pObjectId = lens _pObjectId (\ s a -> s{_pObjectId = a})
95
pObjectId = lens _pObjectId (\ s a -> s{_pObjectId = a})
58
true
true
0
9
38
49
26
23
null
null
kim/amazonka
amazonka-ec2/gen/Network/AWS/EC2/DescribePlacementGroups.hs
mpl-2.0
dpg1DryRun :: Lens' DescribePlacementGroups (Maybe Bool) dpg1DryRun = lens _dpg1DryRun (\s a -> s { _dpg1DryRun = a })
118
dpg1DryRun :: Lens' DescribePlacementGroups (Maybe Bool) dpg1DryRun = lens _dpg1DryRun (\s a -> s { _dpg1DryRun = a })
118
dpg1DryRun = lens _dpg1DryRun (\s a -> s { _dpg1DryRun = a })
61
false
true
0
9
18
45
24
21
null
null
fmthoma/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
assertErrorIdKey = mkPreludeMiscIdUnique 105
57
assertErrorIdKey = mkPreludeMiscIdUnique 105
57
assertErrorIdKey = mkPreludeMiscIdUnique 105
57
false
false
0
5
16
9
4
5
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_TEXTURE_IMMUTABLE_FORMAT_EXT :: GLenum gl_TEXTURE_IMMUTABLE_FORMAT_EXT = 0x912F
82
gl_TEXTURE_IMMUTABLE_FORMAT_EXT :: GLenum gl_TEXTURE_IMMUTABLE_FORMAT_EXT = 0x912F
82
gl_TEXTURE_IMMUTABLE_FORMAT_EXT = 0x912F
40
false
true
0
4
5
11
6
5
null
null
nevrenato/Hets_Fork
Isabelle/IsaConsts.hs
gpl-2.0
constsS :: String constsS = "consts"
36
constsS :: String constsS = "consts"
36
constsS = "consts"
18
false
true
0
4
5
11
6
5
null
null
danr/hipspec
src/HipSpec/Sig/Scope.hs
gpl-3.0
getIdsInScope :: (Id -> Id) -> Ghc [Id] getIdsInScope fix_id = do ns <- getNamesInScope things <- catMaybes <$> mapM lookupName ns return [ fix_id i | AnId i <- things ]
184
getIdsInScope :: (Id -> Id) -> Ghc [Id] getIdsInScope fix_id = do ns <- getNamesInScope things <- catMaybes <$> mapM lookupName ns return [ fix_id i | AnId i <- things ]
184
getIdsInScope fix_id = do ns <- getNamesInScope things <- catMaybes <$> mapM lookupName ns return [ fix_id i | AnId i <- things ]
144
false
true
0
12
46
82
37
45
null
null
harrisi/on-being-better
list-expansion/Haskell/cis194/spring13/04/HigherOrder.hs
cc0-1.0
fun1 :: [Integer] -> Integer fun1 [] = 1
40
fun1 :: [Integer] -> Integer fun1 [] = 1
40
fun1 [] = 1
11
false
true
0
8
8
29
13
16
null
null
schell/odin
odin-engine/src/Odin/Engine/GUI/Styles.hs
mit
--V4 0.74 0.23 0.22 1 textColorForButtonState _ = textColorForButtonState ButtonStateUp
87
textColorForButtonState _ = textColorForButtonState ButtonStateUp
65
textColorForButtonState _ = textColorForButtonState ButtonStateUp
65
true
false
0
5
9
14
6
8
null
null
Jonplussed/genotype-parser
src/Genotype/Printer/Arlequin.hs
bsd-3-clause
refCount [] = 0
15
refCount [] = 0
15
refCount [] = 0
15
false
false
1
5
3
15
5
10
null
null
luqui/tigress
CLI.hs
bsd-3-clause
showEnv :: Database -> PP.Doc showEnv db = PP.vcat [ PP.vcat (map (showProp db) (dbAssumptions db)) ]
106
showEnv :: Database -> PP.Doc showEnv db = PP.vcat [ PP.vcat (map (showProp db) (dbAssumptions db)) ]
106
showEnv db = PP.vcat [ PP.vcat (map (showProp db) (dbAssumptions db)) ]
76
false
true
0
10
21
53
26
27
null
null
kazu-yamamoto/http2
Network/HTTP2/Server.hs
bsd-3-clause
requestHeaders :: Request -> HeaderTable requestHeaders (Request req) = inpObjHeaders req
89
requestHeaders :: Request -> HeaderTable requestHeaders (Request req) = inpObjHeaders req
89
requestHeaders (Request req) = inpObjHeaders req
48
false
true
0
7
10
27
13
14
null
null
haskellbr/missingh
missingh-all/testsrc/Globtest.hs
mit
test_nested_dir = map f [glob (preppath "a/bcd/E*") >>= eq "a/bcd/E*" [preppath "a/bcd/EF"], glob (preppath "a/bcd/*g") >>= eq "a/bcd/*g" [preppath "a/bcd/efg"], glob (preppath "a/*.foo") >>= eq "a/*.foo" [preppath "a/a.foo"] ]
265
test_nested_dir = map f [glob (preppath "a/bcd/E*") >>= eq "a/bcd/E*" [preppath "a/bcd/EF"], glob (preppath "a/bcd/*g") >>= eq "a/bcd/*g" [preppath "a/bcd/efg"], glob (preppath "a/*.foo") >>= eq "a/*.foo" [preppath "a/a.foo"] ]
265
test_nested_dir = map f [glob (preppath "a/bcd/E*") >>= eq "a/bcd/E*" [preppath "a/bcd/EF"], glob (preppath "a/bcd/*g") >>= eq "a/bcd/*g" [preppath "a/bcd/efg"], glob (preppath "a/*.foo") >>= eq "a/*.foo" [preppath "a/a.foo"] ]
265
false
false
0
10
66
92
44
48
null
null
krisajenkins/esqueleto
src/Database/Esqueleto.hs
bsd-3-clause
-- $setup -- -- If you're already using @persistent@, then you're ready to use -- @esqueleto@, no further setup is needed. If you're just -- starting a new project and would like to use @esqueleto@, take -- a look at @persistent@'s book first -- (<http://www.yesodweb.com/book/persistent>) to learn how to -- define your schema. ---------------------------------------------------------------------- -- $introduction -- -- The main goals of @esqueleto@ are to: -- -- * Be easily translatable to SQL. When you take a look at a -- @esqueleto@ query, you should be able to know exactly how -- the SQL query will end up. (As opposed to being a -- relational algebra EDSL such as HaskellDB, which is -- non-trivial to translate into SQL.) -- -- * Support the mostly used SQL features. We'd like you to be -- able to use @esqueleto@ for all of your queries, no -- exceptions. Send a pull request or open an issue on our -- project page (<https://github.com/prowdsponsor/esqueleto>) if -- there's anything missing that you'd like to see. -- -- * Be as type-safe as possible. We strive to provide as many -- type checks as possible. If you get bitten by some invalid -- code that type-checks, please open an issue on our project -- page so we can take a look. -- -- However, it is /not/ a goal to be able to write portable SQL. -- We do not try to hide the differences between DBMSs from you, -- and @esqueleto@ code that works for one database may not work -- on another. This is a compromise we have to make in order to -- give you as much control over the raw SQL as possible without -- losing too much convenience. This also means that you may -- type-check a query that doesn't work on your DBMS. ---------------------------------------------------------------------- -- $gettingstarted -- -- We like clean, easy-to-read EDSLs. However, in order to -- achieve this goal we've used a lot of type hackery, leading to -- some hard-to-read type signatures. On this section, we'll try -- to build some intuition about the syntax. -- -- For the following examples, we'll use this example schema: -- -- @ -- share [mkPersist sqlSettings, mkMigrate \"migrateAll\"] [persist| -- Person -- name String -- age Int Maybe -- deriving Eq Show -- BlogPost -- title String -- authorId PersonId -- deriving Eq Show -- Follow -- follower PersonId -- followed PersonId -- deriving Eq Show -- |] -- @ -- -- Most of @esqueleto@ was created with @SELECT@ statements in -- mind, not only because they're the most common but also -- because they're the most complex kind of statement. The most -- simple kind of @SELECT@ would be: -- -- @ -- SELECT * -- FROM Person -- @ -- -- In @esqueleto@, we may write the same query above as: -- -- @ -- do people <- 'select' $ -- 'from' $ \\person -> do -- return person -- liftIO $ mapM_ (putStrLn . personName . entityVal) people -- @ -- -- The expression above has type @SqlPersist m ()@, while -- @people@ has type @[Entity Person]@. The query above will be -- translated into exactly the same query we wrote manually, but -- instead of @SELECT *@ it will list all entity fields (using -- @*@ is not robust). Note that @esqueleto@ knows that we want -- an @Entity Person@ just because of the @personName@ that we're -- printing later. -- -- However, most of the time we need to filter our queries using -- @WHERE@. For example: -- -- @ -- SELECT * -- FROM Person -- WHERE Person.name = \"John\" -- @ -- -- In @esqueleto@, we may write the same query above as: -- -- @ -- 'select' $ -- 'from' $ \\p -> do -- 'where_' (p '^.' PersonName '==.' 'val' \"John\") -- return p -- @ -- -- Although @esqueleto@'s code is a bit more noisy, it's has -- almost the same structure (save from the @return@). The -- @('^.')@ operator is used to project a field from an entity. -- The field name is the same one generated by @persistent@'s -- Template Haskell functions. We use 'val' to lift a constant -- Haskell value into the SQL query. -- -- Another example would be: -- -- @ -- SELECT * -- FROM Person -- WHERE Person.age >= 18 -- @ -- -- In @esqueleto@, we may write the same query above as: -- -- @ -- 'select' $ -- 'from' $ \\p -> do -- 'where_' (p '^.' PersonAge '>=.' 'just' ('val' 18)) -- return p -- @ -- -- Since @age@ is an optional @Person@ field, we use 'just' lift -- @'val' 18 :: SqlExpr (Value Int)@ into @just ('val' 18) :: -- SqlExpr (Value (Maybe Int))@. -- -- Implicit joins are represented by tuples. For example, to get -- the list of all blog posts and their authors, we could write: -- -- @ -- SELECT BlogPost.*, Person.* -- FROM BlogPost, Person -- WHERE BlogPost.authorId = Person.id -- ORDER BY BlogPost.title ASC -- @ -- -- In @esqueleto@, we may write the same query above as: -- -- @ -- 'select' $ -- 'from' $ \\(b, p) -> do -- 'where_' (b '^.' BlogPostAuthorId '==.' p '^.' PersonId) -- 'orderBy' ['asc' (b '^.' BlogPostTitle)] -- return (b, p) -- @ -- -- However, we may want your results to include people who don't -- have any blog posts as well using a @LEFT OUTER JOIN@: -- -- @ -- SELECT Person.*, BlogPost.* -- FROM Person LEFT OUTER JOIN BlogPost -- ON Person.id = BlogPost.authorId -- ORDER BY Person.name ASC, BlogPost.title ASC -- @ -- -- In @esqueleto@, we may write the same query above as: -- -- @ -- 'select' $ -- 'from' $ \\(p `'LeftOuterJoin`` mb) -> do -- 'on' ('just' (p '^.' PersonId) '==.' mb '?.' BlogPostAuthorId) -- 'orderBy' ['asc' (p '^.' PersonName), 'asc' (mb '?.' BlogPostTitle)] -- return (p, mb) -- @ -- -- On a @LEFT OUTER JOIN@ the entity on the right hand side may -- not exist (i.e. there may be a @Person@ without any -- @BlogPost@s), so while @p :: SqlExpr (Entity Person)@, we have -- @mb :: SqlExpr (Maybe (Entity BlogPost))@. The whole -- expression above has type @SqlPersist m [(Entity Person, Maybe -- (Entity BlogPost))]@. Instead of using @(^.)@, we used -- @('?.')@ to project a field from a @Maybe (Entity a)@. -- -- We are by no means limited to joins of two tables, nor by -- joins of different tables. For example, we may want a list -- the @Follow@ entity: -- -- @ -- SELECT P1.*, Follow.*, P2.* -- FROM Person AS P1 -- INNER JOIN Follow ON P1.id = Follow.follower -- INNER JOIN P2 ON P2.id = Follow.followed -- @ -- -- In @esqueleto@, we may write the same query above as: -- -- @ -- 'select' $ -- 'from' $ \\(p1 `'InnerJoin`` f `'InnerJoin`` p2) -> do -- 'on' (p2 '^.' PersonId '==.' f '^.' FollowFollowed) -- 'on' (p1 '^.' PersonId '==.' f '^.' FollowFollower) -- return (p1, f, p2) -- @ -- -- /Note carefully that the order of the ON clauses is/ -- /reversed!/ You're required to write your 'on's in reverse -- order because that helps composability (see the documentation -- of 'on' for more details). -- -- We also currently support @UPDATE@ and @DELETE@ statements. -- For example: -- -- @ -- do 'update' $ \\p -> do -- 'set' p [ PersonName '=.' 'val' \"João\" ] -- 'where_' (p '^.' PersonName '==.' 'val' \"Joao\") -- 'delete' $ -- 'from' $ \\p -> do -- 'where_' (p '^.' PersonAge '<.' 'just' ('val' 14)) -- @ -- -- The results of queries can also be used for insertions. -- In @SQL@, we might write the following, inserting a new blog -- post for every user: -- -- @ -- INSERT INTO BlogPost -- SELECT ('Group Blog Post', id) -- FROM Person -- @ -- -- In @esqueleto@, we may write the same query above as: -- -- @ -- 'insertSelect' $ 'from' $ \\p-> -- return $ BlogPost '<#' \"Group Blog Post\" '<&>' (p '^.' PersonId) -- @ -- -- Individual insertions can be performed through Persistent's -- 'insert' function, reexported for convenience. ---------------------------------------------------------------------- -- $reexports -- -- We re-export many symbols from @persistent@ for convenince: -- -- * \"Store functions\" from "Database.Persist". -- -- * Everything from "Database.Persist.Class" except for -- @PersistQuery@ and @delete@ (use 'deleteKey' instead). -- -- * Everything from "Database.Persist.Types" except for -- @Update@, @SelectOpt@, @BackendSpecificFilter@ and @Filter@. -- -- * Everything from "Database.Persist.Sql" except for -- @deleteWhereCount@ and @updateWhereCount@. ---------------------------------------------------------------------- -- $rdbmsSpecificModules -- -- There are many differences between SQL syntax and functions -- supported by different RDBMSs. Since version 2.2.8, -- @esqueleto@ includes modules containing functions that are -- specific to a given RDBMS. -- -- * PostgreSQL: "Database.Esqueleto.PostgreSQL". -- -- In order to use these functions, you need to explicitly import -- their corresponding modules, they're not re-exported here. ---------------------------------------------------------------------- -- | @valkey i = 'val' . 'toSqlKey'@ -- (<https://github.com/prowdsponsor/esqueleto/issues/9>). valkey :: (Esqueleto query expr backend, ToBackendKey SqlBackend entity, PersistField (Key entity)) => Int64 -> expr (Value (Key entity)) valkey = val . toSqlKey
9,093
valkey :: (Esqueleto query expr backend, ToBackendKey SqlBackend entity, PersistField (Key entity)) => Int64 -> expr (Value (Key entity)) valkey = val . toSqlKey
171
valkey = val . toSqlKey
23
true
true
0
11
1,728
339
306
33
null
null
apyrgio/ganeti
src/Ganeti/HTools/Cluster.hs
bsd-2-clause
instanceGroup :: Node.List -> Instance.Instance -> Result Gdx instanceGroup nl i = let sidx = Instance.sNode i pnode = Container.find (Instance.pNode i) nl snode = if sidx == Node.noSecondary then pnode else Container.find sidx nl pgroup = Node.group pnode sgroup = Node.group snode in if pgroup /= sgroup then fail ("Instance placed accross two node groups, primary " ++ show pgroup ++ ", secondary " ++ show sgroup) else return pgroup
524
instanceGroup :: Node.List -> Instance.Instance -> Result Gdx instanceGroup nl i = let sidx = Instance.sNode i pnode = Container.find (Instance.pNode i) nl snode = if sidx == Node.noSecondary then pnode else Container.find sidx nl pgroup = Node.group pnode sgroup = Node.group snode in if pgroup /= sgroup then fail ("Instance placed accross two node groups, primary " ++ show pgroup ++ ", secondary " ++ show sgroup) else return pgroup
524
instanceGroup nl i = let sidx = Instance.sNode i pnode = Container.find (Instance.pNode i) nl snode = if sidx == Node.noSecondary then pnode else Container.find sidx nl pgroup = Node.group pnode sgroup = Node.group snode in if pgroup /= sgroup then fail ("Instance placed accross two node groups, primary " ++ show pgroup ++ ", secondary " ++ show sgroup) else return pgroup
462
false
true
0
13
158
157
76
81
null
null
zhiyuanshi/fcore
testsuite/ModuleSpec.hs
bsd-2-clause
testCasesPath = "testsuite/tests/should_run/module"
51
testCasesPath = "testsuite/tests/should_run/module"
51
testCasesPath = "testsuite/tests/should_run/module"
51
false
false
1
5
2
10
3
7
null
null
gsdlab/claferIG
src/Language/Clafer/IG/ClaferModel.hs
mit
n_id (ValueNode i _) = i
24
n_id (ValueNode i _) = i
24
n_id (ValueNode i _) = i
24
false
false
0
6
5
18
8
10
null
null
lukexi/ghc-7.8-arm64
compiler/cmm/CmmOpt.hs
bsd-3-clause
constantFoldNode :: DynFlags -> CmmNode e x -> CmmNode e x constantFoldNode dflags = mapExp (constantFoldExpr dflags)
117
constantFoldNode :: DynFlags -> CmmNode e x -> CmmNode e x constantFoldNode dflags = mapExp (constantFoldExpr dflags)
117
constantFoldNode dflags = mapExp (constantFoldExpr dflags)
58
false
true
0
7
16
41
19
22
null
null
input-output-hk/pos-haskell-prototype
wallet/src/Cardano/Wallet/Kernel/Util/NonEmptyMap.hs
mit
fromMap :: Map k v -> Maybe (NonEmptyMap k v) fromMap m = if Map.null m then Nothing else Just (coerce m)
105
fromMap :: Map k v -> Maybe (NonEmptyMap k v) fromMap m = if Map.null m then Nothing else Just (coerce m)
105
fromMap m = if Map.null m then Nothing else Just (coerce m)
59
false
true
0
8
21
56
27
29
null
null