Search is not available for this dataset
repo_name
string
path
string
license
string
full_code
string
full_size
int64
uncommented_code
string
uncommented_size
int64
function_only_code
string
function_only_size
int64
is_commented
bool
is_signatured
bool
n_ast_errors
int64
ast_max_depth
int64
n_whitespaces
int64
n_ast_nodes
int64
n_ast_terminals
int64
n_ast_nonterminals
int64
loc
int64
cycloplexity
int64
bitemyapp/hlint
data/Default.hs
bsd-3-clause
warn = (\(x,y) -> (x,f y)) ==> Control.Arrow.second f
54
warn = (\(x,y) -> (x,f y)) ==> Control.Arrow.second f
54
warn = (\(x,y) -> (x,f y)) ==> Control.Arrow.second f
54
false
false
2
8
9
39
21
18
null
null
NorfairKing/the-notes
src/Computability/FiniteStateAutomata/Macro.hs
gpl-2.0
-- * Automata -- ** NFSA -- | NFSA definition nfsa :: Note -- ^ Set of states -> Note -- ^ Alphabet -> Note -- ^ Transition function -> Note -- ^ Set of accepting states -> Note -- ^ Set of initial states -> Note nfsa = quintuple
255
nfsa :: Note -- ^ Set of states -> Note -- ^ Alphabet -> Note -- ^ Transition function -> Note -- ^ Set of accepting states -> Note -- ^ Set of initial states -> Note nfsa = quintuple
208
nfsa = quintuple
16
true
true
0
9
75
39
24
15
null
null
DougBurke/swish
tests/RDFQueryTest.hs
lgpl-2.1
result47d1 = b4 [ "?a rel:stepson pers:St3 . \n" , "?a rel:son pers:Gr3 . \n"]
89
result47d1 = b4 [ "?a rel:stepson pers:St3 . \n" , "?a rel:son pers:Gr3 . \n"]
89
result47d1 = b4 [ "?a rel:stepson pers:St3 . \n" , "?a rel:son pers:Gr3 . \n"]
89
false
false
1
5
25
18
8
10
null
null
dfordivam/lava
Lava/Signal.hs
bsd-3-clause
ifBool :: Signal Bool -> (Signal Bool, Signal Bool) -> Signal Bool ifBool c (x,y) = orl[andl[c,x],andl[inv c,y]]
112
ifBool :: Signal Bool -> (Signal Bool, Signal Bool) -> Signal Bool ifBool c (x,y) = orl[andl[c,x],andl[inv c,y]]
112
ifBool c (x,y) = orl[andl[c,x],andl[inv c,y]]
45
false
true
0
9
17
83
41
42
null
null
tjakway/ghcjvm
compiler/typecheck/TcType.hs
bsd-3-clause
getDFunTyKey (ForAllTy (Anon _) _) = getOccName funTyCon
58
getDFunTyKey (ForAllTy (Anon _) _) = getOccName funTyCon
58
getDFunTyKey (ForAllTy (Anon _) _) = getOccName funTyCon
58
false
false
0
9
9
26
12
14
null
null
tamarin-prover/tamarin-prover
lib/theory/src/Theory.hs
gpl-3.0
getLeftProtoRule (DiffProtoRule _ (Just (l, _))) = l
54
getLeftProtoRule (DiffProtoRule _ (Just (l, _))) = l
54
getLeftProtoRule (DiffProtoRule _ (Just (l, _))) = l
54
false
false
0
10
9
29
15
14
null
null
jkoppel/compstrat
Data/Comp/Multi/Strategic.hs
bsd-3-clause
isSortT :: (DynCase f l, Applicative m) => Proxy l -> TranslateM m f l' Bool isSortT p = pure . isSort p
104
isSortT :: (DynCase f l, Applicative m) => Proxy l -> TranslateM m f l' Bool isSortT p = pure . isSort p
104
isSortT p = pure . isSort p
27
false
true
1
8
22
59
27
32
null
null
filopodia/open
stanhs/lib/Stan/Simulate.hs
mit
fracOp :: (forall a . Floating a => a -> a) -> StanValue -> StanValue fracOp f (VDouble x) = VDouble $ f x
106
fracOp :: (forall a . Floating a => a -> a) -> StanValue -> StanValue fracOp f (VDouble x) = VDouble $ f x
106
fracOp f (VDouble x) = VDouble $ f x
36
false
true
0
9
23
56
28
28
null
null
robeverest/accelerate
Data/Array/Accelerate/Analysis/Match.hs
bsd-3-clause
matchBoundary _ Clamp Clamp = True
49
matchBoundary _ Clamp Clamp = True
49
matchBoundary _ Clamp Clamp = True
49
false
false
0
5
20
13
6
7
null
null
Noeda/compiled-expressions
src/Data/CompiledExpression/Internal.hs
mit
synthVarSize (Atanh sz) = 1 + synthVarSize sz
45
synthVarSize (Atanh sz) = 1 + synthVarSize sz
45
synthVarSize (Atanh sz) = 1 + synthVarSize sz
45
false
false
0
7
7
22
10
12
null
null
olsner/m3
Types/Conv.hs
bsd-3-clause
integralConv = Search $ \t -> case t of TInt -> convChar t TBool -> convChar t _ -> [] where convChar t = [(TChar,toChar),(t,retype)]
141
integralConv = Search $ \t -> case t of TInt -> convChar t TBool -> convChar t _ -> [] where convChar t = [(TChar,toChar),(t,retype)]
141
integralConv = Search $ \t -> case t of TInt -> convChar t TBool -> convChar t _ -> [] where convChar t = [(TChar,toChar),(t,retype)]
141
false
false
4
9
32
81
39
42
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/types/FamInstEnv.hs
bsd-3-clause
identicalFamInstHead :: FamInst -> FamInst -> Bool -- ^ True when the LHSs are identical -- Used for overriding in GHCi identicalFamInstHead (FamInst { fi_axiom = ax1 }) (FamInst { fi_axiom = ax2 }) = coAxiomTyCon ax1 == coAxiomTyCon ax2 && brListLength brs1 == brListLength brs2 && and (brListZipWith identical_branch brs1 brs2) where brs1 = coAxiomBranches ax1 brs2 = coAxiomBranches ax2 identical_branch br1 br2 = isJust (tcMatchTys tvs1 lhs1 lhs2) && isJust (tcMatchTys tvs2 lhs2 lhs1) where tvs1 = mkVarSet (coAxBranchTyVars br1) tvs2 = mkVarSet (coAxBranchTyVars br2) lhs1 = coAxBranchLHS br1 lhs2 = coAxBranchLHS br2 {- ************************************************************************ * * Compatibility * * ************************************************************************ Note [Apartness] ~~~~~~~~~~~~~~~~ In dealing with closed type families, we must be able to check that one type will never reduce to another. This check is called /apartness/. The check is always between a target (which may be an arbitrary type) and a pattern. Here is how we do it: apart(target, pattern) = not (unify(flatten(target), pattern)) where flatten (implemented in flattenTys, below) converts all type-family applications into fresh variables. (See Note [Flattening].) Note [Compatibility] ~~~~~~~~~~~~~~~~~~~~ Two patterns are /compatible/ if either of the following conditions hold: 1) The patterns are apart. 2) The patterns unify with a substitution S, and their right hand sides equal under that substitution. For open type families, only compatible instances are allowed. For closed type families, the story is slightly more complicated. Consider the following: type family F a where F Int = Bool F a = Int g :: Show a => a -> F a g x = length (show x) Should that type-check? No. We need to allow for the possibility that 'a' might be Int and therefore 'F a' should be Bool. We can simplify 'F a' to Int only when we can be sure that 'a' is not Int. To achieve this, after finding a possible match within the equations, we have to go back to all previous equations and check that, under the substitution induced by the match, other branches are surely apart. (See Note [Apartness].) This is similar to what happens with class instance selection, when we need to guarantee that there is only a match and no unifiers. The exact algorithm is different here because the the potentially-overlapping group is closed. As another example, consider this: type family G x type instance where G Int = Bool G a = Double type family H y -- no instances Now, we want to simplify (G (H Char)). We can't, because (H Char) might later simplify to be Int. So, (G (H Char)) is stuck, for now. While everything above is quite sound, it isn't as expressive as we'd like. Consider this: type family J a where J Int = Int J a = a Can we simplify (J b) to b? Sure we can. Yes, the first equation matches if b is instantiated with Int, but the RHSs coincide there, so it's all OK. So, the rule is this: when looking up a branch in a closed type family, we find a branch that matches the target, but then we make sure that the target is apart from every previous *incompatible* branch. We don't check the branches that are compatible with the matching branch, because they are either irrelevant (clause 1 of compatible) or benign (clause 2 of compatible). -} -- See Note [Compatibility]
3,636
identicalFamInstHead :: FamInst -> FamInst -> Bool identicalFamInstHead (FamInst { fi_axiom = ax1 }) (FamInst { fi_axiom = ax2 }) = coAxiomTyCon ax1 == coAxiomTyCon ax2 && brListLength brs1 == brListLength brs2 && and (brListZipWith identical_branch brs1 brs2) where brs1 = coAxiomBranches ax1 brs2 = coAxiomBranches ax2 identical_branch br1 br2 = isJust (tcMatchTys tvs1 lhs1 lhs2) && isJust (tcMatchTys tvs2 lhs2 lhs1) where tvs1 = mkVarSet (coAxBranchTyVars br1) tvs2 = mkVarSet (coAxBranchTyVars br2) lhs1 = coAxBranchLHS br1 lhs2 = coAxBranchLHS br2 {- ************************************************************************ * * Compatibility * * ************************************************************************ Note [Apartness] ~~~~~~~~~~~~~~~~ In dealing with closed type families, we must be able to check that one type will never reduce to another. This check is called /apartness/. The check is always between a target (which may be an arbitrary type) and a pattern. Here is how we do it: apart(target, pattern) = not (unify(flatten(target), pattern)) where flatten (implemented in flattenTys, below) converts all type-family applications into fresh variables. (See Note [Flattening].) Note [Compatibility] ~~~~~~~~~~~~~~~~~~~~ Two patterns are /compatible/ if either of the following conditions hold: 1) The patterns are apart. 2) The patterns unify with a substitution S, and their right hand sides equal under that substitution. For open type families, only compatible instances are allowed. For closed type families, the story is slightly more complicated. Consider the following: type family F a where F Int = Bool F a = Int g :: Show a => a -> F a g x = length (show x) Should that type-check? No. We need to allow for the possibility that 'a' might be Int and therefore 'F a' should be Bool. We can simplify 'F a' to Int only when we can be sure that 'a' is not Int. To achieve this, after finding a possible match within the equations, we have to go back to all previous equations and check that, under the substitution induced by the match, other branches are surely apart. (See Note [Apartness].) This is similar to what happens with class instance selection, when we need to guarantee that there is only a match and no unifiers. The exact algorithm is different here because the the potentially-overlapping group is closed. As another example, consider this: type family G x type instance where G Int = Bool G a = Double type family H y -- no instances Now, we want to simplify (G (H Char)). We can't, because (H Char) might later simplify to be Int. So, (G (H Char)) is stuck, for now. While everything above is quite sound, it isn't as expressive as we'd like. Consider this: type family J a where J Int = Int J a = a Can we simplify (J b) to b? Sure we can. Yes, the first equation matches if b is instantiated with Int, but the RHSs coincide there, so it's all OK. So, the rule is this: when looking up a branch in a closed type family, we find a branch that matches the target, but then we make sure that the target is apart from every previous *incompatible* branch. We don't check the branches that are compatible with the matching branch, because they are either irrelevant (clause 1 of compatible) or benign (clause 2 of compatible). -} -- See Note [Compatibility]
3,567
identicalFamInstHead (FamInst { fi_axiom = ax1 }) (FamInst { fi_axiom = ax2 }) = coAxiomTyCon ax1 == coAxiomTyCon ax2 && brListLength brs1 == brListLength brs2 && and (brListZipWith identical_branch brs1 brs2) where brs1 = coAxiomBranches ax1 brs2 = coAxiomBranches ax2 identical_branch br1 br2 = isJust (tcMatchTys tvs1 lhs1 lhs2) && isJust (tcMatchTys tvs2 lhs2 lhs1) where tvs1 = mkVarSet (coAxBranchTyVars br1) tvs2 = mkVarSet (coAxBranchTyVars br2) lhs1 = coAxBranchLHS br1 lhs2 = coAxBranchLHS br2 {- ************************************************************************ * * Compatibility * * ************************************************************************ Note [Apartness] ~~~~~~~~~~~~~~~~ In dealing with closed type families, we must be able to check that one type will never reduce to another. This check is called /apartness/. The check is always between a target (which may be an arbitrary type) and a pattern. Here is how we do it: apart(target, pattern) = not (unify(flatten(target), pattern)) where flatten (implemented in flattenTys, below) converts all type-family applications into fresh variables. (See Note [Flattening].) Note [Compatibility] ~~~~~~~~~~~~~~~~~~~~ Two patterns are /compatible/ if either of the following conditions hold: 1) The patterns are apart. 2) The patterns unify with a substitution S, and their right hand sides equal under that substitution. For open type families, only compatible instances are allowed. For closed type families, the story is slightly more complicated. Consider the following: type family F a where F Int = Bool F a = Int g :: Show a => a -> F a g x = length (show x) Should that type-check? No. We need to allow for the possibility that 'a' might be Int and therefore 'F a' should be Bool. We can simplify 'F a' to Int only when we can be sure that 'a' is not Int. To achieve this, after finding a possible match within the equations, we have to go back to all previous equations and check that, under the substitution induced by the match, other branches are surely apart. (See Note [Apartness].) This is similar to what happens with class instance selection, when we need to guarantee that there is only a match and no unifiers. The exact algorithm is different here because the the potentially-overlapping group is closed. As another example, consider this: type family G x type instance where G Int = Bool G a = Double type family H y -- no instances Now, we want to simplify (G (H Char)). We can't, because (H Char) might later simplify to be Int. So, (G (H Char)) is stuck, for now. While everything above is quite sound, it isn't as expressive as we'd like. Consider this: type family J a where J Int = Int J a = a Can we simplify (J b) to b? Sure we can. Yes, the first equation matches if b is instantiated with Int, but the RHSs coincide there, so it's all OK. So, the rule is this: when looking up a branch in a closed type family, we find a branch that matches the target, but then we make sure that the target is apart from every previous *incompatible* branch. We don't check the branches that are compatible with the matching branch, because they are either irrelevant (clause 1 of compatible) or benign (clause 2 of compatible). -} -- See Note [Compatibility]
3,516
true
true
9
9
822
202
99
103
null
null
aelve/guide
back/tests/WebSpec.hs
bsd-3-clause
shouldLinkToRelative :: CanSelect a => a -> String -> WD () s `shouldLinkToRelative` url2 = do -- TODO: would be nice if it checked relative to the current page url <- getLink s case parseURI url of Nothing -> error ("couldn't parse as URL: " ++ url) Just u -> do maybe "" uriRegName (uriAuthority u) `shouldBe` "localhost" uriPath u `shouldBe` url2
376
shouldLinkToRelative :: CanSelect a => a -> String -> WD () s `shouldLinkToRelative` url2 = do -- TODO: would be nice if it checked relative to the current page url <- getLink s case parseURI url of Nothing -> error ("couldn't parse as URL: " ++ url) Just u -> do maybe "" uriRegName (uriAuthority u) `shouldBe` "localhost" uriPath u `shouldBe` url2
376
s `shouldLinkToRelative` url2 = do -- TODO: would be nice if it checked relative to the current page url <- getLink s case parseURI url of Nothing -> error ("couldn't parse as URL: " ++ url) Just u -> do maybe "" uriRegName (uriAuthority u) `shouldBe` "localhost" uriPath u `shouldBe` url2
316
false
true
1
15
88
120
56
64
null
null
cocreature/leksah
src/IDE/Pane/Modules.hs
gpl-2.0
buildFacetForrest :: ModuleDescr -> DescrForest buildFacetForrest modDescr = let (instances,other) = partition (\id -> case dscTypeHint id of InstanceDescr _ -> True _ -> False) $ take 2000 $ mdIdDescriptions modDescr -- TODO: Patch for toxioc TypeLevel package with 28000 aliases forestWithoutInstances = map buildFacet other (forest2,orphaned) = foldl' addInstances (forestWithoutInstances,[]) instances orphanedNodes = map (\ inst -> Node inst []) orphaned in forest2 ++ reverse orphanedNodes where -- expand nodes in a module desciption for the description tree buildFacet :: Descr -> DescrTree buildFacet descr = case dscTypeHint descr of DataDescr constructors fields -> Node descr (map (\ (SimpleDescr fn ty loc comm exp) -> Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = ConstructorDescr descr, dscExported' = exp})) []) constructors ++ map (\ (SimpleDescr fn ty loc comm exp) -> Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = FieldDescr descr, dscExported' = exp})) []) fields) NewtypeDescr (SimpleDescr fn ty loc comm exp) mbField -> Node descr (Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = ConstructorDescr descr, dscExported' = exp})) [] : case mbField of Just (SimpleDescr fn ty loc comm exp) -> [Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = FieldDescr descr, dscExported' = exp})) []] Nothing -> []) ClassDescr _ methods -> Node descr (map (\(SimpleDescr fn ty loc comm exp) -> Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = MethodDescr descr, dscExported' = exp})) []) methods) _ -> Node descr [] where makeReexported :: Descr -> Descr -> Descr makeReexported (Reexported d1) d2 = Reexported ReexportedDescr{dsrMbModu = dsrMbModu d1, dsrDescr = d2} makeReexported _ d2 = d2 addInstances :: (DescrForest,[Descr]) -> Descr -> (DescrForest,[Descr]) addInstances (forest,orphaned) instDescr = case foldr (matches instDescr) ([],False) forest of (f,True) -> (f,orphaned) (f,False) -> (forest, instDescr:orphaned) matches :: Descr -> DescrTree -> (DescrForest,Bool) -> (DescrForest,Bool) matches (Real (instDescr@RealDescr{dscTypeHint' = InstanceDescr binds})) (Node dd@(Real (RealDescr id _ _ _ _ (DataDescr _ _) _)) sub) (forest,False) | not (null binds) && id == head binds = (Node dd (sub ++ [Node newInstDescr []]) : forest,True) where newInstDescr = if isNothing (dscMbLocation' instDescr) then Real $ instDescr{dscMbLocation' = dscMbLocation dd} else Real instDescr matches (Real (instDescr@RealDescr{dscTypeHint' = InstanceDescr binds})) (Node dd@(Real (RealDescr id _ _ _ _ (NewtypeDescr _ _) _)) sub) (forest,False) | not (null binds) && id == head binds = (Node dd (sub ++ [Node newInstDescr []]) : forest,True) where newInstDescr = if isNothing (dscMbLocation' instDescr) then Real $ instDescr{dscMbLocation' = dscMbLocation dd} else Real instDescr matches _ node (forest,b) = (node:forest,b)
6,243
buildFacetForrest :: ModuleDescr -> DescrForest buildFacetForrest modDescr = let (instances,other) = partition (\id -> case dscTypeHint id of InstanceDescr _ -> True _ -> False) $ take 2000 $ mdIdDescriptions modDescr -- TODO: Patch for toxioc TypeLevel package with 28000 aliases forestWithoutInstances = map buildFacet other (forest2,orphaned) = foldl' addInstances (forestWithoutInstances,[]) instances orphanedNodes = map (\ inst -> Node inst []) orphaned in forest2 ++ reverse orphanedNodes where -- expand nodes in a module desciption for the description tree buildFacet :: Descr -> DescrTree buildFacet descr = case dscTypeHint descr of DataDescr constructors fields -> Node descr (map (\ (SimpleDescr fn ty loc comm exp) -> Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = ConstructorDescr descr, dscExported' = exp})) []) constructors ++ map (\ (SimpleDescr fn ty loc comm exp) -> Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = FieldDescr descr, dscExported' = exp})) []) fields) NewtypeDescr (SimpleDescr fn ty loc comm exp) mbField -> Node descr (Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = ConstructorDescr descr, dscExported' = exp})) [] : case mbField of Just (SimpleDescr fn ty loc comm exp) -> [Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = FieldDescr descr, dscExported' = exp})) []] Nothing -> []) ClassDescr _ methods -> Node descr (map (\(SimpleDescr fn ty loc comm exp) -> Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = MethodDescr descr, dscExported' = exp})) []) methods) _ -> Node descr [] where makeReexported :: Descr -> Descr -> Descr makeReexported (Reexported d1) d2 = Reexported ReexportedDescr{dsrMbModu = dsrMbModu d1, dsrDescr = d2} makeReexported _ d2 = d2 addInstances :: (DescrForest,[Descr]) -> Descr -> (DescrForest,[Descr]) addInstances (forest,orphaned) instDescr = case foldr (matches instDescr) ([],False) forest of (f,True) -> (f,orphaned) (f,False) -> (forest, instDescr:orphaned) matches :: Descr -> DescrTree -> (DescrForest,Bool) -> (DescrForest,Bool) matches (Real (instDescr@RealDescr{dscTypeHint' = InstanceDescr binds})) (Node dd@(Real (RealDescr id _ _ _ _ (DataDescr _ _) _)) sub) (forest,False) | not (null binds) && id == head binds = (Node dd (sub ++ [Node newInstDescr []]) : forest,True) where newInstDescr = if isNothing (dscMbLocation' instDescr) then Real $ instDescr{dscMbLocation' = dscMbLocation dd} else Real instDescr matches (Real (instDescr@RealDescr{dscTypeHint' = InstanceDescr binds})) (Node dd@(Real (RealDescr id _ _ _ _ (NewtypeDescr _ _) _)) sub) (forest,False) | not (null binds) && id == head binds = (Node dd (sub ++ [Node newInstDescr []]) : forest,True) where newInstDescr = if isNothing (dscMbLocation' instDescr) then Real $ instDescr{dscMbLocation' = dscMbLocation dd} else Real instDescr matches _ node (forest,b) = (node:forest,b)
6,243
buildFacetForrest modDescr = let (instances,other) = partition (\id -> case dscTypeHint id of InstanceDescr _ -> True _ -> False) $ take 2000 $ mdIdDescriptions modDescr -- TODO: Patch for toxioc TypeLevel package with 28000 aliases forestWithoutInstances = map buildFacet other (forest2,orphaned) = foldl' addInstances (forestWithoutInstances,[]) instances orphanedNodes = map (\ inst -> Node inst []) orphaned in forest2 ++ reverse orphanedNodes where -- expand nodes in a module desciption for the description tree buildFacet :: Descr -> DescrTree buildFacet descr = case dscTypeHint descr of DataDescr constructors fields -> Node descr (map (\ (SimpleDescr fn ty loc comm exp) -> Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = ConstructorDescr descr, dscExported' = exp})) []) constructors ++ map (\ (SimpleDescr fn ty loc comm exp) -> Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = FieldDescr descr, dscExported' = exp})) []) fields) NewtypeDescr (SimpleDescr fn ty loc comm exp) mbField -> Node descr (Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = ConstructorDescr descr, dscExported' = exp})) [] : case mbField of Just (SimpleDescr fn ty loc comm exp) -> [Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = FieldDescr descr, dscExported' = exp})) []] Nothing -> []) ClassDescr _ methods -> Node descr (map (\(SimpleDescr fn ty loc comm exp) -> Node (makeReexported descr (Real RealDescr{dscName' = fn, dscMbTypeStr' = ty, dscMbModu' = dsMbModu descr, dscMbLocation' = loc, dscMbComment' = comm, dscTypeHint' = MethodDescr descr, dscExported' = exp})) []) methods) _ -> Node descr [] where makeReexported :: Descr -> Descr -> Descr makeReexported (Reexported d1) d2 = Reexported ReexportedDescr{dsrMbModu = dsrMbModu d1, dsrDescr = d2} makeReexported _ d2 = d2 addInstances :: (DescrForest,[Descr]) -> Descr -> (DescrForest,[Descr]) addInstances (forest,orphaned) instDescr = case foldr (matches instDescr) ([],False) forest of (f,True) -> (f,orphaned) (f,False) -> (forest, instDescr:orphaned) matches :: Descr -> DescrTree -> (DescrForest,Bool) -> (DescrForest,Bool) matches (Real (instDescr@RealDescr{dscTypeHint' = InstanceDescr binds})) (Node dd@(Real (RealDescr id _ _ _ _ (DataDescr _ _) _)) sub) (forest,False) | not (null binds) && id == head binds = (Node dd (sub ++ [Node newInstDescr []]) : forest,True) where newInstDescr = if isNothing (dscMbLocation' instDescr) then Real $ instDescr{dscMbLocation' = dscMbLocation dd} else Real instDescr matches (Real (instDescr@RealDescr{dscTypeHint' = InstanceDescr binds})) (Node dd@(Real (RealDescr id _ _ _ _ (NewtypeDescr _ _) _)) sub) (forest,False) | not (null binds) && id == head binds = (Node dd (sub ++ [Node newInstDescr []]) : forest,True) where newInstDescr = if isNothing (dscMbLocation' instDescr) then Real $ instDescr{dscMbLocation' = dscMbLocation dd} else Real instDescr matches _ node (forest,b) = (node:forest,b)
6,194
false
true
33
22
3,312
1,308
706
602
null
null
matt-keibler/svg-playground
src/AnimationConfig.hs
bsd-3-clause
interpolateSVG num (SVGAnimationEllipse ellipseStart ellipseEnd style) = map (`SVGEllipse` style) (animate num ellipseStart ellipseEnd)
135
interpolateSVG num (SVGAnimationEllipse ellipseStart ellipseEnd style) = map (`SVGEllipse` style) (animate num ellipseStart ellipseEnd)
135
interpolateSVG num (SVGAnimationEllipse ellipseStart ellipseEnd style) = map (`SVGEllipse` style) (animate num ellipseStart ellipseEnd)
135
false
false
0
7
13
42
22
20
null
null
strager/b
B/RuleDatabase.hs
bsd-3-clause
mapTo :: forall b m q. (forall r. (Rule q r, Typeable r) => r -> b) -> RuleSet m q -> [b] mapTo f (RuleSet xs) = fmap (f' . unsafeCoerce) $ Map.elems xs where f' :: ARule m q r -> b f' (ARule r) = f r
219
mapTo :: forall b m q. (forall r. (Rule q r, Typeable r) => r -> b) -> RuleSet m q -> [b] mapTo f (RuleSet xs) = fmap (f' . unsafeCoerce) $ Map.elems xs where f' :: ARule m q r -> b f' (ARule r) = f r
219
mapTo f (RuleSet xs) = fmap (f' . unsafeCoerce) $ Map.elems xs where f' :: ARule m q r -> b f' (ARule r) = f r
120
false
true
2
11
68
140
68
72
null
null
feuerbach/stackage
Stackage/Select.hs
mit
select :: SelectSettings -> IO BuildPlan select settings' = do ii <- getInstallInfo settings' bt <- case iiBuildTools ii of Left s -> error $ "Could not topologically sort build tools: " ++ s Right x -> return x return BuildPlan { bpTools = bt , bpPackages = iiPackages ii , bpOptionalCore = iiOptionalCore ii , bpCore = iiCore ii , bpSkippedTests = skippedTests settings' , bpExpectedFailures = expectedFailures settings' } -- | Get all of the build tools required.
569
select :: SelectSettings -> IO BuildPlan select settings' = do ii <- getInstallInfo settings' bt <- case iiBuildTools ii of Left s -> error $ "Could not topologically sort build tools: " ++ s Right x -> return x return BuildPlan { bpTools = bt , bpPackages = iiPackages ii , bpOptionalCore = iiOptionalCore ii , bpCore = iiCore ii , bpSkippedTests = skippedTests settings' , bpExpectedFailures = expectedFailures settings' } -- | Get all of the build tools required.
569
select settings' = do ii <- getInstallInfo settings' bt <- case iiBuildTools ii of Left s -> error $ "Could not topologically sort build tools: " ++ s Right x -> return x return BuildPlan { bpTools = bt , bpPackages = iiPackages ii , bpOptionalCore = iiOptionalCore ii , bpCore = iiCore ii , bpSkippedTests = skippedTests settings' , bpExpectedFailures = expectedFailures settings' } -- | Get all of the build tools required.
528
false
true
0
12
182
134
66
68
null
null
mavenraven/github
samples/Pulls/ReviewComments/ListComments.hs
bsd-3-clause
formatComment :: Github.Comment -> String formatComment comment = "Author: " ++ (formatAuthor $ Github.commentUser comment) ++ "\nUpdated: " ++ (show $ Github.commentUpdatedAt comment) ++ (maybe "" ("\nURL: "++) $ Github.commentHtmlUrl comment) ++ "\n\n" ++ (Github.commentBody comment)
300
formatComment :: Github.Comment -> String formatComment comment = "Author: " ++ (formatAuthor $ Github.commentUser comment) ++ "\nUpdated: " ++ (show $ Github.commentUpdatedAt comment) ++ (maybe "" ("\nURL: "++) $ Github.commentHtmlUrl comment) ++ "\n\n" ++ (Github.commentBody comment)
300
formatComment comment = "Author: " ++ (formatAuthor $ Github.commentUser comment) ++ "\nUpdated: " ++ (show $ Github.commentUpdatedAt comment) ++ (maybe "" ("\nURL: "++) $ Github.commentHtmlUrl comment) ++ "\n\n" ++ (Github.commentBody comment)
258
false
true
0
14
49
97
49
48
null
null
elfeck/grouphs
src/SnGroup.hs
mit
cycleFromElem :: Int -> Int -> (Int -> Int) -> Cycle cycleFromElem n x p = go x [x] p where go x cy p | (p x) `elem` cy = cy | otherwise = go (p x) (cy ++ [p x]) p -- only applicable for well defined permutations
233
cycleFromElem :: Int -> Int -> (Int -> Int) -> Cycle cycleFromElem n x p = go x [x] p where go x cy p | (p x) `elem` cy = cy | otherwise = go (p x) (cy ++ [p x]) p -- only applicable for well defined permutations
233
cycleFromElem n x p = go x [x] p where go x cy p | (p x) `elem` cy = cy | otherwise = go (p x) (cy ++ [p x]) p -- only applicable for well defined permutations
180
false
true
0
10
70
115
58
57
null
null
SKA-ScienceDataProcessor/RC
MS3/lib/DNA/DSL.hs
apache-2.0
-- | Allocates a new file channel for sharing data between actors. createFileChan :: Location -> String -> DNA (FileChan a) createFileChan loc name = DNA $ singleton $ CreateFileChan loc name
191
createFileChan :: Location -> String -> DNA (FileChan a) createFileChan loc name = DNA $ singleton $ CreateFileChan loc name
124
createFileChan loc name = DNA $ singleton $ CreateFileChan loc name
67
true
true
0
9
31
47
23
24
null
null
agrafix/hackage-server
Distribution/Server/Users/State.hs
bsd-3-clause
modifyMirrorClients :: (UserIdSet -> UserIdSet) -> Update MirrorClients () modifyMirrorClients func = State.modify (\users -> users { mirrorClients = func (mirrorClients users) })
179
modifyMirrorClients :: (UserIdSet -> UserIdSet) -> Update MirrorClients () modifyMirrorClients func = State.modify (\users -> users { mirrorClients = func (mirrorClients users) })
179
modifyMirrorClients func = State.modify (\users -> users { mirrorClients = func (mirrorClients users) })
104
false
true
0
12
22
62
32
30
null
null
diku-dk/futhark
src/Futhark/IR/Parse.hs
isc
pDeclBase :: Parser (TypeBase shape NoUniqueness) -> Parser (TypeBase shape Uniqueness) pDeclBase p = flip toDecl <$> pUniqueness <*> p
139
pDeclBase :: Parser (TypeBase shape NoUniqueness) -> Parser (TypeBase shape Uniqueness) pDeclBase p = flip toDecl <$> pUniqueness <*> p
139
pDeclBase p = flip toDecl <$> pUniqueness <*> p
47
false
true
4
6
23
57
24
33
null
null
lcycon/hs-dson
Data/DSON/Parse.hs
gpl-3.0
strP :: Parser DSON strP = fmap Str stringLiteral
49
strP :: Parser DSON strP = fmap Str stringLiteral
49
strP = fmap Str stringLiteral
29
false
true
0
5
8
19
9
10
null
null
Numberartificial/workflow
snipets/src/Craft/Calculator/CalcParseLib.hs
mit
-- -- Examples. -- bracket = token '('
70
bracket = token '('
19
bracket = token '('
19
true
false
1
5
39
15
7
8
null
null
chwthewke/horbits
src/horbits/Horbits/Data/Binding.hs
bsd-3-clause
prismToUnlawfulLens :: Prism' a b -> b -> Lens' a b prismToUnlawfulLens p b f a = fmap (p #) (f . fromMaybe b $ a ^? p)
119
prismToUnlawfulLens :: Prism' a b -> b -> Lens' a b prismToUnlawfulLens p b f a = fmap (p #) (f . fromMaybe b $ a ^? p)
119
prismToUnlawfulLens p b f a = fmap (p #) (f . fromMaybe b $ a ^? p)
67
false
true
0
10
27
65
32
33
null
null
antalsz/hs-to-coq
src/lib/HsToCoq/ConvertHaskell/Module.hs
mit
convertBinding _ (SkippedBinding name) = pure [CommentSentence . Comment $ "Skipping definition `" <> textP name <> "'"]
122
convertBinding _ (SkippedBinding name) = pure [CommentSentence . Comment $ "Skipping definition `" <> textP name <> "'"]
122
convertBinding _ (SkippedBinding name) = pure [CommentSentence . Comment $ "Skipping definition `" <> textP name <> "'"]
122
false
false
0
10
19
42
20
22
null
null
HIPERFIT/contracts
Coq/Extraction/PrettyPrinting.hs
mit
arentheses str = "(" ++ str ++ ")"
35
parentheses str = "(" ++ str ++ ")"
35
parentheses str = "(" ++ str ++ ")"
35
false
false
0
6
8
17
8
9
null
null
spechub/Hets
CSL/EPRelation.hs
gpl-2.0
modelToString :: (a -> Char) -> Model a -> String modelToString f (Model l vm) = case l of [(a, b)] -> map (f . h . (: [])) [a .. b] ++ "\n" [(a, b), (c, d)] -> let g y = map (f . (vm Map.!)) [[x, y] | x <- [a .. b]] in unlines $ map g [c .. d] [] -> "" _ -> concat ["Cannot output a ", show $ length l, "-dim model"] where err x = error $ concat [ "modelToString: elem not in map " , show x, "\n", show $ Map.keys vm ] h x = Map.findWithDefault (err x) x vm
553
modelToString :: (a -> Char) -> Model a -> String modelToString f (Model l vm) = case l of [(a, b)] -> map (f . h . (: [])) [a .. b] ++ "\n" [(a, b), (c, d)] -> let g y = map (f . (vm Map.!)) [[x, y] | x <- [a .. b]] in unlines $ map g [c .. d] [] -> "" _ -> concat ["Cannot output a ", show $ length l, "-dim model"] where err x = error $ concat [ "modelToString: elem not in map " , show x, "\n", show $ Map.keys vm ] h x = Map.findWithDefault (err x) x vm
553
modelToString f (Model l vm) = case l of [(a, b)] -> map (f . h . (: [])) [a .. b] ++ "\n" [(a, b), (c, d)] -> let g y = map (f . (vm Map.!)) [[x, y] | x <- [a .. b]] in unlines $ map g [c .. d] [] -> "" _ -> concat ["Cannot output a ", show $ length l, "-dim model"] where err x = error $ concat [ "modelToString: elem not in map " , show x, "\n", show $ Map.keys vm ] h x = Map.findWithDefault (err x) x vm
503
false
true
1
16
205
283
152
131
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/showsPrec_2.hs
mit
modMyInt :: MyInt -> MyInt -> MyInt modMyInt = primModInt
61
modMyInt :: MyInt -> MyInt -> MyInt modMyInt = primModInt
61
modMyInt = primModInt
21
false
true
0
6
13
19
10
9
null
null
hesselink/stack
src/Stack/Build/Execute.hs
bsd-3-clause
printPlan :: M env m => FinalAction -> Plan -> m () printPlan finalAction plan = do case Map.toList $ planUnregisterLocal plan of [] -> $logInfo "Nothing to unregister" xs -> do $logInfo "Would unregister locally:" forM_ xs $ \(gid, reason) -> $logInfo $ T.concat [ T.pack $ ghcPkgIdString gid , " (" , reason , ")" ] $logInfo "" case Map.elems $ planTasks plan of [] -> $logInfo "Nothing to build" xs -> do $logInfo "Would build:" mapM_ ($logInfo . displayTask) xs let mfinalLabel = case finalAction of DoNothing -> Nothing DoBenchmarks -> Just "benchmark" DoTests -> Just "test" case mfinalLabel of Nothing -> return () Just finalLabel -> do $logInfo "" case Map.toList $ planFinals plan of [] -> $logInfo $ "Nothing to " <> finalLabel xs -> do $logInfo $ "Would " <> finalLabel <> ":" forM_ xs $ \(name, _) -> $logInfo $ T.pack $ packageNameString name $logInfo "" case Map.toList $ planInstallExes plan of [] -> $logInfo "No executables to be installed" xs -> do $logInfo "Would install executables:" forM_ xs $ \(name, loc) -> $logInfo $ T.concat [ name , " from " , case loc of Snap -> "snapshot" Local -> "local" , " database" ] -- | For a dry run
1,711
printPlan :: M env m => FinalAction -> Plan -> m () printPlan finalAction plan = do case Map.toList $ planUnregisterLocal plan of [] -> $logInfo "Nothing to unregister" xs -> do $logInfo "Would unregister locally:" forM_ xs $ \(gid, reason) -> $logInfo $ T.concat [ T.pack $ ghcPkgIdString gid , " (" , reason , ")" ] $logInfo "" case Map.elems $ planTasks plan of [] -> $logInfo "Nothing to build" xs -> do $logInfo "Would build:" mapM_ ($logInfo . displayTask) xs let mfinalLabel = case finalAction of DoNothing -> Nothing DoBenchmarks -> Just "benchmark" DoTests -> Just "test" case mfinalLabel of Nothing -> return () Just finalLabel -> do $logInfo "" case Map.toList $ planFinals plan of [] -> $logInfo $ "Nothing to " <> finalLabel xs -> do $logInfo $ "Would " <> finalLabel <> ":" forM_ xs $ \(name, _) -> $logInfo $ T.pack $ packageNameString name $logInfo "" case Map.toList $ planInstallExes plan of [] -> $logInfo "No executables to be installed" xs -> do $logInfo "Would install executables:" forM_ xs $ \(name, loc) -> $logInfo $ T.concat [ name , " from " , case loc of Snap -> "snapshot" Local -> "local" , " database" ] -- | For a dry run
1,711
printPlan finalAction plan = do case Map.toList $ planUnregisterLocal plan of [] -> $logInfo "Nothing to unregister" xs -> do $logInfo "Would unregister locally:" forM_ xs $ \(gid, reason) -> $logInfo $ T.concat [ T.pack $ ghcPkgIdString gid , " (" , reason , ")" ] $logInfo "" case Map.elems $ planTasks plan of [] -> $logInfo "Nothing to build" xs -> do $logInfo "Would build:" mapM_ ($logInfo . displayTask) xs let mfinalLabel = case finalAction of DoNothing -> Nothing DoBenchmarks -> Just "benchmark" DoTests -> Just "test" case mfinalLabel of Nothing -> return () Just finalLabel -> do $logInfo "" case Map.toList $ planFinals plan of [] -> $logInfo $ "Nothing to " <> finalLabel xs -> do $logInfo $ "Would " <> finalLabel <> ":" forM_ xs $ \(name, _) -> $logInfo $ T.pack $ packageNameString name $logInfo "" case Map.toList $ planInstallExes plan of [] -> $logInfo "No executables to be installed" xs -> do $logInfo "Would install executables:" forM_ xs $ \(name, loc) -> $logInfo $ T.concat [ name , " from " , case loc of Snap -> "snapshot" Local -> "local" , " database" ] -- | For a dry run
1,629
false
true
0
21
765
464
212
252
null
null
tismith/tlisp
src/Primitives.hs
mit
isLispValProcedure (IOFunc _) = True
36
isLispValProcedure (IOFunc _) = True
36
isLispValProcedure (IOFunc _) = True
36
false
false
0
7
4
15
7
8
null
null
rueshyna/gogol
gogol-shopping-content/gen/Network/Google/Resource/Content/Orders/Returnlineitem.hs
mpl-2.0
-- | The ID of the order. oOrderId :: Lens' OrdersReturnlineitem Text oOrderId = lens _oOrderId (\ s a -> s{_oOrderId = a})
123
oOrderId :: Lens' OrdersReturnlineitem Text oOrderId = lens _oOrderId (\ s a -> s{_oOrderId = a})
97
oOrderId = lens _oOrderId (\ s a -> s{_oOrderId = a})
53
true
true
0
9
22
40
22
18
null
null
ganeti/ganeti
src/Ganeti/Hs2Py/OpDoc.hs
bsd-2-clause
opClusterSetParams :: String opClusterSetParams = "Change the parameters of the cluster.\n\ \\n\ \ @type vg_name: C{str} or C{None}\n\ \ @ivar vg_name: The new volume group name or None to disable LVM usage."
212
opClusterSetParams :: String opClusterSetParams = "Change the parameters of the cluster.\n\ \\n\ \ @type vg_name: C{str} or C{None}\n\ \ @ivar vg_name: The new volume group name or None to disable LVM usage."
212
opClusterSetParams = "Change the parameters of the cluster.\n\ \\n\ \ @type vg_name: C{str} or C{None}\n\ \ @ivar vg_name: The new volume group name or None to disable LVM usage."
183
false
true
0
4
35
11
6
5
null
null
cpettitt/tamien
Tamien/Core/Parser.hs
mit
pCase :: Parser CoreExpr pCase = Case <$> (reserved "case" *> pExpr) <*> (reserved "of" *> braces pAlts)
104
pCase :: Parser CoreExpr pCase = Case <$> (reserved "case" *> pExpr) <*> (reserved "of" *> braces pAlts)
104
pCase = Case <$> (reserved "case" *> pExpr) <*> (reserved "of" *> braces pAlts)
79
false
true
2
9
17
52
23
29
null
null
dmuneras/LambdaMethods
src/Integracion.hs
gpl-2.0
f2 :: Func --Para esta funcion probar con n = 6 que es el ejercicio del parcial f2 = FMult (FExp (FSum (FMult (FConst (-1)) (FVar 'x')) (FConst 3))) (FLn (FVar 'x'))
165
f2 :: Func f2 = FMult (FExp (FSum (FMult (FConst (-1)) (FVar 'x')) (FConst 3))) (FLn (FVar 'x'))
96
f2 = FMult (FExp (FSum (FMult (FConst (-1)) (FVar 'x')) (FConst 3))) (FLn (FVar 'x'))
85
true
true
0
15
31
80
39
41
null
null
noexc/mapview-noexc
src/KD8ZRC/Flight/NBP3/Parser.hs
mit
-- | The parser for our telemetry packets. Uses the @parsers@ package and should -- work with any supported parser combinator library. -- -- See <https://noexc.org/wiki/NBP/RTTY_Telemetry_Format_v2> for more details. parser :: (Monad m, DeltaParsing m, Errable m) => m TelemetryLine parser = do _ <- colon callsign' <- manyTill anyChar (try colon) lat' <- eitherToNum <$> integerOrDouble _ <- colon lon' <- eitherToNum <$> integerOrDouble _ <- colon altitude' <- eitherToNum <$> integerOrDouble _ <- colon time' <- many (token digit) _ <- colon voltage' <- eitherToNum <$> integerOrDouble _ <- colon crc16T <- number 16 hexDigit _ <- colon crc16C <- crcHaskell . dropWhileEnd (/= ':') . init . tail . BRC.unpack <$> line raw <- line case lat' <°> lon' of Nothing -> raiseErr $ failed "Unable to produce a Coordinate from the given lat/lon pair." Just coordinate -> do let crcConfirmation = validateCRC (TelemetryCRC crc16T) crc16C case crcConfirmation of CRCMismatch (TelemetryCRC t) (CalculatedCRC c) -> raiseErr $ failed ("CRC Mismatch: Downlink=" ++ show t ++ " Expected=" ++ show c) _ -> return $ TelemetryLine raw (T.pack callsign') coordinate altitude' (readTime defaultTimeLocale "%H%M%S" time') (rawVoltageToRealVoltage voltage') crc16T where number base baseDigit = foldl' (\x d -> base * x + toInteger (digitToInt d)) 0 <$> some baseDigit eitherToNum :: (Num b, Integral a) => Either a b -> b eitherToNum = either fromIntegral id rawVoltageToRealVoltage x = roundToN 3 ((x + 477) / 339) roundToN :: Integer -> Double -> Double roundToN n f = (fromInteger $ round $ f * (10^n)) / (10.0^^n)
1,842
parser :: (Monad m, DeltaParsing m, Errable m) => m TelemetryLine parser = do _ <- colon callsign' <- manyTill anyChar (try colon) lat' <- eitherToNum <$> integerOrDouble _ <- colon lon' <- eitherToNum <$> integerOrDouble _ <- colon altitude' <- eitherToNum <$> integerOrDouble _ <- colon time' <- many (token digit) _ <- colon voltage' <- eitherToNum <$> integerOrDouble _ <- colon crc16T <- number 16 hexDigit _ <- colon crc16C <- crcHaskell . dropWhileEnd (/= ':') . init . tail . BRC.unpack <$> line raw <- line case lat' <°> lon' of Nothing -> raiseErr $ failed "Unable to produce a Coordinate from the given lat/lon pair." Just coordinate -> do let crcConfirmation = validateCRC (TelemetryCRC crc16T) crc16C case crcConfirmation of CRCMismatch (TelemetryCRC t) (CalculatedCRC c) -> raiseErr $ failed ("CRC Mismatch: Downlink=" ++ show t ++ " Expected=" ++ show c) _ -> return $ TelemetryLine raw (T.pack callsign') coordinate altitude' (readTime defaultTimeLocale "%H%M%S" time') (rawVoltageToRealVoltage voltage') crc16T where number base baseDigit = foldl' (\x d -> base * x + toInteger (digitToInt d)) 0 <$> some baseDigit eitherToNum :: (Num b, Integral a) => Either a b -> b eitherToNum = either fromIntegral id rawVoltageToRealVoltage x = roundToN 3 ((x + 477) / 339) roundToN :: Integer -> Double -> Double roundToN n f = (fromInteger $ round $ f * (10^n)) / (10.0^^n)
1,625
parser = do _ <- colon callsign' <- manyTill anyChar (try colon) lat' <- eitherToNum <$> integerOrDouble _ <- colon lon' <- eitherToNum <$> integerOrDouble _ <- colon altitude' <- eitherToNum <$> integerOrDouble _ <- colon time' <- many (token digit) _ <- colon voltage' <- eitherToNum <$> integerOrDouble _ <- colon crc16T <- number 16 hexDigit _ <- colon crc16C <- crcHaskell . dropWhileEnd (/= ':') . init . tail . BRC.unpack <$> line raw <- line case lat' <°> lon' of Nothing -> raiseErr $ failed "Unable to produce a Coordinate from the given lat/lon pair." Just coordinate -> do let crcConfirmation = validateCRC (TelemetryCRC crc16T) crc16C case crcConfirmation of CRCMismatch (TelemetryCRC t) (CalculatedCRC c) -> raiseErr $ failed ("CRC Mismatch: Downlink=" ++ show t ++ " Expected=" ++ show c) _ -> return $ TelemetryLine raw (T.pack callsign') coordinate altitude' (readTime defaultTimeLocale "%H%M%S" time') (rawVoltageToRealVoltage voltage') crc16T where number base baseDigit = foldl' (\x d -> base * x + toInteger (digitToInt d)) 0 <$> some baseDigit eitherToNum :: (Num b, Integral a) => Either a b -> b eitherToNum = either fromIntegral id rawVoltageToRealVoltage x = roundToN 3 ((x + 477) / 339) roundToN :: Integer -> Double -> Double roundToN n f = (fromInteger $ round $ f * (10^n)) / (10.0^^n)
1,559
true
true
0
22
500
562
269
293
null
null
ditto-lang/ditto
src/Ditto/Test.hs
gpl-3.0
captureDeltaWithCoveringWithoutBinding = unlines [ "data Bool : Type where" , "| true,false : Bool" , "end" , "def capture (Bool : Bool) : Type where" , "| b = Type" , "end" ]
190
captureDeltaWithCoveringWithoutBinding = unlines [ "data Bool : Type where" , "| true,false : Bool" , "end" , "def capture (Bool : Bool) : Type where" , "| b = Type" , "end" ]
190
captureDeltaWithCoveringWithoutBinding = unlines [ "data Bool : Type where" , "| true,false : Bool" , "end" , "def capture (Bool : Bool) : Type where" , "| b = Type" , "end" ]
190
false
false
0
5
47
27
16
11
null
null
tsahyt/clingo-haskell
src/Clingo/Internal/Types.hs
mit
rawHeuT HeuristicFalse = Raw.HeuristicFalse
43
rawHeuT HeuristicFalse = Raw.HeuristicFalse
43
rawHeuT HeuristicFalse = Raw.HeuristicFalse
43
false
false
0
5
3
11
5
6
null
null
idzardh/dotfiles
xmonad.hs
gpl-3.0
-- Emit a DBus signal on log updates dbusOutput :: D.Client -> String -> IO () dbusOutput dbus str = do let signal = (D.signal objectPath interfaceName memberName) { D.signalBody = [D.toVariant $ UTF8.decodeString str] } D.emit dbus signal where objectPath = D.objectPath_ "/org/xmonad/Log" interfaceName = D.interfaceName_ "org.xmonad.Log" memberName = D.memberName_ "Update"
418
dbusOutput :: D.Client -> String -> IO () dbusOutput dbus str = do let signal = (D.signal objectPath interfaceName memberName) { D.signalBody = [D.toVariant $ UTF8.decodeString str] } D.emit dbus signal where objectPath = D.objectPath_ "/org/xmonad/Log" interfaceName = D.interfaceName_ "org.xmonad.Log" memberName = D.memberName_ "Update"
381
dbusOutput dbus str = do let signal = (D.signal objectPath interfaceName memberName) { D.signalBody = [D.toVariant $ UTF8.decodeString str] } D.emit dbus signal where objectPath = D.objectPath_ "/org/xmonad/Log" interfaceName = D.interfaceName_ "org.xmonad.Log" memberName = D.memberName_ "Update"
339
true
true
0
15
93
119
59
60
null
null
tonymorris/story-board
src/Graphics/Storyboard/Images.hs
bsd-3-clause
-- | Load an image; do not place it anywhere yet. imageTile :: MonadCanvas m => FilePath -> m (Tile ()) imageTile filePath = liftCanvas $ do -- From the canvas' point of view, we need to fix the absolute path with "/" img <- newImage ("/" <> pack filePath) return $ tile (width img, height img) $ \ (Cavity _ _) -> drawImage (img,[0,0]) -- | Load an scaled image; do not place it anywhere yet.
406
imageTile :: MonadCanvas m => FilePath -> m (Tile ()) imageTile filePath = liftCanvas $ do -- From the canvas' point of view, we need to fix the absolute path with "/" img <- newImage ("/" <> pack filePath) return $ tile (width img, height img) $ \ (Cavity _ _) -> drawImage (img,[0,0]) -- | Load an scaled image; do not place it anywhere yet.
356
imageTile filePath = liftCanvas $ do -- From the canvas' point of view, we need to fix the absolute path with "/" img <- newImage ("/" <> pack filePath) return $ tile (width img, height img) $ \ (Cavity _ _) -> drawImage (img,[0,0]) -- | Load an scaled image; do not place it anywhere yet.
302
true
true
0
12
89
117
59
58
null
null
mightymoose/liquidhaskell
docs/slides/BOS14/hs/long/RBTree-ord.hs
bsd-3-clause
balS k l (Node R y b c) = Node R k l (Node B y b c)
65
rbalS k l (Node R y b c) = Node R k l (Node B y b c)
65
rbalS k l (Node R y b c) = Node R k l (Node B y b c)
65
false
false
0
7
31
47
22
25
null
null
Teaspot-Studio/Urho3D-Haskell
src/Graphics/Urho3D/Scene/Animatable.hs
mit
animatableContext :: C.Context animatableContext = sharedAnimatablePtrCntx <> animatableCntx <> stringHashContext
114
animatableContext :: C.Context animatableContext = sharedAnimatablePtrCntx <> animatableCntx <> stringHashContext
113
animatableContext = sharedAnimatablePtrCntx <> animatableCntx <> stringHashContext
82
false
true
0
6
10
21
11
10
null
null
futufeld/eclogues
eclogues-impl/gen-hs/AuroraAdmin_Client.hs
bsd-3-clause
recv_commitRecovery ip = do (fname, mtype, rseqid) <- T.readMessageBegin ip M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn } res <- read_CommitRecovery_result ip T.readMessageEnd ip P.return $ commitRecovery_result_success res
287
recv_commitRecovery ip = do (fname, mtype, rseqid) <- T.readMessageBegin ip M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn } res <- read_CommitRecovery_result ip T.readMessageEnd ip P.return $ commitRecovery_result_success res
287
recv_commitRecovery ip = do (fname, mtype, rseqid) <- T.readMessageBegin ip M.when (mtype == T.M_EXCEPTION) $ do { exn <- T.readAppExn ip ; T.readMessageEnd ip ; X.throw exn } res <- read_CommitRecovery_result ip T.readMessageEnd ip P.return $ commitRecovery_result_success res
287
false
false
0
12
47
113
52
61
null
null
Soostone/cereal-io-streams
src/System/IO/Streams/Cereal.hs
bsd-3-clause
------------------------------------------------------------------------------- -- | Convert a 'Put' into an 'InputStream' -- -- Example: -- -- >>> putToStream (put False) putToStream :: Put -> IO (InputStream ByteString) putToStream = Streams.fromLazyByteString . runPutLazy
275
putToStream :: Put -> IO (InputStream ByteString) putToStream = Streams.fromLazyByteString . runPutLazy
103
putToStream = Streams.fromLazyByteString . runPutLazy
53
true
true
0
9
29
42
22
20
null
null
HIPERFIT/futhark
src/Futhark/CodeGen/ImpGen.hs
isc
defCompileBasicOp _ (Assert e msg loc) = do e' <- toExp e msg' <- traverse toExp msg emit $ Imp.Assert e' msg' loc attrs <- askAttrs when (AttrComp "warn" ["safety_checks"] `inAttrs` attrs) $ uncurry warn loc "Safety check required at run-time."
260
defCompileBasicOp _ (Assert e msg loc) = do e' <- toExp e msg' <- traverse toExp msg emit $ Imp.Assert e' msg' loc attrs <- askAttrs when (AttrComp "warn" ["safety_checks"] `inAttrs` attrs) $ uncurry warn loc "Safety check required at run-time."
260
defCompileBasicOp _ (Assert e msg loc) = do e' <- toExp e msg' <- traverse toExp msg emit $ Imp.Assert e' msg' loc attrs <- askAttrs when (AttrComp "warn" ["safety_checks"] `inAttrs` attrs) $ uncurry warn loc "Safety check required at run-time."
260
false
false
0
12
55
100
46
54
null
null
phischu/fragnix
tests/packages/scotty/Data.Time.Clock.POSIX.hs
bsd-3-clause
-- Use hi-res POSIX time ctimespecToPosixSeconds :: CTimespec -> POSIXTime ctimespecToPosixSeconds (MkCTimespec (CTime s) ns) = (fromIntegral s) + (fromIntegral ns) / 1000000000
181
ctimespecToPosixSeconds :: CTimespec -> POSIXTime ctimespecToPosixSeconds (MkCTimespec (CTime s) ns) = (fromIntegral s) + (fromIntegral ns) / 1000000000
156
ctimespecToPosixSeconds (MkCTimespec (CTime s) ns) = (fromIntegral s) + (fromIntegral ns) / 1000000000
106
true
true
0
9
26
53
27
26
null
null
rueshyna/gogol
gogol-translate/gen/Network/Google/Translate/Types/Product.hs
mpl-2.0
-- | The translation. trTranslatedText :: Lens' TranslationsResource (Maybe Text) trTranslatedText = lens _trTranslatedText (\ s a -> s{_trTranslatedText = a})
167
trTranslatedText :: Lens' TranslationsResource (Maybe Text) trTranslatedText = lens _trTranslatedText (\ s a -> s{_trTranslatedText = a})
145
trTranslatedText = lens _trTranslatedText (\ s a -> s{_trTranslatedText = a})
85
true
true
0
8
28
49
25
24
null
null
thaldyron/H2048
Strategy.hs
lgpl-2.1
-- | Chooses a swipe direction uniformly at random allRandom :: Strategy allRandom = mkStrategy $ \board -> do r <- getRandom return $ Just r -- | Always ask human for input
208
allRandom :: Strategy allRandom = mkStrategy $ \board -> do r <- getRandom return $ Just r -- | Always ask human for input
157
allRandom = mkStrategy $ \board -> do r <- getRandom return $ Just r -- | Always ask human for input
135
true
true
0
10
67
39
20
19
null
null
netogallo/polyvariant
src/Analysis/Algorithms/Match.hs
bsd-3-clause
match i = match' where match' sigma t1x t2x = do case (t1x,t2x) of (TBool,TBool) -> return M.empty (Forall v1 t1,Forall v2 t2) | S.sort v1 == S.sort v2 -> match' (M.insert (S.name v2) (S.sort v2) sigma) t1 t2 (Arr t1 phi (Ann t2 psi2), Arr t1' (eff@(E.mApp -> Just (_,_))) (Ann t2' (bs@(A.App _ _)))) | t1 == t1' -> let (d0,xs') = getChis eff mkVar v = S.Var v $ (\(Just w_1919) -> w_1919) $ M.lookup v sigma xs = map mkVar xs' d0Rep = foldr (\v s -> E.Abs v s) phi xs (b0,bs') = getBetas bs betas = map mkVar bs' b0Rep = foldr (\v s -> A.Abs v s) psi2 betas in M.union (M.fromList [(d0,Right d0Rep),(b0,Left b0Rep)]) <$> match' sigma t2 t2' _ -> throwError $ Failure i [ C1 "Cannot match the types: ", C4 t1x, C1 " and ", C4 t2x]
918
match i = match' where match' sigma t1x t2x = do case (t1x,t2x) of (TBool,TBool) -> return M.empty (Forall v1 t1,Forall v2 t2) | S.sort v1 == S.sort v2 -> match' (M.insert (S.name v2) (S.sort v2) sigma) t1 t2 (Arr t1 phi (Ann t2 psi2), Arr t1' (eff@(E.mApp -> Just (_,_))) (Ann t2' (bs@(A.App _ _)))) | t1 == t1' -> let (d0,xs') = getChis eff mkVar v = S.Var v $ (\(Just w_1919) -> w_1919) $ M.lookup v sigma xs = map mkVar xs' d0Rep = foldr (\v s -> E.Abs v s) phi xs (b0,bs') = getBetas bs betas = map mkVar bs' b0Rep = foldr (\v s -> A.Abs v s) psi2 betas in M.union (M.fromList [(d0,Right d0Rep),(b0,Left b0Rep)]) <$> match' sigma t2 t2' _ -> throwError $ Failure i [ C1 "Cannot match the types: ", C4 t1x, C1 " and ", C4 t2x]
918
match i = match' where match' sigma t1x t2x = do case (t1x,t2x) of (TBool,TBool) -> return M.empty (Forall v1 t1,Forall v2 t2) | S.sort v1 == S.sort v2 -> match' (M.insert (S.name v2) (S.sort v2) sigma) t1 t2 (Arr t1 phi (Ann t2 psi2), Arr t1' (eff@(E.mApp -> Just (_,_))) (Ann t2' (bs@(A.App _ _)))) | t1 == t1' -> let (d0,xs') = getChis eff mkVar v = S.Var v $ (\(Just w_1919) -> w_1919) $ M.lookup v sigma xs = map mkVar xs' d0Rep = foldr (\v s -> E.Abs v s) phi xs (b0,bs') = getBetas bs betas = map mkVar bs' b0Rep = foldr (\v s -> A.Abs v s) psi2 betas in M.union (M.fromList [(d0,Right d0Rep),(b0,Left b0Rep)]) <$> match' sigma t2 t2' _ -> throwError $ Failure i [ C1 "Cannot match the types: ", C4 t1x, C1 " and ", C4 t2x]
918
false
false
1
21
335
472
234
238
null
null
netvl/alpmhs
lib/Distribution/ArchLinux/Libalpm/Wrapper/TH.hs
bsd-3-clause
-- | Generate a record value containing 'Nothing' values in all its fields given record type name. generateEmptyRecord :: String -- ^ A name for the record value -> Name -- ^ A name of record type -> Name -- ^ A name of record value constructor -> Q [Dec] generateEmptyRecord (mkName -> declname) recname conname = do TyConI (DataD _ _ _ ctors _) <- reify recname let (ctor:_) = filter ((== conname) . ctorName) ctors return $ [generateRecordEmptyDecl declname ctor] where ctorName (RecC name _) = name
578
generateEmptyRecord :: String -- ^ A name for the record value -> Name -- ^ A name of record type -> Name -- ^ A name of record value constructor -> Q [Dec] generateEmptyRecord (mkName -> declname) recname conname = do TyConI (DataD _ _ _ ctors _) <- reify recname let (ctor:_) = filter ((== conname) . ctorName) ctors return $ [generateRecordEmptyDecl declname ctor] where ctorName (RecC name _) = name
479
generateEmptyRecord (mkName -> declname) recname conname = do TyConI (DataD _ _ _ ctors _) <- reify recname let (ctor:_) = filter ((== conname) . ctorName) ctors return $ [generateRecordEmptyDecl declname ctor] where ctorName (RecC name _) = name
258
true
true
0
13
164
147
72
75
null
null
alanz/haskell-lsp
lsp-types/src/Language/LSP/Types/Capabilities.hs
mit
-- ^ Construct a major.minor version -- | Capabilities for full conformance to the LSP specification up until a version. -- Some important milestones: -- -- * 3.12 textDocument/prepareRename request -- * 3.11 CodeActionOptions provided by the server -- * 3.10 hierarchical document symbols, folding ranges -- * 3.9 completion item preselect -- * 3.8 codeAction literals -- * 3.7 related information in diagnostics -- * 3.6 workspace folders, colors, goto type/implementation -- * 3.4 extended completion item and symbol item kinds -- * 3.0 dynamic registration capsForVersion :: LSPVersion -> ClientCapabilities capsForVersion (LSPVersion maj min) = ClientCapabilities (Just w) (Just td) (Just window) Nothing where w = WorkspaceClientCapabilities (Just True) (Just (WorkspaceEditClientCapabilities (Just True) (since 3 13 resourceOperations) Nothing (since 3 16 True) (since 3 16 (WorkspaceEditChangeAnnotationClientCapabilities (Just True))))) (Just (DidChangeConfigurationClientCapabilities dynamicReg)) (Just (DidChangeWatchedFilesClientCapabilities dynamicReg)) (Just symbolCapabilities) (Just (ExecuteCommandClientCapabilities dynamicReg)) (since 3 6 True) (since 3 6 True) resourceOperations = List [ ResourceOperationCreate , ResourceOperationDelete , ResourceOperationRename ] symbolCapabilities = WorkspaceSymbolClientCapabilities dynamicReg (since 3 4 symbolKindCapabilities) (since 3 16 symbolTagCapabilities) symbolKindCapabilities = WorkspaceSymbolKindClientCapabilities (Just sKs) symbolTagCapabilities = WorkspaceSymbolTagClientCapabilities (Just (List [StDeprecated])) sKs | maj >= 3 && min >= 4 = List (oldSKs ++ newSKs) | otherwise = List oldSKs oldSKs = [ SkFile , SkModule , SkNamespace , SkPackage , SkClass , SkMethod , SkProperty , SkField , SkConstructor , SkEnum , SkInterface , SkFunction , SkVariable , SkConstant , SkString , SkNumber , SkBoolean , SkArray ] newSKs = [ SkObject , SkKey , SkNull , SkEnumMember , SkStruct , SkEvent , SkOperator , SkTypeParameter ] td = TextDocumentClientCapabilities (Just sync) (Just completionCapability) (Just hoverCapability) (Just signatureHelpCapability) (Just (ReferencesClientCapabilities dynamicReg)) (Just (DocumentHighlightClientCapabilities dynamicReg)) (Just documentSymbolCapability) (Just (DocumentFormattingClientCapabilities dynamicReg)) (Just (DocumentRangeFormattingClientCapabilities dynamicReg)) (Just (DocumentOnTypeFormattingClientCapabilities dynamicReg)) (since 3 14 (DeclarationClientCapabilities dynamicReg (Just True))) (Just (DefinitionClientCapabilities dynamicReg (since 3 14 True))) (since 3 6 (TypeDefinitionClientCapabilities dynamicReg (since 3 14 True))) (since 3 6 (ImplementationClientCapabilities dynamicReg (since 3 14 True))) (Just codeActionCapability) (Just (CodeLensClientCapabilities dynamicReg)) (Just (DocumentLinkClientCapabilities dynamicReg (since 3 15 True))) (since 3 6 (DocumentColorClientCapabilities dynamicReg)) (Just (RenameClientCapabilities dynamicReg (since 3 12 True) (since 3 16 PsIdentifier) (since 3 16 True))) (Just publishDiagnosticsCapabilities) (since 3 10 foldingRangeCapability) (since 3 5 (SelectionRangeClientCapabilities dynamicReg)) sync = TextDocumentSyncClientCapabilities dynamicReg (Just True) (Just True) (Just True) completionCapability = CompletionClientCapabilities dynamicReg (Just completionItemCapabilities) (since 3 4 completionItemKindCapabilities) (since 3 3 True) completionItemCapabilities = CompletionItemClientCapabilities (Just True) (Just True) (since 3 3 (List [MkPlainText, MkMarkdown])) (Just True) (since 3 9 True) (since 3 15 completionItemTagsCapabilities) (since 3 16 True) (since 3 16 (CompletionItemResolveClientCapabilities (List ["documentation", "details"]))) (since 3 16 (CompletionItemInsertTextModeClientCapabilities (List []))) completionItemKindCapabilities = CompletionItemKindClientCapabilities (Just ciKs) completionItemTagsCapabilities = CompletionItemTagsClientCapabilities (List [ CitDeprecated ]) ciKs | maj >= 3 && min >= 4 = List (oldCiKs ++ newCiKs) | otherwise = List oldCiKs oldCiKs = [ CiText , CiMethod , CiFunction , CiConstructor , CiField , CiVariable , CiClass , CiInterface , CiModule , CiProperty , CiUnit , CiValue , CiEnum , CiKeyword , CiSnippet , CiColor , CiFile , CiReference ] newCiKs = [ CiFolder , CiEnumMember , CiConstant , CiStruct , CiEvent , CiOperator , CiTypeParameter ] hoverCapability = HoverClientCapabilities dynamicReg (since 3 3 (List [MkPlainText, MkMarkdown])) codeActionCapability = CodeActionClientCapabilities dynamicReg (since 3 8 (CodeActionLiteralSupport caKs)) (since 3 15 True) (since 3 16 True) (since 3 16 True) (since 3 16 (CodeActionResolveClientCapabilities (List []))) (since 3 16 True) caKs = CodeActionKindClientCapabilities (List [ CodeActionQuickFix , CodeActionRefactor , CodeActionRefactorExtract , CodeActionRefactorInline , CodeActionRefactorRewrite , CodeActionSource , CodeActionSourceOrganizeImports ]) signatureHelpCapability = SignatureHelpClientCapabilities dynamicReg (Just signatureInformationCapability) Nothing signatureInformationCapability = SignatureHelpSignatureInformation (Just (List [MkPlainText, MkMarkdown])) (Just signatureParameterCapability) (since 3 16 True) signatureParameterCapability = SignatureHelpParameterInformation (since 3 14 True) documentSymbolCapability = DocumentSymbolClientCapabilities dynamicReg (since 3 4 documentSymbolKind) (since 3 10 True) (since 3 16 documentSymbolTag) (since 3 16 True) documentSymbolKind = DocumentSymbolKindClientCapabilities (Just sKs) -- same as workspace symbol kinds documentSymbolTag = DocumentSymbolTagClientCapabilities (Just (List [StDeprecated])) foldingRangeCapability = FoldingRangeClientCapabilities dynamicReg Nothing (Just False) publishDiagnosticsCapabilities = PublishDiagnosticsClientCapabilities (since 3 7 True) (since 3 15 publishDiagnosticsTagsCapabilities) (since 3 15 True) publishDiagnosticsTagsCapabilities = PublishDiagnosticsTagsClientCapabilities (List [ DtUnnecessary, DtDeprecated ]) dynamicReg | maj >= 3 = Just True | otherwise = Nothing since x y a | maj >= x && min >= y = Just a | otherwise = Nothing window = WindowClientCapabilities (since 3 15 True)
8,266
capsForVersion :: LSPVersion -> ClientCapabilities capsForVersion (LSPVersion maj min) = ClientCapabilities (Just w) (Just td) (Just window) Nothing where w = WorkspaceClientCapabilities (Just True) (Just (WorkspaceEditClientCapabilities (Just True) (since 3 13 resourceOperations) Nothing (since 3 16 True) (since 3 16 (WorkspaceEditChangeAnnotationClientCapabilities (Just True))))) (Just (DidChangeConfigurationClientCapabilities dynamicReg)) (Just (DidChangeWatchedFilesClientCapabilities dynamicReg)) (Just symbolCapabilities) (Just (ExecuteCommandClientCapabilities dynamicReg)) (since 3 6 True) (since 3 6 True) resourceOperations = List [ ResourceOperationCreate , ResourceOperationDelete , ResourceOperationRename ] symbolCapabilities = WorkspaceSymbolClientCapabilities dynamicReg (since 3 4 symbolKindCapabilities) (since 3 16 symbolTagCapabilities) symbolKindCapabilities = WorkspaceSymbolKindClientCapabilities (Just sKs) symbolTagCapabilities = WorkspaceSymbolTagClientCapabilities (Just (List [StDeprecated])) sKs | maj >= 3 && min >= 4 = List (oldSKs ++ newSKs) | otherwise = List oldSKs oldSKs = [ SkFile , SkModule , SkNamespace , SkPackage , SkClass , SkMethod , SkProperty , SkField , SkConstructor , SkEnum , SkInterface , SkFunction , SkVariable , SkConstant , SkString , SkNumber , SkBoolean , SkArray ] newSKs = [ SkObject , SkKey , SkNull , SkEnumMember , SkStruct , SkEvent , SkOperator , SkTypeParameter ] td = TextDocumentClientCapabilities (Just sync) (Just completionCapability) (Just hoverCapability) (Just signatureHelpCapability) (Just (ReferencesClientCapabilities dynamicReg)) (Just (DocumentHighlightClientCapabilities dynamicReg)) (Just documentSymbolCapability) (Just (DocumentFormattingClientCapabilities dynamicReg)) (Just (DocumentRangeFormattingClientCapabilities dynamicReg)) (Just (DocumentOnTypeFormattingClientCapabilities dynamicReg)) (since 3 14 (DeclarationClientCapabilities dynamicReg (Just True))) (Just (DefinitionClientCapabilities dynamicReg (since 3 14 True))) (since 3 6 (TypeDefinitionClientCapabilities dynamicReg (since 3 14 True))) (since 3 6 (ImplementationClientCapabilities dynamicReg (since 3 14 True))) (Just codeActionCapability) (Just (CodeLensClientCapabilities dynamicReg)) (Just (DocumentLinkClientCapabilities dynamicReg (since 3 15 True))) (since 3 6 (DocumentColorClientCapabilities dynamicReg)) (Just (RenameClientCapabilities dynamicReg (since 3 12 True) (since 3 16 PsIdentifier) (since 3 16 True))) (Just publishDiagnosticsCapabilities) (since 3 10 foldingRangeCapability) (since 3 5 (SelectionRangeClientCapabilities dynamicReg)) sync = TextDocumentSyncClientCapabilities dynamicReg (Just True) (Just True) (Just True) completionCapability = CompletionClientCapabilities dynamicReg (Just completionItemCapabilities) (since 3 4 completionItemKindCapabilities) (since 3 3 True) completionItemCapabilities = CompletionItemClientCapabilities (Just True) (Just True) (since 3 3 (List [MkPlainText, MkMarkdown])) (Just True) (since 3 9 True) (since 3 15 completionItemTagsCapabilities) (since 3 16 True) (since 3 16 (CompletionItemResolveClientCapabilities (List ["documentation", "details"]))) (since 3 16 (CompletionItemInsertTextModeClientCapabilities (List []))) completionItemKindCapabilities = CompletionItemKindClientCapabilities (Just ciKs) completionItemTagsCapabilities = CompletionItemTagsClientCapabilities (List [ CitDeprecated ]) ciKs | maj >= 3 && min >= 4 = List (oldCiKs ++ newCiKs) | otherwise = List oldCiKs oldCiKs = [ CiText , CiMethod , CiFunction , CiConstructor , CiField , CiVariable , CiClass , CiInterface , CiModule , CiProperty , CiUnit , CiValue , CiEnum , CiKeyword , CiSnippet , CiColor , CiFile , CiReference ] newCiKs = [ CiFolder , CiEnumMember , CiConstant , CiStruct , CiEvent , CiOperator , CiTypeParameter ] hoverCapability = HoverClientCapabilities dynamicReg (since 3 3 (List [MkPlainText, MkMarkdown])) codeActionCapability = CodeActionClientCapabilities dynamicReg (since 3 8 (CodeActionLiteralSupport caKs)) (since 3 15 True) (since 3 16 True) (since 3 16 True) (since 3 16 (CodeActionResolveClientCapabilities (List []))) (since 3 16 True) caKs = CodeActionKindClientCapabilities (List [ CodeActionQuickFix , CodeActionRefactor , CodeActionRefactorExtract , CodeActionRefactorInline , CodeActionRefactorRewrite , CodeActionSource , CodeActionSourceOrganizeImports ]) signatureHelpCapability = SignatureHelpClientCapabilities dynamicReg (Just signatureInformationCapability) Nothing signatureInformationCapability = SignatureHelpSignatureInformation (Just (List [MkPlainText, MkMarkdown])) (Just signatureParameterCapability) (since 3 16 True) signatureParameterCapability = SignatureHelpParameterInformation (since 3 14 True) documentSymbolCapability = DocumentSymbolClientCapabilities dynamicReg (since 3 4 documentSymbolKind) (since 3 10 True) (since 3 16 documentSymbolTag) (since 3 16 True) documentSymbolKind = DocumentSymbolKindClientCapabilities (Just sKs) -- same as workspace symbol kinds documentSymbolTag = DocumentSymbolTagClientCapabilities (Just (List [StDeprecated])) foldingRangeCapability = FoldingRangeClientCapabilities dynamicReg Nothing (Just False) publishDiagnosticsCapabilities = PublishDiagnosticsClientCapabilities (since 3 7 True) (since 3 15 publishDiagnosticsTagsCapabilities) (since 3 15 True) publishDiagnosticsTagsCapabilities = PublishDiagnosticsTagsClientCapabilities (List [ DtUnnecessary, DtDeprecated ]) dynamicReg | maj >= 3 = Just True | otherwise = Nothing since x y a | maj >= x && min >= y = Just a | otherwise = Nothing window = WindowClientCapabilities (since 3 15 True)
7,704
capsForVersion (LSPVersion maj min) = ClientCapabilities (Just w) (Just td) (Just window) Nothing where w = WorkspaceClientCapabilities (Just True) (Just (WorkspaceEditClientCapabilities (Just True) (since 3 13 resourceOperations) Nothing (since 3 16 True) (since 3 16 (WorkspaceEditChangeAnnotationClientCapabilities (Just True))))) (Just (DidChangeConfigurationClientCapabilities dynamicReg)) (Just (DidChangeWatchedFilesClientCapabilities dynamicReg)) (Just symbolCapabilities) (Just (ExecuteCommandClientCapabilities dynamicReg)) (since 3 6 True) (since 3 6 True) resourceOperations = List [ ResourceOperationCreate , ResourceOperationDelete , ResourceOperationRename ] symbolCapabilities = WorkspaceSymbolClientCapabilities dynamicReg (since 3 4 symbolKindCapabilities) (since 3 16 symbolTagCapabilities) symbolKindCapabilities = WorkspaceSymbolKindClientCapabilities (Just sKs) symbolTagCapabilities = WorkspaceSymbolTagClientCapabilities (Just (List [StDeprecated])) sKs | maj >= 3 && min >= 4 = List (oldSKs ++ newSKs) | otherwise = List oldSKs oldSKs = [ SkFile , SkModule , SkNamespace , SkPackage , SkClass , SkMethod , SkProperty , SkField , SkConstructor , SkEnum , SkInterface , SkFunction , SkVariable , SkConstant , SkString , SkNumber , SkBoolean , SkArray ] newSKs = [ SkObject , SkKey , SkNull , SkEnumMember , SkStruct , SkEvent , SkOperator , SkTypeParameter ] td = TextDocumentClientCapabilities (Just sync) (Just completionCapability) (Just hoverCapability) (Just signatureHelpCapability) (Just (ReferencesClientCapabilities dynamicReg)) (Just (DocumentHighlightClientCapabilities dynamicReg)) (Just documentSymbolCapability) (Just (DocumentFormattingClientCapabilities dynamicReg)) (Just (DocumentRangeFormattingClientCapabilities dynamicReg)) (Just (DocumentOnTypeFormattingClientCapabilities dynamicReg)) (since 3 14 (DeclarationClientCapabilities dynamicReg (Just True))) (Just (DefinitionClientCapabilities dynamicReg (since 3 14 True))) (since 3 6 (TypeDefinitionClientCapabilities dynamicReg (since 3 14 True))) (since 3 6 (ImplementationClientCapabilities dynamicReg (since 3 14 True))) (Just codeActionCapability) (Just (CodeLensClientCapabilities dynamicReg)) (Just (DocumentLinkClientCapabilities dynamicReg (since 3 15 True))) (since 3 6 (DocumentColorClientCapabilities dynamicReg)) (Just (RenameClientCapabilities dynamicReg (since 3 12 True) (since 3 16 PsIdentifier) (since 3 16 True))) (Just publishDiagnosticsCapabilities) (since 3 10 foldingRangeCapability) (since 3 5 (SelectionRangeClientCapabilities dynamicReg)) sync = TextDocumentSyncClientCapabilities dynamicReg (Just True) (Just True) (Just True) completionCapability = CompletionClientCapabilities dynamicReg (Just completionItemCapabilities) (since 3 4 completionItemKindCapabilities) (since 3 3 True) completionItemCapabilities = CompletionItemClientCapabilities (Just True) (Just True) (since 3 3 (List [MkPlainText, MkMarkdown])) (Just True) (since 3 9 True) (since 3 15 completionItemTagsCapabilities) (since 3 16 True) (since 3 16 (CompletionItemResolveClientCapabilities (List ["documentation", "details"]))) (since 3 16 (CompletionItemInsertTextModeClientCapabilities (List []))) completionItemKindCapabilities = CompletionItemKindClientCapabilities (Just ciKs) completionItemTagsCapabilities = CompletionItemTagsClientCapabilities (List [ CitDeprecated ]) ciKs | maj >= 3 && min >= 4 = List (oldCiKs ++ newCiKs) | otherwise = List oldCiKs oldCiKs = [ CiText , CiMethod , CiFunction , CiConstructor , CiField , CiVariable , CiClass , CiInterface , CiModule , CiProperty , CiUnit , CiValue , CiEnum , CiKeyword , CiSnippet , CiColor , CiFile , CiReference ] newCiKs = [ CiFolder , CiEnumMember , CiConstant , CiStruct , CiEvent , CiOperator , CiTypeParameter ] hoverCapability = HoverClientCapabilities dynamicReg (since 3 3 (List [MkPlainText, MkMarkdown])) codeActionCapability = CodeActionClientCapabilities dynamicReg (since 3 8 (CodeActionLiteralSupport caKs)) (since 3 15 True) (since 3 16 True) (since 3 16 True) (since 3 16 (CodeActionResolveClientCapabilities (List []))) (since 3 16 True) caKs = CodeActionKindClientCapabilities (List [ CodeActionQuickFix , CodeActionRefactor , CodeActionRefactorExtract , CodeActionRefactorInline , CodeActionRefactorRewrite , CodeActionSource , CodeActionSourceOrganizeImports ]) signatureHelpCapability = SignatureHelpClientCapabilities dynamicReg (Just signatureInformationCapability) Nothing signatureInformationCapability = SignatureHelpSignatureInformation (Just (List [MkPlainText, MkMarkdown])) (Just signatureParameterCapability) (since 3 16 True) signatureParameterCapability = SignatureHelpParameterInformation (since 3 14 True) documentSymbolCapability = DocumentSymbolClientCapabilities dynamicReg (since 3 4 documentSymbolKind) (since 3 10 True) (since 3 16 documentSymbolTag) (since 3 16 True) documentSymbolKind = DocumentSymbolKindClientCapabilities (Just sKs) -- same as workspace symbol kinds documentSymbolTag = DocumentSymbolTagClientCapabilities (Just (List [StDeprecated])) foldingRangeCapability = FoldingRangeClientCapabilities dynamicReg Nothing (Just False) publishDiagnosticsCapabilities = PublishDiagnosticsClientCapabilities (since 3 7 True) (since 3 15 publishDiagnosticsTagsCapabilities) (since 3 15 True) publishDiagnosticsTagsCapabilities = PublishDiagnosticsTagsClientCapabilities (List [ DtUnnecessary, DtDeprecated ]) dynamicReg | maj >= 3 = Just True | otherwise = Nothing since x y a | maj >= x && min >= y = Just a | otherwise = Nothing window = WindowClientCapabilities (since 3 15 True)
7,653
true
true
20
14
2,777
1,842
902
940
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/topic/network/zeromq/src/ZMQ.hs
unlicense
mkNewConnections :: ConnectionCache Address (Socket z Push) -> [Address] -> ZMQ z ([Address], [(Address, Socket z Push)], ConnectionCache Address (Socket z Push)) mkNewConnections (ConnectionCache !m0) !addrs = do (!absent, !present, !m) <- foldM go ([], [], m0) addrs pure $! (absent, present, ConnectionCache m) where go (!ab, !p, !m) !address = do !s <- socket Push void (connect s address) pure $! (ab, (address, s):p, Map.insert address s m)
471
mkNewConnections :: ConnectionCache Address (Socket z Push) -> [Address] -> ZMQ z ([Address], [(Address, Socket z Push)], ConnectionCache Address (Socket z Push)) mkNewConnections (ConnectionCache !m0) !addrs = do (!absent, !present, !m) <- foldM go ([], [], m0) addrs pure $! (absent, present, ConnectionCache m) where go (!ab, !p, !m) !address = do !s <- socket Push void (connect s address) pure $! (ab, (address, s):p, Map.insert address s m)
471
mkNewConnections (ConnectionCache !m0) !addrs = do (!absent, !present, !m) <- foldM go ([], [], m0) addrs pure $! (absent, present, ConnectionCache m) where go (!ab, !p, !m) !address = do !s <- socket Push void (connect s address) pure $! (ab, (address, s):p, Map.insert address s m)
302
false
true
0
13
93
242
121
121
null
null
frp-arduino/frp-arduino
src/Arduino/DSL.hs
gpl-3.0
writeWord :: String -> LLI DAG.Word -> LLI a -> LLI a writeWord register value next = LLI $ DAG.WriteWord register (unLLI value) (unLLI next)
141
writeWord :: String -> LLI DAG.Word -> LLI a -> LLI a writeWord register value next = LLI $ DAG.WriteWord register (unLLI value) (unLLI next)
141
writeWord register value next = LLI $ DAG.WriteWord register (unLLI value) (unLLI next)
87
false
true
0
9
24
70
32
38
null
null
benmos/pathtype
System/Path/Internal.hs
bsd-3-clause
- I don't think this basic type of fold is appropriate for a nested datatype -- pathFold :: a -> (a -> String -> a) -> Path ar fd -> a -- pathFold pr f PathRoot = pr -- pathFold pr f (FileDir d pc) = f (pathFold pr f d) (unPathComponent pc) -- | Map over the components of the path. -- -- >> pathMap (map toLower) "/tmp/Reports/SpreadSheets" == "/tmp/reports/spreadsheets" pathMap :: (String -> String) -> Path ar fd -> Path ar fd pathMap f PathRoot = PathRoot
462
pathMap :: (String -> String) -> Path ar fd -> Path ar fd pathMap f PathRoot = PathRoot
87
pathMap f PathRoot = PathRoot
29
true
true
0
7
90
84
42
42
null
null
karamellpelle/grid
source/Game/Values/Fancy.hs
gpl-3.0
valueSoundSceneNoisePitchMax :: Float valueSoundSceneNoisePitchMax = 1.8
72
valueSoundSceneNoisePitchMax :: Float valueSoundSceneNoisePitchMax = 1.8
72
valueSoundSceneNoisePitchMax = 1.8
34
false
true
0
4
5
11
6
5
null
null
cryptica/slapnet
src/Solver/BooleanTransitionInvariant.hs
gpl-3.0
finalInvariantConstraints :: SBMap Transition -> SBool finalInvariantConstraints x = bOr $ vals x
97
finalInvariantConstraints :: SBMap Transition -> SBool finalInvariantConstraints x = bOr $ vals x
97
finalInvariantConstraints x = bOr $ vals x
42
false
true
0
6
12
28
13
15
null
null
btmura/b1
src/B1/Graphics/Rendering/OpenGL/BufferManager.hs
bsd-3-clause
recycleBuffer :: BufferManager -> BufferObject -> IO () recycleBuffer (BufferManager freeBuffersRef) bufferObject = do bindBuffer ArrayBuffer $= Just bufferObject (size, _, _) <- get $ bufferData ArrayBuffer bindBuffer ArrayBuffer $= Nothing putTraceMsg $ "Recycling buffer: " ++ show bufferObject ++ " Size: " ++ show size let newBuffer = Buffer bufferObject $ fromIntegral size modifyIORef freeBuffersRef (\freeBuffers -> insert newBuffer freeBuffers)
472
recycleBuffer :: BufferManager -> BufferObject -> IO () recycleBuffer (BufferManager freeBuffersRef) bufferObject = do bindBuffer ArrayBuffer $= Just bufferObject (size, _, _) <- get $ bufferData ArrayBuffer bindBuffer ArrayBuffer $= Nothing putTraceMsg $ "Recycling buffer: " ++ show bufferObject ++ " Size: " ++ show size let newBuffer = Buffer bufferObject $ fromIntegral size modifyIORef freeBuffersRef (\freeBuffers -> insert newBuffer freeBuffers)
472
recycleBuffer (BufferManager freeBuffersRef) bufferObject = do bindBuffer ArrayBuffer $= Just bufferObject (size, _, _) <- get $ bufferData ArrayBuffer bindBuffer ArrayBuffer $= Nothing putTraceMsg $ "Recycling buffer: " ++ show bufferObject ++ " Size: " ++ show size let newBuffer = Buffer bufferObject $ fromIntegral size modifyIORef freeBuffersRef (\freeBuffers -> insert newBuffer freeBuffers)
416
false
true
0
11
79
146
67
79
null
null
marcinmrotek/hsqml-transient
src/Graphics/QML/Transient/Property.hs
gpl-3.0
propertySelf :: String -> Build () -- ^A self referencing field, useful for connecting signals in QML. propertySelf name = addMember $ defPropertyConst' name return
167
propertySelf :: String -> Build () propertySelf name = addMember $ defPropertyConst' name return
99
propertySelf name = addMember $ defPropertyConst' name return
61
true
true
0
8
27
37
17
20
null
null
kubkon/gnuplot
src/Graphics/Gnuplot/Private/FrameOption.hs
bsd-3-clause
pm3d :: String -> T; pm3d = Cons "pm3d"
45
pm3d :: String -> T pm3d = Cons "pm3d"
44
pm3d = Cons "pm3d"
21
false
true
0
5
14
19
10
9
null
null
dmjio/lifted-async
src/Control/Concurrent/Async/Lifted/Safe.hs
bsd-3-clause
-- | Generalized version of 'A.waitAnyCatch'. waitAnyCatch :: forall m a. (MonadBaseControl IO m, Forall (Pure m)) => [Async a] -> m (Async a, Either SomeException a) waitAnyCatch = Unsafe.waitAnyCatch \\ (inst :: Forall (Pure m) :- Pure m a)
250
waitAnyCatch :: forall m a. (MonadBaseControl IO m, Forall (Pure m)) => [Async a] -> m (Async a, Either SomeException a) waitAnyCatch = Unsafe.waitAnyCatch \\ (inst :: Forall (Pure m) :- Pure m a)
204
waitAnyCatch = Unsafe.waitAnyCatch \\ (inst :: Forall (Pure m) :- Pure m a)
77
true
true
1
11
47
105
53
52
null
null
ke00n/alabno
backend/complexity_analyser/testFiles/MP/student/MP.hs
mit
expand :: FileContents -> FileContents -> FileContents expand [] _ = []
71
expand :: FileContents -> FileContents -> FileContents expand [] _ = []
71
expand [] _ = []
16
false
true
0
6
11
33
15
18
null
null
josuf107/Adverb
Adverb/Common.hs
gpl-3.0
quaveringly = id
16
quaveringly = id
16
quaveringly = id
16
false
false
0
4
2
6
3
3
null
null
Raveline/FQuoter
lib/FQuoter/Serialize/SerializedTypes.hs
gpl-3.0
unsqlizeST DBAuthor _ = error "SQL error, result array not fitting for author."
79
unsqlizeST DBAuthor _ = error "SQL error, result array not fitting for author."
79
unsqlizeST DBAuthor _ = error "SQL error, result array not fitting for author."
79
false
false
0
4
12
16
6
10
null
null
sinelaw/buildsome
src/Lib/Once.hs
gpl-2.0
once :: IO (IO a -> IO (Maybe a)) once = do doneRef <- newIORef False return $ \act -> join $ atomicModifyIORef doneRef $ \x -> (True, f x act) where f False = fmap Just f True = const (return Nothing)
215
once :: IO (IO a -> IO (Maybe a)) once = do doneRef <- newIORef False return $ \act -> join $ atomicModifyIORef doneRef $ \x -> (True, f x act) where f False = fmap Just f True = const (return Nothing)
215
once = do doneRef <- newIORef False return $ \act -> join $ atomicModifyIORef doneRef $ \x -> (True, f x act) where f False = fmap Just f True = const (return Nothing)
181
false
true
0
12
56
113
54
59
null
null
castaway/pandoc
src/Text/Pandoc/Readers/Markdown.hs
gpl-2.0
strong :: GenParser Char ParserState Inline strong = Strong `liftM` nested (inlinesBetween starStart starEnd <|> inlinesBetween ulStart ulEnd) where starStart = string "**" >> lookAhead nonspaceChar starEnd = try $ string "**" ulStart = string "__" >> lookAhead nonspaceChar ulEnd = try $ string "__"
344
strong :: GenParser Char ParserState Inline strong = Strong `liftM` nested (inlinesBetween starStart starEnd <|> inlinesBetween ulStart ulEnd) where starStart = string "**" >> lookAhead nonspaceChar starEnd = try $ string "**" ulStart = string "__" >> lookAhead nonspaceChar ulEnd = try $ string "__"
344
strong = Strong `liftM` nested (inlinesBetween starStart starEnd <|> inlinesBetween ulStart ulEnd) where starStart = string "**" >> lookAhead nonspaceChar starEnd = try $ string "**" ulStart = string "__" >> lookAhead nonspaceChar ulEnd = try $ string "__"
300
false
true
3
9
88
103
49
54
null
null
ku-fpg/boolean-tf
src/Control/Boolean.hs
bsd-3-clause
boolean :: IfB a => a -> a -> BooleanOf a -> a boolean t e bool = ifB bool t e
78
boolean :: IfB a => a -> a -> BooleanOf a -> a boolean t e bool = ifB bool t e
78
boolean t e bool = ifB bool t e
31
false
true
0
10
21
55
23
32
null
null
andorp/bead
src/Bead/Persistence/NoSQLDir.hs
bsd-3-clause
assessmentDirPath :: AssessmentKey -> FilePath assessmentDirPath (AssessmentKey e) = joinPath [assessmentDataDir, e]
116
assessmentDirPath :: AssessmentKey -> FilePath assessmentDirPath (AssessmentKey e) = joinPath [assessmentDataDir, e]
116
assessmentDirPath (AssessmentKey e) = joinPath [assessmentDataDir, e]
69
false
true
0
7
11
33
17
16
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/course/2013-11-coursera-fp-odersky-but-in-haskell/FP03ObjSetsTweetSet.hs
unlicense
foreach :: TweetSet -> (Tweet -> IO ()) -> IO () foreach Empty _ = return ()
87
foreach :: TweetSet -> (Tweet -> IO ()) -> IO () foreach Empty _ = return ()
87
foreach Empty _ = return ()
38
false
true
0
10
27
51
23
28
null
null
danr/hipspec
testsuite/prod/zeno_version/PropT17.hs
gpl-3.0
intersect,union :: [Nat] -> [Nat] -> [Nat] (x:xs) `intersect` ys | x `elem` ys = x:(xs `intersect` ys) | otherwise = xs `intersect` ys
156
intersect,union :: [Nat] -> [Nat] -> [Nat] (x:xs) `intersect` ys | x `elem` ys = x:(xs `intersect` ys) | otherwise = xs `intersect` ys
156
(x:xs) `intersect` ys | x `elem` ys = x:(xs `intersect` ys) | otherwise = xs `intersect` ys
113
false
true
2
8
45
90
48
42
null
null
ryantrinkle/ghcjs
src/Gen2/Prim.hs
mit
genPrim _ _ IntRemOp [r] [x,y] = PrimInline [j| `r` = `x` % `y` |]
75
genPrim _ _ IntRemOp [r] [x,y] = PrimInline [j| `r` = `x` % `y` |]
75
genPrim _ _ IntRemOp [r] [x,y] = PrimInline [j| `r` = `x` % `y` |]
75
false
false
3
6
23
34
19
15
null
null
massysett/barecheck
lib/Data/Time/Coarbitrary.hs
bsd-3-clause
uTCTime :: UTCTime -> Gen b -> Gen b uTCTime (UTCTime d t) = day d . diffTime t
79
uTCTime :: UTCTime -> Gen b -> Gen b uTCTime (UTCTime d t) = day d . diffTime t
79
uTCTime (UTCTime d t) = day d . diffTime t
42
false
true
0
7
18
46
21
25
null
null
clinty/Juicy.Pixels
src/Codec/Picture/Jpg/FastDct.hs
bsd-3-clause
-- FIX(1.961570560) */ fIX_2_053119869 = 16819
46
fIX_2_053119869 = 16819
23
fIX_2_053119869 = 16819
23
true
false
0
4
5
7
4
3
null
null
ki11men0w/delphi-lint
src/ParsecUtils.hs
bsd-3-clause
isSqlIdentifierChar :: Char -> Bool isSqlIdentifierChar c = isSqlIdentifierStartChar c || isDigit c
100
isSqlIdentifierChar :: Char -> Bool isSqlIdentifierChar c = isSqlIdentifierStartChar c || isDigit c
99
isSqlIdentifierChar c = isSqlIdentifierStartChar c || isDigit c
63
false
true
0
6
13
28
13
15
null
null
wayofthepie/vulgr
vulgr-lib/src/Vulgr/API.hs
bsd-3-clause
-- | Post to /cves postCves :: [Cve] -> App T.Text postCves cs = traceShow "Called post..." $ do conn <- ask liftIO $ createCve conn cs
143
postCves :: [Cve] -> App T.Text postCves cs = traceShow "Called post..." $ do conn <- ask liftIO $ createCve conn cs
124
postCves cs = traceShow "Called post..." $ do conn <- ask liftIO $ createCve conn cs
92
true
true
0
9
34
53
25
28
null
null
DanielSchuessler/hstri
scratch-test.hs
gpl-3.0
cutq = readRgaFile
18
cutq = readRgaFile
18
cutq = readRgaFile
18
false
false
0
4
2
6
3
3
null
null
23Skidoo/aeson
Data/Aeson/Parser/Time.hs
bsd-3-clause
twoDigits :: Parser Int twoDigits = do a <- digit b <- digit let c2d c = ord c .&. 15 return $! c2d a * 10 + c2d b -- | Parse a time of the form @HH:MM:SS[.SSS]@.
171
twoDigits :: Parser Int twoDigits = do a <- digit b <- digit let c2d c = ord c .&. 15 return $! c2d a * 10 + c2d b -- | Parse a time of the form @HH:MM:SS[.SSS]@.
171
twoDigits = do a <- digit b <- digit let c2d c = ord c .&. 15 return $! c2d a * 10 + c2d b -- | Parse a time of the form @HH:MM:SS[.SSS]@.
147
false
true
0
11
47
69
31
38
null
null
nevrenato/Hets_Fork
OMDoc/XmlInterface.hs
gpl-2.0
el_adt = toQN "adt"
19
el_adt = toQN "adt"
19
el_adt = toQN "adt"
19
false
false
0
5
3
9
4
5
null
null
andygill/plist-buddy
src/Database/PlistBuddy.hs
bsd-3-clause
replay (Delete p) = delete p
28
replay (Delete p) = delete p
28
replay (Delete p) = delete p
28
false
false
0
7
5
18
8
10
null
null
haskell-infra/hackage-server
Distribution/Server/Features/UserSignup.hs
bsd-3-clause
renderNonce :: Nonce -> String renderNonce (Nonce nonce) = BS.unpack nonce
74
renderNonce :: Nonce -> String renderNonce (Nonce nonce) = BS.unpack nonce
74
renderNonce (Nonce nonce) = BS.unpack nonce
43
false
true
0
7
10
29
14
15
null
null
Sobieck00/practice
utilities/nonvisualstudio/haskell/math/Tests.hs
mit
roundFloatTestCases = TestList [ TestCase $ easyAssertEqualTwoInputs "roundFloat" roundFloat 2.156486 4 2.1565, TestCase $ easyAssertEqualTwoInputs "roundFloat" roundFloat 2.156486 0 2, TestCase $ easyAssertEqualTwoInputs "roundFloat" roundFloat 2.156486 5 2.15649 ]
292
roundFloatTestCases = TestList [ TestCase $ easyAssertEqualTwoInputs "roundFloat" roundFloat 2.156486 4 2.1565, TestCase $ easyAssertEqualTwoInputs "roundFloat" roundFloat 2.156486 0 2, TestCase $ easyAssertEqualTwoInputs "roundFloat" roundFloat 2.156486 5 2.15649 ]
292
roundFloatTestCases = TestList [ TestCase $ easyAssertEqualTwoInputs "roundFloat" roundFloat 2.156486 4 2.1565, TestCase $ easyAssertEqualTwoInputs "roundFloat" roundFloat 2.156486 0 2, TestCase $ easyAssertEqualTwoInputs "roundFloat" roundFloat 2.156486 5 2.15649 ]
292
false
false
0
7
54
63
31
32
null
null
ony/hledger
hledger-lib/Hledger/Read.hs
gpl-3.0
journalEnvVar2 = "LEDGER"
34
journalEnvVar2 = "LEDGER"
34
journalEnvVar2 = "LEDGER"
34
false
false
1
5
11
10
3
7
null
null
trxeste/wrk
haskell/TrabalhoIA/src/Parser.hs
bsd-3-clause
parseTerrain (Dungeon _) = do terrain' <- letter case terrain' of 'd' -> return WDungeon 'n' -> return NWDungeon _ -> fail "Terreno desconhecido"
162
parseTerrain (Dungeon _) = do terrain' <- letter case terrain' of 'd' -> return WDungeon 'n' -> return NWDungeon _ -> fail "Terreno desconhecido"
162
parseTerrain (Dungeon _) = do terrain' <- letter case terrain' of 'd' -> return WDungeon 'n' -> return NWDungeon _ -> fail "Terreno desconhecido"
162
false
false
0
10
40
57
25
32
null
null
shlevy/ghc
compiler/nativeGen/X86/Ppr.hs
bsd-3-clause
-- both unused (SDM): -- pprInstr PUSHA = text "\tpushal" -- pprInstr POPA = text "\tpopal" pprInstr NOP = text "\tnop"
120
pprInstr NOP = text "\tnop"
27
pprInstr NOP = text "\tnop"
27
true
false
1
5
21
18
8
10
null
null
alexander-at-github/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
primOpHasSideEffects ObjectArrayNewOp = True
48
primOpHasSideEffects ObjectArrayNewOp = True
48
primOpHasSideEffects ObjectArrayNewOp = True
48
false
false
0
5
7
9
4
5
null
null
rueshyna/gogol
gogol-genomics/gen/Network/Google/Genomics/Types/Product.hs
mpl-2.0
-- | The top-level key. vsmKey :: Lens' VariantSetMetadata (Maybe Text) vsmKey = lens _vsmKey (\ s a -> s{_vsmKey = a})
119
vsmKey :: Lens' VariantSetMetadata (Maybe Text) vsmKey = lens _vsmKey (\ s a -> s{_vsmKey = a})
95
vsmKey = lens _vsmKey (\ s a -> s{_vsmKey = a})
47
true
true
0
9
21
46
25
21
null
null
a143753/AOJ
ITP1_10_D.hs
apache-2.0
v1 v2 = sqrt $ foldl (\s (a,b) -> s + (a-b)*(a-b) ) 0 $ zip v1 v2
65
v1 v2 = sqrt $ foldl (\s (a,b) -> s + (a-b)*(a-b) ) 0 $ zip v1 v2
65
v1 v2 = sqrt $ foldl (\s (a,b) -> s + (a-b)*(a-b) ) 0 $ zip v1 v2
65
false
false
3
12
17
69
34
35
null
null
lostbean/Hammer
src/Hammer/VoxBox/Types.hs
gpl-3.0
unCastEdgeVoxelPos :: (Word8, VoxelPos) -> EdgeVoxelPos unCastEdgeVoxelPos (x, p) | x == 0 = Ex p | x == 1 = Ey p | otherwise = Ez p
144
unCastEdgeVoxelPos :: (Word8, VoxelPos) -> EdgeVoxelPos unCastEdgeVoxelPos (x, p) | x == 0 = Ex p | x == 1 = Ey p | otherwise = Ez p
144
unCastEdgeVoxelPos (x, p) | x == 0 = Ex p | x == 1 = Ey p | otherwise = Ez p
88
false
true
0
8
39
80
37
43
null
null
ghc-android/ghc
compiler/coreSyn/CoreSyn.hs
bsd-3-clause
deTagBind :: TaggedBind t -> CoreBind deTagBind (NonRec (TB b _) rhs) = NonRec b (deTagExpr rhs)
96
deTagBind :: TaggedBind t -> CoreBind deTagBind (NonRec (TB b _) rhs) = NonRec b (deTagExpr rhs)
96
deTagBind (NonRec (TB b _) rhs) = NonRec b (deTagExpr rhs)
58
false
true
0
11
16
53
24
29
null
null
facebookincubator/duckling
Duckling/Ordinal/HU/Rules.hs
bsd-3-clause
ordinalsMap :: HashMap Text Int ordinalsMap = HashMap.fromList [ ( "első", 1 ) , ( "második", 2 ) , ( "harmadik", 3 ) , ( "negyedik", 4 ) , ( "ötödik", 5 ) , ( "hatodik", 6 ) , ( "hetedik", 7 ) , ( "nyolcadik", 8 ) , ( "kilencedik", 9 ) , ( "tizedik", 10 ) , ( "huszadik", 20 ) , ( "harmincadik", 30 ) , ( "negyvenedik", 40 ) , ( "ötvenedik", 50 ) , ( "hatvanadik", 60 ) , ( "hetvenedik", 70 ) , ( "nyolcvanadik", 80 ) , ( "kilencvenedik", 90 ) ]
484
ordinalsMap :: HashMap Text Int ordinalsMap = HashMap.fromList [ ( "első", 1 ) , ( "második", 2 ) , ( "harmadik", 3 ) , ( "negyedik", 4 ) , ( "ötödik", 5 ) , ( "hatodik", 6 ) , ( "hetedik", 7 ) , ( "nyolcadik", 8 ) , ( "kilencedik", 9 ) , ( "tizedik", 10 ) , ( "huszadik", 20 ) , ( "harmincadik", 30 ) , ( "negyvenedik", 40 ) , ( "ötvenedik", 50 ) , ( "hatvanadik", 60 ) , ( "hetvenedik", 70 ) , ( "nyolcvanadik", 80 ) , ( "kilencvenedik", 90 ) ]
484
ordinalsMap = HashMap.fromList [ ( "első", 1 ) , ( "második", 2 ) , ( "harmadik", 3 ) , ( "negyedik", 4 ) , ( "ötödik", 5 ) , ( "hatodik", 6 ) , ( "hetedik", 7 ) , ( "nyolcadik", 8 ) , ( "kilencedik", 9 ) , ( "tizedik", 10 ) , ( "huszadik", 20 ) , ( "harmincadik", 30 ) , ( "negyvenedik", 40 ) , ( "ötvenedik", 50 ) , ( "hatvanadik", 60 ) , ( "hetvenedik", 70 ) , ( "nyolcvanadik", 80 ) , ( "kilencvenedik", 90 ) ]
452
false
true
0
6
136
183
118
65
null
null
denisenkom/hsmssql
Database/Mssql/Tds.hs
mit
tokensToDictImpl l m (k:v:xs) = tokensToDictImpl l (Map.insert k v m) xs
72
tokensToDictImpl l m (k:v:xs) = tokensToDictImpl l (Map.insert k v m) xs
72
tokensToDictImpl l m (k:v:xs) = tokensToDictImpl l (Map.insert k v m) xs
72
false
false
0
8
11
43
21
22
null
null
marklar/TagFS
src/DB/Read.hs
bsd-3-clause
fileEntityById ∷ DB → FileId → IO (Maybe Entity) fileEntityById conn fileId = do maybeRow ← findRowById conn "files" fileId case maybeRow of Nothing → return Nothing Just [_, name, contents] → return $ Just (FileEntity fileId (File (fromSql name) (fromSql contents))) {- | Helper fn. Sometimes when you have the name of a file, you want to know how it's tagged. -}
415
fileEntityById ∷ DB → FileId → IO (Maybe Entity) fileEntityById conn fileId = do maybeRow ← findRowById conn "files" fileId case maybeRow of Nothing → return Nothing Just [_, name, contents] → return $ Just (FileEntity fileId (File (fromSql name) (fromSql contents))) {- | Helper fn. Sometimes when you have the name of a file, you want to know how it's tagged. -}
415
fileEntityById conn fileId = do maybeRow ← findRowById conn "files" fileId case maybeRow of Nothing → return Nothing Just [_, name, contents] → return $ Just (FileEntity fileId (File (fromSql name) (fromSql contents))) {- | Helper fn. Sometimes when you have the name of a file, you want to know how it's tagged. -}
366
false
true
0
17
113
117
57
60
null
null
pyuk/euler2
src/P19.hs
bsd-3-clause
bumpMonth :: Month -> Year -> Month bumpMonth (January x) _ | x < 31 = January (x + 1) | otherwise = Feburary 1
139
bumpMonth :: Month -> Year -> Month bumpMonth (January x) _ | x < 31 = January (x + 1) | otherwise = Feburary 1
139
bumpMonth (January x) _ | x < 31 = January (x + 1) | otherwise = Feburary 1
103
false
true
0
8
52
62
29
33
null
null
sgillespie/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
collect_hs_val_binders :: Bool -> HsValBindsLR idL idR -> [idL] collect_hs_val_binders ps (ValBindsIn binds _) = collect_binds ps binds []
143
collect_hs_val_binders :: Bool -> HsValBindsLR idL idR -> [idL] collect_hs_val_binders ps (ValBindsIn binds _) = collect_binds ps binds []
143
collect_hs_val_binders ps (ValBindsIn binds _) = collect_binds ps binds []
79
false
true
0
7
23
49
24
25
null
null
iemxblog/sivi-haskell
src/Sivi/IR/ToGCode.hs
gpl-2.0
toGCode' :: IRInstruction -- ^ The instruction to compile -> TrackedPosition GCodeInstruction -- ^ The resulting 'GCode' instruction toGCode' (Move (V3 x y z) Rapid) = return $ G00 (Just x) (Just y) (Just z)
242
toGCode' :: IRInstruction -- ^ The instruction to compile -> TrackedPosition GCodeInstruction toGCode' (Move (V3 x y z) Rapid) = return $ G00 (Just x) (Just y) (Just z)
199
toGCode' (Move (V3 x y z) Rapid) = return $ G00 (Just x) (Just y) (Just z)
74
true
true
0
11
69
74
36
38
null
null
spacekitteh/smcghc
compiler/main/DynFlags.hs
bsd-3-clause
intSuffix :: (Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags) intSuffix fn = IntSuffix (\n -> upd (fn n))
117
intSuffix :: (Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags) intSuffix fn = IntSuffix (\n -> upd (fn n))
117
intSuffix fn = IntSuffix (\n -> upd (fn n))
43
false
true
0
10
19
62
30
32
null
null
romanb/amazonka
amazonka-iam/gen/Network/AWS/IAM/GetCredentialReport.hs
mpl-2.0
-- | 'GetCredentialReportResponse' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'gcrrContent' @::@ 'Maybe' 'Base64' -- -- * 'gcrrGeneratedTime' @::@ 'Maybe' 'UTCTime' -- -- * 'gcrrReportFormat' @::@ 'Maybe' 'ReportFormatType' -- getCredentialReportResponse :: GetCredentialReportResponse getCredentialReportResponse = GetCredentialReportResponse { _gcrrContent = Nothing , _gcrrReportFormat = Nothing , _gcrrGeneratedTime = Nothing }
494
getCredentialReportResponse :: GetCredentialReportResponse getCredentialReportResponse = GetCredentialReportResponse { _gcrrContent = Nothing , _gcrrReportFormat = Nothing , _gcrrGeneratedTime = Nothing }
227
getCredentialReportResponse = GetCredentialReportResponse { _gcrrContent = Nothing , _gcrrReportFormat = Nothing , _gcrrGeneratedTime = Nothing }
168
true
true
0
7
76
45
30
15
null
null
breestanwyck/bort
src/Bort/MessageHandler.hs
bsd-3-clause
reply :: ByteString -> MsgHandler () reply msgBody = do p <- sentPrivately r <- if p then sender else recipient sendTo r msgBody
134
reply :: ByteString -> MsgHandler () reply msgBody = do p <- sentPrivately r <- if p then sender else recipient sendTo r msgBody
134
reply msgBody = do p <- sentPrivately r <- if p then sender else recipient sendTo r msgBody
97
false
true
0
8
29
53
25
28
null
null
CulpaBS/wbBach
src/Futhark/Test.hs
bsd-3-clause
readTestSpec :: SourceName -> T.Text -> Either ParseError ProgramTest readTestSpec = parse $ testSpec <* eof
108
readTestSpec :: SourceName -> T.Text -> Either ParseError ProgramTest readTestSpec = parse $ testSpec <* eof
108
readTestSpec = parse $ testSpec <* eof
38
false
true
0
7
15
34
17
17
null
null
ku-fpg/sunroof-active
examples/tictactoe/Main.hs
bsd-3-clause
example :: JS A () example = do canvas <- document # getElementById "canvas" c <- canvas # getContext "2d" let clear :: Painting = clearRect (0,0) (canvas ! width, canvas ! height) width' <- evaluate $ canvas ! width height' <- evaluate $ canvas ! height let prog :: Active JSTime Painting prog = pure clear <> ticTacToe (canvas ! width, canvas ! height) let full :: Active JSTime Painting full = prog <> (timeline (100,200) (300,220) `during` prog) (s,e,f) <- reifyActive $ fmap (c #) $ scopeA $ full let mul :: JSNumber mul = 400 / (e - s) jQuery "#start" >>= setText (cast s) jQuery "#end" >>= setText (cast e) date <- evaluate $ object "new Date()" tm0 :: JSNumber <- date # invoke "getTime" () jQuery "#slider" >>= invoke "slider" ("option" :: JSString, "min" :: JSString, s * mul :: JSNumber) :: JS A () jQuery "#slider" >>= invoke "slider" ("option" :: JSString, "max" :: JSString, e * mul :: JSNumber) :: JS A () let paint tm = do printFixed "#time" 2 tm apply f tm ch :: JSChan JSNumber <- newChan let slideHandler :: (JSObject, JSObject) -> JSB () slideHandler = \(event, ui) -> do val :: JSNumber <- evaluate $ ui ! label "value" let nm = val / mul console # B.log ("got %f " :: JSString, nm :: JSNumber) liftJS $ paint nm return () jQuery "#slider" >>= on "slide" (cast nullJS) slideHandler return ()
1,482
example :: JS A () example = do canvas <- document # getElementById "canvas" c <- canvas # getContext "2d" let clear :: Painting = clearRect (0,0) (canvas ! width, canvas ! height) width' <- evaluate $ canvas ! width height' <- evaluate $ canvas ! height let prog :: Active JSTime Painting prog = pure clear <> ticTacToe (canvas ! width, canvas ! height) let full :: Active JSTime Painting full = prog <> (timeline (100,200) (300,220) `during` prog) (s,e,f) <- reifyActive $ fmap (c #) $ scopeA $ full let mul :: JSNumber mul = 400 / (e - s) jQuery "#start" >>= setText (cast s) jQuery "#end" >>= setText (cast e) date <- evaluate $ object "new Date()" tm0 :: JSNumber <- date # invoke "getTime" () jQuery "#slider" >>= invoke "slider" ("option" :: JSString, "min" :: JSString, s * mul :: JSNumber) :: JS A () jQuery "#slider" >>= invoke "slider" ("option" :: JSString, "max" :: JSString, e * mul :: JSNumber) :: JS A () let paint tm = do printFixed "#time" 2 tm apply f tm ch :: JSChan JSNumber <- newChan let slideHandler :: (JSObject, JSObject) -> JSB () slideHandler = \(event, ui) -> do val :: JSNumber <- evaluate $ ui ! label "value" let nm = val / mul console # B.log ("got %f " :: JSString, nm :: JSNumber) liftJS $ paint nm return () jQuery "#slider" >>= on "slide" (cast nullJS) slideHandler return ()
1,482
example = do canvas <- document # getElementById "canvas" c <- canvas # getContext "2d" let clear :: Painting = clearRect (0,0) (canvas ! width, canvas ! height) width' <- evaluate $ canvas ! width height' <- evaluate $ canvas ! height let prog :: Active JSTime Painting prog = pure clear <> ticTacToe (canvas ! width, canvas ! height) let full :: Active JSTime Painting full = prog <> (timeline (100,200) (300,220) `during` prog) (s,e,f) <- reifyActive $ fmap (c #) $ scopeA $ full let mul :: JSNumber mul = 400 / (e - s) jQuery "#start" >>= setText (cast s) jQuery "#end" >>= setText (cast e) date <- evaluate $ object "new Date()" tm0 :: JSNumber <- date # invoke "getTime" () jQuery "#slider" >>= invoke "slider" ("option" :: JSString, "min" :: JSString, s * mul :: JSNumber) :: JS A () jQuery "#slider" >>= invoke "slider" ("option" :: JSString, "max" :: JSString, e * mul :: JSNumber) :: JS A () let paint tm = do printFixed "#time" 2 tm apply f tm ch :: JSChan JSNumber <- newChan let slideHandler :: (JSObject, JSObject) -> JSB () slideHandler = \(event, ui) -> do val :: JSNumber <- evaluate $ ui ! label "value" let nm = val / mul console # B.log ("got %f " :: JSString, nm :: JSNumber) liftJS $ paint nm return () jQuery "#slider" >>= on "slide" (cast nullJS) slideHandler return ()
1,463
false
true
0
16
414
627
306
321
null
null
iquiw/wai
warp-tls/Network/Wai/Handler/WarpTLS.hs
mit
-- taken from stunnel example in tls-extra ciphers :: [TLS.Cipher] ciphers = [ TLSExtra.cipher_ECDHE_RSA_AES128GCM_SHA256 , TLSExtra.cipher_ECDHE_RSA_AES128CBC_SHA256 , TLSExtra.cipher_ECDHE_RSA_AES128CBC_SHA , TLSExtra.cipher_DHE_RSA_AES128GCM_SHA256 , TLSExtra.cipher_DHE_RSA_AES256_SHA256 , TLSExtra.cipher_DHE_RSA_AES128_SHA256 , TLSExtra.cipher_DHE_RSA_AES256_SHA1 , TLSExtra.cipher_DHE_RSA_AES128_SHA1 , TLSExtra.cipher_DHE_DSS_AES128_SHA1 , TLSExtra.cipher_DHE_DSS_AES256_SHA1 , TLSExtra.cipher_AES128_SHA1 , TLSExtra.cipher_AES256_SHA1 ]
597
ciphers :: [TLS.Cipher] ciphers = [ TLSExtra.cipher_ECDHE_RSA_AES128GCM_SHA256 , TLSExtra.cipher_ECDHE_RSA_AES128CBC_SHA256 , TLSExtra.cipher_ECDHE_RSA_AES128CBC_SHA , TLSExtra.cipher_DHE_RSA_AES128GCM_SHA256 , TLSExtra.cipher_DHE_RSA_AES256_SHA256 , TLSExtra.cipher_DHE_RSA_AES128_SHA256 , TLSExtra.cipher_DHE_RSA_AES256_SHA1 , TLSExtra.cipher_DHE_RSA_AES128_SHA1 , TLSExtra.cipher_DHE_DSS_AES128_SHA1 , TLSExtra.cipher_DHE_DSS_AES256_SHA1 , TLSExtra.cipher_AES128_SHA1 , TLSExtra.cipher_AES256_SHA1 ]
554
ciphers = [ TLSExtra.cipher_ECDHE_RSA_AES128GCM_SHA256 , TLSExtra.cipher_ECDHE_RSA_AES128CBC_SHA256 , TLSExtra.cipher_ECDHE_RSA_AES128CBC_SHA , TLSExtra.cipher_DHE_RSA_AES128GCM_SHA256 , TLSExtra.cipher_DHE_RSA_AES256_SHA256 , TLSExtra.cipher_DHE_RSA_AES128_SHA256 , TLSExtra.cipher_DHE_RSA_AES256_SHA1 , TLSExtra.cipher_DHE_RSA_AES128_SHA1 , TLSExtra.cipher_DHE_DSS_AES128_SHA1 , TLSExtra.cipher_DHE_DSS_AES256_SHA1 , TLSExtra.cipher_AES128_SHA1 , TLSExtra.cipher_AES256_SHA1 ]
530
true
true
0
6
88
77
46
31
null
null