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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
atsukotakahashi/wi
|
src/library/Yi/Editor.hs
|
gpl-2.0
|
-- | Return the current buffer
currentBuffer :: Editor -> BufferRef
currentBuffer = NE.head . bufferStack
| 105
|
currentBuffer :: Editor -> BufferRef
currentBuffer = NE.head . bufferStack
| 74
|
currentBuffer = NE.head . bufferStack
| 37
| true
| true
| 0
| 6
| 15
| 22
| 12
| 10
| null | null |
green-haskell/ghc
|
compiler/hsSyn/HsDecls.hs
|
bsd-3-clause
|
pp_vanilla_decl_head :: OutputableBndr name
=> Located name
-> LHsTyVarBndrs name
-> HsContext name
-> SDoc
pp_vanilla_decl_head thing tyvars context
= hsep [pprHsContext context, pprPrefixOcc (unLoc thing), ppr tyvars]
| 232
|
pp_vanilla_decl_head :: OutputableBndr name
=> Located name
-> LHsTyVarBndrs name
-> HsContext name
-> SDoc
pp_vanilla_decl_head thing tyvars context
= hsep [pprHsContext context, pprPrefixOcc (unLoc thing), ppr tyvars]
| 232
|
pp_vanilla_decl_head thing tyvars context
= hsep [pprHsContext context, pprPrefixOcc (unLoc thing), ppr tyvars]
| 112
| false
| true
| 0
| 10
| 40
| 75
| 34
| 41
| null | null |
johnyhlee/baseball-sim
|
src/Baseball.hs
|
gpl-2.0
|
oneBase BaseState{first=_,second=False,third=t} = (BaseState{first=True,second=True,third=t}, 0)
| 96
|
oneBase BaseState{first=_,second=False,third=t} = (BaseState{first=True,second=True,third=t}, 0)
| 96
|
oneBase BaseState{first=_,second=False,third=t} = (BaseState{first=True,second=True,third=t}, 0)
| 96
| false
| false
| 0
| 7
| 4
| 57
| 34
| 23
| null | null |
jvilar/hrows
|
src/Cols.hs
|
gpl-2.0
|
setCols :: String -> Options -> Options
setCols s = case parseCols (T.pack s) of
Left e -> myError $ "Bad column especification: " ++ T.unpack e
Right cs -> set cols cs
| 202
|
setCols :: String -> Options -> Options
setCols s = case parseCols (T.pack s) of
Left e -> myError $ "Bad column especification: " ++ T.unpack e
Right cs -> set cols cs
| 202
|
setCols s = case parseCols (T.pack s) of
Left e -> myError $ "Bad column especification: " ++ T.unpack e
Right cs -> set cols cs
| 162
| false
| true
| 0
| 10
| 66
| 73
| 34
| 39
| null | null |
Happy0/snowdrift
|
Model/Currency.hs
|
agpl-3.0
|
milrayCents :: Milray -> Cent
milrayCents (Milray a) = Cent (round $ fromIntegral a / (100 :: Double))
| 102
|
milrayCents :: Milray -> Cent
milrayCents (Milray a) = Cent (round $ fromIntegral a / (100 :: Double))
| 102
|
milrayCents (Milray a) = Cent (round $ fromIntegral a / (100 :: Double))
| 72
| false
| true
| 0
| 9
| 17
| 47
| 24
| 23
| null | null |
TC1211/TCP
|
src/3a/tester-src/Data/IterIO/Parse.hs
|
apache-2.0
|
tring :: (ChunkData t, LL.ListLike t e, LL.StringLike t, Eq e, Monad m) =>
String -> Iter t m t
string = match . LL.fromString
| 137
|
string :: (ChunkData t, LL.ListLike t e, LL.StringLike t, Eq e, Monad m) =>
String -> Iter t m t
string = match . LL.fromString
| 137
|
string = match . LL.fromString
| 30
| false
| true
| 0
| 8
| 35
| 72
| 35
| 37
| null | null |
codemac/yi-editor
|
src/Yi/UI/Cocoa/TextStorage.hs
|
gpl-2.0
|
_window o = (\ (_,_,x,_,_) -> x) <$> o #. _yiState
| 56
|
_window o = (\ (_,_,x,_,_) -> x) <$> o #. _yiState
| 56
|
_window o = (\ (_,_,x,_,_) -> x) <$> o #. _yiState
| 56
| false
| false
| 0
| 9
| 16
| 40
| 23
| 17
| null | null |
DaMSL/K3
|
src/Language/K3/Runtime/Engine.hs
|
apache-2.0
|
removeConnection :: Address -> MVar EConnectionMap -> EngineM a ()
removeConnection addr conns = modifyConnectionMap conns (liftIO . remove)
where remove cm@(anchor -> (_, Nothing)) = return (cm, ())
remove cm = closeConnection (cache cm) >>= return . (,()) . EConnectionMap (anchor cm)
closeConnection (matchConnections -> (matches, rest)) =
mapM_ (NT.close . conn . snd) matches >> return rest
matchConnections = partition ((addr ==) . fst)
| 478
|
removeConnection :: Address -> MVar EConnectionMap -> EngineM a ()
removeConnection addr conns = modifyConnectionMap conns (liftIO . remove)
where remove cm@(anchor -> (_, Nothing)) = return (cm, ())
remove cm = closeConnection (cache cm) >>= return . (,()) . EConnectionMap (anchor cm)
closeConnection (matchConnections -> (matches, rest)) =
mapM_ (NT.close . conn . snd) matches >> return rest
matchConnections = partition ((addr ==) . fst)
| 478
|
removeConnection addr conns = modifyConnectionMap conns (liftIO . remove)
where remove cm@(anchor -> (_, Nothing)) = return (cm, ())
remove cm = closeConnection (cache cm) >>= return . (,()) . EConnectionMap (anchor cm)
closeConnection (matchConnections -> (matches, rest)) =
mapM_ (NT.close . conn . snd) matches >> return rest
matchConnections = partition ((addr ==) . fst)
| 411
| false
| true
| 4
| 11
| 101
| 190
| 100
| 90
| null | null |
kfish/hogg
|
tools/hogg.hs
|
bsd-3-clause
|
dumpRawPagesSub :: SubCommand
dumpRawPagesSub = SubCommand "dumpraw" dumpRawPages
"Reporting" "Dump raw (unparsed) page data"
dumpRawDesc
[("Dump raw pages of all bitstreams in file.ogg", "file.ogg"),
("Dump raw pages of only the Theora bitstream in file.ogv",
"-c theora file.ogv")]
allOptions
| 321
|
dumpRawPagesSub :: SubCommand
dumpRawPagesSub = SubCommand "dumpraw" dumpRawPages
"Reporting" "Dump raw (unparsed) page data"
dumpRawDesc
[("Dump raw pages of all bitstreams in file.ogg", "file.ogg"),
("Dump raw pages of only the Theora bitstream in file.ogv",
"-c theora file.ogv")]
allOptions
| 321
|
dumpRawPagesSub = SubCommand "dumpraw" dumpRawPages
"Reporting" "Dump raw (unparsed) page data"
dumpRawDesc
[("Dump raw pages of all bitstreams in file.ogg", "file.ogg"),
("Dump raw pages of only the Theora bitstream in file.ogv",
"-c theora file.ogv")]
allOptions
| 291
| false
| true
| 0
| 6
| 64
| 56
| 26
| 30
| null | null |
kbiscanic/PUH
|
hw04/exercises.hs
|
mit
|
-- Exercise 1.1. Define 'headHunter xss' that takes the head of the first list element. If the first element has no head, it takes the head of the second element. If the second element has no head, it takes the head of the third element. If none of this works, the function returns an error.
headHunter :: [[a]] -> a
headHunter ((x:_):_) = x
| 348
|
headHunter :: [[a]] -> a
headHunter ((x:_):_) = x
| 49
|
headHunter ((x:_):_) = x
| 24
| true
| true
| 0
| 9
| 70
| 39
| 22
| 17
| null | null |
quyse/flaw
|
flaw-math/Flaw/Math/Geometry.hs
|
mit
|
affineScaling :: (Vectorized a, Num a) => Vec3 a -> Mat4x4 a
affineScaling (Vec3 x y z) = Mat4x4
x 0 0 0
0 y 0 0
0 0 z 0
0 0 0 1
| 136
|
affineScaling :: (Vectorized a, Num a) => Vec3 a -> Mat4x4 a
affineScaling (Vec3 x y z) = Mat4x4
x 0 0 0
0 y 0 0
0 0 z 0
0 0 0 1
| 136
|
affineScaling (Vec3 x y z) = Mat4x4
x 0 0 0
0 y 0 0
0 0 z 0
0 0 0 1
| 75
| false
| true
| 0
| 7
| 42
| 89
| 40
| 49
| null | null |
snoyberg/publicsuffixlist
|
CreateTest.hs
|
bsd-2-clause
|
intersperse :: (Monad m) => a -> C.Conduit a m a
intersperse i = C.await >>= \ x -> case x of
Nothing -> return ()
Just a -> C.yield a >> intersperseHelper
where intersperseHelper = C.await >>= \ x -> case x of
Nothing -> return ()
Just a -> C.yield i >> C.yield a >> intersperseHelper
| 311
|
intersperse :: (Monad m) => a -> C.Conduit a m a
intersperse i = C.await >>= \ x -> case x of
Nothing -> return ()
Just a -> C.yield a >> intersperseHelper
where intersperseHelper = C.await >>= \ x -> case x of
Nothing -> return ()
Just a -> C.yield i >> C.yield a >> intersperseHelper
| 311
|
intersperse i = C.await >>= \ x -> case x of
Nothing -> return ()
Just a -> C.yield a >> intersperseHelper
where intersperseHelper = C.await >>= \ x -> case x of
Nothing -> return ()
Just a -> C.yield i >> C.yield a >> intersperseHelper
| 262
| false
| true
| 0
| 13
| 83
| 146
| 69
| 77
| null | null |
kmate/raw-feldspar
|
src/Feldspar/Run/Frontend.hs
|
bsd-3-clause
|
-- | Check for end of file
feof :: Handle -> Run (Data Bool)
feof = Run . Imp.feof
| 82
|
feof :: Handle -> Run (Data Bool)
feof = Run . Imp.feof
| 55
|
feof = Run . Imp.feof
| 21
| true
| true
| 0
| 8
| 18
| 31
| 16
| 15
| null | null |
csabahruska/q3demo
|
src/Q3Demo/Graphics/GLBackend.hs
|
bsd-3-clause
|
setAttribute :: GLProgram -> GLAttribute -> ByteString -> IO Bool
setAttribute p l a = do
st "BEGIN[setAttribute]"
r <- setAttribute' p l a
st "END[setAttribute]"
return r
| 187
|
setAttribute :: GLProgram -> GLAttribute -> ByteString -> IO Bool
setAttribute p l a = do
st "BEGIN[setAttribute]"
r <- setAttribute' p l a
st "END[setAttribute]"
return r
| 187
|
setAttribute p l a = do
st "BEGIN[setAttribute]"
r <- setAttribute' p l a
st "END[setAttribute]"
return r
| 121
| false
| true
| 0
| 9
| 43
| 71
| 29
| 42
| null | null |
brendanhay/gogol
|
gogol-gmail/gen/Network/Google/Resource/Gmail/Users/Settings/ForwardingAddresses/List.hs
|
mpl-2.0
|
-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
usfalUploadProtocol :: Lens' UsersSettingsForwardingAddressesList (Maybe Text)
usfalUploadProtocol
= lens _usfalUploadProtocol
(\ s a -> s{_usfalUploadProtocol = a})
| 235
|
usfalUploadProtocol :: Lens' UsersSettingsForwardingAddressesList (Maybe Text)
usfalUploadProtocol
= lens _usfalUploadProtocol
(\ s a -> s{_usfalUploadProtocol = a})
| 173
|
usfalUploadProtocol
= lens _usfalUploadProtocol
(\ s a -> s{_usfalUploadProtocol = a})
| 94
| true
| true
| 0
| 8
| 33
| 49
| 25
| 24
| null | null |
f-me/snap-core
|
src/Snap/Util/FileServe.hs
|
bsd-3-clause
|
queryStringSuffix :: Request -> ByteString
queryStringSuffix rq = S.concat [ s, qs ]
where
qs = rqQueryString rq
s = if S.null qs then "" else "?"
| 157
|
queryStringSuffix :: Request -> ByteString
queryStringSuffix rq = S.concat [ s, qs ]
where
qs = rqQueryString rq
s = if S.null qs then "" else "?"
| 157
|
queryStringSuffix rq = S.concat [ s, qs ]
where
qs = rqQueryString rq
s = if S.null qs then "" else "?"
| 114
| false
| true
| 2
| 7
| 37
| 70
| 31
| 39
| null | null |
webhooq/webhooq-client-haskell-HTTP
|
src/Network/HTTP/Webhooq.hs
|
bsd-3-clause
|
mkMessageIdHeader message_id = Header header_message_id message_id
| 68
|
mkMessageIdHeader message_id = Header header_message_id message_id
| 68
|
mkMessageIdHeader message_id = Header header_message_id message_id
| 68
| false
| false
| 1
| 5
| 7
| 17
| 6
| 11
| null | null |
ocean0yohsuke/deepcontrol
|
test/unit_Monad-Level2.hs
|
bsd-3-clause
|
polandSME x = pushSME (read x :: Double)
| 40
|
polandSME x = pushSME (read x :: Double)
| 40
|
polandSME x = pushSME (read x :: Double)
| 40
| false
| false
| 0
| 7
| 7
| 21
| 10
| 11
| null | null |
CindyLinz/Haskell.js
|
trans/src/Desugar/Tuple.hs
|
mit
|
deTupleType (TySplice l splice) = TySplice (id l) (deTupleSplice splice)
| 72
|
deTupleType (TySplice l splice) = TySplice (id l) (deTupleSplice splice)
| 72
|
deTupleType (TySplice l splice) = TySplice (id l) (deTupleSplice splice)
| 72
| false
| false
| 0
| 7
| 9
| 35
| 16
| 19
| null | null |
da-x/Algorithm-W-Step-By-Step
|
Lamdu/Expr/Val.hs
|
gpl-3.0
|
recRest :: Lens' (RecExtend exp) exp
recRest f RecExtend {..} = f _recRest <&> \_recRest -> RecExtend {..}
| 106
|
recRest :: Lens' (RecExtend exp) exp
recRest f RecExtend {..} = f _recRest <&> \_recRest -> RecExtend {..}
| 106
|
recRest f RecExtend {..} = f _recRest <&> \_recRest -> RecExtend {..}
| 69
| false
| true
| 0
| 7
| 17
| 50
| 25
| 25
| null | null |
sol2man2/Learn-You-A-Haskell-For-Great-Good
|
src/capslocker.hs
|
mit
|
main = interact respondPalindromes
| 34
|
main = interact respondPalindromes
| 34
|
main = interact respondPalindromes
| 34
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
sneaker-rohit/github-crawler
|
src/Client.hs
|
bsd-3-clause
|
g1Queries :: ClientM (RepoInfoResponse)
g1Queries = do
--g1 <- group1 (RepoDataForProcessing "www.RepoDataForProcessing_g1.git" ["Java", "Haskell"])
g1 <- group1 repoDataForG1
return (g1)
| 193
|
g1Queries :: ClientM (RepoInfoResponse)
g1Queries = do
--g1 <- group1 (RepoDataForProcessing "www.RepoDataForProcessing_g1.git" ["Java", "Haskell"])
g1 <- group1 repoDataForG1
return (g1)
| 193
|
g1Queries = do
--g1 <- group1 (RepoDataForProcessing "www.RepoDataForProcessing_g1.git" ["Java", "Haskell"])
g1 <- group1 repoDataForG1
return (g1)
| 153
| false
| true
| 0
| 8
| 25
| 37
| 18
| 19
| null | null |
beni55/wai
|
warp/Network/Wai/Handler/Warp/Response.hs
|
mit
|
sendRsp conn _ _ _ (RspRaw withApp src tickle) =
withApp recv send
where
recv = do
bs <- src
unless (S.null bs) tickle
return bs
send bs = connSendAll conn bs >> tickle
----------------------------------------------------------------
| 272
|
sendRsp conn _ _ _ (RspRaw withApp src tickle) =
withApp recv send
where
recv = do
bs <- src
unless (S.null bs) tickle
return bs
send bs = connSendAll conn bs >> tickle
----------------------------------------------------------------
| 272
|
sendRsp conn _ _ _ (RspRaw withApp src tickle) =
withApp recv send
where
recv = do
bs <- src
unless (S.null bs) tickle
return bs
send bs = connSendAll conn bs >> tickle
----------------------------------------------------------------
| 272
| false
| false
| 1
| 12
| 73
| 88
| 40
| 48
| null | null |
nikita-volkov/deque
|
library/Deque/Strict/State.hs
|
mit
|
{-|
\(\mathcal{O}(n)\).
Add elements to the ending.
-}
append :: MonadState (Deque a) m => Deque a -> m ()
append deque = modify (<> deque)
| 139
|
append :: MonadState (Deque a) m => Deque a -> m ()
append deque = modify (<> deque)
| 84
|
append deque = modify (<> deque)
| 32
| true
| true
| 0
| 8
| 25
| 49
| 24
| 25
| null | null |
brendanhay/apteryx
|
apteryx/System/APT/Store.hs
|
mpl-2.0
|
presign :: ToKey k => Bucket -> k -> Int -> Store ByteString
presign b k n = liftIO expiry >>= lift . presignS3 GET bkt obj
where
expiry = Time.addUTCTime (realToFrac n) <$> Time.getCurrentTime
bkt = Text.encodeUtf8 (bktName b)
obj = Text.encodeUtf8 (objectKey b k)
| 280
|
presign :: ToKey k => Bucket -> k -> Int -> Store ByteString
presign b k n = liftIO expiry >>= lift . presignS3 GET bkt obj
where
expiry = Time.addUTCTime (realToFrac n) <$> Time.getCurrentTime
bkt = Text.encodeUtf8 (bktName b)
obj = Text.encodeUtf8 (objectKey b k)
| 280
|
presign b k n = liftIO expiry >>= lift . presignS3 GET bkt obj
where
expiry = Time.addUTCTime (realToFrac n) <$> Time.getCurrentTime
bkt = Text.encodeUtf8 (bktName b)
obj = Text.encodeUtf8 (objectKey b k)
| 219
| false
| true
| 0
| 9
| 60
| 117
| 56
| 61
| null | null |
vektordev/GP
|
src/GRPTreeAnalytics.hs
|
gpl-2.0
|
ident :: AgentStats -> Int
ident agStats = read $ drop 3 $ reverse $ drop 11 $ source agStats
| 93
|
ident :: AgentStats -> Int
ident agStats = read $ drop 3 $ reverse $ drop 11 $ source agStats
| 93
|
ident agStats = read $ drop 3 $ reverse $ drop 11 $ source agStats
| 66
| false
| true
| 0
| 9
| 19
| 46
| 21
| 25
| null | null |
rueshyna/gogol
|
gogol-apps-tasks/gen/Network/Google/Resource/Tasks/TaskLists/Get.hs
|
mpl-2.0
|
-- | Creates a value of 'TaskListsGet' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tlgTaskList'
taskListsGet
:: Text -- ^ 'tlgTaskList'
-> TaskListsGet
taskListsGet pTlgTaskList_ =
TaskListsGet'
{ _tlgTaskList = pTlgTaskList_
}
| 337
|
taskListsGet
:: Text -- ^ 'tlgTaskList'
-> TaskListsGet
taskListsGet pTlgTaskList_ =
TaskListsGet'
{ _tlgTaskList = pTlgTaskList_
}
| 151
|
taskListsGet pTlgTaskList_ =
TaskListsGet'
{ _tlgTaskList = pTlgTaskList_
}
| 87
| true
| true
| 0
| 7
| 70
| 41
| 22
| 19
| null | null |
facebookincubator/duckling
|
Duckling/Rules/HI.hs
|
bsd-3-clause
|
langRules (Seal Email) = []
| 27
|
langRules (Seal Email) = []
| 27
|
langRules (Seal Email) = []
| 27
| false
| false
| 0
| 6
| 4
| 18
| 8
| 10
| null | null |
garetxe/cabal
|
Cabal/Distribution/Simple/Utils.hs
|
bsd-3-clause
|
doesExecutableExist :: FilePath -> IO Bool
doesExecutableExist f = do
exists <- doesFileExist f
if exists
then do perms <- getPermissions f
return (executable perms)
else return False
---------------------------------
-- Deprecated file copy functions
| 278
|
doesExecutableExist :: FilePath -> IO Bool
doesExecutableExist f = do
exists <- doesFileExist f
if exists
then do perms <- getPermissions f
return (executable perms)
else return False
---------------------------------
-- Deprecated file copy functions
| 278
|
doesExecutableExist f = do
exists <- doesFileExist f
if exists
then do perms <- getPermissions f
return (executable perms)
else return False
---------------------------------
-- Deprecated file copy functions
| 235
| false
| true
| 0
| 12
| 60
| 69
| 32
| 37
| null | null |
glguy/ssh-hans
|
src/Network/SSH/Messages.hs
|
bsd-3-clause
|
openFailureToCode :: SshOpenFailure -> Word32
openFailureToCode x =
case x of
SshOpenAdministrativelyProhibited -> 1
SshOpenConnectFailed -> 2
SshOpenUnknownChannelType -> 3
SshOpenResourceShortage -> 4
| 251
|
openFailureToCode :: SshOpenFailure -> Word32
openFailureToCode x =
case x of
SshOpenAdministrativelyProhibited -> 1
SshOpenConnectFailed -> 2
SshOpenUnknownChannelType -> 3
SshOpenResourceShortage -> 4
| 251
|
openFailureToCode x =
case x of
SshOpenAdministrativelyProhibited -> 1
SshOpenConnectFailed -> 2
SshOpenUnknownChannelType -> 3
SshOpenResourceShortage -> 4
| 205
| false
| true
| 0
| 8
| 71
| 52
| 24
| 28
| null | null |
yu-i9/HaSC
|
src/HaSC/NASM/GenCode.hs
|
mit
|
assignIStmt (ICall dest f args) = liftM3 NCall (getAddr dest)
(return $ objName f)
(mapM getAddr args)
| 205
|
assignIStmt (ICall dest f args) = liftM3 NCall (getAddr dest)
(return $ objName f)
(mapM getAddr args)
| 205
|
assignIStmt (ICall dest f args) = liftM3 NCall (getAddr dest)
(return $ objName f)
(mapM getAddr args)
| 205
| false
| false
| 0
| 8
| 119
| 53
| 25
| 28
| null | null |
haskell-infra/cloudflare
|
util/Main.hs
|
bsd-3-clause
|
loadConfig :: IO Account
loadConfig = do
conf <- getUserConfigFile "" "cloudflare"
accInfo <- fmap T.words $ TIO.readFile conf
if length accInfo /= 2
then error $ "Please ensure " <> conf <> " exists and has format: " <>
"[email] [api token]"
else return $ account (head accInfo) (accInfo !! 1)
| 323
|
loadConfig :: IO Account
loadConfig = do
conf <- getUserConfigFile "" "cloudflare"
accInfo <- fmap T.words $ TIO.readFile conf
if length accInfo /= 2
then error $ "Please ensure " <> conf <> " exists and has format: " <>
"[email] [api token]"
else return $ account (head accInfo) (accInfo !! 1)
| 323
|
loadConfig = do
conf <- getUserConfigFile "" "cloudflare"
accInfo <- fmap T.words $ TIO.readFile conf
if length accInfo /= 2
then error $ "Please ensure " <> conf <> " exists and has format: " <>
"[email] [api token]"
else return $ account (head accInfo) (accInfo !! 1)
| 298
| false
| true
| 0
| 11
| 80
| 103
| 49
| 54
| null | null |
janschulz/pandoc
|
src/Text/Pandoc/Parsing.hs
|
gpl-2.0
|
doubleQuoteStart :: (HasQuoteContext st m, Stream s m Char)
=> ParserT s st m ()
doubleQuoteStart = do
failIfInQuoteContext InDoubleQuote
try $ do charOrRef "\"\8220\147"
notFollowedBy . satisfy $ flip elem [' ', '\t', '\n']
| 256
|
doubleQuoteStart :: (HasQuoteContext st m, Stream s m Char)
=> ParserT s st m ()
doubleQuoteStart = do
failIfInQuoteContext InDoubleQuote
try $ do charOrRef "\"\8220\147"
notFollowedBy . satisfy $ flip elem [' ', '\t', '\n']
| 256
|
doubleQuoteStart = do
failIfInQuoteContext InDoubleQuote
try $ do charOrRef "\"\8220\147"
notFollowedBy . satisfy $ flip elem [' ', '\t', '\n']
| 158
| false
| true
| 0
| 13
| 66
| 93
| 43
| 50
| null | null |
fmthoma/ghc
|
compiler/main/DriverPipeline.hs
|
bsd-3-clause
|
-- ---------------------------------------------------------------------------
-- Pre-process
-- | Just preprocess a file, put the result in a temp. file (used by the
-- compilation manager during the summary phase).
--
-- We return the augmented DynFlags, because they contain the result
-- of slurping in the OPTIONS pragmas
preprocess :: HscEnv
-> (FilePath, Maybe Phase) -- ^ filename and starting phase
-> IO (DynFlags, FilePath)
preprocess hsc_env (filename, mb_phase) =
ASSERT2(isJust mb_phase || isHaskellSrcFilename filename, text filename)
runPipeline anyHsc hsc_env (filename, fmap RealPhase mb_phase)
Nothing Temporary Nothing{-no ModLocation-} Nothing
| 700
|
preprocess :: HscEnv
-> (FilePath, Maybe Phase) -- ^ filename and starting phase
-> IO (DynFlags, FilePath)
preprocess hsc_env (filename, mb_phase) =
ASSERT2(isJust mb_phase || isHaskellSrcFilename filename, text filename)
runPipeline anyHsc hsc_env (filename, fmap RealPhase mb_phase)
Nothing Temporary Nothing{-no ModLocation-} Nothing
| 371
|
preprocess hsc_env (filename, mb_phase) =
ASSERT2(isJust mb_phase || isHaskellSrcFilename filename, text filename)
runPipeline anyHsc hsc_env (filename, fmap RealPhase mb_phase)
Nothing Temporary Nothing{-no ModLocation-} Nothing
| 241
| true
| true
| 0
| 9
| 122
| 119
| 60
| 59
| null | null |
rodrigo-machado/verigraph
|
src/repl/GrLang.hs
|
gpl-3.0
|
put :: (MonadIO m, MonadReader GrLangState m) => (GrLangState -> IORef a) -> a -> m ()
put f x = do
ref <- asks f
liftIO $ writeIORef ref x
| 143
|
put :: (MonadIO m, MonadReader GrLangState m) => (GrLangState -> IORef a) -> a -> m ()
put f x = do
ref <- asks f
liftIO $ writeIORef ref x
| 143
|
put f x = do
ref <- asks f
liftIO $ writeIORef ref x
| 56
| false
| true
| 0
| 9
| 34
| 78
| 37
| 41
| null | null |
snowleopard/shaking-up-ghc
|
src/Oracles/Setting.hs
|
bsd-3-clause
|
settingList :: SettingList -> Action [String]
settingList key = fmap words $ lookupValueOrError configFile $ case key of
ConfCcArgs stage -> "conf-cc-args-" ++ stageString stage
ConfCppArgs stage -> "conf-cpp-args-" ++ stageString stage
ConfGccLinkerArgs stage -> "conf-gcc-linker-args-" ++ stageString stage
ConfLdLinkerArgs stage -> "conf-ld-linker-args-" ++ stageString stage
HsCppArgs -> "hs-cpp-args"
-- | An expression that looks up the value of a 'Setting' in @cfg/system.config@,
-- tracking the result.
| 576
|
settingList :: SettingList -> Action [String]
settingList key = fmap words $ lookupValueOrError configFile $ case key of
ConfCcArgs stage -> "conf-cc-args-" ++ stageString stage
ConfCppArgs stage -> "conf-cpp-args-" ++ stageString stage
ConfGccLinkerArgs stage -> "conf-gcc-linker-args-" ++ stageString stage
ConfLdLinkerArgs stage -> "conf-ld-linker-args-" ++ stageString stage
HsCppArgs -> "hs-cpp-args"
-- | An expression that looks up the value of a 'Setting' in @cfg/system.config@,
-- tracking the result.
| 576
|
settingList key = fmap words $ lookupValueOrError configFile $ case key of
ConfCcArgs stage -> "conf-cc-args-" ++ stageString stage
ConfCppArgs stage -> "conf-cpp-args-" ++ stageString stage
ConfGccLinkerArgs stage -> "conf-gcc-linker-args-" ++ stageString stage
ConfLdLinkerArgs stage -> "conf-ld-linker-args-" ++ stageString stage
HsCppArgs -> "hs-cpp-args"
-- | An expression that looks up the value of a 'Setting' in @cfg/system.config@,
-- tracking the result.
| 530
| false
| true
| 0
| 10
| 131
| 114
| 53
| 61
| null | null |
sharpjs/haskell-learning
|
src/Aex/Types.hs
|
gpl-3.0
|
valueWidth :: Type -> Maybe Width
valueWidth (IntT (Just (w, _, _))) = Just w
| 79
|
valueWidth :: Type -> Maybe Width
valueWidth (IntT (Just (w, _, _))) = Just w
| 79
|
valueWidth (IntT (Just (w, _, _))) = Just w
| 45
| false
| true
| 0
| 12
| 16
| 49
| 24
| 25
| null | null |
ghc-android/ghc
|
compiler/codeGen/StgCmmPrim.hs
|
bsd-3-clause
|
translateOp _ FloatAddOp = Just (MO_F_Add W32)
| 55
|
translateOp _ FloatAddOp = Just (MO_F_Add W32)
| 55
|
translateOp _ FloatAddOp = Just (MO_F_Add W32)
| 55
| false
| false
| 0
| 7
| 15
| 20
| 9
| 11
| null | null |
zerobuzz/servant
|
servant-server/test/Servant/ServerSpec.hs
|
bsd-3-clause
|
qpServer :: Server QueryParamApi
qpServer = queryParamServer :<|> qpNames :<|> qpCapitalize
where qpNames (_:name2:_) = return alice { name = name2 }
qpNames _ = return alice
qpCapitalize False = return alice
qpCapitalize True = return alice { name = map toUpper (name alice) }
queryParamServer (Just name_) = return alice{name = name_}
queryParamServer Nothing = return alice
| 432
|
qpServer :: Server QueryParamApi
qpServer = queryParamServer :<|> qpNames :<|> qpCapitalize
where qpNames (_:name2:_) = return alice { name = name2 }
qpNames _ = return alice
qpCapitalize False = return alice
qpCapitalize True = return alice { name = map toUpper (name alice) }
queryParamServer (Just name_) = return alice{name = name_}
queryParamServer Nothing = return alice
| 432
|
qpServer = queryParamServer :<|> qpNames :<|> qpCapitalize
where qpNames (_:name2:_) = return alice { name = name2 }
qpNames _ = return alice
qpCapitalize False = return alice
qpCapitalize True = return alice { name = map toUpper (name alice) }
queryParamServer (Just name_) = return alice{name = name_}
queryParamServer Nothing = return alice
| 399
| false
| true
| 5
| 10
| 113
| 137
| 71
| 66
| null | null |
tibbe/ghc
|
compiler/nativeGen/X86/CodeGen.hs
|
bsd-3-clause
|
isOperand _ _ = False
| 32
|
isOperand _ _ = False
| 32
|
isOperand _ _ = False
| 32
| false
| false
| 1
| 5
| 15
| 12
| 5
| 7
| null | null |
Toxaris/Grammarkov
|
src/Text/Grammarkov.hs
|
bsd-3-clause
|
-- | Choose nondeterministically from two Grammarkov sequence
-- builders.
(<|>) :: Grammarkov e a -> Grammarkov e a -> Grammarkov e a
p <|> q = choose [p, q]
| 158
|
(<|>) :: Grammarkov e a -> Grammarkov e a -> Grammarkov e a
p <|> q = choose [p, q]
| 83
|
p <|> q = choose [p, q]
| 23
| true
| true
| 0
| 9
| 29
| 53
| 27
| 26
| null | null |
mstksg/auto
|
src/Control/Auto/Core.hs
|
mit
|
-- | A version of 'mkStateM', where the internal state isn't serialized.
-- It can be "saved" and "loaded", but the state is lost in the process.
--
-- See 'mkStateM' for more details.
--
-- Useful if your state @s@ cannot have a meaningful 'Serialize' instance.
mkStateM_ :: (a -> s -> m (b, s)) -- ^ (monadic) state transformer
-> s -- ^ initial state
-> Auto m a b
mkStateM_ f s0 = AutoStateM (return s0, \_ -> return ()) f s0
| 472
|
mkStateM_ :: (a -> s -> m (b, s)) -- ^ (monadic) state transformer
-> s -- ^ initial state
-> Auto m a b
mkStateM_ f s0 = AutoStateM (return s0, \_ -> return ()) f s0
| 209
|
mkStateM_ f s0 = AutoStateM (return s0, \_ -> return ()) f s0
| 61
| true
| true
| 0
| 10
| 127
| 85
| 47
| 38
| null | null |
denibertovic/haskell
|
kubernetes-client-helper/src/Kubernetes/ClientHelper.hs
|
bsd-3-clause
|
-- |Use a custom CA store.
setCAStore :: [SignedCertificate] -> TLS.ClientParams -> TLS.ClientParams
setCAStore certs cp = cp
{ TLS.clientShared = (TLS.clientShared cp)
{ TLS.sharedCAStore = (makeCertificateStore certs)
}
}
| 247
|
setCAStore :: [SignedCertificate] -> TLS.ClientParams -> TLS.ClientParams
setCAStore certs cp = cp
{ TLS.clientShared = (TLS.clientShared cp)
{ TLS.sharedCAStore = (makeCertificateStore certs)
}
}
| 220
|
setCAStore certs cp = cp
{ TLS.clientShared = (TLS.clientShared cp)
{ TLS.sharedCAStore = (makeCertificateStore certs)
}
}
| 146
| true
| true
| 0
| 11
| 53
| 70
| 37
| 33
| null | null |
mortberg/cubicaltt
|
TypeChecker.hs
|
mit
|
-- Monadic version of unless
unlessM :: Monad m => m Bool -> m () -> m ()
unlessM mb x = mb >>= flip unless x
| 111
|
unlessM :: Monad m => m Bool -> m () -> m ()
unlessM mb x = mb >>= flip unless x
| 80
|
unlessM mb x = mb >>= flip unless x
| 35
| true
| true
| 2
| 10
| 28
| 62
| 27
| 35
| null | null |
fmapfmapfmap/amazonka
|
amazonka-rds/test/Test/AWS/Gen/RDS.hs
|
mpl-2.0
|
testRestoreDBClusterFromSnapshot :: RestoreDBClusterFromSnapshot -> TestTree
testRestoreDBClusterFromSnapshot = req
"RestoreDBClusterFromSnapshot"
"fixture/RestoreDBClusterFromSnapshot.yaml"
| 198
|
testRestoreDBClusterFromSnapshot :: RestoreDBClusterFromSnapshot -> TestTree
testRestoreDBClusterFromSnapshot = req
"RestoreDBClusterFromSnapshot"
"fixture/RestoreDBClusterFromSnapshot.yaml"
| 198
|
testRestoreDBClusterFromSnapshot = req
"RestoreDBClusterFromSnapshot"
"fixture/RestoreDBClusterFromSnapshot.yaml"
| 121
| false
| true
| 0
| 5
| 17
| 20
| 10
| 10
| null | null |
jthornber/XMonadContrib
|
XMonad/Hooks/DebugEvents.hs
|
bsd-3-clause
|
dumpString :: Decoder Bool
dumpString = do
fmt <- asks pType
[cOMPOUND_TEXT,uTF8_STRING] <- inX $ mapM getAtom ["COMPOUND_TEXT","UTF8_STRING"]
case () of
() | fmt == cOMPOUND_TEXT -> guardSize 16 (...)
| fmt == sTRING -> guardSize 8 $ do
vs <- gets value
modify (\r -> r {value = []})
let ss = flip unfoldr (map twiddle vs) $
\s -> if null s
then Nothing
else let (w,s'') = break (== '\NUL') s
s' = if null s''
then s''
else tail s''
in Just (w,s')
case ss of
[s] -> append $ show s
ss' -> let go (s:ss'') c = append c >>
append (show s) >>
go ss'' ","
go [] _ = append "]"
in append "[" >> go ss' ""
| fmt == uTF8_STRING -> dumpUTF -- duplicate type test instead of code :)
| otherwise -> (inX $ atomName fmt) >>=
failure . ("unrecognized string type " ++)
-- show who owns a selection
| 1,723
|
dumpString :: Decoder Bool
dumpString = do
fmt <- asks pType
[cOMPOUND_TEXT,uTF8_STRING] <- inX $ mapM getAtom ["COMPOUND_TEXT","UTF8_STRING"]
case () of
() | fmt == cOMPOUND_TEXT -> guardSize 16 (...)
| fmt == sTRING -> guardSize 8 $ do
vs <- gets value
modify (\r -> r {value = []})
let ss = flip unfoldr (map twiddle vs) $
\s -> if null s
then Nothing
else let (w,s'') = break (== '\NUL') s
s' = if null s''
then s''
else tail s''
in Just (w,s')
case ss of
[s] -> append $ show s
ss' -> let go (s:ss'') c = append c >>
append (show s) >>
go ss'' ","
go [] _ = append "]"
in append "[" >> go ss' ""
| fmt == uTF8_STRING -> dumpUTF -- duplicate type test instead of code :)
| otherwise -> (inX $ atomName fmt) >>=
failure . ("unrecognized string type " ++)
-- show who owns a selection
| 1,723
|
dumpString = do
fmt <- asks pType
[cOMPOUND_TEXT,uTF8_STRING] <- inX $ mapM getAtom ["COMPOUND_TEXT","UTF8_STRING"]
case () of
() | fmt == cOMPOUND_TEXT -> guardSize 16 (...)
| fmt == sTRING -> guardSize 8 $ do
vs <- gets value
modify (\r -> r {value = []})
let ss = flip unfoldr (map twiddle vs) $
\s -> if null s
then Nothing
else let (w,s'') = break (== '\NUL') s
s' = if null s''
then s''
else tail s''
in Just (w,s')
case ss of
[s] -> append $ show s
ss' -> let go (s:ss'') c = append c >>
append (show s) >>
go ss'' ","
go [] _ = append "]"
in append "[" >> go ss' ""
| fmt == uTF8_STRING -> dumpUTF -- duplicate type test instead of code :)
| otherwise -> (inX $ atomName fmt) >>=
failure . ("unrecognized string type " ++)
-- show who owns a selection
| 1,696
| false
| true
| 0
| 26
| 1,097
| 394
| 191
| 203
| null | null |
apoikos/pkg-xmobar
|
src/Parsers.hs
|
bsd-3-clause
|
iconParser :: String -> Maybe [Action]
-> Parser [(Widget, ColorString, Maybe [Action])]
iconParser c a = do
string "<icon="
i <- manyTill (noneOf ">") (try (string "/>"))
return [(Icon i, c, a)]
| 215
|
iconParser :: String -> Maybe [Action]
-> Parser [(Widget, ColorString, Maybe [Action])]
iconParser c a = do
string "<icon="
i <- manyTill (noneOf ">") (try (string "/>"))
return [(Icon i, c, a)]
| 215
|
iconParser c a = do
string "<icon="
i <- manyTill (noneOf ">") (try (string "/>"))
return [(Icon i, c, a)]
| 112
| false
| true
| 0
| 13
| 51
| 113
| 55
| 58
| null | null |
GaloisInc/ivory-tower-stm32
|
ivory-bsp-stm32/src/Ivory/BSP/STM32F427/GPIO/AF.hs
|
bsd-3-clause
|
gpio_af_tamper = gpio_af0
| 27
|
gpio_af_tamper = gpio_af0
| 27
|
gpio_af_tamper = gpio_af0
| 27
| false
| false
| 1
| 5
| 4
| 10
| 3
| 7
| null | null |
CulpaBS/wbBach
|
src/Futhark/Optimise/Simplifier/Rules.hs
|
bsd-3-clause
|
simplifyReshapeScratch _ _ _ = Nothing
| 38
|
simplifyReshapeScratch _ _ _ = Nothing
| 38
|
simplifyReshapeScratch _ _ _ = Nothing
| 38
| false
| false
| 0
| 5
| 5
| 13
| 6
| 7
| null | null |
sdiehl/ghc
|
compiler/GHC/StgToCmm/Closure.hs
|
bsd-3-clause
|
-- | Assumes that the argument has one PrimRep, which holds after unarisation.
-- See Note [Post-unarisation invariants]
argPrimRep :: StgArg -> PrimRep
argPrimRep arg = typePrimRep1 (stgArgType arg)
| 199
|
argPrimRep :: StgArg -> PrimRep
argPrimRep arg = typePrimRep1 (stgArgType arg)
| 78
|
argPrimRep arg = typePrimRep1 (stgArgType arg)
| 46
| true
| true
| 0
| 7
| 28
| 29
| 15
| 14
| null | null |
dogweather/nevada-revised-statutes-parser
|
test/SimpleChapterSpec.hs
|
bsd-3-clause
|
main :: IO ()
main = hspec spec
| 31
|
main :: IO ()
main = hspec spec
| 31
|
main = hspec spec
| 17
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
brendanhay/gogol
|
gogol-monitoring/gen/Network/Google/Resource/Monitoring/Projects/AlertPolicies/List.hs
|
mpl-2.0
|
-- | A comma-separated list of fields by which to sort the result. Supports
-- the same set of field references as the filter field. Entries can be
-- prefixed with a minus sign to sort by the field in descending order.For
-- more details, see sorting and filtering
-- (https:\/\/cloud.google.com\/monitoring\/api\/v3\/sorting-and-filtering).
paplOrderBy :: Lens' ProjectsAlertPoliciesList (Maybe Text)
paplOrderBy
= lens _paplOrderBy (\ s a -> s{_paplOrderBy = a})
| 467
|
paplOrderBy :: Lens' ProjectsAlertPoliciesList (Maybe Text)
paplOrderBy
= lens _paplOrderBy (\ s a -> s{_paplOrderBy = a})
| 124
|
paplOrderBy
= lens _paplOrderBy (\ s a -> s{_paplOrderBy = a})
| 64
| true
| true
| 0
| 9
| 69
| 52
| 29
| 23
| null | null |
CristhianMotoche/scion
|
server/Scion/Server/Commands.hs
|
bsd-3-clause
|
commandExecError :: JSValue -> String -> JSValue
commandExecError seq_id msg = makeObject
[("version", str "0.1")
,("id", seq_id)
,("error", makeObject
[("name", str "CommandFailed")
,("message", str msg)])]
| 219
|
commandExecError :: JSValue -> String -> JSValue
commandExecError seq_id msg = makeObject
[("version", str "0.1")
,("id", seq_id)
,("error", makeObject
[("name", str "CommandFailed")
,("message", str msg)])]
| 219
|
commandExecError seq_id msg = makeObject
[("version", str "0.1")
,("id", seq_id)
,("error", makeObject
[("name", str "CommandFailed")
,("message", str msg)])]
| 170
| false
| true
| 0
| 10
| 36
| 84
| 47
| 37
| null | null |
alexander-at-github/eta
|
libraries/base/GHC/Enum.hs
|
bsd-3-clause
|
eftInt :: Int# -> Int# -> [Int]
-- [x1..x2]
eftInt x0 y | isTrue# (x0 ># y) = []
| otherwise = go x0
where
go x = I# x : if isTrue# (x ==# y)
then []
else go (x +# 1#)
| 283
|
eftInt :: Int# -> Int# -> [Int]
eftInt x0 y | isTrue# (x0 ># y) = []
| otherwise = go x0
where
go x = I# x : if isTrue# (x ==# y)
then []
else go (x +# 1#)
| 271
|
eftInt x0 y | isTrue# (x0 ># y) = []
| otherwise = go x0
where
go x = I# x : if isTrue# (x ==# y)
then []
else go (x +# 1#)
| 239
| true
| true
| 0
| 11
| 158
| 109
| 53
| 56
| null | null |
olsner/ghc
|
compiler/prelude/TysWiredIn.hs
|
bsd-3-clause
|
eqDataCon = pcDataCon eqDataConName [] [] orderingTyCon
| 56
|
eqDataCon = pcDataCon eqDataConName [] [] orderingTyCon
| 56
|
eqDataCon = pcDataCon eqDataConName [] [] orderingTyCon
| 56
| false
| false
| 1
| 6
| 7
| 23
| 9
| 14
| null | null |
locaweb/leela
|
src/warpdrive/src/Leela/Data/TimeSeries.hs
|
apache-2.0
|
castToDouble :: Value -> Maybe Double
castToDouble (Text _) = Nothing
| 71
|
castToDouble :: Value -> Maybe Double
castToDouble (Text _) = Nothing
| 71
|
castToDouble (Text _) = Nothing
| 33
| false
| true
| 0
| 7
| 12
| 27
| 13
| 14
| null | null |
beni55/haste-compiler
|
libraries/ghc-7.8/base/Data/STRef.hs
|
bsd-3-clause
|
-- | Mutate the contents of an 'STRef'.
--
-- Be warned that 'modifySTRef' does not apply the function strictly. This
-- means if the program calls 'modifySTRef' many times, but seldomly uses the
-- value, thunks will pile up in memory resulting in a space leak. This is a
-- common mistake made when using an STRef as a counter. For example, the
-- following will leak memory and likely produce a stack overflow:
--
-- >print $ runST $ do
-- > ref <- newSTRef 0
-- > replicateM_ 1000000 $ modifySTRef ref (+1)
-- > readSTRef ref
--
-- To avoid this problem, use 'modifySTRef'' instead.
modifySTRef :: STRef s a -> (a -> a) -> ST s ()
modifySTRef ref f = writeSTRef ref . f =<< readSTRef ref
| 703
|
modifySTRef :: STRef s a -> (a -> a) -> ST s ()
modifySTRef ref f = writeSTRef ref . f =<< readSTRef ref
| 104
|
modifySTRef ref f = writeSTRef ref . f =<< readSTRef ref
| 56
| true
| true
| 0
| 8
| 144
| 71
| 41
| 30
| null | null |
mydaum/cabal
|
cabal-install/Distribution/Client/Utils.hs
|
bsd-3-clause
|
inDir (Just d) m = do
old <- getCurrentDirectory
setCurrentDirectory d
m `Exception.finally` setCurrentDirectory old
-- | Executes the action with an environment variable set to some
-- value.
--
-- Warning: This operation is NOT thread-safe, because current
-- environment is a process-global concept.
| 309
|
inDir (Just d) m = do
old <- getCurrentDirectory
setCurrentDirectory d
m `Exception.finally` setCurrentDirectory old
-- | Executes the action with an environment variable set to some
-- value.
--
-- Warning: This operation is NOT thread-safe, because current
-- environment is a process-global concept.
| 309
|
inDir (Just d) m = do
old <- getCurrentDirectory
setCurrentDirectory d
m `Exception.finally` setCurrentDirectory old
-- | Executes the action with an environment variable set to some
-- value.
--
-- Warning: This operation is NOT thread-safe, because current
-- environment is a process-global concept.
| 309
| false
| false
| 0
| 8
| 51
| 49
| 25
| 24
| null | null |
fatho/kos-c
|
src/KOSC/Compiler/TypeChecker.hs
|
bsd-3-clause
|
isSubSchemeOf :: MonadCompiler MessageContent m => TypeScheme -> TypeScheme -> StateT TypeEnv m Bool
isSubSchemeOf (TypeScheme gen1 ty1 acc1) (TypeScheme gen2 ty2 acc2)
| length gen1 /= length gen2 = return False
| otherwise = do
isSub <- isSubtypeOf Covariant (substituteGenerics (Map.fromList $ zip gen1 (map (\g -> AST.TypeGeneric (AST.ScopedLocal g) []) gen2)) ty1) ty2
return $ isSub && hasAccess acc1 acc2
-- | @isSubtypeOf var sub super@ checks whether @sub@ is a subtype of @super@ using the current variance information.
-- For example, when checking covariantly, @Scalar@ is a subtype of @Structure@, and a function @Scalar(Structure)@
-- is a subtype of @Structure(Scalar)@. Note that the variance has been flipped when checking the arguments of the functions.
-- This is because any function that can take a @Structure@ can also take a @Scalar@.
-- Generic type arguments are checked invariantly currently, because they could occur in both covariant and contravariant positions.
| 1,007
|
isSubSchemeOf :: MonadCompiler MessageContent m => TypeScheme -> TypeScheme -> StateT TypeEnv m Bool
isSubSchemeOf (TypeScheme gen1 ty1 acc1) (TypeScheme gen2 ty2 acc2)
| length gen1 /= length gen2 = return False
| otherwise = do
isSub <- isSubtypeOf Covariant (substituteGenerics (Map.fromList $ zip gen1 (map (\g -> AST.TypeGeneric (AST.ScopedLocal g) []) gen2)) ty1) ty2
return $ isSub && hasAccess acc1 acc2
-- | @isSubtypeOf var sub super@ checks whether @sub@ is a subtype of @super@ using the current variance information.
-- For example, when checking covariantly, @Scalar@ is a subtype of @Structure@, and a function @Scalar(Structure)@
-- is a subtype of @Structure(Scalar)@. Note that the variance has been flipped when checking the arguments of the functions.
-- This is because any function that can take a @Structure@ can also take a @Scalar@.
-- Generic type arguments are checked invariantly currently, because they could occur in both covariant and contravariant positions.
| 1,007
|
isSubSchemeOf (TypeScheme gen1 ty1 acc1) (TypeScheme gen2 ty2 acc2)
| length gen1 /= length gen2 = return False
| otherwise = do
isSub <- isSubtypeOf Covariant (substituteGenerics (Map.fromList $ zip gen1 (map (\g -> AST.TypeGeneric (AST.ScopedLocal g) []) gen2)) ty1) ty2
return $ isSub && hasAccess acc1 acc2
-- | @isSubtypeOf var sub super@ checks whether @sub@ is a subtype of @super@ using the current variance information.
-- For example, when checking covariantly, @Scalar@ is a subtype of @Structure@, and a function @Scalar(Structure)@
-- is a subtype of @Structure(Scalar)@. Note that the variance has been flipped when checking the arguments of the functions.
-- This is because any function that can take a @Structure@ can also take a @Scalar@.
-- Generic type arguments are checked invariantly currently, because they could occur in both covariant and contravariant positions.
| 906
| false
| true
| 1
| 22
| 167
| 177
| 86
| 91
| null | null |
teuffy/min-var-ci
|
src/DataAnalysis/Application/Prelude.hs
|
mit
|
makePool :: SqlPersistM a -> IO ConnectionPool
makePool migrate =
do (fp,h) <- openTempFile "/tmp/" "finance.db"
hClose h
pool <- runNoLoggingT (createSqlitePool (T.pack fp) 1)
day <- fmap utctDay getCurrentTime
runSqlPersistMPool migrate pool
return pool
| 282
|
makePool :: SqlPersistM a -> IO ConnectionPool
makePool migrate =
do (fp,h) <- openTempFile "/tmp/" "finance.db"
hClose h
pool <- runNoLoggingT (createSqlitePool (T.pack fp) 1)
day <- fmap utctDay getCurrentTime
runSqlPersistMPool migrate pool
return pool
| 282
|
makePool migrate =
do (fp,h) <- openTempFile "/tmp/" "finance.db"
hClose h
pool <- runNoLoggingT (createSqlitePool (T.pack fp) 1)
day <- fmap utctDay getCurrentTime
runSqlPersistMPool migrate pool
return pool
| 235
| false
| true
| 0
| 14
| 61
| 105
| 45
| 60
| null | null |
karamellpelle/grid
|
source/OpenGL/ES2/Values.hs
|
gpl-3.0
|
gl_TEXTURE_CUBE_MAP_POSITIVE_Y :: GLenum
gl_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517
| 81
|
gl_TEXTURE_CUBE_MAP_POSITIVE_Y :: GLenum
gl_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517
| 81
|
gl_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517
| 40
| false
| true
| 0
| 4
| 6
| 11
| 6
| 5
| null | null |
heathweiss/Tricad
|
src/Scan/ParseJuicy.hs
|
gpl-2.0
|
{- Take every xth element from a list.
Used for: reduce rows from the raw source data, as the usual several hundred or thousand rows from an
image, is probably overkill for a 3D printer.
(mod counter factor == 0) is saying: divide the current row index by the reduction factor, and if there is no
remainder, include the row.
Starts of with a row index of 1, which is passed into reduceRows' to do the actual recursive work.
Must be something in Data.List such as scanl or foldl that would do this same thing.
-}
reduceRows :: RowReductionFactor -> [a] -> [a]
reduceRows factor x = reduceRows' factor 1 x
| 608
|
reduceRows :: RowReductionFactor -> [a] -> [a]
reduceRows factor x = reduceRows' factor 1 x
| 91
|
reduceRows factor x = reduceRows' factor 1 x
| 44
| true
| true
| 0
| 7
| 115
| 38
| 20
| 18
| null | null |
sopvop/cabal
|
Cabal/tests/UnitTests/Distribution/Compat/Graph.hs
|
bsd-3-clause
|
hasNoDups :: Ord a => [a] -> Bool
hasNoDups = loop Set.empty
where
loop _ [] = True
loop s (x:xs) | s' <- Set.insert x s, Set.size s' > Set.size s
= loop s' xs
| otherwise
= False
-- | Produces a graph of size @len@. We sample with 'suchThat'; if we
-- dropped duplicate entries our size could be smaller.
| 381
|
hasNoDups :: Ord a => [a] -> Bool
hasNoDups = loop Set.empty
where
loop _ [] = True
loop s (x:xs) | s' <- Set.insert x s, Set.size s' > Set.size s
= loop s' xs
| otherwise
= False
-- | Produces a graph of size @len@. We sample with 'suchThat'; if we
-- dropped duplicate entries our size could be smaller.
| 381
|
hasNoDups = loop Set.empty
where
loop _ [] = True
loop s (x:xs) | s' <- Set.insert x s, Set.size s' > Set.size s
= loop s' xs
| otherwise
= False
-- | Produces a graph of size @len@. We sample with 'suchThat'; if we
-- dropped duplicate entries our size could be smaller.
| 347
| false
| true
| 0
| 10
| 138
| 127
| 57
| 70
| null | null |
wavewave/webcanvas-server
|
lib/Application/WebCanvas/Server/Yesod.hs
|
bsd-2-clause
|
-- |
cvsItemFileName :: WebCanvasItem -> FilePath
cvsItemFileName (WebCanvasItem uuid _) = "data" </> show uuid ++ ".png" ++ ".base64"
| 137
|
cvsItemFileName :: WebCanvasItem -> FilePath
cvsItemFileName (WebCanvasItem uuid _) = "data" </> show uuid ++ ".png" ++ ".base64"
| 129
|
cvsItemFileName (WebCanvasItem uuid _) = "data" </> show uuid ++ ".png" ++ ".base64"
| 84
| true
| true
| 0
| 8
| 22
| 42
| 21
| 21
| null | null |
micknelso/language-c
|
src/Language/CFamily/Token.hs
|
bsd-3-clause
|
posLenOfTok (TokInt pos ) = pos
| 48
|
posLenOfTok (TokInt pos ) = pos
| 48
|
posLenOfTok (TokInt pos ) = pos
| 48
| false
| false
| 0
| 7
| 22
| 15
| 7
| 8
| null | null |
thiagoarrais/gtk2hs
|
gtk/Graphics/UI/Gtk/ModelView/TreeStoreStatic.hs
|
lgpl-2.1
|
pathToIter :: ArrForest a -> TreePath -> Maybe TreeIter
pathToIter forest [] = Nothing
| 88
|
pathToIter :: ArrForest a -> TreePath -> Maybe TreeIter
pathToIter forest [] = Nothing
| 88
|
pathToIter forest [] = Nothing
| 32
| false
| true
| 0
| 9
| 15
| 37
| 16
| 21
| null | null |
olorin/amazonka
|
amazonka-iam/gen/Network/AWS/IAM/UploadServerCertificate.hs
|
mpl-2.0
|
-- | Creates a value of 'UploadServerCertificate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'uscPath'
--
-- * 'uscCertificateChain'
--
-- * 'uscServerCertificateName'
--
-- * 'uscCertificateBody'
--
-- * 'uscPrivateKey'
uploadServerCertificate
:: Text -- ^ 'uscServerCertificateName'
-> Text -- ^ 'uscCertificateBody'
-> Text -- ^ 'uscPrivateKey'
-> UploadServerCertificate
uploadServerCertificate pServerCertificateName_ pCertificateBody_ pPrivateKey_ =
UploadServerCertificate'
{ _uscPath = Nothing
, _uscCertificateChain = Nothing
, _uscServerCertificateName = pServerCertificateName_
, _uscCertificateBody = pCertificateBody_
, _uscPrivateKey = _Sensitive # pPrivateKey_
}
| 811
|
uploadServerCertificate
:: Text -- ^ 'uscServerCertificateName'
-> Text -- ^ 'uscCertificateBody'
-> Text -- ^ 'uscPrivateKey'
-> UploadServerCertificate
uploadServerCertificate pServerCertificateName_ pCertificateBody_ pPrivateKey_ =
UploadServerCertificate'
{ _uscPath = Nothing
, _uscCertificateChain = Nothing
, _uscServerCertificateName = pServerCertificateName_
, _uscCertificateBody = pCertificateBody_
, _uscPrivateKey = _Sensitive # pPrivateKey_
}
| 500
|
uploadServerCertificate pServerCertificateName_ pCertificateBody_ pPrivateKey_ =
UploadServerCertificate'
{ _uscPath = Nothing
, _uscCertificateChain = Nothing
, _uscServerCertificateName = pServerCertificateName_
, _uscCertificateBody = pCertificateBody_
, _uscPrivateKey = _Sensitive # pPrivateKey_
}
| 330
| true
| true
| 0
| 9
| 140
| 91
| 56
| 35
| null | null |
ulricha/dsh
|
src/Database/DSH/CL/Opt/NestJoin.hs
|
bsd-3-clause
|
zipCorrelatedR :: RewriteC CL
zipCorrelatedR = logR "nestjoin.zipcorrelated" $ do
Comp to (Comp ti e (S (BindQ y f))) (S (BindQ x xs)) <- promoteT idR
let fvs = freeVars e
guardM $ x `elem` fvs && y `elem` fvs
guardM $ x `elem` freeVars f
-- Is f complex as required?
void $ pathT [CompHead, CompQuals, QualsSingleton, BindQualExpr] containsComplexExprT
z <- freshNameT [y]
let genComp = Comp (ListT $ typeOf f) f (S $ BindQ x xs)
zipGen = P.zip xs genComp
zt = elemT $ typeOf zipGen
zv = Var zt z
f' <- substM x (P.fst zv) e
let innerComp = Comp ti f' (S $ BindQ y (P.snd zv))
outerComp = Comp to innerComp (S (BindQ z zipGen))
return $ inject outerComp
--------------------------------------------------------------------------------
-- Normalization of nesting patterns
-- | Consider the case in which a comprehension is hidden in the
-- generator of an inner comprehension, such that the generator
-- depends on the outer variable and the inner comprehension can not
-- be unnested.
--
-- In this case, perform the inverse rewrite to M-Norm-3: Nest the
-- generator expression into the outer comprehension
--
-- [ [ e y | y <- g x ] | x <- xs ]
-- =>
-- [ [ e y | y <- z ] | z <- [ g x | x <- xs ] ]
--
-- provided that g contains at least one unnestable comprehension
--
-- Important: This is the dual rewrite to M-Norm-3. An unconditional
-- application will lead into a rewriting loop. It **must** be
-- combined with a rewrite that makes progress on g and xs.
-- nestingGenR :: RewriteC CL
-- nestingGenR = logR "nestjoin.nestinggen" $ do
-- Comp to (Comp ti e (S (BindQ y g))) (S (BindQ x xs)) <- promoteT idR
-- -- Generator expression g should depend on x (otherwise we could
-- -- unnest directly
-- guardM $ x `elem` freeVars g
-- -- Generator expression g should contain at least one unnestable
-- -- comprehension
-- void $ constNodeT g >>> searchNestedCompT x
-- z <- freshNameT []
-- let gty = typeOf g
-- let innerComp = Comp ti e (S (BindQ y (Var gty z)))
-- genComp = Comp (ListT gty) g (S (BindQ x xs))
-- outerComp = Comp to innerComp (S (BindQ z genComp))
-- return $ inject outerComp
--------------------------------------------------------------------------------
-- Normalization of nesting patterns
| 2,392
|
zipCorrelatedR :: RewriteC CL
zipCorrelatedR = logR "nestjoin.zipcorrelated" $ do
Comp to (Comp ti e (S (BindQ y f))) (S (BindQ x xs)) <- promoteT idR
let fvs = freeVars e
guardM $ x `elem` fvs && y `elem` fvs
guardM $ x `elem` freeVars f
-- Is f complex as required?
void $ pathT [CompHead, CompQuals, QualsSingleton, BindQualExpr] containsComplexExprT
z <- freshNameT [y]
let genComp = Comp (ListT $ typeOf f) f (S $ BindQ x xs)
zipGen = P.zip xs genComp
zt = elemT $ typeOf zipGen
zv = Var zt z
f' <- substM x (P.fst zv) e
let innerComp = Comp ti f' (S $ BindQ y (P.snd zv))
outerComp = Comp to innerComp (S (BindQ z zipGen))
return $ inject outerComp
--------------------------------------------------------------------------------
-- Normalization of nesting patterns
-- | Consider the case in which a comprehension is hidden in the
-- generator of an inner comprehension, such that the generator
-- depends on the outer variable and the inner comprehension can not
-- be unnested.
--
-- In this case, perform the inverse rewrite to M-Norm-3: Nest the
-- generator expression into the outer comprehension
--
-- [ [ e y | y <- g x ] | x <- xs ]
-- =>
-- [ [ e y | y <- z ] | z <- [ g x | x <- xs ] ]
--
-- provided that g contains at least one unnestable comprehension
--
-- Important: This is the dual rewrite to M-Norm-3. An unconditional
-- application will lead into a rewriting loop. It **must** be
-- combined with a rewrite that makes progress on g and xs.
-- nestingGenR :: RewriteC CL
-- nestingGenR = logR "nestjoin.nestinggen" $ do
-- Comp to (Comp ti e (S (BindQ y g))) (S (BindQ x xs)) <- promoteT idR
-- -- Generator expression g should depend on x (otherwise we could
-- -- unnest directly
-- guardM $ x `elem` freeVars g
-- -- Generator expression g should contain at least one unnestable
-- -- comprehension
-- void $ constNodeT g >>> searchNestedCompT x
-- z <- freshNameT []
-- let gty = typeOf g
-- let innerComp = Comp ti e (S (BindQ y (Var gty z)))
-- genComp = Comp (ListT gty) g (S (BindQ x xs))
-- outerComp = Comp to innerComp (S (BindQ z genComp))
-- return $ inject outerComp
--------------------------------------------------------------------------------
-- Normalization of nesting patterns
| 2,392
|
zipCorrelatedR = logR "nestjoin.zipcorrelated" $ do
Comp to (Comp ti e (S (BindQ y f))) (S (BindQ x xs)) <- promoteT idR
let fvs = freeVars e
guardM $ x `elem` fvs && y `elem` fvs
guardM $ x `elem` freeVars f
-- Is f complex as required?
void $ pathT [CompHead, CompQuals, QualsSingleton, BindQualExpr] containsComplexExprT
z <- freshNameT [y]
let genComp = Comp (ListT $ typeOf f) f (S $ BindQ x xs)
zipGen = P.zip xs genComp
zt = elemT $ typeOf zipGen
zv = Var zt z
f' <- substM x (P.fst zv) e
let innerComp = Comp ti f' (S $ BindQ y (P.snd zv))
outerComp = Comp to innerComp (S (BindQ z zipGen))
return $ inject outerComp
--------------------------------------------------------------------------------
-- Normalization of nesting patterns
-- | Consider the case in which a comprehension is hidden in the
-- generator of an inner comprehension, such that the generator
-- depends on the outer variable and the inner comprehension can not
-- be unnested.
--
-- In this case, perform the inverse rewrite to M-Norm-3: Nest the
-- generator expression into the outer comprehension
--
-- [ [ e y | y <- g x ] | x <- xs ]
-- =>
-- [ [ e y | y <- z ] | z <- [ g x | x <- xs ] ]
--
-- provided that g contains at least one unnestable comprehension
--
-- Important: This is the dual rewrite to M-Norm-3. An unconditional
-- application will lead into a rewriting loop. It **must** be
-- combined with a rewrite that makes progress on g and xs.
-- nestingGenR :: RewriteC CL
-- nestingGenR = logR "nestjoin.nestinggen" $ do
-- Comp to (Comp ti e (S (BindQ y g))) (S (BindQ x xs)) <- promoteT idR
-- -- Generator expression g should depend on x (otherwise we could
-- -- unnest directly
-- guardM $ x `elem` freeVars g
-- -- Generator expression g should contain at least one unnestable
-- -- comprehension
-- void $ constNodeT g >>> searchNestedCompT x
-- z <- freshNameT []
-- let gty = typeOf g
-- let innerComp = Comp ti e (S (BindQ y (Var gty z)))
-- genComp = Comp (ListT gty) g (S (BindQ x xs))
-- outerComp = Comp to innerComp (S (BindQ z genComp))
-- return $ inject outerComp
--------------------------------------------------------------------------------
-- Normalization of nesting patterns
| 2,362
| false
| true
| 1
| 18
| 573
| 371
| 197
| 174
| null | null |
d0kt0r0/Tidal
|
src/Sound/Tidal/old/Parse.hs
|
gpl-3.0
|
brackets = P.brackets lexer
| 27
|
brackets = P.brackets lexer
| 27
|
brackets = P.brackets lexer
| 27
| false
| false
| 0
| 6
| 3
| 11
| 5
| 6
| null | null |
megantti/rtorrent-rpc
|
Network/RTorrent/Torrent.hs
|
mit
|
getTorrentSizeBytes :: TorrentId -> TorrentAction Int
getTorrentSizeBytes = simpleAction "d.get_size_bytes" []
| 110
|
getTorrentSizeBytes :: TorrentId -> TorrentAction Int
getTorrentSizeBytes = simpleAction "d.get_size_bytes" []
| 110
|
getTorrentSizeBytes = simpleAction "d.get_size_bytes" []
| 56
| false
| true
| 0
| 6
| 10
| 25
| 12
| 13
| null | null |
jtojnar/haste-compiler
|
src/Haste/CodeGen.hs
|
bsd-3-clause
|
genEx (StgLet bind ex) = do
genBindRec bind
genEx ex
| 56
|
genEx (StgLet bind ex) = do
genBindRec bind
genEx ex
| 56
|
genEx (StgLet bind ex) = do
genBindRec bind
genEx ex
| 56
| false
| false
| 0
| 7
| 13
| 29
| 12
| 17
| null | null |
danr/hipspec
|
examples/old-examples/hip/Integers.hs
|
gpl-3.0
|
one = P (S Z)
| 13
|
one = P (S Z)
| 13
|
one = P (S Z)
| 13
| false
| false
| 1
| 6
| 4
| 18
| 7
| 11
| null | null |
diegomachadosoares/hcomp
|
Parser.hs
|
gpl-3.0
|
expA = explist <|> expN
| 23
|
expA = explist <|> expN
| 23
|
expA = explist <|> expN
| 23
| false
| false
| 1
| 5
| 4
| 13
| 5
| 8
| null | null |
pikajude/yesod
|
yesod-auth-oauth/Yesod/Auth/OAuth.hs
|
mit
|
authTumblr :: YesodAuth m
=> ByteString -- ^ Consumer Key
-> ByteString -- ^ Consumer Secret
-> AuthPlugin m
authTumblr key secret = authOAuth
(newOAuth { oauthServerName = "tumblr"
, oauthRequestUri = "http://www.tumblr.com/oauth/request_token"
, oauthAccessTokenUri = "http://www.tumblr.com/oauth/access_token"
, oauthAuthorizeUri = "http://www.tumblr.com/oauth/authorize"
, oauthSignatureMethod = HMACSHA1
, oauthConsumerKey = key
, oauthConsumerSecret = secret
, oauthVersion = OAuth10a
})
(mkExtractCreds "tumblr" "name")
| 829
|
authTumblr :: YesodAuth m
=> ByteString -- ^ Consumer Key
-> ByteString -- ^ Consumer Secret
-> AuthPlugin m
authTumblr key secret = authOAuth
(newOAuth { oauthServerName = "tumblr"
, oauthRequestUri = "http://www.tumblr.com/oauth/request_token"
, oauthAccessTokenUri = "http://www.tumblr.com/oauth/access_token"
, oauthAuthorizeUri = "http://www.tumblr.com/oauth/authorize"
, oauthSignatureMethod = HMACSHA1
, oauthConsumerKey = key
, oauthConsumerSecret = secret
, oauthVersion = OAuth10a
})
(mkExtractCreds "tumblr" "name")
| 829
|
authTumblr key secret = authOAuth
(newOAuth { oauthServerName = "tumblr"
, oauthRequestUri = "http://www.tumblr.com/oauth/request_token"
, oauthAccessTokenUri = "http://www.tumblr.com/oauth/access_token"
, oauthAuthorizeUri = "http://www.tumblr.com/oauth/authorize"
, oauthSignatureMethod = HMACSHA1
, oauthConsumerKey = key
, oauthConsumerSecret = secret
, oauthVersion = OAuth10a
})
(mkExtractCreds "tumblr" "name")
| 684
| false
| true
| 0
| 9
| 363
| 108
| 60
| 48
| null | null |
ksaveljev/hake-2
|
src/Game/Monsters/MParasite.hs
|
bsd-3-clause
|
parasiteMoveStand :: MMoveT
parasiteMoveStand = MMoveT "parasiteMoveStand" frameStand01 frameStand17 parasiteFramesStand (Just parasiteStand)
| 141
|
parasiteMoveStand :: MMoveT
parasiteMoveStand = MMoveT "parasiteMoveStand" frameStand01 frameStand17 parasiteFramesStand (Just parasiteStand)
| 141
|
parasiteMoveStand = MMoveT "parasiteMoveStand" frameStand01 frameStand17 parasiteFramesStand (Just parasiteStand)
| 113
| false
| true
| 0
| 7
| 11
| 28
| 14
| 14
| null | null |
binesiyu/ifl
|
examples/ch27/URLParser.hs
|
mit
|
(/>) :: (URLPart a _z, URLPart b c) => a -> b -> URLParser c
a /> b = urlPart a *> char '/' *> urlPart b
| 104
|
(/>) :: (URLPart a _z, URLPart b c) => a -> b -> URLParser c
a /> b = urlPart a *> char '/' *> urlPart b
| 104
|
a /> b = urlPart a *> char '/' *> urlPart b
| 43
| false
| true
| 4
| 10
| 26
| 73
| 35
| 38
| null | null |
grwlf/cake3
|
src/Development/Cake3/Ext/UrWeb.hs
|
bsd-3-clause
|
mime = UrpMime
| 14
|
mime = UrpMime
| 14
|
mime = UrpMime
| 14
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
mapinguari/SC_HS_Proxy
|
src/Proxy/Query/Unit.hs
|
mit
|
maxHitPoints SpecialCrashedNoradII = 188
| 40
|
maxHitPoints SpecialCrashedNoradII = 188
| 40
|
maxHitPoints SpecialCrashedNoradII = 188
| 40
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
wavewave/lhc-analysis-collection
|
lib/HEP/Physics/Analysis/ATLAS/SUSY/SUSY_0L2to6JMET_7TeV.hs
|
gpl-3.0
|
-- mTauBJetMerge :: (MonadPlus m) => IxStateT m RawEv JetMergedEv ()
-- mTauBJetMerge = imodify taubjetMergeIx
{-
deltaRdist :: (MomObj a, MomObj b) => a -> b -> Double
deltaRdist a b = let deta = eta a - eta b
dphi = normalizeDphi (phi a) (phi b)
in sqrt (deta*deta + dphi*dphi)
-}
findJetNearElec :: PhyEventClassified -> ([(Int,PhyObj Jet)],[(Int,PhyObj Jet)])
findJetNearElec PhyEventClassified {..} =
let js = jetlst
es = electronlst
in pass2 0.2 es js
where
pass1 v l js = foldr (findInside v l) ([],[]) js
where findInside v l j (sel,rem) =
if deltaRdist (snd l) (snd j) < v then ((j:sel),rem) else (sel,j:rem)
pass2 v ls js = (,) <$> ptordering . fst <*> ptordering . snd $ foldr (pass1proc v) ([],js) ls
where pass1proc v l (sel,rem) =
let (sel',rem') = pass1 v l rem
in (sel++sel',rem')
| 923
|
findJetNearElec :: PhyEventClassified -> ([(Int,PhyObj Jet)],[(Int,PhyObj Jet)])
findJetNearElec PhyEventClassified {..} =
let js = jetlst
es = electronlst
in pass2 0.2 es js
where
pass1 v l js = foldr (findInside v l) ([],[]) js
where findInside v l j (sel,rem) =
if deltaRdist (snd l) (snd j) < v then ((j:sel),rem) else (sel,j:rem)
pass2 v ls js = (,) <$> ptordering . fst <*> ptordering . snd $ foldr (pass1proc v) ([],js) ls
where pass1proc v l (sel,rem) =
let (sel',rem') = pass1 v l rem
in (sel++sel',rem')
| 595
|
findJetNearElec PhyEventClassified {..} =
let js = jetlst
es = electronlst
in pass2 0.2 es js
where
pass1 v l js = foldr (findInside v l) ([],[]) js
where findInside v l j (sel,rem) =
if deltaRdist (snd l) (snd j) < v then ((j:sel),rem) else (sel,j:rem)
pass2 v ls js = (,) <$> ptordering . fst <*> ptordering . snd $ foldr (pass1proc v) ([],js) ls
where pass1proc v l (sel,rem) =
let (sel',rem') = pass1 v l rem
in (sel++sel',rem')
| 514
| true
| true
| 0
| 13
| 269
| 304
| 163
| 141
| null | null |
beni55/aeson
|
Data/Aeson/Types/Internal.hs
|
bsd-3-clause
|
-- | Converts from CamelCase to another lower case, interspersing
-- the character between all capital letters and their previous
-- entries, except those capital letters that appear together,
-- like 'API'.
--
-- For use by Aeson template haskell calls.
--
-- > camelTo '_' 'CamelCaseAPI' == "camel_case_api"
camelTo :: Char -> String -> String
camelTo c = lastWasCap True
where
lastWasCap :: Bool -- ^ Previous was a capital letter
-> String -- ^ The remaining string
-> String
lastWasCap _ [] = []
lastWasCap prev (x : xs) = if isUpper x
then if prev
then toLower x : lastWasCap True xs
else c : toLower x : lastWasCap True xs
else x : lastWasCap False xs
| 897
|
camelTo :: Char -> String -> String
camelTo c = lastWasCap True
where
lastWasCap :: Bool -- ^ Previous was a capital letter
-> String -- ^ The remaining string
-> String
lastWasCap _ [] = []
lastWasCap prev (x : xs) = if isUpper x
then if prev
then toLower x : lastWasCap True xs
else c : toLower x : lastWasCap True xs
else x : lastWasCap False xs
| 577
|
camelTo c = lastWasCap True
where
lastWasCap :: Bool -- ^ Previous was a capital letter
-> String -- ^ The remaining string
-> String
lastWasCap _ [] = []
lastWasCap prev (x : xs) = if isUpper x
then if prev
then toLower x : lastWasCap True xs
else c : toLower x : lastWasCap True xs
else x : lastWasCap False xs
| 541
| true
| true
| 0
| 9
| 358
| 138
| 73
| 65
| null | null |
konn/pandoc-japanese-docx
|
src/Text/Pandoc/Readers/Docx/Parse.hs
|
gpl-2.0
|
lookupRelationship :: RelId -> [Relationship] -> Maybe Target
lookupRelationship relid rels =
lookup relid (map (\(Relationship pair) -> pair) rels)
| 150
|
lookupRelationship :: RelId -> [Relationship] -> Maybe Target
lookupRelationship relid rels =
lookup relid (map (\(Relationship pair) -> pair) rels)
| 150
|
lookupRelationship relid rels =
lookup relid (map (\(Relationship pair) -> pair) rels)
| 88
| false
| true
| 0
| 11
| 21
| 57
| 29
| 28
| null | null |
beni55/qoropa
|
src/Qoropa/Buffer/Folder.hs
|
gpl-2.0
|
emptyStatusMessage :: StatusMessage
emptyStatusMessage = StatusMessage { sMessage = " " }
| 89
|
emptyStatusMessage :: StatusMessage
emptyStatusMessage = StatusMessage { sMessage = " " }
| 89
|
emptyStatusMessage = StatusMessage { sMessage = " " }
| 53
| false
| true
| 0
| 7
| 11
| 26
| 12
| 14
| null | null |
ndmitchell/safe
|
Safe/Foldable.hs
|
bsd-3-clause
|
foldr1Safe :: (Monoid m, Foldable t) => (m -> m -> m) -> t m -> m
foldr1Safe fun = F.foldr fun mempty
| 101
|
foldr1Safe :: (Monoid m, Foldable t) => (m -> m -> m) -> t m -> m
foldr1Safe fun = F.foldr fun mempty
| 101
|
foldr1Safe fun = F.foldr fun mempty
| 35
| false
| true
| 0
| 10
| 22
| 65
| 30
| 35
| null | null |
phischu/fragnix
|
tests/packages/scotty/Data.Vector.Primitive.hs
|
bsd-3-clause
|
findIndices = G.findIndices
| 27
|
findIndices = G.findIndices
| 27
|
findIndices = G.findIndices
| 27
| false
| false
| 1
| 6
| 2
| 12
| 4
| 8
| null | null |
brendanhay/gogol
|
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/Creatives/List.hs
|
mpl-2.0
|
-- | OAuth access token.
cAccessToken :: Lens' CreativesList (Maybe Text)
cAccessToken
= lens _cAccessToken (\ s a -> s{_cAccessToken = a})
| 141
|
cAccessToken :: Lens' CreativesList (Maybe Text)
cAccessToken
= lens _cAccessToken (\ s a -> s{_cAccessToken = a})
| 116
|
cAccessToken
= lens _cAccessToken (\ s a -> s{_cAccessToken = a})
| 67
| true
| true
| 1
| 9
| 23
| 52
| 25
| 27
| null | null |
FranklinChen/hugs98-plus-Sep2006
|
packages/fgl/Data/Graph/Inductive/Example.hs
|
bsd-3-clause
|
g3b = ([("down",2)], 3,'c',[("up",1)]) & (
([("right",1)],2,'b',[("left",1)]) & (
([],1,'a',[]) & empty ))
| 141
|
g3b = ([("down",2)], 3,'c',[("up",1)]) & (
([("right",1)],2,'b',[("left",1)]) & (
([],1,'a',[]) & empty ))
| 141
|
g3b = ([("down",2)], 3,'c',[("up",1)]) & (
([("right",1)],2,'b',[("left",1)]) & (
([],1,'a',[]) & empty ))
| 141
| false
| false
| 1
| 12
| 47
| 104
| 63
| 41
| null | null |
CloudI/CloudI
|
src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Builder/Prim/ASCII.hs
|
mit
|
word32Hex :: BoundedPrim Word32
word32Hex = encodeWordHex
| 57
|
word32Hex :: BoundedPrim Word32
word32Hex = encodeWordHex
| 57
|
word32Hex = encodeWordHex
| 25
| false
| true
| 0
| 6
| 6
| 20
| 8
| 12
| null | null |
fultonms/artificial-intelligence
|
a1/Tiling.hs
|
mit
|
testRow :: [Tile] -> Bool
testRow [] = True
| 43
|
testRow :: [Tile] -> Bool
testRow [] = True
| 43
|
testRow [] = True
| 17
| false
| true
| 0
| 6
| 8
| 23
| 12
| 11
| null | null |
khibino/haskell-data-handle
|
System/Handle/Enumerator.hs
|
bsd-3-clause
|
onnectFrom :: Enumerator ByteString IO () -> IO Handle
connectFrom e =
do (rfh, wfh) <- createPipe
_ <- forkIO (run_ (e $$ iterHandle wfh) >> hClose wfh)
toIO rfh
| 175
|
connectFrom :: Enumerator ByteString IO () -> IO Handle
connectFrom e =
do (rfh, wfh) <- createPipe
_ <- forkIO (run_ (e $$ iterHandle wfh) >> hClose wfh)
toIO rfh
| 175
|
connectFrom e =
do (rfh, wfh) <- createPipe
_ <- forkIO (run_ (e $$ iterHandle wfh) >> hClose wfh)
toIO rfh
| 119
| false
| true
| 0
| 14
| 42
| 86
| 39
| 47
| null | null |
Refefer/hf
|
src/Write.hs
|
apache-2.0
|
splitLeft :: Write -> (String, String) -> (Write, Write)
splitLeft w (leftS, rightS) = (leftEW, rightEW)
where leftEW = w { contents = leftS }
rightEW = w { justify = LeftRelative leftEW, contents = rightS }
| 218
|
splitLeft :: Write -> (String, String) -> (Write, Write)
splitLeft w (leftS, rightS) = (leftEW, rightEW)
where leftEW = w { contents = leftS }
rightEW = w { justify = LeftRelative leftEW, contents = rightS }
| 218
|
splitLeft w (leftS, rightS) = (leftEW, rightEW)
where leftEW = w { contents = leftS }
rightEW = w { justify = LeftRelative leftEW, contents = rightS }
| 161
| false
| true
| 1
| 8
| 47
| 88
| 50
| 38
| null | null |
Persi/shellcheck
|
ShellCheck/Parser.hs
|
gpl-3.0
|
prop_readPipeline2 = isWarning readPipeline "!cat /etc/issue | grep -i ubuntu"
| 78
|
prop_readPipeline2 = isWarning readPipeline "!cat /etc/issue | grep -i ubuntu"
| 78
|
prop_readPipeline2 = isWarning readPipeline "!cat /etc/issue | grep -i ubuntu"
| 78
| false
| false
| 0
| 5
| 9
| 11
| 5
| 6
| null | null |
timtylin/scholdoc-texmath
|
src/Text/TeXMath/Readers/TeX.hs
|
gpl-2.0
|
hacek 'N' = "Ň"
| 15
|
hacek 'N' = "Ň"
| 15
|
hacek 'N' = "Ň"
| 15
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
TomMD/cryptol
|
src/Cryptol/ModuleSystem/Base.hs
|
bsd-3-clause
|
genInferInput :: Range -> IfaceDecls -> ModuleM T.InferInput
genInferInput r env = do
seeds <- getNameSeeds
-- TODO: include the environment needed by the module
return T.InferInput
{ T.inpRange = r
, T.inpVars = Map.map ifDeclSig (filterEnv ifDecls)
, T.inpTSyns = filterEnv ifTySyns
, T.inpNewtypes = filterEnv ifNewtypes
, T.inpNameSeeds = seeds
}
where
-- at this point, the names used in the aggregate interface should be
-- unique
keepOne :: (QName,[a]) -> Maybe (QName,a)
keepOne (qn,syns) = case syns of
[syn] -> Just (qn,syn)
_ -> Nothing
-- keep symbols without duplicates. the renamer would have caught
-- duplication already, so this is safe.
filterEnv p = Map.fromList (mapMaybe keepOne (Map.toList (p env)))
-- Evaluation ------------------------------------------------------------------
evalExpr :: T.Expr -> ModuleM E.Value
evalExpr e = do
env <- getEvalEnv
denv <- getDynEnv
return (E.evalExpr (env <> deEnv denv) e)
evalDecls :: [T.DeclGroup] -> ModuleM ()
evalDecls dgs = do
env <- getEvalEnv
denv <- getDynEnv
let env' = env <> deEnv denv
denv' = denv { deDecls = deDecls denv ++ dgs
, deEnv = E.evalDecls dgs env'
}
setDynEnv denv'
| 1,328
|
genInferInput :: Range -> IfaceDecls -> ModuleM T.InferInput
genInferInput r env = do
seeds <- getNameSeeds
-- TODO: include the environment needed by the module
return T.InferInput
{ T.inpRange = r
, T.inpVars = Map.map ifDeclSig (filterEnv ifDecls)
, T.inpTSyns = filterEnv ifTySyns
, T.inpNewtypes = filterEnv ifNewtypes
, T.inpNameSeeds = seeds
}
where
-- at this point, the names used in the aggregate interface should be
-- unique
keepOne :: (QName,[a]) -> Maybe (QName,a)
keepOne (qn,syns) = case syns of
[syn] -> Just (qn,syn)
_ -> Nothing
-- keep symbols without duplicates. the renamer would have caught
-- duplication already, so this is safe.
filterEnv p = Map.fromList (mapMaybe keepOne (Map.toList (p env)))
-- Evaluation ------------------------------------------------------------------
evalExpr :: T.Expr -> ModuleM E.Value
evalExpr e = do
env <- getEvalEnv
denv <- getDynEnv
return (E.evalExpr (env <> deEnv denv) e)
evalDecls :: [T.DeclGroup] -> ModuleM ()
evalDecls dgs = do
env <- getEvalEnv
denv <- getDynEnv
let env' = env <> deEnv denv
denv' = denv { deDecls = deDecls denv ++ dgs
, deEnv = E.evalDecls dgs env'
}
setDynEnv denv'
| 1,328
|
genInferInput r env = do
seeds <- getNameSeeds
-- TODO: include the environment needed by the module
return T.InferInput
{ T.inpRange = r
, T.inpVars = Map.map ifDeclSig (filterEnv ifDecls)
, T.inpTSyns = filterEnv ifTySyns
, T.inpNewtypes = filterEnv ifNewtypes
, T.inpNameSeeds = seeds
}
where
-- at this point, the names used in the aggregate interface should be
-- unique
keepOne :: (QName,[a]) -> Maybe (QName,a)
keepOne (qn,syns) = case syns of
[syn] -> Just (qn,syn)
_ -> Nothing
-- keep symbols without duplicates. the renamer would have caught
-- duplication already, so this is safe.
filterEnv p = Map.fromList (mapMaybe keepOne (Map.toList (p env)))
-- Evaluation ------------------------------------------------------------------
evalExpr :: T.Expr -> ModuleM E.Value
evalExpr e = do
env <- getEvalEnv
denv <- getDynEnv
return (E.evalExpr (env <> deEnv denv) e)
evalDecls :: [T.DeclGroup] -> ModuleM ()
evalDecls dgs = do
env <- getEvalEnv
denv <- getDynEnv
let env' = env <> deEnv denv
denv' = denv { deDecls = deDecls denv ++ dgs
, deEnv = E.evalDecls dgs env'
}
setDynEnv denv'
| 1,267
| false
| true
| 0
| 13
| 356
| 378
| 194
| 184
| null | null |
mainland/dph
|
dph-base/Data/Array/Parallel/Base/DTrace.hs
|
bsd-3-clause
|
traceLoopEntryST s = unsafeIOToST (traceLoopEntryIO s)
| 54
|
traceLoopEntryST s = unsafeIOToST (traceLoopEntryIO s)
| 54
|
traceLoopEntryST s = unsafeIOToST (traceLoopEntryIO s)
| 54
| false
| false
| 1
| 7
| 5
| 21
| 8
| 13
| null | null |
jrahm/DuckTest
|
src/DuckTest/AST/Util.hs
|
bsd-2-clause
|
walkStatements :: Statement a -> [Statement a]
walkStatements stmt =
case stmt of
Fun {fun_body = body} -> stmt : concatMap walkStatements body
Class {class_body = body} -> stmt : concatMap walkStatements body
While {while_body = body} -> stmt : concatMap walkStatements body
For {for_body = body, for_else = el} -> stmt : concatMap walkStatements body ++ concatMap walkStatements el
_ -> return stmt -- todo add more
| 461
|
walkStatements :: Statement a -> [Statement a]
walkStatements stmt =
case stmt of
Fun {fun_body = body} -> stmt : concatMap walkStatements body
Class {class_body = body} -> stmt : concatMap walkStatements body
While {while_body = body} -> stmt : concatMap walkStatements body
For {for_body = body, for_else = el} -> stmt : concatMap walkStatements body ++ concatMap walkStatements el
_ -> return stmt -- todo add more
| 461
|
walkStatements stmt =
case stmt of
Fun {fun_body = body} -> stmt : concatMap walkStatements body
Class {class_body = body} -> stmt : concatMap walkStatements body
While {while_body = body} -> stmt : concatMap walkStatements body
For {for_body = body, for_else = el} -> stmt : concatMap walkStatements body ++ concatMap walkStatements el
_ -> return stmt -- todo add more
| 414
| false
| true
| 0
| 10
| 111
| 152
| 76
| 76
| null | null |
sdiehl/ghc
|
compiler/GHC/Iface/Ext/Utils.hs
|
bsd-3-clause
|
flattenAst :: HieAST a -> [HieAST a]
flattenAst n =
n : concatMap flattenAst (nodeChildren n)
| 95
|
flattenAst :: HieAST a -> [HieAST a]
flattenAst n =
n : concatMap flattenAst (nodeChildren n)
| 95
|
flattenAst n =
n : concatMap flattenAst (nodeChildren n)
| 58
| false
| true
| 0
| 8
| 17
| 42
| 20
| 22
| null | null |
svenssonjoel/ObsidianGFX
|
Examples/Simple/Increment.hs
|
bsd-3-clause
|
increment' :: DPull (SPull (SPull EWord32)) -> DPush Grid EWord32
increment' arr = pConcat (fmap body arr)
where body a = tConcat (fmap (push . incLocal) a)
| 161
|
increment' :: DPull (SPull (SPull EWord32)) -> DPush Grid EWord32
increment' arr = pConcat (fmap body arr)
where body a = tConcat (fmap (push . incLocal) a)
| 160
|
increment' arr = pConcat (fmap body arr)
where body a = tConcat (fmap (push . incLocal) a)
| 94
| false
| true
| 0
| 10
| 31
| 77
| 37
| 40
| null | null |
tjhance/logic-puzzles
|
src/Main.hs
|
mit
|
battleshipEx4 :: BattleshipInst
battleshipEx4 =
let grid = map (map battleShipCharToInput) [
" ",
"o ",
" ",
" ~ ",
" ",
" ",
" ",
" S ",
" ",
" "]
shipNums = [4, 3, 2, 1]
rowCounts = [1, 1, 0, 2, 6, 2, 1, 1, 6, 0]
colCounts = [4, 1, 4, 1, 2, 1, 3, 1, 1, 2]
in (shipNums, grid, rowCounts, colCounts)
| 536
|
battleshipEx4 :: BattleshipInst
battleshipEx4 =
let grid = map (map battleShipCharToInput) [
" ",
"o ",
" ",
" ~ ",
" ",
" ",
" ",
" S ",
" ",
" "]
shipNums = [4, 3, 2, 1]
rowCounts = [1, 1, 0, 2, 6, 2, 1, 1, 6, 0]
colCounts = [4, 1, 4, 1, 2, 1, 3, 1, 1, 2]
in (shipNums, grid, rowCounts, colCounts)
| 536
|
battleshipEx4 =
let grid = map (map battleShipCharToInput) [
" ",
"o ",
" ",
" ~ ",
" ",
" ",
" ",
" S ",
" ",
" "]
shipNums = [4, 3, 2, 1]
rowCounts = [1, 1, 0, 2, 6, 2, 1, 1, 6, 0]
colCounts = [4, 1, 4, 1, 2, 1, 3, 1, 1, 2]
in (shipNums, grid, rowCounts, colCounts)
| 504
| false
| true
| 0
| 11
| 305
| 169
| 102
| 67
| null | null |
anchor/vaultaire-collector-ceilometer
|
lib/Vaultaire/Collector/Ceilometer/Process/Common.hs
|
mit
|
-- | Constructs a unique Address for a Metric from its identifying data
getAddress :: Metric -> Text -> Address
getAddress m name = hashIdentifier $ T.encodeUtf8 $ mconcat $ getIdElements m name
| 194
|
getAddress :: Metric -> Text -> Address
getAddress m name = hashIdentifier $ T.encodeUtf8 $ mconcat $ getIdElements m name
| 122
|
getAddress m name = hashIdentifier $ T.encodeUtf8 $ mconcat $ getIdElements m name
| 82
| true
| true
| 0
| 8
| 32
| 44
| 22
| 22
| null | null |
hlian/cryptohaos
|
src/One.hs
|
bsd-3-clause
|
frequency '$' = -1000
| 21
|
frequency '$' = -1000
| 21
|
frequency '$' = -1000
| 21
| false
| false
| 1
| 5
| 3
| 14
| 5
| 9
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.