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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
prowdsponsor/country-codes
|
src/Data/CountryCodes/ISO31661.hs
|
bsd-3-clause
|
toText KP = "KP"
| 16
|
toText KP = "KP"
| 16
|
toText KP = "KP"
| 16
| false
| false
| 0
| 4
| 3
| 10
| 4
| 6
| null | null |
ezyang/ghc
|
testsuite/tests/gadt/nbe.hs
|
bsd-3-clause
|
questionsE (Arr s t) = do
d <- flatten (enumE s)
q <- questionsE t
return (\f -> q (App f d))
-- should be
-- find (List (Exp g Bool) n) -> Tree (Exp g a) n -> Exp g a
| 254
|
questionsE (Arr s t) = do
d <- flatten (enumE s)
q <- questionsE t
return (\f -> q (App f d))
-- should be
-- find (List (Exp g Bool) n) -> Tree (Exp g a) n -> Exp g a
| 254
|
questionsE (Arr s t) = do
d <- flatten (enumE s)
q <- questionsE t
return (\f -> q (App f d))
-- should be
-- find (List (Exp g Bool) n) -> Tree (Exp g a) n -> Exp g a
| 254
| false
| false
| 0
| 12
| 128
| 71
| 33
| 38
| null | null |
katsusuke/haskell-practice
|
lexer.hs
|
mit
|
whiteSpaces (x:xs) = ""
| 23
|
whiteSpaces (x:xs) = ""
| 23
|
whiteSpaces (x:xs) = ""
| 23
| false
| false
| 0
| 7
| 3
| 16
| 8
| 8
| null | null |
jmitchell/Idris-dev
|
src/Util/System.hs
|
bsd-3-clause
|
isATTY :: IO Bool
isATTY = do
tty <- isATTYRaw 1 -- fd stdout
mintty <- isMinTTY
return $ (tty /= 0) || mintty
-- | Return 'True' if the process's standard output is attached to a MinTTY
-- console (e.g., Cygwin or MSYS) on Windows. Return 'False' otherwise.
--
-- Unfortunately, we must check this separately since 'isATTY' always returns
-- 'False' on MinTTY consoles.
| 410
|
isATTY :: IO Bool
isATTY = do
tty <- isATTYRaw 1 -- fd stdout
mintty <- isMinTTY
return $ (tty /= 0) || mintty
-- | Return 'True' if the process's standard output is attached to a MinTTY
-- console (e.g., Cygwin or MSYS) on Windows. Return 'False' otherwise.
--
-- Unfortunately, we must check this separately since 'isATTY' always returns
-- 'False' on MinTTY consoles.
| 410
|
isATTY = do
tty <- isATTYRaw 1 -- fd stdout
mintty <- isMinTTY
return $ (tty /= 0) || mintty
-- | Return 'True' if the process's standard output is attached to a MinTTY
-- console (e.g., Cygwin or MSYS) on Windows. Return 'False' otherwise.
--
-- Unfortunately, we must check this separately since 'isATTY' always returns
-- 'False' on MinTTY consoles.
| 392
| false
| true
| 0
| 10
| 105
| 61
| 30
| 31
| null | null |
kadena-io/pact
|
src-tool/Pact/Analyze/Types/Numerical.hs
|
bsd-3-clause
|
decimalIso :: PactIso Decimal.Decimal Decimal
decimalIso = PactIso $ iso mkDecimal unMkDecimal
where
unMkDecimal :: Decimal -> Decimal.Decimal
unMkDecimal (Decimal dec) = case Decimal.eitherFromRational (dec % 10 ^ decimalPrecision) of
Left err -> error err
Right d -> d
mkDecimal :: Decimal.Decimal -> Decimal
mkDecimal (Decimal.Decimal places mantissa)
= lShiftD (decimalPrecision - fromIntegral places) (Decimal mantissa)
| 462
|
decimalIso :: PactIso Decimal.Decimal Decimal
decimalIso = PactIso $ iso mkDecimal unMkDecimal
where
unMkDecimal :: Decimal -> Decimal.Decimal
unMkDecimal (Decimal dec) = case Decimal.eitherFromRational (dec % 10 ^ decimalPrecision) of
Left err -> error err
Right d -> d
mkDecimal :: Decimal.Decimal -> Decimal
mkDecimal (Decimal.Decimal places mantissa)
= lShiftD (decimalPrecision - fromIntegral places) (Decimal mantissa)
| 462
|
decimalIso = PactIso $ iso mkDecimal unMkDecimal
where
unMkDecimal :: Decimal -> Decimal.Decimal
unMkDecimal (Decimal dec) = case Decimal.eitherFromRational (dec % 10 ^ decimalPrecision) of
Left err -> error err
Right d -> d
mkDecimal :: Decimal.Decimal -> Decimal
mkDecimal (Decimal.Decimal places mantissa)
= lShiftD (decimalPrecision - fromIntegral places) (Decimal mantissa)
| 416
| false
| true
| 0
| 9
| 93
| 146
| 71
| 75
| null | null |
amccausl/RDF4H
|
testsuite/tests/Data/RDF/GraphTestUtils.hs
|
bsd-3-clause
|
p_query_match_so :: RDF g => (g -> Triples) -> g -> Property
p_query_match_so = mk_query_match_fn same f
where same t1 t2 = sameSubj t1 t2 && sameObj t1 t2
f t = (Just $ subjectOf t, Nothing, Just $ objectOf t)
-- fixed predicate and object with wildcard subject
| 273
|
p_query_match_so :: RDF g => (g -> Triples) -> g -> Property
p_query_match_so = mk_query_match_fn same f
where same t1 t2 = sameSubj t1 t2 && sameObj t1 t2
f t = (Just $ subjectOf t, Nothing, Just $ objectOf t)
-- fixed predicate and object with wildcard subject
| 273
|
p_query_match_so = mk_query_match_fn same f
where same t1 t2 = sameSubj t1 t2 && sameObj t1 t2
f t = (Just $ subjectOf t, Nothing, Just $ objectOf t)
-- fixed predicate and object with wildcard subject
| 212
| false
| true
| 3
| 9
| 59
| 110
| 49
| 61
| null | null |
donomii/srt-collector
|
srt2json.hs
|
gpl-3.0
|
srtParser :: Parser [SubTitle]
srtParser = do
optional bom
blocks
| 91
|
srtParser :: Parser [SubTitle]
srtParser = do
optional bom
blocks
| 91
|
srtParser = do
optional bom
blocks
| 60
| false
| true
| 0
| 7
| 35
| 32
| 13
| 19
| null | null |
dmjio/stripe
|
stripe-core/src/Web/Stripe/Card.hs
|
mit
|
deleteCustomerCard
:: CustomerId -- ^ `CustomerId` of the `Card` to be deleted
-> CardId -- ^ `CardId` associated with `Card` to be deleted
-> StripeRequest DeleteCustomerCard
deleteCustomerCard
customerid
(CardId cardid) = deleteCard "customers" (getCustomerId customerid) cardid
| 304
|
deleteCustomerCard
:: CustomerId -- ^ `CustomerId` of the `Card` to be deleted
-> CardId -- ^ `CardId` associated with `Card` to be deleted
-> StripeRequest DeleteCustomerCard
deleteCustomerCard
customerid
(CardId cardid) = deleteCard "customers" (getCustomerId customerid) cardid
| 304
|
deleteCustomerCard
customerid
(CardId cardid) = deleteCard "customers" (getCustomerId customerid) cardid
| 112
| false
| true
| 0
| 10
| 59
| 52
| 25
| 27
| null | null |
beni55/fay
|
examples/oscillator.hs
|
bsd-3-clause
|
rinner = wh / (2 + 7 * rdotfac)
| 31
|
rinner = wh / (2 + 7 * rdotfac)
| 31
|
rinner = wh / (2 + 7 * rdotfac)
| 31
| false
| false
| 1
| 9
| 8
| 25
| 11
| 14
| null | null |
brendanhay/gogol
|
gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs
|
mpl-2.0
|
-- | Whether creative should be treated as SSL compliant even if the system
-- scan shows it\'s not. Applicable to all creative types.
creSSLOverride :: Lens' Creative (Maybe Bool)
creSSLOverride
= lens _creSSLOverride
(\ s a -> s{_creSSLOverride = a})
| 260
|
creSSLOverride :: Lens' Creative (Maybe Bool)
creSSLOverride
= lens _creSSLOverride
(\ s a -> s{_creSSLOverride = a})
| 125
|
creSSLOverride
= lens _creSSLOverride
(\ s a -> s{_creSSLOverride = a})
| 79
| true
| true
| 1
| 9
| 48
| 53
| 26
| 27
| null | null |
pbrisbin/drync
|
src/Drync/Transfer.hs
|
mit
|
transferConduit :: MonadIO m
=> Options
-> Maybe Int
-> Conduit ByteString m ByteString
transferConduit options msize =
throttled (oThrottle options) =$= withProgress (oSilent options) msize
where
pass = await >>= maybe (return ()) (\v -> yield v >> pass)
throttled 0 = pass
throttled n = throttle B.length (n * 1000)
withProgress False (Just size) = reportProgress size
withProgress _ _ = pass
| 471
|
transferConduit :: MonadIO m
=> Options
-> Maybe Int
-> Conduit ByteString m ByteString
transferConduit options msize =
throttled (oThrottle options) =$= withProgress (oSilent options) msize
where
pass = await >>= maybe (return ()) (\v -> yield v >> pass)
throttled 0 = pass
throttled n = throttle B.length (n * 1000)
withProgress False (Just size) = reportProgress size
withProgress _ _ = pass
| 471
|
transferConduit options msize =
throttled (oThrottle options) =$= withProgress (oSilent options) msize
where
pass = await >>= maybe (return ()) (\v -> yield v >> pass)
throttled 0 = pass
throttled n = throttle B.length (n * 1000)
withProgress False (Just size) = reportProgress size
withProgress _ _ = pass
| 335
| false
| true
| 0
| 10
| 140
| 164
| 79
| 85
| null | null |
patperry/hs-linear-algebra
|
lib/Numeric/LinearAlgebra/Vector/STBase.hs
|
bsd-3-clause
|
-- | @kroneckerTo dst x y@ sets @dst := x \otimes y@.
kroneckerTo :: (RVector v1, RVector v2, BLAS2 e)
=> STVector s e -> v1 e -> v2 e -> ST s ()
kroneckerTo dst x y = do
m <- getDim x
n <- getDim y
dimdst <- getDim dst
when (dimdst /= m * n) $ error $
printf ("kroneckerTo"
++ " <vector with dim %d>"
++ " <vector with dim %d>"
++ " <vector with dim %d>:"
++ " dimension mismatch") dimdst m n
clear dst
unsafeIOToST $
unsafeWith dst $ \pdst ->
unsafeWith x $ \px ->
unsafeWith y $ \py ->
BLAS.geru n m 1 py 1 px 1 pdst (max n 1)
| 680
|
kroneckerTo :: (RVector v1, RVector v2, BLAS2 e)
=> STVector s e -> v1 e -> v2 e -> ST s ()
kroneckerTo dst x y = do
m <- getDim x
n <- getDim y
dimdst <- getDim dst
when (dimdst /= m * n) $ error $
printf ("kroneckerTo"
++ " <vector with dim %d>"
++ " <vector with dim %d>"
++ " <vector with dim %d>:"
++ " dimension mismatch") dimdst m n
clear dst
unsafeIOToST $
unsafeWith dst $ \pdst ->
unsafeWith x $ \px ->
unsafeWith y $ \py ->
BLAS.geru n m 1 py 1 px 1 pdst (max n 1)
| 626
|
kroneckerTo dst x y = do
m <- getDim x
n <- getDim y
dimdst <- getDim dst
when (dimdst /= m * n) $ error $
printf ("kroneckerTo"
++ " <vector with dim %d>"
++ " <vector with dim %d>"
++ " <vector with dim %d>:"
++ " dimension mismatch") dimdst m n
clear dst
unsafeIOToST $
unsafeWith dst $ \pdst ->
unsafeWith x $ \px ->
unsafeWith y $ \py ->
BLAS.geru n m 1 py 1 px 1 pdst (max n 1)
| 522
| true
| true
| 0
| 15
| 269
| 231
| 109
| 122
| null | null |
DavidAlphaFox/ghc
|
libraries/xhtml/Text/XHtml/Strict/Elements.hs
|
bsd-3-clause
|
thetitle = tag "title"
| 34
|
thetitle = tag "title"
| 34
|
thetitle = tag "title"
| 34
| false
| false
| 0
| 5
| 15
| 9
| 4
| 5
| null | null |
kawamuray/ganeti
|
src/Ganeti/Constants.hs
|
gpl-2.0
|
opPrioHighest :: Int
opPrioHighest = -20
| 40
|
opPrioHighest :: Int
opPrioHighest = -20
| 40
|
opPrioHighest = -20
| 19
| false
| true
| 0
| 5
| 5
| 13
| 7
| 6
| null | null |
lexml/lexml-linker
|
src/main/haskell/LexML/Linker/LexerPrim.hs
|
gpl-2.0
|
pontoeVirgula :: Action
pontoeVirgula = Just . const PontoeVirgula
| 66
|
pontoeVirgula :: Action
pontoeVirgula = Just . const PontoeVirgula
| 66
|
pontoeVirgula = Just . const PontoeVirgula
| 42
| false
| true
| 1
| 6
| 8
| 25
| 10
| 15
| null | null |
alexbiehl/hoop
|
hadoop-protos/src/Hadoop/Protos/HdfsProtos/CryptoProtocolVersionProto.hs
|
mit
|
toMaybe'Enum :: Prelude'.Int -> P'.Maybe CryptoProtocolVersionProto
toMaybe'Enum 1 = Prelude'.Just UNKNOWN_PROTOCOL_VERSION
| 123
|
toMaybe'Enum :: Prelude'.Int -> P'.Maybe CryptoProtocolVersionProto
toMaybe'Enum 1 = Prelude'.Just UNKNOWN_PROTOCOL_VERSION
| 123
|
toMaybe'Enum 1 = Prelude'.Just UNKNOWN_PROTOCOL_VERSION
| 55
| false
| true
| 0
| 7
| 10
| 30
| 14
| 16
| null | null |
mrmonday/Idris-dev
|
src/Idris/Delaborate.hs
|
bsd-3-clause
|
-- | Add extra metadata to an output annotation, optionally marking metavariables.
fancifyAnnots :: IState -> Bool -> OutputAnnotation -> OutputAnnotation
fancifyAnnots ist meta annot@(AnnName n nt _ _) =
do let ctxt = tt_ctxt ist
docs = docOverview ist n
ty = Just (getTy ist n)
case () of
_ | isDConName n ctxt -> AnnName n (nt <|> Just DataOutput) docs ty
_ | isFnName n ctxt -> AnnName n (nt <|> Just FunOutput) docs ty
_ | isTConName n ctxt -> AnnName n (nt <|> Just TypeOutput) docs ty
_ | isMetavarName n ist -> if meta
then AnnName n (nt <|> Just MetavarOutput) docs ty
else AnnName n (nt <|> Just FunOutput) docs ty
_ | isPostulateName n ist -> AnnName n (nt <|> Just PostulateOutput) docs ty
_ | otherwise -> annot
where docOverview :: IState -> Name -> Maybe String -- pretty-print first paragraph of docs
docOverview ist n = do docs <- lookupCtxtExact n (idris_docstrings ist)
let o = overview (fst docs)
norm = normaliseAll (tt_ctxt ist) []
-- TODO make width configurable
-- Issue #1588 on the Issue Tracker
-- https://github.com/idris-lang/Idris-dev/issues/1588
out = displayS . renderPretty 1.0 50 $
renderDocstring (renderDocTerm (pprintDelab ist)
norm) o
return (out "")
getTy :: IState -> Name -> String -- fails if name not already extant!
getTy ist n = let theTy = pprintPTerm (ppOptionIst ist) [] [] (idris_infixes ist) $
resugar ist $ delabTy ist n
in (displayS . renderPretty 1.0 50 $ theTy) ""
| 2,042
|
fancifyAnnots :: IState -> Bool -> OutputAnnotation -> OutputAnnotation
fancifyAnnots ist meta annot@(AnnName n nt _ _) =
do let ctxt = tt_ctxt ist
docs = docOverview ist n
ty = Just (getTy ist n)
case () of
_ | isDConName n ctxt -> AnnName n (nt <|> Just DataOutput) docs ty
_ | isFnName n ctxt -> AnnName n (nt <|> Just FunOutput) docs ty
_ | isTConName n ctxt -> AnnName n (nt <|> Just TypeOutput) docs ty
_ | isMetavarName n ist -> if meta
then AnnName n (nt <|> Just MetavarOutput) docs ty
else AnnName n (nt <|> Just FunOutput) docs ty
_ | isPostulateName n ist -> AnnName n (nt <|> Just PostulateOutput) docs ty
_ | otherwise -> annot
where docOverview :: IState -> Name -> Maybe String -- pretty-print first paragraph of docs
docOverview ist n = do docs <- lookupCtxtExact n (idris_docstrings ist)
let o = overview (fst docs)
norm = normaliseAll (tt_ctxt ist) []
-- TODO make width configurable
-- Issue #1588 on the Issue Tracker
-- https://github.com/idris-lang/Idris-dev/issues/1588
out = displayS . renderPretty 1.0 50 $
renderDocstring (renderDocTerm (pprintDelab ist)
norm) o
return (out "")
getTy :: IState -> Name -> String -- fails if name not already extant!
getTy ist n = let theTy = pprintPTerm (ppOptionIst ist) [] [] (idris_infixes ist) $
resugar ist $ delabTy ist n
in (displayS . renderPretty 1.0 50 $ theTy) ""
| 1,959
|
fancifyAnnots ist meta annot@(AnnName n nt _ _) =
do let ctxt = tt_ctxt ist
docs = docOverview ist n
ty = Just (getTy ist n)
case () of
_ | isDConName n ctxt -> AnnName n (nt <|> Just DataOutput) docs ty
_ | isFnName n ctxt -> AnnName n (nt <|> Just FunOutput) docs ty
_ | isTConName n ctxt -> AnnName n (nt <|> Just TypeOutput) docs ty
_ | isMetavarName n ist -> if meta
then AnnName n (nt <|> Just MetavarOutput) docs ty
else AnnName n (nt <|> Just FunOutput) docs ty
_ | isPostulateName n ist -> AnnName n (nt <|> Just PostulateOutput) docs ty
_ | otherwise -> annot
where docOverview :: IState -> Name -> Maybe String -- pretty-print first paragraph of docs
docOverview ist n = do docs <- lookupCtxtExact n (idris_docstrings ist)
let o = overview (fst docs)
norm = normaliseAll (tt_ctxt ist) []
-- TODO make width configurable
-- Issue #1588 on the Issue Tracker
-- https://github.com/idris-lang/Idris-dev/issues/1588
out = displayS . renderPretty 1.0 50 $
renderDocstring (renderDocTerm (pprintDelab ist)
norm) o
return (out "")
getTy :: IState -> Name -> String -- fails if name not already extant!
getTy ist n = let theTy = pprintPTerm (ppOptionIst ist) [] [] (idris_infixes ist) $
resugar ist $ delabTy ist n
in (displayS . renderPretty 1.0 50 $ theTy) ""
| 1,887
| true
| true
| 0
| 15
| 873
| 551
| 259
| 292
| null | null |
skogsbaer/HTF
|
Test/Framework/Utils.hs
|
lgpl-2.1
|
mapAccumLM :: Monad m
=> (acc -> x -> m (acc, y)) -- Function of elt of input list
-- and accumulator, returning new
-- accumulator and elt of result list
-> acc -- Initial accumulator
-> [x] -- Input list
-> m (acc, [y]) -- Final accumulator and result list
mapAccumLM _ s [] = return (s, [])
| 443
|
mapAccumLM :: Monad m
=> (acc -> x -> m (acc, y)) -- Function of elt of input list
-- and accumulator, returning new
-- accumulator and elt of result list
-> acc -- Initial accumulator
-> [x] -- Input list
-> m (acc, [y])
mapAccumLM _ s [] = return (s, [])
| 404
|
mapAccumLM _ s [] = return (s, [])
| 41
| true
| true
| 0
| 11
| 208
| 91
| 51
| 40
| null | null |
haskell-tinc/hpack
|
src/Hpack/Syntax/Defaults.hs
|
mit
|
parseGithub :: String -> Parser GithubRepo
parseGithub github
| not (isValidOwner owner) = fail ("invalid owner name " ++ show owner)
| not (isValidRepo repo) = fail ("invalid repository name " ++ show repo)
| otherwise = return (GithubRepo owner repo)
where
(owner, repo) = drop 1 <$> break (== '/') github
| 319
|
parseGithub :: String -> Parser GithubRepo
parseGithub github
| not (isValidOwner owner) = fail ("invalid owner name " ++ show owner)
| not (isValidRepo repo) = fail ("invalid repository name " ++ show repo)
| otherwise = return (GithubRepo owner repo)
where
(owner, repo) = drop 1 <$> break (== '/') github
| 319
|
parseGithub github
| not (isValidOwner owner) = fail ("invalid owner name " ++ show owner)
| not (isValidRepo repo) = fail ("invalid repository name " ++ show repo)
| otherwise = return (GithubRepo owner repo)
where
(owner, repo) = drop 1 <$> break (== '/') github
| 276
| false
| true
| 0
| 10
| 63
| 139
| 64
| 75
| null | null |
omgbebebe/Boom
|
src/Boom.hs
|
mit
|
destroy_instance :: Node -> Sh ()
destroy_instance Node{..} = shelly $ silently $ do
setenv "LANG" "C"
is <- fmap (L.init . T.lines) $ sudo "virsh" ["list","--all", "--name"]
let inst = L.filter (==nodeName) is
forM_ inst (\x -> sudo_ "virsh" ["destroy", x])
| 266
|
destroy_instance :: Node -> Sh ()
destroy_instance Node{..} = shelly $ silently $ do
setenv "LANG" "C"
is <- fmap (L.init . T.lines) $ sudo "virsh" ["list","--all", "--name"]
let inst = L.filter (==nodeName) is
forM_ inst (\x -> sudo_ "virsh" ["destroy", x])
| 266
|
destroy_instance Node{..} = shelly $ silently $ do
setenv "LANG" "C"
is <- fmap (L.init . T.lines) $ sudo "virsh" ["list","--all", "--name"]
let inst = L.filter (==nodeName) is
forM_ inst (\x -> sudo_ "virsh" ["destroy", x])
| 232
| false
| true
| 0
| 13
| 49
| 131
| 65
| 66
| null | null |
iblumenfeld/cryptol
|
src/Cryptol/Transform/Specialize.hs
|
bsd-3-clause
|
reifyName :: Name -> [Type] -> String
reifyName name tys = intercalate "_" (showName name : concatMap showT tys)
where
tvInt (TVFree i _ _ _) = i
tvInt (TVBound i _) = i
showT typ =
case typ of
TCon tc ts -> showTCon tc : concatMap showT ts
TUser _ _ t -> showT t
TVar tv -> [ "a" ++ show (tvInt tv) ]
TRec tr -> "rec" : concatMap showRecFld tr
showTCon tCon =
case tCon of
TC tc -> showTC tc
PC pc -> showPC pc
TF tf -> showTF tf
showPC pc =
case pc of
PEqual -> "eq"
PNeq -> "neq"
PGeq -> "geq"
PFin -> "fin"
PHas sel -> "sel_" ++ showSel sel
PArith -> "arith"
PCmp -> "cmp"
showTC tc =
case tc of
TCNum n -> show n
TCInf -> "inf"
TCBit -> "bit"
TCSeq -> "seq"
TCFun -> "fun"
TCTuple n -> "t" ++ show n
TCNewtype _ -> "user"
showSel sel = intercalate "_" $
case sel of
TupleSel _ sig -> "tup" : maybe [] ((:[]) . show) sig
RecordSel x sig -> "rec" : showName x : map showName (maybe [] id sig)
ListSel _ sig -> "list" : maybe [] ((:[]) . show) sig
showName nm =
case nm of
Name s -> unpack s
NewName _ n -> "x" ++ show n
showTF tf =
case tf of
TCAdd -> "add"
TCSub -> "sub"
TCMul -> "mul"
TCDiv -> "div"
TCMod -> "mod"
TCExp -> "exp"
TCWidth -> "width"
TCMin -> "min"
TCMax -> "max"
TCLenFromThen -> "len_from_then"
TCLenFromThenTo -> "len_from_then_to"
showRecFld (nm,t) = showName nm : showT t
| 1,837
|
reifyName :: Name -> [Type] -> String
reifyName name tys = intercalate "_" (showName name : concatMap showT tys)
where
tvInt (TVFree i _ _ _) = i
tvInt (TVBound i _) = i
showT typ =
case typ of
TCon tc ts -> showTCon tc : concatMap showT ts
TUser _ _ t -> showT t
TVar tv -> [ "a" ++ show (tvInt tv) ]
TRec tr -> "rec" : concatMap showRecFld tr
showTCon tCon =
case tCon of
TC tc -> showTC tc
PC pc -> showPC pc
TF tf -> showTF tf
showPC pc =
case pc of
PEqual -> "eq"
PNeq -> "neq"
PGeq -> "geq"
PFin -> "fin"
PHas sel -> "sel_" ++ showSel sel
PArith -> "arith"
PCmp -> "cmp"
showTC tc =
case tc of
TCNum n -> show n
TCInf -> "inf"
TCBit -> "bit"
TCSeq -> "seq"
TCFun -> "fun"
TCTuple n -> "t" ++ show n
TCNewtype _ -> "user"
showSel sel = intercalate "_" $
case sel of
TupleSel _ sig -> "tup" : maybe [] ((:[]) . show) sig
RecordSel x sig -> "rec" : showName x : map showName (maybe [] id sig)
ListSel _ sig -> "list" : maybe [] ((:[]) . show) sig
showName nm =
case nm of
Name s -> unpack s
NewName _ n -> "x" ++ show n
showTF tf =
case tf of
TCAdd -> "add"
TCSub -> "sub"
TCMul -> "mul"
TCDiv -> "div"
TCMod -> "mod"
TCExp -> "exp"
TCWidth -> "width"
TCMin -> "min"
TCMax -> "max"
TCLenFromThen -> "len_from_then"
TCLenFromThenTo -> "len_from_then_to"
showRecFld (nm,t) = showName nm : showT t
| 1,837
|
reifyName name tys = intercalate "_" (showName name : concatMap showT tys)
where
tvInt (TVFree i _ _ _) = i
tvInt (TVBound i _) = i
showT typ =
case typ of
TCon tc ts -> showTCon tc : concatMap showT ts
TUser _ _ t -> showT t
TVar tv -> [ "a" ++ show (tvInt tv) ]
TRec tr -> "rec" : concatMap showRecFld tr
showTCon tCon =
case tCon of
TC tc -> showTC tc
PC pc -> showPC pc
TF tf -> showTF tf
showPC pc =
case pc of
PEqual -> "eq"
PNeq -> "neq"
PGeq -> "geq"
PFin -> "fin"
PHas sel -> "sel_" ++ showSel sel
PArith -> "arith"
PCmp -> "cmp"
showTC tc =
case tc of
TCNum n -> show n
TCInf -> "inf"
TCBit -> "bit"
TCSeq -> "seq"
TCFun -> "fun"
TCTuple n -> "t" ++ show n
TCNewtype _ -> "user"
showSel sel = intercalate "_" $
case sel of
TupleSel _ sig -> "tup" : maybe [] ((:[]) . show) sig
RecordSel x sig -> "rec" : showName x : map showName (maybe [] id sig)
ListSel _ sig -> "list" : maybe [] ((:[]) . show) sig
showName nm =
case nm of
Name s -> unpack s
NewName _ n -> "x" ++ show n
showTF tf =
case tf of
TCAdd -> "add"
TCSub -> "sub"
TCMul -> "mul"
TCDiv -> "div"
TCMod -> "mod"
TCExp -> "exp"
TCWidth -> "width"
TCMin -> "min"
TCMax -> "max"
TCLenFromThen -> "len_from_then"
TCLenFromThenTo -> "len_from_then_to"
showRecFld (nm,t) = showName nm : showT t
| 1,799
| false
| true
| 6
| 15
| 814
| 538
| 272
| 266
| null | null |
rueshyna/gogol
|
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'VideoFileDetailsAudioStream' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'vfdasBitrateBps'
--
-- * 'vfdasVendor'
--
-- * 'vfdasCodec'
--
-- * 'vfdasChannelCount'
videoFileDetailsAudioStream
:: VideoFileDetailsAudioStream
videoFileDetailsAudioStream =
VideoFileDetailsAudioStream'
{ _vfdasBitrateBps = Nothing
, _vfdasVendor = Nothing
, _vfdasCodec = Nothing
, _vfdasChannelCount = Nothing
}
| 532
|
videoFileDetailsAudioStream
:: VideoFileDetailsAudioStream
videoFileDetailsAudioStream =
VideoFileDetailsAudioStream'
{ _vfdasBitrateBps = Nothing
, _vfdasVendor = Nothing
, _vfdasCodec = Nothing
, _vfdasChannelCount = Nothing
}
| 256
|
videoFileDetailsAudioStream =
VideoFileDetailsAudioStream'
{ _vfdasBitrateBps = Nothing
, _vfdasVendor = Nothing
, _vfdasCodec = Nothing
, _vfdasChannelCount = Nothing
}
| 193
| true
| true
| 0
| 6
| 96
| 48
| 34
| 14
| null | null |
remyoudompheng/forum-gtk
|
src-haskell/mainwindow.hs
|
gpl-3.0
|
action_goto_parent_callback = return ()
| 39
|
action_goto_parent_callback = return ()
| 39
|
action_goto_parent_callback = return ()
| 39
| false
| false
| 1
| 6
| 3
| 14
| 5
| 9
| null | null |
brendanhay/gogol
|
gogol-admin-datatransfer/gen/Network/Google/DataTransfer/Types/Product.hs
|
mpl-2.0
|
-- | The list of all possible transfer parameters for this application. These
-- parameters can be used to select the data of the user in this
-- application to be transferred.
aTransferParams :: Lens' Application [ApplicationTransferParam]
aTransferParams
= lens _aTransferParams
(\ s a -> s{_aTransferParams = a})
. _Default
. _Coerce
| 356
|
aTransferParams :: Lens' Application [ApplicationTransferParam]
aTransferParams
= lens _aTransferParams
(\ s a -> s{_aTransferParams = a})
. _Default
. _Coerce
| 179
|
aTransferParams
= lens _aTransferParams
(\ s a -> s{_aTransferParams = a})
. _Default
. _Coerce
| 115
| true
| true
| 2
| 8
| 71
| 62
| 31
| 31
| null | null |
gust/feature-creature
|
users-service/app/App.hs
|
mit
|
--
-- NOTE: This definition is equivalent and probably more idiomatic Servant.
-- However, I find the explicit ExceptT type clearer
-- newtype AppT a = AppT { unApp :: ReaderT AppConfig (ExceptT ServantErr IO) a }
runAppT :: AppConfig -> AppT a -> Handler a
runAppT cfg appT = runReaderT (unApp appT) cfg
| 311
|
runAppT :: AppConfig -> AppT a -> Handler a
runAppT cfg appT = runReaderT (unApp appT) cfg
| 90
|
runAppT cfg appT = runReaderT (unApp appT) cfg
| 46
| true
| true
| 0
| 7
| 60
| 45
| 23
| 22
| null | null |
hmb-ba/protocol
|
src/Kafka/Client.hs
|
mit
|
byteLength :: BS.ByteString -> Word32
byteLength b = fromIntegral $ BS.length b
| 79
|
byteLength :: BS.ByteString -> Word32
byteLength b = fromIntegral $ BS.length b
| 79
|
byteLength b = fromIntegral $ BS.length b
| 41
| false
| true
| 2
| 7
| 11
| 36
| 15
| 21
| null | null |
truls/language-vhdl-quote
|
src/Language/VHDL/Parser/Internal.hs
|
mpl-2.0
|
blockSpecification :: Parser BlockSpecification
-- FIXME: This distinction is probably useless
blockSpecification =
choice
[ try $ BSGen <$> label <*> optional (parens indexSpecification)
, BSArch <$> name
, BSBlock <$> label
]
| 245
|
blockSpecification :: Parser BlockSpecification
blockSpecification =
choice
[ try $ BSGen <$> label <*> optional (parens indexSpecification)
, BSArch <$> name
, BSBlock <$> label
]
| 198
|
blockSpecification =
choice
[ try $ BSGen <$> label <*> optional (parens indexSpecification)
, BSArch <$> name
, BSBlock <$> label
]
| 150
| true
| true
| 0
| 9
| 50
| 56
| 29
| 27
| null | null |
wouter-swierstra/Data.Stream
|
Data/Stream.hs
|
bsd-3-clause
|
-- | The @ \<:\> @ operator is an infix version of the 'Cons'
-- constructor.
(<:>) :: a -> Stream a -> Stream a
(<:>) = Cons
| 125
|
(<:>) :: a -> Stream a -> Stream a
(<:>) = Cons
| 47
|
(<:>) = Cons
| 12
| true
| true
| 0
| 8
| 27
| 37
| 19
| 18
| null | null |
ghc-android/ghc
|
testsuite/tests/programs/fun_insts/Main.hs
|
bsd-3-clause
|
tt :: Float -> Float
ss = sin * sin
| 36
|
tt :: Float -> Float
ss = sin * sin
| 35
|
ss = sin * sin
| 14
| false
| true
| 0
| 5
| 10
| 19
| 10
| 9
| null | null |
tinyrock/gr4j
|
src/Verification.hs
|
bsd-3-clause
|
mse :: [Obs] -> [Sim] -> Metric
mse obs sim = (sum $ square $ diff obs sim) / genericLength obs
| 95
|
mse :: [Obs] -> [Sim] -> Metric
mse obs sim = (sum $ square $ diff obs sim) / genericLength obs
| 95
|
mse obs sim = (sum $ square $ diff obs sim) / genericLength obs
| 63
| false
| true
| 0
| 8
| 20
| 57
| 28
| 29
| null | null |
nicklawls/eightpuzzle
|
src/Main.hs
|
bsd-3-clause
|
-- (!) is unsafe vector indexing
-- the (Just neighbor) pattern match will throw an exception if 'elemIndex' returns
-- 'Nothing'
-- swap the element at index1 with the element at index2
swap :: Vector a -> Int -> Int -> Vector a
swap vec index1 index2 =
vec //
[ (index1, vec ! index2)
, (index2, vec ! index1)
]
| 343
|
swap :: Vector a -> Int -> Int -> Vector a
swap vec index1 index2 =
vec //
[ (index1, vec ! index2)
, (index2, vec ! index1)
]
| 154
|
swap vec index1 index2 =
vec //
[ (index1, vec ! index2)
, (index2, vec ! index1)
]
| 111
| true
| true
| 2
| 8
| 90
| 76
| 40
| 36
| null | null |
lolepezy/hajs
|
src/Executor.hs
|
unlicense
|
execute :: Program -> Context -> Context
execute p c = c
| 56
|
execute :: Program -> Context -> Context
execute p c = c
| 56
|
execute p c = c
| 15
| false
| true
| 0
| 6
| 11
| 29
| 13
| 16
| null | null |
WraithM/fingmodules
|
src/Lambda.hs
|
bsd-3-clause
|
main :: IO ()
main = do
result <- parseProgFromFile "test.l"
let Just mainProg = lookup "main" result
evalResult = eval result mainProg
mapM_ (\(name, e) -> putStr (name ++ " = ") >> print e) result
newline
putStrLn $ L.prettyProgram result
newline
print evalResult
putStrLn $ render $ L.prettyExp evalResult
where
newline = putStr "\n"
| 387
|
main :: IO ()
main = do
result <- parseProgFromFile "test.l"
let Just mainProg = lookup "main" result
evalResult = eval result mainProg
mapM_ (\(name, e) -> putStr (name ++ " = ") >> print e) result
newline
putStrLn $ L.prettyProgram result
newline
print evalResult
putStrLn $ render $ L.prettyExp evalResult
where
newline = putStr "\n"
| 387
|
main = do
result <- parseProgFromFile "test.l"
let Just mainProg = lookup "main" result
evalResult = eval result mainProg
mapM_ (\(name, e) -> putStr (name ++ " = ") >> print e) result
newline
putStrLn $ L.prettyProgram result
newline
print evalResult
putStrLn $ render $ L.prettyExp evalResult
where
newline = putStr "\n"
| 373
| false
| true
| 1
| 13
| 106
| 147
| 65
| 82
| null | null |
sof/delicious
|
Network/Delicious/User.hs
|
bsd-3-clause
|
getAllHashes :: DM [Post]
getAllHashes = getPosts' "getAll" "posts/all?hashes" nullFilter
| 89
|
getAllHashes :: DM [Post]
getAllHashes = getPosts' "getAll" "posts/all?hashes" nullFilter
| 89
|
getAllHashes = getPosts' "getAll" "posts/all?hashes" nullFilter
| 63
| false
| true
| 0
| 6
| 9
| 24
| 12
| 12
| null | null |
McOmghall/homposer
|
src/Main.hs
|
bsd-3-clause
|
simpleComp :: [Music Pitch]
simpleComp =
let rithmBass = [wn, wn, wn, wn]
notesBass = [(C, 3), (F, 3), (B, 3), (G, 3)]
notesPerBass = 8
process (dur, (bas, mel)) = chord [note dur bas, transpose 12 $ Euterpea.line $ map (note $ dur/(toRational notesPerBass)) mel]
in map process $ zip rithmBass [(x, (take notesPerBass . arpeggiate Major) x) | x <- notesBass]
| 381
|
simpleComp :: [Music Pitch]
simpleComp =
let rithmBass = [wn, wn, wn, wn]
notesBass = [(C, 3), (F, 3), (B, 3), (G, 3)]
notesPerBass = 8
process (dur, (bas, mel)) = chord [note dur bas, transpose 12 $ Euterpea.line $ map (note $ dur/(toRational notesPerBass)) mel]
in map process $ zip rithmBass [(x, (take notesPerBass . arpeggiate Major) x) | x <- notesBass]
| 381
|
simpleComp =
let rithmBass = [wn, wn, wn, wn]
notesBass = [(C, 3), (F, 3), (B, 3), (G, 3)]
notesPerBass = 8
process (dur, (bas, mel)) = chord [note dur bas, transpose 12 $ Euterpea.line $ map (note $ dur/(toRational notesPerBass)) mel]
in map process $ zip rithmBass [(x, (take notesPerBass . arpeggiate Major) x) | x <- notesBass]
| 353
| false
| true
| 2
| 16
| 84
| 208
| 111
| 97
| null | null |
OS2World/DEV-UTIL-HUGS
|
oldlib/BinaryRandList.hs
|
bsd-3-clause
|
lhead E = error "BinaryRandList.lhead: empty sequence"
| 54
|
lhead E = error "BinaryRandList.lhead: empty sequence"
| 54
|
lhead E = error "BinaryRandList.lhead: empty sequence"
| 54
| false
| false
| 1
| 5
| 6
| 16
| 5
| 11
| null | null |
ChristopherKing42/tagsoup
|
Text/HTML/TagSoup/Implementation.hs
|
bsd-3-clause
|
entityChr x s | isEntityNum x = chr_ $ read s
| isEntityHex x = chr_ $ fst $ head $ readHex s
where chr_ x | inRange (toInteger $ ord minBound, toInteger $ ord maxBound) x = chr $ fromInteger x
| otherwise = '?'
| 246
|
entityChr x s | isEntityNum x = chr_ $ read s
| isEntityHex x = chr_ $ fst $ head $ readHex s
where chr_ x | inRange (toInteger $ ord minBound, toInteger $ ord maxBound) x = chr $ fromInteger x
| otherwise = '?'
| 246
|
entityChr x s | isEntityNum x = chr_ $ read s
| isEntityHex x = chr_ $ fst $ head $ readHex s
where chr_ x | inRange (toInteger $ ord minBound, toInteger $ ord maxBound) x = chr $ fromInteger x
| otherwise = '?'
| 246
| false
| false
| 0
| 11
| 80
| 124
| 53
| 71
| null | null |
forste/haReFork
|
tools/base/syntax/SyntaxUtil.hs
|
bsd-3-clause
|
getOpAndArgs e =
error ("BaseSyntaxUtil.getOpAndArgs: not an infix application:\n\n"
++ pp e ++ "\n")
| 133
|
getOpAndArgs e =
error ("BaseSyntaxUtil.getOpAndArgs: not an infix application:\n\n"
++ pp e ++ "\n")
| 133
|
getOpAndArgs e =
error ("BaseSyntaxUtil.getOpAndArgs: not an infix application:\n\n"
++ pp e ++ "\n")
| 133
| false
| false
| 0
| 9
| 45
| 26
| 12
| 14
| null | null |
mikebenfield/hclaws
|
src/Math/Hclaws/Plot.hs
|
isc
|
frontToEnd :: Double -> Front -> (Double, Double)
frontToEnd maxTime Front{end = Just pt} | snd pt <= maxTime = pt
| 114
|
frontToEnd :: Double -> Front -> (Double, Double)
frontToEnd maxTime Front{end = Just pt} | snd pt <= maxTime = pt
| 114
|
frontToEnd maxTime Front{end = Just pt} | snd pt <= maxTime = pt
| 64
| false
| true
| 3
| 9
| 20
| 58
| 28
| 30
| null | null |
ozgurakgun/Idris-dev
|
src/Idris/Core/TT.hs
|
bsd-3-clause
|
safeForgetEnv env (V i) | i < length env = Just $ Var (env !! i)
| otherwise = Nothing
| 110
|
safeForgetEnv env (V i) | i < length env = Just $ Var (env !! i)
| otherwise = Nothing
| 110
|
safeForgetEnv env (V i) | i < length env = Just $ Var (env !! i)
| otherwise = Nothing
| 110
| false
| false
| 0
| 9
| 43
| 54
| 24
| 30
| null | null |
geophf/1HaskellADay
|
exercises/HAD/Y2017/M08/D01/Exercise.hs
|
mit
|
-- The terminus is when the string in the inexhaustible stream is exhausted.
termin :: Stream Char -> Bool
termin str = undefined
| 130
|
termin :: Stream Char -> Bool
termin str = undefined
| 52
|
termin str = undefined
| 22
| true
| true
| 0
| 6
| 23
| 22
| 11
| 11
| null | null |
fpco/fay
|
src/Fay/Compiler/FFI.hs
|
bsd-3-clause
|
formatFFI :: SrcSpanInfo -- ^ Source Location.
-> String -- ^ The format string.
-> [(JsName,FundamentalType)] -- ^ Arguments.
-> Compile String -- ^ The JS code.
formatFFI loc formatstr args = go formatstr where
go ('%':'*':xs) = do
these <- mapM inject (zipWith const [1..] args)
rest <- go xs
return (intercalate "," these ++ rest)
go ('%':'%':xs) = do
rest <- go xs
return ('%' : rest)
go ['%'] = throwError (FfiFormatIncompleteArg loc)
go ('%':(span isDigit -> (op,xs))) =
case readMay op of
Nothing -> throwError (FfiFormatBadChars loc op)
Just n -> do
this <- inject n
rest <- go xs
return (this ++ rest)
go (x:xs) = do rest <- go xs
return (x : rest)
go [] = return []
inject n =
case listToMaybe (drop (n-1) args) of
Nothing -> throwError (FfiFormatNoSuchArg loc n)
Just (arg,typ) ->
return (printJSString (fayToJs SerializeAnywhere typ (JsName arg)))
-- | Generate n name-typ pairs from the given list.
| 1,101
|
formatFFI :: SrcSpanInfo -- ^ Source Location.
-> String -- ^ The format string.
-> [(JsName,FundamentalType)] -- ^ Arguments.
-> Compile String
formatFFI loc formatstr args = go formatstr where
go ('%':'*':xs) = do
these <- mapM inject (zipWith const [1..] args)
rest <- go xs
return (intercalate "," these ++ rest)
go ('%':'%':xs) = do
rest <- go xs
return ('%' : rest)
go ['%'] = throwError (FfiFormatIncompleteArg loc)
go ('%':(span isDigit -> (op,xs))) =
case readMay op of
Nothing -> throwError (FfiFormatBadChars loc op)
Just n -> do
this <- inject n
rest <- go xs
return (this ++ rest)
go (x:xs) = do rest <- go xs
return (x : rest)
go [] = return []
inject n =
case listToMaybe (drop (n-1) args) of
Nothing -> throwError (FfiFormatNoSuchArg loc n)
Just (arg,typ) ->
return (printJSString (fayToJs SerializeAnywhere typ (JsName arg)))
-- | Generate n name-typ pairs from the given list.
| 1,071
|
formatFFI loc formatstr args = go formatstr where
go ('%':'*':xs) = do
these <- mapM inject (zipWith const [1..] args)
rest <- go xs
return (intercalate "," these ++ rest)
go ('%':'%':xs) = do
rest <- go xs
return ('%' : rest)
go ['%'] = throwError (FfiFormatIncompleteArg loc)
go ('%':(span isDigit -> (op,xs))) =
case readMay op of
Nothing -> throwError (FfiFormatBadChars loc op)
Just n -> do
this <- inject n
rest <- go xs
return (this ++ rest)
go (x:xs) = do rest <- go xs
return (x : rest)
go [] = return []
inject n =
case listToMaybe (drop (n-1) args) of
Nothing -> throwError (FfiFormatNoSuchArg loc n)
Just (arg,typ) ->
return (printJSString (fayToJs SerializeAnywhere typ (JsName arg)))
-- | Generate n name-typ pairs from the given list.
| 861
| true
| true
| 0
| 14
| 347
| 422
| 207
| 215
| null | null |
unhammer/bytestring-trie-0.2.4
|
test/Data/Trie/Test.hs
|
bsd-3-clause
|
----------------------------------------------------------------
-- | Lift a function to apply to the first of pairs, retaining the second.
first :: (a -> b) -> (a,c) -> (b,c)
first f (x,y) = (f x, y)
| 200
|
first :: (a -> b) -> (a,c) -> (b,c)
first f (x,y) = (f x, y)
| 60
|
first f (x,y) = (f x, y)
| 24
| true
| true
| 0
| 7
| 31
| 65
| 36
| 29
| null | null |
input-output-hk/pos-haskell-prototype
|
auxx/src/Lang/DisplayError.hs
|
mit
|
ppParseError :: ParseError -> Doc
ppParseError (ParseError str (Report _ expected unconsumed)) =
"Parse error at" <+> text (show span)
<$> "Unexpected" <+> text unconsumedDesc `mappend` ", expected"
<+> hcat (punctuate (text ", or ") $ map text expected)
<$> renderLines
where
unconsumedDesc = maybe "end of input" show . (fmap fst . uncons) . fmap snd $ unconsumed
strLines = nonEmpty $ take spanLines . drop (spanLineStart - 1) $ lines str
renderLines = case strLines of
Nothing ->
-- This can only happen if megaparsec's 'getPosition' somehow
-- returned line number bigger than the actual amount of
-- lines in the input text.
error "ppParseError/renderLines: span is outside of the input bounds"
Just (line :| []) -> renderLine (spanColumnStart - 1) (spanColumnEnd - 1) line
Just (line :| (line' : ls')) -> let ls = line' :| ls' in
renderLine (spanColumnStart - 1) (length line) line
<$> (vcat . map renderFullLine . NE.init $ ls)
<$> renderLine 0 (spanColumnEnd - 1) (NE.last ls)
spanColumnStart = fromIntegral . toNat . locColumn . spanStart $ span
spanColumnEnd = fromIntegral . toNat . locColumn . spanEnd $ span
spanLineStart = fromIntegral . toNat . locLine . spanStart $ span
spanLineEnd = fromIntegral . toNat . locLine . spanEnd $ span
spanLines = spanLineEnd - spanLineStart + 1
strEndLoc = loc 1 (fromInteger . toInteger . length $ str)
addColumn col l = loc (locLine l) (locColumn l + col)
isTokenUnknown = isRight . matching _TokenUnknown
unknownSpans :: [Span]
unknownSpans = map fst . takeWhile (isTokenUnknown . snd) $ unconsumed
span = NE.head $
case nonEmpty (joinAsc unknownSpans) <|> nonEmpty (map fst unconsumed) of
Nothing -> spanFromTo strEndLoc (addColumn 1 strEndLoc) :|[]
Just x -> x
| 1,950
|
ppParseError :: ParseError -> Doc
ppParseError (ParseError str (Report _ expected unconsumed)) =
"Parse error at" <+> text (show span)
<$> "Unexpected" <+> text unconsumedDesc `mappend` ", expected"
<+> hcat (punctuate (text ", or ") $ map text expected)
<$> renderLines
where
unconsumedDesc = maybe "end of input" show . (fmap fst . uncons) . fmap snd $ unconsumed
strLines = nonEmpty $ take spanLines . drop (spanLineStart - 1) $ lines str
renderLines = case strLines of
Nothing ->
-- This can only happen if megaparsec's 'getPosition' somehow
-- returned line number bigger than the actual amount of
-- lines in the input text.
error "ppParseError/renderLines: span is outside of the input bounds"
Just (line :| []) -> renderLine (spanColumnStart - 1) (spanColumnEnd - 1) line
Just (line :| (line' : ls')) -> let ls = line' :| ls' in
renderLine (spanColumnStart - 1) (length line) line
<$> (vcat . map renderFullLine . NE.init $ ls)
<$> renderLine 0 (spanColumnEnd - 1) (NE.last ls)
spanColumnStart = fromIntegral . toNat . locColumn . spanStart $ span
spanColumnEnd = fromIntegral . toNat . locColumn . spanEnd $ span
spanLineStart = fromIntegral . toNat . locLine . spanStart $ span
spanLineEnd = fromIntegral . toNat . locLine . spanEnd $ span
spanLines = spanLineEnd - spanLineStart + 1
strEndLoc = loc 1 (fromInteger . toInteger . length $ str)
addColumn col l = loc (locLine l) (locColumn l + col)
isTokenUnknown = isRight . matching _TokenUnknown
unknownSpans :: [Span]
unknownSpans = map fst . takeWhile (isTokenUnknown . snd) $ unconsumed
span = NE.head $
case nonEmpty (joinAsc unknownSpans) <|> nonEmpty (map fst unconsumed) of
Nothing -> spanFromTo strEndLoc (addColumn 1 strEndLoc) :|[]
Just x -> x
| 1,950
|
ppParseError (ParseError str (Report _ expected unconsumed)) =
"Parse error at" <+> text (show span)
<$> "Unexpected" <+> text unconsumedDesc `mappend` ", expected"
<+> hcat (punctuate (text ", or ") $ map text expected)
<$> renderLines
where
unconsumedDesc = maybe "end of input" show . (fmap fst . uncons) . fmap snd $ unconsumed
strLines = nonEmpty $ take spanLines . drop (spanLineStart - 1) $ lines str
renderLines = case strLines of
Nothing ->
-- This can only happen if megaparsec's 'getPosition' somehow
-- returned line number bigger than the actual amount of
-- lines in the input text.
error "ppParseError/renderLines: span is outside of the input bounds"
Just (line :| []) -> renderLine (spanColumnStart - 1) (spanColumnEnd - 1) line
Just (line :| (line' : ls')) -> let ls = line' :| ls' in
renderLine (spanColumnStart - 1) (length line) line
<$> (vcat . map renderFullLine . NE.init $ ls)
<$> renderLine 0 (spanColumnEnd - 1) (NE.last ls)
spanColumnStart = fromIntegral . toNat . locColumn . spanStart $ span
spanColumnEnd = fromIntegral . toNat . locColumn . spanEnd $ span
spanLineStart = fromIntegral . toNat . locLine . spanStart $ span
spanLineEnd = fromIntegral . toNat . locLine . spanEnd $ span
spanLines = spanLineEnd - spanLineStart + 1
strEndLoc = loc 1 (fromInteger . toInteger . length $ str)
addColumn col l = loc (locLine l) (locColumn l + col)
isTokenUnknown = isRight . matching _TokenUnknown
unknownSpans :: [Span]
unknownSpans = map fst . takeWhile (isTokenUnknown . snd) $ unconsumed
span = NE.head $
case nonEmpty (joinAsc unknownSpans) <|> nonEmpty (map fst unconsumed) of
Nothing -> spanFromTo strEndLoc (addColumn 1 strEndLoc) :|[]
Just x -> x
| 1,916
| false
| true
| 37
| 16
| 519
| 683
| 309
| 374
| null | null |
edsko/cabal
|
Cabal/src/Distribution/Simple/LocalBuildInfo.hs
|
bsd-3-clause
|
-- | Extract the 'ComponentId' from the library component of a
-- 'LocalBuildInfo' if it exists, or make a fake component ID based
-- on the package ID.
localComponentId :: LocalBuildInfo -> ComponentId
localComponentId lbi
= case localUnitId lbi of
SimpleUnitId cid -> cid
-- | Extract the 'UnitId' from the library component of a
-- 'LocalBuildInfo' if it exists, or make a fake unit ID based on
-- the package ID.
| 429
|
localComponentId :: LocalBuildInfo -> ComponentId
localComponentId lbi
= case localUnitId lbi of
SimpleUnitId cid -> cid
-- | Extract the 'UnitId' from the library component of a
-- 'LocalBuildInfo' if it exists, or make a fake unit ID based on
-- the package ID.
| 276
|
localComponentId lbi
= case localUnitId lbi of
SimpleUnitId cid -> cid
-- | Extract the 'UnitId' from the library component of a
-- 'LocalBuildInfo' if it exists, or make a fake unit ID based on
-- the package ID.
| 226
| true
| true
| 0
| 8
| 84
| 40
| 22
| 18
| null | null |
ihc/futhark
|
src/Language/Futhark/Attributes.hs
|
isc
|
peelArray n (Array (RecordArray ts shape _))
| shapeRank shape == n =
Just $ Record $ fmap asType ts
where asType (PrimArrayElem bt _) = Prim bt
asType (PolyArrayElem bt targs _ _) = TypeVar bt targs
asType (ArrayArrayElem at) = Array at
asType (RecordArrayElem ts') = Record $ fmap asType ts'
| 329
|
peelArray n (Array (RecordArray ts shape _))
| shapeRank shape == n =
Just $ Record $ fmap asType ts
where asType (PrimArrayElem bt _) = Prim bt
asType (PolyArrayElem bt targs _ _) = TypeVar bt targs
asType (ArrayArrayElem at) = Array at
asType (RecordArrayElem ts') = Record $ fmap asType ts'
| 329
|
peelArray n (Array (RecordArray ts shape _))
| shapeRank shape == n =
Just $ Record $ fmap asType ts
where asType (PrimArrayElem bt _) = Prim bt
asType (PolyArrayElem bt targs _ _) = TypeVar bt targs
asType (ArrayArrayElem at) = Array at
asType (RecordArrayElem ts') = Record $ fmap asType ts'
| 329
| false
| false
| 3
| 9
| 88
| 137
| 65
| 72
| null | null |
phylake/json-for-git
|
Text/JSON/Git/Pretty.hs
|
mit
|
pp_boolean False = text "false"
| 32
|
pp_boolean False = text "false"
| 32
|
pp_boolean False = text "false"
| 32
| false
| false
| 1
| 5
| 5
| 16
| 5
| 11
| null | null |
markuspf/Idris-dev
|
src/Idris/Output.hs
|
bsd-3-clause
|
idemodePutSExp :: SExpable a => String -> a -> Idris ()
idemodePutSExp cmd info = do i <- getIState
case idris_outputmode i of
IdeMode n h ->
runIO . hPutStrLn h $
convSExp cmd info n
_ -> return ()
-- TODO: send structured output similar to the metavariable list
| 423
|
idemodePutSExp :: SExpable a => String -> a -> Idris ()
idemodePutSExp cmd info = do i <- getIState
case idris_outputmode i of
IdeMode n h ->
runIO . hPutStrLn h $
convSExp cmd info n
_ -> return ()
-- TODO: send structured output similar to the metavariable list
| 423
|
idemodePutSExp cmd info = do i <- getIState
case idris_outputmode i of
IdeMode n h ->
runIO . hPutStrLn h $
convSExp cmd info n
_ -> return ()
-- TODO: send structured output similar to the metavariable list
| 367
| false
| true
| 0
| 13
| 209
| 99
| 44
| 55
| null | null |
vTurbine/ghc
|
compiler/cmm/PprC.hs
|
bsd-3-clause
|
pprTop (CmmData _section (Statics lbl lits)) =
pprDataExterns lits $$
pprWordArray lbl lits
| 95
|
pprTop (CmmData _section (Statics lbl lits)) =
pprDataExterns lits $$
pprWordArray lbl lits
| 95
|
pprTop (CmmData _section (Statics lbl lits)) =
pprDataExterns lits $$
pprWordArray lbl lits
| 95
| false
| false
| 0
| 9
| 16
| 37
| 17
| 20
| null | null |
grandpascorpion/canon
|
Math/NumberTheory/Canon/Internals.hs
|
gpl-3.0
|
crLCM PZero _ = cr0
| 23
|
crLCM PZero _ = cr0
| 23
|
crLCM PZero _ = cr0
| 23
| false
| false
| 0
| 4
| 8
| 13
| 5
| 8
| null | null |
snoyberg/ghc
|
compiler/codeGen/StgCmmPrim.hs
|
bsd-3-clause
|
vecElemInjectCast _ WordVec W64 = Nothing
| 48
|
vecElemInjectCast _ WordVec W64 = Nothing
| 48
|
vecElemInjectCast _ WordVec W64 = Nothing
| 48
| false
| false
| 0
| 5
| 12
| 13
| 6
| 7
| null | null |
hsyl20/HViperVM
|
lib/ViperVM/VirtualPlatform/Object.hs
|
lgpl-3.0
|
unlockObject :: Object -> STM ()
unlockObject obj = do
writeTVar (locking obj) False
| 87
|
unlockObject :: Object -> STM ()
unlockObject obj = do
writeTVar (locking obj) False
| 87
|
unlockObject obj = do
writeTVar (locking obj) False
| 54
| false
| true
| 0
| 10
| 16
| 42
| 18
| 24
| null | null |
techtangents/ablist
|
test/AbListTests.hs
|
bsd-3-clause
|
p_abToPairs_0 :: Bool
p_abToPairs_0 = abToPairs AbNil == ([] :: [(Int,Float)])
| 78
|
p_abToPairs_0 :: Bool
p_abToPairs_0 = abToPairs AbNil == ([] :: [(Int,Float)])
| 78
|
p_abToPairs_0 = abToPairs AbNil == ([] :: [(Int,Float)])
| 56
| false
| true
| 0
| 8
| 10
| 35
| 20
| 15
| null | null |
hpacheco/HAAP
|
examples/plab/svn/2017li1g186/src/BotHugo186.hs
|
mit
|
colideT4Batota :: Bool -> Jogo -> Tempo -> Tempo -> Int -> Maybe Carro
colideT4Batota doAtualiza jogo tempo tick p = fmap (getCarro p) $ colideT4 doAtualiza Nothing jogo tempo tick p
| 182
|
colideT4Batota :: Bool -> Jogo -> Tempo -> Tempo -> Int -> Maybe Carro
colideT4Batota doAtualiza jogo tempo tick p = fmap (getCarro p) $ colideT4 doAtualiza Nothing jogo tempo tick p
| 182
|
colideT4Batota doAtualiza jogo tempo tick p = fmap (getCarro p) $ colideT4 doAtualiza Nothing jogo tempo tick p
| 111
| false
| true
| 0
| 10
| 31
| 71
| 34
| 37
| null | null |
diku-dk/futhark
|
src/Futhark/Test/Values.hs
|
isc
|
unCompound v = [v]
| 18
|
unCompound v = [v]
| 18
|
unCompound v = [v]
| 18
| false
| false
| 0
| 5
| 3
| 12
| 6
| 6
| null | null |
phadej/semver-range
|
test/Tests.hs
|
bsd-3-clause
|
tests :: TestTree
tests = testGroup "Tests" [properties]
| 56
|
tests :: TestTree
tests = testGroup "Tests" [properties]
| 56
|
tests = testGroup "Tests" [properties]
| 38
| false
| true
| 0
| 6
| 7
| 25
| 11
| 14
| null | null |
beni55/ghcjs
|
src/Compiler/JMacro/QQ.hs
|
mit
|
fixIdent _ = "_"
| 16
|
fixIdent _ = "_"
| 16
|
fixIdent _ = "_"
| 16
| false
| false
| 0
| 4
| 3
| 10
| 4
| 6
| null | null |
Brightgalrs/con-lang-gen
|
src/Out/Other.hs
|
mit
|
writeCCs :: [[Phoneme]] -> [[Phoneme]] -> Text
writeCCs onsets codas = "\n\nValid onsets: " ++ "\n/" ++ intercalate "/\n/" oList ++ "/" ++ "\n\nValid codas: " ++ "\n/" ++ intercalate "/\n/" cList ++ "/\n" where
oList = map (concatMap writePhonemeIPA) onsets
cList = map (concatMap writePhonemeIPA) codas
-- write language branches into Newick format
| 355
|
writeCCs :: [[Phoneme]] -> [[Phoneme]] -> Text
writeCCs onsets codas = "\n\nValid onsets: " ++ "\n/" ++ intercalate "/\n/" oList ++ "/" ++ "\n\nValid codas: " ++ "\n/" ++ intercalate "/\n/" cList ++ "/\n" where
oList = map (concatMap writePhonemeIPA) onsets
cList = map (concatMap writePhonemeIPA) codas
-- write language branches into Newick format
| 355
|
writeCCs onsets codas = "\n\nValid onsets: " ++ "\n/" ++ intercalate "/\n/" oList ++ "/" ++ "\n\nValid codas: " ++ "\n/" ++ intercalate "/\n/" cList ++ "/\n" where
oList = map (concatMap writePhonemeIPA) onsets
cList = map (concatMap writePhonemeIPA) codas
-- write language branches into Newick format
| 308
| false
| true
| 0
| 11
| 59
| 113
| 57
| 56
| null | null |
WraithM/opaleye-trans
|
src/Opaleye/Trans/Exception.hs
|
bsd-3-clause
|
maybeError :: T.Transaction (Maybe b) -> e -> Transaction e b
maybeError f e = withTrans f >>= maybe (throwError e) return
| 122
|
maybeError :: T.Transaction (Maybe b) -> e -> Transaction e b
maybeError f e = withTrans f >>= maybe (throwError e) return
| 122
|
maybeError f e = withTrans f >>= maybe (throwError e) return
| 60
| false
| true
| 0
| 9
| 21
| 62
| 28
| 34
| null | null |
tjakway/ghcjvm
|
compiler/basicTypes/Id.hs
|
bsd-3-clause
|
maybeModifyIdInfo Nothing id = id
| 41
|
maybeModifyIdInfo Nothing id = id
| 41
|
maybeModifyIdInfo Nothing id = id
| 41
| false
| false
| 1
| 5
| 12
| 16
| 5
| 11
| null | null |
nbrk/datmap2html
|
MapHTML.hs
|
unlicense
|
-- w is the width of the map
tableBody :: Int -> [Loc] -> String
tableBody w ls = if null ls == False
then tableBodyRow (take w ls) ++ tableBody w (drop w ls)
else []
| 208
|
tableBody :: Int -> [Loc] -> String
tableBody w ls = if null ls == False
then tableBodyRow (take w ls) ++ tableBody w (drop w ls)
else []
| 179
|
tableBody w ls = if null ls == False
then tableBodyRow (take w ls) ++ tableBody w (drop w ls)
else []
| 143
| true
| true
| 0
| 9
| 78
| 73
| 37
| 36
| null | null |
philipcraig/hutton
|
src/Exercises/Countdown.hs
|
bsd-3-clause
|
-- Brute force solution
split :: [a] -> [([a], [a])]
split [] = []
| 66
|
split :: [a] -> [([a], [a])]
split [] = []
| 42
|
split [] = []
| 13
| true
| true
| 0
| 8
| 13
| 41
| 24
| 17
| null | null |
nuttycom/haskoin
|
Network/Haskoin/Crypto/NormalizedKeys.hs
|
unlicense
|
intAddrs :: AccPubKey -> KeyIndex -> [(Address,KeyIndex)]
intAddrs a i = mapMaybe f $ cycleIndex i
where f j = liftM2 (,) (intAddr a j) (return j)
-- | Same as 'extAddrs' with the list reversed.
| 199
|
intAddrs :: AccPubKey -> KeyIndex -> [(Address,KeyIndex)]
intAddrs a i = mapMaybe f $ cycleIndex i
where f j = liftM2 (,) (intAddr a j) (return j)
-- | Same as 'extAddrs' with the list reversed.
| 199
|
intAddrs a i = mapMaybe f $ cycleIndex i
where f j = liftM2 (,) (intAddr a j) (return j)
-- | Same as 'extAddrs' with the list reversed.
| 141
| false
| true
| 0
| 9
| 40
| 78
| 40
| 38
| null | null |
merijn/GPU-benchmarks
|
benchmark-analysis/src/OptionParsers.hs
|
gpl-3.0
|
predictorConfigsParser :: Parser (SqlM [PredictorConfig])
predictorConfigsParser = do
defImpl <- optional implParser
defStrategy <- optional mispredictionStrategyParser
predictorConfigMakers <- some multiConfigParser
pure $ concat <$> sequence
[ makePredictorConfigs defImpl defStrategy
| makePredictorConfigs <- predictorConfigMakers
]
where
multiConfigParser = asum
[ (\f x y -> pure <$> f x y) <$> rawPredictorConfigParser
, rawPredictorConfigSetParser
]
implParser :: Parser (Either Int Text)
implParser = option (Left <$> auto <|> Right <$> str) $ mconcat
[ metavar "IMPLEMENTATION", short 'i', long "default-impl"
, help "Default implementation in case of no valid prediction. \
\Numeric or textual."
]
mispredictionStrategyParser :: Parser MispredictionStrategy
mispredictionStrategyParser = option mispredictionStrategyReader $
mconcat
[ metavar "STRATEGY", long "default-strategy"
, help "Default strategy for handling mispredictions."
]
where
mispredictionStrategyReader :: ReadM MispredictionStrategy
mispredictionStrategyReader =
maybeReader $ parseMaybe parseMispredictionStrategy
| 1,296
|
predictorConfigsParser :: Parser (SqlM [PredictorConfig])
predictorConfigsParser = do
defImpl <- optional implParser
defStrategy <- optional mispredictionStrategyParser
predictorConfigMakers <- some multiConfigParser
pure $ concat <$> sequence
[ makePredictorConfigs defImpl defStrategy
| makePredictorConfigs <- predictorConfigMakers
]
where
multiConfigParser = asum
[ (\f x y -> pure <$> f x y) <$> rawPredictorConfigParser
, rawPredictorConfigSetParser
]
implParser :: Parser (Either Int Text)
implParser = option (Left <$> auto <|> Right <$> str) $ mconcat
[ metavar "IMPLEMENTATION", short 'i', long "default-impl"
, help "Default implementation in case of no valid prediction. \
\Numeric or textual."
]
mispredictionStrategyParser :: Parser MispredictionStrategy
mispredictionStrategyParser = option mispredictionStrategyReader $
mconcat
[ metavar "STRATEGY", long "default-strategy"
, help "Default strategy for handling mispredictions."
]
where
mispredictionStrategyReader :: ReadM MispredictionStrategy
mispredictionStrategyReader =
maybeReader $ parseMaybe parseMispredictionStrategy
| 1,296
|
predictorConfigsParser = do
defImpl <- optional implParser
defStrategy <- optional mispredictionStrategyParser
predictorConfigMakers <- some multiConfigParser
pure $ concat <$> sequence
[ makePredictorConfigs defImpl defStrategy
| makePredictorConfigs <- predictorConfigMakers
]
where
multiConfigParser = asum
[ (\f x y -> pure <$> f x y) <$> rawPredictorConfigParser
, rawPredictorConfigSetParser
]
implParser :: Parser (Either Int Text)
implParser = option (Left <$> auto <|> Right <$> str) $ mconcat
[ metavar "IMPLEMENTATION", short 'i', long "default-impl"
, help "Default implementation in case of no valid prediction. \
\Numeric or textual."
]
mispredictionStrategyParser :: Parser MispredictionStrategy
mispredictionStrategyParser = option mispredictionStrategyReader $
mconcat
[ metavar "STRATEGY", long "default-strategy"
, help "Default strategy for handling mispredictions."
]
where
mispredictionStrategyReader :: ReadM MispredictionStrategy
mispredictionStrategyReader =
maybeReader $ parseMaybe parseMispredictionStrategy
| 1,238
| false
| true
| 0
| 11
| 329
| 260
| 126
| 134
| null | null |
chemist/series-storage
|
src/Query/EvaluatedExpression.hs
|
bsd-3-clause
|
maybeCoerceInt (RealExpression real) = Just $ floor real
| 60
|
maybeCoerceInt (RealExpression real) = Just $ floor real
| 60
|
maybeCoerceInt (RealExpression real) = Just $ floor real
| 60
| false
| false
| 0
| 7
| 11
| 22
| 10
| 12
| null | null |
ehamberg/tapl-haskell-untyped
|
src/UntypedParser.hs
|
bsd-3-clause
|
nonleadingLetters = letter <|> digit <|> oneOf "'*&^%$"
| 55
|
nonleadingLetters = letter <|> digit <|> oneOf "'*&^%$"
| 55
|
nonleadingLetters = letter <|> digit <|> oneOf "'*&^%$"
| 55
| false
| false
| 1
| 6
| 7
| 20
| 8
| 12
| null | null |
eraserhd/onesock
|
ScanDB.hs
|
gpl-3.0
|
est_storeScanWritesFile =
"storeScan writes files" ~: TestCase $
withTestDb $ \db -> do
id <- randomIO :: IO UUID
sampleBitmap <- makeSampleBitmap
now <- getCurrentTime
let scan = Scan{scanId = id, scanTime = now}
storeScan db scan sampleBitmap
let pngFname = dbPath db ++ "/scans/" ++ show id ++ ".png"
doesFileExist pngFname >>= assertBool "image file does not exist"
let yamlFname = dbPath db ++ "/scans/" ++ show id ++ ".yaml"
doesFileExist yamlFname >>= assertBool "yaml file does not exist"
-- | Retrieve a scan from a scan database
| 633
|
test_storeScanWritesFile =
"storeScan writes files" ~: TestCase $
withTestDb $ \db -> do
id <- randomIO :: IO UUID
sampleBitmap <- makeSampleBitmap
now <- getCurrentTime
let scan = Scan{scanId = id, scanTime = now}
storeScan db scan sampleBitmap
let pngFname = dbPath db ++ "/scans/" ++ show id ++ ".png"
doesFileExist pngFname >>= assertBool "image file does not exist"
let yamlFname = dbPath db ++ "/scans/" ++ show id ++ ".yaml"
doesFileExist yamlFname >>= assertBool "yaml file does not exist"
-- | Retrieve a scan from a scan database
| 633
|
test_storeScanWritesFile =
"storeScan writes files" ~: TestCase $
withTestDb $ \db -> do
id <- randomIO :: IO UUID
sampleBitmap <- makeSampleBitmap
now <- getCurrentTime
let scan = Scan{scanId = id, scanTime = now}
storeScan db scan sampleBitmap
let pngFname = dbPath db ++ "/scans/" ++ show id ++ ".png"
doesFileExist pngFname >>= assertBool "image file does not exist"
let yamlFname = dbPath db ++ "/scans/" ++ show id ++ ".yaml"
doesFileExist yamlFname >>= assertBool "yaml file does not exist"
-- | Retrieve a scan from a scan database
| 633
| false
| false
| 0
| 15
| 183
| 164
| 76
| 88
| null | null |
karamellpelle/MEnv
|
source/OpenGL/IOS/Values.hs
|
bsd-2-clause
|
gl_VERTEX_ATTRIB_ARRAY_ENABLED :: GLenum
gl_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622
| 81
|
gl_VERTEX_ATTRIB_ARRAY_ENABLED :: GLenum
gl_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622
| 81
|
gl_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622
| 40
| false
| true
| 0
| 4
| 6
| 11
| 6
| 5
| null | null |
basvandijk/usb-safe
|
System/USB/Safe.hs
|
bsd-3-clause
|
setAlternateWhich ∷ ∀ pr cr sCfg s α
. (pr `AncestorRegion` RegionT s cr, RegionControlIO cr)
⇒ RegionalInterfaceHandle sCfg pr -- ^ Regional handle to the
-- interface for which you want
-- to set an alternate.
→ (USB.InterfaceDesc → Bool) -- ^ Predicate on the interface
-- descriptor.
→ (∀ sAlt. AlternateHandle sAlt pr → RegionT s cr α) -- ^ Continuation function
→ RegionT s cr α
setAlternateWhich h = useWhich (getAlternates h) setAlternate
| 703
|
setAlternateWhich ∷ ∀ pr cr sCfg s α
. (pr `AncestorRegion` RegionT s cr, RegionControlIO cr)
⇒ RegionalInterfaceHandle sCfg pr -- ^ Regional handle to the
-- interface for which you want
-- to set an alternate.
→ (USB.InterfaceDesc → Bool) -- ^ Predicate on the interface
-- descriptor.
→ (∀ sAlt. AlternateHandle sAlt pr → RegionT s cr α) -- ^ Continuation function
→ RegionT s cr α
setAlternateWhich h = useWhich (getAlternates h) setAlternate
| 703
|
setAlternateWhich h = useWhich (getAlternates h) setAlternate
| 61
| false
| true
| 0
| 14
| 332
| 127
| 67
| 60
| null | null |
supermario/hilt
|
src/Hilt/Channel/Stm.hs
|
bsd-3-clause
|
readImpl :: TChan a -> IO a
readImpl chan = atomically $ readTChan chan
| 71
|
readImpl :: TChan a -> IO a
readImpl chan = atomically $ readTChan chan
| 71
|
readImpl chan = atomically $ readTChan chan
| 43
| false
| true
| 0
| 6
| 13
| 31
| 14
| 17
| null | null |
HaskellZhangSong/derive-topdown
|
src/Data/Derive/TopDown/Standalone.hs
|
mit
|
strategy_derivings :: DerivStrategy
-> [Name]
-> Name
-> Q [Dec]
strategy_derivings st cns tn = fmap concat $ (mapM (\x -> strategy_deriving st x tn) cns)
| 212
|
strategy_derivings :: DerivStrategy
-> [Name]
-> Name
-> Q [Dec]
strategy_derivings st cns tn = fmap concat $ (mapM (\x -> strategy_deriving st x tn) cns)
| 211
|
strategy_derivings st cns tn = fmap concat $ (mapM (\x -> strategy_deriving st x tn) cns)
| 89
| false
| true
| 0
| 10
| 83
| 69
| 35
| 34
| null | null |
kawamuray/ganeti
|
src/Ganeti/Constants.hs
|
gpl-2.0
|
exitFailure :: Int
exitFailure = ConstantUtils.exitFailure
| 58
|
exitFailure :: Int
exitFailure = ConstantUtils.exitFailure
| 58
|
exitFailure = ConstantUtils.exitFailure
| 39
| false
| true
| 0
| 5
| 5
| 13
| 7
| 6
| null | null |
bos/filemanip
|
System/FilePath/GlobPattern.hs
|
bsd-3-clause
|
matchTerms (MatchChar:ts) (_:cs) = matchTerms ts cs
| 51
|
matchTerms (MatchChar:ts) (_:cs) = matchTerms ts cs
| 51
|
matchTerms (MatchChar:ts) (_:cs) = matchTerms ts cs
| 51
| false
| false
| 1
| 7
| 6
| 32
| 15
| 17
| null | null |
christiaanb/ghc
|
compiler/simplCore/CoreMonad.hs
|
bsd-3-clause
|
plusWriter :: CoreWriter -> CoreWriter -> CoreWriter
plusWriter w1 w2 = CoreWriter {
cw_simpl_count = (cw_simpl_count w1) `plusSimplCount` (cw_simpl_count w2)
}
| 172
|
plusWriter :: CoreWriter -> CoreWriter -> CoreWriter
plusWriter w1 w2 = CoreWriter {
cw_simpl_count = (cw_simpl_count w1) `plusSimplCount` (cw_simpl_count w2)
}
| 172
|
plusWriter w1 w2 = CoreWriter {
cw_simpl_count = (cw_simpl_count w1) `plusSimplCount` (cw_simpl_count w2)
}
| 119
| false
| true
| 0
| 10
| 32
| 55
| 28
| 27
| null | null |
davideGiovannini/scheme-repl
|
src/Evaluation.hs
|
bsd-3-clause
|
controlBegin :: Env -> IOLispFunction
controlBegin env (first:rest) = last <$> mapM (eval env) (first:rest)
| 107
|
controlBegin :: Env -> IOLispFunction
controlBegin env (first:rest) = last <$> mapM (eval env) (first:rest)
| 107
|
controlBegin env (first:rest) = last <$> mapM (eval env) (first:rest)
| 69
| false
| true
| 0
| 9
| 14
| 54
| 26
| 28
| null | null |
geophf/1HaskellADay
|
exercises/HAD/Y2018/M04/D06/Exercise.hs
|
mit
|
-- now convert the list of categories to a LookupTable
cats2lk :: [Category] -> LookupTable
cats2lk cats = undefined
| 117
|
cats2lk :: [Category] -> LookupTable
cats2lk cats = undefined
| 61
|
cats2lk cats = undefined
| 24
| true
| true
| 0
| 6
| 19
| 22
| 12
| 10
| null | null |
brendanhay/gogol
|
gogol-accesscontextmanager/gen/Network/Google/Resource/AccessContextManager/AccessPolicies/AccessLevels/Get.hs
|
mpl-2.0
|
-- | Whether to return \`BasicLevels\` in the Cloud Common Expression
-- Language rather than as \`BasicLevels\`. Defaults to AS_DEFINED, where
-- Access Levels are returned as \`BasicLevels\` or \`CustomLevels\` based
-- on how they were created. If set to CEL, all Access Levels are returned
-- as \`CustomLevels\`. In the CEL case, \`BasicLevels\` are translated to
-- equivalent \`CustomLevels\`.
apalgAccessLevelFormat :: Lens' AccessPoliciesAccessLevelsGet (Maybe AccessPoliciesAccessLevelsGetAccessLevelFormat)
apalgAccessLevelFormat
= lens _apalgAccessLevelFormat
(\ s a -> s{_apalgAccessLevelFormat = a})
| 621
|
apalgAccessLevelFormat :: Lens' AccessPoliciesAccessLevelsGet (Maybe AccessPoliciesAccessLevelsGetAccessLevelFormat)
apalgAccessLevelFormat
= lens _apalgAccessLevelFormat
(\ s a -> s{_apalgAccessLevelFormat = a})
| 220
|
apalgAccessLevelFormat
= lens _apalgAccessLevelFormat
(\ s a -> s{_apalgAccessLevelFormat = a})
| 103
| true
| true
| 0
| 9
| 84
| 53
| 30
| 23
| null | null |
Alex-Diez/haskell-tdd-kata
|
old-katas/src/BowlingKata/Day6.hs
|
bsd-3-clause
|
score (x:y:z:xs) | x == 10 = 10 + y + z + score (y:z:xs)
| (x + y) == 10 = 10 + z + score (z:xs)
| otherwise = x + y + score (z:xs)
| 182
|
score (x:y:z:xs) | x == 10 = 10 + y + z + score (y:z:xs)
| (x + y) == 10 = 10 + z + score (z:xs)
| otherwise = x + y + score (z:xs)
| 182
|
score (x:y:z:xs) | x == 10 = 10 + y + z + score (y:z:xs)
| (x + y) == 10 = 10 + z + score (z:xs)
| otherwise = x + y + score (z:xs)
| 182
| false
| false
| 0
| 10
| 87
| 125
| 61
| 64
| null | null |
sphynx/hamisado
|
AI/API/My.hs
|
bsd-3-clause
|
runAlgo :: Board b =>
((Position b -> Int) -> Depth -> Position b -> (Position b, Score))
-> Evaluation -> Position b -> Depth -> (PV, Score)
runAlgo algoFn eval r d =
let (r1, score) = algoFn (evalFn eval) d r
pv = drop (pMoveNo r) $ reverse (pMoves r1)
in (pv, score)
| 304
|
runAlgo :: Board b =>
((Position b -> Int) -> Depth -> Position b -> (Position b, Score))
-> Evaluation -> Position b -> Depth -> (PV, Score)
runAlgo algoFn eval r d =
let (r1, score) = algoFn (evalFn eval) d r
pv = drop (pMoveNo r) $ reverse (pMoves r1)
in (pv, score)
| 304
|
runAlgo algoFn eval r d =
let (r1, score) = algoFn (evalFn eval) d r
pv = drop (pMoveNo r) $ reverse (pMoves r1)
in (pv, score)
| 140
| false
| true
| 0
| 13
| 89
| 159
| 78
| 81
| null | null |
conal/reify-core
|
src/ReifyCore/Reify.hs
|
bsd-3-clause
|
isPrimOrRepMeth :: Var -> [Type] -> Bool
isPrimOrRepMeth (fqVarName -> name) tys =
isRepMeth name || (isPrimitiveName name && all isPrimitiveTy tys)
| 150
|
isPrimOrRepMeth :: Var -> [Type] -> Bool
isPrimOrRepMeth (fqVarName -> name) tys =
isRepMeth name || (isPrimitiveName name && all isPrimitiveTy tys)
| 150
|
isPrimOrRepMeth (fqVarName -> name) tys =
isRepMeth name || (isPrimitiveName name && all isPrimitiveTy tys)
| 109
| false
| true
| 1
| 10
| 23
| 63
| 30
| 33
| null | null |
bitemyapp/machines-play
|
Main.hs
|
bsd-3-clause
|
-- Turn the Mealy state machine into a process
m2a :: Monad m => MachineT m (Is Char) M1State
m2a = auto m2
| 107
|
m2a :: Monad m => MachineT m (Is Char) M1State
m2a = auto m2
| 60
|
m2a = auto m2
| 13
| true
| true
| 0
| 9
| 22
| 40
| 18
| 22
| null | null |
batterseapower/machine-learning
|
Algorithms/MachineLearning/Utilities.hs
|
gpl-2.0
|
chunk :: Int -> [a] -> [[a]]
chunk _ [] = []
| 44
|
chunk :: Int -> [a] -> [[a]]
chunk _ [] = []
| 44
|
chunk _ [] = []
| 15
| false
| true
| 0
| 10
| 11
| 43
| 21
| 22
| null | null |
kadena-io/pact
|
src-tool/Pact/Analyze/Parse/Prop.hs
|
bsd-3-clause
|
-- | Convert an @Exp@ to a @Check@ in an environment where the variables have
-- types.
expToCheck
:: TableEnv
-- ^ Tables and schemas in scope
-> VarId
-- ^ ID to start issuing from
-> Map Text VarId
-- ^ Environment mapping names to var IDs
-> Map VarId EType
-- ^ Environment mapping var IDs to their types
-> HM.HashMap Text EProp
-- ^ Environment mapping names to constants
-> HM.HashMap Text (DefinedProperty (Exp Info))
-- ^ Defined props in the environment
-> (Prop 'TyBool -> Check)
-- ^ The style of check to use ('PropertyHolds', 'SucceedsWhen', or
-- 'FailsWhen')
-> Exp Info
-- ^ Exp to convert
-> Either String Check
expToCheck tableEnv' genStart nameEnv idEnv consts propDefs mkCheck body =
mkCheck . prenexConvert
<$> expToProp tableEnv' genStart nameEnv idEnv consts propDefs SBool body
| 845
|
expToCheck
:: TableEnv
-- ^ Tables and schemas in scope
-> VarId
-- ^ ID to start issuing from
-> Map Text VarId
-- ^ Environment mapping names to var IDs
-> Map VarId EType
-- ^ Environment mapping var IDs to their types
-> HM.HashMap Text EProp
-- ^ Environment mapping names to constants
-> HM.HashMap Text (DefinedProperty (Exp Info))
-- ^ Defined props in the environment
-> (Prop 'TyBool -> Check)
-- ^ The style of check to use ('PropertyHolds', 'SucceedsWhen', or
-- 'FailsWhen')
-> Exp Info
-- ^ Exp to convert
-> Either String Check
expToCheck tableEnv' genStart nameEnv idEnv consts propDefs mkCheck body =
mkCheck . prenexConvert
<$> expToProp tableEnv' genStart nameEnv idEnv consts propDefs SBool body
| 757
|
expToCheck tableEnv' genStart nameEnv idEnv consts propDefs mkCheck body =
mkCheck . prenexConvert
<$> expToProp tableEnv' genStart nameEnv idEnv consts propDefs SBool body
| 178
| true
| true
| 0
| 16
| 179
| 156
| 79
| 77
| null | null |
tpsinnem/Idris-dev
|
src/Idris/AbsSyntaxTree.hs
|
bsd-3-clause
|
getImps (_ : xs) = getImps xs
| 44
|
getImps (_ : xs) = getImps xs
| 44
|
getImps (_ : xs) = getImps xs
| 44
| false
| false
| 0
| 7
| 21
| 19
| 9
| 10
| null | null |
ku-fpg/hermit-streamfusion
|
PaperResults.hs
|
mit
|
vectorCmCm :: Int -> Int
vectorCmCm n = VS.foldl' (+) 0
$ VS.concatMap (\x -> VS.concatMap (\y -> VS.enumFromStepN y 1 (x-y+1)) $
VS.enumFromStepN 1 1 x)
$ VS.enumFromStepN 1 1 n
| 256
|
vectorCmCm :: Int -> Int
vectorCmCm n = VS.foldl' (+) 0
$ VS.concatMap (\x -> VS.concatMap (\y -> VS.enumFromStepN y 1 (x-y+1)) $
VS.enumFromStepN 1 1 x)
$ VS.enumFromStepN 1 1 n
| 255
|
vectorCmCm n = VS.foldl' (+) 0
$ VS.concatMap (\x -> VS.concatMap (\y -> VS.enumFromStepN y 1 (x-y+1)) $
VS.enumFromStepN 1 1 x)
$ VS.enumFromStepN 1 1 n
| 230
| false
| true
| 4
| 14
| 109
| 111
| 53
| 58
| null | null |
Thell/pandoc
|
src/Text/Pandoc/Writers/OpenDocument.hs
|
gpl-2.0
|
colHeadsToOpenDocument :: WriterOptions -> String -> [String] -> [[Block]] -> State WriterState Doc
colHeadsToOpenDocument o tn ns hs =
inTagsIndented "table:table-header-rows" . inTagsIndented "table:table-row" . vcat <$>
mapM (tableItemToOpenDocument o tn) (zip ns hs)
| 278
|
colHeadsToOpenDocument :: WriterOptions -> String -> [String] -> [[Block]] -> State WriterState Doc
colHeadsToOpenDocument o tn ns hs =
inTagsIndented "table:table-header-rows" . inTagsIndented "table:table-row" . vcat <$>
mapM (tableItemToOpenDocument o tn) (zip ns hs)
| 278
|
colHeadsToOpenDocument o tn ns hs =
inTagsIndented "table:table-header-rows" . inTagsIndented "table:table-row" . vcat <$>
mapM (tableItemToOpenDocument o tn) (zip ns hs)
| 178
| false
| true
| 0
| 10
| 41
| 89
| 44
| 45
| null | null |
Mokosha/ggj14-Refined-Palette
|
Render.hs
|
mit
|
loadBGColorMap :: IO (ColorMap)
loadBGColorMap = do
yellow <- getDataFileName ("flower-yellow-blue-pattern" <.> "png") >>= texturedQuad
orange <- getDataFileName ("strange-fruit-orange-green-pattern" <.> "png") >>= texturedQuad
return $ Map.fromList [
(Yellow, yellow),
(Orange, orange),
(Green, yellow), -- FIXME
(Blue, orange), -- FIXME
(Red, yellow), -- FIXME
(Purple, orange)] -- FIXME
| 419
|
loadBGColorMap :: IO (ColorMap)
loadBGColorMap = do
yellow <- getDataFileName ("flower-yellow-blue-pattern" <.> "png") >>= texturedQuad
orange <- getDataFileName ("strange-fruit-orange-green-pattern" <.> "png") >>= texturedQuad
return $ Map.fromList [
(Yellow, yellow),
(Orange, orange),
(Green, yellow), -- FIXME
(Blue, orange), -- FIXME
(Red, yellow), -- FIXME
(Purple, orange)] -- FIXME
| 419
|
loadBGColorMap = do
yellow <- getDataFileName ("flower-yellow-blue-pattern" <.> "png") >>= texturedQuad
orange <- getDataFileName ("strange-fruit-orange-green-pattern" <.> "png") >>= texturedQuad
return $ Map.fromList [
(Yellow, yellow),
(Orange, orange),
(Green, yellow), -- FIXME
(Blue, orange), -- FIXME
(Red, yellow), -- FIXME
(Purple, orange)] -- FIXME
| 387
| false
| true
| 0
| 12
| 76
| 135
| 75
| 60
| null | null |
ksaveljev/hake-2
|
src/Game/GameFunc.hs
|
bsd-3-clause
|
doorNoMonster :: Int
doorNoMonster = 8
| 38
|
doorNoMonster :: Int
doorNoMonster = 8
| 38
|
doorNoMonster = 8
| 17
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
rrnewton/accelerate
|
Data/Array/Accelerate/Smart.hs
|
bsd-3-clause
|
mkChr :: Exp Int -> Exp Char
mkChr x = Exp $ PrimChr `PrimApp` x
| 64
|
mkChr :: Exp Int -> Exp Char
mkChr x = Exp $ PrimChr `PrimApp` x
| 64
|
mkChr x = Exp $ PrimChr `PrimApp` x
| 35
| false
| true
| 0
| 6
| 14
| 34
| 17
| 17
| null | null |
phischu/fragnix
|
tests/packages/scotty/System.FilePath.Windows.hs
|
bsd-3-clause
|
hasLeadingPathSeparator x = isPathSeparator (head x)
| 52
|
hasLeadingPathSeparator x = isPathSeparator (head x)
| 52
|
hasLeadingPathSeparator x = isPathSeparator (head x)
| 52
| false
| false
| 0
| 7
| 5
| 18
| 8
| 10
| null | null |
tjakway/ghcjvm
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
plusInteger_RDR = nameRdrName plusIntegerName
| 53
|
plusInteger_RDR = nameRdrName plusIntegerName
| 53
|
plusInteger_RDR = nameRdrName plusIntegerName
| 53
| false
| false
| 0
| 5
| 11
| 9
| 4
| 5
| null | null |
thomie/vector
|
Data/Vector/Primitive.hs
|
bsd-3-clause
|
span = G.span
| 13
|
span = G.span
| 13
|
span = G.span
| 13
| false
| false
| 0
| 5
| 2
| 8
| 4
| 4
| null | null |
fpco/fay-base
|
src/Data/Char.hs
|
bsd-3-clause
|
isAscii :: Char -> Bool
isAscii c = c < '\x80'
| 46
|
isAscii :: Char -> Bool
isAscii c = c < '\x80'
| 46
|
isAscii c = c < '\x80'
| 22
| false
| true
| 0
| 5
| 10
| 22
| 11
| 11
| null | null |
alexbaluta/courseography
|
dependencies/HaXml-1.25.3/src/Text/XML/HaXml/Parse.hs
|
gpl-3.0
|
contentspec :: XParser ContentSpec
contentspec =
oneOf' [ ("EMPTY", peRef (word "EMPTY") >> return EMPTY)
, ("ANY", peRef (word "ANY") >> return ANY)
, ("mixed", peRef mixed >>= return . Mixed)
, ("simple", peRef cp >>= return . ContentSpec)
]
| 296
|
contentspec :: XParser ContentSpec
contentspec =
oneOf' [ ("EMPTY", peRef (word "EMPTY") >> return EMPTY)
, ("ANY", peRef (word "ANY") >> return ANY)
, ("mixed", peRef mixed >>= return . Mixed)
, ("simple", peRef cp >>= return . ContentSpec)
]
| 296
|
contentspec =
oneOf' [ ("EMPTY", peRef (word "EMPTY") >> return EMPTY)
, ("ANY", peRef (word "ANY") >> return ANY)
, ("mixed", peRef mixed >>= return . Mixed)
, ("simple", peRef cp >>= return . ContentSpec)
]
| 261
| false
| true
| 0
| 11
| 92
| 107
| 56
| 51
| null | null |
adityagupta1089/Project-Euler-Haskell
|
src/problems/Problem493.hs
|
bsd-3-clause
|
ways :: Int -> Int -> [[Int]]
ways _ 0 = []
| 43
|
ways :: Int -> Int -> [[Int]]
ways _ 0 = []
| 43
|
ways _ 0 = []
| 13
| false
| true
| 0
| 8
| 11
| 32
| 17
| 15
| null | null |
sherwoodwang/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/Draw.hs
|
lgpl-2.1
|
-- | Default 10pt italic.
fontItalic :: FontStyle
fontItalic
= fontDefault{ _fontShape = ShapeItalic }
| 104
|
fontItalic :: FontStyle
fontItalic
= fontDefault{ _fontShape = ShapeItalic }
| 78
|
fontItalic
= fontDefault{ _fontShape = ShapeItalic }
| 54
| true
| true
| 0
| 7
| 16
| 31
| 14
| 17
| null | null |
CBMM/CBaaS
|
cbaas-frontend/src/Frontend/Canvas.hs
|
bsd-3-clause
|
save = undefined
| 16
|
save = undefined
| 16
|
save = undefined
| 16
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
jacekszymanski/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxLED_ALIGN_LEFT :: Int
wxLED_ALIGN_LEFT = 1
| 44
|
wxLED_ALIGN_LEFT :: Int
wxLED_ALIGN_LEFT = 1
| 44
|
wxLED_ALIGN_LEFT = 1
| 20
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
lesguillemets/haskell-image-filters
|
demo.hs
|
mit
|
demoPoster :: IO ()
demoPoster = do
r <- readJpeg "./assets/room.gray.jpg"
case r of
(Left st) -> putStrLn st
(Right image) ->
case image of
ImageY8 img -> do
saveJpgImage 100 "./assets/demo/posterisedroom.jpg" .
ImageY8 $ simplePosterise 5 img
return ()
_ -> return ()
| 401
|
demoPoster :: IO ()
demoPoster = do
r <- readJpeg "./assets/room.gray.jpg"
case r of
(Left st) -> putStrLn st
(Right image) ->
case image of
ImageY8 img -> do
saveJpgImage 100 "./assets/demo/posterisedroom.jpg" .
ImageY8 $ simplePosterise 5 img
return ()
_ -> return ()
| 401
|
demoPoster = do
r <- readJpeg "./assets/room.gray.jpg"
case r of
(Left st) -> putStrLn st
(Right image) ->
case image of
ImageY8 img -> do
saveJpgImage 100 "./assets/demo/posterisedroom.jpg" .
ImageY8 $ simplePosterise 5 img
return ()
_ -> return ()
| 381
| false
| true
| 0
| 17
| 175
| 113
| 51
| 62
| null | null |
DavidAlphaFox/bittorrent
|
src/Network/BitTorrent/Internal/Progress.hs
|
bsd-3-clause
|
-- | Check global /upload/ limit by downloaded \/ uploaded ratio.
canUpload :: Ratio Int -> Progress -> Bool
canUpload limit Progress {..} = _downloaded % _uploaded > ri2rw64 limit
| 180
|
canUpload :: Ratio Int -> Progress -> Bool
canUpload limit Progress {..} = _downloaded % _uploaded > ri2rw64 limit
| 114
|
canUpload limit Progress {..} = _downloaded % _uploaded > ri2rw64 limit
| 71
| true
| true
| 0
| 6
| 29
| 50
| 23
| 27
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.