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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Potregon/while
|
src/Interface/TAC.hs
|
gpl-3.0
|
getUseVariables (MCall _ ref _) = variablesFromData [ref]
| 57
|
getUseVariables (MCall _ ref _) = variablesFromData [ref]
| 57
|
getUseVariables (MCall _ ref _) = variablesFromData [ref]
| 57
| false
| false
| 0
| 7
| 7
| 25
| 12
| 13
| null | null |
susoDominguez/eNominalTerms-Alpha
|
RewritingX.hs
|
unlicense
|
areNRs rw = isNR rw || isNRout rw
| 33
|
areNRs rw = isNR rw || isNRout rw
| 33
|
areNRs rw = isNR rw || isNRout rw
| 33
| false
| false
| 0
| 6
| 7
| 19
| 8
| 11
| null | null |
brendanhay/gogol
|
gogol-dialogflow/gen/Network/Google/Resource/DialogFlow/Projects/Agent/Export.hs
|
mpl-2.0
|
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
paeUploadType :: Lens' ProjectsAgentExport (Maybe Text)
paeUploadType
= lens _paeUploadType
(\ s a -> s{_paeUploadType = a})
| 203
|
paeUploadType :: Lens' ProjectsAgentExport (Maybe Text)
paeUploadType
= lens _paeUploadType
(\ s a -> s{_paeUploadType = a})
| 132
|
paeUploadType
= lens _paeUploadType
(\ s a -> s{_paeUploadType = a})
| 76
| true
| true
| 1
| 9
| 34
| 51
| 25
| 26
| null | null |
ganeti-github-testing/ganeti-test-1
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
opcodeReasonSrcNoded :: String
opcodeReasonSrcNoded = _opcodeReasonSrcDaemon ++ ":noded"
| 88
|
opcodeReasonSrcNoded :: String
opcodeReasonSrcNoded = _opcodeReasonSrcDaemon ++ ":noded"
| 88
|
opcodeReasonSrcNoded = _opcodeReasonSrcDaemon ++ ":noded"
| 57
| false
| true
| 0
| 5
| 7
| 15
| 8
| 7
| null | null |
DavidAlphaFox/ghc
|
libraries/transformers/Control/Monad/Trans/Writer/Strict.hs
|
bsd-3-clause
|
-- | Unwrap a writer computation as a (result, output) pair.
-- (The inverse of 'writer'.)
runWriter :: Writer w a -> (a, w)
runWriter = runIdentity . runWriterT
| 161
|
runWriter :: Writer w a -> (a, w)
runWriter = runIdentity . runWriterT
| 70
|
runWriter = runIdentity . runWriterT
| 36
| true
| true
| 0
| 6
| 28
| 32
| 18
| 14
| null | null |
dillonhuff/Proper
|
src/Proper/Clause.hs
|
bsd-3-clause
|
assignTruthVal (NLit _) = False
| 31
|
assignTruthVal (NLit _) = False
| 31
|
assignTruthVal (NLit _) = False
| 31
| false
| false
| 0
| 7
| 4
| 15
| 7
| 8
| null | null |
Mic92/eidolon
|
Handler/MediumSettings.hs
|
agpl-3.0
|
postMediumSettingsR :: MediumId -> Handler Html
postMediumSettingsR mediumId = do
checkRes <- mediumCheck mediumId
case checkRes of
Right medium -> do
((result, _), _) <- runFormPost $ mediumSettingsForm medium
case result of
FormSuccess temp -> do
_ <- runDB $ update mediumId
[ MediumTitle =. mediumTitle temp
, MediumDescription =. mediumDescription temp
, MediumTags =. mediumTags temp
]
setMessage "Medium settings changed succesfully"
redirect $ MediumR mediumId
_ -> do
setMessage "There was an error changing the settings"
redirect $ MediumSettingsR mediumId
Left (errorMsg, route) -> do
setMessage errorMsg
redirect $ route
| 782
|
postMediumSettingsR :: MediumId -> Handler Html
postMediumSettingsR mediumId = do
checkRes <- mediumCheck mediumId
case checkRes of
Right medium -> do
((result, _), _) <- runFormPost $ mediumSettingsForm medium
case result of
FormSuccess temp -> do
_ <- runDB $ update mediumId
[ MediumTitle =. mediumTitle temp
, MediumDescription =. mediumDescription temp
, MediumTags =. mediumTags temp
]
setMessage "Medium settings changed succesfully"
redirect $ MediumR mediumId
_ -> do
setMessage "There was an error changing the settings"
redirect $ MediumSettingsR mediumId
Left (errorMsg, route) -> do
setMessage errorMsg
redirect $ route
| 782
|
postMediumSettingsR mediumId = do
checkRes <- mediumCheck mediumId
case checkRes of
Right medium -> do
((result, _), _) <- runFormPost $ mediumSettingsForm medium
case result of
FormSuccess temp -> do
_ <- runDB $ update mediumId
[ MediumTitle =. mediumTitle temp
, MediumDescription =. mediumDescription temp
, MediumTags =. mediumTags temp
]
setMessage "Medium settings changed succesfully"
redirect $ MediumR mediumId
_ -> do
setMessage "There was an error changing the settings"
redirect $ MediumSettingsR mediumId
Left (errorMsg, route) -> do
setMessage errorMsg
redirect $ route
| 734
| false
| true
| 0
| 22
| 241
| 206
| 93
| 113
| null | null |
plow-technologies/shakespeare-dynamic
|
ghcjs-shakespeare-dynamic/example/TankGauge.hs
|
mit
|
scaleWidthHeight :: Scale -> (Int,Int) -> (Int, Int)
scaleWidthHeight (Scale (absWidth, absHeight)) (width, height) = (floor width' , floor height')
where width' = (fromIntegral $ width * absWidth) / 1000.0 :: Double
height' = (fromIntegral $ height * absHeight )/ 1000.0 :: Double
| 291
|
scaleWidthHeight :: Scale -> (Int,Int) -> (Int, Int)
scaleWidthHeight (Scale (absWidth, absHeight)) (width, height) = (floor width' , floor height')
where width' = (fromIntegral $ width * absWidth) / 1000.0 :: Double
height' = (fromIntegral $ height * absHeight )/ 1000.0 :: Double
| 291
|
scaleWidthHeight (Scale (absWidth, absHeight)) (width, height) = (floor width' , floor height')
where width' = (fromIntegral $ width * absWidth) / 1000.0 :: Double
height' = (fromIntegral $ height * absHeight )/ 1000.0 :: Double
| 238
| false
| true
| 5
| 8
| 52
| 118
| 64
| 54
| null | null |
snoyberg/photosorter
|
fay/Language/Fay/JQuery.hs
|
bsd-2-clause
|
onClick :: (EventObject -> Fay Bool) -> JQuery -> Fay JQuery
onClick = ffi "%2['click'](%1)"
| 92
|
onClick :: (EventObject -> Fay Bool) -> JQuery -> Fay JQuery
onClick = ffi "%2['click'](%1)"
| 92
|
onClick = ffi "%2['click'](%1)"
| 31
| false
| true
| 0
| 8
| 14
| 35
| 17
| 18
| null | null |
bravit/Idris-dev
|
src/Idris/Reflection.hs
|
bsd-3-clause
|
reflectRawQuote unq (RConstant cst) = reflCall "RConstant" [reflectConstant cst]
| 80
|
reflectRawQuote unq (RConstant cst) = reflCall "RConstant" [reflectConstant cst]
| 80
|
reflectRawQuote unq (RConstant cst) = reflCall "RConstant" [reflectConstant cst]
| 80
| false
| false
| 0
| 7
| 8
| 30
| 13
| 17
| null | null |
pdmurray/haskell-book-ex
|
src/ch4/Exercises4.hs
|
bsd-3-clause
|
-- 10.
f :: (a, b) -> (c, d) -> ((b, d), (a, c))
f x y = ((snd x, snd y), (fst x, fst y))
| 90
|
f :: (a, b) -> (c, d) -> ((b, d), (a, c))
f x y = ((snd x, snd y), (fst x, fst y))
| 82
|
f x y = ((snd x, snd y), (fst x, fst y))
| 40
| true
| true
| 0
| 8
| 26
| 90
| 50
| 40
| null | null |
urbanslug/ghc
|
testsuite/tests/dph/nbody/Main.hs
|
bsd-3-clause
|
mainBatchRun config calcAccels worldStart
= go worldStart
where go !world
= let world' = advanceWorld
(calcAccels $ configEpsilon config)
(configTimeStep config)
world
in if worldSteps world' < configMaxSteps config
then go world'
else world'
-- | Called at end of run to dump final world state.
| 468
|
mainBatchRun config calcAccels worldStart
= go worldStart
where go !world
= let world' = advanceWorld
(calcAccels $ configEpsilon config)
(configTimeStep config)
world
in if worldSteps world' < configMaxSteps config
then go world'
else world'
-- | Called at end of run to dump final world state.
| 468
|
mainBatchRun config calcAccels worldStart
= go worldStart
where go !world
= let world' = advanceWorld
(calcAccels $ configEpsilon config)
(configTimeStep config)
world
in if worldSteps world' < configMaxSteps config
then go world'
else world'
-- | Called at end of run to dump final world state.
| 468
| false
| false
| 0
| 12
| 218
| 83
| 39
| 44
| null | null |
HJvT/com
|
System/Win32/Com.hs
|
bsd-3-clause
|
enumSkip :: Word32 -> IUnknown a -> IO ()
enumSkip count iptr =
invokeIt (\ methPtr ip -> primEnumSkip methPtr ip count) 4 iptr
| 131
|
enumSkip :: Word32 -> IUnknown a -> IO ()
enumSkip count iptr =
invokeIt (\ methPtr ip -> primEnumSkip methPtr ip count) 4 iptr
| 131
|
enumSkip count iptr =
invokeIt (\ methPtr ip -> primEnumSkip methPtr ip count) 4 iptr
| 89
| false
| true
| 0
| 8
| 27
| 56
| 27
| 29
| null | null |
keera-studios/hsQt
|
Qtc/Enums/Gui/QSizePolicy.hs
|
bsd-2-clause
|
fLabel :: ControlTypes
fLabel
= ifControlTypes $ 64
| 53
|
fLabel :: ControlTypes
fLabel
= ifControlTypes $ 64
| 53
|
fLabel
= ifControlTypes $ 64
| 30
| false
| true
| 2
| 6
| 9
| 23
| 9
| 14
| null | null |
grtlr/wyas
|
src/Wyas/Evaluator.hs
|
bsd-3-clause
|
cdr [badArg] = throwError $ TypeMismatch "pair" badArg
| 69
|
cdr [badArg] = throwError $ TypeMismatch "pair" badArg
| 69
|
cdr [badArg] = throwError $ TypeMismatch "pair" badArg
| 69
| false
| false
| 0
| 6
| 22
| 22
| 10
| 12
| null | null |
olorin/amazonka
|
amazonka-route53/gen/Network/AWS/Route53/Types/Product.hs
|
mpl-2.0
|
-- | The code for a country\'s subdivision (e.g., a province of Canada). A
-- subdivision code is only valid with the appropriate country code.
--
-- Constraint: Specifying 'SubdivisionCode' without 'CountryCode' returns
-- an InvalidInput error.
glSubdivisionCode :: Lens' GeoLocation (Maybe Text)
glSubdivisionCode = lens _glSubdivisionCode (\ s a -> s{_glSubdivisionCode = a})
| 379
|
glSubdivisionCode :: Lens' GeoLocation (Maybe Text)
glSubdivisionCode = lens _glSubdivisionCode (\ s a -> s{_glSubdivisionCode = a})
| 132
|
glSubdivisionCode = lens _glSubdivisionCode (\ s a -> s{_glSubdivisionCode = a})
| 80
| true
| true
| 0
| 9
| 53
| 50
| 29
| 21
| null | null |
wskplho/stack
|
src/Stack/Types/Image.hs
|
bsd-3-clause
|
imgDockerAddArgName :: Text
imgDockerAddArgName = "add"
| 55
|
imgDockerAddArgName :: Text
imgDockerAddArgName = "add"
| 55
|
imgDockerAddArgName = "add"
| 27
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
shayan-najd/Haskell-Desugar-Generic
|
Examples/XMonad/SS_noListComp.hs
|
bsd-3-clause
|
filter :: (a -> Bool) -> Stack a -> Maybe (Stack a)
filter p (Stack f ls rs)
= case L.filter p (f : rs) of
f' : rs' -> Just $ Stack f' (L.filter p ls) rs'
[] -> case L.filter p ls of
f' : ls' -> Just $ Stack f' ls' []
[] -> Nothing
| 285
|
filter :: (a -> Bool) -> Stack a -> Maybe (Stack a)
filter p (Stack f ls rs)
= case L.filter p (f : rs) of
f' : rs' -> Just $ Stack f' (L.filter p ls) rs'
[] -> case L.filter p ls of
f' : ls' -> Just $ Stack f' ls' []
[] -> Nothing
| 285
|
filter p (Stack f ls rs)
= case L.filter p (f : rs) of
f' : rs' -> Just $ Stack f' (L.filter p ls) rs'
[] -> case L.filter p ls of
f' : ls' -> Just $ Stack f' ls' []
[] -> Nothing
| 233
| false
| true
| 0
| 13
| 111
| 152
| 74
| 78
| null | null |
justinethier/husk-scheme
|
hs-src/Language/Scheme/Numerical.hs
|
mit
|
numDiv [Number 0] = throwError $ DivideByZero
| 45
|
numDiv [Number 0] = throwError $ DivideByZero
| 45
|
numDiv [Number 0] = throwError $ DivideByZero
| 45
| false
| false
| 0
| 7
| 6
| 19
| 9
| 10
| null | null |
eigengrau/hlint
|
data/Default.hs
|
bsd-3-clause
|
error = all (a /=) ==> notElem a where note = ValidInstance "Eq" a
| 66
|
error = all (a /=) ==> notElem a where note = ValidInstance "Eq" a
| 66
|
error = all (a /=) ==> notElem a where note = ValidInstance "Eq" a
| 66
| false
| false
| 0
| 7
| 13
| 35
| 17
| 18
| null | null |
rueshyna/gogol
|
gogol-cloudmonitoring/gen/Network/Google/Resource/CloudMonitoring/Timeseries/Write.hs
|
mpl-2.0
|
-- | Creates a value of 'TimeseriesWrite' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'twProject'
--
-- * 'twPayload'
timeseriesWrite
:: Text -- ^ 'twProject'
-> WriteTimeseriesRequest -- ^ 'twPayload'
-> TimeseriesWrite
timeseriesWrite pTwProject_ pTwPayload_ =
TimeseriesWrite'
{ _twProject = pTwProject_
, _twPayload = pTwPayload_
}
| 452
|
timeseriesWrite
:: Text -- ^ 'twProject'
-> WriteTimeseriesRequest -- ^ 'twPayload'
-> TimeseriesWrite
timeseriesWrite pTwProject_ pTwPayload_ =
TimeseriesWrite'
{ _twProject = pTwProject_
, _twPayload = pTwPayload_
}
| 245
|
timeseriesWrite pTwProject_ pTwPayload_ =
TimeseriesWrite'
{ _twProject = pTwProject_
, _twPayload = pTwPayload_
}
| 130
| true
| true
| 0
| 6
| 92
| 47
| 30
| 17
| null | null |
cartazio/omega
|
src/NarrowData.hs
|
bsd-3-clause
|
eq [x,y] = inject(RelN (EqR (x,y)))
| 35
|
eq [x,y] = inject(RelN (EqR (x,y)))
| 35
|
eq [x,y] = inject(RelN (EqR (x,y)))
| 35
| false
| false
| 0
| 10
| 5
| 36
| 19
| 17
| null | null |
GaloisInc/halvm-ghc
|
compiler/coreSyn/TrieMap.hs
|
bsd-3-clause
|
lkTickish :: Tickish Id -> TickishMap a -> Maybe a
lkTickish = lookupTM
| 71
|
lkTickish :: Tickish Id -> TickishMap a -> Maybe a
lkTickish = lookupTM
| 71
|
lkTickish = lookupTM
| 20
| false
| true
| 0
| 7
| 12
| 28
| 13
| 15
| null | null |
TomMD/ghc
|
compiler/nativeGen/SPARC/Regs.hs
|
bsd-3-clause
|
f0 = RegReal (RealRegSingle (fReg 0))
| 38
|
f0 = RegReal (RealRegSingle (fReg 0))
| 38
|
f0 = RegReal (RealRegSingle (fReg 0))
| 38
| false
| false
| 1
| 9
| 6
| 24
| 10
| 14
| null | null |
brownplt/ovid
|
src/Jsaz.hs
|
bsd-2-clause
|
argSpec =
[ Option ['o'] ["output"] (ReqArg OutputScheme "FILE") "output as a PLT Scheme expression"
, Option ['x'] ["xml"] (ReqArg OutputXML "FILE") "output as GraphML"
, Option [] ["cfa"] (ReqArg (ApplyCFA . read) "K") "perform a control flow analysis only"
, Option [] ["cfg"] (ReqArg (BuildCFG . read) "K") "build a control flow graph"
, Option [] ["rga"] (ReqArg (BuildRGA . read) "K") "build randomization information"
, Option [] ["mmx"] (NoArg (error "MMX optimizations require a Pentium MMX processor"))
"enable Pentium MMX optimizations"
, Option [] ["no-dom"] (NoArg $ error "--no-dom is not yet supported")
"do not include the DOM model"
, Option ['a'] ["full-detail"] (NoArg FullDetail) "see the analysis in its full glory"
, Option ['p'] ["no-approximations"] (ReqArg DisableExponentialHacks "FILE") "Disable approximations for this file"
, Option ['m'] ["html"] (ReqArg InputHtml "FILE") "parse this file as HTML"
, Option ['j'] ["javascript"] (ReqArg InputJavascript "FILE") "parse this file as Javascript"
]
| 1,071
|
argSpec =
[ Option ['o'] ["output"] (ReqArg OutputScheme "FILE") "output as a PLT Scheme expression"
, Option ['x'] ["xml"] (ReqArg OutputXML "FILE") "output as GraphML"
, Option [] ["cfa"] (ReqArg (ApplyCFA . read) "K") "perform a control flow analysis only"
, Option [] ["cfg"] (ReqArg (BuildCFG . read) "K") "build a control flow graph"
, Option [] ["rga"] (ReqArg (BuildRGA . read) "K") "build randomization information"
, Option [] ["mmx"] (NoArg (error "MMX optimizations require a Pentium MMX processor"))
"enable Pentium MMX optimizations"
, Option [] ["no-dom"] (NoArg $ error "--no-dom is not yet supported")
"do not include the DOM model"
, Option ['a'] ["full-detail"] (NoArg FullDetail) "see the analysis in its full glory"
, Option ['p'] ["no-approximations"] (ReqArg DisableExponentialHacks "FILE") "Disable approximations for this file"
, Option ['m'] ["html"] (ReqArg InputHtml "FILE") "parse this file as HTML"
, Option ['j'] ["javascript"] (ReqArg InputJavascript "FILE") "parse this file as Javascript"
]
| 1,071
|
argSpec =
[ Option ['o'] ["output"] (ReqArg OutputScheme "FILE") "output as a PLT Scheme expression"
, Option ['x'] ["xml"] (ReqArg OutputXML "FILE") "output as GraphML"
, Option [] ["cfa"] (ReqArg (ApplyCFA . read) "K") "perform a control flow analysis only"
, Option [] ["cfg"] (ReqArg (BuildCFG . read) "K") "build a control flow graph"
, Option [] ["rga"] (ReqArg (BuildRGA . read) "K") "build randomization information"
, Option [] ["mmx"] (NoArg (error "MMX optimizations require a Pentium MMX processor"))
"enable Pentium MMX optimizations"
, Option [] ["no-dom"] (NoArg $ error "--no-dom is not yet supported")
"do not include the DOM model"
, Option ['a'] ["full-detail"] (NoArg FullDetail) "see the analysis in its full glory"
, Option ['p'] ["no-approximations"] (ReqArg DisableExponentialHacks "FILE") "Disable approximations for this file"
, Option ['m'] ["html"] (ReqArg InputHtml "FILE") "parse this file as HTML"
, Option ['j'] ["javascript"] (ReqArg InputJavascript "FILE") "parse this file as Javascript"
]
| 1,071
| false
| false
| 0
| 10
| 197
| 312
| 166
| 146
| null | null |
ekmett/ghc
|
compiler/cmm/CmmBuildInfoTables.hs
|
bsd-3-clause
|
buildSRTs :: DynFlags -> TopSRT -> BlockEnv CAFSet
-> UniqSM (TopSRT, [CmmDecl], BlockEnv C_SRT)
buildSRTs dflags top_srt caf_map
= foldM doOne (top_srt, [], mapEmpty) (mapToList caf_map)
where
doOne (top_srt, decls, srt_env) (l, cafs)
= do (top_srt, mb_decl, srt) <- buildSRT dflags top_srt cafs
return ( top_srt, maybeToList mb_decl ++ decls
, mapInsert l srt srt_env )
{-
- In each CmmDecl there is a mapping from BlockId -> CmmInfoTable
- The one corresponding to g_entry is the closure info table, the
rest are continuations.
- Each one needs an SRT.
- We get the CAFSet for each one from the CAFEnv
- flatten gives us
[(BlockEnv CAFSet, CmmDecl)]
-
-}
{- Note [reverse gs]
It is important to keep the code blocks in the same order,
otherwise binary sizes get slightly bigger. I'm not completely
sure why this is, perhaps the assembler generates bigger jump
instructions for forward refs. --SDM
-}
| 971
|
buildSRTs :: DynFlags -> TopSRT -> BlockEnv CAFSet
-> UniqSM (TopSRT, [CmmDecl], BlockEnv C_SRT)
buildSRTs dflags top_srt caf_map
= foldM doOne (top_srt, [], mapEmpty) (mapToList caf_map)
where
doOne (top_srt, decls, srt_env) (l, cafs)
= do (top_srt, mb_decl, srt) <- buildSRT dflags top_srt cafs
return ( top_srt, maybeToList mb_decl ++ decls
, mapInsert l srt srt_env )
{-
- In each CmmDecl there is a mapping from BlockId -> CmmInfoTable
- The one corresponding to g_entry is the closure info table, the
rest are continuations.
- Each one needs an SRT.
- We get the CAFSet for each one from the CAFEnv
- flatten gives us
[(BlockEnv CAFSet, CmmDecl)]
-
-}
{- Note [reverse gs]
It is important to keep the code blocks in the same order,
otherwise binary sizes get slightly bigger. I'm not completely
sure why this is, perhaps the assembler generates bigger jump
instructions for forward refs. --SDM
-}
| 971
|
buildSRTs dflags top_srt caf_map
= foldM doOne (top_srt, [], mapEmpty) (mapToList caf_map)
where
doOne (top_srt, decls, srt_env) (l, cafs)
= do (top_srt, mb_decl, srt) <- buildSRT dflags top_srt cafs
return ( top_srt, maybeToList mb_decl ++ decls
, mapInsert l srt srt_env )
{-
- In each CmmDecl there is a mapping from BlockId -> CmmInfoTable
- The one corresponding to g_entry is the closure info table, the
rest are continuations.
- Each one needs an SRT.
- We get the CAFSet for each one from the CAFEnv
- flatten gives us
[(BlockEnv CAFSet, CmmDecl)]
-
-}
{- Note [reverse gs]
It is important to keep the code blocks in the same order,
otherwise binary sizes get slightly bigger. I'm not completely
sure why this is, perhaps the assembler generates bigger jump
instructions for forward refs. --SDM
-}
| 864
| false
| true
| 1
| 11
| 219
| 162
| 83
| 79
| null | null |
Numberartificial/workflow
|
haskell-first-principles/haskell-from-first-principles-master/05/05.08.03-does-it-compile.hs
|
mit
|
c = a b 10
| 10
|
c = a b 10
| 10
|
c = a b 10
| 10
| false
| false
| 1
| 5
| 4
| 14
| 5
| 9
| null | null |
nbrunt/JSHOP
|
res/hjs-0.2.1/src/HJS/Parser/Prim.hs
|
mit
|
equal :: Token -> JSParser ()
equal test = mytoken (\tok -> if tok == test then Just () else Nothing)
| 102
|
equal :: Token -> JSParser ()
equal test = mytoken (\tok -> if tok == test then Just () else Nothing)
| 101
|
equal test = mytoken (\tok -> if tok == test then Just () else Nothing)
| 71
| false
| true
| 0
| 10
| 21
| 51
| 26
| 25
| null | null |
tpsinnem/Idris-dev
|
src/Idris/Core/Unify.hs
|
bsd-3-clause
|
recoverable (P (TCon _ _) x _) (Constant _) = False
| 51
|
recoverable (P (TCon _ _) x _) (Constant _) = False
| 51
|
recoverable (P (TCon _ _) x _) (Constant _) = False
| 51
| false
| false
| 0
| 8
| 10
| 37
| 17
| 20
| null | null |
flocc-net/flocc
|
v0.1/Compiler/Front/ExprTree.hs
|
apache-2.0
|
replaceExprIdsOnly :: Monad m => (Expr -> Bool) -> Expr -> StateT (Map Idx Idx) (StateT IdxSet m) Expr
replaceExprIdsOnly predicate exp = if not (predicate exp) then return exp else case exp of
(Lit i v) -> do i' <- saveNewExprId i; return (Lit i' v)
(Var i v s) -> do
i' <- saveNewExprId i
return (Var i' v s)
(Tup i l) -> do
i' <- saveNewExprId i
l' <- mapM recur l
return (Tup i' l')
(Rel i l) -> do
i' <- saveNewExprId i
l' <- mapM recur l
return (Rel i' l')
(Fun i it e) -> do
i' <- saveNewExprId i
it' <- replaceIdxTreeIdsOnly it
e' <- recur e
return (Fun i' it' e')
(App i f e) -> do
i' <- saveNewExprId i
f' <- recur f
e' <- recur e
return (App i' f' e')
(If i p t e) -> do
i' <- saveNewExprId i
p' <- recur p
t' <- recur t
e' <- recur e
return (If i' p' t' e')
(Let i it be ie) -> do
i' <- saveNewExprId i
be' <- recur be
it' <- replaceIdxTreeIdsOnly it
ie' <- recur ie
return (Let i' it' be' ie')
where recur = replaceExprIdsOnly predicate
--evalReplaceExprIdsOnly :: (Expr -> Bool) -> Expr -> Expr
--evalReplaceExprIdsOnly pred expr = evalStateT (replaceExprIdsOnly pred expr) Data.Map.empty
-- |visitIdxTree takes two functions,
{-visitIdxTree :: Monad m =>
(a -> IdxTree -> m (IdxTree, a)) ->
(a -> a -> a) ->
a -> IdxTree -> m (IdxTree, a)
visitIdxTree f combineF a it = case it of
-- recursive
IdxTup i l -> do
l' <- mapM (f combineF a) l
let (its, as) = unzip l'
case length as of
0 -> error "visitIdxTree empty idx tup list!"
_ -> do
let a' = foldl1 combineF as
return (IdxTup i its, a')
-- base case
other -> do
(other', a') <- f combineF a other
return (other', a')-}
-- |visitExprTree takes three functions, one to process
-- |exprs, another process idx trees, and one to combine
-- |'a' (environment) values, such that one
-- |can easily override basic expr visitor functionality.
-- |Note: to recursively visit, exprF must call visitExprTree exprF idxF
-- |unless expr is a leaf.
| 2,095
|
replaceExprIdsOnly :: Monad m => (Expr -> Bool) -> Expr -> StateT (Map Idx Idx) (StateT IdxSet m) Expr
replaceExprIdsOnly predicate exp = if not (predicate exp) then return exp else case exp of
(Lit i v) -> do i' <- saveNewExprId i; return (Lit i' v)
(Var i v s) -> do
i' <- saveNewExprId i
return (Var i' v s)
(Tup i l) -> do
i' <- saveNewExprId i
l' <- mapM recur l
return (Tup i' l')
(Rel i l) -> do
i' <- saveNewExprId i
l' <- mapM recur l
return (Rel i' l')
(Fun i it e) -> do
i' <- saveNewExprId i
it' <- replaceIdxTreeIdsOnly it
e' <- recur e
return (Fun i' it' e')
(App i f e) -> do
i' <- saveNewExprId i
f' <- recur f
e' <- recur e
return (App i' f' e')
(If i p t e) -> do
i' <- saveNewExprId i
p' <- recur p
t' <- recur t
e' <- recur e
return (If i' p' t' e')
(Let i it be ie) -> do
i' <- saveNewExprId i
be' <- recur be
it' <- replaceIdxTreeIdsOnly it
ie' <- recur ie
return (Let i' it' be' ie')
where recur = replaceExprIdsOnly predicate
--evalReplaceExprIdsOnly :: (Expr -> Bool) -> Expr -> Expr
--evalReplaceExprIdsOnly pred expr = evalStateT (replaceExprIdsOnly pred expr) Data.Map.empty
-- |visitIdxTree takes two functions,
{-visitIdxTree :: Monad m =>
(a -> IdxTree -> m (IdxTree, a)) ->
(a -> a -> a) ->
a -> IdxTree -> m (IdxTree, a)
visitIdxTree f combineF a it = case it of
-- recursive
IdxTup i l -> do
l' <- mapM (f combineF a) l
let (its, as) = unzip l'
case length as of
0 -> error "visitIdxTree empty idx tup list!"
_ -> do
let a' = foldl1 combineF as
return (IdxTup i its, a')
-- base case
other -> do
(other', a') <- f combineF a other
return (other', a')-}
-- |visitExprTree takes three functions, one to process
-- |exprs, another process idx trees, and one to combine
-- |'a' (environment) values, such that one
-- |can easily override basic expr visitor functionality.
-- |Note: to recursively visit, exprF must call visitExprTree exprF idxF
-- |unless expr is a leaf.
| 2,095
|
replaceExprIdsOnly predicate exp = if not (predicate exp) then return exp else case exp of
(Lit i v) -> do i' <- saveNewExprId i; return (Lit i' v)
(Var i v s) -> do
i' <- saveNewExprId i
return (Var i' v s)
(Tup i l) -> do
i' <- saveNewExprId i
l' <- mapM recur l
return (Tup i' l')
(Rel i l) -> do
i' <- saveNewExprId i
l' <- mapM recur l
return (Rel i' l')
(Fun i it e) -> do
i' <- saveNewExprId i
it' <- replaceIdxTreeIdsOnly it
e' <- recur e
return (Fun i' it' e')
(App i f e) -> do
i' <- saveNewExprId i
f' <- recur f
e' <- recur e
return (App i' f' e')
(If i p t e) -> do
i' <- saveNewExprId i
p' <- recur p
t' <- recur t
e' <- recur e
return (If i' p' t' e')
(Let i it be ie) -> do
i' <- saveNewExprId i
be' <- recur be
it' <- replaceIdxTreeIdsOnly it
ie' <- recur ie
return (Let i' it' be' ie')
where recur = replaceExprIdsOnly predicate
--evalReplaceExprIdsOnly :: (Expr -> Bool) -> Expr -> Expr
--evalReplaceExprIdsOnly pred expr = evalStateT (replaceExprIdsOnly pred expr) Data.Map.empty
-- |visitIdxTree takes two functions,
{-visitIdxTree :: Monad m =>
(a -> IdxTree -> m (IdxTree, a)) ->
(a -> a -> a) ->
a -> IdxTree -> m (IdxTree, a)
visitIdxTree f combineF a it = case it of
-- recursive
IdxTup i l -> do
l' <- mapM (f combineF a) l
let (its, as) = unzip l'
case length as of
0 -> error "visitIdxTree empty idx tup list!"
_ -> do
let a' = foldl1 combineF as
return (IdxTup i its, a')
-- base case
other -> do
(other', a') <- f combineF a other
return (other', a')-}
-- |visitExprTree takes three functions, one to process
-- |exprs, another process idx trees, and one to combine
-- |'a' (environment) values, such that one
-- |can easily override basic expr visitor functionality.
-- |Note: to recursively visit, exprF must call visitExprTree exprF idxF
-- |unless expr is a leaf.
| 1,992
| false
| true
| 8
| 10
| 570
| 570
| 258
| 312
| null | null |
sellerlabs/haskell-workshop
|
src/FinalReddit.hs
|
bsd-3-clause
|
viewAll :: Listing -> Html ()
viewAll listing = do
bootstrap
container_ (viewListing listing)
| 97
|
viewAll :: Listing -> Html ()
viewAll listing = do
bootstrap
container_ (viewListing listing)
| 97
|
viewAll listing = do
bootstrap
container_ (viewListing listing)
| 67
| false
| true
| 0
| 9
| 17
| 38
| 17
| 21
| null | null |
orbitgray/ProjectEuler
|
haskell/common/Combinations.hs
|
lgpl-3.0
|
filter_unique_sorted (x1:x2:[])
| x1 == x2 = [x1]
| otherwise = (x1:x2:[])
| 82
|
filter_unique_sorted (x1:x2:[])
| x1 == x2 = [x1]
| otherwise = (x1:x2:[])
| 82
|
filter_unique_sorted (x1:x2:[])
| x1 == x2 = [x1]
| otherwise = (x1:x2:[])
| 82
| false
| false
| 1
| 9
| 19
| 56
| 28
| 28
| null | null |
altschuler/kite
|
src/Kite/Syntax.hs
|
mit
|
prettyExpr (PLambda ide expr) = "|" ++ ide ++ "| -> {\n" ++ (prettyExpr expr) ++ "\n}"
| 87
|
prettyExpr (PLambda ide expr) = "|" ++ ide ++ "| -> {\n" ++ (prettyExpr expr) ++ "\n}"
| 87
|
prettyExpr (PLambda ide expr) = "|" ++ ide ++ "| -> {\n" ++ (prettyExpr expr) ++ "\n}"
| 87
| false
| false
| 0
| 8
| 17
| 39
| 19
| 20
| null | null |
schell/blocks
|
src/Game/Block.hs
|
bsd-3-clause
|
blockZ :: Block
blockZ = Block TZ (0,0) [[True, True, False]
,[False, True, True]
]
| 131
|
blockZ :: Block
blockZ = Block TZ (0,0) [[True, True, False]
,[False, True, True]
]
| 131
|
blockZ = Block TZ (0,0) [[True, True, False]
,[False, True, True]
]
| 115
| false
| true
| 0
| 7
| 62
| 48
| 29
| 19
| null | null |
gianlucagiorgolo/glue-xle
|
Parsers.hs
|
mit
|
template :: Parsec String [Argument] Template
template = do
spaces
name <- templateName
spaces
args <- arguments
putState args -- we store the list of argument names
spaces
char '='
raw <- many1 $ try templateSpacingToken <|> try templateStringToken <|> try templateSeparatorToken <|> (templateCall >>= \x -> return $ TemplateCallToken x)
spaces
char '.'
return $ Template name args raw
| 430
|
template :: Parsec String [Argument] Template
template = do
spaces
name <- templateName
spaces
args <- arguments
putState args -- we store the list of argument names
spaces
char '='
raw <- many1 $ try templateSpacingToken <|> try templateStringToken <|> try templateSeparatorToken <|> (templateCall >>= \x -> return $ TemplateCallToken x)
spaces
char '.'
return $ Template name args raw
| 430
|
template = do
spaces
name <- templateName
spaces
args <- arguments
putState args -- we store the list of argument names
spaces
char '='
raw <- many1 $ try templateSpacingToken <|> try templateStringToken <|> try templateSeparatorToken <|> (templateCall >>= \x -> return $ TemplateCallToken x)
spaces
char '.'
return $ Template name args raw
| 384
| false
| true
| 0
| 13
| 103
| 131
| 58
| 73
| null | null |
music-suite/music-score
|
src/Music/Time/Score.hs
|
bsd-3-clause
|
removeRests :: Score (Maybe a) -> Score a
removeRests = mcatMaybes
| 66
|
removeRests :: Score (Maybe a) -> Score a
removeRests = mcatMaybes
| 66
|
removeRests = mcatMaybes
| 24
| false
| true
| 0
| 8
| 10
| 27
| 13
| 14
| null | null |
neothemachine/monadiccp
|
src/Control/CP/FD/FD.hs
|
bsd-3-clause
|
getIntVal_ :: FDSolver s => EGVarId -> FDState s -> Maybe EGPar
getIntVal_ id s =
let r1 =
case Map.lookup id (fdsIntVars s) of
Nothing -> Nothing
Just x -> fdspIntVal x
in case r1 of
Nothing ->
let Just j = fdsModel s
ei = findEdge j EGIntType id (==0) (\x -> case x of { EGIntValue _ -> True; _ -> False })
in case ei of
Nothing -> Nothing
Just (_,ed) -> case egeCons ed of { EGIntValue c -> Just c }
Just x -> r1
| 538
|
getIntVal_ :: FDSolver s => EGVarId -> FDState s -> Maybe EGPar
getIntVal_ id s =
let r1 =
case Map.lookup id (fdsIntVars s) of
Nothing -> Nothing
Just x -> fdspIntVal x
in case r1 of
Nothing ->
let Just j = fdsModel s
ei = findEdge j EGIntType id (==0) (\x -> case x of { EGIntValue _ -> True; _ -> False })
in case ei of
Nothing -> Nothing
Just (_,ed) -> case egeCons ed of { EGIntValue c -> Just c }
Just x -> r1
| 538
|
getIntVal_ id s =
let r1 =
case Map.lookup id (fdsIntVars s) of
Nothing -> Nothing
Just x -> fdspIntVal x
in case r1 of
Nothing ->
let Just j = fdsModel s
ei = findEdge j EGIntType id (==0) (\x -> case x of { EGIntValue _ -> True; _ -> False })
in case ei of
Nothing -> Nothing
Just (_,ed) -> case egeCons ed of { EGIntValue c -> Just c }
Just x -> r1
| 474
| false
| true
| 1
| 20
| 213
| 213
| 104
| 109
| null | null |
lzlarryli/advent_of_code_2016
|
day1/part1.hs
|
mit
|
move facing x y ((turn, numSteps):ss)
| facing' == N = move facing' (x + numSteps) y ss
| facing' == S = move facing' (x - numSteps) y ss
| facing' == E = move facing' x (y + numSteps) ss
| facing' == W = move facing' x (y - numSteps) ss
where
facing' = turnMap Map.! (facing, turn)
| 296
|
move facing x y ((turn, numSteps):ss)
| facing' == N = move facing' (x + numSteps) y ss
| facing' == S = move facing' (x - numSteps) y ss
| facing' == E = move facing' x (y + numSteps) ss
| facing' == W = move facing' x (y - numSteps) ss
where
facing' = turnMap Map.! (facing, turn)
| 296
|
move facing x y ((turn, numSteps):ss)
| facing' == N = move facing' (x + numSteps) y ss
| facing' == S = move facing' (x - numSteps) y ss
| facing' == E = move facing' x (y + numSteps) ss
| facing' == W = move facing' x (y - numSteps) ss
where
facing' = turnMap Map.! (facing, turn)
| 296
| false
| false
| 1
| 8
| 74
| 175
| 83
| 92
| null | null |
HaskellForCats/HaskellForCats
|
wrapHello.hs
|
mit
|
app :: Application
app _req sendResponse = sendResponse $ responseBuilder
status200
[("Content-Type", "text/plain")]
(renderHtmlBuilder myPage)
| 217
|
app :: Application
app _req sendResponse = sendResponse $ responseBuilder
status200
[("Content-Type", "text/plain")]
(renderHtmlBuilder myPage)
| 216
|
app _req sendResponse = sendResponse $ responseBuilder
status200
[("Content-Type", "text/plain")]
(renderHtmlBuilder myPage)
| 197
| false
| true
| 0
| 8
| 88
| 42
| 22
| 20
| null | null |
danoctavian/bit-smuggler
|
BitSmuggler/src/Network/BitSmuggler/Proxy/Server.hs
|
gpl-2.0
|
defaultBTConfig = BTClientConfig {
pubBitTorrentPort = 7881
, socksProxyPort = 3001
, revProxyPort = 3002
, cmdPort = 9000 -- port on which it's receiving commands
-- host, port, (uname, password)
, connectToClient = uTorrentConnect
}
| 250
|
defaultBTConfig = BTClientConfig {
pubBitTorrentPort = 7881
, socksProxyPort = 3001
, revProxyPort = 3002
, cmdPort = 9000 -- port on which it's receiving commands
-- host, port, (uname, password)
, connectToClient = uTorrentConnect
}
| 250
|
defaultBTConfig = BTClientConfig {
pubBitTorrentPort = 7881
, socksProxyPort = 3001
, revProxyPort = 3002
, cmdPort = 9000 -- port on which it's receiving commands
-- host, port, (uname, password)
, connectToClient = uTorrentConnect
}
| 250
| false
| false
| 1
| 7
| 51
| 47
| 27
| 20
| null | null |
purcell/adventofcodeteam
|
app/TwentyTwo.hs
|
bsd-3-clause
|
addPlayerBonus :: Player -> Char -> Effect -> Int -> Player
addPlayerBonus (stats, effects, bonuses) key effect duration = (stats, effects, (bonuses ++ [(key, duration, effect)]))
| 179
|
addPlayerBonus :: Player -> Char -> Effect -> Int -> Player
addPlayerBonus (stats, effects, bonuses) key effect duration = (stats, effects, (bonuses ++ [(key, duration, effect)]))
| 179
|
addPlayerBonus (stats, effects, bonuses) key effect duration = (stats, effects, (bonuses ++ [(key, duration, effect)]))
| 119
| false
| true
| 0
| 11
| 25
| 79
| 43
| 36
| null | null |
triplepointfive/hogldev
|
tutorial22/Tutorial22.hs
|
mit
|
specialKeyboardCB :: IORef Camera -> SpecialCallback
specialKeyboardCB cameraRef key _ = cameraRef $~! cameraOnKeyboard key
| 123
|
specialKeyboardCB :: IORef Camera -> SpecialCallback
specialKeyboardCB cameraRef key _ = cameraRef $~! cameraOnKeyboard key
| 123
|
specialKeyboardCB cameraRef key _ = cameraRef $~! cameraOnKeyboard key
| 70
| false
| true
| 0
| 7
| 14
| 37
| 16
| 21
| null | null |
CulpaBS/wbBach
|
src/Futhark/CodeGen/Backends/SimpleRepresentation.hs
|
bsd-3-clause
|
floatTypeToCType :: FloatType -> C.Type
floatTypeToCType Float32 = [C.cty|float|]
| 81
|
floatTypeToCType :: FloatType -> C.Type
floatTypeToCType Float32 = [C.cty|float|]
| 81
|
floatTypeToCType Float32 = [C.cty|float|]
| 41
| false
| true
| 0
| 8
| 8
| 32
| 16
| 16
| null | null |
brendanhay/gogol
|
gogol-logging/gen/Network/Google/Resource/Logging/Organizations/Locations/Operations/Cancel.hs
|
mpl-2.0
|
-- | Multipart request metadata.
olocPayload :: Lens' OrganizationsLocationsOperationsCancel CancelOperationRequest
olocPayload
= lens _olocPayload (\ s a -> s{_olocPayload = a})
| 180
|
olocPayload :: Lens' OrganizationsLocationsOperationsCancel CancelOperationRequest
olocPayload
= lens _olocPayload (\ s a -> s{_olocPayload = a})
| 147
|
olocPayload
= lens _olocPayload (\ s a -> s{_olocPayload = a})
| 64
| true
| true
| 0
| 9
| 22
| 42
| 22
| 20
| null | null |
dalaing/type-systems
|
src/Fragment/Tuple/Helpers.hs
|
bsd-3-clause
|
tmTupleIx :: AsTmTuple ki ty pt tm => Term ki ty pt tm a -> Int -> Term ki ty pt tm a
tmTupleIx = curry $ review _TmTupleIx
| 123
|
tmTupleIx :: AsTmTuple ki ty pt tm => Term ki ty pt tm a -> Int -> Term ki ty pt tm a
tmTupleIx = curry $ review _TmTupleIx
| 123
|
tmTupleIx = curry $ review _TmTupleIx
| 37
| false
| true
| 2
| 9
| 28
| 67
| 30
| 37
| null | null |
vedgar/mlr
|
Haskell/2017K1rj/Z3rj.hs
|
unlicense
|
f = Application (FuncS 'f' Nothing)
| 35
|
f = Application (FuncS 'f' Nothing)
| 35
|
f = Application (FuncS 'f' Nothing)
| 35
| false
| false
| 1
| 7
| 5
| 20
| 8
| 12
| null | null |
infotroph/pandoc-crossref
|
lib/Text/Pandoc/CrossRef/References/Refs.hs
|
gpl-2.0
|
replaceRefs _ x = return x
| 26
|
replaceRefs _ x = return x
| 26
|
replaceRefs _ x = return x
| 26
| false
| false
| 0
| 5
| 5
| 14
| 6
| 8
| null | null |
AlexeyRaga/eta
|
compiler/ETA/Main/HscTypes.hs
|
bsd-3-clause
|
plusWarns (WarnAll t) _ = WarnAll t
| 35
|
plusWarns (WarnAll t) _ = WarnAll t
| 35
|
plusWarns (WarnAll t) _ = WarnAll t
| 35
| false
| false
| 0
| 7
| 6
| 20
| 9
| 11
| null | null |
tjakway/ghcjvm
|
compiler/nativeGen/X86/CodeGen.hs
|
bsd-3-clause
|
-- Matches: (x + offset) + (y << shift)
getAmode' _ (CmmMachOp (MO_Add _) [CmmRegOff x offset,
CmmMachOp (MO_Shl _)
[y, CmmLit (CmmInt shift _)]])
| shift == 0 || shift == 1 || shift == 2 || shift == 3
= x86_complex_amode (CmmReg x) y shift (fromIntegral offset)
| 341
|
getAmode' _ (CmmMachOp (MO_Add _) [CmmRegOff x offset,
CmmMachOp (MO_Shl _)
[y, CmmLit (CmmInt shift _)]])
| shift == 0 || shift == 1 || shift == 2 || shift == 3
= x86_complex_amode (CmmReg x) y shift (fromIntegral offset)
| 301
|
getAmode' _ (CmmMachOp (MO_Add _) [CmmRegOff x offset,
CmmMachOp (MO_Shl _)
[y, CmmLit (CmmInt shift _)]])
| shift == 0 || shift == 1 || shift == 2 || shift == 3
= x86_complex_amode (CmmReg x) y shift (fromIntegral offset)
| 301
| true
| false
| 1
| 14
| 127
| 125
| 59
| 66
| null | null |
CulpaBS/wbBach
|
src/Futhark/CodeGen/Backends/COpenCL.hs
|
bsd-3-clause
|
copyOpenCLMemory destmem destidx (Space "device") srcmem srcidx (Space "device") nbytes =
-- Be aware that OpenCL swaps the usual order of operands for
-- memcpy()-like functions. The order below is not a typo.
GenericC.stm [C.cstm|{
if ($exp:nbytes > 0) {
OPENCL_SUCCEED(
clEnqueueCopyBuffer(fut_cl_queue,
$exp:srcmem, $exp:destmem,
$exp:srcidx, $exp:destidx,
$exp:nbytes,
0, NULL, NULL));
if (cl_debug) {
OPENCL_SUCCEED(clFinish(fut_cl_queue));
}
}
}|]
| 617
|
copyOpenCLMemory destmem destidx (Space "device") srcmem srcidx (Space "device") nbytes =
-- Be aware that OpenCL swaps the usual order of operands for
-- memcpy()-like functions. The order below is not a typo.
GenericC.stm [C.cstm|{
if ($exp:nbytes > 0) {
OPENCL_SUCCEED(
clEnqueueCopyBuffer(fut_cl_queue,
$exp:srcmem, $exp:destmem,
$exp:srcidx, $exp:destidx,
$exp:nbytes,
0, NULL, NULL));
if (cl_debug) {
OPENCL_SUCCEED(clFinish(fut_cl_queue));
}
}
}|]
| 617
|
copyOpenCLMemory destmem destidx (Space "device") srcmem srcidx (Space "device") nbytes =
-- Be aware that OpenCL swaps the usual order of operands for
-- memcpy()-like functions. The order below is not a typo.
GenericC.stm [C.cstm|{
if ($exp:nbytes > 0) {
OPENCL_SUCCEED(
clEnqueueCopyBuffer(fut_cl_queue,
$exp:srcmem, $exp:destmem,
$exp:srcidx, $exp:destidx,
$exp:nbytes,
0, NULL, NULL));
if (cl_debug) {
OPENCL_SUCCEED(clFinish(fut_cl_queue));
}
}
}|]
| 617
| false
| false
| 0
| 7
| 219
| 46
| 25
| 21
| null | null |
agrafix/hackmanager
|
app/Main.hs
|
bsd-3-clause
|
withProjectInfo :: (ProjectInfo -> IO ()) -> IO ()
withProjectInfo cont =
do raw <- getProjectInfo
case raw of
Left err ->
putStrLn err
Right pinfo ->
cont pinfo
| 216
|
withProjectInfo :: (ProjectInfo -> IO ()) -> IO ()
withProjectInfo cont =
do raw <- getProjectInfo
case raw of
Left err ->
putStrLn err
Right pinfo ->
cont pinfo
| 216
|
withProjectInfo cont =
do raw <- getProjectInfo
case raw of
Left err ->
putStrLn err
Right pinfo ->
cont pinfo
| 165
| false
| true
| 0
| 10
| 83
| 73
| 33
| 40
| null | null |
shepheb/hork
|
Hork/Header.hs
|
bsd-3-clause
|
hdrOBJTABLE = 0xA
| 17
|
hdrOBJTABLE = 0xA
| 17
|
hdrOBJTABLE = 0xA
| 17
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
bruno-cadorette/TheLambdaReactor
|
test/BackendSpec/CharacterSpec.hs
|
mit
|
spec :: Spec
spec = describe "Character" $ do
it "hp" $ do
hp (Entity 15 (Location (V2 1 1) (V2 1 1))) `shouldBe` 15
it "position" $ do
(position $ location (Entity 15 (Location (V2 1 1) (V2 1 1)))) `shouldBe` (V2 1 1)
it "isDead" $ do
isDead (Entity 15 (Location (V2 1 1) (V2 1 1))) `shouldBe` False
it "isDead False" $ do
isDead (Entity 0 (Location (V2 1 1) (V2 1 1))) `shouldBe` True
it "isDead Neg" $ do
isDead (Entity (0-5) (Location (V2 1 1) (V2 1 1))) `shouldBe` True
it "move" $ do
(position $ location (move (Entity 15 (Location (V2 1 1) (V2 1 1))) (V2 1.0 1.0))) `shouldBe` ((V2 2 2) :: V2 Float)
| 714
|
spec :: Spec
spec = describe "Character" $ do
it "hp" $ do
hp (Entity 15 (Location (V2 1 1) (V2 1 1))) `shouldBe` 15
it "position" $ do
(position $ location (Entity 15 (Location (V2 1 1) (V2 1 1)))) `shouldBe` (V2 1 1)
it "isDead" $ do
isDead (Entity 15 (Location (V2 1 1) (V2 1 1))) `shouldBe` False
it "isDead False" $ do
isDead (Entity 0 (Location (V2 1 1) (V2 1 1))) `shouldBe` True
it "isDead Neg" $ do
isDead (Entity (0-5) (Location (V2 1 1) (V2 1 1))) `shouldBe` True
it "move" $ do
(position $ location (move (Entity 15 (Location (V2 1 1) (V2 1 1))) (V2 1.0 1.0))) `shouldBe` ((V2 2 2) :: V2 Float)
| 714
|
spec = describe "Character" $ do
it "hp" $ do
hp (Entity 15 (Location (V2 1 1) (V2 1 1))) `shouldBe` 15
it "position" $ do
(position $ location (Entity 15 (Location (V2 1 1) (V2 1 1)))) `shouldBe` (V2 1 1)
it "isDead" $ do
isDead (Entity 15 (Location (V2 1 1) (V2 1 1))) `shouldBe` False
it "isDead False" $ do
isDead (Entity 0 (Location (V2 1 1) (V2 1 1))) `shouldBe` True
it "isDead Neg" $ do
isDead (Entity (0-5) (Location (V2 1 1) (V2 1 1))) `shouldBe` True
it "move" $ do
(position $ location (move (Entity 15 (Location (V2 1 1) (V2 1 1))) (V2 1.0 1.0))) `shouldBe` ((V2 2 2) :: V2 Float)
| 701
| false
| true
| 0
| 28
| 229
| 412
| 199
| 213
| null | null |
vkomenda/CoALP
|
lib/CoALP/Tree.hs
|
lgpl-3.0
|
initTree :: (Int, Int) -> Term1 -> TreeOper1
initTree bounds a =
NodeOper a $ Array.listArray bounds (repeat $ Left ToBeMatched)
| 130
|
initTree :: (Int, Int) -> Term1 -> TreeOper1
initTree bounds a =
NodeOper a $ Array.listArray bounds (repeat $ Left ToBeMatched)
| 130
|
initTree bounds a =
NodeOper a $ Array.listArray bounds (repeat $ Left ToBeMatched)
| 85
| false
| true
| 2
| 8
| 22
| 59
| 28
| 31
| null | null |
dhess/free-experiments
|
src/RetryTH.hs
|
bsd-3-clause
|
main :: IO ()
main = runRetry test
| 34
|
main :: IO ()
main = runRetry test
| 34
|
main = runRetry test
| 20
| false
| true
| 0
| 7
| 7
| 24
| 10
| 14
| null | null |
lukexi/ghc
|
libraries/base/System/IO.hs
|
bsd-3-clause
|
-- | Write a string to the standard output device
-- (same as 'hPutStr' 'stdout').
putStr :: String -> IO ()
putStr s = hPutStr stdout s
| 154
|
putStr :: String -> IO ()
putStr s = hPutStr stdout s
| 70
|
putStr s = hPutStr stdout s
| 35
| true
| true
| 0
| 8
| 44
| 36
| 16
| 20
| null | null |
rleshchinskiy/vector
|
Data/Vector/Primitive.hs
|
bsd-3-clause
|
indexM = G.indexM
| 17
|
indexM = G.indexM
| 17
|
indexM = G.indexM
| 17
| false
| false
| 0
| 5
| 2
| 8
| 4
| 4
| null | null |
urbanslug/ghc
|
compiler/codeGen/StgCmmMonad.hs
|
bsd-3-clause
|
-- ----------------------------------------------------------------------------
-- turn CmmAGraph into CmmGraph, for making a new proc.
aGraphToGraph :: CmmAGraphScoped -> FCode CmmGraph
aGraphToGraph stmts
= do { l <- newLabelC
; return (labelAGraph l stmts) }
| 273
|
aGraphToGraph :: CmmAGraphScoped -> FCode CmmGraph
aGraphToGraph stmts
= do { l <- newLabelC
; return (labelAGraph l stmts) }
| 136
|
aGraphToGraph stmts
= do { l <- newLabelC
; return (labelAGraph l stmts) }
| 85
| true
| true
| 0
| 9
| 43
| 47
| 24
| 23
| null | null |
tolysz/yesod
|
yesod-core/Yesod/Core/Internal/Run.hs
|
mit
|
-- | Determine if an exception is asynchronous
--
-- Also worth being upstream
isAsyncException :: E.SomeException -> Bool
isAsyncException e =
case fromException e of
Just E.SomeAsyncException{} -> True
Nothing -> False
-- | Convert an exception into an ErrorResponse
| 289
|
isAsyncException :: E.SomeException -> Bool
isAsyncException e =
case fromException e of
Just E.SomeAsyncException{} -> True
Nothing -> False
-- | Convert an exception into an ErrorResponse
| 210
|
isAsyncException e =
case fromException e of
Just E.SomeAsyncException{} -> True
Nothing -> False
-- | Convert an exception into an ErrorResponse
| 166
| true
| true
| 0
| 10
| 61
| 58
| 28
| 30
| null | null |
xpika/Time-Console
|
Main.hs
|
gpl-2.0
|
sequenceWhileTrue (m:ms) = do
r <- m
if r then m >> sequenceWhileTrue ms
else return ()
| 142
|
sequenceWhileTrue (m:ms) = do
r <- m
if r then m >> sequenceWhileTrue ms
else return ()
| 142
|
sequenceWhileTrue (m:ms) = do
r <- m
if r then m >> sequenceWhileTrue ms
else return ()
| 142
| false
| false
| 0
| 9
| 71
| 46
| 22
| 24
| null | null |
gridaphobe/ghc
|
compiler/llvmGen/LlvmCodeGen/CodeGen.hs
|
bsd-3-clause
|
-- | Conditional branch
genCondBranch :: CmmExpr -> BlockId -> BlockId -> LlvmM StmtData
genCondBranch cond idT idF = do
let labelT = blockIdToLlvm idT
let labelF = blockIdToLlvm idF
-- See Note [Literals and branch conditions].
(vc, stmts, top) <- exprToVarOpt i1Option cond
if getVarType vc == i1
then do
let s1 = BranchIf vc labelT labelF
return (stmts `snocOL` s1, top)
else do
dflags <- getDynFlags
panic $ "genCondBranch: Cond expr not bool! (" ++ showSDoc dflags (ppr vc) ++ ")"
{- Note [Literals and branch conditions]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is important that whenever we generate branch conditions for
literals like '1', they are properly narrowed to an LLVM expression of
type 'i1' (for bools.) Otherwise, nobody is happy. So when we convert
a CmmExpr to an LLVM expression for a branch conditional, exprToVarOpt
must be certain to return a properly narrowed type. genLit is
responsible for this, in the case of literal integers.
Often, we won't see direct statements like:
if(1) {
...
} else {
...
}
at this point in the pipeline, because the Glorious Code Generator
will do trivial branch elimination in the sinking pass (among others,)
which will eliminate the expression entirely.
However, it's certainly possible and reasonable for this to occur in
hand-written C-- code. Consider something like:
#ifndef SOME_CONDITIONAL
#define CHECK_THING(x) 1
#else
#define CHECK_THING(x) some_operation((x))
#endif
f() {
if (CHECK_THING(xyz)) {
...
} else {
...
}
}
In such an instance, CHECK_THING might result in an *expression* in
one case, and a *literal* in the other, depending on what in
particular was #define'd. So we must be sure to properly narrow the
literal in this case to i1 as it won't be eliminated beforehand.
For a real example of this, see ./rts/StgStdThunks.cmm
-}
-- | Switch branch
| 2,014
|
genCondBranch :: CmmExpr -> BlockId -> BlockId -> LlvmM StmtData
genCondBranch cond idT idF = do
let labelT = blockIdToLlvm idT
let labelF = blockIdToLlvm idF
-- See Note [Literals and branch conditions].
(vc, stmts, top) <- exprToVarOpt i1Option cond
if getVarType vc == i1
then do
let s1 = BranchIf vc labelT labelF
return (stmts `snocOL` s1, top)
else do
dflags <- getDynFlags
panic $ "genCondBranch: Cond expr not bool! (" ++ showSDoc dflags (ppr vc) ++ ")"
{- Note [Literals and branch conditions]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is important that whenever we generate branch conditions for
literals like '1', they are properly narrowed to an LLVM expression of
type 'i1' (for bools.) Otherwise, nobody is happy. So when we convert
a CmmExpr to an LLVM expression for a branch conditional, exprToVarOpt
must be certain to return a properly narrowed type. genLit is
responsible for this, in the case of literal integers.
Often, we won't see direct statements like:
if(1) {
...
} else {
...
}
at this point in the pipeline, because the Glorious Code Generator
will do trivial branch elimination in the sinking pass (among others,)
which will eliminate the expression entirely.
However, it's certainly possible and reasonable for this to occur in
hand-written C-- code. Consider something like:
#ifndef SOME_CONDITIONAL
#define CHECK_THING(x) 1
#else
#define CHECK_THING(x) some_operation((x))
#endif
f() {
if (CHECK_THING(xyz)) {
...
} else {
...
}
}
In such an instance, CHECK_THING might result in an *expression* in
one case, and a *literal* in the other, depending on what in
particular was #define'd. So we must be sure to properly narrow the
literal in this case to i1 as it won't be eliminated beforehand.
For a real example of this, see ./rts/StgStdThunks.cmm
-}
-- | Switch branch
| 1,990
|
genCondBranch cond idT idF = do
let labelT = blockIdToLlvm idT
let labelF = blockIdToLlvm idF
-- See Note [Literals and branch conditions].
(vc, stmts, top) <- exprToVarOpt i1Option cond
if getVarType vc == i1
then do
let s1 = BranchIf vc labelT labelF
return (stmts `snocOL` s1, top)
else do
dflags <- getDynFlags
panic $ "genCondBranch: Cond expr not bool! (" ++ showSDoc dflags (ppr vc) ++ ")"
{- Note [Literals and branch conditions]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is important that whenever we generate branch conditions for
literals like '1', they are properly narrowed to an LLVM expression of
type 'i1' (for bools.) Otherwise, nobody is happy. So when we convert
a CmmExpr to an LLVM expression for a branch conditional, exprToVarOpt
must be certain to return a properly narrowed type. genLit is
responsible for this, in the case of literal integers.
Often, we won't see direct statements like:
if(1) {
...
} else {
...
}
at this point in the pipeline, because the Glorious Code Generator
will do trivial branch elimination in the sinking pass (among others,)
which will eliminate the expression entirely.
However, it's certainly possible and reasonable for this to occur in
hand-written C-- code. Consider something like:
#ifndef SOME_CONDITIONAL
#define CHECK_THING(x) 1
#else
#define CHECK_THING(x) some_operation((x))
#endif
f() {
if (CHECK_THING(xyz)) {
...
} else {
...
}
}
In such an instance, CHECK_THING might result in an *expression* in
one case, and a *literal* in the other, depending on what in
particular was #define'd. So we must be sure to properly narrow the
literal in this case to i1 as it won't be eliminated beforehand.
For a real example of this, see ./rts/StgStdThunks.cmm
-}
-- | Switch branch
| 1,925
| true
| true
| 0
| 14
| 482
| 167
| 82
| 85
| null | null |
gcampax/ghc
|
compiler/utils/Util.hs
|
bsd-3-clause
|
leLength :: [a] -> [b] -> Bool
-- ^ True if length xs <= length ys
leLength xs ys = case compareLength xs ys of
LT -> True
EQ -> True
GT -> False
----------------------------
| 232
|
leLength :: [a] -> [b] -> Bool
leLength xs ys = case compareLength xs ys of
LT -> True
EQ -> True
GT -> False
----------------------------
| 196
|
leLength xs ys = case compareLength xs ys of
LT -> True
EQ -> True
GT -> False
----------------------------
| 165
| true
| true
| 0
| 8
| 92
| 65
| 32
| 33
| null | null |
wavewave/cmdmanager
|
exe/cmdmanager.hs
|
bsd-3-clause
|
test_tickingevent :: IO ()
test_tickingevent = do
dref <- newEmptyMVar :: IO (MVar (Driver IO ()))
let logger = simplelogger -- weblogger "http://127.0.0.1:7800"
putMVar dref (driver logger world (eventHandler dref))
putStrLn "starting ticking"
ticking dref 0
| 286
|
test_tickingevent :: IO ()
test_tickingevent = do
dref <- newEmptyMVar :: IO (MVar (Driver IO ()))
let logger = simplelogger -- weblogger "http://127.0.0.1:7800"
putMVar dref (driver logger world (eventHandler dref))
putStrLn "starting ticking"
ticking dref 0
| 285
|
test_tickingevent = do
dref <- newEmptyMVar :: IO (MVar (Driver IO ()))
let logger = simplelogger -- weblogger "http://127.0.0.1:7800"
putMVar dref (driver logger world (eventHandler dref))
putStrLn "starting ticking"
ticking dref 0
| 258
| false
| true
| 0
| 14
| 62
| 99
| 44
| 55
| null | null |
lefant/kurt
|
src/Kurt/MainLoop.hs
|
gpl-3.0
|
loop :: EngineState -> IO ()
loop oldState =
do
input <- getLine
let parseResult = pureParseCommand input commandargparserlist
case parseResult of
Left err ->
do
putStrLn $ "? Couldn't parse command: " ++ show err
putStrLn ""
loop oldState
Right (maybeId, Command cmd args) ->
case lookupC cmd commandHandlers of
Nothing ->
do
putStrLn $ "?" ++ outputIdOrBlank maybeId ++ "Unrecognized command " ++ cmd
newLineFlush
loop oldState
Just (_, handler) ->
do
result <- handler args oldState
case result of
Left err ->
do
putStrLn $ "?" ++ outputIdOrBlank maybeId ++ " error: " ++ err
newLineFlush
loop oldState
Right (msg, newState) ->
do
putStrLn $ "=" ++ outputIdOrBlank maybeId ++ msg
newLineFlush
loop newState
| 1,281
|
loop :: EngineState -> IO ()
loop oldState =
do
input <- getLine
let parseResult = pureParseCommand input commandargparserlist
case parseResult of
Left err ->
do
putStrLn $ "? Couldn't parse command: " ++ show err
putStrLn ""
loop oldState
Right (maybeId, Command cmd args) ->
case lookupC cmd commandHandlers of
Nothing ->
do
putStrLn $ "?" ++ outputIdOrBlank maybeId ++ "Unrecognized command " ++ cmd
newLineFlush
loop oldState
Just (_, handler) ->
do
result <- handler args oldState
case result of
Left err ->
do
putStrLn $ "?" ++ outputIdOrBlank maybeId ++ " error: " ++ err
newLineFlush
loop oldState
Right (msg, newState) ->
do
putStrLn $ "=" ++ outputIdOrBlank maybeId ++ msg
newLineFlush
loop newState
| 1,281
|
loop oldState =
do
input <- getLine
let parseResult = pureParseCommand input commandargparserlist
case parseResult of
Left err ->
do
putStrLn $ "? Couldn't parse command: " ++ show err
putStrLn ""
loop oldState
Right (maybeId, Command cmd args) ->
case lookupC cmd commandHandlers of
Nothing ->
do
putStrLn $ "?" ++ outputIdOrBlank maybeId ++ "Unrecognized command " ++ cmd
newLineFlush
loop oldState
Just (_, handler) ->
do
result <- handler args oldState
case result of
Left err ->
do
putStrLn $ "?" ++ outputIdOrBlank maybeId ++ " error: " ++ err
newLineFlush
loop oldState
Right (msg, newState) ->
do
putStrLn $ "=" ++ outputIdOrBlank maybeId ++ msg
newLineFlush
loop newState
| 1,252
| false
| true
| 1
| 25
| 688
| 273
| 120
| 153
| null | null |
damoxc/ganeti
|
test/hs/Test/Ganeti/OpCodes.hs
|
gpl-2.0
|
-- | Generates a list of node names in non-empty string type.
genNodeNamesNE :: Gen [NonEmptyString]
genNodeNamesNE = genNodeNames >>= mapM mkNonEmpty
| 150
|
genNodeNamesNE :: Gen [NonEmptyString]
genNodeNamesNE = genNodeNames >>= mapM mkNonEmpty
| 88
|
genNodeNamesNE = genNodeNames >>= mapM mkNonEmpty
| 49
| true
| true
| 0
| 6
| 21
| 25
| 13
| 12
| null | null |
LambdaHack/LambdaHack
|
engine-src/Game/LambdaHack/Client/UI/Frontend/ANSI.hs
|
bsd-3-clause
|
colorTranslate Color.BrBlue = (ANSI.Vivid, ANSI.Blue)
| 56
|
colorTranslate Color.BrBlue = (ANSI.Vivid, ANSI.Blue)
| 56
|
colorTranslate Color.BrBlue = (ANSI.Vivid, ANSI.Blue)
| 56
| false
| false
| 0
| 6
| 7
| 21
| 11
| 10
| null | null |
ivan-m/keyless-entry
|
bench/KeylessBenchmark.hs
|
bsd-3-clause
|
mkSimpleBenchGroup' :: String -> (forall c . (NFKeyless c) => c Int -> c Int)
-> Benchmark
mkSimpleBenchGroup' nm f = mkSimpleBenchGroup nm $ K . f
| 170
|
mkSimpleBenchGroup' :: String -> (forall c . (NFKeyless c) => c Int -> c Int)
-> Benchmark
mkSimpleBenchGroup' nm f = mkSimpleBenchGroup nm $ K . f
| 170
|
mkSimpleBenchGroup' nm f = mkSimpleBenchGroup nm $ K . f
| 56
| false
| true
| 0
| 11
| 49
| 62
| 31
| 31
| null | null |
jfranklin9000/urbit
|
pkg/hs/urbit-king/lib/Urbit/Vere/Ames.hs
|
mit
|
galaxyPort Real (Patp g) = fromIntegral g + 13337
| 54
|
galaxyPort Real (Patp g) = fromIntegral g + 13337
| 54
|
galaxyPort Real (Patp g) = fromIntegral g + 13337
| 54
| false
| false
| 0
| 7
| 13
| 24
| 11
| 13
| null | null |
diflying/logitext
|
Coq.hs
|
bsd-3-clause
|
-- operconstr:
-- 200 RIGHTA binder_constr
-- 100 RIGHTA operconstr.10 ":" binder_constr
-- operconstr.10 ":" operconstr.100
-- 10 LEFTA operconstr.0 appl_arg+ // this one might be wrong, see what we're using
-- "@" global operconstr.0*
-- 0 atomic_constr
-- "(" operconstr.200 ")"
term :: P Term
term = operconstr200
| 369
|
term :: P Term
term = operconstr200
| 35
|
term = operconstr200
| 20
| true
| true
| 0
| 5
| 100
| 22
| 15
| 7
| null | null |
christiaanb/SoOSiM-components
|
src/SoOSiM/Components/ResourceManager/Behaviour.hs
|
mit
|
behaviour s (Message _ (GetResourceDescription rId) retAddr) = do
let rdM = HashMap.lookup rId (resources s)
respond ResourceManager retAddr (RM_Descriptor rdM)
yield s
| 174
|
behaviour s (Message _ (GetResourceDescription rId) retAddr) = do
let rdM = HashMap.lookup rId (resources s)
respond ResourceManager retAddr (RM_Descriptor rdM)
yield s
| 174
|
behaviour s (Message _ (GetResourceDescription rId) retAddr) = do
let rdM = HashMap.lookup rId (resources s)
respond ResourceManager retAddr (RM_Descriptor rdM)
yield s
| 174
| false
| false
| 0
| 12
| 28
| 71
| 32
| 39
| null | null |
keithodulaigh/Hets
|
HasCASL/InteractiveTests.hs
|
gpl-2.0
|
infoEntry :: GlobalEntry -> Doc
infoEntry ge = case ge of
SpecEntry egs -> text "SpecEntry" <+> parens (infoEGS egs)
ViewOrStructEntry b evs -> text $ (if b then "View" else "Struct")
++ "Entry"
UnitEntry us -> text "UnitEntry"
ArchOrRefEntry b rs -> text $ (if b then "Arch" else "Ref")
++ "Entry"
| 338
|
infoEntry :: GlobalEntry -> Doc
infoEntry ge = case ge of
SpecEntry egs -> text "SpecEntry" <+> parens (infoEGS egs)
ViewOrStructEntry b evs -> text $ (if b then "View" else "Struct")
++ "Entry"
UnitEntry us -> text "UnitEntry"
ArchOrRefEntry b rs -> text $ (if b then "Arch" else "Ref")
++ "Entry"
| 338
|
infoEntry ge = case ge of
SpecEntry egs -> text "SpecEntry" <+> parens (infoEGS egs)
ViewOrStructEntry b evs -> text $ (if b then "View" else "Struct")
++ "Entry"
UnitEntry us -> text "UnitEntry"
ArchOrRefEntry b rs -> text $ (if b then "Arch" else "Ref")
++ "Entry"
| 306
| false
| true
| 0
| 11
| 92
| 119
| 59
| 60
| null | null |
filib/ruby-marshal
|
src/Data/Ruby/Marshal/Encoding.hs
|
mit
|
toEnc "UTF-32BE" = UTF_32BE
| 45
|
toEnc "UTF-32BE" = UTF_32BE
| 45
|
toEnc "UTF-32BE" = UTF_32BE
| 45
| false
| false
| 0
| 5
| 21
| 9
| 4
| 5
| null | null |
ocharles/hs-quake-3
|
Quake3/Shader/TypeCheck.hs
|
bsd-3-clause
|
tcFactor s = Failure ["Unknown blending factor: " ++ s]
| 55
|
tcFactor s = Failure ["Unknown blending factor: " ++ s]
| 55
|
tcFactor s = Failure ["Unknown blending factor: " ++ s]
| 55
| false
| false
| 1
| 7
| 9
| 23
| 9
| 14
| null | null |
erikd/yesod
|
yesod-auth/Yesod/Auth.hs
|
mit
|
maybeAuth :: ( YesodAuthPersist master
, val ~ AuthEntity master
, Key val ~ AuthId master
, PersistEntity val
, Typeable val
) => HandlerT master IO (Maybe (Entity val))
maybeAuth = runMaybeT $ do
(aid, ae) <- MaybeT maybeAuthPair
return $ Entity aid ae
-- | Similar to 'maybeAuth', but doesn’t assume that you are using a
-- Persistent database.
--
-- Since 1.4.0
| 439
|
maybeAuth :: ( YesodAuthPersist master
, val ~ AuthEntity master
, Key val ~ AuthId master
, PersistEntity val
, Typeable val
) => HandlerT master IO (Maybe (Entity val))
maybeAuth = runMaybeT $ do
(aid, ae) <- MaybeT maybeAuthPair
return $ Entity aid ae
-- | Similar to 'maybeAuth', but doesn’t assume that you are using a
-- Persistent database.
--
-- Since 1.4.0
| 439
|
maybeAuth = runMaybeT $ do
(aid, ae) <- MaybeT maybeAuthPair
return $ Entity aid ae
-- | Similar to 'maybeAuth', but doesn’t assume that you are using a
-- Persistent database.
--
-- Since 1.4.0
| 203
| false
| true
| 0
| 10
| 138
| 112
| 56
| 56
| null | null |
m4dc4p/haskelldb
|
examples/DB1/Double_tbl.hs
|
bsd-3-clause
|
f01 :: Attr F01 (Maybe Double)
f01 = mkAttr F01
| 47
|
f01 :: Attr F01 (Maybe Double)
f01 = mkAttr F01
| 47
|
f01 = mkAttr F01
| 16
| false
| true
| 2
| 6
| 9
| 33
| 12
| 21
| null | null |
craigbilner/advent-of-code-2016
|
day-2.hs
|
apache-2.0
|
keyPad2 :: KeyPad
keyPad2 = [ ['0', '0', '0', '0', '0', '0', '0']
, ['0', '0', '0', '1', '0', '0', '0']
, ['0', '0', '2', '3', '4', '0', '0']
, ['0', '5', '6', '7', '8', '9', '0']
, ['0', '0', 'A', 'B', 'C', '0', '0']
, ['0', '0', '0', 'D', '0', '0', '0']
, ['0', '0', '0', '0', '0', '0', '0']
]
| 365
|
keyPad2 :: KeyPad
keyPad2 = [ ['0', '0', '0', '0', '0', '0', '0']
, ['0', '0', '0', '1', '0', '0', '0']
, ['0', '0', '2', '3', '4', '0', '0']
, ['0', '5', '6', '7', '8', '9', '0']
, ['0', '0', 'A', 'B', 'C', '0', '0']
, ['0', '0', '0', 'D', '0', '0', '0']
, ['0', '0', '0', '0', '0', '0', '0']
]
| 365
|
keyPad2 = [ ['0', '0', '0', '0', '0', '0', '0']
, ['0', '0', '0', '1', '0', '0', '0']
, ['0', '0', '2', '3', '4', '0', '0']
, ['0', '5', '6', '7', '8', '9', '0']
, ['0', '0', 'A', 'B', 'C', '0', '0']
, ['0', '0', '0', 'D', '0', '0', '0']
, ['0', '0', '0', '0', '0', '0', '0']
]
| 347
| false
| true
| 0
| 6
| 131
| 179
| 118
| 61
| null | null |
nomeata/sat-britney
|
Data/DenseIntSet.hs
|
gpl-2.0
|
natFromInt :: Int -> Nat
natFromInt i = fromIntegral i
| 54
|
natFromInt :: Int -> Nat
natFromInt i = fromIntegral i
| 54
|
natFromInt i = fromIntegral i
| 29
| false
| true
| 0
| 7
| 9
| 26
| 11
| 15
| null | null |
janschulz/pandoc
|
src/Text/Pandoc/Readers/Docx/Parse.hs
|
gpl-2.0
|
numElemToNum :: NameSpaces -> Element -> Maybe Numb
numElemToNum ns element |
qName (elName element) == "num" &&
qURI (elName element) == (lookup "w" ns) = do
numId <- findAttr (QName "numId" (lookup "w" ns) (Just "w")) element
absNumId <- findChild (QName "abstractNumId" (lookup "w" ns) (Just "w")) element
>>= findAttr (QName "val" (lookup "w" ns) (Just "w"))
return $ Numb numId absNumId
| 423
|
numElemToNum :: NameSpaces -> Element -> Maybe Numb
numElemToNum ns element |
qName (elName element) == "num" &&
qURI (elName element) == (lookup "w" ns) = do
numId <- findAttr (QName "numId" (lookup "w" ns) (Just "w")) element
absNumId <- findChild (QName "abstractNumId" (lookup "w" ns) (Just "w")) element
>>= findAttr (QName "val" (lookup "w" ns) (Just "w"))
return $ Numb numId absNumId
| 423
|
numElemToNum ns element |
qName (elName element) == "num" &&
qURI (elName element) == (lookup "w" ns) = do
numId <- findAttr (QName "numId" (lookup "w" ns) (Just "w")) element
absNumId <- findChild (QName "abstractNumId" (lookup "w" ns) (Just "w")) element
>>= findAttr (QName "val" (lookup "w" ns) (Just "w"))
return $ Numb numId absNumId
| 371
| false
| true
| 0
| 14
| 94
| 186
| 87
| 99
| null | null |
ribag/ganeti-experiments
|
src/Ganeti/Errors.hs
|
gpl-2.0
|
formatError (GenericError msg) =
"Unhandled Ganeti error: " ++ msg
| 68
|
formatError (GenericError msg) =
"Unhandled Ganeti error: " ++ msg
| 68
|
formatError (GenericError msg) =
"Unhandled Ganeti error: " ++ msg
| 68
| false
| false
| 0
| 7
| 11
| 19
| 9
| 10
| null | null |
ibotty/pipes-text
|
src/Pipes/Text.hs
|
bsd-3-clause
|
any :: Monad m => (Char -> Bool) -> Producer Text m () -> m Bool
any = P.any . T.any
| 84
|
any :: Monad m => (Char -> Bool) -> Producer Text m () -> m Bool
any = P.any . T.any
| 84
|
any = P.any . T.any
| 19
| false
| true
| 0
| 10
| 20
| 59
| 27
| 32
| null | null |
cirquit/Personal-Repository
|
Haskell/Playground/AdventOfCode/advent-coding/src/Day11.hs
|
mit
|
genPW :: String -> [String]
genPW str = str' : genPW str'
where
str' = inc str
inc :: String -> String
inc [] = []
inc xs
| overflowed = inc (init xs) ++ [c]
| otherwise = init xs ++ [c]
where (c, overflowed) = succ' (last xs)
succ' 'z' = ('a' , True)
succ' 'h' = ('j' , False)
succ' 'n' = ('p' , False)
succ' 'k' = ('m' , False)
succ' x = (succ x, False)
| 483
|
genPW :: String -> [String]
genPW str = str' : genPW str'
where
str' = inc str
inc :: String -> String
inc [] = []
inc xs
| overflowed = inc (init xs) ++ [c]
| otherwise = init xs ++ [c]
where (c, overflowed) = succ' (last xs)
succ' 'z' = ('a' , True)
succ' 'h' = ('j' , False)
succ' 'n' = ('p' , False)
succ' 'k' = ('m' , False)
succ' x = (succ x, False)
| 483
|
genPW str = str' : genPW str'
where
str' = inc str
inc :: String -> String
inc [] = []
inc xs
| overflowed = inc (init xs) ++ [c]
| otherwise = init xs ++ [c]
where (c, overflowed) = succ' (last xs)
succ' 'z' = ('a' , True)
succ' 'h' = ('j' , False)
succ' 'n' = ('p' , False)
succ' 'k' = ('m' , False)
succ' x = (succ x, False)
| 455
| false
| true
| 16
| 8
| 207
| 200
| 106
| 94
| null | null |
dblia/nosql-ganeti
|
src/Ganeti/HTools/Types.hs
|
gpl-2.0
|
-- | Initial empty utilisation.
zeroUtil :: DynUtil
zeroUtil = DynUtil { cpuWeight = 0, memWeight = 0
, dskWeight = 0, netWeight = 0 }
| 153
|
zeroUtil :: DynUtil
zeroUtil = DynUtil { cpuWeight = 0, memWeight = 0
, dskWeight = 0, netWeight = 0 }
| 121
|
zeroUtil = DynUtil { cpuWeight = 0, memWeight = 0
, dskWeight = 0, netWeight = 0 }
| 101
| true
| true
| 0
| 7
| 44
| 45
| 25
| 20
| null | null |
da-x/ghc
|
compiler/ghci/ByteCodeItbls.hs
|
bsd-3-clause
|
byte6 w = fromIntegral (w `shiftR` 48)
| 38
|
byte6 w = fromIntegral (w `shiftR` 48)
| 38
|
byte6 w = fromIntegral (w `shiftR` 48)
| 38
| false
| false
| 1
| 7
| 6
| 25
| 11
| 14
| null | null |
BartAdv/Idris-dev
|
src/Idris/Reflection.hs
|
bsd-3-clause
|
reifyTTApp t [Constant (I i)]
| t == reflm "V" = return $ V i
| 72
|
reifyTTApp t [Constant (I i)]
| t == reflm "V" = return $ V i
| 72
|
reifyTTApp t [Constant (I i)]
| t == reflm "V" = return $ V i
| 72
| false
| false
| 0
| 9
| 25
| 43
| 19
| 24
| null | null |
ideas-edu/ideas
|
src/Ideas/Common/Strategy/Abstract.hs
|
apache-2.0
|
-- | Removes the label from a strategy
unlabel :: LabeledStrategy a -> Strategy a
unlabel (LS _ s) = s
| 104
|
unlabel :: LabeledStrategy a -> Strategy a
unlabel (LS _ s) = s
| 63
|
unlabel (LS _ s) = s
| 20
| true
| true
| 0
| 6
| 22
| 37
| 17
| 20
| null | null |
yiannist/ganeti
|
src/Ganeti/OpParams.hs
|
bsd-2-clause
|
pNodeSslCerts :: Field
pNodeSslCerts =
withDoc "Whether to renew node SSL certificates" .
defaultField [| False |] $
simpleField "node_certificates" [t| Bool |]
| 166
|
pNodeSslCerts :: Field
pNodeSslCerts =
withDoc "Whether to renew node SSL certificates" .
defaultField [| False |] $
simpleField "node_certificates" [t| Bool |]
| 166
|
pNodeSslCerts =
withDoc "Whether to renew node SSL certificates" .
defaultField [| False |] $
simpleField "node_certificates" [t| Bool |]
| 143
| false
| true
| 0
| 7
| 28
| 37
| 21
| 16
| null | null |
michalt/cvector
|
Data/CVector/Unboxed.hs
|
bsd-3-clause
|
--
-- Indexing
--
indexed :: (Unbox a) => CVector a -> CVector (Int,a)
indexed = G.indexed
| 91
|
indexed :: (Unbox a) => CVector a -> CVector (Int,a)
indexed = G.indexed
| 72
|
indexed = G.indexed
| 19
| true
| true
| 0
| 8
| 17
| 41
| 23
| 18
| null | null |
brendanhay/gogol
|
gogol-slides/gen/Network/Google/Slides/Types/Product.hs
|
mpl-2.0
|
-- | The number of rows to be inserted. Maximum 20 per request.
itrrNumber :: Lens' InsertTableRowsRequest (Maybe Int32)
itrrNumber
= lens _itrrNumber (\ s a -> s{_itrrNumber = a}) .
mapping _Coerce
| 206
|
itrrNumber :: Lens' InsertTableRowsRequest (Maybe Int32)
itrrNumber
= lens _itrrNumber (\ s a -> s{_itrrNumber = a}) .
mapping _Coerce
| 142
|
itrrNumber
= lens _itrrNumber (\ s a -> s{_itrrNumber = a}) .
mapping _Coerce
| 85
| true
| true
| 0
| 10
| 40
| 55
| 28
| 27
| null | null |
lukexi/ghc-7.8-arm64
|
compiler/codeGen/StgCmmPrim.hs
|
bsd-3-clause
|
emitPrimOp dflags res IndexByteArrayOp_Int args = doIndexByteArrayOp Nothing (bWord dflags) res args
| 115
|
emitPrimOp dflags res IndexByteArrayOp_Int args = doIndexByteArrayOp Nothing (bWord dflags) res args
| 115
|
emitPrimOp dflags res IndexByteArrayOp_Int args = doIndexByteArrayOp Nothing (bWord dflags) res args
| 115
| false
| false
| 0
| 7
| 26
| 34
| 14
| 20
| null | null |
sherwoodwang/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxCURSOR_PENCIL :: Int
wxCURSOR_PENCIL = 13
| 43
|
wxCURSOR_PENCIL :: Int
wxCURSOR_PENCIL = 13
| 43
|
wxCURSOR_PENCIL = 13
| 20
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
prydonius/Oxo
|
Player.hs
|
mit
|
showPlayer X = "Player X"
| 28
|
showPlayer X = "Player X"
| 28
|
showPlayer X = "Player X"
| 28
| false
| false
| 0
| 5
| 7
| 9
| 4
| 5
| null | null |
soponpunth/turtle-haskell
|
TurtleGraphics.hs
|
mit
|
getColorGraphic TRed = Red
| 26
|
getColorGraphic TRed = Red
| 26
|
getColorGraphic TRed = Red
| 26
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
nicklawls/haskellbook
|
src/FoldyInstances.hs
|
bsd-3-clause
|
filterF :: (Applicative f, Foldable t, Monoid (f a)) => (a -> Bool) -> t a -> f a
filterF p = foldMap (\a -> if pope a then pure a else mempty)
| 143
|
filterF :: (Applicative f, Foldable t, Monoid (f a)) => (a -> Bool) -> t a -> f a
filterF p = foldMap (\a -> if pope a then pure a else mempty)
| 143
|
filterF p = foldMap (\a -> if pope a then pure a else mempty)
| 61
| false
| true
| 0
| 9
| 32
| 87
| 44
| 43
| null | null |
pjones/xmonad-test
|
vendor/xmonad-contrib/XMonad/Hooks/WallpaperSetter.hs
|
bsd-2-clause
|
getPicPathsAndWSRects :: WallpaperConf -> X [(Rectangle, FilePath)]
getPicPathsAndWSRects wpconf = do
winset <- gets windowset
paths <- liftIO getPicPaths
visws <- getVisibleWorkspaces
let visscr = S.current winset : S.visible winset
visrects = M.fromList $ map (\x -> ((S.tag . S.workspace) x, S.screenDetail x)) visscr
hasPicAndIsVisible (n, mp) = n `elem` visws && (isJust mp)
getRect tag = screenRect $ fromJust $ M.lookup tag visrects
foundpaths = map (\(n,Just p)->(getRect n,p)) $ filter hasPicAndIsVisible paths
return foundpaths
where getPicPaths = mapM (\(x,y) -> getPicPath wpconf y
>>= \p -> return (x,p)) wl
WallpaperList wl = wallpapers wpconf
-- | Gets a list of geometry rectangles and filenames, builds and sets wallpaper
| 814
|
getPicPathsAndWSRects :: WallpaperConf -> X [(Rectangle, FilePath)]
getPicPathsAndWSRects wpconf = do
winset <- gets windowset
paths <- liftIO getPicPaths
visws <- getVisibleWorkspaces
let visscr = S.current winset : S.visible winset
visrects = M.fromList $ map (\x -> ((S.tag . S.workspace) x, S.screenDetail x)) visscr
hasPicAndIsVisible (n, mp) = n `elem` visws && (isJust mp)
getRect tag = screenRect $ fromJust $ M.lookup tag visrects
foundpaths = map (\(n,Just p)->(getRect n,p)) $ filter hasPicAndIsVisible paths
return foundpaths
where getPicPaths = mapM (\(x,y) -> getPicPath wpconf y
>>= \p -> return (x,p)) wl
WallpaperList wl = wallpapers wpconf
-- | Gets a list of geometry rectangles and filenames, builds and sets wallpaper
| 814
|
getPicPathsAndWSRects wpconf = do
winset <- gets windowset
paths <- liftIO getPicPaths
visws <- getVisibleWorkspaces
let visscr = S.current winset : S.visible winset
visrects = M.fromList $ map (\x -> ((S.tag . S.workspace) x, S.screenDetail x)) visscr
hasPicAndIsVisible (n, mp) = n `elem` visws && (isJust mp)
getRect tag = screenRect $ fromJust $ M.lookup tag visrects
foundpaths = map (\(n,Just p)->(getRect n,p)) $ filter hasPicAndIsVisible paths
return foundpaths
where getPicPaths = mapM (\(x,y) -> getPicPath wpconf y
>>= \p -> return (x,p)) wl
WallpaperList wl = wallpapers wpconf
-- | Gets a list of geometry rectangles and filenames, builds and sets wallpaper
| 746
| false
| true
| 1
| 18
| 185
| 299
| 150
| 149
| null | null |
hanjoes/cis194
|
hw3/HW03.hs
|
mit
|
evalSimple :: State -> DietStatement -> State
evalSimple s (DAssign name e) = extend s name $ evalE s e
| 103
|
evalSimple :: State -> DietStatement -> State
evalSimple s (DAssign name e) = extend s name $ evalE s e
| 103
|
evalSimple s (DAssign name e) = extend s name $ evalE s e
| 57
| false
| true
| 0
| 7
| 19
| 46
| 22
| 24
| null | null |
FranklinChen/hugs98-plus-Sep2006
|
packages/network/Network/URI.hs
|
bsd-3-clause
|
isGenDelims c = c `elem` ":/?#[]@"
| 34
|
isGenDelims c = c `elem` ":/?#[]@"
| 34
|
isGenDelims c = c `elem` ":/?#[]@"
| 34
| false
| false
| 0
| 5
| 5
| 15
| 8
| 7
| null | null |
josefs/autosar
|
oldARSim/tmp-ABS.hs
|
bsd-3-clause
|
pressure_step valve accel 20 = do
rte_write valve True
return Stopped
| 85
|
pressure_step valve accel 20 = do
rte_write valve True
return Stopped
| 85
|
pressure_step valve accel 20 = do
rte_write valve True
return Stopped
| 85
| false
| false
| 0
| 7
| 26
| 27
| 11
| 16
| null | null |
s9gf4ult/yesod
|
yesod-core/test/YesodCoreTest/NoOverloadedStrings.hs
|
mit
|
getBarR :: MonadHandler m => m T.Text
getBarR = return $ T.pack "BarR"
| 70
|
getBarR :: MonadHandler m => m T.Text
getBarR = return $ T.pack "BarR"
| 70
|
getBarR = return $ T.pack "BarR"
| 32
| false
| true
| 0
| 7
| 12
| 32
| 15
| 17
| null | null |
ThreeFx/ETH
|
1semester/diskmat/CurryHoward.hs
|
mit
|
-- assume the excluded middle
-- not provable in constructive logic
excluded_middle :: p \/ Not p
excluded_middle = assume
| 125
|
excluded_middle :: p \/ Not p
excluded_middle = assume
| 54
|
excluded_middle = assume
| 24
| true
| true
| 0
| 6
| 22
| 20
| 11
| 9
| null | null |
genos/online_problems
|
advent_of_code_2016/day7/src/Main.hs
|
mit
|
input :: ByteString
input = $(embedFile "input.txt")
| 52
|
input :: ByteString
input = $(embedFile "input.txt")
| 52
|
input = $(embedFile "input.txt")
| 32
| false
| true
| 0
| 7
| 6
| 18
| 9
| 9
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.