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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
alexbiehl/hoop
|
hadoop-protos/src/Hadoop/Protos/YarnServerResourceManagerRecoveryProtos/RMAppStateProto.hs
|
mit
|
toMaybe'Enum 10 = Prelude'.Just RMAPP_KILLED
| 44 |
toMaybe'Enum 10 = Prelude'.Just RMAPP_KILLED
| 44 |
toMaybe'Enum 10 = Prelude'.Just RMAPP_KILLED
| 44 | false | false | 0 | 6 | 4 | 14 | 6 | 8 | null | null |
uduki/hsQt
|
Qtc/ClassTypes/Core.hs
|
bsd-2-clause
|
withQUuidResult :: IO (Ptr (TQUuid a)) -> IO (QUuid a)
withQUuidResult f
= withObjectResult qtc_QUuid_getFinalizer f
| 118 |
withQUuidResult :: IO (Ptr (TQUuid a)) -> IO (QUuid a)
withQUuidResult f
= withObjectResult qtc_QUuid_getFinalizer f
| 118 |
withQUuidResult f
= withObjectResult qtc_QUuid_getFinalizer f
| 63 | false | true | 0 | 10 | 17 | 47 | 22 | 25 | null | null |
snoyberg/ghc
|
compiler/backpack/RnModIface.hs
|
bsd-3-clause
|
rnIfaceDecl d@IfaceAxiom{} = do
tycon <- rnIfaceTyCon (ifTyCon d)
ax_branches <- mapM rnIfaceAxBranch (ifAxBranches d)
return d { ifTyCon = tycon
, ifAxBranches = ax_branches
}
| 254 |
rnIfaceDecl d@IfaceAxiom{} = do
tycon <- rnIfaceTyCon (ifTyCon d)
ax_branches <- mapM rnIfaceAxBranch (ifAxBranches d)
return d { ifTyCon = tycon
, ifAxBranches = ax_branches
}
| 254 |
rnIfaceDecl d@IfaceAxiom{} = do
tycon <- rnIfaceTyCon (ifTyCon d)
ax_branches <- mapM rnIfaceAxBranch (ifAxBranches d)
return d { ifTyCon = tycon
, ifAxBranches = ax_branches
}
| 254 | false | false | 0 | 10 | 103 | 70 | 34 | 36 | null | null |
beni55/haste-compiler
|
libraries/ghc-7.10/array/Data/Array/Base.hs
|
bsd-3-clause
|
listUArrayST :: (MArray (STUArray s) e (ST s), Ix i)
=> (i,i) -> [e] -> ST s (STUArray s i e)
listUArrayST (l,u) es = do
marr <- newArray_ (l,u)
let n = safeRangeSize (l,u)
let fillFromList i xs | i == n = return ()
| otherwise = case xs of
[] -> return ()
y:ys -> unsafeWrite marr i y >> fillFromList (i+1) ys
fillFromList 0 es
return marr
-- I don't know how to write a single rule for listUArrayST, because
-- the type looks like constrained over 's', which runST doesn't
-- like. In fact all MArray (STUArray s) instances are polymorphic
-- wrt. 's', but runST can't know that.
--
-- More precisely, we'd like to write this:
-- listUArray :: (forall s. MArray (STUArray s) e (ST s), Ix i)
-- => (i,i) -> [e] -> UArray i e
-- listUArray lu = runST (listUArrayST lu es >>= unsafeFreezeSTUArray)
-- {-# RULES listArray = listUArray
-- Then we could call listUArray at any type 'e' that had a suitable
-- MArray instance. But sadly we can't, because we don't have quantified
-- constraints. Hence the mass of rules below.
-- I would like also to write a rule for listUArrayST (or listArray or
-- whatever) applied to unpackCString#. Unfortunately unpackCString#
-- calls seem to be floated out, then floated back into the middle
-- of listUArrayST, so I was not able to do this.
| 1,389 |
listUArrayST :: (MArray (STUArray s) e (ST s), Ix i)
=> (i,i) -> [e] -> ST s (STUArray s i e)
listUArrayST (l,u) es = do
marr <- newArray_ (l,u)
let n = safeRangeSize (l,u)
let fillFromList i xs | i == n = return ()
| otherwise = case xs of
[] -> return ()
y:ys -> unsafeWrite marr i y >> fillFromList (i+1) ys
fillFromList 0 es
return marr
-- I don't know how to write a single rule for listUArrayST, because
-- the type looks like constrained over 's', which runST doesn't
-- like. In fact all MArray (STUArray s) instances are polymorphic
-- wrt. 's', but runST can't know that.
--
-- More precisely, we'd like to write this:
-- listUArray :: (forall s. MArray (STUArray s) e (ST s), Ix i)
-- => (i,i) -> [e] -> UArray i e
-- listUArray lu = runST (listUArrayST lu es >>= unsafeFreezeSTUArray)
-- {-# RULES listArray = listUArray
-- Then we could call listUArray at any type 'e' that had a suitable
-- MArray instance. But sadly we can't, because we don't have quantified
-- constraints. Hence the mass of rules below.
-- I would like also to write a rule for listUArrayST (or listArray or
-- whatever) applied to unpackCString#. Unfortunately unpackCString#
-- calls seem to be floated out, then floated back into the middle
-- of listUArrayST, so I was not able to do this.
| 1,389 |
listUArrayST (l,u) es = do
marr <- newArray_ (l,u)
let n = safeRangeSize (l,u)
let fillFromList i xs | i == n = return ()
| otherwise = case xs of
[] -> return ()
y:ys -> unsafeWrite marr i y >> fillFromList (i+1) ys
fillFromList 0 es
return marr
-- I don't know how to write a single rule for listUArrayST, because
-- the type looks like constrained over 's', which runST doesn't
-- like. In fact all MArray (STUArray s) instances are polymorphic
-- wrt. 's', but runST can't know that.
--
-- More precisely, we'd like to write this:
-- listUArray :: (forall s. MArray (STUArray s) e (ST s), Ix i)
-- => (i,i) -> [e] -> UArray i e
-- listUArray lu = runST (listUArrayST lu es >>= unsafeFreezeSTUArray)
-- {-# RULES listArray = listUArray
-- Then we could call listUArray at any type 'e' that had a suitable
-- MArray instance. But sadly we can't, because we don't have quantified
-- constraints. Hence the mass of rules below.
-- I would like also to write a rule for listUArrayST (or listArray or
-- whatever) applied to unpackCString#. Unfortunately unpackCString#
-- calls seem to be floated out, then floated back into the middle
-- of listUArrayST, so I was not able to do this.
| 1,282 | false | true | 0 | 17 | 350 | 238 | 124 | 114 | null | null |
equational/JL2012
|
HaskellExamples/src/MMM.hs
|
mit
|
toOrState
:: StateR err stateIn stateOut ret
-> StateR err stateIn stateOut ret
-> StateR err stateIn stateOut ret
toOrState f1 f2 = StateOr f1 f2
| 158 |
toOrState
:: StateR err stateIn stateOut ret
-> StateR err stateIn stateOut ret
-> StateR err stateIn stateOut ret
toOrState f1 f2 = StateOr f1 f2
| 158 |
toOrState f1 f2 = StateOr f1 f2
| 31 | false | true | 0 | 7 | 37 | 59 | 27 | 32 | null | null |
smaccm/capDL-tool
|
CapDL/PrintIsabelle.hs
|
bsd-2-clause
|
completeMap x [] = x
| 20 |
completeMap x [] = x
| 20 |
completeMap x [] = x
| 20 | false | false | 0 | 6 | 4 | 13 | 6 | 7 | null | null |
jyp/ControlledFusion
|
Control/Fusion/List/NonEmptyNu.hs
|
gpl-3.0
|
enumFromToNeNu :: (Enum a,Ord a) => a -> a -> NeNuList a
enumFromToNeNu from to = Unfold from $ \ n -> if n < to then Yield n (succ n) else Last n
| 146 |
enumFromToNeNu :: (Enum a,Ord a) => a -> a -> NeNuList a
enumFromToNeNu from to = Unfold from $ \ n -> if n < to then Yield n (succ n) else Last n
| 146 |
enumFromToNeNu from to = Unfold from $ \ n -> if n < to then Yield n (succ n) else Last n
| 89 | false | true | 0 | 10 | 33 | 84 | 41 | 43 | null | null |
ezyang/ghc
|
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
|
bsd-3-clause
|
tupleTypeName 0 = mk_tup_name 0 TcClsName
| 41 |
tupleTypeName 0 = mk_tup_name 0 TcClsName
| 41 |
tupleTypeName 0 = mk_tup_name 0 TcClsName
| 41 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
sherwoodwang/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxSTC_PERFORMED_USER :: Int
wxSTC_PERFORMED_USER = 16
| 53 |
wxSTC_PERFORMED_USER :: Int
wxSTC_PERFORMED_USER = 16
| 53 |
wxSTC_PERFORMED_USER = 16
| 25 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
weshack/thelist
|
TheList/Handler/AllUsers.hs
|
gpl-3.0
|
getAllUsersR :: Handler Value
getAllUsersR = do
users <- runDB $ selectList [] [] :: Handler [Entity User]
returnJson users
| 131 |
getAllUsersR :: Handler Value
getAllUsersR = do
users <- runDB $ selectList [] [] :: Handler [Entity User]
returnJson users
| 131 |
getAllUsersR = do
users <- runDB $ selectList [] [] :: Handler [Entity User]
returnJson users
| 101 | false | true | 1 | 11 | 27 | 56 | 24 | 32 | null | null |
siddhanathan/ghc
|
testsuite/tests/partial-sigs/should_compile/AddAndOr2.hs
|
bsd-3-clause
|
addAndOr2 :: _ -> _
addAndOr2 (a, b) (c, d) = (a `plus` d, b || c)
where plus :: Int -> Int -> Int
x `plus` y = x + y
| 127 |
addAndOr2 :: _ -> _
addAndOr2 (a, b) (c, d) = (a `plus` d, b || c)
where plus :: Int -> Int -> Int
x `plus` y = x + y
| 127 |
addAndOr2 (a, b) (c, d) = (a `plus` d, b || c)
where plus :: Int -> Int -> Int
x `plus` y = x + y
| 107 | false | true | 3 | 8 | 41 | 89 | 45 | 44 | null | null |
tjakway/ghcjvm
|
libraries/template-haskell/Language/Haskell/TH/Lib.hs
|
bsd-3-clause
|
fromThenE :: ExpQ -> ExpQ -> ExpQ
fromThenE x y = do { a <- x; b <- y; return (ArithSeqE (FromThenR a b)) }
| 107 |
fromThenE :: ExpQ -> ExpQ -> ExpQ
fromThenE x y = do { a <- x; b <- y; return (ArithSeqE (FromThenR a b)) }
| 107 |
fromThenE x y = do { a <- x; b <- y; return (ArithSeqE (FromThenR a b)) }
| 73 | false | true | 0 | 12 | 24 | 68 | 32 | 36 | null | null |
green-haskell/ghc
|
compiler/coreSyn/CoreUnfold.hs
|
bsd-3-clause
|
classOpSize dflags top_args (arg1 : other_args)
= SizeIs (iUnbox size) arg_discount (_ILIT(0))
where
size = 20 + (10 * length other_args)
-- If the class op is scrutinising a lambda bound dictionary then
-- give it a discount, to encourage the inlining of this function
-- The actual discount is rather arbitrarily chosen
arg_discount = case arg1 of
Var dict | dict `elem` top_args
-> unitBag (dict, ufDictDiscount dflags)
_other -> emptyBag
| 539 |
classOpSize dflags top_args (arg1 : other_args)
= SizeIs (iUnbox size) arg_discount (_ILIT(0))
where
size = 20 + (10 * length other_args)
-- If the class op is scrutinising a lambda bound dictionary then
-- give it a discount, to encourage the inlining of this function
-- The actual discount is rather arbitrarily chosen
arg_discount = case arg1 of
Var dict | dict `elem` top_args
-> unitBag (dict, ufDictDiscount dflags)
_other -> emptyBag
| 539 |
classOpSize dflags top_args (arg1 : other_args)
= SizeIs (iUnbox size) arg_discount (_ILIT(0))
where
size = 20 + (10 * length other_args)
-- If the class op is scrutinising a lambda bound dictionary then
-- give it a discount, to encourage the inlining of this function
-- The actual discount is rather arbitrarily chosen
arg_discount = case arg1 of
Var dict | dict `elem` top_args
-> unitBag (dict, ufDictDiscount dflags)
_other -> emptyBag
| 539 | false | false | 4 | 11 | 169 | 125 | 59 | 66 | null | null |
bitemyapp/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
luxiReqQueryFilters :: String
luxiReqQueryFilters = "QueryFilters"
| 66 |
luxiReqQueryFilters :: String
luxiReqQueryFilters = "QueryFilters"
| 66 |
luxiReqQueryFilters = "QueryFilters"
| 36 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
kmate/HaRe
|
old/testing/renaming/B4_AstOut.hs
|
bsd-3-clause
|
myFringe (Branch left right) = myFringe right
| 45 |
myFringe (Branch left right) = myFringe right
| 45 |
myFringe (Branch left right) = myFringe right
| 45 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
DanielG/kvm-in-a-box
|
src/Utils.hs
|
agpl-3.0
|
alldifferent [] = True
| 22 |
alldifferent [] = True
| 22 |
alldifferent [] = True
| 22 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
ZjMNZHgG5jMXw/privacy-option
|
Language/POL/Syntax/Test.hs
|
bsd-3-clause
|
c1 = pdata "a" "a"
| 18 |
c1 = pdata "a" "a"
| 18 |
c1 = pdata "a" "a"
| 18 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
smurphy8/issue-add
|
src/Action/Internal/Label.hs
|
bsd-3-clause
|
toLabelColorString Wontfix = dropHash "#7F516D"
| 60 |
toLabelColorString Wontfix = dropHash "#7F516D"
| 60 |
toLabelColorString Wontfix = dropHash "#7F516D"
| 60 | false | false | 0 | 5 | 17 | 12 | 5 | 7 | null | null |
michaelt/remorse
|
Remorse/FreeT/Prelude.hs
|
bsd-3-clause
|
repeatM :: Monad m => m a -> FreeT (Of a) m r
repeatM ma = do a <- lift ma
yield a
repeatM ma
| 127 |
repeatM :: Monad m => m a -> FreeT (Of a) m r
repeatM ma = do a <- lift ma
yield a
repeatM ma
| 127 |
repeatM ma = do a <- lift ma
yield a
repeatM ma
| 81 | false | true | 0 | 9 | 58 | 63 | 27 | 36 | null | null |
onponomarev/ganeti
|
src/Ganeti/Types.hs
|
bsd-2-clause
|
-- | The description of the node role.
roleDescription :: NodeRole -> String
roleDescription NROffline = "offline"
| 116 |
roleDescription :: NodeRole -> String
roleDescription NROffline = "offline"
| 77 |
roleDescription NROffline = "offline"
| 39 | true | true | 0 | 5 | 18 | 19 | 10 | 9 | null | null |
ccressent/cressent.org
|
src/website.hs
|
mit
|
main :: IO ()
main = hakyllWith config $ do
match "templates/*" $ compile templateCompiler
match (fromList staticFiles) $ do
route idRoute
compile copyFileCompiler
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "fonts/*" $ do
route idRoute
compile copyFileCompiler
match "styles/*" $
compile $ liftM (fmap compressCss) $
getResourceFilePath
>>= \fp -> unixFilter "sass" ["--scss", fp] ""
>>= makeItem
create ["styles.css"] $ do
route idRoute
compile $ do
items <- loadAll "styles/*"
makeItem $ concatMap itemBody (items :: [Item String])
match "about.md" $ do
route $ setExtension ".html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/main.html" defaultContext
>>= relativizeUrls
match "home.md" $ do
route $ setExtension ".html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/main.html" defaultContext
>>= relativizeUrls
match "articles/*" $ do
route $ setExtension ".html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/article.html" articleCtx
>>= loadAndApplyTemplate "templates/main.html" articleCtx
>>= relativizeUrls
create ["articles.html"] $ do
route idRoute
compile $ do
articles <- recentFirst =<< loadAll "articles/*"
let context =
listField "articles" articleCtx (return articles)
<> constField "title" "Articles"
<> defaultContext
makeItem ""
>>= loadAndApplyTemplate "templates/article-list.html" context
>>= loadAndApplyTemplate "templates/main.html" context
>>= relativizeUrls
| 1,934 |
main :: IO ()
main = hakyllWith config $ do
match "templates/*" $ compile templateCompiler
match (fromList staticFiles) $ do
route idRoute
compile copyFileCompiler
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "fonts/*" $ do
route idRoute
compile copyFileCompiler
match "styles/*" $
compile $ liftM (fmap compressCss) $
getResourceFilePath
>>= \fp -> unixFilter "sass" ["--scss", fp] ""
>>= makeItem
create ["styles.css"] $ do
route idRoute
compile $ do
items <- loadAll "styles/*"
makeItem $ concatMap itemBody (items :: [Item String])
match "about.md" $ do
route $ setExtension ".html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/main.html" defaultContext
>>= relativizeUrls
match "home.md" $ do
route $ setExtension ".html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/main.html" defaultContext
>>= relativizeUrls
match "articles/*" $ do
route $ setExtension ".html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/article.html" articleCtx
>>= loadAndApplyTemplate "templates/main.html" articleCtx
>>= relativizeUrls
create ["articles.html"] $ do
route idRoute
compile $ do
articles <- recentFirst =<< loadAll "articles/*"
let context =
listField "articles" articleCtx (return articles)
<> constField "title" "Articles"
<> defaultContext
makeItem ""
>>= loadAndApplyTemplate "templates/article-list.html" context
>>= loadAndApplyTemplate "templates/main.html" context
>>= relativizeUrls
| 1,934 |
main = hakyllWith config $ do
match "templates/*" $ compile templateCompiler
match (fromList staticFiles) $ do
route idRoute
compile copyFileCompiler
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "fonts/*" $ do
route idRoute
compile copyFileCompiler
match "styles/*" $
compile $ liftM (fmap compressCss) $
getResourceFilePath
>>= \fp -> unixFilter "sass" ["--scss", fp] ""
>>= makeItem
create ["styles.css"] $ do
route idRoute
compile $ do
items <- loadAll "styles/*"
makeItem $ concatMap itemBody (items :: [Item String])
match "about.md" $ do
route $ setExtension ".html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/main.html" defaultContext
>>= relativizeUrls
match "home.md" $ do
route $ setExtension ".html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/main.html" defaultContext
>>= relativizeUrls
match "articles/*" $ do
route $ setExtension ".html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/article.html" articleCtx
>>= loadAndApplyTemplate "templates/main.html" articleCtx
>>= relativizeUrls
create ["articles.html"] $ do
route idRoute
compile $ do
articles <- recentFirst =<< loadAll "articles/*"
let context =
listField "articles" articleCtx (return articles)
<> constField "title" "Articles"
<> defaultContext
makeItem ""
>>= loadAndApplyTemplate "templates/article-list.html" context
>>= loadAndApplyTemplate "templates/main.html" context
>>= relativizeUrls
| 1,920 | false | true | 0 | 21 | 654 | 453 | 196 | 257 | null | null |
sdiehl/ghc
|
compiler/basicTypes/BasicTypes.hs
|
bsd-3-clause
|
isTopLevel TopLevel = True
| 30 |
isTopLevel TopLevel = True
| 30 |
isTopLevel TopLevel = True
| 30 | false | false | 0 | 5 | 7 | 9 | 4 | 5 | null | null |
Shimuuar/protobuf
|
Data/Protobuf/Internal/Transform.hs
|
bsd-3-clause
|
collectPackageNames path (TopEnum e) =
TopEnum <$> collectEnumNames path e
| 85 |
collectPackageNames path (TopEnum e) =
TopEnum <$> collectEnumNames path e
| 85 |
collectPackageNames path (TopEnum e) =
TopEnum <$> collectEnumNames path e
| 85 | false | false | 0 | 7 | 20 | 26 | 12 | 14 | null | null |
frantisekfarka/CoALP
|
tests/CoALP/Tests/Unit/Transform.hs
|
lgpl-3.0
|
ppProg :: (Show a, Show b, Show c) => Program a b c -> String
ppProg = concat . intersperse "\n" . (map ppClause)
| 113 |
ppProg :: (Show a, Show b, Show c) => Program a b c -> String
ppProg = concat . intersperse "\n" . (map ppClause)
| 113 |
ppProg = concat . intersperse "\n" . (map ppClause)
| 51 | false | true | 2 | 8 | 23 | 69 | 31 | 38 | null | null |
uduki/hsQt
|
Qtc/Gui/QTabBar.hs
|
bsd-2-clause
|
tabRect :: QTabBar a -> ((Int)) -> IO (Rect)
tabRect x0 (x1)
= withRectResult $ \crect_ret_x crect_ret_y crect_ret_w crect_ret_h ->
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTabBar_tabRect_qth cobj_x0 (toCInt x1) crect_ret_x crect_ret_y crect_ret_w crect_ret_h
| 264 |
tabRect :: QTabBar a -> ((Int)) -> IO (Rect)
tabRect x0 (x1)
= withRectResult $ \crect_ret_x crect_ret_y crect_ret_w crect_ret_h ->
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTabBar_tabRect_qth cobj_x0 (toCInt x1) crect_ret_x crect_ret_y crect_ret_w crect_ret_h
| 264 |
tabRect x0 (x1)
= withRectResult $ \crect_ret_x crect_ret_y crect_ret_w crect_ret_h ->
withObjectPtr x0 $ \cobj_x0 ->
qtc_QTabBar_tabRect_qth cobj_x0 (toCInt x1) crect_ret_x crect_ret_y crect_ret_w crect_ret_h
| 219 | false | true | 0 | 11 | 42 | 88 | 45 | 43 | null | null |
rahulmutt/ghcvm
|
compiler/Eta/Rename/RnTypes.hs
|
bsd-3-clause
|
rnLHsKind :: HsDocContext -> LHsKind RdrName -> RnM (LHsKind Name, FreeVars)
rnLHsKind = rnLHsTyKi False
| 105 |
rnLHsKind :: HsDocContext -> LHsKind RdrName -> RnM (LHsKind Name, FreeVars)
rnLHsKind = rnLHsTyKi False
| 105 |
rnLHsKind = rnLHsTyKi False
| 27 | false | true | 0 | 10 | 15 | 43 | 19 | 24 | null | null |
jtdawso/remote-haxl
|
tests/Test.hs
|
bsd-3-clause
|
runSP tr ref (SP.Procedure p) = runWP tr ref (WP.Procedure p)
| 64 |
runSP tr ref (SP.Procedure p) = runWP tr ref (WP.Procedure p)
| 64 |
runSP tr ref (SP.Procedure p) = runWP tr ref (WP.Procedure p)
| 64 | false | false | 0 | 8 | 13 | 36 | 17 | 19 | null | null |
mzini/gubs
|
src/GUBS/Solver/MiniSMT.hs
|
mit
|
constraints :: SolverState -> [SMTFormula MiniSMT]
constraints st = concatMap fConstraints (curFrame st : frameStack st)
| 120 |
constraints :: SolverState -> [SMTFormula MiniSMT]
constraints st = concatMap fConstraints (curFrame st : frameStack st)
| 120 |
constraints st = concatMap fConstraints (curFrame st : frameStack st)
| 69 | false | true | 0 | 8 | 15 | 42 | 20 | 22 | null | null |
kawamuray/ganeti
|
src/Ganeti/DataCollectors/Lv.hs
|
gpl-2.0
|
-- | The default setting for the maximum amount of not parsed character to
-- print in case of error.
-- It is set to use most of the screen estate on a standard 80x25 terminal.
-- TODO: add the possibility to set this with a command line parameter.
defaultCharNum :: Int
defaultCharNum = 80*20
| 294 |
defaultCharNum :: Int
defaultCharNum = 80*20
| 44 |
defaultCharNum = 80*20
| 22 | true | true | 0 | 5 | 54 | 19 | 12 | 7 | null | null |
cauterize-tools/cauterize
|
tests/Cauterize/Specification/CompileSpec.hs
|
bsd-3-clause
|
unionIndicies :: Either a Specification -> [Integer]
unionIndicies (Right (Specification { specTypes = [ Type { typeDesc = desc } ] } ) ) =
case desc of
Union { unionFields = fs } -> map fieldIndex fs
_ -> []
| 218 |
unionIndicies :: Either a Specification -> [Integer]
unionIndicies (Right (Specification { specTypes = [ Type { typeDesc = desc } ] } ) ) =
case desc of
Union { unionFields = fs } -> map fieldIndex fs
_ -> []
| 218 |
unionIndicies (Right (Specification { specTypes = [ Type { typeDesc = desc } ] } ) ) =
case desc of
Union { unionFields = fs } -> map fieldIndex fs
_ -> []
| 165 | false | true | 2 | 15 | 50 | 90 | 46 | 44 | null | null |
tdeekens/tda452-code
|
Lab-4-Submission/BattleshipHaste.hs
|
mit
|
nextTarget West (_,0) = Nothing
| 32 |
nextTarget West (_,0) = Nothing
| 32 |
nextTarget West (_,0) = Nothing
| 32 | false | false | 0 | 5 | 5 | 19 | 9 | 10 | null | null |
input-output-hk/pos-haskell-prototype
|
faucet/src/Cardano/Faucet/Endpoints.hs
|
mit
|
returnAddress :: (MonadFaucet c m) => m (V1 Address)
returnAddress = view feReturnAddress
| 89 |
returnAddress :: (MonadFaucet c m) => m (V1 Address)
returnAddress = view feReturnAddress
| 89 |
returnAddress = view feReturnAddress
| 36 | false | true | 0 | 8 | 12 | 34 | 17 | 17 | null | null |
jwiegley/ghc-release
|
libraries/Cabal/cabal/tests/PackageTests.hs
|
gpl-3.0
|
getPersistBuildConfig_ :: FilePath -> IO LocalBuildInfo
getPersistBuildConfig_ filename = do
exists <- doesFileExist filename
if not exists
then die missing
else withFileContents filename $ \str ->
case lines str of
[_header, rest] -> case reads rest of
[(bi,_)] -> return bi
_ -> die cantParse
_ -> die cantParse
where
missing = "Run the 'configure' command first."
cantParse = "Saved package config file seems to be corrupt. "
++ "Try re-running the 'configure' command."
| 570 |
getPersistBuildConfig_ :: FilePath -> IO LocalBuildInfo
getPersistBuildConfig_ filename = do
exists <- doesFileExist filename
if not exists
then die missing
else withFileContents filename $ \str ->
case lines str of
[_header, rest] -> case reads rest of
[(bi,_)] -> return bi
_ -> die cantParse
_ -> die cantParse
where
missing = "Run the 'configure' command first."
cantParse = "Saved package config file seems to be corrupt. "
++ "Try re-running the 'configure' command."
| 570 |
getPersistBuildConfig_ filename = do
exists <- doesFileExist filename
if not exists
then die missing
else withFileContents filename $ \str ->
case lines str of
[_header, rest] -> case reads rest of
[(bi,_)] -> return bi
_ -> die cantParse
_ -> die cantParse
where
missing = "Run the 'configure' command first."
cantParse = "Saved package config file seems to be corrupt. "
++ "Try re-running the 'configure' command."
| 514 | false | true | 1 | 17 | 170 | 141 | 68 | 73 | null | null |
pparkkin/eta
|
compiler/ETA/Prelude/PrelNames.hs
|
bsd-3-clause
|
rec1TyConKey = mkPreludeTyConUnique 138
| 40 |
rec1TyConKey = mkPreludeTyConUnique 138
| 40 |
rec1TyConKey = mkPreludeTyConUnique 138
| 40 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
Unisay/dancher
|
src/Topic/Controller.hs
|
bsd-3-clause
|
serverT :: ServerT TopicApi Response
serverT = allTopics -- GET /topics
:<|> lookupTopic -- GET /topics/:topic-id
:<|> createTopic -- POST /topics
:<|> deleteTopic -- DELETE /topics/:topic-id
:<|> upsertTopic
| 254 |
serverT :: ServerT TopicApi Response
serverT = allTopics -- GET /topics
:<|> lookupTopic -- GET /topics/:topic-id
:<|> createTopic -- POST /topics
:<|> deleteTopic -- DELETE /topics/:topic-id
:<|> upsertTopic
| 254 |
serverT = allTopics -- GET /topics
:<|> lookupTopic -- GET /topics/:topic-id
:<|> createTopic -- POST /topics
:<|> deleteTopic -- DELETE /topics/:topic-id
:<|> upsertTopic
| 217 | false | true | 13 | 5 | 73 | 52 | 28 | 24 | null | null |
fpco/fay
|
src/Fay/Compiler/Exp.hs
|
bsd-3-clause
|
optEnumFromTo _ _ _ = Nothing
| 29 |
optEnumFromTo _ _ _ = Nothing
| 29 |
optEnumFromTo _ _ _ = Nothing
| 29 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
GaloisInc/mime
|
Codec/MIME/QuotedPrintable.hs
|
bsd-3-clause
|
decode ('=':'\r':'\n':xs) = decode xs
| 37 |
decode ('=':'\r':'\n':xs) = decode xs
| 37 |
decode ('=':'\r':'\n':xs) = decode xs
| 37 | false | false | 0 | 7 | 4 | 24 | 11 | 13 | null | null |
yiannist/ganeti
|
src/Ganeti/Utils.hs
|
bsd-2-clause
|
{-| Strip a prefix from a string, allowing the last character of the prefix
(which is assumed to be a separator) to be absent from the string if the string
terminates there.
\>>> chompPrefix \"foo:bar:\" \"a:b:c\"
Nothing
\>>> chompPrefix \"foo:bar:\" \"foo:bar:baz\"
Just \"baz\"
\>>> chompPrefix \"foo:bar:\" \"foo:bar:\"
Just \"\"
\>>> chompPrefix \"foo:bar:\" \"foo:bar\"
Just \"\"
\>>> chompPrefix \"foo:bar:\" \"foo:barbaz\"
Nothing
-}
chompPrefix :: String -> String -> Maybe String
chompPrefix pfx str =
if pfx `isPrefixOf` str || str == init pfx
then Just $ drop (length pfx) str
else Nothing
| 616 |
chompPrefix :: String -> String -> Maybe String
chompPrefix pfx str =
if pfx `isPrefixOf` str || str == init pfx
then Just $ drop (length pfx) str
else Nothing
| 169 |
chompPrefix pfx str =
if pfx `isPrefixOf` str || str == init pfx
then Just $ drop (length pfx) str
else Nothing
| 121 | true | true | 0 | 9 | 105 | 68 | 35 | 33 | null | null |
hermish/courseography
|
app/Css/Constants.hs
|
gpl-3.0
|
{- Node and rectangle constants,
- including sizes, strokes, fills,
- opacities, colors and alignments. -}
-- |Defines "fill" as text for CSS.
fill :: Text -> Css
fill = (-:) "fill"
| 184 |
fill :: Text -> Css
fill = (-:) "fill"
| 38 |
fill = (-:) "fill"
| 18 | true | true | 0 | 7 | 34 | 29 | 14 | 15 | null | null |
davnils/distr-btc
|
src/HTrade/Backend/Storage.hs
|
bsd-3-clause
|
buildCassandraSchema :: CassandraTable -> T.Text
buildCassandraSchema s = "(" <> T.intercalate ", " schemaStr <> ")" <> suffix (_schemaProperties s)
where
schemaStr = map (\(field, fieldType) -> field <> " " <> fieldType) $ _schema s
suffix "" = ""
suffix str = " " <> str
-- | Cassandra host to be used.
| 313 |
buildCassandraSchema :: CassandraTable -> T.Text
buildCassandraSchema s = "(" <> T.intercalate ", " schemaStr <> ")" <> suffix (_schemaProperties s)
where
schemaStr = map (\(field, fieldType) -> field <> " " <> fieldType) $ _schema s
suffix "" = ""
suffix str = " " <> str
-- | Cassandra host to be used.
| 313 |
buildCassandraSchema s = "(" <> T.intercalate ", " schemaStr <> ")" <> suffix (_schemaProperties s)
where
schemaStr = map (\(field, fieldType) -> field <> " " <> fieldType) $ _schema s
suffix "" = ""
suffix str = " " <> str
-- | Cassandra host to be used.
| 264 | false | true | 5 | 9 | 62 | 125 | 56 | 69 | null | null |
input-output-hk/pos-haskell-prototype
|
binary/test/Test/Pos/Cbor/RefImpl.hs
|
mit
|
decodeMap :: [(Term, Term)] -> Decoder Term
decodeMap acc = do
tk <- decodeToken
case tk of
MT7_Break -> return $! TMapI (reverse acc)
_ -> do
tm <- decodeTermFrom tk
tm' <- decodeTerm
decodeMap ((tm, tm') : acc)
| 265 |
decodeMap :: [(Term, Term)] -> Decoder Term
decodeMap acc = do
tk <- decodeToken
case tk of
MT7_Break -> return $! TMapI (reverse acc)
_ -> do
tm <- decodeTermFrom tk
tm' <- decodeTerm
decodeMap ((tm, tm') : acc)
| 265 |
decodeMap acc = do
tk <- decodeToken
case tk of
MT7_Break -> return $! TMapI (reverse acc)
_ -> do
tm <- decodeTermFrom tk
tm' <- decodeTerm
decodeMap ((tm, tm') : acc)
| 221 | false | true | 0 | 17 | 91 | 111 | 52 | 59 | null | null |
x-y-z/cabal
|
Cabal/Distribution/Simple/LocalBuildInfo.hs
|
bsd-3-clause
|
-- | Extract the 'PackageKey' from the library component of a
-- 'LocalBuildInfo' if it exists, or make a fake package key based
-- on the package ID.
localPackageKey :: LocalBuildInfo -> PackageKey
localPackageKey lbi =
foldr go (OldPackageKey (package (localPkgDescr lbi))) (componentsConfigs lbi)
where go (_, clbi, _) old_pk = case clbi of
LibComponentLocalBuildInfo { componentPackageKey = pk } -> pk
_ -> old_pk
-- | Extract the 'LibraryName' from the library component of a
-- 'LocalBuildInfo' if it exists, or make a library name based
-- on the package ID.
| 596 |
localPackageKey :: LocalBuildInfo -> PackageKey
localPackageKey lbi =
foldr go (OldPackageKey (package (localPkgDescr lbi))) (componentsConfigs lbi)
where go (_, clbi, _) old_pk = case clbi of
LibComponentLocalBuildInfo { componentPackageKey = pk } -> pk
_ -> old_pk
-- | Extract the 'LibraryName' from the library component of a
-- 'LocalBuildInfo' if it exists, or make a library name based
-- on the package ID.
| 445 |
localPackageKey lbi =
foldr go (OldPackageKey (package (localPkgDescr lbi))) (componentsConfigs lbi)
where go (_, clbi, _) old_pk = case clbi of
LibComponentLocalBuildInfo { componentPackageKey = pk } -> pk
_ -> old_pk
-- | Extract the 'LibraryName' from the library component of a
-- 'LocalBuildInfo' if it exists, or make a library name based
-- on the package ID.
| 397 | true | true | 1 | 11 | 122 | 110 | 56 | 54 | null | null |
forste/haReFork
|
tools/base/TC/TypeCheckTest.hs
|
bsd-3-clause
|
performTC ds =
perform (do { f <- newGensym
; (ngv, env, ps) <- inferDs f [] (env0 {termEnv = simpleEnv}) ds
; env' <- mapM colEnv (take (length (getTermEnv env) - length simpleEnv) (getTermEnv env))
; return (concat (map showEnv env') ++ show ps)
})
| 315 |
performTC ds =
perform (do { f <- newGensym
; (ngv, env, ps) <- inferDs f [] (env0 {termEnv = simpleEnv}) ds
; env' <- mapM colEnv (take (length (getTermEnv env) - length simpleEnv) (getTermEnv env))
; return (concat (map showEnv env') ++ show ps)
})
| 315 |
performTC ds =
perform (do { f <- newGensym
; (ngv, env, ps) <- inferDs f [] (env0 {termEnv = simpleEnv}) ds
; env' <- mapM colEnv (take (length (getTermEnv env) - length simpleEnv) (getTermEnv env))
; return (concat (map showEnv env') ++ show ps)
})
| 315 | false | false | 0 | 17 | 110 | 137 | 69 | 68 | null | null |
bitemyapp/ether
|
test/Regression.hs
|
bsd-3-clause
|
factorial :: (Num a, Ord a) => a -> (a, Int)
factorial a = I.runState (I.runReaderT recurseCore a) (0 :: Int)
| 109 |
factorial :: (Num a, Ord a) => a -> (a, Int)
factorial a = I.runState (I.runReaderT recurseCore a) (0 :: Int)
| 109 |
factorial a = I.runState (I.runReaderT recurseCore a) (0 :: Int)
| 64 | false | true | 0 | 8 | 20 | 62 | 33 | 29 | null | null |
mdsteele/fallback
|
src/Fallback/Scenario/Feats.hs
|
gpl-3.0
|
featIconCoords Cripple = (10, 0)
| 32 |
featIconCoords Cripple = (10, 0)
| 32 |
featIconCoords Cripple = (10, 0)
| 32 | false | false | 0 | 5 | 4 | 16 | 8 | 8 | null | null |
hvr/cassava
|
src/Data/Csv/Encoding.hs
|
bsd-3-clause
|
prependToAll :: Builder -> [Builder] -> [Builder]
prependToAll _ [] = []
| 78 |
prependToAll :: Builder -> [Builder] -> [Builder]
prependToAll _ [] = []
| 78 |
prependToAll _ [] = []
| 28 | false | true | 0 | 9 | 17 | 40 | 19 | 21 | null | null |
diminishedprime/.org
|
programmey_stuff/write_yourself_a_scheme/ch_07/wyas/app/Main.hs
|
mit
|
runOne :: String -> IO ()
runOne expr = nullEnv >>= flip evalAndPrint expr
| 74 |
runOne :: String -> IO ()
runOne expr = nullEnv >>= flip evalAndPrint expr
| 74 |
runOne expr = nullEnv >>= flip evalAndPrint expr
| 48 | false | true | 0 | 7 | 13 | 32 | 15 | 17 | null | null |
ti1024/hacq
|
src/Control/Monad/Quantum/Adder.hs
|
bsd-3-clause
|
increment :: (MonadQuantum w m, Foldable t) => t w -> m ()
increment x =
incrementList (Foldable.toList x)
| 110 |
increment :: (MonadQuantum w m, Foldable t) => t w -> m ()
increment x =
incrementList (Foldable.toList x)
| 110 |
increment x =
incrementList (Foldable.toList x)
| 51 | false | true | 0 | 9 | 22 | 59 | 27 | 32 | null | null |
ribag/ganeti-experiments
|
src/Ganeti/Query/Language.hs
|
gpl-2.0
|
showFilter (RegexpFilter field regexp) =
JSArray [showJSON C.qlangOpRegexp, showJSON field, showJSON regexp]
| 110 |
showFilter (RegexpFilter field regexp) =
JSArray [showJSON C.qlangOpRegexp, showJSON field, showJSON regexp]
| 110 |
showFilter (RegexpFilter field regexp) =
JSArray [showJSON C.qlangOpRegexp, showJSON field, showJSON regexp]
| 110 | false | false | 0 | 8 | 13 | 40 | 19 | 21 | null | null |
hvr/jhc
|
src/FrontEnd/Lex/ParseMonad.hs
|
mit
|
tryP :: P a -> P a
tryP (P fa) = P $ \e -> case fa e of
(w,Nothing) -> (w,Nothing)
(w,Just v) | any (isJust . warnIsFatal . warnType) (Seq.toList w) -> (w,Nothing)
| otherwise -> (w,Just v)
| 212 |
tryP :: P a -> P a
tryP (P fa) = P $ \e -> case fa e of
(w,Nothing) -> (w,Nothing)
(w,Just v) | any (isJust . warnIsFatal . warnType) (Seq.toList w) -> (w,Nothing)
| otherwise -> (w,Just v)
| 212 |
tryP (P fa) = P $ \e -> case fa e of
(w,Nothing) -> (w,Nothing)
(w,Just v) | any (isJust . warnIsFatal . warnType) (Seq.toList w) -> (w,Nothing)
| otherwise -> (w,Just v)
| 193 | false | true | 0 | 16 | 62 | 133 | 68 | 65 | null | null |
ben-schulz/Idris-dev
|
src/Idris/IdrisDoc.hs
|
bsd-3-clause
|
wrapper :: Maybe NsName -- ^ Namespace name, unless it is the index
-> H.Html -- ^ Inner HTML
-> H.Html
wrapper ns inner =
let (index, str) = extract ns
base = if index then "" else "../"
styles = base ++ "styles.css" :: String
indexPage = base ++ "index.html" :: String
in H.docTypeHtml $ do
H.head $ do
H.title $ do
"IdrisDoc"
if index then " Index" else do
": "
toHtml str
H.link ! type_ "text/css" ! rel "stylesheet"
! href (toValue styles)
H.body ! class_ (if index then "index" else "namespace") $ do
H.div ! class_ "wrapper" $ do
H.header $ do
H.strong "IdrisDoc"
if index then Empty else do
": "
toHtml str
H.nav $ H.a ! href (toValue indexPage) $ "Index"
H.div ! class_ "container" $ inner
H.footer $ do
"Produced by IdrisDoc version "
toHtml version
where extract (Just ns) = (False, nsName2Str ns)
extract _ = (True, "")
-- | Non-break space character
| 1,109 |
wrapper :: Maybe NsName -- ^ Namespace name, unless it is the index
-> H.Html -- ^ Inner HTML
-> H.Html
wrapper ns inner =
let (index, str) = extract ns
base = if index then "" else "../"
styles = base ++ "styles.css" :: String
indexPage = base ++ "index.html" :: String
in H.docTypeHtml $ do
H.head $ do
H.title $ do
"IdrisDoc"
if index then " Index" else do
": "
toHtml str
H.link ! type_ "text/css" ! rel "stylesheet"
! href (toValue styles)
H.body ! class_ (if index then "index" else "namespace") $ do
H.div ! class_ "wrapper" $ do
H.header $ do
H.strong "IdrisDoc"
if index then Empty else do
": "
toHtml str
H.nav $ H.a ! href (toValue indexPage) $ "Index"
H.div ! class_ "container" $ inner
H.footer $ do
"Produced by IdrisDoc version "
toHtml version
where extract (Just ns) = (False, nsName2Str ns)
extract _ = (True, "")
-- | Non-break space character
| 1,109 |
wrapper ns inner =
let (index, str) = extract ns
base = if index then "" else "../"
styles = base ++ "styles.css" :: String
indexPage = base ++ "index.html" :: String
in H.docTypeHtml $ do
H.head $ do
H.title $ do
"IdrisDoc"
if index then " Index" else do
": "
toHtml str
H.link ! type_ "text/css" ! rel "stylesheet"
! href (toValue styles)
H.body ! class_ (if index then "index" else "namespace") $ do
H.div ! class_ "wrapper" $ do
H.header $ do
H.strong "IdrisDoc"
if index then Empty else do
": "
toHtml str
H.nav $ H.a ! href (toValue indexPage) $ "Index"
H.div ! class_ "container" $ inner
H.footer $ do
"Produced by IdrisDoc version "
toHtml version
where extract (Just ns) = (False, nsName2Str ns)
extract _ = (True, "")
-- | Non-break space character
| 981 | false | true | 1 | 23 | 407 | 354 | 170 | 184 | null | null |
iteloo/tsuru-sample
|
src/Streaming/MyIteratee.hs
|
bsd-3-clause
|
-- enumerator for streaming contents of pcap files
enumPcapFile fname it = do
handle <- Pcap.openOffline fname
let
onFinish = return
onGet = do
(hdr, bs) <- Pcap.nextBS handle
return $ if bs == BS.pack "" then Nothing else Just (hdr, bs)
onPrint = putStrLn
-- [todo] handle better
onThrow = putStrLn
enumFromHandlers onFinish onGet onPrint onThrow it
-- [note] no need/way to close handle
-- reorders quotes based on quote accept time, assuming that
-- `pt - qt <= 3` for each quote,
-- where `pt` : packet accept time
-- `qt` : quote accept time
-- we implement this handler using a buffer that assumes quotes
-- `q` satisfying `pt_r - qt_q > 3` can be safely reordered and emitted.
-- Here `r` is the most recently inserted quote.
-- proof that `qt_q` < qt_f` for any quote `q` in the buffer, and
-- all `f`s that we might receive in the future:
-- suppose `f` is a future quote, then since `pt_f > pt_r`, we have
-- `qt_q < pt_r - 3 < pt_f - 3 <= qt_f
-- proof that we cannot do better: let `q` be a quote in the buffer
-- such that `pt_r - qt_q = 3 - e` for `e > 0`. we construct a future `f`
-- such that `qt_q > qt_f`
-- let `f` be a packet with
-- `qt_f = pt_r - 3 + e/2` and `pt_f = pt_r + e/3`
-- then `f` is indeed a valid future packet since:
-- `pt_f > pt_r`
-- `pt_f - qt_f = 3 - e/6 < 3`
-- morever, `qt_q = pt_r - 3 + e > qt_f`
-- reorderQuotes :: Iter (Sum3 (Get (Data Quote)) x y) a
-- -> Iter (Sum3 (Get (Data Quote)) x y) a
| 1,535 |
enumPcapFile fname it = do
handle <- Pcap.openOffline fname
let
onFinish = return
onGet = do
(hdr, bs) <- Pcap.nextBS handle
return $ if bs == BS.pack "" then Nothing else Just (hdr, bs)
onPrint = putStrLn
-- [todo] handle better
onThrow = putStrLn
enumFromHandlers onFinish onGet onPrint onThrow it
-- [note] no need/way to close handle
-- reorders quotes based on quote accept time, assuming that
-- `pt - qt <= 3` for each quote,
-- where `pt` : packet accept time
-- `qt` : quote accept time
-- we implement this handler using a buffer that assumes quotes
-- `q` satisfying `pt_r - qt_q > 3` can be safely reordered and emitted.
-- Here `r` is the most recently inserted quote.
-- proof that `qt_q` < qt_f` for any quote `q` in the buffer, and
-- all `f`s that we might receive in the future:
-- suppose `f` is a future quote, then since `pt_f > pt_r`, we have
-- `qt_q < pt_r - 3 < pt_f - 3 <= qt_f
-- proof that we cannot do better: let `q` be a quote in the buffer
-- such that `pt_r - qt_q = 3 - e` for `e > 0`. we construct a future `f`
-- such that `qt_q > qt_f`
-- let `f` be a packet with
-- `qt_f = pt_r - 3 + e/2` and `pt_f = pt_r + e/3`
-- then `f` is indeed a valid future packet since:
-- `pt_f > pt_r`
-- `pt_f - qt_f = 3 - e/6 < 3`
-- morever, `qt_q = pt_r - 3 + e > qt_f`
-- reorderQuotes :: Iter (Sum3 (Get (Data Quote)) x y) a
-- -> Iter (Sum3 (Get (Data Quote)) x y) a
| 1,484 |
enumPcapFile fname it = do
handle <- Pcap.openOffline fname
let
onFinish = return
onGet = do
(hdr, bs) <- Pcap.nextBS handle
return $ if bs == BS.pack "" then Nothing else Just (hdr, bs)
onPrint = putStrLn
-- [todo] handle better
onThrow = putStrLn
enumFromHandlers onFinish onGet onPrint onThrow it
-- [note] no need/way to close handle
-- reorders quotes based on quote accept time, assuming that
-- `pt - qt <= 3` for each quote,
-- where `pt` : packet accept time
-- `qt` : quote accept time
-- we implement this handler using a buffer that assumes quotes
-- `q` satisfying `pt_r - qt_q > 3` can be safely reordered and emitted.
-- Here `r` is the most recently inserted quote.
-- proof that `qt_q` < qt_f` for any quote `q` in the buffer, and
-- all `f`s that we might receive in the future:
-- suppose `f` is a future quote, then since `pt_f > pt_r`, we have
-- `qt_q < pt_r - 3 < pt_f - 3 <= qt_f
-- proof that we cannot do better: let `q` be a quote in the buffer
-- such that `pt_r - qt_q = 3 - e` for `e > 0`. we construct a future `f`
-- such that `qt_q > qt_f`
-- let `f` be a packet with
-- `qt_f = pt_r - 3 + e/2` and `pt_f = pt_r + e/3`
-- then `f` is indeed a valid future packet since:
-- `pt_f > pt_r`
-- `pt_f - qt_f = 3 - e/6 < 3`
-- morever, `qt_q = pt_r - 3 + e > qt_f`
-- reorderQuotes :: Iter (Sum3 (Get (Data Quote)) x y) a
-- -> Iter (Sum3 (Get (Data Quote)) x y) a
| 1,484 | true | false | 0 | 16 | 390 | 137 | 80 | 57 | null | null |
np/mbox-tools
|
split-mbox.hs
|
bsd-3-clause
|
main :: IO ()
main = do
args <- getArgs
let (flags, nonopts, errs) = getOpt Permute options args
let opts = foldr ($) defaultSettings flags
if opts^.help
then usage ""
else
case (nonopts, errs) of
([], []) -> usage "Too few arguments"
(mboxfiles, []) -> mapM_ (splitMboxWith opts) mboxfiles
(_, _) -> usage (concat errs)
| 372 |
main :: IO ()
main = do
args <- getArgs
let (flags, nonopts, errs) = getOpt Permute options args
let opts = foldr ($) defaultSettings flags
if opts^.help
then usage ""
else
case (nonopts, errs) of
([], []) -> usage "Too few arguments"
(mboxfiles, []) -> mapM_ (splitMboxWith opts) mboxfiles
(_, _) -> usage (concat errs)
| 372 |
main = do
args <- getArgs
let (flags, nonopts, errs) = getOpt Permute options args
let opts = foldr ($) defaultSettings flags
if opts^.help
then usage ""
else
case (nonopts, errs) of
([], []) -> usage "Too few arguments"
(mboxfiles, []) -> mapM_ (splitMboxWith opts) mboxfiles
(_, _) -> usage (concat errs)
| 358 | false | true | 0 | 14 | 107 | 166 | 83 | 83 | null | null |
BlairArchibald/bones
|
apps/tsp/src/Main.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------------
-- Timing Functions
--------------------------------------------------------------------------------
timeIOs :: IO a -> IO (a, Double)
timeIOs action = do
s <- getTime Monotonic
x <- action
e <- getTime Monotonic
return (x, diffTime s e)
| 327 |
timeIOs :: IO a -> IO (a, Double)
timeIOs action = do
s <- getTime Monotonic
x <- action
e <- getTime Monotonic
return (x, diffTime s e)
| 144 |
timeIOs action = do
s <- getTime Monotonic
x <- action
e <- getTime Monotonic
return (x, diffTime s e)
| 110 | true | true | 0 | 9 | 41 | 77 | 37 | 40 | null | null |
karamellpelle/grid
|
source/OpenGL/ES2/Values.hs
|
gpl-3.0
|
gl_GEQUAL :: GLenum
gl_GEQUAL = 0x0206
| 60 |
gl_GEQUAL :: GLenum
gl_GEQUAL = 0x0206
| 60 |
gl_GEQUAL = 0x0206
| 40 | false | true | 0 | 4 | 27 | 11 | 6 | 5 | null | null |
ozataman/tagsoup-parsec
|
Text/HTML/TagSoup/Parsec.hs
|
mit
|
-- | maybeCloseTag will return `Just` the tag if it gets a TagClose with he given name,
-- It will return `Nothing` otherwise.
-- It is not case sensitive.
maybeCloseTag :: (StringLike str, Show str) => str -> TagParserSt str st ( Maybe (Tag str) )
maybeCloseTag =
maybeP . closeTag
| 285 |
maybeCloseTag :: (StringLike str, Show str) => str -> TagParserSt str st ( Maybe (Tag str) )
maybeCloseTag =
maybeP . closeTag
| 129 |
maybeCloseTag =
maybeP . closeTag
| 36 | true | true | 0 | 11 | 53 | 56 | 30 | 26 | null | null |
ghcjs/jsaddle-dom
|
src/JSDOM/Generated/Enums.hs
|
mit
|
js_RTCSignalingStateHaveRemotePranswer = "have-remote-pranswer"
| 63 |
js_RTCSignalingStateHaveRemotePranswer = "have-remote-pranswer"
| 63 |
js_RTCSignalingStateHaveRemotePranswer = "have-remote-pranswer"
| 63 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
dysinger/amazonka
|
amazonka-elasticbeanstalk/gen/Network/AWS/ElasticBeanstalk/TerminateEnvironment.hs
|
mpl-2.0
|
-- | The last modified date for this environment.
terDateUpdated :: Lens' TerminateEnvironmentResponse (Maybe UTCTime)
terDateUpdated = lens _terDateUpdated (\s a -> s { _terDateUpdated = a }) . mapping _Time
| 208 |
terDateUpdated :: Lens' TerminateEnvironmentResponse (Maybe UTCTime)
terDateUpdated = lens _terDateUpdated (\s a -> s { _terDateUpdated = a }) . mapping _Time
| 158 |
terDateUpdated = lens _terDateUpdated (\s a -> s { _terDateUpdated = a }) . mapping _Time
| 89 | true | true | 1 | 10 | 30 | 58 | 28 | 30 | null | null |
danchoi/table
|
Main.hs
|
mit
|
adjustWidths :: Int -> [Int] -> [Int]
adjustWidths maxWidth xs | sum xs <= maxWidth = xs
| otherwise = adjustWidths maxWidth $ reduceWidest xs
| 166 |
adjustWidths :: Int -> [Int] -> [Int]
adjustWidths maxWidth xs | sum xs <= maxWidth = xs
| otherwise = adjustWidths maxWidth $ reduceWidest xs
| 166 |
adjustWidths maxWidth xs | sum xs <= maxWidth = xs
| otherwise = adjustWidths maxWidth $ reduceWidest xs
| 128 | false | true | 0 | 9 | 48 | 62 | 29 | 33 | null | null |
newhoggy/monadic-regions
|
test/MonadicRegionsProperties.hs
|
bsd-3-clause
|
test_sort8 = sort [8, 7, 2, 5, 4, 9, 6, 1, 0, 3] @?= [0..9]
| 59 |
test_sort8 = sort [8, 7, 2, 5, 4, 9, 6, 1, 0, 3] @?= [0..9]
| 59 |
test_sort8 = sort [8, 7, 2, 5, 4, 9, 6, 1, 0, 3] @?= [0..9]
| 59 | false | false | 1 | 7 | 14 | 52 | 29 | 23 | null | null |
brendanhay/gogol
|
gogol-script/gen/Network/Google/Resource/Script/Projects/Versions/List.hs
|
mpl-2.0
|
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
pvlUploadType :: Lens' ProjectsVersionsList (Maybe Text)
pvlUploadType
= lens _pvlUploadType
(\ s a -> s{_pvlUploadType = a})
| 204 |
pvlUploadType :: Lens' ProjectsVersionsList (Maybe Text)
pvlUploadType
= lens _pvlUploadType
(\ s a -> s{_pvlUploadType = a})
| 133 |
pvlUploadType
= lens _pvlUploadType
(\ s a -> s{_pvlUploadType = a})
| 76 | true | true | 0 | 8 | 34 | 49 | 25 | 24 | null | null |
TimLuq/sqrl-auth-client-hs
|
src/Web/Authenticate/SQRL/SecureStorage.hs
|
mit
|
secureStorageType (Block00002 _) = 2
| 38 |
secureStorageType (Block00002 _) = 2
| 38 |
secureStorageType (Block00002 _) = 2
| 38 | false | false | 0 | 6 | 6 | 16 | 7 | 9 | null | null |
gianlucagiorgolo/glue-tp
|
TP.hs
|
mit
|
sub new old (App f a) = App (sub new old f) (sub new old a)
| 59 |
sub new old (App f a) = App (sub new old f) (sub new old a)
| 59 |
sub new old (App f a) = App (sub new old f) (sub new old a)
| 59 | false | false | 0 | 7 | 15 | 46 | 22 | 24 | null | null |
DavidAlphaFox/ghc
|
libraries/pretty/src/Text/PrettyPrint/HughesPJ.hs
|
bsd-3-clause
|
float n = text (show n)
| 26 |
float n = text (show n)
| 26 |
float n = text (show n)
| 26 | false | false | 0 | 7 | 8 | 18 | 8 | 10 | null | null |
christiaanb/clash-compiler
|
clash-lib/src/CLaSH/Normalize.hs
|
bsd-2-clause
|
flattenCallTree (CBranch (nm,(ty,tm)) used) = do
flattenedUsed <- mapM flattenCallTree used
(newUsed,il_ct) <- partitionEithers <$> mapM flattenNode flattenedUsed
let (toInline,il_used) = unzip il_ct
newExpr <- case toInline of
[] -> return tm
_ -> rewriteExpr ("bindConstants",(repeatR (topdownR $ (bindConstantVar >-> caseCon >-> reduceConst))) !-> topLet) (showDoc nm, substTms toInline tm)
return (CBranch (nm,(ty,newExpr)) (newUsed ++ (concat il_used)))
| 501 |
flattenCallTree (CBranch (nm,(ty,tm)) used) = do
flattenedUsed <- mapM flattenCallTree used
(newUsed,il_ct) <- partitionEithers <$> mapM flattenNode flattenedUsed
let (toInline,il_used) = unzip il_ct
newExpr <- case toInline of
[] -> return tm
_ -> rewriteExpr ("bindConstants",(repeatR (topdownR $ (bindConstantVar >-> caseCon >-> reduceConst))) !-> topLet) (showDoc nm, substTms toInline tm)
return (CBranch (nm,(ty,newExpr)) (newUsed ++ (concat il_used)))
| 501 |
flattenCallTree (CBranch (nm,(ty,tm)) used) = do
flattenedUsed <- mapM flattenCallTree used
(newUsed,il_ct) <- partitionEithers <$> mapM flattenNode flattenedUsed
let (toInline,il_used) = unzip il_ct
newExpr <- case toInline of
[] -> return tm
_ -> rewriteExpr ("bindConstants",(repeatR (topdownR $ (bindConstantVar >-> caseCon >-> reduceConst))) !-> topLet) (showDoc nm, substTms toInline tm)
return (CBranch (nm,(ty,newExpr)) (newUsed ++ (concat il_used)))
| 501 | false | false | 0 | 20 | 99 | 202 | 103 | 99 | null | null |
vinnymac/glot-www
|
Model/Language.hs
|
mit
|
languageName Lua = "Lua"
| 24 |
languageName Lua = "Lua"
| 24 |
languageName Lua = "Lua"
| 24 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
forste/haReFork
|
tools/base/lib/Statistics.hs
|
bsd-3-clause
|
histogram n xs = elems $ accumArray (+) 0 (0,n-1) [(x*n `div` (m+1),1)|x<-xs]
where
m = maximum xs
| 104 |
histogram n xs = elems $ accumArray (+) 0 (0,n-1) [(x*n `div` (m+1),1)|x<-xs]
where
m = maximum xs
| 104 |
histogram n xs = elems $ accumArray (+) 0 (0,n-1) [(x*n `div` (m+1),1)|x<-xs]
where
m = maximum xs
| 104 | false | false | 4 | 10 | 23 | 90 | 44 | 46 | null | null |
Frefreak/solitaire-solver
|
src/Solver.hs
|
bsd-3-clause
|
simplify5' bds (bo:bos) ops =
let bds' = zip bds [0..]
sb = S.fromList $ map fst bo
r = map (first (`S.member` sb)) $ drop 6 bds'
rr = filter fst r
in if null rr
then head ops : simplify3' (tail bds) bos (tail ops)
else let idx = snd . head $ rr
pickb = bds !! idx
Just newOp = lookup pickb bo
in newOp ++ drop idx ops
| 420 |
simplify5' bds (bo:bos) ops =
let bds' = zip bds [0..]
sb = S.fromList $ map fst bo
r = map (first (`S.member` sb)) $ drop 6 bds'
rr = filter fst r
in if null rr
then head ops : simplify3' (tail bds) bos (tail ops)
else let idx = snd . head $ rr
pickb = bds !! idx
Just newOp = lookup pickb bo
in newOp ++ drop idx ops
| 420 |
simplify5' bds (bo:bos) ops =
let bds' = zip bds [0..]
sb = S.fromList $ map fst bo
r = map (first (`S.member` sb)) $ drop 6 bds'
rr = filter fst r
in if null rr
then head ops : simplify3' (tail bds) bos (tail ops)
else let idx = snd . head $ rr
pickb = bds !! idx
Just newOp = lookup pickb bo
in newOp ++ drop idx ops
| 420 | false | false | 0 | 13 | 174 | 184 | 91 | 93 | null | null |
snowleopard/shaking-up-ghc
|
src/Settings/Flavours/Quickest.hs
|
bsd-3-clause
|
quickestArgs :: Args
quickestArgs = sourceArgs SourceArgs
{ hsDefault = mconcat $
[ pure ["-O0", "-H64m"]
, naturalInBaseFixArgs
]
, hsLibrary = mempty
, hsCompiler = stage0 ? arg "-O"
, hsGhc = stage0 ? arg "-O" }
| 261 |
quickestArgs :: Args
quickestArgs = sourceArgs SourceArgs
{ hsDefault = mconcat $
[ pure ["-O0", "-H64m"]
, naturalInBaseFixArgs
]
, hsLibrary = mempty
, hsCompiler = stage0 ? arg "-O"
, hsGhc = stage0 ? arg "-O" }
| 261 |
quickestArgs = sourceArgs SourceArgs
{ hsDefault = mconcat $
[ pure ["-O0", "-H64m"]
, naturalInBaseFixArgs
]
, hsLibrary = mempty
, hsCompiler = stage0 ? arg "-O"
, hsGhc = stage0 ? arg "-O" }
| 240 | false | true | 0 | 11 | 84 | 83 | 43 | 40 | null | null |
rodrigogribeiro/mptc
|
src/Iface/IfaceReader.hs
|
bsd-3-clause
|
lexeme = P.lexeme lexer
| 23 |
lexeme = P.lexeme lexer
| 23 |
lexeme = P.lexeme lexer
| 23 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
neilmayhew/DebianAnalytics
|
Analyze.hs
|
gpl-3.0
|
isDownload :: LogLine -> Bool
isDownload = (=='2') . BS.head . llStatus
| 71 |
isDownload :: LogLine -> Bool
isDownload = (=='2') . BS.head . llStatus
| 71 |
isDownload = (=='2') . BS.head . llStatus
| 41 | false | true | 2 | 7 | 11 | 38 | 17 | 21 | null | null |
aslpavel/geekbar
|
lib/GeekBar/Layout.hs
|
bsd-3-clause
|
layout (x', y') (NBranch p cs) =
alignWith $ case p ^. align of
AlignHor -> alignHor
AlignVer -> alignVer
AlignAbs -> alignAbs
where
-- | Align children with align function
alignWith :: (Node -> ST.State (Rect, Edge) Node) -> Node
alignWith a = let (cs', (r, _)) = ST.runState (mapM a cs) (Rect x' y' 0 0, Edge 0 0 0 0)
in NBranch (p & content .~ r) cs'
-- | Horiziontal alignment
-- State is (<all_content_rect>, <margin_edge>)
alignHor :: Node -> ST.State (Rect, Edge) Node
alignHor n = do
(r, m) <- ST.get
let -- x coordinate for contents of current node
x'' = r ^. x
+ r ^. width
+ max (m ^. right) (n ^. props.margin.left)
+ n ^. props.border.left
+ n ^. props.padding.left
-- y cooridnate for contents of current nede
y'' = r ^. y
+ n ^. props.margin.top
+ n ^. props.border.top
+ n ^. props.padding.top
-- layout current node with regards to colclulated coordiantes
n'' = layout (x'', y'') n
-- new width for contnet area
w = x''
- r ^. x
+ n'' ^. props.content.width
+ n'' ^. props.padding.right
+ n'' ^. props.border.right
-- new neight for content area
h = y''
- r ^. y
+ n'' ^. props.content.height
+ n'' ^. props.padding.bottom
+ n'' ^. props.border.bottom
+ n'' ^. props.margin.bottom
ST.put (r & width .~ w & height .~ max h (r ^. height)
,m & right .~ n'' ^. props.margin.right)
return n''
-- | vertical alignment
alignVer :: Node -> ST.State (Rect, Edge) Node
alignVer n = do
(r, m) <- ST.get
let x'' = r ^. x
+ n ^. props.margin.left
+ n ^. props.border.left
+ n ^. props.padding.left
y'' = r ^. y
+ r ^. height
+ max (m ^. bottom) (n ^. props.margin.top)
+ n ^. props.border.top
+ n ^. props.padding.top
n'' = layout (x'', y'') n
w = x''
- r ^. x
+ n'' ^. props.content.width
+ n'' ^. props.padding.right
+ n'' ^. props.border.right
+ n'' ^. props.margin.right
h = y''
- r ^. y
+ n'' ^. props.content.height
+ n'' ^. props.padding.bottom
+ n'' ^. props.border.bottom
ST.put (r & width .~ max w (r ^. width) & height .~ h
,m & bottom .~ n'' ^. props.margin.bottom)
return n''
-- | absolute alignment
alignAbs :: Node -> ST.State (Rect, Edge) Node
alignAbs n = do
(r, m) <- ST.get
let x'' = r ^. x
+ n ^. props.margin.left
+ n ^. props.border.left
+ n ^. props.padding.left
y'' = r ^. y
+ n ^. props.margin.top
+ n ^. props.border.top
+ n ^. props.padding.top
n'' = layout (x'', y'') n
w = x''
- r ^. x
+ n'' ^. props.content.width
+ n'' ^. props.padding.right
+ n'' ^. props.border.right
+ n'' ^. props.margin.right
h = y''
- r ^. y
+ n'' ^. props.content.height
+ n'' ^. props.padding.bottom
+ n'' ^. props.border.bottom
+ n'' ^. props.margin.bottom
ST.put (r & width .~ max w (r ^. width) & height .~ max h (r ^. height), m)
return n''
| 3,874 |
layout (x', y') (NBranch p cs) =
alignWith $ case p ^. align of
AlignHor -> alignHor
AlignVer -> alignVer
AlignAbs -> alignAbs
where
-- | Align children with align function
alignWith :: (Node -> ST.State (Rect, Edge) Node) -> Node
alignWith a = let (cs', (r, _)) = ST.runState (mapM a cs) (Rect x' y' 0 0, Edge 0 0 0 0)
in NBranch (p & content .~ r) cs'
-- | Horiziontal alignment
-- State is (<all_content_rect>, <margin_edge>)
alignHor :: Node -> ST.State (Rect, Edge) Node
alignHor n = do
(r, m) <- ST.get
let -- x coordinate for contents of current node
x'' = r ^. x
+ r ^. width
+ max (m ^. right) (n ^. props.margin.left)
+ n ^. props.border.left
+ n ^. props.padding.left
-- y cooridnate for contents of current nede
y'' = r ^. y
+ n ^. props.margin.top
+ n ^. props.border.top
+ n ^. props.padding.top
-- layout current node with regards to colclulated coordiantes
n'' = layout (x'', y'') n
-- new width for contnet area
w = x''
- r ^. x
+ n'' ^. props.content.width
+ n'' ^. props.padding.right
+ n'' ^. props.border.right
-- new neight for content area
h = y''
- r ^. y
+ n'' ^. props.content.height
+ n'' ^. props.padding.bottom
+ n'' ^. props.border.bottom
+ n'' ^. props.margin.bottom
ST.put (r & width .~ w & height .~ max h (r ^. height)
,m & right .~ n'' ^. props.margin.right)
return n''
-- | vertical alignment
alignVer :: Node -> ST.State (Rect, Edge) Node
alignVer n = do
(r, m) <- ST.get
let x'' = r ^. x
+ n ^. props.margin.left
+ n ^. props.border.left
+ n ^. props.padding.left
y'' = r ^. y
+ r ^. height
+ max (m ^. bottom) (n ^. props.margin.top)
+ n ^. props.border.top
+ n ^. props.padding.top
n'' = layout (x'', y'') n
w = x''
- r ^. x
+ n'' ^. props.content.width
+ n'' ^. props.padding.right
+ n'' ^. props.border.right
+ n'' ^. props.margin.right
h = y''
- r ^. y
+ n'' ^. props.content.height
+ n'' ^. props.padding.bottom
+ n'' ^. props.border.bottom
ST.put (r & width .~ max w (r ^. width) & height .~ h
,m & bottom .~ n'' ^. props.margin.bottom)
return n''
-- | absolute alignment
alignAbs :: Node -> ST.State (Rect, Edge) Node
alignAbs n = do
(r, m) <- ST.get
let x'' = r ^. x
+ n ^. props.margin.left
+ n ^. props.border.left
+ n ^. props.padding.left
y'' = r ^. y
+ n ^. props.margin.top
+ n ^. props.border.top
+ n ^. props.padding.top
n'' = layout (x'', y'') n
w = x''
- r ^. x
+ n'' ^. props.content.width
+ n'' ^. props.padding.right
+ n'' ^. props.border.right
+ n'' ^. props.margin.right
h = y''
- r ^. y
+ n'' ^. props.content.height
+ n'' ^. props.padding.bottom
+ n'' ^. props.border.bottom
+ n'' ^. props.margin.bottom
ST.put (r & width .~ max w (r ^. width) & height .~ max h (r ^. height), m)
return n''
| 3,874 |
layout (x', y') (NBranch p cs) =
alignWith $ case p ^. align of
AlignHor -> alignHor
AlignVer -> alignVer
AlignAbs -> alignAbs
where
-- | Align children with align function
alignWith :: (Node -> ST.State (Rect, Edge) Node) -> Node
alignWith a = let (cs', (r, _)) = ST.runState (mapM a cs) (Rect x' y' 0 0, Edge 0 0 0 0)
in NBranch (p & content .~ r) cs'
-- | Horiziontal alignment
-- State is (<all_content_rect>, <margin_edge>)
alignHor :: Node -> ST.State (Rect, Edge) Node
alignHor n = do
(r, m) <- ST.get
let -- x coordinate for contents of current node
x'' = r ^. x
+ r ^. width
+ max (m ^. right) (n ^. props.margin.left)
+ n ^. props.border.left
+ n ^. props.padding.left
-- y cooridnate for contents of current nede
y'' = r ^. y
+ n ^. props.margin.top
+ n ^. props.border.top
+ n ^. props.padding.top
-- layout current node with regards to colclulated coordiantes
n'' = layout (x'', y'') n
-- new width for contnet area
w = x''
- r ^. x
+ n'' ^. props.content.width
+ n'' ^. props.padding.right
+ n'' ^. props.border.right
-- new neight for content area
h = y''
- r ^. y
+ n'' ^. props.content.height
+ n'' ^. props.padding.bottom
+ n'' ^. props.border.bottom
+ n'' ^. props.margin.bottom
ST.put (r & width .~ w & height .~ max h (r ^. height)
,m & right .~ n'' ^. props.margin.right)
return n''
-- | vertical alignment
alignVer :: Node -> ST.State (Rect, Edge) Node
alignVer n = do
(r, m) <- ST.get
let x'' = r ^. x
+ n ^. props.margin.left
+ n ^. props.border.left
+ n ^. props.padding.left
y'' = r ^. y
+ r ^. height
+ max (m ^. bottom) (n ^. props.margin.top)
+ n ^. props.border.top
+ n ^. props.padding.top
n'' = layout (x'', y'') n
w = x''
- r ^. x
+ n'' ^. props.content.width
+ n'' ^. props.padding.right
+ n'' ^. props.border.right
+ n'' ^. props.margin.right
h = y''
- r ^. y
+ n'' ^. props.content.height
+ n'' ^. props.padding.bottom
+ n'' ^. props.border.bottom
ST.put (r & width .~ max w (r ^. width) & height .~ h
,m & bottom .~ n'' ^. props.margin.bottom)
return n''
-- | absolute alignment
alignAbs :: Node -> ST.State (Rect, Edge) Node
alignAbs n = do
(r, m) <- ST.get
let x'' = r ^. x
+ n ^. props.margin.left
+ n ^. props.border.left
+ n ^. props.padding.left
y'' = r ^. y
+ n ^. props.margin.top
+ n ^. props.border.top
+ n ^. props.padding.top
n'' = layout (x'', y'') n
w = x''
- r ^. x
+ n'' ^. props.content.width
+ n'' ^. props.padding.right
+ n'' ^. props.border.right
+ n'' ^. props.margin.right
h = y''
- r ^. y
+ n'' ^. props.content.height
+ n'' ^. props.padding.bottom
+ n'' ^. props.border.bottom
+ n'' ^. props.margin.bottom
ST.put (r & width .~ max w (r ^. width) & height .~ max h (r ^. height), m)
return n''
| 3,874 | false | false | 0 | 21 | 1,728 | 1,224 | 628 | 596 | null | null |
ganeti/ganeti
|
test/hs/Test/Ganeti/HTools/Graph.hs
|
bsd-2-clause
|
-- | Generate node bounds and edges for an undirected graph.
-- A graph is undirected if for every (a, b) edge there is a
-- corresponding (b, a) one.
undirEdges :: Gen (Graph.Bounds, [Graph.Edge])
undirEdges = sized undirEdges'
where
undirEdges' 0 = return ((0, 0), [])
undirEdges' n = do
maxv <- choose (1, n)
edges <- listOf1 $ do
i <- choose (0, maxv)
j <- choose (0, maxv) `suchThat` (/= i)
return [(i, j), (j, i)]
return ((0, maxv), concat edges)
-- | Generate node bounds and edges for a clique.
-- In a clique all nodes are directly connected to each other.
| 618 |
undirEdges :: Gen (Graph.Bounds, [Graph.Edge])
undirEdges = sized undirEdges'
where
undirEdges' 0 = return ((0, 0), [])
undirEdges' n = do
maxv <- choose (1, n)
edges <- listOf1 $ do
i <- choose (0, maxv)
j <- choose (0, maxv) `suchThat` (/= i)
return [(i, j), (j, i)]
return ((0, maxv), concat edges)
-- | Generate node bounds and edges for a clique.
-- In a clique all nodes are directly connected to each other.
| 467 |
undirEdges = sized undirEdges'
where
undirEdges' 0 = return ((0, 0), [])
undirEdges' n = do
maxv <- choose (1, n)
edges <- listOf1 $ do
i <- choose (0, maxv)
j <- choose (0, maxv) `suchThat` (/= i)
return [(i, j), (j, i)]
return ((0, maxv), concat edges)
-- | Generate node bounds and edges for a clique.
-- In a clique all nodes are directly connected to each other.
| 420 | true | true | 1 | 15 | 158 | 192 | 102 | 90 | null | null |
gridaphobe/ghc
|
utils/mkUserGuidePart/Main.hs
|
bsd-3-clause
|
-- | Generate a listing of all the flags known to GHC.
-- Used in the man page.
flagsList :: [Group] -> ReST
flagsList grps = unlines $
map doGroup grps ++ map flagDescriptions grps
where
doGroup grp = unlines
[ grpTitle grp
, " " ++ unwords (map (inlineCode . flagName) (grpFlags grp))
, ""
]
-- | Generate a definition list of the known flags.
-- Used in the man page.
| 408 |
flagsList :: [Group] -> ReST
flagsList grps = unlines $
map doGroup grps ++ map flagDescriptions grps
where
doGroup grp = unlines
[ grpTitle grp
, " " ++ unwords (map (inlineCode . flagName) (grpFlags grp))
, ""
]
-- | Generate a definition list of the known flags.
-- Used in the man page.
| 328 |
flagsList grps = unlines $
map doGroup grps ++ map flagDescriptions grps
where
doGroup grp = unlines
[ grpTitle grp
, " " ++ unwords (map (inlineCode . flagName) (grpFlags grp))
, ""
]
-- | Generate a definition list of the known flags.
-- Used in the man page.
| 299 | true | true | 0 | 12 | 110 | 97 | 50 | 47 | null | null |
karamellpelle/grid
|
source/OpenGL/ES2/Values.hs
|
gpl-3.0
|
gl_COMPILE_STATUS :: GLenum
gl_COMPILE_STATUS = 0x8B81
| 68 |
gl_COMPILE_STATUS :: GLenum
gl_COMPILE_STATUS = 0x8B81
| 68 |
gl_COMPILE_STATUS = 0x8B81
| 40 | false | true | 0 | 4 | 19 | 11 | 6 | 5 | null | null |
aisamanra/matterhorn
|
src/Login.hs
|
bsd-3-clause
|
app :: App State () Name
app = App
{ appDraw = credsDraw
, appChooseCursor = showFirstCursor
, appHandleEvent = onEvent
, appStartEvent = return
, appAttrMap = const colorTheme
}
| 206 |
app :: App State () Name
app = App
{ appDraw = credsDraw
, appChooseCursor = showFirstCursor
, appHandleEvent = onEvent
, appStartEvent = return
, appAttrMap = const colorTheme
}
| 206 |
app = App
{ appDraw = credsDraw
, appChooseCursor = showFirstCursor
, appHandleEvent = onEvent
, appStartEvent = return
, appAttrMap = const colorTheme
}
| 181 | false | true | 1 | 8 | 58 | 62 | 33 | 29 | null | null |
damoxc/ganeti
|
src/Ganeti/Query/Node.hs
|
gpl-2.0
|
nodeLiveFieldExtract "mtotal" res =
jsonHead (rpcResNodeInfoHvInfo res) hvInfoMemoryTotal
| 91 |
nodeLiveFieldExtract "mtotal" res =
jsonHead (rpcResNodeInfoHvInfo res) hvInfoMemoryTotal
| 91 |
nodeLiveFieldExtract "mtotal" res =
jsonHead (rpcResNodeInfoHvInfo res) hvInfoMemoryTotal
| 91 | false | false | 0 | 7 | 9 | 22 | 10 | 12 | null | null |
kim/amazonka
|
amazonka-opsworks/gen/Network/AWS/OpsWorks/DeregisterElasticIp.hs
|
mpl-2.0
|
-- | 'DeregisterElasticIp' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'dei1ElasticIp' @::@ 'Text'
--
deregisterElasticIp :: Text -- ^ 'dei1ElasticIp'
-> DeregisterElasticIp
deregisterElasticIp p1 = DeregisterElasticIp
{ _dei1ElasticIp = p1
}
| 309 |
deregisterElasticIp :: Text -- ^ 'dei1ElasticIp'
-> DeregisterElasticIp
deregisterElasticIp p1 = DeregisterElasticIp
{ _dei1ElasticIp = p1
}
| 168 |
deregisterElasticIp p1 = DeregisterElasticIp
{ _dei1ElasticIp = p1
}
| 76 | true | true | 0 | 7 | 64 | 37 | 22 | 15 | null | null |
np/hlatex
|
Language/LaTeX/Builder/Math.hs
|
bsd-3-clause
|
vartriangleright :: MathItem
vartriangleright = mathCmd "vartriangleright"
| 74 |
vartriangleright :: MathItem
vartriangleright = mathCmd "vartriangleright"
| 74 |
vartriangleright = mathCmd "vartriangleright"
| 45 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
ggreif/clash-compiler
|
clash-systemverilog/src/CLaSH/Backend/SystemVerilog.hs
|
bsd-2-clause
|
punctuate' :: Monad m => m Doc -> m [Doc] -> m Doc
punctuate' s d = vcat (punctuate s d) <> s
| 93 |
punctuate' :: Monad m => m Doc -> m [Doc] -> m Doc
punctuate' s d = vcat (punctuate s d) <> s
| 93 |
punctuate' s d = vcat (punctuate s d) <> s
| 42 | false | true | 0 | 9 | 22 | 58 | 27 | 31 | null | null |
anggabc/ASD
|
Isi/a.hs
|
mit
|
--pembatas
all' _ [] = True
| 28 |
all' _ [] = True
| 16 |
all' _ [] = True
| 16 | true | false | 0 | 6 | 6 | 14 | 7 | 7 | null | null |
scturtle/fun.hs
|
avl.hs
|
unlicense
|
rol :: AVL a -> AVL a
rol (Branch x lt (Branch y rlt rrt _ _) _ s) =
Branch y (Branch x lt rlt (1 + max (height lt) (height rlt))
(1 + size lt + size rlt))
rrt
(1 + max (1 + max (height lt) (height rlt)) (height rrt)) s
| 295 |
rol :: AVL a -> AVL a
rol (Branch x lt (Branch y rlt rrt _ _) _ s) =
Branch y (Branch x lt rlt (1 + max (height lt) (height rlt))
(1 + size lt + size rlt))
rrt
(1 + max (1 + max (height lt) (height rlt)) (height rrt)) s
| 295 |
rol (Branch x lt (Branch y rlt rrt _ _) _ s) =
Branch y (Branch x lt rlt (1 + max (height lt) (height rlt))
(1 + size lt + size rlt))
rrt
(1 + max (1 + max (height lt) (height rlt)) (height rrt)) s
| 273 | false | true | 0 | 13 | 129 | 168 | 79 | 89 | null | null |
guoy34/ampersand
|
src/Database/Design/Ampersand/Input/ADL1/Parser.hs
|
gpl-3.0
|
-- Help function for pTerm and pTrm4, to allow right association
rightAssociate :: (Origin -> t -> t -> t) -> String -> AmpParser t -> AmpParser (Origin, t)
rightAssociate combinator operator term
= g <$> currPos <* pOperator operator <*> term <*> pMaybe (rightAssociate combinator operator term)
where g orig y Nothing = (orig, y)
g orig y (Just (org,z)) = (orig, combinator org y z)
--- RelationRef ::= NamedRel | 'I' ('[' ConceptOneRef ']')? | 'V' Signature? | Singleton ('[' ConceptOneRef ']')?
| 575 |
rightAssociate :: (Origin -> t -> t -> t) -> String -> AmpParser t -> AmpParser (Origin, t)
rightAssociate combinator operator term
= g <$> currPos <* pOperator operator <*> term <*> pMaybe (rightAssociate combinator operator term)
where g orig y Nothing = (orig, y)
g orig y (Just (org,z)) = (orig, combinator org y z)
--- RelationRef ::= NamedRel | 'I' ('[' ConceptOneRef ']')? | 'V' Signature? | Singleton ('[' ConceptOneRef ']')?
| 510 |
rightAssociate combinator operator term
= g <$> currPos <* pOperator operator <*> term <*> pMaybe (rightAssociate combinator operator term)
where g orig y Nothing = (orig, y)
g orig y (Just (org,z)) = (orig, combinator org y z)
--- RelationRef ::= NamedRel | 'I' ('[' ConceptOneRef ']')? | 'V' Signature? | Singleton ('[' ConceptOneRef ']')?
| 418 | true | true | 0 | 10 | 160 | 148 | 77 | 71 | null | null |
expipiplus1/vulkan
|
utils/src/Vulkan/Utils/QueueAssignment.hs
|
bsd-3-clause
|
-- | Does this queue have 'QUEUE_TRANSFER_BIT' set and not 'QUEUE_COMPUTE_BIT'
-- or 'QUEUE_GRAPHICS_BIT'
isTransferOnlyQueueFamily :: QueueFamilyProperties -> Bool
isTransferOnlyQueueFamily q =
( queueFlags q
.&. (QUEUE_TRANSFER_BIT .|. QUEUE_GRAPHICS_BIT .|. QUEUE_COMPUTE_BIT)
)
== QUEUE_TRANSFER_BIT
| 319 |
isTransferOnlyQueueFamily :: QueueFamilyProperties -> Bool
isTransferOnlyQueueFamily q =
( queueFlags q
.&. (QUEUE_TRANSFER_BIT .|. QUEUE_GRAPHICS_BIT .|. QUEUE_COMPUTE_BIT)
)
== QUEUE_TRANSFER_BIT
| 213 |
isTransferOnlyQueueFamily q =
( queueFlags q
.&. (QUEUE_TRANSFER_BIT .|. QUEUE_GRAPHICS_BIT .|. QUEUE_COMPUTE_BIT)
)
== QUEUE_TRANSFER_BIT
| 154 | true | true | 1 | 9 | 49 | 47 | 25 | 22 | null | null |
k32/visualsgsn
|
src/Text/LogMerger/Logs/MMI.hs
|
unlicense
|
myDissector ∷ LogDissector
myDissector = evalStateT $ tillEnd entry
| 67 |
myDissector ∷ LogDissector
myDissector = evalStateT $ tillEnd entry
| 67 |
myDissector = evalStateT $ tillEnd entry
| 40 | false | true | 0 | 6 | 8 | 18 | 9 | 9 | null | null |
parapluu/encore
|
src/ir/AST/PrettyPrinter.hs
|
bsd-3-clause
|
ppBinop Identifiers.PLUS_EQUALS = "+="
| 39 |
ppBinop Identifiers.PLUS_EQUALS = "+="
| 39 |
ppBinop Identifiers.PLUS_EQUALS = "+="
| 39 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
tonicebrian/sgf
|
Data/SGF/Parse/Util.hs
|
bsd-3-clause
|
-- }}}
-- }}}
-- handy Translators {{{
-- helper functions {{{
duplicatesOn :: Ord b => (a -> b) -> [a] -> [a]
duplicatesOn f = map fst
. concatMap (drop 1)
. groupBy ((==) `on` snd)
. sortBy (comparing snd)
. map (id &&& f)
| 284 |
duplicatesOn :: Ord b => (a -> b) -> [a] -> [a]
duplicatesOn f = map fst
. concatMap (drop 1)
. groupBy ((==) `on` snd)
. sortBy (comparing snd)
. map (id &&& f)
| 221 |
duplicatesOn f = map fst
. concatMap (drop 1)
. groupBy ((==) `on` snd)
. sortBy (comparing snd)
. map (id &&& f)
| 173 | true | true | 0 | 11 | 106 | 107 | 57 | 50 | null | null |
pparkkin/eta
|
compiler/ETA/BasicTypes/NameSet.hs
|
bsd-3-clause
|
mkNameSet = mkUniqSet
| 29 |
mkNameSet = mkUniqSet
| 29 |
mkNameSet = mkUniqSet
| 29 | false | false | 1 | 5 | 10 | 10 | 3 | 7 | null | null |
tidalcycles/Tidal
|
src/Sound/Tidal/ParseBP.hs
|
gpl-3.0
|
pRatioSingleChar :: Fractional a => Char -> a -> MyParser a
pRatioSingleChar c v = try $ do
char c
notFollowedBy (letter)
return v
| 136 |
pRatioSingleChar :: Fractional a => Char -> a -> MyParser a
pRatioSingleChar c v = try $ do
char c
notFollowedBy (letter)
return v
| 136 |
pRatioSingleChar c v = try $ do
char c
notFollowedBy (letter)
return v
| 76 | false | true | 0 | 10 | 29 | 64 | 27 | 37 | null | null |
istehem/ACO-for-vasttrafik
|
ACO.hs
|
bsd-3-clause
|
shuffleNode' gen m xs p t@(ims,vs)
| nodSel `notElem` p && nodSel `notElem` ims && nodSel `notElem` vs
= (Just nodSel,ims,gen')
| otherwise = shuffleNode' gen' m (L.delete nodSel xs) p t
where (nodSel,gen') = selNode gen (genPN m xs)
| 289 |
shuffleNode' gen m xs p t@(ims,vs)
| nodSel `notElem` p && nodSel `notElem` ims && nodSel `notElem` vs
= (Just nodSel,ims,gen')
| otherwise = shuffleNode' gen' m (L.delete nodSel xs) p t
where (nodSel,gen') = selNode gen (genPN m xs)
| 289 |
shuffleNode' gen m xs p t@(ims,vs)
| nodSel `notElem` p && nodSel `notElem` ims && nodSel `notElem` vs
= (Just nodSel,ims,gen')
| otherwise = shuffleNode' gen' m (L.delete nodSel xs) p t
where (nodSel,gen') = selNode gen (genPN m xs)
| 289 | false | false | 0 | 12 | 95 | 128 | 67 | 61 | null | null |
aaronc/Idris-dev
|
src/Idris/Core/TT.hs
|
bsd-3-clause
|
fmapMB f (GHole i ns t) = liftM (GHole i ns) (f t)
| 50 |
fmapMB f (GHole i ns t) = liftM (GHole i ns) (f t)
| 50 |
fmapMB f (GHole i ns t) = liftM (GHole i ns) (f t)
| 50 | false | false | 0 | 6 | 12 | 43 | 19 | 24 | null | null |
fmapfmapfmap/amazonka
|
amazonka-ec2/gen/Network/AWS/EC2/DescribeNetworkInterfaceAttribute.hs
|
mpl-2.0
|
-- | The description of the network interface.
dniarsDescription :: Lens' DescribeNetworkInterfaceAttributeResponse (Maybe AttributeValue)
dniarsDescription = lens _dniarsDescription (\ s a -> s{_dniarsDescription = a})
| 219 |
dniarsDescription :: Lens' DescribeNetworkInterfaceAttributeResponse (Maybe AttributeValue)
dniarsDescription = lens _dniarsDescription (\ s a -> s{_dniarsDescription = a})
| 172 |
dniarsDescription = lens _dniarsDescription (\ s a -> s{_dniarsDescription = a})
| 80 | true | true | 0 | 9 | 24 | 46 | 25 | 21 | null | null |
llelf/flamingra
|
Main.hs
|
bsd-3-clause
|
die :: String -> IO ()
die str = hPutStrLn stderr str >> exitWith (ExitFailure 1)
| 81 |
die :: String -> IO ()
die str = hPutStrLn stderr str >> exitWith (ExitFailure 1)
| 81 |
die str = hPutStrLn stderr str >> exitWith (ExitFailure 1)
| 58 | false | true | 0 | 8 | 15 | 46 | 20 | 26 | null | null |
apyrgio/snf-ganeti
|
src/Ganeti/Query/Language.hs
|
bsd-2-clause
|
readFilterField _ v = Error $ "Cannot deserialise field, expected" ++
" [fieldname] but got " ++
show (pp_value (showJSON v))
| 185 |
readFilterField _ v = Error $ "Cannot deserialise field, expected" ++
" [fieldname] but got " ++
show (pp_value (showJSON v))
| 185 |
readFilterField _ v = Error $ "Cannot deserialise field, expected" ++
" [fieldname] but got " ++
show (pp_value (showJSON v))
| 185 | false | false | 1 | 10 | 80 | 38 | 18 | 20 | null | null |
facebookincubator/duckling
|
Duckling/Time/GA/Rules.hs
|
bsd-3-clause
|
ruleOrdinalCycleINdiaidhTime :: Rule
ruleOrdinalCycleINdiaidhTime = Rule
{ name = "<ordinal> <cycle> i ndiaidh <time>"
, pattern =
[ dimension Ordinal
, dimension TimeGrain
, regex "(i ndiaidh|tar (é|e)is)"
, dimension Time
]
, prod = \tokens -> case tokens of
(Token Ordinal od:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter True grain (TOrdinal.value od - 1) td
_ -> Nothing
}
| 442 |
ruleOrdinalCycleINdiaidhTime :: Rule
ruleOrdinalCycleINdiaidhTime = Rule
{ name = "<ordinal> <cycle> i ndiaidh <time>"
, pattern =
[ dimension Ordinal
, dimension TimeGrain
, regex "(i ndiaidh|tar (é|e)is)"
, dimension Time
]
, prod = \tokens -> case tokens of
(Token Ordinal od:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter True grain (TOrdinal.value od - 1) td
_ -> Nothing
}
| 442 |
ruleOrdinalCycleINdiaidhTime = Rule
{ name = "<ordinal> <cycle> i ndiaidh <time>"
, pattern =
[ dimension Ordinal
, dimension TimeGrain
, regex "(i ndiaidh|tar (é|e)is)"
, dimension Time
]
, prod = \tokens -> case tokens of
(Token Ordinal od:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter True grain (TOrdinal.value od - 1) td
_ -> Nothing
}
| 405 | false | true | 0 | 17 | 109 | 139 | 71 | 68 | null | null |
brendanhay/gogol
|
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/AdvertiserLandingPages/List.hs
|
mpl-2.0
|
-- | OAuth access token.
alplAccessToken :: Lens' AdvertiserLandingPagesList (Maybe Text)
alplAccessToken
= lens _alplAccessToken
(\ s a -> s{_alplAccessToken = a})
| 172 |
alplAccessToken :: Lens' AdvertiserLandingPagesList (Maybe Text)
alplAccessToken
= lens _alplAccessToken
(\ s a -> s{_alplAccessToken = a})
| 147 |
alplAccessToken
= lens _alplAccessToken
(\ s a -> s{_alplAccessToken = a})
| 82 | true | true | 1 | 9 | 29 | 52 | 25 | 27 | null | null |
naushadh/persistent
|
persistent/Database/Persist/Sql/Util.hs
|
mit
|
hasCompositeKey :: EntityDef -> Bool
hasCompositeKey = isJust . entityPrimary
| 77 |
hasCompositeKey :: EntityDef -> Bool
hasCompositeKey = isJust . entityPrimary
| 77 |
hasCompositeKey = isJust . entityPrimary
| 40 | false | true | 0 | 5 | 9 | 19 | 10 | 9 | null | null |
music-suite/music-score
|
src/Music/Score/Meta/Time.hs
|
bsd-3-clause
|
isSimpleTime _ = False
| 44 |
isSimpleTime _ = False
| 44 |
isSimpleTime _ = False
| 44 | false | false | 0 | 5 | 25 | 9 | 4 | 5 | null | null |
rueshyna/gogol
|
gogol-oauth2/gen/Network/Google/OAuth2/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'TokenInfo' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tiAudience'
--
-- * 'tiEmail'
--
-- * 'tiExpiresIn'
--
-- * 'tiAccessType'
--
-- * 'tiScope'
--
-- * 'tiVerifiedEmail'
--
-- * 'tiUserId'
--
-- * 'tiTokenHandle'
--
-- * 'tiIssuedTo'
tokenInfo
:: TokenInfo
tokenInfo =
TokenInfo'
{ _tiAudience = Nothing
, _tiEmail = Nothing
, _tiExpiresIn = Nothing
, _tiAccessType = Nothing
, _tiScope = Nothing
, _tiVerifiedEmail = Nothing
, _tiUserId = Nothing
, _tiTokenHandle = Nothing
, _tiIssuedTo = Nothing
}
| 667 |
tokenInfo
:: TokenInfo
tokenInfo =
TokenInfo'
{ _tiAudience = Nothing
, _tiEmail = Nothing
, _tiExpiresIn = Nothing
, _tiAccessType = Nothing
, _tiScope = Nothing
, _tiVerifiedEmail = Nothing
, _tiUserId = Nothing
, _tiTokenHandle = Nothing
, _tiIssuedTo = Nothing
}
| 314 |
tokenInfo =
TokenInfo'
{ _tiAudience = Nothing
, _tiEmail = Nothing
, _tiExpiresIn = Nothing
, _tiAccessType = Nothing
, _tiScope = Nothing
, _tiVerifiedEmail = Nothing
, _tiUserId = Nothing
, _tiTokenHandle = Nothing
, _tiIssuedTo = Nothing
}
| 287 | true | true | 1 | 7 | 156 | 95 | 65 | 30 | null | null |
cabbibo/loom-haskell
|
src/Game/Pal/Movement.hs
|
bsd-3-clause
|
applyHydraJoystickMovement _ _ = return ()
| 42 |
applyHydraJoystickMovement _ _ = return ()
| 42 |
applyHydraJoystickMovement _ _ = return ()
| 42 | false | false | 0 | 6 | 5 | 16 | 7 | 9 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.