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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Ian-Stewart-Binks/courseography | hs/Svg/Builder.hs | gpl-3.0 | -- | Determines if a text intersects with any shape in a list.
intersectsWithShape :: [Shape] -> Text -> Bool
intersectsWithShape shapes text =
any (intersectsWithPoint (textPos text)) shapes | 195 | intersectsWithShape :: [Shape] -> Text -> Bool
intersectsWithShape shapes text =
any (intersectsWithPoint (textPos text)) shapes | 132 | intersectsWithShape shapes text =
any (intersectsWithPoint (textPos text)) shapes | 85 | true | true | 0 | 9 | 32 | 45 | 23 | 22 | null | null |
hvr/multi-ghc-travis | test/Tests.hs | bsd-3-clause | fixtureGoldenTest :: FilePath -> TestTree
fixtureGoldenTest fp = testGroup fp
[ fixtureGoldenTest' "travis" travisFromConfigFile
, fixtureGoldenTest' "github" githubFromConfigFile
, fixtureGoldenTest' "bash" bashFromConfigFile
]
where
-- name acts as extension also
fixtureGoldenTest' name generate = cabalGoldenTest name outputRef $ do
(argv, opts') <- makeFlags
let opts = opts'
{ optInputType = Just InputTypeProject
, optConfigMorphism = (\cfg -> cfg { cfgInsertVersion = False}) . optConfigMorphism opts'
}
let genConfig = generate argv opts projectfp
first (fmap (lines . fromUTF8BS)) <$> runDiagnosticsT genConfig
where
outputRef = addExtension fp name
projectfp = fp ++ ".project"
readArgv :: IO [String]
readArgv = do
contents <- readFile $ addExtension fp "args"
return $ filter (not . null)$ lines contents
makeFlags :: IO ([String], Options)
makeFlags = do
argv <- readArgv
let argv' = argv ++ [name, projectfp]
(_fp, opts) <- parseOptions argv'
return (argv', opts) | 1,213 | fixtureGoldenTest :: FilePath -> TestTree
fixtureGoldenTest fp = testGroup fp
[ fixtureGoldenTest' "travis" travisFromConfigFile
, fixtureGoldenTest' "github" githubFromConfigFile
, fixtureGoldenTest' "bash" bashFromConfigFile
]
where
-- name acts as extension also
fixtureGoldenTest' name generate = cabalGoldenTest name outputRef $ do
(argv, opts') <- makeFlags
let opts = opts'
{ optInputType = Just InputTypeProject
, optConfigMorphism = (\cfg -> cfg { cfgInsertVersion = False}) . optConfigMorphism opts'
}
let genConfig = generate argv opts projectfp
first (fmap (lines . fromUTF8BS)) <$> runDiagnosticsT genConfig
where
outputRef = addExtension fp name
projectfp = fp ++ ".project"
readArgv :: IO [String]
readArgv = do
contents <- readFile $ addExtension fp "args"
return $ filter (not . null)$ lines contents
makeFlags :: IO ([String], Options)
makeFlags = do
argv <- readArgv
let argv' = argv ++ [name, projectfp]
(_fp, opts) <- parseOptions argv'
return (argv', opts) | 1,213 | fixtureGoldenTest fp = testGroup fp
[ fixtureGoldenTest' "travis" travisFromConfigFile
, fixtureGoldenTest' "github" githubFromConfigFile
, fixtureGoldenTest' "bash" bashFromConfigFile
]
where
-- name acts as extension also
fixtureGoldenTest' name generate = cabalGoldenTest name outputRef $ do
(argv, opts') <- makeFlags
let opts = opts'
{ optInputType = Just InputTypeProject
, optConfigMorphism = (\cfg -> cfg { cfgInsertVersion = False}) . optConfigMorphism opts'
}
let genConfig = generate argv opts projectfp
first (fmap (lines . fromUTF8BS)) <$> runDiagnosticsT genConfig
where
outputRef = addExtension fp name
projectfp = fp ++ ".project"
readArgv :: IO [String]
readArgv = do
contents <- readFile $ addExtension fp "args"
return $ filter (not . null)$ lines contents
makeFlags :: IO ([String], Options)
makeFlags = do
argv <- readArgv
let argv' = argv ++ [name, projectfp]
(_fp, opts) <- parseOptions argv'
return (argv', opts) | 1,171 | false | true | 2 | 18 | 374 | 317 | 161 | 156 | null | null |
keera-studios/hsQt | Qtc/Enums/Network/QHttp.hs | bsd-2-clause | eUnexpectedClose :: QHttpError
eUnexpectedClose
= ieQHttpError $ 4 | 68 | eUnexpectedClose :: QHttpError
eUnexpectedClose
= ieQHttpError $ 4 | 68 | eUnexpectedClose
= ieQHttpError $ 4 | 37 | false | true | 0 | 6 | 9 | 18 | 8 | 10 | null | null |
urv/fixhs | src/Data/FIX/Spec/FIX43.hs | lgpl-2.1 | tTradeType :: FIXTag
tTradeType = FIXTag
{ tName = "TradeType"
, tnum = 418
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 156 | tTradeType :: FIXTag
tTradeType = FIXTag
{ tName = "TradeType"
, tnum = 418
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 156 | tTradeType = FIXTag
{ tName = "TradeType"
, tnum = 418
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 135 | false | true | 0 | 10 | 38 | 51 | 29 | 22 | null | null |
dorchard/effect-monad | examples/State.hs | bsd-2-clause | --example2 :: State '["x" :-> Int :! RW] Int
example2 = do
x <- get (Var::(Var "x"))
put (Var::(Var "x")) (x+1)
return x | 126 | example2 = do
x <- get (Var::(Var "x"))
put (Var::(Var "x")) (x+1)
return x | 81 | example2 = do
x <- get (Var::(Var "x"))
put (Var::(Var "x")) (x+1)
return x | 81 | true | false | 0 | 11 | 28 | 62 | 31 | 31 | null | null |
danr/hipspec | src/HipSpec/Lang/Rich.hs | gpl-3.0 | mapFnBody :: (Expr a -> Expr a) -> Function a -> Function a
mapFnBody f fn = fn { fn_body = f (fn_body fn) } | 108 | mapFnBody :: (Expr a -> Expr a) -> Function a -> Function a
mapFnBody f fn = fn { fn_body = f (fn_body fn) } | 108 | mapFnBody f fn = fn { fn_body = f (fn_body fn) } | 48 | false | true | 0 | 9 | 24 | 60 | 29 | 31 | null | null |
modeswitch/barrelfish | tools/mackerel/Checks.hs | mit | --
-- Check for Registers of Unusual Size
--
check_rous :: Dev.Rec -> [ MacError ]
check_rous d =
[ make_rous_error t
| t@(TT.RegFormat {}) <- (Dev.types d), check_rous_type t ]
++
[ make_rous_error t
| RT.Rec { RT.tpe = t@(TT.ConstType {}) } <- (Dev.registers d), check_rous_type t ] | 308 | check_rous :: Dev.Rec -> [ MacError ]
check_rous d =
[ make_rous_error t
| t@(TT.RegFormat {}) <- (Dev.types d), check_rous_type t ]
++
[ make_rous_error t
| RT.Rec { RT.tpe = t@(TT.ConstType {}) } <- (Dev.registers d), check_rous_type t ] | 262 | check_rous d =
[ make_rous_error t
| t@(TT.RegFormat {}) <- (Dev.types d), check_rous_type t ]
++
[ make_rous_error t
| RT.Rec { RT.tpe = t@(TT.ConstType {}) } <- (Dev.registers d), check_rous_type t ] | 224 | true | true | 0 | 15 | 72 | 125 | 66 | 59 | null | null |
ygale/yesod | yesod-core/Yesod/Core/Dispatch.hs | mit | -- | A default set of middlewares.
--
-- Since 1.2.0
mkDefaultMiddlewares :: Logger -> IO W.Middleware
mkDefaultMiddlewares logger = do
logWare <- mkRequestLogger def
{ destination = Network.Wai.Middleware.RequestLogger.Logger $ loggerSet logger
, outputFormat = Apache FromSocket
}
return $ logWare . defaultMiddlewaresNoLogging
-- | All of the default middlewares, excluding logging.
--
-- Since 1.2.12 | 437 | mkDefaultMiddlewares :: Logger -> IO W.Middleware
mkDefaultMiddlewares logger = do
logWare <- mkRequestLogger def
{ destination = Network.Wai.Middleware.RequestLogger.Logger $ loggerSet logger
, outputFormat = Apache FromSocket
}
return $ logWare . defaultMiddlewaresNoLogging
-- | All of the default middlewares, excluding logging.
--
-- Since 1.2.12 | 384 | mkDefaultMiddlewares logger = do
logWare <- mkRequestLogger def
{ destination = Network.Wai.Middleware.RequestLogger.Logger $ loggerSet logger
, outputFormat = Apache FromSocket
}
return $ logWare . defaultMiddlewaresNoLogging
-- | All of the default middlewares, excluding logging.
--
-- Since 1.2.12 | 334 | true | true | 0 | 12 | 88 | 79 | 43 | 36 | null | null |
rueshyna/gogol | gogol-dataflow/gen/Network/Google/Dataflow/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Disk' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dSizeGb'
--
-- * 'dDiskType'
--
-- * 'dMountPoint'
disk
:: Disk
disk =
Disk'
{ _dSizeGb = Nothing
, _dDiskType = Nothing
, _dMountPoint = Nothing
} | 336 | disk
:: Disk
disk =
Disk'
{ _dSizeGb = Nothing
, _dDiskType = Nothing
, _dMountPoint = Nothing
} | 120 | disk =
Disk'
{ _dSizeGb = Nothing
, _dDiskType = Nothing
, _dMountPoint = Nothing
} | 103 | true | true | 0 | 7 | 84 | 50 | 30 | 20 | null | null |
tphyahoo/happs-tutorial | src/SerializeableJobs.hs | bsd-3-clause | set_jobblurb = mod_jobblurb . const | 35 | set_jobblurb = mod_jobblurb . const | 35 | set_jobblurb = mod_jobblurb . const | 35 | false | false | 0 | 5 | 4 | 10 | 5 | 5 | null | null |
richardfontana/postmaster | Postmaster/FSM/DNSResolver.hs | gpl-3.0 | setDNSResolver :: Resolver -> EnvT ()
setDNSResolver f = setVar dnsResolver (DNSR f) | 84 | setDNSResolver :: Resolver -> EnvT ()
setDNSResolver f = setVar dnsResolver (DNSR f) | 84 | setDNSResolver f = setVar dnsResolver (DNSR f) | 46 | false | true | 0 | 7 | 12 | 34 | 16 | 18 | null | null |
kaoskorobase/mescaline | lib/mescaline-patterns/app/Main.hs | gpl-3.0 | serverLoop :: (MonadIO m, RecvOSC m) => (Message -> IO ()) -> m ()
serverLoop snk = do
m <- OSC.recvMessage
case m of
Nothing -> serverLoop snk
Just msg -> do
liftIO $ snk msg
case messageAddress msg of
"/quit" -> return ()
_ -> serverLoop snk | 283 | serverLoop :: (MonadIO m, RecvOSC m) => (Message -> IO ()) -> m ()
serverLoop snk = do
m <- OSC.recvMessage
case m of
Nothing -> serverLoop snk
Just msg -> do
liftIO $ snk msg
case messageAddress msg of
"/quit" -> return ()
_ -> serverLoop snk | 283 | serverLoop snk = do
m <- OSC.recvMessage
case m of
Nothing -> serverLoop snk
Just msg -> do
liftIO $ snk msg
case messageAddress msg of
"/quit" -> return ()
_ -> serverLoop snk | 216 | false | true | 0 | 18 | 87 | 130 | 58 | 72 | null | null |
razvan9310/barrelfish | hake/RuleDefs.hs | mit | -- Make depend for an assembler output
makeDependAssembler :: Options -> String -> String -> HRule
makeDependAssembler opts phase src =
let objfile = (assemblerFilePath opts src)
in
makeDependArch opts phase src objfile (dependFilePath objfile) | 258 | makeDependAssembler :: Options -> String -> String -> HRule
makeDependAssembler opts phase src =
let objfile = (assemblerFilePath opts src)
in
makeDependArch opts phase src objfile (dependFilePath objfile) | 219 | makeDependAssembler opts phase src =
let objfile = (assemblerFilePath opts src)
in
makeDependArch opts phase src objfile (dependFilePath objfile) | 159 | true | true | 0 | 10 | 48 | 67 | 33 | 34 | null | null |
alang9/deque | Data/Deque/NonCat/LessTyped.hs | bsd-3-clause | toTiny b@B1{} = TinyL b | 23 | toTiny b@B1{} = TinyL b | 23 | toTiny b@B1{} = TinyL b | 23 | false | false | 1 | 6 | 4 | 24 | 9 | 15 | null | null |
dpwright/igo | src/Game/Go/Game.hs | bsd-3-clause | wrappedAdd :: (Enum a, Bounded a) => Int -> a -> a
wrappedAdd n e = toEnum (add (fromEnum (maxBound `asTypeOf` e) + 1) (fromEnum e) n)
where add m x y = (x + y + m) `rem` m | 174 | wrappedAdd :: (Enum a, Bounded a) => Int -> a -> a
wrappedAdd n e = toEnum (add (fromEnum (maxBound `asTypeOf` e) + 1) (fromEnum e) n)
where add m x y = (x + y + m) `rem` m | 174 | wrappedAdd n e = toEnum (add (fromEnum (maxBound `asTypeOf` e) + 1) (fromEnum e) n)
where add m x y = (x + y + m) `rem` m | 123 | false | true | 0 | 12 | 41 | 115 | 58 | 57 | null | null |
olsner/ghc | compiler/simplCore/OccurAnal.hs | bsd-3-clause | betterLB :: NodeScore -> NodeScore -> Bool
-- If n1 `betterLB` n2 then choose n1 as the loop breaker
betterLB (rank1, size1, lb1) (rank2, size2, _)
| rank1 < rank2 = True
| rank1 > rank2 = False
| size1 < size2 = False -- Make the bigger n2 into the loop breaker
| size1 > size2 = True
| lb1 = True -- Tie-break: if n1 was a loop breaker before, choose it
| otherwise = False | 408 | betterLB :: NodeScore -> NodeScore -> Bool
betterLB (rank1, size1, lb1) (rank2, size2, _)
| rank1 < rank2 = True
| rank1 > rank2 = False
| size1 < size2 = False -- Make the bigger n2 into the loop breaker
| size1 > size2 = True
| lb1 = True -- Tie-break: if n1 was a loop breaker before, choose it
| otherwise = False | 348 | betterLB (rank1, size1, lb1) (rank2, size2, _)
| rank1 < rank2 = True
| rank1 > rank2 = False
| size1 < size2 = False -- Make the bigger n2 into the loop breaker
| size1 > size2 = True
| lb1 = True -- Tie-break: if n1 was a loop breaker before, choose it
| otherwise = False | 305 | true | true | 5 | 8 | 110 | 109 | 57 | 52 | null | null |
tokiwoousaka/reasonable-operational | src/Control/Monad/Operational.hs | mit | singleton :: f a -> Program f a
singleton = Program . liftF . liftCoYoneda | 74 | singleton :: f a -> Program f a
singleton = Program . liftF . liftCoYoneda | 74 | singleton = Program . liftF . liftCoYoneda | 42 | false | true | 0 | 7 | 14 | 37 | 16 | 21 | null | null |
ghorn/euler | Euler/E096.hs | bsd-3-clause | toEntry :: Int -> Entry
toEntry 0 = Unknown (IS.fromList [1..9]) | 64 | toEntry :: Int -> Entry
toEntry 0 = Unknown (IS.fromList [1..9]) | 64 | toEntry 0 = Unknown (IS.fromList [1..9]) | 40 | false | true | 0 | 8 | 10 | 34 | 17 | 17 | null | null |
ddssff/pandoc | src/Text/Pandoc/Readers/Org.hs | gpl-2.0 | followingResultsBlock :: OrgParser (Maybe (F Blocks))
followingResultsBlock =
optionMaybe (try $ blanklines *> stringAnyCase "#+RESULTS:"
*> blankline
*> block) | 241 | followingResultsBlock :: OrgParser (Maybe (F Blocks))
followingResultsBlock =
optionMaybe (try $ blanklines *> stringAnyCase "#+RESULTS:"
*> blankline
*> block) | 241 | followingResultsBlock =
optionMaybe (try $ blanklines *> stringAnyCase "#+RESULTS:"
*> blankline
*> block) | 187 | false | true | 0 | 10 | 99 | 51 | 25 | 26 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/NeptuneDBCluster.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-snapshotidentifier
ndbcSnapshotIdentifier :: Lens' NeptuneDBCluster (Maybe (Val Text))
ndbcSnapshotIdentifier = lens _neptuneDBClusterSnapshotIdentifier (\s a -> s { _neptuneDBClusterSnapshotIdentifier = a }) | 333 | ndbcSnapshotIdentifier :: Lens' NeptuneDBCluster (Maybe (Val Text))
ndbcSnapshotIdentifier = lens _neptuneDBClusterSnapshotIdentifier (\s a -> s { _neptuneDBClusterSnapshotIdentifier = a }) | 189 | ndbcSnapshotIdentifier = lens _neptuneDBClusterSnapshotIdentifier (\s a -> s { _neptuneDBClusterSnapshotIdentifier = a }) | 121 | true | true | 0 | 9 | 22 | 52 | 28 | 24 | null | null |
DavidAlphaFox/ghc | libraries/xhtml/Text/XHtml/Frameset.hs | bsd-3-clause | -- | Outputs indented HTML, with indentation inside elements.
-- This can change the meaning of the HTML document, and
-- is mostly useful for debugging the HTML output.
-- The implementation is inefficient, and you are normally
-- better off using 'showHtml' or 'renderHtml'.
prettyHtml :: HTML html => html -> String
prettyHtml = prettyHtmlInternal docType | 367 | prettyHtml :: HTML html => html -> String
prettyHtml = prettyHtmlInternal docType | 81 | prettyHtml = prettyHtmlInternal docType | 39 | true | true | 0 | 6 | 65 | 30 | 17 | 13 | null | null |
zsedem/haskell-playground | gitcommander/src/Main.hs | mit | createFileList items = newTextList items 1 | 42 | createFileList items = newTextList items 1 | 42 | createFileList items = newTextList items 1 | 42 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
amccausl/Swish | Swish/HaskellRDF/RDFDatatypeXsdIntegerTest.hs | lgpl-2.1 | power03inp =
"_:a a xsd_integer:Power ; "
+++ " rdf:_2 \"22\"^^xsd:integer ; "
+++ " rdf:_3 \"-33\"^^xsd:integer . " | 137 | power03inp =
"_:a a xsd_integer:Power ; "
+++ " rdf:_2 \"22\"^^xsd:integer ; "
+++ " rdf:_3 \"-33\"^^xsd:integer . " | 137 | power03inp =
"_:a a xsd_integer:Power ; "
+++ " rdf:_2 \"22\"^^xsd:integer ; "
+++ " rdf:_3 \"-33\"^^xsd:integer . " | 137 | false | false | 0 | 6 | 39 | 14 | 7 | 7 | null | null |
imalsogreg/arte-ephys | arte-spike-viewer/src/System/Arte/SpikeViewer.hs | gpl-3.0 | green' = PixelRGBA8 255 0 255 0 | 33 | green' = PixelRGBA8 255 0 255 0 | 33 | green' = PixelRGBA8 255 0 255 0 | 33 | false | false | 1 | 5 | 8 | 18 | 7 | 11 | null | null |
rueshyna/gogol | gogol-adexchange-buyer/gen/Network/Google/AdExchangeBuyer/Types/Product.hs | mpl-2.0 | -- | The URL that the browser\/SDK will load when the user clicks the ad.
cnataClickLinkURL :: Lens' CreativeNATiveAd (Maybe Text)
cnataClickLinkURL
= lens _cnataClickLinkURL
(\ s a -> s{_cnataClickLinkURL = a}) | 219 | cnataClickLinkURL :: Lens' CreativeNATiveAd (Maybe Text)
cnataClickLinkURL
= lens _cnataClickLinkURL
(\ s a -> s{_cnataClickLinkURL = a}) | 145 | cnataClickLinkURL
= lens _cnataClickLinkURL
(\ s a -> s{_cnataClickLinkURL = a}) | 88 | true | true | 0 | 8 | 39 | 49 | 25 | 24 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/fromEnum_2.hs | mit | primMinusNatS x Zero = x | 24 | primMinusNatS x Zero = x | 24 | primMinusNatS x Zero = x | 24 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
tanishiking/hscc | src/ProgGenerator.hs | mit | convDeclList :: DeclaratorList -> String
convDeclList = concat . foldr f []
where f (ty, directDecl) acc = (concat [show ty, show directDecl, ";\n"]):acc | 155 | convDeclList :: DeclaratorList -> String
convDeclList = concat . foldr f []
where f (ty, directDecl) acc = (concat [show ty, show directDecl, ";\n"]):acc | 155 | convDeclList = concat . foldr f []
where f (ty, directDecl) acc = (concat [show ty, show directDecl, ";\n"]):acc | 114 | false | true | 2 | 9 | 25 | 83 | 37 | 46 | null | null |
brendanhay/gogol | gogol-adexchangebuyer2/gen/Network/Google/Resource/AdExchangeBuyer2/Bidders/Accounts/FilterSets/FilteredBidRequests/List.hs | mpl-2.0 | -- | V1 error format.
bafsfbrlXgafv :: Lens' BiddersAccountsFilterSetsFilteredBidRequestsList (Maybe Xgafv)
bafsfbrlXgafv
= lens _bafsfbrlXgafv
(\ s a -> s{_bafsfbrlXgafv = a}) | 184 | bafsfbrlXgafv :: Lens' BiddersAccountsFilterSetsFilteredBidRequestsList (Maybe Xgafv)
bafsfbrlXgafv
= lens _bafsfbrlXgafv
(\ s a -> s{_bafsfbrlXgafv = a}) | 162 | bafsfbrlXgafv
= lens _bafsfbrlXgafv
(\ s a -> s{_bafsfbrlXgafv = a}) | 76 | true | true | 0 | 8 | 29 | 49 | 25 | 24 | null | null |
hsyl20/HViperVM | lib/ViperVM/Graph/Graph.hs | lgpl-3.0 | -- | IO version of setNodeExpr
setNodeExprIO :: Node -> Expr -> IO ()
setNodeExprIO node ex = atomically (setNodeExpr node ex) | 126 | setNodeExprIO :: Node -> Expr -> IO ()
setNodeExprIO node ex = atomically (setNodeExpr node ex) | 95 | setNodeExprIO node ex = atomically (setNodeExpr node ex) | 56 | true | true | 0 | 8 | 21 | 41 | 20 | 21 | null | null |
keithodulaigh/Hets | ToHaskell/test/FiniteSet.hascasl.hs | gpl-2.0 | a___b_2_r :: a -> FiniteSet a
a___b_2_r = error{-(a -> FiniteSet a)-} "a___b_2_r" | 81 | a___b_2_r :: a -> FiniteSet a
a___b_2_r = error{-(a -> FiniteSet a)-} "a___b_2_r" | 81 | a___b_2_r = error{-(a -> FiniteSet a)-} "a___b_2_r" | 51 | false | true | 0 | 7 | 12 | 28 | 12 | 16 | null | null |
et4te/zero | server/src/Zero/Persistence.hs | bsd-3-clause | handleError :: Either RelationalError a -> IO a
handleError eErr =
case eErr of
Left err ->
print err >> error "Died due to errors."
Right v ->
pure v | 172 | handleError :: Either RelationalError a -> IO a
handleError eErr =
case eErr of
Left err ->
print err >> error "Died due to errors."
Right v ->
pure v | 172 | handleError eErr =
case eErr of
Left err ->
print err >> error "Died due to errors."
Right v ->
pure v | 124 | false | true | 0 | 9 | 51 | 65 | 28 | 37 | null | null |
Gabriel439/Haskell-Dhall-Library | dhall/tests/Dhall/Test/Util.hs | bsd-3-clause | toDhallPath :: Text -> Text
toDhallPath = Text.replace "\\" "/" | 63 | toDhallPath :: Text -> Text
toDhallPath = Text.replace "\\" "/" | 63 | toDhallPath = Text.replace "\\" "/" | 35 | false | true | 0 | 6 | 9 | 22 | 11 | 11 | null | null |
facebookincubator/duckling | Duckling/CreditCardNumber/Corpus.hs | bsd-3-clause | allExamples :: [Example]
allExamples = concat
[ examples
(CreditCardNumberValue "4111111111111111" Visa)
[ "4111111111111111"
, "4111-1111-1111-1111"
]
, examples
(CreditCardNumberValue "371449635398431" Amex)
[ "371449635398431"
, "3714-496353-98431"
]
, examples
(CreditCardNumberValue "6011111111111117" Discover)
[ "6011111111111117"
, "6011-1111-1111-1117"
]
, examples
(CreditCardNumberValue "5555555555554444" Mastercard)
[ "5555555555554444"
, "5555-5555-5555-4444"
]
, examples
(CreditCardNumberValue "30569309025904" DinerClub)
[ "30569309025904"
, "3056-930902-5904"
]
, examples
(CreditCardNumberValue "3530111333300000" Other)
[ "3530111333300000" ]
] | 810 | allExamples :: [Example]
allExamples = concat
[ examples
(CreditCardNumberValue "4111111111111111" Visa)
[ "4111111111111111"
, "4111-1111-1111-1111"
]
, examples
(CreditCardNumberValue "371449635398431" Amex)
[ "371449635398431"
, "3714-496353-98431"
]
, examples
(CreditCardNumberValue "6011111111111117" Discover)
[ "6011111111111117"
, "6011-1111-1111-1117"
]
, examples
(CreditCardNumberValue "5555555555554444" Mastercard)
[ "5555555555554444"
, "5555-5555-5555-4444"
]
, examples
(CreditCardNumberValue "30569309025904" DinerClub)
[ "30569309025904"
, "3056-930902-5904"
]
, examples
(CreditCardNumberValue "3530111333300000" Other)
[ "3530111333300000" ]
] | 810 | allExamples = concat
[ examples
(CreditCardNumberValue "4111111111111111" Visa)
[ "4111111111111111"
, "4111-1111-1111-1111"
]
, examples
(CreditCardNumberValue "371449635398431" Amex)
[ "371449635398431"
, "3714-496353-98431"
]
, examples
(CreditCardNumberValue "6011111111111117" Discover)
[ "6011111111111117"
, "6011-1111-1111-1117"
]
, examples
(CreditCardNumberValue "5555555555554444" Mastercard)
[ "5555555555554444"
, "5555-5555-5555-4444"
]
, examples
(CreditCardNumberValue "30569309025904" DinerClub)
[ "30569309025904"
, "3056-930902-5904"
]
, examples
(CreditCardNumberValue "3530111333300000" Other)
[ "3530111333300000" ]
] | 785 | false | true | 0 | 8 | 210 | 146 | 79 | 67 | null | null |
prydonius/Oxo | Player.hs | mit | readPlayerString "" = None | 37 | readPlayerString "" = None | 37 | readPlayerString "" = None | 37 | false | false | 0 | 5 | 14 | 9 | 4 | 5 | null | null |
pauldoo/scratch | ProgrammingInHaskell/Ex9_6.hs | isc | buttons :: [Char]
buttons = standard ++ extra where
standard = "qcd=123+456-789*0()/"
extra = "QCD \ESC\BS\DEL\n" | 121 | buttons :: [Char]
buttons = standard ++ extra where
standard = "qcd=123+456-789*0()/"
extra = "QCD \ESC\BS\DEL\n" | 121 | buttons = standard ++ extra where
standard = "qcd=123+456-789*0()/"
extra = "QCD \ESC\BS\DEL\n" | 103 | false | true | 0 | 7 | 23 | 37 | 18 | 19 | null | null |
mariefarrell/Hets | Temporal/ModalCaslToNuSmvLtl.hs | gpl-2.0 | convert' (Casl.W phi psi) = convert' ((phi `Casl.Pand` psi) `Casl.B`
(Casl.Pnot phi `Casl.Pand` psi)) | 143 | convert' (Casl.W phi psi) = convert' ((phi `Casl.Pand` psi) `Casl.B`
(Casl.Pnot phi `Casl.Pand` psi)) | 143 | convert' (Casl.W phi psi) = convert' ((phi `Casl.Pand` psi) `Casl.B`
(Casl.Pnot phi `Casl.Pand` psi)) | 143 | false | false | 0 | 11 | 55 | 61 | 33 | 28 | null | null |
epsilonhalbe/Sammelsurium | EquationX/Data/Transformations.hs | bsd-3-clause | simplify (O (Neg (A X))) = O $ Mul (A (N (-1))) (A X) | 66 | simplify (O (Neg (A X))) = O $ Mul (A (N (-1))) (A X) | 66 | simplify (O (Neg (A X))) = O $ Mul (A (N (-1))) (A X) | 66 | false | false | 0 | 12 | 26 | 59 | 29 | 30 | null | null |
cstrahan/nikki | src/Data/StrictList.hs | lgpl-3.0 | singleton :: a -> StrictList a
singleton = (:! Empty) | 53 | singleton :: a -> StrictList a
singleton = (:! Empty) | 53 | singleton = (:! Empty) | 22 | false | true | 0 | 7 | 9 | 28 | 13 | 15 | null | null |
awagner83/powermap | src/Data/Wikipedia/Request.hs | bsd-3-clause | -- | Construct single-argument request
simpleRequest :: (String, String) -> Request
simpleRequest = Request . (:[]) | 115 | simpleRequest :: (String, String) -> Request
simpleRequest = Request . (:[]) | 76 | simpleRequest = Request . (:[]) | 31 | true | true | 0 | 8 | 15 | 39 | 20 | 19 | null | null |
MichielDerhaeg/stack | src/Stack/Init.hs | bsd-3-clause | checkBundleResolver
:: (HasConfig env, HasGHCVariant env)
=> WhichSolverCmd
-> Path Abs File -- ^ stack.yaml
-> InitOpts
-> Map PackageName (Path Abs File, C.GenericPackageDescription)
-- ^ Src package name: cabal dir, cabal package description
-> SnapshotDef
-> RIO env
(Either [PackageName] ( Map PackageName (Map FlagName Bool)
, Map PackageName Version))
checkBundleResolver whichCmd stackYaml initOpts bundle sd = do
result <- checkSnapBuildPlan (parent stackYaml) gpds Nothing sd
case result of
BuildPlanCheckOk f -> return $ Right (f, Map.empty)
BuildPlanCheckPartial f e -> do
shouldUseSolver <- case (resolver, initOpts) of
(_, InitOpts { useSolver = True }) -> return True
(ResolverCompiler _, _) -> do
logInfo "Using solver because a compiler resolver was specified."
return True
_ -> return False
if shouldUseSolver
then do
warnPartial result
solve f
else if omitPackages initOpts
then do
warnPartial result
logWarn "*** Omitting packages with unsatisfied dependencies"
return $ Left $ failedUserPkgs e
else throwM $ ResolverPartial whichCmd (sdResolverName sd) (show result)
BuildPlanCheckFail _ e _
| omitPackages initOpts -> do
logWarn $ "*** Resolver compiler mismatch: "
<> sdResolverName sd
logWarn $ indent $ T.pack $ show result
return $ Left $ failedUserPkgs e
| otherwise -> throwM $ ResolverMismatch whichCmd (sdResolverName sd) (show result)
where
resolver = sdResolver sd
indent t = T.unlines $ fmap (" " <>) (T.lines t)
warnPartial res = do
logWarn $ "*** Resolver " <> sdResolverName sd
<> " will need external packages: "
logWarn $ indent $ T.pack $ show res
failedUserPkgs e = Map.keys $ Map.unions (Map.elems (fmap deNeededBy e))
gpds = Map.elems (fmap snd bundle)
solve flags = do
let cabalDirs = map parent (Map.elems (fmap fst bundle))
srcConstraints = mergeConstraints (gpdPackages gpds) flags
eresult <- solveResolverSpec stackYaml cabalDirs
(sd, srcConstraints, Map.empty)
case eresult of
Right (src, ext) ->
return $ Right (fmap snd (Map.union src ext), fmap fst ext)
Left packages
| omitPackages initOpts, srcpkgs /= []-> do
pkg <- findOneIndependent srcpkgs flags
return $ Left [pkg]
| otherwise -> throwM (SolverGiveUp giveUpMsg)
where srcpkgs = Map.keys bundle `intersect` packages
-- among a list of packages find one on which none among the rest of the
-- packages depend. This package is a good candidate to be removed from
-- the list of packages when there is conflict in dependencies among this
-- set of packages.
findOneIndependent packages flags = do
platform <- view platformL
menv <- getMinimalEnvOverride
(compiler, _) <- getResolverConstraints menv Nothing stackYaml sd
let getGpd pkg = snd (fromMaybe (error "findOneIndependent: getGpd") (Map.lookup pkg bundle))
getFlags pkg = fromMaybe (error "fromOneIndependent: getFlags") (Map.lookup pkg flags)
deps pkg = gpdPackageDeps (getGpd pkg) compiler platform
(getFlags pkg)
allDeps = concatMap (Map.keys . deps) packages
isIndependent pkg = pkg `notElem` allDeps
-- prefer to reject packages in deeper directories
path pkg = fst (fromMaybe (error "findOneIndependent: path") (Map.lookup pkg bundle))
pathlen = length . FP.splitPath . toFilePath . path
maxPathlen = maximumBy (compare `on` pathlen)
return $ maxPathlen (filter isIndependent packages)
giveUpMsg = concat
[ " - Use '--omit-packages to exclude conflicting package(s).\n"
, " - Tweak the generated "
, toFilePath stackDotYaml <> " and then run 'stack solver':\n"
, " - Add any missing remote packages.\n"
, " - Add extra dependencies to guide solver.\n"
, " - Update external packages with 'stack update' and try again.\n"
] | 4,756 | checkBundleResolver
:: (HasConfig env, HasGHCVariant env)
=> WhichSolverCmd
-> Path Abs File -- ^ stack.yaml
-> InitOpts
-> Map PackageName (Path Abs File, C.GenericPackageDescription)
-- ^ Src package name: cabal dir, cabal package description
-> SnapshotDef
-> RIO env
(Either [PackageName] ( Map PackageName (Map FlagName Bool)
, Map PackageName Version))
checkBundleResolver whichCmd stackYaml initOpts bundle sd = do
result <- checkSnapBuildPlan (parent stackYaml) gpds Nothing sd
case result of
BuildPlanCheckOk f -> return $ Right (f, Map.empty)
BuildPlanCheckPartial f e -> do
shouldUseSolver <- case (resolver, initOpts) of
(_, InitOpts { useSolver = True }) -> return True
(ResolverCompiler _, _) -> do
logInfo "Using solver because a compiler resolver was specified."
return True
_ -> return False
if shouldUseSolver
then do
warnPartial result
solve f
else if omitPackages initOpts
then do
warnPartial result
logWarn "*** Omitting packages with unsatisfied dependencies"
return $ Left $ failedUserPkgs e
else throwM $ ResolverPartial whichCmd (sdResolverName sd) (show result)
BuildPlanCheckFail _ e _
| omitPackages initOpts -> do
logWarn $ "*** Resolver compiler mismatch: "
<> sdResolverName sd
logWarn $ indent $ T.pack $ show result
return $ Left $ failedUserPkgs e
| otherwise -> throwM $ ResolverMismatch whichCmd (sdResolverName sd) (show result)
where
resolver = sdResolver sd
indent t = T.unlines $ fmap (" " <>) (T.lines t)
warnPartial res = do
logWarn $ "*** Resolver " <> sdResolverName sd
<> " will need external packages: "
logWarn $ indent $ T.pack $ show res
failedUserPkgs e = Map.keys $ Map.unions (Map.elems (fmap deNeededBy e))
gpds = Map.elems (fmap snd bundle)
solve flags = do
let cabalDirs = map parent (Map.elems (fmap fst bundle))
srcConstraints = mergeConstraints (gpdPackages gpds) flags
eresult <- solveResolverSpec stackYaml cabalDirs
(sd, srcConstraints, Map.empty)
case eresult of
Right (src, ext) ->
return $ Right (fmap snd (Map.union src ext), fmap fst ext)
Left packages
| omitPackages initOpts, srcpkgs /= []-> do
pkg <- findOneIndependent srcpkgs flags
return $ Left [pkg]
| otherwise -> throwM (SolverGiveUp giveUpMsg)
where srcpkgs = Map.keys bundle `intersect` packages
-- among a list of packages find one on which none among the rest of the
-- packages depend. This package is a good candidate to be removed from
-- the list of packages when there is conflict in dependencies among this
-- set of packages.
findOneIndependent packages flags = do
platform <- view platformL
menv <- getMinimalEnvOverride
(compiler, _) <- getResolverConstraints menv Nothing stackYaml sd
let getGpd pkg = snd (fromMaybe (error "findOneIndependent: getGpd") (Map.lookup pkg bundle))
getFlags pkg = fromMaybe (error "fromOneIndependent: getFlags") (Map.lookup pkg flags)
deps pkg = gpdPackageDeps (getGpd pkg) compiler platform
(getFlags pkg)
allDeps = concatMap (Map.keys . deps) packages
isIndependent pkg = pkg `notElem` allDeps
-- prefer to reject packages in deeper directories
path pkg = fst (fromMaybe (error "findOneIndependent: path") (Map.lookup pkg bundle))
pathlen = length . FP.splitPath . toFilePath . path
maxPathlen = maximumBy (compare `on` pathlen)
return $ maxPathlen (filter isIndependent packages)
giveUpMsg = concat
[ " - Use '--omit-packages to exclude conflicting package(s).\n"
, " - Tweak the generated "
, toFilePath stackDotYaml <> " and then run 'stack solver':\n"
, " - Add any missing remote packages.\n"
, " - Add extra dependencies to guide solver.\n"
, " - Update external packages with 'stack update' and try again.\n"
] | 4,756 | checkBundleResolver whichCmd stackYaml initOpts bundle sd = do
result <- checkSnapBuildPlan (parent stackYaml) gpds Nothing sd
case result of
BuildPlanCheckOk f -> return $ Right (f, Map.empty)
BuildPlanCheckPartial f e -> do
shouldUseSolver <- case (resolver, initOpts) of
(_, InitOpts { useSolver = True }) -> return True
(ResolverCompiler _, _) -> do
logInfo "Using solver because a compiler resolver was specified."
return True
_ -> return False
if shouldUseSolver
then do
warnPartial result
solve f
else if omitPackages initOpts
then do
warnPartial result
logWarn "*** Omitting packages with unsatisfied dependencies"
return $ Left $ failedUserPkgs e
else throwM $ ResolverPartial whichCmd (sdResolverName sd) (show result)
BuildPlanCheckFail _ e _
| omitPackages initOpts -> do
logWarn $ "*** Resolver compiler mismatch: "
<> sdResolverName sd
logWarn $ indent $ T.pack $ show result
return $ Left $ failedUserPkgs e
| otherwise -> throwM $ ResolverMismatch whichCmd (sdResolverName sd) (show result)
where
resolver = sdResolver sd
indent t = T.unlines $ fmap (" " <>) (T.lines t)
warnPartial res = do
logWarn $ "*** Resolver " <> sdResolverName sd
<> " will need external packages: "
logWarn $ indent $ T.pack $ show res
failedUserPkgs e = Map.keys $ Map.unions (Map.elems (fmap deNeededBy e))
gpds = Map.elems (fmap snd bundle)
solve flags = do
let cabalDirs = map parent (Map.elems (fmap fst bundle))
srcConstraints = mergeConstraints (gpdPackages gpds) flags
eresult <- solveResolverSpec stackYaml cabalDirs
(sd, srcConstraints, Map.empty)
case eresult of
Right (src, ext) ->
return $ Right (fmap snd (Map.union src ext), fmap fst ext)
Left packages
| omitPackages initOpts, srcpkgs /= []-> do
pkg <- findOneIndependent srcpkgs flags
return $ Left [pkg]
| otherwise -> throwM (SolverGiveUp giveUpMsg)
where srcpkgs = Map.keys bundle `intersect` packages
-- among a list of packages find one on which none among the rest of the
-- packages depend. This package is a good candidate to be removed from
-- the list of packages when there is conflict in dependencies among this
-- set of packages.
findOneIndependent packages flags = do
platform <- view platformL
menv <- getMinimalEnvOverride
(compiler, _) <- getResolverConstraints menv Nothing stackYaml sd
let getGpd pkg = snd (fromMaybe (error "findOneIndependent: getGpd") (Map.lookup pkg bundle))
getFlags pkg = fromMaybe (error "fromOneIndependent: getFlags") (Map.lookup pkg flags)
deps pkg = gpdPackageDeps (getGpd pkg) compiler platform
(getFlags pkg)
allDeps = concatMap (Map.keys . deps) packages
isIndependent pkg = pkg `notElem` allDeps
-- prefer to reject packages in deeper directories
path pkg = fst (fromMaybe (error "findOneIndependent: path") (Map.lookup pkg bundle))
pathlen = length . FP.splitPath . toFilePath . path
maxPathlen = maximumBy (compare `on` pathlen)
return $ maxPathlen (filter isIndependent packages)
giveUpMsg = concat
[ " - Use '--omit-packages to exclude conflicting package(s).\n"
, " - Tweak the generated "
, toFilePath stackDotYaml <> " and then run 'stack solver':\n"
, " - Add any missing remote packages.\n"
, " - Add extra dependencies to guide solver.\n"
, " - Update external packages with 'stack update' and try again.\n"
] | 4,320 | false | true | 4 | 19 | 1,712 | 1,133 | 544 | 589 | null | null |
duplode/stack | src/Stack/Package.hs | bsd-3-clause | getCabalFileName
:: (MonadThrow m, MonadIO m)
=> Path Abs Dir -- ^ package directory
-> m (Path Abs File)
getCabalFileName pkgDir = do
files <- liftIO $ findFiles
pkgDir
(flip hasExtension "cabal" . FL.toFilePath)
(const False)
case files of
[] -> throwM $ PackageNoCabalFileFound pkgDir
[x] -> return x
_:_ -> throwM $ PackageMultipleCabalFilesFound pkgDir files
where hasExtension fp x = FilePath.takeExtensions fp == "." ++ x
-- | Path for the package's build log. | 538 | getCabalFileName
:: (MonadThrow m, MonadIO m)
=> Path Abs Dir -- ^ package directory
-> m (Path Abs File)
getCabalFileName pkgDir = do
files <- liftIO $ findFiles
pkgDir
(flip hasExtension "cabal" . FL.toFilePath)
(const False)
case files of
[] -> throwM $ PackageNoCabalFileFound pkgDir
[x] -> return x
_:_ -> throwM $ PackageMultipleCabalFilesFound pkgDir files
where hasExtension fp x = FilePath.takeExtensions fp == "." ++ x
-- | Path for the package's build log. | 538 | getCabalFileName pkgDir = do
files <- liftIO $ findFiles
pkgDir
(flip hasExtension "cabal" . FL.toFilePath)
(const False)
case files of
[] -> throwM $ PackageNoCabalFileFound pkgDir
[x] -> return x
_:_ -> throwM $ PackageMultipleCabalFilesFound pkgDir files
where hasExtension fp x = FilePath.takeExtensions fp == "." ++ x
-- | Path for the package's build log. | 420 | false | true | 0 | 12 | 145 | 167 | 81 | 86 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_SQL_COMMENTLINE :: Int
wxSTC_SQL_COMMENTLINE = 2 | 54 | wxSTC_SQL_COMMENTLINE :: Int
wxSTC_SQL_COMMENTLINE = 2 | 54 | wxSTC_SQL_COMMENTLINE = 2 | 25 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
YoshikuniJujo/forest | subprojects/http-analysis/get/get.hs | bsd-3-clause | main :: IO ()
main = do
(pn :: Int) : _ <- mapM readIO =<< getArgs
sv <- connectTo "localhost" (PortNumber $ fromIntegral pn)
httpGet sv >>= print | 149 | main :: IO ()
main = do
(pn :: Int) : _ <- mapM readIO =<< getArgs
sv <- connectTo "localhost" (PortNumber $ fromIntegral pn)
httpGet sv >>= print | 149 | main = do
(pn :: Int) : _ <- mapM readIO =<< getArgs
sv <- connectTo "localhost" (PortNumber $ fromIntegral pn)
httpGet sv >>= print | 135 | false | true | 0 | 11 | 31 | 79 | 35 | 44 | null | null |
knupfer/ninety-nine | test/Main.hs | gpl-2.0 | p63 Empty = [] | 14 | p63 Empty = [] | 14 | p63 Empty = [] | 14 | false | false | 1 | 6 | 3 | 15 | 5 | 10 | null | null |
flipstone/kioku | benchmarks/Main.hs | mit | testDataKey :: TestData -> BS.ByteString
testDataKey (TestData bytes) = bytes | 77 | testDataKey :: TestData -> BS.ByteString
testDataKey (TestData bytes) = bytes | 77 | testDataKey (TestData bytes) = bytes | 36 | false | true | 0 | 7 | 9 | 26 | 13 | 13 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/InstanceTemplates/TestIAMPermissions.hs | mpl-2.0 | -- | Project ID for this request.
ittipProject :: Lens' InstanceTemplatesTestIAMPermissions Text
ittipProject
= lens _ittipProject (\ s a -> s{_ittipProject = a}) | 164 | ittipProject :: Lens' InstanceTemplatesTestIAMPermissions Text
ittipProject
= lens _ittipProject (\ s a -> s{_ittipProject = a}) | 130 | ittipProject
= lens _ittipProject (\ s a -> s{_ittipProject = a}) | 67 | true | true | 0 | 9 | 24 | 42 | 22 | 20 | null | null |
vladimir-ipatov/ganeti | src/Ganeti/Query/Query.hs | gpl-2.0 | queryInner cfg live (Query (ItemTypeOpCode QRNetwork) fields qfilter) wanted =
genericQuery Network.fieldsMap Network.collectLiveData
(fromNonEmpty . networkName)
configNetworks getNetwork cfg live fields qfilter wanted | 251 | queryInner cfg live (Query (ItemTypeOpCode QRNetwork) fields qfilter) wanted =
genericQuery Network.fieldsMap Network.collectLiveData
(fromNonEmpty . networkName)
configNetworks getNetwork cfg live fields qfilter wanted | 251 | queryInner cfg live (Query (ItemTypeOpCode QRNetwork) fields qfilter) wanted =
genericQuery Network.fieldsMap Network.collectLiveData
(fromNonEmpty . networkName)
configNetworks getNetwork cfg live fields qfilter wanted | 251 | false | false | 0 | 9 | 54 | 63 | 31 | 32 | null | null |
buckie/juno | src/Juno/Consensus/Handle/AppendEntriesResponse.hs | bsd-3-clause | handle :: Monad m => AppendEntriesResponse -> JT.Raft m ()
handle ae = do
s <- get
let ape = AEResponseEnv
(JT._nodeRole s)
(JT._term s)
(JT._commitProof s)
(AEResponseOut{..}, l) <- runReaderT (runWriterT (handleAEResponse ae)) ape
mapM_ debug l
JT.commitProof .= _stateMergeCommitProof
doCommit
case _leaderState of
NotLeader -> return ()
DoNothing -> resetElectionTimerLeader
StatelessSendAE{..} ->
resetElectionTimerLeader
Unconvinced{..} -> do
JT.lConvinced %= Set.delete _deleteConvinced
resetElectionTimerLeader
ConvincedAndSuccessful{..} -> do
updateLNextIndex $ Map.insert _incrementNextIndexNode $ _incrementNextIndexLogIndex + 1
JT.lConvinced %= Set.insert _insertConvinced
resetElectionTimerLeader
ConvincedAndUnsuccessful{..} -> do
updateLNextIndex $ Map.insert _sendAENodeID _setLaggingLogIndex
resetElectionTimerLeader | 961 | handle :: Monad m => AppendEntriesResponse -> JT.Raft m ()
handle ae = do
s <- get
let ape = AEResponseEnv
(JT._nodeRole s)
(JT._term s)
(JT._commitProof s)
(AEResponseOut{..}, l) <- runReaderT (runWriterT (handleAEResponse ae)) ape
mapM_ debug l
JT.commitProof .= _stateMergeCommitProof
doCommit
case _leaderState of
NotLeader -> return ()
DoNothing -> resetElectionTimerLeader
StatelessSendAE{..} ->
resetElectionTimerLeader
Unconvinced{..} -> do
JT.lConvinced %= Set.delete _deleteConvinced
resetElectionTimerLeader
ConvincedAndSuccessful{..} -> do
updateLNextIndex $ Map.insert _incrementNextIndexNode $ _incrementNextIndexLogIndex + 1
JT.lConvinced %= Set.insert _insertConvinced
resetElectionTimerLeader
ConvincedAndUnsuccessful{..} -> do
updateLNextIndex $ Map.insert _sendAENodeID _setLaggingLogIndex
resetElectionTimerLeader | 961 | handle ae = do
s <- get
let ape = AEResponseEnv
(JT._nodeRole s)
(JT._term s)
(JT._commitProof s)
(AEResponseOut{..}, l) <- runReaderT (runWriterT (handleAEResponse ae)) ape
mapM_ debug l
JT.commitProof .= _stateMergeCommitProof
doCommit
case _leaderState of
NotLeader -> return ()
DoNothing -> resetElectionTimerLeader
StatelessSendAE{..} ->
resetElectionTimerLeader
Unconvinced{..} -> do
JT.lConvinced %= Set.delete _deleteConvinced
resetElectionTimerLeader
ConvincedAndSuccessful{..} -> do
updateLNextIndex $ Map.insert _incrementNextIndexNode $ _incrementNextIndexLogIndex + 1
JT.lConvinced %= Set.insert _insertConvinced
resetElectionTimerLeader
ConvincedAndUnsuccessful{..} -> do
updateLNextIndex $ Map.insert _sendAENodeID _setLaggingLogIndex
resetElectionTimerLeader | 902 | false | true | 0 | 16 | 215 | 280 | 129 | 151 | null | null |
hth313/hthforth | src/Language/Forth/Dictionary.hs | bsd-2-clause | -- Create a new basic dictionary.
newDictionary :: Primitive a =>
[WordId] ->
State (Dictionary a, [WordId], Maybe (Labels WordId)) () ->
Maybe (Labels WordId) ->
(Dictionary a, [WordId], Maybe (Labels WordId))
newDictionary wids extras mLabels =
execState build (Dictionary Nothing (Value 0), wids, mLabels) where
build = do
addWord exitName Native exit
addWord "EXECUTE" Native execute
addWord "SWAP" Native swap
addWord "DROP" Native drop
addWord "OVER" Native over
addWord "DUP" Native dup
addWord "R>" Native rto
addWord ">R" Native tor
addWord "R@" Native rfetch
addWord "+" Native plus
addWord "-" Native minus
addWord "AND" Native and
addWord "OR" Native or
addWord "XOR" Native xor
addWord "2*" Native twoStar
addWord "2/" Native twoSlash
addWord "LSHIFT" Native lshift
addWord "RSHIFT" Native rshift
addWord "0=" Native zerop
addWord "0<" Native lt0
addWord "!" Native store
addWord "C!" Native cstore
addWord "@" Native fetch
addWord "C@" Native cfetch
addWord "CONSTANT" Native constant
addWord "UM*" Native umstar
addWord "UM/MOD" Native ummod
extras | 1,341 | newDictionary :: Primitive a =>
[WordId] ->
State (Dictionary a, [WordId], Maybe (Labels WordId)) () ->
Maybe (Labels WordId) ->
(Dictionary a, [WordId], Maybe (Labels WordId))
newDictionary wids extras mLabels =
execState build (Dictionary Nothing (Value 0), wids, mLabels) where
build = do
addWord exitName Native exit
addWord "EXECUTE" Native execute
addWord "SWAP" Native swap
addWord "DROP" Native drop
addWord "OVER" Native over
addWord "DUP" Native dup
addWord "R>" Native rto
addWord ">R" Native tor
addWord "R@" Native rfetch
addWord "+" Native plus
addWord "-" Native minus
addWord "AND" Native and
addWord "OR" Native or
addWord "XOR" Native xor
addWord "2*" Native twoStar
addWord "2/" Native twoSlash
addWord "LSHIFT" Native lshift
addWord "RSHIFT" Native rshift
addWord "0=" Native zerop
addWord "0<" Native lt0
addWord "!" Native store
addWord "C!" Native cstore
addWord "@" Native fetch
addWord "C@" Native cfetch
addWord "CONSTANT" Native constant
addWord "UM*" Native umstar
addWord "UM/MOD" Native ummod
extras | 1,307 | newDictionary wids extras mLabels =
execState build (Dictionary Nothing (Value 0), wids, mLabels) where
build = do
addWord exitName Native exit
addWord "EXECUTE" Native execute
addWord "SWAP" Native swap
addWord "DROP" Native drop
addWord "OVER" Native over
addWord "DUP" Native dup
addWord "R>" Native rto
addWord ">R" Native tor
addWord "R@" Native rfetch
addWord "+" Native plus
addWord "-" Native minus
addWord "AND" Native and
addWord "OR" Native or
addWord "XOR" Native xor
addWord "2*" Native twoStar
addWord "2/" Native twoSlash
addWord "LSHIFT" Native lshift
addWord "RSHIFT" Native rshift
addWord "0=" Native zerop
addWord "0<" Native lt0
addWord "!" Native store
addWord "C!" Native cstore
addWord "@" Native fetch
addWord "C@" Native cfetch
addWord "CONSTANT" Native constant
addWord "UM*" Native umstar
addWord "UM/MOD" Native ummod
extras | 1,063 | true | true | 1 | 14 | 435 | 421 | 181 | 240 | null | null |
ekmett/wl-pprint-extras | src/Text/PrettyPrint/Free/Internal.hs | bsd-2-clause | flatten (Ribbon f) = Ribbon (flatten . f) | 46 | flatten (Ribbon f) = Ribbon (flatten . f) | 46 | flatten (Ribbon f) = Ribbon (flatten . f) | 46 | false | false | 0 | 7 | 12 | 25 | 12 | 13 | null | null |
MaxDaten/yage | src/Yage/Rendering/Mesh.hs | mit | -- stolen from http://www.haskell.org/pipermail/beginners/2010-October/005571.html
octets :: Word32 -> [Word8]
octets w =
[ fromIntegral (w `shiftR` 24)
, fromIntegral (w `shiftR` 16)
, fromIntegral (w `shiftR` 8)
, fromIntegral w
] | 252 | octets :: Word32 -> [Word8]
octets w =
[ fromIntegral (w `shiftR` 24)
, fromIntegral (w `shiftR` 16)
, fromIntegral (w `shiftR` 8)
, fromIntegral w
] | 169 | octets w =
[ fromIntegral (w `shiftR` 24)
, fromIntegral (w `shiftR` 16)
, fromIntegral (w `shiftR` 8)
, fromIntegral w
] | 141 | true | true | 0 | 9 | 50 | 77 | 43 | 34 | null | null |
Lazersmoke/rhc | src/Old/FESTtoBEST.hs | bsd-3-clause | -- Right now we are throwing out the context TODO: Fix that
-- (e :: C t => t) => [e :: t]
simplify (F.TypeAnnotatedExpression e (F.TypeSignature _ t)) = B.TypedExpression (simplify e) (simplifyType t) | 203 | simplify (F.TypeAnnotatedExpression e (F.TypeSignature _ t)) = B.TypedExpression (simplify e) (simplifyType t) | 110 | simplify (F.TypeAnnotatedExpression e (F.TypeSignature _ t)) = B.TypedExpression (simplify e) (simplifyType t) | 110 | true | false | 0 | 9 | 36 | 51 | 25 | 26 | null | null |
christiaanb/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | orphNamesOfTypes :: [Type] -> NameSet
orphNamesOfTypes = orphNamesOfThings orphNamesOfType | 90 | orphNamesOfTypes :: [Type] -> NameSet
orphNamesOfTypes = orphNamesOfThings orphNamesOfType | 90 | orphNamesOfTypes = orphNamesOfThings orphNamesOfType | 52 | false | true | 0 | 7 | 8 | 27 | 12 | 15 | null | null |
lambdageek/small | src/Algo/DebPho.hs | bsd-3-clause | debruijn :: Term Identity -> Expr
debruijn m = runReader (debruijn' m) 0 | 72 | debruijn :: Term Identity -> Expr
debruijn m = runReader (debruijn' m) 0 | 72 | debruijn m = runReader (debruijn' m) 0 | 38 | false | true | 0 | 7 | 12 | 39 | 16 | 23 | null | null |
nagyf/hs-chess | src/Board.hs | mit | enemyColor Black = White | 24 | enemyColor Black = White | 24 | enemyColor Black = White | 24 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
vinnymac/glot-www | Model/Snippet/Api.hs | mit | createSnippetUrl :: String -> String
createSnippetUrl baseUrl = baseUrl ++ "/snippets" | 86 | createSnippetUrl :: String -> String
createSnippetUrl baseUrl = baseUrl ++ "/snippets" | 86 | createSnippetUrl baseUrl = baseUrl ++ "/snippets" | 49 | false | true | 0 | 5 | 10 | 22 | 11 | 11 | null | null |
8l/asif | tests/Language/FOmega/Test/Derivation.hs | mit | showErr (AppError e1 e2 t1 t2) =
unlines ["AppError", showView e1, showView e2, showView t1, showView t2] | 107 | showErr (AppError e1 e2 t1 t2) =
unlines ["AppError", showView e1, showView e2, showView t1, showView t2] | 107 | showErr (AppError e1 e2 t1 t2) =
unlines ["AppError", showView e1, showView e2, showView t1, showView t2] | 107 | false | false | 0 | 7 | 18 | 51 | 25 | 26 | null | null |
meteogrid/mime-mail-parser | Network/Mail/Mime/Parser/Internal/Common.hs | bsd-3-clause | isHorizontalSpace :: Char -> Bool
isHorizontalSpace c = c==' ' || c=='\t' | 73 | isHorizontalSpace :: Char -> Bool
isHorizontalSpace c = c==' ' || c=='\t' | 73 | isHorizontalSpace c = c==' ' || c=='\t' | 39 | false | true | 0 | 7 | 11 | 30 | 15 | 15 | null | null |
siddhanathan/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | typeable6ClassKey = mkPreludeClassUnique 26 | 49 | typeable6ClassKey = mkPreludeClassUnique 26 | 49 | typeable6ClassKey = mkPreludeClassUnique 26 | 49 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
lorcanmcdonald/mars | src/Client/Main.hs | bsd-3-clause | addHistory :: String -> IO ()
addHistory _ = return () | 54 | addHistory :: String -> IO ()
addHistory _ = return () | 54 | addHistory _ = return () | 24 | false | true | 0 | 7 | 10 | 32 | 14 | 18 | null | null |
bjornbm/astro | test/Astro/Time/Barycentric/TestAsA2009.hs | bsd-3-clause | tt = clock 2004 04 06 7 52 32.570009 TT | 40 | tt = clock 2004 04 06 7 52 32.570009 TT | 40 | tt = clock 2004 04 06 7 52 32.570009 TT | 40 | false | false | 1 | 5 | 10 | 24 | 10 | 14 | null | null |
dinnu93/CIS194 | Lecture-07/Editor.hs | cc0-1.0 | doCommand Edit = do
l <- getCurLine
io $ putStr $ "Replace line " ++ show l ++ ": "
new <- io getLine
modBuffer $ replaceLine l new | 139 | doCommand Edit = do
l <- getCurLine
io $ putStr $ "Replace line " ++ show l ++ ": "
new <- io getLine
modBuffer $ replaceLine l new | 139 | doCommand Edit = do
l <- getCurLine
io $ putStr $ "Replace line " ++ show l ++ ": "
new <- io getLine
modBuffer $ replaceLine l new | 139 | false | false | 0 | 10 | 36 | 60 | 26 | 34 | null | null |
henvic/plc | src/DetalhesSobreListasERecursao.hs | cc0-1.0 | debitar n v [] = [] | 19 | debitar n v [] = [] | 19 | debitar n v [] = [] | 19 | false | false | 0 | 6 | 5 | 17 | 8 | 9 | null | null |
dmit/slct-hs | SLCT/Constants.hs | gpl-2.0 | -- we do not want our constants to be editable outside of this module
maxLineLength :: Constants -> Int
maxLineLength = _maxLineLength | 135 | maxLineLength :: Constants -> Int
maxLineLength = _maxLineLength | 64 | maxLineLength = _maxLineLength | 30 | true | true | 0 | 5 | 22 | 16 | 9 | 7 | null | null |
facebookincubator/duckling | Duckling/CreditCardNumber/Helpers.hs | bsd-3-clause | amexCreditCardNumberRegex :: String
amexCreditCardNumberRegex = "(" ++ withoutDashes ++ "|" ++ withDashes ++")"
where
withoutDashes = "3[47][0-9]{13}"
withDashes = "3[47][0-9]{2}-[0-9]{6}-[0-9]{5}"
-- | Discover credit card regex informed by latest BIN info | 268 | amexCreditCardNumberRegex :: String
amexCreditCardNumberRegex = "(" ++ withoutDashes ++ "|" ++ withDashes ++")"
where
withoutDashes = "3[47][0-9]{13}"
withDashes = "3[47][0-9]{2}-[0-9]{6}-[0-9]{5}"
-- | Discover credit card regex informed by latest BIN info | 268 | amexCreditCardNumberRegex = "(" ++ withoutDashes ++ "|" ++ withDashes ++")"
where
withoutDashes = "3[47][0-9]{13}"
withDashes = "3[47][0-9]{2}-[0-9]{6}-[0-9]{5}"
-- | Discover credit card regex informed by latest BIN info | 232 | false | true | 0 | 8 | 41 | 41 | 22 | 19 | null | null |
nevrenato/HetsAlloy | QBF/Parse_AS_Basic.hs | gpl-2.0 | -- | Parser for true
trueKey :: AnnoState.AParser st Id.Token
trueKey = AnnoState.asKey Keywords.trueS | 102 | trueKey :: AnnoState.AParser st Id.Token
trueKey = AnnoState.asKey Keywords.trueS | 81 | trueKey = AnnoState.asKey Keywords.trueS | 40 | true | true | 1 | 6 | 13 | 31 | 14 | 17 | null | null |
arnizamani/SeqSolver | Amath/Proofs.hs | gpl-2.0 | export' (PState _ _ wm rule _) "pm" = show rule | 47 | export' (PState _ _ wm rule _) "pm" = show rule | 47 | export' (PState _ _ wm rule _) "pm" = show rule | 47 | false | false | 1 | 6 | 10 | 29 | 13 | 16 | null | null |
ethercrow/yi | yi-core/src/Yi/Buffer/HighLevel.hs | gpl-2.0 | scrollToCursorB :: BufferM ()
scrollToCursorB = do
MarkSet f i _ <- markLines
h <- askWindow actualLines
let m = f + (h `div` 2)
scrollB $ i - m
-- | Move cursor to the top of the screen | 203 | scrollToCursorB :: BufferM ()
scrollToCursorB = do
MarkSet f i _ <- markLines
h <- askWindow actualLines
let m = f + (h `div` 2)
scrollB $ i - m
-- | Move cursor to the top of the screen | 203 | scrollToCursorB = do
MarkSet f i _ <- markLines
h <- askWindow actualLines
let m = f + (h `div` 2)
scrollB $ i - m
-- | Move cursor to the top of the screen | 173 | false | true | 1 | 12 | 56 | 78 | 36 | 42 | null | null |
aisamanra/activitystreams-aeson | Codec/ActivityStream/Representation.hs | bsd-3-clause | -- | An IRI <http://www.ietf.org/rfc/rfc3987.txt RFC3987>
-- identifying a resource providing an HTML representation of the
-- activity. An activity MAY contain a @url@ property.
acURL :: Lens' Activity (Maybe Text)
acURL = makeAesonLensMb "url" acRest | 256 | acURL :: Lens' Activity (Maybe Text)
acURL = makeAesonLensMb "url" acRest | 73 | acURL = makeAesonLensMb "url" acRest | 36 | true | true | 1 | 7 | 39 | 33 | 16 | 17 | null | null |
AlexeyRaga/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | gHC_FINGERPRINT_TYPE :: Module
gHC_FINGERPRINT_TYPE = mkBaseModule (fsLit "GHC.Fingerprint.Type") | 97 | gHC_FINGERPRINT_TYPE :: Module
gHC_FINGERPRINT_TYPE = mkBaseModule (fsLit "GHC.Fingerprint.Type") | 97 | gHC_FINGERPRINT_TYPE = mkBaseModule (fsLit "GHC.Fingerprint.Type") | 66 | false | true | 0 | 7 | 7 | 20 | 10 | 10 | null | null |
sampou-org/pfad | Code/Code25.hs | bsd-3-clause | enarrow :: (Int,Interval) -> Interval -> (Int,Interval)
enarrow ei j = (n,i |> j) where (n,i) = extend ei
-- A New definition
-- encode3 :: Model -> [Symbol] -> [Bit]
-- encode3 m = stream ebit enarrow (0,(0,2^e)) . intervals m
{-
ebit :: (Int, Interval) -> Maybe (Bit,(Int,(Int,Int)))
ebit (0,(l,r))
| r <= e2 = Just (0,(0,(2*l,2*r)))
| e2 <= l = Just (1,(0,(2*l-e4,2*r-e4)))
| otherwise = Nothing
ebit (n+1,(l,r))
| r <= e2 = Just (0,(n,(l+2^n*e2,r+2^n*e2)))
| e2 <= l = Just (1,(n,(l-2^n*e2,r-2^n*e2)))
| otherwise = Nothing
-} | 579 | enarrow :: (Int,Interval) -> Interval -> (Int,Interval)
enarrow ei j = (n,i |> j) where (n,i) = extend ei
-- A New definition
-- encode3 :: Model -> [Symbol] -> [Bit]
-- encode3 m = stream ebit enarrow (0,(0,2^e)) . intervals m
{-
ebit :: (Int, Interval) -> Maybe (Bit,(Int,(Int,Int)))
ebit (0,(l,r))
| r <= e2 = Just (0,(0,(2*l,2*r)))
| e2 <= l = Just (1,(0,(2*l-e4,2*r-e4)))
| otherwise = Nothing
ebit (n+1,(l,r))
| r <= e2 = Just (0,(n,(l+2^n*e2,r+2^n*e2)))
| e2 <= l = Just (1,(n,(l-2^n*e2,r-2^n*e2)))
| otherwise = Nothing
-} | 579 | enarrow ei j = (n,i |> j) where (n,i) = extend ei
-- A New definition
-- encode3 :: Model -> [Symbol] -> [Bit]
-- encode3 m = stream ebit enarrow (0,(0,2^e)) . intervals m
{-
ebit :: (Int, Interval) -> Maybe (Bit,(Int,(Int,Int)))
ebit (0,(l,r))
| r <= e2 = Just (0,(0,(2*l,2*r)))
| e2 <= l = Just (1,(0,(2*l-e4,2*r-e4)))
| otherwise = Nothing
ebit (n+1,(l,r))
| r <= e2 = Just (0,(n,(l+2^n*e2,r+2^n*e2)))
| e2 <= l = Just (1,(n,(l-2^n*e2,r-2^n*e2)))
| otherwise = Nothing
-} | 516 | false | true | 0 | 9 | 139 | 72 | 40 | 32 | null | null |
urbanslug/ghc | compiler/llvmGen/Llvm/Types.hs | bsd-3-clause | -- | Lower a variable of 'LMPointer' type.
pVarLower :: LlvmVar -> LlvmVar
pVarLower (LMGlobalVar s t l x a c) = LMGlobalVar s (pLower t) l x a c | 145 | pVarLower :: LlvmVar -> LlvmVar
pVarLower (LMGlobalVar s t l x a c) = LMGlobalVar s (pLower t) l x a c | 102 | pVarLower (LMGlobalVar s t l x a c) = LMGlobalVar s (pLower t) l x a c | 70 | true | true | 0 | 7 | 29 | 54 | 27 | 27 | null | null |
TomMD/cryptol | cryptol/OptParser.hs | bsd-3-clause | runOptParser :: opt -> OptParser opt -> Either [String] opt
runOptParser def parse = case parse of
OptSuccess update -> Right (appEndo update def)
OptFailure msgs -> Left msgs | 181 | runOptParser :: opt -> OptParser opt -> Either [String] opt
runOptParser def parse = case parse of
OptSuccess update -> Right (appEndo update def)
OptFailure msgs -> Left msgs | 181 | runOptParser def parse = case parse of
OptSuccess update -> Right (appEndo update def)
OptFailure msgs -> Left msgs | 121 | false | true | 0 | 10 | 34 | 71 | 33 | 38 | null | null |
mfpi/OpenGL | Graphics/Rendering/OpenGL/GL/BufferObjects.hs | bsd-3-clause | bufferMapped :: BufferTarget -> GettableStateVar Bool
bufferMapped t = makeGettableStateVar $
getBufferParameter t unmarshalGLboolean GetBufferMapped | 152 | bufferMapped :: BufferTarget -> GettableStateVar Bool
bufferMapped t = makeGettableStateVar $
getBufferParameter t unmarshalGLboolean GetBufferMapped | 152 | bufferMapped t = makeGettableStateVar $
getBufferParameter t unmarshalGLboolean GetBufferMapped | 98 | false | true | 0 | 6 | 17 | 32 | 15 | 17 | null | null |
tim-m89/Salsa | Foreign/Salsa/Win/CLRHost.hs | bsd-3-clause | -- | 'all_IEnumUnknown'
all_IEnumUnknown :: IEnumUnknown -> [InterfacePtr] -> IO [InterfacePtr]
all_IEnumUnknown this xs = do
next <- next_IEnumUnknown this
if next == nullPtr then
return xs
else
all_IEnumUnknown this (next : xs)
-- | 'getRuntimes_ICLRMetaHost' | 290 | all_IEnumUnknown :: IEnumUnknown -> [InterfacePtr] -> IO [InterfacePtr]
all_IEnumUnknown this xs = do
next <- next_IEnumUnknown this
if next == nullPtr then
return xs
else
all_IEnumUnknown this (next : xs)
-- | 'getRuntimes_ICLRMetaHost' | 266 | all_IEnumUnknown this xs = do
next <- next_IEnumUnknown this
if next == nullPtr then
return xs
else
all_IEnumUnknown this (next : xs)
-- | 'getRuntimes_ICLRMetaHost' | 194 | true | true | 0 | 10 | 64 | 75 | 38 | 37 | null | null |
scvalex/daemons | src/Control/Pipe/Socket.hs | gpl-3.0 | runSocketClient :: (MonadIO m) => Socket -> Handler r -> m r
runSocketClient socket handler = liftIO $ do
handler (socketReader socket) (socketWriter socket) | 161 | runSocketClient :: (MonadIO m) => Socket -> Handler r -> m r
runSocketClient socket handler = liftIO $ do
handler (socketReader socket) (socketWriter socket) | 161 | runSocketClient socket handler = liftIO $ do
handler (socketReader socket) (socketWriter socket) | 100 | false | true | 0 | 10 | 27 | 63 | 30 | 33 | null | null |
JPMoresmau/leksah | src/IDE/Leksah.hs | gpl-2.0 | loopn :: Int -> IO Bool
loopn 0 = return False | 46 | loopn :: Int -> IO Bool
loopn 0 = return False | 46 | loopn 0 = return False | 22 | false | true | 0 | 6 | 10 | 24 | 11 | 13 | null | null |
izgzhen/aliyun-haskell-sdk | src/Aliyun/API.hs | apache-2.0 | getTime :: IO String
getTime = do
utcTime <- getCurrentTime
let format = iso8601DateFormat (Just "%H:%M:%SZ")
let time = formatTime defaultTimeLocale format utcTime
return time | 192 | getTime :: IO String
getTime = do
utcTime <- getCurrentTime
let format = iso8601DateFormat (Just "%H:%M:%SZ")
let time = formatTime defaultTimeLocale format utcTime
return time | 192 | getTime = do
utcTime <- getCurrentTime
let format = iso8601DateFormat (Just "%H:%M:%SZ")
let time = formatTime defaultTimeLocale format utcTime
return time | 171 | false | true | 0 | 13 | 40 | 67 | 28 | 39 | null | null |
skyfmmf/coord-center | app/Main.hs | bsd-3-clause | config :: Parser Config
config = Config
<$> strOption
( long "file"
<> short 'f'
<> metavar "FILE"
<> value "data.yml"
<> showDefault
<> help "Get the data for the calculation from FILE"
) | 213 | config :: Parser Config
config = Config
<$> strOption
( long "file"
<> short 'f'
<> metavar "FILE"
<> value "data.yml"
<> showDefault
<> help "Get the data for the calculation from FILE"
) | 213 | config = Config
<$> strOption
( long "file"
<> short 'f'
<> metavar "FILE"
<> value "data.yml"
<> showDefault
<> help "Get the data for the calculation from FILE"
) | 189 | false | true | 2 | 12 | 58 | 61 | 27 | 34 | null | null |
ancientlanguage/haskell-analysis | grammar/src/Grammar/Common/Decompose.hs | mit | decomposeChar '\x2F971' = "\x4334" | 34 | decomposeChar '\x2F971' = "\x4334" | 34 | decomposeChar '\x2F971' = "\x4334" | 34 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
thalerjonathan/phd | public/ArtIterating/code/haskell/PureAgentsPar/src/PureAgentsPar.hs | gpl-3.0 | deliverMsg :: Map.Map AgentId (Agent m s e) -> (AgentId, AgentId, m) -> Map.Map AgentId (Agent m s e)
deliverMsg am (senderId, receiverId, m)
| receiverNotFound = am
| otherwise = Map.insert receiverId a' am
where
mayReceiver = Map.lookup receiverId am
receiverNotFound = isNothing mayReceiver
a = (fromJust mayReceiver)
ib = inBox a
ibM = (senderId, m)
-- NOTE: need to deliver messages in the received order => append at the end: ib ++ [ibM]
a' = a { inBox = ib ++ [ibM] }
-- NOTE: first AgentId: senderId, second AgentId: receiverId | 604 | deliverMsg :: Map.Map AgentId (Agent m s e) -> (AgentId, AgentId, m) -> Map.Map AgentId (Agent m s e)
deliverMsg am (senderId, receiverId, m)
| receiverNotFound = am
| otherwise = Map.insert receiverId a' am
where
mayReceiver = Map.lookup receiverId am
receiverNotFound = isNothing mayReceiver
a = (fromJust mayReceiver)
ib = inBox a
ibM = (senderId, m)
-- NOTE: need to deliver messages in the received order => append at the end: ib ++ [ibM]
a' = a { inBox = ib ++ [ibM] }
-- NOTE: first AgentId: senderId, second AgentId: receiverId | 604 | deliverMsg am (senderId, receiverId, m)
| receiverNotFound = am
| otherwise = Map.insert receiverId a' am
where
mayReceiver = Map.lookup receiverId am
receiverNotFound = isNothing mayReceiver
a = (fromJust mayReceiver)
ib = inBox a
ibM = (senderId, m)
-- NOTE: need to deliver messages in the received order => append at the end: ib ++ [ibM]
a' = a { inBox = ib ++ [ibM] }
-- NOTE: first AgentId: senderId, second AgentId: receiverId | 502 | false | true | 6 | 9 | 161 | 176 | 92 | 84 | null | null |
meteogrid/spatial-reference | src/SpatialReference.hs | bsd-3-clause | mkEPSG _ = Nothing | 25 | mkEPSG _ = Nothing | 25 | mkEPSG _ = Nothing | 25 | false | false | 0 | 5 | 10 | 9 | 4 | 5 | null | null |
draperlaboratory/specgen | src/Language/CSPM/SpecGen/UML2CSP.hs | bsd-3-clause | makeEdgeType :: StateChart -> MapWriter Definition
makeEdgeType sc = makeType "EdgeLabel" idPairs True
where
idPairs :: [(SC.Id,String)]
idPairs = map (\e -> (eId e,prettyEdgeName e)) (S.elems $ edges sc)
prettyEdgeName :: Edge -> String
prettyEdgeName (Edge {source,target}) =
(prettyNodeName sc sourceNode) ++ "___" ++ (prettyNodeName sc targetNode)
where
sourceNode = toNode (nIds sc) source
targetNode = toNode (nIds sc) target
-- Generates nice names for nodes. Guaranteed to be unique if both
-- 1) no two nodes have the same names, as do their parents, all the way to the root
-- 2) no immediate child of the root shares the name of the root
-- When a node's name is unique across the whole chart, we use that name. When
-- it's not, we use a name based on its path. | 827 | makeEdgeType :: StateChart -> MapWriter Definition
makeEdgeType sc = makeType "EdgeLabel" idPairs True
where
idPairs :: [(SC.Id,String)]
idPairs = map (\e -> (eId e,prettyEdgeName e)) (S.elems $ edges sc)
prettyEdgeName :: Edge -> String
prettyEdgeName (Edge {source,target}) =
(prettyNodeName sc sourceNode) ++ "___" ++ (prettyNodeName sc targetNode)
where
sourceNode = toNode (nIds sc) source
targetNode = toNode (nIds sc) target
-- Generates nice names for nodes. Guaranteed to be unique if both
-- 1) no two nodes have the same names, as do their parents, all the way to the root
-- 2) no immediate child of the root shares the name of the root
-- When a node's name is unique across the whole chart, we use that name. When
-- it's not, we use a name based on its path. | 827 | makeEdgeType sc = makeType "EdgeLabel" idPairs True
where
idPairs :: [(SC.Id,String)]
idPairs = map (\e -> (eId e,prettyEdgeName e)) (S.elems $ edges sc)
prettyEdgeName :: Edge -> String
prettyEdgeName (Edge {source,target}) =
(prettyNodeName sc sourceNode) ++ "___" ++ (prettyNodeName sc targetNode)
where
sourceNode = toNode (nIds sc) source
targetNode = toNode (nIds sc) target
-- Generates nice names for nodes. Guaranteed to be unique if both
-- 1) no two nodes have the same names, as do their parents, all the way to the root
-- 2) no immediate child of the root shares the name of the root
-- When a node's name is unique across the whole chart, we use that name. When
-- it's not, we use a name based on its path. | 776 | false | true | 11 | 8 | 185 | 183 | 96 | 87 | null | null |
dogweather/nevada-revised-statutes-parser | src/ChapterFile.hs | bsd-3-clause | heading4P :: String
heading4P = "<p class=COHead4>" | 51 | heading4P :: String
heading4P = "<p class=COHead4>" | 51 | heading4P = "<p class=COHead4>" | 31 | false | true | 0 | 4 | 6 | 11 | 6 | 5 | null | null |
roelvandijk/aeson | Data/Aeson/Types/Instances.hs | bsd-3-clause | (>*<) :: B.Builder -> B.Builder -> B.Builder
a >*< b = a <> B.char7 ',' <> b | 76 | (>*<) :: B.Builder -> B.Builder -> B.Builder
a >*< b = a <> B.char7 ',' <> b | 76 | a >*< b = a <> B.char7 ',' <> b | 31 | false | true | 0 | 10 | 16 | 47 | 23 | 24 | null | null |
romanb/amazonka | amazonka-cloudwatch/gen/Network/AWS/CloudWatch/GetMetricStatistics.hs | mpl-2.0 | -- | A label describing the specified metric.
gmsrLabel :: Lens' GetMetricStatisticsResponse (Maybe Text)
gmsrLabel = lens _gmsrLabel (\s a -> s { _gmsrLabel = a }) | 164 | gmsrLabel :: Lens' GetMetricStatisticsResponse (Maybe Text)
gmsrLabel = lens _gmsrLabel (\s a -> s { _gmsrLabel = a }) | 118 | gmsrLabel = lens _gmsrLabel (\s a -> s { _gmsrLabel = a }) | 58 | true | true | 1 | 9 | 26 | 51 | 25 | 26 | null | null |
nytopop/silver | src/Network/Silver/Meta.hs | bsd-3-clause | isInfoDict _ = False | 20 | isInfoDict _ = False | 20 | isInfoDict _ = False | 20 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
rickyhan/rbtree | src/rbtree.hs | mit | balanceR' h l x r = Node B h l x r | 34 | balanceR' h l x r = Node B h l x r | 34 | balanceR' h l x r = Node B h l x r | 34 | false | false | 0 | 5 | 11 | 26 | 12 | 14 | null | null |
DanielG/ohs | src/OHScli/Cli.hs | gpl-3.0 | globalArgSpec :: [OptDescr (Options -> Options)]
globalArgSpec =
[ option "" ["server"] "Server to connect to" $
reqArg "SERVER" $ \s o -> o { optServer = s }
, option "" ["port"] "TCP port to connect to" $
reqArg "PORT" $ \s o -> o { optPort = s }
] | 295 | globalArgSpec :: [OptDescr (Options -> Options)]
globalArgSpec =
[ option "" ["server"] "Server to connect to" $
reqArg "SERVER" $ \s o -> o { optServer = s }
, option "" ["port"] "TCP port to connect to" $
reqArg "PORT" $ \s o -> o { optPort = s }
] | 295 | globalArgSpec =
[ option "" ["server"] "Server to connect to" $
reqArg "SERVER" $ \s o -> o { optServer = s }
, option "" ["port"] "TCP port to connect to" $
reqArg "PORT" $ \s o -> o { optPort = s }
] | 246 | false | true | 0 | 9 | 96 | 102 | 55 | 47 | null | null |
andygill/er-systemf | Language/SystemF/Pretty.hs | bsd-3-clause | pprintType (TyVar nm) = text nm | 36 | pprintType (TyVar nm) = text nm | 36 | pprintType (TyVar nm) = text nm | 36 | false | false | 0 | 6 | 10 | 19 | 8 | 11 | null | null |
gcfavorites/hiccup | TclLib/UtilCmds.hs | lgpl-2.1 | cmdIncr args = case args of
[vname] -> incr vname 1
[vname,val] -> T.asInt val >>= incr vname
_ -> vArgErr "incr varName ?increment?" | 174 | cmdIncr args = case args of
[vname] -> incr vname 1
[vname,val] -> T.asInt val >>= incr vname
_ -> vArgErr "incr varName ?increment?" | 174 | cmdIncr args = case args of
[vname] -> incr vname 1
[vname,val] -> T.asInt val >>= incr vname
_ -> vArgErr "incr varName ?increment?" | 174 | false | false | 0 | 10 | 64 | 60 | 29 | 31 | null | null |
Proclivis/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_H_SGML_SPECIAL :: Int
wxSTC_H_SGML_SPECIAL = 27 | 53 | wxSTC_H_SGML_SPECIAL :: Int
wxSTC_H_SGML_SPECIAL = 27 | 53 | wxSTC_H_SGML_SPECIAL = 27 | 25 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
phischu/fragnix | tests/packages/scotty/Control.Monad.Trans.Writer.Strict.hs | bsd-3-clause | -- | @'pass' m@ is an action that executes the action @m@, which returns
-- a value and a function, and returns the value, applying the function
-- to the output.
--
-- * @'runWriterT' ('pass' m) = 'liftM' (\\ ((a, f), w) -> (a, f w)) ('runWriterT' m)@
pass :: (Monad m) => WriterT w m (a, w -> w) -> WriterT w m a
pass m = WriterT $ do
((a, f), w) <- runWriterT m
return (a, f w)
| 389 | pass :: (Monad m) => WriterT w m (a, w -> w) -> WriterT w m a
pass m = WriterT $ do
((a, f), w) <- runWriterT m
return (a, f w)
| 136 | pass m = WriterT $ do
((a, f), w) <- runWriterT m
return (a, f w)
| 74 | true | true | 2 | 10 | 90 | 102 | 53 | 49 | null | null |
RossMeikleham/Project-Euler-Haskell | 25.hs | mit | :: [Integer]
fibs = 0 : 1 : zipWith (+) fibs (tail fibs) | 56 | :: [Integer]
fibs = 0 : 1 : zipWith (+) fibs (tail fibs) | 56 | :: [Integer]
fibs = 0 : 1 : zipWith (+) fibs (tail fibs) | 56 | false | false | 1 | 8 | 12 | 37 | 19 | 18 | null | null |
abakst/liquidhaskell | tests/todo/err0.hs | bsd-3-clause | x = choose 0 | 12 | x = choose 0 | 12 | x = choose 0 | 12 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
jonaprieto/athena | src/Athena/TSTP/Base.hs | mit | ------------------------------------------------------------------------------
--
-- univquantFreeVars ∷ Formula → Formula
-- univquantFreeVars cnf = Quant All freeVars cnf
-- where
-- freeVars ∷ [V]
-- freeVars = toList $ freeVarsF cnf
readRole ∷ String → Role
readRole "assumption" = Assumption | 321 | readRole ∷ String → Role
readRole "assumption" = Assumption | 67 | readRole "assumption" = Assumption | 42 | true | true | 0 | 5 | 62 | 29 | 17 | 12 | null | null |
co-dan/NPNTool | src/NPNTool/StateSpace.hs | bsd-3-clause | -- | Successors of a node
succSt :: SS a -> Obj -> [Obj]
succSt (g,_,_) (Left s) = map toState $ suc g s | 104 | succSt :: SS a -> Obj -> [Obj]
succSt (g,_,_) (Left s) = map toState $ suc g s | 78 | succSt (g,_,_) (Left s) = map toState $ suc g s | 47 | true | true | 0 | 10 | 24 | 63 | 31 | 32 | null | null |
hermish/courseography | app/Scripts.hs | gpl-3.0 | drawScripts :: H.Html
drawScripts =
mapM_ toScript
["/static/js/draw/variables.js",
"/static/js/draw/path.js",
"/static/js/draw/draw.js",
"/static/js/draw/setup.js",
"/static/js/vendor/jscolor.min.js"] | 249 | drawScripts :: H.Html
drawScripts =
mapM_ toScript
["/static/js/draw/variables.js",
"/static/js/draw/path.js",
"/static/js/draw/draw.js",
"/static/js/draw/setup.js",
"/static/js/vendor/jscolor.min.js"] | 249 | drawScripts =
mapM_ toScript
["/static/js/draw/variables.js",
"/static/js/draw/path.js",
"/static/js/draw/draw.js",
"/static/js/draw/setup.js",
"/static/js/vendor/jscolor.min.js"] | 227 | false | true | 0 | 6 | 59 | 33 | 19 | 14 | null | null |
michiexile/hplex | pershom/src/Math/Misc/NatInfinity.hs | bsd-3-clause | toInt :: NInfinity -> Int
toInt Infinity = error "Attempting to convert Infinity to an Int." | 92 | toInt :: NInfinity -> Int
toInt Infinity = error "Attempting to convert Infinity to an Int." | 92 | toInt Infinity = error "Attempting to convert Infinity to an Int." | 66 | false | true | 0 | 5 | 15 | 21 | 10 | 11 | null | null |
7ocb/fuse_adb_fs | lib/Parsers.hs | gpl-3.0 | parseDDReadFileNl :: String -> Parser String
parseDDReadFileNl newlineType = anyByte `manyTill` end
where records = number >> string "+" >> number >> string " records"
nl = try $ string newlineType
number = many1 digit
anyByte = choice [ nl >> return '\n'
, anyChar ]
end = try $ do
records >> string " in" >> nl
records >> string " out" >> nl
totally <- number
string " bytes transferred in "
anyChar `manyTill` ((nl >> eof) <|> eof) | 595 | parseDDReadFileNl :: String -> Parser String
parseDDReadFileNl newlineType = anyByte `manyTill` end
where records = number >> string "+" >> number >> string " records"
nl = try $ string newlineType
number = many1 digit
anyByte = choice [ nl >> return '\n'
, anyChar ]
end = try $ do
records >> string " in" >> nl
records >> string " out" >> nl
totally <- number
string " bytes transferred in "
anyChar `manyTill` ((nl >> eof) <|> eof) | 595 | parseDDReadFileNl newlineType = anyByte `manyTill` end
where records = number >> string "+" >> number >> string " records"
nl = try $ string newlineType
number = many1 digit
anyByte = choice [ nl >> return '\n'
, anyChar ]
end = try $ do
records >> string " in" >> nl
records >> string " out" >> nl
totally <- number
string " bytes transferred in "
anyChar `manyTill` ((nl >> eof) <|> eof) | 550 | false | true | 4 | 13 | 241 | 170 | 82 | 88 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.