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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
haskell-distributed/distributed-process-demos | src/MapReduce/KMeans.hs | bsd-3-clause | localKMeans :: Array Int Point
-> [Cluster]
-> Int
-> Map Cluster ([Point], Point)
localKMeans points cs iterations = go (iterations - 1)
where
mr :: [Cluster] -> Map Cluster ([Point], Point)
mr = localMapReduce (kmeans points) . trivialSegmentation
go :: Int -> Map Cluster ([Point], Point)
go 0 = mr cs
go n = mr . map snd . Map.elems . go $ n - 1
trivialSegmentation :: [Cluster] -> Map (Int, Int) [Cluster]
trivialSegmentation cs' = Map.fromList [(bounds points, cs')] | 540 | localKMeans :: Array Int Point
-> [Cluster]
-> Int
-> Map Cluster ([Point], Point)
localKMeans points cs iterations = go (iterations - 1)
where
mr :: [Cluster] -> Map Cluster ([Point], Point)
mr = localMapReduce (kmeans points) . trivialSegmentation
go :: Int -> Map Cluster ([Point], Point)
go 0 = mr cs
go n = mr . map snd . Map.elems . go $ n - 1
trivialSegmentation :: [Cluster] -> Map (Int, Int) [Cluster]
trivialSegmentation cs' = Map.fromList [(bounds points, cs')] | 540 | localKMeans points cs iterations = go (iterations - 1)
where
mr :: [Cluster] -> Map Cluster ([Point], Point)
mr = localMapReduce (kmeans points) . trivialSegmentation
go :: Int -> Map Cluster ([Point], Point)
go 0 = mr cs
go n = mr . map snd . Map.elems . go $ n - 1
trivialSegmentation :: [Cluster] -> Map (Int, Int) [Cluster]
trivialSegmentation cs' = Map.fromList [(bounds points, cs')] | 421 | false | true | 7 | 11 | 149 | 252 | 123 | 129 | null | null |
cmc-haskell-2016/checkers | src/GraphicsProcessing.hs | bsd-3-clause | eventHandler pool (EventKey (SpecialKey KeyEnter) Down _ _) (WorldObject players checkers (State 16 checkerChosen posToMoveChosen checkerIsChosen) alertMessage) =
(WorldObject players checkers (State 4 checkerChosen posToMoveChosen checkerIsChosen) alertMessage) | 264 | eventHandler pool (EventKey (SpecialKey KeyEnter) Down _ _) (WorldObject players checkers (State 16 checkerChosen posToMoveChosen checkerIsChosen) alertMessage) =
(WorldObject players checkers (State 4 checkerChosen posToMoveChosen checkerIsChosen) alertMessage) | 264 | eventHandler pool (EventKey (SpecialKey KeyEnter) Down _ _) (WorldObject players checkers (State 16 checkerChosen posToMoveChosen checkerIsChosen) alertMessage) =
(WorldObject players checkers (State 4 checkerChosen posToMoveChosen checkerIsChosen) alertMessage) | 264 | false | false | 0 | 9 | 28 | 79 | 39 | 40 | null | null |
bartavelle/manglingrules | Mangling.hs | gpl-3.0 | hashcatrules :: Char -> Parser [Rule]
hashcatrules c = case c of
'z' -> (return . H . DuplicateFirstN) <$> numeric
'Z' -> (return . H . DuplicateLastN) <$> numeric
'+' -> (return . H . AsciiIncrement) <$> numeric
'k' -> return [H SwapFront]
'K' -> return [H SwapBack]
'*' -> (return . H) <$> (Swap <$> numeric <*> numeric)
'q' -> return [H DuplicateAll]
_ -> unexpected $ "Unknown rule (even hashcat) : " ++ [c] | 475 | hashcatrules :: Char -> Parser [Rule]
hashcatrules c = case c of
'z' -> (return . H . DuplicateFirstN) <$> numeric
'Z' -> (return . H . DuplicateLastN) <$> numeric
'+' -> (return . H . AsciiIncrement) <$> numeric
'k' -> return [H SwapFront]
'K' -> return [H SwapBack]
'*' -> (return . H) <$> (Swap <$> numeric <*> numeric)
'q' -> return [H DuplicateAll]
_ -> unexpected $ "Unknown rule (even hashcat) : " ++ [c] | 475 | hashcatrules c = case c of
'z' -> (return . H . DuplicateFirstN) <$> numeric
'Z' -> (return . H . DuplicateLastN) <$> numeric
'+' -> (return . H . AsciiIncrement) <$> numeric
'k' -> return [H SwapFront]
'K' -> return [H SwapBack]
'*' -> (return . H) <$> (Swap <$> numeric <*> numeric)
'q' -> return [H DuplicateAll]
_ -> unexpected $ "Unknown rule (even hashcat) : " ++ [c] | 437 | false | true | 0 | 11 | 140 | 186 | 93 | 93 | null | null |
elieux/ghc | libraries/base/Text/ParserCombinators/ReadPrec.hs | bsd-3-clause | prec :: Prec -> ReadPrec a -> ReadPrec a
-- ^ @(prec n p)@ checks whether the precedence context is
-- less than or equal to @n@, and
--
-- * if not, fails
--
-- * if so, parses @p@ in context @n@.
prec n (P f) = P (\c -> if c <= n then f n else ReadP.pfail) | 264 | prec :: Prec -> ReadPrec a -> ReadPrec a
prec n (P f) = P (\c -> if c <= n then f n else ReadP.pfail) | 101 | prec n (P f) = P (\c -> if c <= n then f n else ReadP.pfail) | 60 | true | true | 0 | 9 | 66 | 70 | 38 | 32 | null | null |
elieux/ghc | compiler/utils/Outputable.hs | bsd-3-clause | speakNth :: Int -> SDoc
speakNth 1 = ptext (sLit "first") | 57 | speakNth :: Int -> SDoc
speakNth 1 = ptext (sLit "first") | 57 | speakNth 1 = ptext (sLit "first") | 33 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
sol2man2/Learn-You-A-Haskell-For-Great-Good | src/Geometry.hs | mit | cuboidArea :: Float -> Float -> Float -> Float
cuboidArea a b c = rectArea a b*c | 80 | cuboidArea :: Float -> Float -> Float -> Float
cuboidArea a b c = rectArea a b*c | 80 | cuboidArea a b c = rectArea a b*c | 33 | false | true | 0 | 7 | 16 | 39 | 19 | 20 | null | null |
chwthewke/horbits | src/horbits/Horbits/UI/ShowDim.hs | bsd-3-clause | showQuantitySci :: (RealFloat a, ShowDim d) => Quantity d a -> String
showQuantitySci = translateExponent . showQuantityWith [s|%e%s|] | 134 | showQuantitySci :: (RealFloat a, ShowDim d) => Quantity d a -> String
showQuantitySci = translateExponent . showQuantityWith [s|%e%s|] | 134 | showQuantitySci = translateExponent . showQuantityWith [s|%e%s|] | 64 | false | true | 0 | 7 | 17 | 46 | 25 | 21 | null | null |
bitemyapp/ghc | compiler/main/DynFlags.hs | bsd-3-clause | opt_windres :: DynFlags -> [String]
opt_windres dflags = sOpt_windres (settings dflags) | 97 | opt_windres :: DynFlags -> [String]
opt_windres dflags = sOpt_windres (settings dflags) | 97 | opt_windres dflags = sOpt_windres (settings dflags) | 51 | false | true | 0 | 8 | 20 | 35 | 16 | 19 | null | null |
noinia/hsync-client | src/HSync/Client/Foundation.hs | bsd-3-clause | runMain :: Action () -> IO ()
runMain act = do
(hc,sc) <- getConfigs
sd <- getStateDir sc
withAcids (Just sd) $ \acids' -> withSync hc sc acids' act | 169 | runMain :: Action () -> IO ()
runMain act = do
(hc,sc) <- getConfigs
sd <- getStateDir sc
withAcids (Just sd) $ \acids' -> withSync hc sc acids' act | 169 | runMain act = do
(hc,sc) <- getConfigs
sd <- getStateDir sc
withAcids (Just sd) $ \acids' -> withSync hc sc acids' act | 135 | false | true | 0 | 10 | 49 | 81 | 38 | 43 | null | null |
AlexeyRaga/eta | compiler/ETA/TypeCheck/TcGenDeriv.hs | bsd-3-clause | gtChar_RDR = varQual_RDR gHC_PRIM (fsLit "gtChar#") | 56 | gtChar_RDR = varQual_RDR gHC_PRIM (fsLit "gtChar#") | 56 | gtChar_RDR = varQual_RDR gHC_PRIM (fsLit "gtChar#") | 56 | false | false | 0 | 7 | 10 | 17 | 8 | 9 | null | null |
PipocaQuemada/ermine | src/Ermine/Inference/Type.hs | bsd-2-clause | inferHardType (Term.Tuple n) = do
vs <- replicateM (fromIntegral n) $ pure <$> newMeta star Nothing
return $ Witness [] (foldr (~>) (tup vs) vs) $
dataCon (replicate (fromIntegral n) (_Convention # C)) 0 (tupleg n) | 231 | inferHardType (Term.Tuple n) = do
vs <- replicateM (fromIntegral n) $ pure <$> newMeta star Nothing
return $ Witness [] (foldr (~>) (tup vs) vs) $
dataCon (replicate (fromIntegral n) (_Convention # C)) 0 (tupleg n) | 231 | inferHardType (Term.Tuple n) = do
vs <- replicateM (fromIntegral n) $ pure <$> newMeta star Nothing
return $ Witness [] (foldr (~>) (tup vs) vs) $
dataCon (replicate (fromIntegral n) (_Convention # C)) 0 (tupleg n) | 231 | false | false | 0 | 13 | 52 | 116 | 56 | 60 | null | null |
fmthoma/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | -- Classes Generic and Generic1, Datatype, Constructor and Selector
genClassName, gen1ClassName, datatypeClassName, constructorClassName,
selectorClassName :: Name
genClassName = clsQual gHC_GENERICS (fsLit "Generic") genClassKey | 233 | genClassName, gen1ClassName, datatypeClassName, constructorClassName,
selectorClassName :: Name
genClassName = clsQual gHC_GENERICS (fsLit "Generic") genClassKey | 165 | genClassName = clsQual gHC_GENERICS (fsLit "Generic") genClassKey | 67 | true | true | 2 | 7 | 26 | 37 | 21 | 16 | null | null |
0gajun/mal | haskell/Types.hs | mpl-2.0 | _equal_Q (MalSymbol a) (MalSymbol b) = a == b | 45 | _equal_Q (MalSymbol a) (MalSymbol b) = a == b | 45 | _equal_Q (MalSymbol a) (MalSymbol b) = a == b | 45 | false | false | 0 | 6 | 8 | 29 | 13 | 16 | null | null |
beni55/text | tests/Tests/Properties.hs | bsd-2-clause | showFloat TB.Generic = showGFloat | 34 | showFloat TB.Generic = showGFloat | 34 | showFloat TB.Generic = showGFloat | 34 | false | false | 0 | 6 | 4 | 11 | 5 | 6 | null | null |
diku-dk/futhark | unittests/Language/Futhark/SyntaxTests.hs | isc | pUniqueness :: Parser Uniqueness
pUniqueness = choice [lexeme "*" $> Unique, pure Nonunique] | 92 | pUniqueness :: Parser Uniqueness
pUniqueness = choice [lexeme "*" $> Unique, pure Nonunique] | 92 | pUniqueness = choice [lexeme "*" $> Unique, pure Nonunique] | 59 | false | true | 0 | 8 | 12 | 33 | 16 | 17 | null | null |
DanielSchuessler/hstri | Math/GaussElim/Tests.hs | gpl-3.0 | idRatMat :: f (f' Rational) -> f (f' Rational)
idRatMat = id | 60 | idRatMat :: f (f' Rational) -> f (f' Rational)
idRatMat = id | 60 | idRatMat = id | 13 | false | true | 0 | 8 | 11 | 33 | 16 | 17 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/enumFrom_6.hs | mit | enumFromOrdering :: Ordering -> (List Ordering)
enumFromOrdering x = enumFromToOrdering x GT | 94 | enumFromOrdering :: Ordering -> (List Ordering)
enumFromOrdering x = enumFromToOrdering x GT | 94 | enumFromOrdering x = enumFromToOrdering x GT | 44 | false | true | 0 | 9 | 13 | 34 | 15 | 19 | null | null |
ozgurakgun/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | intTyName (ITFixed sized) = "B" ++ show (nativeTyWidth sized) | 61 | intTyName (ITFixed sized) = "B" ++ show (nativeTyWidth sized) | 61 | intTyName (ITFixed sized) = "B" ++ show (nativeTyWidth sized) | 61 | false | false | 0 | 8 | 8 | 29 | 13 | 16 | null | null |
david-caro/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | prop_checkUncheckedCd5 = verifyTree checkUncheckedCd "if true; then cd foo; fi" | 79 | prop_checkUncheckedCd5 = verifyTree checkUncheckedCd "if true; then cd foo; fi" | 79 | prop_checkUncheckedCd5 = verifyTree checkUncheckedCd "if true; then cd foo; fi" | 79 | false | false | 0 | 5 | 9 | 11 | 5 | 6 | null | null |
ribag/ganeti-experiments | src/Ganeti/Query/Instance.hs | gpl-2.0 | -- | Gets an optional fillable NIC field.
getOptionalIndexedNicField :: (J.JSON a)
=> (FilledNicParams -> Maybe a)
-> Int
-> FieldGetter Instance Runtime
getOptionalIndexedNicField =
getIndexedFieldWithDefault
(map nicNicparams . instNics) (\x _ -> getDefaultNicParams x) fillNicParams | 372 | getOptionalIndexedNicField :: (J.JSON a)
=> (FilledNicParams -> Maybe a)
-> Int
-> FieldGetter Instance Runtime
getOptionalIndexedNicField =
getIndexedFieldWithDefault
(map nicNicparams . instNics) (\x _ -> getDefaultNicParams x) fillNicParams | 330 | getOptionalIndexedNicField =
getIndexedFieldWithDefault
(map nicNicparams . instNics) (\x _ -> getDefaultNicParams x) fillNicParams | 137 | true | true | 0 | 10 | 122 | 83 | 40 | 43 | null | null |
siddhanathan/ghc | compiler/utils/Outputable.hs | bsd-3-clause | fsep ds = SDoc $ \sty -> Pretty.fsep [runSDoc d sty | d <- ds] | 62 | fsep ds = SDoc $ \sty -> Pretty.fsep [runSDoc d sty | d <- ds] | 62 | fsep ds = SDoc $ \sty -> Pretty.fsep [runSDoc d sty | d <- ds] | 62 | false | false | 0 | 10 | 14 | 39 | 19 | 20 | null | null |
fmapfmapfmap/amazonka | amazonka-ec2/gen/Network/AWS/EC2/CreateInternetGateway.hs | mpl-2.0 | -- | Information about the Internet gateway.
cigrsInternetGateway :: Lens' CreateInternetGatewayResponse (Maybe InternetGateway)
cigrsInternetGateway = lens _cigrsInternetGateway (\ s a -> s{_cigrsInternetGateway = a}) | 218 | cigrsInternetGateway :: Lens' CreateInternetGatewayResponse (Maybe InternetGateway)
cigrsInternetGateway = lens _cigrsInternetGateway (\ s a -> s{_cigrsInternetGateway = a}) | 173 | cigrsInternetGateway = lens _cigrsInternetGateway (\ s a -> s{_cigrsInternetGateway = a}) | 89 | true | true | 0 | 9 | 23 | 46 | 25 | 21 | null | null |
hguenther/smtlib2 | Language/SMTLib2/Internals/Expression.hs | gpl-3.0 | renderValue SMTRendering (IntValue v)
= if v>=0 then showsPrec 0 v
else showString "(- " .
showsPrec 0 (negate v) .
showChar ')' | 152 | renderValue SMTRendering (IntValue v)
= if v>=0 then showsPrec 0 v
else showString "(- " .
showsPrec 0 (negate v) .
showChar ')' | 152 | renderValue SMTRendering (IntValue v)
= if v>=0 then showsPrec 0 v
else showString "(- " .
showsPrec 0 (negate v) .
showChar ')' | 152 | false | false | 0 | 8 | 46 | 62 | 28 | 34 | null | null |
asztal/transact-sql | Language/TransactSql/Types.hs | bsd-3-clause | precision SmallMoney = Just 10 | 30 | precision SmallMoney = Just 10 | 30 | precision SmallMoney = Just 10 | 30 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
dgonyeo/brandskell | Handler/EditEntry.hs | mit | applyNicks :: [(Int,T.Text,Maybe T.Text)] -> [(Int,T.Text)]
applyNicks [] = [] | 105 | applyNicks :: [(Int,T.Text,Maybe T.Text)] -> [(Int,T.Text)]
applyNicks [] = [] | 105 | applyNicks [] = [] | 45 | false | true | 0 | 9 | 36 | 52 | 29 | 23 | null | null |
flowbox-public/imagemagick | Graphics/ImageMagick/MagickWand/MagickWand.hs | apache-2.0 | getColorspace :: (MonadResource m) => PMagickWand -> m ColorspaceType
getColorspace = liftIO . F.magickGetColorspace | 116 | getColorspace :: (MonadResource m) => PMagickWand -> m ColorspaceType
getColorspace = liftIO . F.magickGetColorspace | 116 | getColorspace = liftIO . F.magickGetColorspace | 46 | false | true | 0 | 7 | 13 | 33 | 17 | 16 | null | null |
krattai/noo-ebs | docs/zeroMQ-guide2/examples/Haskell/syncpub.hs | bsd-2-clause | getSubs :: Int -> Socket a -> IO ()
getSubs num sock | num >= subscribersExpected = return ()
| otherwise = do
msg <- receive sock []
send sock (pack "") []
getSubs (num + 1) sock | 267 | getSubs :: Int -> Socket a -> IO ()
getSubs num sock | num >= subscribersExpected = return ()
| otherwise = do
msg <- receive sock []
send sock (pack "") []
getSubs (num + 1) sock | 259 | getSubs num sock | num >= subscribersExpected = return ()
| otherwise = do
msg <- receive sock []
send sock (pack "") []
getSubs (num + 1) sock | 223 | false | true | 0 | 10 | 125 | 103 | 46 | 57 | null | null |
ComputationWithBoundedResources/tct-trs | tct-trs/Main.hs | bsd-3-clause | args = (degreeArg `optional` 1, degreeArg `optional` 3) | 55 | args = (degreeArg `optional` 1, degreeArg `optional` 3) | 55 | args = (degreeArg `optional` 1, degreeArg `optional` 3) | 55 | false | false | 1 | 7 | 7 | 28 | 15 | 13 | null | null |
mainland/dph | dph-examples/examples/smoke/sharing/Indices/Main.hs | bsd-3-clause | un "vectorised" count countMax
| count > countMax = return ()
| otherwise
= do let arr = P.fromList [0 .. count - 1]
arr `seq` return ()
(arrResult, tElapsed)
<- time
$ let arr' = ID.indicesPA arr arr
in P.nf arr' `seq` return arr'
-- print $ P.length arrResult
-- putStr $ prettyTime tElapsed
putStrLn $ (show $ P.length arrResult)
++ "\t "
++ (show $ wallTime milliseconds tElapsed)
run "vectorised" (count * 2) countMax
-- Sequential version using Data.Vector
| 617 | run "vectorised" count countMax
| count > countMax = return ()
| otherwise
= do let arr = P.fromList [0 .. count - 1]
arr `seq` return ()
(arrResult, tElapsed)
<- time
$ let arr' = ID.indicesPA arr arr
in P.nf arr' `seq` return arr'
-- print $ P.length arrResult
-- putStr $ prettyTime tElapsed
putStrLn $ (show $ P.length arrResult)
++ "\t "
++ (show $ wallTime milliseconds tElapsed)
run "vectorised" (count * 2) countMax
-- Sequential version using Data.Vector | 617 | run "vectorised" count countMax
| count > countMax = return ()
| otherwise
= do let arr = P.fromList [0 .. count - 1]
arr `seq` return ()
(arrResult, tElapsed)
<- time
$ let arr' = ID.indicesPA arr arr
in P.nf arr' `seq` return arr'
-- print $ P.length arrResult
-- putStr $ prettyTime tElapsed
putStrLn $ (show $ P.length arrResult)
++ "\t "
++ (show $ wallTime milliseconds tElapsed)
run "vectorised" (count * 2) countMax
-- Sequential version using Data.Vector | 617 | false | false | 0 | 15 | 235 | 185 | 90 | 95 | null | null |
DougBurke/swish | tests/GraphPartitionTest.hs | lgpl-2.1 | p12 = toPF "s2" [ (LF "p21",PartObj (LF "o21"))
, (LF "p22",PartObj (LF "o22"))
] | 113 | p12 = toPF "s2" [ (LF "p21",PartObj (LF "o21"))
, (LF "p22",PartObj (LF "o22"))
] | 113 | p12 = toPF "s2" [ (LF "p21",PartObj (LF "o21"))
, (LF "p22",PartObj (LF "o22"))
] | 113 | false | false | 1 | 10 | 46 | 56 | 27 | 29 | null | null |
amccausl/Swish | Swish/HaskellRDF/GraphTest.hs | lgpl-2.1 | as22 = map (makeScopedArc 2) as2 | 32 | as22 = map (makeScopedArc 2) as2 | 32 | as22 = map (makeScopedArc 2) as2 | 32 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
mydaum/cabal | cabal-testsuite/PackageTests/Backpack/Includes1/setup.test.hs | bsd-3-clause | main = setupAndCabalTest $ do
skipUnless =<< ghcVersionIs (>= mkVersion [8,1])
setup "configure" []
r <- fails $ setup' "build" []
assertRegex "error should be in B.hs" "^B.hs:" r
assertRegex "error should be \"Could not find module Data.Set\""
"(Could not find module|Failed to load interface).*Data.Set" r | 343 | main = setupAndCabalTest $ do
skipUnless =<< ghcVersionIs (>= mkVersion [8,1])
setup "configure" []
r <- fails $ setup' "build" []
assertRegex "error should be in B.hs" "^B.hs:" r
assertRegex "error should be \"Could not find module Data.Set\""
"(Could not find module|Failed to load interface).*Data.Set" r | 343 | main = setupAndCabalTest $ do
skipUnless =<< ghcVersionIs (>= mkVersion [8,1])
setup "configure" []
r <- fails $ setup' "build" []
assertRegex "error should be in B.hs" "^B.hs:" r
assertRegex "error should be \"Could not find module Data.Set\""
"(Could not find module|Failed to load interface).*Data.Set" r | 343 | false | false | 0 | 12 | 81 | 81 | 37 | 44 | null | null |
expipiplus1/vulkan | generate-new/src/Documentation/RunAsciiDoctor.hs | bsd-3-clause | replaceTag
:: TL.Text
-- ^ Tag name
-> Maybe TL.Text
-- ^ Optional attribute to search for
-> TL.Text
-- ^ Replacement
-> TL.Text
-- ^ Haystack
-> TL.Text
replaceTag needle maybeAttr replacement =
let attr = maybe "" (" " <>) maybeAttr
in TL.replace ("<" <> needle <> attr <> ">") ("<" <> replacement <> ">")
. TL.replace ("</" <> needle <> ">") ("</" <> replacement <> ">") | 405 | replaceTag
:: TL.Text
-- ^ Tag name
-> Maybe TL.Text
-- ^ Optional attribute to search for
-> TL.Text
-- ^ Replacement
-> TL.Text
-- ^ Haystack
-> TL.Text
replaceTag needle maybeAttr replacement =
let attr = maybe "" (" " <>) maybeAttr
in TL.replace ("<" <> needle <> attr <> ">") ("<" <> replacement <> ">")
. TL.replace ("</" <> needle <> ">") ("</" <> replacement <> ">") | 405 | replaceTag needle maybeAttr replacement =
let attr = maybe "" (" " <>) maybeAttr
in TL.replace ("<" <> needle <> attr <> ">") ("<" <> replacement <> ">")
. TL.replace ("</" <> needle <> ">") ("</" <> replacement <> ">") | 232 | false | true | 0 | 12 | 99 | 144 | 73 | 71 | null | null |
joelburget/haste-compiler | libraries/haste-lib/src/Haste/DOM/JSString.hs | bsd-3-clause | -- | Perform an IO action on an element.
withElem :: MonadIO m => ElemID -> (Elem -> m a) -> m a
withElem e act = do
me' <- elemById e
case me' of
Just e' -> act e'
_ -> error $ "No element with ID " ++ fromJSStr e ++ " found!"
-- | Perform an IO action over several elements. Throws an error if some of the
-- elements are not found. | 355 | withElem :: MonadIO m => ElemID -> (Elem -> m a) -> m a
withElem e act = do
me' <- elemById e
case me' of
Just e' -> act e'
_ -> error $ "No element with ID " ++ fromJSStr e ++ " found!"
-- | Perform an IO action over several elements. Throws an error if some of the
-- elements are not found. | 314 | withElem e act = do
me' <- elemById e
case me' of
Just e' -> act e'
_ -> error $ "No element with ID " ++ fromJSStr e ++ " found!"
-- | Perform an IO action over several elements. Throws an error if some of the
-- elements are not found. | 258 | true | true | 0 | 13 | 96 | 103 | 47 | 56 | null | null |
hsyl20/HViperVM | lib/ViperVM/VirtualPlatform/MetaObject.hs | lgpl-3.0 | detachInstance :: MetaObject -> Object -> STM ()
detachInstance mo o = do
TSet.delete o (objects mo)
-- | Exchange an object instance between two shared objects | 164 | detachInstance :: MetaObject -> Object -> STM ()
detachInstance mo o = do
TSet.delete o (objects mo)
-- | Exchange an object instance between two shared objects | 164 | detachInstance mo o = do
TSet.delete o (objects mo)
-- | Exchange an object instance between two shared objects | 115 | false | true | 0 | 9 | 30 | 46 | 22 | 24 | null | null |
janschulz/pandoc | src/Text/Pandoc/Writers/Markdown.hs | gpl-2.0 | linkAttributes :: WriterOptions -> Attr -> Doc
linkAttributes opts attr =
if isEnabled Ext_link_attributes opts && attr /= nullAttr
then attrsToMarkdown attr
else empty | 180 | linkAttributes :: WriterOptions -> Attr -> Doc
linkAttributes opts attr =
if isEnabled Ext_link_attributes opts && attr /= nullAttr
then attrsToMarkdown attr
else empty | 180 | linkAttributes opts attr =
if isEnabled Ext_link_attributes opts && attr /= nullAttr
then attrsToMarkdown attr
else empty | 133 | false | true | 0 | 8 | 35 | 53 | 25 | 28 | null | null |
Solumin/ScriptNScribe | src/BreveEval.hs | mit | evalBinOp ParOp a b = Vpar (check a) (check b)
where
check v = case v of
(Vnote{}) -> v
(Vrest _) -> v
(Vseq _ _) -> v
(Vpar _ _) -> v
_ -> error $ ":=: is undefined for argument " ++ show v
-- Here's why we defined Eq Val the way we did. | 287 | evalBinOp ParOp a b = Vpar (check a) (check b)
where
check v = case v of
(Vnote{}) -> v
(Vrest _) -> v
(Vseq _ _) -> v
(Vpar _ _) -> v
_ -> error $ ":=: is undefined for argument " ++ show v
-- Here's why we defined Eq Val the way we did. | 287 | evalBinOp ParOp a b = Vpar (check a) (check b)
where
check v = case v of
(Vnote{}) -> v
(Vrest _) -> v
(Vseq _ _) -> v
(Vpar _ _) -> v
_ -> error $ ":=: is undefined for argument " ++ show v
-- Here's why we defined Eq Val the way we did. | 287 | false | false | 0 | 9 | 106 | 116 | 57 | 59 | null | null |
mtlstats/mtlstats | test/Actions/NewGameSpec.hs | gpl-3.0 | updateGameStatsSpec :: Spec
updateGameStatsSpec = describe "updateGameStats" $ do
let
baseStats = newGameStats
& gmsWins .~ 1
& gmsLosses .~ 1
& gmsOvertime .~ 1
& gmsGoalsFor .~ 1
& gmsGoalsAgainst .~ 1
s t h a o = newProgState
& progMode.gameStateL
%~ (gameType .~ t)
. (homeScore .~ h)
. (awayScore .~ a)
. (overtimeFlag .~ o)
& database
%~ (dbHomeGameStats .~ baseStats)
. (dbAwayGameStats .~ baseStats)
db hw hl ho hf ha aw al ao af aa = newDatabase
& dbHomeGameStats
%~ (gmsWins .~ hw)
. (gmsLosses .~ hl)
. (gmsOvertime .~ ho)
. (gmsGoalsFor .~ hf)
. (gmsGoalsAgainst .~ ha)
& dbAwayGameStats
%~ (gmsWins .~ aw)
. (gmsLosses .~ al)
. (gmsOvertime .~ ao)
. (gmsGoalsFor .~ af)
. (gmsGoalsAgainst .~ aa)
context "home win" $
it "should record a home win" $ let
s' = s (Just HomeGame) (Just 2) (Just 1) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 2 1 1 3 2 1 1 1 1 1
context "home loss" $
it "should record a home loss" $ let
s' = s (Just HomeGame) (Just 1) (Just 2) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 2 1 2 3 1 1 1 1 1
context "home overtime loss" $
it "should record a home overtime" $ let
s' = s (Just HomeGame) (Just 1) (Just 2) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 2 2 3 1 1 1 1 1
context "away win" $
it "should record an away win" $ let
s' = s (Just AwayGame) (Just 1) (Just 2) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 2 1 1 3 2
context "away loss" $
it "should record an away loss" $ let
s' = s (Just AwayGame) (Just 2) (Just 1) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 2 1 2 3
context "away overtime loss" $
it "should record an away overtime" $ let
s' = s (Just AwayGame) (Just 2) (Just 1) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 2 2 3
context "missing game type" $
it "should not change anything" $ let
s' = s Nothing (Just 1) (Just 2) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1
context "missing home score" $
it "should not change anything" $ let
s' = s (Just HomeGame) Nothing (Just 1) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1
context "missing away score" $
it "should not change anything" $ let
s' = s (Just HomeGame) (Just 1) Nothing (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1
context "missing overtime flag" $
it "should not change anything" $ let
s' = s (Just HomeGame) (Just 1) (Just 2) Nothing
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1 | 3,212 | updateGameStatsSpec :: Spec
updateGameStatsSpec = describe "updateGameStats" $ do
let
baseStats = newGameStats
& gmsWins .~ 1
& gmsLosses .~ 1
& gmsOvertime .~ 1
& gmsGoalsFor .~ 1
& gmsGoalsAgainst .~ 1
s t h a o = newProgState
& progMode.gameStateL
%~ (gameType .~ t)
. (homeScore .~ h)
. (awayScore .~ a)
. (overtimeFlag .~ o)
& database
%~ (dbHomeGameStats .~ baseStats)
. (dbAwayGameStats .~ baseStats)
db hw hl ho hf ha aw al ao af aa = newDatabase
& dbHomeGameStats
%~ (gmsWins .~ hw)
. (gmsLosses .~ hl)
. (gmsOvertime .~ ho)
. (gmsGoalsFor .~ hf)
. (gmsGoalsAgainst .~ ha)
& dbAwayGameStats
%~ (gmsWins .~ aw)
. (gmsLosses .~ al)
. (gmsOvertime .~ ao)
. (gmsGoalsFor .~ af)
. (gmsGoalsAgainst .~ aa)
context "home win" $
it "should record a home win" $ let
s' = s (Just HomeGame) (Just 2) (Just 1) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 2 1 1 3 2 1 1 1 1 1
context "home loss" $
it "should record a home loss" $ let
s' = s (Just HomeGame) (Just 1) (Just 2) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 2 1 2 3 1 1 1 1 1
context "home overtime loss" $
it "should record a home overtime" $ let
s' = s (Just HomeGame) (Just 1) (Just 2) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 2 2 3 1 1 1 1 1
context "away win" $
it "should record an away win" $ let
s' = s (Just AwayGame) (Just 1) (Just 2) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 2 1 1 3 2
context "away loss" $
it "should record an away loss" $ let
s' = s (Just AwayGame) (Just 2) (Just 1) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 2 1 2 3
context "away overtime loss" $
it "should record an away overtime" $ let
s' = s (Just AwayGame) (Just 2) (Just 1) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 2 2 3
context "missing game type" $
it "should not change anything" $ let
s' = s Nothing (Just 1) (Just 2) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1
context "missing home score" $
it "should not change anything" $ let
s' = s (Just HomeGame) Nothing (Just 1) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1
context "missing away score" $
it "should not change anything" $ let
s' = s (Just HomeGame) (Just 1) Nothing (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1
context "missing overtime flag" $
it "should not change anything" $ let
s' = s (Just HomeGame) (Just 1) (Just 2) Nothing
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1 | 3,212 | updateGameStatsSpec = describe "updateGameStats" $ do
let
baseStats = newGameStats
& gmsWins .~ 1
& gmsLosses .~ 1
& gmsOvertime .~ 1
& gmsGoalsFor .~ 1
& gmsGoalsAgainst .~ 1
s t h a o = newProgState
& progMode.gameStateL
%~ (gameType .~ t)
. (homeScore .~ h)
. (awayScore .~ a)
. (overtimeFlag .~ o)
& database
%~ (dbHomeGameStats .~ baseStats)
. (dbAwayGameStats .~ baseStats)
db hw hl ho hf ha aw al ao af aa = newDatabase
& dbHomeGameStats
%~ (gmsWins .~ hw)
. (gmsLosses .~ hl)
. (gmsOvertime .~ ho)
. (gmsGoalsFor .~ hf)
. (gmsGoalsAgainst .~ ha)
& dbAwayGameStats
%~ (gmsWins .~ aw)
. (gmsLosses .~ al)
. (gmsOvertime .~ ao)
. (gmsGoalsFor .~ af)
. (gmsGoalsAgainst .~ aa)
context "home win" $
it "should record a home win" $ let
s' = s (Just HomeGame) (Just 2) (Just 1) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 2 1 1 3 2 1 1 1 1 1
context "home loss" $
it "should record a home loss" $ let
s' = s (Just HomeGame) (Just 1) (Just 2) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 2 1 2 3 1 1 1 1 1
context "home overtime loss" $
it "should record a home overtime" $ let
s' = s (Just HomeGame) (Just 1) (Just 2) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 2 2 3 1 1 1 1 1
context "away win" $
it "should record an away win" $ let
s' = s (Just AwayGame) (Just 1) (Just 2) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 2 1 1 3 2
context "away loss" $
it "should record an away loss" $ let
s' = s (Just AwayGame) (Just 2) (Just 1) (Just False)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 2 1 2 3
context "away overtime loss" $
it "should record an away overtime" $ let
s' = s (Just AwayGame) (Just 2) (Just 1) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 2 2 3
context "missing game type" $
it "should not change anything" $ let
s' = s Nothing (Just 1) (Just 2) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1
context "missing home score" $
it "should not change anything" $ let
s' = s (Just HomeGame) Nothing (Just 1) (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1
context "missing away score" $
it "should not change anything" $ let
s' = s (Just HomeGame) (Just 1) Nothing (Just True)
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1
context "missing overtime flag" $
it "should not change anything" $ let
s' = s (Just HomeGame) (Just 1) (Just 2) Nothing
db' = updateGameStats s' ^. database
in db' `shouldBe` db 1 1 1 1 1 1 1 1 1 1 | 3,184 | false | true | 0 | 23 | 1,099 | 1,277 | 626 | 651 | null | null |
mcmaniac/ghc | distrib/compare/compare.hs | bsd-3-clause | findWays :: [TarLine] -> Maybe Ways
findWays tls = msum $ map f tls
where f tl = case re regex (tlFileName tl) of
Just [dashedWays] -> Just (unSepList '-' dashedWays)
_ -> Nothing
regex = "/libraries/base/dist-install/build/\\.depend-(.*)\\.haskell" | 313 | findWays :: [TarLine] -> Maybe Ways
findWays tls = msum $ map f tls
where f tl = case re regex (tlFileName tl) of
Just [dashedWays] -> Just (unSepList '-' dashedWays)
_ -> Nothing
regex = "/libraries/base/dist-install/build/\\.depend-(.*)\\.haskell" | 313 | findWays tls = msum $ map f tls
where f tl = case re regex (tlFileName tl) of
Just [dashedWays] -> Just (unSepList '-' dashedWays)
_ -> Nothing
regex = "/libraries/base/dist-install/build/\\.depend-(.*)\\.haskell" | 277 | false | true | 0 | 12 | 100 | 92 | 45 | 47 | null | null |
jwiegley/ghc-release | libraries/Cabal/cabal/tests/PackageTests/PackageTester.hs | gpl-3.0 | run :: Maybe FilePath -> String -> [String] -> IO (String, ExitCode, String)
run cwd path args = do
verbosity <- getVerbosity
-- path is relative to the current directory; canonicalizePath makes it
-- absolute, so that runProcess will find it even when changing directory.
path' <- do pathExists <- doesFileExist path
canonicalizePath (if pathExists then path else path <.> exeExtension)
printRawCommandAndArgs verbosity path' args
(readh, writeh) <- createPipe
pid <- runProcess path' args cwd Nothing Nothing (Just writeh) (Just writeh)
-- fork off a thread to start consuming the output
out <- suckH [] readh
hClose readh
-- wait for the program to terminate
exitcode <- waitForProcess pid
let fullCmd = unwords (path' : args)
return ("\"" ++ fullCmd ++ "\" in " ++ fromMaybe "" cwd, exitcode, out)
where
suckH output h = do
eof <- hIsEOF h
if eof
then return (reverse output)
else do
c <- hGetChar h
suckH (c:output) h
-- Copied from Distribution/Simple/Utils.hs | 1,119 | run :: Maybe FilePath -> String -> [String] -> IO (String, ExitCode, String)
run cwd path args = do
verbosity <- getVerbosity
-- path is relative to the current directory; canonicalizePath makes it
-- absolute, so that runProcess will find it even when changing directory.
path' <- do pathExists <- doesFileExist path
canonicalizePath (if pathExists then path else path <.> exeExtension)
printRawCommandAndArgs verbosity path' args
(readh, writeh) <- createPipe
pid <- runProcess path' args cwd Nothing Nothing (Just writeh) (Just writeh)
-- fork off a thread to start consuming the output
out <- suckH [] readh
hClose readh
-- wait for the program to terminate
exitcode <- waitForProcess pid
let fullCmd = unwords (path' : args)
return ("\"" ++ fullCmd ++ "\" in " ++ fromMaybe "" cwd, exitcode, out)
where
suckH output h = do
eof <- hIsEOF h
if eof
then return (reverse output)
else do
c <- hGetChar h
suckH (c:output) h
-- Copied from Distribution/Simple/Utils.hs | 1,119 | run cwd path args = do
verbosity <- getVerbosity
-- path is relative to the current directory; canonicalizePath makes it
-- absolute, so that runProcess will find it even when changing directory.
path' <- do pathExists <- doesFileExist path
canonicalizePath (if pathExists then path else path <.> exeExtension)
printRawCommandAndArgs verbosity path' args
(readh, writeh) <- createPipe
pid <- runProcess path' args cwd Nothing Nothing (Just writeh) (Just writeh)
-- fork off a thread to start consuming the output
out <- suckH [] readh
hClose readh
-- wait for the program to terminate
exitcode <- waitForProcess pid
let fullCmd = unwords (path' : args)
return ("\"" ++ fullCmd ++ "\" in " ++ fromMaybe "" cwd, exitcode, out)
where
suckH output h = do
eof <- hIsEOF h
if eof
then return (reverse output)
else do
c <- hGetChar h
suckH (c:output) h
-- Copied from Distribution/Simple/Utils.hs | 1,042 | false | true | 1 | 13 | 311 | 313 | 147 | 166 | null | null |
mimi1vx/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | prop_checkUncheckedCd6 = verifyNotTree checkUncheckedCd "cd .." | 63 | prop_checkUncheckedCd6 = verifyNotTree checkUncheckedCd "cd .." | 63 | prop_checkUncheckedCd6 = verifyNotTree checkUncheckedCd "cd .." | 63 | false | false | 0 | 5 | 5 | 11 | 5 | 6 | null | null |
dalaing/sdl2 | src/SDL/Raw/Event.hs | bsd-3-clause | eventState :: MonadIO m => Word32 -> CInt -> m Word8
eventState v1 v2 = liftIO $ eventStateFFI v1 v2 | 100 | eventState :: MonadIO m => Word32 -> CInt -> m Word8
eventState v1 v2 = liftIO $ eventStateFFI v1 v2 | 100 | eventState v1 v2 = liftIO $ eventStateFFI v1 v2 | 47 | false | true | 0 | 8 | 19 | 43 | 20 | 23 | null | null |
phaul/chess | Data/ChessTypes.hs | bsd-3-clause | charToPiece 'n' = Knight | 24 | charToPiece 'n' = Knight | 24 | charToPiece 'n' = Knight | 24 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
AccelerateHS/accelerate-buildbot | src/Main.hs | bsd-3-clause | modified :: Config -> Build Bool
modified cfg =
maybe' (configHistory cfg) (return True) $ \hist -> do
buildT <- io $ read `fmap` readFile hist
patchT <- (timestamp . head) `fmap` changesN (Just $ configGitRepo cfg) 1
return (buildT /= patchT)
-- Run the complete fetch/build/test cycle once
-- | 310 | modified :: Config -> Build Bool
modified cfg =
maybe' (configHistory cfg) (return True) $ \hist -> do
buildT <- io $ read `fmap` readFile hist
patchT <- (timestamp . head) `fmap` changesN (Just $ configGitRepo cfg) 1
return (buildT /= patchT)
-- Run the complete fetch/build/test cycle once
-- | 310 | modified cfg =
maybe' (configHistory cfg) (return True) $ \hist -> do
buildT <- io $ read `fmap` readFile hist
patchT <- (timestamp . head) `fmap` changesN (Just $ configGitRepo cfg) 1
return (buildT /= patchT)
-- Run the complete fetch/build/test cycle once
-- | 277 | false | true | 0 | 14 | 65 | 117 | 59 | 58 | null | null |
NorfairKing/the-notes | src/Cryptography/ComputationalProblems/Games/BitGuessingProblems/Macro.hs | gpl-2.0 | stopsym :: Note -> Note
stopsym = (stopsym_ !:) | 47 | stopsym :: Note -> Note
stopsym = (stopsym_ !:) | 47 | stopsym = (stopsym_ !:) | 23 | false | true | 0 | 7 | 8 | 26 | 12 | 14 | null | null |
brendanhay/gogol | gogol-redis/gen/Network/Google/Redis/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'InstanceLabels' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ilAddtional'
instanceLabels
:: HashMap Text Text -- ^ 'ilAddtional'
-> InstanceLabels
instanceLabels pIlAddtional_ =
InstanceLabels' {_ilAddtional = _Coerce # pIlAddtional_} | 358 | instanceLabels
:: HashMap Text Text -- ^ 'ilAddtional'
-> InstanceLabels
instanceLabels pIlAddtional_ =
InstanceLabels' {_ilAddtional = _Coerce # pIlAddtional_} | 170 | instanceLabels pIlAddtional_ =
InstanceLabels' {_ilAddtional = _Coerce # pIlAddtional_} | 89 | true | true | 0 | 8 | 62 | 50 | 26 | 24 | null | null |
pgj/bead | src/Bead/Persistence/NoSQLDir.hs | bsd-3-clause | -- * Feedback
feedbackDirPath :: FeedbackKey -> FilePath
feedbackDirPath = feedbackKey $ \k -> joinPath [feedbackDataDir, k] | 125 | feedbackDirPath :: FeedbackKey -> FilePath
feedbackDirPath = feedbackKey $ \k -> joinPath [feedbackDataDir, k] | 110 | feedbackDirPath = feedbackKey $ \k -> joinPath [feedbackDataDir, k] | 67 | true | true | 0 | 8 | 17 | 34 | 19 | 15 | null | null |
lifengsun/haskell-exercise | scheme/06/replparser.hs | gpl-3.0 | primitives :: [(String, [LispVal] -> ThrowsError LispVal)]
primitives = [("+", numericBinOp (+)),
("-", numericBinOp (-)),
("*", numericBinOp (*)),
("/", numericBinOp div),
("mod", numericBinOp mod),
("quotient", numericBinOp quot),
("remainder", numericBinOp rem),
("=", numBoolBinOp (==)),
("<", numBoolBinOp (<)),
(">", numBoolBinOp (>)),
("/=", numBoolBinOp (/=)),
(">=", numBoolBinOp (>=)),
("<=", numBoolBinOp (<=)),
("&&", boolBoolBinOp (&&)),
("||", boolBoolBinOp (||)),
("string=?", strBoolBinop (==)),
("string<?", strBoolBinop (<)),
("string<=?", strBoolBinop (<=)),
("string>=?", strBoolBinop (>=)),
("car", car),
("cdr", cdr),
("cons", cons),
("eq?", eqv),
("eqv?", eqv),
("equal?", equal)
] | 1,203 | primitives :: [(String, [LispVal] -> ThrowsError LispVal)]
primitives = [("+", numericBinOp (+)),
("-", numericBinOp (-)),
("*", numericBinOp (*)),
("/", numericBinOp div),
("mod", numericBinOp mod),
("quotient", numericBinOp quot),
("remainder", numericBinOp rem),
("=", numBoolBinOp (==)),
("<", numBoolBinOp (<)),
(">", numBoolBinOp (>)),
("/=", numBoolBinOp (/=)),
(">=", numBoolBinOp (>=)),
("<=", numBoolBinOp (<=)),
("&&", boolBoolBinOp (&&)),
("||", boolBoolBinOp (||)),
("string=?", strBoolBinop (==)),
("string<?", strBoolBinop (<)),
("string<=?", strBoolBinop (<=)),
("string>=?", strBoolBinop (>=)),
("car", car),
("cdr", cdr),
("cons", cons),
("eq?", eqv),
("eqv?", eqv),
("equal?", equal)
] | 1,203 | primitives = [("+", numericBinOp (+)),
("-", numericBinOp (-)),
("*", numericBinOp (*)),
("/", numericBinOp div),
("mod", numericBinOp mod),
("quotient", numericBinOp quot),
("remainder", numericBinOp rem),
("=", numBoolBinOp (==)),
("<", numBoolBinOp (<)),
(">", numBoolBinOp (>)),
("/=", numBoolBinOp (/=)),
(">=", numBoolBinOp (>=)),
("<=", numBoolBinOp (<=)),
("&&", boolBoolBinOp (&&)),
("||", boolBoolBinOp (||)),
("string=?", strBoolBinop (==)),
("string<?", strBoolBinop (<)),
("string<=?", strBoolBinop (<=)),
("string>=?", strBoolBinop (>=)),
("car", car),
("cdr", cdr),
("cons", cons),
("eq?", eqv),
("eqv?", eqv),
("equal?", equal)
] | 1,144 | false | true | 0 | 10 | 577 | 349 | 217 | 132 | null | null |
mzini/qlogic | Qlogic/Formula.hs | gpl-3.0 | pprintFormula (Maj a b c) = parens $ text "maj" <+> (pprintFormula a $$ pprintFormula b $$ pprintFormula c) | 107 | pprintFormula (Maj a b c) = parens $ text "maj" <+> (pprintFormula a $$ pprintFormula b $$ pprintFormula c) | 107 | pprintFormula (Maj a b c) = parens $ text "maj" <+> (pprintFormula a $$ pprintFormula b $$ pprintFormula c) | 107 | false | false | 0 | 9 | 18 | 50 | 23 | 27 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_593 (68#) = happyGoto action_143 | 39 | action_593 (68#) = happyGoto action_143 | 39 | action_593 (68#) = happyGoto action_143 | 39 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
scturtle/fun.hs | prolog.hs | unlicense | solveSome :: Subs -> Rules -> [Term] -> _ -> _ -> _
solveSome env rules [] yes no entryno = no | 94 | solveSome :: Subs -> Rules -> [Term] -> _ -> _ -> _
solveSome env rules [] yes no entryno = no | 94 | solveSome env rules [] yes no entryno = no | 42 | false | true | 0 | 12 | 21 | 55 | 26 | 29 | null | null |
bredelings/BAli-Phy | haskell/Bio/Alphabet.hs | gpl-2.0 | aaWithStop = builtin_aaWithStop () | 34 | aaWithStop = builtin_aaWithStop () | 34 | aaWithStop = builtin_aaWithStop () | 34 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
spockwangs/scheme.in.haskell | list6.4.hs | unlicense | badArgList = throwError $ NumArgs 2 badArgList | 46 | badArgList = throwError $ NumArgs 2 badArgList | 46 | badArgList = throwError $ NumArgs 2 badArgList | 46 | false | false | 1 | 6 | 6 | 18 | 7 | 11 | null | null |
ion1/rrdgraph-haskell | Data/RRDGraph/Tests/Fields.hs | isc | prop_asks :: Integer -> Bool
prop_asks a = runField (asks id) a == Just a | 73 | prop_asks :: Integer -> Bool
prop_asks a = runField (asks id) a == Just a | 73 | prop_asks a = runField (asks id) a == Just a | 44 | false | true | 0 | 8 | 14 | 42 | 18 | 24 | null | null |
narrative/stack | src/Stack/Package.hs | bsd-3-clause | resolveFileOrWarn :: (MonadCatch m,MonadIO m,MonadLogger m,MonadReader (Path Abs File, Path Abs Dir) m)
=> FilePath.FilePath
-> m (Maybe (Path Abs File))
resolveFileOrWarn = resolveOrWarn "File" f
where f p x = forgivingAbsence (resolveFile p x) >>= rejectMissingFile
-- | Resolve the directory, if it can't be resolved, warn for the user
-- (purely to be helpful). | 404 | resolveFileOrWarn :: (MonadCatch m,MonadIO m,MonadLogger m,MonadReader (Path Abs File, Path Abs Dir) m)
=> FilePath.FilePath
-> m (Maybe (Path Abs File))
resolveFileOrWarn = resolveOrWarn "File" f
where f p x = forgivingAbsence (resolveFile p x) >>= rejectMissingFile
-- | Resolve the directory, if it can't be resolved, warn for the user
-- (purely to be helpful). | 404 | resolveFileOrWarn = resolveOrWarn "File" f
where f p x = forgivingAbsence (resolveFile p x) >>= rejectMissingFile
-- | Resolve the directory, if it can't be resolved, warn for the user
-- (purely to be helpful). | 214 | false | true | 0 | 11 | 94 | 113 | 57 | 56 | null | null |
mcschroeder/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | pprCLabel :: Platform -> CLabel -> SDoc
pprCLabel platform (AsmTempLabel u)
| cGhcWithNativeCodeGen == "YES"
= getPprStyle $ \ sty ->
if asmStyle sty then
ptext (asmTempLabelPrefix platform) <> pprUnique u
else
char '_' <> pprUnique u | 265 | pprCLabel :: Platform -> CLabel -> SDoc
pprCLabel platform (AsmTempLabel u)
| cGhcWithNativeCodeGen == "YES"
= getPprStyle $ \ sty ->
if asmStyle sty then
ptext (asmTempLabelPrefix platform) <> pprUnique u
else
char '_' <> pprUnique u | 264 | pprCLabel platform (AsmTempLabel u)
| cGhcWithNativeCodeGen == "YES"
= getPprStyle $ \ sty ->
if asmStyle sty then
ptext (asmTempLabelPrefix platform) <> pprUnique u
else
char '_' <> pprUnique u | 224 | false | true | 4 | 10 | 67 | 94 | 42 | 52 | null | null |
frantisekfarka/ghc-dsi | compiler/cmm/CmmCommonBlockElim.hs | bsd-3-clause | eqLastWith :: (BlockId -> BlockId -> Bool) -> CmmNode O C -> CmmNode O C -> Bool
eqLastWith eqBid (CmmBranch bid1) (CmmBranch bid2) = eqBid bid1 bid2 | 149 | eqLastWith :: (BlockId -> BlockId -> Bool) -> CmmNode O C -> CmmNode O C -> Bool
eqLastWith eqBid (CmmBranch bid1) (CmmBranch bid2) = eqBid bid1 bid2 | 149 | eqLastWith eqBid (CmmBranch bid1) (CmmBranch bid2) = eqBid bid1 bid2 | 68 | false | true | 0 | 11 | 26 | 73 | 34 | 39 | null | null |
gcampax/ghc | compiler/llvmGen/LlvmCodeGen/Data.hs | bsd-3-clause | genStaticLit cmm@(CmmLabel l) = do
var <- getGlobalPtr =<< strCLabel_llvm l
dflags <- getDynFlags
let ptr = LMStaticPointer var
lmty = cmmToLlvmType $ cmmLitType dflags cmm
return $ LMPtoI ptr lmty | 221 | genStaticLit cmm@(CmmLabel l) = do
var <- getGlobalPtr =<< strCLabel_llvm l
dflags <- getDynFlags
let ptr = LMStaticPointer var
lmty = cmmToLlvmType $ cmmLitType dflags cmm
return $ LMPtoI ptr lmty | 221 | genStaticLit cmm@(CmmLabel l) = do
var <- getGlobalPtr =<< strCLabel_llvm l
dflags <- getDynFlags
let ptr = LMStaticPointer var
lmty = cmmToLlvmType $ cmmLitType dflags cmm
return $ LMPtoI ptr lmty | 221 | false | false | 0 | 11 | 54 | 77 | 35 | 42 | null | null |
seL4/capDL-tool | CapDL/PrintUtils.hs | bsd-2-clause | maybeRightsList _ [] = [] | 25 | maybeRightsList _ [] = [] | 25 | maybeRightsList _ [] = [] | 25 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
osa1/language-lua | tests/Main.hs | bsd-3-clause | literalDecodingTests :: TestTree
literalDecodingTests = testGroup "Literal codec tests"
[ testCase "decoding"
(do assertEqual "C escapes wrong"
(Just "\a\b\f\n\r\t\v\\\"'")
$ interpretStringLiteral "\"\\a\\b\\f\\n\\r\\t\\v\\\\\\\"'\""
assertEqual "C escapes wrong"
(Just "\a \b \f \n \r \t \v \\ \" '")
$ interpretStringLiteral "\"\\a \\b \\f \\n \\r \\t \\v \\\\ \\\" '\""
assertEqual "ASCII characters wrong"
(Just "the quick brown fox jumps over the lazy dog")
$ interpretStringLiteral "'the quick brown fox jumps over the lazy dog'"
assertEqual "Test decimal escapes"
(Just "\0\1\2\3\4\60\127\255")
$ interpretStringLiteral "'\\0\\1\\2\\3\\4\\60\\127\\255'"
assertEqual "Test hexadecimal escapes"
(Just "\0\1\2\3\4\127\255")
$ interpretStringLiteral "\"\\x00\\x01\\x02\\x03\\x04\\x7f\\xff\""
assertEqual "Test UTF-8 encoding"
(Just "\230\177\137\229\173\151")
$ interpretStringLiteral "'汉字'"
assertEqual "Test unicode escape"
(Just "\0 \16 \230\177\137\229\173\151")
$ interpretStringLiteral "'\\u{0} \\u{10} \\u{6c49}\\u{5b57}'"
assertEqual "Test continued line"
(Just "hello\nworld")
$ interpretStringLiteral "\"hello\\\nworld\""
assertEqual "Test skipped whitespace"
(Just "helloworld")
$ interpretStringLiteral "'hello\\z \n \f \t \r \v world'"
assertEqual "Long-quote leading newline"
(Just "line1\nline2\n")
$ interpretStringLiteral "[===[\nline1\nline2\n]===]"
assertEqual "Long-quote without leading newline"
(Just "line1\nline2\n")
$ interpretStringLiteral "[===[line1\nline2\n]===]"
assertEqual "Long-quote no escapes"
(Just "\\0\\x00\\u{000}")
$ interpretStringLiteral "[===[\\0\\x00\\u{000}]===]"
assertEqual "Empty single quoted"
(Just "")
$ interpretStringLiteral "''"
assertEqual "Empty double quoted"
(Just "")
$ interpretStringLiteral "\"\""
assertEqual "Empty long quoted"
(Just "")
$ interpretStringLiteral "[[]]"
)
, testCase "encoding"
(do assertEqual "Empty string"
"\"\""
$ constructStringLiteral ""
assertEqual "Normal escapes"
"\"\\a\\b\\f\\n\\r\\t\\v\\\\\\\"\""
$ constructStringLiteral "\a\b\f\n\r\t\v\\\""
assertEqual "Exhaustive test"
"\"\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\a\
\\\b\\t\\n\\v\\f\\r\\x0e\\x0f\
\\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\
\\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f\
\ !\\\"#$%&'()*+,-./0123456789:;<=>?@\
\ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`\
\abcdefghijklmnopqrstuvwxyz{|}~\\x7f\
\\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\
\\\x88\\x89\\x8a\\x8b\\x8c\\x8d\\x8e\\x8f\
\\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\
\\\x98\\x99\\x9a\\x9b\\x9c\\x9d\\x9e\\x9f\
\\\xa0\\xa1\\xa2\\xa3\\xa4\\xa5\\xa6\\xa7\
\\\xa8\\xa9\\xaa\\xab\\xac\\xad\\xae\\xaf\
\\\xb0\\xb1\\xb2\\xb3\\xb4\\xb5\\xb6\\xb7\
\\\xb8\\xb9\\xba\\xbb\\xbc\\xbd\\xbe\\xbf\
\\\xc0\\xc1\\xc2\\xc3\\xc4\\xc5\\xc6\\xc7\
\\\xc8\\xc9\\xca\\xcb\\xcc\\xcd\\xce\\xcf\
\\\xd0\\xd1\\xd2\\xd3\\xd4\\xd5\\xd6\\xd7\
\\\xd8\\xd9\\xda\\xdb\\xdc\\xdd\\xde\\xdf\
\\\xe0\\xe1\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\
\\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef\
\\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\
\\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff\""
(constructStringLiteral (B.pack [0..255]))
)
] | 4,050 | literalDecodingTests :: TestTree
literalDecodingTests = testGroup "Literal codec tests"
[ testCase "decoding"
(do assertEqual "C escapes wrong"
(Just "\a\b\f\n\r\t\v\\\"'")
$ interpretStringLiteral "\"\\a\\b\\f\\n\\r\\t\\v\\\\\\\"'\""
assertEqual "C escapes wrong"
(Just "\a \b \f \n \r \t \v \\ \" '")
$ interpretStringLiteral "\"\\a \\b \\f \\n \\r \\t \\v \\\\ \\\" '\""
assertEqual "ASCII characters wrong"
(Just "the quick brown fox jumps over the lazy dog")
$ interpretStringLiteral "'the quick brown fox jumps over the lazy dog'"
assertEqual "Test decimal escapes"
(Just "\0\1\2\3\4\60\127\255")
$ interpretStringLiteral "'\\0\\1\\2\\3\\4\\60\\127\\255'"
assertEqual "Test hexadecimal escapes"
(Just "\0\1\2\3\4\127\255")
$ interpretStringLiteral "\"\\x00\\x01\\x02\\x03\\x04\\x7f\\xff\""
assertEqual "Test UTF-8 encoding"
(Just "\230\177\137\229\173\151")
$ interpretStringLiteral "'汉字'"
assertEqual "Test unicode escape"
(Just "\0 \16 \230\177\137\229\173\151")
$ interpretStringLiteral "'\\u{0} \\u{10} \\u{6c49}\\u{5b57}'"
assertEqual "Test continued line"
(Just "hello\nworld")
$ interpretStringLiteral "\"hello\\\nworld\""
assertEqual "Test skipped whitespace"
(Just "helloworld")
$ interpretStringLiteral "'hello\\z \n \f \t \r \v world'"
assertEqual "Long-quote leading newline"
(Just "line1\nline2\n")
$ interpretStringLiteral "[===[\nline1\nline2\n]===]"
assertEqual "Long-quote without leading newline"
(Just "line1\nline2\n")
$ interpretStringLiteral "[===[line1\nline2\n]===]"
assertEqual "Long-quote no escapes"
(Just "\\0\\x00\\u{000}")
$ interpretStringLiteral "[===[\\0\\x00\\u{000}]===]"
assertEqual "Empty single quoted"
(Just "")
$ interpretStringLiteral "''"
assertEqual "Empty double quoted"
(Just "")
$ interpretStringLiteral "\"\""
assertEqual "Empty long quoted"
(Just "")
$ interpretStringLiteral "[[]]"
)
, testCase "encoding"
(do assertEqual "Empty string"
"\"\""
$ constructStringLiteral ""
assertEqual "Normal escapes"
"\"\\a\\b\\f\\n\\r\\t\\v\\\\\\\"\""
$ constructStringLiteral "\a\b\f\n\r\t\v\\\""
assertEqual "Exhaustive test"
"\"\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\a\
\\\b\\t\\n\\v\\f\\r\\x0e\\x0f\
\\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\
\\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f\
\ !\\\"#$%&'()*+,-./0123456789:;<=>?@\
\ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`\
\abcdefghijklmnopqrstuvwxyz{|}~\\x7f\
\\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\
\\\x88\\x89\\x8a\\x8b\\x8c\\x8d\\x8e\\x8f\
\\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\
\\\x98\\x99\\x9a\\x9b\\x9c\\x9d\\x9e\\x9f\
\\\xa0\\xa1\\xa2\\xa3\\xa4\\xa5\\xa6\\xa7\
\\\xa8\\xa9\\xaa\\xab\\xac\\xad\\xae\\xaf\
\\\xb0\\xb1\\xb2\\xb3\\xb4\\xb5\\xb6\\xb7\
\\\xb8\\xb9\\xba\\xbb\\xbc\\xbd\\xbe\\xbf\
\\\xc0\\xc1\\xc2\\xc3\\xc4\\xc5\\xc6\\xc7\
\\\xc8\\xc9\\xca\\xcb\\xcc\\xcd\\xce\\xcf\
\\\xd0\\xd1\\xd2\\xd3\\xd4\\xd5\\xd6\\xd7\
\\\xd8\\xd9\\xda\\xdb\\xdc\\xdd\\xde\\xdf\
\\\xe0\\xe1\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\
\\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef\
\\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\
\\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff\""
(constructStringLiteral (B.pack [0..255]))
)
] | 4,050 | literalDecodingTests = testGroup "Literal codec tests"
[ testCase "decoding"
(do assertEqual "C escapes wrong"
(Just "\a\b\f\n\r\t\v\\\"'")
$ interpretStringLiteral "\"\\a\\b\\f\\n\\r\\t\\v\\\\\\\"'\""
assertEqual "C escapes wrong"
(Just "\a \b \f \n \r \t \v \\ \" '")
$ interpretStringLiteral "\"\\a \\b \\f \\n \\r \\t \\v \\\\ \\\" '\""
assertEqual "ASCII characters wrong"
(Just "the quick brown fox jumps over the lazy dog")
$ interpretStringLiteral "'the quick brown fox jumps over the lazy dog'"
assertEqual "Test decimal escapes"
(Just "\0\1\2\3\4\60\127\255")
$ interpretStringLiteral "'\\0\\1\\2\\3\\4\\60\\127\\255'"
assertEqual "Test hexadecimal escapes"
(Just "\0\1\2\3\4\127\255")
$ interpretStringLiteral "\"\\x00\\x01\\x02\\x03\\x04\\x7f\\xff\""
assertEqual "Test UTF-8 encoding"
(Just "\230\177\137\229\173\151")
$ interpretStringLiteral "'汉字'"
assertEqual "Test unicode escape"
(Just "\0 \16 \230\177\137\229\173\151")
$ interpretStringLiteral "'\\u{0} \\u{10} \\u{6c49}\\u{5b57}'"
assertEqual "Test continued line"
(Just "hello\nworld")
$ interpretStringLiteral "\"hello\\\nworld\""
assertEqual "Test skipped whitespace"
(Just "helloworld")
$ interpretStringLiteral "'hello\\z \n \f \t \r \v world'"
assertEqual "Long-quote leading newline"
(Just "line1\nline2\n")
$ interpretStringLiteral "[===[\nline1\nline2\n]===]"
assertEqual "Long-quote without leading newline"
(Just "line1\nline2\n")
$ interpretStringLiteral "[===[line1\nline2\n]===]"
assertEqual "Long-quote no escapes"
(Just "\\0\\x00\\u{000}")
$ interpretStringLiteral "[===[\\0\\x00\\u{000}]===]"
assertEqual "Empty single quoted"
(Just "")
$ interpretStringLiteral "''"
assertEqual "Empty double quoted"
(Just "")
$ interpretStringLiteral "\"\""
assertEqual "Empty long quoted"
(Just "")
$ interpretStringLiteral "[[]]"
)
, testCase "encoding"
(do assertEqual "Empty string"
"\"\""
$ constructStringLiteral ""
assertEqual "Normal escapes"
"\"\\a\\b\\f\\n\\r\\t\\v\\\\\\\"\""
$ constructStringLiteral "\a\b\f\n\r\t\v\\\""
assertEqual "Exhaustive test"
"\"\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\a\
\\\b\\t\\n\\v\\f\\r\\x0e\\x0f\
\\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\
\\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f\
\ !\\\"#$%&'()*+,-./0123456789:;<=>?@\
\ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`\
\abcdefghijklmnopqrstuvwxyz{|}~\\x7f\
\\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\
\\\x88\\x89\\x8a\\x8b\\x8c\\x8d\\x8e\\x8f\
\\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\
\\\x98\\x99\\x9a\\x9b\\x9c\\x9d\\x9e\\x9f\
\\\xa0\\xa1\\xa2\\xa3\\xa4\\xa5\\xa6\\xa7\
\\\xa8\\xa9\\xaa\\xab\\xac\\xad\\xae\\xaf\
\\\xb0\\xb1\\xb2\\xb3\\xb4\\xb5\\xb6\\xb7\
\\\xb8\\xb9\\xba\\xbb\\xbc\\xbd\\xbe\\xbf\
\\\xc0\\xc1\\xc2\\xc3\\xc4\\xc5\\xc6\\xc7\
\\\xc8\\xc9\\xca\\xcb\\xcc\\xcd\\xce\\xcf\
\\\xd0\\xd1\\xd2\\xd3\\xd4\\xd5\\xd6\\xd7\
\\\xd8\\xd9\\xda\\xdb\\xdc\\xdd\\xde\\xdf\
\\\xe0\\xe1\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\
\\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef\
\\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\
\\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff\""
(constructStringLiteral (B.pack [0..255]))
)
] | 4,017 | false | true | 0 | 15 | 1,214 | 413 | 181 | 232 | null | null |
magthe/dataenc | test-src/DataencUT.hs | bsd-3-clause | base64UrlTestData =
[ ("base64url", "empty", "", [], base64Url)
, ("base64url", "\0", "AA==", [0], base64Url)
, ("base64url", "\255", "_w==", [255], base64Url)
, ("base64url", "Example", "RXhhbXBsZQ==", [69,120,97,109,112,108,101], base64Url)
] | 264 | base64UrlTestData =
[ ("base64url", "empty", "", [], base64Url)
, ("base64url", "\0", "AA==", [0], base64Url)
, ("base64url", "\255", "_w==", [255], base64Url)
, ("base64url", "Example", "RXhhbXBsZQ==", [69,120,97,109,112,108,101], base64Url)
] | 264 | base64UrlTestData =
[ ("base64url", "empty", "", [], base64Url)
, ("base64url", "\0", "AA==", [0], base64Url)
, ("base64url", "\255", "_w==", [255], base64Url)
, ("base64url", "Example", "RXhhbXBsZQ==", [69,120,97,109,112,108,101], base64Url)
] | 264 | false | false | 1 | 7 | 46 | 110 | 70 | 40 | null | null |
romanb/aws | Aws/Core.hs | bsd-3-clause | tellMetadataRef :: Monoid m => IORef m -> m -> IO ()
tellMetadataRef r m = modifyIORef r (`mappend` m) | 102 | tellMetadataRef :: Monoid m => IORef m -> m -> IO ()
tellMetadataRef r m = modifyIORef r (`mappend` m) | 102 | tellMetadataRef r m = modifyIORef r (`mappend` m) | 49 | false | true | 0 | 9 | 19 | 50 | 25 | 25 | null | null |
romanb/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types.hs | mpl-2.0 | -- | 'InstanceStatusEvent' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'iseCode' @::@ 'Maybe' 'EventCode'
--
-- * 'iseDescription' @::@ 'Maybe' 'Text'
--
-- * 'iseNotAfter' @::@ 'Maybe' 'UTCTime'
--
-- * 'iseNotBefore' @::@ 'Maybe' 'UTCTime'
--
instanceStatusEvent :: InstanceStatusEvent
instanceStatusEvent = InstanceStatusEvent
{ _iseCode = Nothing
, _iseDescription = Nothing
, _iseNotBefore = Nothing
, _iseNotAfter = Nothing
} | 502 | instanceStatusEvent :: InstanceStatusEvent
instanceStatusEvent = InstanceStatusEvent
{ _iseCode = Nothing
, _iseDescription = Nothing
, _iseNotBefore = Nothing
, _iseNotAfter = Nothing
} | 218 | instanceStatusEvent = InstanceStatusEvent
{ _iseCode = Nothing
, _iseDescription = Nothing
, _iseNotBefore = Nothing
, _iseNotAfter = Nothing
} | 175 | true | true | 0 | 7 | 96 | 59 | 37 | 22 | null | null |
spockwangs/scheme.in.haskell | list6.2.hs | unlicense | parseCharacter :: Parser LispVal
parseCharacter = do char '\\'
c <- anyChar
s <- many letter
case map toLower (c:s) of
[a] -> return $ Character a
"space" -> return $ Character ' '
"newline" -> return $ Character '\n'
x -> (unexpected $ "Invalid character name: " ++ x) <?> "\"newline\" or \"space\"" | 448 | parseCharacter :: Parser LispVal
parseCharacter = do char '\\'
c <- anyChar
s <- many letter
case map toLower (c:s) of
[a] -> return $ Character a
"space" -> return $ Character ' '
"newline" -> return $ Character '\n'
x -> (unexpected $ "Invalid character name: " ++ x) <?> "\"newline\" or \"space\"" | 448 | parseCharacter = do char '\\'
c <- anyChar
s <- many letter
case map toLower (c:s) of
[a] -> return $ Character a
"space" -> return $ Character ' '
"newline" -> return $ Character '\n'
x -> (unexpected $ "Invalid character name: " ++ x) <?> "\"newline\" or \"space\"" | 415 | false | true | 0 | 13 | 201 | 119 | 56 | 63 | null | null |
rfranek/duckling | Duckling/Duration/HE/Rules.hs | bsd-3-clause | ruleExactlyDuration :: Rule
ruleExactlyDuration = Rule
{ name = "exactly <duration>"
, pattern =
[ regex "\x05d1\x05d3\x05d9\x05d5\x05e7"
, dimension Duration
]
, prod = \tokens -> case tokens of
(_:token:_) -> Just token
_ -> Nothing
} | 268 | ruleExactlyDuration :: Rule
ruleExactlyDuration = Rule
{ name = "exactly <duration>"
, pattern =
[ regex "\x05d1\x05d3\x05d9\x05d5\x05e7"
, dimension Duration
]
, prod = \tokens -> case tokens of
(_:token:_) -> Just token
_ -> Nothing
} | 268 | ruleExactlyDuration = Rule
{ name = "exactly <duration>"
, pattern =
[ regex "\x05d1\x05d3\x05d9\x05d5\x05e7"
, dimension Duration
]
, prod = \tokens -> case tokens of
(_:token:_) -> Just token
_ -> Nothing
} | 240 | false | true | 0 | 14 | 68 | 82 | 44 | 38 | null | null |
ruicc/haskell-protocol-buffers | Text/ProtocolBuffers/WireMessage.hs | apache-2.0 | wireSizeOpt tagSize i (Just v) = wireSizeReq tagSize i v | 56 | wireSizeOpt tagSize i (Just v) = wireSizeReq tagSize i v | 56 | wireSizeOpt tagSize i (Just v) = wireSizeReq tagSize i v | 56 | false | false | 0 | 6 | 9 | 29 | 12 | 17 | null | null |
bergmark/haskell-opaleye | opaleye-sqlite/src/Opaleye/SQLite/Internal/Sql.hs | bsd-3-clause | sqlQueryGenerator :: PQ.PrimQueryFold Select
sqlQueryGenerator = (unit, baseTable, product, aggregate, order, limit_, join,
values, binary) | 160 | sqlQueryGenerator :: PQ.PrimQueryFold Select
sqlQueryGenerator = (unit, baseTable, product, aggregate, order, limit_, join,
values, binary) | 160 | sqlQueryGenerator = (unit, baseTable, product, aggregate, order, limit_, join,
values, binary) | 115 | false | true | 1 | 6 | 35 | 47 | 26 | 21 | null | null |
DougBurke/swish | src/Swish/RDF/ProofContext.hs | lgpl-2.1 | -- | Ruleset for RDFS inference.
rulesetRDFS :: RDFRuleset
rulesetRDFS = makeRuleset scopeRDFS axiomsRDFS rulesRDFS | 116 | rulesetRDFS :: RDFRuleset
rulesetRDFS = makeRuleset scopeRDFS axiomsRDFS rulesRDFS | 82 | rulesetRDFS = makeRuleset scopeRDFS axiomsRDFS rulesRDFS | 56 | true | true | 0 | 5 | 15 | 19 | 10 | 9 | null | null |
mumuki/mulang | src/Language/Mulang/Transform/Normalizer.hs | gpl-3.0 | normalize ops (Sequence es) = normalizeSequence ops . sortDeclarations ops . mapNormalize ops $ es | 123 | normalize ops (Sequence es) = normalizeSequence ops . sortDeclarations ops . mapNormalize ops $ es | 123 | normalize ops (Sequence es) = normalizeSequence ops . sortDeclarations ops . mapNormalize ops $ es | 123 | false | false | 0 | 8 | 39 | 39 | 17 | 22 | null | null |
dagit/mattermost-api | src/Network/Mattermost/Types.hs | bsd-3-clause | runLogger _ _ _ = return () | 27 | runLogger _ _ _ = return () | 27 | runLogger _ _ _ = return () | 27 | false | false | 0 | 6 | 6 | 18 | 8 | 10 | null | null |
dlewissandy/lambda-blas | src/Numerical/BLAS/Single.hs | bsd-3-clause | scopy :: Int -> Vector Float -> Int -> Vector Float -> Int -> Vector Float
scopy = copy | 87 | scopy :: Int -> Vector Float -> Int -> Vector Float -> Int -> Vector Float
scopy = copy | 87 | scopy = copy | 12 | false | true | 0 | 10 | 18 | 40 | 19 | 21 | null | null |
utsav2601/cmpe295A | tools/flounder/UMP_IPI.hs | mit | uparams = template_params {
ump_payload = 28, -- bytes
ump_drv = "ump_ipi",
ump_binding_extra_fields =
[ C.Param (C.Struct "ipi_notify") "ipi_notify",
C.Param (C.TypeName "bool") "no_notify"
],
ump_extra_includes = ["arch/x86/barrelfish/ipi_notify.h"],
ump_extra_protos = \ifn -> [init_fn_proto ifn],
ump_extra_fns = \ifn -> [accept_alloc_notify_cont_fn ifn,
bind_alloc_notify_cont_fn ifn,
init_fn ifn],
ump_register_recv = ump_ipi_register_recv,
ump_deregister_recv = ump_ipi_deregister_recv,
ump_accept_alloc_notify = Just accept_alloc_notify,
ump_bind_alloc_notify = Just bind_alloc_notify,
ump_store_notify_cap = store_notify_cap,
ump_notify = do_notify,
ump_binding_extra_fields_init = ump_ipi_binding_extra_fields_init,
ump_connect_extra_fields_init = ump_ipi_connect_extra_fields_init
} | 936 | uparams = template_params {
ump_payload = 28, -- bytes
ump_drv = "ump_ipi",
ump_binding_extra_fields =
[ C.Param (C.Struct "ipi_notify") "ipi_notify",
C.Param (C.TypeName "bool") "no_notify"
],
ump_extra_includes = ["arch/x86/barrelfish/ipi_notify.h"],
ump_extra_protos = \ifn -> [init_fn_proto ifn],
ump_extra_fns = \ifn -> [accept_alloc_notify_cont_fn ifn,
bind_alloc_notify_cont_fn ifn,
init_fn ifn],
ump_register_recv = ump_ipi_register_recv,
ump_deregister_recv = ump_ipi_deregister_recv,
ump_accept_alloc_notify = Just accept_alloc_notify,
ump_bind_alloc_notify = Just bind_alloc_notify,
ump_store_notify_cap = store_notify_cap,
ump_notify = do_notify,
ump_binding_extra_fields_init = ump_ipi_binding_extra_fields_init,
ump_connect_extra_fields_init = ump_ipi_connect_extra_fields_init
} | 936 | uparams = template_params {
ump_payload = 28, -- bytes
ump_drv = "ump_ipi",
ump_binding_extra_fields =
[ C.Param (C.Struct "ipi_notify") "ipi_notify",
C.Param (C.TypeName "bool") "no_notify"
],
ump_extra_includes = ["arch/x86/barrelfish/ipi_notify.h"],
ump_extra_protos = \ifn -> [init_fn_proto ifn],
ump_extra_fns = \ifn -> [accept_alloc_notify_cont_fn ifn,
bind_alloc_notify_cont_fn ifn,
init_fn ifn],
ump_register_recv = ump_ipi_register_recv,
ump_deregister_recv = ump_ipi_deregister_recv,
ump_accept_alloc_notify = Just accept_alloc_notify,
ump_bind_alloc_notify = Just bind_alloc_notify,
ump_store_notify_cap = store_notify_cap,
ump_notify = do_notify,
ump_binding_extra_fields_init = ump_ipi_binding_extra_fields_init,
ump_connect_extra_fields_init = ump_ipi_connect_extra_fields_init
} | 936 | false | false | 0 | 11 | 212 | 172 | 101 | 71 | null | null |
christiaanb/ghc | compiler/hsSyn/HsTypes.hs | bsd-3-clause | pprHsContext :: (OutputableBndr name) => HsContext name -> SDoc
pprHsContext = maybe empty (<+> darrow) . pprHsContextMaybe | 123 | pprHsContext :: (OutputableBndr name) => HsContext name -> SDoc
pprHsContext = maybe empty (<+> darrow) . pprHsContextMaybe | 123 | pprHsContext = maybe empty (<+> darrow) . pprHsContextMaybe | 59 | false | true | 0 | 7 | 16 | 40 | 21 | 19 | null | null |
walck/cyclotomic | src/Data/Number/RealCyclotomic.hs | gpl-3.0 | -- | Sine function with argument in degrees.
sinDeg :: Rational -> RealCyclotomic
sinDeg r = RealCyclotomic (Cyc.sinDeg r) | 122 | sinDeg :: Rational -> RealCyclotomic
sinDeg r = RealCyclotomic (Cyc.sinDeg r) | 77 | sinDeg r = RealCyclotomic (Cyc.sinDeg r) | 40 | true | true | 0 | 8 | 18 | 35 | 16 | 19 | null | null |
isomorphism/csound-expression | src/Csound/Control/Instr.hs | bsd-3-clause | -- | Mixes the scores and plays them in the loop.
mixLoop :: (Sigs a) => Sco (Mix a) -> a
mixLoop a = sched instr $ withDur dt $ repeatE unit $ metroE $ sig $ 1 / dt
where
dt = dur a
instr _ = return $ mix a
-- | Mixes the procedures and plays them in the loop. | 287 | mixLoop :: (Sigs a) => Sco (Mix a) -> a
mixLoop a = sched instr $ withDur dt $ repeatE unit $ metroE $ sig $ 1 / dt
where
dt = dur a
instr _ = return $ mix a
-- | Mixes the procedures and plays them in the loop. | 237 | mixLoop a = sched instr $ withDur dt $ repeatE unit $ metroE $ sig $ 1 / dt
where
dt = dur a
instr _ = return $ mix a
-- | Mixes the procedures and plays them in the loop. | 197 | true | true | 1 | 11 | 88 | 97 | 47 | 50 | null | null |
hsyl20/ViperVM | haskus-system/src/lib/Haskus/System/Linux/FileSystem/ReadWrite.hs | bsd-3-clause | -- | Read n bytes in a buffer
handleReadBuffer :: MonadIO m => Handle -> Maybe Word64 -> Word64 -> FlowT ReadErrors' m Buffer
handleReadBuffer hdl offset size = do
b <- mallocBytes (fromIntegral size)
sz <- handleRead hdl offset b (fromIntegral size)
-- free the pointer on error
`onFlowError_` free b
-- otherwise return the buffer
bufferUnsafePackPtr (fromIntegral sz) (castPtr b)
-- | Like read but uses several buffers | 454 | handleReadBuffer :: MonadIO m => Handle -> Maybe Word64 -> Word64 -> FlowT ReadErrors' m Buffer
handleReadBuffer hdl offset size = do
b <- mallocBytes (fromIntegral size)
sz <- handleRead hdl offset b (fromIntegral size)
-- free the pointer on error
`onFlowError_` free b
-- otherwise return the buffer
bufferUnsafePackPtr (fromIntegral sz) (castPtr b)
-- | Like read but uses several buffers | 424 | handleReadBuffer hdl offset size = do
b <- mallocBytes (fromIntegral size)
sz <- handleRead hdl offset b (fromIntegral size)
-- free the pointer on error
`onFlowError_` free b
-- otherwise return the buffer
bufferUnsafePackPtr (fromIntegral sz) (castPtr b)
-- | Like read but uses several buffers | 328 | true | true | 0 | 12 | 101 | 123 | 58 | 65 | null | null |
gumgl/project-euler | 43/43.hs | mit | answer = sum (map (unDigits 10) pandigitalSSDs) | 47 | answer = sum (map (unDigits 10) pandigitalSSDs) | 47 | answer = sum (map (unDigits 10) pandigitalSSDs) | 47 | false | false | 1 | 9 | 6 | 27 | 11 | 16 | null | null |
sgillespie/ghc | testsuite/tests/typecheck/should_fail/VtaFail.hs | bsd-3-clause | e = show @Int @Float (read "5") | 31 | e = show @Int @Float (read "5") | 31 | e = show @Int @Float (read "5") | 31 | false | false | 1 | 7 | 6 | 26 | 11 | 15 | null | null |
hguenther/gtl | lib/Language/GTL/ErrorRefiner.hs | bsd-3-clause | valueToC _ (GTLIntVal x) = show x | 33 | valueToC _ (GTLIntVal x) = show x | 33 | valueToC _ (GTLIntVal x) = show x | 33 | false | false | 1 | 6 | 6 | 23 | 9 | 14 | null | null |
flipstone/glados | src/Handler/Agreement.hs | mit | agreementNew :: App Response
agreementNew = do
view <- getForm "agreement" (agreementForm Nothing)
ok $ toResponse $ agreementNewView view | 142 | agreementNew :: App Response
agreementNew = do
view <- getForm "agreement" (agreementForm Nothing)
ok $ toResponse $ agreementNewView view | 142 | agreementNew = do
view <- getForm "agreement" (agreementForm Nothing)
ok $ toResponse $ agreementNewView view | 113 | false | true | 0 | 11 | 22 | 52 | 22 | 30 | null | null |
snowleopard/alga | src/Algebra/Graph/AdjacencyMap.hs | mit | compose :: Ord a => AdjacencyMap a -> AdjacencyMap a -> AdjacencyMap a
compose x y = fromAdjacencySets
[ (t, ys) | v <- Set.toList vs, let ys = postSet v y, not (Set.null ys)
, t <- Set.toList (postSet v tx) ]
where
tx = transpose x
vs = vertexSet x `Set.union` vertexSet y
-- | Compute the /Cartesian product/ of graphs.
-- Complexity: /O((n + m) * log(n))/ time and O(n + m) memory.
--
-- @
-- box ('path' [0,1]) ('path' "ab") == 'edges' [ ((0,\'a\'), (0,\'b\'))
-- , ((0,\'a\'), (1,\'a\'))
-- , ((0,\'b\'), (1,\'b\'))
-- , ((1,\'a\'), (1,\'b\')) ]
-- @
--
-- Up to isomorphism between the resulting vertex types, this operation is
-- /commutative/, /associative/, /distributes/ over 'overlay', has singleton
-- graphs as /identities/ and 'empty' as the /annihilating zero/. Below @~~@
-- stands for equality up to an isomorphism, e.g. @(x,@ @()) ~~ x@.
--
-- @
-- box x y ~~ box y x
-- box x (box y z) ~~ box (box x y) z
-- box x ('overlay' y z) == 'overlay' (box x y) (box x z)
-- box x ('vertex' ()) ~~ x
-- box x 'empty' ~~ 'empty'
-- 'transpose' (box x y) == box ('transpose' x) ('transpose' y)
-- 'vertexCount' (box x y) == 'vertexCount' x * 'vertexCount' y
-- 'edgeCount' (box x y) <= 'vertexCount' x * 'edgeCount' y + 'edgeCount' x * 'vertexCount' y
-- @ | 1,447 | compose :: Ord a => AdjacencyMap a -> AdjacencyMap a -> AdjacencyMap a
compose x y = fromAdjacencySets
[ (t, ys) | v <- Set.toList vs, let ys = postSet v y, not (Set.null ys)
, t <- Set.toList (postSet v tx) ]
where
tx = transpose x
vs = vertexSet x `Set.union` vertexSet y
-- | Compute the /Cartesian product/ of graphs.
-- Complexity: /O((n + m) * log(n))/ time and O(n + m) memory.
--
-- @
-- box ('path' [0,1]) ('path' "ab") == 'edges' [ ((0,\'a\'), (0,\'b\'))
-- , ((0,\'a\'), (1,\'a\'))
-- , ((0,\'b\'), (1,\'b\'))
-- , ((1,\'a\'), (1,\'b\')) ]
-- @
--
-- Up to isomorphism between the resulting vertex types, this operation is
-- /commutative/, /associative/, /distributes/ over 'overlay', has singleton
-- graphs as /identities/ and 'empty' as the /annihilating zero/. Below @~~@
-- stands for equality up to an isomorphism, e.g. @(x,@ @()) ~~ x@.
--
-- @
-- box x y ~~ box y x
-- box x (box y z) ~~ box (box x y) z
-- box x ('overlay' y z) == 'overlay' (box x y) (box x z)
-- box x ('vertex' ()) ~~ x
-- box x 'empty' ~~ 'empty'
-- 'transpose' (box x y) == box ('transpose' x) ('transpose' y)
-- 'vertexCount' (box x y) == 'vertexCount' x * 'vertexCount' y
-- 'edgeCount' (box x y) <= 'vertexCount' x * 'edgeCount' y + 'edgeCount' x * 'vertexCount' y
-- @ | 1,447 | compose x y = fromAdjacencySets
[ (t, ys) | v <- Set.toList vs, let ys = postSet v y, not (Set.null ys)
, t <- Set.toList (postSet v tx) ]
where
tx = transpose x
vs = vertexSet x `Set.union` vertexSet y
-- | Compute the /Cartesian product/ of graphs.
-- Complexity: /O((n + m) * log(n))/ time and O(n + m) memory.
--
-- @
-- box ('path' [0,1]) ('path' "ab") == 'edges' [ ((0,\'a\'), (0,\'b\'))
-- , ((0,\'a\'), (1,\'a\'))
-- , ((0,\'b\'), (1,\'b\'))
-- , ((1,\'a\'), (1,\'b\')) ]
-- @
--
-- Up to isomorphism between the resulting vertex types, this operation is
-- /commutative/, /associative/, /distributes/ over 'overlay', has singleton
-- graphs as /identities/ and 'empty' as the /annihilating zero/. Below @~~@
-- stands for equality up to an isomorphism, e.g. @(x,@ @()) ~~ x@.
--
-- @
-- box x y ~~ box y x
-- box x (box y z) ~~ box (box x y) z
-- box x ('overlay' y z) == 'overlay' (box x y) (box x z)
-- box x ('vertex' ()) ~~ x
-- box x 'empty' ~~ 'empty'
-- 'transpose' (box x y) == box ('transpose' x) ('transpose' y)
-- 'vertexCount' (box x y) == 'vertexCount' x * 'vertexCount' y
-- 'edgeCount' (box x y) <= 'vertexCount' x * 'edgeCount' y + 'edgeCount' x * 'vertexCount' y
-- @ | 1,376 | false | true | 0 | 10 | 424 | 171 | 95 | 76 | null | null |
eklavya/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reflectTTQuote unq (UType u) = reflCall "UType" [reflectUniverse u] | 67 | reflectTTQuote unq (UType u) = reflCall "UType" [reflectUniverse u] | 67 | reflectTTQuote unq (UType u) = reflCall "UType" [reflectUniverse u] | 67 | false | false | 0 | 7 | 8 | 28 | 13 | 15 | null | null |
thomasdziedzic/hs-spotify | example/high-login.hs | mit | credentialsBlobUpdatedCb :: Session -> String -> IO ()
credentialsBlobUpdatedCb session log_data = do
putStrLn "in credentials_blob_updated_cb callback" | 154 | credentialsBlobUpdatedCb :: Session -> String -> IO ()
credentialsBlobUpdatedCb session log_data = do
putStrLn "in credentials_blob_updated_cb callback" | 154 | credentialsBlobUpdatedCb session log_data = do
putStrLn "in credentials_blob_updated_cb callback" | 99 | false | true | 0 | 8 | 18 | 40 | 17 | 23 | null | null |
CulpaBS/wbBach | src/Futhark/Representation/SOACS.hs | bsd-3-clause | removeFunDefLore :: (Attributes lore, Op lore ~ Op SOACS) => AST.FunDef lore -> FunDef
removeFunDefLore = rephraseFunDef removeLore | 131 | removeFunDefLore :: (Attributes lore, Op lore ~ Op SOACS) => AST.FunDef lore -> FunDef
removeFunDefLore = rephraseFunDef removeLore | 131 | removeFunDefLore = rephraseFunDef removeLore | 44 | false | true | 0 | 8 | 17 | 46 | 22 | 24 | null | null |
richardTowers/verify-sample-local-matching-services | haskell/Controllers/MatchingController.hs | mit | checkCycle3 nextCheck request = nextCheck request | 125 | checkCycle3 nextCheck request = nextCheck request | 125 | checkCycle3 nextCheck request = nextCheck request | 125 | false | false | 0 | 5 | 81 | 14 | 6 | 8 | null | null |
DanielWaterworth/Idris-dev | src/IRTS/CodegenLLVM.hs | bsd-3-clause | cgOp (LStrInt ity) [s] = do
ns <- unbox FString s
nx <- inst $ simpleCall "strtoll"
[ns
, ConstantOperand $ C.Null (PointerType (PointerType (IntegerType 8) (AddrSpace 0)) (AddrSpace 0))
, ConstantOperand $ C.Int 32 10
]
nx' <- case ity of
(ITFixed IT64) -> return nx
_ -> inst $ Trunc nx (IntegerType (itWidth ity)) []
box (FArith (ATInt ity)) nx' | 410 | cgOp (LStrInt ity) [s] = do
ns <- unbox FString s
nx <- inst $ simpleCall "strtoll"
[ns
, ConstantOperand $ C.Null (PointerType (PointerType (IntegerType 8) (AddrSpace 0)) (AddrSpace 0))
, ConstantOperand $ C.Int 32 10
]
nx' <- case ity of
(ITFixed IT64) -> return nx
_ -> inst $ Trunc nx (IntegerType (itWidth ity)) []
box (FArith (ATInt ity)) nx' | 410 | cgOp (LStrInt ity) [s] = do
ns <- unbox FString s
nx <- inst $ simpleCall "strtoll"
[ns
, ConstantOperand $ C.Null (PointerType (PointerType (IntegerType 8) (AddrSpace 0)) (AddrSpace 0))
, ConstantOperand $ C.Int 32 10
]
nx' <- case ity of
(ITFixed IT64) -> return nx
_ -> inst $ Trunc nx (IntegerType (itWidth ity)) []
box (FArith (ATInt ity)) nx' | 410 | false | false | 0 | 18 | 123 | 188 | 90 | 98 | null | null |
rhofour/rlglue-haskell-codec | src/RL_Glue/Network.hs | apache-2.0 | sendMessage :: Word32 -> Socket -> BS.ByteString -> IO BS.ByteString
sendMessage selByte sock msg =
do
let
packedMsg =
runPut (
putWord32be selByte >>
putWord32be (fromIntegral (4 + BS.length msg)) >>
putWord32be (fromIntegral (BS.length msg)) >>
putByteString msg)
sendLazy sock packedMsg
confirmState sock selByte
resp <- runMaybeT (getString sock)
case resp of
Nothing -> do
putStrLn "Error: Could not read response from agent message"
exitWith (ExitFailure 1)
Just x -> return x | 589 | sendMessage :: Word32 -> Socket -> BS.ByteString -> IO BS.ByteString
sendMessage selByte sock msg =
do
let
packedMsg =
runPut (
putWord32be selByte >>
putWord32be (fromIntegral (4 + BS.length msg)) >>
putWord32be (fromIntegral (BS.length msg)) >>
putByteString msg)
sendLazy sock packedMsg
confirmState sock selByte
resp <- runMaybeT (getString sock)
case resp of
Nothing -> do
putStrLn "Error: Could not read response from agent message"
exitWith (ExitFailure 1)
Just x -> return x | 589 | sendMessage selByte sock msg =
do
let
packedMsg =
runPut (
putWord32be selByte >>
putWord32be (fromIntegral (4 + BS.length msg)) >>
putWord32be (fromIntegral (BS.length msg)) >>
putByteString msg)
sendLazy sock packedMsg
confirmState sock selByte
resp <- runMaybeT (getString sock)
case resp of
Nothing -> do
putStrLn "Error: Could not read response from agent message"
exitWith (ExitFailure 1)
Just x -> return x | 520 | false | true | 0 | 21 | 178 | 183 | 82 | 101 | null | null |
sdiehl/ghc | hadrian/src/Rules/Libffi.hs | bsd-3-clause | -- | Need the (locally built) libffi library.
needLibffi :: Stage -> Action ()
needLibffi stage = do
manifest <- dynLibManifest stage
need [manifest]
-- | Context for @libffi@. | 185 | needLibffi :: Stage -> Action ()
needLibffi stage = do
manifest <- dynLibManifest stage
need [manifest]
-- | Context for @libffi@. | 139 | needLibffi stage = do
manifest <- dynLibManifest stage
need [manifest]
-- | Context for @libffi@. | 106 | true | true | 0 | 9 | 37 | 49 | 22 | 27 | null | null |
ddssff/lens | src/Control/Lens/TH.hs | bsd-3-clause | deNewtype d = d | 15 | deNewtype d = d | 15 | deNewtype d = d | 15 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/playpen/interview/api-catalog/src/EntityTagCache.hs | unlicense | tstc = U.t "tstc"
(cToList cache)
( [(0,[1,-1]), (1,[2,1]), (2,[]), (3,[0,-1])]
, 3
, [("abc",2),("bar",-1),("foo",1),("xyz",0)]
, [(-1,"bar"),(0,"xyz"),(1,"foo"),(2,"abc")] ) | 195 | tstc = U.t "tstc"
(cToList cache)
( [(0,[1,-1]), (1,[2,1]), (2,[]), (3,[0,-1])]
, 3
, [("abc",2),("bar",-1),("foo",1),("xyz",0)]
, [(-1,"bar"),(0,"xyz"),(1,"foo"),(2,"abc")] ) | 195 | tstc = U.t "tstc"
(cToList cache)
( [(0,[1,-1]), (1,[2,1]), (2,[]), (3,[0,-1])]
, 3
, [("abc",2),("bar",-1),("foo",1),("xyz",0)]
, [(-1,"bar"),(0,"xyz"),(1,"foo"),(2,"abc")] ) | 195 | false | false | 1 | 9 | 37 | 174 | 107 | 67 | null | null |
da-x/Algorithm-W-Step-By-Step | Lamdu/Expr/Pure.hs | gpl-3.0 | recEmpty :: Monoid a => Val a
recEmpty = Val mempty $ V.BLeaf V.LRecEmpty | 73 | recEmpty :: Monoid a => Val a
recEmpty = Val mempty $ V.BLeaf V.LRecEmpty | 73 | recEmpty = Val mempty $ V.BLeaf V.LRecEmpty | 43 | false | true | 0 | 7 | 13 | 35 | 16 | 19 | null | null |
eklinkhammer/neural-algorithms | src/RandomUtil/Random.hs | bsd-3-clause | randomBool :: RandomGen g => g -> Double -> (g, Bool)
randomBool g percent = (g', bool)
where
(val,g') = random g
bool = val < percent
-- Creates an infinite list of booleans that have percent chance of being true | 232 | randomBool :: RandomGen g => g -> Double -> (g, Bool)
randomBool g percent = (g', bool)
where
(val,g') = random g
bool = val < percent
-- Creates an infinite list of booleans that have percent chance of being true | 232 | randomBool g percent = (g', bool)
where
(val,g') = random g
bool = val < percent
-- Creates an infinite list of booleans that have percent chance of being true | 178 | false | true | 3 | 10 | 59 | 81 | 39 | 42 | null | null |
olsner/ghc | compiler/nativeGen/PPC/Ppr.hs | bsd-3-clause | pprInstr (SL II32 reg1 reg2 (RIImm (ImmInt i))) | i < 0 || i > 31 =
-- As above for SR, but for left shifts.
-- Fixes ticket http://ghc.haskell.org/trac/ghc/ticket/10870
pprInstr (XOR reg1 reg2 (RIReg reg2)) | 220 | pprInstr (SL II32 reg1 reg2 (RIImm (ImmInt i))) | i < 0 || i > 31 =
-- As above for SR, but for left shifts.
-- Fixes ticket http://ghc.haskell.org/trac/ghc/ticket/10870
pprInstr (XOR reg1 reg2 (RIReg reg2)) | 220 | pprInstr (SL II32 reg1 reg2 (RIImm (ImmInt i))) | i < 0 || i > 31 =
-- As above for SR, but for left shifts.
-- Fixes ticket http://ghc.haskell.org/trac/ghc/ticket/10870
pprInstr (XOR reg1 reg2 (RIReg reg2)) | 220 | false | false | 0 | 11 | 48 | 72 | 35 | 37 | null | null |
sdiehl/ghc | compiler/utils/Util.hs | bsd-3-clause | dropList _ xs@[] = xs | 22 | dropList _ xs@[] = xs | 22 | dropList _ xs@[] = xs | 22 | false | false | 0 | 7 | 5 | 16 | 8 | 8 | null | null |
IreneKnapp/direct-http | Haskell/Network/HTTP.hs | mit | headerType HttpIfUnmodifiedSince = RequestHeader | 48 | headerType HttpIfUnmodifiedSince = RequestHeader | 48 | headerType HttpIfUnmodifiedSince = RequestHeader | 48 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
kandersen/Utrecht | src/Utrecht/Mastermind/Core.hs | mit | tODO :: a -> a
tODO = id | 24 | tODO :: a -> a
tODO = id | 24 | tODO = id | 9 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
alosich/language-java | Language/Java/Parser.hs | bsd-3-clause | ----------------------------------------------------------------------------
-- Variable declarations
varDecls :: P [VarDecl]
varDecls = seplist1 varDecl comma | 160 | varDecls :: P [VarDecl]
varDecls = seplist1 varDecl comma | 57 | varDecls = seplist1 varDecl comma | 33 | true | true | 0 | 6 | 13 | 24 | 13 | 11 | null | null |
ardumont/write-yourself-a-scheme-lab | Scheme/Primitive.hs | gpl-2.0 | -- *Main> :main "(cdr '(2 1))"
-- (1)
-- *Main> :main "(cdr '(2 1 . 4))"
-- (1 . 4)
-- *Main> :main "(cdr '(2 1 . 4))"
-- (1 . 4)
-- *Main> :main "(cdr '(2))"
-- ()
-- *Main> :main "(cdr '())"
-- Invalid type: expected pair, found ()
cons :: [LispVal] -> ThrowsError LispVal
cons [x, List []] = return $ List [x] | 313 | cons :: [LispVal] -> ThrowsError LispVal
cons [x, List []] = return $ List [x] | 78 | cons [x, List []] = return $ List [x] | 37 | true | true | 0 | 8 | 66 | 55 | 33 | 22 | null | null |
input-output-hk/rscoin-haskell | test/Test/RSCoin/Pure/Update.hs | gpl-3.0 | execUpdateSafe :: (MonadThrow m, Exception e) => Update e s a -> s -> m s
execUpdateSafe upd storage = snd <$> runUpdateSafe upd storage | 136 | execUpdateSafe :: (MonadThrow m, Exception e) => Update e s a -> s -> m s
execUpdateSafe upd storage = snd <$> runUpdateSafe upd storage | 136 | execUpdateSafe upd storage = snd <$> runUpdateSafe upd storage | 62 | false | true | 2 | 9 | 24 | 65 | 29 | 36 | null | null |
avh4/elm-format | elm-format-lib/src/Parse/Helpers.hs | bsd-3-clause | -- TODO: push the Multiline type further up in the AST and get rid of this
multilineToBool :: Multiline -> Bool
multilineToBool multine =
case multine of
SplitAll -> True
JoinAll -> False | 197 | multilineToBool :: Multiline -> Bool
multilineToBool multine =
case multine of
SplitAll -> True
JoinAll -> False | 122 | multilineToBool multine =
case multine of
SplitAll -> True
JoinAll -> False | 85 | true | true | 0 | 7 | 42 | 35 | 18 | 17 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.