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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sinelaw/buildsome | src/BMake/Interpreter.hs | gpl-2.0 | errWithFilePos :: FilePos -> String -> a
errWithFilePos (filename, AlexPn _ line col) str =
error $ BS8.unpack filename ++ ":" ++ show line ++ ":" ++ show col ++ ": " ++ str | 177 | errWithFilePos :: FilePos -> String -> a
errWithFilePos (filename, AlexPn _ line col) str =
error $ BS8.unpack filename ++ ":" ++ show line ++ ":" ++ show col ++ ": " ++ str | 177 | errWithFilePos (filename, AlexPn _ line col) str =
error $ BS8.unpack filename ++ ":" ++ show line ++ ":" ++ show col ++ ": " ++ str | 136 | false | true | 2 | 10 | 37 | 83 | 38 | 45 | null | null |
nilscc/weightlifting.cc | src-hs/LiftMe/Html/Menu.hs | bsd-3-clause | defaultMenuText :: MenuText
defaultMenuText = MenuText
{ mt_notRegistered = "Not registered."
} | 99 | defaultMenuText :: MenuText
defaultMenuText = MenuText
{ mt_notRegistered = "Not registered."
} | 99 | defaultMenuText = MenuText
{ mt_notRegistered = "Not registered."
} | 71 | false | true | 0 | 6 | 15 | 22 | 12 | 10 | null | null |
AndreasPK/stack | src/main/Main.hs | bsd-3-clause | -- | Helper for build and install commands
buildCmd :: BuildOptsCLI -> GlobalOpts -> IO ()
buildCmd opts go = do
when (any (("-prof" `elem`) . either (const []) id . parseArgs Escaping) (boptsCLIGhcOptions opts)) $ do
hPutStrLn stderr "When building with stack, you should not use the -prof GHC option"
hPutStrLn stderr "Instead, please use --library-profiling and --executable-profiling"
hPutStrLn stderr "See: https://github.com/commercialhaskell/stack/issues/1015"
error "-prof GHC option submitted"
case boptsCLIFileWatch opts of
FileWatchPoll -> fileWatchPoll stderr inner
FileWatch -> fileWatch stderr inner
NoFileWatch -> inner $ const $ return ()
where
inner setLocalFiles = withBuildConfigAndLock go' $ \lk ->
Stack.Build.build setLocalFiles lk opts
-- Read the build command from the CLI and enable it to run
go' = case boptsCLICommand opts of
Test -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidTestsL) (Just True) go
Haddock -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidHaddockL) (Just True) go
Bench -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidBenchmarksL) (Just True) go
Install -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidInstallExesL) (Just True) go
Build -> go -- Default case is just Build | 1,356 | buildCmd :: BuildOptsCLI -> GlobalOpts -> IO ()
buildCmd opts go = do
when (any (("-prof" `elem`) . either (const []) id . parseArgs Escaping) (boptsCLIGhcOptions opts)) $ do
hPutStrLn stderr "When building with stack, you should not use the -prof GHC option"
hPutStrLn stderr "Instead, please use --library-profiling and --executable-profiling"
hPutStrLn stderr "See: https://github.com/commercialhaskell/stack/issues/1015"
error "-prof GHC option submitted"
case boptsCLIFileWatch opts of
FileWatchPoll -> fileWatchPoll stderr inner
FileWatch -> fileWatch stderr inner
NoFileWatch -> inner $ const $ return ()
where
inner setLocalFiles = withBuildConfigAndLock go' $ \lk ->
Stack.Build.build setLocalFiles lk opts
-- Read the build command from the CLI and enable it to run
go' = case boptsCLICommand opts of
Test -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidTestsL) (Just True) go
Haddock -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidHaddockL) (Just True) go
Bench -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidBenchmarksL) (Just True) go
Install -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidInstallExesL) (Just True) go
Build -> go -- Default case is just Build | 1,313 | buildCmd opts go = do
when (any (("-prof" `elem`) . either (const []) id . parseArgs Escaping) (boptsCLIGhcOptions opts)) $ do
hPutStrLn stderr "When building with stack, you should not use the -prof GHC option"
hPutStrLn stderr "Instead, please use --library-profiling and --executable-profiling"
hPutStrLn stderr "See: https://github.com/commercialhaskell/stack/issues/1015"
error "-prof GHC option submitted"
case boptsCLIFileWatch opts of
FileWatchPoll -> fileWatchPoll stderr inner
FileWatch -> fileWatch stderr inner
NoFileWatch -> inner $ const $ return ()
where
inner setLocalFiles = withBuildConfigAndLock go' $ \lk ->
Stack.Build.build setLocalFiles lk opts
-- Read the build command from the CLI and enable it to run
go' = case boptsCLICommand opts of
Test -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidTestsL) (Just True) go
Haddock -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidHaddockL) (Just True) go
Bench -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidBenchmarksL) (Just True) go
Install -> set (globalOptsBuildOptsMonoidL.buildOptsMonoidInstallExesL) (Just True) go
Build -> go -- Default case is just Build | 1,265 | true | true | 0 | 17 | 287 | 317 | 153 | 164 | null | null |
jmn/goodreads | src/Settings.hs | bsd-3-clause | oAuthToken :: Setting String
oAuthToken = Setting "oAuthSecret" "" | 66 | oAuthToken :: Setting String
oAuthToken = Setting "oAuthSecret" "" | 66 | oAuthToken = Setting "oAuthSecret" "" | 37 | false | true | 0 | 6 | 8 | 26 | 10 | 16 | null | null |
mydaum/cabal | Cabal/tests/UnitTests/Distribution/Version.hs | bsd-3-clause | prop_parse_disp5 :: VersionRange -> Property
prop_parse_disp5 vr =
let a = Just vr
b = simpleParse (displayRaw vr)
in
counterexample ("Expected: " ++ show a) $
counterexample ("But got: " ++ show b) $
b == a | 226 | prop_parse_disp5 :: VersionRange -> Property
prop_parse_disp5 vr =
let a = Just vr
b = simpleParse (displayRaw vr)
in
counterexample ("Expected: " ++ show a) $
counterexample ("But got: " ++ show b) $
b == a | 226 | prop_parse_disp5 vr =
let a = Just vr
b = simpleParse (displayRaw vr)
in
counterexample ("Expected: " ++ show a) $
counterexample ("But got: " ++ show b) $
b == a | 181 | false | true | 0 | 13 | 55 | 84 | 40 | 44 | null | null |
sampou-org/pfad | Code/Code16.hs | bsd-3-clause | vks = [(f k,k)|k <- [1..9]] | 27 | vks = [(f k,k)|k <- [1..9]] | 27 | vks = [(f k,k)|k <- [1..9]] | 27 | false | false | 1 | 9 | 5 | 35 | 17 | 18 | null | null |
mettekou/ghc | compiler/coreSyn/CoreArity.hs | bsd-3-clause | floatIn False (ATop as) = ATop (takeWhile isOneShotInfo as) | 59 | floatIn False (ATop as) = ATop (takeWhile isOneShotInfo as) | 59 | floatIn False (ATop as) = ATop (takeWhile isOneShotInfo as) | 59 | false | false | 0 | 7 | 8 | 28 | 13 | 15 | null | null |
rahulmutt/ghcvm | compiler/Eta/HsSyn/HsDoc.hs | bsd-3-clause | ppr_mbDoc :: Maybe LHsDocString -> SDoc
ppr_mbDoc (Just doc) = ppr doc | 70 | ppr_mbDoc :: Maybe LHsDocString -> SDoc
ppr_mbDoc (Just doc) = ppr doc | 70 | ppr_mbDoc (Just doc) = ppr doc | 30 | false | true | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
sdiehl/ghc | ghc/Main.hs | bsd-3-clause | isStopLnMode _ = False | 22 | isStopLnMode _ = False | 22 | isStopLnMode _ = False | 22 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
kaoskorobase/mescaline | lib/mescaline/Mescaline/FeatureSpace/Model.hs | gpl-3.0 | fromList :: [Unit.Unit] -> FeatureSpace
fromList = setUnits (FeatureSpace KDTree.empty (fmap (flip (,) []) (mkDefaultRegions n)))
where n = defaultNumRegions | 161 | fromList :: [Unit.Unit] -> FeatureSpace
fromList = setUnits (FeatureSpace KDTree.empty (fmap (flip (,) []) (mkDefaultRegions n)))
where n = defaultNumRegions | 161 | fromList = setUnits (FeatureSpace KDTree.empty (fmap (flip (,) []) (mkDefaultRegions n)))
where n = defaultNumRegions | 121 | false | true | 1 | 11 | 23 | 78 | 36 | 42 | null | null |
frantisekfarka/ghc-dsi | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitPrimOp _ res ReadOffAddrOp_Word64 args = doIndexOffAddrOp Nothing b64 res args | 99 | emitPrimOp _ res ReadOffAddrOp_Word64 args = doIndexOffAddrOp Nothing b64 res args | 99 | emitPrimOp _ res ReadOffAddrOp_Word64 args = doIndexOffAddrOp Nothing b64 res args | 99 | false | false | 1 | 5 | 27 | 28 | 11 | 17 | null | null |
hce/avwx | src/Data/Aviation/WX.hs | mit | runwayconditionParser :: (Monad f, CharParsing f) => f RunwayCondition
runwayconditionParser = do
runway' <- runwayDesignationParser
_ <- char '/'
choice
[ "SNOCLO" `means` ADClosed
, rwycond runway' ]
where
rwycond runway' = do
cover' <- RCTUnknown `option` ((toEnum . read . (:[])) <$> digit)
spread <- choice
[ char '/' >> return Nothing
, (Just . read . (:[])) <$> digit ]
spreadheight <- choice
[ text "//" >> return Nothing
, Just <$> tuhDigits ]
rkorbw <- tuhDigits
let coff = if rkorbw <= 90
then BrakingFriction rkorbw
else BrakingEffect rkorbw
return $ SpecificRunwayCondition runway' cover' spread spreadheight coff | 844 | runwayconditionParser :: (Monad f, CharParsing f) => f RunwayCondition
runwayconditionParser = do
runway' <- runwayDesignationParser
_ <- char '/'
choice
[ "SNOCLO" `means` ADClosed
, rwycond runway' ]
where
rwycond runway' = do
cover' <- RCTUnknown `option` ((toEnum . read . (:[])) <$> digit)
spread <- choice
[ char '/' >> return Nothing
, (Just . read . (:[])) <$> digit ]
spreadheight <- choice
[ text "//" >> return Nothing
, Just <$> tuhDigits ]
rkorbw <- tuhDigits
let coff = if rkorbw <= 90
then BrakingFriction rkorbw
else BrakingEffect rkorbw
return $ SpecificRunwayCondition runway' cover' spread spreadheight coff | 844 | runwayconditionParser = do
runway' <- runwayDesignationParser
_ <- char '/'
choice
[ "SNOCLO" `means` ADClosed
, rwycond runway' ]
where
rwycond runway' = do
cover' <- RCTUnknown `option` ((toEnum . read . (:[])) <$> digit)
spread <- choice
[ char '/' >> return Nothing
, (Just . read . (:[])) <$> digit ]
spreadheight <- choice
[ text "//" >> return Nothing
, Just <$> tuhDigits ]
rkorbw <- tuhDigits
let coff = if rkorbw <= 90
then BrakingFriction rkorbw
else BrakingEffect rkorbw
return $ SpecificRunwayCondition runway' cover' spread spreadheight coff | 772 | false | true | 0 | 14 | 317 | 243 | 121 | 122 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 13167 = 5940 | 32 | getValueFromProduct 13167 = 5940 | 32 | getValueFromProduct 13167 = 5940 | 32 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ganeti-github-testing/ganeti-test-1 | src/Ganeti/Constants.hs | bsd-2-clause | hvMigrationFailedStatuses :: FrozenSet String
hvMigrationFailedStatuses =
ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled] | 137 | hvMigrationFailedStatuses :: FrozenSet String
hvMigrationFailedStatuses =
ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled] | 137 | hvMigrationFailedStatuses =
ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled] | 91 | false | true | 0 | 6 | 10 | 25 | 13 | 12 | null | null |
allanderek/ipclib | Language/Pepa/QualifiedName.hs | gpl-2.0 | suffixQName (Unqualified ident) suffix = Unqualified (ident ++ suffix) | 73 | suffixQName (Unqualified ident) suffix = Unqualified (ident ++ suffix) | 73 | suffixQName (Unqualified ident) suffix = Unqualified (ident ++ suffix) | 73 | false | false | 0 | 7 | 11 | 27 | 13 | 14 | null | null |
prasmussen/magmod | Magento/Setup.hs | mit | writeUpgradePhpIfMissing :: ModuleInfo -> FilePath -> IO ()
writeUpgradePhpIfMissing info path = do
exists <- doesFileExist path
when (not exists) $ writeUpgradePhp info path | 182 | writeUpgradePhpIfMissing :: ModuleInfo -> FilePath -> IO ()
writeUpgradePhpIfMissing info path = do
exists <- doesFileExist path
when (not exists) $ writeUpgradePhp info path | 182 | writeUpgradePhpIfMissing info path = do
exists <- doesFileExist path
when (not exists) $ writeUpgradePhp info path | 122 | false | true | 0 | 10 | 31 | 60 | 27 | 33 | null | null |
siddhanathan/ghc | compiler/cmm/MkGraph.hs | bsd-3-clause | -- | creates an open AGraph from a given node
mkMiddle :: CmmNode O O -> CmmAGraph
mkMiddle middle = unitOL (CgStmt middle) | 130 | mkMiddle :: CmmNode O O -> CmmAGraph
mkMiddle middle = unitOL (CgStmt middle) | 84 | mkMiddle middle = unitOL (CgStmt middle) | 40 | true | true | 0 | 7 | 29 | 33 | 16 | 17 | null | null |
Vetii/Fractal | RealFunctions.hs | mit | gamma :: (Floating a) => a -> a
gamma z = z ** (1/2.2) | 54 | gamma :: (Floating a) => a -> a
gamma z = z ** (1/2.2) | 54 | gamma z = z ** (1/2.2) | 22 | false | true | 0 | 7 | 13 | 38 | 20 | 18 | null | null |
mariefarrell/Hets | Comorphisms/ExtModal2HasCASL.hs | gpl-2.0 | -- | mixfix names work for tuples and are lost after currying
trI :: Id -> Id
trI i = if isMixfix i then Id [genToken "C"] [i] $ rangeOfId i else i | 147 | trI :: Id -> Id
trI i = if isMixfix i then Id [genToken "C"] [i] $ rangeOfId i else i | 85 | trI i = if isMixfix i then Id [genToken "C"] [i] $ rangeOfId i else i | 69 | true | true | 0 | 9 | 32 | 55 | 27 | 28 | null | null |
corajr/servant-state-graph | test/Servant/StateGraph/Graph/RichEndpointSpec.hs | bsd-3-clause | eQueryParams' :: RichEndpoint
eQueryParams' = eGet' { _apiLink = ApiLink [] ["sort_asc"] } | 90 | eQueryParams' :: RichEndpoint
eQueryParams' = eGet' { _apiLink = ApiLink [] ["sort_asc"] } | 90 | eQueryParams' = eGet' { _apiLink = ApiLink [] ["sort_asc"] } | 60 | false | true | 0 | 8 | 12 | 29 | 16 | 13 | null | null |
ewestern/geos | src/Data/Geometry/Geos/Raw/Base.hs | mit | throwIfZero :: (Eq a, Num a, MonadError e m) => (a -> e) -> m a -> m a
throwIfZero = throwIf (0 ==) | 99 | throwIfZero :: (Eq a, Num a, MonadError e m) => (a -> e) -> m a -> m a
throwIfZero = throwIf (0 ==) | 99 | throwIfZero = throwIf (0 ==) | 28 | false | true | 0 | 8 | 23 | 62 | 32 | 30 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 10891199 = 3400 | 35 | getValueFromProduct 10891199 = 3400 | 35 | getValueFromProduct 10891199 = 3400 | 35 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
creichert/linear-hs | test/Test/Vector.hs | bsd-2-clause | test_parallel3 = "parallel 3" ~: False ~=? parallel v w
where v = mkVector [1,15,11]
w = mkVector [3,3.22,8] | 122 | test_parallel3 = "parallel 3" ~: False ~=? parallel v w
where v = mkVector [1,15,11]
w = mkVector [3,3.22,8] | 122 | test_parallel3 = "parallel 3" ~: False ~=? parallel v w
where v = mkVector [1,15,11]
w = mkVector [3,3.22,8] | 122 | false | false | 1 | 6 | 32 | 56 | 30 | 26 | null | null |
brendanhay/gogol | gogol-gmail/gen/Network/Google/Gmail/Types/Product.hs | mpl-2.0 | -- | The total number of threads in the mailbox.
pfThreadsTotal :: Lens' ProFile (Maybe Int32)
pfThreadsTotal
= lens _pfThreadsTotal
(\ s a -> s{_pfThreadsTotal = a})
. mapping _Coerce | 198 | pfThreadsTotal :: Lens' ProFile (Maybe Int32)
pfThreadsTotal
= lens _pfThreadsTotal
(\ s a -> s{_pfThreadsTotal = a})
. mapping _Coerce | 149 | pfThreadsTotal
= lens _pfThreadsTotal
(\ s a -> s{_pfThreadsTotal = a})
. mapping _Coerce | 103 | true | true | 3 | 8 | 43 | 63 | 28 | 35 | null | null |
jetaggart/te | src/Te.hs | gpl-3.0 | synchronous :: TestRunner -> Sh ()
synchronous = runTest | 56 | synchronous :: TestRunner -> Sh ()
synchronous = runTest | 56 | synchronous = runTest | 21 | false | true | 0 | 7 | 8 | 20 | 10 | 10 | null | null |
sulami/glow | lib/Game/Glow/World.hs | bsd-3-clause | -- | Move all sprites according to its speed times the time in seconds passed
-- since the last frame rendered. This only makes sense with
-- non-player-controlled sprites, like the ball and enemies. This also resets
-- the platform speeds, which is a hacky way to reset them properly when they
-- are not moving currently.
moveSprites :: Float -> World -> World
moveSprites delta w0 = w0 & over (sprites.mapped) (moveSprite delta)
& set (horPlatforms.traverse.speed._1) 0
& set (verPlatforms.traverse.speed._2) 0
& over ball (moveSprite delta)
where
moveSprite :: Float -> Sprite -> Sprite
moveSprite delta s0 = let (x,y) = view pos s0
(dx,dy) = view speed s0
in s0 & set pos (x + dx * delta, y + dy * delta)
-- | Move the platforms according to the (x,y) coordinate tuple supplied, and
-- set the speeds so they can be used for collision detection/ball deflection. | 1,011 | moveSprites :: Float -> World -> World
moveSprites delta w0 = w0 & over (sprites.mapped) (moveSprite delta)
& set (horPlatforms.traverse.speed._1) 0
& set (verPlatforms.traverse.speed._2) 0
& over ball (moveSprite delta)
where
moveSprite :: Float -> Sprite -> Sprite
moveSprite delta s0 = let (x,y) = view pos s0
(dx,dy) = view speed s0
in s0 & set pos (x + dx * delta, y + dy * delta)
-- | Move the platforms according to the (x,y) coordinate tuple supplied, and
-- set the speeds so they can be used for collision detection/ball deflection. | 687 | moveSprites delta w0 = w0 & over (sprites.mapped) (moveSprite delta)
& set (horPlatforms.traverse.speed._1) 0
& set (verPlatforms.traverse.speed._2) 0
& over ball (moveSprite delta)
where
moveSprite :: Float -> Sprite -> Sprite
moveSprite delta s0 = let (x,y) = view pos s0
(dx,dy) = view speed s0
in s0 & set pos (x + dx * delta, y + dy * delta)
-- | Move the platforms according to the (x,y) coordinate tuple supplied, and
-- set the speeds so they can be used for collision detection/ball deflection. | 648 | true | true | 8 | 11 | 295 | 213 | 105 | 108 | null | null |
onponomarev/ganeti | src/Ganeti/Types.hs | bsd-2-clause | addParamsToStorageUnit _ (SURaw StorageRados key) = SURados key | 63 | addParamsToStorageUnit _ (SURaw StorageRados key) = SURados key | 63 | addParamsToStorageUnit _ (SURaw StorageRados key) = SURados key | 63 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
urbanslug/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | isRhoTy :: TcType -> Bool -- True of TcRhoTypes; see Note [TcRhoType]
isRhoTy ty | Just ty' <- tcView ty = isRhoTy ty' | 120 | isRhoTy :: TcType -> Bool
isRhoTy ty | Just ty' <- tcView ty = isRhoTy ty' | 74 | isRhoTy ty | Just ty' <- tcView ty = isRhoTy ty' | 48 | true | true | 0 | 9 | 24 | 43 | 18 | 25 | null | null |
rahulmutt/ghcvm | compiler/Eta/HsSyn/HsExpr.hs | bsd-3-clause | pprTransformStmt :: OutputableBndr id => [id] -> LHsExpr id -> Maybe (LHsExpr id) -> SDoc
pprTransformStmt bndrs using by
= sep [ ptext (sLit "then") <+> ifPprDebug (braces (ppr bndrs))
, nest 2 (ppr using)
, nest 2 (pprBy by)] | 245 | pprTransformStmt :: OutputableBndr id => [id] -> LHsExpr id -> Maybe (LHsExpr id) -> SDoc
pprTransformStmt bndrs using by
= sep [ ptext (sLit "then") <+> ifPprDebug (braces (ppr bndrs))
, nest 2 (ppr using)
, nest 2 (pprBy by)] | 245 | pprTransformStmt bndrs using by
= sep [ ptext (sLit "then") <+> ifPprDebug (braces (ppr bndrs))
, nest 2 (ppr using)
, nest 2 (pprBy by)] | 155 | false | true | 0 | 11 | 57 | 114 | 55 | 59 | null | null |
mettekou/ghc | compiler/types/Type.hs | bsd-3-clause | typeSize (CastTy ty co) = typeSize ty + coercionSize co | 67 | typeSize (CastTy ty co) = typeSize ty + coercionSize co | 67 | typeSize (CastTy ty co) = typeSize ty + coercionSize co | 67 | false | false | 0 | 7 | 21 | 27 | 12 | 15 | null | null |
ditto/ditto | src/Ditto/Monad.hs | gpl-3.0 | initialR :: DittoR
initialR = DittoR
{ ctx = []
, acts = []
} | 67 | initialR :: DittoR
initialR = DittoR
{ ctx = []
, acts = []
} | 67 | initialR = DittoR
{ ctx = []
, acts = []
} | 48 | false | true | 0 | 8 | 20 | 39 | 19 | 20 | null | null |
ewestern/geos | src/Data/Geometry/Geos/Raw/Topology.hs | mit | unaryUnion :: R.Geometry a => a -> Geos a
unaryUnion = geo_1 I.geos_UnaryUnion "unaryUnion" | 91 | unaryUnion :: R.Geometry a => a -> Geos a
unaryUnion = geo_1 I.geos_UnaryUnion "unaryUnion" | 91 | unaryUnion = geo_1 I.geos_UnaryUnion "unaryUnion" | 49 | false | true | 0 | 8 | 13 | 40 | 17 | 23 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_SOURCE2_RGB_ARB :: GLenum
gl_SOURCE2_RGB_ARB = 0x8582 | 56 | gl_SOURCE2_RGB_ARB :: GLenum
gl_SOURCE2_RGB_ARB = 0x8582 | 56 | gl_SOURCE2_RGB_ARB = 0x8582 | 27 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ajnsit/wai-routes | examples/rest-json/src/Main.hs | mit | postPeopleR :: Handler PeopleRoute
postPeopleR = runHandlerM $ do
p <- jsonBody
case p of
Left s -> do
status status400
json $ Err s
Right p' -> do
i <- runCrudAction $ newPerson p'
json $ PersonId i
-- Get a person's data | 259 | postPeopleR :: Handler PeopleRoute
postPeopleR = runHandlerM $ do
p <- jsonBody
case p of
Left s -> do
status status400
json $ Err s
Right p' -> do
i <- runCrudAction $ newPerson p'
json $ PersonId i
-- Get a person's data | 259 | postPeopleR = runHandlerM $ do
p <- jsonBody
case p of
Left s -> do
status status400
json $ Err s
Right p' -> do
i <- runCrudAction $ newPerson p'
json $ PersonId i
-- Get a person's data | 224 | false | true | 0 | 15 | 80 | 91 | 40 | 51 | null | null |
NorfairKing/the-notes | src/Cryptography/ComputationalProblems/Games/BitGuessingProblems/Macro.hs | gpl-2.0 | gadv :: Note -> Note -> Note
gadv p = fn $ gadvf p | 50 | gadv :: Note -> Note -> Note
gadv p = fn $ gadvf p | 50 | gadv p = fn $ gadvf p | 21 | false | true | 2 | 8 | 13 | 36 | 15 | 21 | null | null |
dimara/ganeti | src/Ganeti/OpParams.hs | bsd-2-clause | pStartInstance :: Field
pStartInstance =
withDoc "Whether to start instance after creation" $
defaultTrue "start" | 117 | pStartInstance :: Field
pStartInstance =
withDoc "Whether to start instance after creation" $
defaultTrue "start" | 117 | pStartInstance =
withDoc "Whether to start instance after creation" $
defaultTrue "start" | 93 | false | true | 0 | 6 | 18 | 21 | 10 | 11 | null | null |
pbogdan/kube-cert | src/Lib/IP.hs | bsd-3-clause | fetchAzureIp :: (MonadIO m) => m IPv4
fetchAzureIp = error "not implemented" | 76 | fetchAzureIp :: (MonadIO m) => m IPv4
fetchAzureIp = error "not implemented" | 76 | fetchAzureIp = error "not implemented" | 38 | false | true | 0 | 7 | 11 | 32 | 14 | 18 | null | null |
BartAdv/Idris-dev | src/Idris/Primitives.hs | bsd-3-clause | toInt :: Integral a => IntTy -> a -> Const
toInt (ITFixed IT8) x = B8 (fromIntegral x) | 91 | toInt :: Integral a => IntTy -> a -> Const
toInt (ITFixed IT8) x = B8 (fromIntegral x) | 91 | toInt (ITFixed IT8) x = B8 (fromIntegral x) | 48 | false | true | 0 | 11 | 22 | 52 | 23 | 29 | null | null |
brendanhay/gogol | gogol-cloudfunctions/gen/Network/Google/Resource/CloudFunctions/Projects/Locations/Functions/GenerateUploadURL.hs | mpl-2.0 | -- | V1 error format.
plfguuXgafv :: Lens' ProjectsLocationsFunctionsGenerateUploadURL (Maybe Xgafv)
plfguuXgafv
= lens _plfguuXgafv (\ s a -> s{_plfguuXgafv = a}) | 165 | plfguuXgafv :: Lens' ProjectsLocationsFunctionsGenerateUploadURL (Maybe Xgafv)
plfguuXgafv
= lens _plfguuXgafv (\ s a -> s{_plfguuXgafv = a}) | 143 | plfguuXgafv
= lens _plfguuXgafv (\ s a -> s{_plfguuXgafv = a}) | 64 | true | true | 0 | 9 | 23 | 48 | 25 | 23 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/DynamoDBTable.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-ssespecification
ddbtSSESpecification :: Lens' DynamoDBTable (Maybe DynamoDBTableSSESpecification)
ddbtSSESpecification = lens _dynamoDBTableSSESpecification (\s a -> s { _dynamoDBTableSSESpecification = a }) | 327 | ddbtSSESpecification :: Lens' DynamoDBTable (Maybe DynamoDBTableSSESpecification)
ddbtSSESpecification = lens _dynamoDBTableSSESpecification (\s a -> s { _dynamoDBTableSSESpecification = a }) | 191 | ddbtSSESpecification = lens _dynamoDBTableSSESpecification (\s a -> s { _dynamoDBTableSSESpecification = a }) | 109 | true | true | 1 | 9 | 21 | 50 | 25 | 25 | null | null |
dcreager/cabal | Distribution/Simple/PreProcess.hs | bsd-3-clause | ppAlex :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppAlex _ lbi = pp { platformIndependent = True }
where pp = standardPP lbi alexProgram (hcFlags hc)
hc = compilerFlavor (compiler lbi)
hcFlags GHC = ["-g"]
hcFlags _ = [] | 250 | ppAlex :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppAlex _ lbi = pp { platformIndependent = True }
where pp = standardPP lbi alexProgram (hcFlags hc)
hc = compilerFlavor (compiler lbi)
hcFlags GHC = ["-g"]
hcFlags _ = [] | 250 | ppAlex _ lbi = pp { platformIndependent = True }
where pp = standardPP lbi alexProgram (hcFlags hc)
hc = compilerFlavor (compiler lbi)
hcFlags GHC = ["-g"]
hcFlags _ = [] | 196 | false | true | 3 | 8 | 63 | 107 | 47 | 60 | null | null |
marcelosousa/poet | src/Test/Examples/ExFour.hs | gpl-2.0 | sys4 :: System Sigma
sys4 = System (V.fromList [t11_4,t12_4,t21_4,t22_4]) s4 [Other] | 84 | sys4 :: System Sigma
sys4 = System (V.fromList [t11_4,t12_4,t21_4,t22_4]) s4 [Other] | 84 | sys4 = System (V.fromList [t11_4,t12_4,t21_4,t22_4]) s4 [Other] | 63 | false | true | 1 | 8 | 10 | 47 | 24 | 23 | null | null |
phischu/fragnix | builtins/base/GHC.List.hs | bsd-3-clause | filter :: (a -> Bool) -> [a] -> [a]
filter _pred [] = [] | 59 | filter :: (a -> Bool) -> [a] -> [a]
filter _pred [] = [] | 59 | filter _pred [] = [] | 23 | false | true | 0 | 7 | 16 | 41 | 22 | 19 | null | null |
nevvi/Declarative-D7012E | lab2/Parser.hs | gpl-3.0 | cons(a, b) = a:b | 16 | cons(a, b) = a:b | 16 | cons(a, b) = a:b | 16 | false | false | 0 | 6 | 3 | 19 | 10 | 9 | null | null |
eneas193933/regex-derivatives | test/ParseSpec.hs | bsd-2-clause | spec :: Spec
spec =
describe "Parse.parseRegex" $ do
it "parses \".\" as Dot" $
parseRegex "." `shouldBe` Right Dot
it "parses \"a\" as (Sym a) if a is not a reserved symbol" $
forAll validChar $ \x -> parseRegex [x] `shouldBe` Right (Sym x)
it "parses \"\\a\" as (Sym a) if a is a reserved symbol" $
forAll invalidChar $ \x -> parseRegex ['\\', x] `shouldBe` Right (Sym x)
it "parses \"a|b|c\" as (Or (Sym a) (Or (Sym b) (Sym c)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
forAll validChar $ \z -> parseRegex ['(', x, '|', y, '|', z, ')'] `shouldBe` Right (Or (Or (Sym x) (Sym y)) (Sym z))
it "parses \"[abc]\" as (Or (Or (Sym a) (Sym b)) (Sym c))" $
forAll (vectorOf 3 validChar) $ \xs -> parseRegex ('[' : xs ++ "]") `shouldBe` Right (Or (Or (Sym $ head xs) (Sym $ xs !! 1)) (Sym $ xs !! 2))
it "parses \"abc\" as (Seq (Seq (Sym a) (Sym b)) (Sym c))" $
forAll (vectorOf 3 validChar) $ \xs -> parseRegex xs `shouldBe` Right (Seq (Seq (Sym $ head xs) (Sym $ xs !! 1)) (Sym $ xs !! 2))
it "parses \"a*\" as (Kleene (Sym a))" $
forAll validChar $ \x -> parseRegex [x, '*'] `shouldBe` Right (Kleene (Sym x))
it "parses \"a?\" as (Or Empty (Sym a))" $
forAll validChar $ \x -> parseRegex [x, '?'] `shouldBe` Right (Or Empty (Sym x))
it "parses \"ab*\" as (Seq (Sym a) (Kleene (Sym a)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
let ast = Seq (Sym x) (Kleene (Sym y))
in parseRegex [x, y, '*'] `shouldBe` Right ast
it "parses \"[ab]*\" as (Kleene (Or (Sym a) (Sym b)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
let ast = Kleene (Or (Sym x) (Sym y))
in parseRegex ['[', x, y, ']', '*'] `shouldBe` Right ast
it "parses \"([ab]c|.d)*\" as (Kleene (Or (Seq (Or (Sym a) (Sym b)) (Sym y)) (Seq Dot (Sym d)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
forAll validChar $ \w ->
forAll validChar $ \z ->
let ast = Kleene (Or (Seq (Or (Sym x) (Sym y)) (Sym w)) (Seq Dot (Sym z)))
in parseRegex ['(', '[', x, y, ']', w, '|', '.', z, ')', '*'] `shouldBe` Right ast | 2,203 | spec :: Spec
spec =
describe "Parse.parseRegex" $ do
it "parses \".\" as Dot" $
parseRegex "." `shouldBe` Right Dot
it "parses \"a\" as (Sym a) if a is not a reserved symbol" $
forAll validChar $ \x -> parseRegex [x] `shouldBe` Right (Sym x)
it "parses \"\\a\" as (Sym a) if a is a reserved symbol" $
forAll invalidChar $ \x -> parseRegex ['\\', x] `shouldBe` Right (Sym x)
it "parses \"a|b|c\" as (Or (Sym a) (Or (Sym b) (Sym c)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
forAll validChar $ \z -> parseRegex ['(', x, '|', y, '|', z, ')'] `shouldBe` Right (Or (Or (Sym x) (Sym y)) (Sym z))
it "parses \"[abc]\" as (Or (Or (Sym a) (Sym b)) (Sym c))" $
forAll (vectorOf 3 validChar) $ \xs -> parseRegex ('[' : xs ++ "]") `shouldBe` Right (Or (Or (Sym $ head xs) (Sym $ xs !! 1)) (Sym $ xs !! 2))
it "parses \"abc\" as (Seq (Seq (Sym a) (Sym b)) (Sym c))" $
forAll (vectorOf 3 validChar) $ \xs -> parseRegex xs `shouldBe` Right (Seq (Seq (Sym $ head xs) (Sym $ xs !! 1)) (Sym $ xs !! 2))
it "parses \"a*\" as (Kleene (Sym a))" $
forAll validChar $ \x -> parseRegex [x, '*'] `shouldBe` Right (Kleene (Sym x))
it "parses \"a?\" as (Or Empty (Sym a))" $
forAll validChar $ \x -> parseRegex [x, '?'] `shouldBe` Right (Or Empty (Sym x))
it "parses \"ab*\" as (Seq (Sym a) (Kleene (Sym a)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
let ast = Seq (Sym x) (Kleene (Sym y))
in parseRegex [x, y, '*'] `shouldBe` Right ast
it "parses \"[ab]*\" as (Kleene (Or (Sym a) (Sym b)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
let ast = Kleene (Or (Sym x) (Sym y))
in parseRegex ['[', x, y, ']', '*'] `shouldBe` Right ast
it "parses \"([ab]c|.d)*\" as (Kleene (Or (Seq (Or (Sym a) (Sym b)) (Sym y)) (Seq Dot (Sym d)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
forAll validChar $ \w ->
forAll validChar $ \z ->
let ast = Kleene (Or (Seq (Or (Sym x) (Sym y)) (Sym w)) (Seq Dot (Sym z)))
in parseRegex ['(', '[', x, y, ']', w, '|', '.', z, ')', '*'] `shouldBe` Right ast | 2,203 | spec =
describe "Parse.parseRegex" $ do
it "parses \".\" as Dot" $
parseRegex "." `shouldBe` Right Dot
it "parses \"a\" as (Sym a) if a is not a reserved symbol" $
forAll validChar $ \x -> parseRegex [x] `shouldBe` Right (Sym x)
it "parses \"\\a\" as (Sym a) if a is a reserved symbol" $
forAll invalidChar $ \x -> parseRegex ['\\', x] `shouldBe` Right (Sym x)
it "parses \"a|b|c\" as (Or (Sym a) (Or (Sym b) (Sym c)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
forAll validChar $ \z -> parseRegex ['(', x, '|', y, '|', z, ')'] `shouldBe` Right (Or (Or (Sym x) (Sym y)) (Sym z))
it "parses \"[abc]\" as (Or (Or (Sym a) (Sym b)) (Sym c))" $
forAll (vectorOf 3 validChar) $ \xs -> parseRegex ('[' : xs ++ "]") `shouldBe` Right (Or (Or (Sym $ head xs) (Sym $ xs !! 1)) (Sym $ xs !! 2))
it "parses \"abc\" as (Seq (Seq (Sym a) (Sym b)) (Sym c))" $
forAll (vectorOf 3 validChar) $ \xs -> parseRegex xs `shouldBe` Right (Seq (Seq (Sym $ head xs) (Sym $ xs !! 1)) (Sym $ xs !! 2))
it "parses \"a*\" as (Kleene (Sym a))" $
forAll validChar $ \x -> parseRegex [x, '*'] `shouldBe` Right (Kleene (Sym x))
it "parses \"a?\" as (Or Empty (Sym a))" $
forAll validChar $ \x -> parseRegex [x, '?'] `shouldBe` Right (Or Empty (Sym x))
it "parses \"ab*\" as (Seq (Sym a) (Kleene (Sym a)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
let ast = Seq (Sym x) (Kleene (Sym y))
in parseRegex [x, y, '*'] `shouldBe` Right ast
it "parses \"[ab]*\" as (Kleene (Or (Sym a) (Sym b)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
let ast = Kleene (Or (Sym x) (Sym y))
in parseRegex ['[', x, y, ']', '*'] `shouldBe` Right ast
it "parses \"([ab]c|.d)*\" as (Kleene (Or (Seq (Or (Sym a) (Sym b)) (Sym y)) (Seq Dot (Sym d)))" $
forAll validChar $ \x ->
forAll validChar $ \y ->
forAll validChar $ \w ->
forAll validChar $ \z ->
let ast = Kleene (Or (Seq (Or (Sym x) (Sym y)) (Sym w)) (Seq Dot (Sym z)))
in parseRegex ['(', '[', x, y, ']', w, '|', '.', z, ')', '*'] `shouldBe` Right ast | 2,190 | false | true | 0 | 28 | 605 | 896 | 453 | 443 | null | null |
bravit/Idris-dev | src/Idris/Primitives.hs | bsd-3-clause | bsdiv (ITFixed IT64) [B64 x, B64 y]
= Just $ B64 (fromIntegral (fromIntegral x `div` fromIntegral y :: Int64)) | 114 | bsdiv (ITFixed IT64) [B64 x, B64 y]
= Just $ B64 (fromIntegral (fromIntegral x `div` fromIntegral y :: Int64)) | 114 | bsdiv (ITFixed IT64) [B64 x, B64 y]
= Just $ B64 (fromIntegral (fromIntegral x `div` fromIntegral y :: Int64)) | 114 | false | false | 0 | 11 | 22 | 60 | 30 | 30 | null | null |
brinchj/btree-concurrent | Data/BTree/BTree.hs | lgpl-3.0 | -- | Get next unique node reference id
newRef p = do
ls <- Cstm.liftSTM $ readTVar $ unused p
case ls of
(r:rs) -> do Cstm.liftSTM $ writeTVar (unused p) rs
return r
_ -> Cstm.fail newNode
where
newNode = do
refids <- map Ref `fmap` replicateM 8 randomIO
-- Collisions are rare, but not impossible
forM_ refids $ \ref -> C.eval (state p) $ do
n <- C.fetch ref
case n of
Nothing -> do Cstm.liftSTM $ do ls <- readTVar $ unused p
writeTVar (unused p) $ ref : ls
Just _ -> return ()
-- | Queue marked node for rebalancing | 657 | newRef p = do
ls <- Cstm.liftSTM $ readTVar $ unused p
case ls of
(r:rs) -> do Cstm.liftSTM $ writeTVar (unused p) rs
return r
_ -> Cstm.fail newNode
where
newNode = do
refids <- map Ref `fmap` replicateM 8 randomIO
-- Collisions are rare, but not impossible
forM_ refids $ \ref -> C.eval (state p) $ do
n <- C.fetch ref
case n of
Nothing -> do Cstm.liftSTM $ do ls <- readTVar $ unused p
writeTVar (unused p) $ ref : ls
Just _ -> return ()
-- | Queue marked node for rebalancing | 618 | newRef p = do
ls <- Cstm.liftSTM $ readTVar $ unused p
case ls of
(r:rs) -> do Cstm.liftSTM $ writeTVar (unused p) rs
return r
_ -> Cstm.fail newNode
where
newNode = do
refids <- map Ref `fmap` replicateM 8 randomIO
-- Collisions are rare, but not impossible
forM_ refids $ \ref -> C.eval (state p) $ do
n <- C.fetch ref
case n of
Nothing -> do Cstm.liftSTM $ do ls <- readTVar $ unused p
writeTVar (unused p) $ ref : ls
Just _ -> return ()
-- | Queue marked node for rebalancing | 618 | true | false | 2 | 25 | 243 | 237 | 106 | 131 | null | null |
mainland/dph | dph-lifted-copy/Data/Array/Parallel/Lifted/Unboxed.hs | bsd-3-clause | lengthPA_Double# :: PArray_Double# -> Int#
lengthPA_Double# arr = case U.length arr of { I# n# -> n# } | 102 | lengthPA_Double# :: PArray_Double# -> Int#
lengthPA_Double# arr = case U.length arr of { I# n# -> n# } | 102 | lengthPA_Double# arr = case U.length arr of { I# n# -> n# } | 59 | false | true | 0 | 8 | 17 | 38 | 19 | 19 | null | null |
dvvc/gapaint | GAPaint.hs | gpl-3.0 | -- Probability of performing crossover between two candidates
pMutation = 0.1 | 77 | pMutation = 0.1 | 15 | pMutation = 0.1 | 15 | true | false | 1 | 5 | 10 | 11 | 4 | 7 | null | null |
input-output-hk/pos-haskell-prototype | tools/src/topology-gen/Main.hs | mit | main :: IO ()
main = (flip evalStateT) 0 $ do
let (the'graph, the'nodes) = layoutA
outputDot "primary"
$ render (secondaryToInactive the'graph) "all primary routes"
outputDot "complete" $ render the'graph "all routes"
outputYaml "complete" $ renderAsConfig the'graph
mapM_ (withDead the'graph) $ [[a] | a <- the'nodes]
mapM_ (withDead the'graph)
$ (nub . sort) [sort [a,b] | a <- the'nodes, b <- the'nodes, a /= b]
mapM_ (withDead the'graph)
$ (nub . sort) [sort [a,b,c]
| a <- the'nodes
, b <- the'nodes
, c <- the'nodes
, a /= b, a /= c, b /=c ]
where
outputYaml :: MonadIO m => FilePath -> String -> m ()
outputYaml fp = liftIO . writeFile ("config" <.> fp <.> "yaml")
outputDot :: FilePath -> T.Text -> StateT Int IO ()
outputDot fp dot = do
ix <- inc
liftIO $ T.writeFile ("test" <.> digits 3 ix <.> fp <.> "dot") dot
inc = get >>= \n -> put (n+1) >> return n
digits n = reverse . take n . (++ repeat '0') . reverse . show
withDead :: Gr NodeA EdgeA -> [LNode NodeA] -> StateT Int IO ()
withDead g ns
= let g' = markNodesDead (map fst ns) g
t' = T.intercalate "," [T.pack a | (_,(a,_)) <- ns]
f' = T.unpack . T.map h $ t'
h '/' = '-'
h ',' = '.'
h x = x
msg = case checkConnected g' of
[] -> Nothing
x -> Just x
in
do case msg of
Nothing -> return ()
Just m -> liftIO . putStrLn $ (T.unpack t') ++ ": "
++ show m ++ " isolated."
outputDot f' . render g' $
("with " `mappend` t' `mappend` " dead") `mappend`
case msg of
Nothing -> T.empty
Just m -> " >>ISOLATED>> " `mappend` (T.pack $ show m) | 1,910 | main :: IO ()
main = (flip evalStateT) 0 $ do
let (the'graph, the'nodes) = layoutA
outputDot "primary"
$ render (secondaryToInactive the'graph) "all primary routes"
outputDot "complete" $ render the'graph "all routes"
outputYaml "complete" $ renderAsConfig the'graph
mapM_ (withDead the'graph) $ [[a] | a <- the'nodes]
mapM_ (withDead the'graph)
$ (nub . sort) [sort [a,b] | a <- the'nodes, b <- the'nodes, a /= b]
mapM_ (withDead the'graph)
$ (nub . sort) [sort [a,b,c]
| a <- the'nodes
, b <- the'nodes
, c <- the'nodes
, a /= b, a /= c, b /=c ]
where
outputYaml :: MonadIO m => FilePath -> String -> m ()
outputYaml fp = liftIO . writeFile ("config" <.> fp <.> "yaml")
outputDot :: FilePath -> T.Text -> StateT Int IO ()
outputDot fp dot = do
ix <- inc
liftIO $ T.writeFile ("test" <.> digits 3 ix <.> fp <.> "dot") dot
inc = get >>= \n -> put (n+1) >> return n
digits n = reverse . take n . (++ repeat '0') . reverse . show
withDead :: Gr NodeA EdgeA -> [LNode NodeA] -> StateT Int IO ()
withDead g ns
= let g' = markNodesDead (map fst ns) g
t' = T.intercalate "," [T.pack a | (_,(a,_)) <- ns]
f' = T.unpack . T.map h $ t'
h '/' = '-'
h ',' = '.'
h x = x
msg = case checkConnected g' of
[] -> Nothing
x -> Just x
in
do case msg of
Nothing -> return ()
Just m -> liftIO . putStrLn $ (T.unpack t') ++ ": "
++ show m ++ " isolated."
outputDot f' . render g' $
("with " `mappend` t' `mappend` " dead") `mappend`
case msg of
Nothing -> T.empty
Just m -> " >>ISOLATED>> " `mappend` (T.pack $ show m) | 1,910 | main = (flip evalStateT) 0 $ do
let (the'graph, the'nodes) = layoutA
outputDot "primary"
$ render (secondaryToInactive the'graph) "all primary routes"
outputDot "complete" $ render the'graph "all routes"
outputYaml "complete" $ renderAsConfig the'graph
mapM_ (withDead the'graph) $ [[a] | a <- the'nodes]
mapM_ (withDead the'graph)
$ (nub . sort) [sort [a,b] | a <- the'nodes, b <- the'nodes, a /= b]
mapM_ (withDead the'graph)
$ (nub . sort) [sort [a,b,c]
| a <- the'nodes
, b <- the'nodes
, c <- the'nodes
, a /= b, a /= c, b /=c ]
where
outputYaml :: MonadIO m => FilePath -> String -> m ()
outputYaml fp = liftIO . writeFile ("config" <.> fp <.> "yaml")
outputDot :: FilePath -> T.Text -> StateT Int IO ()
outputDot fp dot = do
ix <- inc
liftIO $ T.writeFile ("test" <.> digits 3 ix <.> fp <.> "dot") dot
inc = get >>= \n -> put (n+1) >> return n
digits n = reverse . take n . (++ repeat '0') . reverse . show
withDead :: Gr NodeA EdgeA -> [LNode NodeA] -> StateT Int IO ()
withDead g ns
= let g' = markNodesDead (map fst ns) g
t' = T.intercalate "," [T.pack a | (_,(a,_)) <- ns]
f' = T.unpack . T.map h $ t'
h '/' = '-'
h ',' = '.'
h x = x
msg = case checkConnected g' of
[] -> Nothing
x -> Just x
in
do case msg of
Nothing -> return ()
Just m -> liftIO . putStrLn $ (T.unpack t') ++ ": "
++ show m ++ " isolated."
outputDot f' . render g' $
("with " `mappend` t' `mappend` " dead") `mappend`
case msg of
Nothing -> T.empty
Just m -> " >>ISOLATED>> " `mappend` (T.pack $ show m) | 1,896 | false | true | 1 | 19 | 714 | 794 | 387 | 407 | null | null |
taylor1791/adventofcode | 2015/src/Day16.hs | bsd-2-clause | match :: MFCSAM -> MFCSAM -> Bool
match x y = foldl (&&) True $ map (\f -> possible f y x) $
[children, cats, samoyeds, pomeranians, akitas, vizslas, goldfish, trees, cars, perfumes] | 184 | match :: MFCSAM -> MFCSAM -> Bool
match x y = foldl (&&) True $ map (\f -> possible f y x) $
[children, cats, samoyeds, pomeranians, akitas, vizslas, goldfish, trees, cars, perfumes] | 184 | match x y = foldl (&&) True $ map (\f -> possible f y x) $
[children, cats, samoyeds, pomeranians, akitas, vizslas, goldfish, trees, cars, perfumes] | 150 | false | true | 2 | 9 | 34 | 95 | 50 | 45 | null | null |
mightymoose/liquidhaskell | benchmarks/llrbtree-0.1.1/Data/Set/WBTree.hs | bsd-3-clause | valid :: Ord a => WBTree a -> Bool
valid t = balanced t && ordered t && validsize t | 83 | valid :: Ord a => WBTree a -> Bool
valid t = balanced t && ordered t && validsize t | 83 | valid t = balanced t && ordered t && validsize t | 48 | false | true | 0 | 7 | 19 | 45 | 20 | 25 | null | null |
facebook/Haxl | tests/MonadBench.hs | bsd-3-clause | unionWombatsFromTo :: Id -> Id -> GenHaxl () SimpleWrite [Id]
unionWombatsFromTo x y = foldl List.union [] <$> Haxl.mapM listWombats [x..y] | 139 | unionWombatsFromTo :: Id -> Id -> GenHaxl () SimpleWrite [Id]
unionWombatsFromTo x y = foldl List.union [] <$> Haxl.mapM listWombats [x..y] | 139 | unionWombatsFromTo x y = foldl List.union [] <$> Haxl.mapM listWombats [x..y] | 77 | false | true | 0 | 8 | 20 | 61 | 30 | 31 | null | null |
adinapoli/threads-supervisor | examples/Main.hs | mit | job5 :: IO ()
job5 = threadDelay 100 >> error "dead" | 52 | job5 :: IO ()
job5 = threadDelay 100 >> error "dead" | 52 | job5 = threadDelay 100 >> error "dead" | 38 | false | true | 2 | 7 | 10 | 32 | 13 | 19 | null | null |
fmthoma/ghc | libraries/base/Data/Typeable/Internal.hs | bsd-3-clause | listTc :: TyCon
listTc = typeRepTyCon (typeOf [()]) | 51 | listTc :: TyCon
listTc = typeRepTyCon (typeOf [()]) | 51 | listTc = typeRepTyCon (typeOf [()]) | 35 | false | true | 0 | 9 | 7 | 25 | 13 | 12 | null | null |
fcostantini/PlEb | src/Report.hs | gpl-3.0 | bad :: RState ()
bad = do r <- get
let bc = badCount r
put $ r {badCount = bc + 1} | 100 | bad :: RState ()
bad = do r <- get
let bc = badCount r
put $ r {badCount = bc + 1} | 100 | bad = do r <- get
let bc = badCount r
put $ r {badCount = bc + 1} | 83 | false | true | 0 | 11 | 40 | 60 | 27 | 33 | null | null |
shlevy/ghc | includes/CodeGen.Platform.hs | bsd-3-clause | callerSaves (DoubleReg 6) = True | 36 | callerSaves (DoubleReg 6) = True | 36 | callerSaves (DoubleReg 6) = True | 36 | false | false | 0 | 7 | 8 | 15 | 7 | 8 | null | null |
NorfairKing/super-user-spark | test/TestUtils.hs | mit | forFileInDirss :: [Path Abs Dir] -> (Path Abs File -> SpecWith a) -> SpecWith a
forFileInDirss [] _ = return () | 111 | forFileInDirss :: [Path Abs Dir] -> (Path Abs File -> SpecWith a) -> SpecWith a
forFileInDirss [] _ = return () | 111 | forFileInDirss [] _ = return () | 31 | false | true | 0 | 9 | 20 | 57 | 27 | 30 | null | null |
limaner2002/EPC-tools | USACScripts/src/Scripts/Random.hs | bsd-3-clause | arbitraryInputUpdateF :: MonadGen m => ReifiedMonadicFold m Value (Either Text Update)
arbitraryInputUpdateF = MonadicFold (cosmos . filtered isEditable . to parseComponentType . traverse . act arbitraryInput . to (fmap toUpdate)) | 230 | arbitraryInputUpdateF :: MonadGen m => ReifiedMonadicFold m Value (Either Text Update)
arbitraryInputUpdateF = MonadicFold (cosmos . filtered isEditable . to parseComponentType . traverse . act arbitraryInput . to (fmap toUpdate)) | 230 | arbitraryInputUpdateF = MonadicFold (cosmos . filtered isEditable . to parseComponentType . traverse . act arbitraryInput . to (fmap toUpdate)) | 143 | false | true | 0 | 12 | 29 | 82 | 37 | 45 | null | null |
AlbinTheander/oden | src/Oden/Compiler/Validation.hs | mit | validateExpr (Subslice _ s r _) = do
validateExpr s
validateRange r | 71 | validateExpr (Subslice _ s r _) = do
validateExpr s
validateRange r | 71 | validateExpr (Subslice _ s r _) = do
validateExpr s
validateRange r | 71 | false | false | 0 | 7 | 15 | 33 | 14 | 19 | null | null |
atsukotakahashi/wi | src/library/Yi/Keymap.hs | gpl-2.0 | catchJustE :: (Exception e) => (e -> Maybe b) -- ^ Predicate to select exceptions
-> YiM a -- ^ Computation to run
-> (b -> YiM a) -- ^ Handler
-> YiM a
catchJustE p (YiM c) h = YiM $ ReaderT (\r -> catchJust p (runReaderT c r) (\b -> runReaderT (runYiM $ h b) r)) | 304 | catchJustE :: (Exception e) => (e -> Maybe b) -- ^ Predicate to select exceptions
-> YiM a -- ^ Computation to run
-> (b -> YiM a) -- ^ Handler
-> YiM a
catchJustE p (YiM c) h = YiM $ ReaderT (\r -> catchJust p (runReaderT c r) (\b -> runReaderT (runYiM $ h b) r)) | 304 | catchJustE p (YiM c) h = YiM $ ReaderT (\r -> catchJust p (runReaderT c r) (\b -> runReaderT (runYiM $ h b) r)) | 111 | false | true | 0 | 15 | 97 | 127 | 65 | 62 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | recSelErrorIdKey = mkPreludeMiscIdUnique 7 | 56 | recSelErrorIdKey = mkPreludeMiscIdUnique 7 | 56 | recSelErrorIdKey = mkPreludeMiscIdUnique 7 | 56 | false | false | 0 | 5 | 17 | 9 | 4 | 5 | null | null |
agentm/project-m36 | src/lib/ProjectM36/NormalizeExpr.hs | unlicense | processRestrictionPredicateExpr (AttributeEqualityPredicate nam expr) =
AttributeEqualityPredicate nam <$> processAtomExpr expr | 129 | processRestrictionPredicateExpr (AttributeEqualityPredicate nam expr) =
AttributeEqualityPredicate nam <$> processAtomExpr expr | 129 | processRestrictionPredicateExpr (AttributeEqualityPredicate nam expr) =
AttributeEqualityPredicate nam <$> processAtomExpr expr | 129 | false | false | 0 | 7 | 11 | 27 | 12 | 15 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/nativeGen/PPC/CodeGen.hs | bsd-3-clause | genCCall :: ForeignTarget -- function to call
-> [CmmFormal] -- where to put the result
-> [CmmActual] -- arguments (of mixed type)
-> NatM InstrBlock
genCCall target dest_regs argsAndHints
= do dflags <- getDynFlags
let platform = targetPlatform dflags
case platformOS platform of
OSLinux -> genCCall' dflags GCPLinux target dest_regs argsAndHints
OSDarwin -> genCCall' dflags GCPDarwin target dest_regs argsAndHints
_ -> panic "PPC.CodeGen.genCCall: not defined for this os" | 577 | genCCall :: ForeignTarget -- function to call
-> [CmmFormal] -- where to put the result
-> [CmmActual] -- arguments (of mixed type)
-> NatM InstrBlock
genCCall target dest_regs argsAndHints
= do dflags <- getDynFlags
let platform = targetPlatform dflags
case platformOS platform of
OSLinux -> genCCall' dflags GCPLinux target dest_regs argsAndHints
OSDarwin -> genCCall' dflags GCPDarwin target dest_regs argsAndHints
_ -> panic "PPC.CodeGen.genCCall: not defined for this os" | 577 | genCCall target dest_regs argsAndHints
= do dflags <- getDynFlags
let platform = targetPlatform dflags
case platformOS platform of
OSLinux -> genCCall' dflags GCPLinux target dest_regs argsAndHints
OSDarwin -> genCCall' dflags GCPDarwin target dest_regs argsAndHints
_ -> panic "PPC.CodeGen.genCCall: not defined for this os" | 374 | false | true | 0 | 10 | 168 | 114 | 55 | 59 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Text.hs | bsd-3-clause | -- | /O(n)/ 'dropWhile' @p@ @t@ returns the suffix remaining after
-- 'takeWhile' @p@ @t@. Subject to fusion.
dropWhile :: (Char -> Bool) -> Text -> Text
dropWhile p t@(Text arr off len) = loop 0 0
where loop !i !l | l >= len = empty
| p c = loop (i+d) (l+d)
| otherwise = Text arr (off+i) (len-l)
where Iter c d = iter t i
| 387 | dropWhile :: (Char -> Bool) -> Text -> Text
dropWhile p t@(Text arr off len) = loop 0 0
where loop !i !l | l >= len = empty
| p c = loop (i+d) (l+d)
| otherwise = Text arr (off+i) (len-l)
where Iter c d = iter t i
| 277 | dropWhile p t@(Text arr off len) = loop 0 0
where loop !i !l | l >= len = empty
| p c = loop (i+d) (l+d)
| otherwise = Text arr (off+i) (len-l)
where Iter c d = iter t i
| 233 | true | true | 3 | 8 | 132 | 163 | 77 | 86 | null | null |
miguelpagano/equ | Equ/Theories/Common.hs | gpl-3.0 | -- | And
and :: Expr -> Expr -> Expr
and (Expr p) (Expr q) = Expr $ BinOp folAnd p q | 84 | and :: Expr -> Expr -> Expr
and (Expr p) (Expr q) = Expr $ BinOp folAnd p q | 75 | and (Expr p) (Expr q) = Expr $ BinOp folAnd p q | 47 | true | true | 0 | 10 | 21 | 53 | 25 | 28 | null | null |
monsanto/hie | Hie/Language/Haskell/Exts/ParseUtils.hs | gpl-3.0 | checkPatField (FieldWildcard l) = return (PFieldWildcard l) | 59 | checkPatField (FieldWildcard l) = return (PFieldWildcard l) | 59 | checkPatField (FieldWildcard l) = return (PFieldWildcard l) | 59 | false | false | 0 | 7 | 6 | 24 | 11 | 13 | null | null |
vikraman/ghc | compiler/coreSyn/CoreUnfold.hs | bsd-3-clause | conSize :: DataCon -> Int -> ExprSize
conSize dc n_val_args
| n_val_args == 0 = SizeIs 0 emptyBag 10 -- Like variables
-- See Note [Unboxed tuple size and result discount]
| isUnboxedTupleCon dc = SizeIs 0 emptyBag (10 * (1 + n_val_args))
-- See Note [Constructor size and result discount]
| otherwise = SizeIs 10 emptyBag (10 * (1 + n_val_args)) | 357 | conSize :: DataCon -> Int -> ExprSize
conSize dc n_val_args
| n_val_args == 0 = SizeIs 0 emptyBag 10 -- Like variables
-- See Note [Unboxed tuple size and result discount]
| isUnboxedTupleCon dc = SizeIs 0 emptyBag (10 * (1 + n_val_args))
-- See Note [Constructor size and result discount]
| otherwise = SizeIs 10 emptyBag (10 * (1 + n_val_args)) | 357 | conSize dc n_val_args
| n_val_args == 0 = SizeIs 0 emptyBag 10 -- Like variables
-- See Note [Unboxed tuple size and result discount]
| isUnboxedTupleCon dc = SizeIs 0 emptyBag (10 * (1 + n_val_args))
-- See Note [Constructor size and result discount]
| otherwise = SizeIs 10 emptyBag (10 * (1 + n_val_args)) | 319 | false | true | 2 | 9 | 72 | 103 | 53 | 50 | null | null |
Gabriel439/Haskell-Dhall-Library | dhall/tests/Dhall/Test/Util.hs | bsd-3-clause | equivalent :: Text -> Text -> IO ()
equivalent text0 text1 = do
expr0 <- fmap Dhall.Core.normalize (code text0) :: IO (Expr Void Void)
expr1 <- fmap Dhall.Core.normalize (code text1) :: IO (Expr Void Void)
assertEqual "Expressions are not equivalent" expr0 expr1 | 274 | equivalent :: Text -> Text -> IO ()
equivalent text0 text1 = do
expr0 <- fmap Dhall.Core.normalize (code text0) :: IO (Expr Void Void)
expr1 <- fmap Dhall.Core.normalize (code text1) :: IO (Expr Void Void)
assertEqual "Expressions are not equivalent" expr0 expr1 | 274 | equivalent text0 text1 = do
expr0 <- fmap Dhall.Core.normalize (code text0) :: IO (Expr Void Void)
expr1 <- fmap Dhall.Core.normalize (code text1) :: IO (Expr Void Void)
assertEqual "Expressions are not equivalent" expr0 expr1 | 238 | false | true | 0 | 10 | 53 | 109 | 52 | 57 | null | null |
alpicola/mel | src/K/Eliminate.hs | mit | elimExpr (KCon con ns) = KCon con ns <$ mapM_ addUse ns | 55 | elimExpr (KCon con ns) = KCon con ns <$ mapM_ addUse ns | 55 | elimExpr (KCon con ns) = KCon con ns <$ mapM_ addUse ns | 55 | false | false | 0 | 6 | 11 | 32 | 14 | 18 | null | null |
shockkolate/containers | tests-ghc/datamap002.hs | bsd-3-clause | ain :: IO ()
main = print $ valid $ deleteMin $ deleteMin
$ fromList [ (i, ()) | i <- [0,2,5,1,6,4,8,9,7,11,10,3] ]
| 121 | main :: IO ()
main = print $ valid $ deleteMin $ deleteMin
$ fromList [ (i, ()) | i <- [0,2,5,1,6,4,8,9,7,11,10,3] ] | 121 | main = print $ valid $ deleteMin $ deleteMin
$ fromList [ (i, ()) | i <- [0,2,5,1,6,4,8,9,7,11,10,3] ] | 107 | false | true | 6 | 8 | 28 | 98 | 53 | 45 | null | null |
radekm/crep | Core/Utils.hs | bsd-3-clause | -- | @'safeFoldl1' e f xs@ returns @'foldl1' f xs@ when @xs@ is nonempty
-- otherwise returns @e@.
safeFoldl1 :: a -> (a -> a -> a) -> [a] -> a
safeFoldl1 e _ [] = e | 167 | safeFoldl1 :: a -> (a -> a -> a) -> [a] -> a
safeFoldl1 e _ [] = e | 66 | safeFoldl1 e _ [] = e | 21 | true | true | 0 | 10 | 38 | 54 | 27 | 27 | null | null |
urv/fixhs | src/Data/FIX/Spec/FIX43.hs | lgpl-2.1 | tSecondaryExecID :: FIXTag
tSecondaryExecID = FIXTag
{ tName = "SecondaryExecID"
, tnum = 527
, tparser = toFIXString
, arbitraryValue = FIXString <$> arbitrary } | 175 | tSecondaryExecID :: FIXTag
tSecondaryExecID = FIXTag
{ tName = "SecondaryExecID"
, tnum = 527
, tparser = toFIXString
, arbitraryValue = FIXString <$> arbitrary } | 175 | tSecondaryExecID = FIXTag
{ tName = "SecondaryExecID"
, tnum = 527
, tparser = toFIXString
, arbitraryValue = FIXString <$> arbitrary } | 148 | false | true | 0 | 8 | 37 | 45 | 26 | 19 | null | null |
brendanhay/gogol | gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs | mpl-2.0 | -- | A list of errors defined if and only if the request failed.
pcbre1Errors :: Lens' ProductsCustomBatchResponseEntry (Maybe Errors)
pcbre1Errors
= lens _pcbre1Errors (\ s a -> s{_pcbre1Errors = a}) | 202 | pcbre1Errors :: Lens' ProductsCustomBatchResponseEntry (Maybe Errors)
pcbre1Errors
= lens _pcbre1Errors (\ s a -> s{_pcbre1Errors = a}) | 137 | pcbre1Errors
= lens _pcbre1Errors (\ s a -> s{_pcbre1Errors = a}) | 67 | true | true | 0 | 9 | 32 | 48 | 25 | 23 | null | null |
apyrgio/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | ssFilePerms :: Int
ssFilePerms = 0o444 | 38 | ssFilePerms :: Int
ssFilePerms = 0o444 | 38 | ssFilePerms = 0o444 | 19 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ekmett/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxNB_FIXEDWIDTH :: Int
wxNB_FIXEDWIDTH = 16 | 43 | wxNB_FIXEDWIDTH :: Int
wxNB_FIXEDWIDTH = 16 | 43 | wxNB_FIXEDWIDTH = 16 | 20 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
da-eto-ya/trash | haskell/simplest/fib.hs | mit | main :: IO ()
main = do
x <- readLn :: IO Integer
print $ fib x | 67 | main :: IO ()
main = do
x <- readLn :: IO Integer
print $ fib x | 67 | main = do
x <- readLn :: IO Integer
print $ fib x | 53 | false | true | 0 | 8 | 20 | 39 | 18 | 21 | null | null |
lukemaurer/sequent-core | src/Language/SequentCore/FloatOut/Summary.hs | bsd-3-clause | cloSk :: Var -> VarSet -> Skeleton -> Skeleton
cloSk var fvs sk | isId var = CloSk var fvs sk
| otherwise = assert (isEmptyVarSet fvs && isNilSk sk)
NilSk | 203 | cloSk :: Var -> VarSet -> Skeleton -> Skeleton
cloSk var fvs sk | isId var = CloSk var fvs sk
| otherwise = assert (isEmptyVarSet fvs && isNilSk sk)
NilSk | 203 | cloSk var fvs sk | isId var = CloSk var fvs sk
| otherwise = assert (isEmptyVarSet fvs && isNilSk sk)
NilSk | 156 | false | true | 0 | 9 | 79 | 73 | 33 | 40 | null | null |
nakamuray/htig | HTIG/IRCServer/Constants.hs | bsd-3-clause | eRR_TOOMANYCHANNELS = 405 | 25 | eRR_TOOMANYCHANNELS = 405 | 25 | eRR_TOOMANYCHANNELS = 405 | 25 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
input-output-hk/pos-haskell-prototype | wallet/src/Cardano/Wallet/Kernel/CoinSelection/Generic/Grouped.hs | mit | -- | Default translation from UTxOs represented as maps to grouped UTxOs
--
-- The cost of this translation is @O(n log m)@, with @n@ the length of the
-- UTxO and @m@ the size of the largest group. In typical cases the size of
-- groups will be bound (and small), so that this is linear in the size of
-- the UTxO.
groupUtxo :: forall utxo. (StandardUtxo utxo, HasAddress (Dom utxo))
=> utxo -> GroupedUtxo utxo
groupUtxo utxo = GroupedUtxo utxo groups
where
groups :: Map (Address (Dom utxo)) (Group utxo)
groups = foldl' insert Map.empty (Map.toList (coerce utxo))
insert :: Map (Address (Dom utxo)) (Group utxo)
-> (Input (Dom utxo), Output (Dom utxo))
-> Map (Address (Dom utxo)) (Group utxo)
insert acc (i, o) = Map.alter f (outAddr o) acc
where
f :: Maybe (Group utxo) -> Maybe (Group utxo)
f Nothing = Just $ Set.singleton i
f (Just group) = Just $ Set.insert i group | 961 | groupUtxo :: forall utxo. (StandardUtxo utxo, HasAddress (Dom utxo))
=> utxo -> GroupedUtxo utxo
groupUtxo utxo = GroupedUtxo utxo groups
where
groups :: Map (Address (Dom utxo)) (Group utxo)
groups = foldl' insert Map.empty (Map.toList (coerce utxo))
insert :: Map (Address (Dom utxo)) (Group utxo)
-> (Input (Dom utxo), Output (Dom utxo))
-> Map (Address (Dom utxo)) (Group utxo)
insert acc (i, o) = Map.alter f (outAddr o) acc
where
f :: Maybe (Group utxo) -> Maybe (Group utxo)
f Nothing = Just $ Set.singleton i
f (Just group) = Just $ Set.insert i group | 645 | groupUtxo utxo = GroupedUtxo utxo groups
where
groups :: Map (Address (Dom utxo)) (Group utxo)
groups = foldl' insert Map.empty (Map.toList (coerce utxo))
insert :: Map (Address (Dom utxo)) (Group utxo)
-> (Input (Dom utxo), Output (Dom utxo))
-> Map (Address (Dom utxo)) (Group utxo)
insert acc (i, o) = Map.alter f (outAddr o) acc
where
f :: Maybe (Group utxo) -> Maybe (Group utxo)
f Nothing = Just $ Set.singleton i
f (Just group) = Just $ Set.insert i group | 538 | true | true | 11 | 10 | 244 | 287 | 149 | 138 | null | null |
ezyang/ghc | testsuite/tests/perf/compiler/Naperian.hs | bsd-3-clause | unsparse :: forall fs a. Shapely fs => Sparse fs a -> Flat fs a
unsparse (Sparse e xs) = Flat (Vector.unsafeAccum (flip const) vs as)
where
as = IntMap.assocs xs
vs = Vector.replicate l e
l = hsize (hreplicate () :: Hyper fs ())
--------------------------------------------------------------------------------
-- Examples | 349 | unsparse :: forall fs a. Shapely fs => Sparse fs a -> Flat fs a
unsparse (Sparse e xs) = Flat (Vector.unsafeAccum (flip const) vs as)
where
as = IntMap.assocs xs
vs = Vector.replicate l e
l = hsize (hreplicate () :: Hyper fs ())
--------------------------------------------------------------------------------
-- Examples | 349 | unsparse (Sparse e xs) = Flat (Vector.unsafeAccum (flip const) vs as)
where
as = IntMap.assocs xs
vs = Vector.replicate l e
l = hsize (hreplicate () :: Hyper fs ())
--------------------------------------------------------------------------------
-- Examples | 285 | false | true | 0 | 9 | 75 | 123 | 61 | 62 | null | null |
rahulmutt/ghcvm | compiler/Eta/CodeGen/Rts.hs | bsd-3-clause | resumeInterruptsMethod :: Code
resumeInterruptsMethod =
invokevirtual $ mkMethodRef stgTSO "resumeInterrupts" [jbool] void | 124 | resumeInterruptsMethod :: Code
resumeInterruptsMethod =
invokevirtual $ mkMethodRef stgTSO "resumeInterrupts" [jbool] void | 124 | resumeInterruptsMethod =
invokevirtual $ mkMethodRef stgTSO "resumeInterrupts" [jbool] void | 93 | false | true | 0 | 7 | 13 | 27 | 14 | 13 | null | null |
BlackBrane/ansigraph | src/System/Console/Ansigraph/Examples.hs | mit | -- | Show all of the available 'AnsiColor's with corresponding 'ColorIntensity', 'Color' pairs.
showColors = do
boldStrLn noColoring "Available colors"
newline
forM_ ansicolors $ \c -> do
let clr = Coloring Nothing (Just c)
colorStr clr $ replicate 20 ' '
putStrLn $ " " ++ show (intensity c) ++ " " ++ show (color c)
setSGR [Reset] | 353 | showColors = do
boldStrLn noColoring "Available colors"
newline
forM_ ansicolors $ \c -> do
let clr = Coloring Nothing (Just c)
colorStr clr $ replicate 20 ' '
putStrLn $ " " ++ show (intensity c) ++ " " ++ show (color c)
setSGR [Reset] | 257 | showColors = do
boldStrLn noColoring "Available colors"
newline
forM_ ansicolors $ \c -> do
let clr = Coloring Nothing (Just c)
colorStr clr $ replicate 20 ' '
putStrLn $ " " ++ show (intensity c) ++ " " ++ show (color c)
setSGR [Reset] | 257 | true | false | 0 | 16 | 78 | 114 | 51 | 63 | null | null |
dmbarbour/Sirea | sirea-filesystem/src/Sirea/Filesystem/KeyedSched.hs | bsd-3-clause | wKeyedSched :: (Ord k) => (Work -> IO ()) -> IO (k -> Work -> IO ())
newKeyedSched sched =
newIORef M.empty >>= \ rf ->
let ks = KS rf sched in
return (addKeyedWork ks)
| 182 | newKeyedSched :: (Ord k) => (Work -> IO ()) -> IO (k -> Work -> IO ())
newKeyedSched sched =
newIORef M.empty >>= \ rf ->
let ks = KS rf sched in
return (addKeyedWork ks) | 182 | newKeyedSched sched =
newIORef M.empty >>= \ rf ->
let ks = KS rf sched in
return (addKeyedWork ks) | 111 | false | true | 0 | 12 | 49 | 97 | 47 | 50 | null | null |
olsner/ghc | libraries/base/Data/Bifoldable.hs | bsd-3-clause | -- | Alias for 'bifor_'.
--
-- @since 4.10.0.0
biforM_ :: (Bifoldable t, Applicative f)
=> t a b -> (a -> f c) -> (b -> f d) -> f ()
biforM_ = bifor_ | 158 | biforM_ :: (Bifoldable t, Applicative f)
=> t a b -> (a -> f c) -> (b -> f d) -> f ()
biforM_ = bifor_ | 111 | biforM_ = bifor_ | 16 | true | true | 0 | 11 | 43 | 71 | 37 | 34 | null | null |
jaalonso/I1M-Cod-Temas | test/Tema_18c_TablaConListasDeAsociacion_Spec.hs | gpl-2.0 | spec :: Spec
spec = do
describe "valor" $ do
it "e1" $
valor t1 6 `shouldBe` -3
it "e2" $
valor t2 2 `shouldBe` 67
it "e3" $
evaluate (valor t2 5 ) `shouldThrow` errorCall "fuera de rango"
describe "modifica" $ do
it "e1" $
valor t1 6 `shouldBe` -3
it "e2" $
valor (modifica (6,9) t1) 6 `shouldBe` 9
describe "tabla" $ do
it "e1" $
show (tabla [(4,89), (1,90), (2,67)]) `shouldBe` "Tbl [(4,89),(1,90),(2,67)]"
where
f x = if x < 3 then x else 3-x
t1 = tabla [(i,f i) | i <- [1..6] ]
t2 = tabla [(4,89), (1,90), (2,67)] | 610 | spec :: Spec
spec = do
describe "valor" $ do
it "e1" $
valor t1 6 `shouldBe` -3
it "e2" $
valor t2 2 `shouldBe` 67
it "e3" $
evaluate (valor t2 5 ) `shouldThrow` errorCall "fuera de rango"
describe "modifica" $ do
it "e1" $
valor t1 6 `shouldBe` -3
it "e2" $
valor (modifica (6,9) t1) 6 `shouldBe` 9
describe "tabla" $ do
it "e1" $
show (tabla [(4,89), (1,90), (2,67)]) `shouldBe` "Tbl [(4,89),(1,90),(2,67)]"
where
f x = if x < 3 then x else 3-x
t1 = tabla [(i,f i) | i <- [1..6] ]
t2 = tabla [(4,89), (1,90), (2,67)] | 610 | spec = do
describe "valor" $ do
it "e1" $
valor t1 6 `shouldBe` -3
it "e2" $
valor t2 2 `shouldBe` 67
it "e3" $
evaluate (valor t2 5 ) `shouldThrow` errorCall "fuera de rango"
describe "modifica" $ do
it "e1" $
valor t1 6 `shouldBe` -3
it "e2" $
valor (modifica (6,9) t1) 6 `shouldBe` 9
describe "tabla" $ do
it "e1" $
show (tabla [(4,89), (1,90), (2,67)]) `shouldBe` "Tbl [(4,89),(1,90),(2,67)]"
where
f x = if x < 3 then x else 3-x
t1 = tabla [(i,f i) | i <- [1..6] ]
t2 = tabla [(4,89), (1,90), (2,67)] | 597 | false | true | 0 | 16 | 195 | 319 | 166 | 153 | null | null |
hbrouwer/pdrt-sandbox | src/Data/DRS/Variables.hs | apache-2.0 | drsVariables (DRS u c) = u `union` variables c
where variables :: [DRSCon] -> [DRSRef]
variables [] = []
variables (Rel _ d:cs) = d `union` variables cs
variables (Neg d1:cs) = drsVariables d1 `union` variables cs
variables (Imp d1 d2:cs) = drsVariables d1 `union` drsVariables d2 `union` variables cs
variables (Or d1 d2:cs) = drsVariables d1 `union` drsVariables d2 `union` variables cs
variables (Prop r d1:cs) = [r] `union` drsVariables d1 `union` variables cs
variables (Diamond d1:cs) = drsVariables d1 `union` variables cs
variables (Box d1:cs) = drsVariables d1 `union` variables cs
---------------------------------------------------------------------------
-- | Returns the ordered list of all lambda variables in a 'DRS'.
--------------------------------------------------------------------------- | 919 | drsVariables (DRS u c) = u `union` variables c
where variables :: [DRSCon] -> [DRSRef]
variables [] = []
variables (Rel _ d:cs) = d `union` variables cs
variables (Neg d1:cs) = drsVariables d1 `union` variables cs
variables (Imp d1 d2:cs) = drsVariables d1 `union` drsVariables d2 `union` variables cs
variables (Or d1 d2:cs) = drsVariables d1 `union` drsVariables d2 `union` variables cs
variables (Prop r d1:cs) = [r] `union` drsVariables d1 `union` variables cs
variables (Diamond d1:cs) = drsVariables d1 `union` variables cs
variables (Box d1:cs) = drsVariables d1 `union` variables cs
---------------------------------------------------------------------------
-- | Returns the ordered list of all lambda variables in a 'DRS'.
--------------------------------------------------------------------------- | 919 | drsVariables (DRS u c) = u `union` variables c
where variables :: [DRSCon] -> [DRSRef]
variables [] = []
variables (Rel _ d:cs) = d `union` variables cs
variables (Neg d1:cs) = drsVariables d1 `union` variables cs
variables (Imp d1 d2:cs) = drsVariables d1 `union` drsVariables d2 `union` variables cs
variables (Or d1 d2:cs) = drsVariables d1 `union` drsVariables d2 `union` variables cs
variables (Prop r d1:cs) = [r] `union` drsVariables d1 `union` variables cs
variables (Diamond d1:cs) = drsVariables d1 `union` variables cs
variables (Box d1:cs) = drsVariables d1 `union` variables cs
---------------------------------------------------------------------------
-- | Returns the ordered list of all lambda variables in a 'DRS'.
--------------------------------------------------------------------------- | 919 | false | false | 0 | 7 | 218 | 313 | 157 | 156 | null | null |
maarons/Cortex | Common/ErrorIO.hs | agpl-3.0 | -----
iSetBuffering :: (MonadError String m, MonadIO m) =>
Handle -> BufferMode -> m ()
iSetBuffering hdl mode = ioReport $ hSetBuffering hdl mode | 151 | iSetBuffering :: (MonadError String m, MonadIO m) =>
Handle -> BufferMode -> m ()
iSetBuffering hdl mode = ioReport $ hSetBuffering hdl mode | 144 | iSetBuffering hdl mode = ioReport $ hSetBuffering hdl mode | 58 | true | true | 0 | 9 | 28 | 56 | 28 | 28 | null | null |
krisajenkins/snaplet-auth | src/Snaplet/Authentication.hs | bsd-3-clause | processEmailPassword :: Login -> Handler b (Authentication b) ()
processEmailPassword payload = do
matchingAccount <- handleSql (lookupByEmail (loginEmail payload))
case matchingAccount of
Nothing -> unauthorized
-- Validate password.
Just (account, accountUidpwd) ->
if validatePassword
(encodeUtf8 (accountUidpwdPassword accountUidpwd))
(encodeUtf8 (loginPassword payload))
then authorizedAccountResponse account
else unauthorized | 496 | processEmailPassword :: Login -> Handler b (Authentication b) ()
processEmailPassword payload = do
matchingAccount <- handleSql (lookupByEmail (loginEmail payload))
case matchingAccount of
Nothing -> unauthorized
-- Validate password.
Just (account, accountUidpwd) ->
if validatePassword
(encodeUtf8 (accountUidpwdPassword accountUidpwd))
(encodeUtf8 (loginPassword payload))
then authorizedAccountResponse account
else unauthorized | 496 | processEmailPassword payload = do
matchingAccount <- handleSql (lookupByEmail (loginEmail payload))
case matchingAccount of
Nothing -> unauthorized
-- Validate password.
Just (account, accountUidpwd) ->
if validatePassword
(encodeUtf8 (accountUidpwdPassword accountUidpwd))
(encodeUtf8 (loginPassword payload))
then authorizedAccountResponse account
else unauthorized | 431 | false | true | 0 | 15 | 108 | 124 | 61 | 63 | null | null |
egonSchiele/HandsomeSoup | src/Text/CSS/Parser.hs | bsd-3-clause | pp ChildOf = "<child of>" | 25 | pp ChildOf = "<child of>" | 25 | pp ChildOf = "<child of>" | 25 | false | false | 1 | 5 | 4 | 13 | 4 | 9 | null | null |
nikivazou/verified_string_matching | src/Data/RString/RString.hs | bsd-3-clause | ------------------------------------------------------------------------------
--------------- Properties assumed for RStrings ---------------------------
------------------------------------------------------------------------------
-- | Empty Strings
{-@ assume stringEmpProp :: x:RString -> { stringLen x == 0 <=> x == stringEmp } @-}
stringEmpProp :: RString -> Proof
stringEmpProp _ = trivial | 402 | stringEmpProp :: RString -> Proof
stringEmpProp _ = trivial | 59 | stringEmpProp _ = trivial | 25 | true | true | 0 | 5 | 42 | 23 | 14 | 9 | null | null |
imh/plover | src/Language/Plover/Reduce.hs | mit | typeCheck' (StructDecl name tp) = do
extendTypedef name (StructType name tp)
let fields = map fst $ st_fields tp
assert (length (nub fields) == length fields) $
"typeCheck'. struct declaration fields are not unique: " ++ show tp
return Void | 252 | typeCheck' (StructDecl name tp) = do
extendTypedef name (StructType name tp)
let fields = map fst $ st_fields tp
assert (length (nub fields) == length fields) $
"typeCheck'. struct declaration fields are not unique: " ++ show tp
return Void | 252 | typeCheck' (StructDecl name tp) = do
extendTypedef name (StructType name tp)
let fields = map fst $ st_fields tp
assert (length (nub fields) == length fields) $
"typeCheck'. struct declaration fields are not unique: " ++ show tp
return Void | 252 | false | false | 0 | 14 | 51 | 95 | 41 | 54 | null | null |
dstarcev/stepic-haskell | src/Module3/Task17.hs | bsd-3-clause | change s = [coin:ch | coin <- coins, coin <= s, ch <- (change $ s - coin)] | 74 | change s = [coin:ch | coin <- coins, coin <= s, ch <- (change $ s - coin)] | 74 | change s = [coin:ch | coin <- coins, coin <= s, ch <- (change $ s - coin)] | 74 | false | false | 0 | 10 | 17 | 51 | 26 | 25 | null | null |
noamz/linlam-gos | src/Viz/List.hs | mit | numberedVList :: [Diagram B] -> [Diagram B]
numberedVList xs = labelledVList $ zip xs (map (text . show) [1..]) | 111 | numberedVList :: [Diagram B] -> [Diagram B]
numberedVList xs = labelledVList $ zip xs (map (text . show) [1..]) | 111 | numberedVList xs = labelledVList $ zip xs (map (text . show) [1..]) | 67 | false | true | 0 | 10 | 18 | 57 | 29 | 28 | null | null |
rahulmutt/ghcvm | compiler/Eta/Utils/UniqDFM.hs | bsd-3-clause | anyUDFM :: (elt -> Bool) -> UniqDFM elt -> Bool
anyUDFM p (UDFM m _i) = M.foldr ((||) . p . taggedFst) False m | 110 | anyUDFM :: (elt -> Bool) -> UniqDFM elt -> Bool
anyUDFM p (UDFM m _i) = M.foldr ((||) . p . taggedFst) False m | 110 | anyUDFM p (UDFM m _i) = M.foldr ((||) . p . taggedFst) False m | 62 | false | true | 0 | 8 | 23 | 64 | 33 | 31 | null | null |
nkartashov/haskell | hw10/Writer/Main.hs | gpl-2.0 | main = fmap (const ()) $ runTestTT $ test
[ runWriter (fac 0) ~?= (1,"1")
, runWriter (fac 1) ~?= (1,"1")
, runWriter (fac 2) ~?= (2,"(1) * 2")
, runWriter (fac 3) ~?= (6,"((1) * 2) * 3")
, runWriter (fac 4) ~?= (24,"(((1) * 2) * 3) * 4")
, runWriter (fac 5) ~?= (120,"((((1) * 2) * 3) * 4) * 5")
] | 326 | main = fmap (const ()) $ runTestTT $ test
[ runWriter (fac 0) ~?= (1,"1")
, runWriter (fac 1) ~?= (1,"1")
, runWriter (fac 2) ~?= (2,"(1) * 2")
, runWriter (fac 3) ~?= (6,"((1) * 2) * 3")
, runWriter (fac 4) ~?= (24,"(((1) * 2) * 3) * 4")
, runWriter (fac 5) ~?= (120,"((((1) * 2) * 3) * 4) * 5")
] | 326 | main = fmap (const ()) $ runTestTT $ test
[ runWriter (fac 0) ~?= (1,"1")
, runWriter (fac 1) ~?= (1,"1")
, runWriter (fac 2) ~?= (2,"(1) * 2")
, runWriter (fac 3) ~?= (6,"((1) * 2) * 3")
, runWriter (fac 4) ~?= (24,"(((1) * 2) * 3) * 4")
, runWriter (fac 5) ~?= (120,"((((1) * 2) * 3) * 4) * 5")
] | 326 | false | false | 1 | 10 | 93 | 164 | 85 | 79 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/nativeGen/X86/RegInfo.hs | bsd-3-clause | fpRegColors :: [(Reg,String)]
fpRegColors =
[ (fake0, "#ff00ff")
, (fake1, "#ff00aa")
, (fake2, "#aa00ff")
, (fake3, "#aa00aa")
, (fake4, "#ff0055")
, (fake5, "#5500ff") ]
++ zip (map regSingle [24..39]) (repeat "red") | 275 | fpRegColors :: [(Reg,String)]
fpRegColors =
[ (fake0, "#ff00ff")
, (fake1, "#ff00aa")
, (fake2, "#aa00ff")
, (fake3, "#aa00aa")
, (fake4, "#ff0055")
, (fake5, "#5500ff") ]
++ zip (map regSingle [24..39]) (repeat "red") | 275 | fpRegColors =
[ (fake0, "#ff00ff")
, (fake1, "#ff00aa")
, (fake2, "#aa00ff")
, (fake3, "#aa00aa")
, (fake4, "#ff0055")
, (fake5, "#5500ff") ]
++ zip (map regSingle [24..39]) (repeat "red") | 245 | false | true | 2 | 8 | 87 | 110 | 63 | 47 | null | null |
rueshyna/gogol | gogol-slides/gen/Network/Google/Slides/Types/Product.hs | mpl-2.0 | -- | Slide specific properties. Only set if page_type = SLIDE.
pSlideProperties :: Lens' Page (Maybe SlideProperties)
pSlideProperties
= lens _pSlideProperties
(\ s a -> s{_pSlideProperties = a}) | 203 | pSlideProperties :: Lens' Page (Maybe SlideProperties)
pSlideProperties
= lens _pSlideProperties
(\ s a -> s{_pSlideProperties = a}) | 140 | pSlideProperties
= lens _pSlideProperties
(\ s a -> s{_pSlideProperties = a}) | 85 | true | true | 0 | 9 | 35 | 48 | 25 | 23 | null | null |
koba-e964/hayashii-mcc | llvm/Emit.hs | bsd-3-clause | runLLVM :: AST.Module -> LLVM a -> Either String AST.Module
runLLVM astmod llvm = execStateT (unLLVM llvm) astmod | 113 | runLLVM :: AST.Module -> LLVM a -> Either String AST.Module
runLLVM astmod llvm = execStateT (unLLVM llvm) astmod | 113 | runLLVM astmod llvm = execStateT (unLLVM llvm) astmod | 53 | false | true | 0 | 8 | 17 | 47 | 22 | 25 | null | null |
rimmington/pipes-cliff | lib/Pipes/Cliff/Core.hs | bsd-3-clause | -- * Mailboxes
-- | Creates a new mailbox and returns 'Proxy' that stream values
-- into and out of the mailbox. Each 'Proxy' is equipped with a
-- finalizer that will seal the mailbox immediately after production
-- or consumption has completed, even if such completion is not due
-- to an exhausted mailbox. This will signal to the other side of
-- the mailbox that the mailbox is sealed.
--
-- Also returns an STM action to seal the box manually.
newMailbox
:: (MonadSafe mi, MonadSafe mo)
=> IO (Consumer a mi (), Producer a mo (), STM ())
newMailbox = do
(toBox, fromBox, seal) <- messageBox
let csmr = register (liftIO $ atomically seal)
>> sendToBox toBox
pdcr = register (liftIO $ atomically seal)
>> produceFromBox fromBox
return (csmr, pdcr, seal)
-- * Exception safety
-- | Creates a process, uses it, and terminates it when the last
-- computation ends. Don't try to use any of the process resources
-- after the last computation ends, because the process will already
-- have been terminated. For an example of its use, see
-- 'Pipes.Cliff.Examples.standardOutputAndErrorBracketed'. | 1,144 | newMailbox
:: (MonadSafe mi, MonadSafe mo)
=> IO (Consumer a mi (), Producer a mo (), STM ())
newMailbox = do
(toBox, fromBox, seal) <- messageBox
let csmr = register (liftIO $ atomically seal)
>> sendToBox toBox
pdcr = register (liftIO $ atomically seal)
>> produceFromBox fromBox
return (csmr, pdcr, seal)
-- * Exception safety
-- | Creates a process, uses it, and terminates it when the last
-- computation ends. Don't try to use any of the process resources
-- after the last computation ends, because the process will already
-- have been terminated. For an example of its use, see
-- 'Pipes.Cliff.Examples.standardOutputAndErrorBracketed'. | 691 | newMailbox = do
(toBox, fromBox, seal) <- messageBox
let csmr = register (liftIO $ atomically seal)
>> sendToBox toBox
pdcr = register (liftIO $ atomically seal)
>> produceFromBox fromBox
return (csmr, pdcr, seal)
-- * Exception safety
-- | Creates a process, uses it, and terminates it when the last
-- computation ends. Don't try to use any of the process resources
-- after the last computation ends, because the process will already
-- have been terminated. For an example of its use, see
-- 'Pipes.Cliff.Examples.standardOutputAndErrorBracketed'. | 593 | true | true | 0 | 15 | 235 | 165 | 89 | 76 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.