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
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F23.hs
bsd-3-clause
ptr_glRasterPos4xvOES :: FunPtr (Ptr GLfixed -> IO ()) ptr_glRasterPos4xvOES = unsafePerformIO $ getCommand "glRasterPos4xvOES"
127
ptr_glRasterPos4xvOES :: FunPtr (Ptr GLfixed -> IO ()) ptr_glRasterPos4xvOES = unsafePerformIO $ getCommand "glRasterPos4xvOES"
127
ptr_glRasterPos4xvOES = unsafePerformIO $ getCommand "glRasterPos4xvOES"
72
false
true
0
9
13
36
17
19
null
null
nobsun/hs-bcopl
src/Language/BCoPL/DataLevel/CompareNat.hs
bsd-3-clause
deduce3 :: Deducer Judge deduce3 j = case j of LessThan n (S n') | n == n' -> [ Node ("L-Succ",j) [] ] LessThan n1 (S n2) -> [ Node ("L-SuccR",j) [j'] | j' <- deduce3 (LessThan n1 n2) ] _ -> []
275
deduce3 :: Deducer Judge deduce3 j = case j of LessThan n (S n') | n == n' -> [ Node ("L-Succ",j) [] ] LessThan n1 (S n2) -> [ Node ("L-SuccR",j) [j'] | j' <- deduce3 (LessThan n1 n2) ] _ -> []
275
deduce3 j = case j of LessThan n (S n') | n == n' -> [ Node ("L-Succ",j) [] ] LessThan n1 (S n2) -> [ Node ("L-SuccR",j) [j'] | j' <- deduce3 (LessThan n1 n2) ] _ -> []
250
false
true
0
13
125
125
62
63
null
null
acowley/ghc
compiler/main/Packages.hs
bsd-3-clause
wired_in_pkgids :: [String] wired_in_pkgids = map packageKeyString wiredInPackageKeys
85
wired_in_pkgids :: [String] wired_in_pkgids = map packageKeyString wiredInPackageKeys
85
wired_in_pkgids = map packageKeyString wiredInPackageKeys
57
false
true
0
5
7
19
10
9
null
null
daleooo/barrelfish
hake/ARMv7.hs
mit
ourLdFlags = [ Str "-Wl,-section-start,.text=0x400000", Str "-Wl,-section-start,.data=0x600000", Str "-Wl,--build-id=none" ]
154
ourLdFlags = [ Str "-Wl,-section-start,.text=0x400000", Str "-Wl,-section-start,.data=0x600000", Str "-Wl,--build-id=none" ]
154
ourLdFlags = [ Str "-Wl,-section-start,.text=0x400000", Str "-Wl,-section-start,.data=0x600000", Str "-Wl,--build-id=none" ]
154
false
false
0
6
39
24
12
12
null
null
adbrowne/dynamodb-eventstore
dynamodb-eventstore/src/DynamoDbEventStore/EventStoreCommands.hs
mit
readField :: (MonadError e m) => (Text -> e) -> Text -> Lens' AttributeValue (Maybe a) -> DynamoValues -> m a readField = readFieldGeneric
138
readField :: (MonadError e m) => (Text -> e) -> Text -> Lens' AttributeValue (Maybe a) -> DynamoValues -> m a readField = readFieldGeneric
138
readField = readFieldGeneric
28
false
true
0
12
23
65
31
34
null
null
kmate/raw-feldspar
src/Feldspar/Data/Option.hs
bsd-3-clause
none :: String -> OptionT m a none = Option . singleton . None
62
none :: String -> OptionT m a none = Option . singleton . None
62
none = Option . singleton . None
32
false
true
0
6
13
28
14
14
null
null
agremm/LogParser
Path.hs
gpl-3.0
toMethod :: ByteString -> Method toMethod m = case m of "GET" -> Get "POST" -> Post -- "_" is impossible to reach as 'parseMethod' already fails if -- the method is neither GET or POST. -- Keep it as a sanity check anyway. _ -> error $ show $ "Unexpected method: " `append` m -- smart constructor for Path
340
toMethod :: ByteString -> Method toMethod m = case m of "GET" -> Get "POST" -> Post -- "_" is impossible to reach as 'parseMethod' already fails if -- the method is neither GET or POST. -- Keep it as a sanity check anyway. _ -> error $ show $ "Unexpected method: " `append` m -- smart constructor for Path
340
toMethod m = case m of "GET" -> Get "POST" -> Post -- "_" is impossible to reach as 'parseMethod' already fails if -- the method is neither GET or POST. -- Keep it as a sanity check anyway. _ -> error $ show $ "Unexpected method: " `append` m -- smart constructor for Path
307
false
true
0
10
94
58
32
26
null
null
jship/metronome
local_deps/netwire/Control/Wire/Switch.hs
bsd-3-clause
drSwitch :: (Monad m) => Wire s e m a b -> Wire s e m (a, Event (Wire s e m a b)) b drSwitch w' = WGen $ \ds mx' -> let nw w | Right (_, Event w1) <- mx' = w1 | otherwise = w in liftM (second (drSwitch . nw)) (stepWire w' ds (fmap fst mx'))
289
drSwitch :: (Monad m) => Wire s e m a b -> Wire s e m (a, Event (Wire s e m a b)) b drSwitch w' = WGen $ \ds mx' -> let nw w | Right (_, Event w1) <- mx' = w1 | otherwise = w in liftM (second (drSwitch . nw)) (stepWire w' ds (fmap fst mx'))
289
drSwitch w' = WGen $ \ds mx' -> let nw w | Right (_, Event w1) <- mx' = w1 | otherwise = w in liftM (second (drSwitch . nw)) (stepWire w' ds (fmap fst mx'))
193
false
true
0
17
109
164
80
84
null
null
urbanslug/ghc
compiler/coreSyn/CoreSyn.hs
bsd-3-clause
-- | Takes a nested application expression and returns the the function -- being applied and the arguments to which it is applied collectAnnArgs :: AnnExpr b a -> (AnnExpr b a, [AnnExpr b a]) collectAnnArgs expr = go expr [] where go (_, AnnApp f a) as = go f (a:as) go e as = (e, as)
310
collectAnnArgs :: AnnExpr b a -> (AnnExpr b a, [AnnExpr b a]) collectAnnArgs expr = go expr [] where go (_, AnnApp f a) as = go f (a:as) go e as = (e, as)
180
collectAnnArgs expr = go expr [] where go (_, AnnApp f a) as = go f (a:as) go e as = (e, as)
118
true
true
2
10
83
114
54
60
null
null
ekohl/ganeti
htools/Ganeti/HTools/Instance.hs
gpl-2.0
-- * Initialization -- | Create an instance. -- -- Some parameters are not initialized by function, and must be set -- later (via 'setIdx' for example). create :: String -> Int -> Int -> Int -> String -> [String] -> Bool -> T.Ndx -> T.Ndx -> Instance create name_init mem_init dsk_init vcpus_init run_init tags_init auto_balance_init pn sn = Instance { name = name_init , alias = name_init , mem = mem_init , dsk = dsk_init , vcpus = vcpus_init , running = run_init `elem` runningStates , runSt = run_init , pNode = pn , sNode = sn , idx = -1 , util = T.baseUtil , tags = tags_init , movable = True , auto_balance = auto_balance_init }
836
create :: String -> Int -> Int -> Int -> String -> [String] -> Bool -> T.Ndx -> T.Ndx -> Instance create name_init mem_init dsk_init vcpus_init run_init tags_init auto_balance_init pn sn = Instance { name = name_init , alias = name_init , mem = mem_init , dsk = dsk_init , vcpus = vcpus_init , running = run_init `elem` runningStates , runSt = run_init , pNode = pn , sNode = sn , idx = -1 , util = T.baseUtil , tags = tags_init , movable = True , auto_balance = auto_balance_init }
682
create name_init mem_init dsk_init vcpus_init run_init tags_init auto_balance_init pn sn = Instance { name = name_init , alias = name_init , mem = mem_init , dsk = dsk_init , vcpus = vcpus_init , running = run_init `elem` runningStates , runSt = run_init , pNode = pn , sNode = sn , idx = -1 , util = T.baseUtil , tags = tags_init , movable = True , auto_balance = auto_balance_init }
577
true
true
0
14
319
174
105
69
null
null
mcschroeder/ghc
compiler/simplCore/SetLevels.hs
bsd-3-clause
isTopLvl :: Level -> Bool isTopLvl (Level 0 0) = True
53
isTopLvl :: Level -> Bool isTopLvl (Level 0 0) = True
53
isTopLvl (Level 0 0) = True
27
false
true
0
9
10
32
14
18
null
null
plow-technologies/hs-webdriver
src/Test/WebDriver/Common/Profile.hs
bsd-3-clause
-- |Delete a file from the profile directory. The first argument is the name of -- file within the profile directory. deleteFile :: FilePath -> Profile b -> Profile b deleteFile path prof = onProfileFiles prof $ HM.delete path
226
deleteFile :: FilePath -> Profile b -> Profile b deleteFile path prof = onProfileFiles prof $ HM.delete path
108
deleteFile path prof = onProfileFiles prof $ HM.delete path
59
true
true
0
7
38
44
21
23
null
null
jwiegley/ghc-release
libraries/binary/src/Data/Binary/Get/Internal.hs
gpl-3.0
-- | Replace the current chunk. put :: B.ByteString -> Get () put s = C $ \_inp ks -> ks s ()
93
put :: B.ByteString -> Get () put s = C $ \_inp ks -> ks s ()
61
put s = C $ \_inp ks -> ks s ()
31
true
true
0
8
22
44
22
22
null
null
ggreif/clash-compiler
testsuite/Test/Tasty/Program.hs
bsd-2-clause
runProgram :: String -- ^ Program name -> [String] -- ^ Program options -> Maybe FilePath -- ^ Optional working directory -> Bool -- ^ Whether to print stdout or stderr on success -> Bool -- ^ Whether a non-empty stdout means failure -> IO Result runProgram program args workingDir stdO stdF = do (_, stdoutH, stderrH, pid) <- runInteractiveProcess program args workingDir Nothing stderr <- hGetContents stderrH stdout <- hGetContents stdoutH ecode <- stdout `deepseq` stderr `deepseq` waitForProcess pid case ecode of ExitSuccess -> if stdF && not (null stdout) then return (exitFailure program 1 stderr stdout) else return (testPassed (if stdO then stdout else stderr)) ExitFailure code -> return $ exitFailure program code stderr stdout -- | Indicates that program does not exist in the path
969
runProgram :: String -- ^ Program name -> [String] -- ^ Program options -> Maybe FilePath -- ^ Optional working directory -> Bool -- ^ Whether to print stdout or stderr on success -> Bool -- ^ Whether a non-empty stdout means failure -> IO Result runProgram program args workingDir stdO stdF = do (_, stdoutH, stderrH, pid) <- runInteractiveProcess program args workingDir Nothing stderr <- hGetContents stderrH stdout <- hGetContents stdoutH ecode <- stdout `deepseq` stderr `deepseq` waitForProcess pid case ecode of ExitSuccess -> if stdF && not (null stdout) then return (exitFailure program 1 stderr stdout) else return (testPassed (if stdO then stdout else stderr)) ExitFailure code -> return $ exitFailure program code stderr stdout -- | Indicates that program does not exist in the path
969
runProgram program args workingDir stdO stdF = do (_, stdoutH, stderrH, pid) <- runInteractiveProcess program args workingDir Nothing stderr <- hGetContents stderrH stdout <- hGetContents stdoutH ecode <- stdout `deepseq` stderr `deepseq` waitForProcess pid case ecode of ExitSuccess -> if stdF && not (null stdout) then return (exitFailure program 1 stderr stdout) else return (testPassed (if stdO then stdout else stderr)) ExitFailure code -> return $ exitFailure program code stderr stdout -- | Indicates that program does not exist in the path
628
false
true
0
15
302
218
111
107
null
null
fmapfmapfmap/amazonka
amazonka-devicefarm/gen/Network/AWS/DeviceFarm/Types/Product.hs
mpl-2.0
-- | The pre-signed Amazon S3 URL that can be used with a corresponding GET -- request to download the sample\'s file. samUrl :: Lens' Sample (Maybe Text) samUrl = lens _samUrl (\ s a -> s{_samUrl = a})
202
samUrl :: Lens' Sample (Maybe Text) samUrl = lens _samUrl (\ s a -> s{_samUrl = a})
83
samUrl = lens _samUrl (\ s a -> s{_samUrl = a})
47
true
true
0
9
38
47
26
21
null
null
sleexyz/haskell-playground
app/Main.hs
bsd-3-clause
main = defaultErrorHandler defaultFatalMessager defaultFlushOut $ runGhc (Just libdir) $ do return ()
107
main = defaultErrorHandler defaultFatalMessager defaultFlushOut $ runGhc (Just libdir) $ do return ()
107
main = defaultErrorHandler defaultFatalMessager defaultFlushOut $ runGhc (Just libdir) $ do return ()
107
false
false
1
10
18
40
16
24
null
null
lenary/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
toAlist :: Ctxt a -> [(Name, a)] toAlist ctxt = let allns = map snd (Map.toList ctxt) in concatMap (Map.toList) allns
133
toAlist :: Ctxt a -> [(Name, a)] toAlist ctxt = let allns = map snd (Map.toList ctxt) in concatMap (Map.toList) allns
133
toAlist ctxt = let allns = map snd (Map.toList ctxt) in concatMap (Map.toList) allns
100
false
true
0
12
36
64
32
32
null
null
ezyang/ghc
libraries/base/GHC/IO/Handle/Text.hs
bsd-3-clause
hGetChar :: Handle -> IO Char hGetChar handle = wantReadableHandle_ "hGetChar" handle $ \handle_@Handle__{..} -> do -- buffering mode makes no difference: we just read whatever is available -- from the device (blocking only if there is nothing available), and then -- return the first character. -- See [note Buffered Reading] in GHC.IO.Handle.Types buf0 <- readIORef haCharBuffer buf1 <- if isEmptyBuffer buf0 then readTextDevice handle_ buf0 else return buf0 (c1,i) <- readCharBuf (bufRaw buf1) (bufL buf1) let buf2 = bufferAdjustL i buf1 if haInputNL == CRLF && c1 == '\r' then do mbuf3 <- if isEmptyBuffer buf2 then maybeFillReadBuffer handle_ buf2 else return (Just buf2) case mbuf3 of -- EOF, so just return the '\r' we have Nothing -> do writeIORef haCharBuffer buf2 return '\r' Just buf3 -> do (c2,i2) <- readCharBuf (bufRaw buf2) (bufL buf2) if c2 == '\n' then do writeIORef haCharBuffer (bufferAdjustL i2 buf3) return '\n' else do -- not a \r\n sequence, so just return the \r writeIORef haCharBuffer buf3 return '\r' else do writeIORef haCharBuffer buf2 return c1 -- --------------------------------------------------------------------------- -- hGetLine -- | Computation 'hGetLine' @hdl@ reads a line from the file or -- channel managed by @hdl@. -- -- This operation may fail with: -- -- * 'isEOFError' if the end of file is encountered when reading -- the /first/ character of the line. -- -- If 'hGetLine' encounters end-of-file at any other point while reading -- in a line, it is treated as a line terminator and the (partial) -- line is returned.
1,997
hGetChar :: Handle -> IO Char hGetChar handle = wantReadableHandle_ "hGetChar" handle $ \handle_@Handle__{..} -> do -- buffering mode makes no difference: we just read whatever is available -- from the device (blocking only if there is nothing available), and then -- return the first character. -- See [note Buffered Reading] in GHC.IO.Handle.Types buf0 <- readIORef haCharBuffer buf1 <- if isEmptyBuffer buf0 then readTextDevice handle_ buf0 else return buf0 (c1,i) <- readCharBuf (bufRaw buf1) (bufL buf1) let buf2 = bufferAdjustL i buf1 if haInputNL == CRLF && c1 == '\r' then do mbuf3 <- if isEmptyBuffer buf2 then maybeFillReadBuffer handle_ buf2 else return (Just buf2) case mbuf3 of -- EOF, so just return the '\r' we have Nothing -> do writeIORef haCharBuffer buf2 return '\r' Just buf3 -> do (c2,i2) <- readCharBuf (bufRaw buf2) (bufL buf2) if c2 == '\n' then do writeIORef haCharBuffer (bufferAdjustL i2 buf3) return '\n' else do -- not a \r\n sequence, so just return the \r writeIORef haCharBuffer buf3 return '\r' else do writeIORef haCharBuffer buf2 return c1 -- --------------------------------------------------------------------------- -- hGetLine -- | Computation 'hGetLine' @hdl@ reads a line from the file or -- channel managed by @hdl@. -- -- This operation may fail with: -- -- * 'isEOFError' if the end of file is encountered when reading -- the /first/ character of the line. -- -- If 'hGetLine' encounters end-of-file at any other point while reading -- in a line, it is treated as a line terminator and the (partial) -- line is returned.
1,997
hGetChar handle = wantReadableHandle_ "hGetChar" handle $ \handle_@Handle__{..} -> do -- buffering mode makes no difference: we just read whatever is available -- from the device (blocking only if there is nothing available), and then -- return the first character. -- See [note Buffered Reading] in GHC.IO.Handle.Types buf0 <- readIORef haCharBuffer buf1 <- if isEmptyBuffer buf0 then readTextDevice handle_ buf0 else return buf0 (c1,i) <- readCharBuf (bufRaw buf1) (bufL buf1) let buf2 = bufferAdjustL i buf1 if haInputNL == CRLF && c1 == '\r' then do mbuf3 <- if isEmptyBuffer buf2 then maybeFillReadBuffer handle_ buf2 else return (Just buf2) case mbuf3 of -- EOF, so just return the '\r' we have Nothing -> do writeIORef haCharBuffer buf2 return '\r' Just buf3 -> do (c2,i2) <- readCharBuf (bufRaw buf2) (bufL buf2) if c2 == '\n' then do writeIORef haCharBuffer (bufferAdjustL i2 buf3) return '\n' else do -- not a \r\n sequence, so just return the \r writeIORef haCharBuffer buf3 return '\r' else do writeIORef haCharBuffer buf2 return c1 -- --------------------------------------------------------------------------- -- hGetLine -- | Computation 'hGetLine' @hdl@ reads a line from the file or -- channel managed by @hdl@. -- -- This operation may fail with: -- -- * 'isEOFError' if the end of file is encountered when reading -- the /first/ character of the line. -- -- If 'hGetLine' encounters end-of-file at any other point while reading -- in a line, it is treated as a line terminator and the (partial) -- line is returned.
1,967
false
true
0
22
683
334
163
171
null
null
kojiromike/Idris-dev
src/Idris/Imports.hs
bsd-3-clause
findIBC :: [FilePath] -> FilePath -> FilePath -> Idris (Maybe FilePath) findIBC [] _ fp = return Nothing
104
findIBC :: [FilePath] -> FilePath -> FilePath -> Idris (Maybe FilePath) findIBC [] _ fp = return Nothing
104
findIBC [] _ fp = return Nothing
32
false
true
0
11
17
52
24
28
null
null
abau/co4
src/CO4/Util.hs
gpl-3.0
eApp' :: Expression -> Expression -> Expression eApp' a b = EApp a [b]
70
eApp' :: Expression -> Expression -> Expression eApp' a b = EApp a [b]
70
eApp' a b = EApp a [b]
22
false
true
0
8
13
37
17
20
null
null
FranklinChen/hugs98-plus-Sep2006
packages/OpenAL/Sound/OpenAL/Constants.hs
bsd-3-clause
al_VERSION, al_RENDERER, al_VENDOR, al_EXTENSIONS :: ALenum al_VERSION = CONST_AL_VERSION
114
al_VERSION, al_RENDERER, al_VENDOR, al_EXTENSIONS :: ALenum al_VERSION = CONST_AL_VERSION
114
al_VERSION = CONST_AL_VERSION
54
false
true
0
4
33
17
12
5
null
null
ancientlanguage/haskell-analysis
grammar/src/Grammar/Common/Decompose.hs
mit
decomposeChar '\x2F906' = "\x23D1E"
35
decomposeChar '\x2F906' = "\x23D1E"
35
decomposeChar '\x2F906' = "\x23D1E"
35
false
false
0
5
3
9
4
5
null
null
WSCU/JSEuterpea
Euterpea Examples/SimpleEuterpea.hs
gpl-3.0
ighAgogo = simplePerc E.HighAgogo
34
highAgogo = simplePerc E.HighAgogo
34
highAgogo = simplePerc E.HighAgogo
34
false
false
0
6
4
11
5
6
null
null
ArnoVanLumig/chesshs
ChessTest.hs
bsd-3-clause
queenallowed = ["d5a2", "d5b3", "d5c4", "d5e6", "d5f7", "d5g8", "d5h1", "d5g2", "d5f3", "d5e4", "d5c6", "d5b7", "d5a8", "d5d1", "d5d2", "d5d3", "d5d4", "d5d6", "d5d7", "d5d8", "d5a5", "d5b5", "d5c5", "d5e5", "d5f5", "d5g5", "d5h5"]
231
queenallowed = ["d5a2", "d5b3", "d5c4", "d5e6", "d5f7", "d5g8", "d5h1", "d5g2", "d5f3", "d5e4", "d5c6", "d5b7", "d5a8", "d5d1", "d5d2", "d5d3", "d5d4", "d5d6", "d5d7", "d5d8", "d5a5", "d5b5", "d5c5", "d5e5", "d5f5", "d5g5", "d5h5"]
231
queenallowed = ["d5a2", "d5b3", "d5c4", "d5e6", "d5f7", "d5g8", "d5h1", "d5g2", "d5f3", "d5e4", "d5c6", "d5b7", "d5a8", "d5d1", "d5d2", "d5d3", "d5d4", "d5d6", "d5d7", "d5d8", "d5a5", "d5b5", "d5c5", "d5e5", "d5f5", "d5g5", "d5h5"]
231
false
false
0
5
28
87
57
30
null
null
rahulmutt/ghcvm
libraries/eta-meta/Language/Eta/Meta/Lib.hs
bsd-3-clause
closedTypeFamilyKindD :: Name -> [TyVarBndr] -> Kind -> [TySynEqnQ] -> DecQ closedTypeFamilyKindD tc tvs kind eqns = do eqns1 <- sequence eqns return (ClosedTypeFamilyD (TypeFamilyHead tc tvs (KindSig kind) Nothing) eqns1)
239
closedTypeFamilyKindD :: Name -> [TyVarBndr] -> Kind -> [TySynEqnQ] -> DecQ closedTypeFamilyKindD tc tvs kind eqns = do eqns1 <- sequence eqns return (ClosedTypeFamilyD (TypeFamilyHead tc tvs (KindSig kind) Nothing) eqns1)
239
closedTypeFamilyKindD tc tvs kind eqns = do eqns1 <- sequence eqns return (ClosedTypeFamilyD (TypeFamilyHead tc tvs (KindSig kind) Nothing) eqns1)
163
false
true
0
13
47
84
41
43
null
null
iand675/digital-ocean
src/DigitalOcean.hs
mit
enableDropletBackups :: DropletId -> DigitalOcean (Response Event) enableDropletBackups dropletId = do credentials <- creds get [uri| /droplets/{dropletId}/enable_backups{?credentials*} |] ---- /droplets/{dropletId}/disable_backups
236
enableDropletBackups :: DropletId -> DigitalOcean (Response Event) enableDropletBackups dropletId = do credentials <- creds get [uri| /droplets/{dropletId}/enable_backups{?credentials*} |] ---- /droplets/{dropletId}/disable_backups
236
enableDropletBackups dropletId = do credentials <- creds get [uri| /droplets/{dropletId}/enable_backups{?credentials*} |] ---- /droplets/{dropletId}/disable_backups
169
false
true
0
8
24
45
23
22
null
null
josercruz01/hsoptions
tests/unit/System/Console/HsOptionsTest.hs
apache-2.0
testFlagWithNoNameError :: UnitTest testFlagWithNoNameError = "Two dashes with no name should be considered an argument" `unitTest` do let flagData = makeFlagData [f2d userId] pr <- process flagData "--user_id 123 --" assertFlagValueEquals pr userId 123 assertArgsEquals pr ["--"]
297
testFlagWithNoNameError :: UnitTest testFlagWithNoNameError = "Two dashes with no name should be considered an argument" `unitTest` do let flagData = makeFlagData [f2d userId] pr <- process flagData "--user_id 123 --" assertFlagValueEquals pr userId 123 assertArgsEquals pr ["--"]
297
testFlagWithNoNameError = "Two dashes with no name should be considered an argument" `unitTest` do let flagData = makeFlagData [f2d userId] pr <- process flagData "--user_id 123 --" assertFlagValueEquals pr userId 123 assertArgsEquals pr ["--"]
261
false
true
0
14
53
75
33
42
null
null
glutamate/cvutils
Track.hs
bsd-3-clause
putS s = lift . putStrLn $ s
29
putS s = lift . putStrLn $ s
29
putS s = lift . putStrLn $ s
29
false
false
0
6
8
17
8
9
null
null
biegunka/biegunka
src/Control/Biegunka/Primitive.hs
mit
-- | Execute scripts sequentially -- Connects two scripts which forces them to run sequentially one after another. prerequisiteOf :: Script 'Sources a -> Script 'Sources b -> Script 'Sources b prerequisiteOf a b = do s <- Script peekToken a t <- Script peekToken script (TWait (Set.fromList [s .. pred t]) ()) b
322
prerequisiteOf :: Script 'Sources a -> Script 'Sources b -> Script 'Sources b prerequisiteOf a b = do s <- Script peekToken a t <- Script peekToken script (TWait (Set.fromList [s .. pred t]) ()) b
207
prerequisiteOf a b = do s <- Script peekToken a t <- Script peekToken script (TWait (Set.fromList [s .. pred t]) ()) b
129
true
true
0
13
64
106
49
57
null
null
Ricikle/Rubik
Cube.hs
gpl-3.0
d' = move [[5,8,7,6]] [[5,8,7,6]] zero8 zero12
46
d' = move [[5,8,7,6]] [[5,8,7,6]] zero8 zero12
46
d' = move [[5,8,7,6]] [[5,8,7,6]] zero8 zero12
46
false
false
1
7
6
49
27
22
null
null
dcjohnson/Project-Euler
220/interpolate_execute.hs
mit
getX :: Position -> Int getX (Position x _ _) = x
49
getX :: Position -> Int getX (Position x _ _) = x
49
getX (Position x _ _) = x
25
false
true
0
9
11
34
15
19
null
null
DanielWaterworth/Idris-dev
src/IRTS/CodegenLLVM.hs
bsd-3-clause
ftyToTy FAny = valueType
24
ftyToTy FAny = valueType
24
ftyToTy FAny = valueType
24
false
false
0
5
3
9
4
5
null
null
mulchy/practice
src/Lecture/Hailstone.hs
mit
hailstone :: Integer -> Integer hailstone n | n `mod` 2 == 0 = n `div` 2 | otherwise = 3 * n + 1
105
hailstone :: Integer -> Integer hailstone n | n `mod` 2 == 0 = n `div` 2 | otherwise = 3 * n + 1
105
hailstone n | n `mod` 2 == 0 = n `div` 2 | otherwise = 3 * n + 1
73
false
true
1
9
33
56
29
27
null
null
ekmett/wl-pprint-extras
src/Text/PrettyPrint/Free/Internal.hs
bsd-2-clause
-- | @flatAlt@ creates a document that changes when flattened; normally -- it is rendered as the first argument, but when flattened is rendered -- as the second. flatAlt :: Doc a e -> Doc a e -> Doc a e flatAlt = FlatAlt
220
flatAlt :: Doc a e -> Doc a e -> Doc a e flatAlt = FlatAlt
58
flatAlt = FlatAlt
17
true
true
0
7
43
37
19
18
null
null
IreneKnapp/Faction
faction/Distribution/Client/Tar.hs
bsd-3-clause
-- | A tar 'Entry' for a directory. -- -- Entry fields such as file permissions and ownership have default values. -- directoryEntry :: TarPath -> Entry directoryEntry name = simpleEntry name Directory
201
directoryEntry :: TarPath -> Entry directoryEntry name = simpleEntry name Directory
83
directoryEntry name = simpleEntry name Directory
48
true
true
0
5
32
27
15
12
null
null
kawu/nerf-proto
src/NLP/Nerf2/Env.hs
bsd-2-clause
-- | A set of binary rules with the given left symbol. perLeft :: InMain e => e -> Either N T -> [C.Binary] perLeft = C.perLeft . cfg . mainEnv
143
perLeft :: InMain e => e -> Either N T -> [C.Binary] perLeft = C.perLeft . cfg . mainEnv
88
perLeft = C.perLeft . cfg . mainEnv
35
true
true
2
11
30
56
25
31
null
null
np/lens
src/Control/Lens/IndexedTraversal.hs
bsd-3-clause
-- | -- Traverse with an index (and the arguments flipped) -- -- @ -- 'Control.Lens.Traversal.forOf' l a ≡ 'iforOf' l a '.' 'const' -- 'iforOf' ≡ 'flip' . 'itraverseOf' -- @ -- -- @ -- 'iforOf' :: 'Control.Lens.IndexedLens.IndexedLens' i s t a b -> s -> (i -> a -> f b) -> f t -- 'iforOf' :: 'IndexedTraversal' i s t a b -> s -> (i -> a -> f b) -> f t -- @ iforOf :: (Indexed i a (f b) -> s -> f t) -> s -> (i -> a -> f b) -> f t iforOf = flip . withIndex
460
iforOf :: (Indexed i a (f b) -> s -> f t) -> s -> (i -> a -> f b) -> f t iforOf = flip . withIndex
98
iforOf = flip . withIndex
25
true
true
1
12
112
90
48
42
null
null
rueshyna/gogol
gogol-games/gen/Network/Google/Games/Types/Product.hs
mpl-2.0
-- | Uniquely identifies the type of this resource. Value is always the fixed -- string games#imageAsset. iaKind :: Lens' ImageAsset Text iaKind = lens _iaKind (\ s a -> s{_iaKind = a})
185
iaKind :: Lens' ImageAsset Text iaKind = lens _iaKind (\ s a -> s{_iaKind = a})
79
iaKind = lens _iaKind (\ s a -> s{_iaKind = a})
47
true
true
0
9
32
41
23
18
null
null
felixsch/moonbase-ng
src/Moonbase/Panel/Items/Clock.hs
lgpl-2.1
clock :: String -> PanelItems clock fmt = item $ do label <- liftIO $ createClockWidget fmt 1 Nothing return $ PanelItem "date" (Gtk.toWidget label) Gtk.PackNatural
180
clock :: String -> PanelItems clock fmt = item $ do label <- liftIO $ createClockWidget fmt 1 Nothing return $ PanelItem "date" (Gtk.toWidget label) Gtk.PackNatural
180
clock fmt = item $ do label <- liftIO $ createClockWidget fmt 1 Nothing return $ PanelItem "date" (Gtk.toWidget label) Gtk.PackNatural
150
false
true
0
12
41
64
30
34
null
null
amar47shah/NICTA-TicTacToe
test/Spec.hs
mit
coord :: QC.Gen Coordinate coord = QC.choose (lower, upper)
59
coord :: QC.Gen Coordinate coord = QC.choose (lower, upper)
59
coord = QC.choose (lower, upper)
32
false
true
0
6
8
27
14
13
null
null
dcreager/cabal
Distribution/Simple/Command.hs
bsd-3-clause
getCurrentChoice :: OptDescr a -> a -> [String] getCurrentChoice (ChoiceOpt alts) a = [ lf | (_,(_sf,lf:_), _, currentChoice) <- alts, currentChoice a]
155
getCurrentChoice :: OptDescr a -> a -> [String] getCurrentChoice (ChoiceOpt alts) a = [ lf | (_,(_sf,lf:_), _, currentChoice) <- alts, currentChoice a]
155
getCurrentChoice (ChoiceOpt alts) a = [ lf | (_,(_sf,lf:_), _, currentChoice) <- alts, currentChoice a]
107
false
true
0
10
26
76
41
35
null
null
vituscze/logic
src/Logic/PrenexTree.hs
bsd-3-clause
-- | Flattens a 'PrenexTree' into a list in preorder fashion. Swaps all -- quantifiers according to the 'Bool' flags. flatten :: PrenexTree a -> [Type a] flatten p = go False p [] where go _ Nil = id go q (Node b qs l r) = goL b' qs . go b' l . go b' r where b' = b /= q goL s = flip (foldr ((:) . swapWhen s))
357
flatten :: PrenexTree a -> [Type a] flatten p = go False p [] where go _ Nil = id go q (Node b qs l r) = goL b' qs . go b' l . go b' r where b' = b /= q goL s = flip (foldr ((:) . swapWhen s))
237
flatten p = go False p [] where go _ Nil = id go q (Node b qs l r) = goL b' qs . go b' l . go b' r where b' = b /= q goL s = flip (foldr ((:) . swapWhen s))
201
true
true
4
10
120
151
69
82
null
null
Philonous/hexpat-internals
Text/XML/Expat/Internal/IO.hs
bsd-3-clause
setStartCDataHandler :: Parser -> StartCDataHandler -> IO () setStartCDataHandler parser handler = do let startCData = _startCDataHandler parser writeIORef startCData $ wrapStartCDataHandler parser handler
213
setStartCDataHandler :: Parser -> StartCDataHandler -> IO () setStartCDataHandler parser handler = do let startCData = _startCDataHandler parser writeIORef startCData $ wrapStartCDataHandler parser handler
213
setStartCDataHandler parser handler = do let startCData = _startCDataHandler parser writeIORef startCData $ wrapStartCDataHandler parser handler
152
false
true
0
10
31
56
25
31
null
null
hvr/jhc
src/GenUtil.hs
mit
chunkText :: Int -> String -> String chunkText mw s = concatMap (unlines . chunk mw) $ lines s
94
chunkText :: Int -> String -> String chunkText mw s = concatMap (unlines . chunk mw) $ lines s
94
chunkText mw s = concatMap (unlines . chunk mw) $ lines s
57
false
true
0
9
18
44
21
23
null
null
tannerb/99-problems-haskell
app/Problems.hs
bsd-3-clause
-- | problem 16. drop every n'th element dropEvery :: Int -> [a] -> [a] dropEvery n [] = []
91
dropEvery :: Int -> [a] -> [a] dropEvery n [] = []
50
dropEvery n [] = []
19
true
true
0
9
19
41
20
21
null
null
y-kamiya/ai-samples
app/AttackHtn.hs
bsd-3-clause
buildDomainPrimitive task@MoveToTarget = (task, [(pre, post)]) where pre = [AtTarget False] post = [AtTarget True]
125
buildDomainPrimitive task@MoveToTarget = (task, [(pre, post)]) where pre = [AtTarget False] post = [AtTarget True]
125
buildDomainPrimitive task@MoveToTarget = (task, [(pre, post)]) where pre = [AtTarget False] post = [AtTarget True]
125
false
false
1
7
25
54
29
25
null
null
lamdu/lamdu
src/Lamdu/GUI/VersionControl.hs
gpl-3.0
branchTextEditId :: Branch t -> Widget.Id branchTextEditId = (`Widget.joinId` ["textedit"]) . branchDelegatorId
111
branchTextEditId :: Branch t -> Widget.Id branchTextEditId = (`Widget.joinId` ["textedit"]) . branchDelegatorId
111
branchTextEditId = (`Widget.joinId` ["textedit"]) . branchDelegatorId
69
false
true
0
8
11
42
21
21
null
null
mpickering/ghc-exactprint
tests/examples/ghc8/Associated.hs
bsd-3-clause
qux NoA = 0
11
qux NoA = 0
11
qux NoA = 0
11
false
false
1
5
3
13
4
9
null
null
tgdavies/codeworld
codeworld-api/src/CodeWorld/Picture.hs
apache-2.0
-- | A picture drawn translated in these directions. translated :: HasCallStack => Double -> Double -> Picture -> Picture translated = Translate callStack
154
translated :: HasCallStack => Double -> Double -> Picture -> Picture translated = Translate callStack
101
translated = Translate callStack
32
true
true
0
10
23
38
17
21
null
null
bhamrick/htwitch
Twitch/APIRequests.hs
mit
getTeam team = baseAPIRequest { path = "/teams/" ++ (B.urlEncode team) , method = "GET" }
95
getTeam team = baseAPIRequest { path = "/teams/" ++ (B.urlEncode team) , method = "GET" }
95
getTeam team = baseAPIRequest { path = "/teams/" ++ (B.urlEncode team) , method = "GET" }
95
false
false
0
11
21
39
20
19
null
null
input-output-hk/pos-haskell-prototype
util/src/Pos/Util/Wlog/Compatibility.hs
mit
usingNamedPureLogger :: Functor m => LoggerName -> NamedPureLogger m a -> m (a, [LogEvent]) usingNamedPureLogger name (NamedPureLogger action) = usingLoggerName name $ runPureLog action
252
usingNamedPureLogger :: Functor m => LoggerName -> NamedPureLogger m a -> m (a, [LogEvent]) usingNamedPureLogger name (NamedPureLogger action) = usingLoggerName name $ runPureLog action
252
usingNamedPureLogger name (NamedPureLogger action) = usingLoggerName name $ runPureLog action
97
false
true
0
10
90
64
31
33
null
null
uroboros/haskell_design_patterns
chapter3/1_functor.hs
mit
main1 = print (f 42)
20
main1 = print (f 42)
20
main1 = print (f 42)
20
false
false
0
7
4
15
7
8
null
null
mudphone/HaskellBook
hangman/src/Main.hs
mit
gameWords :: IO WordList gameWords = do (WordList aw) <- allWords return $ WordList (filter gameLength aw) where gameLength w = let l = length (w :: String) in l > minWordLength && l < maxWordLength
224
gameWords :: IO WordList gameWords = do (WordList aw) <- allWords return $ WordList (filter gameLength aw) where gameLength w = let l = length (w :: String) in l > minWordLength && l < maxWordLength
224
gameWords = do (WordList aw) <- allWords return $ WordList (filter gameLength aw) where gameLength w = let l = length (w :: String) in l > minWordLength && l < maxWordLength
199
false
true
3
10
61
98
43
55
null
null
seereason/HJScript
src/HJScript/DOM/Node.hs
bsd-3-clause
ownerDocument :: IsNode n => Exp n -> Exp Document ownerDocument = deref "ownerDocument"
89
ownerDocument :: IsNode n => Exp n -> Exp Document ownerDocument = deref "ownerDocument"
89
ownerDocument = deref "ownerDocument"
37
false
true
0
7
14
31
14
17
null
null
ucam-cl-dtg/naps-camfort
Extensions/UnitsEnvironment.hs
mit
efmap :: (a -> a) -> Consistency a -> Consistency a efmap f (Ok x) = Ok (f x)
82
efmap :: (a -> a) -> Consistency a -> Consistency a efmap f (Ok x) = Ok (f x)
82
efmap f (Ok x) = Ok (f x)
30
false
true
0
7
23
52
25
27
null
null
Motions/motions
src/Bio/Motions/Format/Handle.hs
apache-2.0
withBinaryInput :: InputSettings -> (BinaryBackend -> [String] -> [String] -> IO a) -> IO a withBinaryInput s f = bracket open closeBackend (\backend -> f backend (getChainNames' backend) (binderTN backend)) where open = openBinaryInput s getChainNames' = fromMaybe (error "error getting chain names") . getChainNames . header binderTN = getBinderTypesNames . header -- | Seek `i` frames from the beginning and return the Dump at this position. `i` must be divisible by fpkf.
490
withBinaryInput :: InputSettings -> (BinaryBackend -> [String] -> [String] -> IO a) -> IO a withBinaryInput s f = bracket open closeBackend (\backend -> f backend (getChainNames' backend) (binderTN backend)) where open = openBinaryInput s getChainNames' = fromMaybe (error "error getting chain names") . getChainNames . header binderTN = getBinderTypesNames . header -- | Seek `i` frames from the beginning and return the Dump at this position. `i` must be divisible by fpkf.
490
withBinaryInput s f = bracket open closeBackend (\backend -> f backend (getChainNames' backend) (binderTN backend)) where open = openBinaryInput s getChainNames' = fromMaybe (error "error getting chain names") . getChainNames . header binderTN = getBinderTypesNames . header -- | Seek `i` frames from the beginning and return the Dump at this position. `i` must be divisible by fpkf.
398
false
true
1
11
87
132
65
67
null
null
johnjcamilleri/maltese-functional-morphology
malti/AttrMt.hs
lgpl-3.0
atWP :: Attr atWP = 2
21
atWP :: Attr atWP = 2
21
atWP = 2
8
false
true
0
4
5
11
6
5
null
null
jsnajder/dsem
src/conll2counts-hadoop.hs
bsd-3-clause
mrReduce :: IO () mrReduce = do xs <- getContents putStr . showCounts . C.fromList . map B.fromString $ lines xs
116
mrReduce :: IO () mrReduce = do xs <- getContents putStr . showCounts . C.fromList . map B.fromString $ lines xs
116
mrReduce = do xs <- getContents putStr . showCounts . C.fromList . map B.fromString $ lines xs
98
false
true
0
10
24
52
24
28
null
null
nomeata/ghc
compiler/llvmGen/Llvm/Types.hs
bsd-3-clause
getPlainName (LMLocalVar x LMLabel ) = show x
47
getPlainName (LMLocalVar x LMLabel ) = show x
47
getPlainName (LMLocalVar x LMLabel ) = show x
47
false
false
0
7
9
20
9
11
null
null
gltronred/haskell-collage
src/ConverterTo64Colour.hs
gpl-3.0
rounding :: Int -> Int rounding num | num < 43 = 0 | num >=43 && num < 128 = 85 | num >=128 && num < 213 = 170 | num >=213 = 255
131
rounding :: Int -> Int rounding num | num < 43 = 0 | num >=43 && num < 128 = 85 | num >=128 && num < 213 = 170 | num >=213 = 255
131
rounding num | num < 43 = 0 | num >=43 && num < 128 = 85 | num >=128 && num < 213 = 170 | num >=213 = 255
108
false
true
0
10
38
95
43
52
null
null
spechub/Hets
LF/Sign.hs
gpl-2.0
-- constructs the signature cogenerated by the specified symbol set coGenSig :: Set.Set Symbol -> Sign -> Result Sign coGenSig syms sig = do let syms' = exclSyms syms sig let defs' = filter (\ d -> Set.notMember (getSym d) syms') $ getDefs sig return $ Sign gen_base gen_module defs'
289
coGenSig :: Set.Set Symbol -> Sign -> Result Sign coGenSig syms sig = do let syms' = exclSyms syms sig let defs' = filter (\ d -> Set.notMember (getSym d) syms') $ getDefs sig return $ Sign gen_base gen_module defs'
221
coGenSig syms sig = do let syms' = exclSyms syms sig let defs' = filter (\ d -> Set.notMember (getSym d) syms') $ getDefs sig return $ Sign gen_base gen_module defs'
171
true
true
1
12
55
97
47
50
null
null
mnacamura/learning-hmm
src/Data/Random/Distribution/Simplex.hs
mit
-- | An algorithm proposed by Rubinstein & Melamed (1998). -- See, /e.g./, S. Onn, I. Weissman. -- Generating uniform random vectors over a simplex with implications to -- the volume of a certain polytope and to multivariate extremes. -- /Ann Oper Res/ (2011) __189__:331-342. fractionalStdSimplex :: (Ord a, Fractional a, Distribution StdUniform a) => Int -> RVar [a] fractionalStdSimplex k = do us <- replicateM k stdUniform let us' = sort us ++ [1] return $ zipWith (-) us' (0 : us')
550
fractionalStdSimplex :: (Ord a, Fractional a, Distribution StdUniform a) => Int -> RVar [a] fractionalStdSimplex k = do us <- replicateM k stdUniform let us' = sort us ++ [1] return $ zipWith (-) us' (0 : us')
265
fractionalStdSimplex k = do us <- replicateM k stdUniform let us' = sort us ++ [1] return $ zipWith (-) us' (0 : us')
173
true
true
0
12
146
111
56
55
null
null
rlpowell/hblog
lib/HBlog/HBlog.hs
mit
-- | See the Tags & Categories section of DESIGN-CODE. myGetTags :: MonadMetadata m => Identifier -> m [String] myGetTags identifier = do tags <- getTags identifier let maintags = map (intercalate "+") $ drop 1 $ subsequences $ sort tags cat <- myGetCategory identifier return $ map (\x -> (head cat) ++ ":" ++ x) maintags
338
myGetTags :: MonadMetadata m => Identifier -> m [String] myGetTags identifier = do tags <- getTags identifier let maintags = map (intercalate "+") $ drop 1 $ subsequences $ sort tags cat <- myGetCategory identifier return $ map (\x -> (head cat) ++ ":" ++ x) maintags
283
myGetTags identifier = do tags <- getTags identifier let maintags = map (intercalate "+") $ drop 1 $ subsequences $ sort tags cat <- myGetCategory identifier return $ map (\x -> (head cat) ++ ":" ++ x) maintags
226
true
true
0
15
72
122
57
65
null
null
ribag/ganeti-experiments
src/Ganeti/Utils.hs
gpl-2.0
watchFile :: Eq a => FilePath -> Int -> a -> IO a -> IO a watchFile fpath timeout old = watchFileBy fpath timeout (/= old)
122
watchFile :: Eq a => FilePath -> Int -> a -> IO a -> IO a watchFile fpath timeout old = watchFileBy fpath timeout (/= old)
122
watchFile fpath timeout old = watchFileBy fpath timeout (/= old)
64
false
true
0
11
25
62
29
33
null
null
achirkin/qua-kit
apps/hs/qua-server/src/Foundation.hs
mit
appDomainName :: Handler Text appDomainName = do app <- getYesod req <- waiRequest let domainStr = getApprootText guessApproot app req (pref, ds) = Text.breakOn "//" domainStr dsClean = if Text.length ds >= 2 then Text.drop 2 ds else pref return . fst $ Text.breakOn "/" dsClean
330
appDomainName :: Handler Text appDomainName = do app <- getYesod req <- waiRequest let domainStr = getApprootText guessApproot app req (pref, ds) = Text.breakOn "//" domainStr dsClean = if Text.length ds >= 2 then Text.drop 2 ds else pref return . fst $ Text.breakOn "/" dsClean
330
appDomainName = do app <- getYesod req <- waiRequest let domainStr = getApprootText guessApproot app req (pref, ds) = Text.breakOn "//" domainStr dsClean = if Text.length ds >= 2 then Text.drop 2 ds else pref return . fst $ Text.breakOn "/" dsClean
300
false
true
0
13
97
110
53
57
null
null
lukasepple/spacecookie
src/Network/Gopher/Util/Gophermap.hs
gpl-3.0
if' False _ b = b
17
if' False _ b = b
17
if' False _ b = b
17
false
false
0
5
5
15
6
9
null
null
Kludgy/tar-fork
htar/htar.hs
bsd-3-clause
decompress BZip = BZip.decompress
33
decompress BZip = BZip.decompress
33
decompress BZip = BZip.decompress
33
false
false
0
5
3
11
5
6
null
null
sinelaw/lamdu
Lamdu/GUI/ExpressionEdit/Parens.hs
gpl-3.0
addTextParensI :: MonadA m => (WidgetMaker m -> WidgetMaker m) -> (WidgetMaker m -> WidgetMaker m) -> Anim.AnimId -> ExpressionGui m -> ExprGuiM m (ExpressionGui m) addTextParensI onLParen onRParen parenId widget = do beforeParen <- onLParen $ label "(" afterParen <- onRParen $ label ")" return $ ExpressionGui.hbox [ ExpressionGui.fromValueWidget beforeParen , widget , ExpressionGui.fromValueWidget afterParen ] where label str = ExprGuiM.widgetEnv . BWidgets.makeLabel str $ parensPrefix parenId
545
addTextParensI :: MonadA m => (WidgetMaker m -> WidgetMaker m) -> (WidgetMaker m -> WidgetMaker m) -> Anim.AnimId -> ExpressionGui m -> ExprGuiM m (ExpressionGui m) addTextParensI onLParen onRParen parenId widget = do beforeParen <- onLParen $ label "(" afterParen <- onRParen $ label ")" return $ ExpressionGui.hbox [ ExpressionGui.fromValueWidget beforeParen , widget , ExpressionGui.fromValueWidget afterParen ] where label str = ExprGuiM.widgetEnv . BWidgets.makeLabel str $ parensPrefix parenId
545
addTextParensI onLParen onRParen parenId widget = do beforeParen <- onLParen $ label "(" afterParen <- onRParen $ label ")" return $ ExpressionGui.hbox [ ExpressionGui.fromValueWidget beforeParen , widget , ExpressionGui.fromValueWidget afterParen ] where label str = ExprGuiM.widgetEnv . BWidgets.makeLabel str $ parensPrefix parenId
368
false
true
1
13
113
180
81
99
null
null
spell-music/data-fix-cse
test/Exp.hs
bsd-3-clause
expAsInt :: Exp Int -> Int expAsInt x = case x of Var str -> error "boom" Const n -> n Add a b -> a + b
128
expAsInt :: Exp Int -> Int expAsInt x = case x of Var str -> error "boom" Const n -> n Add a b -> a + b
128
expAsInt x = case x of Var str -> error "boom" Const n -> n Add a b -> a + b
101
false
true
0
8
52
61
28
33
null
null
aelve/json-x
tests/DataFamilies/Encoders.hs
bsd-3-clause
thNullaryParseJsonString, gNullaryParseJsonString :: Parser Json (Nullary Int) thNullaryParseJsonString = $(mkParseJson defaultOptions 'C3)
139
thNullaryParseJsonString, gNullaryParseJsonString :: Parser Json (Nullary Int) thNullaryParseJsonString = $(mkParseJson defaultOptions 'C3)
139
thNullaryParseJsonString = $(mkParseJson defaultOptions 'C3)
60
false
true
0
7
11
34
18
16
null
null
tomahawkins/atom
Language/Atom/Language.hs
bsd-3-clause
-- | External float variable declaration. float' :: Name -> V Float float' name = var' name Float
97
float' :: Name -> V Float float' name = var' name Float
55
float' name = var' name Float
29
true
true
0
6
17
27
13
14
null
null
nkarag/haskell-CSVDB
src/Data/RTable/Julius.hs
bsd-3-clause
-- (EtlR $ (Join (TabL myTable4) Previous $ JoinOn myJoinPred3) -- :. (Join (TabL myTable3) Previous $ JoinOn myJoinPred2) -- :. (Join (TabL myTable) (Tab myTable2) $ JoinOn myJoinPred) -- :. ROpStart -- ) -- Union => SELECT * FROM myTable UNION SELECT * FROM myTable2 myEtlExpr10 = EtlMapStart :-> (EtlR $ ROpStart :. (Union (TabL myTable) (Tab myTable2)))
519
myEtlExpr10 = EtlMapStart :-> (EtlR $ ROpStart :. (Union (TabL myTable) (Tab myTable2)))
158
myEtlExpr10 = EtlMapStart :-> (EtlR $ ROpStart :. (Union (TabL myTable) (Tab myTable2)))
158
true
false
0
11
220
47
27
20
null
null
input-output-hk/pos-haskell-prototype
script-runner/common/NodeControl.hs
mit
maybeSystemStart :: Maybe Timestamp -> [ String ] maybeSystemStart Nothing = []
79
maybeSystemStart :: Maybe Timestamp -> [ String ] maybeSystemStart Nothing = []
79
maybeSystemStart Nothing = []
29
false
true
0
6
11
26
13
13
null
null
malcolmt/chess-tools
src/ChessTools/Test/ConsoleTest.hs
bsd-3-clause
main :: IO () main = defaultMain tests
38
main :: IO () main = defaultMain tests
38
main = defaultMain tests
24
false
true
0
6
7
19
9
10
null
null
brendanhay/gogol
gogol-cloudsearch/gen/Network/Google/Resource/CloudSearch/Operations/Lro/List.hs
mpl-2.0
-- | Creates a value of 'OperationsLroList' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ollXgafv' -- -- * 'ollUploadProtocol' -- -- * 'ollAccessToken' -- -- * 'ollUploadType' -- -- * 'ollName' -- -- * 'ollFilter' -- -- * 'ollPageToken' -- -- * 'ollPageSize' -- -- * 'ollCallback' operationsLroList :: Text -- ^ 'ollName' -> OperationsLroList operationsLroList pOllName_ = OperationsLroList' { _ollXgafv = Nothing , _ollUploadProtocol = Nothing , _ollAccessToken = Nothing , _ollUploadType = Nothing , _ollName = pOllName_ , _ollFilter = Nothing , _ollPageToken = Nothing , _ollPageSize = Nothing , _ollCallback = Nothing }
762
operationsLroList :: Text -- ^ 'ollName' -> OperationsLroList operationsLroList pOllName_ = OperationsLroList' { _ollXgafv = Nothing , _ollUploadProtocol = Nothing , _ollAccessToken = Nothing , _ollUploadType = Nothing , _ollName = pOllName_ , _ollFilter = Nothing , _ollPageToken = Nothing , _ollPageSize = Nothing , _ollCallback = Nothing }
392
operationsLroList pOllName_ = OperationsLroList' { _ollXgafv = Nothing , _ollUploadProtocol = Nothing , _ollAccessToken = Nothing , _ollUploadType = Nothing , _ollName = pOllName_ , _ollFilter = Nothing , _ollPageToken = Nothing , _ollPageSize = Nothing , _ollCallback = Nothing }
322
true
true
0
7
164
105
70
35
null
null
haskell-lang/haskell-lang
src/HL/View/Home/Whyhaskell.hs
bsd-3-clause
community :: View App () community = do h2_ "Large, active community, plus commercial support" p_ (do "The Haskell open source community is highly active, with strong presences in " a_ [href_ "/mailing-lists"] "mailing lists" ", " a_ [href_ "/irc"] " IRC" ", " a_ [href_ "http://stackoverflow.com/questions/tagged?tagnames=haskell"] " Stack Overflow" ", " a_ [href_ "http://www.reddit.com/r/haskell"] " Reddit" ", and " a_ [href_ "/community"] " more" ". Pick a medium you want to converse on, and odds are you’ll find a vibrant Haskell community.")
685
community :: View App () community = do h2_ "Large, active community, plus commercial support" p_ (do "The Haskell open source community is highly active, with strong presences in " a_ [href_ "/mailing-lists"] "mailing lists" ", " a_ [href_ "/irc"] " IRC" ", " a_ [href_ "http://stackoverflow.com/questions/tagged?tagnames=haskell"] " Stack Overflow" ", " a_ [href_ "http://www.reddit.com/r/haskell"] " Reddit" ", and " a_ [href_ "/community"] " more" ". Pick a medium you want to converse on, and odds are you’ll find a vibrant Haskell community.")
685
community = do h2_ "Large, active community, plus commercial support" p_ (do "The Haskell open source community is highly active, with strong presences in " a_ [href_ "/mailing-lists"] "mailing lists" ", " a_ [href_ "/irc"] " IRC" ", " a_ [href_ "http://stackoverflow.com/questions/tagged?tagnames=haskell"] " Stack Overflow" ", " a_ [href_ "http://www.reddit.com/r/haskell"] " Reddit" ", and " a_ [href_ "/community"] " more" ". Pick a medium you want to converse on, and odds are you’ll find a vibrant Haskell community.")
660
false
true
0
14
218
127
52
75
null
null
diku-kmc/repg
test/Tests/TestUtils.hs
mit
-- | We need a strict `catch` function to capture any calls to `error` in the -- tested code so it can be handled gracefully in the testing framework. strictCatch :: (NFData a, Exception e) => IO a -> (e -> IO a) -> IO a strictCatch = catch . (toNF =<<) where toNF :: (NFData a) => a -> IO a toNF = evaluate . withStrategy rdeepseq
347
strictCatch :: (NFData a, Exception e) => IO a -> (e -> IO a) -> IO a strictCatch = catch . (toNF =<<) where toNF :: (NFData a) => a -> IO a toNF = evaluate . withStrategy rdeepseq
196
strictCatch = catch . (toNF =<<) where toNF :: (NFData a) => a -> IO a toNF = evaluate . withStrategy rdeepseq
126
true
true
2
11
83
108
52
56
null
null
Purview/purview
test/Test/Graphics/Forensics/Algorithms.hs
gpl-3.0
complexToReal :: Complex -> Double complexToReal = fst
54
complexToReal :: Complex -> Double complexToReal = fst
54
complexToReal = fst
19
false
true
0
5
7
15
8
7
null
null
oldmanmike/ghc
compiler/iface/IfaceType.hs
bsd-3-clause
pprIfaceForAllCoBndrs :: [(IfLclName, IfaceCoercion)] -> SDoc pprIfaceForAllCoBndrs bndrs = hsep $ map pprIfaceForAllCoBndr bndrs
129
pprIfaceForAllCoBndrs :: [(IfLclName, IfaceCoercion)] -> SDoc pprIfaceForAllCoBndrs bndrs = hsep $ map pprIfaceForAllCoBndr bndrs
129
pprIfaceForAllCoBndrs bndrs = hsep $ map pprIfaceForAllCoBndr bndrs
67
false
true
0
7
13
36
19
17
null
null
hvr/vector
Data/Vector/Generic.hs
bsd-3-clause
unsafeIndexM v i = UNSAFE_CHECK(checkIndex) "unsafeIndexM" i (length v) $ basicUnsafeIndexM v i
112
unsafeIndexM v i = UNSAFE_CHECK(checkIndex) "unsafeIndexM" i (length v) $ basicUnsafeIndexM v i
112
unsafeIndexM v i = UNSAFE_CHECK(checkIndex) "unsafeIndexM" i (length v) $ basicUnsafeIndexM v i
112
false
false
0
8
29
38
18
20
null
null
jappeace/jappeaceApplication
content/Jappie.hs
gpl-3.0
setAge :: Person' -> Int -> Person' setAge (Person' b _) a = Person' b a
72
setAge :: Person' -> Int -> Person' setAge (Person' b _) a = Person' b a
72
setAge (Person' b _) a = Person' b a
36
false
true
0
10
15
44
19
25
null
null
mpickering/hackage-server
Distribution/Server/Features/LegacyPasswds.hs
bsd-3-clause
replaceLegacyPasswdsTable :: LegacyPasswdsTable -> Update LegacyPasswdsTable () replaceLegacyPasswdsTable = put
111
replaceLegacyPasswdsTable :: LegacyPasswdsTable -> Update LegacyPasswdsTable () replaceLegacyPasswdsTable = put
111
replaceLegacyPasswdsTable = put
31
false
true
0
7
9
22
11
11
null
null
ctford/Idris-Elba-dev
src/IRTS/CodegenLLVM.hs
bsd-3-clause
cmpResultTy _ = FArith (ATInt (ITFixed IT32))
45
cmpResultTy _ = FArith (ATInt (ITFixed IT32))
45
cmpResultTy _ = FArith (ATInt (ITFixed IT32))
45
false
false
0
9
6
24
11
13
null
null
klarh/barch
Barch/QueryParser.hs
mit
tags::GenParser st [Elt] tags = do many space elts <- line return $ elt2Tag <$> elts
96
tags::GenParser st [Elt] tags = do many space elts <- line return $ elt2Tag <$> elts
96
tags = do many space elts <- line return $ elt2Tag <$> elts
71
false
true
0
8
27
50
21
29
null
null
CindyLinz/Haskell-Perl
src/Perl/Constant.hs
mit
const_SVt_NULL, const_SVt_IV, const_SVt_NV, const_SVt_PV, const_SVt_INVLIST, const_SVt_PVIV, const_SVt_PVNV, const_SVt_PVMG, const_SVt_REGEXP, const_SVt_PVGV, const_SVt_PVLV, const_SVt_PVAV, const_SVt_PVHV, const_SVt_PVCV, const_SVt_PVFM, const_SVt_PVIO, const_SVt_LAST :: Integral n => n const_SVt_NULL = 0
314
const_SVt_NULL, const_SVt_IV, const_SVt_NV, const_SVt_PV, const_SVt_INVLIST, const_SVt_PVIV, const_SVt_PVNV, const_SVt_PVMG, const_SVt_REGEXP, const_SVt_PVGV, const_SVt_PVLV, const_SVt_PVAV, const_SVt_PVHV, const_SVt_PVCV, const_SVt_PVFM, const_SVt_PVIO, const_SVt_LAST :: Integral n => n const_SVt_NULL = 0
313
const_SVt_NULL = 0
18
false
true
0
6
31
50
41
9
null
null
atodorov/bdcs
src/BDCS/DB.hs
lgpl-2.1
-- | Like 'maybe', but for keys. If the key is nothing, return the default value. Otherwise, -- run the function on the key and return that value. maybeKey :: MonadIO m => m b -- ^ Default value -> (t -> m b) -- ^ A function to run on the key -> m (Maybe t) -- ^ A 'Maybe' key -> m b maybeKey def fn value = value >>= \case Nothing -> def Just v -> fn v -- | Return a query fragment to match a Maybe value. -- If the value is Nothing, this is equivalent to (column is NULL) -- If the value is Just x, this is (value == column) -- Unlike the other Esqueleto operators, the right-hand value is not boxed in a Value, -- since we need to examine it in order to generate the correct SQL. -- -- e.g., with a table like: -- > create table example ( -- > id integer primary key, -- > value text ); -- you could use an esqueleto query like: -- > select $ from $ \example -> do -- > where_ $ maybeVal ==? (example ?. ExampleValue)
1,006
maybeKey :: MonadIO m => m b -- ^ Default value -> (t -> m b) -- ^ A function to run on the key -> m (Maybe t) -- ^ A 'Maybe' key -> m b maybeKey def fn value = value >>= \case Nothing -> def Just v -> fn v -- | Return a query fragment to match a Maybe value. -- If the value is Nothing, this is equivalent to (column is NULL) -- If the value is Just x, this is (value == column) -- Unlike the other Esqueleto operators, the right-hand value is not boxed in a Value, -- since we need to examine it in order to generate the correct SQL. -- -- e.g., with a table like: -- > create table example ( -- > id integer primary key, -- > value text ); -- you could use an esqueleto query like: -- > select $ from $ \example -> do -- > where_ $ maybeVal ==? (example ?. ExampleValue)
857
maybeKey def fn value = value >>= \case Nothing -> def Just v -> fn v -- | Return a query fragment to match a Maybe value. -- If the value is Nothing, this is equivalent to (column is NULL) -- If the value is Just x, this is (value == column) -- Unlike the other Esqueleto operators, the right-hand value is not boxed in a Value, -- since we need to examine it in order to generate the correct SQL. -- -- e.g., with a table like: -- > create table example ( -- > id integer primary key, -- > value text ); -- you could use an esqueleto query like: -- > select $ from $ \example -> do -- > where_ $ maybeVal ==? (example ?. ExampleValue)
660
true
true
3
11
281
105
58
47
null
null
mettekou/ghc
compiler/ghci/ByteCodeGen.hs
bsd-3-clause
getHscEnv :: BcM HscEnv getHscEnv = BcM $ \st -> return (st, bcm_hsc_env st)
76
getHscEnv :: BcM HscEnv getHscEnv = BcM $ \st -> return (st, bcm_hsc_env st)
76
getHscEnv = BcM $ \st -> return (st, bcm_hsc_env st)
52
false
true
2
7
13
42
19
23
null
null
ssaavedra/liquidhaskell
src/Language/Haskell/Liquid/Desugar710/Coverage.hs
bsd-3-clause
addTickStmt isGuard stmt@(TransStmt { trS_stmts = stmts , trS_by = by, trS_using = using , trS_ret = returnExpr, trS_bind = bindExpr , trS_fmap = liftMExpr }) = do t_s <- addTickLStmts isGuard stmts t_y <- fmapMaybeM addTickLHsExprRHS by t_u <- addTickLHsExprRHS using t_f <- addTickSyntaxExpr hpcSrcSpan returnExpr t_b <- addTickSyntaxExpr hpcSrcSpan bindExpr t_m <- addTickSyntaxExpr hpcSrcSpan liftMExpr return $ stmt { trS_stmts = t_s, trS_by = t_y, trS_using = t_u , trS_ret = t_f, trS_bind = t_b, trS_fmap = t_m }
674
addTickStmt isGuard stmt@(TransStmt { trS_stmts = stmts , trS_by = by, trS_using = using , trS_ret = returnExpr, trS_bind = bindExpr , trS_fmap = liftMExpr }) = do t_s <- addTickLStmts isGuard stmts t_y <- fmapMaybeM addTickLHsExprRHS by t_u <- addTickLHsExprRHS using t_f <- addTickSyntaxExpr hpcSrcSpan returnExpr t_b <- addTickSyntaxExpr hpcSrcSpan bindExpr t_m <- addTickSyntaxExpr hpcSrcSpan liftMExpr return $ stmt { trS_stmts = t_s, trS_by = t_y, trS_using = t_u , trS_ret = t_f, trS_bind = t_b, trS_fmap = t_m }
674
addTickStmt isGuard stmt@(TransStmt { trS_stmts = stmts , trS_by = by, trS_using = using , trS_ret = returnExpr, trS_bind = bindExpr , trS_fmap = liftMExpr }) = do t_s <- addTickLStmts isGuard stmts t_y <- fmapMaybeM addTickLHsExprRHS by t_u <- addTickLHsExprRHS using t_f <- addTickSyntaxExpr hpcSrcSpan returnExpr t_b <- addTickSyntaxExpr hpcSrcSpan bindExpr t_m <- addTickSyntaxExpr hpcSrcSpan liftMExpr return $ stmt { trS_stmts = t_s, trS_by = t_y, trS_using = t_u , trS_ret = t_f, trS_bind = t_b, trS_fmap = t_m }
674
false
false
0
10
235
171
91
80
null
null
lukexi/ghc-7.8-arm64
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
emitPrimOp _ res WriteOffAddrOp_Int64 args = doWriteOffAddrOp Nothing b64 res args
98
emitPrimOp _ res WriteOffAddrOp_Int64 args = doWriteOffAddrOp Nothing b64 res args
98
emitPrimOp _ res WriteOffAddrOp_Int64 args = doWriteOffAddrOp Nothing b64 res args
98
false
false
1
5
26
28
11
17
null
null
Noeda/Megaman
src/NetHack/Monad/NHAction.hs
mit
control 'M' = "\x0d"
20
control 'M' = "\x0d"
20
control 'M' = "\x0d"
20
false
false
1
5
3
13
4
9
null
null
maarons/Cortex
Miranda/CommitRaw.hs
agpl-3.0
fromString' :: (Key, BS.ByteString, LBS.ByteString, Hash, Hash, Timestamp) -> SIM m Commit fromString' (key, "delete", _, _, hash, ts) = return $ Commit (key, Delete, hash, ts)
185
fromString' :: (Key, BS.ByteString, LBS.ByteString, Hash, Hash, Timestamp) -> SIM m Commit fromString' (key, "delete", _, _, hash, ts) = return $ Commit (key, Delete, hash, ts)
184
fromString' (key, "delete", _, _, hash, ts) = return $ Commit (key, Delete, hash, ts)
89
false
true
0
7
35
82
48
34
null
null
johannesgerer/buchhaltung
src/Buchhaltung/Importers.hs
mit
barclaycardPreprocessor :: Preprocessor () AccountId barclaycardPreprocessor (wholeFile, _) = maybe e (return . (,) (T.unlines body) . AccountId bank . T.dropWhile (== 'X')) $ T.stripPrefix accountPrefix accountLine where (bank : accountLine : _ : _ : body) = T.lines wholeFile accountPrefix = "Account Number: " e = throwError $ "Expected second line of file to begin with prefix " `T.append` accountPrefix
435
barclaycardPreprocessor :: Preprocessor () AccountId barclaycardPreprocessor (wholeFile, _) = maybe e (return . (,) (T.unlines body) . AccountId bank . T.dropWhile (== 'X')) $ T.stripPrefix accountPrefix accountLine where (bank : accountLine : _ : _ : body) = T.lines wholeFile accountPrefix = "Account Number: " e = throwError $ "Expected second line of file to begin with prefix " `T.append` accountPrefix
435
barclaycardPreprocessor (wholeFile, _) = maybe e (return . (,) (T.unlines body) . AccountId bank . T.dropWhile (== 'X')) $ T.stripPrefix accountPrefix accountLine where (bank : accountLine : _ : _ : body) = T.lines wholeFile accountPrefix = "Account Number: " e = throwError $ "Expected second line of file to begin with prefix " `T.append` accountPrefix
382
false
true
7
12
88
157
72
85
null
null
nazrhom/vcs-clojure
src/VCS/Disjoint.hs
bsd-3-clause
disjointAlmuH :: (forall u v w . Almu u v -> Almu u w -> Bool) -> AlmuH u -> AlmuH u -> Bool disjointAlmuH rec (AlmuH almu) (AlmuH almu') = rec almu almu'
169
disjointAlmuH :: (forall u v w . Almu u v -> Almu u w -> Bool) -> AlmuH u -> AlmuH u -> Bool disjointAlmuH rec (AlmuH almu) (AlmuH almu') = rec almu almu'
169
disjointAlmuH rec (AlmuH almu) (AlmuH almu') = rec almu almu'
61
false
true
0
10
48
81
40
41
null
null
rvion/lamdu
Lamdu/Eval.hs
gpl-3.0
liftState :: Monad m => StateT (EvalState m pl) m a -> EvalT pl m a liftState = EvalT
85
liftState :: Monad m => StateT (EvalState m pl) m a -> EvalT pl m a liftState = EvalT
85
liftState = EvalT
17
false
true
0
9
18
44
21
23
null
null
j5b/ps-pc
OutputProof.hs
gpl-3.0
conceptToLatex (Atom a) = a
28
conceptToLatex (Atom a) = a
28
conceptToLatex (Atom a) = a
28
false
false
0
6
5
16
7
9
null
null
beni55/hspec-expectations
test/Test/Hspec/ExpectationsSpec.hs
mit
expectationFailed :: (?loc :: CallStack) => String -> HUnitFailure -> Bool expectationFailed msg (HUnitFailure l m) = m == msg && (setColumn <$> l) == location where location :: Maybe Location location = case reverse (getCallStack ?loc) of (_, loc) : _ -> Just $ Location (srcLocFile loc) (srcLocStartLine loc) 0 _ -> Nothing setColumn :: Location -> Location setColumn loc_ = loc_{locationColumn = 0} #else expectationFailed :: String -> HUnitFailure -> Bool expectationFailed msg e = e == HUnitFailure Nothing msg #endif
553
expectationFailed :: (?loc :: CallStack) => String -> HUnitFailure -> Bool expectationFailed msg (HUnitFailure l m) = m == msg && (setColumn <$> l) == location where location :: Maybe Location location = case reverse (getCallStack ?loc) of (_, loc) : _ -> Just $ Location (srcLocFile loc) (srcLocStartLine loc) 0 _ -> Nothing setColumn :: Location -> Location setColumn loc_ = loc_{locationColumn = 0} #else expectationFailed :: String -> HUnitFailure -> Bool expectationFailed msg e = e == HUnitFailure Nothing msg #endif
553
expectationFailed msg (HUnitFailure l m) = m == msg && (setColumn <$> l) == location where location :: Maybe Location location = case reverse (getCallStack ?loc) of (_, loc) : _ -> Just $ Location (srcLocFile loc) (srcLocStartLine loc) 0 _ -> Nothing setColumn :: Location -> Location setColumn loc_ = loc_{locationColumn = 0} #else expectationFailed :: String -> HUnitFailure -> Bool expectationFailed msg e = e == HUnitFailure Nothing msg #endif
478
false
true
0
11
113
160
84
76
null
null
mwotton/dnsmadeeasy
src/Network/DNS/SHAHelper.hs
bsd-3-clause
-- looks weird, but it produces the same result as the Ruby version. genSHA1 :: String -> String -> String genSHA1 key string = map toLower $ BS8.unpack $ hex $ C.encode $ (hmac (MacKey $ BS8.pack key) (BL8.pack string) :: SHA1)
228
genSHA1 :: String -> String -> String genSHA1 key string = map toLower $ BS8.unpack $ hex $ C.encode $ (hmac (MacKey $ BS8.pack key) (BL8.pack string) :: SHA1)
159
genSHA1 key string = map toLower $ BS8.unpack $ hex $ C.encode $ (hmac (MacKey $ BS8.pack key) (BL8.pack string) :: SHA1)
121
true
true
0
11
41
79
40
39
null
null
ToJans/learninghaskell
0005Tetris/src/Engine.hs
unlicense
runEngine :: Level -> (LevelEvent -> Level -> IO Level) -> (Float -> Level -> IO Level) -> IO () runEngine wrld eventHandler = playIO window black 4 -- simulations/sec wrld drawWrld internalEventHandler where window = InWindow "HaskTris by @ToJans" (w, h) (100, 100) w = cellSize * gridWidth h = cellSize * gridHeight drawWrld wrld = return $ translate (-fromIntegral w/2) (-fromIntegral h/2) $ drawLevel wrld internalEventHandler:: Event -> Level -> IO Level internalEventHandler evt = maybe return eventHandler $ maybeEvent evt maybeEvent evt = case evt of EventKey (SpecialKey KeyLeft) Down _ _ -> Just MoveBlockLeft EventKey (SpecialKey KeyRight) Down _ _ -> Just MoveBlockRight EventKey (SpecialKey KeyUp) Down _ _ -> Just RotateBlock EventKey (SpecialKey KeyDown) Down _ _ -> Just MoveBlockDown EventKey (SpecialKey KeySpace) Down _ _ -> Just RestartGame otherwise -> Nothing
1,014
runEngine :: Level -> (LevelEvent -> Level -> IO Level) -> (Float -> Level -> IO Level) -> IO () runEngine wrld eventHandler = playIO window black 4 -- simulations/sec wrld drawWrld internalEventHandler where window = InWindow "HaskTris by @ToJans" (w, h) (100, 100) w = cellSize * gridWidth h = cellSize * gridHeight drawWrld wrld = return $ translate (-fromIntegral w/2) (-fromIntegral h/2) $ drawLevel wrld internalEventHandler:: Event -> Level -> IO Level internalEventHandler evt = maybe return eventHandler $ maybeEvent evt maybeEvent evt = case evt of EventKey (SpecialKey KeyLeft) Down _ _ -> Just MoveBlockLeft EventKey (SpecialKey KeyRight) Down _ _ -> Just MoveBlockRight EventKey (SpecialKey KeyUp) Down _ _ -> Just RotateBlock EventKey (SpecialKey KeyDown) Down _ _ -> Just MoveBlockDown EventKey (SpecialKey KeySpace) Down _ _ -> Just RestartGame otherwise -> Nothing
1,014
runEngine wrld eventHandler = playIO window black 4 -- simulations/sec wrld drawWrld internalEventHandler where window = InWindow "HaskTris by @ToJans" (w, h) (100, 100) w = cellSize * gridWidth h = cellSize * gridHeight drawWrld wrld = return $ translate (-fromIntegral w/2) (-fromIntegral h/2) $ drawLevel wrld internalEventHandler:: Event -> Level -> IO Level internalEventHandler evt = maybe return eventHandler $ maybeEvent evt maybeEvent evt = case evt of EventKey (SpecialKey KeyLeft) Down _ _ -> Just MoveBlockLeft EventKey (SpecialKey KeyRight) Down _ _ -> Just MoveBlockRight EventKey (SpecialKey KeyUp) Down _ _ -> Just RotateBlock EventKey (SpecialKey KeyDown) Down _ _ -> Just MoveBlockDown EventKey (SpecialKey KeySpace) Down _ _ -> Just RestartGame otherwise -> Nothing
917
false
true
13
12
269
375
167
208
null
null
kawu/dawg
src/Data/DAWG/Static.hs
bsd-2-clause
size'I :: ID -> DAWG a Weight c -> Int size'I i d = add $ do x <- case N.edges n of [] -> Nothing xs -> Just (fst $ last xs) (j, v) <- N.onSym' x n return $ v + size'I j d where n = nodeBy i d u = maybe 0 (const 1) (leafValue n d) add m = u + maybe 0 id m ----------------------------------------- -- Index ----------------------------------------- -- | Position in a set of all dictionary entries with respect -- to the lexicographic order.
487
size'I :: ID -> DAWG a Weight c -> Int size'I i d = add $ do x <- case N.edges n of [] -> Nothing xs -> Just (fst $ last xs) (j, v) <- N.onSym' x n return $ v + size'I j d where n = nodeBy i d u = maybe 0 (const 1) (leafValue n d) add m = u + maybe 0 id m ----------------------------------------- -- Index ----------------------------------------- -- | Position in a set of all dictionary entries with respect -- to the lexicographic order.
487
size'I i d = add $ do x <- case N.edges n of [] -> Nothing xs -> Just (fst $ last xs) (j, v) <- N.onSym' x n return $ v + size'I j d where n = nodeBy i d u = maybe 0 (const 1) (leafValue n d) add m = u + maybe 0 id m ----------------------------------------- -- Index ----------------------------------------- -- | Position in a set of all dictionary entries with respect -- to the lexicographic order.
448
false
true
0
15
136
177
87
90
null
null
Chatanga/codingame-hs
src/Codingame/SourcePackager.hs
mit
toExtension (Ident _ "DeriveDataTypeable") = EnableExtension DeriveDataTypeable
79
toExtension (Ident _ "DeriveDataTypeable") = EnableExtension DeriveDataTypeable
79
toExtension (Ident _ "DeriveDataTypeable") = EnableExtension DeriveDataTypeable
79
false
false
0
7
6
20
9
11
null
null