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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Botje/crystal | Crystal/Parser.hs | gpl-2.0 | do' = do iterspecs <- parens (many iterspec)
(check, result) <- parens terminate
fnBody <- exprs <|> makeVoid
let vars = map (^. _1) iterspecs
let vals = map (^. _2) iterspecs
let steps = map (^. _3) iterspecs
name <- fresh "do-"
recCall <- makeAppl name steps
initCall <- makeAppl name vals
fnBody' <- makeExpr $ Begin [fnBody, recCall]
fnBody'' <- makeExpr $ If check result fnBody'
fun <- makeExpr $ Lambda vars Nothing fnBody''
makeExpr $ LetRec [(name, fun)] initCall | 582 | do' = do iterspecs <- parens (many iterspec)
(check, result) <- parens terminate
fnBody <- exprs <|> makeVoid
let vars = map (^. _1) iterspecs
let vals = map (^. _2) iterspecs
let steps = map (^. _3) iterspecs
name <- fresh "do-"
recCall <- makeAppl name steps
initCall <- makeAppl name vals
fnBody' <- makeExpr $ Begin [fnBody, recCall]
fnBody'' <- makeExpr $ If check result fnBody'
fun <- makeExpr $ Lambda vars Nothing fnBody''
makeExpr $ LetRec [(name, fun)] initCall | 582 | do' = do iterspecs <- parens (many iterspec)
(check, result) <- parens terminate
fnBody <- exprs <|> makeVoid
let vars = map (^. _1) iterspecs
let vals = map (^. _2) iterspecs
let steps = map (^. _3) iterspecs
name <- fresh "do-"
recCall <- makeAppl name steps
initCall <- makeAppl name vals
fnBody' <- makeExpr $ Begin [fnBody, recCall]
fnBody'' <- makeExpr $ If check result fnBody'
fun <- makeExpr $ Lambda vars Nothing fnBody''
makeExpr $ LetRec [(name, fun)] initCall | 582 | false | false | 0 | 11 | 191 | 214 | 101 | 113 | null | null |
RaminHAL9001/inf-interval | src/Numeric/Interval/Infinite.hs | gpl-3.0 | member :: (Ord c, InfBound c) => Set c -> c -> Bool
member (Set s) b = _member (_listSet s) b | 93 | member :: (Ord c, InfBound c) => Set c -> c -> Bool
member (Set s) b = _member (_listSet s) b | 93 | member (Set s) b = _member (_listSet s) b | 41 | false | true | 0 | 7 | 21 | 59 | 29 | 30 | null | null |
robinp/nemnem | nemnem-lib/src/Language/Haskell/Nemnem/Printer.hs | bsd-3-clause | tagToBlaze :: (Maybe MName -> Text) -- ^ How to get url path from module
-> Maybe MName -> Tag -> B.Markup -> B.Markup
tagToBlaze module_to_path current_module t = case t of
LinkTo link_module location ->
if current_module == link_module
then BH.a
! BA.href (B.toValue$ "#" <> location)
! highlightOnHover True location
else let mname = module_to_path link_module
href = mname <> "#" <> location
in BH.a
! BA.href (B.toValue href)
! highlightOnHover False href
LineEnd -> const BH.br
Entity location ->
BH.a
! BA.name (B.toValue location)
! highlightOnHover True location
Warning txt ->
BH.span
! BA.class_ "warning"
! BH.dataAttribute "warning" (B.toValue txt)
HighlightClass cls ->
BH.span ! BA.class_ (B.toValue cls)
where
highlightOnHover is_local arg =
let function = if is_local
then "highlightLocalToLocal"
else "highlightLocalToRemote"
in BA.onmouseover . B.toValue . mconcat $
["nemnem.", function, "('", arg, "')"] | 1,108 | tagToBlaze :: (Maybe MName -> Text) -- ^ How to get url path from module
-> Maybe MName -> Tag -> B.Markup -> B.Markup
tagToBlaze module_to_path current_module t = case t of
LinkTo link_module location ->
if current_module == link_module
then BH.a
! BA.href (B.toValue$ "#" <> location)
! highlightOnHover True location
else let mname = module_to_path link_module
href = mname <> "#" <> location
in BH.a
! BA.href (B.toValue href)
! highlightOnHover False href
LineEnd -> const BH.br
Entity location ->
BH.a
! BA.name (B.toValue location)
! highlightOnHover True location
Warning txt ->
BH.span
! BA.class_ "warning"
! BH.dataAttribute "warning" (B.toValue txt)
HighlightClass cls ->
BH.span ! BA.class_ (B.toValue cls)
where
highlightOnHover is_local arg =
let function = if is_local
then "highlightLocalToLocal"
else "highlightLocalToRemote"
in BA.onmouseover . B.toValue . mconcat $
["nemnem.", function, "('", arg, "')"] | 1,108 | tagToBlaze module_to_path current_module t = case t of
LinkTo link_module location ->
if current_module == link_module
then BH.a
! BA.href (B.toValue$ "#" <> location)
! highlightOnHover True location
else let mname = module_to_path link_module
href = mname <> "#" <> location
in BH.a
! BA.href (B.toValue href)
! highlightOnHover False href
LineEnd -> const BH.br
Entity location ->
BH.a
! BA.name (B.toValue location)
! highlightOnHover True location
Warning txt ->
BH.span
! BA.class_ "warning"
! BH.dataAttribute "warning" (B.toValue txt)
HighlightClass cls ->
BH.span ! BA.class_ (B.toValue cls)
where
highlightOnHover is_local arg =
let function = if is_local
then "highlightLocalToLocal"
else "highlightLocalToRemote"
in BA.onmouseover . B.toValue . mconcat $
["nemnem.", function, "('", arg, "')"] | 977 | false | true | 1 | 16 | 320 | 353 | 170 | 183 | null | null |
paulrzcz/takusen-oracle | Database/Enumerator.hs | bsd-3-clause | | Returns the number of rows affected.
execDML :: IE.Command stmt s => stmt -> DBM mark s Int
execDML = executeCommand
| 125 | execDML :: IE.Command stmt s => stmt -> DBM mark s Int
execDML = executeCommand | 79 | execDML = executeCommand | 24 | true | true | 2 | 8 | 27 | 52 | 24 | 28 | null | null |
ejlilley/AbstractMusic | Music.hs | gpl-3.0 | countComp _ = 0 | 15 | countComp _ = 0 | 15 | countComp _ = 0 | 15 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
mischel/tct-trs-gubs | app/Main.hs | bsd-3-clause | sccs = [minBound ..] :: [G.SCC] | 36 | sccs = [minBound ..] :: [G.SCC] | 36 | sccs = [minBound ..] :: [G.SCC] | 36 | false | false | 0 | 6 | 10 | 21 | 12 | 9 | null | null |
quchen/shaking-up-ghc | src/GHC.hs | bsd-3-clause | rts = topLevel "rts" | 32 | rts = topLevel "rts" | 32 | rts = topLevel "rts" | 32 | false | false | 1 | 5 | 15 | 13 | 4 | 9 | null | null |
dorlowd/haskell-servant-realworld-example-app | src/DB.hs | mit | dbUpdateUser :: Connection -> DBUser -> IO (Maybe DBUser)
dbUpdateUser conn DBUser {..} = do
-- Check if name or email are already taken.
existingUsers <-
dbGetUsersByNameOrEmail conn usrUsername usrEmail
let existingUsers' = filter (\x -> (userToId x) /= usrId) existingUsers
case null existingUsers' of
False -> return Nothing
True -> do
_ <- execute conn stmt args
return $ Just DBUser {..}
where
args =
toRow
( usrEmail
, usrUsername
, unPassword usrPassword
, usrBio
, usrImage
, usrId)
stmt =
"UPDATE users \
\ SET usr_email = ? \
\ , usr_username = ? \
\ , usr_password = ? \
\ , usr_bio = ? \
\ , usr_image = ? \
\ WHERE \
\ usr_id = ?" | 826 | dbUpdateUser :: Connection -> DBUser -> IO (Maybe DBUser)
dbUpdateUser conn DBUser {..} = do
-- Check if name or email are already taken.
existingUsers <-
dbGetUsersByNameOrEmail conn usrUsername usrEmail
let existingUsers' = filter (\x -> (userToId x) /= usrId) existingUsers
case null existingUsers' of
False -> return Nothing
True -> do
_ <- execute conn stmt args
return $ Just DBUser {..}
where
args =
toRow
( usrEmail
, usrUsername
, unPassword usrPassword
, usrBio
, usrImage
, usrId)
stmt =
"UPDATE users \
\ SET usr_email = ? \
\ , usr_username = ? \
\ , usr_password = ? \
\ , usr_bio = ? \
\ , usr_image = ? \
\ WHERE \
\ usr_id = ?" | 826 | dbUpdateUser conn DBUser {..} = do
-- Check if name or email are already taken.
existingUsers <-
dbGetUsersByNameOrEmail conn usrUsername usrEmail
let existingUsers' = filter (\x -> (userToId x) /= usrId) existingUsers
case null existingUsers' of
False -> return Nothing
True -> do
_ <- execute conn stmt args
return $ Just DBUser {..}
where
args =
toRow
( usrEmail
, usrUsername
, unPassword usrPassword
, usrBio
, usrImage
, usrId)
stmt =
"UPDATE users \
\ SET usr_email = ? \
\ , usr_username = ? \
\ , usr_password = ? \
\ , usr_bio = ? \
\ , usr_image = ? \
\ WHERE \
\ usr_id = ?" | 768 | false | true | 2 | 15 | 303 | 178 | 87 | 91 | null | null |
Lainepress/hledger | hledger-lib/Hledger/Utils.hs | gpl-3.0 | regexReplace :: String -> String -> String -> String
regexReplace r repl s = gsubRegexPR r repl s | 97 | regexReplace :: String -> String -> String -> String
regexReplace r repl s = gsubRegexPR r repl s | 97 | regexReplace r repl s = gsubRegexPR r repl s | 44 | false | true | 0 | 9 | 17 | 42 | 19 | 23 | null | null |
conal/Boolean | src/Data/Boolean.hs | bsd-3-clause | -- | Point-wise conditional
cond :: (Applicative f, IfB a, bool ~ BooleanOf a) => f bool -> f a -> f a -> f a
cond = liftA3 ifB | 127 | cond :: (Applicative f, IfB a, bool ~ BooleanOf a) => f bool -> f a -> f a -> f a
cond = liftA3 ifB | 99 | cond = liftA3 ifB | 17 | true | true | 0 | 9 | 29 | 65 | 31 | 34 | null | null |
damianfral/clay | src/Clay/Gradient.hs | bsd-3-clause | -------------------------------------------------------------------------------
linearGradient :: Direction -> Ramp -> BackgroundImage
linearGradient d xs = other $ Value $
let Value v = "linear-gradient(" <> value d <> "," <> ramp xs <> ")"
in browsers <> v | 264 | linearGradient :: Direction -> Ramp -> BackgroundImage
linearGradient d xs = other $ Value $
let Value v = "linear-gradient(" <> value d <> "," <> ramp xs <> ")"
in browsers <> v | 183 | linearGradient d xs = other $ Value $
let Value v = "linear-gradient(" <> value d <> "," <> ramp xs <> ")"
in browsers <> v | 128 | true | true | 6 | 13 | 40 | 83 | 36 | 47 | null | null |
dmjio/aeson | src/Data/Aeson/KeyMap.hs | bsd-3-clause | -- | The union with a combining function.
unionWithKey :: (Key -> v -> v -> v) -> KeyMap v -> KeyMap v -> KeyMap v
unionWithKey f (KeyMap x) (KeyMap y) = KeyMap (M.unionWithKey f x y) | 183 | unionWithKey :: (Key -> v -> v -> v) -> KeyMap v -> KeyMap v -> KeyMap v
unionWithKey f (KeyMap x) (KeyMap y) = KeyMap (M.unionWithKey f x y) | 141 | unionWithKey f (KeyMap x) (KeyMap y) = KeyMap (M.unionWithKey f x y) | 68 | true | true | 0 | 11 | 37 | 86 | 41 | 45 | null | null |
charleso/intellij-haskforce | tests/gold/codeInsight/FunctionUsagesInSingleFile00001.hs | apache-2.0 | boring :: ()
boring = const () (funny 18) | 41 | boring :: ()
boring = const () (funny 18) | 41 | boring = const () (funny 18) | 28 | false | true | 0 | 7 | 8 | 26 | 13 | 13 | null | null |
ingemaradahl/bilder | src/bildc.hs | lgpl-3.0 | parseArgs ∷ [String] → State Options Bool
parseArgs [] = return False | 69 | parseArgs ∷ [String] → State Options Bool
parseArgs [] = return False | 69 | parseArgs [] = return False | 27 | false | true | 0 | 8 | 11 | 36 | 16 | 20 | null | null |
timtylin/scholdoc | src/Text/Pandoc/Readers/HTML.hs | gpl-2.0 | tagToString _ = "" | 18 | tagToString _ = "" | 18 | tagToString _ = "" | 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Vector.Fusion.Bundle.Size.hs | bsd-3-clause | upperBound Unknown = Nothing | 30 | upperBound Unknown = Nothing | 30 | upperBound Unknown = Nothing | 30 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
tilltheis/propositional-logic | src/Data/Foldable.hs | bsd-3-clause | -- | Evaluate each monadic action in the structure from left to right,
-- and ignore the results.
sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
sequence_ = foldr (>>) (return ()) | 186 | sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
sequence_ = foldr (>>) (return ()) | 88 | sequence_ = foldr (>>) (return ()) | 34 | true | true | 0 | 9 | 36 | 61 | 32 | 29 | null | null |
biegunka/biegunka | src/Control/Biegunka/Script.hs | mit | -- | Current user
activeUser :: Lens' Annotations (Maybe User)
activeUser f x = f (_activeUser x) <&> \y -> x { _activeUser = y } | 129 | activeUser :: Lens' Annotations (Maybe User)
activeUser f x = f (_activeUser x) <&> \y -> x { _activeUser = y } | 111 | activeUser f x = f (_activeUser x) <&> \y -> x { _activeUser = y } | 66 | true | true | 1 | 9 | 25 | 58 | 28 | 30 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT43.hs | gpl-3.0 | length (_:xs) = S (length xs) | 29 | length (_:xs) = S (length xs) | 29 | length (_:xs) = S (length xs) | 29 | false | false | 0 | 6 | 5 | 26 | 12 | 14 | null | null |
Teaspot-Studio/gore-and-ash-game | src/client/Math/Plane.hs | bsd-3-clause | -- | Returns True if all points lies on single line
colinear :: V3 Float -> V3 Float -> V3 Float -> Bool
colinear a b c = let s = norm ((b - a) `cross` (c - a)) in s < 0.000001 | 176 | colinear :: V3 Float -> V3 Float -> V3 Float -> Bool
colinear a b c = let s = norm ((b - a) `cross` (c - a)) in s < 0.000001 | 124 | colinear a b c = let s = norm ((b - a) `cross` (c - a)) in s < 0.000001 | 71 | true | true | 0 | 13 | 42 | 81 | 41 | 40 | null | null |
foreverbell/unlimited-plt-toys | tapl/untyped/Test.hs | bsd-3-clause | testCount :: Int
testCount = 9 | 30 | testCount :: Int
testCount = 9 | 30 | testCount = 9 | 13 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
lovasko/goat | src/Codec/Goat/Util.hs | bsd-2-clause | packBits :: [Bool] -- ^ bits
-> B.ByteString -- ^ bytestring
packBits xs = B.pack $ map fromBools (chunksOf 8 xs) | 128 | packBits :: [Bool] -- ^ bits
-> B.ByteString
packBits xs = B.pack $ map fromBools (chunksOf 8 xs) | 112 | packBits xs = B.pack $ map fromBools (chunksOf 8 xs) | 52 | true | true | 0 | 8 | 35 | 49 | 24 | 25 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxLITTLE_ENDIAN :: Int
wxLITTLE_ENDIAN = 1234 | 45 | wxLITTLE_ENDIAN :: Int
wxLITTLE_ENDIAN = 1234 | 45 | wxLITTLE_ENDIAN = 1234 | 22 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
zeyuanxy/haskell-playground | ninety-nine-haskell-problems/vol5/48.hs | mit | xor' False True = True | 22 | xor' False True = True | 22 | xor' False True = True | 22 | false | false | 0 | 5 | 4 | 13 | 5 | 8 | null | null |
ckaestne/CIDE | other/CaseStudies/fgl/CIDEfgl/Data/Graph/Inductive/Graph.hs | gpl-3.0 | insNode :: (DynGraph gr) => LNode a -> gr a b -> gr a b;
insNode (v, l) = (([], v, l, []) &) | 94 | insNode :: (DynGraph gr) => LNode a -> gr a b -> gr a b
insNode (v, l) = (([], v, l, []) &) | 91 | insNode (v, l) = (([], v, l, []) &) | 35 | false | true | 0 | 8 | 25 | 76 | 40 | 36 | null | null |
GaloisInc/halvm-ghc | libraries/template-haskell/Language/Haskell/TH/Ppr.hs | bsd-3-clause | -- This will probably break with fixity declarations - would need a ';'
pprExp _ (CompE ss) =
if null ss'
-- If there are no statements in a list comprehension besides the last
-- one, we simply treat it like a normal list.
then text "[" <> ppr s <> text "]"
else text "[" <> ppr s
<+> text "|"
<+> commaSep ss'
<> text "]"
where s = last ss
ss' = init ss | 422 | pprExp _ (CompE ss) =
if null ss'
-- If there are no statements in a list comprehension besides the last
-- one, we simply treat it like a normal list.
then text "[" <> ppr s <> text "]"
else text "[" <> ppr s
<+> text "|"
<+> commaSep ss'
<> text "]"
where s = last ss
ss' = init ss | 350 | pprExp _ (CompE ss) =
if null ss'
-- If there are no statements in a list comprehension besides the last
-- one, we simply treat it like a normal list.
then text "[" <> ppr s <> text "]"
else text "[" <> ppr s
<+> text "|"
<+> commaSep ss'
<> text "]"
where s = last ss
ss' = init ss | 350 | true | false | 11 | 8 | 143 | 111 | 46 | 65 | null | null |
cpennington/h4sh | Build.hs | gpl-2.0 | version :: [Char]
version = "0.3" | 33 | version :: [Char]
version = "0.3" | 33 | version = "0.3" | 15 | false | true | 0 | 5 | 5 | 14 | 8 | 6 | null | null |
abstools/abs-haskell-formal | benchmarks/6_hanoi/progs/18.hs | bsd-3-clause | (a:b:tmp:n:n1:res:the_end:_)=[1..] | 34 | (a:b:tmp:n:n1:res:the_end:_)=[1..] | 34 | (a:b:tmp:n:n1:res:the_end:_)=[1..] | 34 | false | false | 0 | 12 | 0 | 41 | 21 | 20 | null | null |
brendanhay/gogol | gogol-firestore/gen/Network/Google/FireStore/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'RunQueryResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rReadTime'
--
-- * 'rSkippedResults'
--
-- * 'rTransaction'
--
-- * 'rDocument'
runQueryResponse
:: RunQueryResponse
runQueryResponse =
RunQueryResponse'
{ _rReadTime = Nothing
, _rSkippedResults = Nothing
, _rTransaction = Nothing
, _rDocument = Nothing
} | 459 | runQueryResponse
:: RunQueryResponse
runQueryResponse =
RunQueryResponse'
{ _rReadTime = Nothing
, _rSkippedResults = Nothing
, _rTransaction = Nothing
, _rDocument = Nothing
} | 202 | runQueryResponse =
RunQueryResponse'
{ _rReadTime = Nothing
, _rSkippedResults = Nothing
, _rTransaction = Nothing
, _rDocument = Nothing
} | 161 | true | true | 1 | 7 | 94 | 55 | 35 | 20 | null | null |
gcampax/ghc | compiler/main/DynFlags.hs | bsd-3-clause | default_PIC :: Platform -> [GeneralFlag]
default_PIC platform =
case (platformOS platform, platformArch platform) of
(OSDarwin, ArchX86_64) -> [Opt_PIC]
_ -> [] | 191 | default_PIC :: Platform -> [GeneralFlag]
default_PIC platform =
case (platformOS platform, platformArch platform) of
(OSDarwin, ArchX86_64) -> [Opt_PIC]
_ -> [] | 191 | default_PIC platform =
case (platformOS platform, platformArch platform) of
(OSDarwin, ArchX86_64) -> [Opt_PIC]
_ -> [] | 150 | false | true | 2 | 7 | 51 | 62 | 32 | 30 | null | null |
travitch/dalvik | src/Dalvik/SSA/ClassHierarchy.hs | bsd-3-clause | addClass :: Class -> ClassHierarchy -> ClassHierarchy
addClass klass ch =
ch { hierarchy = case classParent klass of
Nothing -> hierarchy ch
Just parent -> HM.insert (classType klass) parent (hierarchy ch)
, children = case classParent klass of
Nothing -> children ch
Just parent -> HM.insertWith (++) parent [classType klass] (children ch)
, implementors =
L.foldl' (\m i -> HM.insertWith (++) i [classType klass] m)
(implementors ch)
(classInterfaces klass)
, typeToClassMap = HM.insert (classType klass) klass (typeToClassMap ch)
} | 641 | addClass :: Class -> ClassHierarchy -> ClassHierarchy
addClass klass ch =
ch { hierarchy = case classParent klass of
Nothing -> hierarchy ch
Just parent -> HM.insert (classType klass) parent (hierarchy ch)
, children = case classParent klass of
Nothing -> children ch
Just parent -> HM.insertWith (++) parent [classType klass] (children ch)
, implementors =
L.foldl' (\m i -> HM.insertWith (++) i [classType klass] m)
(implementors ch)
(classInterfaces klass)
, typeToClassMap = HM.insert (classType klass) klass (typeToClassMap ch)
} | 641 | addClass klass ch =
ch { hierarchy = case classParent klass of
Nothing -> hierarchy ch
Just parent -> HM.insert (classType klass) parent (hierarchy ch)
, children = case classParent klass of
Nothing -> children ch
Just parent -> HM.insertWith (++) parent [classType klass] (children ch)
, implementors =
L.foldl' (\m i -> HM.insertWith (++) i [classType klass] m)
(implementors ch)
(classInterfaces klass)
, typeToClassMap = HM.insert (classType klass) klass (typeToClassMap ch)
} | 587 | false | true | 0 | 12 | 186 | 217 | 110 | 107 | null | null |
rzil/honours | LeavittPathAlgebras/WeightedLPA.hs | mit | (*:) _ Zero = Zero | 18 | (*:) _ Zero = Zero | 18 | (*:) _ Zero = Zero | 18 | false | false | 1 | 5 | 4 | 15 | 7 | 8 | null | null |
tidalcycles/Tidal | src/Sound/Tidal/UI.hs | gpl-3.0 | chunk' :: Integral a1 => Pattern a1 -> (Pattern a2 -> Pattern a2) -> Pattern a2 -> Pattern a2
chunk' npat f p = innerJoin $ (\n -> _chunk' n f p) <$> npat | 154 | chunk' :: Integral a1 => Pattern a1 -> (Pattern a2 -> Pattern a2) -> Pattern a2 -> Pattern a2
chunk' npat f p = innerJoin $ (\n -> _chunk' n f p) <$> npat | 154 | chunk' npat f p = innerJoin $ (\n -> _chunk' n f p) <$> npat | 60 | false | true | 0 | 10 | 33 | 87 | 40 | 47 | null | null |
locaweb/leela | src/warpdrive/src/Leela/Data/Timeout.hs | apache-2.0 | executeOnce :: IORef (IO ()) -> IO ()
executeOnce ioref = do
join $ atomicModifyIORef' ioref (\io -> (return (), io)) | 119 | executeOnce :: IORef (IO ()) -> IO ()
executeOnce ioref = do
join $ atomicModifyIORef' ioref (\io -> (return (), io)) | 119 | executeOnce ioref = do
join $ atomicModifyIORef' ioref (\io -> (return (), io)) | 81 | false | true | 0 | 13 | 22 | 65 | 32 | 33 | null | null |
danr/hipspec | src/HipSpec/Lang/Renamer.hs | gpl-3.0 | disambig2 :: (a -> String) -> (b -> String) -> Suggestor (Either a b) String
disambig2 f _ (Left a) = disambig f a | 115 | disambig2 :: (a -> String) -> (b -> String) -> Suggestor (Either a b) String
disambig2 f _ (Left a) = disambig f a | 115 | disambig2 f _ (Left a) = disambig f a | 38 | false | true | 0 | 9 | 24 | 64 | 32 | 32 | null | null |
abhinav/farmhash | test/FarmHashSpec.hs | bsd-3-clause | spec :: Spec
spec = do
checkBasic [
("hash", hash)
, ("hash32", hash32)
, ("fingerprint32", fingerprint32)
]
checkBasic [("hash64", hash64), ("fingerprint64", fingerprint64)]
checkSeeded "hash32WithSeed" hash32WithSeed
checkSeeded "hash64WithSeed" hash64WithSeed
describe "hash64WithSeeds" $ do
prop "operates on bytestrings" $ \len seed1 seed2 -> do
s <- byteStringOfLength len
hash64WithSeeds s seed1 seed2 `shouldSatisfy` (> 0)
prop "operates on subsrings" $ \len seed1 seed2 tak drp -> do
s <- byteStringOfLength len
hash64WithSeeds (B.take tak (B.drop drp s)) seed1 seed2
`shouldSatisfy` (> 0)
where
checkBasic h = forM_ h $ \(name, func) -> describe name $ do
prop "operates on bytestrings" $ \len -> do
s <- byteStringOfLength len
func s `shouldSatisfy` (> 0)
prop "operates on substrings" $ \tak drp len -> do
s <- byteStringOfLength len
func (B.take tak (B.drop drp s))
`shouldSatisfy` (> 0)
checkSeeded name func = describe name $ do
prop "operates on bytestrings" $ \len seed -> do
s <- byteStringOfLength len
func s seed `shouldSatisfy` (> 0)
prop "operates on subsrings" $ \len seed tak drp -> do
s <- byteStringOfLength len
func (B.take tak (B.drop drp s)) seed
`shouldSatisfy` (> 0) | 1,499 | spec :: Spec
spec = do
checkBasic [
("hash", hash)
, ("hash32", hash32)
, ("fingerprint32", fingerprint32)
]
checkBasic [("hash64", hash64), ("fingerprint64", fingerprint64)]
checkSeeded "hash32WithSeed" hash32WithSeed
checkSeeded "hash64WithSeed" hash64WithSeed
describe "hash64WithSeeds" $ do
prop "operates on bytestrings" $ \len seed1 seed2 -> do
s <- byteStringOfLength len
hash64WithSeeds s seed1 seed2 `shouldSatisfy` (> 0)
prop "operates on subsrings" $ \len seed1 seed2 tak drp -> do
s <- byteStringOfLength len
hash64WithSeeds (B.take tak (B.drop drp s)) seed1 seed2
`shouldSatisfy` (> 0)
where
checkBasic h = forM_ h $ \(name, func) -> describe name $ do
prop "operates on bytestrings" $ \len -> do
s <- byteStringOfLength len
func s `shouldSatisfy` (> 0)
prop "operates on substrings" $ \tak drp len -> do
s <- byteStringOfLength len
func (B.take tak (B.drop drp s))
`shouldSatisfy` (> 0)
checkSeeded name func = describe name $ do
prop "operates on bytestrings" $ \len seed -> do
s <- byteStringOfLength len
func s seed `shouldSatisfy` (> 0)
prop "operates on subsrings" $ \len seed tak drp -> do
s <- byteStringOfLength len
func (B.take tak (B.drop drp s)) seed
`shouldSatisfy` (> 0) | 1,499 | spec = do
checkBasic [
("hash", hash)
, ("hash32", hash32)
, ("fingerprint32", fingerprint32)
]
checkBasic [("hash64", hash64), ("fingerprint64", fingerprint64)]
checkSeeded "hash32WithSeed" hash32WithSeed
checkSeeded "hash64WithSeed" hash64WithSeed
describe "hash64WithSeeds" $ do
prop "operates on bytestrings" $ \len seed1 seed2 -> do
s <- byteStringOfLength len
hash64WithSeeds s seed1 seed2 `shouldSatisfy` (> 0)
prop "operates on subsrings" $ \len seed1 seed2 tak drp -> do
s <- byteStringOfLength len
hash64WithSeeds (B.take tak (B.drop drp s)) seed1 seed2
`shouldSatisfy` (> 0)
where
checkBasic h = forM_ h $ \(name, func) -> describe name $ do
prop "operates on bytestrings" $ \len -> do
s <- byteStringOfLength len
func s `shouldSatisfy` (> 0)
prop "operates on substrings" $ \tak drp len -> do
s <- byteStringOfLength len
func (B.take tak (B.drop drp s))
`shouldSatisfy` (> 0)
checkSeeded name func = describe name $ do
prop "operates on bytestrings" $ \len seed -> do
s <- byteStringOfLength len
func s seed `shouldSatisfy` (> 0)
prop "operates on subsrings" $ \len seed tak drp -> do
s <- byteStringOfLength len
func (B.take tak (B.drop drp s)) seed
`shouldSatisfy` (> 0) | 1,486 | false | true | 0 | 20 | 487 | 496 | 245 | 251 | null | null |
gittywithexcitement/hindent | src/HIndent/Pretty.hs | bsd-3-clause | exp (Lambda _ ps e) =
depend (write "\\")
(do spaced (map pretty ps)
swing (write " -> ")
(pretty e)) | 144 | exp (Lambda _ ps e) =
depend (write "\\")
(do spaced (map pretty ps)
swing (write " -> ")
(pretty e)) | 144 | exp (Lambda _ ps e) =
depend (write "\\")
(do spaced (map pretty ps)
swing (write " -> ")
(pretty e)) | 144 | false | false | 0 | 11 | 63 | 67 | 31 | 36 | null | null |
adamwalker/haskell_cudd | Cudd/Imperative.hs | bsd-3-clause | xEqY :: DDManager s u -> [DDNode s u] -> [DDNode s u] -> ST s (DDNode s u)
xEqY (DDManager m) xs ys = unsafeIOToST $
withArrayLen (map unDDNode xs) $ \xl xp ->
withArrayLen (map unDDNode ys) $ \yl yp -> do
when (xl /= yl) (error "xeqy: lengths not equal")
res <- c_cuddXeqy m (fromIntegral xl) xp yp
return $ DDNode res | 341 | xEqY :: DDManager s u -> [DDNode s u] -> [DDNode s u] -> ST s (DDNode s u)
xEqY (DDManager m) xs ys = unsafeIOToST $
withArrayLen (map unDDNode xs) $ \xl xp ->
withArrayLen (map unDDNode ys) $ \yl yp -> do
when (xl /= yl) (error "xeqy: lengths not equal")
res <- c_cuddXeqy m (fromIntegral xl) xp yp
return $ DDNode res | 341 | xEqY (DDManager m) xs ys = unsafeIOToST $
withArrayLen (map unDDNode xs) $ \xl xp ->
withArrayLen (map unDDNode ys) $ \yl yp -> do
when (xl /= yl) (error "xeqy: lengths not equal")
res <- c_cuddXeqy m (fromIntegral xl) xp yp
return $ DDNode res | 266 | false | true | 0 | 14 | 86 | 171 | 82 | 89 | null | null |
spinda/liquidhaskell | tests/gsoc15/unknown/pos/propmeasure.hs | bsd-3-clause | lenNEqFive [] = True | 24 | lenNEqFive [] = True | 24 | lenNEqFive [] = True | 24 | false | false | 0 | 6 | 7 | 11 | 5 | 6 | null | null |
sdiehl/ghc | testsuite/tests/typecheck/should_compile/Vta1.hs | bsd-3-clause | pairup_nosig x y = (x, y) | 25 | pairup_nosig x y = (x, y) | 25 | pairup_nosig x y = (x, y) | 25 | false | false | 0 | 5 | 5 | 17 | 9 | 8 | null | null |
vincenthz/cryptonite | tests/KAT_AESGCMSIV.hs | bsd-3-clause | makeEncryptionTest :: BlockCipher128 aes => Int -> Vector aes -> TestTree
makeEncryptionTest i vec@Vector{..} =
testCase (show i) $
(t, vecCiphertext) @=? encrypt (vecCipher vec) n vecAAD vecPlaintext
where t = AuthTag (B.convert vecTag)
n = throwCryptoError (nonce vecNonce) | 297 | makeEncryptionTest :: BlockCipher128 aes => Int -> Vector aes -> TestTree
makeEncryptionTest i vec@Vector{..} =
testCase (show i) $
(t, vecCiphertext) @=? encrypt (vecCipher vec) n vecAAD vecPlaintext
where t = AuthTag (B.convert vecTag)
n = throwCryptoError (nonce vecNonce) | 297 | makeEncryptionTest i vec@Vector{..} =
testCase (show i) $
(t, vecCiphertext) @=? encrypt (vecCipher vec) n vecAAD vecPlaintext
where t = AuthTag (B.convert vecTag)
n = throwCryptoError (nonce vecNonce) | 223 | false | true | 0 | 10 | 60 | 113 | 56 | 57 | null | null |
diku-dk/futhark | src/Futhark/CodeGen/ImpGen/GPU.hs | isc | compileProgOpenCL,
compileProgCUDA ::
MonadFreshNames m => Prog GPUMem -> m (Warnings, Imp.Program)
compileProgOpenCL = compileProg $ HostEnv openclAtomics OpenCL mempty | 175 | compileProgOpenCL,
compileProgCUDA ::
MonadFreshNames m => Prog GPUMem -> m (Warnings, Imp.Program)
compileProgOpenCL = compileProg $ HostEnv openclAtomics OpenCL mempty | 175 | compileProgOpenCL = compileProg $ HostEnv openclAtomics OpenCL mempty | 69 | false | true | 0 | 9 | 25 | 49 | 25 | 24 | null | null |
judah/tensorflow-haskell | tensorflow-opgen/src/TensorFlow/OpGen/ParsedOp.hs | apache-2.0 | parseOp :: OpDef -> ParsedOp
parseOp o = ParsedOp
{ parsedOpName = makeName $ o ^. name
, parsedOpSummary = o ^. summary
, parsedOpDescription = o ^. description
, ..
}
where
parsedOpIsMonadic = o ^. isStateful
|| any (isRefCase . parsedArgCase) parsedInputs
|| null (o ^. outputArg)
parsedInputs = zipWith (\t a -> parseArg a (inputTensorKind t a))
tensorKindParams (o ^. inputArg)
tensorKindParams = ["v'" <> Text.pack (show x) | x <- [1::Integer ..]]
parsedOutputs = map (\a -> parseArg a (outputTensorKind parsedOpIsMonadic a))
(o ^. outputArg)
-- Integer attributes that can be inferred from the size of at least one
-- input list.
inferredListSizeAttrs = mapMaybeAttrs (getInferredListSizeAttr parsedInputs)
$ o ^. attr
implicitAttrs = Set.fromList $ map tfName $
map attrName inferredTypeAttrs
++ map attrName inferredListSizeAttrs
inferredTypeAttrs = mapMaybeAttrs (getInferredTypeAttr argTypeParams) $ o ^. attr
argTypeParams = Set.fromList $ map tfName $
mapMaybe (getArgTypeParam . parsedArgCase) $
parsedInputs ++ parsedOutputs
-- Attributes that can't be inferred and don't have defaults, so must be
-- passed as separate arguments to the op.
explicitInputAttrs = sortBy (comparing (tfName . attrName))
$ mapMaybeAttrs (getExplicitInputAttr o implicitAttrs)
$ o ^. attr
-- TODO(judahjacobson): Some arguments should be refs. | 1,701 | parseOp :: OpDef -> ParsedOp
parseOp o = ParsedOp
{ parsedOpName = makeName $ o ^. name
, parsedOpSummary = o ^. summary
, parsedOpDescription = o ^. description
, ..
}
where
parsedOpIsMonadic = o ^. isStateful
|| any (isRefCase . parsedArgCase) parsedInputs
|| null (o ^. outputArg)
parsedInputs = zipWith (\t a -> parseArg a (inputTensorKind t a))
tensorKindParams (o ^. inputArg)
tensorKindParams = ["v'" <> Text.pack (show x) | x <- [1::Integer ..]]
parsedOutputs = map (\a -> parseArg a (outputTensorKind parsedOpIsMonadic a))
(o ^. outputArg)
-- Integer attributes that can be inferred from the size of at least one
-- input list.
inferredListSizeAttrs = mapMaybeAttrs (getInferredListSizeAttr parsedInputs)
$ o ^. attr
implicitAttrs = Set.fromList $ map tfName $
map attrName inferredTypeAttrs
++ map attrName inferredListSizeAttrs
inferredTypeAttrs = mapMaybeAttrs (getInferredTypeAttr argTypeParams) $ o ^. attr
argTypeParams = Set.fromList $ map tfName $
mapMaybe (getArgTypeParam . parsedArgCase) $
parsedInputs ++ parsedOutputs
-- Attributes that can't be inferred and don't have defaults, so must be
-- passed as separate arguments to the op.
explicitInputAttrs = sortBy (comparing (tfName . attrName))
$ mapMaybeAttrs (getExplicitInputAttr o implicitAttrs)
$ o ^. attr
-- TODO(judahjacobson): Some arguments should be refs. | 1,701 | parseOp o = ParsedOp
{ parsedOpName = makeName $ o ^. name
, parsedOpSummary = o ^. summary
, parsedOpDescription = o ^. description
, ..
}
where
parsedOpIsMonadic = o ^. isStateful
|| any (isRefCase . parsedArgCase) parsedInputs
|| null (o ^. outputArg)
parsedInputs = zipWith (\t a -> parseArg a (inputTensorKind t a))
tensorKindParams (o ^. inputArg)
tensorKindParams = ["v'" <> Text.pack (show x) | x <- [1::Integer ..]]
parsedOutputs = map (\a -> parseArg a (outputTensorKind parsedOpIsMonadic a))
(o ^. outputArg)
-- Integer attributes that can be inferred from the size of at least one
-- input list.
inferredListSizeAttrs = mapMaybeAttrs (getInferredListSizeAttr parsedInputs)
$ o ^. attr
implicitAttrs = Set.fromList $ map tfName $
map attrName inferredTypeAttrs
++ map attrName inferredListSizeAttrs
inferredTypeAttrs = mapMaybeAttrs (getInferredTypeAttr argTypeParams) $ o ^. attr
argTypeParams = Set.fromList $ map tfName $
mapMaybe (getArgTypeParam . parsedArgCase) $
parsedInputs ++ parsedOutputs
-- Attributes that can't be inferred and don't have defaults, so must be
-- passed as separate arguments to the op.
explicitInputAttrs = sortBy (comparing (tfName . attrName))
$ mapMaybeAttrs (getExplicitInputAttr o implicitAttrs)
$ o ^. attr
-- TODO(judahjacobson): Some arguments should be refs. | 1,672 | false | true | 0 | 12 | 560 | 385 | 200 | 185 | null | null |
HaskellAmbiguity/AmbiguityGenerator | app/Main.hs | mit | plotShuffleAmbiguity :: Int -> Int -> Integer -> IO (Renderable (LayoutPick Double Double Double))
plotShuffleAmbiguity runs samples range
= fmap (gridToRenderable . aboveN) $ replicateM runs makePlot
where
makePlot :: IO (Grid (Renderable (LayoutPick Double Double Double)))
makePlot = do ambi <- mkAmbiGen (1 / fromIntegral samples) (0.0001) 0 0
values <- generate ambi (4 * samples)
shuffled <- randomShuffle values
return $ combinedPlot range (take samples shuffled) | 537 | plotShuffleAmbiguity :: Int -> Int -> Integer -> IO (Renderable (LayoutPick Double Double Double))
plotShuffleAmbiguity runs samples range
= fmap (gridToRenderable . aboveN) $ replicateM runs makePlot
where
makePlot :: IO (Grid (Renderable (LayoutPick Double Double Double)))
makePlot = do ambi <- mkAmbiGen (1 / fromIntegral samples) (0.0001) 0 0
values <- generate ambi (4 * samples)
shuffled <- randomShuffle values
return $ combinedPlot range (take samples shuffled) | 537 | plotShuffleAmbiguity runs samples range
= fmap (gridToRenderable . aboveN) $ replicateM runs makePlot
where
makePlot :: IO (Grid (Renderable (LayoutPick Double Double Double)))
makePlot = do ambi <- mkAmbiGen (1 / fromIntegral samples) (0.0001) 0 0
values <- generate ambi (4 * samples)
shuffled <- randomShuffle values
return $ combinedPlot range (take samples shuffled) | 438 | false | true | 2 | 12 | 134 | 195 | 89 | 106 | null | null |
M42/mikrokosmos | source/Lambda.hs | gpl-3.0 | simplify_cbn (Pi1 m) = Pi1 (simplify_cbn m) | 56 | simplify_cbn (Pi1 m) = Pi1 (simplify_cbn m) | 56 | simplify_cbn (Pi1 m) = Pi1 (simplify_cbn m) | 56 | false | false | 0 | 7 | 19 | 24 | 11 | 13 | null | null |
Helkafen/cabal | Cabal/Distribution/Simple/Command.hs | bsd-3-clause | viewAsFieldDescr (OptionField n dd) = FieldDescr n get set
where
optDescr = head $ sortBy cmp dd
cmp :: OptDescr a -> OptDescr a -> Ordering
ReqArg{} `cmp` ReqArg{} = EQ
ReqArg{} `cmp` _ = GT
BoolOpt{} `cmp` ReqArg{} = LT
BoolOpt{} `cmp` BoolOpt{} = EQ
BoolOpt{} `cmp` _ = GT
ChoiceOpt{} `cmp` ReqArg{} = LT
ChoiceOpt{} `cmp` BoolOpt{} = LT
ChoiceOpt{} `cmp` ChoiceOpt{} = EQ
ChoiceOpt{} `cmp` _ = GT
OptArg{} `cmp` OptArg{} = EQ
OptArg{} `cmp` _ = LT
-- get :: a -> Doc
get t = case optDescr of
ReqArg _ _ _ _ ppr ->
(cat . punctuate comma . map text . ppr) t
OptArg _ _ _ _ _ ppr ->
case ppr t of [] -> PP.empty
(Nothing : _) -> text "True"
(Just a : _) -> text a
ChoiceOpt alts ->
fromMaybe PP.empty $ listToMaybe
[ text lf | (_,(_,lf:_), _,enabled) <- alts, enabled t]
BoolOpt _ _ _ _ enabled -> (maybe PP.empty disp . enabled) t
-- set :: LineNo -> String -> a -> ParseResult a
set line val a =
case optDescr of
ReqArg _ _ _ readE _ -> ($ a) `liftM` runE line n readE val
-- We parse for a single value instead of a
-- list, as one can't really implement
-- parseList :: ReadE a -> ReadE [a] with
-- the current ReadE definition
ChoiceOpt{} ->
case getChoiceByLongFlag optDescr val of
Just f -> return (f a)
_ -> syntaxError line val
BoolOpt _ _ _ setV _ -> (`setV` a) `liftM` runP line n parse val
OptArg _ _ _ readE _ _ -> ($ a) `liftM` runE line n readE val
-- Optional arguments are parsed just like
-- required arguments here; we don't
-- provide a method to set an OptArg field
-- to the default value. | 2,231 | viewAsFieldDescr (OptionField n dd) = FieldDescr n get set
where
optDescr = head $ sortBy cmp dd
cmp :: OptDescr a -> OptDescr a -> Ordering
ReqArg{} `cmp` ReqArg{} = EQ
ReqArg{} `cmp` _ = GT
BoolOpt{} `cmp` ReqArg{} = LT
BoolOpt{} `cmp` BoolOpt{} = EQ
BoolOpt{} `cmp` _ = GT
ChoiceOpt{} `cmp` ReqArg{} = LT
ChoiceOpt{} `cmp` BoolOpt{} = LT
ChoiceOpt{} `cmp` ChoiceOpt{} = EQ
ChoiceOpt{} `cmp` _ = GT
OptArg{} `cmp` OptArg{} = EQ
OptArg{} `cmp` _ = LT
-- get :: a -> Doc
get t = case optDescr of
ReqArg _ _ _ _ ppr ->
(cat . punctuate comma . map text . ppr) t
OptArg _ _ _ _ _ ppr ->
case ppr t of [] -> PP.empty
(Nothing : _) -> text "True"
(Just a : _) -> text a
ChoiceOpt alts ->
fromMaybe PP.empty $ listToMaybe
[ text lf | (_,(_,lf:_), _,enabled) <- alts, enabled t]
BoolOpt _ _ _ _ enabled -> (maybe PP.empty disp . enabled) t
-- set :: LineNo -> String -> a -> ParseResult a
set line val a =
case optDescr of
ReqArg _ _ _ readE _ -> ($ a) `liftM` runE line n readE val
-- We parse for a single value instead of a
-- list, as one can't really implement
-- parseList :: ReadE a -> ReadE [a] with
-- the current ReadE definition
ChoiceOpt{} ->
case getChoiceByLongFlag optDescr val of
Just f -> return (f a)
_ -> syntaxError line val
BoolOpt _ _ _ setV _ -> (`setV` a) `liftM` runP line n parse val
OptArg _ _ _ readE _ _ -> ($ a) `liftM` runE line n readE val
-- Optional arguments are parsed just like
-- required arguments here; we don't
-- provide a method to set an OptArg field
-- to the default value. | 2,231 | viewAsFieldDescr (OptionField n dd) = FieldDescr n get set
where
optDescr = head $ sortBy cmp dd
cmp :: OptDescr a -> OptDescr a -> Ordering
ReqArg{} `cmp` ReqArg{} = EQ
ReqArg{} `cmp` _ = GT
BoolOpt{} `cmp` ReqArg{} = LT
BoolOpt{} `cmp` BoolOpt{} = EQ
BoolOpt{} `cmp` _ = GT
ChoiceOpt{} `cmp` ReqArg{} = LT
ChoiceOpt{} `cmp` BoolOpt{} = LT
ChoiceOpt{} `cmp` ChoiceOpt{} = EQ
ChoiceOpt{} `cmp` _ = GT
OptArg{} `cmp` OptArg{} = EQ
OptArg{} `cmp` _ = LT
-- get :: a -> Doc
get t = case optDescr of
ReqArg _ _ _ _ ppr ->
(cat . punctuate comma . map text . ppr) t
OptArg _ _ _ _ _ ppr ->
case ppr t of [] -> PP.empty
(Nothing : _) -> text "True"
(Just a : _) -> text a
ChoiceOpt alts ->
fromMaybe PP.empty $ listToMaybe
[ text lf | (_,(_,lf:_), _,enabled) <- alts, enabled t]
BoolOpt _ _ _ _ enabled -> (maybe PP.empty disp . enabled) t
-- set :: LineNo -> String -> a -> ParseResult a
set line val a =
case optDescr of
ReqArg _ _ _ readE _ -> ($ a) `liftM` runE line n readE val
-- We parse for a single value instead of a
-- list, as one can't really implement
-- parseList :: ReadE a -> ReadE [a] with
-- the current ReadE definition
ChoiceOpt{} ->
case getChoiceByLongFlag optDescr val of
Just f -> return (f a)
_ -> syntaxError line val
BoolOpt _ _ _ setV _ -> (`setV` a) `liftM` runP line n parse val
OptArg _ _ _ readE _ _ -> ($ a) `liftM` runE line n readE val
-- Optional arguments are parsed just like
-- required arguments here; we don't
-- provide a method to set an OptArg field
-- to the default value. | 2,231 | false | false | 62 | 9 | 1,026 | 628 | 349 | 279 | null | null |
troydm/edda | src/EDDA/Data/Subscriber.hs | mit | saveMessage _ ShipyardInfo {
shipyardInfoSystemName = systemName,
shipyardInfoStationName = stationName,
shipyardInfoTimestamp = timestamp,
shipyardInfoShips = ships } = do
liftIO $ infoM "EDDA.Subscriber" ("saving shipyard info " ++ T.unpack systemName ++ " / " ++ T.unpack stationName)
saveShips systemName stationName (Ships ships timestamp) | 492 | saveMessage _ ShipyardInfo {
shipyardInfoSystemName = systemName,
shipyardInfoStationName = stationName,
shipyardInfoTimestamp = timestamp,
shipyardInfoShips = ships } = do
liftIO $ infoM "EDDA.Subscriber" ("saving shipyard info " ++ T.unpack systemName ++ " / " ++ T.unpack stationName)
saveShips systemName stationName (Ships ships timestamp) | 492 | saveMessage _ ShipyardInfo {
shipyardInfoSystemName = systemName,
shipyardInfoStationName = stationName,
shipyardInfoTimestamp = timestamp,
shipyardInfoShips = ships } = do
liftIO $ infoM "EDDA.Subscriber" ("saving shipyard info " ++ T.unpack systemName ++ " / " ++ T.unpack stationName)
saveShips systemName stationName (Ships ships timestamp) | 492 | false | false | 9 | 15 | 190 | 93 | 45 | 48 | null | null |
vigoo/stack | src/main/Main.hs | bsd-3-clause | targetsCmd :: Text -> GlobalOpts -> IO ()
targetsCmd target go@GlobalOpts{..} =
withBuildConfig go $
do let bopts = defaultBuildOpts { boptsTargets = [target] }
(_realTargets,_,pkgs) <- ghciSetup bopts False Nothing
pwd <- getWorkingDir
targets <-
fmap
(concat . snd . unzip)
(mapM (getPackageOptsAndTargetFiles pwd) pkgs)
forM_ targets (liftIO . putStrLn)
-- | Pull the current Docker image. | 470 | targetsCmd :: Text -> GlobalOpts -> IO ()
targetsCmd target go@GlobalOpts{..} =
withBuildConfig go $
do let bopts = defaultBuildOpts { boptsTargets = [target] }
(_realTargets,_,pkgs) <- ghciSetup bopts False Nothing
pwd <- getWorkingDir
targets <-
fmap
(concat . snd . unzip)
(mapM (getPackageOptsAndTargetFiles pwd) pkgs)
forM_ targets (liftIO . putStrLn)
-- | Pull the current Docker image. | 470 | targetsCmd target go@GlobalOpts{..} =
withBuildConfig go $
do let bopts = defaultBuildOpts { boptsTargets = [target] }
(_realTargets,_,pkgs) <- ghciSetup bopts False Nothing
pwd <- getWorkingDir
targets <-
fmap
(concat . snd . unzip)
(mapM (getPackageOptsAndTargetFiles pwd) pkgs)
forM_ targets (liftIO . putStrLn)
-- | Pull the current Docker image. | 428 | false | true | 0 | 13 | 135 | 148 | 74 | 74 | null | null |
ucsd-progsys/nanomaly | src/NanoML/Prim.hs | bsd-3-clause | bopD = Bop Nothing | 18 | bopD = Bop Nothing | 18 | bopD = Bop Nothing | 18 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
bartoszw/yhaslo | Settings.hs | bsd-3-clause | -- | A version of @AppSettings@ parsed at compile time from @config/settings.yml@.
compileTimeAppSettings :: AppSettings
compileTimeAppSettings =
case fromJSON $ applyEnvValue False mempty configSettingsYmlValue of
Error e -> error e
Success settings -> settings
-- The following two functions can be used to combine multiple CSS or JS files
-- at compile time to decrease the number of http requests.
-- Sample usage (inside a Widget):
--
-- > $(combineStylesheets 'StaticR [style1_css, style2_css]) | 521 | compileTimeAppSettings :: AppSettings
compileTimeAppSettings =
case fromJSON $ applyEnvValue False mempty configSettingsYmlValue of
Error e -> error e
Success settings -> settings
-- The following two functions can be used to combine multiple CSS or JS files
-- at compile time to decrease the number of http requests.
-- Sample usage (inside a Widget):
--
-- > $(combineStylesheets 'StaticR [style1_css, style2_css]) | 438 | compileTimeAppSettings =
case fromJSON $ applyEnvValue False mempty configSettingsYmlValue of
Error e -> error e
Success settings -> settings
-- The following two functions can be used to combine multiple CSS or JS files
-- at compile time to decrease the number of http requests.
-- Sample usage (inside a Widget):
--
-- > $(combineStylesheets 'StaticR [style1_css, style2_css]) | 400 | true | true | 0 | 8 | 93 | 60 | 29 | 31 | null | null |
uuhan/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v (LXOr ITChar) [l, r] = doOp v (LXOr ITNative) [l, r] | 59 | doOp v (LXOr ITChar) [l, r] = doOp v (LXOr ITNative) [l, r] | 59 | doOp v (LXOr ITChar) [l, r] = doOp v (LXOr ITNative) [l, r] | 59 | false | false | 1 | 7 | 12 | 47 | 23 | 24 | null | null |
jthornber/XMonadContrib | XMonad/Hooks/DebugEvents.hs | bsd-3-clause | dumpProp _ "WM_CLIENT_LEADER" = dumpWindow | 67 | dumpProp _ "WM_CLIENT_LEADER" = dumpWindow | 67 | dumpProp _ "WM_CLIENT_LEADER" = dumpWindow | 67 | false | false | 1 | 5 | 29 | 14 | 5 | 9 | null | null |
elieux/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | dataCast2_RDR = varQual_RDR gENERICS (fsLit "dataCast2") | 58 | dataCast2_RDR = varQual_RDR gENERICS (fsLit "dataCast2") | 58 | dataCast2_RDR = varQual_RDR gENERICS (fsLit "dataCast2") | 58 | false | false | 0 | 7 | 7 | 17 | 8 | 9 | null | null |
hvr/hoopl | src/Compiler/Hoopl/Stream.hs | bsd-3-clause | iterL (x:xs) = x : (xs `thenL` iterL (x:xs)) | 44 | iterL (x:xs) = x : (xs `thenL` iterL (x:xs)) | 44 | iterL (x:xs) = x : (xs `thenL` iterL (x:xs)) | 44 | false | false | 2 | 10 | 8 | 42 | 21 | 21 | null | null |
MichielDerhaeg/stack | src/Stack/Coverage.hs | bsd-3-clause | unionTixes :: [Tix] -> ([String], Tix)
unionTixes tixes = (Map.keys errs, Tix (Map.elems outputs))
where
(errs, outputs) = Map.mapEither id $ Map.unionsWith merge $ map toMap tixes
toMap (Tix ms) = Map.fromList (map (\x@(TixModule k _ _ _) -> (k, Right x)) ms)
merge (Right (TixModule k hash1 len1 tix1))
(Right (TixModule _ hash2 len2 tix2))
| hash1 == hash2 && len1 == len2 = Right (TixModule k hash1 len1 (zipWith (+) tix1 tix2))
merge _ _ = Left () | 488 | unionTixes :: [Tix] -> ([String], Tix)
unionTixes tixes = (Map.keys errs, Tix (Map.elems outputs))
where
(errs, outputs) = Map.mapEither id $ Map.unionsWith merge $ map toMap tixes
toMap (Tix ms) = Map.fromList (map (\x@(TixModule k _ _ _) -> (k, Right x)) ms)
merge (Right (TixModule k hash1 len1 tix1))
(Right (TixModule _ hash2 len2 tix2))
| hash1 == hash2 && len1 == len2 = Right (TixModule k hash1 len1 (zipWith (+) tix1 tix2))
merge _ _ = Left () | 488 | unionTixes tixes = (Map.keys errs, Tix (Map.elems outputs))
where
(errs, outputs) = Map.mapEither id $ Map.unionsWith merge $ map toMap tixes
toMap (Tix ms) = Map.fromList (map (\x@(TixModule k _ _ _) -> (k, Right x)) ms)
merge (Right (TixModule k hash1 len1 tix1))
(Right (TixModule _ hash2 len2 tix2))
| hash1 == hash2 && len1 == len2 = Right (TixModule k hash1 len1 (zipWith (+) tix1 tix2))
merge _ _ = Left () | 449 | false | true | 0 | 12 | 115 | 255 | 129 | 126 | null | null |
jutaro/rdf4h | src/Data/RDF/Types.hs | bsd-3-clause | plainLL :: T.Text -> T.Text -> LValue
plainLL = PlainLL | 55 | plainLL :: T.Text -> T.Text -> LValue
plainLL = PlainLL | 55 | plainLL = PlainLL | 17 | false | true | 0 | 7 | 9 | 23 | 12 | 11 | null | null |
yugr/sudoku | src/Board.hs | mit | decode_idx (size, _) i =
let row = i `mod` size in (row, i - row * size) | 74 | decode_idx (size, _) i =
let row = i `mod` size in (row, i - row * size) | 74 | decode_idx (size, _) i =
let row = i `mod` size in (row, i - row * size) | 74 | false | false | 0 | 9 | 19 | 48 | 26 | 22 | null | null |
theNerd247/ariaRacer | arweb/app/Pages/BuildExistsPage.hs | bsd-3-clause | buildExistsPage :: RacerId -> AriaWebApp H.Html
buildExistsPage rid =
appTemplate "Build Exists" $
do BH.jumbotron
(H.string "Build Already Exists and Is Already Selected")
(racerPageButton rid "Go back") | 222 | buildExistsPage :: RacerId -> AriaWebApp H.Html
buildExistsPage rid =
appTemplate "Build Exists" $
do BH.jumbotron
(H.string "Build Already Exists and Is Already Selected")
(racerPageButton rid "Go back") | 222 | buildExistsPage rid =
appTemplate "Build Exists" $
do BH.jumbotron
(H.string "Build Already Exists and Is Already Selected")
(racerPageButton rid "Go back") | 174 | false | true | 0 | 11 | 44 | 56 | 26 | 30 | null | null |
fadeopolis/prog-spr-ue3 | Trains.hs | bsd-3-clause | c_10 = City "Museumsquartier" | 29 | c_10 = City "Museumsquartier" | 29 | c_10 = City "Museumsquartier" | 29 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
jberthold/rts-serialisation | testTrySer.hs | bsd-3-clause | main :: IO ()
main=do hSetBuffering stdout NoBuffering
args <- getArgs
putStrLn "Test program for packing/serialization:"
putStrLn "testing exceptions during packing. Use -qQ1k or so..."
let n = if (length args < 2) then 1 else read (args!!1)
size = if null args then 128 else read (head args)::Int
arr :: A.Array Int Int
arr = A.array (0,size-1)
[ (i,i) | i <- [0..size-1] ]
let output = A.amap (2*) arr
putStrLn $ show $ take n $ A.elems output
putStrLn "now packing the array (buffer big enough?)"
catchPackExc $
do packet1 <- trySerialize output
putStrLn (show packet1)
putStrLn "now unpacking (deserialize):"
copy <- deserialize packet1
putStrLn ("unpacked, now evaluate")
putStrLn (show copy)
putStrLn "packing some forbidden types"
t <- myThreadId
putStrLn "next should be unsupported"
catchPackExc (trySerialize t >>= print)
m <- newEmptyMVar :: IO (MVar Int)
putStrLn "next should be cannotpack"
catchPackExc (trySerialize m >>= print)
(c,b) <- createC:: IO (ChanName' Double, Double)
putStrLn "next should hit a blackhole"
catchPackExc (trySerialize b >>= print)
let arr2 = A.listArray (0,n-1) (take n (A.elems arr)) :: A.Array Int Int
putStrLn "this - finally - should work"
putStrLn ( show $ arr2 A.! 0 ) -- forcing it
catchPackExc $
do p2 <- trySerialize arr2
arr3 <- deserialize p2
print arr3
putStrLn "DONE" | 1,697 | main :: IO ()
main=do hSetBuffering stdout NoBuffering
args <- getArgs
putStrLn "Test program for packing/serialization:"
putStrLn "testing exceptions during packing. Use -qQ1k or so..."
let n = if (length args < 2) then 1 else read (args!!1)
size = if null args then 128 else read (head args)::Int
arr :: A.Array Int Int
arr = A.array (0,size-1)
[ (i,i) | i <- [0..size-1] ]
let output = A.amap (2*) arr
putStrLn $ show $ take n $ A.elems output
putStrLn "now packing the array (buffer big enough?)"
catchPackExc $
do packet1 <- trySerialize output
putStrLn (show packet1)
putStrLn "now unpacking (deserialize):"
copy <- deserialize packet1
putStrLn ("unpacked, now evaluate")
putStrLn (show copy)
putStrLn "packing some forbidden types"
t <- myThreadId
putStrLn "next should be unsupported"
catchPackExc (trySerialize t >>= print)
m <- newEmptyMVar :: IO (MVar Int)
putStrLn "next should be cannotpack"
catchPackExc (trySerialize m >>= print)
(c,b) <- createC:: IO (ChanName' Double, Double)
putStrLn "next should hit a blackhole"
catchPackExc (trySerialize b >>= print)
let arr2 = A.listArray (0,n-1) (take n (A.elems arr)) :: A.Array Int Int
putStrLn "this - finally - should work"
putStrLn ( show $ arr2 A.! 0 ) -- forcing it
catchPackExc $
do p2 <- trySerialize arr2
arr3 <- deserialize p2
print arr3
putStrLn "DONE" | 1,697 | main=do hSetBuffering stdout NoBuffering
args <- getArgs
putStrLn "Test program for packing/serialization:"
putStrLn "testing exceptions during packing. Use -qQ1k or so..."
let n = if (length args < 2) then 1 else read (args!!1)
size = if null args then 128 else read (head args)::Int
arr :: A.Array Int Int
arr = A.array (0,size-1)
[ (i,i) | i <- [0..size-1] ]
let output = A.amap (2*) arr
putStrLn $ show $ take n $ A.elems output
putStrLn "now packing the array (buffer big enough?)"
catchPackExc $
do packet1 <- trySerialize output
putStrLn (show packet1)
putStrLn "now unpacking (deserialize):"
copy <- deserialize packet1
putStrLn ("unpacked, now evaluate")
putStrLn (show copy)
putStrLn "packing some forbidden types"
t <- myThreadId
putStrLn "next should be unsupported"
catchPackExc (trySerialize t >>= print)
m <- newEmptyMVar :: IO (MVar Int)
putStrLn "next should be cannotpack"
catchPackExc (trySerialize m >>= print)
(c,b) <- createC:: IO (ChanName' Double, Double)
putStrLn "next should hit a blackhole"
catchPackExc (trySerialize b >>= print)
let arr2 = A.listArray (0,n-1) (take n (A.elems arr)) :: A.Array Int Int
putStrLn "this - finally - should work"
putStrLn ( show $ arr2 A.! 0 ) -- forcing it
catchPackExc $
do p2 <- trySerialize arr2
arr3 <- deserialize p2
print arr3
putStrLn "DONE" | 1,683 | false | true | 18 | 13 | 586 | 428 | 225 | 203 | null | null |
sdiehl/ghc | compiler/nativeGen/RegAlloc/Graph/SpillClean.hs | bsd-3-clause | intersectAssoc :: Assoc a -> Assoc a -> Assoc a
intersectAssoc a b
= intersectUFM_C (intersectUniqSets) a b | 115 | intersectAssoc :: Assoc a -> Assoc a -> Assoc a
intersectAssoc a b
= intersectUFM_C (intersectUniqSets) a b | 115 | intersectAssoc a b
= intersectUFM_C (intersectUniqSets) a b | 67 | false | true | 0 | 7 | 25 | 43 | 20 | 23 | null | null |
jonsterling/ETT-Lite | src/PrettyPrint.hs | bsd-3-clause | gatherBinders (Ind binding ann) =
lunbind binding $ \ ((n,x),body) -> do
dn <- display n
dx <- display x
(rest,body) <- gatherBinders body
return (text "ind" <+> dn <+> bindParens dx <+> text "=" : rest,
body) | 249 | gatherBinders (Ind binding ann) =
lunbind binding $ \ ((n,x),body) -> do
dn <- display n
dx <- display x
(rest,body) <- gatherBinders body
return (text "ind" <+> dn <+> bindParens dx <+> text "=" : rest,
body) | 249 | gatherBinders (Ind binding ann) =
lunbind binding $ \ ((n,x),body) -> do
dn <- display n
dx <- display x
(rest,body) <- gatherBinders body
return (text "ind" <+> dn <+> bindParens dx <+> text "=" : rest,
body) | 249 | false | false | 0 | 15 | 77 | 114 | 55 | 59 | null | null |
gcampax/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | exprIsCheap' _ (Type _) = True | 40 | exprIsCheap' _ (Type _) = True | 40 | exprIsCheap' _ (Type _) = True | 40 | false | false | 0 | 7 | 15 | 17 | 8 | 9 | null | null |
kavigupta/N-programming-language | src/Environment.hs | gpl-3.0 | deInterp :: InterpAct () -> Map String FObject -> [FObject] -> [AST] -> ReaderT String (ExceptT FInterpreterError IO) FullEnv
deInterp x items initial ast = withRegs
where
withRegs = fst . snd <$> runStateT withAST (FullEnv (Environment items) (Stack initial), initialRegFile)
withAST = runReaderT (runInterpAct x) [Code ast newFrame] | 346 | deInterp :: InterpAct () -> Map String FObject -> [FObject] -> [AST] -> ReaderT String (ExceptT FInterpreterError IO) FullEnv
deInterp x items initial ast = withRegs
where
withRegs = fst . snd <$> runStateT withAST (FullEnv (Environment items) (Stack initial), initialRegFile)
withAST = runReaderT (runInterpAct x) [Code ast newFrame] | 346 | deInterp x items initial ast = withRegs
where
withRegs = fst . snd <$> runStateT withAST (FullEnv (Environment items) (Stack initial), initialRegFile)
withAST = runReaderT (runInterpAct x) [Code ast newFrame] | 220 | false | true | 0 | 11 | 60 | 135 | 67 | 68 | null | null |
ckaestne/CIDE | CIDE_Language_Haskell/test/WSP/Webserver/MimeTypes.hs | gpl-3.0 | mimeRegex = mkRegex "^([^/]+)/([^ \t]+)[ \t]+(.*)$" | 51 | mimeRegex = mkRegex "^([^/]+)/([^ \t]+)[ \t]+(.*)$" | 51 | mimeRegex = mkRegex "^([^/]+)/([^ \t]+)[ \t]+(.*)$" | 51 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
supki/wybor | src/Score.hs | bsd-2-clause | score :: Input -> Choice -> Score
score (Input q) (Choice c)
| Nothing <- Text.uncons (Text.toLower q) = maxBound
| Just (x, xs) <- Text.uncons (Text.toLower q)
, Just ml <- sub x xs (Text.toLower c) = Score ((fi ql / fi ml) / fi cl)
| otherwise = minBound
where
fi = fromIntegral
ql = Text.length q
cl = Text.length c
-- | The shortest substring match length | 388 | score :: Input -> Choice -> Score
score (Input q) (Choice c)
| Nothing <- Text.uncons (Text.toLower q) = maxBound
| Just (x, xs) <- Text.uncons (Text.toLower q)
, Just ml <- sub x xs (Text.toLower c) = Score ((fi ql / fi ml) / fi cl)
| otherwise = minBound
where
fi = fromIntegral
ql = Text.length q
cl = Text.length c
-- | The shortest substring match length | 388 | score (Input q) (Choice c)
| Nothing <- Text.uncons (Text.toLower q) = maxBound
| Just (x, xs) <- Text.uncons (Text.toLower q)
, Just ml <- sub x xs (Text.toLower c) = Score ((fi ql / fi ml) / fi cl)
| otherwise = minBound
where
fi = fromIntegral
ql = Text.length q
cl = Text.length c
-- | The shortest substring match length | 354 | false | true | 1 | 12 | 98 | 184 | 89 | 95 | null | null |
parsonsmatt/lambda | src/Lambda/Untyped.hs | bsd-3-clause | mkEvalEnv :: Foldable f => f Declaration -> EvalEnv
mkEvalEnv = foldMap (\(D.Def x e) -> Map.singleton x (convert e)) | 117 | mkEvalEnv :: Foldable f => f Declaration -> EvalEnv
mkEvalEnv = foldMap (\(D.Def x e) -> Map.singleton x (convert e)) | 117 | mkEvalEnv = foldMap (\(D.Def x e) -> Map.singleton x (convert e)) | 65 | false | true | 0 | 10 | 19 | 59 | 29 | 30 | null | null |
brendanhay/gogol | gogol-bigquery/gen/Network/Google/Resource/BigQuery/DataSets/Delete.hs | mpl-2.0 | -- | Creates a value of 'DataSetsDelete' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dsdDataSetId'
--
-- * 'dsdProjectId'
--
-- * 'dsdDeleteContents'
dataSetsDelete
:: Text -- ^ 'dsdDataSetId'
-> Text -- ^ 'dsdProjectId'
-> DataSetsDelete
dataSetsDelete pDsdDataSetId_ pDsdProjectId_ =
DataSetsDelete'
{ _dsdDataSetId = pDsdDataSetId_
, _dsdProjectId = pDsdProjectId_
, _dsdDeleteContents = Nothing
} | 520 | dataSetsDelete
:: Text -- ^ 'dsdDataSetId'
-> Text -- ^ 'dsdProjectId'
-> DataSetsDelete
dataSetsDelete pDsdDataSetId_ pDsdProjectId_ =
DataSetsDelete'
{ _dsdDataSetId = pDsdDataSetId_
, _dsdProjectId = pDsdProjectId_
, _dsdDeleteContents = Nothing
} | 280 | dataSetsDelete pDsdDataSetId_ pDsdProjectId_ =
DataSetsDelete'
{ _dsdDataSetId = pDsdDataSetId_
, _dsdProjectId = pDsdProjectId_
, _dsdDeleteContents = Nothing
} | 179 | true | true | 0 | 6 | 102 | 55 | 36 | 19 | null | null |
Rizary/hackage-matrix-builder | src-ui.v3/src/API.hs | gpl-3.0 | getPackageHistory :: forall t m. (Reflex t, SupportsServantReflex t m, MonadHold t m)=> Dynamic t (Either Text PkgN)-> Event t ()-> m (Event t (Vector PkgHistoryEntry))
getPackageHistory pkgNDyn evSubmit = wireClientRes =<< getV2PackageHistory pkgNDyn evSubmit | 260 | getPackageHistory :: forall t m. (Reflex t, SupportsServantReflex t m, MonadHold t m)=> Dynamic t (Either Text PkgN)-> Event t ()-> m (Event t (Vector PkgHistoryEntry))
getPackageHistory pkgNDyn evSubmit = wireClientRes =<< getV2PackageHistory pkgNDyn evSubmit | 260 | getPackageHistory pkgNDyn evSubmit = wireClientRes =<< getV2PackageHistory pkgNDyn evSubmit | 91 | false | true | 0 | 13 | 34 | 101 | 50 | 51 | null | null |
pseudonom/haskell-mechanism | src/Mechanism.hs | agpl-3.0 | strategies :: (Ord ac, Ord ty)
=> Set (Type ty) -> Set (Action ac) -> Set (Strategy ty ac)
strategies tys acs =
S.fromList $ P.fromList . zip (F.toList tys) <$>
replicateM (S.size tys) (F.toList acs) | 227 | strategies :: (Ord ac, Ord ty)
=> Set (Type ty) -> Set (Action ac) -> Set (Strategy ty ac)
strategies tys acs =
S.fromList $ P.fromList . zip (F.toList tys) <$>
replicateM (S.size tys) (F.toList acs) | 227 | strategies tys acs =
S.fromList $ P.fromList . zip (F.toList tys) <$>
replicateM (S.size tys) (F.toList acs) | 125 | false | true | 0 | 10 | 63 | 116 | 56 | 60 | null | null |
rueshyna/gogol | gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs | mpl-2.0 | -- | The ID of the request entry this entry responds to.
icbreBatchId :: Lens' InventoryCustomBatchResponseEntry (Maybe Word32)
icbreBatchId
= lens _icbreBatchId (\ s a -> s{_icbreBatchId = a})
. mapping _Coerce | 219 | icbreBatchId :: Lens' InventoryCustomBatchResponseEntry (Maybe Word32)
icbreBatchId
= lens _icbreBatchId (\ s a -> s{_icbreBatchId = a})
. mapping _Coerce | 162 | icbreBatchId
= lens _icbreBatchId (\ s a -> s{_icbreBatchId = a})
. mapping _Coerce | 91 | true | true | 1 | 9 | 39 | 56 | 28 | 28 | null | null |
ribag/ganeti-experiments | src/Ganeti/Constants.hs | gpl-2.0 | esActionGrow :: String
esActionGrow = "grow" | 44 | esActionGrow :: String
esActionGrow = "grow" | 44 | esActionGrow = "grow" | 21 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
weso/shexkell | app/Main.hs | mit | toEitherT :: Monad m => a -> Maybe b -> EitherT a m b
toEitherT left = hoistEither . toEither left | 98 | toEitherT :: Monad m => a -> Maybe b -> EitherT a m b
toEitherT left = hoistEither . toEither left | 98 | toEitherT left = hoistEither . toEither left | 44 | false | true | 0 | 8 | 20 | 46 | 21 | 25 | null | null |
brendanhay/gogol | gogol-file/gen/Network/Google/File/Types/Product.hs | mpl-2.0 | -- | Service-specific metadata associated with the operation. It typically
-- contains progress information and common metadata such as create time.
-- Some services might not provide such metadata. Any method that returns a
-- long-running operation should document the metadata type, if any.
oMetadata :: Lens' Operation (Maybe OperationSchema)
oMetadata
= lens _oMetadata (\ s a -> s{_oMetadata = a}) | 405 | oMetadata :: Lens' Operation (Maybe OperationSchema)
oMetadata
= lens _oMetadata (\ s a -> s{_oMetadata = a}) | 111 | oMetadata
= lens _oMetadata (\ s a -> s{_oMetadata = a}) | 58 | true | true | 0 | 9 | 62 | 51 | 28 | 23 | null | null |
brendanhay/gogol | gogol-slides/gen/Network/Google/Slides/Types/Product.hs | mpl-2.0 | -- | The IDs of the slides in the presentation that should be moved. The
-- slides in this list must be in existing presentation order, without
-- duplicates.
usprSlideObjectIds :: Lens' UpdateSlidesPositionRequest [Text]
usprSlideObjectIds
= lens _usprSlideObjectIds
(\ s a -> s{_usprSlideObjectIds = a})
. _Default
. _Coerce | 346 | usprSlideObjectIds :: Lens' UpdateSlidesPositionRequest [Text]
usprSlideObjectIds
= lens _usprSlideObjectIds
(\ s a -> s{_usprSlideObjectIds = a})
. _Default
. _Coerce | 187 | usprSlideObjectIds
= lens _usprSlideObjectIds
(\ s a -> s{_usprSlideObjectIds = a})
. _Default
. _Coerce | 124 | true | true | 0 | 11 | 68 | 55 | 30 | 25 | null | null |
njlochner/haskell_turing_machine | Turing.hs | gpl-3.0 | showInstruction machine alphabet tape startState position = showInstructionHelper (H.lookup startState machine) tape position | 125 | showInstruction machine alphabet tape startState position = showInstructionHelper (H.lookup startState machine) tape position | 125 | showInstruction machine alphabet tape startState position = showInstructionHelper (H.lookup startState machine) tape position | 125 | false | false | 0 | 8 | 12 | 36 | 16 | 20 | null | null |
joris-r/labaskel | Util.hs | apache-2.0 | {-
TODO when the pattern just above is removed, put the following instead
-- unary operator associativity is not implemented in the parser
addMinParenExpr ((BNExpression (BUnaryExpression _ _)):_) n@(BUnaryExpression _ _)
= BParenExpression n
addMinParenExpr ((BNExpression (BApply _ lAbove _)):_) n@(BUnaryExpression _ _)
| lAbove `equalModParenExpr` n
= BParenExpression n
| otherwise
= n
-}
addMinParenExpr ((BNExpression (BApply _ lAbove _)):_) n@(BApply _ _ _)
| lAbove `equalModParenExpr` n
= BParenExpression n
| otherwise
= n | 562 | addMinParenExpr ((BNExpression (BApply _ lAbove _)):_) n@(BApply _ _ _)
| lAbove `equalModParenExpr` n
= BParenExpression n
| otherwise
= n | 151 | addMinParenExpr ((BNExpression (BApply _ lAbove _)):_) n@(BApply _ _ _)
| lAbove `equalModParenExpr` n
= BParenExpression n
| otherwise
= n | 151 | true | false | 1 | 11 | 104 | 71 | 36 | 35 | null | null |
zachsully/hakaru | haskell/Language/Hakaru/Syntax/IClasses.hs | bsd-3-clause | dcons1 :: a x -> DList1 a xs -> DList1 a (x ': xs)
dcons1 x (DList1 xs) = DList1 (Cons1 x . xs) | 95 | dcons1 :: a x -> DList1 a xs -> DList1 a (x ': xs)
dcons1 x (DList1 xs) = DList1 (Cons1 x . xs) | 95 | dcons1 x (DList1 xs) = DList1 (Cons1 x . xs) | 44 | false | true | 0 | 9 | 23 | 65 | 31 | 34 | null | null |
cgag/cis-194-solutions | src/HW7/HW7.hs | bsd-3-clause | tag (Single m _) = m | 22 | tag (Single m _) = m | 22 | tag (Single m _) = m | 22 | false | false | 0 | 7 | 7 | 17 | 8 | 9 | null | null |
dysinger/amazonka | core/src/Network/AWS/Signing/Internal/V4.hs | mpl-2.0 | algorithm :: ByteString
algorithm = "AWS4-HMAC-SHA256" | 54 | algorithm :: ByteString
algorithm = "AWS4-HMAC-SHA256" | 54 | algorithm = "AWS4-HMAC-SHA256" | 30 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
michalkonecny/aern | aern-real/src/Numeric/AERN/RealArithmetic/RefinementOrderRounding/Elementary.hs | bsd-3-clause | benchExpAreasReal =
[
("near 0", areaWithBounds (-1/2) (1/2))
,
("near -10", areaWithBounds (-10.5) (-9.5))
,
("near 10", areaWithBounds (9.5) (10.5))
,
("near 20", areaWithBounds (19.5) (20.5))
]
where
areaWithBounds l r =
(NumOrd.AreaLinear (Just l) True (Just r) True $ areaWholeOnlyWhole [],
AreaMaybeAllowOnlyWithConsistencyStatus $ Just Consistent) | 434 | benchExpAreasReal =
[
("near 0", areaWithBounds (-1/2) (1/2))
,
("near -10", areaWithBounds (-10.5) (-9.5))
,
("near 10", areaWithBounds (9.5) (10.5))
,
("near 20", areaWithBounds (19.5) (20.5))
]
where
areaWithBounds l r =
(NumOrd.AreaLinear (Just l) True (Just r) True $ areaWholeOnlyWhole [],
AreaMaybeAllowOnlyWithConsistencyStatus $ Just Consistent) | 434 | benchExpAreasReal =
[
("near 0", areaWithBounds (-1/2) (1/2))
,
("near -10", areaWithBounds (-10.5) (-9.5))
,
("near 10", areaWithBounds (9.5) (10.5))
,
("near 20", areaWithBounds (19.5) (20.5))
]
where
areaWithBounds l r =
(NumOrd.AreaLinear (Just l) True (Just r) True $ areaWholeOnlyWhole [],
AreaMaybeAllowOnlyWithConsistencyStatus $ Just Consistent) | 434 | false | false | 0 | 11 | 125 | 157 | 86 | 71 | null | null |
Peaker/TraceUtils | src/Debug/TraceUtils.hs | bsd-3-clause | tracePrint :: (Show a, Monad m) => a -> m ()
tracePrint = tracePutStrLn . show | 78 | tracePrint :: (Show a, Monad m) => a -> m ()
tracePrint = tracePutStrLn . show | 78 | tracePrint = tracePutStrLn . show | 33 | false | true | 0 | 8 | 15 | 39 | 20 | 19 | null | null |
Purview/purview | src/Graphics/Forensics/Analysers.hs | gpl-3.0 | analysers :: [Analyser ByteImage]
analysers =
[ Test.analyser,
LG.analyser,
LCFA.analyser,
DM.analyser,
CM.analyser
] | 137 | analysers :: [Analyser ByteImage]
analysers =
[ Test.analyser,
LG.analyser,
LCFA.analyser,
DM.analyser,
CM.analyser
] | 137 | analysers =
[ Test.analyser,
LG.analyser,
LCFA.analyser,
DM.analyser,
CM.analyser
] | 103 | false | true | 0 | 8 | 32 | 49 | 25 | 24 | null | null |
markflorisson/hpack | testrepo/bytestring-0.10.2.0/tests/builder/Data/ByteString/Builder/Prim/Tests.hs | bsd-3-clause | tests :: [Test]
tests = concat [ testsBinary, testsASCII, testsChar8, testsUtf8
, testsCombinatorsB ] | 116 | tests :: [Test]
tests = concat [ testsBinary, testsASCII, testsChar8, testsUtf8
, testsCombinatorsB ] | 116 | tests = concat [ testsBinary, testsASCII, testsChar8, testsUtf8
, testsCombinatorsB ] | 100 | false | true | 0 | 7 | 28 | 38 | 20 | 18 | null | null |
lukexi/rumpus | src/Rumpus/Types.hs | bsd-3-clause | profileFPS' :: (MonadIO m) => String -> Int -> m a -> m a
--profileFPS' = profileFPS
profileFPS' _ _ = id | 105 | profileFPS' :: (MonadIO m) => String -> Int -> m a -> m a
profileFPS' _ _ = id | 78 | profileFPS' _ _ = id | 20 | true | true | 0 | 10 | 21 | 49 | 23 | 26 | null | null |
alpmestan/kmeans-vector | bench/OldKMeans.hs | bsd-3-clause | kmeansAux :: [Point a] -> [[Point a]] -> [[Point a]]
kmeansAux points pgroups = let pss = kmeansStep points pgroups in
-- has anything changed since the last step?
-- even a point jumping from one cluster to another is enough to
-- enter the 'False' case
case map (map fst) pss == map (map fst) pgroups of
True -> pgroups -- nothing's changed, we're done
False -> kmeansAux points pss -- something has changed, so let's try again
-- | Performs the k-means clustering algorithm
-- trying to use 'k' clusters on the given list of points | 549 | kmeansAux :: [Point a] -> [[Point a]] -> [[Point a]]
kmeansAux points pgroups = let pss = kmeansStep points pgroups in
-- has anything changed since the last step?
-- even a point jumping from one cluster to another is enough to
-- enter the 'False' case
case map (map fst) pss == map (map fst) pgroups of
True -> pgroups -- nothing's changed, we're done
False -> kmeansAux points pss -- something has changed, so let's try again
-- | Performs the k-means clustering algorithm
-- trying to use 'k' clusters on the given list of points | 549 | kmeansAux points pgroups = let pss = kmeansStep points pgroups in
-- has anything changed since the last step?
-- even a point jumping from one cluster to another is enough to
-- enter the 'False' case
case map (map fst) pss == map (map fst) pgroups of
True -> pgroups -- nothing's changed, we're done
False -> kmeansAux points pss -- something has changed, so let's try again
-- | Performs the k-means clustering algorithm
-- trying to use 'k' clusters on the given list of points | 496 | false | true | 0 | 11 | 112 | 118 | 61 | 57 | null | null |
osa1/chsc | Supercompile/Drive.hs | bsd-3-clause | runScpM :: ScpM (Out FVedTerm) -> (SCStats, Out FVedTerm)
runScpM me = unScpM me init_e init_s (\e' s -> (stats s, letRecSmart (fulfilmentsToBinds $ fst $ partitionFulfilments fulfilmentReferredTo S.unions (fvedTermFreeVars e') (fulfilments s)) e'))
where
init_e = ScpEnv { promises = [], fulfilmentStack = [], depth = 0 }
init_s = ScpState { names = map (\i -> name $ 'h' : show (i :: Int)) [0..], fulfilments = [], stats = mempty } | 443 | runScpM :: ScpM (Out FVedTerm) -> (SCStats, Out FVedTerm)
runScpM me = unScpM me init_e init_s (\e' s -> (stats s, letRecSmart (fulfilmentsToBinds $ fst $ partitionFulfilments fulfilmentReferredTo S.unions (fvedTermFreeVars e') (fulfilments s)) e'))
where
init_e = ScpEnv { promises = [], fulfilmentStack = [], depth = 0 }
init_s = ScpState { names = map (\i -> name $ 'h' : show (i :: Int)) [0..], fulfilments = [], stats = mempty } | 443 | runScpM me = unScpM me init_e init_s (\e' s -> (stats s, letRecSmart (fulfilmentsToBinds $ fst $ partitionFulfilments fulfilmentReferredTo S.unions (fvedTermFreeVars e') (fulfilments s)) e'))
where
init_e = ScpEnv { promises = [], fulfilmentStack = [], depth = 0 }
init_s = ScpState { names = map (\i -> name $ 'h' : show (i :: Int)) [0..], fulfilments = [], stats = mempty } | 385 | false | true | 0 | 14 | 83 | 195 | 106 | 89 | null | null |
plietar/super-user-spark | src/Parser.hs | mit | plainIdentifier :: Parser String
plainIdentifier = many1 $ noneOf $ quotesChar : lineDelimiter ++ whitespaceChars ++ bracesChars | 128 | plainIdentifier :: Parser String
plainIdentifier = many1 $ noneOf $ quotesChar : lineDelimiter ++ whitespaceChars ++ bracesChars | 128 | plainIdentifier = many1 $ noneOf $ quotesChar : lineDelimiter ++ whitespaceChars ++ bracesChars | 95 | false | true | 0 | 9 | 16 | 34 | 17 | 17 | null | null |
corajr/cataskell | src/Cataskell/GameData/Board.hs | bsd-3-clause | terrains :: [Terrain]
terrains = hills ++ pastures ++ mountains ++ fields ++ forests
where hills = replicate 3 Hill
pastures = replicate 4 Pasture
mountains = replicate 3 Mountain
fields = replicate 4 Field
forests = replicate 4 Forest | 269 | terrains :: [Terrain]
terrains = hills ++ pastures ++ mountains ++ fields ++ forests
where hills = replicate 3 Hill
pastures = replicate 4 Pasture
mountains = replicate 3 Mountain
fields = replicate 4 Field
forests = replicate 4 Forest | 269 | terrains = hills ++ pastures ++ mountains ++ fields ++ forests
where hills = replicate 3 Hill
pastures = replicate 4 Pasture
mountains = replicate 3 Mountain
fields = replicate 4 Field
forests = replicate 4 Forest | 247 | false | true | 4 | 8 | 73 | 83 | 42 | 41 | null | null |
caryoscelus/folivora-ge | demos/platformer/Game.hs | gpl-3.0 | game
:: (Monad m, Monoid e, Monoid s, HasTime t s)
=> Wire s e m (Event Input) Game
game = trueModes modeSwitcher emptyGame | 131 | game
:: (Monad m, Monoid e, Monoid s, HasTime t s)
=> Wire s e m (Event Input) Game
game = trueModes modeSwitcher emptyGame | 131 | game = trueModes modeSwitcher emptyGame | 39 | false | true | 0 | 8 | 31 | 65 | 32 | 33 | null | null |
input-output-hk/pos-haskell-prototype | db/src/Pos/DB/Update/GState.hs | mit | -- | Get most recent 'SlottingData'.
getSlottingData :: MonadDBRead m => m SlottingData
getSlottingData = maybeThrow (DBMalformed msg) =<< gsGetBi slottingDataKey
where
msg = "Update System part of GState DB is not initialized (slotting data is missing)"
-- | Get proposers for current epoch. | 299 | getSlottingData :: MonadDBRead m => m SlottingData
getSlottingData = maybeThrow (DBMalformed msg) =<< gsGetBi slottingDataKey
where
msg = "Update System part of GState DB is not initialized (slotting data is missing)"
-- | Get proposers for current epoch. | 262 | getSlottingData = maybeThrow (DBMalformed msg) =<< gsGetBi slottingDataKey
where
msg = "Update System part of GState DB is not initialized (slotting data is missing)"
-- | Get proposers for current epoch. | 211 | true | true | 0 | 8 | 50 | 47 | 23 | 24 | null | null |
dysinger/amazonka | amazonka-lambda/gen/Network/AWS/Lambda/UpdateFunctionConfiguration.hs | mpl-2.0 | -- | The function execution time at which Lambda should terminate the function.
-- Because the execution time has cost implications, we recommend you set this
-- value based on your expected execution time. The default is 3 seconds.
ufcrTimeout :: Lens' UpdateFunctionConfigurationResponse (Maybe Natural)
ufcrTimeout = lens _ufcrTimeout (\s a -> s { _ufcrTimeout = a }) . mapping _Nat | 385 | ufcrTimeout :: Lens' UpdateFunctionConfigurationResponse (Maybe Natural)
ufcrTimeout = lens _ufcrTimeout (\s a -> s { _ufcrTimeout = a }) . mapping _Nat | 152 | ufcrTimeout = lens _ufcrTimeout (\s a -> s { _ufcrTimeout = a }) . mapping _Nat | 79 | true | true | 0 | 10 | 60 | 55 | 30 | 25 | null | null |
jfischoff/LambdaPrettyQuote | tests/SimplyTypedTests.hs | bsd-3-clause | test_arbitrary_type_checks_0 :: Expr String BaseType String -> Bool
test_arbitrary_type_checks_0 x = is_right $ type_check' $ traceIt x | 135 | test_arbitrary_type_checks_0 :: Expr String BaseType String -> Bool
test_arbitrary_type_checks_0 x = is_right $ type_check' $ traceIt x | 135 | test_arbitrary_type_checks_0 x = is_right $ type_check' $ traceIt x | 67 | false | true | 0 | 6 | 16 | 36 | 17 | 19 | null | null |
nomeata/sat-britney | IndexSet.hs | gpl-2.0 | fromList :: [Index a] -> Set a
fromList l = IndexSet $ S.fromList (unIndex <$> l) | 81 | fromList :: [Index a] -> Set a
fromList l = IndexSet $ S.fromList (unIndex <$> l) | 81 | fromList l = IndexSet $ S.fromList (unIndex <$> l) | 50 | false | true | 0 | 8 | 15 | 43 | 21 | 22 | null | null |
nevrenato/Hets_Fork | utils/DtdToHaskell-src/current/Instance.hs | gpl-2.0 | mkInstance :: TypeDef -> Doc
-- no constructors - represents an element with empty content but attributes.
mkInstance (DataDef _ n fs []) =
let (_, frattr, topat, toattr) = attrpats fs
frretval = if null fs then ppHName n else frattr
topatval = if null fs then ppHName n else topat
in
text "instance HTypeable" <+> ppHName n <+> text "where" $$
nest 4 ( text "toHType _ = Defined \"" <> ppXName n <> text "\" [] []" )
$$
text "instance XmlContent" <+> ppHName n <+> text "where" $$
nest 4 (
text "toContents" <+> topatval <+> text "=" $$
nest 4 (text "[CElem (Elem (N \"" <> ppXName n <> text "\")"
<+> toattr <+> text "[]) ()]")
$$
text "parseContents = do" $$
nest 4 ((if not $ null fs then
text "{ (Elem _ as []) <- element [\""
else
text "{ (Elem _ _ []) <- element [\"")
<> ppXName n <> text "\"]" $$
text "; return" <+> frretval $$
text "} `adjustErr` (\"in <" <> ppXName n
<> text ">, \"++)"
)
)
$$
mkInstanceAttrs Same n fs | 1,290 | mkInstance :: TypeDef -> Doc
mkInstance (DataDef _ n fs []) =
let (_, frattr, topat, toattr) = attrpats fs
frretval = if null fs then ppHName n else frattr
topatval = if null fs then ppHName n else topat
in
text "instance HTypeable" <+> ppHName n <+> text "where" $$
nest 4 ( text "toHType _ = Defined \"" <> ppXName n <> text "\" [] []" )
$$
text "instance XmlContent" <+> ppHName n <+> text "where" $$
nest 4 (
text "toContents" <+> topatval <+> text "=" $$
nest 4 (text "[CElem (Elem (N \"" <> ppXName n <> text "\")"
<+> toattr <+> text "[]) ()]")
$$
text "parseContents = do" $$
nest 4 ((if not $ null fs then
text "{ (Elem _ as []) <- element [\""
else
text "{ (Elem _ _ []) <- element [\"")
<> ppXName n <> text "\"]" $$
text "; return" <+> frretval $$
text "} `adjustErr` (\"in <" <> ppXName n
<> text ">, \"++)"
)
)
$$
mkInstanceAttrs Same n fs | 1,211 | mkInstance (DataDef _ n fs []) =
let (_, frattr, topat, toattr) = attrpats fs
frretval = if null fs then ppHName n else frattr
topatval = if null fs then ppHName n else topat
in
text "instance HTypeable" <+> ppHName n <+> text "where" $$
nest 4 ( text "toHType _ = Defined \"" <> ppXName n <> text "\" [] []" )
$$
text "instance XmlContent" <+> ppHName n <+> text "where" $$
nest 4 (
text "toContents" <+> topatval <+> text "=" $$
nest 4 (text "[CElem (Elem (N \"" <> ppXName n <> text "\")"
<+> toattr <+> text "[]) ()]")
$$
text "parseContents = do" $$
nest 4 ((if not $ null fs then
text "{ (Elem _ as []) <- element [\""
else
text "{ (Elem _ _ []) <- element [\"")
<> ppXName n <> text "\"]" $$
text "; return" <+> frretval $$
text "} `adjustErr` (\"in <" <> ppXName n
<> text ">, \"++)"
)
)
$$
mkInstanceAttrs Same n fs | 1,182 | true | true | 4 | 21 | 545 | 333 | 156 | 177 | null | null |
rwbarton/rw | Crawl/Item.hs | bsd-3-clause | itemColor :: Item -> Color
itemColor (Item _ _ color _) = color | 63 | itemColor :: Item -> Color
itemColor (Item _ _ color _) = color | 63 | itemColor (Item _ _ color _) = color | 36 | false | true | 0 | 7 | 12 | 30 | 15 | 15 | null | null |
penguinland/nlp | GrammarFilters.hs | gpl-3.0 | isInfinitive (ConjunctivePhrase _ _ end _) = isInfinitive end | 61 | isInfinitive (ConjunctivePhrase _ _ end _) = isInfinitive end | 61 | isInfinitive (ConjunctivePhrase _ _ end _) = isInfinitive end | 61 | false | false | 0 | 7 | 8 | 24 | 11 | 13 | null | null |
rCEx/feldspar-lang-small | src/Feldspar/BitVector.hs | bsd-3-clause | (++) :: forall w . (Unit w) =>
BitVector w -> BitVector w -> BitVector w
(BitVector ss) ++ (BitVector zs) = BitVector $ ss Prelude.++ zs | 140 | (++) :: forall w . (Unit w) =>
BitVector w -> BitVector w -> BitVector w
(BitVector ss) ++ (BitVector zs) = BitVector $ ss Prelude.++ zs | 140 | (BitVector ss) ++ (BitVector zs) = BitVector $ ss Prelude.++ zs | 63 | false | true | 0 | 9 | 30 | 76 | 37 | 39 | null | null |
jwiegley/hnix | src/Nix/Builtins.hs | bsd-3-clause | import_
:: forall e t f m . MonadNix e t f m => NValue t f m -> m (NValue t f m)
import_ = scopedImport (nvSet M.empty M.empty) | 129 | import_
:: forall e t f m . MonadNix e t f m => NValue t f m -> m (NValue t f m)
import_ = scopedImport (nvSet M.empty M.empty) | 129 | import_ = scopedImport (nvSet M.empty M.empty) | 46 | false | true | 0 | 10 | 31 | 74 | 37 | 37 | null | null |
denisshevchenko/breadu.info | test/Spec.hs | mit | main :: IO ()
main = hspec $ do
calculatorTesting | 53 | main :: IO ()
main = hspec $ do
calculatorTesting | 53 | main = hspec $ do
calculatorTesting | 39 | false | true | 2 | 7 | 13 | 30 | 12 | 18 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.