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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
brendanhay/gogol | gogol-container/gen/Network/Google/Resource/Container/Projects/Locations/Clusters/StartIPRotation.hs | mpl-2.0 | -- | The name (project, location, cluster id) of the cluster to start IP
-- rotation. Specified in the format
-- \`projects\/*\/locations\/*\/clusters\/*\`.
plcsirName :: Lens' ProjectsLocationsClustersStartIPRotation Text
plcsirName
= lens _plcsirName (\ s a -> s{_plcsirName = a}) | 284 | plcsirName :: Lens' ProjectsLocationsClustersStartIPRotation Text
plcsirName
= lens _plcsirName (\ s a -> s{_plcsirName = a}) | 127 | plcsirName
= lens _plcsirName (\ s a -> s{_plcsirName = a}) | 61 | true | true | 0 | 9 | 39 | 44 | 24 | 20 | null | null |
tolysz/prepare-ghcjs | spec-lts8/aeson/Data/Aeson/Encoding/Internal.hs | bsd-3-clause | closeCurly = Encoding $ char7 '}' | 35 | closeCurly = Encoding $ char7 '}' | 35 | closeCurly = Encoding $ char7 '}' | 35 | false | false | 0 | 6 | 7 | 13 | 6 | 7 | null | null |
enolan/pdxfunc-cis194 | src/Week3.hs | bsd-3-clause | -- YOUR CODE GOES HERE
localMaxima :: [Integer] -> [Integer]
localMaxima i = [] | 80 | localMaxima :: [Integer] -> [Integer]
localMaxima i = [] | 56 | localMaxima i = [] | 18 | true | true | 0 | 6 | 14 | 27 | 15 | 12 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/Layout.hs | lgpl-2.1 | -- | Make the layout stretchable and align it in the top-left corner of the assigned area (default).
floatTopLeft :: Layout -> Layout
floatTopLeft
= stretch . alignTopLeft | 173 | floatTopLeft :: Layout -> Layout
floatTopLeft
= stretch . alignTopLeft | 72 | floatTopLeft
= stretch . alignTopLeft | 39 | true | true | 0 | 7 | 29 | 23 | 11 | 12 | null | null |
gbwey/persistent | persistent-zookeeper/Database/Persist/Zookeeper/Config.hs | mit | defaultZookeeperSettings :: MkPersistSettings
defaultZookeeperSettings = (mkPersistSettings $ ConT ''Z.Zookeeper) | 113 | defaultZookeeperSettings :: MkPersistSettings
defaultZookeeperSettings = (mkPersistSettings $ ConT ''Z.Zookeeper) | 113 | defaultZookeeperSettings = (mkPersistSettings $ ConT ''Z.Zookeeper) | 67 | false | true | 0 | 10 | 8 | 32 | 14 | 18 | null | null |
Numberartificial/workflow | snipets/src/Craft/Chapter5.hs | mit | -- List comprehensions
-- ^^^^^^^^^^^^^^^^^^^
-- Examples of list comprehensions
ex :: [Integer]
ex = [2,4,7] | 110 | ex :: [Integer]
ex = [2,4,7] | 28 | ex = [2,4,7] | 12 | true | true | 0 | 7 | 16 | 33 | 18 | 15 | null | null |
DimaSamoz/thodo | src/Commands/Common.hs | mit | nextWeek :: Parser Category
nextWeek = flag' (RelTime NextWeek)
( long "next-week"
<> short 'W'
<> help "Tasks from next week") | 140 | nextWeek :: Parser Category
nextWeek = flag' (RelTime NextWeek)
( long "next-week"
<> short 'W'
<> help "Tasks from next week") | 140 | nextWeek = flag' (RelTime NextWeek)
( long "next-week"
<> short 'W'
<> help "Tasks from next week") | 112 | false | true | 0 | 9 | 33 | 52 | 22 | 30 | null | null |
brendanhay/gogol | gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs | mpl-2.0 | -- | Date on which the collection has been last updated in [ISO
-- 8601](http:\/\/en.wikipedia.org\/wiki\/ISO_8601) format: Date, time, and
-- offset, e.g. \"2020-01-02T09:00:00+01:00\" or \"2020-01-02T09:00:00Z\"
csLastUpdateDate :: Lens' CollectionStatus (Maybe Text)
csLastUpdateDate
= lens _csLastUpdateDate
(\ s a -> s{_csLastUpdateDate = a}) | 355 | csLastUpdateDate :: Lens' CollectionStatus (Maybe Text)
csLastUpdateDate
= lens _csLastUpdateDate
(\ s a -> s{_csLastUpdateDate = a}) | 141 | csLastUpdateDate
= lens _csLastUpdateDate
(\ s a -> s{_csLastUpdateDate = a}) | 85 | true | true | 0 | 9 | 49 | 50 | 27 | 23 | null | null |
dylanmc/cryptol | src/Cryptol/Parser/ParserUtils.hs | bsd-3-clause | polyTerm :: Range -> Integer -> Integer -> ParseM (Bool, Integer)
polyTerm rng k p
| k == 0 = return (False, p)
| k == 1 = return (True, p)
| otherwise = errorMessage rng "Invalid polynomial coefficient" | 233 | polyTerm :: Range -> Integer -> Integer -> ParseM (Bool, Integer)
polyTerm rng k p
| k == 0 = return (False, p)
| k == 1 = return (True, p)
| otherwise = errorMessage rng "Invalid polynomial coefficient" | 233 | polyTerm rng k p
| k == 0 = return (False, p)
| k == 1 = return (True, p)
| otherwise = errorMessage rng "Invalid polynomial coefficient" | 167 | false | true | 2 | 9 | 68 | 92 | 46 | 46 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 4152 = 4151 | 11 | 4152 = 4151 | 11 | 4152 = 4151 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
danr/hipspec | examples/old-examples/hip/Expr.hs | gpl-3.0 | size (Val _) = S Z | 22 | size (Val _) = S Z | 22 | size (Val _) = S Z | 22 | false | false | 0 | 6 | 9 | 19 | 8 | 11 | null | null |
ciderpunx/57-exercises-for-programmers | src/P25PwStrength.hs | gpl-3.0 | manyNumbers = many isNumber | 28 | manyNumbers = many isNumber | 28 | manyNumbers = many isNumber | 28 | false | false | 1 | 5 | 4 | 12 | 4 | 8 | null | null |
advancedtelematic/quickcheck-state-machine-model | test/Mock.hs | bsd-3-clause | mock :: Model Symbolic -> Command Symbolic -> GenSym (Response Symbolic)
mock Model{..} cmd = case (cmd, c) of
(Create, 0) -> Created <$> genSym
(Create, _) -> return NotCreated | 183 | mock :: Model Symbolic -> Command Symbolic -> GenSym (Response Symbolic)
mock Model{..} cmd = case (cmd, c) of
(Create, 0) -> Created <$> genSym
(Create, _) -> return NotCreated | 183 | mock Model{..} cmd = case (cmd, c) of
(Create, 0) -> Created <$> genSym
(Create, _) -> return NotCreated | 110 | false | true | 0 | 9 | 35 | 86 | 44 | 42 | null | null |
nevrenato/HetsAlloy | Common/IRI.hs | gpl-2.0 | -- | Turn a string containing a CURIE into an 'IRI'
parseCurie :: String -> Maybe IRI
parseCurie = parseIRIAny curie | 116 | parseCurie :: String -> Maybe IRI
parseCurie = parseIRIAny curie | 64 | parseCurie = parseIRIAny curie | 30 | true | true | 0 | 7 | 20 | 27 | 12 | 15 | null | null |
rdnetto/H2V | H2V/main.hs | gpl-2.0 | argDefs = [ ("-h", ShowHelp),
("--help", ShowHelp),
("-a", OutputAST),
("--ast", OutputAST),
("-d", OutputDFD),
("--dfd", OutputDFD),
("-g", OutputGV),
("--graphviz", OutputGV),
("-v", OutputVerilog),
("--Verilog", OutputVerilog)
] | 349 | argDefs = [ ("-h", ShowHelp),
("--help", ShowHelp),
("-a", OutputAST),
("--ast", OutputAST),
("-d", OutputDFD),
("--dfd", OutputDFD),
("-g", OutputGV),
("--graphviz", OutputGV),
("-v", OutputVerilog),
("--Verilog", OutputVerilog)
] | 349 | argDefs = [ ("-h", ShowHelp),
("--help", ShowHelp),
("-a", OutputAST),
("--ast", OutputAST),
("-d", OutputDFD),
("--dfd", OutputDFD),
("-g", OutputGV),
("--graphviz", OutputGV),
("-v", OutputVerilog),
("--Verilog", OutputVerilog)
] | 349 | false | false | 0 | 6 | 141 | 96 | 63 | 33 | null | null |
AngusP/NSFWbot | irclog.hs | mit | toCSV :: Log -> String
toCSV [] = [] | 36 | toCSV :: Log -> String
toCSV [] = [] | 36 | toCSV [] = [] | 13 | false | true | 0 | 8 | 8 | 28 | 12 | 16 | null | null |
siyusong/Morphy | Test.hs | bsd-3-clause | prop_undoMove_rt :: Board -> Property
prop_undoMove_rt board =
playable board ==> tryUndoMove (tryMakeFirstMove board) == board | 129 | prop_undoMove_rt :: Board -> Property
prop_undoMove_rt board =
playable board ==> tryUndoMove (tryMakeFirstMove board) == board | 129 | prop_undoMove_rt board =
playable board ==> tryUndoMove (tryMakeFirstMove board) == board | 91 | false | true | 2 | 10 | 17 | 52 | 22 | 30 | null | null |
keera-studios/hsQt | Qtc/Gui/QListView.hs | bsd-2-clause | setLayoutMode :: QListView a -> ((LayoutMode)) -> IO ()
setLayoutMode x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QListView_setLayoutMode cobj_x0 (toCLong $ qEnum_toInt x1) | 179 | setLayoutMode :: QListView a -> ((LayoutMode)) -> IO ()
setLayoutMode x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QListView_setLayoutMode cobj_x0 (toCLong $ qEnum_toInt x1) | 179 | setLayoutMode x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QListView_setLayoutMode cobj_x0 (toCLong $ qEnum_toInt x1) | 123 | false | true | 0 | 10 | 29 | 68 | 34 | 34 | null | null |
nevrenato/Hets_Fork | CommonLogic/ExpandCurie.hs | gpl-2.0 | expMod :: Map.Map String IRI -> MODULE -> MODULE
expMod pm m = case m of
Mod n t rn -> Mod (expName pm n) (expTxt pm t) rn
Mod_ex n ns t rn ->
Mod_ex (expName pm n) (map (expName pm) ns) (expTxt pm t) rn | 213 | expMod :: Map.Map String IRI -> MODULE -> MODULE
expMod pm m = case m of
Mod n t rn -> Mod (expName pm n) (expTxt pm t) rn
Mod_ex n ns t rn ->
Mod_ex (expName pm n) (map (expName pm) ns) (expTxt pm t) rn | 213 | expMod pm m = case m of
Mod n t rn -> Mod (expName pm n) (expTxt pm t) rn
Mod_ex n ns t rn ->
Mod_ex (expName pm n) (map (expName pm) ns) (expTxt pm t) rn | 164 | false | true | 0 | 12 | 56 | 130 | 61 | 69 | null | null |
pparkkin/eta | compiler/ETA/Utils/FastMutInt.hs | bsd-3-clause | writeFastMutPtr (FastMutPtr arr) (Ptr i) = IO $ \s ->
case writeAddrArray# arr 0# i s of { s' ->
(# s', () #) } | 115 | writeFastMutPtr (FastMutPtr arr) (Ptr i) = IO $ \s ->
case writeAddrArray# arr 0# i s of { s' ->
(# s', () #) } | 115 | writeFastMutPtr (FastMutPtr arr) (Ptr i) = IO $ \s ->
case writeAddrArray# arr 0# i s of { s' ->
(# s', () #) } | 115 | false | false | 0 | 11 | 28 | 62 | 31 | 31 | null | null |
sboosali/commands-spiros | config/Commands/Plugins/Spiros/Rank.hs | gpl-2.0 | defaultRankMultiplier :: Int
defaultRankMultiplier = 1000 | 57 | defaultRankMultiplier :: Int
defaultRankMultiplier = 1000 | 57 | defaultRankMultiplier = 1000 | 28 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
pa-ba/alfred | examples/Hoogle.hs | bsd-3-clause | notFound s = T.concat ["No suggestion. Search Hoogle for ", s, "."] | 67 | notFound s = T.concat ["No suggestion. Search Hoogle for ", s, "."] | 67 | notFound s = T.concat ["No suggestion. Search Hoogle for ", s, "."] | 67 | false | false | 0 | 6 | 11 | 23 | 12 | 11 | null | null |
rrnewton/stack | src/Stack/Package.hs | bsd-3-clause | -- | Make the build dir.
buildDir :: Path Abs Dir -> Path Abs Dir
buildDir distDir = distDir </> $(mkRelDir "build") | 116 | buildDir :: Path Abs Dir -> Path Abs Dir
buildDir distDir = distDir </> $(mkRelDir "build") | 91 | buildDir distDir = distDir </> $(mkRelDir "build") | 50 | true | true | 0 | 8 | 21 | 40 | 19 | 21 | null | null |
mohsen3/csv-conduit | src/Data/CSV/Conduit/Parser/Text.hs | bsd-3-clause | quotedField :: Char -> Parser Text
quotedField c = do
let quoted = string dbl *> return c
dbl = T.pack [c,c]
_ <- T.char c
f <- many (T.notChar c <|> quoted)
_ <- T.char c
return $ T.pack f | 205 | quotedField :: Char -> Parser Text
quotedField c = do
let quoted = string dbl *> return c
dbl = T.pack [c,c]
_ <- T.char c
f <- many (T.notChar c <|> quoted)
_ <- T.char c
return $ T.pack f | 205 | quotedField c = do
let quoted = string dbl *> return c
dbl = T.pack [c,c]
_ <- T.char c
f <- many (T.notChar c <|> quoted)
_ <- T.char c
return $ T.pack f | 170 | false | true | 0 | 12 | 56 | 114 | 52 | 62 | null | null |
BeautifulDestinations/fb | src/Facebook/Object/Marketing/AdCreative.hs | bsd-3-clause | setAdCreative :: (R.MonadResource m, MonadBaseControl IO m, AdCreativeSet r) =>
Id_ -- ^ Ad Account Id
-> r -- ^ Arguments to be passed to Facebook.
-> UserAccessToken -- ^ Optional user access token.
-> FacebookT Auth m (Either FacebookException CreateAdCreativeId)
setAdCreative (Id_ id) r mtoken = postForm ("/v2.7/" <> id <> "/adcreatives") (toForm r) mtoken | 378 | setAdCreative :: (R.MonadResource m, MonadBaseControl IO m, AdCreativeSet r) =>
Id_ -- ^ Ad Account Id
-> r -- ^ Arguments to be passed to Facebook.
-> UserAccessToken -- ^ Optional user access token.
-> FacebookT Auth m (Either FacebookException CreateAdCreativeId)
setAdCreative (Id_ id) r mtoken = postForm ("/v2.7/" <> id <> "/adcreatives") (toForm r) mtoken | 378 | setAdCreative (Id_ id) r mtoken = postForm ("/v2.7/" <> id <> "/adcreatives") (toForm r) mtoken | 95 | false | true | 0 | 12 | 71 | 104 | 53 | 51 | null | null |
snowleopard/shaking-up-ghc | src/Settings/Builders/Hsc2Hs.hs | bsd-3-clause | getLFlags :: Expr [String]
getLFlags =
mconcat [ getStagedSettingList ConfGccLinkerArgs
, ldArgs
, getContextData ldOpts
, getContextData depLdOpts ] | 189 | getLFlags :: Expr [String]
getLFlags =
mconcat [ getStagedSettingList ConfGccLinkerArgs
, ldArgs
, getContextData ldOpts
, getContextData depLdOpts ] | 189 | getLFlags =
mconcat [ getStagedSettingList ConfGccLinkerArgs
, ldArgs
, getContextData ldOpts
, getContextData depLdOpts ] | 162 | false | true | 0 | 7 | 58 | 41 | 21 | 20 | null | null |
atsukotakahashi/wi | src/library/Yi/Keymap/Keys.hs | gpl-2.0 | hyperCh :: Char -> Event
hyperCh = hyper . char | 47 | hyperCh :: Char -> Event
hyperCh = hyper . char | 47 | hyperCh = hyper . char | 22 | false | true | 0 | 5 | 9 | 19 | 10 | 9 | null | null |
alanfalloon/git-calendar | Main.hs | gpl-3.0 | parseLog :: String -> String -> String -> Set Event
parseLog proj branch log = Set.fromList events
where
events = map (parseEvent proj branch) $ lines log | 164 | parseLog :: String -> String -> String -> Set Event
parseLog proj branch log = Set.fromList events
where
events = map (parseEvent proj branch) $ lines log | 164 | parseLog proj branch log = Set.fromList events
where
events = map (parseEvent proj branch) $ lines log | 112 | false | true | 1 | 9 | 36 | 71 | 31 | 40 | null | null |
nushio3/formura | exe-src/formura-gen.hs | mit | pprNode :: (Int, OMNode) -> IO ()
pprNode (i,n) = do
let r = case A.toMaybe (n ^. A.annotation) of
Just Manifest -> "M"
_ -> " "
varName = case A.toMaybe (n ^. A.annotation) of
Just (SourceName n1) -> n1
_ -> ""
putStrLn $ unwords [r , take 4 $ varName ++ repeat ' ', show (i,n)] | 351 | pprNode :: (Int, OMNode) -> IO ()
pprNode (i,n) = do
let r = case A.toMaybe (n ^. A.annotation) of
Just Manifest -> "M"
_ -> " "
varName = case A.toMaybe (n ^. A.annotation) of
Just (SourceName n1) -> n1
_ -> ""
putStrLn $ unwords [r , take 4 $ varName ++ repeat ' ', show (i,n)] | 351 | pprNode (i,n) = do
let r = case A.toMaybe (n ^. A.annotation) of
Just Manifest -> "M"
_ -> " "
varName = case A.toMaybe (n ^. A.annotation) of
Just (SourceName n1) -> n1
_ -> ""
putStrLn $ unwords [r , take 4 $ varName ++ repeat ' ', show (i,n)] | 317 | false | true | 0 | 15 | 130 | 163 | 82 | 81 | null | null |
Happstack/happstack-server | src/Happstack/Server/Response.hs | bsd-3-clause | -- | Respond with @500 Internal Server Error@.
--
-- > main = simpleHTTP nullConf $ internalServerError "Sorry, there was an internal server error."
internalServerError :: (FilterMonad Response m) => a -> m a
internalServerError = resp 500 | 239 | internalServerError :: (FilterMonad Response m) => a -> m a
internalServerError = resp 500 | 90 | internalServerError = resp 500 | 30 | true | true | 0 | 8 | 37 | 41 | 20 | 21 | null | null |
janschulz/pandoc | src/Text/Pandoc/Writers/Man.hs | gpl-2.0 | orderedListItemToMan :: WriterOptions -- ^ options
-> String -- ^ order marker for list item
-> Int -- ^ number of spaces to indent
-> [Block] -- ^ list item (list of blocks)
-> State WriterState Doc
orderedListItemToMan _ _ _ [] = return empty | 356 | orderedListItemToMan :: WriterOptions -- ^ options
-> String -- ^ order marker for list item
-> Int -- ^ number of spaces to indent
-> [Block] -- ^ list item (list of blocks)
-> State WriterState Doc
orderedListItemToMan _ _ _ [] = return empty | 356 | orderedListItemToMan _ _ _ [] = return empty | 44 | false | true | 0 | 11 | 156 | 57 | 29 | 28 | null | null |
Cahu/krpc-hs | src/KRPCHS/SpaceCenter.hs | gpl-3.0 | setWheelBrakes :: KRPCHS.SpaceCenter.Wheel -> Float -> RPCContext ()
setWheelBrakes thisArg valueArg = do
let r = makeRequest "SpaceCenter" "Wheel_set_Brakes" [makeArgument 0 thisArg, makeArgument 1 valueArg]
res <- sendRequest r
processResponse res
{-
- Whether the wheel is deployed.
-} | 304 | setWheelBrakes :: KRPCHS.SpaceCenter.Wheel -> Float -> RPCContext ()
setWheelBrakes thisArg valueArg = do
let r = makeRequest "SpaceCenter" "Wheel_set_Brakes" [makeArgument 0 thisArg, makeArgument 1 valueArg]
res <- sendRequest r
processResponse res
{-
- Whether the wheel is deployed.
-} | 304 | setWheelBrakes thisArg valueArg = do
let r = makeRequest "SpaceCenter" "Wheel_set_Brakes" [makeArgument 0 thisArg, makeArgument 1 valueArg]
res <- sendRequest r
processResponse res
{-
- Whether the wheel is deployed.
-} | 235 | false | true | 0 | 13 | 54 | 86 | 39 | 47 | null | null |
sebfisch/parfold | uvec.hs | bsd-3-clause | foldVec f = foldVecWithSparks numCapabilities mappend mempty f | 62 | foldVec f = foldVecWithSparks numCapabilities mappend mempty f | 62 | foldVec f = foldVecWithSparks numCapabilities mappend mempty f | 62 | false | false | 1 | 5 | 7 | 21 | 8 | 13 | null | null |
adamwalker/sylvan-haskell | Sylvan.hs | bsd-3-clause | bxor :: PrimMonad m => BDD -> BDD -> m BDD
bxor (BDD a) (BDD b) = liftM BDD $ unsafePrimToPrim $ c_xor a b | 106 | bxor :: PrimMonad m => BDD -> BDD -> m BDD
bxor (BDD a) (BDD b) = liftM BDD $ unsafePrimToPrim $ c_xor a b | 106 | bxor (BDD a) (BDD b) = liftM BDD $ unsafePrimToPrim $ c_xor a b | 63 | false | true | 0 | 11 | 24 | 66 | 30 | 36 | null | null |
FranklinChen/hugs98-plus-Sep2006 | packages/HaXml/src/Text/XML/HaXml/Html/Pretty.hs | bsd-3-clause | defaultdecl REQUIRED = text "#REQUIRED" | 49 | defaultdecl REQUIRED = text "#REQUIRED" | 49 | defaultdecl REQUIRED = text "#REQUIRED" | 49 | false | false | 0 | 5 | 14 | 12 | 5 | 7 | null | null |
olorin/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | The placement strategy.
pgStrategy :: Lens' PlacementGroup (Maybe PlacementStrategy)
pgStrategy = lens _pgStrategy (\ s a -> s{_pgStrategy = a}) | 149 | pgStrategy :: Lens' PlacementGroup (Maybe PlacementStrategy)
pgStrategy = lens _pgStrategy (\ s a -> s{_pgStrategy = a}) | 120 | pgStrategy = lens _pgStrategy (\ s a -> s{_pgStrategy = a}) | 59 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
sw17ch/json-query | Text/JSONQ.hs | bsd-3-clause | queryMany :: JSONV -> B.ByteString -> Either String [JSONV]
queryMany = undefined | 81 | queryMany :: JSONV -> B.ByteString -> Either String [JSONV]
queryMany = undefined | 81 | queryMany = undefined | 21 | false | true | 0 | 8 | 11 | 29 | 15 | 14 | null | null |
kevinjardine/gruzeSnaplet | src/Snap/Snaplet/Gruze/Box.hs | gpl-2.0 | setBool :: GrzAtomBoxClass c => GrzKey -> Bool -> c -> c
setBool k s c = setAtom k (boolToAtom s) c | 99 | setBool :: GrzAtomBoxClass c => GrzKey -> Bool -> c -> c
setBool k s c = setAtom k (boolToAtom s) c | 99 | setBool k s c = setAtom k (boolToAtom s) c | 42 | false | true | 0 | 8 | 21 | 50 | 24 | 26 | null | null |
exFalso/ProxN | src/Math/ProxN/Pretty.hs | bsd-3-clause | prettyIndent :: PrettyM a -> PrettyM a
prettyIndent pr = do
local (\(indUnit, ind) -> (indUnit, indUnit . ind)) $ pr | 118 | prettyIndent :: PrettyM a -> PrettyM a
prettyIndent pr = do
local (\(indUnit, ind) -> (indUnit, indUnit . ind)) $ pr | 118 | prettyIndent pr = do
local (\(indUnit, ind) -> (indUnit, indUnit . ind)) $ pr | 79 | false | true | 0 | 12 | 22 | 58 | 30 | 28 | null | null |
google/codeworld | codeworld-server/src/Main.hs | apache-2.0 | shareContentHandler :: CodeWorldHandler
shareContentHandler = private $ \userId ctx -> do
mode <- getBuildMode
Just shash <- getParam "shash"
sharingFolder <-
liftIO $
B.readFile
(shareRootDir mode </> shareLink (ShareId $ T.decodeUtf8 shash))
Just name <- fmap T.decodeUtf8 <$> getParam "name"
let dirPath = dirBase $ nameToDirId name
liftIO $ ensureUserBaseDir mode userId dirPath
liftIO
$ copyDirIfExists (T.unpack (T.decodeUtf8 sharingFolder))
$ userProjectDir mode userId </> dirPath
liftIO $
T.writeFile
(userProjectDir mode userId </> dirPath </> "dir.info")
name | 628 | shareContentHandler :: CodeWorldHandler
shareContentHandler = private $ \userId ctx -> do
mode <- getBuildMode
Just shash <- getParam "shash"
sharingFolder <-
liftIO $
B.readFile
(shareRootDir mode </> shareLink (ShareId $ T.decodeUtf8 shash))
Just name <- fmap T.decodeUtf8 <$> getParam "name"
let dirPath = dirBase $ nameToDirId name
liftIO $ ensureUserBaseDir mode userId dirPath
liftIO
$ copyDirIfExists (T.unpack (T.decodeUtf8 sharingFolder))
$ userProjectDir mode userId </> dirPath
liftIO $
T.writeFile
(userProjectDir mode userId </> dirPath </> "dir.info")
name | 628 | shareContentHandler = private $ \userId ctx -> do
mode <- getBuildMode
Just shash <- getParam "shash"
sharingFolder <-
liftIO $
B.readFile
(shareRootDir mode </> shareLink (ShareId $ T.decodeUtf8 shash))
Just name <- fmap T.decodeUtf8 <$> getParam "name"
let dirPath = dirBase $ nameToDirId name
liftIO $ ensureUserBaseDir mode userId dirPath
liftIO
$ copyDirIfExists (T.unpack (T.decodeUtf8 sharingFolder))
$ userProjectDir mode userId </> dirPath
liftIO $
T.writeFile
(userProjectDir mode userId </> dirPath </> "dir.info")
name | 588 | false | true | 2 | 18 | 133 | 212 | 94 | 118 | null | null |
HaskellAmbiguity/AmbiguityGenerator | src/Ambiguity.hs | mit | generateContinuous :: MonadRandom m => ContinuousState -> Int -> m [AmbiGenReal]
generateContinuous gen n = map fst <$> generateContinuousState gen n | 149 | generateContinuous :: MonadRandom m => ContinuousState -> Int -> m [AmbiGenReal]
generateContinuous gen n = map fst <$> generateContinuousState gen n | 149 | generateContinuous gen n = map fst <$> generateContinuousState gen n | 68 | false | true | 0 | 9 | 20 | 53 | 24 | 29 | null | null |
sjfloat/bloodhound | src/Database/Bloodhound/Client.hs | bsd-3-clause | parseUrl' :: MonadThrow m => Text -> m Request
parseUrl' t =
case parseURI laxURIParserOptions (T.encodeUtf8 t) of
Right uri -> setURI def uri
Left e -> throwM $ InvalidUrlException (T.unpack t) ("Invalid URL: " ++ show e) | 232 | parseUrl' :: MonadThrow m => Text -> m Request
parseUrl' t =
case parseURI laxURIParserOptions (T.encodeUtf8 t) of
Right uri -> setURI def uri
Left e -> throwM $ InvalidUrlException (T.unpack t) ("Invalid URL: " ++ show e) | 232 | parseUrl' t =
case parseURI laxURIParserOptions (T.encodeUtf8 t) of
Right uri -> setURI def uri
Left e -> throwM $ InvalidUrlException (T.unpack t) ("Invalid URL: " ++ show e) | 185 | false | true | 0 | 12 | 47 | 95 | 44 | 51 | null | null |
GaloisInc/ICryptol | src/Notebook.hs | bsd-3-clause | tdNames :: P.TopDecl P.PName -> [P.PName]
tdNames (P.Decl d) = map P.thing $ allNamesD $ P.tlValue d | 105 | tdNames :: P.TopDecl P.PName -> [P.PName]
tdNames (P.Decl d) = map P.thing $ allNamesD $ P.tlValue d | 105 | tdNames (P.Decl d) = map P.thing $ allNamesD $ P.tlValue d | 63 | false | true | 0 | 8 | 21 | 56 | 27 | 29 | null | null |
brendanhay/gogol | gogol-adsense-host/gen/Network/Google/Resource/AdSenseHost/Reports/Generate.hs | mpl-2.0 | -- | Index of the first row of report data to return.
rgStartIndex :: Lens' ReportsGenerate (Maybe Word32)
rgStartIndex
= lens _rgStartIndex (\ s a -> s{_rgStartIndex = a})
. mapping _Coerce | 198 | rgStartIndex :: Lens' ReportsGenerate (Maybe Word32)
rgStartIndex
= lens _rgStartIndex (\ s a -> s{_rgStartIndex = a})
. mapping _Coerce | 144 | rgStartIndex
= lens _rgStartIndex (\ s a -> s{_rgStartIndex = a})
. mapping _Coerce | 91 | true | true | 0 | 10 | 39 | 55 | 28 | 27 | null | null |
leshchevds/ganeti | src/Ganeti/Query/Network.hs | bsd-2-clause | -- | Helper function that checks if an instance is linked to the given network.
instIsConnected :: String -> Instance -> Bool
instIsConnected network_uuid inst =
network_uuid `elem` mapMaybe nicNetwork (instNics inst) | 219 | instIsConnected :: String -> Instance -> Bool
instIsConnected network_uuid inst =
network_uuid `elem` mapMaybe nicNetwork (instNics inst) | 139 | instIsConnected network_uuid inst =
network_uuid `elem` mapMaybe nicNetwork (instNics inst) | 93 | true | true | 0 | 8 | 33 | 49 | 24 | 25 | null | null |
ocharles/hackage-server | Distribution/Server/Framework/CacheControl.hs | bsd-3-clause | axAgeMonths n = MaxAge (n * 60 * 60 * 24 * 30)
| 48 | maxAgeMonths n = MaxAge (n * 60 * 60 * 24 * 30) | 48 | maxAgeMonths n = MaxAge (n * 60 * 60 * 24 * 30) | 48 | false | false | 0 | 10 | 14 | 31 | 15 | 16 | null | null |
fehrenbach/rechts | app/Parser.hs | gpl-3.0 | lexeme :: Parser a -> Parser a
lexeme = L.lexeme sc | 51 | lexeme :: Parser a -> Parser a
lexeme = L.lexeme sc | 51 | lexeme = L.lexeme sc | 20 | false | true | 0 | 7 | 10 | 32 | 13 | 19 | null | null |
tolysz/prepare-ghcjs | spec-lts8/aeson/tests/DataFamilies/Encoders.hs | bsd-3-clause | gSomeTypeToEncoding2ElemArray :: SomeType c () Int -> Encoding
gSomeTypeToEncoding2ElemArray = genericToEncoding opts2ElemArray | 127 | gSomeTypeToEncoding2ElemArray :: SomeType c () Int -> Encoding
gSomeTypeToEncoding2ElemArray = genericToEncoding opts2ElemArray | 127 | gSomeTypeToEncoding2ElemArray = genericToEncoding opts2ElemArray | 64 | false | true | 0 | 7 | 11 | 27 | 13 | 14 | null | null |
kylcarte/ixfunctors | src/Data/IxFunctor/Coapply.hs | bsd-3-clause | (<@@>) :: IxCoapply w => w j k (a -> b) -> w i k a -> w i j b
(<@@>) = icoap | 76 | (<@@>) :: IxCoapply w => w j k (a -> b) -> w i k a -> w i j b
(<@@>) = icoap | 76 | (<@@>) = icoap | 14 | false | true | 0 | 9 | 23 | 58 | 30 | 28 | null | null |
abailly/hevents | src/Hevents/Eff/Store/FileOps.hs | mit | runOp OpLoad (Just h) = do
pos <- hTell h
hSeek h SeekFromEnd 0
sz <- hTell h
hSeek h AbsoluteSeek 0
opres <- (LoadSucceed <$> readAll h sz)
`catch` \ (ex :: IOException) -> return (OpFailed $ "exception " <> show ex <> " while loading events")
hSeek h AbsoluteSeek pos
return opres
where
readAll :: (?currentVersion :: Version, Versionable s) => Handle -> Integer -> IO [s]
readAll hdl sz = if sz > 0 then
do
(loaded,ln) <- doLoad hdl
case loaded of
Right e -> do
es <- readAll hdl (sz - ln)
return $ e : es
Left err -> fail err
else
return [] | 853 | runOp OpLoad (Just h) = do
pos <- hTell h
hSeek h SeekFromEnd 0
sz <- hTell h
hSeek h AbsoluteSeek 0
opres <- (LoadSucceed <$> readAll h sz)
`catch` \ (ex :: IOException) -> return (OpFailed $ "exception " <> show ex <> " while loading events")
hSeek h AbsoluteSeek pos
return opres
where
readAll :: (?currentVersion :: Version, Versionable s) => Handle -> Integer -> IO [s]
readAll hdl sz = if sz > 0 then
do
(loaded,ln) <- doLoad hdl
case loaded of
Right e -> do
es <- readAll hdl (sz - ln)
return $ e : es
Left err -> fail err
else
return [] | 853 | runOp OpLoad (Just h) = do
pos <- hTell h
hSeek h SeekFromEnd 0
sz <- hTell h
hSeek h AbsoluteSeek 0
opres <- (LoadSucceed <$> readAll h sz)
`catch` \ (ex :: IOException) -> return (OpFailed $ "exception " <> show ex <> " while loading events")
hSeek h AbsoluteSeek pos
return opres
where
readAll :: (?currentVersion :: Version, Versionable s) => Handle -> Integer -> IO [s]
readAll hdl sz = if sz > 0 then
do
(loaded,ln) <- doLoad hdl
case loaded of
Right e -> do
es <- readAll hdl (sz - ln)
return $ e : es
Left err -> fail err
else
return [] | 853 | false | false | 0 | 18 | 418 | 268 | 128 | 140 | null | null |
lambdageek/indentation | indentation-core/src/Text/Parser/Indentation/Implementation.hs | bsd-3-clause | ignoreAbsoluteIndentation :: LocalState a -> a -> a
ignoreAbsoluteIndentation localState = localState pre post where
pre i1 = i1 { absMode = False }
post i1 i2 = i2 { absMode = absMode i1 }
| 199 | ignoreAbsoluteIndentation :: LocalState a -> a -> a
ignoreAbsoluteIndentation localState = localState pre post where
pre i1 = i1 { absMode = False }
post i1 i2 = i2 { absMode = absMode i1 }
| 199 | ignoreAbsoluteIndentation localState = localState pre post where
pre i1 = i1 { absMode = False }
post i1 i2 = i2 { absMode = absMode i1 }
| 147 | false | true | 0 | 9 | 44 | 69 | 35 | 34 | null | null |
mainland/dph | dph-lifted-vseg/Data/Array/Parallel/PArray/Scalar.hs | bsd-3-clause | zipWith :: (Scalar a, Scalar b, Scalar c)
=> (a -> b -> c) -> PArray a -> PArray b -> PArray c
zipWith f (PArray len xs) (PArray _ ys)
= PArray len $ to $ U.zipWith f (from xs) (from ys) | 203 | zipWith :: (Scalar a, Scalar b, Scalar c)
=> (a -> b -> c) -> PArray a -> PArray b -> PArray c
zipWith f (PArray len xs) (PArray _ ys)
= PArray len $ to $ U.zipWith f (from xs) (from ys) | 202 | zipWith f (PArray len xs) (PArray _ ys)
= PArray len $ to $ U.zipWith f (from xs) (from ys) | 99 | false | true | 0 | 9 | 59 | 119 | 58 | 61 | null | null |
jaalonso/I1M-Cod-Temas | src/Tema_20/ColaDePrioridadConMonticulos.hs | gpl-2.0 | -- (resto c) elimina la cabeza de la cola de prioridad c. Por ejemplo,
-- λ> resto (foldr inserta vacia [3,1,7,2,9])
-- CP (M 2 2
-- (M 9 1 Vacio Vacio)
-- (M 3 1
-- (M 7 1 Vacio Vacio) Vacio))
resto :: Ord a => CPrioridad a -> CPrioridad a
resto (CP c) = CP (M.resto c) | 306 | resto :: Ord a => CPrioridad a -> CPrioridad a
resto (CP c) = CP (M.resto c) | 76 | resto (CP c) = CP (M.resto c) | 29 | true | true | 0 | 10 | 95 | 59 | 29 | 30 | null | null |
graninas/Haskell-Algorithms | Tests/Curring.hs | gpl-3.0 | urringTest = apply show
| 24 | curringTest = apply show | 24 | curringTest = apply show | 24 | false | false | 1 | 5 | 4 | 13 | 4 | 9 | null | null |
snoyberg/ghc | testsuite/tests/concurrent/should_run/hs_try_putmvar003.hs | bsd-3-clause | callbackPutMVar :: StablePtr PrimMVar -> IO ()
callbackPutMVar sp = do
mvar <- deRefStablePtr sp
void $ tryPutMVar (MVar (unsafeCoerce# mvar)) () | 149 | callbackPutMVar :: StablePtr PrimMVar -> IO ()
callbackPutMVar sp = do
mvar <- deRefStablePtr sp
void $ tryPutMVar (MVar (unsafeCoerce# mvar)) () | 149 | callbackPutMVar sp = do
mvar <- deRefStablePtr sp
void $ tryPutMVar (MVar (unsafeCoerce# mvar)) () | 102 | false | true | 0 | 12 | 25 | 62 | 28 | 34 | null | null |
innovimax/bond | compiler/Bond/Template/TypeMapping.hs | mit | cppType BT_UInt64 = pure "uint64_t" | 35 | cppType BT_UInt64 = pure "uint64_t" | 35 | cppType BT_UInt64 = pure "uint64_t" | 35 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
philipturnbull/quenelle | src/Main.hs | gpl-2.0 | oldSGR = [SetColor Foreground Dull Red] | 39 | oldSGR = [SetColor Foreground Dull Red] | 39 | oldSGR = [SetColor Foreground Dull Red] | 39 | false | false | 0 | 6 | 5 | 16 | 8 | 8 | null | null |
kishoredbn/barrelfish | tools/flounder/LMP.hs | mit | lmp_header_body :: String -> Interface -> [C.Unit]
lmp_header_body infile interface@(Interface name descr decls) = [
intf_preamble infile name descr,
C.Blank,
C.MultiComment [ "LMP interconnect driver" ],
C.Blank,
C.Include C.Standard "barrelfish/lmp_chan.h",
C.Blank,
lmp_binding_struct name,
C.Blank,
lmp_init_function_proto name,
lmp_destroy_function_proto name,
lmp_bind_function_proto name,
lmp_connect_handler_proto name,
lmp_ep_create_function_proto name,
lmp_ep_bind_function_proto name,
lmp_rx_handler_proto name,
C.Blank
] | 600 | lmp_header_body :: String -> Interface -> [C.Unit]
lmp_header_body infile interface@(Interface name descr decls) = [
intf_preamble infile name descr,
C.Blank,
C.MultiComment [ "LMP interconnect driver" ],
C.Blank,
C.Include C.Standard "barrelfish/lmp_chan.h",
C.Blank,
lmp_binding_struct name,
C.Blank,
lmp_init_function_proto name,
lmp_destroy_function_proto name,
lmp_bind_function_proto name,
lmp_connect_handler_proto name,
lmp_ep_create_function_proto name,
lmp_ep_bind_function_proto name,
lmp_rx_handler_proto name,
C.Blank
] | 600 | lmp_header_body infile interface@(Interface name descr decls) = [
intf_preamble infile name descr,
C.Blank,
C.MultiComment [ "LMP interconnect driver" ],
C.Blank,
C.Include C.Standard "barrelfish/lmp_chan.h",
C.Blank,
lmp_binding_struct name,
C.Blank,
lmp_init_function_proto name,
lmp_destroy_function_proto name,
lmp_bind_function_proto name,
lmp_connect_handler_proto name,
lmp_ep_create_function_proto name,
lmp_ep_bind_function_proto name,
lmp_rx_handler_proto name,
C.Blank
] | 549 | false | true | 0 | 8 | 117 | 148 | 78 | 70 | null | null |
jwiegley/hnix | src/Nix/Render/Frame.hs | bsd-3-clause | renderFrames
:: forall v t f e m ann
. ( MonadReader e m
, Has e Options
, MonadFile m
, MonadCitedThunks t f m
, Typeable v
)
=> Frames
-> m (Doc ann)
renderFrames [] = pure mempty | 221 | renderFrames
:: forall v t f e m ann
. ( MonadReader e m
, Has e Options
, MonadFile m
, MonadCitedThunks t f m
, Typeable v
)
=> Frames
-> m (Doc ann)
renderFrames [] = pure mempty | 221 | renderFrames [] = pure mempty | 35 | false | true | 0 | 11 | 80 | 87 | 45 | 42 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Mediawiki.hs | gpl-2.0 | regex_'3d'7b1'2c3'7d_'2a'24 = compileRegex True "={1,3} *$" | 59 | regex_'3d'7b1'2c3'7d_'2a'24 = compileRegex True "={1,3} *$" | 59 | regex_'3d'7b1'2c3'7d_'2a'24 = compileRegex True "={1,3} *$" | 59 | false | false | 0 | 5 | 5 | 11 | 5 | 6 | null | null |
zachsully/hakaru | haskell/Language/Hakaru/Evaluation/DisintegrationMonad.hs | bsd-3-clause | -- | Plug a term into a context. That is, the 'statements' of the
-- context specifies a program with a hole in it; so we plug the
-- given term into that hole, returning the complete program.
residualizeListContext
:: forall abt a
. (ABT Term abt)
=> ListContext abt 'Impure
-> Assocs (abt '[])
-> abt '[] ('HMeasure a)
-> abt '[] ('HMeasure a)
residualizeListContext ss rho e0 =
-- N.B., we use a left fold because the head of the list of
-- statements is the one closest to the hole.
#ifdef __TRACE_DISINTEGRATE__
trace ("e0: " ++ show (pretty e0) ++ "\n"
++ show (pretty_Statements (statements ss))) $
#endif
foldl step (plugs rho e0) (statements ss)
where
step
:: abt '[] ('HMeasure a)
-> Statement abt Location 'Impure
-> abt '[] ('HMeasure a)
step e s =
#ifdef __TRACE_DISINTEGRATE__
trace ("wrapping " ++ show (ppStatement 0 s) ++ "\n"
++ "around term " ++ show (pretty e)) $
#endif
case s of
SBind (Location x) body _ ->
-- TODO: if @body@ is dirac, then treat as 'SLet'
syn (MBind :$ plugs rho (fromLazy body) :* bind x e :* End)
SLet (Location x) body _
| not (x `memberVarSet` freeVars e) ->
#ifdef __TRACE_DISINTEGRATE__
trace ("could not find location " ++ show x ++ "\n"
++ "in term " ++ show (pretty e) ++ "\n"
++ "given rho " ++ show (prettyAssocs rho)) $
#endif
e
-- TODO: if used exactly once in @e@, then inline.
| otherwise ->
case getLazyVariable body of
Just y -> plug x (plugs rho (var y)) e
Nothing ->
case getLazyLiteral body of
Just v -> plug x (syn $ Literal_ v) e
Nothing ->
syn (Let_ :$ plugs rho (fromLazy body) :* bind x e :* End)
SGuard xs pat scrutinee _ ->
syn $ Case_ (plugs rho $ fromLazy scrutinee)
[ Branch pat (binds_ (fromLocations1 xs) e)
, Branch PWild (P.reject $ typeOf e)
]
SWeight body _ -> syn $ Superpose_ ((plugs rho $ fromLazy body, e) :| [])
----------------------------------------------------------------
-- An extra is a variable *use* instantiated at some list of indices. | 2,445 | residualizeListContext
:: forall abt a
. (ABT Term abt)
=> ListContext abt 'Impure
-> Assocs (abt '[])
-> abt '[] ('HMeasure a)
-> abt '[] ('HMeasure a)
residualizeListContext ss rho e0 =
-- N.B., we use a left fold because the head of the list of
-- statements is the one closest to the hole.
#ifdef __TRACE_DISINTEGRATE__
trace ("e0: " ++ show (pretty e0) ++ "\n"
++ show (pretty_Statements (statements ss))) $
#endif
foldl step (plugs rho e0) (statements ss)
where
step
:: abt '[] ('HMeasure a)
-> Statement abt Location 'Impure
-> abt '[] ('HMeasure a)
step e s =
#ifdef __TRACE_DISINTEGRATE__
trace ("wrapping " ++ show (ppStatement 0 s) ++ "\n"
++ "around term " ++ show (pretty e)) $
#endif
case s of
SBind (Location x) body _ ->
-- TODO: if @body@ is dirac, then treat as 'SLet'
syn (MBind :$ plugs rho (fromLazy body) :* bind x e :* End)
SLet (Location x) body _
| not (x `memberVarSet` freeVars e) ->
#ifdef __TRACE_DISINTEGRATE__
trace ("could not find location " ++ show x ++ "\n"
++ "in term " ++ show (pretty e) ++ "\n"
++ "given rho " ++ show (prettyAssocs rho)) $
#endif
e
-- TODO: if used exactly once in @e@, then inline.
| otherwise ->
case getLazyVariable body of
Just y -> plug x (plugs rho (var y)) e
Nothing ->
case getLazyLiteral body of
Just v -> plug x (syn $ Literal_ v) e
Nothing ->
syn (Let_ :$ plugs rho (fromLazy body) :* bind x e :* End)
SGuard xs pat scrutinee _ ->
syn $ Case_ (plugs rho $ fromLazy scrutinee)
[ Branch pat (binds_ (fromLocations1 xs) e)
, Branch PWild (P.reject $ typeOf e)
]
SWeight body _ -> syn $ Superpose_ ((plugs rho $ fromLazy body, e) :| [])
----------------------------------------------------------------
-- An extra is a variable *use* instantiated at some list of indices. | 2,252 | residualizeListContext ss rho e0 =
-- N.B., we use a left fold because the head of the list of
-- statements is the one closest to the hole.
#ifdef __TRACE_DISINTEGRATE__
trace ("e0: " ++ show (pretty e0) ++ "\n"
++ show (pretty_Statements (statements ss))) $
#endif
foldl step (plugs rho e0) (statements ss)
where
step
:: abt '[] ('HMeasure a)
-> Statement abt Location 'Impure
-> abt '[] ('HMeasure a)
step e s =
#ifdef __TRACE_DISINTEGRATE__
trace ("wrapping " ++ show (ppStatement 0 s) ++ "\n"
++ "around term " ++ show (pretty e)) $
#endif
case s of
SBind (Location x) body _ ->
-- TODO: if @body@ is dirac, then treat as 'SLet'
syn (MBind :$ plugs rho (fromLazy body) :* bind x e :* End)
SLet (Location x) body _
| not (x `memberVarSet` freeVars e) ->
#ifdef __TRACE_DISINTEGRATE__
trace ("could not find location " ++ show x ++ "\n"
++ "in term " ++ show (pretty e) ++ "\n"
++ "given rho " ++ show (prettyAssocs rho)) $
#endif
e
-- TODO: if used exactly once in @e@, then inline.
| otherwise ->
case getLazyVariable body of
Just y -> plug x (plugs rho (var y)) e
Nothing ->
case getLazyLiteral body of
Just v -> plug x (syn $ Literal_ v) e
Nothing ->
syn (Let_ :$ plugs rho (fromLazy body) :* bind x e :* End)
SGuard xs pat scrutinee _ ->
syn $ Case_ (plugs rho $ fromLazy scrutinee)
[ Branch pat (binds_ (fromLocations1 xs) e)
, Branch PWild (P.reject $ typeOf e)
]
SWeight body _ -> syn $ Superpose_ ((plugs rho $ fromLazy body, e) :| [])
----------------------------------------------------------------
-- An extra is a variable *use* instantiated at some list of indices. | 2,074 | true | true | 0 | 25 | 871 | 700 | 343 | 357 | null | null |
jwoudenberg/elm-editor-tools | app/ResolveModule.hs | bsd-3-clause | usage :: String
usage = "Usage:\n elm-resolve-module <from-path> <module-name>" | 80 | usage :: String
usage = "Usage:\n elm-resolve-module <from-path> <module-name>" | 80 | usage = "Usage:\n elm-resolve-module <from-path> <module-name>" | 64 | false | true | 0 | 4 | 9 | 11 | 6 | 5 | null | null |
jaccokrijnen/leksah | src/IDE/Pane/SourceBuffer.hs | gpl-2.0 | fileSaveAll :: MonadIDE m => (IDEBuffer -> m Bool) -> m Bool
fileSaveAll filterFunc = do
bufs <- allBuffers
filtered <- filterM filterFunc bufs
results <- forM filtered (\buf -> inBufContext False buf (fileSaveBuffer False))
return $ True `elem` results | 274 | fileSaveAll :: MonadIDE m => (IDEBuffer -> m Bool) -> m Bool
fileSaveAll filterFunc = do
bufs <- allBuffers
filtered <- filterM filterFunc bufs
results <- forM filtered (\buf -> inBufContext False buf (fileSaveBuffer False))
return $ True `elem` results | 274 | fileSaveAll filterFunc = do
bufs <- allBuffers
filtered <- filterM filterFunc bufs
results <- forM filtered (\buf -> inBufContext False buf (fileSaveBuffer False))
return $ True `elem` results | 213 | false | true | 0 | 13 | 60 | 103 | 49 | 54 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'VGM.unsafeWrite'
vgm_unsafeWrite = VGM.unsafeWrite | 55 | vgm_unsafeWrite = VGM.unsafeWrite | 33 | vgm_unsafeWrite = VGM.unsafeWrite | 33 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
droundy/franchise | Distribution/Franchise/GhcState.hs | bsd-3-clause | getCFlags :: C [String]
getCFlags = getExtra "cflags" | 53 | getCFlags :: C [String]
getCFlags = getExtra "cflags" | 53 | getCFlags = getExtra "cflags" | 29 | false | true | 0 | 7 | 7 | 25 | 11 | 14 | null | null |
sdiehl/ghc | testsuite/tests/plugins/hole-fit-plugin/HoleFitPlugin.hs | bsd-3-clause | holeFitP :: [CommandLineOption] -> Maybe HoleFitPluginR
holeFitP opts = Just (HoleFitPluginR initP pluginDef stopP)
where initP = initPlugin opts
stopP = const $ return ()
pluginDef ref = HoleFitPlugin { candPlugin = modFilterTimeoutP opts ref
, fitPlugin = modSortP opts ref } | 334 | holeFitP :: [CommandLineOption] -> Maybe HoleFitPluginR
holeFitP opts = Just (HoleFitPluginR initP pluginDef stopP)
where initP = initPlugin opts
stopP = const $ return ()
pluginDef ref = HoleFitPlugin { candPlugin = modFilterTimeoutP opts ref
, fitPlugin = modSortP opts ref } | 334 | holeFitP opts = Just (HoleFitPluginR initP pluginDef stopP)
where initP = initPlugin opts
stopP = const $ return ()
pluginDef ref = HoleFitPlugin { candPlugin = modFilterTimeoutP opts ref
, fitPlugin = modSortP opts ref } | 278 | false | true | 2 | 9 | 98 | 95 | 47 | 48 | null | null |
WojciechKarpiel/cayley-dickson | src/Lib.hs | bsd-3-clause | callWithEqualNestedness fn a b = fn a b | 39 | callWithEqualNestedness fn a b = fn a b | 39 | callWithEqualNestedness fn a b = fn a b | 39 | false | false | 0 | 5 | 7 | 18 | 8 | 10 | null | null |
tjakway/ghcjvm | compiler/specialise/Rules.hs | bsd-3-clause | ruleCheck env (Case e _ _ as) = ruleCheck env e `unionBags`
unionManyBags [ruleCheck env r | (_,_,r) <- as] | 139 | ruleCheck env (Case e _ _ as) = ruleCheck env e `unionBags`
unionManyBags [ruleCheck env r | (_,_,r) <- as] | 139 | ruleCheck env (Case e _ _ as) = ruleCheck env e `unionBags`
unionManyBags [ruleCheck env r | (_,_,r) <- as] | 139 | false | false | 0 | 10 | 51 | 63 | 32 | 31 | null | null |
bitemyapp/wreq | tests/AWS/S3.hs | bsd-3-clause | -- Path based bucket access
createBucket :: MkURL -> String -> String -> Options -> IO ()
createBucket url prefix region baseopts = do
r <- putWith baseopts (url region prefix "testbucket") $
locationConstraint region
assertBool "createBucket 200" $ r ^. responseStatus . statusCode == 200
assertBool "createBucket OK" $ r ^. responseStatus . statusMessage == "OK" | 379 | createBucket :: MkURL -> String -> String -> Options -> IO ()
createBucket url prefix region baseopts = do
r <- putWith baseopts (url region prefix "testbucket") $
locationConstraint region
assertBool "createBucket 200" $ r ^. responseStatus . statusCode == 200
assertBool "createBucket OK" $ r ^. responseStatus . statusMessage == "OK" | 351 | createBucket url prefix region baseopts = do
r <- putWith baseopts (url region prefix "testbucket") $
locationConstraint region
assertBool "createBucket 200" $ r ^. responseStatus . statusCode == 200
assertBool "createBucket OK" $ r ^. responseStatus . statusMessage == "OK" | 289 | true | true | 0 | 11 | 71 | 115 | 54 | 61 | null | null |
silver-lang/silver | src/Silver/Compiler/MonadSilver.hs | bsd-3-clause | -- | run the silver monad to get an either
runSilver :: Silver a -> IO (Either SilverError a)
runSilver s = runExceptT $ do
-- run the state monad, and see if there were any errors
(result,errors) <- runStateT (unSilver s) []
-- if there were any collected errors, throw them
case errors of
[] -> return result
errs -> throwError $ ErrorList errs
-- | This is machinery to allow monads to automatically collect errors. | 435 | runSilver :: Silver a -> IO (Either SilverError a)
runSilver s = runExceptT $ do
-- run the state monad, and see if there were any errors
(result,errors) <- runStateT (unSilver s) []
-- if there were any collected errors, throw them
case errors of
[] -> return result
errs -> throwError $ ErrorList errs
-- | This is machinery to allow monads to automatically collect errors. | 392 | runSilver s = runExceptT $ do
-- run the state monad, and see if there were any errors
(result,errors) <- runStateT (unSilver s) []
-- if there were any collected errors, throw them
case errors of
[] -> return result
errs -> throwError $ ErrorList errs
-- | This is machinery to allow monads to automatically collect errors. | 341 | true | true | 0 | 13 | 93 | 102 | 49 | 53 | null | null |
facebookincubator/duckling | Duckling/Time/SV/Rules.hs | bsd-3-clause | ruleDurationFromNow :: Rule
ruleDurationFromNow = Rule
{ name = "<duration> from now"
, pattern =
[ dimension Duration
, regex "från (idag|nu)"
]
, prod = \tokens -> case tokens of
(Token Duration dd:_) ->
tt $ inDuration dd
_ -> Nothing
} | 279 | ruleDurationFromNow :: Rule
ruleDurationFromNow = Rule
{ name = "<duration> from now"
, pattern =
[ dimension Duration
, regex "från (idag|nu)"
]
, prod = \tokens -> case tokens of
(Token Duration dd:_) ->
tt $ inDuration dd
_ -> Nothing
} | 279 | ruleDurationFromNow = Rule
{ name = "<duration> from now"
, pattern =
[ dimension Duration
, regex "från (idag|nu)"
]
, prod = \tokens -> case tokens of
(Token Duration dd:_) ->
tt $ inDuration dd
_ -> Nothing
} | 251 | false | true | 0 | 14 | 82 | 87 | 46 | 41 | null | null |
da-x/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | pprStmt (LetStmt binds) = hsep [ptext (sLit "let"), pprBinds binds] | 77 | pprStmt (LetStmt binds) = hsep [ptext (sLit "let"), pprBinds binds] | 77 | pprStmt (LetStmt binds) = hsep [ptext (sLit "let"), pprBinds binds] | 77 | false | false | 0 | 9 | 19 | 37 | 17 | 20 | null | null |
triplepointfive/hogldev | tutorial30/Tutorial30.hs | mit | initializeGlutCallbacks :: Mesh
-> LightingTechnique
-> IORef GLfloat
-> IORef Camera
-> IORef Bool
-> Texture
-> Texture
-> Texture
-> IO ()
initializeGlutCallbacks boxMesh lightingEffect gScale cameraRef bampMapRef texture normalMap trivialNormalMap = do
displayCallback $=
renderSceneCB boxMesh lightingEffect gScale cameraRef bampMapRef texture normalMap trivialNormalMap
idleCallback $= Just (idleCB gScale cameraRef)
specialCallback $= Just (specialKeyboardCB cameraRef)
keyboardCallback $= Just (keyboardCB bampMapRef)
passiveMotionCallback $= Just (passiveMotionCB cameraRef) | 806 | initializeGlutCallbacks :: Mesh
-> LightingTechnique
-> IORef GLfloat
-> IORef Camera
-> IORef Bool
-> Texture
-> Texture
-> Texture
-> IO ()
initializeGlutCallbacks boxMesh lightingEffect gScale cameraRef bampMapRef texture normalMap trivialNormalMap = do
displayCallback $=
renderSceneCB boxMesh lightingEffect gScale cameraRef bampMapRef texture normalMap trivialNormalMap
idleCallback $= Just (idleCB gScale cameraRef)
specialCallback $= Just (specialKeyboardCB cameraRef)
keyboardCallback $= Just (keyboardCB bampMapRef)
passiveMotionCallback $= Just (passiveMotionCB cameraRef) | 806 | initializeGlutCallbacks boxMesh lightingEffect gScale cameraRef bampMapRef texture normalMap trivialNormalMap = do
displayCallback $=
renderSceneCB boxMesh lightingEffect gScale cameraRef bampMapRef texture normalMap trivialNormalMap
idleCallback $= Just (idleCB gScale cameraRef)
specialCallback $= Just (specialKeyboardCB cameraRef)
keyboardCallback $= Just (keyboardCB bampMapRef)
passiveMotionCallback $= Just (passiveMotionCB cameraRef) | 472 | false | true | 0 | 15 | 288 | 169 | 76 | 93 | null | null |
spanners/cis194 | 05-type-classes/calculator.hs | unlicense | testExp ∷ Expr a ⇒ Maybe a
testExp = parseExp lit add mul "(3 * -4) + 5" | 72 | testExp ∷ Expr a ⇒ Maybe a
testExp = parseExp lit add mul "(3 * -4) + 5" | 72 | testExp = parseExp lit add mul "(3 * -4) + 5" | 45 | false | true | 0 | 6 | 17 | 30 | 14 | 16 | null | null |
energyflowanalysis/efa-2.1 | sandbox/lagrange/Main.hs | bsd-3-clause | pts :: [(Double, Double)]
pts = [
(1.0, 0.416),
(4.0, 1.041),
(6.0, 1.255),
(8.0, 1.359),
(10.0, 1.416) ] | 115 | pts :: [(Double, Double)]
pts = [
(1.0, 0.416),
(4.0, 1.041),
(6.0, 1.255),
(8.0, 1.359),
(10.0, 1.416) ] | 115 | pts = [
(1.0, 0.416),
(4.0, 1.041),
(6.0, 1.255),
(8.0, 1.359),
(10.0, 1.416) ] | 89 | false | true | 0 | 8 | 27 | 72 | 43 | 29 | null | null |
ckaestne/CIDE | other/CaseStudies/Arith/orig_armin/all/CLI_linux.hs | gpl-3.0 | stringLiteral = PT.stringLiteral lexer | 40 | stringLiteral = PT.stringLiteral lexer | 40 | stringLiteral = PT.stringLiteral lexer | 40 | false | false | 1 | 6 | 5 | 14 | 5 | 9 | null | null |
vasily-kartashov/playground | euler/problem-027.hs | apache-2.0 | primeSeq (a, b) = takeWhile isPrime $ takeWhile (> 0) $ map (\n -> n * n + a * n + b) [0..] | 91 | primeSeq (a, b) = takeWhile isPrime $ takeWhile (> 0) $ map (\n -> n * n + a * n + b) [0..] | 91 | primeSeq (a, b) = takeWhile isPrime $ takeWhile (> 0) $ map (\n -> n * n + a * n + b) [0..] | 91 | false | false | 0 | 12 | 23 | 65 | 34 | 31 | null | null |
tidalcycles/tidal-midi | Sound/Tidal/MIDI/Tetra.hs | gpl-3.0 | lfosaw = doublePattern 2 | 24 | lfosaw = doublePattern 2 | 24 | lfosaw = doublePattern 2 | 24 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
sajith/accelerate | Data/Array/Accelerate/Language.hs | bsd-3-clause | -- Permutations
-- ------------
-- |Forward permutation specified by an index mapping. The result array is
-- initialised with the given defaults and any further values that are permuted
-- into the result array are added to the current value using the given
-- combination function.
--
-- The combination function must be /associative/. Eltents that are mapped to
-- the magic value 'ignore' by the permutation function are being dropped.
--
permute :: (Shape ix, Shape ix', Elt a)
=> (Exp a -> Exp a -> Exp a) -- ^combination function
-> Acc (Array ix' a) -- ^array of default values
-> (Exp ix -> Exp ix') -- ^permutation
-> Acc (Array ix a) -- ^permuted array
-> Acc (Array ix' a)
permute = Acc $$$$ Permute | 789 | permute :: (Shape ix, Shape ix', Elt a)
=> (Exp a -> Exp a -> Exp a) -- ^combination function
-> Acc (Array ix' a) -- ^array of default values
-> (Exp ix -> Exp ix') -- ^permutation
-> Acc (Array ix a) -- ^permuted array
-> Acc (Array ix' a)
permute = Acc $$$$ Permute | 343 | permute = Acc $$$$ Permute | 26 | true | true | 2 | 13 | 205 | 139 | 72 | 67 | null | null |
jthornber/rxgen | Main.hs | gpl-3.0 | simplify' (Quest r) = Quest (simplify' r) | 49 | simplify' (Quest r) = Quest (simplify' r) | 49 | simplify' (Quest r) = Quest (simplify' r) | 49 | false | false | 0 | 7 | 14 | 25 | 11 | 14 | null | null |
urbanslug/ghc | testsuite/tests/perf/should_run/T4474b.hs | bsd-3-clause | flatListNaive (Leaf n) = [n] | 30 | flatListNaive (Leaf n) = [n] | 30 | flatListNaive (Leaf n) = [n] | 30 | false | false | 0 | 7 | 6 | 18 | 9 | 9 | null | null |
overminder/hs-mini-kanren | type-inference-simpl/src/Example.hs | bsd-3-clause | s = Lam ["f", "g", "x"] $ ("f" `App` "x") `App` ("g" `App` "x") | 63 | s = Lam ["f", "g", "x"] $ ("f" `App` "x") `App` ("g" `App` "x") | 63 | s = Lam ["f", "g", "x"] $ ("f" `App` "x") `App` ("g" `App` "x") | 63 | false | false | 1 | 8 | 13 | 49 | 28 | 21 | null | null |
bvdelft/parac2 | src/Language/Java/Paragon/NameResolution.hs | bsd-3-clause | rnClause :: Resolve Clause
rnClause (Clause pos qs a as) = do
let ps = [ pI | ClauseVarDecl _ _ pI <- qs ]
ap = case a of
ClauseDeclHead _ (ClauseVarDecl _ _ pI) -> (pI:)
_ -> id
qualsE = expandAll $ newER { expandExps = ap ps }
extendExpansion qualsE $
Clause pos <$> mapM rnClauseVarDecl qs <*> rnClauseHead a <*> mapM rnAtom as | 390 | rnClause :: Resolve Clause
rnClause (Clause pos qs a as) = do
let ps = [ pI | ClauseVarDecl _ _ pI <- qs ]
ap = case a of
ClauseDeclHead _ (ClauseVarDecl _ _ pI) -> (pI:)
_ -> id
qualsE = expandAll $ newER { expandExps = ap ps }
extendExpansion qualsE $
Clause pos <$> mapM rnClauseVarDecl qs <*> rnClauseHead a <*> mapM rnAtom as | 390 | rnClause (Clause pos qs a as) = do
let ps = [ pI | ClauseVarDecl _ _ pI <- qs ]
ap = case a of
ClauseDeclHead _ (ClauseVarDecl _ _ pI) -> (pI:)
_ -> id
qualsE = expandAll $ newER { expandExps = ap ps }
extendExpansion qualsE $
Clause pos <$> mapM rnClauseVarDecl qs <*> rnClauseHead a <*> mapM rnAtom as | 363 | false | true | 0 | 15 | 127 | 154 | 75 | 79 | null | null |
sol/pandoc | src/Text/Pandoc/Readers/HTML.hs | gpl-2.0 | pHrule :: TagParser [Block]
pHrule = do
pSelfClosing (=="hr") (const True)
return [HorizontalRule] | 102 | pHrule :: TagParser [Block]
pHrule = do
pSelfClosing (=="hr") (const True)
return [HorizontalRule] | 102 | pHrule = do
pSelfClosing (=="hr") (const True)
return [HorizontalRule] | 74 | false | true | 0 | 9 | 16 | 44 | 22 | 22 | null | null |
erochest/stat-nlp | src/StatNLP/Text/Utils.hs | apache-2.0 | ngramsV :: Int -> V.Vector a -> [V.Vector a]
ngramsV n vs = map (\i -> V.slice i n vs) [0..(V.length vs - n - 1)] | 113 | ngramsV :: Int -> V.Vector a -> [V.Vector a]
ngramsV n vs = map (\i -> V.slice i n vs) [0..(V.length vs - n - 1)] | 113 | ngramsV n vs = map (\i -> V.slice i n vs) [0..(V.length vs - n - 1)] | 68 | false | true | 0 | 11 | 25 | 80 | 40 | 40 | null | null |
tmcgilchrist/hashids-haskell | Web/Hashids.hs | mit | encodeUsingSalt :: ByteString -- ^ Salt
-> Int -- ^ Number
-> ByteString
encodeUsingSalt = encode . hashidsSimple | 160 | encodeUsingSalt :: ByteString -- ^ Salt
-> Int -- ^ Number
-> ByteString
encodeUsingSalt = encode . hashidsSimple | 160 | encodeUsingSalt = encode . hashidsSimple | 40 | false | true | 0 | 6 | 64 | 25 | 14 | 11 | null | null |
kim/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types.hs | mpl-2.0 | -- | The ID of the Reserved Instance.
rilReservedInstancesId :: Lens' ReservedInstancesListing (Maybe Text)
rilReservedInstancesId =
lens _rilReservedInstancesId (\s a -> s { _rilReservedInstancesId = a }) | 209 | rilReservedInstancesId :: Lens' ReservedInstancesListing (Maybe Text)
rilReservedInstancesId =
lens _rilReservedInstancesId (\s a -> s { _rilReservedInstancesId = a }) | 171 | rilReservedInstancesId =
lens _rilReservedInstancesId (\s a -> s { _rilReservedInstancesId = a }) | 101 | true | true | 1 | 9 | 30 | 52 | 25 | 27 | null | null |
beni55/LambdaHack | Game/LambdaHack/Client/CommonClient.hs | bsd-3-clause | partActorLeader :: MonadClient m => ActorId -> Actor -> m MU.Part
partActorLeader aid b = do
mleader <- getsClient _sleader
return $! case mleader of
Just leader | aid == leader -> "you"
_ -> partActor b
-- | The part of speech with the actor's pronoun or "you" if a leader
-- of the client's faction. The actor may be not present in the dungeon. | 359 | partActorLeader :: MonadClient m => ActorId -> Actor -> m MU.Part
partActorLeader aid b = do
mleader <- getsClient _sleader
return $! case mleader of
Just leader | aid == leader -> "you"
_ -> partActor b
-- | The part of speech with the actor's pronoun or "you" if a leader
-- of the client's faction. The actor may be not present in the dungeon. | 359 | partActorLeader aid b = do
mleader <- getsClient _sleader
return $! case mleader of
Just leader | aid == leader -> "you"
_ -> partActor b
-- | The part of speech with the actor's pronoun or "you" if a leader
-- of the client's faction. The actor may be not present in the dungeon. | 293 | false | true | 0 | 14 | 78 | 87 | 40 | 47 | null | null |
Lainepress/hledger | hledger/Hledger/Cli/Convert.hs | gpl-3.0 | -- | Convert some date string with unknown format to YYYY/MM/DD.
normaliseDate :: Maybe String -- ^ User-supplied date format: this should be tried in preference to all others
-> String -> String
normaliseDate mb_user_format s =
let parsewith = flip (parseTime defaultTimeLocale) s in
maybe (error' $ "could not parse \""++s++"\" as a date, consider adding a date-format directive or upgrading")
showDate $
firstJust $ (map parsewith $
maybe [] (:[]) mb_user_format
-- the - modifier requires time-1.2.0.5, released
-- in 2011/5, so for now we emulate it for wider
-- compatibility. time < 1.2.0.5 also has a buggy
-- %y which we don't do anything about.
-- ++ [
-- "%Y/%m/%d"
-- ,"%Y/%-m/%-d"
-- ,"%Y-%m-%d"
-- ,"%Y-%-m-%-d"
-- ,"%m/%d/%Y"
-- ,"%-m/%-d/%Y"
-- ,"%m-%d-%Y"
-- ,"%-m-%-d-%Y"
-- ]
)
++ [
parseTime defaultTimeLocale "%Y/%m/%e" s
,parseTime defaultTimeLocale "%Y-%m-%e" s
,parseTime defaultTimeLocale "%m/%e/%Y" s
,parseTime defaultTimeLocale "%m-%e-%Y" s
,parseTime defaultTimeLocale "%Y/%m/%e" (take 5 s ++ "0" ++ drop 5 s)
,parseTime defaultTimeLocale "%Y-%m-%e" (take 5 s ++ "0" ++ drop 5 s)
,parseTime defaultTimeLocale "%m/%e/%Y" ('0':s)
,parseTime defaultTimeLocale "%m-%e-%Y" ('0':s)
] | 1,837 | normaliseDate :: Maybe String -- ^ User-supplied date format: this should be tried in preference to all others
-> String -> String
normaliseDate mb_user_format s =
let parsewith = flip (parseTime defaultTimeLocale) s in
maybe (error' $ "could not parse \""++s++"\" as a date, consider adding a date-format directive or upgrading")
showDate $
firstJust $ (map parsewith $
maybe [] (:[]) mb_user_format
-- the - modifier requires time-1.2.0.5, released
-- in 2011/5, so for now we emulate it for wider
-- compatibility. time < 1.2.0.5 also has a buggy
-- %y which we don't do anything about.
-- ++ [
-- "%Y/%m/%d"
-- ,"%Y/%-m/%-d"
-- ,"%Y-%m-%d"
-- ,"%Y-%-m-%-d"
-- ,"%m/%d/%Y"
-- ,"%-m/%-d/%Y"
-- ,"%m-%d-%Y"
-- ,"%-m-%-d-%Y"
-- ]
)
++ [
parseTime defaultTimeLocale "%Y/%m/%e" s
,parseTime defaultTimeLocale "%Y-%m-%e" s
,parseTime defaultTimeLocale "%m/%e/%Y" s
,parseTime defaultTimeLocale "%m-%e-%Y" s
,parseTime defaultTimeLocale "%Y/%m/%e" (take 5 s ++ "0" ++ drop 5 s)
,parseTime defaultTimeLocale "%Y-%m-%e" (take 5 s ++ "0" ++ drop 5 s)
,parseTime defaultTimeLocale "%m/%e/%Y" ('0':s)
,parseTime defaultTimeLocale "%m-%e-%Y" ('0':s)
] | 1,772 | normaliseDate mb_user_format s =
let parsewith = flip (parseTime defaultTimeLocale) s in
maybe (error' $ "could not parse \""++s++"\" as a date, consider adding a date-format directive or upgrading")
showDate $
firstJust $ (map parsewith $
maybe [] (:[]) mb_user_format
-- the - modifier requires time-1.2.0.5, released
-- in 2011/5, so for now we emulate it for wider
-- compatibility. time < 1.2.0.5 also has a buggy
-- %y which we don't do anything about.
-- ++ [
-- "%Y/%m/%d"
-- ,"%Y/%-m/%-d"
-- ,"%Y-%m-%d"
-- ,"%Y-%-m-%-d"
-- ,"%m/%d/%Y"
-- ,"%-m/%-d/%Y"
-- ,"%m-%d-%Y"
-- ,"%-m-%-d-%Y"
-- ]
)
++ [
parseTime defaultTimeLocale "%Y/%m/%e" s
,parseTime defaultTimeLocale "%Y-%m-%e" s
,parseTime defaultTimeLocale "%m/%e/%Y" s
,parseTime defaultTimeLocale "%m-%e-%Y" s
,parseTime defaultTimeLocale "%Y/%m/%e" (take 5 s ++ "0" ++ drop 5 s)
,parseTime defaultTimeLocale "%Y-%m-%e" (take 5 s ++ "0" ++ drop 5 s)
,parseTime defaultTimeLocale "%m/%e/%Y" ('0':s)
,parseTime defaultTimeLocale "%m-%e-%Y" ('0':s)
] | 1,627 | true | true | 0 | 14 | 811 | 258 | 136 | 122 | null | null |
Tener/HaNS | src/Network/TCP/LTS/User.hs | bsd-3-clause | try_recv :: (SockRsp->t) -> SMonad t (Maybe t)
try_recv cont =
do sock <- get_sock
let q = rcvq $ cb_rcv sock
if st sock `elem` [ CLOSED, SYN_SENT, SYN_RECEIVED] then
return $ Just $ cont $ SockError "Socket not in synchronized state"
else if bufc_length q == 0 then
if cantrcvmore $ cb sock
then return $ Just $ cont $ SockData buffer_empty -- EOF
else return Nothing -- no data, can't proceed
else do
-- let rcvnum = min size (length q)
-- (q1,q2) = splitAt rcvnum q
put_sock $ sock { cb_rcv = (cb_rcv sock) {rcvq = bufferchain_tail q }}
return $ Just $ cont $ SockData $ bufferchain_head q | 711 | try_recv :: (SockRsp->t) -> SMonad t (Maybe t)
try_recv cont =
do sock <- get_sock
let q = rcvq $ cb_rcv sock
if st sock `elem` [ CLOSED, SYN_SENT, SYN_RECEIVED] then
return $ Just $ cont $ SockError "Socket not in synchronized state"
else if bufc_length q == 0 then
if cantrcvmore $ cb sock
then return $ Just $ cont $ SockData buffer_empty -- EOF
else return Nothing -- no data, can't proceed
else do
-- let rcvnum = min size (length q)
-- (q1,q2) = splitAt rcvnum q
put_sock $ sock { cb_rcv = (cb_rcv sock) {rcvq = bufferchain_tail q }}
return $ Just $ cont $ SockData $ bufferchain_head q | 711 | try_recv cont =
do sock <- get_sock
let q = rcvq $ cb_rcv sock
if st sock `elem` [ CLOSED, SYN_SENT, SYN_RECEIVED] then
return $ Just $ cont $ SockError "Socket not in synchronized state"
else if bufc_length q == 0 then
if cantrcvmore $ cb sock
then return $ Just $ cont $ SockData buffer_empty -- EOF
else return Nothing -- no data, can't proceed
else do
-- let rcvnum = min size (length q)
-- (q1,q2) = splitAt rcvnum q
put_sock $ sock { cb_rcv = (cb_rcv sock) {rcvq = bufferchain_tail q }}
return $ Just $ cont $ SockData $ bufferchain_head q | 663 | false | true | 0 | 16 | 231 | 209 | 107 | 102 | null | null |
suhailshergill/liboleg | Language/TEval/TInfLetP.hs | bsd-3-clause | -- | Allocate a fresh type variable (see the first component of TVE)
newtv :: TVEM Typ
newtv = do
TVE n s <- get
put (TVE (succ n) s)
return (TV n) | 150 | newtv :: TVEM Typ
newtv = do
TVE n s <- get
put (TVE (succ n) s)
return (TV n) | 81 | newtv = do
TVE n s <- get
put (TVE (succ n) s)
return (TV n) | 63 | true | true | 0 | 11 | 35 | 59 | 27 | 32 | null | null |
scslab/hails | Hails/Web/Router.hs | mit | routeMethod :: Routeable r => StdMethod -> r -> Route
routeMethod method route = mroute $ \pi eq conf lreq -> do
req <- unlabel lreq
if renderStdMethod method == requestMethod req then
runRoute route pi eq conf lreq
else return Nothing
-- | Routes the given URL pattern. Patterns can include
-- directories as well as variable patterns (prefixed with @:@) to be added
-- to 'queryString' (see 'routeVar')
--
-- * \/posts\/:id
--
-- * \/posts\/:id\/new
--
-- * \/:date\/posts\/:category\/new
-- | 509 | routeMethod :: Routeable r => StdMethod -> r -> Route
routeMethod method route = mroute $ \pi eq conf lreq -> do
req <- unlabel lreq
if renderStdMethod method == requestMethod req then
runRoute route pi eq conf lreq
else return Nothing
-- | Routes the given URL pattern. Patterns can include
-- directories as well as variable patterns (prefixed with @:@) to be added
-- to 'queryString' (see 'routeVar')
--
-- * \/posts\/:id
--
-- * \/posts\/:id\/new
--
-- * \/:date\/posts\/:category\/new
-- | 509 | routeMethod method route = mroute $ \pi eq conf lreq -> do
req <- unlabel lreq
if renderStdMethod method == requestMethod req then
runRoute route pi eq conf lreq
else return Nothing
-- | Routes the given URL pattern. Patterns can include
-- directories as well as variable patterns (prefixed with @:@) to be added
-- to 'queryString' (see 'routeVar')
--
-- * \/posts\/:id
--
-- * \/posts\/:id\/new
--
-- * \/:date\/posts\/:category\/new
-- | 455 | false | true | 0 | 11 | 98 | 101 | 53 | 48 | null | null |
kim/amazonka | amazonka-elasticache/gen/Network/AWS/ElastiCache/CreateCacheCluster.hs | mpl-2.0 | cccrCacheCluster :: Lens' CreateCacheClusterResponse (Maybe CacheCluster)
cccrCacheCluster = lens _cccrCacheCluster (\s a -> s { _cccrCacheCluster = a }) | 153 | cccrCacheCluster :: Lens' CreateCacheClusterResponse (Maybe CacheCluster)
cccrCacheCluster = lens _cccrCacheCluster (\s a -> s { _cccrCacheCluster = a }) | 153 | cccrCacheCluster = lens _cccrCacheCluster (\s a -> s { _cccrCacheCluster = a }) | 79 | false | true | 1 | 9 | 18 | 50 | 24 | 26 | null | null |
narrative/stack | src/Stack/SDist.hs | bsd-3-clause | getSDistTarball
:: M env m
=> Maybe PvpBounds -- ^ Override Config value
-> Path Abs Dir -- ^ Path to local package
-> m (FilePath, L.ByteString) -- ^ Filename and tarball contents
getSDistTarball mpvpBounds pkgDir = do
config <- asks getConfig
let pvpBounds = fromMaybe (configPvpBounds config) mpvpBounds
tweakCabal = pvpBounds /= PvpBoundsNone
pkgFp = toFilePath pkgDir
lp <- readLocalPackage pkgDir
$logInfo $ "Getting file list for " <> T.pack pkgFp
(fileList, cabalfp) <- getSDistFileList lp
$logInfo $ "Building sdist tarball for " <> T.pack pkgFp
files <- normalizeTarballPaths (lines fileList)
-- NOTE: Could make this use lazy I/O to only read files as needed
-- for upload (both GZip.compress and Tar.write are lazy).
-- However, it seems less error prone and more predictable to read
-- everything in at once, so that's what we're doing for now:
let tarPath isDir fp = either error id
(Tar.toTarPath isDir (pkgId FP.</> fp))
packWith f isDir fp = liftIO $ f (pkgFp FP.</> fp) (tarPath isDir fp)
packDir = packWith Tar.packDirectoryEntry True
packFile fp
| tweakCabal && isCabalFp fp = do
lbs <- getCabalLbs pvpBounds $ toFilePath cabalfp
return $ Tar.fileEntry (tarPath False fp) lbs
| otherwise = packWith packFileEntry False fp
isCabalFp fp = toFilePath pkgDir FP.</> fp == toFilePath cabalfp
tarName = pkgId FP.<.> "tar.gz"
pkgId = packageIdentifierString (packageIdentifier (lpPackage lp))
dirEntries <- mapM packDir (dirsFromFiles files)
fileEntries <- mapM packFile files
return (tarName, GZip.compress (Tar.write (dirEntries ++ fileEntries)))
-- | Get the PVP bounds-enabled version of the given cabal file | 1,852 | getSDistTarball
:: M env m
=> Maybe PvpBounds -- ^ Override Config value
-> Path Abs Dir -- ^ Path to local package
-> m (FilePath, L.ByteString)
getSDistTarball mpvpBounds pkgDir = do
config <- asks getConfig
let pvpBounds = fromMaybe (configPvpBounds config) mpvpBounds
tweakCabal = pvpBounds /= PvpBoundsNone
pkgFp = toFilePath pkgDir
lp <- readLocalPackage pkgDir
$logInfo $ "Getting file list for " <> T.pack pkgFp
(fileList, cabalfp) <- getSDistFileList lp
$logInfo $ "Building sdist tarball for " <> T.pack pkgFp
files <- normalizeTarballPaths (lines fileList)
-- NOTE: Could make this use lazy I/O to only read files as needed
-- for upload (both GZip.compress and Tar.write are lazy).
-- However, it seems less error prone and more predictable to read
-- everything in at once, so that's what we're doing for now:
let tarPath isDir fp = either error id
(Tar.toTarPath isDir (pkgId FP.</> fp))
packWith f isDir fp = liftIO $ f (pkgFp FP.</> fp) (tarPath isDir fp)
packDir = packWith Tar.packDirectoryEntry True
packFile fp
| tweakCabal && isCabalFp fp = do
lbs <- getCabalLbs pvpBounds $ toFilePath cabalfp
return $ Tar.fileEntry (tarPath False fp) lbs
| otherwise = packWith packFileEntry False fp
isCabalFp fp = toFilePath pkgDir FP.</> fp == toFilePath cabalfp
tarName = pkgId FP.<.> "tar.gz"
pkgId = packageIdentifierString (packageIdentifier (lpPackage lp))
dirEntries <- mapM packDir (dirsFromFiles files)
fileEntries <- mapM packFile files
return (tarName, GZip.compress (Tar.write (dirEntries ++ fileEntries)))
-- | Get the PVP bounds-enabled version of the given cabal file | 1,817 | getSDistTarball mpvpBounds pkgDir = do
config <- asks getConfig
let pvpBounds = fromMaybe (configPvpBounds config) mpvpBounds
tweakCabal = pvpBounds /= PvpBoundsNone
pkgFp = toFilePath pkgDir
lp <- readLocalPackage pkgDir
$logInfo $ "Getting file list for " <> T.pack pkgFp
(fileList, cabalfp) <- getSDistFileList lp
$logInfo $ "Building sdist tarball for " <> T.pack pkgFp
files <- normalizeTarballPaths (lines fileList)
-- NOTE: Could make this use lazy I/O to only read files as needed
-- for upload (both GZip.compress and Tar.write are lazy).
-- However, it seems less error prone and more predictable to read
-- everything in at once, so that's what we're doing for now:
let tarPath isDir fp = either error id
(Tar.toTarPath isDir (pkgId FP.</> fp))
packWith f isDir fp = liftIO $ f (pkgFp FP.</> fp) (tarPath isDir fp)
packDir = packWith Tar.packDirectoryEntry True
packFile fp
| tweakCabal && isCabalFp fp = do
lbs <- getCabalLbs pvpBounds $ toFilePath cabalfp
return $ Tar.fileEntry (tarPath False fp) lbs
| otherwise = packWith packFileEntry False fp
isCabalFp fp = toFilePath pkgDir FP.</> fp == toFilePath cabalfp
tarName = pkgId FP.<.> "tar.gz"
pkgId = packageIdentifierString (packageIdentifier (lpPackage lp))
dirEntries <- mapM packDir (dirsFromFiles files)
fileEntries <- mapM packFile files
return (tarName, GZip.compress (Tar.write (dirEntries ++ fileEntries)))
-- | Get the PVP bounds-enabled version of the given cabal file | 1,638 | true | true | 0 | 17 | 478 | 471 | 222 | 249 | null | null |
gcampax/ghc | compiler/types/Type.hs | bsd-3-clause | tyConAppArgN :: Int -> Type -> Type
-- Executing Nth
tyConAppArgN n ty
= case tyConAppArgs_maybe ty of
Just tys -> ASSERT2( n < length tys, ppr n <+> ppr tys ) tys !! n
Nothing -> pprPanic "tyConAppArgN" (ppr n <+> ppr ty)
-- | Attempts to tease a type apart into a type constructor and the application
-- of a number of arguments to that constructor. Panics if that is not possible.
-- See also 'splitTyConApp_maybe' | 433 | tyConAppArgN :: Int -> Type -> Type
tyConAppArgN n ty
= case tyConAppArgs_maybe ty of
Just tys -> ASSERT2( n < length tys, ppr n <+> ppr tys ) tys !! n
Nothing -> pprPanic "tyConAppArgN" (ppr n <+> ppr ty)
-- | Attempts to tease a type apart into a type constructor and the application
-- of a number of arguments to that constructor. Panics if that is not possible.
-- See also 'splitTyConApp_maybe' | 416 | tyConAppArgN n ty
= case tyConAppArgs_maybe ty of
Just tys -> ASSERT2( n < length tys, ppr n <+> ppr tys ) tys !! n
Nothing -> pprPanic "tyConAppArgN" (ppr n <+> ppr ty)
-- | Attempts to tease a type apart into a type constructor and the application
-- of a number of arguments to that constructor. Panics if that is not possible.
-- See also 'splitTyConApp_maybe' | 380 | true | true | 0 | 12 | 93 | 100 | 49 | 51 | null | null |
Tehnix/campaigns | Job/Welcome.hs | mit | sendWelcomeMail :: Key Job -> JobValue -> HandlerT App IO ()
sendWelcomeMail jobId (JobValueUserMail mail') = do
let mail = T.toLower mail'
$logInfo $ "Running sendWelcomeMail job for " <> mail
master <- getYesod
maybeUser <- runDB . getBy $ UniqueEmail mail
case maybeUser of
Nothing -> return ()
Just (Entity _ signup) -> do
render <- getUrlRender
now <- liftIO getCurrentTime
let lang = signupLanguage signup
let utms = case appAnalytics $ appSettings master of
Nothing -> ""
Just _ -> "?utm_medium=email&utm_campaign=dashboard"
let referralUrl = render $ ReferAFriendIR lang (signupReferralToken signup)
let dashboardUrl = render (DashboardIR lang (signupDashboardToken signup)) <> utms
let subscriber = MailchimpWelcome mail referralUrl dashboardUrl
let patchRequest = mailchimpPatchRequest master lang subscriber mail
patchResponse <- liftIO $ HTTP.httpLBS patchRequest
let resp = T.decodeUtf8 . C.toStrict $ HTTP.getResponseBody patchResponse
-- Check if the API call was successful or not.
case HTTP.getResponseStatusCode patchResponse of
200 -> runDB $ update jobId [JobFinished =. True, JobUpdated =. now, JobResult =. Just resp]
_ -> runDB $ update jobId [JobUpdated =. now, JobResult =. Just resp]
return () | 1,371 | sendWelcomeMail :: Key Job -> JobValue -> HandlerT App IO ()
sendWelcomeMail jobId (JobValueUserMail mail') = do
let mail = T.toLower mail'
$logInfo $ "Running sendWelcomeMail job for " <> mail
master <- getYesod
maybeUser <- runDB . getBy $ UniqueEmail mail
case maybeUser of
Nothing -> return ()
Just (Entity _ signup) -> do
render <- getUrlRender
now <- liftIO getCurrentTime
let lang = signupLanguage signup
let utms = case appAnalytics $ appSettings master of
Nothing -> ""
Just _ -> "?utm_medium=email&utm_campaign=dashboard"
let referralUrl = render $ ReferAFriendIR lang (signupReferralToken signup)
let dashboardUrl = render (DashboardIR lang (signupDashboardToken signup)) <> utms
let subscriber = MailchimpWelcome mail referralUrl dashboardUrl
let patchRequest = mailchimpPatchRequest master lang subscriber mail
patchResponse <- liftIO $ HTTP.httpLBS patchRequest
let resp = T.decodeUtf8 . C.toStrict $ HTTP.getResponseBody patchResponse
-- Check if the API call was successful or not.
case HTTP.getResponseStatusCode patchResponse of
200 -> runDB $ update jobId [JobFinished =. True, JobUpdated =. now, JobResult =. Just resp]
_ -> runDB $ update jobId [JobUpdated =. now, JobResult =. Just resp]
return () | 1,371 | sendWelcomeMail jobId (JobValueUserMail mail') = do
let mail = T.toLower mail'
$logInfo $ "Running sendWelcomeMail job for " <> mail
master <- getYesod
maybeUser <- runDB . getBy $ UniqueEmail mail
case maybeUser of
Nothing -> return ()
Just (Entity _ signup) -> do
render <- getUrlRender
now <- liftIO getCurrentTime
let lang = signupLanguage signup
let utms = case appAnalytics $ appSettings master of
Nothing -> ""
Just _ -> "?utm_medium=email&utm_campaign=dashboard"
let referralUrl = render $ ReferAFriendIR lang (signupReferralToken signup)
let dashboardUrl = render (DashboardIR lang (signupDashboardToken signup)) <> utms
let subscriber = MailchimpWelcome mail referralUrl dashboardUrl
let patchRequest = mailchimpPatchRequest master lang subscriber mail
patchResponse <- liftIO $ HTTP.httpLBS patchRequest
let resp = T.decodeUtf8 . C.toStrict $ HTTP.getResponseBody patchResponse
-- Check if the API call was successful or not.
case HTTP.getResponseStatusCode patchResponse of
200 -> runDB $ update jobId [JobFinished =. True, JobUpdated =. now, JobResult =. Just resp]
_ -> runDB $ update jobId [JobUpdated =. now, JobResult =. Just resp]
return () | 1,310 | false | true | 0 | 22 | 328 | 420 | 191 | 229 | null | null |
sdiehl/ghc | compiler/GHC/Hs/Expr.hs | bsd-3-clause | pprDo :: (OutputableBndrId p, Outputable body)
=> HsStmtContext any -> [LStmt (GhcPass p) body] -> SDoc
pprDo DoExpr stmts = text "do" <+> ppr_do_stmts stmts | 171 | pprDo :: (OutputableBndrId p, Outputable body)
=> HsStmtContext any -> [LStmt (GhcPass p) body] -> SDoc
pprDo DoExpr stmts = text "do" <+> ppr_do_stmts stmts | 171 | pprDo DoExpr stmts = text "do" <+> ppr_do_stmts stmts | 61 | false | true | 0 | 11 | 38 | 66 | 32 | 34 | null | null |
cbrghostrider/Hacking | HackerRank/FunctionalProgramming/MemoizationAndDP/sherlockMaze.hs | mit | -- various paths with these many number of turns, to end up at current cell, facing (DOWN, RIGHT)
mergeLists :: [PathVal] -> [PathVal] -> [PathVal]
mergeLists pvs [] = pvs | 172 | mergeLists :: [PathVal] -> [PathVal] -> [PathVal]
mergeLists pvs [] = pvs | 73 | mergeLists pvs [] = pvs | 23 | true | true | 0 | 7 | 30 | 41 | 21 | 20 | null | null |
plurSKI/euclidOrchard | src/SdlMaze.hs | bsd-3-clause | putFPS :: MonadState AppData m => Timer -> m ()
putFPS t = modify $ \s -> s { fps = t } | 87 | putFPS :: MonadState AppData m => Timer -> m ()
putFPS t = modify $ \s -> s { fps = t } | 87 | putFPS t = modify $ \s -> s { fps = t } | 39 | false | true | 0 | 9 | 22 | 54 | 26 | 28 | null | null |
garious/hopt | Hopt.hs | mit | -- | Given the name of an optimization pass, returns the pipe that implements
-- that requested optimization.
lookupPass :: String -> Inum Module Module IO a
lookupPass x = maybe (error x) id (lookup x optPassMap) | 215 | lookupPass :: String -> Inum Module Module IO a
lookupPass x = maybe (error x) id (lookup x optPassMap) | 103 | lookupPass x = maybe (error x) id (lookup x optPassMap) | 55 | true | true | 0 | 7 | 38 | 55 | 26 | 29 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.