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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bergmark/haskell-opaleye | opaleye-sqlite/src/Opaleye/SQLite/Internal/PackMap.hs | bsd-3-clause | extractAttrPE :: (primExpr -> String -> String) -> T.Tag -> primExpr
-> PM [(HPQ.Symbol, primExpr)] HPQ.PrimExpr
extractAttrPE mkName t pe = do
i <- new
let s = HPQ.Symbol (mkName pe i) t
write (s, pe)
return (HPQ.AttrExpr s)
-- | As 'extractAttrPE' but ignores the 'primExpr' when making the
-- fresh column name and just uses the supplied 'String' and 'T.Tag'. | 386 | extractAttrPE :: (primExpr -> String -> String) -> T.Tag -> primExpr
-> PM [(HPQ.Symbol, primExpr)] HPQ.PrimExpr
extractAttrPE mkName t pe = do
i <- new
let s = HPQ.Symbol (mkName pe i) t
write (s, pe)
return (HPQ.AttrExpr s)
-- | As 'extractAttrPE' but ignores the 'primExpr' when making the
-- fresh column name and just uses the supplied 'String' and 'T.Tag'. | 386 | extractAttrPE mkName t pe = do
i <- new
let s = HPQ.Symbol (mkName pe i) t
write (s, pe)
return (HPQ.AttrExpr s)
-- | As 'extractAttrPE' but ignores the 'primExpr' when making the
-- fresh column name and just uses the supplied 'String' and 'T.Tag'. | 258 | false | true | 0 | 13 | 85 | 125 | 61 | 64 | null | null |
notcome/ImplFP | src/Language/Core/Parser.hs | mit | applicable = P.try (atom >>= check)
where check (ENum _) = fail "numbers not applicable"
check a = return a
-- Indent-Sensitive Parsec | 152 | applicable = P.try (atom >>= check)
where check (ENum _) = fail "numbers not applicable"
check a = return a
-- Indent-Sensitive Parsec | 152 | applicable = P.try (atom >>= check)
where check (ENum _) = fail "numbers not applicable"
check a = return a
-- Indent-Sensitive Parsec | 152 | false | false | 1 | 7 | 40 | 48 | 24 | 24 | null | null |
ramirez7/configurator-applicative | src/Data/Configurator/Applicative/Print.hs | bsd-3-clause | toSExpr (OrNode children) = WFSList $ "Or" : fmap toSExpr children | 66 | toSExpr (OrNode children) = WFSList $ "Or" : fmap toSExpr children | 66 | toSExpr (OrNode children) = WFSList $ "Or" : fmap toSExpr children | 66 | false | false | 0 | 6 | 10 | 29 | 13 | 16 | null | null |
ehamberg/tribot | src/LanguageModel.hs | bsd-3-clause | randSentence :: DB.Connection -> StateT [B.ByteString] IO B.ByteString
randSentence db = do
current <- get
let n = length current
-- if empty, find a start word
when (null current) $ liftIO (getStartWord db) >>= \s -> put ["<s>",s]
-- get the last two words of the sentence under construction
lastTwo <- fmap (drop (n-2)) get
candidates <- liftIO $ DB.quickQuery' db
"SELECT w3,count FROM trigram WHERE w1 = ? AND w2 = ? AND w3 <> '<e>' COLLATE NOCASE"
(map DB.toSql lastTwo)
if null candidates
then returnCurrent
else do end <- liftIO $ areEndWords db lastTwo
hasN <-liftIO $ hasNext db lastTwo
-- if there is no next word: stop. also, if this is an end word,
-- stop with a probability that is equal to the sentence's length
-- (in per cent) even if there are more words
len <- liftM length get
stop <- liftM (<=len) $ liftIO $ getStdRandom (randomR (1,100))
if not hasN || (stop && end)
then returnCurrent
else do next <- liftIO $ pick (map conv candidates)
modify (++[next])
randSentence db
where returnCurrent = fmap (B.intercalate " " . tail) get
-- convert database rows to (bytestring, int) tuples | 1,321 | randSentence :: DB.Connection -> StateT [B.ByteString] IO B.ByteString
randSentence db = do
current <- get
let n = length current
-- if empty, find a start word
when (null current) $ liftIO (getStartWord db) >>= \s -> put ["<s>",s]
-- get the last two words of the sentence under construction
lastTwo <- fmap (drop (n-2)) get
candidates <- liftIO $ DB.quickQuery' db
"SELECT w3,count FROM trigram WHERE w1 = ? AND w2 = ? AND w3 <> '<e>' COLLATE NOCASE"
(map DB.toSql lastTwo)
if null candidates
then returnCurrent
else do end <- liftIO $ areEndWords db lastTwo
hasN <-liftIO $ hasNext db lastTwo
-- if there is no next word: stop. also, if this is an end word,
-- stop with a probability that is equal to the sentence's length
-- (in per cent) even if there are more words
len <- liftM length get
stop <- liftM (<=len) $ liftIO $ getStdRandom (randomR (1,100))
if not hasN || (stop && end)
then returnCurrent
else do next <- liftIO $ pick (map conv candidates)
modify (++[next])
randSentence db
where returnCurrent = fmap (B.intercalate " " . tail) get
-- convert database rows to (bytestring, int) tuples | 1,321 | randSentence db = do
current <- get
let n = length current
-- if empty, find a start word
when (null current) $ liftIO (getStartWord db) >>= \s -> put ["<s>",s]
-- get the last two words of the sentence under construction
lastTwo <- fmap (drop (n-2)) get
candidates <- liftIO $ DB.quickQuery' db
"SELECT w3,count FROM trigram WHERE w1 = ? AND w2 = ? AND w3 <> '<e>' COLLATE NOCASE"
(map DB.toSql lastTwo)
if null candidates
then returnCurrent
else do end <- liftIO $ areEndWords db lastTwo
hasN <-liftIO $ hasNext db lastTwo
-- if there is no next word: stop. also, if this is an end word,
-- stop with a probability that is equal to the sentence's length
-- (in per cent) even if there are more words
len <- liftM length get
stop <- liftM (<=len) $ liftIO $ getStdRandom (randomR (1,100))
if not hasN || (stop && end)
then returnCurrent
else do next <- liftIO $ pick (map conv candidates)
modify (++[next])
randSentence db
where returnCurrent = fmap (B.intercalate " " . tail) get
-- convert database rows to (bytestring, int) tuples | 1,250 | false | true | 0 | 17 | 411 | 347 | 168 | 179 | null | null |
DavidAlphaFox/darcs | harness/Darcs/Test/Patch/Check.hs | gpl-2.0 | has :: Prop -> [Prop] -> Bool
has _ [] = False | 46 | has :: Prop -> [Prop] -> Bool
has _ [] = False | 46 | has _ [] = False | 16 | false | true | 0 | 9 | 11 | 35 | 16 | 19 | null | null |
ocramz/monad-bayes | test/TestPopulation.hs | mit | expectation :: (a -> Double) -> Dist.Dist Double a -> Double
expectation = Dist.expectation | 91 | expectation :: (a -> Double) -> Dist.Dist Double a -> Double
expectation = Dist.expectation | 91 | expectation = Dist.expectation | 30 | false | true | 0 | 9 | 13 | 42 | 19 | 23 | null | null |
urbit/urbit | pkg/hs/urbit-king/lib/Urbit/King/Main.hs | mit | runMultipleShips :: Maybe Text -> [(CLI.Run, CLI.Opts)] -> RIO HostEnv ()
runMultipleShips serfExe ships = do
shipThreads <- for ships $ \(r, o) -> do
async (runShipRestarting serfExe r o)
{-
Since `spin` never returns, this will run until the main
thread is killed with an async exception. The one we expect is
`UserInterrupt` which will be raised on this thread upon SIGKILL
or SIGTERM.
Once that happens, we send a shutdown signal which will cause all
ships to be shut down, and then we `wait` for them to finish before
returning.
This is different than the single-ship flow, because ships never
go down on their own in this flow. If they go down, they just bring
themselves back up.
-}
let spin = forever (threadDelay maxBound)
finally spin $ do
logTrace "KING IS GOING DOWN"
view killKingActionL >>= atomically
for_ shipThreads waitCatch
-------------------------------------------------------------------------------- | 995 | runMultipleShips :: Maybe Text -> [(CLI.Run, CLI.Opts)] -> RIO HostEnv ()
runMultipleShips serfExe ships = do
shipThreads <- for ships $ \(r, o) -> do
async (runShipRestarting serfExe r o)
{-
Since `spin` never returns, this will run until the main
thread is killed with an async exception. The one we expect is
`UserInterrupt` which will be raised on this thread upon SIGKILL
or SIGTERM.
Once that happens, we send a shutdown signal which will cause all
ships to be shut down, and then we `wait` for them to finish before
returning.
This is different than the single-ship flow, because ships never
go down on their own in this flow. If they go down, they just bring
themselves back up.
-}
let spin = forever (threadDelay maxBound)
finally spin $ do
logTrace "KING IS GOING DOWN"
view killKingActionL >>= atomically
for_ shipThreads waitCatch
-------------------------------------------------------------------------------- | 995 | runMultipleShips serfExe ships = do
shipThreads <- for ships $ \(r, o) -> do
async (runShipRestarting serfExe r o)
{-
Since `spin` never returns, this will run until the main
thread is killed with an async exception. The one we expect is
`UserInterrupt` which will be raised on this thread upon SIGKILL
or SIGTERM.
Once that happens, we send a shutdown signal which will cause all
ships to be shut down, and then we `wait` for them to finish before
returning.
This is different than the single-ship flow, because ships never
go down on their own in this flow. If they go down, they just bring
themselves back up.
-}
let spin = forever (threadDelay maxBound)
finally spin $ do
logTrace "KING IS GOING DOWN"
view killKingActionL >>= atomically
for_ shipThreads waitCatch
-------------------------------------------------------------------------------- | 921 | false | true | 0 | 14 | 215 | 142 | 67 | 75 | null | null |
adept/hledger | hledger-lib/Hledger/Read/TimedotReader.hs | gpl-3.0 | traceparse' = const $ return () | 31 | traceparse' = const $ return () | 31 | traceparse' = const $ return () | 31 | false | false | 0 | 7 | 5 | 15 | 7 | 8 | null | null |
gianlucagiorgolo/glue-tp | TP.hs | mit | associate :: Formula -> Formula -> NonDeterministicState S ()
associate f g = do
s <- get
m <- return $ vars s
modify (\x -> x{vars = Map.insert f g m})
return ()
-- |Looks up the binding of a formula in the variable-formula binding map of the state | 258 | associate :: Formula -> Formula -> NonDeterministicState S ()
associate f g = do
s <- get
m <- return $ vars s
modify (\x -> x{vars = Map.insert f g m})
return ()
-- |Looks up the binding of a formula in the variable-formula binding map of the state | 258 | associate f g = do
s <- get
m <- return $ vars s
modify (\x -> x{vars = Map.insert f g m})
return ()
-- |Looks up the binding of a formula in the variable-formula binding map of the state | 196 | false | true | 0 | 13 | 58 | 92 | 44 | 48 | null | null |
bkoropoff/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | tldeclared (PInstance _ _ _ _ _ _ _ _ _ _ _) = [] | 49 | tldeclared (PInstance _ _ _ _ _ _ _ _ _ _ _) = [] | 49 | tldeclared (PInstance _ _ _ _ _ _ _ _ _ _ _) = [] | 49 | false | false | 0 | 7 | 14 | 37 | 18 | 19 | null | null |
ghc-android/ghc | compiler/coreSyn/CoreSyn.hs | bsd-3-clause | deTagExpr (Type ty) = Type ty | 45 | deTagExpr (Type ty) = Type ty | 45 | deTagExpr (Type ty) = Type ty | 45 | false | false | 0 | 6 | 21 | 19 | 8 | 11 | null | null |
vincenthz/cryptonite | Crypto/Cipher/Camellia/Primitive.hs | bsd-3-clause | 8tow64 :: (Word8, Word8, Word8, Word8, Word8, Word8, Word8, Word8) -> Word64
w8tow64 (t1,t2,t3,t4,t5,t6,t7,t8) =
(fromIntegral t1 `shiftL` 56) .|.
(fromIntegral t2 `shiftL` 48) .|.
(fromIntegral t3 `shiftL` 40) .|.
(fromIntegral t4 `shiftL` 32) .|.
(fromIntegral t5 `shiftL` 24) .|.
(fromIntegral t6 `shiftL` 16) .|.
(fromIntegral t7 `shiftL` 8) .|.
(fromIntegral t8)
| 401 | w8tow64 :: (Word8, Word8, Word8, Word8, Word8, Word8, Word8, Word8) -> Word64
w8tow64 (t1,t2,t3,t4,t5,t6,t7,t8) =
(fromIntegral t1 `shiftL` 56) .|.
(fromIntegral t2 `shiftL` 48) .|.
(fromIntegral t3 `shiftL` 40) .|.
(fromIntegral t4 `shiftL` 32) .|.
(fromIntegral t5 `shiftL` 24) .|.
(fromIntegral t6 `shiftL` 16) .|.
(fromIntegral t7 `shiftL` 8) .|.
(fromIntegral t8) | 401 | w8tow64 (t1,t2,t3,t4,t5,t6,t7,t8) =
(fromIntegral t1 `shiftL` 56) .|.
(fromIntegral t2 `shiftL` 48) .|.
(fromIntegral t3 `shiftL` 40) .|.
(fromIntegral t4 `shiftL` 32) .|.
(fromIntegral t5 `shiftL` 24) .|.
(fromIntegral t6 `shiftL` 16) .|.
(fromIntegral t7 `shiftL` 8) .|.
(fromIntegral t8) | 323 | false | true | 0 | 14 | 85 | 191 | 109 | 82 | null | null |
jml/graphql-api | src/GraphQL/Internal/Arbitrary.hs | bsd-3-clause | -- | Generate an arbitrary 'NonEmpty' list.
arbitraryNonEmpty :: forall a. Arbitrary a => Gen (NonEmpty a)
arbitraryNonEmpty =
-- NonEmpty.fromList panics, but that's OK, because listOf1 is guaranteed to
-- return a non-empty list, and because a panic in a test is highly
-- informative and indicative of a bug.
NonEmpty.fromList <$> listOf1 arbitrary | 359 | arbitraryNonEmpty :: forall a. Arbitrary a => Gen (NonEmpty a)
arbitraryNonEmpty =
-- NonEmpty.fromList panics, but that's OK, because listOf1 is guaranteed to
-- return a non-empty list, and because a panic in a test is highly
-- informative and indicative of a bug.
NonEmpty.fromList <$> listOf1 arbitrary | 315 | arbitraryNonEmpty =
-- NonEmpty.fromList panics, but that's OK, because listOf1 is guaranteed to
-- return a non-empty list, and because a panic in a test is highly
-- informative and indicative of a bug.
NonEmpty.fromList <$> listOf1 arbitrary | 252 | true | true | 0 | 9 | 62 | 45 | 24 | 21 | null | null |
wouwouwou/2017_module_8 | src/haskell/PP-project-2016/Grammar.hs | apache-2.0 | lPar = Symbol "(" | 24 | lPar = Symbol "(" | 24 | lPar = Symbol "(" | 24 | false | false | 0 | 5 | 10 | 9 | 4 | 5 | null | null |
brendanhay/gogol | gogol-videointelligence/gen/Network/Google/VideoIntelligence/Types/Product.hs | mpl-2.0 | -- | Label annotations on frame level. There is exactly one element for each
-- unique label.
gcvvvarsFrameLabelAnnotations :: Lens' GoogleCloudVideointelligenceV1p3beta1_VideoAnnotationResults [GoogleCloudVideointelligenceV1p3beta1_LabelAnnotation]
gcvvvarsFrameLabelAnnotations
= lens _gcvvvarsFrameLabelAnnotations
(\ s a -> s{_gcvvvarsFrameLabelAnnotations = a})
. _Default
. _Coerce | 407 | gcvvvarsFrameLabelAnnotations :: Lens' GoogleCloudVideointelligenceV1p3beta1_VideoAnnotationResults [GoogleCloudVideointelligenceV1p3beta1_LabelAnnotation]
gcvvvarsFrameLabelAnnotations
= lens _gcvvvarsFrameLabelAnnotations
(\ s a -> s{_gcvvvarsFrameLabelAnnotations = a})
. _Default
. _Coerce | 313 | gcvvvarsFrameLabelAnnotations
= lens _gcvvvarsFrameLabelAnnotations
(\ s a -> s{_gcvvvarsFrameLabelAnnotations = a})
. _Default
. _Coerce | 157 | true | true | 0 | 11 | 56 | 54 | 29 | 25 | null | null |
alexander-at-github/eta | compiler/ETA/TypeCheck/TcGenDeriv.hs | bsd-3-clause | bs_RDRs = [ mkVarUnqual (mkFastString ("b"++show i)) | i <- [(1::Int) .. ] ] | 84 | bs_RDRs = [ mkVarUnqual (mkFastString ("b"++show i)) | i <- [(1::Int) .. ] ] | 84 | bs_RDRs = [ mkVarUnqual (mkFastString ("b"++show i)) | i <- [(1::Int) .. ] ] | 84 | false | false | 0 | 11 | 21 | 46 | 25 | 21 | null | null |
vrom911/hs-init | summoner-cli/test/Test/TomlSpec.hs | mit | tomlConfigSpec :: Spec
tomlConfigSpec = describe "TOML configuration spec" $ do
it "finalises default configuration" $
finalise defaultConfig `shouldSatisfy` isSuccess
it "parses default configuration" $
decode configCodec defaultConfigFileContent `shouldSatisfy` isRight
it "default configuration is up-to-date" $
readFileText "examples/summoner-default.toml"
`shouldReturn` defaultConfigFileContent | 448 | tomlConfigSpec :: Spec
tomlConfigSpec = describe "TOML configuration spec" $ do
it "finalises default configuration" $
finalise defaultConfig `shouldSatisfy` isSuccess
it "parses default configuration" $
decode configCodec defaultConfigFileContent `shouldSatisfy` isRight
it "default configuration is up-to-date" $
readFileText "examples/summoner-default.toml"
`shouldReturn` defaultConfigFileContent | 448 | tomlConfigSpec = describe "TOML configuration spec" $ do
it "finalises default configuration" $
finalise defaultConfig `shouldSatisfy` isSuccess
it "parses default configuration" $
decode configCodec defaultConfigFileContent `shouldSatisfy` isRight
it "default configuration is up-to-date" $
readFileText "examples/summoner-default.toml"
`shouldReturn` defaultConfigFileContent | 425 | false | true | 0 | 10 | 87 | 84 | 38 | 46 | null | null |
snoyberg/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | isAtomicHsExpr (HsOverLabel {}) = True | 39 | isAtomicHsExpr (HsOverLabel {}) = True | 39 | isAtomicHsExpr (HsOverLabel {}) = True | 39 | false | false | 0 | 7 | 5 | 16 | 8 | 8 | null | null |
reflex-frp/reflex | src/Reflex/Class.hs | bsd-3-clause | mergeList es = mergeWithFoldCheap' id es | 40 | mergeList es = mergeWithFoldCheap' id es | 40 | mergeList es = mergeWithFoldCheap' id es | 40 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
josuf107/Adverb | Adverb/Common.hs | gpl-3.0 | gullibly = id | 13 | gullibly = id | 13 | gullibly = id | 13 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
rasendubi/arachne | src/Network/MQTT/Encoder.hs | bsd-3-clause | packetTypeValue (UNSUBACK _) = 11 | 36 | packetTypeValue (UNSUBACK _) = 11 | 36 | packetTypeValue (UNSUBACK _) = 11 | 36 | false | false | 0 | 7 | 7 | 15 | 7 | 8 | null | null |
jaccokrijnen/leksah | src/IDE/Pane/SourceBuffer.hs | gpl-2.0 | selectedTextOrCurrentLine :: IDEM (Maybe Text)
selectedTextOrCurrentLine = do
candy' <- readIDE candy
inActiveBufContext Nothing $ \_ _ ebuf currentBuffer _ -> do
hasSelection <- hasSelection ebuf
(i1, i2) <- if hasSelection
then getSelectionBounds ebuf
else do
(i, _) <- getSelectionBounds ebuf
line <- getLine i
iStart <- getIterAtLine ebuf line
iEnd <- forwardToLineEndC iStart
return (iStart, iEnd)
Just <$> getCandylessPart candy' ebuf i1 i2
-- | Get the currently selected text, or, if none, tries to selected the current identifier (the one under the cursor) | 702 | selectedTextOrCurrentLine :: IDEM (Maybe Text)
selectedTextOrCurrentLine = do
candy' <- readIDE candy
inActiveBufContext Nothing $ \_ _ ebuf currentBuffer _ -> do
hasSelection <- hasSelection ebuf
(i1, i2) <- if hasSelection
then getSelectionBounds ebuf
else do
(i, _) <- getSelectionBounds ebuf
line <- getLine i
iStart <- getIterAtLine ebuf line
iEnd <- forwardToLineEndC iStart
return (iStart, iEnd)
Just <$> getCandylessPart candy' ebuf i1 i2
-- | Get the currently selected text, or, if none, tries to selected the current identifier (the one under the cursor) | 702 | selectedTextOrCurrentLine = do
candy' <- readIDE candy
inActiveBufContext Nothing $ \_ _ ebuf currentBuffer _ -> do
hasSelection <- hasSelection ebuf
(i1, i2) <- if hasSelection
then getSelectionBounds ebuf
else do
(i, _) <- getSelectionBounds ebuf
line <- getLine i
iStart <- getIterAtLine ebuf line
iEnd <- forwardToLineEndC iStart
return (iStart, iEnd)
Just <$> getCandylessPart candy' ebuf i1 i2
-- | Get the currently selected text, or, if none, tries to selected the current identifier (the one under the cursor) | 655 | false | true | 0 | 16 | 221 | 164 | 77 | 87 | null | null |
alexander-at-github/eta | compiler/ETA/Types/TyCon.hs | bsd-3-clause | isObjectRep (ArrayRep _) = True | 32 | isObjectRep (ArrayRep _) = True | 32 | isObjectRep (ArrayRep _) = True | 32 | false | false | 0 | 7 | 5 | 15 | 7 | 8 | null | null |
silkapp/cassava | tests/UnitTests.hs | bsd-3-clause | positionalTests :: [TF.Test]
positionalTests =
[ testGroup "encode" $ map encodeTest
[ ("simple", [["abc"]], "abc\r\n")
, ("quoted", [["\"abc\""]], "\"\"\"abc\"\"\"\r\n")
, ("quote", [["a\"b"]], "\"a\"\"b\"\r\n")
, ("quotedQuote", [["\"a\"b\""]], "\"\"\"a\"\"b\"\"\"\r\n")
, ("leadingSpace", [[" abc"]], "\" abc\"\r\n")
, ("comma", [["abc,def"]], "\"abc,def\"\r\n")
, ("twoFields", [["abc","def"]], "abc,def\r\n")
, ("twoRecords", [["abc"], ["def"]], "abc\r\ndef\r\n")
, ("newline", [["abc\ndef"]], "\"abc\ndef\"\r\n")
]
, testGroup "encodeWith"
[ testCase "tab-delim" $ encodesWithAs (defEnc { encDelimiter = 9 })
[["1", "2"]] "1\t2\r\n"
, testCase "newline" $ encodesWithAs (defEnc {encUseCrLf = False})
[["1", "2"], ["3", "4"]] "1,2\n3,4\n"
]
, testGroup "decode" $ map decodeTest decodeTests
, testGroup "decodeWith" $ map decodeWithTest decodeWithTests
, testGroup "streaming"
[ testGroup "decode" $ map streamingDecodeTest decodeTests
, testGroup "decodeWith" $ map streamingDecodeWithTest decodeWithTests
]
]
where
rfc4180Input = BL8.pack $
"#field1,field2,field3\n" ++
"\"aaa\",\"bb\n" ++
"b\",\"ccc\"\n" ++
"\"a,a\",\"b\"\"bb\",\"ccc\"\n" ++
"zzz,yyy,xxx\n"
rfc4180Output = [["#field1", "field2", "field3"],
["aaa", "bb\nb", "ccc"],
["a,a", "b\"bb", "ccc"],
["zzz", "yyy", "xxx"]]
decodeTests =
[ ("simple", "a,b,c\n", [["a", "b", "c"]])
, ("crlf", "a,b\r\nc,d\r\n", [["a", "b"], ["c", "d"]])
, ("noEol", "a,b,c", [["a", "b", "c"]])
, ("blankLine", "a,b,c\n\nd,e,f\n\n",
[["a", "b", "c"], ["d", "e", "f"]])
, ("leadingSpace", " a, b, c\n", [[" a", " b", " c"]])
, ("rfc4180", rfc4180Input, rfc4180Output)
]
decodeWithTests =
[ ("tab-delim", defDec { decDelimiter = 9 }, "1\t2", [["1", "2"]])
]
encodeTest (name, input, expected) =
testCase name $ input `encodesAs` expected
decodeTest (name, input, expected) =
testCase name $ input `decodesAs` expected
decodeWithTest (name, opts, input, expected) =
testCase name $ decodesWithAs opts input expected
streamingDecodeTest (name, input, expected) =
testCase name $ input `decodesStreamingAs` expected
streamingDecodeWithTest (name, opts, input, expected) =
testCase name $ decodesWithStreamingAs opts input expected
defEnc = defaultEncodeOptions
defDec = defaultDecodeOptions | 2,826 | positionalTests :: [TF.Test]
positionalTests =
[ testGroup "encode" $ map encodeTest
[ ("simple", [["abc"]], "abc\r\n")
, ("quoted", [["\"abc\""]], "\"\"\"abc\"\"\"\r\n")
, ("quote", [["a\"b"]], "\"a\"\"b\"\r\n")
, ("quotedQuote", [["\"a\"b\""]], "\"\"\"a\"\"b\"\"\"\r\n")
, ("leadingSpace", [[" abc"]], "\" abc\"\r\n")
, ("comma", [["abc,def"]], "\"abc,def\"\r\n")
, ("twoFields", [["abc","def"]], "abc,def\r\n")
, ("twoRecords", [["abc"], ["def"]], "abc\r\ndef\r\n")
, ("newline", [["abc\ndef"]], "\"abc\ndef\"\r\n")
]
, testGroup "encodeWith"
[ testCase "tab-delim" $ encodesWithAs (defEnc { encDelimiter = 9 })
[["1", "2"]] "1\t2\r\n"
, testCase "newline" $ encodesWithAs (defEnc {encUseCrLf = False})
[["1", "2"], ["3", "4"]] "1,2\n3,4\n"
]
, testGroup "decode" $ map decodeTest decodeTests
, testGroup "decodeWith" $ map decodeWithTest decodeWithTests
, testGroup "streaming"
[ testGroup "decode" $ map streamingDecodeTest decodeTests
, testGroup "decodeWith" $ map streamingDecodeWithTest decodeWithTests
]
]
where
rfc4180Input = BL8.pack $
"#field1,field2,field3\n" ++
"\"aaa\",\"bb\n" ++
"b\",\"ccc\"\n" ++
"\"a,a\",\"b\"\"bb\",\"ccc\"\n" ++
"zzz,yyy,xxx\n"
rfc4180Output = [["#field1", "field2", "field3"],
["aaa", "bb\nb", "ccc"],
["a,a", "b\"bb", "ccc"],
["zzz", "yyy", "xxx"]]
decodeTests =
[ ("simple", "a,b,c\n", [["a", "b", "c"]])
, ("crlf", "a,b\r\nc,d\r\n", [["a", "b"], ["c", "d"]])
, ("noEol", "a,b,c", [["a", "b", "c"]])
, ("blankLine", "a,b,c\n\nd,e,f\n\n",
[["a", "b", "c"], ["d", "e", "f"]])
, ("leadingSpace", " a, b, c\n", [[" a", " b", " c"]])
, ("rfc4180", rfc4180Input, rfc4180Output)
]
decodeWithTests =
[ ("tab-delim", defDec { decDelimiter = 9 }, "1\t2", [["1", "2"]])
]
encodeTest (name, input, expected) =
testCase name $ input `encodesAs` expected
decodeTest (name, input, expected) =
testCase name $ input `decodesAs` expected
decodeWithTest (name, opts, input, expected) =
testCase name $ decodesWithAs opts input expected
streamingDecodeTest (name, input, expected) =
testCase name $ input `decodesStreamingAs` expected
streamingDecodeWithTest (name, opts, input, expected) =
testCase name $ decodesWithStreamingAs opts input expected
defEnc = defaultEncodeOptions
defDec = defaultDecodeOptions | 2,826 | positionalTests =
[ testGroup "encode" $ map encodeTest
[ ("simple", [["abc"]], "abc\r\n")
, ("quoted", [["\"abc\""]], "\"\"\"abc\"\"\"\r\n")
, ("quote", [["a\"b"]], "\"a\"\"b\"\r\n")
, ("quotedQuote", [["\"a\"b\""]], "\"\"\"a\"\"b\"\"\"\r\n")
, ("leadingSpace", [[" abc"]], "\" abc\"\r\n")
, ("comma", [["abc,def"]], "\"abc,def\"\r\n")
, ("twoFields", [["abc","def"]], "abc,def\r\n")
, ("twoRecords", [["abc"], ["def"]], "abc\r\ndef\r\n")
, ("newline", [["abc\ndef"]], "\"abc\ndef\"\r\n")
]
, testGroup "encodeWith"
[ testCase "tab-delim" $ encodesWithAs (defEnc { encDelimiter = 9 })
[["1", "2"]] "1\t2\r\n"
, testCase "newline" $ encodesWithAs (defEnc {encUseCrLf = False})
[["1", "2"], ["3", "4"]] "1,2\n3,4\n"
]
, testGroup "decode" $ map decodeTest decodeTests
, testGroup "decodeWith" $ map decodeWithTest decodeWithTests
, testGroup "streaming"
[ testGroup "decode" $ map streamingDecodeTest decodeTests
, testGroup "decodeWith" $ map streamingDecodeWithTest decodeWithTests
]
]
where
rfc4180Input = BL8.pack $
"#field1,field2,field3\n" ++
"\"aaa\",\"bb\n" ++
"b\",\"ccc\"\n" ++
"\"a,a\",\"b\"\"bb\",\"ccc\"\n" ++
"zzz,yyy,xxx\n"
rfc4180Output = [["#field1", "field2", "field3"],
["aaa", "bb\nb", "ccc"],
["a,a", "b\"bb", "ccc"],
["zzz", "yyy", "xxx"]]
decodeTests =
[ ("simple", "a,b,c\n", [["a", "b", "c"]])
, ("crlf", "a,b\r\nc,d\r\n", [["a", "b"], ["c", "d"]])
, ("noEol", "a,b,c", [["a", "b", "c"]])
, ("blankLine", "a,b,c\n\nd,e,f\n\n",
[["a", "b", "c"], ["d", "e", "f"]])
, ("leadingSpace", " a, b, c\n", [[" a", " b", " c"]])
, ("rfc4180", rfc4180Input, rfc4180Output)
]
decodeWithTests =
[ ("tab-delim", defDec { decDelimiter = 9 }, "1\t2", [["1", "2"]])
]
encodeTest (name, input, expected) =
testCase name $ input `encodesAs` expected
decodeTest (name, input, expected) =
testCase name $ input `decodesAs` expected
decodeWithTest (name, opts, input, expected) =
testCase name $ decodesWithAs opts input expected
streamingDecodeTest (name, input, expected) =
testCase name $ input `decodesStreamingAs` expected
streamingDecodeWithTest (name, opts, input, expected) =
testCase name $ decodesWithStreamingAs opts input expected
defEnc = defaultEncodeOptions
defDec = defaultDecodeOptions | 2,797 | false | true | 15 | 12 | 863 | 834 | 485 | 349 | null | null |
lpenz/realworldhaskell-exercises | ch04/Folds.hs | mit | myTakeWhile_fold2 :: (a -> Bool) -> [a] -> [a]
myTakeWhile_fold2 f = (foldr step []) . map (\ a -> (f a, a))
where
step (True, a) l = a:l
step _ l = l
-- Ex 05: | 173 | myTakeWhile_fold2 :: (a -> Bool) -> [a] -> [a]
myTakeWhile_fold2 f = (foldr step []) . map (\ a -> (f a, a))
where
step (True, a) l = a:l
step _ l = l
-- Ex 05: | 173 | myTakeWhile_fold2 f = (foldr step []) . map (\ a -> (f a, a))
where
step (True, a) l = a:l
step _ l = l
-- Ex 05: | 126 | false | true | 0 | 10 | 50 | 103 | 55 | 48 | null | null |
coghex/abridgefaraway | src/GLUtil/Font.hs | bsd-3-clause | findLetter SMFONT 'T' = (51, 12) | 33 | findLetter SMFONT 'T' = (51, 12) | 33 | findLetter SMFONT 'T' = (51, 12) | 33 | false | false | 0 | 5 | 6 | 19 | 9 | 10 | null | null |
elieux/ghc | compiler/deSugar/DsArrows.hs | bsd-3-clause | mkCmdEnv :: CmdSyntaxTable Id -> DsM ([CoreBind], DsCmdEnv)
-- See Note [CmdSyntaxTable] in HsExpr
mkCmdEnv tc_meths
= do { (meth_binds, prs) <- mapAndUnzipM mk_bind tc_meths
; return (meth_binds, DsCmdEnv {
arr_id = Var (find_meth prs arrAName),
compose_id = Var (find_meth prs composeAName),
first_id = Var (find_meth prs firstAName),
app_id = Var (find_meth prs appAName),
choice_id = Var (find_meth prs choiceAName),
loop_id = Var (find_meth prs loopAName)
}) }
where
mk_bind (std_name, expr)
= do { rhs <- dsExpr expr
; id <- newSysLocalDs (exprType rhs)
; return (NonRec id rhs, (std_name, id)) }
find_meth prs std_name
= assocDefault (mk_panic std_name) prs std_name
mk_panic std_name = pprPanic "mkCmdEnv" (ptext (sLit "Not found:") <+> ppr std_name)
-- arr :: forall b c. (b -> c) -> a b c | 974 | mkCmdEnv :: CmdSyntaxTable Id -> DsM ([CoreBind], DsCmdEnv)
mkCmdEnv tc_meths
= do { (meth_binds, prs) <- mapAndUnzipM mk_bind tc_meths
; return (meth_binds, DsCmdEnv {
arr_id = Var (find_meth prs arrAName),
compose_id = Var (find_meth prs composeAName),
first_id = Var (find_meth prs firstAName),
app_id = Var (find_meth prs appAName),
choice_id = Var (find_meth prs choiceAName),
loop_id = Var (find_meth prs loopAName)
}) }
where
mk_bind (std_name, expr)
= do { rhs <- dsExpr expr
; id <- newSysLocalDs (exprType rhs)
; return (NonRec id rhs, (std_name, id)) }
find_meth prs std_name
= assocDefault (mk_panic std_name) prs std_name
mk_panic std_name = pprPanic "mkCmdEnv" (ptext (sLit "Not found:") <+> ppr std_name)
-- arr :: forall b c. (b -> c) -> a b c | 935 | mkCmdEnv tc_meths
= do { (meth_binds, prs) <- mapAndUnzipM mk_bind tc_meths
; return (meth_binds, DsCmdEnv {
arr_id = Var (find_meth prs arrAName),
compose_id = Var (find_meth prs composeAName),
first_id = Var (find_meth prs firstAName),
app_id = Var (find_meth prs appAName),
choice_id = Var (find_meth prs choiceAName),
loop_id = Var (find_meth prs loopAName)
}) }
where
mk_bind (std_name, expr)
= do { rhs <- dsExpr expr
; id <- newSysLocalDs (exprType rhs)
; return (NonRec id rhs, (std_name, id)) }
find_meth prs std_name
= assocDefault (mk_panic std_name) prs std_name
mk_panic std_name = pprPanic "mkCmdEnv" (ptext (sLit "Not found:") <+> ppr std_name)
-- arr :: forall b c. (b -> c) -> a b c | 875 | true | true | 2 | 13 | 302 | 310 | 155 | 155 | null | null |
Noeda/Megaman | src/NetHack/Data/Level.hs | mit | featureByCh '\\' _ = [Throne] | 29 | featureByCh '\\' _ = [Throne] | 29 | featureByCh '\\' _ = [Throne] | 29 | false | false | 0 | 5 | 4 | 14 | 7 | 7 | null | null |
ohua-dev/ohua-core | tests/src/DFLoweringSpec.hs | epl-1.0 | shouldSatisfyRet :: Show a => IO a -> (a -> Bool) -> Expectation
shouldSatisfyRet action predicate = action >>= (`shouldSatisfy` predicate) | 139 | shouldSatisfyRet :: Show a => IO a -> (a -> Bool) -> Expectation
shouldSatisfyRet action predicate = action >>= (`shouldSatisfy` predicate) | 139 | shouldSatisfyRet action predicate = action >>= (`shouldSatisfy` predicate) | 74 | false | true | 0 | 9 | 20 | 56 | 28 | 28 | null | null |
ezyang/ghc | compiler/simplCore/OccurAnal.hs | bsd-3-clause | cheapExprSize :: CoreExpr -> Int
-- Maxes out at maxExprSize
cheapExprSize e
= go 0 e
where
go n e | n >= maxExprSize = n
| otherwise = go1 n e
go1 n (Var {}) = n+1
go1 n (Lit {}) = n+1
go1 n (Type {}) = n
go1 n (Coercion {}) = n
go1 n (Tick _ e) = go1 n e
go1 n (Cast e _) = go1 n e
go1 n (App f a) = go (go1 n f) a
go1 n (Lam b e)
| isTyVar b = go1 n e
| otherwise = go (n+1) e
go1 n (Let b e) = gos (go1 n e) (rhssOfBind b)
go1 n (Case e _ _ as) = gos (go1 n e) (rhssOfAlts as)
gos n [] = n
gos n (e:es) | n >= maxExprSize = n
| otherwise = gos (go1 n e) es | 732 | cheapExprSize :: CoreExpr -> Int
cheapExprSize e
= go 0 e
where
go n e | n >= maxExprSize = n
| otherwise = go1 n e
go1 n (Var {}) = n+1
go1 n (Lit {}) = n+1
go1 n (Type {}) = n
go1 n (Coercion {}) = n
go1 n (Tick _ e) = go1 n e
go1 n (Cast e _) = go1 n e
go1 n (App f a) = go (go1 n f) a
go1 n (Lam b e)
| isTyVar b = go1 n e
| otherwise = go (n+1) e
go1 n (Let b e) = gos (go1 n e) (rhssOfBind b)
go1 n (Case e _ _ as) = gos (go1 n e) (rhssOfAlts as)
gos n [] = n
gos n (e:es) | n >= maxExprSize = n
| otherwise = gos (go1 n e) es | 704 | cheapExprSize e
= go 0 e
where
go n e | n >= maxExprSize = n
| otherwise = go1 n e
go1 n (Var {}) = n+1
go1 n (Lit {}) = n+1
go1 n (Type {}) = n
go1 n (Coercion {}) = n
go1 n (Tick _ e) = go1 n e
go1 n (Cast e _) = go1 n e
go1 n (App f a) = go (go1 n f) a
go1 n (Lam b e)
| isTyVar b = go1 n e
| otherwise = go (n+1) e
go1 n (Let b e) = gos (go1 n e) (rhssOfBind b)
go1 n (Case e _ _ as) = gos (go1 n e) (rhssOfAlts as)
gos n [] = n
gos n (e:es) | n >= maxExprSize = n
| otherwise = gos (go1 n e) es | 671 | true | true | 10 | 10 | 322 | 404 | 200 | 204 | null | null |
ohua-dev/ohua-core | core/src/Ohua/Feature/TailRec/Passes/ALang.hs | epl-1.0 | y_sf :: Expression
y_sf = PureFunction y Nothing | 48 | y_sf :: Expression
y_sf = PureFunction y Nothing | 48 | y_sf = PureFunction y Nothing | 29 | false | true | 0 | 5 | 7 | 16 | 8 | 8 | null | null |
futufeld/eclogues | eclogues-impl/gen-hs/ReadOnlyScheduler.hs | bsd-3-clause | read_GetConfigSummary_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetConfigSummary_result
read_GetConfigSummary_result iprot = to_GetConfigSummary_result <$> T.readVal iprot (T.T_STRUCT typemap_GetConfigSummary_result) | 229 | read_GetConfigSummary_result :: (T.Transport t, T.Protocol p) => p t -> P.IO GetConfigSummary_result
read_GetConfigSummary_result iprot = to_GetConfigSummary_result <$> T.readVal iprot (T.T_STRUCT typemap_GetConfigSummary_result) | 229 | read_GetConfigSummary_result iprot = to_GetConfigSummary_result <$> T.readVal iprot (T.T_STRUCT typemap_GetConfigSummary_result) | 128 | false | true | 0 | 9 | 20 | 64 | 31 | 33 | null | null |
dmjio/miso | src/Miso/Subscription/History.hs | bsd-3-clause | pushURI uri = pushStateNoModel uri { uriPath = toPath uri } | 59 | pushURI uri = pushStateNoModel uri { uriPath = toPath uri } | 59 | pushURI uri = pushStateNoModel uri { uriPath = toPath uri } | 59 | false | false | 0 | 8 | 10 | 23 | 11 | 12 | null | null |
dolio/irc-core | src/Client/Commands/Arguments/Renderer.hs | isc | getState :: Renderer a -> State String Image'
getState = fmap getConst . getCompose | 83 | getState :: Renderer a -> State String Image'
getState = fmap getConst . getCompose | 83 | getState = fmap getConst . getCompose | 37 | false | true | 0 | 7 | 13 | 35 | 15 | 20 | null | null |
akhileshs/stack | src/Stack/Build/Execute.hs | bsd-3-clause | displayTask :: Task -> Text
displayTask task = T.pack $ concat
[ packageIdentifierString $ taskProvides task
, ": database="
, case taskLocation task of
Snap -> "snapshot"
Local -> "local"
, ", source="
, case taskType task of
TTLocal lp -> concat
[ toFilePath $ lpDir lp
]
TTUpstream _ _ -> "package index"
, if Set.null missing
then ""
else ", after: " ++ intercalate "," (map packageIdentifierString $ Set.toList missing)
]
where
missing = tcoMissing $ taskConfigOpts task | 581 | displayTask :: Task -> Text
displayTask task = T.pack $ concat
[ packageIdentifierString $ taskProvides task
, ": database="
, case taskLocation task of
Snap -> "snapshot"
Local -> "local"
, ", source="
, case taskType task of
TTLocal lp -> concat
[ toFilePath $ lpDir lp
]
TTUpstream _ _ -> "package index"
, if Set.null missing
then ""
else ", after: " ++ intercalate "," (map packageIdentifierString $ Set.toList missing)
]
where
missing = tcoMissing $ taskConfigOpts task | 581 | displayTask task = T.pack $ concat
[ packageIdentifierString $ taskProvides task
, ": database="
, case taskLocation task of
Snap -> "snapshot"
Local -> "local"
, ", source="
, case taskType task of
TTLocal lp -> concat
[ toFilePath $ lpDir lp
]
TTUpstream _ _ -> "package index"
, if Set.null missing
then ""
else ", after: " ++ intercalate "," (map packageIdentifierString $ Set.toList missing)
]
where
missing = tcoMissing $ taskConfigOpts task | 553 | false | true | 0 | 12 | 185 | 163 | 80 | 83 | null | null |
sdiehl/ghc | libraries/base/Foreign/C/Error.hs | bsd-3-clause | -- | as 'throwErrnoIfMinus1', but exceptions include the given path when
-- appropriate.
--
throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> FilePath -> IO a -> IO a
throwErrnoPathIfMinus1 = throwErrnoPathIf (== -1) | 221 | throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> FilePath -> IO a -> IO a
throwErrnoPathIfMinus1 = throwErrnoPathIf (== -1) | 127 | throwErrnoPathIfMinus1 = throwErrnoPathIf (== -1) | 49 | true | true | 0 | 10 | 36 | 61 | 31 | 30 | null | null |
shnarazk/mios | src/SAT/Mios/Criteria.hs | gpl-3.0 | lbdOf :: Solver -> Stack -> IO Int
lbdOf Solver{..} vec = do
k <- (\k -> if 1000000 < k then 1 else k + 1) <$> get' lbd'key
set' lbd'key k -- store the last used value
nv <- getNth vec 0
let loop :: Int -> Int -> IO Int
loop ((<= nv) -> False) n = return $ max 1 n
loop i n = do l <- getNth level . lit2var =<< getNth vec i
x <- getNth lbd'seen l
if x /= k && l /= 0
then setNth lbd'seen l k >> loop (i + 1) (n + 1)
else loop (i + 1) n
loop 1 0
{-
{-# INLINE setLBD #-}
setLBD :: Solver -> Clause -> IO ()
setLBD _ NullClause = error "LBD44"
setLBD s c = set' (rank c) =<< lbdOf s (lits c)
-- | update the lbd field of /c/
{-# INLINE updateLBD #-}
updateLBD :: Solver -> Clause -> IO ()
updateLBD s NullClause = error "LBD71"
updateLBD s c@Clause{..} = do
k <- get' c
-- o <- getInt lbd
n <- lbdOf s lits
case () of
_ | n == 1 -> set' rank (k - 1)
-- _ | n < o -> setInt lbd n
_ -> return ()
-}
-- | returns a vector index of NDD for the nth bit of a var
| 1,098 | lbdOf :: Solver -> Stack -> IO Int
lbdOf Solver{..} vec = do
k <- (\k -> if 1000000 < k then 1 else k + 1) <$> get' lbd'key
set' lbd'key k -- store the last used value
nv <- getNth vec 0
let loop :: Int -> Int -> IO Int
loop ((<= nv) -> False) n = return $ max 1 n
loop i n = do l <- getNth level . lit2var =<< getNth vec i
x <- getNth lbd'seen l
if x /= k && l /= 0
then setNth lbd'seen l k >> loop (i + 1) (n + 1)
else loop (i + 1) n
loop 1 0
{-
{-# INLINE setLBD #-}
setLBD :: Solver -> Clause -> IO ()
setLBD _ NullClause = error "LBD44"
setLBD s c = set' (rank c) =<< lbdOf s (lits c)
-- | update the lbd field of /c/
{-# INLINE updateLBD #-}
updateLBD :: Solver -> Clause -> IO ()
updateLBD s NullClause = error "LBD71"
updateLBD s c@Clause{..} = do
k <- get' c
-- o <- getInt lbd
n <- lbdOf s lits
case () of
_ | n == 1 -> set' rank (k - 1)
-- _ | n < o -> setInt lbd n
_ -> return ()
-}
-- | returns a vector index of NDD for the nth bit of a var
| 1,098 | lbdOf Solver{..} vec = do
k <- (\k -> if 1000000 < k then 1 else k + 1) <$> get' lbd'key
set' lbd'key k -- store the last used value
nv <- getNth vec 0
let loop :: Int -> Int -> IO Int
loop ((<= nv) -> False) n = return $ max 1 n
loop i n = do l <- getNth level . lit2var =<< getNth vec i
x <- getNth lbd'seen l
if x /= k && l /= 0
then setNth lbd'seen l k >> loop (i + 1) (n + 1)
else loop (i + 1) n
loop 1 0
{-
{-# INLINE setLBD #-}
setLBD :: Solver -> Clause -> IO ()
setLBD _ NullClause = error "LBD44"
setLBD s c = set' (rank c) =<< lbdOf s (lits c)
-- | update the lbd field of /c/
{-# INLINE updateLBD #-}
updateLBD :: Solver -> Clause -> IO ()
updateLBD s NullClause = error "LBD71"
updateLBD s c@Clause{..} = do
k <- get' c
-- o <- getInt lbd
n <- lbdOf s lits
case () of
_ | n == 1 -> set' rank (k - 1)
-- _ | n < o -> setInt lbd n
_ -> return ()
-}
-- | returns a vector index of NDD for the nth bit of a var
| 1,063 | false | true | 0 | 16 | 378 | 262 | 128 | 134 | null | null |
nevrenato/Hets_Fork | Comorphisms/SoftFOL2CommonLogic.hs | gpl-2.0 | typeSentence1 :: FOLSign.Sign -> FOLSign.SPTerm -> Result SENTENCE
typeSentence1 sig v = case v of
FOLSign.SPComplexTerm _ [] ->
fail "bug (typeSentence1): nullary functions should not occur here"
FOLSign.SPComplexTerm sym args -> typeSentenceGetTypes sig (symToName sym) args
FOLSign.SPQuantTerm _ _ _ ->
fail "quantification not allowed in bound variable list" | 376 | typeSentence1 :: FOLSign.Sign -> FOLSign.SPTerm -> Result SENTENCE
typeSentence1 sig v = case v of
FOLSign.SPComplexTerm _ [] ->
fail "bug (typeSentence1): nullary functions should not occur here"
FOLSign.SPComplexTerm sym args -> typeSentenceGetTypes sig (symToName sym) args
FOLSign.SPQuantTerm _ _ _ ->
fail "quantification not allowed in bound variable list" | 376 | typeSentence1 sig v = case v of
FOLSign.SPComplexTerm _ [] ->
fail "bug (typeSentence1): nullary functions should not occur here"
FOLSign.SPComplexTerm sym args -> typeSentenceGetTypes sig (symToName sym) args
FOLSign.SPQuantTerm _ _ _ ->
fail "quantification not allowed in bound variable list" | 309 | false | true | 0 | 10 | 63 | 97 | 45 | 52 | null | null |
josefs/deep-shallow-paper | DeepShallow.hs | mit | eval NewRef = newIORef | 27 | eval NewRef = newIORef | 27 | eval NewRef = newIORef | 27 | false | false | 0 | 5 | 8 | 9 | 4 | 5 | null | null |
nevrenato/HetsAlloy | CommonLogic/Analysis.hs | gpl-2.0 | negForm_mod :: AS.MODULE -> AS.MODULE
negForm_mod m = case m of
AS.Mod n t r -> AS.Mod n (negForm_txt t) r
AS.Mod_ex n exs t r -> AS.Mod_ex n exs (negForm_txt t) r
-- negate sentence | 187 | negForm_mod :: AS.MODULE -> AS.MODULE
negForm_mod m = case m of
AS.Mod n t r -> AS.Mod n (negForm_txt t) r
AS.Mod_ex n exs t r -> AS.Mod_ex n exs (negForm_txt t) r
-- negate sentence | 187 | negForm_mod m = case m of
AS.Mod n t r -> AS.Mod n (negForm_txt t) r
AS.Mod_ex n exs t r -> AS.Mod_ex n exs (negForm_txt t) r
-- negate sentence | 149 | false | true | 0 | 10 | 40 | 96 | 45 | 51 | null | null |
andyarvanitis/Idris-dev | src/Idris/ASTUtils.hs | bsd-3-clause | known_classes :: Field IState (Ctxt ClassInfo)
known_classes = Field idris_classes (\v state -> state {idris_classes = idris_classes state}) | 140 | known_classes :: Field IState (Ctxt ClassInfo)
known_classes = Field idris_classes (\v state -> state {idris_classes = idris_classes state}) | 140 | known_classes = Field idris_classes (\v state -> state {idris_classes = idris_classes state}) | 93 | false | true | 1 | 10 | 17 | 51 | 25 | 26 | null | null |
cocreature/reactand | src/Layout.hs | isc | cycleLayout (Layout _ "Horizontal") = verticalLayout | 52 | cycleLayout (Layout _ "Horizontal") = verticalLayout | 52 | cycleLayout (Layout _ "Horizontal") = verticalLayout | 52 | false | false | 0 | 6 | 5 | 18 | 8 | 10 | null | null |
robdockins/edison | edison-core/src/Data/Edison/Concrete/FingerTree.hs | mit | consDigit a (Two b c) = Three a b c | 35 | consDigit a (Two b c) = Three a b c | 35 | consDigit a (Two b c) = Three a b c | 35 | false | false | 0 | 6 | 9 | 30 | 12 | 18 | null | null |
RobertFischer/fusebox | shared/System/Fuse/Box/FSTypes.hs | bsd-3-clause | denodeify :: (Node -> a) -> (FilePath -> a)
-- ^Converts functions that start with a 'Node' to one that
-- starts with a 'FilePath'.
denodeify f = \fp -> f (nodeFromFilePath fp) | 177 | denodeify :: (Node -> a) -> (FilePath -> a)
denodeify f = \fp -> f (nodeFromFilePath fp) | 88 | denodeify f = \fp -> f (nodeFromFilePath fp) | 44 | true | true | 0 | 9 | 32 | 54 | 27 | 27 | null | null |
bjornbm/astro | test/Astro/Util/CyclicSpec.hs | bsd-3-clause | -- TODO These tests should be migrated to dimensional-experimental.
main = hspec spec | 86 | main = hspec spec | 17 | main = hspec spec | 17 | true | false | 0 | 5 | 13 | 10 | 5 | 5 | null | null |
swift-nav/preamble | src/Preamble/Stats.hs | mit | statsHistogram :: (MonadStatsCtx c m, Show a) => Text -> a -> Tags -> m ()
statsHistogram = stats "h" | 101 | statsHistogram :: (MonadStatsCtx c m, Show a) => Text -> a -> Tags -> m ()
statsHistogram = stats "h" | 101 | statsHistogram = stats "h" | 26 | false | true | 0 | 11 | 19 | 54 | 25 | 29 | null | null |
google-research/dex-lang | src/lib/Parser.hs | bsd-3-clause | doubleLit :: Lexer Double
doubleLit = lexeme $
try L.float
<|> try (fromIntegral <$> (L.decimal :: Parser Int) <* char '.') | 131 | doubleLit :: Lexer Double
doubleLit = lexeme $
try L.float
<|> try (fromIntegral <$> (L.decimal :: Parser Int) <* char '.') | 131 | doubleLit = lexeme $
try L.float
<|> try (fromIntegral <$> (L.decimal :: Parser Int) <* char '.') | 105 | false | true | 3 | 10 | 28 | 58 | 29 | 29 | null | null |
rudymatela/llcheck | src/Test/LeanCheck/Function/ShowFunction.hs | bsd-3-clause | showTuple xs | all (== "_") xs = "_"
| otherwise = paren $ intercalate "," xs | 100 | showTuple xs | all (== "_") xs = "_"
| otherwise = paren $ intercalate "," xs | 100 | showTuple xs | all (== "_") xs = "_"
| otherwise = paren $ intercalate "," xs | 100 | false | false | 2 | 9 | 39 | 48 | 21 | 27 | null | null |
katydid/haslapse | test/Suite.hs | bsd-3-clause | testPath :: IO FilePath
testPath = do
cur <- getCurrentDirectory
let up = takeDirectory cur
return $ up </> "testsuite" </> "relapse" </> "tests" | 151 | testPath :: IO FilePath
testPath = do
cur <- getCurrentDirectory
let up = takeDirectory cur
return $ up </> "testsuite" </> "relapse" </> "tests" | 151 | testPath = do
cur <- getCurrentDirectory
let up = takeDirectory cur
return $ up </> "testsuite" </> "relapse" </> "tests" | 127 | false | true | 0 | 10 | 29 | 52 | 24 | 28 | null | null |
roldugin/LiveFusion | Data/LiveFusion/Sharing.hs | bsd-3-clause | recoverSharing :: Typeable t => AST t -> IO (Map Unique (WrappedASG Unique), Unique, Maybe (ASG t Unique))
recoverSharing t = do
Graph l n <- reifyGraph t
let m = Map.fromList l
return (m, n, getASTNode m n)
| 214 | recoverSharing :: Typeable t => AST t -> IO (Map Unique (WrappedASG Unique), Unique, Maybe (ASG t Unique))
recoverSharing t = do
Graph l n <- reifyGraph t
let m = Map.fromList l
return (m, n, getASTNode m n)
| 214 | recoverSharing t = do
Graph l n <- reifyGraph t
let m = Map.fromList l
return (m, n, getASTNode m n)
| 107 | false | true | 0 | 11 | 45 | 111 | 52 | 59 | null | null |
HIPERFIT/futhark | src/Futhark/CodeGen/Backends/SimpleRep.hs | isc | loadValueHeader :: Signedness -> PrimType -> Int -> C.Exp -> C.Exp -> [C.Stm]
loadValueHeader sign pt rank shape src =
[C.cstms|
err |= (*$exp:src++ != 'b');
err |= (*$exp:src++ != 2);
err |= (*$exp:src++ != $exp:rank);
err |= (memcmp($exp:src, $string:(typeStr sign pt), 4) != 0);
$exp:src += 4;
if (err == 0) {
$stms:load_shape
$exp:src += $int:rank*sizeof(typename int64_t);
}|]
where
load_shape
| rank == 0 = []
| otherwise = [C.cstms|memcpy($exp:shape, src, $int:rank*sizeof(typename int64_t));|] | 570 | loadValueHeader :: Signedness -> PrimType -> Int -> C.Exp -> C.Exp -> [C.Stm]
loadValueHeader sign pt rank shape src =
[C.cstms|
err |= (*$exp:src++ != 'b');
err |= (*$exp:src++ != 2);
err |= (*$exp:src++ != $exp:rank);
err |= (memcmp($exp:src, $string:(typeStr sign pt), 4) != 0);
$exp:src += 4;
if (err == 0) {
$stms:load_shape
$exp:src += $int:rank*sizeof(typename int64_t);
}|]
where
load_shape
| rank == 0 = []
| otherwise = [C.cstms|memcpy($exp:shape, src, $int:rank*sizeof(typename int64_t));|] | 570 | loadValueHeader sign pt rank shape src =
[C.cstms|
err |= (*$exp:src++ != 'b');
err |= (*$exp:src++ != 2);
err |= (*$exp:src++ != $exp:rank);
err |= (memcmp($exp:src, $string:(typeStr sign pt), 4) != 0);
$exp:src += 4;
if (err == 0) {
$stms:load_shape
$exp:src += $int:rank*sizeof(typename int64_t);
}|]
where
load_shape
| rank == 0 = []
| otherwise = [C.cstms|memcpy($exp:shape, src, $int:rank*sizeof(typename int64_t));|] | 492 | false | true | 0 | 11 | 142 | 92 | 49 | 43 | null | null |
yav/monadlib | tests/DynamicScopeRW.hs | mit | --------------------------------------------------------------------------------
testW () = twice $
do put "a"
(_,w1) <- collect (put "b")
put "c"
(_,w2) <- collect (put "d")
return (w1,w2) | 211 | testW () = twice $
do put "a"
(_,w1) <- collect (put "b")
put "c"
(_,w2) <- collect (put "d")
return (w1,w2) | 130 | testW () = twice $
do put "a"
(_,w1) <- collect (put "b")
put "c"
(_,w2) <- collect (put "d")
return (w1,w2) | 130 | true | false | 1 | 12 | 44 | 88 | 40 | 48 | null | null |
shigemk2/haskell_abc | Let.hs | mit | main =
let
a = 1
b = 2
c = a + b
in print c | 76 | main =
let
a = 1
b = 2
c = a + b
in print c | 76 | main =
let
a = 1
b = 2
c = a + b
in print c | 76 | false | false | 1 | 9 | 49 | 38 | 17 | 21 | null | null |
scrive/hpqtypes | src/Database/PostgreSQL/PQTypes/ToRow.hs | bsd-3-clause | withFormat :: forall row. ToRow row => row -> (CString -> IO ()) -> IO ()
withFormat = const $ BS.unsafeUseAsCString $ pqFormat0 @row | 133 | withFormat :: forall row. ToRow row => row -> (CString -> IO ()) -> IO ()
withFormat = const $ BS.unsafeUseAsCString $ pqFormat0 @row | 133 | withFormat = const $ BS.unsafeUseAsCString $ pqFormat0 @row | 59 | false | true | 0 | 12 | 23 | 63 | 31 | 32 | null | null |
rueshyna/gogol | gogol-genomics/gen/Network/Google/Genomics/Types/Product.hs | mpl-2.0 | csiAddtional :: Lens' CallSetInfo (HashMap Text [JSONValue])
csiAddtional
= lens _csiAddtional (\ s a -> s{_csiAddtional = a})
. _Coerce | 144 | csiAddtional :: Lens' CallSetInfo (HashMap Text [JSONValue])
csiAddtional
= lens _csiAddtional (\ s a -> s{_csiAddtional = a})
. _Coerce | 144 | csiAddtional
= lens _csiAddtional (\ s a -> s{_csiAddtional = a})
. _Coerce | 83 | false | true | 0 | 10 | 27 | 56 | 29 | 27 | null | null |
gbwey/persistentold | persistent-mysql/Database/Persist/MySQL.hs | mit | getGetter MySQLBase.Decimal = convertPV PersistDouble | 56 | getGetter MySQLBase.Decimal = convertPV PersistDouble | 56 | getGetter MySQLBase.Decimal = convertPV PersistDouble | 56 | false | false | 0 | 6 | 7 | 14 | 6 | 8 | null | null |
mightymoose/liquidhaskell | benchmarks/vector-0.10.0.1/Data/Vector/Fusion/Stream/Monadic.nocpp.hs | bsd-3-clause | null s = foldr (\_ _ -> False) True s | 37 | null s = foldr (\_ _ -> False) True s | 37 | null s = foldr (\_ _ -> False) True s | 37 | false | false | 1 | 7 | 9 | 30 | 13 | 17 | null | null |
facebook/Haxl | tests/BatchTests.hs | bsd-3-clause | exceptionTest2 = expectResult [7..12] $ liftA2 (++)
(withDefault [] (friendsOf 101))
(withDefault [] (friendsOf 2)) | 119 | exceptionTest2 = expectResult [7..12] $ liftA2 (++)
(withDefault [] (friendsOf 101))
(withDefault [] (friendsOf 2)) | 119 | exceptionTest2 = expectResult [7..12] $ liftA2 (++)
(withDefault [] (friendsOf 101))
(withDefault [] (friendsOf 2)) | 119 | false | false | 1 | 9 | 18 | 65 | 30 | 35 | null | null |
rsasse/tamarin-prover | src/Web/Theory.hs | gpl-3.0 | applyDiffProverAtPath :: ClosedDiffTheory -> String -> ProofPath
-> DiffProver -> Maybe ClosedDiffTheory
applyDiffProverAtPath thy lemmaName proofPath prover =
-- error (show thy ++ "<br> " ++ show lemmaName ++ "<br> " ++ show proofPath ++ "<br> "{- ++ show prover-})
modifyDiffLemmaProof (focusDiff proofPath prover) lemmaName thy | 361 | applyDiffProverAtPath :: ClosedDiffTheory -> String -> ProofPath
-> DiffProver -> Maybe ClosedDiffTheory
applyDiffProverAtPath thy lemmaName proofPath prover =
-- error (show thy ++ "<br> " ++ show lemmaName ++ "<br> " ++ show proofPath ++ "<br> "{- ++ show prover-})
modifyDiffLemmaProof (focusDiff proofPath prover) lemmaName thy | 361 | applyDiffProverAtPath thy lemmaName proofPath prover =
-- error (show thy ++ "<br> " ++ show lemmaName ++ "<br> " ++ show proofPath ++ "<br> "{- ++ show prover-})
modifyDiffLemmaProof (focusDiff proofPath prover) lemmaName thy | 234 | false | true | 0 | 9 | 75 | 55 | 27 | 28 | null | null |
haskell-distributed/distributed-process | distributed-process-tests/src/Control/Distributed/Process/Tests/Internal/Utils.hs | bsd-3-clause | putLogMsg :: Logger -> String -> Process ()
putLogMsg logger msg = liftIO $ atomically $ writeTQueue (msgs logger) msg | 118 | putLogMsg :: Logger -> String -> Process ()
putLogMsg logger msg = liftIO $ atomically $ writeTQueue (msgs logger) msg | 118 | putLogMsg logger msg = liftIO $ atomically $ writeTQueue (msgs logger) msg | 74 | false | true | 0 | 8 | 19 | 48 | 23 | 25 | null | null |
pparkkin/eta | compiler/ETA/BasicTypes/VarEnv.hs | bsd-3-clause | inRnEnvR (RV2 { envR = env }) v = v `elemVarEnv` env | 52 | inRnEnvR (RV2 { envR = env }) v = v `elemVarEnv` env | 52 | inRnEnvR (RV2 { envR = env }) v = v `elemVarEnv` env | 52 | false | false | 0 | 9 | 11 | 29 | 16 | 13 | null | null |
konn/hskk | src/Text/InputMethod/SKK/Dictionary.hs | bsd-3-clause | candidatesP :: Parser [Candidate]
candidatesP = nub <$> slashedP candidate | 74 | candidatesP :: Parser [Candidate]
candidatesP = nub <$> slashedP candidate | 74 | candidatesP = nub <$> slashedP candidate | 40 | false | true | 0 | 6 | 9 | 24 | 12 | 12 | null | null |
sergv/tags-server | test-data/0008module_reexport/Module3.hs | bsd-3-clause | foo3 :: a -> b -> a
foo3 x _ =
x | 34 | foo3 :: a -> b -> a
foo3 x _ =
x | 34 | foo3 x _ =
x | 14 | false | true | 0 | 6 | 13 | 29 | 13 | 16 | null | null |
jrclogic/SMCDEL | src/SMCDEL/Symbolic/S5.hs | gpl-2.0 | equivExtraVocabOf :: [Prp] -> KnowStruct -> [(Prp,Prp)]
equivExtraVocabOf mainVocab kns =
[ (p,q) | p <- vocabOf kns \\ mainVocab, q <- vocabOf kns, p > q, validViaBdd kns (PrpF p `Equi` PrpF q) ] | 198 | equivExtraVocabOf :: [Prp] -> KnowStruct -> [(Prp,Prp)]
equivExtraVocabOf mainVocab kns =
[ (p,q) | p <- vocabOf kns \\ mainVocab, q <- vocabOf kns, p > q, validViaBdd kns (PrpF p `Equi` PrpF q) ] | 198 | equivExtraVocabOf mainVocab kns =
[ (p,q) | p <- vocabOf kns \\ mainVocab, q <- vocabOf kns, p > q, validViaBdd kns (PrpF p `Equi` PrpF q) ] | 142 | false | true | 0 | 10 | 36 | 103 | 54 | 49 | null | null |
Javran/Project-Euler | src/ProjectEuler/Problem143.hs | mit | result :: Int
result =
IS.foldr' (+) 0
. IS.fromList
$ doSearch | 69 | result :: Int
result =
IS.foldr' (+) 0
. IS.fromList
$ doSearch | 69 | result =
IS.foldr' (+) 0
. IS.fromList
$ doSearch | 55 | false | true | 3 | 6 | 17 | 33 | 16 | 17 | null | null |
rueshyna/gogol | gogol-discovery/gen/Network/Google/Discovery/Types/Product.hs | mpl-2.0 | -- | The root URL under which all API services live.
rdRootURL :: Lens' RestDescription (Maybe Text)
rdRootURL
= lens _rdRootURL (\ s a -> s{_rdRootURL = a}) | 159 | rdRootURL :: Lens' RestDescription (Maybe Text)
rdRootURL
= lens _rdRootURL (\ s a -> s{_rdRootURL = a}) | 106 | rdRootURL
= lens _rdRootURL (\ s a -> s{_rdRootURL = a}) | 58 | true | true | 0 | 9 | 29 | 48 | 25 | 23 | null | null |
shicks/shsh | Language/Sh/Expansion.hs | bsd-3-clause | --
expandE :: (Monad m,Functor m) => [Word] -> Exp m [String]
expandE ws = do sf <- splitFields =<< mapM expand' ws
sfs <- forM sf $ \w -> do g <- glob w
return $ if null g
then [w]
else map (map Literal) g
return $ map removeQuotes $ concat sfs | 422 | expandE :: (Monad m,Functor m) => [Word] -> Exp m [String]
expandE ws = do sf <- splitFields =<< mapM expand' ws
sfs <- forM sf $ \w -> do g <- glob w
return $ if null g
then [w]
else map (map Literal) g
return $ map removeQuotes $ concat sfs | 418 | expandE ws = do sf <- splitFields =<< mapM expand' ws
sfs <- forM sf $ \w -> do g <- glob w
return $ if null g
then [w]
else map (map Literal) g
return $ map removeQuotes $ concat sfs | 359 | true | true | 0 | 17 | 230 | 144 | 68 | 76 | null | null |
flipstone/orville | orville-postgresql-libpq/test/Test/AutoMigration.hs | mit | prop_altersColumnDefaultValue_Timelike :: Property.NamedDBProperty
prop_altersColumnDefaultValue_Timelike =
Property.namedDBProperty "Alters default value on existing column (timelike)" $ \pool -> do
assertDefaultValuesMigrateProperly pool $
Gen.choice
[ -- Fields without default, or with specific times for the default
SomeField <$> genFieldWithMaybeDefault PgGen.pgUTCTime Orville.utcTimestampDefault (Orville.utcTimestampField "column")
, SomeField <$> genFieldWithMaybeDefault PgGen.pgLocalTime Orville.localTimestampDefault (Orville.localTimestampField "column")
, SomeField <$> genFieldWithMaybeDefault PgGen.pgDay Orville.dateDefault (Orville.dateField "column")
, -- Fields with "now" for the default
pure . SomeField $ Orville.setDefaultValue Orville.currentUTCTimestampDefault (Orville.utcTimestampField "column")
, pure . SomeField $ Orville.setDefaultValue Orville.currentLocalTimestampDefault (Orville.localTimestampField "column")
, pure . SomeField $ Orville.setDefaultValue Orville.currentDateDefault (Orville.dateField "column")
] | 1,136 | prop_altersColumnDefaultValue_Timelike :: Property.NamedDBProperty
prop_altersColumnDefaultValue_Timelike =
Property.namedDBProperty "Alters default value on existing column (timelike)" $ \pool -> do
assertDefaultValuesMigrateProperly pool $
Gen.choice
[ -- Fields without default, or with specific times for the default
SomeField <$> genFieldWithMaybeDefault PgGen.pgUTCTime Orville.utcTimestampDefault (Orville.utcTimestampField "column")
, SomeField <$> genFieldWithMaybeDefault PgGen.pgLocalTime Orville.localTimestampDefault (Orville.localTimestampField "column")
, SomeField <$> genFieldWithMaybeDefault PgGen.pgDay Orville.dateDefault (Orville.dateField "column")
, -- Fields with "now" for the default
pure . SomeField $ Orville.setDefaultValue Orville.currentUTCTimestampDefault (Orville.utcTimestampField "column")
, pure . SomeField $ Orville.setDefaultValue Orville.currentLocalTimestampDefault (Orville.localTimestampField "column")
, pure . SomeField $ Orville.setDefaultValue Orville.currentDateDefault (Orville.dateField "column")
] | 1,136 | prop_altersColumnDefaultValue_Timelike =
Property.namedDBProperty "Alters default value on existing column (timelike)" $ \pool -> do
assertDefaultValuesMigrateProperly pool $
Gen.choice
[ -- Fields without default, or with specific times for the default
SomeField <$> genFieldWithMaybeDefault PgGen.pgUTCTime Orville.utcTimestampDefault (Orville.utcTimestampField "column")
, SomeField <$> genFieldWithMaybeDefault PgGen.pgLocalTime Orville.localTimestampDefault (Orville.localTimestampField "column")
, SomeField <$> genFieldWithMaybeDefault PgGen.pgDay Orville.dateDefault (Orville.dateField "column")
, -- Fields with "now" for the default
pure . SomeField $ Orville.setDefaultValue Orville.currentUTCTimestampDefault (Orville.utcTimestampField "column")
, pure . SomeField $ Orville.setDefaultValue Orville.currentLocalTimestampDefault (Orville.localTimestampField "column")
, pure . SomeField $ Orville.setDefaultValue Orville.currentDateDefault (Orville.dateField "column")
] | 1,069 | false | true | 0 | 16 | 178 | 206 | 103 | 103 | null | null |
arybczak/haskell-dev-utils | cabal/CabalFreeze.hs | bsd-3-clause | changedPackages :: PackageSetDelta -> PackageSetDelta
changedPackages = M.filter $ \(v1, v2) -> isJust v1 && isJust v2 && v1 /= v2 | 130 | changedPackages :: PackageSetDelta -> PackageSetDelta
changedPackages = M.filter $ \(v1, v2) -> isJust v1 && isJust v2 && v1 /= v2 | 130 | changedPackages = M.filter $ \(v1, v2) -> isJust v1 && isJust v2 && v1 /= v2 | 76 | false | true | 0 | 10 | 20 | 50 | 26 | 24 | null | null |
hanshoglund/imitator | src/Music/Imitator/Sound.hs | gpl-3.0 | - |
-- Record to buffer.
--
-- > recordBuf buffer offset trig onOff input
--
recordBuf :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen
recordBuf buffer offset trig onOff input
= U.recordBuf AR buffer offset 1 0 onOff NoLoop trig RemoveSynth input
| 253 | recordBuf :: UGen -> UGen -> UGen -> UGen -> UGen -> UGen
recordBuf buffer offset trig onOff input
= U.recordBuf AR buffer offset 1 0 onOff NoLoop trig RemoveSynth input | 174 | recordBuf buffer offset trig onOff input
= U.recordBuf AR buffer offset 1 0 onOff NoLoop trig RemoveSynth input | 116 | true | true | 1 | 8 | 53 | 64 | 34 | 30 | null | null |
sboosali/commands-backends-osx9 | sources/Commands/Backends/OSX/Constants.hs | mit | keycode SemicolonKey = 0x29 | 31 | keycode SemicolonKey = 0x29 | 31 | keycode SemicolonKey = 0x29 | 31 | false | false | 0 | 5 | 7 | 9 | 4 | 5 | null | null |
dudebout/cdc_2012_dudebout_shamma | simulations/StockMarket.hs | isc | pric2 High e (u1, u2) = choose highToLow Low High
where highToLow = max ((1 - mixing) * down) mixing
down = (market e + order u1 + order u2) / 2
market Bull = 0
market Bear = 1
order Sell = 0.5
order _ = 0 | 271 | pric2 High e (u1, u2) = choose highToLow Low High
where highToLow = max ((1 - mixing) * down) mixing
down = (market e + order u1 + order u2) / 2
market Bull = 0
market Bear = 1
order Sell = 0.5
order _ = 0 | 271 | pric2 High e (u1, u2) = choose highToLow Low High
where highToLow = max ((1 - mixing) * down) mixing
down = (market e + order u1 + order u2) / 2
market Bull = 0
market Bear = 1
order Sell = 0.5
order _ = 0 | 271 | false | false | 5 | 10 | 113 | 118 | 57 | 61 | null | null |
c19/Exercism-Haskell | complex-numbers/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/autogen/Paths_complex_numbers.hs | mit | libdir = "/Users/c19/Documents/projects/exercism/haskell/haskell/complex-numbers/.stack-work/install/x86_64-osx/lts-8.21/8.0.2/lib/x86_64-osx-ghc-8.0.2/complex-numbers-1.0.0.1-8JgwOyf8WhxGBuOr0SRUpi" | 203 | libdir = "/Users/c19/Documents/projects/exercism/haskell/haskell/complex-numbers/.stack-work/install/x86_64-osx/lts-8.21/8.0.2/lib/x86_64-osx-ghc-8.0.2/complex-numbers-1.0.0.1-8JgwOyf8WhxGBuOr0SRUpi" | 203 | libdir = "/Users/c19/Documents/projects/exercism/haskell/haskell/complex-numbers/.stack-work/install/x86_64-osx/lts-8.21/8.0.2/lib/x86_64-osx-ghc-8.0.2/complex-numbers-1.0.0.1-8JgwOyf8WhxGBuOr0SRUpi" | 203 | false | false | 0 | 4 | 6 | 6 | 3 | 3 | null | null |
joshuaunderwood7/hsBF | Main.hs | gpl-3.0 | programBCK program@([], current, next) = ([], '~', next) | 56 | programBCK program@([], current, next) = ([], '~', next) | 56 | programBCK program@([], current, next) = ([], '~', next) | 56 | false | false | 0 | 8 | 7 | 34 | 20 | 14 | null | null |
zerobuzz/hs-webdriver | src/Test/WebDriver/Commands.hs | bsd-3-clause | -- |Returns a handle to the currently focused window
getCurrentWindow :: WebDriver wd => wd WindowHandle
getCurrentWindow = doSessCommand methodGet "/window_handle" Null | 169 | getCurrentWindow :: WebDriver wd => wd WindowHandle
getCurrentWindow = doSessCommand methodGet "/window_handle" Null | 116 | getCurrentWindow = doSessCommand methodGet "/window_handle" Null | 64 | true | true | 0 | 6 | 21 | 29 | 14 | 15 | null | null |
psibi/yesod | yesod-core/Yesod/Core/Handler.hs | mit | setSession :: MonadHandler m
=> Text -- ^ key
-> Text -- ^ value
-> m ()
setSession k = setSessionBS k . encodeUtf8 | 148 | setSession :: MonadHandler m
=> Text -- ^ key
-> Text -- ^ value
-> m ()
setSession k = setSessionBS k . encodeUtf8 | 148 | setSession k = setSessionBS k . encodeUtf8 | 42 | false | true | 0 | 9 | 56 | 43 | 21 | 22 | null | null |
mboes/dedukti | Dedukti/Module.hs | gpl-3.0 | qid_qualifier (Qid qual _ _) = qual | 35 | qid_qualifier (Qid qual _ _) = qual | 35 | qid_qualifier (Qid qual _ _) = qual | 35 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
lamefun/haddock | haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | bsd-2-clause | divDescription = sectionDiv "description" | 45 | divDescription = sectionDiv "description" | 45 | divDescription = sectionDiv "description" | 45 | false | false | 0 | 5 | 7 | 9 | 4 | 5 | null | null |
dysinger/amazonka | amazonka-s3/gen/Network/AWS/S3/CopyObject.hs | mpl-2.0 | -- | 'CopyObjectResponse' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'corCopyObjectResult' @::@ 'Maybe' 'CopyObjectResult'
--
-- * 'corCopySourceVersionId' @::@ 'Maybe' 'Text'
--
-- * 'corExpiration' @::@ 'Maybe' 'Text'
--
-- * 'corSSECustomerAlgorithm' @::@ 'Maybe' 'Text'
--
-- * 'corSSECustomerKeyMD5' @::@ 'Maybe' 'Text'
--
-- * 'corSSEKMSKeyId' @::@ 'Maybe' 'Text'
--
-- * 'corServerSideEncryption' @::@ 'Maybe' 'ServerSideEncryption'
--
copyObjectResponse :: CopyObjectResponse
copyObjectResponse = CopyObjectResponse
{ _corCopyObjectResult = Nothing
, _corExpiration = Nothing
, _corCopySourceVersionId = Nothing
, _corServerSideEncryption = Nothing
, _corSSECustomerAlgorithm = Nothing
, _corSSECustomerKeyMD5 = Nothing
, _corSSEKMSKeyId = Nothing
} | 856 | copyObjectResponse :: CopyObjectResponse
copyObjectResponse = CopyObjectResponse
{ _corCopyObjectResult = Nothing
, _corExpiration = Nothing
, _corCopySourceVersionId = Nothing
, _corServerSideEncryption = Nothing
, _corSSECustomerAlgorithm = Nothing
, _corSSECustomerKeyMD5 = Nothing
, _corSSEKMSKeyId = Nothing
} | 373 | copyObjectResponse = CopyObjectResponse
{ _corCopyObjectResult = Nothing
, _corExpiration = Nothing
, _corCopySourceVersionId = Nothing
, _corServerSideEncryption = Nothing
, _corSSECustomerAlgorithm = Nothing
, _corSSECustomerKeyMD5 = Nothing
, _corSSEKMSKeyId = Nothing
} | 332 | true | true | 0 | 7 | 156 | 83 | 55 | 28 | null | null |
miguelpagano/equ | Equ/TypeChecker/State.hs | gpl-3.0 | rewriteS :: Type -> TyState Type
rewriteS t = flip rewrite t <$> getSub | 71 | rewriteS :: Type -> TyState Type
rewriteS t = flip rewrite t <$> getSub | 71 | rewriteS t = flip rewrite t <$> getSub | 38 | false | true | 0 | 7 | 13 | 35 | 15 | 20 | null | null |
fpco/hlint | src/HSE/Util.hs | bsd-3-clause | nullSrcSpan :: SrcSpan
nullSrcSpan = mkSrcSpan nullSrcLoc nullSrcLoc | 68 | nullSrcSpan :: SrcSpan
nullSrcSpan = mkSrcSpan nullSrcLoc nullSrcLoc | 68 | nullSrcSpan = mkSrcSpan nullSrcLoc nullSrcLoc | 45 | false | true | 0 | 6 | 7 | 22 | 9 | 13 | null | null |
spinda/liquidhaskell | tests/gsoc15/unknown/pos/TerminationNum0.hs | bsd-3-clause | fak1 :: (Num a) => Int -> a -> Int
fak1 0 _ = 1 | 48 | fak1 :: (Num a) => Int -> a -> Int
fak1 0 _ = 1 | 47 | fak1 0 _ = 1 | 12 | false | true | 0 | 7 | 15 | 33 | 17 | 16 | null | null |
arnizamani/DLvalidity | Proof.hs | gpl-2.0 | substitution _ f@(Identical eq) xs wm | snd (getSub (lhs eq)) == Nothing && snd (getSub (rhs eq)) == Nothing
= [singleFiSet $ apply (Identical (equ (fst (getSub (lhs eq))) (fst (getSub (rhs eq))))) xs] | 213 | substitution _ f@(Identical eq) xs wm | snd (getSub (lhs eq)) == Nothing && snd (getSub (rhs eq)) == Nothing
= [singleFiSet $ apply (Identical (equ (fst (getSub (lhs eq))) (fst (getSub (rhs eq))))) xs] | 213 | substitution _ f@(Identical eq) xs wm | snd (getSub (lhs eq)) == Nothing && snd (getSub (rhs eq)) == Nothing
= [singleFiSet $ apply (Identical (equ (fst (getSub (lhs eq))) (fst (getSub (rhs eq))))) xs] | 213 | false | false | 3 | 18 | 46 | 139 | 65 | 74 | null | null |
snapframework/snap-core | src/Snap/Internal/Parsing.hs | bsd-3-clause | ------------------------------------------------------------------------------
pQuotedString :: Parser ByteString
pQuotedString = pQuotedString' isRFCText | 154 | pQuotedString :: Parser ByteString
pQuotedString = pQuotedString' isRFCText | 75 | pQuotedString = pQuotedString' isRFCText | 40 | true | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
karknu/rws | src/Lexer.hs | bsd-3-clause | stringLiteral :: Parser String
stringLiteral = P.stringLiteral lexer | 72 | stringLiteral :: Parser String
stringLiteral = P.stringLiteral lexer | 72 | stringLiteral = P.stringLiteral lexer | 39 | false | true | 0 | 6 | 11 | 19 | 9 | 10 | null | null |
edwardwas/dimensional-cellular-automata | app/Main.hs | isc | test m =
renderRasterific "output.png" (dims $ pure 1200) .
Foldable.foldl' (===) mempty .
take m . map oneDimDisplay . evoledStream | 138 | test m =
renderRasterific "output.png" (dims $ pure 1200) .
Foldable.foldl' (===) mempty .
take m . map oneDimDisplay . evoledStream | 138 | test m =
renderRasterific "output.png" (dims $ pure 1200) .
Foldable.foldl' (===) mempty .
take m . map oneDimDisplay . evoledStream | 138 | false | false | 0 | 12 | 26 | 55 | 26 | 29 | null | null |
TomMD/ghc | compiler/types/Type.hs | bsd-3-clause | mkPiTypes :: [Var] -> Type -> Type
-- ^ 'mkPiType' for multiple type or value arguments
mkPiType v ty
| isId v = mkFunTy (varType v) ty
| otherwise = mkForAllTy v ty | 175 | mkPiTypes :: [Var] -> Type -> Type
mkPiType v ty
| isId v = mkFunTy (varType v) ty
| otherwise = mkForAllTy v ty | 121 | mkPiType v ty
| isId v = mkFunTy (varType v) ty
| otherwise = mkForAllTy v ty | 86 | true | true | 0 | 8 | 42 | 69 | 31 | 38 | null | null |
afiskon/simple-neural-networks | src/AI/NeuralNetworks/Simple.hs | bsd-2-clause | applyAF Logistic = logistic | 27 | applyAF Logistic = logistic | 27 | applyAF Logistic = logistic | 27 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
juodaspaulius/clafer-old-customBNFC | src/Language/Clafer/Front/LayoutResolver.hs | mit | -- | Get the number of characters in the token.
tokenLength :: Token -> Int
tokenLength t = length $ prToken t | 110 | tokenLength :: Token -> Int
tokenLength t = length $ prToken t | 62 | tokenLength t = length $ prToken t | 34 | true | true | 0 | 6 | 21 | 26 | 13 | 13 | null | null |
mydaum/cabal | Cabal/Distribution/Simple/Setup.hs | bsd-3-clause | flagToMaybe :: Flag a -> Maybe a
flagToMaybe (Flag x) = Just x | 62 | flagToMaybe :: Flag a -> Maybe a
flagToMaybe (Flag x) = Just x | 62 | flagToMaybe (Flag x) = Just x | 29 | false | true | 0 | 9 | 12 | 37 | 16 | 21 | null | null |
peterson/lets-haskell | src/Lets/TupleLens.hs | bsd-3-clause | -- return the value x
set1 :: x' -> (x, y) -> (x', y)
set1 x' (_,y) = (x',y) | 77 | set1 :: x' -> (x, y) -> (x', y)
set1 x' (_,y) = (x',y) | 54 | set1 x' (_,y) = (x',y) | 22 | true | true | 0 | 7 | 19 | 49 | 29 | 20 | null | null |
ekmett/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | getRegister' _ is32Bit (CmmMachOp (MO_UU_Conv W32 W64) [CmmLoad addr _])
| not is32Bit = do
code <- intLoadCode (MOV II32) addr -- 32-bit loads zero-extend
return (Any II64 code) | 183 | getRegister' _ is32Bit (CmmMachOp (MO_UU_Conv W32 W64) [CmmLoad addr _])
| not is32Bit = do
code <- intLoadCode (MOV II32) addr -- 32-bit loads zero-extend
return (Any II64 code) | 183 | getRegister' _ is32Bit (CmmMachOp (MO_UU_Conv W32 W64) [CmmLoad addr _])
| not is32Bit = do
code <- intLoadCode (MOV II32) addr -- 32-bit loads zero-extend
return (Any II64 code) | 183 | false | false | 1 | 12 | 33 | 83 | 36 | 47 | null | null |
facebookincubator/duckling | Duckling/Time/TR/Rules.hs | bsd-3-clause | ruleInstants :: [Rule]
ruleInstants = mkRuleInstants
[ ( "now" , TG.Second, 0, "ş?imdi|şu(\\s)?an" )
, ( "today" , TG.Day , 0, "bugün" )
, ( "tomorrow" , TG.Day , 1, "yarın" )
, ( "yesterday" , TG.Day , -1, "dün" )
, ( "after tomorrow" , TG.Day , 2, "(yarından\\ssonraki)\\s?(gün)?" )
, ( "before yesterday", TG.Day , -2, "(dün\\sdeğil\\sevvelsi|dünden\\sönceki|öbürsü|öbürki)\\s(gün)?")
, ( "EOM|End of day", TG.Day , 1, "gün\\s(sonu(na|ndan?)?|bitimi(ne|nden?)?)?" )
, ( "EOM|End of month", TG.Month , 1, "ay\\s(sonu(na|ndan?)?|bitimi(ne|nden?)?)?" )
, ( "EOY|End of year" , TG.Year , 1, "yıl\\s(sonu(na|ndan?)?|bitimi(ne|nden?)?)?" )
] | 1,007 | ruleInstants :: [Rule]
ruleInstants = mkRuleInstants
[ ( "now" , TG.Second, 0, "ş?imdi|şu(\\s)?an" )
, ( "today" , TG.Day , 0, "bugün" )
, ( "tomorrow" , TG.Day , 1, "yarın" )
, ( "yesterday" , TG.Day , -1, "dün" )
, ( "after tomorrow" , TG.Day , 2, "(yarından\\ssonraki)\\s?(gün)?" )
, ( "before yesterday", TG.Day , -2, "(dün\\sdeğil\\sevvelsi|dünden\\sönceki|öbürsü|öbürki)\\s(gün)?")
, ( "EOM|End of day", TG.Day , 1, "gün\\s(sonu(na|ndan?)?|bitimi(ne|nden?)?)?" )
, ( "EOM|End of month", TG.Month , 1, "ay\\s(sonu(na|ndan?)?|bitimi(ne|nden?)?)?" )
, ( "EOY|End of year" , TG.Year , 1, "yıl\\s(sonu(na|ndan?)?|bitimi(ne|nden?)?)?" )
] | 1,007 | ruleInstants = mkRuleInstants
[ ( "now" , TG.Second, 0, "ş?imdi|şu(\\s)?an" )
, ( "today" , TG.Day , 0, "bugün" )
, ( "tomorrow" , TG.Day , 1, "yarın" )
, ( "yesterday" , TG.Day , -1, "dün" )
, ( "after tomorrow" , TG.Day , 2, "(yarından\\ssonraki)\\s?(gün)?" )
, ( "before yesterday", TG.Day , -2, "(dün\\sdeğil\\sevvelsi|dünden\\sönceki|öbürsü|öbürki)\\s(gün)?")
, ( "EOM|End of day", TG.Day , 1, "gün\\s(sonu(na|ndan?)?|bitimi(ne|nden?)?)?" )
, ( "EOM|End of month", TG.Month , 1, "ay\\s(sonu(na|ndan?)?|bitimi(ne|nden?)?)?" )
, ( "EOY|End of year" , TG.Year , 1, "yıl\\s(sonu(na|ndan?)?|bitimi(ne|nden?)?)?" )
] | 984 | false | true | 0 | 7 | 459 | 174 | 110 | 64 | null | null |
betaveros/bcodex | Text/Bcodex/Braille.hs | mit | fromBraille :: Char -> CxElem Char
fromBraille c = case fromBraillePattern c of
Right n -> case Map.lookup n fromBrailleMap of
Just c' -> Right c'
Nothing -> Left $ CxBadInt n
Left lf -> Left lf | 218 | fromBraille :: Char -> CxElem Char
fromBraille c = case fromBraillePattern c of
Right n -> case Map.lookup n fromBrailleMap of
Just c' -> Right c'
Nothing -> Left $ CxBadInt n
Left lf -> Left lf | 218 | fromBraille c = case fromBraillePattern c of
Right n -> case Map.lookup n fromBrailleMap of
Just c' -> Right c'
Nothing -> Left $ CxBadInt n
Left lf -> Left lf | 183 | false | true | 0 | 12 | 60 | 89 | 39 | 50 | null | null |
tsahyt/clingo-haskell | src/Clingo/Internal/AST.hs | mit | freeHeadLiteral (AstHeadDisjunction l x) = do
freeRawLocation l
freeIndirection x freeDisjunction | 105 | freeHeadLiteral (AstHeadDisjunction l x) = do
freeRawLocation l
freeIndirection x freeDisjunction | 105 | freeHeadLiteral (AstHeadDisjunction l x) = do
freeRawLocation l
freeIndirection x freeDisjunction | 105 | false | false | 0 | 7 | 18 | 31 | 13 | 18 | null | null |
brendanhay/gogol | gogol-classroom/gen/Network/Google/Classroom/Types/Product.hs | mpl-2.0 | -- | The \`course_id\` of the course to subscribe to roster changes for.
crciCourseId :: Lens' CourseRosterChangesInfo (Maybe Text)
crciCourseId
= lens _crciCourseId (\ s a -> s{_crciCourseId = a}) | 199 | crciCourseId :: Lens' CourseRosterChangesInfo (Maybe Text)
crciCourseId
= lens _crciCourseId (\ s a -> s{_crciCourseId = a}) | 126 | crciCourseId
= lens _crciCourseId (\ s a -> s{_crciCourseId = a}) | 67 | true | true | 1 | 9 | 31 | 52 | 25 | 27 | null | null |
TomMD/cryptol | sbv/Data/SBV/Tools/Polynomial.hs | bsd-3-clause | crcBV :: Int -> [SBool] -> [SBool] -> [SBool]
crcBV n m p = take n $ go (replicate n false) (m ++ replicate n false)
where mask = drop (length p - n) p
go c [] = c
go c (b:bs) = go next bs
where c' = drop 1 c ++ [b]
next = ite (head c) (zipWith (<+>) c' mask) c'
-- | Compute CRC's over polynomials, i.e., symbolic words. The first
-- 'Int' argument plays the same role as the one in the 'crcBV' function. | 454 | crcBV :: Int -> [SBool] -> [SBool] -> [SBool]
crcBV n m p = take n $ go (replicate n false) (m ++ replicate n false)
where mask = drop (length p - n) p
go c [] = c
go c (b:bs) = go next bs
where c' = drop 1 c ++ [b]
next = ite (head c) (zipWith (<+>) c' mask) c'
-- | Compute CRC's over polynomials, i.e., symbolic words. The first
-- 'Int' argument plays the same role as the one in the 'crcBV' function. | 454 | crcBV n m p = take n $ go (replicate n false) (m ++ replicate n false)
where mask = drop (length p - n) p
go c [] = c
go c (b:bs) = go next bs
where c' = drop 1 c ++ [b]
next = ite (head c) (zipWith (<+>) c' mask) c'
-- | Compute CRC's over polynomials, i.e., symbolic words. The first
-- 'Int' argument plays the same role as the one in the 'crcBV' function. | 408 | false | true | 2 | 9 | 138 | 178 | 92 | 86 | null | null |
vikraman/ghc | compiler/basicTypes/Name.hs | bsd-3-clause | isTyConName :: Name -> Bool
isTyConName name = isTcOcc (nameOccName name) | 73 | isTyConName :: Name -> Bool
isTyConName name = isTcOcc (nameOccName name) | 73 | isTyConName name = isTcOcc (nameOccName name) | 45 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
bamboo/idris-cil | Setup.hs | bsd-3-clause | installRtsPackage :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()
installRtsPackage _ _ _ _ =
traceProcess (proc "idris" ["--install", "cil.ipkg"]) { cwd = Just "rts" } | 193 | installRtsPackage :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()
installRtsPackage _ _ _ _ =
traceProcess (proc "idris" ["--install", "cil.ipkg"]) { cwd = Just "rts" } | 193 | installRtsPackage _ _ _ _ =
traceProcess (proc "idris" ["--install", "cil.ipkg"]) { cwd = Just "rts" } | 104 | false | true | 0 | 10 | 30 | 69 | 35 | 34 | null | null |
kmate/HaRe | old/testing/unfoldAsPatterns/A3_TokOut.hs | bsd-3-clause | insert val (T tval left right)
| val > tval = T tval left (insert val right)
| otherwise = T tval (insert val left) right | 127 | insert val (T tval left right)
| val > tval = T tval left (insert val right)
| otherwise = T tval (insert val left) right | 127 | insert val (T tval left right)
| val > tval = T tval left (insert val right)
| otherwise = T tval (insert val left) right | 127 | false | false | 0 | 8 | 31 | 70 | 32 | 38 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.