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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tonyfloatersu/solution-haskell-craft-of-FP | SetADT.hs | mit | setUnion :: Ord a => Set (Set a) -> Set a
setUnion = foldSet union empty | 75 | setUnion :: Ord a => Set (Set a) -> Set a
setUnion = foldSet union empty | 75 | setUnion = foldSet union empty | 33 | false | true | 0 | 9 | 18 | 39 | 18 | 21 | null | null |
cecton/smd2bin | smd2bin_web.hs | mit | main :: IO ()
main = serve Nothing myApp | 40 | main :: IO ()
main = serve Nothing myApp | 40 | main = serve Nothing myApp | 26 | false | true | 0 | 6 | 8 | 21 | 10 | 11 | null | null |
momomimachli/Hedsql-tests | src/Database/Hedsql/Tests/Queries.hs | gpl-3.0 | testHavingComplex :: Test
testHavingComplex = testCase "Complex HAVING" assertGroupBy
where
assertGroupBy :: Assertion
assertGroupBy = assertEqual
"Complex HAVING is invalid"
( "SELECT \"personId\", \"P\".\"name\", "
<> "SUM(\"C\".\"size\" * (\"P\".\"age\" - 2)) AS \"weird\" "
<> "FROM \"People\" AS \"P\" LEFT JOIN \"Countries\" AS \"C\" "
<> "USING (\"personId\") WHERE \"personId\" > 2 "
<> "GROUP BY \"personId\", \"P\".\"name\", \"P\".\"age\" "
<> "HAVING SUM(\"P\".\"age\" * \"C\".\"size\") > 5000000"
)
(S.codeGen havingComplex)
----------------------------------------
-- Combined queries
---------------------------------------- | 768 | testHavingComplex :: Test
testHavingComplex = testCase "Complex HAVING" assertGroupBy
where
assertGroupBy :: Assertion
assertGroupBy = assertEqual
"Complex HAVING is invalid"
( "SELECT \"personId\", \"P\".\"name\", "
<> "SUM(\"C\".\"size\" * (\"P\".\"age\" - 2)) AS \"weird\" "
<> "FROM \"People\" AS \"P\" LEFT JOIN \"Countries\" AS \"C\" "
<> "USING (\"personId\") WHERE \"personId\" > 2 "
<> "GROUP BY \"personId\", \"P\".\"name\", \"P\".\"age\" "
<> "HAVING SUM(\"P\".\"age\" * \"C\".\"size\") > 5000000"
)
(S.codeGen havingComplex)
----------------------------------------
-- Combined queries
---------------------------------------- | 768 | testHavingComplex = testCase "Complex HAVING" assertGroupBy
where
assertGroupBy :: Assertion
assertGroupBy = assertEqual
"Complex HAVING is invalid"
( "SELECT \"personId\", \"P\".\"name\", "
<> "SUM(\"C\".\"size\" * (\"P\".\"age\" - 2)) AS \"weird\" "
<> "FROM \"People\" AS \"P\" LEFT JOIN \"Countries\" AS \"C\" "
<> "USING (\"personId\") WHERE \"personId\" > 2 "
<> "GROUP BY \"personId\", \"P\".\"name\", \"P\".\"age\" "
<> "HAVING SUM(\"P\".\"age\" * \"C\".\"size\") > 5000000"
)
(S.codeGen havingComplex)
----------------------------------------
-- Combined queries
---------------------------------------- | 742 | false | true | 0 | 10 | 204 | 86 | 39 | 47 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/enumFromThenTo_6.hs | mit | iterate :: (a -> a) -> a -> (List a);
iterate f x = Cons x (iterate f (f x)) | 82 | iterate :: (a -> a) -> a -> (List a)
iterate f x = Cons x (iterate f (f x)) | 81 | iterate f x = Cons x (iterate f (f x)) | 38 | false | true | 0 | 9 | 25 | 57 | 29 | 28 | null | null |
higgsd/euler | hs/92.hs | bsd-2-clause | splitDigits n
| n < 10 = [n]
| otherwise = n `mod` 10 : splitDigits (n `div` 10) | 88 | splitDigits n
| n < 10 = [n]
| otherwise = n `mod` 10 : splitDigits (n `div` 10) | 88 | splitDigits n
| n < 10 = [n]
| otherwise = n `mod` 10 : splitDigits (n `div` 10) | 88 | false | false | 0 | 9 | 26 | 53 | 27 | 26 | null | null |
SLikhachev/pureCdaViewer | src/Application.hs | bsd-3-clause | ------------------------------------------------------------------------------
viewerInit:: SnapletInit b CdaT.CdaViewer
viewerInit = makeSnaplet "viewer" "Cda viewer snaplet" Nothing $ do
cwd <- liftIO $ getCurrentDirectory
let tmpdir = cwd </> "tmp"
liftIO $ createDirectoryIfMissing False tmpdir
return (CdaT.CdaViewer tmpdir)
{--ajaxInit :: SnapletLens b Home -> SnapletInit b Ajax
--ajaxInit _h = makeSnaplet "ajax" "Ajax snaplet" Nothing $ do
ajaxInit :: SnapletInit b Ajax
ajaxInit = makeSnaplet "ajax" "Ajax snaplet" Nothing $ do
return Ajax
-} | 574 | viewerInit:: SnapletInit b CdaT.CdaViewer
viewerInit = makeSnaplet "viewer" "Cda viewer snaplet" Nothing $ do
cwd <- liftIO $ getCurrentDirectory
let tmpdir = cwd </> "tmp"
liftIO $ createDirectoryIfMissing False tmpdir
return (CdaT.CdaViewer tmpdir)
{--ajaxInit :: SnapletLens b Home -> SnapletInit b Ajax
--ajaxInit _h = makeSnaplet "ajax" "Ajax snaplet" Nothing $ do
ajaxInit :: SnapletInit b Ajax
ajaxInit = makeSnaplet "ajax" "Ajax snaplet" Nothing $ do
return Ajax
-} | 495 | viewerInit = makeSnaplet "viewer" "Cda viewer snaplet" Nothing $ do
cwd <- liftIO $ getCurrentDirectory
let tmpdir = cwd </> "tmp"
liftIO $ createDirectoryIfMissing False tmpdir
return (CdaT.CdaViewer tmpdir)
{--ajaxInit :: SnapletLens b Home -> SnapletInit b Ajax
--ajaxInit _h = makeSnaplet "ajax" "Ajax snaplet" Nothing $ do
ajaxInit :: SnapletInit b Ajax
ajaxInit = makeSnaplet "ajax" "Ajax snaplet" Nothing $ do
return Ajax
-} | 453 | true | true | 0 | 11 | 91 | 81 | 38 | 43 | null | null |
ozgurakgun/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | idemodeProcess fn Universes = process fn Universes | 50 | idemodeProcess fn Universes = process fn Universes | 50 | idemodeProcess fn Universes = process fn Universes | 50 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
Tener/spike | src/BrowseTreeOperations.hs | bsd-3-clause | addChild :: BrowseTree -> Page -> Page -> BrowseTree
addChild btree parent child = let
aux (Node page sub) | isSamePage page parent = Node page (sub ++ [newLeaf child])
| otherwise = Node page (map aux sub)
in map aux btree | 268 | addChild :: BrowseTree -> Page -> Page -> BrowseTree
addChild btree parent child = let
aux (Node page sub) | isSamePage page parent = Node page (sub ++ [newLeaf child])
| otherwise = Node page (map aux sub)
in map aux btree | 268 | addChild btree parent child = let
aux (Node page sub) | isSamePage page parent = Node page (sub ++ [newLeaf child])
| otherwise = Node page (map aux sub)
in map aux btree | 215 | false | true | 0 | 14 | 86 | 108 | 50 | 58 | null | null |
gbataille/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | lit :: String -> LP Inlines
lit = pure . str | 44 | lit :: String -> LP Inlines
lit = pure . str | 44 | lit = pure . str | 16 | false | true | 1 | 7 | 10 | 29 | 12 | 17 | null | null |
singingwolfboy/citeproc-hs | src/Text/CSL/Input/MODS.hs | bsd-3-clause | xpMods :: PU Reference
xpMods = xpIElem "mods" xpReference | 58 | xpMods :: PU Reference
xpMods = xpIElem "mods" xpReference | 58 | xpMods = xpIElem "mods" xpReference | 35 | false | true | 0 | 5 | 8 | 19 | 9 | 10 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/DMSEventSubscription.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-eventsubscription.html#cfn-dms-eventsubscription-sourceids
dmsesSourceIds :: Lens' DMSEventSubscription (Maybe (ValList Text))
dmsesSourceIds = lens _dMSEventSubscriptionSourceIds (\s a -> s { _dMSEventSubscriptionSourceIds = a }) | 314 | dmsesSourceIds :: Lens' DMSEventSubscription (Maybe (ValList Text))
dmsesSourceIds = lens _dMSEventSubscriptionSourceIds (\s a -> s { _dMSEventSubscriptionSourceIds = a }) | 171 | dmsesSourceIds = lens _dMSEventSubscriptionSourceIds (\s a -> s { _dMSEventSubscriptionSourceIds = a }) | 103 | true | true | 0 | 9 | 22 | 52 | 28 | 24 | null | null |
mainland/dph | dph-prim-par/Data/Array/Parallel/Unlifted/Parallel/Combinators.hs | bsd-3-clause | -- | Take elements of an array where a flag value is true, and pack them into
-- the result.
--
-- * The souce and flag arrays must have the same length, but this is not checked.
--
packUP :: Unbox e => Vector e -> Vector Bool -> Vector e
packUP xs flags
= Seq.fsts . filterUP snd $ Seq.zip xs flags | 314 | packUP :: Unbox e => Vector e -> Vector Bool -> Vector e
packUP xs flags
= Seq.fsts . filterUP snd $ Seq.zip xs flags | 126 | packUP xs flags
= Seq.fsts . filterUP snd $ Seq.zip xs flags | 69 | true | true | 1 | 9 | 78 | 70 | 33 | 37 | null | null |
zaoqi/zaoqilc | featuring/App.hs | agpl-3.0 | withLP = LP | 11 | withLP = LP | 11 | withLP = LP | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
rahulmutt/ghcvm | compiler/Eta/Core/TrieMap.hs | bsd-3-clause | lkFreeVar :: Var -> VarEnv a -> Maybe a
lkFreeVar var env = lookupVarEnv env var | 80 | lkFreeVar :: Var -> VarEnv a -> Maybe a
lkFreeVar var env = lookupVarEnv env var | 80 | lkFreeVar var env = lookupVarEnv env var | 40 | false | true | 0 | 7 | 15 | 35 | 16 | 19 | null | null |
kelnage/tamarin-prover | lib/utils/src/Text/PrettyPrint/Class.hs | gpl-3.0 | lparen = char '(' | 17 | lparen = char '(' | 17 | lparen = char '(' | 17 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
nikita-volkov/laika | demo/Main.hs | mit | html2 :: Text -> HTML -> HTML
html2 var1 var2 =
[html|<a href="&!var1;">&!var2; </a>|] | 93 | html2 :: Text -> HTML -> HTML
html2 var1 var2 =
[html|<a href="&!var1;">&!var2; </a>|] | 93 | html2 var1 var2 =
[html|<a href="&!var1;">&!var2; </a>|] | 63 | false | true | 0 | 6 | 14 | 28 | 16 | 12 | null | null |
Tosainu/blog | src/Main.hs | mit | timeZoneJST :: TimeZone
timeZoneJST = TimeZone (9 * 60) False "JST" | 67 | timeZoneJST :: TimeZone
timeZoneJST = TimeZone (9 * 60) False "JST" | 67 | timeZoneJST = TimeZone (9 * 60) False "JST" | 43 | false | true | 0 | 7 | 10 | 25 | 13 | 12 | null | null |
ssaavedra/liquidhaskell | benchmarks/bytestring-0.9.2.1/Data/ByteString/Lazy.hs | bsd-3-clause | --TODO: use a better implementation
-- ---------------------------------------------------------------------
-- Searching for substrings
-- | /O(n)/ The 'isPrefixOf' function takes two ByteStrings and returns 'True'
-- iff the first is a prefix of the second.
{-@ isPrefixOf :: ByteString -> ByteString -> Bool @-}
isPrefixOf :: ByteString -> ByteString -> Bool
isPrefixOf Empty _ = True | 390 | isPrefixOf :: ByteString -> ByteString -> Bool
isPrefixOf Empty _ = True | 73 | isPrefixOf Empty _ = True | 26 | true | true | 0 | 8 | 56 | 36 | 19 | 17 | null | null |
harrisi/on-being-better | list-expansion/Haskell/cis194/01/HW01Tests.hs | cc0-1.0 | testDoubleEveryOther'' :: ([Integer], [Integer]) -> Bool
testDoubleEveryOther'' (n, d) = doubleEveryOther'' n == d | 114 | testDoubleEveryOther'' :: ([Integer], [Integer]) -> Bool
testDoubleEveryOther'' (n, d) = doubleEveryOther'' n == d | 114 | testDoubleEveryOther'' (n, d) = doubleEveryOther'' n == d | 57 | false | true | 0 | 7 | 13 | 43 | 24 | 19 | null | null |
flyrry/phonypony | src/Vindinium/Runner/Tileset.hs | mit | tilesConf :: [(String, Int, Int)]
tilesConf = [ -- primitive tiles
("plain", 1, 1)
, ("water", 3, 2)
, ("earth", 4, 2)
, ("rock", 4, 3)
, ("empty", 3, 3)
-- plain extras
, ("plain_grass1", 10, 0)
, ("plain_grass2", 11, 0)
, ("plain_grass3", 11, 1)
, ("plain_flower", 10, 1)
] | 461 | tilesConf :: [(String, Int, Int)]
tilesConf = [ -- primitive tiles
("plain", 1, 1)
, ("water", 3, 2)
, ("earth", 4, 2)
, ("rock", 4, 3)
, ("empty", 3, 3)
-- plain extras
, ("plain_grass1", 10, 0)
, ("plain_grass2", 11, 0)
, ("plain_grass3", 11, 1)
, ("plain_flower", 10, 1)
] | 461 | tilesConf = [ -- primitive tiles
("plain", 1, 1)
, ("water", 3, 2)
, ("earth", 4, 2)
, ("rock", 4, 3)
, ("empty", 3, 3)
-- plain extras
, ("plain_grass1", 10, 0)
, ("plain_grass2", 11, 0)
, ("plain_grass3", 11, 1)
, ("plain_flower", 10, 1)
] | 427 | false | true | 0 | 8 | 235 | 140 | 89 | 51 | null | null |
pgj/bead | src/Bead/View/Content/UploadFile/Page.hs | bsd-3-clause | getUploadFile :: GETContentHandler
getUploadFile = do
fs <- userStory Story.listUsersFiles
size <- fmap maxUploadSizeInKb $ lift getConfiguration
return $ uploadFileContent (PageData fs size) | 197 | getUploadFile :: GETContentHandler
getUploadFile = do
fs <- userStory Story.listUsersFiles
size <- fmap maxUploadSizeInKb $ lift getConfiguration
return $ uploadFileContent (PageData fs size) | 197 | getUploadFile = do
fs <- userStory Story.listUsersFiles
size <- fmap maxUploadSizeInKb $ lift getConfiguration
return $ uploadFileContent (PageData fs size) | 162 | false | true | 0 | 10 | 28 | 58 | 26 | 32 | null | null |
s9gf4ult/yesod | yesod-core/Yesod/Core/Content.hs | mit | typeHtml :: ContentType
typeHtml = "text/html; charset=utf-8" | 61 | typeHtml :: ContentType
typeHtml = "text/html; charset=utf-8" | 61 | typeHtml = "text/html; charset=utf-8" | 37 | false | true | 0 | 6 | 6 | 18 | 7 | 11 | null | null |
pepeiborra/bytestring-xml | src/Text/Xml/Tiny/Internal.hs | bsd-3-clause | null :: Config => Slice -> Bool
null (Slice _ l) = l == 0 | 57 | null :: Config => Slice -> Bool
null (Slice _ l) = l == 0 | 57 | null (Slice _ l) = l == 0 | 25 | false | true | 0 | 7 | 14 | 35 | 17 | 18 | null | null |
dec9ue/jhc_copygc | src/E/LambdaLift.hs | gpl-2.0 | assert x = value True `implies` x | 33 | assert x = value True `implies` x | 33 | assert x = value True `implies` x | 33 | false | false | 0 | 6 | 6 | 18 | 9 | 9 | null | null |
brendanhay/gogol | gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs | mpl-2.0 | -- | The color of the last row or column. If this field is not set, the last
-- row or column is filled with either first_band_color or
-- second_band_color, depending on the color of the previous row or column.
-- If footer_color is also set, this field takes precedence.
bpFooterColorStyle :: Lens' BandingProperties (Maybe ColorStyle)
bpFooterColorStyle
= lens _bpFooterColorStyle
(\ s a -> s{_bpFooterColorStyle = a}) | 429 | bpFooterColorStyle :: Lens' BandingProperties (Maybe ColorStyle)
bpFooterColorStyle
= lens _bpFooterColorStyle
(\ s a -> s{_bpFooterColorStyle = a}) | 156 | bpFooterColorStyle
= lens _bpFooterColorStyle
(\ s a -> s{_bpFooterColorStyle = a}) | 91 | true | true | 1 | 9 | 74 | 55 | 28 | 27 | null | null |
adept/hledger | hledger-lib/Hledger/Utils/Debug.hs | gpl-3.0 | dbg2IO :: (MonadIO m, Show a) => String -> a -> m ()
dbg2IO = ptraceAtIO 2 | 74 | dbg2IO :: (MonadIO m, Show a) => String -> a -> m ()
dbg2IO = ptraceAtIO 2 | 74 | dbg2IO = ptraceAtIO 2 | 21 | false | true | 0 | 9 | 16 | 42 | 21 | 21 | null | null |
ganeti/ganeti | src/Ganeti/Types.hs | bsd-2-clause | addParamsToStorageUnit es (SURaw StorageLvmPv key) = SULvmPv key es | 67 | addParamsToStorageUnit es (SURaw StorageLvmPv key) = SULvmPv key es | 67 | addParamsToStorageUnit es (SURaw StorageLvmPv key) = SULvmPv key es | 67 | false | false | 0 | 7 | 8 | 24 | 11 | 13 | null | null |
sdiehl/ghc | compiler/GHC/Cmm/Dataflow/Block.hs | bsd-3-clause | foldBlockNodesB3 (ff, fm, fl) = block
where block :: forall e x . Block n e x -> IndexedCO x a b -> IndexedCO e c b
block (BlockCO f b ) = ff f `cat` block b
block (BlockCC f b l) = ff f `cat` block b `cat` fl l
block (BlockOC b l) = block b `cat` fl l
block BNil = id
block (BMiddle node) = fm node
block (b1 `BCat` b2) = block b1 `cat` block b2
block (b1 `BSnoc` n) = block b1 `cat` fm n
block (n `BCons` b2) = fm n `cat` block b2
cat :: forall a b c. (b -> c) -> (a -> b) -> a -> c
cat f f' = f . f' | 629 | foldBlockNodesB3 (ff, fm, fl) = block
where block :: forall e x . Block n e x -> IndexedCO x a b -> IndexedCO e c b
block (BlockCO f b ) = ff f `cat` block b
block (BlockCC f b l) = ff f `cat` block b `cat` fl l
block (BlockOC b l) = block b `cat` fl l
block BNil = id
block (BMiddle node) = fm node
block (b1 `BCat` b2) = block b1 `cat` block b2
block (b1 `BSnoc` n) = block b1 `cat` fm n
block (n `BCons` b2) = fm n `cat` block b2
cat :: forall a b c. (b -> c) -> (a -> b) -> a -> c
cat f f' = f . f' | 629 | foldBlockNodesB3 (ff, fm, fl) = block
where block :: forall e x . Block n e x -> IndexedCO x a b -> IndexedCO e c b
block (BlockCO f b ) = ff f `cat` block b
block (BlockCC f b l) = ff f `cat` block b `cat` fl l
block (BlockOC b l) = block b `cat` fl l
block BNil = id
block (BMiddle node) = fm node
block (b1 `BCat` b2) = block b1 `cat` block b2
block (b1 `BSnoc` n) = block b1 `cat` fm n
block (n `BCons` b2) = fm n `cat` block b2
cat :: forall a b c. (b -> c) -> (a -> b) -> a -> c
cat f f' = f . f' | 629 | false | false | 2 | 10 | 252 | 341 | 170 | 171 | null | null |
michalkonecny/aern2 | aern2-net/src/AERN2/QA/NetLog.hs | bsd-3-clause | printQANetLogThenResult :: (Show a) =>(QANetLog, a) -> IO ()
printQANetLogThenResult (lg, result) =
do
printQALog lg
putStrLn $ show result | 151 | printQANetLogThenResult :: (Show a) =>(QANetLog, a) -> IO ()
printQANetLogThenResult (lg, result) =
do
printQALog lg
putStrLn $ show result | 151 | printQANetLogThenResult (lg, result) =
do
printQALog lg
putStrLn $ show result | 90 | false | true | 0 | 8 | 31 | 60 | 30 | 30 | null | null |
mattias-lundell/timber-llvm | src/Common.hs | bsd-3-clause | duplicates xs = filter (`elem` dups) xs1
where xs1 = nub xs
dups = foldl (flip List.delete) xs xs1 | 165 | duplicates xs = filter (`elem` dups) xs1
where xs1 = nub xs
dups = foldl (flip List.delete) xs xs1 | 165 | duplicates xs = filter (`elem` dups) xs1
where xs1 = nub xs
dups = foldl (flip List.delete) xs xs1 | 165 | false | false | 1 | 8 | 85 | 51 | 26 | 25 | null | null |
Lemmih/fvg | tests/runtests.hs | bsd-3-clause | main :: IO ()
main = do
args <- getArgs
case args of
[file] -> do
inp <- readFile file
let outFile = replaceExtension file "out"
expr <- evaluate (runScript inp)
writeFile outFile (show expr)
_ -> do
files <- getDirectoryContents "."
forM_ (sort files) $ \file ->
when (takeExtension file == ".fvg") $ do
inp <- readFile file
let outFile = replaceExtension file "out"
hasOut <- doesFileExist outFile
if hasOut
then do
out <- readFile outFile
ret <- try $ evaluate (runScript inp)
case ret :: Either SomeException Expr of
Left{} -> unexpectedFailure file
Right expr
| show expr == out -> ok file
| otherwise -> mismatch file
else do
ret <- try $ evaluate (runScript inp)
case ret :: Either SomeException Expr of
Left{} -> ok file
Right{} -> expectedFailure file | 1,059 | main :: IO ()
main = do
args <- getArgs
case args of
[file] -> do
inp <- readFile file
let outFile = replaceExtension file "out"
expr <- evaluate (runScript inp)
writeFile outFile (show expr)
_ -> do
files <- getDirectoryContents "."
forM_ (sort files) $ \file ->
when (takeExtension file == ".fvg") $ do
inp <- readFile file
let outFile = replaceExtension file "out"
hasOut <- doesFileExist outFile
if hasOut
then do
out <- readFile outFile
ret <- try $ evaluate (runScript inp)
case ret :: Either SomeException Expr of
Left{} -> unexpectedFailure file
Right expr
| show expr == out -> ok file
| otherwise -> mismatch file
else do
ret <- try $ evaluate (runScript inp)
case ret :: Either SomeException Expr of
Left{} -> ok file
Right{} -> expectedFailure file | 1,059 | main = do
args <- getArgs
case args of
[file] -> do
inp <- readFile file
let outFile = replaceExtension file "out"
expr <- evaluate (runScript inp)
writeFile outFile (show expr)
_ -> do
files <- getDirectoryContents "."
forM_ (sort files) $ \file ->
when (takeExtension file == ".fvg") $ do
inp <- readFile file
let outFile = replaceExtension file "out"
hasOut <- doesFileExist outFile
if hasOut
then do
out <- readFile outFile
ret <- try $ evaluate (runScript inp)
case ret :: Either SomeException Expr of
Left{} -> unexpectedFailure file
Right expr
| show expr == out -> ok file
| otherwise -> mismatch file
else do
ret <- try $ evaluate (runScript inp)
case ret :: Either SomeException Expr of
Left{} -> ok file
Right{} -> expectedFailure file | 1,045 | false | true | 0 | 27 | 432 | 354 | 157 | 197 | null | null |
madjar/fhue | src/FHue/FakeHdfs.hs | bsd-3-clause | mkDir = mkItem Dir | 18 | mkDir = mkItem Dir | 18 | mkDir = mkItem Dir | 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ddssff/lens | src/Control/Lens/Fold.hs | bsd-3-clause | -- | Monadic fold over the elements of a structure with an index, associating to the left.
--
-- When you don't need access to the index then 'foldlMOf' is more flexible in what it accepts.
--
-- @
-- 'foldlMOf' l ≡ 'ifoldlMOf' l '.' 'const'
-- @
--
-- @
-- 'ifoldlMOf' :: 'Monad' m => 'IndexedGetter' i s a -> (i -> r -> a -> m r) -> r -> s -> m r
-- 'ifoldlMOf' :: 'Monad' m => 'IndexedFold' i s a -> (i -> r -> a -> m r) -> r -> s -> m r
-- 'ifoldlMOf' :: 'Monad' m => 'IndexedLens'' i s a -> (i -> r -> a -> m r) -> r -> s -> m r
-- 'ifoldlMOf' :: 'Monad' m => 'IndexedTraversal'' i s a -> (i -> r -> a -> m r) -> r -> s -> m r
-- @
ifoldlMOf :: Monad m => IndexedGetting i (Endo (r -> m r)) s a -> (i -> r -> a -> m r) -> r -> s -> m r
ifoldlMOf l f z0 xs = ifoldrOf l f' return xs z0
where f' i x k z = f i z x >>= k
| 840 | ifoldlMOf :: Monad m => IndexedGetting i (Endo (r -> m r)) s a -> (i -> r -> a -> m r) -> r -> s -> m r
ifoldlMOf l f z0 xs = ifoldrOf l f' return xs z0
where f' i x k z = f i z x >>= k
| 188 | ifoldlMOf l f z0 xs = ifoldrOf l f' return xs z0
where f' i x k z = f i z x >>= k
| 84 | true | true | 0 | 12 | 230 | 141 | 75 | 66 | null | null |
brendanhay/gogol | gogol-searchconsole/gen/Network/Google/Resource/Webmasters/Searchanalytics/Query.hs | mpl-2.0 | -- | The site\'s URL, including protocol. For example:
-- \`http:\/\/www.example.com\/\`.
sqSiteURL :: Lens' SearchanalyticsQuery Text
sqSiteURL
= lens _sqSiteURL (\ s a -> s{_sqSiteURL = a}) | 193 | sqSiteURL :: Lens' SearchanalyticsQuery Text
sqSiteURL
= lens _sqSiteURL (\ s a -> s{_sqSiteURL = a}) | 103 | sqSiteURL
= lens _sqSiteURL (\ s a -> s{_sqSiteURL = a}) | 58 | true | true | 1 | 9 | 28 | 47 | 23 | 24 | null | null |
brendanhay/gogol | gogol-doubleclick-bids/gen/Network/Google/DoubleClickBids/Types/Product.hs | mpl-2.0 | -- | Dimension the filter is applied to.
pqofFilter :: Lens' PathQueryOptionsFilter (Maybe PathQueryOptionsFilterFilter)
pqofFilter
= lens _pqofFilter (\ s a -> s{_pqofFilter = a}) | 182 | pqofFilter :: Lens' PathQueryOptionsFilter (Maybe PathQueryOptionsFilterFilter)
pqofFilter
= lens _pqofFilter (\ s a -> s{_pqofFilter = a}) | 141 | pqofFilter
= lens _pqofFilter (\ s a -> s{_pqofFilter = a}) | 61 | true | true | 0 | 9 | 26 | 48 | 25 | 23 | null | null |
acowley/ghc | compiler/deSugar/DsBinds.hs | bsd-3-clause | dsHsBind (FunBind { fun_id = L _ fun, fun_matches = matches
, fun_co_fn = co_fn, fun_tick = tick
, fun_infix = inf })
= do { dflags <- getDynFlags
; (args, body) <- matchWrapper (FunRhs (idName fun) inf) matches
; let body' = mkOptTickBox tick body
; rhs <- dsHsWrapper co_fn (mkLams args body')
; {- pprTrace "dsHsBind" (ppr fun <+> ppr (idInlinePragma fun)) $ -}
return (unitOL (makeCorePair dflags fun False 0 rhs)) } | 502 | dsHsBind (FunBind { fun_id = L _ fun, fun_matches = matches
, fun_co_fn = co_fn, fun_tick = tick
, fun_infix = inf })
= do { dflags <- getDynFlags
; (args, body) <- matchWrapper (FunRhs (idName fun) inf) matches
; let body' = mkOptTickBox tick body
; rhs <- dsHsWrapper co_fn (mkLams args body')
; {- pprTrace "dsHsBind" (ppr fun <+> ppr (idInlinePragma fun)) $ -}
return (unitOL (makeCorePair dflags fun False 0 rhs)) } | 502 | dsHsBind (FunBind { fun_id = L _ fun, fun_matches = matches
, fun_co_fn = co_fn, fun_tick = tick
, fun_infix = inf })
= do { dflags <- getDynFlags
; (args, body) <- matchWrapper (FunRhs (idName fun) inf) matches
; let body' = mkOptTickBox tick body
; rhs <- dsHsWrapper co_fn (mkLams args body')
; {- pprTrace "dsHsBind" (ppr fun <+> ppr (idInlinePragma fun)) $ -}
return (unitOL (makeCorePair dflags fun False 0 rhs)) } | 502 | false | false | 0 | 12 | 156 | 156 | 82 | 74 | null | null |
google/ghc-source-gen | src/GHC/SourceGen/Pat/Internal.hs | bsd-3-clause | needsPar (ConPat _ _ (InfixCon _ _)) = True | 43 | needsPar (ConPat _ _ (InfixCon _ _)) = True | 43 | needsPar (ConPat _ _ (InfixCon _ _)) = True | 43 | false | false | 0 | 9 | 8 | 27 | 13 | 14 | null | null |
kazu-yamamoto/wai | warp/Network/Wai/Handler/Warp.hs | mit | -- | What to do when a connection is closed. Default: do nothing.
--
-- Since 2.1.0
setOnClose :: (SockAddr -> IO ()) -> Settings -> Settings
setOnClose x y = y { settingsOnClose = x } | 184 | setOnClose :: (SockAddr -> IO ()) -> Settings -> Settings
setOnClose x y = y { settingsOnClose = x } | 100 | setOnClose x y = y { settingsOnClose = x } | 42 | true | true | 0 | 9 | 36 | 47 | 26 | 21 | null | null |
tekul/cryptonite | tests/KAT_PubKey/DSA.hs | bsd-3-clause | doSignatureTest (i, vector) = testCase (show i) (expected @=? actual)
where expected = Just $ DSA.Signature (r vector) (s vector)
actual = DSA.signWith (k vector) (vectorToPrivate vector) SHA1 (msg vector) | 221 | doSignatureTest (i, vector) = testCase (show i) (expected @=? actual)
where expected = Just $ DSA.Signature (r vector) (s vector)
actual = DSA.signWith (k vector) (vectorToPrivate vector) SHA1 (msg vector) | 221 | doSignatureTest (i, vector) = testCase (show i) (expected @=? actual)
where expected = Just $ DSA.Signature (r vector) (s vector)
actual = DSA.signWith (k vector) (vectorToPrivate vector) SHA1 (msg vector) | 221 | false | false | 0 | 10 | 45 | 97 | 49 | 48 | null | null |
beni55/hdbc-postgresql | Database/HDBC/PostgreSQL/ErrorCodes.hs | bsd-3-clause | -- |Is set to @\"38001\"@.
eREContainingSqlNotPermitted :: String
eREContainingSqlNotPermitted = "38001" | 104 | eREContainingSqlNotPermitted :: String
eREContainingSqlNotPermitted = "38001" | 77 | eREContainingSqlNotPermitted = "38001" | 38 | true | true | 0 | 4 | 10 | 12 | 7 | 5 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F24.hs | bsd-3-clause | -- glSecondaryColor3uiv --------------------------------------------------------
-- | Manual page for <https://www.opengl.org/sdk/docs/man2/xhtml/glSecondaryColor.xml OpenGL 2.x>.
glSecondaryColor3uiv
:: MonadIO m
=> Ptr GLuint -- ^ @v@ pointing to @3@ elements of type @ColorUI@.
-> m ()
glSecondaryColor3uiv v1 = liftIO $ dyn110 ptr_glSecondaryColor3uiv v1 | 365 | glSecondaryColor3uiv
:: MonadIO m
=> Ptr GLuint -- ^ @v@ pointing to @3@ elements of type @ColorUI@.
-> m ()
glSecondaryColor3uiv v1 = liftIO $ dyn110 ptr_glSecondaryColor3uiv v1 | 184 | glSecondaryColor3uiv v1 = liftIO $ dyn110 ptr_glSecondaryColor3uiv v1 | 69 | true | true | 0 | 9 | 45 | 49 | 23 | 26 | null | null |
tomasmcz/discrete-opt | src-main/Main/Opts.hs | bsd-3-clause | modConfigSA :: SA.Config -> Flag -> SA.Config
modConfigSA conf (FFin t) = conf {finalTemp = t} | 94 | modConfigSA :: SA.Config -> Flag -> SA.Config
modConfigSA conf (FFin t) = conf {finalTemp = t} | 94 | modConfigSA conf (FFin t) = conf {finalTemp = t} | 48 | false | true | 0 | 7 | 15 | 47 | 23 | 24 | null | null |
jmgimeno/haskell-playground | src/FunWithProfunctors.hs | unlicense | -- Note: every iso is automatically a lens!
-- Lenses as Isos
-- Consider how we can construct a lens
-- type Lens s t a b = forall p. Strong p => p a b -> p s t
-- All we have are dimap and first
-- dimap :: Profuctor f => (c -> a) -> (b -> d) -> p a b -> p c d
-- first :: Strong p => p a b -> p (a, x) (b, x)
-- Every profunctor lens has a normal form
nf :: (s -> (a, x)) -> ((b, x) -> t) -> Lens s t a b
nf f g pab = dimap f g (first pab) | 471 | nf :: (s -> (a, x)) -> ((b, x) -> t) -> Lens s t a b
nf f g pab = dimap f g (first pab) | 87 | nf f g pab = dimap f g (first pab) | 34 | true | true | 0 | 9 | 147 | 86 | 48 | 38 | null | null |
JPMoresmau/haskell-ide-engine | test/ExtensibleStateSpec.hs | bsd-3-clause | testPlugins :: TChan () -> Plugins
testPlugins chSync = Map.fromList [("test",testDescriptor chSync)] | 101 | testPlugins :: TChan () -> Plugins
testPlugins chSync = Map.fromList [("test",testDescriptor chSync)] | 101 | testPlugins chSync = Map.fromList [("test",testDescriptor chSync)] | 66 | false | true | 0 | 8 | 11 | 40 | 20 | 20 | null | null |
enolan/Idris-dev | src/Idris/ElabDecls.hs | bsd-3-clause | elabDecl' what info (PProvider doc syn fc nfc provWhat n)
| what /= EDefns
= do logElab 1 $ "Elaborating type provider " ++ show n
elabProvider doc info syn fc nfc provWhat n | 189 | elabDecl' what info (PProvider doc syn fc nfc provWhat n)
| what /= EDefns
= do logElab 1 $ "Elaborating type provider " ++ show n
elabProvider doc info syn fc nfc provWhat n | 189 | elabDecl' what info (PProvider doc syn fc nfc provWhat n)
| what /= EDefns
= do logElab 1 $ "Elaborating type provider " ++ show n
elabProvider doc info syn fc nfc provWhat n | 189 | false | false | 0 | 10 | 48 | 74 | 33 | 41 | null | null |
awbraunstein/emonad | src/BufferList.hs | mit | -- | Transform the current buffer for the buffer list.
transformCurrentBuffer :: (Buffer -> Buffer) -> BufferList -> BufferList
transformCurrentBuffer _ b@(BL _ Nothing _) = b | 175 | transformCurrentBuffer :: (Buffer -> Buffer) -> BufferList -> BufferList
transformCurrentBuffer _ b@(BL _ Nothing _) = b | 120 | transformCurrentBuffer _ b@(BL _ Nothing _) = b | 47 | true | true | 0 | 8 | 26 | 45 | 24 | 21 | null | null |
Helkafen/haddock | haddock-test/src/Test/Haddock.hs | bsd-2-clause | readRef :: Config c -> FilePath -> IO (Maybe c)
readRef cfg file =
ccfgRead ccfg . BS.unpack
<$> BS.readFile (refFile dcfg file)
where
ccfg = cfgCheckConfig cfg
dcfg = cfgDirConfig cfg
-- | Read (and clean) the test output artifact for a test | 261 | readRef :: Config c -> FilePath -> IO (Maybe c)
readRef cfg file =
ccfgRead ccfg . BS.unpack
<$> BS.readFile (refFile dcfg file)
where
ccfg = cfgCheckConfig cfg
dcfg = cfgDirConfig cfg
-- | Read (and clean) the test output artifact for a test | 261 | readRef cfg file =
ccfgRead ccfg . BS.unpack
<$> BS.readFile (refFile dcfg file)
where
ccfg = cfgCheckConfig cfg
dcfg = cfgDirConfig cfg
-- | Read (and clean) the test output artifact for a test | 213 | false | true | 4 | 10 | 62 | 91 | 40 | 51 | null | null |
markus-git/co-feldspar | src/Feldspar/Software/Primitive.hs | bsd-3-clause | softwarePrimTypeEq (Word32ST) (Word32ST) = Just Dict | 52 | softwarePrimTypeEq (Word32ST) (Word32ST) = Just Dict | 52 | softwarePrimTypeEq (Word32ST) (Word32ST) = Just Dict | 52 | false | false | 0 | 6 | 5 | 20 | 10 | 10 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | kindConKey = mkPreludeTyConUnique 69 | 65 | kindConKey = mkPreludeTyConUnique 69 | 65 | kindConKey = mkPreludeTyConUnique 69 | 65 | false | false | 0 | 5 | 32 | 9 | 4 | 5 | null | null |
syanidar/Sophy | src/Foundation/BitBoard.hs | bsd-3-clause | attack NorthEast x y
= (y''.|.y''`shiftL`28.&.x''.&.onBoard'')`shiftL`7.&.onBoard
where onBoard = complement aFile
y' = y.|.y`shiftL`7.&.x.&.onBoard
x' = x.&.x`shiftL`7.&.onBoard
onBoard' = onBoard.&.onBoard`shiftL`7
y'' = y'.|.y'`shiftL`14.&.x'.&.onBoard'
x'' = x'.&.x'`shiftL`14.&.onBoard'
onBoard'' = onBoard'.&.onBoard'`shiftL`14 | 458 | attack NorthEast x y
= (y''.|.y''`shiftL`28.&.x''.&.onBoard'')`shiftL`7.&.onBoard
where onBoard = complement aFile
y' = y.|.y`shiftL`7.&.x.&.onBoard
x' = x.&.x`shiftL`7.&.onBoard
onBoard' = onBoard.&.onBoard`shiftL`7
y'' = y'.|.y'`shiftL`14.&.x'.&.onBoard'
x'' = x'.&.x'`shiftL`14.&.onBoard'
onBoard'' = onBoard'.&.onBoard'`shiftL`14 | 458 | attack NorthEast x y
= (y''.|.y''`shiftL`28.&.x''.&.onBoard'')`shiftL`7.&.onBoard
where onBoard = complement aFile
y' = y.|.y`shiftL`7.&.x.&.onBoard
x' = x.&.x`shiftL`7.&.onBoard
onBoard' = onBoard.&.onBoard`shiftL`7
y'' = y'.|.y'`shiftL`14.&.x'.&.onBoard'
x'' = x'.&.x'`shiftL`14.&.onBoard'
onBoard'' = onBoard'.&.onBoard'`shiftL`14 | 458 | false | false | 6 | 23 | 153 | 181 | 95 | 86 | null | null |
DaMSL/K3 | src/Language/K3/Codegen/Haskell.hs | apache-2.0 | collectionCopyConPrefixId :: Identifier
collectionCopyConPrefixId = "copy" | 74 | collectionCopyConPrefixId :: Identifier
collectionCopyConPrefixId = "copy" | 74 | collectionCopyConPrefixId = "copy" | 34 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
kyagrd/mininax | src/Main.hs | bsd-2-clause | mykpoly2 = mygr2 "test/kpoly.mininax" | 37 | mykpoly2 = mygr2 "test/kpoly.mininax" | 37 | mykpoly2 = mygr2 "test/kpoly.mininax" | 37 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
jstolarek/ghc | libraries/base/GHC/List.hs | bsd-3-clause | product = foldl (*) 1 | 38 | product = foldl (*) 1 | 38 | product = foldl (*) 1 | 38 | false | false | 0 | 5 | 21 | 13 | 7 | 6 | null | null |
rootzlevel/hledger-add | src/Brick/Widgets/HelpMessage.hs | bsd-3-clause | center :: Widget n -> Widget n
center w = Widget Fixed Fixed $ do
c <- getContext
res <- render w
let rWidth = res^.imageL.to imageWidth
rHeight = res^.imageL.to imageHeight
x = (c^.availWidthL `div` 2) - (rWidth `div` 2)
y = (c^.availHeightL `div` 2) - (rHeight `div` 2)
render $ translateBy (Location (x,y)) $ raw (res^.imageL) | 356 | center :: Widget n -> Widget n
center w = Widget Fixed Fixed $ do
c <- getContext
res <- render w
let rWidth = res^.imageL.to imageWidth
rHeight = res^.imageL.to imageHeight
x = (c^.availWidthL `div` 2) - (rWidth `div` 2)
y = (c^.availHeightL `div` 2) - (rHeight `div` 2)
render $ translateBy (Location (x,y)) $ raw (res^.imageL) | 356 | center w = Widget Fixed Fixed $ do
c <- getContext
res <- render w
let rWidth = res^.imageL.to imageWidth
rHeight = res^.imageL.to imageHeight
x = (c^.availWidthL `div` 2) - (rWidth `div` 2)
y = (c^.availHeightL `div` 2) - (rHeight `div` 2)
render $ translateBy (Location (x,y)) $ raw (res^.imageL) | 325 | false | true | 0 | 14 | 83 | 180 | 93 | 87 | null | null |
urbanslug/ghc | testsuite/tests/perf/compiler/T783.hs | bsd-3-clause | foo x | x == 295 = 295 | 22 | foo x | x == 295 = 295 | 22 | foo x | x == 295 = 295 | 22 | false | false | 0 | 8 | 7 | 23 | 9 | 14 | null | null |
achudnov/hurl | Hurl.hs | bsd-3-clause | printResponseLBS :: Command -> Response LBS.ByteString -> IO ()
printResponseLBS cmd rsp@(Response _ _ _ body) =
let ob = onlyBody cmd
in do h <- maybe (return stdout) (`openBinaryFile` WriteMode) (file cmd)
unless ob $ hPrint h rsp
LBS.hPutStr h body
when (isJust $ file cmd) (hClose h) | 317 | printResponseLBS :: Command -> Response LBS.ByteString -> IO ()
printResponseLBS cmd rsp@(Response _ _ _ body) =
let ob = onlyBody cmd
in do h <- maybe (return stdout) (`openBinaryFile` WriteMode) (file cmd)
unless ob $ hPrint h rsp
LBS.hPutStr h body
when (isJust $ file cmd) (hClose h) | 317 | printResponseLBS cmd rsp@(Response _ _ _ body) =
let ob = onlyBody cmd
in do h <- maybe (return stdout) (`openBinaryFile` WriteMode) (file cmd)
unless ob $ hPrint h rsp
LBS.hPutStr h body
when (isJust $ file cmd) (hClose h) | 253 | false | true | 0 | 12 | 78 | 144 | 68 | 76 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/NV/RegisterCombiners.hs | bsd-3-clause | gl_VARIABLE_B :: GLenum
gl_VARIABLE_B = 0x8524 | 46 | gl_VARIABLE_B :: GLenum
gl_VARIABLE_B = 0x8524 | 46 | gl_VARIABLE_B = 0x8524 | 22 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
dmbarbour/Sirea | src/Sirea/Clock.hs | bsd-3-clause | nanosInDay, nanosInSec :: Integer
nanosInDay = 24*60*60 * nanosInSec | 68 | nanosInDay, nanosInSec :: Integer
nanosInDay = 24*60*60 * nanosInSec | 68 | nanosInDay = 24*60*60 * nanosInSec | 34 | false | true | 0 | 7 | 8 | 25 | 14 | 11 | null | null |
denibertovic/haskell | kubernetes/lib/Kubernetes/OpenAPI/ModelLens.hs | bsd-3-clause | -- | 'v1beta1JSONSchemaPropsAdditionalProperties' Lens
v1beta1JSONSchemaPropsAdditionalPropertiesL :: Lens_' V1beta1JSONSchemaProps (Maybe V1beta1JSONSchemaPropsOrBool)
v1beta1JSONSchemaPropsAdditionalPropertiesL f V1beta1JSONSchemaProps{..} = (\v1beta1JSONSchemaPropsAdditionalProperties -> V1beta1JSONSchemaProps { v1beta1JSONSchemaPropsAdditionalProperties, ..} ) <$> f v1beta1JSONSchemaPropsAdditionalProperties | 415 | v1beta1JSONSchemaPropsAdditionalPropertiesL :: Lens_' V1beta1JSONSchemaProps (Maybe V1beta1JSONSchemaPropsOrBool)
v1beta1JSONSchemaPropsAdditionalPropertiesL f V1beta1JSONSchemaProps{..} = (\v1beta1JSONSchemaPropsAdditionalProperties -> V1beta1JSONSchemaProps { v1beta1JSONSchemaPropsAdditionalProperties, ..} ) <$> f v1beta1JSONSchemaPropsAdditionalProperties | 360 | v1beta1JSONSchemaPropsAdditionalPropertiesL f V1beta1JSONSchemaProps{..} = (\v1beta1JSONSchemaPropsAdditionalProperties -> V1beta1JSONSchemaProps { v1beta1JSONSchemaPropsAdditionalProperties, ..} ) <$> f v1beta1JSONSchemaPropsAdditionalProperties | 246 | true | true | 0 | 8 | 23 | 57 | 30 | 27 | null | null |
pgj/bead | src/Bead/View/TemplateAndComponentNames.hs | bsd-3-clause | names = fieldList ++ classList | 30 | names = fieldList ++ classList | 30 | names = fieldList ++ classList | 30 | false | false | 0 | 5 | 4 | 10 | 5 | 5 | null | null |
garetxe/cabal | Cabal/Distribution/Simple/BuildPaths.hs | bsd-3-clause | -- Implement proper name mangling for dynamical shared objects
-- libHS<packagename>-<compilerFlavour><compilerVersion>
-- e.g. libHSbase-2.1-ghc6.6.1.so
mkSharedLibName :: CompilerId -> UnitId -> String
mkSharedLibName (CompilerId compilerFlavor compilerVersion) lib
= "lib" ++ getHSLibraryName lib ++ "-" ++ comp <.> dllExtension
where comp = display compilerFlavor ++ display compilerVersion
-- ------------------------------------------------------------
-- * Platform file extensions
-- ------------------------------------------------------------
-- | Default extension for executable files on the current platform.
-- (typically @\"\"@ on Unix and @\"exe\"@ on Windows or OS\/2) | 691 | mkSharedLibName :: CompilerId -> UnitId -> String
mkSharedLibName (CompilerId compilerFlavor compilerVersion) lib
= "lib" ++ getHSLibraryName lib ++ "-" ++ comp <.> dllExtension
where comp = display compilerFlavor ++ display compilerVersion
-- ------------------------------------------------------------
-- * Platform file extensions
-- ------------------------------------------------------------
-- | Default extension for executable files on the current platform.
-- (typically @\"\"@ on Unix and @\"exe\"@ on Windows or OS\/2) | 537 | mkSharedLibName (CompilerId compilerFlavor compilerVersion) lib
= "lib" ++ getHSLibraryName lib ++ "-" ++ comp <.> dllExtension
where comp = display compilerFlavor ++ display compilerVersion
-- ------------------------------------------------------------
-- * Platform file extensions
-- ------------------------------------------------------------
-- | Default extension for executable files on the current platform.
-- (typically @\"\"@ on Unix and @\"exe\"@ on Windows or OS\/2) | 487 | true | true | 3 | 10 | 81 | 86 | 42 | 44 | null | null |
ntc2/cryptol | src/Cryptol/Parser/NoPat.hs | bsd-3-clause | -- | Add annotations to exported declaration groups.
--
-- XXX: This isn't quite right: if a signature and binding have different
-- export specifications, this will favor the specification of the binding.
-- This is most likely the intended behavior, so it's probably fine, but it does
-- smell a bit.
annotTopDs :: [TopLevel [Decl]] -> StateT AnnotMap NoPatM [TopLevel Decl]
annotTopDs tds =
case tds of
(ds:dss) ->
do ds' <- annotDs (tlValue ds)
rest <- annotTopDs dss
if null ds'
then return rest
else return ([ ds { tlValue = d } | d <- ds' ] ++ rest)
[] -> return []
-- | Add annotations, keeping track of which annotation are not yet used up. | 712 | annotTopDs :: [TopLevel [Decl]] -> StateT AnnotMap NoPatM [TopLevel Decl]
annotTopDs tds =
case tds of
(ds:dss) ->
do ds' <- annotDs (tlValue ds)
rest <- annotTopDs dss
if null ds'
then return rest
else return ([ ds { tlValue = d } | d <- ds' ] ++ rest)
[] -> return []
-- | Add annotations, keeping track of which annotation are not yet used up. | 409 | annotTopDs tds =
case tds of
(ds:dss) ->
do ds' <- annotDs (tlValue ds)
rest <- annotTopDs dss
if null ds'
then return rest
else return ([ ds { tlValue = d } | d <- ds' ] ++ rest)
[] -> return []
-- | Add annotations, keeping track of which annotation are not yet used up. | 335 | true | true | 0 | 16 | 182 | 149 | 77 | 72 | null | null |
michaeljklein/CPlug | src/Data/Text/Aux.hs | bsd-3-clause | -- | See `wordLines`
unWordLines :: [[T.Text]] -> T.Text
unWordLines = T.unlines . map T.unwords | 96 | unWordLines :: [[T.Text]] -> T.Text
unWordLines = T.unlines . map T.unwords | 75 | unWordLines = T.unlines . map T.unwords | 39 | true | true | 0 | 9 | 14 | 43 | 21 | 22 | null | null |
elieux/ghc | compiler/utils/Util.hs | bsd-3-clause | mapSnd f xys = [(x, f y) | (x,y) <- xys] | 40 | mapSnd f xys = [(x, f y) | (x,y) <- xys] | 40 | mapSnd f xys = [(x, f y) | (x,y) <- xys] | 40 | false | false | 0 | 8 | 10 | 37 | 20 | 17 | null | null |
aldld/hasp | src/Semantics.hs | bsd-3-clause | defaultSK :: SKMap
defaultSK = Map.fromList
[ ("define", SK True define)
, ("lambda", SK False lambda)
, ("if", SK False ifStmt)
, ("apply", SK False applyHFunc)
, ("and", SK False boolAnd)
, ("or", SK False boolOr)
, ("let", SK False letStmt) ] | 273 | defaultSK :: SKMap
defaultSK = Map.fromList
[ ("define", SK True define)
, ("lambda", SK False lambda)
, ("if", SK False ifStmt)
, ("apply", SK False applyHFunc)
, ("and", SK False boolAnd)
, ("or", SK False boolOr)
, ("let", SK False letStmt) ] | 273 | defaultSK = Map.fromList
[ ("define", SK True define)
, ("lambda", SK False lambda)
, ("if", SK False ifStmt)
, ("apply", SK False applyHFunc)
, ("and", SK False boolAnd)
, ("or", SK False boolOr)
, ("let", SK False letStmt) ] | 254 | false | true | 0 | 8 | 69 | 114 | 64 | 50 | null | null |
pparkkin/eta | compiler/ETA/CodeGen/Utils.hs | bsd-3-clause | cgLit :: Literal -> (FieldType, Code)
cgLit (MachChar c) = (jint, iconst jint . fromIntegral $ ord c) | 110 | cgLit :: Literal -> (FieldType, Code)
cgLit (MachChar c) = (jint, iconst jint . fromIntegral $ ord c) | 110 | cgLit (MachChar c) = (jint, iconst jint . fromIntegral $ ord c) | 72 | false | true | 0 | 9 | 26 | 56 | 27 | 29 | null | null |
psibi/cabal2nix | src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs | bsd-3-clause | libNixName "gconf-2.0" = return "GConf" | 64 | libNixName "gconf-2.0" = return "GConf" | 64 | libNixName "gconf-2.0" = return "GConf" | 64 | false | false | 0 | 5 | 29 | 12 | 5 | 7 | null | null |
uduki/hsQt | Qtc/Gui/QGraphicsItemAnimation.hs | bsd-2-clause | verticalShearAt :: QGraphicsItemAnimation a -> ((Double)) -> IO (Double)
verticalShearAt x0 (x1)
= withDoubleResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QGraphicsItemAnimation_verticalShearAt cobj_x0 (toCDouble x1) | 224 | verticalShearAt :: QGraphicsItemAnimation a -> ((Double)) -> IO (Double)
verticalShearAt x0 (x1)
= withDoubleResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QGraphicsItemAnimation_verticalShearAt cobj_x0 (toCDouble x1) | 224 | verticalShearAt x0 (x1)
= withDoubleResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QGraphicsItemAnimation_verticalShearAt cobj_x0 (toCDouble x1) | 151 | false | true | 0 | 9 | 33 | 69 | 35 | 34 | null | null |
swift-nav/plover | src/Language/Plover/Types.hs | mit | getType (Seq pos a b) = getType b | 33 | getType (Seq pos a b) = getType b | 33 | getType (Seq pos a b) = getType b | 33 | false | false | 0 | 6 | 7 | 23 | 10 | 13 | null | null |
DavidAlphaFox/ghc | libraries/Cabal/Cabal/Distribution/PackageDescription/Parse.hs | bsd-3-clause | deprecField _ = cabalBug "'deprecField' called on a non-field" | 62 | deprecField _ = cabalBug "'deprecField' called on a non-field" | 62 | deprecField _ = cabalBug "'deprecField' called on a non-field" | 62 | false | false | 0 | 5 | 8 | 12 | 5 | 7 | null | null |
raboof/xmobar | src/Parsers.hs | bsd-3-clause | -- | Parses the output template string
templateStringParser :: Config -> Parser (String,String,String)
templateStringParser c = do
s <- allTillSep c
com <- templateCommandParser c
ss <- allTillSep c
return (com, s, ss)
-- | Parses the command part of the template string | 282 | templateStringParser :: Config -> Parser (String,String,String)
templateStringParser c = do
s <- allTillSep c
com <- templateCommandParser c
ss <- allTillSep c
return (com, s, ss)
-- | Parses the command part of the template string | 243 | templateStringParser c = do
s <- allTillSep c
com <- templateCommandParser c
ss <- allTillSep c
return (com, s, ss)
-- | Parses the command part of the template string | 179 | true | true | 0 | 9 | 54 | 82 | 39 | 43 | null | null |
super1ha1/haskell | src/intro/HW01Tests.hs | mit | -- Exercise 4 -----------------------------------------
ex4Tests :: [Test]
ex4Tests = [] | 89 | ex4Tests :: [Test]
ex4Tests = [] | 32 | ex4Tests = [] | 13 | true | true | 0 | 7 | 10 | 24 | 11 | 13 | null | null |
verement/etamoo | src/MOO/Object.hs | bsd-3-clause | getLocation :: Object -> ObjId
getLocation = objectForMaybe . objectLocation | 76 | getLocation :: Object -> ObjId
getLocation = objectForMaybe . objectLocation | 76 | getLocation = objectForMaybe . objectLocation | 45 | false | true | 0 | 5 | 9 | 19 | 10 | 9 | null | null |
edsko/cabal | Cabal/src/Distribution/Simple/Build.hs | bsd-3-clause | -- | Translate a lib-style 'TestSuite' component into a lib + exe for building
testSuiteLibV09AsLibAndExe :: PackageDescription
-> TestSuite
-> ComponentLocalBuildInfo
-> LocalBuildInfo
-> FilePath
-> FilePath
-> (PackageDescription,
Library, ComponentLocalBuildInfo,
LocalBuildInfo,
IPI.InstalledPackageInfo,
Executable, ComponentLocalBuildInfo)
testSuiteLibV09AsLibAndExe pkg_descr
test@TestSuite { testInterface = TestSuiteLibV09 _ m }
clbi lbi distPref pwd =
(pkg, lib, libClbi, lbi, ipi, exe, exeClbi)
where
bi = testBuildInfo test
lib = Library {
exposedModules = [ m ],
reexportedModules = [],
requiredSignatures = [],
exposedSignatures = [],
libExposed = True,
libBuildInfo = bi
}
-- NB: temporary hack; I have a refactor which solves this
cid = computeComponentId (package pkg_descr)
(CTestName (testName test))
(map ((\(SimpleUnitId cid0) -> cid0) . fst)
(componentPackageDeps clbi))
(flagAssignment lbi)
uid = SimpleUnitId cid
(pkg_name, compat_key) = computeCompatPackageKey
(compiler lbi) (package pkg_descr)
(CTestName (testName test)) uid
libClbi = LibComponentLocalBuildInfo
{ componentPackageDeps = componentPackageDeps clbi
, componentPackageRenaming = componentPackageRenaming clbi
, componentUnitId = uid
, componentCompatPackageKey = compat_key
, componentExposedModules = [IPI.ExposedModule m Nothing]
}
pkg = pkg_descr {
package = (package pkg_descr) { pkgName = pkg_name }
, buildDepends = targetBuildDepends $ testBuildInfo test
, executables = []
, testSuites = []
, library = Just lib
}
ipi = inplaceInstalledPackageInfo pwd distPref pkg (AbiHash "") lib lbi libClbi
testDir = buildDir lbi </> stubName test
</> stubName test ++ "-tmp"
testLibDep = thisPackageVersion $ package pkg
exe = Executable {
exeName = stubName test,
modulePath = stubFilePath test,
buildInfo = (testBuildInfo test) {
hsSourceDirs = [ testDir ],
targetBuildDepends = testLibDep
: (targetBuildDepends $ testBuildInfo test),
targetBuildRenaming = Map.empty
}
}
-- | The stub executable needs a new 'ComponentLocalBuildInfo'
-- that exposes the relevant test suite library.
exeClbi = ExeComponentLocalBuildInfo {
componentPackageDeps =
(IPI.installedUnitId ipi, packageId ipi)
: (filter (\(_, x) -> let PackageName name = pkgName x
in name == "Cabal" || name == "base")
(componentPackageDeps clbi)),
componentPackageRenaming = Map.empty
} | 3,532 | testSuiteLibV09AsLibAndExe :: PackageDescription
-> TestSuite
-> ComponentLocalBuildInfo
-> LocalBuildInfo
-> FilePath
-> FilePath
-> (PackageDescription,
Library, ComponentLocalBuildInfo,
LocalBuildInfo,
IPI.InstalledPackageInfo,
Executable, ComponentLocalBuildInfo)
testSuiteLibV09AsLibAndExe pkg_descr
test@TestSuite { testInterface = TestSuiteLibV09 _ m }
clbi lbi distPref pwd =
(pkg, lib, libClbi, lbi, ipi, exe, exeClbi)
where
bi = testBuildInfo test
lib = Library {
exposedModules = [ m ],
reexportedModules = [],
requiredSignatures = [],
exposedSignatures = [],
libExposed = True,
libBuildInfo = bi
}
-- NB: temporary hack; I have a refactor which solves this
cid = computeComponentId (package pkg_descr)
(CTestName (testName test))
(map ((\(SimpleUnitId cid0) -> cid0) . fst)
(componentPackageDeps clbi))
(flagAssignment lbi)
uid = SimpleUnitId cid
(pkg_name, compat_key) = computeCompatPackageKey
(compiler lbi) (package pkg_descr)
(CTestName (testName test)) uid
libClbi = LibComponentLocalBuildInfo
{ componentPackageDeps = componentPackageDeps clbi
, componentPackageRenaming = componentPackageRenaming clbi
, componentUnitId = uid
, componentCompatPackageKey = compat_key
, componentExposedModules = [IPI.ExposedModule m Nothing]
}
pkg = pkg_descr {
package = (package pkg_descr) { pkgName = pkg_name }
, buildDepends = targetBuildDepends $ testBuildInfo test
, executables = []
, testSuites = []
, library = Just lib
}
ipi = inplaceInstalledPackageInfo pwd distPref pkg (AbiHash "") lib lbi libClbi
testDir = buildDir lbi </> stubName test
</> stubName test ++ "-tmp"
testLibDep = thisPackageVersion $ package pkg
exe = Executable {
exeName = stubName test,
modulePath = stubFilePath test,
buildInfo = (testBuildInfo test) {
hsSourceDirs = [ testDir ],
targetBuildDepends = testLibDep
: (targetBuildDepends $ testBuildInfo test),
targetBuildRenaming = Map.empty
}
}
-- | The stub executable needs a new 'ComponentLocalBuildInfo'
-- that exposes the relevant test suite library.
exeClbi = ExeComponentLocalBuildInfo {
componentPackageDeps =
(IPI.installedUnitId ipi, packageId ipi)
: (filter (\(_, x) -> let PackageName name = pkgName x
in name == "Cabal" || name == "base")
(componentPackageDeps clbi)),
componentPackageRenaming = Map.empty
} | 3,453 | testSuiteLibV09AsLibAndExe pkg_descr
test@TestSuite { testInterface = TestSuiteLibV09 _ m }
clbi lbi distPref pwd =
(pkg, lib, libClbi, lbi, ipi, exe, exeClbi)
where
bi = testBuildInfo test
lib = Library {
exposedModules = [ m ],
reexportedModules = [],
requiredSignatures = [],
exposedSignatures = [],
libExposed = True,
libBuildInfo = bi
}
-- NB: temporary hack; I have a refactor which solves this
cid = computeComponentId (package pkg_descr)
(CTestName (testName test))
(map ((\(SimpleUnitId cid0) -> cid0) . fst)
(componentPackageDeps clbi))
(flagAssignment lbi)
uid = SimpleUnitId cid
(pkg_name, compat_key) = computeCompatPackageKey
(compiler lbi) (package pkg_descr)
(CTestName (testName test)) uid
libClbi = LibComponentLocalBuildInfo
{ componentPackageDeps = componentPackageDeps clbi
, componentPackageRenaming = componentPackageRenaming clbi
, componentUnitId = uid
, componentCompatPackageKey = compat_key
, componentExposedModules = [IPI.ExposedModule m Nothing]
}
pkg = pkg_descr {
package = (package pkg_descr) { pkgName = pkg_name }
, buildDepends = targetBuildDepends $ testBuildInfo test
, executables = []
, testSuites = []
, library = Just lib
}
ipi = inplaceInstalledPackageInfo pwd distPref pkg (AbiHash "") lib lbi libClbi
testDir = buildDir lbi </> stubName test
</> stubName test ++ "-tmp"
testLibDep = thisPackageVersion $ package pkg
exe = Executable {
exeName = stubName test,
modulePath = stubFilePath test,
buildInfo = (testBuildInfo test) {
hsSourceDirs = [ testDir ],
targetBuildDepends = testLibDep
: (targetBuildDepends $ testBuildInfo test),
targetBuildRenaming = Map.empty
}
}
-- | The stub executable needs a new 'ComponentLocalBuildInfo'
-- that exposes the relevant test suite library.
exeClbi = ExeComponentLocalBuildInfo {
componentPackageDeps =
(IPI.installedUnitId ipi, packageId ipi)
: (filter (\(_, x) -> let PackageName name = pkgName x
in name == "Cabal" || name == "base")
(componentPackageDeps clbi)),
componentPackageRenaming = Map.empty
} | 2,899 | true | true | 0 | 16 | 1,505 | 657 | 364 | 293 | null | null |
michaelficarra/purescript | src/Language/PureScript/Docs/Types.hs | mit | asAssociativity :: Parse PackageError P.Associativity
asAssociativity = withString (maybe (Left InvalidFixity) Right . parseAssociativity) | 138 | asAssociativity :: Parse PackageError P.Associativity
asAssociativity = withString (maybe (Left InvalidFixity) Right . parseAssociativity) | 138 | asAssociativity = withString (maybe (Left InvalidFixity) Right . parseAssociativity) | 84 | false | true | 0 | 10 | 13 | 39 | 19 | 20 | null | null |
vedgar/mlr | 2016 Kolokvij/Z2.hs | unlicense | not_c = unary not | 17 | not_c = unary not | 17 | not_c = unary not | 17 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
msakai/multiset-large | Data/IntMultiSet/Large.hs | bsd-3-clause | {--------------------------------------------------------------------
Construction
--------------------------------------------------------------------}
-- | /O(1)/. The empty mutli set.
empty :: IntMultiSet
empty = MS Map.empty | 231 | empty :: IntMultiSet
empty = MS Map.empty | 41 | empty = MS Map.empty | 20 | true | true | 0 | 6 | 19 | 18 | 10 | 8 | null | null |
Chouser/mal | haskell/Core.hs | mpl-2.0 | _sequential_Q _ = MalFalse | 26 | _sequential_Q _ = MalFalse | 26 | _sequential_Q _ = MalFalse | 26 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
green-haskell/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | eqResult OrdGE = true_Expr | 31 | eqResult OrdGE = true_Expr | 31 | eqResult OrdGE = true_Expr | 31 | false | false | 0 | 5 | 8 | 9 | 4 | 5 | null | null |
allanderek/ipclib | Language/Pepa/Compile/TimedSystemEquation.hs | gpl-2.0 | timedSystemEqnToRateEqns :: CanonicalSuccessors
-> TimedSystemEquation
-> [ RateEquation ]
timedSystemEqnToRateEqns sTransitions =
tseRateEqns
where
tseRateEqns :: TSEcomp -> [ RateEquation ]
tseRateEqns (TSEderivatives derivs actions)
| null actions = nonCooperating
| otherwise =
(error "Cooperating arrays not yet implemented in dizzy translation")
where
-- rate Equations for each of the sequential derivatives
-- these will be split up into those corresponding to the
-- actions in the cooperation set and those not.
singleRateEqns = concatMap sequentialRateEqns derivs
nonCooperating = filter (not . isCooperating) singleRateEqns
_cooperating = [ massCooperation a sources targets rate |
sources <- undefined -- as yet
, targets <- undefined -- as yet
, a <- actions
]
-- This corresponds to the \Gamma(w,\theta) equation of the
-- paper which this implementation follows.
-- It does not (but should) check that any of the rates are
-- on components with no concentration (see the paper).
rate = foldr1 minRates $ map rateEqnRate cooperates
cooperates = filter isCooperating singleRateEqns
isCooperating :: RateEquation -> Bool
isCooperating re = elem (rateEqnAction re) actions
tseRateEqns (TSEcooperation left actions right) =
leftNonL ++ rightNonL ++ cooperates
where
leftRateEqns = tseRateEqns left
rightRateEqns = tseRateEqns right
leftNonL = filter (not . isCooperating) leftRateEqns
rightNonL = filter (not . isCooperating) rightRateEqns
leftCoops = filter isCooperating leftRateEqns
rightCoops = filter isCooperating rightRateEqns
isCooperating :: RateEquation -> Bool
isCooperating re = elem (rateEqnAction re) actions
cooperates = [ combineCoops a b | a <- leftCoops, b <- rightCoops ]
combineCoops :: RateEquation -> RateEquation -> RateEquation
combineCoops reLeft reRight =
RateEquation { rateEqnAction = rateEqnAction reLeft
, rateEqnSrc = (rateEqnSrc reLeft) ++
(rateEqnSrc reRight)
, rateEqnTgt = (rateEqnTgt reLeft) ++
(rateEqnTgt reRight)
, rateEqnRate = minRates (rateEqnRate reLeft)
(rateEqnRate reRight)
}
sequentialRateEqns :: ParsedComponentId -> [ RateEquation ]
sequentialRateEqns ident =
map rateEqnOfTrans relevantTrans
where
relevantTrans = filter ((== ident) . fst) sTransitions
-- we turn a transition of a sequential component into a
-- rate equation, the key point is that the weight is simply
-- 1
rateEqnOfTrans :: CanonicalSuccessor -> RateEquation
rateEqnOfTrans (source, (trans, target)) =
RateEquation { rateEqnAction = aName
, rateEqnSrc = [ source ]
, rateEqnTgt = [ target ]
, rateEqnRate = TSErate source rate
}
where
aName = actionNameOfTrans trans
rate = pepaTransRate trans
massCooperation :: ActionIdentifier -> CompWeight -> CompWeight
-> TSErate -> RateEquation
massCooperation a src tar rate =
RateEquation { rateEqnAction = a
, rateEqnSrc = src
, rateEqnTgt = tar
, rateEqnRate = rate
}
{- NOTE: clearly this is not correct, it is merely a place holder until I
do the correct thing
-} | 3,748 | timedSystemEqnToRateEqns :: CanonicalSuccessors
-> TimedSystemEquation
-> [ RateEquation ]
timedSystemEqnToRateEqns sTransitions =
tseRateEqns
where
tseRateEqns :: TSEcomp -> [ RateEquation ]
tseRateEqns (TSEderivatives derivs actions)
| null actions = nonCooperating
| otherwise =
(error "Cooperating arrays not yet implemented in dizzy translation")
where
-- rate Equations for each of the sequential derivatives
-- these will be split up into those corresponding to the
-- actions in the cooperation set and those not.
singleRateEqns = concatMap sequentialRateEqns derivs
nonCooperating = filter (not . isCooperating) singleRateEqns
_cooperating = [ massCooperation a sources targets rate |
sources <- undefined -- as yet
, targets <- undefined -- as yet
, a <- actions
]
-- This corresponds to the \Gamma(w,\theta) equation of the
-- paper which this implementation follows.
-- It does not (but should) check that any of the rates are
-- on components with no concentration (see the paper).
rate = foldr1 minRates $ map rateEqnRate cooperates
cooperates = filter isCooperating singleRateEqns
isCooperating :: RateEquation -> Bool
isCooperating re = elem (rateEqnAction re) actions
tseRateEqns (TSEcooperation left actions right) =
leftNonL ++ rightNonL ++ cooperates
where
leftRateEqns = tseRateEqns left
rightRateEqns = tseRateEqns right
leftNonL = filter (not . isCooperating) leftRateEqns
rightNonL = filter (not . isCooperating) rightRateEqns
leftCoops = filter isCooperating leftRateEqns
rightCoops = filter isCooperating rightRateEqns
isCooperating :: RateEquation -> Bool
isCooperating re = elem (rateEqnAction re) actions
cooperates = [ combineCoops a b | a <- leftCoops, b <- rightCoops ]
combineCoops :: RateEquation -> RateEquation -> RateEquation
combineCoops reLeft reRight =
RateEquation { rateEqnAction = rateEqnAction reLeft
, rateEqnSrc = (rateEqnSrc reLeft) ++
(rateEqnSrc reRight)
, rateEqnTgt = (rateEqnTgt reLeft) ++
(rateEqnTgt reRight)
, rateEqnRate = minRates (rateEqnRate reLeft)
(rateEqnRate reRight)
}
sequentialRateEqns :: ParsedComponentId -> [ RateEquation ]
sequentialRateEqns ident =
map rateEqnOfTrans relevantTrans
where
relevantTrans = filter ((== ident) . fst) sTransitions
-- we turn a transition of a sequential component into a
-- rate equation, the key point is that the weight is simply
-- 1
rateEqnOfTrans :: CanonicalSuccessor -> RateEquation
rateEqnOfTrans (source, (trans, target)) =
RateEquation { rateEqnAction = aName
, rateEqnSrc = [ source ]
, rateEqnTgt = [ target ]
, rateEqnRate = TSErate source rate
}
where
aName = actionNameOfTrans trans
rate = pepaTransRate trans
massCooperation :: ActionIdentifier -> CompWeight -> CompWeight
-> TSErate -> RateEquation
massCooperation a src tar rate =
RateEquation { rateEqnAction = a
, rateEqnSrc = src
, rateEqnTgt = tar
, rateEqnRate = rate
}
{- NOTE: clearly this is not correct, it is merely a place holder until I
do the correct thing
-} | 3,748 | timedSystemEqnToRateEqns sTransitions =
tseRateEqns
where
tseRateEqns :: TSEcomp -> [ RateEquation ]
tseRateEqns (TSEderivatives derivs actions)
| null actions = nonCooperating
| otherwise =
(error "Cooperating arrays not yet implemented in dizzy translation")
where
-- rate Equations for each of the sequential derivatives
-- these will be split up into those corresponding to the
-- actions in the cooperation set and those not.
singleRateEqns = concatMap sequentialRateEqns derivs
nonCooperating = filter (not . isCooperating) singleRateEqns
_cooperating = [ massCooperation a sources targets rate |
sources <- undefined -- as yet
, targets <- undefined -- as yet
, a <- actions
]
-- This corresponds to the \Gamma(w,\theta) equation of the
-- paper which this implementation follows.
-- It does not (but should) check that any of the rates are
-- on components with no concentration (see the paper).
rate = foldr1 minRates $ map rateEqnRate cooperates
cooperates = filter isCooperating singleRateEqns
isCooperating :: RateEquation -> Bool
isCooperating re = elem (rateEqnAction re) actions
tseRateEqns (TSEcooperation left actions right) =
leftNonL ++ rightNonL ++ cooperates
where
leftRateEqns = tseRateEqns left
rightRateEqns = tseRateEqns right
leftNonL = filter (not . isCooperating) leftRateEqns
rightNonL = filter (not . isCooperating) rightRateEqns
leftCoops = filter isCooperating leftRateEqns
rightCoops = filter isCooperating rightRateEqns
isCooperating :: RateEquation -> Bool
isCooperating re = elem (rateEqnAction re) actions
cooperates = [ combineCoops a b | a <- leftCoops, b <- rightCoops ]
combineCoops :: RateEquation -> RateEquation -> RateEquation
combineCoops reLeft reRight =
RateEquation { rateEqnAction = rateEqnAction reLeft
, rateEqnSrc = (rateEqnSrc reLeft) ++
(rateEqnSrc reRight)
, rateEqnTgt = (rateEqnTgt reLeft) ++
(rateEqnTgt reRight)
, rateEqnRate = minRates (rateEqnRate reLeft)
(rateEqnRate reRight)
}
sequentialRateEqns :: ParsedComponentId -> [ RateEquation ]
sequentialRateEqns ident =
map rateEqnOfTrans relevantTrans
where
relevantTrans = filter ((== ident) . fst) sTransitions
-- we turn a transition of a sequential component into a
-- rate equation, the key point is that the weight is simply
-- 1
rateEqnOfTrans :: CanonicalSuccessor -> RateEquation
rateEqnOfTrans (source, (trans, target)) =
RateEquation { rateEqnAction = aName
, rateEqnSrc = [ source ]
, rateEqnTgt = [ target ]
, rateEqnRate = TSErate source rate
}
where
aName = actionNameOfTrans trans
rate = pepaTransRate trans
massCooperation :: ActionIdentifier -> CompWeight -> CompWeight
-> TSErate -> RateEquation
massCooperation a src tar rate =
RateEquation { rateEqnAction = a
, rateEqnSrc = src
, rateEqnTgt = tar
, rateEqnRate = rate
}
{- NOTE: clearly this is not correct, it is merely a place holder until I
do the correct thing
-} | 3,606 | false | true | 1 | 9 | 1,237 | 669 | 358 | 311 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Unit.hs | mit | maxShields ProtossObservatory = 250 | 35 | maxShields ProtossObservatory = 250 | 35 | maxShields ProtossObservatory = 250 | 35 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
olorin/nagios-perfdata | src/Data/Nagios/Perfdata/Metric.hs | bsd-3-clause | uomFromString "KB" = Kilobyte | 29 | uomFromString "KB" = Kilobyte | 29 | uomFromString "KB" = Kilobyte | 29 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
bitemyapp/roshask | Tests/MsgGen.hs | bsd-3-clause | testGeneratedService :: B.ByteString -> FilePath -> FilePath -> FilePath -> [B.ByteString] -> MsgInfo TestTree
testGeneratedService packagePath srvPath requestGolden responseGolden pkgMsgs =
do srv <- liftIO $
either error id <$> parseSrv srvPath
golds <- liftIO $ mapM B.readFile [requestGolden, responseGolden]
(request, response) <- generateSrvTypes packagePath pkgMsgs srv
return $ testGroup "Generated Haskell" $ zipWith3
(\name gold gen -> testCase name $ gold @=? gen) [srvPath ++" request", srvPath++" response"] golds [request, response]
-- | Precondition: cachePkg has been called | 633 | testGeneratedService :: B.ByteString -> FilePath -> FilePath -> FilePath -> [B.ByteString] -> MsgInfo TestTree
testGeneratedService packagePath srvPath requestGolden responseGolden pkgMsgs =
do srv <- liftIO $
either error id <$> parseSrv srvPath
golds <- liftIO $ mapM B.readFile [requestGolden, responseGolden]
(request, response) <- generateSrvTypes packagePath pkgMsgs srv
return $ testGroup "Generated Haskell" $ zipWith3
(\name gold gen -> testCase name $ gold @=? gen) [srvPath ++" request", srvPath++" response"] golds [request, response]
-- | Precondition: cachePkg has been called | 633 | testGeneratedService packagePath srvPath requestGolden responseGolden pkgMsgs =
do srv <- liftIO $
either error id <$> parseSrv srvPath
golds <- liftIO $ mapM B.readFile [requestGolden, responseGolden]
(request, response) <- generateSrvTypes packagePath pkgMsgs srv
return $ testGroup "Generated Haskell" $ zipWith3
(\name gold gen -> testCase name $ gold @=? gen) [srvPath ++" request", srvPath++" response"] golds [request, response]
-- | Precondition: cachePkg has been called | 522 | false | true | 0 | 13 | 121 | 186 | 93 | 93 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/basicTypes/DataCon.hs | bsd-3-clause | -- | The \"signature\" of the 'DataCon' returns, in order:
--
-- 1) The result of 'dataConAllTyVars',
--
-- 2) All the 'ThetaType's relating to the 'DataCon' (coercion, dictionary, implicit
-- parameter - whatever)
--
-- 3) The type arguments to the constructor
--
-- 4) The /original/ result type of the 'DataCon'
dataConSig :: DataCon -> ([TyVar], ThetaType, [Type], Type)
dataConSig (MkData {dcUnivTyVars = univ_tvs, dcExTyVars = ex_tvs,
dcEqSpec = eq_spec, dcOtherTheta = theta,
dcOrigArgTys = arg_tys, dcOrigResTy = res_ty})
= (univ_tvs ++ ex_tvs, eqSpecPreds eq_spec ++ theta, arg_tys, res_ty) | 645 | dataConSig :: DataCon -> ([TyVar], ThetaType, [Type], Type)
dataConSig (MkData {dcUnivTyVars = univ_tvs, dcExTyVars = ex_tvs,
dcEqSpec = eq_spec, dcOtherTheta = theta,
dcOrigArgTys = arg_tys, dcOrigResTy = res_ty})
= (univ_tvs ++ ex_tvs, eqSpecPreds eq_spec ++ theta, arg_tys, res_ty) | 327 | dataConSig (MkData {dcUnivTyVars = univ_tvs, dcExTyVars = ex_tvs,
dcEqSpec = eq_spec, dcOtherTheta = theta,
dcOrigArgTys = arg_tys, dcOrigResTy = res_ty})
= (univ_tvs ++ ex_tvs, eqSpecPreds eq_spec ++ theta, arg_tys, res_ty) | 267 | true | true | 18 | 11 | 136 | 130 | 72 | 58 | null | null |
grnet/snf-ganeti | src/Ganeti/Constants.hs | bsd-2-clause | ddmAttach :: String
ddmAttach = Types.ddmFullToRaw DdmFullAttach | 64 | ddmAttach :: String
ddmAttach = Types.ddmFullToRaw DdmFullAttach | 64 | ddmAttach = Types.ddmFullToRaw DdmFullAttach | 44 | false | true | 0 | 6 | 6 | 22 | 9 | 13 | null | null |
Soostone/wunderground | src/WUnderground/Types.hs | mit | runWU :: WUConfig -> WU m a -> m a
runWU e f = runReaderT (unWU f) e | 68 | runWU :: WUConfig -> WU m a -> m a
runWU e f = runReaderT (unWU f) e | 68 | runWU e f = runReaderT (unWU f) e | 33 | false | true | 0 | 7 | 17 | 43 | 20 | 23 | null | null |
capitanbatata/sandbox | scrapping-expressions-boilerplate/src/ResetIds.hs | gpl-3.0 | resetExp (FuncCall fid exps) = FuncCall (resetFuncId fid) (resetExp <$> exps) | 77 | resetExp (FuncCall fid exps) = FuncCall (resetFuncId fid) (resetExp <$> exps) | 77 | resetExp (FuncCall fid exps) = FuncCall (resetFuncId fid) (resetExp <$> exps) | 77 | false | false | 0 | 7 | 10 | 35 | 17 | 18 | null | null |
allonsy/brain | runner/BrainRunner.hs | mit | executeCommand cmd@(Bracket cmds) = do
cen <- getCenter
if cen == 0 then return ()
else do
executeBlock cmds
executeCommand cmd | 141 | executeCommand cmd@(Bracket cmds) = do
cen <- getCenter
if cen == 0 then return ()
else do
executeBlock cmds
executeCommand cmd | 141 | executeCommand cmd@(Bracket cmds) = do
cen <- getCenter
if cen == 0 then return ()
else do
executeBlock cmds
executeCommand cmd | 141 | false | false | 0 | 10 | 34 | 57 | 26 | 31 | null | null |
ameingast/slisp | src/SLISP/Parser.hs | bsd-3-clause | parseBase :: GenParser Char st [Expression]
parseBase =
(parseAtom <|>
parseList <|>
parseQExpr <|>
parseFExpr) `sepEndBy` parseSpaces | 145 | parseBase :: GenParser Char st [Expression]
parseBase =
(parseAtom <|>
parseList <|>
parseQExpr <|>
parseFExpr) `sepEndBy` parseSpaces | 145 | parseBase =
(parseAtom <|>
parseList <|>
parseQExpr <|>
parseFExpr) `sepEndBy` parseSpaces | 101 | false | true | 0 | 9 | 27 | 42 | 23 | 19 | null | null |
vyorkin-archive/assignment | api/src/Storage.hs | mit | connect :: SqlPersistT (ResourceT (NoLoggingT IO)) a -> IO a
connect = runNoLoggingT . runResourceT . withSqliteConn "assignment.sqlite3" . runSqlConn | 150 | connect :: SqlPersistT (ResourceT (NoLoggingT IO)) a -> IO a
connect = runNoLoggingT . runResourceT . withSqliteConn "assignment.sqlite3" . runSqlConn | 150 | connect = runNoLoggingT . runResourceT . withSqliteConn "assignment.sqlite3" . runSqlConn | 89 | false | true | 0 | 10 | 19 | 50 | 24 | 26 | null | null |
alpheccar/Signal | Transform.hs | bsd-3-clause | testFFT1 :: Sample a => Int -> Signal a -> U.Vector (Complex Double)
testFFT1 n s = U.convert . F.fft . U.convert . toVectorBS . mapBS ((:+ 0) . toDouble) . takeVectorS n $ s | 174 | testFFT1 :: Sample a => Int -> Signal a -> U.Vector (Complex Double)
testFFT1 n s = U.convert . F.fft . U.convert . toVectorBS . mapBS ((:+ 0) . toDouble) . takeVectorS n $ s | 174 | testFFT1 n s = U.convert . F.fft . U.convert . toVectorBS . mapBS ((:+ 0) . toDouble) . takeVectorS n $ s | 105 | false | true | 0 | 11 | 34 | 92 | 45 | 47 | null | null |
graninas/Haskell-Algorithms | Tests/TextRatio3.hs | gpl-3.0 | bolBalance outS inS | isFirst && isSecond = 0
| isFirst && (not isSecond) = (-1)
| (not isFirst) && isSecond = 1
| otherwise = 0
where
isFirst = outS `C.isInfixOf` letters
isSecond = inS `C.isInfixOf` letters
| 290 | symbolBalance outS inS | isFirst && isSecond = 0
| isFirst && (not isSecond) = (-1)
| (not isFirst) && isSecond = 1
| otherwise = 0
where
isFirst = outS `C.isInfixOf` letters
isSecond = inS `C.isInfixOf` letters | 290 | symbolBalance outS inS | isFirst && isSecond = 0
| isFirst && (not isSecond) = (-1)
| (not isFirst) && isSecond = 1
| otherwise = 0
where
isFirst = outS `C.isInfixOf` letters
isSecond = inS `C.isInfixOf` letters | 290 | false | false | 1 | 10 | 119 | 104 | 51 | 53 | null | null |
TomMD/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | mkCTupleOcc :: NameSpace -> Arity -> OccName
mkCTupleOcc ns ar = mkOccName ns str
where
str = "(%" ++ commas ++ "%)"
commas = take (ar-1) (repeat ',') | 163 | mkCTupleOcc :: NameSpace -> Arity -> OccName
mkCTupleOcc ns ar = mkOccName ns str
where
str = "(%" ++ commas ++ "%)"
commas = take (ar-1) (repeat ',') | 163 | mkCTupleOcc ns ar = mkOccName ns str
where
str = "(%" ++ commas ++ "%)"
commas = take (ar-1) (repeat ',') | 118 | false | true | 0 | 7 | 40 | 68 | 34 | 34 | null | null |
ndmitchell/hlint | src/Hint/ListRec.hs | bsd-3-clause | readPat (L _ (ConPat _ (L _ n) (PrefixCon [] [])))
| n == nameRdrName nilDataConName = Just $ Right BNil | 106 | readPat (L _ (ConPat _ (L _ n) (PrefixCon [] [])))
| n == nameRdrName nilDataConName = Just $ Right BNil | 106 | readPat (L _ (ConPat _ (L _ n) (PrefixCon [] [])))
| n == nameRdrName nilDataConName = Just $ Right BNil | 106 | false | false | 0 | 12 | 22 | 67 | 31 | 36 | null | null |
liamoc/dixi | Dixi/Config.hs | bsd-3-clause | headerForMathMethod LatexMathML = [shamlet|
<script type="text/javascript" src="http://math.etsu.edu/LaTeXMathML/LaTeXMathML.js">
<link rel="stylesheet" type="text/css" href="http://math.etsu.edu/LaTeXMathML/LaTeXMathML.standardarticle.css">
|] | 257 | headerForMathMethod LatexMathML = [shamlet|
<script type="text/javascript" src="http://math.etsu.edu/LaTeXMathML/LaTeXMathML.js">
<link rel="stylesheet" type="text/css" href="http://math.etsu.edu/LaTeXMathML/LaTeXMathML.standardarticle.css">
|] | 257 | headerForMathMethod LatexMathML = [shamlet|
<script type="text/javascript" src="http://math.etsu.edu/LaTeXMathML/LaTeXMathML.js">
<link rel="stylesheet" type="text/css" href="http://math.etsu.edu/LaTeXMathML/LaTeXMathML.standardarticle.css">
|] | 257 | false | false | 0 | 4 | 24 | 14 | 8 | 6 | null | null |
JPMoresmau/reactive-banana-sdl | src/Reactive/Banana/SDL/Util.hs | gpl-3.0 | -- | get the AddHandler from a EventSource
addHandler :: EventSource a -> AddHandler a
addHandler = fst | 103 | addHandler :: EventSource a -> AddHandler a
addHandler = fst | 60 | addHandler = fst | 16 | true | true | 0 | 6 | 17 | 22 | 11 | 11 | null | null |
imccoy/utopia | web/app/Main.hs | mit | inputTextFromEvent :: Ev.Event -> IO (Maybe Text)
inputTextFromEvent ev = do let evVal = (Unsafe.Coerce.unsafeCoerce ev :: JSVal)
v <- [js| `evVal.target.value |]
pure v | 223 | inputTextFromEvent :: Ev.Event -> IO (Maybe Text)
inputTextFromEvent ev = do let evVal = (Unsafe.Coerce.unsafeCoerce ev :: JSVal)
v <- [js| `evVal.target.value |]
pure v | 223 | inputTextFromEvent ev = do let evVal = (Unsafe.Coerce.unsafeCoerce ev :: JSVal)
v <- [js| `evVal.target.value |]
pure v | 173 | false | true | 0 | 12 | 78 | 67 | 34 | 33 | null | null |
krattai/noo-ebs | docs/zeroMQ-guide2/examples/Haskell/asyncsrv.hs | bsd-2-clause | serverTask :: Context -> IO ()
serverTask ctx = withSocket ctx XRep $ \frontend -> do
bind frontend "tcp://*:5570"
withSocket ctx XReq $ \backend -> do
bind backend "inproc://backend"
replicateM_ 5 (forkIO $ serverWorker ctx)
[S frontend' res1, S backend' res2] <- poll [S frontend In, S backend In] (-1)
when (res1 == In) $ do
_id <- receive frontend []
msg <- receive frontend []
print "Sending"
send backend _id [SndMore]
send backend msg []
when (res2 /= In) $ do
_id <- receive backend []
msg <- receive backend []
print "Sending"
send frontend _id [SndMore]
send frontend msg [] | 777 | serverTask :: Context -> IO ()
serverTask ctx = withSocket ctx XRep $ \frontend -> do
bind frontend "tcp://*:5570"
withSocket ctx XReq $ \backend -> do
bind backend "inproc://backend"
replicateM_ 5 (forkIO $ serverWorker ctx)
[S frontend' res1, S backend' res2] <- poll [S frontend In, S backend In] (-1)
when (res1 == In) $ do
_id <- receive frontend []
msg <- receive frontend []
print "Sending"
send backend _id [SndMore]
send backend msg []
when (res2 /= In) $ do
_id <- receive backend []
msg <- receive backend []
print "Sending"
send frontend _id [SndMore]
send frontend msg [] | 777 | serverTask ctx = withSocket ctx XRep $ \frontend -> do
bind frontend "tcp://*:5570"
withSocket ctx XReq $ \backend -> do
bind backend "inproc://backend"
replicateM_ 5 (forkIO $ serverWorker ctx)
[S frontend' res1, S backend' res2] <- poll [S frontend In, S backend In] (-1)
when (res1 == In) $ do
_id <- receive frontend []
msg <- receive frontend []
print "Sending"
send backend _id [SndMore]
send backend msg []
when (res2 /= In) $ do
_id <- receive backend []
msg <- receive backend []
print "Sending"
send frontend _id [SndMore]
send frontend msg [] | 746 | false | true | 0 | 18 | 294 | 289 | 130 | 159 | null | null |
mainland/nikola | src/Data/Array/Nikola/Language/Syntax.hs | bsd-3-clause | flattenT :: Type -> [Type]
flattenT (ScalarT (TupleT taus)) =
concatMap flattenT (map ScalarT taus) | 103 | flattenT :: Type -> [Type]
flattenT (ScalarT (TupleT taus)) =
concatMap flattenT (map ScalarT taus) | 103 | flattenT (ScalarT (TupleT taus)) =
concatMap flattenT (map ScalarT taus) | 76 | false | true | 0 | 11 | 18 | 52 | 24 | 28 | null | null |
brendanhay/gogol | gogol-cloudscheduler/gen/Network/Google/CloudScheduler/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'HTTPTargetHeaders' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'httpthAddtional'
hTTPTargetHeaders
:: HashMap Text Text -- ^ 'httpthAddtional'
-> HTTPTargetHeaders
hTTPTargetHeaders pHttpthAddtional_ =
HTTPTargetHeaders' {_httpthAddtional = _Coerce # pHttpthAddtional_} | 393 | hTTPTargetHeaders
:: HashMap Text Text -- ^ 'httpthAddtional'
-> HTTPTargetHeaders
hTTPTargetHeaders pHttpthAddtional_ =
HTTPTargetHeaders' {_httpthAddtional = _Coerce # pHttpthAddtional_} | 198 | hTTPTargetHeaders pHttpthAddtional_ =
HTTPTargetHeaders' {_httpthAddtional = _Coerce # pHttpthAddtional_} | 107 | true | true | 0 | 8 | 62 | 50 | 26 | 24 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.