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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nick0x01/Win32-services | examples/simple.hs | bsd-3-clause | running = SERVICE_STATUS WIN32_OWN_PROCESS RUNNING [ACCEPT_STOP] nO_ERROR 0 0 0 | 79 | running = SERVICE_STATUS WIN32_OWN_PROCESS RUNNING [ACCEPT_STOP] nO_ERROR 0 0 0 | 79 | running = SERVICE_STATUS WIN32_OWN_PROCESS RUNNING [ACCEPT_STOP] nO_ERROR 0 0 0 | 79 | false | false | 0 | 6 | 9 | 24 | 12 | 12 | null | null |
rahulmutt/ghcvm | compiler/Eta/CodeGen/Closure.hs | bsd-3-clause | mkLFThunk :: Type -> TopLevelFlag -> [Id] -> UpdateFlag -> LambdaFormInfo
mkLFThunk thunkType topLevelFlag freeVars updateFlag
= -- Invariant: not updatable or lifted type
LFThunk {
lfTopLevelFlag = topLevelFlag,
lfNoFreeVars = null freeVars,
lfUpdatable = isUpdatable updateFlag,
lfStandardFormInfo = NonStandardThunk,
lfMaybeFunction = maybeFunction thunkType } | 399 | mkLFThunk :: Type -> TopLevelFlag -> [Id] -> UpdateFlag -> LambdaFormInfo
mkLFThunk thunkType topLevelFlag freeVars updateFlag
= -- Invariant: not updatable or lifted type
LFThunk {
lfTopLevelFlag = topLevelFlag,
lfNoFreeVars = null freeVars,
lfUpdatable = isUpdatable updateFlag,
lfStandardFormInfo = NonStandardThunk,
lfMaybeFunction = maybeFunction thunkType } | 399 | mkLFThunk thunkType topLevelFlag freeVars updateFlag
= -- Invariant: not updatable or lifted type
LFThunk {
lfTopLevelFlag = topLevelFlag,
lfNoFreeVars = null freeVars,
lfUpdatable = isUpdatable updateFlag,
lfStandardFormInfo = NonStandardThunk,
lfMaybeFunction = maybeFunction thunkType } | 325 | false | true | 0 | 8 | 80 | 81 | 45 | 36 | null | null |
LukaHorvat/ArtGallery | src/Geometry/Point.hs | mit | cross :: Vector -> Vector -> Double
cross (Point x1 y1) (Point x2 y2) = x1 * y2 - y1 * x2 | 89 | cross :: Vector -> Vector -> Double
cross (Point x1 y1) (Point x2 y2) = x1 * y2 - y1 * x2 | 89 | cross (Point x1 y1) (Point x2 y2) = x1 * y2 - y1 * x2 | 53 | false | true | 0 | 10 | 21 | 58 | 27 | 31 | null | null |
momomimachli/Hedsql-tests | src/Database/Hedsql/Examples/Create.hs | gpl-3.0 | ----------------------------------------
-- Constraints
----------------------------------------
--------------------
-- PRIMARY KEY
--------------------
{-|
Maria DB and SqLite:
> CREATE TABLE "People" ("personId" INTEGER PRIMARY KEY)
PostgreSQL:
> CREATE TABLE "People" ("personId" integer PRIMARY KEY)
-}
primaryKeyCol :: CreateStmt dbVendor
primaryKeyCol =
createTable "People" [wrap (col "personId" integer) /++ primary False] | 438 | primaryKeyCol :: CreateStmt dbVendor
primaryKeyCol =
createTable "People" [wrap (col "personId" integer) /++ primary False] | 127 | primaryKeyCol =
createTable "People" [wrap (col "personId" integer) /++ primary False] | 90 | true | true | 0 | 10 | 53 | 54 | 27 | 27 | null | null |
mattias-lundell/timber-llvm | src/Scp.hs | bsd-3-clause | scpBinds env (h:t) = do
h' <- scpBinds' env h
t' <- localStore (scpBinds env t)
return (h' ++ t') | 103 | scpBinds env (h:t) = do
h' <- scpBinds' env h
t' <- localStore (scpBinds env t)
return (h' ++ t') | 103 | scpBinds env (h:t) = do
h' <- scpBinds' env h
t' <- localStore (scpBinds env t)
return (h' ++ t') | 103 | false | false | 0 | 10 | 25 | 61 | 28 | 33 | null | null |
mpickering/hackage-server | Distribution/Server/Features/HoogleData.hs | bsd-3-clause | withWriter :: IO (Writer b) -> ((b -> IO ()) -> IO a) -> IO a
withWriter mkwriter action = bracket mkwriter wClose (action . wWrite) | 132 | withWriter :: IO (Writer b) -> ((b -> IO ()) -> IO a) -> IO a
withWriter mkwriter action = bracket mkwriter wClose (action . wWrite) | 132 | withWriter mkwriter action = bracket mkwriter wClose (action . wWrite) | 70 | false | true | 0 | 12 | 25 | 72 | 35 | 37 | null | null |
GaloisInc/halvm-ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | {-
Certain class operations from Prelude classes. They get their own
uniques so we can look them up easily when we want to conjure them up
during type checking.
-}
-- Just a placeholder for unbound variables produced by the renamer:
unboundKey :: Unique
unboundKey = mkPreludeMiscIdUnique 158 | 313 | unboundKey :: Unique
unboundKey = mkPreludeMiscIdUnique 158 | 78 | unboundKey = mkPreludeMiscIdUnique 158 | 57 | true | true | 1 | 5 | 68 | 19 | 9 | 10 | null | null |
haslab/SecreC | tests/Tests.hs | gpl-3.0 | runTestText :: PutText st -> Test -> IO (Counts, st)
runTestText (PutText put us0) t = do
(counts', us1) <- performTest reportStart reportError reportFailure us0 t
us2 <- put (showCounts counts') True us1
return (counts', us2)
where
reportStart ss us = put (showCounts (counts ss)) False us
reportError = reportProblem "Error:" "Error in: "
reportFailure = reportProblem "Failure:" "Failure in: "
reportProblem p0 p1 loc msg ss us = put line True us >> error "stop"
where line = "### " ++ kind ++ path' ++ "\n" ++ formatLocation loc ++ msg
kind = if null path' then p0 else p1
path' = showPath (path ss) | 647 | runTestText :: PutText st -> Test -> IO (Counts, st)
runTestText (PutText put us0) t = do
(counts', us1) <- performTest reportStart reportError reportFailure us0 t
us2 <- put (showCounts counts') True us1
return (counts', us2)
where
reportStart ss us = put (showCounts (counts ss)) False us
reportError = reportProblem "Error:" "Error in: "
reportFailure = reportProblem "Failure:" "Failure in: "
reportProblem p0 p1 loc msg ss us = put line True us >> error "stop"
where line = "### " ++ kind ++ path' ++ "\n" ++ formatLocation loc ++ msg
kind = if null path' then p0 else p1
path' = showPath (path ss) | 647 | runTestText (PutText put us0) t = do
(counts', us1) <- performTest reportStart reportError reportFailure us0 t
us2 <- put (showCounts counts') True us1
return (counts', us2)
where
reportStart ss us = put (showCounts (counts ss)) False us
reportError = reportProblem "Error:" "Error in: "
reportFailure = reportProblem "Failure:" "Failure in: "
reportProblem p0 p1 loc msg ss us = put line True us >> error "stop"
where line = "### " ++ kind ++ path' ++ "\n" ++ formatLocation loc ++ msg
kind = if null path' then p0 else p1
path' = showPath (path ss) | 594 | false | true | 2 | 10 | 149 | 248 | 120 | 128 | null | null |
kellino/TypeSystems | typedArith/Eval.hs | mit | runEval :: Term -> Either Error Term
runEval = runIdentity . runExceptT . eval | 78 | runEval :: Term -> Either Error Term
runEval = runIdentity . runExceptT . eval | 78 | runEval = runIdentity . runExceptT . eval | 41 | false | true | 1 | 7 | 13 | 34 | 15 | 19 | null | null |
expipiplus1/vulkan | openxr/src/OpenXR/Extensions/XR_MSFT_spatial_anchor.hs | bsd-3-clause | -- | xrCreateSpatialAnchorSpaceMSFT - Creates a space from a spatial anchor
--
-- == Parameter Descriptions
--
-- = Description
--
-- Creates an 'OpenXR.Core10.Handles.Space' handle based on a spatial
-- anchor. Application /can/ provide an 'OpenXR.Core10.Space.Posef' to
-- define the position and orientation of the new space’s origin relative
-- to the anchor’s natural origin.
--
-- Multiple 'OpenXR.Core10.Handles.Space' handles may exist for a given
-- 'OpenXR.Extensions.Handles.SpatialAnchorMSFT' simultaneously, up to some
-- limit imposed by the runtime. The 'OpenXR.Core10.Handles.Space' handle
-- must be eventually freed via the 'OpenXR.Core10.Space.destroySpace'
-- function or by destroying the parent
-- 'OpenXR.Extensions.Handles.SpatialAnchorMSFT' handle.
--
-- == Valid Usage (Implicit)
--
-- - #VUID-xrCreateSpatialAnchorSpaceMSFT-extension-notenabled# The
-- @XR_MSFT_spatial_anchor@ extension /must/ be enabled prior to
-- calling 'createSpatialAnchorSpaceMSFT'
--
-- - #VUID-xrCreateSpatialAnchorSpaceMSFT-session-parameter# @session@
-- /must/ be a valid 'OpenXR.Core10.Handles.Session' handle
--
-- - #VUID-xrCreateSpatialAnchorSpaceMSFT-createInfo-parameter#
-- @createInfo@ /must/ be a pointer to a valid
-- 'SpatialAnchorSpaceCreateInfoMSFT' structure
--
-- - #VUID-xrCreateSpatialAnchorSpaceMSFT-space-parameter# @space@ /must/
-- be a pointer to an 'OpenXR.Core10.Handles.Space' handle
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-successcodes Success>]
--
-- - 'OpenXR.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-errorcodes Failure>]
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_INSTANCE_LOST'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_OUT_OF_MEMORY'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_FUNCTION_UNSUPPORTED'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_POSE_INVALID'
--
-- - 'OpenXR.Core10.Enums.Result.ERROR_SESSION_LOST'
--
-- - 'OpenXR.Core10.Enums.Result.SESSION_LOSS_PENDING'
--
-- = See Also
--
-- 'OpenXR.Core10.Handles.Session', 'OpenXR.Core10.Handles.Space',
-- 'OpenXR.Extensions.Handles.SpatialAnchorMSFT',
-- 'SpatialAnchorSpaceCreateInfoMSFT'
createSpatialAnchorSpaceMSFT :: forall io
. (MonadIO io)
=> -- | @session@ is a handle to an 'OpenXR.Core10.Handles.Session'.
Session
-> -- | @createInfo@ is a pointer to an 'SpatialAnchorSpaceCreateInfoMSFT'
-- structure containing information about how to create the anchor.
SpatialAnchorSpaceCreateInfoMSFT
-> io (Space)
createSpatialAnchorSpaceMSFT session createInfo = liftIO . evalContT $ do
let cmds = case session of Session{instanceCmds} -> instanceCmds
let xrCreateSpatialAnchorSpaceMSFTPtr = pXrCreateSpatialAnchorSpaceMSFT cmds
lift $ unless (xrCreateSpatialAnchorSpaceMSFTPtr /= nullFunPtr) $
throwIO $ IOError Nothing InvalidArgument "" "The function pointer for xrCreateSpatialAnchorSpaceMSFT is null" Nothing Nothing
let xrCreateSpatialAnchorSpaceMSFT' = mkXrCreateSpatialAnchorSpaceMSFT xrCreateSpatialAnchorSpaceMSFTPtr
createInfo' <- ContT $ withCStruct (createInfo)
pSpace <- ContT $ bracket (callocBytes @(Ptr Space_T) 8) free
r <- lift $ traceAroundEvent "xrCreateSpatialAnchorSpaceMSFT" (xrCreateSpatialAnchorSpaceMSFT' (sessionHandle (session)) createInfo' (pSpace))
lift $ when (r < SUCCESS) (throwIO (OpenXrException r))
space <- lift $ peek @(Ptr Space_T) pSpace
pure $ (((\h -> Space h cmds ) space))
-- | A convenience wrapper to make a compatible pair of calls to
-- 'createSpatialAnchorSpaceMSFT' and 'destroySpace'
--
-- To ensure that 'destroySpace' is always called: pass
-- 'Control.Exception.bracket' (or the allocate function from your
-- favourite resource management library) as the last argument.
-- To just extract the pair pass '(,)' as the last argument.
-- | 4,270 | createSpatialAnchorSpaceMSFT :: forall io
. (MonadIO io)
=> -- | @session@ is a handle to an 'OpenXR.Core10.Handles.Session'.
Session
-> -- | @createInfo@ is a pointer to an 'SpatialAnchorSpaceCreateInfoMSFT'
-- structure containing information about how to create the anchor.
SpatialAnchorSpaceCreateInfoMSFT
-> io (Space)
createSpatialAnchorSpaceMSFT session createInfo = liftIO . evalContT $ do
let cmds = case session of Session{instanceCmds} -> instanceCmds
let xrCreateSpatialAnchorSpaceMSFTPtr = pXrCreateSpatialAnchorSpaceMSFT cmds
lift $ unless (xrCreateSpatialAnchorSpaceMSFTPtr /= nullFunPtr) $
throwIO $ IOError Nothing InvalidArgument "" "The function pointer for xrCreateSpatialAnchorSpaceMSFT is null" Nothing Nothing
let xrCreateSpatialAnchorSpaceMSFT' = mkXrCreateSpatialAnchorSpaceMSFT xrCreateSpatialAnchorSpaceMSFTPtr
createInfo' <- ContT $ withCStruct (createInfo)
pSpace <- ContT $ bracket (callocBytes @(Ptr Space_T) 8) free
r <- lift $ traceAroundEvent "xrCreateSpatialAnchorSpaceMSFT" (xrCreateSpatialAnchorSpaceMSFT' (sessionHandle (session)) createInfo' (pSpace))
lift $ when (r < SUCCESS) (throwIO (OpenXrException r))
space <- lift $ peek @(Ptr Space_T) pSpace
pure $ (((\h -> Space h cmds ) space))
-- | A convenience wrapper to make a compatible pair of calls to
-- 'createSpatialAnchorSpaceMSFT' and 'destroySpace'
--
-- To ensure that 'destroySpace' is always called: pass
-- 'Control.Exception.bracket' (or the allocate function from your
-- favourite resource management library) as the last argument.
-- To just extract the pair pass '(,)' as the last argument.
-- | 1,838 | createSpatialAnchorSpaceMSFT session createInfo = liftIO . evalContT $ do
let cmds = case session of Session{instanceCmds} -> instanceCmds
let xrCreateSpatialAnchorSpaceMSFTPtr = pXrCreateSpatialAnchorSpaceMSFT cmds
lift $ unless (xrCreateSpatialAnchorSpaceMSFTPtr /= nullFunPtr) $
throwIO $ IOError Nothing InvalidArgument "" "The function pointer for xrCreateSpatialAnchorSpaceMSFT is null" Nothing Nothing
let xrCreateSpatialAnchorSpaceMSFT' = mkXrCreateSpatialAnchorSpaceMSFT xrCreateSpatialAnchorSpaceMSFTPtr
createInfo' <- ContT $ withCStruct (createInfo)
pSpace <- ContT $ bracket (callocBytes @(Ptr Space_T) 8) free
r <- lift $ traceAroundEvent "xrCreateSpatialAnchorSpaceMSFT" (xrCreateSpatialAnchorSpaceMSFT' (sessionHandle (session)) createInfo' (pSpace))
lift $ when (r < SUCCESS) (throwIO (OpenXrException r))
space <- lift $ peek @(Ptr Space_T) pSpace
pure $ (((\h -> Space h cmds ) space))
-- | A convenience wrapper to make a compatible pair of calls to
-- 'createSpatialAnchorSpaceMSFT' and 'destroySpace'
--
-- To ensure that 'destroySpace' is always called: pass
-- 'Control.Exception.bracket' (or the allocate function from your
-- favourite resource management library) as the last argument.
-- To just extract the pair pass '(,)' as the last argument.
-- | 1,301 | true | true | 0 | 15 | 750 | 384 | 224 | 160 | null | null |
rueshyna/gogol | gogol-android-publisher/gen/Network/Google/AndroidPublisher/Types/Product.hs | mpl-2.0 | -- | If set this APK\'s Expansion File references another APK\'s Expansion
-- File. The file_size field will not be set.
efReferencesVersion :: Lens' ExpansionFile (Maybe Int32)
efReferencesVersion
= lens _efReferencesVersion
(\ s a -> s{_efReferencesVersion = a})
. mapping _Coerce | 296 | efReferencesVersion :: Lens' ExpansionFile (Maybe Int32)
efReferencesVersion
= lens _efReferencesVersion
(\ s a -> s{_efReferencesVersion = a})
. mapping _Coerce | 175 | efReferencesVersion
= lens _efReferencesVersion
(\ s a -> s{_efReferencesVersion = a})
. mapping _Coerce | 118 | true | true | 0 | 10 | 54 | 56 | 29 | 27 | null | null |
badi/super-user-spark | src/PreCompiler.hs | mit | cleanCard :: Card -> Precompiler ()
cleanCard (Card name d) = do
cleanCardName name
cleanDeclaration d | 110 | cleanCard :: Card -> Precompiler ()
cleanCard (Card name d) = do
cleanCardName name
cleanDeclaration d | 110 | cleanCard (Card name d) = do
cleanCardName name
cleanDeclaration d | 74 | false | true | 0 | 9 | 23 | 48 | 20 | 28 | null | null |
timtylin/scholdoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | circ 'I' = "Î" | 14 | circ 'I' = "Î" | 14 | circ 'I' = "Î" | 14 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
J2RGEZ/haskell-do | src/common/HaskellDo/Toolbar/View.hs | apache-2.0 | openProjectModal :: Perch
openProjectModal =
div ! id "openProjectModal" ! atr "class" "modal modal-fixed-footer" $ do
div ! atr "class" "modal-content" $ do
h4 ("Open project" :: String)
div $ do
b ("Path to Stack project" :: String)
div ! id "pathInput" $ noHtml
p ! atr "class" "grey-text lighten-4" $ ("Path must be absolute, without ~ or environment variables." :: String)
div ! id "creationDisplay" $ noHtml
ul ! atr "class" "fs-tree collection" $ do
div ! atr "class" "collection-item row" $
li ! id "fsTree-tools" $ noHtml
div ! id "fsTree" $ noHtml
div ! atr "class" "modal-footer" $
div ! id "closeModalButton" $ noHtml | 822 | openProjectModal :: Perch
openProjectModal =
div ! id "openProjectModal" ! atr "class" "modal modal-fixed-footer" $ do
div ! atr "class" "modal-content" $ do
h4 ("Open project" :: String)
div $ do
b ("Path to Stack project" :: String)
div ! id "pathInput" $ noHtml
p ! atr "class" "grey-text lighten-4" $ ("Path must be absolute, without ~ or environment variables." :: String)
div ! id "creationDisplay" $ noHtml
ul ! atr "class" "fs-tree collection" $ do
div ! atr "class" "collection-item row" $
li ! id "fsTree-tools" $ noHtml
div ! id "fsTree" $ noHtml
div ! atr "class" "modal-footer" $
div ! id "closeModalButton" $ noHtml | 822 | openProjectModal =
div ! id "openProjectModal" ! atr "class" "modal modal-fixed-footer" $ do
div ! atr "class" "modal-content" $ do
h4 ("Open project" :: String)
div $ do
b ("Path to Stack project" :: String)
div ! id "pathInput" $ noHtml
p ! atr "class" "grey-text lighten-4" $ ("Path must be absolute, without ~ or environment variables." :: String)
div ! id "creationDisplay" $ noHtml
ul ! atr "class" "fs-tree collection" $ do
div ! atr "class" "collection-item row" $
li ! id "fsTree-tools" $ noHtml
div ! id "fsTree" $ noHtml
div ! atr "class" "modal-footer" $
div ! id "closeModalButton" $ noHtml | 796 | false | true | 0 | 21 | 299 | 213 | 97 | 116 | null | null |
valderman/lambnyaa | Network/LambNyaa/Parser.hs | bsd-3-clause | -- | Parse a non-empty word. A word is a string of at least one non-whitespace
-- character.
word :: Parse String
word = atLeast 1 $ charP (not . isSpace) | 156 | word :: Parse String
word = atLeast 1 $ charP (not . isSpace) | 61 | word = atLeast 1 $ charP (not . isSpace) | 40 | true | true | 0 | 8 | 32 | 38 | 18 | 20 | null | null |
ezyang/ghc | compiler/utils/Util.hs | bsd-3-clause | equalLength :: [a] -> [b] -> Bool
-- ^ True if length xs == length ys
equalLength [] [] = True | 102 | equalLength :: [a] -> [b] -> Bool
equalLength [] [] = True | 66 | equalLength [] [] = True | 32 | true | true | 0 | 7 | 28 | 35 | 19 | 16 | null | null |
Lupino/dispatch-article | src/Article/DataSource.hs | bsd-3-clause | fetchReq (CountTimeline name) = countTimeline name | 63 | fetchReq (CountTimeline name) = countTimeline name | 63 | fetchReq (CountTimeline name) = countTimeline name | 63 | false | false | 0 | 7 | 18 | 18 | 8 | 10 | null | null |
Numberartificial/workflow | snipets/src/Craft/Chapter15/MakeTree.hs | mit | makeCodes ts = makeCodes (amalgamate ts) | 40 | makeCodes ts = makeCodes (amalgamate ts) | 40 | makeCodes ts = makeCodes (amalgamate ts) | 40 | false | false | 1 | 7 | 5 | 22 | 8 | 14 | null | null |
davmre/matrizer | src/Matrizer/RewriteRules.hs | gpl-2.0 | -- TODO:
-- determinant of a diagonal matrix
-- exp(log(a)) = a
-- log(exp(a)) = a
-- log(a.*b) <=> log(a) + log(b)
-- exp(a + b) <=> exp(a) * exp(b)
-- exp(-a) <=> 1.0/exp(a)
elementUnOps :: Rule
elementUnOps _ (Branch1 (MElementWise MExp) (Branch1 (MElementWise MLog) a)) = Just a | 285 | elementUnOps :: Rule
elementUnOps _ (Branch1 (MElementWise MExp) (Branch1 (MElementWise MLog) a)) = Just a | 106 | elementUnOps _ (Branch1 (MElementWise MExp) (Branch1 (MElementWise MLog) a)) = Just a | 85 | true | true | 0 | 12 | 51 | 59 | 31 | 28 | null | null |
ahushh/Monaba | monaba/src/Foundation.hs | mit | -- i18n helpers
i18nFoundPostsRus :: Int -> String
i18nFoundPostsRus n
| n == 1 = "Найден "++show n++" пост"
| n `elem` [2..4] = "Найдено "++show n++" поста"
| n `elem` [5..19] = "Найдено "++show n++" постов"
| lastN == 0 = "Найдено "++show n++" постов"
| lastN == 1 = "Найден "++show n++" пост"
| lastN `elem` [2..4] = "Найдено "++show n++" поста"
| lastN `elem` [5..9] = "Найдено "++show n++" постов"
| otherwise = "Найдено "++show n++" постов"
where lastN = (head $ ((++)[0]) $ map (`mod`10) $ takeWhile (>0) $ iterate (`div`10) n) | 605 | i18nFoundPostsRus :: Int -> String
i18nFoundPostsRus n
| n == 1 = "Найден "++show n++" пост"
| n `elem` [2..4] = "Найдено "++show n++" поста"
| n `elem` [5..19] = "Найдено "++show n++" постов"
| lastN == 0 = "Найдено "++show n++" постов"
| lastN == 1 = "Найден "++show n++" пост"
| lastN `elem` [2..4] = "Найдено "++show n++" поста"
| lastN `elem` [5..9] = "Найдено "++show n++" постов"
| otherwise = "Найдено "++show n++" постов"
where lastN = (head $ ((++)[0]) $ map (`mod`10) $ takeWhile (>0) $ iterate (`div`10) n) | 589 | i18nFoundPostsRus n
| n == 1 = "Найден "++show n++" пост"
| n `elem` [2..4] = "Найдено "++show n++" поста"
| n `elem` [5..19] = "Найдено "++show n++" постов"
| lastN == 0 = "Найдено "++show n++" постов"
| lastN == 1 = "Найден "++show n++" пост"
| lastN `elem` [2..4] = "Найдено "++show n++" поста"
| lastN `elem` [5..9] = "Найдено "++show n++" постов"
| otherwise = "Найдено "++show n++" постов"
where lastN = (head $ ((++)[0]) $ map (`mod`10) $ takeWhile (>0) $ iterate (`div`10) n) | 554 | true | true | 3 | 13 | 166 | 304 | 156 | 148 | null | null |
AlexanderPankiv/ghc | compiler/prelude/THNames.hs | bsd-3-clause | tySynInstDName = libFun (fsLit "tySynInstD") tySynInstDIdKey | 73 | tySynInstDName = libFun (fsLit "tySynInstD") tySynInstDIdKey | 73 | tySynInstDName = libFun (fsLit "tySynInstD") tySynInstDIdKey | 73 | false | false | 1 | 7 | 18 | 20 | 8 | 12 | null | null |
NCrashed/PowerCom | src/powercom/Physical/Layer.hs | gpl-3.0 | -- | Infinite cycle of frame receiving. Informs channel layer
-- about errors and automatically sends received frames.
receiveFrameCycle :: ProcessId -> PortState -> Process ()
receiveFrameCycle channelId portState = do
liftIO $ putStrLn "Receiving thread started..."
forever $ do
thisId <- getSelfPid
eitherT
(\err -> send channelId (thisId, "error", "Error while receiving frame: " ++ err ++ "!"))
(\bs -> send channelId (thisId, "frame", bs))
$ receiveFrame portState
-- | Called when "send" message is received from channel layer. Tries to
-- send frame bytestring to the other side and informs the sender about errors. | 684 | receiveFrameCycle :: ProcessId -> PortState -> Process ()
receiveFrameCycle channelId portState = do
liftIO $ putStrLn "Receiving thread started..."
forever $ do
thisId <- getSelfPid
eitherT
(\err -> send channelId (thisId, "error", "Error while receiving frame: " ++ err ++ "!"))
(\bs -> send channelId (thisId, "frame", bs))
$ receiveFrame portState
-- | Called when "send" message is received from channel layer. Tries to
-- send frame bytestring to the other side and informs the sender about errors. | 564 | receiveFrameCycle channelId portState = do
liftIO $ putStrLn "Receiving thread started..."
forever $ do
thisId <- getSelfPid
eitherT
(\err -> send channelId (thisId, "error", "Error while receiving frame: " ++ err ++ "!"))
(\bs -> send channelId (thisId, "frame", bs))
$ receiveFrame portState
-- | Called when "send" message is received from channel layer. Tries to
-- send frame bytestring to the other side and informs the sender about errors. | 506 | true | true | 0 | 17 | 156 | 124 | 64 | 60 | null | null |
google/haskell-trainings | haskell_102/codelab/01_mastermind/src/Game.hs | apache-2.0 | getCode :: Int -> Int -> IO Code
getCode size turn = do
putStr $ "Turn " ++ show turn ++ ": " -- print the prompt
hFlush stdout -- flush stdout
line <- getLine -- read the input
case validateCode size line of -- we try to read the code
Error msg -> do -- if it wasn't a proper code
putStrLn msg -- we print the error
getCode size turn -- and we retry
Value code -> return code -- otherwise, perfect! | 555 | getCode :: Int -> Int -> IO Code
getCode size turn = do
putStr $ "Turn " ++ show turn ++ ": " -- print the prompt
hFlush stdout -- flush stdout
line <- getLine -- read the input
case validateCode size line of -- we try to read the code
Error msg -> do -- if it wasn't a proper code
putStrLn msg -- we print the error
getCode size turn -- and we retry
Value code -> return code -- otherwise, perfect! | 555 | getCode size turn = do
putStr $ "Turn " ++ show turn ++ ": " -- print the prompt
hFlush stdout -- flush stdout
line <- getLine -- read the input
case validateCode size line of -- we try to read the code
Error msg -> do -- if it wasn't a proper code
putStrLn msg -- we print the error
getCode size turn -- and we retry
Value code -> return code -- otherwise, perfect! | 522 | false | true | 0 | 12 | 239 | 113 | 53 | 60 | null | null |
relrod/spritz | src/Crypto/Cipher/Spritz.hs | bsd-2-clause | initializeState :: Int -- ^ The 'n' value to use throughout.
-> SpritzState -- ^ The initial state.
initializeState n' = SpritzState 0 0 0 0 1 0 (V.fromList [0..n'-1]) n' | 194 | initializeState :: Int -- ^ The 'n' value to use throughout.
-> SpritzState
initializeState n' = SpritzState 0 0 0 0 1 0 (V.fromList [0..n'-1]) n' | 170 | initializeState n' = SpritzState 0 0 0 0 1 0 (V.fromList [0..n'-1]) n' | 70 | true | true | 0 | 9 | 54 | 54 | 28 | 26 | null | null |
sjfloat/dnngraph | NN/DSL.hs | bsd-3-clause | asCaffe Conv = "Convolution" | 28 | asCaffe Conv = "Convolution" | 28 | asCaffe Conv = "Convolution" | 28 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
juretta/course | test/src/L02/List/Tests.hs | bsd-3-clause | prop_flatten ::
List (List Int)
-> Bool
prop_flatten x =
length (flatten x) == sum (map length x) | 103 | prop_flatten ::
List (List Int)
-> Bool
prop_flatten x =
length (flatten x) == sum (map length x) | 103 | prop_flatten x =
length (flatten x) == sum (map length x) | 59 | false | true | 5 | 6 | 23 | 59 | 25 | 34 | null | null |
arne-schroppe/dash | src/Language/Dash/CodeGen/CodeGenState.hs | mit | getCompileTimeConstInSurroundingScopes :: Name -> CodeGen CompileTimeConstant
getCompileTimeConstInSurroundingScopes name = do
scps <- gets scopes
getCompConst name scps
where
getCompConst _ [] = throwError $ InternalCompilerError $
"No compile time constant named '" ++ name ++ "'"
getCompConst constName scps = do
let consts = compileTimeConstants $ head scps
case Map.lookup constName consts of
Just c -> return c
Nothing -> getCompConst constName $ tail scps
-- TODO implement argument spilling to avoid this hard limit | 599 | getCompileTimeConstInSurroundingScopes :: Name -> CodeGen CompileTimeConstant
getCompileTimeConstInSurroundingScopes name = do
scps <- gets scopes
getCompConst name scps
where
getCompConst _ [] = throwError $ InternalCompilerError $
"No compile time constant named '" ++ name ++ "'"
getCompConst constName scps = do
let consts = compileTimeConstants $ head scps
case Map.lookup constName consts of
Just c -> return c
Nothing -> getCompConst constName $ tail scps
-- TODO implement argument spilling to avoid this hard limit | 599 | getCompileTimeConstInSurroundingScopes name = do
scps <- gets scopes
getCompConst name scps
where
getCompConst _ [] = throwError $ InternalCompilerError $
"No compile time constant named '" ++ name ++ "'"
getCompConst constName scps = do
let consts = compileTimeConstants $ head scps
case Map.lookup constName consts of
Just c -> return c
Nothing -> getCompConst constName $ tail scps
-- TODO implement argument spilling to avoid this hard limit | 521 | false | true | 1 | 13 | 150 | 139 | 63 | 76 | null | null |
unisonweb/platform | parser-typechecker/src/Unison/NamePrinter.hs | mit | styleHashQualified ::
IsString s => (Pretty s -> Pretty s) -> HQ.HashQualified Name -> Pretty s
styleHashQualified style hq = styleHashQualified' style id hq | 159 | styleHashQualified ::
IsString s => (Pretty s -> Pretty s) -> HQ.HashQualified Name -> Pretty s
styleHashQualified style hq = styleHashQualified' style id hq | 159 | styleHashQualified style hq = styleHashQualified' style id hq | 61 | false | true | 0 | 10 | 25 | 63 | 28 | 35 | null | null |
Forec/learn | 2017.3/Parallel Haskell/ch15/mvarm.hs | mit | main :: IO Char
main = do
t <- myThreadId
labelThread t "main"
m <- newEmptyMVar
t <- forkIO $ putMVar m 'a'
labelThread t "a"
t <- forkIO $ putMVar m 'b'
labelThread t "b"
traceEventIO "before takeMVar"
takeMVar m
takeMVar m | 256 | main :: IO Char
main = do
t <- myThreadId
labelThread t "main"
m <- newEmptyMVar
t <- forkIO $ putMVar m 'a'
labelThread t "a"
t <- forkIO $ putMVar m 'b'
labelThread t "b"
traceEventIO "before takeMVar"
takeMVar m
takeMVar m | 255 | main = do
t <- myThreadId
labelThread t "main"
m <- newEmptyMVar
t <- forkIO $ putMVar m 'a'
labelThread t "a"
t <- forkIO $ putMVar m 'b'
labelThread t "b"
traceEventIO "before takeMVar"
takeMVar m
takeMVar m | 239 | false | true | 0 | 9 | 73 | 102 | 42 | 60 | null | null |
axch/dysvunctional-language | haskell-fol/FOL/Compiler/JavaScript/Parser.hs | agpl-3.0 | parseLet = liftA2 Let bindings body
where
bindings = Bindings <$> listOf binding
binding = parens $ liftA2 (,) pattern expr
pattern = identifier
expr = parseExpr
body = parseBlck | 222 | parseLet = liftA2 Let bindings body
where
bindings = Bindings <$> listOf binding
binding = parens $ liftA2 (,) pattern expr
pattern = identifier
expr = parseExpr
body = parseBlck | 222 | parseLet = liftA2 Let bindings body
where
bindings = Bindings <$> listOf binding
binding = parens $ liftA2 (,) pattern expr
pattern = identifier
expr = parseExpr
body = parseBlck | 222 | false | false | 7 | 6 | 73 | 72 | 32 | 40 | null | null |
olive/demiurge | src/Demiurge/World.hs | mit | processWorker :: EWorker -> Plan -> [EWorker] -> Terrain -> (EWorker, Plan, Terrain)
processWorker (WorkingWorker wk) p _ t =
let tsk = getTask wk in
case allowed tsk wk t of
TaskPermitted -> perform tsk wk p t
TaskBlocked _ ->
let (wk', p') = unemploy (Message "Blocked") wk p in
(pack $ wk', p', t)
TaskForbidden rsn ->
let (wk', p') = unemploy rsn wk p in
(pack $ wk', p', t) | 458 | processWorker :: EWorker -> Plan -> [EWorker] -> Terrain -> (EWorker, Plan, Terrain)
processWorker (WorkingWorker wk) p _ t =
let tsk = getTask wk in
case allowed tsk wk t of
TaskPermitted -> perform tsk wk p t
TaskBlocked _ ->
let (wk', p') = unemploy (Message "Blocked") wk p in
(pack $ wk', p', t)
TaskForbidden rsn ->
let (wk', p') = unemploy rsn wk p in
(pack $ wk', p', t) | 458 | processWorker (WorkingWorker wk) p _ t =
let tsk = getTask wk in
case allowed tsk wk t of
TaskPermitted -> perform tsk wk p t
TaskBlocked _ ->
let (wk', p') = unemploy (Message "Blocked") wk p in
(pack $ wk', p', t)
TaskForbidden rsn ->
let (wk', p') = unemploy rsn wk p in
(pack $ wk', p', t) | 373 | false | true | 0 | 16 | 153 | 200 | 99 | 101 | null | null |
NickAger/LearningHaskell | well-typed at skills matter/fast-track/exercises/3/SpellCheck.hs | mit | -- If you don't know them yet, try to familiarize yourself with the
-- functions
--
-- words
-- lines
-- Now write a function
spellCheck :: String -> Dictionary -> [String]
spellCheck = error "TODO: implement spellCheck" | 226 | spellCheck :: String -> Dictionary -> [String]
spellCheck = error "TODO: implement spellCheck" | 94 | spellCheck = error "TODO: implement spellCheck" | 47 | true | true | 0 | 9 | 43 | 38 | 20 | 18 | null | null |
distillation/language-core | Language/Core/Syntax.hs | gpl-3.0 | {-|
Rebuilds a set of supplied 'Term's into an 'LHE.Exp' that represents a constructor application.
-}
rebuildCon :: [Term] -> LHE.Exp
rebuildCon (e:[]) = LHE.Paren (LHE.InfixApp (rebuildExp e) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon))) | 271 | rebuildCon :: [Term] -> LHE.Exp
rebuildCon (e:[]) = LHE.Paren (LHE.InfixApp (rebuildExp e) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon))) | 163 | rebuildCon (e:[]) = LHE.Paren (LHE.InfixApp (rebuildExp e) (LHE.QConOp (LHE.Special LHE.Cons)) (LHE.Con (LHE.Special LHE.ListCon))) | 131 | true | true | 0 | 12 | 38 | 92 | 47 | 45 | null | null |
nyorem/cghs | Cghs/Types/Triangle2.hs | mit | -- | Signed area of a triangle.
signedAreaTriangle2 :: (Fractional a) => Triangle2 a -> a
signedAreaTriangle2 t = ((x r - x q) * y p + (x p - x r) * y q + (x q - x p) * y r) / 2
where p = p1 t
q = p2 t
r = p3 t
-- | Circumcenter of a triangle: intersection of the bisectors. | 299 | signedAreaTriangle2 :: (Fractional a) => Triangle2 a -> a
signedAreaTriangle2 t = ((x r - x q) * y p + (x p - x r) * y q + (x q - x p) * y r) / 2
where p = p1 t
q = p2 t
r = p3 t
-- | Circumcenter of a triangle: intersection of the bisectors. | 267 | signedAreaTriangle2 t = ((x r - x q) * y p + (x p - x r) * y q + (x q - x p) * y r) / 2
where p = p1 t
q = p2 t
r = p3 t
-- | Circumcenter of a triangle: intersection of the bisectors. | 209 | true | true | 3 | 14 | 94 | 149 | 66 | 83 | null | null |
nbloomf/feivel | src/Feivel/Parse/ParseM.hs | gpl-3.0 | runParseM :: ParseM a -> String -> String -> Either Goof a
runParseM p name str = case runParserT p () name str of
Left goof -> Left goof
Right (Left err) -> Left (parseGoof err)
Right (Right x) -> Right x | 211 | runParseM :: ParseM a -> String -> String -> Either Goof a
runParseM p name str = case runParserT p () name str of
Left goof -> Left goof
Right (Left err) -> Left (parseGoof err)
Right (Right x) -> Right x | 211 | runParseM p name str = case runParserT p () name str of
Left goof -> Left goof
Right (Left err) -> Left (parseGoof err)
Right (Right x) -> Right x | 152 | false | true | 0 | 10 | 47 | 112 | 50 | 62 | null | null |
demhydraz/waffle | src/Backend/Lua/Optimize.hs | bsd-3-clause | optimizeTree' (Return e) = Return $ optimize e | 46 | optimizeTree' (Return e) = Return $ optimize e | 46 | optimizeTree' (Return e) = Return $ optimize e | 46 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
csrhodes/pandoc | src/Text/Pandoc/Readers/Markdown.hs | gpl-2.0 | isBlank '\t' = True | 19 | isBlank '\t' = True | 19 | isBlank '\t' = True | 19 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
mcmaniac/ssdp-upnp | src/Network/SSDP.hs | mit | sendNotify :: MonadIO m => SSDP Notify -> m ()
sendNotify ssdp = liftIO $ do
-- send ssdp:discover
(sock, sockaddr) <- multicastSender ssdpAddr ssdpPort
_ <- S.sendTo sock (render ssdp) sockaddr
S.sClose sock | 217 | sendNotify :: MonadIO m => SSDP Notify -> m ()
sendNotify ssdp = liftIO $ do
-- send ssdp:discover
(sock, sockaddr) <- multicastSender ssdpAddr ssdpPort
_ <- S.sendTo sock (render ssdp) sockaddr
S.sClose sock | 217 | sendNotify ssdp = liftIO $ do
-- send ssdp:discover
(sock, sockaddr) <- multicastSender ssdpAddr ssdpPort
_ <- S.sendTo sock (render ssdp) sockaddr
S.sClose sock | 170 | false | true | 0 | 11 | 42 | 86 | 40 | 46 | null | null |
msullivan/advent-of-code | 2017/A8a.hs | mit | do2 f g x = (f x, g x) | 22 | do2 f g x = (f x, g x) | 22 | do2 f g x = (f x, g x) | 22 | false | false | 0 | 6 | 8 | 25 | 12 | 13 | null | null |
nh2/quickcheck | Test/QuickCheck/Property.hs | bsd-3-clause | True ==> p = property p | 24 | True ==> p = property p | 24 | True ==> p = property p | 24 | false | false | 0 | 5 | 6 | 15 | 6 | 9 | null | null |
tjakway/ghcjvm | compiler/main/DynFlags.hs | bsd-3-clause | noArgM :: (DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
noArgM fn = NoArg (updM fn) | 96 | noArgM :: (DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
noArgM fn = NoArg (updM fn) | 96 | noArgM fn = NoArg (updM fn) | 27 | false | true | 0 | 9 | 15 | 51 | 23 | 28 | null | null |
ezyang/ghc | compiler/main/GhcMake.hs | bsd-3-clause | multiRootsErr dflags summs@(summ1:_)
= throwOneError $ mkPlainErrMsg dflags noSrcSpan $
text "module" <+> quotes (ppr mod) <+>
text "is defined in multiple files:" <+>
sep (map text files)
where
mod = ms_mod summ1
files = map (expectJust "checkDup" . ml_hs_file . ms_location) summs | 318 | multiRootsErr dflags summs@(summ1:_)
= throwOneError $ mkPlainErrMsg dflags noSrcSpan $
text "module" <+> quotes (ppr mod) <+>
text "is defined in multiple files:" <+>
sep (map text files)
where
mod = ms_mod summ1
files = map (expectJust "checkDup" . ml_hs_file . ms_location) summs | 318 | multiRootsErr dflags summs@(summ1:_)
= throwOneError $ mkPlainErrMsg dflags noSrcSpan $
text "module" <+> quotes (ppr mod) <+>
text "is defined in multiple files:" <+>
sep (map text files)
where
mod = ms_mod summ1
files = map (expectJust "checkDup" . ml_hs_file . ms_location) summs | 318 | false | false | 0 | 10 | 78 | 107 | 51 | 56 | null | null |
dec9ue/jhc_copygc | src/Ho/Library.hs | gpl-2.0 | libVersion lib = let HoHeader { hohName = ~(Right (_name,vers)) } = libHoHeader lib in vers | 91 | libVersion lib = let HoHeader { hohName = ~(Right (_name,vers)) } = libHoHeader lib in vers | 91 | libVersion lib = let HoHeader { hohName = ~(Right (_name,vers)) } = libHoHeader lib in vers | 91 | false | false | 0 | 15 | 15 | 46 | 22 | 24 | null | null |
anton-dessiatov/stack | src/Stack/Image.hs | bsd-3-clause | imageName
:: Path Abs Dir -> String
imageName = map toLower . toFilePathNoTrailingSep . dirname | 99 | imageName
:: Path Abs Dir -> String
imageName = map toLower . toFilePathNoTrailingSep . dirname | 99 | imageName = map toLower . toFilePathNoTrailingSep . dirname | 59 | false | true | 0 | 7 | 18 | 31 | 15 | 16 | null | null |
jaalonso/I1M-Cod-Temas | src/Tema_7.hs | gpl-2.0 | -- Definición por comprensión:
sumaCuadradosPares' :: [Int] -> Int
sumaCuadradosPares' xs = sum [x^2 | x <- xs, even x] | 119 | sumaCuadradosPares' :: [Int] -> Int
sumaCuadradosPares' xs = sum [x^2 | x <- xs, even x] | 88 | sumaCuadradosPares' xs = sum [x^2 | x <- xs, even x] | 52 | true | true | 0 | 8 | 19 | 47 | 24 | 23 | null | null |
fmapfmapfmap/amazonka | amazonka-glacier/gen/Network/AWS/Glacier/Types/Product.hs | mpl-2.0 | -- | The start of the date range in UTC for vault inventory retrieval that
-- includes archives created on or after this date. A string representation
-- of ISO 8601 date format, for example, 2013-03-20T17:03:43Z.
irjiStartDate :: Lens' InventoryRetrievalJobInput (Maybe Text)
irjiStartDate = lens _irjiStartDate (\ s a -> s{_irjiStartDate = a}) | 345 | irjiStartDate :: Lens' InventoryRetrievalJobInput (Maybe Text)
irjiStartDate = lens _irjiStartDate (\ s a -> s{_irjiStartDate = a}) | 131 | irjiStartDate = lens _irjiStartDate (\ s a -> s{_irjiStartDate = a}) | 68 | true | true | 0 | 9 | 52 | 48 | 27 | 21 | null | null |
aaronc/Idris-dev | src/Idris/ElabDecls.hs | bsd-3-clause | elabDecl' what info (PParams f ns ps)
= do i <- getIState
logElab 1 $ "Expanding params block with " ++ show ns ++ " decls " ++
show (concatMap tldeclared ps)
let nblock = pblock i
mapM_ (elabDecl' what info) nblock
where
pinfo = let ds = concatMap tldeclared ps
newps = params info ++ ns
dsParams = map (\n -> (n, map fst newps)) ds
newb = addAlist dsParams (inblock info) in
info { params = newps,
inblock = newb }
pblock i = map (expandParamsD False i id ns
(concatMap tldeclared ps)) ps | 656 | elabDecl' what info (PParams f ns ps)
= do i <- getIState
logElab 1 $ "Expanding params block with " ++ show ns ++ " decls " ++
show (concatMap tldeclared ps)
let nblock = pblock i
mapM_ (elabDecl' what info) nblock
where
pinfo = let ds = concatMap tldeclared ps
newps = params info ++ ns
dsParams = map (\n -> (n, map fst newps)) ds
newb = addAlist dsParams (inblock info) in
info { params = newps,
inblock = newb }
pblock i = map (expandParamsD False i id ns
(concatMap tldeclared ps)) ps | 656 | elabDecl' what info (PParams f ns ps)
= do i <- getIState
logElab 1 $ "Expanding params block with " ++ show ns ++ " decls " ++
show (concatMap tldeclared ps)
let nblock = pblock i
mapM_ (elabDecl' what info) nblock
where
pinfo = let ds = concatMap tldeclared ps
newps = params info ++ ns
dsParams = map (\n -> (n, map fst newps)) ds
newb = addAlist dsParams (inblock info) in
info { params = newps,
inblock = newb }
pblock i = map (expandParamsD False i id ns
(concatMap tldeclared ps)) ps | 656 | false | false | 0 | 13 | 261 | 224 | 109 | 115 | null | null |
olsner/ghc | compiler/basicTypes/DataCon.hs | bsd-3-clause | dataConFieldLabels :: DataCon -> [FieldLabel]
dataConFieldLabels = dcFields | 75 | dataConFieldLabels :: DataCon -> [FieldLabel]
dataConFieldLabels = dcFields | 75 | dataConFieldLabels = dcFields | 29 | false | true | 0 | 8 | 7 | 25 | 11 | 14 | null | null |
beni55/binary | benchmarks/Benchmark.hs | bsd-3-clause | getWord8N8 = loop 0
where loop s n | s `seq` n `seq` False = undefined
loop s 0 = return s
loop s n = do
s0 <- getWord8
s1 <- getWord8
s2 <- getWord8
s3 <- getWord8
s4 <- getWord8
s5 <- getWord8
s6 <- getWord8
s7 <- getWord8
loop (s+s0+s1+s2+s3+s4+s5+s6+s7) (n-8) | 371 | getWord8N8 = loop 0
where loop s n | s `seq` n `seq` False = undefined
loop s 0 = return s
loop s n = do
s0 <- getWord8
s1 <- getWord8
s2 <- getWord8
s3 <- getWord8
s4 <- getWord8
s5 <- getWord8
s6 <- getWord8
s7 <- getWord8
loop (s+s0+s1+s2+s3+s4+s5+s6+s7) (n-8) | 371 | getWord8N8 = loop 0
where loop s n | s `seq` n `seq` False = undefined
loop s 0 = return s
loop s n = do
s0 <- getWord8
s1 <- getWord8
s2 <- getWord8
s3 <- getWord8
s4 <- getWord8
s5 <- getWord8
s6 <- getWord8
s7 <- getWord8
loop (s+s0+s1+s2+s3+s4+s5+s6+s7) (n-8) | 371 | false | false | 2 | 18 | 161 | 168 | 80 | 88 | null | null |
cullina/Extractor | src/MarkovExperts.hs | bsd-3-clause | newFixedMarkovExpert 3 = FME 3 [True, True, True] [0.75, 0.55, 0.3, 0.1, 0.9, 0.5, 0.3, 0.6] [] | 102 | newFixedMarkovExpert 3 = FME 3 [True, True, True] [0.75, 0.55, 0.3, 0.1, 0.9, 0.5, 0.3, 0.6] [] | 102 | newFixedMarkovExpert 3 = FME 3 [True, True, True] [0.75, 0.55, 0.3, 0.1, 0.9, 0.5, 0.3, 0.6] [] | 102 | false | false | 0 | 6 | 23 | 53 | 31 | 22 | null | null |
fpco/stackage-server | src/Stackage/Database/Cron.hs | mit | withResponseUnliftIO :: MonadUnliftIO m => Request -> Manager -> (Response BodyReader -> m b) -> m b
withResponseUnliftIO req man f = withRunInIO $ \ runInIO -> withResponse req man (runInIO . f) | 195 | withResponseUnliftIO :: MonadUnliftIO m => Request -> Manager -> (Response BodyReader -> m b) -> m b
withResponseUnliftIO req man f = withRunInIO $ \ runInIO -> withResponse req man (runInIO . f) | 195 | withResponseUnliftIO req man f = withRunInIO $ \ runInIO -> withResponse req man (runInIO . f) | 94 | false | true | 0 | 11 | 32 | 76 | 37 | 39 | null | null |
toppoint/haskell-alpm | tests/Tests.hs | gpl-2.0 | test_databaseReadGroupNothing :: Assertion
test_databaseReadGroupNothing = withLocalDatabase $ \db -> do
mGroup1 <- databaseReadGroup db ""
mGroup2 <- databaseReadGroup db "groupNameNotToBeFound"
return $ (isNothing mGroup1) && (isNothing mGroup2) | 259 | test_databaseReadGroupNothing :: Assertion
test_databaseReadGroupNothing = withLocalDatabase $ \db -> do
mGroup1 <- databaseReadGroup db ""
mGroup2 <- databaseReadGroup db "groupNameNotToBeFound"
return $ (isNothing mGroup1) && (isNothing mGroup2) | 259 | test_databaseReadGroupNothing = withLocalDatabase $ \db -> do
mGroup1 <- databaseReadGroup db ""
mGroup2 <- databaseReadGroup db "groupNameNotToBeFound"
return $ (isNothing mGroup1) && (isNothing mGroup2) | 216 | false | true | 0 | 12 | 38 | 67 | 32 | 35 | null | null |
plumlife/cabal | Cabal/Distribution/Simple/HaskellSuite.hs | bsd-3-clause | buildLib
:: Verbosity -> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO ()
buildLib verbosity pkg_descr lbi lib clbi = do
-- In future, there should be a mechanism for the compiler to request any
-- number of the above parameters (or their parts) — in particular,
-- pieces of PackageDescription.
--
-- For now, we only pass those that we know are used.
let odir = buildDir lbi
bi = libBuildInfo lib
srcDirs = hsSourceDirs bi ++ [odir]
dbStack = withPackageDB lbi
language = fromMaybe Haskell98 (defaultLanguage bi)
conf = withPrograms lbi
pkgid = packageId pkg_descr
runDbProgram verbosity haskellSuiteProgram conf $
[ "compile", "--build-dir", odir ] ++
concat [ ["-i", d] | d <- srcDirs ] ++
concat [ ["-I", d] | d <- [autogenModulesDir lbi, odir] ++ includeDirs bi ] ++
[ packageDbOpt pkgDb | pkgDb <- dbStack ] ++
[ "--package-name", display pkgid ] ++
concat [ ["--package-id", display ipkgid ]
| (ipkgid, _) <- componentPackageDeps clbi ] ++
["-G", display language] ++
concat [ ["-X", display ex] | ex <- usedExtensions bi ] ++
cppOptions (libBuildInfo lib) ++
[ display modu | modu <- libModules lib ] | 1,251 | buildLib
:: Verbosity -> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO ()
buildLib verbosity pkg_descr lbi lib clbi = do
-- In future, there should be a mechanism for the compiler to request any
-- number of the above parameters (or their parts) — in particular,
-- pieces of PackageDescription.
--
-- For now, we only pass those that we know are used.
let odir = buildDir lbi
bi = libBuildInfo lib
srcDirs = hsSourceDirs bi ++ [odir]
dbStack = withPackageDB lbi
language = fromMaybe Haskell98 (defaultLanguage bi)
conf = withPrograms lbi
pkgid = packageId pkg_descr
runDbProgram verbosity haskellSuiteProgram conf $
[ "compile", "--build-dir", odir ] ++
concat [ ["-i", d] | d <- srcDirs ] ++
concat [ ["-I", d] | d <- [autogenModulesDir lbi, odir] ++ includeDirs bi ] ++
[ packageDbOpt pkgDb | pkgDb <- dbStack ] ++
[ "--package-name", display pkgid ] ++
concat [ ["--package-id", display ipkgid ]
| (ipkgid, _) <- componentPackageDeps clbi ] ++
["-G", display language] ++
concat [ ["-X", display ex] | ex <- usedExtensions bi ] ++
cppOptions (libBuildInfo lib) ++
[ display modu | modu <- libModules lib ] | 1,251 | buildLib verbosity pkg_descr lbi lib clbi = do
-- In future, there should be a mechanism for the compiler to request any
-- number of the above parameters (or their parts) — in particular,
-- pieces of PackageDescription.
--
-- For now, we only pass those that we know are used.
let odir = buildDir lbi
bi = libBuildInfo lib
srcDirs = hsSourceDirs bi ++ [odir]
dbStack = withPackageDB lbi
language = fromMaybe Haskell98 (defaultLanguage bi)
conf = withPrograms lbi
pkgid = packageId pkg_descr
runDbProgram verbosity haskellSuiteProgram conf $
[ "compile", "--build-dir", odir ] ++
concat [ ["-i", d] | d <- srcDirs ] ++
concat [ ["-I", d] | d <- [autogenModulesDir lbi, odir] ++ includeDirs bi ] ++
[ packageDbOpt pkgDb | pkgDb <- dbStack ] ++
[ "--package-name", display pkgid ] ++
concat [ ["--package-id", display ipkgid ]
| (ipkgid, _) <- componentPackageDeps clbi ] ++
["-G", display language] ++
concat [ ["-X", display ex] | ex <- usedExtensions bi ] ++
cppOptions (libBuildInfo lib) ++
[ display modu | modu <- libModules lib ] | 1,138 | false | true | 0 | 21 | 298 | 363 | 185 | 178 | null | null |
sashabu/libcspm | src/CSPM/Renamer.hs | bsd-3-clause | typeVarNotInScopeMessage :: UnRenamedName -> RenamerMonad Error
typeVarNotInScopeMessage n = do
env <- gets typeEnvironment
let mv = HM.maybeLookup env n
if isJust mv then do
let Just rnt = mv
vis = renamedTypeVisibility rnt
t = renamedType rnt
return $
(text "The type-variable" <+> prettyPrint n
<+> text "is not in scope")
P.$$ tabIndent (
text "Defined"
<+> case vis of
Public -> panic "Cannot not be in scope"
Private -> text "privately"
Instance -> text "inside a parameterised module"
<+> case t of
STVar n | nameDefinition n /= Unknown ->
parens (text "at" <+> prettyPrint (nameDefinition n))
_ -> empty
P.$$ case vis of
Public -> panic "Cannot not be in scope"
Private -> text "Hint: move to the exports section"
Instance -> text "Hint: create a module instance")
else do
let availablePp = [(show $ prettyPrint rn, (rn, n)) |
(rn, RenamedType n Public) <- HM.flatten env]
suggestions = fuzzyLookup (show $ prettyPrint n) availablePp
return $
(text "The type-variable" <+> prettyPrint n <+> text "is not in scope")
P.$$ case suggestions of
[] -> empty
_ -> hang (text "Did you mean:") tabWidth (vcat (
(map (\ (rn, t) ->
prettyPrint rn <+>
case t of
STVar n | nameDefinition n /= Unknown ->
parens (text "defined at" <+> prettyPrint
(nameDefinition n))
_ -> empty
) suggestions))) | 1,964 | typeVarNotInScopeMessage :: UnRenamedName -> RenamerMonad Error
typeVarNotInScopeMessage n = do
env <- gets typeEnvironment
let mv = HM.maybeLookup env n
if isJust mv then do
let Just rnt = mv
vis = renamedTypeVisibility rnt
t = renamedType rnt
return $
(text "The type-variable" <+> prettyPrint n
<+> text "is not in scope")
P.$$ tabIndent (
text "Defined"
<+> case vis of
Public -> panic "Cannot not be in scope"
Private -> text "privately"
Instance -> text "inside a parameterised module"
<+> case t of
STVar n | nameDefinition n /= Unknown ->
parens (text "at" <+> prettyPrint (nameDefinition n))
_ -> empty
P.$$ case vis of
Public -> panic "Cannot not be in scope"
Private -> text "Hint: move to the exports section"
Instance -> text "Hint: create a module instance")
else do
let availablePp = [(show $ prettyPrint rn, (rn, n)) |
(rn, RenamedType n Public) <- HM.flatten env]
suggestions = fuzzyLookup (show $ prettyPrint n) availablePp
return $
(text "The type-variable" <+> prettyPrint n <+> text "is not in scope")
P.$$ case suggestions of
[] -> empty
_ -> hang (text "Did you mean:") tabWidth (vcat (
(map (\ (rn, t) ->
prettyPrint rn <+>
case t of
STVar n | nameDefinition n /= Unknown ->
parens (text "defined at" <+> prettyPrint
(nameDefinition n))
_ -> empty
) suggestions))) | 1,964 | typeVarNotInScopeMessage n = do
env <- gets typeEnvironment
let mv = HM.maybeLookup env n
if isJust mv then do
let Just rnt = mv
vis = renamedTypeVisibility rnt
t = renamedType rnt
return $
(text "The type-variable" <+> prettyPrint n
<+> text "is not in scope")
P.$$ tabIndent (
text "Defined"
<+> case vis of
Public -> panic "Cannot not be in scope"
Private -> text "privately"
Instance -> text "inside a parameterised module"
<+> case t of
STVar n | nameDefinition n /= Unknown ->
parens (text "at" <+> prettyPrint (nameDefinition n))
_ -> empty
P.$$ case vis of
Public -> panic "Cannot not be in scope"
Private -> text "Hint: move to the exports section"
Instance -> text "Hint: create a module instance")
else do
let availablePp = [(show $ prettyPrint rn, (rn, n)) |
(rn, RenamedType n Public) <- HM.flatten env]
suggestions = fuzzyLookup (show $ prettyPrint n) availablePp
return $
(text "The type-variable" <+> prettyPrint n <+> text "is not in scope")
P.$$ case suggestions of
[] -> empty
_ -> hang (text "Did you mean:") tabWidth (vcat (
(map (\ (rn, t) ->
prettyPrint rn <+>
case t of
STVar n | nameDefinition n /= Unknown ->
parens (text "defined at" <+> prettyPrint
(nameDefinition n))
_ -> empty
) suggestions))) | 1,900 | false | true | 0 | 33 | 896 | 498 | 234 | 264 | null | null |
leshchevds/ganeti | src/Ganeti/HTools/Backend/Text.hs | bsd-2-clause | breakISpecsPairs owner (x:y:xs) = do
rest <- breakISpecsPairs owner xs
return $ (x, y) : rest | 97 | breakISpecsPairs owner (x:y:xs) = do
rest <- breakISpecsPairs owner xs
return $ (x, y) : rest | 97 | breakISpecsPairs owner (x:y:xs) = do
rest <- breakISpecsPairs owner xs
return $ (x, y) : rest | 97 | false | false | 0 | 9 | 19 | 51 | 25 | 26 | null | null |
karamellpelle/MEnv | source/Font.hs | bsd-2-clause | -- | draw FontObject at 3D-pos.
fontDrawObject3D :: FontShade -> FontObject -> Float -> Float -> Float -> IO ()
fontDrawObject3D sh fo x y z = do
-- stencil
glActiveTexture gl_TEXTURE0
glBindTexture gl_TEXTURE_2D $ fontobjectStencil fo
-- size
glUniform2f (fontShadeUniCharSize sh) (rTF $ fontobjectCharSizeX fo)
(rTF $ fontobjectCharSizeY fo)
-- color
case fontobjectColor fo of
FontColor r g b a ->
glUniform4f (fontShadeUniCharSize sh) r g b a
-- translate
glUniform2f (fontShadeUniTranslate sh) 0.0 0.0
fontDrawObject3D' sh fo x y z
-- | draw FontObject at 3D-pos. | 677 | fontDrawObject3D :: FontShade -> FontObject -> Float -> Float -> Float -> IO ()
fontDrawObject3D sh fo x y z = do
-- stencil
glActiveTexture gl_TEXTURE0
glBindTexture gl_TEXTURE_2D $ fontobjectStencil fo
-- size
glUniform2f (fontShadeUniCharSize sh) (rTF $ fontobjectCharSizeX fo)
(rTF $ fontobjectCharSizeY fo)
-- color
case fontobjectColor fo of
FontColor r g b a ->
glUniform4f (fontShadeUniCharSize sh) r g b a
-- translate
glUniform2f (fontShadeUniTranslate sh) 0.0 0.0
fontDrawObject3D' sh fo x y z
-- | draw FontObject at 3D-pos. | 645 | fontDrawObject3D sh fo x y z = do
-- stencil
glActiveTexture gl_TEXTURE0
glBindTexture gl_TEXTURE_2D $ fontobjectStencil fo
-- size
glUniform2f (fontShadeUniCharSize sh) (rTF $ fontobjectCharSizeX fo)
(rTF $ fontobjectCharSizeY fo)
-- color
case fontobjectColor fo of
FontColor r g b a ->
glUniform4f (fontShadeUniCharSize sh) r g b a
-- translate
glUniform2f (fontShadeUniTranslate sh) 0.0 0.0
fontDrawObject3D' sh fo x y z
-- | draw FontObject at 3D-pos. | 565 | true | true | 0 | 12 | 196 | 180 | 85 | 95 | null | null |
ghc-android/ghc | compiler/codeGen/StgCmmEnv.hs | bsd-3-clause | addBindsC :: [CgIdInfo] -> FCode ()
addBindsC new_bindings = do
binds <- getBinds
let new_binds = foldl (\ binds info -> extendVarEnv binds (cg_id info) info)
binds
new_bindings
setBinds new_binds | 280 | addBindsC :: [CgIdInfo] -> FCode ()
addBindsC new_bindings = do
binds <- getBinds
let new_binds = foldl (\ binds info -> extendVarEnv binds (cg_id info) info)
binds
new_bindings
setBinds new_binds | 280 | addBindsC new_bindings = do
binds <- getBinds
let new_binds = foldl (\ binds info -> extendVarEnv binds (cg_id info) info)
binds
new_bindings
setBinds new_binds | 244 | false | true | 0 | 16 | 113 | 82 | 38 | 44 | null | null |
Pitometsu/bake | src/General/Database.hs | bsd-3-clause | table :: (Columns keys, Columns cols) => String -> Column rowid -> keys -> cols -> Table rowid (Uncolumns cols)
-- important to produce name before looking at columns
table name rowid (columns -> keys) (columns -> cols) = Table name (check keys) (check cols)
where
check x | nubOrd (map colTable $ keys ++ cols) /= [name] = error "Column with the wrong table"
| not $ null $ map colName keys \\ map colName cols = error "Key column which is not one of the normal columns"
| colName rowid `notElem` ["","rowid"] = error "Rowid column must have name rowid"
| otherwise = x | 630 | table :: (Columns keys, Columns cols) => String -> Column rowid -> keys -> cols -> Table rowid (Uncolumns cols)
table name rowid (columns -> keys) (columns -> cols) = Table name (check keys) (check cols)
where
check x | nubOrd (map colTable $ keys ++ cols) /= [name] = error "Column with the wrong table"
| not $ null $ map colName keys \\ map colName cols = error "Key column which is not one of the normal columns"
| colName rowid `notElem` ["","rowid"] = error "Rowid column must have name rowid"
| otherwise = x | 575 | table name rowid (columns -> keys) (columns -> cols) = Table name (check keys) (check cols)
where
check x | nubOrd (map colTable $ keys ++ cols) /= [name] = error "Column with the wrong table"
| not $ null $ map colName keys \\ map colName cols = error "Key column which is not one of the normal columns"
| colName rowid `notElem` ["","rowid"] = error "Rowid column must have name rowid"
| otherwise = x | 463 | true | true | 1 | 13 | 165 | 223 | 107 | 116 | null | null |
da-x/ghc | compiler/utils/Outputable.hs | bsd-3-clause | -- | Returns the separated concatenation of the pretty printed things.
interppSP :: Outputable a => [a] -> SDoc
interppSP xs = sep (map ppr xs) | 145 | interppSP :: Outputable a => [a] -> SDoc
interppSP xs = sep (map ppr xs) | 74 | interppSP xs = sep (map ppr xs) | 32 | true | true | 0 | 7 | 27 | 40 | 20 | 20 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 4369 = 4368 | 11 | 4369 = 4368 | 11 | 4369 = 4368 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
gnn/Hets | Common/IRI.hs | gpl-2.0 | isegmentNzc :: IRIParser st String
isegmentNzc = flat . many1 $ uchar "@" | 73 | isegmentNzc :: IRIParser st String
isegmentNzc = flat . many1 $ uchar "@" | 73 | isegmentNzc = flat . many1 $ uchar "@" | 38 | false | true | 0 | 6 | 12 | 27 | 13 | 14 | null | null |
brendanhay/gogol | gogol-appengine/gen/Network/Google/Resource/AppEngine/Apps/AuthorizedDomains/List.hs | mpl-2.0 | -- | OAuth access token.
aadlAccessToken :: Lens' AppsAuthorizedDomainsList (Maybe Text)
aadlAccessToken
= lens _aadlAccessToken
(\ s a -> s{_aadlAccessToken = a}) | 171 | aadlAccessToken :: Lens' AppsAuthorizedDomainsList (Maybe Text)
aadlAccessToken
= lens _aadlAccessToken
(\ s a -> s{_aadlAccessToken = a}) | 146 | aadlAccessToken
= lens _aadlAccessToken
(\ s a -> s{_aadlAccessToken = a}) | 82 | true | true | 0 | 9 | 29 | 48 | 25 | 23 | null | null |
elginer/Delve | src/Util.hs | gpl-3.0 | -- this very is inefficient
-- seperate the last
sep :: [ a ] -> ( a , [ a ] )
sep lexec =
let lst = L.last lexec
unlst = drop_lst lexec
in ( lst , unlst ) | 172 | sep :: [ a ] -> ( a , [ a ] )
sep lexec =
let lst = L.last lexec
unlst = drop_lst lexec
in ( lst , unlst ) | 122 | sep lexec =
let lst = L.last lexec
unlst = drop_lst lexec
in ( lst , unlst ) | 92 | true | true | 0 | 10 | 56 | 68 | 35 | 33 | null | null |
frantisekfarka/ghc-dsi | testsuite/tests/codeGen/should_run/cgrun068.hs | bsd-3-clause | -- Create an array of arrays, with each sub-array having random length
-- and content.
setup :: Rng s (MArray s (MArray s Int))
setup = do
len <- rnd (1, numArrays)
marr <- liftST $ new_ len
let go i
| i >= len = return ()
| otherwise = do
n <- rnd (1, maxLen)
subarr <- liftST $ fromList [j*j | j <- [(0::Int)..n-1]]
liftST $ write marr i subarr
go (i+1)
go 0
return marr
-- Replace one of the sub-arrays with a newly allocated array. | 544 | setup :: Rng s (MArray s (MArray s Int))
setup = do
len <- rnd (1, numArrays)
marr <- liftST $ new_ len
let go i
| i >= len = return ()
| otherwise = do
n <- rnd (1, maxLen)
subarr <- liftST $ fromList [j*j | j <- [(0::Int)..n-1]]
liftST $ write marr i subarr
go (i+1)
go 0
return marr
-- Replace one of the sub-arrays with a newly allocated array. | 457 | setup = do
len <- rnd (1, numArrays)
marr <- liftST $ new_ len
let go i
| i >= len = return ()
| otherwise = do
n <- rnd (1, maxLen)
subarr <- liftST $ fromList [j*j | j <- [(0::Int)..n-1]]
liftST $ write marr i subarr
go (i+1)
go 0
return marr
-- Replace one of the sub-arrays with a newly allocated array. | 416 | true | true | 2 | 21 | 198 | 208 | 95 | 113 | null | null |
GaloisInc/ivorylang-org | site.hs | bsd-3-clause | main :: IO ()
main = hakyllWith config $ do
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "artifacts/*" $ do
route idRoute
compile copyFileCompiler
match "css/*" $ do
route idRoute
compile compressCssCompiler
match "bootstrap/css/*" $ do
route $ gsubRoute "bootstrap/" (const "")
compile compressCssCompiler
match "bootstrap/js/*.js" $ do
route $ gsubRoute "bootstrap/" (const "")
compile copyFileCompiler
match "jquery/*.js" $ do
route $ gsubRoute "jquery/" (const "js/")
compile copyFileCompiler
match "bootstrap/img/*" $ do
route $ gsubRoute "bootstrap/" (const "")
compile copyFileCompiler
match "templates/*" $ compile templateCompiler
standardPandocPagesSubdir "" | 861 | main :: IO ()
main = hakyllWith config $ do
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "artifacts/*" $ do
route idRoute
compile copyFileCompiler
match "css/*" $ do
route idRoute
compile compressCssCompiler
match "bootstrap/css/*" $ do
route $ gsubRoute "bootstrap/" (const "")
compile compressCssCompiler
match "bootstrap/js/*.js" $ do
route $ gsubRoute "bootstrap/" (const "")
compile copyFileCompiler
match "jquery/*.js" $ do
route $ gsubRoute "jquery/" (const "js/")
compile copyFileCompiler
match "bootstrap/img/*" $ do
route $ gsubRoute "bootstrap/" (const "")
compile copyFileCompiler
match "templates/*" $ compile templateCompiler
standardPandocPagesSubdir "" | 861 | main = hakyllWith config $ do
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "artifacts/*" $ do
route idRoute
compile copyFileCompiler
match "css/*" $ do
route idRoute
compile compressCssCompiler
match "bootstrap/css/*" $ do
route $ gsubRoute "bootstrap/" (const "")
compile compressCssCompiler
match "bootstrap/js/*.js" $ do
route $ gsubRoute "bootstrap/" (const "")
compile copyFileCompiler
match "jquery/*.js" $ do
route $ gsubRoute "jquery/" (const "js/")
compile copyFileCompiler
match "bootstrap/img/*" $ do
route $ gsubRoute "bootstrap/" (const "")
compile copyFileCompiler
match "templates/*" $ compile templateCompiler
standardPandocPagesSubdir "" | 847 | false | true | 2 | 14 | 259 | 251 | 99 | 152 | null | null |
thalerjonathan/phd | coding/learning/haskell/grahambook/Code_Solutions/Parsing.hs | gpl-3.0 | sat :: (Char -> Bool) -> Parser Char
sat p = do x <- item
if p x then return x else empty | 100 | sat :: (Char -> Bool) -> Parser Char
sat p = do x <- item
if p x then return x else empty | 100 | sat p = do x <- item
if p x then return x else empty | 63 | false | true | 0 | 8 | 33 | 57 | 26 | 31 | null | null |
JamesSullivan1/Minisculus | src/MinisculusParser.hs | mit | {- Error messages detailing the set of acceptable next symbols for each
- given state. IE, the first sets of each state.
-}
stmtExpected = "if, while, input, [identifier], write, or begin" | 197 | stmtExpected = "if, while, input, [identifier], write, or begin" | 71 | stmtExpected = "if, while, input, [identifier], write, or begin" | 71 | true | false | 0 | 4 | 40 | 7 | 4 | 3 | null | null |
diku-dk/futhark | src/Futhark/Pass/ExtractKernels/ISRWIM.hs | isc | stripIdentOuterDim :: Ident -> Ident
stripIdentOuterDim ident =
ident {identType = rowType $ identType ident} | 111 | stripIdentOuterDim :: Ident -> Ident
stripIdentOuterDim ident =
ident {identType = rowType $ identType ident} | 111 | stripIdentOuterDim ident =
ident {identType = rowType $ identType ident} | 74 | false | true | 0 | 8 | 16 | 33 | 17 | 16 | null | null |
nevrenato/Hets_Fork | Static/ComputeTheory.hs | gpl-2.0 | getImportNames :: DGraph -> Node -> [String]
getImportNames dg = map (\ (s, _, _) -> getDGNodeName $ labDG dg s)
. getImports dg | 130 | getImportNames :: DGraph -> Node -> [String]
getImportNames dg = map (\ (s, _, _) -> getDGNodeName $ labDG dg s)
. getImports dg | 130 | getImportNames dg = map (\ (s, _, _) -> getDGNodeName $ labDG dg s)
. getImports dg | 85 | false | true | 1 | 9 | 25 | 62 | 32 | 30 | null | null |
paulbarbu/ePseudocode | src/EPseudocode/Lexer.hs | bsd-3-clause | -- FIXME: translate
tAnd = "si" | 31 | tAnd = "si" | 11 | tAnd = "si" | 11 | true | false | 0 | 4 | 5 | 7 | 4 | 3 | null | null |
sdiehl/ghc | testsuite/tests/typecheck/should_compile/T7891.hs | bsd-3-clause | tf :: T
tf = T id | 17 | tf :: T
tf = T id | 17 | tf = T id | 9 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
urbanslug/ghc | compiler/prelude/THNames.hs | bsd-3-clause | asPName = libFun (fsLit "asP") asPIdKey | 45 | asPName = libFun (fsLit "asP") asPIdKey | 45 | asPName = libFun (fsLit "asP") asPIdKey | 45 | false | false | 1 | 7 | 11 | 21 | 8 | 13 | null | null |
rsasse/tamarin-prover | lib/theory/src/Theory/Tools/EquationStore.hs | gpl-3.0 | addEqs :: MonadFresh m
=> MaudeHandle -> [Equal LNTerm] -> EqStore -> m (EqStore, Maybe SplitId)
addEqs hnd eqs0 eqStore =
case unifyLNTermFactored eqs `runReader` hnd of
(_, []) ->
return (set eqsConj falseEqConstrConj eqStore, Nothing)
(subst, [substFresh]) | substFresh == emptySubstVFresh ->
return (applyEqStore hnd subst eqStore, Nothing)
(subst, substs) -> do
let (eqStore', sid) = addDisj (applyEqStore hnd subst eqStore)
(S.fromList substs)
return (eqStore', Just sid)
{-
case splitStrat of
SplitLater ->
return [ addDisj (applyEqStore hnd subst eqStore) (S.fromList substs) ]
SplitNow ->
addEqsAC (modify eqsSubst (compose subst) eqStore)
<$> simpDisjunction hnd (const False) (Disj substs)
-}
where
eqs = apply (L.get eqsSubst eqStore) $ trace (unlines ["addEqs: ", show eqs0]) $ eqs0
{-
addEqsAC eqSt (sfree, Nothing) = [ applyEqStore hnd sfree eqSt ]
addEqsAC eqSt (sfree, Just disj) =
fromMaybe (error "addEqsSplit: impossible, splitAtPos failed")
(splitAtPos (applyEqStore hnd sfree (addDisj eqSt (S.fromList disj))) 0)
-}
-- | Apply a substitution to an equation store and bring resulting equations into
-- normal form again by using unification. | 1,464 | addEqs :: MonadFresh m
=> MaudeHandle -> [Equal LNTerm] -> EqStore -> m (EqStore, Maybe SplitId)
addEqs hnd eqs0 eqStore =
case unifyLNTermFactored eqs `runReader` hnd of
(_, []) ->
return (set eqsConj falseEqConstrConj eqStore, Nothing)
(subst, [substFresh]) | substFresh == emptySubstVFresh ->
return (applyEqStore hnd subst eqStore, Nothing)
(subst, substs) -> do
let (eqStore', sid) = addDisj (applyEqStore hnd subst eqStore)
(S.fromList substs)
return (eqStore', Just sid)
{-
case splitStrat of
SplitLater ->
return [ addDisj (applyEqStore hnd subst eqStore) (S.fromList substs) ]
SplitNow ->
addEqsAC (modify eqsSubst (compose subst) eqStore)
<$> simpDisjunction hnd (const False) (Disj substs)
-}
where
eqs = apply (L.get eqsSubst eqStore) $ trace (unlines ["addEqs: ", show eqs0]) $ eqs0
{-
addEqsAC eqSt (sfree, Nothing) = [ applyEqStore hnd sfree eqSt ]
addEqsAC eqSt (sfree, Just disj) =
fromMaybe (error "addEqsSplit: impossible, splitAtPos failed")
(splitAtPos (applyEqStore hnd sfree (addDisj eqSt (S.fromList disj))) 0)
-}
-- | Apply a substitution to an equation store and bring resulting equations into
-- normal form again by using unification. | 1,464 | addEqs hnd eqs0 eqStore =
case unifyLNTermFactored eqs `runReader` hnd of
(_, []) ->
return (set eqsConj falseEqConstrConj eqStore, Nothing)
(subst, [substFresh]) | substFresh == emptySubstVFresh ->
return (applyEqStore hnd subst eqStore, Nothing)
(subst, substs) -> do
let (eqStore', sid) = addDisj (applyEqStore hnd subst eqStore)
(S.fromList substs)
return (eqStore', Just sid)
{-
case splitStrat of
SplitLater ->
return [ addDisj (applyEqStore hnd subst eqStore) (S.fromList substs) ]
SplitNow ->
addEqsAC (modify eqsSubst (compose subst) eqStore)
<$> simpDisjunction hnd (const False) (Disj substs)
-}
where
eqs = apply (L.get eqsSubst eqStore) $ trace (unlines ["addEqs: ", show eqs0]) $ eqs0
{-
addEqsAC eqSt (sfree, Nothing) = [ applyEqStore hnd sfree eqSt ]
addEqsAC eqSt (sfree, Just disj) =
fromMaybe (error "addEqsSplit: impossible, splitAtPos failed")
(splitAtPos (applyEqStore hnd sfree (addDisj eqSt (S.fromList disj))) 0)
-}
-- | Apply a substitution to an equation store and bring resulting equations into
-- normal form again by using unification. | 1,360 | false | true | 1 | 16 | 472 | 264 | 132 | 132 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Text/Greek/NewTestament/SBL.hs | mit | whenNothing :: a -> Maybe b -> Either a b
whenNothing _ (Just b) = Right b | 74 | whenNothing :: a -> Maybe b -> Either a b
whenNothing _ (Just b) = Right b | 74 | whenNothing _ (Just b) = Right b | 32 | false | true | 0 | 7 | 16 | 41 | 19 | 22 | null | null |
hirokai/PaperServer | Parser/Publisher/Nature2.hs | bsd-2-clause | nature2AReader
= _nature2Reader{
supported=_supportedA
,mainHtml=onlyFull _mainHtmlA
,toc=onlyFull tocA
,abstract=absLevel abstractA
,readerName=_readerNameA
} | 195 | nature2AReader
= _nature2Reader{
supported=_supportedA
,mainHtml=onlyFull _mainHtmlA
,toc=onlyFull tocA
,abstract=absLevel abstractA
,readerName=_readerNameA
} | 195 | nature2AReader
= _nature2Reader{
supported=_supportedA
,mainHtml=onlyFull _mainHtmlA
,toc=onlyFull tocA
,abstract=absLevel abstractA
,readerName=_readerNameA
} | 195 | false | false | 1 | 8 | 47 | 51 | 27 | 24 | null | null |
kim/amazonka | amazonka-elasticache/gen/Network/AWS/ElastiCache/Types.hs | mpl-2.0 | -- | A list of parameters specific to a particular cache node type. Each element
-- in the list contains detailed information about one parameter.
edCacheNodeTypeSpecificParameters :: Lens' EngineDefaults [CacheNodeTypeSpecificParameter]
edCacheNodeTypeSpecificParameters =
lens _edCacheNodeTypeSpecificParameters
(\s a -> s { _edCacheNodeTypeSpecificParameters = a })
. _List | 400 | edCacheNodeTypeSpecificParameters :: Lens' EngineDefaults [CacheNodeTypeSpecificParameter]
edCacheNodeTypeSpecificParameters =
lens _edCacheNodeTypeSpecificParameters
(\s a -> s { _edCacheNodeTypeSpecificParameters = a })
. _List | 253 | edCacheNodeTypeSpecificParameters =
lens _edCacheNodeTypeSpecificParameters
(\s a -> s { _edCacheNodeTypeSpecificParameters = a })
. _List | 162 | true | true | 1 | 8 | 68 | 51 | 27 | 24 | null | null |
apyrgio/ganeti | src/Ganeti/Utils.hs | bsd-2-clause | -- | Convert a ClockTime into a (seconds-only) timestamp.
clockTimeToString :: ClockTime -> String
clockTimeToString (TOD t _) = show t | 135 | clockTimeToString :: ClockTime -> String
clockTimeToString (TOD t _) = show t | 77 | clockTimeToString (TOD t _) = show t | 36 | true | true | 0 | 7 | 20 | 30 | 15 | 15 | null | null |
bhamrick/RouteNeo | Pokemon/Route.hs | bsd-3-clause | trainerBattleState :: MonadRoute m => Integer -> m BattleState
trainerBattleState offset =
case Map.lookup offset trainersByOffset of
Nothing -> throwError (printf "Could not find trainer offset 0x%X" offset)
Just t ->
case trainerBattleParty t of
[] -> throwError (printf "Trainer offset 0x%X has an empty party" offset)
eLead:eRest -> do
pParty <- use party
curBadges <- use badges
case pParty of
[] -> throwError "Player has an empty party"
pLead:pRest ->
return $
BattleState
{ _playerActive =
FromParty
{ _fpIndex = 0
, _fpData = participant False curBadges pLead
}
, _playerBench =
zipWith (\i d ->
FromParty
{ _fpIndex = i
, _fpData = d
}
) [1..] pRest
, _enemyActive =
FromParty
{ _fpIndex = 0
, _fpData = participant True noBadges eLead
}
, _enemyBench =
zipWith (\i d ->
FromParty
{ _fpIndex = i
, _fpData = d
}
) [1..] eRest
, _playerBadges = curBadges
, _turnCount = 0
, _halfTurnCount = 0
, _frameCount = 0
} | 2,357 | trainerBattleState :: MonadRoute m => Integer -> m BattleState
trainerBattleState offset =
case Map.lookup offset trainersByOffset of
Nothing -> throwError (printf "Could not find trainer offset 0x%X" offset)
Just t ->
case trainerBattleParty t of
[] -> throwError (printf "Trainer offset 0x%X has an empty party" offset)
eLead:eRest -> do
pParty <- use party
curBadges <- use badges
case pParty of
[] -> throwError "Player has an empty party"
pLead:pRest ->
return $
BattleState
{ _playerActive =
FromParty
{ _fpIndex = 0
, _fpData = participant False curBadges pLead
}
, _playerBench =
zipWith (\i d ->
FromParty
{ _fpIndex = i
, _fpData = d
}
) [1..] pRest
, _enemyActive =
FromParty
{ _fpIndex = 0
, _fpData = participant True noBadges eLead
}
, _enemyBench =
zipWith (\i d ->
FromParty
{ _fpIndex = i
, _fpData = d
}
) [1..] eRest
, _playerBadges = curBadges
, _turnCount = 0
, _halfTurnCount = 0
, _frameCount = 0
} | 2,357 | trainerBattleState offset =
case Map.lookup offset trainersByOffset of
Nothing -> throwError (printf "Could not find trainer offset 0x%X" offset)
Just t ->
case trainerBattleParty t of
[] -> throwError (printf "Trainer offset 0x%X has an empty party" offset)
eLead:eRest -> do
pParty <- use party
curBadges <- use badges
case pParty of
[] -> throwError "Player has an empty party"
pLead:pRest ->
return $
BattleState
{ _playerActive =
FromParty
{ _fpIndex = 0
, _fpData = participant False curBadges pLead
}
, _playerBench =
zipWith (\i d ->
FromParty
{ _fpIndex = i
, _fpData = d
}
) [1..] pRest
, _enemyActive =
FromParty
{ _fpIndex = 0
, _fpData = participant True noBadges eLead
}
, _enemyBench =
zipWith (\i d ->
FromParty
{ _fpIndex = i
, _fpData = d
}
) [1..] eRest
, _playerBadges = curBadges
, _turnCount = 0
, _halfTurnCount = 0
, _frameCount = 0
} | 2,294 | false | true | 0 | 23 | 1,598 | 313 | 167 | 146 | null | null |
google-research/dex-lang | src/lib/Parser.hs | bsd-3-clause | toNestParsed :: [a VoidS VoidS] -> Nest a VoidS VoidS
toNestParsed = foldr Nest Empty | 85 | toNestParsed :: [a VoidS VoidS] -> Nest a VoidS VoidS
toNestParsed = foldr Nest Empty | 85 | toNestParsed = foldr Nest Empty | 31 | false | true | 0 | 8 | 14 | 42 | 18 | 24 | null | null |
nfjinjing/bench-euler | src/Math/PolyaCounting.hs | bsd-3-clause | -- ROTATION GROUP OF CUBE (AS PERMUTATION OF FACES)
-- 1
-- 2 3 4 5
-- 6
cubeF = fromCycles [[1],[2,3,4,5],[6]] | 121 | cubeF = fromCycles [[1],[2,3,4,5],[6]] | 38 | cubeF = fromCycles [[1],[2,3,4,5],[6]] | 38 | true | false | 1 | 6 | 31 | 43 | 26 | 17 | null | null |
Axiomatic-/nano-md5 | Data/Digest/OpenSSL/MD5.hs | bsd-3-clause | md5_digest_length :: Int
md5_digest_length = 16 | 47 | md5_digest_length :: Int
md5_digest_length = 16 | 47 | md5_digest_length = 16 | 22 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
plow-technologies/ble | src/Bluetooth/Internal/Errors.hs | bsd-3-clause | errorInProgress :: Handler a
errorInProgress = throwError "org.bluez.Error.InProgress" | 86 | errorInProgress :: Handler a
errorInProgress = throwError "org.bluez.Error.InProgress" | 86 | errorInProgress = throwError "org.bluez.Error.InProgress" | 57 | false | true | 1 | 5 | 7 | 20 | 8 | 12 | null | null |
nushio3/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | mkNakedAppTys :: Type -> [Type] -> Type
-- See Note [Type-checking inside the knot] in TcHsType
mkNakedAppTys ty1 [] = ty1 | 139 | mkNakedAppTys :: Type -> [Type] -> Type
mkNakedAppTys ty1 [] = ty1 | 83 | mkNakedAppTys ty1 [] = ty1 | 43 | true | true | 0 | 7 | 37 | 30 | 16 | 14 | null | null |
tjakway/ghcjvm | compiler/codeGen/StgCmmClosure.hs | bsd-3-clause | -------------
mkSelectorLFInfo :: Id -> Int -> Bool -> LambdaFormInfo
mkSelectorLFInfo id offset updatable
= LFThunk NotTopLevel False updatable (SelectorThunk offset)
(might_be_a_function (idType id)) | 211 | mkSelectorLFInfo :: Id -> Int -> Bool -> LambdaFormInfo
mkSelectorLFInfo id offset updatable
= LFThunk NotTopLevel False updatable (SelectorThunk offset)
(might_be_a_function (idType id)) | 197 | mkSelectorLFInfo id offset updatable
= LFThunk NotTopLevel False updatable (SelectorThunk offset)
(might_be_a_function (idType id)) | 141 | true | true | 0 | 9 | 33 | 69 | 31 | 38 | null | null |
mfpi/configs | xmonad/xmonad.hs | mit | -------------------- Support for per-screen xmobars ---------
-- Some parts of this should be merged into contrib sometime
getScreens :: IO [Int]
getScreens = openDisplay "" >>= liftA2 (<*) f closeDisplay
where f = fmap (zipWith const [0..]) . getScreenInfo | 261 | getScreens :: IO [Int]
getScreens = openDisplay "" >>= liftA2 (<*) f closeDisplay
where f = fmap (zipWith const [0..]) . getScreenInfo | 138 | getScreens = openDisplay "" >>= liftA2 (<*) f closeDisplay
where f = fmap (zipWith const [0..]) . getScreenInfo | 115 | true | true | 0 | 11 | 42 | 60 | 32 | 28 | null | null |
andrebask/newsprint | src/UserInterface/NewsPrint/Handler/Home.hs | apache-2.0 | getHomeR :: Handler Html
getHomeR = do user <- lookupSession "user"
case user of
Nothing -> do setUltDestCurrent
sendFile "text/html" "static/home.html"
Just user -> do redirect SessionR | 271 | getHomeR :: Handler Html
getHomeR = do user <- lookupSession "user"
case user of
Nothing -> do setUltDestCurrent
sendFile "text/html" "static/home.html"
Just user -> do redirect SessionR | 271 | getHomeR = do user <- lookupSession "user"
case user of
Nothing -> do setUltDestCurrent
sendFile "text/html" "static/home.html"
Just user -> do redirect SessionR | 246 | false | true | 0 | 12 | 111 | 63 | 27 | 36 | null | null |
facebookarchive/lex-pass | src/Lang/Php/Ast/StmtParse.hs | bsd-3-clause | ifRestP :: Bool -> IC.Intercal (IfBlock, WS) (Maybe WS) -> Parser (If, WS)
ifRestP isColon soFar =
elseifContP isColon soFar <|>
elseContP isColon soFar <|>
do
w' <- if isColon then tokEndifP >> parse else return []
return (If isColon soFar' Nothing, w ++ w')
where
(soFar', w) = ifReconstr soFar
-- | Parse a conditional-and-block ensuring that its colon-syntax-or-not
-- matches the rest of the "if" control structure. | 439 | ifRestP :: Bool -> IC.Intercal (IfBlock, WS) (Maybe WS) -> Parser (If, WS)
ifRestP isColon soFar =
elseifContP isColon soFar <|>
elseContP isColon soFar <|>
do
w' <- if isColon then tokEndifP >> parse else return []
return (If isColon soFar' Nothing, w ++ w')
where
(soFar', w) = ifReconstr soFar
-- | Parse a conditional-and-block ensuring that its colon-syntax-or-not
-- matches the rest of the "if" control structure. | 439 | ifRestP isColon soFar =
elseifContP isColon soFar <|>
elseContP isColon soFar <|>
do
w' <- if isColon then tokEndifP >> parse else return []
return (If isColon soFar' Nothing, w ++ w')
where
(soFar', w) = ifReconstr soFar
-- | Parse a conditional-and-block ensuring that its colon-syntax-or-not
-- matches the rest of the "if" control structure. | 364 | false | true | 0 | 11 | 87 | 143 | 70 | 73 | null | null |
akaspin/wai-middleware-cache | test/Main.hs | bsd-2-clause | ----------------------------------------------------------------------------
-- Assertions
----------------------------------------------------------------------------
assertResponseBase :: SResponse -> Session ()
assertResponseBase r = do
assertStatus 200 r
assertBody sourceData r
----------------------------------------------------------------------------
-- Applications
---------------------------------------------------------------------------- | 473 | assertResponseBase :: SResponse -> Session ()
assertResponseBase r = do
assertStatus 200 r
assertBody sourceData r
----------------------------------------------------------------------------
-- Applications
---------------------------------------------------------------------------- | 299 | assertResponseBase r = do
assertStatus 200 r
assertBody sourceData r
----------------------------------------------------------------------------
-- Applications
---------------------------------------------------------------------------- | 253 | true | true | 0 | 7 | 44 | 45 | 23 | 22 | null | null |
everyevery/programming_study | hackerrank/functional/rotate-string/rotate-string.hs | mit | solve :: String -> String
solve ss = let l = length ss
in map (\(i,c) -> if (mod i (l+1) == 0) then ' ' else c) $ take ((l+1)*l) $ zip [1..] $ drop 1 $ cycle ss | 172 | solve :: String -> String
solve ss = let l = length ss
in map (\(i,c) -> if (mod i (l+1) == 0) then ' ' else c) $ take ((l+1)*l) $ zip [1..] $ drop 1 $ cycle ss | 172 | solve ss = let l = length ss
in map (\(i,c) -> if (mod i (l+1) == 0) then ' ' else c) $ take ((l+1)*l) $ zip [1..] $ drop 1 $ cycle ss | 146 | false | true | 0 | 19 | 51 | 121 | 62 | 59 | null | null |
spacekitteh/compdata | benchmark/Functions/Standard/Desugar.hs | bsd-3-clause | desug' (PEq x y) = PEq (desug' x) (desug' y) | 44 | desug' (PEq x y) = PEq (desug' x) (desug' y) | 44 | desug' (PEq x y) = PEq (desug' x) (desug' y) | 44 | false | false | 0 | 7 | 9 | 34 | 16 | 18 | null | null |
Copilot-Language/sbv-for-copilot | Data/SBV/Examples/Puzzles/U2Bridge.hs | bsd-3-clause | isValid :: Actions -> SBool
isValid as = time end .<= 17 &&& bAll check as &&& zigZag (cycle [there, here]) (map flash states) &&& bAll (.== there) [lBono end, lEdge end, lAdam end, lLarry end]
where check (s, p1, p2) = (bnot s ==> p1 .> p2) -- for two person moves, ensure first person is "larger"
&&& (s ==> p2 .== bono) -- for one person moves, ensure second person is always "bono"
states = evalState (run as) start
end = last states
zigZag reqs locs = bAnd $ zipWith (.==) locs reqs
-------------------------------------------------------------
-- * Solving the puzzle
-------------------------------------------------------------
-- | See if there is a solution that has precisely @n@ steps | 764 | isValid :: Actions -> SBool
isValid as = time end .<= 17 &&& bAll check as &&& zigZag (cycle [there, here]) (map flash states) &&& bAll (.== there) [lBono end, lEdge end, lAdam end, lLarry end]
where check (s, p1, p2) = (bnot s ==> p1 .> p2) -- for two person moves, ensure first person is "larger"
&&& (s ==> p2 .== bono) -- for one person moves, ensure second person is always "bono"
states = evalState (run as) start
end = last states
zigZag reqs locs = bAnd $ zipWith (.==) locs reqs
-------------------------------------------------------------
-- * Solving the puzzle
-------------------------------------------------------------
-- | See if there is a solution that has precisely @n@ steps | 764 | isValid as = time end .<= 17 &&& bAll check as &&& zigZag (cycle [there, here]) (map flash states) &&& bAll (.== there) [lBono end, lEdge end, lAdam end, lLarry end]
where check (s, p1, p2) = (bnot s ==> p1 .> p2) -- for two person moves, ensure first person is "larger"
&&& (s ==> p2 .== bono) -- for one person moves, ensure second person is always "bono"
states = evalState (run as) start
end = last states
zigZag reqs locs = bAnd $ zipWith (.==) locs reqs
-------------------------------------------------------------
-- * Solving the puzzle
-------------------------------------------------------------
-- | See if there is a solution that has precisely @n@ steps | 736 | false | true | 3 | 10 | 182 | 202 | 106 | 96 | null | null |
paulolieuthier/criterion | Criterion/IO.hs | bsd-2-clause | readAll :: Binary a => Handle -> IO [a]
readAll handle = do
let go bs
| L.null bs = return []
| otherwise = case runGetOrFail get bs of
Left (_, _, err) -> fail err
Right (bs', _, a) -> (a:) `fmap` go bs'
go =<< L.hGetContents handle
#else
readAll :: Binary a => Handle -> IO [a]
readAll handle = do
let go i bs
| L.null bs = return []
| otherwise =
let (a, bs', i') = runGetState get bs i
in (a:) `fmap` go i' bs'
go 0 =<< L.hGetContents handle
#endif | 571 | readAll :: Binary a => Handle -> IO [a]
readAll handle = do
let go bs
| L.null bs = return []
| otherwise = case runGetOrFail get bs of
Left (_, _, err) -> fail err
Right (bs', _, a) -> (a:) `fmap` go bs'
go =<< L.hGetContents handle
#else
readAll :: Binary a => Handle -> IO [a]
readAll handle = do
let go i bs
| L.null bs = return []
| otherwise =
let (a, bs', i') = runGetState get bs i
in (a:) `fmap` go i' bs'
go 0 =<< L.hGetContents handle
#endif | 571 | readAll handle = do
let go bs
| L.null bs = return []
| otherwise = case runGetOrFail get bs of
Left (_, _, err) -> fail err
Right (bs', _, a) -> (a:) `fmap` go bs'
go =<< L.hGetContents handle
#else
readAll :: Binary a => Handle -> IO [a]
readAll handle = do
let go i bs
| L.null bs = return []
| otherwise =
let (a, bs', i') = runGetState get bs i
in (a:) `fmap` go i' bs'
go 0 =<< L.hGetContents handle
#endif | 531 | false | true | 0 | 15 | 216 | 142 | 69 | 73 | null | null |
phaazon/Idris-dev | src/IRTS/CodegenJavaScript.hs | bsd-3-clause | codegenJavaScript :: CodeGenerator
codegenJavaScript ci =
codegenJS_all JavaScript (simpleDecls ci)
(includes ci) [] (outputFile ci) (outputType ci) | 154 | codegenJavaScript :: CodeGenerator
codegenJavaScript ci =
codegenJS_all JavaScript (simpleDecls ci)
(includes ci) [] (outputFile ci) (outputType ci) | 154 | codegenJavaScript ci =
codegenJS_all JavaScript (simpleDecls ci)
(includes ci) [] (outputFile ci) (outputType ci) | 119 | false | true | 0 | 7 | 22 | 63 | 27 | 36 | null | null |
betaveros/hyperpolymorph | morph.hs | mit | isId :: Char -> Bool
isId c = isAlphaNum c || c == '_' | 54 | isId :: Char -> Bool
isId c = isAlphaNum c || c == '_' | 54 | isId c = isAlphaNum c || c == '_' | 33 | false | true | 1 | 7 | 13 | 40 | 17 | 23 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F16.hs | bsd-3-clause | ptr_glMap2f :: FunPtr (GLenum -> GLfloat -> GLfloat -> GLint -> GLint -> GLfloat -> GLfloat -> GLint -> GLint -> Ptr GLfloat -> IO ())
ptr_glMap2f = unsafePerformIO $ getCommand "glMap2f" | 187 | ptr_glMap2f :: FunPtr (GLenum -> GLfloat -> GLfloat -> GLint -> GLint -> GLfloat -> GLfloat -> GLint -> GLint -> Ptr GLfloat -> IO ())
ptr_glMap2f = unsafePerformIO $ getCommand "glMap2f" | 187 | ptr_glMap2f = unsafePerformIO $ getCommand "glMap2f" | 52 | false | true | 0 | 18 | 31 | 72 | 35 | 37 | null | null |
shnarazk/mios | src/SAT/Mios/Criteria.hs | gpl-3.0 | -- | print statatistic data to stdio. This should be called after each restart.
dumpStats :: DumpMode -> Solver -> IO ()
dumpStats NoDump _ = return () | 151 | dumpStats :: DumpMode -> Solver -> IO ()
dumpStats NoDump _ = return () | 71 | dumpStats NoDump _ = return () | 30 | true | true | 0 | 8 | 27 | 35 | 17 | 18 | null | null |
stevezhee/pec | src/PecGen.hs | bsd-3-clause | hType :: P.Type -> H.Type
hType x = hFixType $ case x of
TyCxt ys z -> hTyForall (map hAsst ys) (hType z)
P.TyFun a b -> H.TyFun (hType a) (hType b)
TyVoid -> hTyTuple []
TyConstr a bs -> tyApps (tyCon a) $ map hType bs
TyVarT a -> tyVar a | 249 | hType :: P.Type -> H.Type
hType x = hFixType $ case x of
TyCxt ys z -> hTyForall (map hAsst ys) (hType z)
P.TyFun a b -> H.TyFun (hType a) (hType b)
TyVoid -> hTyTuple []
TyConstr a bs -> tyApps (tyCon a) $ map hType bs
TyVarT a -> tyVar a | 249 | hType x = hFixType $ case x of
TyCxt ys z -> hTyForall (map hAsst ys) (hType z)
P.TyFun a b -> H.TyFun (hType a) (hType b)
TyVoid -> hTyTuple []
TyConstr a bs -> tyApps (tyCon a) $ map hType bs
TyVarT a -> tyVar a | 223 | false | true | 3 | 8 | 61 | 136 | 67 | 69 | null | null |
bernstein/ircfs | Network/IRC/Message/Types.hs | bsd-3-clause | numericMsg 383 = RPL_YOURESERVICE | 33 | numericMsg 383 = RPL_YOURESERVICE | 33 | numericMsg 383 = RPL_YOURESERVICE | 33 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
michaeljklein/CPlug | src/Parse.hs | bsd-3-clause | splitToNamedVar :: (T.Text, T.Text) -> NamedVar
splitToNamedVar (t, n) = NameVar {varType = t, varName = n} | 107 | splitToNamedVar :: (T.Text, T.Text) -> NamedVar
splitToNamedVar (t, n) = NameVar {varType = t, varName = n} | 107 | splitToNamedVar (t, n) = NameVar {varType = t, varName = n} | 59 | false | true | 0 | 7 | 16 | 48 | 28 | 20 | null | null |
spacekitteh/smcghc | compiler/vectorise/Vectorise/Utils/PADict.hs | bsd-3-clause | -- |Construct the PA argument type for the tyvar. For the tyvar (v :: *) it's
-- just PA v. For (v :: (* -> *) -> *) it's
--
-- > forall (a :: * -> *). (forall (b :: *). PA b -> PA (a b)) -> PA (v a)
--
paDictArgType :: TyVar -> VM (Maybe Type)
paDictArgType tv = go (TyVarTy tv) (tyVarKind tv)
where
go ty (FunTy k1 k2)
= do
tv <- newTyVar (fsLit "a") k1
mty1 <- go (TyVarTy tv) k1
case mty1 of
Just ty1 -> do
mty2 <- go (AppTy ty (TyVarTy tv)) k2
return $ fmap (ForAllTy tv . FunTy ty1) mty2
Nothing -> go ty k2
go ty k
| isLiftedTypeKind k
= do
pa_cls <- builtin paClass
return $ Just $ mkClassPred pa_cls [ty]
go _ _ = return Nothing
-- |Get the PA dictionary for some type
-- | 845 | paDictArgType :: TyVar -> VM (Maybe Type)
paDictArgType tv = go (TyVarTy tv) (tyVarKind tv)
where
go ty (FunTy k1 k2)
= do
tv <- newTyVar (fsLit "a") k1
mty1 <- go (TyVarTy tv) k1
case mty1 of
Just ty1 -> do
mty2 <- go (AppTy ty (TyVarTy tv)) k2
return $ fmap (ForAllTy tv . FunTy ty1) mty2
Nothing -> go ty k2
go ty k
| isLiftedTypeKind k
= do
pa_cls <- builtin paClass
return $ Just $ mkClassPred pa_cls [ty]
go _ _ = return Nothing
-- |Get the PA dictionary for some type
-- | 642 | paDictArgType tv = go (TyVarTy tv) (tyVarKind tv)
where
go ty (FunTy k1 k2)
= do
tv <- newTyVar (fsLit "a") k1
mty1 <- go (TyVarTy tv) k1
case mty1 of
Just ty1 -> do
mty2 <- go (AppTy ty (TyVarTy tv)) k2
return $ fmap (ForAllTy tv . FunTy ty1) mty2
Nothing -> go ty k2
go ty k
| isLiftedTypeKind k
= do
pa_cls <- builtin paClass
return $ Just $ mkClassPred pa_cls [ty]
go _ _ = return Nothing
-- |Get the PA dictionary for some type
-- | 600 | true | true | 1 | 17 | 315 | 259 | 118 | 141 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.