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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
danfran/feed | src/Text/Feed/Query.hs | bsd-3-clause | getItemPublishDate :: ParseTime t => ItemGetter (Maybe t)
getItemPublishDate it = do
ds <- getItemPublishDateString it
let
rfc3339DateFormat1 = iso8601DateFormat (Just "%H:%M:%S%Z")
rfc3339DateFormat2 = iso8601DateFormat (Just "%H:%M:%S%Q%Z")
formats = [ rfc3339DateFormat1, rfc3339DateFormat2, rfc822DateFormat ]
date = foldl1 mplus (map (\ fmt -> parseTime defaultTimeLocale fmt ds) formats)
return date
where
#if MIN_VERSION_time(1,5,0)
parseTime = F.parseTimeM True
#else
parseTime = F.parseTime
#endif | 550 | getItemPublishDate :: ParseTime t => ItemGetter (Maybe t)
getItemPublishDate it = do
ds <- getItemPublishDateString it
let
rfc3339DateFormat1 = iso8601DateFormat (Just "%H:%M:%S%Z")
rfc3339DateFormat2 = iso8601DateFormat (Just "%H:%M:%S%Q%Z")
formats = [ rfc3339DateFormat1, rfc3339DateFormat2, rfc822DateFormat ]
date = foldl1 mplus (map (\ fmt -> parseTime defaultTimeLocale fmt ds) formats)
return date
where
#if MIN_VERSION_time(1,5,0)
parseTime = F.parseTimeM True
#else
parseTime = F.parseTime
#endif | 550 | getItemPublishDate it = do
ds <- getItemPublishDateString it
let
rfc3339DateFormat1 = iso8601DateFormat (Just "%H:%M:%S%Z")
rfc3339DateFormat2 = iso8601DateFormat (Just "%H:%M:%S%Q%Z")
formats = [ rfc3339DateFormat1, rfc3339DateFormat2, rfc822DateFormat ]
date = foldl1 mplus (map (\ fmt -> parseTime defaultTimeLocale fmt ds) formats)
return date
where
#if MIN_VERSION_time(1,5,0)
parseTime = F.parseTimeM True
#else
parseTime = F.parseTime
#endif | 492 | false | true | 0 | 15 | 104 | 140 | 69 | 71 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpCanFail IndexOffAddrOp_Int = True | 39 | primOpCanFail IndexOffAddrOp_Int = True | 39 | primOpCanFail IndexOffAddrOp_Int = True | 39 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Heather/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | processInjective :: Archive -> Idris ()
processInjective ar = do
ds <- getEntry [] "ibc_injective" ar
mapM_ (\ (n, a) -> updateIState (\i -> i { tt_ctxt = setInjective n a (tt_ctxt i) })) ds | 198 | processInjective :: Archive -> Idris ()
processInjective ar = do
ds <- getEntry [] "ibc_injective" ar
mapM_ (\ (n, a) -> updateIState (\i -> i { tt_ctxt = setInjective n a (tt_ctxt i) })) ds | 198 | processInjective ar = do
ds <- getEntry [] "ibc_injective" ar
mapM_ (\ (n, a) -> updateIState (\i -> i { tt_ctxt = setInjective n a (tt_ctxt i) })) ds | 158 | false | true | 0 | 17 | 42 | 93 | 47 | 46 | null | null |
oisdk/constrained-monads | bench/MuchAdo.hs | mit | diceVectAdoInitial :: WordOfSize 3 -> [WordOfSize 3] -> Double
diceVectAdoInitial n die' = probOfV n . retractAp @ Initial $ do
a <- die
b <- upTo' a
c <- die
d <- upTo' c
pure (b + d)
where
die = liftAp (uniformV die')
upTo' = liftAp . upToV | 262 | diceVectAdoInitial :: WordOfSize 3 -> [WordOfSize 3] -> Double
diceVectAdoInitial n die' = probOfV n . retractAp @ Initial $ do
a <- die
b <- upTo' a
c <- die
d <- upTo' c
pure (b + d)
where
die = liftAp (uniformV die')
upTo' = liftAp . upToV | 262 | diceVectAdoInitial n die' = probOfV n . retractAp @ Initial $ do
a <- die
b <- upTo' a
c <- die
d <- upTo' c
pure (b + d)
where
die = liftAp (uniformV die')
upTo' = liftAp . upToV | 199 | false | true | 1 | 10 | 69 | 123 | 56 | 67 | null | null |
gridaphobe/ghc | utils/ghctags/Main.hs | bsd-3-clause | dumpthing :: Bool -> FoundThing -> String
dumpthing showmod (FoundThing modname name loc) =
fullname ++ "\t" ++ filename ++ "\t" ++ (show line)
where line = srcLocLine loc
filename = unpackFS $ srcLocFile loc
fullname = if showmod then moduleNameString modname ++ "." ++ name
else name
-- stuff for dealing with etags output format | 385 | dumpthing :: Bool -> FoundThing -> String
dumpthing showmod (FoundThing modname name loc) =
fullname ++ "\t" ++ filename ++ "\t" ++ (show line)
where line = srcLocLine loc
filename = unpackFS $ srcLocFile loc
fullname = if showmod then moduleNameString modname ++ "." ++ name
else name
-- stuff for dealing with etags output format | 385 | dumpthing showmod (FoundThing modname name loc) =
fullname ++ "\t" ++ filename ++ "\t" ++ (show line)
where line = srcLocLine loc
filename = unpackFS $ srcLocFile loc
fullname = if showmod then moduleNameString modname ++ "." ++ name
else name
-- stuff for dealing with etags output format | 343 | false | true | 2 | 10 | 109 | 106 | 53 | 53 | null | null |
ramin32/ChessEngine | GameSetup.hs | gpl-3.0 | pawnsSetup :: Color -> GameSetup
pawnsSetup color = Map.fromList $
zip (positionsByRank rank) (repeat $ ChessPiece Pawn color)
where
rank = if color == White then 2 else 7 | 252 | pawnsSetup :: Color -> GameSetup
pawnsSetup color = Map.fromList $
zip (positionsByRank rank) (repeat $ ChessPiece Pawn color)
where
rank = if color == White then 2 else 7 | 252 | pawnsSetup color = Map.fromList $
zip (positionsByRank rank) (repeat $ ChessPiece Pawn color)
where
rank = if color == White then 2 else 7 | 219 | false | true | 0 | 9 | 109 | 66 | 34 | 32 | null | null |
plaprade/haskoin | haskoin-node/src/Network/Haskoin/Node/HeaderTree.hs | unlicense | connectHeaders :: MonadIO m
=> NodeBlock
-> [BlockHeader]
-> Timestamp
-> SqlPersistT m (Either String BlockChainAction)
connectHeaders _ [] _ = runExceptT $ throwError "Nothing to connect" | 249 | connectHeaders :: MonadIO m
=> NodeBlock
-> [BlockHeader]
-> Timestamp
-> SqlPersistT m (Either String BlockChainAction)
connectHeaders _ [] _ = runExceptT $ throwError "Nothing to connect" | 249 | connectHeaders _ [] _ = runExceptT $ throwError "Nothing to connect" | 68 | false | true | 2 | 12 | 86 | 67 | 31 | 36 | null | null |
goldfirere/singletons | singletons-th/src/Data/Singletons/TH/Single.hs | bsd-3-clause | isException :: DExp -> Bool
isException (DVarE n) = nameBase n == "sUndefined" | 90 | isException :: DExp -> Bool
isException (DVarE n) = nameBase n == "sUndefined" | 90 | isException (DVarE n) = nameBase n == "sUndefined" | 62 | false | true | 0 | 7 | 24 | 31 | 15 | 16 | null | null |
mgeorgoulopoulos/TetrisHaskellWeekend | Logic.hs | mit | linesToScore 2 = 100 | 20 | linesToScore 2 = 100 | 20 | linesToScore 2 = 100 | 20 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
sgraf812/feed-gipeda | src/FeedGipeda/TaskScheduler.hs | bsd-3-clause | initialSchedulerState :: SchedulerState a
initialSchedulerState =
SchedulerState Map.empty Map.empty Seq.empty | 112 | initialSchedulerState :: SchedulerState a
initialSchedulerState =
SchedulerState Map.empty Map.empty Seq.empty | 112 | initialSchedulerState =
SchedulerState Map.empty Map.empty Seq.empty | 70 | false | true | 0 | 6 | 11 | 27 | 13 | 14 | null | null |
JPMoresmau/leksah | src/IDE/Keymap.hs | gpl-2.0 | stringLiteral = T.pack <$> P.stringLiteral lexer | 48 | stringLiteral = T.pack <$> P.stringLiteral lexer | 48 | stringLiteral = T.pack <$> P.stringLiteral lexer | 48 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
sgillespie/ghc | compiler/typecheck/TcBinds.hs | bsd-3-clause | mk_inf_msg :: Name -> TcType -> TidyEnv -> TcM (TidyEnv, SDoc)
mk_inf_msg poly_name poly_ty tidy_env
= do { (tidy_env1, poly_ty) <- zonkTidyTcType tidy_env poly_ty
; let msg = vcat [ text "When checking the inferred type"
, nest 2 $ ppr poly_name <+> dcolon <+> ppr poly_ty ]
; return (tidy_env1, msg) } | 339 | mk_inf_msg :: Name -> TcType -> TidyEnv -> TcM (TidyEnv, SDoc)
mk_inf_msg poly_name poly_ty tidy_env
= do { (tidy_env1, poly_ty) <- zonkTidyTcType tidy_env poly_ty
; let msg = vcat [ text "When checking the inferred type"
, nest 2 $ ppr poly_name <+> dcolon <+> ppr poly_ty ]
; return (tidy_env1, msg) } | 339 | mk_inf_msg poly_name poly_ty tidy_env
= do { (tidy_env1, poly_ty) <- zonkTidyTcType tidy_env poly_ty
; let msg = vcat [ text "When checking the inferred type"
, nest 2 $ ppr poly_name <+> dcolon <+> ppr poly_ty ]
; return (tidy_env1, msg) } | 276 | false | true | 0 | 16 | 88 | 120 | 59 | 61 | null | null |
achirkin/BuildWrapper | src/Language/Haskell/BuildWrapper/Base.hs | bsd-3-clause | -- | get files to load
getLoadFiles :: LoadContents -> [(FilePath,String)]
getLoadFiles SingleFile{lmFile=f,lmModule=m}=[(f,m)] | 129 | getLoadFiles :: LoadContents -> [(FilePath,String)]
getLoadFiles SingleFile{lmFile=f,lmModule=m}=[(f,m)] | 104 | getLoadFiles SingleFile{lmFile=f,lmModule=m}=[(f,m)] | 52 | true | true | 4 | 9 | 14 | 60 | 32 | 28 | null | null |
dongarerahul/edx-haskell | chapter-8-hw.hs | apache-2.0 | foldLeftM f a (x: xs) = do z <- f a x
foldLeftM f z xs | 81 | foldLeftM f a (x: xs) = do z <- f a x
foldLeftM f z xs | 81 | foldLeftM f a (x: xs) = do z <- f a x
foldLeftM f z xs | 81 | false | false | 0 | 8 | 42 | 45 | 19 | 26 | null | null |
tolysz/prepare-ghcjs | spec-lts8/aeson/tests/Encoders.hs | bsd-3-clause | gApproxToEncodingDefault :: Approx String -> Encoding
gApproxToEncodingDefault = genericToEncoding defaultOptions | 113 | gApproxToEncodingDefault :: Approx String -> Encoding
gApproxToEncodingDefault = genericToEncoding defaultOptions | 113 | gApproxToEncodingDefault = genericToEncoding defaultOptions | 59 | false | true | 0 | 6 | 9 | 21 | 10 | 11 | null | null |
MoixaEnergy/blaze-react | src/Text/Blaze/Event.hs | mit | -- | A version of 'onFocus' which allows I/O to be performed in the callback.
onFocusM :: IO act -> Attribute act
onFocusM = onEvent . OnFocus | 142 | onFocusM :: IO act -> Attribute act
onFocusM = onEvent . OnFocus | 64 | onFocusM = onEvent . OnFocus | 28 | true | true | 0 | 6 | 26 | 26 | 13 | 13 | null | null |
friedbrice/Haskell | fibs/fibs.hs | gpl-2.0 | listFib1 :: [Integer]
listFib1 = map fib1 [0..] | 47 | listFib1 :: [Integer]
listFib1 = map fib1 [0..] | 47 | listFib1 = map fib1 [0..] | 25 | false | true | 0 | 7 | 7 | 29 | 13 | 16 | null | null |
alexander-at-github/eta | compiler/ETA/TypeCheck/TcType.hs | bsd-3-clause | mkTcReprEqPred :: TcType -> TcType -> Type
mkTcReprEqPred ty1 ty2
= mkTyConApp coercibleTyCon [k, ty1, ty2]
where
k = typeKind ty1
-- | Make an equality predicate at a given role. The role must not be Phantom. | 218 | mkTcReprEqPred :: TcType -> TcType -> Type
mkTcReprEqPred ty1 ty2
= mkTyConApp coercibleTyCon [k, ty1, ty2]
where
k = typeKind ty1
-- | Make an equality predicate at a given role. The role must not be Phantom. | 218 | mkTcReprEqPred ty1 ty2
= mkTyConApp coercibleTyCon [k, ty1, ty2]
where
k = typeKind ty1
-- | Make an equality predicate at a given role. The role must not be Phantom. | 175 | false | true | 1 | 6 | 45 | 53 | 26 | 27 | null | null |
y-kamiya/functional-algorithm-design | src/Countdown/Countdown2.hs | mit | applySnd :: (b -> c) -> (a, b) -> (a, c)
applySnd f (x,y) = (x, f y) | 68 | applySnd :: (b -> c) -> (a, b) -> (a, c)
applySnd f (x,y) = (x, f y) | 68 | applySnd f (x,y) = (x, f y) | 27 | false | true | 0 | 7 | 17 | 58 | 33 | 25 | null | null |
Javran/Project-Euler | src/ProjectEuler/Problem59.hs | mit | guessKey :: [(Word8, Int)] -> Word8
-- hmm... the most frequent letter might be spaces
guessKey = (`xor` fromIntegral (ord ' ')) . fst . head | 142 | guessKey :: [(Word8, Int)] -> Word8
guessKey = (`xor` fromIntegral (ord ' ')) . fst . head | 91 | guessKey = (`xor` fromIntegral (ord ' ')) . fst . head | 55 | true | true | 0 | 10 | 26 | 48 | 28 | 20 | null | null |
urbanslug/ghc | testsuite/tests/typecheck/should_compile/TcStaticPointers02.hs | bsd-3-clause | g :: Int -> Int
g = id | 22 | g :: Int -> Int
g = id | 22 | g = id | 6 | false | true | 0 | 7 | 7 | 22 | 9 | 13 | null | null |
MaxGabriel/yesod | yesod-core/Yesod/Core/Class/Yesod.hs | mit | defaultErrorHandler :: Yesod site => ErrorResponse -> HandlerT site IO TypedContent
defaultErrorHandler NotFound = selectRep $ do
provideRep $ defaultLayout $ do
r <- waiRequest
let path' = TE.decodeUtf8With TEE.lenientDecode $ W.rawPathInfo r
setTitle "Not Found"
toWidget [hamlet|
<h1>Not Found
<p>#{path'}
|]
provideRep $ return $ object ["message" .= ("Not Found" :: Text)]
-- For API requests.
-- For a user with a browser,
-- if you specify an authRoute the user will be redirected there and
-- this page will not be shown. | 602 | defaultErrorHandler :: Yesod site => ErrorResponse -> HandlerT site IO TypedContent
defaultErrorHandler NotFound = selectRep $ do
provideRep $ defaultLayout $ do
r <- waiRequest
let path' = TE.decodeUtf8With TEE.lenientDecode $ W.rawPathInfo r
setTitle "Not Found"
toWidget [hamlet|
<h1>Not Found
<p>#{path'}
|]
provideRep $ return $ object ["message" .= ("Not Found" :: Text)]
-- For API requests.
-- For a user with a browser,
-- if you specify an authRoute the user will be redirected there and
-- this page will not be shown. | 602 | defaultErrorHandler NotFound = selectRep $ do
provideRep $ defaultLayout $ do
r <- waiRequest
let path' = TE.decodeUtf8With TEE.lenientDecode $ W.rawPathInfo r
setTitle "Not Found"
toWidget [hamlet|
<h1>Not Found
<p>#{path'}
|]
provideRep $ return $ object ["message" .= ("Not Found" :: Text)]
-- For API requests.
-- For a user with a browser,
-- if you specify an authRoute the user will be redirected there and
-- this page will not be shown. | 518 | false | true | 0 | 17 | 156 | 131 | 63 | 68 | null | null |
fmapfmapfmap/amazonka | amazonka-swf/gen/Network/AWS/SWF/GetWorkflowExecutionHistory.hs | mpl-2.0 | -- | Creates a value of 'GetWorkflowExecutionHistory' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gwehNextPageToken'
--
-- * 'gwehReverseOrder'
--
-- * 'gwehMaximumPageSize'
--
-- * 'gwehDomain'
--
-- * 'gwehExecution'
getWorkflowExecutionHistory
:: Text -- ^ 'gwehDomain'
-> WorkflowExecution -- ^ 'gwehExecution'
-> GetWorkflowExecutionHistory
getWorkflowExecutionHistory pDomain_ pExecution_ =
GetWorkflowExecutionHistory'
{ _gwehNextPageToken = Nothing
, _gwehReverseOrder = Nothing
, _gwehMaximumPageSize = Nothing
, _gwehDomain = pDomain_
, _gwehExecution = pExecution_
} | 707 | getWorkflowExecutionHistory
:: Text -- ^ 'gwehDomain'
-> WorkflowExecution -- ^ 'gwehExecution'
-> GetWorkflowExecutionHistory
getWorkflowExecutionHistory pDomain_ pExecution_ =
GetWorkflowExecutionHistory'
{ _gwehNextPageToken = Nothing
, _gwehReverseOrder = Nothing
, _gwehMaximumPageSize = Nothing
, _gwehDomain = pDomain_
, _gwehExecution = pExecution_
} | 398 | getWorkflowExecutionHistory pDomain_ pExecution_ =
GetWorkflowExecutionHistory'
{ _gwehNextPageToken = Nothing
, _gwehReverseOrder = Nothing
, _gwehMaximumPageSize = Nothing
, _gwehDomain = pDomain_
, _gwehExecution = pExecution_
} | 259 | true | true | 0 | 8 | 128 | 80 | 50 | 30 | null | null |
tolysz/prepare-ghcjs | spec-lts8/cabal/Cabal/Distribution/Simple/BuildTarget.hs | bsd-3-clause | -- | Combine two matchers. This is similar to 'ambiguousWith' with the
-- difference that an exact match from the left matcher shadows any exact
-- match on the right. Inexact matches are still collected however.
--
matchPlusShadowing :: Match a -> Match a -> Match a
matchPlusShadowing a@(ExactMatch _ _) (ExactMatch _ _) = a | 326 | matchPlusShadowing :: Match a -> Match a -> Match a
matchPlusShadowing a@(ExactMatch _ _) (ExactMatch _ _) = a | 110 | matchPlusShadowing a@(ExactMatch _ _) (ExactMatch _ _) = a | 58 | true | true | 3 | 7 | 55 | 59 | 30 | 29 | null | null |
edsko/hackage-server | Distribution/Server/Packages/Index.hs | bsd-3-clause | utcToUnixTime :: UTCTime -> Int64
utcToUnixTime = truncate . utcTimeToPOSIXSeconds | 82 | utcToUnixTime :: UTCTime -> Int64
utcToUnixTime = truncate . utcTimeToPOSIXSeconds | 82 | utcToUnixTime = truncate . utcTimeToPOSIXSeconds | 48 | false | true | 0 | 5 | 9 | 19 | 10 | 9 | null | null |
tjakway/ghcjvm | compiler/deSugar/TmOracle.hs | bsd-3-clause | extendSubst :: Id -> PmExpr -> TmState -> TmState
extendSubst y e (standby, (unhandled, env))
| isNotPmExprOther simpl_e
= (standby, (unhandled, Map.insert x simpl_e env))
| otherwise = (standby, (True, env))
where
x = idName y
simpl_e = fst $ simplifyPmExpr $ exprDeepLookup env e
-- | Simplify a complex equality. | 332 | extendSubst :: Id -> PmExpr -> TmState -> TmState
extendSubst y e (standby, (unhandled, env))
| isNotPmExprOther simpl_e
= (standby, (unhandled, Map.insert x simpl_e env))
| otherwise = (standby, (True, env))
where
x = idName y
simpl_e = fst $ simplifyPmExpr $ exprDeepLookup env e
-- | Simplify a complex equality. | 332 | extendSubst y e (standby, (unhandled, env))
| isNotPmExprOther simpl_e
= (standby, (unhandled, Map.insert x simpl_e env))
| otherwise = (standby, (True, env))
where
x = idName y
simpl_e = fst $ simplifyPmExpr $ exprDeepLookup env e
-- | Simplify a complex equality. | 282 | false | true | 2 | 9 | 67 | 124 | 65 | 59 | null | null |
jwoudenberg/elm-editor-tools | src/ElmTools/ParseModule.hs | bsd-3-clause | parseString :: FilePath -> String -> Either ParseError [Declaration]
parseString filePath fileContent =
runIndentParser declarations startState filePath fileContent
-- We assume nothing is exported until told otherwise.
where
startState = ParseState (Selected Set.empty) | 282 | parseString :: FilePath -> String -> Either ParseError [Declaration]
parseString filePath fileContent =
runIndentParser declarations startState filePath fileContent
-- We assume nothing is exported until told otherwise.
where
startState = ParseState (Selected Set.empty) | 282 | parseString filePath fileContent =
runIndentParser declarations startState filePath fileContent
-- We assume nothing is exported until told otherwise.
where
startState = ParseState (Selected Set.empty) | 213 | false | true | 0 | 8 | 44 | 61 | 30 | 31 | null | null |
uduki/hsQt | demos/Glome/imageviewer.hs | bsd-2-clause | updateCle (le:cle) (ms:mss)
= do
updateCell le ms
updateCle cle mss | 77 | updateCle (le:cle) (ms:mss)
= do
updateCell le ms
updateCle cle mss | 77 | updateCle (le:cle) (ms:mss)
= do
updateCell le ms
updateCle cle mss | 77 | false | false | 0 | 7 | 20 | 41 | 19 | 22 | null | null |
pocket7878/min-tokenizer | src/NFABuilder.hs | gpl-3.0 | buildNFA' :: R.Reg -> ([N.Rule Int Char], Int) -> ([N.Rule Int Char], Int)
buildNFA' (Left (R.Is a)) (acc, s) = (newRule : acc, (s + 1))
where
newRule = N.Rule (D.State s) (Left (D.Input a)) (D.State (s + 1)) | 217 | buildNFA' :: R.Reg -> ([N.Rule Int Char], Int) -> ([N.Rule Int Char], Int)
buildNFA' (Left (R.Is a)) (acc, s) = (newRule : acc, (s + 1))
where
newRule = N.Rule (D.State s) (Left (D.Input a)) (D.State (s + 1)) | 216 | buildNFA' (Left (R.Is a)) (acc, s) = (newRule : acc, (s + 1))
where
newRule = N.Rule (D.State s) (Left (D.Input a)) (D.State (s + 1)) | 141 | false | true | 0 | 10 | 47 | 149 | 79 | 70 | null | null |
ku-fpg/thrust-gen | examples/IonExamples/Histogram.hs | bsd-3-clause | main :: IO ()
main = toThrust $ do f <- vector int [1..5]
cout f
--empty vector to store histogram counts in
z <- vector int (take 6 $ cycle [0])
a <- countingiterator int 0
res <- upperbound f z a
--actual histogram value
res' <- adjdiff res
cout res'
return f | 483 | main :: IO ()
main = toThrust $ do f <- vector int [1..5]
cout f
--empty vector to store histogram counts in
z <- vector int (take 6 $ cycle [0])
a <- countingiterator int 0
res <- upperbound f z a
--actual histogram value
res' <- adjdiff res
cout res'
return f | 483 | main = toThrust $ do f <- vector int [1..5]
cout f
--empty vector to store histogram counts in
z <- vector int (take 6 $ cycle [0])
a <- countingiterator int 0
res <- upperbound f z a
--actual histogram value
res' <- adjdiff res
cout res'
return f | 469 | false | true | 0 | 13 | 275 | 121 | 54 | 67 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'IntMapS.lookupGT'
ims_lookupGT = IntMapS.lookupGT | 54 | ims_lookupGT = IntMapS.lookupGT | 31 | ims_lookupGT = IntMapS.lookupGT | 31 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
nicklawls/lessons | src/Lessons.hs | bsd-3-clause | extractId _ = "Expansion Object" | 32 | extractId _ = "Expansion Object" | 32 | extractId _ = "Expansion Object" | 32 | false | false | 0 | 4 | 4 | 10 | 4 | 6 | null | null |
pthariensflame/pure-st | Control/Monad/ST/Pure.hs | bsd-3-clause | fixSTT :: (MonadFix m) => (a -> STT s m a) -> STT s m a
fixSTT = mfix | 69 | fixSTT :: (MonadFix m) => (a -> STT s m a) -> STT s m a
fixSTT = mfix | 69 | fixSTT = mfix | 13 | false | true | 0 | 10 | 18 | 51 | 24 | 27 | null | null |
vincenthz/cryptonite | tests/KAT_PBKDF2.hs | bsd-3-clause | vectors_hmac_sha1 :: [ (VectParams, ByteString) ]
vectors_hmac_sha1 =
[
( ("password","salt",2,20)
, "\xea\x6c\x01\x4d\xc7\x2d\x6f\x8c\xcd\x1e\xd9\x2a\xce\x1d\x41\xf0\xd8\xde\x89\x57"
)
, ( ("password","salt",4096,20)
, "\x4b\x00\x79\x01\xb7\x65\x48\x9a\xbe\xad\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1"
)
, ( ("passwordPASSWORDpassword", "saltSALTsaltSALTsaltSALTsaltSALTsalt", 4096, 25)
, "\x3d\x2e\xec\x4f\xe4\x1c\x84\x9b\x80\xc8\xd8\x36\x62\xc0\xe4\x4a\x8b\x29\x1a\x96\x4c\xf2\xf0\x70\x38"
)
, ( ("pass\0word", "sa\0lt", 4096, 16)
, "\x56\xfa\x6a\xa7\x55\x48\x09\x9d\xcc\x37\xd7\xf0\x34\x25\xe0\xc3"
)
] | 705 | vectors_hmac_sha1 :: [ (VectParams, ByteString) ]
vectors_hmac_sha1 =
[
( ("password","salt",2,20)
, "\xea\x6c\x01\x4d\xc7\x2d\x6f\x8c\xcd\x1e\xd9\x2a\xce\x1d\x41\xf0\xd8\xde\x89\x57"
)
, ( ("password","salt",4096,20)
, "\x4b\x00\x79\x01\xb7\x65\x48\x9a\xbe\xad\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1"
)
, ( ("passwordPASSWORDpassword", "saltSALTsaltSALTsaltSALTsaltSALTsalt", 4096, 25)
, "\x3d\x2e\xec\x4f\xe4\x1c\x84\x9b\x80\xc8\xd8\x36\x62\xc0\xe4\x4a\x8b\x29\x1a\x96\x4c\xf2\xf0\x70\x38"
)
, ( ("pass\0word", "sa\0lt", 4096, 16)
, "\x56\xfa\x6a\xa7\x55\x48\x09\x9d\xcc\x37\xd7\xf0\x34\x25\xe0\xc3"
)
] | 705 | vectors_hmac_sha1 =
[
( ("password","salt",2,20)
, "\xea\x6c\x01\x4d\xc7\x2d\x6f\x8c\xcd\x1e\xd9\x2a\xce\x1d\x41\xf0\xd8\xde\x89\x57"
)
, ( ("password","salt",4096,20)
, "\x4b\x00\x79\x01\xb7\x65\x48\x9a\xbe\xad\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1"
)
, ( ("passwordPASSWORDpassword", "saltSALTsaltSALTsaltSALTsaltSALTsalt", 4096, 25)
, "\x3d\x2e\xec\x4f\xe4\x1c\x84\x9b\x80\xc8\xd8\x36\x62\xc0\xe4\x4a\x8b\x29\x1a\x96\x4c\xf2\xf0\x70\x38"
)
, ( ("pass\0word", "sa\0lt", 4096, 16)
, "\x56\xfa\x6a\xa7\x55\x48\x09\x9d\xcc\x37\xd7\xf0\x34\x25\xe0\xc3"
)
] | 655 | false | true | 0 | 7 | 137 | 104 | 68 | 36 | null | null |
ancientlanguage/haskell-analysis | prepare/src/Prepare/Decompose.hs | mit | decomposeChar '\x0137' = "\x006B\x0327" | 39 | decomposeChar '\x0137' = "\x006B\x0327" | 39 | decomposeChar '\x0137' = "\x006B\x0327" | 39 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2017/M11/D15/Exercise.hs | mit | articleSet :: FilePath
articleSet = "Y2017/M11/D15/edweek.csv" | 62 | articleSet :: FilePath
articleSet = "Y2017/M11/D15/edweek.csv" | 62 | articleSet = "Y2017/M11/D15/edweek.csv" | 39 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
idf/haskell-examples | fundamentals/4_higher_order_funcs.hs | bsd-3-clause | map' f (x:xs) = f x : map' f xs | 31 | map' f (x:xs) = f x : map' f xs | 31 | map' f (x:xs) = f x : map' f xs | 31 | false | false | 0 | 6 | 9 | 32 | 14 | 18 | null | null |
rvl/hsoz | example/HawkClient.hs | bsd-3-clause | uri = "http://localhost:8000/resource/1?b=1&a=2" | 48 | uri = "http://localhost:8000/resource/1?b=1&a=2" | 48 | uri = "http://localhost:8000/resource/1?b=1&a=2" | 48 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
literate-unitb/literate-unitb | src/Document/Tests/Suite.hs | mit | verifyFilesWith :: State Sequent a
-> NonEmpty FilePath
-> Int
-> IO POResult
verifyFilesWith opt = verifyFilesOnlyWith opt (const True) | 185 | verifyFilesWith :: State Sequent a
-> NonEmpty FilePath
-> Int
-> IO POResult
verifyFilesWith opt = verifyFilesOnlyWith opt (const True) | 185 | verifyFilesWith opt = verifyFilesOnlyWith opt (const True) | 58 | false | true | 0 | 8 | 68 | 48 | 22 | 26 | null | null |
aelve/guide | back/src/Guide/Types/Edit.hs | bsd-3-clause | isVacuousEdit EditSetCategoryGroup {..} =
editCategoryGroup == editCategoryNewGroup | 85 | isVacuousEdit EditSetCategoryGroup {..} =
editCategoryGroup == editCategoryNewGroup | 85 | isVacuousEdit EditSetCategoryGroup {..} =
editCategoryGroup == editCategoryNewGroup | 85 | false | false | 0 | 7 | 8 | 19 | 9 | 10 | null | null |
AlexanderPankiv/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | pprPatSkolInfo :: ConLike -> SDoc
pprPatSkolInfo (RealDataCon dc)
= sep [ ptext (sLit "a pattern with constructor:")
, nest 2 $ ppr dc <+> dcolon
<+> pprType (dataConUserType dc) <> comma ] | 209 | pprPatSkolInfo :: ConLike -> SDoc
pprPatSkolInfo (RealDataCon dc)
= sep [ ptext (sLit "a pattern with constructor:")
, nest 2 $ ppr dc <+> dcolon
<+> pprType (dataConUserType dc) <> comma ] | 209 | pprPatSkolInfo (RealDataCon dc)
= sep [ ptext (sLit "a pattern with constructor:")
, nest 2 $ ppr dc <+> dcolon
<+> pprType (dataConUserType dc) <> comma ] | 175 | false | true | 0 | 11 | 51 | 73 | 35 | 38 | null | null |
gibiansky/IHaskell | src/IHaskell/Eval/Hoogle.hs | mit | search :: String -> IO [HoogleResult]
search string = either ((:[]) . NoResult) parseResponse <$> query string | 110 | search :: String -> IO [HoogleResult]
search string = either ((:[]) . NoResult) parseResponse <$> query string | 110 | search string = either ((:[]) . NoResult) parseResponse <$> query string | 72 | false | true | 0 | 10 | 16 | 49 | 25 | 24 | null | null |
qpliu/esolang | 01_/hs/interp/Tokenizer.hs | gpl-3.0 | tokenize ('\n':cs) = tokenize cs | 32 | tokenize ('\n':cs) = tokenize cs | 32 | tokenize ('\n':cs) = tokenize cs | 32 | false | false | 0 | 6 | 4 | 20 | 9 | 11 | null | null |
hvr/unordered-containers | tests/HashMapProperties.hs | bsd-3-clause | Foldable :: [(Int, Int)] -> Bool
pFoldable = (L.sort . Foldable.foldr (:) []) `eq`
(L.sort . Foldable.foldr (:) [])
| 128 | pFoldable :: [(Int, Int)] -> Bool
pFoldable = (L.sort . Foldable.foldr (:) []) `eq`
(L.sort . Foldable.foldr (:) []) | 128 | pFoldable = (L.sort . Foldable.foldr (:) []) `eq`
(L.sort . Foldable.foldr (:) []) | 94 | false | true | 0 | 9 | 31 | 73 | 40 | 33 | null | null |
jdreaver/eventful | eventful-core/src/Eventful/Projection.hs | mit | -- | Transform a 'Projection' when you only have a partial relationship between
-- the source event type and the target event type.
projectionMapMaybe
:: (eventB -> Maybe eventA)
-> Projection state eventA
-> Projection state eventB
projectionMapMaybe f (Projection seed handler) = Projection seed handler'
where
handler' state = maybe state (handler state) . f | 373 | projectionMapMaybe
:: (eventB -> Maybe eventA)
-> Projection state eventA
-> Projection state eventB
projectionMapMaybe f (Projection seed handler) = Projection seed handler'
where
handler' state = maybe state (handler state) . f | 241 | projectionMapMaybe f (Projection seed handler) = Projection seed handler'
where
handler' state = maybe state (handler state) . f | 134 | true | true | 0 | 10 | 67 | 90 | 42 | 48 | null | null |
tamarin-prover/tamarin-prover | lib/term/src/Term/Builtin/Convenience.hs | gpl-3.0 | pubVar :: String -> Integer -> LNTerm
pubVar s i = varTerm $ LVar s LSortPub i | 78 | pubVar :: String -> Integer -> LNTerm
pubVar s i = varTerm $ LVar s LSortPub i | 78 | pubVar s i = varTerm $ LVar s LSortPub i | 40 | false | true | 0 | 6 | 16 | 39 | 18 | 21 | null | null |
junnf/Functional-Programming | codes/csvparse.hs | unlicense | splitSemicolon = splitstr ';' | 29 | splitSemicolon = splitstr ';' | 29 | splitSemicolon = splitstr ';' | 29 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
deyaaeldeen/nAnnotizer | Dynamizer/Lattice.hs | gpl-3.0 | genLatticeInfo :: forall f a. Bifoldable f
=> ProgramF (Ann a (f (Ann a Type)))
-> ([Ann (a, Sum Int) Type], Int)
genLatticeInfo = (DL.toList *** getSum) . foldMap localLattice
where
localLattice :: Ann a (f (Ann a Type)) -> (DL.DList (Ann (a, Sum Int) Type), Sum Int)
localLattice (Ann _ e) = bifoldMap ((pure &&& getSnd) . annotateTypeWithCount) localLattice e | 402 | genLatticeInfo :: forall f a. Bifoldable f
=> ProgramF (Ann a (f (Ann a Type)))
-> ([Ann (a, Sum Int) Type], Int)
genLatticeInfo = (DL.toList *** getSum) . foldMap localLattice
where
localLattice :: Ann a (f (Ann a Type)) -> (DL.DList (Ann (a, Sum Int) Type), Sum Int)
localLattice (Ann _ e) = bifoldMap ((pure &&& getSnd) . annotateTypeWithCount) localLattice e | 402 | genLatticeInfo = (DL.toList *** getSum) . foldMap localLattice
where
localLattice :: Ann a (f (Ann a Type)) -> (DL.DList (Ann (a, Sum Int) Type), Sum Int)
localLattice (Ann _ e) = bifoldMap ((pure &&& getSnd) . annotateTypeWithCount) localLattice e | 258 | false | true | 4 | 14 | 100 | 188 | 98 | 90 | null | null |
fizzoo/launchpad-alsa | src/System/MIDI/LaunchpadALSA/Extra.hs | mit | -- | A nice circular pattern.
nicePattern :: [Event.Data]
nicePattern = map (\(c, (x, y)) -> makeData c (grid x y)) nicepatternx4
where
nicepatternx4 = nicepatternx2 ++ map (\(c, (x, y)) -> (c, (7-x, y))) nicepatternx2
nicepatternx2 = nicepatternx1 ++ map (\(c, (x, y)) -> (c, (7-x, 7-y))) nicepatternx1
nicepatternx1 = zip allColors [(x, y) | x <- [0..3], y <- [0..3]]
-- | 'App' that draws colors from the centre of the grid. | 442 | nicePattern :: [Event.Data]
nicePattern = map (\(c, (x, y)) -> makeData c (grid x y)) nicepatternx4
where
nicepatternx4 = nicepatternx2 ++ map (\(c, (x, y)) -> (c, (7-x, y))) nicepatternx2
nicepatternx2 = nicepatternx1 ++ map (\(c, (x, y)) -> (c, (7-x, 7-y))) nicepatternx1
nicepatternx1 = zip allColors [(x, y) | x <- [0..3], y <- [0..3]]
-- | 'App' that draws colors from the centre of the grid. | 412 | nicePattern = map (\(c, (x, y)) -> makeData c (grid x y)) nicepatternx4
where
nicepatternx4 = nicepatternx2 ++ map (\(c, (x, y)) -> (c, (7-x, y))) nicepatternx2
nicepatternx2 = nicepatternx1 ++ map (\(c, (x, y)) -> (c, (7-x, 7-y))) nicepatternx1
nicepatternx1 = zip allColors [(x, y) | x <- [0..3], y <- [0..3]]
-- | 'App' that draws colors from the centre of the grid. | 384 | true | true | 2 | 12 | 88 | 209 | 120 | 89 | null | null |
shlevy/ghc | libraries/base/GHC/Conc/Sync.hs | bsd-3-clause | withMVar :: MVar a -> (a -> IO b) -> IO b
withMVar m io =
mask $ \restore -> do
a <- takeMVar m
b <- catchAny (restore (io a))
(\e -> do putMVar m a; throw e)
putMVar m a
return b
-- | Modify the value of an 'MVar'. | 246 | withMVar :: MVar a -> (a -> IO b) -> IO b
withMVar m io =
mask $ \restore -> do
a <- takeMVar m
b <- catchAny (restore (io a))
(\e -> do putMVar m a; throw e)
putMVar m a
return b
-- | Modify the value of an 'MVar'. | 246 | withMVar m io =
mask $ \restore -> do
a <- takeMVar m
b <- catchAny (restore (io a))
(\e -> do putMVar m a; throw e)
putMVar m a
return b
-- | Modify the value of an 'MVar'. | 204 | false | true | 2 | 15 | 82 | 127 | 57 | 70 | null | null |
ezyang/ghc | testsuite/tests/driver/linkwhole/Main.hs | bsd-3-clause | rotateSO
:: (FunPtr (IO (StablePtr a)) -> (IO (StablePtr a)))
-> String
-> (Maybe FilePath, FilePath)
-> IO a
rotateSO dynamicCall symName (old, newDLL) = do
-- initObjLinker is idempotent
initObjLinker DontRetainCAFs
loadObj newDLL
resolved <- resolveObjs
unless resolved $
throwIO (ErrorCall $ "Unable to resolve objects for " ++ newDLL)
c_sym <- lookupSymbol symName
h <- case c_sym of
Nothing -> throwIO (ErrorCall "Could not find symbol")
Just p_sym ->
bracket (dynamicCall $ castPtrToFunPtr p_sym) freeStablePtr deRefStablePtr
purgeObj newDLL
forM_ old unloadObj
return h | 624 | rotateSO
:: (FunPtr (IO (StablePtr a)) -> (IO (StablePtr a)))
-> String
-> (Maybe FilePath, FilePath)
-> IO a
rotateSO dynamicCall symName (old, newDLL) = do
-- initObjLinker is idempotent
initObjLinker DontRetainCAFs
loadObj newDLL
resolved <- resolveObjs
unless resolved $
throwIO (ErrorCall $ "Unable to resolve objects for " ++ newDLL)
c_sym <- lookupSymbol symName
h <- case c_sym of
Nothing -> throwIO (ErrorCall "Could not find symbol")
Just p_sym ->
bracket (dynamicCall $ castPtrToFunPtr p_sym) freeStablePtr deRefStablePtr
purgeObj newDLL
forM_ old unloadObj
return h | 624 | rotateSO dynamicCall symName (old, newDLL) = do
-- initObjLinker is idempotent
initObjLinker DontRetainCAFs
loadObj newDLL
resolved <- resolveObjs
unless resolved $
throwIO (ErrorCall $ "Unable to resolve objects for " ++ newDLL)
c_sym <- lookupSymbol symName
h <- case c_sym of
Nothing -> throwIO (ErrorCall "Could not find symbol")
Just p_sym ->
bracket (dynamicCall $ castPtrToFunPtr p_sym) freeStablePtr deRefStablePtr
purgeObj newDLL
forM_ old unloadObj
return h | 506 | false | true | 0 | 15 | 131 | 213 | 97 | 116 | null | null |
josefs/sbv | Data/SBV/Control/Query.hs | bsd-3-clause | -- Remove a pair of surrounding bars
unBar :: String -> String
unBar = noSurrounding '|' | 88 | unBar :: String -> String
unBar = noSurrounding '|' | 51 | unBar = noSurrounding '|' | 25 | true | true | 0 | 5 | 15 | 19 | 10 | 9 | null | null |
Peaker/cabal | cabal-install/Distribution/Client/Dependency/Modular/Package.hs | bsd-3-clause | showPP (Setup pn pp) = display pn ++ "-setup" ++ "." ++ showPP pp | 70 | showPP (Setup pn pp) = display pn ++ "-setup" ++ "." ++ showPP pp | 70 | showPP (Setup pn pp) = display pn ++ "-setup" ++ "." ++ showPP pp | 70 | false | false | 0 | 8 | 18 | 35 | 16 | 19 | null | null |
osa1/sequent-core | src/Language/SequentCore/OccurAnal.hs | bsd-3-clause | -- For value lambdas we do a special hack. Consider
-- (\x. \y. ...x...)
-- If we did nothing, x is used inside the \y, so would be marked
-- as dangerous to dup. But in the common case where the abstraction
-- is applied to two arguments this is over-pessimistic.
-- So instead, we just mark each binder with its occurrence
-- info in the *body* of the multiple lambda.
-- Then, the simplifier is careful when partially applying lambdas.
occAnalTerm env expr@(Lam _ _)
= case occAnalTerm env_body body of { ( body_usage, body' ) ->
let
(final_usage, tagged_binders) = tagLamBinders body_usage binders'
-- Use binders' to put one-shot info on the lambdas
really_final_usage
| all isOneShotBndr binders' = final_usage
| otherwise = mapVarEnv markInsideLam final_usage
in
(really_final_usage, mkLambdas tagged_binders body') }
where
(binders, body) = lambdas expr
(env_body, binders') = oneShotGroup env binders | 1,005 | occAnalTerm env expr@(Lam _ _)
= case occAnalTerm env_body body of { ( body_usage, body' ) ->
let
(final_usage, tagged_binders) = tagLamBinders body_usage binders'
-- Use binders' to put one-shot info on the lambdas
really_final_usage
| all isOneShotBndr binders' = final_usage
| otherwise = mapVarEnv markInsideLam final_usage
in
(really_final_usage, mkLambdas tagged_binders body') }
where
(binders, body) = lambdas expr
(env_body, binders') = oneShotGroup env binders | 558 | occAnalTerm env expr@(Lam _ _)
= case occAnalTerm env_body body of { ( body_usage, body' ) ->
let
(final_usage, tagged_binders) = tagLamBinders body_usage binders'
-- Use binders' to put one-shot info on the lambdas
really_final_usage
| all isOneShotBndr binders' = final_usage
| otherwise = mapVarEnv markInsideLam final_usage
in
(really_final_usage, mkLambdas tagged_binders body') }
where
(binders, body) = lambdas expr
(env_body, binders') = oneShotGroup env binders | 558 | true | false | 0 | 15 | 241 | 153 | 81 | 72 | null | null |
raichoo/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | ibc i (IBCInstance int res n ins) f
= return f { ibc_instances = (int, res, n, ins) : ibc_instances f } | 122 | ibc i (IBCInstance int res n ins) f
= return f { ibc_instances = (int, res, n, ins) : ibc_instances f } | 122 | ibc i (IBCInstance int res n ins) f
= return f { ibc_instances = (int, res, n, ins) : ibc_instances f } | 122 | false | false | 1 | 9 | 40 | 60 | 29 | 31 | null | null |
zeyuanxy/haskell-playground | write-yourself-a-scheme/chap7/main.hs | mit | setVar :: Env -> String -> LispVal -> IOThrowsError LispVal
setVar envRef var value = do
env <- liftIO $ readIORef envRef
maybe (throwError $ UnboundVar "Setting an unbound variable" var) (liftIO . (flip writeIORef value)) (lookup var env)
return value | 258 | setVar :: Env -> String -> LispVal -> IOThrowsError LispVal
setVar envRef var value = do
env <- liftIO $ readIORef envRef
maybe (throwError $ UnboundVar "Setting an unbound variable" var) (liftIO . (flip writeIORef value)) (lookup var env)
return value | 258 | setVar envRef var value = do
env <- liftIO $ readIORef envRef
maybe (throwError $ UnboundVar "Setting an unbound variable" var) (liftIO . (flip writeIORef value)) (lookup var env)
return value | 198 | false | true | 0 | 11 | 46 | 98 | 46 | 52 | null | null |
ihc/futhark | src/Futhark/Representation/AST/Attributes.hs | isc | entryPointSize TypeDirect = 1 | 29 | entryPointSize TypeDirect = 1 | 29 | entryPointSize TypeDirect = 1 | 29 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
573/leksah | src/IDE/BufferMode.hs | gpl-2.0 | editFromCandy :: IDEAction
editFromCandy = withCurrentMode () modeEditFromCandy | 79 | editFromCandy :: IDEAction
editFromCandy = withCurrentMode () modeEditFromCandy | 79 | editFromCandy = withCurrentMode () modeEditFromCandy | 52 | false | true | 0 | 6 | 7 | 18 | 9 | 9 | null | null |
jvilar/hrows | lib/GUI/Update.hs | gpl-2.0 | showIteration (AskImportOptions t ifs cfs rst) = dialogCall (askImportOptions t ifs cfs)
(\control (keys, values) -> sendInput control $ case t of
ImportFields -> ImportFieldsFromRowStore rst keys values
ImportRows -> ImportRowsFromRowStore rst values) | 315 | showIteration (AskImportOptions t ifs cfs rst) = dialogCall (askImportOptions t ifs cfs)
(\control (keys, values) -> sendInput control $ case t of
ImportFields -> ImportFieldsFromRowStore rst keys values
ImportRows -> ImportRowsFromRowStore rst values) | 315 | showIteration (AskImportOptions t ifs cfs rst) = dialogCall (askImportOptions t ifs cfs)
(\control (keys, values) -> sendInput control $ case t of
ImportFields -> ImportFieldsFromRowStore rst keys values
ImportRows -> ImportRowsFromRowStore rst values) | 315 | false | false | 0 | 11 | 95 | 89 | 43 | 46 | null | null |
copumpkin/vector-static | Data/Vector/Static.hs | bsd-3-clause | ifoldl' :: (a -> Fin n -> b -> a) -> a -> Vec n b -> a
ifoldl' f z (Vec vs) = G.ifoldl' f z vs | 94 | ifoldl' :: (a -> Fin n -> b -> a) -> a -> Vec n b -> a
ifoldl' f z (Vec vs) = G.ifoldl' f z vs | 94 | ifoldl' f z (Vec vs) = G.ifoldl' f z vs | 39 | false | true | 0 | 9 | 27 | 68 | 33 | 35 | null | null |
hlmerscher/advent-of-code-2015 | src/Day3.hs | bsd-3-clause | charToCoord :: Char -> Coordinate -> Coordinate
charToCoord '^' (x, y) = (x, y + 1) | 83 | charToCoord :: Char -> Coordinate -> Coordinate
charToCoord '^' (x, y) = (x, y + 1) | 83 | charToCoord '^' (x, y) = (x, y + 1) | 35 | false | true | 0 | 6 | 15 | 40 | 22 | 18 | null | null |
Philonous/d-bus | src/DBus/Signal.hs | mit | signalChan :: MatchSignal
-> DBusConnection
-> IO (TChan SomeSignal)
signalChan match dbc = do
sChan <- newTChanIO
addSignalHandler match mempty (atomically . writeTChan sChan) dbc
return sChan | 227 | signalChan :: MatchSignal
-> DBusConnection
-> IO (TChan SomeSignal)
signalChan match dbc = do
sChan <- newTChanIO
addSignalHandler match mempty (atomically . writeTChan sChan) dbc
return sChan | 227 | signalChan match dbc = do
sChan <- newTChanIO
addSignalHandler match mempty (atomically . writeTChan sChan) dbc
return sChan | 136 | false | true | 0 | 10 | 60 | 68 | 31 | 37 | null | null |
dimsuz/nanovg-material | src/Main.hs | bsd-3-clause | leftMousePressPos :: RGLFW.Cursor -> Event MouseEvent -> Event Point
leftMousePressPos c e = mouseEventPos c e isLeftPress | 122 | leftMousePressPos :: RGLFW.Cursor -> Event MouseEvent -> Event Point
leftMousePressPos c e = mouseEventPos c e isLeftPress | 122 | leftMousePressPos c e = mouseEventPos c e isLeftPress | 53 | false | true | 0 | 8 | 16 | 43 | 19 | 24 | null | null |
unisonweb/platform | codebase2/util/U/Util/Relation.hs | mit | (|$>) :: (Ord a, Ord b) => Set a -> Set b -> Relation a b -> Set b
(as |$> bs) r = bs `S.intersection` generarBS as
where generarBS = compactSet . S.map (`lookupDom'` r)
-- | Domain restriction for a relation. Modeled on z. | 228 | (|$>) :: (Ord a, Ord b) => Set a -> Set b -> Relation a b -> Set b
(as |$> bs) r = bs `S.intersection` generarBS as
where generarBS = compactSet . S.map (`lookupDom'` r)
-- | Domain restriction for a relation. Modeled on z. | 228 | (|$>) :: (Ord a, Ord b) => Set a -> Set b -> Relation a b -> Set b
(as |$> bs) r = bs `S.intersection` generarBS as
where generarBS = compactSet . S.map (`lookupDom'` r)
-- | Domain restriction for a relation. Modeled on z. | 228 | false | false | 0 | 12 | 50 | 100 | 52 | 48 | null | null |
ribag/ganeti-experiments | src/Ganeti/Locking/Locks.hs | gpl-2.0 | lockFromName n = fail $ "Unknown lock name '" ++ n ++ "'" | 57 | lockFromName n = fail $ "Unknown lock name '" ++ n ++ "'" | 57 | lockFromName n = fail $ "Unknown lock name '" ++ n ++ "'" | 57 | false | false | 3 | 6 | 12 | 26 | 10 | 16 | null | null |
amccausl/RDF4H | testsuite/tests/Data/RDF/GraphTestUtils.hs | bsd-3-clause | litvalues :: [ByteString]
litvalues = map B.pack ["hello", "world", "peace", "earth", "", "haskell"] | 100 | litvalues :: [ByteString]
litvalues = map B.pack ["hello", "world", "peace", "earth", "", "haskell"] | 100 | litvalues = map B.pack ["hello", "world", "peace", "earth", "", "haskell"] | 74 | false | true | 0 | 7 | 12 | 46 | 24 | 22 | null | null |
prowdsponsor/country-codes | src/Data/CountryCodes/ISO31661.hs | bsd-3-clause | fromMName "Ecuador" = Just EC | 29 | fromMName "Ecuador" = Just EC | 29 | fromMName "Ecuador" = Just EC | 29 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
zepto-lang/zepto-js | src/Zepto/Primitives/ListPrimitives.hs | gpl-2.0 | vectorRef [badType] = throwError $ TypeMismatch "vector integer" badType | 72 | vectorRef [badType] = throwError $ TypeMismatch "vector integer" badType | 72 | vectorRef [badType] = throwError $ TypeMismatch "vector integer" badType | 72 | false | false | 0 | 6 | 8 | 21 | 10 | 11 | null | null |
ganeti/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | confdReplStatuses :: FrozenSet Int
confdReplStatuses =
ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..] | 123 | confdReplStatuses :: FrozenSet Int
confdReplStatuses =
ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..] | 123 | confdReplStatuses =
ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..] | 88 | false | true | 0 | 7 | 12 | 30 | 15 | 15 | null | null |
ancientlanguage/haskell-analysis | grammar/src/Grammar/Common/Decompose.hs | mit | decomposeChar '\x0F93' = "\x0F92\x0FB7" | 39 | decomposeChar '\x0F93' = "\x0F92\x0FB7" | 39 | decomposeChar '\x0F93' = "\x0F92\x0FB7" | 39 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
mgmeier/extra | src/Data/List/Extra.hs | bsd-3-clause | replace from to [] = [] | 23 | replace from to [] = [] | 23 | replace from to [] = [] | 23 | false | false | 1 | 6 | 5 | 23 | 8 | 15 | null | null |
BlackBrane/quantum-random-numbers | src-lib/Quantum/Random/Store.hs | mit | -- | Destructively view the specified number of bytes, via 'extract'.
-- The name connotes the irreversibility of quantum measurement.
-- Measuring quantum data (analogously, viewing or using) expends them as a randomness resource.
-- Thus they are discarded. Use 'peek' if instead you wish the data to be kept.
observe :: Maybe DisplayStyle -> Int -> IO ()
observe ms n = extract n >>= display_ ms | 404 | observe :: Maybe DisplayStyle -> Int -> IO ()
observe ms n = extract n >>= display_ ms | 86 | observe ms n = extract n >>= display_ ms | 40 | true | true | 0 | 9 | 73 | 50 | 24 | 26 | null | null |
ezyang/ghc | libraries/base/GHC/IO/Buffer.hs | bsd-3-clause | newCharBuffer :: Int -> BufferState -> IO CharBuffer
newCharBuffer c st = newBuffer (c * charSize) c st | 103 | newCharBuffer :: Int -> BufferState -> IO CharBuffer
newCharBuffer c st = newBuffer (c * charSize) c st | 103 | newCharBuffer c st = newBuffer (c * charSize) c st | 50 | false | true | 0 | 8 | 17 | 45 | 21 | 24 | null | null |
uwap/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reflectConstant c@(B16 _) = reflCall "B16" [RConstant c] | 56 | reflectConstant c@(B16 _) = reflCall "B16" [RConstant c] | 56 | reflectConstant c@(B16 _) = reflCall "B16" [RConstant c] | 56 | false | false | 1 | 8 | 7 | 33 | 14 | 19 | null | null |
bitrauser/cybnopsis | src/Distill.hs | bsd-3-clause | -- | Filter words which dont enter score calc
wFilter :: Int -> [Text] -> [Text]
wFilter m = filter flt
where
flt w = T.compareLength w m == GT &&
not (T.null w) &&
not (isNum w)
-- | Check if number
-- TODO convert to pure Text function | 258 | wFilter :: Int -> [Text] -> [Text]
wFilter m = filter flt
where
flt w = T.compareLength w m == GT &&
not (T.null w) &&
not (isNum w)
-- | Check if number
-- TODO convert to pure Text function | 212 | wFilter m = filter flt
where
flt w = T.compareLength w m == GT &&
not (T.null w) &&
not (isNum w)
-- | Check if number
-- TODO convert to pure Text function | 177 | true | true | 0 | 10 | 70 | 83 | 42 | 41 | null | null |
rgaiacs/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | parseTableRow :: Int -- ^ number of columns
-> LP [Blocks]
parseTableRow cols = try $ do
let tableCellInline = notFollowedBy (amp <|> lbreak) >> inline
let tableCell = (plain . trimInlines . mconcat) <$> many tableCellInline
cells' <- sepBy1 tableCell amp
let numcells = length cells'
guard $ numcells <= cols && numcells >= 1
guard $ cells' /= [mempty]
-- note: a & b in a three-column table leaves an empty 3rd cell:
let cells'' = cells' ++ replicate (cols - numcells) mempty
spaces
return cells'' | 535 | parseTableRow :: Int -- ^ number of columns
-> LP [Blocks]
parseTableRow cols = try $ do
let tableCellInline = notFollowedBy (amp <|> lbreak) >> inline
let tableCell = (plain . trimInlines . mconcat) <$> many tableCellInline
cells' <- sepBy1 tableCell amp
let numcells = length cells'
guard $ numcells <= cols && numcells >= 1
guard $ cells' /= [mempty]
-- note: a & b in a three-column table leaves an empty 3rd cell:
let cells'' = cells' ++ replicate (cols - numcells) mempty
spaces
return cells'' | 535 | parseTableRow cols = try $ do
let tableCellInline = notFollowedBy (amp <|> lbreak) >> inline
let tableCell = (plain . trimInlines . mconcat) <$> many tableCellInline
cells' <- sepBy1 tableCell amp
let numcells = length cells'
guard $ numcells <= cols && numcells >= 1
guard $ cells' /= [mempty]
-- note: a & b in a three-column table leaves an empty 3rd cell:
let cells'' = cells' ++ replicate (cols - numcells) mempty
spaces
return cells'' | 461 | false | true | 0 | 14 | 123 | 171 | 81 | 90 | null | null |
GaloisInc/saw-script | saw-core/src/Verifier/SAW/Rewriter.hs | bsd-3-clause | addRule :: RewriteRule a -> Simpset a -> Simpset a
addRule rule | lhs rule /= rhs rule = Net.insert_term (lhs rule, Left rule)
| otherwise = id | 156 | addRule :: RewriteRule a -> Simpset a -> Simpset a
addRule rule | lhs rule /= rhs rule = Net.insert_term (lhs rule, Left rule)
| otherwise = id | 156 | addRule rule | lhs rule /= rhs rule = Net.insert_term (lhs rule, Left rule)
| otherwise = id | 105 | false | true | 0 | 9 | 40 | 73 | 32 | 41 | null | null |
paolino/touchnet | Stepping.hs | mit | -- time to listen on a receiving seq
step UnMust (Node
(tailSeq -> hs)
(turn -> ms)
(tailSeq -> ts)
(select (isJust . head . view (transmissions . stream)) -> Just (Neighbor s n, g))
(tailSeq -> ps)
ls
(tailSeq -> ds)
) = ReceiveFree (Free $ fromJust . head . view stream $ s) $ close UnMust . f where
add n' = clean $ Node hs ms ts (tailNeighbors . g $ Neighbor s n') ps ls ds
f Nothing = add $ n + 1 -- missed appointment
f (Just (Info s' (Just m))) = addMessage m . addNeighborOrListener s s' . add $ 0
-- got it , set to trusted
f (Just (Info s' Nothing)) = addNeighborOrListener s s'. add $ 0 -- got it , set to trusted
-- insert a personal message with fresh ttl in the message list and sleep | 965 | step UnMust (Node
(tailSeq -> hs)
(turn -> ms)
(tailSeq -> ts)
(select (isJust . head . view (transmissions . stream)) -> Just (Neighbor s n, g))
(tailSeq -> ps)
ls
(tailSeq -> ds)
) = ReceiveFree (Free $ fromJust . head . view stream $ s) $ close UnMust . f where
add n' = clean $ Node hs ms ts (tailNeighbors . g $ Neighbor s n') ps ls ds
f Nothing = add $ n + 1 -- missed appointment
f (Just (Info s' (Just m))) = addMessage m . addNeighborOrListener s s' . add $ 0
-- got it , set to trusted
f (Just (Info s' Nothing)) = addNeighborOrListener s s'. add $ 0 -- got it , set to trusted
-- insert a personal message with fresh ttl in the message list and sleep | 927 | step UnMust (Node
(tailSeq -> hs)
(turn -> ms)
(tailSeq -> ts)
(select (isJust . head . view (transmissions . stream)) -> Just (Neighbor s n, g))
(tailSeq -> ps)
ls
(tailSeq -> ds)
) = ReceiveFree (Free $ fromJust . head . view stream $ s) $ close UnMust . f where
add n' = clean $ Node hs ms ts (tailNeighbors . g $ Neighbor s n') ps ls ds
f Nothing = add $ n + 1 -- missed appointment
f (Just (Info s' (Just m))) = addMessage m . addNeighborOrListener s s' . add $ 0
-- got it , set to trusted
f (Just (Info s' Nothing)) = addNeighborOrListener s s'. add $ 0 -- got it , set to trusted
-- insert a personal message with fresh ttl in the message list and sleep | 927 | true | false | 0 | 15 | 414 | 294 | 149 | 145 | null | null |
joprice/snippets | haskell/basics.hs | unlicense | -- use file instead of standard out
yell''' file = do
handle <- openFile file ReadMode
contents <- hGetContents handle
putStr $ map toUpper contents
hClose handle
-- simplify using withFile | 199 | yell''' file = do
handle <- openFile file ReadMode
contents <- hGetContents handle
putStr $ map toUpper contents
hClose handle
-- simplify using withFile | 163 | yell''' file = do
handle <- openFile file ReadMode
contents <- hGetContents handle
putStr $ map toUpper contents
hClose handle
-- simplify using withFile | 163 | true | false | 1 | 9 | 40 | 55 | 22 | 33 | null | null |
rsasse/tamarin-prover | src/Web/Theory.hs | gpl-3.0 | htmlSource :: HtmlDocument d
=> RenderUrl -> TheoryIdx -> SourceKind -> (Int, Source) -> d
htmlSource renderUrl tidx kind (j, th) =
if null cases
then withTag "h2" [] ppHeader $-$ withTag "h3" [] (text "No cases.")
else vcat $ withTag "h2" [] ppHeader : cases
where
cases = concatMap ppCase $ zip [1..] $ getDisj $ get cdCases th
wrapP = withTag "p" [("class","monospace cases")]
nCases = int $ length $ getDisj $ get cdCases th
ppPrem = nest 2 $ doubleQuotes $ prettyGoal $ get cdGoal th
ppHeader = hsep
[ text "Sources of" <-> ppPrem
, parens $ nCases <-> text "cases"
]
ppCase (i, (names, se)) =
[ withTag "h3" [] $ fsep [ text "Source", int i, text "of", nCases
, text " / named ", doubleQuotes (text name),
if isPartial then text "(partial deconstructions)" else text "" ]
, refDotPath renderUrl tidx (TheorySource kind j i)
, withTag "p" [] $ ppPrem
, wrapP $ prettyNonGraphSystem se
]
where
name = intercalate "_" names
isPartial = not $ null $ unsolvedChains se
-- | A Html document representing the requires case splitting theorem. | 1,247 | htmlSource :: HtmlDocument d
=> RenderUrl -> TheoryIdx -> SourceKind -> (Int, Source) -> d
htmlSource renderUrl tidx kind (j, th) =
if null cases
then withTag "h2" [] ppHeader $-$ withTag "h3" [] (text "No cases.")
else vcat $ withTag "h2" [] ppHeader : cases
where
cases = concatMap ppCase $ zip [1..] $ getDisj $ get cdCases th
wrapP = withTag "p" [("class","monospace cases")]
nCases = int $ length $ getDisj $ get cdCases th
ppPrem = nest 2 $ doubleQuotes $ prettyGoal $ get cdGoal th
ppHeader = hsep
[ text "Sources of" <-> ppPrem
, parens $ nCases <-> text "cases"
]
ppCase (i, (names, se)) =
[ withTag "h3" [] $ fsep [ text "Source", int i, text "of", nCases
, text " / named ", doubleQuotes (text name),
if isPartial then text "(partial deconstructions)" else text "" ]
, refDotPath renderUrl tidx (TheorySource kind j i)
, withTag "p" [] $ ppPrem
, wrapP $ prettyNonGraphSystem se
]
where
name = intercalate "_" names
isPartial = not $ null $ unsolvedChains se
-- | A Html document representing the requires case splitting theorem. | 1,247 | htmlSource renderUrl tidx kind (j, th) =
if null cases
then withTag "h2" [] ppHeader $-$ withTag "h3" [] (text "No cases.")
else vcat $ withTag "h2" [] ppHeader : cases
where
cases = concatMap ppCase $ zip [1..] $ getDisj $ get cdCases th
wrapP = withTag "p" [("class","monospace cases")]
nCases = int $ length $ getDisj $ get cdCases th
ppPrem = nest 2 $ doubleQuotes $ prettyGoal $ get cdGoal th
ppHeader = hsep
[ text "Sources of" <-> ppPrem
, parens $ nCases <-> text "cases"
]
ppCase (i, (names, se)) =
[ withTag "h3" [] $ fsep [ text "Source", int i, text "of", nCases
, text " / named ", doubleQuotes (text name),
if isPartial then text "(partial deconstructions)" else text "" ]
, refDotPath renderUrl tidx (TheorySource kind j i)
, withTag "p" [] $ ppPrem
, wrapP $ prettyNonGraphSystem se
]
where
name = intercalate "_" names
isPartial = not $ null $ unsolvedChains se
-- | A Html document representing the requires case splitting theorem. | 1,136 | false | true | 0 | 11 | 395 | 409 | 208 | 201 | null | null |
rul/lazymail | src/Main.hs | gpl-3.0 | version = putStrLn "Haskell lazymail 0.0001" | 44 | version = putStrLn "Haskell lazymail 0.0001" | 44 | version = putStrLn "Haskell lazymail 0.0001" | 44 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
osa1/chsc | Evaluator/Syntax.hs | bsd-3-clause | annedVarFreeVars' = taggedSizedFVedVarFreeVars' | 47 | annedVarFreeVars' = taggedSizedFVedVarFreeVars' | 47 | annedVarFreeVars' = taggedSizedFVedVarFreeVars' | 47 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
frenetic-lang/netcore-1.0 | src/Frenetic/NetCore/Util.hs | bsd-3-clause | size (PoUnion p1 p2) = size p1 + size p2 + 1 | 44 | size (PoUnion p1 p2) = size p1 + size p2 + 1 | 44 | size (PoUnion p1 p2) = size p1 + size p2 + 1 | 44 | false | false | 0 | 7 | 11 | 31 | 14 | 17 | null | null |
dimara/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | masterdUser :: String
masterdUser = Runtime.daemonUser GanetiMasterd | 68 | masterdUser :: String
masterdUser = Runtime.daemonUser GanetiMasterd | 68 | masterdUser = Runtime.daemonUser GanetiMasterd | 46 | false | true | 0 | 6 | 6 | 22 | 9 | 13 | null | null |
raphaelmor/99HaskellProblems | 1-10.hs | mit | myLast' :: [a] -> a
myLast' = foldr1 (\x acc -> acc) | 52 | myLast' :: [a] -> a
myLast' = foldr1 (\x acc -> acc) | 52 | myLast' = foldr1 (\x acc -> acc) | 32 | false | true | 0 | 7 | 11 | 31 | 17 | 14 | null | null |
evancz/builder | src/Elm/PerUserCache.hs | bsd-3-clause | getRoot :: FilePath -> IO FilePath
getRoot projectName =
do maybeHome <- Env.lookupEnv "ELM_HOME"
home <- maybe (Dir.getAppUserDataDirectory "elm") return maybeHome
let root = home </> version </> projectName
Dir.createDirectoryIfMissing True root
return root | 286 | getRoot :: FilePath -> IO FilePath
getRoot projectName =
do maybeHome <- Env.lookupEnv "ELM_HOME"
home <- maybe (Dir.getAppUserDataDirectory "elm") return maybeHome
let root = home </> version </> projectName
Dir.createDirectoryIfMissing True root
return root | 286 | getRoot projectName =
do maybeHome <- Env.lookupEnv "ELM_HOME"
home <- maybe (Dir.getAppUserDataDirectory "elm") return maybeHome
let root = home </> version </> projectName
Dir.createDirectoryIfMissing True root
return root | 251 | false | true | 0 | 11 | 60 | 88 | 39 | 49 | null | null |
energyflowanalysis/efa-2.1 | src/EFA/Application/Plot.hs | bsd-3-clause | sectionStackRow ::
(Node.C node, Ord i, FormatValue i) =>
String ->
TopoIdx.Energy node ->
Double ->
SeqFlow.Graph node a (Result (Stack i Double)) ->
IO ()
sectionStackRow ti energyIndex eps env =
case unzip $ Map.toList $ AssignMap.lookupEnergyStacks energyIndex env of
(idxs, energyStacks) ->
stacks ti (map (Format.literal . show) idxs) $
AssignMap.simultaneousThreshold eps . AssignMap.transpose $
map (Map.mapKeys AssignMap.deltaIndexSet) energyStacks | 511 | sectionStackRow ::
(Node.C node, Ord i, FormatValue i) =>
String ->
TopoIdx.Energy node ->
Double ->
SeqFlow.Graph node a (Result (Stack i Double)) ->
IO ()
sectionStackRow ti energyIndex eps env =
case unzip $ Map.toList $ AssignMap.lookupEnergyStacks energyIndex env of
(idxs, energyStacks) ->
stacks ti (map (Format.literal . show) idxs) $
AssignMap.simultaneousThreshold eps . AssignMap.transpose $
map (Map.mapKeys AssignMap.deltaIndexSet) energyStacks | 511 | sectionStackRow ti energyIndex eps env =
case unzip $ Map.toList $ AssignMap.lookupEnergyStacks energyIndex env of
(idxs, energyStacks) ->
stacks ti (map (Format.literal . show) idxs) $
AssignMap.simultaneousThreshold eps . AssignMap.transpose $
map (Map.mapKeys AssignMap.deltaIndexSet) energyStacks | 336 | false | true | 0 | 16 | 114 | 181 | 89 | 92 | null | null |
spechub/Hets | CommonLogic/Parse_KIF.hs | gpl-2.0 | plainsent :: CharParser st SENTENCE
plainsent = atomsent plainAtom | 66 | plainsent :: CharParser st SENTENCE
plainsent = atomsent plainAtom | 66 | plainsent = atomsent plainAtom | 30 | false | true | 0 | 5 | 8 | 19 | 9 | 10 | null | null |
Dronte/Operads | examples/altDual.hs | bsd-3-clause | adn2 = stepOperadicBuchberger ad0 adn1 | 38 | adn2 = stepOperadicBuchberger ad0 adn1 | 38 | adn2 = stepOperadicBuchberger ad0 adn1 | 38 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
jdreaver/quantities | library/Data/Quantities/ExprParser.hs | bsd-3-clause | parseMultFactor = try parseMultExptOp <|> parseMultExpt | 63 | parseMultFactor = try parseMultExptOp <|> parseMultExpt | 63 | parseMultFactor = try parseMultExptOp <|> parseMultExpt | 63 | false | false | 1 | 5 | 13 | 16 | 6 | 10 | null | null |
sgf-dma/sgf-haskell-common | src/Sgf/System/Process.hs | bsd-3-clause | -- Search for executable file with specified path and return either its path
-- with slashes (may be relative) or throw exception: if supplied path
-- contains slashes, just check, that file exists and is executable; if
-- supplied path does contain slashes, search for executable file with such
-- name in supplied path list. The search behavior is the same as of execve()
-- function.
searchExecutable :: MonadIO m => FilePath -> [FilePath] -> m FilePath
searchExecutable cmd ps
| '/' `elem` cmd =
liftIO $ catch (searchExecutable (takeFileName cmd) [takeDirectory cmd])
(\e -> throw $ annotateIOError e "searchExecutable" Nothing (Just cmd))
| otherwise = flip evalStateT doesNotExist $ do
let fs = map (</> cmd) ps
m <- flip findM fs $ \f -> do
t <- liftIO $ try (fmap executable (getPermissions f))
case t of
Right True -> return True
Right False -> put permError >> return False
-- Ignore only "does not exist" exception and forward others.
Left e -> do
unless (isDoesNotExistError e) (put e)
return False
maybe (get >>= throw) return m
where
doesNotExist :: IOError
doesNotExist = mkIOError doesNotExistErrorType
"searchExecutable" Nothing (Just cmd)
permError :: IOError
permError = mkIOError permissionErrorType
"searchExecutable" Nothing (Just cmd)
-- Search for executable file (the same way as execve() would do) in PATH
-- modified by a function. The behavior is implemented in `searchExecutable`,
-- except one case: when no function is supplied, assume, that PATH search is
-- turned off and look for file in current directory. Anyway, this function
-- will either return file path with slashes (so execve() would not perform
-- PATH search by itself) or throw exception. | 1,865 | searchExecutable :: MonadIO m => FilePath -> [FilePath] -> m FilePath
searchExecutable cmd ps
| '/' `elem` cmd =
liftIO $ catch (searchExecutable (takeFileName cmd) [takeDirectory cmd])
(\e -> throw $ annotateIOError e "searchExecutable" Nothing (Just cmd))
| otherwise = flip evalStateT doesNotExist $ do
let fs = map (</> cmd) ps
m <- flip findM fs $ \f -> do
t <- liftIO $ try (fmap executable (getPermissions f))
case t of
Right True -> return True
Right False -> put permError >> return False
-- Ignore only "does not exist" exception and forward others.
Left e -> do
unless (isDoesNotExistError e) (put e)
return False
maybe (get >>= throw) return m
where
doesNotExist :: IOError
doesNotExist = mkIOError doesNotExistErrorType
"searchExecutable" Nothing (Just cmd)
permError :: IOError
permError = mkIOError permissionErrorType
"searchExecutable" Nothing (Just cmd)
-- Search for executable file (the same way as execve() would do) in PATH
-- modified by a function. The behavior is implemented in `searchExecutable`,
-- except one case: when no function is supplied, assume, that PATH search is
-- turned off and look for file in current directory. Anyway, this function
-- will either return file path with slashes (so execve() would not perform
-- PATH search by itself) or throw exception. | 1,478 | searchExecutable cmd ps
| '/' `elem` cmd =
liftIO $ catch (searchExecutable (takeFileName cmd) [takeDirectory cmd])
(\e -> throw $ annotateIOError e "searchExecutable" Nothing (Just cmd))
| otherwise = flip evalStateT doesNotExist $ do
let fs = map (</> cmd) ps
m <- flip findM fs $ \f -> do
t <- liftIO $ try (fmap executable (getPermissions f))
case t of
Right True -> return True
Right False -> put permError >> return False
-- Ignore only "does not exist" exception and forward others.
Left e -> do
unless (isDoesNotExistError e) (put e)
return False
maybe (get >>= throw) return m
where
doesNotExist :: IOError
doesNotExist = mkIOError doesNotExistErrorType
"searchExecutable" Nothing (Just cmd)
permError :: IOError
permError = mkIOError permissionErrorType
"searchExecutable" Nothing (Just cmd)
-- Search for executable file (the same way as execve() would do) in PATH
-- modified by a function. The behavior is implemented in `searchExecutable`,
-- except one case: when no function is supplied, assume, that PATH search is
-- turned off and look for file in current directory. Anyway, this function
-- will either return file path with slashes (so execve() would not perform
-- PATH search by itself) or throw exception. | 1,408 | true | true | 4 | 20 | 453 | 346 | 171 | 175 | null | null |
jystic/tonic | src/Tonic/Codegen.hs | apache-2.0 | iUnary :: UnaryOp -> G.Instruction
iUnary op = case op of
Neg (Fmt I s) | s <= 32 -> G.INeg
| s <= 64 -> G.LNeg
Neg (Fmt F s) | s <= 32 -> G.FNeg
| s <= 64 -> G.DNeg
_ -> error ("iUnary: cannot invoke unary op: " <> show op) | 273 | iUnary :: UnaryOp -> G.Instruction
iUnary op = case op of
Neg (Fmt I s) | s <= 32 -> G.INeg
| s <= 64 -> G.LNeg
Neg (Fmt F s) | s <= 32 -> G.FNeg
| s <= 64 -> G.DNeg
_ -> error ("iUnary: cannot invoke unary op: " <> show op) | 273 | iUnary op = case op of
Neg (Fmt I s) | s <= 32 -> G.INeg
| s <= 64 -> G.LNeg
Neg (Fmt F s) | s <= 32 -> G.FNeg
| s <= 64 -> G.DNeg
_ -> error ("iUnary: cannot invoke unary op: " <> show op) | 238 | false | true | 0 | 11 | 103 | 131 | 61 | 70 | null | null |
Chase-C/Breakout | src/Ball.hs | mit | initBall :: Float -> Float -> Ball
initBall w h = Ball
{ bX = w / 2
, bY = h / 2
, bDX = 0
, bDY = 0
, bRadius = 4
} | 158 | initBall :: Float -> Float -> Ball
initBall w h = Ball
{ bX = w / 2
, bY = h / 2
, bDX = 0
, bDY = 0
, bRadius = 4
} | 158 | initBall w h = Ball
{ bX = w / 2
, bY = h / 2
, bDX = 0
, bDY = 0
, bRadius = 4
} | 123 | false | true | 0 | 7 | 78 | 64 | 37 | 27 | null | null |
input-output-hk/pos-haskell-prototype | wallet/src/Cardano/Wallet/Kernel/Util/NonEmptyMap.hs | mit | findMax :: NonEmptyMap k v -> (k, v)
findMax = NE.head . toDescNEList | 69 | findMax :: NonEmptyMap k v -> (k, v)
findMax = NE.head . toDescNEList | 69 | findMax = NE.head . toDescNEList | 32 | false | true | 0 | 6 | 12 | 32 | 17 | 15 | null | null |
rueshyna/gogol | gogol-classroom/gen/Network/Google/Resource/Classroom/Courses/CourseWork/StudentSubmissions/Return.hs | mpl-2.0 | -- | Pretty-print response.
ccwssrPp :: Lens' CoursesCourseWorkStudentSubmissionsReturn Bool
ccwssrPp = lens _ccwssrPp (\ s a -> s{_ccwssrPp = a}) | 146 | ccwssrPp :: Lens' CoursesCourseWorkStudentSubmissionsReturn Bool
ccwssrPp = lens _ccwssrPp (\ s a -> s{_ccwssrPp = a}) | 118 | ccwssrPp = lens _ccwssrPp (\ s a -> s{_ccwssrPp = a}) | 53 | true | true | 1 | 9 | 19 | 45 | 22 | 23 | null | null |
fluffynukeit/FNIStash | src/FNIStash/File/DAT.hs | bsd-3-clause | doubleVar _ = Nothing | 21 | doubleVar _ = Nothing | 21 | doubleVar _ = Nothing | 21 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
zorion/acm-uva | H99/Problems030.hs | gpl-3.0 | insertAt :: a -> [a] -> Int -> [a]
insertAt x xs 0 = x:xs | 57 | insertAt :: a -> [a] -> Int -> [a]
insertAt x xs 0 = x:xs | 57 | insertAt x xs 0 = x:xs | 22 | false | true | 2 | 10 | 14 | 48 | 22 | 26 | null | null |
scolobb/fgl | Data/Graph/Inductive/Query/MaxFlow2.hs | bsd-3-clause | ekStepList :: EKStepFunc
ekStepList g s t = case maybePath of
Just _ -> Just (mkGraph (labNodes g) newEdges, delta)
Nothing -> Nothing
where newEdges = (integrateDelta es delta) ++ otheredges
maybePath = augPathFused g s t
(es, otheredges) = extractPathList (labEdges g)
(S.fromList (zip justPath (tail justPath)))
delta = minimum $ getPathDeltas es
justPath = pathFromDirPath (fromJust maybePath) | 494 | ekStepList :: EKStepFunc
ekStepList g s t = case maybePath of
Just _ -> Just (mkGraph (labNodes g) newEdges, delta)
Nothing -> Nothing
where newEdges = (integrateDelta es delta) ++ otheredges
maybePath = augPathFused g s t
(es, otheredges) = extractPathList (labEdges g)
(S.fromList (zip justPath (tail justPath)))
delta = minimum $ getPathDeltas es
justPath = pathFromDirPath (fromJust maybePath) | 494 | ekStepList g s t = case maybePath of
Just _ -> Just (mkGraph (labNodes g) newEdges, delta)
Nothing -> Nothing
where newEdges = (integrateDelta es delta) ++ otheredges
maybePath = augPathFused g s t
(es, otheredges) = extractPathList (labEdges g)
(S.fromList (zip justPath (tail justPath)))
delta = minimum $ getPathDeltas es
justPath = pathFromDirPath (fromJust maybePath) | 469 | false | true | 0 | 13 | 155 | 159 | 80 | 79 | null | null |
rueshyna/gogol | gogol-genomics/gen/Network/Google/Genomics/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ReferenceBound' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rbUpperBound'
--
-- * 'rbReferenceName'
referenceBound
:: ReferenceBound
referenceBound =
ReferenceBound'
{ _rbUpperBound = Nothing
, _rbReferenceName = Nothing
} | 357 | referenceBound
:: ReferenceBound
referenceBound =
ReferenceBound'
{ _rbUpperBound = Nothing
, _rbReferenceName = Nothing
} | 142 | referenceBound =
ReferenceBound'
{ _rbUpperBound = Nothing
, _rbReferenceName = Nothing
} | 105 | true | true | 1 | 7 | 72 | 39 | 23 | 16 | null | null |
phischu/fragnix | tests/packages/scotty/Network.Wai.Test.hs | bsd-3-clause | -- | Set whole path (request path + query string).
setPath :: Request -> S8.ByteString -> Request
setPath req path = req {
pathInfo = segments
, rawPathInfo = B.toByteString (H.encodePathSegments segments)
, queryString = query
, rawQueryString = (H.renderQuery True query)
}
where
(segments, query) = H.decodePath path | 337 | setPath :: Request -> S8.ByteString -> Request
setPath req path = req {
pathInfo = segments
, rawPathInfo = B.toByteString (H.encodePathSegments segments)
, queryString = query
, rawQueryString = (H.renderQuery True query)
}
where
(segments, query) = H.decodePath path | 286 | setPath req path = req {
pathInfo = segments
, rawPathInfo = B.toByteString (H.encodePathSegments segments)
, queryString = query
, rawQueryString = (H.renderQuery True query)
}
where
(segments, query) = H.decodePath path | 239 | true | true | 0 | 10 | 66 | 96 | 52 | 44 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.