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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dirkz/google-code-jam-haskell | practice/src/InfiniteHouseOfPancakesOrig.hs | mpl-2.0 | parseInt :: GenParser Char st Int
parseInt = parseIntegral (read :: String -> Int) | 82 | parseInt :: GenParser Char st Int
parseInt = parseIntegral (read :: String -> Int) | 82 | parseInt = parseIntegral (read :: String -> Int) | 48 | false | true | 0 | 6 | 13 | 36 | 17 | 19 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/CSS.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/CSS.supports Mozilla CSS.supports documentation>
supports2 ::
(MonadDOM m, ToJSString property, ToJSString value) =>
property -> value -> m Bool
supports2 property value
= liftDOM
(((jsg "CSS") ^. jsf "supports" [toJSVal property, toJSVal value])
>>= valToBool) | 356 | supports2 ::
(MonadDOM m, ToJSString property, ToJSString value) =>
property -> value -> m Bool
supports2 property value
= liftDOM
(((jsg "CSS") ^. jsf "supports" [toJSVal property, toJSVal value])
>>= valToBool) | 251 | supports2 property value
= liftDOM
(((jsg "CSS") ^. jsf "supports" [toJSVal property, toJSVal value])
>>= valToBool) | 133 | true | true | 0 | 12 | 76 | 94 | 46 | 48 | null | null |
raventid/coursera_learning | haskell/chapter11/worksheet.hs | mit | convert8 No = False | 19 | convert8 No = False | 19 | convert8 No = False | 19 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
denisenkom/hsmssql | Database/Mssql/Statement.hs | mit | convertVal (TdsSmallDateTime days minutes) = SqlLocalTime time
where day = addDays (fromIntegral days) (fromGregorian 1900 1 1)
daytime = timeToTimeOfDay $ secondsToDiffTime ((fromIntegral minutes) * 60)
time = LocalTime day daytime | 256 | convertVal (TdsSmallDateTime days minutes) = SqlLocalTime time
where day = addDays (fromIntegral days) (fromGregorian 1900 1 1)
daytime = timeToTimeOfDay $ secondsToDiffTime ((fromIntegral minutes) * 60)
time = LocalTime day daytime | 256 | convertVal (TdsSmallDateTime days minutes) = SqlLocalTime time
where day = addDays (fromIntegral days) (fromGregorian 1900 1 1)
daytime = timeToTimeOfDay $ secondsToDiffTime ((fromIntegral minutes) * 60)
time = LocalTime day daytime | 256 | false | false | 2 | 10 | 54 | 85 | 41 | 44 | null | null |
andrewMacmurray/haskell-book-solutions | src/ch7/guards.hs | mit | numbers :: (Num a, Ord a) => a -> Integer
numbers a
| a > 0 = 1
| a == 0 = 0
| a < 0 = -1 | 97 | numbers :: (Num a, Ord a) => a -> Integer
numbers a
| a > 0 = 1
| a == 0 = 0
| a < 0 = -1 | 97 | numbers a
| a > 0 = 1
| a == 0 = 0
| a < 0 = -1 | 55 | false | true | 0 | 8 | 37 | 80 | 37 | 43 | null | null |
hpacheco/HAAP | examples/plab/svn/2017li1g186/src/BotHugo186.hs | mit | pecasMap :: [(Peca,Posicao,Orientacao)] -> Map Posicao [(Peca,Posicao,Orientacao)]
pecasMap xs = pecasMap' xs Map.empty
where
pecasMap' [] m = m
pecasMap' (x:xs) m = pecasMap' xs (Map.insert (snd3 x) xs m) | 217 | pecasMap :: [(Peca,Posicao,Orientacao)] -> Map Posicao [(Peca,Posicao,Orientacao)]
pecasMap xs = pecasMap' xs Map.empty
where
pecasMap' [] m = m
pecasMap' (x:xs) m = pecasMap' xs (Map.insert (snd3 x) xs m) | 217 | pecasMap xs = pecasMap' xs Map.empty
where
pecasMap' [] m = m
pecasMap' (x:xs) m = pecasMap' xs (Map.insert (snd3 x) xs m) | 134 | false | true | 0 | 9 | 41 | 109 | 57 | 52 | null | null |
dsorokin/aivika-experiment-chart | examples/Financial/Model.hs | bsd-3-clause | npvIncomeName = "npvIncome" | 29 | npvIncomeName = "npvIncome" | 29 | npvIncomeName = "npvIncome" | 29 | false | false | 1 | 5 | 4 | 10 | 3 | 7 | null | null |
rcook/mlutil | ch04-naive-bayes/spec/UtilSpec.hs | mit | getSpamAndHam :: IO ([String], [String])
getSpamAndHam = do
spamFileNames <- getDataFileNames "email/spam"
spam <- mapM readChar8File spamFileNames
hamFileNames <- getDataFileNames "email/ham"
ham <- mapM readChar8File hamFileNames
return (spam, ham) | 270 | getSpamAndHam :: IO ([String], [String])
getSpamAndHam = do
spamFileNames <- getDataFileNames "email/spam"
spam <- mapM readChar8File spamFileNames
hamFileNames <- getDataFileNames "email/ham"
ham <- mapM readChar8File hamFileNames
return (spam, ham) | 270 | getSpamAndHam = do
spamFileNames <- getDataFileNames "email/spam"
spam <- mapM readChar8File spamFileNames
hamFileNames <- getDataFileNames "email/ham"
ham <- mapM readChar8File hamFileNames
return (spam, ham) | 229 | false | true | 0 | 8 | 48 | 82 | 39 | 43 | null | null |
LambdaHack/LambdaHack | engine-src/Game/LambdaHack/Common/Vector.hs | bsd-3-clause | trajectoryToPathBounded rWidthMax rHeightMax start (v : vs) =
let next = shiftBounded rWidthMax rHeightMax start v
in next : trajectoryToPathBounded rWidthMax rHeightMax next vs | 181 | trajectoryToPathBounded rWidthMax rHeightMax start (v : vs) =
let next = shiftBounded rWidthMax rHeightMax start v
in next : trajectoryToPathBounded rWidthMax rHeightMax next vs | 181 | trajectoryToPathBounded rWidthMax rHeightMax start (v : vs) =
let next = shiftBounded rWidthMax rHeightMax start v
in next : trajectoryToPathBounded rWidthMax rHeightMax next vs | 181 | false | false | 2 | 9 | 27 | 56 | 26 | 30 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-example/Drasil/GlassBR/ModuleDefs.hs | bsd-2-clause | ------------------------------------------------------------------------------------------
--
-- Some semantic functions
-- Given two points (x1,y1) and (x2,y2), return the slope of the line going through them
slope :: (Fractional a) => (a, a) -> (a, a) -> a
slope (x1,y1) (x2,y2) = (y2 - y1) / (x2 - x1) | 305 | slope :: (Fractional a) => (a, a) -> (a, a) -> a
slope (x1,y1) (x2,y2) = (y2 - y1) / (x2 - x1) | 94 | slope (x1,y1) (x2,y2) = (y2 - y1) / (x2 - x1) | 45 | true | true | 0 | 8 | 45 | 79 | 47 | 32 | null | null |
ajnsit/monadfibre | src/Control/Monad/Fibre.hs | gpl-3.0 | --------------------------
-- FUNCTION DEFINITIONS --
--------------------------
-- Choice
(<||>) :: (Monad m, MonadBi m IO) => m o -> m o -> m o
t1 <||> t2 = do
t1io <- lower t1
t2io <- lower t2
x <- raise newEmptyMVar
raise $ do
forkIO $ t1io >>= putMVar x
forkIO $ t2io >>= putMVar x
raise $ takeMVar x
-- Parallelism | 340 | (<||>) :: (Monad m, MonadBi m IO) => m o -> m o -> m o
t1 <||> t2 = do
t1io <- lower t1
t2io <- lower t2
x <- raise newEmptyMVar
raise $ do
forkIO $ t1io >>= putMVar x
forkIO $ t2io >>= putMVar x
raise $ takeMVar x
-- Parallelism | 248 | t1 <||> t2 = do
t1io <- lower t1
t2io <- lower t2
x <- raise newEmptyMVar
raise $ do
forkIO $ t1io >>= putMVar x
forkIO $ t2io >>= putMVar x
raise $ takeMVar x
-- Parallelism | 193 | true | true | 0 | 12 | 81 | 137 | 63 | 74 | null | null |
apoikos/pkg-xmobar | src/Plugins/Monitors/Disk.hs | bsd-3-clause | runDiskIO' :: (String, [Float]) -> Monitor String
runDiskIO' (tmp, xs) = do
s <- mapM (showWithColors speedToStr) xs
b <- mapM (showLogBar 0.8) xs
setConfigValue tmp template
parseTemplate $ s ++ b | 205 | runDiskIO' :: (String, [Float]) -> Monitor String
runDiskIO' (tmp, xs) = do
s <- mapM (showWithColors speedToStr) xs
b <- mapM (showLogBar 0.8) xs
setConfigValue tmp template
parseTemplate $ s ++ b | 205 | runDiskIO' (tmp, xs) = do
s <- mapM (showWithColors speedToStr) xs
b <- mapM (showLogBar 0.8) xs
setConfigValue tmp template
parseTemplate $ s ++ b | 155 | false | true | 0 | 10 | 39 | 91 | 44 | 47 | null | null |
mitchellwrosen/kerchief | src/Handler/AddFile.hs | bsd-3-clause | handleAddFile :: [String] -> Kerchief ()
handleAddFile ["--help"] = printAddFileUsage | 86 | handleAddFile :: [String] -> Kerchief ()
handleAddFile ["--help"] = printAddFileUsage | 86 | handleAddFile ["--help"] = printAddFileUsage | 45 | false | true | 0 | 7 | 10 | 33 | 16 | 17 | null | null |
tonyfloatersu/solution-haskell-craft-of-FP | Chapter18.hs | mit | numberTree (Node x t1 t2)
= do num <- numberNode x
nt1 <- numberTree t1
nt2 <- numberTree t2
return (Node num nt1 nt2)
-- The work of the algorithm is done node by node, hence the function | 212 | numberTree (Node x t1 t2)
= do num <- numberNode x
nt1 <- numberTree t1
nt2 <- numberTree t2
return (Node num nt1 nt2)
-- The work of the algorithm is done node by node, hence the function | 212 | numberTree (Node x t1 t2)
= do num <- numberNode x
nt1 <- numberTree t1
nt2 <- numberTree t2
return (Node num nt1 nt2)
-- The work of the algorithm is done node by node, hence the function | 212 | false | false | 0 | 9 | 61 | 66 | 29 | 37 | null | null |
muspellsson/hiccup | TclLib/ListCmds.hs | lgpl-2.1 | cmdJoin args = case args of
[lst] -> dojoin lst (pack " ")
[lst,sep] -> dojoin lst (T.asBStr sep)
_ -> vArgErr "join list ?joinString?"
where dojoin ll sep = do
lst <- T.asList ll
return $ T.fromBStr (joinWithBS (map T.asBStr lst) sep) | 275 | cmdJoin args = case args of
[lst] -> dojoin lst (pack " ")
[lst,sep] -> dojoin lst (T.asBStr sep)
_ -> vArgErr "join list ?joinString?"
where dojoin ll sep = do
lst <- T.asList ll
return $ T.fromBStr (joinWithBS (map T.asBStr lst) sep) | 275 | cmdJoin args = case args of
[lst] -> dojoin lst (pack " ")
[lst,sep] -> dojoin lst (T.asBStr sep)
_ -> vArgErr "join list ?joinString?"
where dojoin ll sep = do
lst <- T.asList ll
return $ T.fromBStr (joinWithBS (map T.asBStr lst) sep) | 275 | false | false | 0 | 13 | 82 | 121 | 58 | 63 | null | null |
tdox/hcholmod | lib/Numeric/LinearAlgebra/CHOLMOD/CholmodXFaceLow.hs | mit | oneNorm :: NormType
oneNorm = NormType 1 | 41 | oneNorm :: NormType
oneNorm = NormType 1 | 41 | oneNorm = NormType 1 | 21 | false | true | 0 | 5 | 7 | 14 | 7 | 7 | null | null |
duairc/pipes | src/Control/Pipe/Binary.hs | bsd-3-clause | ------------------------------------------------------------------------------
-- | Consume the entire input stream with a strict left monadic fold, one byte
-- at a time.
fold :: Monad m => (b -> Word8 -> b) -> b -> Consumer ByteString m b
fold = PL.fold . B.foldl | 265 | fold :: Monad m => (b -> Word8 -> b) -> b -> Consumer ByteString m b
fold = PL.fold . B.foldl | 93 | fold = PL.fold . B.foldl | 24 | true | true | 0 | 9 | 41 | 55 | 29 | 26 | null | null |
talanis85/rechord | src/Rechord/Render/HTML.hs | gpl-3.0 | renderParagraph :: Paragraph TonalChord -> Render ()
renderParagraph para = do
out "<div class=\"paragraph\">"
mapM_ renderLine para
out "</div>" | 151 | renderParagraph :: Paragraph TonalChord -> Render ()
renderParagraph para = do
out "<div class=\"paragraph\">"
mapM_ renderLine para
out "</div>" | 151 | renderParagraph para = do
out "<div class=\"paragraph\">"
mapM_ renderLine para
out "</div>" | 98 | false | true | 0 | 7 | 24 | 46 | 19 | 27 | null | null |
GaloisInc/halvm-ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | collectHsValBinders = collect_hs_val_binders False | 50 | collectHsValBinders = collect_hs_val_binders False | 50 | collectHsValBinders = collect_hs_val_binders False | 50 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
ezyang/ghc | compiler/typecheck/TcEvidence.hs | bsd-3-clause | mkWpFun (WpCast co1) WpHole _ t2 _ = WpCast (mkTcFunCo Representational (mkTcSymCo co1) (mkTcRepReflCo t2)) | 114 | mkWpFun (WpCast co1) WpHole _ t2 _ = WpCast (mkTcFunCo Representational (mkTcSymCo co1) (mkTcRepReflCo t2)) | 114 | mkWpFun (WpCast co1) WpHole _ t2 _ = WpCast (mkTcFunCo Representational (mkTcSymCo co1) (mkTcRepReflCo t2)) | 114 | false | false | 1 | 9 | 21 | 52 | 23 | 29 | null | null |
GaloisInc/saw-script | src/SAWScript/AST.hs | bsd-3-clause | prettyMaybeTypedArg :: (Name, Maybe Type) -> PP.Doc ann
prettyMaybeTypedArg (name,Nothing) =
PP.pretty name | 110 | prettyMaybeTypedArg :: (Name, Maybe Type) -> PP.Doc ann
prettyMaybeTypedArg (name,Nothing) =
PP.pretty name | 110 | prettyMaybeTypedArg (name,Nothing) =
PP.pretty name | 54 | false | true | 0 | 7 | 15 | 43 | 22 | 21 | null | null |
a-ford/notghc | NotGHC.hs | bsd-3-clause | isCompManagerMode DoInteractive = True | 38 | isCompManagerMode DoInteractive = True | 38 | isCompManagerMode DoInteractive = True | 38 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
expipiplus1/vulkan | src/Vulkan/Version.hs | bsd-3-clause | _VERSION_PATCH :: Word32 -> Word32
_VERSION_PATCH = _API_VERSION_PATCH | 70 | _VERSION_PATCH :: Word32 -> Word32
_VERSION_PATCH = _API_VERSION_PATCH | 70 | _VERSION_PATCH = _API_VERSION_PATCH | 35 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
Xandaros/abnf | test/Document.hs | bsd-2-clause | wsLiteral :: Literal
wsLiteral = NumLit $ IntLit [0x20] | 55 | wsLiteral :: Literal
wsLiteral = NumLit $ IntLit [0x20] | 55 | wsLiteral = NumLit $ IntLit [0x20] | 34 | false | true | 0 | 7 | 8 | 27 | 12 | 15 | null | null |
geekingfrog/advent-of-code | src/Y2015/Day06.hs | bsd-3-clause | applyInstruction2 g (TurnOff, (bl, tr)) = increaseBy (-1) g bl tr | 65 | applyInstruction2 g (TurnOff, (bl, tr)) = increaseBy (-1) g bl tr | 65 | applyInstruction2 g (TurnOff, (bl, tr)) = increaseBy (-1) g bl tr | 65 | false | false | 0 | 7 | 10 | 37 | 20 | 17 | null | null |
Happstack/ixset | src/Data/IxSet.hs | bsd-3-clause | -- | Will replace the item with index k. Only works if there is at
-- most one item with that index in the 'IxSet'. Will not change
-- 'IxSet' if you have more then 1 item with given index.
updateIx :: (Indexable a, Ord a, Typeable a, Typeable k)
=> k -> a -> IxSet a -> IxSet a
updateIx i new ixset = insert new $
maybe ixset (flip delete ixset) $
getOne $ ixset @= i | 420 | updateIx :: (Indexable a, Ord a, Typeable a, Typeable k)
=> k -> a -> IxSet a -> IxSet a
updateIx i new ixset = insert new $
maybe ixset (flip delete ixset) $
getOne $ ixset @= i | 229 | updateIx i new ixset = insert new $
maybe ixset (flip delete ixset) $
getOne $ ixset @= i | 131 | true | true | 0 | 11 | 130 | 98 | 49 | 49 | null | null |
mskmysht/ProjectEuler | src/Problem8.hs | bsd-3-clause | thd = s2ds thds | 15 | thd = s2ds thds | 15 | thd = s2ds thds | 15 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
tsmarques/Yascc | src/yascc.hs | gpl-2.0 | parse_arg args@(x:xs)
| (x == "--total") = do
files <- parse_files xs
yascc files [] True
| otherwise = do
files <- parse_files args
yascc files [] False
-- Removes files with no language specification
-- e.g yascc.hs is haskell but yascc is unknown
-- and therefore removed.
-- If there's any directory reads its content(files or folders) | 362 | parse_arg args@(x:xs)
| (x == "--total") = do
files <- parse_files xs
yascc files [] True
| otherwise = do
files <- parse_files args
yascc files [] False
-- Removes files with no language specification
-- e.g yascc.hs is haskell but yascc is unknown
-- and therefore removed.
-- If there's any directory reads its content(files or folders) | 362 | parse_arg args@(x:xs)
| (x == "--total") = do
files <- parse_files xs
yascc files [] True
| otherwise = do
files <- parse_files args
yascc files [] False
-- Removes files with no language specification
-- e.g yascc.hs is haskell but yascc is unknown
-- and therefore removed.
-- If there's any directory reads its content(files or folders) | 362 | false | false | 1 | 10 | 80 | 89 | 42 | 47 | null | null |
mcschroeder/ghc | compiler/prelude/THNames.hs | bsd-3-clause | -- data RuleBndr = ...
ruleVarIdKey, typedRuleVarIdKey :: Unique
ruleVarIdKey = mkPreludeMiscIdUnique 480 | 110 | ruleVarIdKey, typedRuleVarIdKey :: Unique
ruleVarIdKey = mkPreludeMiscIdUnique 480 | 87 | ruleVarIdKey = mkPreludeMiscIdUnique 480 | 45 | true | true | 0 | 5 | 17 | 17 | 10 | 7 | null | null |
fcostantini/QuickFuzz | src/Png.hs | gpl-3.0 | mdecode :: B.ByteString -> MPngImage
mdecode x = decode (L.pack (B.unpack x)) | 77 | mdecode :: B.ByteString -> MPngImage
mdecode x = decode (L.pack (B.unpack x)) | 77 | mdecode x = decode (L.pack (B.unpack x)) | 40 | false | true | 0 | 10 | 11 | 45 | 20 | 25 | null | null |
pgj/bead | src/Bead/View/Content/Bootstrap.hs | bsd-3-clause | -- | Creates a bootstrap 12 column
colMd12 = H.div ! class_ "col-md-12" | 71 | colMd12 = H.div ! class_ "col-md-12" | 36 | colMd12 = H.div ! class_ "col-md-12" | 36 | true | false | 0 | 6 | 12 | 16 | 8 | 8 | null | null |
AubreyEAnderson/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | checkInexplicablyUnquoted _ _ = return () | 41 | checkInexplicablyUnquoted _ _ = return () | 41 | checkInexplicablyUnquoted _ _ = return () | 41 | false | false | 0 | 6 | 5 | 16 | 7 | 9 | null | null |
beni55/taggy-lens | test/Text/Taggy/LensSpec.hs | bsd-3-clause | spec :: Spec
spec = do
describe "html" $ do
it "Should parse given Text into a single root node." $ do
markup ^? html `shouldBe` Just node
it "Should render a given root node into text." $ do
node ^. re html `shouldBe` markup
it "Should escape HTML entities in rendering." $ do
"&" ^? html ^. _Just . re html `shouldBe` "&"
describe "htmlWith" $ do
it "When parametrised with False, should not escape HTML entities in parsing." $ do
"&" ^? htmlWith False `shouldBe` Just (NodeContent "&")
it "When parametrised with False, should not escape HTML entities in rendering." $ do
"&" ^? htmlWith False ^. _Just . re (htmlWith False) `shouldBe` "&"
describe "name" $ do
it "Should get the name of a given element." $ do
elem ^. name `shouldBe` "html"
it "Should set the name of the given element." $ do
let element' = name .~ "sgml" $ elem
eltName element' `shouldBe` "sgml"
describe "named" $ do
it "Should traverse only elements who's name matches a specific property." $ do
let markup' = "<html><foo>bar</foo><baz>qux</baz><quux>corge</quux></html>"
markup' ^.. html . elements . named (to length . only 3) . name `shouldBe` ["foo", "baz"]
describe "attrs" $ do
it "Should get the attributes of a given element." $ do
elem ^. attrs ^. at "xmlns" `shouldBe` Just "http://www.w3.org/1999/xhtml"
elem ^. attrs ^. at "style" `shouldBe` Nothing
it "Should set the attributes of a given element." $ do
let attributes = eltAttrs elem <> fromList [("style", "body { font-family: 'Comic Sans MS' }")]
element' = attrs .~ attributes $ elem
eltAttrs element' `shouldBe` attributes
describe "attr" $ do
it "Should get the value of a named attribute." $ do
elem ^. attr "xmlns" `shouldBe` Just "http://www.w3.org/1999/xhtml"
elem ^. attr "style" `shouldBe` Nothing
it "Should set the value of a named attribute." $ do
let style = "body { font-family: 'Comic Sans MS' }"
element' = elem & attr "style" ?~ style
element' ^. attr "style" `shouldBe` Just style
describe "attributed" $ do
it "Should traverse only attributes satisfying a given property." $ do
elem ^? attributed (folded . to (isSuffixOf "xhtml")) `shouldBe` Just elem
describe "children" $ do
it "Should get child nodes of the given element." $ do
elem ^. children `shouldBe` []
"<html><bar>qux</bar></html>" ^.. html . element . children . traverse . element . name `shouldBe` ["bar"]
it "Should set the child nodes of a given element." $ do
let subtree = taggyWith False "<a>bar</a>" & domify
eltChildren (elem & children .~ subtree) `shouldBe` subtree
let text = "The quick brown fox jumps over the lazy dog."
describe "element" $ do
it "Should lift a given Element into a Node" $ do
elem ^. re element `shouldBe` node
it "Should try to extract an Element from a given Node." $ do
node ^? element `shouldBe` Just elem
NodeContent text ^? element `shouldBe` Nothing
describe "elements" $ do
it "Should traverse the immediate children of an element that are also elements directly." $ do
let markup' = "<html><foo></foo><bar></bar><baz></baz></html>"
markup' ^.. html . element . elements . name `shouldBe` ["foo", "bar", "baz"]
it "Should traverse the immediate children of an element that are also elements, via a node." $ do
let markup' = "<html><foo></foo><bar></bar><baz></baz></html>"
markup' ^.. html . elements . name `shouldBe` ["foo", "bar", "baz"]
describe "content" $ do
it "Should lift provided Text into a Node." $ do
text ^. re content `shouldBe` NodeContent text
it "Should try to extract Text from a given node." $ do
node ^? content `shouldBe` Nothing
NodeContent text ^? content `shouldBe` Just text
describe "contents" $ do
it "Should traverse the immediate children of an element that are text nodes directly." $ do
let markup' = "<html><foo></foo>bar<baz></baz>qux</html>"
markup' ^.. html . element . contents `shouldBe` ["bar", "qux"]
it "Should traverse the immediate children of an element that are text nodes, via a Node." $ do
let markup' = "<html><foo></foo>bar<baz></baz>qux</html>"
markup' ^.. html . contents `shouldBe` ["bar", "qux"]
describe "validation of plated instance for node" $ do
let markup' = "<html><foo>foo</foo>bar<baz></baz>qux</html>"
it "Should be able to retrieve all transitive descendants of a given node." $ do
markup' ^.. html . to universe . traverse . content `shouldBe` ["foo","bar","qux"]
describe "validation of plated instance for element" $ do
let markup' = "<html><foo></foo>bar<baz></baz>qux</html>"
it "Should be able to retrieve all transitive descendants of a given node." $ do
markup' ^.. html . element . to universe . traverse . name `shouldBe` ["html","foo","baz"]
describe "allNamed" $ do
let markup' = "<html><foo>bar<qux><foo class=\"withBaz\">baz</foo></qux></foo></html>"
it "Should retrieve all nodes in a subtree who's name match a given predicate." $ do
markup' ^.. html . allNamed (only "foo") . contents `shouldBe` ["bar", "baz"]
it "Should compose with other folds in a way that they filter on the parent, not its children." $ do
markup' ^.. html . allNamed (only "foo") . attributed (ix "class" . only "withBaz") . contents `shouldBe` ["baz"]
it "Provided a node, should not exclude the parent element in its traversal." $ do
markup ^.. html . allNamed (only "html") `shouldSatisfy` not . null
it "Provided an element, should not exclude this in its traversal." $ do
markup ^.. html . element . allNamed (only "html") `shouldSatisfy` not . null
describe "allAttributed" $ do
let markup' = "<html><foo class=\"woah\">bar<qux class=\"woah\"></qux></foo><quux class=\"woah\"></quux></html>"
it "Should retrieve all nodes in a subtree who's attributes match a given predicate." $ do
markup' ^.. html . allAttributed (folded . only "woah") . name `shouldBe` ["foo", "qux", "quux"]
it "Should compose with other folds in a way that they filter on the parent, not its children." $ do
markup' ^.. html . allAttributed (ix "class" . only "woah") . named (only "foo") . name `shouldBe` ["foo"] | 6,392 | spec :: Spec
spec = do
describe "html" $ do
it "Should parse given Text into a single root node." $ do
markup ^? html `shouldBe` Just node
it "Should render a given root node into text." $ do
node ^. re html `shouldBe` markup
it "Should escape HTML entities in rendering." $ do
"&" ^? html ^. _Just . re html `shouldBe` "&"
describe "htmlWith" $ do
it "When parametrised with False, should not escape HTML entities in parsing." $ do
"&" ^? htmlWith False `shouldBe` Just (NodeContent "&")
it "When parametrised with False, should not escape HTML entities in rendering." $ do
"&" ^? htmlWith False ^. _Just . re (htmlWith False) `shouldBe` "&"
describe "name" $ do
it "Should get the name of a given element." $ do
elem ^. name `shouldBe` "html"
it "Should set the name of the given element." $ do
let element' = name .~ "sgml" $ elem
eltName element' `shouldBe` "sgml"
describe "named" $ do
it "Should traverse only elements who's name matches a specific property." $ do
let markup' = "<html><foo>bar</foo><baz>qux</baz><quux>corge</quux></html>"
markup' ^.. html . elements . named (to length . only 3) . name `shouldBe` ["foo", "baz"]
describe "attrs" $ do
it "Should get the attributes of a given element." $ do
elem ^. attrs ^. at "xmlns" `shouldBe` Just "http://www.w3.org/1999/xhtml"
elem ^. attrs ^. at "style" `shouldBe` Nothing
it "Should set the attributes of a given element." $ do
let attributes = eltAttrs elem <> fromList [("style", "body { font-family: 'Comic Sans MS' }")]
element' = attrs .~ attributes $ elem
eltAttrs element' `shouldBe` attributes
describe "attr" $ do
it "Should get the value of a named attribute." $ do
elem ^. attr "xmlns" `shouldBe` Just "http://www.w3.org/1999/xhtml"
elem ^. attr "style" `shouldBe` Nothing
it "Should set the value of a named attribute." $ do
let style = "body { font-family: 'Comic Sans MS' }"
element' = elem & attr "style" ?~ style
element' ^. attr "style" `shouldBe` Just style
describe "attributed" $ do
it "Should traverse only attributes satisfying a given property." $ do
elem ^? attributed (folded . to (isSuffixOf "xhtml")) `shouldBe` Just elem
describe "children" $ do
it "Should get child nodes of the given element." $ do
elem ^. children `shouldBe` []
"<html><bar>qux</bar></html>" ^.. html . element . children . traverse . element . name `shouldBe` ["bar"]
it "Should set the child nodes of a given element." $ do
let subtree = taggyWith False "<a>bar</a>" & domify
eltChildren (elem & children .~ subtree) `shouldBe` subtree
let text = "The quick brown fox jumps over the lazy dog."
describe "element" $ do
it "Should lift a given Element into a Node" $ do
elem ^. re element `shouldBe` node
it "Should try to extract an Element from a given Node." $ do
node ^? element `shouldBe` Just elem
NodeContent text ^? element `shouldBe` Nothing
describe "elements" $ do
it "Should traverse the immediate children of an element that are also elements directly." $ do
let markup' = "<html><foo></foo><bar></bar><baz></baz></html>"
markup' ^.. html . element . elements . name `shouldBe` ["foo", "bar", "baz"]
it "Should traverse the immediate children of an element that are also elements, via a node." $ do
let markup' = "<html><foo></foo><bar></bar><baz></baz></html>"
markup' ^.. html . elements . name `shouldBe` ["foo", "bar", "baz"]
describe "content" $ do
it "Should lift provided Text into a Node." $ do
text ^. re content `shouldBe` NodeContent text
it "Should try to extract Text from a given node." $ do
node ^? content `shouldBe` Nothing
NodeContent text ^? content `shouldBe` Just text
describe "contents" $ do
it "Should traverse the immediate children of an element that are text nodes directly." $ do
let markup' = "<html><foo></foo>bar<baz></baz>qux</html>"
markup' ^.. html . element . contents `shouldBe` ["bar", "qux"]
it "Should traverse the immediate children of an element that are text nodes, via a Node." $ do
let markup' = "<html><foo></foo>bar<baz></baz>qux</html>"
markup' ^.. html . contents `shouldBe` ["bar", "qux"]
describe "validation of plated instance for node" $ do
let markup' = "<html><foo>foo</foo>bar<baz></baz>qux</html>"
it "Should be able to retrieve all transitive descendants of a given node." $ do
markup' ^.. html . to universe . traverse . content `shouldBe` ["foo","bar","qux"]
describe "validation of plated instance for element" $ do
let markup' = "<html><foo></foo>bar<baz></baz>qux</html>"
it "Should be able to retrieve all transitive descendants of a given node." $ do
markup' ^.. html . element . to universe . traverse . name `shouldBe` ["html","foo","baz"]
describe "allNamed" $ do
let markup' = "<html><foo>bar<qux><foo class=\"withBaz\">baz</foo></qux></foo></html>"
it "Should retrieve all nodes in a subtree who's name match a given predicate." $ do
markup' ^.. html . allNamed (only "foo") . contents `shouldBe` ["bar", "baz"]
it "Should compose with other folds in a way that they filter on the parent, not its children." $ do
markup' ^.. html . allNamed (only "foo") . attributed (ix "class" . only "withBaz") . contents `shouldBe` ["baz"]
it "Provided a node, should not exclude the parent element in its traversal." $ do
markup ^.. html . allNamed (only "html") `shouldSatisfy` not . null
it "Provided an element, should not exclude this in its traversal." $ do
markup ^.. html . element . allNamed (only "html") `shouldSatisfy` not . null
describe "allAttributed" $ do
let markup' = "<html><foo class=\"woah\">bar<qux class=\"woah\"></qux></foo><quux class=\"woah\"></quux></html>"
it "Should retrieve all nodes in a subtree who's attributes match a given predicate." $ do
markup' ^.. html . allAttributed (folded . only "woah") . name `shouldBe` ["foo", "qux", "quux"]
it "Should compose with other folds in a way that they filter on the parent, not its children." $ do
markup' ^.. html . allAttributed (ix "class" . only "woah") . named (only "foo") . name `shouldBe` ["foo"] | 6,392 | spec = do
describe "html" $ do
it "Should parse given Text into a single root node." $ do
markup ^? html `shouldBe` Just node
it "Should render a given root node into text." $ do
node ^. re html `shouldBe` markup
it "Should escape HTML entities in rendering." $ do
"&" ^? html ^. _Just . re html `shouldBe` "&"
describe "htmlWith" $ do
it "When parametrised with False, should not escape HTML entities in parsing." $ do
"&" ^? htmlWith False `shouldBe` Just (NodeContent "&")
it "When parametrised with False, should not escape HTML entities in rendering." $ do
"&" ^? htmlWith False ^. _Just . re (htmlWith False) `shouldBe` "&"
describe "name" $ do
it "Should get the name of a given element." $ do
elem ^. name `shouldBe` "html"
it "Should set the name of the given element." $ do
let element' = name .~ "sgml" $ elem
eltName element' `shouldBe` "sgml"
describe "named" $ do
it "Should traverse only elements who's name matches a specific property." $ do
let markup' = "<html><foo>bar</foo><baz>qux</baz><quux>corge</quux></html>"
markup' ^.. html . elements . named (to length . only 3) . name `shouldBe` ["foo", "baz"]
describe "attrs" $ do
it "Should get the attributes of a given element." $ do
elem ^. attrs ^. at "xmlns" `shouldBe` Just "http://www.w3.org/1999/xhtml"
elem ^. attrs ^. at "style" `shouldBe` Nothing
it "Should set the attributes of a given element." $ do
let attributes = eltAttrs elem <> fromList [("style", "body { font-family: 'Comic Sans MS' }")]
element' = attrs .~ attributes $ elem
eltAttrs element' `shouldBe` attributes
describe "attr" $ do
it "Should get the value of a named attribute." $ do
elem ^. attr "xmlns" `shouldBe` Just "http://www.w3.org/1999/xhtml"
elem ^. attr "style" `shouldBe` Nothing
it "Should set the value of a named attribute." $ do
let style = "body { font-family: 'Comic Sans MS' }"
element' = elem & attr "style" ?~ style
element' ^. attr "style" `shouldBe` Just style
describe "attributed" $ do
it "Should traverse only attributes satisfying a given property." $ do
elem ^? attributed (folded . to (isSuffixOf "xhtml")) `shouldBe` Just elem
describe "children" $ do
it "Should get child nodes of the given element." $ do
elem ^. children `shouldBe` []
"<html><bar>qux</bar></html>" ^.. html . element . children . traverse . element . name `shouldBe` ["bar"]
it "Should set the child nodes of a given element." $ do
let subtree = taggyWith False "<a>bar</a>" & domify
eltChildren (elem & children .~ subtree) `shouldBe` subtree
let text = "The quick brown fox jumps over the lazy dog."
describe "element" $ do
it "Should lift a given Element into a Node" $ do
elem ^. re element `shouldBe` node
it "Should try to extract an Element from a given Node." $ do
node ^? element `shouldBe` Just elem
NodeContent text ^? element `shouldBe` Nothing
describe "elements" $ do
it "Should traverse the immediate children of an element that are also elements directly." $ do
let markup' = "<html><foo></foo><bar></bar><baz></baz></html>"
markup' ^.. html . element . elements . name `shouldBe` ["foo", "bar", "baz"]
it "Should traverse the immediate children of an element that are also elements, via a node." $ do
let markup' = "<html><foo></foo><bar></bar><baz></baz></html>"
markup' ^.. html . elements . name `shouldBe` ["foo", "bar", "baz"]
describe "content" $ do
it "Should lift provided Text into a Node." $ do
text ^. re content `shouldBe` NodeContent text
it "Should try to extract Text from a given node." $ do
node ^? content `shouldBe` Nothing
NodeContent text ^? content `shouldBe` Just text
describe "contents" $ do
it "Should traverse the immediate children of an element that are text nodes directly." $ do
let markup' = "<html><foo></foo>bar<baz></baz>qux</html>"
markup' ^.. html . element . contents `shouldBe` ["bar", "qux"]
it "Should traverse the immediate children of an element that are text nodes, via a Node." $ do
let markup' = "<html><foo></foo>bar<baz></baz>qux</html>"
markup' ^.. html . contents `shouldBe` ["bar", "qux"]
describe "validation of plated instance for node" $ do
let markup' = "<html><foo>foo</foo>bar<baz></baz>qux</html>"
it "Should be able to retrieve all transitive descendants of a given node." $ do
markup' ^.. html . to universe . traverse . content `shouldBe` ["foo","bar","qux"]
describe "validation of plated instance for element" $ do
let markup' = "<html><foo></foo>bar<baz></baz>qux</html>"
it "Should be able to retrieve all transitive descendants of a given node." $ do
markup' ^.. html . element . to universe . traverse . name `shouldBe` ["html","foo","baz"]
describe "allNamed" $ do
let markup' = "<html><foo>bar<qux><foo class=\"withBaz\">baz</foo></qux></foo></html>"
it "Should retrieve all nodes in a subtree who's name match a given predicate." $ do
markup' ^.. html . allNamed (only "foo") . contents `shouldBe` ["bar", "baz"]
it "Should compose with other folds in a way that they filter on the parent, not its children." $ do
markup' ^.. html . allNamed (only "foo") . attributed (ix "class" . only "withBaz") . contents `shouldBe` ["baz"]
it "Provided a node, should not exclude the parent element in its traversal." $ do
markup ^.. html . allNamed (only "html") `shouldSatisfy` not . null
it "Provided an element, should not exclude this in its traversal." $ do
markup ^.. html . element . allNamed (only "html") `shouldSatisfy` not . null
describe "allAttributed" $ do
let markup' = "<html><foo class=\"woah\">bar<qux class=\"woah\"></qux></foo><quux class=\"woah\"></quux></html>"
it "Should retrieve all nodes in a subtree who's attributes match a given predicate." $ do
markup' ^.. html . allAttributed (folded . only "woah") . name `shouldBe` ["foo", "qux", "quux"]
it "Should compose with other folds in a way that they filter on the parent, not its children." $ do
markup' ^.. html . allAttributed (ix "class" . only "woah") . named (only "foo") . name `shouldBe` ["foo"] | 6,379 | false | true | 0 | 62 | 1,420 | 1,624 | 766 | 858 | null | null |
dpieroux/euler | 0/0084.hs | mit | cCCs = [2, 17, 33] | 18 | cCCs = [2, 17, 33] | 18 | cCCs = [2, 17, 33] | 18 | false | false | 0 | 5 | 4 | 15 | 9 | 6 | null | null |
GaloisInc/ivory-tower-stm32 | ivory-bsp-stm32/src/Ivory/BSP/STM32/Config.hs | bsd-3-clause | px4versionParser :: ConfigParser (Maybe PX4Version)
px4versionParser = string >>= \s ->
case map C.toLower s of
"px4fmuv1" -> return (Just PX4FMU_v1)
"px4fmuv2" -> return (Just PX4FMU_v2)
"pixhawk" -> return (Just PX4FMU_v2)
"none" -> return Nothing
_ -> fail ("expected px4 version, got " ++ s) | 365 | px4versionParser :: ConfigParser (Maybe PX4Version)
px4versionParser = string >>= \s ->
case map C.toLower s of
"px4fmuv1" -> return (Just PX4FMU_v1)
"px4fmuv2" -> return (Just PX4FMU_v2)
"pixhawk" -> return (Just PX4FMU_v2)
"none" -> return Nothing
_ -> fail ("expected px4 version, got " ++ s) | 365 | px4versionParser = string >>= \s ->
case map C.toLower s of
"px4fmuv1" -> return (Just PX4FMU_v1)
"px4fmuv2" -> return (Just PX4FMU_v2)
"pixhawk" -> return (Just PX4FMU_v2)
"none" -> return Nothing
_ -> fail ("expected px4 version, got " ++ s) | 313 | false | true | 0 | 12 | 114 | 110 | 53 | 57 | null | null |
CodiBurley/domain-interpreter | src/parser.hs | mit | rangesList = sepBy1 function (reservedOp ",") | 45 | rangesList = sepBy1 function (reservedOp ",") | 45 | rangesList = sepBy1 function (reservedOp ",") | 45 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
mcschroeder/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | ppr_expr (HsLit lit) = ppr lit | 35 | ppr_expr (HsLit lit) = ppr lit | 35 | ppr_expr (HsLit lit) = ppr lit | 35 | false | false | 0 | 6 | 10 | 19 | 8 | 11 | null | null |
JohnLato/iteratee | tests/testIteratee.hs | bsd-3-clause | runner1 = runIdentity . Iter.run . runIdentity | 46 | runner1 = runIdentity . Iter.run . runIdentity | 46 | runner1 = runIdentity . Iter.run . runIdentity | 46 | false | false | 0 | 7 | 6 | 16 | 8 | 8 | null | null |
peterstuart/dark-sky | test/PrecipitationTypeSpec.hs | mit | precipitationTypeSpec :: IO ()
precipitationTypeSpec =
hspec $
describe "PrecipitationType" $
describe "FromJSON" $
do it "can parse valid JSON" $
decode samplePrecipitationTypes `shouldBe` Just [Rain, Snow, Sleet]
it "doesn't parse invalid JSON" $
decode sampleInvalidData `shouldBe`
(Nothing :: Maybe [PrecipitationType]) | 357 | precipitationTypeSpec :: IO ()
precipitationTypeSpec =
hspec $
describe "PrecipitationType" $
describe "FromJSON" $
do it "can parse valid JSON" $
decode samplePrecipitationTypes `shouldBe` Just [Rain, Snow, Sleet]
it "doesn't parse invalid JSON" $
decode sampleInvalidData `shouldBe`
(Nothing :: Maybe [PrecipitationType]) | 357 | precipitationTypeSpec =
hspec $
describe "PrecipitationType" $
describe "FromJSON" $
do it "can parse valid JSON" $
decode samplePrecipitationTypes `shouldBe` Just [Rain, Snow, Sleet]
it "doesn't parse invalid JSON" $
decode sampleInvalidData `shouldBe`
(Nothing :: Maybe [PrecipitationType]) | 326 | false | true | 5 | 11 | 74 | 102 | 48 | 54 | null | null |
rrnewton/criterion | Criterion/Types.hs | bsd-2-clause | -- | Retrieve the names of all benchmarks. Grouped benchmarks are
-- prefixed with the name of the group they're in.
benchNames :: Benchmark -> [String]
benchNames (Environment _ b) = benchNames (b undefined) | 209 | benchNames :: Benchmark -> [String]
benchNames (Environment _ b) = benchNames (b undefined) | 91 | benchNames (Environment _ b) = benchNames (b undefined) | 55 | true | true | 0 | 7 | 34 | 40 | 21 | 19 | null | null |
rueshyna/gogol | gogol-games/gen/Network/Google/Games/Types/Product.hs | mpl-2.0 | -- | The name to display for the event.
edDisplayName :: Lens' EventDefinition (Maybe Text)
edDisplayName
= lens _edDisplayName
(\ s a -> s{_edDisplayName = a}) | 168 | edDisplayName :: Lens' EventDefinition (Maybe Text)
edDisplayName
= lens _edDisplayName
(\ s a -> s{_edDisplayName = a}) | 128 | edDisplayName
= lens _edDisplayName
(\ s a -> s{_edDisplayName = a}) | 76 | true | true | 0 | 9 | 33 | 48 | 25 | 23 | null | null |
grnet/snf-ganeti | src/Ganeti/OpParams.hs | bsd-2-clause | -- | Custom reader for 'ExportTarget'.
readExportTarget :: JSValue -> Text.JSON.Result ExportTarget
readExportTarget (JSString s) = liftM ExportTargetLocal $
mkNonEmpty (fromJSString s) | 217 | readExportTarget :: JSValue -> Text.JSON.Result ExportTarget
readExportTarget (JSString s) = liftM ExportTargetLocal $
mkNonEmpty (fromJSString s) | 178 | readExportTarget (JSString s) = liftM ExportTargetLocal $
mkNonEmpty (fromJSString s) | 117 | true | true | 0 | 8 | 53 | 47 | 23 | 24 | null | null |
rfranek/duckling | Duckling/Time/PT/Rules.hs | bsd-3-clause | ruleNamedday2 :: Rule
ruleNamedday2 = Rule
{ name = "named-day"
, pattern =
[ regex "ter(\x00e7|c)a((\\s|\\-)feira)?|ter\\.?"
]
, prod = \_ -> tt $ dayOfWeek 2
} | 177 | ruleNamedday2 :: Rule
ruleNamedday2 = Rule
{ name = "named-day"
, pattern =
[ regex "ter(\x00e7|c)a((\\s|\\-)feira)?|ter\\.?"
]
, prod = \_ -> tt $ dayOfWeek 2
} | 177 | ruleNamedday2 = Rule
{ name = "named-day"
, pattern =
[ regex "ter(\x00e7|c)a((\\s|\\-)feira)?|ter\\.?"
]
, prod = \_ -> tt $ dayOfWeek 2
} | 155 | false | true | 0 | 10 | 42 | 53 | 29 | 24 | null | null |
AndrewRademacher/stack | src/Path/Extra.hs | bsd-3-clause | -- | See 'rejectMissingFile'.
rejectMissingDir :: MonadIO m
=> Maybe (Path Abs Dir)
-> m (Maybe (Path Abs Dir))
rejectMissingDir Nothing = return Nothing | 158 | rejectMissingDir :: MonadIO m
=> Maybe (Path Abs Dir)
-> m (Maybe (Path Abs Dir))
rejectMissingDir Nothing = return Nothing | 127 | rejectMissingDir Nothing = return Nothing | 41 | true | true | 0 | 12 | 28 | 61 | 28 | 33 | null | null |
GaloisInc/halvm-ghc | compiler/stranal/DmdAnal.hs | bsd-3-clause | unpackTrivial (App e a) | isTypeArg a = unpackTrivial e | 55 | unpackTrivial (App e a) | isTypeArg a = unpackTrivial e | 55 | unpackTrivial (App e a) | isTypeArg a = unpackTrivial e | 55 | false | false | 0 | 8 | 9 | 29 | 12 | 17 | null | null |
rootzlevel/sansa | src/Sansa/Commands/CommonOpts.hs | bsd-2-clause | printFollow FollowMem = "mem" | 29 | printFollow FollowMem = "mem" | 29 | printFollow FollowMem = "mem" | 29 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
mgold/Elm | tests/Test/Compiler.hs | bsd-3-clause | testMatchesExpected :: String -> String -> IO [Test]
testMatchesExpected elmDir expectedJsDir =
do elmFiles <- getElms elmDir
envVar <- lookupEnv writeExpectedJsEnvVarName
if isJust envVar
then
traverse (doWriteNewExpectedTest expectedJsDir) elmFiles
else
traverse (doMatchesExpectedTest expectedJsDir) elmFiles
-- CHECK RESULTS | 382 | testMatchesExpected :: String -> String -> IO [Test]
testMatchesExpected elmDir expectedJsDir =
do elmFiles <- getElms elmDir
envVar <- lookupEnv writeExpectedJsEnvVarName
if isJust envVar
then
traverse (doWriteNewExpectedTest expectedJsDir) elmFiles
else
traverse (doMatchesExpectedTest expectedJsDir) elmFiles
-- CHECK RESULTS | 382 | testMatchesExpected elmDir expectedJsDir =
do elmFiles <- getElms elmDir
envVar <- lookupEnv writeExpectedJsEnvVarName
if isJust envVar
then
traverse (doWriteNewExpectedTest expectedJsDir) elmFiles
else
traverse (doMatchesExpectedTest expectedJsDir) elmFiles
-- CHECK RESULTS | 329 | false | true | 0 | 11 | 90 | 92 | 42 | 50 | null | null |
sjindel/Chamber | Chamber/Data/NC.hs | gpl-3.0 | eval a (Or f g) = (eval a f) || (eval a g) | 43 | eval a (Or f g) = (eval a f) || (eval a g) | 43 | eval a (Or f g) = (eval a f) || (eval a g) | 43 | false | false | 0 | 7 | 13 | 39 | 19 | 20 | null | null |
rgaiacs/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | hacek 'e' = "ě" | 15 | hacek 'e' = "ě" | 15 | hacek 'e' = "ě" | 15 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Numberartificial/workflow | snipets/src/Craft/Chapter14_1.hs | mit | prop_depth :: NTree -> Bool
prop_depth t =
size t < 2^(depth t) | 68 | prop_depth :: NTree -> Bool
prop_depth t =
size t < 2^(depth t) | 67 | prop_depth t =
size t < 2^(depth t) | 39 | false | true | 0 | 7 | 17 | 35 | 17 | 18 | null | null |
miguel-negrao/iCalendar | Text/ICalendar/Parser/Properties.hs | bsd-3-clause | parseGeo x = throwError $ "parseGeo: " ++ show x | 48 | parseGeo x = throwError $ "parseGeo: " ++ show x | 48 | parseGeo x = throwError $ "parseGeo: " ++ show x | 48 | false | false | 1 | 6 | 9 | 23 | 9 | 14 | null | null |
kaoskorobase/mescaline | resources/hugs/packages/base/Data/IntSet.hs | gpl-3.0 | natFromInt :: Int -> Nat
natFromInt i = fromIntegral i | 54 | natFromInt :: Int -> Nat
natFromInt i = fromIntegral i | 54 | natFromInt i = fromIntegral i | 29 | false | true | 0 | 5 | 9 | 21 | 10 | 11 | null | null |
ksaveljev/hake-2 | src/Game/Monster.hs | bsd-3-clause | monsterTriggeredSpawnUse :: EntUse
monsterTriggeredSpawnUse =
GenericEntUse "monster_trigger_spawn_use" $ \_ _ _ -> do
io (putStrLn "Monster.monsterTriggeredSpawnUse") >> undefined -- TODO
{-
- ================ monster_death_use ================
-
- When a monster dies, it fires all of its targets with the current enemy
- as activator.
-} | 348 | monsterTriggeredSpawnUse :: EntUse
monsterTriggeredSpawnUse =
GenericEntUse "monster_trigger_spawn_use" $ \_ _ _ -> do
io (putStrLn "Monster.monsterTriggeredSpawnUse") >> undefined -- TODO
{-
- ================ monster_death_use ================
-
- When a monster dies, it fires all of its targets with the current enemy
- as activator.
-} | 348 | monsterTriggeredSpawnUse =
GenericEntUse "monster_trigger_spawn_use" $ \_ _ _ -> do
io (putStrLn "Monster.monsterTriggeredSpawnUse") >> undefined -- TODO
{-
- ================ monster_death_use ================
-
- When a monster dies, it fires all of its targets with the current enemy
- as activator.
-} | 313 | false | true | 0 | 12 | 52 | 45 | 23 | 22 | null | null |
gridaphobe/ghc | compiler/basicTypes/VarEnv.hs | bsd-3-clause | unitVarEnv = unitUFM | 26 | unitVarEnv = unitUFM | 26 | unitVarEnv = unitUFM | 26 | false | false | 0 | 4 | 8 | 6 | 3 | 3 | null | null |
annenkov/contracts | Haskell/Contract/Type.hs | mit | -- | conditional contract (two branches)
iff = If | 49 | iff = If | 8 | iff = If | 8 | true | false | 1 | 5 | 8 | 11 | 4 | 7 | null | null |
junjihashimoto/persistent | persistent/Database/Persist/Sql/Migration.hs | mit | sortMigrations :: [Sql] -> [Sql]
sortMigrations x =
filter isCreate x ++ filter (not . isCreate) x
where
-- Note the use of lower-case e. This (hack) allows backends to explicitly
-- choose to have this special sorting applied.
isCreate t = pack "CREATe " `isPrefixOf` t | 288 | sortMigrations :: [Sql] -> [Sql]
sortMigrations x =
filter isCreate x ++ filter (not . isCreate) x
where
-- Note the use of lower-case e. This (hack) allows backends to explicitly
-- choose to have this special sorting applied.
isCreate t = pack "CREATe " `isPrefixOf` t | 288 | sortMigrations x =
filter isCreate x ++ filter (not . isCreate) x
where
-- Note the use of lower-case e. This (hack) allows backends to explicitly
-- choose to have this special sorting applied.
isCreate t = pack "CREATe " `isPrefixOf` t | 255 | false | true | 0 | 8 | 64 | 66 | 35 | 31 | null | null |
xenog/haskoin | test/regtest/Main.hs | unlicense | withChain :: State HeaderMemory a -> a
withChain f = evalState f initialChain | 77 | withChain :: State HeaderMemory a -> a
withChain f = evalState f initialChain | 77 | withChain f = evalState f initialChain | 38 | false | true | 0 | 7 | 12 | 33 | 14 | 19 | null | null |
bestian/haskell-sandbox | h99.hs | unlicense | myButLast (x:[]) = error "only one emlement" | 44 | myButLast (x:[]) = error "only one emlement" | 44 | myButLast (x:[]) = error "only one emlement" | 44 | false | false | 0 | 7 | 6 | 22 | 10 | 12 | null | null |
urv/fixhs | src/Data/FIX/Spec/FIX43.hs | lgpl-2.1 | tLegSide :: FIXTag
tLegSide = FIXTag
{ tName = "LegSide"
, tnum = 624
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 150 | tLegSide :: FIXTag
tLegSide = FIXTag
{ tName = "LegSide"
, tnum = 624
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 150 | tLegSide = FIXTag
{ tName = "LegSide"
, tnum = 624
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 131 | false | true | 0 | 10 | 38 | 51 | 29 | 22 | null | null |
QuickChick/Luck | luck/src/Core/Optimizations.hs | mit | compute (ADT c es) = liftM (ADT c) $ mapM compute es | 52 | compute (ADT c es) = liftM (ADT c) $ mapM compute es | 52 | compute (ADT c es) = liftM (ADT c) $ mapM compute es | 52 | false | false | 0 | 8 | 11 | 35 | 16 | 19 | null | null |
sgillespie/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | enumFromToName = varQual gHC_ENUM (fsLit "enumFromTo") enumFromToClassOpKey | 83 | enumFromToName = varQual gHC_ENUM (fsLit "enumFromTo") enumFromToClassOpKey | 83 | enumFromToName = varQual gHC_ENUM (fsLit "enumFromTo") enumFromToClassOpKey | 83 | false | false | 0 | 7 | 14 | 19 | 9 | 10 | null | null |
thoughtpolice/binary-serialise-cbor | bench/Real/CBOR.hs | bsd-3-clause | decodeSingleCtr2 v f = decodeListLenOf 3 *> decodeWordOf v *> pure f <*> decode <*> decode | 90 | decodeSingleCtr2 v f = decodeListLenOf 3 *> decodeWordOf v *> pure f <*> decode <*> decode | 90 | decodeSingleCtr2 v f = decodeListLenOf 3 *> decodeWordOf v *> pure f <*> decode <*> decode | 90 | false | false | 0 | 9 | 15 | 36 | 16 | 20 | null | null |
kumasento/accelerate | Data/Array/Accelerate/AST.hs | bsd-3-clause | showPreAccOp Fold1Seg{} = "Fold1Seg" | 44 | showPreAccOp Fold1Seg{} = "Fold1Seg" | 44 | showPreAccOp Fold1Seg{} = "Fold1Seg" | 44 | false | false | 0 | 6 | 11 | 13 | 6 | 7 | null | null |
tonymorris/geo-gpx | src/Data/Geo/GPX/Type/Fix.hs | bsd-3-clause | -- | The catamorphism for @Fix@.
foldFix ::
a -- ^ The value if @none@.
-> a -- ^ The value if @twod@.
-> a -- ^ The value if @threed@.
-> a -- ^ The value if @dgps@.
-> a -- ^ The value if @pps@.
-> Fix -- ^ The value to fold.
-> a
foldFix n _ _ _ _ None = n | 273 | foldFix ::
a -- ^ The value if @none@.
-> a -- ^ The value if @twod@.
-> a -- ^ The value if @threed@.
-> a -- ^ The value if @dgps@.
-> a -- ^ The value if @pps@.
-> Fix -- ^ The value to fold.
-> a
foldFix n _ _ _ _ None = n | 240 | foldFix n _ _ _ _ None = n | 26 | true | true | 0 | 12 | 79 | 61 | 32 | 29 | null | null |
jcberentsen/haskell | tensorflow/src/TensorFlow/Session.hs | apache-2.0 | extend :: MonadIO m => SessionT m ()
extend = do
session <- Session (asks rawSession)
trace <- Session (asks tracer)
nodesToExtend <- build flushNodeBuffer
unless (null nodesToExtend) $ liftIO $ do
let graphDef = (defMessage :: GraphDef) & node .~ nodesToExtend
trace ("Session.extend " <> Builder.string8 (showMessage graphDef))
FFI.extendGraph session graphDef
-- Now that all the nodes are created, run the initializers.
initializers <- build flushInitializers
unless (null initializers) $
void $ liftIO $ FFI.run session [] [] (toNodeNames initializers)
-- | Run a subgraph 't', rendering any dependent nodes that aren't already
-- rendered, and fetch the corresponding values for 'a'. | 750 | extend :: MonadIO m => SessionT m ()
extend = do
session <- Session (asks rawSession)
trace <- Session (asks tracer)
nodesToExtend <- build flushNodeBuffer
unless (null nodesToExtend) $ liftIO $ do
let graphDef = (defMessage :: GraphDef) & node .~ nodesToExtend
trace ("Session.extend " <> Builder.string8 (showMessage graphDef))
FFI.extendGraph session graphDef
-- Now that all the nodes are created, run the initializers.
initializers <- build flushInitializers
unless (null initializers) $
void $ liftIO $ FFI.run session [] [] (toNodeNames initializers)
-- | Run a subgraph 't', rendering any dependent nodes that aren't already
-- rendered, and fetch the corresponding values for 'a'. | 750 | extend = do
session <- Session (asks rawSession)
trace <- Session (asks tracer)
nodesToExtend <- build flushNodeBuffer
unless (null nodesToExtend) $ liftIO $ do
let graphDef = (defMessage :: GraphDef) & node .~ nodesToExtend
trace ("Session.extend " <> Builder.string8 (showMessage graphDef))
FFI.extendGraph session graphDef
-- Now that all the nodes are created, run the initializers.
initializers <- build flushInitializers
unless (null initializers) $
void $ liftIO $ FFI.run session [] [] (toNodeNames initializers)
-- | Run a subgraph 't', rendering any dependent nodes that aren't already
-- rendered, and fetch the corresponding values for 'a'. | 713 | false | true | 0 | 16 | 163 | 208 | 95 | 113 | null | null |
haskell/haddock | hypsrc-test/Main.hs | bsd-2-clause | stripLinks' = stripLinksWhen $ \href -> "#local-" `isPrefixOf` href | 67 | stripLinks' = stripLinksWhen $ \href -> "#local-" `isPrefixOf` href | 67 | stripLinks' = stripLinksWhen $ \href -> "#local-" `isPrefixOf` href | 67 | false | false | 0 | 7 | 8 | 21 | 12 | 9 | null | null |
apyrgio/ganeti | test/hs/Test/Ganeti/WConfd/TempRes.hs | bsd-2-clause | prop_IPv4Reservation_serialisation :: IPv4Reservation -> Property
prop_IPv4Reservation_serialisation = testSerialisation | 120 | prop_IPv4Reservation_serialisation :: IPv4Reservation -> Property
prop_IPv4Reservation_serialisation = testSerialisation | 120 | prop_IPv4Reservation_serialisation = testSerialisation | 54 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
tismith/tlisp | write-yourself-a-scheme/listings/listing9.hs | mit | eval env (List (Atom "lambda" : DottedList params varargs : body)) =
makeVarargs varargs env params body | 108 | eval env (List (Atom "lambda" : DottedList params varargs : body)) =
makeVarargs varargs env params body | 108 | eval env (List (Atom "lambda" : DottedList params varargs : body)) =
makeVarargs varargs env params body | 108 | false | false | 0 | 11 | 20 | 45 | 21 | 24 | null | null |
hopper-lang/hazel | test/Spec.hs | bsd-3-clause | caseExample' :: Value
caseExample' = Neu caseExample | 52 | caseExample' :: Value
caseExample' = Neu caseExample | 52 | caseExample' = Neu caseExample | 30 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
AlexanderPankiv/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | timesInteger_RDR = nameRdrName timesIntegerName | 54 | timesInteger_RDR = nameRdrName timesIntegerName | 54 | timesInteger_RDR = nameRdrName timesIntegerName | 54 | false | false | 0 | 5 | 10 | 9 | 4 | 5 | null | null |
mainland/nikola | src/Data/Array/Nikola/Language/Syntax.hs | bsd-3-clause | occMeet ManyBranch ManyBranch = ManyBranch | 43 | occMeet ManyBranch ManyBranch = ManyBranch | 43 | occMeet ManyBranch ManyBranch = ManyBranch | 43 | false | false | 0 | 5 | 5 | 13 | 5 | 8 | null | null |
cdepillabout/wwtw-haskell-solver | src/WWTW/SolveMaze.hs | bsd-3-clause | charToMazeElement '^' = Player | 30 | charToMazeElement '^' = Player | 30 | charToMazeElement '^' = Player | 30 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ucsd-progsys/nanomaly | bin/OcamlToJSON.hs | bsd-3-clause | inp = case parseTopForm inp of
Left e -> error e
Right ds -> LBC.unpack (encode ds) | 87 | inp = case parseTopForm inp of
Left e -> error e
Right ds -> LBC.unpack (encode ds) | 87 | inp = case parseTopForm inp of
Left e -> error e
Right ds -> LBC.unpack (encode ds) | 87 | false | false | 1 | 10 | 20 | 48 | 20 | 28 | null | null |
bartoszw/elca | ElcaQCTestL.hs | gpl-2.0 | ratsVario = choose (100::Int,1500) | 34 | ratsVario = choose (100::Int,1500) | 34 | ratsVario = choose (100::Int,1500) | 34 | false | false | 0 | 6 | 3 | 18 | 10 | 8 | null | null |
urbanslug/ghc | testsuite/tests/gadt/T2151.hs | bsd-3-clause | test :: Type a -> a -> a
test (PF (Func _ _)) ID = ID | 53 | test :: Type a -> a -> a
test (PF (Func _ _)) ID = ID | 53 | test (PF (Func _ _)) ID = ID | 28 | false | true | 0 | 12 | 15 | 47 | 21 | 26 | null | null |
LambdaHack/LambdaHack | engine-src/Game/LambdaHack/Client/UI/Frontend/ANSI.hs | bsd-3-clause | -- | Starts the main program loop using the frontend input and output.
startup :: ScreenContent -> IO RawFrontend
startup coscreen@ScreenContent{rwidth, rheight} = do
ANSI.clearScreen
myx <- ANSI.getTerminalSize
case myx of
Just (y, x) | x < rwidth || y < rheight ->
-- Unlike @error@, @die@ does not move savefiles aside.
die $ T.unpack $
"The terminal is too small. It should have"
<+> tshow rwidth
<+> "columns and"
<+> tshow rheight
<+> "rows, but is has"
<+> tshow x
<+> "columns and"
<+> tshow y
<+> "rows. Resize it and run the program again."
_ -> do
rf <- createRawFrontend coscreen (display coscreen) (shutdown coscreen)
let storeKeys :: IO ()
storeKeys = do
c <- SIO.getChar -- blocks here, so no polling
s <- do
if c == '\ESC' then do
ready <- SIO.hReady SIO.stdin
if ready then do
c2 <- SIO.getChar
case c2 of
'\ESC' -> return [c]
'[' -> keycodeInput [c, c2]
'O' -> keycodeInput [c, c2]
_ -> return [c, c2] -- Alt modifier
else return [c]
else return [c]
let K.KM{..} = keyTranslate s
saveKMP rf modifier key (PointUI 0 0)
storeKeys
keycodeInput :: String -> IO String
keycodeInput inputSoFar = do
ready <- SIO.hReady SIO.stdin
if ready then do
c <- SIO.getChar
if ord '@' <= ord c && ord c <= ord '~' -- terminator
then return $ inputSoFar ++ [c]
else keycodeInput $ inputSoFar ++ [c]
else return inputSoFar
SIO.hSetBuffering SIO.stdin SIO.NoBuffering
SIO.hSetBuffering SIO.stderr $ SIO.BlockBuffering $
Just $ 2 * rwidth * rheight
void $ async storeKeys
return $! rf
-- This is contrived, because we don't want to depend on libraries
-- that read and interpret terminfo or similar on different architectures.
-- The "works" comments are mostly about Gnome terminal.
-- On the Gnome terminal, fo the keys mention on game help screen,
-- the following don't work: C-TAB, C-S-TAB, C-R, C-?. C-/, C-{, C-}, C-q,
-- C-S, C-P, C-keypad. This is acceptable. No worth adding functionality
-- for decoding modifiers that would, with much luck, enable C-keypad,
-- but no other broken keys. Unless more is broken on other terminals.
-- On rxvt, sadly, KP_5 is a dead key. | 2,597 | startup :: ScreenContent -> IO RawFrontend
startup coscreen@ScreenContent{rwidth, rheight} = do
ANSI.clearScreen
myx <- ANSI.getTerminalSize
case myx of
Just (y, x) | x < rwidth || y < rheight ->
-- Unlike @error@, @die@ does not move savefiles aside.
die $ T.unpack $
"The terminal is too small. It should have"
<+> tshow rwidth
<+> "columns and"
<+> tshow rheight
<+> "rows, but is has"
<+> tshow x
<+> "columns and"
<+> tshow y
<+> "rows. Resize it and run the program again."
_ -> do
rf <- createRawFrontend coscreen (display coscreen) (shutdown coscreen)
let storeKeys :: IO ()
storeKeys = do
c <- SIO.getChar -- blocks here, so no polling
s <- do
if c == '\ESC' then do
ready <- SIO.hReady SIO.stdin
if ready then do
c2 <- SIO.getChar
case c2 of
'\ESC' -> return [c]
'[' -> keycodeInput [c, c2]
'O' -> keycodeInput [c, c2]
_ -> return [c, c2] -- Alt modifier
else return [c]
else return [c]
let K.KM{..} = keyTranslate s
saveKMP rf modifier key (PointUI 0 0)
storeKeys
keycodeInput :: String -> IO String
keycodeInput inputSoFar = do
ready <- SIO.hReady SIO.stdin
if ready then do
c <- SIO.getChar
if ord '@' <= ord c && ord c <= ord '~' -- terminator
then return $ inputSoFar ++ [c]
else keycodeInput $ inputSoFar ++ [c]
else return inputSoFar
SIO.hSetBuffering SIO.stdin SIO.NoBuffering
SIO.hSetBuffering SIO.stderr $ SIO.BlockBuffering $
Just $ 2 * rwidth * rheight
void $ async storeKeys
return $! rf
-- This is contrived, because we don't want to depend on libraries
-- that read and interpret terminfo or similar on different architectures.
-- The "works" comments are mostly about Gnome terminal.
-- On the Gnome terminal, fo the keys mention on game help screen,
-- the following don't work: C-TAB, C-S-TAB, C-R, C-?. C-/, C-{, C-}, C-q,
-- C-S, C-P, C-keypad. This is acceptable. No worth adding functionality
-- for decoding modifiers that would, with much luck, enable C-keypad,
-- but no other broken keys. Unless more is broken on other terminals.
-- On rxvt, sadly, KP_5 is a dead key. | 2,526 | startup coscreen@ScreenContent{rwidth, rheight} = do
ANSI.clearScreen
myx <- ANSI.getTerminalSize
case myx of
Just (y, x) | x < rwidth || y < rheight ->
-- Unlike @error@, @die@ does not move savefiles aside.
die $ T.unpack $
"The terminal is too small. It should have"
<+> tshow rwidth
<+> "columns and"
<+> tshow rheight
<+> "rows, but is has"
<+> tshow x
<+> "columns and"
<+> tshow y
<+> "rows. Resize it and run the program again."
_ -> do
rf <- createRawFrontend coscreen (display coscreen) (shutdown coscreen)
let storeKeys :: IO ()
storeKeys = do
c <- SIO.getChar -- blocks here, so no polling
s <- do
if c == '\ESC' then do
ready <- SIO.hReady SIO.stdin
if ready then do
c2 <- SIO.getChar
case c2 of
'\ESC' -> return [c]
'[' -> keycodeInput [c, c2]
'O' -> keycodeInput [c, c2]
_ -> return [c, c2] -- Alt modifier
else return [c]
else return [c]
let K.KM{..} = keyTranslate s
saveKMP rf modifier key (PointUI 0 0)
storeKeys
keycodeInput :: String -> IO String
keycodeInput inputSoFar = do
ready <- SIO.hReady SIO.stdin
if ready then do
c <- SIO.getChar
if ord '@' <= ord c && ord c <= ord '~' -- terminator
then return $ inputSoFar ++ [c]
else keycodeInput $ inputSoFar ++ [c]
else return inputSoFar
SIO.hSetBuffering SIO.stdin SIO.NoBuffering
SIO.hSetBuffering SIO.stderr $ SIO.BlockBuffering $
Just $ 2 * rwidth * rheight
void $ async storeKeys
return $! rf
-- This is contrived, because we don't want to depend on libraries
-- that read and interpret terminfo or similar on different architectures.
-- The "works" comments are mostly about Gnome terminal.
-- On the Gnome terminal, fo the keys mention on game help screen,
-- the following don't work: C-TAB, C-S-TAB, C-R, C-?. C-/, C-{, C-}, C-q,
-- C-S, C-P, C-keypad. This is acceptable. No worth adding functionality
-- for decoding modifiers that would, with much luck, enable C-keypad,
-- but no other broken keys. Unless more is broken on other terminals.
-- On rxvt, sadly, KP_5 is a dead key. | 2,483 | true | true | 13 | 20 | 882 | 558 | 279 | 279 | null | null |
mrakgr/futhark | src/Futhark/CodeGen/Backends/SimpleRepresentation.hs | bsd-3-clause | intTypeToCType :: IntType -> C.Type
intTypeToCType Int8 = [C.cty|typename int8_t|] | 82 | intTypeToCType :: IntType -> C.Type
intTypeToCType Int8 = [C.cty|typename int8_t|] | 82 | intTypeToCType Int8 = [C.cty|typename int8_t|] | 46 | false | true | 0 | 8 | 9 | 32 | 16 | 16 | null | null |
eklavya/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | -- | Lift a term into its Language.Reflection.TT representation
reflect :: Term -> Raw
reflect = reflectTTQuote [] | 114 | reflect :: Term -> Raw
reflect = reflectTTQuote [] | 50 | reflect = reflectTTQuote [] | 27 | true | true | 0 | 6 | 17 | 21 | 11 | 10 | null | null |
laurencer/confluence-sync | vendor/haxr/PrettyNoMin.hs | bsd-3-clause | reference :: Reference -> MBuilder
reference (RefEntity er) = entityref er | 80 | reference :: Reference -> MBuilder
reference (RefEntity er) = entityref er | 80 | reference (RefEntity er) = entityref er | 45 | false | true | 0 | 9 | 16 | 32 | 14 | 18 | null | null |
quchen/prettyprinter | prettyprinter-compat-ansi-wl-pprint/src/Text/PrettyPrint/ANSI/Leijen.hs | bsd-2-clause | linebreak :: Doc
linebreak = New.flatAlt New.line mempty | 56 | linebreak :: Doc
linebreak = New.flatAlt New.line mempty | 56 | linebreak = New.flatAlt New.line mempty | 39 | false | true | 0 | 6 | 7 | 26 | 11 | 15 | null | null |
mfolnovic/puh-hash | Parsing/HashParser.hs | gpl-2.0 | -- Parses assignment.
assign :: Parser Cmd
assign = do
name <- Str <$> identifier
_ <- lexeme $ char '='
value <- expr
_ <- empty
return $ Assign name value
-- Parses command. | 186 | assign :: Parser Cmd
assign = do
name <- Str <$> identifier
_ <- lexeme $ char '='
value <- expr
_ <- empty
return $ Assign name value
-- Parses command. | 164 | assign = do
name <- Str <$> identifier
_ <- lexeme $ char '='
value <- expr
_ <- empty
return $ Assign name value
-- Parses command. | 143 | true | true | 0 | 10 | 45 | 73 | 32 | 41 | null | null |
GaloisInc/saw-script | saw-core/src/Verifier/SAW/Prim.hs | bsd-3-clause | bvShiftL ::
Bool {- ^ bit value to shift in -} ->
BitVector {- ^ value to shift -} ->
Integer {- ^ amount to shift by -} ->
BitVector
bvShiftL c (BV w x) i = bv w ((x `shiftL` j) .|. c')
where c' = if c then (1 `shiftL` j) - 1 else 0
j = fromInteger (i `min` toInteger w) | 289 | bvShiftL ::
Bool {- ^ bit value to shift in -} ->
BitVector {- ^ value to shift -} ->
Integer {- ^ amount to shift by -} ->
BitVector
bvShiftL c (BV w x) i = bv w ((x `shiftL` j) .|. c')
where c' = if c then (1 `shiftL` j) - 1 else 0
j = fromInteger (i `min` toInteger w) | 289 | bvShiftL c (BV w x) i = bv w ((x `shiftL` j) .|. c')
where c' = if c then (1 `shiftL` j) - 1 else 0
j = fromInteger (i `min` toInteger w) | 147 | false | true | 0 | 11 | 81 | 116 | 63 | 53 | null | null |
DougBurke/swish | tests/RDFDatatypeXsdIntegerTest.hs | lgpl-2.1 | dmodXsdIntegerGt = xsdIntName "gt" | 38 | dmodXsdIntegerGt = xsdIntName "gt" | 38 | dmodXsdIntegerGt = xsdIntName "gt" | 38 | false | false | 0 | 5 | 7 | 9 | 4 | 5 | null | null |
ssaavedra/liquidhaskell | src/Language/Haskell/Liquid/GHC/Misc.hs | bsd-3-clause | takeModuleNames = mungeNames initName sepModNames "takeModuleNames: "
where
initName msg = symbol . T.intercalate "." . safeInit msg | 139 | takeModuleNames = mungeNames initName sepModNames "takeModuleNames: "
where
initName msg = symbol . T.intercalate "." . safeInit msg | 139 | takeModuleNames = mungeNames initName sepModNames "takeModuleNames: "
where
initName msg = symbol . T.intercalate "." . safeInit msg | 139 | false | false | 0 | 8 | 24 | 39 | 18 | 21 | null | null |
jwoudenberg/elm-editor-tools | src/ElmTools/FindDefinition.hs | bsd-3-clause | parseElmModule' :: FilePath -> App [Declaration]
parseElmModule' filePath =
ExceptT $ do
parseResult <- ParseModule.elmParser filePath
return $ mapLeft toError parseResult
where
toError = CouldNotParseElmModule filePath . show
-- TODO: implement this | 267 | parseElmModule' :: FilePath -> App [Declaration]
parseElmModule' filePath =
ExceptT $ do
parseResult <- ParseModule.elmParser filePath
return $ mapLeft toError parseResult
where
toError = CouldNotParseElmModule filePath . show
-- TODO: implement this | 267 | parseElmModule' filePath =
ExceptT $ do
parseResult <- ParseModule.elmParser filePath
return $ mapLeft toError parseResult
where
toError = CouldNotParseElmModule filePath . show
-- TODO: implement this | 218 | false | true | 3 | 9 | 48 | 76 | 33 | 43 | null | null |
jeden-universe/jeden-compiler | tools/alonzo/src/Phase2.hs | mit | phase2 :: Module -> Either String Globals
phase2 (Module modName stmts) = go empty stmts
where
go :: Map Global Meaning -> [Statement] -> Either String Globals
go globals (TypeDef (Symbol (pos,ident)) typ : stmts) =
case lookup ident globals of
Nothing ->
go (insert ident (MTypeDef typ pos) globals) stmts
go globals (TermDecl (Symbol (pos,ident)) typ : stmts) =
case lookup ident globals of
Nothing ->
go (insert ident (MTypeDef typ pos) globals) stmts
go globals (TermDef (Symbol (pos,ident)) trm : stmts) =
case lookup ident globals of
Just (MTypeDef typ _) ->
go (insert ident (MTermDef typ trm pos) globals) stmts
Nothing ->
Left $ shows pos . showString ":\n"
. showString " Term defined but not declared\n"
$ ""
go globals [] = Right (Globals globals) | 1,040 | phase2 :: Module -> Either String Globals
phase2 (Module modName stmts) = go empty stmts
where
go :: Map Global Meaning -> [Statement] -> Either String Globals
go globals (TypeDef (Symbol (pos,ident)) typ : stmts) =
case lookup ident globals of
Nothing ->
go (insert ident (MTypeDef typ pos) globals) stmts
go globals (TermDecl (Symbol (pos,ident)) typ : stmts) =
case lookup ident globals of
Nothing ->
go (insert ident (MTypeDef typ pos) globals) stmts
go globals (TermDef (Symbol (pos,ident)) trm : stmts) =
case lookup ident globals of
Just (MTypeDef typ _) ->
go (insert ident (MTermDef typ trm pos) globals) stmts
Nothing ->
Left $ shows pos . showString ":\n"
. showString " Term defined but not declared\n"
$ ""
go globals [] = Right (Globals globals) | 1,040 | phase2 (Module modName stmts) = go empty stmts
where
go :: Map Global Meaning -> [Statement] -> Either String Globals
go globals (TypeDef (Symbol (pos,ident)) typ : stmts) =
case lookup ident globals of
Nothing ->
go (insert ident (MTypeDef typ pos) globals) stmts
go globals (TermDecl (Symbol (pos,ident)) typ : stmts) =
case lookup ident globals of
Nothing ->
go (insert ident (MTypeDef typ pos) globals) stmts
go globals (TermDef (Symbol (pos,ident)) trm : stmts) =
case lookup ident globals of
Just (MTypeDef typ _) ->
go (insert ident (MTermDef typ trm pos) globals) stmts
Nothing ->
Left $ shows pos . showString ":\n"
. showString " Term defined but not declared\n"
$ ""
go globals [] = Right (Globals globals) | 998 | false | true | 0 | 14 | 409 | 345 | 169 | 176 | null | null |
YoshikuniJujo/xml-pipe | others/fromFile.hs | bsd-3-clause | printP :: Show a => Pipe a () IO ()
printP = do
mx <- await
case mx of
Just x -> lift (print x) >> printP
_ -> return () | 126 | printP :: Show a => Pipe a () IO ()
printP = do
mx <- await
case mx of
Just x -> lift (print x) >> printP
_ -> return () | 126 | printP = do
mx <- await
case mx of
Just x -> lift (print x) >> printP
_ -> return () | 90 | false | true | 0 | 13 | 36 | 78 | 36 | 42 | null | null |
keera-studios/hsQt | Qtc/Gui/QStyleOptionMenuItem.hs | bsd-2-clause | qStyleOptionMenuItem_delete :: QStyleOptionMenuItem a -> IO ()
qStyleOptionMenuItem_delete x0
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QStyleOptionMenuItem_delete cobj_x0 | 172 | qStyleOptionMenuItem_delete :: QStyleOptionMenuItem a -> IO ()
qStyleOptionMenuItem_delete x0
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QStyleOptionMenuItem_delete cobj_x0 | 172 | qStyleOptionMenuItem_delete x0
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QStyleOptionMenuItem_delete cobj_x0 | 109 | false | true | 2 | 7 | 22 | 42 | 19 | 23 | null | null |
kazu-yamamoto/domain-auth | Network/DomainAuth/SPF/Eval.hs | bsd-3-clause | evalspf :: IORef Int -> Limit -> IP -> [IO SpfSeq] -> IO (Maybe DAResult)
evalspf _ _ _ [] = return (Just DANeutral) | 116 | evalspf :: IORef Int -> Limit -> IP -> [IO SpfSeq] -> IO (Maybe DAResult)
evalspf _ _ _ [] = return (Just DANeutral) | 116 | evalspf _ _ _ [] = return (Just DANeutral) | 42 | false | true | 0 | 11 | 23 | 65 | 31 | 34 | null | null |
brodyberg/Notes | FindingSuccessAndFailure/leetspeak.hs | mit | translateWord word = map substituteChar word | 44 | translateWord word = map substituteChar word | 44 | translateWord word = map substituteChar word | 44 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
kosmoskatten/synthetic-web | test/TestSuite/Server.hs | mit | get :: Url -> [Header] -> IO Reply
get = op GET emptyBody | 57 | get :: Url -> [Header] -> IO Reply
get = op GET emptyBody | 57 | get = op GET emptyBody | 22 | false | true | 0 | 7 | 12 | 30 | 15 | 15 | null | null |
advancedtelematic/quickcheck-state-machine-model | src/Test/StateMachine/BoxDrawer.hs | bsd-3-clause | toEvent ((_e, Pid 2):_evT) (_xs , []) = error "toEvent: no input from pid 2" | 78 | toEvent ((_e, Pid 2):_evT) (_xs , []) = error "toEvent: no input from pid 2" | 78 | toEvent ((_e, Pid 2):_evT) (_xs , []) = error "toEvent: no input from pid 2" | 78 | false | false | 0 | 9 | 16 | 38 | 20 | 18 | null | null |
FranklinChen/IHaskell | ipython-kernel/src/IHaskell/IPython/Types.hs | mit | -- | Get the reply message type for a request message type.
replyType :: MessageType -> Maybe MessageType
replyType KernelInfoRequestMessage = Just KernelInfoReplyMessage | 170 | replyType :: MessageType -> Maybe MessageType
replyType KernelInfoRequestMessage = Just KernelInfoReplyMessage | 110 | replyType KernelInfoRequestMessage = Just KernelInfoReplyMessage | 64 | true | true | 0 | 6 | 22 | 25 | 12 | 13 | null | null |
FranklinChen/hugs98-plus-Sep2006 | packages/fgl/Data/Graph/Inductive/Query/DFS.hs | bsd-3-clause | xdfsWith _ _ _ g | isEmpty g = [] | 38 | xdfsWith _ _ _ g | isEmpty g = [] | 38 | xdfsWith _ _ _ g | isEmpty g = [] | 38 | false | false | 1 | 8 | 14 | 24 | 9 | 15 | null | null |
revnull/crashboard | src/App.hs | gpl-2.0 | newPostHandler :: Handler App App ()
newPostHandler = method POST $ do
user' <- fmap TE.decodeUtf8 <$> getPostParam "name"
body' <- fmap TE.decodeUtf8 <$> getPostParam "body"
case (user', body', fmap T.length user') of
(Just _, Just body, Just 0) -> void $ with db $ addPost "anonymouse\x1F42D" body
(Just user, Just body, _) -> do
with db $ addPost user body
setUser user
_ -> return ()
redirect "/#bottom" | 471 | newPostHandler :: Handler App App ()
newPostHandler = method POST $ do
user' <- fmap TE.decodeUtf8 <$> getPostParam "name"
body' <- fmap TE.decodeUtf8 <$> getPostParam "body"
case (user', body', fmap T.length user') of
(Just _, Just body, Just 0) -> void $ with db $ addPost "anonymouse\x1F42D" body
(Just user, Just body, _) -> do
with db $ addPost user body
setUser user
_ -> return ()
redirect "/#bottom" | 471 | newPostHandler = method POST $ do
user' <- fmap TE.decodeUtf8 <$> getPostParam "name"
body' <- fmap TE.decodeUtf8 <$> getPostParam "body"
case (user', body', fmap T.length user') of
(Just _, Just body, Just 0) -> void $ with db $ addPost "anonymouse\x1F42D" body
(Just user, Just body, _) -> do
with db $ addPost user body
setUser user
_ -> return ()
redirect "/#bottom" | 434 | false | true | 2 | 14 | 132 | 194 | 87 | 107 | null | null |
onponomarev/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | defaultConfdPort :: Int
defaultConfdPort = 1814 | 47 | defaultConfdPort :: Int
defaultConfdPort = 1814 | 47 | defaultConfdPort = 1814 | 23 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
byorgey/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | ideslaveProcess fn (SetOpt ShowImpl) = do process fn (SetOpt ShowImpl)
iResult "" | 123 | ideslaveProcess fn (SetOpt ShowImpl) = do process fn (SetOpt ShowImpl)
iResult "" | 123 | ideslaveProcess fn (SetOpt ShowImpl) = do process fn (SetOpt ShowImpl)
iResult "" | 123 | false | false | 0 | 9 | 53 | 37 | 16 | 21 | null | null |
Mathnerd314/atomo | src/Atomo/Environment.hs | bsd-3-clause | targets' is (PExpr _) = return [idExpression is] | 48 | targets' is (PExpr _) = return [idExpression is] | 48 | targets' is (PExpr _) = return [idExpression is] | 48 | false | false | 0 | 7 | 7 | 28 | 12 | 16 | null | null |
pparkkin/eta | compiler/ETA/CodeGen/Prim.hs | bsd-3-clause | inlinePrimCall :: String -> [(FieldType, Code)] -> Code
inlinePrimCall name = error $ "inlinePrimCall: unimplemented = " ++ name | 128 | inlinePrimCall :: String -> [(FieldType, Code)] -> Code
inlinePrimCall name = error $ "inlinePrimCall: unimplemented = " ++ name | 128 | inlinePrimCall name = error $ "inlinePrimCall: unimplemented = " ++ name | 72 | false | true | 0 | 8 | 18 | 39 | 21 | 18 | null | null |
andregr/bot | lib/Bot/Action/StopWatch.hs | bsd-3-clause | stopWatch :: IO a -> IO (a, ElapsedTime)
stopWatch = undefined | 62 | stopWatch :: IO a -> IO (a, ElapsedTime)
stopWatch = undefined | 62 | stopWatch = undefined | 21 | false | true | 0 | 8 | 10 | 33 | 15 | 18 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.