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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
WraithM/haskell-opaleye
|
src/Opaleye/Internal/Aggregate.hs
|
bsd-3-clause
|
extractAggregateFields :: T.Tag -> (Maybe (HPQ.AggrOp, [HPQ.OrderExpr], HPQ.AggrDistinct), HPQ.PrimExpr)
-> PM.PM [(HPQ.Symbol, (Maybe (HPQ.AggrOp, [HPQ.OrderExpr], HPQ.AggrDistinct), HPQ.PrimExpr))] HPQ.PrimExpr
extractAggregateFields = PM.extractAttr "result"
| 267
|
extractAggregateFields :: T.Tag -> (Maybe (HPQ.AggrOp, [HPQ.OrderExpr], HPQ.AggrDistinct), HPQ.PrimExpr)
-> PM.PM [(HPQ.Symbol, (Maybe (HPQ.AggrOp, [HPQ.OrderExpr], HPQ.AggrDistinct), HPQ.PrimExpr))] HPQ.PrimExpr
extractAggregateFields = PM.extractAttr "result"
| 267
|
extractAggregateFields = PM.extractAttr "result"
| 48
| false
| true
| 0
| 14
| 27
| 104
| 58
| 46
| null | null |
rleshchinskiy/vector
|
Data/Vector/Internal/Check.hs
|
bsd-3-clause
|
False || x = x
| 14
|
False || x = x
| 14
|
False || x = x
| 14
| false
| false
| 0
| 5
| 4
| 16
| 6
| 10
| null | null |
choener/FormalGrammars
|
src/TwoTableNussinov.hs
|
gpl-3.0
|
runNussinov :: Int -> String -> (Int,[String])
runNussinov k inp = (d, take k . S.toList . unId $ axiom b) where
i = VU.fromList . Prelude.map toUpper $ inp
n = VU.length i
!(Z:.s:.t) = mutateTablesDefault
$ gNussinov bpmax
(ITbl EmptyOk (PA.fromAssocs (subword 0 0) (subword 0 n) (-999999) []))
(ITbl EmptyOk (PA.fromAssocs (subword 0 0) (subword 0 n) (-999999) []))
(chr i) Empty
:: Z:.ITbl Id Unboxed Subword Int:.ITbl Id Unboxed Subword Int
d = let ITbl _ arr _ = t in arr PA.! subword 0 n
!(Z:.b:.c) = gNussinov (bpmax <** pretty) (toBT s (undefined :: Id a -> Id a)) (toBT t (undefined :: Id a -> Id a)) (chr i) Empty
{-
type Arr = PA.Unboxed Subword Int
type Arrs = Z:.Arr:.Arr
forward :: VU.Vector Char -> ST s Arrs -- (Unboxed (Z:.Subword) Int)
forward inp = do
let n = VU.length inp
let c = chr inp
!s' <- PA.newWithM (subword 0 0) (subword 0 n) (-999999)
!t' <- PA.newWithM (subword 0 0) (subword 0 n) (-999999)
let s = MTbl EmptyOk s'
let t = MTbl EmptyOk t'
runFreezeMTbls $ gNussinov bpmax s t c Empty
{-# NOINLINE forward #-}
backtrack :: VU.Vector Char -> Arrs -> [String]
backtrack inp (Z:.s':.t') = unId . SM.toList . unId $ axiom g where
c = chr inp
(Z:.g:.h) = gNussinov (bpmax <** pretty) (BtTbl EmptyOk s') (BtTbl EmptyOk t') c Empty
{-# NOINLINE backtrack #-}
runNussinov :: Int -> String -> (Int,[String])
runNussinov k inp = (t PA.! (subword 0 n), take k b) where
i = VU.fromList . Prelude.map toUpper $ inp
n = VU.length i
(Z:.s:.t) = runST $ forward i
b = backtrack i (Z:.s:.t)
{-# NOINLINE runNussinov #-}
-}
| 1,664
|
runNussinov :: Int -> String -> (Int,[String])
runNussinov k inp = (d, take k . S.toList . unId $ axiom b) where
i = VU.fromList . Prelude.map toUpper $ inp
n = VU.length i
!(Z:.s:.t) = mutateTablesDefault
$ gNussinov bpmax
(ITbl EmptyOk (PA.fromAssocs (subword 0 0) (subword 0 n) (-999999) []))
(ITbl EmptyOk (PA.fromAssocs (subword 0 0) (subword 0 n) (-999999) []))
(chr i) Empty
:: Z:.ITbl Id Unboxed Subword Int:.ITbl Id Unboxed Subword Int
d = let ITbl _ arr _ = t in arr PA.! subword 0 n
!(Z:.b:.c) = gNussinov (bpmax <** pretty) (toBT s (undefined :: Id a -> Id a)) (toBT t (undefined :: Id a -> Id a)) (chr i) Empty
{-
type Arr = PA.Unboxed Subword Int
type Arrs = Z:.Arr:.Arr
forward :: VU.Vector Char -> ST s Arrs -- (Unboxed (Z:.Subword) Int)
forward inp = do
let n = VU.length inp
let c = chr inp
!s' <- PA.newWithM (subword 0 0) (subword 0 n) (-999999)
!t' <- PA.newWithM (subword 0 0) (subword 0 n) (-999999)
let s = MTbl EmptyOk s'
let t = MTbl EmptyOk t'
runFreezeMTbls $ gNussinov bpmax s t c Empty
{-# NOINLINE forward #-}
backtrack :: VU.Vector Char -> Arrs -> [String]
backtrack inp (Z:.s':.t') = unId . SM.toList . unId $ axiom g where
c = chr inp
(Z:.g:.h) = gNussinov (bpmax <** pretty) (BtTbl EmptyOk s') (BtTbl EmptyOk t') c Empty
{-# NOINLINE backtrack #-}
runNussinov :: Int -> String -> (Int,[String])
runNussinov k inp = (t PA.! (subword 0 n), take k b) where
i = VU.fromList . Prelude.map toUpper $ inp
n = VU.length i
(Z:.s:.t) = runST $ forward i
b = backtrack i (Z:.s:.t)
{-# NOINLINE runNussinov #-}
-}
| 1,664
|
runNussinov k inp = (d, take k . S.toList . unId $ axiom b) where
i = VU.fromList . Prelude.map toUpper $ inp
n = VU.length i
!(Z:.s:.t) = mutateTablesDefault
$ gNussinov bpmax
(ITbl EmptyOk (PA.fromAssocs (subword 0 0) (subword 0 n) (-999999) []))
(ITbl EmptyOk (PA.fromAssocs (subword 0 0) (subword 0 n) (-999999) []))
(chr i) Empty
:: Z:.ITbl Id Unboxed Subword Int:.ITbl Id Unboxed Subword Int
d = let ITbl _ arr _ = t in arr PA.! subword 0 n
!(Z:.b:.c) = gNussinov (bpmax <** pretty) (toBT s (undefined :: Id a -> Id a)) (toBT t (undefined :: Id a -> Id a)) (chr i) Empty
{-
type Arr = PA.Unboxed Subword Int
type Arrs = Z:.Arr:.Arr
forward :: VU.Vector Char -> ST s Arrs -- (Unboxed (Z:.Subword) Int)
forward inp = do
let n = VU.length inp
let c = chr inp
!s' <- PA.newWithM (subword 0 0) (subword 0 n) (-999999)
!t' <- PA.newWithM (subword 0 0) (subword 0 n) (-999999)
let s = MTbl EmptyOk s'
let t = MTbl EmptyOk t'
runFreezeMTbls $ gNussinov bpmax s t c Empty
{-# NOINLINE forward #-}
backtrack :: VU.Vector Char -> Arrs -> [String]
backtrack inp (Z:.s':.t') = unId . SM.toList . unId $ axiom g where
c = chr inp
(Z:.g:.h) = gNussinov (bpmax <** pretty) (BtTbl EmptyOk s') (BtTbl EmptyOk t') c Empty
{-# NOINLINE backtrack #-}
runNussinov :: Int -> String -> (Int,[String])
runNussinov k inp = (t PA.! (subword 0 n), take k b) where
i = VU.fromList . Prelude.map toUpper $ inp
n = VU.length i
(Z:.s:.t) = runST $ forward i
b = backtrack i (Z:.s:.t)
{-# NOINLINE runNussinov #-}
-}
| 1,617
| false
| true
| 0
| 14
| 416
| 380
| 189
| 191
| null | null |
valderman/haste-app
|
src/Haste/App.hs
|
mit
|
native _ = error "expression only available on native nodes"
| 60
|
native _ = error "expression only available on native nodes"
| 60
|
native _ = error "expression only available on native nodes"
| 60
| false
| false
| 0
| 5
| 9
| 12
| 5
| 7
| null | null |
mikegehard/haskellBookExercises
|
chapter11/Trees.hs
|
mit
|
preorder (Node left val right) = val : (preorder left ++ preorder right)
| 72
|
preorder (Node left val right) = val : (preorder left ++ preorder right)
| 72
|
preorder (Node left val right) = val : (preorder left ++ preorder right)
| 72
| false
| false
| 0
| 8
| 12
| 36
| 17
| 19
| null | null |
ezyang/ghc
|
compiler/typecheck/TcGenDeriv.hs
|
bsd-3-clause
|
gen_Ix_binds :: SrcSpan -> TyCon -> TcM (LHsBinds GhcPs, BagDerivStuff)
gen_Ix_binds loc tycon = do
dflags <- getDynFlags
return $ if isEnumerationTyCon tycon
then (enum_ixes dflags, listToBag $ map DerivAuxBind
[DerivCon2Tag tycon, DerivTag2Con tycon, DerivMaxTag tycon])
else (single_con_ixes, unitBag (DerivAuxBind (DerivCon2Tag tycon)))
where
--------------------------------------------------------------
enum_ixes dflags = listToBag
[ enum_range dflags
, enum_index dflags
, enum_inRange dflags
]
enum_range dflags
= mk_easy_FunBind loc range_RDR [nlTuplePat [a_Pat, b_Pat] Boxed] $
untag_Expr dflags tycon [(a_RDR, ah_RDR)] $
untag_Expr dflags tycon [(b_RDR, bh_RDR)] $
nlHsApp (nlHsVarApps map_RDR [tag2con_RDR dflags tycon]) $
nlHsPar (enum_from_to_Expr
(nlHsVarApps intDataCon_RDR [ah_RDR])
(nlHsVarApps intDataCon_RDR [bh_RDR]))
enum_index dflags
= mk_easy_FunBind loc unsafeIndex_RDR
[noLoc (AsPat (noLoc c_RDR)
(nlTuplePat [a_Pat, nlWildPat] Boxed)),
d_Pat] (
untag_Expr dflags tycon [(a_RDR, ah_RDR)] (
untag_Expr dflags tycon [(d_RDR, dh_RDR)] (
let
rhs = nlHsVarApps intDataCon_RDR [c_RDR]
in
nlHsCase
(genOpApp (nlHsVar dh_RDR) minusInt_RDR (nlHsVar ah_RDR))
[mkHsCaseAlt (nlVarPat c_RDR) rhs]
))
)
-- This produces something like `(ch >= ah) && (ch <= bh)`
enum_inRange dflags
= mk_easy_FunBind loc inRange_RDR [nlTuplePat [a_Pat, b_Pat] Boxed, c_Pat] $
untag_Expr dflags tycon [(a_RDR, ah_RDR)] (
untag_Expr dflags tycon [(b_RDR, bh_RDR)] (
untag_Expr dflags tycon [(c_RDR, ch_RDR)] (
-- This used to use `if`, which interacts badly with RebindableSyntax.
-- See #11396.
nlHsApps and_RDR
[ genPrimOpApp (nlHsVar ch_RDR) geInt_RDR (nlHsVar ah_RDR)
, genPrimOpApp (nlHsVar ch_RDR) leInt_RDR (nlHsVar bh_RDR)
]
)))
--------------------------------------------------------------
single_con_ixes
= listToBag [single_con_range, single_con_index, single_con_inRange]
data_con
= case tyConSingleDataCon_maybe tycon of -- just checking...
Nothing -> panic "get_Ix_binds"
Just dc -> dc
con_arity = dataConSourceArity data_con
data_con_RDR = getRdrName data_con
as_needed = take con_arity as_RDRs
bs_needed = take con_arity bs_RDRs
cs_needed = take con_arity cs_RDRs
con_pat xs = nlConVarPat data_con_RDR xs
con_expr = nlHsVarApps data_con_RDR cs_needed
--------------------------------------------------------------
single_con_range
= mk_easy_FunBind loc range_RDR
[nlTuplePat [con_pat as_needed, con_pat bs_needed] Boxed] $
noLoc (mkHsComp ListComp stmts con_expr)
where
stmts = zipWith3Equal "single_con_range" mk_qual as_needed bs_needed cs_needed
mk_qual a b c = noLoc $ mkBindStmt (nlVarPat c)
(nlHsApp (nlHsVar range_RDR)
(mkLHsVarTuple [a,b]))
----------------
single_con_index
= mk_easy_FunBind loc unsafeIndex_RDR
[nlTuplePat [con_pat as_needed, con_pat bs_needed] Boxed,
con_pat cs_needed]
-- We need to reverse the order we consider the components in
-- so that
-- range (l,u) !! index (l,u) i == i -- when i is in range
-- (from http://haskell.org/onlinereport/ix.html) holds.
(mk_index (reverse $ zip3 as_needed bs_needed cs_needed))
where
-- index (l1,u1) i1 + rangeSize (l1,u1) * (index (l2,u2) i2 + ...)
mk_index [] = nlHsIntLit 0
mk_index [(l,u,i)] = mk_one l u i
mk_index ((l,u,i) : rest)
= genOpApp (
mk_one l u i
) plus_RDR (
genOpApp (
(nlHsApp (nlHsVar unsafeRangeSize_RDR)
(mkLHsVarTuple [l,u]))
) times_RDR (mk_index rest)
)
mk_one l u i
= nlHsApps unsafeIndex_RDR [mkLHsVarTuple [l,u], nlHsVar i]
------------------
single_con_inRange
= mk_easy_FunBind loc inRange_RDR
[nlTuplePat [con_pat as_needed, con_pat bs_needed] Boxed,
con_pat cs_needed] $
if con_arity == 0
-- If the product type has no fields, inRange is trivially true
-- (see Trac #12853).
then true_Expr
else foldl1 and_Expr (zipWith3Equal "single_con_inRange" in_range
as_needed bs_needed cs_needed)
where
in_range a b c = nlHsApps inRange_RDR [mkLHsVarTuple [a,b], nlHsVar c]
{-
************************************************************************
* *
Read instances
* *
************************************************************************
Example
infix 4 %%
data T = Int %% Int
| T1 { f1 :: Int }
| T2 T
instance Read T where
readPrec =
parens
( prec 4 (
do x <- ReadP.step Read.readPrec
expectP (Symbol "%%")
y <- ReadP.step Read.readPrec
return (x %% y))
+++
prec (appPrec+1) (
-- Note the "+1" part; "T2 T1 {f1=3}" should parse ok
-- Record construction binds even more tightly than application
do expectP (Ident "T1")
expectP (Punc '{')
x <- Read.readField "f1" (ReadP.reset readPrec)
expectP (Punc '}')
return (T1 { f1 = x }))
+++
prec appPrec (
do expectP (Ident "T2")
x <- ReadP.step Read.readPrec
return (T2 x))
)
readListPrec = readListPrecDefault
readList = readListDefault
Note [Use expectP]
~~~~~~~~~~~~~~~~~~
Note that we use
expectP (Ident "T1")
rather than
Ident "T1" <- lexP
The latter desugares to inline code for matching the Ident and the
string, and this can be very voluminous. The former is much more
compact. Cf Trac #7258, although that also concerned non-linearity in
the occurrence analyser, a separate issue.
Note [Read for empty data types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What should we get for this? (Trac #7931)
data Emp deriving( Read ) -- No data constructors
Here we want
read "[]" :: [Emp] to succeed, returning []
So we do NOT want
instance Read Emp where
readPrec = error "urk"
Rather we want
instance Read Emp where
readPred = pfail -- Same as choose []
Because 'pfail' allows the parser to backtrack, but 'error' doesn't.
These instances are also useful for Read (Either Int Emp), where
we want to be able to parse (Left 3) just fine.
-}
| 7,158
|
gen_Ix_binds :: SrcSpan -> TyCon -> TcM (LHsBinds GhcPs, BagDerivStuff)
gen_Ix_binds loc tycon = do
dflags <- getDynFlags
return $ if isEnumerationTyCon tycon
then (enum_ixes dflags, listToBag $ map DerivAuxBind
[DerivCon2Tag tycon, DerivTag2Con tycon, DerivMaxTag tycon])
else (single_con_ixes, unitBag (DerivAuxBind (DerivCon2Tag tycon)))
where
--------------------------------------------------------------
enum_ixes dflags = listToBag
[ enum_range dflags
, enum_index dflags
, enum_inRange dflags
]
enum_range dflags
= mk_easy_FunBind loc range_RDR [nlTuplePat [a_Pat, b_Pat] Boxed] $
untag_Expr dflags tycon [(a_RDR, ah_RDR)] $
untag_Expr dflags tycon [(b_RDR, bh_RDR)] $
nlHsApp (nlHsVarApps map_RDR [tag2con_RDR dflags tycon]) $
nlHsPar (enum_from_to_Expr
(nlHsVarApps intDataCon_RDR [ah_RDR])
(nlHsVarApps intDataCon_RDR [bh_RDR]))
enum_index dflags
= mk_easy_FunBind loc unsafeIndex_RDR
[noLoc (AsPat (noLoc c_RDR)
(nlTuplePat [a_Pat, nlWildPat] Boxed)),
d_Pat] (
untag_Expr dflags tycon [(a_RDR, ah_RDR)] (
untag_Expr dflags tycon [(d_RDR, dh_RDR)] (
let
rhs = nlHsVarApps intDataCon_RDR [c_RDR]
in
nlHsCase
(genOpApp (nlHsVar dh_RDR) minusInt_RDR (nlHsVar ah_RDR))
[mkHsCaseAlt (nlVarPat c_RDR) rhs]
))
)
-- This produces something like `(ch >= ah) && (ch <= bh)`
enum_inRange dflags
= mk_easy_FunBind loc inRange_RDR [nlTuplePat [a_Pat, b_Pat] Boxed, c_Pat] $
untag_Expr dflags tycon [(a_RDR, ah_RDR)] (
untag_Expr dflags tycon [(b_RDR, bh_RDR)] (
untag_Expr dflags tycon [(c_RDR, ch_RDR)] (
-- This used to use `if`, which interacts badly with RebindableSyntax.
-- See #11396.
nlHsApps and_RDR
[ genPrimOpApp (nlHsVar ch_RDR) geInt_RDR (nlHsVar ah_RDR)
, genPrimOpApp (nlHsVar ch_RDR) leInt_RDR (nlHsVar bh_RDR)
]
)))
--------------------------------------------------------------
single_con_ixes
= listToBag [single_con_range, single_con_index, single_con_inRange]
data_con
= case tyConSingleDataCon_maybe tycon of -- just checking...
Nothing -> panic "get_Ix_binds"
Just dc -> dc
con_arity = dataConSourceArity data_con
data_con_RDR = getRdrName data_con
as_needed = take con_arity as_RDRs
bs_needed = take con_arity bs_RDRs
cs_needed = take con_arity cs_RDRs
con_pat xs = nlConVarPat data_con_RDR xs
con_expr = nlHsVarApps data_con_RDR cs_needed
--------------------------------------------------------------
single_con_range
= mk_easy_FunBind loc range_RDR
[nlTuplePat [con_pat as_needed, con_pat bs_needed] Boxed] $
noLoc (mkHsComp ListComp stmts con_expr)
where
stmts = zipWith3Equal "single_con_range" mk_qual as_needed bs_needed cs_needed
mk_qual a b c = noLoc $ mkBindStmt (nlVarPat c)
(nlHsApp (nlHsVar range_RDR)
(mkLHsVarTuple [a,b]))
----------------
single_con_index
= mk_easy_FunBind loc unsafeIndex_RDR
[nlTuplePat [con_pat as_needed, con_pat bs_needed] Boxed,
con_pat cs_needed]
-- We need to reverse the order we consider the components in
-- so that
-- range (l,u) !! index (l,u) i == i -- when i is in range
-- (from http://haskell.org/onlinereport/ix.html) holds.
(mk_index (reverse $ zip3 as_needed bs_needed cs_needed))
where
-- index (l1,u1) i1 + rangeSize (l1,u1) * (index (l2,u2) i2 + ...)
mk_index [] = nlHsIntLit 0
mk_index [(l,u,i)] = mk_one l u i
mk_index ((l,u,i) : rest)
= genOpApp (
mk_one l u i
) plus_RDR (
genOpApp (
(nlHsApp (nlHsVar unsafeRangeSize_RDR)
(mkLHsVarTuple [l,u]))
) times_RDR (mk_index rest)
)
mk_one l u i
= nlHsApps unsafeIndex_RDR [mkLHsVarTuple [l,u], nlHsVar i]
------------------
single_con_inRange
= mk_easy_FunBind loc inRange_RDR
[nlTuplePat [con_pat as_needed, con_pat bs_needed] Boxed,
con_pat cs_needed] $
if con_arity == 0
-- If the product type has no fields, inRange is trivially true
-- (see Trac #12853).
then true_Expr
else foldl1 and_Expr (zipWith3Equal "single_con_inRange" in_range
as_needed bs_needed cs_needed)
where
in_range a b c = nlHsApps inRange_RDR [mkLHsVarTuple [a,b], nlHsVar c]
{-
************************************************************************
* *
Read instances
* *
************************************************************************
Example
infix 4 %%
data T = Int %% Int
| T1 { f1 :: Int }
| T2 T
instance Read T where
readPrec =
parens
( prec 4 (
do x <- ReadP.step Read.readPrec
expectP (Symbol "%%")
y <- ReadP.step Read.readPrec
return (x %% y))
+++
prec (appPrec+1) (
-- Note the "+1" part; "T2 T1 {f1=3}" should parse ok
-- Record construction binds even more tightly than application
do expectP (Ident "T1")
expectP (Punc '{')
x <- Read.readField "f1" (ReadP.reset readPrec)
expectP (Punc '}')
return (T1 { f1 = x }))
+++
prec appPrec (
do expectP (Ident "T2")
x <- ReadP.step Read.readPrec
return (T2 x))
)
readListPrec = readListPrecDefault
readList = readListDefault
Note [Use expectP]
~~~~~~~~~~~~~~~~~~
Note that we use
expectP (Ident "T1")
rather than
Ident "T1" <- lexP
The latter desugares to inline code for matching the Ident and the
string, and this can be very voluminous. The former is much more
compact. Cf Trac #7258, although that also concerned non-linearity in
the occurrence analyser, a separate issue.
Note [Read for empty data types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What should we get for this? (Trac #7931)
data Emp deriving( Read ) -- No data constructors
Here we want
read "[]" :: [Emp] to succeed, returning []
So we do NOT want
instance Read Emp where
readPrec = error "urk"
Rather we want
instance Read Emp where
readPred = pfail -- Same as choose []
Because 'pfail' allows the parser to backtrack, but 'error' doesn't.
These instances are also useful for Read (Either Int Emp), where
we want to be able to parse (Left 3) just fine.
-}
| 7,157
|
gen_Ix_binds loc tycon = do
dflags <- getDynFlags
return $ if isEnumerationTyCon tycon
then (enum_ixes dflags, listToBag $ map DerivAuxBind
[DerivCon2Tag tycon, DerivTag2Con tycon, DerivMaxTag tycon])
else (single_con_ixes, unitBag (DerivAuxBind (DerivCon2Tag tycon)))
where
--------------------------------------------------------------
enum_ixes dflags = listToBag
[ enum_range dflags
, enum_index dflags
, enum_inRange dflags
]
enum_range dflags
= mk_easy_FunBind loc range_RDR [nlTuplePat [a_Pat, b_Pat] Boxed] $
untag_Expr dflags tycon [(a_RDR, ah_RDR)] $
untag_Expr dflags tycon [(b_RDR, bh_RDR)] $
nlHsApp (nlHsVarApps map_RDR [tag2con_RDR dflags tycon]) $
nlHsPar (enum_from_to_Expr
(nlHsVarApps intDataCon_RDR [ah_RDR])
(nlHsVarApps intDataCon_RDR [bh_RDR]))
enum_index dflags
= mk_easy_FunBind loc unsafeIndex_RDR
[noLoc (AsPat (noLoc c_RDR)
(nlTuplePat [a_Pat, nlWildPat] Boxed)),
d_Pat] (
untag_Expr dflags tycon [(a_RDR, ah_RDR)] (
untag_Expr dflags tycon [(d_RDR, dh_RDR)] (
let
rhs = nlHsVarApps intDataCon_RDR [c_RDR]
in
nlHsCase
(genOpApp (nlHsVar dh_RDR) minusInt_RDR (nlHsVar ah_RDR))
[mkHsCaseAlt (nlVarPat c_RDR) rhs]
))
)
-- This produces something like `(ch >= ah) && (ch <= bh)`
enum_inRange dflags
= mk_easy_FunBind loc inRange_RDR [nlTuplePat [a_Pat, b_Pat] Boxed, c_Pat] $
untag_Expr dflags tycon [(a_RDR, ah_RDR)] (
untag_Expr dflags tycon [(b_RDR, bh_RDR)] (
untag_Expr dflags tycon [(c_RDR, ch_RDR)] (
-- This used to use `if`, which interacts badly with RebindableSyntax.
-- See #11396.
nlHsApps and_RDR
[ genPrimOpApp (nlHsVar ch_RDR) geInt_RDR (nlHsVar ah_RDR)
, genPrimOpApp (nlHsVar ch_RDR) leInt_RDR (nlHsVar bh_RDR)
]
)))
--------------------------------------------------------------
single_con_ixes
= listToBag [single_con_range, single_con_index, single_con_inRange]
data_con
= case tyConSingleDataCon_maybe tycon of -- just checking...
Nothing -> panic "get_Ix_binds"
Just dc -> dc
con_arity = dataConSourceArity data_con
data_con_RDR = getRdrName data_con
as_needed = take con_arity as_RDRs
bs_needed = take con_arity bs_RDRs
cs_needed = take con_arity cs_RDRs
con_pat xs = nlConVarPat data_con_RDR xs
con_expr = nlHsVarApps data_con_RDR cs_needed
--------------------------------------------------------------
single_con_range
= mk_easy_FunBind loc range_RDR
[nlTuplePat [con_pat as_needed, con_pat bs_needed] Boxed] $
noLoc (mkHsComp ListComp stmts con_expr)
where
stmts = zipWith3Equal "single_con_range" mk_qual as_needed bs_needed cs_needed
mk_qual a b c = noLoc $ mkBindStmt (nlVarPat c)
(nlHsApp (nlHsVar range_RDR)
(mkLHsVarTuple [a,b]))
----------------
single_con_index
= mk_easy_FunBind loc unsafeIndex_RDR
[nlTuplePat [con_pat as_needed, con_pat bs_needed] Boxed,
con_pat cs_needed]
-- We need to reverse the order we consider the components in
-- so that
-- range (l,u) !! index (l,u) i == i -- when i is in range
-- (from http://haskell.org/onlinereport/ix.html) holds.
(mk_index (reverse $ zip3 as_needed bs_needed cs_needed))
where
-- index (l1,u1) i1 + rangeSize (l1,u1) * (index (l2,u2) i2 + ...)
mk_index [] = nlHsIntLit 0
mk_index [(l,u,i)] = mk_one l u i
mk_index ((l,u,i) : rest)
= genOpApp (
mk_one l u i
) plus_RDR (
genOpApp (
(nlHsApp (nlHsVar unsafeRangeSize_RDR)
(mkLHsVarTuple [l,u]))
) times_RDR (mk_index rest)
)
mk_one l u i
= nlHsApps unsafeIndex_RDR [mkLHsVarTuple [l,u], nlHsVar i]
------------------
single_con_inRange
= mk_easy_FunBind loc inRange_RDR
[nlTuplePat [con_pat as_needed, con_pat bs_needed] Boxed,
con_pat cs_needed] $
if con_arity == 0
-- If the product type has no fields, inRange is trivially true
-- (see Trac #12853).
then true_Expr
else foldl1 and_Expr (zipWith3Equal "single_con_inRange" in_range
as_needed bs_needed cs_needed)
where
in_range a b c = nlHsApps inRange_RDR [mkLHsVarTuple [a,b], nlHsVar c]
{-
************************************************************************
* *
Read instances
* *
************************************************************************
Example
infix 4 %%
data T = Int %% Int
| T1 { f1 :: Int }
| T2 T
instance Read T where
readPrec =
parens
( prec 4 (
do x <- ReadP.step Read.readPrec
expectP (Symbol "%%")
y <- ReadP.step Read.readPrec
return (x %% y))
+++
prec (appPrec+1) (
-- Note the "+1" part; "T2 T1 {f1=3}" should parse ok
-- Record construction binds even more tightly than application
do expectP (Ident "T1")
expectP (Punc '{')
x <- Read.readField "f1" (ReadP.reset readPrec)
expectP (Punc '}')
return (T1 { f1 = x }))
+++
prec appPrec (
do expectP (Ident "T2")
x <- ReadP.step Read.readPrec
return (T2 x))
)
readListPrec = readListPrecDefault
readList = readListDefault
Note [Use expectP]
~~~~~~~~~~~~~~~~~~
Note that we use
expectP (Ident "T1")
rather than
Ident "T1" <- lexP
The latter desugares to inline code for matching the Ident and the
string, and this can be very voluminous. The former is much more
compact. Cf Trac #7258, although that also concerned non-linearity in
the occurrence analyser, a separate issue.
Note [Read for empty data types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What should we get for this? (Trac #7931)
data Emp deriving( Read ) -- No data constructors
Here we want
read "[]" :: [Emp] to succeed, returning []
So we do NOT want
instance Read Emp where
readPrec = error "urk"
Rather we want
instance Read Emp where
readPred = pfail -- Same as choose []
Because 'pfail' allows the parser to backtrack, but 'error' doesn't.
These instances are also useful for Read (Either Int Emp), where
we want to be able to parse (Left 3) just fine.
-}
| 7,085
| false
| true
| 8
| 17
| 2,344
| 1,181
| 610
| 571
| null | null |
PipocaQuemada/ermine
|
src/Ermine/Inference/Type.hs
|
bsd-2-clause
|
inferHardType (DataCon g t)
| g^.name == "Nothing" = unfurl (bimap absurd absurd t) $ dataCon [] 0 g
| g^.name == "Just" = unfurl (bimap absurd absurd t) $ dataCon [_Convention # C] 1 g
| g^.name == "E" = unfurl (bimap absurd absurd t) $ dataCon [_Convention # C] 0 g
| g^.name == "String#" = unfurl (bimap absurd absurd t) $ dataCon [_Convention # N] 1 g
| 372
|
inferHardType (DataCon g t)
| g^.name == "Nothing" = unfurl (bimap absurd absurd t) $ dataCon [] 0 g
| g^.name == "Just" = unfurl (bimap absurd absurd t) $ dataCon [_Convention # C] 1 g
| g^.name == "E" = unfurl (bimap absurd absurd t) $ dataCon [_Convention # C] 0 g
| g^.name == "String#" = unfurl (bimap absurd absurd t) $ dataCon [_Convention # N] 1 g
| 372
|
inferHardType (DataCon g t)
| g^.name == "Nothing" = unfurl (bimap absurd absurd t) $ dataCon [] 0 g
| g^.name == "Just" = unfurl (bimap absurd absurd t) $ dataCon [_Convention # C] 1 g
| g^.name == "E" = unfurl (bimap absurd absurd t) $ dataCon [_Convention # C] 0 g
| g^.name == "String#" = unfurl (bimap absurd absurd t) $ dataCon [_Convention # N] 1 g
| 372
| false
| false
| 0
| 9
| 86
| 207
| 98
| 109
| null | null |
bergmark/http2
|
test-hpack/hpack-stat.hs
|
bsd-3-clause
|
get :: (FilePath -> IO Int) -> String -> IO [Int]
get func dir = do
files0 <- valid . sort <$> getDirectoryContents dir
files1 <- filterM doesFileExist files0
mapM func files1
where
valid = map (dir </>) . filter (isSuffixOf ".json")
| 251
|
get :: (FilePath -> IO Int) -> String -> IO [Int]
get func dir = do
files0 <- valid . sort <$> getDirectoryContents dir
files1 <- filterM doesFileExist files0
mapM func files1
where
valid = map (dir </>) . filter (isSuffixOf ".json")
| 251
|
get func dir = do
files0 <- valid . sort <$> getDirectoryContents dir
files1 <- filterM doesFileExist files0
mapM func files1
where
valid = map (dir </>) . filter (isSuffixOf ".json")
| 201
| false
| true
| 1
| 9
| 59
| 113
| 51
| 62
| null | null |
tittoassini/flat
|
test/Spec.hs
|
bsd-3-clause
|
c3a = [3, 99, 99, 99, 0]
| 24
|
c3a = [3, 99, 99, 99, 0]
| 24
|
c3a = [3, 99, 99, 99, 0]
| 24
| false
| false
| 1
| 5
| 6
| 24
| 13
| 11
| null | null |
ganeti/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
-- * Luxid job death testing
-- | The number of attempts to prove that a job is dead after sending it a
-- KILL signal.
luxidJobDeathDetectionRetries :: Int
luxidJobDeathDetectionRetries = 3
| 191
|
luxidJobDeathDetectionRetries :: Int
luxidJobDeathDetectionRetries = 3
| 70
|
luxidJobDeathDetectionRetries = 3
| 33
| true
| true
| 0
| 4
| 32
| 14
| 9
| 5
| null | null |
databrary/databrary
|
src/Controller/Web.hs
|
agpl-3.0
|
bsLCEq :: BS.ByteString -> BS.ByteString -> Bool
bsLCEq t s
| BS.length t == BS.length s = t == BSC.map toLower s
| otherwise = False
| 137
|
bsLCEq :: BS.ByteString -> BS.ByteString -> Bool
bsLCEq t s
| BS.length t == BS.length s = t == BSC.map toLower s
| otherwise = False
| 137
|
bsLCEq t s
| BS.length t == BS.length s = t == BSC.map toLower s
| otherwise = False
| 88
| false
| true
| 1
| 10
| 29
| 72
| 32
| 40
| null | null |
sbidin/sdl2-ttf
|
src/SDL/Font.hs
|
mit
|
fromMaskWith :: (Enum a, Bounded a) => (a -> CInt) -> CInt -> [a]
fromMaskWith convert cint = concatMap (\a -> find (a, convert a)) [minBound..]
where
find (a, i) = [a | i == i .&. cint]
-- Helper function for converting a list of values into a bitmask.
| 260
|
fromMaskWith :: (Enum a, Bounded a) => (a -> CInt) -> CInt -> [a]
fromMaskWith convert cint = concatMap (\a -> find (a, convert a)) [minBound..]
where
find (a, i) = [a | i == i .&. cint]
-- Helper function for converting a list of values into a bitmask.
| 260
|
fromMaskWith convert cint = concatMap (\a -> find (a, convert a)) [minBound..]
where
find (a, i) = [a | i == i .&. cint]
-- Helper function for converting a list of values into a bitmask.
| 194
| false
| true
| 0
| 10
| 56
| 116
| 60
| 56
| null | null |
kim/amazonka
|
amazonka-elasticbeanstalk/gen/Network/AWS/ElasticBeanstalk/DescribeConfigurationOptions.hs
|
mpl-2.0
|
-- | The name of the application associated with the configuration template or
-- environment. Only needed if you want to describe the configuration options
-- associated with either the configuration template or environment.
dcoApplicationName :: Lens' DescribeConfigurationOptions (Maybe Text)
dcoApplicationName =
lens _dcoApplicationName (\s a -> s { _dcoApplicationName = a })
| 385
|
dcoApplicationName :: Lens' DescribeConfigurationOptions (Maybe Text)
dcoApplicationName =
lens _dcoApplicationName (\s a -> s { _dcoApplicationName = a })
| 159
|
dcoApplicationName =
lens _dcoApplicationName (\s a -> s { _dcoApplicationName = a })
| 89
| true
| true
| 0
| 9
| 56
| 48
| 27
| 21
| null | null |
maurer/hseve
|
lib/EVE/Monad.hs
|
bsd-3-clause
|
eveCacheCheck :: Query -- ^ The question
-> EVE (Maybe Response) -- ^ The response if present
eveCacheCheck q = do
s <- get
t <- liftIO $ getCurrentTime
state $ cacheCheck q t
| 210
|
eveCacheCheck :: Query -- ^ The question
-> EVE (Maybe Response)
eveCacheCheck q = do
s <- get
t <- liftIO $ getCurrentTime
state $ cacheCheck q t
| 181
|
eveCacheCheck q = do
s <- get
t <- liftIO $ getCurrentTime
state $ cacheCheck q t
| 87
| true
| true
| 0
| 8
| 68
| 59
| 28
| 31
| null | null |
mtlstats/mtlstats
|
src/Mtlstats/Types.hs
|
gpl-3.0
|
-- | Adds two sets of 'GoalieStats'
addGoalieStats :: GoalieStats -> GoalieStats -> GoalieStats
addGoalieStats g1 g2 = GoalieStats
{ _gsGames = g1^.gsGames + g2^.gsGames
, _gsMinsPlayed = g1^.gsMinsPlayed + g2^.gsMinsPlayed
, _gsGoalsAllowed = g1^.gsGoalsAllowed + g2^.gsGoalsAllowed
, _gsShutouts = g1^.gsShutouts + g2^.gsShutouts
, _gsWins = g1^.gsWins + g2^.gsWins
, _gsLosses = g1^.gsLosses + g2^.gsLosses
, _gsTies = g1^.gsTies + g2^.gsTies
}
| 533
|
addGoalieStats :: GoalieStats -> GoalieStats -> GoalieStats
addGoalieStats g1 g2 = GoalieStats
{ _gsGames = g1^.gsGames + g2^.gsGames
, _gsMinsPlayed = g1^.gsMinsPlayed + g2^.gsMinsPlayed
, _gsGoalsAllowed = g1^.gsGoalsAllowed + g2^.gsGoalsAllowed
, _gsShutouts = g1^.gsShutouts + g2^.gsShutouts
, _gsWins = g1^.gsWins + g2^.gsWins
, _gsLosses = g1^.gsLosses + g2^.gsLosses
, _gsTies = g1^.gsTies + g2^.gsTies
}
| 497
|
addGoalieStats g1 g2 = GoalieStats
{ _gsGames = g1^.gsGames + g2^.gsGames
, _gsMinsPlayed = g1^.gsMinsPlayed + g2^.gsMinsPlayed
, _gsGoalsAllowed = g1^.gsGoalsAllowed + g2^.gsGoalsAllowed
, _gsShutouts = g1^.gsShutouts + g2^.gsShutouts
, _gsWins = g1^.gsWins + g2^.gsWins
, _gsLosses = g1^.gsLosses + g2^.gsLosses
, _gsTies = g1^.gsTies + g2^.gsTies
}
| 437
| true
| true
| 0
| 10
| 147
| 157
| 85
| 72
| null | null |
MerelyAPseudonym/cmdtheline
|
src/System/Console/CmdTheLine/Term.hs
|
mit
|
eval :: [String] -> ( Term a, TermInfo ) -> IO a
eval = evalBy evalTerm
| 71
|
eval :: [String] -> ( Term a, TermInfo ) -> IO a
eval = evalBy evalTerm
| 71
|
eval = evalBy evalTerm
| 22
| false
| true
| 0
| 8
| 15
| 37
| 19
| 18
| null | null |
kcsmnt0/demesne
|
src/Stdlib.hs
|
bsd-3-clause
|
opDel [VInt x, VDom y] = VDom (Set.delete x y)
| 46
|
opDel [VInt x, VDom y] = VDom (Set.delete x y)
| 46
|
opDel [VInt x, VDom y] = VDom (Set.delete x y)
| 46
| false
| false
| 0
| 8
| 9
| 34
| 16
| 18
| null | null |
massysett/penny
|
penny/lib/Penny/Copper/Decopperize.hs
|
bsd-3-clause
|
dMemo :: Memo Char a -> Seq Text
dMemo (Memo _ _ bl) = dBracketedList bl
| 72
|
dMemo :: Memo Char a -> Seq Text
dMemo (Memo _ _ bl) = dBracketedList bl
| 72
|
dMemo (Memo _ _ bl) = dBracketedList bl
| 39
| false
| true
| 0
| 7
| 15
| 39
| 18
| 21
| null | null |
mgsloan/ghcjs-jquery
|
JavaScript/JQuery.hs
|
mit
|
mouseenter :: (Event -> IO ()) -> HandlerSettings -> JQuery -> IO (IO ())
mouseenter a = on a "mouseenter"
| 106
|
mouseenter :: (Event -> IO ()) -> HandlerSettings -> JQuery -> IO (IO ())
mouseenter a = on a "mouseenter"
| 106
|
mouseenter a = on a "mouseenter"
| 32
| false
| true
| 0
| 11
| 19
| 54
| 26
| 28
| null | null |
yu-i9/thih
|
src/Thih/TI/Unify.hs
|
bsd-3-clause
|
match (TCon tc1) (TCon tc2)
| tc1==tc2 = return nullSubst
| 74
|
match (TCon tc1) (TCon tc2)
| tc1==tc2 = return nullSubst
| 74
|
match (TCon tc1) (TCon tc2)
| tc1==tc2 = return nullSubst
| 74
| false
| false
| 0
| 8
| 26
| 38
| 16
| 22
| null | null |
fmapfmapfmap/amazonka
|
gen/src/Gen/JSON.hs
|
mpl-2.0
|
decode :: ByteString -> Either Error Object
decode = first LText.pack . eitherDecode' . LBS.fromStrict
| 102
|
decode :: ByteString -> Either Error Object
decode = first LText.pack . eitherDecode' . LBS.fromStrict
| 102
|
decode = first LText.pack . eitherDecode' . LBS.fromStrict
| 58
| false
| true
| 0
| 8
| 14
| 41
| 18
| 23
| null | null |
mcschroeder/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
-- | Unset a 'DumpFlag'
dopt_unset :: DynFlags -> DumpFlag -> DynFlags
dopt_unset dfs f = dfs{ dumpFlags = IntSet.delete (fromEnum f) (dumpFlags dfs) }
| 151
|
dopt_unset :: DynFlags -> DumpFlag -> DynFlags
dopt_unset dfs f = dfs{ dumpFlags = IntSet.delete (fromEnum f) (dumpFlags dfs) }
| 127
|
dopt_unset dfs f = dfs{ dumpFlags = IntSet.delete (fromEnum f) (dumpFlags dfs) }
| 80
| true
| true
| 0
| 9
| 24
| 52
| 27
| 25
| null | null |
green-haskell/ghc
|
compiler/typecheck/TcEvidence.hs
|
bsd-3-clause
|
isTcReflCo (TcCoercion co) = isReflCo co
| 40
|
isTcReflCo (TcCoercion co) = isReflCo co
| 40
|
isTcReflCo (TcCoercion co) = isReflCo co
| 40
| false
| false
| 0
| 7
| 5
| 18
| 8
| 10
| null | null |
JustusAdam/marvin
|
src/Marvin/Util/JSON.hs
|
bsd-3-clause
|
-- | Write some data to a file using JSON serialization
writeJSON :: (MonadIO m, ToJSON a) => FilePath -> a -> m ()
writeJSON fp = liftIO . B.writeFile fp . encode
| 163
|
writeJSON :: (MonadIO m, ToJSON a) => FilePath -> a -> m ()
writeJSON fp = liftIO . B.writeFile fp . encode
| 107
|
writeJSON fp = liftIO . B.writeFile fp . encode
| 47
| true
| true
| 0
| 9
| 32
| 56
| 28
| 28
| null | null |
iemxblog/sivi-haskell
|
examples/cap.hs
|
gpl-2.0
|
d2 = 14 + 0.4
| 13
|
d2 = 14 + 0.4
| 13
|
d2 = 14 + 0.4
| 13
| false
| false
| 1
| 5
| 4
| 13
| 5
| 8
| null | null |
olsner/ghc
|
testsuite/tests/perf/compiler/T10370.hs
|
bsd-3-clause
|
a586 :: IO (); a586 = forever $ putStrLn "a586"
| 47
|
a586 :: IO ()
a586 = forever $ putStrLn "a586"
| 46
|
a586 = forever $ putStrLn "a586"
| 32
| false
| true
| 0
| 6
| 9
| 24
| 12
| 12
| null | null |
paf31/typescript-docs
|
src/Language/TypeScript/Docs/Html.hs
|
mit
|
renderExported :: Exported -> H.Html
renderExported _ = keyword "export" >> sp
| 78
|
renderExported :: Exported -> H.Html
renderExported _ = keyword "export" >> sp
| 78
|
renderExported _ = keyword "export" >> sp
| 41
| false
| true
| 0
| 6
| 11
| 27
| 13
| 14
| null | null |
sdiehl/ghc
|
compiler/GHC/HsToCore/PmCheck.hs
|
bsd-3-clause
|
-- Don't warn about incomplete patterns
-- in list comprehensions, pattern guards
-- etc. They are often *supposed* to be
-- incomplete
-- True <==> singular
pprContext :: Bool -> DsMatchContext -> SDoc -> ((SDoc -> SDoc) -> SDoc) -> SDoc
pprContext singular (DsMatchContext kind _loc) msg rest_of_msg_fun
= vcat [text txt <+> msg,
sep [ text "In" <+> ppr_match <> char ':'
, nest 4 (rest_of_msg_fun pref)]]
where
txt | singular = "Pattern match"
| otherwise = "Pattern match(es)"
(ppr_match, pref)
= case kind of
FunRhs { mc_fun = L _ fun }
-> (pprMatchContext kind, \ pp -> ppr fun <+> pp)
_ -> (pprMatchContext kind, \ pp -> pp)
| 850
|
pprContext :: Bool -> DsMatchContext -> SDoc -> ((SDoc -> SDoc) -> SDoc) -> SDoc
pprContext singular (DsMatchContext kind _loc) msg rest_of_msg_fun
= vcat [text txt <+> msg,
sep [ text "In" <+> ppr_match <> char ':'
, nest 4 (rest_of_msg_fun pref)]]
where
txt | singular = "Pattern match"
| otherwise = "Pattern match(es)"
(ppr_match, pref)
= case kind of
FunRhs { mc_fun = L _ fun }
-> (pprMatchContext kind, \ pp -> ppr fun <+> pp)
_ -> (pprMatchContext kind, \ pp -> pp)
| 574
|
pprContext singular (DsMatchContext kind _loc) msg rest_of_msg_fun
= vcat [text txt <+> msg,
sep [ text "In" <+> ppr_match <> char ':'
, nest 4 (rest_of_msg_fun pref)]]
where
txt | singular = "Pattern match"
| otherwise = "Pattern match(es)"
(ppr_match, pref)
= case kind of
FunRhs { mc_fun = L _ fun }
-> (pprMatchContext kind, \ pp -> ppr fun <+> pp)
_ -> (pprMatchContext kind, \ pp -> pp)
| 493
| true
| true
| 1
| 13
| 330
| 215
| 110
| 105
| null | null |
harendra-kumar/asyncly
|
src/Streamly/Internal/Benchmark/FileIO/Array.hs
|
bsd-3-clause
|
decodeUtf8Lenient :: Handle -> IO ()
decodeUtf8Lenient inh =
S.drain
$ IUS.decodeUtf8ArraysLenient
$ IFH.toChunksWithBufferOf (1024*1024) inh
| 154
|
decodeUtf8Lenient :: Handle -> IO ()
decodeUtf8Lenient inh =
S.drain
$ IUS.decodeUtf8ArraysLenient
$ IFH.toChunksWithBufferOf (1024*1024) inh
| 154
|
decodeUtf8Lenient inh =
S.drain
$ IUS.decodeUtf8ArraysLenient
$ IFH.toChunksWithBufferOf (1024*1024) inh
| 117
| false
| true
| 0
| 8
| 28
| 49
| 24
| 25
| null | null |
bitemyapp/ganeti
|
src/Ganeti/OpParams.hs
|
bsd-2-clause
|
pInstanceCommunication :: Field
pInstanceCommunication =
withDoc C.instanceCommunicationDoc $
defaultFalse "instance_communication"
| 135
|
pInstanceCommunication :: Field
pInstanceCommunication =
withDoc C.instanceCommunicationDoc $
defaultFalse "instance_communication"
| 135
|
pInstanceCommunication =
withDoc C.instanceCommunicationDoc $
defaultFalse "instance_communication"
| 103
| false
| true
| 0
| 7
| 13
| 23
| 11
| 12
| null | null |
ankeshs/numerikell
|
tmp/Stats.hs
|
bsd-3-clause
|
-- |function to find Pearson product-moment correlation coefficient
pearson :: (Fractional a, Floating a) => [a] -> [a] -> Either String a
pearson x y = if (length x/=length y)
then Left "Length of vectors must Match"
else Right (xy/(sqrt(x2)*sqrt(y2)))
where xmean = mean x
ymean = mean y
xy = sum (map (\(u,v)->u*v) (zip x1 y1))
x1 = map (\t -> t-xmean) x
y1 = map (\t -> t-ymean) y
x2 = sum (map (\t -> t*t) x1)
y2 = sum (map (\t -> t*t) y1)
n = length x
| 654
|
pearson :: (Fractional a, Floating a) => [a] -> [a] -> Either String a
pearson x y = if (length x/=length y)
then Left "Length of vectors must Match"
else Right (xy/(sqrt(x2)*sqrt(y2)))
where xmean = mean x
ymean = mean y
xy = sum (map (\(u,v)->u*v) (zip x1 y1))
x1 = map (\t -> t-xmean) x
y1 = map (\t -> t-ymean) y
x2 = sum (map (\t -> t*t) x1)
y2 = sum (map (\t -> t*t) y1)
n = length x
| 584
|
pearson x y = if (length x/=length y)
then Left "Length of vectors must Match"
else Right (xy/(sqrt(x2)*sqrt(y2)))
where xmean = mean x
ymean = mean y
xy = sum (map (\(u,v)->u*v) (zip x1 y1))
x1 = map (\t -> t-xmean) x
y1 = map (\t -> t-ymean) y
x2 = sum (map (\t -> t*t) x1)
y2 = sum (map (\t -> t*t) y1)
n = length x
| 513
| true
| true
| 0
| 12
| 287
| 272
| 144
| 128
| null | null |
phischu/fragnix
|
tests/packages/scotty/Control.Monad.Trans.Resource.hs
|
bsd-3-clause
|
-- $internalState
--
-- A @ResourceT@ internally is a modified @ReaderT@ monad transformer holding
-- onto a mutable reference to all of the release actions still remaining to be
-- performed. If you are building up a custom application monad, it may be more
-- efficient to embed this @ReaderT@ functionality directly in your own monad
-- instead of wrapping around @ResourceT@ itself. This section provides you the
-- means of doing so.
-- | Create a new internal state. This state must be closed with
-- @closeInternalState@. It is your responsibility to ensure exception safety.
-- Caveat emptor!
--
-- Since 0.4.9
createInternalState :: MonadBase IO m => m InternalState
createInternalState = liftBase
$ I.newIORef
$ ReleaseMap maxBound (minBound + 1) IntMap.empty
| 810
|
createInternalState :: MonadBase IO m => m InternalState
createInternalState = liftBase
$ I.newIORef
$ ReleaseMap maxBound (minBound + 1) IntMap.empty
| 190
|
createInternalState = liftBase
$ I.newIORef
$ ReleaseMap maxBound (minBound + 1) IntMap.empty
| 133
| true
| true
| 0
| 8
| 163
| 62
| 37
| 25
| null | null |
vTurbine/ghc
|
compiler/hsSyn/HsPat.hs
|
bsd-3-clause
|
hsPatNeedsParens p@(ConPatOut {}) = conPatNeedsParens (pat_args p)
| 69
|
hsPatNeedsParens p@(ConPatOut {}) = conPatNeedsParens (pat_args p)
| 69
|
hsPatNeedsParens p@(ConPatOut {}) = conPatNeedsParens (pat_args p)
| 69
| false
| false
| 0
| 8
| 9
| 28
| 14
| 14
| null | null |
LeoMingo/RPNMathParser
|
Functions/Series/Series.hs
|
gpl-3.0
|
lnOfx :: Float -> Float
lnOfx x = netSum f 1 33
where f i = 2*(1/oddTerm)*((x-1)/(x+1))**oddTerm
where oddTerm = 2*i-1
netSum f minB maxB = sum $ reverse [f i | i <- [minB .. maxB]]
{-
- Or another way around
lnOfx2 :: Float -> Float
lnOfx2 x = netSum f 1 33
where f i = (1/i)*((x-1)/x)**i
netSum f minB maxB = sum $ reverse [f i | i <- [minB .. maxB]]
-}
| 403
|
lnOfx :: Float -> Float
lnOfx x = netSum f 1 33
where f i = 2*(1/oddTerm)*((x-1)/(x+1))**oddTerm
where oddTerm = 2*i-1
netSum f minB maxB = sum $ reverse [f i | i <- [minB .. maxB]]
{-
- Or another way around
lnOfx2 :: Float -> Float
lnOfx2 x = netSum f 1 33
where f i = (1/i)*((x-1)/x)**i
netSum f minB maxB = sum $ reverse [f i | i <- [minB .. maxB]]
-}
| 403
|
lnOfx x = netSum f 1 33
where f i = 2*(1/oddTerm)*((x-1)/(x+1))**oddTerm
where oddTerm = 2*i-1
netSum f minB maxB = sum $ reverse [f i | i <- [minB .. maxB]]
{-
- Or another way around
lnOfx2 :: Float -> Float
lnOfx2 x = netSum f 1 33
where f i = (1/i)*((x-1)/x)**i
netSum f minB maxB = sum $ reverse [f i | i <- [minB .. maxB]]
-}
| 379
| false
| true
| 0
| 12
| 124
| 130
| 68
| 62
| null | null |
leshchevds/ganeti
|
src/Ganeti/HTools/Instance.hs
|
bsd-2-clause
|
isRunning :: Instance -> Bool
isRunning (Instance {runSt = T.Running}) = True
| 77
|
isRunning :: Instance -> Bool
isRunning (Instance {runSt = T.Running}) = True
| 77
|
isRunning (Instance {runSt = T.Running}) = True
| 47
| false
| true
| 3
| 7
| 11
| 39
| 18
| 21
| null | null |
Tener/haskell-minirotate
|
src/Main.hs
|
bsd-3-clause
|
showX xs = "[" ++ intercalate ", " xs ++ "]"
| 44
|
showX xs = "[" ++ intercalate ", " xs ++ "]"
| 44
|
showX xs = "[" ++ intercalate ", " xs ++ "]"
| 44
| false
| false
| 0
| 7
| 10
| 22
| 10
| 12
| null | null |
brendanhay/gogol
|
gogol-compute/gen/Network/Google/Resource/Compute/Instances/Insert.hs
|
mpl-2.0
|
-- | Project ID for this request.
iiiProject :: Lens' InstancesInsert Text
iiiProject
= lens _iiiProject (\ s a -> s{_iiiProject = a})
| 136
|
iiiProject :: Lens' InstancesInsert Text
iiiProject
= lens _iiiProject (\ s a -> s{_iiiProject = a})
| 102
|
iiiProject
= lens _iiiProject (\ s a -> s{_iiiProject = a})
| 61
| true
| true
| 1
| 9
| 24
| 44
| 22
| 22
| null | null |
scottgw/language-eiffel
|
Language/Eiffel/Util.hs
|
bsd-3-clause
|
findFeatureEx :: AbsClas body expr -> Text -> Maybe (FeatureEx expr)
findFeatureEx = findFeature
| 96
|
findFeatureEx :: AbsClas body expr -> Text -> Maybe (FeatureEx expr)
findFeatureEx = findFeature
| 96
|
findFeatureEx = findFeature
| 27
| false
| true
| 0
| 9
| 13
| 33
| 16
| 17
| null | null |
ratatosk/traceblade
|
MatchEval.hs
|
bsd-3-clause
|
cond _ = throwError "'cond' requires list of pairs (condition statement)"
| 73
|
cond _ = throwError "'cond' requires list of pairs (condition statement)"
| 73
|
cond _ = throwError "'cond' requires list of pairs (condition statement)"
| 73
| false
| false
| 0
| 5
| 10
| 12
| 5
| 7
| null | null |
snoyberg/ghc
|
libraries/template-haskell/Language/Haskell/TH/Lib.hs
|
bsd-3-clause
|
normalGE :: ExpQ -> ExpQ -> Q (Guard, Exp)
normalGE g e = do { g1 <- g; e1 <- e; return (NormalG g1, e1) }
| 106
|
normalGE :: ExpQ -> ExpQ -> Q (Guard, Exp)
normalGE g e = do { g1 <- g; e1 <- e; return (NormalG g1, e1) }
| 106
|
normalGE g e = do { g1 <- g; e1 <- e; return (NormalG g1, e1) }
| 63
| false
| true
| 0
| 10
| 25
| 71
| 35
| 36
| null | null |
NCrashed/hjass
|
src/library/Language/Jass/Codegen/Type.hs
|
mit
|
sizeOfType JHandle = return 8
| 29
|
sizeOfType JHandle = return 8
| 29
|
sizeOfType JHandle = return 8
| 29
| false
| false
| 0
| 5
| 4
| 12
| 5
| 7
| null | null |
benkio/VRP
|
src/Behaviour/Genetics/Algorithm.hs
|
gpl-3.0
|
{-
From a list of path return a list of all the pairs between all the element in the list.
-}
pathPair :: [Path] -> [(Path,Path)]
pathPair [] = []
| 151
|
pathPair :: [Path] -> [(Path,Path)]
pathPair [] = []
| 52
|
pathPair [] = []
| 16
| true
| true
| 0
| 9
| 34
| 41
| 21
| 20
| null | null |
sdiehl/ghc
|
compiler/main/SysTools/Process.hs
|
bsd-3-clause
|
breakColon :: String -> Maybe (String, String)
breakColon xs = case break (':' ==) xs of
(ys, _:zs) -> Just (ys, zs)
_ -> Nothing
| 169
|
breakColon :: String -> Maybe (String, String)
breakColon xs = case break (':' ==) xs of
(ys, _:zs) -> Just (ys, zs)
_ -> Nothing
| 169
|
breakColon xs = case break (':' ==) xs of
(ys, _:zs) -> Just (ys, zs)
_ -> Nothing
| 122
| false
| true
| 0
| 9
| 64
| 76
| 39
| 37
| null | null |
CulpaBS/wbBach
|
src/Futhark/Analysis/AlgSimplify.hs
|
bsd-3-clause
|
negateSimplified (SRem e1 e2) =
return $ SRem e1 e2
| 55
|
negateSimplified (SRem e1 e2) =
return $ SRem e1 e2
| 55
|
negateSimplified (SRem e1 e2) =
return $ SRem e1 e2
| 55
| false
| false
| 0
| 7
| 13
| 26
| 12
| 14
| null | null |
Proclivis/wxHaskell
|
wxc/Setup.hs
|
lgpl-2.1
|
x_config :: [String] -> IO String
wx_config parms = do
b <- isWindowsMsys
if b
then do
(r, e, c) <- rawShellSystemStdInOut normal "wx-config" parms
unless (c == ExitSuccess) $ do
putStrLn $ "Error: Failed to execute wx-config command \n" ++ e
exitFailure
return r
else
readProcess "wx-config" parms ""
`E.onException` return ""
-- Try to find a compatible version of wxWidgets
-- (a version that can be handled by this version of wxHaskell)
| 542
|
wx_config :: [String] -> IO String
wx_config parms = do
b <- isWindowsMsys
if b
then do
(r, e, c) <- rawShellSystemStdInOut normal "wx-config" parms
unless (c == ExitSuccess) $ do
putStrLn $ "Error: Failed to execute wx-config command \n" ++ e
exitFailure
return r
else
readProcess "wx-config" parms ""
`E.onException` return ""
-- Try to find a compatible version of wxWidgets
-- (a version that can be handled by this version of wxHaskell)
| 541
|
wx_config parms = do
b <- isWindowsMsys
if b
then do
(r, e, c) <- rawShellSystemStdInOut normal "wx-config" parms
unless (c == ExitSuccess) $ do
putStrLn $ "Error: Failed to execute wx-config command \n" ++ e
exitFailure
return r
else
readProcess "wx-config" parms ""
`E.onException` return ""
-- Try to find a compatible version of wxWidgets
-- (a version that can be handled by this version of wxHaskell)
| 506
| false
| true
| 0
| 15
| 175
| 127
| 61
| 66
| null | null |
mgrebenets/hackerrank
|
alg/strings/anagram.hs
|
mit
|
split l = (take (half + adj) l, drop (half + adj) l)
where
len = length l
half = div len 2
adj = mod len 2
| 120
|
split l = (take (half + adj) l, drop (half + adj) l)
where
len = length l
half = div len 2
adj = mod len 2
| 120
|
split l = (take (half + adj) l, drop (half + adj) l)
where
len = length l
half = div len 2
adj = mod len 2
| 120
| false
| false
| 0
| 8
| 41
| 70
| 35
| 35
| null | null |
kumasento/accelerate
|
Data/Array/Accelerate/Pretty/Traverse.hs
|
bsd-3-clause
|
labelForPrimFun PrimLOr = "PrimLOr"
| 50
|
labelForPrimFun PrimLOr = "PrimLOr"
| 50
|
labelForPrimFun PrimLOr = "PrimLOr"
| 50
| false
| false
| 0
| 4
| 18
| 10
| 4
| 6
| null | null |
gbwey/persistent
|
persistent-template/Database/Persist/TH.hs
|
mit
|
mkLenses :: MkPersistSettings -> EntityDef -> Q [Dec]
mkLenses mps _ | not (mpsGenerateLenses mps) = return []
| 110
|
mkLenses :: MkPersistSettings -> EntityDef -> Q [Dec]
mkLenses mps _ | not (mpsGenerateLenses mps) = return []
| 110
|
mkLenses mps _ | not (mpsGenerateLenses mps) = return []
| 56
| false
| true
| 0
| 10
| 17
| 50
| 23
| 27
| null | null |
beni55/ghcjs
|
src/Gen2/Optimizer.hs
|
mit
|
doubleInfixOp NeqOp (SaneDouble d1) (SaneDouble d2) = eBool (d1 /= d2)
| 71
|
doubleInfixOp NeqOp (SaneDouble d1) (SaneDouble d2) = eBool (d1 /= d2)
| 71
|
doubleInfixOp NeqOp (SaneDouble d1) (SaneDouble d2) = eBool (d1 /= d2)
| 71
| false
| false
| 0
| 7
| 11
| 35
| 17
| 18
| null | null |
stschiff/rarecoal-tools
|
src-combineHistograms/combineHistograms.hs
|
gpl-3.0
|
addHistograms :: RareAlleleHistogram -> RareAlleleHistogram -> Script RareAlleleHistogram
addHistograms hist1 hist2 = do
when (raNames hist1 /= raNames hist2) $ throwE "histograms have different names"
when (raNVec hist1 /= raNVec hist2) $ throwE "histograms have different NVecs"
when (raMaxAf hist1 /= raMaxAf hist2) $ throwE "histograms have different maxAf"
when (raConditionOn hist1 /= raConditionOn hist2) $ throwE "histograms differ in conditioning"
when (raJackknifeEstimates hist1 /= Nothing || raJackknifeEstimates hist2 /= Nothing) $
scriptIO $ errLn "Warning: merging of histograms with Jackknife Estimates is currently \
\not supported. Will remove jackknife estimates for now"
when (raExcludePatterns hist1 /= raExcludePatterns hist2) $
throwE "histograms differ in exclude patterns"
let newTotalNrSites = raTotalNrSites hist1 + raTotalNrSites hist2
return $ hist1 {
raCounts = Map.unionWith (+) (raCounts hist1) (raCounts hist2),
raTotalNrSites = newTotalNrSites,
raJackknifeEstimates = Nothing
}
| 1,099
|
addHistograms :: RareAlleleHistogram -> RareAlleleHistogram -> Script RareAlleleHistogram
addHistograms hist1 hist2 = do
when (raNames hist1 /= raNames hist2) $ throwE "histograms have different names"
when (raNVec hist1 /= raNVec hist2) $ throwE "histograms have different NVecs"
when (raMaxAf hist1 /= raMaxAf hist2) $ throwE "histograms have different maxAf"
when (raConditionOn hist1 /= raConditionOn hist2) $ throwE "histograms differ in conditioning"
when (raJackknifeEstimates hist1 /= Nothing || raJackknifeEstimates hist2 /= Nothing) $
scriptIO $ errLn "Warning: merging of histograms with Jackknife Estimates is currently \
\not supported. Will remove jackknife estimates for now"
when (raExcludePatterns hist1 /= raExcludePatterns hist2) $
throwE "histograms differ in exclude patterns"
let newTotalNrSites = raTotalNrSites hist1 + raTotalNrSites hist2
return $ hist1 {
raCounts = Map.unionWith (+) (raCounts hist1) (raCounts hist2),
raTotalNrSites = newTotalNrSites,
raJackknifeEstimates = Nothing
}
| 1,099
|
addHistograms hist1 hist2 = do
when (raNames hist1 /= raNames hist2) $ throwE "histograms have different names"
when (raNVec hist1 /= raNVec hist2) $ throwE "histograms have different NVecs"
when (raMaxAf hist1 /= raMaxAf hist2) $ throwE "histograms have different maxAf"
when (raConditionOn hist1 /= raConditionOn hist2) $ throwE "histograms differ in conditioning"
when (raJackknifeEstimates hist1 /= Nothing || raJackknifeEstimates hist2 /= Nothing) $
scriptIO $ errLn "Warning: merging of histograms with Jackknife Estimates is currently \
\not supported. Will remove jackknife estimates for now"
when (raExcludePatterns hist1 /= raExcludePatterns hist2) $
throwE "histograms differ in exclude patterns"
let newTotalNrSites = raTotalNrSites hist1 + raTotalNrSites hist2
return $ hist1 {
raCounts = Map.unionWith (+) (raCounts hist1) (raCounts hist2),
raTotalNrSites = newTotalNrSites,
raJackknifeEstimates = Nothing
}
| 1,009
| false
| true
| 0
| 14
| 220
| 264
| 121
| 143
| null | null |
alexbaluta/courseography
|
dependencies/HaXml-1.25.3/src/Text/XML/HaXml/ByteStringPP.hs
|
gpl-3.0
|
sddecl sd | sd = text "standalone='yes'"
| otherwise = text "standalone='no'"
| 104
|
sddecl sd | sd = text "standalone='yes'"
| otherwise = text "standalone='no'"
| 104
|
sddecl sd | sd = text "standalone='yes'"
| otherwise = text "standalone='no'"
| 104
| false
| false
| 2
| 5
| 38
| 27
| 12
| 15
| null | null |
danieldk/lbfgs-hs
|
Numeric/LBFGS.hs
|
apache-2.0
|
mergeL1NormCoefficient :: L1NormCoefficient -> CInt -> CLBFGSParameter ->
CLBFGSParameter
mergeL1NormCoefficient Nothing _ p = p
| 154
|
mergeL1NormCoefficient :: L1NormCoefficient -> CInt -> CLBFGSParameter ->
CLBFGSParameter
mergeL1NormCoefficient Nothing _ p = p
| 154
|
mergeL1NormCoefficient Nothing _ p = p
| 38
| false
| true
| 0
| 7
| 40
| 30
| 15
| 15
| null | null |
a-ford/notghc
|
Llvm/Types.hs
|
bsd-3-clause
|
getStatType (LMAdd t _) = getStatType t
| 47
|
getStatType (LMAdd t _) = getStatType t
| 47
|
getStatType (LMAdd t _) = getStatType t
| 47
| false
| false
| 0
| 7
| 14
| 20
| 9
| 11
| null | null |
bwalkowi/RBT
|
src/RBT.hs
|
bsd-3-clause
|
max (Node _ _ _ right) = RBT.max right
| 38
|
max (Node _ _ _ right) = RBT.max right
| 38
|
max (Node _ _ _ right) = RBT.max right
| 38
| false
| false
| 0
| 6
| 8
| 27
| 12
| 15
| null | null |
tsahyt/midi-simple
|
src/Sound/MIDI/Parser.hs
|
lgpl-3.0
|
aftertouch :: Parser ChannelVoice
aftertouch = channelMessage 0x0A $ \c ->
Aftertouch (Channel c) <$> pitch <*> touch
| 121
|
aftertouch :: Parser ChannelVoice
aftertouch = channelMessage 0x0A $ \c ->
Aftertouch (Channel c) <$> pitch <*> touch
| 121
|
aftertouch = channelMessage 0x0A $ \c ->
Aftertouch (Channel c) <$> pitch <*> touch
| 87
| false
| true
| 1
| 8
| 21
| 47
| 21
| 26
| null | null |
phischu/fragnix
|
benchmarks/containers/Data.Map.Base.hs
|
bsd-3-clause
|
showTree :: (Show k,Show a) => Map k a -> String
showTree m
= showTreeWith showElem True False m
where
showElem k x = show k ++ ":=" ++ show x
{- | /O(n)/. The expression (@'showTreeWith' showelem hang wide map@) shows
the tree that implements the map. Elements are shown using the @showElem@ function. If @hang@ is
'True', a /hanging/ tree is shown otherwise a rotated tree is shown. If
@wide@ is 'True', an extra wide version is shown.
> Map> let t = fromDistinctAscList [(x,()) | x <- [1..5]]
> Map> putStrLn $ showTreeWith (\k x -> show (k,x)) True False t
> (4,())
> +--(2,())
> | +--(1,())
> | +--(3,())
> +--(5,())
>
> Map> putStrLn $ showTreeWith (\k x -> show (k,x)) True True t
> (4,())
> |
> +--(2,())
> | |
> | +--(1,())
> | |
> | +--(3,())
> |
> +--(5,())
>
> Map> putStrLn $ showTreeWith (\k x -> show (k,x)) False True t
> +--(5,())
> |
> (4,())
> |
> | +--(3,())
> | |
> +--(2,())
> |
> +--(1,())
-}
| 972
|
showTree :: (Show k,Show a) => Map k a -> String
showTree m
= showTreeWith showElem True False m
where
showElem k x = show k ++ ":=" ++ show x
{- | /O(n)/. The expression (@'showTreeWith' showelem hang wide map@) shows
the tree that implements the map. Elements are shown using the @showElem@ function. If @hang@ is
'True', a /hanging/ tree is shown otherwise a rotated tree is shown. If
@wide@ is 'True', an extra wide version is shown.
> Map> let t = fromDistinctAscList [(x,()) | x <- [1..5]]
> Map> putStrLn $ showTreeWith (\k x -> show (k,x)) True False t
> (4,())
> +--(2,())
> | +--(1,())
> | +--(3,())
> +--(5,())
>
> Map> putStrLn $ showTreeWith (\k x -> show (k,x)) True True t
> (4,())
> |
> +--(2,())
> | |
> | +--(1,())
> | |
> | +--(3,())
> |
> +--(5,())
>
> Map> putStrLn $ showTreeWith (\k x -> show (k,x)) False True t
> +--(5,())
> |
> (4,())
> |
> | +--(3,())
> | |
> +--(2,())
> |
> +--(1,())
-}
| 972
|
showTree m
= showTreeWith showElem True False m
where
showElem k x = show k ++ ":=" ++ show x
{- | /O(n)/. The expression (@'showTreeWith' showelem hang wide map@) shows
the tree that implements the map. Elements are shown using the @showElem@ function. If @hang@ is
'True', a /hanging/ tree is shown otherwise a rotated tree is shown. If
@wide@ is 'True', an extra wide version is shown.
> Map> let t = fromDistinctAscList [(x,()) | x <- [1..5]]
> Map> putStrLn $ showTreeWith (\k x -> show (k,x)) True False t
> (4,())
> +--(2,())
> | +--(1,())
> | +--(3,())
> +--(5,())
>
> Map> putStrLn $ showTreeWith (\k x -> show (k,x)) True True t
> (4,())
> |
> +--(2,())
> | |
> | +--(1,())
> | |
> | +--(3,())
> |
> +--(5,())
>
> Map> putStrLn $ showTreeWith (\k x -> show (k,x)) False True t
> +--(5,())
> |
> (4,())
> |
> | +--(3,())
> | |
> +--(2,())
> |
> +--(1,())
-}
| 923
| false
| true
| 5
| 8
| 243
| 90
| 37
| 53
| null | null |
ant0nsc/bond
|
compiler/src/Language/Bond/Syntax/Util.hs
|
mit
|
isScalar BT_Bool = True
| 23
|
isScalar BT_Bool = True
| 23
|
isScalar BT_Bool = True
| 23
| false
| false
| 0
| 4
| 3
| 10
| 4
| 6
| null | null |
vasily-kartashov/playground
|
99-problems/problem-46.hs
|
apache-2.0
|
not' False = True
| 17
|
not' False = True
| 17
|
not' False = True
| 17
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
romanofski/gtfsbrisbane
|
test/Main.hs
|
bsd-3-clause
|
-- unit tests
--
unittests :: TestTree
unittests =
testGroup "unit tests" [feedTests, importTests, updateTests, scheduleTests]
| 130
|
unittests :: TestTree
unittests =
testGroup "unit tests" [feedTests, importTests, updateTests, scheduleTests]
| 113
|
unittests =
testGroup "unit tests" [feedTests, importTests, updateTests, scheduleTests]
| 91
| true
| true
| 0
| 6
| 19
| 30
| 18
| 12
| null | null |
thalerjonathan/phd
|
coding/libraries/chimera/examples/ABS/SugarScape/Common.hs
|
gpl-3.0
|
potentialLender :: SugarScapeAgentState -> Maybe Double
potentialLender s
| tooOldForChildren s = Just $ half (sugAgSugarLevel s)
| isFertile s = fertileLending s
| otherwise = Nothing
where
fertileLending :: SugarScapeAgentState -> Maybe Double
fertileLending s
| excessAmount > 0 = Just excessAmount
| otherwise = Nothing
where
excessAmount = excessAmountToChildBearing s
half x = x * 0.5
| 497
|
potentialLender :: SugarScapeAgentState -> Maybe Double
potentialLender s
| tooOldForChildren s = Just $ half (sugAgSugarLevel s)
| isFertile s = fertileLending s
| otherwise = Nothing
where
fertileLending :: SugarScapeAgentState -> Maybe Double
fertileLending s
| excessAmount > 0 = Just excessAmount
| otherwise = Nothing
where
excessAmount = excessAmountToChildBearing s
half x = x * 0.5
| 496
|
potentialLender s
| tooOldForChildren s = Just $ half (sugAgSugarLevel s)
| isFertile s = fertileLending s
| otherwise = Nothing
where
fertileLending :: SugarScapeAgentState -> Maybe Double
fertileLending s
| excessAmount > 0 = Just excessAmount
| otherwise = Nothing
where
excessAmount = excessAmountToChildBearing s
half x = x * 0.5
| 440
| false
| true
| 2
| 9
| 164
| 154
| 65
| 89
| null | null |
NorfairKing/project-euler
|
005/haskell/solution.hs
|
gpl-2.0
|
lcml :: Integral a => [a] -> a
lcml = foldl' lcm 1
| 50
|
lcml :: Integral a => [a] -> a
lcml = foldl' lcm 1
| 50
|
lcml = foldl' lcm 1
| 19
| false
| true
| 0
| 8
| 12
| 38
| 16
| 22
| null | null |
deech/fltkhs
|
Setup.hs
|
mit
|
registerHook pkg_descr localbuildinfo _ flags =
if hasLibs pkg_descr
then register pkg_descr localbuildinfo flags
else setupMessage verbosity
"Package contains no library to register:" (packageId pkg_descr)
where verbosity = fromFlag (regVerbosity flags)
| 279
|
registerHook pkg_descr localbuildinfo _ flags =
if hasLibs pkg_descr
then register pkg_descr localbuildinfo flags
else setupMessage verbosity
"Package contains no library to register:" (packageId pkg_descr)
where verbosity = fromFlag (regVerbosity flags)
| 279
|
registerHook pkg_descr localbuildinfo _ flags =
if hasLibs pkg_descr
then register pkg_descr localbuildinfo flags
else setupMessage verbosity
"Package contains no library to register:" (packageId pkg_descr)
where verbosity = fromFlag (regVerbosity flags)
| 279
| false
| false
| 0
| 8
| 55
| 63
| 30
| 33
| null | null |
DavidAlphaFox/darcs
|
src/Darcs/Util/IsoDate.hs
|
gpl-2.0
|
theBeginning :: CalendarTime
theBeginning = unsafePerformIO $ toCalendarTime $ TOD 0 0
| 86
|
theBeginning :: CalendarTime
theBeginning = unsafePerformIO $ toCalendarTime $ TOD 0 0
| 86
|
theBeginning = unsafePerformIO $ toCalendarTime $ TOD 0 0
| 57
| false
| true
| 0
| 6
| 11
| 24
| 12
| 12
| null | null |
valderman/selda
|
selda/src/Database/Selda/Query.hs
|
mit
|
orderRandom :: Query s ()
orderRandom = order (One (NulOp (Fun0 "RANDOM") :: Exp SQL Int)) Asc
| 94
|
orderRandom :: Query s ()
orderRandom = order (One (NulOp (Fun0 "RANDOM") :: Exp SQL Int)) Asc
| 94
|
orderRandom = order (One (NulOp (Fun0 "RANDOM") :: Exp SQL Int)) Asc
| 68
| false
| true
| 0
| 11
| 16
| 55
| 25
| 30
| null | null |
beni55/hermit
|
src/HERMIT/Context.hs
|
bsd-2-clause
|
-- | Determine whether a variable is in scope.
inScope :: BoundVars c => c -> Var -> Bool
inScope c v = not (isDeadBinder v || (isLocalVar v && (v `notElemVarSet` boundVars c)))
| 177
|
inScope :: BoundVars c => c -> Var -> Bool
inScope c v = not (isDeadBinder v || (isLocalVar v && (v `notElemVarSet` boundVars c)))
| 130
|
inScope c v = not (isDeadBinder v || (isLocalVar v && (v `notElemVarSet` boundVars c)))
| 87
| true
| true
| 0
| 12
| 33
| 67
| 34
| 33
| null | null |
brendanhay/gogol
|
gogol-adexchangebuyer2/gen/Network/Google/Resource/AdExchangeBuyer2/Bidders/FilterSets/BidMetrics/List.hs
|
mpl-2.0
|
-- | Requested page size. The server may return fewer results than requested.
-- If unspecified, the server will pick an appropriate default.
bfsbmlPageSize :: Lens' BiddersFilterSetsBidMetricsList (Maybe Int32)
bfsbmlPageSize
= lens _bfsbmlPageSize
(\ s a -> s{_bfsbmlPageSize = a})
. mapping _Coerce
| 315
|
bfsbmlPageSize :: Lens' BiddersFilterSetsBidMetricsList (Maybe Int32)
bfsbmlPageSize
= lens _bfsbmlPageSize
(\ s a -> s{_bfsbmlPageSize = a})
. mapping _Coerce
| 173
|
bfsbmlPageSize
= lens _bfsbmlPageSize
(\ s a -> s{_bfsbmlPageSize = a})
. mapping _Coerce
| 103
| true
| true
| 2
| 8
| 56
| 61
| 29
| 32
| null | null |
tjakway/ghcjvm
|
compiler/specialise/Rules.hs
|
bsd-3-clause
|
findBest :: (Id, [CoreExpr])
-> (CoreRule,CoreExpr) -> [(CoreRule,CoreExpr)] -> (CoreRule,CoreExpr)
-- All these pairs matched the expression
-- Return the pair the the most specific rule
-- The (fn,args) is just for overlap reporting
findBest _ (rule,ans) [] = (rule,ans)
| 289
|
findBest :: (Id, [CoreExpr])
-> (CoreRule,CoreExpr) -> [(CoreRule,CoreExpr)] -> (CoreRule,CoreExpr)
findBest _ (rule,ans) [] = (rule,ans)
| 153
|
findBest _ (rule,ans) [] = (rule,ans)
| 44
| true
| true
| 0
| 10
| 56
| 83
| 48
| 35
| null | null |
cutsea110/aop
|
src/Traditional.hs
|
bsd-3-clause
|
empty = Empty
| 13
|
empty = Empty
| 13
|
empty = Empty
| 13
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
supermitch/learn-haskell
|
edx-fp101x/1_hw.hs
|
mit
|
average ns = sum ns `div` length ns
| 35
|
average ns = sum ns `div` length ns
| 35
|
average ns = sum ns `div` length ns
| 35
| false
| false
| 0
| 6
| 7
| 21
| 10
| 11
| null | null |
gallais/potpourri
|
haskell/hsubst/Context.hs
|
gpl-3.0
|
wkSubstTm (SubstTm v u) = SubstTm (Just v) (wkNf u)
| 51
|
wkSubstTm (SubstTm v u) = SubstTm (Just v) (wkNf u)
| 51
|
wkSubstTm (SubstTm v u) = SubstTm (Just v) (wkNf u)
| 51
| false
| false
| 0
| 7
| 9
| 34
| 16
| 18
| null | null |
liyanchang/scheme-in-haskell
|
src/chp3.hs
|
mit
|
{-|
main = do
args <- getArgs
putStrLn (readExpr (args !! 0))
-}
symbol :: Parser Char
symbol = oneOf "!$%&|*+-/:<=?>@^~#"
| 131
|
symbol :: Parser Char
symbol = oneOf "!$%&|*+-/:<=?>@^~#"
| 57
|
symbol = oneOf "!$%&|*+-/:<=?>@^~#"
| 35
| true
| true
| 0
| 6
| 29
| 24
| 10
| 14
| null | null |
MihaiVisu/HaskellStuff
|
tutorial3 week5/tutorial3.hs
|
mit
|
- b.
andRec :: [Bool] -> Bool
andRec [] = True
| 47
|
andRec :: [Bool] -> Bool
andRec [] = True
| 41
|
andRec [] = True
| 16
| true
| true
| 1
| 8
| 11
| 35
| 16
| 19
| null | null |
chrisjpn/CPIB_ILMCompiler
|
src/Parser.hs
|
bsd-3-clause
|
parseExpr :: Parser IMLVal
parseExpr = try parseBoolExpr
<|> try parseTerm1
| 79
|
parseExpr :: Parser IMLVal
parseExpr = try parseBoolExpr
<|> try parseTerm1
| 79
|
parseExpr = try parseBoolExpr
<|> try parseTerm1
| 52
| false
| true
| 3
| 5
| 14
| 27
| 13
| 14
| null | null |
Yuras/hfd
|
src/Print.hs
|
bsd-3-clause
|
-- | Print variable
doPrint :: MonadIO m => [String] -> App m ()
doPrint v = do
vs <- getFrame
let vs' = filter (\a -> amfUndecoratedName a == head v) vs
unless (null vs') (doPrintProps (tail v) (head vs'))
-- | Print object properties as requested
| 255
|
doPrint :: MonadIO m => [String] -> App m ()
doPrint v = do
vs <- getFrame
let vs' = filter (\a -> amfUndecoratedName a == head v) vs
unless (null vs') (doPrintProps (tail v) (head vs'))
-- | Print object properties as requested
| 235
|
doPrint v = do
vs <- getFrame
let vs' = filter (\a -> amfUndecoratedName a == head v) vs
unless (null vs') (doPrintProps (tail v) (head vs'))
-- | Print object properties as requested
| 190
| true
| true
| 0
| 14
| 54
| 110
| 53
| 57
| null | null |
pgj/bead
|
src/Bead/View/RouteOf.hs
|
bsd-3-clause
|
routeWithParams :: (IsString s) => Page a b c d e -> [ReqParam] -> s
routeWithParams p rs = fromString . join $
[routeOf p, "?"] ++ (intersperse "&" (map queryStringParam rs))
| 177
|
routeWithParams :: (IsString s) => Page a b c d e -> [ReqParam] -> s
routeWithParams p rs = fromString . join $
[routeOf p, "?"] ++ (intersperse "&" (map queryStringParam rs))
| 177
|
routeWithParams p rs = fromString . join $
[routeOf p, "?"] ++ (intersperse "&" (map queryStringParam rs))
| 108
| false
| true
| 0
| 9
| 33
| 84
| 43
| 41
| null | null |
skill-lang/skill
|
src/main/resources/haskell/Methods.hs
|
bsd-3-clause
|
remodel' :: (Get a, Get a) -> Get (a, a)
remodel' (g1, g2) = g1 >>= \v1 -> g2 >>= \v2 -> return (v1, v2)
| 105
|
remodel' :: (Get a, Get a) -> Get (a, a)
remodel' (g1, g2) = g1 >>= \v1 -> g2 >>= \v2 -> return (v1, v2)
| 104
|
remodel' (g1, g2) = g1 >>= \v1 -> g2 >>= \v2 -> return (v1, v2)
| 63
| false
| true
| 2
| 10
| 25
| 74
| 39
| 35
| null | null |
uuhan/Idris-dev
|
src/Idris/Delaborate.hs
|
bsd-3-clause
|
pprintErr' i (ElabScriptStuck tm) =
text "Can't run" <+> pprintTT [] tm <+> text "as an elaborator script." <$>
text "Is it a stuck term?"
| 142
|
pprintErr' i (ElabScriptStuck tm) =
text "Can't run" <+> pprintTT [] tm <+> text "as an elaborator script." <$>
text "Is it a stuck term?"
| 142
|
pprintErr' i (ElabScriptStuck tm) =
text "Can't run" <+> pprintTT [] tm <+> text "as an elaborator script." <$>
text "Is it a stuck term?"
| 142
| false
| false
| 0
| 9
| 28
| 47
| 20
| 27
| null | null |
spacekitteh/smcghc
|
ghc/Main.hs
|
bsd-3-clause
|
isInterpretiveMode _ = False
| 40
|
isInterpretiveMode _ = False
| 40
|
isInterpretiveMode _ = False
| 40
| false
| false
| 0
| 5
| 15
| 9
| 4
| 5
| null | null |
JoeyEremondi/utrecht-apa-p1
|
src/Elm/Compiler/Module.hs
|
bsd-3-clause
|
-- POKING AROUND INTERFACES
interfacePorts :: Interface -> [String]
interfacePorts interface =
Module.iPorts interface
| 123
|
interfacePorts :: Interface -> [String]
interfacePorts interface =
Module.iPorts interface
| 94
|
interfacePorts interface =
Module.iPorts interface
| 54
| true
| true
| 0
| 6
| 18
| 27
| 14
| 13
| null | null |
bacchanalia/KitchenSink
|
KitchenSink/Qualified.hs
|
gpl-3.0
|
-- |'MapS.updateMax'
ms_updateMax = MapS.updateMax
| 50
|
ms_updateMax = MapS.updateMax
| 29
|
ms_updateMax = MapS.updateMax
| 29
| true
| false
| 0
| 5
| 4
| 9
| 5
| 4
| null | null |
peter-fogg/pardoc
|
src/Text/Pandoc/Writers/DokuWiki.hs
|
gpl-2.0
|
blockToDokuWiki _ HorizontalRule = return "\n----\n"
| 52
|
blockToDokuWiki _ HorizontalRule = return "\n----\n"
| 52
|
blockToDokuWiki _ HorizontalRule = return "\n----\n"
| 52
| false
| false
| 0
| 5
| 5
| 14
| 6
| 8
| null | null |
bgold-cosmos/Tidal
|
src/Sound/Tidal/Params.hs
|
gpl-3.0
|
cutoffCountTo :: String -> Pattern Double -> Pattern ValueMap
cutoffCountTo name ipat = innerJoin $ (\i -> pStateF "cutoff" name (maybe 0 ((`mod'` i) . (+1)))) <$> ipat
| 168
|
cutoffCountTo :: String -> Pattern Double -> Pattern ValueMap
cutoffCountTo name ipat = innerJoin $ (\i -> pStateF "cutoff" name (maybe 0 ((`mod'` i) . (+1)))) <$> ipat
| 168
|
cutoffCountTo name ipat = innerJoin $ (\i -> pStateF "cutoff" name (maybe 0 ((`mod'` i) . (+1)))) <$> ipat
| 106
| false
| true
| 2
| 13
| 27
| 84
| 43
| 41
| null | null |
alexander-at-github/eta
|
compiler/ETA/CodeGen/ArgRep.hs
|
bsd-3-clause
|
toArgRep :: PrimRep -> ArgRep
toArgRep VoidRep = V
| 60
|
toArgRep :: PrimRep -> ArgRep
toArgRep VoidRep = V
| 60
|
toArgRep VoidRep = V
| 30
| false
| true
| 0
| 5
| 18
| 22
| 10
| 12
| null | null |
jdreaver/quantities
|
test-suite/Data/Quantities/ConstructorsSpec.hs
|
bsd-3-clause
|
isLeftDimError _ = False
| 24
|
isLeftDimError _ = False
| 24
|
isLeftDimError _ = False
| 24
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
alexvong1995/pandoc
|
src/Text/Pandoc/Writers/ConTeXt.hs
|
gpl-2.0
|
fromBcp47 ("de":"DE":_) = "de-de"
| 35
|
fromBcp47 ("de":"DE":_) = "de-de"
| 35
|
fromBcp47 ("de":"DE":_) = "de-de"
| 35
| false
| false
| 0
| 7
| 5
| 21
| 10
| 11
| null | null |
chip2n/tin172-project
|
haskell/src/Shrdlite/Planner.hs
|
gpl-3.0
|
makeFloorSpace (w:ws) = 2 * length w : makeFloorSpace ws
| 56
|
makeFloorSpace (w:ws) = 2 * length w : makeFloorSpace ws
| 56
|
makeFloorSpace (w:ws) = 2 * length w : makeFloorSpace ws
| 56
| false
| false
| 0
| 7
| 9
| 30
| 14
| 16
| null | null |
cabbibo/gallery
|
app/Types.hs
|
bsd-3-clause
|
startHeight :: GLfloat
startHeight = 1.5
| 40
|
startHeight :: GLfloat
startHeight = 1.5
| 40
|
startHeight = 1.5
| 17
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
csrhodes/pandoc
|
pandoc.hs
|
gpl-2.0
|
adjustImagePath :: FilePath -> [FilePath] -> Inline -> Inline
adjustImagePath dir paths (Image lab (src, tit))
| src `elem` paths = Image lab (dir ++ "/" ++ src, tit)
| 169
|
adjustImagePath :: FilePath -> [FilePath] -> Inline -> Inline
adjustImagePath dir paths (Image lab (src, tit))
| src `elem` paths = Image lab (dir ++ "/" ++ src, tit)
| 169
|
adjustImagePath dir paths (Image lab (src, tit))
| src `elem` paths = Image lab (dir ++ "/" ++ src, tit)
| 107
| false
| true
| 0
| 9
| 31
| 78
| 41
| 37
| null | null |
noinia/balbst
|
src/Data/MergeableDict.hs
|
bsd-3-clause
|
blackHeight :: RBTree t -> BlackHeight
blackHeight Leaf = 0
| 71
|
blackHeight :: RBTree t -> BlackHeight
blackHeight Leaf = 0
| 71
|
blackHeight Leaf = 0
| 32
| false
| true
| 0
| 6
| 21
| 25
| 11
| 14
| null | null |
emwap/syntactic
|
src/Data/Syntactic/Interpretation.hs
|
bsd-3-clause
|
renderArgsSmart args sym
| isInfix = "(" ++ unwords [a,op,b] ++ ")"
| otherwise = "(" ++ unwords (name : args) ++ ")"
where
name = renderSym sym
[a,b] = args
op = init $ tail name
isInfix
= not (null name)
&& head name == '('
&& last name == ')'
&& length args == 2
-- | Render an 'AST' as concrete syntax
| 363
|
renderArgsSmart args sym
| isInfix = "(" ++ unwords [a,op,b] ++ ")"
| otherwise = "(" ++ unwords (name : args) ++ ")"
where
name = renderSym sym
[a,b] = args
op = init $ tail name
isInfix
= not (null name)
&& head name == '('
&& last name == ')'
&& length args == 2
-- | Render an 'AST' as concrete syntax
| 363
|
renderArgsSmart args sym
| isInfix = "(" ++ unwords [a,op,b] ++ ")"
| otherwise = "(" ++ unwords (name : args) ++ ")"
where
name = renderSym sym
[a,b] = args
op = init $ tail name
isInfix
= not (null name)
&& head name == '('
&& last name == ')'
&& length args == 2
-- | Render an 'AST' as concrete syntax
| 363
| false
| false
| 8
| 9
| 122
| 152
| 72
| 80
| null | null |
ghcjs/jsaddle-dom
|
src/JSDOM/Generated/CanvasRenderingContext2D.hs
|
mit
|
-- | <https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.createPattern Mozilla CanvasRenderingContext2D.createPattern documentation>
createPattern_ ::
(MonadDOM m, IsCanvasImageSource image, ToJSString repetition) =>
CanvasRenderingContext2D -> image -> repetition -> m ()
createPattern_ self image repetition
= liftDOM
(void
(self ^. jsf "createPattern" [toJSVal image, toJSVal repetition]))
| 465
|
createPattern_ ::
(MonadDOM m, IsCanvasImageSource image, ToJSString repetition) =>
CanvasRenderingContext2D -> image -> repetition -> m ()
createPattern_ self image repetition
= liftDOM
(void
(self ^. jsf "createPattern" [toJSVal image, toJSVal repetition]))
| 308
|
createPattern_ self image repetition
= liftDOM
(void
(self ^. jsf "createPattern" [toJSVal image, toJSVal repetition]))
| 136
| true
| true
| 0
| 12
| 87
| 90
| 45
| 45
| null | null |
rawlep/EQS
|
sourceCode/GlobalParameters.hs
|
mit
|
runInfoMessage mStr string = do
dia <- newMessageInfo string
maybe (return ()) (\str -> G.set dia [G.windowTitle G.:= str]) mStr
ans <- G.dialogRun dia
G.dialogResponse dia ans
G.widgetDestroy dia
-- a decision message dialog: displays a message requesting whether or not to
-- execute a process. If Yes is clicked, the provess is executed. Otherwise
-- nothing is done
| 390
|
runInfoMessage mStr string = do
dia <- newMessageInfo string
maybe (return ()) (\str -> G.set dia [G.windowTitle G.:= str]) mStr
ans <- G.dialogRun dia
G.dialogResponse dia ans
G.widgetDestroy dia
-- a decision message dialog: displays a message requesting whether or not to
-- execute a process. If Yes is clicked, the provess is executed. Otherwise
-- nothing is done
| 390
|
runInfoMessage mStr string = do
dia <- newMessageInfo string
maybe (return ()) (\str -> G.set dia [G.windowTitle G.:= str]) mStr
ans <- G.dialogRun dia
G.dialogResponse dia ans
G.widgetDestroy dia
-- a decision message dialog: displays a message requesting whether or not to
-- execute a process. If Yes is clicked, the provess is executed. Otherwise
-- nothing is done
| 390
| false
| false
| 1
| 14
| 79
| 103
| 46
| 57
| null | null |
oldmanmike/ghc
|
compiler/cmm/CLabel.hs
|
bsd-3-clause
|
pprCLbl (AsmTempLabel {}) = panic "pprCLbl AsmTempLabel"
| 62
|
pprCLbl (AsmTempLabel {}) = panic "pprCLbl AsmTempLabel"
| 62
|
pprCLbl (AsmTempLabel {}) = panic "pprCLbl AsmTempLabel"
| 62
| false
| false
| 0
| 6
| 12
| 20
| 9
| 11
| null | null |
bergmark/hlint
|
src/Language/Haskell/HLint2.hs
|
bsd-3-clause
|
esolveBuiltin :: [String] -> [Hint]
resolveBuiltin builtin = map f $ nub $ concat [if x == "All" then map fst builtinHints else [x] | x <- builtin]
where f x = fromMaybe (error $ "Unknown builtin hints: HLint.Builtin." ++ x) $ lookup x builtinHints
-- | Snippet from the documentation, if this changes, update the documentation
| 333
|
resolveBuiltin :: [String] -> [Hint]
resolveBuiltin builtin = map f $ nub $ concat [if x == "All" then map fst builtinHints else [x] | x <- builtin]
where f x = fromMaybe (error $ "Unknown builtin hints: HLint.Builtin." ++ x) $ lookup x builtinHints
-- | Snippet from the documentation, if this changes, update the documentation
| 333
|
resolveBuiltin builtin = map f $ nub $ concat [if x == "All" then map fst builtinHints else [x] | x <- builtin]
where f x = fromMaybe (error $ "Unknown builtin hints: HLint.Builtin." ++ x) $ lookup x builtinHints
-- | Snippet from the documentation, if this changes, update the documentation
| 296
| false
| true
| 0
| 11
| 62
| 103
| 53
| 50
| null | null |
darthdeus/ghc-mod-ng
|
Language/Haskell/GhcMod/Evaluator.hs
|
bsd-3-clause
|
----------------------------------------------------------------
argspec :: [OptDescr (Options -> Options)]
argspec = [ Option "l" ["tolisp"]
(NoArg (\opts -> opts { outputStyle = LispStyle }))
"print as a list of Lisp"
, Option "h" ["hlintOpt"]
(ReqArg (\h opts -> opts { hlintOpts = h : hlintOpts opts }) "hlintOpt")
"hlint options"
, Option "g" ["ghcOpt"]
(ReqArg (\g opts -> opts { ghcOpts = g : ghcOpts opts }) "ghcOpt")
"GHC options"
, Option "o" ["operators"]
(NoArg (\opts -> opts { operators = True }))
"print operators, too"
, Option "d" ["detailed"]
(NoArg (\opts -> opts { detailed = True }))
"print detailed info"
, Option "q" ["qualified"]
(NoArg (\opts -> opts { qualified = True }))
"show qualified names"
, Option "b" ["boundary"]
(ReqArg (\s opts -> opts { lineSeparator = LineSeparator s }) "sep")
"specify line separator (default is Nul string)"
]
| 1,106
|
argspec :: [OptDescr (Options -> Options)]
argspec = [ Option "l" ["tolisp"]
(NoArg (\opts -> opts { outputStyle = LispStyle }))
"print as a list of Lisp"
, Option "h" ["hlintOpt"]
(ReqArg (\h opts -> opts { hlintOpts = h : hlintOpts opts }) "hlintOpt")
"hlint options"
, Option "g" ["ghcOpt"]
(ReqArg (\g opts -> opts { ghcOpts = g : ghcOpts opts }) "ghcOpt")
"GHC options"
, Option "o" ["operators"]
(NoArg (\opts -> opts { operators = True }))
"print operators, too"
, Option "d" ["detailed"]
(NoArg (\opts -> opts { detailed = True }))
"print detailed info"
, Option "q" ["qualified"]
(NoArg (\opts -> opts { qualified = True }))
"show qualified names"
, Option "b" ["boundary"]
(ReqArg (\s opts -> opts { lineSeparator = LineSeparator s }) "sep")
"specify line separator (default is Nul string)"
]
| 1,040
|
argspec = [ Option "l" ["tolisp"]
(NoArg (\opts -> opts { outputStyle = LispStyle }))
"print as a list of Lisp"
, Option "h" ["hlintOpt"]
(ReqArg (\h opts -> opts { hlintOpts = h : hlintOpts opts }) "hlintOpt")
"hlint options"
, Option "g" ["ghcOpt"]
(ReqArg (\g opts -> opts { ghcOpts = g : ghcOpts opts }) "ghcOpt")
"GHC options"
, Option "o" ["operators"]
(NoArg (\opts -> opts { operators = True }))
"print operators, too"
, Option "d" ["detailed"]
(NoArg (\opts -> opts { detailed = True }))
"print detailed info"
, Option "q" ["qualified"]
(NoArg (\opts -> opts { qualified = True }))
"show qualified names"
, Option "b" ["boundary"]
(ReqArg (\s opts -> opts { lineSeparator = LineSeparator s }) "sep")
"specify line separator (default is Nul string)"
]
| 997
| true
| true
| 0
| 14
| 378
| 313
| 174
| 139
| null | null |
danr/hipspec
|
src/HipSpec/ATP/Results.hs
|
gpl-3.0
|
isSuccess :: ProverResult -> Bool
isSuccess Success{} = True
| 60
|
isSuccess :: ProverResult -> Bool
isSuccess Success{} = True
| 60
|
isSuccess Success{} = True
| 26
| false
| true
| 0
| 6
| 8
| 22
| 11
| 11
| null | null |
Prillan/haskell-jsontools
|
app/jless/Program.hs
|
bsd-3-clause
|
drawState :: ProgramM ()
drawState = do
jz <- gets obj
d <- gets redraw
c <- gets color
if d
then drawInitial
else uw $ setTouched True
clean
b <- gets botBar
lift $ updateWindow b $ do
moveCursor 1 0
clearLine
moveCursor 1 0
drawText . rfc6901pointer . fromList . reverse . map fst $ jzHistory jz
setColor (c ColorBlue)
case (current <$> jzPointer jz) of
Just (el, _) -> drawText . rfc6901pointer . fromList . pure $ el
Nothing -> pure ()
setColor (c ColorDefault)
lift render
| 560
|
drawState :: ProgramM ()
drawState = do
jz <- gets obj
d <- gets redraw
c <- gets color
if d
then drawInitial
else uw $ setTouched True
clean
b <- gets botBar
lift $ updateWindow b $ do
moveCursor 1 0
clearLine
moveCursor 1 0
drawText . rfc6901pointer . fromList . reverse . map fst $ jzHistory jz
setColor (c ColorBlue)
case (current <$> jzPointer jz) of
Just (el, _) -> drawText . rfc6901pointer . fromList . pure $ el
Nothing -> pure ()
setColor (c ColorDefault)
lift render
| 560
|
drawState = do
jz <- gets obj
d <- gets redraw
c <- gets color
if d
then drawInitial
else uw $ setTouched True
clean
b <- gets botBar
lift $ updateWindow b $ do
moveCursor 1 0
clearLine
moveCursor 1 0
drawText . rfc6901pointer . fromList . reverse . map fst $ jzHistory jz
setColor (c ColorBlue)
case (current <$> jzPointer jz) of
Just (el, _) -> drawText . rfc6901pointer . fromList . pure $ el
Nothing -> pure ()
setColor (c ColorDefault)
lift render
| 535
| false
| true
| 0
| 16
| 172
| 228
| 101
| 127
| null | null |
ku-fpg/kansas-amber
|
legacy/Deep/SemExample.hs
|
bsd-3-clause
|
semExample :: IO ()
semExample = withArduino True "/dev/cu.usbmodem1421" $ do
initExample
-- Query to confirm task creation
tasks <- queryAllTasksE
liftIO $ print tasks
task1 <- queryTaskE 1
liftIO $ print task1
task2 <- queryTaskE 2
liftIO $ print task2
-- Wait for any debug messgaes from Arduino
debugListen
| 350
|
semExample :: IO ()
semExample = withArduino True "/dev/cu.usbmodem1421" $ do
initExample
-- Query to confirm task creation
tasks <- queryAllTasksE
liftIO $ print tasks
task1 <- queryTaskE 1
liftIO $ print task1
task2 <- queryTaskE 2
liftIO $ print task2
-- Wait for any debug messgaes from Arduino
debugListen
| 350
|
semExample = withArduino True "/dev/cu.usbmodem1421" $ do
initExample
-- Query to confirm task creation
tasks <- queryAllTasksE
liftIO $ print tasks
task1 <- queryTaskE 1
liftIO $ print task1
task2 <- queryTaskE 2
liftIO $ print task2
-- Wait for any debug messgaes from Arduino
debugListen
| 330
| false
| true
| 0
| 9
| 89
| 97
| 40
| 57
| null | null |
mietek/mighttpd2
|
test/ConfigSpec.hs
|
bsd-3-clause
|
spec :: Spec
spec = do
describe "parseConfig" $ do
it "parses example.conf correctly" $ do
res <- parseOption "conf/example.conf" "foo"
res `shouldBe` ans
| 190
|
spec :: Spec
spec = do
describe "parseConfig" $ do
it "parses example.conf correctly" $ do
res <- parseOption "conf/example.conf" "foo"
res `shouldBe` ans
| 190
|
spec = do
describe "parseConfig" $ do
it "parses example.conf correctly" $ do
res <- parseOption "conf/example.conf" "foo"
res `shouldBe` ans
| 177
| false
| true
| 0
| 14
| 59
| 52
| 24
| 28
| null | null |
happyherp/lazyset
|
Data/Map/Lazier.hs
|
mit
|
-- | Check if a key exists in this Map.
member :: Ord k => k -> Map k e -> Bool
member key = LS.member (JustKey key)
| 117
|
member :: Ord k => k -> Map k e -> Bool
member key = LS.member (JustKey key)
| 76
|
member key = LS.member (JustKey key)
| 36
| true
| true
| 0
| 8
| 28
| 46
| 22
| 24
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.