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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Soostone/aws
|
Examples/NukeBucket.hs
|
bsd-3-clause
|
main :: IO ()
main = do
[bucket] <- fmap (map pack) getArgs
{- Set up AWS credentials and the default configuration. -}
cfg <- Aws.baseConfiguration
let s3cfg = Aws.defServiceConfig :: S3.S3Configuration Aws.NormalQuery
{- Set up a ResourceT region with an available HTTP manager. -}
withManager $ \mgr -> do
let src = Aws.awsIteratedSource cfg s3cfg mgr (S3.getBucket bucket)
let deleteObjects [] = return ()
deleteObjects os =
do
let keys = map S3.objectKey os
liftIO $ putStrLn ("Deleting objects: " ++ show keys)
_ <- Aws.pureAws cfg s3cfg mgr (S3.deleteObjects bucket (map S3.objectKey os))
return ()
src C.$$ CL.mapM_ (deleteObjects . S3.gbrContents <=< Aws.readResponseIO)
liftIO $ putStrLn ("Deleting bucket: " ++ show bucket)
_ <- Aws.pureAws cfg s3cfg mgr (S3.DeleteBucket bucket)
return ()
| 904
|
main :: IO ()
main = do
[bucket] <- fmap (map pack) getArgs
{- Set up AWS credentials and the default configuration. -}
cfg <- Aws.baseConfiguration
let s3cfg = Aws.defServiceConfig :: S3.S3Configuration Aws.NormalQuery
{- Set up a ResourceT region with an available HTTP manager. -}
withManager $ \mgr -> do
let src = Aws.awsIteratedSource cfg s3cfg mgr (S3.getBucket bucket)
let deleteObjects [] = return ()
deleteObjects os =
do
let keys = map S3.objectKey os
liftIO $ putStrLn ("Deleting objects: " ++ show keys)
_ <- Aws.pureAws cfg s3cfg mgr (S3.deleteObjects bucket (map S3.objectKey os))
return ()
src C.$$ CL.mapM_ (deleteObjects . S3.gbrContents <=< Aws.readResponseIO)
liftIO $ putStrLn ("Deleting bucket: " ++ show bucket)
_ <- Aws.pureAws cfg s3cfg mgr (S3.DeleteBucket bucket)
return ()
| 904
|
main = do
[bucket] <- fmap (map pack) getArgs
{- Set up AWS credentials and the default configuration. -}
cfg <- Aws.baseConfiguration
let s3cfg = Aws.defServiceConfig :: S3.S3Configuration Aws.NormalQuery
{- Set up a ResourceT region with an available HTTP manager. -}
withManager $ \mgr -> do
let src = Aws.awsIteratedSource cfg s3cfg mgr (S3.getBucket bucket)
let deleteObjects [] = return ()
deleteObjects os =
do
let keys = map S3.objectKey os
liftIO $ putStrLn ("Deleting objects: " ++ show keys)
_ <- Aws.pureAws cfg s3cfg mgr (S3.deleteObjects bucket (map S3.objectKey os))
return ()
src C.$$ CL.mapM_ (deleteObjects . S3.gbrContents <=< Aws.readResponseIO)
liftIO $ putStrLn ("Deleting bucket: " ++ show bucket)
_ <- Aws.pureAws cfg s3cfg mgr (S3.DeleteBucket bucket)
return ()
| 890
| false
| true
| 0
| 23
| 227
| 307
| 141
| 166
| null | null |
jutaro/rdf4h
|
testsuite/tests/W3C/Manifest.hs
|
bsd-3-clause
|
-- FIXME: incorrect namespace "rdfs:approval" in rdf-mt/manifest.ttl, must be "rdft:approval"
mfName = unode "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#name"
| 172
|
mfName = unode "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#name"
| 78
|
mfName = unode "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#name"
| 78
| true
| false
| 0
| 5
| 13
| 10
| 5
| 5
| null | null |
DasAsozialeNetzwerk/circus
|
Network/Circus/Session.hs
|
gpl-3.0
|
defaultParams :: String -> EventFunction -> Params
defaultParams addr eventfn = Params
{ pAddr = addr
, pPort = 6667
, pNick = "circus"
, pUser = "circus"
, pReal = "circus"
, pChannels = []
, pEvent = eventfn
, pDebug = True
}
| 254
|
defaultParams :: String -> EventFunction -> Params
defaultParams addr eventfn = Params
{ pAddr = addr
, pPort = 6667
, pNick = "circus"
, pUser = "circus"
, pReal = "circus"
, pChannels = []
, pEvent = eventfn
, pDebug = True
}
| 254
|
defaultParams addr eventfn = Params
{ pAddr = addr
, pPort = 6667
, pNick = "circus"
, pUser = "circus"
, pReal = "circus"
, pChannels = []
, pEvent = eventfn
, pDebug = True
}
| 203
| false
| true
| 0
| 8
| 71
| 85
| 48
| 37
| null | null |
xu-hao/QueryArrow
|
QueryArrow-db-sql-common/src/QueryArrow/SQL/SQL.hs
|
bsd-3-clause
|
(.<>.) :: SQLExpr -> SQLExpr -> SQLCond
a .<>. b = SQLCompCond "<>" a b
| 72
|
(.<>.) :: SQLExpr -> SQLExpr -> SQLCond
a .<>. b = SQLCompCond "<>" a b
| 71
|
a .<>. b = SQLCompCond "<>" a b
| 31
| false
| true
| 0
| 9
| 15
| 35
| 17
| 18
| null | null |
23Skidoo/xmlhtml
|
src/Text/XmlHtml/HTML/Meta.hs
|
bsd-3-clause
|
reftab26 :: [(Text,Text)]
reftab26 =
[ ("dtrif", "\x025BE"),
("duarr", "\x021F5"),
("duhar", "\x0296F"),
("dwangle", "\x029A6"),
("dzcy", "\x0045F"),
("dzigrarr", "\x027FF"),
("eDDot", "\x02A77"),
("eDot", "\x02251"),
("eacute", "\x000E9"),
("easter", "\x02A6E"),
("ecaron", "\x0011B"),
("ecir", "\x02256"),
("ecirc", "\x000EA"),
("ecolon", "\x02255"),
("ecy", "\x0044D"),
("edot", "\x00117"),
("ee", "\x02147"),
("efDot", "\x02252"),
("efr", "\x1D522"),
("eg", "\x02A9A"),
("egrave", "\x000E8"),
("egs", "\x02A96"),
("egsdot", "\x02A98"),
("el", "\x02A99"),
("elinters", "\x023E7"),
("ell", "\x02113"),
("els", "\x02A95"),
("elsdot", "\x02A97"),
("emacr", "\x00113"),
("empty", "\x02205"),
("emptyset", "\x02205"),
("emptyv", "\x02205"),
("emsp", "\x02003"),
("emsp13", "\x02004"),
("emsp14", "\x02005"),
("eng", "\x0014B"),
("ensp", "\x02002") ]
| 993
|
reftab26 :: [(Text,Text)]
reftab26 =
[ ("dtrif", "\x025BE"),
("duarr", "\x021F5"),
("duhar", "\x0296F"),
("dwangle", "\x029A6"),
("dzcy", "\x0045F"),
("dzigrarr", "\x027FF"),
("eDDot", "\x02A77"),
("eDot", "\x02251"),
("eacute", "\x000E9"),
("easter", "\x02A6E"),
("ecaron", "\x0011B"),
("ecir", "\x02256"),
("ecirc", "\x000EA"),
("ecolon", "\x02255"),
("ecy", "\x0044D"),
("edot", "\x00117"),
("ee", "\x02147"),
("efDot", "\x02252"),
("efr", "\x1D522"),
("eg", "\x02A9A"),
("egrave", "\x000E8"),
("egs", "\x02A96"),
("egsdot", "\x02A98"),
("el", "\x02A99"),
("elinters", "\x023E7"),
("ell", "\x02113"),
("els", "\x02A95"),
("elsdot", "\x02A97"),
("emacr", "\x00113"),
("empty", "\x02205"),
("emptyset", "\x02205"),
("emptyv", "\x02205"),
("emsp", "\x02003"),
("emsp13", "\x02004"),
("emsp14", "\x02005"),
("eng", "\x0014B"),
("ensp", "\x02002") ]
| 993
|
reftab26 =
[ ("dtrif", "\x025BE"),
("duarr", "\x021F5"),
("duhar", "\x0296F"),
("dwangle", "\x029A6"),
("dzcy", "\x0045F"),
("dzigrarr", "\x027FF"),
("eDDot", "\x02A77"),
("eDot", "\x02251"),
("eacute", "\x000E9"),
("easter", "\x02A6E"),
("ecaron", "\x0011B"),
("ecir", "\x02256"),
("ecirc", "\x000EA"),
("ecolon", "\x02255"),
("ecy", "\x0044D"),
("edot", "\x00117"),
("ee", "\x02147"),
("efDot", "\x02252"),
("efr", "\x1D522"),
("eg", "\x02A9A"),
("egrave", "\x000E8"),
("egs", "\x02A96"),
("egsdot", "\x02A98"),
("el", "\x02A99"),
("elinters", "\x023E7"),
("ell", "\x02113"),
("els", "\x02A95"),
("elsdot", "\x02A97"),
("emacr", "\x00113"),
("empty", "\x02205"),
("emptyset", "\x02205"),
("emptyv", "\x02205"),
("emsp", "\x02003"),
("emsp13", "\x02004"),
("emsp14", "\x02005"),
("eng", "\x0014B"),
("ensp", "\x02002") ]
| 967
| false
| true
| 0
| 6
| 226
| 353
| 234
| 119
| null | null |
brendanhay/gogol
|
gogol-storage/gen/Network/Google/Storage/Types/Product.hs
|
mpl-2.0
|
-- | Content-Disposition of the object data.
objContentDisPosition :: Lens' Object (Maybe Text)
objContentDisPosition
= lens _objContentDisPosition
(\ s a -> s{_objContentDisPosition = a})
| 196
|
objContentDisPosition :: Lens' Object (Maybe Text)
objContentDisPosition
= lens _objContentDisPosition
(\ s a -> s{_objContentDisPosition = a})
| 151
|
objContentDisPosition
= lens _objContentDisPosition
(\ s a -> s{_objContentDisPosition = a})
| 100
| true
| true
| 0
| 9
| 31
| 48
| 25
| 23
| null | null |
green-haskell/ghc
|
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
|
bsd-3-clause
|
{- | @reifyRoles nm@ returns the list of roles associated with the parameters of
the tycon @nm@. Fails if @nm@ cannot be found or is not a tycon.
The returned list should never contain 'InferR'.
-}
reifyRoles :: Name -> Q [Role]
reifyRoles nm = Q (qReifyRoles nm)
| 263
|
reifyRoles :: Name -> Q [Role]
reifyRoles nm = Q (qReifyRoles nm)
| 65
|
reifyRoles nm = Q (qReifyRoles nm)
| 34
| true
| true
| 0
| 7
| 47
| 34
| 17
| 17
| null | null |
diku-dk/futhark
|
src/Futhark/Analysis/SymbolTable.hs
|
isc
|
insertFreeVar :: ASTRep rep => VName -> NameInfo rep -> SymbolTable rep -> SymbolTable rep
insertFreeVar name dec = insertEntry name entry
where
entry =
FreeVar
FreeVarEntry
{ freeVarDec = dec,
freeVarIndex = \_ _ -> Nothing,
freeVarAliases = mempty
}
| 315
|
insertFreeVar :: ASTRep rep => VName -> NameInfo rep -> SymbolTable rep -> SymbolTable rep
insertFreeVar name dec = insertEntry name entry
where
entry =
FreeVar
FreeVarEntry
{ freeVarDec = dec,
freeVarIndex = \_ _ -> Nothing,
freeVarAliases = mempty
}
| 315
|
insertFreeVar name dec = insertEntry name entry
where
entry =
FreeVar
FreeVarEntry
{ freeVarDec = dec,
freeVarIndex = \_ _ -> Nothing,
freeVarAliases = mempty
}
| 224
| false
| true
| 0
| 9
| 104
| 87
| 44
| 43
| null | null |
tolysz/prepare-ghcjs
|
spec-lts8/cabal/cabal-install/Distribution/Client/Dependency/Modular/Var.hs
|
bsd-3-clause
|
-- | Extract the package instance from a Var
varPI :: Var QPN -> (QPN, Maybe I)
varPI (P qpn) = (qpn, Nothing)
| 124
|
varPI :: Var QPN -> (QPN, Maybe I)
varPI (P qpn) = (qpn, Nothing)
| 79
|
varPI (P qpn) = (qpn, Nothing)
| 44
| true
| true
| 0
| 9
| 36
| 49
| 24
| 25
| null | null |
keera-studios/hsQt
|
Qtc/ClassTypes/Gui.hs
|
bsd-2-clause
|
qCastList_QStyleHintReturn x = qcl_QStyleHintReturn [] x
| 56
|
qCastList_QStyleHintReturn x = qcl_QStyleHintReturn [] x
| 56
|
qCastList_QStyleHintReturn x = qcl_QStyleHintReturn [] x
| 56
| false
| false
| 0
| 6
| 5
| 16
| 7
| 9
| null | null |
haslab/SecreC
|
src/Text/Derp/Combinator.hs
|
gpl-3.0
|
endBy1 p sep = (p <~ sep) <~> endBy p sep ==> uncurry (:)
| 57
|
endBy1 p sep = (p <~ sep) <~> endBy p sep ==> uncurry (:)
| 57
|
endBy1 p sep = (p <~ sep) <~> endBy p sep ==> uncurry (:)
| 57
| false
| false
| 0
| 8
| 13
| 36
| 18
| 18
| null | null |
peterokagey/haskellOEIS
|
test/PolygonSizes/A328787Spec.hs
|
apache-2.0
|
spec :: Spec
spec = describe "A328787" $
it "correctly computes the first 20 elements" $
map a328787 [2..20] `shouldBe` expectedValue where
expectedValue = [1,2,4,6,8,11,14,17,21,25,28,33,38,43,49,54,59,66,73]
| 221
|
spec :: Spec
spec = describe "A328787" $
it "correctly computes the first 20 elements" $
map a328787 [2..20] `shouldBe` expectedValue where
expectedValue = [1,2,4,6,8,11,14,17,21,25,28,33,38,43,49,54,59,66,73]
| 221
|
spec = describe "A328787" $
it "correctly computes the first 20 elements" $
map a328787 [2..20] `shouldBe` expectedValue where
expectedValue = [1,2,4,6,8,11,14,17,21,25,28,33,38,43,49,54,59,66,73]
| 208
| false
| true
| 0
| 8
| 36
| 105
| 63
| 42
| null | null |
riwsky/wiwinwlh
|
src/split.hs
|
mit
|
example1 = splitOn "." "foo.bar.baz"
| 36
|
example1 = splitOn "." "foo.bar.baz"
| 36
|
example1 = splitOn "." "foo.bar.baz"
| 36
| false
| false
| 1
| 5
| 4
| 15
| 5
| 10
| null | null |
brentonashworth/sitecheck
|
test/Network/SiteCheckTests.hs
|
bsd-3-clause
|
startState = initState emptyVisited [(toLink "http://a.b.c/test")]
| 66
|
startState = initState emptyVisited [(toLink "http://a.b.c/test")]
| 66
|
startState = initState emptyVisited [(toLink "http://a.b.c/test")]
| 66
| false
| false
| 0
| 8
| 5
| 20
| 10
| 10
| null | null |
sdiehl/ghc
|
hadrian/src/Settings.hs
|
bsd-3-clause
|
hadrianFlavours :: [Flavour]
hadrianFlavours =
[ benchmarkFlavour, defaultFlavour, developmentFlavour Stage1
, developmentFlavour Stage2, performanceFlavour, profiledFlavour
, quickFlavour, quickestFlavour, quickCrossFlavour, benchmarkLlvmFlavour
, performanceLlvmFlavour, profiledLlvmFlavour, quickLlvmFlavour
, ghcInGhciFlavour, validateFlavour, slowValidateFlavour ]
| 389
|
hadrianFlavours :: [Flavour]
hadrianFlavours =
[ benchmarkFlavour, defaultFlavour, developmentFlavour Stage1
, developmentFlavour Stage2, performanceFlavour, profiledFlavour
, quickFlavour, quickestFlavour, quickCrossFlavour, benchmarkLlvmFlavour
, performanceLlvmFlavour, profiledLlvmFlavour, quickLlvmFlavour
, ghcInGhciFlavour, validateFlavour, slowValidateFlavour ]
| 389
|
hadrianFlavours =
[ benchmarkFlavour, defaultFlavour, developmentFlavour Stage1
, developmentFlavour Stage2, performanceFlavour, profiledFlavour
, quickFlavour, quickestFlavour, quickCrossFlavour, benchmarkLlvmFlavour
, performanceLlvmFlavour, profiledLlvmFlavour, quickLlvmFlavour
, ghcInGhciFlavour, validateFlavour, slowValidateFlavour ]
| 360
| false
| true
| 0
| 6
| 48
| 68
| 42
| 26
| null | null |
krattai/noo-ebs
|
docs/zeroMQ-guide2/examples/Haskell/interrupt.hs
|
bsd-2-clause
|
handler :: MVar Int -> IO ()
handler s_interrupted = modifyMVar_ s_interrupted (return . (+1))
| 94
|
handler :: MVar Int -> IO ()
handler s_interrupted = modifyMVar_ s_interrupted (return . (+1))
| 94
|
handler s_interrupted = modifyMVar_ s_interrupted (return . (+1))
| 65
| false
| true
| 0
| 8
| 14
| 45
| 22
| 23
| null | null |
ganeti-github-testing/ganeti-test-1
|
src/Ganeti/HTools/Cluster.hs
|
bsd-2-clause
|
tryAlloc _ _ _ (Left []) = fail "No online nodes"
| 53
|
tryAlloc _ _ _ (Left []) = fail "No online nodes"
| 53
|
tryAlloc _ _ _ (Left []) = fail "No online nodes"
| 53
| false
| false
| 0
| 8
| 14
| 26
| 12
| 14
| null | null |
brendanhay/gogol
|
gogol-healthcare/gen/Network/Google/Resource/Healthcare/Projects/Locations/DataSets/ConsentStores/Create.hs
|
mpl-2.0
|
-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
pldscscUploadProtocol :: Lens' ProjectsLocationsDataSetsConsentStoresCreate (Maybe Text)
pldscscUploadProtocol
= lens _pldscscUploadProtocol
(\ s a -> s{_pldscscUploadProtocol = a})
| 251
|
pldscscUploadProtocol :: Lens' ProjectsLocationsDataSetsConsentStoresCreate (Maybe Text)
pldscscUploadProtocol
= lens _pldscscUploadProtocol
(\ s a -> s{_pldscscUploadProtocol = a})
| 189
|
pldscscUploadProtocol
= lens _pldscscUploadProtocol
(\ s a -> s{_pldscscUploadProtocol = a})
| 100
| true
| true
| 1
| 9
| 33
| 51
| 25
| 26
| null | null |
gregor-samsa/hs.test
|
iyd1.hs
|
bsd-3-clause
|
printFileMeta f = do
defaultf <- mkFile (FilePath.takeExtension f) f
putStrLn (show defaultf)
| 97
|
printFileMeta f = do
defaultf <- mkFile (FilePath.takeExtension f) f
putStrLn (show defaultf)
| 97
|
printFileMeta f = do
defaultf <- mkFile (FilePath.takeExtension f) f
putStrLn (show defaultf)
| 97
| false
| false
| 0
| 11
| 16
| 41
| 18
| 23
| null | null |
beni55/http-types
|
Network/HTTP/Types/URI.hs
|
bsd-3-clause
|
renderQuery :: Bool -- ^ prepend question mark?
-> Query -> B.ByteString
renderQuery qm = Blaze.toByteString . renderQueryBuilder qm
| 144
|
renderQuery :: Bool -- ^ prepend question mark?
-> Query -> B.ByteString
renderQuery qm = Blaze.toByteString . renderQueryBuilder qm
| 144
|
renderQuery qm = Blaze.toByteString . renderQueryBuilder qm
| 59
| false
| true
| 0
| 7
| 30
| 34
| 17
| 17
| null | null |
ml9951/ghc
|
compiler/nativeGen/X86/CodeGen.hs
|
bsd-3-clause
|
jumpTableEntry _ (Just blockid) = CmmStaticLit (CmmLabel blockLabel)
where blockLabel = mkAsmTempLabel (getUnique blockid)
-- -----------------------------------------------------------------------------
-- General things for putting together code sequences
-- Expand CmmRegOff. ToDo: should we do it this way around, or convert
-- CmmExprs into CmmRegOff?
| 364
|
jumpTableEntry _ (Just blockid) = CmmStaticLit (CmmLabel blockLabel)
where blockLabel = mkAsmTempLabel (getUnique blockid)
-- -----------------------------------------------------------------------------
-- General things for putting together code sequences
-- Expand CmmRegOff. ToDo: should we do it this way around, or convert
-- CmmExprs into CmmRegOff?
| 364
|
jumpTableEntry _ (Just blockid) = CmmStaticLit (CmmLabel blockLabel)
where blockLabel = mkAsmTempLabel (getUnique blockid)
-- -----------------------------------------------------------------------------
-- General things for putting together code sequences
-- Expand CmmRegOff. ToDo: should we do it this way around, or convert
-- CmmExprs into CmmRegOff?
| 364
| false
| false
| 0
| 7
| 48
| 47
| 24
| 23
| null | null |
msakai/icfpc2014
|
Game.hs
|
bsd-3-clause
|
symbolFromChar '=' = Ghost
| 26
|
symbolFromChar '=' = Ghost
| 26
|
symbolFromChar '=' = Ghost
| 26
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
khibino/haskell-debian-build.rebuild
|
src/Debian/Package/Data/Packages.hs
|
bsd-3-clause
|
-- | Make 'Source'
mkSource :: String -> DebianVersion -> Source
mkSource = Source
| 83
|
mkSource :: String -> DebianVersion -> Source
mkSource = Source
| 64
|
mkSource = Source
| 18
| true
| true
| 0
| 6
| 14
| 20
| 11
| 9
| null | null |
sgillespie/ghc
|
compiler/nativeGen/RegAlloc/Liveness.hs
|
bsd-3-clause
|
--
-- Compute the liveness graph of the set of basic blocks. Important:
-- we also discard any unreachable code here, starting from the entry
-- points (the first block in the list, and any blocks with info
-- tables). Unreachable code arises when code blocks are orphaned in
-- earlier optimisation passes, and may confuse the register allocator
-- by referring to registers that are not initialised. It's easy to
-- discard the unreachable code as part of the SCC pass, so that's
-- exactly what we do. (#7574)
--
sccBlocks
:: Instruction instr
=> [NatBasicBlock instr]
-> [BlockId]
-> [SCC (NatBasicBlock instr)]
sccBlocks blocks entries = map (fmap get_node) sccs
where
-- nodes :: [(NatBasicBlock instr, Unique, [Unique])]
nodes = [ (block, id, getOutEdges instrs)
| block@(BasicBlock id instrs) <- blocks ]
g1 = graphFromEdgedVerticesUniq nodes
reachable :: BlockSet
reachable = setFromList [ id | (_,id,_) <- reachablesG g1 roots ]
g2 = graphFromEdgedVerticesUniq [ node | node@(_,id,_) <- nodes
, id `setMember` reachable ]
sccs = stronglyConnCompG g2
get_node (n, _, _) = n
getOutEdges :: Instruction instr => [instr] -> [BlockId]
getOutEdges instrs = concat $ map jumpDestsOfInstr instrs
-- This is truly ugly, but I don't see a good alternative.
-- Digraph just has the wrong API. We want to identify nodes
-- by their keys (BlockId), but Digraph requires the whole
-- node: (NatBasicBlock, BlockId, [BlockId]). This takes
-- advantage of the fact that Digraph only looks at the key,
-- even though it asks for the whole triple.
roots = [(panic "sccBlocks",b,panic "sccBlocks") | b <- entries ]
--------------------------------------------------------------------------------
-- Annotate code with register liveness information
--
| 1,990
|
sccBlocks
:: Instruction instr
=> [NatBasicBlock instr]
-> [BlockId]
-> [SCC (NatBasicBlock instr)]
sccBlocks blocks entries = map (fmap get_node) sccs
where
-- nodes :: [(NatBasicBlock instr, Unique, [Unique])]
nodes = [ (block, id, getOutEdges instrs)
| block@(BasicBlock id instrs) <- blocks ]
g1 = graphFromEdgedVerticesUniq nodes
reachable :: BlockSet
reachable = setFromList [ id | (_,id,_) <- reachablesG g1 roots ]
g2 = graphFromEdgedVerticesUniq [ node | node@(_,id,_) <- nodes
, id `setMember` reachable ]
sccs = stronglyConnCompG g2
get_node (n, _, _) = n
getOutEdges :: Instruction instr => [instr] -> [BlockId]
getOutEdges instrs = concat $ map jumpDestsOfInstr instrs
-- This is truly ugly, but I don't see a good alternative.
-- Digraph just has the wrong API. We want to identify nodes
-- by their keys (BlockId), but Digraph requires the whole
-- node: (NatBasicBlock, BlockId, [BlockId]). This takes
-- advantage of the fact that Digraph only looks at the key,
-- even though it asks for the whole triple.
roots = [(panic "sccBlocks",b,panic "sccBlocks") | b <- entries ]
--------------------------------------------------------------------------------
-- Annotate code with register liveness information
--
| 1,470
|
sccBlocks blocks entries = map (fmap get_node) sccs
where
-- nodes :: [(NatBasicBlock instr, Unique, [Unique])]
nodes = [ (block, id, getOutEdges instrs)
| block@(BasicBlock id instrs) <- blocks ]
g1 = graphFromEdgedVerticesUniq nodes
reachable :: BlockSet
reachable = setFromList [ id | (_,id,_) <- reachablesG g1 roots ]
g2 = graphFromEdgedVerticesUniq [ node | node@(_,id,_) <- nodes
, id `setMember` reachable ]
sccs = stronglyConnCompG g2
get_node (n, _, _) = n
getOutEdges :: Instruction instr => [instr] -> [BlockId]
getOutEdges instrs = concat $ map jumpDestsOfInstr instrs
-- This is truly ugly, but I don't see a good alternative.
-- Digraph just has the wrong API. We want to identify nodes
-- by their keys (BlockId), but Digraph requires the whole
-- node: (NatBasicBlock, BlockId, [BlockId]). This takes
-- advantage of the fact that Digraph only looks at the key,
-- even though it asks for the whole triple.
roots = [(panic "sccBlocks",b,panic "sccBlocks") | b <- entries ]
--------------------------------------------------------------------------------
-- Annotate code with register liveness information
--
| 1,338
| true
| true
| 0
| 13
| 522
| 313
| 175
| 138
| null | null |
raventid/coursera_learning
|
haskell/will_kurt/10.2_fighting_robots.hs
|
mit
|
killer2 = fight giant2 killer1
| 30
|
killer2 = fight giant2 killer1
| 30
|
killer2 = fight giant2 killer1
| 30
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
pparkkin/eta
|
compiler/ETA/Utils/Util.hs
|
bsd-3-clause
|
zipWithAndUnzip :: (a -> b -> (c,d)) -> [a] -> [b] -> ([c],[d])
zipWithAndUnzip f (a:as) (b:bs)
= let (r1, r2) = f a b
(rs1, rs2) = zipWithAndUnzip f as bs
in
(r1:rs1, r2:rs2)
| 195
|
zipWithAndUnzip :: (a -> b -> (c,d)) -> [a] -> [b] -> ([c],[d])
zipWithAndUnzip f (a:as) (b:bs)
= let (r1, r2) = f a b
(rs1, rs2) = zipWithAndUnzip f as bs
in
(r1:rs1, r2:rs2)
| 195
|
zipWithAndUnzip f (a:as) (b:bs)
= let (r1, r2) = f a b
(rs1, rs2) = zipWithAndUnzip f as bs
in
(r1:rs1, r2:rs2)
| 131
| false
| true
| 0
| 9
| 54
| 140
| 75
| 65
| null | null |
gcross/LogicGrowsOnTrees
|
LogicGrowsOnTrees/sources/LogicGrowsOnTrees/Testing.hs
|
bsd-2-clause
|
addAcceptMultipleWorkloadsAction :: -- {{{
SupervisorCallbacks exploration_mode worker_id IO →
IO (IORef [(worker_id,Workload)],SupervisorCallbacks exploration_mode worker_id IO)
addAcceptMultipleWorkloadsAction actions = do
workers_and_workloads_ref ← newIORef []
return (workers_and_workloads_ref, actions {
sendWorkloadToWorker = \workload worker_id →
readIORef workers_and_workloads_ref
>>=
writeIORef workers_and_workloads_ref . (++ [(worker_id,workload)])
})
-- }}}
| 535
|
addAcceptMultipleWorkloadsAction :: -- {{{
SupervisorCallbacks exploration_mode worker_id IO →
IO (IORef [(worker_id,Workload)],SupervisorCallbacks exploration_mode worker_id IO)
addAcceptMultipleWorkloadsAction actions = do
workers_and_workloads_ref ← newIORef []
return (workers_and_workloads_ref, actions {
sendWorkloadToWorker = \workload worker_id →
readIORef workers_and_workloads_ref
>>=
writeIORef workers_and_workloads_ref . (++ [(worker_id,workload)])
})
-- }}}
| 535
|
addAcceptMultipleWorkloadsAction actions = do
workers_and_workloads_ref ← newIORef []
return (workers_and_workloads_ref, actions {
sendWorkloadToWorker = \workload worker_id →
readIORef workers_and_workloads_ref
>>=
writeIORef workers_and_workloads_ref . (++ [(worker_id,workload)])
})
-- }}}
| 348
| false
| true
| 0
| 15
| 106
| 122
| 64
| 58
| null | null |
lukasepple/spacecookie
|
src/Network/Gopher/Log.hs
|
gpl-3.0
|
defaultLogConfig :: GopherLogConfig
defaultLogConfig = GopherLogConfig (fmap Just toLogStr) True
| 96
|
defaultLogConfig :: GopherLogConfig
defaultLogConfig = GopherLogConfig (fmap Just toLogStr) True
| 96
|
defaultLogConfig = GopherLogConfig (fmap Just toLogStr) True
| 60
| false
| true
| 0
| 7
| 9
| 30
| 13
| 17
| null | null |
shlevy/ghc
|
compiler/simplCore/OccurAnal.hs
|
bsd-3-clause
|
extendFvs_ :: UniqFM VarSet -> VarSet -> VarSet
extendFvs_ env s = fst (extendFvs env s)
| 88
|
extendFvs_ :: UniqFM VarSet -> VarSet -> VarSet
extendFvs_ env s = fst (extendFvs env s)
| 88
|
extendFvs_ env s = fst (extendFvs env s)
| 40
| false
| true
| 0
| 7
| 15
| 38
| 18
| 20
| null | null |
chemist/agentx
|
src/Network/Protocol/Snmp/AgentX/Packet/Put.hs
|
bsd-3-clause
|
packWord :: (w -> Builder) -> (w -> Builder) -> w -> Pack Builder
packWord be le w = do
b <- gets ( bigEndian . flags . packet )
if b then return (be w) else return (le w)
| 180
|
packWord :: (w -> Builder) -> (w -> Builder) -> w -> Pack Builder
packWord be le w = do
b <- gets ( bigEndian . flags . packet )
if b then return (be w) else return (le w)
| 180
|
packWord be le w = do
b <- gets ( bigEndian . flags . packet )
if b then return (be w) else return (le w)
| 114
| false
| true
| 0
| 11
| 48
| 97
| 48
| 49
| null | null |
rueshyna/gogol
|
gogol-admin-directory/gen/Network/Google/Directory/Types/Product.hs
|
mpl-2.0
|
-- | Kind of resource this is.
dKind :: Lens' DomainAlias Text
dKind = lens _dKind (\ s a -> s{_dKind = a})
| 107
|
dKind :: Lens' DomainAlias Text
dKind = lens _dKind (\ s a -> s{_dKind = a})
| 76
|
dKind = lens _dKind (\ s a -> s{_dKind = a})
| 44
| true
| true
| 0
| 9
| 22
| 40
| 22
| 18
| null | null |
CulpaBS/wbBach
|
src/Futhark/Transform/Rename.hs
|
bsd-3-clause
|
runRenamer :: RenameM a -> VNameSource -> (a, VNameSource)
runRenamer m src = runReader (runStateT m src) env
where env = RenameEnv HM.empty newName
-- | Rename variables such that each is unique. The semantics of the
-- program are unaffected, under the assumption that the program was
-- correct to begin with. In particular, the renaming may make an
-- invalid program valid.
| 383
|
runRenamer :: RenameM a -> VNameSource -> (a, VNameSource)
runRenamer m src = runReader (runStateT m src) env
where env = RenameEnv HM.empty newName
-- | Rename variables such that each is unique. The semantics of the
-- program are unaffected, under the assumption that the program was
-- correct to begin with. In particular, the renaming may make an
-- invalid program valid.
| 383
|
runRenamer m src = runReader (runStateT m src) env
where env = RenameEnv HM.empty newName
-- | Rename variables such that each is unique. The semantics of the
-- program are unaffected, under the assumption that the program was
-- correct to begin with. In particular, the renaming may make an
-- invalid program valid.
| 324
| false
| true
| 0
| 7
| 68
| 65
| 34
| 31
| null | null |
BeautifulDestinations/CV
|
Utils/List.hs
|
bsd-3-clause
|
rankBy f xs = map (\(rank,(orig,val)) -> (rank,val))
. sortBy (compare`on`(fst.snd))
. zip [1..]
. sortBy (f`on`snd)
. zip [1..]
$ xs
| 206
|
rankBy f xs = map (\(rank,(orig,val)) -> (rank,val))
. sortBy (compare`on`(fst.snd))
. zip [1..]
. sortBy (f`on`snd)
. zip [1..]
$ xs
| 206
|
rankBy f xs = map (\(rank,(orig,val)) -> (rank,val))
. sortBy (compare`on`(fst.snd))
. zip [1..]
. sortBy (f`on`snd)
. zip [1..]
$ xs
| 206
| false
| false
| 0
| 14
| 94
| 101
| 56
| 45
| null | null |
brodyberg/Notes
|
ProjectRosalind.hsproj/LearnHaskell/lib/HaskellBook/GuardDuty.hs
|
mit
|
numbers :: (Ord a, Num a, Num b) => a -> b
numbers x
| x < 0 = -1
| x == 0 = 0
| x > 0 = 1
| 99
|
numbers :: (Ord a, Num a, Num b) => a -> b
numbers x
| x < 0 = -1
| x == 0 = 0
| x > 0 = 1
| 99
|
numbers x
| x < 0 = -1
| x == 0 = 0
| x > 0 = 1
| 56
| false
| true
| 0
| 8
| 40
| 87
| 40
| 47
| null | null |
sdiehl/ghc
|
compiler/simplCore/SimplEnv.hs
|
bsd-3-clause
|
mkContEx :: SimplEnv -> InExpr -> SimplSR
mkContEx (SimplEnv { seTvSubst = tvs, seCvSubst = cvs, seIdSubst = ids }) e = ContEx tvs cvs ids e
| 140
|
mkContEx :: SimplEnv -> InExpr -> SimplSR
mkContEx (SimplEnv { seTvSubst = tvs, seCvSubst = cvs, seIdSubst = ids }) e = ContEx tvs cvs ids e
| 140
|
mkContEx (SimplEnv { seTvSubst = tvs, seCvSubst = cvs, seIdSubst = ids }) e = ContEx tvs cvs ids e
| 98
| false
| true
| 0
| 9
| 26
| 57
| 31
| 26
| null | null |
phischu/fragnix
|
builtins/integer-gmp/GHC.Integer.Type.hs
|
bsd-3-clause
|
(>>) :: S s a -> S s b -> S s b
(>>) m k = \s -> case m s of (# s', _ #) -> k s'
| 82
|
(>>) :: S s a -> S s b -> S s b
(>>) m k = \s -> case m s of (# s', _ #) -> k s'
| 82
|
(>>) m k = \s -> case m s of (# s', _ #) -> k s'
| 50
| false
| true
| 0
| 9
| 31
| 73
| 36
| 37
| null | null |
svalaskevicius/hob
|
src/lib/Hob/Command/FocusCommandEntry.hs
|
gpl-3.0
|
toggleFocusOnCommandEntryCommandHandler :: CommandHandler
toggleFocusOnCommandEntryCommandHandler = CommandHandler Nothing toggleFocusOnCommandEntry
| 148
|
toggleFocusOnCommandEntryCommandHandler :: CommandHandler
toggleFocusOnCommandEntryCommandHandler = CommandHandler Nothing toggleFocusOnCommandEntry
| 148
|
toggleFocusOnCommandEntryCommandHandler = CommandHandler Nothing toggleFocusOnCommandEntry
| 90
| false
| true
| 0
| 5
| 7
| 16
| 8
| 8
| null | null |
prb/perpubplat
|
src/Blog/Widgets/StreamOfConsciousness/GoogleReader.hs
|
bsd-3-clause
|
fromAtomEntry :: TXL.Element -> Thought
fromAtomEntry e = Thought GoogleReader (textOf atom_updated e) (relAlternateLink e)
(textOf atom_title e) (annotation e)
| 178
|
fromAtomEntry :: TXL.Element -> Thought
fromAtomEntry e = Thought GoogleReader (textOf atom_updated e) (relAlternateLink e)
(textOf atom_title e) (annotation e)
| 178
|
fromAtomEntry e = Thought GoogleReader (textOf atom_updated e) (relAlternateLink e)
(textOf atom_title e) (annotation e)
| 138
| false
| true
| 0
| 7
| 37
| 67
| 30
| 37
| null | null |
phadej/stack
|
src/Options/Applicative/Complicated.hs
|
bsd-3-clause
|
helpOption :: Parser (a -> a)
helpOption =
abortOption ShowHelpText $
long "help" <>
help "Show this help text"
| 123
|
helpOption :: Parser (a -> a)
helpOption =
abortOption ShowHelpText $
long "help" <>
help "Show this help text"
| 123
|
helpOption =
abortOption ShowHelpText $
long "help" <>
help "Show this help text"
| 93
| false
| true
| 0
| 7
| 30
| 38
| 18
| 20
| null | null |
brendanhay/gogol
|
gogol-firebasehosting/gen/Network/Google/Resource/FirebaseHosting/Sites/Versions/Files/List.hs
|
mpl-2.0
|
-- | JSONP
svflCallback :: Lens' SitesVersionsFilesList (Maybe Text)
svflCallback
= lens _svflCallback (\ s a -> s{_svflCallback = a})
| 136
|
svflCallback :: Lens' SitesVersionsFilesList (Maybe Text)
svflCallback
= lens _svflCallback (\ s a -> s{_svflCallback = a})
| 125
|
svflCallback
= lens _svflCallback (\ s a -> s{_svflCallback = a})
| 67
| true
| true
| 1
| 9
| 21
| 52
| 25
| 27
| null | null |
matthewscottgordon/funk
|
test/Test/Scope.hs
|
apache-2.0
|
findItemInInnerScope :: Test
findItemInInnerScope = testCase "Find item in inner scope" $
let td' = foldl' addNameToScope createGlobalScope [foo, bar]
td = foldl' addNameToScope
(createScope td' (FunctionParamRef "func"))
[baz, qux, quux]
in assertEqual
"Wrong result"
(findName td "qux")
(Just qux')
| 364
|
findItemInInnerScope :: Test
findItemInInnerScope = testCase "Find item in inner scope" $
let td' = foldl' addNameToScope createGlobalScope [foo, bar]
td = foldl' addNameToScope
(createScope td' (FunctionParamRef "func"))
[baz, qux, quux]
in assertEqual
"Wrong result"
(findName td "qux")
(Just qux')
| 364
|
findItemInInnerScope = testCase "Find item in inner scope" $
let td' = foldl' addNameToScope createGlobalScope [foo, bar]
td = foldl' addNameToScope
(createScope td' (FunctionParamRef "func"))
[baz, qux, quux]
in assertEqual
"Wrong result"
(findName td "qux")
(Just qux')
| 335
| false
| true
| 0
| 14
| 103
| 98
| 50
| 48
| null | null |
rueshyna/gogol
|
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
|
mpl-2.0
|
-- | Longitude in degrees.
gpLongitude :: Lens' GeoPoint (Maybe Double)
gpLongitude
= lens _gpLongitude (\ s a -> s{_gpLongitude = a}) .
mapping _Coerce
| 160
|
gpLongitude :: Lens' GeoPoint (Maybe Double)
gpLongitude
= lens _gpLongitude (\ s a -> s{_gpLongitude = a}) .
mapping _Coerce
| 133
|
gpLongitude
= lens _gpLongitude (\ s a -> s{_gpLongitude = a}) .
mapping _Coerce
| 88
| true
| true
| 0
| 10
| 32
| 55
| 28
| 27
| null | null |
rjregenold/morse
|
src/Morse/Commands.hs
|
mit
|
runCommand (Decode input) = putStrLn (fromMorse input)
| 54
|
runCommand (Decode input) = putStrLn (fromMorse input)
| 54
|
runCommand (Decode input) = putStrLn (fromMorse input)
| 54
| false
| false
| 0
| 7
| 6
| 24
| 11
| 13
| null | null |
vikraman/ghc
|
compiler/utils/UniqDFM.hs
|
bsd-3-clause
|
alterUDFM
:: Uniquable key
=> (Maybe elt -> Maybe elt) -- How to adjust
-> UniqDFM elt -- old
-> key -- new
-> UniqDFM elt -- result
alterUDFM f (UDFM m i) k =
UDFM (M.alter alterf (getKey $ getUnique k) m) (i + 1)
where
alterf Nothing = inject $ f Nothing
alterf (Just (TaggedVal v _)) = inject $ f (Just v)
inject Nothing = Nothing
inject (Just v) = Just $ TaggedVal v i
-- | Map a function over every value in a UniqDFM
| 496
|
alterUDFM
:: Uniquable key
=> (Maybe elt -> Maybe elt) -- How to adjust
-> UniqDFM elt -- old
-> key -- new
-> UniqDFM elt
alterUDFM f (UDFM m i) k =
UDFM (M.alter alterf (getKey $ getUnique k) m) (i + 1)
where
alterf Nothing = inject $ f Nothing
alterf (Just (TaggedVal v _)) = inject $ f (Just v)
inject Nothing = Nothing
inject (Just v) = Just $ TaggedVal v i
-- | Map a function over every value in a UniqDFM
| 472
|
alterUDFM f (UDFM m i) k =
UDFM (M.alter alterf (getKey $ getUnique k) m) (i + 1)
where
alterf Nothing = inject $ f Nothing
alterf (Just (TaggedVal v _)) = inject $ f (Just v)
inject Nothing = Nothing
inject (Just v) = Just $ TaggedVal v i
-- | Map a function over every value in a UniqDFM
| 302
| true
| true
| 6
| 12
| 162
| 202
| 93
| 109
| null | null |
katydid/haslapse
|
src/Data/Katydid/Relapse/Exprs/Var.hs
|
bsd-3-clause
|
-- |
-- isVar returns whether an expression is one of the six variable expressions.
isVar :: Desc -> Bool
isVar d = null (_params d) && case _name d of
"$bool" -> True
"$int" -> True
"$uint" -> True
"$double" -> True
"$string" -> True
"$[]byte" -> True
_ -> False
-- |
-- varBoolExpr creates a bool variable expression.
| 349
|
isVar :: Desc -> Bool
isVar d = null (_params d) && case _name d of
"$bool" -> True
"$int" -> True
"$uint" -> True
"$double" -> True
"$string" -> True
"$[]byte" -> True
_ -> False
-- |
-- varBoolExpr creates a bool variable expression.
| 265
|
isVar d = null (_params d) && case _name d of
"$bool" -> True
"$int" -> True
"$uint" -> True
"$double" -> True
"$string" -> True
"$[]byte" -> True
_ -> False
-- |
-- varBoolExpr creates a bool variable expression.
| 243
| true
| true
| 2
| 8
| 90
| 91
| 44
| 47
| null | null |
ezyang/ghc
|
testsuite/tests/codeGen/should_run/CmmSwitchTest64.hs
|
bsd-3-clause
|
as_check :: IO ()
as_check = forM_
[ (0,42)
, (1,42)
, (2,43)
, (3,43)
, (4,44)
, (5,1337)] $ \(W# i,o) -> do
let r = W# (as i)
unless (r == o) $ putStrLn $ "ERR: as (" ++ show (W# i)++ ") is " ++ show r ++ " and not " ++ show o ++"."
| 264
|
as_check :: IO ()
as_check = forM_
[ (0,42)
, (1,42)
, (2,43)
, (3,43)
, (4,44)
, (5,1337)] $ \(W# i,o) -> do
let r = W# (as i)
unless (r == o) $ putStrLn $ "ERR: as (" ++ show (W# i)++ ") is " ++ show r ++ " and not " ++ show o ++"."
| 264
|
as_check = forM_
[ (0,42)
, (1,42)
, (2,43)
, (3,43)
, (4,44)
, (5,1337)] $ \(W# i,o) -> do
let r = W# (as i)
unless (r == o) $ putStrLn $ "ERR: as (" ++ show (W# i)++ ") is " ++ show r ++ " and not " ++ show o ++"."
| 246
| false
| true
| 0
| 19
| 88
| 169
| 91
| 78
| null | null |
uuhan/Idris-dev
|
src/Idris/Core/TT.hs
|
bsd-3-clause
|
termSmallerThan x (Proj tm _) = termSmallerThan (x-1) tm
| 56
|
termSmallerThan x (Proj tm _) = termSmallerThan (x-1) tm
| 56
|
termSmallerThan x (Proj tm _) = termSmallerThan (x-1) tm
| 56
| false
| false
| 0
| 7
| 8
| 31
| 15
| 16
| null | null |
mo-gr/parskip
|
src/Parskip.hs
|
bsd-3-clause
|
sqParser :: Parser Argument
sqParser = quoteParser '\'' Textual
| 63
|
sqParser :: Parser Argument
sqParser = quoteParser '\'' Textual
| 63
|
sqParser = quoteParser '\'' Textual
| 35
| false
| true
| 0
| 6
| 8
| 25
| 10
| 15
| null | null |
pgj/bead
|
src/Bead/View/RequestParams.hs
|
bsd-3-clause
|
-- Produces a string representing the key value pair
-- E.g: ReqParam ("name", "rika") = "name=rika"
queryStringParam :: ReqParam -> String
queryStringParam (ReqParam (k,v)) = join [k, "=", v]
| 192
|
queryStringParam :: ReqParam -> String
queryStringParam (ReqParam (k,v)) = join [k, "=", v]
| 91
|
queryStringParam (ReqParam (k,v)) = join [k, "=", v]
| 52
| true
| true
| 0
| 8
| 28
| 44
| 25
| 19
| null | null |
ekmett/doctest
|
test/ParseSpec.hs
|
mit
|
group :: Writer [DocTest] () -> Writer [[DocTest]] ()
group g = tell [execWriter g]
| 83
|
group :: Writer [DocTest] () -> Writer [[DocTest]] ()
group g = tell [execWriter g]
| 83
|
group g = tell [execWriter g]
| 29
| false
| true
| 0
| 9
| 14
| 55
| 26
| 29
| null | null |
shlevy/ghc
|
compiler/nativeGen/X86/CodeGen.hs
|
bsd-3-clause
|
assignReg_IntCode pk reg (CmmLoad src _) = do
load_code <- intLoadCode (MOV pk) src
dflags <- getDynFlags
let platform = targetPlatform dflags
return (load_code (getRegisterReg platform False{-no sse2-} reg))
-- dst is a reg, but src could be anything
| 260
|
assignReg_IntCode pk reg (CmmLoad src _) = do
load_code <- intLoadCode (MOV pk) src
dflags <- getDynFlags
let platform = targetPlatform dflags
return (load_code (getRegisterReg platform False{-no sse2-} reg))
-- dst is a reg, but src could be anything
| 260
|
assignReg_IntCode pk reg (CmmLoad src _) = do
load_code <- intLoadCode (MOV pk) src
dflags <- getDynFlags
let platform = targetPlatform dflags
return (load_code (getRegisterReg platform False{-no sse2-} reg))
-- dst is a reg, but src could be anything
| 260
| false
| false
| 0
| 11
| 47
| 85
| 38
| 47
| null | null |
jaiyalas/haha
|
src/ParametricLambda.hs
|
mit
|
cutLength n xs | n < length xs = (take n xs)
++ "\n"
++ cutLength n (drop n xs)
| 88
|
cutLength n xs | n < length xs = (take n xs)
++ "\n"
++ cutLength n (drop n xs)
| 88
|
cutLength n xs | n < length xs = (take n xs)
++ "\n"
++ cutLength n (drop n xs)
| 88
| false
| false
| 4
| 9
| 28
| 55
| 24
| 31
| null | null |
phischu/fragnix
|
tests/packages/scotty/Data.IntMap.Internal.hs
|
bsd-3-clause
|
-- | /O(n+m)/. The intersection with a combining function.
--
-- > let f k al ar = (show k) ++ ":" ++ al ++ "|" ++ ar
-- > intersectionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "5:a|A"
intersectionWithKey :: (Key -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
intersectionWithKey f m1 m2
= mergeWithKey' bin (\(Tip k1 x1) (Tip _k2 x2) -> Tip k1 (f k1 x1 x2)) (const Nil) (const Nil) m1 m2
| 443
|
intersectionWithKey :: (Key -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
intersectionWithKey f m1 m2
= mergeWithKey' bin (\(Tip k1 x1) (Tip _k2 x2) -> Tip k1 (f k1 x1 x2)) (const Nil) (const Nil) m1 m2
| 210
|
intersectionWithKey f m1 m2
= mergeWithKey' bin (\(Tip k1 x1) (Tip _k2 x2) -> Tip k1 (f k1 x1 x2)) (const Nil) (const Nil) m1 m2
| 130
| true
| true
| 0
| 10
| 92
| 124
| 63
| 61
| null | null |
ben-schulz/Idris-dev
|
src/Idris/Elab/Quasiquote.hs
|
bsd-3-clause
|
extractDoUnquotes :: Int -> PDo -> Elab' aux (PDo, [(Name, PTerm)])
extractDoUnquotes d (DoExp fc tm)
= do (tm', ex) <- extractUnquotes d tm
return (DoExp fc tm', ex)
| 175
|
extractDoUnquotes :: Int -> PDo -> Elab' aux (PDo, [(Name, PTerm)])
extractDoUnquotes d (DoExp fc tm)
= do (tm', ex) <- extractUnquotes d tm
return (DoExp fc tm', ex)
| 175
|
extractDoUnquotes d (DoExp fc tm)
= do (tm', ex) <- extractUnquotes d tm
return (DoExp fc tm', ex)
| 107
| false
| true
| 0
| 10
| 37
| 87
| 45
| 42
| null | null |
kairuku/stack
|
src/Stack/Types/Config.hs
|
bsd-3-clause
|
compilerVersionDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Rel Dir)
compilerVersionDir = do
compilerVersion <- asks (envConfigCompilerVersion . getEnvConfig)
parseRelDir $ case compilerVersion of
GhcVersion version -> versionString version
GhcjsVersion {} -> T.unpack (compilerVersionName compilerVersion)
-- | Package database for installing dependencies into
| 411
|
compilerVersionDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Rel Dir)
compilerVersionDir = do
compilerVersion <- asks (envConfigCompilerVersion . getEnvConfig)
parseRelDir $ case compilerVersion of
GhcVersion version -> versionString version
GhcjsVersion {} -> T.unpack (compilerVersionName compilerVersion)
-- | Package database for installing dependencies into
| 411
|
compilerVersionDir = do
compilerVersion <- asks (envConfigCompilerVersion . getEnvConfig)
parseRelDir $ case compilerVersion of
GhcVersion version -> versionString version
GhcjsVersion {} -> T.unpack (compilerVersionName compilerVersion)
-- | Package database for installing dependencies into
| 317
| false
| true
| 0
| 14
| 71
| 113
| 53
| 60
| null | null |
antalsz/hs-to-coq
|
examples/coinduction/Memo.hs
|
mit
|
lookupTrie :: NatTrie a -> Natural -> a
lookupTrie (TrieNode here div2 minus1div2) n
| n == 0 = here
| odd n = lookupTrie minus1div2 (n `div` 2)
| otherwise = lookupTrie div2 (n `div` 2)
| 205
|
lookupTrie :: NatTrie a -> Natural -> a
lookupTrie (TrieNode here div2 minus1div2) n
| n == 0 = here
| odd n = lookupTrie minus1div2 (n `div` 2)
| otherwise = lookupTrie div2 (n `div` 2)
| 205
|
lookupTrie (TrieNode here div2 minus1div2) n
| n == 0 = here
| odd n = lookupTrie minus1div2 (n `div` 2)
| otherwise = lookupTrie div2 (n `div` 2)
| 165
| false
| true
| 0
| 10
| 55
| 105
| 50
| 55
| null | null |
termite2/tsl
|
Abstract/BFormula.hs
|
bsd-3-clause
|
fVar (FEq v1 v2) = avarVar v1 ++ avarVar v2
| 48
|
fVar (FEq v1 v2) = avarVar v1 ++ avarVar v2
| 48
|
fVar (FEq v1 v2) = avarVar v1 ++ avarVar v2
| 48
| false
| false
| 0
| 6
| 14
| 28
| 12
| 16
| null | null |
adamse/haddock
|
haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
|
bsd-2-clause
|
ppr_mono_ty _ (HsQuasiQuoteTy {}) _ _ = error "ppr_mono_ty HsQuasiQuoteTy"
| 82
|
ppr_mono_ty _ (HsQuasiQuoteTy {}) _ _ = error "ppr_mono_ty HsQuasiQuoteTy"
| 82
|
ppr_mono_ty _ (HsQuasiQuoteTy {}) _ _ = error "ppr_mono_ty HsQuasiQuoteTy"
| 82
| false
| false
| 1
| 6
| 17
| 25
| 11
| 14
| null | null |
muspellsson/hiccup
|
TclErr.hs
|
lgpl-2.1
|
fromCode ec = Err (fromEnum ec) Nothing
| 39
|
fromCode ec = Err (fromEnum ec) Nothing
| 39
|
fromCode ec = Err (fromEnum ec) Nothing
| 39
| false
| false
| 0
| 7
| 6
| 20
| 9
| 11
| null | null |
ezyang/ghc
|
compiler/utils/Pretty.hs
|
bsd-3-clause
|
mkNest 0 p = p
| 30
|
mkNest 0 p = p
| 30
|
mkNest 0 p = p
| 30
| false
| false
| 0
| 5
| 20
| 11
| 5
| 6
| null | null |
thoughtpolice/cabal
|
Cabal/Distribution/Version.hs
|
bsd-3-clause
|
thisVersion :: Version -> VersionRange
thisVersion = ThisVersion
| 64
|
thisVersion :: Version -> VersionRange
thisVersion = ThisVersion
| 64
|
thisVersion = ThisVersion
| 25
| false
| true
| 0
| 5
| 7
| 15
| 8
| 7
| null | null |
adnelson/nix-binary-cache
|
src/Nix/NarInfo.hs
|
mit
|
-- | Convert a compression type string.
parseCompressionType :: Text -> Either String NarCompressionType
parseCompressionType = \case
"xz" -> return NarXzip
"xzip" -> return NarXzip
"bz2" -> return NarBzip2
"bzip2" -> return NarBzip2
ctype -> Left (show ctype <> " is not a known compression type.")
-- | Request for a nix archive.
-- The first argument is some sort of key that the server provides (as
-- a response to the .narinfo route) for how to fetch the package. The
-- second argument is the compression type.
| 528
|
parseCompressionType :: Text -> Either String NarCompressionType
parseCompressionType = \case
"xz" -> return NarXzip
"xzip" -> return NarXzip
"bz2" -> return NarBzip2
"bzip2" -> return NarBzip2
ctype -> Left (show ctype <> " is not a known compression type.")
-- | Request for a nix archive.
-- The first argument is some sort of key that the server provides (as
-- a response to the .narinfo route) for how to fetch the package. The
-- second argument is the compression type.
| 488
|
parseCompressionType = \case
"xz" -> return NarXzip
"xzip" -> return NarXzip
"bz2" -> return NarBzip2
"bzip2" -> return NarBzip2
ctype -> Left (show ctype <> " is not a known compression type.")
-- | Request for a nix archive.
-- The first argument is some sort of key that the server provides (as
-- a response to the .narinfo route) for how to fetch the package. The
-- second argument is the compression type.
| 423
| true
| true
| 5
| 8
| 98
| 86
| 41
| 45
| null | null |
bkoropoff/Idris-dev
|
src/Idris/IdrisDoc.hs
|
bsd-3-clause
|
getNs _ = []
| 20
|
getNs _ = []
| 20
|
getNs _ = []
| 20
| false
| false
| 0
| 5
| 11
| 11
| 5
| 6
| null | null |
nikai3d/ce-challenges
|
easy/delta_time.hs
|
bsd-3-clause
|
nice :: Integer -> String
nice i = intercalate ":" $ map fmt0 t
where t = div i 3600 : mod (div i 60) 60 : [mod i 60]
| 125
|
nice :: Integer -> String
nice i = intercalate ":" $ map fmt0 t
where t = div i 3600 : mod (div i 60) 60 : [mod i 60]
| 125
|
nice i = intercalate ":" $ map fmt0 t
where t = div i 3600 : mod (div i 60) 60 : [mod i 60]
| 98
| false
| true
| 0
| 11
| 37
| 71
| 34
| 37
| null | null |
ezyang/ghc
|
compiler/hsSyn/HsPat.hs
|
bsd-3-clause
|
-- Probably won't typecheck at once, things have changed :/
hsRecFieldsArgs :: HsRecFields p arg -> [arg]
hsRecFieldsArgs rbinds = map (hsRecFieldArg . unLoc) (rec_flds rbinds)
| 176
|
hsRecFieldsArgs :: HsRecFields p arg -> [arg]
hsRecFieldsArgs rbinds = map (hsRecFieldArg . unLoc) (rec_flds rbinds)
| 116
|
hsRecFieldsArgs rbinds = map (hsRecFieldArg . unLoc) (rec_flds rbinds)
| 70
| true
| true
| 0
| 7
| 25
| 45
| 23
| 22
| null | null |
SPbAU-ProgrammingParadigms/materials
|
haskell_2/Bookstore.hs
|
unlicense
|
bookTitle (Book _ title _ ) = title
| 44
|
bookTitle (Book _ title _ ) = title
| 44
|
bookTitle (Book _ title _ ) = title
| 44
| false
| false
| 0
| 7
| 16
| 19
| 9
| 10
| null | null |
gbwey/persistentold
|
persistent-postgresql/Database/Persist/Postgresql.hs
|
mit
|
showSqlType SqlTime = "TIME"
| 28
|
showSqlType SqlTime = "TIME"
| 28
|
showSqlType SqlTime = "TIME"
| 28
| false
| false
| 1
| 5
| 3
| 13
| 4
| 9
| null | null |
tomberek/rulestesting
|
src/Control/Arrow/CCA/AExp.hs
|
bsd-3-clause
|
eqM (ArrM f) (ArrM g) = areExpAEq' f g
| 38
|
eqM (ArrM f) (ArrM g) = areExpAEq' f g
| 38
|
eqM (ArrM f) (ArrM g) = areExpAEq' f g
| 38
| false
| false
| 1
| 7
| 8
| 30
| 13
| 17
| null | null |
brendanhay/gogol
|
gogol-logging/gen/Network/Google/Resource/Logging/Organizations/Locations/Buckets/List.hs
|
mpl-2.0
|
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
olblUploadType :: Lens' OrganizationsLocationsBucketsList (Maybe Text)
olblUploadType
= lens _olblUploadType
(\ s a -> s{_olblUploadType = a})
| 221
|
olblUploadType :: Lens' OrganizationsLocationsBucketsList (Maybe Text)
olblUploadType
= lens _olblUploadType
(\ s a -> s{_olblUploadType = a})
| 150
|
olblUploadType
= lens _olblUploadType
(\ s a -> s{_olblUploadType = a})
| 79
| true
| true
| 1
| 9
| 34
| 52
| 25
| 27
| null | null |
rpglover64/lens
|
src/Language/Haskell/TH/Lens.hs
|
bsd-3-clause
|
-- Lenses and Prisms
locFileName :: Lens' Loc String
locFileName = lens loc_filename
$ \loc fn -> loc { loc_filename = fn }
| 135
|
locFileName :: Lens' Loc String
locFileName = lens loc_filename
$ \loc fn -> loc { loc_filename = fn }
| 114
|
locFileName = lens loc_filename
$ \loc fn -> loc { loc_filename = fn }
| 82
| true
| true
| 0
| 8
| 34
| 39
| 21
| 18
| null | null |
shimmercat/second-transfer
|
hs-src/SecondTransfer/IOCallbacks/Throtler.hs
|
bsd-3-clause
|
secondsDiff :: TimeSpec -> TimeSpec -> Double
secondsDiff t2 t1 =
( fromIntegral (toNanoSecs $ t2 - t1) ) * 1.0e-9
| 118
|
secondsDiff :: TimeSpec -> TimeSpec -> Double
secondsDiff t2 t1 =
( fromIntegral (toNanoSecs $ t2 - t1) ) * 1.0e-9
| 118
|
secondsDiff t2 t1 =
( fromIntegral (toNanoSecs $ t2 - t1) ) * 1.0e-9
| 72
| false
| true
| 0
| 10
| 24
| 45
| 23
| 22
| null | null |
shlevy/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
quotRemIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger") quotRemIntegerIdKey
| 96
|
quotRemIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger") quotRemIntegerIdKey
| 96
|
quotRemIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger") quotRemIntegerIdKey
| 96
| false
| false
| 0
| 7
| 12
| 19
| 9
| 10
| null | null |
innovimax/bond
|
compiler/Options.hs
|
mit
|
mode :: Mode (CmdArgs Options)
mode = cmdArgsMode $ modes [cpp, cs, schema] &=
program "gbc" &=
help "Compile Bond schema file(s) and generate specified output. The schema file(s) can be in one of two formats: Bond IDL or JSON representation of the schema abstract syntax tree as produced by `gbc schema`" &=
summary ("Bond Compiler " ++ majorVersion ++ "." ++ minorVersion ++ ", (C) Microsoft")
| 407
|
mode :: Mode (CmdArgs Options)
mode = cmdArgsMode $ modes [cpp, cs, schema] &=
program "gbc" &=
help "Compile Bond schema file(s) and generate specified output. The schema file(s) can be in one of two formats: Bond IDL or JSON representation of the schema abstract syntax tree as produced by `gbc schema`" &=
summary ("Bond Compiler " ++ majorVersion ++ "." ++ minorVersion ++ ", (C) Microsoft")
| 407
|
mode = cmdArgsMode $ modes [cpp, cs, schema] &=
program "gbc" &=
help "Compile Bond schema file(s) and generate specified output. The schema file(s) can be in one of two formats: Bond IDL or JSON representation of the schema abstract syntax tree as produced by `gbc schema`" &=
summary ("Bond Compiler " ++ majorVersion ++ "." ++ minorVersion ++ ", (C) Microsoft")
| 376
| false
| true
| 6
| 10
| 78
| 86
| 39
| 47
| null | null |
olsner/ghc
|
compiler/main/HscTypes.hs
|
bsd-3-clause
|
msHiFilePath ms = ml_hi_file (ms_location ms)
| 47
|
msHiFilePath ms = ml_hi_file (ms_location ms)
| 47
|
msHiFilePath ms = ml_hi_file (ms_location ms)
| 47
| false
| false
| 1
| 7
| 7
| 21
| 8
| 13
| null | null |
yjwen/hada
|
src/TextExpr.hs
|
lgpl-3.0
|
apply (BinaryOperator o i ops) e = BinaryOperator o i (app e ops)
where app e ZeroOp = OneOp e
app e (OneOp e0) = TwoOps e0 e
app e (TwoOps _ _) = error ("3 operands applied to operator " ++ o)
| 211
|
apply (BinaryOperator o i ops) e = BinaryOperator o i (app e ops)
where app e ZeroOp = OneOp e
app e (OneOp e0) = TwoOps e0 e
app e (TwoOps _ _) = error ("3 operands applied to operator " ++ o)
| 211
|
apply (BinaryOperator o i ops) e = BinaryOperator o i (app e ops)
where app e ZeroOp = OneOp e
app e (OneOp e0) = TwoOps e0 e
app e (TwoOps _ _) = error ("3 operands applied to operator " ++ o)
| 211
| false
| false
| 2
| 7
| 60
| 98
| 48
| 50
| null | null |
mainland/nikola
|
src/Data/Vector/CUDA/UnboxedForeign/Mutable.hs
|
bsd-3-clause
|
copy = G.copy
| 13
|
copy = G.copy
| 13
|
copy = G.copy
| 13
| false
| false
| 1
| 6
| 2
| 12
| 4
| 8
| null | null |
lukexi/ghc-7.8-arm64
|
compiler/main/StaticFlags.hs
|
bsd-3-clause
|
opt_NoStateHack :: Bool
opt_NoStateHack = lookUp (fsLit "-fno-state-hack")
| 81
|
opt_NoStateHack :: Bool
opt_NoStateHack = lookUp (fsLit "-fno-state-hack")
| 81
|
opt_NoStateHack = lookUp (fsLit "-fno-state-hack")
| 54
| false
| true
| 0
| 7
| 14
| 20
| 10
| 10
| null | null |
gimbo/docidx.hs
|
src/Distribution/GhcPkgList.hs
|
bsd-3-clause
|
addToVersionMap :: Eq a => VersionMap a -> Version -> VersionInfo a ->
VersionMap a
addToVersionMap vm v vi = addToAL vm v xs'
where xs' = case v `lookup` vm of
-- No duplicates please.
Just xs -> if vi `elem` xs then xs else xs ++ [vi]
Nothing -> [vi]
-- Checking existence of Haddock docs, and reading synopses from them.
-- | Given a PackageMap over paths to Haddock directories, turn it
-- into one over HaddockInfo values (checking if the Haddocks exist
-- and are readable, and if so, extracting the package synopsis from
-- each).
| 608
|
addToVersionMap :: Eq a => VersionMap a -> Version -> VersionInfo a ->
VersionMap a
addToVersionMap vm v vi = addToAL vm v xs'
where xs' = case v `lookup` vm of
-- No duplicates please.
Just xs -> if vi `elem` xs then xs else xs ++ [vi]
Nothing -> [vi]
-- Checking existence of Haddock docs, and reading synopses from them.
-- | Given a PackageMap over paths to Haddock directories, turn it
-- into one over HaddockInfo values (checking if the Haddocks exist
-- and are readable, and if so, extracting the package synopsis from
-- each).
| 608
|
addToVersionMap vm v vi = addToAL vm v xs'
where xs' = case v `lookup` vm of
-- No duplicates please.
Just xs -> if vi `elem` xs then xs else xs ++ [vi]
Nothing -> [vi]
-- Checking existence of Haddock docs, and reading synopses from them.
-- | Given a PackageMap over paths to Haddock directories, turn it
-- into one over HaddockInfo values (checking if the Haddocks exist
-- and are readable, and if so, extracting the package synopsis from
-- each).
| 505
| false
| true
| 1
| 10
| 170
| 126
| 63
| 63
| null | null |
geekingfrog/project-euler
|
Problem026.hs
|
gpl-3.0
|
concatTail :: [a] -> [(a, [a])]
concatTail [] = []
| 50
|
concatTail :: [a] -> [(a, [a])]
concatTail [] = []
| 50
|
concatTail [] = []
| 18
| false
| true
| 0
| 10
| 9
| 43
| 22
| 21
| null | null |
erantapaa/simple-hunt
|
src/ProcessLine.hs
|
bsd-3-clause
|
typeUri name = "#t:" ++ toUri name
| 34
|
typeUri name = "#t:" ++ toUri name
| 34
|
typeUri name = "#t:" ++ toUri name
| 34
| false
| false
| 0
| 6
| 6
| 16
| 7
| 9
| null | null |
amccausl/RDF4H
|
src/Data/RDF/Namespace.hs
|
bsd-3-clause
|
-- |Example namespace #2.
ex2 :: Namespace
ex2 = mkPrefixedNS' "ex2" "http://www2.example.org/"
| 103
|
ex2 :: Namespace
ex2 = mkPrefixedNS' "ex2" "http://www2.example.org/"
| 77
|
ex2 = mkPrefixedNS' "ex2" "http://www2.example.org/"
| 59
| true
| true
| 0
| 5
| 19
| 17
| 9
| 8
| null | null |
enolive/exercism
|
haskell/list-ops/src/ListOps.hs
|
mit
|
map f (x:xs) = f x : map f xs
| 29
|
map f (x:xs) = f x : map f xs
| 29
|
map f (x:xs) = f x : map f xs
| 29
| false
| false
| 0
| 7
| 9
| 31
| 14
| 17
| null | null |
awto/pretty-template
|
src/Text/PrettyTemplate/Printer.hs
|
bsd-3-clause
|
docArr :: Arr -> D Doc
docArr (A p a o) = local (curPos .~ p) $ return . applyOpts o =<< case a of
Var v t e -> docT =<< getVar v
where
docC vv = case vv of
String vt -> return . vcat . map text
. LT.lines . LT.fromStrict $ vt
Number s -> return $ text (LT.pack (show s))
_ -> do
warnS "not a string value (using plain JSON instead)"
return $ text $ LT.toLazyTextWith 1000
$ encodeToTextBuilder vv
docT vv = maybe (docC vv) (newv vv) t
Template p t -> local (ocol .~ fromEnum (P.column p)) $ docTemplate t
List lopts t s e -> do
vv <- headVal
case vv of
Array av | V.null av -> maybe (return empty) docArr e
Array av -> do
e' <- mapM (flip newv t) (V.toList av)
e'' <- case s of
Nothing -> return e'
Just st -> do
st' <- docArr st
return $ punctuate st' e'
return $ case lopts of
LNone -> hcat e''
LHSep -> hsep e''
LVSep -> vsep e''
LFillSep -> fillSep e''
LSep -> sep e''
LHCat -> hcat e''
LVCat -> vcat e''
LFillCat -> fillCat e''
LCat -> cat e''
_ -> errS "not a list"
Case f d -> do
h <- headVal
case h of
Object obj -> docArr =<< lu "no such case option: " d
=<< val
=<< lu "no such object's field: " obj f
_ -> errS "not an object in switch"
Mod m -> return $ case m of
SoftLine -> softline
Line -> line
SBreak -> softbreak
LBreak -> linebreak
_ -> errS "not implemented"
where
newv vv = local (\x -> x{_stack = vv : _stack x}) . docArr
| 2,165
|
docArr :: Arr -> D Doc
docArr (A p a o) = local (curPos .~ p) $ return . applyOpts o =<< case a of
Var v t e -> docT =<< getVar v
where
docC vv = case vv of
String vt -> return . vcat . map text
. LT.lines . LT.fromStrict $ vt
Number s -> return $ text (LT.pack (show s))
_ -> do
warnS "not a string value (using plain JSON instead)"
return $ text $ LT.toLazyTextWith 1000
$ encodeToTextBuilder vv
docT vv = maybe (docC vv) (newv vv) t
Template p t -> local (ocol .~ fromEnum (P.column p)) $ docTemplate t
List lopts t s e -> do
vv <- headVal
case vv of
Array av | V.null av -> maybe (return empty) docArr e
Array av -> do
e' <- mapM (flip newv t) (V.toList av)
e'' <- case s of
Nothing -> return e'
Just st -> do
st' <- docArr st
return $ punctuate st' e'
return $ case lopts of
LNone -> hcat e''
LHSep -> hsep e''
LVSep -> vsep e''
LFillSep -> fillSep e''
LSep -> sep e''
LHCat -> hcat e''
LVCat -> vcat e''
LFillCat -> fillCat e''
LCat -> cat e''
_ -> errS "not a list"
Case f d -> do
h <- headVal
case h of
Object obj -> docArr =<< lu "no such case option: " d
=<< val
=<< lu "no such object's field: " obj f
_ -> errS "not an object in switch"
Mod m -> return $ case m of
SoftLine -> softline
Line -> line
SBreak -> softbreak
LBreak -> linebreak
_ -> errS "not implemented"
where
newv vv = local (\x -> x{_stack = vv : _stack x}) . docArr
| 2,165
|
docArr (A p a o) = local (curPos .~ p) $ return . applyOpts o =<< case a of
Var v t e -> docT =<< getVar v
where
docC vv = case vv of
String vt -> return . vcat . map text
. LT.lines . LT.fromStrict $ vt
Number s -> return $ text (LT.pack (show s))
_ -> do
warnS "not a string value (using plain JSON instead)"
return $ text $ LT.toLazyTextWith 1000
$ encodeToTextBuilder vv
docT vv = maybe (docC vv) (newv vv) t
Template p t -> local (ocol .~ fromEnum (P.column p)) $ docTemplate t
List lopts t s e -> do
vv <- headVal
case vv of
Array av | V.null av -> maybe (return empty) docArr e
Array av -> do
e' <- mapM (flip newv t) (V.toList av)
e'' <- case s of
Nothing -> return e'
Just st -> do
st' <- docArr st
return $ punctuate st' e'
return $ case lopts of
LNone -> hcat e''
LHSep -> hsep e''
LVSep -> vsep e''
LFillSep -> fillSep e''
LSep -> sep e''
LHCat -> hcat e''
LVCat -> vcat e''
LFillCat -> fillCat e''
LCat -> cat e''
_ -> errS "not a list"
Case f d -> do
h <- headVal
case h of
Object obj -> docArr =<< lu "no such case option: " d
=<< val
=<< lu "no such object's field: " obj f
_ -> errS "not an object in switch"
Mod m -> return $ case m of
SoftLine -> softline
Line -> line
SBreak -> softbreak
LBreak -> linebreak
_ -> errS "not implemented"
where
newv vv = local (\x -> x{_stack = vv : _stack x}) . docArr
| 2,142
| false
| true
| 18
| 19
| 1,116
| 684
| 302
| 382
| null | null |
brendanhay/gogol
|
gogol-iam/gen/Network/Google/Resource/IAM/Projects/Locations/WorkLoadIdentityPools/Operations/Get.hs
|
mpl-2.0
|
-- | JSONP
plwlipogCallback :: Lens' ProjectsLocationsWorkLoadIdentityPoolsOperationsGet (Maybe Text)
plwlipogCallback
= lens _plwlipogCallback
(\ s a -> s{_plwlipogCallback = a})
| 187
|
plwlipogCallback :: Lens' ProjectsLocationsWorkLoadIdentityPoolsOperationsGet (Maybe Text)
plwlipogCallback
= lens _plwlipogCallback
(\ s a -> s{_plwlipogCallback = a})
| 176
|
plwlipogCallback
= lens _plwlipogCallback
(\ s a -> s{_plwlipogCallback = a})
| 85
| true
| true
| 0
| 9
| 27
| 48
| 25
| 23
| null | null |
synsem/texhs
|
src/Text/TeX/Parser/Basic.hs
|
gpl-3.0
|
-- | Parse an environment.
env :: TeXParser TeXAtom
env = do
name <- envName
args <- maybe parseUnknownArgSpec parseArgSpec (M.lookup name envDB)
body <- envInner name
return (Group name args body)
-- Parse the body of an environment.
| 243
|
env :: TeXParser TeXAtom
env = do
name <- envName
args <- maybe parseUnknownArgSpec parseArgSpec (M.lookup name envDB)
body <- envInner name
return (Group name args body)
-- Parse the body of an environment.
| 216
|
env = do
name <- envName
args <- maybe parseUnknownArgSpec parseArgSpec (M.lookup name envDB)
body <- envInner name
return (Group name args body)
-- Parse the body of an environment.
| 191
| true
| true
| 0
| 11
| 47
| 73
| 34
| 39
| null | null |
tismith/tlisp
|
src/Parse.hs
|
mit
|
parseExpr :: Parser LispVal
parseExpr = parseString
<|> parseComplex
<|> parseRatio
<|> parseFloat
<|> parseSignedNumber
<|> parseUnsignedNumber
<|> parseBool
<|> parseChar
<|> parseAtom
<|> parseQuoted
<|> parseQuasiQuoted
<|> parseUnquoted
<|> parseVector
<|> parseBracketedParser parseList
<|> parseBracketedParser parseDottedList
| 389
|
parseExpr :: Parser LispVal
parseExpr = parseString
<|> parseComplex
<|> parseRatio
<|> parseFloat
<|> parseSignedNumber
<|> parseUnsignedNumber
<|> parseBool
<|> parseChar
<|> parseAtom
<|> parseQuoted
<|> parseQuasiQuoted
<|> parseUnquoted
<|> parseVector
<|> parseBracketedParser parseList
<|> parseBracketedParser parseDottedList
| 389
|
parseExpr = parseString
<|> parseComplex
<|> parseRatio
<|> parseFloat
<|> parseSignedNumber
<|> parseUnsignedNumber
<|> parseBool
<|> parseChar
<|> parseAtom
<|> parseQuoted
<|> parseQuasiQuoted
<|> parseUnquoted
<|> parseVector
<|> parseBracketedParser parseList
<|> parseBracketedParser parseDottedList
| 361
| false
| true
| 42
| 5
| 92
| 118
| 65
| 53
| null | null |
myfreeweb/sweetroll
|
sweetroll-be/library/Sweetroll/Auth.hs
|
unlicense
|
errWrongAuthScope ∷ ServantErr
errWrongAuthScope = errText err401 "Your access token is not authorized for this action."
| 120
|
errWrongAuthScope ∷ ServantErr
errWrongAuthScope = errText err401 "Your access token is not authorized for this action."
| 120
|
errWrongAuthScope = errText err401 "Your access token is not authorized for this action."
| 89
| false
| true
| 0
| 6
| 15
| 22
| 9
| 13
| null | null |
txkaduo/hs-vdian-sdk
|
VDian/Order.hs
|
bsd-3-clause
|
fromOrderStatusStr "finish" = Just OrderStatusFinish
| 62
|
fromOrderStatusStr "finish" = Just OrderStatusFinish
| 62
|
fromOrderStatusStr "finish" = Just OrderStatusFinish
| 62
| false
| false
| 0
| 5
| 14
| 12
| 5
| 7
| null | null |
iteloo/tsuru-sample
|
iteratee-0.8.9.6/src/Data/Iteratee/IO/Handle.hs
|
bsd-3-clause
|
-- |The enumerator of a Handle: a variation of enumHandle that
-- supports RandomIO (seek requests).
-- Data is read into a buffer of the specified size.
enumHandleRandom ::
forall s el m a.(NullPoint s, ReadableChunk s el, MonadIO m, MonadMask m) =>
Int -- ^ Buffer size (number of elements per read)
-> Handle
-> Enumerator s m a
enumHandleRandom bs h i = enumHandleCatch bs h handler i
where
handler (SeekException off) =
liftM (either
(Just . EnumException :: IOException -> Maybe EnumException)
(const Nothing))
. liftIO . CIO.try $ hSeek h AbsoluteSeek $ fromIntegral off
-- ----------------------------------------------
-- File Driver wrapper functions.
| 723
|
enumHandleRandom ::
forall s el m a.(NullPoint s, ReadableChunk s el, MonadIO m, MonadMask m) =>
Int -- ^ Buffer size (number of elements per read)
-> Handle
-> Enumerator s m a
enumHandleRandom bs h i = enumHandleCatch bs h handler i
where
handler (SeekException off) =
liftM (either
(Just . EnumException :: IOException -> Maybe EnumException)
(const Nothing))
. liftIO . CIO.try $ hSeek h AbsoluteSeek $ fromIntegral off
-- ----------------------------------------------
-- File Driver wrapper functions.
| 569
|
enumHandleRandom bs h i = enumHandleCatch bs h handler i
where
handler (SeekException off) =
liftM (either
(Just . EnumException :: IOException -> Maybe EnumException)
(const Nothing))
. liftIO . CIO.try $ hSeek h AbsoluteSeek $ fromIntegral off
-- ----------------------------------------------
-- File Driver wrapper functions.
| 384
| true
| true
| 4
| 10
| 166
| 170
| 85
| 85
| null | null |
MasseR/xmonadcontrib
|
XMonad/Layout/ImageButtonDecoration.hs
|
bsd-3-clause
|
minimizeButtonOffset :: Int
minimizeButtonOffset = 32
| 53
|
minimizeButtonOffset :: Int
minimizeButtonOffset = 32
| 53
|
minimizeButtonOffset = 32
| 25
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
forked-upstream-packages-for-ghcjs/ghc
|
compiler/ghci/ByteCodeItbls.hs
|
bsd-3-clause
|
sizeOfItbl :: DynFlags -> StgInfoTable -> Int
sizeOfItbl dflags itbl
= sum
[
if ghciTablesNextToCode then 0 else fieldSz (fromJust . entry) itbl,
fieldSz ptrs itbl,
fieldSz nptrs itbl,
fieldSz tipe itbl,
fieldSz srtlen itbl,
if ghciTablesNextToCode then case mkJumpToAddr dflags undefined of
Left xs -> sizeOf (head xs) * length xs
Right xs -> sizeOf (head xs) * length xs
else 0
]
| 567
|
sizeOfItbl :: DynFlags -> StgInfoTable -> Int
sizeOfItbl dflags itbl
= sum
[
if ghciTablesNextToCode then 0 else fieldSz (fromJust . entry) itbl,
fieldSz ptrs itbl,
fieldSz nptrs itbl,
fieldSz tipe itbl,
fieldSz srtlen itbl,
if ghciTablesNextToCode then case mkJumpToAddr dflags undefined of
Left xs -> sizeOf (head xs) * length xs
Right xs -> sizeOf (head xs) * length xs
else 0
]
| 567
|
sizeOfItbl dflags itbl
= sum
[
if ghciTablesNextToCode then 0 else fieldSz (fromJust . entry) itbl,
fieldSz ptrs itbl,
fieldSz nptrs itbl,
fieldSz tipe itbl,
fieldSz srtlen itbl,
if ghciTablesNextToCode then case mkJumpToAddr dflags undefined of
Left xs -> sizeOf (head xs) * length xs
Right xs -> sizeOf (head xs) * length xs
else 0
]
| 521
| false
| true
| 0
| 14
| 249
| 152
| 75
| 77
| null | null |
lorcanmcdonald/regexicon
|
src/Tests/Main.hs
|
mit
|
tests :: TestTree
tests =
testGroup
""
[ testGroup "Parse" parseTests,
testGroup "Subpatterns" subpatternTests,
testGroup "Backslash patterns" backslashPatterns,
testGroup "Matching" matchingTests
]
| 230
|
tests :: TestTree
tests =
testGroup
""
[ testGroup "Parse" parseTests,
testGroup "Subpatterns" subpatternTests,
testGroup "Backslash patterns" backslashPatterns,
testGroup "Matching" matchingTests
]
| 230
|
tests =
testGroup
""
[ testGroup "Parse" parseTests,
testGroup "Subpatterns" subpatternTests,
testGroup "Backslash patterns" backslashPatterns,
testGroup "Matching" matchingTests
]
| 212
| false
| true
| 0
| 7
| 53
| 56
| 25
| 31
| null | null |
input-output-hk/cardano-sl
|
core/test/Test/Pos/Core/Gen.hs
|
apache-2.0
|
genByte :: Gen Byte
genByte = Gen.integral (Range.constant 0 10)
| 64
|
genByte :: Gen Byte
genByte = Gen.integral (Range.constant 0 10)
| 64
|
genByte = Gen.integral (Range.constant 0 10)
| 44
| false
| true
| 0
| 8
| 9
| 29
| 14
| 15
| null | null |
shlevy/ghc
|
libraries/base/Control/Monad.hs
|
bsd-3-clause
|
-- | Left-to-right Kleisli composition of monads.
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)
f >=> g = \x -> f x >>= g
| 144
|
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)
f >=> g = \x -> f x >>= g
| 94
|
f >=> g = \x -> f x >>= g
| 29
| true
| true
| 0
| 13
| 45
| 81
| 40
| 41
| null | null |
ghcjs/ghcjs
|
src/Gen2/RtsTypes.hs
|
mit
|
-- number of arguments (arity & 0xff = arguments, arity >> 8 = number of registers)
funArity :: JExpr -> JExpr
funArity = funArity' . entry
| 140
|
funArity :: JExpr -> JExpr
funArity = funArity' . entry
| 55
|
funArity = funArity' . entry
| 28
| true
| true
| 0
| 5
| 26
| 20
| 11
| 9
| null | null |
pepegar/cis194-exercises
|
HW01.hs
|
mit
|
dropLastDigit :: Integer -> Integer
dropLastDigit x
| x < 10 = x
| otherwise = read $ init $ show x
| 110
|
dropLastDigit :: Integer -> Integer
dropLastDigit x
| x < 10 = x
| otherwise = read $ init $ show x
| 110
|
dropLastDigit x
| x < 10 = x
| otherwise = read $ init $ show x
| 74
| false
| true
| 0
| 8
| 32
| 55
| 24
| 31
| null | null |
beni55/haste-compiler
|
libraries/ghc-7.10/ghc-prim/GHC/Prim.hs
|
bsd-3-clause
|
check# :: (State# (RealWorld) -> (# State# (RealWorld),a #)) -> State# (RealWorld) -> (# State# (RealWorld),() #)
check# = let x = x in x
| 137
|
check# :: (State# (RealWorld) -> (# State# (RealWorld),a #)) -> State# (RealWorld) -> (# State# (RealWorld),() #)
check# = let x = x in x
| 137
|
check# = let x = x in x
| 23
| false
| true
| 0
| 11
| 24
| 80
| 39
| 41
| null | null |
GRACeFUL-project/haskelzinc
|
src/Interfaces/FZSolutionParser.hs
|
bsd-3-clause
|
skipMany :: Parser a -> Parser ()
skipMany = P.skipMany
| 55
|
skipMany :: Parser a -> Parser ()
skipMany = P.skipMany
| 55
|
skipMany = P.skipMany
| 21
| false
| true
| 0
| 8
| 9
| 31
| 13
| 18
| null | null |
chrisbloecker/Hive
|
src/Hive/Problem.hs
|
gpl-3.0
|
handle (Problem TSPL inst) master =
maybe (return InvalidInput)
(\poslist -> handle (Problem TSP (decodeUtf8 . encode . convertToGraph $ poslist)) master)
(Hive.Data.Poslist.parse inst)
| 204
|
handle (Problem TSPL inst) master =
maybe (return InvalidInput)
(\poslist -> handle (Problem TSP (decodeUtf8 . encode . convertToGraph $ poslist)) master)
(Hive.Data.Poslist.parse inst)
| 204
|
handle (Problem TSPL inst) master =
maybe (return InvalidInput)
(\poslist -> handle (Problem TSP (decodeUtf8 . encode . convertToGraph $ poslist)) master)
(Hive.Data.Poslist.parse inst)
| 204
| false
| false
| 0
| 14
| 42
| 78
| 40
| 38
| null | null |
sphynx/turnir
|
src/Types.hs
|
bsd-3-clause
|
playerTotal :: Player -> Table -> Float
playerTotal p = sum . map (playerScore p) . playerGames p
| 97
|
playerTotal :: Player -> Table -> Float
playerTotal p = sum . map (playerScore p) . playerGames p
| 97
|
playerTotal p = sum . map (playerScore p) . playerGames p
| 57
| false
| true
| 0
| 9
| 17
| 42
| 20
| 22
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.