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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
shlevy/ghc | compiler/prelude/THNames.hs | bsd-3-clause | overlapsDataConName = thCon (fsLit "Overlaps") overlapsDataConKey | 73 | overlapsDataConName = thCon (fsLit "Overlaps") overlapsDataConKey | 73 | overlapsDataConName = thCon (fsLit "Overlaps") overlapsDataConKey | 73 | false | false | 0 | 7 | 13 | 17 | 8 | 9 | null | null |
beni55/LambdaHack | Game/LambdaHack/Common/ItemStrongest.hs | bsd-3-clause | totalRange :: Item -> Int
totalRange item = snd $ snd $ itemTrajectory item [] | 78 | totalRange :: Item -> Int
totalRange item = snd $ snd $ itemTrajectory item [] | 78 | totalRange item = snd $ snd $ itemTrajectory item [] | 52 | false | true | 0 | 7 | 14 | 33 | 16 | 17 | null | null |
alexander-at-github/eta | compiler/ETA/Utils/Serialized.hs | bsd-3-clause | deserializeWithData' :: forall a. Data a => [Word8] -> ([Word8], a)
deserializeWithData' bytes = deserializeConstr bytes $ \constr_rep bytes ->
gunfold (\(bytes, b_to_r) -> let (bytes', b) = deserializeWithData' bytes in (bytes', b_to_r b))
(\x -> (bytes, x))
(repConstr (dataTypeOf (undefined :: a)) constr_rep) | 415 | deserializeWithData' :: forall a. Data a => [Word8] -> ([Word8], a)
deserializeWithData' bytes = deserializeConstr bytes $ \constr_rep bytes ->
gunfold (\(bytes, b_to_r) -> let (bytes', b) = deserializeWithData' bytes in (bytes', b_to_r b))
(\x -> (bytes, x))
(repConstr (dataTypeOf (undefined :: a)) constr_rep) | 415 | deserializeWithData' bytes = deserializeConstr bytes $ \constr_rep bytes ->
gunfold (\(bytes, b_to_r) -> let (bytes', b) = deserializeWithData' bytes in (bytes', b_to_r b))
(\x -> (bytes, x))
(repConstr (dataTypeOf (undefined :: a)) constr_rep) | 347 | false | true | 0 | 14 | 146 | 141 | 77 | 64 | null | null |
jprider63/aeson-ios-0.8.0.2 | tests/Properties/Deprecated.hs | bsd-3-clause | regress_gh72 :: [(String, Maybe String)] -> Bool
regress_gh72 ys = G.decode (G.encode m) == Just m
where m = Map.fromList ys | 128 | regress_gh72 :: [(String, Maybe String)] -> Bool
regress_gh72 ys = G.decode (G.encode m) == Just m
where m = Map.fromList ys | 128 | regress_gh72 ys = G.decode (G.encode m) == Just m
where m = Map.fromList ys | 79 | false | true | 0 | 9 | 24 | 62 | 31 | 31 | null | null |
rueshyna/gogol | gogol-doubleclick-search/gen/Network/Google/Resource/DoubleClickSearch/SavedColumns/List.hs | mpl-2.0 | -- | DS ID of the advertiser.
sclAdvertiserId :: Lens' SavedColumnsList Int64
sclAdvertiserId
= lens _sclAdvertiserId
(\ s a -> s{_sclAdvertiserId = a})
. _Coerce | 176 | sclAdvertiserId :: Lens' SavedColumnsList Int64
sclAdvertiserId
= lens _sclAdvertiserId
(\ s a -> s{_sclAdvertiserId = a})
. _Coerce | 146 | sclAdvertiserId
= lens _sclAdvertiserId
(\ s a -> s{_sclAdvertiserId = a})
. _Coerce | 98 | true | true | 2 | 8 | 38 | 50 | 24 | 26 | null | null |
aristidb/GameOfLife | Test.hs | bsd-3-clause | printCoord :: Coord -> String
printCoord (Coord x y) = show x ++ "/" ++ show y | 78 | printCoord :: Coord -> String
printCoord (Coord x y) = show x ++ "/" ++ show y | 78 | printCoord (Coord x y) = show x ++ "/" ++ show y | 48 | false | true | 0 | 7 | 16 | 40 | 19 | 21 | null | null |
TK009/loyly | RemindHelpers.hs | mit | prettyRemindI :: Text -> WidgetT site IO ()
prettyRemindI txt = case T.words txt of
date : _ : _ : _ : _ : time : msg -> [whamlet|<i>#{date} #{time} - #{T.unwords msg}|]
_ -> [whamlet|error: no parse: #{txt}|]
-- | <li> entries for next reminders. | 256 | prettyRemindI :: Text -> WidgetT site IO ()
prettyRemindI txt = case T.words txt of
date : _ : _ : _ : _ : time : msg -> [whamlet|<i>#{date} #{time} - #{T.unwords msg}|]
_ -> [whamlet|error: no parse: #{txt}|]
-- | <li> entries for next reminders. | 256 | prettyRemindI txt = case T.words txt of
date : _ : _ : _ : _ : time : msg -> [whamlet|<i>#{date} #{time} - #{T.unwords msg}|]
_ -> [whamlet|error: no parse: #{txt}|]
-- | <li> entries for next reminders. | 212 | false | true | 0 | 13 | 55 | 81 | 44 | 37 | null | null |
joelburget/daily-typecheckers | src/Day19.hs | bsd-3-clause | eval :: Hoas -> Hoas
eval t = case t of
HBase _ -> t
HApp (HLam _ f) x -> f x
_ -> t | 90 | eval :: Hoas -> Hoas
eval t = case t of
HBase _ -> t
HApp (HLam _ f) x -> f x
_ -> t | 90 | eval t = case t of
HBase _ -> t
HApp (HLam _ f) x -> f x
_ -> t | 69 | false | true | 0 | 10 | 31 | 65 | 29 | 36 | null | null |
josejuan/rememe | Rememe/Business.hs | gpl-3.0 | updateUserInfo :: (PersistQuery m, PersistMonadBackend m ~ PersistEntityBackend User) => User -> BusinessRun m ()
updateUserInfo newUserInfo = do
ukey <- getUserKey
update ukey [ UserName =. userName newUserInfo ] | 219 | updateUserInfo :: (PersistQuery m, PersistMonadBackend m ~ PersistEntityBackend User) => User -> BusinessRun m ()
updateUserInfo newUserInfo = do
ukey <- getUserKey
update ukey [ UserName =. userName newUserInfo ] | 219 | updateUserInfo newUserInfo = do
ukey <- getUserKey
update ukey [ UserName =. userName newUserInfo ] | 105 | false | true | 0 | 10 | 35 | 73 | 34 | 39 | null | null |
mavenraven/github | samples/Repos/Forks/ListForks.hs | bsd-3-clause | main = do
possibleForks <- Github.forksFor "thoughtbot" "paperclip"
putStrLn $ either (("Error: "++) . show)
(intercalate "\n\n" . map formatFork)
possibleForks | 204 | main = do
possibleForks <- Github.forksFor "thoughtbot" "paperclip"
putStrLn $ either (("Error: "++) . show)
(intercalate "\n\n" . map formatFork)
possibleForks | 204 | main = do
possibleForks <- Github.forksFor "thoughtbot" "paperclip"
putStrLn $ either (("Error: "++) . show)
(intercalate "\n\n" . map formatFork)
possibleForks | 204 | false | false | 1 | 12 | 64 | 62 | 28 | 34 | null | null |
tmielcza/demiurge | test/Parse/Test.hs | apache-2.0 | parseSuite = testGroup "Parsing tests"
[
testGroup "Expression"
[
exprTest "A+B+C" "((A+B)+C)",
exprTest "A^B|C+D" "(A^(B|(C+D)))",
exprTest "A^B|C|D" "(A^((B|C)|D))",
exprTest "A^B|C^D" "((A^(B|C))^D)",
exprTest "A^B|C+D^E" "((A^(B|(C+D)))^E)",
exprErrorTest "+",
exprErrorTest "A B",
exprErrorTest "A+|",
exprErrorTest "A|B+C^",
exprErrorTest "A|A||"
],
testGroup "Not"
[
exprTest "!A" "!A",
exprTest "!A+!B" "(!A+!B)",
exprTest "!!!!!!A^!!!!!B" "(!!!!!!A^!!!!!B)",
exprErrorTest "!",
exprErrorTest "!!!!"
],
testGroup "Parentheses"
[
exprTest "C | (D + Y)" "(C|(D+Y))" ,
exprTest "C ^ !(R | I) + P" "(C^(!(R|I)+P))" ,
exprTest "C + !(R | I) ^ P" "((C+!(R|I))^P)" ,
exprTest "C + !(R | (V ^ O)) ^ P" "((C+!(R|(V^O)))^P)" ,
exprTest "((((((U))))+(((((((F)))))))))" "(U+F)",
exprTest "(U)" "U",
exprErrorTest "(A + B",
exprErrorTest "(A + B +)",
exprErrorTest "(A + B ))",
exprErrorTest "()",
exprErrorTest "(((("
],
testGroup "Relations"
[
relationTest "A => B" "{A=>B}",
relationTest "A <=> B" "{A<=>B}",
relationTest "A + C <=> B" "{(A+C)<=>B}",
relationTest "A ^ C <=> B | D" "{(A^C)<=>(B|D)}",
relationTest "A + (C | P) <=> B" "{(A+(C|P))<=>B}",
relationErrorTest "A => + B",
relationErrorTest "A + => B",
relationErrorTest "A => B => C",
relationErrorTest "(B => C)"
],
testGroup "Blanks / Comments"
[
relationListTest "A => B#CDRR\n C=>D" "[{A=>B},{C=>D}]",
relationListTest "A => B \n E <=> O" "[{A=>B},{E<=>O}]",
relationListTest "A => B" "[{A=>B}]",
relationListErrorTest ""
],
testGroup "Initial Facts"
[
initTest "=ABCD" "[(A,True),(B,True),(C,True),(D,True)]",
initTest "= A BC D" "[(A,True),(B,True),(C,True),(D,True)]",
initTest "= A!BC" "[(A,True),(B,False),(C,True)]",
initTest "=" "[]",
initTest "=It_s_a_factThis_too" "[(It_s_a_fact,True),(This_too,True)]",
initErrorTest "=+",
initErrorTest "=ABC+R",
initErrorTest "=A(BCR)",
initErrorTest ""
],
testGroup "Queries"
[
queryTest "?PON" "[P,O,N]",
queryTest "? P O N" "[P,O,N]",
queryTest "?Today_s_the_dayNo_means_no" "[Today_s_the_day,No_means_no]",
queryErrorTest "?|",
queryErrorTest "?",
queryErrorTest "?@",
queryErrorTest "? A B C + R",
queryErrorTest "? ABC+R",
queryErrorTest "? A B C !R",
queryErrorTest "",
queryErrorTest "allyourbasearebelongtous"
]{-,
testGroup "Parser"
[
parseTest "A+B=>C\n=AB\n?C\n" "([{(A+B)=>C}],Init: [A,B],Query: [C])",
parseTest "A+B=>C\n=AB\n?C" "([{(A+B)=>C}],Init: [A,B],Query: [C])",
parseTest "Asteques+Boisson=>Crocodile\n=AstequesBoisson\n?Crocodile\n" "([{(Asteques+Boisson)=>Crocodile}],Init: [Asteques,Boisson],Query: [Crocodile])",
parseTest "#tactatctatct\n\nA+B=>C#youplalala\n=AB#super\n?C#commentaire\n#derniere ligne\n" "([{(A+B)=>C}],Init: [A,B],Query: [C])",
parseTest "A+B=>C\nE <=> Q\n=AB\n?C\n" "([{(A+B)=>C},{E<=>Q}],Init: [A,B],Query: [C])",
parseFileTest "easy" "([{(A+C)=>B}],Init: [A,C],Query: [B])"
]-}
] | 4,339 | parseSuite = testGroup "Parsing tests"
[
testGroup "Expression"
[
exprTest "A+B+C" "((A+B)+C)",
exprTest "A^B|C+D" "(A^(B|(C+D)))",
exprTest "A^B|C|D" "(A^((B|C)|D))",
exprTest "A^B|C^D" "((A^(B|C))^D)",
exprTest "A^B|C+D^E" "((A^(B|(C+D)))^E)",
exprErrorTest "+",
exprErrorTest "A B",
exprErrorTest "A+|",
exprErrorTest "A|B+C^",
exprErrorTest "A|A||"
],
testGroup "Not"
[
exprTest "!A" "!A",
exprTest "!A+!B" "(!A+!B)",
exprTest "!!!!!!A^!!!!!B" "(!!!!!!A^!!!!!B)",
exprErrorTest "!",
exprErrorTest "!!!!"
],
testGroup "Parentheses"
[
exprTest "C | (D + Y)" "(C|(D+Y))" ,
exprTest "C ^ !(R | I) + P" "(C^(!(R|I)+P))" ,
exprTest "C + !(R | I) ^ P" "((C+!(R|I))^P)" ,
exprTest "C + !(R | (V ^ O)) ^ P" "((C+!(R|(V^O)))^P)" ,
exprTest "((((((U))))+(((((((F)))))))))" "(U+F)",
exprTest "(U)" "U",
exprErrorTest "(A + B",
exprErrorTest "(A + B +)",
exprErrorTest "(A + B ))",
exprErrorTest "()",
exprErrorTest "(((("
],
testGroup "Relations"
[
relationTest "A => B" "{A=>B}",
relationTest "A <=> B" "{A<=>B}",
relationTest "A + C <=> B" "{(A+C)<=>B}",
relationTest "A ^ C <=> B | D" "{(A^C)<=>(B|D)}",
relationTest "A + (C | P) <=> B" "{(A+(C|P))<=>B}",
relationErrorTest "A => + B",
relationErrorTest "A + => B",
relationErrorTest "A => B => C",
relationErrorTest "(B => C)"
],
testGroup "Blanks / Comments"
[
relationListTest "A => B#CDRR\n C=>D" "[{A=>B},{C=>D}]",
relationListTest "A => B \n E <=> O" "[{A=>B},{E<=>O}]",
relationListTest "A => B" "[{A=>B}]",
relationListErrorTest ""
],
testGroup "Initial Facts"
[
initTest "=ABCD" "[(A,True),(B,True),(C,True),(D,True)]",
initTest "= A BC D" "[(A,True),(B,True),(C,True),(D,True)]",
initTest "= A!BC" "[(A,True),(B,False),(C,True)]",
initTest "=" "[]",
initTest "=It_s_a_factThis_too" "[(It_s_a_fact,True),(This_too,True)]",
initErrorTest "=+",
initErrorTest "=ABC+R",
initErrorTest "=A(BCR)",
initErrorTest ""
],
testGroup "Queries"
[
queryTest "?PON" "[P,O,N]",
queryTest "? P O N" "[P,O,N]",
queryTest "?Today_s_the_dayNo_means_no" "[Today_s_the_day,No_means_no]",
queryErrorTest "?|",
queryErrorTest "?",
queryErrorTest "?@",
queryErrorTest "? A B C + R",
queryErrorTest "? ABC+R",
queryErrorTest "? A B C !R",
queryErrorTest "",
queryErrorTest "allyourbasearebelongtous"
]{-,
testGroup "Parser"
[
parseTest "A+B=>C\n=AB\n?C\n" "([{(A+B)=>C}],Init: [A,B],Query: [C])",
parseTest "A+B=>C\n=AB\n?C" "([{(A+B)=>C}],Init: [A,B],Query: [C])",
parseTest "Asteques+Boisson=>Crocodile\n=AstequesBoisson\n?Crocodile\n" "([{(Asteques+Boisson)=>Crocodile}],Init: [Asteques,Boisson],Query: [Crocodile])",
parseTest "#tactatctatct\n\nA+B=>C#youplalala\n=AB#super\n?C#commentaire\n#derniere ligne\n" "([{(A+B)=>C}],Init: [A,B],Query: [C])",
parseTest "A+B=>C\nE <=> Q\n=AB\n?C\n" "([{(A+B)=>C},{E<=>Q}],Init: [A,B],Query: [C])",
parseFileTest "easy" "([{(A+C)=>B}],Init: [A,C],Query: [B])"
]-}
] | 4,339 | parseSuite = testGroup "Parsing tests"
[
testGroup "Expression"
[
exprTest "A+B+C" "((A+B)+C)",
exprTest "A^B|C+D" "(A^(B|(C+D)))",
exprTest "A^B|C|D" "(A^((B|C)|D))",
exprTest "A^B|C^D" "((A^(B|C))^D)",
exprTest "A^B|C+D^E" "((A^(B|(C+D)))^E)",
exprErrorTest "+",
exprErrorTest "A B",
exprErrorTest "A+|",
exprErrorTest "A|B+C^",
exprErrorTest "A|A||"
],
testGroup "Not"
[
exprTest "!A" "!A",
exprTest "!A+!B" "(!A+!B)",
exprTest "!!!!!!A^!!!!!B" "(!!!!!!A^!!!!!B)",
exprErrorTest "!",
exprErrorTest "!!!!"
],
testGroup "Parentheses"
[
exprTest "C | (D + Y)" "(C|(D+Y))" ,
exprTest "C ^ !(R | I) + P" "(C^(!(R|I)+P))" ,
exprTest "C + !(R | I) ^ P" "((C+!(R|I))^P)" ,
exprTest "C + !(R | (V ^ O)) ^ P" "((C+!(R|(V^O)))^P)" ,
exprTest "((((((U))))+(((((((F)))))))))" "(U+F)",
exprTest "(U)" "U",
exprErrorTest "(A + B",
exprErrorTest "(A + B +)",
exprErrorTest "(A + B ))",
exprErrorTest "()",
exprErrorTest "(((("
],
testGroup "Relations"
[
relationTest "A => B" "{A=>B}",
relationTest "A <=> B" "{A<=>B}",
relationTest "A + C <=> B" "{(A+C)<=>B}",
relationTest "A ^ C <=> B | D" "{(A^C)<=>(B|D)}",
relationTest "A + (C | P) <=> B" "{(A+(C|P))<=>B}",
relationErrorTest "A => + B",
relationErrorTest "A + => B",
relationErrorTest "A => B => C",
relationErrorTest "(B => C)"
],
testGroup "Blanks / Comments"
[
relationListTest "A => B#CDRR\n C=>D" "[{A=>B},{C=>D}]",
relationListTest "A => B \n E <=> O" "[{A=>B},{E<=>O}]",
relationListTest "A => B" "[{A=>B}]",
relationListErrorTest ""
],
testGroup "Initial Facts"
[
initTest "=ABCD" "[(A,True),(B,True),(C,True),(D,True)]",
initTest "= A BC D" "[(A,True),(B,True),(C,True),(D,True)]",
initTest "= A!BC" "[(A,True),(B,False),(C,True)]",
initTest "=" "[]",
initTest "=It_s_a_factThis_too" "[(It_s_a_fact,True),(This_too,True)]",
initErrorTest "=+",
initErrorTest "=ABC+R",
initErrorTest "=A(BCR)",
initErrorTest ""
],
testGroup "Queries"
[
queryTest "?PON" "[P,O,N]",
queryTest "? P O N" "[P,O,N]",
queryTest "?Today_s_the_dayNo_means_no" "[Today_s_the_day,No_means_no]",
queryErrorTest "?|",
queryErrorTest "?",
queryErrorTest "?@",
queryErrorTest "? A B C + R",
queryErrorTest "? ABC+R",
queryErrorTest "? A B C !R",
queryErrorTest "",
queryErrorTest "allyourbasearebelongtous"
]{-,
testGroup "Parser"
[
parseTest "A+B=>C\n=AB\n?C\n" "([{(A+B)=>C}],Init: [A,B],Query: [C])",
parseTest "A+B=>C\n=AB\n?C" "([{(A+B)=>C}],Init: [A,B],Query: [C])",
parseTest "Asteques+Boisson=>Crocodile\n=AstequesBoisson\n?Crocodile\n" "([{(Asteques+Boisson)=>Crocodile}],Init: [Asteques,Boisson],Query: [Crocodile])",
parseTest "#tactatctatct\n\nA+B=>C#youplalala\n=AB#super\n?C#commentaire\n#derniere ligne\n" "([{(A+B)=>C}],Init: [A,B],Query: [C])",
parseTest "A+B=>C\nE <=> Q\n=AB\n?C\n" "([{(A+B)=>C},{E<=>Q}],Init: [A,B],Query: [C])",
parseFileTest "easy" "([{(A+C)=>B}],Init: [A,C],Query: [B])"
]-}
] | 4,339 | false | false | 0 | 9 | 1,821 | 482 | 241 | 241 | null | null |
projectorhq/haskell-liquid | test/Text/Liquid/ParserTests.hs | bsd-3-clause | --------------------------------------------------------------------------------
-- * VarIndexSection
--------------------------------------------------------------------------------
case_varIndexSection_1 = parseOnly varIndexSection "a" @?=
Right (ObjectIndex "a" :| []) | 274 | case_varIndexSection_1 = parseOnly varIndexSection "a" @?=
Right (ObjectIndex "a" :| []) | 90 | case_varIndexSection_1 = parseOnly varIndexSection "a" @?=
Right (ObjectIndex "a" :| []) | 90 | true | false | 1 | 7 | 18 | 37 | 17 | 20 | null | null |
AlexanderPankiv/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | iselExpr64 (CmmMachOp (MO_UU_Conv _ W64) [expr]) = do
fn <- getAnyReg expr
r_dst_lo <- getNewRegNat II32
let r_dst_hi = getHiVRegFromLo r_dst_lo
code = fn r_dst_lo
return (
ChildCode64 (code `snocOL`
MOV II32 (OpImm (ImmInt 0)) (OpReg r_dst_hi))
r_dst_lo
) | 363 | iselExpr64 (CmmMachOp (MO_UU_Conv _ W64) [expr]) = do
fn <- getAnyReg expr
r_dst_lo <- getNewRegNat II32
let r_dst_hi = getHiVRegFromLo r_dst_lo
code = fn r_dst_lo
return (
ChildCode64 (code `snocOL`
MOV II32 (OpImm (ImmInt 0)) (OpReg r_dst_hi))
r_dst_lo
) | 363 | iselExpr64 (CmmMachOp (MO_UU_Conv _ W64) [expr]) = do
fn <- getAnyReg expr
r_dst_lo <- getNewRegNat II32
let r_dst_hi = getHiVRegFromLo r_dst_lo
code = fn r_dst_lo
return (
ChildCode64 (code `snocOL`
MOV II32 (OpImm (ImmInt 0)) (OpReg r_dst_hi))
r_dst_lo
) | 363 | false | false | 0 | 16 | 145 | 117 | 55 | 62 | null | null |
DougBurke/swish | tests/GraphTest.hs | lgpl-2.1 | p410 = LV "p410" | 17 | p410 = LV "p410" | 17 | p410 = LV "p410" | 17 | false | false | 1 | 5 | 4 | 12 | 4 | 8 | null | null |
takagi/SimulationDSL | SimulationDSL/SimulationDSL/Language/Equations.hs | bsd-3-clause | dependency _ _ (Constant _) = [] | 37 | dependency _ _ (Constant _) = [] | 37 | dependency _ _ (Constant _) = [] | 37 | false | false | 0 | 7 | 11 | 21 | 10 | 11 | null | null |
paul-rouse/persistent | persistent-sqlite/Database/Persist/Sqlite.hs | mit | -- | A convenience helper which creates a new database connection and runs the
-- given block, handling @MonadResource@ and @MonadLogger@ requirements. Note
-- that all log messages are discarded.
--
-- @since 2.6.2
runSqliteInfo :: (MonadUnliftIO m)
=> SqliteConnectionInfo
-> ReaderT SqlBackend (NoLoggingT (ResourceT m)) a -- ^ database action
-> m a
runSqliteInfo conInfo = runResourceT
. runNoLoggingT
. withSqliteConnInfo conInfo
. runSqlConn | 556 | runSqliteInfo :: (MonadUnliftIO m)
=> SqliteConnectionInfo
-> ReaderT SqlBackend (NoLoggingT (ResourceT m)) a -- ^ database action
-> m a
runSqliteInfo conInfo = runResourceT
. runNoLoggingT
. withSqliteConnInfo conInfo
. runSqlConn | 340 | runSqliteInfo conInfo = runResourceT
. runNoLoggingT
. withSqliteConnInfo conInfo
. runSqlConn | 160 | true | true | 0 | 12 | 172 | 74 | 39 | 35 | null | null |
lukemaurer/sequent-core | src/Language/SequentCore/Inspect.hs | bsd-3-clause | install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
install cmdLine todos =
do reinitializeGlobals
let opts = parseOpts cmdLine
newPass = mkPass opts
todos' = case opt_where opts of
AtStart -> newPass : todos
AtEnd -> todos ++ [newPass]
AtBoth -> newPass : todos ++ [newPass]
unknownOpts = opt_badOptions opts
unless (null unknownOpts) $ do
fatalErrorMsg $ hang (text "Language.SequentCore.Inspect: Unrecognized option(s): ") 4
(pprWithCommas (quotes . text) unknownOpts)
dflags <- getDynFlags
liftIO $ ghcExit dflags 1
return todos'
where
mkPass opts = CoreDoPluginPass "SeqCoreInspect" (passFunc opts)
passFunc opts = sequentPass (inspectSequentCore opts) | 846 | install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo]
install cmdLine todos =
do reinitializeGlobals
let opts = parseOpts cmdLine
newPass = mkPass opts
todos' = case opt_where opts of
AtStart -> newPass : todos
AtEnd -> todos ++ [newPass]
AtBoth -> newPass : todos ++ [newPass]
unknownOpts = opt_badOptions opts
unless (null unknownOpts) $ do
fatalErrorMsg $ hang (text "Language.SequentCore.Inspect: Unrecognized option(s): ") 4
(pprWithCommas (quotes . text) unknownOpts)
dflags <- getDynFlags
liftIO $ ghcExit dflags 1
return todos'
where
mkPass opts = CoreDoPluginPass "SeqCoreInspect" (passFunc opts)
passFunc opts = sequentPass (inspectSequentCore opts) | 846 | install cmdLine todos =
do reinitializeGlobals
let opts = parseOpts cmdLine
newPass = mkPass opts
todos' = case opt_where opts of
AtStart -> newPass : todos
AtEnd -> todos ++ [newPass]
AtBoth -> newPass : todos ++ [newPass]
unknownOpts = opt_badOptions opts
unless (null unknownOpts) $ do
fatalErrorMsg $ hang (text "Language.SequentCore.Inspect: Unrecognized option(s): ") 4
(pprWithCommas (quotes . text) unknownOpts)
dflags <- getDynFlags
liftIO $ ghcExit dflags 1
return todos'
where
mkPass opts = CoreDoPluginPass "SeqCoreInspect" (passFunc opts)
passFunc opts = sequentPass (inspectSequentCore opts) | 781 | false | true | 1 | 15 | 268 | 232 | 112 | 120 | null | null |
romanb/amazonka | gen/src/Gen/AST.hs | mpl-2.0 | operation :: Abbrev
-> Protocol
-> Text
-> [NS]
-> HashSet Text
-> HashMap Text (Pager ())
-> Text
-> Input.Operation
-> State (HashMap Text Data) Operation
operation a proto base ns ss pgs n o = do
inp <- request (o ^. oInput)
out <- response (o ^. oOutput)
op inp out <$> pager inp out (Map.lookup n pgs)
where
op rq rs pg = Operation
{ _opName = n
, _opUrl = base <> n <> ".html"
, _opService = a
, _opProtocol = proto
, _opNamespace = operationNS a n
, _opImports = requestNS a proto : typesNS a : ns
, _opDocumentation = above <$> o ^. oDocumentation
, _opDocumentationUrl = o ^. oDocumentationUrl
, _opMethod = o ^. oHttp.hMethod
, _opRequest = rq
, _opResponse = rs
, _opPager = pg
}
request = go (\x k s d -> Request proto (prefixURI x d) k s d) True
prefixURI k d = o ^. oHttp . hRequestUri & uriSegments %~ f
where
f (Seg x) = Seg x
f (Var x)
| Just y <- x `lookup` ls = Var y
| otherwise = Var (k <> x)
ls = fieldLocations d
response r = go (const (Response proto w k)) False r
where
w = fromMaybe False (join (_refWrapper <$> r))
k = join (_refResultWrapper <$> r)
rqName = n
rsName = n <> "Response"
go :: (Text -> Text -> Bool -> Data -> a)
-> Bool
-> Maybe Ref
-> State (HashMap Text Data) a
go c rq Nothing = return $! placeholder c rq
go c rq (Just x) = do
let k = x ^. refShape
m <- gets (^. at k)
case m of
Nothing -> return $! placeholder c rq
Just Void -> return $! placeholder c rq
Just d -> do
let d' = setStreaming rq d
t = fromMaybe "" (fieldPrefix d')
p = Set.member k ss
unless p $
modify (Map.delete k)
return $! c t k p d'
placeholder c True = c "" rqName False (Empty rqName)
placeholder c False = c "" rsName False (Empty rsName)
-- | Prefix the nested field access and index notation of a pager by introspecting
-- the state fields. | 2,422 | operation :: Abbrev
-> Protocol
-> Text
-> [NS]
-> HashSet Text
-> HashMap Text (Pager ())
-> Text
-> Input.Operation
-> State (HashMap Text Data) Operation
operation a proto base ns ss pgs n o = do
inp <- request (o ^. oInput)
out <- response (o ^. oOutput)
op inp out <$> pager inp out (Map.lookup n pgs)
where
op rq rs pg = Operation
{ _opName = n
, _opUrl = base <> n <> ".html"
, _opService = a
, _opProtocol = proto
, _opNamespace = operationNS a n
, _opImports = requestNS a proto : typesNS a : ns
, _opDocumentation = above <$> o ^. oDocumentation
, _opDocumentationUrl = o ^. oDocumentationUrl
, _opMethod = o ^. oHttp.hMethod
, _opRequest = rq
, _opResponse = rs
, _opPager = pg
}
request = go (\x k s d -> Request proto (prefixURI x d) k s d) True
prefixURI k d = o ^. oHttp . hRequestUri & uriSegments %~ f
where
f (Seg x) = Seg x
f (Var x)
| Just y <- x `lookup` ls = Var y
| otherwise = Var (k <> x)
ls = fieldLocations d
response r = go (const (Response proto w k)) False r
where
w = fromMaybe False (join (_refWrapper <$> r))
k = join (_refResultWrapper <$> r)
rqName = n
rsName = n <> "Response"
go :: (Text -> Text -> Bool -> Data -> a)
-> Bool
-> Maybe Ref
-> State (HashMap Text Data) a
go c rq Nothing = return $! placeholder c rq
go c rq (Just x) = do
let k = x ^. refShape
m <- gets (^. at k)
case m of
Nothing -> return $! placeholder c rq
Just Void -> return $! placeholder c rq
Just d -> do
let d' = setStreaming rq d
t = fromMaybe "" (fieldPrefix d')
p = Set.member k ss
unless p $
modify (Map.delete k)
return $! c t k p d'
placeholder c True = c "" rqName False (Empty rqName)
placeholder c False = c "" rsName False (Empty rsName)
-- | Prefix the nested field access and index notation of a pager by introspecting
-- the state fields. | 2,422 | operation a proto base ns ss pgs n o = do
inp <- request (o ^. oInput)
out <- response (o ^. oOutput)
op inp out <$> pager inp out (Map.lookup n pgs)
where
op rq rs pg = Operation
{ _opName = n
, _opUrl = base <> n <> ".html"
, _opService = a
, _opProtocol = proto
, _opNamespace = operationNS a n
, _opImports = requestNS a proto : typesNS a : ns
, _opDocumentation = above <$> o ^. oDocumentation
, _opDocumentationUrl = o ^. oDocumentationUrl
, _opMethod = o ^. oHttp.hMethod
, _opRequest = rq
, _opResponse = rs
, _opPager = pg
}
request = go (\x k s d -> Request proto (prefixURI x d) k s d) True
prefixURI k d = o ^. oHttp . hRequestUri & uriSegments %~ f
where
f (Seg x) = Seg x
f (Var x)
| Just y <- x `lookup` ls = Var y
| otherwise = Var (k <> x)
ls = fieldLocations d
response r = go (const (Response proto w k)) False r
where
w = fromMaybe False (join (_refWrapper <$> r))
k = join (_refResultWrapper <$> r)
rqName = n
rsName = n <> "Response"
go :: (Text -> Text -> Bool -> Data -> a)
-> Bool
-> Maybe Ref
-> State (HashMap Text Data) a
go c rq Nothing = return $! placeholder c rq
go c rq (Just x) = do
let k = x ^. refShape
m <- gets (^. at k)
case m of
Nothing -> return $! placeholder c rq
Just Void -> return $! placeholder c rq
Just d -> do
let d' = setStreaming rq d
t = fromMaybe "" (fieldPrefix d')
p = Set.member k ss
unless p $
modify (Map.delete k)
return $! c t k p d'
placeholder c True = c "" rqName False (Empty rqName)
placeholder c False = c "" rsName False (Empty rsName)
-- | Prefix the nested field access and index notation of a pager by introspecting
-- the state fields. | 2,185 | false | true | 14 | 17 | 1,031 | 878 | 417 | 461 | null | null |
ambiata/mafia | src/Mafia/Script.hs | bsd-3-clause | pPragma :: Text -> Atto.Parser a -> Atto.Parser a
pPragma pragma parser = do
_ <- Atto.string "{-#" *> Atto.skipSpace *> Atto.string pragma
x <- Atto.skipSpace *> parser <* Atto.skipSpace
_ <- Atto.string "#-}"
pure x | 225 | pPragma :: Text -> Atto.Parser a -> Atto.Parser a
pPragma pragma parser = do
_ <- Atto.string "{-#" *> Atto.skipSpace *> Atto.string pragma
x <- Atto.skipSpace *> parser <* Atto.skipSpace
_ <- Atto.string "#-}"
pure x | 225 | pPragma pragma parser = do
_ <- Atto.string "{-#" *> Atto.skipSpace *> Atto.string pragma
x <- Atto.skipSpace *> parser <* Atto.skipSpace
_ <- Atto.string "#-}"
pure x | 175 | false | true | 0 | 12 | 43 | 103 | 45 | 58 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2017/M01/D12/Solution.hs | mit | {--
*Y2017.M01.D12.Solution> [minimumOr 314159, maximumOr 0] <*> [nada,soma] ~>
[314159,1,0,99]
--}
zumbo, jumbo :: Set Int
zumbo = Set.empty | 142 | zumbo, jumbo :: Set Int
zumbo = Set.empty | 41 | zumbo = Set.empty | 17 | true | true | 2 | 6 | 19 | 29 | 12 | 17 | null | null |
mudphone/HaskellBook | src/TwentyThree.hs | mit | fizzbuzzList :: [Integer] -> [String]
fizzbuzzList list = execState (mapM_ addResult list) [] | 93 | fizzbuzzList :: [Integer] -> [String]
fizzbuzzList list = execState (mapM_ addResult list) [] | 93 | fizzbuzzList list = execState (mapM_ addResult list) [] | 55 | false | true | 0 | 8 | 12 | 44 | 21 | 23 | null | null |
joeyadams/haskell-iocp | IOCP/PSQ.hs | bsd-3-clause | maxKey (Winner _ _ m) = m | 25 | maxKey (Winner _ _ m) = m | 25 | maxKey (Winner _ _ m) = m | 25 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
wdanilo/haskell-language-c | src/Language/C/Syntax/Constants.hs | bsd-3-clause | setFlag :: (Enum f) => f -> Flags f -> Flags f
setFlag flag (Flags k) = Flags$ k `setBit` fromEnum flag | 106 | setFlag :: (Enum f) => f -> Flags f -> Flags f
setFlag flag (Flags k) = Flags$ k `setBit` fromEnum flag | 106 | setFlag flag (Flags k) = Flags$ k `setBit` fromEnum flag | 59 | false | true | 0 | 11 | 24 | 62 | 30 | 32 | null | null |
brendanhay/gogol | gogol-logging/gen/Network/Google/Logging/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ListExclusionsResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lerNextPageToken'
--
-- * 'lerExclusions'
listExclusionsResponse
:: ListExclusionsResponse
listExclusionsResponse =
ListExclusionsResponse'
{_lerNextPageToken = Nothing, _lerExclusions = Nothing} | 388 | listExclusionsResponse
:: ListExclusionsResponse
listExclusionsResponse =
ListExclusionsResponse'
{_lerNextPageToken = Nothing, _lerExclusions = Nothing} | 163 | listExclusionsResponse =
ListExclusionsResponse'
{_lerNextPageToken = Nothing, _lerExclusions = Nothing} | 110 | true | true | 1 | 7 | 59 | 39 | 23 | 16 | null | null |
rahulmutt/ghcvm | tests/suite/codegen/run/RecursiveFib2.hs | bsd-3-clause | fibrecursive n presum sum = fibrecursive (n-1) sum (sum+presum) | 64 | fibrecursive n presum sum = fibrecursive (n-1) sum (sum+presum) | 64 | fibrecursive n presum sum = fibrecursive (n-1) sum (sum+presum) | 64 | false | false | 0 | 7 | 9 | 34 | 17 | 17 | null | null |
zepto-lang/zepto | src/Zepto/Types/Export.hs | gpl-2.0 | isSuffixOfBVec = B.isSuffixOf | 29 | isSuffixOfBVec = B.isSuffixOf | 29 | isSuffixOfBVec = B.isSuffixOf | 29 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
pparkkin/eta | compiler/ETA/Utils/OrdList.hs | bsd-3-clause | foldlOL k z (Two b1 b2) = foldlOL k (foldlOL k z b1) b2 | 55 | foldlOL k z (Two b1 b2) = foldlOL k (foldlOL k z b1) b2 | 55 | foldlOL k z (Two b1 b2) = foldlOL k (foldlOL k z b1) b2 | 55 | false | false | 0 | 7 | 13 | 41 | 18 | 23 | null | null |
fmapfmapfmap/amazonka | amazonka-sns/gen/Network/AWS/SNS/ConfirmSubscription.hs | mpl-2.0 | -- | The ARN of the created subscription.
csrsSubscriptionARN :: Lens' ConfirmSubscriptionResponse (Maybe Text)
csrsSubscriptionARN = lens _csrsSubscriptionARN (\ s a -> s{_csrsSubscriptionARN = a}) | 198 | csrsSubscriptionARN :: Lens' ConfirmSubscriptionResponse (Maybe Text)
csrsSubscriptionARN = lens _csrsSubscriptionARN (\ s a -> s{_csrsSubscriptionARN = a}) | 156 | csrsSubscriptionARN = lens _csrsSubscriptionARN (\ s a -> s{_csrsSubscriptionARN = a}) | 86 | true | true | 0 | 9 | 24 | 46 | 25 | 21 | null | null |
Saulzar/Ants | Ant/Square.hs | bsd-3-clause | foodFlag = 8 | 15 | foodFlag = 8 | 15 | foodFlag = 8 | 15 | false | false | 0 | 4 | 5 | 6 | 3 | 3 | null | null |
da-x/lamdu | bottlelib/Graphics/UI/Bottle/Widgets/TextEdit.hs | gpl-3.0 | makeDisplayStr _ str = str | 30 | makeDisplayStr _ str = str | 30 | makeDisplayStr _ str = str | 30 | false | false | 0 | 5 | 8 | 11 | 5 | 6 | null | null |
mcmaniac/ghc | compiler/llvmGen/Llvm/Types.hs | bsd-3-clause | getLit (LMUndefLit _ ) = "undef" | 35 | getLit (LMUndefLit _ ) = "undef" | 35 | getLit (LMUndefLit _ ) = "undef" | 35 | false | false | 0 | 7 | 8 | 15 | 7 | 8 | null | null |
andir/ganeti | src/Ganeti/WConfd/TempRes.hs | bsd-2-clause | -- | Embeds a state-modifying computation in a stateful monad.
modifyM :: (MonadState s m) => (s -> m s) -> m ()
modifyM f = get >>= f >>= put | 142 | modifyM :: (MonadState s m) => (s -> m s) -> m ()
modifyM f = get >>= f >>= put | 79 | modifyM f = get >>= f >>= put | 29 | true | true | 0 | 9 | 30 | 53 | 27 | 26 | null | null |
rueshyna/gogol | gogol-customsearch/gen/Network/Google/CustomSearch/Types/Product.hs | mpl-2.0 | rHTMLTitle :: Lens' Result (Maybe Text)
rHTMLTitle
= lens _rHTMLTitle (\ s a -> s{_rHTMLTitle = a}) | 101 | rHTMLTitle :: Lens' Result (Maybe Text)
rHTMLTitle
= lens _rHTMLTitle (\ s a -> s{_rHTMLTitle = a}) | 101 | rHTMLTitle
= lens _rHTMLTitle (\ s a -> s{_rHTMLTitle = a}) | 61 | false | true | 0 | 9 | 18 | 47 | 24 | 23 | null | null |
olorin/git-vogue | tests/unit.hs | bsd-3-clause | testLEDiscovery :: FilePath -> PluginDiscoverer IO -> Spec
testLEDiscovery fixtures PluginDiscoverer{..} = do
it "discovers plugins in the libexec dir" . withSetup $ do
ps <- discoverPlugins
fmap pluginName ps `shouldBe`
["(non-executable) ./plugins/git-vogue/non-executable"
,"exploding"
,"failing"
,"succeeding"
]
fmap enabled ps `shouldBe` [False, True, True, True]
it "disables and re-enables plugins" . withSetup $ do
disablePlugin "exploding"
ps <- filter enabled <$> discoverPlugins
fmap pluginName ps `shouldBe` ["failing", "succeeding"]
enablePlugin "exploding"
ps' <- filter enabled <$> discoverPlugins
fmap pluginName ps' `shouldBe` ["exploding", "failing", "succeeding"]
it "provides check methods that do the expected things" . withSetup $ do
ps <- filter enabled <$> discoverPlugins
rs <- sequence $ fmap (\Plugin{..} -> runCheck ["a"] ["a"]) ps
rs `shouldBe` [ Catastrophe 3 "something broke\n"
, Failure "ohnoes\n"
, Success "yay\n"]
it "provides fix methods that do the expected things" . withSetup $ do
ps <- filter enabled <$> discoverPlugins
rs <- sequence $ fmap (\Plugin{..} -> runFix ["a"] ["a"]) ps
rs `shouldBe` [ Catastrophe 3 "something broke\n"
, Failure "ohnoes\n"
, Success "yay\n"]
where
withSetup =
withGitRepo
. withCopy (fixtures </> "plugins") ("plugins" </> "git-vogue") | 1,618 | testLEDiscovery :: FilePath -> PluginDiscoverer IO -> Spec
testLEDiscovery fixtures PluginDiscoverer{..} = do
it "discovers plugins in the libexec dir" . withSetup $ do
ps <- discoverPlugins
fmap pluginName ps `shouldBe`
["(non-executable) ./plugins/git-vogue/non-executable"
,"exploding"
,"failing"
,"succeeding"
]
fmap enabled ps `shouldBe` [False, True, True, True]
it "disables and re-enables plugins" . withSetup $ do
disablePlugin "exploding"
ps <- filter enabled <$> discoverPlugins
fmap pluginName ps `shouldBe` ["failing", "succeeding"]
enablePlugin "exploding"
ps' <- filter enabled <$> discoverPlugins
fmap pluginName ps' `shouldBe` ["exploding", "failing", "succeeding"]
it "provides check methods that do the expected things" . withSetup $ do
ps <- filter enabled <$> discoverPlugins
rs <- sequence $ fmap (\Plugin{..} -> runCheck ["a"] ["a"]) ps
rs `shouldBe` [ Catastrophe 3 "something broke\n"
, Failure "ohnoes\n"
, Success "yay\n"]
it "provides fix methods that do the expected things" . withSetup $ do
ps <- filter enabled <$> discoverPlugins
rs <- sequence $ fmap (\Plugin{..} -> runFix ["a"] ["a"]) ps
rs `shouldBe` [ Catastrophe 3 "something broke\n"
, Failure "ohnoes\n"
, Success "yay\n"]
where
withSetup =
withGitRepo
. withCopy (fixtures </> "plugins") ("plugins" </> "git-vogue") | 1,618 | testLEDiscovery fixtures PluginDiscoverer{..} = do
it "discovers plugins in the libexec dir" . withSetup $ do
ps <- discoverPlugins
fmap pluginName ps `shouldBe`
["(non-executable) ./plugins/git-vogue/non-executable"
,"exploding"
,"failing"
,"succeeding"
]
fmap enabled ps `shouldBe` [False, True, True, True]
it "disables and re-enables plugins" . withSetup $ do
disablePlugin "exploding"
ps <- filter enabled <$> discoverPlugins
fmap pluginName ps `shouldBe` ["failing", "succeeding"]
enablePlugin "exploding"
ps' <- filter enabled <$> discoverPlugins
fmap pluginName ps' `shouldBe` ["exploding", "failing", "succeeding"]
it "provides check methods that do the expected things" . withSetup $ do
ps <- filter enabled <$> discoverPlugins
rs <- sequence $ fmap (\Plugin{..} -> runCheck ["a"] ["a"]) ps
rs `shouldBe` [ Catastrophe 3 "something broke\n"
, Failure "ohnoes\n"
, Success "yay\n"]
it "provides fix methods that do the expected things" . withSetup $ do
ps <- filter enabled <$> discoverPlugins
rs <- sequence $ fmap (\Plugin{..} -> runFix ["a"] ["a"]) ps
rs `shouldBe` [ Catastrophe 3 "something broke\n"
, Failure "ohnoes\n"
, Success "yay\n"]
where
withSetup =
withGitRepo
. withCopy (fixtures </> "plugins") ("plugins" </> "git-vogue") | 1,559 | false | true | 1 | 16 | 492 | 431 | 213 | 218 | null | null |
Numberartificial/workflow | snipets/src/Craft/Chapter17.hs | mit | -- Another definition of listSums which uses scanl1', a generalisation of the
-- original function.
listSums' = scanl' (+) 0 | 125 | listSums' = scanl' (+) 0 | 24 | listSums' = scanl' (+) 0 | 24 | true | false | 1 | 5 | 20 | 20 | 9 | 11 | null | null |
othercriteria/blaze | packaging/Math/Statistics/Inference/Blaze.hs | mit | zeroProb :: Prob
zeroProb = logFloat (0.0 :: Double) | 52 | zeroProb :: Prob
zeroProb = logFloat (0.0 :: Double) | 52 | zeroProb = logFloat (0.0 :: Double) | 35 | false | true | 0 | 6 | 8 | 20 | 11 | 9 | null | null |
rmcmaho/Haskell_OpenGL_Examples | TriSelect/TriSelect_Display.hs | gpl-3.0 | -- | Display callback
display :: TriObjectList -- ^ List of TriObject to display
-> IO ()
display objectList = do
myObjectList <- get objectList
preservingMatrix $ do
matrixMode $= Projection
loadIdentity
ortho2D (-175) 175 (-175) 175
matrixMode $= Modelview 0
clear [ColorBuffer]
scale zoom zoom zoom
rotate zRotation $ Vector3 0 0 (1::GLfloat)
render Render myObjectList
swapBuffers
flush
-- | Renders the triangles. If 'RenderMode' is 'Render', then the triangles are simply rendered.
-- If 'RenderMode' is 'Select', then the triangle names are loaded before rendering the triangles. | 642 | display :: TriObjectList -- ^ List of TriObject to display
-> IO ()
display objectList = do
myObjectList <- get objectList
preservingMatrix $ do
matrixMode $= Projection
loadIdentity
ortho2D (-175) 175 (-175) 175
matrixMode $= Modelview 0
clear [ColorBuffer]
scale zoom zoom zoom
rotate zRotation $ Vector3 0 0 (1::GLfloat)
render Render myObjectList
swapBuffers
flush
-- | Renders the triangles. If 'RenderMode' is 'Render', then the triangles are simply rendered.
-- If 'RenderMode' is 'Select', then the triangle names are loaded before rendering the triangles. | 620 | display objectList = do
myObjectList <- get objectList
preservingMatrix $ do
matrixMode $= Projection
loadIdentity
ortho2D (-175) 175 (-175) 175
matrixMode $= Modelview 0
clear [ColorBuffer]
scale zoom zoom zoom
rotate zRotation $ Vector3 0 0 (1::GLfloat)
render Render myObjectList
swapBuffers
flush
-- | Renders the triangles. If 'RenderMode' is 'Render', then the triangles are simply rendered.
-- If 'RenderMode' is 'Select', then the triangle names are loaded before rendering the triangles. | 541 | true | true | 0 | 12 | 144 | 142 | 65 | 77 | null | null |
dmwit/pi-eta-epsilon | src/Language/PiEtaEpsilon/Parser/Value.hs | bsd-3-clause | toP :: (Particle a) => Value -> a
toP (Fix ( Tuple x y)) = tuple (toP x) (toP y) | 81 | toP :: (Particle a) => Value -> a
toP (Fix ( Tuple x y)) = tuple (toP x) (toP y) | 81 | toP (Fix ( Tuple x y)) = tuple (toP x) (toP y) | 47 | false | true | 0 | 9 | 20 | 58 | 29 | 29 | null | null |
romanb/amazonka | amazonka-dynamodb/gen/Network/AWS/DynamoDB/PutItem.hs | mpl-2.0 | piReturnConsumedCapacity :: Lens' PutItem (Maybe ReturnConsumedCapacity)
piReturnConsumedCapacity =
lens _piReturnConsumedCapacity
(\s a -> s { _piReturnConsumedCapacity = a }) | 188 | piReturnConsumedCapacity :: Lens' PutItem (Maybe ReturnConsumedCapacity)
piReturnConsumedCapacity =
lens _piReturnConsumedCapacity
(\s a -> s { _piReturnConsumedCapacity = a }) | 188 | piReturnConsumedCapacity =
lens _piReturnConsumedCapacity
(\s a -> s { _piReturnConsumedCapacity = a }) | 115 | false | true | 0 | 9 | 30 | 45 | 24 | 21 | null | null |
ideas-edu/ideas | src/Ideas/Common/Rewriting/Unification.hs | apache-2.0 | products :: [[Substitution]] -> [Substitution]
products = foldr op [emptySubst]
where
op xs ys = catMaybes [ x @+@ y | x <- xs, y <- ys ] | 144 | products :: [[Substitution]] -> [Substitution]
products = foldr op [emptySubst]
where
op xs ys = catMaybes [ x @+@ y | x <- xs, y <- ys ] | 143 | products = foldr op [emptySubst]
where
op xs ys = catMaybes [ x @+@ y | x <- xs, y <- ys ] | 96 | false | true | 1 | 8 | 34 | 81 | 38 | 43 | null | null |
DavidAlphaFox/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | isOneOcc :: OccInfo -> Bool
isOneOcc (OneOcc {}) = True | 55 | isOneOcc :: OccInfo -> Bool
isOneOcc (OneOcc {}) = True | 55 | isOneOcc (OneOcc {}) = True | 27 | false | true | 0 | 7 | 9 | 25 | 13 | 12 | null | null |
olsner/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | integerToIntName = varQual gHC_INTEGER_TYPE (fsLit "integerToInt") integerToIntIdKey | 94 | integerToIntName = varQual gHC_INTEGER_TYPE (fsLit "integerToInt") integerToIntIdKey | 94 | integerToIntName = varQual gHC_INTEGER_TYPE (fsLit "integerToInt") integerToIntIdKey | 94 | false | false | 0 | 7 | 16 | 19 | 9 | 10 | null | null |
xmonad/xmonad-contrib | XMonad/Hooks/Place.hs | bsd-3-clause | screenInfo :: S.Screen i l a sid ScreenDetail -> (S.Workspace i l a, Rectangle)
screenInfo S.Screen{ S.workspace = ws, S.screenDetail = (SD s)} = (ws, s) | 153 | screenInfo :: S.Screen i l a sid ScreenDetail -> (S.Workspace i l a, Rectangle)
screenInfo S.Screen{ S.workspace = ws, S.screenDetail = (SD s)} = (ws, s) | 153 | screenInfo S.Screen{ S.workspace = ws, S.screenDetail = (SD s)} = (ws, s) | 73 | false | true | 3 | 10 | 25 | 83 | 42 | 41 | null | null |
Helkafen/cabal | cabal-install/Distribution/Client/Dependency/Modular/Preference.hs | bsd-3-clause | -- | Traversal that tries to establish various kinds of user constraints. Works
-- by selectively disabling choices that have been ruled out by global user
-- constraints.
enforcePackageConstraints :: M.Map PN [PackageConstraint] -> Tree QGoalReasonChain -> Tree QGoalReasonChain
enforcePackageConstraints pcs = trav go
where
go (PChoiceF qpn@(Q _ pn) gr ts) =
let c = toConflictSet (Goal (P qpn) gr)
-- compose the transformation functions for each of the relevant constraint
g = \ (POption i _) -> foldl (\ h pc -> h . processPackageConstraintP c i pc) id
(M.findWithDefault [] pn pcs)
in PChoiceF qpn gr (P.mapWithKey g ts)
go (FChoiceF qfn@(FN (PI (Q _ pn) _) f) gr tr m ts) =
let c = toConflictSet (Goal (F qfn) gr)
-- compose the transformation functions for each of the relevant constraint
g = \ b -> foldl (\ h pc -> h . processPackageConstraintF f c b pc) id
(M.findWithDefault [] pn pcs)
in FChoiceF qfn gr tr m (P.mapWithKey g ts)
go (SChoiceF qsn@(SN (PI (Q _ pn) _) f) gr tr ts) =
let c = toConflictSet (Goal (S qsn) gr)
-- compose the transformation functions for each of the relevant constraint
g = \ b -> foldl (\ h pc -> h . processPackageConstraintS f c b pc) id
(M.findWithDefault [] pn pcs)
in SChoiceF qsn gr tr (P.mapWithKey g ts)
go x = x
-- | Transformation that tries to enforce manual flags. Manual flags
-- can only be re-set explicitly by the user. This transformation should
-- be run after user preferences have been enforced. For manual flags,
-- it checks if a user choice has been made. If not, it disables all but
-- the first choice. | 1,794 | enforcePackageConstraints :: M.Map PN [PackageConstraint] -> Tree QGoalReasonChain -> Tree QGoalReasonChain
enforcePackageConstraints pcs = trav go
where
go (PChoiceF qpn@(Q _ pn) gr ts) =
let c = toConflictSet (Goal (P qpn) gr)
-- compose the transformation functions for each of the relevant constraint
g = \ (POption i _) -> foldl (\ h pc -> h . processPackageConstraintP c i pc) id
(M.findWithDefault [] pn pcs)
in PChoiceF qpn gr (P.mapWithKey g ts)
go (FChoiceF qfn@(FN (PI (Q _ pn) _) f) gr tr m ts) =
let c = toConflictSet (Goal (F qfn) gr)
-- compose the transformation functions for each of the relevant constraint
g = \ b -> foldl (\ h pc -> h . processPackageConstraintF f c b pc) id
(M.findWithDefault [] pn pcs)
in FChoiceF qfn gr tr m (P.mapWithKey g ts)
go (SChoiceF qsn@(SN (PI (Q _ pn) _) f) gr tr ts) =
let c = toConflictSet (Goal (S qsn) gr)
-- compose the transformation functions for each of the relevant constraint
g = \ b -> foldl (\ h pc -> h . processPackageConstraintS f c b pc) id
(M.findWithDefault [] pn pcs)
in SChoiceF qsn gr tr (P.mapWithKey g ts)
go x = x
-- | Transformation that tries to enforce manual flags. Manual flags
-- can only be re-set explicitly by the user. This transformation should
-- be run after user preferences have been enforced. For manual flags,
-- it checks if a user choice has been made. If not, it disables all but
-- the first choice. | 1,622 | enforcePackageConstraints pcs = trav go
where
go (PChoiceF qpn@(Q _ pn) gr ts) =
let c = toConflictSet (Goal (P qpn) gr)
-- compose the transformation functions for each of the relevant constraint
g = \ (POption i _) -> foldl (\ h pc -> h . processPackageConstraintP c i pc) id
(M.findWithDefault [] pn pcs)
in PChoiceF qpn gr (P.mapWithKey g ts)
go (FChoiceF qfn@(FN (PI (Q _ pn) _) f) gr tr m ts) =
let c = toConflictSet (Goal (F qfn) gr)
-- compose the transformation functions for each of the relevant constraint
g = \ b -> foldl (\ h pc -> h . processPackageConstraintF f c b pc) id
(M.findWithDefault [] pn pcs)
in FChoiceF qfn gr tr m (P.mapWithKey g ts)
go (SChoiceF qsn@(SN (PI (Q _ pn) _) f) gr tr ts) =
let c = toConflictSet (Goal (S qsn) gr)
-- compose the transformation functions for each of the relevant constraint
g = \ b -> foldl (\ h pc -> h . processPackageConstraintS f c b pc) id
(M.findWithDefault [] pn pcs)
in SChoiceF qsn gr tr (P.mapWithKey g ts)
go x = x
-- | Transformation that tries to enforce manual flags. Manual flags
-- can only be re-set explicitly by the user. This transformation should
-- be run after user preferences have been enforced. For manual flags,
-- it checks if a user choice has been made. If not, it disables all but
-- the first choice. | 1,514 | true | true | 0 | 14 | 512 | 497 | 252 | 245 | null | null |
nevrenato/Hets_Fork | GUI/GraphAbstraction.hs | gpl-2.0 | applyChanges' :: AbstractionGraph -- ^ The graph
-> [DGChange] -- ^ List of changes
-> [NodeId] -- ^ IDs of the nodes to hide
-> [EdgeId] -- ^ IDs of the edges to hide
-> [(NodeId, NodeId, DGEdgeType, Bool)] -- ^ A list of new edges
-> IO AbstractionGraph
applyChanges' g dgchanges hnIds heIds' ce = do
let
-- split and convert changes
(an', dn, cnt', ae', de) = foldr splitChange ([], [], [], [], []) dgchanges
-- get Ids
anIds = map (\ ~(AddNode nId _ _ _) -> nId) an'
dnIds = map (\ ~(DelNode nId) -> nId) dn
aeIds = map (\ ~(AddEdge eId _ _ _ _ _ _) -> eId) ae'
deIds = map (\ ~(DelEdge eId) -> eId) de
heIds = heIds' ++ map fst (filter (\ (eId, e) -> notElem eId deIds &&
notElem eId heIds' && (elem (ganTo e) hnIds || elem (ganFrom e) hnIds))
$ Map.toList $ edges g)
-- filter multiple changes and changes for deleted and new nodes
(cnt, new) = partition (\ ~(ChangeNodeType nId _) -> notElem nId anIds)
$ filter (\ ~(ChangeNodeType nId _) -> notElem nId dnIds) $ fst
$ foldr (\ ~c@(ChangeNodeType nId _) (cs, nIds) -> if elem nId nIds
then (cs, nIds) else (c : cs, nId : nIds)) ([], []) cnt'
-- fuction for geting new nt if node type change is submitted for node
nnT nId nT = foldl (\ nT' ~(ChangeNodeType nId' nT'') ->
if nId == nId' then nT'' else nT') nT new
-- update node type and mark as hidden if they would be hidden afterwards
an = map (\ ~(AddNode nId nT nN _) -> AddNode nId (nnT nId nT) nN
$ elem nId hnIds) an'
-- old compressed edges
oce = Map.keys $ compressedEdges g
-- delete compressed edges not needed anymore
dce = foldl (\ es e -> if elem e ce then es else DelCompEdge e : es) [] oce
-- get hidden nodes that are not hidden after update
sn = map ShowNode $ filter
(\ n -> isHiddenNode' g n && not (elem n hnIds || elem n dnIds))
$ Map.keys $ nodes g
-- edges to hide
he = map HideEdge $ filter
(\ eId -> notElem eId aeIds && not (isHiddenEdge' g eId)) heIds
-- mark as hidden if they would be hidden afterwards
ae = map (\ ~(AddEdge eId eT nIdF nIdT eN eL _) ->
AddEdge eId eT nIdF nIdT eN eL $ elem nIdF hnIds || elem nIdT hnIds ||
elem eId heIds) ae'
-- nodes to hide
hn = map HideNode $ filter
(\ nId -> notElem nId anIds && not (isHiddenNode' g nId)) hnIds
-- edges to show
se = map ShowEdge
$ filter (\ e -> isHiddenEdge' g e && notElem e heIds && notElem e deIds)
$ Map.keys $ edges g
-- get compressed edges to add
ace = foldl (\ es e -> if elem e oce then es else AddCompEdge e : es) [] ce
-- concat changes
changes = de ++ dce ++ dn ++ cnt ++ sn ++ an ++ he ++ hn ++ se ++ ae ++ ace
foldM applyChange g changes
-- | Apply changes to the uDrawGraph graph | 3,020 | applyChanges' :: AbstractionGraph -- ^ The graph
-> [DGChange] -- ^ List of changes
-> [NodeId] -- ^ IDs of the nodes to hide
-> [EdgeId] -- ^ IDs of the edges to hide
-> [(NodeId, NodeId, DGEdgeType, Bool)] -- ^ A list of new edges
-> IO AbstractionGraph
applyChanges' g dgchanges hnIds heIds' ce = do
let
-- split and convert changes
(an', dn, cnt', ae', de) = foldr splitChange ([], [], [], [], []) dgchanges
-- get Ids
anIds = map (\ ~(AddNode nId _ _ _) -> nId) an'
dnIds = map (\ ~(DelNode nId) -> nId) dn
aeIds = map (\ ~(AddEdge eId _ _ _ _ _ _) -> eId) ae'
deIds = map (\ ~(DelEdge eId) -> eId) de
heIds = heIds' ++ map fst (filter (\ (eId, e) -> notElem eId deIds &&
notElem eId heIds' && (elem (ganTo e) hnIds || elem (ganFrom e) hnIds))
$ Map.toList $ edges g)
-- filter multiple changes and changes for deleted and new nodes
(cnt, new) = partition (\ ~(ChangeNodeType nId _) -> notElem nId anIds)
$ filter (\ ~(ChangeNodeType nId _) -> notElem nId dnIds) $ fst
$ foldr (\ ~c@(ChangeNodeType nId _) (cs, nIds) -> if elem nId nIds
then (cs, nIds) else (c : cs, nId : nIds)) ([], []) cnt'
-- fuction for geting new nt if node type change is submitted for node
nnT nId nT = foldl (\ nT' ~(ChangeNodeType nId' nT'') ->
if nId == nId' then nT'' else nT') nT new
-- update node type and mark as hidden if they would be hidden afterwards
an = map (\ ~(AddNode nId nT nN _) -> AddNode nId (nnT nId nT) nN
$ elem nId hnIds) an'
-- old compressed edges
oce = Map.keys $ compressedEdges g
-- delete compressed edges not needed anymore
dce = foldl (\ es e -> if elem e ce then es else DelCompEdge e : es) [] oce
-- get hidden nodes that are not hidden after update
sn = map ShowNode $ filter
(\ n -> isHiddenNode' g n && not (elem n hnIds || elem n dnIds))
$ Map.keys $ nodes g
-- edges to hide
he = map HideEdge $ filter
(\ eId -> notElem eId aeIds && not (isHiddenEdge' g eId)) heIds
-- mark as hidden if they would be hidden afterwards
ae = map (\ ~(AddEdge eId eT nIdF nIdT eN eL _) ->
AddEdge eId eT nIdF nIdT eN eL $ elem nIdF hnIds || elem nIdT hnIds ||
elem eId heIds) ae'
-- nodes to hide
hn = map HideNode $ filter
(\ nId -> notElem nId anIds && not (isHiddenNode' g nId)) hnIds
-- edges to show
se = map ShowEdge
$ filter (\ e -> isHiddenEdge' g e && notElem e heIds && notElem e deIds)
$ Map.keys $ edges g
-- get compressed edges to add
ace = foldl (\ es e -> if elem e oce then es else AddCompEdge e : es) [] ce
-- concat changes
changes = de ++ dce ++ dn ++ cnt ++ sn ++ an ++ he ++ hn ++ se ++ ae ++ ace
foldM applyChange g changes
-- | Apply changes to the uDrawGraph graph | 3,020 | applyChanges' g dgchanges hnIds heIds' ce = do
let
-- split and convert changes
(an', dn, cnt', ae', de) = foldr splitChange ([], [], [], [], []) dgchanges
-- get Ids
anIds = map (\ ~(AddNode nId _ _ _) -> nId) an'
dnIds = map (\ ~(DelNode nId) -> nId) dn
aeIds = map (\ ~(AddEdge eId _ _ _ _ _ _) -> eId) ae'
deIds = map (\ ~(DelEdge eId) -> eId) de
heIds = heIds' ++ map fst (filter (\ (eId, e) -> notElem eId deIds &&
notElem eId heIds' && (elem (ganTo e) hnIds || elem (ganFrom e) hnIds))
$ Map.toList $ edges g)
-- filter multiple changes and changes for deleted and new nodes
(cnt, new) = partition (\ ~(ChangeNodeType nId _) -> notElem nId anIds)
$ filter (\ ~(ChangeNodeType nId _) -> notElem nId dnIds) $ fst
$ foldr (\ ~c@(ChangeNodeType nId _) (cs, nIds) -> if elem nId nIds
then (cs, nIds) else (c : cs, nId : nIds)) ([], []) cnt'
-- fuction for geting new nt if node type change is submitted for node
nnT nId nT = foldl (\ nT' ~(ChangeNodeType nId' nT'') ->
if nId == nId' then nT'' else nT') nT new
-- update node type and mark as hidden if they would be hidden afterwards
an = map (\ ~(AddNode nId nT nN _) -> AddNode nId (nnT nId nT) nN
$ elem nId hnIds) an'
-- old compressed edges
oce = Map.keys $ compressedEdges g
-- delete compressed edges not needed anymore
dce = foldl (\ es e -> if elem e ce then es else DelCompEdge e : es) [] oce
-- get hidden nodes that are not hidden after update
sn = map ShowNode $ filter
(\ n -> isHiddenNode' g n && not (elem n hnIds || elem n dnIds))
$ Map.keys $ nodes g
-- edges to hide
he = map HideEdge $ filter
(\ eId -> notElem eId aeIds && not (isHiddenEdge' g eId)) heIds
-- mark as hidden if they would be hidden afterwards
ae = map (\ ~(AddEdge eId eT nIdF nIdT eN eL _) ->
AddEdge eId eT nIdF nIdT eN eL $ elem nIdF hnIds || elem nIdT hnIds ||
elem eId heIds) ae'
-- nodes to hide
hn = map HideNode $ filter
(\ nId -> notElem nId anIds && not (isHiddenNode' g nId)) hnIds
-- edges to show
se = map ShowEdge
$ filter (\ e -> isHiddenEdge' g e && notElem e heIds && notElem e deIds)
$ Map.keys $ edges g
-- get compressed edges to add
ace = foldl (\ es e -> if elem e oce then es else AddCompEdge e : es) [] ce
-- concat changes
changes = de ++ dce ++ dn ++ cnt ++ sn ++ an ++ he ++ hn ++ se ++ ae ++ ace
foldM applyChange g changes
-- | Apply changes to the uDrawGraph graph | 2,694 | false | true | 0 | 23 | 971 | 1,061 | 551 | 510 | null | null |
paulolieuthier/haskell-concurrent-lists | src/CoarseGrained.hs | lgpl-2.1 | toPureList :: Eq a => CoarseGrainedList a -> IO [a]
toPureList (CoarseGrainedList mvar) =
let
go prevPtr xs = do
prevNode <- readIORef prevPtr
let currPtr = next prevNode
currNode <- readIORef currPtr
case currNode of
Node { val = val, next = nextNode } -> go currPtr (val:xs)
Null -> return . reverse $ xs
in withMVar mvar $ \head -> go head [] | 454 | toPureList :: Eq a => CoarseGrainedList a -> IO [a]
toPureList (CoarseGrainedList mvar) =
let
go prevPtr xs = do
prevNode <- readIORef prevPtr
let currPtr = next prevNode
currNode <- readIORef currPtr
case currNode of
Node { val = val, next = nextNode } -> go currPtr (val:xs)
Null -> return . reverse $ xs
in withMVar mvar $ \head -> go head [] | 454 | toPureList (CoarseGrainedList mvar) =
let
go prevPtr xs = do
prevNode <- readIORef prevPtr
let currPtr = next prevNode
currNode <- readIORef currPtr
case currNode of
Node { val = val, next = nextNode } -> go currPtr (val:xs)
Null -> return . reverse $ xs
in withMVar mvar $ \head -> go head [] | 402 | false | true | 2 | 16 | 173 | 167 | 77 | 90 | null | null |
liskin/strive | library/Strive/Internal/TH.hs | mit | capitalize :: String -> String
capitalize "" = "" | 49 | capitalize :: String -> String
capitalize "" = "" | 49 | capitalize "" = "" | 18 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
iquiw/hsbin | src/Hsbin/Routine.hs | mit | filterContents :: [String] -> FilePath -> IO [FilePath]
filterContents names dir = map (dir </>)
<$> filter (`notElem` ([".", ".."] ++ names))
<$> getDirectoryContents dir | 225 | filterContents :: [String] -> FilePath -> IO [FilePath]
filterContents names dir = map (dir </>)
<$> filter (`notElem` ([".", ".."] ++ names))
<$> getDirectoryContents dir | 225 | filterContents names dir = map (dir </>)
<$> filter (`notElem` ([".", ".."] ++ names))
<$> getDirectoryContents dir | 169 | false | true | 0 | 11 | 78 | 73 | 40 | 33 | null | null |
tjakway/ghcjvm | compiler/cmm/CLabel.hs | bsd-3-clause | pprCLbl (CC_Label cc) = ppr cc | 40 | pprCLbl (CC_Label cc) = ppr cc | 40 | pprCLbl (CC_Label cc) = ppr cc | 40 | false | false | 0 | 6 | 15 | 19 | 8 | 11 | null | null |
mdsteele/fallback | src/Fallback/Draw/Base.hs | gpl-3.0 | alterMinimap :: Minimap -> [(IPoint, Color)] -> IO ()
alterMinimap (Minimap texture) pixels = withTexture texture $ do
allocaBytes 4 $ \pixelPtr -> do
pokeElemOff pixelPtr 3 255
forM_ pixels $ \(Point x y, Color r g b) -> do
pokeElemOff pixelPtr 0 r
pokeElemOff pixelPtr 1 g
pokeElemOff pixelPtr 2 b
GL.texSubImage2D Nothing 0 (GL.TexturePosition2D (toGLint x) (toGLint y))
(GL.TextureSize2D 1 1) (GL.PixelData GL.RGBA GL.UnsignedByte pixelPtr)
-- | Draw the minimap to the screen. | 525 | alterMinimap :: Minimap -> [(IPoint, Color)] -> IO ()
alterMinimap (Minimap texture) pixels = withTexture texture $ do
allocaBytes 4 $ \pixelPtr -> do
pokeElemOff pixelPtr 3 255
forM_ pixels $ \(Point x y, Color r g b) -> do
pokeElemOff pixelPtr 0 r
pokeElemOff pixelPtr 1 g
pokeElemOff pixelPtr 2 b
GL.texSubImage2D Nothing 0 (GL.TexturePosition2D (toGLint x) (toGLint y))
(GL.TextureSize2D 1 1) (GL.PixelData GL.RGBA GL.UnsignedByte pixelPtr)
-- | Draw the minimap to the screen. | 525 | alterMinimap (Minimap texture) pixels = withTexture texture $ do
allocaBytes 4 $ \pixelPtr -> do
pokeElemOff pixelPtr 3 255
forM_ pixels $ \(Point x y, Color r g b) -> do
pokeElemOff pixelPtr 0 r
pokeElemOff pixelPtr 1 g
pokeElemOff pixelPtr 2 b
GL.texSubImage2D Nothing 0 (GL.TexturePosition2D (toGLint x) (toGLint y))
(GL.TextureSize2D 1 1) (GL.PixelData GL.RGBA GL.UnsignedByte pixelPtr)
-- | Draw the minimap to the screen. | 471 | false | true | 0 | 20 | 118 | 204 | 97 | 107 | null | null |
mmn80/feed-reader | src/FeedReader/Types.hs | bsd-3-clause | unpack :: Text -> String
unpack = T.unpack . unText | 51 | unpack :: Text -> String
unpack = T.unpack . unText | 51 | unpack = T.unpack . unText | 26 | false | true | 0 | 6 | 9 | 21 | 11 | 10 | null | null |
mrmonday/Idris-dev | src/Idris/Primitives.hs | bsd-3-clause | zext ITNative to [I x] = Just $ toInt to (fromIntegral x :: Word) | 65 | zext ITNative to [I x] = Just $ toInt to (fromIntegral x :: Word) | 65 | zext ITNative to [I x] = Just $ toInt to (fromIntegral x :: Word) | 65 | false | false | 0 | 8 | 13 | 37 | 18 | 19 | null | null |
fmthoma/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | mergeAlts :: [(AltCon, a, b)] -> [(AltCon, a, b)] -> [(AltCon, a, b)]
-- ^ Merge alternatives preserving order; alternatives in
-- the first argument shadow ones in the second
mergeAlts [] as2 = as2 | 198 | mergeAlts :: [(AltCon, a, b)] -> [(AltCon, a, b)] -> [(AltCon, a, b)]
mergeAlts [] as2 = as2 | 92 | mergeAlts [] as2 = as2 | 22 | true | true | 0 | 10 | 34 | 70 | 40 | 30 | null | null |
abooij/cubicaltt | Resolver.hs | mit | resolveExp :: Exp -> Resolver Ter
resolveExp e = case e of
U -> return CTT.U
Var x -> resolveVar x
App t s -> resolveApps x xs
where (x,xs) = unApps t [s]
Sigma ptele b -> do
tele <- flattenPTele ptele
binds CTT.Sigma tele (resolveExp b)
Pi ptele b -> do
tele <- flattenPTele ptele
binds CTT.Pi tele (resolveExp b)
Fun a b -> bind CTT.Pi ("_",a) (resolveExp b)
Lam ptele t -> do
tele <- flattenPTele ptele
lams tele (resolveExp t)
Fst t -> CTT.Fst <$> resolveExp t
Snd t -> CTT.Snd <$> resolveExp t
Pair t0 ts -> do
e <- resolveExp t0
es <- mapM resolveExp ts
return $ foldr1 CTT.Pair (e:es)
Let decls e -> do
(rdecls,names) <- resolveDecls decls
mkWheres rdecls <$> local (insertIdents names) (resolveExp e)
Path is e -> paths is (resolveExp e)
Hole (HoleIdent (l,_)) -> CTT.Hole <$> getLoc l
AppFormula t phi ->
let (x,xs,phis) = unAppsFormulas e []
in case x of
PCon n a ->
CTT.PCon (unAIdent n) <$> resolveExp a <*> mapM resolveExp xs
<*> mapM resolveFormula phis
_ -> CTT.AppFormula <$> resolveExp t <*> resolveFormula phi
IdP a u v -> CTT.IdP <$> resolveExp a <*> resolveExp u <*> resolveExp v
Comp u v ts -> CTT.Comp <$> resolveExp u <*> resolveExp v <*> resolveSystem ts
Fill u v ts -> CTT.Fill <$> resolveExp u <*> resolveExp v <*> resolveSystem ts
Trans u v -> CTT.Comp <$> resolveExp u <*> resolveExp v <*> pure Map.empty
Glue u ts -> CTT.Glue <$> resolveExp u <*> resolveSystem ts
GlueElem u ts -> CTT.GlueElem <$> resolveExp u <*> resolveSystem ts
UnGlueElem u ts -> CTT.UnGlueElem <$> resolveExp u <*> resolveSystem ts
_ -> do
modName <- asks envModule
throwError ("Could not resolve " ++ show e ++ " in module " ++ modName) | 1,875 | resolveExp :: Exp -> Resolver Ter
resolveExp e = case e of
U -> return CTT.U
Var x -> resolveVar x
App t s -> resolveApps x xs
where (x,xs) = unApps t [s]
Sigma ptele b -> do
tele <- flattenPTele ptele
binds CTT.Sigma tele (resolveExp b)
Pi ptele b -> do
tele <- flattenPTele ptele
binds CTT.Pi tele (resolveExp b)
Fun a b -> bind CTT.Pi ("_",a) (resolveExp b)
Lam ptele t -> do
tele <- flattenPTele ptele
lams tele (resolveExp t)
Fst t -> CTT.Fst <$> resolveExp t
Snd t -> CTT.Snd <$> resolveExp t
Pair t0 ts -> do
e <- resolveExp t0
es <- mapM resolveExp ts
return $ foldr1 CTT.Pair (e:es)
Let decls e -> do
(rdecls,names) <- resolveDecls decls
mkWheres rdecls <$> local (insertIdents names) (resolveExp e)
Path is e -> paths is (resolveExp e)
Hole (HoleIdent (l,_)) -> CTT.Hole <$> getLoc l
AppFormula t phi ->
let (x,xs,phis) = unAppsFormulas e []
in case x of
PCon n a ->
CTT.PCon (unAIdent n) <$> resolveExp a <*> mapM resolveExp xs
<*> mapM resolveFormula phis
_ -> CTT.AppFormula <$> resolveExp t <*> resolveFormula phi
IdP a u v -> CTT.IdP <$> resolveExp a <*> resolveExp u <*> resolveExp v
Comp u v ts -> CTT.Comp <$> resolveExp u <*> resolveExp v <*> resolveSystem ts
Fill u v ts -> CTT.Fill <$> resolveExp u <*> resolveExp v <*> resolveSystem ts
Trans u v -> CTT.Comp <$> resolveExp u <*> resolveExp v <*> pure Map.empty
Glue u ts -> CTT.Glue <$> resolveExp u <*> resolveSystem ts
GlueElem u ts -> CTT.GlueElem <$> resolveExp u <*> resolveSystem ts
UnGlueElem u ts -> CTT.UnGlueElem <$> resolveExp u <*> resolveSystem ts
_ -> do
modName <- asks envModule
throwError ("Could not resolve " ++ show e ++ " in module " ++ modName) | 1,875 | resolveExp e = case e of
U -> return CTT.U
Var x -> resolveVar x
App t s -> resolveApps x xs
where (x,xs) = unApps t [s]
Sigma ptele b -> do
tele <- flattenPTele ptele
binds CTT.Sigma tele (resolveExp b)
Pi ptele b -> do
tele <- flattenPTele ptele
binds CTT.Pi tele (resolveExp b)
Fun a b -> bind CTT.Pi ("_",a) (resolveExp b)
Lam ptele t -> do
tele <- flattenPTele ptele
lams tele (resolveExp t)
Fst t -> CTT.Fst <$> resolveExp t
Snd t -> CTT.Snd <$> resolveExp t
Pair t0 ts -> do
e <- resolveExp t0
es <- mapM resolveExp ts
return $ foldr1 CTT.Pair (e:es)
Let decls e -> do
(rdecls,names) <- resolveDecls decls
mkWheres rdecls <$> local (insertIdents names) (resolveExp e)
Path is e -> paths is (resolveExp e)
Hole (HoleIdent (l,_)) -> CTT.Hole <$> getLoc l
AppFormula t phi ->
let (x,xs,phis) = unAppsFormulas e []
in case x of
PCon n a ->
CTT.PCon (unAIdent n) <$> resolveExp a <*> mapM resolveExp xs
<*> mapM resolveFormula phis
_ -> CTT.AppFormula <$> resolveExp t <*> resolveFormula phi
IdP a u v -> CTT.IdP <$> resolveExp a <*> resolveExp u <*> resolveExp v
Comp u v ts -> CTT.Comp <$> resolveExp u <*> resolveExp v <*> resolveSystem ts
Fill u v ts -> CTT.Fill <$> resolveExp u <*> resolveExp v <*> resolveSystem ts
Trans u v -> CTT.Comp <$> resolveExp u <*> resolveExp v <*> pure Map.empty
Glue u ts -> CTT.Glue <$> resolveExp u <*> resolveSystem ts
GlueElem u ts -> CTT.GlueElem <$> resolveExp u <*> resolveSystem ts
UnGlueElem u ts -> CTT.UnGlueElem <$> resolveExp u <*> resolveSystem ts
_ -> do
modName <- asks envModule
throwError ("Could not resolve " ++ show e ++ " in module " ++ modName) | 1,841 | false | true | 0 | 18 | 541 | 809 | 367 | 442 | null | null |
brendanhay/gogol | gogol-securitycenter/gen/Network/Google/SecurityCenter/Types/Product.hs | mpl-2.0 | -- | Optional. String indicating the location of the expression for error
-- reporting, e.g. a file name and a position in the file.
eLocation :: Lens' Expr (Maybe Text)
eLocation
= lens _eLocation (\ s a -> s{_eLocation = a}) | 228 | eLocation :: Lens' Expr (Maybe Text)
eLocation
= lens _eLocation (\ s a -> s{_eLocation = a}) | 95 | eLocation
= lens _eLocation (\ s a -> s{_eLocation = a}) | 58 | true | true | 0 | 9 | 42 | 49 | 26 | 23 | null | null |
BioHaskell/hRosetta | tests/test_Restraints.hs | bsd-3-clause | pairs (b:c:cs) = (b,c):pairs (c:cs) | 35 | pairs (b:c:cs) = (b,c):pairs (c:cs) | 35 | pairs (b:c:cs) = (b,c):pairs (c:cs) | 35 | false | false | 0 | 8 | 4 | 40 | 21 | 19 | null | null |
li-zhirui/EoplLangs | src/InferredLang/TypeChecker.hs | bsd-3-clause | typeOfLetExpr :: [(String, Expression)] -> Expression -> TypeEnvironment
-> TypeResult
typeOfLetExpr binds body tenv = do
typeBinds <- foldr func (return []) binds
typeOf body (extendMany typeBinds tenv)
where
func (name, expr) acc = do
typ <- typeOf expr tenv
typeBinds <- acc
return $ (name, typ) : typeBinds | 352 | typeOfLetExpr :: [(String, Expression)] -> Expression -> TypeEnvironment
-> TypeResult
typeOfLetExpr binds body tenv = do
typeBinds <- foldr func (return []) binds
typeOf body (extendMany typeBinds tenv)
where
func (name, expr) acc = do
typ <- typeOf expr tenv
typeBinds <- acc
return $ (name, typ) : typeBinds | 352 | typeOfLetExpr binds body tenv = do
typeBinds <- foldr func (return []) binds
typeOf body (extendMany typeBinds tenv)
where
func (name, expr) acc = do
typ <- typeOf expr tenv
typeBinds <- acc
return $ (name, typ) : typeBinds | 251 | false | true | 1 | 11 | 90 | 142 | 66 | 76 | null | null |
olorin/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | Indicates whether the volume is deleted on instance termination.
eibdDeleteOnTermination :: Lens' EBSInstanceBlockDevice (Maybe Bool)
eibdDeleteOnTermination = lens _eibdDeleteOnTermination (\ s a -> s{_eibdDeleteOnTermination = a}) | 237 | eibdDeleteOnTermination :: Lens' EBSInstanceBlockDevice (Maybe Bool)
eibdDeleteOnTermination = lens _eibdDeleteOnTermination (\ s a -> s{_eibdDeleteOnTermination = a}) | 167 | eibdDeleteOnTermination = lens _eibdDeleteOnTermination (\ s a -> s{_eibdDeleteOnTermination = a}) | 98 | true | true | 0 | 9 | 27 | 46 | 25 | 21 | null | null |
mrakgr/futhark | src/Futhark/CodeGen/ImpGen/Kernels/ToOpenCL.hs | bsd-3-clause | kernelArgs (AnyKernel kernel) =
map (SharedMemoryArg . memSizeToExp . localMemorySize)
(kernelLocalMemory kernel) ++
map useToArg (kernelUses kernel)
where localMemorySize (_, size, _) = size | 203 | kernelArgs (AnyKernel kernel) =
map (SharedMemoryArg . memSizeToExp . localMemorySize)
(kernelLocalMemory kernel) ++
map useToArg (kernelUses kernel)
where localMemorySize (_, size, _) = size | 203 | kernelArgs (AnyKernel kernel) =
map (SharedMemoryArg . memSizeToExp . localMemorySize)
(kernelLocalMemory kernel) ++
map useToArg (kernelUses kernel)
where localMemorySize (_, size, _) = size | 203 | false | false | 2 | 7 | 35 | 78 | 36 | 42 | null | null |
cchalmers/geometry | src/Geometry/TwoD/Size.hs | bsd-3-clause | -- | Make a 'SizeSpec' with only height defined.
mkHeight :: Num n => n -> SizeSpec V2 n
mkHeight h = dims (V2 0 h) | 115 | mkHeight :: Num n => n -> SizeSpec V2 n
mkHeight h = dims (V2 0 h) | 66 | mkHeight h = dims (V2 0 h) | 26 | true | true | 0 | 7 | 25 | 42 | 20 | 22 | null | null |
greenrd/wpfixcites | src/Text/Mediawiki/Wikipedia.hs | bsd-3-clause | handleMixedContent :: [LocatedTree] -> Maybe (Path, String)
handleMixedContent [LocatedTree { path, tree = NTree (XText s) _ }] = Just (path, s) | 144 | handleMixedContent :: [LocatedTree] -> Maybe (Path, String)
handleMixedContent [LocatedTree { path, tree = NTree (XText s) _ }] = Just (path, s) | 144 | handleMixedContent [LocatedTree { path, tree = NTree (XText s) _ }] = Just (path, s) | 84 | false | true | 4 | 8 | 21 | 67 | 36 | 31 | null | null |
luzhuomi/cpp-obs | Language/C/Obfuscate/ASTUtils.hs | apache-2.0 | isVoidDeclSpec _ = False | 24 | isVoidDeclSpec _ = False | 24 | isVoidDeclSpec _ = False | 24 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
juodaspaulius/clafer | src/Language/Clafer/Generator/Graph.hs | mit | graphCVLCard (CardSome _) _ _ = "1..*" | 40 | graphCVLCard (CardSome _) _ _ = "1..*" | 40 | graphCVLCard (CardSome _) _ _ = "1..*" | 40 | false | false | 0 | 7 | 8 | 19 | 9 | 10 | null | null |
snoyberg/ghc | libraries/compact/tests/compact_simple_array.hs | bsd-3-clause | assertEquals :: (Eq a, Show a) => a -> a -> IO ()
assertEquals expected actual =
if expected == actual then return ()
else assertFail $ "expected " ++ (show expected)
++ ", got " ++ (show actual) | 206 | assertEquals :: (Eq a, Show a) => a -> a -> IO ()
assertEquals expected actual =
if expected == actual then return ()
else assertFail $ "expected " ++ (show expected)
++ ", got " ++ (show actual) | 206 | assertEquals expected actual =
if expected == actual then return ()
else assertFail $ "expected " ++ (show expected)
++ ", got " ++ (show actual) | 156 | false | true | 0 | 10 | 49 | 89 | 45 | 44 | null | null |
karamellpelle/grid | designer/source/LevelTools/Helpers.hs | gpl-3.0 | editModifyGrid edit f =
edit { editGrid = f (editGrid edit) } | 65 | editModifyGrid edit f =
edit { editGrid = f (editGrid edit) } | 65 | editModifyGrid edit f =
edit { editGrid = f (editGrid edit) } | 65 | false | false | 0 | 9 | 15 | 28 | 14 | 14 | null | null |
nbloomf/st-haskell | src/STH/Lib/Read/IntSet.hs | gpl-3.0 | readIntSet :: String -> Maybe (Int -> Bool)
readIntSet xs = do
cs <- readIntSet' xs
return (\k -> inIntSet k cs) | 116 | readIntSet :: String -> Maybe (Int -> Bool)
readIntSet xs = do
cs <- readIntSet' xs
return (\k -> inIntSet k cs) | 116 | readIntSet xs = do
cs <- readIntSet' xs
return (\k -> inIntSet k cs) | 72 | false | true | 0 | 10 | 25 | 57 | 27 | 30 | null | null |
GaloisInc/elf | src/Data/ElfEdit/Types.hs | bsd-3-clause | -- | Return the header information about the elf
elfHeader :: Elf w -> ElfHeader w
elfHeader e = ElfHeader { headerData = elfData e
, headerClass = elfClass e
, headerOSABI = elfOSABI e
, headerABIVersion = elfABIVersion e
, headerType = elfType e
, headerMachine = elfMachine e
, headerEntry = elfEntry e
, headerFlags = elfFlags e
} | 561 | elfHeader :: Elf w -> ElfHeader w
elfHeader e = ElfHeader { headerData = elfData e
, headerClass = elfClass e
, headerOSABI = elfOSABI e
, headerABIVersion = elfABIVersion e
, headerType = elfType e
, headerMachine = elfMachine e
, headerEntry = elfEntry e
, headerFlags = elfFlags e
} | 512 | elfHeader e = ElfHeader { headerData = elfData e
, headerClass = elfClass e
, headerOSABI = elfOSABI e
, headerABIVersion = elfABIVersion e
, headerType = elfType e
, headerMachine = elfMachine e
, headerEntry = elfEntry e
, headerFlags = elfFlags e
} | 478 | true | true | 0 | 7 | 287 | 99 | 53 | 46 | null | null |
sarangj/eulerhs | src/Problems/Problem10.hs | bsd-3-clause | getSolution :: Int
getSolution = sum $ filter isPrime [1 .. 2000000] | 69 | getSolution :: Int
getSolution = sum $ filter isPrime [1 .. 2000000] | 68 | getSolution = sum $ filter isPrime [1 .. 2000000] | 49 | false | true | 0 | 7 | 12 | 26 | 14 | 12 | null | null |
TOSPIO/yi | src/library/Yi/Buffer/Region.hs | gpl-2.0 | -- | Extend the right bound of a region to include it.
inclusiveRegionB :: Region -> BufferM Region
inclusiveRegionB r =
if regionStart r <= regionEnd r
then mkRegion (regionStart r) <$> pointAfterCursorB (regionEnd r)
else mkRegion <$> pointAfterCursorB (regionStart r) <*> pure (regionEnd r) | 331 | inclusiveRegionB :: Region -> BufferM Region
inclusiveRegionB r =
if regionStart r <= regionEnd r
then mkRegion (regionStart r) <$> pointAfterCursorB (regionEnd r)
else mkRegion <$> pointAfterCursorB (regionStart r) <*> pure (regionEnd r) | 276 | inclusiveRegionB r =
if regionStart r <= regionEnd r
then mkRegion (regionStart r) <$> pointAfterCursorB (regionEnd r)
else mkRegion <$> pointAfterCursorB (regionStart r) <*> pure (regionEnd r) | 231 | true | true | 0 | 10 | 82 | 88 | 42 | 46 | null | null |
sjfloat/dnngraph | NN/Backend/Torch/Flat.hs | bsd-3-clause | flatten' :: Net -> Maybe (Flat LayerParameter)
flatten' gr = do
flattened <- flattenStructure gr
return $ (lab' . context gr) <$> flattened | 143 | flatten' :: Net -> Maybe (Flat LayerParameter)
flatten' gr = do
flattened <- flattenStructure gr
return $ (lab' . context gr) <$> flattened | 143 | flatten' gr = do
flattened <- flattenStructure gr
return $ (lab' . context gr) <$> flattened | 96 | false | true | 0 | 11 | 26 | 58 | 27 | 31 | null | null |
Booster2/Booster2 | Workflow_Precond/impl_nondisjoint/Workflows.hs | bsd-3-clause | exParWf6 = Par [exSeqWfSingle12,exSeqWfMixed21] | 50 | exParWf6 = Par [exSeqWfSingle12,exSeqWfMixed21] | 50 | exParWf6 = Par [exSeqWfSingle12,exSeqWfMixed21] | 50 | false | false | 0 | 6 | 6 | 15 | 8 | 7 | null | null |
kadena-io/pact | src-ghc/Pact/GasModel/GasTests.hs | bsd-3-clause | intToStrTests :: NativeDefName -> GasUnitTests
intToStrTests = defGasUnitTests allExprs
where
int2strExpr (valInt,baseInt) =
defPactExpression [text| (int-to-str $base $val) |]
where base = intToStr baseInt
val = intToStr valInt
baseList :: NonEmpty Integer
baseList = 64 :| [2..16]
-- TODO is foldr1 the best thing to do here
-- | Test every base conversion against three different number sizes
args = F.foldr1 (<>) $ NEL.map (\(_, n) -> NEL.map (\b -> (n,b)) baseList) sizes
allExprs = NEL.map (int2strExpr) args | 570 | intToStrTests :: NativeDefName -> GasUnitTests
intToStrTests = defGasUnitTests allExprs
where
int2strExpr (valInt,baseInt) =
defPactExpression [text| (int-to-str $base $val) |]
where base = intToStr baseInt
val = intToStr valInt
baseList :: NonEmpty Integer
baseList = 64 :| [2..16]
-- TODO is foldr1 the best thing to do here
-- | Test every base conversion against three different number sizes
args = F.foldr1 (<>) $ NEL.map (\(_, n) -> NEL.map (\b -> (n,b)) baseList) sizes
allExprs = NEL.map (int2strExpr) args | 570 | intToStrTests = defGasUnitTests allExprs
where
int2strExpr (valInt,baseInt) =
defPactExpression [text| (int-to-str $base $val) |]
where base = intToStr baseInt
val = intToStr valInt
baseList :: NonEmpty Integer
baseList = 64 :| [2..16]
-- TODO is foldr1 the best thing to do here
-- | Test every base conversion against three different number sizes
args = F.foldr1 (<>) $ NEL.map (\(_, n) -> NEL.map (\b -> (n,b)) baseList) sizes
allExprs = NEL.map (int2strExpr) args | 523 | false | true | 3 | 12 | 133 | 163 | 87 | 76 | null | null |
ComputationWithBoundedResources/tct-trs | src/Tct/Trs/Data/Rewriting.hs | bsd-3-clause | toPairs :: [CP f v v] -> [(Term f (Either v v), Term f (Either v v))]
toPairs = map (left &&& right) | 100 | toPairs :: [CP f v v] -> [(Term f (Either v v), Term f (Either v v))]
toPairs = map (left &&& right) | 100 | toPairs = map (left &&& right) | 30 | false | true | 0 | 10 | 22 | 70 | 36 | 34 | null | null |
olsner/ghc | compiler/nativeGen/SPARC/CodeGen.hs | bsd-3-clause | generateJumpTableForInstr :: DynFlags -> Instr
-> Maybe (NatCmmDecl CmmStatics Instr)
generateJumpTableForInstr dflags (JMP_TBL _ ids label) =
let jumpTable = map (jumpTableEntry dflags) ids
in Just (CmmData (Section ReadOnlyData label) (Statics label jumpTable)) | 293 | generateJumpTableForInstr :: DynFlags -> Instr
-> Maybe (NatCmmDecl CmmStatics Instr)
generateJumpTableForInstr dflags (JMP_TBL _ ids label) =
let jumpTable = map (jumpTableEntry dflags) ids
in Just (CmmData (Section ReadOnlyData label) (Statics label jumpTable)) | 293 | generateJumpTableForInstr dflags (JMP_TBL _ ids label) =
let jumpTable = map (jumpTableEntry dflags) ids
in Just (CmmData (Section ReadOnlyData label) (Statics label jumpTable)) | 181 | false | true | 0 | 11 | 62 | 94 | 45 | 49 | null | null |
stefan-j/ProjectEuler | q57.hs | mit | toIntegerList :: Integer -> [Integer]
toIntegerList n = map toInt (show n)
where toInt c = read (c:"") :: Integer | 116 | toIntegerList :: Integer -> [Integer]
toIntegerList n = map toInt (show n)
where toInt c = read (c:"") :: Integer | 115 | toIntegerList n = map toInt (show n)
where toInt c = read (c:"") :: Integer | 77 | false | true | 0 | 7 | 22 | 56 | 28 | 28 | null | null |
mfpi/OpenGL | Graphics/Rendering/OpenGL/GL/Evaluators.hs | bsd-3-clause | evalMesh2 :: PolygonMode -> (GLint, GLint) -> (GLint, GLint) -> IO ()
evalMesh2 m (p1, p2) (q1, q2) = glEvalMesh2 (marshalPolygonMode m) p1 p2 q1 q2 | 148 | evalMesh2 :: PolygonMode -> (GLint, GLint) -> (GLint, GLint) -> IO ()
evalMesh2 m (p1, p2) (q1, q2) = glEvalMesh2 (marshalPolygonMode m) p1 p2 q1 q2 | 148 | evalMesh2 m (p1, p2) (q1, q2) = glEvalMesh2 (marshalPolygonMode m) p1 p2 q1 q2 | 78 | false | true | 0 | 9 | 25 | 76 | 41 | 35 | null | null |
Peaker/keyvaluehash | src/Database/KeyValueHash.hs | bsd-3-clause | deleteKey :: Database -> Key -> IO ()
deleteKey db key = do
mResult <- findKey db key
case mResult of
Just (valuePtrRef, valueHeader) ->
-- The old value now becomes unreachable
vprSet valuePtrRef $ vhNextCollision valueHeader
Nothing ->
-- TODO: Throw exception?
return () | 309 | deleteKey :: Database -> Key -> IO ()
deleteKey db key = do
mResult <- findKey db key
case mResult of
Just (valuePtrRef, valueHeader) ->
-- The old value now becomes unreachable
vprSet valuePtrRef $ vhNextCollision valueHeader
Nothing ->
-- TODO: Throw exception?
return () | 309 | deleteKey db key = do
mResult <- findKey db key
case mResult of
Just (valuePtrRef, valueHeader) ->
-- The old value now becomes unreachable
vprSet valuePtrRef $ vhNextCollision valueHeader
Nothing ->
-- TODO: Throw exception?
return () | 271 | false | true | 0 | 12 | 80 | 91 | 42 | 49 | null | null |
ktvoelker/auth-proxy | src/Session.hs | bsd-3-clause | setCookie :: Config.T -> T -> IO Header
setCookie c session = do
bytes <- CS.encryptIO (view Config.authKey c) . toStrict $ encode session
return
$ ( "Set-Cookie"
, toStrict
. toLazyByteString
. renderSetCookie
$ def
{ setCookieName = view Config.authCookie c
, setCookieValue = bytes
, setCookieHttpOnly = True
, setCookiePath = Just "/"
}
) | 436 | setCookie :: Config.T -> T -> IO Header
setCookie c session = do
bytes <- CS.encryptIO (view Config.authKey c) . toStrict $ encode session
return
$ ( "Set-Cookie"
, toStrict
. toLazyByteString
. renderSetCookie
$ def
{ setCookieName = view Config.authCookie c
, setCookieValue = bytes
, setCookieHttpOnly = True
, setCookiePath = Just "/"
}
) | 436 | setCookie c session = do
bytes <- CS.encryptIO (view Config.authKey c) . toStrict $ encode session
return
$ ( "Set-Cookie"
, toStrict
. toLazyByteString
. renderSetCookie
$ def
{ setCookieName = view Config.authCookie c
, setCookieValue = bytes
, setCookieHttpOnly = True
, setCookiePath = Just "/"
}
) | 396 | false | true | 0 | 13 | 150 | 123 | 63 | 60 | null | null |
Daniel-Diaz/binary-list | Data/BinaryList/Serialize.hs | bsd-3-clause | - | Decode a binary list using the 'Binary' instance of
-- its elements. It returns a 'String' in case of
-- decoding failure.
decode :: Binary a => ByteString -> Either String (BinList a)
decode input = encodedFromByteString input >>= fromDecoded . decData . decodeBinList get
| 282 | decode :: Binary a => ByteString -> Either String (BinList a)
decode input = encodedFromByteString input >>= fromDecoded . decData . decodeBinList get | 150 | decode input = encodedFromByteString input >>= fromDecoded . decData . decodeBinList get | 88 | true | true | 1 | 9 | 51 | 65 | 35 | 30 | null | null |
fhaust/aer-utils | src/VanRossumError.hs | mit | errFun :: S.Vector (V4 Double) -> V3 Double -> Double
errFun gs (V3 x y z) = S.sum $ S.map (\(V4 a b c d) -> gauss (V4 a (x-b) (y-c) (z-d))) gs | 143 | errFun :: S.Vector (V4 Double) -> V3 Double -> Double
errFun gs (V3 x y z) = S.sum $ S.map (\(V4 a b c d) -> gauss (V4 a (x-b) (y-c) (z-d))) gs | 143 | errFun gs (V3 x y z) = S.sum $ S.map (\(V4 a b c d) -> gauss (V4 a (x-b) (y-c) (z-d))) gs | 89 | false | true | 0 | 13 | 32 | 122 | 60 | 62 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/S3BucketReplicationRule.hs | mit | s3BucketReplicationRule
:: S3BucketReplicationDestination -- ^ 'sbrrDestination'
-> Val Text -- ^ 'sbrrPrefix'
-> Val Text -- ^ 'sbrrStatus'
-> S3BucketReplicationRule
s3BucketReplicationRule destinationarg prefixarg statusarg =
S3BucketReplicationRule
{ _s3BucketReplicationRuleDestination = destinationarg
, _s3BucketReplicationRuleId = Nothing
, _s3BucketReplicationRulePrefix = prefixarg
, _s3BucketReplicationRuleSourceSelectionCriteria = Nothing
, _s3BucketReplicationRuleStatus = statusarg
} | 520 | s3BucketReplicationRule
:: S3BucketReplicationDestination -- ^ 'sbrrDestination'
-> Val Text -- ^ 'sbrrPrefix'
-> Val Text -- ^ 'sbrrStatus'
-> S3BucketReplicationRule
s3BucketReplicationRule destinationarg prefixarg statusarg =
S3BucketReplicationRule
{ _s3BucketReplicationRuleDestination = destinationarg
, _s3BucketReplicationRuleId = Nothing
, _s3BucketReplicationRulePrefix = prefixarg
, _s3BucketReplicationRuleSourceSelectionCriteria = Nothing
, _s3BucketReplicationRuleStatus = statusarg
} | 520 | s3BucketReplicationRule destinationarg prefixarg statusarg =
S3BucketReplicationRule
{ _s3BucketReplicationRuleDestination = destinationarg
, _s3BucketReplicationRuleId = Nothing
, _s3BucketReplicationRulePrefix = prefixarg
, _s3BucketReplicationRuleSourceSelectionCriteria = Nothing
, _s3BucketReplicationRuleStatus = statusarg
} | 344 | false | true | 0 | 9 | 68 | 80 | 43 | 37 | null | null |
Denommus/stack | src/Stack/Dot.hs | bsd-3-clause | printLocalNodes :: (F.Foldable t, MonadIO m)
=> DotOpts
-> t PackageName
-> m ()
printLocalNodes dotOpts locals = liftIO $ Text.putStrLn (Text.intercalate "\n" lpNodes)
where applyStyle :: Text -> Text
applyStyle n = if dotIncludeExternal dotOpts
then n <> " [style=dashed];"
else n <> " [style=solid];"
lpNodes :: [Text]
lpNodes = map (applyStyle . nodeName) (F.toList locals)
-- | Print nodes without dependencies | 540 | printLocalNodes :: (F.Foldable t, MonadIO m)
=> DotOpts
-> t PackageName
-> m ()
printLocalNodes dotOpts locals = liftIO $ Text.putStrLn (Text.intercalate "\n" lpNodes)
where applyStyle :: Text -> Text
applyStyle n = if dotIncludeExternal dotOpts
then n <> " [style=dashed];"
else n <> " [style=solid];"
lpNodes :: [Text]
lpNodes = map (applyStyle . nodeName) (F.toList locals)
-- | Print nodes without dependencies | 540 | printLocalNodes dotOpts locals = liftIO $ Text.putStrLn (Text.intercalate "\n" lpNodes)
where applyStyle :: Text -> Text
applyStyle n = if dotIncludeExternal dotOpts
then n <> " [style=dashed];"
else n <> " [style=solid];"
lpNodes :: [Text]
lpNodes = map (applyStyle . nodeName) (F.toList locals)
-- | Print nodes without dependencies | 411 | false | true | 0 | 10 | 187 | 157 | 75 | 82 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Math/DeltaGraph.hs | mit | applyAddEdgeU :: ED -> Upsilon -> Upsilon
applyAddEdgeU (e, v, _, n') = (:) (e, v, n') | 86 | applyAddEdgeU :: ED -> Upsilon -> Upsilon
applyAddEdgeU (e, v, _, n') = (:) (e, v, n') | 86 | applyAddEdgeU (e, v, _, n') = (:) (e, v, n') | 44 | false | true | 0 | 6 | 16 | 48 | 28 | 20 | null | null |
josuf107/Fizzckle | src/Fizz/Store.hs | gpl-3.0 | save :: MaybeTimestamped ExpenseEntry -> IO ()
save = record . withSecond Save | 78 | save :: MaybeTimestamped ExpenseEntry -> IO ()
save = record . withSecond Save | 78 | save = record . withSecond Save | 31 | false | true | 0 | 7 | 12 | 30 | 14 | 16 | null | null |
colymore/Uned | Tlp-Skyline-Haskell/src/Skyline.hs | apache-2.0 | resuelveSkyline xs = combina (resuelveSkyline(fst(divide(xs))),resuelveSkyline(snd(divide(xs)))) | 96 | resuelveSkyline xs = combina (resuelveSkyline(fst(divide(xs))),resuelveSkyline(snd(divide(xs)))) | 96 | resuelveSkyline xs = combina (resuelveSkyline(fst(divide(xs))),resuelveSkyline(snd(divide(xs)))) | 96 | false | false | 0 | 12 | 4 | 54 | 27 | 27 | null | null |
dpatti/coverbot | Main.hs | mit | stateFile :: String
stateFile = ".state" | 40 | stateFile :: String
stateFile = ".state" | 40 | stateFile = ".state" | 20 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
asztal/transact-sql | Language/TransactSql/Parser.hs | bsd-3-clause | -- TODO: Dotted notation (figure out least ugly way)
objectName :: P ObjectName
objectName = try (ObjectName <$> part
<*> (period *> opt)
<*> (period *> opt)
<*> (period *> loc rawIdent)) -- server.database?.schema?.obj
<|> try (ObjectName Nothing <$> part
<*> (period *> opt)
<*> (period *> loc rawIdent)) -- database.schema?.obj
<|> try (ObjectName Nothing Nothing <$> part <*> (period *> loc rawIdent))
<|> ObjectName Nothing Nothing Nothing <$> loc rawIdent
<?> "object name"
where part = Just <$> loc rawIdent
opt = optionMaybe (loc rawIdent) | 778 | objectName :: P ObjectName
objectName = try (ObjectName <$> part
<*> (period *> opt)
<*> (period *> opt)
<*> (period *> loc rawIdent)) -- server.database?.schema?.obj
<|> try (ObjectName Nothing <$> part
<*> (period *> opt)
<*> (period *> loc rawIdent)) -- database.schema?.obj
<|> try (ObjectName Nothing Nothing <$> part <*> (period *> loc rawIdent))
<|> ObjectName Nothing Nothing Nothing <$> loc rawIdent
<?> "object name"
where part = Just <$> loc rawIdent
opt = optionMaybe (loc rawIdent) | 725 | objectName = try (ObjectName <$> part
<*> (period *> opt)
<*> (period *> opt)
<*> (period *> loc rawIdent)) -- server.database?.schema?.obj
<|> try (ObjectName Nothing <$> part
<*> (period *> opt)
<*> (period *> loc rawIdent)) -- database.schema?.obj
<|> try (ObjectName Nothing Nothing <$> part <*> (period *> loc rawIdent))
<|> ObjectName Nothing Nothing Nothing <$> loc rawIdent
<?> "object name"
where part = Just <$> loc rawIdent
opt = optionMaybe (loc rawIdent) | 698 | true | true | 1 | 16 | 316 | 189 | 95 | 94 | null | null |
spechub/Hets | Maude/Language.hs | gpl-2.0 | -- * Generic Parser combinators
-- | Run the argument but return 'Nothing'
ignore :: (Monad m) => m a -> m (Maybe b)
ignore parser = parser >> return Nothing | 158 | ignore :: (Monad m) => m a -> m (Maybe b)
ignore parser = parser >> return Nothing | 82 | ignore parser = parser >> return Nothing | 40 | true | true | 0 | 9 | 31 | 48 | 24 | 24 | null | null |
headprogrammingczar/cabal | Cabal/Distribution/Simple/Utils.hs | bsd-3-clause | findFile :: [FilePath] -- ^search locations
-> FilePath -- ^File Name
-> IO FilePath
findFile searchPath fileName =
findFirstFile id
[ path </> fileName
| path <- nub searchPath]
>>= maybe (die $ fileName ++ " doesn't exist") return | 270 | findFile :: [FilePath] -- ^search locations
-> FilePath -- ^File Name
-> IO FilePath
findFile searchPath fileName =
findFirstFile id
[ path </> fileName
| path <- nub searchPath]
>>= maybe (die $ fileName ++ " doesn't exist") return | 270 | findFile searchPath fileName =
findFirstFile id
[ path </> fileName
| path <- nub searchPath]
>>= maybe (die $ fileName ++ " doesn't exist") return | 159 | false | true | 2 | 8 | 76 | 78 | 39 | 39 | null | null |
kRITZCREEK/psc-ide | test/PureScript/Ide/ReexportsSpec.hs | mit | decl1 = FunctionDecl "filter" "asdasd" | 38 | decl1 = FunctionDecl "filter" "asdasd" | 38 | decl1 = FunctionDecl "filter" "asdasd" | 38 | false | false | 1 | 5 | 4 | 14 | 5 | 9 | null | null |
geocurnoff/nikki | src/Object/Types.hs | lgpl-3.0 | mkEditorObject :: Sort_ -> EditorPosition -> EditorObject Sort_
mkEditorObject sort pos =
EditorObject sort pos oemState
where
oemState = fmap (\ methods -> oemInitialize methods pos) $ objectEditMode sort | 215 | mkEditorObject :: Sort_ -> EditorPosition -> EditorObject Sort_
mkEditorObject sort pos =
EditorObject sort pos oemState
where
oemState = fmap (\ methods -> oemInitialize methods pos) $ objectEditMode sort | 215 | mkEditorObject sort pos =
EditorObject sort pos oemState
where
oemState = fmap (\ methods -> oemInitialize methods pos) $ objectEditMode sort | 151 | false | true | 0 | 9 | 38 | 65 | 31 | 34 | null | null |
105424/cis194 | src/Cis194/Hw/Golf.hs | bsd-3-clause | histogram :: [Integer] -> String
histogram _ = "" | 49 | histogram :: [Integer] -> String
histogram _ = "" | 49 | histogram _ = "" | 16 | false | true | 0 | 7 | 8 | 27 | 12 | 15 | null | null |
iblumenfeld/saw-core | src/Verifier/SAW/Rewriter.hs | bsd-3-clause | asRecordRedex :: (Monad m, Termlike t) => R.Recognizer m t (Map FieldName t, FieldName)
asRecordRedex t =
do (x, i) <- R.asRecordSelector t
ts <- R.asRecordValue x
return (ts, i)
----------------------------------------------------------------------
-- Bottom-up rewriting | 291 | asRecordRedex :: (Monad m, Termlike t) => R.Recognizer m t (Map FieldName t, FieldName)
asRecordRedex t =
do (x, i) <- R.asRecordSelector t
ts <- R.asRecordValue x
return (ts, i)
----------------------------------------------------------------------
-- Bottom-up rewriting | 291 | asRecordRedex t =
do (x, i) <- R.asRecordSelector t
ts <- R.asRecordValue x
return (ts, i)
----------------------------------------------------------------------
-- Bottom-up rewriting | 203 | false | true | 0 | 9 | 52 | 93 | 47 | 46 | null | null |
markflorisson/hpack | testrepo/bytestring-0.10.2.0/Data/ByteString/Internal.hs | bsd-3-clause | mallocByteString :: Int -> IO (ForeignPtr a)
mallocByteString l = do
#ifdef __GLASGOW_HASKELL__
mallocPlainForeignPtrBytes l
#else
mallocForeignPtrBytes l
#endif
| 170 | mallocByteString :: Int -> IO (ForeignPtr a)
mallocByteString l = do
#ifdef __GLASGOW_HASKELL__
mallocPlainForeignPtrBytes l
#else
mallocForeignPtrBytes l
#endif
| 170 | mallocByteString l = do
#ifdef __GLASGOW_HASKELL__
mallocPlainForeignPtrBytes l
#else
mallocForeignPtrBytes l
#endif
| 125 | false | true | 0 | 9 | 27 | 40 | 19 | 21 | null | null |
tjhunter/karps | haskell/src/Spark/Core/Internal/OpFunctions.hs | apache-2.0 | nameLocalStructuredTransform :: T.Text
nameLocalStructuredTransform = "org.spark.LocalStructuredTransform" | 106 | nameLocalStructuredTransform :: T.Text
nameLocalStructuredTransform = "org.spark.LocalStructuredTransform" | 106 | nameLocalStructuredTransform = "org.spark.LocalStructuredTransform" | 67 | false | true | 0 | 5 | 5 | 13 | 7 | 6 | null | null |
rueshyna/gogol | gogol-pubsub/gen/Network/Google/Resource/PubSub/Projects/Subscriptions/Acknowledge.hs | mpl-2.0 | -- | OAuth bearer token.
psaBearerToken :: Lens' ProjectsSubscriptionsAcknowledge (Maybe Text)
psaBearerToken
= lens _psaBearerToken
(\ s a -> s{_psaBearerToken = a}) | 174 | psaBearerToken :: Lens' ProjectsSubscriptionsAcknowledge (Maybe Text)
psaBearerToken
= lens _psaBearerToken
(\ s a -> s{_psaBearerToken = a}) | 149 | psaBearerToken
= lens _psaBearerToken
(\ s a -> s{_psaBearerToken = a}) | 79 | true | true | 1 | 9 | 29 | 52 | 25 | 27 | null | null |
osa1/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | arity :: TT n -> Int
arity (Bind n (Pi _ t _) sc) = 1 + arity sc | 64 | arity :: TT n -> Int
arity (Bind n (Pi _ t _) sc) = 1 + arity sc | 64 | arity (Bind n (Pi _ t _) sc) = 1 + arity sc | 43 | false | true | 0 | 11 | 18 | 53 | 24 | 29 | null | null |
shlevy/ghc | compiler/cmm/PprCmm.hs | bsd-3-clause | pprConvention Slow = text "<slow-convention>" | 62 | pprConvention Slow = text "<slow-convention>" | 62 | pprConvention Slow = text "<slow-convention>" | 62 | false | false | 0 | 5 | 21 | 12 | 5 | 7 | null | null |
neongreen/hat | src/DB.hs | bsd-3-clause | getGlobalState :: Acid.Query GlobalState GlobalState
getGlobalState = view id | 77 | getGlobalState :: Acid.Query GlobalState GlobalState
getGlobalState = view id | 77 | getGlobalState = view id | 24 | false | true | 1 | 6 | 8 | 25 | 10 | 15 | null | null |
pgj/bead | src/Bead/View/RouteOf.hs | bsd-3-clause | profilePath :: RoutePath
profilePath = "/profile" | 49 | profilePath :: RoutePath
profilePath = "/profile" | 49 | profilePath = "/profile" | 24 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.