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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
danse/haskellers | Handler/Poll.hs | bsd-2-clause | postPollsR :: Handler Html
postPollsR = do
Entity _ u <- requireAuth
unless (userAdmin u) $ permissionDenied "Must be an admin to create a poll"
t <- runInputPost $ ireq textField "poll"
let ls = filter (not . T.null) $ T.lines t
unless (length ls >= 3) $ invalidArgs ["Need at least a question and two answers"]
let (q:as) = ls
now <- liftIO getCurrentTime
pollid <- runDB $ do
pollid <- insert $ Poll q now False
mapM_ (\(a, i) -> insert $ PollOption pollid a i) $ zip as [1..]
return pollid
setMessage "Poll created"
redirect $ PollR pollid | 607 | postPollsR :: Handler Html
postPollsR = do
Entity _ u <- requireAuth
unless (userAdmin u) $ permissionDenied "Must be an admin to create a poll"
t <- runInputPost $ ireq textField "poll"
let ls = filter (not . T.null) $ T.lines t
unless (length ls >= 3) $ invalidArgs ["Need at least a question and two answers"]
let (q:as) = ls
now <- liftIO getCurrentTime
pollid <- runDB $ do
pollid <- insert $ Poll q now False
mapM_ (\(a, i) -> insert $ PollOption pollid a i) $ zip as [1..]
return pollid
setMessage "Poll created"
redirect $ PollR pollid | 607 | postPollsR = do
Entity _ u <- requireAuth
unless (userAdmin u) $ permissionDenied "Must be an admin to create a poll"
t <- runInputPost $ ireq textField "poll"
let ls = filter (not . T.null) $ T.lines t
unless (length ls >= 3) $ invalidArgs ["Need at least a question and two answers"]
let (q:as) = ls
now <- liftIO getCurrentTime
pollid <- runDB $ do
pollid <- insert $ Poll q now False
mapM_ (\(a, i) -> insert $ PollOption pollid a i) $ zip as [1..]
return pollid
setMessage "Poll created"
redirect $ PollR pollid | 580 | false | true | 0 | 16 | 164 | 238 | 108 | 130 | null | null |
573/leksah | src/IDE/Command/VCS/GIT.hs | gpl-2.0 | pullAction :: Types.VCSAction ()
pullAction = Helper.createActionFromContext $ GitGUI.askPassWrapper GitGUI.pull | 112 | pullAction :: Types.VCSAction ()
pullAction = Helper.createActionFromContext $ GitGUI.askPassWrapper GitGUI.pull | 112 | pullAction = Helper.createActionFromContext $ GitGUI.askPassWrapper GitGUI.pull | 79 | false | true | 1 | 7 | 9 | 34 | 15 | 19 | null | null |
shlevy/ghc | compiler/codeGen/StgCmmClosure.hs | bsd-3-clause | closureFunInfo :: ClosureInfo -> Maybe (RepArity, ArgDescr)
closureFunInfo (ClosureInfo { closureLFInfo = lf_info }) = lfFunInfo lf_info | 136 | closureFunInfo :: ClosureInfo -> Maybe (RepArity, ArgDescr)
closureFunInfo (ClosureInfo { closureLFInfo = lf_info }) = lfFunInfo lf_info | 136 | closureFunInfo (ClosureInfo { closureLFInfo = lf_info }) = lfFunInfo lf_info | 76 | false | true | 0 | 8 | 16 | 46 | 23 | 23 | null | null |
sethfowler/hsbugzilla | demo/BugzillaDemo.hs | bsd-3-clause | doHistory :: BugId -> Int -> BugzillaSession -> IO ()
doHistory bug count session = do
comments <- getComments session bug
history <- getHistory session bug
recentEventsRev <- takeRecent count (reverse comments)
(reverse $ historyEvents history)
mapM_ putStrLn (reverse recentEventsRev)
where
takeRecent :: Int -> [Comment] -> [HistoryEvent] -> IO [String]
takeRecent 0 _ _ = return []
takeRecent n (c:cs) (e:es)
| commentCreationTime c `diffUTCTime` historyEventTime e >= 0 = (:) <$> showComment c
<*> takeRecent (n - 1) cs (e:es)
| otherwise = (:) <$> showEvent e
<*> takeRecent (n - 1) (c:cs) es
takeRecent n cs@(_:_) [] = mapM showComment $ take n cs
takeRecent n [] es@(_:_) = mapM showEvent $ take n es
takeRecent _ [] [] = return []
-- FIXME: showComment and showEvent will call getUser for the same
-- user over and over again. You should never do this in a real application.
showComment (Comment {..}) = do
user <- getUser session commentCreator
let commentUserRealName = fromMaybe commentCreator $ userRealName <$> user
let commentUserEmail = fromMaybe commentCreator $ userEmail =<< user
return $ "(Comment " ++ show commentCount ++ ") " ++ T.unpack commentUserRealName
++ " <" ++ T.unpack commentUserEmail ++ "> " ++ show commentCreationTime
++ "\n" ++ (unlines . map (" " ++) . lines . T.unpack $ commentText)
showEvent (HistoryEvent {..}) = do
user <- getUser session historyEventUser
let eventUserRealName = fromMaybe historyEventUser $ userRealName <$> user
let eventUserEmail = fromMaybe historyEventUser $ userEmail =<< user
return $ "(Event " ++ show historyEventId ++ ") " ++ T.unpack eventUserRealName
++ " <" ++ T.unpack eventUserEmail ++ ">\n"
++ concatMap showChange historyEventChanges
showChange (TextFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (ListFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (IntFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (TimeFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (BoolFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange' f r a aid = " " ++ showField f ++ ": "
++ showMod r ++ " -> " ++ showMod a
++ showAid aid ++ "\n"
showField = T.unpack . fieldName
showMod :: Show a => Maybe a -> String
showMod (Just v) = show v
showMod Nothing = "___"
showAid :: Maybe AttachmentId -> String
showAid (Just aid) = " (Attachment " ++ show aid ++ ")"
showAid Nothing = "" | 2,974 | doHistory :: BugId -> Int -> BugzillaSession -> IO ()
doHistory bug count session = do
comments <- getComments session bug
history <- getHistory session bug
recentEventsRev <- takeRecent count (reverse comments)
(reverse $ historyEvents history)
mapM_ putStrLn (reverse recentEventsRev)
where
takeRecent :: Int -> [Comment] -> [HistoryEvent] -> IO [String]
takeRecent 0 _ _ = return []
takeRecent n (c:cs) (e:es)
| commentCreationTime c `diffUTCTime` historyEventTime e >= 0 = (:) <$> showComment c
<*> takeRecent (n - 1) cs (e:es)
| otherwise = (:) <$> showEvent e
<*> takeRecent (n - 1) (c:cs) es
takeRecent n cs@(_:_) [] = mapM showComment $ take n cs
takeRecent n [] es@(_:_) = mapM showEvent $ take n es
takeRecent _ [] [] = return []
-- FIXME: showComment and showEvent will call getUser for the same
-- user over and over again. You should never do this in a real application.
showComment (Comment {..}) = do
user <- getUser session commentCreator
let commentUserRealName = fromMaybe commentCreator $ userRealName <$> user
let commentUserEmail = fromMaybe commentCreator $ userEmail =<< user
return $ "(Comment " ++ show commentCount ++ ") " ++ T.unpack commentUserRealName
++ " <" ++ T.unpack commentUserEmail ++ "> " ++ show commentCreationTime
++ "\n" ++ (unlines . map (" " ++) . lines . T.unpack $ commentText)
showEvent (HistoryEvent {..}) = do
user <- getUser session historyEventUser
let eventUserRealName = fromMaybe historyEventUser $ userRealName <$> user
let eventUserEmail = fromMaybe historyEventUser $ userEmail =<< user
return $ "(Event " ++ show historyEventId ++ ") " ++ T.unpack eventUserRealName
++ " <" ++ T.unpack eventUserEmail ++ ">\n"
++ concatMap showChange historyEventChanges
showChange (TextFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (ListFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (IntFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (TimeFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (BoolFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange' f r a aid = " " ++ showField f ++ ": "
++ showMod r ++ " -> " ++ showMod a
++ showAid aid ++ "\n"
showField = T.unpack . fieldName
showMod :: Show a => Maybe a -> String
showMod (Just v) = show v
showMod Nothing = "___"
showAid :: Maybe AttachmentId -> String
showAid (Just aid) = " (Attachment " ++ show aid ++ ")"
showAid Nothing = "" | 2,974 | doHistory bug count session = do
comments <- getComments session bug
history <- getHistory session bug
recentEventsRev <- takeRecent count (reverse comments)
(reverse $ historyEvents history)
mapM_ putStrLn (reverse recentEventsRev)
where
takeRecent :: Int -> [Comment] -> [HistoryEvent] -> IO [String]
takeRecent 0 _ _ = return []
takeRecent n (c:cs) (e:es)
| commentCreationTime c `diffUTCTime` historyEventTime e >= 0 = (:) <$> showComment c
<*> takeRecent (n - 1) cs (e:es)
| otherwise = (:) <$> showEvent e
<*> takeRecent (n - 1) (c:cs) es
takeRecent n cs@(_:_) [] = mapM showComment $ take n cs
takeRecent n [] es@(_:_) = mapM showEvent $ take n es
takeRecent _ [] [] = return []
-- FIXME: showComment and showEvent will call getUser for the same
-- user over and over again. You should never do this in a real application.
showComment (Comment {..}) = do
user <- getUser session commentCreator
let commentUserRealName = fromMaybe commentCreator $ userRealName <$> user
let commentUserEmail = fromMaybe commentCreator $ userEmail =<< user
return $ "(Comment " ++ show commentCount ++ ") " ++ T.unpack commentUserRealName
++ " <" ++ T.unpack commentUserEmail ++ "> " ++ show commentCreationTime
++ "\n" ++ (unlines . map (" " ++) . lines . T.unpack $ commentText)
showEvent (HistoryEvent {..}) = do
user <- getUser session historyEventUser
let eventUserRealName = fromMaybe historyEventUser $ userRealName <$> user
let eventUserEmail = fromMaybe historyEventUser $ userEmail =<< user
return $ "(Event " ++ show historyEventId ++ ") " ++ T.unpack eventUserRealName
++ " <" ++ T.unpack eventUserEmail ++ ">\n"
++ concatMap showChange historyEventChanges
showChange (TextFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (ListFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (IntFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (TimeFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange (BoolFieldChange f (Modification r a aid)) = showChange' f r a aid
showChange' f r a aid = " " ++ showField f ++ ": "
++ showMod r ++ " -> " ++ showMod a
++ showAid aid ++ "\n"
showField = T.unpack . fieldName
showMod :: Show a => Maybe a -> String
showMod (Just v) = show v
showMod Nothing = "___"
showAid :: Maybe AttachmentId -> String
showAid (Just aid) = " (Attachment " ++ show aid ++ ")"
showAid Nothing = "" | 2,920 | false | true | 7 | 16 | 937 | 1,034 | 478 | 556 | null | null |
mhwombat/exp-audio-id-wains | src/ALife/Creatur/Wain/AudioID/Experiment.hs | bsd-3-clause | updateChildren :: StateT Experiment IO ()
updateChildren = do
(a:matureChildren) <- W.weanMatureChildren <$> use subject
assign subject a
(a':deadChildren) <- W.pruneDeadChildren <$> use subject
assign subject a'
assign weanlings (matureChildren ++ deadChildren)
(summary.rWeanCount) += length matureChildren | 320 | updateChildren :: StateT Experiment IO ()
updateChildren = do
(a:matureChildren) <- W.weanMatureChildren <$> use subject
assign subject a
(a':deadChildren) <- W.pruneDeadChildren <$> use subject
assign subject a'
assign weanlings (matureChildren ++ deadChildren)
(summary.rWeanCount) += length matureChildren | 320 | updateChildren = do
(a:matureChildren) <- W.weanMatureChildren <$> use subject
assign subject a
(a':deadChildren) <- W.pruneDeadChildren <$> use subject
assign subject a'
assign weanlings (matureChildren ++ deadChildren)
(summary.rWeanCount) += length matureChildren | 278 | false | true | 0 | 9 | 47 | 112 | 52 | 60 | null | null |
spacekitteh/smcghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitCtzCall :: LocalReg -> CmmExpr -> Width -> FCode ()
emitCtzCall res x width = do
emitPrimCall
[ res ]
(MO_Ctz width)
[ x ] | 154 | emitCtzCall :: LocalReg -> CmmExpr -> Width -> FCode ()
emitCtzCall res x width = do
emitPrimCall
[ res ]
(MO_Ctz width)
[ x ] | 154 | emitCtzCall res x width = do
emitPrimCall
[ res ]
(MO_Ctz width)
[ x ] | 98 | false | true | 0 | 10 | 52 | 62 | 29 | 33 | null | null |
portnov/yaledger | YaLedger/Tree.hs | bsd-3-clause | allNodes (Branch {..}) =
branchData: concatMap allNodes branchChildren | 74 | allNodes (Branch {..}) =
branchData: concatMap allNodes branchChildren | 74 | allNodes (Branch {..}) =
branchData: concatMap allNodes branchChildren | 74 | false | false | 2 | 7 | 11 | 30 | 13 | 17 | null | null |
ecaustin/haskhol-math | src/HaskHOL/Lib/Lists.hs | bsd-2-clause | thmREVERSE_APPEND :: ListsCtxt thry => HOL cls thry HOLThm
thmREVERSE_APPEND = cacheProof "thmREVERSE_APPEND" ctxtLists .
prove [txt| ! (xs:A list) (ys:A list). REVERSE (APPEND xs ys) =
APPEND (REVERSE ys) (REVERSE xs) |] $
tacLIST_INDUCT `_THEN`
tacASM_REWRITE [defAPPEND, defREVERSE, thmAPPEND_NIL, thmAPPEND_ASSOC] | 378 | thmREVERSE_APPEND :: ListsCtxt thry => HOL cls thry HOLThm
thmREVERSE_APPEND = cacheProof "thmREVERSE_APPEND" ctxtLists .
prove [txt| ! (xs:A list) (ys:A list). REVERSE (APPEND xs ys) =
APPEND (REVERSE ys) (REVERSE xs) |] $
tacLIST_INDUCT `_THEN`
tacASM_REWRITE [defAPPEND, defREVERSE, thmAPPEND_NIL, thmAPPEND_ASSOC] | 378 | thmREVERSE_APPEND = cacheProof "thmREVERSE_APPEND" ctxtLists .
prove [txt| ! (xs:A list) (ys:A list). REVERSE (APPEND xs ys) =
APPEND (REVERSE ys) (REVERSE xs) |] $
tacLIST_INDUCT `_THEN`
tacASM_REWRITE [defAPPEND, defREVERSE, thmAPPEND_NIL, thmAPPEND_ASSOC] | 319 | false | true | 2 | 7 | 101 | 68 | 35 | 33 | null | null |
JaDogg/__py_playground | reference/sketchbook/regex/nfa.hs | mit | alt re1 re2 state = re1 state `Fork` re2 state | 46 | alt re1 re2 state = re1 state `Fork` re2 state | 46 | alt re1 re2 state = re1 state `Fork` re2 state | 46 | false | false | 0 | 6 | 9 | 25 | 12 | 13 | null | null |
pparkkin/eta | compiler/ETA/BasicTypes/Literal.hs | bsd-3-clause | literalType (MachStr _) = mkObjectPrimTy jstringTy | 54 | literalType (MachStr _) = mkObjectPrimTy jstringTy | 54 | literalType (MachStr _) = mkObjectPrimTy jstringTy | 54 | false | false | 0 | 7 | 9 | 18 | 8 | 10 | null | null |
d0kt0r0/estuary | common/src/Estuary/Tidal/Types.hs | gpl-3.0 | emptySPattern :: SpecificPattern
emptySPattern = S (Blank Inert) | 64 | emptySPattern :: SpecificPattern
emptySPattern = S (Blank Inert) | 64 | emptySPattern = S (Blank Inert) | 31 | false | true | 0 | 7 | 7 | 20 | 10 | 10 | null | null |
sdiehl/ghc | compiler/GHC/Hs/Types.hs | bsd-3-clause | hsLTyVarLocName :: LHsTyVarBndr (GhcPass p) -> Located (IdP (GhcPass p))
hsLTyVarLocName = mapLoc hsTyVarName | 109 | hsLTyVarLocName :: LHsTyVarBndr (GhcPass p) -> Located (IdP (GhcPass p))
hsLTyVarLocName = mapLoc hsTyVarName | 109 | hsLTyVarLocName = mapLoc hsTyVarName | 36 | false | true | 0 | 10 | 13 | 42 | 20 | 22 | null | null |
chreekat/snowdrift | tests/TestImport.hs | agpl-3.0 | distPrefix :: IO FilePath
distPrefix = do
subdirs <- fmap (filter $ L.isPrefixOf "dist-sandbox-") $ getDirectoryContents "dist"
let subdir = case subdirs of [x] -> x; _ -> ""
return $ "dist" </> subdir </> "build" | 225 | distPrefix :: IO FilePath
distPrefix = do
subdirs <- fmap (filter $ L.isPrefixOf "dist-sandbox-") $ getDirectoryContents "dist"
let subdir = case subdirs of [x] -> x; _ -> ""
return $ "dist" </> subdir </> "build" | 225 | distPrefix = do
subdirs <- fmap (filter $ L.isPrefixOf "dist-sandbox-") $ getDirectoryContents "dist"
let subdir = case subdirs of [x] -> x; _ -> ""
return $ "dist" </> subdir </> "build" | 199 | false | true | 0 | 13 | 47 | 93 | 43 | 50 | null | null |
chrisdone/pgsql-simple | Database/PostgreSQL/Simple.hs | bsd-3-clause | query :: (QueryParams q, QueryResults r)
=> Connection -> Query -> q -> IO [r]
query conn template qs = do
q <- formatQuery template qs
(fields,rows) <- Base.query conn q
forM rows $ \row -> let !c = convertResults fields row
in return c
-- | A version of 'query' that does not perform query substitution. | 343 | query :: (QueryParams q, QueryResults r)
=> Connection -> Query -> q -> IO [r]
query conn template qs = do
q <- formatQuery template qs
(fields,rows) <- Base.query conn q
forM rows $ \row -> let !c = convertResults fields row
in return c
-- | A version of 'query' that does not perform query substitution. | 343 | query conn template qs = do
q <- formatQuery template qs
(fields,rows) <- Base.query conn q
forM rows $ \row -> let !c = convertResults fields row
in return c
-- | A version of 'query' that does not perform query substitution. | 255 | false | true | 0 | 13 | 94 | 120 | 57 | 63 | null | null |
ekmett/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_CSS_VALUE :: Int
wxSTC_CSS_VALUE = 8 | 42 | wxSTC_CSS_VALUE :: Int
wxSTC_CSS_VALUE = 8 | 42 | wxSTC_CSS_VALUE = 8 | 19 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
peter-fogg/pardoc | tests/Tests/Readers/LaTeX.hs | gpl-2.0 | natbibCitations :: Test
natbibCitations = testGroup "natbib"
[ "citet" =: "\\citet{item1}"
=?> para (cite [baseCitation] (rt "\\citet{item1}"))
, "suffix" =: "\\citet[p.~30]{item1}"
=?> para
(cite [baseCitation{ citationSuffix = toList $ text "p.\160\&30" }] (rt "\\citet[p.~30]{item1}"))
, "suffix long" =: "\\citet[p.~30, with suffix]{item1}"
=?> para (cite [baseCitation{ citationSuffix =
toList $ text "p.\160\&30, with suffix" }] (rt "\\citet[p.~30, with suffix]{item1}"))
, "multiple" =: "\\citeauthor{item1} \\citetext{\\citeyear{item1}; \\citeyear[p.~30]{item2}; \\citealp[see also][]{item3}}"
=?> para (cite [baseCitation{ citationMode = AuthorInText }
,baseCitation{ citationMode = SuppressAuthor
, citationSuffix = [Str "p.\160\&30"]
, citationId = "item2" }
,baseCitation{ citationId = "item3"
, citationPrefix = [Str "see",Space,Str "also"]
, citationMode = NormalCitation }
] (rt "\\citetext{\\citeyear{item1}; \\citeyear[p.~30]{item2}; \\citealp[see also][]{item3}}"))
, "group" =: "\\citetext{\\citealp[see][p.~34--35]{item1}; \\citealp[also][chap. 3]{item3}}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationPrefix = [Str "see"]
, citationSuffix = [Str "p.\160\&34\8211\&35"] }
,baseCitation{ citationMode = NormalCitation
, citationId = "item3"
, citationPrefix = [Str "also"]
, citationSuffix = [Str "chap.",Space,Str "3"] }
] (rt "\\citetext{\\citealp[see][p.~34--35]{item1}; \\citealp[also][chap. 3]{item3}}"))
, "suffix and locator" =: "\\citep[pp.~33, 35--37, and nowhere else]{item1}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationSuffix = [Str "pp.\160\&33,",Space,Str "35\8211\&37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] (rt "\\citep[pp.~33, 35--37, and nowhere else]{item1}"))
, "suffix only" =: "\\citep[and nowhere else]{item1}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationSuffix = toList $ text "and nowhere else" }] (rt "\\citep[and nowhere else]{item1}"))
, "no author" =: "\\citeyearpar{item1}, and now Doe with a locator \\citeyearpar[p.~44]{item2}"
=?> para (cite [baseCitation{ citationMode = SuppressAuthor }] (rt "\\citeyearpar{item1}") <>
text ", and now Doe with a locator " <>
cite [baseCitation{ citationMode = SuppressAuthor
, citationSuffix = [Str "p.\160\&44"]
, citationId = "item2" }] (rt "\\citeyearpar[p.~44]{item2}"))
, "markup" =: "\\citep[\\emph{see}][p. \\textbf{32}]{item1}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationPrefix = [Emph [Str "see"]]
, citationSuffix = [Str "p.",Space,
Strong [Str "32"]] }] (rt "\\citep[\\emph{see}][p. \\textbf{32}]{item1}"))
] | 3,357 | natbibCitations :: Test
natbibCitations = testGroup "natbib"
[ "citet" =: "\\citet{item1}"
=?> para (cite [baseCitation] (rt "\\citet{item1}"))
, "suffix" =: "\\citet[p.~30]{item1}"
=?> para
(cite [baseCitation{ citationSuffix = toList $ text "p.\160\&30" }] (rt "\\citet[p.~30]{item1}"))
, "suffix long" =: "\\citet[p.~30, with suffix]{item1}"
=?> para (cite [baseCitation{ citationSuffix =
toList $ text "p.\160\&30, with suffix" }] (rt "\\citet[p.~30, with suffix]{item1}"))
, "multiple" =: "\\citeauthor{item1} \\citetext{\\citeyear{item1}; \\citeyear[p.~30]{item2}; \\citealp[see also][]{item3}}"
=?> para (cite [baseCitation{ citationMode = AuthorInText }
,baseCitation{ citationMode = SuppressAuthor
, citationSuffix = [Str "p.\160\&30"]
, citationId = "item2" }
,baseCitation{ citationId = "item3"
, citationPrefix = [Str "see",Space,Str "also"]
, citationMode = NormalCitation }
] (rt "\\citetext{\\citeyear{item1}; \\citeyear[p.~30]{item2}; \\citealp[see also][]{item3}}"))
, "group" =: "\\citetext{\\citealp[see][p.~34--35]{item1}; \\citealp[also][chap. 3]{item3}}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationPrefix = [Str "see"]
, citationSuffix = [Str "p.\160\&34\8211\&35"] }
,baseCitation{ citationMode = NormalCitation
, citationId = "item3"
, citationPrefix = [Str "also"]
, citationSuffix = [Str "chap.",Space,Str "3"] }
] (rt "\\citetext{\\citealp[see][p.~34--35]{item1}; \\citealp[also][chap. 3]{item3}}"))
, "suffix and locator" =: "\\citep[pp.~33, 35--37, and nowhere else]{item1}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationSuffix = [Str "pp.\160\&33,",Space,Str "35\8211\&37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] (rt "\\citep[pp.~33, 35--37, and nowhere else]{item1}"))
, "suffix only" =: "\\citep[and nowhere else]{item1}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationSuffix = toList $ text "and nowhere else" }] (rt "\\citep[and nowhere else]{item1}"))
, "no author" =: "\\citeyearpar{item1}, and now Doe with a locator \\citeyearpar[p.~44]{item2}"
=?> para (cite [baseCitation{ citationMode = SuppressAuthor }] (rt "\\citeyearpar{item1}") <>
text ", and now Doe with a locator " <>
cite [baseCitation{ citationMode = SuppressAuthor
, citationSuffix = [Str "p.\160\&44"]
, citationId = "item2" }] (rt "\\citeyearpar[p.~44]{item2}"))
, "markup" =: "\\citep[\\emph{see}][p. \\textbf{32}]{item1}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationPrefix = [Emph [Str "see"]]
, citationSuffix = [Str "p.",Space,
Strong [Str "32"]] }] (rt "\\citep[\\emph{see}][p. \\textbf{32}]{item1}"))
] | 3,357 | natbibCitations = testGroup "natbib"
[ "citet" =: "\\citet{item1}"
=?> para (cite [baseCitation] (rt "\\citet{item1}"))
, "suffix" =: "\\citet[p.~30]{item1}"
=?> para
(cite [baseCitation{ citationSuffix = toList $ text "p.\160\&30" }] (rt "\\citet[p.~30]{item1}"))
, "suffix long" =: "\\citet[p.~30, with suffix]{item1}"
=?> para (cite [baseCitation{ citationSuffix =
toList $ text "p.\160\&30, with suffix" }] (rt "\\citet[p.~30, with suffix]{item1}"))
, "multiple" =: "\\citeauthor{item1} \\citetext{\\citeyear{item1}; \\citeyear[p.~30]{item2}; \\citealp[see also][]{item3}}"
=?> para (cite [baseCitation{ citationMode = AuthorInText }
,baseCitation{ citationMode = SuppressAuthor
, citationSuffix = [Str "p.\160\&30"]
, citationId = "item2" }
,baseCitation{ citationId = "item3"
, citationPrefix = [Str "see",Space,Str "also"]
, citationMode = NormalCitation }
] (rt "\\citetext{\\citeyear{item1}; \\citeyear[p.~30]{item2}; \\citealp[see also][]{item3}}"))
, "group" =: "\\citetext{\\citealp[see][p.~34--35]{item1}; \\citealp[also][chap. 3]{item3}}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationPrefix = [Str "see"]
, citationSuffix = [Str "p.\160\&34\8211\&35"] }
,baseCitation{ citationMode = NormalCitation
, citationId = "item3"
, citationPrefix = [Str "also"]
, citationSuffix = [Str "chap.",Space,Str "3"] }
] (rt "\\citetext{\\citealp[see][p.~34--35]{item1}; \\citealp[also][chap. 3]{item3}}"))
, "suffix and locator" =: "\\citep[pp.~33, 35--37, and nowhere else]{item1}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationSuffix = [Str "pp.\160\&33,",Space,Str "35\8211\&37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] (rt "\\citep[pp.~33, 35--37, and nowhere else]{item1}"))
, "suffix only" =: "\\citep[and nowhere else]{item1}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationSuffix = toList $ text "and nowhere else" }] (rt "\\citep[and nowhere else]{item1}"))
, "no author" =: "\\citeyearpar{item1}, and now Doe with a locator \\citeyearpar[p.~44]{item2}"
=?> para (cite [baseCitation{ citationMode = SuppressAuthor }] (rt "\\citeyearpar{item1}") <>
text ", and now Doe with a locator " <>
cite [baseCitation{ citationMode = SuppressAuthor
, citationSuffix = [Str "p.\160\&44"]
, citationId = "item2" }] (rt "\\citeyearpar[p.~44]{item2}"))
, "markup" =: "\\citep[\\emph{see}][p. \\textbf{32}]{item1}"
=?> para (cite [baseCitation{ citationMode = NormalCitation
, citationPrefix = [Emph [Str "see"]]
, citationSuffix = [Str "p.",Space,
Strong [Str "32"]] }] (rt "\\citep[\\emph{see}][p. \\textbf{32}]{item1}"))
] | 3,333 | false | true | 0 | 17 | 1,026 | 679 | 371 | 308 | null | null |
castaway/pandoc | src/Text/Pandoc/Shared.hs | gpl-2.0 | consolidateInlines [] = [] | 26 | consolidateInlines [] = [] | 26 | consolidateInlines [] = [] | 26 | false | false | 0 | 6 | 3 | 13 | 6 | 7 | null | null |
ndmitchell/hlint | src/GHC/Util/Brackets.hs | bsd-3-clause | isAtomOrApp (L _ (HsApp _ _ x)) = isAtomOrApp x | 47 | isAtomOrApp (L _ (HsApp _ _ x)) = isAtomOrApp x | 47 | isAtomOrApp (L _ (HsApp _ _ x)) = isAtomOrApp x | 47 | false | false | 0 | 9 | 9 | 30 | 14 | 16 | null | null |
ndmitchell/firstify | Yhc/Core/Firstify/PaperOld.hs | bsd-3-clause | inline :: CoreFuncMap -> CoreFuncName -> SS (Maybe CoreExpr)
inline core name = do
let CoreFunc _ args body = core Map.! name
liftM Just $ duplicateExpr $ coreLam args body | 180 | inline :: CoreFuncMap -> CoreFuncName -> SS (Maybe CoreExpr)
inline core name = do
let CoreFunc _ args body = core Map.! name
liftM Just $ duplicateExpr $ coreLam args body | 180 | inline core name = do
let CoreFunc _ args body = core Map.! name
liftM Just $ duplicateExpr $ coreLam args body | 119 | false | true | 0 | 10 | 38 | 75 | 34 | 41 | null | null |
brendanhay/gogol | gogol-shopping-content/gen/Network/Google/Resource/Content/Productstatuses/Get.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
pgUploadType :: Lens' ProductstatusesGet (Maybe Text)
pgUploadType
= lens _pgUploadType (\ s a -> s{_pgUploadType = a}) | 192 | pgUploadType :: Lens' ProductstatusesGet (Maybe Text)
pgUploadType
= lens _pgUploadType (\ s a -> s{_pgUploadType = a}) | 121 | pgUploadType
= lens _pgUploadType (\ s a -> s{_pgUploadType = a}) | 67 | true | true | 1 | 9 | 28 | 52 | 25 | 27 | null | null |
patperry/hs-ieee754 | tests/Tests.hs | bsd-3-clause | test_copySign_F6 =
copySign 1 (copySign nan (-1)) @?= (-1 :: F) | 67 | test_copySign_F6 =
copySign 1 (copySign nan (-1)) @?= (-1 :: F) | 67 | test_copySign_F6 =
copySign 1 (copySign nan (-1)) @?= (-1 :: F) | 67 | false | false | 0 | 10 | 14 | 36 | 19 | 17 | null | null |
lucasbraun/mt-rewrite | src/MtOptimizer.hs | bsd-3-clause | innerNeedsSplit :: Pa.ScalarExpr -> Bool
innerNeedsSplit (Pa.App _ (Pa.Name _ [Pa.Nmc from]) [Pa.App _ (Pa.Name _ [Pa.Nmc to]) _ ,_]) =
containsString to "ToUniversal" && containsString from "FromUniversal" | 214 | innerNeedsSplit :: Pa.ScalarExpr -> Bool
innerNeedsSplit (Pa.App _ (Pa.Name _ [Pa.Nmc from]) [Pa.App _ (Pa.Name _ [Pa.Nmc to]) _ ,_]) =
containsString to "ToUniversal" && containsString from "FromUniversal" | 214 | innerNeedsSplit (Pa.App _ (Pa.Name _ [Pa.Nmc from]) [Pa.App _ (Pa.Name _ [Pa.Nmc to]) _ ,_]) =
containsString to "ToUniversal" && containsString from "FromUniversal" | 173 | false | true | 0 | 13 | 35 | 101 | 49 | 52 | null | null |
gridaphobe/liquid-fixpoint | src/Language/Fixpoint/Solver/Solve.hs | bsd-3-clause | predKs :: F.Pred -> [(F.KVar, F.Subst)]
predKs (F.PAnd ps) = concatMap predKs ps | 83 | predKs :: F.Pred -> [(F.KVar, F.Subst)]
predKs (F.PAnd ps) = concatMap predKs ps | 83 | predKs (F.PAnd ps) = concatMap predKs ps | 43 | false | true | 0 | 8 | 15 | 50 | 25 | 25 | null | null |
kojiromike/Idris-dev | src/Idris/CaseSplit.hs | bsd-3-clause | -- EB's personal preference :)
stripNS :: PTerm -> PTerm
stripNS tm = mapPT dens tm where
dens (PRef fc hls n) = PRef fc hls (nsroot n)
dens t = t | 155 | stripNS :: PTerm -> PTerm
stripNS tm = mapPT dens tm where
dens (PRef fc hls n) = PRef fc hls (nsroot n)
dens t = t | 123 | stripNS tm = mapPT dens tm where
dens (PRef fc hls n) = PRef fc hls (nsroot n)
dens t = t | 97 | true | true | 1 | 7 | 40 | 76 | 33 | 43 | null | null |
Ralith/tisp | src/Tisp/CodeGen.hs | bsd-3-clause | tyArgs :: Type -> [(String, Type, [A.ParameterAttribute])]
tyArgs (FunctionType _ args False) = zip3 (repeat "") args (repeat []) | 129 | tyArgs :: Type -> [(String, Type, [A.ParameterAttribute])]
tyArgs (FunctionType _ args False) = zip3 (repeat "") args (repeat []) | 129 | tyArgs (FunctionType _ args False) = zip3 (repeat "") args (repeat []) | 70 | false | true | 0 | 9 | 18 | 70 | 36 | 34 | null | null |
nevrenato/HetsAlloy | OWL2/Parse.hs | gpl-2.0 | isegment :: CharParser st String
isegment = flat $ many ipChar | 62 | isegment :: CharParser st String
isegment = flat $ many ipChar | 62 | isegment = flat $ many ipChar | 29 | false | true | 3 | 5 | 10 | 27 | 11 | 16 | null | null |
5outh/cypher | src/Cypher/Functions.hs | mit | getRoot_ :: Connection -> (RootResponse -> Neo4jAction a) -> IO (Maybe a)
getRoot_ = everythingOnAction interpret (json . get) baseUrl | 134 | getRoot_ :: Connection -> (RootResponse -> Neo4jAction a) -> IO (Maybe a)
getRoot_ = everythingOnAction interpret (json . get) baseUrl | 134 | getRoot_ = everythingOnAction interpret (json . get) baseUrl | 60 | false | true | 0 | 9 | 19 | 52 | 26 | 26 | null | null |
marcelosousa/poet | src/Exploration/SUNF/API.hs | gpl-2.0 | filterEvents :: EventsID -> Events -> IO EventsID
filterEvents es events = filterM (\e -> filterEvent e events) es | 114 | filterEvents :: EventsID -> Events -> IO EventsID
filterEvents es events = filterM (\e -> filterEvent e events) es | 114 | filterEvents es events = filterM (\e -> filterEvent e events) es | 64 | false | true | 0 | 8 | 18 | 45 | 22 | 23 | null | null |
Lainepress/hledger | hledger-lib/Hledger/Read/JournalReader.hs | gpl-3.0 | -- | Top-level journal parser. Returns a single composite, I/O performing,
-- error-raising "JournalUpdate" (and final "JournalContext") which can be
-- applied to an empty journal to get the final result.
journalFile :: GenParser Char JournalContext (JournalUpdate,JournalContext)
journalFile = do
journalupdates <- many journalItem
eof
finalctx <- getState
return $ (juSequence journalupdates, finalctx)
where
-- As all journal line types can be distinguished by the first
-- character, excepting transactions versus empty (blank or
-- comment-only) lines, can use choice w/o try
journalItem = choice [ ledgerDirective
, liftM (return . addTransaction) ledgerTransaction
, liftM (return . addModifierTransaction) ledgerModifierTransaction
, liftM (return . addPeriodicTransaction) ledgerPeriodicTransaction
, liftM (return . addHistoricalPrice) ledgerHistoricalPrice
, emptyLine >> return (return id)
] <?> "journal transaction or directive" | 1,142 | journalFile :: GenParser Char JournalContext (JournalUpdate,JournalContext)
journalFile = do
journalupdates <- many journalItem
eof
finalctx <- getState
return $ (juSequence journalupdates, finalctx)
where
-- As all journal line types can be distinguished by the first
-- character, excepting transactions versus empty (blank or
-- comment-only) lines, can use choice w/o try
journalItem = choice [ ledgerDirective
, liftM (return . addTransaction) ledgerTransaction
, liftM (return . addModifierTransaction) ledgerModifierTransaction
, liftM (return . addPeriodicTransaction) ledgerPeriodicTransaction
, liftM (return . addHistoricalPrice) ledgerHistoricalPrice
, emptyLine >> return (return id)
] <?> "journal transaction or directive" | 936 | journalFile = do
journalupdates <- many journalItem
eof
finalctx <- getState
return $ (juSequence journalupdates, finalctx)
where
-- As all journal line types can be distinguished by the first
-- character, excepting transactions versus empty (blank or
-- comment-only) lines, can use choice w/o try
journalItem = choice [ ledgerDirective
, liftM (return . addTransaction) ledgerTransaction
, liftM (return . addModifierTransaction) ledgerModifierTransaction
, liftM (return . addPeriodicTransaction) ledgerPeriodicTransaction
, liftM (return . addHistoricalPrice) ledgerHistoricalPrice
, emptyLine >> return (return id)
] <?> "journal transaction or directive" | 860 | true | true | 4 | 9 | 321 | 170 | 84 | 86 | null | null |
hvr/jhc | src/Text/PrettyPrint/Leijen.hs | mit | fits w SEmpty = True | 38 | fits w SEmpty = True | 38 | fits w SEmpty = True | 38 | false | false | 1 | 5 | 22 | 16 | 5 | 11 | null | null |
tolysz/hs-tls | core/Network/TLS/Crypto/ECDH.hs | bsd-3-clause | -- for server key exchange
ecdhUnwrap :: ECDHParams -> ECDHPublic -> (Word16,Integer,Integer,Int)
ecdhUnwrap (ECDHParams _ name) point = (w16,x,y,siz)
where
w16 = case fromCurveName name of
Just w -> w
Nothing -> error "ecdhUnwrap"
(x,y,siz) = ecdhUnwrapPublic point
-- for client key exchange | 321 | ecdhUnwrap :: ECDHParams -> ECDHPublic -> (Word16,Integer,Integer,Int)
ecdhUnwrap (ECDHParams _ name) point = (w16,x,y,siz)
where
w16 = case fromCurveName name of
Just w -> w
Nothing -> error "ecdhUnwrap"
(x,y,siz) = ecdhUnwrapPublic point
-- for client key exchange | 294 | ecdhUnwrap (ECDHParams _ name) point = (w16,x,y,siz)
where
w16 = case fromCurveName name of
Just w -> w
Nothing -> error "ecdhUnwrap"
(x,y,siz) = ecdhUnwrapPublic point
-- for client key exchange | 223 | true | true | 1 | 10 | 70 | 117 | 60 | 57 | null | null |
alexbiehl/hs-ssh | src/SSH.hs | bsd-3-clause | kexInit :: Session ()
kexInit = do
cookie <- net (readBytes 16)
nameLists <- fmap (map (splitOn "," . fromLBS)) (replicateM 10 (net readLBS))
kpf <- net readByte
dummy <- net readULong
let theirKEXInit = reconstruct cookie nameLists kpf dummy
ocn = match (nameLists !! 3) (map fst supportedCiphers)
icn = match (nameLists !! 2) (map fst supportedCiphers)
omn = match (nameLists !! 5) (map fst supportedMACs)
imn = match (nameLists !! 4) (map fst supportedMACs)
dump ("KEXINIT", theirKEXInit, ocn, icn, omn, imn)
modify $ \st ->
case st of
Initial c cc h s p cv sk is ->
case
( lookup ocn supportedCiphers
, lookup icn supportedCiphers
, lookup omn supportedMACs
, lookup imn supportedMACs
) of
(Just oc, Just ic, Just om, Just im) ->
GotKEXInit
{ ssConfig = c
, ssChannelConfig = cc
, ssThem = h
, ssSend = s
, ssPayload = p
, ssTheirVersion = cv
, ssOurKEXInit = sk
, ssTheirKEXInit = theirKEXInit
, ssOutCipher = oc
, ssInCipher = ic
, ssOutHMACPrep = om
, ssInHMACPrep = im
, ssInSeq = is
}
_ ->
error . concat $
[ "impossible: lookup failed for ciphers/macs: "
, show (ocn, icn, omn, imn)
]
_ -> error "impossible state transition; expected Initial"
where
match n h = head . filter (`elem` h) $ n
reconstruct c nls kpf dummy = doPacket $ do
byte 20
raw c
mapM_ (string . intercalate ",") nls
byte kpf
long dummy | 2,139 | kexInit :: Session ()
kexInit = do
cookie <- net (readBytes 16)
nameLists <- fmap (map (splitOn "," . fromLBS)) (replicateM 10 (net readLBS))
kpf <- net readByte
dummy <- net readULong
let theirKEXInit = reconstruct cookie nameLists kpf dummy
ocn = match (nameLists !! 3) (map fst supportedCiphers)
icn = match (nameLists !! 2) (map fst supportedCiphers)
omn = match (nameLists !! 5) (map fst supportedMACs)
imn = match (nameLists !! 4) (map fst supportedMACs)
dump ("KEXINIT", theirKEXInit, ocn, icn, omn, imn)
modify $ \st ->
case st of
Initial c cc h s p cv sk is ->
case
( lookup ocn supportedCiphers
, lookup icn supportedCiphers
, lookup omn supportedMACs
, lookup imn supportedMACs
) of
(Just oc, Just ic, Just om, Just im) ->
GotKEXInit
{ ssConfig = c
, ssChannelConfig = cc
, ssThem = h
, ssSend = s
, ssPayload = p
, ssTheirVersion = cv
, ssOurKEXInit = sk
, ssTheirKEXInit = theirKEXInit
, ssOutCipher = oc
, ssInCipher = ic
, ssOutHMACPrep = om
, ssInHMACPrep = im
, ssInSeq = is
}
_ ->
error . concat $
[ "impossible: lookup failed for ciphers/macs: "
, show (ocn, icn, omn, imn)
]
_ -> error "impossible state transition; expected Initial"
where
match n h = head . filter (`elem` h) $ n
reconstruct c nls kpf dummy = doPacket $ do
byte 20
raw c
mapM_ (string . intercalate ",") nls
byte kpf
long dummy | 2,139 | kexInit = do
cookie <- net (readBytes 16)
nameLists <- fmap (map (splitOn "," . fromLBS)) (replicateM 10 (net readLBS))
kpf <- net readByte
dummy <- net readULong
let theirKEXInit = reconstruct cookie nameLists kpf dummy
ocn = match (nameLists !! 3) (map fst supportedCiphers)
icn = match (nameLists !! 2) (map fst supportedCiphers)
omn = match (nameLists !! 5) (map fst supportedMACs)
imn = match (nameLists !! 4) (map fst supportedMACs)
dump ("KEXINIT", theirKEXInit, ocn, icn, omn, imn)
modify $ \st ->
case st of
Initial c cc h s p cv sk is ->
case
( lookup ocn supportedCiphers
, lookup icn supportedCiphers
, lookup omn supportedMACs
, lookup imn supportedMACs
) of
(Just oc, Just ic, Just om, Just im) ->
GotKEXInit
{ ssConfig = c
, ssChannelConfig = cc
, ssThem = h
, ssSend = s
, ssPayload = p
, ssTheirVersion = cv
, ssOurKEXInit = sk
, ssTheirKEXInit = theirKEXInit
, ssOutCipher = oc
, ssInCipher = ic
, ssOutHMACPrep = om
, ssInHMACPrep = im
, ssInSeq = is
}
_ ->
error . concat $
[ "impossible: lookup failed for ciphers/macs: "
, show (ocn, icn, omn, imn)
]
_ -> error "impossible state transition; expected Initial"
where
match n h = head . filter (`elem` h) $ n
reconstruct c nls kpf dummy = doPacket $ do
byte 20
raw c
mapM_ (string . intercalate ",") nls
byte kpf
long dummy | 2,117 | false | true | 2 | 18 | 1,068 | 569 | 288 | 281 | null | null |
karamellpelle/grid | source/OpenGL/ES2/Values.hs | gpl-3.0 | gl_UNSIGNED_BYTE :: GLenum
gl_UNSIGNED_BYTE = 0x1401 | 67 | gl_UNSIGNED_BYTE :: GLenum
gl_UNSIGNED_BYTE = 0x1401 | 67 | gl_UNSIGNED_BYTE = 0x1401 | 40 | false | true | 0 | 4 | 20 | 11 | 6 | 5 | null | null |
mikegehard/haskellBookExercises | chapter12/MaybeLib.hs | mit | -- >>> flipMaybe [Just 1, Just 2, Just 3]
-- Just [1, 2, 3]
-- >>> flipMaybe [Just 1, Nothing, Just 3]
-- Nothing
flipMaybe :: [Maybe a] -> Maybe [a]
flipMaybe list =
if difference > 0 then Nothing
else Just justValues
where
justValues = catMaybes list
difference = length list - length justValues | 365 | flipMaybe :: [Maybe a] -> Maybe [a]
flipMaybe list =
if difference > 0 then Nothing
else Just justValues
where
justValues = catMaybes list
difference = length list - length justValues | 231 | flipMaybe list =
if difference > 0 then Nothing
else Just justValues
where
justValues = catMaybes list
difference = length list - length justValues | 195 | true | true | 1 | 7 | 122 | 75 | 39 | 36 | null | null |
DavidAlphaFox/ghc | libraries/transformers/Control/Monad/Trans/State/Lazy.hs | bsd-3-clause | -- | Evaluate a state computation with the given initial state
-- and return the final value, discarding the final state.
--
-- * @'evalStateT' m s = 'liftM' 'fst' ('runStateT' m s)@
evalStateT :: (Monad m) => StateT s m a -> s -> m a
evalStateT m s = do
~(a, _) <- runStateT m s
return a
-- | Evaluate a state computation with the given initial state
-- and return the final state, discarding the final value.
--
-- * @'execStateT' m s = 'liftM' 'snd' ('runStateT' m s)@ | 480 | evalStateT :: (Monad m) => StateT s m a -> s -> m a
evalStateT m s = do
~(a, _) <- runStateT m s
return a
-- | Evaluate a state computation with the given initial state
-- and return the final state, discarding the final value.
--
-- * @'execStateT' m s = 'liftM' 'snd' ('runStateT' m s)@ | 297 | evalStateT m s = do
~(a, _) <- runStateT m s
return a
-- | Evaluate a state computation with the given initial state
-- and return the final state, discarding the final value.
--
-- * @'execStateT' m s = 'liftM' 'snd' ('runStateT' m s)@ | 245 | true | true | 0 | 9 | 101 | 76 | 40 | 36 | null | null |
lhoghu/yahoo-portfolio-manager | src/Data/YahooPortfolioManager/DbAdapter.hs | mit | histoLowCol :: String
histoLowCol = "low" | 41 | histoLowCol :: String
histoLowCol = "low" | 41 | histoLowCol = "low" | 19 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
sourcewave/pg-schema-diff | Console.hs | unlicense | charCheck = '\x2714' | 20 | charCheck = '\x2714' | 20 | charCheck = '\x2714' | 20 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
rvion/ride | jetpack/src/System/Console/ANSI/AsAnsi.hs | bsd-3-clause | -- ansi_hHideCursor :: Handle -> IO ()
ansi_hHideCursor = I.hHideCursor | 71 | ansi_hHideCursor = I.hHideCursor | 32 | ansi_hHideCursor = I.hHideCursor | 32 | true | false | 1 | 6 | 9 | 13 | 5 | 8 | null | null |
gcampax/ghc | compiler/main/DynFlags.hs | bsd-3-clause | -- | These -X<blah> flags cannot be reversed with -XNo<blah>
-- They are used to place hard requirements on what GHC Haskell language
-- features can be used.
safeHaskellFlags :: [FlagSpec SafeHaskellMode]
safeHaskellFlags = [mkF Sf_Unsafe, mkF Sf_Trustworthy, mkF Sf_Safe]
where mkF flag = flagSpec (show flag) flag
-- | These -X<blah> flags can all be reversed with -XNo<blah> | 383 | safeHaskellFlags :: [FlagSpec SafeHaskellMode]
safeHaskellFlags = [mkF Sf_Unsafe, mkF Sf_Trustworthy, mkF Sf_Safe]
where mkF flag = flagSpec (show flag) flag
-- | These -X<blah> flags can all be reversed with -XNo<blah> | 224 | safeHaskellFlags = [mkF Sf_Unsafe, mkF Sf_Trustworthy, mkF Sf_Safe]
where mkF flag = flagSpec (show flag) flag
-- | These -X<blah> flags can all be reversed with -XNo<blah> | 177 | true | true | 0 | 7 | 63 | 60 | 32 | 28 | null | null |
ganeti/htools | Ganeti/HTools/Utils.hs | gpl-2.0 | -- | Coneverts a list of JSON values into a list of JSON objects.
asObjectList :: (Monad m) => [J.JSValue] -> m [J.JSObject J.JSValue]
asObjectList = mapM asJSObject | 165 | asObjectList :: (Monad m) => [J.JSValue] -> m [J.JSObject J.JSValue]
asObjectList = mapM asJSObject | 99 | asObjectList = mapM asJSObject | 30 | true | true | 0 | 10 | 27 | 46 | 24 | 22 | null | null |
ryantrinkle/reflex | src/Reflex/Query/Class.hs | bsd-3-clause | -- | The Semigroup\/Monoid\/Group instances for a Query containing 'SelectedCount's should use
-- this function which returns Nothing if the result is 0. This allows the pruning of leaves
-- of the 'Query' that are no longer wanted.
combineSelectedCounts :: SelectedCount -> SelectedCount -> Maybe SelectedCount
combineSelectedCounts (SelectedCount i) (SelectedCount j) = if i == negate j then Nothing else Just $ SelectedCount (i + j) | 435 | combineSelectedCounts :: SelectedCount -> SelectedCount -> Maybe SelectedCount
combineSelectedCounts (SelectedCount i) (SelectedCount j) = if i == negate j then Nothing else Just $ SelectedCount (i + j) | 202 | combineSelectedCounts (SelectedCount i) (SelectedCount j) = if i == negate j then Nothing else Just $ SelectedCount (i + j) | 123 | true | true | 0 | 9 | 65 | 71 | 37 | 34 | null | null |
bch29/streaming-png | src/Codec/Picture/Png/Streaming.hs | lgpl-3.0 | -- | Is the given PNG interlace method supported? Currently only the null
-- interlace method (no interlacing) is supported.
isInterlaceMethodSupported :: InterlaceMethod -> Bool
isInterlaceMethodSupported = (== 0) | 214 | isInterlaceMethodSupported :: InterlaceMethod -> Bool
isInterlaceMethodSupported = (== 0) | 89 | isInterlaceMethodSupported = (== 0) | 35 | true | true | 0 | 5 | 28 | 21 | 13 | 8 | null | null |
tomwadeson/cis194 | week6/Fibonacci.hs | mit | fib _ = 0 | 9 | fib _ = 0 | 9 | fib _ = 0 | 9 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
samcal/rasa | rasa-ext-slate/src/Rasa/Ext/Slate/Internal/Attributes.hs | gpl-3.0 | -- | helper to reset to default attributes
reset :: V.Image
reset = V.text' V.defAttr "" | 88 | reset :: V.Image
reset = V.text' V.defAttr "" | 45 | reset = V.text' V.defAttr "" | 28 | true | true | 0 | 6 | 15 | 23 | 12 | 11 | null | null |
jozefg/hi | src/TC/TySyn.hs | mit | checkSCC :: SCC Name -> TCM ()
checkSCC = \case
AcyclicSCC _ -> return ()
CyclicSCC (h : _) -> throwError (TySynCycle h) | 124 | checkSCC :: SCC Name -> TCM ()
checkSCC = \case
AcyclicSCC _ -> return ()
CyclicSCC (h : _) -> throwError (TySynCycle h) | 124 | checkSCC = \case
AcyclicSCC _ -> return ()
CyclicSCC (h : _) -> throwError (TySynCycle h) | 93 | false | true | 0 | 10 | 26 | 64 | 30 | 34 | null | null |
geigerzaehler/pladen | Pladen/App/Feed.hs | mit | linkEl :: Show a => a -> Element
linkEl url = Element (atomName "link") (Map.singleton "href" url') []
where url' = fromString $ show url | 141 | linkEl :: Show a => a -> Element
linkEl url = Element (atomName "link") (Map.singleton "href" url') []
where url' = fromString $ show url | 141 | linkEl url = Element (atomName "link") (Map.singleton "href" url') []
where url' = fromString $ show url | 108 | false | true | 1 | 8 | 28 | 74 | 32 | 42 | null | null |
rvion/lamdu | Lamdu/GUI/ExpressionEdit/HoleEdit/SearchArea/SearchTerm.hs | gpl-3.0 | textEditNoEmpty :: TextEdit.Style -> TextEdit.Style
textEditNoEmpty textEditStyle =
textEditStyle
& TextEdit.sEmptyFocusedString .~ " "
& TextEdit.sEmptyUnfocusedString .~ " " | 189 | textEditNoEmpty :: TextEdit.Style -> TextEdit.Style
textEditNoEmpty textEditStyle =
textEditStyle
& TextEdit.sEmptyFocusedString .~ " "
& TextEdit.sEmptyUnfocusedString .~ " " | 189 | textEditNoEmpty textEditStyle =
textEditStyle
& TextEdit.sEmptyFocusedString .~ " "
& TextEdit.sEmptyUnfocusedString .~ " " | 137 | false | true | 4 | 6 | 32 | 45 | 21 | 24 | null | null |
danidiaz/streaming-eversion | src/Streaming/Eversion.hs | bsd-3-clause | stoppedBeforeEOF :: String
stoppedBeforeEOF = "Stopped before receiving EOF." | 77 | stoppedBeforeEOF :: String
stoppedBeforeEOF = "Stopped before receiving EOF." | 77 | stoppedBeforeEOF = "Stopped before receiving EOF." | 50 | false | true | 0 | 4 | 8 | 11 | 6 | 5 | null | null |
ozgurakgun/Idris-dev | src/Idris/Parser/Helpers.hs | bsd-3-clause | popIndent :: IdrisParser ()
popIndent = do ist <- get
case indent_stack ist of
[] -> error "The impossible happened! Tried to pop an indentation level where none was pushed (underflow)."
(x : xs) -> put (ist { indent_stack = xs })
-- | Gets current indentation | 311 | popIndent :: IdrisParser ()
popIndent = do ist <- get
case indent_stack ist of
[] -> error "The impossible happened! Tried to pop an indentation level where none was pushed (underflow)."
(x : xs) -> put (ist { indent_stack = xs })
-- | Gets current indentation | 311 | popIndent = do ist <- get
case indent_stack ist of
[] -> error "The impossible happened! Tried to pop an indentation level where none was pushed (underflow)."
(x : xs) -> put (ist { indent_stack = xs })
-- | Gets current indentation | 283 | false | true | 1 | 14 | 97 | 76 | 36 | 40 | null | null |
vikraman/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | toTcType :: Type -> TcType
-- The constraint solver expects EvVars to have TcType, in which the
-- free type variables are TcTyVars. So we convert from Type to TcType here
-- A bit tiresome; but one day I expect the two types to be entirely separate
-- in which case we'll definitely need to do this
toTcType = runIdentity . to_tc_type emptyVarSet | 347 | toTcType :: Type -> TcType
toTcType = runIdentity . to_tc_type emptyVarSet | 74 | toTcType = runIdentity . to_tc_type emptyVarSet | 47 | true | true | 1 | 7 | 62 | 33 | 16 | 17 | null | null |
kishoredbn/barrelfish | tools/mackerel/ShiftDriver.hs | mit | --
-- Calculate an appropriate built-in type for a mackerel type
--
regtype_c_builtin :: TT.Rec -> C.TypeSpec
regtype_c_builtin rt = C.TypeName $ round_field_size $ TT.tt_size rt | 178 | regtype_c_builtin :: TT.Rec -> C.TypeSpec
regtype_c_builtin rt = C.TypeName $ round_field_size $ TT.tt_size rt | 110 | regtype_c_builtin rt = C.TypeName $ round_field_size $ TT.tt_size rt | 68 | true | true | 0 | 8 | 25 | 45 | 22 | 23 | null | null |
cyruscousins/HarmLang | src/HarmLang/InitialBasis.hs | mit | -- CONVENIENCE FUNCTIONS
intervalAB :: PitchClass -> PitchClass -> Interval
intervalAB (PitchClass a) (PitchClass b) = Interval (mod ((-) b a) 12) | 147 | intervalAB :: PitchClass -> PitchClass -> Interval
intervalAB (PitchClass a) (PitchClass b) = Interval (mod ((-) b a) 12) | 121 | intervalAB (PitchClass a) (PitchClass b) = Interval (mod ((-) b a) 12) | 70 | true | true | 0 | 9 | 22 | 58 | 30 | 28 | null | null |
sdiehl/ghc | libraries/base/GHC/Event/IntTable.hs | bsd-3-clause | -- | Used to undo the effect of a prior insertWith.
reset :: Int -> Maybe a -> IntTable a -> IO ()
reset k (Just v) tbl = insertWith const k v tbl >> return () | 159 | reset :: Int -> Maybe a -> IntTable a -> IO ()
reset k (Just v) tbl = insertWith const k v tbl >> return () | 107 | reset k (Just v) tbl = insertWith const k v tbl >> return () | 60 | true | true | 0 | 9 | 36 | 66 | 31 | 35 | null | null |
AlexanderPankiv/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | -- We know the list must have at least one @Match@ in it.
pprMatches :: (OutputableBndr idL, OutputableBndr idR, Outputable body)
=> HsMatchContext idL -> MatchGroup idR body -> SDoc
pprMatches ctxt (MG { mg_alts = matches })
= vcat (map (pprMatch ctxt) (map unLoc matches)) | 290 | pprMatches :: (OutputableBndr idL, OutputableBndr idR, Outputable body)
=> HsMatchContext idL -> MatchGroup idR body -> SDoc
pprMatches ctxt (MG { mg_alts = matches })
= vcat (map (pprMatch ctxt) (map unLoc matches)) | 231 | pprMatches ctxt (MG { mg_alts = matches })
= vcat (map (pprMatch ctxt) (map unLoc matches)) | 95 | true | true | 3 | 9 | 61 | 98 | 47 | 51 | null | null |
dysinger/amazonka | amazonka-opsworks/gen/Network/AWS/OpsWorks/Types.hs | mpl-2.0 | -- | A 'LayerCustomRecipes' object that specifies the layer's custom recipes.
lCustomRecipes :: Lens' Layer (Maybe Recipes)
lCustomRecipes = lens _lCustomRecipes (\s a -> s { _lCustomRecipes = a }) | 197 | lCustomRecipes :: Lens' Layer (Maybe Recipes)
lCustomRecipes = lens _lCustomRecipes (\s a -> s { _lCustomRecipes = a }) | 119 | lCustomRecipes = lens _lCustomRecipes (\s a -> s { _lCustomRecipes = a }) | 73 | true | true | 0 | 9 | 29 | 46 | 25 | 21 | null | null |
bos/mysql | Database/MySQL/Base.hs | bsd-3-clause | ping :: Connection -> IO ()
ping conn = withConn conn $ \ptr -> mysql_ping ptr >>= check "ping" conn | 100 | ping :: Connection -> IO ()
ping conn = withConn conn $ \ptr -> mysql_ping ptr >>= check "ping" conn | 100 | ping conn = withConn conn $ \ptr -> mysql_ping ptr >>= check "ping" conn | 72 | false | true | 0 | 8 | 19 | 47 | 22 | 25 | null | null |
ahmadsalim/micro-dsl-properties | src/FJ.hs | gpl-3.0 | checkExpressionScope prog env (MethodCall Nothing e m es) =
checkExpressionScope prog env e &&
any (\m' -> length (methodParameters m') == length es && ((== m) . methodName $ m'))
(concat . Map.elems . cchMethods $ prog) &&
all (checkExpressionScope prog env) es | 278 | checkExpressionScope prog env (MethodCall Nothing e m es) =
checkExpressionScope prog env e &&
any (\m' -> length (methodParameters m') == length es && ((== m) . methodName $ m'))
(concat . Map.elems . cchMethods $ prog) &&
all (checkExpressionScope prog env) es | 278 | checkExpressionScope prog env (MethodCall Nothing e m es) =
checkExpressionScope prog env e &&
any (\m' -> length (methodParameters m') == length es && ((== m) . methodName $ m'))
(concat . Map.elems . cchMethods $ prog) &&
all (checkExpressionScope prog env) es | 278 | false | false | 0 | 14 | 58 | 118 | 59 | 59 | null | null |
Noeda/caramia-extras | tests/sanity-check/Main.hs | mit | prop_cover_4buildup :: Rectangle -> Int -> Int -> Property
prop_cover_4buildup (normalize -> rect) x y =
rect^.height > 4 && rect^.width > 4 &&
x > 1 && y > 1 &&
x < (rect^.width - 1) && y < (rect^.height - 1) ==>
all (\rects ->
fullCover rect (addManyToCover rects mempty) &&
all (not . fullCover rect) rects &&
not (fullCover rect (addManyToCover (tail rects) mempty)))
(permutations baseRects)
where
baseRects =
[ -- top-left
ltrb (rect^.left) (rect^.top) (rect^.right-x) (rect^.bottom-y)
-- top-right
, ltrb (rect^.right-x+1) (rect^.top) (rect^.right) (rect^.bottom-y)
-- bottom-left
, ltrb (rect^.left) (rect^.bottom-y+1) (rect^.right-x) (rect^.bottom)
-- bottom-right
, ltrb (rect^.right-x+1) (rect^.bottom-y+1) (rect^.right) (rect^.bottom) ] | 887 | prop_cover_4buildup :: Rectangle -> Int -> Int -> Property
prop_cover_4buildup (normalize -> rect) x y =
rect^.height > 4 && rect^.width > 4 &&
x > 1 && y > 1 &&
x < (rect^.width - 1) && y < (rect^.height - 1) ==>
all (\rects ->
fullCover rect (addManyToCover rects mempty) &&
all (not . fullCover rect) rects &&
not (fullCover rect (addManyToCover (tail rects) mempty)))
(permutations baseRects)
where
baseRects =
[ -- top-left
ltrb (rect^.left) (rect^.top) (rect^.right-x) (rect^.bottom-y)
-- top-right
, ltrb (rect^.right-x+1) (rect^.top) (rect^.right) (rect^.bottom-y)
-- bottom-left
, ltrb (rect^.left) (rect^.bottom-y+1) (rect^.right-x) (rect^.bottom)
-- bottom-right
, ltrb (rect^.right-x+1) (rect^.bottom-y+1) (rect^.right) (rect^.bottom) ] | 887 | prop_cover_4buildup (normalize -> rect) x y =
rect^.height > 4 && rect^.width > 4 &&
x > 1 && y > 1 &&
x < (rect^.width - 1) && y < (rect^.height - 1) ==>
all (\rects ->
fullCover rect (addManyToCover rects mempty) &&
all (not . fullCover rect) rects &&
not (fullCover rect (addManyToCover (tail rects) mempty)))
(permutations baseRects)
where
baseRects =
[ -- top-left
ltrb (rect^.left) (rect^.top) (rect^.right-x) (rect^.bottom-y)
-- top-right
, ltrb (rect^.right-x+1) (rect^.top) (rect^.right) (rect^.bottom-y)
-- bottom-left
, ltrb (rect^.left) (rect^.bottom-y+1) (rect^.right-x) (rect^.bottom)
-- bottom-right
, ltrb (rect^.right-x+1) (rect^.bottom-y+1) (rect^.right) (rect^.bottom) ] | 828 | false | true | 0 | 18 | 243 | 415 | 218 | 197 | null | null |
uduki/hsQt | Qtc/Gui/QIntValidator.hs | bsd-2-clause | qIntValidator_delete :: QIntValidator a -> IO ()
qIntValidator_delete x0
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QIntValidator_delete cobj_x0 | 144 | qIntValidator_delete :: QIntValidator a -> IO ()
qIntValidator_delete x0
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QIntValidator_delete cobj_x0 | 144 | qIntValidator_delete x0
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QIntValidator_delete cobj_x0 | 95 | false | true | 0 | 7 | 22 | 41 | 19 | 22 | null | null |
Mathnerd314/atomo | src/Atomo/Environment.hs | bsd-3-clause | matchable p'@(Keyword { mTargets = ts }) = do
ts' <- mapM matchable' ts
return p' { mTargets = ts' } | 108 | matchable p'@(Keyword { mTargets = ts }) = do
ts' <- mapM matchable' ts
return p' { mTargets = ts' } | 108 | matchable p'@(Keyword { mTargets = ts }) = do
ts' <- mapM matchable' ts
return p' { mTargets = ts' } | 108 | false | false | 3 | 10 | 28 | 54 | 25 | 29 | null | null |
spechub/Hets | Static/ApplyChanges.hs | gpl-2.0 | deleteLeftoverChanges :: Monad m => DGraph -> ChangeList -> m DGraph
deleteLeftoverChanges dg chL = let lIds = Map.keys $ changeLinks chL in do
unless (emptyChangeList == chL { changeLinks = Map.empty })
$ fail $ "some changes could not be processed:\n" ++ show chL
foldM (\ dg' ei -> case getDGLinksById ei dg' of
[ledge@(_, _, lkLab)] | not $ isDefEdge $ dgl_type lkLab -> return
$ changeDGH dg' $ DeleteEdge ledge
_ -> fail $ "deleteLeftoverChanges: conflict with edge #" ++ show ei
) dg lIds
{- | move along xgraph structure and make updates or insertions in accordance
with changelist. In addition to the initial entries of the changelist, all
nodes that were subject to ingoing signature changes as well as all links
adjacent to an updated node will also be updated. -} | 802 | deleteLeftoverChanges :: Monad m => DGraph -> ChangeList -> m DGraph
deleteLeftoverChanges dg chL = let lIds = Map.keys $ changeLinks chL in do
unless (emptyChangeList == chL { changeLinks = Map.empty })
$ fail $ "some changes could not be processed:\n" ++ show chL
foldM (\ dg' ei -> case getDGLinksById ei dg' of
[ledge@(_, _, lkLab)] | not $ isDefEdge $ dgl_type lkLab -> return
$ changeDGH dg' $ DeleteEdge ledge
_ -> fail $ "deleteLeftoverChanges: conflict with edge #" ++ show ei
) dg lIds
{- | move along xgraph structure and make updates or insertions in accordance
with changelist. In addition to the initial entries of the changelist, all
nodes that were subject to ingoing signature changes as well as all links
adjacent to an updated node will also be updated. -} | 802 | deleteLeftoverChanges dg chL = let lIds = Map.keys $ changeLinks chL in do
unless (emptyChangeList == chL { changeLinks = Map.empty })
$ fail $ "some changes could not be processed:\n" ++ show chL
foldM (\ dg' ei -> case getDGLinksById ei dg' of
[ledge@(_, _, lkLab)] | not $ isDefEdge $ dgl_type lkLab -> return
$ changeDGH dg' $ DeleteEdge ledge
_ -> fail $ "deleteLeftoverChanges: conflict with edge #" ++ show ei
) dg lIds
{- | move along xgraph structure and make updates or insertions in accordance
with changelist. In addition to the initial entries of the changelist, all
nodes that were subject to ingoing signature changes as well as all links
adjacent to an updated node will also be updated. -} | 733 | false | true | 0 | 19 | 162 | 191 | 93 | 98 | null | null |
armoredsoftware/protocol | tpm/mainline/src/TPM/Const.hs | bsd-3-clause | tpm_tag_delegations = (0x001a :: Word16) | 40 | tpm_tag_delegations = (0x001a :: Word16) | 40 | tpm_tag_delegations = (0x001a :: Word16) | 40 | false | false | 0 | 5 | 4 | 12 | 7 | 5 | null | null |
corngood/cabal | cabal-install/Main.hs | bsd-3-clause | filterBuildFlags :: Version -> SavedConfig -> BuildFlags -> BuildFlags
filterBuildFlags version config buildFlags
| version >= Version [1,19,1] [] = buildFlags_latest
-- Cabal < 1.19.1 doesn't support 'build -j'.
| otherwise = buildFlags_pre_1_19_1
where
buildFlags_pre_1_19_1 = buildFlags {
buildNumJobs = NoFlag
}
buildFlags_latest = buildFlags {
-- Take the 'jobs' setting '~/.cabal/config' into account.
buildNumJobs = Flag . Just . determineNumJobs $
(numJobsConfigFlag `mappend` numJobsCmdLineFlag)
}
numJobsConfigFlag = installNumJobs . savedInstallFlags $ config
numJobsCmdLineFlag = buildNumJobs buildFlags | 716 | filterBuildFlags :: Version -> SavedConfig -> BuildFlags -> BuildFlags
filterBuildFlags version config buildFlags
| version >= Version [1,19,1] [] = buildFlags_latest
-- Cabal < 1.19.1 doesn't support 'build -j'.
| otherwise = buildFlags_pre_1_19_1
where
buildFlags_pre_1_19_1 = buildFlags {
buildNumJobs = NoFlag
}
buildFlags_latest = buildFlags {
-- Take the 'jobs' setting '~/.cabal/config' into account.
buildNumJobs = Flag . Just . determineNumJobs $
(numJobsConfigFlag `mappend` numJobsCmdLineFlag)
}
numJobsConfigFlag = installNumJobs . savedInstallFlags $ config
numJobsCmdLineFlag = buildNumJobs buildFlags | 716 | filterBuildFlags version config buildFlags
| version >= Version [1,19,1] [] = buildFlags_latest
-- Cabal < 1.19.1 doesn't support 'build -j'.
| otherwise = buildFlags_pre_1_19_1
where
buildFlags_pre_1_19_1 = buildFlags {
buildNumJobs = NoFlag
}
buildFlags_latest = buildFlags {
-- Take the 'jobs' setting '~/.cabal/config' into account.
buildNumJobs = Flag . Just . determineNumJobs $
(numJobsConfigFlag `mappend` numJobsCmdLineFlag)
}
numJobsConfigFlag = installNumJobs . savedInstallFlags $ config
numJobsCmdLineFlag = buildNumJobs buildFlags | 645 | false | true | 1 | 10 | 177 | 136 | 74 | 62 | null | null |
chocoluffy/courseography | hs/Svg/Generator.hs | gpl-3.0 | ellipseToSVG :: Bool -> Shape -> S.Svg
ellipseToSVG styled ellipse =
S.g ! A.id_ (stringValue (shapeId_ ellipse))
! A.class_ "bool" $ do
S.ellipse ! A.cx (stringValue . show . fst $ shapePos ellipse)
! A.cy (stringValue . show . snd $ shapePos ellipse)
! A.rx (stringValue . show $ shapeWidth ellipse / 2)
! A.ry (stringValue . show $ shapeHeight ellipse / 2)
! if styled
then
A.stroke "black" `mappend`
A.fill "none"
else mempty
sequence_ $ map
(textToSVG styled BoolNode (fst $ shapePos ellipse))
(shapeText ellipse)
-- | Converts a text value to SVG. | 814 | ellipseToSVG :: Bool -> Shape -> S.Svg
ellipseToSVG styled ellipse =
S.g ! A.id_ (stringValue (shapeId_ ellipse))
! A.class_ "bool" $ do
S.ellipse ! A.cx (stringValue . show . fst $ shapePos ellipse)
! A.cy (stringValue . show . snd $ shapePos ellipse)
! A.rx (stringValue . show $ shapeWidth ellipse / 2)
! A.ry (stringValue . show $ shapeHeight ellipse / 2)
! if styled
then
A.stroke "black" `mappend`
A.fill "none"
else mempty
sequence_ $ map
(textToSVG styled BoolNode (fst $ shapePos ellipse))
(shapeText ellipse)
-- | Converts a text value to SVG. | 814 | ellipseToSVG styled ellipse =
S.g ! A.id_ (stringValue (shapeId_ ellipse))
! A.class_ "bool" $ do
S.ellipse ! A.cx (stringValue . show . fst $ shapePos ellipse)
! A.cy (stringValue . show . snd $ shapePos ellipse)
! A.rx (stringValue . show $ shapeWidth ellipse / 2)
! A.ry (stringValue . show $ shapeHeight ellipse / 2)
! if styled
then
A.stroke "black" `mappend`
A.fill "none"
else mempty
sequence_ $ map
(textToSVG styled BoolNode (fst $ shapePos ellipse))
(shapeText ellipse)
-- | Converts a text value to SVG. | 775 | false | true | 0 | 17 | 354 | 242 | 118 | 124 | null | null |
authchir/SoSe17-FFP-haskell-http2-server | src/Frame.hs | gpl-3.0 | putType TPriority = Put.putWord8 0x2 | 40 | putType TPriority = Put.putWord8 0x2 | 40 | putType TPriority = Put.putWord8 0x2 | 40 | false | false | 0 | 6 | 8 | 14 | 6 | 8 | null | null |
mrwonko/wonkococo | wcc/Error.hs | mit | toDetailedString :: (Show alphabet) => CompilerError alphabet -> String
toDetailedString (IllegalCharacter (Position line char) str)
= "Illegal character at line " ++ show line ++ " char " ++ show char ++ " in " ++ show str ++ "!" | 234 | toDetailedString :: (Show alphabet) => CompilerError alphabet -> String
toDetailedString (IllegalCharacter (Position line char) str)
= "Illegal character at line " ++ show line ++ " char " ++ show char ++ " in " ++ show str ++ "!" | 234 | toDetailedString (IllegalCharacter (Position line char) str)
= "Illegal character at line " ++ show line ++ " char " ++ show char ++ " in " ++ show str ++ "!" | 162 | false | true | 0 | 11 | 43 | 83 | 39 | 44 | null | null |
bitemyapp/hst | src/HST/Test/Parse.hs | apache-2.0 | alphaFreqList =
[ (26, choose ('a', 'z'))
, (26, choose ('A', 'Z'))
, (1, elements ['_'])
] | 107 | alphaFreqList =
[ (26, choose ('a', 'z'))
, (26, choose ('A', 'Z'))
, (1, elements ['_'])
] | 107 | alphaFreqList =
[ (26, choose ('a', 'z'))
, (26, choose ('A', 'Z'))
, (1, elements ['_'])
] | 107 | false | false | 1 | 9 | 32 | 61 | 34 | 27 | null | null |
eklavya/Idris-dev | src/Idris/Prover.hs | bsd-3-clause | dumpState :: IState -> Bool -> [(Name, Type, Term)] -> ProofState -> Idris ()
dumpState ist inElab menv ps | [] <- holes ps =
do let nm = thname ps
rendered <- iRender $ prettyName True False [] nm <> colon <+> text "No more goals."
iputGoal rendered | 262 | dumpState :: IState -> Bool -> [(Name, Type, Term)] -> ProofState -> Idris ()
dumpState ist inElab menv ps | [] <- holes ps =
do let nm = thname ps
rendered <- iRender $ prettyName True False [] nm <> colon <+> text "No more goals."
iputGoal rendered | 262 | dumpState ist inElab menv ps | [] <- holes ps =
do let nm = thname ps
rendered <- iRender $ prettyName True False [] nm <> colon <+> text "No more goals."
iputGoal rendered | 184 | false | true | 0 | 14 | 60 | 124 | 57 | 67 | null | null |
triplepointfive/cereal | src/Data/Serialize/Get.hs | bsd-3-clause | lookAheadE :: Get (Either a b) -> Get (Either a b)
lookAheadE gea = do
s <- get
ea <- gea
case ea of
Left _ -> put s
_ -> return ()
return ea
-- | Get the next up to @n@ bytes as a ByteString, without consuming them. | 254 | lookAheadE :: Get (Either a b) -> Get (Either a b)
lookAheadE gea = do
s <- get
ea <- gea
case ea of
Left _ -> put s
_ -> return ()
return ea
-- | Get the next up to @n@ bytes as a ByteString, without consuming them. | 254 | lookAheadE gea = do
s <- get
ea <- gea
case ea of
Left _ -> put s
_ -> return ()
return ea
-- | Get the next up to @n@ bytes as a ByteString, without consuming them. | 203 | false | true | 0 | 11 | 87 | 91 | 41 | 50 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/range_2.hs | mit | primCmpInt (Pos x) (Pos y) = primCmpNat x y | 43 | primCmpInt (Pos x) (Pos y) = primCmpNat x y | 43 | primCmpInt (Pos x) (Pos y) = primCmpNat x y | 43 | false | false | 0 | 7 | 8 | 28 | 13 | 15 | null | null |
np/ling | Ling/Equiv.hs | bsd-3-clause | scope :: Getting Defs EqEnv Defs -> a -> Getter EqEnv (Scoped a)
scope l x = to $ \env -> Scoped (env^.egdefs) (env^.l) x | 121 | scope :: Getting Defs EqEnv Defs -> a -> Getter EqEnv (Scoped a)
scope l x = to $ \env -> Scoped (env^.egdefs) (env^.l) x | 121 | scope l x = to $ \env -> Scoped (env^.egdefs) (env^.l) x | 56 | false | true | 2 | 10 | 24 | 78 | 37 | 41 | null | null |
dmwit/sgf | Data/SGF/Parse.hs | bsd-3-clause | -- |
-- Just the properties associated with specific games.
extraProperties :: GameType -> PropertyType -> [String]
extraProperties Go GameInfo = ["HA", "KM"] | 169 | extraProperties :: GameType -> PropertyType -> [String]
extraProperties Go GameInfo = ["HA", "KM"] | 109 | extraProperties Go GameInfo = ["HA", "KM"] | 53 | true | true | 0 | 7 | 33 | 35 | 20 | 15 | null | null |
roberth/uu-helium | test/parser/MinusFullSection.hs | gpl-3.0 | main =
( zipWith (-) [1..10] [2..11]
, zipWith (+) [1..10] [2..11]
) | 75 | main =
( zipWith (-) [1..10] [2..11]
, zipWith (+) [1..10] [2..11]
) | 75 | main =
( zipWith (-) [1..10] [2..11]
, zipWith (+) [1..10] [2..11]
) | 75 | false | false | 1 | 8 | 19 | 54 | 29 | 25 | null | null |
pepincho/Functional-Programming | haskell/ex-5.hs | mit | -- бонус: да приемаме и функцията за разстояние като параметър
maxDistanceBy f pts = maximum [ f p1 p2 | p1<-pts, p2<-pts ] | 123 | maxDistanceBy f pts = maximum [ f p1 p2 | p1<-pts, p2<-pts ] | 60 | maxDistanceBy f pts = maximum [ f p1 p2 | p1<-pts, p2<-pts ] | 60 | true | false | 0 | 8 | 22 | 39 | 19 | 20 | null | null |
fmapfmapfmap/amazonka | amazonka-ml/gen/Network/AWS/MachineLearning/GetBatchPrediction.hs | mpl-2.0 | -- | A link to the file that contains logs of the CreateBatchPrediction
-- operation.
gbprsLogURI :: Lens' GetBatchPredictionResponse (Maybe Text)
gbprsLogURI = lens _gbprsLogURI (\ s a -> s{_gbprsLogURI = a}) | 209 | gbprsLogURI :: Lens' GetBatchPredictionResponse (Maybe Text)
gbprsLogURI = lens _gbprsLogURI (\ s a -> s{_gbprsLogURI = a}) | 123 | gbprsLogURI = lens _gbprsLogURI (\ s a -> s{_gbprsLogURI = a}) | 62 | true | true | 0 | 9 | 31 | 47 | 26 | 21 | null | null |
Lainepress/hledger | hledger-lib/Hledger/Data/Dates.hs | gpl-3.0 | getCurrentYear :: IO Integer
getCurrentYear = do
(y,_,_) <- toGregorian `fmap` getCurrentDay
return y | 105 | getCurrentYear :: IO Integer
getCurrentYear = do
(y,_,_) <- toGregorian `fmap` getCurrentDay
return y | 105 | getCurrentYear = do
(y,_,_) <- toGregorian `fmap` getCurrentDay
return y | 76 | false | true | 0 | 8 | 17 | 42 | 22 | 20 | null | null |
konn/latex-crossref | src/Text/LaTeX/CrossRef.hs | bsd-3-clause | fixArgs :: [TeXArg] -> [LaTeX]
fixArgs = toListOf (folded._FixArg) | 66 | fixArgs :: [TeXArg] -> [LaTeX]
fixArgs = toListOf (folded._FixArg) | 66 | fixArgs = toListOf (folded._FixArg) | 35 | false | true | 0 | 7 | 8 | 29 | 16 | 13 | null | null |
bkoropoff/Idris-dev | src/Idris/Delaborate.hs | bsd-3-clause | showSc i xs = line <> line <> text "In context:" <>
indented (vsep (reverse (showSc' [] xs)))
where showSc' bnd [] = []
showSc' bnd ((n, ty):ctxt) =
let this = bindingOf n False <+> colon <+> pprintTerm' i bnd (delabSugared i ty)
in this : showSc' ((n,False):bnd) ctxt | 322 | showSc i xs = line <> line <> text "In context:" <>
indented (vsep (reverse (showSc' [] xs)))
where showSc' bnd [] = []
showSc' bnd ((n, ty):ctxt) =
let this = bindingOf n False <+> colon <+> pprintTerm' i bnd (delabSugared i ty)
in this : showSc' ((n,False):bnd) ctxt | 322 | showSc i xs = line <> line <> text "In context:" <>
indented (vsep (reverse (showSc' [] xs)))
where showSc' bnd [] = []
showSc' bnd ((n, ty):ctxt) =
let this = bindingOf n False <+> colon <+> pprintTerm' i bnd (delabSugared i ty)
in this : showSc' ((n,False):bnd) ctxt | 322 | false | false | 8 | 12 | 103 | 166 | 75 | 91 | null | null |
meditans/documentator | src/Documentator/TypeAnalysis.hs | gpl-3.0 | components' t = [t] | 36 | components' t = [t] | 36 | components' t = [t] | 36 | false | false | 0 | 5 | 20 | 12 | 6 | 6 | null | null |
ony/hledger | hledger-lib/Hledger/Utils/Parse.hs | gpl-3.0 | nonspace :: TextParser m Char
nonspace = satisfy (not . isSpace) | 64 | nonspace :: TextParser m Char
nonspace = satisfy (not . isSpace) | 64 | nonspace = satisfy (not . isSpace) | 34 | false | true | 1 | 7 | 10 | 29 | 13 | 16 | null | null |
YellPika/effin | src/Control/Effect/List.hs | bsd-3-clause | -- | Nondeterministically chooses a value from a list of computations.
select :: EffectList l => [Effect l a] -> Effect l a
select = join . choose | 148 | select :: EffectList l => [Effect l a] -> Effect l a
select = join . choose | 75 | select = join . choose | 22 | true | true | 0 | 8 | 29 | 40 | 20 | 20 | null | null |
phischu/fragnix | builtins/base/GHC.ForeignPtr.hs | bsd-3-clause | -- | This function is similar to 'mallocForeignPtrAlignedBytes', except that
-- the internally an optimised ForeignPtr representation with no
-- finalizer is used. Attempts to add a finalizer will cause an
-- exception to be thrown.
mallocPlainForeignPtrAlignedBytes :: Int -> Int -> IO (ForeignPtr a)
mallocPlainForeignPtrAlignedBytes size _align | size < 0 =
errorWithoutStackTrace "mallocPlainForeignPtrAlignedBytes: size must be >= 0" | 440 | mallocPlainForeignPtrAlignedBytes :: Int -> Int -> IO (ForeignPtr a)
mallocPlainForeignPtrAlignedBytes size _align | size < 0 =
errorWithoutStackTrace "mallocPlainForeignPtrAlignedBytes: size must be >= 0" | 207 | mallocPlainForeignPtrAlignedBytes size _align | size < 0 =
errorWithoutStackTrace "mallocPlainForeignPtrAlignedBytes: size must be >= 0" | 138 | true | true | 0 | 9 | 61 | 50 | 25 | 25 | null | null |
bj4rtmar/sdl2 | src/SDL/Raw/Haptic.hs | bsd-3-clause | hapticNumAxes :: MonadIO m => Haptic -> m CInt
hapticNumAxes v1 = liftIO $ hapticNumAxes' v1 | 92 | hapticNumAxes :: MonadIO m => Haptic -> m CInt
hapticNumAxes v1 = liftIO $ hapticNumAxes' v1 | 92 | hapticNumAxes v1 = liftIO $ hapticNumAxes' v1 | 45 | false | true | 0 | 7 | 15 | 35 | 16 | 19 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-printers/Language/Drasil/TeX/Print.hs | bsd-2-clause | bibTeXMonth L.May = S "may" | 27 | bibTeXMonth L.May = S "may" | 27 | bibTeXMonth L.May = S "may" | 27 | false | false | 1 | 5 | 4 | 17 | 6 | 11 | null | null |
keera-studios/hsQt | Qtc/Enums/Gui/QFont.hs | bsd-2-clause | eSemiExpanded :: Stretch
eSemiExpanded
= ieStretch $ 112 | 58 | eSemiExpanded :: Stretch
eSemiExpanded
= ieStretch $ 112 | 58 | eSemiExpanded
= ieStretch $ 112 | 33 | false | true | 0 | 6 | 9 | 18 | 8 | 10 | null | null |
codingSteve/fp101x | 20151109/exercise1.hs | cc0-1.0 | {--
-
- Which of the following implementations are valid for a function safetail :: [a] -> [a] that behaves as the library function tail , except that safetail maps the empty list to itself, whereas tail produces an error in this case. Choose all correct implementations!
--}
safetail0 xs = if null xs then [] else tail xs | 326 | safetail0 xs = if null xs then [] else tail xs | 46 | safetail0 xs = if null xs then [] else tail xs | 46 | true | false | 1 | 6 | 62 | 29 | 13 | 16 | null | null |
mariefarrell/Hets | Propositional/Conversions.hs | gpl-2.0 | -- | Mapping of a single Clause
mapClause :: AS.FORMULA
-> Map.Map Id.Token Integer
-> String
mapClause form = unlines . map (++ " 0") . mapClauseAux form | 174 | mapClause :: AS.FORMULA
-> Map.Map Id.Token Integer
-> String
mapClause form = unlines . map (++ " 0") . mapClauseAux form | 142 | mapClause form = unlines . map (++ " 0") . mapClauseAux form | 60 | true | true | 0 | 8 | 47 | 52 | 26 | 26 | null | null |
armoredsoftware/protocol | tpm/mainline/src/TPM/Const.hs | bsd-3-clause | tpm_rt_auth = (0x00000002 :: Word32) | 36 | tpm_rt_auth = (0x00000002 :: Word32) | 36 | tpm_rt_auth = (0x00000002 :: Word32) | 36 | false | false | 0 | 5 | 4 | 12 | 7 | 5 | null | null |
abooij/sudbury | Graphics/Sudbury/CABI/Common.hs | mit | handleWireCArg _ _ f (WireArgBox SUIntWAT n) = f (CArgBox SUIntWAT (fromIntegral n)) | 88 | handleWireCArg _ _ f (WireArgBox SUIntWAT n) = f (CArgBox SUIntWAT (fromIntegral n)) | 88 | handleWireCArg _ _ f (WireArgBox SUIntWAT n) = f (CArgBox SUIntWAT (fromIntegral n)) | 88 | false | false | 0 | 9 | 16 | 40 | 19 | 21 | null | null |
nevrenato/Hets_Fork | HasCASL/InteractiveTests.hs | gpl-2.0 | infoEGS :: ExtGenSig -> Doc
infoEGS (ExtGenSig gs ns) = sepBySemis [infoGS gs, infoNS ns] | 89 | infoEGS :: ExtGenSig -> Doc
infoEGS (ExtGenSig gs ns) = sepBySemis [infoGS gs, infoNS ns] | 89 | infoEGS (ExtGenSig gs ns) = sepBySemis [infoGS gs, infoNS ns] | 61 | false | true | 0 | 7 | 14 | 41 | 20 | 21 | null | null |
jc423/Husky | src/Distance.hs | bsd-3-clause | magnitude xs = sqrt $ sum $ zipWith (\x y -> x `times` y) xs xs | 63 | magnitude xs = sqrt $ sum $ zipWith (\x y -> x `times` y) xs xs | 63 | magnitude xs = sqrt $ sum $ zipWith (\x y -> x `times` y) xs xs | 63 | false | false | 0 | 9 | 15 | 40 | 21 | 19 | null | null |
iblumenfeld/cryptol | src/Cryptol/Symbolic/Prims.hs | bsd-3-clause | replicateV :: Integer -- ^ number of elements
-> TValue -- ^ type of element
-> Value -- ^ element
-> Value
replicateV n (toTypeVal -> TVBit) x = VSeq True (genericReplicate n x) | 215 | replicateV :: Integer -- ^ number of elements
-> TValue -- ^ type of element
-> Value -- ^ element
-> Value
replicateV n (toTypeVal -> TVBit) x = VSeq True (genericReplicate n x) | 215 | replicateV n (toTypeVal -> TVBit) x = VSeq True (genericReplicate n x) | 71 | false | true | 0 | 11 | 70 | 58 | 29 | 29 | null | null |
randen/haddock | haddock-api/src/Haddock/Utils.hs | bsd-2-clause | restrictDecls :: [Name] -> [LSig Name] -> [LSig Name]
restrictDecls names = mapMaybe (filterLSigNames (`elem` names)) | 117 | restrictDecls :: [Name] -> [LSig Name] -> [LSig Name]
restrictDecls names = mapMaybe (filterLSigNames (`elem` names)) | 117 | restrictDecls names = mapMaybe (filterLSigNames (`elem` names)) | 63 | false | true | 0 | 10 | 15 | 57 | 29 | 28 | null | null |
polux/hgom | src/Gom/CodeGen/Common/Helpers.hs | gpl-3.0 | jif = text "if" | 22 | jif = text "if" | 22 | jif = text "if" | 22 | false | false | 0 | 5 | 10 | 9 | 4 | 5 | null | null |
ivan-m/hitchhiker-tree | src/Data/List/Dependent.hs | mit | -- TODO: any
-- TODO: all
-- TODO: sum
-- TODO: product
maximum :: (Ord a) => List (n+1) a -> a
maximum = foldl1 max | 120 | maximum :: (Ord a) => List (n+1) a -> a
maximum = foldl1 max | 60 | maximum = foldl1 max | 20 | true | true | 0 | 10 | 29 | 49 | 25 | 24 | null | null |
KiNaudiz/bachelor | TSSP/Integral.hs | gpl-3.0 | integral :: (RealFloat a,Integral b)
=> Quadratur a -> (a -> a) -> (a,a) -> b -> a
integral quad f (x0,xe) n =
sum $ map (quad f h) l
where h = (xe-x0)/fromIntegral n
l = [ x0 + h*fromIntegral m | m<-[0..n-1]] | 243 | integral :: (RealFloat a,Integral b)
=> Quadratur a -> (a -> a) -> (a,a) -> b -> a
integral quad f (x0,xe) n =
sum $ map (quad f h) l
where h = (xe-x0)/fromIntegral n
l = [ x0 + h*fromIntegral m | m<-[0..n-1]] | 243 | integral quad f (x0,xe) n =
sum $ map (quad f h) l
where h = (xe-x0)/fromIntegral n
l = [ x0 + h*fromIntegral m | m<-[0..n-1]] | 156 | false | true | 5 | 12 | 78 | 160 | 78 | 82 | null | null |
julienschmaltz/madl | src/Parser/MadlTypeChecker.hs | mit | -- | Check if a process of the given name exists
isProcessNameDeclared :: Context -> Text -> Bool
isProcessNameDeclared context name = Hash.member name (contextProcesses context) | 178 | isProcessNameDeclared :: Context -> Text -> Bool
isProcessNameDeclared context name = Hash.member name (contextProcesses context) | 129 | isProcessNameDeclared context name = Hash.member name (contextProcesses context) | 80 | true | true | 0 | 7 | 25 | 38 | 19 | 19 | null | null |
ezyang/ghc | compiler/simplCore/SimplUtils.hs | bsd-3-clause | contHoleType :: SimplCont -> OutType
contHoleType (Stop ty _) = ty | 87 | contHoleType :: SimplCont -> OutType
contHoleType (Stop ty _) = ty | 87 | contHoleType (Stop ty _) = ty | 50 | false | true | 0 | 7 | 31 | 26 | 13 | 13 | null | null |
merijn/lambda-except | Eval.hs | bsd-3-clause | nf :: Expr a -> Expr a
nf expr@Const{} = expr | 45 | nf :: Expr a -> Expr a
nf expr@Const{} = expr | 45 | nf expr@Const{} = expr | 22 | false | true | 0 | 7 | 10 | 31 | 15 | 16 | null | null |
dec9ue/jhc_copygc | src/Support/IniParse.hs | gpl-2.0 | look :: P String
look = gets third | 34 | look :: P String
look = gets third | 34 | look = gets third | 17 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.