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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Th30n/hasgel | app/Main.hs | mit | -- | Rotate the camera as in first person.
rotateCamera :: L.V2 Int32 -> World -> World
rotateCamera motion world =
let sens = -10
dt = millis2Sec . timeDelta $ worldTime world
L.V2 x y = sens * dt *^ fmap fromIntegral motion
camera = worldCamera world
-- | Horizontal rotation is locked to world vertical axis.
horRot = rotateWorld (cameraTransform camera) $ L.V3 0 x 0
-- | Vertical rotation is relative to local horizontal axis.
vertRot = rotateLocal horRot $ L.V3 y 0 0
in world { worldCamera = camera { cameraTransform = vertRot } } | 583 | rotateCamera :: L.V2 Int32 -> World -> World
rotateCamera motion world =
let sens = -10
dt = millis2Sec . timeDelta $ worldTime world
L.V2 x y = sens * dt *^ fmap fromIntegral motion
camera = worldCamera world
-- | Horizontal rotation is locked to world vertical axis.
horRot = rotateWorld (cameraTransform camera) $ L.V3 0 x 0
-- | Vertical rotation is relative to local horizontal axis.
vertRot = rotateLocal horRot $ L.V3 y 0 0
in world { worldCamera = camera { cameraTransform = vertRot } } | 540 | rotateCamera motion world =
let sens = -10
dt = millis2Sec . timeDelta $ worldTime world
L.V2 x y = sens * dt *^ fmap fromIntegral motion
camera = worldCamera world
-- | Horizontal rotation is locked to world vertical axis.
horRot = rotateWorld (cameraTransform camera) $ L.V3 0 x 0
-- | Vertical rotation is relative to local horizontal axis.
vertRot = rotateLocal horRot $ L.V3 y 0 0
in world { worldCamera = camera { cameraTransform = vertRot } } | 495 | true | true | 0 | 12 | 144 | 159 | 80 | 79 | null | null |
apyrgio/ganeti | test/hs/Test/Ganeti/Query/Filter.hs | bsd-2-clause | namesToResult :: [String] -> [[ResultEntry]]
namesToResult = map ((:[]) . ResultEntry RSNormal . Just . showJSON) | 113 | namesToResult :: [String] -> [[ResultEntry]]
namesToResult = map ((:[]) . ResultEntry RSNormal . Just . showJSON) | 113 | namesToResult = map ((:[]) . ResultEntry RSNormal . Just . showJSON) | 68 | false | true | 0 | 11 | 15 | 51 | 28 | 23 | null | null |
ababkin/qmuli | library/Qi/Config/CfTemplate.hs | mit | toOutputs
:: Config
-> Outputs
toOutputs config = mconcat $ ($ config) <$>
[
{- ApiGw.toOutputs -}
CF.toOutputs
] | 129 | toOutputs
:: Config
-> Outputs
toOutputs config = mconcat $ ($ config) <$>
[
{- ApiGw.toOutputs -}
CF.toOutputs
] | 129 | toOutputs config = mconcat $ ($ config) <$>
[
{- ApiGw.toOutputs -}
CF.toOutputs
] | 94 | false | true | 0 | 8 | 34 | 42 | 21 | 21 | null | null |
brendanhay/gogol | gogol-vision/gen/Network/Google/Vision/Types/Product.hs | mpl-2.0 | -- | The Google Cloud Storage location to read the input from.
gGcsSource :: Lens' GoogleCloudVisionV1p4beta1InputConfig (Maybe GoogleCloudVisionV1p4beta1GcsSource)
gGcsSource
= lens _gGcsSource (\ s a -> s{_gGcsSource = a}) | 226 | gGcsSource :: Lens' GoogleCloudVisionV1p4beta1InputConfig (Maybe GoogleCloudVisionV1p4beta1GcsSource)
gGcsSource
= lens _gGcsSource (\ s a -> s{_gGcsSource = a}) | 163 | gGcsSource
= lens _gGcsSource (\ s a -> s{_gGcsSource = a}) | 61 | true | true | 1 | 9 | 30 | 52 | 25 | 27 | null | null |
GaloisInc/halvm-ghc | compiler/simplCore/SimplMonad.hs | bsd-3-clause | returnSmpl :: a -> SimplM a
returnSmpl e = SM (\_st_env us sc -> return (e, us, sc)) | 84 | returnSmpl :: a -> SimplM a
returnSmpl e = SM (\_st_env us sc -> return (e, us, sc)) | 84 | returnSmpl e = SM (\_st_env us sc -> return (e, us, sc)) | 56 | false | true | 0 | 9 | 17 | 53 | 26 | 27 | null | null |
markus-git/co-feldspar | examples/FFT.hs | bsd-3-clause | -- SExp Index -> SExp a -> SExp a
--flipBit i a = a `xor` (1 .<<. (i2n i))
-- |
zeroBit :: (Bits a, Num (SExp a), SType' a) =>
SExp Index -> SExp a -> SExp a
zeroBit i a = a + (a .&. (ones .<<. (i2n i))) | 208 | zeroBit :: (Bits a, Num (SExp a), SType' a) =>
SExp Index -> SExp a -> SExp a
zeroBit i a = a + (a .&. (ones .<<. (i2n i))) | 125 | zeroBit i a = a + (a .&. (ones .<<. (i2n i))) | 45 | true | true | 0 | 11 | 55 | 87 | 45 | 42 | null | null |
Concelo/concelo | src/Database/Concelo/Chunks.hs | bsd-3-clause | findObsoleteChunks oldChunks oldRoot found =
visit (T.empty, T.empty) oldRoot where
visit :: (T.Trie BS.ByteString Pr.Message,
T.Trie BS.ByteString Pr.Message) ->
Pa.Path BS.ByteString () ->
C.Action s (T.Trie BS.ByteString Pr.Message,
T.Trie BS.ByteString Pr.Message)
visit result@(obsolete, obsoleteLeaves) name =
if null (Pa.keys name) || T.member name found then
return result
else
maybeToAction
(Exception ("could not find " ++ show name
++ " in " ++ show oldChunks))
(T.findValue name oldChunks) >>= \chunk ->
foldM visit (T.union (const chunk <$> name) obsolete,
if chunkIsGroup chunk then
obsoleteLeaves
else
T.union (const chunk <$> name) obsoleteLeaves)
(T.paths $ chunkMembers chunk) | 949 | findObsoleteChunks oldChunks oldRoot found =
visit (T.empty, T.empty) oldRoot where
visit :: (T.Trie BS.ByteString Pr.Message,
T.Trie BS.ByteString Pr.Message) ->
Pa.Path BS.ByteString () ->
C.Action s (T.Trie BS.ByteString Pr.Message,
T.Trie BS.ByteString Pr.Message)
visit result@(obsolete, obsoleteLeaves) name =
if null (Pa.keys name) || T.member name found then
return result
else
maybeToAction
(Exception ("could not find " ++ show name
++ " in " ++ show oldChunks))
(T.findValue name oldChunks) >>= \chunk ->
foldM visit (T.union (const chunk <$> name) obsolete,
if chunkIsGroup chunk then
obsoleteLeaves
else
T.union (const chunk <$> name) obsoleteLeaves)
(T.paths $ chunkMembers chunk) | 949 | findObsoleteChunks oldChunks oldRoot found =
visit (T.empty, T.empty) oldRoot where
visit :: (T.Trie BS.ByteString Pr.Message,
T.Trie BS.ByteString Pr.Message) ->
Pa.Path BS.ByteString () ->
C.Action s (T.Trie BS.ByteString Pr.Message,
T.Trie BS.ByteString Pr.Message)
visit result@(obsolete, obsoleteLeaves) name =
if null (Pa.keys name) || T.member name found then
return result
else
maybeToAction
(Exception ("could not find " ++ show name
++ " in " ++ show oldChunks))
(T.findValue name oldChunks) >>= \chunk ->
foldM visit (T.union (const chunk <$> name) obsolete,
if chunkIsGroup chunk then
obsoleteLeaves
else
T.union (const chunk <$> name) obsoleteLeaves)
(T.paths $ chunkMembers chunk) | 949 | false | false | 0 | 16 | 348 | 290 | 145 | 145 | null | null |
shlevy/ghc | testsuite/tests/simplCore/should_compile/T7785.hs | bsd-3-clause | bar xs = 0:shared xs | 20 | bar xs = 0:shared xs | 20 | bar xs = 0:shared xs | 20 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
stevana/haarss | src/Haarss/Model/Window.hs | isc | flipDown :: Window a -> Window a
flipDown (Window as ps x (viewl -> n :< ns) bs) =
Window as ps n (x <| ns) bs | 145 | flipDown :: Window a -> Window a
flipDown (Window as ps x (viewl -> n :< ns) bs) =
Window as ps n (x <| ns) bs | 145 | flipDown (Window as ps x (viewl -> n :< ns) bs) =
Window as ps n (x <| ns) bs | 112 | false | true | 0 | 10 | 61 | 67 | 33 | 34 | null | null |
mhwombat/exp-audio-id-wains | src/ALife/Creatur/Wain/AudioID/Experiment.hs | bsd-3-clause | flirt :: StateT Experiment IO ()
flirt = do
a <- use subject
(O.AObject b) <- use other
babyName <- zoom universe U.genName
(a':b':_, msgs, aMatingDeltaE, bMatingDeltaE)
<- liftIO . evalRandIO $ W.mate a b babyName
if null msgs
then do
report $ agentId a ++ " and " ++ agentId b ++ " mated"
report $ "Contribution to child: " ++
agentId a ++ "'s share is " ++ show aMatingDeltaE ++ " " ++
agentId b ++ "'s share is " ++ show bMatingDeltaE
assign subject a'
assign other (O.AObject b')
recordBirths
(summary . rMatingDeltaE) += aMatingDeltaE
(summary . rOtherMatingDeltaE) += bMatingDeltaE
(summary . rMateCount) += 1
else mapM_ report msgs | 726 | flirt :: StateT Experiment IO ()
flirt = do
a <- use subject
(O.AObject b) <- use other
babyName <- zoom universe U.genName
(a':b':_, msgs, aMatingDeltaE, bMatingDeltaE)
<- liftIO . evalRandIO $ W.mate a b babyName
if null msgs
then do
report $ agentId a ++ " and " ++ agentId b ++ " mated"
report $ "Contribution to child: " ++
agentId a ++ "'s share is " ++ show aMatingDeltaE ++ " " ++
agentId b ++ "'s share is " ++ show bMatingDeltaE
assign subject a'
assign other (O.AObject b')
recordBirths
(summary . rMatingDeltaE) += aMatingDeltaE
(summary . rOtherMatingDeltaE) += bMatingDeltaE
(summary . rMateCount) += 1
else mapM_ report msgs | 726 | flirt = do
a <- use subject
(O.AObject b) <- use other
babyName <- zoom universe U.genName
(a':b':_, msgs, aMatingDeltaE, bMatingDeltaE)
<- liftIO . evalRandIO $ W.mate a b babyName
if null msgs
then do
report $ agentId a ++ " and " ++ agentId b ++ " mated"
report $ "Contribution to child: " ++
agentId a ++ "'s share is " ++ show aMatingDeltaE ++ " " ++
agentId b ++ "'s share is " ++ show bMatingDeltaE
assign subject a'
assign other (O.AObject b')
recordBirths
(summary . rMatingDeltaE) += aMatingDeltaE
(summary . rOtherMatingDeltaE) += bMatingDeltaE
(summary . rMateCount) += 1
else mapM_ report msgs | 693 | false | true | 0 | 17 | 199 | 267 | 124 | 143 | null | null |
michalkonecny/aern2 | aern2-mfun/src/AERN2/BoxFun/Box.hs | bsd-3-clause | upperBounds :: Box -> Box
upperBounds = V.map upperBound | 56 | upperBounds :: Box -> Box
upperBounds = V.map upperBound | 56 | upperBounds = V.map upperBound | 30 | false | true | 0 | 6 | 8 | 20 | 10 | 10 | null | null |
ptitfred/slidecoding | src/Slidecoding/SlidesWriter.hs | gpl-3.0 | replaceSourceBlock :: [Description] -> Block -> [Block]
replaceSourceBlock descs original@(Para [Link _ contents (url, _)]) | isSourceUrl url = expandLink contents (inlineLink descs url)
where expandLink [] (Just b) = [b]
expandLink c (Just b) = [Para c, b]
expandLink _ Nothing = [original] | 312 | replaceSourceBlock :: [Description] -> Block -> [Block]
replaceSourceBlock descs original@(Para [Link _ contents (url, _)]) | isSourceUrl url = expandLink contents (inlineLink descs url)
where expandLink [] (Just b) = [b]
expandLink c (Just b) = [Para c, b]
expandLink _ Nothing = [original] | 312 | replaceSourceBlock descs original@(Para [Link _ contents (url, _)]) | isSourceUrl url = expandLink contents (inlineLink descs url)
where expandLink [] (Just b) = [b]
expandLink c (Just b) = [Para c, b]
expandLink _ Nothing = [original] | 256 | false | true | 2 | 11 | 64 | 139 | 71 | 68 | null | null |
sseefried/shady-gen | src/Shady/Language/Operator.hs | agpl-3.0 | info Mul = OpInfo "(*)" (*) (infixL 7) | 53 | info Mul = OpInfo "(*)" (*) (infixL 7) | 53 | info Mul = OpInfo "(*)" (*) (infixL 7) | 53 | false | false | 0 | 7 | 22 | 24 | 12 | 12 | null | null |
spell-music/temporal-music-notation-demo | src/Temporal/Music/Demo.hs | bsd-3-clause | tuneParams :: MidiPitch -> Maybe TuneId
tuneParams (MidiPitch p d)
| c == (0, 0) = Nothing
| otherwise = Just (fromIntegral p, c)
where c = cents d
-- | 1 semitone / 2^14 | 188 | tuneParams :: MidiPitch -> Maybe TuneId
tuneParams (MidiPitch p d)
| c == (0, 0) = Nothing
| otherwise = Just (fromIntegral p, c)
where c = cents d
-- | 1 semitone / 2^14 | 188 | tuneParams (MidiPitch p d)
| c == (0, 0) = Nothing
| otherwise = Just (fromIntegral p, c)
where c = cents d
-- | 1 semitone / 2^14 | 148 | false | true | 1 | 9 | 52 | 88 | 40 | 48 | null | null |
OS2World/DEV-UTIL-HUGS | demos/prolog/AndorraEngine.hs | bsd-3-clause | version = "Andorra Principle Interpreter (select deterministic goals first)" | 76 | version = "Andorra Principle Interpreter (select deterministic goals first)" | 76 | version = "Andorra Principle Interpreter (select deterministic goals first)" | 76 | false | false | 0 | 4 | 8 | 6 | 3 | 3 | null | null |
Axure/elm-compiler | src/Reporting/Error/Docs.hs | bsd-3-clause | -- TO REPORT
toReport :: Error -> Report.Report
toReport err =
case err of
NoDocs ->
Report.simple "DOCUMENTATION ERROR"
( "You must have a documentation comment between the module declaration and the\n"
++ "imports."
)
"Learn how at <http://package.elm-lang.org/help/documentation-format>"
OnlyInDocs name suggestions ->
Report.simple "DOCUMENTATION ERROR"
("Your module documentation includes `" ++ name ++ "` which is not exported.")
("Is it misspelled? Should it be exported? " ++ Help.maybeYouWant suggestions)
OnlyInExports names ->
Report.simple
"DOCUMENTATION ERROR"
( "The following exports do not appear in your module documentation:\n"
++ concatMap ("\n " ++) names
)
( "All exports must be listed in the module documentation after a @docs keyword.\n"
++ "Learn how at <http://package.elm-lang.org/help/documentation-format>"
)
NoComment name ->
Report.simple "DOCUMENTATION ERROR"
("The value `" ++ name ++ "` does not have a documentation comment.")
( "Documentation comments start with {-| and end with -}. They should provide a\n"
++ "clear description of how they work, and ideally a small code example. This is\n"
++ "extremely valuable for users checking out your package!\n\n"
++ "If you think the docs are clearer without any words, you can use an empty\n"
++ "comment {-|-} which should be used sparingly. Maybe you have a section of 20\n"
++ "values all with the exact same type. The docs may read better if they are all\n"
++ "described in one place.\n\n"
++ "Learn more at <http://package.elm-lang.org/help/documentation-format>"
)
NoType name ->
Report.simple "MISSING ANNOTATION"
("The value `" ++ name ++ "` does not have a type annotation.")
( "Adding type annotations is best practice and it gives you a chance to name\n"
++ "types and type variables so they are as easy as possible to understand!"
) | 2,191 | toReport :: Error -> Report.Report
toReport err =
case err of
NoDocs ->
Report.simple "DOCUMENTATION ERROR"
( "You must have a documentation comment between the module declaration and the\n"
++ "imports."
)
"Learn how at <http://package.elm-lang.org/help/documentation-format>"
OnlyInDocs name suggestions ->
Report.simple "DOCUMENTATION ERROR"
("Your module documentation includes `" ++ name ++ "` which is not exported.")
("Is it misspelled? Should it be exported? " ++ Help.maybeYouWant suggestions)
OnlyInExports names ->
Report.simple
"DOCUMENTATION ERROR"
( "The following exports do not appear in your module documentation:\n"
++ concatMap ("\n " ++) names
)
( "All exports must be listed in the module documentation after a @docs keyword.\n"
++ "Learn how at <http://package.elm-lang.org/help/documentation-format>"
)
NoComment name ->
Report.simple "DOCUMENTATION ERROR"
("The value `" ++ name ++ "` does not have a documentation comment.")
( "Documentation comments start with {-| and end with -}. They should provide a\n"
++ "clear description of how they work, and ideally a small code example. This is\n"
++ "extremely valuable for users checking out your package!\n\n"
++ "If you think the docs are clearer without any words, you can use an empty\n"
++ "comment {-|-} which should be used sparingly. Maybe you have a section of 20\n"
++ "values all with the exact same type. The docs may read better if they are all\n"
++ "described in one place.\n\n"
++ "Learn more at <http://package.elm-lang.org/help/documentation-format>"
)
NoType name ->
Report.simple "MISSING ANNOTATION"
("The value `" ++ name ++ "` does not have a type annotation.")
( "Adding type annotations is best practice and it gives you a chance to name\n"
++ "types and type variables so they are as easy as possible to understand!"
) | 2,177 | toReport err =
case err of
NoDocs ->
Report.simple "DOCUMENTATION ERROR"
( "You must have a documentation comment between the module declaration and the\n"
++ "imports."
)
"Learn how at <http://package.elm-lang.org/help/documentation-format>"
OnlyInDocs name suggestions ->
Report.simple "DOCUMENTATION ERROR"
("Your module documentation includes `" ++ name ++ "` which is not exported.")
("Is it misspelled? Should it be exported? " ++ Help.maybeYouWant suggestions)
OnlyInExports names ->
Report.simple
"DOCUMENTATION ERROR"
( "The following exports do not appear in your module documentation:\n"
++ concatMap ("\n " ++) names
)
( "All exports must be listed in the module documentation after a @docs keyword.\n"
++ "Learn how at <http://package.elm-lang.org/help/documentation-format>"
)
NoComment name ->
Report.simple "DOCUMENTATION ERROR"
("The value `" ++ name ++ "` does not have a documentation comment.")
( "Documentation comments start with {-| and end with -}. They should provide a\n"
++ "clear description of how they work, and ideally a small code example. This is\n"
++ "extremely valuable for users checking out your package!\n\n"
++ "If you think the docs are clearer without any words, you can use an empty\n"
++ "comment {-|-} which should be used sparingly. Maybe you have a section of 20\n"
++ "values all with the exact same type. The docs may read better if they are all\n"
++ "described in one place.\n\n"
++ "Learn more at <http://package.elm-lang.org/help/documentation-format>"
)
NoType name ->
Report.simple "MISSING ANNOTATION"
("The value `" ++ name ++ "` does not have a type annotation.")
( "Adding type annotations is best practice and it gives you a chance to name\n"
++ "types and type variables so they are as easy as possible to understand!"
) | 2,142 | true | true | 0 | 16 | 640 | 227 | 114 | 113 | null | null |
anttisalonen/freekick | haskell/libfreekick/Freekick/Libsoccer/Match.hs | agpl-3.0 | playMatches (m:ms) = do
fstm <- playMatch m
rest <- playMatches ms
return $ fstm : rest | 99 | playMatches (m:ms) = do
fstm <- playMatch m
rest <- playMatches ms
return $ fstm : rest | 99 | playMatches (m:ms) = do
fstm <- playMatch m
rest <- playMatches ms
return $ fstm : rest | 99 | false | false | 0 | 8 | 28 | 48 | 21 | 27 | null | null |
urbanslug/ghc | compiler/utils/Util.hs | bsd-3-clause | isEqual :: Ordering -> Bool
-- Often used in (isEqual (a `compare` b))
isEqual GT = False | 89 | isEqual :: Ordering -> Bool
isEqual GT = False | 46 | isEqual GT = False | 18 | true | true | 0 | 7 | 16 | 25 | 11 | 14 | null | null |
spechub/Hets | TPTP/Pretty.hs | gpl-2.0 | printCNF_annotated :: CNF_annotated -> Doc
printCNF_annotated x = case x of
CNF_annotated n r f a ->
text "cnf"
<> parens (sepByCommas [pretty n, pretty r, pretty f]
<> printAnnotationsIfAnnotated a)
<> text "."
-- <annotations> ::= ,<source><optional_info> | <null> | 305 | printCNF_annotated :: CNF_annotated -> Doc
printCNF_annotated x = case x of
CNF_annotated n r f a ->
text "cnf"
<> parens (sepByCommas [pretty n, pretty r, pretty f]
<> printAnnotationsIfAnnotated a)
<> text "."
-- <annotations> ::= ,<source><optional_info> | <null> | 305 | printCNF_annotated x = case x of
CNF_annotated n r f a ->
text "cnf"
<> parens (sepByCommas [pretty n, pretty r, pretty f]
<> printAnnotationsIfAnnotated a)
<> text "."
-- <annotations> ::= ,<source><optional_info> | <null> | 262 | false | true | 0 | 15 | 78 | 91 | 42 | 49 | null | null |
mettekou/ghc | compiler/types/Coercion.hs | bsd-3-clause | extendLiftingContextEx :: LiftingContext -- ^ original lifting context
-> [(TyVar,Type)] -- ^ ex. var / value pairs
-> LiftingContext
-- Note that this is more involved than extendLiftingContext. That function
-- takes a coercion to extend with, so it's assumed that the caller has taken
-- into account any of the kind-changing stuff worried about here.
extendLiftingContextEx lc [] = lc | 440 | extendLiftingContextEx :: LiftingContext -- ^ original lifting context
-> [(TyVar,Type)] -- ^ ex. var / value pairs
-> LiftingContext
extendLiftingContextEx lc [] = lc | 219 | extendLiftingContextEx lc [] = lc | 33 | true | true | 0 | 8 | 112 | 40 | 24 | 16 | null | null |
daewon/til | exercism/haskell/rna-transcription/src/DNA.hs | mpl-2.0 | toRNA :: (Traversable t) => t Char -> Maybe (t Char)
toRNA str = traverse find str
where find = flip lookup $ dnas | 116 | toRNA :: (Traversable t) => t Char -> Maybe (t Char)
toRNA str = traverse find str
where find = flip lookup $ dnas | 116 | toRNA str = traverse find str
where find = flip lookup $ dnas | 63 | false | true | 1 | 10 | 25 | 67 | 29 | 38 | null | null |
urbanslug/ghc | testsuite/tests/concurrent/should_run/tryReadMVar1.hs | bsd-3-clause | main = do
m <- newMVar (0 :: Int)
Just 0 <- tryReadMVar m
takeMVar m
Nothing <- tryReadMVar m
return () | 123 | main = do
m <- newMVar (0 :: Int)
Just 0 <- tryReadMVar m
takeMVar m
Nothing <- tryReadMVar m
return () | 123 | main = do
m <- newMVar (0 :: Int)
Just 0 <- tryReadMVar m
takeMVar m
Nothing <- tryReadMVar m
return () | 123 | false | false | 0 | 9 | 41 | 59 | 25 | 34 | null | null |
Charlesetc/haskell-parsing | src/Pear/Operator/Concrete.hs | bsd-3-clause | integer :: Parser Int
integer = lexeme (read <$> many1 (digit)) | 63 | integer :: Parser Int
integer = lexeme (read <$> many1 (digit)) | 63 | integer = lexeme (read <$> many1 (digit)) | 41 | false | true | 0 | 9 | 10 | 30 | 15 | 15 | null | null |
deontologician/orbRPG | Game/OrbRPG/HAdventure/Engine.hs | gpl-3.0 | mkActionMap :: ActionList -> ActionMap
mkActionMap = M.fromList | 63 | mkActionMap :: ActionList -> ActionMap
mkActionMap = M.fromList | 63 | mkActionMap = M.fromList | 24 | false | true | 0 | 5 | 7 | 17 | 9 | 8 | null | null |
pparkkin/eta | compiler/ETA/Types/Type.hs | bsd-3-clause | zipTopTvSubst :: [TyVar] -> [Type] -> TvSubst
zipTopTvSubst tyvars tys
| debugIsOn && (length tyvars /= length tys)
= pprTrace "zipTopTvSubst" (ppr tyvars $$ ppr tys) emptyTvSubst
| otherwise
= TvSubst emptyInScopeSet (zipTyEnv tyvars tys) | 247 | zipTopTvSubst :: [TyVar] -> [Type] -> TvSubst
zipTopTvSubst tyvars tys
| debugIsOn && (length tyvars /= length tys)
= pprTrace "zipTopTvSubst" (ppr tyvars $$ ppr tys) emptyTvSubst
| otherwise
= TvSubst emptyInScopeSet (zipTyEnv tyvars tys) | 247 | zipTopTvSubst tyvars tys
| debugIsOn && (length tyvars /= length tys)
= pprTrace "zipTopTvSubst" (ppr tyvars $$ ppr tys) emptyTvSubst
| otherwise
= TvSubst emptyInScopeSet (zipTyEnv tyvars tys) | 201 | false | true | 0 | 11 | 42 | 106 | 47 | 59 | null | null |
BurntSushi/erd | src/Erd/Config.hs | unlicense | defaultConfig :: Config
defaultConfig =
Config { cin = ("<stdin>", stdin)
, cout = ("<stdout>", stdout)
, outfmt = Nothing
, edgeType = Just A.SplineEdges
, configFile = Nothing
, dotentity = Just False
, edgePattern = Just A.Dashed
, notation = Just UML
} | 330 | defaultConfig :: Config
defaultConfig =
Config { cin = ("<stdin>", stdin)
, cout = ("<stdout>", stdout)
, outfmt = Nothing
, edgeType = Just A.SplineEdges
, configFile = Nothing
, dotentity = Just False
, edgePattern = Just A.Dashed
, notation = Just UML
} | 330 | defaultConfig =
Config { cin = ("<stdin>", stdin)
, cout = ("<stdout>", stdout)
, outfmt = Nothing
, edgeType = Just A.SplineEdges
, configFile = Nothing
, dotentity = Just False
, edgePattern = Just A.Dashed
, notation = Just UML
} | 306 | false | true | 0 | 8 | 118 | 89 | 53 | 36 | null | null |
rad1al/hutton_exercises | ch13.hs | gpl-2.0 | nat :: Parser Int
nat = do xs <- some digit
return (read xs) | 69 | nat :: Parser Int
nat = do xs <- some digit
return (read xs) | 69 | nat = do xs <- some digit
return (read xs) | 51 | false | true | 0 | 10 | 22 | 42 | 17 | 25 | null | null |
bennofs/cabal | Cabal/Distribution/Simple/Setup.hs | bsd-3-clause | emptyCopyFlags :: CopyFlags
emptyCopyFlags = mempty | 51 | emptyCopyFlags :: CopyFlags
emptyCopyFlags = mempty | 51 | emptyCopyFlags = mempty | 23 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
spl/generic-deriving-extras | src/Generics/Deriving/Zipper/Base.hs | bsd-3-clause | fromPair :: Zipper b => Contexts b r cs -> (a, Ctx (Rep b) p) -> Loc a r (b ': cs)
fromPair cs (x, c) = Loc x (CCons c cs) | 122 | fromPair :: Zipper b => Contexts b r cs -> (a, Ctx (Rep b) p) -> Loc a r (b ': cs)
fromPair cs (x, c) = Loc x (CCons c cs) | 122 | fromPair cs (x, c) = Loc x (CCons c cs) | 39 | false | true | 0 | 11 | 31 | 90 | 45 | 45 | null | null |
zouppen/stratum-tool | src/PrettyJson.hs | agpl-3.0 | objBuilder :: String -> Builder -> Builder -> Text -> Value -> Builder
objBuilder delimiter path b k v = breadcrumbs' False newPath b delimiter v
where newPath = path <>
buildText k | 201 | objBuilder :: String -> Builder -> Builder -> Text -> Value -> Builder
objBuilder delimiter path b k v = breadcrumbs' False newPath b delimiter v
where newPath = path <>
buildText k | 201 | objBuilder delimiter path b k v = breadcrumbs' False newPath b delimiter v
where newPath = path <>
buildText k | 130 | false | true | 2 | 11 | 52 | 75 | 34 | 41 | null | null |
beni55/LambdaHack | Game/LambdaHack/Client/UI/HandleHumanGlobalClient.hs | bsd-3-clause | -- * RunOnceAhead
runOnceAheadHuman :: MonadClientUI m => m (SlideOrCmd RequestAnyAbility)
runOnceAheadHuman = do
side <- getsClient sside
fact <- getsState $ (EM.! side) . sfactionD
leader <- getLeaderUI
srunning <- getsClient srunning
-- When running, stop if disturbed. If not running, stop at once.
case srunning of
Nothing -> do
stopPlayBack
return $ Left mempty
Just RunParams{runMembers}
| noRunWithMulti fact && runMembers /= [leader] -> do
stopPlayBack
Config{configRunStopMsgs} <- askConfig
if configRunStopMsgs
then failWith "run stop: automatic leader change"
else return $ Left mempty
Just runParams -> do
arena <- getArenaUI
runOutcome <- continueRun arena runParams
case runOutcome of
Left stopMsg -> do
stopPlayBack
Config{configRunStopMsgs} <- askConfig
if configRunStopMsgs
then failWith $ "run stop:" <+> stopMsg
else return $ Left mempty
Right runCmd ->
return $ Right runCmd
-- * MoveOnceToCursor | 1,085 | runOnceAheadHuman :: MonadClientUI m => m (SlideOrCmd RequestAnyAbility)
runOnceAheadHuman = do
side <- getsClient sside
fact <- getsState $ (EM.! side) . sfactionD
leader <- getLeaderUI
srunning <- getsClient srunning
-- When running, stop if disturbed. If not running, stop at once.
case srunning of
Nothing -> do
stopPlayBack
return $ Left mempty
Just RunParams{runMembers}
| noRunWithMulti fact && runMembers /= [leader] -> do
stopPlayBack
Config{configRunStopMsgs} <- askConfig
if configRunStopMsgs
then failWith "run stop: automatic leader change"
else return $ Left mempty
Just runParams -> do
arena <- getArenaUI
runOutcome <- continueRun arena runParams
case runOutcome of
Left stopMsg -> do
stopPlayBack
Config{configRunStopMsgs} <- askConfig
if configRunStopMsgs
then failWith $ "run stop:" <+> stopMsg
else return $ Left mempty
Right runCmd ->
return $ Right runCmd
-- * MoveOnceToCursor | 1,066 | runOnceAheadHuman = do
side <- getsClient sside
fact <- getsState $ (EM.! side) . sfactionD
leader <- getLeaderUI
srunning <- getsClient srunning
-- When running, stop if disturbed. If not running, stop at once.
case srunning of
Nothing -> do
stopPlayBack
return $ Left mempty
Just RunParams{runMembers}
| noRunWithMulti fact && runMembers /= [leader] -> do
stopPlayBack
Config{configRunStopMsgs} <- askConfig
if configRunStopMsgs
then failWith "run stop: automatic leader change"
else return $ Left mempty
Just runParams -> do
arena <- getArenaUI
runOutcome <- continueRun arena runParams
case runOutcome of
Left stopMsg -> do
stopPlayBack
Config{configRunStopMsgs} <- askConfig
if configRunStopMsgs
then failWith $ "run stop:" <+> stopMsg
else return $ Left mempty
Right runCmd ->
return $ Right runCmd
-- * MoveOnceToCursor | 993 | true | true | 0 | 21 | 299 | 285 | 129 | 156 | null | null |
actframework/FrameworkBenchmarks | frameworks/Haskell/yesod/yesod-mysql-mongo/src/yesod.hs | bsd-3-clause | getUpdatesR :: Int -> Handler Value
getUpdatesR cnt = multiRandomHandler randomPair go cnt'
where
cnt' | cnt < 1 = 1
| cnt > 500 = 500
| otherwise = cnt
go = uncurry (intUpdate runMySQL My.toSqlKey) | 226 | getUpdatesR :: Int -> Handler Value
getUpdatesR cnt = multiRandomHandler randomPair go cnt'
where
cnt' | cnt < 1 = 1
| cnt > 500 = 500
| otherwise = cnt
go = uncurry (intUpdate runMySQL My.toSqlKey) | 226 | getUpdatesR cnt = multiRandomHandler randomPair go cnt'
where
cnt' | cnt < 1 = 1
| cnt > 500 = 500
| otherwise = cnt
go = uncurry (intUpdate runMySQL My.toSqlKey) | 190 | false | true | 0 | 8 | 64 | 86 | 40 | 46 | null | null |
mightymoose/liquidhaskell | benchmarks/vector-0.10.0.1/Data/Vector/Fusion/Stream/Monadic.nocpp.hs | bsd-3-clause | prescanlM f z (Stream step s sz) = Stream step' (s,z) sz
where
{-# INLINE [0] step' #-}
step' (s,x) = do
r <- step s
case r of
Yield y s' -> do
z <- f x y
return $ Yield x (s', z)
Skip s' -> return $ Skip (s', x)
Done -> return Done
-- | Prefix scan with strict accumulator | 475 | prescanlM f z (Stream step s sz) = Stream step' (s,z) sz
where
{-# INLINE [0] step' #-}
step' (s,x) = do
r <- step s
case r of
Yield y s' -> do
z <- f x y
return $ Yield x (s', z)
Skip s' -> return $ Skip (s', x)
Done -> return Done
-- | Prefix scan with strict accumulator | 475 | prescanlM f z (Stream step s sz) = Stream step' (s,z) sz
where
{-# INLINE [0] step' #-}
step' (s,x) = do
r <- step s
case r of
Yield y s' -> do
z <- f x y
return $ Yield x (s', z)
Skip s' -> return $ Skip (s', x)
Done -> return Done
-- | Prefix scan with strict accumulator | 475 | false | false | 0 | 14 | 265 | 148 | 70 | 78 | null | null |
NightRa/FurnitureAI | src/Example.hs | mit | initialGrid :: Grid
initialGrid = roomGrid $ Room (Point 0 0) 5 5 | 65 | initialGrid :: Grid
initialGrid = roomGrid $ Room (Point 0 0) 5 5 | 65 | initialGrid = roomGrid $ Room (Point 0 0) 5 5 | 45 | false | true | 0 | 8 | 12 | 30 | 15 | 15 | null | null |
dreixel/instant-generics | src/Generics/Instant/Functions/Empty.hs | bsd-3-clause | empty :: (Representable a, Empty (Rep a)) => a
empty = to empty' | 65 | empty :: (Representable a, Empty (Rep a)) => a
empty = to empty' | 64 | empty = to empty' | 17 | false | true | 0 | 9 | 13 | 41 | 19 | 22 | null | null |
CulpaBS/wbBach | src/Futhark/Representation/AST/Attributes/Scope.hs | bsd-3-clause | inScopeOf :: (Scoped lore a, LocalScope lore m) => a -> m b -> m b
inScopeOf = localScope . scopeOf | 99 | inScopeOf :: (Scoped lore a, LocalScope lore m) => a -> m b -> m b
inScopeOf = localScope . scopeOf | 99 | inScopeOf = localScope . scopeOf | 32 | false | true | 0 | 8 | 20 | 48 | 24 | 24 | null | null |
giogadi/hs-motion-planning | lib-src/Planners/RRT.hs | mit | solve :: StateSpace s -> MotionPlanningQuery s -> MotionValidity s -> Double -> Int -> [s]
solve space query motionValidity stepSize numIterations =
getPathToGoal $ buildRRTDefault space query motionValidity stepSize numIterations | 232 | solve :: StateSpace s -> MotionPlanningQuery s -> MotionValidity s -> Double -> Int -> [s]
solve space query motionValidity stepSize numIterations =
getPathToGoal $ buildRRTDefault space query motionValidity stepSize numIterations | 232 | solve space query motionValidity stepSize numIterations =
getPathToGoal $ buildRRTDefault space query motionValidity stepSize numIterations | 141 | false | true | 0 | 10 | 32 | 73 | 34 | 39 | null | null |
Happy0/liscrabble | src/Controllers/Game/Model/ServerGame.hs | gpl-2.0 | decreaseConnectionsByOne :: ServerGame -> STM ()
decreaseConnectionsByOne serverGame = modifyTVar (numConnections serverGame) decreaseByOne
where
decreaseByOne i = i - 1 | 187 | decreaseConnectionsByOne :: ServerGame -> STM ()
decreaseConnectionsByOne serverGame = modifyTVar (numConnections serverGame) decreaseByOne
where
decreaseByOne i = i - 1 | 183 | decreaseConnectionsByOne serverGame = modifyTVar (numConnections serverGame) decreaseByOne
where
decreaseByOne i = i - 1 | 134 | false | true | 0 | 8 | 37 | 49 | 23 | 26 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/playpen/2020-07-07-harold-carr-phantom-existential-scratchpad/src/FuelLevel.hs | unlicense | validateFuelLevel0 :: Int -> Maybe FuelLevel0
validateFuelLevel0 i =
if 0 <= i && i <= 10
then Just (FuelLevel0 i)
else Nothing | 133 | validateFuelLevel0 :: Int -> Maybe FuelLevel0
validateFuelLevel0 i =
if 0 <= i && i <= 10
then Just (FuelLevel0 i)
else Nothing | 133 | validateFuelLevel0 i =
if 0 <= i && i <= 10
then Just (FuelLevel0 i)
else Nothing | 87 | false | true | 0 | 8 | 28 | 55 | 26 | 29 | null | null |
andorp/bead | src/Bead/View/TemplateAndComponentNames.hs | bsd-3-clause | testScriptNotesField = TestScriptField "test-script-note" | 57 | testScriptNotesField = TestScriptField "test-script-note" | 57 | testScriptNotesField = TestScriptField "test-script-note" | 57 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
alvisespano/Lw | extras/hml-prototype/PPrint.hs | gpl-3.0 | fill f d = width d (\w ->
if (w >= f) then empty
else text (spaces (f - w))) | 131 | fill f d = width d (\w ->
if (w >= f) then empty
else text (spaces (f - w))) | 131 | fill f d = width d (\w ->
if (w >= f) then empty
else text (spaces (f - w))) | 131 | false | false | 0 | 13 | 74 | 55 | 29 | 26 | null | null |
databrary/databrary | src/Ops.hs | agpl-3.0 | -- TODO: get rid of this
flatMapM :: Monad m => (a -> m (Maybe b)) -> Maybe a -> m (Maybe b)
flatMapM justAction mVal = maybe (return Nothing) justAction mVal | 158 | flatMapM :: Monad m => (a -> m (Maybe b)) -> Maybe a -> m (Maybe b)
flatMapM justAction mVal = maybe (return Nothing) justAction mVal | 133 | flatMapM justAction mVal = maybe (return Nothing) justAction mVal | 65 | true | true | 0 | 12 | 31 | 77 | 36 | 41 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/PrimOp.hs | bsd-3-clause | tagOf_PrimOp ReadByteArrayOp_Word32 = _ILIT(211) | 48 | tagOf_PrimOp ReadByteArrayOp_Word32 = _ILIT(211) | 48 | tagOf_PrimOp ReadByteArrayOp_Word32 = _ILIT(211) | 48 | false | false | 0 | 6 | 3 | 15 | 7 | 8 | null | null |
juanmab37/HOpenCV-0.5.0.1 | src/HOpenCV/ImageProcessors.hs | gpl-2.0 | mageProcessor :: (Image -> Image -> IO Image) -> (Image -> IO Image)
-> ImageProcessor
imageProcessor procFunc allocFunc = processor procFunc allocFunc return (const $ return ())
| 194 | imageProcessor :: (Image -> Image -> IO Image) -> (Image -> IO Image)
-> ImageProcessor
imageProcessor procFunc allocFunc = processor procFunc allocFunc return (const $ return ()) | 194 | imageProcessor procFunc allocFunc = processor procFunc allocFunc return (const $ return ()) | 91 | false | true | 0 | 10 | 42 | 74 | 35 | 39 | null | null |
ivan-m/jbi | lib/System/JBI/Commands.hs | mit | withWrapped :: (forall bt. (NamedTool bt) => proxy bt -> res)
-> WrappedTool proxy -> res
withWrapped f (Wrapped bt) = f bt | 138 | withWrapped :: (forall bt. (NamedTool bt) => proxy bt -> res)
-> WrappedTool proxy -> res
withWrapped f (Wrapped bt) = f bt | 138 | withWrapped f (Wrapped bt) = f bt | 33 | false | true | 0 | 11 | 37 | 65 | 31 | 34 | null | null |
Mahdi89/eTeak | src/Bits.hs | bsd-3-clause | bitmaskToIntervals :: (Bits i, Num i, Integral j, Show j) => i -> [Slice j]
bitmaskToIntervals mask = notInSlice 0 mask
where
notInSlice _ 0 = []
notInSlice i mask
| testBit mask 0 = inSlice i i' mask'
| otherwise = notInSlice i' mask'
where
mask' = mask `shiftR` 1
i' = i + 1
inSlice from to 0 = [from<:(to - 1)]
inSlice from to mask
| testBit mask 0 = inSlice from (to + 1) (mask `shiftR` 1)
| otherwise = (from<:(to - 1)) : notInSlice to mask
-- sliceToBitmask : return a bitmask with 1s at each of the bit indices of the given slice | 723 | bitmaskToIntervals :: (Bits i, Num i, Integral j, Show j) => i -> [Slice j]
bitmaskToIntervals mask = notInSlice 0 mask
where
notInSlice _ 0 = []
notInSlice i mask
| testBit mask 0 = inSlice i i' mask'
| otherwise = notInSlice i' mask'
where
mask' = mask `shiftR` 1
i' = i + 1
inSlice from to 0 = [from<:(to - 1)]
inSlice from to mask
| testBit mask 0 = inSlice from (to + 1) (mask `shiftR` 1)
| otherwise = (from<:(to - 1)) : notInSlice to mask
-- sliceToBitmask : return a bitmask with 1s at each of the bit indices of the given slice | 719 | bitmaskToIntervals mask = notInSlice 0 mask
where
notInSlice _ 0 = []
notInSlice i mask
| testBit mask 0 = inSlice i i' mask'
| otherwise = notInSlice i' mask'
where
mask' = mask `shiftR` 1
i' = i + 1
inSlice from to 0 = [from<:(to - 1)]
inSlice from to mask
| testBit mask 0 = inSlice from (to + 1) (mask `shiftR` 1)
| otherwise = (from<:(to - 1)) : notInSlice to mask
-- sliceToBitmask : return a bitmask with 1s at each of the bit indices of the given slice | 643 | false | true | 0 | 12 | 295 | 241 | 120 | 121 | null | null |
jeannekamikaze/calc | Calc/Compiler.hs | bsd-3-clause | run :: Prog -> IO Int
run prog =
let code = compile prog
in nasm code >>= system >>= return . readExit | 110 | run :: Prog -> IO Int
run prog =
let code = compile prog
in nasm code >>= system >>= return . readExit | 110 | run prog =
let code = compile prog
in nasm code >>= system >>= return . readExit | 88 | false | true | 0 | 10 | 30 | 54 | 24 | 30 | null | null |
GaloisInc/saw-script | heapster-saw/src/Verifier/SAW/Heapster/ParsedCtx.hs | bsd-3-clause | -- | Remove the last variable in a 'ParsedCtx'
parsedCtxUncons :: ParsedCtx (ctx :> tp) -> ParsedCtx ctx
parsedCtxUncons (ParsedCtx (xs :>: _) (CruCtxCons ctx _)) = ParsedCtx xs ctx | 181 | parsedCtxUncons :: ParsedCtx (ctx :> tp) -> ParsedCtx ctx
parsedCtxUncons (ParsedCtx (xs :>: _) (CruCtxCons ctx _)) = ParsedCtx xs ctx | 134 | parsedCtxUncons (ParsedCtx (xs :>: _) (CruCtxCons ctx _)) = ParsedCtx xs ctx | 76 | true | true | 0 | 9 | 29 | 60 | 30 | 30 | null | null |
raymoo/needles | src/Needles/Bot.hs | gpl-3.0 | configuredBot :: Configuration -> BotState
configuredBot config = BotState { bName = cUsername config
, bPass = cPassword config
, bTriggers = cTriggers config
, bConfig = config
, bTimestamps = empty
} | 362 | configuredBot :: Configuration -> BotState
configuredBot config = BotState { bName = cUsername config
, bPass = cPassword config
, bTriggers = cTriggers config
, bConfig = config
, bTimestamps = empty
} | 362 | configuredBot config = BotState { bName = cUsername config
, bPass = cPassword config
, bTriggers = cTriggers config
, bConfig = config
, bTimestamps = empty
} | 319 | false | true | 0 | 7 | 192 | 59 | 33 | 26 | null | null |
uriba/dwarf | src/Data/Dwarf.hs | bsd-3-clause | dw_at 0x58 = DW_AT_call_file | 28 | dw_at 0x58 = DW_AT_call_file | 28 | dw_at 0x58 = DW_AT_call_file | 28 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
xnning/fcore | lib/Examples.hs | bsd-2-clause | x `add` y = PrimOp x (S.Arith J.Add) y | 41 | x `add` y = PrimOp x (S.Arith J.Add) y | 41 | x `add` y = PrimOp x (S.Arith J.Add) y | 41 | false | false | 0 | 8 | 11 | 34 | 16 | 18 | null | null |
beni55/bayes-stack | BayesStack/Dirichlet.hs | bsd-3-clause | symmetrizeAlpha alpha@(Alpha {}) =
SymAlpha { aDomain = alphaDomain alpha
, aAlpha = sumAlpha alpha / realToFrac (EM.size $ aAlphas alpha)
, aNorm = alphaNorm $ symmetrizeAlpha alpha
} | 219 | symmetrizeAlpha alpha@(Alpha {}) =
SymAlpha { aDomain = alphaDomain alpha
, aAlpha = sumAlpha alpha / realToFrac (EM.size $ aAlphas alpha)
, aNorm = alphaNorm $ symmetrizeAlpha alpha
} | 219 | symmetrizeAlpha alpha@(Alpha {}) =
SymAlpha { aDomain = alphaDomain alpha
, aAlpha = sumAlpha alpha / realToFrac (EM.size $ aAlphas alpha)
, aNorm = alphaNorm $ symmetrizeAlpha alpha
} | 219 | false | false | 0 | 11 | 63 | 71 | 37 | 34 | null | null |
TomMD/ghc | compiler/main/DynFlags.hs | bsd-3-clause | getSigOf :: DynFlags -> ModuleName -> Maybe Module
getSigOf dflags n = Map.lookup n (sigOf dflags) | 98 | getSigOf :: DynFlags -> ModuleName -> Maybe Module
getSigOf dflags n = Map.lookup n (sigOf dflags) | 98 | getSigOf dflags n = Map.lookup n (sigOf dflags) | 47 | false | true | 0 | 8 | 15 | 46 | 20 | 26 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/succ_4.hs | mit | primMinusNat :: Nat -> Nat -> MyInt;
primMinusNat Zero Zero = Pos Zero | 74 | primMinusNat :: Nat -> Nat -> MyInt
primMinusNat Zero Zero = Pos Zero | 73 | primMinusNat Zero Zero = Pos Zero | 33 | false | true | 0 | 6 | 16 | 28 | 14 | 14 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/index_3.hs | mit | compareMyInt :: MyInt -> MyInt -> Ordering
compareMyInt = primCmpInt | 72 | compareMyInt :: MyInt -> MyInt -> Ordering
compareMyInt = primCmpInt | 72 | compareMyInt = primCmpInt | 25 | false | true | 0 | 8 | 13 | 26 | 11 | 15 | null | null |
foreverbell/project-euler-solutions | src/543.hs | bsd-3-clause | solve :: Int
solve = foldl' (\r i -> r + contrib i * f i) 0 [1 .. to]
where
to = head fib
f i | i <= 7 = [0, 0, 1, 1, 1, 2, 2, 3] !! i
| even i = i `quot` 2 - 1
| otherwise = fromBool (isPrimeTable V.! i) + fromBool (isPrimeTable V.! (i - 2)) + i `quot` 2 - 2 | 286 | solve :: Int
solve = foldl' (\r i -> r + contrib i * f i) 0 [1 .. to]
where
to = head fib
f i | i <= 7 = [0, 0, 1, 1, 1, 2, 2, 3] !! i
| even i = i `quot` 2 - 1
| otherwise = fromBool (isPrimeTable V.! i) + fromBool (isPrimeTable V.! (i - 2)) + i `quot` 2 - 2 | 286 | solve = foldl' (\r i -> r + contrib i * f i) 0 [1 .. to]
where
to = head fib
f i | i <= 7 = [0, 0, 1, 1, 1, 2, 2, 3] !! i
| even i = i `quot` 2 - 1
| otherwise = fromBool (isPrimeTable V.! i) + fromBool (isPrimeTable V.! (i - 2)) + i `quot` 2 - 2 | 273 | false | true | 1 | 14 | 97 | 206 | 102 | 104 | null | null |
jkachmar/servant-persistent-realworld | src/Api/User.hs | mit | --------------------------------------------------------------------------------
-- TODO - make a `Common` module to store duplicated code such as this
-- | Return a textual view of a JWT from a token, valid for a given duration
-- of seconds
mkJWT :: Token -> NominalDiffTime -> App JWTText
mkJWT token duration = do
-- Try to make a JWT with the settings from the Reader environment.
settings <- view jwtSettings
expires <- liftIO $ Just . (addUTCTime duration) <$> getCurrentTime
tryJWT <- liftIO $ makeJWT token settings expires
case tryJWT of
-- If JWT generation failed, log the error and throw a 500
Left e -> addNamespace "jwt_generation" $ do
logErrorM [logt|JWT generation failed with the error #{e}|]
throwM err500
Right lazyJWT -> pure . JWTText . decodeUtf8 . toStrict $ lazyJWT | 830 | mkJWT :: Token -> NominalDiffTime -> App JWTText
mkJWT token duration = do
-- Try to make a JWT with the settings from the Reader environment.
settings <- view jwtSettings
expires <- liftIO $ Just . (addUTCTime duration) <$> getCurrentTime
tryJWT <- liftIO $ makeJWT token settings expires
case tryJWT of
-- If JWT generation failed, log the error and throw a 500
Left e -> addNamespace "jwt_generation" $ do
logErrorM [logt|JWT generation failed with the error #{e}|]
throwM err500
Right lazyJWT -> pure . JWTText . decodeUtf8 . toStrict $ lazyJWT | 587 | mkJWT token duration = do
-- Try to make a JWT with the settings from the Reader environment.
settings <- view jwtSettings
expires <- liftIO $ Just . (addUTCTime duration) <$> getCurrentTime
tryJWT <- liftIO $ makeJWT token settings expires
case tryJWT of
-- If JWT generation failed, log the error and throw a 500
Left e -> addNamespace "jwt_generation" $ do
logErrorM [logt|JWT generation failed with the error #{e}|]
throwM err500
Right lazyJWT -> pure . JWTText . decodeUtf8 . toStrict $ lazyJWT | 538 | true | true | 0 | 14 | 165 | 156 | 74 | 82 | null | null |
christiaanb/ghc | compiler/main/DriverPipeline.hs | bsd-3-clause | checkLinkInfo :: DynFlags -> [PackageKey] -> FilePath -> IO Bool
checkLinkInfo dflags pkg_deps exe_file
| not (platformSupportsSavingLinkOpts (platformOS (targetPlatform dflags)))
-- ToDo: Windows and OS X do not use the ELF binary format, so
-- readelf does not work there. We need to find another way to do
-- this.
= return False -- conservatively we should return True, but not
-- linking in this case was the behaviour for a long
-- time so we leave it as-is.
| otherwise
= do
link_info <- getLinkInfo dflags pkg_deps
debugTraceMsg dflags 3 $ text ("Link info: " ++ link_info)
m_exe_link_info <- readElfSection dflags ghcLinkInfoSectionName exe_file
debugTraceMsg dflags 3 $ text ("Exe link info: " ++ show m_exe_link_info)
return (Just link_info /= m_exe_link_info) | 826 | checkLinkInfo :: DynFlags -> [PackageKey] -> FilePath -> IO Bool
checkLinkInfo dflags pkg_deps exe_file
| not (platformSupportsSavingLinkOpts (platformOS (targetPlatform dflags)))
-- ToDo: Windows and OS X do not use the ELF binary format, so
-- readelf does not work there. We need to find another way to do
-- this.
= return False -- conservatively we should return True, but not
-- linking in this case was the behaviour for a long
-- time so we leave it as-is.
| otherwise
= do
link_info <- getLinkInfo dflags pkg_deps
debugTraceMsg dflags 3 $ text ("Link info: " ++ link_info)
m_exe_link_info <- readElfSection dflags ghcLinkInfoSectionName exe_file
debugTraceMsg dflags 3 $ text ("Exe link info: " ++ show m_exe_link_info)
return (Just link_info /= m_exe_link_info) | 826 | checkLinkInfo dflags pkg_deps exe_file
| not (platformSupportsSavingLinkOpts (platformOS (targetPlatform dflags)))
-- ToDo: Windows and OS X do not use the ELF binary format, so
-- readelf does not work there. We need to find another way to do
-- this.
= return False -- conservatively we should return True, but not
-- linking in this case was the behaviour for a long
-- time so we leave it as-is.
| otherwise
= do
link_info <- getLinkInfo dflags pkg_deps
debugTraceMsg dflags 3 $ text ("Link info: " ++ link_info)
m_exe_link_info <- readElfSection dflags ghcLinkInfoSectionName exe_file
debugTraceMsg dflags 3 $ text ("Exe link info: " ++ show m_exe_link_info)
return (Just link_info /= m_exe_link_info) | 761 | false | true | 0 | 14 | 175 | 173 | 81 | 92 | null | null |
nyirog/cis194 | lec04.hs | unlicense | maze4' c = maze4 c | 18 | maze4' c = maze4 c | 18 | maze4' c = maze4 c | 18 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
olorin/amazonka | amazonka/src/Network/AWS/Internal/HTTP.hs | mpl-2.0 | waiter :: ( MonadCatch m
, MonadResource m
, MonadReader r m
, HasEnv r
, AWSRequest a
)
=> Wait a
-> a
-> m (Maybe Error)
waiter w@Wait{..} x = do
e@Env{..} <- view environment
rq <- configured x
retrying policy (check _envLogger) (result rq <$> perform e rq) >>= exit
where
policy = limitRetries _waitAttempts
<> constantDelay (microseconds _waitDelay)
check e n (a, _) = msg e n a >> return (retry a)
where
retry AcceptSuccess = False
retry AcceptFailure = False
retry AcceptRetry = True
result rq = first (fromMaybe AcceptRetry . accept w rq) . join (,)
exit (AcceptSuccess, _) = return Nothing
exit (_, Left e) = return (Just e)
exit (_, _) = return Nothing
msg l n a = logDebug l
. mconcat
. intersperse " "
$ [ "[Await " <> build _waitName <> "]"
, build a
, "after"
, build (n + 1)
, "attempts."
]
-- | The 'Service' is configured + unwrapped at this point. | 1,122 | waiter :: ( MonadCatch m
, MonadResource m
, MonadReader r m
, HasEnv r
, AWSRequest a
)
=> Wait a
-> a
-> m (Maybe Error)
waiter w@Wait{..} x = do
e@Env{..} <- view environment
rq <- configured x
retrying policy (check _envLogger) (result rq <$> perform e rq) >>= exit
where
policy = limitRetries _waitAttempts
<> constantDelay (microseconds _waitDelay)
check e n (a, _) = msg e n a >> return (retry a)
where
retry AcceptSuccess = False
retry AcceptFailure = False
retry AcceptRetry = True
result rq = first (fromMaybe AcceptRetry . accept w rq) . join (,)
exit (AcceptSuccess, _) = return Nothing
exit (_, Left e) = return (Just e)
exit (_, _) = return Nothing
msg l n a = logDebug l
. mconcat
. intersperse " "
$ [ "[Await " <> build _waitName <> "]"
, build a
, "after"
, build (n + 1)
, "attempts."
]
-- | The 'Service' is configured + unwrapped at this point. | 1,122 | waiter w@Wait{..} x = do
e@Env{..} <- view environment
rq <- configured x
retrying policy (check _envLogger) (result rq <$> perform e rq) >>= exit
where
policy = limitRetries _waitAttempts
<> constantDelay (microseconds _waitDelay)
check e n (a, _) = msg e n a >> return (retry a)
where
retry AcceptSuccess = False
retry AcceptFailure = False
retry AcceptRetry = True
result rq = first (fromMaybe AcceptRetry . accept w rq) . join (,)
exit (AcceptSuccess, _) = return Nothing
exit (_, Left e) = return (Just e)
exit (_, _) = return Nothing
msg l n a = logDebug l
. mconcat
. intersperse " "
$ [ "[Await " <> build _waitName <> "]"
, build a
, "after"
, build (n + 1)
, "attempts."
]
-- | The 'Service' is configured + unwrapped at this point. | 928 | false | true | 6 | 12 | 424 | 333 | 176 | 157 | null | null |
DaMSL/K3 | src/Language/K3/Core/Declaration.hs | apache-2.0 | isDInferredProvenance _ = False | 53 | isDInferredProvenance _ = False | 53 | isDInferredProvenance _ = False | 53 | false | false | 0 | 5 | 25 | 9 | 4 | 5 | null | null |
fmapfmapfmap/amazonka | amazonka-ml/gen/Network/AWS/MachineLearning/GetMLModel.hs | mpl-2.0 | -- | The MLModel ID which is same as the 'MLModelId' in the request.
gmlmrsMLModelId :: Lens' GetMLModelResponse (Maybe Text)
gmlmrsMLModelId = lens _gmlmrsMLModelId (\ s a -> s{_gmlmrsMLModelId = a}) | 200 | gmlmrsMLModelId :: Lens' GetMLModelResponse (Maybe Text)
gmlmrsMLModelId = lens _gmlmrsMLModelId (\ s a -> s{_gmlmrsMLModelId = a}) | 131 | gmlmrsMLModelId = lens _gmlmrsMLModelId (\ s a -> s{_gmlmrsMLModelId = a}) | 74 | true | true | 0 | 9 | 30 | 46 | 25 | 21 | null | null |
kajigor/uKanren_transformations | src/CPD/LocalControl.hs | bsd-3-clause | msgExists gs hs | length gs == length hs =
all (\x -> case x of (Invoke f _, Invoke g _) -> f == g; _ -> False) $ zip gs hs | 125 | msgExists gs hs | length gs == length hs =
all (\x -> case x of (Invoke f _, Invoke g _) -> f == g; _ -> False) $ zip gs hs | 125 | msgExists gs hs | length gs == length hs =
all (\x -> case x of (Invoke f _, Invoke g _) -> f == g; _ -> False) $ zip gs hs | 125 | false | false | 0 | 12 | 34 | 84 | 40 | 44 | null | null |
jml/difftodo | tests/Main.hs | apache-2.0 | main :: IO ()
main = defaultMain tests | 38 | main :: IO ()
main = defaultMain tests | 38 | main = defaultMain tests | 24 | false | true | 0 | 7 | 7 | 25 | 10 | 15 | null | null |
joranvar/GCJ | src/gcj-lib/Y2017/Q/A.hs | gpl-3.0 | write (S s) = toS $ " " ++ show s ++ "\n" | 41 | write (S s) = toS $ " " ++ show s ++ "\n" | 41 | write (S s) = toS $ " " ++ show s ++ "\n" | 41 | false | false | 0 | 7 | 12 | 31 | 14 | 17 | null | null |
rahulmutt/ghcvm | compiler/Eta/CodeGen/Prim.hs | bsd-3-clause | simpleOp Addr2Int64Op = Just idOp | 33 | simpleOp Addr2Int64Op = Just idOp | 33 | simpleOp Addr2Int64Op = Just idOp | 33 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
fferreira/hnh | CodeGen.hs | gpl-3.0 | procK ke@(FunK fun params body k) =
do cfun <- newCVar fun
params' <- mapM (\p -> newCVar p) params
body' <- procK body
addFun (createFun (desc ke) cfun params' body')
code <- procK k
return code | 224 | procK ke@(FunK fun params body k) =
do cfun <- newCVar fun
params' <- mapM (\p -> newCVar p) params
body' <- procK body
addFun (createFun (desc ke) cfun params' body')
code <- procK k
return code | 224 | procK ke@(FunK fun params body k) =
do cfun <- newCVar fun
params' <- mapM (\p -> newCVar p) params
body' <- procK body
addFun (createFun (desc ke) cfun params' body')
code <- procK k
return code | 224 | false | false | 0 | 11 | 65 | 107 | 48 | 59 | null | null |
vladimir-ipatov/ganeti | test/hs/Test/Ganeti/TestCommon.hs | gpl-2.0 | genPropParser :: (Show a, Eq a) => Parser a -> String -> a -> Property
genPropParser parser s expected =
case parseOnly parser $ pack s of
Left msg -> failTest $ "Parsing failed: " ++ msg
Right obtained -> expected ==? obtained
-- | Generate an arbitrary non negative integer number | 293 | genPropParser :: (Show a, Eq a) => Parser a -> String -> a -> Property
genPropParser parser s expected =
case parseOnly parser $ pack s of
Left msg -> failTest $ "Parsing failed: " ++ msg
Right obtained -> expected ==? obtained
-- | Generate an arbitrary non negative integer number | 293 | genPropParser parser s expected =
case parseOnly parser $ pack s of
Left msg -> failTest $ "Parsing failed: " ++ msg
Right obtained -> expected ==? obtained
-- | Generate an arbitrary non negative integer number | 222 | false | true | 0 | 9 | 62 | 99 | 46 | 53 | null | null |
tjakway/ghcjvm | compiler/cmm/CmmImplementSwitchPlans.hs | bsd-3-clause | --
-- This module replaces Switch statements as generated by the Stg -> Cmm
-- transformation, which might be huge and sparse and hence unsuitable for
-- assembly code, by proper constructs (if-then-else trees, dense jump tables).
--
-- The actual, abstract strategy is determined by createSwitchPlan in
-- CmmSwitch and returned as a SwitchPlan; here is just the implementation in
-- terms of Cmm code. See Note [Cmm Switches, the general plan] in CmmSwitch.
--
-- This division into different modules is both to clearly separte concerns,
-- but also because createSwitchPlan needs access to the constructors of
-- SwitchTargets, a data type exported abstractly by CmmSwitch.
--
-- | Traverses the 'CmmGraph', making sure that 'CmmSwitch' are suitable for
-- code generation.
cmmImplementSwitchPlans :: DynFlags -> CmmGraph -> UniqSM CmmGraph
cmmImplementSwitchPlans dflags g
| targetSupportsSwitch (hscTarget dflags) = return g
| otherwise = do
blocks' <- concat `fmap` mapM (visitSwitches dflags) (toBlockList g)
return $ ofBlockList (g_entry g) blocks' | 1,073 | cmmImplementSwitchPlans :: DynFlags -> CmmGraph -> UniqSM CmmGraph
cmmImplementSwitchPlans dflags g
| targetSupportsSwitch (hscTarget dflags) = return g
| otherwise = do
blocks' <- concat `fmap` mapM (visitSwitches dflags) (toBlockList g)
return $ ofBlockList (g_entry g) blocks' | 295 | cmmImplementSwitchPlans dflags g
| targetSupportsSwitch (hscTarget dflags) = return g
| otherwise = do
blocks' <- concat `fmap` mapM (visitSwitches dflags) (toBlockList g)
return $ ofBlockList (g_entry g) blocks' | 228 | true | true | 0 | 13 | 177 | 120 | 63 | 57 | null | null |
raichoo/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | pErrorHandlers :: [Name] -> Idris ()
pErrorHandlers ns = updateIState (\i ->
i { idris_errorhandlers = idris_errorhandlers i ++ ns }) | 157 | pErrorHandlers :: [Name] -> Idris ()
pErrorHandlers ns = updateIState (\i ->
i { idris_errorhandlers = idris_errorhandlers i ++ ns }) | 157 | pErrorHandlers ns = updateIState (\i ->
i { idris_errorhandlers = idris_errorhandlers i ++ ns }) | 120 | false | true | 0 | 11 | 44 | 56 | 28 | 28 | null | null |
Melvar/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | expandNS :: SyntaxInfo -> Name -> Name
expandNS syn n@(NS _ _) = n | 66 | expandNS :: SyntaxInfo -> Name -> Name
expandNS syn n@(NS _ _) = n | 66 | expandNS syn n@(NS _ _) = n | 27 | false | true | 1 | 8 | 13 | 44 | 19 | 25 | null | null |
jkramer/database-abstract | Database/Abstract.hs | gpl-3.0 | -- Compare two things.
whereSQL style (Compare comparator left right) =
Just (
quoteSQL style left
++ " " ++
comparatorSQL style comparator
++ " " ++
quoteSQL style right
) | 252 | whereSQL style (Compare comparator left right) =
Just (
quoteSQL style left
++ " " ++
comparatorSQL style comparator
++ " " ++
quoteSQL style right
) | 225 | whereSQL style (Compare comparator left right) =
Just (
quoteSQL style left
++ " " ++
comparatorSQL style comparator
++ " " ++
quoteSQL style right
) | 225 | true | false | 0 | 11 | 110 | 59 | 28 | 31 | null | null |
nakamuray/mangekyo | src/Mangekyo/Builtin.hs | bsd-2-clause | -- TODO: split using regex
split_ :: Value -> Value -> Mangekyo Value
split_ (String sep) (String t) = return $ Array $ V.fromList $ map String $ T.splitOn sep t | 161 | split_ :: Value -> Value -> Mangekyo Value
split_ (String sep) (String t) = return $ Array $ V.fromList $ map String $ T.splitOn sep t | 134 | split_ (String sep) (String t) = return $ Array $ V.fromList $ map String $ T.splitOn sep t | 91 | true | true | 0 | 10 | 30 | 72 | 34 | 38 | null | null |
rsasse/tamarin-prover | lib/theory/src/Theory.hs | gpl-3.0 | prettyLemmaName :: HighlightDocument d => Lemma p -> d
prettyLemmaName l = case L.get lAttributes l of
[] -> text (L.get lName l)
as -> text (L.get lName l) <->
(brackets $ fsep $ punctuate comma $ map prettyLemmaAttribute as)
where
prettyLemmaAttribute SourceLemma = text "sources"
prettyLemmaAttribute ReuseLemma = text "reuse"
prettyLemmaAttribute InvariantLemma = text "use_induction"
prettyLemmaAttribute (HideLemma s) = text ("hide_lemma=" ++ s)
prettyLemmaAttribute (LemmaHeuristic h) = text ("heuristic=" ++ h)
prettyLemmaAttribute LHSLemma = text "left"
prettyLemmaAttribute RHSLemma = text "right"
-- prettyLemmaAttribute BothLemma = text "both"
-- | Pretty print the diff lemma name | 802 | prettyLemmaName :: HighlightDocument d => Lemma p -> d
prettyLemmaName l = case L.get lAttributes l of
[] -> text (L.get lName l)
as -> text (L.get lName l) <->
(brackets $ fsep $ punctuate comma $ map prettyLemmaAttribute as)
where
prettyLemmaAttribute SourceLemma = text "sources"
prettyLemmaAttribute ReuseLemma = text "reuse"
prettyLemmaAttribute InvariantLemma = text "use_induction"
prettyLemmaAttribute (HideLemma s) = text ("hide_lemma=" ++ s)
prettyLemmaAttribute (LemmaHeuristic h) = text ("heuristic=" ++ h)
prettyLemmaAttribute LHSLemma = text "left"
prettyLemmaAttribute RHSLemma = text "right"
-- prettyLemmaAttribute BothLemma = text "both"
-- | Pretty print the diff lemma name | 802 | prettyLemmaName l = case L.get lAttributes l of
[] -> text (L.get lName l)
as -> text (L.get lName l) <->
(brackets $ fsep $ punctuate comma $ map prettyLemmaAttribute as)
where
prettyLemmaAttribute SourceLemma = text "sources"
prettyLemmaAttribute ReuseLemma = text "reuse"
prettyLemmaAttribute InvariantLemma = text "use_induction"
prettyLemmaAttribute (HideLemma s) = text ("hide_lemma=" ++ s)
prettyLemmaAttribute (LemmaHeuristic h) = text ("heuristic=" ++ h)
prettyLemmaAttribute LHSLemma = text "left"
prettyLemmaAttribute RHSLemma = text "right"
-- prettyLemmaAttribute BothLemma = text "both"
-- | Pretty print the diff lemma name | 747 | false | true | 0 | 12 | 204 | 214 | 102 | 112 | null | null |
karamellpelle/grid | designer/source/Linear.hs | gpl-3.0 | mat4Ortho :: Float -> Float -> Float -> Float -> Float -> Float -> Mat4
mat4Ortho left right bottom top near far =
let tx = (right + left) / (left - right)
ty = (top + bottom) / (bottom - top)
tz = (far + near) / (near - far)
in Mat4 (2 / (right - left)) 0 0 0
0 (2 / (top - bottom)) 0 0
0 0 (2 / (near - far)) 0
tx ty tz 1 | 388 | mat4Ortho :: Float -> Float -> Float -> Float -> Float -> Float -> Mat4
mat4Ortho left right bottom top near far =
let tx = (right + left) / (left - right)
ty = (top + bottom) / (bottom - top)
tz = (far + near) / (near - far)
in Mat4 (2 / (right - left)) 0 0 0
0 (2 / (top - bottom)) 0 0
0 0 (2 / (near - far)) 0
tx ty tz 1 | 388 | mat4Ortho left right bottom top near far =
let tx = (right + left) / (left - right)
ty = (top + bottom) / (bottom - top)
tz = (far + near) / (near - far)
in Mat4 (2 / (right - left)) 0 0 0
0 (2 / (top - bottom)) 0 0
0 0 (2 / (near - far)) 0
tx ty tz 1 | 316 | false | true | 0 | 11 | 145 | 198 | 105 | 93 | null | null |
rahulmutt/ghcvm | compiler/Eta/BasicTypes/OccName.hs | bsd-3-clause | startsWithUnderscore :: OccName -> Bool
-- ^ Haskell 98 encourages compilers to suppress warnings about unsed
-- names in a pattern if they start with @_@: this implements that test
startsWithUnderscore occ = case occNameString occ of
('_' : _) -> True
_other -> False
{-
************************************************************************
* *
\subsection{Making system names}
* *
************************************************************************
Here's our convention for splitting up the interface file name space:
d... dictionary identifiers
(local variables, so no name-clash worries)
All of these other OccNames contain a mixture of alphabetic
and symbolic characters, and hence cannot possibly clash with
a user-written type or function name
$f... Dict-fun identifiers (from inst decls)
$dmop Default method for 'op'
$pnC n'th superclass selector for class C
$wf Worker for functtoin 'f'
$sf.. Specialised version of f
T:C Tycon for dictionary for class C
D:C Data constructor for dictionary for class C
NTCo:T Coercion connecting newtype T with its representation type
TFCo:R Coercion connecting a data family to its respresentation type R
In encoded form these appear as Zdfxxx etc
:... keywords (export:, letrec: etc.)
--- I THINK THIS IS WRONG!
This knowledge is encoded in the following functions.
@mk_deriv@ generates an @OccName@ from the prefix and a string.
NB: The string must already be encoded!
-} | 1,776 | startsWithUnderscore :: OccName -> Bool
startsWithUnderscore occ = case occNameString occ of
('_' : _) -> True
_other -> False
{-
************************************************************************
* *
\subsection{Making system names}
* *
************************************************************************
Here's our convention for splitting up the interface file name space:
d... dictionary identifiers
(local variables, so no name-clash worries)
All of these other OccNames contain a mixture of alphabetic
and symbolic characters, and hence cannot possibly clash with
a user-written type or function name
$f... Dict-fun identifiers (from inst decls)
$dmop Default method for 'op'
$pnC n'th superclass selector for class C
$wf Worker for functtoin 'f'
$sf.. Specialised version of f
T:C Tycon for dictionary for class C
D:C Data constructor for dictionary for class C
NTCo:T Coercion connecting newtype T with its representation type
TFCo:R Coercion connecting a data family to its respresentation type R
In encoded form these appear as Zdfxxx etc
:... keywords (export:, letrec: etc.)
--- I THINK THIS IS WRONG!
This knowledge is encoded in the following functions.
@mk_deriv@ generates an @OccName@ from the prefix and a string.
NB: The string must already be encoded!
-} | 1,634 | startsWithUnderscore occ = case occNameString occ of
('_' : _) -> True
_other -> False
{-
************************************************************************
* *
\subsection{Making system names}
* *
************************************************************************
Here's our convention for splitting up the interface file name space:
d... dictionary identifiers
(local variables, so no name-clash worries)
All of these other OccNames contain a mixture of alphabetic
and symbolic characters, and hence cannot possibly clash with
a user-written type or function name
$f... Dict-fun identifiers (from inst decls)
$dmop Default method for 'op'
$pnC n'th superclass selector for class C
$wf Worker for functtoin 'f'
$sf.. Specialised version of f
T:C Tycon for dictionary for class C
D:C Data constructor for dictionary for class C
NTCo:T Coercion connecting newtype T with its representation type
TFCo:R Coercion connecting a data family to its respresentation type R
In encoded form these appear as Zdfxxx etc
:... keywords (export:, letrec: etc.)
--- I THINK THIS IS WRONG!
This knowledge is encoded in the following functions.
@mk_deriv@ generates an @OccName@ from the prefix and a string.
NB: The string must already be encoded!
-} | 1,594 | true | true | 0 | 9 | 556 | 47 | 25 | 22 | null | null |
amccausl/Swish | Swish/HaskellRDF/RDFDatatypeXsdIntegerTest.hs | lgpl-2.1 | testRuleFwdAbs02 = testRuleFwd "testRuleFwdAbs02" ruleabs abs02inp abs02fwd | 75 | testRuleFwdAbs02 = testRuleFwd "testRuleFwdAbs02" ruleabs abs02inp abs02fwd | 75 | testRuleFwdAbs02 = testRuleFwd "testRuleFwdAbs02" ruleabs abs02inp abs02fwd | 75 | false | false | 0 | 5 | 6 | 15 | 7 | 8 | null | null |
eijian/deeplearning | src/Parser.hs | bsd-3-clause | rClass :: String
rClass = "class" | 33 | rClass :: String
rClass = "class" | 33 | rClass = "class" | 16 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
Javran/misc | proc-parser/src/Main.hs | mit | parsingTestReseek nTimes fPath parser = do
h <- openFile fPath ReadMode
replicateM_ nTimes $ do
r <- reseekAndParse h parser
pure (rnf r)
hClose h | 160 | parsingTestReseek nTimes fPath parser = do
h <- openFile fPath ReadMode
replicateM_ nTimes $ do
r <- reseekAndParse h parser
pure (rnf r)
hClose h | 160 | parsingTestReseek nTimes fPath parser = do
h <- openFile fPath ReadMode
replicateM_ nTimes $ do
r <- reseekAndParse h parser
pure (rnf r)
hClose h | 160 | false | false | 0 | 12 | 38 | 65 | 27 | 38 | null | null |
brendanhay/gogol | gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ShoppingAdsProgramStatusRegionStatus' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sapsrsDisApprovalDate'
--
-- * 'sapsrsReviewIssues'
--
-- * 'sapsrsReviewEligibilityStatus'
--
-- * 'sapsrsIneligibilityReason'
--
-- * 'sapsrsRegionCodes'
--
-- * 'sapsrsEligibilityStatus'
shoppingAdsProgramStatusRegionStatus
:: ShoppingAdsProgramStatusRegionStatus
shoppingAdsProgramStatusRegionStatus =
ShoppingAdsProgramStatusRegionStatus'
{ _sapsrsDisApprovalDate = Nothing
, _sapsrsReviewIssues = Nothing
, _sapsrsReviewEligibilityStatus = Nothing
, _sapsrsIneligibilityReason = Nothing
, _sapsrsRegionCodes = Nothing
, _sapsrsEligibilityStatus = Nothing
} | 793 | shoppingAdsProgramStatusRegionStatus
:: ShoppingAdsProgramStatusRegionStatus
shoppingAdsProgramStatusRegionStatus =
ShoppingAdsProgramStatusRegionStatus'
{ _sapsrsDisApprovalDate = Nothing
, _sapsrsReviewIssues = Nothing
, _sapsrsReviewEligibilityStatus = Nothing
, _sapsrsIneligibilityReason = Nothing
, _sapsrsRegionCodes = Nothing
, _sapsrsEligibilityStatus = Nothing
} | 406 | shoppingAdsProgramStatusRegionStatus =
ShoppingAdsProgramStatusRegionStatus'
{ _sapsrsDisApprovalDate = Nothing
, _sapsrsReviewIssues = Nothing
, _sapsrsReviewEligibilityStatus = Nothing
, _sapsrsIneligibilityReason = Nothing
, _sapsrsRegionCodes = Nothing
, _sapsrsEligibilityStatus = Nothing
} | 325 | true | true | 1 | 7 | 118 | 71 | 47 | 24 | null | null |
robeverest/accelerate | Data/Array/Accelerate/Language.hs | bsd-3-clause | -- | Call a foreign function with foreign implementations for three different backends.
foreignAcc3 :: (Arrays acc, Arrays res, ForeignFun ff1, ForeignFun ff2, ForeignFun ff3)
=> ff1 acc res
-> ff2 acc res
-> ff3 acc res
-> (Acc acc -> Acc res)
-> Acc acc
-> Acc res
foreignAcc3 ff1 ff2 = Acc $$$ Foreign ff1 $$ Acc $$$ Foreign ff2 $$ Acc $$$ Foreign | 426 | foreignAcc3 :: (Arrays acc, Arrays res, ForeignFun ff1, ForeignFun ff2, ForeignFun ff3)
=> ff1 acc res
-> ff2 acc res
-> ff3 acc res
-> (Acc acc -> Acc res)
-> Acc acc
-> Acc res
foreignAcc3 ff1 ff2 = Acc $$$ Foreign ff1 $$ Acc $$$ Foreign ff2 $$ Acc $$$ Foreign | 338 | foreignAcc3 ff1 ff2 = Acc $$$ Foreign ff1 $$ Acc $$$ Foreign ff2 $$ Acc $$$ Foreign | 83 | true | true | 0 | 12 | 141 | 130 | 62 | 68 | null | null |
trskop/yx | src/YX/Shell/Bash.hs | bsd-3-clause | mkEnvironment :: ProjectConfig -> Text -> Text
mkEnvironment _ _ = "" | 69 | mkEnvironment :: ProjectConfig -> Text -> Text
mkEnvironment _ _ = "" | 69 | mkEnvironment _ _ = "" | 22 | false | true | 0 | 6 | 11 | 24 | 12 | 12 | null | null |
stevezhee/grm | grm.hs | bsd-3-clause | types _ [] = unreachable | 24 | types _ [] = unreachable | 24 | types _ [] = unreachable | 24 | false | false | 0 | 6 | 4 | 17 | 7 | 10 | null | null |
avieth/type-grammar | Data/Type/Grammar.hs | bsd-3-clause | pOneOfValue :: POneOf index anything -> anything
pOneOfValue term = case term of
POneOfHere x -> x
POneOfThere rest -> pOneOfValue rest | 143 | pOneOfValue :: POneOf index anything -> anything
pOneOfValue term = case term of
POneOfHere x -> x
POneOfThere rest -> pOneOfValue rest | 143 | pOneOfValue term = case term of
POneOfHere x -> x
POneOfThere rest -> pOneOfValue rest | 94 | false | true | 3 | 6 | 29 | 46 | 22 | 24 | null | null |
GregorySchwartz/convert-annotation | src/EnsemblConvert.hs | gpl-3.0 | nullNull _ = return $ "" | 34 | nullNull _ = return $ "" | 34 | nullNull _ = return $ "" | 34 | false | false | 0 | 5 | 15 | 13 | 6 | 7 | null | null |
ruud-v-a/blog | src/Type.hs | gpl-3.0 | getFamily :: TagProperties -> FontFamily
getFamily t = case t of
_ | Html.isCode t -> Mono
_ | Html.isH3 t -> Sans
_ | Html.isVar t -> Sans
_ | Html.isBlockQuote t -> Serif
_ | Html.isArchiveLink t -> Serif
_ | Html.isHeader t -> Serif
_ | Html.isHeading t -> Serif
_ | Html.isTeaserLink t -> Serif
_ | otherwise -> Sans | 384 | getFamily :: TagProperties -> FontFamily
getFamily t = case t of
_ | Html.isCode t -> Mono
_ | Html.isH3 t -> Sans
_ | Html.isVar t -> Sans
_ | Html.isBlockQuote t -> Serif
_ | Html.isArchiveLink t -> Serif
_ | Html.isHeader t -> Serif
_ | Html.isHeading t -> Serif
_ | Html.isTeaserLink t -> Serif
_ | otherwise -> Sans | 384 | getFamily t = case t of
_ | Html.isCode t -> Mono
_ | Html.isH3 t -> Sans
_ | Html.isVar t -> Sans
_ | Html.isBlockQuote t -> Serif
_ | Html.isArchiveLink t -> Serif
_ | Html.isHeader t -> Serif
_ | Html.isHeading t -> Serif
_ | Html.isTeaserLink t -> Serif
_ | otherwise -> Sans | 343 | false | true | 9 | 8 | 127 | 170 | 72 | 98 | null | null |
olsner/ghc | compiler/simplCore/SAT.hs | bsd-3-clause | satBind (Rec pairs) interesting_ids = do
let (binders, rhss) = unzip pairs
rhss_SATed <- mapM (\e -> satTopLevelExpr e interesting_ids) rhss
let (rhss', sat_info_rhss') = unzip rhss_SATed
return (Rec (zipEqual "satBind" binders rhss'), mergeIdSATInfos sat_info_rhss') | 283 | satBind (Rec pairs) interesting_ids = do
let (binders, rhss) = unzip pairs
rhss_SATed <- mapM (\e -> satTopLevelExpr e interesting_ids) rhss
let (rhss', sat_info_rhss') = unzip rhss_SATed
return (Rec (zipEqual "satBind" binders rhss'), mergeIdSATInfos sat_info_rhss') | 283 | satBind (Rec pairs) interesting_ids = do
let (binders, rhss) = unzip pairs
rhss_SATed <- mapM (\e -> satTopLevelExpr e interesting_ids) rhss
let (rhss', sat_info_rhss') = unzip rhss_SATed
return (Rec (zipEqual "satBind" binders rhss'), mergeIdSATInfos sat_info_rhss') | 283 | false | false | 0 | 11 | 50 | 108 | 51 | 57 | null | null |
alphaHeavy/cabal | cabal-install/Distribution/Client/Dependency/Modular/Dependency.hs | bsd-3-clause | showVar (S qsn) = showQSN qsn | 29 | showVar (S qsn) = showQSN qsn | 29 | showVar (S qsn) = showQSN qsn | 29 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
dlewissandy/lambda-blas | src/Numerical/BLAS/Single.hs | bsd-3-clause | snrm2 :: Int-> Vector Float-> Int-> Float
snrm2 = nrm2 | 54 | snrm2 :: Int-> Vector Float-> Int-> Float
snrm2 = nrm2 | 54 | snrm2 = nrm2 | 12 | false | true | 0 | 7 | 9 | 26 | 13 | 13 | null | null |
AaronFriel/hyhac | src/Database/HyperDex/Internal/Util.hs | bsd-3-clause | -- | Marshal a ByteString into a NUL terminated C string.
--
-- * the ByteString string /must not/ contain any NUL characters
--
-- * as with 'newCAString', new storage is allocated for the C String
-- and must be explicitly freed
--
newCBString :: ByteString -> IO CString
newCBString bs = unsafeUseAsCString bs
(\cs -> do
let l = BS.length bs
buf <- mallocArray0 l
copyBytes buf cs l
pokeElemOff buf l 0
return buf) | 541 | newCBString :: ByteString -> IO CString
newCBString bs = unsafeUseAsCString bs
(\cs -> do
let l = BS.length bs
buf <- mallocArray0 l
copyBytes buf cs l
pokeElemOff buf l 0
return buf) | 305 | newCBString bs = unsafeUseAsCString bs
(\cs -> do
let l = BS.length bs
buf <- mallocArray0 l
copyBytes buf cs l
pokeElemOff buf l 0
return buf) | 265 | true | true | 0 | 14 | 200 | 91 | 44 | 47 | null | null |
TomMD/ghc | libraries/template-haskell/Language/Haskell/TH/Ppr.hs | bsd-3-clause | pprPat _ (TupP ps) = parens $ sep $ punctuate comma $ map ppr ps | 67 | pprPat _ (TupP ps) = parens $ sep $ punctuate comma $ map ppr ps | 67 | pprPat _ (TupP ps) = parens $ sep $ punctuate comma $ map ppr ps | 67 | false | false | 5 | 6 | 17 | 41 | 17 | 24 | null | null |
alexander-at-github/eta | compiler/ETA/CodeGen/Rts.hs | bsd-3-clause | indStaticType = obj stgIndStatic | 36 | indStaticType = obj stgIndStatic | 36 | indStaticType = obj stgIndStatic | 36 | false | false | 0 | 5 | 7 | 9 | 4 | 5 | null | null |
spechub/Hets | CoCASL/Sublogic.hs | gpl-2.0 | minCSigItem :: C_SIG_ITEM -> CoCASL_Sublogics
minCSigItem (CoDatatype_items l _) =
foldl sublogics_max theCoFeature $ map (minCoDatatype . item) l | 150 | minCSigItem :: C_SIG_ITEM -> CoCASL_Sublogics
minCSigItem (CoDatatype_items l _) =
foldl sublogics_max theCoFeature $ map (minCoDatatype . item) l | 150 | minCSigItem (CoDatatype_items l _) =
foldl sublogics_max theCoFeature $ map (minCoDatatype . item) l | 104 | false | true | 0 | 9 | 22 | 53 | 24 | 29 | null | null |
ezyang/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | needsCDecl (CCS_Label _) = True | 46 | needsCDecl (CCS_Label _) = True | 46 | needsCDecl (CCS_Label _) = True | 46 | false | false | 0 | 6 | 19 | 16 | 7 | 9 | null | null |
themattchan/tandoori | library/Tandoori/Typing/Repr.hs | bsd-3-clause | fromLHsType' :: GHC.LHsType GHC.Name -> WriterT PolyCtx Typing Ty
fromLHsType' = fromHsType' . unLoc | 100 | fromLHsType' :: GHC.LHsType GHC.Name -> WriterT PolyCtx Typing Ty
fromLHsType' = fromHsType' . unLoc | 100 | fromLHsType' = fromHsType' . unLoc | 34 | false | true | 0 | 7 | 13 | 33 | 16 | 17 | null | null |
rueshyna/gogol | gogol-prediction/gen/Network/Google/Prediction/Types/Product.hs | mpl-2.0 | -- | Number of numeric values for this feature in the data set.
addfinCount :: Lens' AnalyzeDataDescriptionFeaturesItemNumeric (Maybe Int64)
addfinCount
= lens _addfinCount (\ s a -> s{_addfinCount = a}) .
mapping _Coerce | 229 | addfinCount :: Lens' AnalyzeDataDescriptionFeaturesItemNumeric (Maybe Int64)
addfinCount
= lens _addfinCount (\ s a -> s{_addfinCount = a}) .
mapping _Coerce | 165 | addfinCount
= lens _addfinCount (\ s a -> s{_addfinCount = a}) .
mapping _Coerce | 88 | true | true | 0 | 10 | 40 | 55 | 28 | 27 | null | null |
gridaphobe/ghc | compiler/nativeGen/PPC/Ppr.hs | bsd-3-clause | pprInstr (MULLW reg1 reg2 ri@(RIReg _)) = pprLogic (sLit "mullw") reg1 reg2 ri | 78 | pprInstr (MULLW reg1 reg2 ri@(RIReg _)) = pprLogic (sLit "mullw") reg1 reg2 ri | 78 | pprInstr (MULLW reg1 reg2 ri@(RIReg _)) = pprLogic (sLit "mullw") reg1 reg2 ri | 78 | false | false | 0 | 10 | 12 | 43 | 21 | 22 | null | null |
input-output-hk/pos-haskell-prototype | core/test/Test/Pos/Core/Bi.hs | mit | roundTripStakesMapBi :: Property
roundTripStakesMapBi = eachOf 1000 genStakesMap roundTripsBiShow | 97 | roundTripStakesMapBi :: Property
roundTripStakesMapBi = eachOf 1000 genStakesMap roundTripsBiShow | 97 | roundTripStakesMapBi = eachOf 1000 genStakesMap roundTripsBiShow | 64 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
zlqhem/course2013-ModelChecking | SAT_problem/tests/Properties.hs | mit | isDiagonal (x,y) (x2, y2) = x /= x2 && (slope == 1 || slope == -1)
where slope = fromIntegral (y2-y) / fromIntegral (x2-x) | 124 | isDiagonal (x,y) (x2, y2) = x /= x2 && (slope == 1 || slope == -1)
where slope = fromIntegral (y2-y) / fromIntegral (x2-x) | 124 | isDiagonal (x,y) (x2, y2) = x /= x2 && (slope == 1 || slope == -1)
where slope = fromIntegral (y2-y) / fromIntegral (x2-x) | 124 | false | false | 1 | 9 | 25 | 85 | 42 | 43 | null | null |
AlexanderPankiv/ghc | compiler/cmm/PprC.hs | bsd-3-clause | floatComparison (MO_F_Ge _) = True | 36 | floatComparison (MO_F_Ge _) = True | 36 | floatComparison (MO_F_Ge _) = True | 36 | false | false | 0 | 6 | 6 | 16 | 7 | 9 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.