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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
yliu120/K3 | src/Language/K3/Analysis/SEffects/Inference.hs | apache-2.0 | simplifyApplyM :: Maybe (ExtInferF a, a) -> Bool -> Maybe (K3 Expression) -> [Maybe (K3 Effect)] -> K3 Effect -> K3 Effect -> FInfM (K3 Effect, K3 Effect)
simplifyApplyM extInfOpt defer eOpt ef lrf argrf = do
env <- get
(nef, nrf, nenv) <- liftEitherM $ simplifyApply env extInfOpt defer eOpt ef lrf argrf
void $ put nenv
return (nef, nrf)
{- FInfM helpers -} | 369 | simplifyApplyM :: Maybe (ExtInferF a, a) -> Bool -> Maybe (K3 Expression) -> [Maybe (K3 Effect)] -> K3 Effect -> K3 Effect -> FInfM (K3 Effect, K3 Effect)
simplifyApplyM extInfOpt defer eOpt ef lrf argrf = do
env <- get
(nef, nrf, nenv) <- liftEitherM $ simplifyApply env extInfOpt defer eOpt ef lrf argrf
void $ put nenv
return (nef, nrf)
{- FInfM helpers -} | 369 | simplifyApplyM extInfOpt defer eOpt ef lrf argrf = do
env <- get
(nef, nrf, nenv) <- liftEitherM $ simplifyApply env extInfOpt defer eOpt ef lrf argrf
void $ put nenv
return (nef, nrf)
{- FInfM helpers -} | 214 | false | true | 0 | 13 | 74 | 167 | 81 | 86 | null | null |
fthomasmorel/Sudoku-solver | Sudoku.hs | mit | stringToStrings :: [String] -> [[String]]
stringToStrings l = aux l [] where
aux [] acc = acc
aux li acc = aux (drop 9 li) (acc ++ [take 9 li]) | 147 | stringToStrings :: [String] -> [[String]]
stringToStrings l = aux l [] where
aux [] acc = acc
aux li acc = aux (drop 9 li) (acc ++ [take 9 li]) | 147 | stringToStrings l = aux l [] where
aux [] acc = acc
aux li acc = aux (drop 9 li) (acc ++ [take 9 li]) | 105 | false | true | 0 | 11 | 33 | 86 | 44 | 42 | null | null |
afwlehmann/rhm-io-iter | src/LazyIO.hs | bsd-3-clause | -- Resources closed "unexpectedly" as soon as the IO action returns
problem1 :: IO ()
problem1 = do
[fileName] <- getArgs
str <- withFile fileName ReadMode hGetContents
putStrLn str
-- Solving problem1 by evaluating the contents of the file inside withFile's IO
-- action | 278 | problem1 :: IO ()
problem1 = do
[fileName] <- getArgs
str <- withFile fileName ReadMode hGetContents
putStrLn str
-- Solving problem1 by evaluating the contents of the file inside withFile's IO
-- action | 210 | problem1 = do
[fileName] <- getArgs
str <- withFile fileName ReadMode hGetContents
putStrLn str
-- Solving problem1 by evaluating the contents of the file inside withFile's IO
-- action | 192 | true | true | 0 | 8 | 50 | 49 | 24 | 25 | null | null |
alexisVallet/ag44-graph-algorithms | GraphIO.hs | bsd-3-clause | showGraph :: Graph -> IO ()
showGraph graph = withGraphviz $ do
let dotGraph = graphToDot' graph
runGraphvizCanvas' dotGraph Xlib
-- | Prints the adjacency matrix of the graph. | 181 | showGraph :: Graph -> IO ()
showGraph graph = withGraphviz $ do
let dotGraph = graphToDot' graph
runGraphvizCanvas' dotGraph Xlib
-- | Prints the adjacency matrix of the graph. | 181 | showGraph graph = withGraphviz $ do
let dotGraph = graphToDot' graph
runGraphvizCanvas' dotGraph Xlib
-- | Prints the adjacency matrix of the graph. | 153 | false | true | 0 | 11 | 33 | 48 | 22 | 26 | null | null |
DavidAlphaFox/ghc | libraries/containers/Data/Map/Base.hs | bsd-3-clause | -- | The union of a list of maps, with a combining operation:
-- (@'unionsWith' f == 'Prelude.foldl' ('unionWith' f) 'empty'@).
--
-- > unionsWith (++) [(fromList [(5, "a"), (3, "b")]), (fromList [(5, "A"), (7, "C")]), (fromList [(5, "A3"), (3, "B3")])]
-- > == fromList [(3, "bB3"), (5, "aAA3"), (7, "C")]
unionsWith :: Ord k => (a->a->a) -> [Map k a] -> Map k a
unionsWith f ts
= foldlStrict (unionWith f) empty ts | 425 | unionsWith :: Ord k => (a->a->a) -> [Map k a] -> Map k a
unionsWith f ts
= foldlStrict (unionWith f) empty ts | 111 | unionsWith f ts
= foldlStrict (unionWith f) empty ts | 54 | true | true | 0 | 10 | 82 | 80 | 39 | 41 | null | null |
savannidgerinel/mead | test/ApiSpec.hs | bsd-3-clause | exchangeGrantToken :: BS.ByteString -> WaiTest.SRequest
exchangeGrantToken token =
WaiTest.SRequest
(Wai.defaultRequest { Wai.requestMethod = methodPut
, Wai.pathInfo = ["grant-exchange"]
, Wai.requestHeaders = [("Content-Type", "application/x-www-form-urlencoded")]
})
(BSL.fromStrict $ renderSimpleQuery False ([("grant", token)])) | 415 | exchangeGrantToken :: BS.ByteString -> WaiTest.SRequest
exchangeGrantToken token =
WaiTest.SRequest
(Wai.defaultRequest { Wai.requestMethod = methodPut
, Wai.pathInfo = ["grant-exchange"]
, Wai.requestHeaders = [("Content-Type", "application/x-www-form-urlencoded")]
})
(BSL.fromStrict $ renderSimpleQuery False ([("grant", token)])) | 415 | exchangeGrantToken token =
WaiTest.SRequest
(Wai.defaultRequest { Wai.requestMethod = methodPut
, Wai.pathInfo = ["grant-exchange"]
, Wai.requestHeaders = [("Content-Type", "application/x-www-form-urlencoded")]
})
(BSL.fromStrict $ renderSimpleQuery False ([("grant", token)])) | 359 | false | true | 0 | 10 | 111 | 99 | 56 | 43 | null | null |
mk12/euler | haskell/Common.hs | mit | properDivisors :: Int -> [Int]
properDivisors 1 = [] | 52 | properDivisors :: Int -> [Int]
properDivisors 1 = [] | 52 | properDivisors 1 = [] | 21 | false | true | 0 | 6 | 8 | 23 | 12 | 11 | null | null |
meiersi-11ce/stack | src/System/Process/Read.hs | bsd-3-clause | doesExecutableExist :: MonadIO m => EnvOverride -> String -> m Bool
doesExecutableExist menv name = liftM isJust $ findExecutable menv name | 139 | doesExecutableExist :: MonadIO m => EnvOverride -> String -> m Bool
doesExecutableExist menv name = liftM isJust $ findExecutable menv name | 139 | doesExecutableExist menv name = liftM isJust $ findExecutable menv name | 71 | false | true | 0 | 9 | 20 | 50 | 22 | 28 | null | null |
sighingnow/hindent | src/HIndent/Pretty.hs | bsd-3-clause | groupAdjacentBy adj items = xs : groupAdjacentBy adj rest
where
(xs, rest) = spanAdjacentBy adj items | 107 | groupAdjacentBy adj items = xs : groupAdjacentBy adj rest
where
(xs, rest) = spanAdjacentBy adj items | 107 | groupAdjacentBy adj items = xs : groupAdjacentBy adj rest
where
(xs, rest) = spanAdjacentBy adj items | 107 | false | false | 1 | 6 | 21 | 44 | 19 | 25 | null | null |
plow-technologies/valentine | test/Valentine/ParserSpec.hs | mit | runTests :: [Test] -> IO ()
runTests [] = return () | 52 | runTests :: [Test] -> IO ()
runTests [] = return () | 51 | runTests [] = return () | 23 | false | true | 0 | 7 | 11 | 33 | 16 | 17 | null | null |
nushio3/ghc | compiler/hsSyn/HsPat.hs | bsd-3-clause | hsPatNeedsParens (SplicePat {}) = False | 44 | hsPatNeedsParens (SplicePat {}) = False | 44 | hsPatNeedsParens (SplicePat {}) = False | 44 | false | false | 0 | 7 | 9 | 16 | 8 | 8 | null | null |
mettekou/ghc | compiler/types/Type.hs | bsd-3-clause | isFamFreeTy (CastTy ty _) = isFamFreeTy ty | 46 | isFamFreeTy (CastTy ty _) = isFamFreeTy ty | 46 | isFamFreeTy (CastTy ty _) = isFamFreeTy ty | 46 | false | false | 0 | 7 | 10 | 20 | 9 | 11 | null | null |
jbearer/hspl | src/Control/Hspl/Internal/UI.hs | mit | formatGoal (IsVariable t) = "isVariable " ++ parensTerm t | 57 | formatGoal (IsVariable t) = "isVariable " ++ parensTerm t | 57 | formatGoal (IsVariable t) = "isVariable " ++ parensTerm t | 57 | false | false | 0 | 6 | 8 | 23 | 10 | 13 | null | null |
flowbox-public/fgl | Data/Graph/Inductive/Internal/FiniteMap.hs | bsd-3-clause | -- | applies lookup to an interval
rangeFM :: Ord a => FiniteMap a b -> a -> a -> [b]
rangeFM m i j = rangeFMa m i j [] | 119 | rangeFM :: Ord a => FiniteMap a b -> a -> a -> [b]
rangeFM m i j = rangeFMa m i j [] | 84 | rangeFM m i j = rangeFMa m i j [] | 33 | true | true | 0 | 9 | 30 | 57 | 28 | 29 | null | null |
haskell-streaming/streaming | benchmarks/old/Stream/Internal.hs | bsd-3-clause | chunksOf :: (Monad m, Functor f) => Int -> Stream f m r -> Stream (Stream f m) m r
chunksOf n0 = loop where
loop stream = case stream of
Return r -> Return r
Delay m -> Delay (liftM loop m)
Step fs -> Step $ Step $ fmap (fmap loop . splitAt n0) fs
| 282 | chunksOf :: (Monad m, Functor f) => Int -> Stream f m r -> Stream (Stream f m) m r
chunksOf n0 = loop where
loop stream = case stream of
Return r -> Return r
Delay m -> Delay (liftM loop m)
Step fs -> Step $ Step $ fmap (fmap loop . splitAt n0) fs
| 282 | chunksOf n0 = loop where
loop stream = case stream of
Return r -> Return r
Delay m -> Delay (liftM loop m)
Step fs -> Step $ Step $ fmap (fmap loop . splitAt n0) fs
| 199 | false | true | 0 | 14 | 91 | 140 | 66 | 74 | null | null |
urbanslug/ghc | compiler/nativeGen/X86/Ppr.hs | bsd-3-clause | pprInstr g@(GNEG _ src dst)
= pprG g (hcat [gtab, gpush src 0, text " ; fchs ; ", gpop dst 1]) | 97 | pprInstr g@(GNEG _ src dst)
= pprG g (hcat [gtab, gpush src 0, text " ; fchs ; ", gpop dst 1]) | 97 | pprInstr g@(GNEG _ src dst)
= pprG g (hcat [gtab, gpush src 0, text " ; fchs ; ", gpop dst 1]) | 97 | false | false | 1 | 9 | 24 | 65 | 29 | 36 | null | null |
andrebask/newsprint | src/UserInterface/NewsPrint/Handler/Delete.hs | apache-2.0 | postDeleteR :: Handler ()
postDeleteR = do itemType <- runInputPost $ ireq hiddenField "type"
url <- runInputPost $ ireq hiddenField "delete"
u <- lookupSession "user"
case u of
Nothing -> do { setUltDestCurrent; redirect HomeR }
Just user
-> do token <- lookupSession "token"
let tk = case token of
Nothing -> ("" :: Text)
Just t -> t
sc <- lift $ withConnection (openConnection "127.0.0.1" 3000)
(submitItem itemType url tk)
case sc of
Just 200 -> redirect SessionR
Nothing -> redirect HomeR
_ -> redirect HomeR | 944 | postDeleteR :: Handler ()
postDeleteR = do itemType <- runInputPost $ ireq hiddenField "type"
url <- runInputPost $ ireq hiddenField "delete"
u <- lookupSession "user"
case u of
Nothing -> do { setUltDestCurrent; redirect HomeR }
Just user
-> do token <- lookupSession "token"
let tk = case token of
Nothing -> ("" :: Text)
Just t -> t
sc <- lift $ withConnection (openConnection "127.0.0.1" 3000)
(submitItem itemType url tk)
case sc of
Just 200 -> redirect SessionR
Nothing -> redirect HomeR
_ -> redirect HomeR | 944 | postDeleteR = do itemType <- runInputPost $ ireq hiddenField "type"
url <- runInputPost $ ireq hiddenField "delete"
u <- lookupSession "user"
case u of
Nothing -> do { setUltDestCurrent; redirect HomeR }
Just user
-> do token <- lookupSession "token"
let tk = case token of
Nothing -> ("" :: Text)
Just t -> t
sc <- lift $ withConnection (openConnection "127.0.0.1" 3000)
(submitItem itemType url tk)
case sc of
Just 200 -> redirect SessionR
Nothing -> redirect HomeR
_ -> redirect HomeR | 918 | false | true | 0 | 18 | 517 | 207 | 95 | 112 | null | null |
thlorenz/WebToInk | webtoink-converter/WebToInk/Converter/TocGeneration.hs | bsd-2-clause | -----------------------
-- ---- Tests ---- --
-----------------------
debug = do
let pages = ["toc.html", "this-is-the-title.html"]
putStrLn $ generateToc pages "title" "en-us" "Some Author" | 201 | debug = do
let pages = ["toc.html", "this-is-the-title.html"]
putStrLn $ generateToc pages "title" "en-us" "Some Author" | 128 | debug = do
let pages = ["toc.html", "this-is-the-title.html"]
putStrLn $ generateToc pages "title" "en-us" "Some Author" | 128 | true | false | 1 | 11 | 33 | 44 | 21 | 23 | null | null |
gsnewmark/cis194 | src/Cis194/Week1/Lecture.hs | apache-2.0 | -- Do nothing to the empty list
sumEveryTwo (x:[]) = [x] | 60 | sumEveryTwo (x:[]) = [x] | 28 | sumEveryTwo (x:[]) = [x] | 28 | true | false | 0 | 8 | 14 | 22 | 12 | 10 | null | null |
fmthoma/ghc | libraries/template-haskell/Language/Haskell/TH/Syntax.hs | bsd-3-clause | {- | @reifyInstances nm tys@ returns a list of visible instances of @nm tys@. That is,
if @nm@ is the name of a type class, then all instances of this class at the types @tys@
are returned. Alternatively, if @nm@ is the name of a data family or type family,
all instances of this family at the types @tys@ are returned.
-}
reifyInstances :: Name -> [Type] -> Q [InstanceDec]
reifyInstances cls tys = Q (qReifyInstances cls tys) | 427 | reifyInstances :: Name -> [Type] -> Q [InstanceDec]
reifyInstances cls tys = Q (qReifyInstances cls tys) | 104 | reifyInstances cls tys = Q (qReifyInstances cls tys) | 52 | true | true | 0 | 8 | 77 | 45 | 23 | 22 | null | null |
sdiehl/ghc | compiler/types/Coercion.hs | bsd-3-clause | downgradeRole_maybe Representational Nominal co = Just (mkSubCo co) | 76 | downgradeRole_maybe Representational Nominal co = Just (mkSubCo co) | 76 | downgradeRole_maybe Representational Nominal co = Just (mkSubCo co) | 76 | false | false | 0 | 7 | 16 | 22 | 10 | 12 | null | null |
HIPERFIT/language-c-quote | Language/C/Quote/Base.hs | bsd-3-clause | qqBlockItemListP [C.AntiBlockItems v _] = Just $ antiVarP v | 59 | qqBlockItemListP [C.AntiBlockItems v _] = Just $ antiVarP v | 59 | qqBlockItemListP [C.AntiBlockItems v _] = Just $ antiVarP v | 59 | false | false | 0 | 8 | 8 | 26 | 12 | 14 | null | null |
jeremy-w/Idris-dev | src/Idris/Core/ProofState.hs | bsd-3-clause | claimFn _ _ _ ctxt env _ = fail "Can't make function type here" | 63 | claimFn _ _ _ ctxt env _ = fail "Can't make function type here" | 63 | claimFn _ _ _ ctxt env _ = fail "Can't make function type here" | 63 | false | false | 1 | 5 | 13 | 23 | 9 | 14 | null | null |
zhensydow/ljcsandbox | lang/haskell/sudoku/main.hs | gpl-3.0 | getLikely :: Sudoku -> [(Int, Int)] -> SudokuCell
getLikely sudoku = uniques . concat . fmap (sudoku!) | 102 | getLikely :: Sudoku -> [(Int, Int)] -> SudokuCell
getLikely sudoku = uniques . concat . fmap (sudoku!) | 102 | getLikely sudoku = uniques . concat . fmap (sudoku!) | 52 | false | true | 0 | 8 | 16 | 46 | 25 | 21 | null | null |
artuuge/IHaskell | ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Interactive.hs | mit | -- | Transform a function (HList ts -> r) to one which: 1) Uses widgets to accept the arguments 2)
-- Accepts initial values for the arguments 3) Creates a compound FlexBox widget with an embedded
-- OutputWidget for display
liftToWidgets :: IHaskellDisplay r
=> (HList ts -> r) -> Rec WidgetConf ts -> Rec Argument ts -> IO FlexBox
liftToWidgets func rc initvals = do
let constructors = rmap extractConstructor rc
getters = rmap extractGetter rc
eventSetters = rmap extractEventSetter rc
initializers = rmap extractInitializer rc
bx <- mkFlexBox
out <- mkOutputWidget
-- Create a list of widgets
widgets <- rtraverse createWidget constructors
let handler = do
vals <- applyGetters getters widgets
replaceOutput out $ func vals
-- Apply handler to all widgets
applyEventSetters eventSetters widgets handler
-- Set initial values for all widgets
setInitialValues initializers widgets initvals
-- applyValueSetters valueSetters widgets $ getList defvals
setField out Width 500
setField bx Orientation VerticalOrientation
-- Set children for the FlexBox
let children = mkChildren widgets
setField bx Children $ children ++ [ChildWidget out]
return bx | 1,236 | liftToWidgets :: IHaskellDisplay r
=> (HList ts -> r) -> Rec WidgetConf ts -> Rec Argument ts -> IO FlexBox
liftToWidgets func rc initvals = do
let constructors = rmap extractConstructor rc
getters = rmap extractGetter rc
eventSetters = rmap extractEventSetter rc
initializers = rmap extractInitializer rc
bx <- mkFlexBox
out <- mkOutputWidget
-- Create a list of widgets
widgets <- rtraverse createWidget constructors
let handler = do
vals <- applyGetters getters widgets
replaceOutput out $ func vals
-- Apply handler to all widgets
applyEventSetters eventSetters widgets handler
-- Set initial values for all widgets
setInitialValues initializers widgets initvals
-- applyValueSetters valueSetters widgets $ getList defvals
setField out Width 500
setField bx Orientation VerticalOrientation
-- Set children for the FlexBox
let children = mkChildren widgets
setField bx Children $ children ++ [ChildWidget out]
return bx | 1,011 | liftToWidgets func rc initvals = do
let constructors = rmap extractConstructor rc
getters = rmap extractGetter rc
eventSetters = rmap extractEventSetter rc
initializers = rmap extractInitializer rc
bx <- mkFlexBox
out <- mkOutputWidget
-- Create a list of widgets
widgets <- rtraverse createWidget constructors
let handler = do
vals <- applyGetters getters widgets
replaceOutput out $ func vals
-- Apply handler to all widgets
applyEventSetters eventSetters widgets handler
-- Set initial values for all widgets
setInitialValues initializers widgets initvals
-- applyValueSetters valueSetters widgets $ getList defvals
setField out Width 500
setField bx Orientation VerticalOrientation
-- Set children for the FlexBox
let children = mkChildren widgets
setField bx Children $ children ++ [ChildWidget out]
return bx | 889 | true | true | 0 | 13 | 263 | 252 | 115 | 137 | null | null |
greydot/iproute | Data/IP/Addr.hs | bsd-3-clause | ip6ToInteger :: IPv6 -> Integer
ip6ToInteger (IP6 (a,b,c,d)) = let a' = word32ToInteger a `shift` 96
b' = word32ToInteger b `shift` 64
c' = word32ToInteger c `shift` 32
d' = word32ToInteger d
in a' .|. b' .|. c' .|. d'
where
word32ToInteger :: Word32 -> Integer
word32ToInteger = toEnum . fromEnum | 453 | ip6ToInteger :: IPv6 -> Integer
ip6ToInteger (IP6 (a,b,c,d)) = let a' = word32ToInteger a `shift` 96
b' = word32ToInteger b `shift` 64
c' = word32ToInteger c `shift` 32
d' = word32ToInteger d
in a' .|. b' .|. c' .|. d'
where
word32ToInteger :: Word32 -> Integer
word32ToInteger = toEnum . fromEnum | 453 | ip6ToInteger (IP6 (a,b,c,d)) = let a' = word32ToInteger a `shift` 96
b' = word32ToInteger b `shift` 64
c' = word32ToInteger c `shift` 32
d' = word32ToInteger d
in a' .|. b' .|. c' .|. d'
where
word32ToInteger :: Word32 -> Integer
word32ToInteger = toEnum . fromEnum | 421 | false | true | 0 | 10 | 206 | 124 | 67 | 57 | null | null |
rueshyna/gogol | gogol-admin-directory/gen/Network/Google/Resource/Directory/OrgUnits/Update.hs | mpl-2.0 | -- | Immutable id of the Google Apps account
ouuCustomerId :: Lens' OrgUnitsUpdate Text
ouuCustomerId
= lens _ouuCustomerId
(\ s a -> s{_ouuCustomerId = a}) | 164 | ouuCustomerId :: Lens' OrgUnitsUpdate Text
ouuCustomerId
= lens _ouuCustomerId
(\ s a -> s{_ouuCustomerId = a}) | 119 | ouuCustomerId
= lens _ouuCustomerId
(\ s a -> s{_ouuCustomerId = a}) | 76 | true | true | 1 | 9 | 32 | 45 | 22 | 23 | null | null |
diminishedprime/.org | programmey_stuff/write_yourself_a_scheme/ch_06/wyas/app/LispVal.hs | mit | showVal (Bool False) = "#f" | 27 | showVal (Bool False) = "#f" | 27 | showVal (Bool False) = "#f" | 27 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
jsavatgy/xroads-game | code/blue-angles-text.hs | gpl-2.0 | orange = RGB 0.98 0.63 0.15 | 28 | orange = RGB 0.98 0.63 0.15 | 28 | orange = RGB 0.98 0.63 0.15 | 28 | false | false | 1 | 5 | 6 | 16 | 6 | 10 | null | null |
ianclement/dzen-utils | Example2.hs | gpl-3.0 | timeBar' :: Printer ZonedTime
timeBar' = comap zonedSecs timeBar | 64 | timeBar' :: Printer ZonedTime
timeBar' = comap zonedSecs timeBar | 64 | timeBar' = comap zonedSecs timeBar | 34 | false | true | 0 | 5 | 8 | 19 | 9 | 10 | null | null |
sheyll/b9-vm-image-builder | src/lib/B9/Environment.hs | mit | -- | Get the current 'Environment'
--
-- @since 0.5.62
askEnvironment :: Member EnvironmentReader e => Eff e Environment
askEnvironment = ask | 141 | askEnvironment :: Member EnvironmentReader e => Eff e Environment
askEnvironment = ask | 86 | askEnvironment = ask | 20 | true | true | 0 | 7 | 21 | 34 | 16 | 18 | null | null |
fcostantini/QuickFuzz | src/CommandExec.hs | gpl-3.0 | exec :: Cmd -> IO ExitCode
exec (prog, args) = rawSystem prog args | 66 | exec :: Cmd -> IO ExitCode
exec (prog, args) = rawSystem prog args | 66 | exec (prog, args) = rawSystem prog args | 39 | false | true | 0 | 8 | 12 | 36 | 17 | 19 | null | null |
MichaelMackus/hsrl | RL/UI/Sprite.hs | mit | toMessage e (EventMessage (MenuChange Inventory)) = Just $ "Pick an item to use or equip. Press space to cancel." | 113 | toMessage e (EventMessage (MenuChange Inventory)) = Just $ "Pick an item to use or equip. Press space to cancel." | 113 | toMessage e (EventMessage (MenuChange Inventory)) = Just $ "Pick an item to use or equip. Press space to cancel." | 113 | false | false | 0 | 9 | 18 | 27 | 13 | 14 | null | null |
diku-dk/futhark | src/Futhark/Compiler.hs | isc | -- | Not verbose, and terminates process on error.
readUntypedProgramOrDie :: MonadIO m => FilePath -> m [(String, E.UncheckedProg)]
readUntypedProgramOrDie file = orDie $ readUntypedProgram file | 195 | readUntypedProgramOrDie :: MonadIO m => FilePath -> m [(String, E.UncheckedProg)]
readUntypedProgramOrDie file = orDie $ readUntypedProgram file | 144 | readUntypedProgramOrDie file = orDie $ readUntypedProgram file | 62 | true | true | 0 | 10 | 25 | 47 | 24 | 23 | null | null |
ewestern/geos | src/Data/Geometry/Geos/Raw/Serialize.hs | mit | writeWkt :: Geometry a => WktWriter -> a -> Geos BC.ByteString
writeWkt (WktWriter w) g = withGeos $ \h -> do
wkt <- withForeignPtr w
$ \wp -> withGeometry g $ \gp -> I.geos_WKTWriterWrite h wp gp
BC.packCString wkt | 223 | writeWkt :: Geometry a => WktWriter -> a -> Geos BC.ByteString
writeWkt (WktWriter w) g = withGeos $ \h -> do
wkt <- withForeignPtr w
$ \wp -> withGeometry g $ \gp -> I.geos_WKTWriterWrite h wp gp
BC.packCString wkt | 223 | writeWkt (WktWriter w) g = withGeos $ \h -> do
wkt <- withForeignPtr w
$ \wp -> withGeometry g $ \gp -> I.geos_WKTWriterWrite h wp gp
BC.packCString wkt | 160 | false | true | 0 | 15 | 46 | 99 | 47 | 52 | null | null |
rfranek/duckling | Duckling/Time/PL/Rules.hs | bsd-3-clause | ruleHhmmMilitaryAmpm :: Rule
ruleHhmmMilitaryAmpm = Rule
{ name = "hhmm (military) am|pm"
, pattern =
[ regex "((?:1[012]|0?\\d))([0-5]\\d)"
, regex "([ap])\\.?m?\\.?"
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (hh:mm:_)):
Token RegexMatch (GroupMatch (ap:_)):
_) -> do
h <- parseInt hh
m <- parseInt mm
tt . timeOfDayAMPM (hourMinute True h m) $
Text.toLower ap == "a"
_ -> Nothing
} | 488 | ruleHhmmMilitaryAmpm :: Rule
ruleHhmmMilitaryAmpm = Rule
{ name = "hhmm (military) am|pm"
, pattern =
[ regex "((?:1[012]|0?\\d))([0-5]\\d)"
, regex "([ap])\\.?m?\\.?"
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (hh:mm:_)):
Token RegexMatch (GroupMatch (ap:_)):
_) -> do
h <- parseInt hh
m <- parseInt mm
tt . timeOfDayAMPM (hourMinute True h m) $
Text.toLower ap == "a"
_ -> Nothing
} | 488 | ruleHhmmMilitaryAmpm = Rule
{ name = "hhmm (military) am|pm"
, pattern =
[ regex "((?:1[012]|0?\\d))([0-5]\\d)"
, regex "([ap])\\.?m?\\.?"
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (hh:mm:_)):
Token RegexMatch (GroupMatch (ap:_)):
_) -> do
h <- parseInt hh
m <- parseInt mm
tt . timeOfDayAMPM (hourMinute True h m) $
Text.toLower ap == "a"
_ -> Nothing
} | 459 | false | true | 0 | 19 | 144 | 172 | 86 | 86 | null | null |
hydrogen-tools/hydrogen-parsing | src/Hydrogen/Parsing.hs | mit | mkError :: ParseError -> Either SomethingBad b
mkError e = Left $ map ((errorPos e,) . messageToString) (errorMessages e)
where
messageToString = \case
SysUnExpect msg -> "Unexpected " ++ msg
UnExpect msg -> "Unexpected " ++ msg
Expect msg -> "Expected " ++ msg
Message msg -> msg | 318 | mkError :: ParseError -> Either SomethingBad b
mkError e = Left $ map ((errorPos e,) . messageToString) (errorMessages e)
where
messageToString = \case
SysUnExpect msg -> "Unexpected " ++ msg
UnExpect msg -> "Unexpected " ++ msg
Expect msg -> "Expected " ++ msg
Message msg -> msg | 318 | mkError e = Left $ map ((errorPos e,) . messageToString) (errorMessages e)
where
messageToString = \case
SysUnExpect msg -> "Unexpected " ++ msg
UnExpect msg -> "Unexpected " ++ msg
Expect msg -> "Expected " ++ msg
Message msg -> msg | 271 | false | true | 3 | 9 | 85 | 119 | 54 | 65 | null | null |
olorin/amazonka | amazonka-iam/gen/Network/AWS/IAM/GetAccountAuthorizationDetails.hs | mpl-2.0 | -- | Creates a value of 'GetAccountAuthorizationDetails' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gaadMarker'
--
-- * 'gaadMaxItems'
--
-- * 'gaadFilter'
getAccountAuthorizationDetails
:: GetAccountAuthorizationDetails
getAccountAuthorizationDetails =
GetAccountAuthorizationDetails'
{ _gaadMarker = Nothing
, _gaadMaxItems = Nothing
, _gaadFilter = Nothing
} | 476 | getAccountAuthorizationDetails
:: GetAccountAuthorizationDetails
getAccountAuthorizationDetails =
GetAccountAuthorizationDetails'
{ _gaadMarker = Nothing
, _gaadMaxItems = Nothing
, _gaadFilter = Nothing
} | 229 | getAccountAuthorizationDetails =
GetAccountAuthorizationDetails'
{ _gaadMarker = Nothing
, _gaadMaxItems = Nothing
, _gaadFilter = Nothing
} | 160 | true | true | 1 | 7 | 84 | 47 | 29 | 18 | null | null |
jkr/pandoc-citeproc | src/Text/CSL/Proc/Collapse.hs | bsd-3-clause | groupCites :: [(Cite, Output)] -> [(Cite, Output)]
groupCites [] = [] | 73 | groupCites :: [(Cite, Output)] -> [(Cite, Output)]
groupCites [] = [] | 73 | groupCites [] = [] | 22 | false | true | 0 | 9 | 14 | 46 | 24 | 22 | null | null |
ryantm/ghc | compiler/nativeGen/RegAlloc/Liveness.hs | bsd-3-clause | natCmmTopToLive proc@(CmmProc info lbl live (ListGraph blocks@(first : _)))
= let first_id = blockId first
sccs = sccBlocks blocks (entryBlocks proc)
sccsLive = map (fmap (\(BasicBlock l instrs) ->
BasicBlock l (map (\i -> LiveInstr (Instr i) Nothing) instrs)))
$ sccs
in CmmProc (LiveInfo info (Just first_id) Nothing Map.empty) lbl live sccsLive | 460 | natCmmTopToLive proc@(CmmProc info lbl live (ListGraph blocks@(first : _)))
= let first_id = blockId first
sccs = sccBlocks blocks (entryBlocks proc)
sccsLive = map (fmap (\(BasicBlock l instrs) ->
BasicBlock l (map (\i -> LiveInstr (Instr i) Nothing) instrs)))
$ sccs
in CmmProc (LiveInfo info (Just first_id) Nothing Map.empty) lbl live sccsLive | 460 | natCmmTopToLive proc@(CmmProc info lbl live (ListGraph blocks@(first : _)))
= let first_id = blockId first
sccs = sccBlocks blocks (entryBlocks proc)
sccsLive = map (fmap (\(BasicBlock l instrs) ->
BasicBlock l (map (\i -> LiveInstr (Instr i) Nothing) instrs)))
$ sccs
in CmmProc (LiveInfo info (Just first_id) Nothing Map.empty) lbl live sccsLive | 460 | false | false | 3 | 22 | 164 | 172 | 83 | 89 | null | null |
pparkkin/eta | compiler/ETA/TypeCheck/TcRnTypes.hs | bsd-3-clause | pprSkolInfo (ClsSkol cls) = ptext (sLit "the class declaration for") <+> quotes (ppr cls) | 91 | pprSkolInfo (ClsSkol cls) = ptext (sLit "the class declaration for") <+> quotes (ppr cls) | 91 | pprSkolInfo (ClsSkol cls) = ptext (sLit "the class declaration for") <+> quotes (ppr cls) | 91 | false | false | 0 | 8 | 15 | 37 | 17 | 20 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT26.hs | gpl-3.0 | not False = True | 16 | not False = True | 16 | not False = True | 16 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
sdiehl/ghc | compiler/utils/UniqDSet.hs | bsd-3-clause | pprUniqDSet :: (a -> SDoc) -> UniqDSet a -> SDoc
pprUniqDSet f = braces . pprWithCommas f . uniqDSetToList | 106 | pprUniqDSet :: (a -> SDoc) -> UniqDSet a -> SDoc
pprUniqDSet f = braces . pprWithCommas f . uniqDSetToList | 106 | pprUniqDSet f = braces . pprWithCommas f . uniqDSetToList | 57 | false | true | 1 | 8 | 18 | 50 | 22 | 28 | null | null |
uduki/hsQt | Qtc/ClassTypes/Gui.hs | bsd-2-clause | qCast_QListWidgetItem :: Object a -> IO (QListWidgetItem ())
qCast_QListWidgetItem _qobj
= return (objectCast _qobj) | 118 | qCast_QListWidgetItem :: Object a -> IO (QListWidgetItem ())
qCast_QListWidgetItem _qobj
= return (objectCast _qobj) | 118 | qCast_QListWidgetItem _qobj
= return (objectCast _qobj) | 57 | false | true | 0 | 9 | 15 | 41 | 19 | 22 | null | null |
rubik/stack-hpc-coveralls | test/HLint.hs | isc | main :: IO ()
main = do
hints <- hlint arguments
if null hints then exitSuccess else exitFailure | 104 | main :: IO ()
main = do
hints <- hlint arguments
if null hints then exitSuccess else exitFailure | 104 | main = do
hints <- hlint arguments
if null hints then exitSuccess else exitFailure | 90 | false | true | 0 | 8 | 25 | 40 | 19 | 21 | null | null |
brendanhay/gogol | gogol-adsense-host/gen/Network/Google/Resource/AdSenseHost/CustomChannels/Delete.hs | mpl-2.0 | -- | Creates a value of 'CustomChannelsDelete' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ccdCustomChannelId'
--
-- * 'ccdAdClientId'
customChannelsDelete
:: Text -- ^ 'ccdCustomChannelId'
-> Text -- ^ 'ccdAdClientId'
-> CustomChannelsDelete
customChannelsDelete pCcdCustomChannelId_ pCcdAdClientId_ =
CustomChannelsDelete'
{ _ccdCustomChannelId = pCcdCustomChannelId_
, _ccdAdClientId = pCcdAdClientId_
} | 522 | customChannelsDelete
:: Text -- ^ 'ccdCustomChannelId'
-> Text -- ^ 'ccdAdClientId'
-> CustomChannelsDelete
customChannelsDelete pCcdCustomChannelId_ pCcdAdClientId_ =
CustomChannelsDelete'
{ _ccdCustomChannelId = pCcdCustomChannelId_
, _ccdAdClientId = pCcdAdClientId_
} | 297 | customChannelsDelete pCcdCustomChannelId_ pCcdAdClientId_ =
CustomChannelsDelete'
{ _ccdCustomChannelId = pCcdCustomChannelId_
, _ccdAdClientId = pCcdAdClientId_
} | 177 | true | true | 0 | 8 | 90 | 56 | 32 | 24 | null | null |
sgillespie/ghc | compiler/basicTypes/Unique.hs | bsd-3-clause | --------------------------------------------------
dataConRepNameUnique, dataConWorkerUnique :: Unique -> Unique
dataConWorkerUnique u = incrUnique u | 150 | dataConRepNameUnique, dataConWorkerUnique :: Unique -> Unique
dataConWorkerUnique u = incrUnique u | 99 | dataConWorkerUnique u = incrUnique u | 37 | true | true | 0 | 5 | 12 | 24 | 13 | 11 | null | null |
nevrenato/Hets_Fork | DFOL/ATC_DFOL.hs | gpl-2.0 | _tcBASIC_SPECTc :: TyCon
_tcBASIC_SPECTc = mkTyCon "DFOL.AS_DFOL.BASIC_SPEC" | 76 | _tcBASIC_SPECTc :: TyCon
_tcBASIC_SPECTc = mkTyCon "DFOL.AS_DFOL.BASIC_SPEC" | 76 | _tcBASIC_SPECTc = mkTyCon "DFOL.AS_DFOL.BASIC_SPEC" | 51 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
sdiehl/ghc | compiler/nativeGen/BlockLayout.hs | bsd-3-clause | chainCons :: BlockId -> BlockChain -> BlockChain
chainCons lbl (BlockChain blks)
= BlockChain (lbl `consOL` blks) | 115 | chainCons :: BlockId -> BlockChain -> BlockChain
chainCons lbl (BlockChain blks)
= BlockChain (lbl `consOL` blks) | 115 | chainCons lbl (BlockChain blks)
= BlockChain (lbl `consOL` blks) | 66 | false | true | 0 | 10 | 17 | 48 | 23 | 25 | null | null |
brendanhay/gogol | gogol-logging/gen/Network/Google/Resource/Logging/Folders/Locations/Buckets/Views/List.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
flbvlUploadType :: Lens' FoldersLocationsBucketsViewsList (Maybe Text)
flbvlUploadType
= lens _flbvlUploadType
(\ s a -> s{_flbvlUploadType = a}) | 224 | flbvlUploadType :: Lens' FoldersLocationsBucketsViewsList (Maybe Text)
flbvlUploadType
= lens _flbvlUploadType
(\ s a -> s{_flbvlUploadType = a}) | 153 | flbvlUploadType
= lens _flbvlUploadType
(\ s a -> s{_flbvlUploadType = a}) | 82 | true | true | 0 | 9 | 34 | 48 | 25 | 23 | null | null |
jakubriha/automata | src/Visualization.hs | bsd-3-clause | faToDot :: (Show sym, Show sta) => Fa sym sta -> String
faToDot (Fa initialStates finalStates transitions) =
"digraph something { node [shape=circle] {" ++
initialStatesToDot initialStates ++
finalStatesToDot finalStates ++
"}" ++
transitionsToDot transitions ++
"}"
where
initialStatesToDot =
concatMap (\state -> showInQuotesWithSuffix "_start" state
++ " [shape=point];"
++ showInQuotesWithSuffix "_start" state
++ "->"
++ showInQuotes state
++ ";")
finalStatesToDot =
concatMap (\state -> showInQuotes state ++ " [shape=doublecircle];")
transitionsToDot =
concatMap mapper
mapper (Transition symbol state finalState) =
showInQuotes state ++ " -> " ++ showInQuotes finalState ++ " [ label=" ++ show symbol ++ " ];" | 843 | faToDot :: (Show sym, Show sta) => Fa sym sta -> String
faToDot (Fa initialStates finalStates transitions) =
"digraph something { node [shape=circle] {" ++
initialStatesToDot initialStates ++
finalStatesToDot finalStates ++
"}" ++
transitionsToDot transitions ++
"}"
where
initialStatesToDot =
concatMap (\state -> showInQuotesWithSuffix "_start" state
++ " [shape=point];"
++ showInQuotesWithSuffix "_start" state
++ "->"
++ showInQuotes state
++ ";")
finalStatesToDot =
concatMap (\state -> showInQuotes state ++ " [shape=doublecircle];")
transitionsToDot =
concatMap mapper
mapper (Transition symbol state finalState) =
showInQuotes state ++ " -> " ++ showInQuotes finalState ++ " [ label=" ++ show symbol ++ " ];" | 843 | faToDot (Fa initialStates finalStates transitions) =
"digraph something { node [shape=circle] {" ++
initialStatesToDot initialStates ++
finalStatesToDot finalStates ++
"}" ++
transitionsToDot transitions ++
"}"
where
initialStatesToDot =
concatMap (\state -> showInQuotesWithSuffix "_start" state
++ " [shape=point];"
++ showInQuotesWithSuffix "_start" state
++ "->"
++ showInQuotes state
++ ";")
finalStatesToDot =
concatMap (\state -> showInQuotes state ++ " [shape=doublecircle];")
transitionsToDot =
concatMap mapper
mapper (Transition symbol state finalState) =
showInQuotes state ++ " -> " ++ showInQuotes finalState ++ " [ label=" ++ show symbol ++ " ];" | 787 | false | true | 7 | 12 | 224 | 224 | 101 | 123 | null | null |
supermitch/learn-haskell | real-world-haskell/ch03/Nullable.hs | mit | {-
> :type Just "something"
Just "something" :: Maybe [Char]
-- Maybe is a polymorphic, or generic, type.
We give the Maybe type constructor a parameter to create a specific type,
such as Maybe Int or Maybe [Bool].
We can nest the use of parameterised types inside each other...
-}
wrapped = Just (Just "wrapped") | 317 | wrapped = Just (Just "wrapped") | 31 | wrapped = Just (Just "wrapped") | 31 | true | false | 0 | 7 | 58 | 16 | 8 | 8 | null | null |
facebookincubator/duckling | Duckling/Rules/IT.hs | bsd-3-clause | langRules (Seal (CustomDimension dim)) = dimLangRules IT dim | 60 | langRules (Seal (CustomDimension dim)) = dimLangRules IT dim | 60 | langRules (Seal (CustomDimension dim)) = dimLangRules IT dim | 60 | false | false | 0 | 8 | 7 | 27 | 12 | 15 | null | null |
elieux/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | word16TyConKey = mkPreludeTyConUnique 61 | 65 | word16TyConKey = mkPreludeTyConUnique 61 | 65 | word16TyConKey = mkPreludeTyConUnique 61 | 65 | false | false | 0 | 5 | 28 | 9 | 4 | 5 | null | null |
sarahn/ganeti | src/Ganeti/Utils.hs | gpl-2.0 | defaultHead _ (x:_) = x | 25 | defaultHead _ (x:_) = x | 25 | defaultHead _ (x:_) = x | 25 | false | false | 1 | 6 | 6 | 21 | 9 | 12 | null | null |
ilseman2/yaml-light | Data/Yaml/YamlLight.hs | bsd-3-clause | (|!) :: Maybe YamlLight -> ByteString.ByteString -> Maybe YamlLight
my |! s = do -- maybe monad
y <- my
lookupYL (YStr s) y | 131 | (|!) :: Maybe YamlLight -> ByteString.ByteString -> Maybe YamlLight
my |! s = do -- maybe monad
y <- my
lookupYL (YStr s) y | 129 | my |! s = do -- maybe monad
y <- my
lookupYL (YStr s) y | 61 | false | true | 0 | 10 | 31 | 61 | 28 | 33 | null | null |
alexander-at-github/eta | compiler/ETA/BasicTypes/BasicTypes.hs | bsd-3-clause | isActive InitialPhase (ActiveBefore {}) = True | 46 | isActive InitialPhase (ActiveBefore {}) = True | 46 | isActive InitialPhase (ActiveBefore {}) = True | 46 | false | false | 0 | 6 | 5 | 20 | 9 | 11 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | int16TyConName = tcQual gHC_INT (fsLit "Int16") int16TyConKey | 65 | int16TyConName = tcQual gHC_INT (fsLit "Int16") int16TyConKey | 65 | int16TyConName = tcQual gHC_INT (fsLit "Int16") int16TyConKey | 65 | false | false | 1 | 7 | 10 | 23 | 9 | 14 | null | null |
Concomitant/LambdaHack | Game/LambdaHack/Client/AI/ConditionClient.hs | bsd-3-clause | -- | Require the actor is in a bad position to melee or can't melee at all.
condMeleeBadM :: MonadClient m => ActorId -> m Bool
condMeleeBadM aid = do
b <- getsState $ getActorBody aid
btarget <- getsClient $ getTarget aid
mtgtPos <- aidTgtToPos aid (blid b) btarget
condTgtEnemyPresent <- condTgtEnemyPresentM aid
condTgtEnemyRemembered <- condTgtEnemyRememberedM aid
fact <- getsState $ (EM.! bfid b) . sfactionD
activeItems <- activeItemsClient aid
let condNoUsableWeapon = all (not . isMelee) activeItems
friendlyFid fid = fid == bfid b || isAllied fact fid
friends <- getsState $ actorRegularAssocs friendlyFid (blid b)
let closeEnough b2 = let dist = chessDist (bpos b) (bpos b2)
in dist > 0 && (dist <= 2 || approaching b2)
-- 3 is the condThreatAtHand distance that AI keeps when alone.
approaching = case mtgtPos of
Just tgtPos | condTgtEnemyPresent || condTgtEnemyRemembered ->
\b1 -> chessDist (bpos b1) tgtPos <= 3
_ -> const False
closeFriends = filter (closeEnough . snd) friends
strongActor (aid2, b2) = do
activeItems2 <- activeItemsClient aid2
let condUsableWeapon2 = any isMelee activeItems2
actorMaxSk2 = sumSkills activeItems2
canMelee2 = EM.findWithDefault 0 Ability.AbMelee actorMaxSk2 > 0
hpGood = not $ hpTooLow b2 activeItems2
return $! hpGood && condUsableWeapon2 && canMelee2
strongCloseFriends <- filterM strongActor closeFriends
let noFriendlyHelp = length closeFriends < 3
&& null strongCloseFriends
&& length friends > 1 -- solo fighters aggresive
&& not (hpHuge b) -- uniques, etc., aggresive
let actorMaxSk = sumSkills activeItems
return $ condNoUsableWeapon
|| EM.findWithDefault 0 Ability.AbMelee actorMaxSk <= 0
|| noFriendlyHelp -- still not getting friends' help
-- no $!; keep it lazy
-- | Require that the actor stands in the dark, but is betrayed
-- by his own equipped light, | 2,083 | condMeleeBadM :: MonadClient m => ActorId -> m Bool
condMeleeBadM aid = do
b <- getsState $ getActorBody aid
btarget <- getsClient $ getTarget aid
mtgtPos <- aidTgtToPos aid (blid b) btarget
condTgtEnemyPresent <- condTgtEnemyPresentM aid
condTgtEnemyRemembered <- condTgtEnemyRememberedM aid
fact <- getsState $ (EM.! bfid b) . sfactionD
activeItems <- activeItemsClient aid
let condNoUsableWeapon = all (not . isMelee) activeItems
friendlyFid fid = fid == bfid b || isAllied fact fid
friends <- getsState $ actorRegularAssocs friendlyFid (blid b)
let closeEnough b2 = let dist = chessDist (bpos b) (bpos b2)
in dist > 0 && (dist <= 2 || approaching b2)
-- 3 is the condThreatAtHand distance that AI keeps when alone.
approaching = case mtgtPos of
Just tgtPos | condTgtEnemyPresent || condTgtEnemyRemembered ->
\b1 -> chessDist (bpos b1) tgtPos <= 3
_ -> const False
closeFriends = filter (closeEnough . snd) friends
strongActor (aid2, b2) = do
activeItems2 <- activeItemsClient aid2
let condUsableWeapon2 = any isMelee activeItems2
actorMaxSk2 = sumSkills activeItems2
canMelee2 = EM.findWithDefault 0 Ability.AbMelee actorMaxSk2 > 0
hpGood = not $ hpTooLow b2 activeItems2
return $! hpGood && condUsableWeapon2 && canMelee2
strongCloseFriends <- filterM strongActor closeFriends
let noFriendlyHelp = length closeFriends < 3
&& null strongCloseFriends
&& length friends > 1 -- solo fighters aggresive
&& not (hpHuge b) -- uniques, etc., aggresive
let actorMaxSk = sumSkills activeItems
return $ condNoUsableWeapon
|| EM.findWithDefault 0 Ability.AbMelee actorMaxSk <= 0
|| noFriendlyHelp -- still not getting friends' help
-- no $!; keep it lazy
-- | Require that the actor stands in the dark, but is betrayed
-- by his own equipped light, | 2,007 | condMeleeBadM aid = do
b <- getsState $ getActorBody aid
btarget <- getsClient $ getTarget aid
mtgtPos <- aidTgtToPos aid (blid b) btarget
condTgtEnemyPresent <- condTgtEnemyPresentM aid
condTgtEnemyRemembered <- condTgtEnemyRememberedM aid
fact <- getsState $ (EM.! bfid b) . sfactionD
activeItems <- activeItemsClient aid
let condNoUsableWeapon = all (not . isMelee) activeItems
friendlyFid fid = fid == bfid b || isAllied fact fid
friends <- getsState $ actorRegularAssocs friendlyFid (blid b)
let closeEnough b2 = let dist = chessDist (bpos b) (bpos b2)
in dist > 0 && (dist <= 2 || approaching b2)
-- 3 is the condThreatAtHand distance that AI keeps when alone.
approaching = case mtgtPos of
Just tgtPos | condTgtEnemyPresent || condTgtEnemyRemembered ->
\b1 -> chessDist (bpos b1) tgtPos <= 3
_ -> const False
closeFriends = filter (closeEnough . snd) friends
strongActor (aid2, b2) = do
activeItems2 <- activeItemsClient aid2
let condUsableWeapon2 = any isMelee activeItems2
actorMaxSk2 = sumSkills activeItems2
canMelee2 = EM.findWithDefault 0 Ability.AbMelee actorMaxSk2 > 0
hpGood = not $ hpTooLow b2 activeItems2
return $! hpGood && condUsableWeapon2 && canMelee2
strongCloseFriends <- filterM strongActor closeFriends
let noFriendlyHelp = length closeFriends < 3
&& null strongCloseFriends
&& length friends > 1 -- solo fighters aggresive
&& not (hpHuge b) -- uniques, etc., aggresive
let actorMaxSk = sumSkills activeItems
return $ condNoUsableWeapon
|| EM.findWithDefault 0 Ability.AbMelee actorMaxSk <= 0
|| noFriendlyHelp -- still not getting friends' help
-- no $!; keep it lazy
-- | Require that the actor stands in the dark, but is betrayed
-- by his own equipped light, | 1,955 | true | true | 5 | 15 | 548 | 529 | 253 | 276 | null | null |
Daniel-Diaz/yesod | yesod-test/Yesod/Test.hs | mit | -- | Performs a CSS query and print the matches to stderr.
printMatches :: Query -> YesodExample site ()
printMatches query = do
matches <- htmlQuery query
liftIO $ hPutStrLn stderr $ show matches
-- | Add a parameter with the given name and value to the request body. | 273 | printMatches :: Query -> YesodExample site ()
printMatches query = do
matches <- htmlQuery query
liftIO $ hPutStrLn stderr $ show matches
-- | Add a parameter with the given name and value to the request body. | 214 | printMatches query = do
matches <- htmlQuery query
liftIO $ hPutStrLn stderr $ show matches
-- | Add a parameter with the given name and value to the request body. | 168 | true | true | 0 | 9 | 53 | 54 | 25 | 29 | null | null |
ekmett/wxHaskell | wxdirect/src/CompileClassInfo.hs | lgpl-2.1 | {-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------}
toHaskellClassType :: String -> (String,String)
toHaskellClassType className
= (classTypeDeclName
,"{-# NOINLINE " ++ classTypeDeclName ++ " #-}\n" ++
classTypeDeclName ++ " :: ClassType (" ++ classTypeName' ++ " ())\n" ++
classTypeDeclName ++ " = ClassType (unsafePerformIO (classInfoFindClass " ++ classTypeString ++ "))\n\n"
)
where
classTypeDeclName :: String
classTypeDeclName = haskellDeclName ("class" ++ classTypeName')
classTypeName' :: String
classTypeName' = haskellTypeName className
classTypeString :: String
classTypeString = "\"" ++ className ++ "\""
{-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------} | 989 | toHaskellClassType :: String -> (String,String)
toHaskellClassType className
= (classTypeDeclName
,"{-# NOINLINE " ++ classTypeDeclName ++ " #-}\n" ++
classTypeDeclName ++ " :: ClassType (" ++ classTypeName' ++ " ())\n" ++
classTypeDeclName ++ " = ClassType (unsafePerformIO (classInfoFindClass " ++ classTypeString ++ "))\n\n"
)
where
classTypeDeclName :: String
classTypeDeclName = haskellDeclName ("class" ++ classTypeName')
classTypeName' :: String
classTypeName' = haskellTypeName className
classTypeString :: String
classTypeString = "\"" ++ className ++ "\""
{-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------} | 806 | toHaskellClassType className
= (classTypeDeclName
,"{-# NOINLINE " ++ classTypeDeclName ++ " #-}\n" ++
classTypeDeclName ++ " :: ClassType (" ++ classTypeName' ++ " ())\n" ++
classTypeDeclName ++ " = ClassType (unsafePerformIO (classInfoFindClass " ++ classTypeString ++ "))\n\n"
)
where
classTypeDeclName :: String
classTypeDeclName = haskellDeclName ("class" ++ classTypeName')
classTypeName' :: String
classTypeName' = haskellTypeName className
classTypeString :: String
classTypeString = "\"" ++ className ++ "\""
{-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------} | 758 | true | true | 0 | 15 | 133 | 126 | 68 | 58 | null | null |
glutamate/probably | Math/Probably/KS.hs | bsd-3-clause | -- c1 - -pi**2/8, c2 = 9*c1, c3 = 25*c1
c1 = -1.2337005501361697 | 64 | c1 = -1.2337005501361697 | 24 | c1 = -1.2337005501361697 | 24 | true | false | 0 | 5 | 12 | 9 | 5 | 4 | null | null |
mikaperlin/scripts-configs-etc | configs/home/perlinm/.xmonad/xmonad.hs | mit | myWorkspaces = Prelude.map show [0..10] ++ ["NSP"] | 50 | myWorkspaces = Prelude.map show [0..10] ++ ["NSP"] | 50 | myWorkspaces = Prelude.map show [0..10] ++ ["NSP"] | 50 | false | false | 0 | 7 | 6 | 25 | 13 | 12 | null | null |
meiersi/scyther-proof | src/Scyther/Theory/FOL.hs | gpl-3.0 | getMath :: Article a -> [a]
getMath a = [ x | Math x <- getArticle a ] | 70 | getMath :: Article a -> [a]
getMath a = [ x | Math x <- getArticle a ] | 70 | getMath a = [ x | Math x <- getArticle a ] | 42 | false | true | 0 | 9 | 17 | 47 | 21 | 26 | null | null |
ezyang/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | pprLCmd :: (SourceTextX p, OutputableBndrId p) => LHsCmd p -> SDoc
pprLCmd (L _ c) = pprCmd c | 93 | pprLCmd :: (SourceTextX p, OutputableBndrId p) => LHsCmd p -> SDoc
pprLCmd (L _ c) = pprCmd c | 93 | pprLCmd (L _ c) = pprCmd c | 26 | false | true | 0 | 7 | 17 | 51 | 24 | 27 | null | null |
yiannist/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | drbdProtocol :: String
drbdProtocol = "protocol" | 48 | drbdProtocol :: String
drbdProtocol = "protocol" | 48 | drbdProtocol = "protocol" | 25 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
mattyw/forth | forth.hs | gpl-3.0 | add :: StackOp
add [] = error "empty list" | 42 | add :: StackOp
add [] = error "empty list" | 42 | add [] = error "empty list" | 27 | false | true | 0 | 6 | 8 | 19 | 9 | 10 | null | null |
Shimuuar/type-level-numbers | TypeLevel/Number/Nat/Num.hs | bsd-3-clause | n8 :: N8; n8 = undefined | 24 | n8 :: N8
n8 = undefined | 23 | n8 = undefined | 14 | false | true | 1 | 5 | 5 | 16 | 7 | 9 | null | null |
nicodelpiano/stlcnat-exhaustivity-checker | src/ECL/Checker.hs | mit | check :: (Match c) => [(c, c)] -> [[c]]
check = listToVec (map vecToList . uncurry missed . unzipVec) | 101 | check :: (Match c) => [(c, c)] -> [[c]]
check = listToVec (map vecToList . uncurry missed . unzipVec) | 101 | check = listToVec (map vecToList . uncurry missed . unzipVec) | 61 | false | true | 0 | 10 | 18 | 66 | 33 | 33 | null | null |
dpieroux/euler | 0/0045.hs | mit | hexagonal :: Int -> Int
hexagonal n = n*(2*n-1) | 47 | hexagonal :: Int -> Int
hexagonal n = n*(2*n-1) | 47 | hexagonal n = n*(2*n-1) | 23 | false | true | 0 | 8 | 8 | 33 | 17 | 16 | null | null |
rueshyna/gogol | gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/OrderDocuments/List.hs | mpl-2.0 | -- | Select only order documents that have been approved by at least one
-- user.
odlApproved :: Lens' OrderDocumentsList (Maybe Bool)
odlApproved
= lens _odlApproved (\ s a -> s{_odlApproved = a}) | 199 | odlApproved :: Lens' OrderDocumentsList (Maybe Bool)
odlApproved
= lens _odlApproved (\ s a -> s{_odlApproved = a}) | 117 | odlApproved
= lens _odlApproved (\ s a -> s{_odlApproved = a}) | 64 | true | true | 0 | 9 | 34 | 49 | 26 | 23 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 2242 = 2241 | 11 | 2242 = 2241 | 11 | 2242 = 2241 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
OpenXT/network | nws/NetworkUtils.hs | gpl-2.0 | checkAndAddBridge :: String -> IO ()
checkAndAddBridge bridge = _checkAndAddBridge bridge "0" | 93 | checkAndAddBridge :: String -> IO ()
checkAndAddBridge bridge = _checkAndAddBridge bridge "0" | 93 | checkAndAddBridge bridge = _checkAndAddBridge bridge "0" | 56 | false | true | 0 | 7 | 11 | 28 | 13 | 15 | null | null |
fcostantini/QuickFuzz | src/Lua.hs | gpl-3.0 | pushId :: Name -> VState Name ()
pushId i = do st <- get
put $ st {vars = i:(vars st)} | 100 | pushId :: Name -> VState Name ()
pushId i = do st <- get
put $ st {vars = i:(vars st)} | 100 | pushId i = do st <- get
put $ st {vars = i:(vars st)} | 67 | false | true | 0 | 13 | 34 | 62 | 29 | 33 | null | null |
nickng/gong | GoTypes.hs | apache-2.0 | -- Should be handled in ChanInst
checkFinite debug defEnv pRecs ys zs cDef (ChanInst (TVar x) l) =
if (x == cDef) then
-- return $ ((not . null $ ys) || (l `finMem` zs))
if ((not . null $ ys) || (l `finMem` zs))
then return True
else if debug
then error $ "Not fenced: "++(show ((l,zs),ys))
else return False
else
if (x `S.member` pRecs) then
return $ True
else
do
let tdef = (case (L.lookup x defEnv) of
Just(Embed(t)) -> t
_ -> error $ "Something went wrong, can't find: "++(show x))
let tabs = (case tdef of
ChanAbst bnd -> bnd
_ -> error "boom! wtf")
(params,abs) <- unbind tabs
let perm = L.foldr (\(d,c) acc -> compose acc (single (AnyName d) (AnyName c)) )
(Unbound.LocallyNameless.empty) (zip params l)
checkFinite debug defEnv (S.insert x pRecs) ys zs cDef (swaps perm abs) | 1,298 | checkFinite debug defEnv pRecs ys zs cDef (ChanInst (TVar x) l) =
if (x == cDef) then
-- return $ ((not . null $ ys) || (l `finMem` zs))
if ((not . null $ ys) || (l `finMem` zs))
then return True
else if debug
then error $ "Not fenced: "++(show ((l,zs),ys))
else return False
else
if (x `S.member` pRecs) then
return $ True
else
do
let tdef = (case (L.lookup x defEnv) of
Just(Embed(t)) -> t
_ -> error $ "Something went wrong, can't find: "++(show x))
let tabs = (case tdef of
ChanAbst bnd -> bnd
_ -> error "boom! wtf")
(params,abs) <- unbind tabs
let perm = L.foldr (\(d,c) acc -> compose acc (single (AnyName d) (AnyName c)) )
(Unbound.LocallyNameless.empty) (zip params l)
checkFinite debug defEnv (S.insert x pRecs) ys zs cDef (swaps perm abs) | 1,265 | checkFinite debug defEnv pRecs ys zs cDef (ChanInst (TVar x) l) =
if (x == cDef) then
-- return $ ((not . null $ ys) || (l `finMem` zs))
if ((not . null $ ys) || (l `finMem` zs))
then return True
else if debug
then error $ "Not fenced: "++(show ((l,zs),ys))
else return False
else
if (x `S.member` pRecs) then
return $ True
else
do
let tdef = (case (L.lookup x defEnv) of
Just(Embed(t)) -> t
_ -> error $ "Something went wrong, can't find: "++(show x))
let tabs = (case tdef of
ChanAbst bnd -> bnd
_ -> error "boom! wtf")
(params,abs) <- unbind tabs
let perm = L.foldr (\(d,c) acc -> compose acc (single (AnyName d) (AnyName c)) )
(Unbound.LocallyNameless.empty) (zip params l)
checkFinite debug defEnv (S.insert x pRecs) ys zs cDef (swaps perm abs) | 1,265 | true | false | 4 | 12 | 659 | 365 | 196 | 169 | null | null |
brendanhay/gogol | gogol-slides/gen/Network/Google/Resource/Slides/Presentations/Pages/GetThumbnail.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
ppgtUploadType :: Lens' PresentationsPagesGetThumbnail (Maybe Text)
ppgtUploadType
= lens _ppgtUploadType
(\ s a -> s{_ppgtUploadType = a}) | 218 | ppgtUploadType :: Lens' PresentationsPagesGetThumbnail (Maybe Text)
ppgtUploadType
= lens _ppgtUploadType
(\ s a -> s{_ppgtUploadType = a}) | 147 | ppgtUploadType
= lens _ppgtUploadType
(\ s a -> s{_ppgtUploadType = a}) | 79 | true | true | 0 | 8 | 34 | 49 | 25 | 24 | null | null |
Mahdi89/eTeak | src/Call.hs | bsd-3-clause | prepareProcActual :: Eval Decl -> Pos -> [Context Decl] -> Binding Decl -> ProcActual ->
(Completeness, (ProcActual, Decl))
prepareProcActual _evalDecl pos cs formal actual = body actual decl
where
evalError' str = (comp, (actual, decl))
where (comp, _) = evalError cs pos actual str
decl = bindingValue formal
typ = declType decl
exprToChan decl expr
| chanR == Complete = (Complete, (ChanProcActual $ CheckChan pos decl chan, decl))
| otherwise = (chanR, (actual, decl))
where (chanR, chan) = actualExprToChan cs expr undefined
body (TypeProcActual {}) decl@(TypeParamDecl {}) = (Complete, (actual, decl))
body (TypeProcActual {}) _ = evalError' "not expecting a type actual"
body (ExprProcActual expr) decl@(TypeParamDecl {}) = (comp, (actual', decl))
where (comp, actual') = actualExprToType pos cs expr actual TypeProcActual
body (ExprProcActual expr) decl@(ParamDecl {}) =
(Complete, (ExprProcActual $ ConstCheckExpr pos $ TypeCheckExpr pos Transient typ expr, decl))
body (ExprProcActual expr) decl@(PortDecl {}) = exprToChan decl expr
body (ExprProcActual expr) decl@(ArrayedDecl {}) = exprToChan decl expr
{- FIXME, need to make conditional ports work
body actual@(ExprProcActual {}) decl@(CaseDecl {}) = whyToPairDefault (actual, decl) $ do
-- decl' <- pairToWhy $ evalDecl cs decl
let decl' = PortDecl NoPos Output (Bits 1)
pairToWhy $ body actual decl'
-}
body (ExprProcActual _) _ = evalError' "not expecting an expression"
body (ChanProcActual _) _ = (Complete, (actual, decl))
-- makeActualsArray : make an array of (Just actual) elements based on matching actuals to
-- their corresponding formals in the given formals list. Populates all other elements of
-- the returned array with Nothing | 2,077 | prepareProcActual :: Eval Decl -> Pos -> [Context Decl] -> Binding Decl -> ProcActual ->
(Completeness, (ProcActual, Decl))
prepareProcActual _evalDecl pos cs formal actual = body actual decl
where
evalError' str = (comp, (actual, decl))
where (comp, _) = evalError cs pos actual str
decl = bindingValue formal
typ = declType decl
exprToChan decl expr
| chanR == Complete = (Complete, (ChanProcActual $ CheckChan pos decl chan, decl))
| otherwise = (chanR, (actual, decl))
where (chanR, chan) = actualExprToChan cs expr undefined
body (TypeProcActual {}) decl@(TypeParamDecl {}) = (Complete, (actual, decl))
body (TypeProcActual {}) _ = evalError' "not expecting a type actual"
body (ExprProcActual expr) decl@(TypeParamDecl {}) = (comp, (actual', decl))
where (comp, actual') = actualExprToType pos cs expr actual TypeProcActual
body (ExprProcActual expr) decl@(ParamDecl {}) =
(Complete, (ExprProcActual $ ConstCheckExpr pos $ TypeCheckExpr pos Transient typ expr, decl))
body (ExprProcActual expr) decl@(PortDecl {}) = exprToChan decl expr
body (ExprProcActual expr) decl@(ArrayedDecl {}) = exprToChan decl expr
{- FIXME, need to make conditional ports work
body actual@(ExprProcActual {}) decl@(CaseDecl {}) = whyToPairDefault (actual, decl) $ do
-- decl' <- pairToWhy $ evalDecl cs decl
let decl' = PortDecl NoPos Output (Bits 1)
pairToWhy $ body actual decl'
-}
body (ExprProcActual _) _ = evalError' "not expecting an expression"
body (ChanProcActual _) _ = (Complete, (actual, decl))
-- makeActualsArray : make an array of (Just actual) elements based on matching actuals to
-- their corresponding formals in the given formals list. Populates all other elements of
-- the returned array with Nothing | 2,073 | prepareProcActual _evalDecl pos cs formal actual = body actual decl
where
evalError' str = (comp, (actual, decl))
where (comp, _) = evalError cs pos actual str
decl = bindingValue formal
typ = declType decl
exprToChan decl expr
| chanR == Complete = (Complete, (ChanProcActual $ CheckChan pos decl chan, decl))
| otherwise = (chanR, (actual, decl))
where (chanR, chan) = actualExprToChan cs expr undefined
body (TypeProcActual {}) decl@(TypeParamDecl {}) = (Complete, (actual, decl))
body (TypeProcActual {}) _ = evalError' "not expecting a type actual"
body (ExprProcActual expr) decl@(TypeParamDecl {}) = (comp, (actual', decl))
where (comp, actual') = actualExprToType pos cs expr actual TypeProcActual
body (ExprProcActual expr) decl@(ParamDecl {}) =
(Complete, (ExprProcActual $ ConstCheckExpr pos $ TypeCheckExpr pos Transient typ expr, decl))
body (ExprProcActual expr) decl@(PortDecl {}) = exprToChan decl expr
body (ExprProcActual expr) decl@(ArrayedDecl {}) = exprToChan decl expr
{- FIXME, need to make conditional ports work
body actual@(ExprProcActual {}) decl@(CaseDecl {}) = whyToPairDefault (actual, decl) $ do
-- decl' <- pairToWhy $ evalDecl cs decl
let decl' = PortDecl NoPos Output (Bits 1)
pairToWhy $ body actual decl'
-}
body (ExprProcActual _) _ = evalError' "not expecting an expression"
body (ChanProcActual _) _ = (Complete, (actual, decl))
-- makeActualsArray : make an array of (Just actual) elements based on matching actuals to
-- their corresponding formals in the given formals list. Populates all other elements of
-- the returned array with Nothing | 1,941 | false | true | 11 | 14 | 620 | 503 | 271 | 232 | null | null |
aaronc/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | highestFC (PAppImpl t _) = highestFC t | 38 | highestFC (PAppImpl t _) = highestFC t | 38 | highestFC (PAppImpl t _) = highestFC t | 38 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
techtangents/ablist | test/AbListTests.hs | bsd-3-clause | p_abHead_n :: Int -> Bool
p_abHead_n a = abHead (a :/ undefined :: AbList Int Float) == Just a | 94 | p_abHead_n :: Int -> Bool
p_abHead_n a = abHead (a :/ undefined :: AbList Int Float) == Just a | 94 | p_abHead_n a = abHead (a :/ undefined :: AbList Int Float) == Just a | 68 | false | true | 0 | 8 | 18 | 43 | 21 | 22 | null | null |
yan-ac/bbq.yan.ac | Data/AppConfig.hs | mit | deleteRecord :: PoolType -> VCode -> App ()
deleteRecord t vcode = do
pools <- recordPools <$> ask
liftIO $ removeRecord pools t vcode | 139 | deleteRecord :: PoolType -> VCode -> App ()
deleteRecord t vcode = do
pools <- recordPools <$> ask
liftIO $ removeRecord pools t vcode | 139 | deleteRecord t vcode = do
pools <- recordPools <$> ask
liftIO $ removeRecord pools t vcode | 95 | false | true | 0 | 8 | 28 | 54 | 25 | 29 | null | null |
badp/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | -- | 60 MiB/s, expressed in KiB/s
classicDrbdSyncSpeed :: Int
classicDrbdSyncSpeed = 60 * 1024 | 94 | classicDrbdSyncSpeed :: Int
classicDrbdSyncSpeed = 60 * 1024 | 60 | classicDrbdSyncSpeed = 60 * 1024 | 32 | true | true | 0 | 5 | 14 | 16 | 9 | 7 | null | null |
mniip/h6502 | src/H6502/Util.hs | mit | -- | Get the Y index.
getY :: Monad m => H6502T m Word8
getY = onState reg_y | 76 | getY :: Monad m => H6502T m Word8
getY = onState reg_y | 54 | getY = onState reg_y | 20 | true | true | 0 | 6 | 17 | 27 | 13 | 14 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 4183 = 4182 | 11 | 4183 = 4182 | 11 | 4183 = 4182 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
Proclivis/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxLANGUAGE_SHONA :: Int
wxLANGUAGE_SHONA = 168 | 46 | wxLANGUAGE_SHONA :: Int
wxLANGUAGE_SHONA = 168 | 46 | wxLANGUAGE_SHONA = 168 | 22 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
SKA-ScienceDataProcessor/RC | MS6/LogAn/Text/Scanf.hs | apache-2.0 | lit :: String -> Scanner a a
lit = SLit | 40 | lit :: String -> Scanner a a
lit = SLit | 40 | lit = SLit | 11 | false | true | 0 | 7 | 10 | 26 | 11 | 15 | null | null |
Daniel-Diaz/wavy | Data/Sound.hs | bsd-3-clause | - | /Parallelization of sounds/. Often refered as the /par/ operator.
-- Applying this operator over two sounds will make them sound at the same
-- time, but in different channels. The sound at the left will be at left-most
-- channels, and the right one at the right-most channels.
-- There are some restriction to use this function.
--
-- * Both arguments must share the same /sample rate/.
--
(<|>) :: Sound -> Sound -> Sound
s1@(S r l nc c) <|> s2@(S r' l' nc' c')
| r /= r' = soundError [s1,s2] "<|>" $ "Can't par sounds with different sample rates. "
++ "Please, consider to change the sample rate of one of them."
| otherwise = let c'' = if l < l' then zipChunkedSame appendSamples (c <> zeroChunks (l'-l) nc) c'
else zipChunkedSame appendSamples c (c' <> zeroChunks (l-l') nc')
in S r (max l l') (nc+nc') c''
| 921 | (<|>) :: Sound -> Sound -> Sound
s1@(S r l nc c) <|> s2@(S r' l' nc' c')
| r /= r' = soundError [s1,s2] "<|>" $ "Can't par sounds with different sample rates. "
++ "Please, consider to change the sample rate of one of them."
| otherwise = let c'' = if l < l' then zipChunkedSame appendSamples (c <> zeroChunks (l'-l) nc) c'
else zipChunkedSame appendSamples c (c' <> zeroChunks (l-l') nc')
in S r (max l l') (nc+nc') c'' | 514 | s1@(S r l nc c) <|> s2@(S r' l' nc' c')
| r /= r' = soundError [s1,s2] "<|>" $ "Can't par sounds with different sample rates. "
++ "Please, consider to change the sample rate of one of them."
| otherwise = let c'' = if l < l' then zipChunkedSame appendSamples (c <> zeroChunks (l'-l) nc) c'
else zipChunkedSame appendSamples c (c' <> zeroChunks (l-l') nc')
in S r (max l l') (nc+nc') c'' | 481 | true | true | 3 | 15 | 258 | 236 | 122 | 114 | null | null |
vladimir-ipatov/ganeti | src/Ganeti/HTools/Types.hs | gpl-2.0 | -- | Unknown field in table output.
unknownField :: String
unknownField = "<unknown field>" | 91 | unknownField :: String
unknownField = "<unknown field>" | 55 | unknownField = "<unknown field>" | 32 | true | true | 0 | 6 | 13 | 19 | 8 | 11 | null | null |
BartAdv/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reifyNativeTy (P _ n _) | n == reflm "IT8" = return IT8 | 55 | reifyNativeTy (P _ n _) | n == reflm "IT8" = return IT8 | 55 | reifyNativeTy (P _ n _) | n == reflm "IT8" = return IT8 | 55 | false | false | 0 | 9 | 12 | 35 | 15 | 20 | null | null |
mfpi/boom | src/CleanFRP.hs | mit | deltaRenderAdd eId pushId rc = liftF (DeltaRenderAdd eId pushId rc id) | 70 | deltaRenderAdd eId pushId rc = liftF (DeltaRenderAdd eId pushId rc id) | 70 | deltaRenderAdd eId pushId rc = liftF (DeltaRenderAdd eId pushId rc id) | 70 | false | false | 0 | 7 | 10 | 29 | 13 | 16 | null | null |
leshchevds/ganeti | src/Ganeti/OpParams.hs | bsd-2-clause | pIAllocatorCount :: Field
pIAllocatorCount =
withDoc "IAllocator count field" .
renameField "IAllocatorCount" .
defaultField [| forceNonNeg (1::Int) |] $
simpleField "count" [t| NonNegative Int |] | 204 | pIAllocatorCount :: Field
pIAllocatorCount =
withDoc "IAllocator count field" .
renameField "IAllocatorCount" .
defaultField [| forceNonNeg (1::Int) |] $
simpleField "count" [t| NonNegative Int |] | 204 | pIAllocatorCount =
withDoc "IAllocator count field" .
renameField "IAllocatorCount" .
defaultField [| forceNonNeg (1::Int) |] $
simpleField "count" [t| NonNegative Int |] | 178 | false | true | 0 | 6 | 32 | 52 | 25 | 27 | null | null |
elieux/ghc | compiler/llvmGen/LlvmCodeGen/CodeGen.hs | bsd-3-clause | genCall (PrimTarget (MO_UF_Conv w)) [dst] [e] = runStmtsDecls $ do
dstV <- getCmmRegW (CmmLocal dst)
let ty = cmmToLlvmType $ localRegType dst
width = widthToLlvmFloat w
castV <- lift $ mkLocalVar ty
ve <- exprToVarW e
statement $ Assignment castV $ Cast LM_Uitofp ve width
statement $ Store castV dstV | 334 | genCall (PrimTarget (MO_UF_Conv w)) [dst] [e] = runStmtsDecls $ do
dstV <- getCmmRegW (CmmLocal dst)
let ty = cmmToLlvmType $ localRegType dst
width = widthToLlvmFloat w
castV <- lift $ mkLocalVar ty
ve <- exprToVarW e
statement $ Assignment castV $ Cast LM_Uitofp ve width
statement $ Store castV dstV | 334 | genCall (PrimTarget (MO_UF_Conv w)) [dst] [e] = runStmtsDecls $ do
dstV <- getCmmRegW (CmmLocal dst)
let ty = cmmToLlvmType $ localRegType dst
width = widthToLlvmFloat w
castV <- lift $ mkLocalVar ty
ve <- exprToVarW e
statement $ Assignment castV $ Cast LM_Uitofp ve width
statement $ Store castV dstV | 334 | false | false | 1 | 13 | 81 | 136 | 60 | 76 | null | null |
brendanhay/gogol | gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs | mpl-2.0 | -- | The list of rows that constitute the table. Must have the same length as
-- \`rowHeaders\`. Required.
tRows :: Lens' Table [Row]
tRows
= lens _tRows (\ s a -> s{_tRows = a}) . _Default .
_Coerce | 207 | tRows :: Lens' Table [Row]
tRows
= lens _tRows (\ s a -> s{_tRows = a}) . _Default .
_Coerce | 100 | tRows
= lens _tRows (\ s a -> s{_tRows = a}) . _Default .
_Coerce | 73 | true | true | 0 | 11 | 46 | 54 | 29 | 25 | null | null |
liefswanson/projectEuler | src/Cards.hs | gpl-2.0 | suitMap = fromList $ zip suitOrderString [Clubs ..] | 51 | suitMap = fromList $ zip suitOrderString [Clubs ..] | 51 | suitMap = fromList $ zip suitOrderString [Clubs ..] | 51 | false | false | 0 | 7 | 7 | 19 | 10 | 9 | null | null |
rueshyna/gogol | gogol-replicapool-updater/gen/Network/Google/Resource/ReplicaPoolUpdater/RollingUpdates/Cancel.hs | mpl-2.0 | -- | Creates a value of 'RollingUpdatesCancel' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rucRollingUpdate'
--
-- * 'rucProject'
--
-- * 'rucZone'
rollingUpdatesCancel
:: Text -- ^ 'rucRollingUpdate'
-> Text -- ^ 'rucProject'
-> Text -- ^ 'rucZone'
-> RollingUpdatesCancel
rollingUpdatesCancel pRucRollingUpdate_ pRucProject_ pRucZone_ =
RollingUpdatesCancel'
{ _rucRollingUpdate = pRucRollingUpdate_
, _rucProject = pRucProject_
, _rucZone = pRucZone_
} | 581 | rollingUpdatesCancel
:: Text -- ^ 'rucRollingUpdate'
-> Text -- ^ 'rucProject'
-> Text -- ^ 'rucZone'
-> RollingUpdatesCancel
rollingUpdatesCancel pRucRollingUpdate_ pRucProject_ pRucZone_ =
RollingUpdatesCancel'
{ _rucRollingUpdate = pRucRollingUpdate_
, _rucProject = pRucProject_
, _rucZone = pRucZone_
} | 343 | rollingUpdatesCancel pRucRollingUpdate_ pRucProject_ pRucZone_ =
RollingUpdatesCancel'
{ _rucRollingUpdate = pRucRollingUpdate_
, _rucProject = pRucProject_
, _rucZone = pRucZone_
} | 201 | true | true | 0 | 9 | 114 | 71 | 42 | 29 | null | null |
peterbecich/haskell-programming-first-principles | src/Chapter11.hs | bsd-3-clause | reduceExpr (Minus x y) = reduceExpr x - reduceExpr y | 52 | reduceExpr (Minus x y) = reduceExpr x - reduceExpr y | 52 | reduceExpr (Minus x y) = reduceExpr x - reduceExpr y | 52 | false | false | 0 | 7 | 9 | 27 | 12 | 15 | null | null |
alfpark/bond | compiler/src/Language/Bond/Parser.hs | mit | findSymbol :: QualifiedName -> Parser Declaration
findSymbol name = doFind <?> "qualified name"
where
doFind = do
namespaces <- asks currentNamespaces
Symbols { symbols = symbols } <- getState
case find (delcMatching namespaces name) symbols of
Just decl -> return decl
Nothing -> fail $ "Unknown symbol: " ++ showQualifiedName name
delcMatching namespaces [unqualifiedName] decl =
unqualifiedName == declName decl
&& (not $ null $ intersectBy nsMatching namespaces (declNamespaces decl))
delcMatching _ qualifiedName' decl =
takeName qualifiedName' == declName decl
&& any ((takeNamespace qualifiedName' ==) . nsName) (declNamespaces decl)
nsMatching ns1 ns2 =
nsName ns1 == nsName ns2 && (lang1 == lang2 || lang1 == Nothing || lang2 == Nothing)
where
lang1 = nsLanguage ns1
lang2 = nsLanguage ns2 | 920 | findSymbol :: QualifiedName -> Parser Declaration
findSymbol name = doFind <?> "qualified name"
where
doFind = do
namespaces <- asks currentNamespaces
Symbols { symbols = symbols } <- getState
case find (delcMatching namespaces name) symbols of
Just decl -> return decl
Nothing -> fail $ "Unknown symbol: " ++ showQualifiedName name
delcMatching namespaces [unqualifiedName] decl =
unqualifiedName == declName decl
&& (not $ null $ intersectBy nsMatching namespaces (declNamespaces decl))
delcMatching _ qualifiedName' decl =
takeName qualifiedName' == declName decl
&& any ((takeNamespace qualifiedName' ==) . nsName) (declNamespaces decl)
nsMatching ns1 ns2 =
nsName ns1 == nsName ns2 && (lang1 == lang2 || lang1 == Nothing || lang2 == Nothing)
where
lang1 = nsLanguage ns1
lang2 = nsLanguage ns2 | 920 | findSymbol name = doFind <?> "qualified name"
where
doFind = do
namespaces <- asks currentNamespaces
Symbols { symbols = symbols } <- getState
case find (delcMatching namespaces name) symbols of
Just decl -> return decl
Nothing -> fail $ "Unknown symbol: " ++ showQualifiedName name
delcMatching namespaces [unqualifiedName] decl =
unqualifiedName == declName decl
&& (not $ null $ intersectBy nsMatching namespaces (declNamespaces decl))
delcMatching _ qualifiedName' decl =
takeName qualifiedName' == declName decl
&& any ((takeNamespace qualifiedName' ==) . nsName) (declNamespaces decl)
nsMatching ns1 ns2 =
nsName ns1 == nsName ns2 && (lang1 == lang2 || lang1 == Nothing || lang2 == Nothing)
where
lang1 = nsLanguage ns1
lang2 = nsLanguage ns2 | 870 | false | true | 4 | 11 | 240 | 276 | 132 | 144 | null | null |
phischu/fragnix | benchmarks/containers/Data.Sequence.hs | bsd-3-clause | seqDataType :: DataType
seqDataType = mkDataType "Data.Sequence.Seq" [emptyConstr, consConstr] | 94 | seqDataType :: DataType
seqDataType = mkDataType "Data.Sequence.Seq" [emptyConstr, consConstr] | 94 | seqDataType = mkDataType "Data.Sequence.Seq" [emptyConstr, consConstr] | 70 | false | true | 0 | 6 | 8 | 29 | 13 | 16 | null | null |
facebookincubator/duckling | Duckling/Numeral/HI/Rules.hs | bsd-3-clause | ruleMultiply :: Rule
ruleMultiply = Rule
{ name = "compose by multiplication"
, pattern =
[ Predicate isPositive
, Predicate isMultipliable
]
, prod = \tokens -> case tokens of
(token1:token2:_) -> multiply token1 token2
_ -> Nothing
} | 267 | ruleMultiply :: Rule
ruleMultiply = Rule
{ name = "compose by multiplication"
, pattern =
[ Predicate isPositive
, Predicate isMultipliable
]
, prod = \tokens -> case tokens of
(token1:token2:_) -> multiply token1 token2
_ -> Nothing
} | 267 | ruleMultiply = Rule
{ name = "compose by multiplication"
, pattern =
[ Predicate isPositive
, Predicate isMultipliable
]
, prod = \tokens -> case tokens of
(token1:token2:_) -> multiply token1 token2
_ -> Nothing
} | 246 | false | true | 0 | 14 | 70 | 84 | 45 | 39 | null | null |
ghc-android/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | pprTcTyVarDetails (MetaTv { mtv_info = info, mtv_tclvl = tclvl })
= pp_info <> colon <> ppr tclvl
where
pp_info = case info of
ReturnTv -> ptext (sLit "ret")
TauTv -> ptext (sLit "tau")
SigTv -> ptext (sLit "sig")
FlatMetaTv -> ptext (sLit "fuv") | 330 | pprTcTyVarDetails (MetaTv { mtv_info = info, mtv_tclvl = tclvl })
= pp_info <> colon <> ppr tclvl
where
pp_info = case info of
ReturnTv -> ptext (sLit "ret")
TauTv -> ptext (sLit "tau")
SigTv -> ptext (sLit "sig")
FlatMetaTv -> ptext (sLit "fuv") | 330 | pprTcTyVarDetails (MetaTv { mtv_info = info, mtv_tclvl = tclvl })
= pp_info <> colon <> ppr tclvl
where
pp_info = case info of
ReturnTv -> ptext (sLit "ret")
TauTv -> ptext (sLit "tau")
SigTv -> ptext (sLit "sig")
FlatMetaTv -> ptext (sLit "fuv") | 330 | false | false | 0 | 10 | 126 | 110 | 54 | 56 | null | null |
mstksg/netwire-experiments | src/Utils/Wire/Wrapped.hs | gpl-3.0 | dWireBox :: forall m e a b s. (Monoid s, Monad m) => a -> Wire s e m (Event [Wire s e m a b],[a]) [b]
dWireBox fill = wireBox fill . delay (NoEvent,[]) | 151 | dWireBox :: forall m e a b s. (Monoid s, Monad m) => a -> Wire s e m (Event [Wire s e m a b],[a]) [b]
dWireBox fill = wireBox fill . delay (NoEvent,[]) | 151 | dWireBox fill = wireBox fill . delay (NoEvent,[]) | 49 | false | true | 0 | 12 | 34 | 100 | 54 | 46 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.