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
arianvp/binary-serialise-cbor
bench/Macro/CBOR.hs
bsd-3-clause
decodeCtrTag = (\len tag -> (tag, len)) <$> decodeListLen <*> decodeWord
72
decodeCtrTag = (\len tag -> (tag, len)) <$> decodeListLen <*> decodeWord
72
decodeCtrTag = (\len tag -> (tag, len)) <$> decodeListLen <*> decodeWord
72
false
false
0
9
10
30
17
13
null
null
typelead/epm
epm/Main.hs
bsd-3-clause
checkAction :: Flag Verbosity -> [String] -> GlobalFlags -> IO () checkAction verbosityFlag extraArgs _globalFlags = do unless (null extraArgs) $ die $ "'check' doesn't take any extra arguments: " ++ unwords extraArgs allOk <- Check.check (fromFlag verbosityFlag) unless allOk exitFailure
298
checkAction :: Flag Verbosity -> [String] -> GlobalFlags -> IO () checkAction verbosityFlag extraArgs _globalFlags = do unless (null extraArgs) $ die $ "'check' doesn't take any extra arguments: " ++ unwords extraArgs allOk <- Check.check (fromFlag verbosityFlag) unless allOk exitFailure
298
checkAction verbosityFlag extraArgs _globalFlags = do unless (null extraArgs) $ die $ "'check' doesn't take any extra arguments: " ++ unwords extraArgs allOk <- Check.check (fromFlag verbosityFlag) unless allOk exitFailure
232
false
true
0
12
50
94
43
51
null
null
brailsmt/hsrt
src/main.hs
apache-2.0
main = do args <- getArgs imgHandle <- openFile (fname args) WriteMode writeImage imgHandle $ rndr (width args) (height args) (readScene "") hClose imgHandle where fname = head width = (read . head . tail) height = (read . head . tail . tail) rndr w h scene = renderScene (mkviewport w h 1) scene
336
main = do args <- getArgs imgHandle <- openFile (fname args) WriteMode writeImage imgHandle $ rndr (width args) (height args) (readScene "") hClose imgHandle where fname = head width = (read . head . tail) height = (read . head . tail . tail) rndr w h scene = renderScene (mkviewport w h 1) scene
336
main = do args <- getArgs imgHandle <- openFile (fname args) WriteMode writeImage imgHandle $ rndr (width args) (height args) (readScene "") hClose imgHandle where fname = head width = (read . head . tail) height = (read . head . tail . tail) rndr w h scene = renderScene (mkviewport w h 1) scene
336
false
false
5
10
94
161
69
92
null
null
mbrock/HBEAM
src/Language/Erlang/BEAM/Loader.hs
gpl-3.0
parseLiteral :: ChunkData -> External parseLiteral = runGet (verify >> readExternal) where verify = getInt8 `expecting` ("external version magic", 131 :: Int)
160
parseLiteral :: ChunkData -> External parseLiteral = runGet (verify >> readExternal) where verify = getInt8 `expecting` ("external version magic", 131 :: Int)
160
parseLiteral = runGet (verify >> readExternal) where verify = getInt8 `expecting` ("external version magic", 131 :: Int)
122
false
true
0
7
23
48
27
21
null
null
sinelaw/lamdu
Lamdu/Data/Expression/Infer/Rules.hs
gpl-3.0
runRecordTypeToGetFieldType :: ExprRef -> RefExpression2 def -> RuleResult def runRecordTypeToGetFieldType getFieldTypeRef (recordTypeExpr, fieldTag) = do guid <- fieldTag ^.. ExprLens.exprTag (_, fieldType) <- recordTypeExpr ^.. recordField guid [(getFieldTypeRef, fieldType)]
283
runRecordTypeToGetFieldType :: ExprRef -> RefExpression2 def -> RuleResult def runRecordTypeToGetFieldType getFieldTypeRef (recordTypeExpr, fieldTag) = do guid <- fieldTag ^.. ExprLens.exprTag (_, fieldType) <- recordTypeExpr ^.. recordField guid [(getFieldTypeRef, fieldType)]
283
runRecordTypeToGetFieldType getFieldTypeRef (recordTypeExpr, fieldTag) = do guid <- fieldTag ^.. ExprLens.exprTag (_, fieldType) <- recordTypeExpr ^.. recordField guid [(getFieldTypeRef, fieldType)]
204
false
true
0
9
34
81
41
40
null
null
gnn/Hets
RDF/Print.hs
gpl-2.0
printTriples :: Triples -> Doc printTriples (Triples s ls) = pretty s <+> ppWithSemis ls <+> dot
96
printTriples :: Triples -> Doc printTriples (Triples s ls) = pretty s <+> ppWithSemis ls <+> dot
96
printTriples (Triples s ls) = pretty s <+> ppWithSemis ls <+> dot
65
false
true
0
7
16
40
19
21
null
null
ssaavedra/liquidhaskell
docs/slides/BOS14/hs/long/GhcListSort.hs
bsd-3-clause
-- qsort is stable and does not concatenate. qsort :: (Ord a) => a -> [a] -> [a] -> [a] qsort _ [] r = r
109
qsort :: (Ord a) => a -> [a] -> [a] -> [a] qsort _ [] r = r
64
qsort _ [] r = r
20
true
true
0
11
30
57
29
28
null
null
ngzax/urbit
pkg/hs/urbit-king/lib/Urbit/King/Main.hs
mit
-------------------------------------------------------------------------------- checkEvs :: forall e. HasLogFunc e => FilePath -> Word64 -> Word64 -> RIO e () checkEvs pierPath first last = do rwith (Log.existing logPath) $ \log -> do let ident = Log.identity log let pbSty = PB.defStyle { PB.stylePostfix = PB.exact } logTrace (displayShow ident) last <- Log.lastEv log <&> \lastReal -> min last lastReal let evCount = fromIntegral (last - first) pb <- PB.newProgressBar pbSty 10 (PB.Progress 1 evCount ()) runConduit $ Log.streamEvents log first .| showEvents pb first (fromIntegral $ lifecycleLen ident) where logPath :: FilePath logPath = pierPath <> "/.urb/log" showEvents :: PB.ProgressBar () -> EventId -> EventId -> ConduitT ByteString Void (RIO e) () showEvents pb eId _ | eId > last = pure () showEvents pb eId cycle = await >>= \case Nothing -> do lift $ PB.killProgressBar pb lift $ logTrace "Everything checks out." Just bs -> do lift $ PB.incProgress pb 1 lift $ do n <- io $ cueBSExn bs when (eId > cycle) $ do (mug, wen, evNoun) <- unpackJob n fromNounErr evNoun & \case Left err -> logError (displayShow (eId, err)) Right (_ ∷ Ev) -> pure () showEvents pb (succ eId) cycle unpackJob :: Noun -> RIO e (Mug, Wen, Noun) unpackJob = io . fromNounExn -------------------------------------------------------------------------------- {-| This runs the serf at `$top/.tmpdir`, but we disable snapshots, so this should never actually be created. We just do this to avoid letting the serf use an existing snapshot. -}
1,880
checkEvs :: forall e. HasLogFunc e => FilePath -> Word64 -> Word64 -> RIO e () checkEvs pierPath first last = do rwith (Log.existing logPath) $ \log -> do let ident = Log.identity log let pbSty = PB.defStyle { PB.stylePostfix = PB.exact } logTrace (displayShow ident) last <- Log.lastEv log <&> \lastReal -> min last lastReal let evCount = fromIntegral (last - first) pb <- PB.newProgressBar pbSty 10 (PB.Progress 1 evCount ()) runConduit $ Log.streamEvents log first .| showEvents pb first (fromIntegral $ lifecycleLen ident) where logPath :: FilePath logPath = pierPath <> "/.urb/log" showEvents :: PB.ProgressBar () -> EventId -> EventId -> ConduitT ByteString Void (RIO e) () showEvents pb eId _ | eId > last = pure () showEvents pb eId cycle = await >>= \case Nothing -> do lift $ PB.killProgressBar pb lift $ logTrace "Everything checks out." Just bs -> do lift $ PB.incProgress pb 1 lift $ do n <- io $ cueBSExn bs when (eId > cycle) $ do (mug, wen, evNoun) <- unpackJob n fromNounErr evNoun & \case Left err -> logError (displayShow (eId, err)) Right (_ ∷ Ev) -> pure () showEvents pb (succ eId) cycle unpackJob :: Noun -> RIO e (Mug, Wen, Noun) unpackJob = io . fromNounExn -------------------------------------------------------------------------------- {-| This runs the serf at `$top/.tmpdir`, but we disable snapshots, so this should never actually be created. We just do this to avoid letting the serf use an existing snapshot. -}
1,798
checkEvs pierPath first last = do rwith (Log.existing logPath) $ \log -> do let ident = Log.identity log let pbSty = PB.defStyle { PB.stylePostfix = PB.exact } logTrace (displayShow ident) last <- Log.lastEv log <&> \lastReal -> min last lastReal let evCount = fromIntegral (last - first) pb <- PB.newProgressBar pbSty 10 (PB.Progress 1 evCount ()) runConduit $ Log.streamEvents log first .| showEvents pb first (fromIntegral $ lifecycleLen ident) where logPath :: FilePath logPath = pierPath <> "/.urb/log" showEvents :: PB.ProgressBar () -> EventId -> EventId -> ConduitT ByteString Void (RIO e) () showEvents pb eId _ | eId > last = pure () showEvents pb eId cycle = await >>= \case Nothing -> do lift $ PB.killProgressBar pb lift $ logTrace "Everything checks out." Just bs -> do lift $ PB.incProgress pb 1 lift $ do n <- io $ cueBSExn bs when (eId > cycle) $ do (mug, wen, evNoun) <- unpackJob n fromNounErr evNoun & \case Left err -> logError (displayShow (eId, err)) Right (_ ∷ Ev) -> pure () showEvents pb (succ eId) cycle unpackJob :: Noun -> RIO e (Mug, Wen, Noun) unpackJob = io . fromNounExn -------------------------------------------------------------------------------- {-| This runs the serf at `$top/.tmpdir`, but we disable snapshots, so this should never actually be created. We just do this to avoid letting the serf use an existing snapshot. -}
1,719
true
true
33
16
596
511
262
249
null
null
benarmston/hpastie
src/Site.hs
bsd-3-clause
------------------------------------------------------------------------------ -- | Renders a form to add a new paste. pasteFormH :: Application () pasteFormH = renderView $ pasteFormV [] nullPaste
197
pasteFormH :: Application () pasteFormH = renderView $ pasteFormV [] nullPaste
78
pasteFormH = renderView $ pasteFormV [] nullPaste
49
true
true
0
7
21
29
15
14
null
null
GaloisInc/saw-script
saw-core/src/Verifier/SAW/Simulator/Prims.hs
bsd-3-clause
natCaseOp :: (VMonad l, Show (Extra l)) => Prim l natCaseOp = constFun $ primFun $ \z -> primFun $ \s -> natFun $ \n -> Prim $ if n == 0 then force z else do s' <- force s apply s' (ready (VNat (n - 1))) -------------------------------------------------------------------------------- -- Strings
328
natCaseOp :: (VMonad l, Show (Extra l)) => Prim l natCaseOp = constFun $ primFun $ \z -> primFun $ \s -> natFun $ \n -> Prim $ if n == 0 then force z else do s' <- force s apply s' (ready (VNat (n - 1))) -------------------------------------------------------------------------------- -- Strings
328
natCaseOp = constFun $ primFun $ \z -> primFun $ \s -> natFun $ \n -> Prim $ if n == 0 then force z else do s' <- force s apply s' (ready (VNat (n - 1))) -------------------------------------------------------------------------------- -- Strings
278
false
true
10
15
83
135
65
70
null
null
brendanhay/gogol
gogol-groups-settings/gen/Network/Google/GroupsSettings/Types/Product.hs
mpl-2.0
-- | Enables members to post messages as the group. Possible values are: - -- true: Group member can post messages using the group\'s email address -- instead of their own email address. Message appear to originate from the -- group itself. Note: When true, any message moderation settings on -- individual users or new members do not apply to posts made on behalf of -- the group. - false: Members can not post in behalf of the group\'s email -- address. gMembersCanPostAsTheGroup :: Lens' Groups (Maybe Text) gMembersCanPostAsTheGroup = lens _gMembersCanPostAsTheGroup (\ s a -> s{_gMembersCanPostAsTheGroup = a})
623
gMembersCanPostAsTheGroup :: Lens' Groups (Maybe Text) gMembersCanPostAsTheGroup = lens _gMembersCanPostAsTheGroup (\ s a -> s{_gMembersCanPostAsTheGroup = a})
167
gMembersCanPostAsTheGroup = lens _gMembersCanPostAsTheGroup (\ s a -> s{_gMembersCanPostAsTheGroup = a})
112
true
true
0
9
106
54
31
23
null
null
siddhanathan/ghc
compiler/prelude/PrimOp.hs
bsd-3-clause
compare_fun_ty ty = mkFunTys [ty, ty] intPrimTy
47
compare_fun_ty ty = mkFunTys [ty, ty] intPrimTy
47
compare_fun_ty ty = mkFunTys [ty, ty] intPrimTy
47
false
false
0
6
6
20
10
10
null
null
vape-nation/owt-api
app/Main.hs
mit
main :: IO () main = run 8081 tourServer
40
main :: IO () main = run 8081 tourServer
40
main = run 8081 tourServer
26
false
true
0
6
8
21
10
11
null
null
bachase/cis194
hw7/JoinList.hs
mit
foldJ :: (Sized b, Monoid b) => r -> (Int -> JoinList b a -> r) -> (Int -> Int -> r -> r -> r) -> Int -> JoinList b a -> r foldJ e _ _ _ Empty = e
154
foldJ :: (Sized b, Monoid b) => r -> (Int -> JoinList b a -> r) -> (Int -> Int -> r -> r -> r) -> Int -> JoinList b a -> r foldJ e _ _ _ Empty = e
154
foldJ e _ _ _ Empty = e
23
false
true
0
14
49
103
50
53
null
null
facebookarchive/lex-pass
src/Lang/Php/Ast/StmtParse.hs
bsd-3-clause
postOp :: PostOp -> Parser a -> ExprOpP postOp o p = do ws2 <- p >> parse return $ \ (e, ws1) -> (ExprPostOp o e ws1, ws2)
126
postOp :: PostOp -> Parser a -> ExprOpP postOp o p = do ws2 <- p >> parse return $ \ (e, ws1) -> (ExprPostOp o e ws1, ws2)
126
postOp o p = do ws2 <- p >> parse return $ \ (e, ws1) -> (ExprPostOp o e ws1, ws2)
86
false
true
0
11
32
75
36
39
null
null
TomMD/ghc
compiler/main/GhcMake.hs
bsd-3-clause
typecheckLoop :: DynFlags -> HscEnv -> [ModuleName] -> IO HscEnv typecheckLoop dflags hsc_env mods = do debugTraceMsg dflags 2 $ text "Re-typechecking loop: " <> ppr mods new_hpt <- fixIO $ \new_hpt -> do let new_hsc_env = hsc_env{ hsc_HPT = new_hpt } mds <- initIfaceCheck new_hsc_env $ mapM (typecheckIface . hm_iface) hmis let new_hpt = addListToUFM old_hpt (zip mods [ hmi{ hm_details = details } | (hmi,details) <- zip hmis mds ]) return new_hpt return hsc_env{ hsc_HPT = new_hpt } where old_hpt = hsc_HPT hsc_env hmis = map (expectJust "typecheckLoop" . lookupUFM old_hpt) mods
709
typecheckLoop :: DynFlags -> HscEnv -> [ModuleName] -> IO HscEnv typecheckLoop dflags hsc_env mods = do debugTraceMsg dflags 2 $ text "Re-typechecking loop: " <> ppr mods new_hpt <- fixIO $ \new_hpt -> do let new_hsc_env = hsc_env{ hsc_HPT = new_hpt } mds <- initIfaceCheck new_hsc_env $ mapM (typecheckIface . hm_iface) hmis let new_hpt = addListToUFM old_hpt (zip mods [ hmi{ hm_details = details } | (hmi,details) <- zip hmis mds ]) return new_hpt return hsc_env{ hsc_HPT = new_hpt } where old_hpt = hsc_HPT hsc_env hmis = map (expectJust "typecheckLoop" . lookupUFM old_hpt) mods
709
typecheckLoop dflags hsc_env mods = do debugTraceMsg dflags 2 $ text "Re-typechecking loop: " <> ppr mods new_hpt <- fixIO $ \new_hpt -> do let new_hsc_env = hsc_env{ hsc_HPT = new_hpt } mds <- initIfaceCheck new_hsc_env $ mapM (typecheckIface . hm_iface) hmis let new_hpt = addListToUFM old_hpt (zip mods [ hmi{ hm_details = details } | (hmi,details) <- zip hmis mds ]) return new_hpt return hsc_env{ hsc_HPT = new_hpt } where old_hpt = hsc_HPT hsc_env hmis = map (expectJust "typecheckLoop" . lookupUFM old_hpt) mods
644
false
true
0
21
219
223
108
115
null
null
crackleware/hscolour
Language/Haskell/HsColour/LaTeX.hs
gpl-2.0
latexColour Green = "green"
29
latexColour Green = "green"
29
latexColour Green = "green"
29
false
false
0
5
5
9
4
5
null
null
ezyang/ghc
libraries/base/GHC/IO/Buffer.hs
bsd-3-clause
summaryBuffer :: Buffer a -> String summaryBuffer !buf -- Strict => slightly better code = "buf" ++ show (bufSize buf) ++ "(" ++ show (bufL buf) ++ "-" ++ show (bufR buf) ++ ")"
181
summaryBuffer :: Buffer a -> String summaryBuffer !buf -- Strict => slightly better code = "buf" ++ show (bufSize buf) ++ "(" ++ show (bufL buf) ++ "-" ++ show (bufR buf) ++ ")"
181
summaryBuffer !buf -- Strict => slightly better code = "buf" ++ show (bufSize buf) ++ "(" ++ show (bufL buf) ++ "-" ++ show (bufR buf) ++ ")"
145
false
true
2
11
37
82
37
45
null
null
rueshyna/gogol
gogol-taskqueue/gen/Network/Google/Resource/TaskQueue/Tasks/List.hs
mpl-2.0
-- | The id of the taskqueue to list tasks from. tTaskQueue :: Lens' TasksList Text tTaskQueue = lens _tTaskQueue (\ s a -> s{_tTaskQueue = a})
145
tTaskQueue :: Lens' TasksList Text tTaskQueue = lens _tTaskQueue (\ s a -> s{_tTaskQueue = a})
96
tTaskQueue = lens _tTaskQueue (\ s a -> s{_tTaskQueue = a})
61
true
true
0
9
28
42
22
20
null
null
dsorokin/aivika-experiment-chart
examples/SingleLaneTraffic/Model.hs
bsd-3-clause
odel1 = model lightTime1
25
model1 = model lightTime1
25
model1 = model lightTime1
25
false
false
1
4
4
12
4
8
null
null
scrive/consumers
test/Test.hs
bsd-3-clause
createTableMigration :: (MonadDB m) => Table -> Migration m createTableMigration tbl = Migration { mgrTableName = tblName tbl , mgrFrom = 0 , mgrAction = StandardMigration $ do createTable True tbl }
221
createTableMigration :: (MonadDB m) => Table -> Migration m createTableMigration tbl = Migration { mgrTableName = tblName tbl , mgrFrom = 0 , mgrAction = StandardMigration $ do createTable True tbl }
221
createTableMigration tbl = Migration { mgrTableName = tblName tbl , mgrFrom = 0 , mgrAction = StandardMigration $ do createTable True tbl }
161
false
true
0
11
53
69
35
34
null
null
Motions/motions
Setup.hs
apache-2.0
protoDescriptionFile :: String protoDescriptionFile = "https://raw.githubusercontent.com/Motions/Format/627f467b65595a1ff24a2c5b99b921d2f69aa2ed/message.proto"
163
protoDescriptionFile :: String protoDescriptionFile = "https://raw.githubusercontent.com/Motions/Format/627f467b65595a1ff24a2c5b99b921d2f69aa2ed/message.proto"
163
protoDescriptionFile = "https://raw.githubusercontent.com/Motions/Format/627f467b65595a1ff24a2c5b99b921d2f69aa2ed/message.proto"
132
false
true
0
4
9
11
6
5
null
null
tokyo-jesus/university
src/haskell/higherOrderFunctions/quicksort.hs
unlicense
quicksort (x:xs) = let smallerSorted = quicksort (filter (<=x) xs) biggerSorted = quicksort (filter (>x) xs) in smallerSorted ++ [x] ++ biggerSorted
164
quicksort (x:xs) = let smallerSorted = quicksort (filter (<=x) xs) biggerSorted = quicksort (filter (>x) xs) in smallerSorted ++ [x] ++ biggerSorted
164
quicksort (x:xs) = let smallerSorted = quicksort (filter (<=x) xs) biggerSorted = quicksort (filter (>x) xs) in smallerSorted ++ [x] ++ biggerSorted
164
false
false
0
12
37
73
38
35
null
null
snoyberg/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
emitCloneArray :: CLabel -> CmmFormal -> CmmExpr -> CmmExpr -> WordOff -> FCode () emitCloneArray info_p res_r src src_off n = do dflags <- getDynFlags let info_ptr = mkLblExpr info_p rep = arrPtrsRep dflags n tickyAllocPrim (mkIntExpr dflags (arrPtrsHdrSize dflags)) (mkIntExpr dflags (nonHdrSize dflags rep)) (zeroExpr dflags) let hdr_size = fixedHdrSize dflags base <- allocHeapClosure rep info_ptr curCCS [ (mkIntExpr dflags n, hdr_size + oFFSET_StgMutArrPtrs_ptrs dflags) , (mkIntExpr dflags (nonHdrSizeW rep), hdr_size + oFFSET_StgMutArrPtrs_size dflags) ] arr <- CmmLocal `fmap` newTemp (bWord dflags) emit $ mkAssign arr base dst_p <- assignTempE $ cmmOffsetB dflags (CmmReg arr) (arrPtrsHdrSize dflags) src_p <- assignTempE $ cmmOffsetExprW dflags src (cmmAddWord dflags (mkIntExpr dflags (arrPtrsHdrSizeW dflags)) src_off) emitMemcpyCall dst_p src_p (mkIntExpr dflags (wordsToBytes dflags n)) (wORD_SIZE dflags) emit $ mkAssign (CmmLocal res_r) (CmmReg arr) -- | Takes an info table label, a register to return the newly -- allocated array in, a source array, an offset in the source array, -- and the number of elements to copy. Allocates a new array and -- initializes it from the source array.
1,457
emitCloneArray :: CLabel -> CmmFormal -> CmmExpr -> CmmExpr -> WordOff -> FCode () emitCloneArray info_p res_r src src_off n = do dflags <- getDynFlags let info_ptr = mkLblExpr info_p rep = arrPtrsRep dflags n tickyAllocPrim (mkIntExpr dflags (arrPtrsHdrSize dflags)) (mkIntExpr dflags (nonHdrSize dflags rep)) (zeroExpr dflags) let hdr_size = fixedHdrSize dflags base <- allocHeapClosure rep info_ptr curCCS [ (mkIntExpr dflags n, hdr_size + oFFSET_StgMutArrPtrs_ptrs dflags) , (mkIntExpr dflags (nonHdrSizeW rep), hdr_size + oFFSET_StgMutArrPtrs_size dflags) ] arr <- CmmLocal `fmap` newTemp (bWord dflags) emit $ mkAssign arr base dst_p <- assignTempE $ cmmOffsetB dflags (CmmReg arr) (arrPtrsHdrSize dflags) src_p <- assignTempE $ cmmOffsetExprW dflags src (cmmAddWord dflags (mkIntExpr dflags (arrPtrsHdrSizeW dflags)) src_off) emitMemcpyCall dst_p src_p (mkIntExpr dflags (wordsToBytes dflags n)) (wORD_SIZE dflags) emit $ mkAssign (CmmLocal res_r) (CmmReg arr) -- | Takes an info table label, a register to return the newly -- allocated array in, a source array, an offset in the source array, -- and the number of elements to copy. Allocates a new array and -- initializes it from the source array.
1,457
emitCloneArray info_p res_r src src_off n = do dflags <- getDynFlags let info_ptr = mkLblExpr info_p rep = arrPtrsRep dflags n tickyAllocPrim (mkIntExpr dflags (arrPtrsHdrSize dflags)) (mkIntExpr dflags (nonHdrSize dflags rep)) (zeroExpr dflags) let hdr_size = fixedHdrSize dflags base <- allocHeapClosure rep info_ptr curCCS [ (mkIntExpr dflags n, hdr_size + oFFSET_StgMutArrPtrs_ptrs dflags) , (mkIntExpr dflags (nonHdrSizeW rep), hdr_size + oFFSET_StgMutArrPtrs_size dflags) ] arr <- CmmLocal `fmap` newTemp (bWord dflags) emit $ mkAssign arr base dst_p <- assignTempE $ cmmOffsetB dflags (CmmReg arr) (arrPtrsHdrSize dflags) src_p <- assignTempE $ cmmOffsetExprW dflags src (cmmAddWord dflags (mkIntExpr dflags (arrPtrsHdrSizeW dflags)) src_off) emitMemcpyCall dst_p src_p (mkIntExpr dflags (wordsToBytes dflags n)) (wORD_SIZE dflags) emit $ mkAssign (CmmLocal res_r) (CmmReg arr) -- | Takes an info table label, a register to return the newly -- allocated array in, a source array, an offset in the source array, -- and the number of elements to copy. Allocates a new array and -- initializes it from the source array.
1,359
false
true
0
15
425
366
176
190
null
null
apauley/parallel-frequency
src/Utf8Chunk.hs
mit
breakLengthUtf8 :: (Char -> Bool) -> B.ByteString -> Int -- keep getting text until it's safe to break -- return the number of bytes consumed breakLengthUtf8 canBreak = go 0 where go !count s = case fromUtf8 s of Nothing -> count Just (t, bytes) | canBreak (T.last t) -> count | otherwise -> go (count + bytes) (B.drop bytes s)
361
breakLengthUtf8 :: (Char -> Bool) -> B.ByteString -> Int breakLengthUtf8 canBreak = go 0 where go !count s = case fromUtf8 s of Nothing -> count Just (t, bytes) | canBreak (T.last t) -> count | otherwise -> go (count + bytes) (B.drop bytes s)
276
breakLengthUtf8 canBreak = go 0 where go !count s = case fromUtf8 s of Nothing -> count Just (t, bytes) | canBreak (T.last t) -> count | otherwise -> go (count + bytes) (B.drop bytes s)
219
true
true
0
14
94
126
61
65
null
null
paulrpotts/arctic-slide-haskell
ArcticSlideCore.hs
unlicense
collide :: [ Tile ] -> [ Tile ] collide [] = []
47
collide :: [ Tile ] -> [ Tile ] collide [] = []
47
collide [] = []
15
false
true
0
8
12
34
16
18
null
null
HackerFoo/peg
Peg.hs
gpl-3.0
getLinesFromFile f = withFile f ReadMode hGetLines
50
getLinesFromFile f = withFile f ReadMode hGetLines
50
getLinesFromFile f = withFile f ReadMode hGetLines
50
false
false
0
5
6
16
7
9
null
null
zmthy/http-media
src/Network/HTTP/Media/MediaType.hs
mit
------------------------------------------------------------------------------ -- | Retrieves a parameter from a 'MediaType'. (/.) :: MediaType -> ByteString -> Maybe (CI ByteString) (MediaType _ _ p) /. k = Map.lookup (CI.mk k) p
230
(/.) :: MediaType -> ByteString -> Maybe (CI ByteString) (MediaType _ _ p) /. k = Map.lookup (CI.mk k) p
104
(MediaType _ _ p) /. k = Map.lookup (CI.mk k) p
47
true
true
0
9
28
66
33
33
null
null
bvdelft/parac2
src/Language/Java/Paragon/TypeCheck/Monad/CodeEnv.hs
bsd-3-clause
thisFE :: B.ByteString -> Entity thisFE = ThisFieldEntity
57
thisFE :: B.ByteString -> Entity thisFE = ThisFieldEntity
57
thisFE = ThisFieldEntity
24
false
true
0
7
7
24
10
14
null
null
beni55/cryptol
src/Cryptol/ModuleSystem/Renamer.hs
bsd-3-clause
-- | Throw errors for any names that overlap in a rewrite environment. checkNamingEnv :: NamingEnv -> ([RenamerError],[RenamerWarning]) checkNamingEnv env = (out, []) where out = Map.foldr check outTys (neExprs env) outTys = Map.foldr check mempty (neTypes env) check ns acc = containsOverlap ns ++ acc -- Renaming --------------------------------------------------------------------
397
checkNamingEnv :: NamingEnv -> ([RenamerError],[RenamerWarning]) checkNamingEnv env = (out, []) where out = Map.foldr check outTys (neExprs env) outTys = Map.foldr check mempty (neTypes env) check ns acc = containsOverlap ns ++ acc -- Renaming --------------------------------------------------------------------
326
checkNamingEnv env = (out, []) where out = Map.foldr check outTys (neExprs env) outTys = Map.foldr check mempty (neTypes env) check ns acc = containsOverlap ns ++ acc -- Renaming --------------------------------------------------------------------
261
true
true
0
7
62
100
53
47
null
null
brendanhay/gogol
gogol-serviceusage/gen/Network/Google/ServiceUsage/Types/Product.hs
mpl-2.0
-- | The human-readable name for this log. This information appears on the -- user interface and should be concise. ldDisplayName :: Lens' LogDescriptor (Maybe Text) ldDisplayName = lens _ldDisplayName (\ s a -> s{_ldDisplayName = a})
242
ldDisplayName :: Lens' LogDescriptor (Maybe Text) ldDisplayName = lens _ldDisplayName (\ s a -> s{_ldDisplayName = a})
126
ldDisplayName = lens _ldDisplayName (\ s a -> s{_ldDisplayName = a})
76
true
true
0
9
44
49
26
23
null
null
aburnett88/HSat
tests-src/Test/Problem/Instances/Common/Clause.hs
mit
mkClauseFromLitsTest1 :: TestTree mkClauseFromLitsTest1 = testProperty ("let V.length lits " `equiv` " size cl,"++ "V.toList cl " `equiv` " lits in cl = mkClauseFromLits lits") (\lits -> let clause = mkClauseFromLits lits exptdSize = toEnum $ length lits exptdLits = V.fromList lits valSize = getSizeClause clause valLits = getVectLiteral clause in (exptdSize === valSize) .&&. (exptdLits === valLits) )
479
mkClauseFromLitsTest1 :: TestTree mkClauseFromLitsTest1 = testProperty ("let V.length lits " `equiv` " size cl,"++ "V.toList cl " `equiv` " lits in cl = mkClauseFromLits lits") (\lits -> let clause = mkClauseFromLits lits exptdSize = toEnum $ length lits exptdLits = V.fromList lits valSize = getSizeClause clause valLits = getVectLiteral clause in (exptdSize === valSize) .&&. (exptdLits === valLits) )
479
mkClauseFromLitsTest1 = testProperty ("let V.length lits " `equiv` " size cl,"++ "V.toList cl " `equiv` " lits in cl = mkClauseFromLits lits") (\lits -> let clause = mkClauseFromLits lits exptdSize = toEnum $ length lits exptdLits = V.fromList lits valSize = getSizeClause clause valLits = getVectLiteral clause in (exptdSize === valSize) .&&. (exptdLits === valLits) )
445
false
true
0
12
134
114
60
54
null
null
ndmitchell/hlint
src/Timing.hs
bsd-3-clause
timedIO :: Category -> Item -> IO a -> IO a timedIO c i x = if not useTimings then x else do let quiet = c == "Hint" unless quiet $ whenLoud $ do putStr $ "# " ++ c ++ " of " ++ i ++ "... " hFlush stdout (time, x) <- duration x atomicModifyIORef'_ timings $ Map.insertWith (+) (c, i) time unless quiet $ whenLoud $ putStrLn $ "took " ++ showDuration time pure x
401
timedIO :: Category -> Item -> IO a -> IO a timedIO c i x = if not useTimings then x else do let quiet = c == "Hint" unless quiet $ whenLoud $ do putStr $ "# " ++ c ++ " of " ++ i ++ "... " hFlush stdout (time, x) <- duration x atomicModifyIORef'_ timings $ Map.insertWith (+) (c, i) time unless quiet $ whenLoud $ putStrLn $ "took " ++ showDuration time pure x
401
timedIO c i x = if not useTimings then x else do let quiet = c == "Hint" unless quiet $ whenLoud $ do putStr $ "# " ++ c ++ " of " ++ i ++ "... " hFlush stdout (time, x) <- duration x atomicModifyIORef'_ timings $ Map.insertWith (+) (c, i) time unless quiet $ whenLoud $ putStrLn $ "took " ++ showDuration time pure x
357
false
true
0
16
118
182
84
98
null
null
cocreature/leksah
src/IDE/TextEditor/CodeMirror.hs
gpl-2.0
runCM :: CodeMirrorRef -> CM a -> IDEM a runCM (v, mvar) f = liftIO $ do s <- guiTakeMVar mvar runReaderT (runReaderT f (v, s)) (cmContext s) where guiTakeMVar mvar = do maybeValue <- tryTakeMVar mvar case maybeValue of Just value -> do putMVar mvar value return value Nothing -> do debugM "leksah" "looping" s <- loop mvar debugM "leksah" "done looping" return s loop mvar = do maybeValue <- tryTakeMVar mvar case maybeValue of Just value -> do putMVar mvar value return value Nothing -> do mainIteration loop mvar
779
runCM :: CodeMirrorRef -> CM a -> IDEM a runCM (v, mvar) f = liftIO $ do s <- guiTakeMVar mvar runReaderT (runReaderT f (v, s)) (cmContext s) where guiTakeMVar mvar = do maybeValue <- tryTakeMVar mvar case maybeValue of Just value -> do putMVar mvar value return value Nothing -> do debugM "leksah" "looping" s <- loop mvar debugM "leksah" "done looping" return s loop mvar = do maybeValue <- tryTakeMVar mvar case maybeValue of Just value -> do putMVar mvar value return value Nothing -> do mainIteration loop mvar
779
runCM (v, mvar) f = liftIO $ do s <- guiTakeMVar mvar runReaderT (runReaderT f (v, s)) (cmContext s) where guiTakeMVar mvar = do maybeValue <- tryTakeMVar mvar case maybeValue of Just value -> do putMVar mvar value return value Nothing -> do debugM "leksah" "looping" s <- loop mvar debugM "leksah" "done looping" return s loop mvar = do maybeValue <- tryTakeMVar mvar case maybeValue of Just value -> do putMVar mvar value return value Nothing -> do mainIteration loop mvar
738
false
true
0
14
354
236
101
135
null
null
ku-fpg/kansas-amber
System/Hardware/Haskino/Compiler.hs
bsd-3-clause
compileProcedure (IterateUnitW32E br iv bf) = do b <- nextBind let bb = RemBindI b i <- nextBind let bi = RemBindUnit i j <- nextBind let bj = RemBindW32 j _ <- compileIterateProcedure UnitType Word32Type b bb br i bi j bj iv bf return bj
270
compileProcedure (IterateUnitW32E br iv bf) = do b <- nextBind let bb = RemBindI b i <- nextBind let bi = RemBindUnit i j <- nextBind let bj = RemBindW32 j _ <- compileIterateProcedure UnitType Word32Type b bb br i bi j bj iv bf return bj
270
compileProcedure (IterateUnitW32E br iv bf) = do b <- nextBind let bb = RemBindI b i <- nextBind let bi = RemBindUnit i j <- nextBind let bj = RemBindW32 j _ <- compileIterateProcedure UnitType Word32Type b bb br i bi j bj iv bf return bj
270
false
false
0
10
78
112
49
63
null
null
GaloisInc/sk-dev-platform
libs/SCD/testsrc/SCD/M4/Test/Dependencies.hs
bsd-3-clause
printSortedCalls :: [[M4Id]] -> IO () printSortedCalls = do putStrLn . render . above . map (sep . map pp)
108
printSortedCalls :: [[M4Id]] -> IO () printSortedCalls = do putStrLn . render . above . map (sep . map pp)
108
printSortedCalls = do putStrLn . render . above . map (sep . map pp)
70
false
true
0
12
21
60
28
32
null
null
pbv/codex
src/Codex/Config.hs
mit
-- | custom mime type mapping mimeTypes :: MimeMap mimeTypes = HM.union defaultMimeTypes $ HM.fromList [(".mdown", "text/markdown"), (".md", "text/markdown"), (".tst", "text/plain"), (".cfg", "text/plain") ]
281
mimeTypes :: MimeMap mimeTypes = HM.union defaultMimeTypes $ HM.fromList [(".mdown", "text/markdown"), (".md", "text/markdown"), (".tst", "text/plain"), (".cfg", "text/plain") ]
251
mimeTypes = HM.union defaultMimeTypes $ HM.fromList [(".mdown", "text/markdown"), (".md", "text/markdown"), (".tst", "text/plain"), (".cfg", "text/plain") ]
230
true
true
0
8
97
65
37
28
null
null
jasonzoladz/persistent
persistent-mongoDB/Database/Persist/MongoDB.hs
mit
-- | No intersection of lists: if no value in the field is found in the list. ninList :: PersistField typ => EntityField v [typ] -> [typ] -> Filter v f `ninList` a = Filter (unsafeCoerce f) (Right a) In
202
ninList :: PersistField typ => EntityField v [typ] -> [typ] -> Filter v f `ninList` a = Filter (unsafeCoerce f) (Right a) In
124
f `ninList` a = Filter (unsafeCoerce f) (Right a) In
52
true
true
0
8
39
71
35
36
null
null
spicyj/tex-parser
src/TeX/Parser/Expand.hs
mit
expanders :: [TeXParser [Token]] expanders = [expandMacros]
59
expanders :: [TeXParser [Token]] expanders = [expandMacros]
59
expanders = [expandMacros]
26
false
true
0
7
6
23
13
10
null
null
NorfairKing/super-user-spark
src/SuperUserSpark/Utils.hs
mit
containsMultipleConsequtiveSlashes :: String -> Bool containsMultipleConsequtiveSlashes = isInfixOf "//"
104
containsMultipleConsequtiveSlashes :: String -> Bool containsMultipleConsequtiveSlashes = isInfixOf "//"
104
containsMultipleConsequtiveSlashes = isInfixOf "//"
51
false
true
0
5
8
18
9
9
null
null
tjakway/ghcjvm
compiler/nativeGen/SPARC/Ppr.hs
bsd-3-clause
pprInstr (LDATA _ _) = panic "PprMach.pprInstr: LDATA"
62
pprInstr (LDATA _ _) = panic "PprMach.pprInstr: LDATA"
62
pprInstr (LDATA _ _) = panic "PprMach.pprInstr: LDATA"
62
false
false
0
7
15
20
9
11
null
null
Mic92/eidolon
Handler/AdminAlbumSettings.hs
agpl-3.0
getAdminAlbumsR :: Handler Html getAdminAlbumsR = do adminCheck <- loginIsAdmin case adminCheck of Right _ -> do albums <- runDB $ selectList [] [Asc AlbumTitle] defaultLayout $ do setTitle "Administration: Albums" $(widgetFile "adminAlbums") Left (errorMsg, route) -> do setMessage errorMsg redirect $ route
360
getAdminAlbumsR :: Handler Html getAdminAlbumsR = do adminCheck <- loginIsAdmin case adminCheck of Right _ -> do albums <- runDB $ selectList [] [Asc AlbumTitle] defaultLayout $ do setTitle "Administration: Albums" $(widgetFile "adminAlbums") Left (errorMsg, route) -> do setMessage errorMsg redirect $ route
360
getAdminAlbumsR = do adminCheck <- loginIsAdmin case adminCheck of Right _ -> do albums <- runDB $ selectList [] [Asc AlbumTitle] defaultLayout $ do setTitle "Administration: Albums" $(widgetFile "adminAlbums") Left (errorMsg, route) -> do setMessage errorMsg redirect $ route
328
false
true
0
17
94
118
51
67
null
null
pandaychen/PFQ
user/Haskell/Network/PFq/Default.hs
gpl-2.0
-- | Evaluate to /True/ if the SkBuff is an IPv6 packet. is_ip6 = Predicate "is_ip6" () () () () () () () ()
108
is_ip6 = Predicate "is_ip6" () () () () () () () ()
51
is_ip6 = Predicate "is_ip6" () () () () () () () ()
51
true
false
0
6
23
42
21
21
null
null
dreixel/regular
src/Generics/Regular/TH.hs
bsd-3-clause
pfCon :: (Name, [Name]) -> Con -> Q Type pfCon (dt, vs) (NormalC n []) = appT (appT (conT ''C) (conT $ genName [dt, n])) (conT ''U)
135
pfCon :: (Name, [Name]) -> Con -> Q Type pfCon (dt, vs) (NormalC n []) = appT (appT (conT ''C) (conT $ genName [dt, n])) (conT ''U)
135
pfCon (dt, vs) (NormalC n []) = appT (appT (conT ''C) (conT $ genName [dt, n])) (conT ''U)
94
false
true
0
11
30
97
51
46
null
null
ekmett/ermine
src/Ermine/Core/Optimizer.hs
bsd-2-clause
lamlam c = return c
19
lamlam c = return c
19
lamlam c = return c
19
false
false
1
5
4
16
5
11
null
null
WraithM/haskell-opaleye
src/Opaleye/PGTypes.hs
bsd-3-clause
pgUTCTime :: Time.UTCTime -> Column PGTimestamptz pgUTCTime = IPT.unsafePgFormatTime "timestamptz" "'%FT%T%QZ'"
111
pgUTCTime :: Time.UTCTime -> Column PGTimestamptz pgUTCTime = IPT.unsafePgFormatTime "timestamptz" "'%FT%T%QZ'"
111
pgUTCTime = IPT.unsafePgFormatTime "timestamptz" "'%FT%T%QZ'"
61
false
true
0
7
10
32
14
18
null
null
haskell-opengl/OpenGLRaw
RegistryProcessor/src/Main.hs
bsd-3-clause
showComment :: Registry -> String -> SignatureElement -> P.Doc showComment registry name sigElem | null name' && null info = P.text "" | otherwise = P.text " " P.<> P.pPrint (Comment ("^" ++ name' ++ info ++ ".")) where name' | null name = "" | otherwise = " " ++ inlineCode name info | isInteresting = elms ++ " of type " ++ hurz | otherwise = "" -- Alas, there are tons of group names which are referenced, but never -- defined, so we have to leave them without a link. -- TODO: Do not use Show instance for SignatureElement. hurz = case belongsToGroup sigElem of Just gn | numPointer sigElem <= 1 && fgn `M.member` groups registry -> linkToGroup fgn where fgn = fixGroupName gn _ -> inlineCode (show (base sigElem)) isInteresting = DM.isJust (arrayLength sigElem) || DM.isJust (belongsToGroup sigElem) elms | numPointer sigElem > 0 = " pointing to" ++ len ++ " " ++ elements | otherwise = "" elements | arrayLength sigElem == Just "1" = "element" | otherwise = "elements" len = maybe "" (\l -> " " ++ inlineCode l) (arrayLength sigElem) base = maybeDeref . maybeSetBaseType maybeDeref e | numPointer e > 0 = e {numPointer = numPointer e - 1} | otherwise = e maybeSetBaseType e = maybe e (\g -> e {baseType = TypeName (unGroupName g)}) (belongsToGroup e)
1,452
showComment :: Registry -> String -> SignatureElement -> P.Doc showComment registry name sigElem | null name' && null info = P.text "" | otherwise = P.text " " P.<> P.pPrint (Comment ("^" ++ name' ++ info ++ ".")) where name' | null name = "" | otherwise = " " ++ inlineCode name info | isInteresting = elms ++ " of type " ++ hurz | otherwise = "" -- Alas, there are tons of group names which are referenced, but never -- defined, so we have to leave them without a link. -- TODO: Do not use Show instance for SignatureElement. hurz = case belongsToGroup sigElem of Just gn | numPointer sigElem <= 1 && fgn `M.member` groups registry -> linkToGroup fgn where fgn = fixGroupName gn _ -> inlineCode (show (base sigElem)) isInteresting = DM.isJust (arrayLength sigElem) || DM.isJust (belongsToGroup sigElem) elms | numPointer sigElem > 0 = " pointing to" ++ len ++ " " ++ elements | otherwise = "" elements | arrayLength sigElem == Just "1" = "element" | otherwise = "elements" len = maybe "" (\l -> " " ++ inlineCode l) (arrayLength sigElem) base = maybeDeref . maybeSetBaseType maybeDeref e | numPointer e > 0 = e {numPointer = numPointer e - 1} | otherwise = e maybeSetBaseType e = maybe e (\g -> e {baseType = TypeName (unGroupName g)}) (belongsToGroup e)
1,452
showComment registry name sigElem | null name' && null info = P.text "" | otherwise = P.text " " P.<> P.pPrint (Comment ("^" ++ name' ++ info ++ ".")) where name' | null name = "" | otherwise = " " ++ inlineCode name info | isInteresting = elms ++ " of type " ++ hurz | otherwise = "" -- Alas, there are tons of group names which are referenced, but never -- defined, so we have to leave them without a link. -- TODO: Do not use Show instance for SignatureElement. hurz = case belongsToGroup sigElem of Just gn | numPointer sigElem <= 1 && fgn `M.member` groups registry -> linkToGroup fgn where fgn = fixGroupName gn _ -> inlineCode (show (base sigElem)) isInteresting = DM.isJust (arrayLength sigElem) || DM.isJust (belongsToGroup sigElem) elms | numPointer sigElem > 0 = " pointing to" ++ len ++ " " ++ elements | otherwise = "" elements | arrayLength sigElem == Just "1" = "element" | otherwise = "elements" len = maybe "" (\l -> " " ++ inlineCode l) (arrayLength sigElem) base = maybeDeref . maybeSetBaseType maybeDeref e | numPointer e > 0 = e {numPointer = numPointer e - 1} | otherwise = e maybeSetBaseType e = maybe e (\g -> e {baseType = TypeName (unGroupName g)}) (belongsToGroup e)
1,389
false
true
1
14
424
477
228
249
null
null
erikd/hs-tls
core/Network/TLS/Crypto/IES.hs
bsd-3-clause
groupGenerateKeyPair FFDHE2048 = gen ffdhe2048 GroupPri_FFDHE2048 GroupPub_FFDHE2048
84
groupGenerateKeyPair FFDHE2048 = gen ffdhe2048 GroupPri_FFDHE2048 GroupPub_FFDHE2048
84
groupGenerateKeyPair FFDHE2048 = gen ffdhe2048 GroupPri_FFDHE2048 GroupPub_FFDHE2048
84
false
false
0
5
6
16
7
9
null
null
tomahawkins/devsurf
Language/DevSurf/Types.hs
bsd-3-clause
subdivide :: Curve -> Curve subdivide = f2 . f1 where f1 :: Curve -> Curve f1 a = case a of a : b : c -> a : ave2 a b : f1 (b : c) a -> a f2 :: Curve -> Curve f2 a = case a of [] -> [] a : b -> a : f3 b f3 :: Curve -> Curve f3 a = case a of a : b : c : d -> a : ave3 a b c : f3 (c : d) a -> a ave2 :: Vertex -> Vertex -> Vertex ave2 (x1, y1, z1) (x2, y2, z2) = ((x1 + x2) / 2, (y1 + y2) / 2, (z1 + z2) / 2) ave3 :: Vertex -> Vertex -> Vertex -> Vertex ave3 (x1, y1, z1) (x2, y2, z2) (x3, y3, z3) = ((x1 + x2 + x3) / 3, (y1 + y2 + y3) / 3, (z1 + z2 + z3) / 3) -- | Subdivde a 'Curve' N times.
642
subdivide :: Curve -> Curve subdivide = f2 . f1 where f1 :: Curve -> Curve f1 a = case a of a : b : c -> a : ave2 a b : f1 (b : c) a -> a f2 :: Curve -> Curve f2 a = case a of [] -> [] a : b -> a : f3 b f3 :: Curve -> Curve f3 a = case a of a : b : c : d -> a : ave3 a b c : f3 (c : d) a -> a ave2 :: Vertex -> Vertex -> Vertex ave2 (x1, y1, z1) (x2, y2, z2) = ((x1 + x2) / 2, (y1 + y2) / 2, (z1 + z2) / 2) ave3 :: Vertex -> Vertex -> Vertex -> Vertex ave3 (x1, y1, z1) (x2, y2, z2) (x3, y3, z3) = ((x1 + x2 + x3) / 3, (y1 + y2 + y3) / 3, (z1 + z2 + z3) / 3) -- | Subdivde a 'Curve' N times.
642
subdivide = f2 . f1 where f1 :: Curve -> Curve f1 a = case a of a : b : c -> a : ave2 a b : f1 (b : c) a -> a f2 :: Curve -> Curve f2 a = case a of [] -> [] a : b -> a : f3 b f3 :: Curve -> Curve f3 a = case a of a : b : c : d -> a : ave3 a b c : f3 (c : d) a -> a ave2 :: Vertex -> Vertex -> Vertex ave2 (x1, y1, z1) (x2, y2, z2) = ((x1 + x2) / 2, (y1 + y2) / 2, (z1 + z2) / 2) ave3 :: Vertex -> Vertex -> Vertex -> Vertex ave3 (x1, y1, z1) (x2, y2, z2) (x3, y3, z3) = ((x1 + x2 + x3) / 3, (y1 + y2 + y3) / 3, (z1 + z2 + z3) / 3) -- | Subdivde a 'Curve' N times.
614
false
true
1
11
224
431
220
211
null
null
hellertime/consul-haskell
tests/Main.hs
bsd-3-clause
{- Managed Session -} testCreateManagedSession :: TestTree testCreateManagedSession = testCase "testCreateManagedSession" $ do client <- initializeConsulClient "localhost" (PortNum 8500) Nothing x <- createManagedSession client (Just "testCreateManagedSession") "60s" assertEqual "testCreateManagedSession: Session not created" True (isJust x)
349
testCreateManagedSession :: TestTree testCreateManagedSession = testCase "testCreateManagedSession" $ do client <- initializeConsulClient "localhost" (PortNum 8500) Nothing x <- createManagedSession client (Just "testCreateManagedSession") "60s" assertEqual "testCreateManagedSession: Session not created" True (isJust x)
327
testCreateManagedSession = testCase "testCreateManagedSession" $ do client <- initializeConsulClient "localhost" (PortNum 8500) Nothing x <- createManagedSession client (Just "testCreateManagedSession") "60s" assertEqual "testCreateManagedSession: Session not created" True (isJust x)
290
true
true
0
12
40
82
36
46
null
null
frelindb/agsyHOL
SearchControl.hs
mit
-- 1200 -- 800 -- 600 -- 1000 costGenericSubprob, costGenericBottom :: Int costGenericSubprob = 300
103
costGenericSubprob, costGenericBottom :: Int costGenericSubprob = 300
69
costGenericSubprob = 300
24
true
true
0
4
18
14
9
5
null
null
mikebenfield/ftensor
test/Tests/Math/Ftensor/General.hs
isc
case_index_17 = index t1 (0:-1:-0:-N) @?= 5
43
case_index_17 = index t1 (0:-1:-0:-N) @?= 5
43
case_index_17 = index t1 (0:-1:-0:-N) @?= 5
43
false
false
1
9
6
34
15
19
null
null
mapr/impala
thirdparty/thrift-0.9.0/lib/hs/src/Thrift/Protocol.hs
apache-2.0
skip p T_SET = do (t, n) <- readSetBegin p replicateM_ (fromIntegral n) (skip p t) readSetEnd p
131
skip p T_SET = do (t, n) <- readSetBegin p replicateM_ (fromIntegral n) (skip p t) readSetEnd p
131
skip p T_SET = do (t, n) <- readSetBegin p replicateM_ (fromIntegral n) (skip p t) readSetEnd p
131
false
false
1
10
53
60
25
35
null
null
sdiehl/ghc
compiler/main/HscTypes.hs
bsd-3-clause
implicitConLikeThings :: ConLike -> [TyThing] implicitConLikeThings (RealDataCon dc) = dataConImplicitTyThings dc
115
implicitConLikeThings :: ConLike -> [TyThing] implicitConLikeThings (RealDataCon dc) = dataConImplicitTyThings dc
115
implicitConLikeThings (RealDataCon dc) = dataConImplicitTyThings dc
69
false
true
0
7
12
30
15
15
null
null
Noeda/caramia
src/Graphics/Caramia/Query.hs
mit
-- | Which queries cannot be used together? illPairs :: M.Map SomeQuery (S.Set SomeQuery) illPairs = M.fromList [ (Left SamplesPassed, S.singleton $ Right AnySamplesPassed) , (Right AnySamplesPassed, S.singleton $ Left SamplesPassed) ]
243
illPairs :: M.Map SomeQuery (S.Set SomeQuery) illPairs = M.fromList [ (Left SamplesPassed, S.singleton $ Right AnySamplesPassed) , (Right AnySamplesPassed, S.singleton $ Left SamplesPassed) ]
199
illPairs = M.fromList [ (Left SamplesPassed, S.singleton $ Right AnySamplesPassed) , (Right AnySamplesPassed, S.singleton $ Left SamplesPassed) ]
153
true
true
2
9
39
82
38
44
null
null
rueshyna/gogol
gogol-dns/gen/Network/Google/Resource/DNS/ManagedZones/Get.hs
mpl-2.0
-- | Identifies the project addressed by this request. mzgProject :: Lens' ManagedZonesGet Text mzgProject = lens _mzgProject (\ s a -> s{_mzgProject = a})
157
mzgProject :: Lens' ManagedZonesGet Text mzgProject = lens _mzgProject (\ s a -> s{_mzgProject = a})
102
mzgProject = lens _mzgProject (\ s a -> s{_mzgProject = a})
61
true
true
0
9
26
42
22
20
null
null
SKA-ScienceDataProcessor/RC
MS3/Sketches/Oskar_New_Reader/OskarBinReader.hs
apache-2.0
finalizeTaskData :: TaskData -> IO () finalizeTaskData td = do free $ tdMap td free $ tdUVWs td free $ tdVisibilies td
124
finalizeTaskData :: TaskData -> IO () finalizeTaskData td = do free $ tdMap td free $ tdUVWs td free $ tdVisibilies td
124
finalizeTaskData td = do free $ tdMap td free $ tdUVWs td free $ tdVisibilies td
86
false
true
0
8
27
53
23
30
null
null
ianoc/jt
src/Jt/Command/Counters.hs
mit
recoverWith :: IO (Maybe a) -> IO (Maybe a) -> IO (Maybe a) recoverWith existing generator = do e <- existing fnE e where fnE (Just e) = return $ Just e fnE Nothing = generator
195
recoverWith :: IO (Maybe a) -> IO (Maybe a) -> IO (Maybe a) recoverWith existing generator = do e <- existing fnE e where fnE (Just e) = return $ Just e fnE Nothing = generator
195
recoverWith existing generator = do e <- existing fnE e where fnE (Just e) = return $ Just e fnE Nothing = generator
135
false
true
0
9
54
96
44
52
null
null
brendanhay/gogol
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
mpl-2.0
-- | Creates a value of 'Region' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'r1MerchantId' -- -- * 'r1PostalCodeArea' -- -- * 'r1RegionalInventoryEligible' -- -- * 'r1RegionId' -- -- * 'r1GeotargetArea' -- -- * 'r1ShippingEligible' -- -- * 'r1DisplayName' region :: Region region = Region' { _r1MerchantId = Nothing , _r1PostalCodeArea = Nothing , _r1RegionalInventoryEligible = Nothing , _r1RegionId = Nothing , _r1GeotargetArea = Nothing , _r1ShippingEligible = Nothing , _r1DisplayName = Nothing }
628
region :: Region region = Region' { _r1MerchantId = Nothing , _r1PostalCodeArea = Nothing , _r1RegionalInventoryEligible = Nothing , _r1RegionId = Nothing , _r1GeotargetArea = Nothing , _r1ShippingEligible = Nothing , _r1DisplayName = Nothing }
282
region = Region' { _r1MerchantId = Nothing , _r1PostalCodeArea = Nothing , _r1RegionalInventoryEligible = Nothing , _r1RegionId = Nothing , _r1GeotargetArea = Nothing , _r1ShippingEligible = Nothing , _r1DisplayName = Nothing }
261
true
true
1
7
130
79
53
26
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/types/Type.hs
bsd-3-clause
-- Class and it corresponding TyCon have the same Unique isIPPred_maybe :: Type -> Maybe (FastString, Type) isIPPred_maybe ty = do (tc,[t1,t2]) <- splitTyConApp_maybe ty guard (isIPTyCon tc) x <- isStrLitTy t1 return (x,t2) {- Make PredTypes --------------------- Equality types --------------------------------- -} -- | Creates a type equality predicate
375
isIPPred_maybe :: Type -> Maybe (FastString, Type) isIPPred_maybe ty = do (tc,[t1,t2]) <- splitTyConApp_maybe ty guard (isIPTyCon tc) x <- isStrLitTy t1 return (x,t2) {- Make PredTypes --------------------- Equality types --------------------------------- -} -- | Creates a type equality predicate
317
isIPPred_maybe ty = do (tc,[t1,t2]) <- splitTyConApp_maybe ty guard (isIPTyCon tc) x <- isStrLitTy t1 return (x,t2) {- Make PredTypes --------------------- Equality types --------------------------------- -} -- | Creates a type equality predicate
266
true
true
0
10
69
91
45
46
null
null
kawamuray/ganeti
src/Ganeti/Constants.hs
gpl-2.0
wconfdDefCtmo :: Int wconfdDefCtmo = 10
39
wconfdDefCtmo :: Int wconfdDefCtmo = 10
39
wconfdDefCtmo = 10
18
false
true
0
4
5
11
6
5
null
null
Tarrasch/Hong
Fal/Fal.hs
bsd-3-clause
cball1r = paint color1r circ
29
cball1r = paint color1r circ
29
cball1r = paint color1r circ
29
false
false
0
5
5
11
5
6
null
null
spechub/Hets
Common/Data.hs
gpl-2.0
{- | conversion with special treatment for numbers, booleans, strings, characters, ranges, ids, IRIs and other lists. -} dataToMyData :: Data a => a -> MyData dataToMyData a = let l = gmapQ dataToMyData a c = toConstr a fs = constrFields c s = showConstr c bool = const $ Builtin "bool" s :: Bool -> MyData res = case l of [] -> case s of "[]" -> ListOrTuple True [] "()" -> ListOrTuple False [] _ -> Cons s Nothing [] [hd, ListOrTuple True rt] | s == "(:)" -> ListOrTuple True $ hd : rt _ | isPrefixOf "(," s -> ListOrTuple False l _ -> Cons s (if length fs == length l && all (not . null) fs then Just fs else Nothing) l in case dataTypeRep $ dataTypeOf a of r | elem r [IntRep, FloatRep] -> Builtin "number" s CharRep -> Builtin "char" s _ -> maybe (maybe (maybe (maybe (maybe res (Builtin "iri" . iriToStringUnsecure) $ cast a) (Builtin "id" . (`showId` "")) $ cast a) (Builtin "range" . show . prettyRange . rangeToList) $ cast a) (Builtin "string") $ cast a) bool $ cast a
1,146
dataToMyData :: Data a => a -> MyData dataToMyData a = let l = gmapQ dataToMyData a c = toConstr a fs = constrFields c s = showConstr c bool = const $ Builtin "bool" s :: Bool -> MyData res = case l of [] -> case s of "[]" -> ListOrTuple True [] "()" -> ListOrTuple False [] _ -> Cons s Nothing [] [hd, ListOrTuple True rt] | s == "(:)" -> ListOrTuple True $ hd : rt _ | isPrefixOf "(," s -> ListOrTuple False l _ -> Cons s (if length fs == length l && all (not . null) fs then Just fs else Nothing) l in case dataTypeRep $ dataTypeOf a of r | elem r [IntRep, FloatRep] -> Builtin "number" s CharRep -> Builtin "char" s _ -> maybe (maybe (maybe (maybe (maybe res (Builtin "iri" . iriToStringUnsecure) $ cast a) (Builtin "id" . (`showId` "")) $ cast a) (Builtin "range" . show . prettyRange . rangeToList) $ cast a) (Builtin "string") $ cast a) bool $ cast a
1,025
dataToMyData a = let l = gmapQ dataToMyData a c = toConstr a fs = constrFields c s = showConstr c bool = const $ Builtin "bool" s :: Bool -> MyData res = case l of [] -> case s of "[]" -> ListOrTuple True [] "()" -> ListOrTuple False [] _ -> Cons s Nothing [] [hd, ListOrTuple True rt] | s == "(:)" -> ListOrTuple True $ hd : rt _ | isPrefixOf "(," s -> ListOrTuple False l _ -> Cons s (if length fs == length l && all (not . null) fs then Just fs else Nothing) l in case dataTypeRep $ dataTypeOf a of r | elem r [IntRep, FloatRep] -> Builtin "number" s CharRep -> Builtin "char" s _ -> maybe (maybe (maybe (maybe (maybe res (Builtin "iri" . iriToStringUnsecure) $ cast a) (Builtin "id" . (`showId` "")) $ cast a) (Builtin "range" . show . prettyRange . rangeToList) $ cast a) (Builtin "string") $ cast a) bool $ cast a
987
true
true
2
21
362
430
209
221
null
null
sdiehl/ghc
compiler/main/FileCleanup.hs
bsd-3-clause
removeTmpFiles :: DynFlags -> [FilePath] -> IO () removeTmpFiles dflags fs = warnNon $ traceCmd dflags "Deleting temp files" ("Deleting: " ++ unwords deletees) (mapM_ (removeWith dflags removeFile) deletees) where -- Flat out refuse to delete files that are likely to be source input -- files (is there a worse bug than having a compiler delete your source -- files?) -- -- Deleting source files is a sign of a bug elsewhere, so prominently flag -- the condition. warnNon act | null non_deletees = act | otherwise = do putMsg dflags (text "WARNING - NOT deleting source files:" <+> hsep (map text non_deletees)) act (non_deletees, deletees) = partition isHaskellUserSrcFilename fs
810
removeTmpFiles :: DynFlags -> [FilePath] -> IO () removeTmpFiles dflags fs = warnNon $ traceCmd dflags "Deleting temp files" ("Deleting: " ++ unwords deletees) (mapM_ (removeWith dflags removeFile) deletees) where -- Flat out refuse to delete files that are likely to be source input -- files (is there a worse bug than having a compiler delete your source -- files?) -- -- Deleting source files is a sign of a bug elsewhere, so prominently flag -- the condition. warnNon act | null non_deletees = act | otherwise = do putMsg dflags (text "WARNING - NOT deleting source files:" <+> hsep (map text non_deletees)) act (non_deletees, deletees) = partition isHaskellUserSrcFilename fs
810
removeTmpFiles dflags fs = warnNon $ traceCmd dflags "Deleting temp files" ("Deleting: " ++ unwords deletees) (mapM_ (removeWith dflags removeFile) deletees) where -- Flat out refuse to delete files that are likely to be source input -- files (is there a worse bug than having a compiler delete your source -- files?) -- -- Deleting source files is a sign of a bug elsewhere, so prominently flag -- the condition. warnNon act | null non_deletees = act | otherwise = do putMsg dflags (text "WARNING - NOT deleting source files:" <+> hsep (map text non_deletees)) act (non_deletees, deletees) = partition isHaskellUserSrcFilename fs
760
false
true
0
13
239
155
76
79
null
null
adp-multi/adp-multi
tests/ADP/Tests/RGExampleDim2.hs
bsd-3-clause
maxKnots :: RG_Algebra Char Int maxKnots = (nil,left,pair,knot,knot1,knot2,basepair,base,h) where nil _ = 0 left _ _ b = b pair _ _ b c = b + c knot _ _ _ c d e f = 1 + c + d + e + f knot1 _ _ = 0 knot2 _ = 0 basepair _ = 0 base _ = 0 h [] = [] h xs = [maximum xs] -- The left part is the structure and the right part the reconstructed input.
454
maxKnots :: RG_Algebra Char Int maxKnots = (nil,left,pair,knot,knot1,knot2,basepair,base,h) where nil _ = 0 left _ _ b = b pair _ _ b c = b + c knot _ _ _ c d e f = 1 + c + d + e + f knot1 _ _ = 0 knot2 _ = 0 basepair _ = 0 base _ = 0 h [] = [] h xs = [maximum xs] -- The left part is the structure and the right part the reconstructed input.
454
maxKnots = (nil,left,pair,knot,knot1,knot2,basepair,base,h) where nil _ = 0 left _ _ b = b pair _ _ b c = b + c knot _ _ _ c d e f = 1 + c + d + e + f knot1 _ _ = 0 knot2 _ = 0 basepair _ = 0 base _ = 0 h [] = [] h xs = [maximum xs] -- The left part is the structure and the right part the reconstructed input.
422
false
true
0
10
197
180
95
85
null
null
tangboyun/miranda
src/MiRanda/Parameter.hs
gpl-3.0
psRegMeanMap :: IntMap (Maybe (Double,Double)) psRegMeanMap = IM.fromList [(fromEnum M8, Just (0.378,0.299)) ,(fromEnum M7M8, Just (0.212,0.289)) ,(fromEnum M7A1, Just (0.164,0.303)) ,(fromEnum M6, Just (0.094,0.293)) ,(fromEnum M6O, Just (0.094,0.293)) ,(fromEnum Imperfect, Nothing)]
375
psRegMeanMap :: IntMap (Maybe (Double,Double)) psRegMeanMap = IM.fromList [(fromEnum M8, Just (0.378,0.299)) ,(fromEnum M7M8, Just (0.212,0.289)) ,(fromEnum M7A1, Just (0.164,0.303)) ,(fromEnum M6, Just (0.094,0.293)) ,(fromEnum M6O, Just (0.094,0.293)) ,(fromEnum Imperfect, Nothing)]
375
psRegMeanMap = IM.fromList [(fromEnum M8, Just (0.378,0.299)) ,(fromEnum M7M8, Just (0.212,0.289)) ,(fromEnum M7A1, Just (0.164,0.303)) ,(fromEnum M6, Just (0.094,0.293)) ,(fromEnum M6O, Just (0.094,0.293)) ,(fromEnum Imperfect, Nothing)]
328
false
true
0
9
120
154
84
70
null
null
danr/hipspec
testsuite/prod/zeno_version/PropT25.hs
gpl-3.0
one, zero :: Nat zero = Z
25
one, zero :: Nat zero = Z
25
zero = Z
8
false
true
2
5
6
18
8
10
null
null
ssaavedra/liquidhaskell
src/Language/Haskell/Liquid/Bare/GhcSpec.hs
bsd-3-clause
replaceLocalBinds :: TCEmb TyCon -> M.HashMap TyCon RTyCon -> [(Var, Located SpecType)] -> [(Var, [Expr])] -> SEnv SortedReft -> CoreProgram -> ([(Var, Located SpecType)], [(Var, [Expr])]) replaceLocalBinds emb tyi sigs texprs senv cbs = (M.toList s, M.toList t) where (s,t) = execState (runReaderT (mapM_ (`traverseBinds` return ()) cbs) (RE M.empty senv emb tyi)) (M.fromList sigs, M.fromList texprs)
574
replaceLocalBinds :: TCEmb TyCon -> M.HashMap TyCon RTyCon -> [(Var, Located SpecType)] -> [(Var, [Expr])] -> SEnv SortedReft -> CoreProgram -> ([(Var, Located SpecType)], [(Var, [Expr])]) replaceLocalBinds emb tyi sigs texprs senv cbs = (M.toList s, M.toList t) where (s,t) = execState (runReaderT (mapM_ (`traverseBinds` return ()) cbs) (RE M.empty senv emb tyi)) (M.fromList sigs, M.fromList texprs)
574
replaceLocalBinds emb tyi sigs texprs senv cbs = (M.toList s, M.toList t) where (s,t) = execState (runReaderT (mapM_ (`traverseBinds` return ()) cbs) (RE M.empty senv emb tyi)) (M.fromList sigs, M.fromList texprs)
277
false
true
0
14
228
208
111
97
null
null
fmthoma/ghc
compiler/typecheck/TcEvidence.hs
bsd-3-clause
mkWpCast :: TcCoercion -> HsWrapper mkWpCast co | isTcReflCo co = WpHole | otherwise = ASSERT2(tcCoercionRole co == Representational, ppr co) WpCast co
179
mkWpCast :: TcCoercion -> HsWrapper mkWpCast co | isTcReflCo co = WpHole | otherwise = ASSERT2(tcCoercionRole co == Representational, ppr co) WpCast co
179
mkWpCast co | isTcReflCo co = WpHole | otherwise = ASSERT2(tcCoercionRole co == Representational, ppr co) WpCast co
143
false
true
0
9
50
68
29
39
null
null
ku-fpg/kansas-amber
System/Hardware/Haskino/Protocol.hs
bsd-3-clause
packageExpr (EqPinMode e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_WORD8 EXPR_EQ) e1 e2
87
packageExpr (EqPinMode e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_WORD8 EXPR_EQ) e1 e2
87
packageExpr (EqPinMode e1 e2) = packageTwoSubExpr (exprCmdVal EXPR_WORD8 EXPR_EQ) e1 e2
87
false
false
0
7
10
32
15
17
null
null
shepheb/graphmind
Settings.hs
bsd-2-clause
-- The next two functions are for allocating a connection pool and running -- database actions using a pool, respectively. It is used internally -- by the scaffolded application, and therefore you will rarely need to use -- them yourself. withConnectionPool :: MonadInvertIO m => (ConnectionPool -> m a) -> m a withConnectionPool = withSqlitePool connStr connectionCount
370
withConnectionPool :: MonadInvertIO m => (ConnectionPool -> m a) -> m a withConnectionPool = withSqlitePool connStr connectionCount
131
withConnectionPool = withSqlitePool connStr connectionCount
59
true
true
0
10
56
49
24
25
null
null
jimfinnis/keith
firmware/common/regparse.hs
mit
scoreReg = mkRegex "\\_"
24
scoreReg = mkRegex "\\_"
24
scoreReg = mkRegex "\\_"
24
false
false
1
5
3
13
4
9
null
null
eccstartup/incredible
logic/Propositions.hs
mit
quantifiers :: [(Char, [Char])] quantifiers = [ ('∀', ['!']) , ('∃', ['?']) , ('λ', ['\\']) ]
109
quantifiers :: [(Char, [Char])] quantifiers = [ ('∀', ['!']) , ('∃', ['?']) , ('λ', ['\\']) ]
109
quantifiers = [ ('∀', ['!']) , ('∃', ['?']) , ('λ', ['\\']) ]
77
false
true
0
9
31
66
39
27
null
null
eklavya/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
reflectConstant (AType (ATInt (ITFixed IT8))) = reflCall "AType" [reflCall "ATInt" [reflCall "ITFixed" [Var (reflm "IT8")]]]
125
reflectConstant (AType (ATInt (ITFixed IT8))) = reflCall "AType" [reflCall "ATInt" [reflCall "ITFixed" [Var (reflm "IT8")]]]
125
reflectConstant (AType (ATInt (ITFixed IT8))) = reflCall "AType" [reflCall "ATInt" [reflCall "ITFixed" [Var (reflm "IT8")]]]
125
false
false
0
13
15
60
29
31
null
null
tomwadeson/scheme
app/Main.hs
mit
main :: IO () main = do (expr:_) <- getArgs putStrLn (readExpr expr)
72
main :: IO () main = do (expr:_) <- getArgs putStrLn (readExpr expr)
72
main = do (expr:_) <- getArgs putStrLn (readExpr expr)
58
false
true
1
10
16
46
20
26
null
null
xabbu42/balance-game
balance_game.hs
bsd-3-clause
is_perfect_solution :: Position -> Bool is_perfect_solution p = normal p >= total p - 1 && unknown p == 0
105
is_perfect_solution :: Position -> Bool is_perfect_solution p = normal p >= total p - 1 && unknown p == 0
105
is_perfect_solution p = normal p >= total p - 1 && unknown p == 0
65
false
true
2
8
19
51
22
29
null
null
frantisekfarka/ghc-dsi
utils/hpc/HpcMarkup.hs
bsd-3-clause
addMarkup tabStop cs loc ((o,_):os) ticks | loc > o = closeTick ++ addMarkup tabStop cs loc os ticks
102
addMarkup tabStop cs loc ((o,_):os) ticks | loc > o = closeTick ++ addMarkup tabStop cs loc os ticks
102
addMarkup tabStop cs loc ((o,_):os) ticks | loc > o = closeTick ++ addMarkup tabStop cs loc os ticks
102
false
false
0
8
20
55
27
28
null
null
rzeigler/advent-of-code-2016
Lib/AoC/Day6.hs
mit
leastCommon :: [(Char, Int)] -> Char leastCommon = fst . minimumBy (comparing snd)
82
leastCommon :: [(Char, Int)] -> Char leastCommon = fst . minimumBy (comparing snd)
82
leastCommon = fst . minimumBy (comparing snd)
45
false
true
1
8
12
44
21
23
null
null
travitch/hbgl-experimental
tests/MutableGraphTests.hs
bsd-3-clause
cg1 :: SG cg1 = mkGraph (map (\n -> (n, ())) [1..5]) es where es = map (\(s,d) -> Edge s d ()) [(1,2), (2,1), (3,4), (4,3), (1,3), (5,4)]
143
cg1 :: SG cg1 = mkGraph (map (\n -> (n, ())) [1..5]) es where es = map (\(s,d) -> Edge s d ()) [(1,2), (2,1), (3,4), (4,3), (1,3), (5,4)]
143
cg1 = mkGraph (map (\n -> (n, ())) [1..5]) es where es = map (\(s,d) -> Edge s d ()) [(1,2), (2,1), (3,4), (4,3), (1,3), (5,4)]
133
false
true
0
11
34
135
80
55
null
null
zhiyuanshi/fcore
examples/case_studies/FOLogic.hs
bsd-2-clause
prdof (Implies l r) = prdof l `Set.union` prdof r
49
prdof (Implies l r) = prdof l `Set.union` prdof r
49
prdof (Implies l r) = prdof l `Set.union` prdof r
49
false
false
0
7
9
31
15
16
null
null
erochest/wa-tor
src/WaTor/Random.hs
apache-2.0
randomEntity :: GenIO -> Params -> IO Entity randomEntity g Params{..} = randomEntity' <$> uniform g where randomEntity' x | x <= initialFish = Fish 0 | x <= (initialFish + initialSharks) = Shark 0 initEnergy | otherwise = Empty
332
randomEntity :: GenIO -> Params -> IO Entity randomEntity g Params{..} = randomEntity' <$> uniform g where randomEntity' x | x <= initialFish = Fish 0 | x <= (initialFish + initialSharks) = Shark 0 initEnergy | otherwise = Empty
332
randomEntity g Params{..} = randomEntity' <$> uniform g where randomEntity' x | x <= initialFish = Fish 0 | x <= (initialFish + initialSharks) = Shark 0 initEnergy | otherwise = Empty
287
false
true
0
10
143
97
45
52
null
null
anttisalonen/cgen
src/DeriveMod.hs
bsd-3-clause
deriveSMod :: [Dec] -> [Dec] deriveSMod = concatMap toState
61
deriveSMod :: [Dec] -> [Dec] deriveSMod = concatMap toState
61
deriveSMod = concatMap toState
32
false
true
0
8
10
31
14
17
null
null
shlomobauer/BuildIT
src/OutClean.hs
apache-2.0
ocleanrsb h _ = do return ()
29
ocleanrsb h _ = do return ()
29
ocleanrsb h _ = do return ()
29
false
false
0
8
7
19
8
11
null
null
fredmorcos/attic
snippets/haskell/passman/archive/Main.hs
isc
evalCmd :: [String] -> IO Bool evalCmd [] = do return True
58
evalCmd :: [String] -> IO Bool evalCmd [] = do return True
58
evalCmd [] = do return True
27
false
true
0
8
11
37
16
21
null
null
M-Jack/adventofcode
src/Main.hs
gpl-3.0
solutions = M.fromList [ (1, day01), (2, day02) ]
121
solutions = M.fromList [ (1, day01), (2, day02) ]
121
solutions = M.fromList [ (1, day01), (2, day02) ]
121
false
false
1
7
80
32
17
15
null
null
himura/twitter-conduit
src/Web/Twitter/Conduit/Base.hs
bsd-2-clause
-- | Perform an 'APIRequest' and then provide the 'Response'. -- -- Example: -- -- @ -- res \<- 'callWithResponse' twInfo mgr $ 'accountVerifyCredentials' -- 'print' $ 'responseStatus' res -- 'print' $ 'responseHeaders' res -- 'print' $ 'responseBody' res -- @ callWithResponse :: ResponseBodyType responseType => -- | Twitter Setting TWInfo -> HTTP.Manager -> APIRequest apiName responseType -> IO (Response responseType) callWithResponse = callWithResponse'
483
callWithResponse :: ResponseBodyType responseType => -- | Twitter Setting TWInfo -> HTTP.Manager -> APIRequest apiName responseType -> IO (Response responseType) callWithResponse = callWithResponse'
222
callWithResponse = callWithResponse'
36
true
true
0
11
87
57
33
24
null
null
damianfral/clay
src/Clay/Color.hs
bsd-3-clause
white = rgb 255 255 255
38
white = rgb 255 255 255
38
white = rgb 255 255 255
38
false
false
0
5
20
13
6
7
null
null
Xingtao/RLHask
test/TestChapter4DP.hs
bsd-3-clause
showAsTable :: [Int] -> [Int] -> [Double] -> Bool -> String showAsTable col row vals bFloat = let colLen = length col header = "|First/second| " ++ (concat $ map ((++ "|") . show) col) ++ "\n" alignHeader = (concat . take (colLen + 1) $ repeat "|:-----:") ++ "|\n" showRows = concat $ map (go colLen vals) row in header ++ alignHeader ++ showRows where go len vals rowIdx = let first = show rowIdx ++ "|" rows = take len $ drop (len * rowIdx) vals format = bFloat ? ("%7.2f", "%7.0f") in first ++ (concat $ map (\ x -> (printf format x :: String) ++ "|") rows) ++ "|\n" ---------------------------------------------------------------------------------------------------- -- Gambler Problem Test
747
showAsTable :: [Int] -> [Int] -> [Double] -> Bool -> String showAsTable col row vals bFloat = let colLen = length col header = "|First/second| " ++ (concat $ map ((++ "|") . show) col) ++ "\n" alignHeader = (concat . take (colLen + 1) $ repeat "|:-----:") ++ "|\n" showRows = concat $ map (go colLen vals) row in header ++ alignHeader ++ showRows where go len vals rowIdx = let first = show rowIdx ++ "|" rows = take len $ drop (len * rowIdx) vals format = bFloat ? ("%7.2f", "%7.0f") in first ++ (concat $ map (\ x -> (printf format x :: String) ++ "|") rows) ++ "|\n" ---------------------------------------------------------------------------------------------------- -- Gambler Problem Test
747
showAsTable col row vals bFloat = let colLen = length col header = "|First/second| " ++ (concat $ map ((++ "|") . show) col) ++ "\n" alignHeader = (concat . take (colLen + 1) $ repeat "|:-----:") ++ "|\n" showRows = concat $ map (go colLen vals) row in header ++ alignHeader ++ showRows where go len vals rowIdx = let first = show rowIdx ++ "|" rows = take len $ drop (len * rowIdx) vals format = bFloat ? ("%7.2f", "%7.0f") in first ++ (concat $ map (\ x -> (printf format x :: String) ++ "|") rows) ++ "|\n" ---------------------------------------------------------------------------------------------------- -- Gambler Problem Test
687
false
true
0
16
170
275
143
132
null
null
plaprade/aeson
benchmarks/Typed/Manual.hs
bsd-3-clause
benchmarks :: Benchmark benchmarks = env ((,) <$> load "json-data/twitter100.json" <*> load "json-data/jp100.json") $ \ ~(twitter100, jp100) -> bgroup "manual" [ bgroup "direct" [ bench "twitter100" $ nf encodeDirect twitter100 , bench "jp100" $ nf encodeDirect jp100 ] , bgroup "viaValue" [ bench "twitter100" $ nf encodeViaValue twitter100 , bench "jp100" $ nf encodeViaValue jp100 ] ]
445
benchmarks :: Benchmark benchmarks = env ((,) <$> load "json-data/twitter100.json" <*> load "json-data/jp100.json") $ \ ~(twitter100, jp100) -> bgroup "manual" [ bgroup "direct" [ bench "twitter100" $ nf encodeDirect twitter100 , bench "jp100" $ nf encodeDirect jp100 ] , bgroup "viaValue" [ bench "twitter100" $ nf encodeViaValue twitter100 , bench "jp100" $ nf encodeViaValue jp100 ] ]
445
benchmarks = env ((,) <$> load "json-data/twitter100.json" <*> load "json-data/jp100.json") $ \ ~(twitter100, jp100) -> bgroup "manual" [ bgroup "direct" [ bench "twitter100" $ nf encodeDirect twitter100 , bench "jp100" $ nf encodeDirect jp100 ] , bgroup "viaValue" [ bench "twitter100" $ nf encodeViaValue twitter100 , bench "jp100" $ nf encodeViaValue jp100 ] ]
421
false
true
0
12
114
131
64
67
null
null
SergeyKrivohatskiy/fp_haskell
class/Hw06.hs
mit
-- (a) Возвращает высоту дерева height :: Tree a -> Int height (Node v children) = 1 + (max_height children) where max_height [] = 0 max_height (x:xs) = max (height x) (max_height xs) -- (b) Возвращает среднее арифметическое значений во всех узлах дерева -- Необходимо вычислить эту функцию, выполнив один проход по дереву
334
height :: Tree a -> Int height (Node v children) = 1 + (max_height children) where max_height [] = 0 max_height (x:xs) = max (height x) (max_height xs) -- (b) Возвращает среднее арифметическое значений во всех узлах дерева -- Необходимо вычислить эту функцию, выполнив один проход по дереву
302
height (Node v children) = 1 + (max_height children) where max_height [] = 0 max_height (x:xs) = max (height x) (max_height xs) -- (b) Возвращает среднее арифметическое значений во всех узлах дерева -- Необходимо вычислить эту функцию, выполнив один проход по дереву
278
true
true
0
7
64
87
44
43
null
null
psfblair/clay
src/Clay/Color.hs
bsd-3-clause
cornflowerblue = rgb 100 149 237
38
cornflowerblue = rgb 100 149 237
38
cornflowerblue = rgb 100 149 237
38
false
false
1
5
11
16
6
10
null
null
bartavelle/pcre-utils
Text/Regex/PCRE/ByteString/Utils.hs
bsd-3-clause
regexpAll :: [RegexpSplit a] -> [a] regexpAll = map unreg where unreg ( Matched x _ ) = x unreg ( Unmatched x ) = x
135
regexpAll :: [RegexpSplit a] -> [a] regexpAll = map unreg where unreg ( Matched x _ ) = x unreg ( Unmatched x ) = x
135
regexpAll = map unreg where unreg ( Matched x _ ) = x unreg ( Unmatched x ) = x
99
false
true
1
7
45
60
30
30
null
null
kawu/tagger
src/LogMath.hs
bsd-3-clause
m_inf :: RealFloat a => a m_inf = -(1/0)
40
m_inf :: RealFloat a => a m_inf = -(1/0)
40
m_inf = -(1/0)
14
false
true
0
7
8
27
14
13
null
null
tonyday567/hdcharts
src/Web/Play/Types.hs
mit
mkJsSlider' :: CtrSlider -> JStat mkJsSlider' cs = (jq paramId $. "change") $$$ fun0 (Js.var "avalue" <> ("avalue" =: jq paramId $. "val") <> ((jq textId $. "value") =: r "avalue") <> (onChange $$$ r "avalue")) where paramId = "#param" ++ cs ^. csDomName textId = "#text" ++ cs ^. csDomName onChange = cs^.csOnChange
353
mkJsSlider' :: CtrSlider -> JStat mkJsSlider' cs = (jq paramId $. "change") $$$ fun0 (Js.var "avalue" <> ("avalue" =: jq paramId $. "val") <> ((jq textId $. "value") =: r "avalue") <> (onChange $$$ r "avalue")) where paramId = "#param" ++ cs ^. csDomName textId = "#text" ++ cs ^. csDomName onChange = cs^.csOnChange
353
mkJsSlider' cs = (jq paramId $. "change") $$$ fun0 (Js.var "avalue" <> ("avalue" =: jq paramId $. "val") <> ((jq textId $. "value") =: r "avalue") <> (onChange $$$ r "avalue")) where paramId = "#param" ++ cs ^. csDomName textId = "#text" ++ cs ^. csDomName onChange = cs^.csOnChange
319
false
true
11
12
90
157
70
87
null
null
AaronFriel/hyhac
src/Database/HyperDex/Internal/Util/Resource.hs
bsd-3-clause
rMalloc :: (Storable a, MonadResource m) => m (Ptr a) rMalloc = fmap snd $ allocateAcquire $ hAcquire malloc free
113
rMalloc :: (Storable a, MonadResource m) => m (Ptr a) rMalloc = fmap snd $ allocateAcquire $ hAcquire malloc free
113
rMalloc = fmap snd $ allocateAcquire $ hAcquire malloc free
59
false
true
0
8
19
51
25
26
null
null
luzhuomi/xhaskell
Language/XHaskell/Source.hs
bsd-3-clause
isStar (UnQual (Ident "Star")) = True
37
isStar (UnQual (Ident "Star")) = True
37
isStar (UnQual (Ident "Star")) = True
37
false
false
0
8
5
22
10
12
null
null
swamp-agr/carbuyer-advisor
fay/TextAdvise.hs
mit
delRow :: Element -> Bool -> Fay () delRow _ False = return ()
62
delRow :: Element -> Bool -> Fay () delRow _ False = return ()
62
delRow _ False = return ()
26
false
true
0
9
13
38
17
21
null
null
ghcjs/ghcjs-sodium
src/Alder/Html/Internal.hs
mit
(!?.) :: Attributable h => h -> (Bool, Text) -> h h !?. (p, v) = if p then h !. v else h
88
(!?.) :: Attributable h => h -> (Bool, Text) -> h h !?. (p, v) = if p then h !. v else h
88
h !?. (p, v) = if p then h !. v else h
38
false
true
0
10
23
63
33
30
null
null
olsner/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
ppr_cmd (HsCmdIf _ e ct ce) = sep [hsep [text "if", nest 2 (ppr e), ptext (sLit "then")], nest 4 (ppr ct), text "else", nest 4 (ppr ce)]
165
ppr_cmd (HsCmdIf _ e ct ce) = sep [hsep [text "if", nest 2 (ppr e), ptext (sLit "then")], nest 4 (ppr ct), text "else", nest 4 (ppr ce)]
165
ppr_cmd (HsCmdIf _ e ct ce) = sep [hsep [text "if", nest 2 (ppr e), ptext (sLit "then")], nest 4 (ppr ct), text "else", nest 4 (ppr ce)]
165
false
false
0
10
56
97
47
50
null
null
reiddraper/haskell-simple-check
src/Test/SimpleCheck/Gen.hs
bsd-3-clause
mktree :: (Random a, Integral a) => StdGen -> (a, a) -> RoseTree a mktree r rng = filterRose (mkfilter rng) $ integralRoseTree x where (x,_) = randomR rng r mkfilter (a, b) y = y >= a && y <= b
207
mktree :: (Random a, Integral a) => StdGen -> (a, a) -> RoseTree a mktree r rng = filterRose (mkfilter rng) $ integralRoseTree x where (x,_) = randomR rng r mkfilter (a, b) y = y >= a && y <= b
207
mktree r rng = filterRose (mkfilter rng) $ integralRoseTree x where (x,_) = randomR rng r mkfilter (a, b) y = y >= a && y <= b
140
false
true
1
9
55
111
57
54
null
null