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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bitemyapp/ganeti | src/Ganeti/HTools/Program/Hcheck.hs | bsd-2-clause | -- | Format a list of key, value as a shell fragment.
printKeysHTC :: [(String, String)] -> IO ()
printKeysHTC = printKeys htcPrefix | 132 | printKeysHTC :: [(String, String)] -> IO ()
printKeysHTC = printKeys htcPrefix | 78 | printKeysHTC = printKeys htcPrefix | 34 | true | true | 0 | 7 | 22 | 33 | 18 | 15 | null | null |
olsner/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | matchSeparator ProcExpr = text "->" | 39 | matchSeparator ProcExpr = text "->" | 39 | matchSeparator ProcExpr = text "->" | 39 | false | false | 0 | 5 | 8 | 12 | 5 | 7 | null | null |
da-x/free | src/Control/Monad/Free.hs | bsd-3-clause | retract (Free as) = as >>= retract | 34 | retract (Free as) = as >>= retract | 34 | retract (Free as) = as >>= retract | 34 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
cobbpg/elerea | FRP/Elerea/Param.hs | bsd-3-clause | -- | Embed a generator with an overridden input signal. It is
-- equivalent to the following function:
--
-- > embed s g t_start s_input = g t_start s
--
-- Example:
--
-- > do
-- > smp <- start $ do
-- > sig <- input
-- > embed (sig*2) $ do
-- > sig <- input
-- > return (sig+1)
-- > res <- forM [4,1,3,5,2,8,6] smp
-- > print res
--
-- Output:
--
-- > [9,3,7,11,5,17,13]
embed :: Signal p' -> SignalGen p' a -> SignalGen p a
embed s (SG g) = SG $ \pool _ -> g pool s | 521 | embed :: Signal p' -> SignalGen p' a -> SignalGen p a
embed s (SG g) = SG $ \pool _ -> g pool s | 95 | embed s (SG g) = SG $ \pool _ -> g pool s | 41 | true | true | 0 | 7 | 159 | 78 | 47 | 31 | null | null |
tyler-sommer/stormy-pond | src/Pond/Data.hs | mit | outerM :: Pond -> Maybe Shimmer
outerM pond = do
id <- outer pond
Map.lookup id (ripples pond)
-- | 'searchM' returns the specified 'Shimmer' or Nothing. | 158 | outerM :: Pond -> Maybe Shimmer
outerM pond = do
id <- outer pond
Map.lookup id (ripples pond)
-- | 'searchM' returns the specified 'Shimmer' or Nothing. | 158 | outerM pond = do
id <- outer pond
Map.lookup id (ripples pond)
-- | 'searchM' returns the specified 'Shimmer' or Nothing. | 126 | false | true | 0 | 9 | 31 | 48 | 22 | 26 | null | null |
kim/amazonka | amazonka-sdb/gen/Network/AWS/SDB/GetAttributes.hs | mpl-2.0 | -- | The name of the item.
gaItemName :: Lens' GetAttributes Text
gaItemName = lens _gaItemName (\s a -> s { _gaItemName = a }) | 127 | gaItemName :: Lens' GetAttributes Text
gaItemName = lens _gaItemName (\s a -> s { _gaItemName = a }) | 100 | gaItemName = lens _gaItemName (\s a -> s { _gaItemName = a }) | 61 | true | true | 0 | 9 | 24 | 40 | 22 | 18 | null | null |
vigoo/stack | src/Stack/Build/ConstructPlan.hs | bsd-3-clause | installPackage :: Bool -- ^ is this being used by a dependency?
-> PackageName
-> PackageSource
-> Maybe Installed
-> M (Either ConstructPlanException AddDepRes)
installPackage treatAsDep name ps minstalled = do
ctx <- ask
case ps of
PSUpstream version _ flags -> do
package <- liftIO $ loadPackage ctx name version flags
resolveDepsAndInstall False treatAsDep ps package minstalled
PSLocal lp ->
case lpTestBench lp of
Nothing -> resolveDepsAndInstall False treatAsDep ps (lpPackage lp) minstalled
Just tb -> do
-- Attempt to find a plan which performs an all-in-one
-- build. Ignore the writer action + reset the state if
-- it fails.
s <- get
res <- pass $ do
res <- addPackageDeps treatAsDep tb
let writerFunc w = case res of
Left _ -> mempty
_ -> w
return (res, writerFunc)
case res of
Right deps -> do
adr <- installPackageGivenDeps True ps tb minstalled deps
-- FIXME: this redundantly adds the deps (but
-- they'll all just get looked up in the map)
addFinal lp tb True
return $ Right adr
Left _ -> do
-- Reset the state to how it was before
-- attempting to find an all-in-one build
-- plan.
put s
-- Otherwise, fall back on building the
-- tests / benchmarks in a separate step.
res' <- resolveDepsAndInstall False treatAsDep ps (lpPackage lp) minstalled
when (isRight res') $ do
-- Insert it into the map so that it's
-- available for addFinal.
modify $ Map.insert name res'
addFinal lp tb False
return res' | 2,385 | installPackage :: Bool -- ^ is this being used by a dependency?
-> PackageName
-> PackageSource
-> Maybe Installed
-> M (Either ConstructPlanException AddDepRes)
installPackage treatAsDep name ps minstalled = do
ctx <- ask
case ps of
PSUpstream version _ flags -> do
package <- liftIO $ loadPackage ctx name version flags
resolveDepsAndInstall False treatAsDep ps package minstalled
PSLocal lp ->
case lpTestBench lp of
Nothing -> resolveDepsAndInstall False treatAsDep ps (lpPackage lp) minstalled
Just tb -> do
-- Attempt to find a plan which performs an all-in-one
-- build. Ignore the writer action + reset the state if
-- it fails.
s <- get
res <- pass $ do
res <- addPackageDeps treatAsDep tb
let writerFunc w = case res of
Left _ -> mempty
_ -> w
return (res, writerFunc)
case res of
Right deps -> do
adr <- installPackageGivenDeps True ps tb minstalled deps
-- FIXME: this redundantly adds the deps (but
-- they'll all just get looked up in the map)
addFinal lp tb True
return $ Right adr
Left _ -> do
-- Reset the state to how it was before
-- attempting to find an all-in-one build
-- plan.
put s
-- Otherwise, fall back on building the
-- tests / benchmarks in a separate step.
res' <- resolveDepsAndInstall False treatAsDep ps (lpPackage lp) minstalled
when (isRight res') $ do
-- Insert it into the map so that it's
-- available for addFinal.
modify $ Map.insert name res'
addFinal lp tb False
return res' | 2,385 | installPackage treatAsDep name ps minstalled = do
ctx <- ask
case ps of
PSUpstream version _ flags -> do
package <- liftIO $ loadPackage ctx name version flags
resolveDepsAndInstall False treatAsDep ps package minstalled
PSLocal lp ->
case lpTestBench lp of
Nothing -> resolveDepsAndInstall False treatAsDep ps (lpPackage lp) minstalled
Just tb -> do
-- Attempt to find a plan which performs an all-in-one
-- build. Ignore the writer action + reset the state if
-- it fails.
s <- get
res <- pass $ do
res <- addPackageDeps treatAsDep tb
let writerFunc w = case res of
Left _ -> mempty
_ -> w
return (res, writerFunc)
case res of
Right deps -> do
adr <- installPackageGivenDeps True ps tb minstalled deps
-- FIXME: this redundantly adds the deps (but
-- they'll all just get looked up in the map)
addFinal lp tb True
return $ Right adr
Left _ -> do
-- Reset the state to how it was before
-- attempting to find an all-in-one build
-- plan.
put s
-- Otherwise, fall back on building the
-- tests / benchmarks in a separate step.
res' <- resolveDepsAndInstall False treatAsDep ps (lpPackage lp) minstalled
when (isRight res') $ do
-- Insert it into the map so that it's
-- available for addFinal.
modify $ Map.insert name res'
addFinal lp tb False
return res' | 2,163 | false | true | 0 | 25 | 1,216 | 384 | 178 | 206 | null | null |
aartifact/aartifact-verifier | src/Exp.hs | mit | updName :: Name -> Integer -> Name
updName (s,i) i' = (s,i') | 60 | updName :: Name -> Integer -> Name
updName (s,i) i' = (s,i') | 60 | updName (s,i) i' = (s,i') | 25 | false | true | 0 | 9 | 11 | 42 | 21 | 21 | null | null |
dorchard/gram_lang | frontend/src/Language/Granule/Checker/Substitution.hs | bsd-3-clause | (<<>>) :: (?globals :: Globals)
=> Maybe Substitution -> Maybe Substitution -> Checker (Maybe Substitution)
xs <<>> ys =
case (xs, ys) of
(Just xs', Just ys') ->
combineSubstitutions nullSpan xs' ys' >>= (return . Just)
_ -> return Nothing | 260 | (<<>>) :: (?globals :: Globals)
=> Maybe Substitution -> Maybe Substitution -> Checker (Maybe Substitution)
xs <<>> ys =
case (xs, ys) of
(Just xs', Just ys') ->
combineSubstitutions nullSpan xs' ys' >>= (return . Just)
_ -> return Nothing | 260 | xs <<>> ys =
case (xs, ys) of
(Just xs', Just ys') ->
combineSubstitutions nullSpan xs' ys' >>= (return . Just)
_ -> return Nothing | 150 | false | true | 0 | 12 | 60 | 109 | 55 | 54 | null | null |
nevrenato/Hets_Fork | Maude/PreComorphism.hs | gpl-2.0 | getTypes :: [CAS.CASLTERM] -> [Id]
getTypes = mapMaybe getType | 62 | getTypes :: [CAS.CASLTERM] -> [Id]
getTypes = mapMaybe getType | 62 | getTypes = mapMaybe getType | 27 | false | true | 0 | 8 | 8 | 33 | 15 | 18 | null | null |
gcampax/ghc | compiler/llvmGen/LlvmCodeGen/Data.hs | bsd-3-clause | -- ----------------------------------------------------------------------------
-- * Generate static data
--
-- | Handle static data
genData :: CmmStatic -> LlvmM LlvmStatic
genData (CmmString str) = do
let v = map (\x -> LMStaticLit $ LMIntLit (fromIntegral x) i8) str
ve = v ++ [LMStaticLit $ LMIntLit 0 i8]
return $ LMStaticArray ve (LMArray (length ve) i8) | 379 | genData :: CmmStatic -> LlvmM LlvmStatic
genData (CmmString str) = do
let v = map (\x -> LMStaticLit $ LMIntLit (fromIntegral x) i8) str
ve = v ++ [LMStaticLit $ LMIntLit 0 i8]
return $ LMStaticArray ve (LMArray (length ve) i8) | 244 | genData (CmmString str) = do
let v = map (\x -> LMStaticLit $ LMIntLit (fromIntegral x) i8) str
ve = v ++ [LMStaticLit $ LMIntLit 0 i8]
return $ LMStaticArray ve (LMArray (length ve) i8) | 203 | true | true | 0 | 16 | 72 | 115 | 58 | 57 | null | null |
wayofthepie/nats-queue | Network/Nats/Json.hs | bsd-3-clause | requestMany :: (AE.ToJSON a, AE.FromJSON b) =>
Nats
-> String -- ^ Subject
-> a -- ^ Body
-> Int -- ^ Timeout in microseconds
-> IO [b]
requestMany nats subject body time =
decodeAndFilter <$> N.requestMany nats subject (AE.encode body) time
where
decodeAndFilter = mapMaybe AE.decode | 366 | requestMany :: (AE.ToJSON a, AE.FromJSON b) =>
Nats
-> String -- ^ Subject
-> a -- ^ Body
-> Int -- ^ Timeout in microseconds
-> IO [b]
requestMany nats subject body time =
decodeAndFilter <$> N.requestMany nats subject (AE.encode body) time
where
decodeAndFilter = mapMaybe AE.decode | 366 | requestMany nats subject body time =
decodeAndFilter <$> N.requestMany nats subject (AE.encode body) time
where
decodeAndFilter = mapMaybe AE.decode | 163 | false | true | 0 | 12 | 128 | 101 | 51 | 50 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-code/Language/Drasil/Code/Imperative/Modules.hs | bsd-2-clause | initConsts :: (ProgramSym repr) => Reader DrasilState
(Maybe (MS (repr (Statement repr))))
initConsts = do
g <- ask
v_consts <- mkVar (codevar consts)
let cname = "Constants"
getDecl _ Inline = return Nothing
getDecl ([],[]) _ = return Nothing
getDecl (_,[]) WithInputs = return Nothing
getDecl (c:_,[]) _ = asks (constCont c . conRepr)
getDecl ([],cs) _ = do
vars <- mapM mkVar cs
vals <- mapM (convExpr . codeEquat) cs
logs <- mapM maybeLog vars
return $ Just $ multi $ zipWith (defFunc $ conRepr g) vars vals ++
concat logs
getDecl _ _ = error "Only some constants present in export map"
constCont c Var = Just $ (if currentModule g == eMap (codeSpec g) !
codeName c then objDecNewNoParams else extObjDecNewNoParams cname)
v_consts
constCont _ Const = Nothing
defFunc Var = varDecDef
defFunc Const = constDecDef
getDecl (partition (flip member (eMap $ codeSpec g) . codeName)
(constants $ csi $ codeSpec g)) (conStruct g) | 1,062 | initConsts :: (ProgramSym repr) => Reader DrasilState
(Maybe (MS (repr (Statement repr))))
initConsts = do
g <- ask
v_consts <- mkVar (codevar consts)
let cname = "Constants"
getDecl _ Inline = return Nothing
getDecl ([],[]) _ = return Nothing
getDecl (_,[]) WithInputs = return Nothing
getDecl (c:_,[]) _ = asks (constCont c . conRepr)
getDecl ([],cs) _ = do
vars <- mapM mkVar cs
vals <- mapM (convExpr . codeEquat) cs
logs <- mapM maybeLog vars
return $ Just $ multi $ zipWith (defFunc $ conRepr g) vars vals ++
concat logs
getDecl _ _ = error "Only some constants present in export map"
constCont c Var = Just $ (if currentModule g == eMap (codeSpec g) !
codeName c then objDecNewNoParams else extObjDecNewNoParams cname)
v_consts
constCont _ Const = Nothing
defFunc Var = varDecDef
defFunc Const = constDecDef
getDecl (partition (flip member (eMap $ codeSpec g) . codeName)
(constants $ csi $ codeSpec g)) (conStruct g) | 1,062 | initConsts = do
g <- ask
v_consts <- mkVar (codevar consts)
let cname = "Constants"
getDecl _ Inline = return Nothing
getDecl ([],[]) _ = return Nothing
getDecl (_,[]) WithInputs = return Nothing
getDecl (c:_,[]) _ = asks (constCont c . conRepr)
getDecl ([],cs) _ = do
vars <- mapM mkVar cs
vals <- mapM (convExpr . codeEquat) cs
logs <- mapM maybeLog vars
return $ Just $ multi $ zipWith (defFunc $ conRepr g) vars vals ++
concat logs
getDecl _ _ = error "Only some constants present in export map"
constCont c Var = Just $ (if currentModule g == eMap (codeSpec g) !
codeName c then objDecNewNoParams else extObjDecNewNoParams cname)
v_consts
constCont _ Const = Nothing
defFunc Var = varDecDef
defFunc Const = constDecDef
getDecl (partition (flip member (eMap $ codeSpec g) . codeName)
(constants $ csi $ codeSpec g)) (conStruct g) | 968 | false | true | 0 | 18 | 294 | 425 | 206 | 219 | null | null |
shepheb/hork | Hork/Objects.hs | bsd-3-clause | objPropValue :: Word16 -> Word16 -> Hork Word16
objPropValue num prop = do
a <- objPropAddr num prop
case a of
0 -> do
def <- propDefaults
rw $ ra . BA $ fromIntegral def + 2 * (prop-1)
_ -> do
(_, size, sizelen) <- propInfo a
case size of
1 -> fromIntegral <$> rb (a + fromIntegral sizelen)
2 -> rw (a + fromIntegral sizelen)
_ -> return 0
-- Expects to be given the address of the FIRST DATA BYTE.
-- Examines previous bytes to determine the size. | 510 | objPropValue :: Word16 -> Word16 -> Hork Word16
objPropValue num prop = do
a <- objPropAddr num prop
case a of
0 -> do
def <- propDefaults
rw $ ra . BA $ fromIntegral def + 2 * (prop-1)
_ -> do
(_, size, sizelen) <- propInfo a
case size of
1 -> fromIntegral <$> rb (a + fromIntegral sizelen)
2 -> rw (a + fromIntegral sizelen)
_ -> return 0
-- Expects to be given the address of the FIRST DATA BYTE.
-- Examines previous bytes to determine the size. | 510 | objPropValue num prop = do
a <- objPropAddr num prop
case a of
0 -> do
def <- propDefaults
rw $ ra . BA $ fromIntegral def + 2 * (prop-1)
_ -> do
(_, size, sizelen) <- propInfo a
case size of
1 -> fromIntegral <$> rb (a + fromIntegral sizelen)
2 -> rw (a + fromIntegral sizelen)
_ -> return 0
-- Expects to be given the address of the FIRST DATA BYTE.
-- Examines previous bytes to determine the size. | 462 | false | true | 0 | 19 | 151 | 177 | 85 | 92 | null | null |
conal/DeepArrow | src/Language/Haskell/Parens.hs | bsd-3-clause | -- Next two swiped from Haskell.Language.Pretty (not exported)
getName :: HsQName -> HsName
getName (UnQual s) = s | 114 | getName :: HsQName -> HsName
getName (UnQual s) = s | 51 | getName (UnQual s) = s | 22 | true | true | 0 | 9 | 17 | 31 | 14 | 17 | null | null |
unisonweb/platform | parser-typechecker/src/Unison/Util/ColorText.hs | mit | blue = style Blue | 17 | blue = style Blue | 17 | blue = style Blue | 17 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
joelburget/daily-typecheckers | src/Day7.hs | bsd-3-clause | alphaEquivalent2 (FVar2 x1) (FVar2 x2) = x1 == x2 | 49 | alphaEquivalent2 (FVar2 x1) (FVar2 x2) = x1 == x2 | 49 | alphaEquivalent2 (FVar2 x1) (FVar2 x2) = x1 == x2 | 49 | false | false | 0 | 7 | 8 | 27 | 13 | 14 | null | null |
AccelerateHS/accelerate-buildbot | src/Benchmarks.hs | bsd-3-clause | readCriterionStats :: FilePath -> Build [BenchResult Stats]
readCriterionStats f = do
contents <- io $ B.readFile f
case parseCSV contents of
Nothing -> if B.null contents then return [] else throw $ ErrorOther "failed to parse criterion results"
Just csv -> return $ map parse (tail csv)
where
seconds = Seconds . fst . fromJust . B.readDouble
stats avg lb ub = WithSeconds (Time KernelWall Stats { statsMin = seconds lb
, statsMax = seconds ub
, statsAvg = seconds avg })
parse (n:avg:lb:ub:_) = BenchResult (B.unpack n) [BenchRunResult 0 [] [ stats avg lb ub ]]
parse _ = error "we should not be here..."
-- Run a standard accelerate-examples benchmark. The executable is expected to
-- write kernel statistics to the given file, which will be read later.
--
-- TLM: return the wall time for the entire program? Includes random number
-- generation and the criterion machinery, but also important Accelerate
-- operations such as sharing recovery and code generation.
-- | 1,155 | readCriterionStats :: FilePath -> Build [BenchResult Stats]
readCriterionStats f = do
contents <- io $ B.readFile f
case parseCSV contents of
Nothing -> if B.null contents then return [] else throw $ ErrorOther "failed to parse criterion results"
Just csv -> return $ map parse (tail csv)
where
seconds = Seconds . fst . fromJust . B.readDouble
stats avg lb ub = WithSeconds (Time KernelWall Stats { statsMin = seconds lb
, statsMax = seconds ub
, statsAvg = seconds avg })
parse (n:avg:lb:ub:_) = BenchResult (B.unpack n) [BenchRunResult 0 [] [ stats avg lb ub ]]
parse _ = error "we should not be here..."
-- Run a standard accelerate-examples benchmark. The executable is expected to
-- write kernel statistics to the given file, which will be read later.
--
-- TLM: return the wall time for the entire program? Includes random number
-- generation and the criterion machinery, but also important Accelerate
-- operations such as sharing recovery and code generation.
-- | 1,155 | readCriterionStats f = do
contents <- io $ B.readFile f
case parseCSV contents of
Nothing -> if B.null contents then return [] else throw $ ErrorOther "failed to parse criterion results"
Just csv -> return $ map parse (tail csv)
where
seconds = Seconds . fst . fromJust . B.readDouble
stats avg lb ub = WithSeconds (Time KernelWall Stats { statsMin = seconds lb
, statsMax = seconds ub
, statsAvg = seconds avg })
parse (n:avg:lb:ub:_) = BenchResult (B.unpack n) [BenchRunResult 0 [] [ stats avg lb ub ]]
parse _ = error "we should not be here..."
-- Run a standard accelerate-examples benchmark. The executable is expected to
-- write kernel statistics to the given file, which will be read later.
--
-- TLM: return the wall time for the entire program? Includes random number
-- generation and the criterion machinery, but also important Accelerate
-- operations such as sharing recovery and code generation.
-- | 1,095 | false | true | 3 | 13 | 345 | 260 | 131 | 129 | null | null |
GaloisInc/galua | galua/src/Galua/ImportCode.hs | mit | cvtKst :: BC.Function -> BC.Kst -> IO Literal
cvtKst fun (BC.Kst n) =
case BC.funcConstants fun Vector.!? n of
Nothing -> fail "Bad constant in op-codes"
Just k ->
return $!
case k of
BC.KNil -> LNil
BC.KNum d -> LNum d
BC.KInt i -> LInt i
BC.KBool b -> LBool b
BC.KString s -> LStr s
BC.KLongString s -> LStr s | 414 | cvtKst :: BC.Function -> BC.Kst -> IO Literal
cvtKst fun (BC.Kst n) =
case BC.funcConstants fun Vector.!? n of
Nothing -> fail "Bad constant in op-codes"
Just k ->
return $!
case k of
BC.KNil -> LNil
BC.KNum d -> LNum d
BC.KInt i -> LInt i
BC.KBool b -> LBool b
BC.KString s -> LStr s
BC.KLongString s -> LStr s | 414 | cvtKst fun (BC.Kst n) =
case BC.funcConstants fun Vector.!? n of
Nothing -> fail "Bad constant in op-codes"
Just k ->
return $!
case k of
BC.KNil -> LNil
BC.KNum d -> LNum d
BC.KInt i -> LInt i
BC.KBool b -> LBool b
BC.KString s -> LStr s
BC.KLongString s -> LStr s | 368 | false | true | 0 | 13 | 164 | 162 | 73 | 89 | null | null |
SAdams601/HaRe | old/testing/refacFunDef/Test12_TokOut.hs | bsd-3-clause | g = 37 | 6 | g = 37 | 6 | g = 37 | 6 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
vikraman/ghc | compiler/main/DynFlags.hs | bsd-3-clause | add_dep_message (PrefixPred pred f) message =
PrefixPred pred $ \s -> f s >> deprecate message | 122 | add_dep_message (PrefixPred pred f) message =
PrefixPred pred $ \s -> f s >> deprecate message | 122 | add_dep_message (PrefixPred pred f) message =
PrefixPred pred $ \s -> f s >> deprecate message | 122 | false | false | 0 | 8 | 43 | 41 | 19 | 22 | null | null |
sebcrozet/falling | Physics/Falling/Collision/Graph/CollisionGraphTree.hs | bsd-3-clause | insertRemoveToMatch :: Node -> [ (Node, b) ] -> [ (Node, b) ] -> Gr a b -> Gr a b
insertRemoveToMatch node succs preds (Gr g) =
Gr g5
where
-- setup datas
(oldSuccs, nl, oldPreds) = g IM.! node
newSuccs = IM.fromList succs
newPreds = IM.fromList preds
-- compute diffs
diff new old = (new IM.\\ old, old IM.\\ new)
(toAddSucc, toRemoveSucc) = diff newSuccs oldSuccs
(toAddPred, toRemovePred) = diff newPreds oldPreds
-- adjust current node’s attached edges
finalSucc = toAddSucc `IM.union` (oldSuccs IM.\\ toRemoveSucc)
finalPred = toAddPred `IM.union` (oldPreds IM.\\ toRemovePred)
g1 = IM.insert node (finalSucc, nl, finalPred) g
-- adjust other node’s edges
g2 = IM.foldrWithKey (modify rmSucc') g1 toRemovePred
g3 = IM.foldrWithKey (modify rmPred') g2 toRemoveSucc
g4 = IM.foldrWithKey (modify addSucc') g3 toAddPred
g5 = IM.foldrWithKey (modify addPred') g4 toAddSucc
-- modification helpers
modify method k b gr = IM.adjust (method b) k gr
addSucc' b (ps, l', ss) = (ps , l', IM.insert node b ss)
addPred' b (ps, l', ss) = (IM.insert node b ps, l', ss)
rmSucc' _ (ps, l', ss) = (ps , l', IM.delete node ss)
rmPred' _ (ps, l', ss) = (IM.delete node ps , l', ss)
| 1,985 | insertRemoveToMatch :: Node -> [ (Node, b) ] -> [ (Node, b) ] -> Gr a b -> Gr a b
insertRemoveToMatch node succs preds (Gr g) =
Gr g5
where
-- setup datas
(oldSuccs, nl, oldPreds) = g IM.! node
newSuccs = IM.fromList succs
newPreds = IM.fromList preds
-- compute diffs
diff new old = (new IM.\\ old, old IM.\\ new)
(toAddSucc, toRemoveSucc) = diff newSuccs oldSuccs
(toAddPred, toRemovePred) = diff newPreds oldPreds
-- adjust current node’s attached edges
finalSucc = toAddSucc `IM.union` (oldSuccs IM.\\ toRemoveSucc)
finalPred = toAddPred `IM.union` (oldPreds IM.\\ toRemovePred)
g1 = IM.insert node (finalSucc, nl, finalPred) g
-- adjust other node’s edges
g2 = IM.foldrWithKey (modify rmSucc') g1 toRemovePred
g3 = IM.foldrWithKey (modify rmPred') g2 toRemoveSucc
g4 = IM.foldrWithKey (modify addSucc') g3 toAddPred
g5 = IM.foldrWithKey (modify addPred') g4 toAddSucc
-- modification helpers
modify method k b gr = IM.adjust (method b) k gr
addSucc' b (ps, l', ss) = (ps , l', IM.insert node b ss)
addPred' b (ps, l', ss) = (IM.insert node b ps, l', ss)
rmSucc' _ (ps, l', ss) = (ps , l', IM.delete node ss)
rmPred' _ (ps, l', ss) = (IM.delete node ps , l', ss)
| 1,985 | insertRemoveToMatch node succs preds (Gr g) =
Gr g5
where
-- setup datas
(oldSuccs, nl, oldPreds) = g IM.! node
newSuccs = IM.fromList succs
newPreds = IM.fromList preds
-- compute diffs
diff new old = (new IM.\\ old, old IM.\\ new)
(toAddSucc, toRemoveSucc) = diff newSuccs oldSuccs
(toAddPred, toRemovePred) = diff newPreds oldPreds
-- adjust current node’s attached edges
finalSucc = toAddSucc `IM.union` (oldSuccs IM.\\ toRemoveSucc)
finalPred = toAddPred `IM.union` (oldPreds IM.\\ toRemovePred)
g1 = IM.insert node (finalSucc, nl, finalPred) g
-- adjust other node’s edges
g2 = IM.foldrWithKey (modify rmSucc') g1 toRemovePred
g3 = IM.foldrWithKey (modify rmPred') g2 toRemoveSucc
g4 = IM.foldrWithKey (modify addSucc') g3 toAddPred
g5 = IM.foldrWithKey (modify addPred') g4 toAddSucc
-- modification helpers
modify method k b gr = IM.adjust (method b) k gr
addSucc' b (ps, l', ss) = (ps , l', IM.insert node b ss)
addPred' b (ps, l', ss) = (IM.insert node b ps, l', ss)
rmSucc' _ (ps, l', ss) = (ps , l', IM.delete node ss)
rmPred' _ (ps, l', ss) = (IM.delete node ps , l', ss)
| 1,903 | false | true | 0 | 9 | 1,016 | 503 | 274 | 229 | null | null |
wehu/hw | src/Type.hs | apache-2.0 | prType TStr = PP.text "String" | 34 | prType TStr = PP.text "String" | 34 | prType TStr = PP.text "String" | 34 | false | false | 1 | 6 | 8 | 17 | 6 | 11 | null | null |
apyrgio/snf-ganeti | src/Ganeti/Constants.hs | bsd-2-clause | cvEclusterdanglingnodes :: (String, String, String)
cvEclusterdanglingnodes =
("node",
Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
"Some nodes belong to non-existing groups") | 186 | cvEclusterdanglingnodes :: (String, String, String)
cvEclusterdanglingnodes =
("node",
Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
"Some nodes belong to non-existing groups") | 186 | cvEclusterdanglingnodes =
("node",
Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
"Some nodes belong to non-existing groups") | 134 | false | true | 0 | 7 | 23 | 34 | 20 | 14 | null | null |
svenssonjoel/ObsidianGFX | Obsidian/Program.hs | bsd-3-clause | assign :: Scalar a => Name -> [Exp Word32] -> (Exp a) -> Program Thread ()
assign nom ix e = Assign nom ix e | 108 | assign :: Scalar a => Name -> [Exp Word32] -> (Exp a) -> Program Thread ()
assign nom ix e = Assign nom ix e | 108 | assign nom ix e = Assign nom ix e | 33 | false | true | 0 | 10 | 24 | 63 | 30 | 33 | null | null |
droundy/franchise | Distribution/Franchise/Util.hs | bsd-3-clause | systemOutErrToFile :: String -> [String] -> String -> C ExitCode
systemOutErrToFile g args outf0 =
do assertNotCreatingScript "systemInOut"
sd <- getCurrentSubdir
c <- findCommandInExtraPath g
let long = unwords (c:args)
short = if length args < 2 then long
else '[':c++"]"
putSV short long
env <- Just `fmap` getEnvironment
outf <- processFilePath outf0
h <- io $ openFile outf WriteMode
pid <- io $ runProcess c args sd env Nothing (Just h) (Just h)
io $ waitForProcess pid
-- | Run a process with a list of arguments and get the resulting
-- output from stdout. | 681 | systemOutErrToFile :: String -> [String] -> String -> C ExitCode
systemOutErrToFile g args outf0 =
do assertNotCreatingScript "systemInOut"
sd <- getCurrentSubdir
c <- findCommandInExtraPath g
let long = unwords (c:args)
short = if length args < 2 then long
else '[':c++"]"
putSV short long
env <- Just `fmap` getEnvironment
outf <- processFilePath outf0
h <- io $ openFile outf WriteMode
pid <- io $ runProcess c args sd env Nothing (Just h) (Just h)
io $ waitForProcess pid
-- | Run a process with a list of arguments and get the resulting
-- output from stdout. | 681 | systemOutErrToFile g args outf0 =
do assertNotCreatingScript "systemInOut"
sd <- getCurrentSubdir
c <- findCommandInExtraPath g
let long = unwords (c:args)
short = if length args < 2 then long
else '[':c++"]"
putSV short long
env <- Just `fmap` getEnvironment
outf <- processFilePath outf0
h <- io $ openFile outf WriteMode
pid <- io $ runProcess c args sd env Nothing (Just h) (Just h)
io $ waitForProcess pid
-- | Run a process with a list of arguments and get the resulting
-- output from stdout. | 616 | false | true | 0 | 13 | 212 | 209 | 97 | 112 | null | null |
wdanilo/container | src/Data/Container/Class.hs | apache-2.0 | free = withTransFunc (fmap3 runIdentity) freeM | 51 | free = withTransFunc (fmap3 runIdentity) freeM | 51 | free = withTransFunc (fmap3 runIdentity) freeM | 51 | false | false | 0 | 7 | 10 | 17 | 8 | 9 | null | null |
noughtmare/yi | yi-keymap-vim/src/Yi/Keymap/Vim.hs | gpl-2.0 | convertEvent (Insert _) _ e = e | 31 | convertEvent (Insert _) _ e = e | 31 | convertEvent (Insert _) _ e = e | 31 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
OpenXT/manager | xenmgr/XenMgr/Expose/HostObject.hs | gpl-2.0 | pluginDir = "/usr/lib/xui/plugins" | 34 | pluginDir = "/usr/lib/xui/plugins" | 34 | pluginDir = "/usr/lib/xui/plugins" | 34 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
DavidAlphaFox/ghc | libraries/Cabal/Cabal/Distribution/Simple/Setup.hs | bsd-3-clause | configureLinker :: Verbosity -> ProgramConfiguration -> IO (FilePath, [String])
configureLinker verbosity lbi = configureProg verbosity lbi ldProgram | 149 | configureLinker :: Verbosity -> ProgramConfiguration -> IO (FilePath, [String])
configureLinker verbosity lbi = configureProg verbosity lbi ldProgram | 149 | configureLinker verbosity lbi = configureProg verbosity lbi ldProgram | 69 | false | true | 0 | 9 | 16 | 43 | 22 | 21 | null | null |
ziman/idris-py | src/IRTS/CodegenPython.hs | bsd-3-clause | cgPrim LStrFloat = cgPFun "float" | 33 | cgPrim LStrFloat = cgPFun "float" | 33 | cgPrim LStrFloat = cgPFun "float" | 33 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
Frefreak/hnem | src/Player.hs | bsd-3-clause | playMusicFile :: FilePath -> MVar MpObject -> IO ()
playMusicFile fp = sendCommand ("loadlist " ++ fp) | 102 | playMusicFile :: FilePath -> MVar MpObject -> IO ()
playMusicFile fp = sendCommand ("loadlist " ++ fp) | 102 | playMusicFile fp = sendCommand ("loadlist " ++ fp) | 50 | false | true | 0 | 9 | 16 | 44 | 20 | 24 | null | null |
pparkkin/eta | compiler/ETA/SimplCore/SimplEnv.hs | bsd-3-clause | addFlts :: Floats -> Floats -> Floats
addFlts (Floats bs1 l1) (Floats bs2 l2)
= Floats (bs1 `appOL` bs2) (l1 `andFF` l2) | 122 | addFlts :: Floats -> Floats -> Floats
addFlts (Floats bs1 l1) (Floats bs2 l2)
= Floats (bs1 `appOL` bs2) (l1 `andFF` l2) | 122 | addFlts (Floats bs1 l1) (Floats bs2 l2)
= Floats (bs1 `appOL` bs2) (l1 `andFF` l2) | 84 | false | true | 0 | 10 | 23 | 68 | 35 | 33 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/EXT/VertexShader.hs | bsd-3-clause | gl_Z :: GLenum
gl_Z = 0x87D7 | 28 | gl_Z :: GLenum
gl_Z = 0x87D7 | 28 | gl_Z = 0x87D7 | 13 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/RoboMakerSimulationApplicationSimulationSoftwareSuite.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-robomaker-simulationapplication-simulationsoftwaresuite.html#cfn-robomaker-simulationapplication-simulationsoftwaresuite-version
rmsasssVersion :: Lens' RoboMakerSimulationApplicationSimulationSoftwareSuite (Val Text)
rmsasssVersion = lens _roboMakerSimulationApplicationSimulationSoftwareSuiteVersion (\s a -> s { _roboMakerSimulationApplicationSimulationSoftwareSuiteVersion = a }) | 465 | rmsasssVersion :: Lens' RoboMakerSimulationApplicationSimulationSoftwareSuite (Val Text)
rmsasssVersion = lens _roboMakerSimulationApplicationSimulationSoftwareSuiteVersion (\s a -> s { _roboMakerSimulationApplicationSimulationSoftwareSuiteVersion = a }) | 254 | rmsasssVersion = lens _roboMakerSimulationApplicationSimulationSoftwareSuiteVersion (\s a -> s { _roboMakerSimulationApplicationSimulationSoftwareSuiteVersion = a }) | 165 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
peti/funcmp | FMP/Resolve.hs | gpl-3.0 | resolveNumeric2 (SymNHier name' _ ds) (Hier name n)
= if name == name'
then resolveNumeric2 ds n
else Nothing | 216 | resolveNumeric2 (SymNHier name' _ ds) (Hier name n)
= if name == name'
then resolveNumeric2 ds n
else Nothing | 216 | resolveNumeric2 (SymNHier name' _ ds) (Hier name n)
= if name == name'
then resolveNumeric2 ds n
else Nothing | 216 | false | false | 0 | 7 | 125 | 46 | 23 | 23 | null | null |
gabesoft/kapi | src/Persistence/ElasticSearch.hs | bsd-3-clause | mToMaybe
:: (Eq a, Monoid a)
=> a -> Maybe a
mToMaybe a
| a == mempty = Nothing
| otherwise = Just a | 108 | mToMaybe
:: (Eq a, Monoid a)
=> a -> Maybe a
mToMaybe a
| a == mempty = Nothing
| otherwise = Just a | 108 | mToMaybe a
| a == mempty = Nothing
| otherwise = Just a | 59 | false | true | 1 | 8 | 31 | 59 | 28 | 31 | null | null |
CloudI/CloudI | src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Builder/Internal.hs | mit | trimmedChunkFromBuffer :: AllocationStrategy -> Buffer
-> L.ByteString -> L.ByteString
trimmedChunkFromBuffer (AllocationStrategy _ _ trim) buf k
| S.null bs = k
| trim (S.length bs) (bufferSize buf) = L.Chunk (S.copy bs) k
| otherwise = L.Chunk bs k
where
bs = byteStringFromBuffer buf
------------------------------------------------------------------------------
-- Chunked IO Stream
------------------------------------------------------------------------------
-- | A stream of chunks that are constructed in the 'IO' monad.
--
-- This datatype serves as the common interface for the buffer-by-buffer
-- execution of a 'BuildStep' by 'buildStepToCIOS'. Typical users of this
-- interface are 'ciosToLazyByteString' or iteratee-style libraries like
-- @enumerator@. | 867 | trimmedChunkFromBuffer :: AllocationStrategy -> Buffer
-> L.ByteString -> L.ByteString
trimmedChunkFromBuffer (AllocationStrategy _ _ trim) buf k
| S.null bs = k
| trim (S.length bs) (bufferSize buf) = L.Chunk (S.copy bs) k
| otherwise = L.Chunk bs k
where
bs = byteStringFromBuffer buf
------------------------------------------------------------------------------
-- Chunked IO Stream
------------------------------------------------------------------------------
-- | A stream of chunks that are constructed in the 'IO' monad.
--
-- This datatype serves as the common interface for the buffer-by-buffer
-- execution of a 'BuildStep' by 'buildStepToCIOS'. Typical users of this
-- interface are 'ciosToLazyByteString' or iteratee-style libraries like
-- @enumerator@. | 867 | trimmedChunkFromBuffer (AllocationStrategy _ _ trim) buf k
| S.null bs = k
| trim (S.length bs) (bufferSize buf) = L.Chunk (S.copy bs) k
| otherwise = L.Chunk bs k
where
bs = byteStringFromBuffer buf
------------------------------------------------------------------------------
-- Chunked IO Stream
------------------------------------------------------------------------------
-- | A stream of chunks that are constructed in the 'IO' monad.
--
-- This datatype serves as the common interface for the buffer-by-buffer
-- execution of a 'BuildStep' by 'buildStepToCIOS'. Typical users of this
-- interface are 'ciosToLazyByteString' or iteratee-style libraries like
-- @enumerator@. | 757 | false | true | 2 | 11 | 192 | 137 | 68 | 69 | null | null |
jandersen7/Daily | src/290e/hs/kap.hs | gpl-3.0 | -- Decide whether the Integer is kap or not
isKap :: Int -> Bool
isKap 1 = True | 79 | isKap :: Int -> Bool
isKap 1 = True | 35 | isKap 1 = True | 14 | true | true | 0 | 7 | 17 | 25 | 11 | 14 | null | null |
romanb/amazonka | amazonka-elasticache/gen/Network/AWS/ElastiCache/RebootCacheCluster.hs | mpl-2.0 | -- | 'RebootCacheCluster' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'rccCacheClusterId' @::@ 'Text'
--
-- * 'rccCacheNodeIdsToReboot' @::@ ['Text']
--
rebootCacheCluster :: Text -- ^ 'rccCacheClusterId'
-> RebootCacheCluster
rebootCacheCluster p1 = RebootCacheCluster
{ _rccCacheClusterId = p1
, _rccCacheNodeIdsToReboot = mempty
} | 409 | rebootCacheCluster :: Text -- ^ 'rccCacheClusterId'
-> RebootCacheCluster
rebootCacheCluster p1 = RebootCacheCluster
{ _rccCacheClusterId = p1
, _rccCacheNodeIdsToReboot = mempty
} | 217 | rebootCacheCluster p1 = RebootCacheCluster
{ _rccCacheClusterId = p1
, _rccCacheNodeIdsToReboot = mempty
} | 124 | true | true | 0 | 7 | 83 | 45 | 28 | 17 | null | null |
markuspf/Idris-dev | src/Idris/Delaborate.hs | bsd-3-clause | -- | Re-add syntactic sugar in a term
resugar :: IState -> PTerm -> PTerm
resugar ist = transform flattenDoLet . transform resugarApp
where
resugarApp (PApp fc (PRef _ _ n) args)
| [c, t, f] <- mapMaybe explicitTerm args
, basename n == sUN "ifThenElse"
= PIfThenElse fc c (dedelay t) (dedelay f)
resugarApp (PApp fc (PRef _ _ n) args)
| [v, PLam _ bn _ _ next] <- mapMaybe explicitTerm args
, basename n == sUN ">>="
= let step = if bn `elem` namesIn [] ist next
then DoBind fc bn NoFC v
else DoExp NoFC v
in case resugarApp next of
PDoBlock dos -> PDoBlock (step : dos)
expr -> PDoBlock [step, DoExp NoFC expr]
resugarApp (PApp fc (PRef _ _ n) args)
| [PConstant fc (BI i)] <- mapMaybe explicitTerm args
, basename n == sUN "fromInteger"
= PConstant fc (BI i)
resugarApp tm = tm
flattenDoLet (PLet _ ln _ ty v bdy)
| PDoBlock dos <- flattenDoLet bdy
= PDoBlock (DoLet NoFC ln NoFC ty v : dos)
flattenDoLet (PDoBlock dos) =
PDoBlock $ concatMap fixExp dos
where fixExp (DoExp _ (PLet _ ln _ ty v bdy)) =
DoLet NoFC ln NoFC ty v : fixExp (DoExp NoFC bdy)
fixExp d = [d]
flattenDoLet tm = tm
dedelay (PApp _ (PRef _ _ delay) [_, _, obj])
| delay == sUN "Delay" = getTm obj
dedelay x = x
explicitTerm (PExp {getTm = tm}) = Just tm
explicitTerm _ = Nothing
-- | Delaborate and resugar a term | 1,533 | resugar :: IState -> PTerm -> PTerm
resugar ist = transform flattenDoLet . transform resugarApp
where
resugarApp (PApp fc (PRef _ _ n) args)
| [c, t, f] <- mapMaybe explicitTerm args
, basename n == sUN "ifThenElse"
= PIfThenElse fc c (dedelay t) (dedelay f)
resugarApp (PApp fc (PRef _ _ n) args)
| [v, PLam _ bn _ _ next] <- mapMaybe explicitTerm args
, basename n == sUN ">>="
= let step = if bn `elem` namesIn [] ist next
then DoBind fc bn NoFC v
else DoExp NoFC v
in case resugarApp next of
PDoBlock dos -> PDoBlock (step : dos)
expr -> PDoBlock [step, DoExp NoFC expr]
resugarApp (PApp fc (PRef _ _ n) args)
| [PConstant fc (BI i)] <- mapMaybe explicitTerm args
, basename n == sUN "fromInteger"
= PConstant fc (BI i)
resugarApp tm = tm
flattenDoLet (PLet _ ln _ ty v bdy)
| PDoBlock dos <- flattenDoLet bdy
= PDoBlock (DoLet NoFC ln NoFC ty v : dos)
flattenDoLet (PDoBlock dos) =
PDoBlock $ concatMap fixExp dos
where fixExp (DoExp _ (PLet _ ln _ ty v bdy)) =
DoLet NoFC ln NoFC ty v : fixExp (DoExp NoFC bdy)
fixExp d = [d]
flattenDoLet tm = tm
dedelay (PApp _ (PRef _ _ delay) [_, _, obj])
| delay == sUN "Delay" = getTm obj
dedelay x = x
explicitTerm (PExp {getTm = tm}) = Just tm
explicitTerm _ = Nothing
-- | Delaborate and resugar a term | 1,495 | resugar ist = transform flattenDoLet . transform resugarApp
where
resugarApp (PApp fc (PRef _ _ n) args)
| [c, t, f] <- mapMaybe explicitTerm args
, basename n == sUN "ifThenElse"
= PIfThenElse fc c (dedelay t) (dedelay f)
resugarApp (PApp fc (PRef _ _ n) args)
| [v, PLam _ bn _ _ next] <- mapMaybe explicitTerm args
, basename n == sUN ">>="
= let step = if bn `elem` namesIn [] ist next
then DoBind fc bn NoFC v
else DoExp NoFC v
in case resugarApp next of
PDoBlock dos -> PDoBlock (step : dos)
expr -> PDoBlock [step, DoExp NoFC expr]
resugarApp (PApp fc (PRef _ _ n) args)
| [PConstant fc (BI i)] <- mapMaybe explicitTerm args
, basename n == sUN "fromInteger"
= PConstant fc (BI i)
resugarApp tm = tm
flattenDoLet (PLet _ ln _ ty v bdy)
| PDoBlock dos <- flattenDoLet bdy
= PDoBlock (DoLet NoFC ln NoFC ty v : dos)
flattenDoLet (PDoBlock dos) =
PDoBlock $ concatMap fixExp dos
where fixExp (DoExp _ (PLet _ ln _ ty v bdy)) =
DoLet NoFC ln NoFC ty v : fixExp (DoExp NoFC bdy)
fixExp d = [d]
flattenDoLet tm = tm
dedelay (PApp _ (PRef _ _ delay) [_, _, obj])
| delay == sUN "Delay" = getTm obj
dedelay x = x
explicitTerm (PExp {getTm = tm}) = Just tm
explicitTerm _ = Nothing
-- | Delaborate and resugar a term | 1,459 | true | true | 0 | 13 | 501 | 638 | 307 | 331 | null | null |
brendanhay/gogol | gogol-games/gen/Network/Google/Games/Types/Product.hs | mpl-2.0 | -- | Uniquely identifies the type of this resource. Value is always the fixed
-- string \`games#eventBatchRecordFailure\`.
ebrfKind :: Lens' EventBatchRecordFailure (Maybe Text)
ebrfKind = lens _ebrfKind (\ s a -> s{_ebrfKind = a}) | 231 | ebrfKind :: Lens' EventBatchRecordFailure (Maybe Text)
ebrfKind = lens _ebrfKind (\ s a -> s{_ebrfKind = a}) | 108 | ebrfKind = lens _ebrfKind (\ s a -> s{_ebrfKind = a}) | 53 | true | true | 0 | 9 | 33 | 47 | 26 | 21 | null | null |
wavewave/lhc-analysis-collection | analysis/XQLD_sqsg_ATLAS0L2to6JMET_8TeV.hs | gpl-3.0 | createRdirBName procname (mg,mq) =
let rdir = "montecarlo/admproject/XQLDdegen/8TeV/scan_" ++ procname
basename = "ADMXQLD111degenMG"++ show mg++ "MQ" ++ show mq ++ "ML50000.0MN50000.0_" ++ procname ++ "_LHC8ATLAS_NoMatch_NoCut_AntiKT0.4_NoTau_Set"
in (rdir,basename) | 279 | createRdirBName procname (mg,mq) =
let rdir = "montecarlo/admproject/XQLDdegen/8TeV/scan_" ++ procname
basename = "ADMXQLD111degenMG"++ show mg++ "MQ" ++ show mq ++ "ML50000.0MN50000.0_" ++ procname ++ "_LHC8ATLAS_NoMatch_NoCut_AntiKT0.4_NoTau_Set"
in (rdir,basename) | 279 | createRdirBName procname (mg,mq) =
let rdir = "montecarlo/admproject/XQLDdegen/8TeV/scan_" ++ procname
basename = "ADMXQLD111degenMG"++ show mg++ "MQ" ++ show mq ++ "ML50000.0MN50000.0_" ++ procname ++ "_LHC8ATLAS_NoMatch_NoCut_AntiKT0.4_NoTau_Set"
in (rdir,basename) | 279 | false | false | 0 | 15 | 38 | 74 | 37 | 37 | null | null |
dmbarbour/Sirea | src/Sirea/Internal/B0Dynamic.hs | bsd-3-clause | dynBInstall (LnkSum x y) bl =
let lx = map (second ln_left) bl in
let ly = map (second ln_right) bl in
dynBInstall x lx >>= \ gcx ->
dynBInstall y ly >>= \ gcy ->
return (gcPair gcx gcy) | 206 | dynBInstall (LnkSum x y) bl =
let lx = map (second ln_left) bl in
let ly = map (second ln_right) bl in
dynBInstall x lx >>= \ gcx ->
dynBInstall y ly >>= \ gcy ->
return (gcPair gcx gcy) | 206 | dynBInstall (LnkSum x y) bl =
let lx = map (second ln_left) bl in
let ly = map (second ln_right) bl in
dynBInstall x lx >>= \ gcx ->
dynBInstall y ly >>= \ gcy ->
return (gcPair gcx gcy) | 206 | false | false | 0 | 15 | 59 | 102 | 48 | 54 | null | null |
green-haskell/ghc | compiler/nativeGen/SPARC/Ppr.hs | bsd-3-clause | pprInstr (XOR b reg1 ri reg2) = pprRegRIReg (sLit "xor") b reg1 ri reg2 | 73 | pprInstr (XOR b reg1 ri reg2) = pprRegRIReg (sLit "xor") b reg1 ri reg2 | 73 | pprInstr (XOR b reg1 ri reg2) = pprRegRIReg (sLit "xor") b reg1 ri reg2 | 73 | false | false | 0 | 7 | 15 | 38 | 18 | 20 | null | null |
ctford/Idris-Elba-dev | src/IRTS/CodegenJava.hs | bsd-3-clause | mkConstMatch pp getDefaultStmts var (c:cases) = mkConstMatch pp getDefaultStmts var cases | 89 | mkConstMatch pp getDefaultStmts var (c:cases) = mkConstMatch pp getDefaultStmts var cases | 89 | mkConstMatch pp getDefaultStmts var (c:cases) = mkConstMatch pp getDefaultStmts var cases | 89 | false | false | 0 | 7 | 10 | 31 | 15 | 16 | null | null |
FranklinChen/IHaskell | ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Output.hs | mit | clearOutput :: OutputWidget -> IO ()
clearOutput widget = widgetClearOutput widget False | 88 | clearOutput :: OutputWidget -> IO ()
clearOutput widget = widgetClearOutput widget False | 88 | clearOutput widget = widgetClearOutput widget False | 51 | false | true | 0 | 7 | 11 | 28 | 13 | 15 | null | null |
mavenraven/validations-checkers | src/Validations/Checkers/PhoneNumber.hs | bsd-3-clause | hasCountryCode :: PhoneNumber -> Either LocalizedMessage PhoneNumber
hasCountryCode = hasPhoneField _countryCode
[ Message english (Just "should have a country code") "Phone number should have a country code."
] | 215 | hasCountryCode :: PhoneNumber -> Either LocalizedMessage PhoneNumber
hasCountryCode = hasPhoneField _countryCode
[ Message english (Just "should have a country code") "Phone number should have a country code."
] | 215 | hasCountryCode = hasPhoneField _countryCode
[ Message english (Just "should have a country code") "Phone number should have a country code."
] | 146 | false | true | 0 | 8 | 31 | 42 | 20 | 22 | null | null |
jeroennoels/exact-real | test/Mandelbrot/Recursive.hs | mit | cons2 :: Walk2 -> Maybe T2 -> Maybe T2 -> (Walk2, Binding T2)
cons2 (a,b) u v = ((cons u a, cons v b), bind u v) | 113 | cons2 :: Walk2 -> Maybe T2 -> Maybe T2 -> (Walk2, Binding T2)
cons2 (a,b) u v = ((cons u a, cons v b), bind u v) | 113 | cons2 (a,b) u v = ((cons u a, cons v b), bind u v) | 51 | false | true | 0 | 9 | 27 | 78 | 40 | 38 | null | null |
rvion/lamdu | bottlelib/Graphics/UI/Bottle/Rect.hs | gpl-3.0 | width :: Lens' Rect R
width = size . _1 | 39 | width :: Lens' Rect R
width = size . _1 | 39 | width = size . _1 | 17 | false | true | 1 | 6 | 9 | 24 | 10 | 14 | null | null |
sdiehl/ghc | compiler/prelude/THNames.hs | bsd-3-clause | -- newtype TExp a = ...
tExpDataConName :: Name
tExpDataConName = thCon (fsLit "TExp") tExpDataConKey | 101 | tExpDataConName :: Name
tExpDataConName = thCon (fsLit "TExp") tExpDataConKey | 77 | tExpDataConName = thCon (fsLit "TExp") tExpDataConKey | 53 | true | true | 0 | 7 | 14 | 23 | 12 | 11 | null | null |
zaxtax/hakaru | haskell/Examples/OptimizationTests.hs | bsd-3-clause | flips = 20 | 10 | flips = 20 | 10 | flips = 20 | 10 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
suhailshergill/liboleg | Language/TEval/TEvalNR.hs | bsd-3-clause | test2a = teval env0 term2a | 26 | test2a = teval env0 term2a | 26 | test2a = teval env0 term2a | 26 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
thomie/cabal | cabal-install/tests/UnitTests/Distribution/Client/ArbitraryInstances.hs | bsd-3-clause | shortListOf1 :: Int -> Gen a -> Gen [a]
shortListOf1 bound gen =
sized $ \n -> do
k <- choose (1, 1 `max` ((n `div` 2) `min` bound))
vectorOf k gen | 163 | shortListOf1 :: Int -> Gen a -> Gen [a]
shortListOf1 bound gen =
sized $ \n -> do
k <- choose (1, 1 `max` ((n `div` 2) `min` bound))
vectorOf k gen | 163 | shortListOf1 bound gen =
sized $ \n -> do
k <- choose (1, 1 `max` ((n `div` 2) `min` bound))
vectorOf k gen | 123 | false | true | 0 | 16 | 47 | 90 | 48 | 42 | null | null |
DavidAlphaFox/ghc | libraries/array/Data/Array/Base.hs | bsd-3-clause | -- | Constructs a mutable array from a list of initial elements.
-- The list gives the elements of the array in ascending order
-- beginning with the lowest index.
newListArray :: (MArray a e m, Ix i) => (i,i) -> [e] -> m (a i e)
newListArray (l,u) es = do
marr <- newArray_ (l,u)
let n = safeRangeSize (l,u)
let fillFromList i xs | i == n = return ()
| otherwise = case xs of
[] -> return ()
y:ys -> unsafeWrite marr i y >> fillFromList (i+1) ys
fillFromList 0 es
return marr
| 553 | newListArray :: (MArray a e m, Ix i) => (i,i) -> [e] -> m (a i e)
newListArray (l,u) es = do
marr <- newArray_ (l,u)
let n = safeRangeSize (l,u)
let fillFromList i xs | i == n = return ()
| otherwise = case xs of
[] -> return ()
y:ys -> unsafeWrite marr i y >> fillFromList (i+1) ys
fillFromList 0 es
return marr
| 389 | newListArray (l,u) es = do
marr <- newArray_ (l,u)
let n = safeRangeSize (l,u)
let fillFromList i xs | i == n = return ()
| otherwise = case xs of
[] -> return ()
y:ys -> unsafeWrite marr i y >> fillFromList (i+1) ys
fillFromList 0 es
return marr
| 323 | true | true | 0 | 17 | 173 | 208 | 102 | 106 | null | null |
lpeterse/haskell-source | src/Data/Source/Attoparsec.hs | mit | parse :: MonadThrow m => A.Parser a -> Transducer m c BS.ByteString a
parse p = whenChunk f
where
f a sb | BS.null a = whenChunk f sb
| otherwise = g (A.parse p a) sb
g (A.Partial continuation) = requireChunk (g . continuation)
g (A.Done remains r) = Source . pure . Chunk r . parse p . prepend remains
g (A.Fail _ ctx msg) = \_-> Source $ throwM (AttoparsecException ctx msg) | 433 | parse :: MonadThrow m => A.Parser a -> Transducer m c BS.ByteString a
parse p = whenChunk f
where
f a sb | BS.null a = whenChunk f sb
| otherwise = g (A.parse p a) sb
g (A.Partial continuation) = requireChunk (g . continuation)
g (A.Done remains r) = Source . pure . Chunk r . parse p . prepend remains
g (A.Fail _ ctx msg) = \_-> Source $ throwM (AttoparsecException ctx msg) | 433 | parse p = whenChunk f
where
f a sb | BS.null a = whenChunk f sb
| otherwise = g (A.parse p a) sb
g (A.Partial continuation) = requireChunk (g . continuation)
g (A.Done remains r) = Source . pure . Chunk r . parse p . prepend remains
g (A.Fail _ ctx msg) = \_-> Source $ throwM (AttoparsecException ctx msg) | 363 | false | true | 2 | 9 | 131 | 211 | 97 | 114 | null | null |
CarstenKoenig/Countdown | src/web/CountdownGame/Players.hs | mit | isRegistered :: State -> ActionM Bool
isRegistered state = do
player <- registeredPlayer state
return $ isJust player | 121 | isRegistered :: State -> ActionM Bool
isRegistered state = do
player <- registeredPlayer state
return $ isJust player | 121 | isRegistered state = do
player <- registeredPlayer state
return $ isJust player | 83 | false | true | 0 | 8 | 21 | 41 | 18 | 23 | null | null |
pasberth/binal1 | Language/Binal/Optimizer.hs | mit | isTailCall name (TyList (TyLit (SymLit "letrec") _ _:_:x:[]) _ _) = isNotCall name x | 84 | isTailCall name (TyList (TyLit (SymLit "letrec") _ _:_:x:[]) _ _) = isNotCall name x | 84 | isTailCall name (TyList (TyLit (SymLit "letrec") _ _:_:x:[]) _ _) = isNotCall name x | 84 | false | false | 0 | 12 | 13 | 56 | 27 | 29 | null | null |
miguelpagano/equ | Equ/Proof/Zipper.hs | gpl-3.0 | -- | Subir un nivel en el focus.
goUp :: ProofFocus' ctxTy relTy proofTy exprTy ->
Maybe (ProofFocus' ctxTy relTy proofTy exprTy)
goUp (_, Top) = Nothing | 162 | goUp :: ProofFocus' ctxTy relTy proofTy exprTy ->
Maybe (ProofFocus' ctxTy relTy proofTy exprTy)
goUp (_, Top) = Nothing | 129 | goUp (_, Top) = Nothing | 23 | true | true | 0 | 8 | 35 | 49 | 25 | 24 | null | null |
GaloisInc/pads-haskell | Examples/First.hs | bsd-3-clause | result_intRangePLow = intRangeP_parseS (0, 256) intRangeLow_input | 65 | result_intRangePLow = intRangeP_parseS (0, 256) intRangeLow_input | 65 | result_intRangePLow = intRangeP_parseS (0, 256) intRangeLow_input | 65 | false | false | 0 | 6 | 5 | 17 | 9 | 8 | null | null |
GaloisInc/saw-script | cryptol-saw-core/src/Verifier/SAW/CryptolEnv.hs | bsd-3-clause | genTermEnv :: SharedContext -> ME.ModuleEnv -> C.Env -> IO (Map T.Name Term)
genTermEnv sc modEnv cryEnv0 = do
let declGroups = concatMap T.mDecls
$ filter (not . T.isParametrizedModule)
$ ME.loadedModules modEnv
cryEnv <- C.importTopLevelDeclGroups sc C.defaultPrimitiveOptions cryEnv0 declGroups
traverse (\(t, j) -> incVars sc 0 j t) (C.envE cryEnv)
-------------------------------------------------------------------------------- | 474 | genTermEnv :: SharedContext -> ME.ModuleEnv -> C.Env -> IO (Map T.Name Term)
genTermEnv sc modEnv cryEnv0 = do
let declGroups = concatMap T.mDecls
$ filter (not . T.isParametrizedModule)
$ ME.loadedModules modEnv
cryEnv <- C.importTopLevelDeclGroups sc C.defaultPrimitiveOptions cryEnv0 declGroups
traverse (\(t, j) -> incVars sc 0 j t) (C.envE cryEnv)
-------------------------------------------------------------------------------- | 474 | genTermEnv sc modEnv cryEnv0 = do
let declGroups = concatMap T.mDecls
$ filter (not . T.isParametrizedModule)
$ ME.loadedModules modEnv
cryEnv <- C.importTopLevelDeclGroups sc C.defaultPrimitiveOptions cryEnv0 declGroups
traverse (\(t, j) -> incVars sc 0 j t) (C.envE cryEnv)
-------------------------------------------------------------------------------- | 397 | false | true | 0 | 15 | 90 | 146 | 71 | 75 | null | null |
mcschroeder/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | -- Promoted List
promotedConsDataCon, promotedNilDataCon :: TyCon
promotedConsDataCon = promoteDataCon consDataCon | 116 | promotedConsDataCon, promotedNilDataCon :: TyCon
promotedConsDataCon = promoteDataCon consDataCon | 99 | promotedConsDataCon = promoteDataCon consDataCon | 50 | true | true | 0 | 5 | 12 | 17 | 10 | 7 | null | null |
phischu/fragnix | tests/packages/scotty/Network.HTTP2.Types.hs | bsd-3-clause | -- | Setting the PADDED flag.
--
-- >>> setPadded 0
-- 8
setPadded :: FrameFlags -> FrameFlags
setPadded x = x `setBit` 3 | 121 | setPadded :: FrameFlags -> FrameFlags
setPadded x = x `setBit` 3 | 64 | setPadded x = x `setBit` 3 | 26 | true | true | 0 | 5 | 23 | 28 | 17 | 11 | null | null |
Saulzar/ghcjs-websockets-reflex | src/JavaScript/WebSockets/Reflex/WebSocket.hs | mit | -- |Open a connection
-- |Can be upgraded to operate on an event of Urls
-- |switchEvents openConnection :: Event Text -> m (Event t Connection)
openConnection :: MonadWidget t m => Text -> m (Event t Connection)
openConnection = generate WS.openConnection | 256 | openConnection :: MonadWidget t m => Text -> m (Event t Connection)
openConnection = generate WS.openConnection | 111 | openConnection = generate WS.openConnection | 43 | true | true | 0 | 9 | 41 | 43 | 22 | 21 | null | null |
emmanueltouzery/cigale-timesheet | src/WebServer/Main.hs | mit | getToday :: IO Day
getToday = (localDay . zonedTimeToLocalTime) <$> getZonedTime | 80 | getToday :: IO Day
getToday = (localDay . zonedTimeToLocalTime) <$> getZonedTime | 80 | getToday = (localDay . zonedTimeToLocalTime) <$> getZonedTime | 61 | false | true | 0 | 7 | 10 | 25 | 13 | 12 | null | null |
alexbiehl/hoop | hadoop-protos/src/Hadoop/Protos/YarnProtos/YarnApplicationStateProto.hs | mit | toMaybe'Enum 3 = Prelude'.Just SUBMITTED | 40 | toMaybe'Enum 3 = Prelude'.Just SUBMITTED | 40 | toMaybe'Enum 3 = Prelude'.Just SUBMITTED | 40 | false | false | 1 | 6 | 4 | 17 | 6 | 11 | null | null |
alekhin0w/unicorn | bindings/haskell/samples/SampleX86.hs | gpl-2.0 | testI386InvalidMemRead :: IO ()
testI386InvalidMemRead = do
putStrLn "==================================="
putStrLn "Emulate i386 code that read from invalid memory"
result <- runEmulator $ do
-- Initialize emulator in X86-32bit mode
uc <- open ArchX86 [Mode32]
-- Map 2MB memory for this emulation
memMap uc address (2 * 1024 * 1024) [ProtAll]
-- Write machine code to be emulated to memory
memWrite uc address x86Code32MemRead
-- Initialize machine registers
regWrite uc X86.Ecx 0x1234
regWrite uc X86.Edx 0x7890
-- Tracing all basic block with customized callback
blockHookAdd uc hookBlock () 1 0
-- Tracing all instructions by having @beegin > @end
codeHookAdd uc hookCode () 1 0
-- Emulate machine code in infinite time
let codeLen = codeLength x86Code32MemRead
start uc address (address + codeLen) Nothing Nothing
-- Now print out some registers
emuPutStrLn ">>> Emulation done. Below is the CPU context"
ecx <- regRead uc X86.Ecx
edx <- regRead uc X86.Edx
emuPutStrLn $ ">>> ECX = 0x" ++ showHex ecx
emuPutStrLn $ ">>> EDX = 0x" ++ showHex edx
case result of
Right _ -> return ()
Left err -> putStrLn $ "Failed with error " ++ show err ++ ": " ++
strerror err
-- Emulate code that write invalid memory | 1,459 | testI386InvalidMemRead :: IO ()
testI386InvalidMemRead = do
putStrLn "==================================="
putStrLn "Emulate i386 code that read from invalid memory"
result <- runEmulator $ do
-- Initialize emulator in X86-32bit mode
uc <- open ArchX86 [Mode32]
-- Map 2MB memory for this emulation
memMap uc address (2 * 1024 * 1024) [ProtAll]
-- Write machine code to be emulated to memory
memWrite uc address x86Code32MemRead
-- Initialize machine registers
regWrite uc X86.Ecx 0x1234
regWrite uc X86.Edx 0x7890
-- Tracing all basic block with customized callback
blockHookAdd uc hookBlock () 1 0
-- Tracing all instructions by having @beegin > @end
codeHookAdd uc hookCode () 1 0
-- Emulate machine code in infinite time
let codeLen = codeLength x86Code32MemRead
start uc address (address + codeLen) Nothing Nothing
-- Now print out some registers
emuPutStrLn ">>> Emulation done. Below is the CPU context"
ecx <- regRead uc X86.Ecx
edx <- regRead uc X86.Edx
emuPutStrLn $ ">>> ECX = 0x" ++ showHex ecx
emuPutStrLn $ ">>> EDX = 0x" ++ showHex edx
case result of
Right _ -> return ()
Left err -> putStrLn $ "Failed with error " ++ show err ++ ": " ++
strerror err
-- Emulate code that write invalid memory | 1,459 | testI386InvalidMemRead = do
putStrLn "==================================="
putStrLn "Emulate i386 code that read from invalid memory"
result <- runEmulator $ do
-- Initialize emulator in X86-32bit mode
uc <- open ArchX86 [Mode32]
-- Map 2MB memory for this emulation
memMap uc address (2 * 1024 * 1024) [ProtAll]
-- Write machine code to be emulated to memory
memWrite uc address x86Code32MemRead
-- Initialize machine registers
regWrite uc X86.Ecx 0x1234
regWrite uc X86.Edx 0x7890
-- Tracing all basic block with customized callback
blockHookAdd uc hookBlock () 1 0
-- Tracing all instructions by having @beegin > @end
codeHookAdd uc hookCode () 1 0
-- Emulate machine code in infinite time
let codeLen = codeLength x86Code32MemRead
start uc address (address + codeLen) Nothing Nothing
-- Now print out some registers
emuPutStrLn ">>> Emulation done. Below is the CPU context"
ecx <- regRead uc X86.Ecx
edx <- regRead uc X86.Edx
emuPutStrLn $ ">>> ECX = 0x" ++ showHex ecx
emuPutStrLn $ ">>> EDX = 0x" ++ showHex edx
case result of
Right _ -> return ()
Left err -> putStrLn $ "Failed with error " ++ show err ++ ": " ++
strerror err
-- Emulate code that write invalid memory | 1,427 | false | true | 0 | 15 | 450 | 308 | 139 | 169 | null | null |
ardumont/haskell-lab | test/LoadAndUpdateIniTests.hs | gpl-2.0 | testCountPropertiess :: Test.HUnit.Test
testCountPropertiess = TestList ["testCountProperties1" ~: testCountProperties1] | 120 | testCountPropertiess :: Test.HUnit.Test
testCountPropertiess = TestList ["testCountProperties1" ~: testCountProperties1] | 120 | testCountPropertiess = TestList ["testCountProperties1" ~: testCountProperties1] | 80 | false | true | 0 | 7 | 8 | 24 | 13 | 11 | null | null |
rahulmutt/ghcvm | compiler/Eta/BasicTypes/Id.hs | bsd-3-clause | -- Note [Free type variables]
-- | Create a system local 'Id'. These are local 'Id's (see "Var#globalvslocal")
-- that are created by the compiler out of thin air
mkSysLocal :: FastString -> Unique -> Type -> Id
mkSysLocal fs uniq ty = mkLocalId (mkSystemVarName uniq fs) ty | 276 | mkSysLocal :: FastString -> Unique -> Type -> Id
mkSysLocal fs uniq ty = mkLocalId (mkSystemVarName uniq fs) ty | 111 | mkSysLocal fs uniq ty = mkLocalId (mkSystemVarName uniq fs) ty | 62 | true | true | 0 | 9 | 49 | 51 | 25 | 26 | null | null |
pikajude/yesod | yesod-core/Yesod/Core/Class/Yesod.hs | mit | defaultErrorHandler (InvalidArgs ia) = selectRep $ do
provideRep $ defaultLayout $ do
setTitle "Invalid Arguments"
toWidget [hamlet|
<h1>Invalid Arguments
<ul>
$forall msg <- ia
<li>#{msg}
|]
provideRep $ return $ object ["message" .= ("Invalid Arguments" :: Text), "errors" .= ia] | 373 | defaultErrorHandler (InvalidArgs ia) = selectRep $ do
provideRep $ defaultLayout $ do
setTitle "Invalid Arguments"
toWidget [hamlet|
<h1>Invalid Arguments
<ul>
$forall msg <- ia
<li>#{msg}
|]
provideRep $ return $ object ["message" .= ("Invalid Arguments" :: Text), "errors" .= ia] | 373 | defaultErrorHandler (InvalidArgs ia) = selectRep $ do
provideRep $ defaultLayout $ do
setTitle "Invalid Arguments"
toWidget [hamlet|
<h1>Invalid Arguments
<ul>
$forall msg <- ia
<li>#{msg}
|]
provideRep $ return $ object ["message" .= ("Invalid Arguments" :: Text), "errors" .= ia] | 373 | false | false | 0 | 12 | 131 | 80 | 40 | 40 | null | null |
jwiegley/ghc-release | libraries/transformers/Control/Monad/Trans/Error.hs | gpl-3.0 | liftPass :: Monad m => (m (Either e a,w -> w) -> m (Either e a)) ->
ErrorT e m (a,w -> w) -> ErrorT e m a
liftPass pass = mapErrorT $ \ m -> pass $ do
a <- m
return $! case a of
Left l -> (Left l, id)
Right (r, f) -> (Right r, f)
{- $examples
Wrapping an IO action that can throw an error @e@:
> type ErrorWithIO e a = ErrorT e IO a
> ==> ErrorT (IO (Either e a))
An IO monad wrapped in @StateT@ inside of @ErrorT@:
> type ErrorAndStateWithIO e s a = ErrorT e (StateT s IO) a
> ==> ErrorT (StateT s IO (Either e a))
> ==> ErrorT (StateT (s -> IO (Either e a,s)))
-} | 606 | liftPass :: Monad m => (m (Either e a,w -> w) -> m (Either e a)) ->
ErrorT e m (a,w -> w) -> ErrorT e m a
liftPass pass = mapErrorT $ \ m -> pass $ do
a <- m
return $! case a of
Left l -> (Left l, id)
Right (r, f) -> (Right r, f)
{- $examples
Wrapping an IO action that can throw an error @e@:
> type ErrorWithIO e a = ErrorT e IO a
> ==> ErrorT (IO (Either e a))
An IO monad wrapped in @StateT@ inside of @ErrorT@:
> type ErrorAndStateWithIO e s a = ErrorT e (StateT s IO) a
> ==> ErrorT (StateT s IO (Either e a))
> ==> ErrorT (StateT (s -> IO (Either e a,s)))
-} | 606 | liftPass pass = mapErrorT $ \ m -> pass $ do
a <- m
return $! case a of
Left l -> (Left l, id)
Right (r, f) -> (Right r, f)
{- $examples
Wrapping an IO action that can throw an error @e@:
> type ErrorWithIO e a = ErrorT e IO a
> ==> ErrorT (IO (Either e a))
An IO monad wrapped in @StateT@ inside of @ErrorT@:
> type ErrorAndStateWithIO e s a = ErrorT e (StateT s IO) a
> ==> ErrorT (StateT s IO (Either e a))
> ==> ErrorT (StateT (s -> IO (Either e a,s)))
-} | 496 | false | true | 0 | 15 | 171 | 163 | 82 | 81 | null | null |
ocramz/CurveProject | src/Math/TikzGenerator.hs | bsd-3-clause | drawCurve :: Int -> CGConfig -> CurveOptions -> Curve -> Builder
drawCurve i CGConfig{comments} CurveOpts{..} (BezierJoints (map piPoint -> p:c:ps)) =
mWhen comments ("% Courbe n°" <> decimal i <> "\n")
<> "\\draw[" <> fromString curveColor <> ", " <> fromString curveStyle <> "] "
<> point p <> " .. controls " <> point c <> go ps
where
go [c,p] = " and " <> point c <> " .. " <> point p <> ";\n\n"
go (lc:p:rc:ps) = " and " <> point lc <> " .. " <> point p <> " .. controls " <> point rc <> go ps | 514 | drawCurve :: Int -> CGConfig -> CurveOptions -> Curve -> Builder
drawCurve i CGConfig{comments} CurveOpts{..} (BezierJoints (map piPoint -> p:c:ps)) =
mWhen comments ("% Courbe n°" <> decimal i <> "\n")
<> "\\draw[" <> fromString curveColor <> ", " <> fromString curveStyle <> "] "
<> point p <> " .. controls " <> point c <> go ps
where
go [c,p] = " and " <> point c <> " .. " <> point p <> ";\n\n"
go (lc:p:rc:ps) = " and " <> point lc <> " .. " <> point p <> " .. controls " <> point rc <> go ps | 514 | drawCurve i CGConfig{comments} CurveOpts{..} (BezierJoints (map piPoint -> p:c:ps)) =
mWhen comments ("% Courbe n°" <> decimal i <> "\n")
<> "\\draw[" <> fromString curveColor <> ", " <> fromString curveStyle <> "] "
<> point p <> " .. controls " <> point c <> go ps
where
go [c,p] = " and " <> point c <> " .. " <> point p <> ";\n\n"
go (lc:p:rc:ps) = " and " <> point lc <> " .. " <> point p <> " .. controls " <> point rc <> go ps | 449 | false | true | 4 | 11 | 120 | 245 | 115 | 130 | null | null |
christiaanb/clash-tryout | src/CLaSH/Normalize/Transformations.hs | bsd-3-clause | inlineBox _ _ = fail "inlineBox" | 32 | inlineBox _ _ = fail "inlineBox" | 32 | inlineBox _ _ = fail "inlineBox" | 32 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
DavidAlphaFox/ghc | libraries/pretty/src/Text/PrettyPrint/HughesPJ.hs | bsd-3-clause | fullRender LeftMode _ _ txt end doc
= easyDisplay nlText first txt end (reduceDoc doc) | 91 | fullRender LeftMode _ _ txt end doc
= easyDisplay nlText first txt end (reduceDoc doc) | 91 | fullRender LeftMode _ _ txt end doc
= easyDisplay nlText first txt end (reduceDoc doc) | 91 | false | false | 0 | 7 | 19 | 36 | 17 | 19 | null | null |
kazu-yamamoto/mighttpd2 | test/ConfigSpec.hs | bsd-3-clause | spec :: Spec
spec = do
describe "parseConfig" $ do
it "parses example.conf correctly" $ do
res <- parseOption "conf/example.conf"
res { opt_server_name = "foo" } `shouldBe` ans
#ifdef DHALL
describe "parseDhall" $ do
it "parses example.dhall correctly" $ do
res <- parseOptionDhall "./conf/example.dhall"
res { opt_server_name = "foo" } `shouldBe` ans
#endif | 431 | spec :: Spec
spec = do
describe "parseConfig" $ do
it "parses example.conf correctly" $ do
res <- parseOption "conf/example.conf"
res { opt_server_name = "foo" } `shouldBe` ans
#ifdef DHALL
describe "parseDhall" $ do
it "parses example.dhall correctly" $ do
res <- parseOptionDhall "./conf/example.dhall"
res { opt_server_name = "foo" } `shouldBe` ans
#endif | 431 | spec = do
describe "parseConfig" $ do
it "parses example.conf correctly" $ do
res <- parseOption "conf/example.conf"
res { opt_server_name = "foo" } `shouldBe` ans
#ifdef DHALL
describe "parseDhall" $ do
it "parses example.dhall correctly" $ do
res <- parseOptionDhall "./conf/example.dhall"
res { opt_server_name = "foo" } `shouldBe` ans
#endif | 418 | false | true | 0 | 21 | 125 | 108 | 52 | 56 | null | null |
patrikja/LearningHaskellDataAnalysis | LearnHaskDA/Chapter7.hs | bsd-3-clause | test129' :: IO ( Counts MyWord
, Counts Lang
, HashMap Lang (Counts MyWord))
test129' = do
tweets <- test125
let freqTable = frequency tweets
let uniqueTweets = HM.keys freqTable
let cleanedTweets = zip (L.map snd uniqueTweets) (L.map (clean.fst) uniqueTweets)
let languageFrequency = (frequency . L.map fst) cleanedTweets
let wordFreqByLang = wordFrequencyByFst cleanedTweets
let wordFrequency = (frequency . concat) (L.map snd cleanedTweets)
return (wordFrequency, languageFrequency, wordFreqByLang) | 577 | test129' :: IO ( Counts MyWord
, Counts Lang
, HashMap Lang (Counts MyWord))
test129' = do
tweets <- test125
let freqTable = frequency tweets
let uniqueTweets = HM.keys freqTable
let cleanedTweets = zip (L.map snd uniqueTweets) (L.map (clean.fst) uniqueTweets)
let languageFrequency = (frequency . L.map fst) cleanedTweets
let wordFreqByLang = wordFrequencyByFst cleanedTweets
let wordFrequency = (frequency . concat) (L.map snd cleanedTweets)
return (wordFrequency, languageFrequency, wordFreqByLang) | 577 | test129' = do
tweets <- test125
let freqTable = frequency tweets
let uniqueTweets = HM.keys freqTable
let cleanedTweets = zip (L.map snd uniqueTweets) (L.map (clean.fst) uniqueTweets)
let languageFrequency = (frequency . L.map fst) cleanedTweets
let wordFreqByLang = wordFrequencyByFst cleanedTweets
let wordFrequency = (frequency . concat) (L.map snd cleanedTweets)
return (wordFrequency, languageFrequency, wordFreqByLang) | 470 | false | true | 0 | 14 | 141 | 192 | 91 | 101 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Word8.hs | bsd-3-clause | _X = 0x58 | 9 | _X = 0x58 | 9 | _X = 0x58 | 9 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
umairsd/course-haskell-cis194 | hw02/LogAnalysis.hs | mit | tsForLog (LogMessage _ ts _) = ts | 33 | tsForLog (LogMessage _ ts _) = ts | 33 | tsForLog (LogMessage _ ts _) = ts | 33 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
xor-xor/webapp_spock | test/Spec.hs | bsd-3-clause | loginTestUser :: WaiSession SResponse
loginTestUser = postHtmlForm "/login" [ ("username", testUser)
, ("password", testPassword)
] | 207 | loginTestUser :: WaiSession SResponse
loginTestUser = postHtmlForm "/login" [ ("username", testUser)
, ("password", testPassword)
] | 207 | loginTestUser = postHtmlForm "/login" [ ("username", testUser)
, ("password", testPassword)
] | 169 | false | true | 1 | 7 | 90 | 40 | 21 | 19 | null | null |
sjakobi/stack | src/main/Main.hs | bsd-3-clause | -- | Fix up extra-deps for a project
solverCmd :: Bool -- ^ modify stack.yaml automatically?
-> GlobalOpts
-> IO ()
solverCmd fixStackYaml go =
withBuildConfigAndLock go (\_ -> solveExtraDeps fixStackYaml) | 229 | solverCmd :: Bool -- ^ modify stack.yaml automatically?
-> GlobalOpts
-> IO ()
solverCmd fixStackYaml go =
withBuildConfigAndLock go (\_ -> solveExtraDeps fixStackYaml) | 192 | solverCmd fixStackYaml go =
withBuildConfigAndLock go (\_ -> solveExtraDeps fixStackYaml) | 93 | true | true | 0 | 9 | 54 | 51 | 25 | 26 | null | null |
Frefreak/solitaire-solver | src/Types.hs | bsd-3-clause | rankCard (Tiao n) = n | 21 | rankCard (Tiao n) = n | 21 | rankCard (Tiao n) = n | 21 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
jstolarek/ghc | compiler/cmm/PprC.hs | bsd-3-clause | te_Expr (CmmStackSlot _ _) = panic "te_Expr: CmmStackSlot not supported!" | 78 | te_Expr (CmmStackSlot _ _) = panic "te_Expr: CmmStackSlot not supported!" | 78 | te_Expr (CmmStackSlot _ _) = panic "te_Expr: CmmStackSlot not supported!" | 78 | false | false | 0 | 6 | 14 | 21 | 9 | 12 | null | null |
rdnetto/persistent | persistent-sqlite/Database/Sqlite.hs | mit | decodeError 101 = ErrorDone | 27 | decodeError 101 = ErrorDone | 27 | decodeError 101 = ErrorDone | 27 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
cobbpg/elerea | FRP/Elerea/Param.hs | bsd-3-clause | snapshot :: Signal a -> SignalGen p a
snapshot (S s) = SG $ \_ _ -> s | 69 | snapshot :: Signal a -> SignalGen p a
snapshot (S s) = SG $ \_ _ -> s | 69 | snapshot (S s) = SG $ \_ _ -> s | 31 | false | true | 0 | 7 | 17 | 43 | 21 | 22 | null | null |
micknelso/language-c | src/Language/CFamily/Data/Position.hs | bsd-3-clause | -- | adjust position: change file and line number, reseting column to 1. This is usually
-- used for #LINE pragmas. The absolute offset is not changed - this can be done
-- by @adjustPos newFile line . incPos (length pragma)@.
adjustPos :: FilePath -> Int -> Position -> Position
adjustPos fname row (Position offs _ _ _) = Position offs fname row 1 | 353 | adjustPos :: FilePath -> Int -> Position -> Position
adjustPos fname row (Position offs _ _ _) = Position offs fname row 1 | 122 | adjustPos fname row (Position offs _ _ _) = Position offs fname row 1 | 69 | true | true | 0 | 7 | 67 | 54 | 28 | 26 | null | null |
FranklinChen/stable-maps | System/Mem/StableName/Map.hs | bsd-3-clause | member :: StableName a -> Map f -> Bool
member k m = case lookup k m of
Nothing -> False
Just _ -> True | 111 | member :: StableName a -> Map f -> Bool
member k m = case lookup k m of
Nothing -> False
Just _ -> True | 111 | member k m = case lookup k m of
Nothing -> False
Just _ -> True | 71 | false | true | 3 | 7 | 32 | 54 | 25 | 29 | null | null |
chinaran/haskell-study | ch01/WC.hs | apache-2.0 | -- counts the number of lines int its input
main = interact wordConut
where wordConut input = show (length (lines input)) ++ "\n"
--where wordConut input = show (length (words input)) ++ "\n"
--where wordConut input = show (length input) ++ "\n" | 259 | main = interact wordConut
where wordConut input = show (length (lines input)) ++ "\n"
--where wordConut input = show (length (words input)) ++ "\n"
--where wordConut input = show (length input) ++ "\n" | 214 | main = interact wordConut
where wordConut input = show (length (lines input)) ++ "\n"
--where wordConut input = show (length (words input)) ++ "\n"
--where wordConut input = show (length input) ++ "\n" | 214 | true | false | 0 | 10 | 55 | 41 | 21 | 20 | null | null |
lordi/jazzmate | src/GUI/Render.hs | gpl-2.0 | centerShowText :: String -> Double -> Double -> C.Render ()
centerShowText s cx cy = do
te <- C.textExtents s
C.moveTo (cx - (C.textExtentsWidth te)/2) (cy + (C.textExtentsHeight te)/2)
C.showText s
return () | 256 | centerShowText :: String -> Double -> Double -> C.Render ()
centerShowText s cx cy = do
te <- C.textExtents s
C.moveTo (cx - (C.textExtentsWidth te)/2) (cy + (C.textExtentsHeight te)/2)
C.showText s
return () | 256 | centerShowText s cx cy = do
te <- C.textExtents s
C.moveTo (cx - (C.textExtentsWidth te)/2) (cy + (C.textExtentsHeight te)/2)
C.showText s
return () | 196 | false | true | 0 | 14 | 80 | 119 | 54 | 65 | null | null |
kairuku/stack | src/Stack/PackageDump.hs | bsd-3-clause | isProfiling :: FilePath -- ^ entry in directory
-> ByteString -- ^ name of library
-> Bool
isProfiling content lib =
prefix `S.isPrefixOf` S8.pack content
where
prefix = S.concat ["lib", lib, "_p"]
-- | Add haddock information to the stream of @DumpPackage@s | 293 | isProfiling :: FilePath -- ^ entry in directory
-> ByteString -- ^ name of library
-> Bool
isProfiling content lib =
prefix `S.isPrefixOf` S8.pack content
where
prefix = S.concat ["lib", lib, "_p"]
-- | Add haddock information to the stream of @DumpPackage@s | 293 | isProfiling content lib =
prefix `S.isPrefixOf` S8.pack content
where
prefix = S.concat ["lib", lib, "_p"]
-- | Add haddock information to the stream of @DumpPackage@s | 178 | false | true | 0 | 7 | 76 | 62 | 34 | 28 | null | null |
thalerjonathan/phd | public/ArtIterating/code/haskell/PureAgentsPar/src/WildFire/WildFireModelStatic.hs | gpl-3.0 | agentNeighbours :: WFAgent -> [WFAgent] -> (Int, Int) -> [WFAgent]
agentNeighbours a as cells = filter (\a' -> any (==(agentToCell a' cells)) neighbourCells ) as
where
aCell = agentToCell a cells
neighbourCells = neighbours aCell | 249 | agentNeighbours :: WFAgent -> [WFAgent] -> (Int, Int) -> [WFAgent]
agentNeighbours a as cells = filter (\a' -> any (==(agentToCell a' cells)) neighbourCells ) as
where
aCell = agentToCell a cells
neighbourCells = neighbours aCell | 249 | agentNeighbours a as cells = filter (\a' -> any (==(agentToCell a' cells)) neighbourCells ) as
where
aCell = agentToCell a cells
neighbourCells = neighbours aCell | 182 | false | true | 0 | 11 | 54 | 92 | 49 | 43 | null | null |
fmapfmapfmap/amazonka | amazonka-glacier/test/Test/AWS/Gen/Glacier.hs | mpl-2.0 | testListTagsForVault :: ListTagsForVault -> TestTree
testListTagsForVault = req
"ListTagsForVault"
"fixture/ListTagsForVault.yaml" | 138 | testListTagsForVault :: ListTagsForVault -> TestTree
testListTagsForVault = req
"ListTagsForVault"
"fixture/ListTagsForVault.yaml" | 138 | testListTagsForVault = req
"ListTagsForVault"
"fixture/ListTagsForVault.yaml" | 85 | false | true | 0 | 5 | 17 | 21 | 10 | 11 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_139 (193#) = happyShift action_69 | 40 | action_139 (193#) = happyShift action_69 | 40 | action_139 (193#) = happyShift action_69 | 40 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
siliconbrain/khaland | src/Speed.hs | bsd-3-clause | multiply :: (RealFrac a) => Speed a -> a -> Speed a
(MetersPerSecond v) `multiply` m = MetersPerSecond $ v * m | 110 | multiply :: (RealFrac a) => Speed a -> a -> Speed a
(MetersPerSecond v) `multiply` m = MetersPerSecond $ v * m | 110 | (MetersPerSecond v) `multiply` m = MetersPerSecond $ v * m | 58 | false | true | 1 | 11 | 21 | 57 | 27 | 30 | null | null |
ARCCN/hcprobe | src/HCProbe/EDSL/PacketGeneration.hs | bsd-3-clause | putQueueStatsReply :: Writer (Endo OfpStatsReplyData) a -> Writer (Endo OfpMessage) ()
putQueueStatsReply w =
tell . Endo $ \m -> m{ofp_data = OfpStatsReply (appEndo (execWriter w) (OfpQueueStatsReply def def def def def))} | 227 | putQueueStatsReply :: Writer (Endo OfpStatsReplyData) a -> Writer (Endo OfpMessage) ()
putQueueStatsReply w =
tell . Endo $ \m -> m{ofp_data = OfpStatsReply (appEndo (execWriter w) (OfpQueueStatsReply def def def def def))} | 227 | putQueueStatsReply w =
tell . Endo $ \m -> m{ofp_data = OfpStatsReply (appEndo (execWriter w) (OfpQueueStatsReply def def def def def))} | 140 | false | true | 6 | 12 | 35 | 107 | 48 | 59 | null | null |
urbanslug/ghc | compiler/basicTypes/Literal.hs | bsd-3-clause | litIsDupable :: DynFlags -> Literal -> Bool
-- c.f. CoreUtils.exprIsDupable
litIsDupable _ (MachStr _) = False | 125 | litIsDupable :: DynFlags -> Literal -> Bool
litIsDupable _ (MachStr _) = False | 88 | litIsDupable _ (MachStr _) = False | 44 | true | true | 0 | 10 | 30 | 37 | 17 | 20 | null | null |
Happy0/snowdrift | tests/TestImport.hs | agpl-3.0 | login :: (Yesod site) => YesodExample site ()
login = do
get $ urlPath $ testRoot `T.append` "/auth/login"
statusIs 200
submitLogin "test" "test"
-- Do a login (using hashdb auth). This just attempts to go to the home
-- url, and follows through the login process. It should probably be the
-- first thing in each "it" spec.
-- | 342 | login :: (Yesod site) => YesodExample site ()
login = do
get $ urlPath $ testRoot `T.append` "/auth/login"
statusIs 200
submitLogin "test" "test"
-- Do a login (using hashdb auth). This just attempts to go to the home
-- url, and follows through the login process. It should probably be the
-- first thing in each "it" spec.
-- | 342 | login = do
get $ urlPath $ testRoot `T.append` "/auth/login"
statusIs 200
submitLogin "test" "test"
-- Do a login (using hashdb auth). This just attempts to go to the home
-- url, and follows through the login process. It should probably be the
-- first thing in each "it" spec.
-- | 296 | false | true | 0 | 9 | 73 | 64 | 33 | 31 | null | null |
tolysz/prepare-ghcjs | spec-lts8/aeson/Data/Aeson/Encoding/Internal.hs | bsd-3-clause | -- | Make Encoding from Builder.
--
-- Use with care! You have to make sure that the passed Builder
-- is a valid JSON Encoding!
unsafeToEncoding :: Builder -> Encoding' a
unsafeToEncoding = Encoding | 199 | unsafeToEncoding :: Builder -> Encoding' a
unsafeToEncoding = Encoding | 70 | unsafeToEncoding = Encoding | 27 | true | true | 0 | 6 | 34 | 22 | 13 | 9 | null | null |
TheCrafter/tvaddict | src/Main.hs | mit | getSeriesInfo :: IO (Db.Series)
getSeriesInfo = do
putStrLn "Write the name of the series you want to add"
name <- getLine
putStrLn "Write the number of the season you're at"
season' <- getLine
let season = read season' :: Int
putStrLn "Write the number of the episode you're at"
episode' <- getLine
let episode = read episode' :: Int
return $ Series name $ Episode season episode | 414 | getSeriesInfo :: IO (Db.Series)
getSeriesInfo = do
putStrLn "Write the name of the series you want to add"
name <- getLine
putStrLn "Write the number of the season you're at"
season' <- getLine
let season = read season' :: Int
putStrLn "Write the number of the episode you're at"
episode' <- getLine
let episode = read episode' :: Int
return $ Series name $ Episode season episode | 413 | getSeriesInfo = do
putStrLn "Write the name of the series you want to add"
name <- getLine
putStrLn "Write the number of the season you're at"
season' <- getLine
let season = read season' :: Int
putStrLn "Write the number of the episode you're at"
episode' <- getLine
let episode = read episode' :: Int
return $ Series name $ Episode season episode | 381 | false | true | 0 | 10 | 100 | 107 | 47 | 60 | null | null |
josuf107/Adverb | Adverb/Common.hs | gpl-3.0 | purposely = id | 14 | purposely = id | 14 | purposely = id | 14 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs | mit | decomposeChar '\x2F859' = "\x214E4" | 35 | decomposeChar '\x2F859' = "\x214E4" | 35 | decomposeChar '\x2F859' = "\x214E4" | 35 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.