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
HIPERFIT/futhark
src/Futhark/IR/Primitive.hs
isc
doCmpOp FCmpLe {} (FloatValue v1) (FloatValue v2) = Just $ doFCmpLe v1 v2
73
doCmpOp FCmpLe {} (FloatValue v1) (FloatValue v2) = Just $ doFCmpLe v1 v2
73
doCmpOp FCmpLe {} (FloatValue v1) (FloatValue v2) = Just $ doFCmpLe v1 v2
73
false
false
2
8
12
41
18
23
null
null
danr/hipspec
testsuite/prod/zeno_version/PropT07.hs
gpl-3.0
union [] ys = ys
16
union [] ys = ys
16
union [] ys = ys
16
false
false
1
5
4
18
6
12
null
null
anekos/liname-hs
src/LiName/Utils.hs
gpl-3.0
notDots :: String -> Bool notDots "." = False
46
notDots :: String -> Bool notDots "." = False
46
notDots "." = False
20
false
true
0
7
9
24
10
14
null
null
kim/amazonka
amazonka-lambda/gen/Network/AWS/Lambda/UploadFunction.hs
mpl-2.0
-- | The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it -- executes your function to access any other Amazon Web Services (AWS) -- resources. ufRole :: Lens' UploadFunction Text ufRole = lens _ufRole (\s a -> s { _ufRole = a })
251
ufRole :: Lens' UploadFunction Text ufRole = lens _ufRole (\s a -> s { _ufRole = a })
85
ufRole = lens _ufRole (\s a -> s { _ufRole = a })
49
true
true
1
9
47
48
24
24
null
null
notae/haskell-exercise
cp/TypedCP2.hs
bsd-3-clause
f2 :: RangedInt l u -> RangedInt (l + 2) (u + 2) f2 x = x @+ $(ric 2)
69
f2 :: RangedInt l u -> RangedInt (l + 2) (u + 2) f2 x = x @+ $(ric 2)
69
f2 x = x @+ $(ric 2)
20
false
true
2
9
19
60
28
32
null
null
abuiles/turbinado-blog
tmp/dependencies/hdbc-postgresql-1.1.4.1/testsrc/TestSbasics.hs
bsd-3-clause
testWithTransaction = dbTestCase (\dbh -> do assertBool "Connected database does not support transactions; skipping transaction test" (dbTransactionSupport dbh) sth <- prepare dbh "INSERT INTO hdbctest1 VALUES ('withTransaction', ?, NULL, NULL)" sExecute sth [Just "0"] commit dbh qrysth <- prepare dbh "SELECT testid FROM hdbctest1 WHERE testname = 'withTransaction' ORDER BY testid" sExecute qrysth [] sFetchAllRows qrysth >>= (assertEqual "initial commit" [[Just "0"]]) -- Let's try a rollback. try $ withTransaction dbh (\_ -> do sExecuteMany sth rows fail "Foo") sExecute qrysth [] sFetchAllRows qrysth >>= (assertEqual "rollback" [[Just "0"]]) -- And now a commit. withTransaction dbh (\_ -> sExecuteMany sth rows) sExecute qrysth [] sFetchAllRows qrysth >>= (assertEqual "final commit" ([Just "0"]:rows)) ) where rows = map (\x -> [Just . show $ x]) [1..9]
1,052
testWithTransaction = dbTestCase (\dbh -> do assertBool "Connected database does not support transactions; skipping transaction test" (dbTransactionSupport dbh) sth <- prepare dbh "INSERT INTO hdbctest1 VALUES ('withTransaction', ?, NULL, NULL)" sExecute sth [Just "0"] commit dbh qrysth <- prepare dbh "SELECT testid FROM hdbctest1 WHERE testname = 'withTransaction' ORDER BY testid" sExecute qrysth [] sFetchAllRows qrysth >>= (assertEqual "initial commit" [[Just "0"]]) -- Let's try a rollback. try $ withTransaction dbh (\_ -> do sExecuteMany sth rows fail "Foo") sExecute qrysth [] sFetchAllRows qrysth >>= (assertEqual "rollback" [[Just "0"]]) -- And now a commit. withTransaction dbh (\_ -> sExecuteMany sth rows) sExecute qrysth [] sFetchAllRows qrysth >>= (assertEqual "final commit" ([Just "0"]:rows)) ) where rows = map (\x -> [Just . show $ x]) [1..9]
1,052
testWithTransaction = dbTestCase (\dbh -> do assertBool "Connected database does not support transactions; skipping transaction test" (dbTransactionSupport dbh) sth <- prepare dbh "INSERT INTO hdbctest1 VALUES ('withTransaction', ?, NULL, NULL)" sExecute sth [Just "0"] commit dbh qrysth <- prepare dbh "SELECT testid FROM hdbctest1 WHERE testname = 'withTransaction' ORDER BY testid" sExecute qrysth [] sFetchAllRows qrysth >>= (assertEqual "initial commit" [[Just "0"]]) -- Let's try a rollback. try $ withTransaction dbh (\_ -> do sExecuteMany sth rows fail "Foo") sExecute qrysth [] sFetchAllRows qrysth >>= (assertEqual "rollback" [[Just "0"]]) -- And now a commit. withTransaction dbh (\_ -> sExecuteMany sth rows) sExecute qrysth [] sFetchAllRows qrysth >>= (assertEqual "final commit" ([Just "0"]:rows)) ) where rows = map (\x -> [Just . show $ x]) [1..9]
1,052
false
false
0
16
313
284
133
151
null
null
bergmark/binary
src/Data/Binary/Put.hs
bsd-3-clause
-- | Run the 'Put' monad with a serialiser runPut :: Put -> L.ByteString runPut = toLazyByteString . sndS . unPut
113
runPut :: Put -> L.ByteString runPut = toLazyByteString . sndS . unPut
70
runPut = toLazyByteString . sndS . unPut
40
true
true
0
6
20
26
14
12
null
null
Xuyuanp/hscheme
main.hs
apache-2.0
cdr [DottedList (_:xs) x] = return $ DottedList xs x
52
cdr [DottedList (_:xs) x] = return $ DottedList xs x
52
cdr [DottedList (_:xs) x] = return $ DottedList xs x
52
false
false
0
8
9
34
16
18
null
null
brendanhay/gogol
gogol-searchconsole/gen/Network/Google/Resource/Webmasters/Sitemaps/Submit.hs
mpl-2.0
-- | The URL of the actual sitemap. For example: -- \`http:\/\/www.example.com\/sitemap.xml\`. ssFeedpath :: Lens' SitemapsSubmit Text ssFeedpath = lens _ssFeedpath (\ s a -> s{_ssFeedpath = a})
196
ssFeedpath :: Lens' SitemapsSubmit Text ssFeedpath = lens _ssFeedpath (\ s a -> s{_ssFeedpath = a})
101
ssFeedpath = lens _ssFeedpath (\ s a -> s{_ssFeedpath = a})
61
true
true
0
9
29
43
23
20
null
null
rimmington/eclogues
eclogues-impl/test/Eclogues/StateSpec.hs
bsd-3-clause
optDepName :: Job.Name optDepName = forceName "optDep"
54
optDepName :: Job.Name optDepName = forceName "optDep"
54
optDepName = forceName "optDep"
31
false
true
0
7
6
22
9
13
null
null
karknu/rws
src/Packet.hs
bsd-3-clause
defaultIPv4 :: IPv4 defaultIPv4 = IPv4 4 5 0 (-1) 0x1234 0 64 17 0 0xa0a0a0a1 0xa0a0a0a2 True
93
defaultIPv4 :: IPv4 defaultIPv4 = IPv4 4 5 0 (-1) 0x1234 0 64 17 0 0xa0a0a0a1 0xa0a0a0a2 True
93
defaultIPv4 = IPv4 4 5 0 (-1) 0x1234 0 64 17 0 0xa0a0a0a1 0xa0a0a0a2 True
73
false
true
0
7
17
41
21
20
null
null
rbonifacio/funsat
etc/fiblib/Data/FibHeap.hs
bsd-3-clause
insertRight :: Tree a -> Cursor a -> Cursor a insertRight x EmptyC = Cursor x emptyPath
87
insertRight :: Tree a -> Cursor a -> Cursor a insertRight x EmptyC = Cursor x emptyPath
87
insertRight x EmptyC = Cursor x emptyPath
41
false
true
0
7
16
38
17
21
null
null
agrafix/hackage-server
Distribution/Server/Packages/ChangeLog.hs
bsd-3-clause
isChangeLogFile :: FilePath -> Bool isChangeLogFile fname = map Char.toLower base `elem` basenames && ext `elem` extensions where (base, ext) = splitExtension fname basenames = ["news", "changelog", "change_log", "changes"] extensions = ["", ".txt", ".md", ".markdown"]
308
isChangeLogFile :: FilePath -> Bool isChangeLogFile fname = map Char.toLower base `elem` basenames && ext `elem` extensions where (base, ext) = splitExtension fname basenames = ["news", "changelog", "change_log", "changes"] extensions = ["", ".txt", ".md", ".markdown"]
308
isChangeLogFile fname = map Char.toLower base `elem` basenames && ext `elem` extensions where (base, ext) = splitExtension fname basenames = ["news", "changelog", "change_log", "changes"] extensions = ["", ".txt", ".md", ".markdown"]
272
false
true
2
9
73
94
53
41
null
null
rueshyna/gogol
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
mpl-2.0
vRating :: Lens' VideoRating (Maybe VideoRatingRating) vRating = lens _vRating (\ s a -> s{_vRating = a})
105
vRating :: Lens' VideoRating (Maybe VideoRatingRating) vRating = lens _vRating (\ s a -> s{_vRating = a})
105
vRating = lens _vRating (\ s a -> s{_vRating = a})
50
false
true
0
9
16
45
24
21
null
null
christiaanb/Idris-dev
src/Core/ProofState.hs
bsd-3-clause
action :: Monad m => (ProofState -> ProofState) -> StateT TState m () action a = do ps <- get put (a ps)
118
action :: Monad m => (ProofState -> ProofState) -> StateT TState m () action a = do ps <- get put (a ps)
118
action a = do ps <- get put (a ps)
48
false
true
0
10
36
65
29
36
null
null
DavidAlphaFox/darcs
src/Darcs/UI/Commands/SetPref.hs
gpl-2.0
setprefOpts :: DarcsOption a (Maybe String -> Maybe O.StdCmdAction -> Bool -> Bool -> O.Verbosity -> Bool -> O.UMask -> O.UseCache -> Maybe String -> Bool -> Maybe String -> Bool -> a) setprefOpts = setprefBasicOpts `withStdOpts` setprefAdvancedOpts
456
setprefOpts :: DarcsOption a (Maybe String -> Maybe O.StdCmdAction -> Bool -> Bool -> O.Verbosity -> Bool -> O.UMask -> O.UseCache -> Maybe String -> Bool -> Maybe String -> Bool -> a) setprefOpts = setprefBasicOpts `withStdOpts` setprefAdvancedOpts
456
setprefOpts = setprefBasicOpts `withStdOpts` setprefAdvancedOpts
64
false
true
0
18
244
93
46
47
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/sequence__1.hs
mit
returnMaybe :: b -> Maybe b returnMaybe = Just
48
returnMaybe :: b -> Maybe b returnMaybe = Just
48
returnMaybe = Just
18
false
true
0
6
10
18
9
9
null
null
jparyani/capnproto-boostpython
compiler/src/Semantics.hs
bsd-2-clause
typeName scope (InlineListType t s) = printf "InlineList(%s, %d)" (typeName scope t) s
86
typeName scope (InlineListType t s) = printf "InlineList(%s, %d)" (typeName scope t) s
86
typeName scope (InlineListType t s) = printf "InlineList(%s, %d)" (typeName scope t) s
86
false
false
0
7
12
36
16
20
null
null
mcschroeder/ghc
compiler/types/Type.hs
bsd-3-clause
isNomEqPred ty = case tyConAppTyCon_maybe ty of Just tyCon -> tyCon `hasKey` eqPrimTyConKey _ -> False
119
isNomEqPred ty = case tyConAppTyCon_maybe ty of Just tyCon -> tyCon `hasKey` eqPrimTyConKey _ -> False
119
isNomEqPred ty = case tyConAppTyCon_maybe ty of Just tyCon -> tyCon `hasKey` eqPrimTyConKey _ -> False
119
false
false
1
8
32
41
18
23
null
null
gridaphobe/ghc
compiler/utils/Util.hs
bsd-3-clause
thdOf3 (_,_,c) = c
24
thdOf3 (_,_,c) = c
24
thdOf3 (_,_,c) = c
24
false
false
0
5
9
19
10
9
null
null
YoEight/eventstore
Database/EventStore/Internal/Types.hs
bsd-3-clause
-------------------------------------------------------------------------------- -- | Creates an event using JSON format withJson :: ToJSON a => a -> EventData withJson value = Json (toJSON value) Nothing
204
withJson :: ToJSON a => a -> EventData withJson value = Json (toJSON value) Nothing
83
withJson value = Json (toJSON value) Nothing
44
true
true
0
7
23
38
19
19
null
null
xmonad/xmonad
src/XMonad/Core.hs
bsd-3-clause
runQuery :: Query a -> Window -> X a runQuery (Query m) w = runReaderT m w
74
runQuery :: Query a -> Window -> X a runQuery (Query m) w = runReaderT m w
74
runQuery (Query m) w = runReaderT m w
37
false
true
0
7
16
41
19
22
null
null
rueshyna/gogol
gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs
mpl-2.0
-- | [Optional] Describes the schema of this table. tabSchema :: Lens' Table (Maybe TableSchema) tabSchema = lens _tabSchema (\ s a -> s{_tabSchema = a})
155
tabSchema :: Lens' Table (Maybe TableSchema) tabSchema = lens _tabSchema (\ s a -> s{_tabSchema = a})
103
tabSchema = lens _tabSchema (\ s a -> s{_tabSchema = a})
58
true
true
0
9
27
48
25
23
null
null
Lokathor/hexes
src/Hexes/Internal.hs
mit
- TODO: The following should maybe (?) be collapsed into a single "work" -- function that takes the gen operation as a paramater in three different -- aliases, since they're so similar. Also, they can all trivially be adjusted -- to (Integral i), so that should be considered. -- | Generates a buffer and automatically handles the pointer fiddling. safeGenBuffers :: MonadIO m => Int -> m [GLuint] safeGenBuffers n = do liftIO $ allocaArray n $ \arrP -> do glGenBuffers (fromIntegral n) arrP (peekArray n arrP) -- | Generates a vertex array and automatically handles the pointer fiddling.
611
safeGenBuffers :: MonadIO m => Int -> m [GLuint] safeGenBuffers n = do liftIO $ allocaArray n $ \arrP -> do glGenBuffers (fromIntegral n) arrP (peekArray n arrP) -- | Generates a vertex array and automatically handles the pointer fiddling.
260
safeGenBuffers n = do liftIO $ allocaArray n $ \arrP -> do glGenBuffers (fromIntegral n) arrP (peekArray n arrP) -- | Generates a vertex array and automatically handles the pointer fiddling.
211
true
true
0
13
121
112
56
56
null
null
rahulmutt/ghcvm
compiler/Eta/TypeCheck/TcPatSyn.hs
bsd-3-clause
tcPatToExpr :: [Located Name] -> LPat Name -> Maybe (LHsExpr Name) tcPatToExpr args = go where lhsVars = mkNameSet (map unLoc args) go :: LPat Name -> Maybe (LHsExpr Name) go (L loc (ConPatIn conName info)) = do { let con = L loc (HsVar (unLoc conName)) ; exprs <- mapM go (hsConPatArgs info) ; return $ foldl (\x y -> L loc (HsApp x y)) con exprs } go (L loc p) = fmap (L loc) $ go1 p go1 :: Pat Name -> Maybe (HsExpr Name) go1 (VarPat var) | var `elemNameSet` lhsVars = return $ HsVar var | otherwise = Nothing go1 (LazyPat pat) = fmap HsPar $ go pat go1 (ParPat pat) = fmap HsPar $ go pat go1 (BangPat pat) = fmap HsPar $ go pat go1 (PArrPat pats ptt) = do { exprs <- mapM go pats ; return $ ExplicitPArr ptt exprs } go1 (ListPat pats ptt reb) = do { exprs <- mapM go pats ; return $ ExplicitList ptt (fmap snd reb) exprs } go1 (TuplePat pats box _) = do { exprs <- mapM go pats ; return (ExplicitTuple (map (noLoc . Present) exprs) box) } go1 (LitPat lit) = return $ HsLit lit go1 (NPat (L _ n) Nothing _) = return $ HsOverLit n go1 (NPat (L _ n) (Just neg) _) = return $ noLoc neg `HsApp` noLoc (HsOverLit n) go1 (SigPatIn pat (HsWB ty _ _ wcs)) = do { expr <- go pat ; return $ ExprWithTySig expr ty wcs } go1 (ConPatOut{}) = panic "ConPatOut in output of renamer" go1 (SigPatOut{}) = panic "SigPatOut in output of renamer" go1 (CoPat{}) = panic "CoPat in output of renamer" go1 _ = Nothing -- Walk the whole pattern and for all ConPatOuts, collect the -- existentially-bound type variables and evidence binding variables. -- -- These are used in computing the type of a pattern synonym and also -- in generating matcher functions, since success continuations need -- to be passed these pattern-bound evidences.
2,081
tcPatToExpr :: [Located Name] -> LPat Name -> Maybe (LHsExpr Name) tcPatToExpr args = go where lhsVars = mkNameSet (map unLoc args) go :: LPat Name -> Maybe (LHsExpr Name) go (L loc (ConPatIn conName info)) = do { let con = L loc (HsVar (unLoc conName)) ; exprs <- mapM go (hsConPatArgs info) ; return $ foldl (\x y -> L loc (HsApp x y)) con exprs } go (L loc p) = fmap (L loc) $ go1 p go1 :: Pat Name -> Maybe (HsExpr Name) go1 (VarPat var) | var `elemNameSet` lhsVars = return $ HsVar var | otherwise = Nothing go1 (LazyPat pat) = fmap HsPar $ go pat go1 (ParPat pat) = fmap HsPar $ go pat go1 (BangPat pat) = fmap HsPar $ go pat go1 (PArrPat pats ptt) = do { exprs <- mapM go pats ; return $ ExplicitPArr ptt exprs } go1 (ListPat pats ptt reb) = do { exprs <- mapM go pats ; return $ ExplicitList ptt (fmap snd reb) exprs } go1 (TuplePat pats box _) = do { exprs <- mapM go pats ; return (ExplicitTuple (map (noLoc . Present) exprs) box) } go1 (LitPat lit) = return $ HsLit lit go1 (NPat (L _ n) Nothing _) = return $ HsOverLit n go1 (NPat (L _ n) (Just neg) _) = return $ noLoc neg `HsApp` noLoc (HsOverLit n) go1 (SigPatIn pat (HsWB ty _ _ wcs)) = do { expr <- go pat ; return $ ExprWithTySig expr ty wcs } go1 (ConPatOut{}) = panic "ConPatOut in output of renamer" go1 (SigPatOut{}) = panic "SigPatOut in output of renamer" go1 (CoPat{}) = panic "CoPat in output of renamer" go1 _ = Nothing -- Walk the whole pattern and for all ConPatOuts, collect the -- existentially-bound type variables and evidence binding variables. -- -- These are used in computing the type of a pattern synonym and also -- in generating matcher functions, since success continuations need -- to be passed these pattern-bound evidences.
2,081
tcPatToExpr args = go where lhsVars = mkNameSet (map unLoc args) go :: LPat Name -> Maybe (LHsExpr Name) go (L loc (ConPatIn conName info)) = do { let con = L loc (HsVar (unLoc conName)) ; exprs <- mapM go (hsConPatArgs info) ; return $ foldl (\x y -> L loc (HsApp x y)) con exprs } go (L loc p) = fmap (L loc) $ go1 p go1 :: Pat Name -> Maybe (HsExpr Name) go1 (VarPat var) | var `elemNameSet` lhsVars = return $ HsVar var | otherwise = Nothing go1 (LazyPat pat) = fmap HsPar $ go pat go1 (ParPat pat) = fmap HsPar $ go pat go1 (BangPat pat) = fmap HsPar $ go pat go1 (PArrPat pats ptt) = do { exprs <- mapM go pats ; return $ ExplicitPArr ptt exprs } go1 (ListPat pats ptt reb) = do { exprs <- mapM go pats ; return $ ExplicitList ptt (fmap snd reb) exprs } go1 (TuplePat pats box _) = do { exprs <- mapM go pats ; return (ExplicitTuple (map (noLoc . Present) exprs) box) } go1 (LitPat lit) = return $ HsLit lit go1 (NPat (L _ n) Nothing _) = return $ HsOverLit n go1 (NPat (L _ n) (Just neg) _) = return $ noLoc neg `HsApp` noLoc (HsOverLit n) go1 (SigPatIn pat (HsWB ty _ _ wcs)) = do { expr <- go pat ; return $ ExprWithTySig expr ty wcs } go1 (ConPatOut{}) = panic "ConPatOut in output of renamer" go1 (SigPatOut{}) = panic "SigPatOut in output of renamer" go1 (CoPat{}) = panic "CoPat in output of renamer" go1 _ = Nothing -- Walk the whole pattern and for all ConPatOuts, collect the -- existentially-bound type variables and evidence binding variables. -- -- These are used in computing the type of a pattern synonym and also -- in generating matcher functions, since success continuations need -- to be passed these pattern-bound evidences.
2,014
false
true
0
14
700
747
366
381
null
null
nushio3/ghc
compiler/coreSyn/CoreUtils.hs
bsd-3-clause
coreAltsType :: [CoreAlt] -> Type -- ^ Returns the type of the first alternative, which should be the same as for all alternatives coreAltsType (alt:_) = coreAltType alt
169
coreAltsType :: [CoreAlt] -> Type coreAltsType (alt:_) = coreAltType alt
72
coreAltsType (alt:_) = coreAltType alt
38
true
true
0
7
27
32
17
15
null
null
haskell-distributed/distributed-process-tests
src/Control/Distributed/Process/Tests/CH.hs
bsd-3-clause
forkTry :: IO () -> IO ThreadId forkTry p = do tid <- myThreadId forkIO $ Ex.catch p (\e -> throwTo tid (e :: SomeException)) -- | The ping server from the paper
166
forkTry :: IO () -> IO ThreadId forkTry p = do tid <- myThreadId forkIO $ Ex.catch p (\e -> throwTo tid (e :: SomeException)) -- | The ping server from the paper
166
forkTry p = do tid <- myThreadId forkIO $ Ex.catch p (\e -> throwTo tid (e :: SomeException)) -- | The ping server from the paper
134
false
true
0
12
37
67
33
34
null
null
hirokai/PaperServer
Parser/PaperReaderTypes.hs
bsd-2-clause
doi2url :: String -> String doi2url doi = "http://dx.doi.org/" ++ doi
69
doi2url :: String -> String doi2url doi = "http://dx.doi.org/" ++ doi
69
doi2url doi = "http://dx.doi.org/" ++ doi
41
false
true
0
5
10
22
11
11
null
null
bj4rtmar/sdl2
src/SDL/Raw/Video.hs
bsd-3-clause
getNumVideoDisplays :: MonadIO m => m CInt getNumVideoDisplays = liftIO getNumVideoDisplays'
92
getNumVideoDisplays :: MonadIO m => m CInt getNumVideoDisplays = liftIO getNumVideoDisplays'
92
getNumVideoDisplays = liftIO getNumVideoDisplays'
49
false
true
0
7
10
30
12
18
null
null
anammari/pandoc
src/Text/Pandoc/Writers/ConTeXt.hs
gpl-2.0
inlineToConTeXt (Quoted DoubleQuote lst) = do contents <- inlineListToConTeXt lst return $ text "\\quotation{" <> contents <> char '}'
138
inlineToConTeXt (Quoted DoubleQuote lst) = do contents <- inlineListToConTeXt lst return $ text "\\quotation{" <> contents <> char '}'
138
inlineToConTeXt (Quoted DoubleQuote lst) = do contents <- inlineListToConTeXt lst return $ text "\\quotation{" <> contents <> char '}'
138
false
false
0
10
22
48
21
27
null
null
henrytill/deviser
src/Deviser/Parser.hs
bsd-3-clause
schemeDef :: Token.GenLanguageDef T.Text () Identity schemeDef = Language.emptyDef { Token.commentStart = "" , Token.commentEnd = "" , Token.commentLine = ";" , Token.opStart = Token.opLetter schemeDef , Token.opLetter = symbol , Token.identStart = letter <|> symbol , Token.identLetter = letter <|> symbol <|> digit , Token.reservedOpNames = ["'", "\"", ".", "+", "-"] }
425
schemeDef :: Token.GenLanguageDef T.Text () Identity schemeDef = Language.emptyDef { Token.commentStart = "" , Token.commentEnd = "" , Token.commentLine = ";" , Token.opStart = Token.opLetter schemeDef , Token.opLetter = symbol , Token.identStart = letter <|> symbol , Token.identLetter = letter <|> symbol <|> digit , Token.reservedOpNames = ["'", "\"", ".", "+", "-"] }
425
schemeDef = Language.emptyDef { Token.commentStart = "" , Token.commentEnd = "" , Token.commentLine = ";" , Token.opStart = Token.opLetter schemeDef , Token.opLetter = symbol , Token.identStart = letter <|> symbol , Token.identLetter = letter <|> symbol <|> digit , Token.reservedOpNames = ["'", "\"", ".", "+", "-"] }
372
false
true
0
9
106
128
73
55
null
null
nirvinm/Solving-Exercises-in-Haskell-Programming-From-First-Principles
Applicative/src/Validation.hs
gpl-3.0
validToEither :: Validation e a -> Either e a validToEither (Failure err) = Left err
84
validToEither :: Validation e a -> Either e a validToEither (Failure err) = Left err
84
validToEither (Failure err) = Left err
38
false
true
0
7
14
37
17
20
null
null
zeyuanxy/haskell-playground
ninety-nine-haskell-problems/vol2/16.hs
mit
dropEvery :: [a] -> Int -> [a] dropEvery xs n = map fst $ filter ((/= n) . snd) $ zip xs (cycle [1..n])
103
dropEvery :: [a] -> Int -> [a] dropEvery xs n = map fst $ filter ((/= n) . snd) $ zip xs (cycle [1..n])
103
dropEvery xs n = map fst $ filter ((/= n) . snd) $ zip xs (cycle [1..n])
72
false
true
2
9
23
77
38
39
null
null
nikki-and-the-robots/nikki
src/Base/Grounds.hs
lgpl-3.0
mkMainLayer :: Indexable a -> Layer a mkMainLayer c = content ^= c $ initial
76
mkMainLayer :: Indexable a -> Layer a mkMainLayer c = content ^= c $ initial
76
mkMainLayer c = content ^= c $ initial
38
false
true
2
7
14
38
17
21
null
null
kim/amazonka
amazonka-s3/gen/Network/AWS/S3/GetObject.hs
mpl-2.0
-- | Last modified date of the object gorLastModified :: Lens' GetObjectResponse (Maybe UTCTime) gorLastModified = lens _gorLastModified (\s a -> s { _gorLastModified = a }) . mapping _Time
189
gorLastModified :: Lens' GetObjectResponse (Maybe UTCTime) gorLastModified = lens _gorLastModified (\s a -> s { _gorLastModified = a }) . mapping _Time
151
gorLastModified = lens _gorLastModified (\s a -> s { _gorLastModified = a }) . mapping _Time
92
true
true
0
10
29
53
28
25
null
null
alevy/postgresql-orm
src/Database/PostgreSQL/Devel.hs
gpl-3.0
pgDirectives92 :: FilePath -> [(String, String)] pgDirectives92 dir = map depluralize $ pgDirectives dir where depluralize ("unix_socket_directories", _) = ("unix_socket_directory" , "unix_socket_directory = '" ++ singleQuote dir ++ "'") depluralize kv = kv -- | Create a directory for a local database cluster entirely -- self-contained within one directory. This is accomplished by -- creating a new PostgreSQL database cluster in the directory and -- setting the following configuration options in @postgresql.conf@: -- -- * @listen_address@ is set to empty (i.e., @\'\'@), so that no TCP -- socket is bound, avoiding conflicts with any other running instaces -- of PostgreSQL. -- -- * @logging_collector@ is set to @yes@, so that all message logs are -- kept in the @pg_log@ subdirectory of the directory you specified. -- -- Note this function does /not/ start a postgres server after -- creating the directory. You will seperately need to start the -- server using 'startLocalDB' or 'initLocalDB'. (And note that -- 'initLocalDB' already calls @createLocalDB@ if the directory does -- not exist or is empty. Hence the primary use of this function is -- if you want to call 'configLocalDB' between 'createLocalDB' and -- 'startLocalDB'.)
1,279
pgDirectives92 :: FilePath -> [(String, String)] pgDirectives92 dir = map depluralize $ pgDirectives dir where depluralize ("unix_socket_directories", _) = ("unix_socket_directory" , "unix_socket_directory = '" ++ singleQuote dir ++ "'") depluralize kv = kv -- | Create a directory for a local database cluster entirely -- self-contained within one directory. This is accomplished by -- creating a new PostgreSQL database cluster in the directory and -- setting the following configuration options in @postgresql.conf@: -- -- * @listen_address@ is set to empty (i.e., @\'\'@), so that no TCP -- socket is bound, avoiding conflicts with any other running instaces -- of PostgreSQL. -- -- * @logging_collector@ is set to @yes@, so that all message logs are -- kept in the @pg_log@ subdirectory of the directory you specified. -- -- Note this function does /not/ start a postgres server after -- creating the directory. You will seperately need to start the -- server using 'startLocalDB' or 'initLocalDB'. (And note that -- 'initLocalDB' already calls @createLocalDB@ if the directory does -- not exist or is empty. Hence the primary use of this function is -- if you want to call 'configLocalDB' between 'createLocalDB' and -- 'startLocalDB'.)
1,279
pgDirectives92 dir = map depluralize $ pgDirectives dir where depluralize ("unix_socket_directories", _) = ("unix_socket_directory" , "unix_socket_directory = '" ++ singleQuote dir ++ "'") depluralize kv = kv -- | Create a directory for a local database cluster entirely -- self-contained within one directory. This is accomplished by -- creating a new PostgreSQL database cluster in the directory and -- setting the following configuration options in @postgresql.conf@: -- -- * @listen_address@ is set to empty (i.e., @\'\'@), so that no TCP -- socket is bound, avoiding conflicts with any other running instaces -- of PostgreSQL. -- -- * @logging_collector@ is set to @yes@, so that all message logs are -- kept in the @pg_log@ subdirectory of the directory you specified. -- -- Note this function does /not/ start a postgres server after -- creating the directory. You will seperately need to start the -- server using 'startLocalDB' or 'initLocalDB'. (And note that -- 'initLocalDB' already calls @createLocalDB@ if the directory does -- not exist or is empty. Hence the primary use of this function is -- if you want to call 'configLocalDB' between 'createLocalDB' and -- 'startLocalDB'.)
1,230
false
true
1
9
228
108
61
47
null
null
brendanhay/gogol
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/Campaigns/Patch.hs
mpl-2.0
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\"). cpUploadType :: Lens' CampaignsPatch (Maybe Text) cpUploadType = lens _cpUploadType (\ s a -> s{_cpUploadType = a})
188
cpUploadType :: Lens' CampaignsPatch (Maybe Text) cpUploadType = lens _cpUploadType (\ s a -> s{_cpUploadType = a})
117
cpUploadType = lens _cpUploadType (\ s a -> s{_cpUploadType = a})
67
true
true
1
9
28
52
25
27
null
null
beni55/Historical-Cryptography
Codec/Encryption/Historical/XOR/Analysis.hs
mit
crack_key_length :: Int -> Histogram a -> String -> Int crack_key_length keyLen h s = head $ sortBy (comparing best) [1..keyLen] where hv = histogramVar h best :: Int -> (Float, Int) best n = (abs (hv - compute n), n) compute :: Int -> Float compute n = average $ map (histogramVar . histogram) $ transpose $ chunksOf n s
395
crack_key_length :: Int -> Histogram a -> String -> Int crack_key_length keyLen h s = head $ sortBy (comparing best) [1..keyLen] where hv = histogramVar h best :: Int -> (Float, Int) best n = (abs (hv - compute n), n) compute :: Int -> Float compute n = average $ map (histogramVar . histogram) $ transpose $ chunksOf n s
395
crack_key_length keyLen h s = head $ sortBy (comparing best) [1..keyLen] where hv = histogramVar h best :: Int -> (Float, Int) best n = (abs (hv - compute n), n) compute :: Int -> Float compute n = average $ map (histogramVar . histogram) $ transpose $ chunksOf n s
339
false
true
9
10
134
151
76
75
null
null
rueshyna/gogol
gogol-civicinfo/gen/Network/Google/CivicInfo/Types/Product.hs
mpl-2.0
-- | Creates a value of 'Office' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'oDivisionId' -- -- * 'oRoles' -- -- * 'oOfficialIndices' -- -- * 'oSources' -- -- * 'oName' -- -- * 'oLevels' office :: Office office = Office' { _oDivisionId = Nothing , _oRoles = Nothing , _oOfficialIndices = Nothing , _oSources = Nothing , _oName = Nothing , _oLevels = Nothing }
485
office :: Office office = Office' { _oDivisionId = Nothing , _oRoles = Nothing , _oOfficialIndices = Nothing , _oSources = Nothing , _oName = Nothing , _oLevels = Nothing }
208
office = Office' { _oDivisionId = Nothing , _oRoles = Nothing , _oOfficialIndices = Nothing , _oSources = Nothing , _oName = Nothing , _oLevels = Nothing }
187
true
true
0
7
120
74
48
26
null
null
massysett/penny
penny/lib/Penny/Copper/Grammar.hs
bsd-3-clause
nextPostings = star nextPosting
31
nextPostings = star nextPosting
31
nextPostings = star nextPosting
31
false
false
0
5
3
9
4
5
null
null
LinuxUser404/haskell-mcint
src/SobolGen.hs
mit
-- to run external program dNFilePath = "./src/direction_numbers-joe-kuo-6.21201"
82
dNFilePath = "./src/direction_numbers-joe-kuo-6.21201"
54
dNFilePath = "./src/direction_numbers-joe-kuo-6.21201"
54
true
false
1
5
8
11
4
7
null
null
rueshyna/gogol
gogol-dataproc/gen/Network/Google/Dataproc/Types/Product.hs
mpl-2.0
-- | Creates a value of 'ListJobsResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ljrNextPageToken' -- -- * 'ljrJobs' listJobsResponse :: ListJobsResponse listJobsResponse = ListJobsResponse' { _ljrNextPageToken = Nothing , _ljrJobs = Nothing }
359
listJobsResponse :: ListJobsResponse listJobsResponse = ListJobsResponse' { _ljrNextPageToken = Nothing , _ljrJobs = Nothing }
146
listJobsResponse = ListJobsResponse' { _ljrNextPageToken = Nothing , _ljrJobs = Nothing }
105
true
true
1
7
72
39
23
16
null
null
heathweiss/Tricad
src/Tests/MathPolarTest.hs
gpl-2.0
slopeForXYAngleAndYslopeTestXPos1YPos10XY280 = TestCase $ assertEqual "slopeForXYAngleAndYslopeTestXPos1YPos10XY280" (NegSlope 2.721289529681512) (slopeAdjustedForVerticalAngle (PosXSlope 1) (PosYSlope 10) (Angle 280) )
227
slopeForXYAngleAndYslopeTestXPos1YPos10XY280 = TestCase $ assertEqual "slopeForXYAngleAndYslopeTestXPos1YPos10XY280" (NegSlope 2.721289529681512) (slopeAdjustedForVerticalAngle (PosXSlope 1) (PosYSlope 10) (Angle 280) )
227
slopeForXYAngleAndYslopeTestXPos1YPos10XY280 = TestCase $ assertEqual "slopeForXYAngleAndYslopeTestXPos1YPos10XY280" (NegSlope 2.721289529681512) (slopeAdjustedForVerticalAngle (PosXSlope 1) (PosYSlope 10) (Angle 280) )
227
false
false
0
8
23
53
25
28
null
null
karamellpelle/grid
source/Linear.hs
gpl-3.0
mat4Perspective :: Float -> Float -> Float -> Float -> Mat4 mat4Perspective fovy aspect near far = let ymax = near * tan (fovy * 0.5) ymin = -ymax xmax = ymax * aspect xmin = -xmax in Mat4 ((2 * near) / (xmax - xmin)) 0 0 0 0 ((2 * near) / (ymax - ymin)) 0 0 0 0 ((far + near) / (near - far)) (-1) 0 0 ((2 * far * near) / (near - far)) 0
411
mat4Perspective :: Float -> Float -> Float -> Float -> Mat4 mat4Perspective fovy aspect near far = let ymax = near * tan (fovy * 0.5) ymin = -ymax xmax = ymax * aspect xmin = -xmax in Mat4 ((2 * near) / (xmax - xmin)) 0 0 0 0 ((2 * near) / (ymax - ymin)) 0 0 0 0 ((far + near) / (near - far)) (-1) 0 0 ((2 * far * near) / (near - far)) 0
411
mat4Perspective fovy aspect near far = let ymax = near * tan (fovy * 0.5) ymin = -ymax xmax = ymax * aspect xmin = -xmax in Mat4 ((2 * near) / (xmax - xmin)) 0 0 0 0 ((2 * near) / (ymax - ymin)) 0 0 0 0 ((far + near) / (near - far)) (-1) 0 0 ((2 * far * near) / (near - far)) 0
351
false
true
0
12
154
210
112
98
null
null
sapek/pandoc
src/Text/Pandoc/Writers/Textile.hs
gpl-2.0
blockToTextile opts (Para inlines) = do useTags <- liftM stUseTags get listLevel <- liftM stListLevel get contents <- inlineListToTextile opts inlines return $ if useTags then "<p>" ++ contents ++ "</p>" else contents ++ if null listLevel then "\n" else ""
292
blockToTextile opts (Para inlines) = do useTags <- liftM stUseTags get listLevel <- liftM stListLevel get contents <- inlineListToTextile opts inlines return $ if useTags then "<p>" ++ contents ++ "</p>" else contents ++ if null listLevel then "\n" else ""
292
blockToTextile opts (Para inlines) = do useTags <- liftM stUseTags get listLevel <- liftM stListLevel get contents <- inlineListToTextile opts inlines return $ if useTags then "<p>" ++ contents ++ "</p>" else contents ++ if null listLevel then "\n" else ""
292
false
false
0
11
76
91
43
48
null
null
ezyang/ghc
testsuite/tests/patsyn/should_run/T11224.hs
bsd-3-clause
bar :: String -> Int bar (readMaybe -> Just x) = (x::Int)
58
bar :: String -> Int bar (readMaybe -> Just x) = (x::Int)
58
bar (readMaybe -> Just x) = (x::Int)
37
false
true
0
7
12
38
19
19
null
null
chreekat/snowdrift
Handler/ProjectBlog.hs
agpl-3.0
-------------------------------------------------------------------------------- -- /p/#Text/blog/#Text/c/#CommentId/tag/#TagId getBlogPostCommentTagR :: Text -> Text -> CommentId -> TagId -> Handler Html getBlogPostCommentTagR _ _ = getCommentTagR
249
getBlogPostCommentTagR :: Text -> Text -> CommentId -> TagId -> Handler Html getBlogPostCommentTagR _ _ = getCommentTagR
120
getBlogPostCommentTagR _ _ = getCommentTagR
43
true
true
0
9
20
37
19
18
null
null
ggreif/clash-compiler
clash-systemverilog/src/CLaSH/Backend/SystemVerilog.hs
bsd-2-clause
expr_ _ (Identifier id_ (Just (Indexed ((Vector _ elTy),1,1)))) = do id' <- fmap (displayT . renderOneLine) (text id_ <> brackets (int 0)) simpleFromSLV elTy id'
165
expr_ _ (Identifier id_ (Just (Indexed ((Vector _ elTy),1,1)))) = do id' <- fmap (displayT . renderOneLine) (text id_ <> brackets (int 0)) simpleFromSLV elTy id'
165
expr_ _ (Identifier id_ (Just (Indexed ((Vector _ elTy),1,1)))) = do id' <- fmap (displayT . renderOneLine) (text id_ <> brackets (int 0)) simpleFromSLV elTy id'
165
false
false
0
14
29
94
46
48
null
null
RaphaelJ/getwebb.org
Handler/Download.hs
gpl-3.0
-- | Responds with a file contained in an archive of an upload. getDownloadArchiveR :: Hmac -> Hmac -> Handler TypedContent getDownloadArchiveR hmac archiveHmac = do (file, uploadId, archiveFile, h) <- runDB $ do Entity uploadId upload <- getBy404 $ UniqueUploadHmac hmac Entity _ archiveFile <- getBy404 $ UniqueArchiveFileHmac archiveHmac when (archiveFileFile archiveFile /= uploadFile upload) notFound file <- getJust $ uploadFile upload -- Opens the file inside the transaction to ensure data consistency. h <- lift $ safeOpenFile file Original return (file, uploadId, archiveFile, h) fileBs'<- liftIO $ L.hGetContents h let fileBs = case fileCompressed file of Just _ -> decompress fileBs' Nothing -> fileBs' path = archiveFilePath archiveFile Just entry = Z.findEntryByPath (T.unpack path) $ Z.toArchive fileBs mime = defaultMimeLookup path size = word64 $ Z.eUncompressedSize entry bs <- getTrackedBS True uploadId (Z.fromEntry entry) streamByteString [h] bs mime (Just size) -- HTTP streaming --------------------------------------------------------------
1,240
getDownloadArchiveR :: Hmac -> Hmac -> Handler TypedContent getDownloadArchiveR hmac archiveHmac = do (file, uploadId, archiveFile, h) <- runDB $ do Entity uploadId upload <- getBy404 $ UniqueUploadHmac hmac Entity _ archiveFile <- getBy404 $ UniqueArchiveFileHmac archiveHmac when (archiveFileFile archiveFile /= uploadFile upload) notFound file <- getJust $ uploadFile upload -- Opens the file inside the transaction to ensure data consistency. h <- lift $ safeOpenFile file Original return (file, uploadId, archiveFile, h) fileBs'<- liftIO $ L.hGetContents h let fileBs = case fileCompressed file of Just _ -> decompress fileBs' Nothing -> fileBs' path = archiveFilePath archiveFile Just entry = Z.findEntryByPath (T.unpack path) $ Z.toArchive fileBs mime = defaultMimeLookup path size = word64 $ Z.eUncompressedSize entry bs <- getTrackedBS True uploadId (Z.fromEntry entry) streamByteString [h] bs mime (Just size) -- HTTP streaming --------------------------------------------------------------
1,176
getDownloadArchiveR hmac archiveHmac = do (file, uploadId, archiveFile, h) <- runDB $ do Entity uploadId upload <- getBy404 $ UniqueUploadHmac hmac Entity _ archiveFile <- getBy404 $ UniqueArchiveFileHmac archiveHmac when (archiveFileFile archiveFile /= uploadFile upload) notFound file <- getJust $ uploadFile upload -- Opens the file inside the transaction to ensure data consistency. h <- lift $ safeOpenFile file Original return (file, uploadId, archiveFile, h) fileBs'<- liftIO $ L.hGetContents h let fileBs = case fileCompressed file of Just _ -> decompress fileBs' Nothing -> fileBs' path = archiveFilePath archiveFile Just entry = Z.findEntryByPath (T.unpack path) $ Z.toArchive fileBs mime = defaultMimeLookup path size = word64 $ Z.eUncompressedSize entry bs <- getTrackedBS True uploadId (Z.fromEntry entry) streamByteString [h] bs mime (Just size) -- HTTP streaming --------------------------------------------------------------
1,116
true
true
0
14
321
314
148
166
null
null
urbanslug/ghc
testsuite/tests/module/mod104.hs
bsd-3-clause
--import Prelude head = "head"
31
head = "head"
13
head = "head"
13
true
false
0
4
5
7
4
3
null
null
jacekszymanski/wxHaskell
wx/src/Graphics/UI/WX/Attributes.hs
lgpl-2.1
findProperty :: Typeable a => Attr w a -> a -> [Prop w] -> Maybe (a,[Prop w]) findProperty attr def props = case filterProperty attr props of (PropValue x, ps) -> Just (x,ps) (PropModify f, ps) -> Just (f def,ps) (PropNone, _ps) -> Nothing -- | Transform the properties based on a style property.
323
findProperty :: Typeable a => Attr w a -> a -> [Prop w] -> Maybe (a,[Prop w]) findProperty attr def props = case filterProperty attr props of (PropValue x, ps) -> Just (x,ps) (PropModify f, ps) -> Just (f def,ps) (PropNone, _ps) -> Nothing -- | Transform the properties based on a style property.
323
findProperty attr def props = case filterProperty attr props of (PropValue x, ps) -> Just (x,ps) (PropModify f, ps) -> Just (f def,ps) (PropNone, _ps) -> Nothing -- | Transform the properties based on a style property.
245
false
true
6
12
80
135
70
65
null
null
rueshyna/gogol
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
mpl-2.0
-- | Specifies the projection format of the video. vcdProjection :: Lens' VideoContentDetails (Maybe VideoContentDetailsProjection) vcdProjection = lens _vcdProjection (\ s a -> s{_vcdProjection = a})
208
vcdProjection :: Lens' VideoContentDetails (Maybe VideoContentDetailsProjection) vcdProjection = lens _vcdProjection (\ s a -> s{_vcdProjection = a})
157
vcdProjection = lens _vcdProjection (\ s a -> s{_vcdProjection = a})
76
true
true
0
9
33
48
25
23
null
null
beni55/pandoc
src/Text/Pandoc/Writers/Markdown.hs
gpl-2.0
olMarker :: GenParser Char ParserState Char olMarker = do (start, style', delim) <- anyOrderedListMarker if delim == Period && (style' == UpperAlpha || (style' == UpperRoman && start `elem` [1, 5, 10, 50, 100, 500, 1000])) then spaceChar >> spaceChar else spaceChar -- | True if string begins with an ordered list marker
440
olMarker :: GenParser Char ParserState Char olMarker = do (start, style', delim) <- anyOrderedListMarker if delim == Period && (style' == UpperAlpha || (style' == UpperRoman && start `elem` [1, 5, 10, 50, 100, 500, 1000])) then spaceChar >> spaceChar else spaceChar -- | True if string begins with an ordered list marker
440
olMarker = do (start, style', delim) <- anyOrderedListMarker if delim == Period && (style' == UpperAlpha || (style' == UpperRoman && start `elem` [1, 5, 10, 50, 100, 500, 1000])) then spaceChar >> spaceChar else spaceChar -- | True if string begins with an ordered list marker
396
false
true
0
14
172
107
61
46
null
null
chrisprobst/haskell-chess
Chess/Moves.hs
bsd-3-clause
rookMoves :: Board -> Color -> (Int, Int) -> [((Int, Int), MColoredPiece)] rookMoves board color coords = up ++ down ++ left ++ right where positions dir = collectPieces board color dir 8 coords up = positions N down = positions S left = positions W right = positions E
291
rookMoves :: Board -> Color -> (Int, Int) -> [((Int, Int), MColoredPiece)] rookMoves board color coords = up ++ down ++ left ++ right where positions dir = collectPieces board color dir 8 coords up = positions N down = positions S left = positions W right = positions E
291
rookMoves board color coords = up ++ down ++ left ++ right where positions dir = collectPieces board color dir 8 coords up = positions N down = positions S left = positions W right = positions E
216
false
true
4
12
71
134
62
72
null
null
HairyDude/heal
Utils.hs
bsd-2-clause
maybeRead _ = Nothing
21
maybeRead _ = Nothing
21
maybeRead _ = Nothing
21
false
false
0
4
3
10
4
6
null
null
ekohl/ganeti
htools/Ganeti/HTools/QC.hs
gpl-2.0
-- * Helper functions -- | Simple checker for whether OpResult is fail or pass isFailure :: Types.OpResult a -> Bool isFailure (Types.OpFail _) = True
151
isFailure :: Types.OpResult a -> Bool isFailure (Types.OpFail _) = True
71
isFailure (Types.OpFail _) = True
33
true
true
0
8
26
33
17
16
null
null
glguy/prelude-extras
src/Prelude/Extras.hs
bsd-3-clause
reads2 :: (Read2 f, Read a, Read b) => ReadS (f a b) reads2 = readsPrec2 minPrec
80
reads2 :: (Read2 f, Read a, Read b) => ReadS (f a b) reads2 = readsPrec2 minPrec
80
reads2 = readsPrec2 minPrec
27
false
true
0
8
16
46
23
23
null
null
shapr/ghclive
src-main/Main.hs
bsd-3-clause
jsonError :: String -> J.Value jsonError msg = J.object [ "error" .= msg ]
74
jsonError :: String -> J.Value jsonError msg = J.object [ "error" .= msg ]
74
jsonError msg = J.object [ "error" .= msg ]
43
false
true
0
8
13
37
17
20
null
null
svalaskevicius/hob
src/lib/Hob/Ui/Editor/Search.hs
gpl-3.0
replaceStringQuark :: IO Quark replaceStringQuark = quarkFromString "activeReplaceString"
89
replaceStringQuark :: IO Quark replaceStringQuark = quarkFromString "activeReplaceString"
89
replaceStringQuark = quarkFromString "activeReplaceString"
58
false
true
0
5
7
17
8
9
null
null
shouya/projz
assembler/Assembler.hs
bsd-2-clause
parseSourceArgs [p] = liftM (:[]) $ parseSourceArg p
52
parseSourceArgs [p] = liftM (:[]) $ parseSourceArg p
52
parseSourceArgs [p] = liftM (:[]) $ parseSourceArg p
52
false
false
0
8
7
28
14
14
null
null
k0001/haskell-opaleye
Opaleye/Internal/PrimQuery.hs
bsd-3-clause
foldPrimQuery :: PrimQueryFold p -> PrimQuery -> p foldPrimQuery (unit, baseTable, product, aggregate, order, limit, join, values, binary) = fold where fold primQ = case primQ of Unit -> unit BaseTable n s -> baseTable n s Product pqs pes -> product (fmap fold pqs) pes Aggregate aggrs pq -> aggregate aggrs (fold pq) Order pes pq -> order pes (fold pq) Limit op pq -> limit op (fold pq) Join j pes cond q1 q2 -> join j pes cond (fold q1) (fold q2) Values ss pes -> values ss pes Binary binop pes (pq, pq') -> binary binop pes (fold pq, fold pq')
817
foldPrimQuery :: PrimQueryFold p -> PrimQuery -> p foldPrimQuery (unit, baseTable, product, aggregate, order, limit, join, values, binary) = fold where fold primQ = case primQ of Unit -> unit BaseTable n s -> baseTable n s Product pqs pes -> product (fmap fold pqs) pes Aggregate aggrs pq -> aggregate aggrs (fold pq) Order pes pq -> order pes (fold pq) Limit op pq -> limit op (fold pq) Join j pes cond q1 q2 -> join j pes cond (fold q1) (fold q2) Values ss pes -> values ss pes Binary binop pes (pq, pq') -> binary binop pes (fold pq, fold pq')
817
foldPrimQuery (unit, baseTable, product, aggregate, order, limit, join, values, binary) = fold where fold primQ = case primQ of Unit -> unit BaseTable n s -> baseTable n s Product pqs pes -> product (fmap fold pqs) pes Aggregate aggrs pq -> aggregate aggrs (fold pq) Order pes pq -> order pes (fold pq) Limit op pq -> limit op (fold pq) Join j pes cond q1 q2 -> join j pes cond (fold q1) (fold q2) Values ss pes -> values ss pes Binary binop pes (pq, pq') -> binary binop pes (fold pq, fold pq')
766
false
true
1
10
375
280
134
146
null
null
rvion/lamdu
test/Formatting.hs
gpl-3.0
ansiRed :: String ansiRed = "\ESC[31m"
38
ansiRed :: String ansiRed = "\ESC[31m"
38
ansiRed = "\ESC[31m"
20
false
true
0
4
5
11
6
5
null
null
marcellussiegburg/autotool
collection/src/Expression/Tokens.hs
gpl-2.0
semiSep1 = P.semiSep1 me
31
semiSep1 = P.semiSep1 me
31
semiSep1 = P.semiSep1 me
31
false
false
0
6
10
11
5
6
null
null
imuli/gitit
Network/Gitit/Export.hs
gpl-2.0
respondRST :: String -> Pandoc -> Handler respondRST = respondS "rst" "text/plain; charset=utf-8" "" writeRST defaultRespOptions{writerReferenceLinks = True}
159
respondRST :: String -> Pandoc -> Handler respondRST = respondS "rst" "text/plain; charset=utf-8" "" writeRST defaultRespOptions{writerReferenceLinks = True}
159
respondRST = respondS "rst" "text/plain; charset=utf-8" "" writeRST defaultRespOptions{writerReferenceLinks = True}
117
false
true
0
7
19
40
20
20
null
null
orclev/GELF
test/Suite.hs
lgpl-3.0
main :: IO () -- main = defaultMain tests main = defaultMainWithOpts tests runnerOptions
88
main :: IO () main = defaultMainWithOpts tests runnerOptions
60
main = defaultMainWithOpts tests runnerOptions
46
true
true
1
6
13
25
11
14
null
null
ihc/futhark
src/Futhark/CodeGen/Backends/GenericPython.hs
isc
extValueDescName (Imp.OpaqueValue desc (v:_)) = extName $ zEncodeString desc ++ "_" ++ pretty (baseTag (valueDescVName v))
124
extValueDescName (Imp.OpaqueValue desc (v:_)) = extName $ zEncodeString desc ++ "_" ++ pretty (baseTag (valueDescVName v))
124
extValueDescName (Imp.OpaqueValue desc (v:_)) = extName $ zEncodeString desc ++ "_" ++ pretty (baseTag (valueDescVName v))
124
false
false
0
10
17
56
27
29
null
null
psibi/cabal2nix
src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs
bsd-3-clause
pkg :: Identifier -> Binding pkg i = create binding (i, create path ["pkgs",i])
79
pkg :: Identifier -> Binding pkg i = create binding (i, create path ["pkgs",i])
79
pkg i = create binding (i, create path ["pkgs",i])
50
false
true
0
8
13
45
22
23
null
null
s4ke/101lang
s1.hs
apache-2.0
s1 = Declare "x" (Constant (NumVal 150)) (Declare "y" (Constant (NumVal 200)) (Seq (While (Greater (Variable "x" ) (Constant (NumVal 0)) ) (Seq (Assign "x" (Minus (Variable "x") (Constant (NumVal 1)) ) ) (Assign "y" (Minus (Variable "y") (Constant (NumVal 1)) ) ) ) ) (Print (Variable "y")) ) )
714
s1 = Declare "x" (Constant (NumVal 150)) (Declare "y" (Constant (NumVal 200)) (Seq (While (Greater (Variable "x" ) (Constant (NumVal 0)) ) (Seq (Assign "x" (Minus (Variable "x") (Constant (NumVal 1)) ) ) (Assign "y" (Minus (Variable "y") (Constant (NumVal 1)) ) ) ) ) (Print (Variable "y")) ) )
714
s1 = Declare "x" (Constant (NumVal 150)) (Declare "y" (Constant (NumVal 200)) (Seq (While (Greater (Variable "x" ) (Constant (NumVal 0)) ) (Seq (Assign "x" (Minus (Variable "x") (Constant (NumVal 1)) ) ) (Assign "y" (Minus (Variable "y") (Constant (NumVal 1)) ) ) ) ) (Print (Variable "y")) ) )
714
false
false
1
20
469
182
88
94
null
null
typelead/epm
Cabal/Distribution/Simple/Utils.hs
bsd-3-clause
listUnionRight :: (Ord a) => [a] -> [a] -> [a] listUnionRight a b = ordNubRight (filter (`Set.notMember` bSet) a) ++ b where bSet = Set.fromList b
152
listUnionRight :: (Ord a) => [a] -> [a] -> [a] listUnionRight a b = ordNubRight (filter (`Set.notMember` bSet) a) ++ b where bSet = Set.fromList b
152
listUnionRight a b = ordNubRight (filter (`Set.notMember` bSet) a) ++ b where bSet = Set.fromList b
105
false
true
0
9
31
78
42
36
null
null
rfranek/duckling
tests/Duckling/Temperature/Tests.hs
bsd-3-clause
tests :: TestTree tests = testGroup "Temperature Tests" [ EN.tests , ES.tests , FR.tests , GA.tests , HR.tests , IT.tests , JA.tests , KO.tests , PT.tests , RO.tests , ZH.tests ]
202
tests :: TestTree tests = testGroup "Temperature Tests" [ EN.tests , ES.tests , FR.tests , GA.tests , HR.tests , IT.tests , JA.tests , KO.tests , PT.tests , RO.tests , ZH.tests ]
202
tests = testGroup "Temperature Tests" [ EN.tests , ES.tests , FR.tests , GA.tests , HR.tests , IT.tests , JA.tests , KO.tests , PT.tests , RO.tests , ZH.tests ]
184
false
true
0
7
54
79
42
37
null
null
eckyputrady/haskell-scotty-realworld-example-app
src/Misc/Client.hs
mit
followUser :: (RW r m) => Token -> Username -> m (Either (Err UserError) Profile) followUser token username = runExceptT $ do url <- buildUrl $ "/profiles/" <> unpack username <> "/follow" let body = Aeson.toJSON $ asText "" let opts = defaults & authHeader token profileWrapperProfile <$> exec (postWith opts url body)
327
followUser :: (RW r m) => Token -> Username -> m (Either (Err UserError) Profile) followUser token username = runExceptT $ do url <- buildUrl $ "/profiles/" <> unpack username <> "/follow" let body = Aeson.toJSON $ asText "" let opts = defaults & authHeader token profileWrapperProfile <$> exec (postWith opts url body)
327
followUser token username = runExceptT $ do url <- buildUrl $ "/profiles/" <> unpack username <> "/follow" let body = Aeson.toJSON $ asText "" let opts = defaults & authHeader token profileWrapperProfile <$> exec (postWith opts url body)
245
false
true
0
13
60
137
63
74
null
null
sdiehl/ghc
libraries/base/GHC/Show.hs
bsd-3-clause
showLitString ('"' : cs) s = showString "\\\"" (showLitString cs s)
67
showLitString ('"' : cs) s = showString "\\\"" (showLitString cs s)
67
showLitString ('"' : cs) s = showString "\\\"" (showLitString cs s)
67
false
false
1
7
10
33
15
18
null
null
cje/system-log-transform
src/Parser.hs
cc0-1.0
term :: Parser TermC term = do AP.takeWhile AP.isHorizontalSpace AP.choice [ -- These are evaluated in the order they are listed -- and the first parser to succeed is the return value -- AP.endOfLine *> pure EndOfLineC -- , AP.endOfInput *> pure EndOfLineC DatetimeC <$> datetime , IPv4C <$> ipv4 , IntegerC <$> integer , TextC <$> text ] -- RFC 3164 style date parser.
561
term :: Parser TermC term = do AP.takeWhile AP.isHorizontalSpace AP.choice [ -- These are evaluated in the order they are listed -- and the first parser to succeed is the return value -- AP.endOfLine *> pure EndOfLineC -- , AP.endOfInput *> pure EndOfLineC DatetimeC <$> datetime , IPv4C <$> ipv4 , IntegerC <$> integer , TextC <$> text ] -- RFC 3164 style date parser.
560
term = do AP.takeWhile AP.isHorizontalSpace AP.choice [ -- These are evaluated in the order they are listed -- and the first parser to succeed is the return value -- AP.endOfLine *> pure EndOfLineC -- , AP.endOfInput *> pure EndOfLineC DatetimeC <$> datetime , IPv4C <$> ipv4 , IntegerC <$> integer , TextC <$> text ] -- RFC 3164 style date parser.
539
false
true
0
9
256
65
35
30
null
null
peter-fogg/pardoc
src/Text/Pandoc/Writers/ICML.hs
gpl-2.0
-- | Convert Pandoc document to string in ICML format. writeICML :: WriterOptions -> Pandoc -> String writeICML opts (Pandoc meta blocks) = let colwidth = if writerWrapText opts then Just $ writerColumns opts else Nothing render' = render colwidth renderMeta f s = Just $ render' $ fst $ runState (f opts [] s) defaultWriterState Just metadata = metaToJSON opts (renderMeta blocksToICML) (renderMeta inlinesToICML) meta (doc, st) = runState (blocksToICML opts [] blocks) defaultWriterState main = render' doc context = defField "body" main $ defField "charStyles" (render' $ charStylesToDoc st) $ defField "parStyles" (render' $ parStylesToDoc st) $ defField "hyperlinks" (render' $ hyperlinksToDoc $ links st) $ metadata in if writerStandalone opts then renderTemplate' (writerTemplate opts) context else main
1,020
writeICML :: WriterOptions -> Pandoc -> String writeICML opts (Pandoc meta blocks) = let colwidth = if writerWrapText opts then Just $ writerColumns opts else Nothing render' = render colwidth renderMeta f s = Just $ render' $ fst $ runState (f opts [] s) defaultWriterState Just metadata = metaToJSON opts (renderMeta blocksToICML) (renderMeta inlinesToICML) meta (doc, st) = runState (blocksToICML opts [] blocks) defaultWriterState main = render' doc context = defField "body" main $ defField "charStyles" (render' $ charStylesToDoc st) $ defField "parStyles" (render' $ parStylesToDoc st) $ defField "hyperlinks" (render' $ hyperlinksToDoc $ links st) $ metadata in if writerStandalone opts then renderTemplate' (writerTemplate opts) context else main
965
writeICML opts (Pandoc meta blocks) = let colwidth = if writerWrapText opts then Just $ writerColumns opts else Nothing render' = render colwidth renderMeta f s = Just $ render' $ fst $ runState (f opts [] s) defaultWriterState Just metadata = metaToJSON opts (renderMeta blocksToICML) (renderMeta inlinesToICML) meta (doc, st) = runState (blocksToICML opts [] blocks) defaultWriterState main = render' doc context = defField "body" main $ defField "charStyles" (render' $ charStylesToDoc st) $ defField "parStyles" (render' $ parStylesToDoc st) $ defField "hyperlinks" (render' $ hyperlinksToDoc $ links st) $ metadata in if writerStandalone opts then renderTemplate' (writerTemplate opts) context else main
918
true
true
0
16
329
273
134
139
null
null
brendanhay/gogol
gogol-cloudkms/gen/Network/Google/CloudKMS/Types/Product.hs
mpl-2.0
-- | \`etag\` is used for optimistic concurrency control as a way to help -- prevent simultaneous updates of a policy from overwriting each other. It -- is strongly suggested that systems make use of the \`etag\` in the -- read-modify-write cycle to perform policy updates in order to avoid race -- conditions: An \`etag\` is returned in the response to \`getIamPolicy\`, -- and systems are expected to put that etag in the request to -- \`setIamPolicy\` to ensure that their change will be applied to the same -- version of the policy. **Important:** If you use IAM Conditions, you -- must include the \`etag\` field whenever you call \`setIamPolicy\`. If -- you omit this field, then IAM allows you to overwrite a version \`3\` -- policy with a version \`1\` policy, and all of the conditions in the -- version \`3\` policy are lost. pEtag :: Lens' Policy (Maybe ByteString) pEtag = lens _pEtag (\ s a -> s{_pEtag = a}) . mapping _Bytes
946
pEtag :: Lens' Policy (Maybe ByteString) pEtag = lens _pEtag (\ s a -> s{_pEtag = a}) . mapping _Bytes
110
pEtag = lens _pEtag (\ s a -> s{_pEtag = a}) . mapping _Bytes
69
true
true
0
10
172
66
39
27
null
null
GAumala/PiAssist
input-script-parser/src/InputModels.hs
gpl-3.0
arrowsToCode :: ArrowCombination -> InputCode arrowsToCode NO_ARROWS = 0
73
arrowsToCode :: ArrowCombination -> InputCode arrowsToCode NO_ARROWS = 0
73
arrowsToCode NO_ARROWS = 0
27
false
true
0
5
9
18
9
9
null
null
arnizamani/aiw
Instances.hs
gpl-2.0
ltmNotmember :: Axiom -> LTM -> Bool ltmNotmember ax (Ltm fc axs) = if containsVarAx ax then Set.notMember ax axs else Set.notMember ax fc
202
ltmNotmember :: Axiom -> LTM -> Bool ltmNotmember ax (Ltm fc axs) = if containsVarAx ax then Set.notMember ax axs else Set.notMember ax fc
202
ltmNotmember ax (Ltm fc axs) = if containsVarAx ax then Set.notMember ax axs else Set.notMember ax fc
165
false
true
0
10
87
62
29
33
null
null
sebastiaanvisser/haha
src/Graphics/Ascii/Haha/Geometry.hs
bsd-3-clause
centroidPoly :: Fractional u => Poly u -> Point u centroidPoly (Poly xs) = Point (sum (map _x xs) / n) (sum (map _y xs) / n) where n = fromIntegral $ length xs
161
centroidPoly :: Fractional u => Poly u -> Point u centroidPoly (Poly xs) = Point (sum (map _x xs) / n) (sum (map _y xs) / n) where n = fromIntegral $ length xs
161
centroidPoly (Poly xs) = Point (sum (map _x xs) / n) (sum (map _y xs) / n) where n = fromIntegral $ length xs
111
false
true
0
10
35
93
44
49
null
null
facebookincubator/duckling
Duckling/Temperature/EN/Rules.hs
bsd-3-clause
ruleTemperatureBelowZero :: Rule ruleTemperatureBelowZero = Rule { name = "<temp> below zero" , pattern = [ Predicate $ isValueOnly True , regex "below zero" ] , prod = \case (Token Temperature td@TemperatureData {TTemperature.value = Just v}: _) -> case TTemperature.unit td of Nothing -> Just . Token Temperature . withUnit TTemperature.Degree $ td {TTemperature.value = Just (- v)} _ -> Just . Token Temperature $ td {TTemperature.value = Just (- v)} _ -> Nothing }
533
ruleTemperatureBelowZero :: Rule ruleTemperatureBelowZero = Rule { name = "<temp> below zero" , pattern = [ Predicate $ isValueOnly True , regex "below zero" ] , prod = \case (Token Temperature td@TemperatureData {TTemperature.value = Just v}: _) -> case TTemperature.unit td of Nothing -> Just . Token Temperature . withUnit TTemperature.Degree $ td {TTemperature.value = Just (- v)} _ -> Just . Token Temperature $ td {TTemperature.value = Just (- v)} _ -> Nothing }
533
ruleTemperatureBelowZero = Rule { name = "<temp> below zero" , pattern = [ Predicate $ isValueOnly True , regex "below zero" ] , prod = \case (Token Temperature td@TemperatureData {TTemperature.value = Just v}: _) -> case TTemperature.unit td of Nothing -> Just . Token Temperature . withUnit TTemperature.Degree $ td {TTemperature.value = Just (- v)} _ -> Just . Token Temperature $ td {TTemperature.value = Just (- v)} _ -> Nothing }
500
false
true
0
19
139
188
95
93
null
null
audreyt/stringtable-atom
src/StringTable/AtomSet.hs
bsd-3-clause
map :: (Atom->Atom) -> AtomSet -> AtomSet map x y = MkAtomSet (IS.map ((\f -> fromAtom . f . unsafeIntToAtom) x) (fromAtomSet y))
129
map :: (Atom->Atom) -> AtomSet -> AtomSet map x y = MkAtomSet (IS.map ((\f -> fromAtom . f . unsafeIntToAtom) x) (fromAtomSet y))
129
map x y = MkAtomSet (IS.map ((\f -> fromAtom . f . unsafeIntToAtom) x) (fromAtomSet y))
87
false
true
0
13
22
76
38
38
null
null
ndmitchell/tagsoup
test/TagSoup/Generate/Type.hs
bsd-3-clause
isPattAny _ = False
19
isPattAny _ = False
19
isPattAny _ = False
19
false
false
0
5
3
9
4
5
null
null
runjak/projectEuler
src/Problem22.hs
mit
alphaScore :: String -> Integer alphaScore = sum . fmap (flip (-) 64 . toInteger . fromEnum)
92
alphaScore :: String -> Integer alphaScore = sum . fmap (flip (-) 64 . toInteger . fromEnum)
92
alphaScore = sum . fmap (flip (-) 64 . toInteger . fromEnum)
60
false
true
0
10
16
40
21
19
null
null
mettekou/ghc
compiler/iface/IfaceType.hs
bsd-3-clause
ppr_iface_tc_app :: (TyPrec -> a -> SDoc) -> TyPrec -> IfaceTyCon -> [a] -> SDoc ppr_iface_tc_app pp _ tc [ty] | tc `ifaceTyConHasKey` listTyConKey = pprPromotionQuote tc <> brackets (pp TopPrec ty) | tc `ifaceTyConHasKey` parrTyConKey = pprPromotionQuote tc <> paBrackets (pp TopPrec ty)
292
ppr_iface_tc_app :: (TyPrec -> a -> SDoc) -> TyPrec -> IfaceTyCon -> [a] -> SDoc ppr_iface_tc_app pp _ tc [ty] | tc `ifaceTyConHasKey` listTyConKey = pprPromotionQuote tc <> brackets (pp TopPrec ty) | tc `ifaceTyConHasKey` parrTyConKey = pprPromotionQuote tc <> paBrackets (pp TopPrec ty)
292
ppr_iface_tc_app pp _ tc [ty] | tc `ifaceTyConHasKey` listTyConKey = pprPromotionQuote tc <> brackets (pp TopPrec ty) | tc `ifaceTyConHasKey` parrTyConKey = pprPromotionQuote tc <> paBrackets (pp TopPrec ty)
211
false
true
1
9
47
116
58
58
null
null
fffej/Keyword-Search
Porter.hs
bsd-2-clause
measure :: T.Text -> Int measure = length . filter not . init . (True:) . map head . group . byIndex (map . isConsonant)
120
measure :: T.Text -> Int measure = length . filter not . init . (True:) . map head . group . byIndex (map . isConsonant)
120
measure = length . filter not . init . (True:) . map head . group . byIndex (map . isConsonant)
95
false
true
0
11
24
61
31
30
null
null
frantisekfarka/ghc-dsi
libraries/base/GHC/IO/Handle/Text.hs
bsd-3-clause
-- #define CHARBUF_UTF16 -- NB. performance-critical code: eyeball the Core. unpack :: RawCharBuffer -> Int -> Int -> [Char] -> IO [Char] unpack !buf !r !w acc0 | r == w = return acc0 | otherwise = withRawBuffer buf $ \pbuf -> let unpackRB acc !i | i < r = return acc | otherwise = do -- Here, we are rather careful to only put an *evaluated* character -- in the output string. Due to pointer tagging, this allows the consumer -- to avoid ping-ponging between the actual consumer code and the thunk code #ifdef CHARBUF_UTF16 -- reverse-order decoding of UTF-16 c2 <- peekElemOff pbuf i if (c2 < 0xdc00 || c2 > 0xdffff) then unpackRB (unsafeChr (fromIntegral c2) : acc) (i-1) else do c1 <- peekElemOff pbuf (i-1) let c = (fromIntegral c1 - 0xd800) * 0x400 + (fromIntegral c2 - 0xdc00) + 0x10000 case desurrogatifyRoundtripCharacter (unsafeChr c) of { C# c# -> unpackRB (C# c# : acc) (i-2) } #else c <- peekElemOff pbuf i unpackRB (c : acc) (i-1) #endif in unpackRB acc0 (w-1)
1,281
unpack :: RawCharBuffer -> Int -> Int -> [Char] -> IO [Char] unpack !buf !r !w acc0 | r == w = return acc0 | otherwise = withRawBuffer buf $ \pbuf -> let unpackRB acc !i | i < r = return acc | otherwise = do -- Here, we are rather careful to only put an *evaluated* character -- in the output string. Due to pointer tagging, this allows the consumer -- to avoid ping-ponging between the actual consumer code and the thunk code #ifdef CHARBUF_UTF16 -- reverse-order decoding of UTF-16 c2 <- peekElemOff pbuf i if (c2 < 0xdc00 || c2 > 0xdffff) then unpackRB (unsafeChr (fromIntegral c2) : acc) (i-1) else do c1 <- peekElemOff pbuf (i-1) let c = (fromIntegral c1 - 0xd800) * 0x400 + (fromIntegral c2 - 0xdc00) + 0x10000 case desurrogatifyRoundtripCharacter (unsafeChr c) of { C# c# -> unpackRB (C# c# : acc) (i-2) } #else c <- peekElemOff pbuf i unpackRB (c : acc) (i-1) #endif in unpackRB acc0 (w-1)
1,203
unpack !buf !r !w acc0 | r == w = return acc0 | otherwise = withRawBuffer buf $ \pbuf -> let unpackRB acc !i | i < r = return acc | otherwise = do -- Here, we are rather careful to only put an *evaluated* character -- in the output string. Due to pointer tagging, this allows the consumer -- to avoid ping-ponging between the actual consumer code and the thunk code #ifdef CHARBUF_UTF16 -- reverse-order decoding of UTF-16 c2 <- peekElemOff pbuf i if (c2 < 0xdc00 || c2 > 0xdffff) then unpackRB (unsafeChr (fromIntegral c2) : acc) (i-1) else do c1 <- peekElemOff pbuf (i-1) let c = (fromIntegral c1 - 0xd800) * 0x400 + (fromIntegral c2 - 0xdc00) + 0x10000 case desurrogatifyRoundtripCharacter (unsafeChr c) of { C# c# -> unpackRB (C# c# : acc) (i-2) } #else c <- peekElemOff pbuf i unpackRB (c : acc) (i-1) #endif in unpackRB acc0 (w-1)
1,142
true
true
1
25
484
323
159
164
null
null
karamellpelle/grid
designer/source/Game/LevelPuzzleMode/LevelPuzzleWorld/Room.hs
gpl-3.0
dottelearrayAt :: DotTeleArray -> UInt -> IO DotTele dottelearrayAt array ix = unsafeRead array (fI ix)
108
dottelearrayAt :: DotTeleArray -> UInt -> IO DotTele dottelearrayAt array ix = unsafeRead array (fI ix)
108
dottelearrayAt array ix = unsafeRead array (fI ix)
55
false
true
0
7
20
43
19
24
null
null
diku-dk/futhark
src/Futhark/CodeGen/ImpGen.hs
isc
-- | Create a typed variable from a name and a dynamic type. Note -- that there is no guarantee that the dynamic type corresponds to the -- inferred static type, but the latter will at least have to be used -- consistently. mkTV :: VName -> PrimType -> TV t mkTV = TV
268
mkTV :: VName -> PrimType -> TV t mkTV = TV
43
mkTV = TV
9
true
true
0
8
54
32
16
16
null
null
elieux/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
isQuietHsCmd :: HsCmd id -> Bool -- Parentheses do display something, but it gives little info and -- if we go deeper when we go inside them then we get ugly things -- like (...) isQuietHsCmd (HsCmdPar _) = True
211
isQuietHsCmd :: HsCmd id -> Bool isQuietHsCmd (HsCmdPar _) = True
65
isQuietHsCmd (HsCmdPar _) = True
32
true
true
0
9
39
36
17
19
null
null
brendanhay/gogol
gogol-blogger/gen/Network/Google/Resource/Blogger/Comments/MarkAsSpam.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). cmasUploadProtocol :: Lens' CommentsMarkAsSpam (Maybe Text) cmasUploadProtocol = lens _cmasUploadProtocol (\ s a -> s{_cmasUploadProtocol = a})
213
cmasUploadProtocol :: Lens' CommentsMarkAsSpam (Maybe Text) cmasUploadProtocol = lens _cmasUploadProtocol (\ s a -> s{_cmasUploadProtocol = a})
151
cmasUploadProtocol = lens _cmasUploadProtocol (\ s a -> s{_cmasUploadProtocol = a})
91
true
true
0
9
33
48
25
23
null
null
wouwouwou/2017_module_8
src/haskell/PP-project-2016/Checker.hs
apache-2.0
checker2 (ASTDecl varType var@(ASTVar varName _) Nothing _) check = ASTDecl varType var Nothing newCheck where newCheck = addToScope check (varName, varType) -- Adds variable to scope (see addToScope) -- Check expression type -- Does nameCheck
262
checker2 (ASTDecl varType var@(ASTVar varName _) Nothing _) check = ASTDecl varType var Nothing newCheck where newCheck = addToScope check (varName, varType) -- Adds variable to scope (see addToScope) -- Check expression type -- Does nameCheck
262
checker2 (ASTDecl varType var@(ASTVar varName _) Nothing _) check = ASTDecl varType var Nothing newCheck where newCheck = addToScope check (varName, varType) -- Adds variable to scope (see addToScope) -- Check expression type -- Does nameCheck
262
false
false
1
10
54
70
34
36
null
null
y-kamiya/ai-samples
src/Strips.hs
bsd-3-clause
getConditionDiff :: (Term b) => [b] -> [b] -> (Int, [b]) getConditionDiff dest src = let diff = dest \\ src in (length diff, diff)
130
getConditionDiff :: (Term b) => [b] -> [b] -> (Int, [b]) getConditionDiff dest src = let diff = dest \\ src in (length diff, diff)
130
getConditionDiff dest src = let diff = dest \\ src in (length diff, diff)
73
false
true
0
9
24
77
40
37
null
null
snoyberg/ghc
compiler/utils/Pretty.hs
bsd-3-clause
-- ^ All on one line -- | Render the @Doc@ to a String using the given @Style@. renderStyle :: Style -> Doc -> String renderStyle s = fullRender (mode s) (lineLength s) (ribbonsPerLine s) txtPrinter ""
218
renderStyle :: Style -> Doc -> String renderStyle s = fullRender (mode s) (lineLength s) (ribbonsPerLine s) txtPrinter ""
137
renderStyle s = fullRender (mode s) (lineLength s) (ribbonsPerLine s) txtPrinter ""
99
true
true
0
7
53
53
27
26
null
null
Trundle/idris-go
src/IRTS/CodegenGo.hs
mit
primToGo var (LIntStr ITNative) [i] = let code = "MkString(strconv.FormatInt(*(*int64)(" `T.append` lVarToGo i `T.append` "), 10))" in Line (Just var) [ lVarToVar i ] (assign var code)
188
primToGo var (LIntStr ITNative) [i] = let code = "MkString(strconv.FormatInt(*(*int64)(" `T.append` lVarToGo i `T.append` "), 10))" in Line (Just var) [ lVarToVar i ] (assign var code)
188
primToGo var (LIntStr ITNative) [i] = let code = "MkString(strconv.FormatInt(*(*int64)(" `T.append` lVarToGo i `T.append` "), 10))" in Line (Just var) [ lVarToVar i ] (assign var code)
188
false
false
0
11
30
79
40
39
null
null
tpsinnem/Idris-dev
src/Idris/IdeMode.hs
bsd-3-clause
decodeTerm :: String -> ([(Name, Bool)], Term) decodeTerm = Binary.decode . Lazy.fromStrict . Base64.decodeLenient . UTF8.fromString
132
decodeTerm :: String -> ([(Name, Bool)], Term) decodeTerm = Binary.decode . Lazy.fromStrict . Base64.decodeLenient . UTF8.fromString
132
decodeTerm = Binary.decode . Lazy.fromStrict . Base64.decodeLenient . UTF8.fromString
85
false
true
0
10
15
57
29
28
null
null
Chattered/proplcf
Bootstrap.hs
mit
substRight :: Theorem Three substRight = reflect lemma where lemma = let step1 = Assume (p <=> q) step2 = Assume (r :=>: p) step3 = Assume r step4 = MP step2 step3 step5 = UseTheorem (inst2 (p :=>: q) (q :=>: p) conj1) step6 = MP step5 step1 step7 = MP step6 step4 step8 = discharge (concl step3) step7 step9 = discharge (concl step2) step8 in verify step9 -- | ⊢ (X ↔ Y) → (¬X ↔ ¬Y)
562
substRight :: Theorem Three substRight = reflect lemma where lemma = let step1 = Assume (p <=> q) step2 = Assume (r :=>: p) step3 = Assume r step4 = MP step2 step3 step5 = UseTheorem (inst2 (p :=>: q) (q :=>: p) conj1) step6 = MP step5 step1 step7 = MP step6 step4 step8 = discharge (concl step3) step7 step9 = discharge (concl step2) step8 in verify step9 -- | ⊢ (X ↔ Y) → (¬X ↔ ¬Y)
562
substRight = reflect lemma where lemma = let step1 = Assume (p <=> q) step2 = Assume (r :=>: p) step3 = Assume r step4 = MP step2 step3 step5 = UseTheorem (inst2 (p :=>: q) (q :=>: p) conj1) step6 = MP step5 step1 step7 = MP step6 step4 step8 = discharge (concl step3) step7 step9 = discharge (concl step2) step8 in verify step9 -- | ⊢ (X ↔ Y) → (¬X ↔ ¬Y)
534
false
true
2
13
257
173
84
89
null
null
foreverbell/project-euler-solutions
src/6.hs
bsd-3-clause
sum2 = sum (map (^2) [1 .. 100])
32
sum2 = sum (map (^2) [1 .. 100])
32
sum2 = sum (map (^2) [1 .. 100])
32
false
false
1
8
7
31
15
16
null
null
tewe/uroboro
src/Uroboro/PrettyPrint.hs
mit
commaSep :: [String] -> String commaSep ss = intercalate ", " ss
64
commaSep :: [String] -> String commaSep ss = intercalate ", " ss
64
commaSep ss = intercalate ", " ss
33
false
true
0
7
11
31
14
17
null
null
ghc-android/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
isFFIExportResultTy :: Type -> Validity isFFIExportResultTy ty = checkRepTyCon legalFEResultTyCon ty
100
isFFIExportResultTy :: Type -> Validity isFFIExportResultTy ty = checkRepTyCon legalFEResultTyCon ty
100
isFFIExportResultTy ty = checkRepTyCon legalFEResultTyCon ty
60
false
true
0
7
10
28
12
16
null
null
DanielSchuessler/hstri
Triangulation/PreTriangulation.hs
gpl-3.0
gluingsIrredundant :: PreTriangulation tr => tr -> [Gluing] gluingsIrredundant = map ngToGluing . normalizedGluings
115
gluingsIrredundant :: PreTriangulation tr => tr -> [Gluing] gluingsIrredundant = map ngToGluing . normalizedGluings
115
gluingsIrredundant = map ngToGluing . normalizedGluings
55
false
true
0
9
13
38
17
21
null
null
henvic/plc
src/FuncoesDeAltaOrdemFilterFold.hs
cc0-1.0
somaf l = fold (+) l
20
somaf l = fold (+) l
20
somaf l = fold (+) l
20
false
false
1
5
5
21
8
13
null
null