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
contivero/hasmin
src/Hasmin/Types/TransformFunction.hs
bsd-3-clause
simplify (ScaleZ n) | n == 1 = pure $ Skew NullAngle Nothing | otherwise = pure $ ScaleZ n
105
simplify (ScaleZ n) | n == 1 = pure $ Skew NullAngle Nothing | otherwise = pure $ ScaleZ n
105
simplify (ScaleZ n) | n == 1 = pure $ Skew NullAngle Nothing | otherwise = pure $ ScaleZ n
105
false
false
4
8
34
53
22
31
null
null
DanielWaterworth/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
pToV' n i (Bind x b sc) -- We can assume the inner scope has been pToVed already, so continue to -- resolve names from the *outer* scope which may happen to have the same id. | n == x = Bind x (fmap (pToV' n i) b) sc | otherwise = Bind x (fmap (pToV' n i) b) (pToV' n (i+1) sc)
290
pToV' n i (Bind x b sc) -- We can assume the inner scope has been pToVed already, so continue to -- resolve names from the *outer* scope which may happen to have the same id. | n == x = Bind x (fmap (pToV' n i) b) sc | otherwise = Bind x (fmap (pToV' n i) b) (pToV' n (i+1) sc)
290
pToV' n i (Bind x b sc) -- We can assume the inner scope has been pToVed already, so continue to -- resolve names from the *outer* scope which may happen to have the same id. | n == x = Bind x (fmap (pToV' n i) b) sc | otherwise = Bind x (fmap (pToV' n i) b) (pToV' n (i+1) sc)
290
false
false
0
9
75
116
53
63
null
null
hguenther/smtlib2
Language/SMTLib2/Internals/Type/List.hs
gpl-3.0
nil :: List e '[] nil = Nil
27
nil :: List e '[] nil = Nil
27
nil = Nil
9
false
true
0
8
7
26
11
15
null
null
vladimir-ipatov/ganeti
src/Ganeti/Constants.hs
gpl-2.0
ssFileStorageDir :: String ssFileStorageDir = "file_storage_dir"
64
ssFileStorageDir :: String ssFileStorageDir = "file_storage_dir"
64
ssFileStorageDir = "file_storage_dir"
37
false
true
0
6
5
18
7
11
null
null
gcampax/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
integerSDataConKey = mkPreludeDataConUnique 7
67
integerSDataConKey = mkPreludeDataConUnique 7
67
integerSDataConKey = mkPreludeDataConUnique 7
67
false
false
0
5
25
9
4
5
null
null
cbrghostrider/Hacking
HackerRank/Algorithms/Warmup/extraLongFactorial.hs
mit
-- ------------------------------------------------------------------------------------- -- Author: Sourabh S Joshi (cbrghostrider); Copyright - All rights reserved. -- For email, run on linux (perl v5.8.5): -- perl -e 'print pack "H*","736f75726162682e732e6a6f73686940676d61696c2e636f6d0a"' -- ------------------------------------------------------------------------------------- main = interact $ \x -> show . product $ [1..(read x)]
467
main = interact $ \x -> show . product $ [1..(read x)]
54
main = interact $ \x -> show . product $ [1..(read x)]
54
true
false
0
10
72
39
23
16
null
null
573/leksah
src/IDE/Utils/ServerConnection.hs
gpl-2.0
doServerCommand' :: ServerCommand -> (ServerAnswer -> IDEM ()) -> IDEAction doServerCommand' command cont = do server' <- readIDE server case server' of Just handle -> do isOpen <- liftIO $ hIsOpen handle if isOpen then void (doCommand handle) else do modifyIDE_ (\ ide -> ide{server = Nothing}) doServerCommand command cont Nothing -> do prefs' <- readIDE prefs handle <- reifyIDE $ \ideR -> catch (connectTo (T.unpack $ serverIP prefs') (PortNumber(PortNum (fromIntegral $ serverPort prefs')))) (\(exc :: SomeException) -> do catch (startServer (serverPort prefs')) (\(exc :: SomeException) -> throwIDE ("Can't start leksah-server" <> T.pack (show exc))) mbHandle <- waitForServer prefs' 100 case mbHandle of Just handle -> return handle Nothing -> throwIDE "Can't connect to leksah-server") modifyIDE_ (\ ide -> ide{server = Just handle}) doCommand handle return () where doCommand handle = do postAsyncIDE . void $ triggerEventIDE (StatusbarChanged [CompartmentCollect True]) resp <- liftIO $ do debugM "leksah" $ "Sending server command " ++ show command hPrint handle command hFlush handle debugM "leksah" $ "Waiting on server command " ++ show command hGetLine handle liftIO . debugM "leksah" $ "Server result " ++ resp postAsyncIDE $ do triggerEventIDE (StatusbarChanged [CompartmentCollect False]) cont (read resp)
1,873
doServerCommand' :: ServerCommand -> (ServerAnswer -> IDEM ()) -> IDEAction doServerCommand' command cont = do server' <- readIDE server case server' of Just handle -> do isOpen <- liftIO $ hIsOpen handle if isOpen then void (doCommand handle) else do modifyIDE_ (\ ide -> ide{server = Nothing}) doServerCommand command cont Nothing -> do prefs' <- readIDE prefs handle <- reifyIDE $ \ideR -> catch (connectTo (T.unpack $ serverIP prefs') (PortNumber(PortNum (fromIntegral $ serverPort prefs')))) (\(exc :: SomeException) -> do catch (startServer (serverPort prefs')) (\(exc :: SomeException) -> throwIDE ("Can't start leksah-server" <> T.pack (show exc))) mbHandle <- waitForServer prefs' 100 case mbHandle of Just handle -> return handle Nothing -> throwIDE "Can't connect to leksah-server") modifyIDE_ (\ ide -> ide{server = Just handle}) doCommand handle return () where doCommand handle = do postAsyncIDE . void $ triggerEventIDE (StatusbarChanged [CompartmentCollect True]) resp <- liftIO $ do debugM "leksah" $ "Sending server command " ++ show command hPrint handle command hFlush handle debugM "leksah" $ "Waiting on server command " ++ show command hGetLine handle liftIO . debugM "leksah" $ "Server result " ++ resp postAsyncIDE $ do triggerEventIDE (StatusbarChanged [CompartmentCollect False]) cont (read resp)
1,873
doServerCommand' command cont = do server' <- readIDE server case server' of Just handle -> do isOpen <- liftIO $ hIsOpen handle if isOpen then void (doCommand handle) else do modifyIDE_ (\ ide -> ide{server = Nothing}) doServerCommand command cont Nothing -> do prefs' <- readIDE prefs handle <- reifyIDE $ \ideR -> catch (connectTo (T.unpack $ serverIP prefs') (PortNumber(PortNum (fromIntegral $ serverPort prefs')))) (\(exc :: SomeException) -> do catch (startServer (serverPort prefs')) (\(exc :: SomeException) -> throwIDE ("Can't start leksah-server" <> T.pack (show exc))) mbHandle <- waitForServer prefs' 100 case mbHandle of Just handle -> return handle Nothing -> throwIDE "Can't connect to leksah-server") modifyIDE_ (\ ide -> ide{server = Just handle}) doCommand handle return () where doCommand handle = do postAsyncIDE . void $ triggerEventIDE (StatusbarChanged [CompartmentCollect True]) resp <- liftIO $ do debugM "leksah" $ "Sending server command " ++ show command hPrint handle command hFlush handle debugM "leksah" $ "Waiting on server command " ++ show command hGetLine handle liftIO . debugM "leksah" $ "Server result " ++ resp postAsyncIDE $ do triggerEventIDE (StatusbarChanged [CompartmentCollect False]) cont (read resp)
1,797
false
true
0
28
742
512
237
275
null
null
jimsnow/glome
GlomeTrace/Data/Glome/Sphere.hs
gpl-2.0
-- adapted from graphics gems volume 1 rayint_sphere :: Sphere tag mat -> Ray -> Flt -> [Texture tag mat] -> [tag] -> Rayint tag mat rayint_sphere (Sphere center r invr) ray@(Ray e dir) dist t tags = let eo = vsub center e v = vdot eo dir vsqr = v*v csqr = vdot eo eo rsqr = r*r disc = rsqr - (csqr - vsqr) in if disc < 0.0 then RayMiss else let d = sqrt disc hitdist = if (v-d) > 0 then (v-d) else (v+d) in if (hitdist < 0) || (hitdist > dist) then RayMiss else let p = vscaleadd e dir hitdist -- n = vscale (vsub p center) invr in -- n = vsub (vscale p invr) (vscale center invr) in n = vnorm (vsub p center) in RayHit hitdist p n ray vzero t tags
758
rayint_sphere :: Sphere tag mat -> Ray -> Flt -> [Texture tag mat] -> [tag] -> Rayint tag mat rayint_sphere (Sphere center r invr) ray@(Ray e dir) dist t tags = let eo = vsub center e v = vdot eo dir vsqr = v*v csqr = vdot eo eo rsqr = r*r disc = rsqr - (csqr - vsqr) in if disc < 0.0 then RayMiss else let d = sqrt disc hitdist = if (v-d) > 0 then (v-d) else (v+d) in if (hitdist < 0) || (hitdist > dist) then RayMiss else let p = vscaleadd e dir hitdist -- n = vscale (vsub p center) invr in -- n = vsub (vscale p invr) (vscale center invr) in n = vnorm (vsub p center) in RayHit hitdist p n ray vzero t tags
719
rayint_sphere (Sphere center r invr) ray@(Ray e dir) dist t tags = let eo = vsub center e v = vdot eo dir vsqr = v*v csqr = vdot eo eo rsqr = r*r disc = rsqr - (csqr - vsqr) in if disc < 0.0 then RayMiss else let d = sqrt disc hitdist = if (v-d) > 0 then (v-d) else (v+d) in if (hitdist < 0) || (hitdist > dist) then RayMiss else let p = vscaleadd e dir hitdist -- n = vscale (vsub p center) invr in -- n = vsub (vscale p invr) (vscale center invr) in n = vnorm (vsub p center) in RayHit hitdist p n ray vzero t tags
625
true
true
0
17
252
296
154
142
null
null
ddssff/lens
tests/templates.hs
bsd-3-clause
checkThing' :: Lens' (Dude a) a checkThing' = thing
51
checkThing' :: Lens' (Dude a) a checkThing' = thing
51
checkThing' = thing
19
false
true
0
7
8
22
11
11
null
null
ribag/ganeti-experiments
src/Ganeti/HTools/Node.hs
gpl-2.0
-- | Sets the offline attribute. setOffline :: Node -> Bool -> Node setOffline t val = t { offline = val }
106
setOffline :: Node -> Bool -> Node setOffline t val = t { offline = val }
73
setOffline t val = t { offline = val }
38
true
true
0
8
22
42
20
22
null
null
sirius94/free-tracker
free-tracker-server/src/FreeTracker/Configuration.hs
gpl-3.0
runPersist :: MonadBaseControl IO m => ReaderT SqlBackend (FreeTrackerT m) a -> FreeTrackerT m a runPersist a = getPool >>= runSqlPool a
136
runPersist :: MonadBaseControl IO m => ReaderT SqlBackend (FreeTrackerT m) a -> FreeTrackerT m a runPersist a = getPool >>= runSqlPool a
136
runPersist a = getPool >>= runSqlPool a
39
false
true
0
9
21
52
24
28
null
null
spechub/Hets
Common/Doc.hs
gpl-2.0
hcat :: [Doc] -> Doc -- ^List version of '<>' hcat = Cat Horiz . rmEmpties
83
hcat :: [Doc] -> Doc hcat = Cat Horiz . rmEmpties
49
hcat = Cat Horiz . rmEmpties
28
true
true
0
7
24
33
15
18
null
null
spechub/Hets
GUI/GraphDisplay.hs
gpl-2.0
initializeGraph :: GInfo -> String -> LibFunc -> IO () initializeGraph gInfo title showLib = do ost <- readIORef $ intState gInfo case i_state ost of Nothing -> return () Just _ -> do let title' = title ++ " for " ++ show (libName gInfo) createGraph gInfo title' convertGraph showLib
295
initializeGraph :: GInfo -> String -> LibFunc -> IO () initializeGraph gInfo title showLib = do ost <- readIORef $ intState gInfo case i_state ost of Nothing -> return () Just _ -> do let title' = title ++ " for " ++ show (libName gInfo) createGraph gInfo title' convertGraph showLib
295
initializeGraph gInfo title showLib = do ost <- readIORef $ intState gInfo case i_state ost of Nothing -> return () Just _ -> do let title' = title ++ " for " ++ show (libName gInfo) createGraph gInfo title' convertGraph showLib
240
false
true
0
18
62
117
53
64
null
null
takoeight0821/malgo
src/Malgo/Rename/Pass.hs
bsd-3-clause
lookupTypeName :: (MonadReader RnEnv m, MonadIO m) => SourcePos -> Text -> m RnId lookupTypeName pos name = view (typeEnv . at name) >>= \case Just names -> case find (\i -> i ^. ann == Implicit) names of Just (Annotated _ name) -> pure name Nothing -> errorOn pos $ "Not in scope:" <+> quotes (pPrint name) $$ "Did you mean" <+> pPrint (map (view value) names) _ -> errorOn pos $ "Not in scope:" <+> quotes (pPrint name)
473
lookupTypeName :: (MonadReader RnEnv m, MonadIO m) => SourcePos -> Text -> m RnId lookupTypeName pos name = view (typeEnv . at name) >>= \case Just names -> case find (\i -> i ^. ann == Implicit) names of Just (Annotated _ name) -> pure name Nothing -> errorOn pos $ "Not in scope:" <+> quotes (pPrint name) $$ "Did you mean" <+> pPrint (map (view value) names) _ -> errorOn pos $ "Not in scope:" <+> quotes (pPrint name)
473
lookupTypeName pos name = view (typeEnv . at name) >>= \case Just names -> case find (\i -> i ^. ann == Implicit) names of Just (Annotated _ name) -> pure name Nothing -> errorOn pos $ "Not in scope:" <+> quotes (pPrint name) $$ "Did you mean" <+> pPrint (map (view value) names) _ -> errorOn pos $ "Not in scope:" <+> quotes (pPrint name)
391
false
true
0
17
131
194
93
101
null
null
YellPika/effin
src/Data/Union.hs
bsd-3-clause
unwrap :: Union (f ':+ 'Nil) a -> f a unwrap (Union i x) = gcastWith (Index.trivial i) x
88
unwrap :: Union (f ':+ 'Nil) a -> f a unwrap (Union i x) = gcastWith (Index.trivial i) x
88
unwrap (Union i x) = gcastWith (Index.trivial i) x
50
false
true
0
9
18
62
29
33
null
null
green-haskell/ghc
compiler/typecheck/TcGenGenerics.hs
bsd-3-clause
-- This M1 is meta-information for the selector wrapArg_P Gen1 v = m1DataCon_RDR `nlConVarPat` [v]
98
wrapArg_P Gen1 v = m1DataCon_RDR `nlConVarPat` [v]
50
wrapArg_P Gen1 v = m1DataCon_RDR `nlConVarPat` [v]
50
true
false
0
6
14
21
12
9
null
null
antalsz/hs-to-coq
examples/ghc/gen-files/Lexer.hs
mit
alex_action_24 = dispatch_pragmas linePrags
44
alex_action_24 = dispatch_pragmas linePrags
44
alex_action_24 = dispatch_pragmas linePrags
44
false
false
0
5
4
9
4
5
null
null
nikivazou/hscolour
Language/Haskell/HsColour/InlineCSS.hs
gpl-2.0
style Blink = "text-decoration: blink;"
49
style Blink = "text-decoration: blink;"
49
style Blink = "text-decoration: blink;"
49
false
false
0
4
14
10
4
6
null
null
jsl/RunnyBabbot
src/RunnyBabbot/Spoonerize.hs
mit
hasLeadingVowel :: Word -> Bool hasLeadingVowel word = not (null word) && head word `elem` vowels
97
hasLeadingVowel :: Word -> Bool hasLeadingVowel word = not (null word) && head word `elem` vowels
97
hasLeadingVowel word = not (null word) && head word `elem` vowels
65
false
true
0
9
15
46
21
25
null
null
bgaster/blocks
Blocks.hs
mit
blockI1 = [ [noBlockID, noBlockID, blockIDI, noBlockID], [noBlockID, noBlockID, blockIDI, noBlockID], [noBlockID, noBlockID, blockIDI, noBlockID], [noBlockID, noBlockID, blockIDI, noBlockID] ] :: Block
240
blockI1 = [ [noBlockID, noBlockID, blockIDI, noBlockID], [noBlockID, noBlockID, blockIDI, noBlockID], [noBlockID, noBlockID, blockIDI, noBlockID], [noBlockID, noBlockID, blockIDI, noBlockID] ] :: Block
240
blockI1 = [ [noBlockID, noBlockID, blockIDI, noBlockID], [noBlockID, noBlockID, blockIDI, noBlockID], [noBlockID, noBlockID, blockIDI, noBlockID], [noBlockID, noBlockID, blockIDI, noBlockID] ] :: Block
240
false
false
0
6
60
69
45
24
null
null
sampou-org/pfad
Code/Code08.hs
bsd-3-clause
{- upravels = filter (all up) . unravels -} upravels1 :: Ord a => [a] -> [[[a]]] upravels1 = foldr (concatMap . uprefixes1) [[]]
140
upravels1 :: Ord a => [a] -> [[[a]]] upravels1 = foldr (concatMap . uprefixes1) [[]]
90
upravels1 = foldr (concatMap . uprefixes1) [[]]
50
true
true
0
11
35
59
30
29
null
null
michaeljklein/HCy2C
Cycles/Findcy.hs
mit
vertexAdjacencyLists :: [[Int]] -> Bool -> [[Int]] vertexAdjacencyLists graph directed = map (\vi -> vadjpos vi graph directed) [0..max_vertex] where max_vertex = max2 graph -- | Following is the generator for a one-time use C program to find all cycles in a graph. -- -- The general program will work with directed and undirected graphs and will find all *directed* cycles in the graph -- I plan to modify the original program to work with graphs and digraphs and each modification to optinally only count cycles instead of listing them -- This cannot be solved in O(V+E) time because even planar graphs can have O(2^v) cycles and listing/counting a graph cycle takes at least 1 CPU cycle -- -- The algorithm performs a depth first search from an arbitrary vertex, marking seen vertices on the way, and only outputting cycles through -- \ the initial vertex. As all cycles through that vertex have been found by the end, it is removed and the process repeated. -- \ This way, there is no need to check if a cycle has been found yet and there are no sources of repetition. -- -- The only weaknesses of this algorithm that I know are: -- 1) It requires full out-adjacency lists for each vertex (best fit for directed, sparse graphs) -- 2) For undirected graphs, if the cycles are considered to be undirected, it outputs one "forward" and one "backward" copy of each cycle -- N.B. For the purposes of inputting the cycles into the Max-Cycles part of the code, this is a strength as the algorithm needs both -- 3) Although the output file is formatted, it is annoying to integrate generating, compiling, running, and parsing into a single function -- 4) The generated code is in C. Yeah, I said it. On the plus side, unless you're running this on very big graphs -- \ (where it would take an obscene amount of time to finish), you shouldn't run into overflow issues. -- -- The biggest plus? This algorithm is stupid-fast. The last big test I ran outputted ~1.5GB of cycles from ~2k strongly-connected graphs, |E|<=36 in under 30s. -- -- Note: graph (edgelist), cfilename, are assumed variables
2,248
vertexAdjacencyLists :: [[Int]] -> Bool -> [[Int]] vertexAdjacencyLists graph directed = map (\vi -> vadjpos vi graph directed) [0..max_vertex] where max_vertex = max2 graph -- | Following is the generator for a one-time use C program to find all cycles in a graph. -- -- The general program will work with directed and undirected graphs and will find all *directed* cycles in the graph -- I plan to modify the original program to work with graphs and digraphs and each modification to optinally only count cycles instead of listing them -- This cannot be solved in O(V+E) time because even planar graphs can have O(2^v) cycles and listing/counting a graph cycle takes at least 1 CPU cycle -- -- The algorithm performs a depth first search from an arbitrary vertex, marking seen vertices on the way, and only outputting cycles through -- \ the initial vertex. As all cycles through that vertex have been found by the end, it is removed and the process repeated. -- \ This way, there is no need to check if a cycle has been found yet and there are no sources of repetition. -- -- The only weaknesses of this algorithm that I know are: -- 1) It requires full out-adjacency lists for each vertex (best fit for directed, sparse graphs) -- 2) For undirected graphs, if the cycles are considered to be undirected, it outputs one "forward" and one "backward" copy of each cycle -- N.B. For the purposes of inputting the cycles into the Max-Cycles part of the code, this is a strength as the algorithm needs both -- 3) Although the output file is formatted, it is annoying to integrate generating, compiling, running, and parsing into a single function -- 4) The generated code is in C. Yeah, I said it. On the plus side, unless you're running this on very big graphs -- \ (where it would take an obscene amount of time to finish), you shouldn't run into overflow issues. -- -- The biggest plus? This algorithm is stupid-fast. The last big test I ran outputted ~1.5GB of cycles from ~2k strongly-connected graphs, |E|<=36 in under 30s. -- -- Note: graph (edgelist), cfilename, are assumed variables
2,248
vertexAdjacencyLists graph directed = map (\vi -> vadjpos vi graph directed) [0..max_vertex] where max_vertex = max2 graph -- | Following is the generator for a one-time use C program to find all cycles in a graph. -- -- The general program will work with directed and undirected graphs and will find all *directed* cycles in the graph -- I plan to modify the original program to work with graphs and digraphs and each modification to optinally only count cycles instead of listing them -- This cannot be solved in O(V+E) time because even planar graphs can have O(2^v) cycles and listing/counting a graph cycle takes at least 1 CPU cycle -- -- The algorithm performs a depth first search from an arbitrary vertex, marking seen vertices on the way, and only outputting cycles through -- \ the initial vertex. As all cycles through that vertex have been found by the end, it is removed and the process repeated. -- \ This way, there is no need to check if a cycle has been found yet and there are no sources of repetition. -- -- The only weaknesses of this algorithm that I know are: -- 1) It requires full out-adjacency lists for each vertex (best fit for directed, sparse graphs) -- 2) For undirected graphs, if the cycles are considered to be undirected, it outputs one "forward" and one "backward" copy of each cycle -- N.B. For the purposes of inputting the cycles into the Max-Cycles part of the code, this is a strength as the algorithm needs both -- 3) Although the output file is formatted, it is annoying to integrate generating, compiling, running, and parsing into a single function -- 4) The generated code is in C. Yeah, I said it. On the plus side, unless you're running this on very big graphs -- \ (where it would take an obscene amount of time to finish), you shouldn't run into overflow issues. -- -- The biggest plus? This algorithm is stupid-fast. The last big test I ran outputted ~1.5GB of cycles from ~2k strongly-connected graphs, |E|<=36 in under 30s. -- -- Note: graph (edgelist), cfilename, are assumed variables
2,197
false
true
0
8
524
93
59
34
null
null
dolio/irc-core
src/Client/Configuration.hs
isc
paletteSpec :: ValueSpec Palette paletteSpec = sectionsSpec "palette" $ (ala Endo (foldMap . foldMap) ?? defaultPalette) <$> sequenceA fields where nickColorsSpec :: ValueSpec (Palette -> Palette) nickColorsSpec = set palNicks . Vector.fromList . NonEmpty.toList <$> nonemptySpec attrSpec modeColorsSpec :: Lens' Palette (HashMap Char Attr) -> ValueSpec (Palette -> Palette) modeColorsSpec l = fmap (set l) $ customSpec "modes" (assocSpec attrSpec) $ fmap HashMap.fromList . traverse (\(mode, attr) -> case Text.unpack mode of [m] -> Right (m, attr) _ -> Left "expected single letter") fields :: [SectionsSpec (Maybe (Palette -> Palette))] fields = optSection' "nick-colors" nickColorsSpec "Colors used to highlight nicknames" : optSection' "cmodes" (modeColorsSpec palCModes) "Colors used to highlight channel modes" : optSection' "umodes" (modeColorsSpec palUModes) "Colors used to highlight user modes" : optSection' "snomask" (modeColorsSpec palSnomask) "Colors used to highlight server notice mask" : [ optSection' lbl (set l <$> attrSpec) "" | (lbl, Lens l) <- paletteMap ]
1,287
paletteSpec :: ValueSpec Palette paletteSpec = sectionsSpec "palette" $ (ala Endo (foldMap . foldMap) ?? defaultPalette) <$> sequenceA fields where nickColorsSpec :: ValueSpec (Palette -> Palette) nickColorsSpec = set palNicks . Vector.fromList . NonEmpty.toList <$> nonemptySpec attrSpec modeColorsSpec :: Lens' Palette (HashMap Char Attr) -> ValueSpec (Palette -> Palette) modeColorsSpec l = fmap (set l) $ customSpec "modes" (assocSpec attrSpec) $ fmap HashMap.fromList . traverse (\(mode, attr) -> case Text.unpack mode of [m] -> Right (m, attr) _ -> Left "expected single letter") fields :: [SectionsSpec (Maybe (Palette -> Palette))] fields = optSection' "nick-colors" nickColorsSpec "Colors used to highlight nicknames" : optSection' "cmodes" (modeColorsSpec palCModes) "Colors used to highlight channel modes" : optSection' "umodes" (modeColorsSpec palUModes) "Colors used to highlight user modes" : optSection' "snomask" (modeColorsSpec palSnomask) "Colors used to highlight server notice mask" : [ optSection' lbl (set l <$> attrSpec) "" | (lbl, Lens l) <- paletteMap ]
1,287
paletteSpec = sectionsSpec "palette" $ (ala Endo (foldMap . foldMap) ?? defaultPalette) <$> sequenceA fields where nickColorsSpec :: ValueSpec (Palette -> Palette) nickColorsSpec = set palNicks . Vector.fromList . NonEmpty.toList <$> nonemptySpec attrSpec modeColorsSpec :: Lens' Palette (HashMap Char Attr) -> ValueSpec (Palette -> Palette) modeColorsSpec l = fmap (set l) $ customSpec "modes" (assocSpec attrSpec) $ fmap HashMap.fromList . traverse (\(mode, attr) -> case Text.unpack mode of [m] -> Right (m, attr) _ -> Left "expected single letter") fields :: [SectionsSpec (Maybe (Palette -> Palette))] fields = optSection' "nick-colors" nickColorsSpec "Colors used to highlight nicknames" : optSection' "cmodes" (modeColorsSpec palCModes) "Colors used to highlight channel modes" : optSection' "umodes" (modeColorsSpec palUModes) "Colors used to highlight user modes" : optSection' "snomask" (modeColorsSpec palSnomask) "Colors used to highlight server notice mask" : [ optSection' lbl (set l <$> attrSpec) "" | (lbl, Lens l) <- paletteMap ]
1,254
false
true
5
12
357
354
174
180
null
null
kaoskorobase/mescaline
app/Mescaline/FeatureSpace/View.hs
gpl-3.0
regionMouseMoveHandler :: Process.Handle -> Region -> Qt.QGraphicsEllipseItem () -> Qt.QGraphicsSceneMouseEvent () -> IO () regionMouseMoveHandler fspace region item evt = do Qt.IPoint ex ey <- Qt.scenePos evt () state <- readMVar (regionState region) case state of RegionIdle -> return () RegionMove dx dy -> do let ix = ex + dx iy = ey + dy Qt.IRect _ _ d _ <- Qt.qboundingRect item () -- putStrLn $ "Region " ++ show (regionId region) ++ " pos=" ++ show pos sendTo fspace $ Process.UpdateRegion $ Model.mkRegion (regionId region) (ix, iy) (d/2) -- Qt.setPos item pos return () RegionResize y0 -> do Qt.IRect _ _ d _ <- Qt.qboundingRect item () let dy = y0 - ey d' = d + dy r' = max (d'/2) unitRadius -- putStrLn $ "Region " ++ show (regionId region) ++ " radius=" ++ show r' -- onChanged $ Update $ Model.updateRegionById (regionId region) (\r -> r { Model.radius = r' }) Qt.IPoint ix iy <- Qt.scenePos item () sendTo fspace $ Process.UpdateRegion $ Model.mkRegion (regionId region) (ix, iy) r' -- Qt.qsetRect item (Qt.IRect (-r') (-r') d' d') _ <- swapMVar (regionState region) (RegionResize ey) return ()
1,385
regionMouseMoveHandler :: Process.Handle -> Region -> Qt.QGraphicsEllipseItem () -> Qt.QGraphicsSceneMouseEvent () -> IO () regionMouseMoveHandler fspace region item evt = do Qt.IPoint ex ey <- Qt.scenePos evt () state <- readMVar (regionState region) case state of RegionIdle -> return () RegionMove dx dy -> do let ix = ex + dx iy = ey + dy Qt.IRect _ _ d _ <- Qt.qboundingRect item () -- putStrLn $ "Region " ++ show (regionId region) ++ " pos=" ++ show pos sendTo fspace $ Process.UpdateRegion $ Model.mkRegion (regionId region) (ix, iy) (d/2) -- Qt.setPos item pos return () RegionResize y0 -> do Qt.IRect _ _ d _ <- Qt.qboundingRect item () let dy = y0 - ey d' = d + dy r' = max (d'/2) unitRadius -- putStrLn $ "Region " ++ show (regionId region) ++ " radius=" ++ show r' -- onChanged $ Update $ Model.updateRegionById (regionId region) (\r -> r { Model.radius = r' }) Qt.IPoint ix iy <- Qt.scenePos item () sendTo fspace $ Process.UpdateRegion $ Model.mkRegion (regionId region) (ix, iy) r' -- Qt.qsetRect item (Qt.IRect (-r') (-r') d' d') _ <- swapMVar (regionState region) (RegionResize ey) return ()
1,385
regionMouseMoveHandler fspace region item evt = do Qt.IPoint ex ey <- Qt.scenePos evt () state <- readMVar (regionState region) case state of RegionIdle -> return () RegionMove dx dy -> do let ix = ex + dx iy = ey + dy Qt.IRect _ _ d _ <- Qt.qboundingRect item () -- putStrLn $ "Region " ++ show (regionId region) ++ " pos=" ++ show pos sendTo fspace $ Process.UpdateRegion $ Model.mkRegion (regionId region) (ix, iy) (d/2) -- Qt.setPos item pos return () RegionResize y0 -> do Qt.IRect _ _ d _ <- Qt.qboundingRect item () let dy = y0 - ey d' = d + dy r' = max (d'/2) unitRadius -- putStrLn $ "Region " ++ show (regionId region) ++ " radius=" ++ show r' -- onChanged $ Update $ Model.updateRegionById (regionId region) (\r -> r { Model.radius = r' }) Qt.IPoint ix iy <- Qt.scenePos item () sendTo fspace $ Process.UpdateRegion $ Model.mkRegion (regionId region) (ix, iy) r' -- Qt.qsetRect item (Qt.IRect (-r') (-r') d' d') _ <- swapMVar (regionState region) (RegionResize ey) return ()
1,261
false
true
0
17
467
398
188
210
null
null
davidyu/Slowpoke
hs/src/Math/vec.hs
mit
vec3 :: Double -> Double -> Double -> Vec3 vec3 x1 x2 x3 = x1 & x2 & x3 & nil
77
vec3 :: Double -> Double -> Double -> Vec3 vec3 x1 x2 x3 = x1 & x2 & x3 & nil
77
vec3 x1 x2 x3 = x1 & x2 & x3 & nil
34
false
true
4
9
20
49
22
27
null
null
pyuk/euler2
src/P20.hs
bsd-3-clause
p20 :: Integer p20 = sum . sepDigits . factorial $ 100
54
p20 :: Integer p20 = sum . sepDigits . factorial $ 100
54
p20 = sum . sepDigits . factorial $ 100
39
false
true
0
7
11
23
12
11
null
null
printedheart/Dao
src/Dao/Interval.hs
agpl-3.0
-- Creates a list from segments, but does not clean it with 'intervalNub' _fromList :: (Ord c, Enum c, InfBound c) => [Interval c] -> Set c _fromList a | Data.List.null a = EmptySet | a==[wholeInterval] = InfiniteSet | otherwise = Set a
253
_fromList :: (Ord c, Enum c, InfBound c) => [Interval c] -> Set c _fromList a | Data.List.null a = EmptySet | a==[wholeInterval] = InfiniteSet | otherwise = Set a
179
_fromList a | Data.List.null a = EmptySet | a==[wholeInterval] = InfiniteSet | otherwise = Set a
113
true
true
0
9
59
98
46
52
null
null
telser/numerals
src-test/Text/Numeral/Language/CBK/TestData.hs
bsd-3-clause
-------------------------------------------------------------------------------- -- Test data -------------------------------------------------------------------------------- {- Sources: http://www.languagesandnumbers.com/how-to-count-in-chavacano/en/cbk/ -} cardinals ∷ (Num i) ⇒ TestData i cardinals = [ ( "default" , defaultInflection , [ (0, "cero") , (1, "uno") , (2, "dos") , (3, "tres") , (4, "cuatro") , (5, "cinco") , (6, "seis") , (7, "siete") , (8, "ocho") , (9, "nueve") , (10, "diez") , (11, "once") , (12, "doce") , (13, "trece") , (14, "catorce") , (15, "quince") , (16, "dieciséis") , (17, "diecisiete") , (18, "dieciocho") , (19, "diecinueve") , (20, "veinte") , (21, "veintiún") , (22, "veintidós") , (23, "veintitrés") , (24, "veinticuatro") , (25, "veinticinco") , (26, "veintiséis") , (27, "veintisiete") , (28, "veintiocho") , (29, "veintinueve") , (30, "treinta") , (31, "treinta y uno") , (32, "treinta y dos") , (33, "treinta y tres") , (34, "treinta y cuatro") , (35, "treinta y cinco") , (36, "treinta y seis") , (37, "treinta y siete") , (38, "treinta y ocho") , (39, "treinta y nueve") , (40, "cuarenta") , (41, "cuarenta y uno") , (42, "cuarenta y dos") , (43, "cuarenta y tres") , (44, "cuarenta y cuatro") , (45, "cuarenta y cinco") , (46, "cuarenta y seis") , (47, "cuarenta y siete") , (48, "cuarenta y ocho") , (49, "cuarenta y nueve") , (50, "cinquenta") , (51, "cinquenta y uno") , (52, "cinquenta y dos") , (53, "cinquenta y tres") , (54, "cinquenta y cuatro") , (55, "cinquenta y cinco") , (56, "cinquenta y seis") , (57, "cinquenta y siete") , (58, "cinquenta y ocho") , (59, "cinquenta y nueve") , (60, "sesenta") , (61, "sesenta y uno") , (62, "sesenta y dos") , (63, "sesenta y tres") , (64, "sesenta y cuatro") , (65, "sesenta y cinco") , (66, "sesenta y seis") , (67, "sesenta y siete") , (68, "sesenta y ocho") , (69, "sesenta y nueve") , (70, "setenta") , (71, "setenta y uno") , (72, "setenta y dos") , (73, "setenta y tres") , (74, "setenta y cuatro") , (75, "setenta y cinco") , (76, "setenta y seis") , (77, "setenta y siete") , (78, "setenta y ocho") , (79, "setenta y nueve") , (80, "ochenta") , (81, "ochenta y uno") , (82, "ochenta y dos") , (83, "ochenta y tres") , (84, "ochenta y cuatro") , (85, "ochenta y cinco") , (86, "ochenta y seis") , (87, "ochenta y siete") , (88, "ochenta y ocho") , (89, "ochenta y nueve") , (90, "noventa") , (91, "noventa y uno") , (92, "noventa y dos") , (93, "noventa y tres") , (94, "noventa y cuatro") , (95, "noventa y cinco") , (96, "noventa y seis") , (97, "noventa y siete") , (98, "noventa y ocho") , (99, "noventa y nueve") , (100, "ciento") , (101, "ciento uno") , (102, "ciento dos") , (103, "ciento tres") , (104, "ciento cuatro") , (105, "ciento cinco") , (106, "ciento seis") , (107, "ciento siete") , (108, "ciento ocho") , (109, "ciento nueve") , (110, "ciento diez") , (123, "ciento veintitrés") , (200, "dos cientos") , (300, "tres cientos") , (321, "tres cientos veintiún") , (400, "cuatro cientos") , (500, "quinientos") , (600, "seis cientos") , (700, "siete cientos") , (800, "ocho cientos") , (900, "nueve cientos") , (909, "nueve cientos nueve") , (990, "nueve cientos noventa") , (999, "nueve cientos noventa y nueve") , (1000, "un mil") , (1001, "un mil uno") , (1008, "un mil ocho") , (1234, "un mil dos cientos treinta y cuatro") , (2000, "dos mil") , (3000, "tres mil") , (4000, "cuatro mil") , (4321, "cuatro mil tres cientos veintiún") , (5000, "cinco mil") , (6000, "seis mil") , (7000, "siete mil") , (8000, "ocho mil") , (9000, "nueve mil") , (10000, "diez mil") , (12345, "doce mil tres cientos cuarenta y cinco") , (20000, "veinte mil") , (30000, "treinta mil") , (40000, "cuarenta mil") , (50000, "cinquenta mil") , (54321, "cinquenta y cuatro mil tres cientos veintiún") , (60000, "sesenta mil") , (70000, "setenta mil") , (80000, "ochenta mil") , (90000, "noventa mil") , (100000, "ciento mil") , (123456, "ciento veintitrés mil cuatro cientos cinquenta y seis") , (200000, "dos cientos mil") , (300000, "tres cientos mil") , (400000, "cuatro cientos mil") , (500000, "quinientos mil") , (600000, "seis cientos mil") , (654321, "seis cientos cinquenta y cuatro mil tres cientos veintiún") , (700000, "siete cientos mil") , (800000, "ocho cientos mil") , (900000, "nueve cientos mil") , (1000000, "un millón") , (1234567, "un millón dos cientos treinta y cuatro mil quinientos sesenta y siete") , (7654321, "siete millones seis cientos cinquenta y cuatro mil tres cientos veintiún") , (1000000000, "un billón") , (1000000000000, "un trillón") , (1000000000000000, "un cuatrillón") , (1000000000000000000, "un quintillón") , (1000000000000000000000, "un sextillón") , (1000000000000000000000000, "un septillón") , (1000000000000000000000000000, "un octillón") , (1000000000000000000000000000000, "un nonillón") , (1000000000000000000000000000000000, "un decallón") ] ) ]
5,941
cardinals ∷ (Num i) ⇒ TestData i cardinals = [ ( "default" , defaultInflection , [ (0, "cero") , (1, "uno") , (2, "dos") , (3, "tres") , (4, "cuatro") , (5, "cinco") , (6, "seis") , (7, "siete") , (8, "ocho") , (9, "nueve") , (10, "diez") , (11, "once") , (12, "doce") , (13, "trece") , (14, "catorce") , (15, "quince") , (16, "dieciséis") , (17, "diecisiete") , (18, "dieciocho") , (19, "diecinueve") , (20, "veinte") , (21, "veintiún") , (22, "veintidós") , (23, "veintitrés") , (24, "veinticuatro") , (25, "veinticinco") , (26, "veintiséis") , (27, "veintisiete") , (28, "veintiocho") , (29, "veintinueve") , (30, "treinta") , (31, "treinta y uno") , (32, "treinta y dos") , (33, "treinta y tres") , (34, "treinta y cuatro") , (35, "treinta y cinco") , (36, "treinta y seis") , (37, "treinta y siete") , (38, "treinta y ocho") , (39, "treinta y nueve") , (40, "cuarenta") , (41, "cuarenta y uno") , (42, "cuarenta y dos") , (43, "cuarenta y tres") , (44, "cuarenta y cuatro") , (45, "cuarenta y cinco") , (46, "cuarenta y seis") , (47, "cuarenta y siete") , (48, "cuarenta y ocho") , (49, "cuarenta y nueve") , (50, "cinquenta") , (51, "cinquenta y uno") , (52, "cinquenta y dos") , (53, "cinquenta y tres") , (54, "cinquenta y cuatro") , (55, "cinquenta y cinco") , (56, "cinquenta y seis") , (57, "cinquenta y siete") , (58, "cinquenta y ocho") , (59, "cinquenta y nueve") , (60, "sesenta") , (61, "sesenta y uno") , (62, "sesenta y dos") , (63, "sesenta y tres") , (64, "sesenta y cuatro") , (65, "sesenta y cinco") , (66, "sesenta y seis") , (67, "sesenta y siete") , (68, "sesenta y ocho") , (69, "sesenta y nueve") , (70, "setenta") , (71, "setenta y uno") , (72, "setenta y dos") , (73, "setenta y tres") , (74, "setenta y cuatro") , (75, "setenta y cinco") , (76, "setenta y seis") , (77, "setenta y siete") , (78, "setenta y ocho") , (79, "setenta y nueve") , (80, "ochenta") , (81, "ochenta y uno") , (82, "ochenta y dos") , (83, "ochenta y tres") , (84, "ochenta y cuatro") , (85, "ochenta y cinco") , (86, "ochenta y seis") , (87, "ochenta y siete") , (88, "ochenta y ocho") , (89, "ochenta y nueve") , (90, "noventa") , (91, "noventa y uno") , (92, "noventa y dos") , (93, "noventa y tres") , (94, "noventa y cuatro") , (95, "noventa y cinco") , (96, "noventa y seis") , (97, "noventa y siete") , (98, "noventa y ocho") , (99, "noventa y nueve") , (100, "ciento") , (101, "ciento uno") , (102, "ciento dos") , (103, "ciento tres") , (104, "ciento cuatro") , (105, "ciento cinco") , (106, "ciento seis") , (107, "ciento siete") , (108, "ciento ocho") , (109, "ciento nueve") , (110, "ciento diez") , (123, "ciento veintitrés") , (200, "dos cientos") , (300, "tres cientos") , (321, "tres cientos veintiún") , (400, "cuatro cientos") , (500, "quinientos") , (600, "seis cientos") , (700, "siete cientos") , (800, "ocho cientos") , (900, "nueve cientos") , (909, "nueve cientos nueve") , (990, "nueve cientos noventa") , (999, "nueve cientos noventa y nueve") , (1000, "un mil") , (1001, "un mil uno") , (1008, "un mil ocho") , (1234, "un mil dos cientos treinta y cuatro") , (2000, "dos mil") , (3000, "tres mil") , (4000, "cuatro mil") , (4321, "cuatro mil tres cientos veintiún") , (5000, "cinco mil") , (6000, "seis mil") , (7000, "siete mil") , (8000, "ocho mil") , (9000, "nueve mil") , (10000, "diez mil") , (12345, "doce mil tres cientos cuarenta y cinco") , (20000, "veinte mil") , (30000, "treinta mil") , (40000, "cuarenta mil") , (50000, "cinquenta mil") , (54321, "cinquenta y cuatro mil tres cientos veintiún") , (60000, "sesenta mil") , (70000, "setenta mil") , (80000, "ochenta mil") , (90000, "noventa mil") , (100000, "ciento mil") , (123456, "ciento veintitrés mil cuatro cientos cinquenta y seis") , (200000, "dos cientos mil") , (300000, "tres cientos mil") , (400000, "cuatro cientos mil") , (500000, "quinientos mil") , (600000, "seis cientos mil") , (654321, "seis cientos cinquenta y cuatro mil tres cientos veintiún") , (700000, "siete cientos mil") , (800000, "ocho cientos mil") , (900000, "nueve cientos mil") , (1000000, "un millón") , (1234567, "un millón dos cientos treinta y cuatro mil quinientos sesenta y siete") , (7654321, "siete millones seis cientos cinquenta y cuatro mil tres cientos veintiún") , (1000000000, "un billón") , (1000000000000, "un trillón") , (1000000000000000, "un cuatrillón") , (1000000000000000000, "un quintillón") , (1000000000000000000000, "un sextillón") , (1000000000000000000000000, "un septillón") , (1000000000000000000000000000, "un octillón") , (1000000000000000000000000000000, "un nonillón") , (1000000000000000000000000000000000, "un decallón") ] ) ]
5,678
cardinals = [ ( "default" , defaultInflection , [ (0, "cero") , (1, "uno") , (2, "dos") , (3, "tres") , (4, "cuatro") , (5, "cinco") , (6, "seis") , (7, "siete") , (8, "ocho") , (9, "nueve") , (10, "diez") , (11, "once") , (12, "doce") , (13, "trece") , (14, "catorce") , (15, "quince") , (16, "dieciséis") , (17, "diecisiete") , (18, "dieciocho") , (19, "diecinueve") , (20, "veinte") , (21, "veintiún") , (22, "veintidós") , (23, "veintitrés") , (24, "veinticuatro") , (25, "veinticinco") , (26, "veintiséis") , (27, "veintisiete") , (28, "veintiocho") , (29, "veintinueve") , (30, "treinta") , (31, "treinta y uno") , (32, "treinta y dos") , (33, "treinta y tres") , (34, "treinta y cuatro") , (35, "treinta y cinco") , (36, "treinta y seis") , (37, "treinta y siete") , (38, "treinta y ocho") , (39, "treinta y nueve") , (40, "cuarenta") , (41, "cuarenta y uno") , (42, "cuarenta y dos") , (43, "cuarenta y tres") , (44, "cuarenta y cuatro") , (45, "cuarenta y cinco") , (46, "cuarenta y seis") , (47, "cuarenta y siete") , (48, "cuarenta y ocho") , (49, "cuarenta y nueve") , (50, "cinquenta") , (51, "cinquenta y uno") , (52, "cinquenta y dos") , (53, "cinquenta y tres") , (54, "cinquenta y cuatro") , (55, "cinquenta y cinco") , (56, "cinquenta y seis") , (57, "cinquenta y siete") , (58, "cinquenta y ocho") , (59, "cinquenta y nueve") , (60, "sesenta") , (61, "sesenta y uno") , (62, "sesenta y dos") , (63, "sesenta y tres") , (64, "sesenta y cuatro") , (65, "sesenta y cinco") , (66, "sesenta y seis") , (67, "sesenta y siete") , (68, "sesenta y ocho") , (69, "sesenta y nueve") , (70, "setenta") , (71, "setenta y uno") , (72, "setenta y dos") , (73, "setenta y tres") , (74, "setenta y cuatro") , (75, "setenta y cinco") , (76, "setenta y seis") , (77, "setenta y siete") , (78, "setenta y ocho") , (79, "setenta y nueve") , (80, "ochenta") , (81, "ochenta y uno") , (82, "ochenta y dos") , (83, "ochenta y tres") , (84, "ochenta y cuatro") , (85, "ochenta y cinco") , (86, "ochenta y seis") , (87, "ochenta y siete") , (88, "ochenta y ocho") , (89, "ochenta y nueve") , (90, "noventa") , (91, "noventa y uno") , (92, "noventa y dos") , (93, "noventa y tres") , (94, "noventa y cuatro") , (95, "noventa y cinco") , (96, "noventa y seis") , (97, "noventa y siete") , (98, "noventa y ocho") , (99, "noventa y nueve") , (100, "ciento") , (101, "ciento uno") , (102, "ciento dos") , (103, "ciento tres") , (104, "ciento cuatro") , (105, "ciento cinco") , (106, "ciento seis") , (107, "ciento siete") , (108, "ciento ocho") , (109, "ciento nueve") , (110, "ciento diez") , (123, "ciento veintitrés") , (200, "dos cientos") , (300, "tres cientos") , (321, "tres cientos veintiún") , (400, "cuatro cientos") , (500, "quinientos") , (600, "seis cientos") , (700, "siete cientos") , (800, "ocho cientos") , (900, "nueve cientos") , (909, "nueve cientos nueve") , (990, "nueve cientos noventa") , (999, "nueve cientos noventa y nueve") , (1000, "un mil") , (1001, "un mil uno") , (1008, "un mil ocho") , (1234, "un mil dos cientos treinta y cuatro") , (2000, "dos mil") , (3000, "tres mil") , (4000, "cuatro mil") , (4321, "cuatro mil tres cientos veintiún") , (5000, "cinco mil") , (6000, "seis mil") , (7000, "siete mil") , (8000, "ocho mil") , (9000, "nueve mil") , (10000, "diez mil") , (12345, "doce mil tres cientos cuarenta y cinco") , (20000, "veinte mil") , (30000, "treinta mil") , (40000, "cuarenta mil") , (50000, "cinquenta mil") , (54321, "cinquenta y cuatro mil tres cientos veintiún") , (60000, "sesenta mil") , (70000, "setenta mil") , (80000, "ochenta mil") , (90000, "noventa mil") , (100000, "ciento mil") , (123456, "ciento veintitrés mil cuatro cientos cinquenta y seis") , (200000, "dos cientos mil") , (300000, "tres cientos mil") , (400000, "cuatro cientos mil") , (500000, "quinientos mil") , (600000, "seis cientos mil") , (654321, "seis cientos cinquenta y cuatro mil tres cientos veintiún") , (700000, "siete cientos mil") , (800000, "ocho cientos mil") , (900000, "nueve cientos mil") , (1000000, "un millón") , (1234567, "un millón dos cientos treinta y cuatro mil quinientos sesenta y siete") , (7654321, "siete millones seis cientos cinquenta y cuatro mil tres cientos veintiún") , (1000000000, "un billón") , (1000000000000, "un trillón") , (1000000000000000, "un cuatrillón") , (1000000000000000000, "un quintillón") , (1000000000000000000000, "un sextillón") , (1000000000000000000000000, "un septillón") , (1000000000000000000000000000, "un octillón") , (1000000000000000000000000000000, "un nonillón") , (1000000000000000000000000000000000, "un decallón") ] ) ]
5,645
true
true
0
9
1,845
1,584
1,051
533
null
null
JoshuaGross/haskell-learning-log
Code/Haskellbook/BTree.hs
mit
testInorder :: IO () testInorder = if inorder testTree == [1, 2, 3] then putStrLn "Inorder fine!" else putStrLn "Bad news bears."
135
testInorder :: IO () testInorder = if inorder testTree == [1, 2, 3] then putStrLn "Inorder fine!" else putStrLn "Bad news bears."
135
testInorder = if inorder testTree == [1, 2, 3] then putStrLn "Inorder fine!" else putStrLn "Bad news bears."
114
false
true
0
7
27
46
24
22
null
null
strager/reactive-thread
examples/sdl/Main.hs
bsd-3-clause
heldOf :: KeyboardChan -> [SDL.SDLKey] -> Update o (UpdateVar [SDL.SDLKey]) heldOf origKeyChan keys = parallel [] $ do keyChan <- liftIO $ dupChan origKeyChan evalStateT (foreverT $ go keyChan) [] where go keyChan = do (upOrDown, sym) <- liftIO $ readChan keyChan let key = SDL.symKey sym when (key `elem` keys) $ do held <- get let held' = case upOrDown of Up -> delete key held Down -> key : held put held' lift $ yield held'
515
heldOf :: KeyboardChan -> [SDL.SDLKey] -> Update o (UpdateVar [SDL.SDLKey]) heldOf origKeyChan keys = parallel [] $ do keyChan <- liftIO $ dupChan origKeyChan evalStateT (foreverT $ go keyChan) [] where go keyChan = do (upOrDown, sym) <- liftIO $ readChan keyChan let key = SDL.symKey sym when (key `elem` keys) $ do held <- get let held' = case upOrDown of Up -> delete key held Down -> key : held put held' lift $ yield held'
515
heldOf origKeyChan keys = parallel [] $ do keyChan <- liftIO $ dupChan origKeyChan evalStateT (foreverT $ go keyChan) [] where go keyChan = do (upOrDown, sym) <- liftIO $ readChan keyChan let key = SDL.symKey sym when (key `elem` keys) $ do held <- get let held' = case upOrDown of Up -> delete key held Down -> key : held put held' lift $ yield held'
439
false
true
1
17
165
217
99
118
null
null
Crazycolorz5/AlgebraicPrelude
Categories.hs
mit
(<$>) :: (Functor f) => (a -> b) -> (f a -> f b) (<$>) = fmap
62
(<$>) :: (Functor f) => (a -> b) -> (f a -> f b) (<$>) = fmap
61
(<$>) = fmap
12
false
true
0
11
17
55
28
27
null
null
emhoracek/smooch
app/src/CelToPng.hs
gpl-3.0
celToRGBA8 :: Int -- ^ Cel width. -> Int -- ^ Cel height. -> CelPixels -> Image Pixel8 celToRGBA8 width height celPixels = Pic.generateImage generator width height where generator x y = pixelByIndex (y * width + x) celPixels -- | Return the RGBA8 representation of the given palette.
327
celToRGBA8 :: Int -- ^ Cel width. -> Int -- ^ Cel height. -> CelPixels -> Image Pixel8 celToRGBA8 width height celPixels = Pic.generateImage generator width height where generator x y = pixelByIndex (y * width + x) celPixels -- | Return the RGBA8 representation of the given palette.
327
celToRGBA8 width height celPixels = Pic.generateImage generator width height where generator x y = pixelByIndex (y * width + x) celPixels -- | Return the RGBA8 representation of the given palette.
207
false
true
0
9
92
76
38
38
null
null
nishiuramakoto/logiku
test/Handler/CCSpec.hs
gpl-3.0
submitPreview = do bodyContains "Preview your submission" action <- formActionValue ".articleDetailBody form" liftIO $ I.unpack action `shouldStartWith` "/blog/" let req = do setMethod methodPost setUrl $ "http://localhost:3000" ++ I.unpack action addPostParam "submit" "Submit" addToken I.request req statusIs 200 bodyContains "Blog View" bodyContains "You are logged in as root." ------------------------------------------------------------------
513
submitPreview = do bodyContains "Preview your submission" action <- formActionValue ".articleDetailBody form" liftIO $ I.unpack action `shouldStartWith` "/blog/" let req = do setMethod methodPost setUrl $ "http://localhost:3000" ++ I.unpack action addPostParam "submit" "Submit" addToken I.request req statusIs 200 bodyContains "Blog View" bodyContains "You are logged in as root." ------------------------------------------------------------------
513
submitPreview = do bodyContains "Preview your submission" action <- formActionValue ".articleDetailBody form" liftIO $ I.unpack action `shouldStartWith` "/blog/" let req = do setMethod methodPost setUrl $ "http://localhost:3000" ++ I.unpack action addPostParam "submit" "Submit" addToken I.request req statusIs 200 bodyContains "Blog View" bodyContains "You are logged in as root." ------------------------------------------------------------------
513
false
false
0
14
113
109
45
64
null
null
NickAger/LearningHaskell
well-typed at skills matter/fast-track/exercises/0/QuickTour.hs
mit
------------------------------------------------------------ -- Testing lazy evalution of ``or'': -- lazyOrTest1 = True || undefined -- lazyOrTest2 = False || undefined ------------------------------------------------------------ -- Logical negation: -- not :: Bool -> Bool -- optional, but good practice -- not True = False -- not False = True ------------------------------------------------------------ -- Currying: -- -- Try in GHCi: -- -- :t (||) -- -- Note that we can use operators as normal functions by -- putting them in parentheses. ------------------------------------------------------------ -- Partial application: -- elem :: Int -> [Int] -> Bool -- Type signatures can appear elsewhere in the module than -- the function, but that's usually not recommended -- containsZero :: [Int] -> Bool -- containsZero = elem 0 ------------------------------------------------------------ -- Overloading and polymorphism: -- -- Comment out the type signature of elem above, then try -- in GHCi: -- -- :t elem ------------------------------------------------------------ -- Type classes: -- -- Try in GHCi: -- -- :t (==) ------------------------------------------------------------ -- Overloaded literals: -- -- Try in GHCi: -- -- :t 23 ------------------------------------------------------------ -- Other type classes: -- -- Just for fun, try in GHCi: -- -- :t (<=) -- :t show -- :t enumFromTo -- :t minBound ------------------------------------------------------------ -- (Parametric) polymorphism: -- -- Try in GHCi: -- -- :t [] ------------------------------------------------------------ -- Example: (++) :: [a] -> [a] -> [a] [] ++ ys = ys
1,669
(++) :: [a] -> [a] -> [a] [] ++ ys = ys
45
[] ++ ys = ys
19
true
true
0
10
240
104
83
21
null
null
forste/haReFork
tools/base/TI/TiDefinedNames.hs
bsd-3-clause
typeIdent (n,t) = case t of Class {} -> Just (HsCon n) Type {} -> Just (HsCon n) _ -> Nothing
113
typeIdent (n,t) = case t of Class {} -> Just (HsCon n) Type {} -> Just (HsCon n) _ -> Nothing
113
typeIdent (n,t) = case t of Class {} -> Just (HsCon n) Type {} -> Just (HsCon n) _ -> Nothing
113
false
false
0
10
40
64
31
33
null
null
kadoban/sgf
Canvas.hs
agpl-3.0
jsCanvas = Canvas { setupCanvas = jsSetup , nextPlayer = jsToPlay , placeStone = jsPlaceStone , placeMark = jsPlaceMark , finalize = jsFinalize , initState = undefined :: ((Point -> Point), Integer) }
308
jsCanvas = Canvas { setupCanvas = jsSetup , nextPlayer = jsToPlay , placeStone = jsPlaceStone , placeMark = jsPlaceMark , finalize = jsFinalize , initState = undefined :: ((Point -> Point), Integer) }
308
jsCanvas = Canvas { setupCanvas = jsSetup , nextPlayer = jsToPlay , placeStone = jsPlaceStone , placeMark = jsPlaceMark , finalize = jsFinalize , initState = undefined :: ((Point -> Point), Integer) }
308
false
false
1
10
140
67
39
28
null
null
siddhanathan/ghc
compiler/main/DriverPipeline.hs
bsd-3-clause
maybeCreateManifest :: DynFlags -> FilePath -- filename of executable -> IO [FilePath] -- extra objects to embed, maybe maybeCreateManifest dflags exe_filename | platformOS (targetPlatform dflags) == OSMinGW32 && gopt Opt_GenManifest dflags = do let manifest_filename = exe_filename <.> "manifest" writeFile manifest_filename $ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"++ " <assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"++ " <assemblyIdentity version=\"1.0.0.0\"\n"++ " processorArchitecture=\"X86\"\n"++ " name=\"" ++ dropExtension exe_filename ++ "\"\n"++ " type=\"win32\"/>\n\n"++ " <trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n"++ " <security>\n"++ " <requestedPrivileges>\n"++ " <requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\"/>\n"++ " </requestedPrivileges>\n"++ " </security>\n"++ " </trustInfo>\n"++ "</assembly>\n" -- Windows will find the manifest file if it is named -- foo.exe.manifest. However, for extra robustness, and so that -- we can move the binary around, we can embed the manifest in -- the binary itself using windres: if not (gopt Opt_EmbedManifest dflags) then return [] else do rc_filename <- newTempName dflags "rc" rc_obj_filename <- newTempName dflags (objectSuf dflags) writeFile rc_filename $ "1 24 MOVEABLE PURE " ++ show manifest_filename ++ "\n" -- magic numbers :-) -- show is a bit hackish above, but we need to escape the -- backslashes in the path. runWindres dflags $ map SysTools.Option $ ["--input="++rc_filename, "--output="++rc_obj_filename, "--output-format=coff"] -- no FileOptions here: windres doesn't like seeing -- backslashes, apparently removeFile manifest_filename return [rc_obj_filename] | otherwise = return []
2,288
maybeCreateManifest :: DynFlags -> FilePath -- filename of executable -> IO [FilePath] maybeCreateManifest dflags exe_filename | platformOS (targetPlatform dflags) == OSMinGW32 && gopt Opt_GenManifest dflags = do let manifest_filename = exe_filename <.> "manifest" writeFile manifest_filename $ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"++ " <assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"++ " <assemblyIdentity version=\"1.0.0.0\"\n"++ " processorArchitecture=\"X86\"\n"++ " name=\"" ++ dropExtension exe_filename ++ "\"\n"++ " type=\"win32\"/>\n\n"++ " <trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n"++ " <security>\n"++ " <requestedPrivileges>\n"++ " <requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\"/>\n"++ " </requestedPrivileges>\n"++ " </security>\n"++ " </trustInfo>\n"++ "</assembly>\n" -- Windows will find the manifest file if it is named -- foo.exe.manifest. However, for extra robustness, and so that -- we can move the binary around, we can embed the manifest in -- the binary itself using windres: if not (gopt Opt_EmbedManifest dflags) then return [] else do rc_filename <- newTempName dflags "rc" rc_obj_filename <- newTempName dflags (objectSuf dflags) writeFile rc_filename $ "1 24 MOVEABLE PURE " ++ show manifest_filename ++ "\n" -- magic numbers :-) -- show is a bit hackish above, but we need to escape the -- backslashes in the path. runWindres dflags $ map SysTools.Option $ ["--input="++rc_filename, "--output="++rc_obj_filename, "--output-format=coff"] -- no FileOptions here: windres doesn't like seeing -- backslashes, apparently removeFile manifest_filename return [rc_obj_filename] | otherwise = return []
2,235
maybeCreateManifest dflags exe_filename | platformOS (targetPlatform dflags) == OSMinGW32 && gopt Opt_GenManifest dflags = do let manifest_filename = exe_filename <.> "manifest" writeFile manifest_filename $ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"++ " <assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"++ " <assemblyIdentity version=\"1.0.0.0\"\n"++ " processorArchitecture=\"X86\"\n"++ " name=\"" ++ dropExtension exe_filename ++ "\"\n"++ " type=\"win32\"/>\n\n"++ " <trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n"++ " <security>\n"++ " <requestedPrivileges>\n"++ " <requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\"/>\n"++ " </requestedPrivileges>\n"++ " </security>\n"++ " </trustInfo>\n"++ "</assembly>\n" -- Windows will find the manifest file if it is named -- foo.exe.manifest. However, for extra robustness, and so that -- we can move the binary around, we can embed the manifest in -- the binary itself using windres: if not (gopt Opt_EmbedManifest dflags) then return [] else do rc_filename <- newTempName dflags "rc" rc_obj_filename <- newTempName dflags (objectSuf dflags) writeFile rc_filename $ "1 24 MOVEABLE PURE " ++ show manifest_filename ++ "\n" -- magic numbers :-) -- show is a bit hackish above, but we need to escape the -- backslashes in the path. runWindres dflags $ map SysTools.Option $ ["--input="++rc_filename, "--output="++rc_obj_filename, "--output-format=coff"] -- no FileOptions here: windres doesn't like seeing -- backslashes, apparently removeFile manifest_filename return [rc_obj_filename] | otherwise = return []
2,114
true
true
1
25
744
302
145
157
null
null
elben/typing-haskell-in-haskell
TIMain.hs
bsd-3-clause
tiExpr ce as (Lit l) = do (ps,t) <- tiLit l return (ps, t)
103
tiExpr ce as (Lit l) = do (ps,t) <- tiLit l return (ps, t)
103
tiExpr ce as (Lit l) = do (ps,t) <- tiLit l return (ps, t)
103
false
false
0
8
58
50
23
27
null
null
spechub/Hets
GUI/hets_cgi.hs
gpl-2.0
-- link to the homepage of hetcasl hetcaslUrl :: String hetcaslUrl = "http://dol-omg.org/"
90
hetcaslUrl :: String hetcaslUrl = "http://dol-omg.org/"
55
hetcaslUrl = "http://dol-omg.org/"
34
true
true
0
4
12
12
7
5
null
null
gcampax/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
isCIrredEvCan :: Ct -> Bool isCIrredEvCan (CIrredEvCan {}) = True
65
isCIrredEvCan :: Ct -> Bool isCIrredEvCan (CIrredEvCan {}) = True
65
isCIrredEvCan (CIrredEvCan {}) = True
37
false
true
0
7
9
25
13
12
null
null
valderman/selda
selda-tests/test/Tables.hs
mit
modPeople :: Table Person modPeople = tableFieldMod "modpeople" [Single pName :- primary] $ \name -> "mod_" <> name
117
modPeople :: Table Person modPeople = tableFieldMod "modpeople" [Single pName :- primary] $ \name -> "mod_" <> name
117
modPeople = tableFieldMod "modpeople" [Single pName :- primary] $ \name -> "mod_" <> name
91
false
true
0
9
19
42
21
21
null
null
alexander-at-github/eta
compiler/ETA/BasicTypes/Literal.hs
bsd-3-clause
narrow8IntLit l = pprPanic "narrow8IntLit" (ppr l)
64
narrow8IntLit l = pprPanic "narrow8IntLit" (ppr l)
64
narrow8IntLit l = pprPanic "narrow8IntLit" (ppr l)
64
false
false
0
7
20
20
9
11
null
null
haasn/colour
Data/Colour/Names.hs
mit
readColourName "mediumaquamarine" = return mediumaquamarine
59
readColourName "mediumaquamarine" = return mediumaquamarine
59
readColourName "mediumaquamarine" = return mediumaquamarine
59
false
false
0
5
4
13
5
8
null
null
rvion/ride
jetpack/src/System/Environment/AsEnv.hs
bsd-3-clause
-- env_getEnvironment :: IO [(String, String)] env_getEnvironment = I.getEnvironment
84
env_getEnvironment = I.getEnvironment
37
env_getEnvironment = I.getEnvironment
37
true
false
0
5
8
9
5
4
null
null
rolph-recto/liquid-fixpoint
src/Language/Fixpoint/Types/Refinements.hs
bsd-3-clause
predReft :: (Predicate a) => a -> Reft predReft p = Reft (vv_, prop p)
78
predReft :: (Predicate a) => a -> Reft predReft p = Reft (vv_, prop p)
78
predReft p = Reft (vv_, prop p)
34
false
true
0
7
22
39
20
19
null
null
Spheniscida/symmath
Symmath/Simplify.hs
mit
-- 10^(log(10,y)) = y simplifyPow (Power b1 (Log b2 t)) | b1 == b2 = t
70
simplifyPow (Power b1 (Log b2 t)) | b1 == b2 = t
48
simplifyPow (Power b1 (Log b2 t)) | b1 == b2 = t
48
true
false
0
8
15
37
17
20
null
null
diku-dk/futhark
src/Futhark/Util.hs
isc
encodeChar '>' = "zg"
21
encodeChar '>' = "zg"
21
encodeChar '>' = "zg"
21
false
false
0
5
3
9
4
5
null
null
amccausl/Swish
Swish/HaskellRDF/RDFProofContext.hs
lgpl-2.1
rdfsa05 :: RDFFormula rdfsa05 = makeFormula scopeRDFS "a05" "rdfs:range rdfs:domain rdf:Property ."
112
rdfsa05 :: RDFFormula rdfsa05 = makeFormula scopeRDFS "a05" "rdfs:range rdfs:domain rdf:Property ."
112
rdfsa05 = makeFormula scopeRDFS "a05" "rdfs:range rdfs:domain rdf:Property ."
90
false
true
0
5
24
19
9
10
null
null
kbiscanic/PUH
hw01/homework.hs
mit
-- 1) function that takes a string and length boundaries and checks whether the string length is within those bounds (inclusive) strlenInRange str a b | a < 0 || b < 0 = error "String length cannot be a negative number" | otherwise = length str >= a && length str <= b
294
strlenInRange str a b | a < 0 || b < 0 = error "String length cannot be a negative number" | otherwise = length str >= a && length str <= b
165
strlenInRange str a b | a < 0 || b < 0 = error "String length cannot be a negative number" | otherwise = length str >= a && length str <= b
165
true
false
1
10
79
66
29
37
null
null
keithodulaigh/Hets
GMP/Proof.hs
gpl-2.0
ttest :: [ (Sequent, Sequent) ] -> String ttest [] = []
55
ttest :: [ (Sequent, Sequent) ] -> String ttest [] = []
55
ttest [] = []
13
false
true
0
8
11
37
18
19
null
null
hferreiro/replay
testsuite/tests/safeHaskell/check/Check10.hs
bsd-3-clause
b :: ByteString b = pack "Hello World"
38
b :: ByteString b = pack "Hello World"
38
b = pack "Hello World"
22
false
true
0
6
7
20
8
12
null
null
cryptica/slapnet
src/Solver.hs
gpl-3.0
rebuildModel _ (Right (True, _)) = error "Prover returned unknown"
66
rebuildModel _ (Right (True, _)) = error "Prover returned unknown"
66
rebuildModel _ (Right (True, _)) = error "Prover returned unknown"
66
false
false
0
8
9
26
13
13
null
null
vladimir-ipatov/ganeti
src/Ganeti/Constants.hs
gpl-2.0
-- | Node clock skew (seconds) nodeMaxClockSkew :: Int nodeMaxClockSkew = 150
77
nodeMaxClockSkew :: Int nodeMaxClockSkew = 150
46
nodeMaxClockSkew = 150
22
true
true
0
6
11
19
8
11
null
null
roberth/uu-helium
src/Helium/Main/Args.hs
gpl-3.0
processRunHeliumArgs :: [String] -> IO ([Option], Maybe String) processRunHeliumArgs args = do (options, maybeFiles) <- basicProcessArgs [] args case maybeFiles of Nothing -> terminateWithMessage options "Error in invocation: the name of the lvm file to be run seems to be missing." [] Just _ -> return (options, maybeFiles) -- Sometimes you know the options are correct. Then you can use this.
449
processRunHeliumArgs :: [String] -> IO ([Option], Maybe String) processRunHeliumArgs args = do (options, maybeFiles) <- basicProcessArgs [] args case maybeFiles of Nothing -> terminateWithMessage options "Error in invocation: the name of the lvm file to be run seems to be missing." [] Just _ -> return (options, maybeFiles) -- Sometimes you know the options are correct. Then you can use this.
449
processRunHeliumArgs args = do (options, maybeFiles) <- basicProcessArgs [] args case maybeFiles of Nothing -> terminateWithMessage options "Error in invocation: the name of the lvm file to be run seems to be missing." [] Just _ -> return (options, maybeFiles) -- Sometimes you know the options are correct. Then you can use this.
385
false
true
0
11
115
97
49
48
null
null
haskell-distributed/distributed-process-tests
src/Control/Distributed/Process/Tests/CH.hs
bsd-3-clause
testMonitorNode :: TestTransport -> Assertion testMonitorNode TestTransport{..} = do [node1, node2] <- replicateM 2 $ newLocalNode testTransport initRemoteTable done <- newEmptyMVar closeLocalNode node1 runProcess node2 $ do ref <- monitorNode (localNodeId node1) NodeMonitorNotification ref' nid DiedDisconnect <- expect True <- return $ ref == ref' && nid == localNodeId node1 liftIO $ putMVar done () takeMVar done
446
testMonitorNode :: TestTransport -> Assertion testMonitorNode TestTransport{..} = do [node1, node2] <- replicateM 2 $ newLocalNode testTransport initRemoteTable done <- newEmptyMVar closeLocalNode node1 runProcess node2 $ do ref <- monitorNode (localNodeId node1) NodeMonitorNotification ref' nid DiedDisconnect <- expect True <- return $ ref == ref' && nid == localNodeId node1 liftIO $ putMVar done () takeMVar done
446
testMonitorNode TestTransport{..} = do [node1, node2] <- replicateM 2 $ newLocalNode testTransport initRemoteTable done <- newEmptyMVar closeLocalNode node1 runProcess node2 $ do ref <- monitorNode (localNodeId node1) NodeMonitorNotification ref' nid DiedDisconnect <- expect True <- return $ ref == ref' && nid == localNodeId node1 liftIO $ putMVar done () takeMVar done
400
false
true
0
14
85
148
66
82
null
null
garetxe/cabal
Cabal/Distribution/Simple/Utils.hs
bsd-3-clause
findAllFilesWithExtension :: [String] -> [FilePath] -> FilePath -> IO [FilePath] findAllFilesWithExtension extensions searchPath basename = findAllFiles id [ path </> basename <.> ext | path <- nub searchPath , ext <- nub extensions ]
326
findAllFilesWithExtension :: [String] -> [FilePath] -> FilePath -> IO [FilePath] findAllFilesWithExtension extensions searchPath basename = findAllFiles id [ path </> basename <.> ext | path <- nub searchPath , ext <- nub extensions ]
326
findAllFilesWithExtension extensions searchPath basename = findAllFiles id [ path </> basename <.> ext | path <- nub searchPath , ext <- nub extensions ]
167
false
true
0
9
125
80
40
40
null
null
ben-schulz/Idris-dev
src/Idris/Parser/Helpers.hs
bsd-3-clause
-- | Checks that there are no braces that are not closed notOpenBraces :: IdrisParser () notOpenBraces = do ist <- get when (hasNothing $ brace_stack ist) $ fail "end of input" where hasNothing :: [Maybe a] -> Bool hasNothing = any isNothing {- | Parses an accessibilty modifier (e.g. public, private) -}
334
notOpenBraces :: IdrisParser () notOpenBraces = do ist <- get when (hasNothing $ brace_stack ist) $ fail "end of input" where hasNothing :: [Maybe a] -> Bool hasNothing = any isNothing {- | Parses an accessibilty modifier (e.g. public, private) -}
277
notOpenBraces = do ist <- get when (hasNothing $ brace_stack ist) $ fail "end of input" where hasNothing :: [Maybe a] -> Bool hasNothing = any isNothing {- | Parses an accessibilty modifier (e.g. public, private) -}
245
true
true
2
11
82
75
36
39
null
null
pparkkin/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
primOpHasSideEffects WriteTVarOp = True
39
primOpHasSideEffects WriteTVarOp = True
39
primOpHasSideEffects WriteTVarOp = True
39
false
false
0
5
3
9
4
5
null
null
jcristovao/data-easy
src/Data/Easy.hs
bsd-3-clause
-- | A @'(!!)'@ that fails returning @'mempty'@. -- -- /Note/: this function starts by mapping the foldable structure to a list... atF :: (F.Foldable t, Monoid a) => t a -> Int -> a atF lst index = flip (atDef mempty) index . F.toList $ lst
240
atF :: (F.Foldable t, Monoid a) => t a -> Int -> a atF lst index = flip (atDef mempty) index . F.toList $ lst
109
atF lst index = flip (atDef mempty) index . F.toList $ lst
58
true
true
0
9
46
73
36
37
null
null
ekmett/wl-pprint-extras
test/WLPPrintTests.hs
bsd-2-clause
hangTest :: Assertion hangTest = do assertRender 20 "@hang@ test 1" (concat [ "the hang combinator\n" , " indents these\n" , " words !" ]) $ hang 4 $ fillSep $ map text $ words "the hang combinator indents these words !"
308
hangTest :: Assertion hangTest = do assertRender 20 "@hang@ test 1" (concat [ "the hang combinator\n" , " indents these\n" , " words !" ]) $ hang 4 $ fillSep $ map text $ words "the hang combinator indents these words !"
308
hangTest = do assertRender 20 "@hang@ test 1" (concat [ "the hang combinator\n" , " indents these\n" , " words !" ]) $ hang 4 $ fillSep $ map text $ words "the hang combinator indents these words !"
286
false
true
0
15
129
68
31
37
null
null
pbiggar/rash
src/Rash/IR/Bash2Rough.hs
bsd-3-clause
convertShellCommand (S.FunctionDef name cmds) = postProcessFunctionDefs (FunctionDefinition (FuncDef name [] (convertList cmds)))
133
convertShellCommand (S.FunctionDef name cmds) = postProcessFunctionDefs (FunctionDefinition (FuncDef name [] (convertList cmds)))
133
convertShellCommand (S.FunctionDef name cmds) = postProcessFunctionDefs (FunctionDefinition (FuncDef name [] (convertList cmds)))
133
false
false
0
11
15
46
22
24
null
null
sordina/wai
wai-http2-extra/Network/Wai/Middleware/Push/Referer/Multi.hs
bsd-2-clause
insert :: Ord a => a -> Multi a -> Multi a insert _ m@Multi{..} | Set.size check == limit = m
105
insert :: Ord a => a -> Multi a -> Multi a insert _ m@Multi{..} | Set.size check == limit = m
105
insert _ m@Multi{..} | Set.size check == limit = m
62
false
true
0
10
33
61
28
33
null
null
spatial-reasoning/zeno
src/DecisionProcedure/FlipFlop.hs
bsd-2-clause
biquadraticFinalPolynomials = DecisionProcedure { decProName = "BFP" , decProProc = isAcyclicChirotopeWithoutBPFlipFlop }
129
biquadraticFinalPolynomials = DecisionProcedure { decProName = "BFP" , decProProc = isAcyclicChirotopeWithoutBPFlipFlop }
129
biquadraticFinalPolynomials = DecisionProcedure { decProName = "BFP" , decProProc = isAcyclicChirotopeWithoutBPFlipFlop }
129
false
false
0
7
19
24
13
11
null
null
olsner/ghc
compiler/hsSyn/HsPat.hs
bsd-3-clause
hsRecUpdFieldId :: HsRecField' (AmbiguousFieldOcc Id) arg -> Located Id hsRecUpdFieldId = fmap selectorFieldOcc . hsRecUpdFieldOcc
130
hsRecUpdFieldId :: HsRecField' (AmbiguousFieldOcc Id) arg -> Located Id hsRecUpdFieldId = fmap selectorFieldOcc . hsRecUpdFieldOcc
130
hsRecUpdFieldId = fmap selectorFieldOcc . hsRecUpdFieldOcc
58
false
true
0
8
14
36
17
19
null
null
jozefg/cooked-pi
src/LambdaPi/Easy.hs
mit
-- The term is open inferType (Env _ m) (Const s) = lift $ M.lookup s m
71
inferType (Env _ m) (Const s) = lift $ M.lookup s m
51
inferType (Env _ m) (Const s) = lift $ M.lookup s m
51
true
false
0
7
16
37
18
19
null
null
seereason/ghcjs-jquery
JavaScript/JQuery.hs
mit
childrenMatching :: Selector -> JQuery -> IO JQuery childrenMatching s = jq_children (textToJSString s)
103
childrenMatching :: Selector -> JQuery -> IO JQuery childrenMatching s = jq_children (textToJSString s)
103
childrenMatching s = jq_children (textToJSString s)
51
false
true
0
7
13
34
16
18
null
null
tomasmcz/discrete-opt
src/Problems/TSP/NN.hs
bsd-3-clause
fp dist frst lst unv | not (Set.null unv) = nearest : fp dist frst nearest (Set.delete nearest unv) where nearest = snd (minimum (map dist' (Set.elems unv))) dist' x = (dist (lst, x), x)
200
fp dist frst lst unv | not (Set.null unv) = nearest : fp dist frst nearest (Set.delete nearest unv) where nearest = snd (minimum (map dist' (Set.elems unv))) dist' x = (dist (lst, x), x)
200
fp dist frst lst unv | not (Set.null unv) = nearest : fp dist frst nearest (Set.delete nearest unv) where nearest = snd (minimum (map dist' (Set.elems unv))) dist' x = (dist (lst, x), x)
200
false
false
2
11
48
124
55
69
null
null
trskop/cabal
Cabal/Distribution/PackageDescription/Parse.hs
bsd-3-clause
storeXFieldsLib _ _ = Nothing
29
storeXFieldsLib _ _ = Nothing
29
storeXFieldsLib _ _ = Nothing
29
false
false
1
5
4
12
5
7
null
null
tpsinnem/Idris-dev
src/Idris/Prover.hs
bsd-3-clause
undoStep :: [String] -> [(Name, Type, Term)] -> ElabState EState -> ElabShellHistory -> Idris ([String], [(Name, Type, Term)], ElabState EState) undoStep prf env st ElabStep = do (_, st') <- elabStep st loadState return (init prf, env, st')
274
undoStep :: [String] -> [(Name, Type, Term)] -> ElabState EState -> ElabShellHistory -> Idris ([String], [(Name, Type, Term)], ElabState EState) undoStep prf env st ElabStep = do (_, st') <- elabStep st loadState return (init prf, env, st')
274
undoStep prf env st ElabStep = do (_, st') <- elabStep st loadState return (init prf, env, st')
129
false
true
0
12
71
120
65
55
null
null
lgeorget/ogma
client/app/Main.hs
mit
getHello :: forall t m.MonadWidget t m => Event t () -> m (Event t (Maybe Hello, XhrResponse)) getHello = client (Proxy :: Proxy OgmaApi) (Proxy :: Proxy m) (constDyn $ BaseUrl Http "localhost" 8080 "")
256
getHello :: forall t m.MonadWidget t m => Event t () -> m (Event t (Maybe Hello, XhrResponse)) getHello = client (Proxy :: Proxy OgmaApi) (Proxy :: Proxy m) (constDyn $ BaseUrl Http "localhost" 8080 "")
256
getHello = client (Proxy :: Proxy OgmaApi) (Proxy :: Proxy m) (constDyn $ BaseUrl Http "localhost" 8080 "")
143
false
true
0
12
89
98
50
48
null
null
rfranek/duckling
Duckling/Rules/UK.hs
bsd-3-clause
rules (This Temperature) = []
29
rules (This Temperature) = []
29
rules (This Temperature) = []
29
false
false
0
7
4
17
8
9
null
null
aedanlombardo/HaskellPS
DSP-PBE/Tests/MetricSpace.hs
bsd-3-clause
constallationTest = do f <- getFile (dir++"PianoC2.wav") p <- peakList (dir++"PianoC2.wav",f) putStrLn$ "# of time slices taken from PianoC.wav: " print $ length p if length p > 1 then return () else putStrLn "FAILED - too few time slices taken" >> exitFailure putStrLn $ "First time slice peaks of PianoC.wav: " putStrLn $ listToCSV $ take 10 $ head p
375
constallationTest = do f <- getFile (dir++"PianoC2.wav") p <- peakList (dir++"PianoC2.wav",f) putStrLn$ "# of time slices taken from PianoC.wav: " print $ length p if length p > 1 then return () else putStrLn "FAILED - too few time slices taken" >> exitFailure putStrLn $ "First time slice peaks of PianoC.wav: " putStrLn $ listToCSV $ take 10 $ head p
375
constallationTest = do f <- getFile (dir++"PianoC2.wav") p <- peakList (dir++"PianoC2.wav",f) putStrLn$ "# of time slices taken from PianoC.wav: " print $ length p if length p > 1 then return () else putStrLn "FAILED - too few time slices taken" >> exitFailure putStrLn $ "First time slice peaks of PianoC.wav: " putStrLn $ listToCSV $ take 10 $ head p
375
false
false
0
10
83
118
54
64
null
null
acowley/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
hsExprNeedsParens (HsIPVar {}) = False
45
hsExprNeedsParens (HsIPVar {}) = False
45
hsExprNeedsParens (HsIPVar {}) = False
45
false
false
0
6
11
17
8
9
null
null
NightRa/Idris-dev
src/Idris/Core/ProofState.hs
bsd-3-clause
check_in :: Raw -> RunTactic check_in t ctxt env tm = do (val, valty) <- lift $ check ctxt env t addLog (showEnv env val ++ " : " ++ showEnv env valty) return tm
179
check_in :: Raw -> RunTactic check_in t ctxt env tm = do (val, valty) <- lift $ check ctxt env t addLog (showEnv env val ++ " : " ++ showEnv env valty) return tm
179
check_in t ctxt env tm = do (val, valty) <- lift $ check ctxt env t addLog (showEnv env val ++ " : " ++ showEnv env valty) return tm
150
false
true
0
11
52
81
38
43
null
null
caasi/spj-book-student-1992
src/Utils.hs
bsd-3-clause
setElemnteOf x (y:ys) = x == y || (x > y && setElementOf x ys)
62
setElemnteOf x (y:ys) = x == y || (x > y && setElementOf x ys)
62
setElemnteOf x (y:ys) = x == y || (x > y && setElementOf x ys)
62
false
false
0
8
14
44
21
23
null
null
dmjio/aeson
src/Data/Aeson/KeyMap.hs
bsd-3-clause
-- | Convert a 'Map' to a 'KeyMap'. fromMap :: Map Key v -> KeyMap v fromMap = KeyMap
85
fromMap :: Map Key v -> KeyMap v fromMap = KeyMap
49
fromMap = KeyMap
16
true
true
0
7
18
30
13
17
null
null
ezrosent/s-explore
src/UTLC.hs
bsd-3-clause
test1 :: FreshM UTLC test1 = uncurry sub2 `liftM` unbind idents where idents :: Bind (Name UTLC) UTLC idents = abs "x" (var "x") abs x = bind (s2n x) sub2 :: Name UTLC -> UTLC -> UTLC sub2 x = subst x (var "y")
244
test1 :: FreshM UTLC test1 = uncurry sub2 `liftM` unbind idents where idents :: Bind (Name UTLC) UTLC idents = abs "x" (var "x") abs x = bind (s2n x) sub2 :: Name UTLC -> UTLC -> UTLC sub2 x = subst x (var "y")
244
test1 = uncurry sub2 `liftM` unbind idents where idents :: Bind (Name UTLC) UTLC idents = abs "x" (var "x") abs x = bind (s2n x) sub2 :: Name UTLC -> UTLC -> UTLC sub2 x = subst x (var "y")
223
false
true
3
8
78
139
58
81
null
null
DavidAlphaFox/ghc
libraries/haskeline/System/Console/Haskeline/Recover.hs
bsd-3-clause
transliterateFailure :: TextEncoding -> TextEncoding transliterateFailure TextEncoding { mkTextEncoder = mkEncoder , mkTextDecoder = mkDecoder , textEncodingName = name } = TextEncoding { mkTextDecoder = fmap (setRecover $ recoverDecode TransliterateCodingFailure) mkDecoder , mkTextEncoder = fmap (setRecover $ recoverEncode TransliterateCodingFailure) mkEncoder , textEncodingName = name } where setRecover r x = x { recover = r }
616
transliterateFailure :: TextEncoding -> TextEncoding transliterateFailure TextEncoding { mkTextEncoder = mkEncoder , mkTextDecoder = mkDecoder , textEncodingName = name } = TextEncoding { mkTextDecoder = fmap (setRecover $ recoverDecode TransliterateCodingFailure) mkDecoder , mkTextEncoder = fmap (setRecover $ recoverEncode TransliterateCodingFailure) mkEncoder , textEncodingName = name } where setRecover r x = x { recover = r }
616
transliterateFailure TextEncoding { mkTextEncoder = mkEncoder , mkTextDecoder = mkDecoder , textEncodingName = name } = TextEncoding { mkTextDecoder = fmap (setRecover $ recoverDecode TransliterateCodingFailure) mkDecoder , mkTextEncoder = fmap (setRecover $ recoverEncode TransliterateCodingFailure) mkEncoder , textEncodingName = name } where setRecover r x = x { recover = r }
563
false
true
1
11
239
116
61
55
null
null
apyrgio/snf-ganeti
src/Ganeti/JSON.hs
bsd-2-clause
arrayMaybeFromJVal :: (J.JSON a, Monad m) => J.JSValue -> m [Maybe a] arrayMaybeFromJVal (J.JSArray xs) = mapM parse xs where parse J.JSNull = return Nothing parse x = liftM Just $ fromJVal x
209
arrayMaybeFromJVal :: (J.JSON a, Monad m) => J.JSValue -> m [Maybe a] arrayMaybeFromJVal (J.JSArray xs) = mapM parse xs where parse J.JSNull = return Nothing parse x = liftM Just $ fromJVal x
209
arrayMaybeFromJVal (J.JSArray xs) = mapM parse xs where parse J.JSNull = return Nothing parse x = liftM Just $ fromJVal x
139
false
true
0
9
50
94
44
50
null
null
martintrojer/scheme-haskell
src/BuiltIns.hs
bsd-3-clause
illegalArguments :: String -> t illegalArguments fn = error $ "Illegal arguments " ++ fn
88
illegalArguments :: String -> t illegalArguments fn = error $ "Illegal arguments " ++ fn
88
illegalArguments fn = error $ "Illegal arguments " ++ fn
56
false
true
2
7
14
32
14
18
null
null
UweSchmidt/cmdtheline
src/System/Console/CmdTheLine/CmdLine.hs
mit
create :: [ArgInfo] -> [String] -> Err CmdLine create ais args = processPosArgs posAis =<< parseArgs optTrie cl args where ( optTrie, posAis, cl ) = argInfoIndexes ais
171
create :: [ArgInfo] -> [String] -> Err CmdLine create ais args = processPosArgs posAis =<< parseArgs optTrie cl args where ( optTrie, posAis, cl ) = argInfoIndexes ais
171
create ais args = processPosArgs posAis =<< parseArgs optTrie cl args where ( optTrie, posAis, cl ) = argInfoIndexes ais
124
false
true
0
7
31
68
34
34
null
null
pminten/xhaskell
_test/check-exercises.hs
mit
parseModule :: [String] -> String parseModule = (!!1) . words . head . filter (isPrefixOf "module ")
100
parseModule :: [String] -> String parseModule = (!!1) . words . head . filter (isPrefixOf "module ")
100
parseModule = (!!1) . words . head . filter (isPrefixOf "module ")
66
false
true
0
8
16
43
23
20
null
null
gridaphobe/liquid-fixpoint
src/Language/Fixpoint/Types/Refinements.hs
bsd-3-clause
parensIf True = parens
23
parensIf True = parens
23
parensIf True = parens
23
false
false
1
5
4
13
4
9
null
null
GaloisInc/saw-script
src/SAWScript/Prover/MRSolver/Solver.hs
bsd-3-clause
mrRefines' m1 (Ite cond2 m2 m2') = liftSC1 scNot cond2 >>= \not_cond2 -> mrProvable cond2 >>= \cond2_true_pv-> mrProvable not_cond2 >>= \cond2_false_pv -> case (cond2_true_pv, cond2_false_pv) of (True, _) -> mrRefines m1 m2 (_, True) -> mrRefines m1 m2' _ -> withAssumption cond2 (mrRefines m1 m2) >> withAssumption not_cond2 (mrRefines m1 m2')
373
mrRefines' m1 (Ite cond2 m2 m2') = liftSC1 scNot cond2 >>= \not_cond2 -> mrProvable cond2 >>= \cond2_true_pv-> mrProvable not_cond2 >>= \cond2_false_pv -> case (cond2_true_pv, cond2_false_pv) of (True, _) -> mrRefines m1 m2 (_, True) -> mrRefines m1 m2' _ -> withAssumption cond2 (mrRefines m1 m2) >> withAssumption not_cond2 (mrRefines m1 m2')
373
mrRefines' m1 (Ite cond2 m2 m2') = liftSC1 scNot cond2 >>= \not_cond2 -> mrProvable cond2 >>= \cond2_true_pv-> mrProvable not_cond2 >>= \cond2_false_pv -> case (cond2_true_pv, cond2_false_pv) of (True, _) -> mrRefines m1 m2 (_, True) -> mrRefines m1 m2' _ -> withAssumption cond2 (mrRefines m1 m2) >> withAssumption not_cond2 (mrRefines m1 m2')
373
false
false
0
17
79
139
70
69
null
null
danidiaz/lens
src/Control/Lens/Review.hs
bsd-3-clause
-- | An infix alias for 'review'. -- -- @ -- 'unto' f # x ≡ f x -- l # x ≡ x '^.' 're' l -- @ -- -- This is commonly used when using a 'Prism' as a smart constructor. -- -- >>> _Left # 4 -- Left 4 -- -- But it can be used for any 'Prism' -- -- >>> base 16 # 123 -- "7b" -- -- @ -- (#) :: 'Iso'' s a -> a -> s -- (#) :: 'Prism'' s a -> a -> s -- (#) :: 'Review' s a -> a -> s -- (#) :: 'Equality'' s a -> a -> s -- @ ( # ) :: AReview t b -> b -> t ( # ) p = runIdentity #. unTagged #. p .# Tagged .# Identity
518
( # ) :: AReview t b -> b -> t ( # ) p = runIdentity #. unTagged #. p .# Tagged .# Identity
91
( # ) p = runIdentity #. unTagged #. p .# Tagged .# Identity
60
true
true
0
8
151
70
48
22
null
null
alexander-at-github/eta
compiler/ETA/Core/TrieMap.hs
bsd-3-clause
xtNamed :: NamedThing n => n -> XT a -> NameEnv a -> NameEnv a xtNamed tc f m = alterNameEnv f m (getName tc)
109
xtNamed :: NamedThing n => n -> XT a -> NameEnv a -> NameEnv a xtNamed tc f m = alterNameEnv f m (getName tc)
109
xtNamed tc f m = alterNameEnv f m (getName tc)
46
false
true
0
10
24
63
28
35
null
null
nilenso/tronkell
src/Tronkell/Game/Engine.hs
bsd-3-clause
isPlayerAlive :: PlayerId -> Game -> Bool isPlayerAlive pid = maybe False ((== Alive) . playerStatus) . Map.lookup pid . gamePlayers
138
isPlayerAlive :: PlayerId -> Game -> Bool isPlayerAlive pid = maybe False ((== Alive) . playerStatus) . Map.lookup pid . gamePlayers
138
isPlayerAlive pid = maybe False ((== Alive) . playerStatus) . Map.lookup pid . gamePlayers
96
false
true
2
8
26
54
26
28
null
null
thoughtpolice/cabal
Cabal/Distribution/Simple/GHCJS.hs
bsd-3-clause
guessHaddockFromGhcjsPath :: ConfiguredProgram -> Verbosity -> ProgramSearchPath -> IO (Maybe FilePath) guessHaddockFromGhcjsPath = guessToolFromGhcjsPath haddockProgram
195
guessHaddockFromGhcjsPath :: ConfiguredProgram -> Verbosity -> ProgramSearchPath -> IO (Maybe FilePath) guessHaddockFromGhcjsPath = guessToolFromGhcjsPath haddockProgram
195
guessHaddockFromGhcjsPath = guessToolFromGhcjsPath haddockProgram
65
false
true
0
10
40
35
17
18
null
null
mzero/plush
src/Control/Monad/Exception.hs
apache-2.0
catchAll :: (MonadException m) => m a -> (SomeException -> m a) -> m a catchAll = catch
87
catchAll :: (MonadException m) => m a -> (SomeException -> m a) -> m a catchAll = catch
87
catchAll = catch
16
false
true
0
10
17
44
22
22
null
null
bitemyapp/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
luxiReqQueryJobs :: String luxiReqQueryJobs = "QueryJobs"
57
luxiReqQueryJobs :: String luxiReqQueryJobs = "QueryJobs"
57
luxiReqQueryJobs = "QueryJobs"
30
false
true
0
6
5
18
7
11
null
null
mainland/nikola
examples/mandelbrot/Mandelbrot/NikolaV1.hs
bsd-3-clause
mandelbrot :: R -> R -> R -> R -> Int32 -> Int32 -> Int32 -> IO (StepPlane CUF) mandelbrot lowx lowy highx highy viewx viewy depth = do cs <- genPlane lowx lowy highx highy viewx viewy zs0 <- mkinit cs iterateM (step cs) depth zs0
320
mandelbrot :: R -> R -> R -> R -> Int32 -> Int32 -> Int32 -> IO (StepPlane CUF) mandelbrot lowx lowy highx highy viewx viewy depth = do cs <- genPlane lowx lowy highx highy viewx viewy zs0 <- mkinit cs iterateM (step cs) depth zs0
320
mandelbrot lowx lowy highx highy viewx viewy depth = do cs <- genPlane lowx lowy highx highy viewx viewy zs0 <- mkinit cs iterateM (step cs) depth zs0
163
false
true
0
14
136
109
51
58
null
null
mckeankylej/hwRecog
Network/Trainer.hs
mit
trainNTimes :: (Trainer t n, RandomGen g) => g -> n -> t -> Selection -> [TrainingData] -> Int -> n trainNTimes g network trainer s dat n = trainUntil g network trainer s dat completion 0 where completion _ _ _ n' = (n == n') -- | Given a network, a trainer, a list of training data, -- and an error value, this function trains the network with the list of -- training data until the error of the network (calculated -- by averaging the errors of each training data) is less than -- the given error value
517
trainNTimes :: (Trainer t n, RandomGen g) => g -> n -> t -> Selection -> [TrainingData] -> Int -> n trainNTimes g network trainer s dat n = trainUntil g network trainer s dat completion 0 where completion _ _ _ n' = (n == n') -- | Given a network, a trainer, a list of training data, -- and an error value, this function trains the network with the list of -- training data until the error of the network (calculated -- by averaging the errors of each training data) is less than -- the given error value
517
trainNTimes g network trainer s dat n = trainUntil g network trainer s dat completion 0 where completion _ _ _ n' = (n == n') -- | Given a network, a trainer, a list of training data, -- and an error value, this function trains the network with the list of -- training data until the error of the network (calculated -- by averaging the errors of each training data) is less than -- the given error value
417
false
true
0
11
112
112
59
53
null
null
olorin/amazonka
amazonka-opsworks/gen/Network/AWS/OpsWorks/AttachElasticLoadBalancer.hs
mpl-2.0
-- | Creates a value of 'AttachElasticLoadBalancerResponse' with the minimum fields required to make a request. -- attachElasticLoadBalancerResponse :: AttachElasticLoadBalancerResponse attachElasticLoadBalancerResponse = AttachElasticLoadBalancerResponse'
260
attachElasticLoadBalancerResponse :: AttachElasticLoadBalancerResponse attachElasticLoadBalancerResponse = AttachElasticLoadBalancerResponse'
145
attachElasticLoadBalancerResponse = AttachElasticLoadBalancerResponse'
70
true
true
1
5
26
17
8
9
null
null
snoyberg/ghc
compiler/basicTypes/Var.hs
bsd-3-clause
globaliseId :: Id -> Id -- ^ If it's a local, make it global globaliseId id = id { idScope = GlobalId }
103
globaliseId :: Id -> Id globaliseId id = id { idScope = GlobalId }
66
globaliseId id = id { idScope = GlobalId }
42
true
true
0
6
22
27
15
12
null
null
ivitjuk/Haskell-Music-Player
src/HMP.hs
gpl-3.0
execHMP :: Host -> Port -> Password -> HMP () -> IO () execHMP host port pw action = do Right mpd <- makeMPDPersistent host port pw runReaderT (evalStateT (runHMP action) (HMPState "")) (HMPConfig mpd) return ()
217
execHMP :: Host -> Port -> Password -> HMP () -> IO () execHMP host port pw action = do Right mpd <- makeMPDPersistent host port pw runReaderT (evalStateT (runHMP action) (HMPState "")) (HMPConfig mpd) return ()
217
execHMP host port pw action = do Right mpd <- makeMPDPersistent host port pw runReaderT (evalStateT (runHMP action) (HMPState "")) (HMPConfig mpd) return ()
162
false
true
0
11
42
105
48
57
null
null
badp/ganeti
src/Ganeti/Constants.hs
gpl-2.0
sslCertExpirationWarn :: Int sslCertExpirationWarn = 30
55
sslCertExpirationWarn :: Int sslCertExpirationWarn = 30
55
sslCertExpirationWarn = 30
26
false
true
0
4
5
11
6
5
null
null
THeK3nger/quadarto
src/Main.hs
mit
isIndivisible :: Image PixelRGB8 -> Int -> Rect -> Bool -- isIndivisible _ t rect | trace ("isIndivisible:: " ++ show rect ++ " th: " ++ show t) False = undefined isIndivisible img threshold rect = let isPixelInThreshold (PixelRGB8 r g b) | wordIsNear ar r threshold && wordIsNear ag g threshold || wordIsNear ab b threshold = True | otherwise = False where (PixelRGB8 ar ag ab) = avgColor img rect in -- any isPixelInThreshold $ pixelsInSquare img rect all isPixelInThreshold (pixelsInSquare img rect)
586
isIndivisible :: Image PixelRGB8 -> Int -> Rect -> Bool isIndivisible img threshold rect = let isPixelInThreshold (PixelRGB8 r g b) | wordIsNear ar r threshold && wordIsNear ag g threshold || wordIsNear ab b threshold = True | otherwise = False where (PixelRGB8 ar ag ab) = avgColor img rect in -- any isPixelInThreshold $ pixelsInSquare img rect all isPixelInThreshold (pixelsInSquare img rect)
479
isIndivisible img threshold rect = let isPixelInThreshold (PixelRGB8 r g b) | wordIsNear ar r threshold && wordIsNear ag g threshold || wordIsNear ab b threshold = True | otherwise = False where (PixelRGB8 ar ag ab) = avgColor img rect in -- any isPixelInThreshold $ pixelsInSquare img rect all isPixelInThreshold (pixelsInSquare img rect)
423
true
true
0
14
169
139
65
74
null
null
zmoazeni/csscss-haskell
src/Text/CSS/Shorthand/Border.hs
mit
borderWidthsParser :: Parser BorderWidths borderWidthsParser = separate <|> inherit where inherit = do symbol "inherit" endOfInput return InheritBorderWidth separate = do ws <- many1 borderWidthParser let borderWidths = case ws of (w1:[]) -> BorderWidths w1 w1 w1 w1 (w1:w2:[]) -> BorderWidths w1 w2 w1 w2 (w1:w2:w3:[]) -> BorderWidths w1 w2 w3 w2 (w1:w2:w3:w4:_) -> BorderWidths w1 w2 w3 w4 return borderWidths
585
borderWidthsParser :: Parser BorderWidths borderWidthsParser = separate <|> inherit where inherit = do symbol "inherit" endOfInput return InheritBorderWidth separate = do ws <- many1 borderWidthParser let borderWidths = case ws of (w1:[]) -> BorderWidths w1 w1 w1 w1 (w1:w2:[]) -> BorderWidths w1 w2 w1 w2 (w1:w2:w3:[]) -> BorderWidths w1 w2 w3 w2 (w1:w2:w3:w4:_) -> BorderWidths w1 w2 w3 w4 return borderWidths
585
borderWidthsParser = separate <|> inherit where inherit = do symbol "inherit" endOfInput return InheritBorderWidth separate = do ws <- many1 borderWidthParser let borderWidths = case ws of (w1:[]) -> BorderWidths w1 w1 w1 w1 (w1:w2:[]) -> BorderWidths w1 w2 w1 w2 (w1:w2:w3:[]) -> BorderWidths w1 w2 w3 w2 (w1:w2:w3:w4:_) -> BorderWidths w1 w2 w3 w4 return borderWidths
543
false
true
5
18
234
208
95
113
null
null
govindkrjoshi/snaplet-persistent
src/Snap/Snaplet/Auth/Backends/Persistent.hs
bsd-3-clause
initHelper :: AuthSettings -> SnapletLens b SessionManager -> ConnectionPool -> Initializer b (AuthManager b) (AuthManager b) initHelper aus l pool = liftIO $ do key <- getKey (asSiteKey aus) rng <- liftIO mkRNG return $ AuthManager { backend = PAM pool , session = l , activeUser = Nothing , minPasswdLen = asMinPasswdLen aus , rememberCookieName = asRememberCookieName aus , rememberPeriod = asRememberPeriod aus , siteKey = key , lockout = asLockout aus , randomNumberGenerator = rng }
689
initHelper :: AuthSettings -> SnapletLens b SessionManager -> ConnectionPool -> Initializer b (AuthManager b) (AuthManager b) initHelper aus l pool = liftIO $ do key <- getKey (asSiteKey aus) rng <- liftIO mkRNG return $ AuthManager { backend = PAM pool , session = l , activeUser = Nothing , minPasswdLen = asMinPasswdLen aus , rememberCookieName = asRememberCookieName aus , rememberPeriod = asRememberPeriod aus , siteKey = key , lockout = asLockout aus , randomNumberGenerator = rng }
689
initHelper aus l pool = liftIO $ do key <- getKey (asSiteKey aus) rng <- liftIO mkRNG return $ AuthManager { backend = PAM pool , session = l , activeUser = Nothing , minPasswdLen = asMinPasswdLen aus , rememberCookieName = asRememberCookieName aus , rememberPeriod = asRememberPeriod aus , siteKey = key , lockout = asLockout aus , randomNumberGenerator = rng }
530
false
true
2
11
278
168
85
83
null
null
nevrenato/Hets_Fork
Common/Lib/Pretty.hs
gpl-2.0
beside (TextBeside s sl p) g q = textBeside_ s sl rest where rest = case p of Empty -> nilBeside g q _ -> beside p g q
275
beside (TextBeside s sl p) g q = textBeside_ s sl rest where rest = case p of Empty -> nilBeside g q _ -> beside p g q
275
beside (TextBeside s sl p) g q = textBeside_ s sl rest where rest = case p of Empty -> nilBeside g q _ -> beside p g q
275
false
false
0
10
185
65
31
34
null
null