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
cocreature/leksah
src/IDE/Session.hs
gpl-2.0
recover pp (VariablesSt p) = void (recoverState pp p)
60
recover pp (VariablesSt p) = void (recoverState pp p)
60
recover pp (VariablesSt p) = void (recoverState pp p)
60
false
false
0
7
15
28
13
15
null
null
olsner/ghc
compiler/types/Type.hs
bsd-3-clause
-- | Creates a primitive representational type equality predicate -- with explicit kinds mkHeteroReprPrimEqPred :: Kind -> Kind -> Type -> Type -> Type mkHeteroReprPrimEqPred k1 k2 ty1 ty2 = TyConApp eqReprPrimTyCon [k1, k2, ty1, ty2]
236
mkHeteroReprPrimEqPred :: Kind -> Kind -> Type -> Type -> Type mkHeteroReprPrimEqPred k1 k2 ty1 ty2 = TyConApp eqReprPrimTyCon [k1, k2, ty1, ty2]
147
mkHeteroReprPrimEqPred k1 k2 ty1 ty2 = TyConApp eqReprPrimTyCon [k1, k2, ty1, ty2]
84
true
true
0
8
37
55
30
25
null
null
phonohawk/HsOpenSSL
OpenSSL/X509.hs
cc0-1.0
-- |@'setPublicKey' cert pubkey@ updates the public key of the subject -- of certificate. setPublicKey :: PublicKey key => X509 -> key -> IO () setPublicKey x509 key = withX509Ptr x509 $ \ x509Ptr -> withPKeyPtr' key $ \ pkeyPtr -> _set_pubkey x509Ptr pkeyPtr >>= failIf (/= 1) >> return ()
329
setPublicKey :: PublicKey key => X509 -> key -> IO () setPublicKey x509 key = withX509Ptr x509 $ \ x509Ptr -> withPKeyPtr' key $ \ pkeyPtr -> _set_pubkey x509Ptr pkeyPtr >>= failIf (/= 1) >> return ()
239
setPublicKey x509 key = withX509Ptr x509 $ \ x509Ptr -> withPKeyPtr' key $ \ pkeyPtr -> _set_pubkey x509Ptr pkeyPtr >>= failIf (/= 1) >> return ()
185
true
true
0
12
89
87
43
44
null
null
haskellGardener/transient
Test.hs
gpl-3.0
moveExample host port= do putStrLnhp port "enter a string. It will be inserted in the other node by a migrating program" name <- logged $ input (const True) beamTo host port putStrLnhp port "moved!" putStrLnhp port $ "inserting "++ name ++" as new data in this node" Environ environ <- getSData <|> do ref <- liftIO $ newIORef "Not Changed" let env= Environ ref setSData env return env liftIO $ writeIORef environ name return()
599
moveExample host port= do putStrLnhp port "enter a string. It will be inserted in the other node by a migrating program" name <- logged $ input (const True) beamTo host port putStrLnhp port "moved!" putStrLnhp port $ "inserting "++ name ++" as new data in this node" Environ environ <- getSData <|> do ref <- liftIO $ newIORef "Not Changed" let env= Environ ref setSData env return env liftIO $ writeIORef environ name return()
599
moveExample host port= do putStrLnhp port "enter a string. It will be inserted in the other node by a migrating program" name <- logged $ input (const True) beamTo host port putStrLnhp port "moved!" putStrLnhp port $ "inserting "++ name ++" as new data in this node" Environ environ <- getSData <|> do ref <- liftIO $ newIORef "Not Changed" let env= Environ ref setSData env return env liftIO $ writeIORef environ name return()
599
false
false
0
14
245
146
60
86
null
null
mzini/TcT
source/Tct/Processors.hs
gpl-3.0
{- | [on :: strict|weak|both|union /(optional)/] Chooses the TRS from the problem on which the predicate is applied (only applies to predicates on TRSs). -} isGround :: S.StdProcessor Predicate isGround = isGroundProcessor
225
isGround :: S.StdProcessor Predicate isGround = isGroundProcessor
65
isGround = isGroundProcessor
28
true
true
0
6
34
17
9
8
null
null
jfdm/hUML
src/ClassDiagram/Keywords.hs
bsd-3-clause
hUmlOperatorComposition = "*--"
34
hUmlOperatorComposition = "*--"
34
hUmlOperatorComposition = "*--"
34
false
false
0
4
5
6
3
3
null
null
taksuyu/game-of-ur
src/Game/Ur.hs
bsd-3-clause
nextBoardState :: (Ur, Board) -> IO Board nextBoardState ur = do newDice <- newDiceRoll pure $ nextBoard newDice ur
119
nextBoardState :: (Ur, Board) -> IO Board nextBoardState ur = do newDice <- newDiceRoll pure $ nextBoard newDice ur
119
nextBoardState ur = do newDice <- newDiceRoll pure $ nextBoard newDice ur
77
false
true
0
8
22
46
22
24
null
null
hectorhon/autotrace2
src/TimeSeriesData/Expressions.hs
bsd-3-clause
logical' :: forall s u (m :: * -> *) . Stream s m Char => ParsecT s u m Expression logical' = do _ <- try $ spaces >> char '(' >> spaces a <- try logical _ <- try $ spaces >> char ')' >> spaces return a
253
logical' :: forall s u (m :: * -> *) . Stream s m Char => ParsecT s u m Expression logical' = do _ <- try $ spaces >> char '(' >> spaces a <- try logical _ <- try $ spaces >> char ')' >> spaces return a
253
logical' = do _ <- try $ spaces >> char '(' >> spaces a <- try logical _ <- try $ spaces >> char ')' >> spaces return a
161
false
true
0
11
100
114
53
61
null
null
aisamanra/matterhorn
src/State/Editing.hs
bsd-3-clause
cursorIsAtEnd :: Editor Text a -> Bool cursorIsAtEnd e = let col = snd $ Z.cursorPosition z curLine = Z.currentLine z z = e^.editContentsL in col == T.length curLine
189
cursorIsAtEnd :: Editor Text a -> Bool cursorIsAtEnd e = let col = snd $ Z.cursorPosition z curLine = Z.currentLine z z = e^.editContentsL in col == T.length curLine
189
cursorIsAtEnd e = let col = snd $ Z.cursorPosition z curLine = Z.currentLine z z = e^.editContentsL in col == T.length curLine
150
false
true
0
11
52
71
34
37
null
null
jaspervdj/lorem-markdownum
lib/LoremMarkdownum/Gen/Code.hs
bsd-3-clause
printStatement (IfS c code) = printText "if (" >> printBrk >> printExpression c >> printText ") {" >> printNl >> printIndent4 (printCode code) >> printText "}" >> printNl
179
printStatement (IfS c code) = printText "if (" >> printBrk >> printExpression c >> printText ") {" >> printNl >> printIndent4 (printCode code) >> printText "}" >> printNl
179
printStatement (IfS c code) = printText "if (" >> printBrk >> printExpression c >> printText ") {" >> printNl >> printIndent4 (printCode code) >> printText "}" >> printNl
179
false
false
0
12
36
66
30
36
null
null
hvr/jhc
regress/tests/1_typecheck/2_pass/ghc/uncat/tc229.hs
mit
hP4' = thr' t_hPrefix
22
thP4' = thr' t_hPrefix
22
thP4' = thr' t_hPrefix
22
false
false
0
5
4
9
4
5
null
null
elieux/ghc
compiler/hsSyn/HsDecls.hs
bsd-3-clause
annProvenanceName_maybe :: AnnProvenance name -> Maybe name annProvenanceName_maybe (ValueAnnProvenance (L _ name)) = Just name
127
annProvenanceName_maybe :: AnnProvenance name -> Maybe name annProvenanceName_maybe (ValueAnnProvenance (L _ name)) = Just name
127
annProvenanceName_maybe (ValueAnnProvenance (L _ name)) = Just name
67
false
true
0
9
14
41
19
22
null
null
alphaHeavy/cabal
Cabal/Distribution/System.hs
bsd-3-clause
buildArch :: Arch buildArch = classifyArch Permissive System.Info.arch
70
buildArch :: Arch buildArch = classifyArch Permissive System.Info.arch
70
buildArch = classifyArch Permissive System.Info.arch
52
false
true
0
6
7
19
10
9
null
null
emilaxelsson/feldspar-synch
src/Feldspar/Synch/System.hs
bsd-3-clause
execSystemN :: MonadComp m => Length -> System m a -> m () execSystemN n (System sys) = do next <- sys for (0,1,Excl (value n)) $ \_ -> next >> return () -- | Run a system as long as it returns 'true'
209
execSystemN :: MonadComp m => Length -> System m a -> m () execSystemN n (System sys) = do next <- sys for (0,1,Excl (value n)) $ \_ -> next >> return () -- | Run a system as long as it returns 'true'
209
execSystemN n (System sys) = do next <- sys for (0,1,Excl (value n)) $ \_ -> next >> return () -- | Run a system as long as it returns 'true'
150
false
true
0
12
52
97
47
50
null
null
Codas/yesod-live
exec/Cabal.hs
bsd-2-clause
extensionStrings :: LocalBuildInfo -> Target -> IO [String] extensionStrings lbi@LocalBuildInfo{..} target = do buildTargets <- case target of Library -> return [BuildTargetComponent CLibName] _otherwise -> readBuildTargets localPkgDescr [showTarget target] (comp, clbi, exts) <- case buildTargets of [] -> throwIO $ userError "Invalid target" _:_:_ -> throwIO $ userError "Ambiguous target" [BuildTargetComponent component] -> do let !comp = getComponent localPkgDescr component !clbi = getComponentLocalBuildInfo lbi component exts <- getExtensions localPkgDescr (showTarget target) return (comp, clbi, exts) [BuildTargetModule _component _module] -> throwIO $ userError "Unsupported target" [BuildTargetFile _component _file] -> throwIO $ userError "Unsupported target" return (showExtensions exts) -- | Set GHC options.
1,245
extensionStrings :: LocalBuildInfo -> Target -> IO [String] extensionStrings lbi@LocalBuildInfo{..} target = do buildTargets <- case target of Library -> return [BuildTargetComponent CLibName] _otherwise -> readBuildTargets localPkgDescr [showTarget target] (comp, clbi, exts) <- case buildTargets of [] -> throwIO $ userError "Invalid target" _:_:_ -> throwIO $ userError "Ambiguous target" [BuildTargetComponent component] -> do let !comp = getComponent localPkgDescr component !clbi = getComponentLocalBuildInfo lbi component exts <- getExtensions localPkgDescr (showTarget target) return (comp, clbi, exts) [BuildTargetModule _component _module] -> throwIO $ userError "Unsupported target" [BuildTargetFile _component _file] -> throwIO $ userError "Unsupported target" return (showExtensions exts) -- | Set GHC options.
1,245
extensionStrings lbi@LocalBuildInfo{..} target = do buildTargets <- case target of Library -> return [BuildTargetComponent CLibName] _otherwise -> readBuildTargets localPkgDescr [showTarget target] (comp, clbi, exts) <- case buildTargets of [] -> throwIO $ userError "Invalid target" _:_:_ -> throwIO $ userError "Ambiguous target" [BuildTargetComponent component] -> do let !comp = getComponent localPkgDescr component !clbi = getComponentLocalBuildInfo lbi component exts <- getExtensions localPkgDescr (showTarget target) return (comp, clbi, exts) [BuildTargetModule _component _module] -> throwIO $ userError "Unsupported target" [BuildTargetFile _component _file] -> throwIO $ userError "Unsupported target" return (showExtensions exts) -- | Set GHC options.
1,185
false
true
0
16
522
266
127
139
null
null
brendanhay/gogol
gogol-android-enterprise/gen/Network/Google/Resource/AndroidEnterprise/Storelayoutclusters/List.hs
mpl-2.0
-- | The ID of the enterprise. sllEnterpriseId :: Lens' StorelayoutclustersList Text sllEnterpriseId = lens _sllEnterpriseId (\ s a -> s{_sllEnterpriseId = a})
167
sllEnterpriseId :: Lens' StorelayoutclustersList Text sllEnterpriseId = lens _sllEnterpriseId (\ s a -> s{_sllEnterpriseId = a})
136
sllEnterpriseId = lens _sllEnterpriseId (\ s a -> s{_sllEnterpriseId = a})
82
true
true
1
9
30
45
22
23
null
null
andorp/hs-bluesnap
src/Bluesnap/API/Response.hs
gpl-3.0
elementToXMLTransaction_id :: Xsd.XsdString -> [Content ()] elementToXMLTransaction_id = schemaTypeToXML "transaction-id"
121
elementToXMLTransaction_id :: Xsd.XsdString -> [Content ()] elementToXMLTransaction_id = schemaTypeToXML "transaction-id"
121
elementToXMLTransaction_id = schemaTypeToXML "transaction-id"
61
false
true
0
8
9
28
14
14
null
null
spacekitteh/smcghc
compiler/nativeGen/X86/Instr.hs
bsd-3-clause
-- Size of an x86/x86_64 memory address, in bytes. -- archWordSize :: Bool -> Size archWordSize is32Bit | is32Bit = II32 | otherwise = II64
143
archWordSize :: Bool -> Size archWordSize is32Bit | is32Bit = II32 | otherwise = II64
89
archWordSize is32Bit | is32Bit = II32 | otherwise = II64
60
true
true
1
7
28
34
17
17
null
null
Gabriel439/Haskell-Dhall-Library
dhall/src/Dhall/Import/Types.hs
bsd-3-clause
-- | Lens from a `Status` to its `_startingContext` field startingContext :: Functor f => LensLike' f Status (Context (Expr Src Void)) startingContext k s = fmap (\x -> s { _startingContext = x }) (k (_startingContext s))
225
startingContext :: Functor f => LensLike' f Status (Context (Expr Src Void)) startingContext k s = fmap (\x -> s { _startingContext = x }) (k (_startingContext s))
167
startingContext k s = fmap (\x -> s { _startingContext = x }) (k (_startingContext s))
90
true
true
0
10
41
78
40
38
null
null
mrwonko/wonkococo
wcc/Regex.hs
mit
definitelyNull (Symbol _) = False
33
definitelyNull (Symbol _) = False
33
definitelyNull (Symbol _) = False
33
false
false
0
7
4
15
7
8
null
null
mariefarrell/Hets
Maude/Maude2DG.hs
gpl-2.0
applyRenamingTerm sm (Var q s) = Var q s' where s' = applyRenamingType sm s -- | renames a type
105
applyRenamingTerm sm (Var q s) = Var q s' where s' = applyRenamingType sm s -- | renames a type
105
applyRenamingTerm sm (Var q s) = Var q s' where s' = applyRenamingType sm s -- | renames a type
105
false
false
0
7
29
37
18
19
null
null
derekelkins/servant-jquery
src/Servant/JQuery/Internal.hs
bsd-3-clause
jsParams (x:xs) = paramToStr x True ++ "&" ++ jsParams xs
57
jsParams (x:xs) = paramToStr x True ++ "&" ++ jsParams xs
57
jsParams (x:xs) = paramToStr x True ++ "&" ++ jsParams xs
57
false
false
0
7
10
32
15
17
null
null
wavewave/hoodle-render
src/Graphics/Hoodle/Render/Type/Item.hs
bsd-2-clause
findSVGInRItem _ = Nothing
26
findSVGInRItem _ = Nothing
26
findSVGInRItem _ = Nothing
26
false
false
0
5
3
9
4
5
null
null
phischu/fragnix
builtins/ghc-prim/GHC.PrimopWrappers.hs
bsd-3-clause
indexArray# :: Array# a -> Int# -> (# a #) indexArray# a1 a2 = (GHC.Prim.indexArray#) a1 a2
91
indexArray# :: Array# a -> Int# -> (# a #) indexArray# a1 a2 = (GHC.Prim.indexArray#) a1 a2
91
indexArray# a1 a2 = (GHC.Prim.indexArray#) a1 a2
48
false
true
0
7
16
40
20
20
null
null
tel/graphbuilder
src/Data/Graph/Builder.hs
mit
-- | Unwrap a 'GraphBuilder' monad specifying *undirected* edges. Useful -- for when the type of the graph is never actually specified. runUGraphBuilder :: UGraphBuilder a b x -> x runUGraphBuilder = runGraphBuilder
215
runUGraphBuilder :: UGraphBuilder a b x -> x runUGraphBuilder = runGraphBuilder
79
runUGraphBuilder = runGraphBuilder
34
true
true
0
6
32
24
13
11
null
null
fiigii/dataflow
Parser.hs
mit
conertOp Js.OpBXor = OpBXor
27
conertOp Js.OpBXor = OpBXor
27
conertOp Js.OpBXor = OpBXor
27
false
false
0
5
3
12
5
7
null
null
davmre/matrizer
src/Matrizer/Derivatives.hs
gpl-2.0
reduceDifferential v (LiteralScalar a) = ZeroLeaf 1 1
53
reduceDifferential v (LiteralScalar a) = ZeroLeaf 1 1
53
reduceDifferential v (LiteralScalar a) = ZeroLeaf 1 1
53
false
false
0
7
7
22
10
12
null
null
dmvianna/haskellbook
src/Ch14Ex-tests.hs
unlicense
-- 9. Check functions prop_concat :: Property prop_concat = forAll (genTuple :: Gen ([Int], [Int])) (\(x, y) -> foldr (:) y x == (++) x y)
143
prop_concat :: Property prop_concat = forAll (genTuple :: Gen ([Int], [Int])) (\(x, y) -> foldr (:) y x == (++) x y)
120
prop_concat = forAll (genTuple :: Gen ([Int], [Int])) (\(x, y) -> foldr (:) y x == (++) x y)
96
true
true
0
9
30
73
42
31
null
null
kuribas/hmetafont
Typography/HMetafont.hs
bsd-3-clause
z18r = Point x18r y18r
22
z18r = Point x18r y18r
22
z18r = Point x18r y18r
22
false
false
0
5
4
11
5
6
null
null
fpco/statistics
Statistics/Test/WilcoxonT.hs
bsd-2-clause
-- 1 + x coefficients r = let coeffs = coefficients (r-1) (firstR, rest) = splitAt r coeffs in firstR ++ add rest coeffs where add (x:xs) (y:ys) = x + y : add xs ys add xs [] = xs add [] ys = ys -- This list will be processed lazily from the head.
285
coefficients r = let coeffs = coefficients (r-1) (firstR, rest) = splitAt r coeffs in firstR ++ add rest coeffs where add (x:xs) (y:ys) = x + y : add xs ys add xs [] = xs add [] ys = ys -- This list will be processed lazily from the head.
276
coefficients r = let coeffs = coefficients (r-1) (firstR, rest) = splitAt r coeffs in firstR ++ add rest coeffs where add (x:xs) (y:ys) = x + y : add xs ys add xs [] = xs add [] ys = ys -- This list will be processed lazily from the head.
276
true
false
8
11
93
134
61
73
null
null
GaloisInc/halvm-ghc
compiler/prelude/TysWiredIn.hs
bsd-3-clause
doubleTyCon :: TyCon doubleTyCon = pcNonRecDataTyCon doubleTyConName (Just (CType "" Nothing ("HsDouble",fsLit "HsDouble"))) [] [doubleDataCon]
187
doubleTyCon :: TyCon doubleTyCon = pcNonRecDataTyCon doubleTyConName (Just (CType "" Nothing ("HsDouble",fsLit "HsDouble"))) [] [doubleDataCon]
187
doubleTyCon = pcNonRecDataTyCon doubleTyConName (Just (CType "" Nothing ("HsDouble",fsLit "HsDouble"))) [] [doubleDataCon]
166
false
true
0
11
58
50
26
24
null
null
li-zhirui/EoplLangs
src/ImplicitRefs/Parser.hs
bsd-3-clause
binOp :: Parser BinOp binOp = do opStr <- foldl1 (<|>) (fmap (try . symbol . fst) binOpsMap) return $ fromMaybe (error ("Unknown operator '" `mappend` opStr `mappend` "'")) (lookup opStr binOpsMap)
209
binOp :: Parser BinOp binOp = do opStr <- foldl1 (<|>) (fmap (try . symbol . fst) binOpsMap) return $ fromMaybe (error ("Unknown operator '" `mappend` opStr `mappend` "'")) (lookup opStr binOpsMap)
209
binOp = do opStr <- foldl1 (<|>) (fmap (try . symbol . fst) binOpsMap) return $ fromMaybe (error ("Unknown operator '" `mappend` opStr `mappend` "'")) (lookup opStr binOpsMap)
187
false
true
0
13
43
88
46
42
null
null
synsem/texhs
src/Text/TeX/Lexer/TokenParser/Basic.hs
gpl-3.0
-- | Parse an octal digit. octDigit :: Monad m => LexerT m Char octDigit = satisfyCharCC isOctDigit [Other]
107
octDigit :: Monad m => LexerT m Char octDigit = satisfyCharCC isOctDigit [Other]
80
octDigit = satisfyCharCC isOctDigit [Other]
43
true
true
0
7
18
38
17
21
null
null
castaway/pandoc
src/Text/Pandoc/Readers/Markdown.hs
gpl-2.0
prefix :: GenParser Char ParserState [Inline] prefix = liftM normalizeSpaces $ manyTill inline (char ']' <|> liftM (const ']') (lookAhead citeKey))
149
prefix :: GenParser Char ParserState [Inline] prefix = liftM normalizeSpaces $ manyTill inline (char ']' <|> liftM (const ']') (lookAhead citeKey))
149
prefix = liftM normalizeSpaces $ manyTill inline (char ']' <|> liftM (const ']') (lookAhead citeKey))
103
false
true
0
11
22
60
29
31
null
null
karamellpelle/MEnv
source/GUI/Widget/Output.hs
bsd-2-clause
resetFillTex :: GUIData -> GUIState -> IO () resetFillTex gd gs = do case guistateFillTex gs of 0 -> do glUniform1i (guiShadeUniUseFillTex $ guistateGUIShade gs) $ fI gl_FALSE filltex -> do glUniform1i (guiShadeUniUseFillTex $ guistateGUIShade gs) $ fI gl_TRUE glActiveTexture gl_TEXTURE1 glBindTexture gl_TEXTURE_2D filltex
403
resetFillTex :: GUIData -> GUIState -> IO () resetFillTex gd gs = do case guistateFillTex gs of 0 -> do glUniform1i (guiShadeUniUseFillTex $ guistateGUIShade gs) $ fI gl_FALSE filltex -> do glUniform1i (guiShadeUniUseFillTex $ guistateGUIShade gs) $ fI gl_TRUE glActiveTexture gl_TEXTURE1 glBindTexture gl_TEXTURE_2D filltex
403
resetFillTex gd gs = do case guistateFillTex gs of 0 -> do glUniform1i (guiShadeUniUseFillTex $ guistateGUIShade gs) $ fI gl_FALSE filltex -> do glUniform1i (guiShadeUniUseFillTex $ guistateGUIShade gs) $ fI gl_TRUE glActiveTexture gl_TEXTURE1 glBindTexture gl_TEXTURE_2D filltex
358
false
true
0
16
122
111
49
62
null
null
brendanhay/gogol
gogol-compute/gen/Network/Google/Resource/Compute/ResourcePolicies/AggregatedList.hs
mpl-2.0
-- | Specifies a page token to use. Set \`pageToken\` to the -- \`nextPageToken\` returned by a previous list request to get the next -- page of results. rpalPageToken :: Lens' ResourcePoliciesAggregatedList (Maybe Text) rpalPageToken = lens _rpalPageToken (\ s a -> s{_rpalPageToken = a})
297
rpalPageToken :: Lens' ResourcePoliciesAggregatedList (Maybe Text) rpalPageToken = lens _rpalPageToken (\ s a -> s{_rpalPageToken = a})
143
rpalPageToken = lens _rpalPageToken (\ s a -> s{_rpalPageToken = a})
76
true
true
0
9
52
50
27
23
null
null
haskell-gi/gi-gtk-examples
notebook/Notebook.hs
lgpl-2.1
notebookTabStop :: NotebookTab -> IO () notebookTabStop NotebookTab {ntBox = box ,ntSpinner = spinner} = do containerTryRemove box spinner spinnerStop spinner -- | Create image widget with given icon name and size.
251
notebookTabStop :: NotebookTab -> IO () notebookTabStop NotebookTab {ntBox = box ,ntSpinner = spinner} = do containerTryRemove box spinner spinnerStop spinner -- | Create image widget with given icon name and size.
251
notebookTabStop NotebookTab {ntBox = box ,ntSpinner = spinner} = do containerTryRemove box spinner spinnerStop spinner -- | Create image widget with given icon name and size.
211
false
true
0
8
68
53
26
27
null
null
quintenpalmer/qz
src/Main.hs
mit
getMapHandler :: Snap () getMapHandler = do Snap.modifyResponse $ Snap.setContentType "application/json" Snap.writeLBS $ encode (fromList [("data", [[1,2,1,2], [2,2,2,2], [2,2,2,4], [3,3,4,4]])] :: Map String [[Int]])
225
getMapHandler :: Snap () getMapHandler = do Snap.modifyResponse $ Snap.setContentType "application/json" Snap.writeLBS $ encode (fromList [("data", [[1,2,1,2], [2,2,2,2], [2,2,2,4], [3,3,4,4]])] :: Map String [[Int]])
225
getMapHandler = do Snap.modifyResponse $ Snap.setContentType "application/json" Snap.writeLBS $ encode (fromList [("data", [[1,2,1,2], [2,2,2,2], [2,2,2,4], [3,3,4,4]])] :: Map String [[Int]])
200
false
true
0
14
31
131
76
55
null
null
rodrigo-machado/ufrgs-grt
src/Graph/Builder/Instance.hs
gpl-3.0
setCurrentRuleId :: Monad m => Int -> InstanceBuilder a b m () setCurrentRuleId r = do (g, t, rs, _) <- get put $ (g, t, rs, r) -- | Gets the currently selected rule
190
setCurrentRuleId :: Monad m => Int -> InstanceBuilder a b m () setCurrentRuleId r = do (g, t, rs, _) <- get put $ (g, t, rs, r) -- | Gets the currently selected rule
190
setCurrentRuleId r = do (g, t, rs, _) <- get put $ (g, t, rs, r) -- | Gets the currently selected rule
127
false
true
0
9
59
80
41
39
null
null
Zigazou/Tank
src/Tank/Units/Angle.hs
gpl-3.0
{-| Convert a radian `Angle` to a degree `Angle`. -} toDeg :: Angle -> Angle toDeg (Rad r) = makeDeg (57.295779513 * r)
119
toDeg :: Angle -> Angle toDeg (Rad r) = makeDeg (57.295779513 * r)
66
toDeg (Rad r) = makeDeg (57.295779513 * r)
42
true
true
0
9
22
41
19
22
null
null
dec9ue/jhc_copygc
src/Doc/DocLike.hs
gpl-2.0
braces x = enclose lbrace rbrace x
34
braces x = enclose lbrace rbrace x
34
braces x = enclose lbrace rbrace x
34
false
false
0
5
6
16
7
9
null
null
mjgpy3/butters
test/Butters/TestParser.hs
bsd-3-clause
parsesToMany text = (==) (parseAll text) . Right
48
parsesToMany text = (==) (parseAll text) . Right
48
parsesToMany text = (==) (parseAll text) . Right
48
false
false
0
8
7
24
12
12
null
null
zaxtax/hakaru
haskell/Tests/Distribution.hs
bsd-3-clause
betaTest = do Positive a <- QM.pick arbitrary Positive b <- QM.pick arbitrary g <- QM.run $ MWC.create samples <- QM.run $ replicateM 1000 $ distSample (beta a b) g let (mean, variance) = meanVariance (map fromLebesgue samples) QM.assert $ (almostEqual tol mean (mu a b)) && (almostEqual tol variance (var a b)) where tol = 1e-1 mu a b = a / (a + b) var a b = a*b / ((sq $ a + b) * (a + b + 1))
449
betaTest = do Positive a <- QM.pick arbitrary Positive b <- QM.pick arbitrary g <- QM.run $ MWC.create samples <- QM.run $ replicateM 1000 $ distSample (beta a b) g let (mean, variance) = meanVariance (map fromLebesgue samples) QM.assert $ (almostEqual tol mean (mu a b)) && (almostEqual tol variance (var a b)) where tol = 1e-1 mu a b = a / (a + b) var a b = a*b / ((sq $ a + b) * (a + b + 1))
449
betaTest = do Positive a <- QM.pick arbitrary Positive b <- QM.pick arbitrary g <- QM.run $ MWC.create samples <- QM.run $ replicateM 1000 $ distSample (beta a b) g let (mean, variance) = meanVariance (map fromLebesgue samples) QM.assert $ (almostEqual tol mean (mu a b)) && (almostEqual tol variance (var a b)) where tol = 1e-1 mu a b = a / (a + b) var a b = a*b / ((sq $ a + b) * (a + b + 1))
449
false
false
2
12
137
239
114
125
null
null
NinjaTrappeur/DobadoBots
src/DobadoBots/Graphics/Editor.hs
bsd-3-clause
offset :: CInt offset = 14
26
offset :: CInt offset = 14
26
offset = 14
11
false
true
0
6
5
18
7
11
null
null
vshabanov/fast-tagsoup
Text/HTML/TagSoup/Fast.hs
bsd-3-clause
-- toLowerBS = B.map toLower -- toLower is inplace toLowerBS :: B.ByteString -> B.ByteString toLowerBS bs@(B.PS fp offs len) = unsafePerformIO $ withForeignPtr fp $ \ p -> do let go !_ 0 = return bs go !o l = do w <- peekByteOff p o pokeByteOff p o (B.c2w $ toLower $ B.w2c w) go (o+1) (l-1) go offs len -- | Parse a string to a list of tags. -- -- > parseTags "<div>&amp;<script>x<y</script>" == -- > [TagOpen "div" [],TagText "&",TagOpen "script" [],TagText "x<y",TagClose "script"] --
570
toLowerBS :: B.ByteString -> B.ByteString toLowerBS bs@(B.PS fp offs len) = unsafePerformIO $ withForeignPtr fp $ \ p -> do let go !_ 0 = return bs go !o l = do w <- peekByteOff p o pokeByteOff p o (B.c2w $ toLower $ B.w2c w) go (o+1) (l-1) go offs len -- | Parse a string to a list of tags. -- -- > parseTags "<div>&amp;<script>x<y</script>" == -- > [TagOpen "div" [],TagText "&",TagOpen "script" [],TagText "x<y",TagClose "script"] --
519
toLowerBS bs@(B.PS fp offs len) = unsafePerformIO $ withForeignPtr fp $ \ p -> do let go !_ 0 = return bs go !o l = do w <- peekByteOff p o pokeByteOff p o (B.c2w $ toLower $ B.w2c w) go (o+1) (l-1) go offs len -- | Parse a string to a list of tags. -- -- > parseTags "<div>&amp;<script>x<y</script>" == -- > [TagOpen "div" [],TagText "&",TagOpen "script" [],TagText "x<y",TagClose "script"] --
477
true
true
0
18
170
159
78
81
null
null
linearray/mealstrom
test/Timeout.hs
mit
timeoutEffects :: IORef Bool -> MVar () -> Msg TimeoutAction -> IO Bool timeoutEffects b sync _a = do bb <- readIORef b if bb then putMVar sync () -- if this is the second run, we proceed normally else seq (sum [1..]) (return ()) -- else we timeout return True
300
timeoutEffects :: IORef Bool -> MVar () -> Msg TimeoutAction -> IO Bool timeoutEffects b sync _a = do bb <- readIORef b if bb then putMVar sync () -- if this is the second run, we proceed normally else seq (sum [1..]) (return ()) -- else we timeout return True
300
timeoutEffects b sync _a = do bb <- readIORef b if bb then putMVar sync () -- if this is the second run, we proceed normally else seq (sum [1..]) (return ()) -- else we timeout return True
228
false
true
0
11
90
102
48
54
null
null
cstrahan/nikki
src/Utils.hs
lgpl-3.0
swapTuple :: (a, b) -> (b, a) swapTuple (a, b) = (b, a)
55
swapTuple :: (a, b) -> (b, a) swapTuple (a, b) = (b, a)
55
swapTuple (a, b) = (b, a)
25
false
true
0
8
12
48
26
22
null
null
vTurbine/ghc
compiler/typecheck/TcClassDcl.hs
bsd-3-clause
tcDefMeth :: Class -> [TyVar] -> EvVar -> LHsBinds Name -> HsSigFun -> TcPragEnv -> ClassOpItem -> TcM (LHsBinds TcId) -- Generate code for default methods -- This is incompatible with Hugs, which expects a polymorphic -- default method for every class op, regardless of whether or not -- the programmer supplied an explicit default decl for the class. -- (If necessary we can fix that, but we don't have a convenient Id to hand.) tcDefMeth _ _ _ _ _ prag_fn (sel_id, Nothing) = do { -- No default method mapM_ (addLocM (badDmPrag sel_id)) (lookupPragEnv prag_fn (idName sel_id)) ; return emptyBag }
653
tcDefMeth :: Class -> [TyVar] -> EvVar -> LHsBinds Name -> HsSigFun -> TcPragEnv -> ClassOpItem -> TcM (LHsBinds TcId) tcDefMeth _ _ _ _ _ prag_fn (sel_id, Nothing) = do { -- No default method mapM_ (addLocM (badDmPrag sel_id)) (lookupPragEnv prag_fn (idName sel_id)) ; return emptyBag }
340
tcDefMeth _ _ _ _ _ prag_fn (sel_id, Nothing) = do { -- No default method mapM_ (addLocM (badDmPrag sel_id)) (lookupPragEnv prag_fn (idName sel_id)) ; return emptyBag }
201
true
true
0
14
156
124
65
59
null
null
ghcjs/ghcjs-base
test/Tests/Marshal.hs
mit
to_from_jsval_list :: (ToJSVal a, FromJSVal a, Eq a) => TypeName a -> [a] -> Property to_from_jsval_list _ = to_from_jsval'
123
to_from_jsval_list :: (ToJSVal a, FromJSVal a, Eq a) => TypeName a -> [a] -> Property to_from_jsval_list _ = to_from_jsval'
123
to_from_jsval_list _ = to_from_jsval'
37
false
true
0
8
18
49
25
24
null
null
energyflowanalysis/efa-2.1
examples/elementary/optimalStorageUsage/Main.hs
bsd-3-clause
givenEnvHU :: [Sig.PSignal [] Double] -> EqSys.EquationSystemIgnore Node s (Data Nil Double) (Data ([] :> Nil) Double) givenEnvHU xs = let ys = zip (map Idx.Section [0..]) xs in commonEnvHU (map fst ys) <> foldMap givenEnvHUSec ys
251
givenEnvHU :: [Sig.PSignal [] Double] -> EqSys.EquationSystemIgnore Node s (Data Nil Double) (Data ([] :> Nil) Double) givenEnvHU xs = let ys = zip (map Idx.Section [0..]) xs in commonEnvHU (map fst ys) <> foldMap givenEnvHUSec ys
251
givenEnvHU xs = let ys = zip (map Idx.Section [0..]) xs in commonEnvHU (map fst ys) <> foldMap givenEnvHUSec ys
128
false
true
2
12
57
116
56
60
null
null
michalt/cvector
Data/CVector/Unboxed.hs
bsd-3-clause
fromListN :: (Unbox a) => Int -> [a] -> CVector a fromListN = G.fromListN
73
fromListN :: (Unbox a) => Int -> [a] -> CVector a fromListN = G.fromListN
73
fromListN = G.fromListN
23
false
true
0
8
13
36
19
17
null
null
antarestrader/sapphire
Text/Parsec/Pos.hs
gpl-3.0
-- | Create a new 'SourcePos' with the given source name, -- and line number and column number set to 1, the upper left. initialPos :: SourceName -> SourcePos initialPos name = newPos name 1 1
197
initialPos :: SourceName -> SourcePos initialPos name = newPos name 1 1
75
initialPos name = newPos name 1 1
37
true
true
0
5
40
27
14
13
null
null
nilthehuman/H-99
Lists.hs
unlicense
rnd_select' :: [a] -> Int -> [a] -- the type tells you this function is actually deterministic rnd_select' xs n = take n . map (xs !!) $ rIndices where rs g = let (i, g') = R.randomR (0, pred . length $ xs) g in i : rs g' rIndices = rs $ R.mkStdGen n -- use whatever little entropy we're given in n -- Problem 24
329
rnd_select' :: [a] -> Int -> [a] rnd_select' xs n = take n . map (xs !!) $ rIndices where rs g = let (i, g') = R.randomR (0, pred . length $ xs) g in i : rs g' rIndices = rs $ R.mkStdGen n -- use whatever little entropy we're given in n -- Problem 24
266
rnd_select' xs n = take n . map (xs !!) $ rIndices where rs g = let (i, g') = R.randomR (0, pred . length $ xs) g in i : rs g' rIndices = rs $ R.mkStdGen n -- use whatever little entropy we're given in n -- Problem 24
233
true
true
1
12
84
122
63
59
null
null
ian-ross/cabal
cabal-install/Distribution/Client/Init.hs
bsd-3-clause
chooseDep :: InitFlags -> (ModuleName, Maybe [InstalledPackageInfo]) -> IO (Maybe P.Dependency) chooseDep flags (m, Nothing) = message flags ("\nWarning: no package found providing " ++ display m ++ ".") >> return Nothing
238
chooseDep :: InitFlags -> (ModuleName, Maybe [InstalledPackageInfo]) -> IO (Maybe P.Dependency) chooseDep flags (m, Nothing) = message flags ("\nWarning: no package found providing " ++ display m ++ ".") >> return Nothing
237
chooseDep flags (m, Nothing) = message flags ("\nWarning: no package found providing " ++ display m ++ ".") >> return Nothing
131
false
true
0
10
48
79
40
39
null
null
nshepperd/funn
AI/Funn/Flat/Buffer.hs
mit
getVector :: Buffer -> S.Vector Double getVector (Buffer n ref) = unsafePerformIO $ do vs <- readIORef ref case vs of [] -> pure V.empty [xs] -> pure xs _ -> compact ref
190
getVector :: Buffer -> S.Vector Double getVector (Buffer n ref) = unsafePerformIO $ do vs <- readIORef ref case vs of [] -> pure V.empty [xs] -> pure xs _ -> compact ref
190
getVector (Buffer n ref) = unsafePerformIO $ do vs <- readIORef ref case vs of [] -> pure V.empty [xs] -> pure xs _ -> compact ref
151
false
true
0
12
53
86
40
46
null
null
Mahdi89/eTeak
src/Finish.hs
bsd-3-clause
-- finishRefSubsts emptyFinishContext :: FinishContext emptyFinishContext = FinishContext [] 1 []
106
emptyFinishContext :: FinishContext emptyFinishContext = FinishContext [] 1 []
78
emptyFinishContext = FinishContext [] 1 []
42
true
true
0
6
19
29
13
16
null
null
bitterharvest/BilliardBalls
src/Configure.hs
gpl-2.0
radius2 :: Double radius2 = 0.05
32
radius2 :: Double radius2 = 0.05
32
radius2 = 0.05
14
false
true
0
4
5
11
6
5
null
null
Heather/stack
src/Stack/Build.hs
bsd-3-clause
queryBuildInfo :: M env m => [Text] -- ^ selectors -> m () queryBuildInfo selectors0 = rawBuildInfo >>= select id selectors0 >>= liftIO . TIO.putStrLn . decodeUtf8 . Yaml.encode where select _ [] value = return value select front (sel:sels) value = case value of Object o -> case HM.lookup sel o of Nothing -> err "Selector not found" Just value' -> cont value' Array v -> case decimal sel of Right (i, "") | i >= 0 && i < V.length v -> cont $ v V.! i | otherwise -> err "Index out of range" _ -> err "Encountered array and needed numeric selector" _ -> err $ "Cannot apply selector to " ++ show value where cont = select (front . (sel:)) sels err msg = error $ msg ++ ": " ++ show (front [sel]) -- | Get the raw build information object
1,020
queryBuildInfo :: M env m => [Text] -- ^ selectors -> m () queryBuildInfo selectors0 = rawBuildInfo >>= select id selectors0 >>= liftIO . TIO.putStrLn . decodeUtf8 . Yaml.encode where select _ [] value = return value select front (sel:sels) value = case value of Object o -> case HM.lookup sel o of Nothing -> err "Selector not found" Just value' -> cont value' Array v -> case decimal sel of Right (i, "") | i >= 0 && i < V.length v -> cont $ v V.! i | otherwise -> err "Index out of range" _ -> err "Encountered array and needed numeric selector" _ -> err $ "Cannot apply selector to " ++ show value where cont = select (front . (sel:)) sels err msg = error $ msg ++ ": " ++ show (front [sel]) -- | Get the raw build information object
1,020
queryBuildInfo selectors0 = rawBuildInfo >>= select id selectors0 >>= liftIO . TIO.putStrLn . decodeUtf8 . Yaml.encode where select _ [] value = return value select front (sel:sels) value = case value of Object o -> case HM.lookup sel o of Nothing -> err "Selector not found" Just value' -> cont value' Array v -> case decimal sel of Right (i, "") | i >= 0 && i < V.length v -> cont $ v V.! i | otherwise -> err "Index out of range" _ -> err "Encountered array and needed numeric selector" _ -> err $ "Cannot apply selector to " ++ show value where cont = select (front . (sel:)) sels err msg = error $ msg ++ ": " ++ show (front [sel]) -- | Get the raw build information object
931
false
true
4
16
429
311
150
161
null
null
anton-dessiatov/stack
src/Stack/Build/ConstructPlan.hs
bsd-3-clause
toolWarningText :: ToolWarning -> Text toolWarningText (ToolWarning (ExeName toolName) pkgName Nothing) = "No packages found in snapshot which provide a " <> T.pack (show toolName) <> " executable, which is a build-tool dependency of " <> T.pack (show (packageNameString pkgName))
296
toolWarningText :: ToolWarning -> Text toolWarningText (ToolWarning (ExeName toolName) pkgName Nothing) = "No packages found in snapshot which provide a " <> T.pack (show toolName) <> " executable, which is a build-tool dependency of " <> T.pack (show (packageNameString pkgName))
296
toolWarningText (ToolWarning (ExeName toolName) pkgName Nothing) = "No packages found in snapshot which provide a " <> T.pack (show toolName) <> " executable, which is a build-tool dependency of " <> T.pack (show (packageNameString pkgName))
257
false
true
2
9
55
80
37
43
null
null
hvr/vector
Data/Vector/Unboxed.hs
bsd-3-clause
unsafeFreeze = G.unsafeFreeze
29
unsafeFreeze = G.unsafeFreeze
29
unsafeFreeze = G.unsafeFreeze
29
false
false
0
5
2
8
4
4
null
null
NorfairKing/the-notes
src/Macro/Tuple.hs
gpl-2.0
-- * Tuples -- | 2-tuple tuple :: Note -> Note -> Note tuple a b = pars $ commaSeparated [a, b]
96
tuple :: Note -> Note -> Note tuple a b = pars $ commaSeparated [a, b]
70
tuple a b = pars $ commaSeparated [a, b]
40
true
true
0
7
22
39
21
18
null
null
Sventimir/bridge-tools
Rotation/Interface.hs
apache-2.0
performCheck (r:rs) = gatherPairings r >> performCheck rs where gatherPairings :: [Table] -> State CheckState [RotationError] gatherPairings [] = gets errors gatherPairings ((Table _ ns we brd):ts) = let pairing = (min ns we, max ns we) play_ns = (ns, brd) play_we = (we, brd) in do CheckState pairings played_brds errs <- get if pairing `Set.member` pairings then addError $ OponentMetAgain ns we else addPairing pairing if play_ns `Set.member` played_brds then addError $ BoardPlayedAgain ns brd else addPlay play_ns if play_we `Set.member` played_brds then addError $ BoardPlayedAgain we brd else addPlay play_we gatherPairings ts addError :: RotationError -> State CheckState () addError err = modify $ \st -> st { errors = err : errors st } addPairing :: (Int, Int) -> State CheckState () addPairing p = modify $ \st -> st { pairs_met = Set.insert p (pairs_met st) } addPlay :: (Int, Int) -> State CheckState () addPlay p = modify $ \st -> st { boards_played = Set.insert p (boards_played st) }
1,335
performCheck (r:rs) = gatherPairings r >> performCheck rs where gatherPairings :: [Table] -> State CheckState [RotationError] gatherPairings [] = gets errors gatherPairings ((Table _ ns we brd):ts) = let pairing = (min ns we, max ns we) play_ns = (ns, brd) play_we = (we, brd) in do CheckState pairings played_brds errs <- get if pairing `Set.member` pairings then addError $ OponentMetAgain ns we else addPairing pairing if play_ns `Set.member` played_brds then addError $ BoardPlayedAgain ns brd else addPlay play_ns if play_we `Set.member` played_brds then addError $ BoardPlayedAgain we brd else addPlay play_we gatherPairings ts addError :: RotationError -> State CheckState () addError err = modify $ \st -> st { errors = err : errors st } addPairing :: (Int, Int) -> State CheckState () addPairing p = modify $ \st -> st { pairs_met = Set.insert p (pairs_met st) } addPlay :: (Int, Int) -> State CheckState () addPlay p = modify $ \st -> st { boards_played = Set.insert p (boards_played st) }
1,335
performCheck (r:rs) = gatherPairings r >> performCheck rs where gatherPairings :: [Table] -> State CheckState [RotationError] gatherPairings [] = gets errors gatherPairings ((Table _ ns we brd):ts) = let pairing = (min ns we, max ns we) play_ns = (ns, brd) play_we = (we, brd) in do CheckState pairings played_brds errs <- get if pairing `Set.member` pairings then addError $ OponentMetAgain ns we else addPairing pairing if play_ns `Set.member` played_brds then addError $ BoardPlayedAgain ns brd else addPlay play_ns if play_we `Set.member` played_brds then addError $ BoardPlayedAgain we brd else addPlay play_we gatherPairings ts addError :: RotationError -> State CheckState () addError err = modify $ \st -> st { errors = err : errors st } addPairing :: (Int, Int) -> State CheckState () addPairing p = modify $ \st -> st { pairs_met = Set.insert p (pairs_met st) } addPlay :: (Int, Int) -> State CheckState () addPlay p = modify $ \st -> st { boards_played = Set.insert p (boards_played st) }
1,335
false
false
0
11
500
419
216
203
null
null
wavewave/madgraph-auto-dataset
src/HEP/Automation/MadGraph/Dataset/Set20110717set7ATLAS.hs
gpl-3.0
paramSet :: [ModelParam C8V] paramSet = [ C8VParam { mnp = m, gnpR = g, gnpL = 0 } | (m,g) <- [ (400,0.75), (800,1.4) ] ]
132
paramSet :: [ModelParam C8V] paramSet = [ C8VParam { mnp = m, gnpR = g, gnpL = 0 } | (m,g) <- [ (400,0.75), (800,1.4) ] ]
132
paramSet = [ C8VParam { mnp = m, gnpR = g, gnpL = 0 } | (m,g) <- [ (400,0.75), (800,1.4) ] ]
103
false
true
0
10
37
79
45
34
null
null
md5/hs-zenfolio
Network/JsonRpc.hs
bsd-3-clause
-- | Create an XML-RPC compliant HTTP request. request :: URI -> [H.Header] -> BS.ByteString -> H.Request BS.ByteString request uri headers content = pipeline req where req = H.Request { rqURI = uri, rqMethod = POST, rqHeaders = headers, rqBody = content } pipeline :: H.Request BS.ByteString -> H.Request BS.ByteString pipeline = addDefaultUserAgent . setJsonRpcHeaders setJsonRpcHeaders :: H.Request BS.ByteString -> H.Request BS.ByteString setJsonRpcHeaders = ct . cl where ct = replaceHeader HdrContentType jsonContentType cl = replaceHeader HdrContentLength (show (BS.length content)) addDefaultUserAgent :: H.Request BS.ByteString -> H.Request BS.ByteString addDefaultUserAgent = insertHeaderIfMissing HdrUserAgent defaultUserAgent
946
request :: URI -> [H.Header] -> BS.ByteString -> H.Request BS.ByteString request uri headers content = pipeline req where req = H.Request { rqURI = uri, rqMethod = POST, rqHeaders = headers, rqBody = content } pipeline :: H.Request BS.ByteString -> H.Request BS.ByteString pipeline = addDefaultUserAgent . setJsonRpcHeaders setJsonRpcHeaders :: H.Request BS.ByteString -> H.Request BS.ByteString setJsonRpcHeaders = ct . cl where ct = replaceHeader HdrContentType jsonContentType cl = replaceHeader HdrContentLength (show (BS.length content)) addDefaultUserAgent :: H.Request BS.ByteString -> H.Request BS.ByteString addDefaultUserAgent = insertHeaderIfMissing HdrUserAgent defaultUserAgent
899
request uri headers content = pipeline req where req = H.Request { rqURI = uri, rqMethod = POST, rqHeaders = headers, rqBody = content } pipeline :: H.Request BS.ByteString -> H.Request BS.ByteString pipeline = addDefaultUserAgent . setJsonRpcHeaders setJsonRpcHeaders :: H.Request BS.ByteString -> H.Request BS.ByteString setJsonRpcHeaders = ct . cl where ct = replaceHeader HdrContentType jsonContentType cl = replaceHeader HdrContentLength (show (BS.length content)) addDefaultUserAgent :: H.Request BS.ByteString -> H.Request BS.ByteString addDefaultUserAgent = insertHeaderIfMissing HdrUserAgent defaultUserAgent
826
true
true
3
10
300
246
117
129
null
null
RayRacine/aws
Aws/Pa/Config.hs
bsd-3-clause
baseDomain :: BS.ByteString baseDomain = "amazon.com"
53
baseDomain :: BS.ByteString baseDomain = "amazon.com"
53
baseDomain = "amazon.com"
25
false
true
0
5
5
13
7
6
null
null
ctford/Idris-Elba-dev
src/Idris/REPL.hs
bsd-3-clause
ideslaveProcess fn (ExecVal t) = process stdout fn (ExecVal t)
62
ideslaveProcess fn (ExecVal t) = process stdout fn (ExecVal t)
62
ideslaveProcess fn (ExecVal t) = process stdout fn (ExecVal t)
62
false
false
0
7
9
30
14
16
null
null
geophf/1HaskellADay
exercises/HAD/Y2016/M09/D02/Solution.hs
mit
-- *Y2016.M09.D02.Solution> length $ txIndices it ~> 2646 -- whew! {-- BONUS ----------------------------------------------------------------- So, you've read a block from file. Great! Now, read the latest block securely from blockchain.info. The call-URL is: https://blockchain.info/latestblock --} latestBlockURL :: String latestBlockURL = "https://blockchain.info/latestblock"
383
latestBlockURL :: String latestBlockURL = "https://blockchain.info/latestblock"
79
latestBlockURL = "https://blockchain.info/latestblock"
54
true
true
0
4
43
13
8
5
null
null
slyrz/phantom
src/Phantom/Util.hs
mit
ansiEscLineClr = "\x1b[K"
27
ansiEscLineClr = "\x1b[K"
27
ansiEscLineClr = "\x1b[K"
27
false
false
0
4
4
6
3
3
null
null
gcross/LogicGrowsOnTrees
LogicGrowsOnTrees/tests/tests.hs
bsd-2-clause
shuffle items = do index ← choose (0,length items-1) let hd = items !! index rest = take index items ++ drop (index+1) items tl ← shuffle rest return (hd:tl) -- }}}
188
shuffle items = do index ← choose (0,length items-1) let hd = items !! index rest = take index items ++ drop (index+1) items tl ← shuffle rest return (hd:tl) -- }}}
188
shuffle items = do index ← choose (0,length items-1) let hd = items !! index rest = take index items ++ drop (index+1) items tl ← shuffle rest return (hd:tl) -- }}}
188
false
false
1
14
55
99
45
54
null
null
glhrmfrts/lusk
Lusk/Eval.hs
mit
-- Pushes a new state a level down, this means the beginning of a loop or function pushState :: (Monad m) => (MonadIO m) => SM m () pushState = do liftIO $ putStrLn "push" cs <- get put $ newState cs -- Pop the current state and make it's parent the current state -- Occurs at the end of a function or a loop
315
pushState :: (Monad m) => (MonadIO m) => SM m () pushState = do liftIO $ putStrLn "push" cs <- get put $ newState cs -- Pop the current state and make it's parent the current state -- Occurs at the end of a function or a loop
232
pushState = do liftIO $ putStrLn "push" cs <- get put $ newState cs -- Pop the current state and make it's parent the current state -- Occurs at the end of a function or a loop
183
true
true
0
9
71
72
34
38
null
null
fmapfmapfmap/amazonka
gen/src/Gen/AST/Data/Syntax.hs
mpl-2.0
seqE :: Exp -> [Exp] -> Exp seqE l [] = app pureE l
55
seqE :: Exp -> [Exp] -> Exp seqE l [] = app pureE l
55
seqE l [] = app pureE l
27
false
true
0
7
17
34
17
17
null
null
arnizamani/aiw
Domains/PropLogic.hs
gpl-2.0
isContradiction :: Exp -> Bool isContradiction e | null (getVars e) = not $ isTrue e
84
isContradiction :: Exp -> Bool isContradiction e | null (getVars e) = not $ isTrue e
84
isContradiction e | null (getVars e) = not $ isTrue e
53
false
true
0
10
15
43
19
24
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_TEXTURE5_ARB :: GLenum gl_TEXTURE5_ARB = 0x84C5
50
gl_TEXTURE5_ARB :: GLenum gl_TEXTURE5_ARB = 0x84C5
50
gl_TEXTURE5_ARB = 0x84C5
24
false
true
0
4
5
11
6
5
null
null
DavidAlphaFox/ghc
libraries/Cabal/cabal-install/Distribution/Client/Dependency/TopDown.hs
bsd-3-clause
addTopLevelTargets (pkg:pkgs) cs = case Constraints.addTarget pkg cs of Satisfiable cs' () -> addTopLevelTargets pkgs cs' Unsatisfiable -> Fail (NoSuchPackage pkg) ConflictsWith _conflicts -> impossible "addTopLevelTargets conflicts"
264
addTopLevelTargets (pkg:pkgs) cs = case Constraints.addTarget pkg cs of Satisfiable cs' () -> addTopLevelTargets pkgs cs' Unsatisfiable -> Fail (NoSuchPackage pkg) ConflictsWith _conflicts -> impossible "addTopLevelTargets conflicts"
264
addTopLevelTargets (pkg:pkgs) cs = case Constraints.addTarget pkg cs of Satisfiable cs' () -> addTopLevelTargets pkgs cs' Unsatisfiable -> Fail (NoSuchPackage pkg) ConflictsWith _conflicts -> impossible "addTopLevelTargets conflicts"
264
false
false
0
10
57
74
34
40
null
null
haskoin/haskoin
src/Haskoin/Transaction/Builder.hs
unlicense
-- | Same as 'guessTxFee' but for multisig transactions. guessMSTxFee :: Word64 -> (Int, Int) -> Int -> Int -> Word64 guessMSTxFee byteFee ms nOut nIn = byteFee * fromIntegral (guessTxSize 0 (replicate nIn ms) nOut 0)
221
guessMSTxFee :: Word64 -> (Int, Int) -> Int -> Int -> Word64 guessMSTxFee byteFee ms nOut nIn = byteFee * fromIntegral (guessTxSize 0 (replicate nIn ms) nOut 0)
164
guessMSTxFee byteFee ms nOut nIn = byteFee * fromIntegral (guessTxSize 0 (replicate nIn ms) nOut 0)
103
true
true
1
9
40
71
36
35
null
null
monsanto/hie
Hie/Language/Haskell/Exts/Fixity.hs
gpl-3.0
infix_ = fixity AssocNone
26
infix_ = fixity AssocNone
26
infix_ = fixity AssocNone
26
false
false
1
5
4
13
4
9
null
null
fmapfmapfmap/amazonka
amazonka-ds/gen/Network/AWS/DirectoryService/DescribeSnapshots.hs
mpl-2.0
-- | A list of identifiers of the snapshots to obtain the information for. If -- this member is null or empty, all snapshots are returned using the -- /Limit/ and /NextToken/ members. dsSnapshotIds :: Lens' DescribeSnapshots [Text] dsSnapshotIds = lens _dsSnapshotIds (\ s a -> s{_dsSnapshotIds = a}) . _Default . _Coerce
321
dsSnapshotIds :: Lens' DescribeSnapshots [Text] dsSnapshotIds = lens _dsSnapshotIds (\ s a -> s{_dsSnapshotIds = a}) . _Default . _Coerce
137
dsSnapshotIds = lens _dsSnapshotIds (\ s a -> s{_dsSnapshotIds = a}) . _Default . _Coerce
89
true
true
0
10
52
60
31
29
null
null
rahulmutt/ghcvm
tests/packages/Test.hs
bsd-3-clause
actualVersion :: Text -> [Int] actualVersion = map (read . T.unpack) . T.split (== '.') . actualVersion'
104
actualVersion :: Text -> [Int] actualVersion = map (read . T.unpack) . T.split (== '.') . actualVersion'
104
actualVersion = map (read . T.unpack) . T.split (== '.') . actualVersion'
73
false
true
0
10
16
47
25
22
null
null
thomasathorne/h-chu
src/Data.hs
bsd-3-clause
findValid (c:[]) = [Play Single [c]]
36
findValid (c:[]) = [Play Single [c]]
36
findValid (c:[]) = [Play Single [c]]
36
false
false
0
7
5
30
15
15
null
null
FranklinChen/hugs98-plus-Sep2006
packages/network/tests/URITest.hs
bsd-3-clause
isAbsIdT _ = False
22
isAbsIdT _ = False
22
isAbsIdT _ = False
22
false
false
0
4
7
10
4
6
null
null
alexander-at-github/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
primOpInfo DoubleGeOp = mkCompare (fsLit ">=##") doublePrimTy
61
primOpInfo DoubleGeOp = mkCompare (fsLit ">=##") doublePrimTy
61
primOpInfo DoubleGeOp = mkCompare (fsLit ">=##") doublePrimTy
61
false
false
0
7
6
20
9
11
null
null
bvdelft/parac2
src/Language/Java/Paragon/TypeCheck/Monad.hs
bsd-3-clause
scrambleT :: TcRefType -> Ident SourcePos -> Bool -> TcCodeM () scrambleT rtyO iF fresh = setState =<< transformBiM scr =<< getState -- "updateStateM" where scr :: InstanceInfo -> TcCodeM InstanceInfo scr isig = do appl <- liftTcDeclM $ (iType isig) `subTypeOf` rtyO return $ if appl && not (fresh && iFresh isig) then isig { iMembers = scrVM $ iMembers isig } else isig scrVM :: VarMap -> VarMap scrVM (VarMap {-aMap-} pMap iMap tMap) = let matches k _v = k == unIdent iF in VarMap -- (deleteIf matches aMap) (deleteIf matches pMap) (deleteIf matches iMap) tMap -- will be empty
778
scrambleT :: TcRefType -> Ident SourcePos -> Bool -> TcCodeM () scrambleT rtyO iF fresh = setState =<< transformBiM scr =<< getState -- "updateStateM" where scr :: InstanceInfo -> TcCodeM InstanceInfo scr isig = do appl <- liftTcDeclM $ (iType isig) `subTypeOf` rtyO return $ if appl && not (fresh && iFresh isig) then isig { iMembers = scrVM $ iMembers isig } else isig scrVM :: VarMap -> VarMap scrVM (VarMap {-aMap-} pMap iMap tMap) = let matches k _v = k == unIdent iF in VarMap -- (deleteIf matches aMap) (deleteIf matches pMap) (deleteIf matches iMap) tMap -- will be empty
778
scrambleT rtyO iF fresh = setState =<< transformBiM scr =<< getState -- "updateStateM" where scr :: InstanceInfo -> TcCodeM InstanceInfo scr isig = do appl <- liftTcDeclM $ (iType isig) `subTypeOf` rtyO return $ if appl && not (fresh && iFresh isig) then isig { iMembers = scrVM $ iMembers isig } else isig scrVM :: VarMap -> VarMap scrVM (VarMap {-aMap-} pMap iMap tMap) = let matches k _v = k == unIdent iF in VarMap -- (deleteIf matches aMap) (deleteIf matches pMap) (deleteIf matches iMap) tMap -- will be empty
714
false
true
6
14
301
216
110
106
null
null
pgj/bead
snaplets/fay/src/Bead/View/Fay/HookIds.hs
bsd-3-clause
assignmentStartHourField = HookId "asg-start-hour"
50
assignmentStartHourField = HookId "asg-start-hour"
50
assignmentStartHourField = HookId "asg-start-hour"
50
false
false
0
5
3
9
4
5
null
null
li-zhirui/EoplLangs
src/ExplicitRefs/Parser.hs
bsd-3-clause
listExpr :: Parser Expression listExpr = do keyWord "list" body <- parens $ sepBy expression comma return $ ListExpr body -- | Expression ::= ConstExpr -- ::= BinOpExpr -- ::= UnaryOpExpr -- ::= IfExpr -- ::= CondExpr -- ::= VarExpr -- ::= LetExpr -- ::= ProcExpr -- ::= CallExpr -- ::= LetRecExpr -- ::= BeginExpr -- ::= NewRefExpr -- ::= DeRefExpr -- ::= SetRefExpr -- ::= ListExpr
572
listExpr :: Parser Expression listExpr = do keyWord "list" body <- parens $ sepBy expression comma return $ ListExpr body -- | Expression ::= ConstExpr -- ::= BinOpExpr -- ::= UnaryOpExpr -- ::= IfExpr -- ::= CondExpr -- ::= VarExpr -- ::= LetExpr -- ::= ProcExpr -- ::= CallExpr -- ::= LetRecExpr -- ::= BeginExpr -- ::= NewRefExpr -- ::= DeRefExpr -- ::= SetRefExpr -- ::= ListExpr
572
listExpr = do keyWord "list" body <- parens $ sepBy expression comma return $ ListExpr body -- | Expression ::= ConstExpr -- ::= BinOpExpr -- ::= UnaryOpExpr -- ::= IfExpr -- ::= CondExpr -- ::= VarExpr -- ::= LetExpr -- ::= ProcExpr -- ::= CallExpr -- ::= LetRecExpr -- ::= BeginExpr -- ::= NewRefExpr -- ::= DeRefExpr -- ::= SetRefExpr -- ::= ListExpr
542
false
true
0
9
255
61
35
26
null
null
davbaumgartner/LAuREL
LAuREL/Types.hs
bsd-3-clause
-- Don't change this, it works… -- |Returns a function from the lib findFunInLib :: Lib -> Id -> LibFunction findFunInLib (Lib []) i = error $ "Undefined function " ++ i
186
findFunInLib :: Lib -> Id -> LibFunction findFunInLib (Lib []) i = error $ "Undefined function " ++ i
110
findFunInLib (Lib []) i = error $ "Undefined function " ++ i
69
true
true
2
11
48
48
23
25
null
null
ItsLastDay/academic_university_2016-2018
subjects/Haskell/coursework_tests.hs
gpl-3.0
fac''step = Lam "f" $ Lam "n" $ iif :@ (iszro :@ n) :@ one :@ (mult :@ n :@ (f :@ (pred' :@ n)))
96
fac''step = Lam "f" $ Lam "n" $ iif :@ (iszro :@ n) :@ one :@ (mult :@ n :@ (f :@ (pred' :@ n)))
96
fac''step = Lam "f" $ Lam "n" $ iif :@ (iszro :@ n) :@ one :@ (mult :@ n :@ (f :@ (pred' :@ n)))
96
false
false
0
11
24
64
33
31
null
null
banacorn/socket.io-haskell
test/Test/Unit/Session.hs
mit
testHandshake :: Assertion testHandshake = do env <- makeEnvironment -- before size <- sessionTableSize env assertEqual "number of sessions before handshake" 0 size -- after MsgHandshake sessionID _ _ _ <- runConnection env Handshake size' <- sessionTableSize env assertEqual "number of sessions after handshake" 1 size' session <- sessionLookup env sessionID case session of Just (Session i s _ _ _) -> do assertEqual "matching session ID" sessionID i assertEqual "session status" Connecting s _ -> assertFailure "session not found" -- timeout let closeTimeout' = closeTimeout (envConfiguration env) threadDelay (closeTimeout' * 1000000 + 1000000) size'' <- sessionTableSize env assertEqual "number of sessions after handshake closing timeout" 0 size'' --------------------------------------------------------------------------------
941
testHandshake :: Assertion testHandshake = do env <- makeEnvironment -- before size <- sessionTableSize env assertEqual "number of sessions before handshake" 0 size -- after MsgHandshake sessionID _ _ _ <- runConnection env Handshake size' <- sessionTableSize env assertEqual "number of sessions after handshake" 1 size' session <- sessionLookup env sessionID case session of Just (Session i s _ _ _) -> do assertEqual "matching session ID" sessionID i assertEqual "session status" Connecting s _ -> assertFailure "session not found" -- timeout let closeTimeout' = closeTimeout (envConfiguration env) threadDelay (closeTimeout' * 1000000 + 1000000) size'' <- sessionTableSize env assertEqual "number of sessions after handshake closing timeout" 0 size'' --------------------------------------------------------------------------------
941
testHandshake = do env <- makeEnvironment -- before size <- sessionTableSize env assertEqual "number of sessions before handshake" 0 size -- after MsgHandshake sessionID _ _ _ <- runConnection env Handshake size' <- sessionTableSize env assertEqual "number of sessions after handshake" 1 size' session <- sessionLookup env sessionID case session of Just (Session i s _ _ _) -> do assertEqual "matching session ID" sessionID i assertEqual "session status" Connecting s _ -> assertFailure "session not found" -- timeout let closeTimeout' = closeTimeout (envConfiguration env) threadDelay (closeTimeout' * 1000000 + 1000000) size'' <- sessionTableSize env assertEqual "number of sessions after handshake closing timeout" 0 size'' --------------------------------------------------------------------------------
914
false
true
0
12
215
209
93
116
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/types/Type.hs
bsd-3-clause
getTvSubstEnv :: TvSubst -> TvSubstEnv getTvSubstEnv (TvSubst _ env) = env
74
getTvSubstEnv :: TvSubst -> TvSubstEnv getTvSubstEnv (TvSubst _ env) = env
74
getTvSubstEnv (TvSubst _ env) = env
35
false
true
0
6
10
30
14
16
null
null
pikajude/th-printf
src/Language/Haskell/Printf.hs
mit
t :: QuasiQuoter t = quoter $ \s' -> do (lhss, rhs) <- toSplices s' OutputText return $ LamE lhss rhs -- | Like 's', but prints the resulting string to @stdout@. -- -- @ -- [p|Hello, %s! (%d people greeted)|] :: 'MonadIO' m => ... -> m () -- @
248
t :: QuasiQuoter t = quoter $ \s' -> do (lhss, rhs) <- toSplices s' OutputText return $ LamE lhss rhs -- | Like 's', but prints the resulting string to @stdout@. -- -- @ -- [p|Hello, %s! (%d people greeted)|] :: 'MonadIO' m => ... -> m () -- @
248
t = quoter $ \s' -> do (lhss, rhs) <- toSplices s' OutputText return $ LamE lhss rhs -- | Like 's', but prints the resulting string to @stdout@. -- -- @ -- [p|Hello, %s! (%d people greeted)|] :: 'MonadIO' m => ... -> m () -- @
231
false
true
2
10
55
63
31
32
null
null
d10genes/haskell-edu
e9/AParser.hs
bsd-2-clause
f _ = Nothing
13
f _ = Nothing
13
f _ = Nothing
13
false
false
0
4
3
10
4
6
null
null
olsner/ghc
compiler/prelude/THNames.hs
bsd-3-clause
conPName = libFun (fsLit "conP") conPIdKey
46
conPName = libFun (fsLit "conP") conPIdKey
46
conPName = libFun (fsLit "conP") conPIdKey
46
false
false
0
7
9
17
8
9
null
null
snoyberg/photosorter
fay/Language/Fay/JQuery.hs
bsd-2-clause
size :: JQuery -> Fay Double size = ffi "%1['length']"
54
size :: JQuery -> Fay Double size = ffi "%1['length']"
54
size = ffi "%1['length']"
25
false
true
0
6
9
21
10
11
null
null
mrkkrp/stack
test/integration/lib/StackTest.hs
bsd-3-clause
fileContentsMatch :: FilePath -> FilePath -> IO () fileContentsMatch f1 f2 = do doesExist f1 doesExist f2 f1Contents <- readFile f1 f2Contents <- readFile f2 unless (f1Contents == f2Contents) $ error ("contents do not match for " ++ show f1 ++ " " ++ show f2)
287
fileContentsMatch :: FilePath -> FilePath -> IO () fileContentsMatch f1 f2 = do doesExist f1 doesExist f2 f1Contents <- readFile f1 f2Contents <- readFile f2 unless (f1Contents == f2Contents) $ error ("contents do not match for " ++ show f1 ++ " " ++ show f2)
287
fileContentsMatch f1 f2 = do doesExist f1 doesExist f2 f1Contents <- readFile f1 f2Contents <- readFile f2 unless (f1Contents == f2Contents) $ error ("contents do not match for " ++ show f1 ++ " " ++ show f2)
236
false
true
0
14
73
107
46
61
null
null
manasij7479/hasnake
main.hs
gpl-3.0
moveSnake :: [(Int, Int)] -> Dir -> Int -> Int -> Int -> Int -> ([(Int, Int)], Int, Int) moveSnake ((a,b):xs) d x y i j= let np = nextPos (a,b) d in if np == (x,y) then let (newX, newY) = arbiter ((a,b):xs) x y d i j in (growSnake ((a,b):xs) x y, newX, newY) else ((check np i j xs):(a,b):init xs, x, y)
369
moveSnake :: [(Int, Int)] -> Dir -> Int -> Int -> Int -> Int -> ([(Int, Int)], Int, Int) moveSnake ((a,b):xs) d x y i j= let np = nextPos (a,b) d in if np == (x,y) then let (newX, newY) = arbiter ((a,b):xs) x y d i j in (growSnake ((a,b):xs) x y, newX, newY) else ((check np i j xs):(a,b):init xs, x, y)
369
moveSnake ((a,b):xs) d x y i j= let np = nextPos (a,b) d in if np == (x,y) then let (newX, newY) = arbiter ((a,b):xs) x y d i j in (growSnake ((a,b):xs) x y, newX, newY) else ((check np i j xs):(a,b):init xs, x, y)
280
false
true
0
15
130
246
134
112
null
null
WraithM/CoreCompiler
src/GraphReduction/Machine.hs
bsd-3-clause
dispatch (Push n) = push n
26
dispatch (Push n) = push n
26
dispatch (Push n) = push n
26
false
false
0
6
5
19
8
11
null
null
sdiehl/ts
src/Query.hs
mit
vexpr (EOp And a b) = vcompose (vexpr a) (vexpr b)
50
vexpr (EOp And a b) = vcompose (vexpr a) (vexpr b)
50
vexpr (EOp And a b) = vcompose (vexpr a) (vexpr b)
50
false
false
0
7
10
37
17
20
null
null
IreneKnapp/Inductive
Haskell/Inductive.hs
mit
dual (p `SPAnd` q) = dual p `SPOr` dual q
45
dual (p `SPAnd` q) = dual p `SPOr` dual q
45
dual (p `SPAnd` q) = dual p `SPOr` dual q
45
false
false
0
6
13
31
16
15
null
null
TransformingMusicology/tabcode-haskell
src/TabCode/Types.hs
gpl-3.0
twPos (SystemBreak l c _) = (l, c)
34
twPos (SystemBreak l c _) = (l, c)
34
twPos (SystemBreak l c _) = (l, c)
34
false
false
0
7
7
25
13
12
null
null
manyoo/reflex-dom
src/Reflex/Dom/Class.hs
bsd-3-clause
-- | Alias for Data.Map.singleton (=:) :: k -> a -> Map k a (=:) = Map.singleton
80
(=:) :: k -> a -> Map k a (=:) = Map.singleton
46
(=:) = Map.singleton
20
true
true
0
8
16
37
19
18
null
null
mindriot101/pandoc
tests/Tests/Readers/Markdown.hs
gpl-2.0
(=:) :: ToString c => String -> (String, c) -> Test (=:) = test markdown
77
(=:) :: ToString c => String -> (String, c) -> Test (=:) = test markdown
77
(=:) = test markdown
20
false
true
0
8
19
39
22
17
null
null