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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pyuk/euler2 | src/P23.hs | bsd-3-clause | testNum :: Int -> Bool
testNum x = if [a+b | a <- abundantNums, b <- abundantNums, a+b == x] /= []
then False else True | 121 | testNum :: Int -> Bool
testNum x = if [a+b | a <- abundantNums, b <- abundantNums, a+b == x] /= []
then False else True | 121 | testNum x = if [a+b | a <- abundantNums, b <- abundantNums, a+b == x] /= []
then False else True | 98 | false | true | 0 | 10 | 27 | 67 | 35 | 32 | null | null |
koengit/modalox | Modalox.hs | bsd-2-clause | addDiaPrim :: Lit -> Modality m -> Lit -> M m ()
addDiaPrim a m b = M (\s say ref -> return ((),[],[(a,m,b)])) | 110 | addDiaPrim :: Lit -> Modality m -> Lit -> M m ()
addDiaPrim a m b = M (\s say ref -> return ((),[],[(a,m,b)])) | 110 | addDiaPrim a m b = M (\s say ref -> return ((),[],[(a,m,b)])) | 61 | false | true | 0 | 11 | 23 | 83 | 44 | 39 | null | null |
Azabuhs/Roogle | src/Roogle/Scope.hs | mit | scopeToDoc :: Scope -> String
scopeToDoc (Class klass scopes) = unlines $ map (\x -> (klass ++ scopeToDoc x)) scopes | 116 | scopeToDoc :: Scope -> String
scopeToDoc (Class klass scopes) = unlines $ map (\x -> (klass ++ scopeToDoc x)) scopes | 116 | scopeToDoc (Class klass scopes) = unlines $ map (\x -> (klass ++ scopeToDoc x)) scopes | 86 | false | true | 0 | 11 | 19 | 58 | 28 | 30 | null | null |
brendanhay/gogol | gogol-cloudsearch/gen/Network/Google/CloudSearch/Types/Product.hs | mpl-2.0 | -- | Queue to which this item belongs to. The default queue is chosen if this
-- field is not specified. The maximum length is 512 characters.
piQueue :: Lens' PushItem (Maybe Text)
piQueue = lens _piQueue (\ s a -> s{_piQueue = a}) | 232 | piQueue :: Lens' PushItem (Maybe Text)
piQueue = lens _piQueue (\ s a -> s{_piQueue = a}) | 89 | piQueue = lens _piQueue (\ s a -> s{_piQueue = a}) | 50 | true | true | 2 | 9 | 43 | 56 | 26 | 30 | null | null |
IreneKnapp/direct-opengl | Graphics/Rendering/OpenGL/GL/VertexArrays.hs | bsd-3-clause | marshalClientArrayType :: ClientArrayType -> GLenum
marshalClientArrayType x = case x of
VertexArray -> gl_VERTEX_ARRAY
NormalArray -> gl_NORMAL_ARRAY
ColorArray -> gl_COLOR_ARRAY
IndexArray -> gl_INDEX_ARRAY
TextureCoordArray -> gl_TEXTURE_COORD_ARRAY
EdgeFlagArray -> gl_EDGE_FLAG_ARRAY
FogCoordArray -> gl_FOG_COORD_ARRAY
SecondaryColorArray -> gl_SECONDARY_COLOR_ARRAY
MatrixIndexArray -> gl_MATRIX_INDEX_ARRAY
-- Hmmm... | 453 | marshalClientArrayType :: ClientArrayType -> GLenum
marshalClientArrayType x = case x of
VertexArray -> gl_VERTEX_ARRAY
NormalArray -> gl_NORMAL_ARRAY
ColorArray -> gl_COLOR_ARRAY
IndexArray -> gl_INDEX_ARRAY
TextureCoordArray -> gl_TEXTURE_COORD_ARRAY
EdgeFlagArray -> gl_EDGE_FLAG_ARRAY
FogCoordArray -> gl_FOG_COORD_ARRAY
SecondaryColorArray -> gl_SECONDARY_COLOR_ARRAY
MatrixIndexArray -> gl_MATRIX_INDEX_ARRAY
-- Hmmm... | 453 | marshalClientArrayType x = case x of
VertexArray -> gl_VERTEX_ARRAY
NormalArray -> gl_NORMAL_ARRAY
ColorArray -> gl_COLOR_ARRAY
IndexArray -> gl_INDEX_ARRAY
TextureCoordArray -> gl_TEXTURE_COORD_ARRAY
EdgeFlagArray -> gl_EDGE_FLAG_ARRAY
FogCoordArray -> gl_FOG_COORD_ARRAY
SecondaryColorArray -> gl_SECONDARY_COLOR_ARRAY
MatrixIndexArray -> gl_MATRIX_INDEX_ARRAY
-- Hmmm... | 401 | false | true | 0 | 7 | 67 | 77 | 39 | 38 | null | null |
achernyak/stack | src/Stack/Types/Config.hs | bsd-3-clause | configMonoidSetupInfoLocationsName :: Text
configMonoidSetupInfoLocationsName = "setup-info" | 92 | configMonoidSetupInfoLocationsName :: Text
configMonoidSetupInfoLocationsName = "setup-info" | 92 | configMonoidSetupInfoLocationsName = "setup-info" | 49 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
Kwarrtz/microparsec | tests/Spec.hs | mit | main :: IO ()
main = hspec $ do
describe "ParserT" $ do
describe "runParser" $ do
it "consumes input" $ property $
\ a -> case (a :: String) of
[] -> runParser anySymbol ([] :: String) == Nothing
(x:xs) -> runParser anySymbol (x:xs) == Just (x :: Char, xs :: String)
describe "return" $ do
it "consumes no input" $ property $
\ cs -> runParser (return ()) cs == Just ((),cs :: String)
it "returns the value" $ property $
\ a cs -> runParser (return a) cs == Just (a :: Char, cs :: String)
describe "parser generators" $ do
describe "character matching" $ do
describe "whitespace" $ do
it "matches a newline" $
parse space "\n" `shouldBe` Just '\n'
it "matches a space" $
parse space " " `shouldBe` Just ' '
it "matches only if is whitespace" $ property $
charProp space isSpace
it "matches many whitespace characters" $
parse spaces " \n\t\n " `shouldBe` Just " \n\t\n "
it "does not match an alphanumeric character" $
parse space "a" `shouldBe` Nothing
describe "digit" $ do
it "matches only if is digit" $ property $
charProp digit isDigit
describe "alphanum" $ do
it "matches only if is alpha" $ property $
charProp alpha isAlpha
it "matches only if is alphanum" $ property $
charProp alphaNum isAlphaNum
describe "satisfy" $ do
it "fails on 'const False'" $ property $
\ c -> parse (satisfy $ const False) [c :: Char] == Nothing
it "succeeds on 'const True'" $ property $
\ c -> parse (satisfy $ const True) [c :: Char] == Just c
where charProp p f c = let r = parse p [c]
in if f c
then r == Just c
else r == Nothing | 1,884 | main :: IO ()
main = hspec $ do
describe "ParserT" $ do
describe "runParser" $ do
it "consumes input" $ property $
\ a -> case (a :: String) of
[] -> runParser anySymbol ([] :: String) == Nothing
(x:xs) -> runParser anySymbol (x:xs) == Just (x :: Char, xs :: String)
describe "return" $ do
it "consumes no input" $ property $
\ cs -> runParser (return ()) cs == Just ((),cs :: String)
it "returns the value" $ property $
\ a cs -> runParser (return a) cs == Just (a :: Char, cs :: String)
describe "parser generators" $ do
describe "character matching" $ do
describe "whitespace" $ do
it "matches a newline" $
parse space "\n" `shouldBe` Just '\n'
it "matches a space" $
parse space " " `shouldBe` Just ' '
it "matches only if is whitespace" $ property $
charProp space isSpace
it "matches many whitespace characters" $
parse spaces " \n\t\n " `shouldBe` Just " \n\t\n "
it "does not match an alphanumeric character" $
parse space "a" `shouldBe` Nothing
describe "digit" $ do
it "matches only if is digit" $ property $
charProp digit isDigit
describe "alphanum" $ do
it "matches only if is alpha" $ property $
charProp alpha isAlpha
it "matches only if is alphanum" $ property $
charProp alphaNum isAlphaNum
describe "satisfy" $ do
it "fails on 'const False'" $ property $
\ c -> parse (satisfy $ const False) [c :: Char] == Nothing
it "succeeds on 'const True'" $ property $
\ c -> parse (satisfy $ const True) [c :: Char] == Just c
where charProp p f c = let r = parse p [c]
in if f c
then r == Just c
else r == Nothing | 1,884 | main = hspec $ do
describe "ParserT" $ do
describe "runParser" $ do
it "consumes input" $ property $
\ a -> case (a :: String) of
[] -> runParser anySymbol ([] :: String) == Nothing
(x:xs) -> runParser anySymbol (x:xs) == Just (x :: Char, xs :: String)
describe "return" $ do
it "consumes no input" $ property $
\ cs -> runParser (return ()) cs == Just ((),cs :: String)
it "returns the value" $ property $
\ a cs -> runParser (return a) cs == Just (a :: Char, cs :: String)
describe "parser generators" $ do
describe "character matching" $ do
describe "whitespace" $ do
it "matches a newline" $
parse space "\n" `shouldBe` Just '\n'
it "matches a space" $
parse space " " `shouldBe` Just ' '
it "matches only if is whitespace" $ property $
charProp space isSpace
it "matches many whitespace characters" $
parse spaces " \n\t\n " `shouldBe` Just " \n\t\n "
it "does not match an alphanumeric character" $
parse space "a" `shouldBe` Nothing
describe "digit" $ do
it "matches only if is digit" $ property $
charProp digit isDigit
describe "alphanum" $ do
it "matches only if is alpha" $ property $
charProp alpha isAlpha
it "matches only if is alphanum" $ property $
charProp alphaNum isAlphaNum
describe "satisfy" $ do
it "fails on 'const False'" $ property $
\ c -> parse (satisfy $ const False) [c :: Char] == Nothing
it "succeeds on 'const True'" $ property $
\ c -> parse (satisfy $ const True) [c :: Char] == Just c
where charProp p f c = let r = parse p [c]
in if f c
then r == Just c
else r == Nothing | 1,870 | false | true | 3 | 21 | 656 | 637 | 297 | 340 | null | null |
OS2World/DEV-UTIL-HUGS | libraries/Foreign/Marshal/Pool.hs | bsd-3-clause | -- | Deallocate a memory pool and everything which has been allocated in the
-- pool itself.
freePool :: Pool -> IO ()
freePool (Pool pool) = readIORef pool >>= freeAll
where freeAll [] = return ()
freeAll (p:ps) = free p >> freeAll ps
-- | Execute an action with a fresh memory pool, which gets automatically
-- deallocated (including its contents) after the action has finished. | 398 | freePool :: Pool -> IO ()
freePool (Pool pool) = readIORef pool >>= freeAll
where freeAll [] = return ()
freeAll (p:ps) = free p >> freeAll ps
-- | Execute an action with a fresh memory pool, which gets automatically
-- deallocated (including its contents) after the action has finished. | 304 | freePool (Pool pool) = readIORef pool >>= freeAll
where freeAll [] = return ()
freeAll (p:ps) = free p >> freeAll ps
-- | Execute an action with a fresh memory pool, which gets automatically
-- deallocated (including its contents) after the action has finished. | 278 | true | true | 0 | 9 | 85 | 89 | 42 | 47 | null | null |
pgj/bead | test/Test/Property/EntityGen.hs | bsd-3-clause | numbers = listOf1 $ elements ['0' .. '9'] | 41 | numbers = listOf1 $ elements ['0' .. '9'] | 41 | numbers = listOf1 $ elements ['0' .. '9'] | 41 | false | false | 0 | 7 | 7 | 19 | 10 | 9 | null | null |
valderman/selda | selda/src/Database/Selda/Query/Type.hs | mit | -- | Generate a unique name for the given column.
rename :: UntypedCol sql -> State GenState [SomeCol sql]
rename (Untyped col) = do
n <- freshId
return [Named (newName n) col]
where
newName ns =
case col of
Col n -> addColSuffix n $ "_" <> pack (show ns)
_ -> mkColName $ "tmp_" <> pack (show ns)
-- | Get a guaranteed unique identifier. | 379 | rename :: UntypedCol sql -> State GenState [SomeCol sql]
rename (Untyped col) = do
n <- freshId
return [Named (newName n) col]
where
newName ns =
case col of
Col n -> addColSuffix n $ "_" <> pack (show ns)
_ -> mkColName $ "tmp_" <> pack (show ns)
-- | Get a guaranteed unique identifier. | 329 | rename (Untyped col) = do
n <- freshId
return [Named (newName n) col]
where
newName ns =
case col of
Col n -> addColSuffix n $ "_" <> pack (show ns)
_ -> mkColName $ "tmp_" <> pack (show ns)
-- | Get a guaranteed unique identifier. | 272 | true | true | 0 | 11 | 106 | 134 | 63 | 71 | null | null |
Proclivis/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxPAPER_JAPANESE_POSTCARD :: Int
wxPAPER_JAPANESE_POSTCARD = 43 | 63 | wxPAPER_JAPANESE_POSTCARD :: Int
wxPAPER_JAPANESE_POSTCARD = 43 | 63 | wxPAPER_JAPANESE_POSTCARD = 43 | 30 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
wfleming/advent-of-code-2016 | 2016/src/D17Lib.hs | bsd-3-clause | move :: Vault -> Direction -> Vault
move v@Vault { pos = (x, y) } d
| canMove v d = Vault
{ pos = apply d
, height = height v
, width = width v
, seed = seed v
, path = path v ++ show d }
| otherwise = error "can't move in that direction"
where
apply U = (x, y - 1)
apply D = (x, y + 1)
apply L = (x - 1, y)
apply R = (x + 1, y)
{- find the *maximum* path that works for a goal. Unlike `PS.minPath`, this is
- designed specifically for `Vault` (which tracks history internally),
- so this doesn't bother with `Path` to track history for the return val -} | 623 | move :: Vault -> Direction -> Vault
move v@Vault { pos = (x, y) } d
| canMove v d = Vault
{ pos = apply d
, height = height v
, width = width v
, seed = seed v
, path = path v ++ show d }
| otherwise = error "can't move in that direction"
where
apply U = (x, y - 1)
apply D = (x, y + 1)
apply L = (x - 1, y)
apply R = (x + 1, y)
{- find the *maximum* path that works for a goal. Unlike `PS.minPath`, this is
- designed specifically for `Vault` (which tracks history internally),
- so this doesn't bother with `Path` to track history for the return val -} | 623 | move v@Vault { pos = (x, y) } d
| canMove v d = Vault
{ pos = apply d
, height = height v
, width = width v
, seed = seed v
, path = path v ++ show d }
| otherwise = error "can't move in that direction"
where
apply U = (x, y - 1)
apply D = (x, y + 1)
apply L = (x - 1, y)
apply R = (x + 1, y)
{- find the *maximum* path that works for a goal. Unlike `PS.minPath`, this is
- designed specifically for `Vault` (which tracks history internally),
- so this doesn't bother with `Path` to track history for the return val -} | 587 | false | true | 3 | 10 | 195 | 195 | 103 | 92 | null | null |
aslatter/parsec2 | Text/ParserCombinators/Parsec/Char.hs | bsd-2-clause | -- | Parses a newline character (\'\\n\'). Returns a newline character.
newline :: CharParser st Char
newline = char '\n' <?> "new-line" | 160 | newline :: CharParser st Char
newline = char '\n' <?> "new-line" | 88 | newline = char '\n' <?> "new-line" | 58 | true | true | 1 | 6 | 45 | 28 | 12 | 16 | null | null |
GaloisInc/halvm-ghc | compiler/typecheck/TcType.hs | bsd-3-clause | pprUserTypeCtxt SpecInstCtxt = text "a SPECIALISE instance pragma" | 71 | pprUserTypeCtxt SpecInstCtxt = text "a SPECIALISE instance pragma" | 71 | pprUserTypeCtxt SpecInstCtxt = text "a SPECIALISE instance pragma" | 71 | false | false | 0 | 5 | 12 | 12 | 5 | 7 | null | null |
GaloisInc/haskell-tor | src/Tor/Circuit.hs | bsd-3-clause | completeTAPHandshake :: PrivateNumber -> ByteString ->
Either String (CryptoData, CryptoData)
completeTAPHandshake x rbstr
| kh == kh' = Right (f, b)
| otherwise = Left "Key agreement failure."
where
(gyBS, kh) = S.splitAt 128 rbstr
gy = PublicNumber (os2ip gyBS)
(kh', f, b) = computeTAPValues x gy | 347 | completeTAPHandshake :: PrivateNumber -> ByteString ->
Either String (CryptoData, CryptoData)
completeTAPHandshake x rbstr
| kh == kh' = Right (f, b)
| otherwise = Left "Key agreement failure."
where
(gyBS, kh) = S.splitAt 128 rbstr
gy = PublicNumber (os2ip gyBS)
(kh', f, b) = computeTAPValues x gy | 347 | completeTAPHandshake x rbstr
| kh == kh' = Right (f, b)
| otherwise = Left "Key agreement failure."
where
(gyBS, kh) = S.splitAt 128 rbstr
gy = PublicNumber (os2ip gyBS)
(kh', f, b) = computeTAPValues x gy | 229 | false | true | 1 | 8 | 94 | 129 | 62 | 67 | null | null |
gspia/reflex-dom-htmlea | lib/src/Reflex/Dom/HTML5/Elements/Elements.hs | bsd-3-clause | -- | A short-hand notion for @ el \"figcaption\" ... @
figCaptionN ∷ forall t m a. DomBuilder t m ⇒ m a → m a
figCaptionN children = snd <$> figCaptionN' children | 162 | figCaptionN ∷ forall t m a. DomBuilder t m ⇒ m a → m a
figCaptionN children = snd <$> figCaptionN' children | 107 | figCaptionN children = snd <$> figCaptionN' children | 52 | true | true | 0 | 8 | 32 | 51 | 25 | 26 | null | null |
AlexLusitania/ProjectEuler | 040-champernowne-constant/Main.hs | unlicense | irrationalNumber :: String
irrationalNumber = concatMap show [1..] | 66 | irrationalNumber :: String
irrationalNumber = concatMap show [1..] | 66 | irrationalNumber = concatMap show [1..] | 39 | false | true | 0 | 6 | 7 | 25 | 11 | 14 | null | null |
TomMD/CV | CV/Projection.hs | bsd-3-clause | computeEpilines :: Matrix (Float,Float) -- ^ The set of points
-> Int -- ^ Which camera (either 1 or 2)
-> Matrix Float -- ^ Fundamental matrix
-> Matrix (Float,Float,Float) -- ^ Output epilines
computeEpilines points cam fund = unsafePerformIO $ do
res <- CV.Matrix.create (n,1)
withMatPtr points $ \c_points ->
withMatPtr fund $ \c_fund ->
withMatPtr res $ \c_res ->
c'cvComputeCorrespondEpilines c_points (fromIntegral cam) c_fund c_res
return res
where n = case getSize points of
(1,n') -> n'
(n',1) -> n'
_ -> error "points should be 1 x N or N x 1 matrix" | 735 | computeEpilines :: Matrix (Float,Float) -- ^ The set of points
-> Int -- ^ Which camera (either 1 or 2)
-> Matrix Float -- ^ Fundamental matrix
-> Matrix (Float,Float,Float)
computeEpilines points cam fund = unsafePerformIO $ do
res <- CV.Matrix.create (n,1)
withMatPtr points $ \c_points ->
withMatPtr fund $ \c_fund ->
withMatPtr res $ \c_res ->
c'cvComputeCorrespondEpilines c_points (fromIntegral cam) c_fund c_res
return res
where n = case getSize points of
(1,n') -> n'
(n',1) -> n'
_ -> error "points should be 1 x N or N x 1 matrix" | 709 | computeEpilines points cam fund = unsafePerformIO $ do
res <- CV.Matrix.create (n,1)
withMatPtr points $ \c_points ->
withMatPtr fund $ \c_fund ->
withMatPtr res $ \c_res ->
c'cvComputeCorrespondEpilines c_points (fromIntegral cam) c_fund c_res
return res
where n = case getSize points of
(1,n') -> n'
(n',1) -> n'
_ -> error "points should be 1 x N or N x 1 matrix" | 459 | true | true | 1 | 16 | 269 | 196 | 98 | 98 | null | null |
dysinger/amazonka | amazonka-elastictranscoder/gen/Network/AWS/ElasticTranscoder/Types.hs | mpl-2.0 | -- | 'JobAlbumArt' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'jaaArtwork' @::@ ['Artwork']
--
-- * 'jaaMergePolicy' @::@ 'Maybe' 'Text'
--
jobAlbumArt :: JobAlbumArt
jobAlbumArt = JobAlbumArt
{ _jaaMergePolicy = Nothing
, _jaaArtwork = mempty
} | 301 | jobAlbumArt :: JobAlbumArt
jobAlbumArt = JobAlbumArt
{ _jaaMergePolicy = Nothing
, _jaaArtwork = mempty
} | 121 | jobAlbumArt = JobAlbumArt
{ _jaaMergePolicy = Nothing
, _jaaArtwork = mempty
} | 94 | true | true | 0 | 7 | 57 | 37 | 24 | 13 | null | null |
MarcusVoelker/Recolang | CodeModel/Function.hs | mit | showStatement _ (Call s1 s2) = show s1 ++ " " ++ show s2 | 56 | showStatement _ (Call s1 s2) = show s1 ++ " " ++ show s2 | 56 | showStatement _ (Call s1 s2) = show s1 ++ " " ++ show s2 | 56 | false | false | 1 | 7 | 13 | 35 | 15 | 20 | null | null |
siddhanathan/ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickHsExpr (NegApp e neg) =
liftM2 NegApp
(addTickLHsExpr e)
(addTickSyntaxExpr hpcSrcSpan neg) | 138 | addTickHsExpr (NegApp e neg) =
liftM2 NegApp
(addTickLHsExpr e)
(addTickSyntaxExpr hpcSrcSpan neg) | 138 | addTickHsExpr (NegApp e neg) =
liftM2 NegApp
(addTickLHsExpr e)
(addTickSyntaxExpr hpcSrcSpan neg) | 138 | false | false | 0 | 7 | 51 | 38 | 18 | 20 | null | null |
cmahon/interactive-brokers | library/API/IB/Monadic.hs | bsd-3-clause | requestIds :: Int -> IB Bool
requestIds = send . IBRequest . RequestIds | 71 | requestIds :: Int -> IB Bool
requestIds = send . IBRequest . RequestIds | 71 | requestIds = send . IBRequest . RequestIds | 42 | false | true | 0 | 6 | 12 | 26 | 13 | 13 | null | null |
iljakuklic/eel-proto | src/Sema/Term.hs | bsd-3-clause | getMeta (TSumA m _) = m | 26 | getMeta (TSumA m _) = m | 26 | getMeta (TSumA m _) = m | 26 | false | false | 0 | 7 | 8 | 17 | 8 | 9 | null | null |
jrraymond/ray-tracer | src/SceneParser.hs | gpl-3.0 | {- This function convertes a shape with expression values to a shape at
- time t, where time t is passed as the first argument -}
evalObjectExpr :: Float -> ObjectExpr -> Object
evalObjectExpr t (SphereE c r mat) = Sphere (evalExprTuple t c) (evalExpr t r) mat | 260 | evalObjectExpr :: Float -> ObjectExpr -> Object
evalObjectExpr t (SphereE c r mat) = Sphere (evalExprTuple t c) (evalExpr t r) mat | 130 | evalObjectExpr t (SphereE c r mat) = Sphere (evalExprTuple t c) (evalExpr t r) mat | 82 | true | true | 0 | 10 | 47 | 63 | 30 | 33 | null | null |
alphalambda/k12math | lib/Drawing.hs | mit | a & b = Pictures [a,b] | 32 | a & b = Pictures [a,b] | 32 | a & b = Pictures [a,b] | 32 | false | false | 2 | 6 | 15 | 20 | 10 | 10 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Ruby.hs | gpl-2.0 | parseRules ("Ruby","Quoted String") =
(((pString False "\\\\" >>= withAttribute StringTok))
<|>
((pRegExpr regex_'5c'5c'5c'22 >>= withAttribute StringTok))
<|>
((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst"))
<|>
((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))
<|>
((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop"))
<|>
(currentContext >>= \x -> guard (x == ("Ruby","Quoted String")) >> pDefault >>= withAttribute StringTok)) | 601 | parseRules ("Ruby","Quoted String") =
(((pString False "\\\\" >>= withAttribute StringTok))
<|>
((pRegExpr regex_'5c'5c'5c'22 >>= withAttribute StringTok))
<|>
((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst"))
<|>
((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))
<|>
((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop"))
<|>
(currentContext >>= \x -> guard (x == ("Ruby","Quoted String")) >> pDefault >>= withAttribute StringTok)) | 601 | parseRules ("Ruby","Quoted String") =
(((pString False "\\\\" >>= withAttribute StringTok))
<|>
((pRegExpr regex_'5c'5c'5c'22 >>= withAttribute StringTok))
<|>
((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst"))
<|>
((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))
<|>
((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop"))
<|>
(currentContext >>= \x -> guard (x == ("Ruby","Quoted String")) >> pDefault >>= withAttribute StringTok)) | 601 | false | false | 0 | 15 | 93 | 204 | 106 | 98 | null | null |
stefan-hoeck/labeled-graph | Data/Graph/Simple/Graph.hs | bsd-3-clause | -- | True if the graph is complete (every vertex is adjacent
-- to every other vertex).
isComplete ∷ Graph → Bool
isComplete g = let o = order g
in size g == (o * (o-1)) `div` 2 | 195 | isComplete ∷ Graph → Bool
isComplete g = let o = order g
in size g == (o * (o-1)) `div` 2 | 105 | isComplete g = let o = order g
in size g == (o * (o-1)) `div` 2 | 79 | true | true | 0 | 12 | 56 | 67 | 33 | 34 | null | null |
abstools/abs-haskell-formal | benchmarks/3_primality_test_parallel/progs/3500.hs | bsd-3-clause | main :: IO ()
main = printHeap =<< run 1000000 main_ (head the_end) | 67 | main :: IO ()
main = printHeap =<< run 1000000 main_ (head the_end) | 67 | main = printHeap =<< run 1000000 main_ (head the_end) | 53 | false | true | 1 | 8 | 12 | 36 | 16 | 20 | null | null |
Paow/encore | src/parser/Parser/Parser.hs | bsd-3-clause | validIdentifierChar :: EncParser Char
validIdentifierChar = alphaNumChar <|> char '_' <|> char '\'' | 99 | validIdentifierChar :: EncParser Char
validIdentifierChar = alphaNumChar <|> char '_' <|> char '\'' | 99 | validIdentifierChar = alphaNumChar <|> char '_' <|> char '\'' | 61 | false | true | 0 | 7 | 12 | 28 | 13 | 15 | null | null |
acowley/ghc | compiler/utils/Pretty.hs | bsd-3-clause | -- | Above, with no overlapping.
-- '$+$' is associative, with identity 'empty'.
($+$) :: Doc -> Doc -> Doc
p $+$ q = above_ p True q | 133 | ($+$) :: Doc -> Doc -> Doc
p $+$ q = above_ p True q | 52 | p $+$ q = above_ p True q | 25 | true | true | 0 | 9 | 27 | 40 | 20 | 20 | null | null |
rfranek/duckling | Duckling/Numeral/PL/Rules.hs | bsd-3-clause | ruleOne :: Rule
ruleOne = Rule
{ name = "one"
, pattern =
[ regex "jed(en|nego|nemu|nym|nej|n(a|\x0105))"
]
, prod = \_ -> integer 1
} | 150 | ruleOne :: Rule
ruleOne = Rule
{ name = "one"
, pattern =
[ regex "jed(en|nego|nemu|nym|nej|n(a|\x0105))"
]
, prod = \_ -> integer 1
} | 150 | ruleOne = Rule
{ name = "one"
, pattern =
[ regex "jed(en|nego|nemu|nym|nej|n(a|\x0105))"
]
, prod = \_ -> integer 1
} | 134 | false | true | 0 | 9 | 40 | 49 | 27 | 22 | null | null |
geocurnoff/nikki | src/Sorts/Nikki/State.hs | lgpl-3.0 | -- provided for clarity (and efficiency?)
jumpCollision collisions =
(
filter (not . isDownward) >>>
sortLegsCollisions >>>
filter (isGhostCollision ~.> isHorizontalCollision) >>>
sortByAngle >>>
newSpreadCollisions >>>
addEmergencyJumpCollision >>>
filter causingJumps >>>
listToMaybe
) collisions -- not best point-free-style, because addEmergencyJumpCollision needs the
-- original list of collisions.
where
-- | remove angles pointing downward
isDownward c = abs (nikkiCollisionAngle c) > (pi / 2 + deg2rad 3.5)
-- | sorting collisions: legs, ghost, head
sortLegsCollisions = sortBy (compare `on` (nikkiCollisionType >>> toNumber))
toNumber NikkiLegsCT = 1
toNumber NikkiGhostCT = 2
toNumber NikkiHeadCT = 3
isGhostCollision c = NikkiGhostCT == nikkiCollisionType c
isHorizontalCollision c = abs (nikkiCollisionAngle c) =~= (tau / 4)
where
a =~= b = abs (a - b) < eps
eps = deg2rad 3.5
-- | sort (more upward first)
sortByAngle =
sortBy (compare `on` (abs . nikkiCollisionAngle))
-- | If there are collisions with angles with different signs,
-- we want a new artificial collision with angle 0.
-- This does not (in no case) consider ghost collisions.
newSpreadCollisions collisions =
if any ((< 0) . nikkiCollisionAngle) collisions &&
any ((> 0) . nikkiCollisionAngle) collisions
then (head collisions){nikkiCollisionAngle = 0} : collisions
-- Adds the artificial collision.
-- Just takes the first collision. The second would probably not be worse, but we have to pick one.
else collisions
-- | adds a collision in the case that nikki's best collision is a
-- leg collision that doesn't count as a standing feet collision
-- AND something else touches nikki's head from above.
-- This is to prevent Nikki from getting stuck under e.g. boxes
addEmergencyJumpCollision :: [NikkiCollision] -> [NikkiCollision]
addEmergencyJumpCollision l@(a : _) =
if isLegsCollision a &&
(not $ isStandingFeetAngle $ nikkiCollisionAngle a) &&
(not $ null downwardHeadCollisions)
then emergencyJumpCollision : l
else l
where
originalCollisions = collisions
downwardHeadCollisions = filter isHeadCollision $ filter isDownward originalCollisions
-- (will only be used if (not $ null downwardHeadCollisions)
firstDownwardHeadCollision = head downwardHeadCollisions
emergencyJumpCollision =
a{nikkiCollisionAngle = newAngle}
newAngle = mirrorAtHorizon $ nikkiCollisionAngle firstDownwardHeadCollision
mirrorAtHorizon =
subtract (pi / 2) >>>
negate >>>
(+ pi / 2)
addEmergencyJumpCollision [] = []
-- | if a single collision would cause a jump.
-- Does (of course) not consider spread collisions.
causingJumps x =
(not $ isHeadCollision x) ~>
(isStandingFeetAngle $ nikkiCollisionAngle x)
-- | putting the head in a Just
listToMaybe [] = Strict.Nothing
listToMaybe (a : _) = Strict.Just a
-- updates the start time of nikki if applicable | 3,264 | jumpCollision collisions =
(
filter (not . isDownward) >>>
sortLegsCollisions >>>
filter (isGhostCollision ~.> isHorizontalCollision) >>>
sortByAngle >>>
newSpreadCollisions >>>
addEmergencyJumpCollision >>>
filter causingJumps >>>
listToMaybe
) collisions -- not best point-free-style, because addEmergencyJumpCollision needs the
-- original list of collisions.
where
-- | remove angles pointing downward
isDownward c = abs (nikkiCollisionAngle c) > (pi / 2 + deg2rad 3.5)
-- | sorting collisions: legs, ghost, head
sortLegsCollisions = sortBy (compare `on` (nikkiCollisionType >>> toNumber))
toNumber NikkiLegsCT = 1
toNumber NikkiGhostCT = 2
toNumber NikkiHeadCT = 3
isGhostCollision c = NikkiGhostCT == nikkiCollisionType c
isHorizontalCollision c = abs (nikkiCollisionAngle c) =~= (tau / 4)
where
a =~= b = abs (a - b) < eps
eps = deg2rad 3.5
-- | sort (more upward first)
sortByAngle =
sortBy (compare `on` (abs . nikkiCollisionAngle))
-- | If there are collisions with angles with different signs,
-- we want a new artificial collision with angle 0.
-- This does not (in no case) consider ghost collisions.
newSpreadCollisions collisions =
if any ((< 0) . nikkiCollisionAngle) collisions &&
any ((> 0) . nikkiCollisionAngle) collisions
then (head collisions){nikkiCollisionAngle = 0} : collisions
-- Adds the artificial collision.
-- Just takes the first collision. The second would probably not be worse, but we have to pick one.
else collisions
-- | adds a collision in the case that nikki's best collision is a
-- leg collision that doesn't count as a standing feet collision
-- AND something else touches nikki's head from above.
-- This is to prevent Nikki from getting stuck under e.g. boxes
addEmergencyJumpCollision :: [NikkiCollision] -> [NikkiCollision]
addEmergencyJumpCollision l@(a : _) =
if isLegsCollision a &&
(not $ isStandingFeetAngle $ nikkiCollisionAngle a) &&
(not $ null downwardHeadCollisions)
then emergencyJumpCollision : l
else l
where
originalCollisions = collisions
downwardHeadCollisions = filter isHeadCollision $ filter isDownward originalCollisions
-- (will only be used if (not $ null downwardHeadCollisions)
firstDownwardHeadCollision = head downwardHeadCollisions
emergencyJumpCollision =
a{nikkiCollisionAngle = newAngle}
newAngle = mirrorAtHorizon $ nikkiCollisionAngle firstDownwardHeadCollision
mirrorAtHorizon =
subtract (pi / 2) >>>
negate >>>
(+ pi / 2)
addEmergencyJumpCollision [] = []
-- | if a single collision would cause a jump.
-- Does (of course) not consider spread collisions.
causingJumps x =
(not $ isHeadCollision x) ~>
(isStandingFeetAngle $ nikkiCollisionAngle x)
-- | putting the head in a Just
listToMaybe [] = Strict.Nothing
listToMaybe (a : _) = Strict.Just a
-- updates the start time of nikki if applicable | 3,222 | jumpCollision collisions =
(
filter (not . isDownward) >>>
sortLegsCollisions >>>
filter (isGhostCollision ~.> isHorizontalCollision) >>>
sortByAngle >>>
newSpreadCollisions >>>
addEmergencyJumpCollision >>>
filter causingJumps >>>
listToMaybe
) collisions -- not best point-free-style, because addEmergencyJumpCollision needs the
-- original list of collisions.
where
-- | remove angles pointing downward
isDownward c = abs (nikkiCollisionAngle c) > (pi / 2 + deg2rad 3.5)
-- | sorting collisions: legs, ghost, head
sortLegsCollisions = sortBy (compare `on` (nikkiCollisionType >>> toNumber))
toNumber NikkiLegsCT = 1
toNumber NikkiGhostCT = 2
toNumber NikkiHeadCT = 3
isGhostCollision c = NikkiGhostCT == nikkiCollisionType c
isHorizontalCollision c = abs (nikkiCollisionAngle c) =~= (tau / 4)
where
a =~= b = abs (a - b) < eps
eps = deg2rad 3.5
-- | sort (more upward first)
sortByAngle =
sortBy (compare `on` (abs . nikkiCollisionAngle))
-- | If there are collisions with angles with different signs,
-- we want a new artificial collision with angle 0.
-- This does not (in no case) consider ghost collisions.
newSpreadCollisions collisions =
if any ((< 0) . nikkiCollisionAngle) collisions &&
any ((> 0) . nikkiCollisionAngle) collisions
then (head collisions){nikkiCollisionAngle = 0} : collisions
-- Adds the artificial collision.
-- Just takes the first collision. The second would probably not be worse, but we have to pick one.
else collisions
-- | adds a collision in the case that nikki's best collision is a
-- leg collision that doesn't count as a standing feet collision
-- AND something else touches nikki's head from above.
-- This is to prevent Nikki from getting stuck under e.g. boxes
addEmergencyJumpCollision :: [NikkiCollision] -> [NikkiCollision]
addEmergencyJumpCollision l@(a : _) =
if isLegsCollision a &&
(not $ isStandingFeetAngle $ nikkiCollisionAngle a) &&
(not $ null downwardHeadCollisions)
then emergencyJumpCollision : l
else l
where
originalCollisions = collisions
downwardHeadCollisions = filter isHeadCollision $ filter isDownward originalCollisions
-- (will only be used if (not $ null downwardHeadCollisions)
firstDownwardHeadCollision = head downwardHeadCollisions
emergencyJumpCollision =
a{nikkiCollisionAngle = newAngle}
newAngle = mirrorAtHorizon $ nikkiCollisionAngle firstDownwardHeadCollision
mirrorAtHorizon =
subtract (pi / 2) >>>
negate >>>
(+ pi / 2)
addEmergencyJumpCollision [] = []
-- | if a single collision would cause a jump.
-- Does (of course) not consider spread collisions.
causingJumps x =
(not $ isHeadCollision x) ~>
(isStandingFeetAngle $ nikkiCollisionAngle x)
-- | putting the head in a Just
listToMaybe [] = Strict.Nothing
listToMaybe (a : _) = Strict.Just a
-- updates the start time of nikki if applicable | 3,222 | true | false | 0 | 15 | 855 | 588 | 315 | 273 | null | null |
glguy/hm | src/HM/Example.hs | mit | termType Equal =
let a = MonoVar "a"
in Poly ["a"] (a --> a --> logicType) | 78 | termType Equal =
let a = MonoVar "a"
in Poly ["a"] (a --> a --> logicType) | 78 | termType Equal =
let a = MonoVar "a"
in Poly ["a"] (a --> a --> logicType) | 78 | false | false | 0 | 10 | 19 | 42 | 20 | 22 | null | null |
jystic/river | test/test.hs | bsd-3-clause | main :: IO ()
main = do
hSetBuffering stdout LineBuffering
hSetBuffering stderr LineBuffering
results <- sequence tests
unless (and results) exitFailure | 160 | main :: IO ()
main = do
hSetBuffering stdout LineBuffering
hSetBuffering stderr LineBuffering
results <- sequence tests
unless (and results) exitFailure | 160 | main = do
hSetBuffering stdout LineBuffering
hSetBuffering stderr LineBuffering
results <- sequence tests
unless (and results) exitFailure | 146 | false | true | 0 | 9 | 28 | 56 | 24 | 32 | null | null |
OpenXT/manager | updatemgr/UpdateMgr/Logic.hs | gpl-2.0 | haveMeta :: Update Bool
haveMeta = and <$> mapM fileExists [xcRepoMetaPath, xcPackagesMetaPath, xcSignatureMetaPath] | 116 | haveMeta :: Update Bool
haveMeta = and <$> mapM fileExists [xcRepoMetaPath, xcPackagesMetaPath, xcSignatureMetaPath] | 116 | haveMeta = and <$> mapM fileExists [xcRepoMetaPath, xcPackagesMetaPath, xcSignatureMetaPath] | 92 | false | true | 0 | 7 | 12 | 32 | 17 | 15 | null | null |
yuncliu/Learn | haskell/person.hs | bsd-3-clause | main = do
let a = Person "abc" "def" 26
let b = Person "abc" "def" 25
print(a == a)
print(a)
print(b)
print(a > b) | 138 | main = do
let a = Person "abc" "def" 26
let b = Person "abc" "def" 25
print(a == a)
print(a)
print(b)
print(a > b) | 138 | main = do
let a = Person "abc" "def" 26
let b = Person "abc" "def" 25
print(a == a)
print(a)
print(b)
print(a > b) | 138 | false | false | 0 | 10 | 48 | 82 | 37 | 45 | null | null |
noteed/python-pickle | Language/Python/Pickle.hs | bsd-3-clause | executeOne MARK stack memo = return (MarkObject:stack, memo) | 60 | executeOne MARK stack memo = return (MarkObject:stack, memo) | 60 | executeOne MARK stack memo = return (MarkObject:stack, memo) | 60 | false | false | 0 | 7 | 7 | 26 | 13 | 13 | null | null |
pauldoo/scratch | RealWorldHaskell/ch12/Barcode.hs | isc | runLength :: Eq a => [a] -> RunLength a
runLength = map rle . group
where rle xs = (length xs, head xs) | 107 | runLength :: Eq a => [a] -> RunLength a
runLength = map rle . group
where rle xs = (length xs, head xs) | 107 | runLength = map rle . group
where rle xs = (length xs, head xs) | 67 | false | true | 0 | 7 | 26 | 57 | 28 | 29 | null | null |
juhp/stack | src/Stack/Dot.hs | bsd-3-clause | treeNodePrefix :: Text -> [Int] -> Bool -> Int -> Text
treeNodePrefix t [] _ _ = t | 87 | treeNodePrefix :: Text -> [Int] -> Bool -> Int -> Text
treeNodePrefix t [] _ _ = t | 87 | treeNodePrefix t [] _ _ = t | 32 | false | true | 0 | 8 | 22 | 41 | 21 | 20 | null | null |
vlastachu/haskell-ccg | app/Main.hs | bsd-3-clause | getRow (Cell val _ chart _) = val : (getRow chart) | 55 | getRow (Cell val _ chart _) = val : (getRow chart) | 55 | getRow (Cell val _ chart _) = val : (getRow chart) | 55 | false | false | 0 | 7 | 15 | 31 | 15 | 16 | null | null |
azapps/hspell | src/SpellChecker/CheckFile.hs | gpl-3.0 | checkSilentIO :: String -> Trie Char -> IO String
checkSilentIO str trie = return $ checkSilent str trie | 104 | checkSilentIO :: String -> Trie Char -> IO String
checkSilentIO str trie = return $ checkSilent str trie | 104 | checkSilentIO str trie = return $ checkSilent str trie | 54 | false | true | 0 | 7 | 17 | 39 | 18 | 21 | null | null |
bergmark/transliterate | src/Translit/Hangeul.hs | bsd-3-clause | _ <*> _ = Nothing | 31 | _ <*> _ = Nothing | 31 | _ <*> _ = Nothing | 31 | false | false | 0 | 5 | 18 | 12 | 5 | 7 | null | null |
mightymoose/liquidhaskell | benchmarks/vector-0.10.0.1/Data/Vector/Fusion/Stream/Monadic.nocpp.hs | bsd-3-clause | enumFromTo_int x y = x `seq` y `seq` Stream step x (Exact (len x y))
where
{-# INLINE [0] len #-}
len x y | x > y = 0
| otherwise = ((Ck.check "Data/Vector/Fusion/Stream/Monadic.hs" 1289) Ck.Bounds) "enumFromTo" "vector too large"
(n > 0)
$ fromIntegral n
where
n = y-x+1
{-# INLINE [0] step #-}
step x | x <= y = return $ Yield x (x+1)
| otherwise = return $ Done
| 479 | enumFromTo_int x y = x `seq` y `seq` Stream step x (Exact (len x y))
where
{-# INLINE [0] len #-}
len x y | x > y = 0
| otherwise = ((Ck.check "Data/Vector/Fusion/Stream/Monadic.hs" 1289) Ck.Bounds) "enumFromTo" "vector too large"
(n > 0)
$ fromIntegral n
where
n = y-x+1
{-# INLINE [0] step #-}
step x | x <= y = return $ Yield x (x+1)
| otherwise = return $ Done
| 479 | enumFromTo_int x y = x `seq` y `seq` Stream step x (Exact (len x y))
where
{-# INLINE [0] len #-}
len x y | x > y = 0
| otherwise = ((Ck.check "Data/Vector/Fusion/Stream/Monadic.hs" 1289) Ck.Bounds) "enumFromTo" "vector too large"
(n > 0)
$ fromIntegral n
where
n = y-x+1
{-# INLINE [0] step #-}
step x | x <= y = return $ Yield x (x+1)
| otherwise = return $ Done
| 479 | false | false | 5 | 11 | 188 | 200 | 93 | 107 | null | null |
chrisjpn/CPIB_ILMCompiler | src/VM/VirtualMachineIO.hs | bsd-3-clause | execInstr (DivEuclid Int64VmTy loc) (pc, fp, Int64VmVal y : Int64VmVal x : stack) =
case x `divEexcla` y of
Left DivisionByZero ->
return (Left (ErrorMsg ([loc], "divE: division by zero")))
Left Overflow ->
return (Left (ErrorMsg ([loc], "divE: overflow of 64 bit")))
Right result -> return2 (pc + 1, fp, Int64VmVal result : stack) | 357 | execInstr (DivEuclid Int64VmTy loc) (pc, fp, Int64VmVal y : Int64VmVal x : stack) =
case x `divEexcla` y of
Left DivisionByZero ->
return (Left (ErrorMsg ([loc], "divE: division by zero")))
Left Overflow ->
return (Left (ErrorMsg ([loc], "divE: overflow of 64 bit")))
Right result -> return2 (pc + 1, fp, Int64VmVal result : stack) | 357 | execInstr (DivEuclid Int64VmTy loc) (pc, fp, Int64VmVal y : Int64VmVal x : stack) =
case x `divEexcla` y of
Left DivisionByZero ->
return (Left (ErrorMsg ([loc], "divE: division by zero")))
Left Overflow ->
return (Left (ErrorMsg ([loc], "divE: overflow of 64 bit")))
Right result -> return2 (pc + 1, fp, Int64VmVal result : stack) | 357 | false | false | 0 | 14 | 79 | 150 | 77 | 73 | null | null |
wfaler/ghpass | src/Main.hs | mit | saveFile :: ToJSON a => Bool -> a -> String -> Passphrase -> IO T.Text
saveFile overwrite obj file pass = do
fileExists <- DIR.doesFileExist file
if (fileExists && (overwrite == False))
then
do
putStrLn "Duplicate file, exiting!"
exitFailure
else
encrypt (toTxt $ obj) (T.pack file) pass
{-
0: notes
1: password
2: title
3: type
4: url
5: username
-} | 384 | saveFile :: ToJSON a => Bool -> a -> String -> Passphrase -> IO T.Text
saveFile overwrite obj file pass = do
fileExists <- DIR.doesFileExist file
if (fileExists && (overwrite == False))
then
do
putStrLn "Duplicate file, exiting!"
exitFailure
else
encrypt (toTxt $ obj) (T.pack file) pass
{-
0: notes
1: password
2: title
3: type
4: url
5: username
-} | 384 | saveFile overwrite obj file pass = do
fileExists <- DIR.doesFileExist file
if (fileExists && (overwrite == False))
then
do
putStrLn "Duplicate file, exiting!"
exitFailure
else
encrypt (toTxt $ obj) (T.pack file) pass
{-
0: notes
1: password
2: title
3: type
4: url
5: username
-} | 313 | false | true | 0 | 11 | 94 | 118 | 57 | 61 | null | null |
mohsen3/haskell-tutorials | src/job-scheduling/src/Scheduler.hs | mit | worstCoresFit = genericSingleFieldScheduler cores maximumBy | 59 | worstCoresFit = genericSingleFieldScheduler cores maximumBy | 59 | worstCoresFit = genericSingleFieldScheduler cores maximumBy | 59 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
finlay/octohat | src/Network/Octohat/Internal.hs | mit | viewResponse :: Response a -> Int
viewResponse = view (responseStatus . statusCode) | 83 | viewResponse :: Response a -> Int
viewResponse = view (responseStatus . statusCode) | 83 | viewResponse = view (responseStatus . statusCode) | 49 | false | true | 0 | 7 | 11 | 28 | 14 | 14 | null | null |
flipstone/orville | orville-postgresql/test/ErrorsTest.hs | mit | badVirusTable :: O.TableDefinition BadVirus BadVirus VirusId
badVirusTable =
O.mkTableDefinition $
O.TableParams
{ O.tblName = "virus"
, O.tblPrimaryKey = O.primaryKey virusIdField
, O.tblMapper =
BadVirus
<$> O.attrField badVirusId virusIdField
<*> O.attrField badVirusName badVirusNameField
, O.tblGetKey = badVirusId
, O.tblSafeToDelete = []
, O.tblComments = O.noComments
} | 433 | badVirusTable :: O.TableDefinition BadVirus BadVirus VirusId
badVirusTable =
O.mkTableDefinition $
O.TableParams
{ O.tblName = "virus"
, O.tblPrimaryKey = O.primaryKey virusIdField
, O.tblMapper =
BadVirus
<$> O.attrField badVirusId virusIdField
<*> O.attrField badVirusName badVirusNameField
, O.tblGetKey = badVirusId
, O.tblSafeToDelete = []
, O.tblComments = O.noComments
} | 433 | badVirusTable =
O.mkTableDefinition $
O.TableParams
{ O.tblName = "virus"
, O.tblPrimaryKey = O.primaryKey virusIdField
, O.tblMapper =
BadVirus
<$> O.attrField badVirusId virusIdField
<*> O.attrField badVirusName badVirusNameField
, O.tblGetKey = badVirusId
, O.tblSafeToDelete = []
, O.tblComments = O.noComments
} | 372 | false | true | 0 | 11 | 100 | 113 | 60 | 53 | null | null |
dzhus/dsmc | src/DSMC/Traceables.hs | bsd-3-clause | -- | If the particle has hit the body during last time step, calculate
-- the first corresponding 'HitPoint'. Note that the time at which the hit
-- occured will be negative. This is the primary function to calculate
-- ray-body intersections.
hitPoint :: Time -> Body -> Particle -> Maybe HitPoint
hitPoint !dt !b !p =
let
lastHit = [(HitPoint (-dt) Nothing) :!: (HitPoint 0 Nothing)]
in
case (intersectTraces lastHit $ trace b p) of
[] -> Nothing
(hs:_) -> Just $ fst hs
| 511 | hitPoint :: Time -> Body -> Particle -> Maybe HitPoint
hitPoint !dt !b !p =
let
lastHit = [(HitPoint (-dt) Nothing) :!: (HitPoint 0 Nothing)]
in
case (intersectTraces lastHit $ trace b p) of
[] -> Nothing
(hs:_) -> Just $ fst hs
| 267 | hitPoint !dt !b !p =
let
lastHit = [(HitPoint (-dt) Nothing) :!: (HitPoint 0 Nothing)]
in
case (intersectTraces lastHit $ trace b p) of
[] -> Nothing
(hs:_) -> Just $ fst hs
| 212 | true | true | 0 | 14 | 123 | 133 | 67 | 66 | null | null |
input-output-hk/pos-haskell-prototype | wallet/src/Cardano/Wallet/Types/UtxoStatistics.hs | mit | -- | Compute UtxoStatistics from a bunch of UTXOs
computeUtxoStatistics :: BoundType -> [Utxo] -> UtxoStatistics
computeUtxoStatistics btype =
L.fold foldStatistics . concatMap getCoins
where
getCoins :: Utxo -> [Word64]
getCoins =
map (getCoin . txOutValue . toaOut) . Map.elems
foldStatistics :: L.Fold Word64 UtxoStatistics
foldStatistics = UtxoStatistics
<$> foldBuckets (generateBounds btype)
<*> L.sum
foldBuckets :: NonEmpty Word64 -> L.Fold Word64 [HistogramBar]
foldBuckets bounds =
let
step :: Map Word64 Word64 -> Word64 -> Map Word64 Word64
step x a =
case Map.lookupGE a x of
Just (k, v) -> Map.insert k (v+1) x
Nothing -> Map.adjust (+1) (head bounds) x
initial :: Map Word64 Word64
initial =
Map.fromList $ zip (NL.toList bounds) (repeat 0)
extract :: Map Word64 Word64 -> [HistogramBar]
extract =
map (uncurry HistogramBarCount) . Map.toList
in
L.Fold step initial extract
--
-- INTERNALS
--
-- Utxo statistics for the wallet.
-- Histogram is composed of bars that represent the bucket. The bucket is tagged by upper bound of a given bucket.
-- The bar value corresponds to the number of stakes
-- In the future the bar value could be different things:
-- (a) sum of stakes in a bucket
-- (b) avg or std of stake in a bucket
-- (c) topN buckets
-- to name a few | 1,536 | computeUtxoStatistics :: BoundType -> [Utxo] -> UtxoStatistics
computeUtxoStatistics btype =
L.fold foldStatistics . concatMap getCoins
where
getCoins :: Utxo -> [Word64]
getCoins =
map (getCoin . txOutValue . toaOut) . Map.elems
foldStatistics :: L.Fold Word64 UtxoStatistics
foldStatistics = UtxoStatistics
<$> foldBuckets (generateBounds btype)
<*> L.sum
foldBuckets :: NonEmpty Word64 -> L.Fold Word64 [HistogramBar]
foldBuckets bounds =
let
step :: Map Word64 Word64 -> Word64 -> Map Word64 Word64
step x a =
case Map.lookupGE a x of
Just (k, v) -> Map.insert k (v+1) x
Nothing -> Map.adjust (+1) (head bounds) x
initial :: Map Word64 Word64
initial =
Map.fromList $ zip (NL.toList bounds) (repeat 0)
extract :: Map Word64 Word64 -> [HistogramBar]
extract =
map (uncurry HistogramBarCount) . Map.toList
in
L.Fold step initial extract
--
-- INTERNALS
--
-- Utxo statistics for the wallet.
-- Histogram is composed of bars that represent the bucket. The bucket is tagged by upper bound of a given bucket.
-- The bar value corresponds to the number of stakes
-- In the future the bar value could be different things:
-- (a) sum of stakes in a bucket
-- (b) avg or std of stake in a bucket
-- (c) topN buckets
-- to name a few | 1,486 | computeUtxoStatistics btype =
L.fold foldStatistics . concatMap getCoins
where
getCoins :: Utxo -> [Word64]
getCoins =
map (getCoin . txOutValue . toaOut) . Map.elems
foldStatistics :: L.Fold Word64 UtxoStatistics
foldStatistics = UtxoStatistics
<$> foldBuckets (generateBounds btype)
<*> L.sum
foldBuckets :: NonEmpty Word64 -> L.Fold Word64 [HistogramBar]
foldBuckets bounds =
let
step :: Map Word64 Word64 -> Word64 -> Map Word64 Word64
step x a =
case Map.lookupGE a x of
Just (k, v) -> Map.insert k (v+1) x
Nothing -> Map.adjust (+1) (head bounds) x
initial :: Map Word64 Word64
initial =
Map.fromList $ zip (NL.toList bounds) (repeat 0)
extract :: Map Word64 Word64 -> [HistogramBar]
extract =
map (uncurry HistogramBarCount) . Map.toList
in
L.Fold step initial extract
--
-- INTERNALS
--
-- Utxo statistics for the wallet.
-- Histogram is composed of bars that represent the bucket. The bucket is tagged by upper bound of a given bucket.
-- The bar value corresponds to the number of stakes
-- In the future the bar value could be different things:
-- (a) sum of stakes in a bucket
-- (b) avg or std of stake in a bucket
-- (c) topN buckets
-- to name a few | 1,423 | true | true | 0 | 14 | 471 | 347 | 179 | 168 | null | null |
nevrenato/Hets_Fork | THF/ParseTHF.hs | gpl-2.0 | constant :: CharParser st Constant
constant = tptpFunctor | 57 | constant :: CharParser st Constant
constant = tptpFunctor | 57 | constant = tptpFunctor | 22 | false | true | 0 | 5 | 7 | 16 | 8 | 8 | null | null |
nikita-volkov/record-syntax | library/Record/Syntax/LevelReifier/Levels.hs | mit | qName :: Level -> E.QName -> Levels
qName c =
\case
E.UnQual n -> name c n
_ -> mempty | 96 | qName :: Level -> E.QName -> Levels
qName c =
\case
E.UnQual n -> name c n
_ -> mempty | 96 | qName c =
\case
E.UnQual n -> name c n
_ -> mempty | 60 | false | true | 3 | 7 | 29 | 47 | 23 | 24 | null | null |
fmthoma/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | failMName = varQual gHC_BASE (fsLit "fail") failMClassOpKey | 70 | failMName = varQual gHC_BASE (fsLit "fail") failMClassOpKey | 70 | failMName = varQual gHC_BASE (fsLit "fail") failMClassOpKey | 70 | false | false | 0 | 7 | 17 | 19 | 9 | 10 | null | null |
nevrenato/HetsAlloy | HasCASL/Sublogic.hs | gpl-2.0 | sublogic_max :: Sublogic -> Sublogic -> Sublogic
sublogic_max = sublogic_join max max max | 89 | sublogic_max :: Sublogic -> Sublogic -> Sublogic
sublogic_max = sublogic_join max max max | 89 | sublogic_max = sublogic_join max max max | 40 | false | true | 0 | 6 | 12 | 26 | 13 | 13 | null | null |
Spawek/HCPParse | src/Preproc.hs | mit | tokenizeFile :: (Monad m) => World m -> String -> m (Either String [PPGroupPart])
tokenizeFile world fileName = do
rawText <- worldReadFile world fileName
worldPutStr world "\nRAW TEXT BEGIN\n"
worldPutStr world rawText
worldPutStr world "\nRAW TEXT END\n"
case ppTokenize rawText of
Left err -> do
worldPrint world $ "tokenizer error: " ++ show err
return $ (Left (show err))
Right tokens -> do
worldPutStr world "\nPP TOKENS BEGIN\n"
worldPutStr world $ intercalate "\n" $ map show tokens
worldPutStr world "\nPP TOKENS END\n"
worldPutStr world "\nREPRINT BEGIN\n"
worldPutStr world $ intercalate " " $ restringifyTokens tokens
worldPutStr world "\nREPRINT END\n"
case parsePPFile tokens of
Left err -> do
worldPrint world $ "preproc parser error: " ++ show err
return $ Left (show err)
Right file@(PPFile parsedTokens) -> do
worldPutStr world "\nPARSED TOKENS BEGIN\n"
worldPrint world file
worldPutStr world "\nPARSED TOKENS END\n"
return $ Right parsedTokens | 1,259 | tokenizeFile :: (Monad m) => World m -> String -> m (Either String [PPGroupPart])
tokenizeFile world fileName = do
rawText <- worldReadFile world fileName
worldPutStr world "\nRAW TEXT BEGIN\n"
worldPutStr world rawText
worldPutStr world "\nRAW TEXT END\n"
case ppTokenize rawText of
Left err -> do
worldPrint world $ "tokenizer error: " ++ show err
return $ (Left (show err))
Right tokens -> do
worldPutStr world "\nPP TOKENS BEGIN\n"
worldPutStr world $ intercalate "\n" $ map show tokens
worldPutStr world "\nPP TOKENS END\n"
worldPutStr world "\nREPRINT BEGIN\n"
worldPutStr world $ intercalate " " $ restringifyTokens tokens
worldPutStr world "\nREPRINT END\n"
case parsePPFile tokens of
Left err -> do
worldPrint world $ "preproc parser error: " ++ show err
return $ Left (show err)
Right file@(PPFile parsedTokens) -> do
worldPutStr world "\nPARSED TOKENS BEGIN\n"
worldPrint world file
worldPutStr world "\nPARSED TOKENS END\n"
return $ Right parsedTokens | 1,259 | tokenizeFile world fileName = do
rawText <- worldReadFile world fileName
worldPutStr world "\nRAW TEXT BEGIN\n"
worldPutStr world rawText
worldPutStr world "\nRAW TEXT END\n"
case ppTokenize rawText of
Left err -> do
worldPrint world $ "tokenizer error: " ++ show err
return $ (Left (show err))
Right tokens -> do
worldPutStr world "\nPP TOKENS BEGIN\n"
worldPutStr world $ intercalate "\n" $ map show tokens
worldPutStr world "\nPP TOKENS END\n"
worldPutStr world "\nREPRINT BEGIN\n"
worldPutStr world $ intercalate " " $ restringifyTokens tokens
worldPutStr world "\nREPRINT END\n"
case parsePPFile tokens of
Left err -> do
worldPrint world $ "preproc parser error: " ++ show err
return $ Left (show err)
Right file@(PPFile parsedTokens) -> do
worldPutStr world "\nPARSED TOKENS BEGIN\n"
worldPrint world file
worldPutStr world "\nPARSED TOKENS END\n"
return $ Right parsedTokens | 1,177 | false | true | 0 | 20 | 439 | 328 | 140 | 188 | null | null |
imalsogreg/reflex-dom | src/Reflex/Dom/Xhr.hs | bsd-3-clause | getMay :: MonadWidget t m => (Event t a -> m (Event t b)) -> Event t (Maybe a) -> m (Event t (Maybe b))
getMay f e = do
e' <- f (fmapMaybe id e)
return $ leftmost [fmap Just e', fmapMaybe (maybe (Just Nothing) (const Nothing)) e] | 237 | getMay :: MonadWidget t m => (Event t a -> m (Event t b)) -> Event t (Maybe a) -> m (Event t (Maybe b))
getMay f e = do
e' <- f (fmapMaybe id e)
return $ leftmost [fmap Just e', fmapMaybe (maybe (Just Nothing) (const Nothing)) e] | 237 | getMay f e = do
e' <- f (fmapMaybe id e)
return $ leftmost [fmap Just e', fmapMaybe (maybe (Just Nothing) (const Nothing)) e] | 133 | false | true | 0 | 15 | 56 | 153 | 71 | 82 | null | null |
kadena-io/pact | src-tool/Pact/Analyze/Eval/Core.hs | bsd-3-clause | shrinkObject
(obj , schema@(SingList (SCons k v kvs)))
searchSchema@(SingList (SCons sk _sv _skvs))
= withHasKind v $ withSymVal (SObjectUnsafe (SingList kvs)) $
case cmpSym k sk of
GT -> SomeObj schema obj
_ -> shrinkObject (_2 obj , SingList kvs) searchSchema
-- | Merge two objects, returning one with the requested schema.
--
-- We simultaneously shrink each input object, via @shrinkObject@ so that we're
-- always examining the smallest objects that could possibly match our
-- searched-for schema.
--
-- Example:
--
-- obj1: { x: 1, y: 2 }
-- obj2: { y: 4, z: 5 }
-- schema: { y: integer, z: integer }
--
-- Note that this example illustrates why we must shrink objects before the
-- first call. If we didn't shrink here then obj2 would match first even though
-- obj1 should.
--
-- Step 1: shrink
--
-- obj1: { y: 2 }
-- obj2: { y: 4, z: 5 }
-- schema: { y: integer, z: integer }
--
-- 2: match
--
-- y = 2
--
-- 3: shrink
--
-- obj1: { }
-- obj2: { z: 5 }
-- schema: { z: integer }
--
-- 3.5. switch to @subObject@
--
-- obj2: { z: 5 }
-- schema: { z: integer }
--
-- 4: match
--
-- z = 5
--
-- 5: shrink
--
-- obj2: {}
-- schema: {}
--
-- 6: terminate
--
-- result: { y: 2, z: 5 } | 1,360 | shrinkObject
(obj , schema@(SingList (SCons k v kvs)))
searchSchema@(SingList (SCons sk _sv _skvs))
= withHasKind v $ withSymVal (SObjectUnsafe (SingList kvs)) $
case cmpSym k sk of
GT -> SomeObj schema obj
_ -> shrinkObject (_2 obj , SingList kvs) searchSchema
-- | Merge two objects, returning one with the requested schema.
--
-- We simultaneously shrink each input object, via @shrinkObject@ so that we're
-- always examining the smallest objects that could possibly match our
-- searched-for schema.
--
-- Example:
--
-- obj1: { x: 1, y: 2 }
-- obj2: { y: 4, z: 5 }
-- schema: { y: integer, z: integer }
--
-- Note that this example illustrates why we must shrink objects before the
-- first call. If we didn't shrink here then obj2 would match first even though
-- obj1 should.
--
-- Step 1: shrink
--
-- obj1: { y: 2 }
-- obj2: { y: 4, z: 5 }
-- schema: { y: integer, z: integer }
--
-- 2: match
--
-- y = 2
--
-- 3: shrink
--
-- obj1: { }
-- obj2: { z: 5 }
-- schema: { z: integer }
--
-- 3.5. switch to @subObject@
--
-- obj2: { z: 5 }
-- schema: { z: integer }
--
-- 4: match
--
-- z = 5
--
-- 5: shrink
--
-- obj2: {}
-- schema: {}
--
-- 6: terminate
--
-- result: { y: 2, z: 5 } | 1,360 | shrinkObject
(obj , schema@(SingList (SCons k v kvs)))
searchSchema@(SingList (SCons sk _sv _skvs))
= withHasKind v $ withSymVal (SObjectUnsafe (SingList kvs)) $
case cmpSym k sk of
GT -> SomeObj schema obj
_ -> shrinkObject (_2 obj , SingList kvs) searchSchema
-- | Merge two objects, returning one with the requested schema.
--
-- We simultaneously shrink each input object, via @shrinkObject@ so that we're
-- always examining the smallest objects that could possibly match our
-- searched-for schema.
--
-- Example:
--
-- obj1: { x: 1, y: 2 }
-- obj2: { y: 4, z: 5 }
-- schema: { y: integer, z: integer }
--
-- Note that this example illustrates why we must shrink objects before the
-- first call. If we didn't shrink here then obj2 would match first even though
-- obj1 should.
--
-- Step 1: shrink
--
-- obj1: { y: 2 }
-- obj2: { y: 4, z: 5 }
-- schema: { y: integer, z: integer }
--
-- 2: match
--
-- y = 2
--
-- 3: shrink
--
-- obj1: { }
-- obj2: { z: 5 }
-- schema: { z: integer }
--
-- 3.5. switch to @subObject@
--
-- obj2: { z: 5 }
-- schema: { z: integer }
--
-- 4: match
--
-- z = 5
--
-- 5: shrink
--
-- obj2: {}
-- schema: {}
--
-- 6: terminate
--
-- result: { y: 2, z: 5 } | 1,360 | false | false | 2 | 11 | 418 | 178 | 110 | 68 | null | null |
keithodulaigh/Hets | OMDoc/Import.hs | gpl-2.0 | importTheory :: ImpEnv -- ^ The import environment
-> CurrentLib -- ^ The current lib
-> OMCD -- ^ The cd which points to the Theory
-> ResultT IO ( ImpEnv -- the updated environment
, LibName -- the origin libname of the theory
, DGraph -- the updated devgraph of the current lib
, LNode DGNodeLab -- the corresponding node
)
importTheory e (ln, dg) cd = do
let ucd = toIriCD cd ln
rPut2 e $ "Looking up theory " ++ showIriCD ucd ++ " ..."
case lookupNode e (ln, dg) ucd of
Just (ln', nd)
| ln == ln' ->
do
rPut2 e "... found local node."
return (e, ln, dg, nd)
| isDGRef $ snd nd ->
do
rPut2 e "... found already referenced node."
return (e, ln', dg, nd)
| otherwise ->
do
rPut2 e "... found node, referencing it ..."
let (lnode, dg') = addNodeAsRefToDG nd ln' dg
rPut2 e "... done"
return (e, ln', dg', lnode)
-- if lookupNode finds nothing implies that ln is not the current libname!
_ -> do
let u = fromJust $ getIri ucd
rPut2 e "... node not found, reading lib."
(e', ln', refDg) <- readLib e u
case filterLocalNodesByName (getModule ucd) refDg of
-- don't add the node to the refDG but to the original DG!
nd : _ -> let (lnode, dg') = addNodeAsRefToDG nd ln' dg
in return (e', ln', dg', lnode)
[] -> error $ "importTheory: couldn't find node: " ++ show cd
-- | Adds a view or theory to the DG, the ImpEnv may also be modified. | 1,739 | importTheory :: ImpEnv -- ^ The import environment
-> CurrentLib -- ^ The current lib
-> OMCD -- ^ The cd which points to the Theory
-> ResultT IO ( ImpEnv -- the updated environment
, LibName -- the origin libname of the theory
, DGraph -- the updated devgraph of the current lib
, LNode DGNodeLab -- the corresponding node
)
importTheory e (ln, dg) cd = do
let ucd = toIriCD cd ln
rPut2 e $ "Looking up theory " ++ showIriCD ucd ++ " ..."
case lookupNode e (ln, dg) ucd of
Just (ln', nd)
| ln == ln' ->
do
rPut2 e "... found local node."
return (e, ln, dg, nd)
| isDGRef $ snd nd ->
do
rPut2 e "... found already referenced node."
return (e, ln', dg, nd)
| otherwise ->
do
rPut2 e "... found node, referencing it ..."
let (lnode, dg') = addNodeAsRefToDG nd ln' dg
rPut2 e "... done"
return (e, ln', dg', lnode)
-- if lookupNode finds nothing implies that ln is not the current libname!
_ -> do
let u = fromJust $ getIri ucd
rPut2 e "... node not found, reading lib."
(e', ln', refDg) <- readLib e u
case filterLocalNodesByName (getModule ucd) refDg of
-- don't add the node to the refDG but to the original DG!
nd : _ -> let (lnode, dg') = addNodeAsRefToDG nd ln' dg
in return (e', ln', dg', lnode)
[] -> error $ "importTheory: couldn't find node: " ++ show cd
-- | Adds a view or theory to the DG, the ImpEnv may also be modified. | 1,739 | importTheory e (ln, dg) cd = do
let ucd = toIriCD cd ln
rPut2 e $ "Looking up theory " ++ showIriCD ucd ++ " ..."
case lookupNode e (ln, dg) ucd of
Just (ln', nd)
| ln == ln' ->
do
rPut2 e "... found local node."
return (e, ln, dg, nd)
| isDGRef $ snd nd ->
do
rPut2 e "... found already referenced node."
return (e, ln', dg, nd)
| otherwise ->
do
rPut2 e "... found node, referencing it ..."
let (lnode, dg') = addNodeAsRefToDG nd ln' dg
rPut2 e "... done"
return (e, ln', dg', lnode)
-- if lookupNode finds nothing implies that ln is not the current libname!
_ -> do
let u = fromJust $ getIri ucd
rPut2 e "... node not found, reading lib."
(e', ln', refDg) <- readLib e u
case filterLocalNodesByName (getModule ucd) refDg of
-- don't add the node to the refDG but to the original DG!
nd : _ -> let (lnode, dg') = addNodeAsRefToDG nd ln' dg
in return (e', ln', dg', lnode)
[] -> error $ "importTheory: couldn't find node: " ++ show cd
-- | Adds a view or theory to the DG, the ImpEnv may also be modified. | 1,265 | false | true | 0 | 19 | 671 | 418 | 208 | 210 | null | null |
oldmanmike/ghc | compiler/main/DynFlags.hs | bsd-3-clause | -- | Set a 'WarningFlag'
wopt_set :: DynFlags -> WarningFlag -> DynFlags
wopt_set dfs f = dfs{ warningFlags = IntSet.insert (fromEnum f) (warningFlags dfs) } | 157 | wopt_set :: DynFlags -> WarningFlag -> DynFlags
wopt_set dfs f = dfs{ warningFlags = IntSet.insert (fromEnum f) (warningFlags dfs) } | 132 | wopt_set dfs f = dfs{ warningFlags = IntSet.insert (fromEnum f) (warningFlags dfs) } | 84 | true | true | 0 | 10 | 24 | 62 | 29 | 33 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxTEXT_ATTR_BULLET_NAME :: Int
wxTEXT_ATTR_BULLET_NAME = 0x00100000 | 85 | wxTEXT_ATTR_BULLET_NAME :: Int
wxTEXT_ATTR_BULLET_NAME = 0x00100000 | 85 | wxTEXT_ATTR_BULLET_NAME = 0x00100000 | 45 | false | true | 0 | 4 | 23 | 11 | 6 | 5 | null | null |
josuf107/Adverb | Adverb/Common.hs | gpl-3.0 | mimickingly = id | 16 | mimickingly = id | 16 | mimickingly = id | 16 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
johnyhlee/baseball-sim | src/Baseball.hs | gpl-2.0 | tupSequence :: IO a -> b -> IO (a,b)
tupSequence x y = do
mx <- x
let my = y
return (mx, my) | 116 | tupSequence :: IO a -> b -> IO (a,b)
tupSequence x y = do
mx <- x
let my = y
return (mx, my) | 116 | tupSequence x y = do
mx <- x
let my = y
return (mx, my) | 79 | false | true | 0 | 9 | 47 | 64 | 31 | 33 | null | null |
danchoi/imapget | src/Network/HaskellNet/SMTP.hs | bsd-3-clause | -- | doSMTP is similar to doSMTPPort, except that it does not require
-- port number but connects to the server with port 25.
doSMTP :: String -> (SMTPConnection -> IO a) -> IO a
doSMTP host execution = doSMTPPort host 25 execution | 231 | doSMTP :: String -> (SMTPConnection -> IO a) -> IO a
doSMTP host execution = doSMTPPort host 25 execution | 105 | doSMTP host execution = doSMTPPort host 25 execution | 52 | true | true | 0 | 9 | 42 | 50 | 24 | 26 | null | null |
mightymoose/liquidhaskell | benchmarks/llrbtree-0.1.1/Data/Heap/Leftist.hs | bsd-3-clause | deleteMin2 :: Ord a => Leftist a -> Maybe (a, Leftist a)
deleteMin2 Leaf = Nothing | 82 | deleteMin2 :: Ord a => Leftist a -> Maybe (a, Leftist a)
deleteMin2 Leaf = Nothing | 82 | deleteMin2 Leaf = Nothing | 25 | false | true | 0 | 9 | 15 | 40 | 19 | 21 | null | null |
phischu/fragnix | tests/packages/scotty/Network.Wai.Handler.SCGI.hs | bsd-3-clause | runSendfile :: ByteString -> Application -> IO ()
runSendfile sf app = runOne (Just sf) app >> runSendfile sf app | 113 | runSendfile :: ByteString -> Application -> IO ()
runSendfile sf app = runOne (Just sf) app >> runSendfile sf app | 113 | runSendfile sf app = runOne (Just sf) app >> runSendfile sf app | 63 | false | true | 0 | 8 | 19 | 49 | 23 | 26 | null | null |
vikraman/ghc | compiler/typecheck/TcGenGenerics.hs | bsd-3-clause | -- When working only within a single datacon, "the" parameter's name should
-- match that datacon's name for it.
gk2gkDC :: GenericKind_ -> DataCon -> GenericKind_DC
gk2gkDC Gen0_ _ = Gen0_DC | 193 | gk2gkDC :: GenericKind_ -> DataCon -> GenericKind_DC
gk2gkDC Gen0_ _ = Gen0_DC | 80 | gk2gkDC Gen0_ _ = Gen0_DC | 27 | true | true | 0 | 6 | 32 | 26 | 14 | 12 | null | null |
yjwen/hada | test/Num.hs | lgpl-3.0 | gtU16 :: Word16 -> Word16 -> Bool
gtU16 = (>) | 45 | gtU16 :: Word16 -> Word16 -> Bool
gtU16 = (>) | 45 | gtU16 = (>) | 11 | false | true | 0 | 6 | 9 | 21 | 12 | 9 | null | null |
geocurnoff/nikki | src/Sorts/Battery.hs | lgpl-3.0 | -- tweakValue "battmass"-- 3.588785046728972
batterySize :: Fractional f => Size f
batterySize = Size 28 52 | 108 | batterySize :: Fractional f => Size f
batterySize = Size 28 52 | 62 | batterySize = Size 28 52 | 24 | true | true | 0 | 7 | 16 | 34 | 14 | 20 | null | null |
Numberartificial/workflow | snipets/src/Craft/Chapter4.hs | mit | fourPics3 :: Picture -> Picture
fourPics3 pic =
left `beside` right
where
left = pic `above` invertColour pic
right = invertColour (flipV left) | 171 | fourPics3 :: Picture -> Picture
fourPics3 pic =
left `beside` right
where
left = pic `above` invertColour pic
right = invertColour (flipV left) | 170 | fourPics3 pic =
left `beside` right
where
left = pic `above` invertColour pic
right = invertColour (flipV left) | 138 | false | true | 2 | 7 | 50 | 73 | 32 | 41 | null | null |
ahodgen/archer-calc | src/BuiltIn/Stats.hs | bsd-2-clause | fDist :: [Value] -> Interpreter EvalError Value
fDist [VNum x, VNum df1, VNum df2]
| x < 0 = biErr "First argument to fdist must be positive"
| df1 < 1 || df1 >= 10**10 = biErr "fdist numerator degrees of freedom out of range"
| df2 < 1 || df2 >= 10**10 = biErr "fdist denominator degrees of freedom out of range"
| otherwise = return . VNum $ complCumulative dist x
where
dist = fDistribution (truncate df1) (truncate df2) | 445 | fDist :: [Value] -> Interpreter EvalError Value
fDist [VNum x, VNum df1, VNum df2]
| x < 0 = biErr "First argument to fdist must be positive"
| df1 < 1 || df1 >= 10**10 = biErr "fdist numerator degrees of freedom out of range"
| df2 < 1 || df2 >= 10**10 = biErr "fdist denominator degrees of freedom out of range"
| otherwise = return . VNum $ complCumulative dist x
where
dist = fDistribution (truncate df1) (truncate df2) | 445 | fDist [VNum x, VNum df1, VNum df2]
| x < 0 = biErr "First argument to fdist must be positive"
| df1 < 1 || df1 >= 10**10 = biErr "fdist numerator degrees of freedom out of range"
| df2 < 1 || df2 >= 10**10 = biErr "fdist denominator degrees of freedom out of range"
| otherwise = return . VNum $ complCumulative dist x
where
dist = fDistribution (truncate df1) (truncate df2) | 397 | false | true | 1 | 11 | 102 | 162 | 77 | 85 | null | null |
DougBurke/swish | src/Swish/RDF/Parser/Turtle.hs | lgpl-2.1 | {-
[167s] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
[168s] PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
-}
_pnPrefix :: TurtleParser L.Text
_pnPrefix = L.cons <$> _pnCharsBase <*> _pnRest | 261 | _pnPrefix :: TurtleParser L.Text
_pnPrefix = L.cons <$> _pnCharsBase <*> _pnRest | 80 | _pnPrefix = L.cons <$> _pnCharsBase <*> _pnRest | 47 | true | true | 0 | 7 | 43 | 27 | 14 | 13 | null | null |
nathyong/microghc-ghc | ghc/Main.hs | bsd-3-clause | -- -----------------------------------------------------------------------------
-- ABI hash support
{-
ghc --abi-hash Data.Foo System.Bar
Generates a combined hash of the ABI for modules Data.Foo and
System.Bar. The modules must already be compiled, and appropriate -i
options may be necessary in order to find the .hi files.
This is used by Cabal for generating the InstalledPackageId for a
package. The InstalledPackageId must change when the visible ABI of
the package chagnes, so during registration Cabal calls ghc --abi-hash
to get a hash of the package's ABI.
-}
-- | Print ABI hash of input modules.
--
-- The resulting hash is the MD5 of the GHC version used (Trac #5328,
-- see 'hiVersion') and of the existing ABI hash from each module (see
-- 'mi_mod_hash').
abiHash :: [String] -- ^ List of module names
-> Ghc ()
abiHash strs = do
hsc_env <- getSession
let dflags = hsc_dflags hsc_env
liftIO $ do
let find_it str = do
let modname = mkModuleName str
r <- findImportedModule hsc_env modname Nothing
case r of
Found _ m -> return m
_error -> throwGhcException $ CmdLineError $ showSDoc dflags $
cannotFindInterface dflags modname r
mods <- mapM find_it strs
let get_iface modl = loadUserInterface False (text "abiHash") modl
ifaces <- initIfaceCheck hsc_env $ mapM get_iface mods
bh <- openBinMem (3*1024) -- just less than a block
put_ bh hiVersion
-- package hashes change when the compiler version changes (for now)
-- see #5328
mapM_ (put_ bh . mi_mod_hash) ifaces
f <- fingerprintBinMem bh
putStrLn (showPpr dflags f)
-- -----------------------------------------------------------------------------
-- Util | 1,762 | abiHash :: [String] -- ^ List of module names
-> Ghc ()
abiHash strs = do
hsc_env <- getSession
let dflags = hsc_dflags hsc_env
liftIO $ do
let find_it str = do
let modname = mkModuleName str
r <- findImportedModule hsc_env modname Nothing
case r of
Found _ m -> return m
_error -> throwGhcException $ CmdLineError $ showSDoc dflags $
cannotFindInterface dflags modname r
mods <- mapM find_it strs
let get_iface modl = loadUserInterface False (text "abiHash") modl
ifaces <- initIfaceCheck hsc_env $ mapM get_iface mods
bh <- openBinMem (3*1024) -- just less than a block
put_ bh hiVersion
-- package hashes change when the compiler version changes (for now)
-- see #5328
mapM_ (put_ bh . mi_mod_hash) ifaces
f <- fingerprintBinMem bh
putStrLn (showPpr dflags f)
-- -----------------------------------------------------------------------------
-- Util | 976 | abiHash strs = do
hsc_env <- getSession
let dflags = hsc_dflags hsc_env
liftIO $ do
let find_it str = do
let modname = mkModuleName str
r <- findImportedModule hsc_env modname Nothing
case r of
Found _ m -> return m
_error -> throwGhcException $ CmdLineError $ showSDoc dflags $
cannotFindInterface dflags modname r
mods <- mapM find_it strs
let get_iface modl = loadUserInterface False (text "abiHash") modl
ifaces <- initIfaceCheck hsc_env $ mapM get_iface mods
bh <- openBinMem (3*1024) -- just less than a block
put_ bh hiVersion
-- package hashes change when the compiler version changes (for now)
-- see #5328
mapM_ (put_ bh . mi_mod_hash) ifaces
f <- fingerprintBinMem bh
putStrLn (showPpr dflags f)
-- -----------------------------------------------------------------------------
-- Util | 912 | true | true | 0 | 20 | 391 | 276 | 129 | 147 | null | null |
mcmaniac/ghc | utils/hpc/HpcMarkup.hs | bsd-3-clause | red,green,yellow :: String
red = "#f20913" | 45 | red,green,yellow :: String
red = "#f20913" | 45 | red = "#f20913" | 18 | false | true | 4 | 6 | 8 | 30 | 11 | 19 | null | null |
alanz/cloud-haskell-play | src/simplesupgenserver.hs | unlicense | handleIncrement :: State -> Increment -> Process (ProcessReply Int State)
handleIncrement count Increment =
let next = count + 1 in continue next >>= replyWith next | 168 | handleIncrement :: State -> Increment -> Process (ProcessReply Int State)
handleIncrement count Increment =
let next = count + 1 in continue next >>= replyWith next | 168 | handleIncrement count Increment =
let next = count + 1 in continue next >>= replyWith next | 94 | false | true | 0 | 9 | 29 | 60 | 28 | 32 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxFONTFAMILY_MAX :: Int
wxFONTFAMILY_MAX = wxFONTFAMILY_TELETYPE + 1 | 68 | wxFONTFAMILY_MAX :: Int
wxFONTFAMILY_MAX = wxFONTFAMILY_TELETYPE + 1 | 68 | wxFONTFAMILY_MAX = wxFONTFAMILY_TELETYPE + 1 | 44 | false | true | 0 | 6 | 7 | 22 | 9 | 13 | null | null |
corajr/cataskell | src/Cataskell/Game.hs | bsd-3-clause | phaseOneOf :: [Phase] -> Precondition Game
phaseOneOf phases = Precondition { predicate = flip elem phases . view phase, label = "phase one of: " ++ show phases } | 162 | phaseOneOf :: [Phase] -> Precondition Game
phaseOneOf phases = Precondition { predicate = flip elem phases . view phase, label = "phase one of: " ++ show phases } | 162 | phaseOneOf phases = Precondition { predicate = flip elem phases . view phase, label = "phase one of: " ++ show phases } | 119 | false | true | 0 | 8 | 28 | 57 | 29 | 28 | null | null |
christiaanb/ghc | compiler/simplCore/CoreMonad.hs | bsd-3-clause | simplCountN (SimplCount { ticks = n }) = n | 42 | simplCountN (SimplCount { ticks = n }) = n | 42 | simplCountN (SimplCount { ticks = n }) = n | 42 | false | false | 0 | 9 | 8 | 21 | 11 | 10 | null | null |
vasily-kirichenko/haskell-book | src/Parsers.hs | bsd-3-clause | -- fractions
badFraction = "1/0" | 33 | badFraction = "1/0" | 19 | badFraction = "1/0" | 19 | true | false | 0 | 4 | 5 | 7 | 4 | 3 | null | null |
mpwillson/mal | haskell/step2_eval.hs | mpl-2.0 | main = do
load_history
repl_loop | 40 | main = do
load_history
repl_loop | 40 | main = do
load_history
repl_loop | 40 | false | false | 0 | 6 | 12 | 12 | 5 | 7 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/HTMLDocument.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument.alinkColor Mozilla HTMLDocument.alinkColor documentation>
getAlinkColor ::
(MonadDOM m, FromJSString result) => HTMLDocument -> m result
getAlinkColor self
= liftDOM ((self ^. js "alinkColor") >>= fromJSValUnchecked) | 301 | getAlinkColor ::
(MonadDOM m, FromJSString result) => HTMLDocument -> m result
getAlinkColor self
= liftDOM ((self ^. js "alinkColor") >>= fromJSValUnchecked) | 174 | getAlinkColor self
= liftDOM ((self ^. js "alinkColor") >>= fromJSValUnchecked) | 81 | true | true | 0 | 10 | 43 | 57 | 29 | 28 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/DocDBDBCluster.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-docdb-dbcluster.html#cfn-docdb-dbcluster-dbsubnetgroupname
ddbdbcDBSubnetGroupName :: Lens' DocDBDBCluster (Maybe (Val Text))
ddbdbcDBSubnetGroupName = lens _docDBDBClusterDBSubnetGroupName (\s a -> s { _docDBDBClusterDBSubnetGroupName = a }) | 322 | ddbdbcDBSubnetGroupName :: Lens' DocDBDBCluster (Maybe (Val Text))
ddbdbcDBSubnetGroupName = lens _docDBDBClusterDBSubnetGroupName (\s a -> s { _docDBDBClusterDBSubnetGroupName = a }) | 183 | ddbdbcDBSubnetGroupName = lens _docDBDBClusterDBSubnetGroupName (\s a -> s { _docDBDBClusterDBSubnetGroupName = a }) | 116 | true | true | 0 | 9 | 22 | 52 | 28 | 24 | null | null |
SDKE/Programacion-Logica-y-Funcional | Practica4_Solucion.hs | gpl-3.0 | permuta l = [x:resto | x <- l, resto <- permuta(borra x l)] | 60 | permuta l = [x:resto | x <- l, resto <- permuta(borra x l)] | 60 | permuta l = [x:resto | x <- l, resto <- permuta(borra x l)] | 60 | false | false | 0 | 10 | 13 | 43 | 21 | 22 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Mediawiki.hs | gpl-2.0 | regex_'3d'7b4'2c'7d_'2a'24 = compileRegex True "={4,} *$" | 57 | regex_'3d'7b4'2c'7d_'2a'24 = compileRegex True "={4,} *$" | 57 | regex_'3d'7b4'2c'7d_'2a'24 = compileRegex True "={4,} *$" | 57 | false | false | 0 | 5 | 5 | 11 | 5 | 6 | null | null |
mikeizbicki/typeparams | examples/supercomp-lebesgue.hs | bsd-3-clause | v = VG.fromList [1..10] :: Lebesgue (Static (2/1)) (VPU.Vector Automatic) Float | 79 | v = VG.fromList [1..10] :: Lebesgue (Static (2/1)) (VPU.Vector Automatic) Float | 79 | v = VG.fromList [1..10] :: Lebesgue (Static (2/1)) (VPU.Vector Automatic) Float | 79 | false | false | 0 | 9 | 10 | 50 | 25 | 25 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Data/Text/Format/Strict.hs | mit | format' :: Params s => Format -> s -> Text
format' fmt ps = toStrict . format fmt $ ps | 86 | format' :: Params s => Format -> s -> Text
format' fmt ps = toStrict . format fmt $ ps | 86 | format' fmt ps = toStrict . format fmt $ ps | 43 | false | true | 0 | 7 | 19 | 42 | 20 | 22 | null | null |
alanz/htelehash | src/Network/TeleHash/Switch.hs | bsd-3-clause | switch_new :: IO Switch
switch_new = do
rng <- initRNG
return $ Switch
{ swId = HN "foo"
, swParts = []
, swExternalIPP = Nothing
, swSeeds = Set.empty
, swOut = [] -- packets waiting to be delivered
, swLast = Nothing
, swChans = Set.empty
, swUid = 0
, swTxid = 0
, swCrid = CR 0
, swCap = 256 -- default cap size
, swWindow = 32 -- default reliable window size
-- , swIsSeed = False
, swIsSeed = True
, swDhtK = 8
, swDhtLinkMax = 256
, swDht = Map.empty
, swIndex = Map.empty
, swIndexChans = Map.empty
, swIndexCrypto = Map.empty
, swIndexLines = Map.empty
, swIndexSeeks = Map.empty
, swHandler = Nothing
, swH = Nothing
, swChan = Nothing
, swSender = doSendDgram
, swThtp = Nothing
, swIndexChat = Map.empty
, swIndexChatR = Map.empty
, swLink = Nothing
, swCurrentChat = Nothing
, swRNG = rng
, swTick = 0
}
{-
switch_t switch_new(uint32_t prime)
{
switch_t s;
if(!(s = malloc(sizeof (struct switch_struct)))) return NULL;
memset(s, 0, sizeof(struct switch_struct));
s->cap = 256; // default cap size
s->window = 32; // default reliable window size
s->index = xht_new(prime?prime:MAXPRIME);
s->parts = packet_new();
if(!s->index || !s->parts) return switch_free(s);
return s;
}
-}
-- --------------------------------------------------------------------- | 1,701 | switch_new :: IO Switch
switch_new = do
rng <- initRNG
return $ Switch
{ swId = HN "foo"
, swParts = []
, swExternalIPP = Nothing
, swSeeds = Set.empty
, swOut = [] -- packets waiting to be delivered
, swLast = Nothing
, swChans = Set.empty
, swUid = 0
, swTxid = 0
, swCrid = CR 0
, swCap = 256 -- default cap size
, swWindow = 32 -- default reliable window size
-- , swIsSeed = False
, swIsSeed = True
, swDhtK = 8
, swDhtLinkMax = 256
, swDht = Map.empty
, swIndex = Map.empty
, swIndexChans = Map.empty
, swIndexCrypto = Map.empty
, swIndexLines = Map.empty
, swIndexSeeks = Map.empty
, swHandler = Nothing
, swH = Nothing
, swChan = Nothing
, swSender = doSendDgram
, swThtp = Nothing
, swIndexChat = Map.empty
, swIndexChatR = Map.empty
, swLink = Nothing
, swCurrentChat = Nothing
, swRNG = rng
, swTick = 0
}
{-
switch_t switch_new(uint32_t prime)
{
switch_t s;
if(!(s = malloc(sizeof (struct switch_struct)))) return NULL;
memset(s, 0, sizeof(struct switch_struct));
s->cap = 256; // default cap size
s->window = 32; // default reliable window size
s->index = xht_new(prime?prime:MAXPRIME);
s->parts = packet_new();
if(!s->index || !s->parts) return switch_free(s);
return s;
}
-}
-- --------------------------------------------------------------------- | 1,701 | switch_new = do
rng <- initRNG
return $ Switch
{ swId = HN "foo"
, swParts = []
, swExternalIPP = Nothing
, swSeeds = Set.empty
, swOut = [] -- packets waiting to be delivered
, swLast = Nothing
, swChans = Set.empty
, swUid = 0
, swTxid = 0
, swCrid = CR 0
, swCap = 256 -- default cap size
, swWindow = 32 -- default reliable window size
-- , swIsSeed = False
, swIsSeed = True
, swDhtK = 8
, swDhtLinkMax = 256
, swDht = Map.empty
, swIndex = Map.empty
, swIndexChans = Map.empty
, swIndexCrypto = Map.empty
, swIndexLines = Map.empty
, swIndexSeeks = Map.empty
, swHandler = Nothing
, swH = Nothing
, swChan = Nothing
, swSender = doSendDgram
, swThtp = Nothing
, swIndexChat = Map.empty
, swIndexChatR = Map.empty
, swLink = Nothing
, swCurrentChat = Nothing
, swRNG = rng
, swTick = 0
}
{-
switch_t switch_new(uint32_t prime)
{
switch_t s;
if(!(s = malloc(sizeof (struct switch_struct)))) return NULL;
memset(s, 0, sizeof(struct switch_struct));
s->cap = 256; // default cap size
s->window = 32; // default reliable window size
s->index = xht_new(prime?prime:MAXPRIME);
s->parts = packet_new();
if(!s->index || !s->parts) return switch_free(s);
return s;
}
-}
-- --------------------------------------------------------------------- | 1,677 | false | true | 0 | 10 | 652 | 258 | 162 | 96 | null | null |
donatello/minio-hs | test/LiveServer.hs | apache-2.0 | presignedPostPolicyFunTest :: TestTree
presignedPostPolicyFunTest = funTestWithBucket "Presigned Post Policy tests" $
\step bucket -> do
step "presignedPostPolicy basic test"
now <- liftIO $ Time.getCurrentTime
let key = "presignedPostPolicyTest/myfile"
policyConds = [ ppCondBucket bucket
, ppCondKey key
, ppCondContentLengthRange 1 1000
, ppCondContentType "application/octet-stream"
, ppCondSuccessActionStatus 200
]
expirationTime = Time.addUTCTime 3600 now
postPolicyE = newPostPolicy expirationTime policyConds
size = 1000 :: Int64
inputFile <- mkRandFile size
case postPolicyE of
Left err -> liftIO $ assertFailure $ show err
Right postPolicy -> do
(url, formData) <- presignedPostPolicy postPolicy
-- liftIO (print url) >> liftIO (print formData)
result <- liftIO $ postForm url formData inputFile
liftIO $ (NC.responseStatus result == HT.status200) @?
"presigned POST failed"
mapM_ (removeObject bucket) [key]
where
postForm url formData inputFile = do
req <- NC.parseRequest $ toS url
let parts = map (\(x, y) -> Form.partBS x y) $
Map.toList formData
parts' = parts ++ [Form.partFile "file" inputFile]
req' <- Form.formDataBody parts' req
mgr <- NC.newManager NC.tlsManagerSettings
NC.httpLbs req' mgr | 1,525 | presignedPostPolicyFunTest :: TestTree
presignedPostPolicyFunTest = funTestWithBucket "Presigned Post Policy tests" $
\step bucket -> do
step "presignedPostPolicy basic test"
now <- liftIO $ Time.getCurrentTime
let key = "presignedPostPolicyTest/myfile"
policyConds = [ ppCondBucket bucket
, ppCondKey key
, ppCondContentLengthRange 1 1000
, ppCondContentType "application/octet-stream"
, ppCondSuccessActionStatus 200
]
expirationTime = Time.addUTCTime 3600 now
postPolicyE = newPostPolicy expirationTime policyConds
size = 1000 :: Int64
inputFile <- mkRandFile size
case postPolicyE of
Left err -> liftIO $ assertFailure $ show err
Right postPolicy -> do
(url, formData) <- presignedPostPolicy postPolicy
-- liftIO (print url) >> liftIO (print formData)
result <- liftIO $ postForm url formData inputFile
liftIO $ (NC.responseStatus result == HT.status200) @?
"presigned POST failed"
mapM_ (removeObject bucket) [key]
where
postForm url formData inputFile = do
req <- NC.parseRequest $ toS url
let parts = map (\(x, y) -> Form.partBS x y) $
Map.toList formData
parts' = parts ++ [Form.partFile "file" inputFile]
req' <- Form.formDataBody parts' req
mgr <- NC.newManager NC.tlsManagerSettings
NC.httpLbs req' mgr | 1,525 | presignedPostPolicyFunTest = funTestWithBucket "Presigned Post Policy tests" $
\step bucket -> do
step "presignedPostPolicy basic test"
now <- liftIO $ Time.getCurrentTime
let key = "presignedPostPolicyTest/myfile"
policyConds = [ ppCondBucket bucket
, ppCondKey key
, ppCondContentLengthRange 1 1000
, ppCondContentType "application/octet-stream"
, ppCondSuccessActionStatus 200
]
expirationTime = Time.addUTCTime 3600 now
postPolicyE = newPostPolicy expirationTime policyConds
size = 1000 :: Int64
inputFile <- mkRandFile size
case postPolicyE of
Left err -> liftIO $ assertFailure $ show err
Right postPolicy -> do
(url, formData) <- presignedPostPolicy postPolicy
-- liftIO (print url) >> liftIO (print formData)
result <- liftIO $ postForm url formData inputFile
liftIO $ (NC.responseStatus result == HT.status200) @?
"presigned POST failed"
mapM_ (removeObject bucket) [key]
where
postForm url formData inputFile = do
req <- NC.parseRequest $ toS url
let parts = map (\(x, y) -> Form.partBS x y) $
Map.toList formData
parts' = parts ++ [Form.partFile "file" inputFile]
req' <- Form.formDataBody parts' req
mgr <- NC.newManager NC.tlsManagerSettings
NC.httpLbs req' mgr | 1,486 | false | true | 0 | 19 | 473 | 375 | 178 | 197 | null | null |
benanhalt/haskify | Sql.hs | gpl-2.0 | query dm = do
co <- from $ (alias (getTable dm "CollectionObject") "co")
agent <- join (alias (getTable dm "Agent") "a") (
\agent -> CompEq (getField agent "agentId") (getField co "collectionObjectId"))
select "foo" | 225 | query dm = do
co <- from $ (alias (getTable dm "CollectionObject") "co")
agent <- join (alias (getTable dm "Agent") "a") (
\agent -> CompEq (getField agent "agentId") (getField co "collectionObjectId"))
select "foo" | 225 | query dm = do
co <- from $ (alias (getTable dm "CollectionObject") "co")
agent <- join (alias (getTable dm "Agent") "a") (
\agent -> CompEq (getField agent "agentId") (getField co "collectionObjectId"))
select "foo" | 225 | false | false | 1 | 14 | 42 | 103 | 47 | 56 | null | null |
TOSPIO/yi | src/library/Yi/UI/Utils.hs | gpl-2.0 | paintStrokes _ x0 lf [] = fmap (second ($ x0)) lf | 50 | paintStrokes _ x0 lf [] = fmap (second ($ x0)) lf | 50 | paintStrokes _ x0 lf [] = fmap (second ($ x0)) lf | 50 | false | false | 0 | 8 | 11 | 32 | 16 | 16 | null | null |
pscollins/Termonoid | src/Parser.hs | gpl-3.0 | stripTrailingSemiColon :: String -> String
stripTrailingSemiColon s = reverse backwards
where (';':backwards) = reverse s
-- FIXME: strip out the Maybe here | 159 | stripTrailingSemiColon :: String -> String
stripTrailingSemiColon s = reverse backwards
where (';':backwards) = reverse s
-- FIXME: strip out the Maybe here | 159 | stripTrailingSemiColon s = reverse backwards
where (';':backwards) = reverse s
-- FIXME: strip out the Maybe here | 116 | false | true | 0 | 7 | 24 | 40 | 20 | 20 | null | null |
dmgolubovsky/capri | Main.hs | bsd-3-clause | cabalCommand :: CommandUI CabalFlags
cabalCommand = CommandUI {
commandName = "cabal"
,commandSynopsis = "Invoke the cabal-install or Setup.{hs|lhs} program to run arbitrary " ++
"action on private packages"
,commandUsage = (++ " cabal -- <cabal or Setup command options>")
,commandNotes = Nothing
,commandDescription = Just $ \pname ->
"Use this command to invoke arbitrary action of cabal-install on the privately\n" ++
"installed packages. Use double-hyphen (--) before any cabal parameters to\n" ++
"avoid interpretation of them by " ++ pname ++ " as its own options.\n" ++
"If the cabal command complains about unrecognized options `--package-db' or\n" ++
"`--prefix' use -D or -P options BEFORE the double hyphen to omit them. Use -S\n" ++
"option to run the package's Setup.{hs|lhs} installation program instead of\n" ++
"cabal-install.\n\n"
,commandDefaultFlags = CabalFlags False False False
,commandOptions = const [
OptionField {
optionName = "omit-package-db"
,optionDescr = [
ChoiceOpt [
("Omit the --package-db option for cabal commands that do not understand it"
,(['D'], ["omit-package-db"])
,(\flags -> flags {pkgdb = True})
,pkgdb)
,("Omit the --prefix option for cabal commands that do not understand it"
,(['P'], ["omit-prefix"])
,(\flags -> flags {prefix = True})
,prefix)
,("Use the Setup.{hs|lhs} installation program instead of Cabal-install"
,(['S'], ["setup"])
,(\flags -> flags {setup = True})
,prefix)]
]
}
]
} | 1,709 | cabalCommand :: CommandUI CabalFlags
cabalCommand = CommandUI {
commandName = "cabal"
,commandSynopsis = "Invoke the cabal-install or Setup.{hs|lhs} program to run arbitrary " ++
"action on private packages"
,commandUsage = (++ " cabal -- <cabal or Setup command options>")
,commandNotes = Nothing
,commandDescription = Just $ \pname ->
"Use this command to invoke arbitrary action of cabal-install on the privately\n" ++
"installed packages. Use double-hyphen (--) before any cabal parameters to\n" ++
"avoid interpretation of them by " ++ pname ++ " as its own options.\n" ++
"If the cabal command complains about unrecognized options `--package-db' or\n" ++
"`--prefix' use -D or -P options BEFORE the double hyphen to omit them. Use -S\n" ++
"option to run the package's Setup.{hs|lhs} installation program instead of\n" ++
"cabal-install.\n\n"
,commandDefaultFlags = CabalFlags False False False
,commandOptions = const [
OptionField {
optionName = "omit-package-db"
,optionDescr = [
ChoiceOpt [
("Omit the --package-db option for cabal commands that do not understand it"
,(['D'], ["omit-package-db"])
,(\flags -> flags {pkgdb = True})
,pkgdb)
,("Omit the --prefix option for cabal commands that do not understand it"
,(['P'], ["omit-prefix"])
,(\flags -> flags {prefix = True})
,prefix)
,("Use the Setup.{hs|lhs} installation program instead of Cabal-install"
,(['S'], ["setup"])
,(\flags -> flags {setup = True})
,prefix)]
]
}
]
} | 1,708 | cabalCommand = CommandUI {
commandName = "cabal"
,commandSynopsis = "Invoke the cabal-install or Setup.{hs|lhs} program to run arbitrary " ++
"action on private packages"
,commandUsage = (++ " cabal -- <cabal or Setup command options>")
,commandNotes = Nothing
,commandDescription = Just $ \pname ->
"Use this command to invoke arbitrary action of cabal-install on the privately\n" ++
"installed packages. Use double-hyphen (--) before any cabal parameters to\n" ++
"avoid interpretation of them by " ++ pname ++ " as its own options.\n" ++
"If the cabal command complains about unrecognized options `--package-db' or\n" ++
"`--prefix' use -D or -P options BEFORE the double hyphen to omit them. Use -S\n" ++
"option to run the package's Setup.{hs|lhs} installation program instead of\n" ++
"cabal-install.\n\n"
,commandDefaultFlags = CabalFlags False False False
,commandOptions = const [
OptionField {
optionName = "omit-package-db"
,optionDescr = [
ChoiceOpt [
("Omit the --package-db option for cabal commands that do not understand it"
,(['D'], ["omit-package-db"])
,(\flags -> flags {pkgdb = True})
,pkgdb)
,("Omit the --prefix option for cabal commands that do not understand it"
,(['P'], ["omit-prefix"])
,(\flags -> flags {prefix = True})
,prefix)
,("Use the Setup.{hs|lhs} installation program instead of Cabal-install"
,(['S'], ["setup"])
,(\flags -> flags {setup = True})
,prefix)]
]
}
]
} | 1,671 | false | true | 0 | 18 | 479 | 269 | 164 | 105 | null | null |
bananu7/Turnip | src/Turnip/Eval/Lib.hs | mit | luarawlen :: NativeFunction
luarawlen (Str s : _) = return [Number . fromIntegral . length $ s] | 95 | luarawlen :: NativeFunction
luarawlen (Str s : _) = return [Number . fromIntegral . length $ s] | 95 | luarawlen (Str s : _) = return [Number . fromIntegral . length $ s] | 67 | false | true | 0 | 9 | 16 | 42 | 21 | 21 | null | null |
nevrenato/Hets_Fork | GUI/ShowLibGraph.hs | gpl-2.0 | -- | Displays the Specs of a Library in a Textwindow
showSpec :: LibEnv -> LibName -> IO ()
showSpec le ln =
createTextDisplay ("Contents of " ++ show ln)
$ unlines . map show . Map.keys . globalEnv
$ lookupDGraph ln le | 261 | showSpec :: LibEnv -> LibName -> IO ()
showSpec le ln =
createTextDisplay ("Contents of " ++ show ln)
$ unlines . map show . Map.keys . globalEnv
$ lookupDGraph ln le | 208 | showSpec le ln =
createTextDisplay ("Contents of " ++ show ln)
$ unlines . map show . Map.keys . globalEnv
$ lookupDGraph ln le | 169 | true | true | 0 | 13 | 84 | 73 | 35 | 38 | null | null |
spechub/Hets | CoCASL/StatAna.hs | gpl-2.0 | mapC_FORMULA :: C_FORMULA -> C_FORMULA
mapC_FORMULA = foldC_Formula (mkMixfixRecord mapC_FORMULA) mapCoRecord | 109 | mapC_FORMULA :: C_FORMULA -> C_FORMULA
mapC_FORMULA = foldC_Formula (mkMixfixRecord mapC_FORMULA) mapCoRecord | 109 | mapC_FORMULA = foldC_Formula (mkMixfixRecord mapC_FORMULA) mapCoRecord | 70 | false | true | 0 | 7 | 10 | 26 | 13 | 13 | null | null |
alexliew/learn_you_a_haskell | 4_recursion.hs | unlicense | maximum' [x] = x | 16 | maximum' [x] = x | 16 | maximum' [x] = x | 16 | false | false | 0 | 6 | 3 | 12 | 6 | 6 | null | null |
trygvis/hledger | hledger-lib/Hledger/Data/Dates.hs | gpl-3.0 | nthdayofweekcontaining n d | d1 >= d = d1
| otherwise = d2
where d1 = addDays (fromIntegral n-1) s
d2 = addDays (fromIntegral n-1) $ nextweek s
s = startofweek d
----------------------------------------------------------------------
-- parsing | 298 | nthdayofweekcontaining n d | d1 >= d = d1
| otherwise = d2
where d1 = addDays (fromIntegral n-1) s
d2 = addDays (fromIntegral n-1) $ nextweek s
s = startofweek d
----------------------------------------------------------------------
-- parsing | 298 | nthdayofweekcontaining n d | d1 >= d = d1
| otherwise = d2
where d1 = addDays (fromIntegral n-1) s
d2 = addDays (fromIntegral n-1) $ nextweek s
s = startofweek d
----------------------------------------------------------------------
-- parsing | 298 | false | false | 4 | 8 | 89 | 101 | 43 | 58 | null | null |
tek/proteome | packages/test/test/Proteome/Test/Unit.hs | mit | test ::
ProteomeTesting m n =>
Env ->
TestT n a ->
TestT m a
test =
unitTest defaultTestConfig | 104 | test ::
ProteomeTesting m n =>
Env ->
TestT n a ->
TestT m a
test =
unitTest defaultTestConfig | 104 | test =
unitTest defaultTestConfig | 35 | false | true | 0 | 9 | 28 | 47 | 20 | 27 | null | null |
damoxc/ganeti | src/Ganeti/Query/Server.hs | gpl-2.0 | runQueryD :: (FilePath, S.Socket) -> ConfigReader -> IO ()
runQueryD (socket_path, server) creader =
finally
(mainLoop creader server)
(closeServer socket_path server) | 177 | runQueryD :: (FilePath, S.Socket) -> ConfigReader -> IO ()
runQueryD (socket_path, server) creader =
finally
(mainLoop creader server)
(closeServer socket_path server) | 177 | runQueryD (socket_path, server) creader =
finally
(mainLoop creader server)
(closeServer socket_path server) | 118 | false | true | 0 | 8 | 30 | 64 | 33 | 31 | null | null |
traceguide/api-php | vendor/apache/thrift/lib/hs/src/Thrift/Protocol/JSON.hs | mit | parseJSONValue T_DOUBLE = TDouble <$> double | 44 | parseJSONValue T_DOUBLE = TDouble <$> double | 44 | parseJSONValue T_DOUBLE = TDouble <$> double | 44 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
jystic/QuickSpec | qs1/CongruenceClosure.hs | bsd-3-clause | actions :: Int -> Gen [Action]
actions 0 =
frequency [(25, liftM (NewSym:) (actions 1)),
(1, return [])] | 119 | actions :: Int -> Gen [Action]
actions 0 =
frequency [(25, liftM (NewSym:) (actions 1)),
(1, return [])] | 119 | actions 0 =
frequency [(25, liftM (NewSym:) (actions 1)),
(1, return [])] | 88 | false | true | 0 | 10 | 32 | 65 | 35 | 30 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.