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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ChShersh/rogue-lang | src/Rogue/LLVM/Codegen.hs | bsd-3-clause | modifyBlock :: BlockState -> Codegen ()
modifyBlock new = do
active <- gets currentBlock
modify $ \s -> s { blocks = Map.insert active new (blocks s) } | 159 | modifyBlock :: BlockState -> Codegen ()
modifyBlock new = do
active <- gets currentBlock
modify $ \s -> s { blocks = Map.insert active new (blocks s) } | 159 | modifyBlock new = do
active <- gets currentBlock
modify $ \s -> s { blocks = Map.insert active new (blocks s) } | 119 | false | true | 0 | 14 | 35 | 73 | 34 | 39 | null | null |
erantapaa/haskellnews | src/Text/Links.hs | bsd-3-clause | tests :: Test
tests = TestList $ map testify
[("empty","",[])
,("just text","abc",[Right "abc"])
,("just link","http://abc",[Left (uri "http://abc")])
,("link start","http://abc foobar",[Left (uri "http://abc"),Right " foobar"])
,("link end","foobar http://abc",[Right "foobar ",Left (uri "http://abc")])
,("link mid","foobar http://abc zot",[Right "foobar ",Left (uri "http://abc"),Right " zot"])
,("has http","http http://abc zot",[Right "http ",Left (uri "http://abc"),Right " zot"])
,("has http (2)","foo http http://abc zot",[Right "foo http ",Left (uri "http://abc"),Right " zot"])
,("non-uri char","foo \"http://abc\" zot",[Right "foo \"",Left (uri "http://abc"),Right "\" zot"])
,("non-uri char (2)","foo <http://abc> zot",[Right "foo <",Left (uri "http://abc"),Right "> zot"])
]
where uri = fromJust . parseURI
testify (label,param,expected) = TestCase (assertEqual label (explodeLinks param) expected) | 944 | tests :: Test
tests = TestList $ map testify
[("empty","",[])
,("just text","abc",[Right "abc"])
,("just link","http://abc",[Left (uri "http://abc")])
,("link start","http://abc foobar",[Left (uri "http://abc"),Right " foobar"])
,("link end","foobar http://abc",[Right "foobar ",Left (uri "http://abc")])
,("link mid","foobar http://abc zot",[Right "foobar ",Left (uri "http://abc"),Right " zot"])
,("has http","http http://abc zot",[Right "http ",Left (uri "http://abc"),Right " zot"])
,("has http (2)","foo http http://abc zot",[Right "foo http ",Left (uri "http://abc"),Right " zot"])
,("non-uri char","foo \"http://abc\" zot",[Right "foo \"",Left (uri "http://abc"),Right "\" zot"])
,("non-uri char (2)","foo <http://abc> zot",[Right "foo <",Left (uri "http://abc"),Right "> zot"])
]
where uri = fromJust . parseURI
testify (label,param,expected) = TestCase (assertEqual label (explodeLinks param) expected) | 944 | tests = TestList $ map testify
[("empty","",[])
,("just text","abc",[Right "abc"])
,("just link","http://abc",[Left (uri "http://abc")])
,("link start","http://abc foobar",[Left (uri "http://abc"),Right " foobar"])
,("link end","foobar http://abc",[Right "foobar ",Left (uri "http://abc")])
,("link mid","foobar http://abc zot",[Right "foobar ",Left (uri "http://abc"),Right " zot"])
,("has http","http http://abc zot",[Right "http ",Left (uri "http://abc"),Right " zot"])
,("has http (2)","foo http http://abc zot",[Right "foo http ",Left (uri "http://abc"),Right " zot"])
,("non-uri char","foo \"http://abc\" zot",[Right "foo \"",Left (uri "http://abc"),Right "\" zot"])
,("non-uri char (2)","foo <http://abc> zot",[Right "foo <",Left (uri "http://abc"),Right "> zot"])
]
where uri = fromJust . parseURI
testify (label,param,expected) = TestCase (assertEqual label (explodeLinks param) expected) | 930 | false | true | 4 | 10 | 133 | 377 | 204 | 173 | null | null |
fmthoma/ghc | compiler/main/DynFlags.hs | bsd-3-clause | isOneShot _other = False | 25 | isOneShot _other = False | 25 | isOneShot _other = False | 25 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
abstools/habs | src/ABS/Compiler/Codegen/StmExp.hs | bsd-3-clause | tStmExp (ABS.EMod l r) = do
(e1,t1) <- tStmExp l
(e2,t2) <- tStmExp r
let declaredArgs = [ABS.TSimple $ ABS.U_ $ ABS.U ((0,0),"Rat"), ABS.TSimple $ ABS.U_ $ ABS.U ((0,0),"Rat")]
[ue1,ue2] = mUpMany declaredArgs [t1,t2] [e1,e2]
pure ([hs|((%) <$!> $ue1 <*> $ue2)|], ABS.TSimple $ ABS.U_ $ ABS.U ((0,0),"Int")) | 324 | tStmExp (ABS.EMod l r) = do
(e1,t1) <- tStmExp l
(e2,t2) <- tStmExp r
let declaredArgs = [ABS.TSimple $ ABS.U_ $ ABS.U ((0,0),"Rat"), ABS.TSimple $ ABS.U_ $ ABS.U ((0,0),"Rat")]
[ue1,ue2] = mUpMany declaredArgs [t1,t2] [e1,e2]
pure ([hs|((%) <$!> $ue1 <*> $ue2)|], ABS.TSimple $ ABS.U_ $ ABS.U ((0,0),"Int")) | 324 | tStmExp (ABS.EMod l r) = do
(e1,t1) <- tStmExp l
(e2,t2) <- tStmExp r
let declaredArgs = [ABS.TSimple $ ABS.U_ $ ABS.U ((0,0),"Rat"), ABS.TSimple $ ABS.U_ $ ABS.U ((0,0),"Rat")]
[ue1,ue2] = mUpMany declaredArgs [t1,t2] [e1,e2]
pure ([hs|((%) <$!> $ue1 <*> $ue2)|], ABS.TSimple $ ABS.U_ $ ABS.U ((0,0),"Int")) | 324 | false | false | 0 | 14 | 62 | 201 | 109 | 92 | null | null |
bezirg/gpah | src/Generics/GPAH/Derive/Analyze.hs | bsd-3-clause | runDriftPP :: [Comment] -> M.Map String Int
runDriftPP cs = foldl (\ m r -> M.insertWith (+) r 1 m) mempty $ concatMap (\ (Comment _ _ s) -> case execParser pDriftPP s of
(res, []) -> res
_ -> [] -- error in parsing
) cs | 503 | runDriftPP :: [Comment] -> M.Map String Int
runDriftPP cs = foldl (\ m r -> M.insertWith (+) r 1 m) mempty $ concatMap (\ (Comment _ _ s) -> case execParser pDriftPP s of
(res, []) -> res
_ -> [] -- error in parsing
) cs | 503 | runDriftPP cs = foldl (\ m r -> M.insertWith (+) r 1 m) mempty $ concatMap (\ (Comment _ _ s) -> case execParser pDriftPP s of
(res, []) -> res
_ -> [] -- error in parsing
) cs | 459 | false | true | 0 | 13 | 329 | 120 | 61 | 59 | null | null |
mbernat/aoc16-haskell | src/Day3.hs | bsd-3-clause | triangle :: [Int] -> Bool
triangle [a,b,c] = a + b > c && b + c > a && c + a > b | 80 | triangle :: [Int] -> Bool
triangle [a,b,c] = a + b > c && b + c > a && c + a > b | 80 | triangle [a,b,c] = a + b > c && b + c > a && c + a > b | 54 | false | true | 0 | 12 | 24 | 62 | 33 | 29 | null | null |
c0c0n3/audidoza | tests/app/Html/DiffJstPage.hs | gpl-3.0 | render JstJs _ = "jstree-dist/jstree.min.js" | 44 | render JstJs _ = "jstree-dist/jstree.min.js" | 44 | render JstJs _ = "jstree-dist/jstree.min.js" | 44 | false | false | 0 | 5 | 4 | 13 | 5 | 8 | null | null |
fmthoma/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | isTauTy (ForAllTy {}) = False | 33 | isTauTy (ForAllTy {}) = False | 33 | isTauTy (ForAllTy {}) = False | 33 | false | false | 0 | 7 | 8 | 16 | 8 | 8 | null | null |
edsko/cabal | cabal-install/Distribution/Client/Setup.hs | bsd-3-clause | configureExCommand :: CommandUI (ConfigFlags, ConfigExFlags)
configureExCommand = configureCommand {
commandDefaultFlags = (mempty, defaultConfigExFlags),
commandOptions = \showOrParseArgs ->
liftOptions fst setFst
(filter ((`notElem` ["constraint", "dependency", "exact-configuration"])
. optionName) $ configureOptions showOrParseArgs)
++ liftOptions snd setSnd
(configureExOptions showOrParseArgs ConstraintSourceCommandlineFlag)
}
where
setFst a (_,b) = (a,b)
setSnd b (a,_) = (a,b) | 563 | configureExCommand :: CommandUI (ConfigFlags, ConfigExFlags)
configureExCommand = configureCommand {
commandDefaultFlags = (mempty, defaultConfigExFlags),
commandOptions = \showOrParseArgs ->
liftOptions fst setFst
(filter ((`notElem` ["constraint", "dependency", "exact-configuration"])
. optionName) $ configureOptions showOrParseArgs)
++ liftOptions snd setSnd
(configureExOptions showOrParseArgs ConstraintSourceCommandlineFlag)
}
where
setFst a (_,b) = (a,b)
setSnd b (a,_) = (a,b) | 563 | configureExCommand = configureCommand {
commandDefaultFlags = (mempty, defaultConfigExFlags),
commandOptions = \showOrParseArgs ->
liftOptions fst setFst
(filter ((`notElem` ["constraint", "dependency", "exact-configuration"])
. optionName) $ configureOptions showOrParseArgs)
++ liftOptions snd setSnd
(configureExOptions showOrParseArgs ConstraintSourceCommandlineFlag)
}
where
setFst a (_,b) = (a,b)
setSnd b (a,_) = (a,b) | 502 | false | true | 0 | 16 | 125 | 153 | 87 | 66 | null | null |
juhp/stackage-query | Main.hs | mit | getConfigDir :: IO FilePath
getConfigDir = do
home <- getHomeDirectory
let confdir = home </> ".stackage-query"
createDirectoryIfMissing False confdir
return confdir | 173 | getConfigDir :: IO FilePath
getConfigDir = do
home <- getHomeDirectory
let confdir = home </> ".stackage-query"
createDirectoryIfMissing False confdir
return confdir | 173 | getConfigDir = do
home <- getHomeDirectory
let confdir = home </> ".stackage-query"
createDirectoryIfMissing False confdir
return confdir | 145 | false | true | 0 | 11 | 28 | 54 | 22 | 32 | null | null |
FranklinChen/hugs98-plus-Sep2006 | packages/HaXml/src/Text/XML/HaXml/Html/Parse.hs | bsd-3-clause | "form" `closes` "form" = True | 35 | "form" `closes` "form" = True | 35 | "form" `closes` "form" = True | 35 | false | false | 0 | 5 | 10 | 14 | 7 | 7 | null | null |
ys-nuem/project-euler | 001/001.hs | mit | problem1 = sum [x | x <- [1..999], x `mod` 3 == 0 || x `mod` 5 == 0] | 68 | problem1 = sum [x | x <- [1..999], x `mod` 3 == 0 || x `mod` 5 == 0] | 68 | problem1 = sum [x | x <- [1..999], x `mod` 3 == 0 || x `mod` 5 == 0] | 68 | false | false | 1 | 12 | 18 | 57 | 29 | 28 | null | null |
rudymatela/llcheck | src/Test/LeanCheck/Tiers.hs | bsd-3-clause | -- | Delete the first occurence of an element in a tier.
--
-- For normalized lists-of-tiers without repetitions, the following holds:
--
-- > deleteT x = normalizeT . (`suchThat` (/= x))
deleteT :: Eq a => a -> [[a]] -> [[a]]
deleteT _ [] = [] | 248 | deleteT :: Eq a => a -> [[a]] -> [[a]]
deleteT _ [] = [] | 58 | deleteT _ [] = [] | 19 | true | true | 0 | 11 | 51 | 58 | 31 | 27 | null | null |
romanb/amazonka | amazonka-ec2/gen/Network/AWS/EC2/RequestSpotInstances.hs | mpl-2.0 | -- | The Spot Instance request type.
--
-- Default: 'one-time'
rsiType :: Lens' RequestSpotInstances (Maybe SpotInstanceType)
rsiType = lens _rsiType (\s a -> s { _rsiType = a }) | 178 | rsiType :: Lens' RequestSpotInstances (Maybe SpotInstanceType)
rsiType = lens _rsiType (\s a -> s { _rsiType = a }) | 115 | rsiType = lens _rsiType (\s a -> s { _rsiType = a }) | 52 | true | true | 1 | 9 | 29 | 54 | 27 | 27 | null | null |
mvr/at | src/Math/Algebra/AbGroupPres.hs | bsd-3-clause | fromIsoClass :: IsoClass -> AbGroupPres
fromIsoClass (IsoClass 0 []) = zero | 75 | fromIsoClass :: IsoClass -> AbGroupPres
fromIsoClass (IsoClass 0 []) = zero | 75 | fromIsoClass (IsoClass 0 []) = zero | 35 | false | true | 0 | 8 | 10 | 28 | 14 | 14 | null | null |
nkaretnikov/ghc | compiler/utils/Outputable.hs | bsd-3-clause | quotedListWithOr xs = quotedList xs | 35 | quotedListWithOr xs = quotedList xs | 35 | quotedListWithOr xs = quotedList xs | 35 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
wavewave/hoodle-core | src/Hoodle/Coroutine/Dialog.hs | gpl-3.0 | --
-- |
okMessageBox :: String -> MainCoroutine ()
okMessageBox msg = modify (tempQueue %~ enqueue action)
>> waitSomeEvent (\case GotOk -> True ; _ -> False)
>> return ()
where
action = mkIOaction $
\_evhandler -> do
dialog <- messageDialogNew Nothing [DialogModal]
MessageQuestion ButtonsOk msg
_res <- dialogRun dialog
widgetDestroy dialog
return (UsrEv GotOk)
-- | | 527 | okMessageBox :: String -> MainCoroutine ()
okMessageBox msg = modify (tempQueue %~ enqueue action)
>> waitSomeEvent (\case GotOk -> True ; _ -> False)
>> return ()
where
action = mkIOaction $
\_evhandler -> do
dialog <- messageDialogNew Nothing [DialogModal]
MessageQuestion ButtonsOk msg
_res <- dialogRun dialog
widgetDestroy dialog
return (UsrEv GotOk)
-- | | 517 | okMessageBox msg = modify (tempQueue %~ enqueue action)
>> waitSomeEvent (\case GotOk -> True ; _ -> False)
>> return ()
where
action = mkIOaction $
\_evhandler -> do
dialog <- messageDialogNew Nothing [DialogModal]
MessageQuestion ButtonsOk msg
_res <- dialogRun dialog
widgetDestroy dialog
return (UsrEv GotOk)
-- | | 474 | true | true | 0 | 11 | 215 | 139 | 67 | 72 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F05.hs | bsd-3-clause | ptr_glDeletePerfMonitorsAMD :: FunPtr (GLsizei -> Ptr GLuint -> IO ())
ptr_glDeletePerfMonitorsAMD = unsafePerformIO $ getCommand "glDeletePerfMonitorsAMD" | 155 | ptr_glDeletePerfMonitorsAMD :: FunPtr (GLsizei -> Ptr GLuint -> IO ())
ptr_glDeletePerfMonitorsAMD = unsafePerformIO $ getCommand "glDeletePerfMonitorsAMD" | 155 | ptr_glDeletePerfMonitorsAMD = unsafePerformIO $ getCommand "glDeletePerfMonitorsAMD" | 84 | false | true | 0 | 10 | 15 | 40 | 19 | 21 | null | null |
Warbo/mlspec-helper | test/Main.hs | gpl-3.0 | -- We should have (at least) one generator; might as well test all of them
boolGen = oneof boolGens | 99 | boolGen = oneof boolGens | 24 | boolGen = oneof boolGens | 24 | true | false | 1 | 5 | 18 | 14 | 5 | 9 | null | null |
elbrujohalcon/hPage | src/HPage/Control.hs | bsd-3-clause | exprFromString' s i = (exprFromString s,
flip (-) 1 . length . splitOn "\n\n" $ take i s) | 113 | exprFromString' s i = (exprFromString s,
flip (-) 1 . length . splitOn "\n\n" $ take i s) | 113 | exprFromString' s i = (exprFromString s,
flip (-) 1 . length . splitOn "\n\n" $ take i s) | 113 | false | false | 1 | 10 | 41 | 52 | 23 | 29 | null | null |
mydaum/cabal | Cabal/Distribution/Simple/BuildTarget.hs | bsd-3-clause | ------------------------------
-- Various match primitives
--
matchErrorExpected, matchErrorNoSuch :: String -> String -> Match a
matchErrorExpected thing got = NoMatch 0 [MatchErrorExpected thing got] | 202 | matchErrorExpected, matchErrorNoSuch :: String -> String -> Match a
matchErrorExpected thing got = NoMatch 0 [MatchErrorExpected thing got] | 139 | matchErrorExpected thing got = NoMatch 0 [MatchErrorExpected thing got] | 71 | true | true | 0 | 7 | 24 | 45 | 24 | 21 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/types/TyCon.hs | bsd-3-clause | isNewTyCon _ = False | 54 | isNewTyCon _ = False | 54 | isNewTyCon _ = False | 54 | false | false | 0 | 5 | 37 | 9 | 4 | 5 | null | null |
mettekou/ghc | compiler/simplCore/CoreMonad.hs | bsd-3-clause | tickToTag (PostInlineUnconditionally _) = 1 | 43 | tickToTag (PostInlineUnconditionally _) = 1 | 43 | tickToTag (PostInlineUnconditionally _) = 1 | 43 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
dmjio/aeson | src/Data/Aeson/Types/FromJSON.hs | bsd-3-clause | -------------------------------------------------------------------------------
-- List functions
-------------------------------------------------------------------------------
-- | Helper function to use with 'liftParseJSON'. See 'Data.Aeson.ToJSON.listEncoding'.
listParser :: (Value -> Parser a) -> Value -> Parser [a]
listParser f (Array xs) = fmap V.toList (V.mapM f xs) | 377 | listParser :: (Value -> Parser a) -> Value -> Parser [a]
listParser f (Array xs) = fmap V.toList (V.mapM f xs) | 110 | listParser f (Array xs) = fmap V.toList (V.mapM f xs) | 53 | true | true | 0 | 8 | 36 | 67 | 35 | 32 | null | null |
siddhanathan/ghc | compiler/basicTypes/Id.hs | bsd-3-clause | setIdUnfoldingLazily :: Id -> Unfolding -> Id
setIdUnfoldingLazily id unfolding = modifyIdInfo (`setUnfoldingInfoLazily` unfolding) id | 134 | setIdUnfoldingLazily :: Id -> Unfolding -> Id
setIdUnfoldingLazily id unfolding = modifyIdInfo (`setUnfoldingInfoLazily` unfolding) id | 134 | setIdUnfoldingLazily id unfolding = modifyIdInfo (`setUnfoldingInfoLazily` unfolding) id | 88 | false | true | 0 | 6 | 14 | 35 | 19 | 16 | null | null |
chadbrewbaker/shellcheck | ShellCheck/Parser.hs | gpl-3.0 | prop_readForClause6 = isOk readForClause "for ((;;))\ndo echo $i\ndone" | 71 | prop_readForClause6 = isOk readForClause "for ((;;))\ndo echo $i\ndone" | 71 | prop_readForClause6 = isOk readForClause "for ((;;))\ndo echo $i\ndone" | 71 | false | false | 1 | 5 | 7 | 14 | 5 | 9 | null | null |
marcinmrotek/repa-linear-algebra | src/Numeric/LinearAlgebra/Repa.hs | bsd-3-clause | convSIO :: (Product t, Numeric t) => Array F DIM1 t -> Array D DIM1 t -> IO (Array F DIM1 t)
convSIO k = fmap (hv2repa . H.conv (repa2hv k)) . repa2hvSIO | 153 | convSIO :: (Product t, Numeric t) => Array F DIM1 t -> Array D DIM1 t -> IO (Array F DIM1 t)
convSIO k = fmap (hv2repa . H.conv (repa2hv k)) . repa2hvSIO | 153 | convSIO k = fmap (hv2repa . H.conv (repa2hv k)) . repa2hvSIO | 60 | false | true | 0 | 11 | 32 | 94 | 44 | 50 | null | null |
jgm/pandoc-citeproc | pandoc-citeproc.hs | bsd-3-clause | uchar :: Attoparsec.Parser B.ByteString
uchar = do
_ <- char '\\'
num <- (2 <$ char 'x') <|> (4 <$ char 'u') <|> (8 <$ char 'U')
cs <- count num $ satisfy $ inClass "0-9a-fA-F"
let n = read ('0':'x':cs)
return $ encodeUtf8 $ T.pack [chr n] | 249 | uchar :: Attoparsec.Parser B.ByteString
uchar = do
_ <- char '\\'
num <- (2 <$ char 'x') <|> (4 <$ char 'u') <|> (8 <$ char 'U')
cs <- count num $ satisfy $ inClass "0-9a-fA-F"
let n = read ('0':'x':cs)
return $ encodeUtf8 $ T.pack [chr n] | 249 | uchar = do
_ <- char '\\'
num <- (2 <$ char 'x') <|> (4 <$ char 'u') <|> (8 <$ char 'U')
cs <- count num $ satisfy $ inClass "0-9a-fA-F"
let n = read ('0':'x':cs)
return $ encodeUtf8 $ T.pack [chr n] | 209 | false | true | 0 | 14 | 57 | 145 | 66 | 79 | null | null |
ecaustin/haskhol-core | src/HaskHOL/Core/Kernel.hs | bsd-2-clause | termUnion l1 [] = l1 | 20 | termUnion l1 [] = l1 | 20 | termUnion l1 [] = l1 | 20 | false | false | 0 | 6 | 4 | 13 | 6 | 7 | null | null |
kmyk/proof-haskell | Data/Proof.hs | mit | foldProof :: (a -> b) -> (b -> b -> b) -> (a -> b -> b) -> Proof a -> b
foldProof f g h = rec where
rec (Proof x) = f x
rec (Apply x y) = rec x `g` rec y
rec (Lambda x y) = h x (rec y)
-- | >>> freeVars $ Proof "a" ~& Proof "b"
-- ["a","b"]
-- >>> freeVars $ Lambda "a" (Proof "a" ~& Proof "b")
-- ["b"] | 316 | foldProof :: (a -> b) -> (b -> b -> b) -> (a -> b -> b) -> Proof a -> b
foldProof f g h = rec where
rec (Proof x) = f x
rec (Apply x y) = rec x `g` rec y
rec (Lambda x y) = h x (rec y)
-- | >>> freeVars $ Proof "a" ~& Proof "b"
-- ["a","b"]
-- >>> freeVars $ Lambda "a" (Proof "a" ~& Proof "b")
-- ["b"] | 316 | foldProof f g h = rec where
rec (Proof x) = f x
rec (Apply x y) = rec x `g` rec y
rec (Lambda x y) = h x (rec y)
-- | >>> freeVars $ Proof "a" ~& Proof "b"
-- ["a","b"]
-- >>> freeVars $ Lambda "a" (Proof "a" ~& Proof "b")
-- ["b"] | 244 | false | true | 0 | 10 | 91 | 144 | 74 | 70 | null | null |
rueshyna/gogol | gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs | mpl-2.0 | -- | Etag of this resource.
lcmEtag :: Lens' LiveChatMessage (Maybe Text)
lcmEtag = lens _lcmEtag (\ s a -> s{_lcmEtag = a}) | 124 | lcmEtag :: Lens' LiveChatMessage (Maybe Text)
lcmEtag = lens _lcmEtag (\ s a -> s{_lcmEtag = a}) | 96 | lcmEtag = lens _lcmEtag (\ s a -> s{_lcmEtag = a}) | 50 | true | true | 0 | 9 | 22 | 46 | 25 | 21 | null | null |
mstksg/netwire-experiments | src/Render/Sprite.hs | gpl-3.0 | transShape t (Polygon vs f) = Polygon (map (t !*) vs) f | 55 | transShape t (Polygon vs f) = Polygon (map (t !*) vs) f | 55 | transShape t (Polygon vs f) = Polygon (map (t !*) vs) f | 55 | false | false | 0 | 8 | 11 | 38 | 18 | 20 | null | null |
nevrenato/HetsAlloy | Fpl/As.der.hs | gpl-2.0 | letTerm :: [String] -> AParser st TermExt
letTerm ks = do
l <- asKey letS
d <- funDef ks <|> letVar ks
i <- asKey inS
t <- term ks
return $ Let d t $ toRange l [] i | 174 | letTerm :: [String] -> AParser st TermExt
letTerm ks = do
l <- asKey letS
d <- funDef ks <|> letVar ks
i <- asKey inS
t <- term ks
return $ Let d t $ toRange l [] i | 174 | letTerm ks = do
l <- asKey letS
d <- funDef ks <|> letVar ks
i <- asKey inS
t <- term ks
return $ Let d t $ toRange l [] i | 132 | false | true | 0 | 9 | 49 | 98 | 43 | 55 | null | null |
joelburget/graphreduction | src/Machine/Internal/GC/MarkScan.hs | bsd-3-clause | markFromDump :: State -> State
markFromDump state = state & dump .~ newDump
& heap .~ newHeap
where (newHeap, newDump) = mapAccumLOf
(traverse.traverse) markFrom (state^.heap) (state^.dump) | 234 | markFromDump :: State -> State
markFromDump state = state & dump .~ newDump
& heap .~ newHeap
where (newHeap, newDump) = mapAccumLOf
(traverse.traverse) markFrom (state^.heap) (state^.dump) | 234 | markFromDump state = state & dump .~ newDump
& heap .~ newHeap
where (newHeap, newDump) = mapAccumLOf
(traverse.traverse) markFrom (state^.heap) (state^.dump) | 203 | false | true | 8 | 7 | 70 | 91 | 43 | 48 | null | null |
tpsinnem/Idris-dev | src/Idris/Parser/Helpers.hs | bsd-3-clause | accessibility :: IdrisParser Accessibility
accessibility = do acc <- optional accessibility'
case acc of
Just a -> return a
Nothing -> do ist <- get
return (default_access ist)
-- | Adds accessibility option for function | 326 | accessibility :: IdrisParser Accessibility
accessibility = do acc <- optional accessibility'
case acc of
Just a -> return a
Nothing -> do ist <- get
return (default_access ist)
-- | Adds accessibility option for function | 326 | accessibility = do acc <- optional accessibility'
case acc of
Just a -> return a
Nothing -> do ist <- get
return (default_access ist)
-- | Adds accessibility option for function | 283 | false | true | 1 | 16 | 140 | 74 | 31 | 43 | null | null |
rahulmutt/ghcvm | compiler/Eta/StgSyn/StgLint.hs | bsd-3-clause | lintStgAlts :: [StgAlt]
-> Type -- Type of scrutinee
-> LintM (Maybe Type) -- Just ty => type is accurage
lintStgAlts alts scrut_ty = do
maybe_result_tys <- mapM (lintAlt scrut_ty) alts
-- Check the result types
case catMaybes (maybe_result_tys) of
[] -> return Nothing
(first_ty:_tys) -> do -- mapM_ check tys
return (Just first_ty)
where
-- check ty = checkTys first_ty ty (mkCaseAltMsg alts)
-- We can't check that the alternatives have the
-- same type, because they don't, with unsafeCoerce# | 638 | lintStgAlts :: [StgAlt]
-> Type -- Type of scrutinee
-> LintM (Maybe Type)
lintStgAlts alts scrut_ty = do
maybe_result_tys <- mapM (lintAlt scrut_ty) alts
-- Check the result types
case catMaybes (maybe_result_tys) of
[] -> return Nothing
(first_ty:_tys) -> do -- mapM_ check tys
return (Just first_ty)
where
-- check ty = checkTys first_ty ty (mkCaseAltMsg alts)
-- We can't check that the alternatives have the
-- same type, because they don't, with unsafeCoerce# | 606 | lintStgAlts alts scrut_ty = do
maybe_result_tys <- mapM (lintAlt scrut_ty) alts
-- Check the result types
case catMaybes (maybe_result_tys) of
[] -> return Nothing
(first_ty:_tys) -> do -- mapM_ check tys
return (Just first_ty)
where
-- check ty = checkTys first_ty ty (mkCaseAltMsg alts)
-- We can't check that the alternatives have the
-- same type, because they don't, with unsafeCoerce# | 493 | true | true | 0 | 15 | 222 | 116 | 58 | 58 | null | null |
scturtle/2048AI | 2048st.hs | unlicense | expectVal :: Int -> Table -> State Double Double
expectVal depth t = do
res <- sequence [liftM ((,) p) $ bestMove (depth - 1) t' -- [(p, Maybe (v, m))]
| (p, t') <- genNext t]
return . sum . map (\(p, r) -> maybe 0 ((*p) . fst) r) $ res -- sum { p * v } | 295 | expectVal :: Int -> Table -> State Double Double
expectVal depth t = do
res <- sequence [liftM ((,) p) $ bestMove (depth - 1) t' -- [(p, Maybe (v, m))]
| (p, t') <- genNext t]
return . sum . map (\(p, r) -> maybe 0 ((*p) . fst) r) $ res -- sum { p * v } | 295 | expectVal depth t = do
res <- sequence [liftM ((,) p) $ bestMove (depth - 1) t' -- [(p, Maybe (v, m))]
| (p, t') <- genNext t]
return . sum . map (\(p, r) -> maybe 0 ((*p) . fst) r) $ res -- sum { p * v } | 246 | false | true | 0 | 15 | 101 | 144 | 73 | 71 | null | null |
4ZP6Capstone2015/ampersand | src/Database/Design/Ampersand/ADL1/Disambiguate.hs | gpl-3.0 | propagateConstraints :: Constraints -> Constraints -> Constraints
propagateConstraints topDown bottomUp
= Cnstr{sourceConstraintsOf = sourceConstraintsOf topDown ++ sourceConstraintsOf bottomUp
,targetConstraintsOf = targetConstraintsOf topDown ++ targetConstraintsOf bottomUp
} | 298 | propagateConstraints :: Constraints -> Constraints -> Constraints
propagateConstraints topDown bottomUp
= Cnstr{sourceConstraintsOf = sourceConstraintsOf topDown ++ sourceConstraintsOf bottomUp
,targetConstraintsOf = targetConstraintsOf topDown ++ targetConstraintsOf bottomUp
} | 298 | propagateConstraints topDown bottomUp
= Cnstr{sourceConstraintsOf = sourceConstraintsOf topDown ++ sourceConstraintsOf bottomUp
,targetConstraintsOf = targetConstraintsOf topDown ++ targetConstraintsOf bottomUp
} | 232 | false | true | 0 | 8 | 45 | 58 | 29 | 29 | null | null |
k0001/pipes-http-message | src/Pipes/HTTP/Message/Attoparsec/FastSet.hs | bsd-3-clause | fromList :: [Word8] -> FastSet
fromList = set . B.pack | 54 | fromList :: [Word8] -> FastSet
fromList = set . B.pack | 54 | fromList = set . B.pack | 23 | false | true | 0 | 6 | 9 | 24 | 13 | 11 | null | null |
ezyang/ghc | compiler/types/Kind.hs | bsd-3-clause | returnsTyCon tc_u (FunTy _ ty) = returnsTyCon tc_u ty | 57 | returnsTyCon tc_u (FunTy _ ty) = returnsTyCon tc_u ty | 57 | returnsTyCon tc_u (FunTy _ ty) = returnsTyCon tc_u ty | 57 | false | false | 0 | 7 | 12 | 24 | 11 | 13 | null | null |
joelwilliamson/validator | Maker.hs | agpl-3.0 | -- | Get the root label of the single child. If the label is a number, fail.
fetchString = Maker $ \t → case subForest t of
[] → Left (("Can't take a value at " <> show' (rootLabel t),source t), BadConversion)
[Node { rootLabel = Number n}] →
Left (("Expected string for value of "<> show' (rootLabel t) <>", got: "<> show' n
, source t)
, BadConversion)
[Node { rootLabel = Label l}] → Right l
_ → Left (("Expected a string for value of "<> show' (rootLabel t) <> ", got a block."
, source t)
, BadConversion)
-- | Get an event id from the label of the single child. This can either be of
-- the form @Number id@ or @Label $ namespace <> "." <> number@. | 713 | fetchString = Maker $ \t → case subForest t of
[] → Left (("Can't take a value at " <> show' (rootLabel t),source t), BadConversion)
[Node { rootLabel = Number n}] →
Left (("Expected string for value of "<> show' (rootLabel t) <>", got: "<> show' n
, source t)
, BadConversion)
[Node { rootLabel = Label l}] → Right l
_ → Left (("Expected a string for value of "<> show' (rootLabel t) <> ", got a block."
, source t)
, BadConversion)
-- | Get an event id from the label of the single child. This can either be of
-- the form @Number id@ or @Label $ namespace <> "." <> number@. | 636 | fetchString = Maker $ \t → case subForest t of
[] → Left (("Can't take a value at " <> show' (rootLabel t),source t), BadConversion)
[Node { rootLabel = Number n}] →
Left (("Expected string for value of "<> show' (rootLabel t) <>", got: "<> show' n
, source t)
, BadConversion)
[Node { rootLabel = Label l}] → Right l
_ → Left (("Expected a string for value of "<> show' (rootLabel t) <> ", got a block."
, source t)
, BadConversion)
-- | Get an event id from the label of the single child. This can either be of
-- the form @Number id@ or @Label $ namespace <> "." <> number@. | 636 | true | false | 0 | 18 | 190 | 192 | 99 | 93 | null | null |
jgm/pandoc-citeproc | src/Text/CSL/Eval/Common.hs | bsd-3-clause | getStringValue :: Value -> Text
getStringValue val =
-- The second clause handles the case where we have a Formatted
-- but need a String. This is currently needed for "page". It's a bit
-- hackish; we should probably change the type in Reference for
-- page to String.
case fromValue val `mplus` ((stringify . unFormatted) `fmap` fromValue val)
`mplus` (unLiteral `fmap` fromValue val) of
Just v -> v
Nothing -> Debug.Trace.trace ("Expecting string value, got " ++
show val) T.empty | 542 | getStringValue :: Value -> Text
getStringValue val =
-- The second clause handles the case where we have a Formatted
-- but need a String. This is currently needed for "page". It's a bit
-- hackish; we should probably change the type in Reference for
-- page to String.
case fromValue val `mplus` ((stringify . unFormatted) `fmap` fromValue val)
`mplus` (unLiteral `fmap` fromValue val) of
Just v -> v
Nothing -> Debug.Trace.trace ("Expecting string value, got " ++
show val) T.empty | 542 | getStringValue val =
-- The second clause handles the case where we have a Formatted
-- but need a String. This is currently needed for "page". It's a bit
-- hackish; we should probably change the type in Reference for
-- page to String.
case fromValue val `mplus` ((stringify . unFormatted) `fmap` fromValue val)
`mplus` (unLiteral `fmap` fromValue val) of
Just v -> v
Nothing -> Debug.Trace.trace ("Expecting string value, got " ++
show val) T.empty | 510 | false | true | 0 | 11 | 139 | 112 | 60 | 52 | null | null |
MichaelXavier/HTTPMock | test/Network/HTTPMock/SpecHelper.hs | bsd-2-clause | sequenceMocker :: HTTPMocker
sequenceMocker = def & responder . fakedInteractions <>~ singleton (fooMatcher, ReturnsSequence $ firstResponse !: [secondResponse])
where fooMatcher = matchPath "/foo/bar" | 203 | sequenceMocker :: HTTPMocker
sequenceMocker = def & responder . fakedInteractions <>~ singleton (fooMatcher, ReturnsSequence $ firstResponse !: [secondResponse])
where fooMatcher = matchPath "/foo/bar" | 203 | sequenceMocker = def & responder . fakedInteractions <>~ singleton (fooMatcher, ReturnsSequence $ firstResponse !: [secondResponse])
where fooMatcher = matchPath "/foo/bar" | 174 | false | true | 0 | 9 | 24 | 54 | 28 | 26 | null | null |
andorp/bead | src/Bead/Persistence/SQL/FileSystem.hs | bsd-3-clause | listFiles :: (MonadIO io) => Username -> io [(UsersFile, FileInfo)]
listFiles username = liftIO $ do
createUserFileDir username
let dirname = dirName username
privateFiles <- f (dirname </> "private-files") UsersPrivateFile
publicFiles <- f (dirname </> "public-files") UsersPublicFile
return $ privateFiles ++ publicFiles
where
f dir typ = do
paths <- getFilesInFolder dir
forM paths $ \path -> do
status <- getFileStatus path
let info = FileInfo
(fileOffsetToInt $ fileSize status)
(fileModificationInUTCTime status)
return (typ $ takeFileName path, info)
fileOffsetToInt (COff x) = fromIntegral x | 695 | listFiles :: (MonadIO io) => Username -> io [(UsersFile, FileInfo)]
listFiles username = liftIO $ do
createUserFileDir username
let dirname = dirName username
privateFiles <- f (dirname </> "private-files") UsersPrivateFile
publicFiles <- f (dirname </> "public-files") UsersPublicFile
return $ privateFiles ++ publicFiles
where
f dir typ = do
paths <- getFilesInFolder dir
forM paths $ \path -> do
status <- getFileStatus path
let info = FileInfo
(fileOffsetToInt $ fileSize status)
(fileModificationInUTCTime status)
return (typ $ takeFileName path, info)
fileOffsetToInt (COff x) = fromIntegral x | 695 | listFiles username = liftIO $ do
createUserFileDir username
let dirname = dirName username
privateFiles <- f (dirname </> "private-files") UsersPrivateFile
publicFiles <- f (dirname </> "public-files") UsersPublicFile
return $ privateFiles ++ publicFiles
where
f dir typ = do
paths <- getFilesInFolder dir
forM paths $ \path -> do
status <- getFileStatus path
let info = FileInfo
(fileOffsetToInt $ fileSize status)
(fileModificationInUTCTime status)
return (typ $ takeFileName path, info)
fileOffsetToInt (COff x) = fromIntegral x | 627 | false | true | 1 | 17 | 179 | 233 | 106 | 127 | null | null |
nevrenato/Hets_Fork | GMP/versioning/gmp-coloss-0.0.3/GMP/Prover.hs | gpl-2.0 | osatisfiable :: (SigFeature a b (c d), Eq (a (b (c d)))) => [Bool] -> [Sequent] -> Formula (a (b (c d))) -> Bool
osatisfiable flags ec phi = not (oprovable flags ec (neg phi)) | 175 | osatisfiable :: (SigFeature a b (c d), Eq (a (b (c d)))) => [Bool] -> [Sequent] -> Formula (a (b (c d))) -> Bool
osatisfiable flags ec phi = not (oprovable flags ec (neg phi)) | 175 | osatisfiable flags ec phi = not (oprovable flags ec (neg phi)) | 62 | false | true | 0 | 15 | 34 | 119 | 60 | 59 | null | null |
siddhanathan/yi | yi-core/src/Yi/UI/TabBar.hs | gpl-2.0 | tabAbbrevTitle :: T.Text -> T.Text
tabAbbrevTitle title = if isValid fp
then T.pack $ concatMap abbrev (splitPath fp)
else title
where
fp = T.unpack title
abbrev "/" = "/"
abbrev path | head path == '.' && last path == '/' = take 2 path ++ "/"
| last path == '/' = head path : "/"
| otherwise = path | 398 | tabAbbrevTitle :: T.Text -> T.Text
tabAbbrevTitle title = if isValid fp
then T.pack $ concatMap abbrev (splitPath fp)
else title
where
fp = T.unpack title
abbrev "/" = "/"
abbrev path | head path == '.' && last path == '/' = take 2 path ++ "/"
| last path == '/' = head path : "/"
| otherwise = path | 398 | tabAbbrevTitle title = if isValid fp
then T.pack $ concatMap abbrev (splitPath fp)
else title
where
fp = T.unpack title
abbrev "/" = "/"
abbrev path | head path == '.' && last path == '/' = take 2 path ++ "/"
| last path == '/' = head path : "/"
| otherwise = path | 363 | false | true | 0 | 11 | 159 | 144 | 67 | 77 | null | null |
portnov/xtt | XMonad/TimeTracker.hs | bsd-3-clause | writer :: TChan TEvent -> Handle -> IO ()
writer chan file = go Nothing
where
go lastEv = do
ev <- atomically $ readTChan chan
case ev of
Quit -> hClose file
_ -> do
when (Just ev /= lastEv) $ do
BL.hPut file $ encode ev
hFlush file
go (Just ev) | 335 | writer :: TChan TEvent -> Handle -> IO ()
writer chan file = go Nothing
where
go lastEv = do
ev <- atomically $ readTChan chan
case ev of
Quit -> hClose file
_ -> do
when (Just ev /= lastEv) $ do
BL.hPut file $ encode ev
hFlush file
go (Just ev) | 335 | writer chan file = go Nothing
where
go lastEv = do
ev <- atomically $ readTChan chan
case ev of
Quit -> hClose file
_ -> do
when (Just ev /= lastEv) $ do
BL.hPut file $ encode ev
hFlush file
go (Just ev) | 293 | false | true | 0 | 17 | 142 | 134 | 59 | 75 | null | null |
urbanslug/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | a_Pat, b_Pat, c_Pat, d_Pat, f_Pat, k_Pat, z_Pat :: LPat RdrName
a_Pat = nlVarPat a_RDR | 96 | a_Pat, b_Pat, c_Pat, d_Pat, f_Pat, k_Pat, z_Pat :: LPat RdrName
a_Pat = nlVarPat a_RDR | 96 | a_Pat = nlVarPat a_RDR | 32 | false | true | 4 | 5 | 23 | 37 | 20 | 17 | null | null |
dchagniot/threadscopeRestServer | src/Events/HECs.hs | bsd-3-clause | -----------------------------------------------------------------------------
eventIndexToTimestamp :: HECs -> Int -> Timestamp
eventIndexToTimestamp HECs{hecEventArray=arr} n =
time (ce_event (arr ! n)) | 206 | eventIndexToTimestamp :: HECs -> Int -> Timestamp
eventIndexToTimestamp HECs{hecEventArray=arr} n =
time (ce_event (arr ! n)) | 127 | eventIndexToTimestamp HECs{hecEventArray=arr} n =
time (ce_event (arr ! n)) | 77 | true | true | 1 | 9 | 19 | 57 | 27 | 30 | null | null |
supki/directory-layout | src/System/Directory/Layout/Internal.hs | bsd-3-clause | -- | Symbolic link
--
-- >>> let layout = symlink "foo" "bar"
symlink
:: String -- link's name
-> FilePath -- link's source
-> Layout ()
symlink name s = L (liftF (SL name s False defaux ())) | 199 | symlink
:: String -- link's name
-> FilePath -- link's source
-> Layout ()
symlink name s = L (liftF (SL name s False defaux ())) | 137 | symlink name s = L (liftF (SL name s False defaux ())) | 54 | true | true | 0 | 10 | 46 | 63 | 32 | 31 | null | null |
abakst/liquidhaskell | tests/neg/Books.hs | bsd-3-clause | {-@ type Discount i = {v:Int | v == discount i} @-}
---------------------------------------------------------------------------------------
-- 3. Policy: Only compute discounts for discountable customers
---------------------------------------------------------------------------------------
{-@ calculateDiscount' :: c:Customer -> i:{Int | customerGetsDiscount c i} -> Discount i @-}
calculateDiscount' c i = discount i | 422 | calculateDiscount' c i = discount i | 35 | calculateDiscount' c i = discount i | 35 | true | false | 0 | 5 | 44 | 19 | 11 | 8 | null | null |
elegios/datalang | src/CABI/EntryPoint.hs | mit | generate :: FuncSpec -> (Maybe Arg, [Arg]) -> [Definition]
generate f@FuncSpec{ definitionLocation = InLanguage } (mRet, is) = (:[]) $
GlobalDefinition $ G.functionDefaults
{ G.name = nonMangled f
, G.returnType = case mRet of
Just (Arg Direct t _ _) -> t
_ -> void
, G.returnAttributes = case mRet of
Just (Arg Direct _ (Just a) _) -> [a]
_ -> []
, G.parameters = (addRetParam parameters, False)
, G.basicBlocks = [BasicBlock (Name "conv") instrs ret]
}
where
addRetParam = case mRet of
Just (Arg Indirect t mAttr _) -> (Parameter t (UnName 0) (maybeToList mAttr) :) -- TODO: is the return argument allowed to have padding before it?
_ -> id
((parameters, ret), instrs) = run $ do
-- Construct the list of parameters
(paramOps, params) <- execWriterT . forM is $ \(Arg k t a padT) -> do
T.forM padT $ \padT' -> do
n <- freshName
writer ((), ([], [Parameter padT' n []]))
n <- freshName
let t' = if k == Indirect then ptr t else t
writer ((), ([LocalReference t' n], [Parameter t' n $ maybeToList a]))
-- Bitcast the parameters to conform to the inlang types
let (args, n, r) = (argTs f, mangled f, fromMaybe void $ retty f)
callable = ConstantOperand $ GlobalReference (FunctionType r args False) n
argOps <- forM (zip3 paramOps args is) $ \(argOp, inlangT, Arg k externT _ _) -> do
ptrOp <- case k of
Indirect -> return argOp
Direct -> do
allocaOp <- instr (ptr externT) $ Alloca externT Nothing 0 []
uinstr $ Store False allocaOp argOp Nothing 0 []
return allocaOp
castPtr <- instr (ptr inlangT) $ BitCast ptrOp (ptr inlangT) []
instr inlangT (Load False castPtr Nothing 0 [])
-- Call function, then fixup returns
(params,) <$> case (mRet, retty f) of
(Just (Arg Indirect externT _ _), Just inlangT) -> do
callOp <- instr inlangT $ Call False CC.Fast [] (Right callable) ((,[]) <$> argOps) [] []
let retPtrOp = LocalReference (ptr externT) $ UnName 0
castPtr <- instr (ptr inlangT) $ BitCast retPtrOp (ptr inlangT) []
uinstr $ Store False castPtr callOp Nothing 0 []
return . Do $ Ret Nothing []
(Just (Arg Direct externT _ _), Just inlangT) -> do
callOp <- instr inlangT $ Call False CC.Fast [] (Right callable) ((,[]) <$> argOps) [] []
allocaOp <- instr (ptr externT) $ Alloca externT Nothing 0 []
castPtr <- instr (ptr inlangT) $ BitCast allocaOp (ptr inlangT) []
uinstr $ Store False castPtr callOp Nothing 0 []
retOp <- instr externT $ Load False allocaOp Nothing 0 []
return . Do $ Ret (Just retOp) []
_ -> do
uinstr $ Call False CC.Fast [] (Right callable) ((,[]) <$> argOps) [] []
return . Do $ Ret Nothing [] | 2,988 | generate :: FuncSpec -> (Maybe Arg, [Arg]) -> [Definition]
generate f@FuncSpec{ definitionLocation = InLanguage } (mRet, is) = (:[]) $
GlobalDefinition $ G.functionDefaults
{ G.name = nonMangled f
, G.returnType = case mRet of
Just (Arg Direct t _ _) -> t
_ -> void
, G.returnAttributes = case mRet of
Just (Arg Direct _ (Just a) _) -> [a]
_ -> []
, G.parameters = (addRetParam parameters, False)
, G.basicBlocks = [BasicBlock (Name "conv") instrs ret]
}
where
addRetParam = case mRet of
Just (Arg Indirect t mAttr _) -> (Parameter t (UnName 0) (maybeToList mAttr) :) -- TODO: is the return argument allowed to have padding before it?
_ -> id
((parameters, ret), instrs) = run $ do
-- Construct the list of parameters
(paramOps, params) <- execWriterT . forM is $ \(Arg k t a padT) -> do
T.forM padT $ \padT' -> do
n <- freshName
writer ((), ([], [Parameter padT' n []]))
n <- freshName
let t' = if k == Indirect then ptr t else t
writer ((), ([LocalReference t' n], [Parameter t' n $ maybeToList a]))
-- Bitcast the parameters to conform to the inlang types
let (args, n, r) = (argTs f, mangled f, fromMaybe void $ retty f)
callable = ConstantOperand $ GlobalReference (FunctionType r args False) n
argOps <- forM (zip3 paramOps args is) $ \(argOp, inlangT, Arg k externT _ _) -> do
ptrOp <- case k of
Indirect -> return argOp
Direct -> do
allocaOp <- instr (ptr externT) $ Alloca externT Nothing 0 []
uinstr $ Store False allocaOp argOp Nothing 0 []
return allocaOp
castPtr <- instr (ptr inlangT) $ BitCast ptrOp (ptr inlangT) []
instr inlangT (Load False castPtr Nothing 0 [])
-- Call function, then fixup returns
(params,) <$> case (mRet, retty f) of
(Just (Arg Indirect externT _ _), Just inlangT) -> do
callOp <- instr inlangT $ Call False CC.Fast [] (Right callable) ((,[]) <$> argOps) [] []
let retPtrOp = LocalReference (ptr externT) $ UnName 0
castPtr <- instr (ptr inlangT) $ BitCast retPtrOp (ptr inlangT) []
uinstr $ Store False castPtr callOp Nothing 0 []
return . Do $ Ret Nothing []
(Just (Arg Direct externT _ _), Just inlangT) -> do
callOp <- instr inlangT $ Call False CC.Fast [] (Right callable) ((,[]) <$> argOps) [] []
allocaOp <- instr (ptr externT) $ Alloca externT Nothing 0 []
castPtr <- instr (ptr inlangT) $ BitCast allocaOp (ptr inlangT) []
uinstr $ Store False castPtr callOp Nothing 0 []
retOp <- instr externT $ Load False allocaOp Nothing 0 []
return . Do $ Ret (Just retOp) []
_ -> do
uinstr $ Call False CC.Fast [] (Right callable) ((,[]) <$> argOps) [] []
return . Do $ Ret Nothing [] | 2,988 | generate f@FuncSpec{ definitionLocation = InLanguage } (mRet, is) = (:[]) $
GlobalDefinition $ G.functionDefaults
{ G.name = nonMangled f
, G.returnType = case mRet of
Just (Arg Direct t _ _) -> t
_ -> void
, G.returnAttributes = case mRet of
Just (Arg Direct _ (Just a) _) -> [a]
_ -> []
, G.parameters = (addRetParam parameters, False)
, G.basicBlocks = [BasicBlock (Name "conv") instrs ret]
}
where
addRetParam = case mRet of
Just (Arg Indirect t mAttr _) -> (Parameter t (UnName 0) (maybeToList mAttr) :) -- TODO: is the return argument allowed to have padding before it?
_ -> id
((parameters, ret), instrs) = run $ do
-- Construct the list of parameters
(paramOps, params) <- execWriterT . forM is $ \(Arg k t a padT) -> do
T.forM padT $ \padT' -> do
n <- freshName
writer ((), ([], [Parameter padT' n []]))
n <- freshName
let t' = if k == Indirect then ptr t else t
writer ((), ([LocalReference t' n], [Parameter t' n $ maybeToList a]))
-- Bitcast the parameters to conform to the inlang types
let (args, n, r) = (argTs f, mangled f, fromMaybe void $ retty f)
callable = ConstantOperand $ GlobalReference (FunctionType r args False) n
argOps <- forM (zip3 paramOps args is) $ \(argOp, inlangT, Arg k externT _ _) -> do
ptrOp <- case k of
Indirect -> return argOp
Direct -> do
allocaOp <- instr (ptr externT) $ Alloca externT Nothing 0 []
uinstr $ Store False allocaOp argOp Nothing 0 []
return allocaOp
castPtr <- instr (ptr inlangT) $ BitCast ptrOp (ptr inlangT) []
instr inlangT (Load False castPtr Nothing 0 [])
-- Call function, then fixup returns
(params,) <$> case (mRet, retty f) of
(Just (Arg Indirect externT _ _), Just inlangT) -> do
callOp <- instr inlangT $ Call False CC.Fast [] (Right callable) ((,[]) <$> argOps) [] []
let retPtrOp = LocalReference (ptr externT) $ UnName 0
castPtr <- instr (ptr inlangT) $ BitCast retPtrOp (ptr inlangT) []
uinstr $ Store False castPtr callOp Nothing 0 []
return . Do $ Ret Nothing []
(Just (Arg Direct externT _ _), Just inlangT) -> do
callOp <- instr inlangT $ Call False CC.Fast [] (Right callable) ((,[]) <$> argOps) [] []
allocaOp <- instr (ptr externT) $ Alloca externT Nothing 0 []
castPtr <- instr (ptr inlangT) $ BitCast allocaOp (ptr inlangT) []
uinstr $ Store False castPtr callOp Nothing 0 []
retOp <- instr externT $ Load False allocaOp Nothing 0 []
return . Do $ Ret (Just retOp) []
_ -> do
uinstr $ Call False CC.Fast [] (Right callable) ((,[]) <$> argOps) [] []
return . Do $ Ret Nothing [] | 2,929 | false | true | 0 | 24 | 928 | 1,249 | 619 | 630 | null | null |
timtian090/Playground | Haskell/simpleJSON/src/Prettify.hs | mit | flatten :: Doc -> Doc
flatten (x `Concat` y) = flatten x `Concat` flatten y | 75 | flatten :: Doc -> Doc
flatten (x `Concat` y) = flatten x `Concat` flatten y | 75 | flatten (x `Concat` y) = flatten x `Concat` flatten y | 53 | false | true | 0 | 7 | 14 | 39 | 21 | 18 | null | null |
CoryXie/BarrelfishOS | hake/RuleDefs.hs | mit | --
-- Look for a set of files: this is called using the "find" combinator
--
withSuffix :: [String] -> String -> String -> [String]
withSuffix af tf arg =
[ basename f | f <- af, f `isInSameDirAs` tf, isSuffixOf arg f ] | 223 | withSuffix :: [String] -> String -> String -> [String]
withSuffix af tf arg =
[ basename f | f <- af, f `isInSameDirAs` tf, isSuffixOf arg f ] | 146 | withSuffix af tf arg =
[ basename f | f <- af, f `isInSameDirAs` tf, isSuffixOf arg f ] | 91 | true | true | 0 | 10 | 47 | 78 | 40 | 38 | null | null |
elitak/frag | src/AFRPEvent.hs | gpl-2.0 | -- A generic event merge utility:
mapMerge :: (a -> c) -> (b -> c) -> (a -> b -> c)
-> Event a -> Event b -> Event c
mapMerge _ _ _ NoEvent NoEvent = NoEvent | 175 | mapMerge :: (a -> c) -> (b -> c) -> (a -> b -> c)
-> Event a -> Event b -> Event c
mapMerge _ _ _ NoEvent NoEvent = NoEvent | 141 | mapMerge _ _ _ NoEvent NoEvent = NoEvent | 46 | true | true | 0 | 10 | 55 | 77 | 39 | 38 | null | null |
lnds/programando.org | siracusa/damowe-2.hs | bsd-3-clause | collatz :: Int -> [Int] -> [Int]
collatz n xs | n == 1 = xs ++ [1] | 66 | collatz :: Int -> [Int] -> [Int]
collatz n xs | n == 1 = xs ++ [1] | 66 | collatz n xs | n == 1 = xs ++ [1] | 33 | false | true | 2 | 9 | 17 | 53 | 25 | 28 | null | null |
WraithM/fingmodules | src/Language/Lambda/Pretty.hs | bsd-3-clause | prettyLit :: Literal -> Doc
prettyLit (IntConst i) = int i | 58 | prettyLit :: Literal -> Doc
prettyLit (IntConst i) = int i | 58 | prettyLit (IntConst i) = int i | 30 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
jgm/grammata | Grammata/Parse.hs | bsd-2-clause | pBlockArg :: Parser Text
pBlockArg = pBraced (try $ skipMany (pComment <|> pSkip) >> pBlockCommand
<* skipMany (pComment <|> pSkip)) | 161 | pBlockArg :: Parser Text
pBlockArg = pBraced (try $ skipMany (pComment <|> pSkip) >> pBlockCommand
<* skipMany (pComment <|> pSkip)) | 161 | pBlockArg = pBraced (try $ skipMany (pComment <|> pSkip) >> pBlockCommand
<* skipMany (pComment <|> pSkip)) | 136 | false | true | 1 | 12 | 48 | 55 | 26 | 29 | null | null |
nsmryan/CADH | src/CADH/DataDefs.hs | bsd-3-clause | sint64Tlmbe = sint64Tlm BigEndian | 33 | sint64Tlmbe = sint64Tlm BigEndian | 33 | sint64Tlmbe = sint64Tlm BigEndian | 33 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
Bodigrim/arithmoi | Math/NumberTheory/Moduli/Singleton.hs | mit | cyclicGroupFromFactors
:: (Eq a, Num a)
=> [(Prime a, Word)]
-> Maybe (Some (CyclicGroup a))
cyclicGroupFromFactors = \case
[(unPrime -> 2, 1)] -> Just $ Some CG2'
[(unPrime -> 2, 2)] -> Just $ Some CG4'
[(unPrime -> 2, _)] -> Nothing
[(p, k)] -> Just $ Some $ CGOddPrimePower' p k
[(unPrime -> 2, 1), (p, k)] -> Just $ Some $ CGDoubleOddPrimePower' p k
[(p, k), (unPrime -> 2, 1)] -> Just $ Some $ CGDoubleOddPrimePower' p k
_ -> Nothing
-- | Similar to 'cyclicGroupFromFactors' . 'factorise',
-- but much faster, because it
-- but performes only one primality test instead of full
-- factorisation. | 621 | cyclicGroupFromFactors
:: (Eq a, Num a)
=> [(Prime a, Word)]
-> Maybe (Some (CyclicGroup a))
cyclicGroupFromFactors = \case
[(unPrime -> 2, 1)] -> Just $ Some CG2'
[(unPrime -> 2, 2)] -> Just $ Some CG4'
[(unPrime -> 2, _)] -> Nothing
[(p, k)] -> Just $ Some $ CGOddPrimePower' p k
[(unPrime -> 2, 1), (p, k)] -> Just $ Some $ CGDoubleOddPrimePower' p k
[(p, k), (unPrime -> 2, 1)] -> Just $ Some $ CGDoubleOddPrimePower' p k
_ -> Nothing
-- | Similar to 'cyclicGroupFromFactors' . 'factorise',
-- but much faster, because it
-- but performes only one primality test instead of full
-- factorisation. | 621 | cyclicGroupFromFactors = \case
[(unPrime -> 2, 1)] -> Just $ Some CG2'
[(unPrime -> 2, 2)] -> Just $ Some CG4'
[(unPrime -> 2, _)] -> Nothing
[(p, k)] -> Just $ Some $ CGOddPrimePower' p k
[(unPrime -> 2, 1), (p, k)] -> Just $ Some $ CGDoubleOddPrimePower' p k
[(p, k), (unPrime -> 2, 1)] -> Just $ Some $ CGDoubleOddPrimePower' p k
_ -> Nothing
-- | Similar to 'cyclicGroupFromFactors' . 'factorise',
-- but much faster, because it
-- but performes only one primality test instead of full
-- factorisation. | 522 | false | true | 0 | 12 | 128 | 256 | 139 | 117 | null | null |
yu-i9/thih | src/Thih/Static/Prelude.hs | bsd-3-clause | gTCfun = "GT" :>: (Forall [] ([] :=> tOrdering)) | 51 | gTCfun = "GT" :>: (Forall [] ([] :=> tOrdering)) | 51 | gTCfun = "GT" :>: (Forall [] ([] :=> tOrdering)) | 51 | false | false | 0 | 10 | 11 | 29 | 15 | 14 | null | null |
haskell/filepath | System/FilePath/Posix.hs | bsd-3-clause | -- | Split a path by the directory separator.
--
-- > splitPath "/directory/file.ext" == ["/","directory/","file.ext"]
-- > concat (splitPath x) == x
-- > splitPath "test//item/" == ["test//","item/"]
-- > splitPath "test/item/file" == ["test/","item/","file"]
-- > splitPath "" == []
-- > Windows: splitPath "c:\\test\\path" == ["c:\\","test\\","path"]
-- > Posix: splitPath "/file/test" == ["/","file/","test"]
splitPath :: FilePath -> [FilePath]
splitPath x = [drive | drive /= ""] ++ f path
where
(drive,path) = splitDrive x
f "" = []
f y = (a++c) : f d
where
(a,b) = break isPathSeparator y
(c,d) = span isPathSeparator b
-- | Just as 'splitPath', but don't add the trailing slashes to each element.
--
-- > splitDirectories "/directory/file.ext" == ["/","directory","file.ext"]
-- > splitDirectories "test/file" == ["test","file"]
-- > splitDirectories "/test/file" == ["/","test","file"]
-- > Windows: splitDirectories "C:\\test\\file" == ["C:\\", "test", "file"]
-- > Valid x => joinPath (splitDirectories x) `equalFilePath` x
-- > splitDirectories "" == []
-- > Windows: splitDirectories "C:\\test\\\\\\file" == ["C:\\", "test", "file"]
-- > splitDirectories "/test///file" == ["/","test","file"] | 1,336 | splitPath :: FilePath -> [FilePath]
splitPath x = [drive | drive /= ""] ++ f path
where
(drive,path) = splitDrive x
f "" = []
f y = (a++c) : f d
where
(a,b) = break isPathSeparator y
(c,d) = span isPathSeparator b
-- | Just as 'splitPath', but don't add the trailing slashes to each element.
--
-- > splitDirectories "/directory/file.ext" == ["/","directory","file.ext"]
-- > splitDirectories "test/file" == ["test","file"]
-- > splitDirectories "/test/file" == ["/","test","file"]
-- > Windows: splitDirectories "C:\\test\\file" == ["C:\\", "test", "file"]
-- > Valid x => joinPath (splitDirectories x) `equalFilePath` x
-- > splitDirectories "" == []
-- > Windows: splitDirectories "C:\\test\\\\\\file" == ["C:\\", "test", "file"]
-- > splitDirectories "/test///file" == ["/","test","file"] | 921 | splitPath x = [drive | drive /= ""] ++ f path
where
(drive,path) = splitDrive x
f "" = []
f y = (a++c) : f d
where
(a,b) = break isPathSeparator y
(c,d) = span isPathSeparator b
-- | Just as 'splitPath', but don't add the trailing slashes to each element.
--
-- > splitDirectories "/directory/file.ext" == ["/","directory","file.ext"]
-- > splitDirectories "test/file" == ["test","file"]
-- > splitDirectories "/test/file" == ["/","test","file"]
-- > Windows: splitDirectories "C:\\test\\file" == ["C:\\", "test", "file"]
-- > Valid x => joinPath (splitDirectories x) `equalFilePath` x
-- > splitDirectories "" == []
-- > Windows: splitDirectories "C:\\test\\\\\\file" == ["C:\\", "test", "file"]
-- > splitDirectories "/test///file" == ["/","test","file"] | 885 | true | true | 2 | 8 | 301 | 143 | 83 | 60 | null | null |
passionfruit18/ldl_exposition | src/Samples.hs | gpl-3.0 | afa2 :: AFA State Alphabet
afa2 = FA (mkAlph "a") qs (St 1) (ATransition t) (S.singleton (St 3)) where
t = M.fromList [((St 1, L 'a'), form)]
form = mapLog id St $ And (Or (PropVar 3) (PropVar 2)) (Or (PropVar 4) (PropVar 5)) | 233 | afa2 :: AFA State Alphabet
afa2 = FA (mkAlph "a") qs (St 1) (ATransition t) (S.singleton (St 3)) where
t = M.fromList [((St 1, L 'a'), form)]
form = mapLog id St $ And (Or (PropVar 3) (PropVar 2)) (Or (PropVar 4) (PropVar 5)) | 233 | afa2 = FA (mkAlph "a") qs (St 1) (ATransition t) (S.singleton (St 3)) where
t = M.fromList [((St 1, L 'a'), form)]
form = mapLog id St $ And (Or (PropVar 3) (PropVar 2)) (Or (PropVar 4) (PropVar 5)) | 206 | false | true | 0 | 12 | 51 | 151 | 76 | 75 | null | null |
erantapaa/simple-hunt | src/Hayoo/ParseSignature.hs | bsd-3-clause | prettySignature :: Signature -> String
prettySignature = pretty | 78 | prettySignature :: Signature -> String
prettySignature = pretty | 78 | prettySignature = pretty | 39 | false | true | 0 | 5 | 22 | 15 | 8 | 7 | null | null |
rueshyna/gogol | gogol-android-publisher/gen/Network/Google/Resource/AndroidPublisher/Edits/Tracks/Update.hs | mpl-2.0 | -- | Unique identifier for the Android app that is being updated; for
-- example, \"com.spiffygame\".
etuPackageName :: Lens' EditsTracksUpdate Text
etuPackageName
= lens _etuPackageName
(\ s a -> s{_etuPackageName = a}) | 228 | etuPackageName :: Lens' EditsTracksUpdate Text
etuPackageName
= lens _etuPackageName
(\ s a -> s{_etuPackageName = a}) | 126 | etuPackageName
= lens _etuPackageName
(\ s a -> s{_etuPackageName = a}) | 79 | true | true | 0 | 9 | 39 | 43 | 23 | 20 | null | null |
dmcclean/HPi | System/RaspberryPi/GPIO.hs | bsd-3-clause | getHwPin PinV1_11 = 17 | 22 | getHwPin PinV1_11 = 17 | 22 | getHwPin PinV1_11 = 17 | 22 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
denumerate/raven | src/Raven/Server/Commands.hs | bsd-3-clause | parseDeleteUser server self (n:":deleteUser":_) =
send server (self,ProcessedMsg n ":deleteUser takes one argument") | 118 | parseDeleteUser server self (n:":deleteUser":_) =
send server (self,ProcessedMsg n ":deleteUser takes one argument") | 118 | parseDeleteUser server self (n:":deleteUser":_) =
send server (self,ProcessedMsg n ":deleteUser takes one argument") | 118 | false | false | 0 | 8 | 14 | 40 | 20 | 20 | null | null |
termite2/tsl | Ops.hs | bsd-3-clause | -- Perform binary arithmetic operation
-- Takes integer arguments and their widths
arithBOp :: BOp -> (Integer,Bool,Int) -> (Integer,Bool,Int) -> (Integer,Bool,Int)
arithBOp op (i1,s1,w1) (i2,s2,w2) | elem op [BAnd,BOr,BXor] = (i,s,w)
where (s,w) = arithBOpType op (s1,w1) (s2,w2)
f = case op of
BAnd -> (&&)
BOr -> (||)
BXor -> (\b1 b2 -> (b1 && not b2) || (b2 && not b1))
i = foldl' (\v idx -> case f (testBit i1 idx) (testBit i2 idx) of
True -> setBit v idx
False -> v)
0 [0..w - 1] | 666 | arithBOp :: BOp -> (Integer,Bool,Int) -> (Integer,Bool,Int) -> (Integer,Bool,Int)
arithBOp op (i1,s1,w1) (i2,s2,w2) | elem op [BAnd,BOr,BXor] = (i,s,w)
where (s,w) = arithBOpType op (s1,w1) (s2,w2)
f = case op of
BAnd -> (&&)
BOr -> (||)
BXor -> (\b1 b2 -> (b1 && not b2) || (b2 && not b1))
i = foldl' (\v idx -> case f (testBit i1 idx) (testBit i2 idx) of
True -> setBit v idx
False -> v)
0 [0..w - 1] | 583 | arithBOp op (i1,s1,w1) (i2,s2,w2) | elem op [BAnd,BOr,BXor] = (i,s,w)
where (s,w) = arithBOpType op (s1,w1) (s2,w2)
f = case op of
BAnd -> (&&)
BOr -> (||)
BXor -> (\b1 b2 -> (b1 && not b2) || (b2 && not b1))
i = foldl' (\v idx -> case f (testBit i1 idx) (testBit i2 idx) of
True -> setBit v idx
False -> v)
0 [0..w - 1] | 501 | true | true | 2 | 15 | 270 | 277 | 154 | 123 | null | null |
laszlopandy/elm-package | src/CommandLine/Arguments.hs | bsd-3-clause | -- GENERAL HELP
infoModifier :: Opt.InfoMod (Manager.Manager ())
infoModifier =
mconcat
[ Opt.fullDesc
, Opt.header top
, Opt.progDesc "install and publish elm libraries"
, Opt.footerDoc (Just moreHelp)
]
where
top =
"Elm Package Manager " ++ showVersion This.version
++ " (Elm Platform " ++ (Package.versionToString Compiler.version) ++ ")\n"
moreHelp =
linesToDoc
[ "To learn more about a particular command run:"
, " elm-package COMMAND --help"
] | 556 | infoModifier :: Opt.InfoMod (Manager.Manager ())
infoModifier =
mconcat
[ Opt.fullDesc
, Opt.header top
, Opt.progDesc "install and publish elm libraries"
, Opt.footerDoc (Just moreHelp)
]
where
top =
"Elm Package Manager " ++ showVersion This.version
++ " (Elm Platform " ++ (Package.versionToString Compiler.version) ++ ")\n"
moreHelp =
linesToDoc
[ "To learn more about a particular command run:"
, " elm-package COMMAND --help"
] | 539 | infoModifier =
mconcat
[ Opt.fullDesc
, Opt.header top
, Opt.progDesc "install and publish elm libraries"
, Opt.footerDoc (Just moreHelp)
]
where
top =
"Elm Package Manager " ++ showVersion This.version
++ " (Elm Platform " ++ (Package.versionToString Compiler.version) ++ ")\n"
moreHelp =
linesToDoc
[ "To learn more about a particular command run:"
, " elm-package COMMAND --help"
] | 490 | true | true | 8 | 9 | 172 | 132 | 61 | 71 | null | null |
danr/hipspec | examples/old-examples/hip/Nat2ndArg.hs | gpl-3.0 | prop_lt_suc :: Nat -> Nat -> Prop Bool
prop_lt_suc i m =
proveBool (i < S (m + i)) | 85 | prop_lt_suc :: Nat -> Nat -> Prop Bool
prop_lt_suc i m =
proveBool (i < S (m + i)) | 85 | prop_lt_suc i m =
proveBool (i < S (m + i)) | 45 | false | true | 0 | 10 | 21 | 47 | 23 | 24 | null | null |
olsner/ghc | ghc/Main.hs | bsd-3-clause | isCompManagerMode DoInteractive = True | 38 | isCompManagerMode DoInteractive = True | 38 | isCompManagerMode DoInteractive = True | 38 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
vituscze/norri | src/Compiler/Pretty.hs | bsd-3-clause | -- | Pretty print a type constructor.
prettyTyCon :: TyCon -> ShowS
prettyTyCon (TyCon n tvs) =
concatD . intersperse (str " ") . (str n:) . map str $ tvs | 158 | prettyTyCon :: TyCon -> ShowS
prettyTyCon (TyCon n tvs) =
concatD . intersperse (str " ") . (str n:) . map str $ tvs | 120 | prettyTyCon (TyCon n tvs) =
concatD . intersperse (str " ") . (str n:) . map str $ tvs | 90 | true | true | 1 | 10 | 34 | 69 | 32 | 37 | null | null |
gridaphobe/ghc | compiler/main/DynFlags.hs | bsd-3-clause | setDylibInstallName f d = d{ dylibInstallName = Just f} | 56 | setDylibInstallName f d = d{ dylibInstallName = Just f} | 56 | setDylibInstallName f d = d{ dylibInstallName = Just f} | 56 | false | false | 0 | 7 | 9 | 22 | 11 | 11 | null | null |
snoyberg/ghc | libraries/ghci/GHCi/Run.hs | bsd-3-clause | evalString :: HValueRef -> IO (EvalResult String)
evalString r = do
io <- localRef r
tryEval $ do
r <- unsafeCoerce io :: IO String
evaluate (force r) | 162 | evalString :: HValueRef -> IO (EvalResult String)
evalString r = do
io <- localRef r
tryEval $ do
r <- unsafeCoerce io :: IO String
evaluate (force r) | 162 | evalString r = do
io <- localRef r
tryEval $ do
r <- unsafeCoerce io :: IO String
evaluate (force r) | 112 | false | true | 0 | 12 | 39 | 72 | 32 | 40 | null | null |
ulricha/dsh | src/Database/DSH/VSL/Opt/Rewrite/Window.hs | bsd-3-clause | aggrToWinFun (AggrMax e) = Just $ WinMax e | 52 | aggrToWinFun (AggrMax e) = Just $ WinMax e | 52 | aggrToWinFun (AggrMax e) = Just $ WinMax e | 52 | false | false | 0 | 7 | 17 | 22 | 10 | 12 | null | null |
michalkonecny/aern2 | aern2-net/src/AERN2/QA/Strategy/Parallel.hs | bsd-3-clause | logQuery ::
QANetState -> Maybe ValueId -> ValueId -> String -> QANetState
logQuery ns src valueId qS =
ns { net_log = (net_log ns) ++ [logItem] }
where
logItem = QANetLogQuery src valueId qS | 199 | logQuery ::
QANetState -> Maybe ValueId -> ValueId -> String -> QANetState
logQuery ns src valueId qS =
ns { net_log = (net_log ns) ++ [logItem] }
where
logItem = QANetLogQuery src valueId qS | 199 | logQuery ns src valueId qS =
ns { net_log = (net_log ns) ++ [logItem] }
where
logItem = QANetLogQuery src valueId qS | 122 | false | true | 1 | 10 | 41 | 86 | 40 | 46 | null | null |
facebookincubator/duckling | Duckling/Time/IT/Rules.hs | bsd-3-clause | ruleHhRelativeminutesDelPomeriggiotimeofday :: Rule
ruleHhRelativeminutesDelPomeriggiotimeofday = Rule
{ name = "hh <relative-minutes> del pomeriggio(time-of-day)"
, pattern =
[ Predicate $ and . sequence [isNotLatent, isAnHourOfDay]
, Predicate $ isIntegerBetween 1 59
, regex "d(i|el(la)?) (pomeriggio|(sta)?(sera|notte))"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
token:
_) -> do
n <- getIntValue token
let h = if hours > 12 then hours else hours + 12
tt $ hourMinute False h n
_ -> Nothing
} | 639 | ruleHhRelativeminutesDelPomeriggiotimeofday :: Rule
ruleHhRelativeminutesDelPomeriggiotimeofday = Rule
{ name = "hh <relative-minutes> del pomeriggio(time-of-day)"
, pattern =
[ Predicate $ and . sequence [isNotLatent, isAnHourOfDay]
, Predicate $ isIntegerBetween 1 59
, regex "d(i|el(la)?) (pomeriggio|(sta)?(sera|notte))"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
token:
_) -> do
n <- getIntValue token
let h = if hours > 12 then hours else hours + 12
tt $ hourMinute False h n
_ -> Nothing
} | 639 | ruleHhRelativeminutesDelPomeriggiotimeofday = Rule
{ name = "hh <relative-minutes> del pomeriggio(time-of-day)"
, pattern =
[ Predicate $ and . sequence [isNotLatent, isAnHourOfDay]
, Predicate $ isIntegerBetween 1 59
, regex "d(i|el(la)?) (pomeriggio|(sta)?(sera|notte))"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
token:
_) -> do
n <- getIntValue token
let h = if hours > 12 then hours else hours + 12
tt $ hourMinute False h n
_ -> Nothing
} | 587 | false | true | 0 | 22 | 157 | 189 | 97 | 92 | null | null |
rueshyna/gogol | gogol-android-publisher/gen/Network/Google/Resource/AndroidPublisher/Edits/Images/Deleteall.hs | mpl-2.0 | -- | Creates a value of 'EditsImagesDeleteall' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ediPackageName'
--
-- * 'ediImageType'
--
-- * 'ediLanguage'
--
-- * 'ediEditId'
editsImagesDeleteall
:: Text -- ^ 'ediPackageName'
-> EditsImagesDeleteallImageType -- ^ 'ediImageType'
-> Text -- ^ 'ediLanguage'
-> Text -- ^ 'ediEditId'
-> EditsImagesDeleteall
editsImagesDeleteall pEdiPackageName_ pEdiImageType_ pEdiLanguage_ pEdiEditId_ =
EditsImagesDeleteall'
{ _ediPackageName = pEdiPackageName_
, _ediImageType = pEdiImageType_
, _ediLanguage = pEdiLanguage_
, _ediEditId = pEdiEditId_
} | 718 | editsImagesDeleteall
:: Text -- ^ 'ediPackageName'
-> EditsImagesDeleteallImageType -- ^ 'ediImageType'
-> Text -- ^ 'ediLanguage'
-> Text -- ^ 'ediEditId'
-> EditsImagesDeleteall
editsImagesDeleteall pEdiPackageName_ pEdiImageType_ pEdiLanguage_ pEdiEditId_ =
EditsImagesDeleteall'
{ _ediPackageName = pEdiPackageName_
, _ediImageType = pEdiImageType_
, _ediLanguage = pEdiLanguage_
, _ediEditId = pEdiEditId_
} | 456 | editsImagesDeleteall pEdiPackageName_ pEdiImageType_ pEdiLanguage_ pEdiEditId_ =
EditsImagesDeleteall'
{ _ediPackageName = pEdiPackageName_
, _ediImageType = pEdiImageType_
, _ediLanguage = pEdiLanguage_
, _ediEditId = pEdiEditId_
} | 256 | true | true | 0 | 10 | 136 | 86 | 52 | 34 | null | null |
hellerve/brainfuck | brainf*ck.hs | gpl-2.0 | prompt :: String
prompt = name ++ "> " | 38 | prompt :: String
prompt = name ++ "> " | 38 | prompt = name ++ "> " | 21 | false | true | 2 | 6 | 8 | 23 | 9 | 14 | null | null |
jparyani/capnproto-boostpython | compiler/src/BoostPythonGenerator.hs | bsd-2-clause | generateCxxSource file = hastacheStr hastacheConfig (encodeStr srcTemplate) (fileContext file) | 94 | generateCxxSource file = hastacheStr hastacheConfig (encodeStr srcTemplate) (fileContext file) | 94 | generateCxxSource file = hastacheStr hastacheConfig (encodeStr srcTemplate) (fileContext file) | 94 | false | false | 1 | 7 | 8 | 32 | 13 | 19 | null | null |
coreyoconnor/bind-marshal | test/verify_bind_rules_proto_2.hs | bsd-3-clause | force_13 :: ( T13A0 pre_m, T13A1 post_m, ReifyM pre_m, ReifyM post_m ) => Dyn pre_m post_m SZ () -> Test ()
force_13 = assert_ops_are [SB 1, SB 1, SB 1, SB 1] | 159 | force_13 :: ( T13A0 pre_m, T13A1 post_m, ReifyM pre_m, ReifyM post_m ) => Dyn pre_m post_m SZ () -> Test ()
force_13 = assert_ops_are [SB 1, SB 1, SB 1, SB 1] | 159 | force_13 = assert_ops_are [SB 1, SB 1, SB 1, SB 1] | 50 | false | true | 0 | 8 | 32 | 85 | 42 | 43 | null | null |
kolmodin/cabal | cabal-install/Distribution/Client/InstallPlan.hs | bsd-3-clause | checkConfiguredPackage :: (Package srcpkg, Package ipkg)
=> GenericPlanPackage ipkg srcpkg iresult ifailure
-> Maybe srcpkg
checkConfiguredPackage (Configured pkg) = Just pkg | 220 | checkConfiguredPackage :: (Package srcpkg, Package ipkg)
=> GenericPlanPackage ipkg srcpkg iresult ifailure
-> Maybe srcpkg
checkConfiguredPackage (Configured pkg) = Just pkg | 220 | checkConfiguredPackage (Configured pkg) = Just pkg | 50 | false | true | 0 | 7 | 66 | 54 | 26 | 28 | null | null |
thomie/cabal | Cabal/Distribution/Simple/LocalBuildInfo.hs | bsd-3-clause | componentDisabledReason :: Component -> Maybe ComponentDisabledReason
componentDisabledReason (CLib lib)
| not (buildable (libBuildInfo lib)) = Just DisabledComponent | 174 | componentDisabledReason :: Component -> Maybe ComponentDisabledReason
componentDisabledReason (CLib lib)
| not (buildable (libBuildInfo lib)) = Just DisabledComponent | 174 | componentDisabledReason (CLib lib)
| not (buildable (libBuildInfo lib)) = Just DisabledComponent | 104 | false | true | 0 | 12 | 24 | 51 | 23 | 28 | null | null |
apyrgio/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | htKvmValidDiskTypes :: FrozenSet String
htKvmValidDiskTypes =
ConstantUtils.mkSet [htDiskIde,
htDiskMtd,
htDiskParavirtual,
htDiskPflash,
htDiskScsi,
htDiskSd] | 276 | htKvmValidDiskTypes :: FrozenSet String
htKvmValidDiskTypes =
ConstantUtils.mkSet [htDiskIde,
htDiskMtd,
htDiskParavirtual,
htDiskPflash,
htDiskScsi,
htDiskSd] | 276 | htKvmValidDiskTypes =
ConstantUtils.mkSet [htDiskIde,
htDiskMtd,
htDiskParavirtual,
htDiskPflash,
htDiskScsi,
htDiskSd] | 236 | false | true | 0 | 6 | 129 | 37 | 21 | 16 | null | null |
cabrera/ghc-mod | Language/Haskell/GhcMod/CabalApi.hs | bsd-3-clause | ----------------------------------------------------------------
uniqueAndSort :: [String] -> [String]
uniqueAndSort = toList . fromList | 137 | uniqueAndSort :: [String] -> [String]
uniqueAndSort = toList . fromList | 71 | uniqueAndSort = toList . fromList | 33 | true | true | 0 | 6 | 11 | 26 | 15 | 11 | null | null |
isovector/haystack | src/Haystack/Web/Preferences.hs | bsd-3-clause | runForm :: H.AttributeValue -> Html -> Html
runForm submit contents =
form ! action "/form"
! enctype "multipart/form-data"
! A.method "POST" $ do
input ! type_ "submit" ! value "No preferences!"
contents
input ! type_ "submit" ! value submit | 303 | runForm :: H.AttributeValue -> Html -> Html
runForm submit contents =
form ! action "/form"
! enctype "multipart/form-data"
! A.method "POST" $ do
input ! type_ "submit" ! value "No preferences!"
contents
input ! type_ "submit" ! value submit | 303 | runForm submit contents =
form ! action "/form"
! enctype "multipart/form-data"
! A.method "POST" $ do
input ! type_ "submit" ! value "No preferences!"
contents
input ! type_ "submit" ! value submit | 259 | false | true | 0 | 10 | 99 | 90 | 40 | 50 | null | null |
MichaelBurge/stockfighter-jailbreak | src/Api/Stockfighter/Jailbreak/Decompiler/Passes.hs | bsd-3-clause | eImm8 = ELiteral . LImm8 | 24 | eImm8 = ELiteral . LImm8 | 24 | eImm8 = ELiteral . LImm8 | 24 | false | false | 1 | 5 | 4 | 13 | 5 | 8 | null | null |
andykitchen/linear-logic | RewriteRules.hs | gpl-3.0 | lattice (l :+: r) = lattice l && lattice r | 43 | lattice (l :+: r) = lattice l && lattice r | 43 | lattice (l :+: r) = lattice l && lattice r | 43 | false | false | 2 | 6 | 10 | 28 | 12 | 16 | null | null |
rohitjha/DiMPL | src/Graph.hs | bsd-2-clause | {-|
The 'unionG' function returns the union of two graphs.
The function takes two arguments, both of the type 'Graph', and returns a 'Graph' type.
For example:
>>> g
Graph ({1,2,3,4},{(1,2,5),(1,3,7),(2,4,3)})
>>> g'
Graph ({1,2,3},{(1,2,1),(1,4,5)})
>>> unionG g g'
Graph ({1,2,3,4},{(1,2,1),(1,2,5),(1,3,7),(1,4,5),(2,4,3)})
-}
unionG :: (Num a, Ord a) => Graph a -> Graph a -> Graph a
unionG (Graph g1) (Graph g2) = Graph (
Vertices $ L.sort $ verticesToList (getVerticesG (Graph g1)) `L.union` verticesToList (getVerticesG (Graph g2)),
Edges $ L.sort $ edgesToList (getEdgesG (Graph g1)) `L.union` edgesToList (getEdgesG (Graph g2))) | 663 | unionG :: (Num a, Ord a) => Graph a -> Graph a -> Graph a
unionG (Graph g1) (Graph g2) = Graph (
Vertices $ L.sort $ verticesToList (getVerticesG (Graph g1)) `L.union` verticesToList (getVerticesG (Graph g2)),
Edges $ L.sort $ edgesToList (getEdgesG (Graph g1)) `L.union` edgesToList (getEdgesG (Graph g2))) | 311 | unionG (Graph g1) (Graph g2) = Graph (
Vertices $ L.sort $ verticesToList (getVerticesG (Graph g1)) `L.union` verticesToList (getVerticesG (Graph g2)),
Edges $ L.sort $ edgesToList (getEdgesG (Graph g1)) `L.union` edgesToList (getEdgesG (Graph g2))) | 253 | true | true | 0 | 13 | 116 | 166 | 83 | 83 | null | null |
ShellShoccar-jpn/Open-usp-Tukubai | COMMANDS.HS/delf.hs | mit | getFields (opt:opts) = getFields opts | 43 | getFields (opt:opts) = getFields opts | 43 | getFields (opt:opts) = getFields opts | 43 | false | false | 0 | 7 | 10 | 19 | 9 | 10 | null | null |
CloudI/CloudI | src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Short/Internal.hs | mit | -- | /O(n)/. Convert a 'ShortByteString' into a list.
unpack :: ShortByteString -> [Word8]
unpack = unpackBytes | 111 | unpack :: ShortByteString -> [Word8]
unpack = unpackBytes | 57 | unpack = unpackBytes | 20 | true | true | 0 | 8 | 16 | 26 | 12 | 14 | null | null |
rueshyna/gogol | gogol-webmaster-tools/gen/Network/Google/Resource/Webmasters/Sites/Get.hs | mpl-2.0 | -- | Creates a value of 'SitesGet' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sitSiteURL'
sitesGet
:: Text -- ^ 'sitSiteURL'
-> SitesGet
sitesGet pSitSiteURL_ =
SitesGet'
{ _sitSiteURL = pSitSiteURL_
} | 312 | sitesGet
:: Text -- ^ 'sitSiteURL'
-> SitesGet
sitesGet pSitSiteURL_ =
SitesGet'
{ _sitSiteURL = pSitSiteURL_
} | 131 | sitesGet pSitSiteURL_ =
SitesGet'
{ _sitSiteURL = pSitSiteURL_
} | 76 | true | true | 0 | 7 | 70 | 41 | 22 | 19 | null | null |
fiigii/dataflow | AnalysisTools.hs | mit | stmtsGraph :: Statement -> [(Label, Statement)]
stmtsGraph (BlockStmt []) = [] | 78 | stmtsGraph :: Statement -> [(Label, Statement)]
stmtsGraph (BlockStmt []) = [] | 78 | stmtsGraph (BlockStmt []) = [] | 30 | false | true | 0 | 7 | 10 | 41 | 21 | 20 | null | null |
danr/hipspec | examples/old-examples/hip/ZenoLists.hs | gpl-3.0 | prop_len_plus_list_homomorphism :: [a] -> [a] -> Prop Nat
prop_len_plus_list_homomorphism xs ys =
len (xs ++ ys) =:= len xs + len ys | 134 | prop_len_plus_list_homomorphism :: [a] -> [a] -> Prop Nat
prop_len_plus_list_homomorphism xs ys =
len (xs ++ ys) =:= len xs + len ys | 134 | prop_len_plus_list_homomorphism xs ys =
len (xs ++ ys) =:= len xs + len ys | 76 | false | true | 2 | 7 | 23 | 56 | 27 | 29 | null | null |
xmonad/xmonad-contrib | XMonad/Actions/SwapPromote.hs | bsd-3-clause | -- | Perform the same swap as 'swapPromoteStack'. However the new window
-- receives the focus; it appears to "swap into" the position of the original
-- window. Under this model focus follows stack position and the zipper does
-- not move.
--
-- See 'swapPromoteStack' for more details regarding the parameters.
swapInStack :: Maybe Window -> W.Stack Window -> (Bool,W.Stack Window)
swapInStack _ st@(W.Stack _x [] []) = (False,st) | 440 | swapInStack :: Maybe Window -> W.Stack Window -> (Bool,W.Stack Window)
swapInStack _ st@(W.Stack _x [] []) = (False,st) | 127 | swapInStack _ st@(W.Stack _x [] []) = (False,st) | 56 | true | true | 0 | 9 | 77 | 74 | 41 | 33 | null | null |
beni55/haste-compiler | libraries/ghc-7.8/base/GHC/IO/Handle/Types.hs | bsd-3-clause | -- | Use the native newline representation on both input and output
--
-- > nativeNewlineMode = NewlineMode { inputNL = nativeNewline
-- > outputNL = nativeNewline }
--
nativeNewlineMode :: NewlineMode
nativeNewlineMode = NewlineMode { inputNL = nativeNewline,
outputNL = nativeNewline } | 372 | nativeNewlineMode :: NewlineMode
nativeNewlineMode = NewlineMode { inputNL = nativeNewline,
outputNL = nativeNewline } | 165 | nativeNewlineMode = NewlineMode { inputNL = nativeNewline,
outputNL = nativeNewline } | 129 | true | true | 0 | 6 | 127 | 30 | 20 | 10 | null | null |
jkozlowski/kdb-haskell | src/Database/Kdb/Internal/IPC.hs | mit | vectorParser :: End.Endianness -- ^ Endianness to parse.
-> Word8 -- ^ Type of the vector.
-> Int -- ^ Number of elements in the vector.
-> A.Parser KT.Vector -- ^ Parsed vector.
vectorParser _ !t !len | t == KT.boolVT = KBoolV <$> SV.replicateM len A.anyWord8 | 346 | vectorParser :: End.Endianness -- ^ Endianness to parse.
-> Word8 -- ^ Type of the vector.
-> Int -- ^ Number of elements in the vector.
-> A.Parser KT.Vector
vectorParser _ !t !len | t == KT.boolVT = KBoolV <$> SV.replicateM len A.anyWord8 | 325 | vectorParser _ !t !len | t == KT.boolVT = KBoolV <$> SV.replicateM len A.anyWord8 | 92 | true | true | 0 | 11 | 132 | 76 | 37 | 39 | null | null |
sinelaw/lamdu | Lamdu/Sugar/Convert/Hole.hs | gpl-3.0 | accept ::
(MonadA m, Typeable1 m) =>
SugarM.Context m ->
Infer.Node (DefIM m) ->
ExprIRef.ExpressionIM m ->
T m (Maybe Guid, ExprIRef.ExpressionM m (ExprIRef.ExpressionIM m))
accept sugarContext point iref = do
-- Reinfer the inferred value so we can know which parts to clean
-- up:
(exprInferred, _) <-
Cache.unmemoS $
unsafeUnjust "The inferred value of a hole must type-check!" <$>
(runMaybeT . (`runStateT` (sugarContext ^. SugarM.scHoleInferContext)))
(SugarInfer.memoLoadInfer Nothing expr point)
pickResult iref $
flip (,) Nothing <$> cleanUpInferredVal (fst <$> exprInferred)
where
expr = Infer.iValue $ Infer.derefNode structureInferState point
structureInferState = sugarContext ^. SugarM.scStructureInferState
-- Sugar exports fpId of Lambda params as:
-- Guid.combine lamGuid paramGuid
--
-- So to be compatible with that in our idTranslations, we want to
-- change our param Guids to match that: | 960 | accept ::
(MonadA m, Typeable1 m) =>
SugarM.Context m ->
Infer.Node (DefIM m) ->
ExprIRef.ExpressionIM m ->
T m (Maybe Guid, ExprIRef.ExpressionM m (ExprIRef.ExpressionIM m))
accept sugarContext point iref = do
-- Reinfer the inferred value so we can know which parts to clean
-- up:
(exprInferred, _) <-
Cache.unmemoS $
unsafeUnjust "The inferred value of a hole must type-check!" <$>
(runMaybeT . (`runStateT` (sugarContext ^. SugarM.scHoleInferContext)))
(SugarInfer.memoLoadInfer Nothing expr point)
pickResult iref $
flip (,) Nothing <$> cleanUpInferredVal (fst <$> exprInferred)
where
expr = Infer.iValue $ Infer.derefNode structureInferState point
structureInferState = sugarContext ^. SugarM.scStructureInferState
-- Sugar exports fpId of Lambda params as:
-- Guid.combine lamGuid paramGuid
--
-- So to be compatible with that in our idTranslations, we want to
-- change our param Guids to match that: | 960 | accept sugarContext point iref = do
-- Reinfer the inferred value so we can know which parts to clean
-- up:
(exprInferred, _) <-
Cache.unmemoS $
unsafeUnjust "The inferred value of a hole must type-check!" <$>
(runMaybeT . (`runStateT` (sugarContext ^. SugarM.scHoleInferContext)))
(SugarInfer.memoLoadInfer Nothing expr point)
pickResult iref $
flip (,) Nothing <$> cleanUpInferredVal (fst <$> exprInferred)
where
expr = Infer.iValue $ Infer.derefNode structureInferState point
structureInferState = sugarContext ^. SugarM.scStructureInferState
-- Sugar exports fpId of Lambda params as:
-- Guid.combine lamGuid paramGuid
--
-- So to be compatible with that in our idTranslations, we want to
-- change our param Guids to match that: | 775 | false | true | 0 | 15 | 179 | 230 | 118 | 112 | null | null |
kinghajj/BitTicker | src/BitTicker/Util.hs | bsd-3-clause | -- output a string with an ISO8601 timestamp
timedLog :: String -> IO ()
timedLog s = getClockTime >>= toCalendarTime >>= \t -> printf "%s: %s" (iso t) s
where iso = formatCalendarTime defaultTimeLocale "%Y-%m-%d %H:%M:%S"
-- repeat some action at a given interval | 267 | timedLog :: String -> IO ()
timedLog s = getClockTime >>= toCalendarTime >>= \t -> printf "%s: %s" (iso t) s
where iso = formatCalendarTime defaultTimeLocale "%Y-%m-%d %H:%M:%S"
-- repeat some action at a given interval | 222 | timedLog s = getClockTime >>= toCalendarTime >>= \t -> printf "%s: %s" (iso t) s
where iso = formatCalendarTime defaultTimeLocale "%Y-%m-%d %H:%M:%S"
-- repeat some action at a given interval | 194 | true | true | 0 | 9 | 46 | 64 | 32 | 32 | null | null |
tjakway/ghcjvm | compiler/nativeGen/PPC/Instr.hs | bsd-3-clause | ppc_patchJumpInstr :: Instr -> (BlockId -> BlockId) -> Instr
ppc_patchJumpInstr insn patchF
= case insn of
BCC cc id -> BCC cc (patchF id)
BCCFAR cc id -> BCCFAR cc (patchF id)
BCTR ids lbl -> BCTR (map (fmap patchF) ids) lbl
_ -> insn
-- -----------------------------------------------------------------------------
-- | An instruction to spill a register into a spill slot. | 438 | ppc_patchJumpInstr :: Instr -> (BlockId -> BlockId) -> Instr
ppc_patchJumpInstr insn patchF
= case insn of
BCC cc id -> BCC cc (patchF id)
BCCFAR cc id -> BCCFAR cc (patchF id)
BCTR ids lbl -> BCTR (map (fmap patchF) ids) lbl
_ -> insn
-- -----------------------------------------------------------------------------
-- | An instruction to spill a register into a spill slot. | 438 | ppc_patchJumpInstr insn patchF
= case insn of
BCC cc id -> BCC cc (patchF id)
BCCFAR cc id -> BCCFAR cc (patchF id)
BCTR ids lbl -> BCTR (map (fmap patchF) ids) lbl
_ -> insn
-- -----------------------------------------------------------------------------
-- | An instruction to spill a register into a spill slot. | 377 | false | true | 7 | 8 | 121 | 114 | 57 | 57 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.