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
mitchellwrosen/dohaskell
src/Model/Resource/Internal.hs
bsd-3-clause
shortReadResourceTypePlural "tutorials" = Just ExtendedExample
74
shortReadResourceTypePlural "tutorials" = Just ExtendedExample
74
shortReadResourceTypePlural "tutorials" = Just ExtendedExample
74
false
false
0
5
16
12
5
7
null
null
jfischoff/opengl-eval
src/OpenGL/Evaluator/GLFunction.hs
bsd-3-clause
size_of_tgl TGLuint = 4
27
size_of_tgl TGLuint = 4
27
size_of_tgl TGLuint = 4
27
false
false
0
5
7
9
4
5
null
null
gcross/habit-of-fate
sources/library/HabitOfFate/Story.hs
agpl-3.0
{- template ∷ Outcomes Story template = [outcomes| ================================= Common Title ================================= ================================= Common Story ================================= ================================ Common Question =============================== ================================ Success Choice ================================ ================================= Success Title ================================ ================================= Success Story ================================ ================================ Averted Choice ================================ ================================= Averted Title ================================ ================================= Averted Story ================================ ================================ Failure Choice ================================ ================================= Failure Title ================================ ================================= Failure Story ================================ ===================================== Shame ==================================== |] -} commonDangerAvertedFailureSuccess = [ AvertedChoice , AvertedStory , AvertedTitle , CommonQuestion , CommonStory , CommonTitle , DangerChoice , DangerQuestion , DangerStory , DangerTitle , FailureChoice , FailureStory , FailureTitle , SuccessChoice , SuccessStory , SuccessTitle ]
1,438
commonDangerAvertedFailureSuccess = [ AvertedChoice , AvertedStory , AvertedTitle , CommonQuestion , CommonStory , CommonTitle , DangerChoice , DangerQuestion , DangerStory , DangerTitle , FailureChoice , FailureStory , FailureTitle , SuccessChoice , SuccessStory , SuccessTitle ]
314
commonDangerAvertedFailureSuccess = [ AvertedChoice , AvertedStory , AvertedTitle , CommonQuestion , CommonStory , CommonTitle , DangerChoice , DangerQuestion , DangerStory , DangerTitle , FailureChoice , FailureStory , FailureTitle , SuccessChoice , SuccessStory , SuccessTitle ]
314
true
false
0
5
143
55
36
19
null
null
ganeti-github-testing/ganeti-test-1
src/Ganeti/Constants.hs
bsd-2-clause
hvKvmSpiceAudioCompr :: String hvKvmSpiceAudioCompr = "spice_playback_compression"
82
hvKvmSpiceAudioCompr :: String hvKvmSpiceAudioCompr = "spice_playback_compression"
82
hvKvmSpiceAudioCompr = "spice_playback_compression"
51
false
true
0
4
5
11
6
5
null
null
rodrigogribeiro/mptc
test/Data/TestCase1TypeOrdering.hs
bsd-3-clause
testcase10 = (t11, t11, True)
29
testcase10 = (t11, t11, True)
29
testcase10 = (t11, t11, True)
29
false
false
1
5
4
18
9
9
null
null
nushio3/ghc
compiler/simplCore/CoreMonad.hs
bsd-3-clause
cmpEqTick (UnfoldingDone a) (UnfoldingDone b) = a `compare` b
87
cmpEqTick (UnfoldingDone a) (UnfoldingDone b) = a `compare` b
87
cmpEqTick (UnfoldingDone a) (UnfoldingDone b) = a `compare` b
87
false
false
1
8
34
33
15
18
null
null
lpsmith/blaze-builder-compat
src/Blaze/ByteString/Builder/Internal/Write.hs
bsd-3-clause
exactWrite :: Int -> (Ptr Word8 -> IO ()) -> Write exactWrite size io = Write size (pokeN size io)
120
exactWrite :: Int -> (Ptr Word8 -> IO ()) -> Write exactWrite size io = Write size (pokeN size io)
120
exactWrite size io = Write size (pokeN size io)
47
false
true
0
10
41
52
25
27
null
null
brendanhay/gogol
gogol-admin-directory/gen/Network/Google/Resource/Admin/Customers/Chrome/Printers/List.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). ccplUploadProtocol :: Lens' CustomersChromePrintersList (Maybe Text) ccplUploadProtocol = lens _ccplUploadProtocol (\ s a -> s{_ccplUploadProtocol = a})
222
ccplUploadProtocol :: Lens' CustomersChromePrintersList (Maybe Text) ccplUploadProtocol = lens _ccplUploadProtocol (\ s a -> s{_ccplUploadProtocol = a})
160
ccplUploadProtocol = lens _ccplUploadProtocol (\ s a -> s{_ccplUploadProtocol = a})
91
true
true
0
9
33
48
25
23
null
null
brtmr/Eden-Tracelab-cli-tool
src/Bachelor/DataBase.hs
gpl-3.0
nsertMachine :: DBInfo -> MachineId-> IO DBInfo insertMachine dbi mid = do let conn = db_connection dbi traceKey = db_traceKey dbi machineKey <- head <$> query conn insertMachineQuery (mid, traceKey) case machineKey of Only key -> do return $ dbi { db_machines = M.insert mid key (db_machines dbi) } _ -> error "machine insertion failed"
432
insertMachine :: DBInfo -> MachineId-> IO DBInfo insertMachine dbi mid = do let conn = db_connection dbi traceKey = db_traceKey dbi machineKey <- head <$> query conn insertMachineQuery (mid, traceKey) case machineKey of Only key -> do return $ dbi { db_machines = M.insert mid key (db_machines dbi) } _ -> error "machine insertion failed"
432
insertMachine dbi mid = do let conn = db_connection dbi traceKey = db_traceKey dbi machineKey <- head <$> query conn insertMachineQuery (mid, traceKey) case machineKey of Only key -> do return $ dbi { db_machines = M.insert mid key (db_machines dbi) } _ -> error "machine insertion failed"
383
false
true
1
15
149
127
60
67
null
null
brendanhay/gogol
gogol-cloudiot/gen/Network/Google/Resource/CloudIOT/Projects/Locations/Registries/GetIAMPolicy.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). plrgipUploadProtocol :: Lens' ProjectsLocationsRegistriesGetIAMPolicy (Maybe Text) plrgipUploadProtocol = lens _plrgipUploadProtocol (\ s a -> s{_plrgipUploadProtocol = a})
242
plrgipUploadProtocol :: Lens' ProjectsLocationsRegistriesGetIAMPolicy (Maybe Text) plrgipUploadProtocol = lens _plrgipUploadProtocol (\ s a -> s{_plrgipUploadProtocol = a})
180
plrgipUploadProtocol = lens _plrgipUploadProtocol (\ s a -> s{_plrgipUploadProtocol = a})
97
true
true
0
8
33
49
25
24
null
null
wilbowma/accelerate
Data/Array/Accelerate/Language.hs
bsd-3-clause
(?) :: Elt t => Exp Bool -> (Exp t, Exp t) -> Exp t c ? (t, e) = Exp $ Cond c t e
81
(?) :: Elt t => Exp Bool -> (Exp t, Exp t) -> Exp t c ? (t, e) = Exp $ Cond c t e
81
c ? (t, e) = Exp $ Cond c t e
29
false
true
0
10
25
72
35
37
null
null
beni55/Historical-Cryptography
Codec/Encryption/Historical/XOR/Analysis.hs
mit
crackPart :: Histogram Char -> String -> Char crackPart h cypher = fst $ head $ sortBy (comparing best) goodSolutions where best :: (Char, Histogram Char) -> Float best = histogramDelta h . snd goodSolutions :: [(Char, Histogram Char)] goodSolutions = filter ((>20) . length . snd) solutions solutions :: [(Char, Histogram Char)] solutions = map ((id &&& histogram . singletonDecode cypher) . B.w2c) [minBound..maxBound]
448
crackPart :: Histogram Char -> String -> Char crackPart h cypher = fst $ head $ sortBy (comparing best) goodSolutions where best :: (Char, Histogram Char) -> Float best = histogramDelta h . snd goodSolutions :: [(Char, Histogram Char)] goodSolutions = filter ((>20) . length . snd) solutions solutions :: [(Char, Histogram Char)] solutions = map ((id &&& histogram . singletonDecode cypher) . B.w2c) [minBound..maxBound]
448
crackPart h cypher = fst $ head $ sortBy (comparing best) goodSolutions where best :: (Char, Histogram Char) -> Float best = histogramDelta h . snd goodSolutions :: [(Char, Histogram Char)] goodSolutions = filter ((>20) . length . snd) solutions solutions :: [(Char, Histogram Char)] solutions = map ((id &&& histogram . singletonDecode cypher) . B.w2c) [minBound..maxBound]
402
false
true
3
10
92
181
93
88
null
null
sashabu/libcspm
src/CSPM/Syntax/DataTypeAnalyser.hs
bsd-3-clause
-- | Determine if the expression, which is a type expression, is actually -- trivial in that it can never fail on a particular value. This is the case -- when the expression evaluates to the set of all values of a given type. This -- function approximates this in a conservative fashion. fieldExpressionIsTrivial :: TCExp -> Bool fieldExpressionIsTrivial (An _ _ (Var n)) | n `elem` builtinCompleteDataTypeSets = True
417
fieldExpressionIsTrivial :: TCExp -> Bool fieldExpressionIsTrivial (An _ _ (Var n)) | n `elem` builtinCompleteDataTypeSets = True
129
fieldExpressionIsTrivial (An _ _ (Var n)) | n `elem` builtinCompleteDataTypeSets = True
87
true
true
0
9
69
50
27
23
null
null
HyperGainZ/neobot
mediawiki/MediaWiki/API/Query/UserContribs/Import.hs
bsd-3-clause
stringXml :: String -> Either (String,[{-Error msg-}String]) UserContribsResponse stringXml s = parseDoc xml s
110
stringXml :: String -> Either (String,[{-Error msg-}String]) UserContribsResponse stringXml s = parseDoc xml s
110
stringXml s = parseDoc xml s
28
false
true
0
9
13
44
21
23
null
null
spechub/Hets
VSE/As.hs
gpl-2.0
gnEqName :: SORT -> Id gnEqName = genSortName "eq_"
51
gnEqName :: SORT -> Id gnEqName = genSortName "eq_"
51
gnEqName = genSortName "eq_"
28
false
true
0
5
8
18
9
9
null
null
lynnard/reflex-cocos2d
src/Reflex/EventVisitor.hs
mit
previewFree :: FreeF f a b -> Maybe (f b) previewFree (Free fb) = Just fb
73
previewFree :: FreeF f a b -> Maybe (f b) previewFree (Free fb) = Just fb
73
previewFree (Free fb) = Just fb
31
false
true
0
9
15
47
21
26
null
null
termite2/tsl
TSL2Boogie/Spec2Boogie.hs
bsd-3-clause
mkGen :: (?spec::Spec) => Transducer -> [(Path,String)] -> Symbol -> Doc mkGen x ports sym = while (pp "*") body where body = (if isSeq $ symbolType sym then empty else (havoc $ showSymbol sym) $+$ (vcat $ map (\(path,port) -> call (handlerName path (port:tail sym)) [showSymbol sym]) ports)) $+$ (vcat $ map (mkGen x ports) $ symChildren (symbolType sym) sym)
461
mkGen :: (?spec::Spec) => Transducer -> [(Path,String)] -> Symbol -> Doc mkGen x ports sym = while (pp "*") body where body = (if isSeq $ symbolType sym then empty else (havoc $ showSymbol sym) $+$ (vcat $ map (\(path,port) -> call (handlerName path (port:tail sym)) [showSymbol sym]) ports)) $+$ (vcat $ map (mkGen x ports) $ symChildren (symbolType sym) sym)
461
mkGen x ports sym = while (pp "*") body where body = (if isSeq $ symbolType sym then empty else (havoc $ showSymbol sym) $+$ (vcat $ map (\(path,port) -> call (handlerName path (port:tail sym)) [showSymbol sym]) ports)) $+$ (vcat $ map (mkGen x ports) $ symChildren (symbolType sym) sym)
388
false
true
3
18
161
202
101
101
null
null
rudymatela/llcheck
src/Test/LeanCheck/Derive.hs
bsd-3-clause
normalizeTypeUnits :: Name -> Q Type normalizeTypeUnits t = do ar <- typeArity t return (foldl AppT (ConT t) (replicate ar (TupleT 0))) -- Given a type name and a class name, -- returns whether the type is an instance of that class.
239
normalizeTypeUnits :: Name -> Q Type normalizeTypeUnits t = do ar <- typeArity t return (foldl AppT (ConT t) (replicate ar (TupleT 0))) -- Given a type name and a class name, -- returns whether the type is an instance of that class.
239
normalizeTypeUnits t = do ar <- typeArity t return (foldl AppT (ConT t) (replicate ar (TupleT 0))) -- Given a type name and a class name, -- returns whether the type is an instance of that class.
202
false
true
0
13
49
69
33
36
null
null
iqsf/HFitUI
src/WebUI/Widgets/UIWidget.hs
bsd-3-clause
none :: WidgetUI -> UI WidgetUI none widget = do return widget { wui_attr_style = (wui_attr_style widget) ++ "display: none;" } -- | Способ отображения run_in
159
none :: WidgetUI -> UI WidgetUI none widget = do return widget { wui_attr_style = (wui_attr_style widget) ++ "display: none;" } -- | Способ отображения run_in
159
none widget = do return widget { wui_attr_style = (wui_attr_style widget) ++ "display: none;" } -- | Способ отображения run_in
127
false
true
0
13
26
51
24
27
null
null
bgamari/pandoc
src/Text/Pandoc/Readers/Org.hs
gpl-2.0
emphasisBetween :: Char -> OrgParser (F Inlines) emphasisBetween c = try $ do startEmphasisNewlinesCounting emphasisAllowedNewlines res <- enclosedInlines (emphasisStart c) (emphasisEnd c) isTopLevelEmphasis <- null . orgStateEmphasisCharStack <$> getState when isTopLevelEmphasis resetEmphasisNewlines return res
346
emphasisBetween :: Char -> OrgParser (F Inlines) emphasisBetween c = try $ do startEmphasisNewlinesCounting emphasisAllowedNewlines res <- enclosedInlines (emphasisStart c) (emphasisEnd c) isTopLevelEmphasis <- null . orgStateEmphasisCharStack <$> getState when isTopLevelEmphasis resetEmphasisNewlines return res
346
emphasisBetween c = try $ do startEmphasisNewlinesCounting emphasisAllowedNewlines res <- enclosedInlines (emphasisStart c) (emphasisEnd c) isTopLevelEmphasis <- null . orgStateEmphasisCharStack <$> getState when isTopLevelEmphasis resetEmphasisNewlines return res
281
false
true
0
11
66
90
40
50
null
null
bergmark/hlint
src/HSE/Util.hs
bsd-3-clause
isString :: Exp_ -> Bool isString (Lit _ String{}) = True
57
isString :: Exp_ -> Bool isString (Lit _ String{}) = True
57
isString (Lit _ String{}) = True
32
false
true
0
8
10
30
15
15
null
null
kaizhang/bioinformatics-toolkit
bioinformatics-toolkit/src/Bio/Data/Bam.hs
mit
-- | Convert pairedend bam file to bed. the bam file must be sorted by names, -- e.g., using "samtools sort -n". This condition is checked from Bam header. sortedBamToBedPE :: Monad m => BAMHeader -> ConduitT BAM (BED, BED) m () sortedBamToBedPE header = case getSortOrder header of Queryname -> loopBedPE .| concatC _ -> error "Bam file must be sorted by NAME." where loopBedPE = (,) <$$> await <***> await >>= \case Nothing -> return () Just (bam1, bam2) -> if queryName bam1 /= queryName bam2 then error "Adjacent records have different query names. Aborted." else do yield $ (,) <$> bamToBed header bam1 <*> bamToBed header bam2 loopBedPE where (<$$>) = fmap . fmap (<***>) = (<*>) . fmap (<*>)
815
sortedBamToBedPE :: Monad m => BAMHeader -> ConduitT BAM (BED, BED) m () sortedBamToBedPE header = case getSortOrder header of Queryname -> loopBedPE .| concatC _ -> error "Bam file must be sorted by NAME." where loopBedPE = (,) <$$> await <***> await >>= \case Nothing -> return () Just (bam1, bam2) -> if queryName bam1 /= queryName bam2 then error "Adjacent records have different query names. Aborted." else do yield $ (,) <$> bamToBed header bam1 <*> bamToBed header bam2 loopBedPE where (<$$>) = fmap . fmap (<***>) = (<*>) . fmap (<*>)
659
sortedBamToBedPE header = case getSortOrder header of Queryname -> loopBedPE .| concatC _ -> error "Bam file must be sorted by NAME." where loopBedPE = (,) <$$> await <***> await >>= \case Nothing -> return () Just (bam1, bam2) -> if queryName bam1 /= queryName bam2 then error "Adjacent records have different query names. Aborted." else do yield $ (,) <$> bamToBed header bam1 <*> bamToBed header bam2 loopBedPE where (<$$>) = fmap . fmap (<***>) = (<*>) . fmap (<*>)
586
true
true
0
15
239
204
105
99
null
null
ghc-android/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
mempty_RDR = varQual_RDR gHC_BASE (fsLit "mempty")
74
mempty_RDR = varQual_RDR gHC_BASE (fsLit "mempty")
74
mempty_RDR = varQual_RDR gHC_BASE (fsLit "mempty")
74
false
false
0
7
29
17
8
9
null
null
MatthiasHu/4d-labyrinth
src/Transformation.hs
gpl-3.0
translation :: (SomeVector v, Num a) => v a -> Transformation v a translation t = Transformation identity t
109
translation :: (SomeVector v, Num a) => v a -> Transformation v a translation t = Transformation identity t
109
translation t = Transformation identity t
41
false
true
0
7
20
46
22
24
null
null
bitemyapp/ghc
compiler/cmm/CLabel.hs
bsd-3-clause
externallyVisibleCLabel (PlainModuleInitLabel _)= True
54
externallyVisibleCLabel (PlainModuleInitLabel _)= True
54
externallyVisibleCLabel (PlainModuleInitLabel _)= True
54
false
false
0
7
3
15
7
8
null
null
robstewart57/stack
src/Stack/Types/Build.hs
bsd-3-clause
defaultTestOpts :: TestOpts defaultTestOpts = TestOpts { toRerunTests = True , toAdditionalArgs = [] , toCoverage = False , toDisableRun = False }
166
defaultTestOpts :: TestOpts defaultTestOpts = TestOpts { toRerunTests = True , toAdditionalArgs = [] , toCoverage = False , toDisableRun = False }
166
defaultTestOpts = TestOpts { toRerunTests = True , toAdditionalArgs = [] , toCoverage = False , toDisableRun = False }
138
false
true
0
8
42
43
25
18
null
null
iand675/metrics
src/Data/Metrics/Timer/Internal.hs
mit
update :: NominalDiffTime -> Double -> Timer -> Timer update t x = (histogram %~ H.update x t) . (meter %~ M.mark t 1)
118
update :: NominalDiffTime -> Double -> Timer -> Timer update t x = (histogram %~ H.update x t) . (meter %~ M.mark t 1)
118
update t x = (histogram %~ H.update x t) . (meter %~ M.mark t 1)
64
false
true
0
9
23
60
30
30
null
null
zaxtax/hakaru
haskell/Language/Hakaru/CodeGen/Flatten.hs
bsd-3-clause
flattenTerm (Datum_ d) = flattenDatum d
46
flattenTerm (Datum_ d) = flattenDatum d
46
flattenTerm (Datum_ d) = flattenDatum d
46
false
false
0
7
12
18
8
10
null
null
triplepointfive/cereal
tests/Benchmark.hs
bsd-3-clause
putWord32N16Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return () loop s n = do putWord32le (s+0) putWord32le (s+1) putWord32le (s+2) putWord32le (s+3) putWord32le (s+4) putWord32le (s+5) putWord32le (s+6) putWord32le (s+7) putWord32le (s+8) putWord32le (s+9) putWord32le (s+10) putWord32le (s+11) putWord32le (s+12) putWord32le (s+13) putWord32le (s+14) putWord32le (s+15) loop (s+16) (n-16) ------------------------------------------------------------------------
688
putWord32N16Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return () loop s n = do putWord32le (s+0) putWord32le (s+1) putWord32le (s+2) putWord32le (s+3) putWord32le (s+4) putWord32le (s+5) putWord32le (s+6) putWord32le (s+7) putWord32le (s+8) putWord32le (s+9) putWord32le (s+10) putWord32le (s+11) putWord32le (s+12) putWord32le (s+13) putWord32le (s+14) putWord32le (s+15) loop (s+16) (n-16) ------------------------------------------------------------------------
688
putWord32N16Little = loop 0 where loop s n | s `seq` n `seq` False = undefined loop _ 0 = return () loop s n = do putWord32le (s+0) putWord32le (s+1) putWord32le (s+2) putWord32le (s+3) putWord32le (s+4) putWord32le (s+5) putWord32le (s+6) putWord32le (s+7) putWord32le (s+8) putWord32le (s+9) putWord32le (s+10) putWord32le (s+11) putWord32le (s+12) putWord32le (s+13) putWord32le (s+14) putWord32le (s+15) loop (s+16) (n-16) ------------------------------------------------------------------------
688
false
false
3
10
251
301
140
161
null
null
goldfirere/units
units-test/Tests/Compile/Physics.hs
bsd-3-clause
cgsTime :: MkQu_DLN Time CGS Double cgsTime = 4 % Second
56
cgsTime :: MkQu_DLN Time CGS Double cgsTime = 4 % Second
56
cgsTime = 4 % Second
20
false
true
2
5
10
28
11
17
null
null
emc2/static-dict
test/PerfTest.hs
bsd-3-clause
intmapLookupBenchmark :: IntMap Int -> [Int] -> Benchmark intmapLookupBenchmark m = bench "IntMap" . nf (map (\i -> IntMap.lookup i m))
135
intmapLookupBenchmark :: IntMap Int -> [Int] -> Benchmark intmapLookupBenchmark m = bench "IntMap" . nf (map (\i -> IntMap.lookup i m))
135
intmapLookupBenchmark m = bench "IntMap" . nf (map (\i -> IntMap.lookup i m))
77
false
true
0
12
20
59
29
30
null
null
byteally/webapi
webapi-swagger/src/SwaggerGen.hs
bsd-3-clause
schemaDefinitions :: (DefinitionName -> SwaggerGenerator Ref) -> Provenance -> Definitions Schema -> SwaggerGenerator [Ref] schemaDefinitions defLookup prov defs = OHM.foldlWithKey' (\ !s k sc -> do xs <- s x <- schemaDefinition defLookup prov k sc pure (x : xs) ) (pure []) defs
373
schemaDefinitions :: (DefinitionName -> SwaggerGenerator Ref) -> Provenance -> Definitions Schema -> SwaggerGenerator [Ref] schemaDefinitions defLookup prov defs = OHM.foldlWithKey' (\ !s k sc -> do xs <- s x <- schemaDefinition defLookup prov k sc pure (x : xs) ) (pure []) defs
373
schemaDefinitions defLookup prov defs = OHM.foldlWithKey' (\ !s k sc -> do xs <- s x <- schemaDefinition defLookup prov k sc pure (x : xs) ) (pure []) defs
249
false
true
0
12
137
115
55
60
null
null
TravisWhitaker/discern
src/Discern/Report.hs
mit
renderModuleReport :: ModuleReport -> [String] renderModuleReport (ModuleReport n []) = ["Module " ++ n ++ "has no tests or couldn't be loaded."]
145
renderModuleReport :: ModuleReport -> [String] renderModuleReport (ModuleReport n []) = ["Module " ++ n ++ "has no tests or couldn't be loaded."]
145
renderModuleReport (ModuleReport n []) = ["Module " ++ n ++ "has no tests or couldn't be loaded."]
98
false
true
0
8
21
42
22
20
null
null
paholg/dotfiles
home/xmonad.hs
gpl-2.0
my_workspaces = ["^ca(1,xdotool key super+"++cmd++") "++display++" ^ca()" | ws <- ws_list, let display = ws, let cmd = if ws == "`" then "grave" else if ws == "-" then "minus" else if ws == "=" then "equal" else ws ]
364
my_workspaces = ["^ca(1,xdotool key super+"++cmd++") "++display++" ^ca()" | ws <- ws_list, let display = ws, let cmd = if ws == "`" then "grave" else if ws == "-" then "minus" else if ws == "=" then "equal" else ws ]
364
my_workspaces = ["^ca(1,xdotool key super+"++cmd++") "++display++" ^ca()" | ws <- ws_list, let display = ws, let cmd = if ws == "`" then "grave" else if ws == "-" then "minus" else if ws == "=" then "equal" else ws ]
364
false
false
0
13
188
89
48
41
null
null
CRogers/stack
src/main/Main.hs
bsd-3-clause
execOptsParser :: Maybe String -- ^ command -> Parser ExecOpts execOptsParser mcmd = ExecOpts <$> maybe eoCmdParser pure mcmd <*> eoArgsParser <*> (eoPlainParser <|> ExecOptsEmbellished <$> eoEnvSettingsParser <*> eoPackagesParser) where eoCmdParser :: Parser String eoCmdParser = strArgument (metavar "CMD") eoArgsParser :: Parser [String] eoArgsParser = many (strArgument (metavar "-- ARGS (e.g. stack ghc -- X.hs -o x)")) eoEnvSettingsParser :: Parser EnvSettings eoEnvSettingsParser = EnvSettings <$> pure True <*> boolFlags True "ghc-package-path" "setting the GHC_PACKAGE_PATH variable for the subprocess" idm <*> boolFlags True "stack-exe" "setting the STACK_EXE environment variable to the path for the stack executable" idm eoPackagesParser :: Parser [String] eoPackagesParser = packagesParser eoPlainParser :: Parser ExecOptsExtra eoPlainParser = flag' ExecOptsPlain (long "plain" <> help "Use an unmodified environment (only useful with Docker)") -- | Execute a command.
1,289
execOptsParser :: Maybe String -- ^ command -> Parser ExecOpts execOptsParser mcmd = ExecOpts <$> maybe eoCmdParser pure mcmd <*> eoArgsParser <*> (eoPlainParser <|> ExecOptsEmbellished <$> eoEnvSettingsParser <*> eoPackagesParser) where eoCmdParser :: Parser String eoCmdParser = strArgument (metavar "CMD") eoArgsParser :: Parser [String] eoArgsParser = many (strArgument (metavar "-- ARGS (e.g. stack ghc -- X.hs -o x)")) eoEnvSettingsParser :: Parser EnvSettings eoEnvSettingsParser = EnvSettings <$> pure True <*> boolFlags True "ghc-package-path" "setting the GHC_PACKAGE_PATH variable for the subprocess" idm <*> boolFlags True "stack-exe" "setting the STACK_EXE environment variable to the path for the stack executable" idm eoPackagesParser :: Parser [String] eoPackagesParser = packagesParser eoPlainParser :: Parser ExecOptsExtra eoPlainParser = flag' ExecOptsPlain (long "plain" <> help "Use an unmodified environment (only useful with Docker)") -- | Execute a command.
1,289
execOptsParser mcmd = ExecOpts <$> maybe eoCmdParser pure mcmd <*> eoArgsParser <*> (eoPlainParser <|> ExecOptsEmbellished <$> eoEnvSettingsParser <*> eoPackagesParser) where eoCmdParser :: Parser String eoCmdParser = strArgument (metavar "CMD") eoArgsParser :: Parser [String] eoArgsParser = many (strArgument (metavar "-- ARGS (e.g. stack ghc -- X.hs -o x)")) eoEnvSettingsParser :: Parser EnvSettings eoEnvSettingsParser = EnvSettings <$> pure True <*> boolFlags True "ghc-package-path" "setting the GHC_PACKAGE_PATH variable for the subprocess" idm <*> boolFlags True "stack-exe" "setting the STACK_EXE environment variable to the path for the stack executable" idm eoPackagesParser :: Parser [String] eoPackagesParser = packagesParser eoPlainParser :: Parser ExecOptsExtra eoPlainParser = flag' ExecOptsPlain (long "plain" <> help "Use an unmodified environment (only useful with Docker)") -- | Execute a command.
1,211
false
true
16
9
435
223
112
111
null
null
PseudoPower/AFSM
src/Data/AFSM/SFA.hs
mit
sfaexec :: SFA a b -> [a] -> (SFA a b, [b]) sfaexec = unsafeCoerce# sfaexec'
76
sfaexec :: SFA a b -> [a] -> (SFA a b, [b]) sfaexec = unsafeCoerce# sfaexec'
76
sfaexec = unsafeCoerce# sfaexec'
32
false
true
0
8
15
44
23
21
null
null
harrisi/on-being-better
list-expansion/Haskell/cis194/01/HW01.hs
cc0-1.0
{-- For future me: I have data such as 12345 I want to get the last element of the data There does exist a function `last` which gives the last element of a list (although `last` is a partial function, so a better solution does exist. I am not overly concerned with this, however) Ergo, I want to get 12345 to be shoved into a list structure Knowing that a string "foo" is ['f', 'o', 'o'], `last "foo"` is 'o' Calling `show` on 12345 gives "12345" which is close to what I want I then call `last` on "12345" which gives '5' Now I want it back to an Integer. I have at least two options here The option I'm using above is to convert the char to an Int, and then convert the Int to an Integer (The assignment requires the type of `lastDigit` to be Integer -> Integer) Alternatively (ideally) I would just call `read` after `last` which would make a nice function of `read . last . show` However, I cannot call `read` on '5' because '5' is a Char, not a [Char] (which is a String) I could use `repeat` which has type a -> [a], and simply returns an infinite list of the same value repeated But then I would need to just get the first element (using `take 1`) and then `read` that This would leave me with the following definition of `lastDigit'` I think I prefer the above version, although the below definition is more general. --} lastDigit' :: Integer -> Integer lastDigit' = read . take 1 . repeat . last . show
1,413
lastDigit' :: Integer -> Integer lastDigit' = read . take 1 . repeat . last . show
82
lastDigit' = read . take 1 . repeat . last . show
49
true
true
0
9
271
35
18
17
null
null
samcal/rasa
rasa-ext-vim/src/Rasa/Ext/Vim.hs
gpl-3.0
addHist :: Keypress -> BufAction () addHist keypress = overBufExt extend where extend (VimHist hist) = VimHist $ hist ++ [keypress]
133
addHist :: Keypress -> BufAction () addHist keypress = overBufExt extend where extend (VimHist hist) = VimHist $ hist ++ [keypress]
133
addHist keypress = overBufExt extend where extend (VimHist hist) = VimHist $ hist ++ [keypress]
97
false
true
0
7
22
53
26
27
null
null
OpenXT/network
nws/NetworkManager.hs
gpl-2.0
nmDeviceManaged nmDevObj = orgFreedesktopNetworkManagerDeviceGetManaged nmService nmDevObj
90
nmDeviceManaged nmDevObj = orgFreedesktopNetworkManagerDeviceGetManaged nmService nmDevObj
90
nmDeviceManaged nmDevObj = orgFreedesktopNetworkManagerDeviceGetManaged nmService nmDevObj
90
false
false
0
5
5
14
6
8
null
null
BartAdv/idris-cil
src/IRTS/Cil/FFI.hs
bsd-3-clause
isIO :: FDesc -> Bool isIO (FIO _) = True
41
isIO :: FDesc -> Bool isIO (FIO _) = True
41
isIO (FIO _) = True
19
false
true
0
7
9
24
12
12
null
null
alexander-at-github/eta
compiler/ETA/Types/Type.hs
bsd-3-clause
-- | Is this a numeric literal. We also look through type synonyms. isNumLitTy :: Type -> Maybe Integer isNumLitTy ty | Just ty1 <- tcView ty = isNumLitTy ty1
158
isNumLitTy :: Type -> Maybe Integer isNumLitTy ty | Just ty1 <- tcView ty = isNumLitTy ty1
90
isNumLitTy ty | Just ty1 <- tcView ty = isNumLitTy ty1
54
true
true
0
9
29
41
18
23
null
null
ml9951/ghc
compiler/nativeGen/AsmCodeGen.hs
bsd-3-clause
cmmExprConFold :: ReferenceKind -> CmmExpr -> CmmOptM CmmExpr cmmExprConFold referenceKind expr = do dflags <- getDynFlags -- With -O1 and greater, the cmmSink pass does constant-folding, so -- we don't need to do it again here. let expr' = if optLevel dflags >= 1 then expr else cmmExprCon dflags expr cmmExprNative referenceKind expr'
398
cmmExprConFold :: ReferenceKind -> CmmExpr -> CmmOptM CmmExpr cmmExprConFold referenceKind expr = do dflags <- getDynFlags -- With -O1 and greater, the cmmSink pass does constant-folding, so -- we don't need to do it again here. let expr' = if optLevel dflags >= 1 then expr else cmmExprCon dflags expr cmmExprNative referenceKind expr'
398
cmmExprConFold referenceKind expr = do dflags <- getDynFlags -- With -O1 and greater, the cmmSink pass does constant-folding, so -- we don't need to do it again here. let expr' = if optLevel dflags >= 1 then expr else cmmExprCon dflags expr cmmExprNative referenceKind expr'
336
false
true
0
12
114
73
35
38
null
null
apyrgio/snf-ganeti
src/Ganeti/Query/Language.hs
bsd-2-clause
traverseFlt f (TrueFilter a) = TrueFilter <$> f a
52
traverseFlt f (TrueFilter a) = TrueFilter <$> f a
52
traverseFlt f (TrueFilter a) = TrueFilter <$> f a
52
false
false
0
6
11
26
11
15
null
null
thomie/vector
Data/Vector/Fusion/Stream/Monadic.hs
bsd-3-clause
enumFromTo_small x y = x `seq` y `seq` Stream step x where {-# INLINE_INNER step #-} step w | w <= y = return $ Yield w (w+1) | otherwise = return $ Done
179
enumFromTo_small x y = x `seq` y `seq` Stream step x where {-# INLINE_INNER step #-} step w | w <= y = return $ Yield w (w+1) | otherwise = return $ Done
179
enumFromTo_small x y = x `seq` y `seq` Stream step x where {-# INLINE_INNER step #-} step w | w <= y = return $ Yield w (w+1) | otherwise = return $ Done
179
false
false
1
9
59
91
42
49
null
null
ilyasergey/GHC-XAppFix
compiler/llvmGen/Llvm/Types.hs
bsd-3-clause
pVarLift (LMLitVar _ ) = error $ "Can't lower a literal type!"
74
pVarLift (LMLitVar _ ) = error $ "Can't lower a literal type!"
74
pVarLift (LMLitVar _ ) = error $ "Can't lower a literal type!"
74
false
false
0
7
23
19
9
10
null
null
MichaelMackus/hsrl
RL/Generator/Items.hs
mit
itemRarity d (Item "Arrow" _) = (2 % 10)
51
itemRarity d (Item "Arrow" _) = (2 % 10)
51
itemRarity d (Item "Arrow" _) = (2 % 10)
51
false
false
0
7
19
26
13
13
null
null
olorin/amazonka
amazonka-storagegateway/test/Test/AWS/Gen/StorageGateway.hs
mpl-2.0
testCreateCachediSCSIVolume :: CreateCachediSCSIVolume -> TestTree testCreateCachediSCSIVolume = req "CreateCachediSCSIVolume" "fixture/CreateCachediSCSIVolume.yaml"
173
testCreateCachediSCSIVolume :: CreateCachediSCSIVolume -> TestTree testCreateCachediSCSIVolume = req "CreateCachediSCSIVolume" "fixture/CreateCachediSCSIVolume.yaml"
173
testCreateCachediSCSIVolume = req "CreateCachediSCSIVolume" "fixture/CreateCachediSCSIVolume.yaml"
106
false
true
0
5
17
21
10
11
null
null
slpopejoy/fadno-xml
src/Fadno/Gen/GenMusicXml.hs
bsd-2-clause
loadXlinkXmlSchemas :: IO Schema loadXlinkXmlSchemas = do xml <- namespaceSchema "xml" <$> parseFile "xsd/xml.xsd" xlink <- namespaceSchema "xlink" <$> parseFile "xsd/xlink.xsd" xsd <- loadXsdSchema "xsd/XMLSchema.xsd" return (xml <> xlink <> xsd) -- | Load Music XML XSD and deps
289
loadXlinkXmlSchemas :: IO Schema loadXlinkXmlSchemas = do xml <- namespaceSchema "xml" <$> parseFile "xsd/xml.xsd" xlink <- namespaceSchema "xlink" <$> parseFile "xsd/xlink.xsd" xsd <- loadXsdSchema "xsd/XMLSchema.xsd" return (xml <> xlink <> xsd) -- | Load Music XML XSD and deps
289
loadXlinkXmlSchemas = do xml <- namespaceSchema "xml" <$> parseFile "xsd/xml.xsd" xlink <- namespaceSchema "xlink" <$> parseFile "xsd/xlink.xsd" xsd <- loadXsdSchema "xsd/XMLSchema.xsd" return (xml <> xlink <> xsd) -- | Load Music XML XSD and deps
256
false
true
0
11
47
82
35
47
null
null
Javran/Project-Euler
src/ProjectEuler/Problem31.hs
mit
problem :: Problem problem = pureProblem 31 Solved result
57
problem :: Problem problem = pureProblem 31 Solved result
57
problem = pureProblem 31 Solved result
38
false
true
0
5
8
18
9
9
null
null
Cahu/krpc-hs
src/KRPCHS/SpaceCenter.hs
gpl-3.0
getRadiatorStateStreamReq :: KRPCHS.SpaceCenter.Radiator -> KRPCStreamReq (KRPCHS.SpaceCenter.RadiatorState) getRadiatorStateStreamReq thisArg = let req = makeRequest "SpaceCenter" "Radiator_get_State" [makeArgument 0 thisArg] in makeStream req
253
getRadiatorStateStreamReq :: KRPCHS.SpaceCenter.Radiator -> KRPCStreamReq (KRPCHS.SpaceCenter.RadiatorState) getRadiatorStateStreamReq thisArg = let req = makeRequest "SpaceCenter" "Radiator_get_State" [makeArgument 0 thisArg] in makeStream req
253
getRadiatorStateStreamReq thisArg = let req = makeRequest "SpaceCenter" "Radiator_get_State" [makeArgument 0 thisArg] in makeStream req
144
false
true
0
11
29
63
30
33
null
null
antalsz/hs-to-coq
examples/intervals/Intervals.hs
mit
intersect :: Intervals -> Intervals -> Intervals intersect (Intervals is1) (Intervals is2) = Intervals $ go is1 is2 where go _ [] = [] go [] _ = [] go (i1:is1) (i2:is2) -- reorder for symmetry | to i1 < to i2 = go (i2:is2) (i1:is1) -- disjoint | from i1 >= to i2 = go (i1:is1) is2 -- subset | to i1 == to i2 = I f' (to i2) : go is1 is2 -- overlapping | otherwise = I f' (to i2) : go (i1 { from = to i2} : is1) is2 where f' = max (from i1) (from i2)
532
intersect :: Intervals -> Intervals -> Intervals intersect (Intervals is1) (Intervals is2) = Intervals $ go is1 is2 where go _ [] = [] go [] _ = [] go (i1:is1) (i2:is2) -- reorder for symmetry | to i1 < to i2 = go (i2:is2) (i1:is1) -- disjoint | from i1 >= to i2 = go (i1:is1) is2 -- subset | to i1 == to i2 = I f' (to i2) : go is1 is2 -- overlapping | otherwise = I f' (to i2) : go (i1 { from = to i2} : is1) is2 where f' = max (from i1) (from i2)
532
intersect (Intervals is1) (Intervals is2) = Intervals $ go is1 is2 where go _ [] = [] go [] _ = [] go (i1:is1) (i2:is2) -- reorder for symmetry | to i1 < to i2 = go (i2:is2) (i1:is1) -- disjoint | from i1 >= to i2 = go (i1:is1) is2 -- subset | to i1 == to i2 = I f' (to i2) : go is1 is2 -- overlapping | otherwise = I f' (to i2) : go (i1 { from = to i2} : is1) is2 where f' = max (from i1) (from i2)
483
false
true
1
11
186
306
141
165
null
null
h8gi/Open-usp-Tukubai
COMMANDS.HS/loopx.hs
mit
mainProc' files left right = mainProc files $ joint left right
62
mainProc' files left right = mainProc files $ joint left right
62
mainProc' files left right = mainProc files $ joint left right
62
false
false
0
6
10
26
11
15
null
null
nomeata/codeworld
funblocks-client/src/Blocks/Types.hs
apache-2.0
numMax = standardFunction "numMax" "max" (Just "arrow-up.svg") [typeNumber, typeNumber, typeNumber] ["LEFT", "RIGHT"] colorNumber "The maximum of two numbers"
170
numMax = standardFunction "numMax" "max" (Just "arrow-up.svg") [typeNumber, typeNumber, typeNumber] ["LEFT", "RIGHT"] colorNumber "The maximum of two numbers"
170
numMax = standardFunction "numMax" "max" (Just "arrow-up.svg") [typeNumber, typeNumber, typeNumber] ["LEFT", "RIGHT"] colorNumber "The maximum of two numbers"
170
false
false
0
7
29
42
23
19
null
null
beni55/LambdaHack
Game/LambdaHack/Client/UI/MsgClient.hs
bsd-3-clause
lookAt :: MonadClientUI m => Bool -- ^ detailed? -> Text -- ^ how to start tile description -> Bool -- ^ can be seen right now? -> Point -- ^ position to describe -> ActorId -- ^ the actor that looks -> Text -- ^ an extra sentence to print -> m Text lookAt detailed tilePrefix canSee pos aid msg = do cops@Kind.COps{cotile=cotile@Kind.Ops{okind}} <- getsState scops itemToF <- itemToFullClient b <- getsState $ getActorBody aid stgtMode <- getsClient stgtMode let lidV = maybe (blid b) tgtLevelId stgtMode lvl <- getLevel lidV localTime <- getsState $ getLocalTime lidV subject <- partAidLeader aid is <- getsState $ getCBag $ CFloor lidV pos let verb = MU.Text $ if pos == bpos b then "stand on" else if canSee then "notice" else "remember" let nWs (iid, kit@(k, _)) = partItemWs k CGround localTime (itemToF iid kit) isd = case detailed of _ | EM.size is == 0 -> "" _ | EM.size is <= 2 -> makeSentence [ MU.SubjectVerbSg subject verb , MU.WWandW $ map nWs $ EM.assocs is] -- TODO: detailed unused here; disabled together with overlay in doLook True -> "\n" _ -> makeSentence [MU.Cardinal (EM.size is), "items here"] tile = lvl `at` pos obscured | knownLsecret lvl && tile /= hideTile cops lvl pos = "partially obscured" | otherwise = "" tileText = obscured <+> TK.tname (okind tile) tilePart | T.null tilePrefix = MU.Text tileText | otherwise = MU.AW $ MU.Text tileText tileDesc = [MU.Text tilePrefix, tilePart] if not (null (Tile.causeEffects cotile tile)) then return $! makeSentence ("activable:" : tileDesc) <+> msg <+> isd else if detailed then return $! makeSentence tileDesc <+> msg <+> isd else return $! msg <+> isd -- | Create a list of item names.
2,035
lookAt :: MonadClientUI m => Bool -- ^ detailed? -> Text -- ^ how to start tile description -> Bool -- ^ can be seen right now? -> Point -- ^ position to describe -> ActorId -- ^ the actor that looks -> Text -- ^ an extra sentence to print -> m Text lookAt detailed tilePrefix canSee pos aid msg = do cops@Kind.COps{cotile=cotile@Kind.Ops{okind}} <- getsState scops itemToF <- itemToFullClient b <- getsState $ getActorBody aid stgtMode <- getsClient stgtMode let lidV = maybe (blid b) tgtLevelId stgtMode lvl <- getLevel lidV localTime <- getsState $ getLocalTime lidV subject <- partAidLeader aid is <- getsState $ getCBag $ CFloor lidV pos let verb = MU.Text $ if pos == bpos b then "stand on" else if canSee then "notice" else "remember" let nWs (iid, kit@(k, _)) = partItemWs k CGround localTime (itemToF iid kit) isd = case detailed of _ | EM.size is == 0 -> "" _ | EM.size is <= 2 -> makeSentence [ MU.SubjectVerbSg subject verb , MU.WWandW $ map nWs $ EM.assocs is] -- TODO: detailed unused here; disabled together with overlay in doLook True -> "\n" _ -> makeSentence [MU.Cardinal (EM.size is), "items here"] tile = lvl `at` pos obscured | knownLsecret lvl && tile /= hideTile cops lvl pos = "partially obscured" | otherwise = "" tileText = obscured <+> TK.tname (okind tile) tilePart | T.null tilePrefix = MU.Text tileText | otherwise = MU.AW $ MU.Text tileText tileDesc = [MU.Text tilePrefix, tilePart] if not (null (Tile.causeEffects cotile tile)) then return $! makeSentence ("activable:" : tileDesc) <+> msg <+> isd else if detailed then return $! makeSentence tileDesc <+> msg <+> isd else return $! msg <+> isd -- | Create a list of item names.
2,035
lookAt detailed tilePrefix canSee pos aid msg = do cops@Kind.COps{cotile=cotile@Kind.Ops{okind}} <- getsState scops itemToF <- itemToFullClient b <- getsState $ getActorBody aid stgtMode <- getsClient stgtMode let lidV = maybe (blid b) tgtLevelId stgtMode lvl <- getLevel lidV localTime <- getsState $ getLocalTime lidV subject <- partAidLeader aid is <- getsState $ getCBag $ CFloor lidV pos let verb = MU.Text $ if pos == bpos b then "stand on" else if canSee then "notice" else "remember" let nWs (iid, kit@(k, _)) = partItemWs k CGround localTime (itemToF iid kit) isd = case detailed of _ | EM.size is == 0 -> "" _ | EM.size is <= 2 -> makeSentence [ MU.SubjectVerbSg subject verb , MU.WWandW $ map nWs $ EM.assocs is] -- TODO: detailed unused here; disabled together with overlay in doLook True -> "\n" _ -> makeSentence [MU.Cardinal (EM.size is), "items here"] tile = lvl `at` pos obscured | knownLsecret lvl && tile /= hideTile cops lvl pos = "partially obscured" | otherwise = "" tileText = obscured <+> TK.tname (okind tile) tilePart | T.null tilePrefix = MU.Text tileText | otherwise = MU.AW $ MU.Text tileText tileDesc = [MU.Text tilePrefix, tilePart] if not (null (Tile.causeEffects cotile tile)) then return $! makeSentence ("activable:" : tileDesc) <+> msg <+> isd else if detailed then return $! makeSentence tileDesc <+> msg <+> isd else return $! msg <+> isd -- | Create a list of item names.
1,704
false
true
12
25
665
606
297
309
null
null
romanofski/gtfsbrisbane
src/GTFS/Schedule.hs
bsd-3-clause
-- | Create a specific point in time from the current time/date getTimeSpecFromNow :: Stop -> IO TimeSpec getTimeSpecFromNow Stop { stopWalktime = delay } = do t <- getCurrentTime tz <- getCurrentTimeZone let lday = localDay $ utcToLocalTime tz t let earliestTime = calculateEarliestDepartureTime t tz (delayAsDiffTime delay) return $ TimeSpec earliestTime lday -- | Returns current time of day --
433
getTimeSpecFromNow :: Stop -> IO TimeSpec getTimeSpecFromNow Stop { stopWalktime = delay } = do t <- getCurrentTime tz <- getCurrentTimeZone let lday = localDay $ utcToLocalTime tz t let earliestTime = calculateEarliestDepartureTime t tz (delayAsDiffTime delay) return $ TimeSpec earliestTime lday -- | Returns current time of day --
369
getTimeSpecFromNow Stop { stopWalktime = delay } = do t <- getCurrentTime tz <- getCurrentTimeZone let lday = localDay $ utcToLocalTime tz t let earliestTime = calculateEarliestDepartureTime t tz (delayAsDiffTime delay) return $ TimeSpec earliestTime lday -- | Returns current time of day --
323
true
true
3
13
97
101
47
54
null
null
juhp/stack
src/Stack/Build/ConstructPlan.hs
bsd-3-clause
psLocation :: PackageSource -> InstallLocation psLocation (PSFilePath _) = Local
80
psLocation :: PackageSource -> InstallLocation psLocation (PSFilePath _) = Local
80
psLocation (PSFilePath _) = Local
33
false
true
0
7
9
24
12
12
null
null
lemilonkh/algorithmuss
visuals/Util.hs
mit
hsv :: Optic' (->) (Vec4) (Vec4) hsv = dimap rgb2hsv hsv2rgb
60
hsv :: Optic' (->) (Vec4) (Vec4) hsv = dimap rgb2hsv hsv2rgb
60
hsv = dimap rgb2hsv hsv2rgb
27
false
true
0
7
10
37
18
19
null
null
denibertovic/haskell
kubernetes/lib/Kubernetes/OpenAPI/ModelLens.hs
bsd-3-clause
-- | 'v1beta1RoleMetadata' Lens v1beta1RoleMetadataL :: Lens_' V1beta1Role (Maybe V1ObjectMeta) v1beta1RoleMetadataL f V1beta1Role{..} = (\v1beta1RoleMetadata -> V1beta1Role { v1beta1RoleMetadata, ..} ) <$> f v1beta1RoleMetadata
228
v1beta1RoleMetadataL :: Lens_' V1beta1Role (Maybe V1ObjectMeta) v1beta1RoleMetadataL f V1beta1Role{..} = (\v1beta1RoleMetadata -> V1beta1Role { v1beta1RoleMetadata, ..} ) <$> f v1beta1RoleMetadata
196
v1beta1RoleMetadataL f V1beta1Role{..} = (\v1beta1RoleMetadata -> V1beta1Role { v1beta1RoleMetadata, ..} ) <$> f v1beta1RoleMetadata
132
true
true
1
8
23
62
30
32
null
null
jamshidh/ethereum-merkle-patricia-db
src/Blockchain/Database/MerklePatricia.hs
bsd-3-clause
getKeyVal::MPDB -- ^ Object containing the current stateRoot. -> Key -- ^ Key of the data to be inserted. -> ResourceT IO (Maybe Val) -- ^ The requested value. getKeyVal db key = do vals <- unsafeGetKeyVals db (keyToSafeKey key) return $ if not (null vals) then Just $ snd (head vals) -- Since we hash the keys, it's impossible -- for vals to have more than one item else Nothing -- | Deletes a key (and its corresponding data) from the database. -- -- Note that the key/value pair will still be present in the history, and -- can be accessed by using an older 'MPDB' object.
629
getKeyVal::MPDB -- ^ Object containing the current stateRoot. -> Key -- ^ Key of the data to be inserted. -> ResourceT IO (Maybe Val) getKeyVal db key = do vals <- unsafeGetKeyVals db (keyToSafeKey key) return $ if not (null vals) then Just $ snd (head vals) -- Since we hash the keys, it's impossible -- for vals to have more than one item else Nothing -- | Deletes a key (and its corresponding data) from the database. -- -- Note that the key/value pair will still be present in the history, and -- can be accessed by using an older 'MPDB' object.
603
getKeyVal db key = do vals <- unsafeGetKeyVals db (keyToSafeKey key) return $ if not (null vals) then Just $ snd (head vals) -- Since we hash the keys, it's impossible -- for vals to have more than one item else Nothing -- | Deletes a key (and its corresponding data) from the database. -- -- Note that the key/value pair will still be present in the history, and -- can be accessed by using an older 'MPDB' object.
451
true
true
0
12
161
105
53
52
null
null
ryzhyk/cocoon
cocoon/SMT/SMTSolver.hs
apache-2.0
typ _ _ (EBool _) = TBool
34
typ _ _ (EBool _) = TBool
34
typ _ _ (EBool _) = TBool
34
false
false
1
6
15
20
8
12
null
null
bennofs/vplan
src/Data/VPlan/Filter.hs
gpl-3.0
-- | Replace the toplevel modifier with Empty when it doesn't contain a value. cleanTop :: forall c i s v. (Supported Empty (Schedule s), Data (Schedule s c i Unique), Functor (Schedule s c i)) => Schedule s c i v -> Schedule s c i v cleanTop s | containsType (Proxy :: Proxy Unique) $ Unique <$ s = s | otherwise = new Empty
329
cleanTop :: forall c i s v. (Supported Empty (Schedule s), Data (Schedule s c i Unique), Functor (Schedule s c i)) => Schedule s c i v -> Schedule s c i v cleanTop s | containsType (Proxy :: Proxy Unique) $ Unique <$ s = s | otherwise = new Empty
250
cleanTop s | containsType (Proxy :: Proxy Unique) $ Unique <$ s = s | otherwise = new Empty
95
true
true
1
12
70
132
67
65
null
null
futufeld/eclogues
eclogues-impl/gen-hs/AuroraAdmin.hs
bsd-3-clause
encode_DrainHosts_args :: (T.Protocol p, T.Transport t) => p t -> DrainHosts_args -> LBS.ByteString encode_DrainHosts_args oprot record = T.serializeVal oprot $ from_DrainHosts_args record
188
encode_DrainHosts_args :: (T.Protocol p, T.Transport t) => p t -> DrainHosts_args -> LBS.ByteString encode_DrainHosts_args oprot record = T.serializeVal oprot $ from_DrainHosts_args record
188
encode_DrainHosts_args oprot record = T.serializeVal oprot $ from_DrainHosts_args record
88
false
true
0
8
21
64
30
34
null
null
laurencer/confluence-sync
vendor/http-streams/tests/CurrentPoint.hs
bsd-3-clause
actual :: ByteString -> IO () actual x' = do c <- fakeConnection x' let q = buildRequest1 $ do http GET "/bucket42/object149" setAccept "text/plain" sendRequest c q emptyBody receiveResponse c (\p i -> do n <- Streams.nullOutput Streams.write (Just $ S.pack $ show p) n Streams.connect i n) return ()
379
actual :: ByteString -> IO () actual x' = do c <- fakeConnection x' let q = buildRequest1 $ do http GET "/bucket42/object149" setAccept "text/plain" sendRequest c q emptyBody receiveResponse c (\p i -> do n <- Streams.nullOutput Streams.write (Just $ S.pack $ show p) n Streams.connect i n) return ()
379
actual x' = do c <- fakeConnection x' let q = buildRequest1 $ do http GET "/bucket42/object149" setAccept "text/plain" sendRequest c q emptyBody receiveResponse c (\p i -> do n <- Streams.nullOutput Streams.write (Just $ S.pack $ show p) n Streams.connect i n) return ()
349
false
true
0
16
129
141
62
79
null
null
osa1/sequent-core
src/Language/SequentCore/Simpl/Env.hs
bsd-3-clause
uncondInline :: OutTerm -> Arity -> Int -> Bool -- Inline unconditionally if there no size increase -- Size of call is arity (+1 for the function) -- See GHC CoreUnfold: Note [INLINE for small functions] uncondInline rhs arity size | arity > 0 = size <= 10 * (arity + 1) | otherwise = isTrivialTerm rhs
307
uncondInline :: OutTerm -> Arity -> Int -> Bool uncondInline rhs arity size | arity > 0 = size <= 10 * (arity + 1) | otherwise = isTrivialTerm rhs
151
uncondInline rhs arity size | arity > 0 = size <= 10 * (arity + 1) | otherwise = isTrivialTerm rhs
103
true
true
1
8
61
68
35
33
null
null
flofehrenbacher/music-project
EasyNotes/DisplayInfo.hs
gpl-3.0
updateDisplayInfo displayInfo startTimeRef currentPitchClassPlayed = do let nextNote = (fmap fst (songInfo displayInfo)) let remainingNotes = (fmap snd (songInfo displayInfo)) displayInfo' <- updateLastNote currentPitchClassPlayed displayInfo -- RIGHT NOTE WAS PLAYED if (isScreenKeyPressed displayInfo' || isMidiKeyPressed displayInfo') && isAbsPitchTheSame nextNote (lastNote displayInfo') then do let newDisplayInfo = displayInfo' {isRightNotePlayed = True, songInfo = updateSongInfo =<< remainingNotes, lastNote = Nothing} resetTime startTimeRef return newDisplayInfo -- WRONG NOTE WAS PLAYED else do case (isScreenKeyPressed displayInfo' || isMidiKeyPressed displayInfo') of False -> return displayInfo' {isRightNotePlayed = False} True -> do return $ displayInfo' -- | Updates in the 'DisplayInfo' the 'lastNote' that was played
1,186
updateDisplayInfo displayInfo startTimeRef currentPitchClassPlayed = do let nextNote = (fmap fst (songInfo displayInfo)) let remainingNotes = (fmap snd (songInfo displayInfo)) displayInfo' <- updateLastNote currentPitchClassPlayed displayInfo -- RIGHT NOTE WAS PLAYED if (isScreenKeyPressed displayInfo' || isMidiKeyPressed displayInfo') && isAbsPitchTheSame nextNote (lastNote displayInfo') then do let newDisplayInfo = displayInfo' {isRightNotePlayed = True, songInfo = updateSongInfo =<< remainingNotes, lastNote = Nothing} resetTime startTimeRef return newDisplayInfo -- WRONG NOTE WAS PLAYED else do case (isScreenKeyPressed displayInfo' || isMidiKeyPressed displayInfo') of False -> return displayInfo' {isRightNotePlayed = False} True -> do return $ displayInfo' -- | Updates in the 'DisplayInfo' the 'lastNote' that was played
1,186
updateDisplayInfo displayInfo startTimeRef currentPitchClassPlayed = do let nextNote = (fmap fst (songInfo displayInfo)) let remainingNotes = (fmap snd (songInfo displayInfo)) displayInfo' <- updateLastNote currentPitchClassPlayed displayInfo -- RIGHT NOTE WAS PLAYED if (isScreenKeyPressed displayInfo' || isMidiKeyPressed displayInfo') && isAbsPitchTheSame nextNote (lastNote displayInfo') then do let newDisplayInfo = displayInfo' {isRightNotePlayed = True, songInfo = updateSongInfo =<< remainingNotes, lastNote = Nothing} resetTime startTimeRef return newDisplayInfo -- WRONG NOTE WAS PLAYED else do case (isScreenKeyPressed displayInfo' || isMidiKeyPressed displayInfo') of False -> return displayInfo' {isRightNotePlayed = False} True -> do return $ displayInfo' -- | Updates in the 'DisplayInfo' the 'lastNote' that was played
1,186
false
false
0
15
451
208
102
106
null
null
ihc/futhark
src/Futhark/TypeCheck.hs
isc
checkLambdaResult :: Checkable lore => [Type] -> Result -> TypeM lore () checkLambdaResult ts es | length ts /= length es = bad $ TypeError $ "Lambda has return type " ++ prettyTuple ts ++ " describing " ++ show (length ts) ++ " values, but body returns " ++ show (length es) ++ " values: " ++ prettyTuple es | otherwise = forM_ (zip ts es) $ \(t, e) -> do et <- checkSubExp e unless (et == t) $ bad $ TypeError $ "Subexpression " ++ pretty e ++ " has type " ++ pretty et ++ " but expected " ++ pretty t
580
checkLambdaResult :: Checkable lore => [Type] -> Result -> TypeM lore () checkLambdaResult ts es | length ts /= length es = bad $ TypeError $ "Lambda has return type " ++ prettyTuple ts ++ " describing " ++ show (length ts) ++ " values, but body returns " ++ show (length es) ++ " values: " ++ prettyTuple es | otherwise = forM_ (zip ts es) $ \(t, e) -> do et <- checkSubExp e unless (et == t) $ bad $ TypeError $ "Subexpression " ++ pretty e ++ " has type " ++ pretty et ++ " but expected " ++ pretty t
580
checkLambdaResult ts es | length ts /= length es = bad $ TypeError $ "Lambda has return type " ++ prettyTuple ts ++ " describing " ++ show (length ts) ++ " values, but body returns " ++ show (length es) ++ " values: " ++ prettyTuple es | otherwise = forM_ (zip ts es) $ \(t, e) -> do et <- checkSubExp e unless (et == t) $ bad $ TypeError $ "Subexpression " ++ pretty e ++ " has type " ++ pretty et ++ " but expected " ++ pretty t
486
false
true
1
20
182
215
101
114
null
null
jwaldmann/haskell-obdd
src/OBDD/Operation.hs
gpl-2.0
-- | replace variable by value instantiate :: Ord v => v -> Bool -> OBDD v -> OBDD v instantiate var val = fold bool ( \ v l r -> if var == v then Data.Bool.bool l r val else choose l r (variable v) )
248
instantiate :: Ord v => v -> Bool -> OBDD v -> OBDD v instantiate var val = fold bool ( \ v l r -> if var == v then Data.Bool.bool l r val else choose l r (variable v) )
217
instantiate var val = fold bool ( \ v l r -> if var == v then Data.Bool.bool l r val else choose l r (variable v) )
125
true
true
0
10
95
95
47
48
null
null
jgm/grammata
th.hs
bsd-2-clause
emphQ :: Q Exp emphQ = varE (mkName "emph")
43
emphQ :: Q Exp emphQ = varE (mkName "emph")
43
emphQ = varE (mkName "emph")
28
false
true
0
7
8
23
11
12
null
null
periodic/Simple-Yesod-ToDo
Handler/Root.hs
bsd-2-clause
-- This is a handler function for the GET request method on the RootR -- resource pattern. All of your resource patterns are defined in -- config/routes -- -- The majority of the code you will write in Yesod lives in these handler -- functions. You can spread them across multiple files if you are so -- inclined, or create a single monolithic file. getRootR :: Handler RepHtml getRootR = do defaultLayout $ do h2id <- lift newIdent setTitle "TierList homepage" $(widgetFile "homepage")
514
getRootR :: Handler RepHtml getRootR = do defaultLayout $ do h2id <- lift newIdent setTitle "TierList homepage" $(widgetFile "homepage")
164
getRootR = do defaultLayout $ do h2id <- lift newIdent setTitle "TierList homepage" $(widgetFile "homepage")
136
true
true
0
12
110
54
27
27
null
null
SimonRichards/HaskellOfLife
georgie.hs
apache-2.0
chain n | even n = n:chain (n `div` 2) | odd n = n:chain (n * 3 + 1)
76
chain n | even n = n:chain (n `div` 2) | odd n = n:chain (n * 3 + 1)
76
chain n | even n = n:chain (n `div` 2) | odd n = n:chain (n * 3 + 1)
76
false
false
0
10
27
64
30
34
null
null
mstksg/tensor-ops
src/Type/Class/Higher/Util.hs
bsd-3-clause
all1 :: Foldable1 t => (forall a. f a -> Bool) -> t f b -> Bool all1 p = getAll . foldMap1 (All . p)
116
all1 :: Foldable1 t => (forall a. f a -> Bool) -> t f b -> Bool all1 p = getAll . foldMap1 (All . p)
116
all1 p = getAll . foldMap1 (All . p)
36
false
true
0
11
41
68
32
36
null
null
netrium/Netrium
src/Observable.hs
mit
printObs (BinOp Gt o1 o2) = mkElemC "Gt" [printObs o1, printObs o2]
69
printObs (BinOp Gt o1 o2) = mkElemC "Gt" [printObs o1, printObs o2]
69
printObs (BinOp Gt o1 o2) = mkElemC "Gt" [printObs o1, printObs o2]
69
false
false
0
7
13
37
17
20
null
null
AdityaKumarRavikanti/Boxes
src/SheetDB.hs
mit
access :: String -> String -> String -> String -> API Sheet -- ^ get an access to the sheet for the "cont" block, temporarily injecting the token access keyf worksheetidf clientId clientSecret = do let clientf = OAuth2Client clientId clientSecret urlf <- formURL keyf worksheetidf [("alt","json")] token <- io (createToken clientf) jsonf <- getJson token (exportURL urlf) let cols = AT.parseMaybe getColumns jsonf case cols of Just cols -> return Sheet { key = keyf , worksheetId = worksheetidf , columns = cols , cid = clientId , csecret = clientSecret } Nothing -> die ["Cannot parse columns:", show cols] -- ^ Selection
807
access :: String -> String -> String -> String -> API Sheet access keyf worksheetidf clientId clientSecret = do let clientf = OAuth2Client clientId clientSecret urlf <- formURL keyf worksheetidf [("alt","json")] token <- io (createToken clientf) jsonf <- getJson token (exportURL urlf) let cols = AT.parseMaybe getColumns jsonf case cols of Just cols -> return Sheet { key = keyf , worksheetId = worksheetidf , columns = cols , cid = clientId , csecret = clientSecret } Nothing -> die ["Cannot parse columns:", show cols] -- ^ Selection
721
access keyf worksheetidf clientId clientSecret = do let clientf = OAuth2Client clientId clientSecret urlf <- formURL keyf worksheetidf [("alt","json")] token <- io (createToken clientf) jsonf <- getJson token (exportURL urlf) let cols = AT.parseMaybe getColumns jsonf case cols of Just cols -> return Sheet { key = keyf , worksheetId = worksheetidf , columns = cols , cid = clientId , csecret = clientSecret } Nothing -> die ["Cannot parse columns:", show cols] -- ^ Selection
661
true
true
0
12
288
197
99
98
null
null
brendanhay/gogol
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/EventTags/Get.hs
mpl-2.0
-- | Event tag ID. etgId :: Lens' EventTagsGet Int64 etgId = lens _etgId (\ s a -> s{_etgId = a}) . _Coerce
109
etgId :: Lens' EventTagsGet Int64 etgId = lens _etgId (\ s a -> s{_etgId = a}) . _Coerce
90
etgId = lens _etgId (\ s a -> s{_etgId = a}) . _Coerce
56
true
true
0
10
24
46
24
22
null
null
tyler-sommer/stormy-pond
src/Pond/Data.hs
mit
-- | 'checksum' calculates the SHA256 checksum of a 'Ripple' checksum :: Ripple -> RippleID checksum r = ByteString.unpack (Base16.encode (SHA256.hash (LS.toStrict (encode r))))
179
checksum :: Ripple -> RippleID checksum r = ByteString.unpack (Base16.encode (SHA256.hash (LS.toStrict (encode r))))
118
checksum r = ByteString.unpack (Base16.encode (SHA256.hash (LS.toStrict (encode r))))
87
true
true
0
13
25
54
27
27
null
null
wfleming/advent-of-code-2016
2017/D18/src/D18Lib.hs
bsd-3-clause
-- receiving does not appear to change observable machine state apply m (Jgz x y) = if opVal m x == 0 then incrPos m else m { mPos = opVal m y + mPos m }
153
apply m (Jgz x y) = if opVal m x == 0 then incrPos m else m { mPos = opVal m y + mPos m }
89
apply m (Jgz x y) = if opVal m x == 0 then incrPos m else m { mPos = opVal m y + mPos m }
89
true
false
0
9
36
60
30
30
null
null
DaMSL/K3
src/Language/K3/Codegen/Haskell.hs
apache-2.0
ensureActionE :: CGExpr -> CodeGeneration CGExpr ensureActionE (pureOrPartial -> Just (HS.Do [])) = blockError
110
ensureActionE :: CGExpr -> CodeGeneration CGExpr ensureActionE (pureOrPartial -> Just (HS.Do [])) = blockError
110
ensureActionE (pureOrPartial -> Just (HS.Do [])) = blockError
61
false
true
0
11
13
41
20
21
null
null
juanbono/my-scheme
src/Eval.hs
bsd-3-clause
apply :: String -> [LispVal] -> ThrowsError LispVal apply func args = maybe (throwError $ NotFunction "Unrecognized primitive function args" func) ($ args) (lookup func primitives)
216
apply :: String -> [LispVal] -> ThrowsError LispVal apply func args = maybe (throwError $ NotFunction "Unrecognized primitive function args" func) ($ args) (lookup func primitives)
216
apply func args = maybe (throwError $ NotFunction "Unrecognized primitive function args" func) ($ args) (lookup func primitives)
164
false
true
0
8
61
61
31
30
null
null
svetlemodry/Android-Password-Store
contrib/oisafe2pstore/oisafe2pstore.hs
gpl-3.0
buildFile :: Maybe Entry -> IO () buildFile Nothing = return ()
63
buildFile :: Maybe Entry -> IO () buildFile Nothing = return ()
63
buildFile Nothing = return ()
29
false
true
0
7
11
31
14
17
null
null
Mahdi89/eTeak
src/Type.hs
bsd-3-clause
typeBodyBuiltinOffsets _ _ (EnumType {}) = []
45
typeBodyBuiltinOffsets _ _ (EnumType {}) = []
45
typeBodyBuiltinOffsets _ _ (EnumType {}) = []
45
false
false
0
7
6
22
11
11
null
null
codemac/yi-editor
src/Yi/Interpreter.hs
gpl-2.0
funTyCon = fst $ splitTyConApp $ typeOf (id :: Char -> Char)
60
funTyCon = fst $ splitTyConApp $ typeOf (id :: Char -> Char)
60
funTyCon = fst $ splitTyConApp $ typeOf (id :: Char -> Char)
60
false
false
0
8
11
27
14
13
null
null
nakamuray/htig
HTIG/IRCServer/Core.hs
bsd-3-clause
mkSet :: (IRCState g l -> TVar a) -> a -> IRCM g l () mkSet f v = liftIO . atomically . flip writeTVar v =<< asks f
115
mkSet :: (IRCState g l -> TVar a) -> a -> IRCM g l () mkSet f v = liftIO . atomically . flip writeTVar v =<< asks f
115
mkSet f v = liftIO . atomically . flip writeTVar v =<< asks f
61
false
true
0
8
28
68
32
36
null
null
autocorr/lyah
chap4.hs
mit
-- as pattern capital :: String -> String capital "" = "Empty"
62
capital :: String -> String capital "" = "Empty"
48
capital "" = "Empty"
20
true
true
0
7
11
25
11
14
null
null
alexbiehl/mysql-haskell-simple
src/Database/MySQL/Simple/Decoder.hs
bsd-3-clause
float :: Value Float float = Value $ \succ_ fail_ mv -> case mv of MySQLFloat i -> succ_ i _ -> fail_ InvalidValue
183
float :: Value Float float = Value $ \succ_ fail_ mv -> case mv of MySQLFloat i -> succ_ i _ -> fail_ InvalidValue
183
float = Value $ \succ_ fail_ mv -> case mv of MySQLFloat i -> succ_ i _ -> fail_ InvalidValue
162
false
true
0
10
92
52
25
27
null
null
bjornbm/leapseconds-announced
MakeLeapSecondTable.hs
bsd-3-clause
-- | Converts an 'EOPList' into a minimal list of (day, leapsecond) pairs -- in reverse chronological order. eopToLS :: EOPList a -> [(Day, Integer)] eopToLS = reverse . keepInitial . fmap (fmap deltaAT)
203
eopToLS :: EOPList a -> [(Day, Integer)] eopToLS = reverse . keepInitial . fmap (fmap deltaAT)
94
eopToLS = reverse . keepInitial . fmap (fmap deltaAT)
53
true
true
0
9
33
52
26
26
null
null
neglectedvalue/xmobar-freebsd
Plugins/Monitors/Common.hs
bsd-3-clause
options :: [OptDescr Opts] options = [ Option ['H'] ["High"] (ReqArg High "number" ) "The high threshold" , Option ['L'] ["Low"] (ReqArg Low "number" ) "The low threshold" , Option ['h'] ["high"] (ReqArg HighColor "color number" ) "Color for the high threshold: ex \"#FF0000\"" , Option ['n'] ["normal"] (ReqArg NormalColor "color number" ) "Color for the normal threshold: ex \"#00FF00\"" , Option ['l'] ["low"] (ReqArg LowColor "color number" ) "Color for the low threshold: ex \"#0000FF\"" , Option ['t'] ["template"] (ReqArg Template "output template" ) "Output template." ]
664
options :: [OptDescr Opts] options = [ Option ['H'] ["High"] (ReqArg High "number" ) "The high threshold" , Option ['L'] ["Low"] (ReqArg Low "number" ) "The low threshold" , Option ['h'] ["high"] (ReqArg HighColor "color number" ) "Color for the high threshold: ex \"#FF0000\"" , Option ['n'] ["normal"] (ReqArg NormalColor "color number" ) "Color for the normal threshold: ex \"#00FF00\"" , Option ['l'] ["low"] (ReqArg LowColor "color number" ) "Color for the low threshold: ex \"#0000FF\"" , Option ['t'] ["template"] (ReqArg Template "output template" ) "Output template." ]
664
options = [ Option ['H'] ["High"] (ReqArg High "number" ) "The high threshold" , Option ['L'] ["Low"] (ReqArg Low "number" ) "The low threshold" , Option ['h'] ["high"] (ReqArg HighColor "color number" ) "Color for the high threshold: ex \"#FF0000\"" , Option ['n'] ["normal"] (ReqArg NormalColor "color number" ) "Color for the normal threshold: ex \"#00FF00\"" , Option ['l'] ["low"] (ReqArg LowColor "color number" ) "Color for the low threshold: ex \"#0000FF\"" , Option ['t'] ["template"] (ReqArg Template "output template" ) "Output template." ]
637
false
true
0
8
173
173
93
80
null
null
ederoyd46/GeoIndex
src/Index.hs
mit
indexFile :: String -> String -> IO () indexFile f i = do contents <- Char8.readFile f let lines = Char8.lines contents let jsonEntries = mapMaybe (\i -> JSON.decode i :: Maybe JSONEntry) lines let entries = buildEntries jsonEntries let indexData = buildIndex $ fst entries writeIndexFile indexData (snd entries) where writeIndexFile :: (Int64, ByteString, Int64, ByteString) -> ByteString -> IO () writeIndexFile (rootSize,rootIndex,subIndexSize,subIndex) entries = writeFile i $ concat [ encode rootSize , rootIndex , encode subIndexSize , subIndex , entries]
649
indexFile :: String -> String -> IO () indexFile f i = do contents <- Char8.readFile f let lines = Char8.lines contents let jsonEntries = mapMaybe (\i -> JSON.decode i :: Maybe JSONEntry) lines let entries = buildEntries jsonEntries let indexData = buildIndex $ fst entries writeIndexFile indexData (snd entries) where writeIndexFile :: (Int64, ByteString, Int64, ByteString) -> ByteString -> IO () writeIndexFile (rootSize,rootIndex,subIndexSize,subIndex) entries = writeFile i $ concat [ encode rootSize , rootIndex , encode subIndexSize , subIndex , entries]
649
indexFile f i = do contents <- Char8.readFile f let lines = Char8.lines contents let jsonEntries = mapMaybe (\i -> JSON.decode i :: Maybe JSONEntry) lines let entries = buildEntries jsonEntries let indexData = buildIndex $ fst entries writeIndexFile indexData (snd entries) where writeIndexFile :: (Int64, ByteString, Int64, ByteString) -> ByteString -> IO () writeIndexFile (rootSize,rootIndex,subIndexSize,subIndex) entries = writeFile i $ concat [ encode rootSize , rootIndex , encode subIndexSize , subIndex , entries]
610
false
true
2
14
169
226
108
118
null
null
qmuli/qmuli
library/Qi/Program/Gen/Lang.hs
mit
sleep :: Member GenEff effs => Int -> Eff effs () sleep = send . Sleep
76
sleep :: Member GenEff effs => Int -> Eff effs () sleep = send . Sleep
76
sleep = send . Sleep
20
false
true
0
9
21
41
18
23
null
null
bitemyapp/ether
src/Control/Ether/TH.hs
bsd-3-clause
emptyDataDecl :: TH.Name -> TH.DecQ emptyDataDecl name = TH.dataD (return []) name [] [] []
91
emptyDataDecl :: TH.Name -> TH.DecQ emptyDataDecl name = TH.dataD (return []) name [] [] []
91
emptyDataDecl name = TH.dataD (return []) name [] [] []
55
false
true
0
8
14
49
24
25
null
null
GregorySchwartz/dotfiles
.xmonad/xmonad.hs
gpl-2.0
myGSConfig height = def { gs_font = "xft:Open Sans Light-14" , gs_cellheight = size , gs_cellwidth = size * 3 } where size = fromIntegral . round . (/ 10) . fromIntegral $ height
256
myGSConfig height = def { gs_font = "xft:Open Sans Light-14" , gs_cellheight = size , gs_cellwidth = size * 3 } where size = fromIntegral . round . (/ 10) . fromIntegral $ height
256
myGSConfig height = def { gs_font = "xft:Open Sans Light-14" , gs_cellheight = size , gs_cellwidth = size * 3 } where size = fromIntegral . round . (/ 10) . fromIntegral $ height
256
false
false
0
8
111
61
34
27
null
null
fnoble/raml
src/Web/Raml.hs
mit
toParameterType v (Just "integer") = RamlParameterInteger <$> v .:? "maximum" <*> v .:? "minimum" <*> v .:? "example" <*> v .:? "default"
145
toParameterType v (Just "integer") = RamlParameterInteger <$> v .:? "maximum" <*> v .:? "minimum" <*> v .:? "example" <*> v .:? "default"
145
toParameterType v (Just "integer") = RamlParameterInteger <$> v .:? "maximum" <*> v .:? "minimum" <*> v .:? "example" <*> v .:? "default"
145
false
false
11
7
29
59
30
29
null
null
jecisc/TP_PF_L3
PF-TP5/src/Main.hs
mit
minuscule :: Parser Char minuscule = carCond estMini
52
minuscule :: Parser Char minuscule = carCond estMini
52
minuscule = carCond estMini
27
false
true
1
5
7
20
8
12
null
null
Cahu/krpc-hs
src/KRPCHS/SpaceCenter.hs
gpl-3.0
setWheelTractionControlEnabled :: KRPCHS.SpaceCenter.Wheel -> Bool -> RPCContext () setWheelTractionControlEnabled thisArg valueArg = do let r = makeRequest "SpaceCenter" "Wheel_set_TractionControlEnabled" [makeArgument 0 thisArg, makeArgument 1 valueArg] res <- sendRequest r processResponse res {- - The currently active vessel. -}
349
setWheelTractionControlEnabled :: KRPCHS.SpaceCenter.Wheel -> Bool -> RPCContext () setWheelTractionControlEnabled thisArg valueArg = do let r = makeRequest "SpaceCenter" "Wheel_set_TractionControlEnabled" [makeArgument 0 thisArg, makeArgument 1 valueArg] res <- sendRequest r processResponse res {- - The currently active vessel. -}
349
setWheelTractionControlEnabled thisArg valueArg = do let r = makeRequest "SpaceCenter" "Wheel_set_TractionControlEnabled" [makeArgument 0 thisArg, makeArgument 1 valueArg] res <- sendRequest r processResponse res {- - The currently active vessel. -}
265
false
true
0
13
53
86
39
47
null
null
IreneKnapp/Faction
libfaction/Distribution/Simple/Setup.hs
bsd-3-clause
splitArgs :: String -> [String] splitArgs = space [] where space :: String -> String -> [String] space w [] = word w [] space w ( c :s) | isSpace c = word w (space [] s) space w ('"':s) = string w s space w s = nonstring w s string :: String -> String -> [String] string w [] = word w [] string w ('"':s) = space w s string w ( c :s) = string (c:w) s nonstring :: String -> String -> [String] nonstring w [] = word w [] nonstring w ('"':s) = string w s nonstring w ( c :s) = space (c:w) s word [] s = s word w s = reverse w : s -- The test cases kinda have to be rewritten from the ground up... :/ --hunitTests :: [Test] --hunitTests = -- let m = [("ghc", GHC), ("nhc98", NHC), ("hugs", Hugs)] -- (flags, commands', unkFlags, ers) -- = getOpt Permute options ["configure", "foobar", "--prefix=/foo", "--ghc", "--nhc98", "--hugs", "--with-compiler=/comp", "--unknown1", "--unknown2", "--install-prefix=/foo", "--user", "--global"] -- in [TestLabel "very basic option parsing" $ TestList [ -- "getOpt flags" ~: "failed" ~: -- [Prefix "/foo", GhcFlag, NhcFlag, HugsFlag, -- WithCompiler "/comp", InstPrefix "/foo", UserFlag, GlobalFlag] -- ~=? flags, -- "getOpt commands" ~: "failed" ~: ["configure", "foobar"] ~=? commands', -- "getOpt unknown opts" ~: "failed" ~: -- ["--unknown1", "--unknown2"] ~=? unkFlags, -- "getOpt errors" ~: "failed" ~: [] ~=? ers], -- -- TestLabel "test location of various compilers" $ TestList -- ["configure parsing for prefix and compiler flag" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Nothing, Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, "configure"]) -- | (name, comp) <- m], -- -- TestLabel "find the package tool" $ TestList -- ["configure parsing for prefix comp flag, withcompiler" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Just "/foo/comp", Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, -- "--with-compiler=/foo/comp", "configure"]) -- | (name, comp) <- m], -- -- TestLabel "simpler commands" $ TestList -- [flag ~: "failed" ~: (Right (flagCmd, [])) ~=? (parseArgs [flag]) -- | (flag, flagCmd) <- [("build", BuildCmd), -- ("install", InstallCmd Nothing False), -- ("sdist", SDistCmd), -- ("register", RegisterCmd False)] -- ] -- ] {- Testing ideas: * IO to look for hugs and hugs-pkg (which hugs, etc) * quickCheck to test permutations of arguments * what other options can we over-ride with a command-line flag? -}
3,103
splitArgs :: String -> [String] splitArgs = space [] where space :: String -> String -> [String] space w [] = word w [] space w ( c :s) | isSpace c = word w (space [] s) space w ('"':s) = string w s space w s = nonstring w s string :: String -> String -> [String] string w [] = word w [] string w ('"':s) = space w s string w ( c :s) = string (c:w) s nonstring :: String -> String -> [String] nonstring w [] = word w [] nonstring w ('"':s) = string w s nonstring w ( c :s) = space (c:w) s word [] s = s word w s = reverse w : s -- The test cases kinda have to be rewritten from the ground up... :/ --hunitTests :: [Test] --hunitTests = -- let m = [("ghc", GHC), ("nhc98", NHC), ("hugs", Hugs)] -- (flags, commands', unkFlags, ers) -- = getOpt Permute options ["configure", "foobar", "--prefix=/foo", "--ghc", "--nhc98", "--hugs", "--with-compiler=/comp", "--unknown1", "--unknown2", "--install-prefix=/foo", "--user", "--global"] -- in [TestLabel "very basic option parsing" $ TestList [ -- "getOpt flags" ~: "failed" ~: -- [Prefix "/foo", GhcFlag, NhcFlag, HugsFlag, -- WithCompiler "/comp", InstPrefix "/foo", UserFlag, GlobalFlag] -- ~=? flags, -- "getOpt commands" ~: "failed" ~: ["configure", "foobar"] ~=? commands', -- "getOpt unknown opts" ~: "failed" ~: -- ["--unknown1", "--unknown2"] ~=? unkFlags, -- "getOpt errors" ~: "failed" ~: [] ~=? ers], -- -- TestLabel "test location of various compilers" $ TestList -- ["configure parsing for prefix and compiler flag" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Nothing, Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, "configure"]) -- | (name, comp) <- m], -- -- TestLabel "find the package tool" $ TestList -- ["configure parsing for prefix comp flag, withcompiler" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Just "/foo/comp", Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, -- "--with-compiler=/foo/comp", "configure"]) -- | (name, comp) <- m], -- -- TestLabel "simpler commands" $ TestList -- [flag ~: "failed" ~: (Right (flagCmd, [])) ~=? (parseArgs [flag]) -- | (flag, flagCmd) <- [("build", BuildCmd), -- ("install", InstallCmd Nothing False), -- ("sdist", SDistCmd), -- ("register", RegisterCmd False)] -- ] -- ] {- Testing ideas: * IO to look for hugs and hugs-pkg (which hugs, etc) * quickCheck to test permutations of arguments * what other options can we over-ride with a command-line flag? -}
3,103
splitArgs = space [] where space :: String -> String -> [String] space w [] = word w [] space w ( c :s) | isSpace c = word w (space [] s) space w ('"':s) = string w s space w s = nonstring w s string :: String -> String -> [String] string w [] = word w [] string w ('"':s) = space w s string w ( c :s) = string (c:w) s nonstring :: String -> String -> [String] nonstring w [] = word w [] nonstring w ('"':s) = string w s nonstring w ( c :s) = space (c:w) s word [] s = s word w s = reverse w : s -- The test cases kinda have to be rewritten from the ground up... :/ --hunitTests :: [Test] --hunitTests = -- let m = [("ghc", GHC), ("nhc98", NHC), ("hugs", Hugs)] -- (flags, commands', unkFlags, ers) -- = getOpt Permute options ["configure", "foobar", "--prefix=/foo", "--ghc", "--nhc98", "--hugs", "--with-compiler=/comp", "--unknown1", "--unknown2", "--install-prefix=/foo", "--user", "--global"] -- in [TestLabel "very basic option parsing" $ TestList [ -- "getOpt flags" ~: "failed" ~: -- [Prefix "/foo", GhcFlag, NhcFlag, HugsFlag, -- WithCompiler "/comp", InstPrefix "/foo", UserFlag, GlobalFlag] -- ~=? flags, -- "getOpt commands" ~: "failed" ~: ["configure", "foobar"] ~=? commands', -- "getOpt unknown opts" ~: "failed" ~: -- ["--unknown1", "--unknown2"] ~=? unkFlags, -- "getOpt errors" ~: "failed" ~: [] ~=? ers], -- -- TestLabel "test location of various compilers" $ TestList -- ["configure parsing for prefix and compiler flag" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Nothing, Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, "configure"]) -- | (name, comp) <- m], -- -- TestLabel "find the package tool" $ TestList -- ["configure parsing for prefix comp flag, withcompiler" ~: "failed" ~: -- (Right (ConfigCmd (Just comp, Just "/foo/comp", Just "/usr/local"), [])) -- ~=? (parseArgs ["--prefix=/usr/local", "--"++name, -- "--with-compiler=/foo/comp", "configure"]) -- | (name, comp) <- m], -- -- TestLabel "simpler commands" $ TestList -- [flag ~: "failed" ~: (Right (flagCmd, [])) ~=? (parseArgs [flag]) -- | (flag, flagCmd) <- [("build", BuildCmd), -- ("install", InstallCmd Nothing False), -- ("sdist", SDistCmd), -- ("register", RegisterCmd False)] -- ] -- ] {- Testing ideas: * IO to look for hugs and hugs-pkg (which hugs, etc) * quickCheck to test permutations of arguments * what other options can we over-ride with a command-line flag? -}
3,071
false
true
3
9
1,070
424
212
212
null
null
ciderpunx/57-exercises-for-programmers
src/P25PwStrength.hs
gpl-3.0
hasSpecials = any (\x -> isPunctuation x || isSymbol x)
56
hasSpecials = any (\x -> isPunctuation x || isSymbol x)
56
hasSpecials = any (\x -> isPunctuation x || isSymbol x)
56
false
false
1
9
10
30
13
17
null
null
shlevy/ghc
compiler/nativeGen/X86/Ppr.hs
bsd-3-clause
pprFormatFormatOpReg :: LitString -> Format -> Format -> Operand -> Reg -> SDoc pprFormatFormatOpReg name format1 format2 op1 reg2 = hcat [ pprMnemonic name format2, pprOperand format1 op1, comma, pprReg format2 reg2 ]
256
pprFormatFormatOpReg :: LitString -> Format -> Format -> Operand -> Reg -> SDoc pprFormatFormatOpReg name format1 format2 op1 reg2 = hcat [ pprMnemonic name format2, pprOperand format1 op1, comma, pprReg format2 reg2 ]
256
pprFormatFormatOpReg name format1 format2 op1 reg2 = hcat [ pprMnemonic name format2, pprOperand format1 op1, comma, pprReg format2 reg2 ]
176
false
true
0
9
70
72
36
36
null
null
robrix/surface
src/REPL.hs
bsd-3-clause
command :: (Monad m, TokenParsing m) => m Command command = whiteSpace *> (colon *> meta <|> eval) <* eof <?> "command" where meta = (Help <$ (long "help" <|> short 'h' <|> short '?') <?> "help") <|> (Quit <$ (long "quit" <|> short 'q') <?> "quit") <|> (TypeOf <$> ((long "type" <|> short 't') *> expr) <?> "type of") <|> (REPL.WHNF <$> ((long "whnf" <|> short 'w') *> expr) <?> "whnf") <?> "command; use :? for help" eval = Run <$> expr <?> "expression" short = symbol . (:[]) long = symbol
563
command :: (Monad m, TokenParsing m) => m Command command = whiteSpace *> (colon *> meta <|> eval) <* eof <?> "command" where meta = (Help <$ (long "help" <|> short 'h' <|> short '?') <?> "help") <|> (Quit <$ (long "quit" <|> short 'q') <?> "quit") <|> (TypeOf <$> ((long "type" <|> short 't') *> expr) <?> "type of") <|> (REPL.WHNF <$> ((long "whnf" <|> short 'w') *> expr) <?> "whnf") <?> "command; use :? for help" eval = Run <$> expr <?> "expression" short = symbol . (:[]) long = symbol
563
command = whiteSpace *> (colon *> meta <|> eval) <* eof <?> "command" where meta = (Help <$ (long "help" <|> short 'h' <|> short '?') <?> "help") <|> (Quit <$ (long "quit" <|> short 'q') <?> "quit") <|> (TypeOf <$> ((long "type" <|> short 't') *> expr) <?> "type of") <|> (REPL.WHNF <$> ((long "whnf" <|> short 'w') *> expr) <?> "whnf") <?> "command; use :? for help" eval = Run <$> expr <?> "expression" short = symbol . (:[]) long = symbol
513
false
true
3
18
164
234
118
116
null
null
AlexanderPankiv/ghc
compiler/types/TypeRep.hs
bsd-3-clause
tidyType env (TyVarTy tv) = TyVarTy (tidyTyVarOcc env tv)
65
tidyType env (TyVarTy tv) = TyVarTy (tidyTyVarOcc env tv)
65
tidyType env (TyVarTy tv) = TyVarTy (tidyTyVarOcc env tv)
65
false
false
0
7
16
28
13
15
null
null
brendanhay/network-metrics
src/Network/Metric/Sink/Ganglia.hs
mpl-2.0
putGroup :: BS.ByteString -> Put putGroup group | BS.null group = putInt 0 | otherwise = do putInt 1 putString "GROUP" putString group
216
putGroup :: BS.ByteString -> Put putGroup group | BS.null group = putInt 0 | otherwise = do putInt 1 putString "GROUP" putString group
216
putGroup group | BS.null group = putInt 0 | otherwise = do putInt 1 putString "GROUP" putString group
183
false
true
1
9
104
65
26
39
null
null
banacorn/formal-language
haskell-legacy/Language/util.hs
mit
-- make mappings a function driverDFA :: Transitions -> State -> Alphabet -> State driverDFA (TransitionsDFA mappings) state alphabet = let result = [ f | (s, a, f) <- mappings, s == state, a == alphabet ] in case result of [] -> error $ show state ++ ", " ++ showAlphabet alphabet ++ " Transition not deinfed" (x:xs) -> x where showAlphabet Epsilon = "ɛ" showAlphabet (Alphabet a) = show a -- make mappings a function
463
driverDFA :: Transitions -> State -> Alphabet -> State driverDFA (TransitionsDFA mappings) state alphabet = let result = [ f | (s, a, f) <- mappings, s == state, a == alphabet ] in case result of [] -> error $ show state ++ ", " ++ showAlphabet alphabet ++ " Transition not deinfed" (x:xs) -> x where showAlphabet Epsilon = "ɛ" showAlphabet (Alphabet a) = show a -- make mappings a function
435
driverDFA (TransitionsDFA mappings) state alphabet = let result = [ f | (s, a, f) <- mappings, s == state, a == alphabet ] in case result of [] -> error $ show state ++ ", " ++ showAlphabet alphabet ++ " Transition not deinfed" (x:xs) -> x where showAlphabet Epsilon = "ɛ" showAlphabet (Alphabet a) = show a -- make mappings a function
380
true
true
0
14
122
159
81
78
null
null