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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LukaHorvat/Halt | test/Tests.hs | mit | conf :: Config
conf = defaultConfig
{ configColorMode = ColorAuto } | 72 | conf :: Config
conf = defaultConfig
{ configColorMode = ColorAuto } | 72 | conf = defaultConfig
{ configColorMode = ColorAuto } | 57 | false | true | 0 | 6 | 15 | 19 | 11 | 8 | null | null |
unknownloner/calccomp | Asm/InstrBytes.hs | mit | instrBytes LD (Reg8 R:Reg8 A:_) = w8l [0xED, 0x4F] | 65 | instrBytes LD (Reg8 R:Reg8 A:_) = w8l [0xED, 0x4F] | 65 | instrBytes LD (Reg8 R:Reg8 A:_) = w8l [0xED, 0x4F] | 65 | false | false | 0 | 9 | 23 | 37 | 18 | 19 | null | null |
gridaphobe/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | leInt_RDR = varQual_RDR gHC_PRIM (fsLit "<=#") | 52 | leInt_RDR = varQual_RDR gHC_PRIM (fsLit "<=#") | 52 | leInt_RDR = varQual_RDR gHC_PRIM (fsLit "<=#") | 52 | false | false | 0 | 7 | 11 | 17 | 8 | 9 | null | null |
DanielJanzon/CryptoLab | ElGamalMain.hs | bsd-3-clause | print_usage :: IOError -> IO()
print_usage err = do
putStrLn "init n \t- Create an n-bit ElGamal cryptosystem"
putStrLn "keys s \t- Create keys within cryptosystem s"
putStrLn "encrypt s k m\t- Encypt message m with public key k in system s"
putStrLn "decrypt s p c\t- Decrypt cipher c with private key p in system s"
-- Create an ElGamal crypto system, i.e. a group
-- of prime order p and a generator g | 433 | print_usage :: IOError -> IO()
print_usage err = do
putStrLn "init n \t- Create an n-bit ElGamal cryptosystem"
putStrLn "keys s \t- Create keys within cryptosystem s"
putStrLn "encrypt s k m\t- Encypt message m with public key k in system s"
putStrLn "decrypt s p c\t- Decrypt cipher c with private key p in system s"
-- Create an ElGamal crypto system, i.e. a group
-- of prime order p and a generator g | 433 | print_usage err = do
putStrLn "init n \t- Create an n-bit ElGamal cryptosystem"
putStrLn "keys s \t- Create keys within cryptosystem s"
putStrLn "encrypt s k m\t- Encypt message m with public key k in system s"
putStrLn "decrypt s p c\t- Decrypt cipher c with private key p in system s"
-- Create an ElGamal crypto system, i.e. a group
-- of prime order p and a generator g | 402 | false | true | 0 | 8 | 103 | 54 | 22 | 32 | null | null |
SamirTalwar/advent-of-code | 2015/AOC_07_2.hs | mit | wire = Wire "a" | 15 | wire = Wire "a" | 15 | wire = Wire "a" | 15 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
jwaldmann/haskell-obdd | examples/MM0916.hs | gpl-2.0 | header n q a w = unwords
[ "n =", show n
, "q =", show q
, "a =", show a
, "m =", show w
] | 107 | header n q a w = unwords
[ "n =", show n
, "q =", show q
, "a =", show a
, "m =", show w
] | 107 | header n q a w = unwords
[ "n =", show n
, "q =", show q
, "a =", show a
, "m =", show w
] | 107 | false | false | 0 | 6 | 44 | 54 | 28 | 26 | null | null |
bitemyapp/haskell-vcache | hsrc_lib/Database/VCache/VRef.hs | bsd-2-clause | readVarNat :: Ptr Word8 -> Int -> IO (Ptr Word8, Int)
readVarNat !p !n =
peek p >>= \ w8 ->
let p' = p `plusPtr` 1 in
let n' = (n `shiftL` 7) + (fromIntegral $ w8 .&. 0x7f) in
let bDone = (0 == (w8 .&. 0x80)) in
if bDone then return (p', n') else
readVarNat p' n' | 287 | readVarNat :: Ptr Word8 -> Int -> IO (Ptr Word8, Int)
readVarNat !p !n =
peek p >>= \ w8 ->
let p' = p `plusPtr` 1 in
let n' = (n `shiftL` 7) + (fromIntegral $ w8 .&. 0x7f) in
let bDone = (0 == (w8 .&. 0x80)) in
if bDone then return (p', n') else
readVarNat p' n' | 287 | readVarNat !p !n =
peek p >>= \ w8 ->
let p' = p `plusPtr` 1 in
let n' = (n `shiftL` 7) + (fromIntegral $ w8 .&. 0x7f) in
let bDone = (0 == (w8 .&. 0x80)) in
if bDone then return (p', n') else
readVarNat p' n' | 233 | false | true | 0 | 18 | 83 | 152 | 78 | 74 | null | null |
sdiehl/ghc | compiler/simplCore/CSE.hs | bsd-3-clause | extendCSSubst :: CSEnv -> Id -> CoreExpr -> CSEnv
extendCSSubst cse x rhs = cse { cs_subst = extendSubst (cs_subst cse) x rhs } | 128 | extendCSSubst :: CSEnv -> Id -> CoreExpr -> CSEnv
extendCSSubst cse x rhs = cse { cs_subst = extendSubst (cs_subst cse) x rhs } | 128 | extendCSSubst cse x rhs = cse { cs_subst = extendSubst (cs_subst cse) x rhs } | 77 | false | true | 0 | 9 | 24 | 51 | 26 | 25 | null | null |
Axure/elm-compiler | src/Docs/Check.hs | bsd-3-clause | filterUnionTags :: [(String, [String])] -> String -> A.Located Docs.Union -> Result w (A.Located Docs.Union)
filterUnionTags exportedUnions name (A.A region union@(Docs.Union _ _ ctors)) =
let
exportedTags =
maybe [] id (List.lookup name exportedUnions)
in
R.ok $ A.A region $ union
{ Docs.unionCases =
filter (\(tag, _) -> elem tag exportedTags) ctors
} | 394 | filterUnionTags :: [(String, [String])] -> String -> A.Located Docs.Union -> Result w (A.Located Docs.Union)
filterUnionTags exportedUnions name (A.A region union@(Docs.Union _ _ ctors)) =
let
exportedTags =
maybe [] id (List.lookup name exportedUnions)
in
R.ok $ A.A region $ union
{ Docs.unionCases =
filter (\(tag, _) -> elem tag exportedTags) ctors
} | 394 | filterUnionTags exportedUnions name (A.A region union@(Docs.Union _ _ ctors)) =
let
exportedTags =
maybe [] id (List.lookup name exportedUnions)
in
R.ok $ A.A region $ union
{ Docs.unionCases =
filter (\(tag, _) -> elem tag exportedTags) ctors
} | 285 | false | true | 0 | 12 | 91 | 172 | 87 | 85 | null | null |
marcmo/includeSpellChecker | src/Analyzer/Checker.hs | bsd-3-clause | headerFiles = find always (extension ==? ".h") | 46 | headerFiles = find always (extension ==? ".h") | 46 | headerFiles = find always (extension ==? ".h") | 46 | false | false | 1 | 7 | 6 | 22 | 9 | 13 | null | null |
AlexeyRaga/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpOutOfLine CloneArrayOp = True | 35 | primOpOutOfLine CloneArrayOp = True | 35 | primOpOutOfLine CloneArrayOp = True | 35 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
rahulmutt/ghcvm | compiler/Eta/SimplCore/CoreMonad.hs | bsd-3-clause | plusSimplCount (VerySimplCount n) (VerySimplCount m) = VerySimplCount (n+m) | 75 | plusSimplCount (VerySimplCount n) (VerySimplCount m) = VerySimplCount (n+m) | 75 | plusSimplCount (VerySimplCount n) (VerySimplCount m) = VerySimplCount (n+m) | 75 | false | false | 1 | 7 | 7 | 35 | 16 | 19 | null | null |
ddssff/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | rawLaTeXInline :: LP Inline
rawLaTeXInline = do
raw <- (snd <$> withRaw inlineCommand) <|> (snd <$> withRaw blockCommand)
RawInline "latex" <$> applyMacros' raw | 164 | rawLaTeXInline :: LP Inline
rawLaTeXInline = do
raw <- (snd <$> withRaw inlineCommand) <|> (snd <$> withRaw blockCommand)
RawInline "latex" <$> applyMacros' raw | 164 | rawLaTeXInline = do
raw <- (snd <$> withRaw inlineCommand) <|> (snd <$> withRaw blockCommand)
RawInline "latex" <$> applyMacros' raw | 136 | false | true | 1 | 12 | 26 | 62 | 27 | 35 | null | null |
Fuuzetsu/haddock | haddock-api/src/Haddock/Backends/Hoogle.hs | bsd-2-clause | ppSig :: DynFlags -> Sig Name -> [String]
ppSig dflags x = ppSigWithDoc dflags x [] | 84 | ppSig :: DynFlags -> Sig Name -> [String]
ppSig dflags x = ppSigWithDoc dflags x [] | 84 | ppSig dflags x = ppSigWithDoc dflags x [] | 42 | false | true | 0 | 9 | 16 | 47 | 20 | 27 | null | null |
Norberg/gui_scad | src/DSL/Generate.hs | gpl-3.0 | buildTree :: Int -> Tree Scad -> Builder
buildTree level tree =
indent level <> buildTree' level tree <> "\n" | 114 | buildTree :: Int -> Tree Scad -> Builder
buildTree level tree =
indent level <> buildTree' level tree <> "\n" | 114 | buildTree level tree =
indent level <> buildTree' level tree <> "\n" | 73 | false | true | 0 | 7 | 24 | 43 | 20 | 23 | null | null |
DaMSL/K3 | src/Language/K3/Parser/ProgramBuilder.hs | apache-2.0 | cpdrName :: Identifier -> Identifier
cpdrName n = n++"PDataRead" | 64 | cpdrName :: Identifier -> Identifier
cpdrName n = n++"PDataRead" | 64 | cpdrName n = n++"PDataRead" | 27 | false | true | 0 | 5 | 8 | 22 | 11 | 11 | null | null |
timtian090/Playground | Haskell/simpleJSON/src/SimpleJSON.hs | mit | getArray _ = Nothing | 29 | getArray _ = Nothing | 29 | getArray _ = Nothing | 29 | false | false | 0 | 5 | 12 | 9 | 4 | 5 | null | null |
kfish/hogg | Codec/Container/Ogg/Page.hs | bsd-3-clause | buildTab q r _ _ = ((take q $ repeat (255 :: Word8)) ++ [fromIntegral r]) | 73 | buildTab q r _ _ = ((take q $ repeat (255 :: Word8)) ++ [fromIntegral r]) | 73 | buildTab q r _ _ = ((take q $ repeat (255 :: Word8)) ++ [fromIntegral r]) | 73 | false | false | 0 | 10 | 15 | 47 | 24 | 23 | null | null |
SAdams601/ParRegexSearch | test/HaRe/test/TestUtils.hs | mit | parsedFileGhcCd :: FilePath -> FilePath -> IO ParseResult
parsedFileGhcCd path fileName = do
old <- getCurrentDirectory
let
comp = do
res <- parseSourceFileTest fileName
return res
newDir = setCurrentDirectory path
oldDir _ = setCurrentDirectory old
(parseResult,_s) <- GHC.gbracket newDir oldDir $ \_ -> runRefactGhcState comp
return parseResult
-- --------------------------------------------------------------------- | 454 | parsedFileGhcCd :: FilePath -> FilePath -> IO ParseResult
parsedFileGhcCd path fileName = do
old <- getCurrentDirectory
let
comp = do
res <- parseSourceFileTest fileName
return res
newDir = setCurrentDirectory path
oldDir _ = setCurrentDirectory old
(parseResult,_s) <- GHC.gbracket newDir oldDir $ \_ -> runRefactGhcState comp
return parseResult
-- --------------------------------------------------------------------- | 454 | parsedFileGhcCd path fileName = do
old <- getCurrentDirectory
let
comp = do
res <- parseSourceFileTest fileName
return res
newDir = setCurrentDirectory path
oldDir _ = setCurrentDirectory old
(parseResult,_s) <- GHC.gbracket newDir oldDir $ \_ -> runRefactGhcState comp
return parseResult
-- --------------------------------------------------------------------- | 396 | false | true | 0 | 13 | 83 | 117 | 54 | 63 | null | null |
headprogrammingczar/Data | data-eval/IRC/Data/L.hs | bsd-3-clause | morseChar 'e' = "." | 19 | morseChar 'e' = "." | 19 | morseChar 'e' = "." | 19 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
batterseapower/mini-ghc | Core/Syntax.hs | bsd-3-clause | pPrintPrecSeq :: (Pretty a, Pretty b) => PrettyLevel -> Rational -> a -> b -> Doc
pPrintPrecSeq level prec e1 e2 = pPrintPrecApp level prec (PrettyFunction $ \level prec -> pPrintPrecApp level prec (name "seq") e1) e2 | 217 | pPrintPrecSeq :: (Pretty a, Pretty b) => PrettyLevel -> Rational -> a -> b -> Doc
pPrintPrecSeq level prec e1 e2 = pPrintPrecApp level prec (PrettyFunction $ \level prec -> pPrintPrecApp level prec (name "seq") e1) e2 | 217 | pPrintPrecSeq level prec e1 e2 = pPrintPrecApp level prec (PrettyFunction $ \level prec -> pPrintPrecApp level prec (name "seq") e1) e2 | 135 | false | true | 0 | 11 | 36 | 95 | 46 | 49 | null | null |
Danl2620/htads | src/Lib.hs | bsd-3-clause | g_itemMap :: H.ItemMap
g_itemMap = Map.fromList
[("pedestal", H.Item "pedestal" ["pedestal"] [] "A pedestal" [H.Fixed] "cave")
,("skull", H.Item "skull" ["skull"] ["gold"] "A gold skull" [H.Score 10] "cave")
,("table", H.Item "table" ["table"] ["small"] "A small kitchen table" [H.Bulky] "cave")
,("largeSandbag", H.Item "largeSandbag" ["sandbag", "bag"] ["large"] "A large bag of sand" [H.Bulky] "cave")
,("smallSandbag1", H.Item "smallSandbag1" ["sandbag", "bag"] ["small", "red"] "A small red bag of sand" [] "cave")
,("smallSandbag2", H.Item "smallSandbag2" ["sandbag", "bag"] ["small", "blue"] "A small blue bag of sand" [] "cave")
--,("knife", H.Item "knife" ["knife"] ["large"] "A large kitchen kife" [] "table")
] | 801 | g_itemMap :: H.ItemMap
g_itemMap = Map.fromList
[("pedestal", H.Item "pedestal" ["pedestal"] [] "A pedestal" [H.Fixed] "cave")
,("skull", H.Item "skull" ["skull"] ["gold"] "A gold skull" [H.Score 10] "cave")
,("table", H.Item "table" ["table"] ["small"] "A small kitchen table" [H.Bulky] "cave")
,("largeSandbag", H.Item "largeSandbag" ["sandbag", "bag"] ["large"] "A large bag of sand" [H.Bulky] "cave")
,("smallSandbag1", H.Item "smallSandbag1" ["sandbag", "bag"] ["small", "red"] "A small red bag of sand" [] "cave")
,("smallSandbag2", H.Item "smallSandbag2" ["sandbag", "bag"] ["small", "blue"] "A small blue bag of sand" [] "cave")
--,("knife", H.Item "knife" ["knife"] ["large"] "A large kitchen kife" [] "table")
] | 801 | g_itemMap = Map.fromList
[("pedestal", H.Item "pedestal" ["pedestal"] [] "A pedestal" [H.Fixed] "cave")
,("skull", H.Item "skull" ["skull"] ["gold"] "A gold skull" [H.Score 10] "cave")
,("table", H.Item "table" ["table"] ["small"] "A small kitchen table" [H.Bulky] "cave")
,("largeSandbag", H.Item "largeSandbag" ["sandbag", "bag"] ["large"] "A large bag of sand" [H.Bulky] "cave")
,("smallSandbag1", H.Item "smallSandbag1" ["sandbag", "bag"] ["small", "red"] "A small red bag of sand" [] "cave")
,("smallSandbag2", H.Item "smallSandbag2" ["sandbag", "bag"] ["small", "blue"] "A small blue bag of sand" [] "cave")
--,("knife", H.Item "knife" ["knife"] ["large"] "A large kitchen kife" [] "table")
] | 778 | false | true | 0 | 10 | 171 | 246 | 137 | 109 | null | null |
lamdu/lamdu | src/Lamdu/GUI/Expr/ParamsEdit.hs | gpl-3.0 | mkShrunk :: _ => [Sugar.EntityId] -> Widget.Id -> f (Maybe (M.Widget o) -> [Responsive o])
mkShrunk paramIds myId =
do
env <- Lens.view id
let expandEventMap =
paramIds ^? Lens.traverse
& foldMap
(E.keysEventMapMovesCursor
(env ^. has . Config.jumpToDefinitionKeys)
( E.toDoc env
[ has . MomentuTexts.view
, has . Texts.expandLambdaParams
]
) . pure . WidgetIds.fromEntityId)
theme <- Lens.view has
lamLabel <-
(Widget.makeFocusableView ?? lamId myId <&> (M.tValue %~))
<*> grammar (label Texts.lam)
<&> Responsive.fromWithTextPos
& local (TextView.underline ?~ LightLambda.underline theme)
addScopeEd <- addScopeEdit
pure $ \mScopeEdit ->
[ addScopeEd mScopeEdit lamLabel
& M.weakerEvents expandEventMap
] | 1,038 | mkShrunk :: _ => [Sugar.EntityId] -> Widget.Id -> f (Maybe (M.Widget o) -> [Responsive o])
mkShrunk paramIds myId =
do
env <- Lens.view id
let expandEventMap =
paramIds ^? Lens.traverse
& foldMap
(E.keysEventMapMovesCursor
(env ^. has . Config.jumpToDefinitionKeys)
( E.toDoc env
[ has . MomentuTexts.view
, has . Texts.expandLambdaParams
]
) . pure . WidgetIds.fromEntityId)
theme <- Lens.view has
lamLabel <-
(Widget.makeFocusableView ?? lamId myId <&> (M.tValue %~))
<*> grammar (label Texts.lam)
<&> Responsive.fromWithTextPos
& local (TextView.underline ?~ LightLambda.underline theme)
addScopeEd <- addScopeEdit
pure $ \mScopeEdit ->
[ addScopeEd mScopeEdit lamLabel
& M.weakerEvents expandEventMap
] | 1,038 | mkShrunk paramIds myId =
do
env <- Lens.view id
let expandEventMap =
paramIds ^? Lens.traverse
& foldMap
(E.keysEventMapMovesCursor
(env ^. has . Config.jumpToDefinitionKeys)
( E.toDoc env
[ has . MomentuTexts.view
, has . Texts.expandLambdaParams
]
) . pure . WidgetIds.fromEntityId)
theme <- Lens.view has
lamLabel <-
(Widget.makeFocusableView ?? lamId myId <&> (M.tValue %~))
<*> grammar (label Texts.lam)
<&> Responsive.fromWithTextPos
& local (TextView.underline ?~ LightLambda.underline theme)
addScopeEd <- addScopeEdit
pure $ \mScopeEdit ->
[ addScopeEd mScopeEdit lamLabel
& M.weakerEvents expandEventMap
] | 947 | false | true | 0 | 20 | 426 | 282 | 136 | 146 | null | null |
koengit/symbo | Object.hs | bsd-2-clause | boolT = Type "Bool" [] [false,true] | 36 | boolT = Type "Bool" [] [false,true] | 36 | boolT = Type "Bool" [] [false,true] | 36 | false | false | 1 | 6 | 6 | 24 | 11 | 13 | null | null |
matterhorn-chat/matterhorn | src/Matterhorn/Types/Channels.hs | bsd-3-clause | initialChannelInfo :: UserId -> Channel -> ChannelInfo
initialChannelInfo myId chan =
let updated = chan ^. channelLastPostAtL
in ChannelInfo { _cdChannelId = chan^.channelIdL
, _cdTeamId = chan^.channelTeamIdL
, _cdViewed = Nothing
, _cdNewMessageIndicator = Hide
, _cdEditedMessageThreshold = Nothing
, _cdMentionCount = 0
, _cdUpdated = updated
, _cdName = preferredChannelName chan
, _cdDisplayName = sanitizeUserText $ channelDisplayName chan
, _cdHeader = sanitizeUserText $ chan^.channelHeaderL
, _cdPurpose = sanitizeUserText $ chan^.channelPurposeL
, _cdType = chan^.channelTypeL
, _cdNotifyProps = emptyChannelNotifyProps
, _cdTypingUsers = noTypingUsers
, _cdDMUserId = if chan^.channelTypeL == Direct
then userIdForDMChannel myId $
sanitizeUserText $ channelName chan
else Nothing
, _cdSidebarShowOverride = Nothing
} | 1,484 | initialChannelInfo :: UserId -> Channel -> ChannelInfo
initialChannelInfo myId chan =
let updated = chan ^. channelLastPostAtL
in ChannelInfo { _cdChannelId = chan^.channelIdL
, _cdTeamId = chan^.channelTeamIdL
, _cdViewed = Nothing
, _cdNewMessageIndicator = Hide
, _cdEditedMessageThreshold = Nothing
, _cdMentionCount = 0
, _cdUpdated = updated
, _cdName = preferredChannelName chan
, _cdDisplayName = sanitizeUserText $ channelDisplayName chan
, _cdHeader = sanitizeUserText $ chan^.channelHeaderL
, _cdPurpose = sanitizeUserText $ chan^.channelPurposeL
, _cdType = chan^.channelTypeL
, _cdNotifyProps = emptyChannelNotifyProps
, _cdTypingUsers = noTypingUsers
, _cdDMUserId = if chan^.channelTypeL == Direct
then userIdForDMChannel myId $
sanitizeUserText $ channelName chan
else Nothing
, _cdSidebarShowOverride = Nothing
} | 1,484 | initialChannelInfo myId chan =
let updated = chan ^. channelLastPostAtL
in ChannelInfo { _cdChannelId = chan^.channelIdL
, _cdTeamId = chan^.channelTeamIdL
, _cdViewed = Nothing
, _cdNewMessageIndicator = Hide
, _cdEditedMessageThreshold = Nothing
, _cdMentionCount = 0
, _cdUpdated = updated
, _cdName = preferredChannelName chan
, _cdDisplayName = sanitizeUserText $ channelDisplayName chan
, _cdHeader = sanitizeUserText $ chan^.channelHeaderL
, _cdPurpose = sanitizeUserText $ chan^.channelPurposeL
, _cdType = chan^.channelTypeL
, _cdNotifyProps = emptyChannelNotifyProps
, _cdTypingUsers = noTypingUsers
, _cdDMUserId = if chan^.channelTypeL == Direct
then userIdForDMChannel myId $
sanitizeUserText $ channelName chan
else Nothing
, _cdSidebarShowOverride = Nothing
} | 1,429 | false | true | 0 | 12 | 759 | 205 | 117 | 88 | null | null |
geocurnoff/nikki | src/Base/Configuration/Controls.hs | lgpl-3.0 | contextKey = accessor contextKey_ (\ a r -> r{contextKey_ = a}) | 63 | contextKey = accessor contextKey_ (\ a r -> r{contextKey_ = a}) | 63 | contextKey = accessor contextKey_ (\ a r -> r{contextKey_ = a}) | 63 | false | false | 0 | 9 | 10 | 29 | 16 | 13 | null | null |
bos/mysql | Database/MySQL/Base.hs | bsd-3-clause | commit :: Connection -> IO ()
commit conn = withConn conn $ \ptr ->
mysql_commit ptr >>= check "commit" conn | 122 | commit :: Connection -> IO ()
commit conn = withConn conn $ \ptr ->
mysql_commit ptr >>= check "commit" conn | 122 | commit conn = withConn conn $ \ptr ->
mysql_commit ptr >>= check "commit" conn | 92 | false | true | 0 | 8 | 33 | 47 | 22 | 25 | null | null |
alanz/haxl-play | src/main.hs | unlicense | thread1 :: Thread Haxl [Id]
thread1 = do
r <- lift $ friendsOf (Id "Simon")
return r
------------------------------------------------------------------------
-- ++AZ++ missing definitions ---------------------------
-- newtype HaxlQuery a = HaxlQuery { query :: Haxl [a] } | 279 | thread1 :: Thread Haxl [Id]
thread1 = do
r <- lift $ friendsOf (Id "Simon")
return r
------------------------------------------------------------------------
-- ++AZ++ missing definitions ---------------------------
-- newtype HaxlQuery a = HaxlQuery { query :: Haxl [a] } | 279 | thread1 = do
r <- lift $ friendsOf (Id "Simon")
return r
------------------------------------------------------------------------
-- ++AZ++ missing definitions ---------------------------
-- newtype HaxlQuery a = HaxlQuery { query :: Haxl [a] } | 251 | false | true | 0 | 11 | 41 | 48 | 24 | 24 | null | null |
GaloisInc/haskell-tor | src/Tor/DataFormat/RelayCell.hs | bsd-3-clause | putRelayEndReason ReasonConnectionReset = putWord8 12 | 57 | putRelayEndReason ReasonConnectionReset = putWord8 12 | 57 | putRelayEndReason ReasonConnectionReset = putWord8 12 | 57 | false | false | 0 | 5 | 8 | 12 | 5 | 7 | null | null |
lifengsun/haskell-exercise | scheme/06/replparser.hs | gpl-3.0 | trapError :: ThrowsError String -> ThrowsError String
trapError action = catchError action (return . show) | 106 | trapError :: ThrowsError String -> ThrowsError String
trapError action = catchError action (return . show) | 106 | trapError action = catchError action (return . show) | 52 | false | true | 0 | 7 | 14 | 40 | 18 | 22 | null | null |
nevrenato/Hets_Fork | Comorphisms/Hs2HOLCFaux.hs | gpl-2.0 | getInstClass :: HsPred -> HsType
getInstClass x = case x of (Typ (HsTyApp c _)) -> c
_ -> trace ("\n CLASS: " ++ show x) $
error "Hs2HOLCFaux.getInstClass"
----------------------- getting class information ----------------------- | 289 | getInstClass :: HsPred -> HsType
getInstClass x = case x of (Typ (HsTyApp c _)) -> c
_ -> trace ("\n CLASS: " ++ show x) $
error "Hs2HOLCFaux.getInstClass"
----------------------- getting class information ----------------------- | 289 | getInstClass x = case x of (Typ (HsTyApp c _)) -> c
_ -> trace ("\n CLASS: " ++ show x) $
error "Hs2HOLCFaux.getInstClass"
----------------------- getting class information ----------------------- | 256 | false | true | 0 | 12 | 93 | 69 | 34 | 35 | null | null |
Happy0/snowdrift | Handler/Project.hs | agpl-3.0 | postInviteR :: Text -> Handler Html
postInviteR project_handle = do
(user_id, Entity project_id _) <- requireRolesAny [Admin] project_handle "You must be a project admin to invite."
now <- liftIO getCurrentTime
invite <- liftIO randomIO
((result, _), _) <- runFormPost inviteForm
case result of
FormSuccess (tag, role) -> do
let invite_code = T.pack $ printf "%016x" (invite :: Int64)
_ <- runDB $ insert $ Invite now project_id invite_code user_id role tag False Nothing Nothing
setSession "InviteCode" invite_code
setSession "InviteRole" (T.pack $ show role)
_ -> alertDanger "Error in submitting form."
redirect $ InviteR project_handle
--------------------------------------------------------------------------------
-- /patrons | 825 | postInviteR :: Text -> Handler Html
postInviteR project_handle = do
(user_id, Entity project_id _) <- requireRolesAny [Admin] project_handle "You must be a project admin to invite."
now <- liftIO getCurrentTime
invite <- liftIO randomIO
((result, _), _) <- runFormPost inviteForm
case result of
FormSuccess (tag, role) -> do
let invite_code = T.pack $ printf "%016x" (invite :: Int64)
_ <- runDB $ insert $ Invite now project_id invite_code user_id role tag False Nothing Nothing
setSession "InviteCode" invite_code
setSession "InviteRole" (T.pack $ show role)
_ -> alertDanger "Error in submitting form."
redirect $ InviteR project_handle
--------------------------------------------------------------------------------
-- /patrons | 825 | postInviteR project_handle = do
(user_id, Entity project_id _) <- requireRolesAny [Admin] project_handle "You must be a project admin to invite."
now <- liftIO getCurrentTime
invite <- liftIO randomIO
((result, _), _) <- runFormPost inviteForm
case result of
FormSuccess (tag, role) -> do
let invite_code = T.pack $ printf "%016x" (invite :: Int64)
_ <- runDB $ insert $ Invite now project_id invite_code user_id role tag False Nothing Nothing
setSession "InviteCode" invite_code
setSession "InviteRole" (T.pack $ show role)
_ -> alertDanger "Error in submitting form."
redirect $ InviteR project_handle
--------------------------------------------------------------------------------
-- /patrons | 789 | false | true | 0 | 17 | 189 | 222 | 106 | 116 | null | null |
anttisalonen/economics | src/Market.hs | mit | regProd :: MarketQuantityMap -> ProductionMap
regProd = fmap (\q -> ProductionInfo (P.Constant q) "" "" 0 0) | 108 | regProd :: MarketQuantityMap -> ProductionMap
regProd = fmap (\q -> ProductionInfo (P.Constant q) "" "" 0 0) | 108 | regProd = fmap (\q -> ProductionInfo (P.Constant q) "" "" 0 0) | 62 | false | true | 0 | 11 | 16 | 45 | 23 | 22 | null | null |
danr/hipspec | src/HipSpec/Lang/RichToSimple.hs | gpl-3.0 | rtsBody :: R.Expr Id -> RTS (S.Body Id)
rtsBody e0 = case e0 of
R.Case e x alts -> S.Case <$> rtsExpr e <*> sequence
[ (,) p <$> rtsBody (removeScrutinee e x alt)
| alt@(p,_) <- alts
]
_ -> S.Body <$> rtsExpr e0 | 243 | rtsBody :: R.Expr Id -> RTS (S.Body Id)
rtsBody e0 = case e0 of
R.Case e x alts -> S.Case <$> rtsExpr e <*> sequence
[ (,) p <$> rtsBody (removeScrutinee e x alt)
| alt@(p,_) <- alts
]
_ -> S.Body <$> rtsExpr e0 | 243 | rtsBody e0 = case e0 of
R.Case e x alts -> S.Case <$> rtsExpr e <*> sequence
[ (,) p <$> rtsBody (removeScrutinee e x alt)
| alt@(p,_) <- alts
]
_ -> S.Body <$> rtsExpr e0 | 203 | false | true | 0 | 14 | 76 | 127 | 62 | 65 | null | null |
awalterschulze/xhaskell-regex-deriv | Text/Regex/Deriv/ByteString/Posix.hs | bsd-3-clause | sbinderToEnv' (PStar _ _) (SStar cf) = return cf | 48 | sbinderToEnv' (PStar _ _) (SStar cf) = return cf | 48 | sbinderToEnv' (PStar _ _) (SStar cf) = return cf | 48 | false | false | 0 | 7 | 8 | 28 | 13 | 15 | null | null |
infotroph/pandoc | src/Text/Pandoc/Readers/EPUB.hs | gpl-2.0 | fixBlockIRs :: String -> Block -> Block
fixBlockIRs s (Div as b) =
Div (fixAttrs s as) b | 90 | fixBlockIRs :: String -> Block -> Block
fixBlockIRs s (Div as b) =
Div (fixAttrs s as) b | 90 | fixBlockIRs s (Div as b) =
Div (fixAttrs s as) b | 50 | false | true | 0 | 10 | 19 | 52 | 23 | 29 | null | null |
paolino/HDynTs | src/HDynTs/ST/Core.hs | bsd-3-clause | reversable [] = Reversable mempty mempty | 40 | reversable [] = Reversable mempty mempty | 40 | reversable [] = Reversable mempty mempty | 40 | false | false | 0 | 6 | 5 | 16 | 7 | 9 | null | null |
Tuplanolla/eigenlanguage | haskell/Formatter.hs | gpl-3.0 | -- | Manages space and indentation tags.
format :: Expression -> Expression
format = id | 87 | format :: Expression -> Expression
format = id | 46 | format = id | 11 | true | true | 0 | 7 | 14 | 23 | 10 | 13 | null | null |
jleahred/katas | langs/haskell/machine_revisions_problem/src/Main.hs | gpl-3.0 | -- get a random visits info for a machine
rdnVisitsMach:: (MonadRandom m) => MachInf -> m (String, [(Int, Int)])
rdnVisitsMach (mach, visits) = do
cl <- shuffleM $ expandVisitInfo visits
return (mach, cl)
where expandVisitInfo visits = foldl (\acc visit ->
acc ++ expandVisit visit)
[]
(zip [1..] visits)
expandVisit (idx, (n, t)) = replicate n (idx, t)
-- get a list with the sum per period (perhaps months) of all machines | 599 | rdnVisitsMach:: (MonadRandom m) => MachInf -> m (String, [(Int, Int)])
rdnVisitsMach (mach, visits) = do
cl <- shuffleM $ expandVisitInfo visits
return (mach, cl)
where expandVisitInfo visits = foldl (\acc visit ->
acc ++ expandVisit visit)
[]
(zip [1..] visits)
expandVisit (idx, (n, t)) = replicate n (idx, t)
-- get a list with the sum per period (perhaps months) of all machines | 557 | rdnVisitsMach (mach, visits) = do
cl <- shuffleM $ expandVisitInfo visits
return (mach, cl)
where expandVisitInfo visits = foldl (\acc visit ->
acc ++ expandVisit visit)
[]
(zip [1..] visits)
expandVisit (idx, (n, t)) = replicate n (idx, t)
-- get a list with the sum per period (perhaps months) of all machines | 486 | true | true | 0 | 10 | 246 | 164 | 86 | 78 | null | null |
bgold-cosmos/Tidal | src/Sound/Tidal/Params.hs | gpl-3.0 | wavelossrecv :: Pattern Int -> ControlPattern
wavelossrecv busid = pI "^waveloss" busid | 87 | wavelossrecv :: Pattern Int -> ControlPattern
wavelossrecv busid = pI "^waveloss" busid | 87 | wavelossrecv busid = pI "^waveloss" busid | 41 | false | true | 0 | 7 | 11 | 33 | 13 | 20 | null | null |
cartazio/arithmoi | Math/NumberTheory/DirichletCharacters.hs | mit | orZeroToNum f (NonZero x) = f x | 31 | orZeroToNum f (NonZero x) = f x | 31 | orZeroToNum f (NonZero x) = f x | 31 | false | false | 0 | 6 | 6 | 22 | 9 | 13 | null | null |
lueck/standoff-tools | testsuite/Test/StandOff/MarkupRange.hs | gpl-3.0 | test_notLeftOverlaps = assertEqual ((sampleRanges !! 1) `leftOverlaps` (sampleRanges !! 3)) False | 97 | test_notLeftOverlaps = assertEqual ((sampleRanges !! 1) `leftOverlaps` (sampleRanges !! 3)) False | 97 | test_notLeftOverlaps = assertEqual ((sampleRanges !! 1) `leftOverlaps` (sampleRanges !! 3)) False | 97 | false | false | 1 | 9 | 10 | 37 | 19 | 18 | null | null |
stevezhee/grm | Grm/Lex.hs | bsd-3-clause | dQuoteChar :: Char
dQuoteChar = '"' | 35 | dQuoteChar :: Char
dQuoteChar = '"' | 35 | dQuoteChar = '"' | 16 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
4ZP6Capstone2015/ampersand | src/Database/Design/Ampersand/Input/Parsing.hs | gpl-3.0 | parseCtx :: FilePath -- ^ The file name (used for error messages)
-> String -- ^ The string to be parsed
-> Guarded (P_Context, [String]) -- ^ The context and a list of included files
parseCtx = runParser pContext | 233 | parseCtx :: FilePath -- ^ The file name (used for error messages)
-> String -- ^ The string to be parsed
-> Guarded (P_Context, [String])
parseCtx = runParser pContext | 187 | parseCtx = runParser pContext | 29 | true | true | 0 | 9 | 58 | 37 | 21 | 16 | null | null |
m-alvarez/jhc | drift_processed/Ho/Type.hs | mit | cff_file = chunkType "FILE" | 28 | cff_file = chunkType "FILE" | 28 | cff_file = chunkType "FILE" | 28 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
brendanhay/gogol | gogol-apps-reseller/gen/Network/Google/Resource/Reseller/Customers/Insert.hs | mpl-2.0 | -- | Creates a value of 'CustomersInsert' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ciXgafv'
--
-- * 'ciUploadProtocol'
--
-- * 'ciAccessToken'
--
-- * 'ciUploadType'
--
-- * 'ciPayload'
--
-- * 'ciCustomerAuthToken'
--
-- * 'ciCallback'
customersInsert
:: Customer -- ^ 'ciPayload'
-> CustomersInsert
customersInsert pCiPayload_ =
CustomersInsert'
{ _ciXgafv = Nothing
, _ciUploadProtocol = Nothing
, _ciAccessToken = Nothing
, _ciUploadType = Nothing
, _ciPayload = pCiPayload_
, _ciCustomerAuthToken = Nothing
, _ciCallback = Nothing
} | 672 | customersInsert
:: Customer -- ^ 'ciPayload'
-> CustomersInsert
customersInsert pCiPayload_ =
CustomersInsert'
{ _ciXgafv = Nothing
, _ciUploadProtocol = Nothing
, _ciAccessToken = Nothing
, _ciUploadType = Nothing
, _ciPayload = pCiPayload_
, _ciCustomerAuthToken = Nothing
, _ciCallback = Nothing
} | 342 | customersInsert pCiPayload_ =
CustomersInsert'
{ _ciXgafv = Nothing
, _ciUploadProtocol = Nothing
, _ciAccessToken = Nothing
, _ciUploadType = Nothing
, _ciPayload = pCiPayload_
, _ciCustomerAuthToken = Nothing
, _ciCallback = Nothing
} | 270 | true | true | 0 | 6 | 140 | 80 | 56 | 24 | null | null |
nfjinjing/hack2-handler-mongrel2-http | src/Hack2/Handler/Mongrel2/MessageParser.hs | bsd-3-clause | isSpace _ = False | 20 | isSpace _ = False | 20 | isSpace _ = False | 20 | false | false | 0 | 4 | 6 | 10 | 4 | 6 | null | null |
Erdwolf/autotool-bonn | src/Lambda/Position.hs | gpl-2.0 | poke :: Monad m => Lambda -> ( Position, Lambda ) -> m Lambda
poke t ( [], a ) = return a | 89 | poke :: Monad m => Lambda -> ( Position, Lambda ) -> m Lambda
poke t ( [], a ) = return a | 89 | poke t ( [], a ) = return a | 27 | false | true | 0 | 8 | 22 | 56 | 27 | 29 | null | null |
docker-exec/haskell | test/unicode.hs | mit | main = putStrLn "hello unicode 👾" | 33 | main = putStrLn "hello unicode 👾" | 33 | main = putStrLn "hello unicode 👾" | 33 | false | false | 1 | 5 | 5 | 13 | 4 | 9 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT18.hs | gpl-3.0 | mult :: Nat -> Nat -> Nat -> Nat
mult Z _ acc = acc | 51 | mult :: Nat -> Nat -> Nat -> Nat
mult Z _ acc = acc | 51 | mult Z _ acc = acc | 18 | false | true | 0 | 7 | 14 | 30 | 15 | 15 | null | null |
olsner/ghc | compiler/nativeGen/SPARC/Ppr.hs | bsd-3-clause | pprInstr (FSUB format reg1 reg2 reg3)
= pprFormatRegRegReg (sLit "fsub") format reg1 reg2 reg3 | 102 | pprInstr (FSUB format reg1 reg2 reg3)
= pprFormatRegRegReg (sLit "fsub") format reg1 reg2 reg3 | 102 | pprInstr (FSUB format reg1 reg2 reg3)
= pprFormatRegRegReg (sLit "fsub") format reg1 reg2 reg3 | 102 | false | false | 0 | 7 | 21 | 39 | 18 | 21 | null | null |
mikeizbicki/homoiconic | src/Homoiconic/Constrained/TH.hs | bsd-3-clause | cons2consTag t = t | 18 | cons2consTag t = t | 18 | cons2consTag t = t | 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
nevrenato/Hets_Fork | TopHybrid/Parse_AS.hs | gpl-2.0 | -- the top parser; parses an entire specification
thBasic :: (String -> AnyLogic) -> AParser st Spc_Wrap
thBasic getLogic =
do
asKey "baselogic"
logicName <- simpleId
thSpec $ getLogic $ show logicName
-- Parses the specification after knowing
--the underlying logic | 301 | thBasic :: (String -> AnyLogic) -> AParser st Spc_Wrap
thBasic getLogic =
do
asKey "baselogic"
logicName <- simpleId
thSpec $ getLogic $ show logicName
-- Parses the specification after knowing
--the underlying logic | 251 | thBasic getLogic =
do
asKey "baselogic"
logicName <- simpleId
thSpec $ getLogic $ show logicName
-- Parses the specification after knowing
--the underlying logic | 196 | true | true | 0 | 9 | 75 | 64 | 30 | 34 | null | null |
forste/haReFork | tools/Phugs/StrategoPretty.hs | bsd-3-clause | showP (Paspat n p) = "AsPattern("++n++","++show p++")" | 57 | showP (Paspat n p) = "AsPattern("++n++","++show p++")" | 57 | showP (Paspat n p) = "AsPattern("++n++","++show p++")" | 57 | false | false | 0 | 8 | 9 | 36 | 17 | 19 | null | null |
kowey/pandoc-old | src/Text/Pandoc/Templates.hs | gpl-2.0 | conditional :: GenParser Char TemplateState String
conditional = try $ do
TemplateState pos vars <- getState
string "$if("
id' <- ident
string ")$"
-- if newline after the "if", then a newline after "endif" will be swallowed
multiline <- option False $ try $ skipEndline >> return True
ifContents <- liftM concat parseTemplate
-- reset state for else block
setState $ TemplateState pos vars
elseContents <- option "" $ do try (string "$else$")
when multiline $ optional skipEndline
liftM concat parseTemplate
string "$endif$"
when multiline $ optional skipEndline
let conditionSatisfied = case lookup id' vars of
Nothing -> False
Just "" -> False
Just _ -> True
return $ if conditionSatisfied
then ifContents
else elseContents | 945 | conditional :: GenParser Char TemplateState String
conditional = try $ do
TemplateState pos vars <- getState
string "$if("
id' <- ident
string ")$"
-- if newline after the "if", then a newline after "endif" will be swallowed
multiline <- option False $ try $ skipEndline >> return True
ifContents <- liftM concat parseTemplate
-- reset state for else block
setState $ TemplateState pos vars
elseContents <- option "" $ do try (string "$else$")
when multiline $ optional skipEndline
liftM concat parseTemplate
string "$endif$"
when multiline $ optional skipEndline
let conditionSatisfied = case lookup id' vars of
Nothing -> False
Just "" -> False
Just _ -> True
return $ if conditionSatisfied
then ifContents
else elseContents | 945 | conditional = try $ do
TemplateState pos vars <- getState
string "$if("
id' <- ident
string ")$"
-- if newline after the "if", then a newline after "endif" will be swallowed
multiline <- option False $ try $ skipEndline >> return True
ifContents <- liftM concat parseTemplate
-- reset state for else block
setState $ TemplateState pos vars
elseContents <- option "" $ do try (string "$else$")
when multiline $ optional skipEndline
liftM concat parseTemplate
string "$endif$"
when multiline $ optional skipEndline
let conditionSatisfied = case lookup id' vars of
Nothing -> False
Just "" -> False
Just _ -> True
return $ if conditionSatisfied
then ifContents
else elseContents | 894 | false | true | 0 | 14 | 333 | 227 | 99 | 128 | null | null |
gspia/reflex-dom-htmlea | lib/src/Reflex/Dom/HTML5/Attrs/Globals.hs | bsd-3-clause | rNote = attrSetRole (RoleA Rnote) | 45 | rNote = attrSetRole (RoleA Rnote) | 45 | rNote = attrSetRole (RoleA Rnote) | 45 | false | false | 0 | 7 | 16 | 15 | 7 | 8 | null | null |
jqpeterson/roc-translator | src/Protocol/ROC/PointTypes.hs | bsd-3-clause | fetchPointType (PTID13 _ ) bs = PTID13 $ decodeToEither $ runGetIncremental pointType13Parser `pushChunks` bs | 110 | fetchPointType (PTID13 _ ) bs = PTID13 $ decodeToEither $ runGetIncremental pointType13Parser `pushChunks` bs | 110 | fetchPointType (PTID13 _ ) bs = PTID13 $ decodeToEither $ runGetIncremental pointType13Parser `pushChunks` bs | 110 | false | false | 1 | 7 | 14 | 35 | 17 | 18 | null | null |
snoyberg/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | undefinedKey :: Unique
undefinedKey = mkPreludeMiscIdUnique 155 | 80 | undefinedKey :: Unique
undefinedKey = mkPreludeMiscIdUnique 155 | 80 | undefinedKey = mkPreludeMiscIdUnique 155 | 57 | false | true | 0 | 5 | 23 | 14 | 7 | 7 | null | null |
wiggly/functional-pokering | src/Poker.hs | mit | groupSuits :: [Card] -> [[Suit]]
groupSuits xs = group . sort $ (map suit xs) | 77 | groupSuits :: [Card] -> [[Suit]]
groupSuits xs = group . sort $ (map suit xs) | 77 | groupSuits xs = group . sort $ (map suit xs) | 44 | false | true | 3 | 9 | 14 | 51 | 24 | 27 | null | null |
nickbart1980/pandoc | src/Text/Pandoc/Writers/EPUB.hs | gpl-2.0 | toRelator :: String -> Maybe String
toRelator x
| x `elem` relators = Just x
| otherwise = lookup (map toLower x) relatorMap | 136 | toRelator :: String -> Maybe String
toRelator x
| x `elem` relators = Just x
| otherwise = lookup (map toLower x) relatorMap | 136 | toRelator x
| x `elem` relators = Just x
| otherwise = lookup (map toLower x) relatorMap | 100 | false | true | 1 | 8 | 34 | 60 | 28 | 32 | null | null |
grumply/mop | tests/Ef/Pipes/Prelude.hs | bsd-3-clause | scan :: Monad m => (x -> a -> x) -> x -> (x -> b) -> Pipe a b m r
scan step begin done = go begin
where
go x = do
yield (done x)
a <- await
let x' = step x a
go $! x'
| 205 | scan :: Monad m => (x -> a -> x) -> x -> (x -> b) -> Pipe a b m r
scan step begin done = go begin
where
go x = do
yield (done x)
a <- await
let x' = step x a
go $! x'
| 205 | scan step begin done = go begin
where
go x = do
yield (done x)
a <- await
let x' = step x a
go $! x'
| 139 | false | true | 0 | 10 | 87 | 117 | 55 | 62 | null | null |
ezyang/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | translateOp dflags IntSubOp = Just (mo_wordSub dflags) | 60 | translateOp dflags IntSubOp = Just (mo_wordSub dflags) | 60 | translateOp dflags IntSubOp = Just (mo_wordSub dflags) | 60 | false | false | 0 | 7 | 12 | 22 | 9 | 13 | null | null |
svenssonjoel/GCDObsidian | Obsidian/GCDObsidian/CodeGen/Liveness.hs | bsd-3-clause | liveness' (Allocate name size t _) s =
(Allocate name size t alive,alive)
where
alive = name `Set.delete` s | 117 | liveness' (Allocate name size t _) s =
(Allocate name size t alive,alive)
where
alive = name `Set.delete` s | 117 | liveness' (Allocate name size t _) s =
(Allocate name size t alive,alive)
where
alive = name `Set.delete` s | 117 | false | false | 2 | 7 | 28 | 65 | 29 | 36 | null | null |
bergey/plots | examples/area.hs | bsd-3-clause | myaxis :: Axis B V2 Double
myaxis = r2Axis &~ do
ribbonPlot' (mydata1 ++ zeroy (reverse mydata1)) $ do
addLegendEntry "ribbon test"
plotColor .= red
strokeEdge .= False | 188 | myaxis :: Axis B V2 Double
myaxis = r2Axis &~ do
ribbonPlot' (mydata1 ++ zeroy (reverse mydata1)) $ do
addLegendEntry "ribbon test"
plotColor .= red
strokeEdge .= False | 188 | myaxis = r2Axis &~ do
ribbonPlot' (mydata1 ++ zeroy (reverse mydata1)) $ do
addLegendEntry "ribbon test"
plotColor .= red
strokeEdge .= False | 161 | false | true | 0 | 14 | 47 | 68 | 31 | 37 | null | null |
phadej/file-embed | Data/FileEmbed.hs | bsd-2-clause | -- | Like 'dummySpace', but takes a postfix for the magic string. In
-- order for this to work, the same postfix must be used by 'inject' /
-- 'injectFile'. This allows an executable to have multiple
-- 'ByteString's injected into it, without encountering collisions.
--
-- Since 0.0.8
dummySpaceWith :: B.ByteString -> Int -> Q Exp
dummySpaceWith postfix space = do
let size = padSize space
magic' = magic postfix
start = B8.unpack magic' ++ size
magicLen = B8.length magic'
len = magicLen + sizeLen + space
chars = LitE $ StringPrimL $
#if MIN_VERSION_template_haskell(2,6,0)
map (toEnum . fromEnum) $
#endif
start ++ replicate space '0'
[| getInner (B.drop magicLen (unsafePerformIO (unsafePackAddressLen len $(return chars)))) |]
#endif
-- | Inject some raw data inside a @ByteString@ containing empty, dummy space
-- (allocated with @dummySpace@). Typically, the original @ByteString@ is an
-- executable read from the filesystem. | 1,010 | dummySpaceWith :: B.ByteString -> Int -> Q Exp
dummySpaceWith postfix space = do
let size = padSize space
magic' = magic postfix
start = B8.unpack magic' ++ size
magicLen = B8.length magic'
len = magicLen + sizeLen + space
chars = LitE $ StringPrimL $
#if MIN_VERSION_template_haskell(2,6,0)
map (toEnum . fromEnum) $
#endif
start ++ replicate space '0'
[| getInner (B.drop magicLen (unsafePerformIO (unsafePackAddressLen len $(return chars)))) |]
#endif
-- | Inject some raw data inside a @ByteString@ containing empty, dummy space
-- (allocated with @dummySpace@). Typically, the original @ByteString@ is an
-- executable read from the filesystem. | 722 | dummySpaceWith postfix space = do
let size = padSize space
magic' = magic postfix
start = B8.unpack magic' ++ size
magicLen = B8.length magic'
len = magicLen + sizeLen + space
chars = LitE $ StringPrimL $
#if MIN_VERSION_template_haskell(2,6,0)
map (toEnum . fromEnum) $
#endif
start ++ replicate space '0'
[| getInner (B.drop magicLen (unsafePerformIO (unsafePackAddressLen len $(return chars)))) |]
#endif
-- | Inject some raw data inside a @ByteString@ containing empty, dummy space
-- (allocated with @dummySpace@). Typically, the original @ByteString@ is an
-- executable read from the filesystem. | 675 | true | true | 0 | 15 | 221 | 145 | 77 | 68 | null | null |
beni55/libmpd-haskell | tests/Network/MPD/Applicative/StickersSpec.hs | mit | main :: IO ()
main = hspec spec | 31 | main :: IO ()
main = hspec spec | 31 | main = hspec spec | 17 | false | true | 0 | 7 | 7 | 25 | 10 | 15 | null | null |
ancientlanguage/haskell-analysis | grammar/src/Grammar/Common/Decompose.hs | mit | decomposeChar '\x095D' = "\x0922\x093C" | 39 | decomposeChar '\x095D' = "\x0922\x093C" | 39 | decomposeChar '\x095D' = "\x0922\x093C" | 39 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
unknownloner/calccomp | Asm/InstrSize.hs | mit | -- Hardware ops
instrSize DI _ = 1 | 36 | instrSize DI _ = 1 | 20 | instrSize DI _ = 1 | 20 | true | false | 0 | 4 | 9 | 14 | 6 | 8 | null | null |
poiuj/pfcc | src/Codegen.hs | bsd-3-clause | cgen (BoolConst bool) = return $ ConstantOperand $ Const.Int 1 $
if bool then 1 else 0 | 88 | cgen (BoolConst bool) = return $ ConstantOperand $ Const.Int 1 $
if bool then 1 else 0 | 88 | cgen (BoolConst bool) = return $ ConstantOperand $ Const.Int 1 $
if bool then 1 else 0 | 88 | false | false | 0 | 8 | 18 | 41 | 20 | 21 | null | null |
josuf107/Adverb | Adverb/Common.hs | gpl-3.0 | callously = id | 14 | callously = id | 14 | callously = id | 14 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
qpliu/esolang | shiftprime/hs/repl.hs | gpl-3.0 | hasEquals (_:tokens) = hasEquals tokens | 39 | hasEquals (_:tokens) = hasEquals tokens | 39 | hasEquals (_:tokens) = hasEquals tokens | 39 | false | false | 0 | 7 | 4 | 19 | 9 | 10 | null | null |
raymoo/NEET | src/Neet/Species.hs | gpl-3.0 | -- | "Helper function" for runFitTestWStrategy
runFitTestWithScores :: [Double] -> Species -> TestResult
runFitTestWithScores fitList Species{..} = TR mmap ss (totF / dubSize)
where dubSize = fromIntegral specSize :: Double
(mmap, totF) = foldl' accumOne (MM.empty, 0) resses
resses = zip fitList specOrgs
accumOne (accM, accA) (score, g) = (MM.insert score g accM, accA + score)
ss = case MM.findMaxWithValues mmap of
Nothing -> error "(runFitTest) folding fitness resulted in empty map!"
Just (scr, (x:_)) -> SpecScore scr x
_ -> error "(runFitTest) MultiMap had a key with empty list!"
-- | Takes a new SpecScore and updates the metadata of a species | 737 | runFitTestWithScores :: [Double] -> Species -> TestResult
runFitTestWithScores fitList Species{..} = TR mmap ss (totF / dubSize)
where dubSize = fromIntegral specSize :: Double
(mmap, totF) = foldl' accumOne (MM.empty, 0) resses
resses = zip fitList specOrgs
accumOne (accM, accA) (score, g) = (MM.insert score g accM, accA + score)
ss = case MM.findMaxWithValues mmap of
Nothing -> error "(runFitTest) folding fitness resulted in empty map!"
Just (scr, (x:_)) -> SpecScore scr x
_ -> error "(runFitTest) MultiMap had a key with empty list!"
-- | Takes a new SpecScore and updates the metadata of a species | 690 | runFitTestWithScores fitList Species{..} = TR mmap ss (totF / dubSize)
where dubSize = fromIntegral specSize :: Double
(mmap, totF) = foldl' accumOne (MM.empty, 0) resses
resses = zip fitList specOrgs
accumOne (accM, accA) (score, g) = (MM.insert score g accM, accA + score)
ss = case MM.findMaxWithValues mmap of
Nothing -> error "(runFitTest) folding fitness resulted in empty map!"
Just (scr, (x:_)) -> SpecScore scr x
_ -> error "(runFitTest) MultiMap had a key with empty list!"
-- | Takes a new SpecScore and updates the metadata of a species | 632 | true | true | 2 | 11 | 186 | 206 | 105 | 101 | null | null |
larskuhtz/wai-cors | src/Network/Wai/Middleware/Cors.hs | mit | -- | Add HTTP headers to a WAI response
--
addHeaders ∷ HTTP.ResponseHeaders → WAI.Middleware
addHeaders hdrs app req respond = app req $ \response → do
let (st, headers, streamHandle) = WAI.responseToStream response
streamHandle $ \streamBody →
respond $ WAI.responseStream st (headers ⊕ hdrs) streamBody
-- | Format a list of 'HTTP.HeaderName's such that it can be used as
-- an HTTP header value
-- | 418 | addHeaders ∷ HTTP.ResponseHeaders → WAI.Middleware
addHeaders hdrs app req respond = app req $ \response → do
let (st, headers, streamHandle) = WAI.responseToStream response
streamHandle $ \streamBody →
respond $ WAI.responseStream st (headers ⊕ hdrs) streamBody
-- | Format a list of 'HTTP.HeaderName's such that it can be used as
-- an HTTP header value
-- | 375 | addHeaders hdrs app req respond = app req $ \response → do
let (st, headers, streamHandle) = WAI.responseToStream response
streamHandle $ \streamBody →
respond $ WAI.responseStream st (headers ⊕ hdrs) streamBody
-- | Format a list of 'HTTP.HeaderName's such that it can be used as
-- an HTTP header value
-- | 324 | true | true | 0 | 14 | 82 | 101 | 53 | 48 | null | null |
BenedictEggers/calculusbot | src/Calculusbot/Unparse.hs | gpl-3.0 | unparsebin Divide = " / " | 25 | unparsebin Divide = " / " | 25 | unparsebin Divide = " / " | 25 | false | false | 1 | 5 | 5 | 13 | 4 | 9 | null | null |
JustusAdam/haxl-test-generated-graph | app/RunTests.hs | bsd-3-clause | outputResults rawData expName runTime confs = do
let jsonData = fromMaybe (error "json unreadable") $ decode $ B.fromStrict $ encodeUtf8 rawData
let withPercent = map (\(mg, conf) -> mg { genConf = Just conf } ) (zip jsonData confs)
print "Writing results to {}\n" [show $ outputLocation </> expName <.> "json"]
writefile (outputLocation </> expName <.> "json") (decodeUtf8 $ B.toStrict $ encode withPercent)
print "Ran program in {}\n" [formatSeconds $ ceiling runTime] | 497 | outputResults rawData expName runTime confs = do
let jsonData = fromMaybe (error "json unreadable") $ decode $ B.fromStrict $ encodeUtf8 rawData
let withPercent = map (\(mg, conf) -> mg { genConf = Just conf } ) (zip jsonData confs)
print "Writing results to {}\n" [show $ outputLocation </> expName <.> "json"]
writefile (outputLocation </> expName <.> "json") (decodeUtf8 $ B.toStrict $ encode withPercent)
print "Ran program in {}\n" [formatSeconds $ ceiling runTime] | 497 | outputResults rawData expName runTime confs = do
let jsonData = fromMaybe (error "json unreadable") $ decode $ B.fromStrict $ encodeUtf8 rawData
let withPercent = map (\(mg, conf) -> mg { genConf = Just conf } ) (zip jsonData confs)
print "Writing results to {}\n" [show $ outputLocation </> expName <.> "json"]
writefile (outputLocation </> expName <.> "json") (decodeUtf8 $ B.toStrict $ encode withPercent)
print "Ran program in {}\n" [formatSeconds $ ceiling runTime] | 497 | false | false | 0 | 15 | 98 | 173 | 84 | 89 | null | null |
ankeshs/numerikell | tmp/Stats.hs | bsd-3-clause | covMatrix :: (Fractional a) => [[a]] -> [[a]]
covMatrix x = map (\i -> covMatrix' x n i) [0..(n-1)]
where n = Matrix.maxCol x
-- |helping function for covMatrix | 179 | covMatrix :: (Fractional a) => [[a]] -> [[a]]
covMatrix x = map (\i -> covMatrix' x n i) [0..(n-1)]
where n = Matrix.maxCol x
-- |helping function for covMatrix | 178 | covMatrix x = map (\i -> covMatrix' x n i) [0..(n-1)]
where n = Matrix.maxCol x
-- |helping function for covMatrix | 132 | false | true | 0 | 8 | 47 | 84 | 46 | 38 | null | null |
mightymoose/liquidhaskell | benchmarks/icfp15/neg/Composition.hs | bsd-3-clause | {-@ plusminus :: n:Nat -> m:Nat -> x:{Nat | x <= m} -> {v:Nat | v < (m - x) + n} @-}
plusminus :: Int -> Int -> Int -> Int
plusminus n m = (n+) `cmp` (m-) | 154 | plusminus :: Int -> Int -> Int -> Int
plusminus n m = (n+) `cmp` (m-) | 69 | plusminus n m = (n+) `cmp` (m-) | 31 | true | true | 0 | 7 | 38 | 43 | 25 | 18 | null | null |
davidpdrsn/alisp | src/Parser.hs | bsd-3-clause | fun :: Parser Function
fun = parens $ do
_ <- symbol "defun"
name <- identifier
args <- arguments
body <- many expr
return $ Function name args body | 158 | fun :: Parser Function
fun = parens $ do
_ <- symbol "defun"
name <- identifier
args <- arguments
body <- many expr
return $ Function name args body | 158 | fun = parens $ do
_ <- symbol "defun"
name <- identifier
args <- arguments
body <- many expr
return $ Function name args body | 135 | false | true | 1 | 10 | 38 | 70 | 29 | 41 | null | null |
erantapaa/haskell-platform | hptool/os-extras/win/test/glut.hs | bsd-3-clause | display = do
clear [ColorBuffer]
renderPrimitive Points $ mapM_ (\(x, y, z)->vertex$Vertex3 x y z) myPoints
flush | 120 | display = do
clear [ColorBuffer]
renderPrimitive Points $ mapM_ (\(x, y, z)->vertex$Vertex3 x y z) myPoints
flush | 120 | display = do
clear [ColorBuffer]
renderPrimitive Points $ mapM_ (\(x, y, z)->vertex$Vertex3 x y z) myPoints
flush | 120 | false | false | 1 | 12 | 23 | 65 | 30 | 35 | null | null |
bgamari/linear | src/Linear/V.hs | bsd-3-clause | retagPD :: (Proxy n -> a) -> proxy (PD n) -> a
retagPD f _ = f Proxy | 68 | retagPD :: (Proxy n -> a) -> proxy (PD n) -> a
retagPD f _ = f Proxy | 68 | retagPD f _ = f Proxy | 21 | false | true | 0 | 9 | 17 | 46 | 22 | 24 | null | null |
lwchkg/sunlight-x | test/code-snippets/haskell.hs | apache-2.0 | nilAboveNest :: Bool -> Int -> RDoc -> RDoc
-- Specification: text s <> nilaboveNest g k q
-- = text s <> (text "" $g$ nest k q)
nilAboveNest _ k _ | k `seq` False = undefined | 200 | nilAboveNest :: Bool -> Int -> RDoc -> RDoc
nilAboveNest _ k _ | k `seq` False = undefined | 100 | nilAboveNest _ k _ | k `seq` False = undefined | 56 | true | true | 0 | 8 | 63 | 44 | 23 | 21 | null | null |
ganeti/htools | Ganeti/HTools/Cluster.hs | gpl-2.0 | tryEvac :: (Monad m) =>
Node.List -- ^ The node list
-> Instance.List -- ^ The instance list
-> [Idx] -- ^ Instances to be evacuated
-> [Ndx] -- ^ Restricted nodes (the ones being evacuated)
-> m AllocSolution -- ^ Solution list
tryEvac nl il idxs ex_ndx = do
(_, sol) <- foldM (evacInstance ex_ndx il) (nl, emptySolution) idxs
return sol
-- | Multi-group evacuation of a list of nodes. | 467 | tryEvac :: (Monad m) =>
Node.List -- ^ The node list
-> Instance.List -- ^ The instance list
-> [Idx] -- ^ Instances to be evacuated
-> [Ndx] -- ^ Restricted nodes (the ones being evacuated)
-> m AllocSolution
tryEvac nl il idxs ex_ndx = do
(_, sol) <- foldM (evacInstance ex_ndx il) (nl, emptySolution) idxs
return sol
-- | Multi-group evacuation of a list of nodes. | 448 | tryEvac nl il idxs ex_ndx = do
(_, sol) <- foldM (evacInstance ex_ndx il) (nl, emptySolution) idxs
return sol
-- | Multi-group evacuation of a list of nodes. | 162 | true | true | 0 | 11 | 151 | 109 | 57 | 52 | null | null |
vTurbine/ghc | compiler/nativeGen/AsmCodeGen.hs | bsd-3-clause | cmmExprCon :: DynFlags -> CmmExpr -> CmmExpr
cmmExprCon dflags (CmmLoad addr rep) = CmmLoad (cmmExprCon dflags addr) rep | 120 | cmmExprCon :: DynFlags -> CmmExpr -> CmmExpr
cmmExprCon dflags (CmmLoad addr rep) = CmmLoad (cmmExprCon dflags addr) rep | 120 | cmmExprCon dflags (CmmLoad addr rep) = CmmLoad (cmmExprCon dflags addr) rep | 75 | false | true | 0 | 7 | 17 | 45 | 22 | 23 | null | null |
rueshyna/gogol | gogol-affiliates/gen/Network/Google/Affiliates/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Publishers' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pNextPageToken'
--
-- * 'pKind'
--
-- * 'pItems'
publishers
:: Publishers
publishers =
Publishers'
{ _pNextPageToken = Nothing
, _pKind = "gan#publishers"
, _pItems = Nothing
} | 371 | publishers
:: Publishers
publishers =
Publishers'
{ _pNextPageToken = Nothing
, _pKind = "gan#publishers"
, _pItems = Nothing
} | 151 | publishers =
Publishers'
{ _pNextPageToken = Nothing
, _pKind = "gan#publishers"
, _pItems = Nothing
} | 122 | true | true | 0 | 7 | 84 | 50 | 30 | 20 | null | null |
nikita-volkov/graph-db | executables/Benchmarks/GraphDB.hs | mit | -- Interpreter
-------------------------
interpretSession ::
(G.Session s, u ~ Catalogue,
MonadTrans (s u), MonadIO (s u m),
MonadIO m, MonadBaseControl IO m) =>
Session m a -> s u m a
interpretSession = iterTM $ \case
InsertArtist a c -> G.write (insertArtist a) >>= c
InsertGenre g c -> G.write (insertGenre g) >>= c
InsertSong s gl al c -> G.write (insertSong s gl al) >>= c
LookupArtistByUID u c -> G.read (lookupArtistByUID u) >>= c
LookupArtistsByName n c -> G.read (lookupArtistsByName n) >>= c
LookupArtistsBySongGenreName n c -> G.read (lookupArtistsBySongGenreName n) >>= c
where
lookupArtistByUID :: UID Artist -> G.Read s Catalogue t (Maybe (Identified Artist))
lookupArtistByUID uid =
G.getRoot >>= flip G.getTargets (Catalogue_Artist_UID uid) >>=
return . listToMaybe >>= mapM G.getValue
lookupArtistsByName :: Text -> G.Read s Catalogue t [Identified Artist]
lookupArtistsByName n =
G.getRoot >>= flip G.getTargets (Catalogue_Artist_Name n) >>= mapM G.getValue
lookupArtistsBySongGenreName :: Text -> G.Read s Catalogue t [Identified Artist]
lookupArtistsBySongGenreName n =
G.getRoot >>=
flip G.getTargets (Catalogue_Genre_Name n) >>=
mapM (flip G.getTargets Genre_Song) >>=
return . concat >>=
mapM (flip G.getTargets Song_Artist) >>=
return . concat >>=
mapM G.getValue
insertArtist :: Artist -> G.Write s Catalogue t (UID Artist)
insertArtist value = do
root <- G.getRoot
uid <- updateNode root $ zoom _1 $ modify succ >> get
node <- G.newNode (Identified uid value)
G.addTarget root node
return uid
insertGenre :: Genre -> G.Write s Catalogue t (UID Genre)
insertGenre value = do
root <- G.getRoot
uid <- updateNode root $ zoom _2 $ modify succ >> get
node <- G.newNode (Identified uid value)
G.addTarget root node
return uid
insertSong :: Song -> [UID Genre] -> [UID Artist] -> G.Write s Catalogue t (UID Song)
insertSong value genreUIDs artistUIDs = do
root <- G.getRoot
uid <- updateNode root $ zoom _3 $ modify succ >> get
node <- G.newNode (Identified uid value)
forM_ genreUIDs $ \uid -> do
genres <- G.getTargets root (Catalogue_Genre_UID uid)
forM_ genres $ \genre -> do
G.addTarget genre node
forM_ artistUIDs $ \uid -> do
artists <- G.getTargets root (Catalogue_Artist_UID uid)
forM_ artists $ \artist -> do
G.addTarget node artist
return uid
generateUID :: Lens' Catalogue (UID a) -> G.Write s Catalogue t (UID a)
generateUID selector = do
root <- G.getRoot
updateNode root $ zoom selector $ modify succ >> get
updateNode ::
(G.PolyValue Catalogue v) =>
G.Node s Catalogue t v -> State v r -> G.Write s Catalogue t r
updateNode n u = G.getValue n >>= return . runState u >>= \(r, v') -> G.setValue n v' >> return r
-- Setup
------------------------- | 3,021 | interpretSession ::
(G.Session s, u ~ Catalogue,
MonadTrans (s u), MonadIO (s u m),
MonadIO m, MonadBaseControl IO m) =>
Session m a -> s u m a
interpretSession = iterTM $ \case
InsertArtist a c -> G.write (insertArtist a) >>= c
InsertGenre g c -> G.write (insertGenre g) >>= c
InsertSong s gl al c -> G.write (insertSong s gl al) >>= c
LookupArtistByUID u c -> G.read (lookupArtistByUID u) >>= c
LookupArtistsByName n c -> G.read (lookupArtistsByName n) >>= c
LookupArtistsBySongGenreName n c -> G.read (lookupArtistsBySongGenreName n) >>= c
where
lookupArtistByUID :: UID Artist -> G.Read s Catalogue t (Maybe (Identified Artist))
lookupArtistByUID uid =
G.getRoot >>= flip G.getTargets (Catalogue_Artist_UID uid) >>=
return . listToMaybe >>= mapM G.getValue
lookupArtistsByName :: Text -> G.Read s Catalogue t [Identified Artist]
lookupArtistsByName n =
G.getRoot >>= flip G.getTargets (Catalogue_Artist_Name n) >>= mapM G.getValue
lookupArtistsBySongGenreName :: Text -> G.Read s Catalogue t [Identified Artist]
lookupArtistsBySongGenreName n =
G.getRoot >>=
flip G.getTargets (Catalogue_Genre_Name n) >>=
mapM (flip G.getTargets Genre_Song) >>=
return . concat >>=
mapM (flip G.getTargets Song_Artist) >>=
return . concat >>=
mapM G.getValue
insertArtist :: Artist -> G.Write s Catalogue t (UID Artist)
insertArtist value = do
root <- G.getRoot
uid <- updateNode root $ zoom _1 $ modify succ >> get
node <- G.newNode (Identified uid value)
G.addTarget root node
return uid
insertGenre :: Genre -> G.Write s Catalogue t (UID Genre)
insertGenre value = do
root <- G.getRoot
uid <- updateNode root $ zoom _2 $ modify succ >> get
node <- G.newNode (Identified uid value)
G.addTarget root node
return uid
insertSong :: Song -> [UID Genre] -> [UID Artist] -> G.Write s Catalogue t (UID Song)
insertSong value genreUIDs artistUIDs = do
root <- G.getRoot
uid <- updateNode root $ zoom _3 $ modify succ >> get
node <- G.newNode (Identified uid value)
forM_ genreUIDs $ \uid -> do
genres <- G.getTargets root (Catalogue_Genre_UID uid)
forM_ genres $ \genre -> do
G.addTarget genre node
forM_ artistUIDs $ \uid -> do
artists <- G.getTargets root (Catalogue_Artist_UID uid)
forM_ artists $ \artist -> do
G.addTarget node artist
return uid
generateUID :: Lens' Catalogue (UID a) -> G.Write s Catalogue t (UID a)
generateUID selector = do
root <- G.getRoot
updateNode root $ zoom selector $ modify succ >> get
updateNode ::
(G.PolyValue Catalogue v) =>
G.Node s Catalogue t v -> State v r -> G.Write s Catalogue t r
updateNode n u = G.getValue n >>= return . runState u >>= \(r, v') -> G.setValue n v' >> return r
-- Setup
------------------------- | 2,979 | interpretSession = iterTM $ \case
InsertArtist a c -> G.write (insertArtist a) >>= c
InsertGenre g c -> G.write (insertGenre g) >>= c
InsertSong s gl al c -> G.write (insertSong s gl al) >>= c
LookupArtistByUID u c -> G.read (lookupArtistByUID u) >>= c
LookupArtistsByName n c -> G.read (lookupArtistsByName n) >>= c
LookupArtistsBySongGenreName n c -> G.read (lookupArtistsBySongGenreName n) >>= c
where
lookupArtistByUID :: UID Artist -> G.Read s Catalogue t (Maybe (Identified Artist))
lookupArtistByUID uid =
G.getRoot >>= flip G.getTargets (Catalogue_Artist_UID uid) >>=
return . listToMaybe >>= mapM G.getValue
lookupArtistsByName :: Text -> G.Read s Catalogue t [Identified Artist]
lookupArtistsByName n =
G.getRoot >>= flip G.getTargets (Catalogue_Artist_Name n) >>= mapM G.getValue
lookupArtistsBySongGenreName :: Text -> G.Read s Catalogue t [Identified Artist]
lookupArtistsBySongGenreName n =
G.getRoot >>=
flip G.getTargets (Catalogue_Genre_Name n) >>=
mapM (flip G.getTargets Genre_Song) >>=
return . concat >>=
mapM (flip G.getTargets Song_Artist) >>=
return . concat >>=
mapM G.getValue
insertArtist :: Artist -> G.Write s Catalogue t (UID Artist)
insertArtist value = do
root <- G.getRoot
uid <- updateNode root $ zoom _1 $ modify succ >> get
node <- G.newNode (Identified uid value)
G.addTarget root node
return uid
insertGenre :: Genre -> G.Write s Catalogue t (UID Genre)
insertGenre value = do
root <- G.getRoot
uid <- updateNode root $ zoom _2 $ modify succ >> get
node <- G.newNode (Identified uid value)
G.addTarget root node
return uid
insertSong :: Song -> [UID Genre] -> [UID Artist] -> G.Write s Catalogue t (UID Song)
insertSong value genreUIDs artistUIDs = do
root <- G.getRoot
uid <- updateNode root $ zoom _3 $ modify succ >> get
node <- G.newNode (Identified uid value)
forM_ genreUIDs $ \uid -> do
genres <- G.getTargets root (Catalogue_Genre_UID uid)
forM_ genres $ \genre -> do
G.addTarget genre node
forM_ artistUIDs $ \uid -> do
artists <- G.getTargets root (Catalogue_Artist_UID uid)
forM_ artists $ \artist -> do
G.addTarget node artist
return uid
generateUID :: Lens' Catalogue (UID a) -> G.Write s Catalogue t (UID a)
generateUID selector = do
root <- G.getRoot
updateNode root $ zoom selector $ modify succ >> get
updateNode ::
(G.PolyValue Catalogue v) =>
G.Node s Catalogue t v -> State v r -> G.Write s Catalogue t r
updateNode n u = G.getValue n >>= return . runState u >>= \(r, v') -> G.setValue n v' >> return r
-- Setup
------------------------- | 2,824 | true | true | 0 | 16 | 767 | 1,157 | 544 | 613 | null | null |
circuithub/circuithub-prelude | Data/Either/Validation/Extra.hs | mit | successMay (Failure _) = Nothing | 32 | successMay (Failure _) = Nothing | 32 | successMay (Failure _) = Nothing | 32 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
shockkolate/lambdircd | plugins.old/User.hs | apache-2.0 | user env _
| Client.registered (Env.client env) = env {Env.actions=aMayNot:Env.actions env}
| otherwise = env {Env.actions=aNotEnough:Env.actions env}
where aNotEnough = GenericAction $ \e -> sendNumeric e numERR_NEEDMOREPARAMS ["USER", "Not enough parameters"]
>> return e | 295 | user env _
| Client.registered (Env.client env) = env {Env.actions=aMayNot:Env.actions env}
| otherwise = env {Env.actions=aNotEnough:Env.actions env}
where aNotEnough = GenericAction $ \e -> sendNumeric e numERR_NEEDMOREPARAMS ["USER", "Not enough parameters"]
>> return e | 295 | user env _
| Client.registered (Env.client env) = env {Env.actions=aMayNot:Env.actions env}
| otherwise = env {Env.actions=aNotEnough:Env.actions env}
where aNotEnough = GenericAction $ \e -> sendNumeric e numERR_NEEDMOREPARAMS ["USER", "Not enough parameters"]
>> return e | 295 | false | false | 0 | 11 | 55 | 114 | 56 | 58 | null | null |
keera-studios/hsQt | Qtc/Enums/Gui/QAbstractItemView.hs | bsd-2-clause | eOnItem :: DropIndicatorPosition
eOnItem
= ieDropIndicatorPosition $ 0 | 72 | eOnItem :: DropIndicatorPosition
eOnItem
= ieDropIndicatorPosition $ 0 | 72 | eOnItem
= ieDropIndicatorPosition $ 0 | 39 | false | true | 0 | 6 | 9 | 22 | 9 | 13 | null | null |
hazel-el/hazel | Hazel/Parser/OWL/SPARQL.hs | gpl-3.0 | isCharU :: Char -> Bool
isCharU '_' = True | 42 | isCharU :: Char -> Bool
isCharU '_' = True | 42 | isCharU '_' = True | 18 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
petertseng/adventofcode-hs | bin/20_factors.hs | apache-2.0 | isqrt :: Int -> Int
isqrt = floor' . sqrt . fromIntegral
-- This is just to avoid a compiler warning
-- about a defaulted constraint
where floor' = floor :: (Double -> Int) | 178 | isqrt :: Int -> Int
isqrt = floor' . sqrt . fromIntegral
-- This is just to avoid a compiler warning
-- about a defaulted constraint
where floor' = floor :: (Double -> Int) | 178 | isqrt = floor' . sqrt . fromIntegral
-- This is just to avoid a compiler warning
-- about a defaulted constraint
where floor' = floor :: (Double -> Int) | 158 | false | true | 0 | 6 | 39 | 43 | 24 | 19 | null | null |
DavidAlphaFox/ghc | libraries/Cabal/Cabal/Distribution/Compiler.hs | bsd-3-clause | knownCompilerFlavors :: [CompilerFlavor]
knownCompilerFlavors = [GHC, GHCJS, NHC, YHC, Hugs, HBC, Helium, JHC, LHC, UHC] | 120 | knownCompilerFlavors :: [CompilerFlavor]
knownCompilerFlavors = [GHC, GHCJS, NHC, YHC, Hugs, HBC, Helium, JHC, LHC, UHC] | 120 | knownCompilerFlavors = [GHC, GHCJS, NHC, YHC, Hugs, HBC, Helium, JHC, LHC, UHC] | 79 | false | true | 0 | 7 | 14 | 51 | 29 | 22 | null | null |
tsuraan/ekg-wai | System/Remote/Monitoring.hs | bsd-3-clause | -- | A list of all built-in (e.g. GC) counters, together with a
-- pretty-printing function for each.
builtinCounters :: Map.Map T.Text (Stats.GCStats -> String)
builtinCounters = Map.fromList [
("bytes_allocated" , show . Stats.bytesAllocated)
, ("num_gcs" , show . Stats.numGcs)
, ("max_bytes_used" , show . Stats.maxBytesUsed)
, ("num_bytes_usage_samples" , show . Stats.numByteUsageSamples)
, ("cumulative_bytes_used" , show . Stats.cumulativeBytesUsed)
, ("bytes_copied" , show . Stats.bytesCopied)
, ("current_bytes_used" , show . Stats.currentBytesUsed)
, ("current_bytes_slop" , show . Stats.currentBytesSlop)
, ("max_bytes_slop" , show . Stats.maxBytesSlop)
, ("peak_megabytes_allocated" , show . Stats.peakMegabytesAllocated)
, ("mutator_cpu_seconds" , show . Stats.mutatorCpuSeconds)
, ("mutator_wall_seconds" , show . Stats.mutatorWallSeconds)
, ("gc_cpu_seconds" , show . Stats.gcCpuSeconds)
, ("gc_wall_seconds" , show . Stats.gcWallSeconds)
, ("cpu_seconds" , show . Stats.cpuSeconds)
, ("wall_seconds" , show . Stats.wallSeconds)
#if MIN_VERSION_base(4,6,0)
, ("par_tot_bytes_copied" , show . Stats.parTotBytesCopied)
, ("par_avg_bytes_copied" , show . Stats.parTotBytesCopied)
#else
, ("par_avg_bytes_copied" , show . Stats.parAvgBytesCopied)
#endif
, ("par_max_bytes_copied" , show . Stats.parMaxBytesCopied)
] | 1,557 | builtinCounters :: Map.Map T.Text (Stats.GCStats -> String)
builtinCounters = Map.fromList [
("bytes_allocated" , show . Stats.bytesAllocated)
, ("num_gcs" , show . Stats.numGcs)
, ("max_bytes_used" , show . Stats.maxBytesUsed)
, ("num_bytes_usage_samples" , show . Stats.numByteUsageSamples)
, ("cumulative_bytes_used" , show . Stats.cumulativeBytesUsed)
, ("bytes_copied" , show . Stats.bytesCopied)
, ("current_bytes_used" , show . Stats.currentBytesUsed)
, ("current_bytes_slop" , show . Stats.currentBytesSlop)
, ("max_bytes_slop" , show . Stats.maxBytesSlop)
, ("peak_megabytes_allocated" , show . Stats.peakMegabytesAllocated)
, ("mutator_cpu_seconds" , show . Stats.mutatorCpuSeconds)
, ("mutator_wall_seconds" , show . Stats.mutatorWallSeconds)
, ("gc_cpu_seconds" , show . Stats.gcCpuSeconds)
, ("gc_wall_seconds" , show . Stats.gcWallSeconds)
, ("cpu_seconds" , show . Stats.cpuSeconds)
, ("wall_seconds" , show . Stats.wallSeconds)
#if MIN_VERSION_base(4,6,0)
, ("par_tot_bytes_copied" , show . Stats.parTotBytesCopied)
, ("par_avg_bytes_copied" , show . Stats.parTotBytesCopied)
#else
, ("par_avg_bytes_copied" , show . Stats.parAvgBytesCopied)
#endif
, ("par_max_bytes_copied" , show . Stats.parMaxBytesCopied)
] | 1,455 | builtinCounters = Map.fromList [
("bytes_allocated" , show . Stats.bytesAllocated)
, ("num_gcs" , show . Stats.numGcs)
, ("max_bytes_used" , show . Stats.maxBytesUsed)
, ("num_bytes_usage_samples" , show . Stats.numByteUsageSamples)
, ("cumulative_bytes_used" , show . Stats.cumulativeBytesUsed)
, ("bytes_copied" , show . Stats.bytesCopied)
, ("current_bytes_used" , show . Stats.currentBytesUsed)
, ("current_bytes_slop" , show . Stats.currentBytesSlop)
, ("max_bytes_slop" , show . Stats.maxBytesSlop)
, ("peak_megabytes_allocated" , show . Stats.peakMegabytesAllocated)
, ("mutator_cpu_seconds" , show . Stats.mutatorCpuSeconds)
, ("mutator_wall_seconds" , show . Stats.mutatorWallSeconds)
, ("gc_cpu_seconds" , show . Stats.gcCpuSeconds)
, ("gc_wall_seconds" , show . Stats.gcWallSeconds)
, ("cpu_seconds" , show . Stats.cpuSeconds)
, ("wall_seconds" , show . Stats.wallSeconds)
#if MIN_VERSION_base(4,6,0)
, ("par_tot_bytes_copied" , show . Stats.parTotBytesCopied)
, ("par_avg_bytes_copied" , show . Stats.parTotBytesCopied)
#else
, ("par_avg_bytes_copied" , show . Stats.parAvgBytesCopied)
#endif
, ("par_max_bytes_copied" , show . Stats.parMaxBytesCopied)
] | 1,395 | true | true | 0 | 9 | 381 | 324 | 193 | 131 | null | null |
narrative/stack | src/Stack/Types/Config/Build.hs | bsd-3-clause | toMonoidAdditionalArgsName :: Text
toMonoidAdditionalArgsName = "additional-args" | 81 | toMonoidAdditionalArgsName :: Text
toMonoidAdditionalArgsName = "additional-args" | 81 | toMonoidAdditionalArgsName = "additional-args" | 46 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
trskop/hpwgen | src/Text/Pwgen/Common.hs | bsd-3-clause | -- | Numbers @\'0\', \'1\', ... \'9\'@.
numbers :: FromAscii a => (a -> t -> t) -> t -> t
numbers = construct [48..57] | 118 | numbers :: FromAscii a => (a -> t -> t) -> t -> t
numbers = construct [48..57] | 78 | numbers = construct [48..57] | 28 | true | true | 0 | 10 | 24 | 53 | 25 | 28 | null | null |
tolysz/prepare-ghcjs | spec-lts8/cabal/Cabal/Distribution/PackageDescription/Parse.hs | bsd-3-clause | showHookedBuildInfo :: HookedBuildInfo -> String
showHookedBuildInfo (mb_lib_bi, ex_bis) = render $
(case mb_lib_bi of
Nothing -> empty
Just bi -> ppBuildInfo bi)
$$ vcat [ space
$$ text "executable:" <+> text name
$$ ppBuildInfo bi
| (name, bi) <- ex_bis ]
where
ppBuildInfo bi = ppFields binfoFieldDescrs bi
$$ ppCustomFields (customFieldsBI bi)
-- replace all tabs used as indentation with whitespace, also return where
-- tabs were found | 526 | showHookedBuildInfo :: HookedBuildInfo -> String
showHookedBuildInfo (mb_lib_bi, ex_bis) = render $
(case mb_lib_bi of
Nothing -> empty
Just bi -> ppBuildInfo bi)
$$ vcat [ space
$$ text "executable:" <+> text name
$$ ppBuildInfo bi
| (name, bi) <- ex_bis ]
where
ppBuildInfo bi = ppFields binfoFieldDescrs bi
$$ ppCustomFields (customFieldsBI bi)
-- replace all tabs used as indentation with whitespace, also return where
-- tabs were found | 526 | showHookedBuildInfo (mb_lib_bi, ex_bis) = render $
(case mb_lib_bi of
Nothing -> empty
Just bi -> ppBuildInfo bi)
$$ vcat [ space
$$ text "executable:" <+> text name
$$ ppBuildInfo bi
| (name, bi) <- ex_bis ]
where
ppBuildInfo bi = ppFields binfoFieldDescrs bi
$$ ppCustomFields (customFieldsBI bi)
-- replace all tabs used as indentation with whitespace, also return where
-- tabs were found | 477 | false | true | 2 | 10 | 152 | 130 | 64 | 66 | null | null |
zachsully/redo | dist/build/autogen/Paths_redo.hs | bsd-3-clause | getLibDir = catchIO (getEnv "redo_libdir") (\_ -> return libdir) | 64 | getLibDir = catchIO (getEnv "redo_libdir") (\_ -> return libdir) | 64 | getLibDir = catchIO (getEnv "redo_libdir") (\_ -> return libdir) | 64 | false | false | 0 | 8 | 8 | 28 | 14 | 14 | null | null |
phischu/fragnix | builtins/base/Data.List.NonEmpty.hs | bsd-3-clause | -- | The 'nub' function removes duplicate elements from a list. In
-- particular, it keeps only the first occurence of each element.
-- (The name 'nub' means \'essence\'.)
-- It is a special case of 'nubBy', which allows the programmer to
-- supply their own inequality test.
nub :: Eq a => NonEmpty a -> NonEmpty a
nub = nubBy (==) | 332 | nub :: Eq a => NonEmpty a -> NonEmpty a
nub = nubBy (==) | 56 | nub = nubBy (==) | 16 | true | true | 0 | 7 | 61 | 38 | 21 | 17 | null | null |
Mathnerd314/atomo | src/Atomo/Parser/Base.hs | bsd-3-clause | wsBlock :: Parser a -> Parser [a]
wsBlock = wsDelim ";" | 55 | wsBlock :: Parser a -> Parser [a]
wsBlock = wsDelim ";" | 55 | wsBlock = wsDelim ";" | 21 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
geekingfrog/advent-of-code | src/Y2015/Day13.hs | bsd-3-clause | completeSitting sitting vs =
let
firstPerson = first $ head sitting
lastPerson = second $ last sitting
missingSitting =
find (\(a, b, _) -> b == firstPerson && a == lastPerson) vs
err =
"Cannot find sitting between "
++ show firstPerson
++ " and "
++ show lastPerson
in
fromMaybe (error err) missingSitting | 427 | completeSitting sitting vs =
let
firstPerson = first $ head sitting
lastPerson = second $ last sitting
missingSitting =
find (\(a, b, _) -> b == firstPerson && a == lastPerson) vs
err =
"Cannot find sitting between "
++ show firstPerson
++ " and "
++ show lastPerson
in
fromMaybe (error err) missingSitting | 427 | completeSitting sitting vs =
let
firstPerson = first $ head sitting
lastPerson = second $ last sitting
missingSitting =
find (\(a, b, _) -> b == firstPerson && a == lastPerson) vs
err =
"Cannot find sitting between "
++ show firstPerson
++ " and "
++ show lastPerson
in
fromMaybe (error err) missingSitting | 427 | false | false | 0 | 14 | 174 | 114 | 57 | 57 | null | null |
bitemyapp/irc-core | src/Irc/Model.hs | bsd-3-clause | doList ::
Identifier {- ^ channel -} ->
Integer {- ^ members -} ->
ByteString {- ^ topic -} ->
IrcConnection -> Logic IrcConnection
doList chan num topic =
doServerMessage "LIST"
(B8.unwords [idBytes chan, " - ",
B8.pack (show num), " - ",
topic]) | 300 | doList ::
Identifier {- ^ channel -} ->
Integer {- ^ members -} ->
ByteString {- ^ topic -} ->
IrcConnection -> Logic IrcConnection
doList chan num topic =
doServerMessage "LIST"
(B8.unwords [idBytes chan, " - ",
B8.pack (show num), " - ",
topic]) | 300 | doList chan num topic =
doServerMessage "LIST"
(B8.unwords [idBytes chan, " - ",
B8.pack (show num), " - ",
topic]) | 155 | false | true | 0 | 11 | 96 | 82 | 43 | 39 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.