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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
urbanslug/ghc | testsuite/tests/safeHaskell/safeLanguage/SafeLang15.hs | bsd-3-clause | main = do
let h = H "Hello World"
g = G 1
-- Just h' = (cast h) :: Maybe G
Just p' = (cast p) :: Maybe G
Just px = (cast $ incrG p') :: Maybe P
putStrLn $ show h
putStrLn $ show g
-- putStrLn $ show h'
putStrLn $ showP p
putStrLn $ show p'
putStrLn $ showP px | 317 | main = do
let h = H "Hello World"
g = G 1
-- Just h' = (cast h) :: Maybe G
Just p' = (cast p) :: Maybe G
Just px = (cast $ incrG p') :: Maybe P
putStrLn $ show h
putStrLn $ show g
-- putStrLn $ show h'
putStrLn $ showP p
putStrLn $ show p'
putStrLn $ showP px | 317 | main = do
let h = H "Hello World"
g = G 1
-- Just h' = (cast h) :: Maybe G
Just p' = (cast p) :: Maybe G
Just px = (cast $ incrG p') :: Maybe P
putStrLn $ show h
putStrLn $ show g
-- putStrLn $ show h'
putStrLn $ showP p
putStrLn $ show p'
putStrLn $ showP px | 317 | false | false | 0 | 12 | 122 | 124 | 56 | 68 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Math/DeltaGraph.hs | mit | rmve _ = [] | 11 | rmve _ = [] | 11 | rmve _ = [] | 11 | false | false | 0 | 5 | 3 | 11 | 5 | 6 | null | null |
ancientlanguage/haskell-analysis | grammar/src/Grammar/Common/Decompose.hs | mit | decomposeChar '\x1F7B' = "\x03C5\x0301" | 39 | decomposeChar '\x1F7B' = "\x03C5\x0301" | 39 | decomposeChar '\x1F7B' = "\x03C5\x0301" | 39 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
silkapp/generic-aeson | src/Generics/Generic/Aeson/Util.hs | bsd-3-clause | stripPref :: Settings -> Text -> Text
stripPref set s = (maybe id (\p t -> fromMaybe t . (disallowEmpty <=< T.stripPrefix (T.pack p)) $ t) . stripPrefix) set s
where
disallowEmpty x
| T.null x = Just s
| otherwise = Just x | 241 | stripPref :: Settings -> Text -> Text
stripPref set s = (maybe id (\p t -> fromMaybe t . (disallowEmpty <=< T.stripPrefix (T.pack p)) $ t) . stripPrefix) set s
where
disallowEmpty x
| T.null x = Just s
| otherwise = Just x | 241 | stripPref set s = (maybe id (\p t -> fromMaybe t . (disallowEmpty <=< T.stripPrefix (T.pack p)) $ t) . stripPrefix) set s
where
disallowEmpty x
| T.null x = Just s
| otherwise = Just x | 203 | false | true | 0 | 18 | 62 | 119 | 56 | 63 | null | null |
ezyang/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | ctoHerald :: SDoc
ctoHerald = text "arising from" | 49 | ctoHerald :: SDoc
ctoHerald = text "arising from" | 49 | ctoHerald = text "arising from" | 31 | false | true | 0 | 6 | 7 | 21 | 8 | 13 | null | null |
Alasdair/Mella | Lang/Term.hs | bsd-3-clause | reconstructMeta m (Ann t1 t2) = Ann (reconstructMeta m t1) (reconstructMeta m t1) | 88 | reconstructMeta m (Ann t1 t2) = Ann (reconstructMeta m t1) (reconstructMeta m t1) | 88 | reconstructMeta m (Ann t1 t2) = Ann (reconstructMeta m t1) (reconstructMeta m t1) | 88 | false | false | 0 | 7 | 19 | 40 | 19 | 21 | null | null |
mhwombat/exp-prediction-wains | src/ALife/Creatur/Wain/UIVector/Prediction/Experiment.hs | bsd-3-clause | totalEnergy :: StateT Experiment IO (Double, Double)
totalEnergy = do
a <- fmap uiToDouble $ view W.energy <$> use subject
b <- fmap uiToDouble $ view W.energy <$> use other
d <- W.childEnergy <$> use subject
e <- W.childEnergy <$> use other
return (a + b, d + e) | 273 | totalEnergy :: StateT Experiment IO (Double, Double)
totalEnergy = do
a <- fmap uiToDouble $ view W.energy <$> use subject
b <- fmap uiToDouble $ view W.energy <$> use other
d <- W.childEnergy <$> use subject
e <- W.childEnergy <$> use other
return (a + b, d + e) | 273 | totalEnergy = do
a <- fmap uiToDouble $ view W.energy <$> use subject
b <- fmap uiToDouble $ view W.energy <$> use other
d <- W.childEnergy <$> use subject
e <- W.childEnergy <$> use other
return (a + b, d + e) | 220 | false | true | 0 | 11 | 58 | 128 | 59 | 69 | null | null |
iblumenfeld/cryptol | src/Cryptol/Parser/LexerUtils.hs | bsd-3-clause | endString :: Action
endString cfg pe txt s = case s of
InString ps str -> (Just (mkToken ps str), Normal)
_ -> panic "[Lexer] endString" ["outside string"]
where
parseStr s1 = case reads s1 of
[(cs, "")] -> StrLit cs
_ -> Err InvalidString
mkToken ps str = Located { srcRange = Range
{ from = ps
, to = moves pe txt
, source = cfgSource cfg
}
, thing = Token
{ tokenType = parseStr (T.unpack tokStr)
, tokenText = tokStr
}
}
where
tokStr = str `T.append` txt | 816 | endString :: Action
endString cfg pe txt s = case s of
InString ps str -> (Just (mkToken ps str), Normal)
_ -> panic "[Lexer] endString" ["outside string"]
where
parseStr s1 = case reads s1 of
[(cs, "")] -> StrLit cs
_ -> Err InvalidString
mkToken ps str = Located { srcRange = Range
{ from = ps
, to = moves pe txt
, source = cfgSource cfg
}
, thing = Token
{ tokenType = parseStr (T.unpack tokStr)
, tokenText = tokStr
}
}
where
tokStr = str `T.append` txt | 816 | endString cfg pe txt s = case s of
InString ps str -> (Just (mkToken ps str), Normal)
_ -> panic "[Lexer] endString" ["outside string"]
where
parseStr s1 = case reads s1 of
[(cs, "")] -> StrLit cs
_ -> Err InvalidString
mkToken ps str = Located { srcRange = Range
{ from = ps
, to = moves pe txt
, source = cfgSource cfg
}
, thing = Token
{ tokenType = parseStr (T.unpack tokStr)
, tokenText = tokStr
}
}
where
tokStr = str `T.append` txt | 796 | false | true | 0 | 12 | 449 | 204 | 108 | 96 | null | null |
mfpi/OpenGL | Graphics/Rendering/OpenGL/GLU/NURBS.hs | bsd-3-clause | nurbsSurface :: ControlPoint c => NURBSObj -> GLint -> Ptr GLfloat -> GLint -> Ptr GLfloat -> GLint -> GLint -> Ptr (c GLfloat) -> GLint -> GLint -> IO ()
nurbsSurface nurbsObj sKnotCount sKnots tKnotCount tKnots sStride tStride control sOrder tOrder =
gluNurbsSurface nurbsObj sKnotCount sKnots tKnotCount tKnots sStride tStride (castPtr control) sOrder tOrder (map2Target (pseudoPeek control)) | 398 | nurbsSurface :: ControlPoint c => NURBSObj -> GLint -> Ptr GLfloat -> GLint -> Ptr GLfloat -> GLint -> GLint -> Ptr (c GLfloat) -> GLint -> GLint -> IO ()
nurbsSurface nurbsObj sKnotCount sKnots tKnotCount tKnots sStride tStride control sOrder tOrder =
gluNurbsSurface nurbsObj sKnotCount sKnots tKnotCount tKnots sStride tStride (castPtr control) sOrder tOrder (map2Target (pseudoPeek control)) | 398 | nurbsSurface nurbsObj sKnotCount sKnots tKnotCount tKnots sStride tStride control sOrder tOrder =
gluNurbsSurface nurbsObj sKnotCount sKnots tKnotCount tKnots sStride tStride (castPtr control) sOrder tOrder (map2Target (pseudoPeek control)) | 243 | false | true | 0 | 18 | 60 | 146 | 68 | 78 | null | null |
geraldus/yesod | yesod-core/src/Yesod/Core/TypeCache.hs | mit | cacheGet :: Typeable a => TypeMap -> Maybe a
cacheGet cache = res
where
res = lookup (typeOf $ fromJust res) cache >>= fromDynamic
fromJust :: Maybe a -> a
fromJust = error "Yesod.Handler.cached.fromJust: Argument to typeOf was evaluated"
-- | Sets a value in the cache
--
-- @since 1.6.10 | 304 | cacheGet :: Typeable a => TypeMap -> Maybe a
cacheGet cache = res
where
res = lookup (typeOf $ fromJust res) cache >>= fromDynamic
fromJust :: Maybe a -> a
fromJust = error "Yesod.Handler.cached.fromJust: Argument to typeOf was evaluated"
-- | Sets a value in the cache
--
-- @since 1.6.10 | 304 | cacheGet cache = res
where
res = lookup (typeOf $ fromJust res) cache >>= fromDynamic
fromJust :: Maybe a -> a
fromJust = error "Yesod.Handler.cached.fromJust: Argument to typeOf was evaluated"
-- | Sets a value in the cache
--
-- @since 1.6.10 | 259 | false | true | 0 | 9 | 65 | 78 | 39 | 39 | null | null |
tepf/QuickPlot | src/QuickPlot/IPC/QQParser.hs | gpl-3.0 | symbol :: CharParser () String
symbol = many1 (noneOf "\\ \":;><${}") | 69 | symbol :: CharParser () String
symbol = many1 (noneOf "\\ \":;><${}") | 69 | symbol = many1 (noneOf "\\ \":;><${}") | 38 | false | true | 1 | 7 | 10 | 31 | 13 | 18 | null | null |
paulbarbu/haskell-ground | todo.hs | apache-2.0 | main = do
argList <- getArgs
-- if I don't get at least a command and a filename I assign "" to cmd so
-- the lookup below will fail, any suggestion to make this more readable?
let (cmd:args) = if length argList >= 2 then argList else ["",""]
case lookup cmd dispatch of
Just action -> action args `catch` handler
Nothing -> usage | 368 | main = do
argList <- getArgs
-- if I don't get at least a command and a filename I assign "" to cmd so
-- the lookup below will fail, any suggestion to make this more readable?
let (cmd:args) = if length argList >= 2 then argList else ["",""]
case lookup cmd dispatch of
Just action -> action args `catch` handler
Nothing -> usage | 368 | main = do
argList <- getArgs
-- if I don't get at least a command and a filename I assign "" to cmd so
-- the lookup below will fail, any suggestion to make this more readable?
let (cmd:args) = if length argList >= 2 then argList else ["",""]
case lookup cmd dispatch of
Just action -> action args `catch` handler
Nothing -> usage | 368 | false | false | 0 | 12 | 101 | 89 | 45 | 44 | null | null |
sjfloat/accelerate | Data/Array/Accelerate/Trafo/Base.hs | bsd-3-clause | prjExp (SuccIdx ix) (PushExp env _) = prjExp ix env | 51 | prjExp (SuccIdx ix) (PushExp env _) = prjExp ix env | 51 | prjExp (SuccIdx ix) (PushExp env _) = prjExp ix env | 51 | false | false | 0 | 7 | 9 | 30 | 14 | 16 | null | null |
ktvoelker/cookie-jar | test/Util.hs | gpl-3.0 | path1b = "/path1/b" | 19 | path1b = "/path1/b" | 19 | path1b = "/path1/b" | 19 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
justinethier/husk-scheme | hs-src/Language/Scheme/Parser.hs | mit | lexer = P.makeTokenParser lispDef | 33 | lexer = P.makeTokenParser lispDef | 33 | lexer = P.makeTokenParser lispDef | 33 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
airt/Haskell-99 | src/NinetyNine/P0X.hs | mit | -- myLast' = head . reverse
{-
2. Find the last but one element of a list.
(Note that the Lisp transcription of this problem is incorrect.)
Example in Haskell:
Prelude> myButLast [1,2,3,4]
3
Prelude> myButLast ['a'..'z']
'y'
-}
myButLast :: [a] -> a
myButLast = head . tail . reverse | 286 | myButLast :: [a] -> a
myButLast = head . tail . reverse | 55 | myButLast = head . tail . reverse | 33 | true | true | 2 | 7 | 53 | 37 | 17 | 20 | null | null |
iu-parfunc/AutoObsidian | src/Auto/BitString.hs | bsd-3-clause | makePopulation :: Int -> Int -> Int -> StdGen -> Population
makePopulation 0 _ _ _ = [] | 87 | makePopulation :: Int -> Int -> Int -> StdGen -> Population
makePopulation 0 _ _ _ = [] | 87 | makePopulation 0 _ _ _ = [] | 27 | false | true | 0 | 10 | 17 | 44 | 20 | 24 | null | null |
gitjonathan/agile | agile.hs | mit | roadmap :: [String] -> IO ()
roadmap args = do
putStrLn "Roadmap does nothing yet."
--
-- Allows for adding, removing, and showing features
-- | 148 | roadmap :: [String] -> IO ()
roadmap args = do
putStrLn "Roadmap does nothing yet."
--
-- Allows for adding, removing, and showing features
-- | 148 | roadmap args = do
putStrLn "Roadmap does nothing yet."
--
-- Allows for adding, removing, and showing features
-- | 119 | false | true | 0 | 8 | 30 | 39 | 19 | 20 | null | null |
runeksvendsen/rbpcp-handler | src/RBPCP/Handler/Internal/BtcAddrIndex.hs | bsd-3-clause | unspentOuts :: HC.Address -> ClientM [AddressFundingInfo]
unspentOuts = client api . Addr
where api :: Proxy UnspentOuts
api = Proxy | 147 | unspentOuts :: HC.Address -> ClientM [AddressFundingInfo]
unspentOuts = client api . Addr
where api :: Proxy UnspentOuts
api = Proxy | 147 | unspentOuts = client api . Addr
where api :: Proxy UnspentOuts
api = Proxy | 89 | false | true | 0 | 7 | 34 | 45 | 23 | 22 | null | null |
joncol/mal | haskell/step2/src/MalParser.hs | mpl-2.0 | quoteParser :: Parser Form
quoteParser = FQuote <$> (char '\'' >> formParser) | 77 | quoteParser :: Parser Form
quoteParser = FQuote <$> (char '\'' >> formParser) | 77 | quoteParser = FQuote <$> (char '\'' >> formParser) | 50 | false | true | 0 | 8 | 11 | 28 | 14 | 14 | null | null |
spechub/Hets | RDF/Parse.hs | gpl-2.0 | uriP :: CharParser st IRI
uriP =
skips $ try $ checkWithUsing showIRI uriQ $ \ q ->
not (null $ prefixName q) || notElem (show $ iriPath q) criticalKeywords | 162 | uriP :: CharParser st IRI
uriP =
skips $ try $ checkWithUsing showIRI uriQ $ \ q ->
not (null $ prefixName q) || notElem (show $ iriPath q) criticalKeywords | 162 | uriP =
skips $ try $ checkWithUsing showIRI uriQ $ \ q ->
not (null $ prefixName q) || notElem (show $ iriPath q) criticalKeywords | 136 | false | true | 0 | 11 | 35 | 70 | 34 | 36 | null | null |
kmate/HaRe | old/tools/hs2html/ParseMyDoc.hs | bsd-3-clause | endAllLists [] = error "endAllLists: []" | 41 | endAllLists [] = error "endAllLists: []" | 41 | endAllLists [] = error "endAllLists: []" | 41 | false | false | 1 | 5 | 6 | 17 | 6 | 11 | null | null |
sol/wai | warp/Network/Wai/Handler/Warp/MultiMap.hs | mit | balanceL' (Node R a xk xv (Node R b yk yv c)) zk zv d =
Node R (Node B a xk xv b) yk yv (Node B c zk zv d) | 110 | balanceL' (Node R a xk xv (Node R b yk yv c)) zk zv d =
Node R (Node B a xk xv b) yk yv (Node B c zk zv d) | 110 | balanceL' (Node R a xk xv (Node R b yk yv c)) zk zv d =
Node R (Node B a xk xv b) yk yv (Node B c zk zv d) | 110 | false | false | 0 | 9 | 35 | 82 | 40 | 42 | null | null |
joe9/barrelfish | tools/mackerel/ShiftDriver.hs | mit | device_initial_values d
= [ C.Blank,
C.MultiComment ["Initial register values (currently 0)"],
C.EnumDecl (device_initial_enum_name d)
[ C.EnumItem (register_initial_name r) (Just $ C.HexConstant $ 0)
| r <- (Dev.registers d) ],
C.Blank ] | 300 | device_initial_values d
= [ C.Blank,
C.MultiComment ["Initial register values (currently 0)"],
C.EnumDecl (device_initial_enum_name d)
[ C.EnumItem (register_initial_name r) (Just $ C.HexConstant $ 0)
| r <- (Dev.registers d) ],
C.Blank ] | 300 | device_initial_values d
= [ C.Blank,
C.MultiComment ["Initial register values (currently 0)"],
C.EnumDecl (device_initial_enum_name d)
[ C.EnumItem (register_initial_name r) (Just $ C.HexConstant $ 0)
| r <- (Dev.registers d) ],
C.Blank ] | 300 | false | false | 0 | 12 | 92 | 91 | 47 | 44 | null | null |
damianfral/clay | src/Clay/List.hs | bsd-3-clause | upperAlpha = ListStyleType "upper-alpha" | 49 | upperAlpha = ListStyleType "upper-alpha" | 49 | upperAlpha = ListStyleType "upper-alpha" | 49 | false | false | 1 | 5 | 12 | 12 | 4 | 8 | null | null |
oldmanmike/ghc | compiler/hsSyn/HsDecls.hs | bsd-3-clause | instDeclDataFamInsts :: [LInstDecl name] -> [DataFamInstDecl name]
instDeclDataFamInsts inst_decls
= concatMap do_one inst_decls
where
do_one (L _ (ClsInstD { cid_inst = ClsInstDecl { cid_datafam_insts = fam_insts } }))
= map unLoc fam_insts
do_one (L _ (DataFamInstD { dfid_inst = fam_inst })) = [fam_inst]
do_one (L _ (TyFamInstD {})) = []
{-
************************************************************************
* *
\subsection[DerivDecl]{A stand-alone instance deriving declaration}
* *
************************************************************************
-} | 764 | instDeclDataFamInsts :: [LInstDecl name] -> [DataFamInstDecl name]
instDeclDataFamInsts inst_decls
= concatMap do_one inst_decls
where
do_one (L _ (ClsInstD { cid_inst = ClsInstDecl { cid_datafam_insts = fam_insts } }))
= map unLoc fam_insts
do_one (L _ (DataFamInstD { dfid_inst = fam_inst })) = [fam_inst]
do_one (L _ (TyFamInstD {})) = []
{-
************************************************************************
* *
\subsection[DerivDecl]{A stand-alone instance deriving declaration}
* *
************************************************************************
-} | 764 | instDeclDataFamInsts inst_decls
= concatMap do_one inst_decls
where
do_one (L _ (ClsInstD { cid_inst = ClsInstDecl { cid_datafam_insts = fam_insts } }))
= map unLoc fam_insts
do_one (L _ (DataFamInstD { dfid_inst = fam_inst })) = [fam_inst]
do_one (L _ (TyFamInstD {})) = []
{-
************************************************************************
* *
\subsection[DerivDecl]{A stand-alone instance deriving declaration}
* *
************************************************************************
-} | 697 | false | true | 0 | 13 | 257 | 140 | 71 | 69 | null | null |
pparkkin/eta | compiler/ETA/Rename/RnBinds.hs | bsd-3-clause | methodBindErr :: HsBindLR RdrName RdrName -> SDoc
methodBindErr mbind
= hang (ptext (sLit "Pattern bindings (except simple variables) not allowed in instance declarations"))
2 (ppr mbind) | 196 | methodBindErr :: HsBindLR RdrName RdrName -> SDoc
methodBindErr mbind
= hang (ptext (sLit "Pattern bindings (except simple variables) not allowed in instance declarations"))
2 (ppr mbind) | 196 | methodBindErr mbind
= hang (ptext (sLit "Pattern bindings (except simple variables) not allowed in instance declarations"))
2 (ppr mbind) | 146 | false | true | 0 | 9 | 34 | 48 | 23 | 25 | null | null |
ardumont/haskell-platform | hptool/src/Website.hs | bsd-3-clause | historyCtx :: (Monad m) => MuContext m
historyCtx = mkStrContext outerCtx
where
outerCtx "history" = MuList [mkStrContext ctx]
outerCtx _ = MuNothing
ctx "hpReleases" = mapListStrContext rlsCtx releasesNewToOld
ctx "ncols" = MuVariable $ length releasesNewToOld + 1
ctx "sections" = MuList
[ sectionCtx "Compiler" [isGhc, not . isLib]
, sectionCtx "Core Libraries, provided with GHC" [isGhc, isLib]
, sectionCtx "Additional Platform Libraries" [not . isGhc, isLib]
, sectionCtx "Programs and Tools" [isTool]
]
ctx _ = MuNothing
rlsCtx rls "hpVersion" = MuVariable . showVersion . hpVersion . relVersion $ rls
rlsCtx _ _ = MuNothing | 759 | historyCtx :: (Monad m) => MuContext m
historyCtx = mkStrContext outerCtx
where
outerCtx "history" = MuList [mkStrContext ctx]
outerCtx _ = MuNothing
ctx "hpReleases" = mapListStrContext rlsCtx releasesNewToOld
ctx "ncols" = MuVariable $ length releasesNewToOld + 1
ctx "sections" = MuList
[ sectionCtx "Compiler" [isGhc, not . isLib]
, sectionCtx "Core Libraries, provided with GHC" [isGhc, isLib]
, sectionCtx "Additional Platform Libraries" [not . isGhc, isLib]
, sectionCtx "Programs and Tools" [isTool]
]
ctx _ = MuNothing
rlsCtx rls "hpVersion" = MuVariable . showVersion . hpVersion . relVersion $ rls
rlsCtx _ _ = MuNothing | 759 | historyCtx = mkStrContext outerCtx
where
outerCtx "history" = MuList [mkStrContext ctx]
outerCtx _ = MuNothing
ctx "hpReleases" = mapListStrContext rlsCtx releasesNewToOld
ctx "ncols" = MuVariable $ length releasesNewToOld + 1
ctx "sections" = MuList
[ sectionCtx "Compiler" [isGhc, not . isLib]
, sectionCtx "Core Libraries, provided with GHC" [isGhc, isLib]
, sectionCtx "Additional Platform Libraries" [not . isGhc, isLib]
, sectionCtx "Programs and Tools" [isTool]
]
ctx _ = MuNothing
rlsCtx rls "hpVersion" = MuVariable . showVersion . hpVersion . relVersion $ rls
rlsCtx _ _ = MuNothing | 720 | false | true | 7 | 14 | 222 | 201 | 102 | 99 | null | null |
brendanhay/gogol | gogol-gmail/gen/Network/Google/Resource/Gmail/Users/Threads/Modify.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
utmUploadProtocol :: Lens' UsersThreadsModify (Maybe Text)
utmUploadProtocol
= lens _utmUploadProtocol
(\ s a -> s{_utmUploadProtocol = a}) | 209 | utmUploadProtocol :: Lens' UsersThreadsModify (Maybe Text)
utmUploadProtocol
= lens _utmUploadProtocol
(\ s a -> s{_utmUploadProtocol = a}) | 147 | utmUploadProtocol
= lens _utmUploadProtocol
(\ s a -> s{_utmUploadProtocol = a}) | 88 | true | true | 0 | 8 | 33 | 49 | 25 | 24 | null | null |
acowley/roshask | src/Ros/Node/RosTcp.hs | bsd-3-clause | bracketOnErrorME :: MonadError e m => m a -> (a -> m b) -> (a -> m c) -> m c
bracketOnErrorME before after thing = do
a <- before
let handler e = after a >> throwError e
catchError (thing a) handler
-- | Catch any IOErrors and convert them to a different type | 266 | bracketOnErrorME :: MonadError e m => m a -> (a -> m b) -> (a -> m c) -> m c
bracketOnErrorME before after thing = do
a <- before
let handler e = after a >> throwError e
catchError (thing a) handler
-- | Catch any IOErrors and convert them to a different type | 266 | bracketOnErrorME before after thing = do
a <- before
let handler e = after a >> throwError e
catchError (thing a) handler
-- | Catch any IOErrors and convert them to a different type | 189 | false | true | 0 | 12 | 61 | 115 | 51 | 64 | null | null |
bitemyapp/persistent | persistent-test/src/EquivalentTypeTest.hs | mit | specs :: Spec
specs = describe "doesn't migrate equivalent types" $ do
it "works" $ asIO $ runResourceT $ runConn $ do
#ifdef WITH_POSTGRESQL
_ <- rawExecute "DROP DOMAIN IF EXISTS us_postal_code CASCADE" []
_ <- rawExecute "CREATE DOMAIN us_postal_code AS TEXT CHECK(VALUE ~ '^\\d{5}$')" []
#endif
#ifndef WITH_NOSQL
_ <- runMigrationSilent migrateAll1
xs <- getMigration migrateAll2
liftIO $ xs @?= []
#else
return ()
#endif | 480 | specs :: Spec
specs = describe "doesn't migrate equivalent types" $ do
it "works" $ asIO $ runResourceT $ runConn $ do
#ifdef WITH_POSTGRESQL
_ <- rawExecute "DROP DOMAIN IF EXISTS us_postal_code CASCADE" []
_ <- rawExecute "CREATE DOMAIN us_postal_code AS TEXT CHECK(VALUE ~ '^\\d{5}$')" []
#endif
#ifndef WITH_NOSQL
_ <- runMigrationSilent migrateAll1
xs <- getMigration migrateAll2
liftIO $ xs @?= []
#else
return ()
#endif | 480 | specs = describe "doesn't migrate equivalent types" $ do
it "works" $ asIO $ runResourceT $ runConn $ do
#ifdef WITH_POSTGRESQL
_ <- rawExecute "DROP DOMAIN IF EXISTS us_postal_code CASCADE" []
_ <- rawExecute "CREATE DOMAIN us_postal_code AS TEXT CHECK(VALUE ~ '^\\d{5}$')" []
#endif
#ifndef WITH_NOSQL
_ <- runMigrationSilent migrateAll1
xs <- getMigration migrateAll2
liftIO $ xs @?= []
#else
return ()
#endif | 466 | false | true | 0 | 14 | 119 | 112 | 50 | 62 | null | null |
IxpertaSolutions/freer-effects | src/Data/OpenUnion/Internal.hs | bsd-3-clause | -- | Project a value of type @'Union' (t ': r) :: * -> *@ into a possible
-- summand of the type @t :: * -> *@. 'Nothing' means that @t :: * -> *@ is not
-- the value stored in the @'Union' (t ': r) :: * -> *@.
--
-- It is assumed that summand is stored in the 'Union' when the 'Word' value is
-- the same value as is stored in the 'Union'.
--
-- __This function is unsafe.__
--
-- /O(1)/
unsafePrj :: Word -> Union r a -> Maybe (t a)
unsafePrj n (Union n' x)
| n == n' = Just (unsafeCoerce x)
| otherwise = Nothing | 521 | unsafePrj :: Word -> Union r a -> Maybe (t a)
unsafePrj n (Union n' x)
| n == n' = Just (unsafeCoerce x)
| otherwise = Nothing | 132 | unsafePrj n (Union n' x)
| n == n' = Just (unsafeCoerce x)
| otherwise = Nothing | 86 | true | true | 0 | 10 | 121 | 91 | 46 | 45 | null | null |
oldmanmike/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | ctLocLevel :: CtLoc -> TcLevel
ctLocLevel loc = tcl_tclvl (ctLocEnv loc) | 72 | ctLocLevel :: CtLoc -> TcLevel
ctLocLevel loc = tcl_tclvl (ctLocEnv loc) | 72 | ctLocLevel loc = tcl_tclvl (ctLocEnv loc) | 41 | false | true | 0 | 7 | 10 | 33 | 14 | 19 | null | null |
AlexanderPankiv/ghc | compiler/simplCore/CoreMonad.hs | bsd-3-clause | doFreeSimplTick tick sc@SimplCount { details = dts }
= sc { details = dts `addTick` tick } | 92 | doFreeSimplTick tick sc@SimplCount { details = dts }
= sc { details = dts `addTick` tick } | 92 | doFreeSimplTick tick sc@SimplCount { details = dts }
= sc { details = dts `addTick` tick } | 92 | false | false | 0 | 9 | 18 | 37 | 21 | 16 | null | null |
urbanslug/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitPrimOp dflags res WriteOffAddrOp_WideChar args = doWriteOffAddrOp (Just (mo_WordTo32 dflags)) b32 res args | 118 | emitPrimOp dflags res WriteOffAddrOp_WideChar args = doWriteOffAddrOp (Just (mo_WordTo32 dflags)) b32 res args | 118 | emitPrimOp dflags res WriteOffAddrOp_WideChar args = doWriteOffAddrOp (Just (mo_WordTo32 dflags)) b32 res args | 118 | false | false | 0 | 9 | 20 | 37 | 17 | 20 | null | null |
coreyoconnor/bind-marshal | src/Bind/Marshal/Action/Monad.hs | bsd-3-clause | resolve_iter !required_size !bd_iter = case max_bytes_final bd_iter of
0 -> case required_size > max_bytes_avail bd_iter of
True -> gen_region required_size (buffer_delegate bd_iter)
False -> returnM ( bd_iter { max_bytes_final = required_size } )
finalized_size -> case required_size + finalized_size > max_bytes_avail bd_iter of
True -> gen_region required_size =<< finalize_region bd_iter
False -> returnM ( bd_iter { max_bytes_final = finalized_size + required_size } )
{- A dynamic memory action bound to another dynamic memory action needs to account for buffering in
- some cases.
-
- By some flimsy application of the monad laws it is sufficient to analyse only the following
- equation to determine the rules for a dynamic action bound to another dynamic action:*
- pre_action >> post_action = equiv_action
-
- Given: A dynamic action is provides the necessary buffering for the mid and post memory actions.
-
- No bind between two dynamic actions requires the insertion of buffering. All buffering is already
- accounted for by the post_action's pre actions and the post_action's post actions. In this case the
- post_action's pre_action IS the pre_actions' and therefor the required buffering is handled by
- the pre_action.
-
- In the case where a pre_action is a static memory action no buffering needs to be inserted: The
- post_action already accounts for the buffering required for it's execution. The pre_action does
- not already account for the buffering required for it's execution however the buffering will be
- inserted.
-
- In the case where a post_action is a static memory action buffer handling needs to be inserted
e only if the pre_action is a dynamic action which has an empty post action. If the dynamic action
- does not have an empty post action then the buffering for the static action is already covered by
- the dynamic action.
-
- * This assumes the dynamic action is a monad. However the rules we are deriving from analyzing
- this equation effect whether or not a dynamic action is a monad. If the derived rules do not
- suppor the monad laws then only analyzing that equation is insufficient.
-} | 2,304 | resolve_iter !required_size !bd_iter = case max_bytes_final bd_iter of
0 -> case required_size > max_bytes_avail bd_iter of
True -> gen_region required_size (buffer_delegate bd_iter)
False -> returnM ( bd_iter { max_bytes_final = required_size } )
finalized_size -> case required_size + finalized_size > max_bytes_avail bd_iter of
True -> gen_region required_size =<< finalize_region bd_iter
False -> returnM ( bd_iter { max_bytes_final = finalized_size + required_size } )
{- A dynamic memory action bound to another dynamic memory action needs to account for buffering in
- some cases.
-
- By some flimsy application of the monad laws it is sufficient to analyse only the following
- equation to determine the rules for a dynamic action bound to another dynamic action:*
- pre_action >> post_action = equiv_action
-
- Given: A dynamic action is provides the necessary buffering for the mid and post memory actions.
-
- No bind between two dynamic actions requires the insertion of buffering. All buffering is already
- accounted for by the post_action's pre actions and the post_action's post actions. In this case the
- post_action's pre_action IS the pre_actions' and therefor the required buffering is handled by
- the pre_action.
-
- In the case where a pre_action is a static memory action no buffering needs to be inserted: The
- post_action already accounts for the buffering required for it's execution. The pre_action does
- not already account for the buffering required for it's execution however the buffering will be
- inserted.
-
- In the case where a post_action is a static memory action buffer handling needs to be inserted
e only if the pre_action is a dynamic action which has an empty post action. If the dynamic action
- does not have an empty post action then the buffering for the static action is already covered by
- the dynamic action.
-
- * This assumes the dynamic action is a monad. However the rules we are deriving from analyzing
- this equation effect whether or not a dynamic action is a monad. If the derived rules do not
- suppor the monad laws then only analyzing that equation is insufficient.
-} | 2,304 | resolve_iter !required_size !bd_iter = case max_bytes_final bd_iter of
0 -> case required_size > max_bytes_avail bd_iter of
True -> gen_region required_size (buffer_delegate bd_iter)
False -> returnM ( bd_iter { max_bytes_final = required_size } )
finalized_size -> case required_size + finalized_size > max_bytes_avail bd_iter of
True -> gen_region required_size =<< finalize_region bd_iter
False -> returnM ( bd_iter { max_bytes_final = finalized_size + required_size } )
{- A dynamic memory action bound to another dynamic memory action needs to account for buffering in
- some cases.
-
- By some flimsy application of the monad laws it is sufficient to analyse only the following
- equation to determine the rules for a dynamic action bound to another dynamic action:*
- pre_action >> post_action = equiv_action
-
- Given: A dynamic action is provides the necessary buffering for the mid and post memory actions.
-
- No bind between two dynamic actions requires the insertion of buffering. All buffering is already
- accounted for by the post_action's pre actions and the post_action's post actions. In this case the
- post_action's pre_action IS the pre_actions' and therefor the required buffering is handled by
- the pre_action.
-
- In the case where a pre_action is a static memory action no buffering needs to be inserted: The
- post_action already accounts for the buffering required for it's execution. The pre_action does
- not already account for the buffering required for it's execution however the buffering will be
- inserted.
-
- In the case where a post_action is a static memory action buffer handling needs to be inserted
e only if the pre_action is a dynamic action which has an empty post action. If the dynamic action
- does not have an empty post action then the buffering for the static action is already covered by
- the dynamic action.
-
- * This assumes the dynamic action is a monad. However the rules we are deriving from analyzing
- this equation effect whether or not a dynamic action is a monad. If the derived rules do not
- suppor the monad laws then only analyzing that equation is insufficient.
-} | 2,304 | false | false | 0 | 15 | 523 | 139 | 67 | 72 | null | null |
damoxc/ganeti | src/Ganeti/OpParams.hs | gpl-2.0 | tagObjectFrom TagTypeCluster JSNull = return TagCluster | 62 | tagObjectFrom TagTypeCluster JSNull = return TagCluster | 62 | tagObjectFrom TagTypeCluster JSNull = return TagCluster | 62 | false | false | 0 | 5 | 12 | 14 | 6 | 8 | null | null |
christiaanb/SoOSiM-components | src/SoOSiM/Components/ProcManager/Behaviour.hs | mit | procMgr ::
PM_State
-> Input PM_Cmd
-> Sim PM_State
procMgr s i = execStateT (behaviour i) s >>= yield | 108 | procMgr ::
PM_State
-> Input PM_Cmd
-> Sim PM_State
procMgr s i = execStateT (behaviour i) s >>= yield | 108 | procMgr s i = execStateT (behaviour i) s >>= yield | 50 | false | true | 0 | 8 | 24 | 50 | 22 | 28 | null | null |
mpkh/Idris-dev | src/IRTS/Lang.hs | bsd-3-clause | lsubst n new (LOp op args) = let args' = map (lsubst n new) args in
LOp op args' | 113 | lsubst n new (LOp op args) = let args' = map (lsubst n new) args in
LOp op args' | 113 | lsubst n new (LOp op args) = let args' = map (lsubst n new) args in
LOp op args' | 113 | false | false | 0 | 11 | 51 | 53 | 23 | 30 | null | null |
jsavatgy/hatupist | code/settings.hs | gpl-2.0 | tableRRefreshMs = 500 | 21 | tableRRefreshMs = 500 | 21 | tableRRefreshMs = 500 | 21 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
jrockway/c2hs | src/C2HS/Gen/Bind.hs | gpl-2.0 | showExtType (PrimET CCharPT) = "CChar" | 45 | showExtType (PrimET CCharPT) = "CChar" | 45 | showExtType (PrimET CCharPT) = "CChar" | 45 | false | false | 0 | 7 | 11 | 15 | 7 | 8 | null | null |
cliffano/swaggy-jenkins | clients/haskell-http-client/generated/lib/SwaggyJenkins/ModelLens.hs | mit | -- | 'freeStyleBuildDescription' Lens
freeStyleBuildDescriptionL :: Lens_' FreeStyleBuild (Maybe Text)
freeStyleBuildDescriptionL f FreeStyleBuild{..} = (\freeStyleBuildDescription -> FreeStyleBuild { freeStyleBuildDescription, ..} ) <$> f freeStyleBuildDescription | 265 | freeStyleBuildDescriptionL :: Lens_' FreeStyleBuild (Maybe Text)
freeStyleBuildDescriptionL f FreeStyleBuild{..} = (\freeStyleBuildDescription -> FreeStyleBuild { freeStyleBuildDescription, ..} ) <$> f freeStyleBuildDescription | 227 | freeStyleBuildDescriptionL f FreeStyleBuild{..} = (\freeStyleBuildDescription -> FreeStyleBuild { freeStyleBuildDescription, ..} ) <$> f freeStyleBuildDescription | 162 | true | true | 0 | 8 | 23 | 57 | 30 | 27 | null | null |
matthieu/witty | haskell/src/interpr.hs | apache-2.0 | evalWy wa@(WyApplic fn vals pos) = put pos >> do
env <- ask
efn <- eval fn
let ps = params efn
case adjust WyNull WyList ps vals $ length vals - (fst $ unslurps ps) of
Nothing -> paramErr ps vals
Just adjv -> if (length adjv == length ps)
-- normal application
then apply adjv vals efn
-- partial application
else let rmndr = drop (length adjv) ps
newps = vals ++ map (flip WyId pos) rmndr
in return $ WyLambda rmndr (WyApplic fn newps pos) env
where
params (WyLambda ps _ _) = ps
params (WyPrimitive _ ps _) = ps
params (WyCont _) = ["c"] | 701 | evalWy wa@(WyApplic fn vals pos) = put pos >> do
env <- ask
efn <- eval fn
let ps = params efn
case adjust WyNull WyList ps vals $ length vals - (fst $ unslurps ps) of
Nothing -> paramErr ps vals
Just adjv -> if (length adjv == length ps)
-- normal application
then apply adjv vals efn
-- partial application
else let rmndr = drop (length adjv) ps
newps = vals ++ map (flip WyId pos) rmndr
in return $ WyLambda rmndr (WyApplic fn newps pos) env
where
params (WyLambda ps _ _) = ps
params (WyPrimitive _ ps _) = ps
params (WyCont _) = ["c"] | 701 | evalWy wa@(WyApplic fn vals pos) = put pos >> do
env <- ask
efn <- eval fn
let ps = params efn
case adjust WyNull WyList ps vals $ length vals - (fst $ unslurps ps) of
Nothing -> paramErr ps vals
Just adjv -> if (length adjv == length ps)
-- normal application
then apply adjv vals efn
-- partial application
else let rmndr = drop (length adjv) ps
newps = vals ++ map (flip WyId pos) rmndr
in return $ WyLambda rmndr (WyApplic fn newps pos) env
where
params (WyLambda ps _ _) = ps
params (WyPrimitive _ ps _) = ps
params (WyCont _) = ["c"] | 701 | false | false | 2 | 19 | 270 | 266 | 127 | 139 | null | null |
kawamuray/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | -- * Storage fields
-- ** First two are valid in LU context only, not passed to backend
sfNode :: String
sfNode = "node" | 121 | sfNode :: String
sfNode = "node" | 32 | sfNode = "node" | 15 | true | true | 0 | 4 | 24 | 13 | 8 | 5 | null | null |
TOSPIO/yi | src/library/Yi/File.hs | gpl-2.0 | -- | Write a given buffer to disk if it is associated with a file.
fwriteBufferE :: BufferRef -> YiM Bool
fwriteBufferE bufferKey = do
nameContents <- withGivenBuffer bufferKey $ do
fl <- gets file
st <- streamB Forward 0
conv <- use encodingConverterNameA
return (fl, st, conv)
case nameContents of
(Just f, contents, conv) -> io (doesDirectoryExist f) >>= \case
True -> printMsg "Can't save over a directory, doing nothing." >> return False
False -> do
hooks <- view preSaveHooks <$> askCfg
mapM_ runAction hooks
mayErr <- liftBase $ case conv of
Nothing -> R.writeFileUsingText f contents >> return Nothing
Just cn -> R.writeFile f contents cn
case mayErr of
Just err -> printMsg err >> return False
Nothing -> io getCurrentTime >>= withGivenBuffer bufferKey . markSavedB
>> return True
(Nothing, _, _) -> printMsg "Buffer not associated with a file" >> return False
-- | Write current buffer to disk as @f@. The file is also set to @f@. | 1,075 | fwriteBufferE :: BufferRef -> YiM Bool
fwriteBufferE bufferKey = do
nameContents <- withGivenBuffer bufferKey $ do
fl <- gets file
st <- streamB Forward 0
conv <- use encodingConverterNameA
return (fl, st, conv)
case nameContents of
(Just f, contents, conv) -> io (doesDirectoryExist f) >>= \case
True -> printMsg "Can't save over a directory, doing nothing." >> return False
False -> do
hooks <- view preSaveHooks <$> askCfg
mapM_ runAction hooks
mayErr <- liftBase $ case conv of
Nothing -> R.writeFileUsingText f contents >> return Nothing
Just cn -> R.writeFile f contents cn
case mayErr of
Just err -> printMsg err >> return False
Nothing -> io getCurrentTime >>= withGivenBuffer bufferKey . markSavedB
>> return True
(Nothing, _, _) -> printMsg "Buffer not associated with a file" >> return False
-- | Write current buffer to disk as @f@. The file is also set to @f@. | 1,008 | fwriteBufferE bufferKey = do
nameContents <- withGivenBuffer bufferKey $ do
fl <- gets file
st <- streamB Forward 0
conv <- use encodingConverterNameA
return (fl, st, conv)
case nameContents of
(Just f, contents, conv) -> io (doesDirectoryExist f) >>= \case
True -> printMsg "Can't save over a directory, doing nothing." >> return False
False -> do
hooks <- view preSaveHooks <$> askCfg
mapM_ runAction hooks
mayErr <- liftBase $ case conv of
Nothing -> R.writeFileUsingText f contents >> return Nothing
Just cn -> R.writeFile f contents cn
case mayErr of
Just err -> printMsg err >> return False
Nothing -> io getCurrentTime >>= withGivenBuffer bufferKey . markSavedB
>> return True
(Nothing, _, _) -> printMsg "Buffer not associated with a file" >> return False
-- | Write current buffer to disk as @f@. The file is also set to @f@. | 969 | true | true | 0 | 23 | 295 | 299 | 138 | 161 | null | null |
gbataille/pandoc | src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs | gpl-2.0 | eitherToMaybe (Right a) = Just a | 32 | eitherToMaybe (Right a) = Just a | 32 | eitherToMaybe (Right a) = Just a | 32 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
batterseapower/chsc | examples/imaginary/Bernouilli.hs | bsd-3-clause | add'Rational = (Prelude.+) :: Rational -> Rational -> Rational | 62 | add'Rational = (Prelude.+) :: Rational -> Rational -> Rational | 62 | add'Rational = (Prelude.+) :: Rational -> Rational -> Rational | 62 | false | false | 0 | 6 | 8 | 21 | 12 | 9 | null | null |
plcplc/typed-rest | types/src/Network/HTTP/Rest/Match.hs | gpl-3.0 | atchFailed :: Match e a -> Bool
isMatchFailed (MatchErr _) = True
is | 68 | isMatchFailed :: Match e a -> Bool
isMatchFailed (MatchErr _) = True | 68 | isMatchFailed (MatchErr _) = True | 33 | false | true | 0 | 9 | 12 | 38 | 16 | 22 | null | null |
afcowie/openstack-haskell | tests/Experiment.hs | mit | main :: IO ()
main = do
let syd1 = "https://keystone.syd.opencloud.anchor.hosting:5000/v2.0"
let auth = Credentials "afcowie" "stack123" "vaultaire"
token <- requestToken syd1 auth
result <- runExceptT $ do
image <- viaGlance token $ do
getImage "coreos"
server <- viaNova token $ do
listInstances
createServer "vaultire-009" image
-- other
viaKeystone token $ do
validateToken
either throwIO print result
{-
main :: IO ()
main = do
let syd1 = "https://keystone.syd.opencloud.anchor.hosting:5000/v2.0"
let auth = Credentials "afcowie" "stack123" "vaultaire"
withOpenStack syd1 auth $ do
image <- getImage "coreos"
createServerFromImage "vaultaire-010" image
-} | 811 | main :: IO ()
main = do
let syd1 = "https://keystone.syd.opencloud.anchor.hosting:5000/v2.0"
let auth = Credentials "afcowie" "stack123" "vaultaire"
token <- requestToken syd1 auth
result <- runExceptT $ do
image <- viaGlance token $ do
getImage "coreos"
server <- viaNova token $ do
listInstances
createServer "vaultire-009" image
-- other
viaKeystone token $ do
validateToken
either throwIO print result
{-
main :: IO ()
main = do
let syd1 = "https://keystone.syd.opencloud.anchor.hosting:5000/v2.0"
let auth = Credentials "afcowie" "stack123" "vaultaire"
withOpenStack syd1 auth $ do
image <- getImage "coreos"
createServerFromImage "vaultaire-010" image
-} | 811 | main = do
let syd1 = "https://keystone.syd.opencloud.anchor.hosting:5000/v2.0"
let auth = Credentials "afcowie" "stack123" "vaultaire"
token <- requestToken syd1 auth
result <- runExceptT $ do
image <- viaGlance token $ do
getImage "coreos"
server <- viaNova token $ do
listInstances
createServer "vaultire-009" image
-- other
viaKeystone token $ do
validateToken
either throwIO print result
{-
main :: IO ()
main = do
let syd1 = "https://keystone.syd.opencloud.anchor.hosting:5000/v2.0"
let auth = Credentials "afcowie" "stack123" "vaultaire"
withOpenStack syd1 auth $ do
image <- getImage "coreos"
createServerFromImage "vaultaire-010" image
-} | 797 | false | true | 0 | 16 | 239 | 140 | 59 | 81 | null | null |
IreneKnapp/Faction | libfaction/Distribution/PackageDescription.hs | bsd-3-clause | -- |does this package have any apps?
hasApps :: PackageDescription -> Bool
hasApps p = any (buildable . appBuildInfo) (apps p) | 126 | hasApps :: PackageDescription -> Bool
hasApps p = any (buildable . appBuildInfo) (apps p) | 89 | hasApps p = any (buildable . appBuildInfo) (apps p) | 51 | true | true | 0 | 7 | 20 | 37 | 19 | 18 | null | null |
kylcarte/games | src/Automata/Langton.hs | bsd-3-clause | straight = id | 13 | straight = id | 13 | straight = id | 13 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
Airtnp/Freshman_Simple_Haskell_Lib | Intro/hello-world.hs | mit | -- view
-- view :: ((a -> Const a a) -> b -> Const a b) -> b -> a
view_alt :: Lens_alt b a -> b -> a
view_alt lens = getConst_alt . (lens Const_alt) | 148 | view_alt :: Lens_alt b a -> b -> a
view_alt lens = getConst_alt . (lens Const_alt) | 82 | view_alt lens = getConst_alt . (lens Const_alt) | 47 | true | true | 0 | 8 | 35 | 45 | 21 | 24 | null | null |
neothemachine/monadiccp | src/Data/Expr/Util.hs | bsd-3-clause | simplify (Div (Mult (Const a) b) (Const c)) | (a `mod` c)==0 = simplify $ Mult (Const (a `div` c)) b | 100 | simplify (Div (Mult (Const a) b) (Const c)) | (a `mod` c)==0 = simplify $ Mult (Const (a `div` c)) b | 100 | simplify (Div (Mult (Const a) b) (Const c)) | (a `mod` c)==0 = simplify $ Mult (Const (a `div` c)) b | 100 | false | false | 0 | 11 | 20 | 80 | 41 | 39 | null | null |
andreagenso/java2scala | src/J2s/Parser.hs | apache-2.0 | -- pClassModifiers = pList pClassModifier XX
pModifier = AGS.sem_Modifier_ModifierPublic <$ pKeyWord "public"
<|> AGS.sem_Modifier_ModifierProtected <$ pKeyWord "protected"
<|> AGS.sem_Modifier_ModifierPrivate <$ pKeyWord "private"
<|> AGS.sem_Modifier_ModifierAbstract <$ pKeyWord "abstract"
<|> AGS.sem_Modifier_ModifiersStatic <$ pKeyWord "static"
<|> AGS.sem_Modifier_ModifierFinal <$ pKeyWord "final"
<|> AGS.sem_Modifier_ModifierStrictfp <$ pKeyWord "strictfp"
<|> AGS.sem_Modifier_FieldModifierVolatile <$ pKeyWord "volatile"
<|> AGS.sem_Modifier_FieldModifierTransient <$ pKeyWord "transient"
<|> AGS.sem_Modifier_MethodModifierSynchronized <$ pKeyWord "synchronized"
<|> AGS.sem_Modifier_MethodModifierNative <$ pKeyWord "native"
<|> AGS.sem_Modifier_ModifierAnnotation <$> pAnnotation | 1,020 | pModifier = AGS.sem_Modifier_ModifierPublic <$ pKeyWord "public"
<|> AGS.sem_Modifier_ModifierProtected <$ pKeyWord "protected"
<|> AGS.sem_Modifier_ModifierPrivate <$ pKeyWord "private"
<|> AGS.sem_Modifier_ModifierAbstract <$ pKeyWord "abstract"
<|> AGS.sem_Modifier_ModifiersStatic <$ pKeyWord "static"
<|> AGS.sem_Modifier_ModifierFinal <$ pKeyWord "final"
<|> AGS.sem_Modifier_ModifierStrictfp <$ pKeyWord "strictfp"
<|> AGS.sem_Modifier_FieldModifierVolatile <$ pKeyWord "volatile"
<|> AGS.sem_Modifier_FieldModifierTransient <$ pKeyWord "transient"
<|> AGS.sem_Modifier_MethodModifierSynchronized <$ pKeyWord "synchronized"
<|> AGS.sem_Modifier_MethodModifierNative <$ pKeyWord "native"
<|> AGS.sem_Modifier_ModifierAnnotation <$> pAnnotation | 952 | pModifier = AGS.sem_Modifier_ModifierPublic <$ pKeyWord "public"
<|> AGS.sem_Modifier_ModifierProtected <$ pKeyWord "protected"
<|> AGS.sem_Modifier_ModifierPrivate <$ pKeyWord "private"
<|> AGS.sem_Modifier_ModifierAbstract <$ pKeyWord "abstract"
<|> AGS.sem_Modifier_ModifiersStatic <$ pKeyWord "static"
<|> AGS.sem_Modifier_ModifierFinal <$ pKeyWord "final"
<|> AGS.sem_Modifier_ModifierStrictfp <$ pKeyWord "strictfp"
<|> AGS.sem_Modifier_FieldModifierVolatile <$ pKeyWord "volatile"
<|> AGS.sem_Modifier_FieldModifierTransient <$ pKeyWord "transient"
<|> AGS.sem_Modifier_MethodModifierSynchronized <$ pKeyWord "synchronized"
<|> AGS.sem_Modifier_MethodModifierNative <$ pKeyWord "native"
<|> AGS.sem_Modifier_ModifierAnnotation <$> pAnnotation | 952 | true | false | 34 | 6 | 291 | 193 | 95 | 98 | null | null |
GaloisInc/sk-dev-platform | libs/lviz/LViz.hs | bsd-3-clause | parallel :: PosPx -> Double
parallel (0, 0) = error "unable to rotate point at origin" | 86 | parallel :: PosPx -> Double
parallel (0, 0) = error "unable to rotate point at origin" | 86 | parallel (0, 0) = error "unable to rotate point at origin" | 58 | false | true | 0 | 6 | 15 | 27 | 14 | 13 | null | null |
bb010g/aura | aura/lib/Aura/Languages.hs | gpl-3.0 | reportBadDowngradePkgs_2 :: PkgName -> Language -> Doc AnsiStyle
reportBadDowngradePkgs_2 (PkgName p) = \case
Spanish -> pretty p <+> "no tiene una versión en la caché."
Italian -> pretty p <+> "non ha alcuna versione nella cache."
Dutch -> pretty p <+> "heeft geen versie in de cache."
_ -> pretty p <+> "has no version in the cache." | 357 | reportBadDowngradePkgs_2 :: PkgName -> Language -> Doc AnsiStyle
reportBadDowngradePkgs_2 (PkgName p) = \case
Spanish -> pretty p <+> "no tiene una versión en la caché."
Italian -> pretty p <+> "non ha alcuna versione nella cache."
Dutch -> pretty p <+> "heeft geen versie in de cache."
_ -> pretty p <+> "has no version in the cache." | 357 | reportBadDowngradePkgs_2 (PkgName p) = \case
Spanish -> pretty p <+> "no tiene una versión en la caché."
Italian -> pretty p <+> "non ha alcuna versione nella cache."
Dutch -> pretty p <+> "heeft geen versie in de cache."
_ -> pretty p <+> "has no version in the cache." | 292 | false | true | 0 | 9 | 79 | 85 | 40 | 45 | null | null |
ulricha/dsh | src/Database/DSH/Common/VectorLang.hs | bsd-3-clause | idxOnly :: (TupleIndex -> Bool) -> TExpr -> Bool
idxOnly p (TBinApp _ e1 e2) = idxOnly p e1 && idxOnly p e2 | 109 | idxOnly :: (TupleIndex -> Bool) -> TExpr -> Bool
idxOnly p (TBinApp _ e1 e2) = idxOnly p e1 && idxOnly p e2 | 109 | idxOnly p (TBinApp _ e1 e2) = idxOnly p e1 && idxOnly p e2 | 60 | false | true | 0 | 7 | 24 | 55 | 27 | 28 | null | null |
spechub/Hets | TPTP/StaticAnalysis.hs | gpl-2.0 | signOfAtom :: Atom -> Sign
signOfAtom x = case x of
Atom_untyped a -> signOfUntyped_atom a
Atom_constant a -> signOfDefined_constant a | 138 | signOfAtom :: Atom -> Sign
signOfAtom x = case x of
Atom_untyped a -> signOfUntyped_atom a
Atom_constant a -> signOfDefined_constant a | 138 | signOfAtom x = case x of
Atom_untyped a -> signOfUntyped_atom a
Atom_constant a -> signOfDefined_constant a | 111 | false | true | 3 | 5 | 24 | 43 | 21 | 22 | null | null |
Shou/KawaiiBot-hs | KawaiiBot/Bot.hs | gpl-2.0 | logMsgs :: Memory [(T.Text, T.Text, T.Text)]
logMsgs = do
meta <- asks getMeta
logsPath <- asks (logsPathC . getConfig)
let path = logsPath ++ getServer meta ++ " " ++ getDestino meta
cs <- liftIO $ TL.readFile path
let msgs :: [(T.Text, T.Text, T.Text)]
msgs = do
line <- reverse $ TL.lines cs
let mresult = ATL.maybeResult . (flip ATL.parse) line $ do
time <- ATL.takeWhile1 (/= '\t')
ATL.char '\t'
nick <- ATL.takeWhile1 (/= '\t')
ATL.char '\t'
msg <- ATL.takeWhile1 (/= '\n')
return (time, nick, msg)
guard $ isJust mresult
return $ fromJust mresult
return msgs
-- | Print userlist | 786 | logMsgs :: Memory [(T.Text, T.Text, T.Text)]
logMsgs = do
meta <- asks getMeta
logsPath <- asks (logsPathC . getConfig)
let path = logsPath ++ getServer meta ++ " " ++ getDestino meta
cs <- liftIO $ TL.readFile path
let msgs :: [(T.Text, T.Text, T.Text)]
msgs = do
line <- reverse $ TL.lines cs
let mresult = ATL.maybeResult . (flip ATL.parse) line $ do
time <- ATL.takeWhile1 (/= '\t')
ATL.char '\t'
nick <- ATL.takeWhile1 (/= '\t')
ATL.char '\t'
msg <- ATL.takeWhile1 (/= '\n')
return (time, nick, msg)
guard $ isJust mresult
return $ fromJust mresult
return msgs
-- | Print userlist | 786 | logMsgs = do
meta <- asks getMeta
logsPath <- asks (logsPathC . getConfig)
let path = logsPath ++ getServer meta ++ " " ++ getDestino meta
cs <- liftIO $ TL.readFile path
let msgs :: [(T.Text, T.Text, T.Text)]
msgs = do
line <- reverse $ TL.lines cs
let mresult = ATL.maybeResult . (flip ATL.parse) line $ do
time <- ATL.takeWhile1 (/= '\t')
ATL.char '\t'
nick <- ATL.takeWhile1 (/= '\t')
ATL.char '\t'
msg <- ATL.takeWhile1 (/= '\n')
return (time, nick, msg)
guard $ isJust mresult
return $ fromJust mresult
return msgs
-- | Print userlist | 741 | false | true | 0 | 20 | 300 | 286 | 137 | 149 | null | null |
CheeseSucker/haskell-roguelike | src/TerminalStuff.hs | bsd-2-clause | consoleWidth :: IO Int
consoleWidth = do
e <- getEnv("COLUMNS")
return $ read e | 87 | consoleWidth :: IO Int
consoleWidth = do
e <- getEnv("COLUMNS")
return $ read e | 87 | consoleWidth = do
e <- getEnv("COLUMNS")
return $ read e | 64 | false | true | 0 | 10 | 21 | 43 | 18 | 25 | null | null |
miguelpagano/equ | TestSuite/Tests/Proof.hs | gpl-3.0 | -- Pruebas utilizadas en unit-test.
pFxEqY :: Proof
pFxEqY = Hole M.empty relEq fFx fy | 86 | pFxEqY :: Proof
pFxEqY = Hole M.empty relEq fFx fy | 50 | pFxEqY = Hole M.empty relEq fFx fy | 34 | true | true | 0 | 6 | 14 | 23 | 12 | 11 | null | null |
ku-fpg/kansas-amber | tests/TransTests/TransMultiTest1.hs | bsd-3-clause | myRead1 :: Word8 -> Arduino Bool
myRead1 p = do
delayMillis 100
a <- digitalRead (p+1)
return (not a) | 113 | myRead1 :: Word8 -> Arduino Bool
myRead1 p = do
delayMillis 100
a <- digitalRead (p+1)
return (not a) | 113 | myRead1 p = do
delayMillis 100
a <- digitalRead (p+1)
return (not a) | 80 | false | true | 0 | 11 | 30 | 61 | 26 | 35 | null | null |
exit91/hmatrix-lens | Numeric/LinearAlgebra/GivensRotation.hs | bsd-3-clause | triagonalize :: (Floating t, Element t, Ord t, Product t) => Matrix t -> Matrix t
triagonalize matrix =
let (r,c) = (rows matrix, cols matrix)
minrc = min r c
in flip id matrix . foldr (flip (.)) id $
do i <- [0..minrc-1]
j <- [0..i-1]
return (givens i j) | 296 | triagonalize :: (Floating t, Element t, Ord t, Product t) => Matrix t -> Matrix t
triagonalize matrix =
let (r,c) = (rows matrix, cols matrix)
minrc = min r c
in flip id matrix . foldr (flip (.)) id $
do i <- [0..minrc-1]
j <- [0..i-1]
return (givens i j) | 296 | triagonalize matrix =
let (r,c) = (rows matrix, cols matrix)
minrc = min r c
in flip id matrix . foldr (flip (.)) id $
do i <- [0..minrc-1]
j <- [0..i-1]
return (givens i j) | 214 | false | true | 0 | 12 | 92 | 163 | 80 | 83 | null | null |
wouwouwou/module_8 | src/main/haskell/series3/exercise5.hs | apache-2.0 | insertTree i (BinNode n t1 t2) | i < n = BinNode n (insertTree i t1) t2
| otherwise = BinNode n t1 (insertTree i t2) | 147 | insertTree i (BinNode n t1 t2) | i < n = BinNode n (insertTree i t1) t2
| otherwise = BinNode n t1 (insertTree i t2) | 147 | insertTree i (BinNode n t1 t2) | i < n = BinNode n (insertTree i t1) t2
| otherwise = BinNode n t1 (insertTree i t2) | 147 | false | false | 0 | 8 | 56 | 70 | 32 | 38 | null | null |
rueshyna/gogol | gogol-apps-calendar/gen/Network/Google/AppsCalendar/Types/Product.hs | mpl-2.0 | -- | The background color associated with this color definition.
cdBackgRound :: Lens' ColorDefinition (Maybe Text)
cdBackgRound
= lens _cdBackgRound (\ s a -> s{_cdBackgRound = a}) | 183 | cdBackgRound :: Lens' ColorDefinition (Maybe Text)
cdBackgRound
= lens _cdBackgRound (\ s a -> s{_cdBackgRound = a}) | 118 | cdBackgRound
= lens _cdBackgRound (\ s a -> s{_cdBackgRound = a}) | 67 | true | true | 0 | 9 | 28 | 48 | 25 | 23 | null | null |
li-zhirui/EoplLangs | src/SimpleModule/TypeChecker.hs | bsd-3-clause | typeOf (BinOpExpr op e1 e2) tenv = typeOfBinOpExpr op e1 e2 tenv | 67 | typeOf (BinOpExpr op e1 e2) tenv = typeOfBinOpExpr op e1 e2 tenv | 67 | typeOf (BinOpExpr op e1 e2) tenv = typeOfBinOpExpr op e1 e2 tenv | 67 | false | false | 0 | 7 | 14 | 30 | 14 | 16 | null | null |
thomie/haskell-platform | hptool/os-extras/osx/bin/uninstall-hs.hs | bsd-3-clause | message :: Options -> String -> IO ()
message opts str = putStrLn $ messagePrefix ++ str
where
messagePrefix = if (optRemove opts == OptScript) then "echo " else ""
--
-- Primitive File Operations
-- | 207 | message :: Options -> String -> IO ()
message opts str = putStrLn $ messagePrefix ++ str
where
messagePrefix = if (optRemove opts == OptScript) then "echo " else ""
--
-- Primitive File Operations
-- | 207 | message opts str = putStrLn $ messagePrefix ++ str
where
messagePrefix = if (optRemove opts == OptScript) then "echo " else ""
--
-- Primitive File Operations
-- | 169 | false | true | 0 | 8 | 43 | 66 | 35 | 31 | null | null |
MichielDerhaeg/stack | src/Stack/Build/ConstructPlan.hs | bsd-3-clause | tellExecutablesUpstream :: PackageIdentifierRevision -> InstallLocation -> Map FlagName Bool -> M ()
tellExecutablesUpstream pir@(PackageIdentifierRevision (PackageIdentifier name _) _) loc flags = do
ctx <- ask
when (name `Set.member` extraToBuild ctx) $ do
p <- liftIO $ loadPackage ctx (PLIndex pir) flags []
tellExecutablesPackage loc p | 364 | tellExecutablesUpstream :: PackageIdentifierRevision -> InstallLocation -> Map FlagName Bool -> M ()
tellExecutablesUpstream pir@(PackageIdentifierRevision (PackageIdentifier name _) _) loc flags = do
ctx <- ask
when (name `Set.member` extraToBuild ctx) $ do
p <- liftIO $ loadPackage ctx (PLIndex pir) flags []
tellExecutablesPackage loc p | 364 | tellExecutablesUpstream pir@(PackageIdentifierRevision (PackageIdentifier name _) _) loc flags = do
ctx <- ask
when (name `Set.member` extraToBuild ctx) $ do
p <- liftIO $ loadPackage ctx (PLIndex pir) flags []
tellExecutablesPackage loc p | 263 | false | true | 1 | 15 | 68 | 128 | 60 | 68 | null | null |
dec9ue/jhc_copygc | src/FrontEnd/TypeSyns.hs | gpl-2.0 | renameHsDecl (HsInfixDecl srcLoc assoc int hsNames) subTable = withSrcLoc srcLoc $ do
hsNames' <- renameHsNames hsNames subTable
return $ HsInfixDecl srcLoc assoc int hsNames' | 183 | renameHsDecl (HsInfixDecl srcLoc assoc int hsNames) subTable = withSrcLoc srcLoc $ do
hsNames' <- renameHsNames hsNames subTable
return $ HsInfixDecl srcLoc assoc int hsNames' | 183 | renameHsDecl (HsInfixDecl srcLoc assoc int hsNames) subTable = withSrcLoc srcLoc $ do
hsNames' <- renameHsNames hsNames subTable
return $ HsInfixDecl srcLoc assoc int hsNames' | 183 | false | false | 0 | 9 | 31 | 58 | 26 | 32 | null | null |
bflyblue/quadtree | Quadtree2.hs | unlicense | top :: Ord a => Zipper a -> Maybe (Zipper a)
top z@(Zipper _ _ []) = Just z | 75 | top :: Ord a => Zipper a -> Maybe (Zipper a)
top z@(Zipper _ _ []) = Just z | 75 | top z@(Zipper _ _ []) = Just z | 30 | false | true | 1 | 9 | 18 | 62 | 27 | 35 | null | null |
jean-edouard/manager | xenmgr/Vm/Config.hs | gpl-2.0 | vmKeepAlive = property "keep-alive" | 35 | vmKeepAlive = property "keep-alive" | 35 | vmKeepAlive = property "keep-alive" | 35 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Docteur-Lalla/HsSHAUN | src/Shaun/Syntax/Lexer.hs | bsd-3-clause | readString :: String -> Lexer Token
readString ('"':s) = readStringContents "" s
where
readStringContents _ "" = Left "expected end of string (symbol \")"
readStringContents acc ('"':cs) = Right (cs, Str $! reverse acc)
readStringContents acc ('\\':c:cs) = readStringContents (nc:acc) cs
where
nc =
case c of
'\\' -> '\\'
'n' -> '\n'
't' -> '\t'
'r' -> '\r'
_ -> c
readStringContents acc (c:cs) = readStringContents (c:acc) cs | 556 | readString :: String -> Lexer Token
readString ('"':s) = readStringContents "" s
where
readStringContents _ "" = Left "expected end of string (symbol \")"
readStringContents acc ('"':cs) = Right (cs, Str $! reverse acc)
readStringContents acc ('\\':c:cs) = readStringContents (nc:acc) cs
where
nc =
case c of
'\\' -> '\\'
'n' -> '\n'
't' -> '\t'
'r' -> '\r'
_ -> c
readStringContents acc (c:cs) = readStringContents (c:acc) cs | 554 | readString ('"':s) = readStringContents "" s
where
readStringContents _ "" = Left "expected end of string (symbol \")"
readStringContents acc ('"':cs) = Right (cs, Str $! reverse acc)
readStringContents acc ('\\':c:cs) = readStringContents (nc:acc) cs
where
nc =
case c of
'\\' -> '\\'
'n' -> '\n'
't' -> '\t'
'r' -> '\r'
_ -> c
readStringContents acc (c:cs) = readStringContents (c:acc) cs | 518 | false | true | 1 | 8 | 198 | 193 | 94 | 99 | null | null |
apoikos/pkg-xmobar | src/Plugins/Monitors/Top.hs | bsd-3-clause | showInfo :: String -> String -> Float -> Monitor [String]
showInfo nm sms mms = do
mnw <- getConfigValue maxWidth
mxw <- getConfigValue minWidth
let lsms = length sms
nmw = mnw - lsms - 1
nmx = mxw - lsms - 1
rnm = if nmw > 0 then padString nmw nmx " " True nm else nm
mstr <- showWithColors' sms mms
both <- showWithColors' (rnm ++ " " ++ sms) mms
return [nm, mstr, both] | 402 | showInfo :: String -> String -> Float -> Monitor [String]
showInfo nm sms mms = do
mnw <- getConfigValue maxWidth
mxw <- getConfigValue minWidth
let lsms = length sms
nmw = mnw - lsms - 1
nmx = mxw - lsms - 1
rnm = if nmw > 0 then padString nmw nmx " " True nm else nm
mstr <- showWithColors' sms mms
both <- showWithColors' (rnm ++ " " ++ sms) mms
return [nm, mstr, both] | 402 | showInfo nm sms mms = do
mnw <- getConfigValue maxWidth
mxw <- getConfigValue minWidth
let lsms = length sms
nmw = mnw - lsms - 1
nmx = mxw - lsms - 1
rnm = if nmw > 0 then padString nmw nmx " " True nm else nm
mstr <- showWithColors' sms mms
both <- showWithColors' (rnm ++ " " ++ sms) mms
return [nm, mstr, both] | 344 | false | true | 0 | 11 | 107 | 172 | 84 | 88 | null | null |
quickdudley/varroa | Neural.hs | agpl-3.0 | randomNNet gen (i:r@(n:_)) = let
i' = i + 1
(gen',l1) =
mapAccumL (const . uncurry (flip (,)) . randomR (-0.05, 0.05)) gen $
replicate ((i + 1) * n) ()
ar = ((0,0),(i, n - 1))
l1' = Layer $ array ar $ zip (range ar) l1
in l1' : randomNNet gen' r | 263 | randomNNet gen (i:r@(n:_)) = let
i' = i + 1
(gen',l1) =
mapAccumL (const . uncurry (flip (,)) . randomR (-0.05, 0.05)) gen $
replicate ((i + 1) * n) ()
ar = ((0,0),(i, n - 1))
l1' = Layer $ array ar $ zip (range ar) l1
in l1' : randomNNet gen' r | 263 | randomNNet gen (i:r@(n:_)) = let
i' = i + 1
(gen',l1) =
mapAccumL (const . uncurry (flip (,)) . randomR (-0.05, 0.05)) gen $
replicate ((i + 1) * n) ()
ar = ((0,0),(i, n - 1))
l1' = Layer $ array ar $ zip (range ar) l1
in l1' : randomNNet gen' r | 263 | false | false | 2 | 17 | 71 | 185 | 96 | 89 | null | null |
shayan-najd/HsParser | Ctype.hs | gpl-3.0 | is_ident, is_symbol, is_any, is_space, is_lower, is_upper, is_digit,
is_alphanum :: Char -> Bool
is_ident = is_ctype cIdent | 128 | is_ident, is_symbol, is_any, is_space, is_lower, is_upper, is_digit,
is_alphanum :: Char -> Bool
is_ident = is_ctype cIdent | 128 | is_ident = is_ctype cIdent | 27 | false | true | 2 | 5 | 20 | 36 | 23 | 13 | null | null |
stevejb71/Idris-dev | src/IRTS/CodegenJavaScript.hs | bsd-3-clause | initCompileInfo :: [(Name, [BC])] -> CompileInfo
initCompileInfo bc =
CompileInfo (collectCases "APPLY" bc) (collectCases "EVAL" bc) (lookupBigInt bc)
where
lookupBigInt :: [(Name, [BC])] -> Bool
lookupBigInt = any (needsBigInt . snd)
where
needsBigInt :: [BC] -> Bool
needsBigInt bc = any testBCForBigInt bc
where
testBCForBigInt :: BC -> Bool
testBCForBigInt (ASSIGNCONST _ c) =
testConstForBigInt c
testBCForBigInt (CONSTCASE _ c d) =
maybe False needsBigInt d
|| any (needsBigInt . snd) c
|| any (testConstForBigInt . fst) c
testBCForBigInt (CASE _ _ c d) =
maybe False needsBigInt d
|| any (needsBigInt . snd) c
testBCForBigInt _ = False
testConstForBigInt :: Const -> Bool
testConstForBigInt (BI _) = True
testConstForBigInt (B64 _) = True
testConstForBigInt _ = False
collectCases :: String -> [(Name, [BC])] -> [Int]
collectCases fun bc = getCases $ findFunction fun bc
findFunction :: String -> [(Name, [BC])] -> [BC]
findFunction f ((MN 0 fun, bc):_)
| fun == txt f = bc
findFunction f (_:bc) = findFunction f bc
getCases :: [BC] -> [Int]
getCases = concatMap analyze
where
analyze :: BC -> [Int]
analyze (CASE _ _ b _) = map fst b
analyze _ = [] | 1,492 | initCompileInfo :: [(Name, [BC])] -> CompileInfo
initCompileInfo bc =
CompileInfo (collectCases "APPLY" bc) (collectCases "EVAL" bc) (lookupBigInt bc)
where
lookupBigInt :: [(Name, [BC])] -> Bool
lookupBigInt = any (needsBigInt . snd)
where
needsBigInt :: [BC] -> Bool
needsBigInt bc = any testBCForBigInt bc
where
testBCForBigInt :: BC -> Bool
testBCForBigInt (ASSIGNCONST _ c) =
testConstForBigInt c
testBCForBigInt (CONSTCASE _ c d) =
maybe False needsBigInt d
|| any (needsBigInt . snd) c
|| any (testConstForBigInt . fst) c
testBCForBigInt (CASE _ _ c d) =
maybe False needsBigInt d
|| any (needsBigInt . snd) c
testBCForBigInt _ = False
testConstForBigInt :: Const -> Bool
testConstForBigInt (BI _) = True
testConstForBigInt (B64 _) = True
testConstForBigInt _ = False
collectCases :: String -> [(Name, [BC])] -> [Int]
collectCases fun bc = getCases $ findFunction fun bc
findFunction :: String -> [(Name, [BC])] -> [BC]
findFunction f ((MN 0 fun, bc):_)
| fun == txt f = bc
findFunction f (_:bc) = findFunction f bc
getCases :: [BC] -> [Int]
getCases = concatMap analyze
where
analyze :: BC -> [Int]
analyze (CASE _ _ b _) = map fst b
analyze _ = [] | 1,492 | initCompileInfo bc =
CompileInfo (collectCases "APPLY" bc) (collectCases "EVAL" bc) (lookupBigInt bc)
where
lookupBigInt :: [(Name, [BC])] -> Bool
lookupBigInt = any (needsBigInt . snd)
where
needsBigInt :: [BC] -> Bool
needsBigInt bc = any testBCForBigInt bc
where
testBCForBigInt :: BC -> Bool
testBCForBigInt (ASSIGNCONST _ c) =
testConstForBigInt c
testBCForBigInt (CONSTCASE _ c d) =
maybe False needsBigInt d
|| any (needsBigInt . snd) c
|| any (testConstForBigInt . fst) c
testBCForBigInt (CASE _ _ c d) =
maybe False needsBigInt d
|| any (needsBigInt . snd) c
testBCForBigInt _ = False
testConstForBigInt :: Const -> Bool
testConstForBigInt (BI _) = True
testConstForBigInt (B64 _) = True
testConstForBigInt _ = False
collectCases :: String -> [(Name, [BC])] -> [Int]
collectCases fun bc = getCases $ findFunction fun bc
findFunction :: String -> [(Name, [BC])] -> [BC]
findFunction f ((MN 0 fun, bc):_)
| fun == txt f = bc
findFunction f (_:bc) = findFunction f bc
getCases :: [BC] -> [Int]
getCases = concatMap analyze
where
analyze :: BC -> [Int]
analyze (CASE _ _ b _) = map fst b
analyze _ = [] | 1,443 | false | true | 28 | 9 | 527 | 535 | 275 | 260 | null | null |
trygvis/hledger | hledger-lib/Hledger/Read/JournalReader.hs | gpl-3.0 | -- Parse the following whitespace-beginning lines as postings, posting metadata, and/or comments.
-- complicated to handle intermixed comment and metadata lines.. make me better ?
ledgerpostings :: GenParser Char JournalContext [Posting]
ledgerpostings = do
ctx <- getState
-- pass current position to the sub-parses for more useful errors
pos <- getPosition
ls <- many1 $ try linebeginningwithspaces
let parses p = isRight . parseWithCtx ctx p
postinglines = filter (not . (ledgercommentline `parses`)) ls
-- group any metadata lines with the posting line above
postinglinegroups :: [String] -> [String]
postinglinegroups [] = []
postinglinegroups (pline:ls) = (unlines $ pline:mdlines):postinglinegroups rest
where (mdlines,rest) = span (ledgermetadataline `parses`) ls
pstrs = postinglinegroups postinglines
when (null pstrs) $ fail "no postings"
return $ map (fromparse . parseWithCtx ctx (setPosition pos >> ledgerposting)) pstrs
<?> "postings" | 1,011 | ledgerpostings :: GenParser Char JournalContext [Posting]
ledgerpostings = do
ctx <- getState
-- pass current position to the sub-parses for more useful errors
pos <- getPosition
ls <- many1 $ try linebeginningwithspaces
let parses p = isRight . parseWithCtx ctx p
postinglines = filter (not . (ledgercommentline `parses`)) ls
-- group any metadata lines with the posting line above
postinglinegroups :: [String] -> [String]
postinglinegroups [] = []
postinglinegroups (pline:ls) = (unlines $ pline:mdlines):postinglinegroups rest
where (mdlines,rest) = span (ledgermetadataline `parses`) ls
pstrs = postinglinegroups postinglines
when (null pstrs) $ fail "no postings"
return $ map (fromparse . parseWithCtx ctx (setPosition pos >> ledgerposting)) pstrs
<?> "postings" | 831 | ledgerpostings = do
ctx <- getState
-- pass current position to the sub-parses for more useful errors
pos <- getPosition
ls <- many1 $ try linebeginningwithspaces
let parses p = isRight . parseWithCtx ctx p
postinglines = filter (not . (ledgercommentline `parses`)) ls
-- group any metadata lines with the posting line above
postinglinegroups :: [String] -> [String]
postinglinegroups [] = []
postinglinegroups (pline:ls) = (unlines $ pline:mdlines):postinglinegroups rest
where (mdlines,rest) = span (ledgermetadataline `parses`) ls
pstrs = postinglinegroups postinglines
when (null pstrs) $ fail "no postings"
return $ map (fromparse . parseWithCtx ctx (setPosition pos >> ledgerposting)) pstrs
<?> "postings" | 773 | true | true | 3 | 14 | 193 | 252 | 127 | 125 | null | null |
mstksg/hledger | hledger/Hledger/Cli.hs | gpl-3.0 | ledger7 :: Ledger
ledger7 = ledgerFromJournal Any journal7 | 58 | ledger7 :: Ledger
ledger7 = ledgerFromJournal Any journal7 | 58 | ledger7 = ledgerFromJournal Any journal7 | 40 | false | true | 0 | 5 | 7 | 16 | 8 | 8 | null | null |
tjakway/ghcjvm | compiler/types/Coercion.hs | bsd-3-clause | isCoVar_maybe _ = Nothing | 36 | isCoVar_maybe _ = Nothing | 36 | isCoVar_maybe _ = Nothing | 36 | false | false | 0 | 4 | 14 | 10 | 4 | 6 | null | null |
ezrakilty/narc | Database/Narc/Type.hs | bsd-2-clause | runNormalizeType :: Type -> Type
runNormalizeType ty = evalState (normalizeType ty) (0, []) | 91 | runNormalizeType :: Type -> Type
runNormalizeType ty = evalState (normalizeType ty) (0, []) | 91 | runNormalizeType ty = evalState (normalizeType ty) (0, []) | 58 | false | true | 0 | 7 | 12 | 40 | 20 | 20 | null | null |
vTurbine/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | tupleSortBoxity UnboxedTuple = Unboxed | 41 | tupleSortBoxity UnboxedTuple = Unboxed | 41 | tupleSortBoxity UnboxedTuple = Unboxed | 41 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
bitemyapp/hterm | Main.hs | mit | indexLookUp :: (Pieces -> IO LookupResult) -> Pieces -> IO LookupResult
indexLookUp lookup p =
case p of [] -> lookup [unsafeToPiece "index.html"]
p' -> lookup p' | 180 | indexLookUp :: (Pieces -> IO LookupResult) -> Pieces -> IO LookupResult
indexLookUp lookup p =
case p of [] -> lookup [unsafeToPiece "index.html"]
p' -> lookup p' | 180 | indexLookUp lookup p =
case p of [] -> lookup [unsafeToPiece "index.html"]
p' -> lookup p' | 108 | false | true | 0 | 10 | 44 | 67 | 32 | 35 | null | null |
uduki/hsQt | Qtc/Core/QUrl.hs | bsd-2-clause | toLocalFile :: QUrl a -> (()) -> IO (String)
toLocalFile x0 ()
= withStringResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QUrl_toLocalFile cobj_x0 | 153 | toLocalFile :: QUrl a -> (()) -> IO (String)
toLocalFile x0 ()
= withStringResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QUrl_toLocalFile cobj_x0 | 153 | toLocalFile x0 ()
= withStringResult $
withObjectPtr x0 $ \cobj_x0 ->
qtc_QUrl_toLocalFile cobj_x0 | 108 | false | true | 0 | 8 | 31 | 59 | 29 | 30 | null | null |
EarthCitizen/baskell | src/Eval.hs | bsd-3-clause | eval v@(FloatingValue _) = Right $ v | 36 | eval v@(FloatingValue _) = Right $ v | 36 | eval v@(FloatingValue _) = Right $ v | 36 | false | false | 1 | 9 | 6 | 28 | 11 | 17 | null | null |
spacekitteh/smcghc | libraries/base/Control/Exception/Base.hs | bsd-3-clause | -- GHC's RTS calls this
nestedAtomically :: SomeException
nestedAtomically = toException NestedAtomically | 105 | nestedAtomically :: SomeException
nestedAtomically = toException NestedAtomically | 81 | nestedAtomically = toException NestedAtomically | 47 | true | true | 0 | 6 | 11 | 21 | 9 | 12 | null | null |
cdxr/haskell-interface | src/Data/Interface/Type/Diff.hs | bsd-3-clause | changePreds :: ChangeContext t -> Change [Pred t]
changePreds cc = case cc of
RemovedContext ps -> Change ps []
AddedContext ps -> Change [] ps
ContextElems es -> toChange es | 190 | changePreds :: ChangeContext t -> Change [Pred t]
changePreds cc = case cc of
RemovedContext ps -> Change ps []
AddedContext ps -> Change [] ps
ContextElems es -> toChange es | 190 | changePreds cc = case cc of
RemovedContext ps -> Change ps []
AddedContext ps -> Change [] ps
ContextElems es -> toChange es | 140 | false | true | 4 | 8 | 46 | 73 | 35 | 38 | null | null |
christiaanb/clash-compiler | clash-lib/src/CLaSH/Normalize/Transformations.hs | bsd-2-clause | nonRepANF _ e = return e | 24 | nonRepANF _ e = return e | 24 | nonRepANF _ e = return e | 24 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
s9gf4ult/jfprrd | src/JFP/Controller.hs | bsd-3-clause | revertView :: View -> Model -> IO ()
revertView view model = do
Gtk.set (viewStart view) [entryText := model ^. modelStart . _TimeSpec]
Gtk.set (viewEnd view) [entryText := model ^. modelEnd . _TimeSpec]
Gtk.set (viewStep view)
[entryText := (fromMaybe "" $ model ^? modelStep . _Just . _TimeSpec)]
widgetSizeAllocate (viewImageContainer view)
$ Rectangle 0 0
(model ^. modelImageSize . isWidth)
(model ^. modelImageSize . isHeight) | 456 | revertView :: View -> Model -> IO ()
revertView view model = do
Gtk.set (viewStart view) [entryText := model ^. modelStart . _TimeSpec]
Gtk.set (viewEnd view) [entryText := model ^. modelEnd . _TimeSpec]
Gtk.set (viewStep view)
[entryText := (fromMaybe "" $ model ^? modelStep . _Just . _TimeSpec)]
widgetSizeAllocate (viewImageContainer view)
$ Rectangle 0 0
(model ^. modelImageSize . isWidth)
(model ^. modelImageSize . isHeight) | 456 | revertView view model = do
Gtk.set (viewStart view) [entryText := model ^. modelStart . _TimeSpec]
Gtk.set (viewEnd view) [entryText := model ^. modelEnd . _TimeSpec]
Gtk.set (viewStep view)
[entryText := (fromMaybe "" $ model ^? modelStep . _Just . _TimeSpec)]
widgetSizeAllocate (viewImageContainer view)
$ Rectangle 0 0
(model ^. modelImageSize . isWidth)
(model ^. modelImageSize . isHeight) | 419 | false | true | 0 | 15 | 88 | 183 | 89 | 94 | null | null |
AlexanderPankiv/ghc | compiler/nativeGen/PPC/Ppr.hs | bsd-3-clause | pprInstr (XORIS reg1 reg2 imm) = hcat [
char '\t',
ptext (sLit "xoris"),
char '\t',
pprReg reg1,
ptext (sLit ", "),
pprReg reg2,
ptext (sLit ", "),
pprImm imm
] | 228 | pprInstr (XORIS reg1 reg2 imm) = hcat [
char '\t',
ptext (sLit "xoris"),
char '\t',
pprReg reg1,
ptext (sLit ", "),
pprReg reg2,
ptext (sLit ", "),
pprImm imm
] | 228 | pprInstr (XORIS reg1 reg2 imm) = hcat [
char '\t',
ptext (sLit "xoris"),
char '\t',
pprReg reg1,
ptext (sLit ", "),
pprReg reg2,
ptext (sLit ", "),
pprImm imm
] | 228 | false | false | 0 | 9 | 97 | 89 | 43 | 46 | null | null |
kim/amazonka | amazonka-kms/gen/Network/AWS/KMS/ListGrants.hs | mpl-2.0 | -- | 'ListGrants' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'lgKeyId' @::@ 'Text'
--
-- * 'lgLimit' @::@ 'Maybe' 'Natural'
--
-- * 'lgMarker' @::@ 'Maybe' 'Text'
--
listGrants :: Text -- ^ 'lgKeyId'
-> ListGrants
listGrants p1 = ListGrants
{ _lgKeyId = p1
, _lgLimit = Nothing
, _lgMarker = Nothing
} | 370 | listGrants :: Text -- ^ 'lgKeyId'
-> ListGrants
listGrants p1 = ListGrants
{ _lgKeyId = p1
, _lgLimit = Nothing
, _lgMarker = Nothing
} | 164 | listGrants p1 = ListGrants
{ _lgKeyId = p1
, _lgLimit = Nothing
, _lgMarker = Nothing
} | 105 | true | true | 0 | 6 | 87 | 49 | 33 | 16 | null | null |
mdsteele/fallback | src/Fallback/State/Tileset.hs | gpl-3.0 | tileTagId AdobeDoorClosedTile = 3891 | 36 | tileTagId AdobeDoorClosedTile = 3891 | 36 | tileTagId AdobeDoorClosedTile = 3891 | 36 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
ysnrkdm/Hamlet | src/Util.hs | mit | atod :: Char -> Char
atod = convCh 'a' '1' | 42 | atod :: Char -> Char
atod = convCh 'a' '1' | 42 | atod = convCh 'a' '1' | 21 | false | true | 0 | 7 | 9 | 28 | 11 | 17 | null | null |
yihuang/haskell-aliyun | Network/Aliyun.hs | bsd-3-clause | -- TODO put object multipart
-- | download a file.
getObject :: ByteString -> ByteString -> Yun LByteString
getObject bucket name = getObjectRange bucket name Nothing | 167 | getObject :: ByteString -> ByteString -> Yun LByteString
getObject bucket name = getObjectRange bucket name Nothing | 115 | getObject bucket name = getObjectRange bucket name Nothing | 58 | true | true | 0 | 7 | 26 | 40 | 19 | 21 | null | null |
ksaveljev/hake-2 | src/Util/Math3D.hs | bsd-3-clause | angleMod :: Float -> Float
angleMod a = let b :: Int = truncate (a / shortRatio)
in shortRatio * fromIntegral (b .&. 65535) | 136 | angleMod :: Float -> Float
angleMod a = let b :: Int = truncate (a / shortRatio)
in shortRatio * fromIntegral (b .&. 65535) | 136 | angleMod a = let b :: Int = truncate (a / shortRatio)
in shortRatio * fromIntegral (b .&. 65535) | 109 | false | true | 0 | 11 | 36 | 63 | 29 | 34 | null | null |
rueshyna/gogol | gogol-classroom/gen/Network/Google/Resource/Classroom/Courses/CourseWork/StudentSubmissions/Patch.hs | mpl-2.0 | -- | V1 error format.
ccwsspXgafv :: Lens' CoursesCourseWorkStudentSubmissionsPatch (Maybe Text)
ccwsspXgafv
= lens _ccwsspXgafv (\ s a -> s{_ccwsspXgafv = a}) | 161 | ccwsspXgafv :: Lens' CoursesCourseWorkStudentSubmissionsPatch (Maybe Text)
ccwsspXgafv
= lens _ccwsspXgafv (\ s a -> s{_ccwsspXgafv = a}) | 139 | ccwsspXgafv
= lens _ccwsspXgafv (\ s a -> s{_ccwsspXgafv = a}) | 64 | true | true | 0 | 9 | 23 | 48 | 25 | 23 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | box_if_necy :: String -- The class involved
-> TyCon -- The tycon involved
-> LHsExpr RdrName -- The argument
-> Type -- The argument type
-> LHsExpr RdrName -- Boxed version of the arg
-- See Note [Deriving and unboxed types]
box_if_necy cls_str tycon arg arg_ty
| isUnLiftedType arg_ty = nlHsApp (nlHsVar box_con) arg
| otherwise = arg
where
box_con = assoc_ty_id cls_str tycon boxConTbl arg_ty
--------------------- | 524 | box_if_necy :: String -- The class involved
-> TyCon -- The tycon involved
-> LHsExpr RdrName -- The argument
-> Type -- The argument type
-> LHsExpr RdrName
box_if_necy cls_str tycon arg arg_ty
| isUnLiftedType arg_ty = nlHsApp (nlHsVar box_con) arg
| otherwise = arg
where
box_con = assoc_ty_id cls_str tycon boxConTbl arg_ty
--------------------- | 454 | box_if_necy cls_str tycon arg arg_ty
| isUnLiftedType arg_ty = nlHsApp (nlHsVar box_con) arg
| otherwise = arg
where
box_con = assoc_ty_id cls_str tycon boxConTbl arg_ty
--------------------- | 214 | true | true | 1 | 9 | 172 | 93 | 47 | 46 | null | null |
AubreyEAnderson/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | checkSudoRedirect _ _ = return () | 33 | checkSudoRedirect _ _ = return () | 33 | checkSudoRedirect _ _ = return () | 33 | false | false | 1 | 6 | 5 | 16 | 7 | 9 | null | null |
leshchevds/ganeti | src/Ganeti/Objects/Disk.hs | bsd-2-clause | encodeDLId (LIDFile driver name) = JSArray [showJSON driver, showJSON name] | 75 | encodeDLId (LIDFile driver name) = JSArray [showJSON driver, showJSON name] | 75 | encodeDLId (LIDFile driver name) = JSArray [showJSON driver, showJSON name] | 75 | false | false | 0 | 7 | 9 | 33 | 15 | 18 | null | null |
rvion/ride | jetpack/src/System/Directory/AsEnv.hs | bsd-3-clause | -- env_getUserDocumentsDirectory :: IO FilePath
env_getUserDocumentsDirectory = I.getUserDocumentsDirectory | 107 | env_getUserDocumentsDirectory = I.getUserDocumentsDirectory | 59 | env_getUserDocumentsDirectory = I.getUserDocumentsDirectory | 59 | true | false | 0 | 5 | 7 | 9 | 5 | 4 | null | null |
josefs/sbv | SBVTestSuite/TestSuite/Basics/BasicTests.hs | bsd-3-clause | test0 :: (forall a. Num a => (a -> a -> a)) -> Word8
test0 f = f (3 :: Word8) 2 | 79 | test0 :: (forall a. Num a => (a -> a -> a)) -> Word8
test0 f = f (3 :: Word8) 2 | 79 | test0 f = f (3 :: Word8) 2 | 26 | false | true | 0 | 11 | 21 | 55 | 29 | 26 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.