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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
EPashkin/gamenumber-freegame | src_gl/GameLogic/Util.hs | gpl-3.0 | calcStrengthsForPlayer :: Int -> WorldPos -> GameData -> Strengths
calcStrengthsForPlayer playerInd pos game
= (same, others, sameStrength, deltaStrength)
where (same, others) = calcStrengthsForPlayer' playerInd pos game
sameStrength = same ^. value
deltaStrength = getDeltaOtherStrength sameStrength others | 335 | calcStrengthsForPlayer :: Int -> WorldPos -> GameData -> Strengths
calcStrengthsForPlayer playerInd pos game
= (same, others, sameStrength, deltaStrength)
where (same, others) = calcStrengthsForPlayer' playerInd pos game
sameStrength = same ^. value
deltaStrength = getDeltaOtherStrength sameStrength others | 335 | calcStrengthsForPlayer playerInd pos game
= (same, others, sameStrength, deltaStrength)
where (same, others) = calcStrengthsForPlayer' playerInd pos game
sameStrength = same ^. value
deltaStrength = getDeltaOtherStrength sameStrength others | 268 | false | true | 0 | 7 | 63 | 82 | 44 | 38 | null | null |
Hi-Angel/yi | yi-core/src/Yi/Buffer/Misc.hs | gpl-2.0 | isUnchangedBuffer :: FBuffer -> Bool
isUnchangedBuffer = isAtSavedFilePointU . view undosA | 90 | isUnchangedBuffer :: FBuffer -> Bool
isUnchangedBuffer = isAtSavedFilePointU . view undosA | 90 | isUnchangedBuffer = isAtSavedFilePointU . view undosA | 53 | false | true | 0 | 6 | 10 | 22 | 11 | 11 | null | null |
gcampax/ghc | compiler/types/Type.hs | bsd-3-clause | isEqPred ty = case tyConAppTyCon_maybe ty of
Just tyCon -> tyCon `hasKey` eqTyConKey
_ -> False | 112 | isEqPred ty = case tyConAppTyCon_maybe ty of
Just tyCon -> tyCon `hasKey` eqTyConKey
_ -> False | 112 | isEqPred ty = case tyConAppTyCon_maybe ty of
Just tyCon -> tyCon `hasKey` eqTyConKey
_ -> False | 112 | false | false | 3 | 6 | 32 | 34 | 17 | 17 | null | null |
da-x/lamdu | Lamdu/Builtins/PrimVal.hs | gpl-3.0 | bytesType :: Type
bytesType = T.TInst bytesTid mempty | 53 | bytesType :: Type
bytesType = T.TInst bytesTid mempty | 53 | bytesType = T.TInst bytesTid mempty | 35 | false | true | 0 | 6 | 7 | 18 | 9 | 9 | null | null |
dblia/nosql-ganeti | src/Ganeti/Objects.hs | gpl-2.0 | roleDescription NRRegular = "regular" | 39 | roleDescription NRRegular = "regular" | 39 | roleDescription NRRegular = "regular" | 39 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
nick8325/kbc | src/Twee/Proof.hs | bsd-3-clause | simpleLemma :: PrettyTerm f => Proof f -> Derivation f
simpleLemma p =
UseLemma p (autoSubst (equation p)) | 108 | simpleLemma :: PrettyTerm f => Proof f -> Derivation f
simpleLemma p =
UseLemma p (autoSubst (equation p)) | 108 | simpleLemma p =
UseLemma p (autoSubst (equation p)) | 53 | false | true | 0 | 9 | 19 | 48 | 22 | 26 | null | null |
fcharlie/hgit | src/Git/Common.hs | bsd-3-clause | eitherToMaybe :: Either e a -> Maybe a
eitherToMaybe (Right x) = Just x | 71 | eitherToMaybe :: Either e a -> Maybe a
eitherToMaybe (Right x) = Just x | 71 | eitherToMaybe (Right x) = Just x | 32 | false | true | 0 | 7 | 13 | 35 | 16 | 19 | null | null |
mbixby/stackoverflow_cli | so.hs | gpl-3.0 | -- | Version info
version :: String
version = "GNU CLI StackOverflow 1.0\n\
\Copyright (C) 2007 Free Software Foundation, Inc.\n\
\Complain about bugs & issues on https://github.com/mbixby/stackoverflow_cli\n\
\License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
\This is free software: you are free to change and redistribute it.\n\
\There is NO WARRANTY, to the extent permitted by law." | 469 | version :: String
version = "GNU CLI StackOverflow 1.0\n\
\Copyright (C) 2007 Free Software Foundation, Inc.\n\
\Complain about bugs & issues on https://github.com/mbixby/stackoverflow_cli\n\
\License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
\This is free software: you are free to change and redistribute it.\n\
\There is NO WARRANTY, to the extent permitted by law." | 450 | version = "GNU CLI StackOverflow 1.0\n\
\Copyright (C) 2007 Free Software Foundation, Inc.\n\
\Complain about bugs & issues on https://github.com/mbixby/stackoverflow_cli\n\
\License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
\This is free software: you are free to change and redistribute it.\n\
\There is NO WARRANTY, to the extent permitted by law." | 432 | true | true | 0 | 4 | 108 | 12 | 7 | 5 | null | null |
Teaspot-Studio/Urho3D-Haskell | src/Graphics/Urho3D/UI/Text.hs | mit | textGetRowHeight :: (Parent Text a, Pointer p a, MonadIO m)
=> p -- ^ Pointer to Text object
-> m Int
textGetRowHeight p = liftIO $ do
let ptr = parentPointer p
fromIntegral <$> [C.exp| int { $(Text* ptr)->GetRowHeight() } |]
-- | Return row height. | 258 | textGetRowHeight :: (Parent Text a, Pointer p a, MonadIO m)
=> p -- ^ Pointer to Text object
-> m Int
textGetRowHeight p = liftIO $ do
let ptr = parentPointer p
fromIntegral <$> [C.exp| int { $(Text* ptr)->GetRowHeight() } |]
-- | Return row height. | 258 | textGetRowHeight p = liftIO $ do
let ptr = parentPointer p
fromIntegral <$> [C.exp| int { $(Text* ptr)->GetRowHeight() } |]
-- | Return row height. | 152 | false | true | 2 | 10 | 54 | 83 | 41 | 42 | null | null |
nomeata/sat-britney | Picosat.hs | gpl-2.0 | runPicosatPMINMAX :: [Int] -> SATProb -> IO (Either (CNF) ([Int],[[Int]]))
runPicosatPMINMAX _ sp | isPMAXSAT sp = error "runPicosatPMINMAX must not be passed a PMAXSAT instance" | 178 | runPicosatPMINMAX :: [Int] -> SATProb -> IO (Either (CNF) ([Int],[[Int]]))
runPicosatPMINMAX _ sp | isPMAXSAT sp = error "runPicosatPMINMAX must not be passed a PMAXSAT instance" | 178 | runPicosatPMINMAX _ sp | isPMAXSAT sp = error "runPicosatPMINMAX must not be passed a PMAXSAT instance" | 103 | false | true | 0 | 12 | 25 | 68 | 35 | 33 | null | null |
shayan-najd/QFeldspar | QFeldspar/Expression/Utils/Equality/GADTFirstOrder.hs | gpl-3.0 | eql (May em en es ) (May em' en' es') =
case eqlSin (sinTypOf em tt) (sinTypOf em' tt) of
Rgt Rfl -> eql em em' && eql en en' && eql es es'
_ -> False | 168 | eql (May em en es ) (May em' en' es') =
case eqlSin (sinTypOf em tt) (sinTypOf em' tt) of
Rgt Rfl -> eql em em' && eql en en' && eql es es'
_ -> False | 168 | eql (May em en es ) (May em' en' es') =
case eqlSin (sinTypOf em tt) (sinTypOf em' tt) of
Rgt Rfl -> eql em em' && eql en en' && eql es es'
_ -> False | 168 | false | false | 0 | 10 | 54 | 96 | 44 | 52 | null | null |
joelburget/haste-compiler | libraries/base-ghc-7.6/GHC/Float/ConversionUtils.hs | bsd-3-clause | -- Number of trailing zero bits in a byte
zeroCountArr :: BA
zeroCountArr =
let mkArr s =
case newByteArray# 256# s of
(# s1, mba #) ->
case writeInt8Array# mba 0# 8# s1 of
s2 ->
let fillA step val idx st
| idx <# 256# = case writeInt8Array# mba idx val st of
nx -> fillA step val (idx +# step) nx
| step <# 256# = fillA (2# *# step) (val +# 1#) step st
| otherwise = st
in case fillA 2# 0# 1# s2 of
s3 -> case unsafeFreezeByteArray# mba s3 of
(# _, ba #) -> ba
in case mkArr realWorld# of
b -> BA b | 775 | zeroCountArr :: BA
zeroCountArr =
let mkArr s =
case newByteArray# 256# s of
(# s1, mba #) ->
case writeInt8Array# mba 0# 8# s1 of
s2 ->
let fillA step val idx st
| idx <# 256# = case writeInt8Array# mba idx val st of
nx -> fillA step val (idx +# step) nx
| step <# 256# = fillA (2# *# step) (val +# 1#) step st
| otherwise = st
in case fillA 2# 0# 1# s2 of
s3 -> case unsafeFreezeByteArray# mba s3 of
(# _, ba #) -> ba
in case mkArr realWorld# of
b -> BA b | 733 | zeroCountArr =
let mkArr s =
case newByteArray# 256# s of
(# s1, mba #) ->
case writeInt8Array# mba 0# 8# s1 of
s2 ->
let fillA step val idx st
| idx <# 256# = case writeInt8Array# mba idx val st of
nx -> fillA step val (idx +# step) nx
| step <# 256# = fillA (2# *# step) (val +# 1#) step st
| otherwise = st
in case fillA 2# 0# 1# s2 of
s3 -> case unsafeFreezeByteArray# mba s3 of
(# _, ba #) -> ba
in case mkArr realWorld# of
b -> BA b | 714 | true | true | 1 | 25 | 387 | 230 | 110 | 120 | null | null |
nikita-volkov/hasql-th | library/Hasql/TH/Extraction/ChildExprList.hs | mit | collateClause = anyName | 23 | collateClause = anyName | 23 | collateClause = anyName | 23 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
3of8/haskell_playground | mandelbrot/Mandelbrot.hs | gpl-2.0 | colors :: RealFrac a => V.Vector (a, a, a)
colors = V.fromList
[(0.00000, 0.00000, 0.50000),(0.00000, 0.00000, 0.56349),(0.00000, 0.00000, 0.62698),
(0.00000, 0.00000, 0.69048),(0.00000, 0.00000, 0.75397),(0.00000, 0.00000, 0.81746),
(0.00000, 0.00000, 0.88095),(0.00000, 0.00000, 0.94444),(0.00000, 0.00794, 1.00000),
(0.00000, 0.07143, 1.00000),(0.00000, 0.13492, 1.00000),(0.00000, 0.19841, 1.00000),
(0.00000, 0.26190, 1.00000),(0.00000, 0.32540, 1.00000),(0.00000, 0.38889, 1.00000),
(0.00000, 0.45238, 1.00000),(0.00000, 0.51587, 1.00000),(0.00000, 0.57937, 1.00000),
(0.00000, 0.64286, 1.00000),(0.00000, 0.70635, 1.00000),(0.00000, 0.76984, 1.00000),
(0.00000, 0.83333, 1.00000),(0.00000, 0.89683, 1.00000),(0.00000, 0.96032, 1.00000),
(0.02381, 1.00000, 0.97619),(0.08730, 1.00000, 0.91270),(0.15079, 1.00000, 0.84921),
(0.21429, 1.00000, 0.78571),(0.27778, 1.00000, 0.72222),(0.34127, 1.00000, 0.65873),
(0.40476, 1.00000, 0.59524),(0.46825, 1.00000, 0.53175),(0.53175, 1.00000, 0.46825),
(0.59524, 1.00000, 0.40476),(0.65873, 1.00000, 0.34127),(0.72222, 1.00000, 0.27778),
(0.78571, 1.00000, 0.21429),(0.84921, 1.00000, 0.15079),(0.91270, 1.00000, 0.08730),
(0.97619, 1.00000, 0.02381),(1.00000, 0.96032, 0.00000),(1.00000, 0.89683, 0.00000),
(1.00000, 0.83333, 0.00000),(1.00000, 0.76984, 0.00000),(1.00000, 0.70635, 0.00000),
(1.00000, 0.64286, 0.00000),(1.00000, 0.57937, 0.00000),(1.00000, 0.51587, 0.00000),
(1.00000, 0.45238, 0.00000),(1.00000, 0.38889, 0.00000),(1.00000, 0.32540, 0.00000),
(1.00000, 0.26190, 0.00000),(1.00000, 0.19841, 0.00000),(1.00000, 0.13492, 0.00000),
(1.00000, 0.07143, 0.00000),(1.00000, 0.00794, 0.00000),(0.94444, 0.00000, 0.00000),
(0.88095, 0.00000, 0.00000),(0.81746, 0.00000, 0.00000),(0.75397, 0.00000, 0.00000),
(0.69048, 0.00000, 0.00000),(0.62698, 0.00000, 0.00000),(0.56349, 0.00000, 0.00000),
(0.50000, 0.00000, 0.00000)] | 2,183 | colors :: RealFrac a => V.Vector (a, a, a)
colors = V.fromList
[(0.00000, 0.00000, 0.50000),(0.00000, 0.00000, 0.56349),(0.00000, 0.00000, 0.62698),
(0.00000, 0.00000, 0.69048),(0.00000, 0.00000, 0.75397),(0.00000, 0.00000, 0.81746),
(0.00000, 0.00000, 0.88095),(0.00000, 0.00000, 0.94444),(0.00000, 0.00794, 1.00000),
(0.00000, 0.07143, 1.00000),(0.00000, 0.13492, 1.00000),(0.00000, 0.19841, 1.00000),
(0.00000, 0.26190, 1.00000),(0.00000, 0.32540, 1.00000),(0.00000, 0.38889, 1.00000),
(0.00000, 0.45238, 1.00000),(0.00000, 0.51587, 1.00000),(0.00000, 0.57937, 1.00000),
(0.00000, 0.64286, 1.00000),(0.00000, 0.70635, 1.00000),(0.00000, 0.76984, 1.00000),
(0.00000, 0.83333, 1.00000),(0.00000, 0.89683, 1.00000),(0.00000, 0.96032, 1.00000),
(0.02381, 1.00000, 0.97619),(0.08730, 1.00000, 0.91270),(0.15079, 1.00000, 0.84921),
(0.21429, 1.00000, 0.78571),(0.27778, 1.00000, 0.72222),(0.34127, 1.00000, 0.65873),
(0.40476, 1.00000, 0.59524),(0.46825, 1.00000, 0.53175),(0.53175, 1.00000, 0.46825),
(0.59524, 1.00000, 0.40476),(0.65873, 1.00000, 0.34127),(0.72222, 1.00000, 0.27778),
(0.78571, 1.00000, 0.21429),(0.84921, 1.00000, 0.15079),(0.91270, 1.00000, 0.08730),
(0.97619, 1.00000, 0.02381),(1.00000, 0.96032, 0.00000),(1.00000, 0.89683, 0.00000),
(1.00000, 0.83333, 0.00000),(1.00000, 0.76984, 0.00000),(1.00000, 0.70635, 0.00000),
(1.00000, 0.64286, 0.00000),(1.00000, 0.57937, 0.00000),(1.00000, 0.51587, 0.00000),
(1.00000, 0.45238, 0.00000),(1.00000, 0.38889, 0.00000),(1.00000, 0.32540, 0.00000),
(1.00000, 0.26190, 0.00000),(1.00000, 0.19841, 0.00000),(1.00000, 0.13492, 0.00000),
(1.00000, 0.07143, 0.00000),(1.00000, 0.00794, 0.00000),(0.94444, 0.00000, 0.00000),
(0.88095, 0.00000, 0.00000),(0.81746, 0.00000, 0.00000),(0.75397, 0.00000, 0.00000),
(0.69048, 0.00000, 0.00000),(0.62698, 0.00000, 0.00000),(0.56349, 0.00000, 0.00000),
(0.50000, 0.00000, 0.00000)] | 2,183 | colors = V.fromList
[(0.00000, 0.00000, 0.50000),(0.00000, 0.00000, 0.56349),(0.00000, 0.00000, 0.62698),
(0.00000, 0.00000, 0.69048),(0.00000, 0.00000, 0.75397),(0.00000, 0.00000, 0.81746),
(0.00000, 0.00000, 0.88095),(0.00000, 0.00000, 0.94444),(0.00000, 0.00794, 1.00000),
(0.00000, 0.07143, 1.00000),(0.00000, 0.13492, 1.00000),(0.00000, 0.19841, 1.00000),
(0.00000, 0.26190, 1.00000),(0.00000, 0.32540, 1.00000),(0.00000, 0.38889, 1.00000),
(0.00000, 0.45238, 1.00000),(0.00000, 0.51587, 1.00000),(0.00000, 0.57937, 1.00000),
(0.00000, 0.64286, 1.00000),(0.00000, 0.70635, 1.00000),(0.00000, 0.76984, 1.00000),
(0.00000, 0.83333, 1.00000),(0.00000, 0.89683, 1.00000),(0.00000, 0.96032, 1.00000),
(0.02381, 1.00000, 0.97619),(0.08730, 1.00000, 0.91270),(0.15079, 1.00000, 0.84921),
(0.21429, 1.00000, 0.78571),(0.27778, 1.00000, 0.72222),(0.34127, 1.00000, 0.65873),
(0.40476, 1.00000, 0.59524),(0.46825, 1.00000, 0.53175),(0.53175, 1.00000, 0.46825),
(0.59524, 1.00000, 0.40476),(0.65873, 1.00000, 0.34127),(0.72222, 1.00000, 0.27778),
(0.78571, 1.00000, 0.21429),(0.84921, 1.00000, 0.15079),(0.91270, 1.00000, 0.08730),
(0.97619, 1.00000, 0.02381),(1.00000, 0.96032, 0.00000),(1.00000, 0.89683, 0.00000),
(1.00000, 0.83333, 0.00000),(1.00000, 0.76984, 0.00000),(1.00000, 0.70635, 0.00000),
(1.00000, 0.64286, 0.00000),(1.00000, 0.57937, 0.00000),(1.00000, 0.51587, 0.00000),
(1.00000, 0.45238, 0.00000),(1.00000, 0.38889, 0.00000),(1.00000, 0.32540, 0.00000),
(1.00000, 0.26190, 0.00000),(1.00000, 0.19841, 0.00000),(1.00000, 0.13492, 0.00000),
(1.00000, 0.07143, 0.00000),(1.00000, 0.00794, 0.00000),(0.94444, 0.00000, 0.00000),
(0.88095, 0.00000, 0.00000),(0.81746, 0.00000, 0.00000),(0.75397, 0.00000, 0.00000),
(0.69048, 0.00000, 0.00000),(0.62698, 0.00000, 0.00000),(0.56349, 0.00000, 0.00000),
(0.50000, 0.00000, 0.00000)] | 2,140 | false | true | 0 | 7 | 467 | 805 | 531 | 274 | null | null |
nevrenato/Hets_Fork | Comorphisms/Hs2HOLCFaux.hs | gpl-2.0 | ----------------------- TERMS ------------------------------------------
-- lifting, tuples, multiple abstractions and applications, fixpoints --
funFliftbin :: Term -> Term
funFliftbin f = termMAppl NotCont (conDouble lliftbinS) [f] | 234 | funFliftbin :: Term -> Term
funFliftbin f = termMAppl NotCont (conDouble lliftbinS) [f] | 87 | funFliftbin f = termMAppl NotCont (conDouble lliftbinS) [f] | 59 | true | true | 0 | 7 | 25 | 36 | 19 | 17 | null | null |
ekr/tamarin-prover | lib/utils/src/Text/PrettyPrint/Class.hs | gpl-3.0 | -- | Like 'nestShort'' but doesn't print the lead and finish, if the document is
-- empty.
nestShortNonEmpty' :: Document d => String -> String -> d -> d
nestShortNonEmpty' lead finish =
nestShortNonEmpty (length lead + 1) (text lead) (text finish) | 251 | nestShortNonEmpty' :: Document d => String -> String -> d -> d
nestShortNonEmpty' lead finish =
nestShortNonEmpty (length lead + 1) (text lead) (text finish) | 160 | nestShortNonEmpty' lead finish =
nestShortNonEmpty (length lead + 1) (text lead) (text finish) | 97 | true | true | 0 | 8 | 44 | 66 | 33 | 33 | null | null |
thiagoarrais/gtk2hs | demo/opengl/RotatingCube.hs | lgpl-2.1 | drawCube :: (GLfloat, GLfloat, GLfloat) -> IO ()
drawCube (r_x, r_y, r_z) = do
loadIdentity
rotate r_x (Vector3 1 0 0 :: Vector3 GLfloat)
rotate r_y (Vector3 0 1 0 :: Vector3 GLfloat)
rotate r_z (Vector3 0 0 1 :: Vector3 GLfloat)
mapM_ drawFace (zip colours faces)
where drawFace :: (Color3 GLfloat, IO ()) -> IO ()
drawFace (colour, face) = do color colour
renderPrimitive Quads face
faces = map (mapM_ vertex) faceVertices :: [IO ()]
colours = [red, green, yellow, blue, purple, cyan]
faceVertices = [
[Vertex3 to to to,
Vertex3 from to to,
Vertex3 from from to,
Vertex3 to from to],
[Vertex3 to to from,
Vertex3 from to from,
Vertex3 from from from,
Vertex3 to from from],
[Vertex3 to to to,
Vertex3 from to to,
Vertex3 from to from,
Vertex3 to to from],
[Vertex3 to from to,
Vertex3 from from to,
Vertex3 from from from,
Vertex3 to from from],
[Vertex3 to to to,
Vertex3 to from to,
Vertex3 to from from,
Vertex3 to to from],
[Vertex3 from to to,
Vertex3 from from to,
Vertex3 from from from,
Vertex3 from to from]] | 1,671 | drawCube :: (GLfloat, GLfloat, GLfloat) -> IO ()
drawCube (r_x, r_y, r_z) = do
loadIdentity
rotate r_x (Vector3 1 0 0 :: Vector3 GLfloat)
rotate r_y (Vector3 0 1 0 :: Vector3 GLfloat)
rotate r_z (Vector3 0 0 1 :: Vector3 GLfloat)
mapM_ drawFace (zip colours faces)
where drawFace :: (Color3 GLfloat, IO ()) -> IO ()
drawFace (colour, face) = do color colour
renderPrimitive Quads face
faces = map (mapM_ vertex) faceVertices :: [IO ()]
colours = [red, green, yellow, blue, purple, cyan]
faceVertices = [
[Vertex3 to to to,
Vertex3 from to to,
Vertex3 from from to,
Vertex3 to from to],
[Vertex3 to to from,
Vertex3 from to from,
Vertex3 from from from,
Vertex3 to from from],
[Vertex3 to to to,
Vertex3 from to to,
Vertex3 from to from,
Vertex3 to to from],
[Vertex3 to from to,
Vertex3 from from to,
Vertex3 from from from,
Vertex3 to from from],
[Vertex3 to to to,
Vertex3 to from to,
Vertex3 to from from,
Vertex3 to to from],
[Vertex3 from to to,
Vertex3 from from to,
Vertex3 from from from,
Vertex3 from to from]] | 1,671 | drawCube (r_x, r_y, r_z) = do
loadIdentity
rotate r_x (Vector3 1 0 0 :: Vector3 GLfloat)
rotate r_y (Vector3 0 1 0 :: Vector3 GLfloat)
rotate r_z (Vector3 0 0 1 :: Vector3 GLfloat)
mapM_ drawFace (zip colours faces)
where drawFace :: (Color3 GLfloat, IO ()) -> IO ()
drawFace (colour, face) = do color colour
renderPrimitive Quads face
faces = map (mapM_ vertex) faceVertices :: [IO ()]
colours = [red, green, yellow, blue, purple, cyan]
faceVertices = [
[Vertex3 to to to,
Vertex3 from to to,
Vertex3 from from to,
Vertex3 to from to],
[Vertex3 to to from,
Vertex3 from to from,
Vertex3 from from from,
Vertex3 to from from],
[Vertex3 to to to,
Vertex3 from to to,
Vertex3 from to from,
Vertex3 to to from],
[Vertex3 to from to,
Vertex3 from from to,
Vertex3 from from from,
Vertex3 to from from],
[Vertex3 to to to,
Vertex3 to from to,
Vertex3 to from from,
Vertex3 to to from],
[Vertex3 from to to,
Vertex3 from from to,
Vertex3 from from from,
Vertex3 from to from]] | 1,622 | false | true | 4 | 9 | 834 | 507 | 256 | 251 | null | null |
dillonhuff/IntLang | test/SyntaxTests.hs | bsd-3-clause | toRPNCases =
[(var "d", [arg 2]),
(var "v", [arg 1]),
(var "e", [arg 3]),
(var "nil", [intVal 0]),
(bool True, [boolVal True]),
(bool False, [boolVal False]),
(num 3, [intVal 3]),
(ap (ap (var "+") (num 3)) (num 5), [intVal 5, intVal 3, funcall "int_add" 2, appl, appl]),
(var "+", [funcall "int_add" 2]),
(var "-", [funcall "int_sub" 2]),
(var "*", [funcall "int_mul" 2]),
(var "/", [funcall "int_div" 2]),
(var "||", [funcall "bool_or" 2]),
(var "&&", [funcall "bool_and" 2]),
(var "~", [funcall "bool_not" 1]),
(var ">", [funcall "greater" 2]),
(var "<", [funcall "less" 2]),
(var ">=", [funcall "greater_or_equal" 2]),
(var "<=", [funcall "less_or_equal" 2]),
(var "==", [funcall "equal" 2]),
(var "isNil", [funcall "is_nil" 1]),
(ite (ap (var "~") (var "e")) (num (-4)) (var "d"),
[arg 3, funcall "bool_not" 1, appl, jumpFalse 0, intVal (-4), jump 1, label 0, arg 2, label 1]),
(var "list", [intVal 2, funcall "create_record" 3, appl]),
(var "bTree", [intVal 3, funcall "create_record" 4, appl]),
(var "data", [intVal 0, funcall "get_field" 2, appl]),
(var "next", [intVal 1, funcall "get_field" 2, appl]),
(var "val", [intVal 0, funcall "get_field" 2, appl]),
(var "left", [intVal 1, funcall "get_field" 2, appl]),
(var "right", [intVal 2, funcall "get_field" 2, appl])] | 1,366 | toRPNCases =
[(var "d", [arg 2]),
(var "v", [arg 1]),
(var "e", [arg 3]),
(var "nil", [intVal 0]),
(bool True, [boolVal True]),
(bool False, [boolVal False]),
(num 3, [intVal 3]),
(ap (ap (var "+") (num 3)) (num 5), [intVal 5, intVal 3, funcall "int_add" 2, appl, appl]),
(var "+", [funcall "int_add" 2]),
(var "-", [funcall "int_sub" 2]),
(var "*", [funcall "int_mul" 2]),
(var "/", [funcall "int_div" 2]),
(var "||", [funcall "bool_or" 2]),
(var "&&", [funcall "bool_and" 2]),
(var "~", [funcall "bool_not" 1]),
(var ">", [funcall "greater" 2]),
(var "<", [funcall "less" 2]),
(var ">=", [funcall "greater_or_equal" 2]),
(var "<=", [funcall "less_or_equal" 2]),
(var "==", [funcall "equal" 2]),
(var "isNil", [funcall "is_nil" 1]),
(ite (ap (var "~") (var "e")) (num (-4)) (var "d"),
[arg 3, funcall "bool_not" 1, appl, jumpFalse 0, intVal (-4), jump 1, label 0, arg 2, label 1]),
(var "list", [intVal 2, funcall "create_record" 3, appl]),
(var "bTree", [intVal 3, funcall "create_record" 4, appl]),
(var "data", [intVal 0, funcall "get_field" 2, appl]),
(var "next", [intVal 1, funcall "get_field" 2, appl]),
(var "val", [intVal 0, funcall "get_field" 2, appl]),
(var "left", [intVal 1, funcall "get_field" 2, appl]),
(var "right", [intVal 2, funcall "get_field" 2, appl])] | 1,366 | toRPNCases =
[(var "d", [arg 2]),
(var "v", [arg 1]),
(var "e", [arg 3]),
(var "nil", [intVal 0]),
(bool True, [boolVal True]),
(bool False, [boolVal False]),
(num 3, [intVal 3]),
(ap (ap (var "+") (num 3)) (num 5), [intVal 5, intVal 3, funcall "int_add" 2, appl, appl]),
(var "+", [funcall "int_add" 2]),
(var "-", [funcall "int_sub" 2]),
(var "*", [funcall "int_mul" 2]),
(var "/", [funcall "int_div" 2]),
(var "||", [funcall "bool_or" 2]),
(var "&&", [funcall "bool_and" 2]),
(var "~", [funcall "bool_not" 1]),
(var ">", [funcall "greater" 2]),
(var "<", [funcall "less" 2]),
(var ">=", [funcall "greater_or_equal" 2]),
(var "<=", [funcall "less_or_equal" 2]),
(var "==", [funcall "equal" 2]),
(var "isNil", [funcall "is_nil" 1]),
(ite (ap (var "~") (var "e")) (num (-4)) (var "d"),
[arg 3, funcall "bool_not" 1, appl, jumpFalse 0, intVal (-4), jump 1, label 0, arg 2, label 1]),
(var "list", [intVal 2, funcall "create_record" 3, appl]),
(var "bTree", [intVal 3, funcall "create_record" 4, appl]),
(var "data", [intVal 0, funcall "get_field" 2, appl]),
(var "next", [intVal 1, funcall "get_field" 2, appl]),
(var "val", [intVal 0, funcall "get_field" 2, appl]),
(var "left", [intVal 1, funcall "get_field" 2, appl]),
(var "right", [intVal 2, funcall "get_field" 2, appl])] | 1,366 | false | false | 0 | 11 | 285 | 772 | 421 | 351 | null | null |
skywind3000/language | haskell/str2int.hs | mit | drop_while (s:t, n)
| s == n = t
| otherwise = drop_while(t, n) | 82 | drop_while (s:t, n)
| s == n = t
| otherwise = drop_while(t, n) | 82 | drop_while (s:t, n)
| s == n = t
| otherwise = drop_while(t, n) | 82 | false | false | 0 | 8 | 32 | 50 | 24 | 26 | null | null |
naohaq/gf256-hs | example/MyUtil.hs | mit | fromW8toHex :: W.Word8 -> String
fromW8toHex x = [letters !! (fromIntegral hi), letters !! (fromIntegral lo)]
where letters = "0123456789abcdef"
(hi,lo) = x `divMod` 16 | 178 | fromW8toHex :: W.Word8 -> String
fromW8toHex x = [letters !! (fromIntegral hi), letters !! (fromIntegral lo)]
where letters = "0123456789abcdef"
(hi,lo) = x `divMod` 16 | 178 | fromW8toHex x = [letters !! (fromIntegral hi), letters !! (fromIntegral lo)]
where letters = "0123456789abcdef"
(hi,lo) = x `divMod` 16 | 145 | false | true | 1 | 8 | 34 | 73 | 39 | 34 | null | null |
CindyLinz/Haskell.js | trans/sample/show_int.hs | mit | main =
let
showPosInt = \n ->
let
showDigit = \d -> case d of
0 -> '0'
1 -> '1'
2 -> '2'
3 -> '3'
4 -> '4'
5 -> '5'
6 -> '6'
7 -> '7'
8 -> '8'
9 -> '9'
go = \n -> case n of
0 -> []
_ -> (:) (showDigit (mod n 10)) (go (div n 10))
reverse = \ls ->
let
go = \ls rs -> case ls of
[] -> rs
(:) a as -> go as ((:) a rs)
in
go ls []
in
reverse (go n)
in
putStrLn (showPosInt 257) | 622 | main =
let
showPosInt = \n ->
let
showDigit = \d -> case d of
0 -> '0'
1 -> '1'
2 -> '2'
3 -> '3'
4 -> '4'
5 -> '5'
6 -> '6'
7 -> '7'
8 -> '8'
9 -> '9'
go = \n -> case n of
0 -> []
_ -> (:) (showDigit (mod n 10)) (go (div n 10))
reverse = \ls ->
let
go = \ls rs -> case ls of
[] -> rs
(:) a as -> go as ((:) a rs)
in
go ls []
in
reverse (go n)
in
putStrLn (showPosInt 257) | 622 | main =
let
showPosInt = \n ->
let
showDigit = \d -> case d of
0 -> '0'
1 -> '1'
2 -> '2'
3 -> '3'
4 -> '4'
5 -> '5'
6 -> '6'
7 -> '7'
8 -> '8'
9 -> '9'
go = \n -> case n of
0 -> []
_ -> (:) (showDigit (mod n 10)) (go (div n 10))
reverse = \ls ->
let
go = \ls rs -> case ls of
[] -> rs
(:) a as -> go as ((:) a rs)
in
go ls []
in
reverse (go n)
in
putStrLn (showPosInt 257) | 622 | false | false | 1 | 25 | 352 | 261 | 131 | 130 | null | null |
vikraman/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | pprCLbl (RtsLabel (RtsSelectorInfoTable upd_reqd offset))
= sdocWithDynFlags $ \dflags ->
ASSERT(offset >= 0 && offset <= mAX_SPEC_SELECTEE_SIZE dflags)
hcat [text "stg_sel_", text (show offset),
ptext (if upd_reqd
then (sLit "_upd_info")
else (sLit "_noupd_info"))
] | 329 | pprCLbl (RtsLabel (RtsSelectorInfoTable upd_reqd offset))
= sdocWithDynFlags $ \dflags ->
ASSERT(offset >= 0 && offset <= mAX_SPEC_SELECTEE_SIZE dflags)
hcat [text "stg_sel_", text (show offset),
ptext (if upd_reqd
then (sLit "_upd_info")
else (sLit "_noupd_info"))
] | 329 | pprCLbl (RtsLabel (RtsSelectorInfoTable upd_reqd offset))
= sdocWithDynFlags $ \dflags ->
ASSERT(offset >= 0 && offset <= mAX_SPEC_SELECTEE_SIZE dflags)
hcat [text "stg_sel_", text (show offset),
ptext (if upd_reqd
then (sLit "_upd_info")
else (sLit "_noupd_info"))
] | 329 | false | false | 2 | 11 | 95 | 109 | 53 | 56 | null | null |
Gabriel439/Haskell-Pipes-Library | src/Pipes/Core.hs | bsd-3-clause | (/</)
:: Functor m
=> (c' -> Proxy b' b x' x m c)
-- ^
-> (b' -> Proxy a' a x' x m b)
-- ^
-> (c' -> Proxy a' a x' x m c)
-- ^
p1 /</ p2 = p2 \>\ p1 | 176 | (/</)
:: Functor m
=> (c' -> Proxy b' b x' x m c)
-- ^
-> (b' -> Proxy a' a x' x m b)
-- ^
-> (c' -> Proxy a' a x' x m c)
p1 /</ p2 = p2 \>\ p1 | 167 | p1 /</ p2 = p2 \>\ p1 | 21 | true | true | 0 | 10 | 74 | 101 | 52 | 49 | null | null |
pauloborba/plc | src/ExameEscrito2015.hs | cc0-1.0 | c = Binaria Soma a b | 20 | c = Binaria Soma a b | 20 | c = Binaria Soma a b | 20 | false | false | 1 | 5 | 5 | 16 | 6 | 10 | null | null |
uduki/hsQt | Qtc/Enums/Core/QVariant.hs | bsd-2-clause | eULongLong :: QVariantType
eULongLong
= ieQVariantType $ 5 | 60 | eULongLong :: QVariantType
eULongLong
= ieQVariantType $ 5 | 60 | eULongLong
= ieQVariantType $ 5 | 33 | false | true | 0 | 6 | 9 | 18 | 8 | 10 | null | null |
ducis/scraper-dsl-open-snapshot | invertible-syntax-0.2.1/src/Text/Syntax/Combinators.hs | gpl-2.0 | sepBy :: Syntax delta => delta alpha -> delta () -> delta [alpha]
sepBy x sep
= nil <$> text ""
<|> cons <$> x <*> many (sep *> x) | 140 | sepBy :: Syntax delta => delta alpha -> delta () -> delta [alpha]
sepBy x sep
= nil <$> text ""
<|> cons <$> x <*> many (sep *> x) | 140 | sepBy x sep
= nil <$> text ""
<|> cons <$> x <*> many (sep *> x) | 74 | false | true | 3 | 9 | 39 | 81 | 38 | 43 | null | null |
ezyang/ghc | libraries/base/GHC/Conc/Sync.hs | bsd-3-clause | -- |Exception handling within STM actions.
catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a
catchSTM (STM m) handler = STM $ catchSTM# m handler'
where
handler' e = case fromException e of
Just e' -> unSTM (handler e')
Nothing -> raiseIO# e
-- | Low-level primitive on which 'always' and 'alwaysSucceeds' are built.
-- 'checkInv' differs from these in that,
--
-- 1. the invariant is not checked when 'checkInv' is called, only at the end of
-- this and subsequent transactions
-- 2. the invariant failure is indicated by raising an exception. | 605 | catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a
catchSTM (STM m) handler = STM $ catchSTM# m handler'
where
handler' e = case fromException e of
Just e' -> unSTM (handler e')
Nothing -> raiseIO# e
-- | Low-level primitive on which 'always' and 'alwaysSucceeds' are built.
-- 'checkInv' differs from these in that,
--
-- 1. the invariant is not checked when 'checkInv' is called, only at the end of
-- this and subsequent transactions
-- 2. the invariant failure is indicated by raising an exception. | 562 | catchSTM (STM m) handler = STM $ catchSTM# m handler'
where
handler' e = case fromException e of
Just e' -> unSTM (handler e')
Nothing -> raiseIO# e
-- | Low-level primitive on which 'always' and 'alwaysSucceeds' are built.
-- 'checkInv' differs from these in that,
--
-- 1. the invariant is not checked when 'checkInv' is called, only at the end of
-- this and subsequent transactions
-- 2. the invariant failure is indicated by raising an exception. | 504 | true | true | 0 | 10 | 152 | 114 | 56 | 58 | null | null |
brendanhay/gogol | gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs | mpl-2.0 | -- | [Output-only] Detailed statistics for DML statements Present only for
-- DML statements INSERT, UPDATE, DELETE or TRUNCATE.
qDmlStats :: Lens' QueryResponse (Maybe DmlStatistics)
qDmlStats
= lens _qDmlStats (\ s a -> s{_qDmlStats = a}) | 242 | qDmlStats :: Lens' QueryResponse (Maybe DmlStatistics)
qDmlStats
= lens _qDmlStats (\ s a -> s{_qDmlStats = a}) | 113 | qDmlStats
= lens _qDmlStats (\ s a -> s{_qDmlStats = a}) | 58 | true | true | 0 | 9 | 37 | 49 | 26 | 23 | null | null |
eltongo/unicorn | bindings/haskell/samples/Shellcode.hs | gpl-2.0 | -- Calculate code length
codeLength :: Num a => BS.ByteString -> a
codeLength =
fromIntegral . BS.length | 108 | codeLength :: Num a => BS.ByteString -> a
codeLength =
fromIntegral . BS.length | 83 | codeLength =
fromIntegral . BS.length | 41 | true | true | 0 | 7 | 20 | 31 | 16 | 15 | null | null |
GaloisInc/halvm-ghc | compiler/main/DynFlags.hs | bsd-3-clause | programName :: DynFlags -> String
programName dflags = sProgramName (settings dflags) | 85 | programName :: DynFlags -> String
programName dflags = sProgramName (settings dflags) | 85 | programName dflags = sProgramName (settings dflags) | 51 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
graninas/Haskell-Algorithms | Tests/Robotics/Task2.hs | gpl-3.0 | foldSuccesses (B d branches) = case folded branches of
[] -> []
sucPaths -> map (d:) sucPaths
where
folded :: [SolutionTree] -> Paths
folded [] = []
folded bs = concat $ map foldSuccesses bs
-- �������� ���������� ������� ��� ������� n | 266 | foldSuccesses (B d branches) = case folded branches of
[] -> []
sucPaths -> map (d:) sucPaths
where
folded :: [SolutionTree] -> Paths
folded [] = []
folded bs = concat $ map foldSuccesses bs
-- �������� ���������� ������� ��� ������� n | 266 | foldSuccesses (B d branches) = case folded branches of
[] -> []
sucPaths -> map (d:) sucPaths
where
folded :: [SolutionTree] -> Paths
folded [] = []
folded bs = concat $ map foldSuccesses bs
-- �������� ���������� ������� ��� ������� n | 266 | false | false | 0 | 9 | 72 | 94 | 47 | 47 | null | null |
google/hs-batching | src/Control/Batching.hs | apache-2.0 | request :: rq -> Batching rq rs rs
request rq = Batching $ \k n g !rqs -> k
(sintVal `addSInt` n)
-- Consume our response off the front of the VecView and pass it to the
-- result function.
(\rss -> let !(rs, rss') = uncons rss in g rss' rs)
-- Add our request to the front of the VecBuilder.
(rq `cons` rqs) | 320 | request :: rq -> Batching rq rs rs
request rq = Batching $ \k n g !rqs -> k
(sintVal `addSInt` n)
-- Consume our response off the front of the VecView and pass it to the
-- result function.
(\rss -> let !(rs, rss') = uncons rss in g rss' rs)
-- Add our request to the front of the VecBuilder.
(rq `cons` rqs) | 320 | request rq = Batching $ \k n g !rqs -> k
(sintVal `addSInt` n)
-- Consume our response off the front of the VecView and pass it to the
-- result function.
(\rss -> let !(rs, rss') = uncons rss in g rss' rs)
-- Add our request to the front of the VecBuilder.
(rq `cons` rqs) | 285 | false | true | 0 | 12 | 76 | 111 | 56 | 55 | null | null |
robstewart57/stack | src/System/Process/PagerEditor.hs | bsd-3-clause | -- | Run pager to display contents of a file.
pageFile :: FilePath -> IO ()
pageFile p = pageByteString =<< Data.ByteString.Lazy.readFile p | 139 | pageFile :: FilePath -> IO ()
pageFile p = pageByteString =<< Data.ByteString.Lazy.readFile p | 93 | pageFile p = pageByteString =<< Data.ByteString.Lazy.readFile p | 63 | true | true | 0 | 7 | 22 | 35 | 18 | 17 | null | null |
Teaspot-Studio/gore-and-ash-network | src/Game/GoreAndAsh/Network/Backend/TCP.hs | bsd-3-clause | registerConnection :: BackendRegistry -> ConnectionId -> TCPPeer -> IO ()
registerConnection BackendRegistry{..} cid peer =
atomicModifyIORef' serverPeers $ \m -> (M.insert cid peer m, ()) | 190 | registerConnection :: BackendRegistry -> ConnectionId -> TCPPeer -> IO ()
registerConnection BackendRegistry{..} cid peer =
atomicModifyIORef' serverPeers $ \m -> (M.insert cid peer m, ()) | 190 | registerConnection BackendRegistry{..} cid peer =
atomicModifyIORef' serverPeers $ \m -> (M.insert cid peer m, ()) | 116 | false | true | 0 | 9 | 26 | 70 | 35 | 35 | null | null |
jailson-dias/Arca | src/Main.hs | bsd-3-clause | escolhaNivel :: IORef Nivel -> IORef ConfiguracaoNivel -> IO()
escolhaNivel nivelJogo configuracaoNivel = do
nivel <- get nivelJogo
case nivel of
'1' -> do
nivelJogo $= nivel
putStrLn("Nível escolhido: " ++ show nivel)
configuracaoNivel $= (40, 65, 89, 97, 100) --porcentagem somada uma a uma até 100%
return()
'2' -> do
nivelJogo $= nivel
putStrLn("Nível escolhido: " ++ show nivel)
configuracaoNivel $= (30, 58, 82, 90, 100)
return()
'3' -> do
nivelJogo $= nivel
putStrLn("Nível escolhido: " ++ show nivel)
configuracaoNivel $= (15, 35, 60, 80, 100)
return()
x | x >= ' ' -> do
escolhaNivel nivelJogo configuracaoNivel
_ -> do
putStrLn("Nível escolhido inválido.")
escolhaNivel nivelJogo configuracaoNivel
-- Alterar a cor de uma casa no mapa | 996 | escolhaNivel :: IORef Nivel -> IORef ConfiguracaoNivel -> IO()
escolhaNivel nivelJogo configuracaoNivel = do
nivel <- get nivelJogo
case nivel of
'1' -> do
nivelJogo $= nivel
putStrLn("Nível escolhido: " ++ show nivel)
configuracaoNivel $= (40, 65, 89, 97, 100) --porcentagem somada uma a uma até 100%
return()
'2' -> do
nivelJogo $= nivel
putStrLn("Nível escolhido: " ++ show nivel)
configuracaoNivel $= (30, 58, 82, 90, 100)
return()
'3' -> do
nivelJogo $= nivel
putStrLn("Nível escolhido: " ++ show nivel)
configuracaoNivel $= (15, 35, 60, 80, 100)
return()
x | x >= ' ' -> do
escolhaNivel nivelJogo configuracaoNivel
_ -> do
putStrLn("Nível escolhido inválido.")
escolhaNivel nivelJogo configuracaoNivel
-- Alterar a cor de uma casa no mapa | 996 | escolhaNivel nivelJogo configuracaoNivel = do
nivel <- get nivelJogo
case nivel of
'1' -> do
nivelJogo $= nivel
putStrLn("Nível escolhido: " ++ show nivel)
configuracaoNivel $= (40, 65, 89, 97, 100) --porcentagem somada uma a uma até 100%
return()
'2' -> do
nivelJogo $= nivel
putStrLn("Nível escolhido: " ++ show nivel)
configuracaoNivel $= (30, 58, 82, 90, 100)
return()
'3' -> do
nivelJogo $= nivel
putStrLn("Nível escolhido: " ++ show nivel)
configuracaoNivel $= (15, 35, 60, 80, 100)
return()
x | x >= ' ' -> do
escolhaNivel nivelJogo configuracaoNivel
_ -> do
putStrLn("Nível escolhido inválido.")
escolhaNivel nivelJogo configuracaoNivel
-- Alterar a cor de uma casa no mapa | 933 | false | true | 0 | 15 | 368 | 278 | 132 | 146 | null | null |
basvandijk/usb-safe | System/USB/Safe.hs | bsd-3-clause | useActiveAlternate ∷ ∀ pr cr s sCfg α
. (pr `AncestorRegion` RegionT s cr, RegionControlIO cr)
⇒ RegionalInterfaceHandle sCfg pr -- ^ Regional handle to the
-- interface from which you want
-- to use the active alternate.
→ (∀ sAlt. AlternateHandle sAlt pr → RegionT s cr α) -- ^ Continuation function.
→ RegionT s cr α
useActiveAlternate (RegionalInterfaceHandle (Interface internalDevHndl ifNum alts)
mv _
) f =
unsafeControlIO $ \runInIO → withSettedMVar mv $ do
let timeout = 5000 -- ms
activeAltValue ← USB.getInterfaceAltSetting internalDevHndl
ifNum
timeout
let activeAltHandle = AlternateHandle internalDevHndl activeAlt
activeAlt = fromJust $ find isActive alts
isActive = (activeAltValue ≡) ∘ USB.interfaceAltSetting
runInIO $ f activeAltHandle
{-| Convenience function which finds the first alternate of the given interface
handle which satisfies the given predicate on its descriptor, then sets that
alternate and applies the given function to the resulting alternate handle.
This function calls 'setAlternate' so do see its documentation.
Exceptions:
* 'USB.NotFoundException' if no alternate is found that satisfies the given
predicate.
* 'USB.NoDeviceException' if the device has been disconnected.
* 'SettingAlreadySet' if an alternate has already been set using
'setAlternate', 'useActiveAlternate' or 'setAlternateWhich'.
* Another 'USB.USBException'.
-} | 1,773 | useActiveAlternate ∷ ∀ pr cr s sCfg α
. (pr `AncestorRegion` RegionT s cr, RegionControlIO cr)
⇒ RegionalInterfaceHandle sCfg pr -- ^ Regional handle to the
-- interface from which you want
-- to use the active alternate.
→ (∀ sAlt. AlternateHandle sAlt pr → RegionT s cr α) -- ^ Continuation function.
→ RegionT s cr α
useActiveAlternate (RegionalInterfaceHandle (Interface internalDevHndl ifNum alts)
mv _
) f =
unsafeControlIO $ \runInIO → withSettedMVar mv $ do
let timeout = 5000 -- ms
activeAltValue ← USB.getInterfaceAltSetting internalDevHndl
ifNum
timeout
let activeAltHandle = AlternateHandle internalDevHndl activeAlt
activeAlt = fromJust $ find isActive alts
isActive = (activeAltValue ≡) ∘ USB.interfaceAltSetting
runInIO $ f activeAltHandle
{-| Convenience function which finds the first alternate of the given interface
handle which satisfies the given predicate on its descriptor, then sets that
alternate and applies the given function to the resulting alternate handle.
This function calls 'setAlternate' so do see its documentation.
Exceptions:
* 'USB.NotFoundException' if no alternate is found that satisfies the given
predicate.
* 'USB.NoDeviceException' if the device has been disconnected.
* 'SettingAlreadySet' if an alternate has already been set using
'setAlternate', 'useActiveAlternate' or 'setAlternateWhich'.
* Another 'USB.USBException'.
-} | 1,773 | useActiveAlternate (RegionalInterfaceHandle (Interface internalDevHndl ifNum alts)
mv _
) f =
unsafeControlIO $ \runInIO → withSettedMVar mv $ do
let timeout = 5000 -- ms
activeAltValue ← USB.getInterfaceAltSetting internalDevHndl
ifNum
timeout
let activeAltHandle = AlternateHandle internalDevHndl activeAlt
activeAlt = fromJust $ find isActive alts
isActive = (activeAltValue ≡) ∘ USB.interfaceAltSetting
runInIO $ f activeAltHandle
{-| Convenience function which finds the first alternate of the given interface
handle which satisfies the given predicate on its descriptor, then sets that
alternate and applies the given function to the resulting alternate handle.
This function calls 'setAlternate' so do see its documentation.
Exceptions:
* 'USB.NotFoundException' if no alternate is found that satisfies the given
predicate.
* 'USB.NoDeviceException' if the device has been disconnected.
* 'SettingAlreadySet' if an alternate has already been set using
'setAlternate', 'useActiveAlternate' or 'setAlternateWhich'.
* Another 'USB.USBException'.
-} | 1,281 | false | true | 2 | 14 | 595 | 220 | 111 | 109 | null | null |
michaxm/packman-exploration | app/BasicExample.hs | bsd-3-clause | wrapToBinary :: (Typeable a) => a -> IO L.ByteString
wrapToBinary a = trySerialize a >>= return . encode | 104 | wrapToBinary :: (Typeable a) => a -> IO L.ByteString
wrapToBinary a = trySerialize a >>= return . encode | 104 | wrapToBinary a = trySerialize a >>= return . encode | 51 | false | true | 0 | 9 | 17 | 48 | 22 | 26 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'VUM.length'
vum_length = VUM.length | 40 | vum_length = VUM.length | 23 | vum_length = VUM.length | 23 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
Concelo/concelo | src/Data/Tree/RBTree.hs | bsd-3-clause | -- no such parent, return a empty zip
-- |find predecessor of a node/leaf.
predZip :: RBZip a -> RBZip a
predZip (RBZip (Node c v l@(Node _ _ _ _) r) path) = rightMostZip (RBZip l ((Step c v ToLeft r):path)) | 208 | predZip :: RBZip a -> RBZip a
predZip (RBZip (Node c v l@(Node _ _ _ _) r) path) = rightMostZip (RBZip l ((Step c v ToLeft r):path)) | 132 | predZip (RBZip (Node c v l@(Node _ _ _ _) r) path) = rightMostZip (RBZip l ((Step c v ToLeft r):path)) | 102 | true | true | 0 | 12 | 42 | 91 | 46 | 45 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/enumFrom_2.hs | mit | enumFromMyBool :: MyBool -> (List MyBool)
enumFromMyBool x = enumFromToMyBool x MyTrue | 88 | enumFromMyBool :: MyBool -> (List MyBool)
enumFromMyBool x = enumFromToMyBool x MyTrue | 88 | enumFromMyBool x = enumFromToMyBool x MyTrue | 44 | false | true | 0 | 9 | 13 | 34 | 15 | 19 | null | null |
lamefun/haddock | haddock-api/src/Haddock/Interface/AttachInstances.hs | bsd-2-clause | argCount :: Type -> Int
argCount (AppTy t _) = argCount t + 1 | 61 | argCount :: Type -> Int
argCount (AppTy t _) = argCount t + 1 | 61 | argCount (AppTy t _) = argCount t + 1 | 37 | false | true | 0 | 6 | 13 | 37 | 17 | 20 | null | null |
sdiehl/ghc | hadrian/src/Packages.hs | bsd-3-clause | rtsContext :: Stage -> Context
rtsContext stage = vanillaContext stage rts | 74 | rtsContext :: Stage -> Context
rtsContext stage = vanillaContext stage rts | 74 | rtsContext stage = vanillaContext stage rts | 43 | false | true | 0 | 7 | 10 | 28 | 12 | 16 | null | null |
seereason/HJScript | src/HJScript/DOM/Window.hs | bsd-3-clause | defaultStatus :: Exp Window -> JString
defaultStatus = deref "defaultStatus" | 77 | defaultStatus :: Exp Window -> JString
defaultStatus = deref "defaultStatus" | 76 | defaultStatus = deref "defaultStatus" | 37 | false | true | 0 | 6 | 10 | 21 | 10 | 11 | null | null |
sonyandy/unvar | src/UnVar.hs | bsd-3-clause | runQueryM :: QueryM a -> CoreM (a, UniqFM MutVarDeps, UniqSet CoreBndr)
runQueryM m = do
(a, S deps captured) <- runStateT m (S emptyUFM emptyUniqSet)
return (a, deps, captured) | 181 | runQueryM :: QueryM a -> CoreM (a, UniqFM MutVarDeps, UniqSet CoreBndr)
runQueryM m = do
(a, S deps captured) <- runStateT m (S emptyUFM emptyUniqSet)
return (a, deps, captured) | 181 | runQueryM m = do
(a, S deps captured) <- runStateT m (S emptyUFM emptyUniqSet)
return (a, deps, captured) | 109 | false | true | 0 | 10 | 32 | 85 | 42 | 43 | null | null |
kikofernandez/kikofernandez.github.io | files/monadic-typechecker/typechecker/src/PhantomFunctors/AST.hs | mit | isFieldAccess _ = False | 23 | isFieldAccess _ = False | 23 | isFieldAccess _ = False | 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
iu-parfunc/containers | Data/Sequence.hs | bsd-3-clause | addDigits1 m1 (Two a b) c (Two d e) m2 =
appendTree2 m1 (node3 a b c) (node2 d e) m2 | 88 | addDigits1 m1 (Two a b) c (Two d e) m2 =
appendTree2 m1 (node3 a b c) (node2 d e) m2 | 88 | addDigits1 m1 (Two a b) c (Two d e) m2 =
appendTree2 m1 (node3 a b c) (node2 d e) m2 | 88 | false | false | 0 | 7 | 24 | 60 | 29 | 31 | null | null |
codygman/frames-diff | Frames/Time/Chicago/TimeIn.hs | bsd-3-clause | formats = ["%F %T", "%F", "%F %T", "%F %T %z %Z"] | 49 | formats = ["%F %T", "%F", "%F %T", "%F %T %z %Z"] | 49 | formats = ["%F %T", "%F", "%F %T", "%F %T %z %Z"] | 49 | false | false | 1 | 5 | 10 | 21 | 11 | 10 | null | null |
patrickherrmann/advent | src/Day13.hs | bsd-3-clause | addPat :: Graph -> Graph
addPat (Graph ns es) = Graph (pat:ns) es'
where
newEs n = [((pat, n), 0), ((n, pat), 0)]
es' = es `Map.union` Map.fromList (ns >>= newEs)
pat = "Pat" | 188 | addPat :: Graph -> Graph
addPat (Graph ns es) = Graph (pat:ns) es'
where
newEs n = [((pat, n), 0), ((n, pat), 0)]
es' = es `Map.union` Map.fromList (ns >>= newEs)
pat = "Pat" | 188 | addPat (Graph ns es) = Graph (pat:ns) es'
where
newEs n = [((pat, n), 0), ((n, pat), 0)]
es' = es `Map.union` Map.fromList (ns >>= newEs)
pat = "Pat" | 163 | false | true | 3 | 9 | 47 | 127 | 63 | 64 | null | null |
kadena-io/pact | src/Pact/Eval.hs | bsd-3-clause | eval' :: Term Name -> Eval e (Term Name)
eval' (TUse u@Use{..} i) = topLevelCall i "use" (GUse _uModuleName _uModuleHash) $ \g ->
evalUse u >> return (g,tStr $ renderCompactText' $ "Using " <> pretty _uModuleName) | 217 | eval' :: Term Name -> Eval e (Term Name)
eval' (TUse u@Use{..} i) = topLevelCall i "use" (GUse _uModuleName _uModuleHash) $ \g ->
evalUse u >> return (g,tStr $ renderCompactText' $ "Using " <> pretty _uModuleName) | 217 | eval' (TUse u@Use{..} i) = topLevelCall i "use" (GUse _uModuleName _uModuleHash) $ \g ->
evalUse u >> return (g,tStr $ renderCompactText' $ "Using " <> pretty _uModuleName) | 174 | false | true | 0 | 12 | 39 | 108 | 52 | 56 | null | null |
elieux/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | tagToEnum_RDR = getRdrName (primOpId TagToEnumOp) | 49 | tagToEnum_RDR = getRdrName (primOpId TagToEnumOp) | 49 | tagToEnum_RDR = getRdrName (primOpId TagToEnumOp) | 49 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
xmonad/xmonad | src/XMonad/Operations.hs | bsd-3-clause | setTopFocus :: X ()
setTopFocus = withWindowSet $ maybe (setFocusX =<< asks theRoot) setFocusX . W.peek | 103 | setTopFocus :: X ()
setTopFocus = withWindowSet $ maybe (setFocusX =<< asks theRoot) setFocusX . W.peek | 103 | setTopFocus = withWindowSet $ maybe (setFocusX =<< asks theRoot) setFocusX . W.peek | 83 | false | true | 0 | 10 | 15 | 41 | 20 | 21 | null | null |
asi1024/WXCS | src/OnlineJudge/Aoj.hs | mit | mkQuery :: ByteString -> ByteString -> ByteString -> ByteString -> ByteString
-> [(ByteString, ByteString)]
mkQuery user pass pid lang src =
[("userID" , user),
("password" , pass),
("language" , lang),
("problemNO" , pid),
("sourceCode", src)] | 274 | mkQuery :: ByteString -> ByteString -> ByteString -> ByteString -> ByteString
-> [(ByteString, ByteString)]
mkQuery user pass pid lang src =
[("userID" , user),
("password" , pass),
("language" , lang),
("problemNO" , pid),
("sourceCode", src)] | 274 | mkQuery user pass pid lang src =
[("userID" , user),
("password" , pass),
("language" , lang),
("problemNO" , pid),
("sourceCode", src)] | 155 | false | true | 0 | 11 | 64 | 96 | 57 | 39 | null | null |
rickerbh/GenerativeArtHaskell | GenerativeArt.hsproj/GenerativeArtC3.hs | mit | line3 = renderDrawing width height background $
withTexture (uniformTexture lineStroke) $
mergeStrokes strokes3 | 133 | line3 = renderDrawing width height background $
withTexture (uniformTexture lineStroke) $
mergeStrokes strokes3 | 133 | line3 = renderDrawing width height background $
withTexture (uniformTexture lineStroke) $
mergeStrokes strokes3 | 133 | false | false | 1 | 7 | 34 | 38 | 15 | 23 | null | null |
google/codeworld | codeworld-compiler/test/testcases/functionReturningFunction/source.hs | apache-2.0 | program = drawingOf (blank) | 27 | program = drawingOf (blank) | 27 | program = drawingOf (blank) | 27 | false | false | 0 | 6 | 3 | 12 | 6 | 6 | null | null |
tsiliakis/xmobar | src/Window.hs | bsd-3-clause | getStrutValues :: Rectangle -> XPosition -> Int -> [Int]
getStrutValues r@(Rectangle x y w h) p rwh =
case p of
OnScreen _ p' -> getStrutValues r p' rwh
Top -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopP _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopW _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopSize {} -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
Bottom -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomP _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomW _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomSize {} -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
Static {} -> getStaticStrutValues p rwh
where st = fi y + fi h
sb = rwh - fi y
nx = fi x
nw = fi (x + fi w - 1)
-- get some reaonable strut values for static placement. | 894 | getStrutValues :: Rectangle -> XPosition -> Int -> [Int]
getStrutValues r@(Rectangle x y w h) p rwh =
case p of
OnScreen _ p' -> getStrutValues r p' rwh
Top -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopP _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopW _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopSize {} -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
Bottom -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomP _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomW _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomSize {} -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
Static {} -> getStaticStrutValues p rwh
where st = fi y + fi h
sb = rwh - fi y
nx = fi x
nw = fi (x + fi w - 1)
-- get some reaonable strut values for static placement. | 894 | getStrutValues r@(Rectangle x y w h) p rwh =
case p of
OnScreen _ p' -> getStrutValues r p' rwh
Top -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopP _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopW _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopSize {} -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
Bottom -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomP _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomW _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomSize {} -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
Static {} -> getStaticStrutValues p rwh
where st = fi y + fi h
sb = rwh - fi y
nx = fi x
nw = fi (x + fi w - 1)
-- get some reaonable strut values for static placement. | 837 | false | true | 7 | 11 | 343 | 531 | 301 | 230 | null | null |
rahulmutt/ghcvm | compiler/Eta/Utils/Digraph.hs | bsd-3-clause | transpose :: IntGraph -> IntGraph
transpose g = buildG (bounds g) (reverseE g) | 79 | transpose :: IntGraph -> IntGraph
transpose g = buildG (bounds g) (reverseE g) | 79 | transpose g = buildG (bounds g) (reverseE g) | 44 | false | true | 0 | 7 | 13 | 41 | 18 | 23 | null | null |
jtdaugherty/mix-assembler | src/MIX/Assembler.hs | bsd-3-clause | assembleStatement (S.End ms wv) = do
registerSym ms =<< getPc
a <- startAddr <$> get
v <- evalWValue wv
case a of
Just x -> err ("Start address already declared to be " ++ show x)
Nothing -> do
let mx = (1 `shiftL` (fromEnum $ 2 * S.bitsPerByte)) - 1
when (S.wordToInteger v > mx) $
err $ "END argument exceeds two-byte maximum (max value " ++ show mx ++ ")"
modify $ \st -> st { startAddr = Just v } | 465 | assembleStatement (S.End ms wv) = do
registerSym ms =<< getPc
a <- startAddr <$> get
v <- evalWValue wv
case a of
Just x -> err ("Start address already declared to be " ++ show x)
Nothing -> do
let mx = (1 `shiftL` (fromEnum $ 2 * S.bitsPerByte)) - 1
when (S.wordToInteger v > mx) $
err $ "END argument exceeds two-byte maximum (max value " ++ show mx ++ ")"
modify $ \st -> st { startAddr = Just v } | 465 | assembleStatement (S.End ms wv) = do
registerSym ms =<< getPc
a <- startAddr <$> get
v <- evalWValue wv
case a of
Just x -> err ("Start address already declared to be " ++ show x)
Nothing -> do
let mx = (1 `shiftL` (fromEnum $ 2 * S.bitsPerByte)) - 1
when (S.wordToInteger v > mx) $
err $ "END argument exceeds two-byte maximum (max value " ++ show mx ++ ")"
modify $ \st -> st { startAddr = Just v } | 465 | false | false | 0 | 20 | 147 | 180 | 86 | 94 | null | null |
Hodapp87/ivory | ivory-eval/src/Ivory/Eval.hs | bsd-3-clause | evalOp I.ExpOr [x, y] = return (x `or` y) | 52 | evalOp I.ExpOr [x, y] = return (x `or` y) | 52 | evalOp I.ExpOr [x, y] = return (x `or` y) | 52 | false | false | 0 | 7 | 19 | 31 | 17 | 14 | null | null |
maarons/Cortex | Common/OptParse.hs | agpl-3.0 | makeSwitchString :: (MonadError String m) => [CmdSwitch] -> m String
makeSwitchString [] = throwError "Option with no switches." | 128 | makeSwitchString :: (MonadError String m) => [CmdSwitch] -> m String
makeSwitchString [] = throwError "Option with no switches." | 128 | makeSwitchString [] = throwError "Option with no switches." | 59 | false | true | 0 | 9 | 17 | 44 | 21 | 23 | null | null |
dolio/vector | old-testsuite/Testsuite/Vector/AsList.hs | bsd-3-clause | prop_prescanl = arg_ty (A :-> B :-> A)
V.prescanl ==? (\f z -> init . scanl f z) | 98 | prop_prescanl = arg_ty (A :-> B :-> A)
V.prescanl ==? (\f z -> init . scanl f z) | 98 | prop_prescanl = arg_ty (A :-> B :-> A)
V.prescanl ==? (\f z -> init . scanl f z) | 98 | false | false | 0 | 9 | 35 | 47 | 24 | 23 | null | null |
cblp/haskell-shell-experiment | src/Main.hs | bsd-3-clause | run1PipeInShell :: IO ()
run1PipeInShell = do let n = 1000000 :: Int
cmd = "seq 1 " <> show n <> " | wc -l"
result <- read . strip <$> run cmd
assertEqual "run1PipeInShell result" n result | 259 | run1PipeInShell :: IO ()
run1PipeInShell = do let n = 1000000 :: Int
cmd = "seq 1 " <> show n <> " | wc -l"
result <- read . strip <$> run cmd
assertEqual "run1PipeInShell result" n result | 259 | run1PipeInShell = do let n = 1000000 :: Int
cmd = "seq 1 " <> show n <> " | wc -l"
result <- read . strip <$> run cmd
assertEqual "run1PipeInShell result" n result | 234 | false | true | 1 | 12 | 109 | 73 | 34 | 39 | null | null |
paulbarbu/ePseudocode | src/EPseudocode/Builtins.hs | bsd-3-clause | strToInt :: [[Expr]] -> Error Expr
strToInt [[String arg]] = case listToMaybe (reads arg :: [(Integer, String)]) of
Nothing -> return $ Bool False
Just (parsed, remaining) ->
if remaining == ""
then return $ Int parsed
else return $ Bool False | 283 | strToInt :: [[Expr]] -> Error Expr
strToInt [[String arg]] = case listToMaybe (reads arg :: [(Integer, String)]) of
Nothing -> return $ Bool False
Just (parsed, remaining) ->
if remaining == ""
then return $ Int parsed
else return $ Bool False | 283 | strToInt [[String arg]] = case listToMaybe (reads arg :: [(Integer, String)]) of
Nothing -> return $ Bool False
Just (parsed, remaining) ->
if remaining == ""
then return $ Int parsed
else return $ Bool False | 248 | false | true | 0 | 10 | 81 | 119 | 61 | 58 | null | null |
brodyberg/Notes | csv/csv1/src/Prettify.hs | mit | pretty :: Int -> Doc -> String
pretty width x = best 0 [x]
where best col (d:ds) =
case d of
Empty -> best col ds
Char c -> c : best (col + 1) ds
Text s -> s ++ best (col + length s) ds
Line -> '\n' : best 0 ds
a `Concat` b -> best col (a:b:ds)
a `Union` b -> nicest col (best col (a:ds))
(best col (b:ds))
best _ _ = ""
nicest col a b | (width - least) `fits` a = a
| otherwise = b
where least = min width col | 681 | pretty :: Int -> Doc -> String
pretty width x = best 0 [x]
where best col (d:ds) =
case d of
Empty -> best col ds
Char c -> c : best (col + 1) ds
Text s -> s ++ best (col + length s) ds
Line -> '\n' : best 0 ds
a `Concat` b -> best col (a:b:ds)
a `Union` b -> nicest col (best col (a:ds))
(best col (b:ds))
best _ _ = ""
nicest col a b | (width - least) `fits` a = a
| otherwise = b
where least = min width col | 681 | pretty width x = best 0 [x]
where best col (d:ds) =
case d of
Empty -> best col ds
Char c -> c : best (col + 1) ds
Text s -> s ++ best (col + length s) ds
Line -> '\n' : best 0 ds
a `Concat` b -> best col (a:b:ds)
a `Union` b -> nicest col (best col (a:ds))
(best col (b:ds))
best _ _ = ""
nicest col a b | (width - least) `fits` a = a
| otherwise = b
where least = min width col | 650 | false | true | 5 | 14 | 371 | 278 | 139 | 139 | null | null |
rudymatela/llcheck | src/Test/LeanCheck/Function/ShowFunction.hs | bsd-3-clause | select _ [] = [] | 16 | select _ [] = [] | 16 | select _ [] = [] | 16 | false | false | 0 | 6 | 4 | 19 | 8 | 11 | null | null |
Concomitant/LambdaHack | GameDefinition/Content/ItemKind.hs | bsd-3-clause | _symbolClothes = '(' | 22 | _symbolClothes = '(' | 22 | _symbolClothes = '(' | 22 | false | false | 0 | 4 | 4 | 6 | 3 | 3 | null | null |
flipstone/orville | orville-postgresql-libpq/src/Orville/PostgreSQL/Plan/Operation.hs | mit | {- |
'findOneWhere' is similar to 'findOne' but allows a 'WhereCondition' to be
specified that is added to the database query to restrict which rows are
returned.
-}
findOneWhere ::
Ord param =>
TableDefinition.TableDefinition key writeEntity readEntity ->
WherePlanner param ->
SelectOptions.WhereCondition ->
Operation param (Maybe readEntity)
findOneWhere tableDef wherePlanner cond =
findOneWithOpts tableDef wherePlanner (SelectOptions.where_ cond) | 471 | findOneWhere ::
Ord param =>
TableDefinition.TableDefinition key writeEntity readEntity ->
WherePlanner param ->
SelectOptions.WhereCondition ->
Operation param (Maybe readEntity)
findOneWhere tableDef wherePlanner cond =
findOneWithOpts tableDef wherePlanner (SelectOptions.where_ cond) | 299 | findOneWhere tableDef wherePlanner cond =
findOneWithOpts tableDef wherePlanner (SelectOptions.where_ cond) | 109 | true | true | 0 | 11 | 74 | 78 | 37 | 41 | null | null |
databrary/databrary | src/Model/Permission.hs | agpl-3.0 | checkPermission
:: (a -> Permission) -- ^ Extract the object's permission rules
-> a -- ^ The object in question
-> Permission -- ^ The requested permission
-> PermissionResponse a
-- ^ The object decorated with the permission response
checkPermission getGrantedPerms obj requestedPerms =
case compare (getGrantedPerms obj) requestedPerms of
LT -> PermissionDenied
GT -> PermissionGranted obj
EQ -> PermissionGranted obj | 468 | checkPermission
:: (a -> Permission) -- ^ Extract the object's permission rules
-> a -- ^ The object in question
-> Permission -- ^ The requested permission
-> PermissionResponse a
checkPermission getGrantedPerms obj requestedPerms =
case compare (getGrantedPerms obj) requestedPerms of
LT -> PermissionDenied
GT -> PermissionGranted obj
EQ -> PermissionGranted obj | 409 | checkPermission getGrantedPerms obj requestedPerms =
case compare (getGrantedPerms obj) requestedPerms of
LT -> PermissionDenied
GT -> PermissionGranted obj
EQ -> PermissionGranted obj | 212 | true | true | 0 | 8 | 108 | 83 | 42 | 41 | null | null |
dimara/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | rapiGroup :: String
rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi) | 76 | rapiGroup :: String
rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi) | 76 | rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi) | 56 | false | true | 0 | 7 | 7 | 28 | 12 | 16 | null | null |
mcmaniac/ghc | compiler/cmm/CmmCommonBlockElim.hs | bsd-3-clause | eqMaybeWith :: (a -> b -> Bool) -> Maybe a -> Maybe b -> Bool
eqMaybeWith eltEq (Just e) (Just e') = eltEq e e' | 111 | eqMaybeWith :: (a -> b -> Bool) -> Maybe a -> Maybe b -> Bool
eqMaybeWith eltEq (Just e) (Just e') = eltEq e e' | 111 | eqMaybeWith eltEq (Just e) (Just e') = eltEq e e' | 49 | false | true | 0 | 11 | 24 | 69 | 32 | 37 | null | null |
karamellpelle/grid | source/Linear.hs | gpl-3.0 | -- | viewing the modelspace. 0 0 1 gives the identity matrix
mat4ViewABC :: Float -> Float -> Float -> Mat4
mat4ViewABC a b c =
let x0 = (c) * cos b * sin a
x1 = (-c) * sin b
x2 = (-c) * cos b * cos a
z0 = (-x2)
z1 = 0
z2 = x0
y0 = (-x1) * x0
y1 = x0 * x0 + x2 * x2
y2 = (-x1) * x2
xscale = scale x0 x1 x2
yscale = scale y0 y1 y2
zscale = scale z0 z1 z2
a0 = zscale * z0
a1 = zscale * z1
a2 = zscale * z2
b0 = yscale * y0
b1 = yscale * y1
b2 = yscale * y2
c0 = xscale * (-x0)
c1 = xscale * (-x1)
c2 = xscale * (-x2)
-- translate. inverse is transpose
tx = a0 * x0 + a1 * x1 + a2 * x2
ty = b0 * x0 + b1 * x1 + b2 * x2
tz = c0 * x0 + c1 * x1 + c2 * x2
-- inverse is transpose
in Mat4 a0 b0 c0 0
a1 b1 c1 0
a2 b2 c2 0
tx ty tz 1
where
scale x0 x1 x2 =
let abs = sqrt $ x0 * x0 + x1 * x1 + x2 * x2
in if abs == 0.0 then 0.0
else 1 / abs | 1,166 | mat4ViewABC :: Float -> Float -> Float -> Mat4
mat4ViewABC a b c =
let x0 = (c) * cos b * sin a
x1 = (-c) * sin b
x2 = (-c) * cos b * cos a
z0 = (-x2)
z1 = 0
z2 = x0
y0 = (-x1) * x0
y1 = x0 * x0 + x2 * x2
y2 = (-x1) * x2
xscale = scale x0 x1 x2
yscale = scale y0 y1 y2
zscale = scale z0 z1 z2
a0 = zscale * z0
a1 = zscale * z1
a2 = zscale * z2
b0 = yscale * y0
b1 = yscale * y1
b2 = yscale * y2
c0 = xscale * (-x0)
c1 = xscale * (-x1)
c2 = xscale * (-x2)
-- translate. inverse is transpose
tx = a0 * x0 + a1 * x1 + a2 * x2
ty = b0 * x0 + b1 * x1 + b2 * x2
tz = c0 * x0 + c1 * x1 + c2 * x2
-- inverse is transpose
in Mat4 a0 b0 c0 0
a1 b1 c1 0
a2 b2 c2 0
tx ty tz 1
where
scale x0 x1 x2 =
let abs = sqrt $ x0 * x0 + x1 * x1 + x2 * x2
in if abs == 0.0 then 0.0
else 1 / abs | 1,105 | mat4ViewABC a b c =
let x0 = (c) * cos b * sin a
x1 = (-c) * sin b
x2 = (-c) * cos b * cos a
z0 = (-x2)
z1 = 0
z2 = x0
y0 = (-x1) * x0
y1 = x0 * x0 + x2 * x2
y2 = (-x1) * x2
xscale = scale x0 x1 x2
yscale = scale y0 y1 y2
zscale = scale z0 z1 z2
a0 = zscale * z0
a1 = zscale * z1
a2 = zscale * z2
b0 = yscale * y0
b1 = yscale * y1
b2 = yscale * y2
c0 = xscale * (-x0)
c1 = xscale * (-x1)
c2 = xscale * (-x2)
-- translate. inverse is transpose
tx = a0 * x0 + a1 * x1 + a2 * x2
ty = b0 * x0 + b1 * x1 + b2 * x2
tz = c0 * x0 + c1 * x1 + c2 * x2
-- inverse is transpose
in Mat4 a0 b0 c0 0
a1 b1 c1 0
a2 b2 c2 0
tx ty tz 1
where
scale x0 x1 x2 =
let abs = sqrt $ x0 * x0 + x1 * x1 + x2 * x2
in if abs == 0.0 then 0.0
else 1 / abs | 1,058 | true | true | 0 | 14 | 574 | 473 | 249 | 224 | null | null |
haskoin/haskoin | src/Haskoin/Address.hs | unlicense | isWitnessAddress _ = False | 42 | isWitnessAddress _ = False | 42 | isWitnessAddress _ = False | 42 | false | false | 0 | 4 | 19 | 10 | 4 | 6 | null | null |
urbanslug/ghc | compiler/llvmGen/Llvm/PpLlvm.hs | bsd-3-clause | ppCast :: LlvmCastOp -> LlvmVar -> LlvmType -> SDoc
ppCast op from to
= ppr op
<+> ppr (getVarType from) <+> ppName from
<+> text "to"
<+> ppr to | 166 | ppCast :: LlvmCastOp -> LlvmVar -> LlvmType -> SDoc
ppCast op from to
= ppr op
<+> ppr (getVarType from) <+> ppName from
<+> text "to"
<+> ppr to | 166 | ppCast op from to
= ppr op
<+> ppr (getVarType from) <+> ppName from
<+> text "to"
<+> ppr to | 114 | false | true | 8 | 9 | 49 | 77 | 32 | 45 | null | null |
NickAger/LearningHaskell | ParallelConcurrent/2-BankAccount.hsproj/Account5.hs | mit | launchMissiles :: IO ()
launchMissiles = hPutStr stdout "Zzzing!" | 65 | launchMissiles :: IO ()
launchMissiles = hPutStr stdout "Zzzing!" | 65 | launchMissiles = hPutStr stdout "Zzzing!" | 41 | false | true | 0 | 6 | 8 | 21 | 10 | 11 | null | null |
ku-fpg/blank-canvas | wiki-suite/Circle.hs | bsd-3-clause | -- (578,200)
main :: IO ()
main = blankCanvas 3000 $ \ context -> do
send context $ do
let centerX = width context / 2
let centerY = height context / 2
let radius = 70
beginPath()
arc(centerX, centerY, radius, 0, 2 * pi, False)
fillStyle "#8ED6FF"
fill()
lineWidth 5
strokeStyle "black"
stroke()
wiki $ snapShot context "images/Circle.png"
wiki $ close context | 457 | main :: IO ()
main = blankCanvas 3000 $ \ context -> do
send context $ do
let centerX = width context / 2
let centerY = height context / 2
let radius = 70
beginPath()
arc(centerX, centerY, radius, 0, 2 * pi, False)
fillStyle "#8ED6FF"
fill()
lineWidth 5
strokeStyle "black"
stroke()
wiki $ snapShot context "images/Circle.png"
wiki $ close context | 443 | main = blankCanvas 3000 $ \ context -> do
send context $ do
let centerX = width context / 2
let centerY = height context / 2
let radius = 70
beginPath()
arc(centerX, centerY, radius, 0, 2 * pi, False)
fillStyle "#8ED6FF"
fill()
lineWidth 5
strokeStyle "black"
stroke()
wiki $ snapShot context "images/Circle.png"
wiki $ close context | 429 | true | true | 2 | 16 | 159 | 179 | 78 | 101 | null | null |
hspec/hspec-wai | src/Test/Hspec/Wai/Internal.hs | mit | getApp :: WaiSession st Application
getApp = WaiSession (lift ask) | 66 | getApp :: WaiSession st Application
getApp = WaiSession (lift ask) | 66 | getApp = WaiSession (lift ask) | 30 | false | true | 1 | 7 | 9 | 28 | 12 | 16 | null | null |
sampou-org/pfad | Code/Code19.hs | bsd-3-clause | group xs = take 3 xs : group (drop 3 xs) | 43 | group xs = take 3 xs : group (drop 3 xs) | 43 | group xs = take 3 xs : group (drop 3 xs) | 43 | false | false | 0 | 8 | 13 | 29 | 13 | 16 | null | null |
Proclivis/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_METAPOST_TEXT :: Int
wxSTC_METAPOST_TEXT = 5 | 50 | wxSTC_METAPOST_TEXT :: Int
wxSTC_METAPOST_TEXT = 5 | 50 | wxSTC_METAPOST_TEXT = 5 | 23 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
UCSD-PL/RefScript | src/Language/Rsc/Errors.hs | bsd-3-clause | errorTAliasMismatch l t a = mkErr l $ text $ printf "Invalid type alias application %s : Cannot convert %s into value argument" (ppshow t) (ppshow a) | 153 | errorTAliasMismatch l t a = mkErr l $ text $ printf "Invalid type alias application %s : Cannot convert %s into value argument" (ppshow t) (ppshow a) | 153 | errorTAliasMismatch l t a = mkErr l $ text $ printf "Invalid type alias application %s : Cannot convert %s into value argument" (ppshow t) (ppshow a) | 153 | false | false | 0 | 8 | 30 | 43 | 20 | 23 | null | null |
TomMD/cryptol | cryptol/REPL/Command.hs | bsd-3-clause | handleCtrlC :: REPL ()
handleCtrlC = io (putStrLn "Ctrl-C") | 60 | handleCtrlC :: REPL ()
handleCtrlC = io (putStrLn "Ctrl-C") | 60 | handleCtrlC = io (putStrLn "Ctrl-C") | 37 | false | true | 0 | 7 | 9 | 25 | 12 | 13 | null | null |
tjakway/ghcjvm | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | -- | Get the equality relation relevant for a 'CtEvidence'
ctEvEqRel :: CtEvidence -> EqRel
ctEvEqRel = predTypeEqRel . ctEvPred | 128 | ctEvEqRel :: CtEvidence -> EqRel
ctEvEqRel = predTypeEqRel . ctEvPred | 69 | ctEvEqRel = predTypeEqRel . ctEvPred | 36 | true | true | 1 | 7 | 19 | 28 | 12 | 16 | null | null |
brendanhay/gogol | gogol-sheets/gen/Network/Google/Resource/Sheets/Spreadsheets/DeveloperMetadata/Get.hs | mpl-2.0 | -- | V1 error format.
sdmgXgafv :: Lens' SpreadsheetsDeveloperMetadataGet (Maybe Xgafv)
sdmgXgafv
= lens _sdmgXgafv (\ s a -> s{_sdmgXgafv = a}) | 146 | sdmgXgafv :: Lens' SpreadsheetsDeveloperMetadataGet (Maybe Xgafv)
sdmgXgafv
= lens _sdmgXgafv (\ s a -> s{_sdmgXgafv = a}) | 124 | sdmgXgafv
= lens _sdmgXgafv (\ s a -> s{_sdmgXgafv = a}) | 58 | true | true | 1 | 9 | 23 | 52 | 25 | 27 | null | null |
thinkpad20/rowling | test/Language/Rowling/TypeLibSpec.hs | mit | fromStringSpec :: Spec
fromStringSpec = describe "fromstring" $ do
it "should wrap captalized strings in TConst" $ do
"Foo" `shouldBe` TConst "Foo"
it "should wrap lower-case or $ strings in TVar" $ do
"a" `shouldBe` TVar "a"
"$t12" `shouldBe` TVar "$t12"
it "should strip whitespace" $ do
" Foo " `shouldBe` TConst "Foo"
" bar" `shouldBe` TVar "bar" | 378 | fromStringSpec :: Spec
fromStringSpec = describe "fromstring" $ do
it "should wrap captalized strings in TConst" $ do
"Foo" `shouldBe` TConst "Foo"
it "should wrap lower-case or $ strings in TVar" $ do
"a" `shouldBe` TVar "a"
"$t12" `shouldBe` TVar "$t12"
it "should strip whitespace" $ do
" Foo " `shouldBe` TConst "Foo"
" bar" `shouldBe` TVar "bar" | 378 | fromStringSpec = describe "fromstring" $ do
it "should wrap captalized strings in TConst" $ do
"Foo" `shouldBe` TConst "Foo"
it "should wrap lower-case or $ strings in TVar" $ do
"a" `shouldBe` TVar "a"
"$t12" `shouldBe` TVar "$t12"
it "should strip whitespace" $ do
" Foo " `shouldBe` TConst "Foo"
" bar" `shouldBe` TVar "bar" | 355 | false | true | 0 | 13 | 85 | 115 | 52 | 63 | null | null |
buildsome/buildsome | src/Lib/Parallelism.hs | gpl-2.0 | assertPutMVar :: MVar a -> a -> IO ()
assertPutMVar mvar val =
do
True <- tryPutMVar mvar val
pure ()
-- runs under mask (non-blocking) | 156 | assertPutMVar :: MVar a -> a -> IO ()
assertPutMVar mvar val =
do
True <- tryPutMVar mvar val
pure ()
-- runs under mask (non-blocking) | 156 | assertPutMVar mvar val =
do
True <- tryPutMVar mvar val
pure ()
-- runs under mask (non-blocking) | 118 | false | true | 0 | 8 | 46 | 53 | 24 | 29 | null | null |
fluffynukeit/FNIStash | src/FNIStash/File/DAT.hs | bsd-3-clause | -- Extract the variable with the given VarID from the given DATNode
lkupVar :: VarID -> DATNode -> Maybe DATVar
lkupVar v d = snd <$> (find (\(id, var) -> id == v) $ datNodeVars d) | 180 | lkupVar :: VarID -> DATNode -> Maybe DATVar
lkupVar v d = snd <$> (find (\(id, var) -> id == v) $ datNodeVars d) | 112 | lkupVar v d = snd <$> (find (\(id, var) -> id == v) $ datNodeVars d) | 68 | true | true | 0 | 11 | 35 | 63 | 33 | 30 | null | null |
23Skidoo/ghc-parmake | src/GHC/ParMake/BuildPlan.hs | bsd-3-clause | size :: BuildPlan -> Int
size = (+) 1 . snd . Array.bounds . planGraphRev | 73 | size :: BuildPlan -> Int
size = (+) 1 . snd . Array.bounds . planGraphRev | 73 | size = (+) 1 . snd . Array.bounds . planGraphRev | 48 | false | true | 2 | 7 | 14 | 43 | 19 | 24 | null | null |
shlevy/ghc | compiler/nativeGen/X86/Regs.hs | bsd-3-clause | fake4 = regSingle 20 | 20 | fake4 = regSingle 20 | 20 | fake4 = regSingle 20 | 20 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
liamoc/dixi | Dixi/Database.hs | bsd-3-clause | getDiff :: Key -> (Version, Version) -> Query Database (Either DixiError (Page (P.Hunks Char)))
getDiff k (v1 , v2) | v1 > v2 = getDiff k (v2, v1)
| otherwise = runExceptT $ do
b <- view (db . ix k)
let latest = C.length b
when (latest < v1) $ throwE $ VersionNotFound k v1
when (latest < v2) $ throwE $ VersionNotFound k v2
let y = patchToVector (C.composed (C.take v1 b) ^. body)
return $ fmap (`P.hunks` y) (C.dropComposed v1 (C.take v2 b)) | 478 | getDiff :: Key -> (Version, Version) -> Query Database (Either DixiError (Page (P.Hunks Char)))
getDiff k (v1 , v2) | v1 > v2 = getDiff k (v2, v1)
| otherwise = runExceptT $ do
b <- view (db . ix k)
let latest = C.length b
when (latest < v1) $ throwE $ VersionNotFound k v1
when (latest < v2) $ throwE $ VersionNotFound k v2
let y = patchToVector (C.composed (C.take v1 b) ^. body)
return $ fmap (`P.hunks` y) (C.dropComposed v1 (C.take v2 b)) | 478 | getDiff k (v1 , v2) | v1 > v2 = getDiff k (v2, v1)
| otherwise = runExceptT $ do
b <- view (db . ix k)
let latest = C.length b
when (latest < v1) $ throwE $ VersionNotFound k v1
when (latest < v2) $ throwE $ VersionNotFound k v2
let y = patchToVector (C.composed (C.take v1 b) ^. body)
return $ fmap (`P.hunks` y) (C.dropComposed v1 (C.take v2 b)) | 382 | false | true | 1 | 18 | 120 | 260 | 126 | 134 | null | null |
rueshyna/gogol | gogol-genomics/gen/Network/Google/Genomics/Types/Product.hs | mpl-2.0 | -- | The range of the coding sequence for this transcript, if any. To
-- determine the exact ranges of coding sequence, intersect this range with
-- those of the exons, if any. If there are any exons, the codingSequence
-- must start and end within them. Note that in some cases, the reference
-- genome will not exactly match the observed mRNA transcript e.g. due to
-- variance in the source genome from reference. In these cases, exon.frame
-- will not necessarily match the expected reference reading frame and
-- coding exon reference bases cannot necessarily be concatenated to
-- produce the original transcript mRNA.
tCodingSequence :: Lens' Transcript (Maybe CodingSequence)
tCodingSequence
= lens _tCodingSequence
(\ s a -> s{_tCodingSequence = a}) | 766 | tCodingSequence :: Lens' Transcript (Maybe CodingSequence)
tCodingSequence
= lens _tCodingSequence
(\ s a -> s{_tCodingSequence = a}) | 141 | tCodingSequence
= lens _tCodingSequence
(\ s a -> s{_tCodingSequence = a}) | 82 | true | true | 0 | 9 | 130 | 56 | 33 | 23 | null | null |
alexbiehl/protocol-buffers | hprotoc/Text/ProtocolBuffers/ProtoCompile/Gen.hs | apache-2.0 | minimalImports :: [ImportDecl]
minimalImports =
[ ImportDecl src (ModuleName "Prelude") True False False Nothing (Just (ModuleName "Prelude'")) Nothing
, ImportDecl src (ModuleName "Data.Typeable") True False False Nothing (Just (ModuleName "Prelude'")) Nothing
, ImportDecl src (ModuleName "Data.Data") True False False Nothing (Just (ModuleName "Prelude'")) Nothing
, ImportDecl src (ModuleName "Text.ProtocolBuffers.Header") True False False Nothing (Just (ModuleName "P'")) Nothing ] | 495 | minimalImports :: [ImportDecl]
minimalImports =
[ ImportDecl src (ModuleName "Prelude") True False False Nothing (Just (ModuleName "Prelude'")) Nothing
, ImportDecl src (ModuleName "Data.Typeable") True False False Nothing (Just (ModuleName "Prelude'")) Nothing
, ImportDecl src (ModuleName "Data.Data") True False False Nothing (Just (ModuleName "Prelude'")) Nothing
, ImportDecl src (ModuleName "Text.ProtocolBuffers.Header") True False False Nothing (Just (ModuleName "P'")) Nothing ] | 495 | minimalImports =
[ ImportDecl src (ModuleName "Prelude") True False False Nothing (Just (ModuleName "Prelude'")) Nothing
, ImportDecl src (ModuleName "Data.Typeable") True False False Nothing (Just (ModuleName "Prelude'")) Nothing
, ImportDecl src (ModuleName "Data.Data") True False False Nothing (Just (ModuleName "Prelude'")) Nothing
, ImportDecl src (ModuleName "Text.ProtocolBuffers.Header") True False False Nothing (Just (ModuleName "P'")) Nothing ] | 464 | false | true | 0 | 10 | 65 | 166 | 84 | 82 | null | null |
DanielSchuessler/hstri | FaceClasses.hs | gpl-3.0 | edgesOfT :: TriangleLike t => t -> Triple (Ed t)
edgesOfT = edges | 65 | edgesOfT :: TriangleLike t => t -> Triple (Ed t)
edgesOfT = edges | 65 | edgesOfT = edges | 16 | false | true | 0 | 9 | 12 | 31 | 15 | 16 | null | null |
apyrgio/ganeti | src/Ganeti/WConfd/Monad.hs | bsd-2-clause | -- | Modify the configuration while temporarily acquiring
-- the configuration lock. If the configuration lock is held by
-- someone else, nothing is changed and Nothing is returned.
modifyConfigWithLock
:: (TempResState -> ConfigState -> AtomicModifyMonad ConfigState)
-> State TempResState ()
-> WConfdMonad (Maybe ())
modifyConfigWithLock f tempres = do
now <- liftIO getClockTime
dh <- lift . WConfdMonadInt $ ask
pid <- liftIO getProcessID
tid <- liftIO myThreadId
let cid = ClientId { ciIdentifier = ClientOther $ "wconfd-" ++ show tid
, ciLockFile = dhLivelock dh
, ciPid = pid
}
let modCS ds@(DaemonState { dsTempRes = tr }) =
mapMOf2
dsConfigStateL
(\cs -> liftM (unpackConfigResult now cs . (,) ()) (f tr cs))
ds
maybeDist <- bracket
(atomicModifyWithLens (dhDaemonState dh) dsLockWaitingL
$ swap . LW.updateLocks cid [LA.requestExclusive ConfigLock])
(\(res, _) -> case res of
Ok s | S.null s -> do
(_, nfy) <- atomicModifyWithLens (dhDaemonState dh) dsLockWaitingL
$ swap . LW.updateLocks cid [LA.requestRelease ConfigLock]
unless (S.null nfy) . liftIO . void . forkIO $ do
logDebug . (++) "Locks became available for " . show $ S.toList nfy
mapM_ (notifyJob . ciPid) $ S.toList nfy
logDebug "Finished notifying processes"
_ -> return ())
(\(res, _) -> case res of
Ok s | S.null s ->do
((), modif, dist) <- atomicModifyIORefErrLog (dhDaemonState dh)
(liftM swap . modCS)
atomicModifyWithLens (dhDaemonState dh) dsTempResL $ runState tempres
return $ Just (modif, dist)
_ -> return Nothing)
flip (maybe $ return Nothing) maybeDist $ \(modified, dist) -> do
when modified $ do
logDebug . (++) "Triggering config write; distribution "
$ if dist then "synchronously" else "asynchronously"
liftBase . triggerAndWait (Any dist) $ dhSaveConfigWorker dh
logDebug "Config write finished"
logDebug "Triggering temporary reservations write"
liftBase . triggerAndWait_ . dhSaveTempResWorker $ dh
logDebug "Temporary reservations write finished"
return $ Just () | 2,328 | modifyConfigWithLock
:: (TempResState -> ConfigState -> AtomicModifyMonad ConfigState)
-> State TempResState ()
-> WConfdMonad (Maybe ())
modifyConfigWithLock f tempres = do
now <- liftIO getClockTime
dh <- lift . WConfdMonadInt $ ask
pid <- liftIO getProcessID
tid <- liftIO myThreadId
let cid = ClientId { ciIdentifier = ClientOther $ "wconfd-" ++ show tid
, ciLockFile = dhLivelock dh
, ciPid = pid
}
let modCS ds@(DaemonState { dsTempRes = tr }) =
mapMOf2
dsConfigStateL
(\cs -> liftM (unpackConfigResult now cs . (,) ()) (f tr cs))
ds
maybeDist <- bracket
(atomicModifyWithLens (dhDaemonState dh) dsLockWaitingL
$ swap . LW.updateLocks cid [LA.requestExclusive ConfigLock])
(\(res, _) -> case res of
Ok s | S.null s -> do
(_, nfy) <- atomicModifyWithLens (dhDaemonState dh) dsLockWaitingL
$ swap . LW.updateLocks cid [LA.requestRelease ConfigLock]
unless (S.null nfy) . liftIO . void . forkIO $ do
logDebug . (++) "Locks became available for " . show $ S.toList nfy
mapM_ (notifyJob . ciPid) $ S.toList nfy
logDebug "Finished notifying processes"
_ -> return ())
(\(res, _) -> case res of
Ok s | S.null s ->do
((), modif, dist) <- atomicModifyIORefErrLog (dhDaemonState dh)
(liftM swap . modCS)
atomicModifyWithLens (dhDaemonState dh) dsTempResL $ runState tempres
return $ Just (modif, dist)
_ -> return Nothing)
flip (maybe $ return Nothing) maybeDist $ \(modified, dist) -> do
when modified $ do
logDebug . (++) "Triggering config write; distribution "
$ if dist then "synchronously" else "asynchronously"
liftBase . triggerAndWait (Any dist) $ dhSaveConfigWorker dh
logDebug "Config write finished"
logDebug "Triggering temporary reservations write"
liftBase . triggerAndWait_ . dhSaveTempResWorker $ dh
logDebug "Temporary reservations write finished"
return $ Just () | 2,145 | modifyConfigWithLock f tempres = do
now <- liftIO getClockTime
dh <- lift . WConfdMonadInt $ ask
pid <- liftIO getProcessID
tid <- liftIO myThreadId
let cid = ClientId { ciIdentifier = ClientOther $ "wconfd-" ++ show tid
, ciLockFile = dhLivelock dh
, ciPid = pid
}
let modCS ds@(DaemonState { dsTempRes = tr }) =
mapMOf2
dsConfigStateL
(\cs -> liftM (unpackConfigResult now cs . (,) ()) (f tr cs))
ds
maybeDist <- bracket
(atomicModifyWithLens (dhDaemonState dh) dsLockWaitingL
$ swap . LW.updateLocks cid [LA.requestExclusive ConfigLock])
(\(res, _) -> case res of
Ok s | S.null s -> do
(_, nfy) <- atomicModifyWithLens (dhDaemonState dh) dsLockWaitingL
$ swap . LW.updateLocks cid [LA.requestRelease ConfigLock]
unless (S.null nfy) . liftIO . void . forkIO $ do
logDebug . (++) "Locks became available for " . show $ S.toList nfy
mapM_ (notifyJob . ciPid) $ S.toList nfy
logDebug "Finished notifying processes"
_ -> return ())
(\(res, _) -> case res of
Ok s | S.null s ->do
((), modif, dist) <- atomicModifyIORefErrLog (dhDaemonState dh)
(liftM swap . modCS)
atomicModifyWithLens (dhDaemonState dh) dsTempResL $ runState tempres
return $ Just (modif, dist)
_ -> return Nothing)
flip (maybe $ return Nothing) maybeDist $ \(modified, dist) -> do
when modified $ do
logDebug . (++) "Triggering config write; distribution "
$ if dist then "synchronously" else "asynchronously"
liftBase . triggerAndWait (Any dist) $ dhSaveConfigWorker dh
logDebug "Config write finished"
logDebug "Triggering temporary reservations write"
liftBase . triggerAndWait_ . dhSaveTempResWorker $ dh
logDebug "Temporary reservations write finished"
return $ Just () | 1,995 | true | true | 0 | 24 | 664 | 715 | 342 | 373 | null | null |
danr/hipspec | examples/old-examples/hip/Ordinals.hs | gpl-3.0 | (%+) :: Ord -> Ord -> Ord
Zero %+ y = y | 40 | (%+) :: Ord -> Ord -> Ord
Zero %+ y = y | 40 | Zero %+ y = y | 14 | false | true | 0 | 6 | 12 | 27 | 14 | 13 | null | null |
romanb/bruce-protocol | src/Network/Bruce/Protocol.hs | mpl-2.0 | encodeKey Nothing = put (0 :: Int32) | 37 | encodeKey Nothing = put (0 :: Int32) | 37 | encodeKey Nothing = put (0 :: Int32) | 37 | false | false | 0 | 6 | 7 | 18 | 9 | 9 | null | null |
jutaro/rdf4h | testsuite/tests/Data/RDF/Graph/TriplesList_Test.hs | bsd-3-clause | uniqTriplesOf' :: TriplesList -> Triples
uniqTriplesOf' = uniqTriplesOf | 71 | uniqTriplesOf' :: TriplesList -> Triples
uniqTriplesOf' = uniqTriplesOf | 71 | uniqTriplesOf' = uniqTriplesOf | 30 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
supki/scrobblers | src/Control/Scrobbler/Network.hs | bsd-2-clause | -- | De'Serialize' datum after network transmission
deserialize :: (Serialize b, Monad m) => Scrobbler m ByteString b
deserialize = mkFix $ \_dt -> left NoDecoding . decode | 172 | deserialize :: (Serialize b, Monad m) => Scrobbler m ByteString b
deserialize = mkFix $ \_dt -> left NoDecoding . decode | 120 | deserialize = mkFix $ \_dt -> left NoDecoding . decode | 54 | true | true | 0 | 8 | 27 | 50 | 26 | 24 | null | null |
jonsterling/singletons | Data/Singletons/Singletons.hs | bsd-3-clause | singInstanceMethName = mkName "singInstance" | 44 | singInstanceMethName = mkName "singInstance" | 44 | singInstanceMethName = mkName "singInstance" | 44 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
forste/haReFork | refactorer/RefacDupTrans.hs | bsd-3-clause | createParameters mods n (Just e)
= do
numParams <- countParams e
let nameParams = mkNewNames (length numParams) e []
e' <- renameNormals e nameParams
let newDec = createDec (transformBindings e') nameParams
return (Just newDec)
where
transformBindings (Exp (HsDo stmts))
= (Exp (HsDo (transformBind [] stmts)))
transformBindings e = e
transformBind pats (HsGenerator s p1 e1 stmts)
= (HsGenerator s p1 e1 (transformBind (pats++[p1]) stmts))
transformBind pats (HsQualifier e stmts)
= (HsQualifier e (transformBind pats stmts))
transformBind pats (HsLast e)
| e == defaultExp
= (HsLast (Exp (HsApp (nameToExp "return") (Exp (HsTuple (getPats pats))))))
| pats /= [] = (HsQualifier e (HsLast (Exp (HsApp (nameToExp "return") (Exp (HsTuple (getPats pats)))))))
| otherwise = (HsLast e)
getPats [] = []
getPats (p:ps) = nameToExp (pNTtoName (patToPNT p)) : getPats ps
createDec e' nameParams
= Dec (HsFunBind loc0 [HsMatch loc0 (nameToPNT newName)
(map nameToPat nameParams)
(HsBody e')
[] ])
newName = mkNewName "abs" (map pNTtoName (hsPNTs mods)) n
renameNormals e [] = return e
renameNormals e (x:xs)
= do
e' <- renameANorm e x
res <- renameNormals e' xs
return res
where
renameANorm e x
= applyTP (once_tdTP (failTP `adhocTP` (inPNT x))) e
inPNT x (p::PNT)
| pNTtoName p == "$I" = return (nameToPNT x)
inPNT _ _ = mzero
countParams t
= applyTU (full_tdTU (constTU [] `adhocTU` inPNT)) t
inPNT (p::PNT)
| pNTtoName p == "$I" = return [p]
inPNT x = return []
mkNewNames :: Int -> HsExpP -> [String] -> [String]
mkNewNames 0 e names = names
mkNewNames n e names
= mkNewNames (n-1) e (result : names)
where
result = mkNewName "p" (oldNames ++ names) n
oldNames = map pNTtoName (hsPNTs e) | 2,480 | createParameters mods n (Just e)
= do
numParams <- countParams e
let nameParams = mkNewNames (length numParams) e []
e' <- renameNormals e nameParams
let newDec = createDec (transformBindings e') nameParams
return (Just newDec)
where
transformBindings (Exp (HsDo stmts))
= (Exp (HsDo (transformBind [] stmts)))
transformBindings e = e
transformBind pats (HsGenerator s p1 e1 stmts)
= (HsGenerator s p1 e1 (transformBind (pats++[p1]) stmts))
transformBind pats (HsQualifier e stmts)
= (HsQualifier e (transformBind pats stmts))
transformBind pats (HsLast e)
| e == defaultExp
= (HsLast (Exp (HsApp (nameToExp "return") (Exp (HsTuple (getPats pats))))))
| pats /= [] = (HsQualifier e (HsLast (Exp (HsApp (nameToExp "return") (Exp (HsTuple (getPats pats)))))))
| otherwise = (HsLast e)
getPats [] = []
getPats (p:ps) = nameToExp (pNTtoName (patToPNT p)) : getPats ps
createDec e' nameParams
= Dec (HsFunBind loc0 [HsMatch loc0 (nameToPNT newName)
(map nameToPat nameParams)
(HsBody e')
[] ])
newName = mkNewName "abs" (map pNTtoName (hsPNTs mods)) n
renameNormals e [] = return e
renameNormals e (x:xs)
= do
e' <- renameANorm e x
res <- renameNormals e' xs
return res
where
renameANorm e x
= applyTP (once_tdTP (failTP `adhocTP` (inPNT x))) e
inPNT x (p::PNT)
| pNTtoName p == "$I" = return (nameToPNT x)
inPNT _ _ = mzero
countParams t
= applyTU (full_tdTU (constTU [] `adhocTU` inPNT)) t
inPNT (p::PNT)
| pNTtoName p == "$I" = return [p]
inPNT x = return []
mkNewNames :: Int -> HsExpP -> [String] -> [String]
mkNewNames 0 e names = names
mkNewNames n e names
= mkNewNames (n-1) e (result : names)
where
result = mkNewName "p" (oldNames ++ names) n
oldNames = map pNTtoName (hsPNTs e) | 2,480 | createParameters mods n (Just e)
= do
numParams <- countParams e
let nameParams = mkNewNames (length numParams) e []
e' <- renameNormals e nameParams
let newDec = createDec (transformBindings e') nameParams
return (Just newDec)
where
transformBindings (Exp (HsDo stmts))
= (Exp (HsDo (transformBind [] stmts)))
transformBindings e = e
transformBind pats (HsGenerator s p1 e1 stmts)
= (HsGenerator s p1 e1 (transformBind (pats++[p1]) stmts))
transformBind pats (HsQualifier e stmts)
= (HsQualifier e (transformBind pats stmts))
transformBind pats (HsLast e)
| e == defaultExp
= (HsLast (Exp (HsApp (nameToExp "return") (Exp (HsTuple (getPats pats))))))
| pats /= [] = (HsQualifier e (HsLast (Exp (HsApp (nameToExp "return") (Exp (HsTuple (getPats pats)))))))
| otherwise = (HsLast e)
getPats [] = []
getPats (p:ps) = nameToExp (pNTtoName (patToPNT p)) : getPats ps
createDec e' nameParams
= Dec (HsFunBind loc0 [HsMatch loc0 (nameToPNT newName)
(map nameToPat nameParams)
(HsBody e')
[] ])
newName = mkNewName "abs" (map pNTtoName (hsPNTs mods)) n
renameNormals e [] = return e
renameNormals e (x:xs)
= do
e' <- renameANorm e x
res <- renameNormals e' xs
return res
where
renameANorm e x
= applyTP (once_tdTP (failTP `adhocTP` (inPNT x))) e
inPNT x (p::PNT)
| pNTtoName p == "$I" = return (nameToPNT x)
inPNT _ _ = mzero
countParams t
= applyTU (full_tdTU (constTU [] `adhocTU` inPNT)) t
inPNT (p::PNT)
| pNTtoName p == "$I" = return [p]
inPNT x = return []
mkNewNames :: Int -> HsExpP -> [String] -> [String]
mkNewNames 0 e names = names
mkNewNames n e names
= mkNewNames (n-1) e (result : names)
where
result = mkNewName "p" (oldNames ++ names) n
oldNames = map pNTtoName (hsPNTs e) | 2,480 | false | false | 12 | 19 | 1,069 | 928 | 420 | 508 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_590 (168#) = happyShift action_450 | 41 | action_590 (168#) = happyShift action_450 | 41 | action_590 (168#) = happyShift action_450 | 41 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/book/2009-Real_World_Haskell/myDrop.hs | unlicense | myDrop :: (Ord a, Num a) => a -> [a1] -> [a1]
myDrop n xs | n <= 0 || null xs = xs
| otherwise = myDrop (n - 1) (tail xs) | 142 | myDrop :: (Ord a, Num a) => a -> [a1] -> [a1]
myDrop n xs | n <= 0 || null xs = xs
| otherwise = myDrop (n - 1) (tail xs) | 141 | myDrop n xs | n <= 0 || null xs = xs
| otherwise = myDrop (n - 1) (tail xs) | 95 | false | true | 0 | 9 | 53 | 89 | 44 | 45 | null | null |
ababkin/partial_inspector | src/Vim/Netbeans/Protocol.hs | mit | printCommandArgs (RemoveAnno serNum) =
" " ++ (show serNum) | 66 | printCommandArgs (RemoveAnno serNum) =
" " ++ (show serNum) | 66 | printCommandArgs (RemoveAnno serNum) =
" " ++ (show serNum) | 66 | false | false | 2 | 7 | 15 | 28 | 12 | 16 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.