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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DavidAlphaFox/ghc
|
libraries/Cabal/Cabal/Distribution/Simple/Setup.hs
|
bsd-3-clause
|
programFlagsDescription :: ProgramConfiguration -> String
programFlagsDescription progConf =
"The flags --with-PROG and --PROG-option(s) can be used with"
++ " the following programs:"
++ (concatMap (\line -> "\n " ++ unwords line) . wrapLine 77 . sort)
[ programName prog | (prog, _) <- knownPrograms progConf ]
++ "\n"
| 337
|
programFlagsDescription :: ProgramConfiguration -> String
programFlagsDescription progConf =
"The flags --with-PROG and --PROG-option(s) can be used with"
++ " the following programs:"
++ (concatMap (\line -> "\n " ++ unwords line) . wrapLine 77 . sort)
[ programName prog | (prog, _) <- knownPrograms progConf ]
++ "\n"
| 337
|
programFlagsDescription progConf =
"The flags --with-PROG and --PROG-option(s) can be used with"
++ " the following programs:"
++ (concatMap (\line -> "\n " ++ unwords line) . wrapLine 77 . sort)
[ programName prog | (prog, _) <- knownPrograms progConf ]
++ "\n"
| 279
| false
| true
| 6
| 12
| 64
| 92
| 44
| 48
| null | null |
tpsinnem/Idris-dev
|
src/Idris/Core/Elaborate.hs
|
bsd-3-clause
|
prepare_apply :: Raw -- ^ The operation being applied
-> [Bool] -- ^ Whether arguments are implicit
-> Elab' aux [(Name, Name)] -- ^ The names of the arguments and their holes to be filled with elaborated argument values
prepare_apply fn imps =
do ty <- get_type fn
ctxt <- get_context
env <- get_env
-- let claims = getArgs ty imps
-- claims <- mkClaims (normalise ctxt env ty) imps []
claims <- -- trace (show (fn, imps, ty, map fst env, normalise ctxt env (finalise ty))) $
mkClaims (finalise ty)
(normalise ctxt env (finalise ty))
imps [] (map fst env)
ES (p, a) s prev <- get
-- reverse the claims we made so that args go left to right
let n = length (filter not imps)
let (h : hs) = holes p
put (ES (p { holes = h : (reverse (take n hs) ++ drop n hs) }, a) s prev)
return $! claims
where
mkClaims :: Type -- ^ The type of the operation being applied
-> Type -- ^ Normalised version if we need it
-> [Bool] -- ^ Whether the arguments are implicit
-> [(Name, Name)] -- ^ Accumulator for produced claims
-> [Name] -- ^ Hypotheses
-> Elab' aux [(Name, Name)] -- ^ The names of the arguments and their holes, resp.
mkClaims (Bind n' (Pi _ t_in _) sc) (Bind _ _ scn) (i : is) claims hs =
do let t = rebind hs t_in
n <- getNameFrom (mkMN n')
-- when (null claims) (start_unify n)
let sc' = instantiate (P Bound n t) sc
env <- get_env
claim n (forgetEnv (map fst env) t)
when i (movelast n)
mkClaims sc' scn is ((n', n) : claims) hs
-- if we run out of arguments, we need the normalised version...
mkClaims t tn@(Bind _ _ sc) (i : is) cs hs = mkClaims tn tn (i : is) cs hs
mkClaims t _ [] claims _ = return $! (reverse claims)
mkClaims _ _ _ _ _
| Var n <- fn
= do ctxt <- get_context
case lookupTy n ctxt of
[] -> lift $ tfail $ NoSuchVariable n
_ -> lift $ tfail $ TooManyArguments n
| otherwise = fail $ "Too many arguments for " ++ show fn
doClaim ((i, _), n, t) = do claim n t
when i (movelast n)
mkMN n@(MN i _) = n
mkMN n@(UN x) = MN 99999 x
mkMN n@(SN s) = sMN 99999 (show s)
mkMN (NS n xs) = NS (mkMN n) xs
rebind hs (Bind n t sc)
| n `elem` hs = let n' = uniqueName n hs in
Bind n' (fmap (rebind hs) t) (rebind (n':hs) sc)
| otherwise = Bind n (fmap (rebind hs) t) (rebind (n:hs) sc)
rebind hs (App s f a) = App s (rebind hs f) (rebind hs a)
rebind hs t = t
-- | Apply an operator, solving some arguments by unification or matching.
| 2,944
|
prepare_apply :: Raw -- ^ The operation being applied
-> [Bool] -- ^ Whether arguments are implicit
-> Elab' aux [(Name, Name)]
prepare_apply fn imps =
do ty <- get_type fn
ctxt <- get_context
env <- get_env
-- let claims = getArgs ty imps
-- claims <- mkClaims (normalise ctxt env ty) imps []
claims <- -- trace (show (fn, imps, ty, map fst env, normalise ctxt env (finalise ty))) $
mkClaims (finalise ty)
(normalise ctxt env (finalise ty))
imps [] (map fst env)
ES (p, a) s prev <- get
-- reverse the claims we made so that args go left to right
let n = length (filter not imps)
let (h : hs) = holes p
put (ES (p { holes = h : (reverse (take n hs) ++ drop n hs) }, a) s prev)
return $! claims
where
mkClaims :: Type -- ^ The type of the operation being applied
-> Type -- ^ Normalised version if we need it
-> [Bool] -- ^ Whether the arguments are implicit
-> [(Name, Name)] -- ^ Accumulator for produced claims
-> [Name] -- ^ Hypotheses
-> Elab' aux [(Name, Name)] -- ^ The names of the arguments and their holes, resp.
mkClaims (Bind n' (Pi _ t_in _) sc) (Bind _ _ scn) (i : is) claims hs =
do let t = rebind hs t_in
n <- getNameFrom (mkMN n')
-- when (null claims) (start_unify n)
let sc' = instantiate (P Bound n t) sc
env <- get_env
claim n (forgetEnv (map fst env) t)
when i (movelast n)
mkClaims sc' scn is ((n', n) : claims) hs
-- if we run out of arguments, we need the normalised version...
mkClaims t tn@(Bind _ _ sc) (i : is) cs hs = mkClaims tn tn (i : is) cs hs
mkClaims t _ [] claims _ = return $! (reverse claims)
mkClaims _ _ _ _ _
| Var n <- fn
= do ctxt <- get_context
case lookupTy n ctxt of
[] -> lift $ tfail $ NoSuchVariable n
_ -> lift $ tfail $ TooManyArguments n
| otherwise = fail $ "Too many arguments for " ++ show fn
doClaim ((i, _), n, t) = do claim n t
when i (movelast n)
mkMN n@(MN i _) = n
mkMN n@(UN x) = MN 99999 x
mkMN n@(SN s) = sMN 99999 (show s)
mkMN (NS n xs) = NS (mkMN n) xs
rebind hs (Bind n t sc)
| n `elem` hs = let n' = uniqueName n hs in
Bind n' (fmap (rebind hs) t) (rebind (n':hs) sc)
| otherwise = Bind n (fmap (rebind hs) t) (rebind (n:hs) sc)
rebind hs (App s f a) = App s (rebind hs f) (rebind hs a)
rebind hs t = t
-- | Apply an operator, solving some arguments by unification or matching.
| 2,851
|
prepare_apply fn imps =
do ty <- get_type fn
ctxt <- get_context
env <- get_env
-- let claims = getArgs ty imps
-- claims <- mkClaims (normalise ctxt env ty) imps []
claims <- -- trace (show (fn, imps, ty, map fst env, normalise ctxt env (finalise ty))) $
mkClaims (finalise ty)
(normalise ctxt env (finalise ty))
imps [] (map fst env)
ES (p, a) s prev <- get
-- reverse the claims we made so that args go left to right
let n = length (filter not imps)
let (h : hs) = holes p
put (ES (p { holes = h : (reverse (take n hs) ++ drop n hs) }, a) s prev)
return $! claims
where
mkClaims :: Type -- ^ The type of the operation being applied
-> Type -- ^ Normalised version if we need it
-> [Bool] -- ^ Whether the arguments are implicit
-> [(Name, Name)] -- ^ Accumulator for produced claims
-> [Name] -- ^ Hypotheses
-> Elab' aux [(Name, Name)] -- ^ The names of the arguments and their holes, resp.
mkClaims (Bind n' (Pi _ t_in _) sc) (Bind _ _ scn) (i : is) claims hs =
do let t = rebind hs t_in
n <- getNameFrom (mkMN n')
-- when (null claims) (start_unify n)
let sc' = instantiate (P Bound n t) sc
env <- get_env
claim n (forgetEnv (map fst env) t)
when i (movelast n)
mkClaims sc' scn is ((n', n) : claims) hs
-- if we run out of arguments, we need the normalised version...
mkClaims t tn@(Bind _ _ sc) (i : is) cs hs = mkClaims tn tn (i : is) cs hs
mkClaims t _ [] claims _ = return $! (reverse claims)
mkClaims _ _ _ _ _
| Var n <- fn
= do ctxt <- get_context
case lookupTy n ctxt of
[] -> lift $ tfail $ NoSuchVariable n
_ -> lift $ tfail $ TooManyArguments n
| otherwise = fail $ "Too many arguments for " ++ show fn
doClaim ((i, _), n, t) = do claim n t
when i (movelast n)
mkMN n@(MN i _) = n
mkMN n@(UN x) = MN 99999 x
mkMN n@(SN s) = sMN 99999 (show s)
mkMN (NS n xs) = NS (mkMN n) xs
rebind hs (Bind n t sc)
| n `elem` hs = let n' = uniqueName n hs in
Bind n' (fmap (rebind hs) t) (rebind (n':hs) sc)
| otherwise = Bind n (fmap (rebind hs) t) (rebind (n:hs) sc)
rebind hs (App s f a) = App s (rebind hs f) (rebind hs a)
rebind hs t = t
-- | Apply an operator, solving some arguments by unification or matching.
| 2,692
| true
| true
| 7
| 18
| 1,099
| 1,049
| 501
| 548
| null | null |
MedeaMelana/HoleyMonoid
|
Data/HoleyMonoid.hs
|
bsd-3-clause
|
-- | Insert a monoidal value that is not specified until the computation is
-- 'run'. The argument that is expected later is converted to the monoid type
-- using the given conversion function.
later :: (a -> m) -> HoleyMonoid m r (a -> r)
later f = HoleyMonoid (. f)
| 267
|
later :: (a -> m) -> HoleyMonoid m r (a -> r)
later f = HoleyMonoid (. f)
| 73
|
later f = HoleyMonoid (. f)
| 27
| true
| true
| 0
| 9
| 51
| 54
| 28
| 26
| null | null |
snoyberg/ghc
|
compiler/nativeGen/Dwarf/Types.hs
|
bsd-3-clause
|
-- | Assembly for 4 bytes of constant DWARF data
pprData4 :: Word -> SDoc
pprData4 = pprData4' . ppr
| 100
|
pprData4 :: Word -> SDoc
pprData4 = pprData4' . ppr
| 51
|
pprData4 = pprData4' . ppr
| 26
| true
| true
| 1
| 7
| 19
| 28
| 12
| 16
| null | null |
limansky/wbxml
|
src/Wbxml/Tables.hs
|
bsd-3-clause
|
emn10TagTable :: WbxmlTagTable
emn10TagTable = [ (0x00, [ (0x05, "emn") ] ) ]
| 77
|
emn10TagTable :: WbxmlTagTable
emn10TagTable = [ (0x00, [ (0x05, "emn") ] ) ]
| 77
|
emn10TagTable = [ (0x00, [ (0x05, "emn") ] ) ]
| 46
| false
| true
| 0
| 8
| 12
| 29
| 18
| 11
| null | null |
kernelim/gitomail
|
src/Lib/Git.hs
|
apache-2.0
|
iterateHistoryUntil :: forall (m :: * -> *) (t :: * -> *) a.
(Traversable t, MonadIO m, MonadBaseControl IO m, MonadMask m)
=> a
-> (a -> CommitHash -> [CommitHash] -> IO (a, t (CommitHash)))
-> FilePath
-> CommitHash
-> m (Either String ())
iterateHistoryUntil v'' f path firstrev = do
withRepository lgFactory path $ do
let filterF v oidH parentsH act = do
let oid = oidToText oidH
(a, tl) <- lift $ liftIO $ f v oid (map (\(Tagged parent) -> oidToText parent) parentsH)
tl' <- forM tl (liftIO . textToOid)
act (a, tl')
let recurse v (Git.CommitObj commit) = do
let Tagged oid = Git.commitOid commit
filterF v oid (Git.commitParents commit) $ \(v', parents) ->
forM_ parents $ \parent -> do
sub_object <- lift $ lookupObject parent
recurse v' sub_object
recurse _ _ = left $ "Not a commit object while iterating hashes"
runEitherT $ do
oid <- lift $ Git.parseOid firstrev
(lift $ lookupObject oid) >>= (recurse v'')
| 1,284
|
iterateHistoryUntil :: forall (m :: * -> *) (t :: * -> *) a.
(Traversable t, MonadIO m, MonadBaseControl IO m, MonadMask m)
=> a
-> (a -> CommitHash -> [CommitHash] -> IO (a, t (CommitHash)))
-> FilePath
-> CommitHash
-> m (Either String ())
iterateHistoryUntil v'' f path firstrev = do
withRepository lgFactory path $ do
let filterF v oidH parentsH act = do
let oid = oidToText oidH
(a, tl) <- lift $ liftIO $ f v oid (map (\(Tagged parent) -> oidToText parent) parentsH)
tl' <- forM tl (liftIO . textToOid)
act (a, tl')
let recurse v (Git.CommitObj commit) = do
let Tagged oid = Git.commitOid commit
filterF v oid (Git.commitParents commit) $ \(v', parents) ->
forM_ parents $ \parent -> do
sub_object <- lift $ lookupObject parent
recurse v' sub_object
recurse _ _ = left $ "Not a commit object while iterating hashes"
runEitherT $ do
oid <- lift $ Git.parseOid firstrev
(lift $ lookupObject oid) >>= (recurse v'')
| 1,284
|
iterateHistoryUntil v'' f path firstrev = do
withRepository lgFactory path $ do
let filterF v oidH parentsH act = do
let oid = oidToText oidH
(a, tl) <- lift $ liftIO $ f v oid (map (\(Tagged parent) -> oidToText parent) parentsH)
tl' <- forM tl (liftIO . textToOid)
act (a, tl')
let recurse v (Git.CommitObj commit) = do
let Tagged oid = Git.commitOid commit
filterF v oid (Git.commitParents commit) $ \(v', parents) ->
forM_ parents $ \parent -> do
sub_object <- lift $ lookupObject parent
recurse v' sub_object
recurse _ _ = left $ "Not a commit object while iterating hashes"
runEitherT $ do
oid <- lift $ Git.parseOid firstrev
(lift $ lookupObject oid) >>= (recurse v'')
| 904
| false
| true
| 0
| 23
| 529
| 436
| 212
| 224
| null | null |
andorp/bead
|
src/Bead/Persistence/NoSQLDirFile.hs
|
bsd-3-clause
|
loadString :: DirPath -> FilePath -> TIO String
loadString d f = fileLoad d f same
| 82
|
loadString :: DirPath -> FilePath -> TIO String
loadString d f = fileLoad d f same
| 82
|
loadString d f = fileLoad d f same
| 34
| false
| true
| 0
| 7
| 15
| 34
| 16
| 18
| null | null |
agocorona/ghcjs-perch
|
src/Internal/Perch.hs
|
mit
|
link = nelem "link"
| 23
|
link = nelem "link"
| 23
|
link = nelem "link"
| 23
| false
| false
| 1
| 5
| 7
| 13
| 4
| 9
| null | null |
brendanhay/gogol
|
gogol-cloudasset/gen/Network/Google/CloudAsset/Types/Product.hs
|
mpl-2.0
|
-- | Please also refer to the [access policy user
-- guide](https:\/\/cloud.google.com\/access-context-manager\/docs\/overview#access-policies).
gcavaAccessPolicy :: Lens' GoogleCloudAssetV1p7beta1Asset (Maybe GoogleIdentityAccesscontextManagerV1AccessPolicy)
gcavaAccessPolicy
= lens _gcavaAccessPolicy
(\ s a -> s{_gcavaAccessPolicy = a})
| 348
|
gcavaAccessPolicy :: Lens' GoogleCloudAssetV1p7beta1Asset (Maybe GoogleIdentityAccesscontextManagerV1AccessPolicy)
gcavaAccessPolicy
= lens _gcavaAccessPolicy
(\ s a -> s{_gcavaAccessPolicy = a})
| 203
|
gcavaAccessPolicy
= lens _gcavaAccessPolicy
(\ s a -> s{_gcavaAccessPolicy = a})
| 88
| true
| true
| 0
| 8
| 36
| 50
| 26
| 24
| null | null |
passy/hf
|
src/Main.hs
|
apache-2.0
|
displayWrite :: ColorID -> ([Attribute], Bool, ExactWrite) -> Update ()
displayWrite cid (atts, hl, (ExactWrite (r, col) s)) = do
moveCursor (fromIntegral r) (fromIntegral col)
applyColor cid hl $ applyAttributes atts $ drawString s
-- Apply an attribute for a given amount
| 278
|
displayWrite :: ColorID -> ([Attribute], Bool, ExactWrite) -> Update ()
displayWrite cid (atts, hl, (ExactWrite (r, col) s)) = do
moveCursor (fromIntegral r) (fromIntegral col)
applyColor cid hl $ applyAttributes atts $ drawString s
-- Apply an attribute for a given amount
| 278
|
displayWrite cid (atts, hl, (ExactWrite (r, col) s)) = do
moveCursor (fromIntegral r) (fromIntegral col)
applyColor cid hl $ applyAttributes atts $ drawString s
-- Apply an attribute for a given amount
| 206
| false
| true
| 0
| 9
| 46
| 107
| 55
| 52
| null | null |
phischu/fragnix
|
builtins/base/GHC.IO.Handle.hs
|
bsd-3-clause
|
dupHandle_ :: (IODevice dev, BufferedIO dev, Typeable dev) => dev
-> FilePath
-> Maybe (MVar Handle__)
-> Handle__
-> Maybe HandleFinalizer
-> IO Handle
dupHandle_ new_dev filepath other_side h_@Handle__{..} mb_finalizer = do
-- XXX wrong!
mb_codec <- if isJust haEncoder then fmap Just getLocaleEncoding else return Nothing
mkHandle new_dev filepath haType True{-buffered-} mb_codec
NewlineMode { inputNL = haInputNL, outputNL = haOutputNL }
mb_finalizer other_side
-- -----------------------------------------------------------------------------
-- Replacing a Handle
{- |
Makes the second handle a duplicate of the first handle. The second
handle will be closed first, if it is not already.
This can be used to retarget the standard Handles, for example:
> do h <- openFile "mystdout" WriteMode
> hDuplicateTo h stdout
-}
| 906
|
dupHandle_ :: (IODevice dev, BufferedIO dev, Typeable dev) => dev
-> FilePath
-> Maybe (MVar Handle__)
-> Handle__
-> Maybe HandleFinalizer
-> IO Handle
dupHandle_ new_dev filepath other_side h_@Handle__{..} mb_finalizer = do
-- XXX wrong!
mb_codec <- if isJust haEncoder then fmap Just getLocaleEncoding else return Nothing
mkHandle new_dev filepath haType True{-buffered-} mb_codec
NewlineMode { inputNL = haInputNL, outputNL = haOutputNL }
mb_finalizer other_side
-- -----------------------------------------------------------------------------
-- Replacing a Handle
{- |
Makes the second handle a duplicate of the first handle. The second
handle will be closed first, if it is not already.
This can be used to retarget the standard Handles, for example:
> do h <- openFile "mystdout" WriteMode
> hDuplicateTo h stdout
-}
| 906
|
dupHandle_ new_dev filepath other_side h_@Handle__{..} mb_finalizer = do
-- XXX wrong!
mb_codec <- if isJust haEncoder then fmap Just getLocaleEncoding else return Nothing
mkHandle new_dev filepath haType True{-buffered-} mb_codec
NewlineMode { inputNL = haInputNL, outputNL = haOutputNL }
mb_finalizer other_side
-- -----------------------------------------------------------------------------
-- Replacing a Handle
{- |
Makes the second handle a duplicate of the first handle. The second
handle will be closed first, if it is not already.
This can be used to retarget the standard Handles, for example:
> do h <- openFile "mystdout" WriteMode
> hDuplicateTo h stdout
-}
| 698
| false
| true
| 3
| 12
| 198
| 156
| 79
| 77
| null | null |
lynnard/cocos2d-hs
|
src/Graphics/UI/Cocos2d/Label.hs
|
bsd-3-clause
|
label_setHorizontalAlignment :: (LabelPtr arg'1) => arg'1 -> M2.TextHAlignment -> HoppyP.IO ()
label_setHorizontalAlignment arg'1 arg'2 =
HoppyFHR.withCppPtr (toLabel arg'1) $ \arg'1' ->
let arg'2' = HoppyFHR.coerceIntegral $ HoppyP.fromEnum arg'2 in
(label_setHorizontalAlignment' arg'1' arg'2')
| 302
|
label_setHorizontalAlignment :: (LabelPtr arg'1) => arg'1 -> M2.TextHAlignment -> HoppyP.IO ()
label_setHorizontalAlignment arg'1 arg'2 =
HoppyFHR.withCppPtr (toLabel arg'1) $ \arg'1' ->
let arg'2' = HoppyFHR.coerceIntegral $ HoppyP.fromEnum arg'2 in
(label_setHorizontalAlignment' arg'1' arg'2')
| 302
|
label_setHorizontalAlignment arg'1 arg'2 =
HoppyFHR.withCppPtr (toLabel arg'1) $ \arg'1' ->
let arg'2' = HoppyFHR.coerceIntegral $ HoppyP.fromEnum arg'2 in
(label_setHorizontalAlignment' arg'1' arg'2')
| 207
| false
| true
| 0
| 13
| 37
| 92
| 45
| 47
| null | null |
kovach/web2
|
src/Reflection.hs
|
mit
|
flattenE q c n (EVar str) = flattenNV q c n (NVar str)
| 54
|
flattenE q c n (EVar str) = flattenNV q c n (NVar str)
| 54
|
flattenE q c n (EVar str) = flattenNV q c n (NVar str)
| 54
| false
| false
| 0
| 7
| 12
| 36
| 17
| 19
| null | null |
jraygauthier/jrg-gitit
|
src/jrg-gitit.hs
|
gpl-2.0
|
copyrightMessage :: String
copyrightMessage = "\nCopyright (C) 2008 John MacFarlane\n" ++
"This is free software; see the source for copying conditions. There is no\n" ++
"warranty, not even for merchantability or fitness for a particular purpose."
| 287
|
copyrightMessage :: String
copyrightMessage = "\nCopyright (C) 2008 John MacFarlane\n" ++
"This is free software; see the source for copying conditions. There is no\n" ++
"warranty, not even for merchantability or fitness for a particular purpose."
| 287
|
copyrightMessage = "\nCopyright (C) 2008 John MacFarlane\n" ++
"This is free software; see the source for copying conditions. There is no\n" ++
"warranty, not even for merchantability or fitness for a particular purpose."
| 260
| false
| true
| 0
| 6
| 74
| 26
| 11
| 15
| null | null |
nurpax/snaplet-sqlite-simple
|
example/src/Db.hs
|
bsd-3-clause
|
createTables :: S.Connection -> IO ()
createTables conn = do
-- Note: for a bigger app, you probably want to create a 'version'
-- table too and use it to keep track of schema version and
-- implement your schema upgrade procedure here.
schemaCreated <- tableExists conn "comments"
unless schemaCreated $
S.execute_ conn
(S.Query $
T.concat [ "CREATE TABLE comments ("
, "id INTEGER PRIMARY KEY, "
, "user_id INTEGER NOT NULL, "
, "saved_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, "
, "comment TEXT)"])
-- | Retrieve a user's list of comments
| 640
|
createTables :: S.Connection -> IO ()
createTables conn = do
-- Note: for a bigger app, you probably want to create a 'version'
-- table too and use it to keep track of schema version and
-- implement your schema upgrade procedure here.
schemaCreated <- tableExists conn "comments"
unless schemaCreated $
S.execute_ conn
(S.Query $
T.concat [ "CREATE TABLE comments ("
, "id INTEGER PRIMARY KEY, "
, "user_id INTEGER NOT NULL, "
, "saved_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, "
, "comment TEXT)"])
-- | Retrieve a user's list of comments
| 640
|
createTables conn = do
-- Note: for a bigger app, you probably want to create a 'version'
-- table too and use it to keep track of schema version and
-- implement your schema upgrade procedure here.
schemaCreated <- tableExists conn "comments"
unless schemaCreated $
S.execute_ conn
(S.Query $
T.concat [ "CREATE TABLE comments ("
, "id INTEGER PRIMARY KEY, "
, "user_id INTEGER NOT NULL, "
, "saved_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, "
, "comment TEXT)"])
-- | Retrieve a user's list of comments
| 602
| false
| true
| 0
| 12
| 183
| 87
| 45
| 42
| null | null |
RaphMad/CodeEval
|
src/PrimePalindrome.hs
|
mit
|
primes :: [Integer]
primes = 2 : [n | n <- 2 : [3..], not $ any (`divides` n) [2..sqrtInteger n]]
| 97
|
primes :: [Integer]
primes = 2 : [n | n <- 2 : [3..], not $ any (`divides` n) [2..sqrtInteger n]]
| 97
|
primes = 2 : [n | n <- 2 : [3..], not $ any (`divides` n) [2..sqrtInteger n]]
| 77
| false
| true
| 0
| 11
| 20
| 63
| 35
| 28
| null | null |
brendanhay/gogol
|
gogol-videointelligence/gen/Network/Google/VideoIntelligence/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'GoogleCloudVideointelligenceV1p3beta1_ExplicitContentFrame' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gcvvecfcTimeOffSet'
--
-- * 'gcvvecfcPornographyLikelihood'
googleCloudVideointelligenceV1p3beta1_ExplicitContentFrame
:: GoogleCloudVideointelligenceV1p3beta1_ExplicitContentFrame
googleCloudVideointelligenceV1p3beta1_ExplicitContentFrame =
GoogleCloudVideointelligenceV1p3beta1_ExplicitContentFrame'
{_gcvvecfcTimeOffSet = Nothing, _gcvvecfcPornographyLikelihood = Nothing}
| 604
|
googleCloudVideointelligenceV1p3beta1_ExplicitContentFrame
:: GoogleCloudVideointelligenceV1p3beta1_ExplicitContentFrame
googleCloudVideointelligenceV1p3beta1_ExplicitContentFrame =
GoogleCloudVideointelligenceV1p3beta1_ExplicitContentFrame'
{_gcvvecfcTimeOffSet = Nothing, _gcvvecfcPornographyLikelihood = Nothing}
| 325
|
googleCloudVideointelligenceV1p3beta1_ExplicitContentFrame =
GoogleCloudVideointelligenceV1p3beta1_ExplicitContentFrame'
{_gcvvecfcTimeOffSet = Nothing, _gcvvecfcPornographyLikelihood = Nothing}
| 200
| true
| true
| 0
| 6
| 59
| 32
| 22
| 10
| null | null |
energyflowanalysis/efa-2.1
|
src/EFA/Flow/Part/Index.hs
|
bsd-3-clause
|
formatBoundary (Following (NoInit s)) = format s
| 48
|
formatBoundary (Following (NoInit s)) = format s
| 48
|
formatBoundary (Following (NoInit s)) = format s
| 48
| false
| false
| 0
| 9
| 6
| 24
| 11
| 13
| null | null |
benkolera/phb
|
hs/Site.hs
|
mit
|
app :: SnapletInit Phb Phb
app = makeSnaplet "Phb" "A pointy haired boss" Nothing $ do
p <- nestSnaplet "" db $ initPersist (runMigration migrateAll)
h <- nestSnaplet "" heist $ heistInit' "templates" phbHeistConfig
s <- nestSnaplet "sess" sess $
initCookieSessionManager "site_key.txt" "sess" (Just 3600)
a <- nestSnaplet "auth" auth $
initPhbAuthManager sess (persistPool . view snapletValue $ p)
c <- getSnapletUserConfig
m <- liftIO $ mkMailConfig c
l <- liftIO $ mkLdapConfig c
addAuthSplices h auth
addRoutes routes
return $ Phb h p a s m l
| 574
|
app :: SnapletInit Phb Phb
app = makeSnaplet "Phb" "A pointy haired boss" Nothing $ do
p <- nestSnaplet "" db $ initPersist (runMigration migrateAll)
h <- nestSnaplet "" heist $ heistInit' "templates" phbHeistConfig
s <- nestSnaplet "sess" sess $
initCookieSessionManager "site_key.txt" "sess" (Just 3600)
a <- nestSnaplet "auth" auth $
initPhbAuthManager sess (persistPool . view snapletValue $ p)
c <- getSnapletUserConfig
m <- liftIO $ mkMailConfig c
l <- liftIO $ mkLdapConfig c
addAuthSplices h auth
addRoutes routes
return $ Phb h p a s m l
| 574
|
app = makeSnaplet "Phb" "A pointy haired boss" Nothing $ do
p <- nestSnaplet "" db $ initPersist (runMigration migrateAll)
h <- nestSnaplet "" heist $ heistInit' "templates" phbHeistConfig
s <- nestSnaplet "sess" sess $
initCookieSessionManager "site_key.txt" "sess" (Just 3600)
a <- nestSnaplet "auth" auth $
initPhbAuthManager sess (persistPool . view snapletValue $ p)
c <- getSnapletUserConfig
m <- liftIO $ mkMailConfig c
l <- liftIO $ mkLdapConfig c
addAuthSplices h auth
addRoutes routes
return $ Phb h p a s m l
| 547
| false
| true
| 1
| 15
| 115
| 212
| 91
| 121
| null | null |
Voleking/ICPC
|
references/aoapc-book/BeginningAlgorithmContests/haskell/ch2/ex2-5.hs
|
mit
|
main = do
line <- getLine
let arr = map read $ words line :: [Int]
let n = head arr
let m = last arr
let a = init . tail $ arr
print $ length $ filter (<m) a
| 169
|
main = do
line <- getLine
let arr = map read $ words line :: [Int]
let n = head arr
let m = last arr
let a = init . tail $ arr
print $ length $ filter (<m) a
| 169
|
main = do
line <- getLine
let arr = map read $ words line :: [Int]
let n = head arr
let m = last arr
let a = init . tail $ arr
print $ length $ filter (<m) a
| 169
| false
| false
| 4
| 7
| 52
| 88
| 44
| 44
| null | null |
atsukotakahashi/wi
|
src/library/Yi/UI/Vty/Conversions.hs
|
gpl-2.0
|
fromVtyKey (Vty.KCenter ) = Yi.Event.KNP5
| 43
|
fromVtyKey (Vty.KCenter ) = Yi.Event.KNP5
| 43
|
fromVtyKey (Vty.KCenter ) = Yi.Event.KNP5
| 43
| false
| false
| 0
| 6
| 6
| 18
| 9
| 9
| null | null |
zeniuseducation/poly-euler
|
Alfa/ml/one.hs
|
epl-1.0
|
sol53 :: Integral a => a -> Int
sol53 n = sum [length xs | lst <- triPascal n, let xs = filter (> 1000000) lst]
| 113
|
sol53 :: Integral a => a -> Int
sol53 n = sum [length xs | lst <- triPascal n, let xs = filter (> 1000000) lst]
| 111
|
sol53 n = sum [length xs | lst <- triPascal n, let xs = filter (> 1000000) lst]
| 79
| false
| true
| 0
| 12
| 27
| 70
| 32
| 38
| null | null |
ezyang/ghc
|
testsuite/tests/simplCore/should_compile/T7702plugin/T7702Plugin.hs
|
bsd-3-clause
|
nothingX1000 :: CoreM ()
nothingX1000 = do
nothingX100 ; nothingX100 ; nothingX100 ; nothingX100 ; nothingX100
nothingX100 ; nothingX100 ; nothingX100 ; nothingX100 ; nothingX100
| 186
|
nothingX1000 :: CoreM ()
nothingX1000 = do
nothingX100 ; nothingX100 ; nothingX100 ; nothingX100 ; nothingX100
nothingX100 ; nothingX100 ; nothingX100 ; nothingX100 ; nothingX100
| 186
|
nothingX1000 = do
nothingX100 ; nothingX100 ; nothingX100 ; nothingX100 ; nothingX100
nothingX100 ; nothingX100 ; nothingX100 ; nothingX100 ; nothingX100
| 161
| false
| true
| 1
| 7
| 32
| 58
| 26
| 32
| null | null |
fmapfmapfmap/amazonka
|
amazonka-ec2/gen/Network/AWS/EC2/AssignPrivateIPAddresses.hs
|
mpl-2.0
|
-- | The number of secondary IP addresses to assign to the network interface.
-- You can\'t specify this parameter when also specifying private IP
-- addresses.
apiaSecondaryPrivateIPAddressCount :: Lens' AssignPrivateIPAddresses (Maybe Int)
apiaSecondaryPrivateIPAddressCount = lens _apiaSecondaryPrivateIPAddressCount (\ s a -> s{_apiaSecondaryPrivateIPAddressCount = a})
| 373
|
apiaSecondaryPrivateIPAddressCount :: Lens' AssignPrivateIPAddresses (Maybe Int)
apiaSecondaryPrivateIPAddressCount = lens _apiaSecondaryPrivateIPAddressCount (\ s a -> s{_apiaSecondaryPrivateIPAddressCount = a})
| 212
|
apiaSecondaryPrivateIPAddressCount = lens _apiaSecondaryPrivateIPAddressCount (\ s a -> s{_apiaSecondaryPrivateIPAddressCount = a})
| 131
| true
| true
| 0
| 9
| 43
| 48
| 27
| 21
| null | null |
oldmanmike/ghc
|
compiler/types/Type.hs
|
bsd-3-clause
|
cmpTypes :: [Type] -> [Type] -> Ordering
cmpTypes ts1 ts2 = cmpTypesX rn_env ts1 ts2
where
rn_env = mkRnEnv2 (mkInScopeSet (tyCoVarsOfTypes (ts1 ++ ts2)))
-- | An ordering relation between two 'Type's (known below as @t1 :: k1@
-- and @t2 :: k2@)
| 253
|
cmpTypes :: [Type] -> [Type] -> Ordering
cmpTypes ts1 ts2 = cmpTypesX rn_env ts1 ts2
where
rn_env = mkRnEnv2 (mkInScopeSet (tyCoVarsOfTypes (ts1 ++ ts2)))
-- | An ordering relation between two 'Type's (known below as @t1 :: k1@
-- and @t2 :: k2@)
| 253
|
cmpTypes ts1 ts2 = cmpTypesX rn_env ts1 ts2
where
rn_env = mkRnEnv2 (mkInScopeSet (tyCoVarsOfTypes (ts1 ++ ts2)))
-- | An ordering relation between two 'Type's (known below as @t1 :: k1@
-- and @t2 :: k2@)
| 212
| false
| true
| 1
| 11
| 49
| 77
| 37
| 40
| null | null |
danr/hipspec
|
testsuite/prod/Properties.hs
|
gpl-3.0
|
prop_T33 :: Nat -> Prop Nat
prop_T33 x = fac x =:= qfac x one
| 61
|
prop_T33 :: Nat -> Prop Nat
prop_T33 x = fac x =:= qfac x one
| 61
|
prop_T33 x = fac x =:= qfac x one
| 33
| false
| true
| 1
| 7
| 14
| 36
| 15
| 21
| null | null |
uros-stegic/canx
|
server/canx-server/Settings.hs
|
gpl-3.0
|
-- | How static files should be combined.
combineSettings :: CombineSettings
combineSettings = def
| 98
|
combineSettings :: CombineSettings
combineSettings = def
| 56
|
combineSettings = def
| 21
| true
| true
| 0
| 4
| 13
| 12
| 7
| 5
| null | null |
adarqui/ToyBox
|
haskell/tomahawkins/atom/src/atom.hs
|
gpl-3.0
|
-- | An example design that computes the greatest common divisor.
example :: Atom ()
example = do
-- External reference to value A.
let a = word32' "a"
-- External reference to value B.
let b = word32' "b"
-- The external running flag.
let running = bool' "running"
-- A rule to modify A.
atom "a_minus_b" $ do
cond $ value a >. value b
a <== value a - value b
-- A rule to modify B.
atom "b_minus_a" $ do
cond $ value b >. value a
b <== value b - value a
-- A rule to clear the running flag.
atom "stop" $ do
cond $ value a ==. value b
running <== false
| 608
|
example :: Atom ()
example = do
-- External reference to value A.
let a = word32' "a"
-- External reference to value B.
let b = word32' "b"
-- The external running flag.
let running = bool' "running"
-- A rule to modify A.
atom "a_minus_b" $ do
cond $ value a >. value b
a <== value a - value b
-- A rule to modify B.
atom "b_minus_a" $ do
cond $ value b >. value a
b <== value b - value a
-- A rule to clear the running flag.
atom "stop" $ do
cond $ value a ==. value b
running <== false
| 542
|
example = do
-- External reference to value A.
let a = word32' "a"
-- External reference to value B.
let b = word32' "b"
-- The external running flag.
let running = bool' "running"
-- A rule to modify A.
atom "a_minus_b" $ do
cond $ value a >. value b
a <== value a - value b
-- A rule to modify B.
atom "b_minus_a" $ do
cond $ value b >. value a
b <== value b - value a
-- A rule to clear the running flag.
atom "stop" $ do
cond $ value a ==. value b
running <== false
| 523
| true
| true
| 0
| 12
| 173
| 181
| 80
| 101
| null | null |
pranjaltale16/codeworld
|
codeworld-account/src/CodeWorld/Account/Actions.hs
|
apache-2.0
|
updateAccount :: Store -> UserId -> Maybe Status -> Maybe PasswordHash -> IO ()
updateAccount store (UserId userIdRaw) mbStatus mbPasswordHash =
let params = buildParams $ do
addParam mbStatus "status" toField
addParam mbPasswordHash "passwordHash" (\(PasswordHash passwordHashRaw) -> SQLBlob passwordHashRaw)
(q, ps) = renderInsert "accounts" "userId" (SQLText $ Text.pack userIdRaw) params
in case ps of
[_] -> pure ()
_ -> withStore store $ \conn -> executeNamed conn q ps
| 571
|
updateAccount :: Store -> UserId -> Maybe Status -> Maybe PasswordHash -> IO ()
updateAccount store (UserId userIdRaw) mbStatus mbPasswordHash =
let params = buildParams $ do
addParam mbStatus "status" toField
addParam mbPasswordHash "passwordHash" (\(PasswordHash passwordHashRaw) -> SQLBlob passwordHashRaw)
(q, ps) = renderInsert "accounts" "userId" (SQLText $ Text.pack userIdRaw) params
in case ps of
[_] -> pure ()
_ -> withStore store $ \conn -> executeNamed conn q ps
| 571
|
updateAccount store (UserId userIdRaw) mbStatus mbPasswordHash =
let params = buildParams $ do
addParam mbStatus "status" toField
addParam mbPasswordHash "passwordHash" (\(PasswordHash passwordHashRaw) -> SQLBlob passwordHashRaw)
(q, ps) = renderInsert "accounts" "userId" (SQLText $ Text.pack userIdRaw) params
in case ps of
[_] -> pure ()
_ -> withStore store $ \conn -> executeNamed conn q ps
| 491
| false
| true
| 0
| 16
| 164
| 185
| 88
| 97
| null | null |
anand-singh/either
|
src/Data/Either/Combinators.hs
|
bsd-3-clause
|
-- | The 'mapLeft' function takes a function and applies it to an Either value
-- iff the value takes the form @'Left' _@.
--
-- Using @Data.Bifunctor@:
--
-- @
-- 'mapLeft' = first
-- @
--
-- Using @Control.Arrow@:
--
-- @
-- 'mapLeft' = ('Control.Arrow.left')
-- @
--
-- Using @Control.Lens@:
--
-- @
-- 'mapLeft' = over _Left
-- @
--
-- >>> mapLeft (*2) (Left 4)
-- Left 8
--
-- >>> mapLeft (*2) (Right "hello")
-- Right "hello"
mapLeft :: (a -> c) -> Either a b -> Either c b
mapLeft f = mapBoth f id
| 504
|
mapLeft :: (a -> c) -> Either a b -> Either c b
mapLeft f = mapBoth f id
| 72
|
mapLeft f = mapBoth f id
| 24
| true
| true
| 0
| 7
| 102
| 70
| 47
| 23
| null | null |
romanb/amazonka
|
amazonka-ec2/gen/Network/AWS/EC2/CreateReservedInstancesListing.hs
|
mpl-2.0
|
-- | 'CreateReservedInstancesListing' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'crilClientToken' @::@ 'Text'
--
-- * 'crilInstanceCount' @::@ 'Int'
--
-- * 'crilPriceSchedules' @::@ ['PriceScheduleSpecification']
--
-- * 'crilReservedInstancesId' @::@ 'Text'
--
createReservedInstancesListing :: Text -- ^ 'crilReservedInstancesId'
-> Int -- ^ 'crilInstanceCount'
-> Text -- ^ 'crilClientToken'
-> CreateReservedInstancesListing
createReservedInstancesListing p1 p2 p3 = CreateReservedInstancesListing
{ _crilReservedInstancesId = p1
, _crilInstanceCount = p2
, _crilClientToken = p3
, _crilPriceSchedules = mempty
}
| 790
|
createReservedInstancesListing :: Text -- ^ 'crilReservedInstancesId'
-> Int -- ^ 'crilInstanceCount'
-> Text -- ^ 'crilClientToken'
-> CreateReservedInstancesListing
createReservedInstancesListing p1 p2 p3 = CreateReservedInstancesListing
{ _crilReservedInstancesId = p1
, _crilInstanceCount = p2
, _crilClientToken = p3
, _crilPriceSchedules = mempty
}
| 486
|
createReservedInstancesListing p1 p2 p3 = CreateReservedInstancesListing
{ _crilReservedInstancesId = p1
, _crilInstanceCount = p2
, _crilClientToken = p3
, _crilPriceSchedules = mempty
}
| 226
| true
| true
| 0
| 7
| 210
| 75
| 48
| 27
| null | null |
diku-dk/futhark
|
src/Futhark/IR/Primitive.hs
|
isc
|
binOpType (AShr t) = IntType t
| 30
|
binOpType (AShr t) = IntType t
| 30
|
binOpType (AShr t) = IntType t
| 30
| false
| false
| 0
| 7
| 5
| 18
| 8
| 10
| null | null |
ndmitchell/nsis
|
src/Development/NSIS/Plugins/WinMessages.hs
|
bsd-3-clause
|
em_REPLACESEL = 0x00C2
| 32
|
em_REPLACESEL = 0x00C2
| 32
|
em_REPLACESEL = 0x00C2
| 32
| false
| false
| 0
| 4
| 12
| 6
| 3
| 3
| null | null |
mettekou/ghc
|
compiler/vectorise/Vectorise/Monad/Base.hs
|
bsd-3-clause
|
ensureV _reason True = return ()
| 33
|
ensureV _reason True = return ()
| 33
|
ensureV _reason True = return ()
| 33
| false
| false
| 0
| 6
| 6
| 16
| 7
| 9
| null | null |
gsnewmark/cis194
|
src/Cis194/Week8/Party.hs
|
apache-2.0
|
showSortedGuestList :: GuestList -> String
showSortedGuestList (GL es f) =
unlines $ ("Total fun: " ++ show f) : sort (map empName es)
| 136
|
showSortedGuestList :: GuestList -> String
showSortedGuestList (GL es f) =
unlines $ ("Total fun: " ++ show f) : sort (map empName es)
| 136
|
showSortedGuestList (GL es f) =
unlines $ ("Total fun: " ++ show f) : sort (map empName es)
| 93
| false
| true
| 2
| 8
| 24
| 60
| 28
| 32
| null | null |
AlexeyRaga/eta
|
compiler/ETA/Prelude/PrimOp.hs
|
bsd-3-clause
|
primOpInfo Ctz16Op = mkMonadic (fsLit "ctz16#") wordPrimTy
| 58
|
primOpInfo Ctz16Op = mkMonadic (fsLit "ctz16#") wordPrimTy
| 58
|
primOpInfo Ctz16Op = mkMonadic (fsLit "ctz16#") wordPrimTy
| 58
| false
| false
| 1
| 7
| 6
| 23
| 9
| 14
| null | null |
hferreiro/replay
|
compiler/nativeGen/X86/Ppr.hs
|
bsd-3-clause
|
pprSizeRegAddr :: LitString -> Size -> Reg -> AddrMode -> SDoc
pprSizeRegAddr name size src op
= hcat [
pprMnemonic name size,
pprReg size src,
comma,
pprAddr op
]
| 201
|
pprSizeRegAddr :: LitString -> Size -> Reg -> AddrMode -> SDoc
pprSizeRegAddr name size src op
= hcat [
pprMnemonic name size,
pprReg size src,
comma,
pprAddr op
]
| 201
|
pprSizeRegAddr name size src op
= hcat [
pprMnemonic name size,
pprReg size src,
comma,
pprAddr op
]
| 138
| false
| true
| 0
| 8
| 66
| 64
| 32
| 32
| null | null |
quyse/flaw
|
flaw-gl/Flaw/Graphics/OpenGL/FFI.hs
|
mit
|
glDeleteFramebufferName :: FramebufferName -> IO ()
glDeleteFramebufferName name = with name $ glDeleteFramebuffers 1
| 117
|
glDeleteFramebufferName :: FramebufferName -> IO ()
glDeleteFramebufferName name = with name $ glDeleteFramebuffers 1
| 117
|
glDeleteFramebufferName name = with name $ glDeleteFramebuffers 1
| 65
| false
| true
| 0
| 7
| 13
| 33
| 15
| 18
| null | null |
AKST/jo
|
source/test/JoScript/Pass/ParseTest.hs
|
mit
|
parseAppNestedCall = TestCase $ do
mod <- getModule
[ LpIdentifier "mul"
, LpSpace 1
, LpBraceL
, LpIdentifier "sub"
, LpSpace 1
, LpInteger 70
, LpSpace 1
, LpInteger 1
, LpBraceR
, LpSpace 1
, LpBraceL
, LpIdentifier "add"
, LpSpace 1
, LpInteger 900
, LpSpace 1
, LpInteger 11
, LpBraceR
, LpEnd ]
assertEqual "parses correctly" (statements mod)
[ invoke ( idExpr "mul" )
[ invoke ( idExpr "sub" ) [int 70, int 1] empty mempty
, invoke ( idExpr "add" ) [int 900, int 11] empty mempty ]
empty
mempty ]
--------------------------------------------------------------
-- Numbers --
--------------------------------------------------------------
| 827
|
parseAppNestedCall = TestCase $ do
mod <- getModule
[ LpIdentifier "mul"
, LpSpace 1
, LpBraceL
, LpIdentifier "sub"
, LpSpace 1
, LpInteger 70
, LpSpace 1
, LpInteger 1
, LpBraceR
, LpSpace 1
, LpBraceL
, LpIdentifier "add"
, LpSpace 1
, LpInteger 900
, LpSpace 1
, LpInteger 11
, LpBraceR
, LpEnd ]
assertEqual "parses correctly" (statements mod)
[ invoke ( idExpr "mul" )
[ invoke ( idExpr "sub" ) [int 70, int 1] empty mempty
, invoke ( idExpr "add" ) [int 900, int 11] empty mempty ]
empty
mempty ]
--------------------------------------------------------------
-- Numbers --
--------------------------------------------------------------
| 827
|
parseAppNestedCall = TestCase $ do
mod <- getModule
[ LpIdentifier "mul"
, LpSpace 1
, LpBraceL
, LpIdentifier "sub"
, LpSpace 1
, LpInteger 70
, LpSpace 1
, LpInteger 1
, LpBraceR
, LpSpace 1
, LpBraceL
, LpIdentifier "add"
, LpSpace 1
, LpInteger 900
, LpSpace 1
, LpInteger 11
, LpBraceR
, LpEnd ]
assertEqual "parses correctly" (statements mod)
[ invoke ( idExpr "mul" )
[ invoke ( idExpr "sub" ) [int 70, int 1] empty mempty
, invoke ( idExpr "add" ) [int 900, int 11] empty mempty ]
empty
mempty ]
--------------------------------------------------------------
-- Numbers --
--------------------------------------------------------------
| 827
| false
| false
| 0
| 14
| 285
| 210
| 107
| 103
| null | null |
haskell-opengl/OpenGLRaw
|
src/Graphics/GL/Functions/F14.hs
|
bsd-3-clause
|
-- glGetnUniformivARB ----------------------------------------------------------
glGetnUniformivARB
:: MonadIO m
=> GLuint -- ^ @program@.
-> GLint -- ^ @location@.
-> GLsizei -- ^ @bufSize@.
-> Ptr GLint -- ^ @params@ pointing to @bufSize@ elements of type @GLint@.
-> m ()
glGetnUniformivARB v1 v2 v3 v4 = liftIO $ dyn481 ptr_glGetnUniformivARB v1 v2 v3 v4
| 371
|
glGetnUniformivARB
:: MonadIO m
=> GLuint -- ^ @program@.
-> GLint -- ^ @location@.
-> GLsizei -- ^ @bufSize@.
-> Ptr GLint -- ^ @params@ pointing to @bufSize@ elements of type @GLint@.
-> m ()
glGetnUniformivARB v1 v2 v3 v4 = liftIO $ dyn481 ptr_glGetnUniformivARB v1 v2 v3 v4
| 289
|
glGetnUniformivARB v1 v2 v3 v4 = liftIO $ dyn481 ptr_glGetnUniformivARB v1 v2 v3 v4
| 83
| true
| true
| 0
| 12
| 64
| 75
| 37
| 38
| null | null |
haskell-distributed/distributed-process
|
distributed-process-tests/src/Control/Distributed/Process/Tests/Closure.hs
|
bsd-3-clause
|
testBind :: TestTransport -> RemoteTable -> Assertion
testBind TestTransport{..} rtable = do
node <- newLocalNode testTransport rtable
done <- newEmptyMVar
runProcess node $ do
us <- getSelfPid
join . unClosure $ sendFac 6 us
(i :: Int) <- expect
liftIO $ putMVar done ()
if i == 720
then return ()
else error "Something went horribly wrong"
takeMVar done
| 395
|
testBind :: TestTransport -> RemoteTable -> Assertion
testBind TestTransport{..} rtable = do
node <- newLocalNode testTransport rtable
done <- newEmptyMVar
runProcess node $ do
us <- getSelfPid
join . unClosure $ sendFac 6 us
(i :: Int) <- expect
liftIO $ putMVar done ()
if i == 720
then return ()
else error "Something went horribly wrong"
takeMVar done
| 395
|
testBind TestTransport{..} rtable = do
node <- newLocalNode testTransport rtable
done <- newEmptyMVar
runProcess node $ do
us <- getSelfPid
join . unClosure $ sendFac 6 us
(i :: Int) <- expect
liftIO $ putMVar done ()
if i == 720
then return ()
else error "Something went horribly wrong"
takeMVar done
| 341
| false
| true
| 0
| 12
| 98
| 139
| 63
| 76
| null | null |
mettekou/ghc
|
compiler/hsSyn/HsExpr.hs
|
bsd-3-clause
|
pprCmd :: (OutputableBndrId id) => HsCmd id -> SDoc
pprCmd c | isQuietHsCmd c = ppr_cmd c
| otherwise = pprDeeper (ppr_cmd c)
| 150
|
pprCmd :: (OutputableBndrId id) => HsCmd id -> SDoc
pprCmd c | isQuietHsCmd c = ppr_cmd c
| otherwise = pprDeeper (ppr_cmd c)
| 150
|
pprCmd c | isQuietHsCmd c = ppr_cmd c
| otherwise = pprDeeper (ppr_cmd c)
| 98
| false
| true
| 1
| 8
| 47
| 63
| 28
| 35
| null | null |
dpiponi/Bine
|
src/OSCLI.hs
|
bsd-3-clause
|
oscli :: (MonadState State6502 m, Emu6502 m) => m ()
oscli = do
lo <- getX
hi <- getY
let addr = make16 lo hi
cmd <- stringAt addr
tracelog $ printf "OSCLI: %s" cmd
let cmd' = removeStars cmd
let cmd'' = parse parseCommand "" cmd'
case cmd'' of
Right cmd''' -> execStarCommand cmd'''
Left _ -> do
void $ liftIO $ system cmd'
p0 <- getPC
putPC $ p0+2
return ()
| 447
|
oscli :: (MonadState State6502 m, Emu6502 m) => m ()
oscli = do
lo <- getX
hi <- getY
let addr = make16 lo hi
cmd <- stringAt addr
tracelog $ printf "OSCLI: %s" cmd
let cmd' = removeStars cmd
let cmd'' = parse parseCommand "" cmd'
case cmd'' of
Right cmd''' -> execStarCommand cmd'''
Left _ -> do
void $ liftIO $ system cmd'
p0 <- getPC
putPC $ p0+2
return ()
| 447
|
oscli = do
lo <- getX
hi <- getY
let addr = make16 lo hi
cmd <- stringAt addr
tracelog $ printf "OSCLI: %s" cmd
let cmd' = removeStars cmd
let cmd'' = parse parseCommand "" cmd'
case cmd'' of
Right cmd''' -> execStarCommand cmd'''
Left _ -> do
void $ liftIO $ system cmd'
p0 <- getPC
putPC $ p0+2
return ()
| 394
| false
| true
| 12
| 9
| 160
| 169
| 80
| 89
| null | null |
cutsea110/yesod-pnotify
|
Yesod/Goodies/PNotify.hs
|
bsd-3-clause
|
setPNotify :: PNotify -> HandlerT site IO ()
setPNotify n = do
mns <- getPNotify
_setPNotify (n:maybe [] id mns)
| 116
|
setPNotify :: PNotify -> HandlerT site IO ()
setPNotify n = do
mns <- getPNotify
_setPNotify (n:maybe [] id mns)
| 116
|
setPNotify n = do
mns <- getPNotify
_setPNotify (n:maybe [] id mns)
| 71
| false
| true
| 0
| 12
| 23
| 61
| 27
| 34
| null | null |
ssaavedra/liquidhaskell
|
benchmarks/esop2013-submission/GhcListSort.hs
|
bsd-3-clause
|
-- qpart partitions and sorts the sublists
qpart :: (Ord a) => a -> a -> [a] -> [a] -> [a] -> [a] -> [a]
qpart w x [] rlt rge r =
-- rlt and rge are in reverse order and must be sorted with an
-- anti-stable sorting
rqsort x rlt (x:rqsort w rge r)
| 259
|
qpart :: (Ord a) => a -> a -> [a] -> [a] -> [a] -> [a] -> [a]
qpart w x [] rlt rge r =
-- rlt and rge are in reverse order and must be sorted with an
-- anti-stable sorting
rqsort x rlt (x:rqsort w rge r)
| 216
|
qpart w x [] rlt rge r =
-- rlt and rge are in reverse order and must be sorted with an
-- anti-stable sorting
rqsort x rlt (x:rqsort w rge r)
| 154
| true
| true
| 0
| 12
| 68
| 98
| 53
| 45
| null | null |
Eugleo/Code-Wars
|
src/haskell-kata/FunctionalStreams.hs
|
bsd-3-clause
|
takeS :: Int -> Stream a -> [a]
takeS n (x :> xs) =
if n <= 0
then []
else x : takeS (n - 1) xs
| 105
|
takeS :: Int -> Stream a -> [a]
takeS n (x :> xs) =
if n <= 0
then []
else x : takeS (n - 1) xs
| 105
|
takeS n (x :> xs) =
if n <= 0
then []
else x : takeS (n - 1) xs
| 73
| false
| true
| 0
| 9
| 37
| 71
| 36
| 35
| null | null |
da-x/lamdu
|
Lamdu/GUI/ExpressionEdit/LambdaEdit.hs
|
gpl-3.0
|
mkLightLambda ::
Monad n =>
Sugar.BinderParams a m -> Widget.Id ->
ExprGuiM n
(Maybe (ExpressionGui n) ->
Maybe (ExpressionGui n) ->
[ExpressionGui n])
mkLightLambda params myId =
do
isSelected <-
mapM (WE.isSubCursor . WidgetIds.fromEntityId) paramIds
<&> or
& ExprGuiM.widgetEnv
let shrinkKeys = [ModKey mempty GLFW.Key'Escape]
let shrinkEventMap =
Widget.keysEventMapMovesCursor shrinkKeys
(E.Doc ["View", "Shrink Lambda Params"]) (return (lamId myId))
if isSelected
then
mkExpanded animId
<&> Lens.mapped . Lens.mapped . Lens.mapped . ExpressionGui.egWidget %~ Widget.weakerEvents shrinkEventMap
else mkShrunk paramIds myId
<&> \mk _mParamsEdit mScopeEdit -> mk mScopeEdit
where
paramIds = params ^.. SugarLens.binderNamedParams . Sugar.fpId
animId = Widget.toAnimId myId
| 1,000
|
mkLightLambda ::
Monad n =>
Sugar.BinderParams a m -> Widget.Id ->
ExprGuiM n
(Maybe (ExpressionGui n) ->
Maybe (ExpressionGui n) ->
[ExpressionGui n])
mkLightLambda params myId =
do
isSelected <-
mapM (WE.isSubCursor . WidgetIds.fromEntityId) paramIds
<&> or
& ExprGuiM.widgetEnv
let shrinkKeys = [ModKey mempty GLFW.Key'Escape]
let shrinkEventMap =
Widget.keysEventMapMovesCursor shrinkKeys
(E.Doc ["View", "Shrink Lambda Params"]) (return (lamId myId))
if isSelected
then
mkExpanded animId
<&> Lens.mapped . Lens.mapped . Lens.mapped . ExpressionGui.egWidget %~ Widget.weakerEvents shrinkEventMap
else mkShrunk paramIds myId
<&> \mk _mParamsEdit mScopeEdit -> mk mScopeEdit
where
paramIds = params ^.. SugarLens.binderNamedParams . Sugar.fpId
animId = Widget.toAnimId myId
| 1,000
|
mkLightLambda params myId =
do
isSelected <-
mapM (WE.isSubCursor . WidgetIds.fromEntityId) paramIds
<&> or
& ExprGuiM.widgetEnv
let shrinkKeys = [ModKey mempty GLFW.Key'Escape]
let shrinkEventMap =
Widget.keysEventMapMovesCursor shrinkKeys
(E.Doc ["View", "Shrink Lambda Params"]) (return (lamId myId))
if isSelected
then
mkExpanded animId
<&> Lens.mapped . Lens.mapped . Lens.mapped . ExpressionGui.egWidget %~ Widget.weakerEvents shrinkEventMap
else mkShrunk paramIds myId
<&> \mk _mParamsEdit mScopeEdit -> mk mScopeEdit
where
paramIds = params ^.. SugarLens.binderNamedParams . Sugar.fpId
animId = Widget.toAnimId myId
| 822
| false
| true
| 2
| 15
| 321
| 284
| 134
| 150
| null | null |
Teaspot-Studio/gore-and-ash
|
examples/Logger.hs
|
bsd-3-clause
|
-- The application should be generic in the host monad that is used
app :: LoggerMonad t m => m ()
app = do
msgE <- inputMessage
outputMessage $ fmap (\msg -> "You said: " ++ msg) msgE
| 188
|
app :: LoggerMonad t m => m ()
app = do
msgE <- inputMessage
outputMessage $ fmap (\msg -> "You said: " ++ msg) msgE
| 120
|
app = do
msgE <- inputMessage
outputMessage $ fmap (\msg -> "You said: " ++ msg) msgE
| 89
| true
| true
| 0
| 11
| 41
| 57
| 28
| 29
| null | null |
ben-schulz/Idris-dev
|
src/Idris/CaseSplit.hs
|
bsd-3-clause
|
mergePat :: IState -> PTerm -> PTerm -> Maybe Name -> State MergeState PTerm
mergePat ist orig new t =
do -- collect user names for name map, by matching user pattern against
-- the generated pattern
case matchClause ist orig new of
Left _ -> return ()
Right ns -> mapM_ addNameMap ns
mergePat' ist orig new t
where
addNameMap (n, PRef fc _ n') = do ms <- get
put (ms { namemap = ((n', n) : namemap ms) })
addNameMap _ = return ()
-- | If any names are unified, make sure they stay unified. Always
-- prefer user provided name (first pattern)
| 640
|
mergePat :: IState -> PTerm -> PTerm -> Maybe Name -> State MergeState PTerm
mergePat ist orig new t =
do -- collect user names for name map, by matching user pattern against
-- the generated pattern
case matchClause ist orig new of
Left _ -> return ()
Right ns -> mapM_ addNameMap ns
mergePat' ist orig new t
where
addNameMap (n, PRef fc _ n') = do ms <- get
put (ms { namemap = ((n', n) : namemap ms) })
addNameMap _ = return ()
-- | If any names are unified, make sure they stay unified. Always
-- prefer user provided name (first pattern)
| 640
|
mergePat ist orig new t =
do -- collect user names for name map, by matching user pattern against
-- the generated pattern
case matchClause ist orig new of
Left _ -> return ()
Right ns -> mapM_ addNameMap ns
mergePat' ist orig new t
where
addNameMap (n, PRef fc _ n') = do ms <- get
put (ms { namemap = ((n', n) : namemap ms) })
addNameMap _ = return ()
-- | If any names are unified, make sure they stay unified. Always
-- prefer user provided name (first pattern)
| 563
| false
| true
| 0
| 13
| 204
| 179
| 87
| 92
| null | null |
shlevy/ghc
|
compiler/utils/Outputable.hs
|
bsd-3-clause
|
pprHsChar :: Char -> SDoc
pprHsChar c | c > '\x10ffff' = char '\\' <> text (show (fromIntegral (ord c) :: Word32))
| otherwise = text (show c)
| 159
|
pprHsChar :: Char -> SDoc
pprHsChar c | c > '\x10ffff' = char '\\' <> text (show (fromIntegral (ord c) :: Word32))
| otherwise = text (show c)
| 159
|
pprHsChar c | c > '\x10ffff' = char '\\' <> text (show (fromIntegral (ord c) :: Word32))
| otherwise = text (show c)
| 133
| false
| true
| 0
| 13
| 44
| 77
| 36
| 41
| null | null |
JoeyEremondi/haskelm-old
|
Setup.hs
|
bsd-3-clause
|
-- The runtime is called:
rts :: LocalBuildInfo -> FilePath
rts lbi = rtsDir lbi </> "elm-runtime.js"
| 101
|
rts :: LocalBuildInfo -> FilePath
rts lbi = rtsDir lbi </> "elm-runtime.js"
| 75
|
rts lbi = rtsDir lbi </> "elm-runtime.js"
| 41
| true
| true
| 0
| 7
| 16
| 31
| 14
| 17
| null | null |
spechub/Hets
|
Temporal/NuSmv.hs
|
gpl-2.0
|
showBasicExpr (Xnor exprA exprB) True = concat [ showBasicExpr exprA False,
" xnor ",
showBasicExpr exprB False ]
| 211
|
showBasicExpr (Xnor exprA exprB) True = concat [ showBasicExpr exprA False,
" xnor ",
showBasicExpr exprB False ]
| 211
|
showBasicExpr (Xnor exprA exprB) True = concat [ showBasicExpr exprA False,
" xnor ",
showBasicExpr exprB False ]
| 211
| false
| false
| 1
| 7
| 115
| 42
| 20
| 22
| null | null |
pbogdan/react-flux-mui
|
react-flux-mui/src/React/Flux/Mui/Card/CardActions.hs
|
bsd-3-clause
|
defCardActions :: CardActions
defCardActions =
CardActions
{ cardActionsActAsExpander = Nothing
, cardActionsExpandable = Nothing
, cardActionsShowExpandableButton = Nothing
}
| 185
|
defCardActions :: CardActions
defCardActions =
CardActions
{ cardActionsActAsExpander = Nothing
, cardActionsExpandable = Nothing
, cardActionsShowExpandableButton = Nothing
}
| 185
|
defCardActions =
CardActions
{ cardActionsActAsExpander = Nothing
, cardActionsExpandable = Nothing
, cardActionsShowExpandableButton = Nothing
}
| 155
| false
| true
| 0
| 7
| 28
| 41
| 21
| 20
| null | null |
winterland1989/mysql-haskell
|
Database/MySQL/Protocol/MySQLValue.hs
|
bsd-3-clause
|
putBinaryField (MySQLInt32U n) = putWord32le n
| 50
|
putBinaryField (MySQLInt32U n) = putWord32le n
| 50
|
putBinaryField (MySQLInt32U n) = putWord32le n
| 50
| false
| false
| 0
| 7
| 9
| 18
| 8
| 10
| null | null |
noamz/linlam-gos
|
src/Lambda.hs
|
mit
|
sizeNeutral (V x) = 0
| 21
|
sizeNeutral (V x) = 0
| 21
|
sizeNeutral (V x) = 0
| 21
| false
| false
| 0
| 7
| 4
| 15
| 7
| 8
| null | null |
ddssff/lens
|
benchmarks/alongside.hs
|
bsd-3-clause
|
-- a version of alongside built with Context and product
half :: LensLike (Context a b) s t a b -> Lens s' t' a' b' -> Lens (s,s') (t,t') (a,a') (b,b')
half l r pfq (s,s') = fmap (\(b,t') -> (peekContext b x,t')) (getCompose (r (\a' -> Compose $ pfq (posContext x, a')) s'))
| 274
|
half :: LensLike (Context a b) s t a b -> Lens s' t' a' b' -> Lens (s,s') (t,t') (a,a') (b,b')
half l r pfq (s,s') = fmap (\(b,t') -> (peekContext b x,t')) (getCompose (r (\a' -> Compose $ pfq (posContext x, a')) s'))
| 217
|
half l r pfq (s,s') = fmap (\(b,t') -> (peekContext b x,t')) (getCompose (r (\a' -> Compose $ pfq (posContext x, a')) s'))
| 122
| true
| true
| 0
| 15
| 54
| 164
| 89
| 75
| null | null |
HJvT/hdirect
|
src/Parser.hs
|
bsd-3-clause
|
action_384 (48#) = happyGoto action_191
| 39
|
action_384 (48#) = happyGoto action_191
| 39
|
action_384 (48#) = happyGoto action_191
| 39
| false
| false
| 0
| 6
| 4
| 15
| 7
| 8
| null | null |
maxking/cs583-project
|
src/BotCommand.hs
|
gpl-3.0
|
{- The conversions need to be strict so that errors can be caught
to show proper messages.
The value of seq a b is bottom if a is bottom, and otherwise equal to b.
seq is usually introduced to improve performance by avoiding unneeded laziness.
Both its arguments are strict
-}
convertToInt :: [String] -> Either ArgError Int
convertToInt [x] = let i = read x :: Int in i `seq` return i
| 389
|
convertToInt :: [String] -> Either ArgError Int
convertToInt [x] = let i = read x :: Int in i `seq` return i
| 108
|
convertToInt [x] = let i = read x :: Int in i `seq` return i
| 60
| true
| true
| 0
| 9
| 76
| 56
| 29
| 27
| null | null |
shimazing/haskell-study-fall2016
|
HW05/HW05.hs
|
bsd-3-clause
|
getBadTs :: FilePath -> FilePath -> IO (Maybe [Transaction])
getBadTs vicFile tsFile = do
vicList_ <- parseFile vicFile
tsList_ <- parseFile tsFile
let vicList = fromMaybe [] vicList_
let tsList = fromMaybe [] tsList_
return $ Just $ filter (\x -> elem (tid x) vicList) tsList
-- Exercise 5 -----------------------------------------
| 353
|
getBadTs :: FilePath -> FilePath -> IO (Maybe [Transaction])
getBadTs vicFile tsFile = do
vicList_ <- parseFile vicFile
tsList_ <- parseFile tsFile
let vicList = fromMaybe [] vicList_
let tsList = fromMaybe [] tsList_
return $ Just $ filter (\x -> elem (tid x) vicList) tsList
-- Exercise 5 -----------------------------------------
| 353
|
getBadTs vicFile tsFile = do
vicList_ <- parseFile vicFile
tsList_ <- parseFile tsFile
let vicList = fromMaybe [] vicList_
let tsList = fromMaybe [] tsList_
return $ Just $ filter (\x -> elem (tid x) vicList) tsList
-- Exercise 5 -----------------------------------------
| 292
| false
| true
| 0
| 13
| 70
| 124
| 58
| 66
| null | null |
Mokosha/HsTetrisAttack
|
TetrisAttack/AI.hs
|
mit
|
canSwap _ = False
| 17
|
canSwap _ = False
| 17
|
canSwap _ = False
| 17
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
joyfulmantis/heisigUtils
|
heisigUtils.hs
|
gpl-2.0
|
parserQueryer :: (T.Text -> Command) -> Parser Command
parserQueryer q = q <$> T.pack <$> strArgument (metavar "<Characters and/or Keywords>")
| 142
|
parserQueryer :: (T.Text -> Command) -> Parser Command
parserQueryer q = q <$> T.pack <$> strArgument (metavar "<Characters and/or Keywords>")
| 142
|
parserQueryer q = q <$> T.pack <$> strArgument (metavar "<Characters and/or Keywords>")
| 87
| false
| true
| 0
| 8
| 19
| 49
| 24
| 25
| null | null |
grnet/snf-ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
besParameterTypes :: Map String VType
besParameterTypes =
Map.fromList [(beAlwaysFailover, VTypeBool),
(beAutoBalance, VTypeBool),
(beMaxmem, VTypeSize),
(beMinmem, VTypeSize),
(beSpindleUse, VTypeInt),
(beVcpus, VTypeInt)]
| 305
|
besParameterTypes :: Map String VType
besParameterTypes =
Map.fromList [(beAlwaysFailover, VTypeBool),
(beAutoBalance, VTypeBool),
(beMaxmem, VTypeSize),
(beMinmem, VTypeSize),
(beSpindleUse, VTypeInt),
(beVcpus, VTypeInt)]
| 305
|
besParameterTypes =
Map.fromList [(beAlwaysFailover, VTypeBool),
(beAutoBalance, VTypeBool),
(beMaxmem, VTypeSize),
(beMinmem, VTypeSize),
(beSpindleUse, VTypeInt),
(beVcpus, VTypeInt)]
| 267
| false
| true
| 1
| 6
| 101
| 79
| 46
| 33
| null | null |
FranklinChen/Hugs
|
tests/rts/read.hs
|
bsd-3-clause
|
test101 = tst (pi :: Float)
| 28
|
test101 = tst (pi :: Float)
| 28
|
test101 = tst (pi :: Float)
| 28
| false
| false
| 1
| 6
| 6
| 18
| 8
| 10
| null | null |
jrosti/ultra
|
src/PredictionExts.hs
|
bsd-3-clause
|
co2o2ratio rp
| rp >= 0.85 = 1.0
| rp < 0.5 = 0.7
| otherwise = 0.7 + 0.3/0.35*(rp-0.5)
| 94
|
co2o2ratio rp
| rp >= 0.85 = 1.0
| rp < 0.5 = 0.7
| otherwise = 0.7 + 0.3/0.35*(rp-0.5)
| 94
|
co2o2ratio rp
| rp >= 0.85 = 1.0
| rp < 0.5 = 0.7
| otherwise = 0.7 + 0.3/0.35*(rp-0.5)
| 94
| false
| false
| 2
| 8
| 26
| 59
| 28
| 31
| null | null |
christiaanb/clash-compiler
|
clash-ghc/src-ghc/CLaSH/GHC/GHC2Core.hs
|
bsd-2-clause
|
coreToId :: Id
-> State GHC2CoreState C.Id
coreToId i =
C.Id <$> (coreToVar i) <*> (embed <$> coreToType (varType i))
| 128
|
coreToId :: Id
-> State GHC2CoreState C.Id
coreToId i =
C.Id <$> (coreToVar i) <*> (embed <$> coreToType (varType i))
| 128
|
coreToId i =
C.Id <$> (coreToVar i) <*> (embed <$> coreToType (varType i))
| 76
| false
| true
| 0
| 10
| 30
| 57
| 28
| 29
| null | null |
svalaskevicius/nested-sets
|
test/Data/NestedSetSpec.hs
|
gpl-3.0
|
complexNestedSets :: NestedSets Char
complexNestedSets = [NestedSetsNode (1, 8) 'a' [
NestedSetsNode (2, 7) 'b' [
NestedSetsNode (3, 4) 'c' [],
NestedSetsNode (5, 6) 'd' []]],
NestedSetsNode (9, 14) 'e' [
NestedSetsNode (10, 11) 'f' [],
NestedSetsNode (12, 13) 'g' []]]
| 423
|
complexNestedSets :: NestedSets Char
complexNestedSets = [NestedSetsNode (1, 8) 'a' [
NestedSetsNode (2, 7) 'b' [
NestedSetsNode (3, 4) 'c' [],
NestedSetsNode (5, 6) 'd' []]],
NestedSetsNode (9, 14) 'e' [
NestedSetsNode (10, 11) 'f' [],
NestedSetsNode (12, 13) 'g' []]]
| 423
|
complexNestedSets = [NestedSetsNode (1, 8) 'a' [
NestedSetsNode (2, 7) 'b' [
NestedSetsNode (3, 4) 'c' [],
NestedSetsNode (5, 6) 'd' []]],
NestedSetsNode (9, 14) 'e' [
NestedSetsNode (10, 11) 'f' [],
NestedSetsNode (12, 13) 'g' []]]
| 386
| false
| true
| 1
| 12
| 194
| 138
| 74
| 64
| null | null |
sgillespie/ghc
|
compiler/hsSyn/HsExpr.hs
|
bsd-3-clause
|
isAtomicHsExpr (HsOverLabel {}) = True
| 39
|
isAtomicHsExpr (HsOverLabel {}) = True
| 39
|
isAtomicHsExpr (HsOverLabel {}) = True
| 39
| false
| false
| 0
| 7
| 5
| 16
| 8
| 8
| null | null |
RossOgilvie/MathPrelude
|
MathPrelude/Classes/VectorSpace.hs
|
gpl-3.0
|
-- | In the case where the base ring is actually a field after all, scalar division makes sense.
(/.) :: (Field k, Module v k) => v -> k -> v
(/.) = flip (./)
| 158
|
(/.) :: (Field k, Module v k) => v -> k -> v
(/.) = flip (./)
| 61
|
(/.) = flip (./)
| 16
| true
| true
| 0
| 9
| 35
| 53
| 28
| 25
| null | null |
tadeuzagallo/verve-lang
|
src/Core/Desugar.hs
|
mit
|
d_decls (d:ds) k = do
d_decl d (\_ -> d_decls ds k)
| 53
|
d_decls (d:ds) k = do
d_decl d (\_ -> d_decls ds k)
| 53
|
d_decls (d:ds) k = do
d_decl d (\_ -> d_decls ds k)
| 53
| false
| false
| 0
| 10
| 13
| 39
| 19
| 20
| null | null |
stackbuilders/sshd-lint
|
spec/System/SshdLint/CheckSpec.hs
|
mit
|
spec :: Spec
spec =
describe "normalizing and validating settings" $ do
describe "duplicatedValues" $ do
it "returns a list of keys found multiple times" $
duplicatedValues [ "PermitEmptyPasswords"
, "PermitEmptyPasswords" ] `shouldBe`
Set.fromList ["permitemptypasswords"]
it "finds duplicated elements regardless of case" $
duplicatedValues [ "PermitEmptyPasswords"
, "permitemptypasswords" ] `shouldBe`
Set.fromList ["permitemptypasswords"]
it "allows duplicate HostKey values" $
duplicatedValues [ "HostKey"
, "hostkey" ] `shouldBe`
Set.empty
describe "activeSettings" $
it "returns settings based on their first occurrence in the list" $
activeSettings [ ("PermitEmptyPasswords", ["yes"])
, ("PermitEmptyPasswords", ["no"]) ]
`shouldBe` Map.fromList [ ("permitemptypasswords", ["yes"]) ]
describe "recommendations" $ do
it "returns all settings that are unsafe, along with better alternatives" $
recommendations (Map.fromList [("permitemptypasswords", ["no"])])
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` ["permitemptypasswords should be [\"no\"], found [\"yes\"]"]
it "finds recommendations even when there are case differences" $
recommendations (Map.fromList [("PermitEmptyPasswords", ["no"])])
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` ["permitemptypasswords should be [\"no\"], found [\"yes\"]"]
it "passes over config options for which we have no recommendations" $
recommendations Map.empty
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` [ ]
it "doesn't care about ordering of values" $
recommendations (Map.fromList [("AcceptEnv", ["LANG", "LC_*"])])
(Map.fromList [("acceptenv", ["LC_*", "LANG"])])
`shouldBe` [ ]
| 2,025
|
spec :: Spec
spec =
describe "normalizing and validating settings" $ do
describe "duplicatedValues" $ do
it "returns a list of keys found multiple times" $
duplicatedValues [ "PermitEmptyPasswords"
, "PermitEmptyPasswords" ] `shouldBe`
Set.fromList ["permitemptypasswords"]
it "finds duplicated elements regardless of case" $
duplicatedValues [ "PermitEmptyPasswords"
, "permitemptypasswords" ] `shouldBe`
Set.fromList ["permitemptypasswords"]
it "allows duplicate HostKey values" $
duplicatedValues [ "HostKey"
, "hostkey" ] `shouldBe`
Set.empty
describe "activeSettings" $
it "returns settings based on their first occurrence in the list" $
activeSettings [ ("PermitEmptyPasswords", ["yes"])
, ("PermitEmptyPasswords", ["no"]) ]
`shouldBe` Map.fromList [ ("permitemptypasswords", ["yes"]) ]
describe "recommendations" $ do
it "returns all settings that are unsafe, along with better alternatives" $
recommendations (Map.fromList [("permitemptypasswords", ["no"])])
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` ["permitemptypasswords should be [\"no\"], found [\"yes\"]"]
it "finds recommendations even when there are case differences" $
recommendations (Map.fromList [("PermitEmptyPasswords", ["no"])])
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` ["permitemptypasswords should be [\"no\"], found [\"yes\"]"]
it "passes over config options for which we have no recommendations" $
recommendations Map.empty
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` [ ]
it "doesn't care about ordering of values" $
recommendations (Map.fromList [("AcceptEnv", ["LANG", "LC_*"])])
(Map.fromList [("acceptenv", ["LC_*", "LANG"])])
`shouldBe` [ ]
| 2,025
|
spec =
describe "normalizing and validating settings" $ do
describe "duplicatedValues" $ do
it "returns a list of keys found multiple times" $
duplicatedValues [ "PermitEmptyPasswords"
, "PermitEmptyPasswords" ] `shouldBe`
Set.fromList ["permitemptypasswords"]
it "finds duplicated elements regardless of case" $
duplicatedValues [ "PermitEmptyPasswords"
, "permitemptypasswords" ] `shouldBe`
Set.fromList ["permitemptypasswords"]
it "allows duplicate HostKey values" $
duplicatedValues [ "HostKey"
, "hostkey" ] `shouldBe`
Set.empty
describe "activeSettings" $
it "returns settings based on their first occurrence in the list" $
activeSettings [ ("PermitEmptyPasswords", ["yes"])
, ("PermitEmptyPasswords", ["no"]) ]
`shouldBe` Map.fromList [ ("permitemptypasswords", ["yes"]) ]
describe "recommendations" $ do
it "returns all settings that are unsafe, along with better alternatives" $
recommendations (Map.fromList [("permitemptypasswords", ["no"])])
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` ["permitemptypasswords should be [\"no\"], found [\"yes\"]"]
it "finds recommendations even when there are case differences" $
recommendations (Map.fromList [("PermitEmptyPasswords", ["no"])])
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` ["permitemptypasswords should be [\"no\"], found [\"yes\"]"]
it "passes over config options for which we have no recommendations" $
recommendations Map.empty
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` [ ]
it "doesn't care about ordering of values" $
recommendations (Map.fromList [("AcceptEnv", ["LANG", "LC_*"])])
(Map.fromList [("acceptenv", ["LC_*", "LANG"])])
`shouldBe` [ ]
| 2,012
| false
| true
| 0
| 18
| 532
| 447
| 239
| 208
| null | null |
blockynight/hdarchiver
|
Main.hs
|
mit
|
dumpDar :: FilePath -> IO ()
dumpDar dFile = do
darfile <- BC.readFile dFile
either
(\msg -> hPutStrLn stderr msg)
(\dNodes -> putStrLn $ dFile ++ "\n\n"
++ (concatMap (\d -> (BC.unpack $ identifyDNode d) ++ "\n"
++ (BC.unpack $ contentDNode d) ++ "\n\n") dNodes))
(getDARFile darfile)
| 355
|
dumpDar :: FilePath -> IO ()
dumpDar dFile = do
darfile <- BC.readFile dFile
either
(\msg -> hPutStrLn stderr msg)
(\dNodes -> putStrLn $ dFile ++ "\n\n"
++ (concatMap (\d -> (BC.unpack $ identifyDNode d) ++ "\n"
++ (BC.unpack $ contentDNode d) ++ "\n\n") dNodes))
(getDARFile darfile)
| 355
|
dumpDar dFile = do
darfile <- BC.readFile dFile
either
(\msg -> hPutStrLn stderr msg)
(\dNodes -> putStrLn $ dFile ++ "\n\n"
++ (concatMap (\d -> (BC.unpack $ identifyDNode d) ++ "\n"
++ (BC.unpack $ contentDNode d) ++ "\n\n") dNodes))
(getDARFile darfile)
| 326
| false
| true
| 0
| 21
| 116
| 141
| 69
| 72
| null | null |
alexvong1995/pandoc
|
src/Text/Pandoc/Parsing.hs
|
gpl-2.0
|
oneOfStrings :: Stream s m Char => [String] -> ParserT s st m String
oneOfStrings = oneOfStrings' (==)
| 102
|
oneOfStrings :: Stream s m Char => [String] -> ParserT s st m String
oneOfStrings = oneOfStrings' (==)
| 102
|
oneOfStrings = oneOfStrings' (==)
| 33
| false
| true
| 0
| 7
| 17
| 43
| 22
| 21
| null | null |
Lykos/Sara
|
src/lib/Sara/Ast/AstUtils.hs
|
gpl-3.0
|
foldMapExpression :: Monoid m => (Expression a b c d -> m) -> Expression a b c d -> m
foldMapExpression f = execWriter . transformExpressionInternal transformer
where transformer = AstTransformer id id id id nullTVarContextTrans Nothing undefined (accumulate f) undefined undefined
-- | Accumulates a monoid over all expressions.
| 332
|
foldMapExpression :: Monoid m => (Expression a b c d -> m) -> Expression a b c d -> m
foldMapExpression f = execWriter . transformExpressionInternal transformer
where transformer = AstTransformer id id id id nullTVarContextTrans Nothing undefined (accumulate f) undefined undefined
-- | Accumulates a monoid over all expressions.
| 332
|
foldMapExpression f = execWriter . transformExpressionInternal transformer
where transformer = AstTransformer id id id id nullTVarContextTrans Nothing undefined (accumulate f) undefined undefined
-- | Accumulates a monoid over all expressions.
| 246
| false
| true
| 0
| 9
| 52
| 97
| 47
| 50
| null | null |
CulpaBS/wbBach
|
src/Futhark/Representation/ExplicitMemory/IndexFunction.hs
|
bsd-3-clause
|
shape (Offset ixfun _) =
shape ixfun
| 38
|
shape (Offset ixfun _) =
shape ixfun
| 38
|
shape (Offset ixfun _) =
shape ixfun
| 38
| false
| false
| 0
| 6
| 8
| 21
| 9
| 12
| null | null |
phischu/fragnix
|
tests/packages/scotty/Data.Aeson.Encode.hs
|
bsd-3-clause
|
encode :: A.ToJSON a => a -> ByteString
encode = A.encode
| 57
|
encode :: A.ToJSON a => a -> ByteString
encode = A.encode
| 57
|
encode = A.encode
| 17
| false
| true
| 0
| 7
| 10
| 26
| 13
| 13
| null | null |
cutsea110/aop
|
src/FixPrime.hs
|
bsd-3-clause
|
cochrono :: Functor f => (f (Cofree f t) -> t) -> (t -> f (Free f t)) -> Fix f -> Fix f
cochrono phi psi = futu psi . histo phi
| 127
|
cochrono :: Functor f => (f (Cofree f t) -> t) -> (t -> f (Free f t)) -> Fix f -> Fix f
cochrono phi psi = futu psi . histo phi
| 127
|
cochrono phi psi = futu psi . histo phi
| 39
| false
| true
| 0
| 12
| 32
| 87
| 41
| 46
| null | null |
pheaver/BitVector
|
Data/BitVector/BitVector3.hs
|
bsd-3-clause
|
resize n (BV w a b)
| n < w = BV n (maskWidth n a) (maskWidth n b)
| otherwise = BV n a b
| 97
|
resize n (BV w a b)
| n < w = BV n (maskWidth n a) (maskWidth n b)
| otherwise = BV n a b
| 97
|
resize n (BV w a b)
| n < w = BV n (maskWidth n a) (maskWidth n b)
| otherwise = BV n a b
| 97
| false
| false
| 1
| 8
| 33
| 68
| 32
| 36
| null | null |
isomorphism/labelled-hexdump-parser
|
Parser.hs
|
bsd-3-clause
|
skipZeros8 :: (Monad m) => Int -> FieldParser m ()
skipZeros8 l = named "skipped bytes" . displayAs (replicate l 'b') $ do
replicateM l $ expect 0 uint8
return ()
| 172
|
skipZeros8 :: (Monad m) => Int -> FieldParser m ()
skipZeros8 l = named "skipped bytes" . displayAs (replicate l 'b') $ do
replicateM l $ expect 0 uint8
return ()
| 172
|
skipZeros8 l = named "skipped bytes" . displayAs (replicate l 'b') $ do
replicateM l $ expect 0 uint8
return ()
| 121
| false
| true
| 0
| 10
| 40
| 84
| 37
| 47
| null | null |
rfranek/duckling
|
Duckling/Numeral/EN/Rules.hs
|
bsd-3-clause
|
ruleFractions :: Rule
ruleFractions = Rule
{ name = "fractional number"
, pattern = [regex "(\\d+)/(\\d+)"]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (numerator:denominator:_)):_) -> do
n <- parseDecimal False numerator
d <- parseDecimal False denominator
divide n d
_ -> Nothing
}
| 348
|
ruleFractions :: Rule
ruleFractions = Rule
{ name = "fractional number"
, pattern = [regex "(\\d+)/(\\d+)"]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (numerator:denominator:_)):_) -> do
n <- parseDecimal False numerator
d <- parseDecimal False denominator
divide n d
_ -> Nothing
}
| 348
|
ruleFractions = Rule
{ name = "fractional number"
, pattern = [regex "(\\d+)/(\\d+)"]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (numerator:denominator:_)):_) -> do
n <- parseDecimal False numerator
d <- parseDecimal False denominator
divide n d
_ -> Nothing
}
| 326
| false
| true
| 0
| 19
| 90
| 129
| 63
| 66
| null | null |
NicolasT/kontiki
|
src/Network/Kontiki/Raft/Candidate.hs
|
bsd-3-clause
|
handle :: (Functor m, Monad m, MonadLog m a)
=> Handler a Candidate m
handle = handleGeneric
handleRequestVote
handleRequestVoteResponse
handleAppendEntries
handleAppendEntriesResponse
handleElectionTimeout
handleHeartbeatTimeout
| 308
|
handle :: (Functor m, Monad m, MonadLog m a)
=> Handler a Candidate m
handle = handleGeneric
handleRequestVote
handleRequestVoteResponse
handleAppendEntries
handleAppendEntriesResponse
handleElectionTimeout
handleHeartbeatTimeout
| 308
|
handle = handleGeneric
handleRequestVote
handleRequestVoteResponse
handleAppendEntries
handleAppendEntriesResponse
handleElectionTimeout
handleHeartbeatTimeout
| 231
| false
| true
| 0
| 6
| 101
| 65
| 28
| 37
| null | null |
keera-studios/hsQt
|
Qtc/Enums/Gui/QTextDocument.hs
|
bsd-2-clause
|
fFindCaseSensitively :: FindFlags
fFindCaseSensitively
= ifFindFlags $ 2
| 74
|
fFindCaseSensitively :: FindFlags
fFindCaseSensitively
= ifFindFlags $ 2
| 74
|
fFindCaseSensitively
= ifFindFlags $ 2
| 40
| false
| true
| 0
| 6
| 9
| 18
| 8
| 10
| null | null |
brendanhay/gogol
|
gogol-run/gen/Network/Google/Run/Types/Product.hs
|
mpl-2.0
|
-- | (Optional) The UID to run the entrypoint of the container process.
-- Defaults to user specified in image metadata if unspecified. May also be
-- set in PodSecurityContext. If set in both SecurityContext and
-- PodSecurityContext, the value specified in SecurityContext takes
-- precedence.
scRunAsUser :: Lens' SecurityContext (Maybe Int32)
scRunAsUser
= lens _scRunAsUser (\ s a -> s{_scRunAsUser = a}) .
mapping _Coerce
| 435
|
scRunAsUser :: Lens' SecurityContext (Maybe Int32)
scRunAsUser
= lens _scRunAsUser (\ s a -> s{_scRunAsUser = a}) .
mapping _Coerce
| 139
|
scRunAsUser
= lens _scRunAsUser (\ s a -> s{_scRunAsUser = a}) .
mapping _Coerce
| 88
| true
| true
| 0
| 10
| 73
| 59
| 32
| 27
| null | null |
fibsifan/pandoc
|
src/Text/Pandoc/Readers/Org.hs
|
gpl-2.0
|
rowsToTable :: [OrgTableRow]
-> F OrgTable
rowsToTable = foldM (flip rowToContent) zeroTable
where zeroTable = OrgTable 0 mempty mempty mempty
| 156
|
rowsToTable :: [OrgTableRow]
-> F OrgTable
rowsToTable = foldM (flip rowToContent) zeroTable
where zeroTable = OrgTable 0 mempty mempty mempty
| 156
|
rowsToTable = foldM (flip rowToContent) zeroTable
where zeroTable = OrgTable 0 mempty mempty mempty
| 101
| false
| true
| 1
| 7
| 33
| 58
| 25
| 33
| null | null |
chreekat/snowdrift
|
Model/Project.hs
|
agpl-3.0
|
fetchProjectCommentRethreadEventsBeforeDB
:: ProjectId
-> Maybe UserId
-> UTCTime
-> Int64
-> DB [(EventCommentRethreadedId, Entity Rethread)]
fetchProjectCommentRethreadEventsBeforeDB project_id muser_id before lim =
fetchProjectDiscussionsDB project_id >>= \project_discussions ->
fmap unwrapValues $
select $
from $ \(ecr `InnerJoin` r `InnerJoin` c) -> do
on_ $ r ^. RethreadNewComment ==. c ^. CommentId
on_ $ ecr ^. EventCommentRethreadedRethread ==. r ^. RethreadId
where_ $ ecr ^. EventCommentRethreadedTs <=. val before
&&. exprCommentProjectPermissionFilter muser_id (val project_id) c
&&. c ^. CommentDiscussion `in_` valList project_discussions
orderBy
[ desc $ ecr ^. EventCommentRethreadedTs
, desc $ ecr ^. EventCommentRethreadedId ]
limit lim
return (ecr ^. EventCommentRethreadedId, r)
-- | Get all Closings for comments on the current project
| 1,001
|
fetchProjectCommentRethreadEventsBeforeDB
:: ProjectId
-> Maybe UserId
-> UTCTime
-> Int64
-> DB [(EventCommentRethreadedId, Entity Rethread)]
fetchProjectCommentRethreadEventsBeforeDB project_id muser_id before lim =
fetchProjectDiscussionsDB project_id >>= \project_discussions ->
fmap unwrapValues $
select $
from $ \(ecr `InnerJoin` r `InnerJoin` c) -> do
on_ $ r ^. RethreadNewComment ==. c ^. CommentId
on_ $ ecr ^. EventCommentRethreadedRethread ==. r ^. RethreadId
where_ $ ecr ^. EventCommentRethreadedTs <=. val before
&&. exprCommentProjectPermissionFilter muser_id (val project_id) c
&&. c ^. CommentDiscussion `in_` valList project_discussions
orderBy
[ desc $ ecr ^. EventCommentRethreadedTs
, desc $ ecr ^. EventCommentRethreadedId ]
limit lim
return (ecr ^. EventCommentRethreadedId, r)
-- | Get all Closings for comments on the current project
| 1,001
|
fetchProjectCommentRethreadEventsBeforeDB project_id muser_id before lim =
fetchProjectDiscussionsDB project_id >>= \project_discussions ->
fmap unwrapValues $
select $
from $ \(ecr `InnerJoin` r `InnerJoin` c) -> do
on_ $ r ^. RethreadNewComment ==. c ^. CommentId
on_ $ ecr ^. EventCommentRethreadedRethread ==. r ^. RethreadId
where_ $ ecr ^. EventCommentRethreadedTs <=. val before
&&. exprCommentProjectPermissionFilter muser_id (val project_id) c
&&. c ^. CommentDiscussion `in_` valList project_discussions
orderBy
[ desc $ ecr ^. EventCommentRethreadedTs
, desc $ ecr ^. EventCommentRethreadedId ]
limit lim
return (ecr ^. EventCommentRethreadedId, r)
-- | Get all Closings for comments on the current project
| 838
| false
| true
| 0
| 18
| 251
| 247
| 122
| 125
| null | null |
taylor1791/adventofcode
|
2015/src/Day21.hs
|
bsd-2-clause
|
losingEquipmentSets :: Player -> Boss -> [Player]
losingEquipmentSets p b = filter (\x -> not $ x `playerWins` b) (equipmentChoices p)
| 134
|
losingEquipmentSets :: Player -> Boss -> [Player]
losingEquipmentSets p b = filter (\x -> not $ x `playerWins` b) (equipmentChoices p)
| 134
|
losingEquipmentSets p b = filter (\x -> not $ x `playerWins` b) (equipmentChoices p)
| 84
| false
| true
| 0
| 9
| 20
| 61
| 31
| 30
| null | null |
marcellussiegburg/autotool
|
package-translator/Print_Packages.hs
|
gpl-2.0
|
info p = ( S $ packageKeyString $ packageKey p
, S $ packageNameString p
)
| 92
|
info p = ( S $ packageKeyString $ packageKey p
, S $ packageNameString p
)
| 92
|
info p = ( S $ packageKeyString $ packageKey p
, S $ packageNameString p
)
| 92
| false
| false
| 0
| 7
| 33
| 33
| 16
| 17
| null | null |
sdiehl/ghc
|
libraries/base/GHC/Event/Internal.hs
|
bsd-3-clause
|
elLifetime :: EventLifetime -> Lifetime
elLifetime (EL x) = if x .&. 8 == 0 then OneShot else MultiShot
| 103
|
elLifetime :: EventLifetime -> Lifetime
elLifetime (EL x) = if x .&. 8 == 0 then OneShot else MultiShot
| 103
|
elLifetime (EL x) = if x .&. 8 == 0 then OneShot else MultiShot
| 63
| false
| true
| 0
| 7
| 18
| 40
| 21
| 19
| null | null |
sol/reserve
|
src/Interpreter.hs
|
mit
|
terminate :: Interpreter -> IO ()
terminate i@(Interpreter p h) = stop i >> hClose h >> waitForProcess p >> return ()
| 117
|
terminate :: Interpreter -> IO ()
terminate i@(Interpreter p h) = stop i >> hClose h >> waitForProcess p >> return ()
| 117
|
terminate i@(Interpreter p h) = stop i >> hClose h >> waitForProcess p >> return ()
| 83
| false
| true
| 0
| 8
| 21
| 60
| 28
| 32
| null | null |
ezyang/ghc
|
compiler/utils/Digraph.hs
|
bsd-3-clause
|
reduceNodesIntoVerticesOrd :: Ord key => ReduceFn key payload
reduceNodesIntoVerticesOrd = reduceNodesIntoVertices Map.fromList Map.lookup
| 138
|
reduceNodesIntoVerticesOrd :: Ord key => ReduceFn key payload
reduceNodesIntoVerticesOrd = reduceNodesIntoVertices Map.fromList Map.lookup
| 138
|
reduceNodesIntoVerticesOrd = reduceNodesIntoVertices Map.fromList Map.lookup
| 76
| false
| true
| 0
| 6
| 12
| 32
| 15
| 17
| null | null |
ChrisCoffey/haskell_sandbox
|
99problems.hs
|
mit
|
forAll f (x:xs) = (f x) && (forAll f xs)
| 40
|
forAll f (x:xs) = (f x) && (forAll f xs)
| 40
|
forAll f (x:xs) = (f x) && (forAll f xs)
| 40
| false
| false
| 0
| 7
| 9
| 38
| 18
| 20
| null | null |
achernyak/stack
|
src/Stack/Options.hs
|
bsd-3-clause
|
readAbstractResolver :: ReadM AbstractResolver
readAbstractResolver = do
s <- readerAsk
case s of
"global" -> return ARGlobal
"nightly" -> return ARLatestNightly
"lts" -> return ARLatestLTS
'l':'t':'s':'-':x | Right (x', "") <- decimal $ T.pack x ->
return $ ARLatestLTSMajor x'
_ ->
case parseResolverText $ T.pack s of
Left e -> readerError $ show e
Right x -> return $ ARResolver x
| 488
|
readAbstractResolver :: ReadM AbstractResolver
readAbstractResolver = do
s <- readerAsk
case s of
"global" -> return ARGlobal
"nightly" -> return ARLatestNightly
"lts" -> return ARLatestLTS
'l':'t':'s':'-':x | Right (x', "") <- decimal $ T.pack x ->
return $ ARLatestLTSMajor x'
_ ->
case parseResolverText $ T.pack s of
Left e -> readerError $ show e
Right x -> return $ ARResolver x
| 488
|
readAbstractResolver = do
s <- readerAsk
case s of
"global" -> return ARGlobal
"nightly" -> return ARLatestNightly
"lts" -> return ARLatestLTS
'l':'t':'s':'-':x | Right (x', "") <- decimal $ T.pack x ->
return $ ARLatestLTSMajor x'
_ ->
case parseResolverText $ T.pack s of
Left e -> readerError $ show e
Right x -> return $ ARResolver x
| 441
| false
| true
| 0
| 16
| 165
| 163
| 75
| 88
| null | null |
mbernat/aoc16-haskell
|
src/Day16.hs
|
bsd-3-clause
|
produce :: BS -> Int -> BS
produce s len = BS.take len $ List.last $ List.unfoldr foo s
where
foo s = if BS.length s >= len then Nothing else Just (s', s')
where
s' = dragon s
| 195
|
produce :: BS -> Int -> BS
produce s len = BS.take len $ List.last $ List.unfoldr foo s
where
foo s = if BS.length s >= len then Nothing else Just (s', s')
where
s' = dragon s
| 195
|
produce s len = BS.take len $ List.last $ List.unfoldr foo s
where
foo s = if BS.length s >= len then Nothing else Just (s', s')
where
s' = dragon s
| 168
| false
| true
| 2
| 8
| 58
| 105
| 47
| 58
| null | null |
phischu/fragnix
|
benchmarks/containers/Data.Map.Strict.hs
|
bsd-3-clause
|
-- | /O(log n)/. Combines insert operation with old value retrieval.
-- The expression (@'insertLookupWithKey' f k x map@)
-- is a pair where the first element is equal to (@'lookup' k map@)
-- and the second element equal to (@'insertWithKey' f k x map@).
--
-- > let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value
-- > insertLookupWithKey f 5 "xxx" (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "5:xxx|a")])
-- > insertLookupWithKey f 7 "xxx" (fromList [(5,"a"), (3,"b")]) == (Nothing, fromList [(3, "b"), (5, "a"), (7, "xxx")])
-- > insertLookupWithKey f 5 "xxx" empty == (Nothing, singleton 5 "xxx")
--
-- This is how to define @insertLookup@ using @insertLookupWithKey@:
--
-- > let insertLookup kx x t = insertLookupWithKey (\_ a _ -> a) kx x t
-- > insertLookup 5 "x" (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "x")])
-- > insertLookup 7 "x" (fromList [(5,"a"), (3,"b")]) == (Nothing, fromList [(3, "b"), (5, "a"), (7, "x")])
-- See Map.Base.Note: Type of local 'go' function
insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a
-> (Maybe a, Map k a)
insertLookupWithKey f0 kx0 x0 t0 = toPair $ go f0 kx0 x0 t0
where
go :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> StrictPair (Maybe a) (Map k a)
go _ arg _ _ | arg `seq` False = undefined
go _ kx x Tip = Nothing :*: singleton kx x
go f kx x (Bin sy ky y l r) =
case compare kx ky of
LT -> let (found :*: l') = go f kx x l
in found :*: balanceL ky y l' r
GT -> let (found :*: r') = go f kx x r
in found :*: balanceR ky y l r'
EQ -> let x' = f kx x y
in x' `seq` (Just y :*: Bin sy kx x' l r)
| 1,821
|
insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a
-> (Maybe a, Map k a)
insertLookupWithKey f0 kx0 x0 t0 = toPair $ go f0 kx0 x0 t0
where
go :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> StrictPair (Maybe a) (Map k a)
go _ arg _ _ | arg `seq` False = undefined
go _ kx x Tip = Nothing :*: singleton kx x
go f kx x (Bin sy ky y l r) =
case compare kx ky of
LT -> let (found :*: l') = go f kx x l
in found :*: balanceL ky y l' r
GT -> let (found :*: r') = go f kx x r
in found :*: balanceR ky y l r'
EQ -> let x' = f kx x y
in x' `seq` (Just y :*: Bin sy kx x' l r)
| 731
|
insertLookupWithKey f0 kx0 x0 t0 = toPair $ go f0 kx0 x0 t0
where
go :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> StrictPair (Maybe a) (Map k a)
go _ arg _ _ | arg `seq` False = undefined
go _ kx x Tip = Nothing :*: singleton kx x
go f kx x (Bin sy ky y l r) =
case compare kx ky of
LT -> let (found :*: l') = go f kx x l
in found :*: balanceL ky y l' r
GT -> let (found :*: r') = go f kx x r
in found :*: balanceR ky y l r'
EQ -> let x' = f kx x y
in x' `seq` (Just y :*: Bin sy kx x' l r)
| 617
| true
| true
| 2
| 13
| 510
| 426
| 207
| 219
| null | null |
spatial-reasoning/zeno
|
src/Helpful/Directory.hs
|
bsd-2-clause
|
createTempDir :: String -> IO FilePath
createTempDir dirName = do
randGen <- newStdGen
sysTmpDir <- getTemporaryDirectory
let tmpDirPrefix = sysTmpDir ++ "/" ++ dirName ++ "_"
tmpDir <- nonExistingDirName tmpDirPrefix
createDirectory tmpDir
return tmpDir
where
nonExistingDirName prefix = do
randint <- randomRIO (1, 9999999 :: Int)
let path = prefix ++ show randint
fileExists <- doesFileExist path
dirExists <- doesDirectoryExist path
if (fileExists || dirExists) then nonExistingDirName prefix
else return path
-- |create a temporary directory, run the action, remove the temporary directory
-- the first argument is a template for the temporary directory name
-- the directory will be created as a subdirectory of the directory returned by getTemporaryDirectory
-- the temporary directory will be automatically removed afterwards.
-- your working directory is not altered
| 954
|
createTempDir :: String -> IO FilePath
createTempDir dirName = do
randGen <- newStdGen
sysTmpDir <- getTemporaryDirectory
let tmpDirPrefix = sysTmpDir ++ "/" ++ dirName ++ "_"
tmpDir <- nonExistingDirName tmpDirPrefix
createDirectory tmpDir
return tmpDir
where
nonExistingDirName prefix = do
randint <- randomRIO (1, 9999999 :: Int)
let path = prefix ++ show randint
fileExists <- doesFileExist path
dirExists <- doesDirectoryExist path
if (fileExists || dirExists) then nonExistingDirName prefix
else return path
-- |create a temporary directory, run the action, remove the temporary directory
-- the first argument is a template for the temporary directory name
-- the directory will be created as a subdirectory of the directory returned by getTemporaryDirectory
-- the temporary directory will be automatically removed afterwards.
-- your working directory is not altered
| 954
|
createTempDir dirName = do
randGen <- newStdGen
sysTmpDir <- getTemporaryDirectory
let tmpDirPrefix = sysTmpDir ++ "/" ++ dirName ++ "_"
tmpDir <- nonExistingDirName tmpDirPrefix
createDirectory tmpDir
return tmpDir
where
nonExistingDirName prefix = do
randint <- randomRIO (1, 9999999 :: Int)
let path = prefix ++ show randint
fileExists <- doesFileExist path
dirExists <- doesDirectoryExist path
if (fileExists || dirExists) then nonExistingDirName prefix
else return path
-- |create a temporary directory, run the action, remove the temporary directory
-- the first argument is a template for the temporary directory name
-- the directory will be created as a subdirectory of the directory returned by getTemporaryDirectory
-- the temporary directory will be automatically removed afterwards.
-- your working directory is not altered
| 915
| false
| true
| 0
| 12
| 204
| 178
| 82
| 96
| null | null |
reinh/http-client-lens
|
src/Network/HTTP/Client/Lens.hs
|
bsd-3-clause
|
_StatusCodeException :: AsHttpException t => Prism' t (H.Status, H.ResponseHeaders, H.CookieJar)
_StatusCodeException = _HttpException . prism' (uncurry3 H.StatusCodeException) go where
go (H.StatusCodeException s rh cj) = Just (s, rh, cj)
go _ = Nothing
| 259
|
_StatusCodeException :: AsHttpException t => Prism' t (H.Status, H.ResponseHeaders, H.CookieJar)
_StatusCodeException = _HttpException . prism' (uncurry3 H.StatusCodeException) go where
go (H.StatusCodeException s rh cj) = Just (s, rh, cj)
go _ = Nothing
| 259
|
_StatusCodeException = _HttpException . prism' (uncurry3 H.StatusCodeException) go where
go (H.StatusCodeException s rh cj) = Just (s, rh, cj)
go _ = Nothing
| 162
| false
| true
| 0
| 9
| 37
| 96
| 50
| 46
| null | null |
wavewave/HROOT
|
HROOT-generate/lib/HROOT/Data/Tree/Class.hs
|
gpl-3.0
|
tBranch :: Class
tBranch =
treeclass "TBranch" [tNamed, tAttFill]
[
]
| 75
|
tBranch :: Class
tBranch =
treeclass "TBranch" [tNamed, tAttFill]
[
]
| 75
|
tBranch =
treeclass "TBranch" [tNamed, tAttFill]
[
]
| 58
| false
| true
| 0
| 6
| 16
| 27
| 14
| 13
| null | null |
verement/etamoo
|
src/MOO/Types.hs
|
bsd-3-clause
|
toText (Err x) = error2text x
| 29
|
toText (Err x) = error2text x
| 29
|
toText (Err x) = error2text x
| 29
| false
| false
| 0
| 7
| 5
| 18
| 8
| 10
| null | null |
sdiehl/ghc
|
testsuite/tests/simplCore/should_run/T13429a.hs
|
bsd-3-clause
|
appendTree3 (Single x) a b c xs =
x <| a <| b <| c <| xs
| 60
|
appendTree3 (Single x) a b c xs =
x <| a <| b <| c <| xs
| 60
|
appendTree3 (Single x) a b c xs =
x <| a <| b <| c <| xs
| 60
| false
| false
| 8
| 6
| 20
| 51
| 23
| 28
| null | null |
mimi1vx/shellcheck
|
ShellCheck/Analytics.hs
|
gpl-3.0
|
prop_checkQuotedCondRegex3 = verifyNot checkQuotedCondRegex "[[ $foo =~ $foo ]]"
| 80
|
prop_checkQuotedCondRegex3 = verifyNot checkQuotedCondRegex "[[ $foo =~ $foo ]]"
| 80
|
prop_checkQuotedCondRegex3 = verifyNot checkQuotedCondRegex "[[ $foo =~ $foo ]]"
| 80
| false
| false
| 1
| 5
| 8
| 14
| 5
| 9
| null | null |
ngeiswei/opencog
|
opencog/nlp/lojban/HaskellLib/src/OpenCog/Lojban/Syntax/Util.hs
|
agpl-3.0
|
gsAtoms :: SynIso () [Atom]
gsAtoms = Iso f g where
f _ = do
as <- getAtoms
setAtoms []
pure as
g a = setAtoms a
| 144
|
gsAtoms :: SynIso () [Atom]
gsAtoms = Iso f g where
f _ = do
as <- getAtoms
setAtoms []
pure as
g a = setAtoms a
| 144
|
gsAtoms = Iso f g where
f _ = do
as <- getAtoms
setAtoms []
pure as
g a = setAtoms a
| 116
| false
| true
| 1
| 8
| 58
| 80
| 32
| 48
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.