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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fredcy/elm-format | src/ElmFormat/Render/Box.hs | bsd-3-clause | formatTypeConstructor :: TypeConstructor -> Box
formatTypeConstructor ctor =
case ctor of
NamedConstructor name ->
line $ identifier name
TupleConstructor n ->
line $ keyword $ "(" ++ (List.replicate (n-1) ',') ++ ")" | 262 | formatTypeConstructor :: TypeConstructor -> Box
formatTypeConstructor ctor =
case ctor of
NamedConstructor name ->
line $ identifier name
TupleConstructor n ->
line $ keyword $ "(" ++ (List.replicate (n-1) ',') ++ ")" | 262 | formatTypeConstructor ctor =
case ctor of
NamedConstructor name ->
line $ identifier name
TupleConstructor n ->
line $ keyword $ "(" ++ (List.replicate (n-1) ',') ++ ")" | 214 | false | true | 0 | 13 | 76 | 86 | 40 | 46 | null | null |
robdockins/edison | edison-core/src/Data/Edison/Assoc/TernaryTrie.hs | mit | foldl1' :: (b -> b -> b) -> FM k b -> b
foldl1' = foldl1 | 56 | foldl1' :: (b -> b -> b) -> FM k b -> b
foldl1' = foldl1 | 56 | foldl1' = foldl1 | 16 | false | true | 0 | 8 | 15 | 35 | 18 | 17 | null | null |
bkoropoff/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | tldeclared (PData _ _ _ _ _ (PDatadecl n _ _ ts)) = n : map fstt ts
where fstt (_, _, a, _, _, _, _) = a | 107 | tldeclared (PData _ _ _ _ _ (PDatadecl n _ _ ts)) = n : map fstt ts
where fstt (_, _, a, _, _, _, _) = a | 107 | tldeclared (PData _ _ _ _ _ (PDatadecl n _ _ ts)) = n : map fstt ts
where fstt (_, _, a, _, _, _, _) = a | 107 | false | false | 0 | 9 | 31 | 77 | 41 | 36 | null | null |
pparkkin/eta | compiler/ETA/Types/TyCon.hs | bsd-3-clause | isInjectiveTyCon (PromotedTyCon {ty_con = tc}) r
= isInjectiveTyCon tc r | 74 | isInjectiveTyCon (PromotedTyCon {ty_con = tc}) r
= isInjectiveTyCon tc r | 74 | isInjectiveTyCon (PromotedTyCon {ty_con = tc}) r
= isInjectiveTyCon tc r | 74 | false | false | 1 | 8 | 11 | 32 | 14 | 18 | null | null |
vizietto/kalkulu | src/Kalkulu/Environment.hs | gpl-3.0 | getDef :: Environment -> Symbol -> IO Definition
getDef env (Builtin b) = return $ (builtinDefs env) ! b | 104 | getDef :: Environment -> Symbol -> IO Definition
getDef env (Builtin b) = return $ (builtinDefs env) ! b | 104 | getDef env (Builtin b) = return $ (builtinDefs env) ! b | 55 | false | true | 0 | 8 | 18 | 47 | 23 | 24 | null | null |
ntc2/cryptol | src/Cryptol/Parser/NoPat.hs | bsd-3-clause | noPatM :: Match -> NoPatM [Match]
noPatM (Match p e) =
do (x,bs) <- noPat p
e1 <- noPatE e
return (Match x e1 : map MatchLet bs) | 144 | noPatM :: Match -> NoPatM [Match]
noPatM (Match p e) =
do (x,bs) <- noPat p
e1 <- noPatE e
return (Match x e1 : map MatchLet bs) | 144 | noPatM (Match p e) =
do (x,bs) <- noPat p
e1 <- noPatE e
return (Match x e1 : map MatchLet bs) | 110 | false | true | 0 | 10 | 43 | 85 | 39 | 46 | null | null |
unisonweb/platform | unison-core/src/Unison/LabeledDependency.hs | mit | effectConstructor :: Reference -> Int -> LabeledDependency
derivedType = X . Left . DerivedId | 94 | effectConstructor :: Reference -> Int -> LabeledDependency
derivedType = X . Left . DerivedId | 93 | derivedType = X . Left . DerivedId | 34 | false | true | 0 | 6 | 14 | 27 | 14 | 13 | null | null |
nevrenato/HetsAlloy | Common/IRI.hs | gpl-2.0 | {- |'mergeCurie' merges the CURIE @c@ into IRI @i@, appending their string
representations -}
mergeCurie :: IRI -> IRI -> Maybe IRI
mergeCurie c i =
parseIRIManchester $ '<' : iriToStringFull id (setAngles False i) ""
++ iriToStringAbbrevMerge c ">" | 255 | mergeCurie :: IRI -> IRI -> Maybe IRI
mergeCurie c i =
parseIRIManchester $ '<' : iriToStringFull id (setAngles False i) ""
++ iriToStringAbbrevMerge c ">" | 161 | mergeCurie c i =
parseIRIManchester $ '<' : iriToStringFull id (setAngles False i) ""
++ iriToStringAbbrevMerge c ">" | 123 | true | true | 2 | 8 | 45 | 65 | 30 | 35 | null | null |
melted/idris-java | src/IRTS/Java/JTypes.hs | bsd-3-clause | idrisTailCallClosureType :: J.Type
idrisTailCallClosureType =
RefType . ClassRefType $ ClassType [(Ident "TailCallClosure", [])] | 130 | idrisTailCallClosureType :: J.Type
idrisTailCallClosureType =
RefType . ClassRefType $ ClassType [(Ident "TailCallClosure", [])] | 130 | idrisTailCallClosureType =
RefType . ClassRefType $ ClassType [(Ident "TailCallClosure", [])] | 95 | false | true | 1 | 9 | 14 | 39 | 20 | 19 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Protocol.hs | bsd-3-clause | parseQueryResult (IfThenElseUnitI8 _ _ _) (IfThenElseI8Reply r) = Just $ ExprRight $ lit r | 90 | parseQueryResult (IfThenElseUnitI8 _ _ _) (IfThenElseI8Reply r) = Just $ ExprRight $ lit r | 90 | parseQueryResult (IfThenElseUnitI8 _ _ _) (IfThenElseI8Reply r) = Just $ ExprRight $ lit r | 90 | false | false | 0 | 7 | 13 | 38 | 18 | 20 | null | null |
WraithM/HTeapots | src/ObjFile.hs | gpl-3.0 | isFace _ = False | 23 | isFace _ = False | 23 | isFace _ = False | 23 | false | false | 0 | 5 | 10 | 9 | 4 | 5 | null | null |
apriori/accelerate-raytracer | raytracer.hs | gpl-2.0 | calcPixels :: Scene -> Exp VecF -> Acc (Array DIM2 Index) -> Acc (Array DIM2 VecF)
calcPixels s eye idx = let
rays = A.map (constructRay s eye) idx
in
traceAll rays s | 248 | calcPixels :: Scene -> Exp VecF -> Acc (Array DIM2 Index) -> Acc (Array DIM2 VecF)
calcPixels s eye idx = let
rays = A.map (constructRay s eye) idx
in
traceAll rays s | 248 | calcPixels s eye idx = let
rays = A.map (constructRay s eye) idx
in
traceAll rays s | 165 | false | true | 0 | 11 | 114 | 86 | 40 | 46 | null | null |
JoseD92/EasyGL | src/EasyGL/Camera.hs | bsd-3-clause | setYawPitchRoll :: GLdouble -> GLdouble -> GLdouble -> Camera3D -> Camera3D
setYawPitchRoll yaw picth roll (Camera3D _ x y z fovy aspect zNear zFar) = Camera3D newMat x y z fovy aspect zNear zFar
where
newMat = yawPicthRollMatrix yaw picth roll
-- | Sets camera position (x,y,z) | 290 | setYawPitchRoll :: GLdouble -> GLdouble -> GLdouble -> Camera3D -> Camera3D
setYawPitchRoll yaw picth roll (Camera3D _ x y z fovy aspect zNear zFar) = Camera3D newMat x y z fovy aspect zNear zFar
where
newMat = yawPicthRollMatrix yaw picth roll
-- | Sets camera position (x,y,z) | 289 | setYawPitchRoll yaw picth roll (Camera3D _ x y z fovy aspect zNear zFar) = Camera3D newMat x y z fovy aspect zNear zFar
where
newMat = yawPicthRollMatrix yaw picth roll
-- | Sets camera position (x,y,z) | 213 | false | true | 0 | 8 | 58 | 89 | 44 | 45 | null | null |
philippos2/ticktacktoe | src/Lib.hs | bsd-3-clause | usersTurn :: StateT Board IO Int
usersTurn = do
liftIO $ putStrLn "your turn (quit: q): "
board <- get
position <- liftIO $ getPosition board
updateBoard Nought position >> return position
where
getPosition board = do
input <- getLine
case input of
"q" -> exitSuccess
input
| filter Char.isAlpha input == "" -> putStrLn "wrong input" >> getPosition board
| filter Char.isNumber input == "" -> putStrLn "wrong input" >> getPosition board
otherwise -> do
let position = transPosition input board
if elem position . Map.keys $ Map.filter (== Blank) board
then return position
else putStrLn "wrong input" >> getPosition board
transPosition input board = do
let c = Maybe.fromMaybe 0 $ List.elemIndex (head $ filter Char.isAlpha input) ['a'..]
let r = Maybe.fromMaybe 0 $ List.elemIndex (head $ filter Char.isNumber input) ['0'..]
let index = r * sizeof board + (c + mod r (sizeof board))
if index > length board
then length board
else Maybe.fromMaybe 0 $ Map.lookupIndex index board
{------------------------------------------------
CPU側ターン
------------------------------------------------} | 1,252 | usersTurn :: StateT Board IO Int
usersTurn = do
liftIO $ putStrLn "your turn (quit: q): "
board <- get
position <- liftIO $ getPosition board
updateBoard Nought position >> return position
where
getPosition board = do
input <- getLine
case input of
"q" -> exitSuccess
input
| filter Char.isAlpha input == "" -> putStrLn "wrong input" >> getPosition board
| filter Char.isNumber input == "" -> putStrLn "wrong input" >> getPosition board
otherwise -> do
let position = transPosition input board
if elem position . Map.keys $ Map.filter (== Blank) board
then return position
else putStrLn "wrong input" >> getPosition board
transPosition input board = do
let c = Maybe.fromMaybe 0 $ List.elemIndex (head $ filter Char.isAlpha input) ['a'..]
let r = Maybe.fromMaybe 0 $ List.elemIndex (head $ filter Char.isNumber input) ['0'..]
let index = r * sizeof board + (c + mod r (sizeof board))
if index > length board
then length board
else Maybe.fromMaybe 0 $ Map.lookupIndex index board
{------------------------------------------------
CPU側ターン
------------------------------------------------} | 1,252 | usersTurn = do
liftIO $ putStrLn "your turn (quit: q): "
board <- get
position <- liftIO $ getPosition board
updateBoard Nought position >> return position
where
getPosition board = do
input <- getLine
case input of
"q" -> exitSuccess
input
| filter Char.isAlpha input == "" -> putStrLn "wrong input" >> getPosition board
| filter Char.isNumber input == "" -> putStrLn "wrong input" >> getPosition board
otherwise -> do
let position = transPosition input board
if elem position . Map.keys $ Map.filter (== Blank) board
then return position
else putStrLn "wrong input" >> getPosition board
transPosition input board = do
let c = Maybe.fromMaybe 0 $ List.elemIndex (head $ filter Char.isAlpha input) ['a'..]
let r = Maybe.fromMaybe 0 $ List.elemIndex (head $ filter Char.isNumber input) ['0'..]
let index = r * sizeof board + (c + mod r (sizeof board))
if index > length board
then length board
else Maybe.fromMaybe 0 $ Map.lookupIndex index board
{------------------------------------------------
CPU側ターン
------------------------------------------------} | 1,219 | false | true | 0 | 15 | 330 | 396 | 182 | 214 | null | null |
acfoltzer/gitrev | src/Development/GitRev.hs | bsd-3-clause | getDotGit :: IO FilePath
getDotGit = do
pwd <- getGitRoot
let dotGit = pwd </> ".git"
oops = return dotGit -- it's gonna fail, that's fine
isDir <- doesDirectoryExist dotGit
isFile <- doesFileExist dotGit
if | isDir -> return dotGit
| not isFile -> oops
| isFile ->
splitAt 8 `fmap` readFile dotGit >>= \case
("gitdir: ", relDir) -> do
isRelDir <- doesDirectoryExist relDir
if isRelDir
then return relDir
else oops
_ -> oops
-- | Get the root directory of the Git repo. | 583 | getDotGit :: IO FilePath
getDotGit = do
pwd <- getGitRoot
let dotGit = pwd </> ".git"
oops = return dotGit -- it's gonna fail, that's fine
isDir <- doesDirectoryExist dotGit
isFile <- doesFileExist dotGit
if | isDir -> return dotGit
| not isFile -> oops
| isFile ->
splitAt 8 `fmap` readFile dotGit >>= \case
("gitdir: ", relDir) -> do
isRelDir <- doesDirectoryExist relDir
if isRelDir
then return relDir
else oops
_ -> oops
-- | Get the root directory of the Git repo. | 583 | getDotGit = do
pwd <- getGitRoot
let dotGit = pwd </> ".git"
oops = return dotGit -- it's gonna fail, that's fine
isDir <- doesDirectoryExist dotGit
isFile <- doesFileExist dotGit
if | isDir -> return dotGit
| not isFile -> oops
| isFile ->
splitAt 8 `fmap` readFile dotGit >>= \case
("gitdir: ", relDir) -> do
isRelDir <- doesDirectoryExist relDir
if isRelDir
then return relDir
else oops
_ -> oops
-- | Get the root directory of the Git repo. | 558 | false | true | 0 | 16 | 197 | 160 | 75 | 85 | null | null |
tjakway/ghcjvm | compiler/deSugar/DsArrows.hs | bsd-3-clause | dsCmd ids local_vars stack_ty res_ty (HsCmdLet (L _ binds) body) env_ids = do
let
defined_vars = mkVarSet (collectLocalBinders binds)
local_vars' = defined_vars `unionVarSet` local_vars
(core_body, _free_vars, env_ids') <- dsfixCmd ids local_vars' stack_ty res_ty body
stack_id <- newSysLocalDs stack_ty
-- build a new environment, plus the stack, using the let bindings
core_binds <- dsLocalBinds binds (buildEnvStack env_ids' stack_id)
-- match the old environment and stack against the input
core_map <- matchEnvStack env_ids stack_id core_binds
return (do_premap ids
(envStackType env_ids stack_ty)
(envStackType env_ids' stack_ty)
res_ty
core_map
core_body,
exprFreeIds core_binds `intersectVarSet` local_vars)
-- D; xs |-a ss : t
-- ----------------------------------
-- D; xs |-a do { ss } : () --> t
--
-- ---> premap (\ (env,stk) -> env) c | 1,039 | dsCmd ids local_vars stack_ty res_ty (HsCmdLet (L _ binds) body) env_ids = do
let
defined_vars = mkVarSet (collectLocalBinders binds)
local_vars' = defined_vars `unionVarSet` local_vars
(core_body, _free_vars, env_ids') <- dsfixCmd ids local_vars' stack_ty res_ty body
stack_id <- newSysLocalDs stack_ty
-- build a new environment, plus the stack, using the let bindings
core_binds <- dsLocalBinds binds (buildEnvStack env_ids' stack_id)
-- match the old environment and stack against the input
core_map <- matchEnvStack env_ids stack_id core_binds
return (do_premap ids
(envStackType env_ids stack_ty)
(envStackType env_ids' stack_ty)
res_ty
core_map
core_body,
exprFreeIds core_binds `intersectVarSet` local_vars)
-- D; xs |-a ss : t
-- ----------------------------------
-- D; xs |-a do { ss } : () --> t
--
-- ---> premap (\ (env,stk) -> env) c | 1,039 | dsCmd ids local_vars stack_ty res_ty (HsCmdLet (L _ binds) body) env_ids = do
let
defined_vars = mkVarSet (collectLocalBinders binds)
local_vars' = defined_vars `unionVarSet` local_vars
(core_body, _free_vars, env_ids') <- dsfixCmd ids local_vars' stack_ty res_ty body
stack_id <- newSysLocalDs stack_ty
-- build a new environment, plus the stack, using the let bindings
core_binds <- dsLocalBinds binds (buildEnvStack env_ids' stack_id)
-- match the old environment and stack against the input
core_map <- matchEnvStack env_ids stack_id core_binds
return (do_premap ids
(envStackType env_ids stack_ty)
(envStackType env_ids' stack_ty)
res_ty
core_map
core_body,
exprFreeIds core_binds `intersectVarSet` local_vars)
-- D; xs |-a ss : t
-- ----------------------------------
-- D; xs |-a do { ss } : () --> t
--
-- ---> premap (\ (env,stk) -> env) c | 1,039 | false | false | 0 | 12 | 309 | 196 | 97 | 99 | null | null |
qnikst/2pc-haskell | Network/TwoPhase.hs | bsd-3-clause | decoding :: (MonadIO m, Binary b) => (VoteHandler -> b -> m ()) -> VoteHandler -> ByteString -> m ()
decoding f v = maybe (decline v "unknown message") (f v) . decodeMay' | 170 | decoding :: (MonadIO m, Binary b) => (VoteHandler -> b -> m ()) -> VoteHandler -> ByteString -> m ()
decoding f v = maybe (decline v "unknown message") (f v) . decodeMay' | 170 | decoding f v = maybe (decline v "unknown message") (f v) . decodeMay' | 69 | false | true | 0 | 11 | 32 | 87 | 43 | 44 | null | null |
meiersi/bytestring | Data/ByteString/Char8.hs | bsd-3-clause | -- | 'foldl1' is a variant of 'foldl' that has no starting value
-- argument, and thus must be applied to non-empty 'ByteStrings'.
foldl1 :: (Char -> Char -> Char) -> ByteString -> Char
foldl1 f ps = w2c (B.foldl1 (\x y -> c2w (f (w2c x) (w2c y))) ps) | 251 | foldl1 :: (Char -> Char -> Char) -> ByteString -> Char
foldl1 f ps = w2c (B.foldl1 (\x y -> c2w (f (w2c x) (w2c y))) ps) | 120 | foldl1 f ps = w2c (B.foldl1 (\x y -> c2w (f (w2c x) (w2c y))) ps) | 65 | true | true | 0 | 14 | 49 | 83 | 43 | 40 | null | null |
energyflowanalysis/efa-2.1 | src/EFA/Flow/Topology/Quantity.hs | bsd-3-clause | dirFromSums :: Sums v -> Maybe Topo.StoreDir
dirFromSums sums =
case (sumIn sums, sumOut sums) of
(Nothing, Nothing) -> Nothing
(Just _, Nothing) -> Just Topo.In
(Nothing, Just _) -> Just Topo.Out
(Just _, Just _) -> error "storage cannot be both In and Out" | 285 | dirFromSums :: Sums v -> Maybe Topo.StoreDir
dirFromSums sums =
case (sumIn sums, sumOut sums) of
(Nothing, Nothing) -> Nothing
(Just _, Nothing) -> Just Topo.In
(Nothing, Just _) -> Just Topo.Out
(Just _, Just _) -> error "storage cannot be both In and Out" | 285 | dirFromSums sums =
case (sumIn sums, sumOut sums) of
(Nothing, Nothing) -> Nothing
(Just _, Nothing) -> Just Topo.In
(Nothing, Just _) -> Just Topo.Out
(Just _, Just _) -> error "storage cannot be both In and Out" | 240 | false | true | 0 | 9 | 71 | 119 | 58 | 61 | null | null |
phischu/fragnix | tests/packages/scotty/Utils.Containers.Internal.BitUtil.hs | bsd-3-clause | shiftRL, shiftLL :: Word -> Int -> Word
{--------------------------------------------------------------------
GHC: use unboxing to get @shiftRL@ inlined.
--------------------------------------------------------------------}
shiftRL (W# x) (I# i) = W# (uncheckedShiftRL# x i) | 276 | shiftRL, shiftLL :: Word -> Int -> Word
shiftRL (W# x) (I# i) = W# (uncheckedShiftRL# x i) | 90 | shiftRL (W# x) (I# i) = W# (uncheckedShiftRL# x i) | 50 | true | true | 0 | 7 | 28 | 50 | 26 | 24 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Time.LocalTime.TimeZone.hs | bsd-3-clause | -- | Get the current time-zone
getCurrentTimeZone :: IO TimeZone
getCurrentTimeZone = getCurrentTime >>= getTimeZone | 116 | getCurrentTimeZone :: IO TimeZone
getCurrentTimeZone = getCurrentTime >>= getTimeZone | 85 | getCurrentTimeZone = getCurrentTime >>= getTimeZone | 51 | true | true | 0 | 5 | 14 | 19 | 10 | 9 | null | null |
dalaing/type-systems | src/Fragment/PtWild/Rules/Type/Infer/Common.hs | bsd-3-clause | ptWildInferTypeInput :: PtWildInferTypeConstraint e w s r m ki ty pt tm a i
=> Proxy (MonadProxy e w s r m)
-> Proxy i
-> InferTypeInput e w s r m (InferTypeMonad m ki ty a i) ki ty pt tm a
ptWildInferTypeInput m i =
InferTypeInput [] [] [ PCheckBase $ checkWild m i ] | 333 | ptWildInferTypeInput :: PtWildInferTypeConstraint e w s r m ki ty pt tm a i
=> Proxy (MonadProxy e w s r m)
-> Proxy i
-> InferTypeInput e w s r m (InferTypeMonad m ki ty a i) ki ty pt tm a
ptWildInferTypeInput m i =
InferTypeInput [] [] [ PCheckBase $ checkWild m i ] | 333 | ptWildInferTypeInput m i =
InferTypeInput [] [] [ PCheckBase $ checkWild m i ] | 80 | false | true | 0 | 10 | 121 | 131 | 63 | 68 | null | null |
snoyberg/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | randomGenClassName = clsQual rANDOM (fsLit "RandomGen") randomGenClassKey | 78 | randomGenClassName = clsQual rANDOM (fsLit "RandomGen") randomGenClassKey | 78 | randomGenClassName = clsQual rANDOM (fsLit "RandomGen") randomGenClassKey | 78 | false | false | 0 | 7 | 11 | 19 | 9 | 10 | null | null |
m-schmidt/Asm6502 | src/AsmParser.hs | bsd-3-clause | asmLabels :: Parser [Statement]
asmLabels = many (try oneLabel)
where
oneLabel = do
l <- lexeme identifier
_ <- lexeme (char ':') <?> "label designator"
return $ Label (map toLower l)
-- |Parser for assembler statements which may be directives or instructions | 285 | asmLabels :: Parser [Statement]
asmLabels = many (try oneLabel)
where
oneLabel = do
l <- lexeme identifier
_ <- lexeme (char ':') <?> "label designator"
return $ Label (map toLower l)
-- |Parser for assembler statements which may be directives or instructions | 285 | asmLabels = many (try oneLabel)
where
oneLabel = do
l <- lexeme identifier
_ <- lexeme (char ':') <?> "label designator"
return $ Label (map toLower l)
-- |Parser for assembler statements which may be directives or instructions | 253 | false | true | 0 | 11 | 67 | 83 | 39 | 44 | null | null |
fmthoma/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | charTyConName, charDataConName, intTyConName, intDataConName :: Name
charTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Char") charTyConKey charTyCon | 168 | charTyConName, charDataConName, intTyConName, intDataConName :: Name
charTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Char") charTyConKey charTyCon | 168 | charTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "Char") charTyConKey charTyCon | 99 | false | true | 0 | 7 | 20 | 34 | 20 | 14 | null | null |
Teaspot-Studio/gore-and-ash | src/Game/GoreAndAsh/Core/Monad.hs | bsd-3-clause | processAsyncEvents :: EventChannel Spider -> FireCommand Spider (SpiderHost Global) -> IO ()
processAsyncEvents events fireCommand = void . forkIO . forever $ do
ers <- readChan events
_ <- runSpiderHost $ do
mes <- liftIO $ forM ers $ \(EventTriggerRef er :=> TriggerInvocation a _) -> do
me <- readIORef er
pure $ (\e -> e :=> Identity a) <$> me
triggerFires mes fireCommand
liftIO $ forM_ ers $ \(_ :=> TriggerInvocation _ cb) -> cb
pure ()
where
triggerFires mes (FireCommand fire) = void $ fire (catMaybes mes) $ pure ()
-- | Enumeration of type classes that 'MonadGame' should implement | 629 | processAsyncEvents :: EventChannel Spider -> FireCommand Spider (SpiderHost Global) -> IO ()
processAsyncEvents events fireCommand = void . forkIO . forever $ do
ers <- readChan events
_ <- runSpiderHost $ do
mes <- liftIO $ forM ers $ \(EventTriggerRef er :=> TriggerInvocation a _) -> do
me <- readIORef er
pure $ (\e -> e :=> Identity a) <$> me
triggerFires mes fireCommand
liftIO $ forM_ ers $ \(_ :=> TriggerInvocation _ cb) -> cb
pure ()
where
triggerFires mes (FireCommand fire) = void $ fire (catMaybes mes) $ pure ()
-- | Enumeration of type classes that 'MonadGame' should implement | 629 | processAsyncEvents events fireCommand = void . forkIO . forever $ do
ers <- readChan events
_ <- runSpiderHost $ do
mes <- liftIO $ forM ers $ \(EventTriggerRef er :=> TriggerInvocation a _) -> do
me <- readIORef er
pure $ (\e -> e :=> Identity a) <$> me
triggerFires mes fireCommand
liftIO $ forM_ ers $ \(_ :=> TriggerInvocation _ cb) -> cb
pure ()
where
triggerFires mes (FireCommand fire) = void $ fire (catMaybes mes) $ pure ()
-- | Enumeration of type classes that 'MonadGame' should implement | 536 | false | true | 0 | 22 | 138 | 238 | 111 | 127 | null | null |
zjhmale/HMF | src/Ranked/Env.hs | bsd-3-clause | tcList :: T
tcList = TConst "list" | 34 | tcList :: T
tcList = TConst "list" | 34 | tcList = TConst "list" | 22 | false | true | 0 | 6 | 6 | 20 | 8 | 12 | null | null |
markus-git/PBKDF2 | src/Soft.hs | bsd-3-clause | (|<<|) :: (SType' a, Bits a) => SExp a -> SWord32 -> SExp a
(|<<|) = rotateL | 76 | (|<<|) :: (SType' a, Bits a) => SExp a -> SWord32 -> SExp a
(|<<|) = rotateL | 76 | (|<<|) = rotateL | 16 | false | true | 0 | 8 | 16 | 44 | 24 | 20 | null | null |
AlexanderPankiv/ghc | compiler/coreSyn/CoreSeq.hs | bsd-3-clause | seqExpr (Cast e co) = seqExpr e `seq` seqCo co | 50 | seqExpr (Cast e co) = seqExpr e `seq` seqCo co | 50 | seqExpr (Cast e co) = seqExpr e `seq` seqCo co | 50 | false | false | 0 | 7 | 13 | 29 | 14 | 15 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_2 (196#) = happyShift action_72 | 38 | action_2 (196#) = happyShift action_72 | 38 | action_2 (196#) = happyShift action_72 | 38 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
mithrandi/advent2016 | Day18.hs | mit | showTile Trap = '^' | 19 | showTile Trap = '^' | 19 | showTile Trap = '^' | 19 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
diekmann/Iptables_Semantics | haskell_tool/lib/Network/RTbl/Parser.hs | bsd-2-clause | parseMetric :: Isabelle.Len a => Parsec String s (Routing_rule a -> Routing_rule a)
parseMetric = do
lit "metric"
skipWS
metric_update . const . Isabelle.nat_of_integer <$> nat | 188 | parseMetric :: Isabelle.Len a => Parsec String s (Routing_rule a -> Routing_rule a)
parseMetric = do
lit "metric"
skipWS
metric_update . const . Isabelle.nat_of_integer <$> nat | 188 | parseMetric = do
lit "metric"
skipWS
metric_update . const . Isabelle.nat_of_integer <$> nat | 104 | false | true | 0 | 9 | 37 | 66 | 30 | 36 | null | null |
AndreasPK/stack | src/Stack/Setup/Installed.hs | bsd-3-clause | unmarkInstalled :: (MonadIO m, MonadCatch m)
=> Path Abs Dir
-> Tool
-> m ()
unmarkInstalled programsPath tool = do
fpRel <- parseRelFile $ toolString tool ++ ".installed"
ignoringAbsence (removeFile $ programsPath </> fpRel) | 281 | unmarkInstalled :: (MonadIO m, MonadCatch m)
=> Path Abs Dir
-> Tool
-> m ()
unmarkInstalled programsPath tool = do
fpRel <- parseRelFile $ toolString tool ++ ".installed"
ignoringAbsence (removeFile $ programsPath </> fpRel) | 281 | unmarkInstalled programsPath tool = do
fpRel <- parseRelFile $ toolString tool ++ ".installed"
ignoringAbsence (removeFile $ programsPath </> fpRel) | 156 | false | true | 0 | 10 | 89 | 84 | 40 | 44 | null | null |
randen/haddock | haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | bsd-2-clause | -- type in ParseIface.y in GHC
pREC_CTX = 1 :: Int | 50 | pREC_CTX = 1 :: Int | 19 | pREC_CTX = 1 :: Int | 19 | true | false | 2 | 5 | 10 | 16 | 6 | 10 | null | null |
juhp/leksah | src/IDE/BufferMode.hs | gpl-2.0 | doForSelectedLines :: [a] -> (forall editor. TextEditor editor => EditorBuffer editor -> Int -> IDEM a) -> IDEM [a]
doForSelectedLines d f = inActiveBufContext d $ \_ _ ebuf currentBuffer _ -> do
(start,end) <- getStartAndEndLineOfSelection ebuf
mapM (f ebuf) [start .. end]
-- * Buffer Modes | 301 | doForSelectedLines :: [a] -> (forall editor. TextEditor editor => EditorBuffer editor -> Int -> IDEM a) -> IDEM [a]
doForSelectedLines d f = inActiveBufContext d $ \_ _ ebuf currentBuffer _ -> do
(start,end) <- getStartAndEndLineOfSelection ebuf
mapM (f ebuf) [start .. end]
-- * Buffer Modes | 301 | doForSelectedLines d f = inActiveBufContext d $ \_ _ ebuf currentBuffer _ -> do
(start,end) <- getStartAndEndLineOfSelection ebuf
mapM (f ebuf) [start .. end]
-- * Buffer Modes | 185 | false | true | 0 | 12 | 55 | 119 | 60 | 59 | null | null |
kmels/dart-haskell | examples/interpreter/GHC.Num.hs | bsd-3-clause | fib23 = fib 17 | 14 | fib23 = fib 17 | 14 | fib23 = fib 17 | 14 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
grwlf/cake3 | src/Development/Cake3.hs | bsd-3-clause | -- | A Generic Make monad runner. Execute the monad @mk@, provide the @output@
-- handler with Makefile encoded as a string. Note that Makefile may contain
-- rules which references the file itself by the name @makefile@. In case of
-- errors, print report to stderr and abort the execution with @fail@ call
runMakeH
:: MakeState -- ^ Result of evalMake
-> (String -> IO b) -- ^ Handler to output the file
-> IO (MakeState,b)
runMakeH ms output = do
when (not $ L.null (warnings ms)) $ do
hPutStr stderr (warnings ms)
when (not $ L.null (errors ms)) $ do
fail (errors ms)
case buildMake ms of
Left e -> fail e
Right s -> do
o <- output s
return (ms,o)
-- | A Version of @runMakeH@ returning no state | 741 | runMakeH
:: MakeState -- ^ Result of evalMake
-> (String -> IO b) -- ^ Handler to output the file
-> IO (MakeState,b)
runMakeH ms output = do
when (not $ L.null (warnings ms)) $ do
hPutStr stderr (warnings ms)
when (not $ L.null (errors ms)) $ do
fail (errors ms)
case buildMake ms of
Left e -> fail e
Right s -> do
o <- output s
return (ms,o)
-- | A Version of @runMakeH@ returning no state | 432 | runMakeH ms output = do
when (not $ L.null (warnings ms)) $ do
hPutStr stderr (warnings ms)
when (not $ L.null (errors ms)) $ do
fail (errors ms)
case buildMake ms of
Left e -> fail e
Right s -> do
o <- output s
return (ms,o)
-- | A Version of @runMakeH@ returning no state | 308 | true | true | 0 | 15 | 174 | 191 | 90 | 101 | null | null |
GaloisInc/saw-script | saw-core/src/Verifier/SAW/Term/Pretty.hs | bsd-3-clause | -- | Run a pretty-printing computation inside a context that binds zero or more
-- variables, returning the result of the computation and also the
-- pretty-printing of the context. Note: we do not use any local memoization
-- tables for the inner computation; the justification is that this function is
-- only used for printing datatypes, which we assume are not very big.
ppWithBoundCtx :: [(LocalName, Term)] -> PPM a -> PPM (SawDoc, a)
ppWithBoundCtx [] m = (mempty ,) <$> m | 479 | ppWithBoundCtx :: [(LocalName, Term)] -> PPM a -> PPM (SawDoc, a)
ppWithBoundCtx [] m = (mempty ,) <$> m | 104 | ppWithBoundCtx [] m = (mempty ,) <$> m | 38 | true | true | 0 | 8 | 82 | 60 | 35 | 25 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F22.hs | bsd-3-clause | ptr_glProgramUniform4ui64vNV :: FunPtr (GLuint -> GLint -> GLsizei -> Ptr GLuint64EXT -> IO ())
ptr_glProgramUniform4ui64vNV = unsafePerformIO $ getCommand "glProgramUniform4ui64vNV" | 182 | ptr_glProgramUniform4ui64vNV :: FunPtr (GLuint -> GLint -> GLsizei -> Ptr GLuint64EXT -> IO ())
ptr_glProgramUniform4ui64vNV = unsafePerformIO $ getCommand "glProgramUniform4ui64vNV" | 182 | ptr_glProgramUniform4ui64vNV = unsafePerformIO $ getCommand "glProgramUniform4ui64vNV" | 86 | false | true | 1 | 12 | 19 | 51 | 23 | 28 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/RedshiftClusterParameterGroupParameter.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-property-redshift-clusterparametergroup-parameter.html#cfn-redshift-clusterparametergroup-parameter-parametername
rcpgpParameterName :: Lens' RedshiftClusterParameterGroupParameter (Val Text)
rcpgpParameterName = lens _redshiftClusterParameterGroupParameterParameterName (\s a -> s { _redshiftClusterParameterGroupParameterParameterName = a }) | 414 | rcpgpParameterName :: Lens' RedshiftClusterParameterGroupParameter (Val Text)
rcpgpParameterName = lens _redshiftClusterParameterGroupParameterParameterName (\s a -> s { _redshiftClusterParameterGroupParameterParameterName = a }) | 229 | rcpgpParameterName = lens _redshiftClusterParameterGroupParameterParameterName (\s a -> s { _redshiftClusterParameterGroupParameterParameterName = a }) | 151 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
sdiehl/ghc | testsuite/tests/ghci/scripts/T16804a.hs | bsd-3-clause | testFunction _ _ = False | 24 | testFunction _ _ = False | 24 | testFunction _ _ = False | 24 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
snoyberg/ghc | compiler/types/Type.hs | bsd-3-clause | splitFunTy_maybe :: Type -> Maybe (Type, Type)
-- ^ Attempts to extract the argument and result types from a type
splitFunTy_maybe ty | Just ty' <- coreView ty = splitFunTy_maybe ty' | 182 | splitFunTy_maybe :: Type -> Maybe (Type, Type)
splitFunTy_maybe ty | Just ty' <- coreView ty = splitFunTy_maybe ty' | 115 | splitFunTy_maybe ty | Just ty' <- coreView ty = splitFunTy_maybe ty' | 68 | true | true | 0 | 9 | 30 | 51 | 23 | 28 | null | null |
ssaavedra/liquidhaskell | tests/pos/pair00.hs | bsd-3-clause | chk3 (x, ((_, y))) = liquidAssertB (x <y) | 41 | chk3 (x, ((_, y))) = liquidAssertB (x <y) | 41 | chk3 (x, ((_, y))) = liquidAssertB (x <y) | 41 | false | false | 0 | 7 | 7 | 35 | 19 | 16 | null | null |
DavidAlphaFox/ghc | compiler/basicTypes/Id.hs | bsd-3-clause | isDataConId_maybe :: Id -> Maybe DataCon
isDataConId_maybe id = case Var.idDetails id of
DataConWorkId con -> Just con
DataConWrapId con -> Just con
_ -> Nothing | 252 | isDataConId_maybe :: Id -> Maybe DataCon
isDataConId_maybe id = case Var.idDetails id of
DataConWorkId con -> Just con
DataConWrapId con -> Just con
_ -> Nothing | 252 | isDataConId_maybe id = case Var.idDetails id of
DataConWorkId con -> Just con
DataConWrapId con -> Just con
_ -> Nothing | 211 | false | true | 0 | 8 | 116 | 60 | 27 | 33 | null | null |
hvr/text | tests/Tests/Properties.hs | bsd-2-clause | t_justifyLeft k c = justifyLeft j c `eqP` (unpackS . T.justifyLeft j c)
where j = fromIntegral (k :: Word8) | 111 | t_justifyLeft k c = justifyLeft j c `eqP` (unpackS . T.justifyLeft j c)
where j = fromIntegral (k :: Word8) | 111 | t_justifyLeft k c = justifyLeft j c `eqP` (unpackS . T.justifyLeft j c)
where j = fromIntegral (k :: Word8) | 111 | false | false | 0 | 9 | 23 | 53 | 27 | 26 | null | null |
joris-r/labaskel | BRec.hs | apache-2.0 | k :: Mut -> [BNode] -> BExpression -> BExpression
k m l n@(BNegation p)
= (mutExpression m) l (BNegation p')
where p' = k m ((BNExpression n):l) p | 150 | k :: Mut -> [BNode] -> BExpression -> BExpression
k m l n@(BNegation p)
= (mutExpression m) l (BNegation p')
where p' = k m ((BNExpression n):l) p | 150 | k m l n@(BNegation p)
= (mutExpression m) l (BNegation p')
where p' = k m ((BNExpression n):l) p | 100 | false | true | 0 | 9 | 31 | 91 | 45 | 46 | null | null |
vincenthz/hs-cryptohash | Crypto/Hash/SHA512t.hs | bsd-3-clause | -- | init a context
init :: Int -> Ctx
init t = Ctx t (SHA512.init_t t) | 71 | init :: Int -> Ctx
init t = Ctx t (SHA512.init_t t) | 51 | init t = Ctx t (SHA512.init_t t) | 32 | true | true | 0 | 8 | 16 | 39 | 17 | 22 | null | null |
craigbilner/advent-of-code-2016 | day-7.hs | apache-2.0 | isABBA :: String -> Bool
isABBA [a, b, c, d] = a /= b && [a, b] == [d, c] | 73 | isABBA :: String -> Bool
isABBA [a, b, c, d] = a /= b && [a, b] == [d, c] | 73 | isABBA [a, b, c, d] = a /= b && [a, b] == [d, c] | 48 | false | true | 0 | 7 | 19 | 54 | 31 | 23 | null | null |
jtapolczai/Scratchpad | Differentiate.hs | apache-2.0 | -- sum rule
d v (f :+ g) = d v f :+ d v g | 41 | d v (f :+ g) = d v f :+ d v g | 29 | d v (f :+ g) = d v f :+ d v g | 29 | true | false | 0 | 7 | 15 | 34 | 16 | 18 | null | null |
Mahdi89/eTeak | src/ParseTree.hs | bsd-3-clause | exprPos (EnumElemExpr pos _ _) = pos | 36 | exprPos (EnumElemExpr pos _ _) = pos | 36 | exprPos (EnumElemExpr pos _ _) = pos | 36 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
gavilancomun/kakuro-haskell | Kakuro.hs | apache-2.0 | d = Down | 8 | d = Down | 8 | d = Down | 8 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
ssaavedra/liquidhaskell | src/Language/Haskell/Liquid/Desugar710/DsForeign.hs | bsd-3-clause | ret_addr_arg :: DynFlags -> (SDoc, SDoc, Type, CmmType)
ret_addr_arg dflags = (text "original_return_addr", text "void*", undefined,
typeCmmType dflags addrPrimTy) | 186 | ret_addr_arg :: DynFlags -> (SDoc, SDoc, Type, CmmType)
ret_addr_arg dflags = (text "original_return_addr", text "void*", undefined,
typeCmmType dflags addrPrimTy) | 186 | ret_addr_arg dflags = (text "original_return_addr", text "void*", undefined,
typeCmmType dflags addrPrimTy) | 130 | false | true | 0 | 6 | 41 | 53 | 29 | 24 | null | null |
snapframework/snap-templates | test/suite/Blackbox/Tests.hs | bsd-3-clause | fooHandlerConfigTest :: Test
fooHandlerConfigTest = testWithCwd "foo/handlerConfig" $ \cwd b -> do
let response = L.fromChunks [ "([\"app\"],\""
, S.pack cwd
, "/non-cabal-appdir/snaplets/foosnaplet\","
, "Just \"foosnaplet\",\"A demonstration "
, "snaplet called foo.\",\"foo\")" ]
assertEqual "" response b
------------------------------------------------------------------------------ | 525 | fooHandlerConfigTest :: Test
fooHandlerConfigTest = testWithCwd "foo/handlerConfig" $ \cwd b -> do
let response = L.fromChunks [ "([\"app\"],\""
, S.pack cwd
, "/non-cabal-appdir/snaplets/foosnaplet\","
, "Just \"foosnaplet\",\"A demonstration "
, "snaplet called foo.\",\"foo\")" ]
assertEqual "" response b
------------------------------------------------------------------------------ | 525 | fooHandlerConfigTest = testWithCwd "foo/handlerConfig" $ \cwd b -> do
let response = L.fromChunks [ "([\"app\"],\""
, S.pack cwd
, "/non-cabal-appdir/snaplets/foosnaplet\","
, "Just \"foosnaplet\",\"A demonstration "
, "snaplet called foo.\",\"foo\")" ]
assertEqual "" response b
------------------------------------------------------------------------------ | 496 | false | true | 0 | 15 | 175 | 70 | 36 | 34 | null | null |
mvr/cf | src/Math/ContinuedFraction/Simple.hs | mit | bihom (n0, _n1, n2, _n3,
d0, _d1, d2, _d3) (CF []) y = hom (n0, n2,
d0, d2) y | 126 | bihom (n0, _n1, n2, _n3,
d0, _d1, d2, _d3) (CF []) y = hom (n0, n2,
d0, d2) y | 126 | bihom (n0, _n1, n2, _n3,
d0, _d1, d2, _d3) (CF []) y = hom (n0, n2,
d0, d2) y | 126 | false | false | 1 | 8 | 67 | 65 | 36 | 29 | null | null |
bgamari/shaking-up-ghc | src/Oracles/Setting.hs | bsd-3-clause | useLibFFIForAdjustors :: Action Bool
useLibFFIForAdjustors = notM $ anyTargetArch ["i386", "x86_64"] | 100 | useLibFFIForAdjustors :: Action Bool
useLibFFIForAdjustors = notM $ anyTargetArch ["i386", "x86_64"] | 100 | useLibFFIForAdjustors = notM $ anyTargetArch ["i386", "x86_64"] | 63 | false | true | 0 | 7 | 10 | 27 | 14 | 13 | null | null |
samidarko/euler | problem036.hs | mit | toBinary :: Int -> String
toBinary x = showIntAtBase 2 intToDigit x "" | 70 | toBinary :: Int -> String
toBinary x = showIntAtBase 2 intToDigit x "" | 70 | toBinary x = showIntAtBase 2 intToDigit x "" | 44 | false | true | 0 | 5 | 12 | 27 | 13 | 14 | null | null |
haroldcarr/juno | z-no-longer-used/src/Hop/Apps/Juno/Ledger.hs | bsd-3-clause | filterById :: Natural -> HopperLog -> HopperLog
filterById i (l, ss, ts) = (l', ss', ts')
where
l' = filter (\(TransactionId i', _) -> i' == i) l
ss' = Map.filterWithKey (\k _ -> k == TransactionId i) ss
ts' = Map.filterWithKey (\k _ -> k == TransactionId i) ts | 275 | filterById :: Natural -> HopperLog -> HopperLog
filterById i (l, ss, ts) = (l', ss', ts')
where
l' = filter (\(TransactionId i', _) -> i' == i) l
ss' = Map.filterWithKey (\k _ -> k == TransactionId i) ss
ts' = Map.filterWithKey (\k _ -> k == TransactionId i) ts | 275 | filterById i (l, ss, ts) = (l', ss', ts')
where
l' = filter (\(TransactionId i', _) -> i' == i) l
ss' = Map.filterWithKey (\k _ -> k == TransactionId i) ss
ts' = Map.filterWithKey (\k _ -> k == TransactionId i) ts | 227 | false | true | 2 | 9 | 63 | 134 | 72 | 62 | null | null |
waterlink/hgo | Types.hs | mit | i64 = T.i64 | 11 | i64 = T.i64 | 11 | i64 = T.i64 | 11 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
fmapfmapfmap/amazonka | amazonka-swf/test/Test/AWS/Gen/SWF.hs | mpl-2.0 | testCountClosedWorkflowExecutionsResponse :: WorkflowExecutionCount -> TestTree
testCountClosedWorkflowExecutionsResponse = res
"CountClosedWorkflowExecutionsResponse"
"fixture/CountClosedWorkflowExecutionsResponse.proto"
sWF
(Proxy :: Proxy CountClosedWorkflowExecutions) | 288 | testCountClosedWorkflowExecutionsResponse :: WorkflowExecutionCount -> TestTree
testCountClosedWorkflowExecutionsResponse = res
"CountClosedWorkflowExecutionsResponse"
"fixture/CountClosedWorkflowExecutionsResponse.proto"
sWF
(Proxy :: Proxy CountClosedWorkflowExecutions) | 288 | testCountClosedWorkflowExecutionsResponse = res
"CountClosedWorkflowExecutionsResponse"
"fixture/CountClosedWorkflowExecutionsResponse.proto"
sWF
(Proxy :: Proxy CountClosedWorkflowExecutions) | 208 | false | true | 0 | 6 | 30 | 36 | 17 | 19 | null | null |
nushio3/Paraiso | attic/QuasiQuote/JSON.hs | bsd-3-clause | antiQuoteE :: JSON -> Maybe ExpQ
antiQuoteE (JSQuote nm) = Just $ appE (varE 'toJSON) (varE $ mkName nm) | 104 | antiQuoteE :: JSON -> Maybe ExpQ
antiQuoteE (JSQuote nm) = Just $ appE (varE 'toJSON) (varE $ mkName nm) | 104 | antiQuoteE (JSQuote nm) = Just $ appE (varE 'toJSON) (varE $ mkName nm) | 71 | false | true | 0 | 9 | 18 | 57 | 27 | 30 | null | null |
mihaimaruseac/petulant-octo-avenger | src/Globals.hs | mit | gSnapshotSize :: Int
gSnapshotSize = 1000000 | 44 | gSnapshotSize :: Int
gSnapshotSize = 1000000 | 44 | gSnapshotSize = 1000000 | 23 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
phischu/fragnix | builtins/ghc-prim/GHC.Prim.hs | bsd-3-clause | -- | Reads vector; offset in bytes.
readWord16X32OffAddr# :: Addr# -> Int# -> State# s -> (# State# s,Word16X32# #)
readWord16X32OffAddr# = readWord16X32OffAddr# | 163 | readWord16X32OffAddr# :: Addr# -> Int# -> State# s -> (# State# s,Word16X32# #)
readWord16X32OffAddr# = readWord16X32OffAddr# | 125 | readWord16X32OffAddr# = readWord16X32OffAddr# | 45 | true | true | 0 | 9 | 24 | 35 | 18 | 17 | null | null |
oldmanmike/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | andCts :: Cts -> Cts -> Cts
andCts = unionBags | 46 | andCts :: Cts -> Cts -> Cts
andCts = unionBags | 46 | andCts = unionBags | 18 | false | true | 0 | 8 | 9 | 26 | 11 | 15 | null | null |
Cahu/nbody-test | src/Lib.hs | bsd-3-clause | vertexFromBody :: Body -> [GLfloat]
vertexFromBody b = vertexFromVec (bodyPosition b) ++ [realToFrac $ bodyMass b] | 114 | vertexFromBody :: Body -> [GLfloat]
vertexFromBody b = vertexFromVec (bodyPosition b) ++ [realToFrac $ bodyMass b] | 114 | vertexFromBody b = vertexFromVec (bodyPosition b) ++ [realToFrac $ bodyMass b] | 78 | false | true | 2 | 8 | 15 | 51 | 23 | 28 | null | null |
Nathan-Fenner/New-Nickel | Scope.hs | mit | declareVariables' ((n, t) : rest) scope = declareVariables' rest $ declareVariable' n t scope | 93 | declareVariables' ((n, t) : rest) scope = declareVariables' rest $ declareVariable' n t scope | 93 | declareVariables' ((n, t) : rest) scope = declareVariables' rest $ declareVariable' n t scope | 93 | false | false | 0 | 8 | 13 | 38 | 19 | 19 | null | null |
koba-e964/hayashii-mcc | zekamashi/RegAlloc.hs | bsd-3-clause | replaceTerm term = case term of
TRet op -> TRet <$> replaceOperand op
TBr op b1 b2 -> do
repOp <- replaceOperand op
return $! TBr repOp b1 b2
TJmp _ -> return term | 177 | replaceTerm term = case term of
TRet op -> TRet <$> replaceOperand op
TBr op b1 b2 -> do
repOp <- replaceOperand op
return $! TBr repOp b1 b2
TJmp _ -> return term | 177 | replaceTerm term = case term of
TRet op -> TRet <$> replaceOperand op
TBr op b1 b2 -> do
repOp <- replaceOperand op
return $! TBr repOp b1 b2
TJmp _ -> return term | 177 | false | false | 0 | 11 | 47 | 78 | 34 | 44 | null | null |
ndmitchell/nsis | src/Development/NSIS/Plugins/WinMessages.hs | bsd-3-clause | -- Not in win3.1
sbm_SETRANGE = 0x00E2 | 53 | sbm_SETRANGE = 0x00E2 | 36 | sbm_SETRANGE = 0x00E2 | 36 | true | false | 0 | 4 | 21 | 7 | 4 | 3 | null | null |
GaloisInc/galua | galua-spec/src/Galua/Spec/CFG.hs | mit | run :: M a -> Either Error a
run (M m) =
case final m of
Left err -> Left err
Right (a,rw) ->
case curBlock rw of
Nothing -> Right a
Just (l,_) -> panic ("run: Unterminated block " ++ show l)
where
final = runId . runExceptionT . runStateT rwBlank | 284 | run :: M a -> Either Error a
run (M m) =
case final m of
Left err -> Left err
Right (a,rw) ->
case curBlock rw of
Nothing -> Right a
Just (l,_) -> panic ("run: Unterminated block " ++ show l)
where
final = runId . runExceptionT . runStateT rwBlank | 284 | run (M m) =
case final m of
Left err -> Left err
Right (a,rw) ->
case curBlock rw of
Nothing -> Right a
Just (l,_) -> panic ("run: Unterminated block " ++ show l)
where
final = runId . runExceptionT . runStateT rwBlank | 255 | false | true | 1 | 14 | 88 | 136 | 62 | 74 | null | null |
RefactoringTools/HaRe | test/testdata/TypeUtils/VisiblePNs.hs | bsd-3-clause | getModuleName= undefined | 24 | getModuleName= undefined | 24 | getModuleName= undefined | 24 | false | false | 0 | 4 | 1 | 6 | 3 | 3 | null | null |
zjhmale/Ntha | src/Ntha/Core/Prelude.hs | bsd-3-clause | builtins :: ValueScope
builtins = ValueScope Nothing $
M.fromList [("+", binFn (\(VNum a) (VNum b) -> (VNum $ a + b))),
("-", binFn (\(VNum a) (VNum b) -> (VNum $ a - b))),
("*", binFn (\(VNum a) (VNum b) -> (VNum $ a * b))),
("/", binFn (\(VNum a) (VNum b) -> (VNum $ a `div` b))),
("%", binFn (\(VNum a) (VNum b) -> (VNum $ a `mod` b))),
("=", binFn (\a b -> VBool $ a == b)),
("≠", binFn (\a b -> VBool $ a /= b)),
("<", binFn (\a b -> VBool $ a < b)),
(">", binFn (\a b -> VBool $ a > b)),
("≤", binFn (\a b -> VBool $ a <= b)),
("≥", binFn (\a b -> VBool $ a >= b)),
("∧", binFn (\(VBool a) (VBool b) -> VBool $ a && b)),
("∨", binFn (\(VBool a) (VBool b) -> VBool $ a || b)),
("¬", Fn (\(VBool b) _ -> VBool $ not b)),
("int2str", Fn (\(VNum n) _ -> strV $ show n)),
("bool2str", Fn (\(VBool b) _ -> strV $ show b)),
("asserteq", binFn (\a b -> if a == b
then VUnit
else error $ show a ++ " and " ++ show b ++ " not equal.")),
("print", Fn (\v _ -> trace (desugerStrV v) VUnit)),
("error", Fn (\v _ -> error $ desugerStrV v)),
("reverse", Fn (\v _ -> reverseList v)),
("list?", Fn (\v _ -> case v of
Adt "Cons" _ -> VBool True
_ -> VBool False)),
("string?", Fn (\v _ -> VBool $ isString v)),
("Cons", binFn (\a b -> cons a b)),
("Nil", nil),
("inc", Fn (\(VNum n) _ -> VNum $ n + 1)),
("dec", Fn (\(VNum n) _ -> VNum $ n - 1))] | 1,842 | builtins :: ValueScope
builtins = ValueScope Nothing $
M.fromList [("+", binFn (\(VNum a) (VNum b) -> (VNum $ a + b))),
("-", binFn (\(VNum a) (VNum b) -> (VNum $ a - b))),
("*", binFn (\(VNum a) (VNum b) -> (VNum $ a * b))),
("/", binFn (\(VNum a) (VNum b) -> (VNum $ a `div` b))),
("%", binFn (\(VNum a) (VNum b) -> (VNum $ a `mod` b))),
("=", binFn (\a b -> VBool $ a == b)),
("≠", binFn (\a b -> VBool $ a /= b)),
("<", binFn (\a b -> VBool $ a < b)),
(">", binFn (\a b -> VBool $ a > b)),
("≤", binFn (\a b -> VBool $ a <= b)),
("≥", binFn (\a b -> VBool $ a >= b)),
("∧", binFn (\(VBool a) (VBool b) -> VBool $ a && b)),
("∨", binFn (\(VBool a) (VBool b) -> VBool $ a || b)),
("¬", Fn (\(VBool b) _ -> VBool $ not b)),
("int2str", Fn (\(VNum n) _ -> strV $ show n)),
("bool2str", Fn (\(VBool b) _ -> strV $ show b)),
("asserteq", binFn (\a b -> if a == b
then VUnit
else error $ show a ++ " and " ++ show b ++ " not equal.")),
("print", Fn (\v _ -> trace (desugerStrV v) VUnit)),
("error", Fn (\v _ -> error $ desugerStrV v)),
("reverse", Fn (\v _ -> reverseList v)),
("list?", Fn (\v _ -> case v of
Adt "Cons" _ -> VBool True
_ -> VBool False)),
("string?", Fn (\v _ -> VBool $ isString v)),
("Cons", binFn (\a b -> cons a b)),
("Nil", nil),
("inc", Fn (\(VNum n) _ -> VNum $ n + 1)),
("dec", Fn (\(VNum n) _ -> VNum $ n - 1))] | 1,842 | builtins = ValueScope Nothing $
M.fromList [("+", binFn (\(VNum a) (VNum b) -> (VNum $ a + b))),
("-", binFn (\(VNum a) (VNum b) -> (VNum $ a - b))),
("*", binFn (\(VNum a) (VNum b) -> (VNum $ a * b))),
("/", binFn (\(VNum a) (VNum b) -> (VNum $ a `div` b))),
("%", binFn (\(VNum a) (VNum b) -> (VNum $ a `mod` b))),
("=", binFn (\a b -> VBool $ a == b)),
("≠", binFn (\a b -> VBool $ a /= b)),
("<", binFn (\a b -> VBool $ a < b)),
(">", binFn (\a b -> VBool $ a > b)),
("≤", binFn (\a b -> VBool $ a <= b)),
("≥", binFn (\a b -> VBool $ a >= b)),
("∧", binFn (\(VBool a) (VBool b) -> VBool $ a && b)),
("∨", binFn (\(VBool a) (VBool b) -> VBool $ a || b)),
("¬", Fn (\(VBool b) _ -> VBool $ not b)),
("int2str", Fn (\(VNum n) _ -> strV $ show n)),
("bool2str", Fn (\(VBool b) _ -> strV $ show b)),
("asserteq", binFn (\a b -> if a == b
then VUnit
else error $ show a ++ " and " ++ show b ++ " not equal.")),
("print", Fn (\v _ -> trace (desugerStrV v) VUnit)),
("error", Fn (\v _ -> error $ desugerStrV v)),
("reverse", Fn (\v _ -> reverseList v)),
("list?", Fn (\v _ -> case v of
Adt "Cons" _ -> VBool True
_ -> VBool False)),
("string?", Fn (\v _ -> VBool $ isString v)),
("Cons", binFn (\a b -> cons a b)),
("Nil", nil),
("inc", Fn (\(VNum n) _ -> VNum $ n + 1)),
("dec", Fn (\(VNum n) _ -> VNum $ n - 1))] | 1,819 | false | true | 0 | 17 | 801 | 950 | 525 | 425 | null | null |
meiersi-11ce/stack | src/Stack/Types/StackT.hs | bsd-3-clause | getCanUseUnicode :: IO Bool
getCanUseUnicode = do
let enc = localeEncoding
str = "\x2018\x2019"
test = withCString enc str $ \cstr -> do
str' <- peekCString enc cstr
return (str == str')
test `catchIOError` \_ -> return False
--------------------------------------------------------------------------------
-- Logging only StackLoggingT monad transformer
-- | Monadic environment for 'StackLoggingT'. | 450 | getCanUseUnicode :: IO Bool
getCanUseUnicode = do
let enc = localeEncoding
str = "\x2018\x2019"
test = withCString enc str $ \cstr -> do
str' <- peekCString enc cstr
return (str == str')
test `catchIOError` \_ -> return False
--------------------------------------------------------------------------------
-- Logging only StackLoggingT monad transformer
-- | Monadic environment for 'StackLoggingT'. | 450 | getCanUseUnicode = do
let enc = localeEncoding
str = "\x2018\x2019"
test = withCString enc str $ \cstr -> do
str' <- peekCString enc cstr
return (str == str')
test `catchIOError` \_ -> return False
--------------------------------------------------------------------------------
-- Logging only StackLoggingT monad transformer
-- | Monadic environment for 'StackLoggingT'. | 422 | false | true | 0 | 16 | 100 | 92 | 47 | 45 | null | null |
robstewart57/stack | src/Stack/Build/Execute.hs | bsd-3-clause | singleBench :: M env m
=> (m () -> IO ())
-> BenchmarkOpts
-> LocalPackageTB
-> ActionContext
-> ExecuteEnv
-> Task
-> InstalledMap
-> m ()
singleBench runInBase beopts _lptb ac ee task installedMap = do
(allDepsMap, cache) <- getConfigCache ee task $
case taskType task of
TTLocal lp -> concat
[ ["--enable-tests" | depsPresent installedMap $ lpTestDeps lp]
, ["--enable-benchmarks"]
]
_ -> []
withSingleContext runInBase ac ee task (Just allDepsMap) (Just "bench") $ \_package cabalfp pkgDir cabal announce console _mlogFile -> do
neededConfig <- ensureConfig cache pkgDir ee (announce "configure (benchmarks)") cabal cabalfp
benchBuilt <- checkBenchBuilt pkgDir
let needBuild = neededConfig ||
(case taskType task of
TTLocal lp -> lpDirtyFiles lp
_ -> assert False True) ||
not benchBuilt
when needBuild $ do
announce "build (benchmarks)"
unsetBenchBuilt pkgDir
case taskType task of
TTLocal lp -> writeBuildCache pkgDir $ lpNewBuildCache lp
TTUpstream _ _ -> assert False $ return ()
config <- asks getConfig
extraOpts <- extraBuildOptions (eeBuildOpts ee)
cabal (console && configHideTHLoading config) ("build" : extraOpts)
setBenchBuilt pkgDir
let args = maybe []
((:[]) . ("--benchmark-options=" <>))
(beoAdditionalArgs beopts)
toRun <-
if beoDisableRun beopts
then do
announce "Benchmark running disabled by --no-run-benchmarks flag."
return False
else do
return True
when toRun $ do
announce "benchmarks"
cabal False ("bench" : args)
-- | Grab all output from the given @Handle@ and print it to stdout, stripping
-- Template Haskell "Loading package" lines. Does work in a separate thread. | 2,195 | singleBench :: M env m
=> (m () -> IO ())
-> BenchmarkOpts
-> LocalPackageTB
-> ActionContext
-> ExecuteEnv
-> Task
-> InstalledMap
-> m ()
singleBench runInBase beopts _lptb ac ee task installedMap = do
(allDepsMap, cache) <- getConfigCache ee task $
case taskType task of
TTLocal lp -> concat
[ ["--enable-tests" | depsPresent installedMap $ lpTestDeps lp]
, ["--enable-benchmarks"]
]
_ -> []
withSingleContext runInBase ac ee task (Just allDepsMap) (Just "bench") $ \_package cabalfp pkgDir cabal announce console _mlogFile -> do
neededConfig <- ensureConfig cache pkgDir ee (announce "configure (benchmarks)") cabal cabalfp
benchBuilt <- checkBenchBuilt pkgDir
let needBuild = neededConfig ||
(case taskType task of
TTLocal lp -> lpDirtyFiles lp
_ -> assert False True) ||
not benchBuilt
when needBuild $ do
announce "build (benchmarks)"
unsetBenchBuilt pkgDir
case taskType task of
TTLocal lp -> writeBuildCache pkgDir $ lpNewBuildCache lp
TTUpstream _ _ -> assert False $ return ()
config <- asks getConfig
extraOpts <- extraBuildOptions (eeBuildOpts ee)
cabal (console && configHideTHLoading config) ("build" : extraOpts)
setBenchBuilt pkgDir
let args = maybe []
((:[]) . ("--benchmark-options=" <>))
(beoAdditionalArgs beopts)
toRun <-
if beoDisableRun beopts
then do
announce "Benchmark running disabled by --no-run-benchmarks flag."
return False
else do
return True
when toRun $ do
announce "benchmarks"
cabal False ("bench" : args)
-- | Grab all output from the given @Handle@ and print it to stdout, stripping
-- Template Haskell "Loading package" lines. Does work in a separate thread. | 2,195 | singleBench runInBase beopts _lptb ac ee task installedMap = do
(allDepsMap, cache) <- getConfigCache ee task $
case taskType task of
TTLocal lp -> concat
[ ["--enable-tests" | depsPresent installedMap $ lpTestDeps lp]
, ["--enable-benchmarks"]
]
_ -> []
withSingleContext runInBase ac ee task (Just allDepsMap) (Just "bench") $ \_package cabalfp pkgDir cabal announce console _mlogFile -> do
neededConfig <- ensureConfig cache pkgDir ee (announce "configure (benchmarks)") cabal cabalfp
benchBuilt <- checkBenchBuilt pkgDir
let needBuild = neededConfig ||
(case taskType task of
TTLocal lp -> lpDirtyFiles lp
_ -> assert False True) ||
not benchBuilt
when needBuild $ do
announce "build (benchmarks)"
unsetBenchBuilt pkgDir
case taskType task of
TTLocal lp -> writeBuildCache pkgDir $ lpNewBuildCache lp
TTUpstream _ _ -> assert False $ return ()
config <- asks getConfig
extraOpts <- extraBuildOptions (eeBuildOpts ee)
cabal (console && configHideTHLoading config) ("build" : extraOpts)
setBenchBuilt pkgDir
let args = maybe []
((:[]) . ("--benchmark-options=" <>))
(beoAdditionalArgs beopts)
toRun <-
if beoDisableRun beopts
then do
announce "Benchmark running disabled by --no-run-benchmarks flag."
return False
else do
return True
when toRun $ do
announce "benchmarks"
cabal False ("bench" : args)
-- | Grab all output from the given @Handle@ and print it to stdout, stripping
-- Template Haskell "Loading package" lines. Does work in a separate thread. | 1,959 | false | true | 0 | 20 | 835 | 539 | 249 | 290 | null | null |
rjregenold/chutes-and-ladders | Game/ChutesAndLadders/Cli.hs | mit | pSpaceB s = putStrLn $ "\n" ++ s | 32 | pSpaceB s = putStrLn $ "\n" ++ s | 32 | pSpaceB s = putStrLn $ "\n" ++ s | 32 | false | false | 0 | 6 | 7 | 17 | 8 | 9 | null | null |
brodyberg/Notes | csv/csv1/src/WorkDataKinds.hs | mit | main :: IO ()
main = do
taskOneWorker (JobOne 10)
-- taskOneWorker JobTwo
taskOneWorker (JobThree 10) | 109 | main :: IO ()
main = do
taskOneWorker (JobOne 10)
-- taskOneWorker JobTwo
taskOneWorker (JobThree 10) | 109 | main = do
taskOneWorker (JobOne 10)
-- taskOneWorker JobTwo
taskOneWorker (JobThree 10) | 95 | false | true | 0 | 9 | 23 | 41 | 19 | 22 | null | null |
ezyang/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | integralClassKey = mkPreludeClassUnique 7 | 48 | integralClassKey = mkPreludeClassUnique 7 | 48 | integralClassKey = mkPreludeClassUnique 7 | 48 | false | false | 1 | 5 | 10 | 12 | 4 | 8 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Upgrade.hs | mit | whatResearches ArgusTalisman = ProtossTemplarArchives | 53 | whatResearches ArgusTalisman = ProtossTemplarArchives | 53 | whatResearches ArgusTalisman = ProtossTemplarArchives | 53 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
KaneTW/Idris-dev | Setup.hs | bsd-3-clause | mymake = "gmake" | 16 | mymake = "gmake" | 16 | mymake = "gmake" | 16 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
urv/fixhs | src/Data/FIX/Spec/FIX41.hs | lgpl-2.1 | tLastCapacity :: FIXTag
tLastCapacity = FIXTag
{ tName = "LastCapacity"
, tnum = 29
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 164 | tLastCapacity :: FIXTag
tLastCapacity = FIXTag
{ tName = "LastCapacity"
, tnum = 29
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 164 | tLastCapacity = FIXTag
{ tName = "LastCapacity"
, tnum = 29
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 140 | false | true | 0 | 10 | 38 | 51 | 29 | 22 | null | null |
nomeata/ghc | compiler/main/DynFlags.hs | bsd-3-clause | printInfoForUser :: DynFlags -> PrintUnqualified -> SDoc -> IO ()
printInfoForUser = printSevForUser SevInfo | 108 | printInfoForUser :: DynFlags -> PrintUnqualified -> SDoc -> IO ()
printInfoForUser = printSevForUser SevInfo | 108 | printInfoForUser = printSevForUser SevInfo | 42 | false | true | 0 | 9 | 13 | 31 | 15 | 16 | null | null |
harlanhaskins/Letter | Haskell/app/REPL/Parser.hs | mit | commandExp = ((\_ -> Quit) <$> commandToken "quit" "q")
<||> importCmd
<||> describe
<||> (Eval <$> line) | 129 | commandExp = ((\_ -> Quit) <$> commandToken "quit" "q")
<||> importCmd
<||> describe
<||> (Eval <$> line) | 129 | commandExp = ((\_ -> Quit) <$> commandToken "quit" "q")
<||> importCmd
<||> describe
<||> (Eval <$> line) | 129 | false | false | 0 | 11 | 40 | 45 | 24 | 21 | null | null |
mstksg/hledger | hledger/Hledger/Cli.hs | gpl-3.0 | tests_Hledger_Cli :: Test
tests_Hledger_Cli = TestList
[
tests_Hledger
-- ,tests_Hledger_Cli_Add
,tests_Hledger_Cli_Balance
,tests_Hledger_Cli_Balancesheet
,tests_Hledger_Cli_Cashflow
-- ,tests_Hledger_Cli_Histogram
,tests_Hledger_Cli_Incomestatement
,tests_Hledger_Cli_CliOptions
-- ,tests_Hledger_Cli_Print
,tests_Hledger_Cli_Register
-- ,tests_Hledger_Cli_Stats
,"apply account directive" ~:
let ignoresourcepos j = j{jtxns=map (\t -> t{tsourcepos=nullsourcepos}) (jtxns j)} in
let sameParse str1 str2 = do j1 <- readJournal Nothing Nothing True Nothing str1 >>= either error' (return . ignoresourcepos)
j2 <- readJournal Nothing Nothing True Nothing str2 >>= either error' (return . ignoresourcepos)
j1 `is` j2{jlastreadtime=jlastreadtime j1, jfiles=jfiles j1} --, jparsestate=jparsestate j1}
in sameParse
("2008/12/07 One\n alpha $-1\n beta $1\n" <>
"apply account outer\n2008/12/07 Two\n aigh $-2\n bee $2\n" <>
"apply account inner\n2008/12/07 Three\n gamma $-3\n delta $3\n" <>
"end apply account\n2008/12/07 Four\n why $-4\n zed $4\n" <>
"end apply account\n2008/12/07 Five\n foo $-5\n bar $5\n"
)
("2008/12/07 One\n alpha $-1\n beta $1\n" <>
"2008/12/07 Two\n outer:aigh $-2\n outer:bee $2\n" <>
"2008/12/07 Three\n outer:inner:gamma $-3\n outer:inner:delta $3\n" <>
"2008/12/07 Four\n outer:why $-4\n outer:zed $4\n" <>
"2008/12/07 Five\n foo $-5\n bar $5\n"
)
,"apply account directive should preserve \"virtual\" posting type" ~: do
j <- readJournal Nothing Nothing True Nothing "apply account test\n2008/12/07 One\n (from) $-1\n (to) $1\n" >>= either error' return
let p = head $ tpostings $ head $ jtxns j
assertBool "" $ paccount p == "test:from"
assertBool "" $ ptype p == VirtualPosting
,"account aliases" ~: do
j <- readJournal Nothing Nothing True Nothing "!alias expenses = equity:draw:personal\n1/1\n (expenses:food) 1\n" >>= either error' return
let p = head $ tpostings $ head $ jtxns j
assertBool "" $ paccount p == "equity:draw:personal:food"
,"ledgerAccountNames" ~:
ledgerAccountNames ledger7 `is`
["assets","assets:cash","assets:checking","assets:saving","equity","equity:opening balances",
"expenses","expenses:food","expenses:food:dining","expenses:phone","expenses:vacation",
"liabilities","liabilities:credit cards","liabilities:credit cards:discover"]
-- ,"journalCanonicaliseAmounts" ~:
-- "use the greatest precision" ~:
-- (map asprecision $ journalAmountAndPriceCommodities $ journalCanonicaliseAmounts $ journalWithAmounts ["1","2.00"]) `is` [2,2]
-- don't know what this should do
-- ,"elideAccountName" ~: do
-- (elideAccountName 50 "aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa"
-- `is` "aa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa")
-- (elideAccountName 20 "aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa"
-- `is` "aa:aa:aaaaaaaaaaaaaa")
,"default year" ~: do
j <- readJournal Nothing Nothing True Nothing defaultyear_journal_txt >>= either error' return
tdate (head $ jtxns j) `is` fromGregorian 2009 1 1
return ()
,"show dollars" ~: showAmount (usd 1) ~?= "$1.00"
,"show hours" ~: showAmount (hrs 1) ~?= "1.00h"
] | 3,733 | tests_Hledger_Cli :: Test
tests_Hledger_Cli = TestList
[
tests_Hledger
-- ,tests_Hledger_Cli_Add
,tests_Hledger_Cli_Balance
,tests_Hledger_Cli_Balancesheet
,tests_Hledger_Cli_Cashflow
-- ,tests_Hledger_Cli_Histogram
,tests_Hledger_Cli_Incomestatement
,tests_Hledger_Cli_CliOptions
-- ,tests_Hledger_Cli_Print
,tests_Hledger_Cli_Register
-- ,tests_Hledger_Cli_Stats
,"apply account directive" ~:
let ignoresourcepos j = j{jtxns=map (\t -> t{tsourcepos=nullsourcepos}) (jtxns j)} in
let sameParse str1 str2 = do j1 <- readJournal Nothing Nothing True Nothing str1 >>= either error' (return . ignoresourcepos)
j2 <- readJournal Nothing Nothing True Nothing str2 >>= either error' (return . ignoresourcepos)
j1 `is` j2{jlastreadtime=jlastreadtime j1, jfiles=jfiles j1} --, jparsestate=jparsestate j1}
in sameParse
("2008/12/07 One\n alpha $-1\n beta $1\n" <>
"apply account outer\n2008/12/07 Two\n aigh $-2\n bee $2\n" <>
"apply account inner\n2008/12/07 Three\n gamma $-3\n delta $3\n" <>
"end apply account\n2008/12/07 Four\n why $-4\n zed $4\n" <>
"end apply account\n2008/12/07 Five\n foo $-5\n bar $5\n"
)
("2008/12/07 One\n alpha $-1\n beta $1\n" <>
"2008/12/07 Two\n outer:aigh $-2\n outer:bee $2\n" <>
"2008/12/07 Three\n outer:inner:gamma $-3\n outer:inner:delta $3\n" <>
"2008/12/07 Four\n outer:why $-4\n outer:zed $4\n" <>
"2008/12/07 Five\n foo $-5\n bar $5\n"
)
,"apply account directive should preserve \"virtual\" posting type" ~: do
j <- readJournal Nothing Nothing True Nothing "apply account test\n2008/12/07 One\n (from) $-1\n (to) $1\n" >>= either error' return
let p = head $ tpostings $ head $ jtxns j
assertBool "" $ paccount p == "test:from"
assertBool "" $ ptype p == VirtualPosting
,"account aliases" ~: do
j <- readJournal Nothing Nothing True Nothing "!alias expenses = equity:draw:personal\n1/1\n (expenses:food) 1\n" >>= either error' return
let p = head $ tpostings $ head $ jtxns j
assertBool "" $ paccount p == "equity:draw:personal:food"
,"ledgerAccountNames" ~:
ledgerAccountNames ledger7 `is`
["assets","assets:cash","assets:checking","assets:saving","equity","equity:opening balances",
"expenses","expenses:food","expenses:food:dining","expenses:phone","expenses:vacation",
"liabilities","liabilities:credit cards","liabilities:credit cards:discover"]
-- ,"journalCanonicaliseAmounts" ~:
-- "use the greatest precision" ~:
-- (map asprecision $ journalAmountAndPriceCommodities $ journalCanonicaliseAmounts $ journalWithAmounts ["1","2.00"]) `is` [2,2]
-- don't know what this should do
-- ,"elideAccountName" ~: do
-- (elideAccountName 50 "aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa"
-- `is` "aa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa")
-- (elideAccountName 20 "aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa"
-- `is` "aa:aa:aaaaaaaaaaaaaa")
,"default year" ~: do
j <- readJournal Nothing Nothing True Nothing defaultyear_journal_txt >>= either error' return
tdate (head $ jtxns j) `is` fromGregorian 2009 1 1
return ()
,"show dollars" ~: showAmount (usd 1) ~?= "$1.00"
,"show hours" ~: showAmount (hrs 1) ~?= "1.00h"
] | 3,733 | tests_Hledger_Cli = TestList
[
tests_Hledger
-- ,tests_Hledger_Cli_Add
,tests_Hledger_Cli_Balance
,tests_Hledger_Cli_Balancesheet
,tests_Hledger_Cli_Cashflow
-- ,tests_Hledger_Cli_Histogram
,tests_Hledger_Cli_Incomestatement
,tests_Hledger_Cli_CliOptions
-- ,tests_Hledger_Cli_Print
,tests_Hledger_Cli_Register
-- ,tests_Hledger_Cli_Stats
,"apply account directive" ~:
let ignoresourcepos j = j{jtxns=map (\t -> t{tsourcepos=nullsourcepos}) (jtxns j)} in
let sameParse str1 str2 = do j1 <- readJournal Nothing Nothing True Nothing str1 >>= either error' (return . ignoresourcepos)
j2 <- readJournal Nothing Nothing True Nothing str2 >>= either error' (return . ignoresourcepos)
j1 `is` j2{jlastreadtime=jlastreadtime j1, jfiles=jfiles j1} --, jparsestate=jparsestate j1}
in sameParse
("2008/12/07 One\n alpha $-1\n beta $1\n" <>
"apply account outer\n2008/12/07 Two\n aigh $-2\n bee $2\n" <>
"apply account inner\n2008/12/07 Three\n gamma $-3\n delta $3\n" <>
"end apply account\n2008/12/07 Four\n why $-4\n zed $4\n" <>
"end apply account\n2008/12/07 Five\n foo $-5\n bar $5\n"
)
("2008/12/07 One\n alpha $-1\n beta $1\n" <>
"2008/12/07 Two\n outer:aigh $-2\n outer:bee $2\n" <>
"2008/12/07 Three\n outer:inner:gamma $-3\n outer:inner:delta $3\n" <>
"2008/12/07 Four\n outer:why $-4\n outer:zed $4\n" <>
"2008/12/07 Five\n foo $-5\n bar $5\n"
)
,"apply account directive should preserve \"virtual\" posting type" ~: do
j <- readJournal Nothing Nothing True Nothing "apply account test\n2008/12/07 One\n (from) $-1\n (to) $1\n" >>= either error' return
let p = head $ tpostings $ head $ jtxns j
assertBool "" $ paccount p == "test:from"
assertBool "" $ ptype p == VirtualPosting
,"account aliases" ~: do
j <- readJournal Nothing Nothing True Nothing "!alias expenses = equity:draw:personal\n1/1\n (expenses:food) 1\n" >>= either error' return
let p = head $ tpostings $ head $ jtxns j
assertBool "" $ paccount p == "equity:draw:personal:food"
,"ledgerAccountNames" ~:
ledgerAccountNames ledger7 `is`
["assets","assets:cash","assets:checking","assets:saving","equity","equity:opening balances",
"expenses","expenses:food","expenses:food:dining","expenses:phone","expenses:vacation",
"liabilities","liabilities:credit cards","liabilities:credit cards:discover"]
-- ,"journalCanonicaliseAmounts" ~:
-- "use the greatest precision" ~:
-- (map asprecision $ journalAmountAndPriceCommodities $ journalCanonicaliseAmounts $ journalWithAmounts ["1","2.00"]) `is` [2,2]
-- don't know what this should do
-- ,"elideAccountName" ~: do
-- (elideAccountName 50 "aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa"
-- `is` "aa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa")
-- (elideAccountName 20 "aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa"
-- `is` "aa:aa:aaaaaaaaaaaaaa")
,"default year" ~: do
j <- readJournal Nothing Nothing True Nothing defaultyear_journal_txt >>= either error' return
tdate (head $ jtxns j) `is` fromGregorian 2009 1 1
return ()
,"show dollars" ~: showAmount (usd 1) ~?= "$1.00"
,"show hours" ~: showAmount (hrs 1) ~?= "1.00h"
] | 3,707 | false | true | 0 | 19 | 994 | 597 | 307 | 290 | null | null |
stevely/hspirv | src/SpirV/Builder.hs | bsd-3-clause | -- Id 1: Result type
-- Id 2: Sampler, cannot have dim of cube or buffer, no depth-comparison
-- Id 3: Texture coordinate, integer scalar or vector
-- Id 4: Level of detail to use when sampling
textureFetchTexelLod :: TypeId -> Id -> Id -> Id -> Builder Id
textureFetchTexelLod (TypeId i) = R.textureFetchTexelLod i | 315 | textureFetchTexelLod :: TypeId -> Id -> Id -> Id -> Builder Id
textureFetchTexelLod (TypeId i) = R.textureFetchTexelLod i | 121 | textureFetchTexelLod (TypeId i) = R.textureFetchTexelLod i | 58 | true | true | 0 | 12 | 54 | 52 | 26 | 26 | null | null |
hvr/jhc | lib/haskell-extras/Data/List.hs | mit | (\\) :: Eq a => [a] -> [a] -> [a]
(\\) = foldl (flip delete) | 99 | (\\) :: Eq a => [a] -> [a] -> [a]
(\\) = foldl (flip delete) | 99 | (\\) = foldl (flip delete) | 46 | false | true | 0 | 10 | 53 | 54 | 28 | 26 | null | null |
sordina/DiffLine | src/Main.hs | mit | prop_slash = testOutputSlash == onSlash testInput | 58 | prop_slash = testOutputSlash == onSlash testInput | 58 | prop_slash = testOutputSlash == onSlash testInput | 58 | false | false | 0 | 6 | 14 | 13 | 6 | 7 | null | null |
GaloisInc/msf-haskell | src/MsgPack.hs | bsd-3-clause | fixedRaw :: Word8 -> Maybe Int
fixedRaw n = do
guard (n .&. 0xe0 == 0xa0)
return (fromIntegral (n .&. 0x1f)) | 112 | fixedRaw :: Word8 -> Maybe Int
fixedRaw n = do
guard (n .&. 0xe0 == 0xa0)
return (fromIntegral (n .&. 0x1f)) | 112 | fixedRaw n = do
guard (n .&. 0xe0 == 0xa0)
return (fromIntegral (n .&. 0x1f)) | 81 | false | true | 0 | 11 | 24 | 57 | 27 | 30 | null | null |
sdiehl/ghc | compiler/parser/Ctype.hs | bsd-3-clause | is_symbol = is_ctype cSymbol | 28 | is_symbol = is_ctype cSymbol | 28 | is_symbol = is_ctype cSymbol | 28 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
nwf/grade | lib/Grade/Grade.hs | bsd-2-clause | collectErrors :: [Either e a] -> Either [e] [a]
collectErrors x = case partitionEithers x of
([], r) -> Right r
(l, _) -> Left l | 169 | collectErrors :: [Either e a] -> Either [e] [a]
collectErrors x = case partitionEithers x of
([], r) -> Right r
(l, _) -> Left l | 169 | collectErrors x = case partitionEithers x of
([], r) -> Right r
(l, _) -> Left l | 121 | false | true | 0 | 9 | 66 | 80 | 40 | 40 | null | null |
dalaing/type-systems | src/Fragment/Tuple/Rules/Term.hs | bsd-3-clause | stepTupleIxLazy :: AsTmTuple ki ty pt tm => Term ki ty pt tm a -> Maybe (Term ki ty pt tm a)
stepTupleIxLazy tm = do
(tmT ,i) <- preview _TmTupleIx tm
tms <- preview _TmTuple tmT
return $ tms !! i | 202 | stepTupleIxLazy :: AsTmTuple ki ty pt tm => Term ki ty pt tm a -> Maybe (Term ki ty pt tm a)
stepTupleIxLazy tm = do
(tmT ,i) <- preview _TmTupleIx tm
tms <- preview _TmTuple tmT
return $ tms !! i | 202 | stepTupleIxLazy tm = do
(tmT ,i) <- preview _TmTupleIx tm
tms <- preview _TmTuple tmT
return $ tms !! i | 109 | false | true | 0 | 9 | 47 | 100 | 47 | 53 | null | null |
hanshoglund/modulo | src/Language/Modulo/Lisp.hs | gpl-3.0 | convertDecl :: LispStyle -> Decl -> [Lisp]
convertDecl st (TypeDecl n Nothing) = declOpaque st n | 97 | convertDecl :: LispStyle -> Decl -> [Lisp]
convertDecl st (TypeDecl n Nothing) = declOpaque st n | 97 | convertDecl st (TypeDecl n Nothing) = declOpaque st n | 54 | false | true | 0 | 7 | 16 | 40 | 20 | 20 | null | null |
nevrenato/HetsAlloy | Common/Id.hs | gpl-2.0 | appRange :: Range -> Range -> Range
appRange (Range l1) (Range l2) = Range $ l1 ++ l2 | 85 | appRange :: Range -> Range -> Range
appRange (Range l1) (Range l2) = Range $ l1 ++ l2 | 85 | appRange (Range l1) (Range l2) = Range $ l1 ++ l2 | 49 | false | true | 0 | 7 | 17 | 44 | 22 | 22 | null | null |
anekos/liname-hs | src/LiName/Sort.hs | gpl-3.0 | readSortType "-" = DontSort | 32 | readSortType "-" = DontSort | 32 | readSortType "-" = DontSort | 32 | false | false | 0 | 5 | 8 | 9 | 4 | 5 | null | null |
jfoutz/language-bash | src/Language/Bash/Parse/Builder.hs | bsd-3-clause | -- | Append two monoidal results.
(<+>) :: (Applicative f, Monoid a) => f a -> f a -> f a
(<+>) = liftA2 mappend | 112 | (<+>) :: (Applicative f, Monoid a) => f a -> f a -> f a
(<+>) = liftA2 mappend | 78 | (<+>) = liftA2 mappend | 22 | true | true | 0 | 8 | 24 | 51 | 27 | 24 | null | null |
nitrix/lspace | legacy/Engine.hs | unlicense | withEngine :: Engine () -> String -> Environment -> IO ()
withEngine engine name env = do
-- Loading game
gs <- loadGame name
-- Running engine
ngs <- fmap snd $ flip runStateT gs
$ runMaybeT
$ flip runReaderT env
$ unwrapEngine engine
-- Save new game state
saveGame ngs | 365 | withEngine :: Engine () -> String -> Environment -> IO ()
withEngine engine name env = do
-- Loading game
gs <- loadGame name
-- Running engine
ngs <- fmap snd $ flip runStateT gs
$ runMaybeT
$ flip runReaderT env
$ unwrapEngine engine
-- Save new game state
saveGame ngs | 365 | withEngine engine name env = do
-- Loading game
gs <- loadGame name
-- Running engine
ngs <- fmap snd $ flip runStateT gs
$ runMaybeT
$ flip runReaderT env
$ unwrapEngine engine
-- Save new game state
saveGame ngs | 307 | false | true | 0 | 12 | 144 | 98 | 45 | 53 | null | null |
jystic/ntpmon | tst/TestMain.hs | bsd-3-clause | prop_add_sub_roundtrip t d = dur >= minDur ==>
dur <= maxDur ==>
t `add` d `sub` t == d
where
dur = unDuration d
minDur = minTime - time
maxDur = maxTime - time
time = fromIntegral (unTime t)
minTime = fromIntegral (unTime minBound)
maxTime = fromIntegral (unTime maxBound) | 336 | prop_add_sub_roundtrip t d = dur >= minDur ==>
dur <= maxDur ==>
t `add` d `sub` t == d
where
dur = unDuration d
minDur = minTime - time
maxDur = maxTime - time
time = fromIntegral (unTime t)
minTime = fromIntegral (unTime minBound)
maxTime = fromIntegral (unTime maxBound) | 336 | prop_add_sub_roundtrip t d = dur >= minDur ==>
dur <= maxDur ==>
t `add` d `sub` t == d
where
dur = unDuration d
minDur = minTime - time
maxDur = maxTime - time
time = fromIntegral (unTime t)
minTime = fromIntegral (unTime minBound)
maxTime = fromIntegral (unTime maxBound) | 336 | false | false | 0 | 11 | 111 | 114 | 59 | 55 | null | null |
ribag/ganeti-experiments | src/Ganeti/Utils/AsyncWorker.hs | gpl-2.0 | -- | Trigger a list of workers and wait until all the actions following these
-- triggers finish. Returns the results of the actions.
--
-- Note that there is a significant difference between 'triggerAndWaitMany'
-- and @mapM triggerAndWait@. The latter runs all the actions of the workers
-- sequentially, while the former runs them in parallel.
triggerAndWaitMany :: (T.Traversable t, MonadBase IO m, Monoid i)
=> i -> t (AsyncWorker i a) -> m (t a)
triggerAndWaitMany i workers =
let trig w = do
result <- newEmptyMVar
triggerInternal i (Just result) w
return result
in T.mapM trig workers >>= T.mapM takeMVar | 693 | triggerAndWaitMany :: (T.Traversable t, MonadBase IO m, Monoid i)
=> i -> t (AsyncWorker i a) -> m (t a)
triggerAndWaitMany i workers =
let trig w = do
result <- newEmptyMVar
triggerInternal i (Just result) w
return result
in T.mapM trig workers >>= T.mapM takeMVar | 346 | triggerAndWaitMany i workers =
let trig w = do
result <- newEmptyMVar
triggerInternal i (Just result) w
return result
in T.mapM trig workers >>= T.mapM takeMVar | 222 | true | true | 0 | 13 | 183 | 134 | 65 | 69 | null | null |
rueshyna/gogol | gogol-classroom/gen/Network/Google/Resource/Classroom/Courses/CourseWork/Delete.hs | mpl-2.0 | -- | Pretty-print response.
ccwdPp :: Lens' CoursesCourseWorkDelete Bool
ccwdPp = lens _ccwdPp (\ s a -> s{_ccwdPp = a}) | 120 | ccwdPp :: Lens' CoursesCourseWorkDelete Bool
ccwdPp = lens _ccwdPp (\ s a -> s{_ccwdPp = a}) | 92 | ccwdPp = lens _ccwdPp (\ s a -> s{_ccwdPp = a}) | 47 | true | true | 0 | 9 | 19 | 40 | 22 | 18 | null | null |
martinnj/PMPH2015 | Assignment1/Task2+3/PrimesQuicksort.hs | mit | myop ne arr = tail $ scanl myop ne arr | 38 | myop ne arr = tail $ scanl myop ne arr | 38 | myop ne arr = tail $ scanl myop ne arr | 38 | false | false | 0 | 6 | 9 | 22 | 10 | 12 | null | null |
rgleichman/glance | app/Rendering.hs | gpl-3.0 | addEdges :: (HasCallStack, SpecialBackend b n, ING.Graph gr) =>
String -- ^ Debugging information
-> IconInfo
-> gr NamedIcon (EmbedInfo Edge)
-> SpecialQDiagram b n
-> [(NamedIcon, (Bool, Angle n))]
-> SpecialQDiagram b n
addEdges debugInfo iconInfo graph dia rotationMap = applyAll connections dia
where
connections
= makeEdge debugInfo iconInfo graph dia rotationMap <$> ING.labEdges graph
-- BEGIN rotateNodes --
-- TODO May want to use a power other than 2 for the edgeAngleDiffs | 511 | addEdges :: (HasCallStack, SpecialBackend b n, ING.Graph gr) =>
String -- ^ Debugging information
-> IconInfo
-> gr NamedIcon (EmbedInfo Edge)
-> SpecialQDiagram b n
-> [(NamedIcon, (Bool, Angle n))]
-> SpecialQDiagram b n
addEdges debugInfo iconInfo graph dia rotationMap = applyAll connections dia
where
connections
= makeEdge debugInfo iconInfo graph dia rotationMap <$> ING.labEdges graph
-- BEGIN rotateNodes --
-- TODO May want to use a power other than 2 for the edgeAngleDiffs | 511 | addEdges debugInfo iconInfo graph dia rotationMap = applyAll connections dia
where
connections
= makeEdge debugInfo iconInfo graph dia rotationMap <$> ING.labEdges graph
-- BEGIN rotateNodes --
-- TODO May want to use a power other than 2 for the edgeAngleDiffs | 275 | false | true | 1 | 15 | 100 | 149 | 72 | 77 | null | null |
Xidian-Haskell-Server-Keeper/XHSK-Home | src/Config.hs | bsd-3-clause | getDataFromFileStep :: [String] -> Integer -> [ConfigData]
getDataFromFileStep [] _ = [] | 94 | getDataFromFileStep :: [String] -> Integer -> [ConfigData]
getDataFromFileStep [] _ = [] | 88 | getDataFromFileStep [] _ = [] | 29 | false | true | 0 | 9 | 17 | 36 | 18 | 18 | null | null |
peterokagey/haskellOEIS | src/Sandbox/MonotonicSubsequence.hs | apache-2.0 | -- Length of the longest monotonic increasing subsequence of (a_1,a_2,...)
-- that starts with a_1.
longestMonotonicIncreasing :: (Num p, Ord p, Ord a) => [a] -> p
longestMonotonicIncreasing [] = 0 | 197 | longestMonotonicIncreasing :: (Num p, Ord p, Ord a) => [a] -> p
longestMonotonicIncreasing [] = 0 | 97 | longestMonotonicIncreasing [] = 0 | 33 | true | true | 0 | 7 | 30 | 46 | 25 | 21 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.