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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Raynes/Hricket | src/Game.hs | bsd-3-clause | dartString :: [String] -> (Int, Mark)
dartString (x:y:[]) = (read x :: Int, read y :: Mark) | 91 | dartString :: [String] -> (Int, Mark)
dartString (x:y:[]) = (read x :: Int, read y :: Mark) | 91 | dartString (x:y:[]) = (read x :: Int, read y :: Mark) | 53 | false | true | 0 | 8 | 16 | 62 | 33 | 29 | null | null |
anchor/haskell-netsuite | lib/Netsuite/Types/Fields.hs | bsd-3-clause | -- | Non-Inventory Item > Price3
nsSubtypeFields ("noninventoryitem":"price3":_) = [
"currency",
"discount",
"discountdisplay",
"pricelevel"] | 157 | nsSubtypeFields ("noninventoryitem":"price3":_) = [
"currency",
"discount",
"discountdisplay",
"pricelevel"] | 124 | nsSubtypeFields ("noninventoryitem":"price3":_) = [
"currency",
"discount",
"discountdisplay",
"pricelevel"] | 124 | true | false | 0 | 8 | 29 | 33 | 19 | 14 | null | null |
skogsbaer/roundtrip-xml | src/Text/Roundtrip/Xml/Printer.hs | bsd-3-clause | mkXmlPrinter :: (a -> [PxEvent]) -> XmlPrinter a
mkXmlPrinter f = XmlPrinter $ Printer $ \x -> return (Just (f x)) | 114 | mkXmlPrinter :: (a -> [PxEvent]) -> XmlPrinter a
mkXmlPrinter f = XmlPrinter $ Printer $ \x -> return (Just (f x)) | 114 | mkXmlPrinter f = XmlPrinter $ Printer $ \x -> return (Just (f x)) | 65 | false | true | 0 | 11 | 20 | 63 | 31 | 32 | null | null |
tlaitinen/yesod-datatables | Yesod/DataTables/Request.hs | bsd-2-clause | parseSortDir :: [Column] -> Text -> Text -> Maybe (ColumnName, SortDir)
parseSortDir columns idStr sortDir = do
idNum <- readMaybe (Just idStr)
name <- maybeColumnName idNum
dir <- readSortDir sortDir
return (name, dir)
where
maybeColumnName colId
| colId < 0 = Nothing
| colId >= L.length columns = Nothing
| otherwise = Just $ colName (columns !! colId)
-- | Tries to parse DataTables request | 461 | parseSortDir :: [Column] -> Text -> Text -> Maybe (ColumnName, SortDir)
parseSortDir columns idStr sortDir = do
idNum <- readMaybe (Just idStr)
name <- maybeColumnName idNum
dir <- readSortDir sortDir
return (name, dir)
where
maybeColumnName colId
| colId < 0 = Nothing
| colId >= L.length columns = Nothing
| otherwise = Just $ colName (columns !! colId)
-- | Tries to parse DataTables request | 461 | parseSortDir columns idStr sortDir = do
idNum <- readMaybe (Just idStr)
name <- maybeColumnName idNum
dir <- readSortDir sortDir
return (name, dir)
where
maybeColumnName colId
| colId < 0 = Nothing
| colId >= L.length columns = Nothing
| otherwise = Just $ colName (columns !! colId)
-- | Tries to parse DataTables request | 389 | false | true | 1 | 10 | 131 | 157 | 74 | 83 | null | null |
ezyang/ghc | compiler/deSugar/DsGRHSs.hs | bsd-3-clause | matchGuards (ParStmt {} : _) _ _ _ = panic "matchGuards ParStmt" | 66 | matchGuards (ParStmt {} : _) _ _ _ = panic "matchGuards ParStmt" | 66 | matchGuards (ParStmt {} : _) _ _ _ = panic "matchGuards ParStmt" | 66 | false | false | 0 | 8 | 13 | 29 | 14 | 15 | null | null |
taojang/haskell-programming-book-exercise | src/ch03/chapter3.hs | bsd-3-clause | thirdLetter :: String -> Char
thirdLetter = (!! 3) | 50 | thirdLetter :: String -> Char
thirdLetter = (!! 3) | 50 | thirdLetter = (!! 3) | 20 | false | true | 0 | 5 | 8 | 19 | 11 | 8 | null | null |
brunjlar/protop | src/Protop/Core/Monos.hs | mit | setConst :: IsSetoid x => x -> Functoid Star x
setConst x = Functoid (const x) (const $ reflexivity x) | 103 | setConst :: IsSetoid x => x -> Functoid Star x
setConst x = Functoid (const x) (const $ reflexivity x) | 103 | setConst x = Functoid (const x) (const $ reflexivity x) | 56 | false | true | 0 | 8 | 20 | 57 | 25 | 32 | null | null |
iand675/metrics | src/Data/Metrics/Reservoir/Uniform.hs | mit | -- | Get the current size of the reservoir
size :: UniformReservoir -> Int
size = go
where
go c = min (c ^. count) (I.length $ c ^. innerReservoir)
| 154 | size :: UniformReservoir -> Int
size = go
where
go c = min (c ^. count) (I.length $ c ^. innerReservoir)
| 111 | size = go
where
go c = min (c ^. count) (I.length $ c ^. innerReservoir)
| 79 | true | true | 0 | 9 | 36 | 52 | 27 | 25 | null | null |
gust/feature-creature | feature-creature/backend/src/Repositories.hs | mit | toID :: Int -> Int64
toID = fromIntegral | 40 | toID :: Int -> Int64
toID = fromIntegral | 40 | toID = fromIntegral | 19 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
lexml/lexml-linker | src/main/haskell/LexML/Linker/Regras2.hs | gpl-2.0 | variosNumeros :: SimpleNumeroParser -> [SimpleNumeroParser] -> NumeroParser
variosNumeros primeiro outros = do
(inicio,fim1,n) <- primeiro
nl <- many $ try $ do
hifen
(_,fim,n) <- choice $ map try $ outros
return (fim,n)
let fim2 = case nl of
[] -> fim1
_ -> fst $ last nl
return (inicio,fim2, n : snd (unzip nl))
{-
listaDe :: LinkerParserMonad [a] -> LinkerParserMonad [a]
listaDe m = do
log'' " listaDe: start"
res1 <- m
log'' " listaDe: res1 obtained"
resl <- try (parseSeparator >>= sepBy m) <|> return []
log'' " listaDe: resl obtained. returning."
return $ concat $ res1:resl
-} | 692 | variosNumeros :: SimpleNumeroParser -> [SimpleNumeroParser] -> NumeroParser
variosNumeros primeiro outros = do
(inicio,fim1,n) <- primeiro
nl <- many $ try $ do
hifen
(_,fim,n) <- choice $ map try $ outros
return (fim,n)
let fim2 = case nl of
[] -> fim1
_ -> fst $ last nl
return (inicio,fim2, n : snd (unzip nl))
{-
listaDe :: LinkerParserMonad [a] -> LinkerParserMonad [a]
listaDe m = do
log'' " listaDe: start"
res1 <- m
log'' " listaDe: res1 obtained"
resl <- try (parseSeparator >>= sepBy m) <|> return []
log'' " listaDe: resl obtained. returning."
return $ concat $ res1:resl
-} | 692 | variosNumeros primeiro outros = do
(inicio,fim1,n) <- primeiro
nl <- many $ try $ do
hifen
(_,fim,n) <- choice $ map try $ outros
return (fim,n)
let fim2 = case nl of
[] -> fim1
_ -> fst $ last nl
return (inicio,fim2, n : snd (unzip nl))
{-
listaDe :: LinkerParserMonad [a] -> LinkerParserMonad [a]
listaDe m = do
log'' " listaDe: start"
res1 <- m
log'' " listaDe: res1 obtained"
resl <- try (parseSeparator >>= sepBy m) <|> return []
log'' " listaDe: resl obtained. returning."
return $ concat $ res1:resl
-} | 615 | false | true | 0 | 14 | 207 | 163 | 82 | 81 | null | null |
ice1000/OI-codes | codewars/101-200/count-of-positives-slash-sum-of-negatives.hs | agpl-3.0 | countPositivesSumNegatives :: Maybe [Int] -> [Int]
countPositivesSumNegatives Nothing = [] | 90 | countPositivesSumNegatives :: Maybe [Int] -> [Int]
countPositivesSumNegatives Nothing = [] | 90 | countPositivesSumNegatives Nothing = [] | 39 | false | true | 0 | 7 | 9 | 29 | 15 | 14 | null | null |
RaminHAL9001/rose-trie | src/Data/Tree/RoseTrie.hs | gpl-3.0 | ----------------------------------------------------------------------------------------------------
intersectionWithKeyM
:: (Monad m, Ord p)
=> RunRoseTrie
-> ([p] -> a -> b -> m c)
-> RoseTrie p a -> RoseTrie p b -> m (RoseTrie p c)
intersectionWithKeyM control f =
mergeWithKeyM control
(\k a b -> maybe (return Nothing) (>>= (return . Just)) $ f <$> pure k <*> a <*> b)
(return . const Data.Tree.RoseTrie.empty) (return . const Data.Tree.RoseTrie.empty) | 478 | intersectionWithKeyM
:: (Monad m, Ord p)
=> RunRoseTrie
-> ([p] -> a -> b -> m c)
-> RoseTrie p a -> RoseTrie p b -> m (RoseTrie p c)
intersectionWithKeyM control f =
mergeWithKeyM control
(\k a b -> maybe (return Nothing) (>>= (return . Just)) $ f <$> pure k <*> a <*> b)
(return . const Data.Tree.RoseTrie.empty) (return . const Data.Tree.RoseTrie.empty) | 376 | intersectionWithKeyM control f =
mergeWithKeyM control
(\k a b -> maybe (return Nothing) (>>= (return . Just)) $ f <$> pure k <*> a <*> b)
(return . const Data.Tree.RoseTrie.empty) (return . const Data.Tree.RoseTrie.empty) | 234 | true | true | 0 | 15 | 85 | 184 | 94 | 90 | null | null |
fmthoma/ghc | compiler/nativeGen/AsmCodeGen.hs | bsd-3-clause | cmmExprCon :: DynFlags -> CmmExpr -> CmmExpr
cmmExprCon dflags (CmmLoad addr rep) = CmmLoad (cmmExprCon dflags addr) rep | 120 | cmmExprCon :: DynFlags -> CmmExpr -> CmmExpr
cmmExprCon dflags (CmmLoad addr rep) = CmmLoad (cmmExprCon dflags addr) rep | 120 | cmmExprCon dflags (CmmLoad addr rep) = CmmLoad (cmmExprCon dflags addr) rep | 75 | false | true | 0 | 7 | 17 | 45 | 22 | 23 | null | null |
ice1000/OI-codes | codewars/101-200/tiny-three-pass-compiler-given-up.hs | agpl-3.0 | --
parse :: [Token] -> [Token] -> AST
parse params [TInt i] = Imm i | 68 | parse :: [Token] -> [Token] -> AST
parse params [TInt i] = Imm i | 64 | parse params [TInt i] = Imm i | 29 | true | true | 0 | 10 | 15 | 46 | 22 | 24 | null | null |
fmthoma/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | floatDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "F#") floatDataConKey floatDataCon | 109 | floatDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "F#") floatDataConKey floatDataCon | 109 | floatDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "F#") floatDataConKey floatDataCon | 109 | false | false | 0 | 7 | 15 | 23 | 11 | 12 | null | null |
zerobuzz/hs-webdriver | src/Test/WebDriver/Commands/Wait.hs | bsd-3-clause | -- | 'expect' the given 'Element' to not be stale and returns it
expectNotStale :: WebDriver wd => Element -> wd Element
expectNotStale e = catchFailedCommand StaleElementReference $ do
_ <- isEnabled e -- Any command will force a staleness check
return e
-- | 'expect' an alert to be present on the page, and returns its text. | 336 | expectNotStale :: WebDriver wd => Element -> wd Element
expectNotStale e = catchFailedCommand StaleElementReference $ do
_ <- isEnabled e -- Any command will force a staleness check
return e
-- | 'expect' an alert to be present on the page, and returns its text. | 271 | expectNotStale e = catchFailedCommand StaleElementReference $ do
_ <- isEnabled e -- Any command will force a staleness check
return e
-- | 'expect' an alert to be present on the page, and returns its text. | 215 | true | true | 0 | 9 | 66 | 54 | 25 | 29 | null | null |
SKA-ScienceDataProcessor/RC | MS3/lib/DNA/Logging.hs | apache-2.0 | logConnect :: MonadLog m => Maybe AID -> Maybe AID -> m ()
logConnect aidSrc aidDst = do
attrs <- processAttributes
liftIO $ rawMessage "CONNECT" attrs (render aidSrc ++ " -> " ++ render aidDst) False
where
render = maybe "-" show
----------------------------------------------------------------
-- API for logging
----------------------------------------------------------------
-- | Put message into event log that panic occured. | 447 | logConnect :: MonadLog m => Maybe AID -> Maybe AID -> m ()
logConnect aidSrc aidDst = do
attrs <- processAttributes
liftIO $ rawMessage "CONNECT" attrs (render aidSrc ++ " -> " ++ render aidDst) False
where
render = maybe "-" show
----------------------------------------------------------------
-- API for logging
----------------------------------------------------------------
-- | Put message into event log that panic occured. | 447 | logConnect aidSrc aidDst = do
attrs <- processAttributes
liftIO $ rawMessage "CONNECT" attrs (render aidSrc ++ " -> " ++ render aidDst) False
where
render = maybe "-" show
----------------------------------------------------------------
-- API for logging
----------------------------------------------------------------
-- | Put message into event log that panic occured. | 388 | false | true | 0 | 12 | 73 | 99 | 47 | 52 | null | null |
geraldus/ghcjs-perch-canvas | src/Internal/API.hs | mit | -- | Unwrap 'Coords' to (X, Y) 'Pixels' tuple.
takeCoords :: Coords -> (Pixels, Pixels)
takeCoords (Coords (px, py)) = (px, py) | 127 | takeCoords :: Coords -> (Pixels, Pixels)
takeCoords (Coords (px, py)) = (px, py) | 80 | takeCoords (Coords (px, py)) = (px, py) | 39 | true | true | 0 | 8 | 21 | 43 | 25 | 18 | null | null |
kairne/repa-lts | Data/Rope/Operators/Mapping.hs | bsd-3-clause | ctxLength :: MapCtx a b -> (Int, Int)
ctxLength MCTop = (0, 0) | 62 | ctxLength :: MapCtx a b -> (Int, Int)
ctxLength MCTop = (0, 0) | 62 | ctxLength MCTop = (0, 0) | 24 | false | true | 0 | 6 | 12 | 35 | 19 | 16 | null | null |
rob-b/pivotal | src/Pivotal/Lib.hs | bsd-3-clause | formatSingleProject :: (Integer, T.Text) -> T.Text
formatSingleProject (project_id,project_name) =
sformat ("#" % int % " " % stext) project_id project_name | 158 | formatSingleProject :: (Integer, T.Text) -> T.Text
formatSingleProject (project_id,project_name) =
sformat ("#" % int % " " % stext) project_id project_name | 158 | formatSingleProject (project_id,project_name) =
sformat ("#" % int % " " % stext) project_id project_name | 107 | false | true | 0 | 9 | 21 | 56 | 30 | 26 | null | null |
webcrank/webcrank.hs | test/ParserTests.hs | bsd-3-clause | parserTests :: TestTree
parserTests = testGroup "parser tests"
[ csl1Tests
] | 80 | parserTests :: TestTree
parserTests = testGroup "parser tests"
[ csl1Tests
] | 80 | parserTests = testGroup "parser tests"
[ csl1Tests
] | 56 | false | true | 0 | 5 | 14 | 20 | 10 | 10 | null | null |
bjin/monad-lrs | Test.hs | bsd-3-clause | prop_vector_mul1 :: V.Vector Rational -> Bool
prop_vector_mul1 a = (a *> 1) == a && (1 <* a) == a | 97 | prop_vector_mul1 :: V.Vector Rational -> Bool
prop_vector_mul1 a = (a *> 1) == a && (1 <* a) == a | 97 | prop_vector_mul1 a = (a *> 1) == a && (1 <* a) == a | 51 | false | true | 0 | 9 | 19 | 49 | 25 | 24 | null | null |
tismith/tlisp | write-yourself-a-scheme/listings/listing7.hs | mit | symbol :: Parser Char
symbol = oneOf "!$%&|*+-/:<=>?@^_~#" | 58 | symbol :: Parser Char
symbol = oneOf "!$%&|*+-/:<=>?@^_~#" | 58 | symbol = oneOf "!$%&|*+-/:<=>?@^_~#" | 36 | false | true | 1 | 5 | 7 | 20 | 8 | 12 | null | null |
dysinger/amazonka | amazonka-cloudwatch-logs/gen/Network/AWS/CloudWatchLogs/Types.hs | mpl-2.0 | -- | 'LogGroup' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'lgArn' @::@ 'Maybe' 'Text'
--
-- * 'lgCreationTime' @::@ 'Maybe' 'Natural'
--
-- * 'lgLogGroupName' @::@ 'Maybe' 'Text'
--
-- * 'lgMetricFilterCount' @::@ 'Maybe' 'Int'
--
-- * 'lgRetentionInDays' @::@ 'Maybe' 'Int'
--
-- * 'lgStoredBytes' @::@ 'Maybe' 'Natural'
--
logGroup :: LogGroup
logGroup = LogGroup
{ _lgLogGroupName = Nothing
, _lgCreationTime = Nothing
, _lgRetentionInDays = Nothing
, _lgMetricFilterCount = Nothing
, _lgArn = Nothing
, _lgStoredBytes = Nothing
} | 634 | logGroup :: LogGroup
logGroup = LogGroup
{ _lgLogGroupName = Nothing
, _lgCreationTime = Nothing
, _lgRetentionInDays = Nothing
, _lgMetricFilterCount = Nothing
, _lgArn = Nothing
, _lgStoredBytes = Nothing
} | 268 | logGroup = LogGroup
{ _lgLogGroupName = Nothing
, _lgCreationTime = Nothing
, _lgRetentionInDays = Nothing
, _lgMetricFilterCount = Nothing
, _lgArn = Nothing
, _lgStoredBytes = Nothing
} | 247 | true | true | 0 | 6 | 146 | 65 | 47 | 18 | null | null |
Philonous/pontarius-xmpp | source/Network/Xmpp/Lens.hs | bsd-3-clause | subjectLangL :: Lens MessageSubject (Maybe LangTag)
subjectLangL inj m@MessageSubject{subjectLang = bc} =
(\bc' -> m{subjectLang = bc'}) <$> inj bc | 151 | subjectLangL :: Lens MessageSubject (Maybe LangTag)
subjectLangL inj m@MessageSubject{subjectLang = bc} =
(\bc' -> m{subjectLang = bc'}) <$> inj bc | 151 | subjectLangL inj m@MessageSubject{subjectLang = bc} =
(\bc' -> m{subjectLang = bc'}) <$> inj bc | 99 | false | true | 0 | 9 | 23 | 62 | 33 | 29 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2018/M05/D04/Solution.hs | mit | i' day (Just d) = localDay (zonedTimeToLocalTime d) >= day | 58 | i' day (Just d) = localDay (zonedTimeToLocalTime d) >= day | 58 | i' day (Just d) = localDay (zonedTimeToLocalTime d) >= day | 58 | false | false | 0 | 8 | 9 | 30 | 14 | 16 | null | null |
green-haskell/ghc | compiler/hsSyn/HsTypes.hs | bsd-3-clause | hsLTyVarNames :: LHsTyVarBndrs name -> [name]
-- Type variables only
hsLTyVarNames qtvs = map hsLTyVarName (hsQTvBndrs qtvs) | 124 | hsLTyVarNames :: LHsTyVarBndrs name -> [name]
hsLTyVarNames qtvs = map hsLTyVarName (hsQTvBndrs qtvs) | 101 | hsLTyVarNames qtvs = map hsLTyVarName (hsQTvBndrs qtvs) | 55 | true | true | 0 | 7 | 16 | 36 | 18 | 18 | null | null |
prb/perpubplat | src/Blog/FrontEnd/ContentAtoms.hs | bsd-3-clause | heading :: Html
heading = divid "header" ( (h1 $ _at (V.url $ V.All Nothing) C.blog_title)
+++
(h2 $ stringToHtml C.blog_tagline) ) | 185 | heading :: Html
heading = divid "header" ( (h1 $ _at (V.url $ V.All Nothing) C.blog_title)
+++
(h2 $ stringToHtml C.blog_tagline) ) | 185 | heading = divid "header" ( (h1 $ _at (V.url $ V.All Nothing) C.blog_title)
+++
(h2 $ stringToHtml C.blog_tagline) ) | 169 | false | true | 0 | 14 | 75 | 63 | 32 | 31 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/IDBObjectStore.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore.getAll Mozilla IDBObjectStore.getAll documentation>
getAll_ ::
(MonadDOM m, ToJSVal key) =>
IDBObjectStore -> key -> Maybe Word -> m ()
getAll_ self key count
= liftDOM
(void (self ^. jsf "getAll" [toJSVal key, toJSVal count])) | 324 | getAll_ ::
(MonadDOM m, ToJSVal key) =>
IDBObjectStore -> key -> Maybe Word -> m ()
getAll_ self key count
= liftDOM
(void (self ^. jsf "getAll" [toJSVal key, toJSVal count])) | 201 | getAll_ self key count
= liftDOM
(void (self ^. jsf "getAll" [toJSVal key, toJSVal count])) | 99 | true | true | 0 | 12 | 63 | 87 | 43 | 44 | null | null |
xmonad/xmonad-contrib | XMonad/Util/Dmenu.hs | bsd-3-clause | -- | Like 'menu' but also takes a list of command line arguments.
menuArgs :: MonadIO m => String -> [String] -> [String] -> m String
menuArgs menuCmd args opts = filter (/='\n') <$>
runProcessWithInput menuCmd args (unlines opts) | 232 | menuArgs :: MonadIO m => String -> [String] -> [String] -> m String
menuArgs menuCmd args opts = filter (/='\n') <$>
runProcessWithInput menuCmd args (unlines opts) | 166 | menuArgs menuCmd args opts = filter (/='\n') <$>
runProcessWithInput menuCmd args (unlines opts) | 98 | true | true | 2 | 10 | 40 | 79 | 37 | 42 | null | null |
sgillespie/ghc | compiler/ghci/GHCi.hs | bsd-3-clause | removeLibrarySearchPath :: HscEnv -> Ptr () -> IO Bool
removeLibrarySearchPath hsc_env p =
iservCmd hsc_env (RemoveLibrarySearchPath (toRemotePtr p)) | 151 | removeLibrarySearchPath :: HscEnv -> Ptr () -> IO Bool
removeLibrarySearchPath hsc_env p =
iservCmd hsc_env (RemoveLibrarySearchPath (toRemotePtr p)) | 151 | removeLibrarySearchPath hsc_env p =
iservCmd hsc_env (RemoveLibrarySearchPath (toRemotePtr p)) | 96 | false | true | 0 | 9 | 19 | 49 | 23 | 26 | null | null |
kelecorix/api-hasoffers | src/HasOffers/API/Affiliate/AdManager.hs | bsd-3-clause | findAllCreatives params =
Call "Affiliate_AdManager"
"findAllCreatives"
"GET"
[ Param "filters" False $ getParam params 0
] | 158 | findAllCreatives params =
Call "Affiliate_AdManager"
"findAllCreatives"
"GET"
[ Param "filters" False $ getParam params 0
] | 158 | findAllCreatives params =
Call "Affiliate_AdManager"
"findAllCreatives"
"GET"
[ Param "filters" False $ getParam params 0
] | 158 | false | false | 0 | 8 | 50 | 35 | 16 | 19 | null | null |
bach741974/ftphse | src/Network/FTPE/Internal/FClient.hs | bsd-3-clause | kdir :: FConn
-> String -> IO (Maybe String, FTPResult)
mkdir = s'' N.mkdir
| 92 | mkdir :: FConn
-> String -> IO (Maybe String, FTPResult)
mkdir = s'' N.mkdir | 91 | mkdir = s'' N.mkdir | 19 | false | true | 0 | 10 | 30 | 42 | 19 | 23 | null | null |
sdiehl/ghc | compiler/main/UnitInfo.hs | bsd-3-clause | pprUnitInfo :: UnitInfo -> SDoc
pprUnitInfo InstalledPackageInfo {..} =
vcat [
field "name" (ppr packageName),
field "version" (text (showVersion packageVersion)),
field "id" (ppr unitId),
field "exposed" (ppr exposed),
field "exposed-modules" (ppr exposedModules),
field "hidden-modules" (fsep (map ppr hiddenModules)),
field "trusted" (ppr trusted),
field "import-dirs" (fsep (map text importDirs)),
field "library-dirs" (fsep (map text libraryDirs)),
field "dynamic-library-dirs" (fsep (map text libraryDynDirs)),
field "hs-libraries" (fsep (map text hsLibraries)),
field "extra-libraries" (fsep (map text extraLibraries)),
field "extra-ghci-libraries" (fsep (map text extraGHCiLibraries)),
field "include-dirs" (fsep (map text includeDirs)),
field "includes" (fsep (map text includes)),
field "depends" (fsep (map ppr depends)),
field "cc-options" (fsep (map text ccOptions)),
field "ld-options" (fsep (map text ldOptions)),
field "framework-dirs" (fsep (map text frameworkDirs)),
field "frameworks" (fsep (map text frameworks)),
field "haddock-interfaces" (fsep (map text haddockInterfaces)),
field "haddock-html" (fsep (map text haddockHTMLs))
]
where
field name body = text name <> colon <+> nest 4 body
-- -----------------------------------------------------------------------------
-- UnitId (package names, versions and dep hash)
-- $package_naming
-- #package_naming#
-- Mostly the compiler deals in terms of 'UnitId's, which are md5 hashes
-- of a package ID, keys of its dependencies, and Cabal flags. You're expected
-- to pass in the unit id in the @-this-unit-id@ flag. However, for
-- wired-in packages like @base@ & @rts@, we don't necessarily know what the
-- version is, so these are handled specially; see #wired_in_packages#.
-- | Get the GHC 'UnitId' right out of a Cabalish 'UnitInfo' | 2,152 | pprUnitInfo :: UnitInfo -> SDoc
pprUnitInfo InstalledPackageInfo {..} =
vcat [
field "name" (ppr packageName),
field "version" (text (showVersion packageVersion)),
field "id" (ppr unitId),
field "exposed" (ppr exposed),
field "exposed-modules" (ppr exposedModules),
field "hidden-modules" (fsep (map ppr hiddenModules)),
field "trusted" (ppr trusted),
field "import-dirs" (fsep (map text importDirs)),
field "library-dirs" (fsep (map text libraryDirs)),
field "dynamic-library-dirs" (fsep (map text libraryDynDirs)),
field "hs-libraries" (fsep (map text hsLibraries)),
field "extra-libraries" (fsep (map text extraLibraries)),
field "extra-ghci-libraries" (fsep (map text extraGHCiLibraries)),
field "include-dirs" (fsep (map text includeDirs)),
field "includes" (fsep (map text includes)),
field "depends" (fsep (map ppr depends)),
field "cc-options" (fsep (map text ccOptions)),
field "ld-options" (fsep (map text ldOptions)),
field "framework-dirs" (fsep (map text frameworkDirs)),
field "frameworks" (fsep (map text frameworks)),
field "haddock-interfaces" (fsep (map text haddockInterfaces)),
field "haddock-html" (fsep (map text haddockHTMLs))
]
where
field name body = text name <> colon <+> nest 4 body
-- -----------------------------------------------------------------------------
-- UnitId (package names, versions and dep hash)
-- $package_naming
-- #package_naming#
-- Mostly the compiler deals in terms of 'UnitId's, which are md5 hashes
-- of a package ID, keys of its dependencies, and Cabal flags. You're expected
-- to pass in the unit id in the @-this-unit-id@ flag. However, for
-- wired-in packages like @base@ & @rts@, we don't necessarily know what the
-- version is, so these are handled specially; see #wired_in_packages#.
-- | Get the GHC 'UnitId' right out of a Cabalish 'UnitInfo' | 2,152 | pprUnitInfo InstalledPackageInfo {..} =
vcat [
field "name" (ppr packageName),
field "version" (text (showVersion packageVersion)),
field "id" (ppr unitId),
field "exposed" (ppr exposed),
field "exposed-modules" (ppr exposedModules),
field "hidden-modules" (fsep (map ppr hiddenModules)),
field "trusted" (ppr trusted),
field "import-dirs" (fsep (map text importDirs)),
field "library-dirs" (fsep (map text libraryDirs)),
field "dynamic-library-dirs" (fsep (map text libraryDynDirs)),
field "hs-libraries" (fsep (map text hsLibraries)),
field "extra-libraries" (fsep (map text extraLibraries)),
field "extra-ghci-libraries" (fsep (map text extraGHCiLibraries)),
field "include-dirs" (fsep (map text includeDirs)),
field "includes" (fsep (map text includes)),
field "depends" (fsep (map ppr depends)),
field "cc-options" (fsep (map text ccOptions)),
field "ld-options" (fsep (map text ldOptions)),
field "framework-dirs" (fsep (map text frameworkDirs)),
field "frameworks" (fsep (map text frameworks)),
field "haddock-interfaces" (fsep (map text haddockInterfaces)),
field "haddock-html" (fsep (map text haddockHTMLs))
]
where
field name body = text name <> colon <+> nest 4 body
-- -----------------------------------------------------------------------------
-- UnitId (package names, versions and dep hash)
-- $package_naming
-- #package_naming#
-- Mostly the compiler deals in terms of 'UnitId's, which are md5 hashes
-- of a package ID, keys of its dependencies, and Cabal flags. You're expected
-- to pass in the unit id in the @-this-unit-id@ flag. However, for
-- wired-in packages like @base@ & @rts@, we don't necessarily know what the
-- version is, so these are handled specially; see #wired_in_packages#.
-- | Get the GHC 'UnitId' right out of a Cabalish 'UnitInfo' | 2,120 | false | true | 0 | 11 | 577 | 507 | 257 | 250 | null | null |
olsner/ghc | libraries/template-haskell/Language/Haskell/TH/Lib.hs | bsd-3-clause | bang :: SourceUnpackednessQ -> SourceStrictnessQ -> BangQ
bang u s = do u' <- u
s' <- s
return (Bang u' s') | 135 | bang :: SourceUnpackednessQ -> SourceStrictnessQ -> BangQ
bang u s = do u' <- u
s' <- s
return (Bang u' s') | 135 | bang u s = do u' <- u
s' <- s
return (Bang u' s') | 77 | false | true | 0 | 9 | 49 | 52 | 24 | 28 | null | null |
dgvncsz0f/nettty | src/Nettty/Connect.hs | gpl-3.0 | iothread :: Connections -> IO ()
iothread c = superviseSentinel (fmap not (hIsEOF stdin)) $ do
mchunk <- fmap load B.getLine
when (isJust mchunk) (exec c (fromJust mchunk)) | 176 | iothread :: Connections -> IO ()
iothread c = superviseSentinel (fmap not (hIsEOF stdin)) $ do
mchunk <- fmap load B.getLine
when (isJust mchunk) (exec c (fromJust mchunk)) | 176 | iothread c = superviseSentinel (fmap not (hIsEOF stdin)) $ do
mchunk <- fmap load B.getLine
when (isJust mchunk) (exec c (fromJust mchunk)) | 143 | false | true | 0 | 12 | 31 | 86 | 40 | 46 | null | null |
ezyang/ghc | compiler/types/Coercion.hs | bsd-3-clause | -- If co :: (forall a1:k1. t1) ~ (forall a2:k2. t2)
-- then (nth 0 co :: k1 ~ k2)
mkNthCo n co@(FunCo _ arg res)
-- See Note [Function coercions]
-- If FunCo _ arg_co res_co :: (s1:TYPE sk1 -> s2:TYPE sk2)
-- ~ (t1:TYPE tk1 -> t2:TYPE tk2)
-- Then we want to behave as if co was
-- TyConAppCo argk_co resk_co arg_co res_co
-- where
-- argk_co :: sk1 ~ tk1 = mkNthCo 0 (mkKindCo arg_co)
-- resk_co :: sk2 ~ tk2 = mkNthCo 0 (mkKindCo res_co)
-- i.e. mkRuntimeRepCo
= case n of
0 -> mkRuntimeRepCo arg
1 -> mkRuntimeRepCo res
2 -> arg
3 -> res
_ -> pprPanic "mkNthCo(FunCo)" (ppr n $$ ppr co) | 713 | mkNthCo n co@(FunCo _ arg res)
-- See Note [Function coercions]
-- If FunCo _ arg_co res_co :: (s1:TYPE sk1 -> s2:TYPE sk2)
-- ~ (t1:TYPE tk1 -> t2:TYPE tk2)
-- Then we want to behave as if co was
-- TyConAppCo argk_co resk_co arg_co res_co
-- where
-- argk_co :: sk1 ~ tk1 = mkNthCo 0 (mkKindCo arg_co)
-- resk_co :: sk2 ~ tk2 = mkNthCo 0 (mkKindCo res_co)
-- i.e. mkRuntimeRepCo
= case n of
0 -> mkRuntimeRepCo arg
1 -> mkRuntimeRepCo res
2 -> arg
3 -> res
_ -> pprPanic "mkNthCo(FunCo)" (ppr n $$ ppr co) | 628 | mkNthCo n co@(FunCo _ arg res)
-- See Note [Function coercions]
-- If FunCo _ arg_co res_co :: (s1:TYPE sk1 -> s2:TYPE sk2)
-- ~ (t1:TYPE tk1 -> t2:TYPE tk2)
-- Then we want to behave as if co was
-- TyConAppCo argk_co resk_co arg_co res_co
-- where
-- argk_co :: sk1 ~ tk1 = mkNthCo 0 (mkKindCo arg_co)
-- resk_co :: sk2 ~ tk2 = mkNthCo 0 (mkKindCo res_co)
-- i.e. mkRuntimeRepCo
= case n of
0 -> mkRuntimeRepCo arg
1 -> mkRuntimeRepCo res
2 -> arg
3 -> res
_ -> pprPanic "mkNthCo(FunCo)" (ppr n $$ ppr co) | 628 | true | false | 0 | 11 | 243 | 93 | 50 | 43 | null | null |
lukemaurer/sequent-core | src/Language/SequentCore/FloatOut/SetLevels.hs | bsd-3-clause | destLevel :: LevelEnv -> Summary
-> Bool -- True <=> is bottom
-> Level
destLevel env summ is_bot
| is_bot = tOP_LEVEL -- Send bottoming bindings to the top
-- regardless; see Note [Bottoming floats]
| otherwise = maxFvLevel isId env summ | 289 | destLevel :: LevelEnv -> Summary
-> Bool -- True <=> is bottom
-> Level
destLevel env summ is_bot
| is_bot = tOP_LEVEL -- Send bottoming bindings to the top
-- regardless; see Note [Bottoming floats]
| otherwise = maxFvLevel isId env summ | 289 | destLevel env summ is_bot
| is_bot = tOP_LEVEL -- Send bottoming bindings to the top
-- regardless; see Note [Bottoming floats]
| otherwise = maxFvLevel isId env summ | 195 | false | true | 0 | 9 | 92 | 62 | 29 | 33 | null | null |
monky-hs/monky | Monky/Template.hs | lgpl-3.0 | mkGetHandle :: Name -> String -> Q Stmt
mkGetHandle h libname =
BindS (VarP h) <$> [| dlopen libname [RTLD_LAZY] |] | 117 | mkGetHandle :: Name -> String -> Q Stmt
mkGetHandle h libname =
BindS (VarP h) <$> [| dlopen libname [RTLD_LAZY] |] | 117 | mkGetHandle h libname =
BindS (VarP h) <$> [| dlopen libname [RTLD_LAZY] |] | 77 | false | true | 1 | 8 | 22 | 48 | 23 | 25 | null | null |
alanz/Blobs | src/Graphics/Blobs/Colors.hs | lgpl-2.1 | indigo = RGB 75 0 130 | 21 | indigo = RGB 75 0 130 | 21 | indigo = RGB 75 0 130 | 21 | false | false | 1 | 5 | 5 | 19 | 6 | 13 | null | null |
Numberartificial/workflow | haskell-first-principles/haskell-programming-from-first-principles-master/src/ReaderPractice.hs | mit | lookup e ((k, v) : kvs) | e == k = Just v
| otherwise = lookup e kvs | 95 | lookup e ((k, v) : kvs) | e == k = Just v
| otherwise = lookup e kvs | 95 | lookup e ((k, v) : kvs) | e == k = Just v
| otherwise = lookup e kvs | 95 | false | false | 1 | 8 | 45 | 51 | 24 | 27 | null | null |
spacekitteh/smcghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitSetCards :: CmmExpr -> CmmExpr -> WordOff -> FCode ()
emitSetCards dst_start dst_cards_start n = do
dflags <- getDynFlags
start_card <- assignTempE $ cardCmm dflags dst_start
let end_card = cardCmm dflags
(cmmSubWord dflags
(cmmAddWord dflags dst_start (mkIntExpr dflags n))
(mkIntExpr dflags 1))
emitMemsetCall (cmmAddWord dflags dst_cards_start start_card)
(mkIntExpr dflags 1)
(cmmAddWord dflags (cmmSubWord dflags end_card start_card) (mkIntExpr dflags 1))
(mkIntExpr dflags 1) -- no alignment (1 byte)
-- Convert an element index to a card index | 654 | emitSetCards :: CmmExpr -> CmmExpr -> WordOff -> FCode ()
emitSetCards dst_start dst_cards_start n = do
dflags <- getDynFlags
start_card <- assignTempE $ cardCmm dflags dst_start
let end_card = cardCmm dflags
(cmmSubWord dflags
(cmmAddWord dflags dst_start (mkIntExpr dflags n))
(mkIntExpr dflags 1))
emitMemsetCall (cmmAddWord dflags dst_cards_start start_card)
(mkIntExpr dflags 1)
(cmmAddWord dflags (cmmSubWord dflags end_card start_card) (mkIntExpr dflags 1))
(mkIntExpr dflags 1) -- no alignment (1 byte)
-- Convert an element index to a card index | 654 | emitSetCards dst_start dst_cards_start n = do
dflags <- getDynFlags
start_card <- assignTempE $ cardCmm dflags dst_start
let end_card = cardCmm dflags
(cmmSubWord dflags
(cmmAddWord dflags dst_start (mkIntExpr dflags n))
(mkIntExpr dflags 1))
emitMemsetCall (cmmAddWord dflags dst_cards_start start_card)
(mkIntExpr dflags 1)
(cmmAddWord dflags (cmmSubWord dflags end_card start_card) (mkIntExpr dflags 1))
(mkIntExpr dflags 1) -- no alignment (1 byte)
-- Convert an element index to a card index | 596 | false | true | 0 | 17 | 175 | 181 | 86 | 95 | null | null |
MaxGabriel/yesod | yesod-form/Yesod/Form/Fields.hs | mit | -- | Creates an input with @type="search"@. For <http://caniuse.com/#search=autofocus browsers without autofocus support>, a JS fallback is used if @AutoFocus@ is true.
searchField :: Monad m => RenderMessage (HandlerSite m) FormMessage => AutoFocus -> Field m Text
searchField autoFocus = Field
{ fieldParse = parseHelper Right
, fieldView = \theId name attrs val isReq -> do
[whamlet|
$newline never
<input id="#{theId}" name="#{name}" *{attrs} type="search" :isReq:required="" :autoFocus:autofocus="" value="#{either id id val}">
|]
when autoFocus $ do
-- we want this javascript to be placed immediately after the field
[whamlet|
$newline never
<script>if (!('autofocus' in document.createElement('input'))) {document.getElementById('#{theId}').focus();}
|]
toWidget [cassius|
##{theId}
-webkit-appearance: textfield
|]
, fieldEnctype = UrlEncoded
} | 953 | searchField :: Monad m => RenderMessage (HandlerSite m) FormMessage => AutoFocus -> Field m Text
searchField autoFocus = Field
{ fieldParse = parseHelper Right
, fieldView = \theId name attrs val isReq -> do
[whamlet|
$newline never
<input id="#{theId}" name="#{name}" *{attrs} type="search" :isReq:required="" :autoFocus:autofocus="" value="#{either id id val}">
|]
when autoFocus $ do
-- we want this javascript to be placed immediately after the field
[whamlet|
$newline never
<script>if (!('autofocus' in document.createElement('input'))) {document.getElementById('#{theId}').focus();}
|]
toWidget [cassius|
##{theId}
-webkit-appearance: textfield
|]
, fieldEnctype = UrlEncoded
} | 784 | searchField autoFocus = Field
{ fieldParse = parseHelper Right
, fieldView = \theId name attrs val isReq -> do
[whamlet|
$newline never
<input id="#{theId}" name="#{name}" *{attrs} type="search" :isReq:required="" :autoFocus:autofocus="" value="#{either id id val}">
|]
when autoFocus $ do
-- we want this javascript to be placed immediately after the field
[whamlet|
$newline never
<script>if (!('autofocus' in document.createElement('input'))) {document.getElementById('#{theId}').focus();}
|]
toWidget [cassius|
##{theId}
-webkit-appearance: textfield
|]
, fieldEnctype = UrlEncoded
} | 687 | true | true | 0 | 13 | 206 | 117 | 64 | 53 | null | null |
myuon/typed | tapl/test/Typed/SimplyTest.hs | mit | test_eval =
[ testCase "(λx:bool. x) true" $ rights [eval (SimplyTerm $ Tabs "x" Kbool (Tvar "x") `Tapp` Ttrue)] @?= [SimplyTerm Ttrue]
, testCase "λx:bool. true" $ rights [eval (SimplyTerm $ Tabs "x" Kbool Ttrue)] @?= [SimplyTerm $ Tabs "x" Kbool Ttrue]
] | 262 | test_eval =
[ testCase "(λx:bool. x) true" $ rights [eval (SimplyTerm $ Tabs "x" Kbool (Tvar "x") `Tapp` Ttrue)] @?= [SimplyTerm Ttrue]
, testCase "λx:bool. true" $ rights [eval (SimplyTerm $ Tabs "x" Kbool Ttrue)] @?= [SimplyTerm $ Tabs "x" Kbool Ttrue]
] | 262 | test_eval =
[ testCase "(λx:bool. x) true" $ rights [eval (SimplyTerm $ Tabs "x" Kbool (Tvar "x") `Tapp` Ttrue)] @?= [SimplyTerm Ttrue]
, testCase "λx:bool. true" $ rights [eval (SimplyTerm $ Tabs "x" Kbool Ttrue)] @?= [SimplyTerm $ Tabs "x" Kbool Ttrue]
] | 262 | false | false | 1 | 17 | 48 | 116 | 56 | 60 | null | null |
urbanslug/ghc | testsuite/tests/module/mod94.hs | bsd-3-clause | y = 'a' /= 'b' | 14 | y = 'a' /= 'b' | 14 | y = 'a' /= 'b' | 14 | false | false | 3 | 5 | 4 | 16 | 6 | 10 | null | null |
serokell/importify | test/test-data/haskell-names@records/02-ImportBothUsedUnqualified.hs | mit | main = symbolName | 17 | main = symbolName | 17 | main = symbolName | 17 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
UCSD-PL/RefScript | src/Language/Rsc/SSA/SSA.hs | bsd-3-clause | ssaExpr g (NewExpr l e es) = do
(g1, s, e') <- ssaExpr g e
(gs, ss, es') <- ssaExprs g1 es
return (gs, s ++ ss, NewExpr l e' es') | 143 | ssaExpr g (NewExpr l e es) = do
(g1, s, e') <- ssaExpr g e
(gs, ss, es') <- ssaExprs g1 es
return (gs, s ++ ss, NewExpr l e' es') | 143 | ssaExpr g (NewExpr l e es) = do
(g1, s, e') <- ssaExpr g e
(gs, ss, es') <- ssaExprs g1 es
return (gs, s ++ ss, NewExpr l e' es') | 143 | false | false | 0 | 9 | 44 | 89 | 45 | 44 | null | null |
nirvinm/Solving-Exercises-in-Haskell-Programming-From-First-Principles | ParserCombinators/src/Integer.hs | gpl-3.0 | digitToInt _ = 0 | 16 | digitToInt _ = 0 | 16 | digitToInt _ = 0 | 16 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
SaneApp/webmachine | src/Network/Webmachine/DecisionCore.hs | bsd-3-clause | l17 :: (DecisionGraph m r) => Context r m Response
l17 t = do
lm <- lastModified
case lm of
Nothing -> decision notModified304
Just m -> if m > t then m16 else decision notModified304 | 195 | l17 :: (DecisionGraph m r) => Context r m Response
l17 t = do
lm <- lastModified
case lm of
Nothing -> decision notModified304
Just m -> if m > t then m16 else decision notModified304 | 195 | l17 t = do
lm <- lastModified
case lm of
Nothing -> decision notModified304
Just m -> if m > t then m16 else decision notModified304 | 144 | false | true | 0 | 12 | 47 | 83 | 39 | 44 | null | null |
gereeter/bounded-intmap | src/Data/WordMap/Base.hs | mit | -- | /O(n)/. Convert the map to a list of key\/value pairs where the
-- keys are in ascending order. Subject to list fusion.
--
-- > toAscList (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]
toAscList :: WordMap a -> [(Key, a)]
toAscList = foldrWithKey (\k v l -> (k, v) : l) [] | 282 | toAscList :: WordMap a -> [(Key, a)]
toAscList = foldrWithKey (\k v l -> (k, v) : l) [] | 87 | toAscList = foldrWithKey (\k v l -> (k, v) : l) [] | 50 | true | true | 0 | 9 | 52 | 60 | 35 | 25 | null | null |
YellPika/Hannel | src/Control/Concurrent/Transactional/Channel/Swap.hs | mit | -- |Receives a value from the front side of a channel.
receiveFront :: SwapChannel () b -> Event b
receiveFront = flip swapFront () | 131 | receiveFront :: SwapChannel () b -> Event b
receiveFront = flip swapFront () | 76 | receiveFront = flip swapFront () | 32 | true | true | 0 | 7 | 23 | 33 | 16 | 17 | null | null |
hsienchiaolee/stethoscope | src/Web/Parser/EventParser.hs | bsd-3-clause | extractMetricName _ = Nothing | 29 | extractMetricName _ = Nothing | 29 | extractMetricName _ = Nothing | 29 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
JPMoresmau/leksah | src/IDE/Pane/Errors.hs | gpl-2.0 | -- | Add a 'LogRef' at a specific index to the Errors pane
addErrorToList' :: Int -> LogRef -> ErrorsPane -> IDEAction
addErrorToList' unfilteredIndex ref pane = do
liftIO $ debugM "leksah" "addErrorToList'"
visible <- isRefVisible pane ref
updateFilterButtons pane
when visible $ do
refs <- F.toList <$> readIDE errorRefs
index <- length <$> filterM (isRefVisible pane) (take unfilteredIndex refs)
ac <- liftIO $ readIORef (autoClose pane)
let store = errorStore pane
let view = treeView pane
emptyPath <- treePathNewFromIndices' []
forestStoreInsert store emptyPath index (ERLogRef ref)
when (length (T.lines (refDescription ref)) > 1) $ do
p <- treePathNewFromIndices' [fromIntegral index]
forestStoreInsert store p 0 (ERFullMessage (refDescription ref) (Just ref))
treeViewExpandToPath view =<< treePathNewFromIndices' [fromIntegral index,0]
-- | Updates the filter buttons in the Error Pane | 1,015 | addErrorToList' :: Int -> LogRef -> ErrorsPane -> IDEAction
addErrorToList' unfilteredIndex ref pane = do
liftIO $ debugM "leksah" "addErrorToList'"
visible <- isRefVisible pane ref
updateFilterButtons pane
when visible $ do
refs <- F.toList <$> readIDE errorRefs
index <- length <$> filterM (isRefVisible pane) (take unfilteredIndex refs)
ac <- liftIO $ readIORef (autoClose pane)
let store = errorStore pane
let view = treeView pane
emptyPath <- treePathNewFromIndices' []
forestStoreInsert store emptyPath index (ERLogRef ref)
when (length (T.lines (refDescription ref)) > 1) $ do
p <- treePathNewFromIndices' [fromIntegral index]
forestStoreInsert store p 0 (ERFullMessage (refDescription ref) (Just ref))
treeViewExpandToPath view =<< treePathNewFromIndices' [fromIntegral index,0]
-- | Updates the filter buttons in the Error Pane | 956 | addErrorToList' unfilteredIndex ref pane = do
liftIO $ debugM "leksah" "addErrorToList'"
visible <- isRefVisible pane ref
updateFilterButtons pane
when visible $ do
refs <- F.toList <$> readIDE errorRefs
index <- length <$> filterM (isRefVisible pane) (take unfilteredIndex refs)
ac <- liftIO $ readIORef (autoClose pane)
let store = errorStore pane
let view = treeView pane
emptyPath <- treePathNewFromIndices' []
forestStoreInsert store emptyPath index (ERLogRef ref)
when (length (T.lines (refDescription ref)) > 1) $ do
p <- treePathNewFromIndices' [fromIntegral index]
forestStoreInsert store p 0 (ERFullMessage (refDescription ref) (Just ref))
treeViewExpandToPath view =<< treePathNewFromIndices' [fromIntegral index,0]
-- | Updates the filter buttons in the Error Pane | 896 | true | true | 0 | 18 | 245 | 296 | 134 | 162 | null | null |
silver-lang/silver | src/Silver/Compiler/Lexer.hs | bsd-3-clause | comma = symbol "," | 18 | comma = symbol "," | 18 | comma = symbol "," | 18 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
polarina/sdl2 | Graphics/UI/SDL/Video.hs | bsd-3-clause | getDesktopDisplayMode :: MonadIO m => CInt -> Ptr DisplayMode -> m CInt
getDesktopDisplayMode v1 v2 = liftIO $ getDesktopDisplayMode' v1 v2 | 139 | getDesktopDisplayMode :: MonadIO m => CInt -> Ptr DisplayMode -> m CInt
getDesktopDisplayMode v1 v2 = liftIO $ getDesktopDisplayMode' v1 v2 | 139 | getDesktopDisplayMode v1 v2 = liftIO $ getDesktopDisplayMode' v1 v2 | 67 | false | true | 0 | 8 | 20 | 46 | 21 | 25 | null | null |
jgm/aws | Aws/Http.hs | bsd-3-clause | httpMethod Put = "PUT" | 28 | httpMethod Put = "PUT" | 28 | httpMethod Put = "PUT" | 28 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
josecastro/lambda | Test.hs | gpl-2.0 | testPairs =
do
putStrLn ("(a,b) = " ++ (par "a" "b"))
putStrLn ("FIRST (a,b) = (a,b)TRUE = " ++ (par "a" "b") ++ true)
evalStr ((par "a" "b") ++ true)
putStrLn "-----------------------"
putStrLn ("SECOND (a,b) = (a,b)FALSE = " ++ (par "a" "b") ++ false)
evalStr ((par "a" "b") ++ false)
putStrLn "-----------------------"
putStrLn ("PHI = " ++ phi)
putStrLn "PHI (n,k) = (n+1,n)"
putStrLn (" => PHI (3,1) = (4,3)")
putStrLn ("(3,1) = " ++ (par three one))
putStrLn ("(4,3) = " ++ (par four three))
putStrLn ("PHI (3,1) = " ++ phi ++ (par three one))
evalStr (phi ++ (par three one))
putStrLn "-----------------------"
putStrLn "PREV = (Ln.n PHI (0,0) FALSE)"
putStrLn ("PREV = " ++ prev)
putStrLn ("PREV 3 = " ++ prev ++ three)
evalStr (prev ++ three)
putStrLn "-----------------------" | 912 | testPairs =
do
putStrLn ("(a,b) = " ++ (par "a" "b"))
putStrLn ("FIRST (a,b) = (a,b)TRUE = " ++ (par "a" "b") ++ true)
evalStr ((par "a" "b") ++ true)
putStrLn "-----------------------"
putStrLn ("SECOND (a,b) = (a,b)FALSE = " ++ (par "a" "b") ++ false)
evalStr ((par "a" "b") ++ false)
putStrLn "-----------------------"
putStrLn ("PHI = " ++ phi)
putStrLn "PHI (n,k) = (n+1,n)"
putStrLn (" => PHI (3,1) = (4,3)")
putStrLn ("(3,1) = " ++ (par three one))
putStrLn ("(4,3) = " ++ (par four three))
putStrLn ("PHI (3,1) = " ++ phi ++ (par three one))
evalStr (phi ++ (par three one))
putStrLn "-----------------------"
putStrLn "PREV = (Ln.n PHI (0,0) FALSE)"
putStrLn ("PREV = " ++ prev)
putStrLn ("PREV 3 = " ++ prev ++ three)
evalStr (prev ++ three)
putStrLn "-----------------------" | 912 | testPairs =
do
putStrLn ("(a,b) = " ++ (par "a" "b"))
putStrLn ("FIRST (a,b) = (a,b)TRUE = " ++ (par "a" "b") ++ true)
evalStr ((par "a" "b") ++ true)
putStrLn "-----------------------"
putStrLn ("SECOND (a,b) = (a,b)FALSE = " ++ (par "a" "b") ++ false)
evalStr ((par "a" "b") ++ false)
putStrLn "-----------------------"
putStrLn ("PHI = " ++ phi)
putStrLn "PHI (n,k) = (n+1,n)"
putStrLn (" => PHI (3,1) = (4,3)")
putStrLn ("(3,1) = " ++ (par three one))
putStrLn ("(4,3) = " ++ (par four three))
putStrLn ("PHI (3,1) = " ++ phi ++ (par three one))
evalStr (phi ++ (par three one))
putStrLn "-----------------------"
putStrLn "PREV = (Ln.n PHI (0,0) FALSE)"
putStrLn ("PREV = " ++ prev)
putStrLn ("PREV 3 = " ++ prev ++ three)
evalStr (prev ++ three)
putStrLn "-----------------------" | 912 | false | false | 1 | 13 | 259 | 312 | 141 | 171 | null | null |
haskell-compat/base-compat | base-compat/src/Type/Reflection/Compat.hs | mit | -- | Use a 'TypeRep' as 'Typeable' evidence.
withTypeable :: forall (a :: k) (r :: TYPE rep). ()
=> TypeRep a -> (Typeable a => r) -> r
withTypeable rep k = unsafeCoerce k' rep
where k' :: Gift a r
k' = Gift k
-- | A helper to satisfy the type checker in 'withTypeable'. | 294 | withTypeable :: forall (a :: k) (r :: TYPE rep). ()
=> TypeRep a -> (Typeable a => r) -> r
withTypeable rep k = unsafeCoerce k' rep
where k' :: Gift a r
k' = Gift k
-- | A helper to satisfy the type checker in 'withTypeable'. | 249 | withTypeable rep k = unsafeCoerce k' rep
where k' :: Gift a r
k' = Gift k
-- | A helper to satisfy the type checker in 'withTypeable'. | 145 | true | true | 1 | 11 | 80 | 90 | 48 | 42 | null | null |
nobsun/hs-uc | src/Language/SIMPLE/Environment.hs | bsd-3-clause | -- |
-- constructs an environment from the associated a-list.
--
-- >>> putStr $ render $ pprEnv $ fromListEnv [("x",Number 3),("y",Add (Variable "x") (Number 1))]
-- {x <- 3; y <- x + 1}
fromListEnv :: (Ord a) => [(a, f a)] -> Env f a
fromListEnv = M.fromList | 260 | fromListEnv :: (Ord a) => [(a, f a)] -> Env f a
fromListEnv = M.fromList | 72 | fromListEnv = M.fromList | 24 | true | true | 0 | 10 | 49 | 54 | 29 | 25 | null | null |
andir/ganeti | src/Ganeti/HTools/Repair.hs | bsd-2-clause | setInitialState :: Instance.Instance -> Result InstanceData
setInitialState inst =
let arData = mapMaybe parseInitTag $ Instance.allTags inst
-- Group all the AutoRepairData records by id (i.e. by repair task), and
-- present them from oldest to newest.
arData' = sortBy (comparing arUuid) arData
arGroups = groupBy ((==) `on` arUuid) arData'
arGroups' = sortBy (comparing $ minimum . map arTime) arGroups
in
foldM arStatusCmp (InstanceData inst (ArHealthy Nothing) []) arGroups' | 516 | setInitialState :: Instance.Instance -> Result InstanceData
setInitialState inst =
let arData = mapMaybe parseInitTag $ Instance.allTags inst
-- Group all the AutoRepairData records by id (i.e. by repair task), and
-- present them from oldest to newest.
arData' = sortBy (comparing arUuid) arData
arGroups = groupBy ((==) `on` arUuid) arData'
arGroups' = sortBy (comparing $ minimum . map arTime) arGroups
in
foldM arStatusCmp (InstanceData inst (ArHealthy Nothing) []) arGroups' | 516 | setInitialState inst =
let arData = mapMaybe parseInitTag $ Instance.allTags inst
-- Group all the AutoRepairData records by id (i.e. by repair task), and
-- present them from oldest to newest.
arData' = sortBy (comparing arUuid) arData
arGroups = groupBy ((==) `on` arUuid) arData'
arGroups' = sortBy (comparing $ minimum . map arTime) arGroups
in
foldM arStatusCmp (InstanceData inst (ArHealthy Nothing) []) arGroups' | 456 | false | true | 0 | 12 | 105 | 138 | 69 | 69 | null | null |
adept/hledger | hledger-lib/Hledger/Data/Journal.hs | gpl-3.0 | journalLiabilityAccountQuery :: Journal -> Query
journalLiabilityAccountQuery = journalAccountTypeQuery [Liability] liabilityAccountRegex | 137 | journalLiabilityAccountQuery :: Journal -> Query
journalLiabilityAccountQuery = journalAccountTypeQuery [Liability] liabilityAccountRegex | 137 | journalLiabilityAccountQuery = journalAccountTypeQuery [Liability] liabilityAccountRegex | 88 | false | true | 0 | 6 | 9 | 23 | 12 | 11 | null | null |
Mahdi89/eTeak | src/SimPN.hs | bsd-3-clause | showsBit :: Int -> ShowS
showsBit dist = shows (bit dist :: Integer) | 72 | showsBit :: Int -> ShowS
showsBit dist = shows (bit dist :: Integer) | 68 | showsBit dist = shows (bit dist :: Integer) | 43 | false | true | 0 | 7 | 16 | 30 | 15 | 15 | null | null |
brendanhay/gogol | gogol-resourcemanager/gen/Network/Google/ResourceManager/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Empty' with the minimum fields required to make a request.
--
empty
:: Empty
empty = Empty' | 120 | empty
:: Empty
empty = Empty' | 33 | empty = Empty' | 14 | true | true | 1 | 5 | 26 | 17 | 8 | 9 | null | null |
ckaestne/CIDE | CIDE_Language_Haskell/test/WSP/scripts/CalcHistory.hs | gpl-3.0 | getOp '+' (Add z1) z2 = Add (z1 + z2) | 37 | getOp '+' (Add z1) z2 = Add (z1 + z2) | 37 | getOp '+' (Add z1) z2 = Add (z1 + z2) | 37 | false | false | 1 | 7 | 9 | 34 | 14 | 20 | null | null |
input-output-hk/pos-haskell-prototype | wallet/test/unit/Golden/WalletError.hs | mit | golden_WalletError_TxSafeSignerNotFound :: Property
golden_WalletError_TxSafeSignerNotFound =
goldenTestJSON
(TxSafeSignerNotFound $ V1 exampleAddress)
"test/unit/Golden/golden/WalletError_TxSafeSignerNotFound" | 234 | golden_WalletError_TxSafeSignerNotFound :: Property
golden_WalletError_TxSafeSignerNotFound =
goldenTestJSON
(TxSafeSignerNotFound $ V1 exampleAddress)
"test/unit/Golden/golden/WalletError_TxSafeSignerNotFound" | 234 | golden_WalletError_TxSafeSignerNotFound =
goldenTestJSON
(TxSafeSignerNotFound $ V1 exampleAddress)
"test/unit/Golden/golden/WalletError_TxSafeSignerNotFound" | 182 | false | true | 0 | 7 | 34 | 27 | 13 | 14 | null | null |
sdiehl/ghc | libraries/base/GHC/Enum.hs | bsd-3-clause | succError :: String -> a
succError inst_ty =
errorWithoutStackTrace $ "Enum.succ{" ++ inst_ty ++ "}: tried to take `succ' of maxBound" | 138 | succError :: String -> a
succError inst_ty =
errorWithoutStackTrace $ "Enum.succ{" ++ inst_ty ++ "}: tried to take `succ' of maxBound" | 138 | succError inst_ty =
errorWithoutStackTrace $ "Enum.succ{" ++ inst_ty ++ "}: tried to take `succ' of maxBound" | 113 | false | true | 0 | 7 | 24 | 30 | 15 | 15 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_346 (70#) = happyGoto action_145 | 39 | action_346 (70#) = happyGoto action_145 | 39 | action_346 (70#) = happyGoto action_145 | 39 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
erikd/hs-packer | Benchs/Impl.hs | bsd-2-clause | benchPackerGet :: (NFData a, ImplPacker a) => a -> ByteString -> Benchmark
benchPackerGet a bs = bench "packer" $ nf (runDecode a) bs
where runDecode :: ImplPacker a => a -> ByteString -> a
runDecode _ bs = implGetPacker bs | 237 | benchPackerGet :: (NFData a, ImplPacker a) => a -> ByteString -> Benchmark
benchPackerGet a bs = bench "packer" $ nf (runDecode a) bs
where runDecode :: ImplPacker a => a -> ByteString -> a
runDecode _ bs = implGetPacker bs | 237 | benchPackerGet a bs = bench "packer" $ nf (runDecode a) bs
where runDecode :: ImplPacker a => a -> ByteString -> a
runDecode _ bs = implGetPacker bs | 162 | false | true | 2 | 9 | 53 | 104 | 47 | 57 | null | null |
brendanhay/gogol | gogol-people/gen/Network/Google/Resource/People/People/UpdateContactPhoto.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
pucpUploadProtocol :: Lens' PeopleUpdateContactPhoto (Maybe Text)
pucpUploadProtocol
= lens _pucpUploadProtocol
(\ s a -> s{_pucpUploadProtocol = a}) | 219 | pucpUploadProtocol :: Lens' PeopleUpdateContactPhoto (Maybe Text)
pucpUploadProtocol
= lens _pucpUploadProtocol
(\ s a -> s{_pucpUploadProtocol = a}) | 157 | pucpUploadProtocol
= lens _pucpUploadProtocol
(\ s a -> s{_pucpUploadProtocol = a}) | 91 | true | true | 0 | 9 | 33 | 48 | 25 | 23 | null | null |
jiayuanmark/Haxl | tests/BatchTests.hs | bsd-3-clause | exceptionTest1 = expectResult []
$ withDefault [] $ friendsOf 101 | 67 | exceptionTest1 = expectResult []
$ withDefault [] $ friendsOf 101 | 67 | exceptionTest1 = expectResult []
$ withDefault [] $ friendsOf 101 | 67 | false | false | 2 | 7 | 11 | 28 | 12 | 16 | null | null |
JPMoresmau/haskell-ide-engine | test/testdata/FileWithWarning.hs | bsd-3-clause | main = putStrLn "hello" | 23 | main = putStrLn "hello" | 23 | main = putStrLn "hello" | 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
spechub/Hets | RelationalScheme/AS.der.hs | gpl-2.0 | getSignature :: RSScheme -> RSTables
getSignature spec = case spec of
RSScheme tb _ _ -> tb | 103 | getSignature :: RSScheme -> RSTables
getSignature spec = case spec of
RSScheme tb _ _ -> tb | 103 | getSignature spec = case spec of
RSScheme tb _ _ -> tb | 66 | false | true | 2 | 5 | 28 | 35 | 17 | 18 | null | null |
imalsogreg/arte-ephys | tetrode-ephys/src/Data/Ephys/OldMWL/ParseSpike.hs | gpl-3.0 | toChan :: SpikeFileInfo -> U.Vector Voltage -> Int -> U.Vector Voltage
toChan SpikeFileInfo{..} vIn chanInd =
U.map (vIn U.!) $
U.iterateN nSampsPerChan (+nChans) chanInd | 174 | toChan :: SpikeFileInfo -> U.Vector Voltage -> Int -> U.Vector Voltage
toChan SpikeFileInfo{..} vIn chanInd =
U.map (vIn U.!) $
U.iterateN nSampsPerChan (+nChans) chanInd | 174 | toChan SpikeFileInfo{..} vIn chanInd =
U.map (vIn U.!) $
U.iterateN nSampsPerChan (+nChans) chanInd | 103 | false | true | 0 | 9 | 27 | 74 | 37 | 37 | null | null |
jamshidh/ethereum-rlp | src/Blockchain/Data/RLP.hs | bsd-3-clause | rlp2Bytes (RLPString s) | length s <= 55 = 0x80 + fromIntegral (length s):(c2w <$> s) | 85 | rlp2Bytes (RLPString s) | length s <= 55 = 0x80 + fromIntegral (length s):(c2w <$> s) | 85 | rlp2Bytes (RLPString s) | length s <= 55 = 0x80 + fromIntegral (length s):(c2w <$> s) | 85 | false | false | 0 | 10 | 15 | 53 | 24 | 29 | null | null |
GaloisInc/sk-dev-platform | libs/SCD/src/SCD/M4/ErrorsXml.hs | bsd-3-clause | warnName (KindMismatch _ _ _ ) = "kind_mismatch" | 64 | warnName (KindMismatch _ _ _ ) = "kind_mismatch" | 64 | warnName (KindMismatch _ _ _ ) = "kind_mismatch" | 64 | false | false | 0 | 6 | 23 | 20 | 9 | 11 | null | null |
sdiehl/ghc | testsuite/tests/perf/should_run/T14955.hs | bsd-3-clause | --test4 :: [Bool] -> Bool
--test4 xs = porsProxy xs
main = print (test3 (replicate 1000000 False)) | 99 | main = print (test3 (replicate 1000000 False)) | 46 | main = print (test3 (replicate 1000000 False)) | 46 | true | false | 1 | 9 | 17 | 29 | 13 | 16 | null | null |
tjakway/ghcjvm | compiler/main/CmdLineParser.hs | bsd-3-clause | unknownFlagErr :: String -> Either String a
unknownFlagErr f = Left ("unrecognised flag: " ++ f) | 96 | unknownFlagErr :: String -> Either String a
unknownFlagErr f = Left ("unrecognised flag: " ++ f) | 96 | unknownFlagErr f = Left ("unrecognised flag: " ++ f) | 52 | false | true | 0 | 7 | 15 | 38 | 17 | 21 | null | null |
paulolieuthier/criterion | Criterion/Monad.hs | bsd-2-clause | memoise :: (Crit -> IORef (Maybe a)) -> IO a -> Criterion a
memoise ref generate = do
r <- Criterion $ asks ref
liftIO $ do
mv <- readIORef r
case mv of
Just rv -> return rv
Nothing -> do
rv <- generate
writeIORef r (Just rv)
return rv | 283 | memoise :: (Crit -> IORef (Maybe a)) -> IO a -> Criterion a
memoise ref generate = do
r <- Criterion $ asks ref
liftIO $ do
mv <- readIORef r
case mv of
Just rv -> return rv
Nothing -> do
rv <- generate
writeIORef r (Just rv)
return rv | 283 | memoise ref generate = do
r <- Criterion $ asks ref
liftIO $ do
mv <- readIORef r
case mv of
Just rv -> return rv
Nothing -> do
rv <- generate
writeIORef r (Just rv)
return rv | 223 | false | true | 0 | 19 | 98 | 135 | 58 | 77 | null | null |
sebastiaanvisser/haha | src/Graphics/Ascii/Haha/Geometry.hs | bsd-3-clause | rotatePoint :: Floating u => u -> Point u -> Point u -> Point u
rotatePoint t (Point ox oy) (Point x y) = Point
(ox + (x-ox) * cos t - (y-oy) * sin t)
(oy + (x-ox) * sin t + (y-oy) * cos t) | 193 | rotatePoint :: Floating u => u -> Point u -> Point u -> Point u
rotatePoint t (Point ox oy) (Point x y) = Point
(ox + (x-ox) * cos t - (y-oy) * sin t)
(oy + (x-ox) * sin t + (y-oy) * cos t) | 193 | rotatePoint t (Point ox oy) (Point x y) = Point
(ox + (x-ox) * cos t - (y-oy) * sin t)
(oy + (x-ox) * sin t + (y-oy) * cos t) | 129 | false | true | 0 | 11 | 50 | 146 | 71 | 75 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/enumFromThenTo_1.hs | mit | esEsOrdering EQ GT = MyFalse | 28 | esEsOrdering EQ GT = MyFalse | 28 | esEsOrdering EQ GT = MyFalse | 28 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
bitemyapp/ether | src/Control/Monad/Trans/Ether/State/Strict.hs | bsd-3-clause | -- | Runs a 'StateT' with the given initial state
-- and returns both the final value and the final state.
runStateT :: proxy tag -> StateT tag s m a -> s -> m (a, s)
runStateT t = Trans.runStateT . untagged t | 209 | runStateT :: proxy tag -> StateT tag s m a -> s -> m (a, s)
runStateT t = Trans.runStateT . untagged t | 102 | runStateT t = Trans.runStateT . untagged t | 42 | true | true | 0 | 9 | 43 | 58 | 29 | 29 | null | null |
peletomi/icanhasren | Rename.hs | gpl-3.0 | datePar :: GenParser Char st Renamer
datePar = do
char '['
nc <- (char 'D' <|> char 'd')
f <- option "%Y%m%d" dateFormatPar
char ']'
return (dateBuilder f) | 216 | datePar :: GenParser Char st Renamer
datePar = do
char '['
nc <- (char 'D' <|> char 'd')
f <- option "%Y%m%d" dateFormatPar
char ']'
return (dateBuilder f) | 216 | datePar = do
char '['
nc <- (char 'D' <|> char 'd')
f <- option "%Y%m%d" dateFormatPar
char ']'
return (dateBuilder f) | 179 | false | true | 1 | 11 | 88 | 78 | 32 | 46 | null | null |
sgillespie/ghc | compiler/codeGen/StgCmmClosure.hs | bsd-3-clause | -------------
mkApLFInfo :: Id -> UpdateFlag -> Arity -> LambdaFormInfo
mkApLFInfo id upd_flag arity
= LFThunk NotTopLevel (arity == 0) (isUpdatable upd_flag) (ApThunk arity)
(might_be_a_function (idType id)) | 218 | mkApLFInfo :: Id -> UpdateFlag -> Arity -> LambdaFormInfo
mkApLFInfo id upd_flag arity
= LFThunk NotTopLevel (arity == 0) (isUpdatable upd_flag) (ApThunk arity)
(might_be_a_function (idType id)) | 204 | mkApLFInfo id upd_flag arity
= LFThunk NotTopLevel (arity == 0) (isUpdatable upd_flag) (ApThunk arity)
(might_be_a_function (idType id)) | 146 | true | true | 0 | 9 | 36 | 73 | 37 | 36 | null | null |
venkat24/codeworld | codeworld-server/src/Main.hs | apache-2.0 | getUser :: ClientId -> Snap User
getUser clientId = getParam "id_token" >>= \ case
Nothing -> pass
Just id_token -> do
let url = "https://www.googleapis.com/oauth2/v1/tokeninfo?id_token=" ++ BC.unpack id_token
decoded <- fmap decode $ liftIO $ simpleHttp url
case decoded of
Nothing -> pass
Just user -> do
when (clientId /= ClientId (Just (audience user))) pass
return user
-- A revised upload policy that allows up to 4 MB of uploaded data in a
-- request. This is needed to handle uploads of projects including editor
-- history. | 628 | getUser :: ClientId -> Snap User
getUser clientId = getParam "id_token" >>= \ case
Nothing -> pass
Just id_token -> do
let url = "https://www.googleapis.com/oauth2/v1/tokeninfo?id_token=" ++ BC.unpack id_token
decoded <- fmap decode $ liftIO $ simpleHttp url
case decoded of
Nothing -> pass
Just user -> do
when (clientId /= ClientId (Just (audience user))) pass
return user
-- A revised upload policy that allows up to 4 MB of uploaded data in a
-- request. This is needed to handle uploads of projects including editor
-- history. | 628 | getUser clientId = getParam "id_token" >>= \ case
Nothing -> pass
Just id_token -> do
let url = "https://www.googleapis.com/oauth2/v1/tokeninfo?id_token=" ++ BC.unpack id_token
decoded <- fmap decode $ liftIO $ simpleHttp url
case decoded of
Nothing -> pass
Just user -> do
when (clientId /= ClientId (Just (audience user))) pass
return user
-- A revised upload policy that allows up to 4 MB of uploaded data in a
-- request. This is needed to handle uploads of projects including editor
-- history. | 595 | false | true | 2 | 21 | 182 | 149 | 67 | 82 | null | null |
vigoos/Farrago-OS | aura-master/aura-master/src/Aura/Flags.hs | gpl-2.0 | dualFlagMap f = flip simpleFlagMap f [ (Quiet, "-q" )
, (NoConfirm, "--noconfirm" )
, (Needed, "--needed" ) ] | 202 | dualFlagMap f = flip simpleFlagMap f [ (Quiet, "-q" )
, (NoConfirm, "--noconfirm" )
, (Needed, "--needed" ) ] | 202 | dualFlagMap f = flip simpleFlagMap f [ (Quiet, "-q" )
, (NoConfirm, "--noconfirm" )
, (Needed, "--needed" ) ] | 202 | false | false | 0 | 7 | 111 | 43 | 25 | 18 | null | null |
pbrisbin/yesod-comments | Yesod/Comments/View.hs | bsd-3-clause | showComments :: YesodComments m => [Comment] -> WidgetT m IO ()
showComments comments = [whamlet|
<div .list>
$if not $ null comments
<h4>#{helper $ length comments}:
$forall comment <- comments
^{showComment comment}
|]
where
-- pluralize comments
helper :: Int -> String
helper 0 = "no comments"
helper 1 = "1 comment"
helper n = show n ++ " comments" | 455 | showComments :: YesodComments m => [Comment] -> WidgetT m IO ()
showComments comments = [whamlet|
<div .list>
$if not $ null comments
<h4>#{helper $ length comments}:
$forall comment <- comments
^{showComment comment}
|]
where
-- pluralize comments
helper :: Int -> String
helper 0 = "no comments"
helper 1 = "1 comment"
helper n = show n ++ " comments" | 455 | showComments comments = [whamlet|
<div .list>
$if not $ null comments
<h4>#{helper $ length comments}:
$forall comment <- comments
^{showComment comment}
|]
where
-- pluralize comments
helper :: Int -> String
helper 0 = "no comments"
helper 1 = "1 comment"
helper n = show n ++ " comments" | 391 | false | true | 0 | 8 | 161 | 84 | 44 | 40 | null | null |
phi16/Lambia | src/Lambia/Parse.hs | gpl-3.0 | source :: Parser Source
source = do
try lf <|> return ()
(ds,e) <- let
du (xs,j) = try (do
e <- optionMaybe expr
lf
return (xs [],e)
) <|> (do
d <- decl $ Just ""
du (xs . (d:), j))
in du (id,Nothing)
eof
return $ Source ds e | 301 | source :: Parser Source
source = do
try lf <|> return ()
(ds,e) <- let
du (xs,j) = try (do
e <- optionMaybe expr
lf
return (xs [],e)
) <|> (do
d <- decl $ Just ""
du (xs . (d:), j))
in du (id,Nothing)
eof
return $ Source ds e | 301 | source = do
try lf <|> return ()
(ds,e) <- let
du (xs,j) = try (do
e <- optionMaybe expr
lf
return (xs [],e)
) <|> (do
d <- decl $ Just ""
du (xs . (d:), j))
in du (id,Nothing)
eof
return $ Source ds e | 277 | false | true | 0 | 20 | 126 | 163 | 78 | 85 | null | null |
tekul/cryptonite | Crypto/ECC/Simple/Prim.hs | bsd-3-clause | pointAdd :: Curve curve => Point curve -> Point curve -> Point curve
pointAdd PointO PointO = PointO | 100 | pointAdd :: Curve curve => Point curve -> Point curve -> Point curve
pointAdd PointO PointO = PointO | 100 | pointAdd PointO PointO = PointO | 31 | false | true | 0 | 8 | 17 | 40 | 18 | 22 | null | null |
Apsod/bihash | src/Data/Bihash.hs | bsd-3-clause | fromList :: (Eq a, Hashable a, Eq b, Hashable b) => [(a,b)] -> Maybe (Bihash a b)
fromList xs = let assertInj :: (Eq a, Hashable a) => [(a,b)] -> Maybe (HashMap a b)
assertInj = sequenceA . HM.fromListWith (\_ _ -> Nothing) . fmap (second Just)
swap (a,b) = (b,a)
in Bihash <$> assertInj xs <*> assertInj (fmap swap xs) | 369 | fromList :: (Eq a, Hashable a, Eq b, Hashable b) => [(a,b)] -> Maybe (Bihash a b)
fromList xs = let assertInj :: (Eq a, Hashable a) => [(a,b)] -> Maybe (HashMap a b)
assertInj = sequenceA . HM.fromListWith (\_ _ -> Nothing) . fmap (second Just)
swap (a,b) = (b,a)
in Bihash <$> assertInj xs <*> assertInj (fmap swap xs) | 369 | fromList xs = let assertInj :: (Eq a, Hashable a) => [(a,b)] -> Maybe (HashMap a b)
assertInj = sequenceA . HM.fromListWith (\_ _ -> Nothing) . fmap (second Just)
swap (a,b) = (b,a)
in Bihash <$> assertInj xs <*> assertInj (fmap swap xs) | 287 | false | true | 2 | 13 | 110 | 199 | 102 | 97 | null | null |
thomie/vector | Data/Vector/Primitive.hs | bsd-3-clause | copy = G.copy | 13 | copy = G.copy | 13 | copy = G.copy | 13 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
beni55/cgrep | src/CGrep/Semantic/Cpp/Token.hs | gpl-2.0 | getTokenString (C.uncons -> Nothing) _ = Nothing | 48 | getTokenString (C.uncons -> Nothing) _ = Nothing | 48 | getTokenString (C.uncons -> Nothing) _ = Nothing | 48 | false | false | 1 | 7 | 6 | 21 | 10 | 11 | null | null |
badp/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | -- * Auto-repair levels
autoRepairFailover :: String
autoRepairFailover = Types.autoRepairTypeToRaw ArFailover | 111 | autoRepairFailover :: String
autoRepairFailover = Types.autoRepairTypeToRaw ArFailover | 86 | autoRepairFailover = Types.autoRepairTypeToRaw ArFailover | 57 | true | true | 0 | 6 | 11 | 17 | 9 | 8 | null | null |
randen/cabal | Cabal/Distribution/Simple/Program/HcPkg.hs | bsd-3-clause | -- | Call @hc-pkg@ to get all the details of all the packages in the given
-- package database.
--
dump :: HcPkgInfo -> Verbosity -> PackageDB -> IO [InstalledPackageInfo]
dump hpi verbosity packagedb = do
output <- getProgramInvocationOutput verbosity
(dumpInvocation hpi verbosity packagedb)
`catchIO` \_ -> die $ programId (hcPkgProgram hpi) ++ " dump failed"
case parsePackages output of
Left ok -> return ok
_ -> die $ "failed to parse output of '"
++ programId (hcPkgProgram hpi) ++ " dump'" | 553 | dump :: HcPkgInfo -> Verbosity -> PackageDB -> IO [InstalledPackageInfo]
dump hpi verbosity packagedb = do
output <- getProgramInvocationOutput verbosity
(dumpInvocation hpi verbosity packagedb)
`catchIO` \_ -> die $ programId (hcPkgProgram hpi) ++ " dump failed"
case parsePackages output of
Left ok -> return ok
_ -> die $ "failed to parse output of '"
++ programId (hcPkgProgram hpi) ++ " dump'" | 454 | dump hpi verbosity packagedb = do
output <- getProgramInvocationOutput verbosity
(dumpInvocation hpi verbosity packagedb)
`catchIO` \_ -> die $ programId (hcPkgProgram hpi) ++ " dump failed"
case parsePackages output of
Left ok -> return ok
_ -> die $ "failed to parse output of '"
++ programId (hcPkgProgram hpi) ++ " dump'" | 381 | true | true | 0 | 15 | 137 | 144 | 69 | 75 | null | null |
e1528532/libelektra | src/libs/typesystem/spectranslator/Elektra/SpecTranslator.hs | bsd-3-clause | translateKeySpecification :: FunctionMap -> KeySpecification -> [Decl ()]
translateKeySpecification f k = [specTranslation]
where
rawKeyTranslation = ExpTypeSig () e t
where
kt = ignoreEither $ keyType k
ignoreEither (Right r) = r
ignoreEither _ = ".*"
e = Con () key
t = TyCon () regex <-> TyPromoted () (PromotedString () kt kt)
specTranslation = let specs = functionCandidates k
conv (t, v) = foldl (<=>) (Var () (translateUnqualPath $ renamedTySpecName t)) . catMaybes $ [translateFunctionParameter v]
sigs = map (flip M.lookup f . functionBaseName . fncFun) specs
repack Nothing _ = Nothing
repack (Just a) b = Just (a, b)
transl = conv <$> sortBy (flip compare `on` (order . fst)) (catMaybes $ zipWith repack sigs specs)
in nameBind (specificationKeyName k) $ foldr (<=>) rawKeyTranslation transl
translateFunctionParameter v = case fncPath v of
"" -> case fncStr v of
"" -> Nothing
_ -> let rgx = fncStr v
vr = Var () key
ty = TyCon () regex <-> TyPromoted () (PromotedString () rgx rgx)
in Just $ ExpTypeSig () vr ty
_ -> Just $ Var () (translateUnqualPath $ fncPath v)
translateUnqualPath = translateUnqual . pathToDeclName | 1,459 | translateKeySpecification :: FunctionMap -> KeySpecification -> [Decl ()]
translateKeySpecification f k = [specTranslation]
where
rawKeyTranslation = ExpTypeSig () e t
where
kt = ignoreEither $ keyType k
ignoreEither (Right r) = r
ignoreEither _ = ".*"
e = Con () key
t = TyCon () regex <-> TyPromoted () (PromotedString () kt kt)
specTranslation = let specs = functionCandidates k
conv (t, v) = foldl (<=>) (Var () (translateUnqualPath $ renamedTySpecName t)) . catMaybes $ [translateFunctionParameter v]
sigs = map (flip M.lookup f . functionBaseName . fncFun) specs
repack Nothing _ = Nothing
repack (Just a) b = Just (a, b)
transl = conv <$> sortBy (flip compare `on` (order . fst)) (catMaybes $ zipWith repack sigs specs)
in nameBind (specificationKeyName k) $ foldr (<=>) rawKeyTranslation transl
translateFunctionParameter v = case fncPath v of
"" -> case fncStr v of
"" -> Nothing
_ -> let rgx = fncStr v
vr = Var () key
ty = TyCon () regex <-> TyPromoted () (PromotedString () rgx rgx)
in Just $ ExpTypeSig () vr ty
_ -> Just $ Var () (translateUnqualPath $ fncPath v)
translateUnqualPath = translateUnqual . pathToDeclName | 1,459 | translateKeySpecification f k = [specTranslation]
where
rawKeyTranslation = ExpTypeSig () e t
where
kt = ignoreEither $ keyType k
ignoreEither (Right r) = r
ignoreEither _ = ".*"
e = Con () key
t = TyCon () regex <-> TyPromoted () (PromotedString () kt kt)
specTranslation = let specs = functionCandidates k
conv (t, v) = foldl (<=>) (Var () (translateUnqualPath $ renamedTySpecName t)) . catMaybes $ [translateFunctionParameter v]
sigs = map (flip M.lookup f . functionBaseName . fncFun) specs
repack Nothing _ = Nothing
repack (Just a) b = Just (a, b)
transl = conv <$> sortBy (flip compare `on` (order . fst)) (catMaybes $ zipWith repack sigs specs)
in nameBind (specificationKeyName k) $ foldr (<=>) rawKeyTranslation transl
translateFunctionParameter v = case fncPath v of
"" -> case fncStr v of
"" -> Nothing
_ -> let rgx = fncStr v
vr = Var () key
ty = TyCon () regex <-> TyPromoted () (PromotedString () rgx rgx)
in Just $ ExpTypeSig () vr ty
_ -> Just $ Var () (translateUnqualPath $ fncPath v)
translateUnqualPath = translateUnqual . pathToDeclName | 1,385 | false | true | 3 | 23 | 515 | 488 | 242 | 246 | null | null |
egaburov/funstuff | Haskell/sharing/observable1.hs | apache-2.0 | interp :: Bit -> [Bool]
interp (Xor b1 b2) = zipWith (/=) (interp b1) (interp b2) | 81 | interp :: Bit -> [Bool]
interp (Xor b1 b2) = zipWith (/=) (interp b1) (interp b2) | 81 | interp (Xor b1 b2) = zipWith (/=) (interp b1) (interp b2) | 57 | false | true | 0 | 7 | 15 | 50 | 26 | 24 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-printers/Language/Drasil/Printing/Import.hs | bsd-2-clause | spec _ (P s) = P.E $ symbol s | 39 | spec _ (P s) = P.E $ symbol s | 39 | spec _ (P s) = P.E $ symbol s | 39 | false | false | 1 | 6 | 18 | 28 | 12 | 16 | null | null |
zer/BeginningHaskell | src/Chapter2/PatternMatching.hs | apache-2.0 | reduceTimeMachines (x:xs) r = reduceTimeMachines [x] r ++ reduceTimeMachines xs r | 101 | reduceTimeMachines (x:xs) r = reduceTimeMachines [x] r ++ reduceTimeMachines xs r | 101 | reduceTimeMachines (x:xs) r = reduceTimeMachines [x] r ++ reduceTimeMachines xs r | 101 | false | false | 0 | 7 | 30 | 35 | 17 | 18 | null | null |
fehu/min-dat--weka-data | src/WekaData.hs | mit | getFromMaybe name = fromMaybe (error $ "attribute '" ++ name ++ "' not found") | 78 | getFromMaybe name = fromMaybe (error $ "attribute '" ++ name ++ "' not found") | 78 | getFromMaybe name = fromMaybe (error $ "attribute '" ++ name ++ "' not found") | 78 | false | false | 1 | 9 | 13 | 31 | 13 | 18 | null | null |
Daniel-Diaz/wavy | Data/Sound.hs | bsd-3-clause | - | Add a silence at the beginning of a sound.
addSilenceBeg :: Time -- ^ Duration of the silence.
-> Sound -> Sound
addSilenceBeg d s = multiply n (zeroSoundWith r d) <.> s
where
r = rate s
n = channels s
-- | Add a silence at the end of a sound.
| 268 | addSilenceBeg :: Time -- ^ Duration of the silence.
-> Sound -> Sound
addSilenceBeg d s = multiply n (zeroSoundWith r d) <.> s
where
r = rate s
n = channels s
-- | Add a silence at the end of a sound. | 220 | addSilenceBeg d s = multiply n (zeroSoundWith r d) <.> s
where
r = rate s
n = channels s
-- | Add a silence at the end of a sound. | 136 | true | true | 2 | 9 | 75 | 83 | 41 | 42 | null | null |
seschwar/mailkwds | src/Args.hs | mit | -- | Parse the command line arguments and create an appropriate configuration.
parseArgs :: [String] -> Either String (Config ByteString)
parseArgs args = sanitizeError +++ (sanitizeConfig . \x -> foldr (>>>) id x config)
$ parse pArgs "Args" args -- (>>>) ensures that the map's values
where -- get overwritten correctly
config = Config
{ catenate = foldHeaders
, command = flip const
, help = False
, input = empty
, keywords = []
, output = []
, version = False
}
-- | Print @UnExpect@ed errors @Message@s or the complete @ParseError@ if there
-- is none. | 670 | parseArgs :: [String] -> Either String (Config ByteString)
parseArgs args = sanitizeError +++ (sanitizeConfig . \x -> foldr (>>>) id x config)
$ parse pArgs "Args" args -- (>>>) ensures that the map's values
where -- get overwritten correctly
config = Config
{ catenate = foldHeaders
, command = flip const
, help = False
, input = empty
, keywords = []
, output = []
, version = False
}
-- | Print @UnExpect@ed errors @Message@s or the complete @ParseError@ if there
-- is none. | 591 | parseArgs args = sanitizeError +++ (sanitizeConfig . \x -> foldr (>>>) id x config)
$ parse pArgs "Args" args -- (>>>) ensures that the map's values
where -- get overwritten correctly
config = Config
{ catenate = foldHeaders
, command = flip const
, help = False
, input = empty
, keywords = []
, output = []
, version = False
}
-- | Print @UnExpect@ed errors @Message@s or the complete @ParseError@ if there
-- is none. | 532 | true | true | 0 | 10 | 210 | 134 | 77 | 57 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.