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
brendanhay/gogol
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/CreativeFieldValues/Patch.hs
mpl-2.0
-- | User profile ID associated with this request. cfvpProFileId :: Lens' CreativeFieldValuesPatch Int64 cfvpProFileId = lens _cfvpProFileId (\ s a -> s{_cfvpProFileId = a}) . _Coerce
197
cfvpProFileId :: Lens' CreativeFieldValuesPatch Int64 cfvpProFileId = lens _cfvpProFileId (\ s a -> s{_cfvpProFileId = a}) . _Coerce
146
cfvpProFileId = lens _cfvpProFileId (\ s a -> s{_cfvpProFileId = a}) . _Coerce
92
true
true
0
10
40
46
24
22
null
null
teleshoes/taffybar
src/System/Taffybar/Information/EWMHDesktopInfo.hs
bsd-3-clause
ewmhStateHidden = "_NET_WM_STATE_HIDDEN"
40
ewmhStateHidden = "_NET_WM_STATE_HIDDEN"
40
ewmhStateHidden = "_NET_WM_STATE_HIDDEN"
40
false
false
0
4
2
6
3
3
null
null
evansb/sacred
sacred/Logic.hs
mit
diff p (SLeaf txt1 _) (SLeaf txt2 _) | txt1 == txt2 = S.empty | otherwise = S.singleton (Change p (hash txt1) (hash txt2))
133
diff p (SLeaf txt1 _) (SLeaf txt2 _) | txt1 == txt2 = S.empty | otherwise = S.singleton (Change p (hash txt1) (hash txt2))
133
diff p (SLeaf txt1 _) (SLeaf txt2 _) | txt1 == txt2 = S.empty | otherwise = S.singleton (Change p (hash txt1) (hash txt2))
133
false
false
0
10
34
82
37
45
null
null
stevezhee/pec
Language/Pds/Abs.hs
bsd-3-clause
ppCxt x = case x of Cxt v1 v2 -> ppUident v1 <+> ppVarList v2
64
ppCxt x = case x of Cxt v1 v2 -> ppUident v1 <+> ppVarList v2
64
ppCxt x = case x of Cxt v1 v2 -> ppUident v1 <+> ppVarList v2
64
false
false
1
9
17
37
15
22
null
null
zerokarmaleft/krom
src/Main.hs
bsd-3-clause
registrationMessages :: KromConfig -> [Message] registrationMessages config = let configuredPassword = CharBS.pack $ config ^. kromRemotePassword configuredNickName = CharBS.pack $ config ^. kromNickName joinChanMessages = map (joinChan . CharBS.pack) $ config ^. kromJoinChannels in [ password configuredPassword , nick configuredNickName , user configuredNickName "0" "*" configuredNickName ] ++ joinChanMessages
455
registrationMessages :: KromConfig -> [Message] registrationMessages config = let configuredPassword = CharBS.pack $ config ^. kromRemotePassword configuredNickName = CharBS.pack $ config ^. kromNickName joinChanMessages = map (joinChan . CharBS.pack) $ config ^. kromJoinChannels in [ password configuredPassword , nick configuredNickName , user configuredNickName "0" "*" configuredNickName ] ++ joinChanMessages
455
registrationMessages config = let configuredPassword = CharBS.pack $ config ^. kromRemotePassword configuredNickName = CharBS.pack $ config ^. kromNickName joinChanMessages = map (joinChan . CharBS.pack) $ config ^. kromJoinChannels in [ password configuredPassword , nick configuredNickName , user configuredNickName "0" "*" configuredNickName ] ++ joinChanMessages
407
false
true
0
14
89
110
56
54
null
null
tolysz/prepare-ghcjs
spec-lts8/cabal/Cabal/Distribution/PackageDescription/Parse.hs
bsd-3-clause
------------------------------------------------------------------------------ sourceRepoFieldDescrs :: [FieldDescr SourceRepo] sourceRepoFieldDescrs = [ simpleField "type" (maybe empty disp) (fmap Just parse) repoType (\val repo -> repo { repoType = val }) , simpleField "location" (maybe empty showFreeText) (fmap Just parseFreeText) repoLocation (\val repo -> repo { repoLocation = val }) , simpleField "module" (maybe empty showToken) (fmap Just parseTokenQ) repoModule (\val repo -> repo { repoModule = val }) , simpleField "branch" (maybe empty showToken) (fmap Just parseTokenQ) repoBranch (\val repo -> repo { repoBranch = val }) , simpleField "tag" (maybe empty showToken) (fmap Just parseTokenQ) repoTag (\val repo -> repo { repoTag = val }) , simpleField "subdir" (maybe empty showFilePath) (fmap Just parseFilePathQ) repoSubdir (\val repo -> repo { repoSubdir = val }) ]
1,123
sourceRepoFieldDescrs :: [FieldDescr SourceRepo] sourceRepoFieldDescrs = [ simpleField "type" (maybe empty disp) (fmap Just parse) repoType (\val repo -> repo { repoType = val }) , simpleField "location" (maybe empty showFreeText) (fmap Just parseFreeText) repoLocation (\val repo -> repo { repoLocation = val }) , simpleField "module" (maybe empty showToken) (fmap Just parseTokenQ) repoModule (\val repo -> repo { repoModule = val }) , simpleField "branch" (maybe empty showToken) (fmap Just parseTokenQ) repoBranch (\val repo -> repo { repoBranch = val }) , simpleField "tag" (maybe empty showToken) (fmap Just parseTokenQ) repoTag (\val repo -> repo { repoTag = val }) , simpleField "subdir" (maybe empty showFilePath) (fmap Just parseFilePathQ) repoSubdir (\val repo -> repo { repoSubdir = val }) ]
1,043
sourceRepoFieldDescrs = [ simpleField "type" (maybe empty disp) (fmap Just parse) repoType (\val repo -> repo { repoType = val }) , simpleField "location" (maybe empty showFreeText) (fmap Just parseFreeText) repoLocation (\val repo -> repo { repoLocation = val }) , simpleField "module" (maybe empty showToken) (fmap Just parseTokenQ) repoModule (\val repo -> repo { repoModule = val }) , simpleField "branch" (maybe empty showToken) (fmap Just parseTokenQ) repoBranch (\val repo -> repo { repoBranch = val }) , simpleField "tag" (maybe empty showToken) (fmap Just parseTokenQ) repoTag (\val repo -> repo { repoTag = val }) , simpleField "subdir" (maybe empty showFilePath) (fmap Just parseFilePathQ) repoSubdir (\val repo -> repo { repoSubdir = val }) ]
994
true
true
0
10
362
306
166
140
null
null
DanielWaterworth/Idris-dev
src/Idris/REPL.hs
bsd-3-clause
ideslaveProcess fn _ = iPrintError "command not recognized or not supported"
76
ideslaveProcess fn _ = iPrintError "command not recognized or not supported"
76
ideslaveProcess fn _ = iPrintError "command not recognized or not supported"
76
false
false
0
5
10
14
6
8
null
null
isomorphism/hackage2
Distribution/Server/Packages/PackageIndex.hs
bsd-3-clause
insertWith :: Package pkg => (pkg -> pkg -> pkg) -> pkg -> PackageIndex pkg -> PackageIndex pkg insertWith mergeFunc pkg (PackageIndex index) = mkPackageIndex $ Map.insertWith (\_ -> insertMerge) (packageName pkg) [pkg] index where pkgid = packageId pkg insertMerge [] = [pkg] insertMerge pkgs@(pkg':pkgs') = case compare pkgid (packageId pkg') of LT -> pkg : pkgs EQ -> let merged = mergeFunc pkg pkg' in if packageId merged == pkgid then merged : pkgs' else pkg : pkgs' GT -> pkg' : insertMerge pkgs' -- | Internal delete helper. --
634
insertWith :: Package pkg => (pkg -> pkg -> pkg) -> pkg -> PackageIndex pkg -> PackageIndex pkg insertWith mergeFunc pkg (PackageIndex index) = mkPackageIndex $ Map.insertWith (\_ -> insertMerge) (packageName pkg) [pkg] index where pkgid = packageId pkg insertMerge [] = [pkg] insertMerge pkgs@(pkg':pkgs') = case compare pkgid (packageId pkg') of LT -> pkg : pkgs EQ -> let merged = mergeFunc pkg pkg' in if packageId merged == pkgid then merged : pkgs' else pkg : pkgs' GT -> pkg' : insertMerge pkgs' -- | Internal delete helper. --
634
insertWith mergeFunc pkg (PackageIndex index) = mkPackageIndex $ Map.insertWith (\_ -> insertMerge) (packageName pkg) [pkg] index where pkgid = packageId pkg insertMerge [] = [pkg] insertMerge pkgs@(pkg':pkgs') = case compare pkgid (packageId pkg') of LT -> pkg : pkgs EQ -> let merged = mergeFunc pkg pkg' in if packageId merged == pkgid then merged : pkgs' else pkg : pkgs' GT -> pkg' : insertMerge pkgs' -- | Internal delete helper. --
538
false
true
0
12
190
219
110
109
null
null
mstksg/expr-gadt
src/Data/ExprGADT/Eval.hs
bsd-3-clause
-- maybe can do the same trick with Either to get rid of EStar? evalWithP :: forall vs a. HList vs -> ExprP vs a -> a evalWithP vs = go where go :: forall b. ExprP vs b -> b go e = case e of VP ix -> subIndexor vs ix TP o ts -> tOp o $ map' (go . getComp) ts OP o _ es -> op o $ map' (Identity . go) es LambdaP _ eλ -> \x -> evalWithP (x :<- vs) eλ -- fromExprP :: forall vs a. ExprP vs a -> Either ETypeW (Expr vs a) -- fromExprP = go -- where -- go :: forall us b. ExprP us b -> Either ETypeW (Expr us b) -- go e = case e of -- VP ix -> Right (V ix) -- -- oops this is now unwritable -- -- okay let's calm down. the result of traverse' go ts is -- -- a Prod of Expr vs (EType a)'s. And the only thing those -- -- can be are V's...or whatever the result of this function -- -- is. Maybe the Left term should be ETypeW's, and this could -- -- be aggregating ETypeW's. ANd if it's Right, it's because -- -- it's variables, and...? -- -- ah well there's the problem, ain't it? -- -- hm, will anything go badly if this is just...undefined? -- -- well, it would be nice to have a good Left. maybe see if -- -- they are all Left's, and if so, use tOp. and if one is -- -- a variable, then...? that's the problem huh? a variable, -- -- or a lambda? but maybe the lambda case should be taken -- -- care of in the lambda branch to auto-compress it. Hm. Oh, -- -- what if the varaible case is done as ewll? maybe not as -- -- simple. -- -- In the variable case, is it even solveable? -- -- maybe this can force us to not even consider this one? -- -- maybe Lambda case can be caught. and it would show up here -- -- as right. auto-evaluate for Lambdas. yaaah. -- TP o ts -> case traverse' (either (\etw -> Just (Const [etw])) (const Nothing) . go) ts of -- -- hm there is a problem here. what to -- -- return if there is some variable or -- -- something not reduceable? this would -- -- happen if there was an unbound variable. -- -- i wonder if i could write a way to -- -- evaluate exprp that returns types, that -- -- could account for unbound variables. but -- -- what would i even return if there were -- -- unbound variables? basically that would -- -- be like (a -> b) bound to an a. i guess -- -- that could only happen if it was -- -- introduced with lambda before??? maybe -- -- it's good -- -- but here we're basically relying on the -- -- fact that all cases will eventually not -- -- lead to Nothing. -- -- or well, the result can have unbound -- -- variables too, right? ... maybe just -- -- leave as V? -- -- but TP constructor...oops. -- -- hm maybe return an ExprP that only likes -- -- ExprP ETypes? -- Nothing -> undefined -- -- Right _ -> undefined -- -- Left (ETW t) -> -- -- TP o ts -> Left (f t) -- -- OP Ap (TP EStar :< _) (LambdaP (TP EStar) eλ :> et) -> go $ subIxorsP (g et) eλ -- OP o _ es -> O o <$> traverse' go es -- LambdaP _ eλ -> Lambda <$> go eλ -- where -- g :: forall c d. -- ExprP us (EType c) -- -> Indexor (EType c ': us) d -- -> ExprP us d -- g t IZ = t -- g _ (IS ix) = VP ix -- -- comper :: forall us b. Either ETypeW (Expr us b) -> Either ETypeW :.: Expr us -- -- comper = Comp -- fromExprP' :: forall vs r a. (forall b. EType b -> r) -> ExprP vs a -> Either r (Expr (DeLambdaList vs) (DeLambda a)) -- fromExprP' f = go -- where -- go :: forall us b. ExprP us b -> Either r (Expr (DeLambdaList us) (DeLambda b)) -- go e = case e of -- VP ix -> Right (V (deLambdaIx ix)) -- TP t -> Left (f t) -- O0p o _ -> case o of -- I i -> Right $ O0 (I i) -- B b -> Right $ O0 (B b) -- Unit -> Right $ O0 Unit -- Nil -> Right $ O0 Nil -- O1p o _ e1 -> case o of -- Abs -> O1 Abs <$> go e1 -- Signum -> O1 Signum <$> go e1 -- Not -> O1 Not <$> go e1 -- Left' -> O1 Left' <$> go e1 -- Right' -> O1 Right' <$> go e1 -- Fst -> O1 Fst <$> go e1 -- Snd -> O1 Snd <$> go e1 -- O2p o ts e1 e2 -> case o of -- Plus -> O2 Plus <$> go e1 <*> go e2 -- Times -> O2 Times <$> go e1 <*> go e2 -- Minus -> O2 Minus <$> go e1 <*> go e2 -- LEquals -> O2 LEquals <$> go e1 <*> go e2 -- And -> O2 And <$> go e1 <*> go e2 -- Or -> O2 Or <$> go e1 <*> go e2 -- Tup -> O2 Tup <$> go e1 <*> go e2 -- Cons -> O2 Cons <$> go e1 <*> go e2 -- Ap -> case (ts, e1, e2) of -- -- so can apply -- (TP EStar :< _, LambdaP (TP EStar) eλ, et) -> go $ subIxorsP (g et) eλ -- (_, LambdaP et eλ, _) -> O2 Ap <$> (Lambda <$> go eλ) <*> go e2 -- -- problem here ... wants to turn -- -- ExprP (a -> b) into Expr -- -- (DeLambda a -> DeLambda b), but -- -- really should be turning it -- -- into DeLambda (a -> b) -- -- (_, _, _) -> O2 Ap <$> (_ e1) <*> go e2 -- -- (TP EStar :< _, VP ix, et) -> Right $ V (deLambdaIx ix) -- -- (TP EStar :< _, VP ix, _) -> O2 Ap _ <$> go e2 -- -- (_, TP _, _) -> undefined -- (TP EInt :> TP EInt, _, _) -> O2 Ap <$> go e1 <*> go e2 -- -- (TP EInt :< _, _, _) -> do -- -- O2 Ap e1' e2' <- O2 Ap <$> go e1 <*> go e2 -- -- return $ O2 Ap (_ e1') e2' -- Div -> O2 Div <$> go e1 <*> go e2 -- Mod -> O2 Mod <$> go e1 <*> go e2 -- O3p o ts e1 e2 e3 -> case o of -- If -> O3 If <$> go e1 <*> go e2 <*> go e3 -- -- Case -> O3 If (go e1) (go e2) (go e3) -- -- UnfoldrN -> O3 UnfoldrN (go e1) (go e2) (go e3) -- -- Foldr -> O3 Foldr (go e1) (go e2) (go e3) -- where -- g :: forall c d. -- ExprP us (EType c) -- -> Indexor (EType c ': us) d -- -> ExprP us d -- g t IZ = t -- g _ (IS ix) = VP ix -- Unit -> O0 Unit -- Nil -> O0 Nil -- OP o _ es -> O o <$> traverse' go es -- go e = case e of -- VP ix -> Right (V ix) -- TP t -> Left (f t) -- OP Ap (TP EStar :< _) (LambdaP (TP EStar) eλ :> et) -> go $ subIxorsP (g et) eλ -- OP o _ es -> O o <$> traverse' go es -- LambdaP _ eλ -> Lambda <$> go eλ -- where -- g :: forall c d. -- ExprP us (EType c) -- -> Indexor (EType c ': us) d -- -> ExprP us d -- g t IZ = t -- g _ (IS ix) = VP ix
8,881
evalWithP :: forall vs a. HList vs -> ExprP vs a -> a evalWithP vs = go where go :: forall b. ExprP vs b -> b go e = case e of VP ix -> subIndexor vs ix TP o ts -> tOp o $ map' (go . getComp) ts OP o _ es -> op o $ map' (Identity . go) es LambdaP _ eλ -> \x -> evalWithP (x :<- vs) eλ -- fromExprP :: forall vs a. ExprP vs a -> Either ETypeW (Expr vs a) -- fromExprP = go -- where -- go :: forall us b. ExprP us b -> Either ETypeW (Expr us b) -- go e = case e of -- VP ix -> Right (V ix) -- -- oops this is now unwritable -- -- okay let's calm down. the result of traverse' go ts is -- -- a Prod of Expr vs (EType a)'s. And the only thing those -- -- can be are V's...or whatever the result of this function -- -- is. Maybe the Left term should be ETypeW's, and this could -- -- be aggregating ETypeW's. ANd if it's Right, it's because -- -- it's variables, and...? -- -- ah well there's the problem, ain't it? -- -- hm, will anything go badly if this is just...undefined? -- -- well, it would be nice to have a good Left. maybe see if -- -- they are all Left's, and if so, use tOp. and if one is -- -- a variable, then...? that's the problem huh? a variable, -- -- or a lambda? but maybe the lambda case should be taken -- -- care of in the lambda branch to auto-compress it. Hm. Oh, -- -- what if the varaible case is done as ewll? maybe not as -- -- simple. -- -- In the variable case, is it even solveable? -- -- maybe this can force us to not even consider this one? -- -- maybe Lambda case can be caught. and it would show up here -- -- as right. auto-evaluate for Lambdas. yaaah. -- TP o ts -> case traverse' (either (\etw -> Just (Const [etw])) (const Nothing) . go) ts of -- -- hm there is a problem here. what to -- -- return if there is some variable or -- -- something not reduceable? this would -- -- happen if there was an unbound variable. -- -- i wonder if i could write a way to -- -- evaluate exprp that returns types, that -- -- could account for unbound variables. but -- -- what would i even return if there were -- -- unbound variables? basically that would -- -- be like (a -> b) bound to an a. i guess -- -- that could only happen if it was -- -- introduced with lambda before??? maybe -- -- it's good -- -- but here we're basically relying on the -- -- fact that all cases will eventually not -- -- lead to Nothing. -- -- or well, the result can have unbound -- -- variables too, right? ... maybe just -- -- leave as V? -- -- but TP constructor...oops. -- -- hm maybe return an ExprP that only likes -- -- ExprP ETypes? -- Nothing -> undefined -- -- Right _ -> undefined -- -- Left (ETW t) -> -- -- TP o ts -> Left (f t) -- -- OP Ap (TP EStar :< _) (LambdaP (TP EStar) eλ :> et) -> go $ subIxorsP (g et) eλ -- OP o _ es -> O o <$> traverse' go es -- LambdaP _ eλ -> Lambda <$> go eλ -- where -- g :: forall c d. -- ExprP us (EType c) -- -> Indexor (EType c ': us) d -- -> ExprP us d -- g t IZ = t -- g _ (IS ix) = VP ix -- -- comper :: forall us b. Either ETypeW (Expr us b) -> Either ETypeW :.: Expr us -- -- comper = Comp -- fromExprP' :: forall vs r a. (forall b. EType b -> r) -> ExprP vs a -> Either r (Expr (DeLambdaList vs) (DeLambda a)) -- fromExprP' f = go -- where -- go :: forall us b. ExprP us b -> Either r (Expr (DeLambdaList us) (DeLambda b)) -- go e = case e of -- VP ix -> Right (V (deLambdaIx ix)) -- TP t -> Left (f t) -- O0p o _ -> case o of -- I i -> Right $ O0 (I i) -- B b -> Right $ O0 (B b) -- Unit -> Right $ O0 Unit -- Nil -> Right $ O0 Nil -- O1p o _ e1 -> case o of -- Abs -> O1 Abs <$> go e1 -- Signum -> O1 Signum <$> go e1 -- Not -> O1 Not <$> go e1 -- Left' -> O1 Left' <$> go e1 -- Right' -> O1 Right' <$> go e1 -- Fst -> O1 Fst <$> go e1 -- Snd -> O1 Snd <$> go e1 -- O2p o ts e1 e2 -> case o of -- Plus -> O2 Plus <$> go e1 <*> go e2 -- Times -> O2 Times <$> go e1 <*> go e2 -- Minus -> O2 Minus <$> go e1 <*> go e2 -- LEquals -> O2 LEquals <$> go e1 <*> go e2 -- And -> O2 And <$> go e1 <*> go e2 -- Or -> O2 Or <$> go e1 <*> go e2 -- Tup -> O2 Tup <$> go e1 <*> go e2 -- Cons -> O2 Cons <$> go e1 <*> go e2 -- Ap -> case (ts, e1, e2) of -- -- so can apply -- (TP EStar :< _, LambdaP (TP EStar) eλ, et) -> go $ subIxorsP (g et) eλ -- (_, LambdaP et eλ, _) -> O2 Ap <$> (Lambda <$> go eλ) <*> go e2 -- -- problem here ... wants to turn -- -- ExprP (a -> b) into Expr -- -- (DeLambda a -> DeLambda b), but -- -- really should be turning it -- -- into DeLambda (a -> b) -- -- (_, _, _) -> O2 Ap <$> (_ e1) <*> go e2 -- -- (TP EStar :< _, VP ix, et) -> Right $ V (deLambdaIx ix) -- -- (TP EStar :< _, VP ix, _) -> O2 Ap _ <$> go e2 -- -- (_, TP _, _) -> undefined -- (TP EInt :> TP EInt, _, _) -> O2 Ap <$> go e1 <*> go e2 -- -- (TP EInt :< _, _, _) -> do -- -- O2 Ap e1' e2' <- O2 Ap <$> go e1 <*> go e2 -- -- return $ O2 Ap (_ e1') e2' -- Div -> O2 Div <$> go e1 <*> go e2 -- Mod -> O2 Mod <$> go e1 <*> go e2 -- O3p o ts e1 e2 e3 -> case o of -- If -> O3 If <$> go e1 <*> go e2 <*> go e3 -- -- Case -> O3 If (go e1) (go e2) (go e3) -- -- UnfoldrN -> O3 UnfoldrN (go e1) (go e2) (go e3) -- -- Foldr -> O3 Foldr (go e1) (go e2) (go e3) -- where -- g :: forall c d. -- ExprP us (EType c) -- -> Indexor (EType c ': us) d -- -> ExprP us d -- g t IZ = t -- g _ (IS ix) = VP ix -- Unit -> O0 Unit -- Nil -> O0 Nil -- OP o _ es -> O o <$> traverse' go es -- go e = case e of -- VP ix -> Right (V ix) -- TP t -> Left (f t) -- OP Ap (TP EStar :< _) (LambdaP (TP EStar) eλ :> et) -> go $ subIxorsP (g et) eλ -- OP o _ es -> O o <$> traverse' go es -- LambdaP _ eλ -> Lambda <$> go eλ -- where -- g :: forall c d. -- ExprP us (EType c) -- -> Indexor (EType c ': us) d -- -> ExprP us d -- g t IZ = t -- g _ (IS ix) = VP ix
8,817
evalWithP vs = go where go :: forall b. ExprP vs b -> b go e = case e of VP ix -> subIndexor vs ix TP o ts -> tOp o $ map' (go . getComp) ts OP o _ es -> op o $ map' (Identity . go) es LambdaP _ eλ -> \x -> evalWithP (x :<- vs) eλ -- fromExprP :: forall vs a. ExprP vs a -> Either ETypeW (Expr vs a) -- fromExprP = go -- where -- go :: forall us b. ExprP us b -> Either ETypeW (Expr us b) -- go e = case e of -- VP ix -> Right (V ix) -- -- oops this is now unwritable -- -- okay let's calm down. the result of traverse' go ts is -- -- a Prod of Expr vs (EType a)'s. And the only thing those -- -- can be are V's...or whatever the result of this function -- -- is. Maybe the Left term should be ETypeW's, and this could -- -- be aggregating ETypeW's. ANd if it's Right, it's because -- -- it's variables, and...? -- -- ah well there's the problem, ain't it? -- -- hm, will anything go badly if this is just...undefined? -- -- well, it would be nice to have a good Left. maybe see if -- -- they are all Left's, and if so, use tOp. and if one is -- -- a variable, then...? that's the problem huh? a variable, -- -- or a lambda? but maybe the lambda case should be taken -- -- care of in the lambda branch to auto-compress it. Hm. Oh, -- -- what if the varaible case is done as ewll? maybe not as -- -- simple. -- -- In the variable case, is it even solveable? -- -- maybe this can force us to not even consider this one? -- -- maybe Lambda case can be caught. and it would show up here -- -- as right. auto-evaluate for Lambdas. yaaah. -- TP o ts -> case traverse' (either (\etw -> Just (Const [etw])) (const Nothing) . go) ts of -- -- hm there is a problem here. what to -- -- return if there is some variable or -- -- something not reduceable? this would -- -- happen if there was an unbound variable. -- -- i wonder if i could write a way to -- -- evaluate exprp that returns types, that -- -- could account for unbound variables. but -- -- what would i even return if there were -- -- unbound variables? basically that would -- -- be like (a -> b) bound to an a. i guess -- -- that could only happen if it was -- -- introduced with lambda before??? maybe -- -- it's good -- -- but here we're basically relying on the -- -- fact that all cases will eventually not -- -- lead to Nothing. -- -- or well, the result can have unbound -- -- variables too, right? ... maybe just -- -- leave as V? -- -- but TP constructor...oops. -- -- hm maybe return an ExprP that only likes -- -- ExprP ETypes? -- Nothing -> undefined -- -- Right _ -> undefined -- -- Left (ETW t) -> -- -- TP o ts -> Left (f t) -- -- OP Ap (TP EStar :< _) (LambdaP (TP EStar) eλ :> et) -> go $ subIxorsP (g et) eλ -- OP o _ es -> O o <$> traverse' go es -- LambdaP _ eλ -> Lambda <$> go eλ -- where -- g :: forall c d. -- ExprP us (EType c) -- -> Indexor (EType c ': us) d -- -> ExprP us d -- g t IZ = t -- g _ (IS ix) = VP ix -- -- comper :: forall us b. Either ETypeW (Expr us b) -> Either ETypeW :.: Expr us -- -- comper = Comp -- fromExprP' :: forall vs r a. (forall b. EType b -> r) -> ExprP vs a -> Either r (Expr (DeLambdaList vs) (DeLambda a)) -- fromExprP' f = go -- where -- go :: forall us b. ExprP us b -> Either r (Expr (DeLambdaList us) (DeLambda b)) -- go e = case e of -- VP ix -> Right (V (deLambdaIx ix)) -- TP t -> Left (f t) -- O0p o _ -> case o of -- I i -> Right $ O0 (I i) -- B b -> Right $ O0 (B b) -- Unit -> Right $ O0 Unit -- Nil -> Right $ O0 Nil -- O1p o _ e1 -> case o of -- Abs -> O1 Abs <$> go e1 -- Signum -> O1 Signum <$> go e1 -- Not -> O1 Not <$> go e1 -- Left' -> O1 Left' <$> go e1 -- Right' -> O1 Right' <$> go e1 -- Fst -> O1 Fst <$> go e1 -- Snd -> O1 Snd <$> go e1 -- O2p o ts e1 e2 -> case o of -- Plus -> O2 Plus <$> go e1 <*> go e2 -- Times -> O2 Times <$> go e1 <*> go e2 -- Minus -> O2 Minus <$> go e1 <*> go e2 -- LEquals -> O2 LEquals <$> go e1 <*> go e2 -- And -> O2 And <$> go e1 <*> go e2 -- Or -> O2 Or <$> go e1 <*> go e2 -- Tup -> O2 Tup <$> go e1 <*> go e2 -- Cons -> O2 Cons <$> go e1 <*> go e2 -- Ap -> case (ts, e1, e2) of -- -- so can apply -- (TP EStar :< _, LambdaP (TP EStar) eλ, et) -> go $ subIxorsP (g et) eλ -- (_, LambdaP et eλ, _) -> O2 Ap <$> (Lambda <$> go eλ) <*> go e2 -- -- problem here ... wants to turn -- -- ExprP (a -> b) into Expr -- -- (DeLambda a -> DeLambda b), but -- -- really should be turning it -- -- into DeLambda (a -> b) -- -- (_, _, _) -> O2 Ap <$> (_ e1) <*> go e2 -- -- (TP EStar :< _, VP ix, et) -> Right $ V (deLambdaIx ix) -- -- (TP EStar :< _, VP ix, _) -> O2 Ap _ <$> go e2 -- -- (_, TP _, _) -> undefined -- (TP EInt :> TP EInt, _, _) -> O2 Ap <$> go e1 <*> go e2 -- -- (TP EInt :< _, _, _) -> do -- -- O2 Ap e1' e2' <- O2 Ap <$> go e1 <*> go e2 -- -- return $ O2 Ap (_ e1') e2' -- Div -> O2 Div <$> go e1 <*> go e2 -- Mod -> O2 Mod <$> go e1 <*> go e2 -- O3p o ts e1 e2 e3 -> case o of -- If -> O3 If <$> go e1 <*> go e2 <*> go e3 -- -- Case -> O3 If (go e1) (go e2) (go e3) -- -- UnfoldrN -> O3 UnfoldrN (go e1) (go e2) (go e3) -- -- Foldr -> O3 Foldr (go e1) (go e2) (go e3) -- where -- g :: forall c d. -- ExprP us (EType c) -- -> Indexor (EType c ': us) d -- -> ExprP us d -- g t IZ = t -- g _ (IS ix) = VP ix -- Unit -> O0 Unit -- Nil -> O0 Nil -- OP o _ es -> O o <$> traverse' go es -- go e = case e of -- VP ix -> Right (V ix) -- TP t -> Left (f t) -- OP Ap (TP EStar :< _) (LambdaP (TP EStar) eλ :> et) -> go $ subIxorsP (g et) eλ -- OP o _ es -> O o <$> traverse' go es -- LambdaP _ eλ -> Lambda <$> go eλ -- where -- g :: forall c d. -- ExprP us (EType c) -- -> Indexor (EType c ': us) d -- -> ExprP us d -- g t IZ = t -- g _ (IS ix) = VP ix
8,763
true
true
0
11
4,544
320
228
92
null
null
massysett/penny
penny/lib/Penny/Copper/Grammar.hs
bsd-3-clause
-- Digit from 0 through 9 d0'9 = union "D0'9" [ zero, one, two, three, four, five, six, seven, eight, nine ]
110
d0'9 = union "D0'9" [ zero, one, two, three, four, five, six, seven, eight, nine ]
84
d0'9 = union "D0'9" [ zero, one, two, three, four, five, six, seven, eight, nine ]
84
true
false
0
5
23
43
26
17
null
null
lally/libmet
src/Ppt/Agent/Command.hs
bsd-3-clause
writeBufferToFile :: (Storable a, Show a, Integral a, FiniteBits a) => Handle -> VM.IOVector a -> Int -> Int -> Int -> IO () writeBufferToFile h vec startIndex nelements verb = do let hexList [] = [] hexList xs = (L.concatMap hex thisWord) ++ (' ':(hexList rest)) where hex n = (L.take (countLeadingZeros n `div` 4) $ L.repeat '0') ++ (showHex n " ") (thisWord, rest) = L.splitAt 4 xs readFn :: (Storable a, Integral a) => Ptr a-> IO ([a]) readFn p = do -- Don't actually need the data, just a value of 'a' from Ptr a to get its size. first <- peek p let size = sizeOf first start = plusPtr p startIndex :: Ptr a end = plusPtr start nelements :: Ptr a toList :: (Integral a, Storable a) => Ptr a -> Ptr a -> Int -> IO ([a]) toList s e sz | s == e = return [] | otherwise = do val <- peek s rest <- toList (plusPtr s sz) e sz return (val:rest) valList <- toList start end size -- :: (Storable a, Integral a) => IO ([a]) if verb > 0 then do putStrLn $ "calling hPutBuf with p=" ++ (show p) ++ " start=" ++ (show start) ++ " size=" ++ ( show $ size * nelements) ++ " and startIndex=" ++ show startIndex else return () hPutBuf h start nelements return valList lst <- VM.unsafeWith vec readFn if verb > 1 then putStrLn $ hexList lst else return () -- Actual command implementations of Agent-mode commands (attach)
1,671
writeBufferToFile :: (Storable a, Show a, Integral a, FiniteBits a) => Handle -> VM.IOVector a -> Int -> Int -> Int -> IO () writeBufferToFile h vec startIndex nelements verb = do let hexList [] = [] hexList xs = (L.concatMap hex thisWord) ++ (' ':(hexList rest)) where hex n = (L.take (countLeadingZeros n `div` 4) $ L.repeat '0') ++ (showHex n " ") (thisWord, rest) = L.splitAt 4 xs readFn :: (Storable a, Integral a) => Ptr a-> IO ([a]) readFn p = do -- Don't actually need the data, just a value of 'a' from Ptr a to get its size. first <- peek p let size = sizeOf first start = plusPtr p startIndex :: Ptr a end = plusPtr start nelements :: Ptr a toList :: (Integral a, Storable a) => Ptr a -> Ptr a -> Int -> IO ([a]) toList s e sz | s == e = return [] | otherwise = do val <- peek s rest <- toList (plusPtr s sz) e sz return (val:rest) valList <- toList start end size -- :: (Storable a, Integral a) => IO ([a]) if verb > 0 then do putStrLn $ "calling hPutBuf with p=" ++ (show p) ++ " start=" ++ (show start) ++ " size=" ++ ( show $ size * nelements) ++ " and startIndex=" ++ show startIndex else return () hPutBuf h start nelements return valList lst <- VM.unsafeWith vec readFn if verb > 1 then putStrLn $ hexList lst else return () -- Actual command implementations of Agent-mode commands (attach)
1,671
writeBufferToFile h vec startIndex nelements verb = do let hexList [] = [] hexList xs = (L.concatMap hex thisWord) ++ (' ':(hexList rest)) where hex n = (L.take (countLeadingZeros n `div` 4) $ L.repeat '0') ++ (showHex n " ") (thisWord, rest) = L.splitAt 4 xs readFn :: (Storable a, Integral a) => Ptr a-> IO ([a]) readFn p = do -- Don't actually need the data, just a value of 'a' from Ptr a to get its size. first <- peek p let size = sizeOf first start = plusPtr p startIndex :: Ptr a end = plusPtr start nelements :: Ptr a toList :: (Integral a, Storable a) => Ptr a -> Ptr a -> Int -> IO ([a]) toList s e sz | s == e = return [] | otherwise = do val <- peek s rest <- toList (plusPtr s sz) e sz return (val:rest) valList <- toList start end size -- :: (Storable a, Integral a) => IO ([a]) if verb > 0 then do putStrLn $ "calling hPutBuf with p=" ++ (show p) ++ " start=" ++ (show start) ++ " size=" ++ ( show $ size * nelements) ++ " and startIndex=" ++ show startIndex else return () hPutBuf h start nelements return valList lst <- VM.unsafeWith vec readFn if verb > 1 then putStrLn $ hexList lst else return () -- Actual command implementations of Agent-mode commands (attach)
1,546
false
true
0
24
623
588
283
305
null
null
haskell-pkg-janitors/feed
Text/Feed/Query.hs
bsd-3-clause
getItemPublishDate :: ItemGetter DateText getItemPublishDate it = case it of Feed.AtomItem i -> Just $ Atom.entryUpdated i Feed.RSSItem i -> RSS.rssItemPubDate i Feed.RSS1Item i -> case filter isDate $ RSS1.itemDC i of (dci:_) -> Just (dcText dci) _ -> Nothing -- ToDo: look for it in Atom \/ RSS1 like-content as well if no 'pubDate' element. Feed.XMLItem e -> fmap XML.strContent $ findElement (unqual "pubDate") e where isDate dc = dcElt dc == DC_Date
505
getItemPublishDate :: ItemGetter DateText getItemPublishDate it = case it of Feed.AtomItem i -> Just $ Atom.entryUpdated i Feed.RSSItem i -> RSS.rssItemPubDate i Feed.RSS1Item i -> case filter isDate $ RSS1.itemDC i of (dci:_) -> Just (dcText dci) _ -> Nothing -- ToDo: look for it in Atom \/ RSS1 like-content as well if no 'pubDate' element. Feed.XMLItem e -> fmap XML.strContent $ findElement (unqual "pubDate") e where isDate dc = dcElt dc == DC_Date
505
getItemPublishDate it = case it of Feed.AtomItem i -> Just $ Atom.entryUpdated i Feed.RSSItem i -> RSS.rssItemPubDate i Feed.RSS1Item i -> case filter isDate $ RSS1.itemDC i of (dci:_) -> Just (dcText dci) _ -> Nothing -- ToDo: look for it in Atom \/ RSS1 like-content as well if no 'pubDate' element. Feed.XMLItem e -> fmap XML.strContent $ findElement (unqual "pubDate") e where isDate dc = dcElt dc == DC_Date
463
false
true
5
10
124
137
66
71
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
happyReduction_21 _ = notHappyAtAll
36
happyReduction_21 _ = notHappyAtAll
36
happyReduction_21 _ = notHappyAtAll
36
false
false
0
5
4
9
4
5
null
null
RakNoel/INF122
src/Oblig1.hs
gpl-3.0
varCheck :: Ast -> [String] -> [String] varCheck ast p = case ast of (If var t f) -> varCheckEx var ++ varCheckEx t ++ varCheckEx f (Let s a b) -> varCheckEx a ++ varCheck b (s:p) (Var s) -> if s `elem` p then [] else [s] (Sum a b) -> varCheckEx a ++ varCheckEx b (Mul a b) -> varCheckEx a ++ varCheckEx b (Min a) -> varCheckEx a (Nr _) -> [] where varCheckEx x = varCheck x p
431
varCheck :: Ast -> [String] -> [String] varCheck ast p = case ast of (If var t f) -> varCheckEx var ++ varCheckEx t ++ varCheckEx f (Let s a b) -> varCheckEx a ++ varCheck b (s:p) (Var s) -> if s `elem` p then [] else [s] (Sum a b) -> varCheckEx a ++ varCheckEx b (Mul a b) -> varCheckEx a ++ varCheckEx b (Min a) -> varCheckEx a (Nr _) -> [] where varCheckEx x = varCheck x p
431
varCheck ast p = case ast of (If var t f) -> varCheckEx var ++ varCheckEx t ++ varCheckEx f (Let s a b) -> varCheckEx a ++ varCheck b (s:p) (Var s) -> if s `elem` p then [] else [s] (Sum a b) -> varCheckEx a ++ varCheckEx b (Mul a b) -> varCheckEx a ++ varCheckEx b (Min a) -> varCheckEx a (Nr _) -> [] where varCheckEx x = varCheck x p
391
false
true
0
11
137
225
111
114
null
null
taktoa/TestGL
test-suite/HPC.hs
mit
match :: String -> [Int] match = fmap read . concat . catMaybes . fmap (matchRegex pattern) . lines where pattern = mkRegex "^ *([0-9]*)% "
145
match :: String -> [Int] match = fmap read . concat . catMaybes . fmap (matchRegex pattern) . lines where pattern = mkRegex "^ *([0-9]*)% "
145
match = fmap read . concat . catMaybes . fmap (matchRegex pattern) . lines where pattern = mkRegex "^ *([0-9]*)% "
120
false
true
2
9
31
55
28
27
null
null
drpowell/XMPP
Network/XMPP/Stanzas.hs
bsd-3-clause
-- |Get cdata from xmlelem. cdata :: XMLElem -> Text cdata = maybe "" id . getCdata
83
cdata :: XMLElem -> Text cdata = maybe "" id . getCdata
55
cdata = maybe "" id . getCdata
30
true
true
1
7
16
34
14
20
null
null
oldmanmike/ghc
compiler/main/Packages.hs
bsd-3-clause
-- | Find all the link options in these and the preload packages, -- returning (package hs lib options, extra library options, other flags) getPackageLinkOpts :: DynFlags -> [UnitId] -> IO ([String], [String], [String]) getPackageLinkOpts dflags pkgs = collectLinkOpts dflags `fmap` getPreloadPackagesAnd dflags pkgs
318
getPackageLinkOpts :: DynFlags -> [UnitId] -> IO ([String], [String], [String]) getPackageLinkOpts dflags pkgs = collectLinkOpts dflags `fmap` getPreloadPackagesAnd dflags pkgs
178
getPackageLinkOpts dflags pkgs = collectLinkOpts dflags `fmap` getPreloadPackagesAnd dflags pkgs
98
true
true
0
9
45
64
36
28
null
null
Athas/banko
barc/Barc/CCodeGen.hs
bsd-2-clause
codeBoolExp :: ExpBool -> T.Text codeBoolExp e = T.append (codeBoolExp' e) "\n"
79
codeBoolExp :: ExpBool -> T.Text codeBoolExp e = T.append (codeBoolExp' e) "\n"
79
codeBoolExp e = T.append (codeBoolExp' e) "\n"
46
false
true
0
7
11
33
16
17
null
null
dfoxfranke/llvm-general-util
LLVM/General/Util/Module.hs
mit
pss :: (MonadBaseControl IO m) => PassSetSpec -> L b m LL.PassSetSpec pss spec = do c <- getC let dl = fromBackendMaybe (lDataLayout c) let tli = Just $ lLibraryInfo c let tm = fromBackendMaybe (lTargetMachine c) case spec of (PassSetSpec t) -> return $ LL.PassSetSpec t dl tli tm (CuratedPassSetSpec ol sl uaat slc uiwt) -> return $ LL.CuratedPassSetSpec ol sl uaat slc uiwt tli
433
pss :: (MonadBaseControl IO m) => PassSetSpec -> L b m LL.PassSetSpec pss spec = do c <- getC let dl = fromBackendMaybe (lDataLayout c) let tli = Just $ lLibraryInfo c let tm = fromBackendMaybe (lTargetMachine c) case spec of (PassSetSpec t) -> return $ LL.PassSetSpec t dl tli tm (CuratedPassSetSpec ol sl uaat slc uiwt) -> return $ LL.CuratedPassSetSpec ol sl uaat slc uiwt tli
433
pss spec = do c <- getC let dl = fromBackendMaybe (lDataLayout c) let tli = Just $ lLibraryInfo c let tm = fromBackendMaybe (lTargetMachine c) case spec of (PassSetSpec t) -> return $ LL.PassSetSpec t dl tli tm (CuratedPassSetSpec ol sl uaat slc uiwt) -> return $ LL.CuratedPassSetSpec ol sl uaat slc uiwt tli
363
false
true
0
12
120
170
80
90
null
null
brendanhay/gogol
gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs
mpl-2.0
-- | Additional properties to set if sourceFormat is set to CSV. edcCSVOptions :: Lens' ExternalDataConfiguration (Maybe CSVOptions) edcCSVOptions = lens _edcCSVOptions (\ s a -> s{_edcCSVOptions = a})
209
edcCSVOptions :: Lens' ExternalDataConfiguration (Maybe CSVOptions) edcCSVOptions = lens _edcCSVOptions (\ s a -> s{_edcCSVOptions = a})
144
edcCSVOptions = lens _edcCSVOptions (\ s a -> s{_edcCSVOptions = a})
76
true
true
0
9
36
48
25
23
null
null
yan-ac/bbq.yan.ac
BBQ/Sitemap.hs
mit
--problemIdParams :: Router () (ProblemId :- ()) problemIdParams :: Router r (ProblemId :- r) problemIdParams = xmaph (ProblemId) pidToInt int where pidToInt (ProblemId x) = if and [x >= 1, x <= 9] then Just x else Nothing
290
problemIdParams :: Router r (ProblemId :- r) problemIdParams = xmaph (ProblemId) pidToInt int where pidToInt (ProblemId x) = if and [x >= 1, x <= 9] then Just x else Nothing
241
problemIdParams = xmaph (ProblemId) pidToInt int where pidToInt (ProblemId x) = if and [x >= 1, x <= 9] then Just x else Nothing
196
true
true
0
8
105
78
41
37
null
null
fmthoma/ghc
compiler/types/Type.hs
bsd-3-clause
cmpTypesX _ _ [] = GT
38
cmpTypesX _ _ [] = GT
38
cmpTypesX _ _ [] = GT
38
false
false
0
6
22
15
7
8
null
null
ilyasergey/GHC-XAppFix
compiler/main/DynFlags.hs
bsd-3-clause
setVerboseCore2Core :: DynP () setVerboseCore2Core = do forceRecompile setDynFlag Opt_D_verbose_core2core upd (\dfs -> dfs { shouldDumpSimplPhase = Nothing })
208
setVerboseCore2Core :: DynP () setVerboseCore2Core = do forceRecompile setDynFlag Opt_D_verbose_core2core upd (\dfs -> dfs { shouldDumpSimplPhase = Nothing })
208
setVerboseCore2Core = do forceRecompile setDynFlag Opt_D_verbose_core2core upd (\dfs -> dfs { shouldDumpSimplPhase = Nothing })
177
false
true
1
12
68
51
23
28
null
null
dblia/nosql-ganeti
src/Ganeti/HTools/Backend/Luxi.hs
gpl-2.0
-- | Parse an overall query result and get the [(status, value)] list -- for each element queried. parseQueryResult :: (Monad m) => JSValue -> m [[(JSValue, JSValue)]] parseQueryResult (JSArray arr) = mapM parseQueryRow arr
223
parseQueryResult :: (Monad m) => JSValue -> m [[(JSValue, JSValue)]] parseQueryResult (JSArray arr) = mapM parseQueryRow arr
124
parseQueryResult (JSArray arr) = mapM parseQueryRow arr
55
true
true
0
10
34
55
30
25
null
null
A1kmm/motocse
motocse.hs
agpl-3.0
appendListCrossProduct l (xs:x) y = (appendListCrossProduct (mapAndPrepend ((,)xs) y l) x y)
92
appendListCrossProduct l (xs:x) y = (appendListCrossProduct (mapAndPrepend ((,)xs) y l) x y)
92
appendListCrossProduct l (xs:x) y = (appendListCrossProduct (mapAndPrepend ((,)xs) y l) x y)
92
false
false
0
11
11
49
25
24
null
null
zhiyuanshi/fcore
frontend/SymbolicEvaluator.hs
bsd-2-clause
eval g@(Fix _ _ f _ _) = VFun $ eval . f (eval g)
49
eval g@(Fix _ _ f _ _) = VFun $ eval . f (eval g)
49
eval g@(Fix _ _ f _ _) = VFun $ eval . f (eval g)
49
false
false
1
10
14
48
21
27
null
null
mydaum/cabal
cabal-testsuite/PackageTests/InternalLibraries/cabal.test.hs
bsd-3-clause
main = cabalTest $ do cabal "new-build" ["p"]
49
main = cabalTest $ do cabal "new-build" ["p"]
49
main = cabalTest $ do cabal "new-build" ["p"]
49
false
false
1
10
11
25
10
15
null
null
flyrry/tictactoe
test/Test.hs
mit
testBoard = forAll arbitrary $ \board@(Board _ m) -> forAll arbitrary $ \pos -> if M.member pos m then True else takeBack (move board pos) == board
193
testBoard = forAll arbitrary $ \board@(Board _ m) -> forAll arbitrary $ \pos -> if M.member pos m then True else takeBack (move board pos) == board
193
testBoard = forAll arbitrary $ \board@(Board _ m) -> forAll arbitrary $ \pos -> if M.member pos m then True else takeBack (move board pos) == board
193
false
false
1
13
72
75
36
39
null
null
aquatir/remember_java_api
code-sample-haskell/hello_world/func_magic/dont_turn.hs
mit
turnRight turns | turns + 1 == 4 = Nothing | otherwise = Just $ turns + 1
87
turnRight turns | turns + 1 == 4 = Nothing | otherwise = Just $ turns + 1
87
turnRight turns | turns + 1 == 4 = Nothing | otherwise = Just $ turns + 1
87
false
false
0
9
31
46
20
26
null
null
yang-wei/elm-lang.org
src/backend/Init/Compiler.hs
bsd-3-clause
toElmSource :: [(N.Name, V.Version, [Module.Name])] -> String toElmSource deps = let toImportList (_, _, exposedModules) = concatMap toImport exposedModules toImport name = "import " ++ Module.nameToString name ++ "\n" in concatMap toImportList deps ++ "\nfortyTwo = 40 + 2"
311
toElmSource :: [(N.Name, V.Version, [Module.Name])] -> String toElmSource deps = let toImportList (_, _, exposedModules) = concatMap toImport exposedModules toImport name = "import " ++ Module.nameToString name ++ "\n" in concatMap toImportList deps ++ "\nfortyTwo = 40 + 2"
311
toElmSource deps = let toImportList (_, _, exposedModules) = concatMap toImport exposedModules toImport name = "import " ++ Module.nameToString name ++ "\n" in concatMap toImportList deps ++ "\nfortyTwo = 40 + 2"
249
false
true
0
12
75
104
51
53
null
null
rhennigan/code
haskell/pcdSimplification/src/paperFunctions.hs
gpl-2.0
acc' [] (yh:yt) = acc' [yh] yt
30
acc' [] (yh:yt) = acc' [yh] yt
30
acc' [] (yh:yt) = acc' [yh] yt
30
false
false
0
6
6
31
14
17
null
null
bitemyapp/blacktip
src/Database/Blacktip.hs
apache-2.0
getUnixMillis :: IO Milliseconds getUnixMillis = fmap (round . (*1000)) PSX.getPOSIXTime
88
getUnixMillis :: IO Milliseconds getUnixMillis = fmap (round . (*1000)) PSX.getPOSIXTime
88
getUnixMillis = fmap (round . (*1000)) PSX.getPOSIXTime
55
false
true
0
8
10
32
17
15
null
null
23Skidoo/heist
src/Heist/Internal/Types.hs
bsd-3-clause
scLoadTimeSplices :: Functor f => (Splices (I.Splice IO) -> f (Splices (I.Splice IO))) -> SpliceConfig m -> f (SpliceConfig m) scLoadTimeSplices = lens _scLoadTimeSplices setter where setter sc v = sc { _scLoadTimeSplices = v } ------------------------------------------------------------------------------ -- | Lens for complied splices -- :: Simple Lens (SpliceConfig m) (Splices (C.Splice m))
415
scLoadTimeSplices :: Functor f => (Splices (I.Splice IO) -> f (Splices (I.Splice IO))) -> SpliceConfig m -> f (SpliceConfig m) scLoadTimeSplices = lens _scLoadTimeSplices setter where setter sc v = sc { _scLoadTimeSplices = v } ------------------------------------------------------------------------------ -- | Lens for complied splices -- :: Simple Lens (SpliceConfig m) (Splices (C.Splice m))
415
scLoadTimeSplices = lens _scLoadTimeSplices setter where setter sc v = sc { _scLoadTimeSplices = v } ------------------------------------------------------------------------------ -- | Lens for complied splices -- :: Simple Lens (SpliceConfig m) (Splices (C.Splice m))
276
false
true
0
15
71
109
52
57
null
null
dnvriend/study-category-theory
haskell/learn_a_haskell/ch3/pattern-matching.hs
apache-2.0
addTuples :: (Enum a, Num a) => [(a, a)] -> [a] addTuples xs = [a + b | (a, b) <- xs]
85
addTuples :: (Enum a, Num a) => [(a, a)] -> [a] addTuples xs = [a + b | (a, b) <- xs]
85
addTuples xs = [a + b | (a, b) <- xs]
37
false
true
0
9
21
72
38
34
null
null
alonho/bottle
src/Graphics/UI/Bottle/Widgets/Grid.hs
gpl-3.0
mkNavEventmap :: [[Widget.MEnter f]] -> Cursor -> Widget.EventHandlers f mkNavEventmap mEnterChildren cursor@(Vector2 cursorX cursorY) = mconcat . catMaybes $ [ movement "left" GLFW.KeyLeft fromRight leftOfCursor, movement "right" GLFW.KeyRight fromLeft rightOfCursor, movement "up" GLFW.KeyUp fromBelow aboveCursor, movement "down" GLFW.KeyDown fromAbove belowCursor, movement "top" GLFW.KeyPageup fromAbove topCursor, movement "bottom" GLFW.KeyPagedown fromBelow bottomCursor, movement "leftmost" GLFW.KeyHome fromRight leftMostCursor, movement "rightmost" GLFW.KeyEnd fromLeft rightMostCursor ] where size = length2d mEnterChildren Vector2 cappedX cappedY = capCursor size cursor movement dirName key direction = fmap (EventMap.fromEventType (EventMap.KeyEventType EventMap.noMods key) ("Move " ++ dirName) . ($ Just direction)) . msum leftOfCursor = reverse $ take cursorX curRow aboveCursor = reverse $ take cursorY curColumn rightOfCursor = drop (cursorX+1) curRow belowCursor = drop (cursorY+1) curColumn topCursor = take (min 1 cursorY) curColumn leftMostCursor = take (min 1 cursorX) curRow bottomCursor = take 1 . reverse $ drop (cursorY+1) curColumn rightMostCursor = take 1 . reverse $ drop (cursorX+1) curRow curRow = fromMaybe [] $ index cappedY mEnterChildren curColumn = fromMaybe [] $ index cappedX (transpose mEnterChildren) -- makeHelper :: Bool -> Cursor -> Cursor -> [[Widget k]] -> Widget k -- makeHelper isFocused =
1,685
mkNavEventmap :: [[Widget.MEnter f]] -> Cursor -> Widget.EventHandlers f mkNavEventmap mEnterChildren cursor@(Vector2 cursorX cursorY) = mconcat . catMaybes $ [ movement "left" GLFW.KeyLeft fromRight leftOfCursor, movement "right" GLFW.KeyRight fromLeft rightOfCursor, movement "up" GLFW.KeyUp fromBelow aboveCursor, movement "down" GLFW.KeyDown fromAbove belowCursor, movement "top" GLFW.KeyPageup fromAbove topCursor, movement "bottom" GLFW.KeyPagedown fromBelow bottomCursor, movement "leftmost" GLFW.KeyHome fromRight leftMostCursor, movement "rightmost" GLFW.KeyEnd fromLeft rightMostCursor ] where size = length2d mEnterChildren Vector2 cappedX cappedY = capCursor size cursor movement dirName key direction = fmap (EventMap.fromEventType (EventMap.KeyEventType EventMap.noMods key) ("Move " ++ dirName) . ($ Just direction)) . msum leftOfCursor = reverse $ take cursorX curRow aboveCursor = reverse $ take cursorY curColumn rightOfCursor = drop (cursorX+1) curRow belowCursor = drop (cursorY+1) curColumn topCursor = take (min 1 cursorY) curColumn leftMostCursor = take (min 1 cursorX) curRow bottomCursor = take 1 . reverse $ drop (cursorY+1) curColumn rightMostCursor = take 1 . reverse $ drop (cursorX+1) curRow curRow = fromMaybe [] $ index cappedY mEnterChildren curColumn = fromMaybe [] $ index cappedX (transpose mEnterChildren) -- makeHelper :: Bool -> Cursor -> Cursor -> [[Widget k]] -> Widget k -- makeHelper isFocused =
1,685
mkNavEventmap mEnterChildren cursor@(Vector2 cursorX cursorY) = mconcat . catMaybes $ [ movement "left" GLFW.KeyLeft fromRight leftOfCursor, movement "right" GLFW.KeyRight fromLeft rightOfCursor, movement "up" GLFW.KeyUp fromBelow aboveCursor, movement "down" GLFW.KeyDown fromAbove belowCursor, movement "top" GLFW.KeyPageup fromAbove topCursor, movement "bottom" GLFW.KeyPagedown fromBelow bottomCursor, movement "leftmost" GLFW.KeyHome fromRight leftMostCursor, movement "rightmost" GLFW.KeyEnd fromLeft rightMostCursor ] where size = length2d mEnterChildren Vector2 cappedX cappedY = capCursor size cursor movement dirName key direction = fmap (EventMap.fromEventType (EventMap.KeyEventType EventMap.noMods key) ("Move " ++ dirName) . ($ Just direction)) . msum leftOfCursor = reverse $ take cursorX curRow aboveCursor = reverse $ take cursorY curColumn rightOfCursor = drop (cursorX+1) curRow belowCursor = drop (cursorY+1) curColumn topCursor = take (min 1 cursorY) curColumn leftMostCursor = take (min 1 cursorX) curRow bottomCursor = take 1 . reverse $ drop (cursorY+1) curColumn rightMostCursor = take 1 . reverse $ drop (cursorX+1) curRow curRow = fromMaybe [] $ index cappedY mEnterChildren curColumn = fromMaybe [] $ index cappedX (transpose mEnterChildren) -- makeHelper :: Bool -> Cursor -> Cursor -> [[Widget k]] -> Widget k -- makeHelper isFocused =
1,612
false
true
20
10
432
503
230
273
null
null
sru-systems/protobuf-simple
src/Parser/GeneratorUtils.hs
mit
isEnum :: FileDesc -> FieldDesc -> GenState -> Bool isEnum f fd state = Set.member fqTypeName (enumSet state) where fqTypeName = getNamespace f ++ "." ++ FieldDesc.getTypeName fd
184
isEnum :: FileDesc -> FieldDesc -> GenState -> Bool isEnum f fd state = Set.member fqTypeName (enumSet state) where fqTypeName = getNamespace f ++ "." ++ FieldDesc.getTypeName fd
184
isEnum f fd state = Set.member fqTypeName (enumSet state) where fqTypeName = getNamespace f ++ "." ++ FieldDesc.getTypeName fd
132
false
true
3
9
33
77
33
44
null
null
tolysz/dsp
DSP/Multirate/Polyphase.hs
gpl-2.0
poly_interp :: (Num a, Eq a) => Int -- ^ L -> Array Int a -- ^ h[n] -> [a] -- ^ x[n] -> [a] -- ^ y[n] poly_interp l h x = concat $ transpose y where g = map (fir . mkpoly h l) [0..(l-1)] y = map ($ x) g {- gZipWith :: Eq a => (a -> a -> a) -> [[a]] -> [a] gZipWith f xs | any (== []) xs = [] | otherwise = foldl1 f (map head xs) : gZipWith f (map tail xs) poly_decim :: Num a => Int -> Array Int a -> [a] -> [a] poly_decim l h x = gZipWith (+) g where g = map (fir . mkpoly h l) [0..(l-1)] Test > h :: Array Int Double > h = listArray (0,15) [1..16] > x :: [Double] > x = [ 1, 0, 0, 0 ] -}
667
poly_interp :: (Num a, Eq a) => Int -- ^ L -> Array Int a -- ^ h[n] -> [a] -- ^ x[n] -> [a] poly_interp l h x = concat $ transpose y where g = map (fir . mkpoly h l) [0..(l-1)] y = map ($ x) g {- gZipWith :: Eq a => (a -> a -> a) -> [[a]] -> [a] gZipWith f xs | any (== []) xs = [] | otherwise = foldl1 f (map head xs) : gZipWith f (map tail xs) poly_decim :: Num a => Int -> Array Int a -> [a] -> [a] poly_decim l h x = gZipWith (+) g where g = map (fir . mkpoly h l) [0..(l-1)] Test > h :: Array Int Double > h = listArray (0,15) [1..16] > x :: [Double] > x = [ 1, 0, 0, 0 ] -}
656
poly_interp l h x = concat $ transpose y where g = map (fir . mkpoly h l) [0..(l-1)] y = map ($ x) g {- gZipWith :: Eq a => (a -> a -> a) -> [[a]] -> [a] gZipWith f xs | any (== []) xs = [] | otherwise = foldl1 f (map head xs) : gZipWith f (map tail xs) poly_decim :: Num a => Int -> Array Int a -> [a] -> [a] poly_decim l h x = gZipWith (+) g where g = map (fir . mkpoly h l) [0..(l-1)] Test > h :: Array Int Double > h = listArray (0,15) [1..16] > x :: [Double] > x = [ 1, 0, 0, 0 ] -}
528
true
true
1
9
228
119
64
55
null
null
danstiner/dupes
src/Dupes/Actions.hs
mit
removeMatching'' :: Monad m => forall r. Producer FilePath m r -> Producer DuplicateAction m r removeMatching'' = undefined
123
removeMatching'' :: Monad m => forall r. Producer FilePath m r -> Producer DuplicateAction m r removeMatching'' = undefined
123
removeMatching'' = undefined
28
false
true
0
8
18
41
20
21
null
null
rkoeninger/GameCom
src/lib/Memory.hs
mit
backgroundPatternTableAddr state = if testBit (controlReg state) 4 then 0x1000 else 0x0000 :: Word16
100
backgroundPatternTableAddr state = if testBit (controlReg state) 4 then 0x1000 else 0x0000 :: Word16
100
backgroundPatternTableAddr state = if testBit (controlReg state) 4 then 0x1000 else 0x0000 :: Word16
100
false
false
0
8
13
31
16
15
null
null
jtojnar/haste-compiler
libraries/ghc-7.8/base/GHC/IO/Handle/FD.hs
bsd-3-clause
stdHandleFinalizer :: FilePath -> MVar Handle__ -> IO () stdHandleFinalizer fp m = do h_ <- takeMVar m flushWriteBuffer h_ case haType h_ of ClosedHandle -> return () _other -> closeTextCodecs h_ putMVar m (ioe_finalizedHandle fp) -- We have to put the FDs into binary mode on Windows to avoid the newline -- translation that the CRT IO library does.
378
stdHandleFinalizer :: FilePath -> MVar Handle__ -> IO () stdHandleFinalizer fp m = do h_ <- takeMVar m flushWriteBuffer h_ case haType h_ of ClosedHandle -> return () _other -> closeTextCodecs h_ putMVar m (ioe_finalizedHandle fp) -- We have to put the FDs into binary mode on Windows to avoid the newline -- translation that the CRT IO library does.
378
stdHandleFinalizer fp m = do h_ <- takeMVar m flushWriteBuffer h_ case haType h_ of ClosedHandle -> return () _other -> closeTextCodecs h_ putMVar m (ioe_finalizedHandle fp) -- We have to put the FDs into binary mode on Windows to avoid the newline -- translation that the CRT IO library does.
321
false
true
0
11
87
94
42
52
null
null
ezyang/ghc
compiler/typecheck/TcGenGenerics.hs
bsd-3-clause
mkProd_E :: GenericKind_DC -- Generic or Generic1? -> US -- Base for unique names -> [(RdrName, Type)] -- List of variables matched on the lhs and their types -> LHsExpr GhcPs -- Resulting product expression mkProd_E _ _ [] = mkM1_E (nlHsVar u1DataCon_RDR)
332
mkProd_E :: GenericKind_DC -- Generic or Generic1? -> US -- Base for unique names -> [(RdrName, Type)] -- List of variables matched on the lhs and their types -> LHsExpr GhcPs mkProd_E _ _ [] = mkM1_E (nlHsVar u1DataCon_RDR)
298
mkProd_E _ _ [] = mkM1_E (nlHsVar u1DataCon_RDR)
54
true
true
0
9
118
57
31
26
null
null
tibbe/ghc
compiler/cmm/PprC.hs
bsd-3-clause
pprWordArray :: CLabel -> [CmmStatic] -> SDoc pprWordArray lbl ds = sdocWithDynFlags $ \dflags -> hcat [ pprLocalness lbl, ptext (sLit "StgWord") , space, ppr lbl, ptext (sLit "[] = {") ] $$ nest 8 (commafy (pprStatics dflags ds)) $$ ptext (sLit "};")
274
pprWordArray :: CLabel -> [CmmStatic] -> SDoc pprWordArray lbl ds = sdocWithDynFlags $ \dflags -> hcat [ pprLocalness lbl, ptext (sLit "StgWord") , space, ppr lbl, ptext (sLit "[] = {") ] $$ nest 8 (commafy (pprStatics dflags ds)) $$ ptext (sLit "};")
274
pprWordArray lbl ds = sdocWithDynFlags $ \dflags -> hcat [ pprLocalness lbl, ptext (sLit "StgWord") , space, ppr lbl, ptext (sLit "[] = {") ] $$ nest 8 (commafy (pprStatics dflags ds)) $$ ptext (sLit "};")
228
false
true
4
11
65
116
57
59
null
null
brendanhay/gogol
gogol-tagmanager/gen/Network/Google/Resource/TagManager/Accounts/Containers/Workspaces/Folders/MoveEntitiesToFolder.hs
mpl-2.0
-- | Creates a value of 'AccountsContainersWorkspacesFoldersMoveEntitiesToFolder' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'acwfmetfXgafv' -- -- * 'acwfmetfUploadProtocol' -- -- * 'acwfmetfPath' -- -- * 'acwfmetfTriggerId' -- -- * 'acwfmetfAccessToken' -- -- * 'acwfmetfVariableId' -- -- * 'acwfmetfUploadType' -- -- * 'acwfmetfPayload' -- -- * 'acwfmetfTagId' -- -- * 'acwfmetfCallback' accountsContainersWorkspacesFoldersMoveEntitiesToFolder :: Text -- ^ 'acwfmetfPath' -> Folder -- ^ 'acwfmetfPayload' -> AccountsContainersWorkspacesFoldersMoveEntitiesToFolder accountsContainersWorkspacesFoldersMoveEntitiesToFolder pAcwfmetfPath_ pAcwfmetfPayload_ = AccountsContainersWorkspacesFoldersMoveEntitiesToFolder' { _acwfmetfXgafv = Nothing , _acwfmetfUploadProtocol = Nothing , _acwfmetfPath = pAcwfmetfPath_ , _acwfmetfTriggerId = Nothing , _acwfmetfAccessToken = Nothing , _acwfmetfVariableId = Nothing , _acwfmetfUploadType = Nothing , _acwfmetfPayload = pAcwfmetfPayload_ , _acwfmetfTagId = Nothing , _acwfmetfCallback = Nothing }
1,183
accountsContainersWorkspacesFoldersMoveEntitiesToFolder :: Text -- ^ 'acwfmetfPath' -> Folder -- ^ 'acwfmetfPayload' -> AccountsContainersWorkspacesFoldersMoveEntitiesToFolder accountsContainersWorkspacesFoldersMoveEntitiesToFolder pAcwfmetfPath_ pAcwfmetfPayload_ = AccountsContainersWorkspacesFoldersMoveEntitiesToFolder' { _acwfmetfXgafv = Nothing , _acwfmetfUploadProtocol = Nothing , _acwfmetfPath = pAcwfmetfPath_ , _acwfmetfTriggerId = Nothing , _acwfmetfAccessToken = Nothing , _acwfmetfVariableId = Nothing , _acwfmetfUploadType = Nothing , _acwfmetfPayload = pAcwfmetfPayload_ , _acwfmetfTagId = Nothing , _acwfmetfCallback = Nothing }
703
accountsContainersWorkspacesFoldersMoveEntitiesToFolder pAcwfmetfPath_ pAcwfmetfPayload_ = AccountsContainersWorkspacesFoldersMoveEntitiesToFolder' { _acwfmetfXgafv = Nothing , _acwfmetfUploadProtocol = Nothing , _acwfmetfPath = pAcwfmetfPath_ , _acwfmetfTriggerId = Nothing , _acwfmetfAccessToken = Nothing , _acwfmetfVariableId = Nothing , _acwfmetfUploadType = Nothing , _acwfmetfPayload = pAcwfmetfPayload_ , _acwfmetfTagId = Nothing , _acwfmetfCallback = Nothing }
515
true
true
0
8
186
120
80
40
null
null
input-output-hk/cardano-sl
core/test/Test/Pos/Core/ExampleHelpers.hs
apache-2.0
feedEpochSlots :: (SlotCount -> H.Gen a) -> H.Gen a feedEpochSlots genA = genA =<< pcEpochSlots <$> genProtocolConstants
120
feedEpochSlots :: (SlotCount -> H.Gen a) -> H.Gen a feedEpochSlots genA = genA =<< pcEpochSlots <$> genProtocolConstants
120
feedEpochSlots genA = genA =<< pcEpochSlots <$> genProtocolConstants
68
false
true
0
9
16
43
21
22
null
null
bitemyapp/ganeti
src/Ganeti/Query/Query.hs
bsd-2-clause
getSelectedFields :: FieldMap a b -- ^ Defined fields -> [String] -- ^ Requested fields -> FieldList a b -- ^ Selected fields getSelectedFields defined = map (\name -> fromMaybe (mkUnknownFDef name) $ name `Map.lookup` defined)
271
getSelectedFields :: FieldMap a b -- ^ Defined fields -> [String] -- ^ Requested fields -> FieldList a b getSelectedFields defined = map (\name -> fromMaybe (mkUnknownFDef name) $ name `Map.lookup` defined)
250
getSelectedFields defined = map (\name -> fromMaybe (mkUnknownFDef name) $ name `Map.lookup` defined)
103
true
true
0
12
79
70
37
33
null
null
tpsinnem/Idris-dev
src/Idris/Core/Elaborate.hs
bsd-3-clause
-- Clear the list of variables not to unify, and try to solve them unify_all :: Elab' aux () unify_all = processTactic' UnifyAll
128
unify_all :: Elab' aux () unify_all = processTactic' UnifyAll
61
unify_all = processTactic' UnifyAll
35
true
true
0
7
22
27
12
15
null
null
nau/lasca-compiler
src/lib/Lasca/EmitStatic.hs
bsd-3-clause
getArithOp code tpe = case (code, tpe) of (10, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.Add False False lhs rhs [] (10, TypeFloat) -> Just $ \lhs rhs -> I.FAdd I.noFastMathFlags lhs rhs [] (11, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.Sub False False lhs rhs [] (11, TypeFloat) -> Just $ \lhs rhs -> I.FSub I.noFastMathFlags lhs rhs [] (12, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.Mul False False lhs rhs [] (12, TypeFloat) -> Just $ \lhs rhs -> I.FMul I.noFastMathFlags lhs rhs [] (13, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.SDiv True lhs rhs [] (13, TypeFloat) -> Just $ \lhs rhs -> I.FDiv I.noFastMathFlags lhs rhs [] _ -> Nothing
700
getArithOp code tpe = case (code, tpe) of (10, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.Add False False lhs rhs [] (10, TypeFloat) -> Just $ \lhs rhs -> I.FAdd I.noFastMathFlags lhs rhs [] (11, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.Sub False False lhs rhs [] (11, TypeFloat) -> Just $ \lhs rhs -> I.FSub I.noFastMathFlags lhs rhs [] (12, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.Mul False False lhs rhs [] (12, TypeFloat) -> Just $ \lhs rhs -> I.FMul I.noFastMathFlags lhs rhs [] (13, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.SDiv True lhs rhs [] (13, TypeFloat) -> Just $ \lhs rhs -> I.FDiv I.noFastMathFlags lhs rhs [] _ -> Nothing
700
getArithOp code tpe = case (code, tpe) of (10, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.Add False False lhs rhs [] (10, TypeFloat) -> Just $ \lhs rhs -> I.FAdd I.noFastMathFlags lhs rhs [] (11, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.Sub False False lhs rhs [] (11, TypeFloat) -> Just $ \lhs rhs -> I.FSub I.noFastMathFlags lhs rhs [] (12, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.Mul False False lhs rhs [] (12, TypeFloat) -> Just $ \lhs rhs -> I.FMul I.noFastMathFlags lhs rhs [] (13, _) | isIntegralType tpe -> Just $ \lhs rhs -> I.SDiv True lhs rhs [] (13, TypeFloat) -> Just $ \lhs rhs -> I.FDiv I.noFastMathFlags lhs rhs [] _ -> Nothing
700
false
false
18
8
165
364
185
179
null
null
23Skidoo/heist
src/Heist/Splices/Markdown.hs
bsd-3-clause
readProcessWithExitCode' :: FilePath -- ^ command to run -> [String] -- ^ any arguments -> ByteString -- ^ standard input -> IO (ExitCode,ByteString,ByteString) -- ^ exitcode, stdout, stderr readProcessWithExitCode' cmd args input = do (Just inh, Just outh, Just errh, pid) <- createProcess (proc cmd args){ std_in = CreatePipe, std_out = CreatePipe, std_err = CreatePipe } outMVar <- newEmptyMVar outM <- newEmptyMVar errM <- newEmptyMVar -- fork off a thread to start consuming stdout _ <- forkIO $ do out <- B.hGetContents outh putMVar outM out putMVar outMVar () -- fork off a thread to start consuming stderr _ <- forkIO $ do err <- B.hGetContents errh putMVar errM err putMVar outMVar () -- now write and flush any input when (not (B.null input)) $ do B.hPutStr inh input; hFlush inh hClose inh -- done with stdin -- wait on the output takeMVar outMVar takeMVar outMVar hClose outh -- wait on the process ex <- waitForProcess pid out <- readMVar outM err <- readMVar errM return (ex, out, err)
1,285
readProcessWithExitCode' :: FilePath -- ^ command to run -> [String] -- ^ any arguments -> ByteString -- ^ standard input -> IO (ExitCode,ByteString,ByteString) readProcessWithExitCode' cmd args input = do (Just inh, Just outh, Just errh, pid) <- createProcess (proc cmd args){ std_in = CreatePipe, std_out = CreatePipe, std_err = CreatePipe } outMVar <- newEmptyMVar outM <- newEmptyMVar errM <- newEmptyMVar -- fork off a thread to start consuming stdout _ <- forkIO $ do out <- B.hGetContents outh putMVar outM out putMVar outMVar () -- fork off a thread to start consuming stderr _ <- forkIO $ do err <- B.hGetContents errh putMVar errM err putMVar outMVar () -- now write and flush any input when (not (B.null input)) $ do B.hPutStr inh input; hFlush inh hClose inh -- done with stdin -- wait on the output takeMVar outMVar takeMVar outMVar hClose outh -- wait on the process ex <- waitForProcess pid out <- readMVar outM err <- readMVar errM return (ex, out, err)
1,255
readProcessWithExitCode' cmd args input = do (Just inh, Just outh, Just errh, pid) <- createProcess (proc cmd args){ std_in = CreatePipe, std_out = CreatePipe, std_err = CreatePipe } outMVar <- newEmptyMVar outM <- newEmptyMVar errM <- newEmptyMVar -- fork off a thread to start consuming stdout _ <- forkIO $ do out <- B.hGetContents outh putMVar outM out putMVar outMVar () -- fork off a thread to start consuming stderr _ <- forkIO $ do err <- B.hGetContents errh putMVar errM err putMVar outMVar () -- now write and flush any input when (not (B.null input)) $ do B.hPutStr inh input; hFlush inh hClose inh -- done with stdin -- wait on the output takeMVar outMVar takeMVar outMVar hClose outh -- wait on the process ex <- waitForProcess pid out <- readMVar outM err <- readMVar errM return (ex, out, err)
1,032
true
true
0
14
454
332
156
176
null
null
duncanburke/toliman-core
src/Game/Toliman/Internal/Sodium.hs
mpl-2.0
pushEvent :: Reactive (PushEvent a) pushEvent = do (_naev_event, _naev_push) <- newEvent return PushEvent {..}
114
pushEvent :: Reactive (PushEvent a) pushEvent = do (_naev_event, _naev_push) <- newEvent return PushEvent {..}
114
pushEvent = do (_naev_event, _naev_push) <- newEvent return PushEvent {..}
78
false
true
0
9
18
50
23
27
null
null
fibsifan/pandoc
src/Text/Pandoc/Writers/Haddock.hs
gpl-2.0
inlineToHaddock opts SoftBreak = case writerWrapText opts of WrapAuto -> return space WrapNone -> return space WrapPreserve -> return cr
167
inlineToHaddock opts SoftBreak = case writerWrapText opts of WrapAuto -> return space WrapNone -> return space WrapPreserve -> return cr
167
inlineToHaddock opts SoftBreak = case writerWrapText opts of WrapAuto -> return space WrapNone -> return space WrapPreserve -> return cr
167
false
false
0
8
50
45
20
25
null
null
sdiehl/ghc
compiler/prelude/THNames.hs
bsd-3-clause
listKName = libFun (fsLit "listK") listKIdKey
58
listKName = libFun (fsLit "listK") listKIdKey
58
listKName = libFun (fsLit "listK") listKIdKey
58
false
false
0
7
18
17
8
9
null
null
rueshyna/gogol
gogol-blogger/gen/Network/Google/Blogger/Types/Product.hs
mpl-2.0
-- | The comment creator\'s avatar URL. caiURL :: Lens' CommentAuthorImage (Maybe Text) caiURL = lens _caiURL (\ s a -> s{_caiURL = a})
135
caiURL :: Lens' CommentAuthorImage (Maybe Text) caiURL = lens _caiURL (\ s a -> s{_caiURL = a})
95
caiURL = lens _caiURL (\ s a -> s{_caiURL = a})
47
true
true
1
9
23
52
25
27
null
null
george-steel/maxent-learner
maxent-learner-hw/src/Text/PhonotacticLearner/DFST.hs
gpl-2.0
-- | Get the total expectations over each length of string up to a maximum expsByLengthVec :: (Ix sigma) => ExpVecDFST sigma -> Int -> Array Int (Expectation Vec) expsByLengthVec (ExpVecDFST ns q0 cbound dims tm tpm tvm fpm fvm) maxlen = unsafePerformIO $ do let nc = rangeSize cbound dims' = fromIntegral dims ns' = fromIntegral ns lpm <- SVM.new (ns'*(maxlen+1)) lvm <- SVM.new (dims'*ns'*(maxlen+1)) SV.unsafeWith tm $ \ptm -> SV.unsafeWith tpm $ \ptp -> SV.unsafeWith tvm $ \ptv -> SV.unsafeWith fpm $ \pfp -> SV.unsafeWith fvm $ \pfv -> SVM.unsafeWith lpm $ \plp -> SVM.unsafeWith lvm $ \plv -> c_expsByLengthVec ns (fromIntegral nc) dims q0 (fromIntegral maxlen) ptm ptp ptv pfp pfv plp plv fmap (listArray (0,maxlen)) . forM (range (0,maxlen)) $ \n -> do p <- SVM.read lpm n v <- SV.freeze (SVM.slice (n*dims') dims' lvm) return $ Exp p (Vec (SV.convert v)) -- | Optimized DFST form calculating scalar expectations over the entire probability distribution defined by the DFA.
1,064
expsByLengthVec :: (Ix sigma) => ExpVecDFST sigma -> Int -> Array Int (Expectation Vec) expsByLengthVec (ExpVecDFST ns q0 cbound dims tm tpm tvm fpm fvm) maxlen = unsafePerformIO $ do let nc = rangeSize cbound dims' = fromIntegral dims ns' = fromIntegral ns lpm <- SVM.new (ns'*(maxlen+1)) lvm <- SVM.new (dims'*ns'*(maxlen+1)) SV.unsafeWith tm $ \ptm -> SV.unsafeWith tpm $ \ptp -> SV.unsafeWith tvm $ \ptv -> SV.unsafeWith fpm $ \pfp -> SV.unsafeWith fvm $ \pfv -> SVM.unsafeWith lpm $ \plp -> SVM.unsafeWith lvm $ \plv -> c_expsByLengthVec ns (fromIntegral nc) dims q0 (fromIntegral maxlen) ptm ptp ptv pfp pfv plp plv fmap (listArray (0,maxlen)) . forM (range (0,maxlen)) $ \n -> do p <- SVM.read lpm n v <- SV.freeze (SVM.slice (n*dims') dims' lvm) return $ Exp p (Vec (SV.convert v)) -- | Optimized DFST form calculating scalar expectations over the entire probability distribution defined by the DFA.
989
expsByLengthVec (ExpVecDFST ns q0 cbound dims tm tpm tvm fpm fvm) maxlen = unsafePerformIO $ do let nc = rangeSize cbound dims' = fromIntegral dims ns' = fromIntegral ns lpm <- SVM.new (ns'*(maxlen+1)) lvm <- SVM.new (dims'*ns'*(maxlen+1)) SV.unsafeWith tm $ \ptm -> SV.unsafeWith tpm $ \ptp -> SV.unsafeWith tvm $ \ptv -> SV.unsafeWith fpm $ \pfp -> SV.unsafeWith fvm $ \pfv -> SVM.unsafeWith lpm $ \plp -> SVM.unsafeWith lvm $ \plv -> c_expsByLengthVec ns (fromIntegral nc) dims q0 (fromIntegral maxlen) ptm ptp ptv pfp pfv plp plv fmap (listArray (0,maxlen)) . forM (range (0,maxlen)) $ \n -> do p <- SVM.read lpm n v <- SV.freeze (SVM.slice (n*dims') dims' lvm) return $ Exp p (Vec (SV.convert v)) -- | Optimized DFST form calculating scalar expectations over the entire probability distribution defined by the DFA.
901
true
true
0
24
244
414
204
210
null
null
truls/language-vhdl-quote
src/Language/VHDL/Lexer.hs
mpl-2.0
number, hexNumber :: Parser String number = number' digitChar
61
number, hexNumber :: Parser String number = number' digitChar
61
number = number' digitChar
26
false
true
2
6
8
25
10
15
null
null
phadej/generics-sop
src/Generics/SOP/TH.hs
bsd-3-clause
conInfo (GadtC _ _ _) = fail "GADTs not supported"
53
conInfo (GadtC _ _ _) = fail "GADTs not supported"
53
conInfo (GadtC _ _ _) = fail "GADTs not supported"
53
false
false
0
7
12
22
10
12
null
null
shlevy/ghc
compiler/nativeGen/PIC.hs
bsd-3-clause
-- On AIX we use an indirect local TOC anchored by 'gotLabel'. -- This way we use up only one global TOC entry per compilation-unit -- (this is quite similiar to GCC's @-mminimal-toc@ compilation mode) picRelative _ OSAIX lbl = CmmLabelDiffOff lbl gotLabel 0
266
picRelative _ OSAIX lbl = CmmLabelDiffOff lbl gotLabel 0
64
picRelative _ OSAIX lbl = CmmLabelDiffOff lbl gotLabel 0
64
true
false
0
5
51
23
12
11
null
null
oisdk/trie
Trie.hsproj/Trie.hs
mit
main = do trie <- fromIn () line <- getLine unless (line == "q") $ do forM (subs line trie) putStrLn main
119
main = do trie <- fromIn () line <- getLine unless (line == "q") $ do forM (subs line trie) putStrLn main
119
main = do trie <- fromIn () line <- getLine unless (line == "q") $ do forM (subs line trie) putStrLn main
119
false
false
0
12
35
61
27
34
null
null
rueshyna/gogol
gogol-logging/gen/Network/Google/Resource/Logging/Projects/Sinks/Get.hs
mpl-2.0
-- | Creates a value of 'ProjectsSinksGet' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'psgXgafv' -- -- * 'psgUploadProtocol' -- -- * 'psgPp' -- -- * 'psgAccessToken' -- -- * 'psgUploadType' -- -- * 'psgBearerToken' -- -- * 'psgSinkName' -- -- * 'psgCallback' projectsSinksGet :: Text -- ^ 'psgSinkName' -> ProjectsSinksGet projectsSinksGet pPsgSinkName_ = ProjectsSinksGet' { _psgXgafv = Nothing , _psgUploadProtocol = Nothing , _psgPp = True , _psgAccessToken = Nothing , _psgUploadType = Nothing , _psgBearerToken = Nothing , _psgSinkName = pPsgSinkName_ , _psgCallback = Nothing }
721
projectsSinksGet :: Text -- ^ 'psgSinkName' -> ProjectsSinksGet projectsSinksGet pPsgSinkName_ = ProjectsSinksGet' { _psgXgafv = Nothing , _psgUploadProtocol = Nothing , _psgPp = True , _psgAccessToken = Nothing , _psgUploadType = Nothing , _psgBearerToken = Nothing , _psgSinkName = pPsgSinkName_ , _psgCallback = Nothing }
372
projectsSinksGet pPsgSinkName_ = ProjectsSinksGet' { _psgXgafv = Nothing , _psgUploadProtocol = Nothing , _psgPp = True , _psgAccessToken = Nothing , _psgUploadType = Nothing , _psgBearerToken = Nothing , _psgSinkName = pPsgSinkName_ , _psgCallback = Nothing }
300
true
true
0
7
154
97
64
33
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F14.hs
bsd-3-clause
-- glInvalidateNamedFramebufferSubData ----------------------------------------- -- | Manual page for <https://www.opengl.org/sdk/docs/man4/html/glInvalidateSubFramebuffer.xhtml OpenGL 4.x>. glInvalidateNamedFramebufferSubData :: MonadIO m => GLuint -- ^ @framebuffer@. -> GLsizei -- ^ @numAttachments@. -> Ptr GLenum -- ^ @attachments@ pointing to elements of type [FramebufferAttachment](Graphics-GL-Groups.html#FramebufferAttachment). -> GLint -- ^ @x@. -> GLint -- ^ @y@. -> GLsizei -- ^ @width@. -> GLsizei -- ^ @height@. -> m () glInvalidateNamedFramebufferSubData v1 v2 v3 v4 v5 v6 v7 = liftIO $ dyn497 ptr_glInvalidateNamedFramebufferSubData v1 v2 v3 v4 v5 v6 v7
689
glInvalidateNamedFramebufferSubData :: MonadIO m => GLuint -- ^ @framebuffer@. -> GLsizei -- ^ @numAttachments@. -> Ptr GLenum -- ^ @attachments@ pointing to elements of type [FramebufferAttachment](Graphics-GL-Groups.html#FramebufferAttachment). -> GLint -- ^ @x@. -> GLint -- ^ @y@. -> GLsizei -- ^ @width@. -> GLsizei -- ^ @height@. -> m () glInvalidateNamedFramebufferSubData v1 v2 v3 v4 v5 v6 v7 = liftIO $ dyn497 ptr_glInvalidateNamedFramebufferSubData v1 v2 v3 v4 v5 v6 v7
497
glInvalidateNamedFramebufferSubData v1 v2 v3 v4 v5 v6 v7 = liftIO $ dyn497 ptr_glInvalidateNamedFramebufferSubData v1 v2 v3 v4 v5 v6 v7
135
true
true
0
15
98
103
53
50
null
null
AlexeyRaga/eta
compiler/ETA/StgSyn/StgSyn.hs
bsd-3-clause
-- | Strip ticks of a given type from an STG expression stripStgTicksTop :: (Tickish Id -> Bool) -> StgExpr -> ([Tickish Id], StgExpr) stripStgTicksTop p = go [] where go ts (StgTick t e) | p t = go (t:ts) e go ts other = (reverse ts, other) {- ************************************************************************ * * \subsection{STG expressions} * * ************************************************************************ The @GenStgExpr@ data type is parameterised on binder and occurrence info, as before. ************************************************************************ * * \subsubsection{@GenStgExpr@ application} * * ************************************************************************ An application is of a function to a list of atoms [not expressions]. Operationally, we want to push the arguments on the stack and call the function. (If the arguments were expressions, we would have to build their closures first.) There is no constructor for a lone variable; it would appear as @StgApp var [] _@. -}
1,335
stripStgTicksTop :: (Tickish Id -> Bool) -> StgExpr -> ([Tickish Id], StgExpr) stripStgTicksTop p = go [] where go ts (StgTick t e) | p t = go (t:ts) e go ts other = (reverse ts, other) {- ************************************************************************ * * \subsection{STG expressions} * * ************************************************************************ The @GenStgExpr@ data type is parameterised on binder and occurrence info, as before. ************************************************************************ * * \subsubsection{@GenStgExpr@ application} * * ************************************************************************ An application is of a function to a list of atoms [not expressions]. Operationally, we want to push the arguments on the stack and call the function. (If the arguments were expressions, we would have to build their closures first.) There is no constructor for a lone variable; it would appear as @StgApp var [] _@. -}
1,279
stripStgTicksTop p = go [] where go ts (StgTick t e) | p t = go (t:ts) e go ts other = (reverse ts, other) {- ************************************************************************ * * \subsection{STG expressions} * * ************************************************************************ The @GenStgExpr@ data type is parameterised on binder and occurrence info, as before. ************************************************************************ * * \subsubsection{@GenStgExpr@ application} * * ************************************************************************ An application is of a function to a list of atoms [not expressions]. Operationally, we want to push the arguments on the stack and call the function. (If the arguments were expressions, we would have to build their closures first.) There is no constructor for a lone variable; it would appear as @StgApp var [] _@. -}
1,200
true
true
0
10
443
111
56
55
null
null
diagrams/diagrams-contrib
src/Diagrams/Color/XKCD.hs
bsd-3-clause
mahogany = fromJust $ readHexColor "#4a0100"
57
mahogany = fromJust $ readHexColor "#4a0100"
57
mahogany = fromJust $ readHexColor "#4a0100"
57
false
false
0
6
18
13
6
7
null
null
ssaavedra/liquidhaskell
src/Language/Haskell/Liquid/Constraint/Split.hs
bsd-3-clause
splitfWithVariance f t1 t2 Contravariant = f t2 t1
50
splitfWithVariance f t1 t2 Contravariant = f t2 t1
50
splitfWithVariance f t1 t2 Contravariant = f t2 t1
50
false
false
0
5
8
20
9
11
null
null
codeq/pyhint
src/PyHint/Scanner.hs
bsd-3-clause
scanFromImport :: C.Context -> FromItemsSpan -> MessageWriter scanFromImport ctx items = case items of ImportEverything span -> do tell [Message "W001" "Wildcard import used; unable to detect undefined names" span] return $ C.dirty ctx FromItems items _ -> foldM scanFromItem ctx items
297
scanFromImport :: C.Context -> FromItemsSpan -> MessageWriter scanFromImport ctx items = case items of ImportEverything span -> do tell [Message "W001" "Wildcard import used; unable to detect undefined names" span] return $ C.dirty ctx FromItems items _ -> foldM scanFromItem ctx items
297
scanFromImport ctx items = case items of ImportEverything span -> do tell [Message "W001" "Wildcard import used; unable to detect undefined names" span] return $ C.dirty ctx FromItems items _ -> foldM scanFromItem ctx items
235
false
true
0
12
53
85
39
46
null
null
danmane/abalone
unsupported/hs/src/abalone.hs
mit
colinear :: Direction -> Direction -> Bool colinear d1 d2 = d1 == d2 || d1 == opposite d2
89
colinear :: Direction -> Direction -> Bool colinear d1 d2 = d1 == d2 || d1 == opposite d2
89
colinear d1 d2 = d1 == d2 || d1 == opposite d2
46
false
true
0
7
18
39
19
20
null
null
Fuuzetsu/aeson-schema
src/Data/Aeson/Schema/Validator.hs
mit
-- | Validates a JSON value against a schema. validate :: Ord ref => Graph Schema ref -- ^ referenced schemas -> Schema ref -> Value -> [ValidationError] validate graph schema val = case schemaDRef schema of Just ref -> case M.lookup ref graph of Nothing -> validationError "referenced schema is not in map" Just referencedSchema -> validate graph referencedSchema val Nothing -> L.concat [ case schemaType schema of [t] -> validateType t ts -> if L.any L.null (map validateType ts) then [] else validationError "no type matched" , maybeCheck checkEnum $ schemaEnum schema , concatMap validateTypeDisallowed (schemaDisallow schema) , concatMap (flip (validate graph) val) (schemaExtends schema) ] where validateType (Choice1of2 t) = case (t, val) of (StringType, String str) -> validateString schema str (NumberType, Number num) -> validateNumber schema num (IntegerType, Number num) -> validateInteger schema num (BooleanType, Bool _) -> valid (ObjectType, Object obj) -> validateObject graph schema obj (ArrayType, Array arr) -> validateArray graph schema arr (NullType, Null) -> valid (AnyType, _) -> case val of String str -> validateString schema str Number num -> validateNumber schema num Object obj -> validateObject graph schema obj Array arr -> validateArray graph schema arr _ -> valid (typ, _) -> validationError $ "type mismatch: expected " ++ show typ ++ " but got " ++ getType val validateType (Choice2of2 s) = validate graph s val getType :: A.Value -> String getType (String _) = "string" getType (Number _) = "number" getType (Bool _) = "boolean" getType (Object _) = "object" getType (Array _) = "array" getType Null = "null" checkEnum e = assert (val `elem` e) "value has to be one of the values in enum" isType :: Value -> SchemaType -> Bool isType (String _) StringType = True isType (Number num) IntegerType = isInteger num isType (Number _) NumberType = True isType (Bool _) BooleanType = True isType (Object _) ObjectType = True isType (Array _) ArrayType = True isType _ AnyType = True isType _ _ = False validateTypeDisallowed (Choice1of2 t) = if isType val t then validationError $ "values of type " ++ show t ++ " are not allowed here" else valid validateTypeDisallowed (Choice2of2 s) = assert (not . L.null $ validate graph s val) "value disallowed"
2,574
validate :: Ord ref => Graph Schema ref -- ^ referenced schemas -> Schema ref -> Value -> [ValidationError] validate graph schema val = case schemaDRef schema of Just ref -> case M.lookup ref graph of Nothing -> validationError "referenced schema is not in map" Just referencedSchema -> validate graph referencedSchema val Nothing -> L.concat [ case schemaType schema of [t] -> validateType t ts -> if L.any L.null (map validateType ts) then [] else validationError "no type matched" , maybeCheck checkEnum $ schemaEnum schema , concatMap validateTypeDisallowed (schemaDisallow schema) , concatMap (flip (validate graph) val) (schemaExtends schema) ] where validateType (Choice1of2 t) = case (t, val) of (StringType, String str) -> validateString schema str (NumberType, Number num) -> validateNumber schema num (IntegerType, Number num) -> validateInteger schema num (BooleanType, Bool _) -> valid (ObjectType, Object obj) -> validateObject graph schema obj (ArrayType, Array arr) -> validateArray graph schema arr (NullType, Null) -> valid (AnyType, _) -> case val of String str -> validateString schema str Number num -> validateNumber schema num Object obj -> validateObject graph schema obj Array arr -> validateArray graph schema arr _ -> valid (typ, _) -> validationError $ "type mismatch: expected " ++ show typ ++ " but got " ++ getType val validateType (Choice2of2 s) = validate graph s val getType :: A.Value -> String getType (String _) = "string" getType (Number _) = "number" getType (Bool _) = "boolean" getType (Object _) = "object" getType (Array _) = "array" getType Null = "null" checkEnum e = assert (val `elem` e) "value has to be one of the values in enum" isType :: Value -> SchemaType -> Bool isType (String _) StringType = True isType (Number num) IntegerType = isInteger num isType (Number _) NumberType = True isType (Bool _) BooleanType = True isType (Object _) ObjectType = True isType (Array _) ArrayType = True isType _ AnyType = True isType _ _ = False validateTypeDisallowed (Choice1of2 t) = if isType val t then validationError $ "values of type " ++ show t ++ " are not allowed here" else valid validateTypeDisallowed (Choice2of2 s) = assert (not . L.null $ validate graph s val) "value disallowed"
2,528
validate graph schema val = case schemaDRef schema of Just ref -> case M.lookup ref graph of Nothing -> validationError "referenced schema is not in map" Just referencedSchema -> validate graph referencedSchema val Nothing -> L.concat [ case schemaType schema of [t] -> validateType t ts -> if L.any L.null (map validateType ts) then [] else validationError "no type matched" , maybeCheck checkEnum $ schemaEnum schema , concatMap validateTypeDisallowed (schemaDisallow schema) , concatMap (flip (validate graph) val) (schemaExtends schema) ] where validateType (Choice1of2 t) = case (t, val) of (StringType, String str) -> validateString schema str (NumberType, Number num) -> validateNumber schema num (IntegerType, Number num) -> validateInteger schema num (BooleanType, Bool _) -> valid (ObjectType, Object obj) -> validateObject graph schema obj (ArrayType, Array arr) -> validateArray graph schema arr (NullType, Null) -> valid (AnyType, _) -> case val of String str -> validateString schema str Number num -> validateNumber schema num Object obj -> validateObject graph schema obj Array arr -> validateArray graph schema arr _ -> valid (typ, _) -> validationError $ "type mismatch: expected " ++ show typ ++ " but got " ++ getType val validateType (Choice2of2 s) = validate graph s val getType :: A.Value -> String getType (String _) = "string" getType (Number _) = "number" getType (Bool _) = "boolean" getType (Object _) = "object" getType (Array _) = "array" getType Null = "null" checkEnum e = assert (val `elem` e) "value has to be one of the values in enum" isType :: Value -> SchemaType -> Bool isType (String _) StringType = True isType (Number num) IntegerType = isInteger num isType (Number _) NumberType = True isType (Bool _) BooleanType = True isType (Object _) ObjectType = True isType (Array _) ArrayType = True isType _ AnyType = True isType _ _ = False validateTypeDisallowed (Choice1of2 t) = if isType val t then validationError $ "values of type " ++ show t ++ " are not allowed here" else valid validateTypeDisallowed (Choice2of2 s) = assert (not . L.null $ validate graph s val) "value disallowed"
2,384
true
true
32
13
666
840
417
423
null
null
tomberek/RETE
src/RETE/Lib1.hs
bsd-3-clause
rewrite' --[ :: ( VAR :<: f , LAM :<: f , VAR :<: PF (LHS' f) , LAM :<: PF (LHS' f) , VAR :<: PF (RHS f) , LAM :<: PF (RHS f) , Traversable f, EqF f,OrdF f , g ~ (f :&: Set.Set Name) ) => (Term g -> Term g -> Term g) -- ^ Application operator -> Rule (LHS' f) (RHS f) -> Term g -> Maybe (Term g) rewrite' app (Rule lhs rhs) t = do subst <- match' lhs t substitute app subst rhs --]
466
rewrite' --[ :: ( VAR :<: f , LAM :<: f , VAR :<: PF (LHS' f) , LAM :<: PF (LHS' f) , VAR :<: PF (RHS f) , LAM :<: PF (RHS f) , Traversable f, EqF f,OrdF f , g ~ (f :&: Set.Set Name) ) => (Term g -> Term g -> Term g) -- ^ Application operator -> Rule (LHS' f) (RHS f) -> Term g -> Maybe (Term g) rewrite' app (Rule lhs rhs) t = do subst <- match' lhs t substitute app subst rhs --]
466
rewrite' app (Rule lhs rhs) t = do subst <- match' lhs t substitute app subst rhs --]
93
false
true
0
11
177
237
114
123
null
null
amccausl/Swish
Swish/HaskellRDF/RDFGraphTest.hs
lgpl-2.1
g2f3 = setFormulae fm3 g2f1
27
g2f3 = setFormulae fm3 g2f1
27
g2f3 = setFormulae fm3 g2f1
27
false
false
1
5
4
14
5
9
null
null
pparkkin/Hagl
Hagl/Strategy.hs
bsd-3-clause
-- -- * Selectors -- -- ** ByPlayer selection -- -- | Select the element corresponding to the current player. my :: GameM m g => m (ByPlayer a) -> m a my = liftM2 forPlayer myPlayerID
185
my :: GameM m g => m (ByPlayer a) -> m a my = liftM2 forPlayer myPlayerID
73
my = liftM2 forPlayer myPlayerID
32
true
true
0
10
38
53
26
27
null
null
jfischoff/symbolic-combinatorics
src/Combinatorics/Symbolic/AllowableConstructions.hs
bsd-3-clause
toGenFunc (Sequence x) = one `divide` (one `sub` (toGenFunc x))
66
toGenFunc (Sequence x) = one `divide` (one `sub` (toGenFunc x))
66
toGenFunc (Sequence x) = one `divide` (one `sub` (toGenFunc x))
66
false
false
0
9
12
36
20
16
null
null
stefaneng/scheme48
src/Language/Scheme/Parser.hs
mit
octDigits :: Parser String octDigits = many1 octDigit
53
octDigits :: Parser String octDigits = many1 octDigit
53
octDigits = many1 octDigit
26
false
true
0
5
7
17
8
9
null
null
iand675/GitMega
Command/Update.hs
bsd-3-clause
getBranchTip = git "symbolic-ref" ["HEAD", "--short"] $ \p -> do b <- exitOK p if b then out p >>= (return . Just . asSingleLine) else return Nothing
153
getBranchTip = git "symbolic-ref" ["HEAD", "--short"] $ \p -> do b <- exitOK p if b then out p >>= (return . Just . asSingleLine) else return Nothing
153
getBranchTip = git "symbolic-ref" ["HEAD", "--short"] $ \p -> do b <- exitOK p if b then out p >>= (return . Just . asSingleLine) else return Nothing
153
false
false
0
13
31
68
34
34
null
null
opentower/carnap
Carnap/src/Carnap/Calculi/NaturalDeduction/Syntax.hs
gpl-3.0
range i j sp@(SubProof (n,m) ls) = if n == i && j == m then Just sp else locale i sp >>= range i j
153
range i j sp@(SubProof (n,m) ls) = if n == i && j == m then Just sp else locale i sp >>= range i j
153
range i j sp@(SubProof (n,m) ls) = if n == i && j == m then Just sp else locale i sp >>= range i j
153
false
false
1
8
80
74
34
40
null
null
mscoutermarsh/exercism_coveralls
assignments/haskell/grains/grains_test.hs
agpl-3.0
grainsTests :: [Test] grainsTests = [ testCase "square 1" $ 1 @=? square 1 , testCase "square 2" $ 2 @=? square 2 , testCase "square 3" $ 4 @=? square 3 , testCase "square 4" $ 8 @=? square 4 , testCase "square 16" $ 32768 @=? square 16 , testCase "square 32" $ 2147483648 @=? square 32 , testCase "square 64" $ 9223372036854775808 @=? square 64 , testCase "total grains" $ 18446744073709551615 @=? total ]
456
grainsTests :: [Test] grainsTests = [ testCase "square 1" $ 1 @=? square 1 , testCase "square 2" $ 2 @=? square 2 , testCase "square 3" $ 4 @=? square 3 , testCase "square 4" $ 8 @=? square 4 , testCase "square 16" $ 32768 @=? square 16 , testCase "square 32" $ 2147483648 @=? square 32 , testCase "square 64" $ 9223372036854775808 @=? square 64 , testCase "total grains" $ 18446744073709551615 @=? total ]
456
grainsTests = [ testCase "square 1" $ 1 @=? square 1 , testCase "square 2" $ 2 @=? square 2 , testCase "square 3" $ 4 @=? square 3 , testCase "square 4" $ 8 @=? square 4 , testCase "square 16" $ 32768 @=? square 16 , testCase "square 32" $ 2147483648 @=? square 32 , testCase "square 64" $ 9223372036854775808 @=? square 64 , testCase "total grains" $ 18446744073709551615 @=? total ]
434
false
true
0
8
126
147
71
76
null
null
GintMist/double-pendulum
test/Spec.hs
bsd-3-clause
mechEnergy :: DoublePendulumSystem -> Float mechEnergy (DPS (Pendulum m1 l1 t1 o1 _ _) (Pendulum m2 l2 t2 o2 _ _) g _) = - (m1 + m2) * g * l1 * cos t1 - m2 * g * l2 * cos t2 + (1/2) * m1 * l1 * l1 * o1 * o1 + (1/2) * m2 * (l1 * l1 * o1 * o1 + l2 * l2 * o2 * o2 + 2 * l1 * l2 * o1 * o2 * cos(t1 - t2))
438
mechEnergy :: DoublePendulumSystem -> Float mechEnergy (DPS (Pendulum m1 l1 t1 o1 _ _) (Pendulum m2 l2 t2 o2 _ _) g _) = - (m1 + m2) * g * l1 * cos t1 - m2 * g * l2 * cos t2 + (1/2) * m1 * l1 * l1 * o1 * o1 + (1/2) * m2 * (l1 * l1 * o1 * o1 + l2 * l2 * o2 * o2 + 2 * l1 * l2 * o1 * o2 * cos(t1 - t2))
438
mechEnergy (DPS (Pendulum m1 l1 t1 o1 _ _) (Pendulum m2 l2 t2 o2 _ _) g _) = - (m1 + m2) * g * l1 * cos t1 - m2 * g * l2 * cos t2 + (1/2) * m1 * l1 * l1 * o1 * o1 + (1/2) * m2 * (l1 * l1 * o1 * o1 + l2 * l2 * o2 * o2 + 2 * l1 * l2 * o1 * o2 * cos(t1 - t2))
394
false
true
0
23
227
220
111
109
null
null
JacquesCarette/literate-scientific-software
code/drasil-data/Data/Drasil/Concepts/Physics.hs
bsd-2-clause
yVel = dccWDS "yVel" (nounPhraseSent $ phrase yComp `sOf` phrase velocity) (S "The" +:+ phrase yComp `sOf` phrase velocity)
123
yVel = dccWDS "yVel" (nounPhraseSent $ phrase yComp `sOf` phrase velocity) (S "The" +:+ phrase yComp `sOf` phrase velocity)
123
yVel = dccWDS "yVel" (nounPhraseSent $ phrase yComp `sOf` phrase velocity) (S "The" +:+ phrase yComp `sOf` phrase velocity)
123
false
false
1
9
18
59
27
32
null
null
TOSPIO/yi
src/library/Yi/Buffer/Misc.hs
gpl-2.0
-- | Read the character at the current point readB :: BufferM Char readB = pointB >>= readAtB
93
readB :: BufferM Char readB = pointB >>= readAtB
48
readB = pointB >>= readAtB
26
true
true
0
5
17
19
10
9
null
null
amccausl/Swish
Swish/HaskellRDF/N3FormatterTest.hs
lgpl-2.1
x1 = NSGraph { namespaces = nslist , formulae = emptyFormulaMap , statements = [tx101,tx102, tx111,tx112,tx113,tx114, tx121,tx122,tx123,tx124, tx125,tx126,tx127,tx128] }
282
x1 = NSGraph { namespaces = nslist , formulae = emptyFormulaMap , statements = [tx101,tx102, tx111,tx112,tx113,tx114, tx121,tx122,tx123,tx124, tx125,tx126,tx127,tx128] }
282
x1 = NSGraph { namespaces = nslist , formulae = emptyFormulaMap , statements = [tx101,tx102, tx111,tx112,tx113,tx114, tx121,tx122,tx123,tx124, tx125,tx126,tx127,tx128] }
282
false
false
1
7
131
71
44
27
null
null
rscprof/kalium
src/Kalium/Nucleus/Vector/Match.hs
bsd-3-clause
doubleOp2 :: NameSpecial -> Maybe (Rational -> Rational -> Rational) doubleOp2 = \case OpAdd -> return (+) OpSubtract -> return (-) OpMultiply -> return (*) OpDivide -> return (/) _ -> Nothing
212
doubleOp2 :: NameSpecial -> Maybe (Rational -> Rational -> Rational) doubleOp2 = \case OpAdd -> return (+) OpSubtract -> return (-) OpMultiply -> return (*) OpDivide -> return (/) _ -> Nothing
212
doubleOp2 = \case OpAdd -> return (+) OpSubtract -> return (-) OpMultiply -> return (*) OpDivide -> return (/) _ -> Nothing
143
false
true
6
9
51
84
43
41
null
null
shepheb/hork
Hork/Objects.hs
bsd-3-clause
objPropAddrData :: Word16 -> Word16 -> Hork RA objPropAddrData num prop = do a <- objPropAddr num prop -- address of the size byte case a of 0 -> return 0 _ -> do (_, _, sizelen) <- propInfo a return $ a + fromIntegral sizelen -- Given a property's (first) size byte's address, returns the address, number, length and sizelength of the next property. -- Returns (0, 0, undefined, undefined) if the object has no more properties.
453
objPropAddrData :: Word16 -> Word16 -> Hork RA objPropAddrData num prop = do a <- objPropAddr num prop -- address of the size byte case a of 0 -> return 0 _ -> do (_, _, sizelen) <- propInfo a return $ a + fromIntegral sizelen -- Given a property's (first) size byte's address, returns the address, number, length and sizelength of the next property. -- Returns (0, 0, undefined, undefined) if the object has no more properties.
453
objPropAddrData num prop = do a <- objPropAddr num prop -- address of the size byte case a of 0 -> return 0 _ -> do (_, _, sizelen) <- propInfo a return $ a + fromIntegral sizelen -- Given a property's (first) size byte's address, returns the address, number, length and sizelength of the next property. -- Returns (0, 0, undefined, undefined) if the object has no more properties.
406
false
true
0
13
102
97
47
50
null
null
luzhuomi/xhaskell
Language/XHaskell/Subtype.hs
bsd-3-clause
-- todo: fixme, this is a hack to get GHC.Types.Bool translated to "Bool", otherwise we can't handle GHC.Types.Bool <= Bool toRE (TH.TupleT 0) = Eps
148
toRE (TH.TupleT 0) = Eps
24
toRE (TH.TupleT 0) = Eps
24
true
false
0
8
24
18
9
9
null
null
xenog/haskoin
src/Network/Haskoin/Block/Merkle.hs
unlicense
encodeMerkleFlags :: [Bool] -> [Word8] encodeMerkleFlags bs = map boolsToWord8 $ splitIn 8 bs
93
encodeMerkleFlags :: [Bool] -> [Word8] encodeMerkleFlags bs = map boolsToWord8 $ splitIn 8 bs
93
encodeMerkleFlags bs = map boolsToWord8 $ splitIn 8 bs
54
false
true
0
6
13
36
18
18
null
null
donomii/srt-collector
srt2json.hs
gpl-3.0
cr :: Parser () cr = do char '\r' return ()
59
cr :: Parser () cr = do char '\r' return ()
59
cr = do char '\r' return ()
43
false
true
0
9
26
36
14
22
null
null
bredelings/BAli-Phy
haskell/Probability/Distribution/Multinomial.hs
gpl-2.0
-- Not sure this is the same as conditioning on not having any zeros. random_composition sum n_groups | sum < n_groups = error "random_composition: sum < n_groups!" | otherwise = map (1+) <$> random_composition' (sum-n_groups) n_groups
272
random_composition sum n_groups | sum < n_groups = error "random_composition: sum < n_groups!" | otherwise = map (1+) <$> random_composition' (sum-n_groups) n_groups
202
random_composition sum n_groups | sum < n_groups = error "random_composition: sum < n_groups!" | otherwise = map (1+) <$> random_composition' (sum-n_groups) n_groups
202
true
false
0
9
72
57
27
30
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/enumFromThen_2.hs
mit
primPlusInt :: MyInt -> MyInt -> MyInt; primPlusInt (Pos x) (Neg y) = primMinusNat x y
90
primPlusInt :: MyInt -> MyInt -> MyInt primPlusInt (Pos x) (Neg y) = primMinusNat x y
89
primPlusInt (Pos x) (Neg y) = primMinusNat x y
46
false
true
0
7
19
42
21
21
null
null
arekfu/funpart
test/Physics/FunPart/StatTest.hs
bsd-3-clause
prop_rmsCorrect :: [Double] -> Property prop_rmsCorrect l = counterexample (show (rms sVar) ++ "; " ++ show naiveRMS ++ "\n" ++ show sVar ++ "\n" ++ show residues) $ if length l > 1 then fromJust (rms sVar) ~== naiveRMS else isNothing $ rms sVar where sVar = foldl' tally empty l xbar = naiveMean l residues = map (\x -> (x-xbar)^(2::Int)) l len = fromIntegral (length l) naiveRMS = sqrt $ naiveMean residues / (len - 1)
480
prop_rmsCorrect :: [Double] -> Property prop_rmsCorrect l = counterexample (show (rms sVar) ++ "; " ++ show naiveRMS ++ "\n" ++ show sVar ++ "\n" ++ show residues) $ if length l > 1 then fromJust (rms sVar) ~== naiveRMS else isNothing $ rms sVar where sVar = foldl' tally empty l xbar = naiveMean l residues = map (\x -> (x-xbar)^(2::Int)) l len = fromIntegral (length l) naiveRMS = sqrt $ naiveMean residues / (len - 1)
480
prop_rmsCorrect l = counterexample (show (rms sVar) ++ "; " ++ show naiveRMS ++ "\n" ++ show sVar ++ "\n" ++ show residues) $ if length l > 1 then fromJust (rms sVar) ~== naiveRMS else isNothing $ rms sVar where sVar = foldl' tally empty l xbar = naiveMean l residues = map (\x -> (x-xbar)^(2::Int)) l len = fromIntegral (length l) naiveRMS = sqrt $ naiveMean residues / (len - 1)
440
false
true
0
16
137
202
102
100
null
null
sethfowler/pygmalion
indexers/Pygmalion/Index/Source.hs
bsd-3-clause
toSourceKind C.Cursor_FloatingLiteral = FloatingLiteral
74
toSourceKind C.Cursor_FloatingLiteral = FloatingLiteral
74
toSourceKind C.Cursor_FloatingLiteral = FloatingLiteral
74
false
false
0
6
22
11
5
6
null
null
ben-schulz/Idris-dev
src/Idris/Primitives.hs
bsd-3-clause
intArith :: IntTy -> [Prim] intArith ity = [ iBinOp ity "add" (bitBin ity (+)) (LPlus . ATInt) total , iBinOp ity "sub" (bitBin ity (-)) (LMinus . ATInt) total , iBinOp ity "mul" (bitBin ity (*)) (LTimes . ATInt) total , iBinOp ity "udiv" (bitBin ity div) LUDiv partial , iBinOp ity "sdiv" (bsdiv ity) (LSDiv . ATInt) partial , iBinOp ity "urem" (bitBin ity rem) LURem partial , iBinOp ity "srem" (bsrem ity) (LSRem . ATInt) partial , iBinOp ity "shl" (bitBin ity (\x y -> shiftL x (fromIntegral y))) LSHL total , iBinOp ity "lshr" (bitBin ity (\x y -> shiftR x (fromIntegral y))) LLSHR total , iBinOp ity "ashr" (bashr ity) LASHR total , iBinOp ity "and" (bitBin ity (.&.)) LAnd total , iBinOp ity "or" (bitBin ity (.|.)) LOr total , iBinOp ity "xor" (bitBin ity (xor)) LXOr total , iUnOp ity "compl" (bUn ity complement) LCompl total ]
897
intArith :: IntTy -> [Prim] intArith ity = [ iBinOp ity "add" (bitBin ity (+)) (LPlus . ATInt) total , iBinOp ity "sub" (bitBin ity (-)) (LMinus . ATInt) total , iBinOp ity "mul" (bitBin ity (*)) (LTimes . ATInt) total , iBinOp ity "udiv" (bitBin ity div) LUDiv partial , iBinOp ity "sdiv" (bsdiv ity) (LSDiv . ATInt) partial , iBinOp ity "urem" (bitBin ity rem) LURem partial , iBinOp ity "srem" (bsrem ity) (LSRem . ATInt) partial , iBinOp ity "shl" (bitBin ity (\x y -> shiftL x (fromIntegral y))) LSHL total , iBinOp ity "lshr" (bitBin ity (\x y -> shiftR x (fromIntegral y))) LLSHR total , iBinOp ity "ashr" (bashr ity) LASHR total , iBinOp ity "and" (bitBin ity (.&.)) LAnd total , iBinOp ity "or" (bitBin ity (.|.)) LOr total , iBinOp ity "xor" (bitBin ity (xor)) LXOr total , iUnOp ity "compl" (bUn ity complement) LCompl total ]
897
intArith ity = [ iBinOp ity "add" (bitBin ity (+)) (LPlus . ATInt) total , iBinOp ity "sub" (bitBin ity (-)) (LMinus . ATInt) total , iBinOp ity "mul" (bitBin ity (*)) (LTimes . ATInt) total , iBinOp ity "udiv" (bitBin ity div) LUDiv partial , iBinOp ity "sdiv" (bsdiv ity) (LSDiv . ATInt) partial , iBinOp ity "urem" (bitBin ity rem) LURem partial , iBinOp ity "srem" (bsrem ity) (LSRem . ATInt) partial , iBinOp ity "shl" (bitBin ity (\x y -> shiftL x (fromIntegral y))) LSHL total , iBinOp ity "lshr" (bitBin ity (\x y -> shiftR x (fromIntegral y))) LLSHR total , iBinOp ity "ashr" (bashr ity) LASHR total , iBinOp ity "and" (bitBin ity (.&.)) LAnd total , iBinOp ity "or" (bitBin ity (.|.)) LOr total , iBinOp ity "xor" (bitBin ity (xor)) LXOr total , iUnOp ity "compl" (bUn ity complement) LCompl total ]
869
false
true
0
13
213
413
216
197
null
null
jean-edouard/manager
updatemgr/UpdateMgr/UpdateMgrRpc.hs
gpl-2.0
expose :: Job -> App () expose job = liftRpc . rpcExpose (fromString "/") . interfaces . implementation job =<< getAppState
123
expose :: Job -> App () expose job = liftRpc . rpcExpose (fromString "/") . interfaces . implementation job =<< getAppState
123
expose job = liftRpc . rpcExpose (fromString "/") . interfaces . implementation job =<< getAppState
99
false
true
0
11
20
51
24
27
null
null
mdsteele/fallback
src/Fallback/View/Widget.hs
gpl-3.0
newScrollZone :: (MonadDraw m) => m (View (Int, Int, Int, Int) Int) newScrollZone = do let barWidth = 10 scrollBar <- newScrollBar let handler (_, maxValue, perPage, curValue) (EvScrollDownwards pt) = do whenWithinCanvas pt $ do return $ Action $ min (maxValue - perPage) $ curValue + 1 handler (minValue, _, _, curValue) (EvScrollUpwards pt) = do whenWithinCanvas pt $ return $ Action $ max minValue $ curValue - 1 handler _ _ = return Ignore return $ compoundView [ (subView (\_ (w, h) -> Rect (w - barWidth) 0 barWidth h) $ scrollBar), (View (const $ return ()) handler)] -------------------------------------------------------------------------------
709
newScrollZone :: (MonadDraw m) => m (View (Int, Int, Int, Int) Int) newScrollZone = do let barWidth = 10 scrollBar <- newScrollBar let handler (_, maxValue, perPage, curValue) (EvScrollDownwards pt) = do whenWithinCanvas pt $ do return $ Action $ min (maxValue - perPage) $ curValue + 1 handler (minValue, _, _, curValue) (EvScrollUpwards pt) = do whenWithinCanvas pt $ return $ Action $ max minValue $ curValue - 1 handler _ _ = return Ignore return $ compoundView [ (subView (\_ (w, h) -> Rect (w - barWidth) 0 barWidth h) $ scrollBar), (View (const $ return ()) handler)] -------------------------------------------------------------------------------
709
newScrollZone = do let barWidth = 10 scrollBar <- newScrollBar let handler (_, maxValue, perPage, curValue) (EvScrollDownwards pt) = do whenWithinCanvas pt $ do return $ Action $ min (maxValue - perPage) $ curValue + 1 handler (minValue, _, _, curValue) (EvScrollUpwards pt) = do whenWithinCanvas pt $ return $ Action $ max minValue $ curValue - 1 handler _ _ = return Ignore return $ compoundView [ (subView (\_ (w, h) -> Rect (w - barWidth) 0 barWidth h) $ scrollBar), (View (const $ return ()) handler)] -------------------------------------------------------------------------------
641
false
true
0
21
155
285
144
141
null
null
bgamari/pandoc
src/Text/Pandoc/Readers/Markdown.hs
gpl-2.0
indentSpaces :: MarkdownParser String indentSpaces = try $ do tabStop <- getOption readerTabStop count tabStop (char ' ') <|> string "\t" <?> "indentation"
163
indentSpaces :: MarkdownParser String indentSpaces = try $ do tabStop <- getOption readerTabStop count tabStop (char ' ') <|> string "\t" <?> "indentation"
163
indentSpaces = try $ do tabStop <- getOption readerTabStop count tabStop (char ' ') <|> string "\t" <?> "indentation"
125
false
true
0
12
30
53
24
29
null
null
vikraman/ghc
compiler/hsSyn/HsDecls.hs
bsd-3-clause
lvectInstDecl _ = False
45
lvectInstDecl _ = False
45
lvectInstDecl _ = False
45
false
false
0
5
25
9
4
5
null
null
Gurrt/software-testing
week-1/CSI.hs
mit
-- Matthew: Carl didn’t do it, and neither did I. -- says Matthew Matthew = False says Matthew Carl = False
107
says Matthew Carl = False
25
says Matthew Carl = False
25
true
false
1
5
20
18
7
11
null
null
tchagnon/cs636-raytracer
a6/Scene.hs
apache-2.0
prepScene :: Int -> Scene -> Scene prepScene faceThreshold scene = let objs2 = prepObjs id4f (objects scene) in let objs3 = constructBVH faceThreshold objs2 in scene{objects = objs3}
194
prepScene :: Int -> Scene -> Scene prepScene faceThreshold scene = let objs2 = prepObjs id4f (objects scene) in let objs3 = constructBVH faceThreshold objs2 in scene{objects = objs3}
194
prepScene faceThreshold scene = let objs2 = prepObjs id4f (objects scene) in let objs3 = constructBVH faceThreshold objs2 in scene{objects = objs3}
159
false
true
0
11
40
70
34
36
null
null
dmjio/miso
src/Miso/Svg/Attribute.hs
bsd-3-clause
-- | <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/k1> k1_ :: MisoString -> Attribute action k1_ = attr "k1"
123
k1_ :: MisoString -> Attribute action k1_ = attr "k1"
54
k1_ = attr "k1"
15
true
true
0
7
13
27
12
15
null
null
rueshyna/gogol
gogol-logging/gen/Network/Google/Logging/Types/Product.hs
mpl-2.0
-- | Optional. A concise name for the monitored resource type that might be -- displayed in user interfaces. It should be a Title Cased Noun Phrase, -- without any article or other determiners. For example, \"Google Cloud -- SQL Database\". mrdDisplayName :: Lens' MonitoredResourceDescriptor (Maybe Text) mrdDisplayName = lens _mrdDisplayName (\ s a -> s{_mrdDisplayName = a})
385
mrdDisplayName :: Lens' MonitoredResourceDescriptor (Maybe Text) mrdDisplayName = lens _mrdDisplayName (\ s a -> s{_mrdDisplayName = a})
144
mrdDisplayName = lens _mrdDisplayName (\ s a -> s{_mrdDisplayName = a})
79
true
true
0
9
65
51
28
23
null
null
forestbelton/orb
src/Layout/Box.hs
bsd-3-clause
makeBoxModel :: StyledNode -> [BoxNode] makeBoxModel node = maybeToList . fmap go . displayToBox . fromDisplayVal $ S.lookup sty Display where sty = node ^. style go bt = BoxNode (node ^. nodeType) sty Named bt cs cs = concatMap makeBoxModel (node ^. children) -- hack for now, we really need to make NodeType optional on BoxNode
354
makeBoxModel :: StyledNode -> [BoxNode] makeBoxModel node = maybeToList . fmap go . displayToBox . fromDisplayVal $ S.lookup sty Display where sty = node ^. style go bt = BoxNode (node ^. nodeType) sty Named bt cs cs = concatMap makeBoxModel (node ^. children) -- hack for now, we really need to make NodeType optional on BoxNode
354
makeBoxModel node = maybeToList . fmap go . displayToBox . fromDisplayVal $ S.lookup sty Display where sty = node ^. style go bt = BoxNode (node ^. nodeType) sty Named bt cs cs = concatMap makeBoxModel (node ^. children) -- hack for now, we really need to make NodeType optional on BoxNode
314
false
true
3
9
81
117
53
64
null
null
chrisdone/ghc-server
src/GHC/Server/Model/Ghc.hs
bsd-3-clause
-- | Initialize the GHC service. initializeGhc :: (MonadLogger m,GhcMonad m) => m () initializeGhc = do (libincs,exts,pkgs) <- liftIO getDependencyInfo initialDynFlags <- getSessionDynFlags userFlags <- fmap (<> concat [exts,initFlags,deps pkgs,src libincs]) makeUserFlags (dflags',_,_) <- parseDynamicFlags (initialDynFlags {hscTarget = HscAsm ,ghcLink = LinkInMemory ,ghcMode = CompManager ,optLevel = 0}) (map (mkGeneralLocated "flag") userFlags) let dflags'' = dflags' _ <- setSessionDynFlags dflags'' (dflags''',packageids) <- liftIO (initPackages dflags'') _ <- setSessionDynFlags dflags''' mapM parseImportDecl necessaryImports >>= setContext liftIO (initDynLinker dflags''') $(logInfo) ("User flags: " <> T.pack (unwords userFlags)) $(logInfo) ("Packages: " <> T.pack (unwords (map (showppr dflags''') packageids))) where initFlags = ["-fobject-code" ,"-dynamic-too" ,"-v1" ,"-optP-include" ,"-optPdist/build/autogen/cabal_macros.h"] <> ["-fdefer-type-errors" | ghcVersion >= Ghc78] deps [] = [] deps xs = ["-hide-all-packages"] <> map (\pkg -> "-package " <> renderPackageId pkg) xs src [] = [] src xs = map (\x -> "-i" <> x) xs -- | Handle any messages coming from GHC. GHC seems to disregard -- resetting the 'log_action' for some reason, so we set a log action -- which will read from a var for its action and that var will be -- reset once the action is done. Any further messages broadcast on -- that handler will be printed in debugging mode as bogus.
1,865
initializeGhc :: (MonadLogger m,GhcMonad m) => m () initializeGhc = do (libincs,exts,pkgs) <- liftIO getDependencyInfo initialDynFlags <- getSessionDynFlags userFlags <- fmap (<> concat [exts,initFlags,deps pkgs,src libincs]) makeUserFlags (dflags',_,_) <- parseDynamicFlags (initialDynFlags {hscTarget = HscAsm ,ghcLink = LinkInMemory ,ghcMode = CompManager ,optLevel = 0}) (map (mkGeneralLocated "flag") userFlags) let dflags'' = dflags' _ <- setSessionDynFlags dflags'' (dflags''',packageids) <- liftIO (initPackages dflags'') _ <- setSessionDynFlags dflags''' mapM parseImportDecl necessaryImports >>= setContext liftIO (initDynLinker dflags''') $(logInfo) ("User flags: " <> T.pack (unwords userFlags)) $(logInfo) ("Packages: " <> T.pack (unwords (map (showppr dflags''') packageids))) where initFlags = ["-fobject-code" ,"-dynamic-too" ,"-v1" ,"-optP-include" ,"-optPdist/build/autogen/cabal_macros.h"] <> ["-fdefer-type-errors" | ghcVersion >= Ghc78] deps [] = [] deps xs = ["-hide-all-packages"] <> map (\pkg -> "-package " <> renderPackageId pkg) xs src [] = [] src xs = map (\x -> "-i" <> x) xs -- | Handle any messages coming from GHC. GHC seems to disregard -- resetting the 'log_action' for some reason, so we set a log action -- which will read from a var for its action and that var will be -- reset once the action is done. Any further messages broadcast on -- that handler will be printed in debugging mode as bogus.
1,832
initializeGhc = do (libincs,exts,pkgs) <- liftIO getDependencyInfo initialDynFlags <- getSessionDynFlags userFlags <- fmap (<> concat [exts,initFlags,deps pkgs,src libincs]) makeUserFlags (dflags',_,_) <- parseDynamicFlags (initialDynFlags {hscTarget = HscAsm ,ghcLink = LinkInMemory ,ghcMode = CompManager ,optLevel = 0}) (map (mkGeneralLocated "flag") userFlags) let dflags'' = dflags' _ <- setSessionDynFlags dflags'' (dflags''',packageids) <- liftIO (initPackages dflags'') _ <- setSessionDynFlags dflags''' mapM parseImportDecl necessaryImports >>= setContext liftIO (initDynLinker dflags''') $(logInfo) ("User flags: " <> T.pack (unwords userFlags)) $(logInfo) ("Packages: " <> T.pack (unwords (map (showppr dflags''') packageids))) where initFlags = ["-fobject-code" ,"-dynamic-too" ,"-v1" ,"-optP-include" ,"-optPdist/build/autogen/cabal_macros.h"] <> ["-fdefer-type-errors" | ghcVersion >= Ghc78] deps [] = [] deps xs = ["-hide-all-packages"] <> map (\pkg -> "-package " <> renderPackageId pkg) xs src [] = [] src xs = map (\x -> "-i" <> x) xs -- | Handle any messages coming from GHC. GHC seems to disregard -- resetting the 'log_action' for some reason, so we set a log action -- which will read from a var for its action and that var will be -- reset once the action is done. Any further messages broadcast on -- that handler will be printed in debugging mode as bogus.
1,761
true
true
8
16
603
443
223
220
null
null
AlexeyRaga/eta
compiler/ETA/TypeCheck/TcGenDeriv.hs
bsd-3-clause
isSym :: String -> Bool isSym "" = False
45
isSym :: String -> Bool isSym "" = False
45
isSym "" = False
21
false
true
0
5
13
22
10
12
null
null
alexander-at-github/eta
shake/Build.hs
bsd-3-clause
getInstallDir :: Action FilePath getInstallDir = fmap (</> "bin") $ liftIO $ getAppUserDataDirectory "local"
108
getInstallDir :: Action FilePath getInstallDir = fmap (</> "bin") $ liftIO $ getAppUserDataDirectory "local"
108
getInstallDir = fmap (</> "bin") $ liftIO $ getAppUserDataDirectory "local"
75
false
true
1
8
13
35
16
19
null
null
vTurbine/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
dcQual = mk_known_key_name dataName
37
dcQual = mk_known_key_name dataName
37
dcQual = mk_known_key_name dataName
37
false
false
0
5
5
9
4
5
null
null