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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
forsyde/forsyde-atom
|
src/ForSyDe/Atom/MoC/SDF/SADF.hs
|
bsd-3-clause
|
kernel14 sf s1 =
(scen14 <$$> sf -*- s1 -*<<<)
| 48
|
kernel14 sf s1 =
(scen14 <$$> sf -*- s1 -*<<<)
| 48
|
kernel14 sf s1 =
(scen14 <$$> sf -*- s1 -*<<<)
| 48
| false
| false
| 0
| 7
| 11
| 23
| 12
| 11
| null | null |
sgord512/Algebra
|
Algebra/Rewriting.hs
|
mit
|
p = mergeMonomials
| 18
|
p = mergeMonomials
| 18
|
p = mergeMonomials
| 18
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
raptros/respond
|
src/Web/Respond/Path.hs
|
bsd-3-clause
|
-- | convert a predicate into a 'PathExtractor0'
predicateExtractor :: (T.Text -> Bool) -> PathExtractor0
predicateExtractor = unitExtractor . (mayWhen () .)
| 157
|
predicateExtractor :: (T.Text -> Bool) -> PathExtractor0
predicateExtractor = unitExtractor . (mayWhen () .)
| 108
|
predicateExtractor = unitExtractor . (mayWhen () .)
| 51
| true
| true
| 0
| 9
| 21
| 45
| 22
| 23
| null | null |
LambdaHack/LambdaHack
|
engine-src/Game/LambdaHack/Client/UI/Key.hs
|
bsd-3-clause
|
downKM :: KM
downKM = KM NoModifier Down
| 40
|
downKM :: KM
downKM = KM NoModifier Down
| 40
|
downKM = KM NoModifier Down
| 27
| false
| true
| 0
| 5
| 7
| 16
| 8
| 8
| null | null |
tedkornish/stack
|
src/Stack/Build/ConstructPlan.hs
|
bsd-3-clause
|
tellExecutablesPackage :: InstallLocation -> Package -> M ()
tellExecutablesPackage loc p = do
cm <- asks combinedMap
-- Determine which components are enabled so we know which ones to copy
let myComps =
case Map.lookup (packageName p) cm of
Nothing -> assert False Set.empty
Just (PIOnlyInstalled _ _ _) -> Set.empty
Just (PIOnlySource ps) -> goSource ps
Just (PIBoth ps _) -> goSource ps
goSource (PSLocal lp) = fromMaybe Set.empty $ lpExeComponents lp
goSource (PSUpstream _ _ _) = Set.empty
tell mempty { wInstall = m myComps }
where
m myComps = Map.fromList $ map (, loc) $ Set.toList
$ filterComps myComps $ packageExes p
filterComps myComps x
| Set.null myComps = x
| otherwise = Set.intersection x $ Set.map toExe myComps
toExe x = fromMaybe x $ T.stripPrefix "exe:" x
-- TODO There are a lot of duplicated computations below. I've kept that for
-- simplicity right now
| 1,034
|
tellExecutablesPackage :: InstallLocation -> Package -> M ()
tellExecutablesPackage loc p = do
cm <- asks combinedMap
-- Determine which components are enabled so we know which ones to copy
let myComps =
case Map.lookup (packageName p) cm of
Nothing -> assert False Set.empty
Just (PIOnlyInstalled _ _ _) -> Set.empty
Just (PIOnlySource ps) -> goSource ps
Just (PIBoth ps _) -> goSource ps
goSource (PSLocal lp) = fromMaybe Set.empty $ lpExeComponents lp
goSource (PSUpstream _ _ _) = Set.empty
tell mempty { wInstall = m myComps }
where
m myComps = Map.fromList $ map (, loc) $ Set.toList
$ filterComps myComps $ packageExes p
filterComps myComps x
| Set.null myComps = x
| otherwise = Set.intersection x $ Set.map toExe myComps
toExe x = fromMaybe x $ T.stripPrefix "exe:" x
-- TODO There are a lot of duplicated computations below. I've kept that for
-- simplicity right now
| 1,034
|
tellExecutablesPackage loc p = do
cm <- asks combinedMap
-- Determine which components are enabled so we know which ones to copy
let myComps =
case Map.lookup (packageName p) cm of
Nothing -> assert False Set.empty
Just (PIOnlyInstalled _ _ _) -> Set.empty
Just (PIOnlySource ps) -> goSource ps
Just (PIBoth ps _) -> goSource ps
goSource (PSLocal lp) = fromMaybe Set.empty $ lpExeComponents lp
goSource (PSUpstream _ _ _) = Set.empty
tell mempty { wInstall = m myComps }
where
m myComps = Map.fromList $ map (, loc) $ Set.toList
$ filterComps myComps $ packageExes p
filterComps myComps x
| Set.null myComps = x
| otherwise = Set.intersection x $ Set.map toExe myComps
toExe x = fromMaybe x $ T.stripPrefix "exe:" x
-- TODO There are a lot of duplicated computations below. I've kept that for
-- simplicity right now
| 973
| false
| true
| 6
| 15
| 305
| 333
| 150
| 183
| null | null |
kylcarte/wangtiles
|
src/Tile/Legend.hs
|
bsd-3-clause
|
parseRoomLine :: (CoordType c) => c -> RoomParse c
-> Text -> RoomParse c
parseRoomLine r rp = foldr fn rp . zip [0..] . unpack
where
fn (c,ch) (fp,bld) = (fp',bld')
where
(ti,bld') = rbldInsert ch bld
fp' = tmInsert (mkCoord c r) ti fp
| 254
|
parseRoomLine :: (CoordType c) => c -> RoomParse c
-> Text -> RoomParse c
parseRoomLine r rp = foldr fn rp . zip [0..] . unpack
where
fn (c,ch) (fp,bld) = (fp',bld')
where
(ti,bld') = rbldInsert ch bld
fp' = tmInsert (mkCoord c r) ti fp
| 254
|
parseRoomLine r rp = foldr fn rp . zip [0..] . unpack
where
fn (c,ch) (fp,bld) = (fp',bld')
where
(ti,bld') = rbldInsert ch bld
fp' = tmInsert (mkCoord c r) ti fp
| 178
| false
| true
| 0
| 10
| 63
| 134
| 68
| 66
| null | null |
charlescrain/tholos
|
app/Main.hs
|
bsd-3-clause
|
initDB :: IO Connection
initDB = do
connInfo <- DB.buildConnectInfo
let dbName = connectDatabase connInfo
_ <- createDBIfNeeded connInfo dbName
connect connInfo
| 168
|
initDB :: IO Connection
initDB = do
connInfo <- DB.buildConnectInfo
let dbName = connectDatabase connInfo
_ <- createDBIfNeeded connInfo dbName
connect connInfo
| 168
|
initDB = do
connInfo <- DB.buildConnectInfo
let dbName = connectDatabase connInfo
_ <- createDBIfNeeded connInfo dbName
connect connInfo
| 144
| false
| true
| 1
| 11
| 29
| 57
| 23
| 34
| null | null |
brendanhay/gogol
|
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/ContentCategories/Patch.hs
|
mpl-2.0
|
-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
ccpUploadProtocol :: Lens' ContentCategoriesPatch (Maybe Text)
ccpUploadProtocol
= lens _ccpUploadProtocol
(\ s a -> s{_ccpUploadProtocol = a})
| 213
|
ccpUploadProtocol :: Lens' ContentCategoriesPatch (Maybe Text)
ccpUploadProtocol
= lens _ccpUploadProtocol
(\ s a -> s{_ccpUploadProtocol = a})
| 151
|
ccpUploadProtocol
= lens _ccpUploadProtocol
(\ s a -> s{_ccpUploadProtocol = a})
| 88
| true
| true
| 1
| 9
| 33
| 51
| 25
| 26
| null | null |
jspahrsummers/ScrumBut
|
GitHub.hs
|
mit
|
links :: Parser [Link]
links = link `sepBy` (char ',')
| 54
|
links :: Parser [Link]
links = link `sepBy` (char ',')
| 54
|
links = link `sepBy` (char ',')
| 31
| false
| true
| 0
| 7
| 9
| 29
| 16
| 13
| null | null |
isomorphism/csound-expression
|
src/Csound/Air/Wave.hs
|
bsd-3-clause
|
-- | Unipolar square wave.
usqr :: Sig -> Sig
usqr = unipolar . sqr
| 67
|
usqr :: Sig -> Sig
usqr = unipolar . sqr
| 40
|
usqr = unipolar . sqr
| 21
| true
| true
| 1
| 7
| 14
| 28
| 12
| 16
| null | null |
fpco/stackage-view
|
server/Handler/Command.hs
|
mit
|
-- | Guess the module name of the file by parsing its lines until
-- @module Foo@ is found. This isn't complete but generally should be
-- effective. @module {- bar -} Foo@ won't work but this is a stop-gap
-- anyway. Edsko tells me that requiring the module name in this call
-- is actually a mistake anyway -- we should only need to use the
-- filepath.
guessModuleName :: Text -> IO (Maybe Text)
guessModuleName fp =
runResourceT
(CB.sourceFile (T.unpack fp) $=
CT.decodeUtf8 $=
CT.lines $$
consumePrefix)
where consumePrefix =
do mheader <- await
case mheader of
Nothing ->
return Nothing
Just line
| Just rest <-
T.stripPrefix "module " line -> consumeName rest
| otherwise -> consumePrefix
consumeName (T.strip -> string) =
if probablyModuleName string
then return (Just (takeModuleName string))
else do mnextLine <- await
case mnextLine of
Nothing -> return Nothing
Just line -> consumeName line
probablyModuleName =
T.all isUpper .
T.take 1
takeModuleName = T.takeWhile valid
where valid c =
isLetter c ||
isDigit c ||
elem c "._'"
| 1,397
|
guessModuleName :: Text -> IO (Maybe Text)
guessModuleName fp =
runResourceT
(CB.sourceFile (T.unpack fp) $=
CT.decodeUtf8 $=
CT.lines $$
consumePrefix)
where consumePrefix =
do mheader <- await
case mheader of
Nothing ->
return Nothing
Just line
| Just rest <-
T.stripPrefix "module " line -> consumeName rest
| otherwise -> consumePrefix
consumeName (T.strip -> string) =
if probablyModuleName string
then return (Just (takeModuleName string))
else do mnextLine <- await
case mnextLine of
Nothing -> return Nothing
Just line -> consumeName line
probablyModuleName =
T.all isUpper .
T.take 1
takeModuleName = T.takeWhile valid
where valid c =
isLetter c ||
isDigit c ||
elem c "._'"
| 1,041
|
guessModuleName fp =
runResourceT
(CB.sourceFile (T.unpack fp) $=
CT.decodeUtf8 $=
CT.lines $$
consumePrefix)
where consumePrefix =
do mheader <- await
case mheader of
Nothing ->
return Nothing
Just line
| Just rest <-
T.stripPrefix "module " line -> consumeName rest
| otherwise -> consumePrefix
consumeName (T.strip -> string) =
if probablyModuleName string
then return (Just (takeModuleName string))
else do mnextLine <- await
case mnextLine of
Nothing -> return Nothing
Just line -> consumeName line
probablyModuleName =
T.all isUpper .
T.take 1
takeModuleName = T.takeWhile valid
where valid c =
isLetter c ||
isDigit c ||
elem c "._'"
| 998
| true
| true
| 4
| 16
| 531
| 276
| 130
| 146
| null | null |
kfish/vacuum
|
src/GHC/Vacuum.hs
|
lgpl-3.0
|
nodeH :: HValue -> H [HNodeId]
nodeH = scanNodeH getNodeH' getId' insertG
| 73
|
nodeH :: HValue -> H [HNodeId]
nodeH = scanNodeH getNodeH' getId' insertG
| 73
|
nodeH = scanNodeH getNodeH' getId' insertG
| 42
| false
| true
| 0
| 7
| 11
| 28
| 14
| 14
| null | null |
rleshchinskiy/vector
|
Data/Vector/Fusion/Bundle/Monadic.hs
|
bsd-3-clause
|
enumFromTo x y = fromList [x .. y]
| 34
|
enumFromTo x y = fromList [x .. y]
| 34
|
enumFromTo x y = fromList [x .. y]
| 34
| false
| false
| 0
| 6
| 7
| 20
| 10
| 10
| null | null |
shlevy/ghc
|
libraries/base/tests/lazySTexamples.hs
|
bsd-3-clause
|
example1 :: [Int]
example1 = L.runST go where
go = do
v <- strictToLazyST (S.newSTRef 0)
fix (\loop -> do
n <- strictToLazyST (do n <- S.readSTRef v
S.writeSTRef v (n+1)
return n
)
ns <- loop
return (n : ns))
| 358
|
example1 :: [Int]
example1 = L.runST go where
go = do
v <- strictToLazyST (S.newSTRef 0)
fix (\loop -> do
n <- strictToLazyST (do n <- S.readSTRef v
S.writeSTRef v (n+1)
return n
)
ns <- loop
return (n : ns))
| 358
|
example1 = L.runST go where
go = do
v <- strictToLazyST (S.newSTRef 0)
fix (\loop -> do
n <- strictToLazyST (do n <- S.readSTRef v
S.writeSTRef v (n+1)
return n
)
ns <- loop
return (n : ns))
| 340
| false
| true
| 0
| 19
| 190
| 125
| 59
| 66
| null | null |
changlinli/nikki
|
src/Utils.hs
|
lgpl-3.0
|
modifyState :: MonadState s m => (s -> s) -> m ()
modifyState f =
get >>= (return . f) >>= put
| 98
|
modifyState :: MonadState s m => (s -> s) -> m ()
modifyState f =
get >>= (return . f) >>= put
| 98
|
modifyState f =
get >>= (return . f) >>= put
| 48
| false
| true
| 4
| 9
| 25
| 63
| 30
| 33
| null | null |
isomorphism/csound-expression
|
src/Csound/Air/Envelope.hs
|
bsd-3-clause
|
isaw1 dt val = [0, dt, val, 0]
| 30
|
isaw1 dt val = [0, dt, val, 0]
| 30
|
isaw1 dt val = [0, dt, val, 0]
| 30
| false
| false
| 0
| 5
| 7
| 23
| 13
| 10
| null | null |
snapframework/io-streams-haproxy
|
src/System/IO/Streams/Network/HAProxy.hs
|
bsd-3-clause
|
decodeHAProxyHeaders :: ProxyInfo -> (InputStream ByteString) -> IO ProxyInfo
decodeHAProxyHeaders localProxyInfo is0 = do
-- 536 bytes as per spec
is <- Streams.throwIfProducesMoreThan 536 is0
(!isOld, !mbOldInfo) <- Streams.parseFromStream
(((True,) <$> parseOldHaProxy)
<|> return (False, Nothing)) is
if isOld
then maybe (return localProxyInfo)
(\(srcAddr, srcPort, destAddr, destPort, f) -> do
(_, s) <- getSockAddr srcPort srcAddr
(_, d) <- getSockAddr destPort destAddr
return $! makeProxyInfo s d f $ getSocketType localProxyInfo)
mbOldInfo
else Streams.parseFromStream (parseNewHaProxy localProxyInfo) is
------------------------------------------------------------------------------
-- | Stores information about the proxied request.
| 931
|
decodeHAProxyHeaders :: ProxyInfo -> (InputStream ByteString) -> IO ProxyInfo
decodeHAProxyHeaders localProxyInfo is0 = do
-- 536 bytes as per spec
is <- Streams.throwIfProducesMoreThan 536 is0
(!isOld, !mbOldInfo) <- Streams.parseFromStream
(((True,) <$> parseOldHaProxy)
<|> return (False, Nothing)) is
if isOld
then maybe (return localProxyInfo)
(\(srcAddr, srcPort, destAddr, destPort, f) -> do
(_, s) <- getSockAddr srcPort srcAddr
(_, d) <- getSockAddr destPort destAddr
return $! makeProxyInfo s d f $ getSocketType localProxyInfo)
mbOldInfo
else Streams.parseFromStream (parseNewHaProxy localProxyInfo) is
------------------------------------------------------------------------------
-- | Stores information about the proxied request.
| 931
|
decodeHAProxyHeaders localProxyInfo is0 = do
-- 536 bytes as per spec
is <- Streams.throwIfProducesMoreThan 536 is0
(!isOld, !mbOldInfo) <- Streams.parseFromStream
(((True,) <$> parseOldHaProxy)
<|> return (False, Nothing)) is
if isOld
then maybe (return localProxyInfo)
(\(srcAddr, srcPort, destAddr, destPort, f) -> do
(_, s) <- getSockAddr srcPort srcAddr
(_, d) <- getSockAddr destPort destAddr
return $! makeProxyInfo s d f $ getSocketType localProxyInfo)
mbOldInfo
else Streams.parseFromStream (parseNewHaProxy localProxyInfo) is
------------------------------------------------------------------------------
-- | Stores information about the proxied request.
| 853
| false
| true
| 0
| 15
| 273
| 216
| 111
| 105
| null | null |
gonimo/gonimo-front
|
build/Main.hs
|
agpl-3.0
|
templateName' = srcDir </> templateName
| 39
|
templateName' = srcDir </> templateName
| 39
|
templateName' = srcDir </> templateName
| 39
| false
| false
| 0
| 5
| 4
| 10
| 5
| 5
| null | null |
green-haskell/ghc
|
compiler/basicTypes/OccName.hs
|
bsd-3-clause
|
mkPADFunOcc = mk_simple_deriv_with varName "$pa"
| 56
|
mkPADFunOcc = mk_simple_deriv_with varName "$pa"
| 56
|
mkPADFunOcc = mk_simple_deriv_with varName "$pa"
| 56
| false
| false
| 0
| 5
| 12
| 11
| 5
| 6
| null | null |
nikita-volkov/graph-db
|
executables/Benchmarks/GraphDB.hs
|
mit
|
initDir :: IO ()
initDir = do
FS.removeIfExists dir
FS.createTree dir
| 73
|
initDir :: IO ()
initDir = do
FS.removeIfExists dir
FS.createTree dir
| 73
|
initDir = do
FS.removeIfExists dir
FS.createTree dir
| 56
| false
| true
| 0
| 8
| 14
| 32
| 14
| 18
| null | null |
shlevy/arithmoi
|
Math/NumberTheory/GCD.hs
|
mit
|
gi8 :: Int8 -> Int8 -> Int8
gi8 (I8# x#) (I8# y#) = I8# (gcdInt# x# y#)
| 71
|
gi8 :: Int8 -> Int8 -> Int8
gi8 (I8# x#) (I8# y#) = I8# (gcdInt# x# y#)
| 71
|
gi8 (I8# x#) (I8# y#) = I8# (gcdInt# x# y#)
| 43
| false
| true
| 0
| 7
| 16
| 47
| 23
| 24
| null | null |
kazu-yamamoto/http2
|
Network/HPACK/Huffman/Tree.hs
|
bsd-3-clause
|
showTree' pref (Bin _ n l r) = "No " ++ show n ++ "\n"
++ pref ++ "+ " ++ showTree' pref' l
++ pref ++ "+ " ++ showTree' pref' r
where
pref' = " " ++ pref
| 217
|
showTree' pref (Bin _ n l r) = "No " ++ show n ++ "\n"
++ pref ++ "+ " ++ showTree' pref' l
++ pref ++ "+ " ++ showTree' pref' r
where
pref' = " " ++ pref
| 217
|
showTree' pref (Bin _ n l r) = "No " ++ show n ++ "\n"
++ pref ++ "+ " ++ showTree' pref' l
++ pref ++ "+ " ++ showTree' pref' r
where
pref' = " " ++ pref
| 217
| false
| false
| 0
| 13
| 102
| 80
| 38
| 42
| null | null |
ghcjs/ghcjs
|
src/Gen2/Prim.hs
|
mit
|
{- new ops in 8.6
, ReadByteArrayOp_Word8AsChar
, ReadByteArrayOp_Word8AsWideChar
, ReadByteArrayOp_Word8AsAddr
, ReadByteArrayOp_Word8AsFloat
, ReadByteArrayOp_Word8AsDouble
, ReadByteArrayOp_Word8AsStablePtr
, ReadByteArrayOp_Word8AsInt16
, ReadByteArrayOp_Word8AsInt32
, ReadByteArrayOp_Word8AsInt64
, ReadByteArrayOp_Word8AsInt
, ReadByteArrayOp_Word8AsWord16
, ReadByteArrayOp_Word8AsWord32
, ReadByteArrayOp_Word8AsWord64
, ReadByteArrayOp_Word8AsWord
-}
genPrim _ _ WriteByteArrayOp_Char [] [a,i,e] = PrimInline $ u8_ a i |= e
| 576
|
genPrim _ _ WriteByteArrayOp_Char [] [a,i,e] = PrimInline $ u8_ a i |= e
| 72
|
genPrim _ _ WriteByteArrayOp_Char [] [a,i,e] = PrimInline $ u8_ a i |= e
| 72
| true
| false
| 0
| 7
| 90
| 42
| 22
| 20
| null | null |
centromere/cacophony
|
src/Crypto/Noise/Internal/Handshake/Validation.hs
|
unlicense
|
addError :: (ErrorPosition -> InspectionError) -> State Inspection ()
addError err = do
msgPos <- use iCurMsgPos
tokenPos <- use iCurTokenPos
iErrors <>= [err (msgPos, tokenPos)]
| 186
|
addError :: (ErrorPosition -> InspectionError) -> State Inspection ()
addError err = do
msgPos <- use iCurMsgPos
tokenPos <- use iCurTokenPos
iErrors <>= [err (msgPos, tokenPos)]
| 186
|
addError err = do
msgPos <- use iCurMsgPos
tokenPos <- use iCurTokenPos
iErrors <>= [err (msgPos, tokenPos)]
| 116
| false
| true
| 0
| 11
| 33
| 76
| 35
| 41
| null | null |
ckaestne/CIDE
|
CIDE_Language_Haskell/test/WSP/Webserver/Request.hs
|
gpl-3.0
|
http1_0 = (1, 0)
| 16
|
http1_0 = (1, 0)
| 16
|
http1_0 = (1, 0)
| 16
| false
| false
| 0
| 5
| 3
| 12
| 7
| 5
| null | null |
tkawachi/pkcs12-hs
|
src/Crypto/Pkcs12/BmpString.hs
|
bsd-3-clause
|
dropRight :: Int -> [a] -> [a]
dropRight n xs = take (length xs - n) xs
| 71
|
dropRight :: Int -> [a] -> [a]
dropRight n xs = take (length xs - n) xs
| 71
|
dropRight n xs = take (length xs - n) xs
| 40
| false
| true
| 0
| 8
| 16
| 45
| 23
| 22
| null | null |
nothiphop/project-euler
|
022/solution.hs
|
apache-2.0
|
alphabeticalScore :: String -> Int
alphabeticalScore name = sum $ map letterIndex name
where
letterIndex char = ord char - letterAindex + 1
letterAindex = ord 'A'
| 172
|
alphabeticalScore :: String -> Int
alphabeticalScore name = sum $ map letterIndex name
where
letterIndex char = ord char - letterAindex + 1
letterAindex = ord 'A'
| 172
|
alphabeticalScore name = sum $ map letterIndex name
where
letterIndex char = ord char - letterAindex + 1
letterAindex = ord 'A'
| 137
| false
| true
| 2
| 7
| 36
| 69
| 28
| 41
| null | null |
input-output-hk/pos-haskell-prototype
|
tools/post-mortem/src/Statistics/Block.hs
|
mit
|
blockChain :: SMap BlockHash BlockHeader -> Set BlockHash
blockChain m = S.fromList $ maybe [] id $ (fmap fst . uncons) $ sortByLengthDesc [getLongestChain h | h <- allHashes]
where
allHashes :: [BlockHash]
allHashes = MS.keys m
sortByLengthDesc :: [[a]] -> [[a]]
sortByLengthDesc = sortBy (compare `on` (negate . length))
successors :: SMap BlockHash [BlockHash]
successors = foldl' f MS.empty allHashes
getSuccessors :: BlockHash -> [BlockHash]
getSuccessors h = MS.findWithDefault [] h successors
f :: SMap BlockHash [BlockHash] -> BlockHash -> SMap BlockHash [BlockHash]
f s h = let BlockHeader{..} = m MS.! h
in MS.alter (Just . maybe [bhHash] (bhHash :)) bhPrevBlock s
longestChains :: LMap Text [Text]
longestChains = ML.fromList [(h, getLongestChain h) | h <- allHashes]
getLongestChain :: Text -> [Text]
getLongestChain h = case sortByLengthDesc $ map (longestChains ML.!) $ getSuccessors h of
[] -> [h]
(c : _) -> h : c
| 1,027
|
blockChain :: SMap BlockHash BlockHeader -> Set BlockHash
blockChain m = S.fromList $ maybe [] id $ (fmap fst . uncons) $ sortByLengthDesc [getLongestChain h | h <- allHashes]
where
allHashes :: [BlockHash]
allHashes = MS.keys m
sortByLengthDesc :: [[a]] -> [[a]]
sortByLengthDesc = sortBy (compare `on` (negate . length))
successors :: SMap BlockHash [BlockHash]
successors = foldl' f MS.empty allHashes
getSuccessors :: BlockHash -> [BlockHash]
getSuccessors h = MS.findWithDefault [] h successors
f :: SMap BlockHash [BlockHash] -> BlockHash -> SMap BlockHash [BlockHash]
f s h = let BlockHeader{..} = m MS.! h
in MS.alter (Just . maybe [bhHash] (bhHash :)) bhPrevBlock s
longestChains :: LMap Text [Text]
longestChains = ML.fromList [(h, getLongestChain h) | h <- allHashes]
getLongestChain :: Text -> [Text]
getLongestChain h = case sortByLengthDesc $ map (longestChains ML.!) $ getSuccessors h of
[] -> [h]
(c : _) -> h : c
| 1,027
|
blockChain m = S.fromList $ maybe [] id $ (fmap fst . uncons) $ sortByLengthDesc [getLongestChain h | h <- allHashes]
where
allHashes :: [BlockHash]
allHashes = MS.keys m
sortByLengthDesc :: [[a]] -> [[a]]
sortByLengthDesc = sortBy (compare `on` (negate . length))
successors :: SMap BlockHash [BlockHash]
successors = foldl' f MS.empty allHashes
getSuccessors :: BlockHash -> [BlockHash]
getSuccessors h = MS.findWithDefault [] h successors
f :: SMap BlockHash [BlockHash] -> BlockHash -> SMap BlockHash [BlockHash]
f s h = let BlockHeader{..} = m MS.! h
in MS.alter (Just . maybe [bhHash] (bhHash :)) bhPrevBlock s
longestChains :: LMap Text [Text]
longestChains = ML.fromList [(h, getLongestChain h) | h <- allHashes]
getLongestChain :: Text -> [Text]
getLongestChain h = case sortByLengthDesc $ map (longestChains ML.!) $ getSuccessors h of
[] -> [h]
(c : _) -> h : c
| 969
| false
| true
| 0
| 11
| 244
| 409
| 211
| 198
| null | null |
ozgurakgun/Idris-dev
|
src/Idris/AbsSyntaxTree.hs
|
bsd-3-clause
|
is_scoped _ = Nothing
| 35
|
is_scoped _ = Nothing
| 35
|
is_scoped _ = Nothing
| 35
| false
| false
| 0
| 4
| 17
| 10
| 4
| 6
| null | null |
Cadasta/django-tutelary
|
experiments/Tutelary.hs
|
agpl-3.0
|
showPattern :: Char -> [Pattern] -> String
showPattern sep ps = intercalate (sep:[]) $ map show ps
| 98
|
showPattern :: Char -> [Pattern] -> String
showPattern sep ps = intercalate (sep:[]) $ map show ps
| 98
|
showPattern sep ps = intercalate (sep:[]) $ map show ps
| 55
| false
| true
| 0
| 9
| 16
| 48
| 24
| 24
| null | null |
mcmaniac/ghc
|
compiler/nativeGen/RegAlloc/Liveness.hs
|
bsd-3-clause
|
livenessSCCs blockmap done
(CyclicSCC blocks : sccs) =
livenessSCCs blockmap' (CyclicSCC blocks':done) sccs
where (blockmap', blocks')
= iterateUntilUnchanged linearLiveness equalBlockMaps
blockmap blocks
iterateUntilUnchanged
:: (a -> b -> (a,c)) -> (a -> a -> Bool)
-> a -> b
-> (a,c)
iterateUntilUnchanged f eq a b
= head $
concatMap tail $
groupBy (\(a1, _) (a2, _) -> eq a1 a2) $
iterate (\(a, _) -> f a b) $
(a, panic "RegLiveness.livenessSCCs")
linearLiveness
:: Instruction instr
=> BlockMap RegSet -> [LiveBasicBlock instr]
-> (BlockMap RegSet, [LiveBasicBlock instr])
linearLiveness = mapAccumL livenessBlock
-- probably the least efficient way to compare two
-- BlockMaps for equality.
equalBlockMaps a b
= a' == b'
where a' = map f $ mapToList a
b' = map f $ mapToList b
f (key,elt) = (key, uniqSetToList elt)
-- | Annotate a basic block with register liveness information.
--
| 1,319
|
livenessSCCs blockmap done
(CyclicSCC blocks : sccs) =
livenessSCCs blockmap' (CyclicSCC blocks':done) sccs
where (blockmap', blocks')
= iterateUntilUnchanged linearLiveness equalBlockMaps
blockmap blocks
iterateUntilUnchanged
:: (a -> b -> (a,c)) -> (a -> a -> Bool)
-> a -> b
-> (a,c)
iterateUntilUnchanged f eq a b
= head $
concatMap tail $
groupBy (\(a1, _) (a2, _) -> eq a1 a2) $
iterate (\(a, _) -> f a b) $
(a, panic "RegLiveness.livenessSCCs")
linearLiveness
:: Instruction instr
=> BlockMap RegSet -> [LiveBasicBlock instr]
-> (BlockMap RegSet, [LiveBasicBlock instr])
linearLiveness = mapAccumL livenessBlock
-- probably the least efficient way to compare two
-- BlockMaps for equality.
equalBlockMaps a b
= a' == b'
where a' = map f $ mapToList a
b' = map f $ mapToList b
f (key,elt) = (key, uniqSetToList elt)
-- | Annotate a basic block with register liveness information.
--
| 1,319
|
livenessSCCs blockmap done
(CyclicSCC blocks : sccs) =
livenessSCCs blockmap' (CyclicSCC blocks':done) sccs
where (blockmap', blocks')
= iterateUntilUnchanged linearLiveness equalBlockMaps
blockmap blocks
iterateUntilUnchanged
:: (a -> b -> (a,c)) -> (a -> a -> Bool)
-> a -> b
-> (a,c)
iterateUntilUnchanged f eq a b
= head $
concatMap tail $
groupBy (\(a1, _) (a2, _) -> eq a1 a2) $
iterate (\(a, _) -> f a b) $
(a, panic "RegLiveness.livenessSCCs")
linearLiveness
:: Instruction instr
=> BlockMap RegSet -> [LiveBasicBlock instr]
-> (BlockMap RegSet, [LiveBasicBlock instr])
linearLiveness = mapAccumL livenessBlock
-- probably the least efficient way to compare two
-- BlockMaps for equality.
equalBlockMaps a b
= a' == b'
where a' = map f $ mapToList a
b' = map f $ mapToList b
f (key,elt) = (key, uniqSetToList elt)
-- | Annotate a basic block with register liveness information.
--
| 1,319
| false
| false
| 2
| 12
| 574
| 332
| 174
| 158
| null | null |
JacquesCarette/literate-scientific-software
|
code/drasil-example/Drasil/SWHS/Unitals.hs
|
bsd-2-clause
|
coilHTCMax = mkQuantDef (unitary' "coilHTCMax"
(nounPhraseSP $ "maximum convective heat " ++
"transfer coefficient between coil and water")
(staged (supMax (eqSymb coilHTC)) (subMax (eqSymb coilHTC)))
UT.heatTransferCoef Rational) 10000
| 245
|
coilHTCMax = mkQuantDef (unitary' "coilHTCMax"
(nounPhraseSP $ "maximum convective heat " ++
"transfer coefficient between coil and water")
(staged (supMax (eqSymb coilHTC)) (subMax (eqSymb coilHTC)))
UT.heatTransferCoef Rational) 10000
| 245
|
coilHTCMax = mkQuantDef (unitary' "coilHTCMax"
(nounPhraseSP $ "maximum convective heat " ++
"transfer coefficient between coil and water")
(staged (supMax (eqSymb coilHTC)) (subMax (eqSymb coilHTC)))
UT.heatTransferCoef Rational) 10000
| 245
| false
| false
| 0
| 13
| 36
| 70
| 35
| 35
| null | null |
HuwCampbell/htoml
|
src/Text/Toml/Parser.hs
|
bsd-3-clause
|
unicodeHex :: Int -> Parser Char
unicodeHex n = do
h <- count n (satisfy isHex)
let v = fst . head . readHex $ h
return $ if v <= maxChar then toEnum v else '_'
where
isHex c = (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')
maxChar = fromEnum (maxBound :: Char)
-- | Parser for signs (a plus or a minus).
| 356
|
unicodeHex :: Int -> Parser Char
unicodeHex n = do
h <- count n (satisfy isHex)
let v = fst . head . readHex $ h
return $ if v <= maxChar then toEnum v else '_'
where
isHex c = (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')
maxChar = fromEnum (maxBound :: Char)
-- | Parser for signs (a plus or a minus).
| 356
|
unicodeHex n = do
h <- count n (satisfy isHex)
let v = fst . head . readHex $ h
return $ if v <= maxChar then toEnum v else '_'
where
isHex c = (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')
maxChar = fromEnum (maxBound :: Char)
-- | Parser for signs (a plus or a minus).
| 323
| false
| true
| 3
| 12
| 103
| 179
| 84
| 95
| null | null |
ezyang/ghc
|
compiler/main/DriverPhases.hs
|
bsd-3-clause
|
nextPhase :: DynFlags -> Phase -> Phase
nextPhase dflags p
-- A conservative approximation to the next phase, used in happensBefore
= case p of
Unlit sf -> Cpp sf
Cpp sf -> HsPp sf
HsPp sf -> Hsc sf
Hsc _ -> maybeHCc
Splitter -> SplitAs
LlvmOpt -> LlvmLlc
LlvmLlc -> LlvmMangle
LlvmMangle -> As False
SplitAs -> MergeForeign
As _ -> MergeForeign
Ccxx -> As False
Cc -> As False
Cobjc -> As False
Cobjcxx -> As False
CmmCpp -> Cmm
Cmm -> maybeHCc
HCc -> As False
MergeForeign -> StopLn
StopLn -> panic "nextPhase: nothing after StopLn"
where maybeHCc = if platformUnregisterised (targetPlatform dflags)
then HCc
else As False
-- the first compilation phase for a given file is determined
-- by its suffix.
| 950
|
nextPhase :: DynFlags -> Phase -> Phase
nextPhase dflags p
-- A conservative approximation to the next phase, used in happensBefore
= case p of
Unlit sf -> Cpp sf
Cpp sf -> HsPp sf
HsPp sf -> Hsc sf
Hsc _ -> maybeHCc
Splitter -> SplitAs
LlvmOpt -> LlvmLlc
LlvmLlc -> LlvmMangle
LlvmMangle -> As False
SplitAs -> MergeForeign
As _ -> MergeForeign
Ccxx -> As False
Cc -> As False
Cobjc -> As False
Cobjcxx -> As False
CmmCpp -> Cmm
Cmm -> maybeHCc
HCc -> As False
MergeForeign -> StopLn
StopLn -> panic "nextPhase: nothing after StopLn"
where maybeHCc = if platformUnregisterised (targetPlatform dflags)
then HCc
else As False
-- the first compilation phase for a given file is determined
-- by its suffix.
| 950
|
nextPhase dflags p
-- A conservative approximation to the next phase, used in happensBefore
= case p of
Unlit sf -> Cpp sf
Cpp sf -> HsPp sf
HsPp sf -> Hsc sf
Hsc _ -> maybeHCc
Splitter -> SplitAs
LlvmOpt -> LlvmLlc
LlvmLlc -> LlvmMangle
LlvmMangle -> As False
SplitAs -> MergeForeign
As _ -> MergeForeign
Ccxx -> As False
Cc -> As False
Cobjc -> As False
Cobjcxx -> As False
CmmCpp -> Cmm
Cmm -> maybeHCc
HCc -> As False
MergeForeign -> StopLn
StopLn -> panic "nextPhase: nothing after StopLn"
where maybeHCc = if platformUnregisterised (targetPlatform dflags)
then HCc
else As False
-- the first compilation phase for a given file is determined
-- by its suffix.
| 910
| false
| true
| 0
| 8
| 372
| 218
| 103
| 115
| null | null |
kmate/HaRe
|
old/testing/introCase/MainIn1AST.hs
|
bsd-3-clause
|
f ((a :* b))
= case b of
b@Nil -> a
b@(b_1 :* b_2) -> a
| 85
|
f ((a :* b))
= case b of
b@Nil -> a
b@(b_1 :* b_2) -> a
| 85
|
f ((a :* b))
= case b of
b@Nil -> a
b@(b_1 :* b_2) -> a
| 85
| false
| false
| 0
| 10
| 45
| 49
| 26
| 23
| null | null |
thalerjonathan/phd
|
public/ArtIterating/code/haskell/PureAgentsPar/src/PureAgentsPar.hs
|
gpl-3.0
|
newAgent :: Agent m s e -> Agent m s e -> Agent m s e
newAgent aParent aNew = aParent { newAgents = aNew : nas }
where
nas = newAgents aParent
| 154
|
newAgent :: Agent m s e -> Agent m s e -> Agent m s e
newAgent aParent aNew = aParent { newAgents = aNew : nas }
where
nas = newAgents aParent
| 154
|
newAgent aParent aNew = aParent { newAgents = aNew : nas }
where
nas = newAgents aParent
| 100
| false
| true
| 0
| 7
| 44
| 67
| 33
| 34
| null | null |
tolysz/Haxl
|
Haxl/Core/Monad.hs
|
bsd-3-clause
|
caches :: Env u -> Caches u
caches env = (cacheRef env, memoRef env)
| 68
|
caches :: Env u -> Caches u
caches env = (cacheRef env, memoRef env)
| 68
|
caches env = (cacheRef env, memoRef env)
| 40
| false
| true
| 0
| 6
| 13
| 36
| 17
| 19
| null | null |
zalora/kraken
|
src/Kraken/Util.hs
|
bsd-3-clause
|
reachableVerticesWithoutSelf :: Ord i => Graph i v -> i -> [i]
reachableVerticesWithoutSelf g i =
nub $
concat $ fmap (reachableVertices g) $ successors g i
| 164
|
reachableVerticesWithoutSelf :: Ord i => Graph i v -> i -> [i]
reachableVerticesWithoutSelf g i =
nub $
concat $ fmap (reachableVertices g) $ successors g i
| 164
|
reachableVerticesWithoutSelf g i =
nub $
concat $ fmap (reachableVertices g) $ successors g i
| 101
| false
| true
| 4
| 10
| 34
| 72
| 32
| 40
| null | null |
graninas/Andromeda
|
src/Andromeda/Common/Exists.hs
|
bsd-3-clause
|
mkExists :: forall f a. f a -> Exists f
mkExists = unsafeCoerce
| 63
|
mkExists :: forall f a. f a -> Exists f
mkExists = unsafeCoerce
| 63
|
mkExists = unsafeCoerce
| 23
| false
| true
| 0
| 8
| 12
| 33
| 15
| 18
| null | null |
mathhun/stack
|
src/Stack/Build/Installed.hs
|
bsd-3-clause
|
loadDatabase :: (M env m, PackageInstallInfo pii)
=> EnvOverride
-> GetInstalledOpts
-> Maybe InstalledCache -- ^ if Just, profiling or haddock is required
-> Map PackageName pii -- ^ to determine which installed things we should include
-> Maybe (InstalledPackageLocation, Path Abs Dir) -- ^ package database, Nothing for global
-> [LoadHelper] -- ^ from parent databases
-> m ([LoadHelper], [DumpPackage () ()])
loadDatabase menv opts mcache sourceMap mdb lhs0 = do
wc <- getWhichCompiler
(lhs1', dps) <- ghcPkgDump menv wc (fmap snd (maybeToList mdb))
$ conduitDumpPackage =$ sink
let ghcjsHack = wc == Ghcjs && isNothing mdb
lhs1 <- liftM catMaybes $ mapM (processLoadResult mdb ghcjsHack) lhs1'
let lhs = pruneDeps
id
lhId
lhDeps
const
(lhs0 ++ lhs1)
return (map (\lh -> lh { lhDeps = [] }) $ Map.elems lhs, dps)
where
conduitProfilingCache =
case mcache of
Just cache | getInstalledProfiling opts -> addProfiling cache
-- Just an optimization to avoid calculating the profiling
-- values when they aren't necessary
_ -> CL.map (\dp -> dp { dpProfiling = False })
conduitHaddockCache =
case mcache of
Just cache | getInstalledHaddock opts -> addHaddock cache
-- Just an optimization to avoid calculating the haddock
-- values when they aren't necessary
_ -> CL.map (\dp -> dp { dpHaddock = False })
mloc = fmap fst mdb
sinkDP = conduitProfilingCache
=$ conduitHaddockCache
=$ CL.map (\dp -> (isAllowed opts mcache sourceMap mloc dp, toLoadHelper mloc dp))
=$ CL.consume
sink = getZipSink $ (,)
<$> ZipSink sinkDP
<*> ZipSink CL.consume
| 1,911
|
loadDatabase :: (M env m, PackageInstallInfo pii)
=> EnvOverride
-> GetInstalledOpts
-> Maybe InstalledCache -- ^ if Just, profiling or haddock is required
-> Map PackageName pii -- ^ to determine which installed things we should include
-> Maybe (InstalledPackageLocation, Path Abs Dir) -- ^ package database, Nothing for global
-> [LoadHelper] -- ^ from parent databases
-> m ([LoadHelper], [DumpPackage () ()])
loadDatabase menv opts mcache sourceMap mdb lhs0 = do
wc <- getWhichCompiler
(lhs1', dps) <- ghcPkgDump menv wc (fmap snd (maybeToList mdb))
$ conduitDumpPackage =$ sink
let ghcjsHack = wc == Ghcjs && isNothing mdb
lhs1 <- liftM catMaybes $ mapM (processLoadResult mdb ghcjsHack) lhs1'
let lhs = pruneDeps
id
lhId
lhDeps
const
(lhs0 ++ lhs1)
return (map (\lh -> lh { lhDeps = [] }) $ Map.elems lhs, dps)
where
conduitProfilingCache =
case mcache of
Just cache | getInstalledProfiling opts -> addProfiling cache
-- Just an optimization to avoid calculating the profiling
-- values when they aren't necessary
_ -> CL.map (\dp -> dp { dpProfiling = False })
conduitHaddockCache =
case mcache of
Just cache | getInstalledHaddock opts -> addHaddock cache
-- Just an optimization to avoid calculating the haddock
-- values when they aren't necessary
_ -> CL.map (\dp -> dp { dpHaddock = False })
mloc = fmap fst mdb
sinkDP = conduitProfilingCache
=$ conduitHaddockCache
=$ CL.map (\dp -> (isAllowed opts mcache sourceMap mloc dp, toLoadHelper mloc dp))
=$ CL.consume
sink = getZipSink $ (,)
<$> ZipSink sinkDP
<*> ZipSink CL.consume
| 1,911
|
loadDatabase menv opts mcache sourceMap mdb lhs0 = do
wc <- getWhichCompiler
(lhs1', dps) <- ghcPkgDump menv wc (fmap snd (maybeToList mdb))
$ conduitDumpPackage =$ sink
let ghcjsHack = wc == Ghcjs && isNothing mdb
lhs1 <- liftM catMaybes $ mapM (processLoadResult mdb ghcjsHack) lhs1'
let lhs = pruneDeps
id
lhId
lhDeps
const
(lhs0 ++ lhs1)
return (map (\lh -> lh { lhDeps = [] }) $ Map.elems lhs, dps)
where
conduitProfilingCache =
case mcache of
Just cache | getInstalledProfiling opts -> addProfiling cache
-- Just an optimization to avoid calculating the profiling
-- values when they aren't necessary
_ -> CL.map (\dp -> dp { dpProfiling = False })
conduitHaddockCache =
case mcache of
Just cache | getInstalledHaddock opts -> addHaddock cache
-- Just an optimization to avoid calculating the haddock
-- values when they aren't necessary
_ -> CL.map (\dp -> dp { dpHaddock = False })
mloc = fmap fst mdb
sinkDP = conduitProfilingCache
=$ conduitHaddockCache
=$ CL.map (\dp -> (isAllowed opts mcache sourceMap mloc dp, toLoadHelper mloc dp))
=$ CL.consume
sink = getZipSink $ (,)
<$> ZipSink sinkDP
<*> ZipSink CL.consume
| 1,406
| false
| true
| 6
| 19
| 618
| 477
| 243
| 234
| null | null |
bjpop/berp
|
libs/src/Berp/Base/Prims.hs
|
bsd-3-clause
|
pass :: Eval Object
pass = return none
| 38
|
pass :: Eval Object
pass = return none
| 38
|
pass = return none
| 18
| false
| true
| 0
| 5
| 7
| 17
| 8
| 9
| null | null |
amtal/soyuz
|
DCPU16/Instructions.hs
|
mit
|
fromOpCode SHL=0x7
| 18
|
fromOpCode SHL=0x7
| 18
|
fromOpCode SHL=0x7
| 18
| false
| false
| 0
| 5
| 1
| 9
| 4
| 5
| null | null |
suhailshergill/liboleg
|
Language/TEval/TInfTEnv.hs
|
bsd-3-clause
|
-- (TInt,[("x",TInt)])
-- But some terms still fail type-checking: no environment could
-- be found to make the term typeable
test63 = teval $ IFZ (vx `A` (I 1)) vx (I 2)
| 171
|
test63 = teval $ IFZ (vx `A` (I 1)) vx (I 2)
| 44
|
test63 = teval $ IFZ (vx `A` (I 1)) vx (I 2)
| 44
| true
| false
| 0
| 10
| 32
| 41
| 23
| 18
| null | null |
mumuki/mulang
|
src/Language/Mulang/Inspector/Logic.hs
|
gpl-3.0
|
declaresPredicate :: BoundInspection
declaresPredicate pred = orElse (declaresFact pred) (declaresRule pred)
| 108
|
declaresPredicate :: BoundInspection
declaresPredicate pred = orElse (declaresFact pred) (declaresRule pred)
| 108
|
declaresPredicate pred = orElse (declaresFact pred) (declaresRule pred)
| 71
| false
| true
| 0
| 7
| 10
| 31
| 15
| 16
| null | null |
jyp/hgal
|
Data/Graph/Construction.hs
|
gpl-2.0
|
kG :: Int -> Int -> Graph
kG n m = undirG $ buildG (1, n+m) [(x,y) | x <- [1..n], y <- [n+1..n+m]]
| 98
|
kG :: Int -> Int -> Graph
kG n m = undirG $ buildG (1, n+m) [(x,y) | x <- [1..n], y <- [n+1..n+m]]
| 98
|
kG n m = undirG $ buildG (1, n+m) [(x,y) | x <- [1..n], y <- [n+1..n+m]]
| 72
| false
| true
| 0
| 11
| 23
| 86
| 46
| 40
| null | null |
alasconnect/auth0
|
src/Auth0/Management/UsersByEmail.hs
|
apache-2.0
|
usersByEmailGet :: (FromJSON appMd, ToJSON appMd, FromJSON userMd, ToJSON userMd)
=> AccessToken
-> Maybe Text
-> Maybe Text
-> Text
-> ClientM [UserResponse appMd userMd]
--------------------------------------------------------------------------------
type UsersByEmailApi appMd userMd
= "api"
:> "v2"
:> "users-by-email"
:> UsersByEmailGetApi appMd userMd
| 377
|
usersByEmailGet :: (FromJSON appMd, ToJSON appMd, FromJSON userMd, ToJSON userMd)
=> AccessToken
-> Maybe Text
-> Maybe Text
-> Text
-> ClientM [UserResponse appMd userMd]
--------------------------------------------------------------------------------
type UsersByEmailApi appMd userMd
= "api"
:> "v2"
:> "users-by-email"
:> UsersByEmailGetApi appMd userMd
| 377
|
usersByEmailGet :: (FromJSON appMd, ToJSON appMd, FromJSON userMd, ToJSON userMd)
=> AccessToken
-> Maybe Text
-> Maybe Text
-> Text
-> ClientM [UserResponse appMd userMd]
--------------------------------------------------------------------------------
type UsersByEmailApi appMd userMd
= "api"
:> "v2"
:> "users-by-email"
:> UsersByEmailGetApi appMd userMd
| 377
| false
| false
| 6
| 13
| 59
| 100
| 47
| 53
| null | null |
lukemaurer/sequent-core
|
src/Language/SequentCore/Driver.hs
|
bsd-3-clause
|
pprPassDetails :: SeqCoreToDo -> SDoc
pprPassDetails (SeqCoreDoSimplify iters mode) = vcat [ text "Max iterations =" <+> int iters
, ppr mode ]
| 197
|
pprPassDetails :: SeqCoreToDo -> SDoc
pprPassDetails (SeqCoreDoSimplify iters mode) = vcat [ text "Max iterations =" <+> int iters
, ppr mode ]
| 197
|
pprPassDetails (SeqCoreDoSimplify iters mode) = vcat [ text "Max iterations =" <+> int iters
, ppr mode ]
| 159
| false
| true
| 0
| 8
| 76
| 48
| 23
| 25
| null | null |
Soostone/hadron
|
src/Hadron/Run/Hadoop.hs
|
bsd-3-clause
|
-------------------------------------------------------------------------------
-- | Number of key segments that constitute input object equality, for
-- hadoop partitions.
eqSegs :: PartitionStrategy -> Int
eqSegs NoPartition = 1
| 230
|
eqSegs :: PartitionStrategy -> Int
eqSegs NoPartition = 1
| 57
|
eqSegs NoPartition = 1
| 22
| true
| true
| 0
| 7
| 24
| 27
| 13
| 14
| null | null |
rolph-recto/liquid-fixpoint
|
src/Language/Fixpoint/Smt/Theories.hs
|
bsd-3-clause
|
setMem = "Set_mem"
| 20
|
setMem = "Set_mem"
| 20
|
setMem = "Set_mem"
| 20
| false
| false
| 0
| 4
| 4
| 6
| 3
| 3
| null | null |
robdockins/edison
|
edison-core/src/Data/Edison/Seq/RandList.hs
|
mit
|
concatMap = concatMapUsingFoldr
| 31
|
concatMap = concatMapUsingFoldr
| 31
|
concatMap = concatMapUsingFoldr
| 31
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
romanb/amazonka
|
amazonka-cloudhsm/gen/Network/AWS/CloudHSM/DescribeHsm.hs
|
mpl-2.0
|
-- | The subscription end date.
dhr2SubscriptionEndDate :: Lens' DescribeHsmResponse (Maybe Text)
dhr2SubscriptionEndDate =
lens _dhr2SubscriptionEndDate (\s a -> s { _dhr2SubscriptionEndDate = a })
| 202
|
dhr2SubscriptionEndDate :: Lens' DescribeHsmResponse (Maybe Text)
dhr2SubscriptionEndDate =
lens _dhr2SubscriptionEndDate (\s a -> s { _dhr2SubscriptionEndDate = a })
| 170
|
dhr2SubscriptionEndDate =
lens _dhr2SubscriptionEndDate (\s a -> s { _dhr2SubscriptionEndDate = a })
| 104
| true
| true
| 0
| 9
| 28
| 46
| 25
| 21
| null | null |
dalaing/type-systems
|
src/Fragment/Int/Rules/Type/Infer/Common.hs
|
bsd-3-clause
|
inferTmAdd :: IntInferConstraint e w s r m ki ty pt tm a i
=> Proxy (MonadProxy e w s r m)
-> Proxy i
-> (Term ki ty pt tm a -> InferTypeMonad m ki ty a i (Type ki ty a))
-> Term ki ty pt tm a
-> Maybe (InferTypeMonad m ki ty a i (Type ki ty a))
inferTmAdd m i inferFn tm = do
(tm1, tm2) <- preview _TmAdd tm
return $ do
let ty = review _TyInt ()
ty1 <- inferFn tm1
expectType m i (ExpectedType ty) (ActualType ty1)
ty2 <- inferFn tm2
expectType m i (ExpectedType ty) (ActualType ty2)
tyV <- createInt m i
expectType m i (ExpectedType ty) (ActualType tyV)
return tyV
| 657
|
inferTmAdd :: IntInferConstraint e w s r m ki ty pt tm a i
=> Proxy (MonadProxy e w s r m)
-> Proxy i
-> (Term ki ty pt tm a -> InferTypeMonad m ki ty a i (Type ki ty a))
-> Term ki ty pt tm a
-> Maybe (InferTypeMonad m ki ty a i (Type ki ty a))
inferTmAdd m i inferFn tm = do
(tm1, tm2) <- preview _TmAdd tm
return $ do
let ty = review _TyInt ()
ty1 <- inferFn tm1
expectType m i (ExpectedType ty) (ActualType ty1)
ty2 <- inferFn tm2
expectType m i (ExpectedType ty) (ActualType ty2)
tyV <- createInt m i
expectType m i (ExpectedType ty) (ActualType tyV)
return tyV
| 657
|
inferTmAdd m i inferFn tm = do
(tm1, tm2) <- preview _TmAdd tm
return $ do
let ty = review _TyInt ()
ty1 <- inferFn tm1
expectType m i (ExpectedType ty) (ActualType ty1)
ty2 <- inferFn tm2
expectType m i (ExpectedType ty) (ActualType ty2)
tyV <- createInt m i
expectType m i (ExpectedType ty) (ActualType tyV)
return tyV
| 356
| false
| true
| 0
| 14
| 210
| 315
| 146
| 169
| null | null |
phaazon/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
|
bsd-3-clause
|
gl_COMPRESSED_LUMINANCE_ARB :: GLenum
gl_COMPRESSED_LUMINANCE_ARB = 0x84EA
| 74
|
gl_COMPRESSED_LUMINANCE_ARB :: GLenum
gl_COMPRESSED_LUMINANCE_ARB = 0x84EA
| 74
|
gl_COMPRESSED_LUMINANCE_ARB = 0x84EA
| 36
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
dysinger/amazonka
|
amazonka-storagegateway/gen/Network/AWS/StorageGateway/UpdateGatewaySoftwareNow.hs
|
mpl-2.0
|
ugsnrGatewayARN :: Lens' UpdateGatewaySoftwareNowResponse (Maybe Text)
ugsnrGatewayARN = lens _ugsnrGatewayARN (\s a -> s { _ugsnrGatewayARN = a })
| 147
|
ugsnrGatewayARN :: Lens' UpdateGatewaySoftwareNowResponse (Maybe Text)
ugsnrGatewayARN = lens _ugsnrGatewayARN (\s a -> s { _ugsnrGatewayARN = a })
| 147
|
ugsnrGatewayARN = lens _ugsnrGatewayARN (\s a -> s { _ugsnrGatewayARN = a })
| 76
| false
| true
| 0
| 9
| 18
| 45
| 24
| 21
| null | null |
mimi1vx/shellcheck
|
ShellCheck/Analytics.hs
|
gpl-3.0
|
checkDollarBrackets _ (T_DollarBracket id _) =
style id 2007 "Use $((..)) instead of deprecated $[..]"
| 106
|
checkDollarBrackets _ (T_DollarBracket id _) =
style id 2007 "Use $((..)) instead of deprecated $[..]"
| 106
|
checkDollarBrackets _ (T_DollarBracket id _) =
style id 2007 "Use $((..)) instead of deprecated $[..]"
| 106
| false
| false
| 0
| 7
| 18
| 28
| 12
| 16
| null | null |
MortimerMcMire315/sparkive
|
src/DB/AcidStateBackend.hs
|
gpl-3.0
|
insertSessTokenQ :: String -> ByteString -> AcidState Archive -> IO (Either String ())
insertSessTokenQ uname tok a = fmap Right . update a $ InsertSessToken uname tok
| 167
|
insertSessTokenQ :: String -> ByteString -> AcidState Archive -> IO (Either String ())
insertSessTokenQ uname tok a = fmap Right . update a $ InsertSessToken uname tok
| 167
|
insertSessTokenQ uname tok a = fmap Right . update a $ InsertSessToken uname tok
| 80
| false
| true
| 0
| 11
| 26
| 69
| 31
| 38
| null | null |
gnn/Hets
|
OWL2/ProvePellet.hs
|
gpl-2.0
|
pelletS :: String
pelletS = "Pellet"
| 36
|
pelletS :: String
pelletS = "Pellet"
| 36
|
pelletS = "Pellet"
| 18
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
joeyadams/haskell-iocp
|
IOCP/PSQ.hs
|
bsd-3-clause
|
secondBest (RLoser _ e tl m tr) m' = secondBest tl m `play` Winner e tr m'
| 74
|
secondBest (RLoser _ e tl m tr) m' = secondBest tl m `play` Winner e tr m'
| 74
|
secondBest (RLoser _ e tl m tr) m' = secondBest tl m `play` Winner e tr m'
| 74
| false
| false
| 0
| 7
| 16
| 43
| 21
| 22
| null | null |
vito/atomo
|
src/Atomo/Method.hs
|
bsd-3-clause
|
comparePrecision (PNamed _ a) b = comparePrecision a b
| 54
|
comparePrecision (PNamed _ a) b = comparePrecision a b
| 54
|
comparePrecision (PNamed _ a) b = comparePrecision a b
| 54
| false
| false
| 0
| 7
| 8
| 24
| 11
| 13
| null | null |
sgillespie/ghc
|
compiler/coreSyn/TrieMap.hs
|
bsd-3-clause
|
xtC :: DeBruijn Coercion -> XT a -> CoercionMapX a -> CoercionMapX a
xtC (D env co) f (CoercionMapX m)
= CoercionMapX (xtT (D env $ coercionType co) f m)
| 155
|
xtC :: DeBruijn Coercion -> XT a -> CoercionMapX a -> CoercionMapX a
xtC (D env co) f (CoercionMapX m)
= CoercionMapX (xtT (D env $ coercionType co) f m)
| 155
|
xtC (D env co) f (CoercionMapX m)
= CoercionMapX (xtT (D env $ coercionType co) f m)
| 86
| false
| true
| 0
| 11
| 31
| 86
| 39
| 47
| null | null |
carlohamalainen/imagetrove-uploader
|
src/Network/ImageTrove/Utils.hs
|
bsd-2-clause
|
getStuff' :: FilePath -> IO [FilePath]
getStuff' dir = map (dir </>) . filter (not . (`elem` [".", ".."])) <$> getDirectoryContents dir
| 135
|
getStuff' :: FilePath -> IO [FilePath]
getStuff' dir = map (dir </>) . filter (not . (`elem` [".", ".."])) <$> getDirectoryContents dir
| 135
|
getStuff' dir = map (dir </>) . filter (not . (`elem` [".", ".."])) <$> getDirectoryContents dir
| 96
| false
| true
| 0
| 11
| 21
| 64
| 35
| 29
| null | null |
brendanhay/gogol
|
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
|
mpl-2.0
|
-- | The request entries to be processed in the batch.
locEntries :: Lens' LocalinventoryCustomBatchRequest [LocalinventoryCustomBatchRequestEntry]
locEntries
= lens _locEntries (\ s a -> s{_locEntries = a}) .
_Default
. _Coerce
| 242
|
locEntries :: Lens' LocalinventoryCustomBatchRequest [LocalinventoryCustomBatchRequestEntry]
locEntries
= lens _locEntries (\ s a -> s{_locEntries = a}) .
_Default
. _Coerce
| 187
|
locEntries
= lens _locEntries (\ s a -> s{_locEntries = a}) .
_Default
. _Coerce
| 94
| true
| true
| 0
| 11
| 44
| 53
| 28
| 25
| null | null |
naoto-ogawa/h-xproto-mysql
|
src/Example/Example06.hs
|
mit
|
example06_02 :: IO ()
example06_02 = do
putStrLn "start example6_02"
nodeSess <- nodeSession
(meta, ret@(x:xs)) <- executeRawSqlMetaData "select * from data_type_date limit 1" nodeSess
print meta
print ret
let b = Seq.index x 0
print $ getColDay' b
-- print $ (BL.length b )
-- print $ (BinG.runGet example06_02_1 b)
return ()
-- example06_02_1 :: BinG.Get String
-- example06_02_1 = do
-- y <- BinG.getWord16le
-- m <- BinG.getWord8
-- d <- BinG.getWord8
-- return $ (show (y-2048)) ++ "-" ++ (show m) ++ "-" ++ (show d)
| 557
|
example06_02 :: IO ()
example06_02 = do
putStrLn "start example6_02"
nodeSess <- nodeSession
(meta, ret@(x:xs)) <- executeRawSqlMetaData "select * from data_type_date limit 1" nodeSess
print meta
print ret
let b = Seq.index x 0
print $ getColDay' b
-- print $ (BL.length b )
-- print $ (BinG.runGet example06_02_1 b)
return ()
-- example06_02_1 :: BinG.Get String
-- example06_02_1 = do
-- y <- BinG.getWord16le
-- m <- BinG.getWord8
-- d <- BinG.getWord8
-- return $ (show (y-2048)) ++ "-" ++ (show m) ++ "-" ++ (show d)
| 557
|
example06_02 = do
putStrLn "start example6_02"
nodeSess <- nodeSession
(meta, ret@(x:xs)) <- executeRawSqlMetaData "select * from data_type_date limit 1" nodeSess
print meta
print ret
let b = Seq.index x 0
print $ getColDay' b
-- print $ (BL.length b )
-- print $ (BinG.runGet example06_02_1 b)
return ()
-- example06_02_1 :: BinG.Get String
-- example06_02_1 = do
-- y <- BinG.getWord16le
-- m <- BinG.getWord8
-- d <- BinG.getWord8
-- return $ (show (y-2048)) ++ "-" ++ (show m) ++ "-" ++ (show d)
| 535
| false
| true
| 0
| 11
| 123
| 111
| 54
| 57
| null | null |
guillaume-nargeot/project-euler-haskell
|
src/ProjectEuler/Problem074.hs
|
bsd-3-clause
|
dfsChain :: Int -> [Int]
dfsChain n = n : takeWhile (/= n) (tail $ iterate digitsFactSum n)
| 91
|
dfsChain :: Int -> [Int]
dfsChain n = n : takeWhile (/= n) (tail $ iterate digitsFactSum n)
| 91
|
dfsChain n = n : takeWhile (/= n) (tail $ iterate digitsFactSum n)
| 66
| false
| true
| 0
| 9
| 17
| 46
| 24
| 22
| null | null |
duplode/dohaskell
|
src/View/Browse.hs
|
bsd-3-clause
|
topBarCSS :: Widget
topBarCSS = toWidget
[cassius|
.bar
font-size: 1.1em
font-variant: small-caps
height: 1.1em
line-height: 1.1em
.bar-link
color: #069
a.bar-link:hover
text-decoration: none
.arr
font-size: 0.7em
|]
| 307
|
topBarCSS :: Widget
topBarCSS = toWidget
[cassius|
.bar
font-size: 1.1em
font-variant: small-caps
height: 1.1em
line-height: 1.1em
.bar-link
color: #069
a.bar-link:hover
text-decoration: none
.arr
font-size: 0.7em
|]
| 307
|
topBarCSS = toWidget
[cassius|
.bar
font-size: 1.1em
font-variant: small-caps
height: 1.1em
line-height: 1.1em
.bar-link
color: #069
a.bar-link:hover
text-decoration: none
.arr
font-size: 0.7em
|]
| 287
| false
| true
| 0
| 4
| 116
| 18
| 11
| 7
| null | null |
jdreaver/oanda-rest-api
|
src/OANDA/Pricing.hs
|
bsd-3-clause
|
pricingArgs :: [InstrumentName] -> PricingArgs
pricingArgs instruments =
PricingArgs
{ _pricingArgsInstruments = instruments
, _pricingArgsSince = Nothing
}
| 164
|
pricingArgs :: [InstrumentName] -> PricingArgs
pricingArgs instruments =
PricingArgs
{ _pricingArgsInstruments = instruments
, _pricingArgsSince = Nothing
}
| 164
|
pricingArgs instruments =
PricingArgs
{ _pricingArgsInstruments = instruments
, _pricingArgsSince = Nothing
}
| 117
| false
| true
| 0
| 7
| 25
| 39
| 21
| 18
| null | null |
phaazon/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
|
bsd-3-clause
|
gl_COLOR_ARRAY_POINTER_EXT :: GLenum
gl_COLOR_ARRAY_POINTER_EXT = 0x8090
| 72
|
gl_COLOR_ARRAY_POINTER_EXT :: GLenum
gl_COLOR_ARRAY_POINTER_EXT = 0x8090
| 72
|
gl_COLOR_ARRAY_POINTER_EXT = 0x8090
| 35
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
spechub/Hets
|
Isabelle/IsaConsts.hs
|
gpl-2.0
|
isaTerm :: IsaClass
isaTerm = IsaClass "type"
| 45
|
isaTerm :: IsaClass
isaTerm = IsaClass "type"
| 45
|
isaTerm = IsaClass "type"
| 25
| false
| true
| 0
| 5
| 6
| 14
| 7
| 7
| null | null |
kmate/HaRe
|
old/testing/renaming/A4.hs
|
bsd-3-clause
|
main :: Tree Int ->Bool
main t = isSame (sumSquares (fringe t))
(sumSquares (B4.myFringe t)+sumSquares (C4.myFringe t))
| 134
|
main :: Tree Int ->Bool
main t = isSame (sumSquares (fringe t))
(sumSquares (B4.myFringe t)+sumSquares (C4.myFringe t))
| 134
|
main t = isSame (sumSquares (fringe t))
(sumSquares (B4.myFringe t)+sumSquares (C4.myFringe t))
| 110
| false
| true
| 0
| 11
| 31
| 67
| 32
| 35
| null | null |
bjornbm/astro
|
src/Astro/Place/ReferenceEllipsoid.hs
|
bsd-3-clause
|
-- [wp].
grs80 = referenceEllipsoid' (6378137.0 *~meter) (298.257222101*~one)
| 90
|
grs80 = referenceEllipsoid' (6378137.0 *~meter) (298.257222101*~one)
| 81
|
grs80 = referenceEllipsoid' (6378137.0 *~meter) (298.257222101*~one)
| 81
| true
| false
| 1
| 7
| 20
| 29
| 14
| 15
| null | null |
klmerryn/courseography
|
app/WebParsing/PostParser.hs
|
gpl-3.0
|
getDepartmentName :: [Char] -> T.Text -> [Char]
getDepartmentName fullPostName postType = do
let parsed = P.parse (isDepartmentName (T.unpack postType)) "(source)" fullPostName
case parsed of
Right name -> name
Left _ -> ""
| 248
|
getDepartmentName :: [Char] -> T.Text -> [Char]
getDepartmentName fullPostName postType = do
let parsed = P.parse (isDepartmentName (T.unpack postType)) "(source)" fullPostName
case parsed of
Right name -> name
Left _ -> ""
| 248
|
getDepartmentName fullPostName postType = do
let parsed = P.parse (isDepartmentName (T.unpack postType)) "(source)" fullPostName
case parsed of
Right name -> name
Left _ -> ""
| 200
| false
| true
| 0
| 15
| 56
| 89
| 43
| 46
| null | null |
mzini/hosa
|
src/HoSA/SizeType/Infer.hs
|
mit
|
-- notOccur vs `mapM` Ix.metaVars t2
notOccur :: [Ix.VarId] -> Ix.MetaVar -> InferCG f v ()
notOccur [] _ = return ()
| 118
|
notOccur :: [Ix.VarId] -> Ix.MetaVar -> InferCG f v ()
notOccur [] _ = return ()
| 80
|
notOccur [] _ = return ()
| 25
| true
| true
| 0
| 8
| 22
| 48
| 24
| 24
| null | null |
supki/liblastfm
|
src/Lastfm/User.hs
|
mit
|
-- | Get information about a user profile.
--
-- <http://www.last.fm/api/show/user.getInfo>
getInfo :: Request f (User -> APIKey -> Ready)
getInfo = api "user.getInfo"
| 167
|
getInfo :: Request f (User -> APIKey -> Ready)
getInfo = api "user.getInfo"
| 75
|
getInfo = api "user.getInfo"
| 28
| true
| true
| 0
| 8
| 23
| 33
| 18
| 15
| null | null |
asakamirai/kazura-queue
|
src/Control/Concurrent/KazuraQueue.hs
|
bsd-3-clause
|
newReadState :: StreamIndex -> IO (WVar (ReadState a))
newReadState strIdx = do
rcounter <- Atm.newCounter strIdx
WVar.newWVar ReadState
{ rsCounter = rcounter
, rsLimit = strIdx
}
-- | Create a new empty 'Queue'.
| 248
|
newReadState :: StreamIndex -> IO (WVar (ReadState a))
newReadState strIdx = do
rcounter <- Atm.newCounter strIdx
WVar.newWVar ReadState
{ rsCounter = rcounter
, rsLimit = strIdx
}
-- | Create a new empty 'Queue'.
| 248
|
newReadState strIdx = do
rcounter <- Atm.newCounter strIdx
WVar.newWVar ReadState
{ rsCounter = rcounter
, rsLimit = strIdx
}
-- | Create a new empty 'Queue'.
| 193
| false
| true
| 0
| 10
| 68
| 68
| 34
| 34
| null | null |
urbanslug/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
-- Might be worth caching these in targetPlatform?
tARGET_MIN_INT, tARGET_MAX_INT, tARGET_MAX_WORD :: DynFlags -> Integer
tARGET_MIN_INT dflags
= case platformWordSize (targetPlatform dflags) of
4 -> toInteger (minBound :: Int32)
8 -> toInteger (minBound :: Int64)
w -> panic ("tARGET_MIN_INT: Unknown platformWordSize: " ++ show w)
| 354
|
tARGET_MIN_INT, tARGET_MAX_INT, tARGET_MAX_WORD :: DynFlags -> Integer
tARGET_MIN_INT dflags
= case platformWordSize (targetPlatform dflags) of
4 -> toInteger (minBound :: Int32)
8 -> toInteger (minBound :: Int64)
w -> panic ("tARGET_MIN_INT: Unknown platformWordSize: " ++ show w)
| 303
|
tARGET_MIN_INT dflags
= case platformWordSize (targetPlatform dflags) of
4 -> toInteger (minBound :: Int32)
8 -> toInteger (minBound :: Int64)
w -> panic ("tARGET_MIN_INT: Unknown platformWordSize: " ++ show w)
| 232
| true
| true
| 3
| 11
| 66
| 92
| 45
| 47
| null | null |
jwiegley/ghc-release
|
utils/haddock/src/Haddock/Backends/LaTeX.hs
|
gpl-3.0
|
processExport (ExportNoDecl y subs)
= ppDocName y <> parens (sep (punctuate comma (map ppDocName subs)))
| 106
|
processExport (ExportNoDecl y subs)
= ppDocName y <> parens (sep (punctuate comma (map ppDocName subs)))
| 106
|
processExport (ExportNoDecl y subs)
= ppDocName y <> parens (sep (punctuate comma (map ppDocName subs)))
| 106
| false
| false
| 0
| 12
| 16
| 49
| 23
| 26
| null | null |
davean/waldo
|
Waldo/CityLoc.hs
|
bsd-3-clause
|
christchurch = mkCity ((-43.500000) !.! ( 172.600000)) 13
| 57
|
christchurch = mkCity ((-43.500000) !.! ( 172.600000)) 13
| 57
|
christchurch = mkCity ((-43.500000) !.! ( 172.600000)) 13
| 57
| false
| false
| 1
| 9
| 7
| 29
| 14
| 15
| null | null |
phischu/fragnix
|
builtins/ghc-prim/GHC.PrimopWrappers.hs
|
bsd-3-clause
|
leWord# :: Word# -> Word# -> Int#
leWord# a1 a2 = (GHC.Prim.leWord#) a1 a2
| 74
|
leWord# :: Word# -> Word# -> Int#
leWord# a1 a2 = (GHC.Prim.leWord#) a1 a2
| 74
|
leWord# a1 a2 = (GHC.Prim.leWord#) a1 a2
| 40
| false
| true
| 0
| 7
| 13
| 35
| 18
| 17
| null | null |
seppeljordan/simplechat2
|
src/server.hs
|
gpl-3.0
|
-- | Execute the corresponding io action to a chat command.
execChatCommand :: ( ChatCommand c, User c
, User u, NetworkTarget u, Named u
, Foldable f) =>
f u -> c -> IO ()
execChatCommand users chatCmd = do
when (isHelp chatCmd) (sendMessage originalUser (TextMessage $ helpText))
when (isWho chatCmd) (sendMessage originalUser (TextMessage $ who users))
when (isRename chatCmd) (do broadcastMessage
sendMessage
users
(SentMessage ( userId chatCmd
, show (userId chatCmd)++" -> "++newName++"\n"
)
)
sendMessage originalUser (TextMessage $ "Renamed to "++newName++"\n")
)
when (isBroadcast chatCmd) ( case getBroadcastMessage chatCmd of
Nothing -> return ()
Just s -> broadcastMessage sendMessage users (SentMessage (userId chatCmd,s))
)
when (isQuit chatCmd) (do sendMessage originalUser $ TextMessage "Goodbye :)\n"
disconnect originalUser
putStrLn $ "User "++show (userId chatCmd)++" disconnected"
)
where originalUser =
maybe
(error "execChatCommand: cannot associate message with any user")
id
(find (\x -> userId x == userId chatCmd) users)
who xs =
foldl
(\s user -> s ++ show (userId user) ++ "\t" ++ (name user) ++ "\n")
"ID\tNAME\n"
xs
newName = maybe "<incognito>" id (getRenameText chatCmd)
-- | Delete a user from the userlist when they disconnect.
| 1,892
|
execChatCommand :: ( ChatCommand c, User c
, User u, NetworkTarget u, Named u
, Foldable f) =>
f u -> c -> IO ()
execChatCommand users chatCmd = do
when (isHelp chatCmd) (sendMessage originalUser (TextMessage $ helpText))
when (isWho chatCmd) (sendMessage originalUser (TextMessage $ who users))
when (isRename chatCmd) (do broadcastMessage
sendMessage
users
(SentMessage ( userId chatCmd
, show (userId chatCmd)++" -> "++newName++"\n"
)
)
sendMessage originalUser (TextMessage $ "Renamed to "++newName++"\n")
)
when (isBroadcast chatCmd) ( case getBroadcastMessage chatCmd of
Nothing -> return ()
Just s -> broadcastMessage sendMessage users (SentMessage (userId chatCmd,s))
)
when (isQuit chatCmd) (do sendMessage originalUser $ TextMessage "Goodbye :)\n"
disconnect originalUser
putStrLn $ "User "++show (userId chatCmd)++" disconnected"
)
where originalUser =
maybe
(error "execChatCommand: cannot associate message with any user")
id
(find (\x -> userId x == userId chatCmd) users)
who xs =
foldl
(\s user -> s ++ show (userId user) ++ "\t" ++ (name user) ++ "\n")
"ID\tNAME\n"
xs
newName = maybe "<incognito>" id (getRenameText chatCmd)
-- | Delete a user from the userlist when they disconnect.
| 1,832
|
execChatCommand users chatCmd = do
when (isHelp chatCmd) (sendMessage originalUser (TextMessage $ helpText))
when (isWho chatCmd) (sendMessage originalUser (TextMessage $ who users))
when (isRename chatCmd) (do broadcastMessage
sendMessage
users
(SentMessage ( userId chatCmd
, show (userId chatCmd)++" -> "++newName++"\n"
)
)
sendMessage originalUser (TextMessage $ "Renamed to "++newName++"\n")
)
when (isBroadcast chatCmd) ( case getBroadcastMessage chatCmd of
Nothing -> return ()
Just s -> broadcastMessage sendMessage users (SentMessage (userId chatCmd,s))
)
when (isQuit chatCmd) (do sendMessage originalUser $ TextMessage "Goodbye :)\n"
disconnect originalUser
putStrLn $ "User "++show (userId chatCmd)++" disconnected"
)
where originalUser =
maybe
(error "execChatCommand: cannot associate message with any user")
id
(find (\x -> userId x == userId chatCmd) users)
who xs =
foldl
(\s user -> s ++ show (userId user) ++ "\t" ++ (name user) ++ "\n")
"ID\tNAME\n"
xs
newName = maybe "<incognito>" id (getRenameText chatCmd)
-- | Delete a user from the userlist when they disconnect.
| 1,662
| true
| true
| 2
| 20
| 818
| 466
| 224
| 242
| null | null |
nikita-volkov/postgresql-error-codes
|
library/PostgreSQL/ErrorCodes.hs
|
mit
|
-- | Code \"42P05\".
duplicate_prepared_statement :: ErrorCode = "42P05"
| 96
|
duplicate_prepared_statement :: ErrorCode = "42P05"
| 75
|
duplicate_prepared_statement :: ErrorCode = "42P05"
| 75
| true
| false
| 0
| 5
| 32
| 12
| 6
| 6
| null | null |
ribag/ganeti-experiments
|
test/hs/Test/Ganeti/Objects/BitArray.hs
|
gpl-2.0
|
prop_BitArray_fromToList :: BitArray -> Property
prop_BitArray_fromToList bs =
BA.fromList (BA.toList bs) ==? bs
| 114
|
prop_BitArray_fromToList :: BitArray -> Property
prop_BitArray_fromToList bs =
BA.fromList (BA.toList bs) ==? bs
| 114
|
prop_BitArray_fromToList bs =
BA.fromList (BA.toList bs) ==? bs
| 65
| false
| true
| 0
| 9
| 14
| 35
| 17
| 18
| null | null |
tomsmalley/aima
|
src/AIMA/Agent/Core.hs
|
bsd-3-clause
|
mean :: (Real a, Fractional b) => [a] -> b
mean as = realToFrac (sum as) / genericLength as
| 91
|
mean :: (Real a, Fractional b) => [a] -> b
mean as = realToFrac (sum as) / genericLength as
| 91
|
mean as = realToFrac (sum as) / genericLength as
| 48
| false
| true
| 0
| 8
| 18
| 57
| 27
| 30
| null | null |
robx/puzzle-draw
|
src/Draw/Elements.hs
|
mit
|
tree :: Backend' b => Tree -> Drawing b
tree Tree =
draw $ fit 0.5 $ centerXY $ scaleY 0.5 $ fc black $
mconcat
[ rect 0.1 0.6 # moveTo (p2 (0.5, 0.7)),
circle 0.1 # moveTo (p2 (0.4, 0.9)),
circle 0.2 # moveTo (p2 (0.6, 1.0)),
circle 0.2 # moveTo (p2 (0.4, 1.2)),
circle 0.16 # moveTo (p2 (0.6, 1.3)),
circle 0.15 # moveTo (p2 (0.45, 1.45)),
circle 0.1 # moveTo (p2 (0.7, 1.4))
]
| 445
|
tree :: Backend' b => Tree -> Drawing b
tree Tree =
draw $ fit 0.5 $ centerXY $ scaleY 0.5 $ fc black $
mconcat
[ rect 0.1 0.6 # moveTo (p2 (0.5, 0.7)),
circle 0.1 # moveTo (p2 (0.4, 0.9)),
circle 0.2 # moveTo (p2 (0.6, 1.0)),
circle 0.2 # moveTo (p2 (0.4, 1.2)),
circle 0.16 # moveTo (p2 (0.6, 1.3)),
circle 0.15 # moveTo (p2 (0.45, 1.45)),
circle 0.1 # moveTo (p2 (0.7, 1.4))
]
| 445
|
tree Tree =
draw $ fit 0.5 $ centerXY $ scaleY 0.5 $ fc black $
mconcat
[ rect 0.1 0.6 # moveTo (p2 (0.5, 0.7)),
circle 0.1 # moveTo (p2 (0.4, 0.9)),
circle 0.2 # moveTo (p2 (0.6, 1.0)),
circle 0.2 # moveTo (p2 (0.4, 1.2)),
circle 0.16 # moveTo (p2 (0.6, 1.3)),
circle 0.15 # moveTo (p2 (0.45, 1.45)),
circle 0.1 # moveTo (p2 (0.7, 1.4))
]
| 405
| false
| true
| 0
| 11
| 143
| 242
| 120
| 122
| null | null |
Yuras/mongodb
|
Database/MongoDB/GridFS.hs
|
apache-2.0
|
openDefaultBucket :: (Monad m, MonadIO m) => Action m Bucket
-- ^ Open the default 'Bucket' (named "fs")
openDefaultBucket = openBucket "fs"
| 140
|
openDefaultBucket :: (Monad m, MonadIO m) => Action m Bucket
openDefaultBucket = openBucket "fs"
| 96
|
openDefaultBucket = openBucket "fs"
| 35
| true
| true
| 0
| 6
| 21
| 35
| 18
| 17
| null | null |
ghc-android/ghc
|
compiler/nativeGen/PPC/Cond.hs
|
bsd-3-clause
|
condNegate :: Cond -> Cond
condNegate ALWAYS = panic "condNegate: ALWAYS"
| 74
|
condNegate :: Cond -> Cond
condNegate ALWAYS = panic "condNegate: ALWAYS"
| 74
|
condNegate ALWAYS = panic "condNegate: ALWAYS"
| 47
| false
| true
| 0
| 7
| 11
| 27
| 11
| 16
| null | null |
zaxtax/hakaru
|
haskell/Language/Hakaru/Syntax/Reducer.hs
|
bsd-3-clause
|
jmEqReducer (Red_Index s i r) (Red_Index s' i' r') = do
(Refl, Refl) <- jmEq2 s s'
(Refl, Refl) <- jmEq2 i i'
Refl <- jmEqReducer r r'
return Refl
| 162
|
jmEqReducer (Red_Index s i r) (Red_Index s' i' r') = do
(Refl, Refl) <- jmEq2 s s'
(Refl, Refl) <- jmEq2 i i'
Refl <- jmEqReducer r r'
return Refl
| 162
|
jmEqReducer (Red_Index s i r) (Red_Index s' i' r') = do
(Refl, Refl) <- jmEq2 s s'
(Refl, Refl) <- jmEq2 i i'
Refl <- jmEqReducer r r'
return Refl
| 162
| false
| false
| 0
| 8
| 45
| 85
| 40
| 45
| null | null |
gorkinovich/Haskell
|
Problems/Problem0012b.hs
|
mit
|
-- Gets the prime factors of a number. The result is reversed.
getFactors :: Integer -> [Integer]
getFactors 1 = [1]
| 116
|
getFactors :: Integer -> [Integer]
getFactors 1 = [1]
| 53
|
getFactors 1 = [1]
| 18
| true
| true
| 0
| 8
| 20
| 31
| 15
| 16
| null | null |
lukexi/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
updM :: (DynFlags -> DynP DynFlags) -> DynP ()
updM f = do dflags <- liftEwM getCmdLineState
dflags' <- f dflags
liftEwM $ putCmdLineState $! dflags'
--------------- Constructor functions for OptKind -----------------
| 242
|
updM :: (DynFlags -> DynP DynFlags) -> DynP ()
updM f = do dflags <- liftEwM getCmdLineState
dflags' <- f dflags
liftEwM $ putCmdLineState $! dflags'
--------------- Constructor functions for OptKind -----------------
| 242
|
updM f = do dflags <- liftEwM getCmdLineState
dflags' <- f dflags
liftEwM $ putCmdLineState $! dflags'
--------------- Constructor functions for OptKind -----------------
| 195
| false
| true
| 0
| 9
| 56
| 70
| 31
| 39
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/CodeGen/Rts.hs
|
bsd-3-clause
|
classFt, methodFt :: FieldType
classFt = obj classType
| 55
|
classFt, methodFt :: FieldType
classFt = obj classType
| 55
|
classFt = obj classType
| 24
| false
| true
| 0
| 5
| 8
| 16
| 9
| 7
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/TypeCheck/TcType.hs
|
bsd-3-clause
|
getDFunTyKey (LitTy x) = getDFunTyLitKey x
| 48
|
getDFunTyKey (LitTy x) = getDFunTyLitKey x
| 48
|
getDFunTyKey (LitTy x) = getDFunTyLitKey x
| 48
| false
| false
| 0
| 7
| 11
| 18
| 8
| 10
| null | null |
bitemyapp/formatting
|
src/Formatting/Formatters.hs
|
bsd-3-clause
|
commas :: (Buildable n,Integral n) => Format r (n -> r)
commas = groupInt 3 ','
| 79
|
commas :: (Buildable n,Integral n) => Format r (n -> r)
commas = groupInt 3 ','
| 79
|
commas = groupInt 3 ','
| 23
| false
| true
| 0
| 9
| 15
| 49
| 23
| 26
| null | null |
nakamuray/mangekyo
|
src/Mangekyo/Builtin.hs
|
bsd-2-clause
|
mul_ Null n@(Number _) = mul_ (number Null) n
| 45
|
mul_ Null n@(Number _) = mul_ (number Null) n
| 45
|
mul_ Null n@(Number _) = mul_ (number Null) n
| 45
| false
| false
| 1
| 7
| 8
| 37
| 15
| 22
| null | null |
mcschroeder/ghc
|
compiler/ghci/ByteCodeGen.hs
|
bsd-3-clause
|
newUnique :: BcM Unique
newUnique = BcM $
\st -> case takeUniqFromSupply (uniqSupply st) of
(uniq, us) -> let newState = st { uniqSupply = us }
in return (newState, uniq)
| 214
|
newUnique :: BcM Unique
newUnique = BcM $
\st -> case takeUniqFromSupply (uniqSupply st) of
(uniq, us) -> let newState = st { uniqSupply = us }
in return (newState, uniq)
| 214
|
newUnique = BcM $
\st -> case takeUniqFromSupply (uniqSupply st) of
(uniq, us) -> let newState = st { uniqSupply = us }
in return (newState, uniq)
| 190
| false
| true
| 0
| 15
| 74
| 76
| 40
| 36
| null | null |
cchalmers/geometry
|
src/Geometry/TwoD/Combinators.hs
|
bsd-3-clause
|
-- | Translate so the origin is on the bottom edge of the trace.
snugB
:: (InSpace V2 n a, Fractional n, Traced a, HasOrigin a)
=> a -> a
snugB = snug unit_Y
| 161
|
snugB
:: (InSpace V2 n a, Fractional n, Traced a, HasOrigin a)
=> a -> a
snugB = snug unit_Y
| 96
|
snugB = snug unit_Y
| 19
| true
| true
| 0
| 6
| 37
| 53
| 27
| 26
| null | null |
dahlia/nirum
|
src/Nirum/Targets/Python/TypeExpression.hs
|
gpl-3.0
|
compileTypeExpression mod' (Just (MapModifier k v)) = do
kExpr <- compileTypeExpression mod' (Just k)
vExpr <- compileTypeExpression mod' (Just v)
typing <- importStandardLibrary "typing"
return [qq|$typing.Mapping[$kExpr, $vExpr]|]
| 248
|
compileTypeExpression mod' (Just (MapModifier k v)) = do
kExpr <- compileTypeExpression mod' (Just k)
vExpr <- compileTypeExpression mod' (Just v)
typing <- importStandardLibrary "typing"
return [qq|$typing.Mapping[$kExpr, $vExpr]|]
| 248
|
compileTypeExpression mod' (Just (MapModifier k v)) = do
kExpr <- compileTypeExpression mod' (Just k)
vExpr <- compileTypeExpression mod' (Just v)
typing <- importStandardLibrary "typing"
return [qq|$typing.Mapping[$kExpr, $vExpr]|]
| 248
| false
| false
| 0
| 10
| 42
| 81
| 38
| 43
| null | null |
brendanhay/gogol
|
gogol-firebase-dynamiclinks/gen/Network/Google/Resource/FirebaseDynamicLinks/InstallAttribution.hs
|
mpl-2.0
|
-- | V1 error format.
iaXgafv :: Lens' InstallAttribution (Maybe Xgafv)
iaXgafv = lens _iaXgafv (\ s a -> s{_iaXgafv = a})
| 122
|
iaXgafv :: Lens' InstallAttribution (Maybe Xgafv)
iaXgafv = lens _iaXgafv (\ s a -> s{_iaXgafv = a})
| 100
|
iaXgafv = lens _iaXgafv (\ s a -> s{_iaXgafv = a})
| 50
| true
| true
| 1
| 9
| 21
| 52
| 25
| 27
| null | null |
Teaspot-Studio/Urho3D-Haskell
|
src/Graphics/Urho3D/Graphics/IndexBuffer.hs
|
mit
|
indexBufferGetIndexSize :: (Parent IndexBuffer a, Pointer p a, MonadIO m)
=> p -- ^ Pointer to IndexBuffer or ascentor
-> m Word
indexBufferGetIndexSize p = liftIO $ do
let ptr = parentPointer p
fromIntegral <$> [C.exp| unsigned int {$(IndexBuffer* ptr)->GetIndexSize()} |]
-- unsigned GetIndexSize() const { return indexSize_; }
-- | Return used vertex range from index range.
| 386
|
indexBufferGetIndexSize :: (Parent IndexBuffer a, Pointer p a, MonadIO m)
=> p -- ^ Pointer to IndexBuffer or ascentor
-> m Word
indexBufferGetIndexSize p = liftIO $ do
let ptr = parentPointer p
fromIntegral <$> [C.exp| unsigned int {$(IndexBuffer* ptr)->GetIndexSize()} |]
-- unsigned GetIndexSize() const { return indexSize_; }
-- | Return used vertex range from index range.
| 386
|
indexBufferGetIndexSize p = liftIO $ do
let ptr = parentPointer p
fromIntegral <$> [C.exp| unsigned int {$(IndexBuffer* ptr)->GetIndexSize()} |]
-- unsigned GetIndexSize() const { return indexSize_; }
-- | Return used vertex range from index range.
| 253
| false
| true
| 0
| 11
| 66
| 79
| 41
| 38
| null | null |
ezyang/ghc
|
compiler/prelude/THNames.hs
|
bsd-3-clause
|
standaloneDerivWithStrategyDName = libFun (fsLit "standaloneDerivWithStrategyD") standaloneDerivWithStrategyDIdKey
| 114
|
standaloneDerivWithStrategyDName = libFun (fsLit "standaloneDerivWithStrategyD") standaloneDerivWithStrategyDIdKey
| 114
|
standaloneDerivWithStrategyDName = libFun (fsLit "standaloneDerivWithStrategyD") standaloneDerivWithStrategyDIdKey
| 114
| false
| false
| 0
| 7
| 5
| 17
| 8
| 9
| null | null |
brendanhay/gogol
|
gogol-androidmanagement/gen/Network/Google/Resource/AndroidManagement/Enterprises/WebApps/Create.hs
|
mpl-2.0
|
-- | OAuth access token.
ewacAccessToken :: Lens' EnterprisesWebAppsCreate (Maybe Text)
ewacAccessToken
= lens _ewacAccessToken
(\ s a -> s{_ewacAccessToken = a})
| 170
|
ewacAccessToken :: Lens' EnterprisesWebAppsCreate (Maybe Text)
ewacAccessToken
= lens _ewacAccessToken
(\ s a -> s{_ewacAccessToken = a})
| 145
|
ewacAccessToken
= lens _ewacAccessToken
(\ s a -> s{_ewacAccessToken = a})
| 82
| true
| true
| 0
| 9
| 29
| 48
| 25
| 23
| null | null |
sebiva/monite
|
src/Monite/Interpret.hs
|
gpl-3.0
|
-- | An empty environment
initEnv :: IO Env
initEnv = do home <- getHomeDirectory -- TODO: Config instead? : 2015-03-02 - 22:33:21 (John) Maybe should start in the current working dir?
env <- liftM (map (\(k, v) -> (k, [v]))) getEnvironment
return $ Env [M.fromList env] home
-- | Shorthand for io actions
| 332
|
initEnv :: IO Env
initEnv = do home <- getHomeDirectory -- TODO: Config instead? : 2015-03-02 - 22:33:21 (John) Maybe should start in the current working dir?
env <- liftM (map (\(k, v) -> (k, [v]))) getEnvironment
return $ Env [M.fromList env] home
-- | Shorthand for io actions
| 306
|
initEnv = do home <- getHomeDirectory -- TODO: Config instead? : 2015-03-02 - 22:33:21 (John) Maybe should start in the current working dir?
env <- liftM (map (\(k, v) -> (k, [v]))) getEnvironment
return $ Env [M.fromList env] home
-- | Shorthand for io actions
| 288
| true
| true
| 0
| 15
| 80
| 91
| 46
| 45
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.