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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dselsam/tc
|
src/Frontend/Parser.hs
|
gpl-3.0
|
blank = char ' '
| 16
|
blank = char ' '
| 16
|
blank = char ' '
| 16
| false
| false
| 0
| 5
| 4
| 9
| 4
| 5
| null | null |
ekmett/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 |
michiexile/hplex
|
pershom/src/Math/Misc/Natural.hs
|
bsd-3-clause
|
six = C 6
| 9
|
six = C 6
| 9
|
six = C 6
| 9
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
rueshyna/gogol
|
gogol-dataflow/gen/Network/Google/Dataflow/Types/Product.hs
|
mpl-2.0
|
-- | The global topology of the streaming Dataflow job.
sstStreamingComputationTopology :: Lens' StreamingSetupTask (Maybe TopologyConfig)
sstStreamingComputationTopology
= lens _sstStreamingComputationTopology
(\ s a -> s{_sstStreamingComputationTopology = a})
| 269
|
sstStreamingComputationTopology :: Lens' StreamingSetupTask (Maybe TopologyConfig)
sstStreamingComputationTopology
= lens _sstStreamingComputationTopology
(\ s a -> s{_sstStreamingComputationTopology = a})
| 213
|
sstStreamingComputationTopology
= lens _sstStreamingComputationTopology
(\ s a -> s{_sstStreamingComputationTopology = a})
| 130
| true
| true
| 1
| 9
| 34
| 51
| 25
| 26
| null | null |
altschuler/kite
|
src/Kite/Syntax.hs
|
mit
|
prettyExpr (PChar val) = show val
| 33
|
prettyExpr (PChar val) = show val
| 33
|
prettyExpr (PChar val) = show val
| 33
| false
| false
| 0
| 7
| 5
| 18
| 8
| 10
| null | null |
mapinguari/SC_HS_Proxy
|
src/Proxy/Query/Unit.hs
|
mit
|
isBuilding ZergInfestedCommandCenter = False
| 44
|
isBuilding ZergInfestedCommandCenter = False
| 44
|
isBuilding ZergInfestedCommandCenter = False
| 44
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
mzini/TcT
|
source/Tct/Certificate.hs
|
gpl-3.0
|
rank Primrec = (47,0)
| 29
|
rank Primrec = (47,0)
| 29
|
rank Primrec = (47,0)
| 29
| false
| false
| 0
| 5
| 11
| 16
| 8
| 8
| null | null |
alphaHeavy/cabal
|
Cabal/Distribution/Simple/Configure.hs
|
bsd-3-clause
|
-- -----------------------------------------------------------------------------
-- Configuring program dependencies
configureRequiredPrograms :: Verbosity -> [Dependency] -> ProgramConfiguration -> IO ProgramConfiguration
configureRequiredPrograms verbosity deps conf =
foldM (configureRequiredProgram verbosity) conf deps
| 326
|
configureRequiredPrograms :: Verbosity -> [Dependency] -> ProgramConfiguration -> IO ProgramConfiguration
configureRequiredPrograms verbosity deps conf =
foldM (configureRequiredProgram verbosity) conf deps
| 208
|
configureRequiredPrograms verbosity deps conf =
foldM (configureRequiredProgram verbosity) conf deps
| 102
| true
| true
| 0
| 8
| 28
| 51
| 26
| 25
| null | null |
dterei/Scraps
|
haskell/Ajax/test1.hs
|
bsd-3-clause
|
timeDate (a, Nothing) = Just ("[\"" ++ (fromJust a) ++ "\"]")
| 61
|
timeDate (a, Nothing) = Just ("[\"" ++ (fromJust a) ++ "\"]")
| 61
|
timeDate (a, Nothing) = Just ("[\"" ++ (fromJust a) ++ "\"]")
| 61
| false
| false
| 0
| 10
| 10
| 35
| 18
| 17
| null | null |
mydaum/cabal
|
cabal-install/Distribution/Client/ProjectConfig.hs
|
bsd-3-clause
|
reportParseResult :: Verbosity -> String -> FilePath -> ParseResult a -> IO a
reportParseResult verbosity _filetype filename (ParseOk warnings x) = do
unless (null warnings) $
let msg = unlines (map (showPWarning filename) warnings)
in warn verbosity msg
return x
| 284
|
reportParseResult :: Verbosity -> String -> FilePath -> ParseResult a -> IO a
reportParseResult verbosity _filetype filename (ParseOk warnings x) = do
unless (null warnings) $
let msg = unlines (map (showPWarning filename) warnings)
in warn verbosity msg
return x
| 284
|
reportParseResult verbosity _filetype filename (ParseOk warnings x) = do
unless (null warnings) $
let msg = unlines (map (showPWarning filename) warnings)
in warn verbosity msg
return x
| 206
| false
| true
| 0
| 16
| 60
| 105
| 48
| 57
| null | null |
xu-hao/QueryArrow
|
QueryArrow-ffi-genquery/src/QueryArrow/FFI/GenQuery/Translate.hs
|
bsd-3-clause
|
userId = toVariable "USER_ID"
| 29
|
userId = toVariable "USER_ID"
| 29
|
userId = toVariable "USER_ID"
| 29
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
travitch/shellDSL
|
src/Shell/Internal.hs
|
bsd-3-clause
|
anyChars :: BWord
anyChars = BWord [BWildcard WAsterisk]
| 56
|
anyChars :: BWord
anyChars = BWord [BWildcard WAsterisk]
| 56
|
anyChars = BWord [BWildcard WAsterisk]
| 38
| false
| true
| 0
| 7
| 7
| 26
| 11
| 15
| null | null |
mcmaniac/ghc
|
compiler/nativeGen/X86/CodeGen.hs
|
bsd-3-clause
|
getRegister' is32Bit (CmmMachOp mop [x]) = do -- unary MachOps
sse2 <- sse2Enabled
case mop of
MO_F_Neg w
| sse2 -> sse2NegCode w x
| otherwise -> trivialUFCode FF80 (GNEG FF80) x
MO_S_Neg w -> triv_ucode NEGI (intSize w)
MO_Not w -> triv_ucode NOT (intSize w)
-- Nop conversions
MO_UU_Conv W32 W8 -> toI8Reg W32 x
MO_SS_Conv W32 W8 -> toI8Reg W32 x
MO_UU_Conv W16 W8 -> toI8Reg W16 x
MO_SS_Conv W16 W8 -> toI8Reg W16 x
MO_UU_Conv W32 W16 -> toI16Reg W32 x
MO_SS_Conv W32 W16 -> toI16Reg W32 x
MO_UU_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_SS_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_UU_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_SS_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_UU_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_SS_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_UU_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
MO_SS_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
-- widenings
MO_UU_Conv W8 W32 -> integerExtend W8 W32 MOVZxL x
MO_UU_Conv W16 W32 -> integerExtend W16 W32 MOVZxL x
MO_UU_Conv W8 W16 -> integerExtend W8 W16 MOVZxL x
MO_SS_Conv W8 W32 -> integerExtend W8 W32 MOVSxL x
MO_SS_Conv W16 W32 -> integerExtend W16 W32 MOVSxL x
MO_SS_Conv W8 W16 -> integerExtend W8 W16 MOVSxL x
MO_UU_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVZxL x
MO_UU_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVZxL x
MO_UU_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVZxL x
MO_SS_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVSxL x
MO_SS_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVSxL x
MO_SS_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVSxL x
-- for 32-to-64 bit zero extension, amd64 uses an ordinary movl.
-- However, we don't want the register allocator to throw it
-- away as an unnecessary reg-to-reg move, so we keep it in
-- the form of a movzl and print it as a movl later.
MO_FF_Conv W32 W64
| sse2 -> coerceFP2FP W64 x
| otherwise -> conversionNop FF80 x
MO_FF_Conv W64 W32 -> coerceFP2FP W32 x
MO_FS_Conv from to -> coerceFP2Int from to x
MO_SF_Conv from to -> coerceInt2FP from to x
_other -> pprPanic "getRegister" (pprMachOp mop)
where
triv_ucode :: (Size -> Operand -> Instr) -> Size -> NatM Register
triv_ucode instr size = trivialUCode size (instr size) x
-- signed or unsigned extension.
integerExtend :: Width -> Width
-> (Size -> Operand -> Operand -> Instr)
-> CmmExpr -> NatM Register
integerExtend from to instr expr = do
(reg,e_code) <- if from == W8 then getByteReg expr
else getSomeReg expr
let
code dst =
e_code `snocOL`
instr (intSize from) (OpReg reg) (OpReg dst)
return (Any (intSize to) code)
toI8Reg :: Width -> CmmExpr -> NatM Register
toI8Reg new_rep expr
= do codefn <- getAnyReg expr
return (Any (intSize new_rep) codefn)
-- HACK: use getAnyReg to get a byte-addressable register.
-- If the source was a Fixed register, this will add the
-- mov instruction to put it into the desired destination.
-- We're assuming that the destination won't be a fixed
-- non-byte-addressable register; it won't be, because all
-- fixed registers are word-sized.
toI16Reg = toI8Reg -- for now
conversionNop :: Size -> CmmExpr -> NatM Register
conversionNop new_size expr
= do e_code <- getRegister' is32Bit expr
return (swizzleRegisterRep e_code new_size)
| 4,054
|
getRegister' is32Bit (CmmMachOp mop [x]) = do -- unary MachOps
sse2 <- sse2Enabled
case mop of
MO_F_Neg w
| sse2 -> sse2NegCode w x
| otherwise -> trivialUFCode FF80 (GNEG FF80) x
MO_S_Neg w -> triv_ucode NEGI (intSize w)
MO_Not w -> triv_ucode NOT (intSize w)
-- Nop conversions
MO_UU_Conv W32 W8 -> toI8Reg W32 x
MO_SS_Conv W32 W8 -> toI8Reg W32 x
MO_UU_Conv W16 W8 -> toI8Reg W16 x
MO_SS_Conv W16 W8 -> toI8Reg W16 x
MO_UU_Conv W32 W16 -> toI16Reg W32 x
MO_SS_Conv W32 W16 -> toI16Reg W32 x
MO_UU_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_SS_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_UU_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_SS_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_UU_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_SS_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_UU_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
MO_SS_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
-- widenings
MO_UU_Conv W8 W32 -> integerExtend W8 W32 MOVZxL x
MO_UU_Conv W16 W32 -> integerExtend W16 W32 MOVZxL x
MO_UU_Conv W8 W16 -> integerExtend W8 W16 MOVZxL x
MO_SS_Conv W8 W32 -> integerExtend W8 W32 MOVSxL x
MO_SS_Conv W16 W32 -> integerExtend W16 W32 MOVSxL x
MO_SS_Conv W8 W16 -> integerExtend W8 W16 MOVSxL x
MO_UU_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVZxL x
MO_UU_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVZxL x
MO_UU_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVZxL x
MO_SS_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVSxL x
MO_SS_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVSxL x
MO_SS_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVSxL x
-- for 32-to-64 bit zero extension, amd64 uses an ordinary movl.
-- However, we don't want the register allocator to throw it
-- away as an unnecessary reg-to-reg move, so we keep it in
-- the form of a movzl and print it as a movl later.
MO_FF_Conv W32 W64
| sse2 -> coerceFP2FP W64 x
| otherwise -> conversionNop FF80 x
MO_FF_Conv W64 W32 -> coerceFP2FP W32 x
MO_FS_Conv from to -> coerceFP2Int from to x
MO_SF_Conv from to -> coerceInt2FP from to x
_other -> pprPanic "getRegister" (pprMachOp mop)
where
triv_ucode :: (Size -> Operand -> Instr) -> Size -> NatM Register
triv_ucode instr size = trivialUCode size (instr size) x
-- signed or unsigned extension.
integerExtend :: Width -> Width
-> (Size -> Operand -> Operand -> Instr)
-> CmmExpr -> NatM Register
integerExtend from to instr expr = do
(reg,e_code) <- if from == W8 then getByteReg expr
else getSomeReg expr
let
code dst =
e_code `snocOL`
instr (intSize from) (OpReg reg) (OpReg dst)
return (Any (intSize to) code)
toI8Reg :: Width -> CmmExpr -> NatM Register
toI8Reg new_rep expr
= do codefn <- getAnyReg expr
return (Any (intSize new_rep) codefn)
-- HACK: use getAnyReg to get a byte-addressable register.
-- If the source was a Fixed register, this will add the
-- mov instruction to put it into the desired destination.
-- We're assuming that the destination won't be a fixed
-- non-byte-addressable register; it won't be, because all
-- fixed registers are word-sized.
toI16Reg = toI8Reg -- for now
conversionNop :: Size -> CmmExpr -> NatM Register
conversionNop new_size expr
= do e_code <- getRegister' is32Bit expr
return (swizzleRegisterRep e_code new_size)
| 4,054
|
getRegister' is32Bit (CmmMachOp mop [x]) = do -- unary MachOps
sse2 <- sse2Enabled
case mop of
MO_F_Neg w
| sse2 -> sse2NegCode w x
| otherwise -> trivialUFCode FF80 (GNEG FF80) x
MO_S_Neg w -> triv_ucode NEGI (intSize w)
MO_Not w -> triv_ucode NOT (intSize w)
-- Nop conversions
MO_UU_Conv W32 W8 -> toI8Reg W32 x
MO_SS_Conv W32 W8 -> toI8Reg W32 x
MO_UU_Conv W16 W8 -> toI8Reg W16 x
MO_SS_Conv W16 W8 -> toI8Reg W16 x
MO_UU_Conv W32 W16 -> toI16Reg W32 x
MO_SS_Conv W32 W16 -> toI16Reg W32 x
MO_UU_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_SS_Conv W64 W32 | not is32Bit -> conversionNop II64 x
MO_UU_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_SS_Conv W64 W16 | not is32Bit -> toI16Reg W64 x
MO_UU_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_SS_Conv W64 W8 | not is32Bit -> toI8Reg W64 x
MO_UU_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
MO_SS_Conv rep1 rep2 | rep1 == rep2 -> conversionNop (intSize rep1) x
-- widenings
MO_UU_Conv W8 W32 -> integerExtend W8 W32 MOVZxL x
MO_UU_Conv W16 W32 -> integerExtend W16 W32 MOVZxL x
MO_UU_Conv W8 W16 -> integerExtend W8 W16 MOVZxL x
MO_SS_Conv W8 W32 -> integerExtend W8 W32 MOVSxL x
MO_SS_Conv W16 W32 -> integerExtend W16 W32 MOVSxL x
MO_SS_Conv W8 W16 -> integerExtend W8 W16 MOVSxL x
MO_UU_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVZxL x
MO_UU_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVZxL x
MO_UU_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVZxL x
MO_SS_Conv W8 W64 | not is32Bit -> integerExtend W8 W64 MOVSxL x
MO_SS_Conv W16 W64 | not is32Bit -> integerExtend W16 W64 MOVSxL x
MO_SS_Conv W32 W64 | not is32Bit -> integerExtend W32 W64 MOVSxL x
-- for 32-to-64 bit zero extension, amd64 uses an ordinary movl.
-- However, we don't want the register allocator to throw it
-- away as an unnecessary reg-to-reg move, so we keep it in
-- the form of a movzl and print it as a movl later.
MO_FF_Conv W32 W64
| sse2 -> coerceFP2FP W64 x
| otherwise -> conversionNop FF80 x
MO_FF_Conv W64 W32 -> coerceFP2FP W32 x
MO_FS_Conv from to -> coerceFP2Int from to x
MO_SF_Conv from to -> coerceInt2FP from to x
_other -> pprPanic "getRegister" (pprMachOp mop)
where
triv_ucode :: (Size -> Operand -> Instr) -> Size -> NatM Register
triv_ucode instr size = trivialUCode size (instr size) x
-- signed or unsigned extension.
integerExtend :: Width -> Width
-> (Size -> Operand -> Operand -> Instr)
-> CmmExpr -> NatM Register
integerExtend from to instr expr = do
(reg,e_code) <- if from == W8 then getByteReg expr
else getSomeReg expr
let
code dst =
e_code `snocOL`
instr (intSize from) (OpReg reg) (OpReg dst)
return (Any (intSize to) code)
toI8Reg :: Width -> CmmExpr -> NatM Register
toI8Reg new_rep expr
= do codefn <- getAnyReg expr
return (Any (intSize new_rep) codefn)
-- HACK: use getAnyReg to get a byte-addressable register.
-- If the source was a Fixed register, this will add the
-- mov instruction to put it into the desired destination.
-- We're assuming that the destination won't be a fixed
-- non-byte-addressable register; it won't be, because all
-- fixed registers are word-sized.
toI16Reg = toI8Reg -- for now
conversionNop :: Size -> CmmExpr -> NatM Register
conversionNop new_size expr
= do e_code <- getRegister' is32Bit expr
return (swizzleRegisterRep e_code new_size)
| 4,054
| false
| false
| 0
| 13
| 1,332
| 1,155
| 522
| 633
| null | null |
DaMSL/K3
|
src/Language/K3/Interpreter/Data/Accessors.hs
|
apache-2.0
|
getTraceUID :: Interpretation (Maybe (Span, UID))
getTraceUID = get >>= (\l -> if null l then return Nothing else return . Just $ head l) . stackTrace . getTracer
| 162
|
getTraceUID :: Interpretation (Maybe (Span, UID))
getTraceUID = get >>= (\l -> if null l then return Nothing else return . Just $ head l) . stackTrace . getTracer
| 162
|
getTraceUID = get >>= (\l -> if null l then return Nothing else return . Just $ head l) . stackTrace . getTracer
| 112
| false
| true
| 0
| 12
| 28
| 71
| 37
| 34
| null | null |
konn/sized-vector
|
Data/Vector/Sized.hs
|
bsd-3-clause
|
zipWith _ Nil (_ :- _) = Nil
| 35
|
zipWith _ Nil (_ :- _) = Nil
| 35
|
zipWith _ Nil (_ :- _) = Nil
| 35
| false
| false
| 0
| 7
| 14
| 20
| 10
| 10
| null | null |
mikeplus64/plissken
|
src/Uniform.hs
|
gpl-3.0
|
uvec4 = More (Proxy::Proxy Vec4)
| 33
|
uvec4 = More (Proxy::Proxy Vec4)
| 33
|
uvec4 = More (Proxy::Proxy Vec4)
| 33
| false
| false
| 0
| 7
| 5
| 18
| 9
| 9
| null | null |
aloiscochard/codex
|
codex/Main.hs
|
apache-2.0
|
cleanCache :: (Builder, Codex) -> IO ()
cleanCache (bldr, cx) = do
-- TODO Delete hash file!
xs <- listDirectory hp
ys <- builderOp bldr =<< traverseDirectories xs
_ <- removeTagFiles $ concat ys
return ()
where
hp = hackagePath cx
safe = (try :: IO a -> IO (Either SomeException a))
removeTagFiles = traverse (safe . removeFile) . fmap (</> "tags")
traverseDirectories = fmap rights . traverse (safe . listDirectory)
builderOp (Stack _) = traverseDirectories . concat
builderOp Cabal = return
| 530
|
cleanCache :: (Builder, Codex) -> IO ()
cleanCache (bldr, cx) = do
-- TODO Delete hash file!
xs <- listDirectory hp
ys <- builderOp bldr =<< traverseDirectories xs
_ <- removeTagFiles $ concat ys
return ()
where
hp = hackagePath cx
safe = (try :: IO a -> IO (Either SomeException a))
removeTagFiles = traverse (safe . removeFile) . fmap (</> "tags")
traverseDirectories = fmap rights . traverse (safe . listDirectory)
builderOp (Stack _) = traverseDirectories . concat
builderOp Cabal = return
| 530
|
cleanCache (bldr, cx) = do
-- TODO Delete hash file!
xs <- listDirectory hp
ys <- builderOp bldr =<< traverseDirectories xs
_ <- removeTagFiles $ concat ys
return ()
where
hp = hackagePath cx
safe = (try :: IO a -> IO (Either SomeException a))
removeTagFiles = traverse (safe . removeFile) . fmap (</> "tags")
traverseDirectories = fmap rights . traverse (safe . listDirectory)
builderOp (Stack _) = traverseDirectories . concat
builderOp Cabal = return
| 490
| false
| true
| 4
| 9
| 118
| 217
| 99
| 118
| null | null |
uuhan/Idris-dev
|
src/Util/System.hs
|
bsd-3-clause
|
isWindows :: Bool
isWindows = os `elem` ["win32", "mingw32", "cygwin32"]
| 72
|
isWindows :: Bool
isWindows = os `elem` ["win32", "mingw32", "cygwin32"]
| 72
|
isWindows = os `elem` ["win32", "mingw32", "cygwin32"]
| 54
| false
| true
| 0
| 6
| 9
| 26
| 16
| 10
| null | null |
vdweegen/UvA-Software_Testing
|
Lab2/Final/Exercises.hs
|
gpl-3.0
|
stronger, weaker :: [a] -> (a -> Bool) -> (a -> Bool) -> Bool
stronger xs p q = forall xs (\ x -> p x --> q x)
| 110
|
stronger, weaker :: [a] -> (a -> Bool) -> (a -> Bool) -> Bool
stronger xs p q = forall xs (\ x -> p x --> q x)
| 110
|
stronger xs p q = forall xs (\ x -> p x --> q x)
| 48
| false
| true
| 0
| 9
| 28
| 72
| 38
| 34
| null | null |
egison/egison
|
hs-src/Language/Egison/Primitives/String.hs
|
mit
|
splitString :: String -> PrimitiveFunc
splitString = twoArgs $ \pat src -> do
patStr <- fromEgison pat
srcStr <- fromEgison src
return . Collection . Sq.fromList $ map String $ T.splitOn patStr srcStr
| 206
|
splitString :: String -> PrimitiveFunc
splitString = twoArgs $ \pat src -> do
patStr <- fromEgison pat
srcStr <- fromEgison src
return . Collection . Sq.fromList $ map String $ T.splitOn patStr srcStr
| 206
|
splitString = twoArgs $ \pat src -> do
patStr <- fromEgison pat
srcStr <- fromEgison src
return . Collection . Sq.fromList $ map String $ T.splitOn patStr srcStr
| 167
| false
| true
| 0
| 13
| 38
| 84
| 37
| 47
| null | null |
oldmanmike/ghc
|
compiler/main/HscTypes.hs
|
bsd-3-clause
|
handleFlagWarnings :: DynFlags -> [Located String] -> IO ()
handleFlagWarnings dflags warns
= when (wopt Opt_WarnDeprecatedFlags dflags) $ do
-- It would be nicer if warns :: [Located MsgDoc], but that
-- has circular import problems.
let bag = listToBag [ mkPlainWarnMsg dflags loc (text warn)
| L loc warn <- warns ]
printOrThrowWarnings dflags bag
{-
************************************************************************
* *
\subsection{HscEnv}
* *
************************************************************************
-}
-- | HscEnv is like 'Session', except that some of the fields are immutable.
-- An HscEnv is used to compile a single module from plain Haskell source
-- code (after preprocessing) to either C, assembly or C--. Things like
-- the module graph don't change during a single compilation.
--
-- Historical note: \"hsc\" used to be the name of the compiler binary,
-- when there was a separate driver and compiler. To compile a single
-- module, the driver would invoke hsc on the source code... so nowadays
-- we think of hsc as the layer of the compiler that deals with compiling
-- a single module.
| 1,325
|
handleFlagWarnings :: DynFlags -> [Located String] -> IO ()
handleFlagWarnings dflags warns
= when (wopt Opt_WarnDeprecatedFlags dflags) $ do
-- It would be nicer if warns :: [Located MsgDoc], but that
-- has circular import problems.
let bag = listToBag [ mkPlainWarnMsg dflags loc (text warn)
| L loc warn <- warns ]
printOrThrowWarnings dflags bag
{-
************************************************************************
* *
\subsection{HscEnv}
* *
************************************************************************
-}
-- | HscEnv is like 'Session', except that some of the fields are immutable.
-- An HscEnv is used to compile a single module from plain Haskell source
-- code (after preprocessing) to either C, assembly or C--. Things like
-- the module graph don't change during a single compilation.
--
-- Historical note: \"hsc\" used to be the name of the compiler binary,
-- when there was a separate driver and compiler. To compile a single
-- module, the driver would invoke hsc on the source code... so nowadays
-- we think of hsc as the layer of the compiler that deals with compiling
-- a single module.
| 1,325
|
handleFlagWarnings dflags warns
= when (wopt Opt_WarnDeprecatedFlags dflags) $ do
-- It would be nicer if warns :: [Located MsgDoc], but that
-- has circular import problems.
let bag = listToBag [ mkPlainWarnMsg dflags loc (text warn)
| L loc warn <- warns ]
printOrThrowWarnings dflags bag
{-
************************************************************************
* *
\subsection{HscEnv}
* *
************************************************************************
-}
-- | HscEnv is like 'Session', except that some of the fields are immutable.
-- An HscEnv is used to compile a single module from plain Haskell source
-- code (after preprocessing) to either C, assembly or C--. Things like
-- the module graph don't change during a single compilation.
--
-- Historical note: \"hsc\" used to be the name of the compiler binary,
-- when there was a separate driver and compiler. To compile a single
-- module, the driver would invoke hsc on the source code... so nowadays
-- we think of hsc as the layer of the compiler that deals with compiling
-- a single module.
| 1,265
| false
| true
| 0
| 16
| 371
| 117
| 60
| 57
| null | null |
mfpi/OpenGL
|
Graphics/Rendering/OpenGL/GL/Texturing/Environments.hs
|
bsd-3-clause
|
marshalSrc :: Src -> GLint
marshalSrc x = fromIntegral $ case x of
CurrentUnit -> gl_TEXTURE
Previous -> gl_PREVIOUS
Crossbar u -> fromIntegral (marshalTextureUnit u)
Constant -> gl_CONSTANT
PrimaryColor -> gl_PRIMARY_COLOR
| 238
|
marshalSrc :: Src -> GLint
marshalSrc x = fromIntegral $ case x of
CurrentUnit -> gl_TEXTURE
Previous -> gl_PREVIOUS
Crossbar u -> fromIntegral (marshalTextureUnit u)
Constant -> gl_CONSTANT
PrimaryColor -> gl_PRIMARY_COLOR
| 238
|
marshalSrc x = fromIntegral $ case x of
CurrentUnit -> gl_TEXTURE
Previous -> gl_PREVIOUS
Crossbar u -> fromIntegral (marshalTextureUnit u)
Constant -> gl_CONSTANT
PrimaryColor -> gl_PRIMARY_COLOR
| 211
| false
| true
| 7
| 9
| 45
| 73
| 33
| 40
| null | null |
beni55/combinatorrent
|
src/Process/Listen.hs
|
bsd-2-clause
|
eventLoop :: Socket -> Process CF () ()
eventLoop sockFd = do
c <- asks peerMgrCh
liftIO $ do
conn <- accept sockFd
atomically $ writeTChan c (NewIncoming conn)
eventLoop sockFd
| 205
|
eventLoop :: Socket -> Process CF () ()
eventLoop sockFd = do
c <- asks peerMgrCh
liftIO $ do
conn <- accept sockFd
atomically $ writeTChan c (NewIncoming conn)
eventLoop sockFd
| 205
|
eventLoop sockFd = do
c <- asks peerMgrCh
liftIO $ do
conn <- accept sockFd
atomically $ writeTChan c (NewIncoming conn)
eventLoop sockFd
| 165
| false
| true
| 0
| 13
| 58
| 80
| 35
| 45
| null | null |
maarons/Cortex
|
Miranda/test/CommitList_Test.hs
|
agpl-3.0
|
test2 :: Test
test2 = TestCase $ do
let a = C.Commit ("a", C.Set "1", "", "2012.03.18 20:32:32:910425188000")
let add x y = fst $ insert x y
let cl = add a $ add a $ add a empty
let r = snd $ insert a cl
assertBool "" $ null r
assertBool "" $ (==) 1 (length $ toList cl)
-----
-----
| 309
|
test2 :: Test
test2 = TestCase $ do
let a = C.Commit ("a", C.Set "1", "", "2012.03.18 20:32:32:910425188000")
let add x y = fst $ insert x y
let cl = add a $ add a $ add a empty
let r = snd $ insert a cl
assertBool "" $ null r
assertBool "" $ (==) 1 (length $ toList cl)
-----
-----
| 309
|
test2 = TestCase $ do
let a = C.Commit ("a", C.Set "1", "", "2012.03.18 20:32:32:910425188000")
let add x y = fst $ insert x y
let cl = add a $ add a $ add a empty
let r = snd $ insert a cl
assertBool "" $ null r
assertBool "" $ (==) 1 (length $ toList cl)
-----
-----
| 295
| false
| true
| 2
| 14
| 90
| 165
| 75
| 90
| null | null |
abuiles/turbinado-blog
|
tmp/dependencies/hs-plugins-1.3.1/src/System/Plugins/Utils.hs
|
bsd-3-clause
|
decode_lower 'd' = '$'
| 22
|
decode_lower 'd' = '$'
| 22
|
decode_lower 'd' = '$'
| 22
| false
| false
| 0
| 4
| 3
| 10
| 4
| 6
| null | null |
supermario/stack
|
src/Stack/Types/Config.hs
|
bsd-3-clause
|
installationRootLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)
installationRootLocal = do
bc <- asks getBuildConfig
psc <- useShaPathOnWindows =<< platformSnapAndCompilerRel
return $ configProjectWorkDir bc </> $(mkRelDir "install") </> psc
-- | Path for platform followed by snapshot name followed by compiler
-- name.
| 366
|
installationRootLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)
installationRootLocal = do
bc <- asks getBuildConfig
psc <- useShaPathOnWindows =<< platformSnapAndCompilerRel
return $ configProjectWorkDir bc </> $(mkRelDir "install") </> psc
-- | Path for platform followed by snapshot name followed by compiler
-- name.
| 366
|
installationRootLocal = do
bc <- asks getBuildConfig
psc <- useShaPathOnWindows =<< platformSnapAndCompilerRel
return $ configProjectWorkDir bc </> $(mkRelDir "install") </> psc
-- | Path for platform followed by snapshot name followed by compiler
-- name.
| 269
| false
| true
| 0
| 11
| 61
| 93
| 45
| 48
| null | null |
nushio3/ghc
|
compiler/iface/IfaceType.hs
|
bsd-3-clause
|
-- | Similar to 'eqTyVarBndrs', checks that tyvar lists
-- are the same length and have matching kinds; if so, extend the
-- 'IfRnEnv2'. Returns 'Nothing' if they don't match.
eqIfaceTvBndrs :: IfRnEnv2 -> [IfaceTvBndr] -> [IfaceTvBndr] -> Maybe IfRnEnv2
eqIfaceTvBndrs env [] [] = Just env
| 291
|
eqIfaceTvBndrs :: IfRnEnv2 -> [IfaceTvBndr] -> [IfaceTvBndr] -> Maybe IfRnEnv2
eqIfaceTvBndrs env [] [] = Just env
| 114
|
eqIfaceTvBndrs env [] [] = Just env
| 35
| true
| true
| 0
| 8
| 47
| 55
| 27
| 28
| null | null |
marcellussiegburg/autotool
|
server-implementation/src/Main.hs
|
gpl-2.0
|
main :: IO ()
main = do
hSetBinaryMode stdout True
hSetBinaryMode stdin True
-- note: timeouts are supposed to be handled by the individual services.
-- this limit is a fallback.
timeout (timeLimit * 3 `div` 2) $
cgiXmlRpcServer proto
return ()
-- supported RPC calls
| 300
|
main :: IO ()
main = do
hSetBinaryMode stdout True
hSetBinaryMode stdin True
-- note: timeouts are supposed to be handled by the individual services.
-- this limit is a fallback.
timeout (timeLimit * 3 `div` 2) $
cgiXmlRpcServer proto
return ()
-- supported RPC calls
| 300
|
main = do
hSetBinaryMode stdout True
hSetBinaryMode stdin True
-- note: timeouts are supposed to be handled by the individual services.
-- this limit is a fallback.
timeout (timeLimit * 3 `div` 2) $
cgiXmlRpcServer proto
return ()
-- supported RPC calls
| 286
| false
| true
| 0
| 12
| 78
| 75
| 34
| 41
| null | null |
christiaanb/clash-compiler
|
clash-ghc/src-ghc/CLaSH/GHC/Compat/DynFlags.hs
|
bsd-2-clause
|
dopt_unset = DynFlags.gopt_unset
| 32
|
dopt_unset = DynFlags.gopt_unset
| 32
|
dopt_unset = DynFlags.gopt_unset
| 32
| false
| false
| 0
| 5
| 2
| 8
| 4
| 4
| null | null |
mbackenkoehler/ssa-hs
|
src/SSA/Model.hs
|
mit
|
evalV e _ = error $ "evalV: unexpected expression: " ++ show e
| 62
|
evalV e _ = error $ "evalV: unexpected expression: " ++ show e
| 62
|
evalV e _ = error $ "evalV: unexpected expression: " ++ show e
| 62
| false
| false
| 0
| 6
| 12
| 24
| 10
| 14
| null | null |
Concomitant/LambdaHack
|
GameDefinition/Content/ModeKind.hs
|
bsd-3-clause
|
campaign, raid, skirmish, ambush, battle, battleSurvival, safari, safariSurvival, pvp, coop, defense, screensaver, boardgame :: ModeKind
campaign = ModeKind
{ msymbol = 'c'
, mname = "campaign"
, mfreq = [("campaign", 1)]
, mroster = rosterCampaign
, mcaves = cavesCampaign
, mdesc = "Don't let wanton curiosity, greed and the creeping abstraction madness keep you down there in the darkness for too long!"
}
| 437
|
campaign, raid, skirmish, ambush, battle, battleSurvival, safari, safariSurvival, pvp, coop, defense, screensaver, boardgame :: ModeKind
campaign = ModeKind
{ msymbol = 'c'
, mname = "campaign"
, mfreq = [("campaign", 1)]
, mroster = rosterCampaign
, mcaves = cavesCampaign
, mdesc = "Don't let wanton curiosity, greed and the creeping abstraction madness keep you down there in the darkness for too long!"
}
| 436
|
campaign = ModeKind
{ msymbol = 'c'
, mname = "campaign"
, mfreq = [("campaign", 1)]
, mroster = rosterCampaign
, mcaves = cavesCampaign
, mdesc = "Don't let wanton curiosity, greed and the creeping abstraction madness keep you down there in the darkness for too long!"
}
| 292
| false
| true
| 0
| 9
| 91
| 86
| 62
| 24
| null | null |
thiagoarrais/hdbc-oracle
|
Database/HDBC/Oracle.hs
|
lgpl-2.1
|
disconnectOracle (OracleConnection env err conn) = do
session <- getHandleAttr err (castPtr conn) oci_HTYPE_SVCCTX oci_ATTR_SESSION
server <- getHandleAttr err (castPtr conn) oci_HTYPE_SVCCTX oci_ATTR_SERVER
sessionEnd err conn session
serverDetach err server
free session
free server
free conn
free err
free env
| 357
|
disconnectOracle (OracleConnection env err conn) = do
session <- getHandleAttr err (castPtr conn) oci_HTYPE_SVCCTX oci_ATTR_SESSION
server <- getHandleAttr err (castPtr conn) oci_HTYPE_SVCCTX oci_ATTR_SERVER
sessionEnd err conn session
serverDetach err server
free session
free server
free conn
free err
free env
| 357
|
disconnectOracle (OracleConnection env err conn) = do
session <- getHandleAttr err (castPtr conn) oci_HTYPE_SVCCTX oci_ATTR_SESSION
server <- getHandleAttr err (castPtr conn) oci_HTYPE_SVCCTX oci_ATTR_SERVER
sessionEnd err conn session
serverDetach err server
free session
free server
free conn
free err
free env
| 357
| false
| false
| 0
| 10
| 84
| 111
| 46
| 65
| null | null |
anttisalonen/lvm
|
src/stau/StauTypes.hs
|
gpl-3.0
|
pair :: [(a, [b])] -> [(a, b)]
pair [] = []
| 43
|
pair :: [(a, [b])] -> [(a, b)]
pair [] = []
| 43
|
pair [] = []
| 12
| false
| true
| 0
| 8
| 10
| 43
| 25
| 18
| null | null |
sboosali/commands
|
commands-core/sources/Commands/RHS/Derived.hs
|
mit
|
-- | one or more. @(-++) = 'many1RHS'@
--
-- like 'someRHS', but "downcasted" to a list.
(-++), many1RHS :: RHS n t f a -> RHS n t f [a]
(-++) = many1RHS
| 153
|
(-++), many1RHS :: RHS n t f a -> RHS n t f [a]
(-++) = many1RHS
| 64
|
(-++) = many1RHS
| 16
| true
| true
| 0
| 7
| 33
| 45
| 27
| 18
| null | null |
ocharles/hackage-server
|
Distribution/Server/Pages/AdminLog.hs
|
bsd-3-clause
|
adminLogPage :: Users -> [(UTCTime, UserId, String, UserId, String, String)] -> Html
adminLogPage users entries = hackagePage "adminstrator actions log" docBody
where
docBody = [XHtml.h2 << "Administrator actions",
XHtml.table ! [XHtml.align "center"] << (header : map makeRow entries)]
makeRow (time, actorId, action, targetId, group, reason) = XHtml.tr << map fmtCell
[showTime time,
display $ Users.userIdToName users actorId,
action,
display $ Users.userIdToName users targetId,
group,
reason]
nbsp = XHtml.primHtmlChar "nbsp"
showTime = formatTime defaultTimeLocale "%c"
header = XHtml.tr << map (XHtml.th <<) ["Time ","User ","Action ","Target ","Group ","Reason "]
fmtCell x = XHtml.td ! [XHtml.align "left"] << [XHtml.toHtml x, nbsp, nbsp]
| 902
|
adminLogPage :: Users -> [(UTCTime, UserId, String, UserId, String, String)] -> Html
adminLogPage users entries = hackagePage "adminstrator actions log" docBody
where
docBody = [XHtml.h2 << "Administrator actions",
XHtml.table ! [XHtml.align "center"] << (header : map makeRow entries)]
makeRow (time, actorId, action, targetId, group, reason) = XHtml.tr << map fmtCell
[showTime time,
display $ Users.userIdToName users actorId,
action,
display $ Users.userIdToName users targetId,
group,
reason]
nbsp = XHtml.primHtmlChar "nbsp"
showTime = formatTime defaultTimeLocale "%c"
header = XHtml.tr << map (XHtml.th <<) ["Time ","User ","Action ","Target ","Group ","Reason "]
fmtCell x = XHtml.td ! [XHtml.align "left"] << [XHtml.toHtml x, nbsp, nbsp]
| 902
|
adminLogPage users entries = hackagePage "adminstrator actions log" docBody
where
docBody = [XHtml.h2 << "Administrator actions",
XHtml.table ! [XHtml.align "center"] << (header : map makeRow entries)]
makeRow (time, actorId, action, targetId, group, reason) = XHtml.tr << map fmtCell
[showTime time,
display $ Users.userIdToName users actorId,
action,
display $ Users.userIdToName users targetId,
group,
reason]
nbsp = XHtml.primHtmlChar "nbsp"
showTime = formatTime defaultTimeLocale "%c"
header = XHtml.tr << map (XHtml.th <<) ["Time ","User ","Action ","Target ","Group ","Reason "]
fmtCell x = XHtml.td ! [XHtml.align "left"] << [XHtml.toHtml x, nbsp, nbsp]
| 817
| false
| true
| 0
| 10
| 254
| 280
| 153
| 127
| null | null |
seereason/ghcjs
|
src/Compiler/Program.hs
|
mit
|
-- ghcjs --print-foo
showGhcUsageMode, showGhciUsageMode, showInfoMode :: Mode
showGhcUsageMode = mkPreLoadMode ShowGhcUsage
| 125
|
showGhcUsageMode, showGhciUsageMode, showInfoMode :: Mode
showGhcUsageMode = mkPreLoadMode ShowGhcUsage
| 103
|
showGhcUsageMode = mkPreLoadMode ShowGhcUsage
| 45
| true
| true
| 2
| 5
| 12
| 23
| 12
| 11
| null | null |
idupree/haskell-time-steward
|
FlatTimeSteward.hs
|
gpl-3.0
|
--composeListOfEndomorphisms :: [a -> a] -> a -> a
-- = flip (foldl (flip id))
-- = appEndo . mconcat . map Endo
-- = Prelude.foldr (.) id
-- 'initializePredictions' is idempotent.
-- Also, for any complete FlatTimeStewardInstance, it should have no effect.
-- (TODO: define "complete" usefully, by using the word in any other
-- documentation.)
initializePredictions :: FlatTimeStewardInstance -> FlatTimeStewardInstance
initializePredictions ftsi = List.foldr (.) id
[makePrediction numberedPredictor entityId |
numberedPredictor@(_, Predictor (_::Proxy f) _) <-
List.zip [(1::Word32) ..] (ftsiPredictors ftsi),
entityId <- Map.keys (getEntityFieldsOfType (ftsiEntityFieldStates ftsi)
:: Map EntityId f)]
ftsi
| 759
|
initializePredictions :: FlatTimeStewardInstance -> FlatTimeStewardInstance
initializePredictions ftsi = List.foldr (.) id
[makePrediction numberedPredictor entityId |
numberedPredictor@(_, Predictor (_::Proxy f) _) <-
List.zip [(1::Word32) ..] (ftsiPredictors ftsi),
entityId <- Map.keys (getEntityFieldsOfType (ftsiEntityFieldStates ftsi)
:: Map EntityId f)]
ftsi
| 411
|
initializePredictions ftsi = List.foldr (.) id
[makePrediction numberedPredictor entityId |
numberedPredictor@(_, Predictor (_::Proxy f) _) <-
List.zip [(1::Word32) ..] (ftsiPredictors ftsi),
entityId <- Map.keys (getEntityFieldsOfType (ftsiEntityFieldStates ftsi)
:: Map EntityId f)]
ftsi
| 335
| true
| true
| 0
| 13
| 141
| 137
| 74
| 63
| null | null |
atwupack/LearnOpenGL
|
app/1_Getting-started/2_Hello-triangle/Hello-triangle.hs
|
bsd-3-clause
|
main :: IO ()
main = do
GLFW.init
w <- createAppWindow 800 600 "LearnOpenGL"
prg <- createShaderProgram
(vao, vbo) <- createVAO 9 vertices
runAppLoop w $ do
pollEvents
clearColor $= Color4 0.2 0.3 0.3 1.0
clear [ColorBuffer]
-- Draw our first triangle
currentProgram $= Just prg
bindVertexArrayObject $= Just vao
drawArrays Triangles 0 3
bindVertexArrayObject $= Nothing
swap w
deleteObjectName vao
deleteObjectName vbo
terminate
| 533
|
main :: IO ()
main = do
GLFW.init
w <- createAppWindow 800 600 "LearnOpenGL"
prg <- createShaderProgram
(vao, vbo) <- createVAO 9 vertices
runAppLoop w $ do
pollEvents
clearColor $= Color4 0.2 0.3 0.3 1.0
clear [ColorBuffer]
-- Draw our first triangle
currentProgram $= Just prg
bindVertexArrayObject $= Just vao
drawArrays Triangles 0 3
bindVertexArrayObject $= Nothing
swap w
deleteObjectName vao
deleteObjectName vbo
terminate
| 533
|
main = do
GLFW.init
w <- createAppWindow 800 600 "LearnOpenGL"
prg <- createShaderProgram
(vao, vbo) <- createVAO 9 vertices
runAppLoop w $ do
pollEvents
clearColor $= Color4 0.2 0.3 0.3 1.0
clear [ColorBuffer]
-- Draw our first triangle
currentProgram $= Just prg
bindVertexArrayObject $= Just vao
drawArrays Triangles 0 3
bindVertexArrayObject $= Nothing
swap w
deleteObjectName vao
deleteObjectName vbo
terminate
| 519
| false
| true
| 0
| 11
| 167
| 163
| 68
| 95
| null | null |
yesodweb/persistent
|
persistent-postgresql/test/ImplicitUuidSpec.hs
|
mit
|
spec :: Spec
spec = describe "ImplicitUuidSpec" $ before_ wipe $ do
describe "WithDefUuidKey" $ do
it "works on UUIDs" $ do
let withDefUuidKey = WithDefUuidKey (UUID "Hello")
pass
describe "getEntityId" $ do
let Just idField = getEntityIdField (entityDef (Proxy @WithDefUuid))
it "has a UUID SqlType" $ asIO $ do
fieldSqlType idField `shouldBe` SqlOther "UUID"
it "is an implicit ID column" $ asIO $ do
fieldIsImplicitIdColumn idField `shouldBe` True
describe "insert" $ do
itDb "successfully has a default" $ do
let matt = WithDefUuid
{ withDefUuidName =
"Matt"
}
k <- insert matt
mrec <- get k
mrec `shouldBe` Just matt
| 834
|
spec :: Spec
spec = describe "ImplicitUuidSpec" $ before_ wipe $ do
describe "WithDefUuidKey" $ do
it "works on UUIDs" $ do
let withDefUuidKey = WithDefUuidKey (UUID "Hello")
pass
describe "getEntityId" $ do
let Just idField = getEntityIdField (entityDef (Proxy @WithDefUuid))
it "has a UUID SqlType" $ asIO $ do
fieldSqlType idField `shouldBe` SqlOther "UUID"
it "is an implicit ID column" $ asIO $ do
fieldIsImplicitIdColumn idField `shouldBe` True
describe "insert" $ do
itDb "successfully has a default" $ do
let matt = WithDefUuid
{ withDefUuidName =
"Matt"
}
k <- insert matt
mrec <- get k
mrec `shouldBe` Just matt
| 834
|
spec = describe "ImplicitUuidSpec" $ before_ wipe $ do
describe "WithDefUuidKey" $ do
it "works on UUIDs" $ do
let withDefUuidKey = WithDefUuidKey (UUID "Hello")
pass
describe "getEntityId" $ do
let Just idField = getEntityIdField (entityDef (Proxy @WithDefUuid))
it "has a UUID SqlType" $ asIO $ do
fieldSqlType idField `shouldBe` SqlOther "UUID"
it "is an implicit ID column" $ asIO $ do
fieldIsImplicitIdColumn idField `shouldBe` True
describe "insert" $ do
itDb "successfully has a default" $ do
let matt = WithDefUuid
{ withDefUuidName =
"Matt"
}
k <- insert matt
mrec <- get k
mrec `shouldBe` Just matt
| 821
| false
| true
| 0
| 19
| 313
| 237
| 103
| 134
| null | null |
rahulmutt/ghcvm
|
tests/suite/array/run/Arr016/Arr016.hs
|
bsd-3-clause
|
fraction a b c = fromInteger a + (fromInteger b / (abs (fromInteger c) + 1))
| 76
|
fraction a b c = fromInteger a + (fromInteger b / (abs (fromInteger c) + 1))
| 76
|
fraction a b c = fromInteger a + (fromInteger b / (abs (fromInteger c) + 1))
| 76
| false
| false
| 1
| 13
| 15
| 52
| 22
| 30
| null | null |
wouwouwou/2017_module_8
|
src/haskell/PP-project-2016/CodeGen.hs
|
apache-2.0
|
codeGen' int ast = insertACallPointers (insertFPointers instrss (pPointers, cPointers)) (pPointers, cPointers)
where
(instrss, pPointers, cPointers) = findPointers' $ codeGen ast int
| 195
|
codeGen' int ast = insertACallPointers (insertFPointers instrss (pPointers, cPointers)) (pPointers, cPointers)
where
(instrss, pPointers, cPointers) = findPointers' $ codeGen ast int
| 195
|
codeGen' int ast = insertACallPointers (insertFPointers instrss (pPointers, cPointers)) (pPointers, cPointers)
where
(instrss, pPointers, cPointers) = findPointers' $ codeGen ast int
| 195
| false
| false
| 0
| 8
| 33
| 62
| 33
| 29
| null | null |
GaloisInc/halvm-ghc
|
compiler/basicTypes/BasicTypes.hs
|
bsd-3-clause
|
tupleParens ConstraintTuple p -- In debug-style write (% Eq a, Ord b %)
| opt_PprStyle_Debug = text "(%" <+> p <+> ptext (sLit "%)")
| otherwise = parens p
| 184
|
tupleParens ConstraintTuple p -- In debug-style write (% Eq a, Ord b %)
| opt_PprStyle_Debug = text "(%" <+> p <+> ptext (sLit "%)")
| otherwise = parens p
| 184
|
tupleParens ConstraintTuple p -- In debug-style write (% Eq a, Ord b %)
| opt_PprStyle_Debug = text "(%" <+> p <+> ptext (sLit "%)")
| otherwise = parens p
| 184
| false
| false
| 1
| 9
| 57
| 50
| 22
| 28
| null | null |
kojiromike/Idris-dev
|
src/IRTS/JavaScript/LangTransforms.hs
|
bsd-3-clause
|
extractGlobs :: Map Name LDecl -> LDecl -> [Name]
extractGlobs defs (LConstructor _ _ _) = []
| 93
|
extractGlobs :: Map Name LDecl -> LDecl -> [Name]
extractGlobs defs (LConstructor _ _ _) = []
| 93
|
extractGlobs defs (LConstructor _ _ _) = []
| 43
| false
| true
| 0
| 10
| 16
| 50
| 23
| 27
| null | null |
davidhinkes/anarchy
|
src/Network/Anarchy/Client.hs
|
bsd-3-clause
|
resultToMaybeT _ = MaybeT (return Nothing)
| 43
|
resultToMaybeT _ = MaybeT (return Nothing)
| 43
|
resultToMaybeT _ = MaybeT (return Nothing)
| 43
| false
| false
| 0
| 6
| 6
| 19
| 8
| 11
| null | null |
yarbroughw/advent
|
src/Day3.hs
|
bsd-3-clause
|
part1 :: [Direction] -> Int
part1 directions = numDistinct houses
where houses = travel directions
| 102
|
part1 :: [Direction] -> Int
part1 directions = numDistinct houses
where houses = travel directions
| 102
|
part1 directions = numDistinct houses
where houses = travel directions
| 74
| false
| true
| 0
| 6
| 18
| 38
| 18
| 20
| null | null |
zerobuzz/hs-webdriver
|
src/Test/WebDriver/Monad.hs
|
bsd-3-clause
|
-- |Prints a history of API requests to stdout after computing the given action.
dumpSessionHistory :: WDSessionStateControl wd => wd a -> wd a
dumpSessionHistory = (`finally` (getSession >>= liftBase . print . wdSessHist))
| 223
|
dumpSessionHistory :: WDSessionStateControl wd => wd a -> wd a
dumpSessionHistory = (`finally` (getSession >>= liftBase . print . wdSessHist))
| 142
|
dumpSessionHistory = (`finally` (getSession >>= liftBase . print . wdSessHist))
| 79
| true
| true
| 0
| 9
| 33
| 50
| 27
| 23
| null | null |
brendanhay/gogol
|
gogol-people/gen/Network/Google/Resource/People/People/UpdateContactPhoto.hs
|
mpl-2.0
|
-- | V1 error format.
pucpXgafv :: Lens' PeopleUpdateContactPhoto (Maybe Xgafv)
pucpXgafv
= lens _pucpXgafv (\ s a -> s{_pucpXgafv = a})
| 138
|
pucpXgafv :: Lens' PeopleUpdateContactPhoto (Maybe Xgafv)
pucpXgafv
= lens _pucpXgafv (\ s a -> s{_pucpXgafv = a})
| 116
|
pucpXgafv
= lens _pucpXgafv (\ s a -> s{_pucpXgafv = a})
| 58
| true
| true
| 0
| 9
| 23
| 48
| 25
| 23
| null | null |
jacendfeng/OpenJDK-7U-Research
|
src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
|
gpl-2.0
|
ffitype W32 Nulong = UINT32
| 27
|
ffitype W32 Nulong = UINT32
| 27
|
ffitype W32 Nulong = UINT32
| 27
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
Mokosha/Lambency
|
lib/Lambency/Transform.hs
|
mit
|
fromForwardUp :: Vec3f -> Vec3f -> CoordinateBasis
fromForwardUp f u =
let
r = u `cross` f
u' = f `cross` r
in (r, u', f)
| 133
|
fromForwardUp :: Vec3f -> Vec3f -> CoordinateBasis
fromForwardUp f u =
let
r = u `cross` f
u' = f `cross` r
in (r, u', f)
| 133
|
fromForwardUp f u =
let
r = u `cross` f
u' = f `cross` r
in (r, u', f)
| 82
| false
| true
| 0
| 9
| 37
| 61
| 34
| 27
| null | null |
bmillwood/stepeval
|
src/Language/Haskell/Stepeval.hs
|
bsd-3-clause
|
liftE :: (Exp -> Exp) -> EvalStep -> EvalStep
liftE f (Step (Eval e)) = Step (Eval (f e))
| 89
|
liftE :: (Exp -> Exp) -> EvalStep -> EvalStep
liftE f (Step (Eval e)) = Step (Eval (f e))
| 89
|
liftE f (Step (Eval e)) = Step (Eval (f e))
| 43
| false
| true
| 0
| 9
| 18
| 58
| 29
| 29
| null | null |
zhensydow/ljcsandbox
|
lang/haskell/euler/completed/problem078.hs
|
gpl-3.0
|
penta = f . k
| 13
|
penta = f . k
| 13
|
penta = f . k
| 13
| false
| false
| 0
| 5
| 4
| 10
| 5
| 5
| null | null |
bitemyapp/hakaru
|
Language/Hakaru/Linter.hs
|
bsd-3-clause
|
applyPairs ((Linter a,Linter b):xs) =
apply2 (Linter $ and [a,b]) (applyPairs xs)
| 85
|
applyPairs ((Linter a,Linter b):xs) =
apply2 (Linter $ and [a,b]) (applyPairs xs)
| 85
|
applyPairs ((Linter a,Linter b):xs) =
apply2 (Linter $ and [a,b]) (applyPairs xs)
| 85
| false
| false
| 0
| 9
| 15
| 57
| 28
| 29
| null | null |
klarh/hasdy
|
test/test.hs
|
apache-2.0
|
typ = ParticleType 0
| 20
|
typ = ParticleType 0
| 20
|
typ = ParticleType 0
| 20
| false
| false
| 1
| 5
| 3
| 12
| 4
| 8
| null | null |
zhengqm/scheme
|
src/LispTypes.hs
|
bsd-3-clause
|
trapError action = catchError action (return . show)
| 60
|
trapError action = catchError action (return . show)
| 60
|
trapError action = catchError action (return . show)
| 60
| false
| false
| 1
| 7
| 15
| 24
| 10
| 14
| null | null |
LouisJenkinsCS/Minimal-JVM
|
MateVMRuntime/MockBlockAllocation.hs
|
bsd-3-clause
|
mkBlockIO :: Int -> AllocIOT Block
mkBlockIO size = do
ptr <- liftIO $ mallocBytes size
let block = Block { beginPtr = ptrToIntPtr ptr,
endPtr = ptrToIntPtr $ ptr `plusPtr` size,
freePtr = ptrToIntPtr ptr }
liftIO $ printfGc $ printf "made block: %s\n" (show block)
return block
| 332
|
mkBlockIO :: Int -> AllocIOT Block
mkBlockIO size = do
ptr <- liftIO $ mallocBytes size
let block = Block { beginPtr = ptrToIntPtr ptr,
endPtr = ptrToIntPtr $ ptr `plusPtr` size,
freePtr = ptrToIntPtr ptr }
liftIO $ printfGc $ printf "made block: %s\n" (show block)
return block
| 332
|
mkBlockIO size = do
ptr <- liftIO $ mallocBytes size
let block = Block { beginPtr = ptrToIntPtr ptr,
endPtr = ptrToIntPtr $ ptr `plusPtr` size,
freePtr = ptrToIntPtr ptr }
liftIO $ printfGc $ printf "made block: %s\n" (show block)
return block
| 297
| false
| true
| 0
| 13
| 102
| 108
| 53
| 55
| null | null |
kim/amazonka
|
amazonka-cloudwatch/gen/Network/AWS/CloudWatch/Types.hs
|
mpl-2.0
|
-- | The namespace of alarm's associated metric.
maNamespace :: Lens' MetricAlarm (Maybe Text)
maNamespace = lens _maNamespace (\s a -> s { _maNamespace = a })
| 159
|
maNamespace :: Lens' MetricAlarm (Maybe Text)
maNamespace = lens _maNamespace (\s a -> s { _maNamespace = a })
| 110
|
maNamespace = lens _maNamespace (\s a -> s { _maNamespace = a })
| 64
| true
| true
| 1
| 9
| 26
| 51
| 25
| 26
| null | null |
brendanhay/gogol
|
gogol-cloudiot/gen/Network/Google/CloudIOT/Types/Product.hs
|
mpl-2.0
|
-- | Optional. Title for the expression, i.e. a short string describing its
-- purpose. This can be used e.g. in UIs which allow to enter the
-- expression.
eTitle :: Lens' Expr (Maybe Text)
eTitle = lens _eTitle (\ s a -> s{_eTitle = a})
| 238
|
eTitle :: Lens' Expr (Maybe Text)
eTitle = lens _eTitle (\ s a -> s{_eTitle = a})
| 81
|
eTitle = lens _eTitle (\ s a -> s{_eTitle = a})
| 47
| true
| true
| 1
| 9
| 45
| 53
| 27
| 26
| null | null |
ndmitchell/hlint
|
src/Hint/ListRec.hs
|
bsd-3-clause
|
asDo (L _ (HsDo _ (DoExpr _) (L _ stmts))) = stmts
| 50
|
asDo (L _ (HsDo _ (DoExpr _) (L _ stmts))) = stmts
| 50
|
asDo (L _ (HsDo _ (DoExpr _) (L _ stmts))) = stmts
| 50
| false
| false
| 0
| 11
| 11
| 41
| 20
| 21
| null | null |
amcphail/hsignal
|
lib/Numeric/Signal.hs
|
bsd-3-clause
|
resize :: S.Filterable a => Int -> Vector a -> Vector a
resize n v = S.downsample_ (size v `div` n) v
| 101
|
resize :: S.Filterable a => Int -> Vector a -> Vector a
resize n v = S.downsample_ (size v `div` n) v
| 101
|
resize n v = S.downsample_ (size v `div` n) v
| 45
| false
| true
| 0
| 9
| 21
| 62
| 29
| 33
| null | null |
spinda/liquidhaskell
|
tests/gsoc15/unknown/pos/ConstraintsAppend.hs
|
bsd-3-clause
|
quicksort (x:xs) = xsle ++ (x:xsge)
where xsle = quicksort (takeL x xs)
xsge = quicksort (takeGE x xs)
| 112
|
quicksort (x:xs) = xsle ++ (x:xsge)
where xsle = quicksort (takeL x xs)
xsge = quicksort (takeGE x xs)
| 112
|
quicksort (x:xs) = xsle ++ (x:xsge)
where xsle = quicksort (takeL x xs)
xsge = quicksort (takeGE x xs)
| 112
| false
| false
| 4
| 7
| 28
| 71
| 31
| 40
| null | null |
idf/haskell-examples
|
fundamentals/7_own_types_typeclasses.hs
|
bsd-3-clause
|
-- | range since Bounded
entireDays = [minBound .. maxBound] :: [Day]
| 69
|
entireDays = [minBound .. maxBound] :: [Day]
| 44
|
entireDays = [minBound .. maxBound] :: [Day]
| 44
| true
| false
| 0
| 5
| 11
| 22
| 13
| 9
| null | null |
mettekou/ghc
|
compiler/nativeGen/AsmCodeGen.hs
|
bsd-3-clause
|
cmmExprCon dflags (CmmMachOp mop args)
= cmmMachOpFold dflags mop (map (cmmExprCon dflags) args)
| 100
|
cmmExprCon dflags (CmmMachOp mop args)
= cmmMachOpFold dflags mop (map (cmmExprCon dflags) args)
| 100
|
cmmExprCon dflags (CmmMachOp mop args)
= cmmMachOpFold dflags mop (map (cmmExprCon dflags) args)
| 100
| false
| false
| 0
| 8
| 16
| 44
| 19
| 25
| null | null |
headprogrammingczar/cabal
|
cabal-install/tests/IntegrationTests2.hs
|
bsd-3-clause
|
testExceptionInBuildStep :: ProjectConfig -> Assertion
testExceptionInBuildStep config = do
plan <- planProject testdir config
plan' <- executePlan plan
(_pkga1, failure) <- expectPackageFailed plan' pkgidA1
expectBuildFailed failure
where
testdir = "exception/build"
pkgidA1 = PackageIdentifier (PackageName "a") (Version [1] [])
| 357
|
testExceptionInBuildStep :: ProjectConfig -> Assertion
testExceptionInBuildStep config = do
plan <- planProject testdir config
plan' <- executePlan plan
(_pkga1, failure) <- expectPackageFailed plan' pkgidA1
expectBuildFailed failure
where
testdir = "exception/build"
pkgidA1 = PackageIdentifier (PackageName "a") (Version [1] [])
| 357
|
testExceptionInBuildStep config = do
plan <- planProject testdir config
plan' <- executePlan plan
(_pkga1, failure) <- expectPackageFailed plan' pkgidA1
expectBuildFailed failure
where
testdir = "exception/build"
pkgidA1 = PackageIdentifier (PackageName "a") (Version [1] [])
| 302
| false
| true
| 0
| 8
| 64
| 101
| 48
| 53
| null | null |
geophf/1HaskellADay
|
exercises/HAD/Y2020/M07/D14/Exercise.hs
|
mit
|
-- given the recent history (obtained from history function from yesterday),
-- pairs returns the aggregate of teams in that history
paired :: Member -> [Team] -> [Member]
paired x teams = undefined
| 199
|
paired :: Member -> [Team] -> [Member]
paired x teams = undefined
| 65
|
paired x teams = undefined
| 26
| true
| true
| 0
| 7
| 33
| 32
| 18
| 14
| null | null |
danipozodg/dependency
|
AVLDictionary.hs
|
gpl-3.0
|
foldValues :: (b -> c -> c) -> c -> Dictionary a b -> c
foldValues f z (D avl) = T.foldInOrder (f . value) z avl
| 114
|
foldValues :: (b -> c -> c) -> c -> Dictionary a b -> c
foldValues f z (D avl) = T.foldInOrder (f . value) z avl
| 113
|
foldValues f z (D avl) = T.foldInOrder (f . value) z avl
| 57
| false
| true
| 0
| 8
| 28
| 74
| 35
| 39
| null | null |
gust/feature-creature
|
feature-creature/backend/app/Repositories/Query.hs
|
mit
|
toAppRepos :: Vector GH.Repo -> [Repository]
toAppRepos = V.toList . (V.map toRepository)
| 89
|
toAppRepos :: Vector GH.Repo -> [Repository]
toAppRepos = V.toList . (V.map toRepository)
| 89
|
toAppRepos = V.toList . (V.map toRepository)
| 44
| false
| true
| 1
| 8
| 11
| 45
| 20
| 25
| null | null |
gcampax/ghc
|
compiler/hsSyn/HsTypes.hs
|
bsd-3-clause
|
ppr_mono_ty _ (HsTyVar name) = pprPrefixOcc name
| 56
|
ppr_mono_ty _ (HsTyVar name) = pprPrefixOcc name
| 56
|
ppr_mono_ty _ (HsTyVar name) = pprPrefixOcc name
| 56
| false
| false
| 1
| 6
| 14
| 22
| 9
| 13
| null | null |
lpsmith/blaze-builder-compat
|
src/Blaze/ByteString/Builder/Word.hs
|
bsd-3-clause
|
fromWord16be :: Word16 -> Builder
fromWord16be = B.word16BE
| 61
|
fromWord16be :: Word16 -> Builder
fromWord16be = B.word16BE
| 61
|
fromWord16be = B.word16BE
| 25
| false
| true
| 0
| 7
| 9
| 24
| 10
| 14
| null | null |
edsko/cabal
|
cabal-install/tests/UnitTests/Distribution/Client/Dependency/Modular/DSL.hs
|
bsd-3-clause
|
exAvSrcPkg :: ExampleAvailable -> SourcePackage
exAvSrcPkg ex =
let (libraryDeps, testSuites, exts, mlang) = splitTopLevel (CD.libraryDeps (exAvDeps ex))
in SourcePackage {
packageInfoId = exAvPkgId ex
, packageSource = LocalTarballPackage "<<path>>"
, packageDescrOverride = Nothing
, packageDescription = C.GenericPackageDescription {
C.packageDescription = C.emptyPackageDescription {
C.package = exAvPkgId ex
, C.library = error "not yet configured: library"
, C.executables = error "not yet configured: executables"
, C.testSuites = error "not yet configured: testSuites"
, C.benchmarks = error "not yet configured: benchmarks"
, C.buildDepends = error "not yet configured: buildDepends"
, C.setupBuildInfo = Just C.SetupBuildInfo {
C.setupDepends = mkSetupDeps (CD.setupDeps (exAvDeps ex))
}
}
, C.genPackageFlags = nub $ concatMap extractFlags
(CD.libraryDeps (exAvDeps ex))
, C.condLibrary = Just $ mkCondTree (extsLib exts <> langLib mlang)
disableLib
(Buildable libraryDeps)
, C.condExecutables = []
, C.condTestSuites =
let mkTree = mkCondTree mempty disableTest . Buildable
in map (\(t, deps) -> (t, mkTree deps)) testSuites
, C.condBenchmarks = []
}
}
where
-- Split the set of dependencies into the set of dependencies of the library,
-- the dependencies of the test suites and extensions.
splitTopLevel :: [ExampleDependency]
-> ( [ExampleDependency]
, [(ExampleTestName, [ExampleDependency])]
, [Extension]
, Maybe Language
)
splitTopLevel [] =
([], [], [], Nothing)
splitTopLevel (ExTest t a:deps) =
let (other, testSuites, exts, lang) = splitTopLevel deps
in (other, (t, a):testSuites, exts, lang)
splitTopLevel (ExExt ext:deps) =
let (other, testSuites, exts, lang) = splitTopLevel deps
in (other, testSuites, ext:exts, lang)
splitTopLevel (ExLang lang:deps) =
case splitTopLevel deps of
(other, testSuites, exts, Nothing) -> (other, testSuites, exts, Just lang)
_ -> error "Only 1 Language dependency is supported"
splitTopLevel (dep:deps) =
let (other, testSuites, exts, lang) = splitTopLevel deps
in (dep:other, testSuites, exts, lang)
-- Extract the total set of flags used
extractFlags :: ExampleDependency -> [C.Flag]
extractFlags (ExAny _) = []
extractFlags (ExFix _ _) = []
extractFlags (ExFlag f a b) = C.MkFlag {
C.flagName = C.FlagName f
, C.flagDescription = ""
, C.flagDefault = True
, C.flagManual = False
}
: concatMap extractFlags (deps a ++ deps b)
where
deps :: Dependencies -> [ExampleDependency]
deps NotBuildable = []
deps (Buildable ds) = ds
extractFlags (ExTest _ a) = concatMap extractFlags a
extractFlags (ExExt _) = []
extractFlags (ExLang _) = []
mkCondTree :: Monoid a => a -> (a -> a) -> Dependencies -> DependencyTree a
mkCondTree x dontBuild NotBuildable =
C.CondNode {
C.condTreeData = dontBuild x
, C.condTreeConstraints = []
, C.condTreeComponents = []
}
mkCondTree x dontBuild (Buildable deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in C.CondNode {
C.condTreeData = x -- Necessary for language extensions
, C.condTreeConstraints = map mkDirect directDeps
, C.condTreeComponents = map (mkFlagged dontBuild) flaggedDeps
}
mkDirect :: (ExamplePkgName, Maybe ExamplePkgVersion) -> C.Dependency
mkDirect (dep, Nothing) = C.Dependency (C.PackageName dep) C.anyVersion
mkDirect (dep, Just n) = C.Dependency (C.PackageName dep) (C.thisVersion v)
where
v = Version [n, 0, 0] []
mkFlagged :: Monoid a
=> (a -> a)
-> (ExampleFlagName, Dependencies, Dependencies)
-> (C.Condition C.ConfVar
, DependencyTree a, Maybe (DependencyTree a))
mkFlagged dontBuild (f, a, b) = ( C.Var (C.Flag (C.FlagName f))
, mkCondTree mempty dontBuild a
, Just (mkCondTree mempty dontBuild b)
)
-- Split a set of dependencies into direct dependencies and flagged
-- dependencies. A direct dependency is a tuple of the name of package and
-- maybe its version (no version means any version) meant to be converted
-- to a 'C.Dependency' with 'mkDirect' for example. A flagged dependency is
-- the set of dependencies guarded by a flag.
--
-- TODO: Take care of flagged language extensions and language flavours.
splitDeps :: [ExampleDependency]
-> ( [(ExamplePkgName, Maybe Int)]
, [(ExampleFlagName, Dependencies, Dependencies)]
)
splitDeps [] =
([], [])
splitDeps (ExAny p:deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in ((p, Nothing):directDeps, flaggedDeps)
splitDeps (ExFix p v:deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in ((p, Just v):directDeps, flaggedDeps)
splitDeps (ExFlag f a b:deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in (directDeps, (f, a, b):flaggedDeps)
splitDeps (ExTest _ _:_) =
error "Unexpected nested test"
splitDeps (_:deps) = splitDeps deps
-- Currently we only support simple setup dependencies
mkSetupDeps :: [ExampleDependency] -> [C.Dependency]
mkSetupDeps deps =
let (directDeps, []) = splitDeps deps in map mkDirect directDeps
-- A 'C.Library' with just the given extensions in its 'BuildInfo'
extsLib :: [Extension] -> C.Library
extsLib es = mempty { C.libBuildInfo = mempty { C.otherExtensions = es } }
-- A 'C.Library' with just the given extensions in its 'BuildInfo'
langLib :: Maybe Language -> C.Library
langLib (Just lang) = mempty { C.libBuildInfo = mempty { C.defaultLanguage = Just lang } }
langLib _ = mempty
disableLib :: C.Library -> C.Library
disableLib lib =
lib { C.libBuildInfo = (C.libBuildInfo lib) { C.buildable = False }}
disableTest :: C.TestSuite -> C.TestSuite
disableTest test =
test { C.testBuildInfo = (C.testBuildInfo test) { C.buildable = False }}
| 7,128
|
exAvSrcPkg :: ExampleAvailable -> SourcePackage
exAvSrcPkg ex =
let (libraryDeps, testSuites, exts, mlang) = splitTopLevel (CD.libraryDeps (exAvDeps ex))
in SourcePackage {
packageInfoId = exAvPkgId ex
, packageSource = LocalTarballPackage "<<path>>"
, packageDescrOverride = Nothing
, packageDescription = C.GenericPackageDescription {
C.packageDescription = C.emptyPackageDescription {
C.package = exAvPkgId ex
, C.library = error "not yet configured: library"
, C.executables = error "not yet configured: executables"
, C.testSuites = error "not yet configured: testSuites"
, C.benchmarks = error "not yet configured: benchmarks"
, C.buildDepends = error "not yet configured: buildDepends"
, C.setupBuildInfo = Just C.SetupBuildInfo {
C.setupDepends = mkSetupDeps (CD.setupDeps (exAvDeps ex))
}
}
, C.genPackageFlags = nub $ concatMap extractFlags
(CD.libraryDeps (exAvDeps ex))
, C.condLibrary = Just $ mkCondTree (extsLib exts <> langLib mlang)
disableLib
(Buildable libraryDeps)
, C.condExecutables = []
, C.condTestSuites =
let mkTree = mkCondTree mempty disableTest . Buildable
in map (\(t, deps) -> (t, mkTree deps)) testSuites
, C.condBenchmarks = []
}
}
where
-- Split the set of dependencies into the set of dependencies of the library,
-- the dependencies of the test suites and extensions.
splitTopLevel :: [ExampleDependency]
-> ( [ExampleDependency]
, [(ExampleTestName, [ExampleDependency])]
, [Extension]
, Maybe Language
)
splitTopLevel [] =
([], [], [], Nothing)
splitTopLevel (ExTest t a:deps) =
let (other, testSuites, exts, lang) = splitTopLevel deps
in (other, (t, a):testSuites, exts, lang)
splitTopLevel (ExExt ext:deps) =
let (other, testSuites, exts, lang) = splitTopLevel deps
in (other, testSuites, ext:exts, lang)
splitTopLevel (ExLang lang:deps) =
case splitTopLevel deps of
(other, testSuites, exts, Nothing) -> (other, testSuites, exts, Just lang)
_ -> error "Only 1 Language dependency is supported"
splitTopLevel (dep:deps) =
let (other, testSuites, exts, lang) = splitTopLevel deps
in (dep:other, testSuites, exts, lang)
-- Extract the total set of flags used
extractFlags :: ExampleDependency -> [C.Flag]
extractFlags (ExAny _) = []
extractFlags (ExFix _ _) = []
extractFlags (ExFlag f a b) = C.MkFlag {
C.flagName = C.FlagName f
, C.flagDescription = ""
, C.flagDefault = True
, C.flagManual = False
}
: concatMap extractFlags (deps a ++ deps b)
where
deps :: Dependencies -> [ExampleDependency]
deps NotBuildable = []
deps (Buildable ds) = ds
extractFlags (ExTest _ a) = concatMap extractFlags a
extractFlags (ExExt _) = []
extractFlags (ExLang _) = []
mkCondTree :: Monoid a => a -> (a -> a) -> Dependencies -> DependencyTree a
mkCondTree x dontBuild NotBuildable =
C.CondNode {
C.condTreeData = dontBuild x
, C.condTreeConstraints = []
, C.condTreeComponents = []
}
mkCondTree x dontBuild (Buildable deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in C.CondNode {
C.condTreeData = x -- Necessary for language extensions
, C.condTreeConstraints = map mkDirect directDeps
, C.condTreeComponents = map (mkFlagged dontBuild) flaggedDeps
}
mkDirect :: (ExamplePkgName, Maybe ExamplePkgVersion) -> C.Dependency
mkDirect (dep, Nothing) = C.Dependency (C.PackageName dep) C.anyVersion
mkDirect (dep, Just n) = C.Dependency (C.PackageName dep) (C.thisVersion v)
where
v = Version [n, 0, 0] []
mkFlagged :: Monoid a
=> (a -> a)
-> (ExampleFlagName, Dependencies, Dependencies)
-> (C.Condition C.ConfVar
, DependencyTree a, Maybe (DependencyTree a))
mkFlagged dontBuild (f, a, b) = ( C.Var (C.Flag (C.FlagName f))
, mkCondTree mempty dontBuild a
, Just (mkCondTree mempty dontBuild b)
)
-- Split a set of dependencies into direct dependencies and flagged
-- dependencies. A direct dependency is a tuple of the name of package and
-- maybe its version (no version means any version) meant to be converted
-- to a 'C.Dependency' with 'mkDirect' for example. A flagged dependency is
-- the set of dependencies guarded by a flag.
--
-- TODO: Take care of flagged language extensions and language flavours.
splitDeps :: [ExampleDependency]
-> ( [(ExamplePkgName, Maybe Int)]
, [(ExampleFlagName, Dependencies, Dependencies)]
)
splitDeps [] =
([], [])
splitDeps (ExAny p:deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in ((p, Nothing):directDeps, flaggedDeps)
splitDeps (ExFix p v:deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in ((p, Just v):directDeps, flaggedDeps)
splitDeps (ExFlag f a b:deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in (directDeps, (f, a, b):flaggedDeps)
splitDeps (ExTest _ _:_) =
error "Unexpected nested test"
splitDeps (_:deps) = splitDeps deps
-- Currently we only support simple setup dependencies
mkSetupDeps :: [ExampleDependency] -> [C.Dependency]
mkSetupDeps deps =
let (directDeps, []) = splitDeps deps in map mkDirect directDeps
-- A 'C.Library' with just the given extensions in its 'BuildInfo'
extsLib :: [Extension] -> C.Library
extsLib es = mempty { C.libBuildInfo = mempty { C.otherExtensions = es } }
-- A 'C.Library' with just the given extensions in its 'BuildInfo'
langLib :: Maybe Language -> C.Library
langLib (Just lang) = mempty { C.libBuildInfo = mempty { C.defaultLanguage = Just lang } }
langLib _ = mempty
disableLib :: C.Library -> C.Library
disableLib lib =
lib { C.libBuildInfo = (C.libBuildInfo lib) { C.buildable = False }}
disableTest :: C.TestSuite -> C.TestSuite
disableTest test =
test { C.testBuildInfo = (C.testBuildInfo test) { C.buildable = False }}
| 7,128
|
exAvSrcPkg ex =
let (libraryDeps, testSuites, exts, mlang) = splitTopLevel (CD.libraryDeps (exAvDeps ex))
in SourcePackage {
packageInfoId = exAvPkgId ex
, packageSource = LocalTarballPackage "<<path>>"
, packageDescrOverride = Nothing
, packageDescription = C.GenericPackageDescription {
C.packageDescription = C.emptyPackageDescription {
C.package = exAvPkgId ex
, C.library = error "not yet configured: library"
, C.executables = error "not yet configured: executables"
, C.testSuites = error "not yet configured: testSuites"
, C.benchmarks = error "not yet configured: benchmarks"
, C.buildDepends = error "not yet configured: buildDepends"
, C.setupBuildInfo = Just C.SetupBuildInfo {
C.setupDepends = mkSetupDeps (CD.setupDeps (exAvDeps ex))
}
}
, C.genPackageFlags = nub $ concatMap extractFlags
(CD.libraryDeps (exAvDeps ex))
, C.condLibrary = Just $ mkCondTree (extsLib exts <> langLib mlang)
disableLib
(Buildable libraryDeps)
, C.condExecutables = []
, C.condTestSuites =
let mkTree = mkCondTree mempty disableTest . Buildable
in map (\(t, deps) -> (t, mkTree deps)) testSuites
, C.condBenchmarks = []
}
}
where
-- Split the set of dependencies into the set of dependencies of the library,
-- the dependencies of the test suites and extensions.
splitTopLevel :: [ExampleDependency]
-> ( [ExampleDependency]
, [(ExampleTestName, [ExampleDependency])]
, [Extension]
, Maybe Language
)
splitTopLevel [] =
([], [], [], Nothing)
splitTopLevel (ExTest t a:deps) =
let (other, testSuites, exts, lang) = splitTopLevel deps
in (other, (t, a):testSuites, exts, lang)
splitTopLevel (ExExt ext:deps) =
let (other, testSuites, exts, lang) = splitTopLevel deps
in (other, testSuites, ext:exts, lang)
splitTopLevel (ExLang lang:deps) =
case splitTopLevel deps of
(other, testSuites, exts, Nothing) -> (other, testSuites, exts, Just lang)
_ -> error "Only 1 Language dependency is supported"
splitTopLevel (dep:deps) =
let (other, testSuites, exts, lang) = splitTopLevel deps
in (dep:other, testSuites, exts, lang)
-- Extract the total set of flags used
extractFlags :: ExampleDependency -> [C.Flag]
extractFlags (ExAny _) = []
extractFlags (ExFix _ _) = []
extractFlags (ExFlag f a b) = C.MkFlag {
C.flagName = C.FlagName f
, C.flagDescription = ""
, C.flagDefault = True
, C.flagManual = False
}
: concatMap extractFlags (deps a ++ deps b)
where
deps :: Dependencies -> [ExampleDependency]
deps NotBuildable = []
deps (Buildable ds) = ds
extractFlags (ExTest _ a) = concatMap extractFlags a
extractFlags (ExExt _) = []
extractFlags (ExLang _) = []
mkCondTree :: Monoid a => a -> (a -> a) -> Dependencies -> DependencyTree a
mkCondTree x dontBuild NotBuildable =
C.CondNode {
C.condTreeData = dontBuild x
, C.condTreeConstraints = []
, C.condTreeComponents = []
}
mkCondTree x dontBuild (Buildable deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in C.CondNode {
C.condTreeData = x -- Necessary for language extensions
, C.condTreeConstraints = map mkDirect directDeps
, C.condTreeComponents = map (mkFlagged dontBuild) flaggedDeps
}
mkDirect :: (ExamplePkgName, Maybe ExamplePkgVersion) -> C.Dependency
mkDirect (dep, Nothing) = C.Dependency (C.PackageName dep) C.anyVersion
mkDirect (dep, Just n) = C.Dependency (C.PackageName dep) (C.thisVersion v)
where
v = Version [n, 0, 0] []
mkFlagged :: Monoid a
=> (a -> a)
-> (ExampleFlagName, Dependencies, Dependencies)
-> (C.Condition C.ConfVar
, DependencyTree a, Maybe (DependencyTree a))
mkFlagged dontBuild (f, a, b) = ( C.Var (C.Flag (C.FlagName f))
, mkCondTree mempty dontBuild a
, Just (mkCondTree mempty dontBuild b)
)
-- Split a set of dependencies into direct dependencies and flagged
-- dependencies. A direct dependency is a tuple of the name of package and
-- maybe its version (no version means any version) meant to be converted
-- to a 'C.Dependency' with 'mkDirect' for example. A flagged dependency is
-- the set of dependencies guarded by a flag.
--
-- TODO: Take care of flagged language extensions and language flavours.
splitDeps :: [ExampleDependency]
-> ( [(ExamplePkgName, Maybe Int)]
, [(ExampleFlagName, Dependencies, Dependencies)]
)
splitDeps [] =
([], [])
splitDeps (ExAny p:deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in ((p, Nothing):directDeps, flaggedDeps)
splitDeps (ExFix p v:deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in ((p, Just v):directDeps, flaggedDeps)
splitDeps (ExFlag f a b:deps) =
let (directDeps, flaggedDeps) = splitDeps deps
in (directDeps, (f, a, b):flaggedDeps)
splitDeps (ExTest _ _:_) =
error "Unexpected nested test"
splitDeps (_:deps) = splitDeps deps
-- Currently we only support simple setup dependencies
mkSetupDeps :: [ExampleDependency] -> [C.Dependency]
mkSetupDeps deps =
let (directDeps, []) = splitDeps deps in map mkDirect directDeps
-- A 'C.Library' with just the given extensions in its 'BuildInfo'
extsLib :: [Extension] -> C.Library
extsLib es = mempty { C.libBuildInfo = mempty { C.otherExtensions = es } }
-- A 'C.Library' with just the given extensions in its 'BuildInfo'
langLib :: Maybe Language -> C.Library
langLib (Just lang) = mempty { C.libBuildInfo = mempty { C.defaultLanguage = Just lang } }
langLib _ = mempty
disableLib :: C.Library -> C.Library
disableLib lib =
lib { C.libBuildInfo = (C.libBuildInfo lib) { C.buildable = False }}
disableTest :: C.TestSuite -> C.TestSuite
disableTest test =
test { C.testBuildInfo = (C.testBuildInfo test) { C.buildable = False }}
| 7,080
| false
| true
| 0
| 20
| 2,456
| 1,866
| 1,006
| 860
| null | null |
atsukotakahashi/wi
|
sketches/IncrementalParser.hs
|
gpl-2.0
|
repair ((Bin l x p err rl rr), over)
| not err = ((Bin l x p err rl rr), over)
-- if left is still in error, don't bother reparsing (we're as good with the current parse)
| hasErr rl' = ((Bin l x p err rl rr), over)
| otherwise = ((Bin l' x' p err' rl' rr'), over')
where (rl', overl) = repair (rl, getSymbols rr ++ over)
(rr', over') = if getLength rl == getLength rl'
then repair (rr, over)
else pexec (getParser rr) overl
-- when the length of left is different, we cannot re-use the parser for right side.
x' = (getResult rl') (getResult rr')
l' = getLength rl' + getLength rr'
err' = hasErr rl' || hasErr rr'
-------------------------------
-- Example
| 807
|
repair ((Bin l x p err rl rr), over)
| not err = ((Bin l x p err rl rr), over)
-- if left is still in error, don't bother reparsing (we're as good with the current parse)
| hasErr rl' = ((Bin l x p err rl rr), over)
| otherwise = ((Bin l' x' p err' rl' rr'), over')
where (rl', overl) = repair (rl, getSymbols rr ++ over)
(rr', over') = if getLength rl == getLength rl'
then repair (rr, over)
else pexec (getParser rr) overl
-- when the length of left is different, we cannot re-use the parser for right side.
x' = (getResult rl') (getResult rr')
l' = getLength rl' + getLength rr'
err' = hasErr rl' || hasErr rr'
-------------------------------
-- Example
| 807
|
repair ((Bin l x p err rl rr), over)
| not err = ((Bin l x p err rl rr), over)
-- if left is still in error, don't bother reparsing (we're as good with the current parse)
| hasErr rl' = ((Bin l x p err rl rr), over)
| otherwise = ((Bin l' x' p err' rl' rr'), over')
where (rl', overl) = repair (rl, getSymbols rr ++ over)
(rr', over') = if getLength rl == getLength rl'
then repair (rr, over)
else pexec (getParser rr) overl
-- when the length of left is different, we cannot re-use the parser for right side.
x' = (getResult rl') (getResult rr')
l' = getLength rl' + getLength rr'
err' = hasErr rl' || hasErr rr'
-------------------------------
-- Example
| 807
| false
| false
| 6
| 8
| 278
| 276
| 137
| 139
| null | null |
urbanslug/ghc
|
testsuite/tests/lib/integer/integerConstantFolding.hs
|
bsd-3-clause
|
compareIntegerE :: Ordering
compareIntegerE = (100044 :: Integer) `compare` 100044
| 82
|
compareIntegerE :: Ordering
compareIntegerE = (100044 :: Integer) `compare` 100044
| 82
|
compareIntegerE = (100044 :: Integer) `compare` 100044
| 54
| false
| true
| 0
| 6
| 9
| 23
| 14
| 9
| null | null |
tpsinnem/Idris-dev
|
src/Idris/IdeMode.hs
|
bsd-3-clause
|
constTy (B8 _) = "Bits8"
| 24
|
constTy (B8 _) = "Bits8"
| 24
|
constTy (B8 _) = "Bits8"
| 24
| false
| false
| 0
| 6
| 4
| 16
| 7
| 9
| null | null |
nikki-and-the-robots/nikki
|
src/Base/Grounds.hs
|
lgpl-3.0
|
layerA (Foregrounds i) = foregrounds .> indexA i
| 48
|
layerA (Foregrounds i) = foregrounds .> indexA i
| 48
|
layerA (Foregrounds i) = foregrounds .> indexA i
| 48
| false
| false
| 0
| 6
| 7
| 23
| 10
| 13
| null | null |
joelburget/interplanetary-computation
|
src/Planetary/Util.hs
|
bsd-3-clause
|
localState m = do
s <- get
x <- m
put s
return x
| 64
|
localState m = do
s <- get
x <- m
put s
return x
| 64
|
localState m = do
s <- get
x <- m
put s
return x
| 64
| false
| false
| 0
| 7
| 29
| 35
| 14
| 21
| null | null |
changlinli/nikki
|
src/Graphics/Qt/CPPWrapper.hs
|
lgpl-3.0
|
-- | loads a new pixmap. Canonicalizes the path first.
newQPixmap :: FilePath -> IO (ForeignPtr QPixmap)
newQPixmap file_ = do
file <- canonicalizePath file_
exists <- doesFileExist file
when (not exists) $
error ("file does not exist: " ++ file)
-- ~ ptr <- withCString file cppNewQPixmap
ptr <- newQPixmapFromPNGData file
when (ptr == nullPtr) $
error ("could not load image file: " ++ file)
newForeignQPixmap ptr
| 459
|
newQPixmap :: FilePath -> IO (ForeignPtr QPixmap)
newQPixmap file_ = do
file <- canonicalizePath file_
exists <- doesFileExist file
when (not exists) $
error ("file does not exist: " ++ file)
-- ~ ptr <- withCString file cppNewQPixmap
ptr <- newQPixmapFromPNGData file
when (ptr == nullPtr) $
error ("could not load image file: " ++ file)
newForeignQPixmap ptr
| 404
|
newQPixmap file_ = do
file <- canonicalizePath file_
exists <- doesFileExist file
when (not exists) $
error ("file does not exist: " ++ file)
-- ~ ptr <- withCString file cppNewQPixmap
ptr <- newQPixmapFromPNGData file
when (ptr == nullPtr) $
error ("could not load image file: " ++ file)
newForeignQPixmap ptr
| 354
| true
| true
| 0
| 10
| 111
| 118
| 54
| 64
| null | null |
geophf/1HaskellADay
|
exercises/HAD/Y2020/M11/D18/Exercise.hs
|
mit
|
-- now, with the fixed wikidata set, we validate in the wikidata-set which
-- continents are "real" and which are malarky.
validateContinents :: ContinentMap -> ContinentInfoMap -> ContinentInfoMap
validateContinents mycontis fixedwiki = undefined
| 248
|
validateContinents :: ContinentMap -> ContinentInfoMap -> ContinentInfoMap
validateContinents mycontis fixedwiki = undefined
| 124
|
validateContinents mycontis fixedwiki = undefined
| 49
| true
| true
| 0
| 6
| 33
| 26
| 14
| 12
| null | null |
tobsan/yane
|
Enterprise.hs
|
gpl-3.0
|
unified cpuenv ppuenv (inp:inps) acts = do
c <- Lazy.strictToLazyST $ stepCPU cpuenv inp acts
(pxs,as) <- Lazy.strictToLazyST $ stepPPU ppuenv c
pxss <- unified cpuenv ppuenv inps as
return $ pxs ++ pxss
| 230
|
unified cpuenv ppuenv (inp:inps) acts = do
c <- Lazy.strictToLazyST $ stepCPU cpuenv inp acts
(pxs,as) <- Lazy.strictToLazyST $ stepPPU ppuenv c
pxss <- unified cpuenv ppuenv inps as
return $ pxs ++ pxss
| 230
|
unified cpuenv ppuenv (inp:inps) acts = do
c <- Lazy.strictToLazyST $ stepCPU cpuenv inp acts
(pxs,as) <- Lazy.strictToLazyST $ stepPPU ppuenv c
pxss <- unified cpuenv ppuenv inps as
return $ pxs ++ pxss
| 230
| false
| false
| 1
| 10
| 60
| 99
| 44
| 55
| null | null |
urbanslug/ghc
|
testsuite/tests/typecheck/should_run/tcrun026.hs
|
bsd-3-clause
|
my_nil = FA (L []) :: FA L
| 26
|
my_nil = FA (L []) :: FA L
| 26
|
my_nil = FA (L []) :: FA L
| 26
| false
| false
| 0
| 8
| 7
| 23
| 11
| 12
| null | null |
marcellussiegburg/autotool
|
collection/src/CSP/STS/Type.hs
|
gpl-2.0
|
all_states_are_reachable :: ( Ord s, Ord t )
=> STS s t -> Bool
all_states_are_reachable s =
let reach = R.reflex_trans
$ R.make $ do (p,a,q) <- visible s ; return(p,q)
++ do (p, q) <- hidden s ; return(p,q)
in flip all ( S.toList $ states s ) $ \ q ->
R.holds reach ( start s) q
| 364
|
all_states_are_reachable :: ( Ord s, Ord t )
=> STS s t -> Bool
all_states_are_reachable s =
let reach = R.reflex_trans
$ R.make $ do (p,a,q) <- visible s ; return(p,q)
++ do (p, q) <- hidden s ; return(p,q)
in flip all ( S.toList $ states s ) $ \ q ->
R.holds reach ( start s) q
| 364
|
all_states_are_reachable s =
let reach = R.reflex_trans
$ R.make $ do (p,a,q) <- visible s ; return(p,q)
++ do (p, q) <- hidden s ; return(p,q)
in flip all ( S.toList $ states s ) $ \ q ->
R.holds reach ( start s) q
| 271
| false
| true
| 0
| 14
| 143
| 167
| 84
| 83
| null | null |
ancientlanguage/haskell-analysis
|
grammar/src/Grammar/Common/Decompose.hs
|
mit
|
decomposeChar '\xFA8A' = "\x6160"
| 33
|
decomposeChar '\xFA8A' = "\x6160"
| 33
|
decomposeChar '\xFA8A' = "\x6160"
| 33
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
gcampax/ghc
|
compiler/codeGen/StgCmmUtils.hs
|
bsd-3-clause
|
label_code :: BlockId -> CmmAGraphScoped -> FCode BlockId
-- label_code J code
-- generates
-- [L: code; goto J]
-- and returns L
label_code join_lbl (code,tsc) = do
lbl <- newLabelC
emitOutOfLine lbl (code MkGraph.<*> mkBranch join_lbl, tsc)
return lbl
--------------
| 288
|
label_code :: BlockId -> CmmAGraphScoped -> FCode BlockId
label_code join_lbl (code,tsc) = do
lbl <- newLabelC
emitOutOfLine lbl (code MkGraph.<*> mkBranch join_lbl, tsc)
return lbl
--------------
| 209
|
label_code join_lbl (code,tsc) = do
lbl <- newLabelC
emitOutOfLine lbl (code MkGraph.<*> mkBranch join_lbl, tsc)
return lbl
--------------
| 151
| true
| true
| 0
| 10
| 60
| 74
| 38
| 36
| null | null |
jm-g/global-variables
|
test/src/Data/Global/Registry/Test.hs
|
bsd-3-clause
|
prop_pure_declare :: Eq a => (String -> () -> a) -> String -> Bool
prop_pure_declare decl n = decl n () == decl n ()
| 116
|
prop_pure_declare :: Eq a => (String -> () -> a) -> String -> Bool
prop_pure_declare decl n = decl n () == decl n ()
| 116
|
prop_pure_declare decl n = decl n () == decl n ()
| 49
| false
| true
| 0
| 10
| 24
| 62
| 30
| 32
| null | null |
input-output-hk/pos-haskell-prototype
|
db/src/Pos/DB/Update/MemState/Functions.hs
|
mit
|
-- | Add given payload to MemPool. Size is updated assuming that all added
-- data is new (is not in MemPool). This assumption is fine, because
-- duplicated data should be considered invalid anyway.
addToMemPool :: UpdatePayload -> MemPool -> MemPool
addToMemPool UpdatePayload {..} = addProposal . addVotes
where
addProposal mp =
case upProposal of
Nothing -> mp
Just up -> mp { mpProposals = HM.insert (hash up) up (mpProposals mp)
, mpSize = biSize (hash up) + biSize up + mpSize mp}
-- Here size update is not accurate, but it shouldn't matter.
addVotes mp = mp { mpLocalVotes = foldr' forceInsertVote (mpLocalVotes mp) upVotes
, mpSize = biSize upVotes + mpSize mp}
forceInsertVote :: UpdateVote -> LocalVotes -> LocalVotes
forceInsertVote vote = HM.alter (append vote) (uvProposalId vote)
append :: UpdateVote -> Maybe UpdateVotes -> Maybe UpdateVotes
append vote Nothing = Just $ HM.singleton (uvKey vote) vote
append vote (Just stVotes) = Just $ HM.insert (uvKey vote) vote stVotes
| 1,112
|
addToMemPool :: UpdatePayload -> MemPool -> MemPool
addToMemPool UpdatePayload {..} = addProposal . addVotes
where
addProposal mp =
case upProposal of
Nothing -> mp
Just up -> mp { mpProposals = HM.insert (hash up) up (mpProposals mp)
, mpSize = biSize (hash up) + biSize up + mpSize mp}
-- Here size update is not accurate, but it shouldn't matter.
addVotes mp = mp { mpLocalVotes = foldr' forceInsertVote (mpLocalVotes mp) upVotes
, mpSize = biSize upVotes + mpSize mp}
forceInsertVote :: UpdateVote -> LocalVotes -> LocalVotes
forceInsertVote vote = HM.alter (append vote) (uvProposalId vote)
append :: UpdateVote -> Maybe UpdateVotes -> Maybe UpdateVotes
append vote Nothing = Just $ HM.singleton (uvKey vote) vote
append vote (Just stVotes) = Just $ HM.insert (uvKey vote) vote stVotes
| 912
|
addToMemPool UpdatePayload {..} = addProposal . addVotes
where
addProposal mp =
case upProposal of
Nothing -> mp
Just up -> mp { mpProposals = HM.insert (hash up) up (mpProposals mp)
, mpSize = biSize (hash up) + biSize up + mpSize mp}
-- Here size update is not accurate, but it shouldn't matter.
addVotes mp = mp { mpLocalVotes = foldr' forceInsertVote (mpLocalVotes mp) upVotes
, mpSize = biSize upVotes + mpSize mp}
forceInsertVote :: UpdateVote -> LocalVotes -> LocalVotes
forceInsertVote vote = HM.alter (append vote) (uvProposalId vote)
append :: UpdateVote -> Maybe UpdateVotes -> Maybe UpdateVotes
append vote Nothing = Just $ HM.singleton (uvKey vote) vote
append vote (Just stVotes) = Just $ HM.insert (uvKey vote) vote stVotes
| 860
| true
| true
| 20
| 9
| 282
| 299
| 147
| 152
| null | null |
rodrigo-machado/verigraph
|
src/library/Data/Graphs.hs
|
gpl-3.0
|
-- | Get the edges that are incident on the current node.
-- /O(e)/, plus the cost of evaluating the nodes of the result (see 'EdgeInContext').
incidentEdges :: NodeContext n e -> [EdgeInContext n e]
incidentEdges (NodeCtx nodeId graph) =
map (edgeInContext graph)
. filter (\edge -> sourceId edge == nodeId || targetId edge == nodeId)
. map snd
$ edgeMap graph
| 369
|
incidentEdges :: NodeContext n e -> [EdgeInContext n e]
incidentEdges (NodeCtx nodeId graph) =
map (edgeInContext graph)
. filter (\edge -> sourceId edge == nodeId || targetId edge == nodeId)
. map snd
$ edgeMap graph
| 225
|
incidentEdges (NodeCtx nodeId graph) =
map (edgeInContext graph)
. filter (\edge -> sourceId edge == nodeId || targetId edge == nodeId)
. map snd
$ edgeMap graph
| 169
| true
| true
| 4
| 10
| 69
| 106
| 48
| 58
| null | null |
input-output-hk/pos-haskell-prototype
|
chain/src/Pos/Chain/Block/Util.hs
|
mit
|
checkBodyProof
:: (Buildable bodyProof, Eq bodyProof, MonadError Text m)
=> (body -> bodyProof)
-> body
-> bodyProof
-> m ()
checkBodyProof mkProof body proof = do
let calculatedProof = mkProof body
let errMsg =
sformat ("Incorrect proof of body. "%
"Proof in header: "%build%
", calculated proof: "%build)
proof calculatedProof
unless (calculatedProof == proof) $ throwError errMsg
| 482
|
checkBodyProof
:: (Buildable bodyProof, Eq bodyProof, MonadError Text m)
=> (body -> bodyProof)
-> body
-> bodyProof
-> m ()
checkBodyProof mkProof body proof = do
let calculatedProof = mkProof body
let errMsg =
sformat ("Incorrect proof of body. "%
"Proof in header: "%build%
", calculated proof: "%build)
proof calculatedProof
unless (calculatedProof == proof) $ throwError errMsg
| 482
|
checkBodyProof mkProof body proof = do
let calculatedProof = mkProof body
let errMsg =
sformat ("Incorrect proof of body. "%
"Proof in header: "%build%
", calculated proof: "%build)
proof calculatedProof
unless (calculatedProof == proof) $ throwError errMsg
| 337
| false
| true
| 0
| 16
| 156
| 137
| 65
| 72
| null | null |
brendanhay/gogol
|
gogol-vision/gen/Network/Google/Vision/Types/Product.hs
|
mpl-2.0
|
-- | If present, image properties were extracted successfully.
gImagePropertiesAnnotation :: Lens' GoogleCloudVisionV1p4beta1AnnotateImageResponse (Maybe GoogleCloudVisionV1p4beta1ImageProperties)
gImagePropertiesAnnotation
= lens _gImagePropertiesAnnotation
(\ s a -> s{_gImagePropertiesAnnotation = a})
| 312
|
gImagePropertiesAnnotation :: Lens' GoogleCloudVisionV1p4beta1AnnotateImageResponse (Maybe GoogleCloudVisionV1p4beta1ImageProperties)
gImagePropertiesAnnotation
= lens _gImagePropertiesAnnotation
(\ s a -> s{_gImagePropertiesAnnotation = a})
| 249
|
gImagePropertiesAnnotation
= lens _gImagePropertiesAnnotation
(\ s a -> s{_gImagePropertiesAnnotation = a})
| 115
| true
| true
| 0
| 8
| 33
| 49
| 25
| 24
| null | null |
mettekou/ghc
|
compiler/utils/Outputable.hs
|
bsd-3-clause
|
qualName (PprDump q) mod occ = queryQualifyName q mod occ
| 60
|
qualName (PprDump q) mod occ = queryQualifyName q mod occ
| 60
|
qualName (PprDump q) mod occ = queryQualifyName q mod occ
| 60
| false
| false
| 1
| 7
| 12
| 28
| 12
| 16
| null | null |
jaspervdj/firefly
|
src/Firefly/Input/Keys.hs
|
bsd-3-clause
|
return :: Key
return = Key 13
| 29
|
return :: Key
return = Key 13
| 29
|
return = Key 13
| 15
| false
| true
| 0
| 5
| 6
| 14
| 7
| 7
| null | null |
ruud-v-a/blog
|
src/Main.hs
|
gpl-3.0
|
-- Applies the IO-performing function f to every file in a given directory, and
-- returns a map from the file name to the result.
mapFilesFileName :: (FilePath -> IO a) -> FilePath -> IO (M.Map FilePath a)
mapFilesFileName f = (fmap M.fromList) . (mapFiles makePair)
where makePair fname = fmap (\x -> (takeFileName fname, x)) (f fname)
-- Reads and parses all templates in the given directory.
| 398
|
mapFilesFileName :: (FilePath -> IO a) -> FilePath -> IO (M.Map FilePath a)
mapFilesFileName f = (fmap M.fromList) . (mapFiles makePair)
where makePair fname = fmap (\x -> (takeFileName fname, x)) (f fname)
-- Reads and parses all templates in the given directory.
| 267
|
mapFilesFileName f = (fmap M.fromList) . (mapFiles makePair)
where makePair fname = fmap (\x -> (takeFileName fname, x)) (f fname)
-- Reads and parses all templates in the given directory.
| 191
| true
| true
| 1
| 11
| 70
| 112
| 55
| 57
| null | null |
patperry/hs-linear-algebra
|
tests-old/STVector.hs
|
bsd-3-clause
|
prop_GetElemsLazyModifyWith f =
(\x -> do { es <- getElems x ; modifyWith f x ; return es })
`implements`
getElemsLazyModifyWith_S f
| 146
|
prop_GetElemsLazyModifyWith f =
(\x -> do { es <- getElems x ; modifyWith f x ; return es })
`implements`
getElemsLazyModifyWith_S f
| 146
|
prop_GetElemsLazyModifyWith f =
(\x -> do { es <- getElems x ; modifyWith f x ; return es })
`implements`
getElemsLazyModifyWith_S f
| 146
| false
| false
| 0
| 10
| 35
| 57
| 28
| 29
| null | null |
NewByteOrder/ghcjs-base
|
test/Tests/Properties.hs
|
mit
|
j_breakOn_start (NotEmpty s) t =
let (k,m) = J.breakOn s t
in k `J.isPrefixOf` t && (J.null m || s `J.isPrefixOf` m)
| 124
|
j_breakOn_start (NotEmpty s) t =
let (k,m) = J.breakOn s t
in k `J.isPrefixOf` t && (J.null m || s `J.isPrefixOf` m)
| 124
|
j_breakOn_start (NotEmpty s) t =
let (k,m) = J.breakOn s t
in k `J.isPrefixOf` t && (J.null m || s `J.isPrefixOf` m)
| 124
| false
| false
| 0
| 12
| 29
| 74
| 38
| 36
| null | null |
erantapaa/happstack-server
|
src/Happstack/Server/Internal/Monads.hs
|
bsd-3-clause
|
extract (Append x) = x
| 22
|
extract (Append x) = x
| 22
|
extract (Append x) = x
| 22
| false
| false
| 0
| 7
| 4
| 15
| 7
| 8
| null | null |
forsyde/forsyde-shallow
|
src/ForSyDe/Shallow/Utility/PolyArith.hs
|
bsd-3-clause
|
zipWithExt (x0,y0) f (x:xs) [] = f x y0 : (zipWithExt (x0,y0) f xs [])
| 70
|
zipWithExt (x0,y0) f (x:xs) [] = f x y0 : (zipWithExt (x0,y0) f xs [])
| 70
|
zipWithExt (x0,y0) f (x:xs) [] = f x y0 : (zipWithExt (x0,y0) f xs [])
| 70
| false
| false
| 0
| 8
| 14
| 59
| 31
| 28
| null | null |
urv/fixhs
|
src/Data/FIX/Spec/FIX43.hs
|
lgpl-2.1
|
tEncodedIssuerLen :: FIXTag
tEncodedIssuerLen = FIXTag
{ tName = "EncodedIssuerLen"
, tnum = 348
, tparser = toFIXInt
, arbitraryValue = FIXInt <$> arbitrary }
| 172
|
tEncodedIssuerLen :: FIXTag
tEncodedIssuerLen = FIXTag
{ tName = "EncodedIssuerLen"
, tnum = 348
, tparser = toFIXInt
, arbitraryValue = FIXInt <$> arbitrary }
| 172
|
tEncodedIssuerLen = FIXTag
{ tName = "EncodedIssuerLen"
, tnum = 348
, tparser = toFIXInt
, arbitraryValue = FIXInt <$> arbitrary }
| 144
| false
| true
| 0
| 8
| 37
| 45
| 26
| 19
| null | null |
backofhan/HaskellExercises
|
CH23/src/Lib.hs
|
bsd-3-clause
|
--4
eval' :: Moi s a -> s -> a
eval' (Moi sa) s = let (a, _) = sa s in a
| 72
|
eval' :: Moi s a -> s -> a
eval' (Moi sa) s = let (a, _) = sa s in a
| 68
|
eval' (Moi sa) s = let (a, _) = sa s in a
| 41
| true
| true
| 0
| 9
| 22
| 57
| 28
| 29
| null | null |
jstolarek/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
setOutputDir f = setObjectDir f . setHiDir f . setStubDir f . setDumpDir f
| 75
|
setOutputDir f = setObjectDir f . setHiDir f . setStubDir f . setDumpDir f
| 75
|
setOutputDir f = setObjectDir f . setHiDir f . setStubDir f . setDumpDir f
| 75
| false
| false
| 0
| 8
| 14
| 33
| 14
| 19
| null | null |
olsner/ghc
|
compiler/cmm/CmmUtils.hs
|
bsd-3-clause
|
cmmOffset :: DynFlags -> CmmExpr -> Int -> CmmExpr
cmmOffset _ e 0 = e
| 93
|
cmmOffset :: DynFlags -> CmmExpr -> Int -> CmmExpr
cmmOffset _ e 0 = e
| 93
|
cmmOffset _ e 0 = e
| 42
| false
| true
| 0
| 7
| 37
| 30
| 15
| 15
| null | null |
raventid/coursera_learning
|
haskell/chapter15/worksheet.hs
|
mit
|
mappendingBool' :: Bool
mappendingBool' = getAny $ Any True <> Any False
| 72
|
mappendingBool' :: Bool
mappendingBool' = getAny $ Any True <> Any False
| 72
|
mappendingBool' = getAny $ Any True <> Any False
| 48
| false
| true
| 0
| 7
| 11
| 25
| 12
| 13
| null | null |
vTurbine/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
tablesNextToCode :: DynFlags -> Bool
tablesNextToCode dflags
= mkTablesNextToCode (platformUnregisterised (targetPlatform dflags))
| 134
|
tablesNextToCode :: DynFlags -> Bool
tablesNextToCode dflags
= mkTablesNextToCode (platformUnregisterised (targetPlatform dflags))
| 134
|
tablesNextToCode dflags
= mkTablesNextToCode (platformUnregisterised (targetPlatform dflags))
| 97
| false
| true
| 0
| 9
| 15
| 33
| 16
| 17
| null | null |
fjarri/wigner
|
test/TestTransformations.hs
|
bsd-3-clause
|
factory f (i, v) = f s_psi [i] [v]
| 34
|
factory f (i, v) = f s_psi [i] [v]
| 34
|
factory f (i, v) = f s_psi [i] [v]
| 34
| false
| false
| 0
| 6
| 8
| 30
| 16
| 14
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.