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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
timerg/parser
|
src/Parser/TechFile.hs
|
bsd-3-clause
|
parseModel :: Parser Model
parseModel = do
stringCI ".model" <?> ".model"
skipSpace
mName <- parseIdentifier <?> "expected model Name"
skipSpace
mType <- parseIdentifier <?> "expected model Type"
skipSpace
char '(' <?> "expected a opening bracket"
skipSpace
mContent <- parseParams <?> "expected a lot of Values"
skipSpace
char ')' <?> "expected a closing bracket"
skipSpace
return $ Model mName mType mContent
| 512
|
parseModel :: Parser Model
parseModel = do
stringCI ".model" <?> ".model"
skipSpace
mName <- parseIdentifier <?> "expected model Name"
skipSpace
mType <- parseIdentifier <?> "expected model Type"
skipSpace
char '(' <?> "expected a opening bracket"
skipSpace
mContent <- parseParams <?> "expected a lot of Values"
skipSpace
char ')' <?> "expected a closing bracket"
skipSpace
return $ Model mName mType mContent
| 512
|
parseModel = do
stringCI ".model" <?> ".model"
skipSpace
mName <- parseIdentifier <?> "expected model Name"
skipSpace
mType <- parseIdentifier <?> "expected model Type"
skipSpace
char '(' <?> "expected a opening bracket"
skipSpace
mContent <- parseParams <?> "expected a lot of Values"
skipSpace
char ')' <?> "expected a closing bracket"
skipSpace
return $ Model mName mType mContent
| 485
| false
| true
| 0
| 8
| 161
| 109
| 46
| 63
| null | null |
facebookincubator/duckling
|
Duckling/Time/AR/Rules.hs
|
bsd-3-clause
|
ruleDOMOrdinalMonthYear :: Rule
ruleDOMOrdinalMonthYear = Rule
{ name = "<day-of-month>(ordinal) <named-month> year"
, pattern =
[ Predicate isDOMOrdinal
, Predicate isAMonth
, regex "(\\d{2,4})"
]
, prod = \tokens -> case tokens of
(token:Token Time td:Token RegexMatch (GroupMatch (match:_)):_) -> do
intVal <- parseInt match
dom <- intersectDOM td token
Token Time <$> intersect dom (year intVal)
_ -> Nothing
}
| 474
|
ruleDOMOrdinalMonthYear :: Rule
ruleDOMOrdinalMonthYear = Rule
{ name = "<day-of-month>(ordinal) <named-month> year"
, pattern =
[ Predicate isDOMOrdinal
, Predicate isAMonth
, regex "(\\d{2,4})"
]
, prod = \tokens -> case tokens of
(token:Token Time td:Token RegexMatch (GroupMatch (match:_)):_) -> do
intVal <- parseInt match
dom <- intersectDOM td token
Token Time <$> intersect dom (year intVal)
_ -> Nothing
}
| 474
|
ruleDOMOrdinalMonthYear = Rule
{ name = "<day-of-month>(ordinal) <named-month> year"
, pattern =
[ Predicate isDOMOrdinal
, Predicate isAMonth
, regex "(\\d{2,4})"
]
, prod = \tokens -> case tokens of
(token:Token Time td:Token RegexMatch (GroupMatch (match:_)):_) -> do
intVal <- parseInt match
dom <- intersectDOM td token
Token Time <$> intersect dom (year intVal)
_ -> Nothing
}
| 442
| false
| true
| 0
| 20
| 120
| 155
| 77
| 78
| null | null |
DrBoolean/wai-middleware-static
|
Network/Wai/Middleware/Static.hs
|
bsd-3-clause
|
-- | Accept only URIs with given prefix
hasPrefix :: String -> Policy
hasPrefix = predicate . isPrefixOf
| 104
|
hasPrefix :: String -> Policy
hasPrefix = predicate . isPrefixOf
| 64
|
hasPrefix = predicate . isPrefixOf
| 34
| true
| true
| 0
| 5
| 17
| 20
| 11
| 9
| null | null |
lenary/Idris-dev
|
src/Idris/Core/TT.hs
|
bsd-3-clause
|
-- Once we've finished checking everything about a term we no longer need
-- the type on the 'P' so erase it so save memory
pEraseType :: TT n -> TT n
pEraseType (P nt t _) = P nt t Erased
| 189
|
pEraseType :: TT n -> TT n
pEraseType (P nt t _) = P nt t Erased
| 64
|
pEraseType (P nt t _) = P nt t Erased
| 37
| true
| true
| 0
| 9
| 42
| 50
| 22
| 28
| null | null |
Emmatipate/ava
|
src/ChipmunkBindings.hs
|
bsd-3-clause
|
newBody :: CpFloat -> CpFloat -> IO (Ptr Body)
newBody m i = [C.exp| cpBody* { cpBodyNew($(double m), $(double i)) } |]
| 119
|
newBody :: CpFloat -> CpFloat -> IO (Ptr Body)
newBody m i = [C.exp| cpBody* { cpBodyNew($(double m), $(double i)) } |]
| 119
|
newBody m i = [C.exp| cpBody* { cpBodyNew($(double m), $(double i)) } |]
| 72
| false
| true
| 0
| 9
| 21
| 39
| 21
| 18
| null | null |
d0kt0r0/Tidal
|
src/Sound/Tidal/old/Dirt.hs
|
gpl-3.0
|
xfadeIn t now (p:p':_) = overlay (p |*| gain (now `rotR` (_slow t envEqR))) (p' |*| gain (now `rotR` (_slow t (envEq))))
| 120
|
xfadeIn t now (p:p':_) = overlay (p |*| gain (now `rotR` (_slow t envEqR))) (p' |*| gain (now `rotR` (_slow t (envEq))))
| 120
|
xfadeIn t now (p:p':_) = overlay (p |*| gain (now `rotR` (_slow t envEqR))) (p' |*| gain (now `rotR` (_slow t (envEq))))
| 120
| false
| false
| 0
| 13
| 21
| 86
| 46
| 40
| null | null |
tomlokhorst/language-cil
|
src/Language/Cil/Build.hs
|
bsd-3-clause
|
ldc_i4 3 = OpCode $ Ldc_i4_3
| 31
|
ldc_i4 3 = OpCode $ Ldc_i4_3
| 31
|
ldc_i4 3 = OpCode $ Ldc_i4_3
| 31
| false
| false
| 3
| 5
| 8
| 18
| 6
| 12
| null | null |
rrnewton/accelerate
|
Data/Array/Accelerate/Type.hs
|
bsd-3-clause
|
floatingDict (TypeDouble dict) = dict
| 37
|
floatingDict (TypeDouble dict) = dict
| 37
|
floatingDict (TypeDouble dict) = dict
| 37
| false
| false
| 0
| 7
| 4
| 15
| 7
| 8
| null | null |
akhileshs/stack
|
src/Stack/Build/Source.hs
|
bsd-3-clause
|
loadSourceMap :: (MonadIO m, MonadCatch m, MonadReader env m, HasBuildConfig env, MonadBaseControl IO m, HasHttpManager env, MonadLogger m, HasEnvConfig env)
=> NeedTargets
-> BuildOpts
-> m ( Map PackageName SimpleTarget
, MiniBuildPlan
, [LocalPackage]
, Set PackageName -- non-local targets
, SourceMap
)
loadSourceMap needTargets bopts = do
bconfig <- asks getBuildConfig
rawLocals <- getLocalPackageViews
(mbp0, cliExtraDeps, targets) <- parseTargetsFromBuildOpts needTargets bopts
menv <- getMinimalEnvOverride
caches <- getPackageCaches menv
let latestVersion = Map.fromListWith max $ map toTuple $ Map.keys caches
-- Extend extra-deps to encompass targets requested on the command line
-- that are not in the snapshot.
extraDeps0 <- extendExtraDeps
(bcExtraDeps bconfig)
cliExtraDeps
(Map.keysSet $ Map.filter (== STUnknown) targets)
latestVersion
locals <- mapM (loadLocalPackage bopts targets) $ Map.toList rawLocals
checkFlagsUsed bopts locals extraDeps0 (mbpPackages mbp0)
let
-- loadLocals returns PackageName (foo) and PackageIdentifier (bar-1.2.3) targets separately;
-- here we combine them into nonLocalTargets. This is one of the
-- return values of this function.
nonLocalTargets :: Set PackageName
nonLocalTargets =
Map.keysSet $ Map.filter (not . isLocal) targets
where
isLocal (STLocalComps _) = True
isLocal STLocalAll = True
isLocal STUnknown = False
isLocal STNonLocal = False
shadowed = Map.keysSet rawLocals <> Map.keysSet extraDeps0
(mbp, extraDeps1) = shadowMiniBuildPlan mbp0 shadowed
-- Add the extra deps from the stack.yaml file to the deps grabbed from
-- the snapshot
extraDeps2 = Map.union
(Map.map (\v -> (v, Map.empty)) extraDeps0)
(Map.map (\mpi -> (mpiVersion mpi, mpiFlags mpi)) extraDeps1)
-- Overwrite any flag settings with those from the config file
extraDeps3 = Map.mapWithKey
(\n (v, f) -> PSUpstream v Local $
case ( Map.lookup (Just n) $ boptsFlags bopts
, Map.lookup Nothing $ boptsFlags bopts
, Map.lookup n $ bcFlags bconfig
) of
-- Didn't have any flag overrides, fall back to the flags
-- defined in the snapshot.
(Nothing, Nothing, Nothing) -> f
-- Either command line flag for this package, general
-- command line flag, or flag in stack.yaml is defined.
-- Take all of those and ignore the snapshot flags.
(x, y, z) -> Map.unions
[ fromMaybe Map.empty x
, fromMaybe Map.empty y
, fromMaybe Map.empty z
])
extraDeps2
let sourceMap = Map.unions
[ Map.fromList $ flip map locals $ \lp ->
let p = lpPackage lp
in (packageName p, PSLocal lp)
, extraDeps3
, flip fmap (mbpPackages mbp) $ \mpi ->
(PSUpstream (mpiVersion mpi) Snap (mpiFlags mpi))
] `Map.difference` Map.fromList (map (, ()) (HashSet.toList wiredInPackages))
return (targets, mbp, locals, nonLocalTargets, sourceMap)
-- | Use the build options and environment to parse targets.
| 3,654
|
loadSourceMap :: (MonadIO m, MonadCatch m, MonadReader env m, HasBuildConfig env, MonadBaseControl IO m, HasHttpManager env, MonadLogger m, HasEnvConfig env)
=> NeedTargets
-> BuildOpts
-> m ( Map PackageName SimpleTarget
, MiniBuildPlan
, [LocalPackage]
, Set PackageName -- non-local targets
, SourceMap
)
loadSourceMap needTargets bopts = do
bconfig <- asks getBuildConfig
rawLocals <- getLocalPackageViews
(mbp0, cliExtraDeps, targets) <- parseTargetsFromBuildOpts needTargets bopts
menv <- getMinimalEnvOverride
caches <- getPackageCaches menv
let latestVersion = Map.fromListWith max $ map toTuple $ Map.keys caches
-- Extend extra-deps to encompass targets requested on the command line
-- that are not in the snapshot.
extraDeps0 <- extendExtraDeps
(bcExtraDeps bconfig)
cliExtraDeps
(Map.keysSet $ Map.filter (== STUnknown) targets)
latestVersion
locals <- mapM (loadLocalPackage bopts targets) $ Map.toList rawLocals
checkFlagsUsed bopts locals extraDeps0 (mbpPackages mbp0)
let
-- loadLocals returns PackageName (foo) and PackageIdentifier (bar-1.2.3) targets separately;
-- here we combine them into nonLocalTargets. This is one of the
-- return values of this function.
nonLocalTargets :: Set PackageName
nonLocalTargets =
Map.keysSet $ Map.filter (not . isLocal) targets
where
isLocal (STLocalComps _) = True
isLocal STLocalAll = True
isLocal STUnknown = False
isLocal STNonLocal = False
shadowed = Map.keysSet rawLocals <> Map.keysSet extraDeps0
(mbp, extraDeps1) = shadowMiniBuildPlan mbp0 shadowed
-- Add the extra deps from the stack.yaml file to the deps grabbed from
-- the snapshot
extraDeps2 = Map.union
(Map.map (\v -> (v, Map.empty)) extraDeps0)
(Map.map (\mpi -> (mpiVersion mpi, mpiFlags mpi)) extraDeps1)
-- Overwrite any flag settings with those from the config file
extraDeps3 = Map.mapWithKey
(\n (v, f) -> PSUpstream v Local $
case ( Map.lookup (Just n) $ boptsFlags bopts
, Map.lookup Nothing $ boptsFlags bopts
, Map.lookup n $ bcFlags bconfig
) of
-- Didn't have any flag overrides, fall back to the flags
-- defined in the snapshot.
(Nothing, Nothing, Nothing) -> f
-- Either command line flag for this package, general
-- command line flag, or flag in stack.yaml is defined.
-- Take all of those and ignore the snapshot flags.
(x, y, z) -> Map.unions
[ fromMaybe Map.empty x
, fromMaybe Map.empty y
, fromMaybe Map.empty z
])
extraDeps2
let sourceMap = Map.unions
[ Map.fromList $ flip map locals $ \lp ->
let p = lpPackage lp
in (packageName p, PSLocal lp)
, extraDeps3
, flip fmap (mbpPackages mbp) $ \mpi ->
(PSUpstream (mpiVersion mpi) Snap (mpiFlags mpi))
] `Map.difference` Map.fromList (map (, ()) (HashSet.toList wiredInPackages))
return (targets, mbp, locals, nonLocalTargets, sourceMap)
-- | Use the build options and environment to parse targets.
| 3,654
|
loadSourceMap needTargets bopts = do
bconfig <- asks getBuildConfig
rawLocals <- getLocalPackageViews
(mbp0, cliExtraDeps, targets) <- parseTargetsFromBuildOpts needTargets bopts
menv <- getMinimalEnvOverride
caches <- getPackageCaches menv
let latestVersion = Map.fromListWith max $ map toTuple $ Map.keys caches
-- Extend extra-deps to encompass targets requested on the command line
-- that are not in the snapshot.
extraDeps0 <- extendExtraDeps
(bcExtraDeps bconfig)
cliExtraDeps
(Map.keysSet $ Map.filter (== STUnknown) targets)
latestVersion
locals <- mapM (loadLocalPackage bopts targets) $ Map.toList rawLocals
checkFlagsUsed bopts locals extraDeps0 (mbpPackages mbp0)
let
-- loadLocals returns PackageName (foo) and PackageIdentifier (bar-1.2.3) targets separately;
-- here we combine them into nonLocalTargets. This is one of the
-- return values of this function.
nonLocalTargets :: Set PackageName
nonLocalTargets =
Map.keysSet $ Map.filter (not . isLocal) targets
where
isLocal (STLocalComps _) = True
isLocal STLocalAll = True
isLocal STUnknown = False
isLocal STNonLocal = False
shadowed = Map.keysSet rawLocals <> Map.keysSet extraDeps0
(mbp, extraDeps1) = shadowMiniBuildPlan mbp0 shadowed
-- Add the extra deps from the stack.yaml file to the deps grabbed from
-- the snapshot
extraDeps2 = Map.union
(Map.map (\v -> (v, Map.empty)) extraDeps0)
(Map.map (\mpi -> (mpiVersion mpi, mpiFlags mpi)) extraDeps1)
-- Overwrite any flag settings with those from the config file
extraDeps3 = Map.mapWithKey
(\n (v, f) -> PSUpstream v Local $
case ( Map.lookup (Just n) $ boptsFlags bopts
, Map.lookup Nothing $ boptsFlags bopts
, Map.lookup n $ bcFlags bconfig
) of
-- Didn't have any flag overrides, fall back to the flags
-- defined in the snapshot.
(Nothing, Nothing, Nothing) -> f
-- Either command line flag for this package, general
-- command line flag, or flag in stack.yaml is defined.
-- Take all of those and ignore the snapshot flags.
(x, y, z) -> Map.unions
[ fromMaybe Map.empty x
, fromMaybe Map.empty y
, fromMaybe Map.empty z
])
extraDeps2
let sourceMap = Map.unions
[ Map.fromList $ flip map locals $ \lp ->
let p = lpPackage lp
in (packageName p, PSLocal lp)
, extraDeps3
, flip fmap (mbpPackages mbp) $ \mpi ->
(PSUpstream (mpiVersion mpi) Snap (mpiFlags mpi))
] `Map.difference` Map.fromList (map (, ()) (HashSet.toList wiredInPackages))
return (targets, mbp, locals, nonLocalTargets, sourceMap)
-- | Use the build options and environment to parse targets.
| 3,209
| false
| true
| 0
| 20
| 1,270
| 800
| 410
| 390
| null | null |
lisphacker/codewars
|
Sudoku.hs
|
bsd-2-clause
|
boardToList board = [[value el | el <- row] | row <- rows board]
| 64
|
boardToList board = [[value el | el <- row] | row <- rows board]
| 64
|
boardToList board = [[value el | el <- row] | row <- rows board]
| 64
| false
| false
| 0
| 8
| 13
| 37
| 18
| 19
| null | null |
pauloborba/plc
|
src/ExpressoesLambdaComposicaoLazyness.hs
|
cc0-1.0
|
av (x,op,y) = avOp op x y
| 25
|
av (x,op,y) = avOp op x y
| 25
|
av (x,op,y) = avOp op x y
| 25
| false
| false
| 0
| 6
| 6
| 25
| 13
| 12
| null | null |
DougBurke/swish
|
tests/RDFQueryTest.hs
|
lgpl-2.1
|
vbss01e = -- ?c is typed literal
[ makeVarBinding [ (v_a,u_s), (v_b,u_p), (v_c,l_3) ]
, makeVarBinding [ (v_a,u_s), (v_b,u_p), (v_c,l_4) ]
, makeVarBinding [ (v_a,b_3), (v_b,u_p), (v_c,l_5) ]
]
| 226
|
vbss01e = -- ?c is typed literal
[ makeVarBinding [ (v_a,u_s), (v_b,u_p), (v_c,l_3) ]
, makeVarBinding [ (v_a,u_s), (v_b,u_p), (v_c,l_4) ]
, makeVarBinding [ (v_a,b_3), (v_b,u_p), (v_c,l_5) ]
]
| 226
|
vbss01e = -- ?c is typed literal
[ makeVarBinding [ (v_a,u_s), (v_b,u_p), (v_c,l_3) ]
, makeVarBinding [ (v_a,u_s), (v_b,u_p), (v_c,l_4) ]
, makeVarBinding [ (v_a,b_3), (v_b,u_p), (v_c,l_5) ]
]
| 226
| false
| false
| 1
| 9
| 61
| 110
| 67
| 43
| null | null |
ghc-android/ghc
|
compiler/typecheck/TcRnTypes.hs
|
bsd-3-clause
|
-- and type constraints here
topStage, topAnnStage, topSpliceStage :: ThStage
topStage = Comp
| 104
|
topStage, topAnnStage, topSpliceStage :: ThStage
topStage = Comp
| 70
|
topStage = Comp
| 21
| true
| true
| 4
| 6
| 23
| 31
| 12
| 19
| null | null |
rhofour/PlayingAtari
|
src/RandomAgent.hs
|
apache-2.0
|
generateDoubleAction (_, UpBound upper) = randomRIO (upper - 10*abs upper, upper)
| 81
|
generateDoubleAction (_, UpBound upper) = randomRIO (upper - 10*abs upper, upper)
| 81
|
generateDoubleAction (_, UpBound upper) = randomRIO (upper - 10*abs upper, upper)
| 81
| false
| false
| 0
| 8
| 10
| 38
| 19
| 19
| null | null |
sebastian-philipp/r-tree
|
test/RTreeStrict.hs
|
mit
|
-- smart constructor for evaluation into NF
-- before calling the constructor A
mkA :: [Int] -> Attr
mkA xs = A $!! xs
| 119
|
mkA :: [Int] -> Attr
mkA xs = A $!! xs
| 38
|
mkA xs = A $!! xs
| 17
| true
| true
| 0
| 7
| 24
| 33
| 16
| 17
| null | null |
brendanhay/gogol
|
gogol-drive/gen/Network/Google/Drive/Types/Product.hs
|
mpl-2.0
|
-- | ID of the shared drive the file resides in. Only populated for items in
-- shared drives.
fDriveId :: Lens' File (Maybe Text)
fDriveId = lens _fDriveId (\ s a -> s{_fDriveId = a})
| 184
|
fDriveId :: Lens' File (Maybe Text)
fDriveId = lens _fDriveId (\ s a -> s{_fDriveId = a})
| 89
|
fDriveId = lens _fDriveId (\ s a -> s{_fDriveId = a})
| 53
| true
| true
| 0
| 9
| 35
| 47
| 26
| 21
| null | null |
bananu7/Hate
|
samples/sample_spritesheet.hs
|
mit
|
generateKoala :: Int -> IO Koala
generateKoala i = do
let px = 128 * (fromIntegral $ i `div` 5)
let py = 128 * (fromIntegral $ i `mod` 5)
n <- getStdRandom $ randomR (0 :: Int,3)
return $ Koala (Vec2 px py) n
| 231
|
generateKoala :: Int -> IO Koala
generateKoala i = do
let px = 128 * (fromIntegral $ i `div` 5)
let py = 128 * (fromIntegral $ i `mod` 5)
n <- getStdRandom $ randomR (0 :: Int,3)
return $ Koala (Vec2 px py) n
| 230
|
generateKoala i = do
let px = 128 * (fromIntegral $ i `div` 5)
let py = 128 * (fromIntegral $ i `mod` 5)
n <- getStdRandom $ randomR (0 :: Int,3)
return $ Koala (Vec2 px py) n
| 197
| false
| true
| 0
| 13
| 67
| 116
| 59
| 57
| null | null |
gcampax/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
mkTyConName = varQual tYPEABLE_INTERNAL (fsLit "mkTyCon") mkTyConKey
| 85
|
mkTyConName = varQual tYPEABLE_INTERNAL (fsLit "mkTyCon") mkTyConKey
| 85
|
mkTyConName = varQual tYPEABLE_INTERNAL (fsLit "mkTyCon") mkTyConKey
| 85
| false
| false
| 0
| 7
| 23
| 19
| 9
| 10
| null | null |
Kyly/liquidhaskell
|
src/Language/Haskell/Liquid/RefType.hs
|
bsd-3-clause
|
nlzP ps t@(RRTy _ _ _ t')
= (t, ps ++ ps')
where ps' = snd $ nlzP [] t'
| 73
|
nlzP ps t@(RRTy _ _ _ t')
= (t, ps ++ ps')
where ps' = snd $ nlzP [] t'
| 73
|
nlzP ps t@(RRTy _ _ _ t')
= (t, ps ++ ps')
where ps' = snd $ nlzP [] t'
| 73
| false
| false
| 0
| 7
| 21
| 57
| 28
| 29
| null | null |
rueshyna/gogol
|
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
|
mpl-2.0
|
-- | The ID of the request entry this entry responds to.
pcbreBatchId :: Lens' ProductstatusesCustomBatchResponseEntry (Maybe Word32)
pcbreBatchId
= lens _pcbreBatchId (\ s a -> s{_pcbreBatchId = a})
. mapping _Coerce
| 225
|
pcbreBatchId :: Lens' ProductstatusesCustomBatchResponseEntry (Maybe Word32)
pcbreBatchId
= lens _pcbreBatchId (\ s a -> s{_pcbreBatchId = a})
. mapping _Coerce
| 168
|
pcbreBatchId
= lens _pcbreBatchId (\ s a -> s{_pcbreBatchId = a})
. mapping _Coerce
| 91
| true
| true
| 1
| 9
| 39
| 56
| 28
| 28
| null | null |
cdornan/keystore
|
src/Data/KeyStore/KS/Crypto.hs
|
bsd-3-clause
|
randomAESKeyKS :: Cipher -> KS AESKey
randomAESKeyKS cip = randomBytes (keyWidth cip) (AESKey . Binary)
| 103
|
randomAESKeyKS :: Cipher -> KS AESKey
randomAESKeyKS cip = randomBytes (keyWidth cip) (AESKey . Binary)
| 103
|
randomAESKeyKS cip = randomBytes (keyWidth cip) (AESKey . Binary)
| 65
| false
| true
| 0
| 7
| 14
| 39
| 19
| 20
| null | null |
keithodulaigh/Hets
|
OMDoc/OMDocInterface.hs
|
gpl-2.0
|
mkOMBWordsE :: [Word.Word8] -> OMElement
mkOMBWordsE = toElement . mkOMBWords
| 77
|
mkOMBWordsE :: [Word.Word8] -> OMElement
mkOMBWordsE = toElement . mkOMBWords
| 77
|
mkOMBWordsE = toElement . mkOMBWords
| 36
| false
| true
| 1
| 8
| 9
| 32
| 14
| 18
| null | null |
HJvT/hdirect
|
src/Parser.hs
|
bsd-3-clause
|
happyReduction_315 _
= HappyAbsSyn98
(Attrib (Id "default") []
)
| 99
|
happyReduction_315 _
= HappyAbsSyn98
(Attrib (Id "default") []
)
| 99
|
happyReduction_315 _
= HappyAbsSyn98
(Attrib (Id "default") []
)
| 99
| false
| false
| 0
| 9
| 43
| 28
| 13
| 15
| null | null |
gafiatulin/codewars
|
src/8 kyu/CountPosSumNeg.hs
|
mit
|
countPositivesSumNegatives (Just []) = []
| 41
|
countPositivesSumNegatives (Just []) = []
| 41
|
countPositivesSumNegatives (Just []) = []
| 41
| false
| false
| 0
| 8
| 4
| 19
| 9
| 10
| null | null |
green-haskell/ghc
|
libraries/template-haskell/Language/Haskell/TH/Ppr.hs
|
bsd-3-clause
|
pprLit _ (StringPrimL s) = pprString (bytesToString s) <> char '#'
| 66
|
pprLit _ (StringPrimL s) = pprString (bytesToString s) <> char '#'
| 66
|
pprLit _ (StringPrimL s) = pprString (bytesToString s) <> char '#'
| 66
| false
| false
| 0
| 8
| 10
| 33
| 15
| 18
| null | null |
pbogdan/react-flux-mui
|
react-flux-mui/src/React/Flux/Mui/Tabs/Tab.hs
|
bsd-3-clause
|
defTab :: Tab
defTab = Tab {tabClassName = Nothing, tabSelected = Nothing, tabWidth = Nothing}
| 94
|
defTab :: Tab
defTab = Tab {tabClassName = Nothing, tabSelected = Nothing, tabWidth = Nothing}
| 94
|
defTab = Tab {tabClassName = Nothing, tabSelected = Nothing, tabWidth = Nothing}
| 80
| false
| true
| 0
| 6
| 14
| 31
| 19
| 12
| null | null |
b1g3ar5/Spreadsheet
|
SpreadsheetTest.hs
|
mit
|
printFSheet :: Sheet (Fix Cell) -> IO ()
printFSheet ss =
forM_ [0..4] $ \i -> do
forM_ [0..4] $ \j ->
printf "%s " (show $ ss ! (fromCoords (i,j)))
printf "\n"
| 210
|
printFSheet :: Sheet (Fix Cell) -> IO ()
printFSheet ss =
forM_ [0..4] $ \i -> do
forM_ [0..4] $ \j ->
printf "%s " (show $ ss ! (fromCoords (i,j)))
printf "\n"
| 210
|
printFSheet ss =
forM_ [0..4] $ \i -> do
forM_ [0..4] $ \j ->
printf "%s " (show $ ss ! (fromCoords (i,j)))
printf "\n"
| 169
| false
| true
| 0
| 16
| 82
| 103
| 51
| 52
| null | null |
venkat24/codeworld
|
codeworld-server/src/Util.hs
|
apache-2.0
|
sourceToDeployId :: ByteString -> DeployId
sourceToDeployId = DeployId . hashToId "D" . ("DEPLOY_ID" <>)
| 104
|
sourceToDeployId :: ByteString -> DeployId
sourceToDeployId = DeployId . hashToId "D" . ("DEPLOY_ID" <>)
| 104
|
sourceToDeployId = DeployId . hashToId "D" . ("DEPLOY_ID" <>)
| 61
| false
| true
| 1
| 7
| 13
| 38
| 17
| 21
| null | null |
kadena-io/pact
|
src-tool/Pact/Analyze/Util.hs
|
bsd-3-clause
|
infoToParsed :: Info -> Parsed
infoToParsed parsed = case _iInfo parsed of
Nothing -> dummyParsed
Just (_code, parsed') -> parsed'
-- | A 'Parsed' for when there is no location info available.
| 211
|
infoToParsed :: Info -> Parsed
infoToParsed parsed = case _iInfo parsed of
Nothing -> dummyParsed
Just (_code, parsed') -> parsed'
-- | A 'Parsed' for when there is no location info available.
| 211
|
infoToParsed parsed = case _iInfo parsed of
Nothing -> dummyParsed
Just (_code, parsed') -> parsed'
-- | A 'Parsed' for when there is no location info available.
| 180
| false
| true
| 0
| 9
| 50
| 47
| 24
| 23
| null | null |
glguy/irc-core
|
src/Client/Image/MircFormatting.hs
|
isc
|
plainText xs =
case break isControl xs of
(first, "" ) -> I.string defAttr first
(first, cntl:rest) -> I.string defAttr first <>
controlImage cntl <>
plainText rest
| 232
|
plainText xs =
case break isControl xs of
(first, "" ) -> I.string defAttr first
(first, cntl:rest) -> I.string defAttr first <>
controlImage cntl <>
plainText rest
| 232
|
plainText xs =
case break isControl xs of
(first, "" ) -> I.string defAttr first
(first, cntl:rest) -> I.string defAttr first <>
controlImage cntl <>
plainText rest
| 232
| false
| false
| 0
| 11
| 94
| 74
| 36
| 38
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/Types/OptCoercion.hs
|
bsd-3-clause
|
opt_trans_rule _ _ _ = Nothing
| 30
|
opt_trans_rule _ _ _ = Nothing
| 30
|
opt_trans_rule _ _ _ = Nothing
| 30
| false
| false
| 0
| 5
| 5
| 13
| 6
| 7
| null | null |
ssaavedra/liquidhaskell
|
benchmarks/llrbtree-0.1.1/Data/Heap/Binominal.hs
|
bsd-3-clause
|
toList' (Node _ x ts) = x : concatMap toList' ts
| 48
|
toList' (Node _ x ts) = x : concatMap toList' ts
| 48
|
toList' (Node _ x ts) = x : concatMap toList' ts
| 48
| false
| false
| 0
| 7
| 10
| 28
| 13
| 15
| null | null |
joelburget/haste-compiler
|
src/Haste/Config.hs
|
bsd-3-clause
|
-- | Fast but unsafe Int multiplication.
fastMultiply :: AST Exp -> AST Exp -> AST Exp
fastMultiply = binOp Mul
| 111
|
fastMultiply :: AST Exp -> AST Exp -> AST Exp
fastMultiply = binOp Mul
| 70
|
fastMultiply = binOp Mul
| 24
| true
| true
| 0
| 7
| 20
| 32
| 15
| 17
| null | null |
vikraman/ghc
|
compiler/types/Coercion.hs
|
bsd-3-clause
|
ppr_co p (UnivCo UnsafeCoerceProv r ty1 ty2)
= pprPrefixApp p (text "UnsafeCo" <+> ppr r)
[pprParendType ty1, pprParendType ty2]
| 149
|
ppr_co p (UnivCo UnsafeCoerceProv r ty1 ty2)
= pprPrefixApp p (text "UnsafeCo" <+> ppr r)
[pprParendType ty1, pprParendType ty2]
| 149
|
ppr_co p (UnivCo UnsafeCoerceProv r ty1 ty2)
= pprPrefixApp p (text "UnsafeCo" <+> ppr r)
[pprParendType ty1, pprParendType ty2]
| 149
| false
| false
| 0
| 8
| 39
| 55
| 26
| 29
| null | null |
oldmanmike/ghc
|
compiler/deSugar/DsBinds.hs
|
bsd-3-clause
|
ds_ev_typeable ty (EvTypeableTyApp ev1 ev2)
| Just (t1,t2) <- splitAppTy_maybe ty
= do { e1 <- getRep ev1 t1
; e2 <- getRep ev2 t2
; ctr <- dsLookupGlobalId mkAppTyName
; return ( mkApps (Var ctr) [ e1, e2 ] ) }
| 238
|
ds_ev_typeable ty (EvTypeableTyApp ev1 ev2)
| Just (t1,t2) <- splitAppTy_maybe ty
= do { e1 <- getRep ev1 t1
; e2 <- getRep ev2 t2
; ctr <- dsLookupGlobalId mkAppTyName
; return ( mkApps (Var ctr) [ e1, e2 ] ) }
| 238
|
ds_ev_typeable ty (EvTypeableTyApp ev1 ev2)
| Just (t1,t2) <- splitAppTy_maybe ty
= do { e1 <- getRep ev1 t1
; e2 <- getRep ev2 t2
; ctr <- dsLookupGlobalId mkAppTyName
; return ( mkApps (Var ctr) [ e1, e2 ] ) }
| 238
| false
| false
| 0
| 12
| 68
| 106
| 51
| 55
| null | null |
ekmett/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxSTC_CP_DBCS :: Int
wxSTC_CP_DBCS = 1
| 38
|
wxSTC_CP_DBCS :: Int
wxSTC_CP_DBCS = 1
| 38
|
wxSTC_CP_DBCS = 1
| 17
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
robstewart57/hdph-rs
|
src/Test/HdpH/summatory-liouville.hs
|
bsd-3-clause
|
initrand :: Int -> IO ()
initrand seed =
when (seed /= 0) $
setStdGen (mkStdGen seed)
| 91
|
initrand :: Int -> IO ()
initrand seed =
when (seed /= 0) $
setStdGen (mkStdGen seed)
| 91
|
initrand seed =
when (seed /= 0) $
setStdGen (mkStdGen seed)
| 66
| false
| true
| 0
| 8
| 22
| 46
| 22
| 24
| null | null |
LambdaHack/LambdaHack
|
engine-src/Game/LambdaHack/Client/UI/MonadClientUI.hs
|
bsd-3-clause
|
computeChosenLore :: MonadClientUI m
=> m ([(ActorId, Actor)], [(ItemId, ItemQuant)])
computeChosenLore = do
side <- getsClient sside
xhairPos <- xhairToPos
lidV <- viewedLevelUI
let isOurs (_, b) = bfid b == side
inhabitants0 <- getsState $ filter (not . isOurs)
. posToAidAssocs xhairPos lidV
embeds0 <- getsState $ EM.assocs . getEmbedBag lidV xhairPos
return (inhabitants0, embeds0)
| 448
|
computeChosenLore :: MonadClientUI m
=> m ([(ActorId, Actor)], [(ItemId, ItemQuant)])
computeChosenLore = do
side <- getsClient sside
xhairPos <- xhairToPos
lidV <- viewedLevelUI
let isOurs (_, b) = bfid b == side
inhabitants0 <- getsState $ filter (not . isOurs)
. posToAidAssocs xhairPos lidV
embeds0 <- getsState $ EM.assocs . getEmbedBag lidV xhairPos
return (inhabitants0, embeds0)
| 448
|
computeChosenLore = do
side <- getsClient sside
xhairPos <- xhairToPos
lidV <- viewedLevelUI
let isOurs (_, b) = bfid b == side
inhabitants0 <- getsState $ filter (not . isOurs)
. posToAidAssocs xhairPos lidV
embeds0 <- getsState $ EM.assocs . getEmbedBag lidV xhairPos
return (inhabitants0, embeds0)
| 344
| false
| true
| 0
| 12
| 117
| 158
| 78
| 80
| null | null |
zeyuanxy/haskell-playground
|
write-yourself-a-scheme/chap6/main.hs
|
mit
|
showVal :: LispVal -> String
showVal (String contents) = "\"" ++ contents ++ "\""
| 81
|
showVal :: LispVal -> String
showVal (String contents) = "\"" ++ contents ++ "\""
| 81
|
showVal (String contents) = "\"" ++ contents ++ "\""
| 52
| false
| true
| 0
| 7
| 13
| 32
| 16
| 16
| null | null |
rodrigogribeiro/mptc
|
src/Tc/TcClassInstGen.hs
|
bsd-3-clause
|
isTypeSig _ = False
| 19
|
isTypeSig _ = False
| 19
|
isTypeSig _ = False
| 19
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
green-haskell/ghc
|
compiler/basicTypes/Module.hs
|
bsd-3-clause
|
moduleNameColons :: ModuleName -> String
moduleNameColons = dots_to_colons . moduleNameString
where dots_to_colons = map (\c -> if c == '.' then ':' else c)
{-
************************************************************************
* *
\subsection{A fully qualified module}
* *
************************************************************************
-}
-- | A Module is a pair of a 'PackageKey' and a 'ModuleName'.
| 558
|
moduleNameColons :: ModuleName -> String
moduleNameColons = dots_to_colons . moduleNameString
where dots_to_colons = map (\c -> if c == '.' then ':' else c)
{-
************************************************************************
* *
\subsection{A fully qualified module}
* *
************************************************************************
-}
-- | A Module is a pair of a 'PackageKey' and a 'ModuleName'.
| 558
|
moduleNameColons = dots_to_colons . moduleNameString
where dots_to_colons = map (\c -> if c == '.' then ':' else c)
{-
************************************************************************
* *
\subsection{A fully qualified module}
* *
************************************************************************
-}
-- | A Module is a pair of a 'PackageKey' and a 'ModuleName'.
| 517
| false
| true
| 0
| 9
| 190
| 52
| 29
| 23
| null | null |
pranjaltale16/codeworld
|
codeworld-compiler/src/CodeWorld/Compile/Requirements/Matcher.hs
|
apache-2.0
|
structuralEq :: (Data a, Data b) => a -> b -> Bool
structuralEq x y = toConstr x == toConstr y && and (gzipWithQ matchQ x y)
| 124
|
structuralEq :: (Data a, Data b) => a -> b -> Bool
structuralEq x y = toConstr x == toConstr y && and (gzipWithQ matchQ x y)
| 124
|
structuralEq x y = toConstr x == toConstr y && and (gzipWithQ matchQ x y)
| 73
| false
| true
| 0
| 8
| 26
| 66
| 32
| 34
| null | null |
nevrenato/HetsAlloy
|
Comorphisms/SuleCFOL2SoftFOL.hs
|
gpl-2.0
|
-- | specialized lookup for IdTypeSPIdMap
lookupSPId :: Id -> CType -> IdTypeSPIdMap ->
Maybe SPIdentifier
lookupSPId i t = maybe Nothing (Map.lookup t) . Map.lookup i
| 177
|
lookupSPId :: Id -> CType -> IdTypeSPIdMap ->
Maybe SPIdentifier
lookupSPId i t = maybe Nothing (Map.lookup t) . Map.lookup i
| 135
|
lookupSPId i t = maybe Nothing (Map.lookup t) . Map.lookup i
| 60
| true
| true
| 0
| 9
| 36
| 54
| 26
| 28
| null | null |
ekmett/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
setDepIncludePkgDeps :: Bool -> DynFlags -> DynFlags
setDepIncludePkgDeps b d = d { depIncludePkgDeps = b }
| 107
|
setDepIncludePkgDeps :: Bool -> DynFlags -> DynFlags
setDepIncludePkgDeps b d = d { depIncludePkgDeps = b }
| 107
|
setDepIncludePkgDeps b d = d { depIncludePkgDeps = b }
| 54
| false
| true
| 0
| 8
| 16
| 41
| 19
| 22
| null | null |
nkaretnikov/ghc
|
compiler/utils/Outputable.hs
|
bsd-3-clause
|
warnPprTrace _ _file _line _msg x | opt_NoDebugOutput = x
| 61
|
warnPprTrace _ _file _line _msg x | opt_NoDebugOutput = x
| 61
|
warnPprTrace _ _file _line _msg x | opt_NoDebugOutput = x
| 61
| false
| false
| 0
| 7
| 13
| 23
| 10
| 13
| null | null |
CulpaBS/wbBach
|
src/Futhark/Pass/ExplicitAllocations.hs
|
bsd-3-clause
|
arraySizeInBytes :: Allocator m => Type -> m SubExp
arraySizeInBytes = computeSize "bytes" <=< arraySizeInBytesExpM
| 115
|
arraySizeInBytes :: Allocator m => Type -> m SubExp
arraySizeInBytes = computeSize "bytes" <=< arraySizeInBytesExpM
| 115
|
arraySizeInBytes = computeSize "bytes" <=< arraySizeInBytesExpM
| 63
| false
| true
| 0
| 8
| 14
| 38
| 16
| 22
| null | null |
rnons/ted2srt
|
backend/src/Web/TED/TalkPage.hs
|
bsd-3-clause
|
parseId :: ByteString -> Int
parseId body = read $ L8.unpack $ last $ last r
where
pat = "id\":\"([^,]+)\",\"mediaIdentifier" :: ByteString
r = body =~ pat :: [[ByteString]]
| 183
|
parseId :: ByteString -> Int
parseId body = read $ L8.unpack $ last $ last r
where
pat = "id\":\"([^,]+)\",\"mediaIdentifier" :: ByteString
r = body =~ pat :: [[ByteString]]
| 183
|
parseId body = read $ L8.unpack $ last $ last r
where
pat = "id\":\"([^,]+)\",\"mediaIdentifier" :: ByteString
r = body =~ pat :: [[ByteString]]
| 154
| false
| true
| 5
| 8
| 38
| 68
| 35
| 33
| null | null |
ryanplusplus/seven-languages-in-seven-weeks
|
haskell/day2/sort_list.hs
|
mit
|
sortList xs = minx:(sortList (delete minx xs))
where minx = minimum xs
| 74
|
sortList xs = minx:(sortList (delete minx xs))
where minx = minimum xs
| 74
|
sortList xs = minx:(sortList (delete minx xs))
where minx = minimum xs
| 74
| false
| false
| 0
| 9
| 15
| 38
| 18
| 20
| null | null |
rahulmutt/ghcvm
|
libraries/eta-meta/Language/Eta/Meta/Lib.hs
|
bsd-3-clause
|
pragSpecInlD :: Name -> TypeQ -> Inline -> Phases -> DecQ
pragSpecInlD n ty inline phases
= do
ty1 <- ty
return $ PragmaD $ SpecialiseP n ty1 (Just inline) phases
| 179
|
pragSpecInlD :: Name -> TypeQ -> Inline -> Phases -> DecQ
pragSpecInlD n ty inline phases
= do
ty1 <- ty
return $ PragmaD $ SpecialiseP n ty1 (Just inline) phases
| 179
|
pragSpecInlD n ty inline phases
= do
ty1 <- ty
return $ PragmaD $ SpecialiseP n ty1 (Just inline) phases
| 121
| false
| true
| 0
| 10
| 47
| 69
| 33
| 36
| null | null |
iambernie/tryhaskell
|
MyData.hs
|
mit
|
symbol :: MetricUnit -> String
symbol x
| x == Meter = "m"
| x == Liter = "L"
| x == KiloGram = "kg"
| 112
|
symbol :: MetricUnit -> String
symbol x
| x == Meter = "m"
| x == Liter = "L"
| x == KiloGram = "kg"
| 112
|
symbol x
| x == Meter = "m"
| x == Liter = "L"
| x == KiloGram = "kg"
| 81
| false
| true
| 0
| 8
| 36
| 54
| 25
| 29
| null | null |
DanielWaterworth/Idris-dev
|
src/Idris/DSL.hs
|
bsd-3-clause
|
unIdiom :: PTerm -> PTerm -> FC -> PTerm -> PTerm
unIdiom ap pure fc e@(PApp _ _ _) = let f = getFn e in
mkap (getFn e)
where
getFn (PApp fc f args) = (PApp fc pure [pexp f], args)
getFn f = (f, [])
mkap (f, []) = f
mkap (f, a:as) = mkap (PApp fc ap [pexp f, a], as)
| 327
|
unIdiom :: PTerm -> PTerm -> FC -> PTerm -> PTerm
unIdiom ap pure fc e@(PApp _ _ _) = let f = getFn e in
mkap (getFn e)
where
getFn (PApp fc f args) = (PApp fc pure [pexp f], args)
getFn f = (f, [])
mkap (f, []) = f
mkap (f, a:as) = mkap (PApp fc ap [pexp f, a], as)
| 327
|
unIdiom ap pure fc e@(PApp _ _ _) = let f = getFn e in
mkap (getFn e)
where
getFn (PApp fc f args) = (PApp fc pure [pexp f], args)
getFn f = (f, [])
mkap (f, []) = f
mkap (f, a:as) = mkap (PApp fc ap [pexp f, a], as)
| 277
| false
| true
| 8
| 9
| 124
| 183
| 97
| 86
| null | null |
adp-multi/adp-multi
|
tests/ADP/Tests/RGExample.hs
|
bsd-3-clause
|
-- with consistency checks
enumDebug :: RG_Algebra Char Start
enumDebug = (nil,left,pair,knot,knot1,knot2,basepair,base,h) where
s' = [Nil, Left'{}, Pair{}, Knot{}]
k' = [Knot1 {}, Knot2 {}]
nil _ = Nil
left b@(Base _) s
| s `isOf` s' = Left' b s
pair p@(BasePair _) s1 s2
| [s1,s2] `areOf` s' = Pair p s1 s2
knot k1 k2 s1 s2 s3 s4
| [k1,k2] `areOf` k' && [s1,s2,s3,s4] `areOf` s' = Knot k1 k2 s1 s2 s3 s4
knot1 p@(BasePair _) k
| k `isOf` k' = Knot1 p k
knot2 p@(BasePair _) = Knot2 p
basepair = BasePair
base = Base
h = id
isOf l r = toConstr l `elem` map toConstr r
areOf l r = all (`isOf` r) l
| 763
|
enumDebug :: RG_Algebra Char Start
enumDebug = (nil,left,pair,knot,knot1,knot2,basepair,base,h) where
s' = [Nil, Left'{}, Pair{}, Knot{}]
k' = [Knot1 {}, Knot2 {}]
nil _ = Nil
left b@(Base _) s
| s `isOf` s' = Left' b s
pair p@(BasePair _) s1 s2
| [s1,s2] `areOf` s' = Pair p s1 s2
knot k1 k2 s1 s2 s3 s4
| [k1,k2] `areOf` k' && [s1,s2,s3,s4] `areOf` s' = Knot k1 k2 s1 s2 s3 s4
knot1 p@(BasePair _) k
| k `isOf` k' = Knot1 p k
knot2 p@(BasePair _) = Knot2 p
basepair = BasePair
base = Base
h = id
isOf l r = toConstr l `elem` map toConstr r
areOf l r = all (`isOf` r) l
| 736
|
enumDebug = (nil,left,pair,knot,knot1,knot2,basepair,base,h) where
s' = [Nil, Left'{}, Pair{}, Knot{}]
k' = [Knot1 {}, Knot2 {}]
nil _ = Nil
left b@(Base _) s
| s `isOf` s' = Left' b s
pair p@(BasePair _) s1 s2
| [s1,s2] `areOf` s' = Pair p s1 s2
knot k1 k2 s1 s2 s3 s4
| [k1,k2] `areOf` k' && [s1,s2,s3,s4] `areOf` s' = Knot k1 k2 s1 s2 s3 s4
knot1 p@(BasePair _) k
| k `isOf` k' = Knot1 p k
knot2 p@(BasePair _) = Knot2 p
basepair = BasePair
base = Base
h = id
isOf l r = toConstr l `elem` map toConstr r
areOf l r = all (`isOf` r) l
| 701
| true
| true
| 0
| 13
| 288
| 376
| 207
| 169
| null | null |
takoeight0821/malgo
|
src/Koriel/Core/Flat.hs
|
bsd-3-clause
|
flatExp (Match v (Unpack con ps e :| [])) = do
v <- flatExp v
tell $ Endo $ \k -> Match v (Unpack con ps k :| [])
flatExp e
| 129
|
flatExp (Match v (Unpack con ps e :| [])) = do
v <- flatExp v
tell $ Endo $ \k -> Match v (Unpack con ps k :| [])
flatExp e
| 129
|
flatExp (Match v (Unpack con ps e :| [])) = do
v <- flatExp v
tell $ Endo $ \k -> Match v (Unpack con ps k :| [])
flatExp e
| 129
| false
| false
| 0
| 12
| 36
| 87
| 40
| 47
| null | null |
tomberek/rulestesting
|
src/Control/Arrow/CCA/AExp.hs
|
bsd-3-clause
|
lft :: (t -> a) -> Either t b -> Either a b
lft f x = case x of
Left u -> Left (f u)
Right u -> Right u
| 108
|
lft :: (t -> a) -> Either t b -> Either a b
lft f x = case x of
Left u -> Left (f u)
Right u -> Right u
| 108
|
lft f x = case x of
Left u -> Left (f u)
Right u -> Right u
| 64
| false
| true
| 0
| 10
| 35
| 79
| 36
| 43
| null | null |
tavisrudd/ghcjs-base
|
JavaScript/TypedArray/DataView.hs
|
mit
|
unsafeGetInt8 idx dv = I.js_i_unsafeGetInt8 idx dv
| 50
|
unsafeGetInt8 idx dv = I.js_i_unsafeGetInt8 idx dv
| 50
|
unsafeGetInt8 idx dv = I.js_i_unsafeGetInt8 idx dv
| 50
| false
| false
| 0
| 6
| 6
| 19
| 8
| 11
| null | null |
seereason/ghcjs
|
src/Gen2/Prim.hs
|
mit
|
genPrim d t CopyMutableByteArrayOp [] xs@[_a1,_o1,_a2,_o2,_n] = genPrim d t CopyByteArrayOp [] xs
| 97
|
genPrim d t CopyMutableByteArrayOp [] xs@[_a1,_o1,_a2,_o2,_n] = genPrim d t CopyByteArrayOp [] xs
| 97
|
genPrim d t CopyMutableByteArrayOp [] xs@[_a1,_o1,_a2,_o2,_n] = genPrim d t CopyByteArrayOp [] xs
| 97
| false
| false
| 0
| 7
| 12
| 50
| 27
| 23
| null | null |
ruud-v-a/hakyll
|
src/Hakyll/Web/Feed.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------------
-- | Copies @$updated$@ from @$published$@ if it is not already set.
makeItemContext :: String -> Context a -> Context a
makeItemContext fmt context = mconcat
[dateField "published" fmt, context, dateField "updated" fmt]
| 305
|
makeItemContext :: String -> Context a -> Context a
makeItemContext fmt context = mconcat
[dateField "published" fmt, context, dateField "updated" fmt]
| 155
|
makeItemContext fmt context = mconcat
[dateField "published" fmt, context, dateField "updated" fmt]
| 103
| true
| true
| 0
| 7
| 37
| 54
| 27
| 27
| null | null |
RossMeikleham/Idris-dev
|
src/IRTS/CodegenC.hs
|
bsd-3-clause
|
doOp v (LSLe (ATInt ITBig)) [l, r] = v ++ "idris_bigLe(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
| 95
|
doOp v (LSLe (ATInt ITBig)) [l, r] = v ++ "idris_bigLe(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
| 95
|
doOp v (LSLe (ATInt ITBig)) [l, r] = v ++ "idris_bigLe(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
| 95
| false
| false
| 0
| 9
| 22
| 57
| 28
| 29
| null | null |
yav/monadlib
|
src/MonadLib/Derive.hs
|
mit
|
-- | Derive the implementation of 'return' from 'Monad'.
derive_return :: (Monad m) => Iso m n -> (a -> n a)
derive_return iso a = close iso (return a)
| 151
|
derive_return :: (Monad m) => Iso m n -> (a -> n a)
derive_return iso a = close iso (return a)
| 94
|
derive_return iso a = close iso (return a)
| 42
| true
| true
| 0
| 9
| 29
| 56
| 28
| 28
| null | null |
kim/amazonka
|
amazonka-ec2/gen/Network/AWS/EC2/Types.hs
|
mpl-2.0
|
-- | One or more filter values. Filter values are case-sensitive.
fValues :: Lens' Filter [Text]
fValues = lens _fValues (\s a -> s { _fValues = a }) . _List
| 157
|
fValues :: Lens' Filter [Text]
fValues = lens _fValues (\s a -> s { _fValues = a }) . _List
| 91
|
fValues = lens _fValues (\s a -> s { _fValues = a }) . _List
| 60
| true
| true
| 0
| 9
| 30
| 54
| 27
| 27
| null | null |
DavidAlphaFox/ghc
|
compiler/simplCore/SimplUtils.hs
|
bsd-3-clause
|
updModeForStableUnfoldings :: Activation -> SimplifierMode -> SimplifierMode
-- See Note [Simplifying inside stable unfoldings]
updModeForStableUnfoldings inline_rule_act current_mode
= current_mode { sm_phase = phaseFromActivation inline_rule_act
, sm_inline = True
, sm_eta_expand = False }
-- For sm_rules, just inherit; sm_rules might be "off"
-- because of -fno-enable-rewrite-rules
where
phaseFromActivation (ActiveAfter n) = Phase n
phaseFromActivation _ = InitialPhase
{-
Note [Inlining in gentle mode]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Something is inlined if
(i) the sm_inline flag is on, AND
(ii) the thing has an INLINE pragma, AND
(iii) the thing is inlinable in the earliest phase.
Example of why (iii) is important:
{-# INLINE [~1] g #-}
g = ...
{-# INLINE f #-}
f x = g (g x)
If we were to inline g into f's inlining, then an importing module would
never be able to do
f e --> g (g e) ---> RULE fires
because the stable unfolding for f has had g inlined into it.
On the other hand, it is bad not to do ANY inlining into an
stable unfolding, because then recursive knots in instance declarations
don't get unravelled.
However, *sometimes* SimplGently must do no call-site inlining at all
(hence sm_inline = False). Before full laziness we must be careful
not to inline wrappers, because doing so inhibits floating
e.g. ...(case f x of ...)...
==> ...(case (case x of I# x# -> fw x#) of ...)...
==> ...(case x of I# x# -> case fw x# of ...)...
and now the redex (f x) isn't floatable any more.
The no-inlining thing is also important for Template Haskell. You might be
compiling in one-shot mode with -O2; but when TH compiles a splice before
running it, we don't want to use -O2. Indeed, we don't want to inline
anything, because the byte-code interpreter might get confused about
unboxed tuples and suchlike.
Note [Simplifying inside stable unfoldings]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We must take care with simplification inside stable unfoldings (which come from
INLINE pragmas).
First, consider the following example
let f = \pq -> BIG
in
let g = \y -> f y y
{-# INLINE g #-}
in ...g...g...g...g...g...
Now, if that's the ONLY occurrence of f, it might be inlined inside g,
and thence copied multiple times when g is inlined. HENCE we treat
any occurrence in a stable unfolding as a multiple occurrence, not a single
one; see OccurAnal.addRuleUsage.
Second, we do want *do* to some modest rules/inlining stuff in stable
unfoldings, partly to eliminate senseless crap, and partly to break
the recursive knots generated by instance declarations.
However, suppose we have
{-# INLINE <act> f #-}
f = <rhs>
meaning "inline f in phases p where activation <act>(p) holds".
Then what inlinings/rules can we apply to the copy of <rhs> captured in
f's stable unfolding? Our model is that literally <rhs> is substituted for
f when it is inlined. So our conservative plan (implemented by
updModeForStableUnfoldings) is this:
-------------------------------------------------------------
When simplifying the RHS of an stable unfolding, set the phase
to the phase in which the stable unfolding first becomes active
-------------------------------------------------------------
That ensures that
a) Rules/inlinings that *cease* being active before p will
not apply to the stable unfolding, consistent with it being
inlined in its *original* form in phase p.
b) Rules/inlinings that only become active *after* p will
not apply to the stable unfolding, again to be consistent with
inlining the *original* rhs in phase p.
For example,
{-# INLINE f #-}
f x = ...g...
{-# NOINLINE [1] g #-}
g y = ...
{-# RULE h g = ... #-}
Here we must not inline g into f's RHS, even when we get to phase 0,
because when f is later inlined into some other module we want the
rule for h to fire.
Similarly, consider
{-# INLINE f #-}
f x = ...g...
g y = ...
and suppose that there are auto-generated specialisations and a strictness
wrapper for g. The specialisations get activation AlwaysActive, and the
strictness wrapper get activation (ActiveAfter 0). So the strictness
wrepper fails the test and won't be inlined into f's stable unfolding. That
means f can inline, expose the specialised call to g, so the specialisation
rules can fire.
A note about wrappers
~~~~~~~~~~~~~~~~~~~~~
It's also important not to inline a worker back into a wrapper.
A wrapper looks like
wraper = inline_me (\x -> ...worker... )
Normally, the inline_me prevents the worker getting inlined into
the wrapper (initially, the worker's only call site!). But,
if the wrapper is sure to be called, the strictness analyser will
mark it 'demanded', so when the RHS is simplified, it'll get an ArgOf
continuation.
-}
| 5,008
|
updModeForStableUnfoldings :: Activation -> SimplifierMode -> SimplifierMode
updModeForStableUnfoldings inline_rule_act current_mode
= current_mode { sm_phase = phaseFromActivation inline_rule_act
, sm_inline = True
, sm_eta_expand = False }
-- For sm_rules, just inherit; sm_rules might be "off"
-- because of -fno-enable-rewrite-rules
where
phaseFromActivation (ActiveAfter n) = Phase n
phaseFromActivation _ = InitialPhase
{-
Note [Inlining in gentle mode]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Something is inlined if
(i) the sm_inline flag is on, AND
(ii) the thing has an INLINE pragma, AND
(iii) the thing is inlinable in the earliest phase.
Example of why (iii) is important:
{-# INLINE [~1] g #-}
g = ...
{-# INLINE f #-}
f x = g (g x)
If we were to inline g into f's inlining, then an importing module would
never be able to do
f e --> g (g e) ---> RULE fires
because the stable unfolding for f has had g inlined into it.
On the other hand, it is bad not to do ANY inlining into an
stable unfolding, because then recursive knots in instance declarations
don't get unravelled.
However, *sometimes* SimplGently must do no call-site inlining at all
(hence sm_inline = False). Before full laziness we must be careful
not to inline wrappers, because doing so inhibits floating
e.g. ...(case f x of ...)...
==> ...(case (case x of I# x# -> fw x#) of ...)...
==> ...(case x of I# x# -> case fw x# of ...)...
and now the redex (f x) isn't floatable any more.
The no-inlining thing is also important for Template Haskell. You might be
compiling in one-shot mode with -O2; but when TH compiles a splice before
running it, we don't want to use -O2. Indeed, we don't want to inline
anything, because the byte-code interpreter might get confused about
unboxed tuples and suchlike.
Note [Simplifying inside stable unfoldings]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We must take care with simplification inside stable unfoldings (which come from
INLINE pragmas).
First, consider the following example
let f = \pq -> BIG
in
let g = \y -> f y y
{-# INLINE g #-}
in ...g...g...g...g...g...
Now, if that's the ONLY occurrence of f, it might be inlined inside g,
and thence copied multiple times when g is inlined. HENCE we treat
any occurrence in a stable unfolding as a multiple occurrence, not a single
one; see OccurAnal.addRuleUsage.
Second, we do want *do* to some modest rules/inlining stuff in stable
unfoldings, partly to eliminate senseless crap, and partly to break
the recursive knots generated by instance declarations.
However, suppose we have
{-# INLINE <act> f #-}
f = <rhs>
meaning "inline f in phases p where activation <act>(p) holds".
Then what inlinings/rules can we apply to the copy of <rhs> captured in
f's stable unfolding? Our model is that literally <rhs> is substituted for
f when it is inlined. So our conservative plan (implemented by
updModeForStableUnfoldings) is this:
-------------------------------------------------------------
When simplifying the RHS of an stable unfolding, set the phase
to the phase in which the stable unfolding first becomes active
-------------------------------------------------------------
That ensures that
a) Rules/inlinings that *cease* being active before p will
not apply to the stable unfolding, consistent with it being
inlined in its *original* form in phase p.
b) Rules/inlinings that only become active *after* p will
not apply to the stable unfolding, again to be consistent with
inlining the *original* rhs in phase p.
For example,
{-# INLINE f #-}
f x = ...g...
{-# NOINLINE [1] g #-}
g y = ...
{-# RULE h g = ... #-}
Here we must not inline g into f's RHS, even when we get to phase 0,
because when f is later inlined into some other module we want the
rule for h to fire.
Similarly, consider
{-# INLINE f #-}
f x = ...g...
g y = ...
and suppose that there are auto-generated specialisations and a strictness
wrapper for g. The specialisations get activation AlwaysActive, and the
strictness wrapper get activation (ActiveAfter 0). So the strictness
wrepper fails the test and won't be inlined into f's stable unfolding. That
means f can inline, expose the specialised call to g, so the specialisation
rules can fire.
A note about wrappers
~~~~~~~~~~~~~~~~~~~~~
It's also important not to inline a worker back into a wrapper.
A wrapper looks like
wraper = inline_me (\x -> ...worker... )
Normally, the inline_me prevents the worker getting inlined into
the wrapper (initially, the worker's only call site!). But,
if the wrapper is sure to be called, the strictness analyser will
mark it 'demanded', so when the RHS is simplified, it'll get an ArgOf
continuation.
-}
| 4,957
|
updModeForStableUnfoldings inline_rule_act current_mode
= current_mode { sm_phase = phaseFromActivation inline_rule_act
, sm_inline = True
, sm_eta_expand = False }
-- For sm_rules, just inherit; sm_rules might be "off"
-- because of -fno-enable-rewrite-rules
where
phaseFromActivation (ActiveAfter n) = Phase n
phaseFromActivation _ = InitialPhase
{-
Note [Inlining in gentle mode]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Something is inlined if
(i) the sm_inline flag is on, AND
(ii) the thing has an INLINE pragma, AND
(iii) the thing is inlinable in the earliest phase.
Example of why (iii) is important:
{-# INLINE [~1] g #-}
g = ...
{-# INLINE f #-}
f x = g (g x)
If we were to inline g into f's inlining, then an importing module would
never be able to do
f e --> g (g e) ---> RULE fires
because the stable unfolding for f has had g inlined into it.
On the other hand, it is bad not to do ANY inlining into an
stable unfolding, because then recursive knots in instance declarations
don't get unravelled.
However, *sometimes* SimplGently must do no call-site inlining at all
(hence sm_inline = False). Before full laziness we must be careful
not to inline wrappers, because doing so inhibits floating
e.g. ...(case f x of ...)...
==> ...(case (case x of I# x# -> fw x#) of ...)...
==> ...(case x of I# x# -> case fw x# of ...)...
and now the redex (f x) isn't floatable any more.
The no-inlining thing is also important for Template Haskell. You might be
compiling in one-shot mode with -O2; but when TH compiles a splice before
running it, we don't want to use -O2. Indeed, we don't want to inline
anything, because the byte-code interpreter might get confused about
unboxed tuples and suchlike.
Note [Simplifying inside stable unfoldings]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We must take care with simplification inside stable unfoldings (which come from
INLINE pragmas).
First, consider the following example
let f = \pq -> BIG
in
let g = \y -> f y y
{-# INLINE g #-}
in ...g...g...g...g...g...
Now, if that's the ONLY occurrence of f, it might be inlined inside g,
and thence copied multiple times when g is inlined. HENCE we treat
any occurrence in a stable unfolding as a multiple occurrence, not a single
one; see OccurAnal.addRuleUsage.
Second, we do want *do* to some modest rules/inlining stuff in stable
unfoldings, partly to eliminate senseless crap, and partly to break
the recursive knots generated by instance declarations.
However, suppose we have
{-# INLINE <act> f #-}
f = <rhs>
meaning "inline f in phases p where activation <act>(p) holds".
Then what inlinings/rules can we apply to the copy of <rhs> captured in
f's stable unfolding? Our model is that literally <rhs> is substituted for
f when it is inlined. So our conservative plan (implemented by
updModeForStableUnfoldings) is this:
-------------------------------------------------------------
When simplifying the RHS of an stable unfolding, set the phase
to the phase in which the stable unfolding first becomes active
-------------------------------------------------------------
That ensures that
a) Rules/inlinings that *cease* being active before p will
not apply to the stable unfolding, consistent with it being
inlined in its *original* form in phase p.
b) Rules/inlinings that only become active *after* p will
not apply to the stable unfolding, again to be consistent with
inlining the *original* rhs in phase p.
For example,
{-# INLINE f #-}
f x = ...g...
{-# NOINLINE [1] g #-}
g y = ...
{-# RULE h g = ... #-}
Here we must not inline g into f's RHS, even when we get to phase 0,
because when f is later inlined into some other module we want the
rule for h to fire.
Similarly, consider
{-# INLINE f #-}
f x = ...g...
g y = ...
and suppose that there are auto-generated specialisations and a strictness
wrapper for g. The specialisations get activation AlwaysActive, and the
strictness wrapper get activation (ActiveAfter 0). So the strictness
wrepper fails the test and won't be inlined into f's stable unfolding. That
means f can inline, expose the specialised call to g, so the specialisation
rules can fire.
A note about wrappers
~~~~~~~~~~~~~~~~~~~~~
It's also important not to inline a worker back into a wrapper.
A wrapper looks like
wraper = inline_me (\x -> ...worker... )
Normally, the inline_me prevents the worker getting inlined into
the wrapper (initially, the worker's only call site!). But,
if the wrapper is sure to be called, the strictness analyser will
mark it 'demanded', so when the RHS is simplified, it'll get an ArgOf
continuation.
-}
| 4,880
| true
| true
| 0
| 7
| 1,094
| 79
| 43
| 36
| null | null |
cbowdon/TDOP
|
Test/expr.hs
|
gpl-3.0
|
-- Gratefully taken from: http://www.cs.virginia.edu/~wh5a/personal/Transformers.pdf
-- TODO actually use the transformers
eval :: Env -> Expr -> Value
eval _ (FloLit f) = FloVal f
| 183
|
eval :: Env -> Expr -> Value
eval _ (FloLit f) = FloVal f
| 60
|
eval _ (FloLit f) = FloVal f
| 30
| true
| true
| 0
| 10
| 27
| 40
| 19
| 21
| null | null |
spechub/Hets
|
CASL_DL/PredefinedCASLAxioms.hs
|
gpl-2.0
|
integerSign :: CASLSign
integerSign = (emptySign ())
{ sortRel =
Rel.transClosure $ Rel.fromList
[(negIntS, nonPosInt),
(nonNegInt, integer),
(nonPosInt, integer),
(posInt, nonNegInt),
(integer, dataS)]
, predMap =
MapSet.fromList
$
map ( \ o -> (stringToId o, intTypes))
["even", "odd"]
, opMap = MapSet.fromList
$ map (\ i -> (stringToId $ show i, [natT]))
[0 .. 9 :: Int]
++
[
(atAt, [atAtTy])
]
, globAnnos = emptyGlobalAnnos
{ literal_annos = emptyLiteralAnnos
{ number_lit = Just atAt
}}
}
| 1,029
|
integerSign :: CASLSign
integerSign = (emptySign ())
{ sortRel =
Rel.transClosure $ Rel.fromList
[(negIntS, nonPosInt),
(nonNegInt, integer),
(nonPosInt, integer),
(posInt, nonNegInt),
(integer, dataS)]
, predMap =
MapSet.fromList
$
map ( \ o -> (stringToId o, intTypes))
["even", "odd"]
, opMap = MapSet.fromList
$ map (\ i -> (stringToId $ show i, [natT]))
[0 .. 9 :: Int]
++
[
(atAt, [atAtTy])
]
, globAnnos = emptyGlobalAnnos
{ literal_annos = emptyLiteralAnnos
{ number_lit = Just atAt
}}
}
| 1,029
|
integerSign = (emptySign ())
{ sortRel =
Rel.transClosure $ Rel.fromList
[(negIntS, nonPosInt),
(nonNegInt, integer),
(nonPosInt, integer),
(posInt, nonNegInt),
(integer, dataS)]
, predMap =
MapSet.fromList
$
map ( \ o -> (stringToId o, intTypes))
["even", "odd"]
, opMap = MapSet.fromList
$ map (\ i -> (stringToId $ show i, [natT]))
[0 .. 9 :: Int]
++
[
(atAt, [atAtTy])
]
, globAnnos = emptyGlobalAnnos
{ literal_annos = emptyLiteralAnnos
{ number_lit = Just atAt
}}
}
| 1,005
| false
| true
| 0
| 14
| 610
| 214
| 127
| 87
| null | null |
ksaveljev/hake-2
|
src/Constants.hs
|
bsd-3-clause
|
-- 2048
dfAllowExit = 0x00001000 :: Int
| 45
|
dfAllowExit = 0x00001000 :: Int
| 36
|
dfAllowExit = 0x00001000 :: Int
| 36
| true
| false
| 0
| 4
| 12
| 10
| 6
| 4
| null | null |
kadena-io/pact
|
src-ghc/Pact/GasModel/GasTests.hs
|
bsd-3-clause
|
describeTableTests :: NativeDefName -> GasUnitTests
describeTableTests = defGasUnitTests allExprs
where
describeTableExpr =
defPactExpression [text| (describe-table $acctModuleNameText.accounts) |]
allExprs = describeTableExpr :| []
| 248
|
describeTableTests :: NativeDefName -> GasUnitTests
describeTableTests = defGasUnitTests allExprs
where
describeTableExpr =
defPactExpression [text| (describe-table $acctModuleNameText.accounts) |]
allExprs = describeTableExpr :| []
| 248
|
describeTableTests = defGasUnitTests allExprs
where
describeTableExpr =
defPactExpression [text| (describe-table $acctModuleNameText.accounts) |]
allExprs = describeTableExpr :| []
| 196
| false
| true
| 1
| 6
| 37
| 45
| 24
| 21
| null | null |
bixuanzju/fcore
|
lib/OptiUtils.hs
|
bsd-2-clause
|
peq n (TApp e1 _) (TApp e2 _) = peq n e1 e2
| 43
|
peq n (TApp e1 _) (TApp e2 _) = peq n e1 e2
| 43
|
peq n (TApp e1 _) (TApp e2 _) = peq n e1 e2
| 43
| false
| false
| 1
| 7
| 12
| 39
| 17
| 22
| null | null |
rueshyna/gogol
|
gogol-mirror/gen/Network/Google/Resource/Mirror/Timeline/Attachments/Insert.hs
|
mpl-2.0
|
-- | Creates a value of 'TimelineAttachmentsInsert' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'taiItemId'
timelineAttachmentsInsert
:: Text -- ^ 'taiItemId'
-> TimelineAttachmentsInsert
timelineAttachmentsInsert pTaiItemId_ =
TimelineAttachmentsInsert'
{ _taiItemId = pTaiItemId_
}
| 392
|
timelineAttachmentsInsert
:: Text -- ^ 'taiItemId'
-> TimelineAttachmentsInsert
timelineAttachmentsInsert pTaiItemId_ =
TimelineAttachmentsInsert'
{ _taiItemId = pTaiItemId_
}
| 195
|
timelineAttachmentsInsert pTaiItemId_ =
TimelineAttachmentsInsert'
{ _taiItemId = pTaiItemId_
}
| 107
| true
| true
| 0
| 7
| 70
| 41
| 22
| 19
| null | null |
nazrhom/vcs-clojure
|
src/VCS/Cost.hs
|
bsd-3-clause
|
costS costAt costAl (Scns c p) = sumAll costAt p
| 48
|
costS costAt costAl (Scns c p) = sumAll costAt p
| 48
|
costS costAt costAl (Scns c p) = sumAll costAt p
| 48
| false
| false
| 0
| 7
| 9
| 26
| 12
| 14
| null | null |
olorin/amazonka
|
amazonka-codedeploy/gen/Network/AWS/CodeDeploy/CreateDeploymentGroup.hs
|
mpl-2.0
|
-- | Creates a value of 'CreateDeploymentGroup' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cdgDeploymentConfigName'
--
-- * 'cdgEc2TagFilters'
--
-- * 'cdgOnPremisesInstanceTagFilters'
--
-- * 'cdgAutoScalingGroups'
--
-- * 'cdgApplicationName'
--
-- * 'cdgDeploymentGroupName'
--
-- * 'cdgServiceRoleARN'
createDeploymentGroup
:: Text -- ^ 'cdgApplicationName'
-> Text -- ^ 'cdgDeploymentGroupName'
-> Text -- ^ 'cdgServiceRoleARN'
-> CreateDeploymentGroup
createDeploymentGroup pApplicationName_ pDeploymentGroupName_ pServiceRoleARN_ =
CreateDeploymentGroup'
{ _cdgDeploymentConfigName = Nothing
, _cdgEc2TagFilters = Nothing
, _cdgOnPremisesInstanceTagFilters = Nothing
, _cdgAutoScalingGroups = Nothing
, _cdgApplicationName = pApplicationName_
, _cdgDeploymentGroupName = pDeploymentGroupName_
, _cdgServiceRoleARN = pServiceRoleARN_
}
| 984
|
createDeploymentGroup
:: Text -- ^ 'cdgApplicationName'
-> Text -- ^ 'cdgDeploymentGroupName'
-> Text -- ^ 'cdgServiceRoleARN'
-> CreateDeploymentGroup
createDeploymentGroup pApplicationName_ pDeploymentGroupName_ pServiceRoleARN_ =
CreateDeploymentGroup'
{ _cdgDeploymentConfigName = Nothing
, _cdgEc2TagFilters = Nothing
, _cdgOnPremisesInstanceTagFilters = Nothing
, _cdgAutoScalingGroups = Nothing
, _cdgApplicationName = pApplicationName_
, _cdgDeploymentGroupName = pDeploymentGroupName_
, _cdgServiceRoleARN = pServiceRoleARN_
}
| 587
|
createDeploymentGroup pApplicationName_ pDeploymentGroupName_ pServiceRoleARN_ =
CreateDeploymentGroup'
{ _cdgDeploymentConfigName = Nothing
, _cdgEc2TagFilters = Nothing
, _cdgOnPremisesInstanceTagFilters = Nothing
, _cdgAutoScalingGroups = Nothing
, _cdgApplicationName = pApplicationName_
, _cdgDeploymentGroupName = pDeploymentGroupName_
, _cdgServiceRoleARN = pServiceRoleARN_
}
| 419
| true
| true
| 0
| 9
| 162
| 103
| 66
| 37
| null | null |
brendanhay/gogol
|
gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs
|
mpl-2.0
|
-- | The series for a histogram may be either a single series of values to be
-- bucketed or multiple series, each of the same length, containing the
-- name of the series followed by the values to be bucketed for that
-- series.
hcsSeries :: Lens' HistogramChartSpec [HistogramSeries]
hcsSeries
= lens _hcsSeries (\ s a -> s{_hcsSeries = a}) .
_Default
. _Coerce
| 377
|
hcsSeries :: Lens' HistogramChartSpec [HistogramSeries]
hcsSeries
= lens _hcsSeries (\ s a -> s{_hcsSeries = a}) .
_Default
. _Coerce
| 147
|
hcsSeries
= lens _hcsSeries (\ s a -> s{_hcsSeries = a}) .
_Default
. _Coerce
| 91
| true
| true
| 2
| 9
| 78
| 61
| 31
| 30
| null | null |
bixuanzju/fcore
|
lib/PartialEvaluator.hs
|
bsd-2-clause
|
rewrite2' :: Map.Map Int e -> Expr t Int -> Int -> Expr t e
rewrite2' env e@(Let _ expr f) num@(f -> (Var _ num')) =
if num' == num
then rewrite2' env expr num
else rewriteExpr (swap1_3 rewrite2') num env e
| 212
|
rewrite2' :: Map.Map Int e -> Expr t Int -> Int -> Expr t e
rewrite2' env e@(Let _ expr f) num@(f -> (Var _ num')) =
if num' == num
then rewrite2' env expr num
else rewriteExpr (swap1_3 rewrite2') num env e
| 212
|
rewrite2' env e@(Let _ expr f) num@(f -> (Var _ num')) =
if num' == num
then rewrite2' env expr num
else rewriteExpr (swap1_3 rewrite2') num env e
| 152
| false
| true
| 0
| 10
| 48
| 112
| 56
| 56
| null | null |
d0kt0r0/InnerEar
|
src/InnerEar/Exercises/FrequencyEnvelope.hs
|
gpl-3.0
|
similarityToExp 3 = 1.5
| 23
|
similarityToExp 3 = 1.5
| 23
|
similarityToExp 3 = 1.5
| 23
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
urbanslug/ghc
|
testsuite/tests/simplCore/should_run/T5587.hs
|
bsd-3-clause
|
main = print $ seq (head (map (\a -> \b -> hiddenError) (hiddenError::[] Bool))) id [1]
| 87
|
main = print $ seq (head (map (\a -> \b -> hiddenError) (hiddenError::[] Bool))) id [1]
| 87
|
main = print $ seq (head (map (\a -> \b -> hiddenError) (hiddenError::[] Bool))) id [1]
| 87
| false
| false
| 3
| 12
| 15
| 62
| 31
| 31
| null | null |
vincenthz/language-c
|
test/src/RenderTests.hs
|
bsd-3-clause
|
throughput :: TestSummary -> Double
throughput ts = (totalEntities ts) `per` (totalTime ts)
| 92
|
throughput :: TestSummary -> Double
throughput ts = (totalEntities ts) `per` (totalTime ts)
| 92
|
throughput ts = (totalEntities ts) `per` (totalTime ts)
| 56
| false
| true
| 0
| 8
| 13
| 40
| 20
| 20
| null | null |
yigitozkavci/glow
|
src/Codegen.hs
|
mit
|
-- error $ "Store instruction operands should have the same type.\nSource type: " ++ show (oType src) ++ "\nDestination type: " ++ show (oType dest)
load :: Operand -> Codegen Operand
load ptr = instr (oType ptr) $ Load False ptr Nothing 0 []
| 243
|
load :: Operand -> Codegen Operand
load ptr = instr (oType ptr) $ Load False ptr Nothing 0 []
| 93
|
load ptr = instr (oType ptr) $ Load False ptr Nothing 0 []
| 58
| true
| true
| 0
| 8
| 44
| 48
| 23
| 25
| null | null |
abayley/netpoll
|
src/Network/Protocol/SNMP/UDP.hs
|
gpl-3.0
|
berLength :: Word.Word64 -> [Word.Word8]
berLength l = if l < 128 then [fromIntegral l] else
(fromIntegral (128 + List.length bytes)) : bytes
where bytes = word2Words l
-- We use Lazy ByteStrings here (rather than Builders)
-- because we need to know the length of each piece.
-- I do wonder if it would be better to just have the
-- functions return [Word.Word8], but I also believe
-- small ByteStrings are copy-combined, so you don't get
-- much overhead in terms of storage (and chained appends).
-- Besides, ByteString comes with a convenient functions
-- to encode a String via UTF8; I have not found an
-- equivalent for Word8 yet.
| 648
|
berLength :: Word.Word64 -> [Word.Word8]
berLength l = if l < 128 then [fromIntegral l] else
(fromIntegral (128 + List.length bytes)) : bytes
where bytes = word2Words l
-- We use Lazy ByteStrings here (rather than Builders)
-- because we need to know the length of each piece.
-- I do wonder if it would be better to just have the
-- functions return [Word.Word8], but I also believe
-- small ByteStrings are copy-combined, so you don't get
-- much overhead in terms of storage (and chained appends).
-- Besides, ByteString comes with a convenient functions
-- to encode a String via UTF8; I have not found an
-- equivalent for Word8 yet.
| 648
|
berLength l = if l < 128 then [fromIntegral l] else
(fromIntegral (128 + List.length bytes)) : bytes
where bytes = word2Words l
-- We use Lazy ByteStrings here (rather than Builders)
-- because we need to know the length of each piece.
-- I do wonder if it would be better to just have the
-- functions return [Word.Word8], but I also believe
-- small ByteStrings are copy-combined, so you don't get
-- much overhead in terms of storage (and chained appends).
-- Besides, ByteString comes with a convenient functions
-- to encode a String via UTF8; I have not found an
-- equivalent for Word8 yet.
| 607
| false
| true
| 0
| 12
| 122
| 84
| 48
| 36
| null | null |
mpickering/hackage-server
|
Distribution/Server/Framework/BackupRestore.hs
|
bsd-3-clause
|
abstractRestoreBackup :: (st -> IO ()) -> RestoreBackup st -> AbstractRestoreBackup
abstractRestoreBackup putSt = go
where
go RestoreBackup {..} = AbstractRestoreBackup {
abstractRestoreEntry = \store entry ->
liftM go <$> (runRestore store $ restoreEntry entry)
, abstractRestoreFinalize = \store ->
liftM putSt <$> (runRestore store $ restoreFinalize)
}
| 404
|
abstractRestoreBackup :: (st -> IO ()) -> RestoreBackup st -> AbstractRestoreBackup
abstractRestoreBackup putSt = go
where
go RestoreBackup {..} = AbstractRestoreBackup {
abstractRestoreEntry = \store entry ->
liftM go <$> (runRestore store $ restoreEntry entry)
, abstractRestoreFinalize = \store ->
liftM putSt <$> (runRestore store $ restoreFinalize)
}
| 404
|
abstractRestoreBackup putSt = go
where
go RestoreBackup {..} = AbstractRestoreBackup {
abstractRestoreEntry = \store entry ->
liftM go <$> (runRestore store $ restoreEntry entry)
, abstractRestoreFinalize = \store ->
liftM putSt <$> (runRestore store $ restoreFinalize)
}
| 320
| false
| true
| 0
| 11
| 96
| 116
| 59
| 57
| null | null |
kawamuray/ganeti
|
src/Ganeti/UDSServer.hs
|
gpl-2.0
|
clientToFd :: Client -> IO (Fd, Fd)
clientToFd client | rh == wh = join (,) <$> handleToFd rh
| otherwise = (,) <$> handleToFd rh <*> handleToFd wh
where
rh = rsocket client
wh = wsocket client
-- | Sends a message over a transport.
| 262
|
clientToFd :: Client -> IO (Fd, Fd)
clientToFd client | rh == wh = join (,) <$> handleToFd rh
| otherwise = (,) <$> handleToFd rh <*> handleToFd wh
where
rh = rsocket client
wh = wsocket client
-- | Sends a message over a transport.
| 262
|
clientToFd client | rh == wh = join (,) <$> handleToFd rh
| otherwise = (,) <$> handleToFd rh <*> handleToFd wh
where
rh = rsocket client
wh = wsocket client
-- | Sends a message over a transport.
| 226
| false
| true
| 3
| 8
| 75
| 105
| 47
| 58
| null | null |
surajx/learn-haskell
|
basic.hs
|
mit
|
factorial' 0 = 1
| 16
|
factorial' 0 = 1
| 16
|
factorial' 0 = 1
| 16
| false
| false
| 1
| 5
| 3
| 13
| 4
| 9
| null | null |
snoyberg/photosorter
|
fay/Language/Fay/JQuery.hs
|
bsd-2-clause
|
isJQuery :: JQuery -> JQuery -> Fay JQuery
isJQuery = ffi "%2['is'](%1)"
| 72
|
isJQuery :: JQuery -> JQuery -> Fay JQuery
isJQuery = ffi "%2['is'](%1)"
| 72
|
isJQuery = ffi "%2['is'](%1)"
| 29
| false
| true
| 0
| 7
| 11
| 25
| 12
| 13
| null | null |
ItsLastDay/academic_university_2016-2018
|
subjects/Haskell/8a/Fp08A.hs
|
gpl-3.0
|
charA :: Parser Char Char
charA = Parser f where
f (c:cs) | c == 'A' = Just (cs,c)
f _ = Nothing
{-
> runParser charA "ABC"
Just ('A',"BC")
> runParser charA "BCD"
Nothing
-}
| 205
|
charA :: Parser Char Char
charA = Parser f where
f (c:cs) | c == 'A' = Just (cs,c)
f _ = Nothing
{-
> runParser charA "ABC"
Just ('A',"BC")
> runParser charA "BCD"
Nothing
-}
| 204
|
charA = Parser f where
f (c:cs) | c == 'A' = Just (cs,c)
f _ = Nothing
{-
> runParser charA "ABC"
Just ('A',"BC")
> runParser charA "BCD"
Nothing
-}
| 178
| false
| true
| 0
| 8
| 66
| 73
| 33
| 40
| null | null |
ku-fpg/ldpc
|
src/Manifold/Haskell.hs
|
bsd-2-clause
|
cnv32 :: Double -> Int32
-- NB How to best choose the divisor?
cnv32 d | d > 0 = toEnum $ fromEnum $
d * (toEnum $ fromEnum (maxBound `div` 8 :: Int32))
| otherwise = toEnum $ fromEnum $
abs d * (toEnum $ fromEnum (minBound `div` 8 :: Int32))
| 272
|
cnv32 :: Double -> Int32
cnv32 d | d > 0 = toEnum $ fromEnum $
d * (toEnum $ fromEnum (maxBound `div` 8 :: Int32))
| otherwise = toEnum $ fromEnum $
abs d * (toEnum $ fromEnum (minBound `div` 8 :: Int32))
| 234
|
cnv32 d | d > 0 = toEnum $ fromEnum $
d * (toEnum $ fromEnum (maxBound `div` 8 :: Int32))
| otherwise = toEnum $ fromEnum $
abs d * (toEnum $ fromEnum (minBound `div` 8 :: Int32))
| 209
| true
| true
| 0
| 11
| 81
| 109
| 57
| 52
| null | null |
agremm/Matryoshka
|
Data/Array/Matryoshka/PArray/Combinators.hs
|
bsd-3-clause
|
scanMP !f !xs !(Range !s !e) !mvec = go s s
where
go !gs !i | gs == e = return ()
| gs > i = do
val0 <- unsafeRead mvec (gs - 1)
let !val1 = xs ! gs
let !res = f val0 val1
unsafeWrite mvec gs res
let !s1 = gs + 1
go s1 i
| otherwise = do
let !val = xs ! gs
unsafeWrite mvec gs val
let !s1 = gs + 1
go s1 i
| 510
|
scanMP !f !xs !(Range !s !e) !mvec = go s s
where
go !gs !i | gs == e = return ()
| gs > i = do
val0 <- unsafeRead mvec (gs - 1)
let !val1 = xs ! gs
let !res = f val0 val1
unsafeWrite mvec gs res
let !s1 = gs + 1
go s1 i
| otherwise = do
let !val = xs ! gs
unsafeWrite mvec gs val
let !s1 = gs + 1
go s1 i
| 510
|
scanMP !f !xs !(Range !s !e) !mvec = go s s
where
go !gs !i | gs == e = return ()
| gs > i = do
val0 <- unsafeRead mvec (gs - 1)
let !val1 = xs ! gs
let !res = f val0 val1
unsafeWrite mvec gs res
let !s1 = gs + 1
go s1 i
| otherwise = do
let !val = xs ! gs
unsafeWrite mvec gs val
let !s1 = gs + 1
go s1 i
| 510
| false
| false
| 0
| 11
| 287
| 216
| 88
| 128
| null | null |
oldmanmike/ghc
|
compiler/types/Type.hs
|
bsd-3-clause
|
splitFunTy_maybe :: Type -> Maybe (Type, Type)
-- ^ Attempts to extract the argument and result types from a type
splitFunTy_maybe ty | Just ty' <- coreView ty = splitFunTy_maybe ty'
| 182
|
splitFunTy_maybe :: Type -> Maybe (Type, Type)
splitFunTy_maybe ty | Just ty' <- coreView ty = splitFunTy_maybe ty'
| 115
|
splitFunTy_maybe ty | Just ty' <- coreView ty = splitFunTy_maybe ty'
| 68
| true
| true
| 0
| 9
| 30
| 51
| 23
| 28
| null | null |
mettekou/ghc
|
compiler/coreSyn/CoreSyn.hs
|
bsd-3-clause
|
deTagExpr (Coercion co) = Coercion co
| 49
|
deTagExpr (Coercion co) = Coercion co
| 49
|
deTagExpr (Coercion co) = Coercion co
| 49
| false
| false
| 0
| 6
| 17
| 19
| 8
| 11
| null | null |
utky/lycopene
|
src/Lycopene/Logger.hs
|
apache-2.0
|
runLoggerT :: (Monad m) => LoggerT m a -> m (a, Log)
runLoggerT = W.runWriterT
| 78
|
runLoggerT :: (Monad m) => LoggerT m a -> m (a, Log)
runLoggerT = W.runWriterT
| 78
|
runLoggerT = W.runWriterT
| 25
| false
| true
| 0
| 9
| 14
| 46
| 22
| 24
| null | null |
keera-studios/hsQt
|
Qtc/Enums/Gui/QDateTimeEdit.hs
|
bsd-2-clause
|
eTimeSections_Mask :: Section
eTimeSections_Mask
= ieSection $ 31
| 67
|
eTimeSections_Mask :: Section
eTimeSections_Mask
= ieSection $ 31
| 67
|
eTimeSections_Mask
= ieSection $ 31
| 37
| false
| true
| 0
| 6
| 9
| 18
| 8
| 10
| null | null |
haskell-opengl/OpenGLRaw
|
src/Graphics/GL/Functions/F12.hs
|
bsd-3-clause
|
-- glGetShaderiv ---------------------------------------------------------------
-- | Manual pages for <https://www.opengl.org/sdk/docs/man2/xhtml/glGetShader.xml OpenGL 2.x> or <https://www.opengl.org/sdk/docs/man3/xhtml/glGetShader.xml OpenGL 3.x> or <https://www.opengl.org/sdk/docs/man4/html/glGetShader.xhtml OpenGL 4.x>.
glGetShaderiv
:: MonadIO m
=> GLuint -- ^ @shader@.
-> GLenum -- ^ @pname@ of type [ShaderParameterName](Graphics-GL-Groups.html#ShaderParameterName).
-> Ptr GLint -- ^ @params@ pointing to @COMPSIZE(pname)@ elements of type @GLint@.
-> m ()
glGetShaderiv v1 v2 v3 = liftIO $ dyn348 ptr_glGetShaderiv v1 v2 v3
| 647
|
glGetShaderiv
:: MonadIO m
=> GLuint -- ^ @shader@.
-> GLenum -- ^ @pname@ of type [ShaderParameterName](Graphics-GL-Groups.html#ShaderParameterName).
-> Ptr GLint -- ^ @params@ pointing to @COMPSIZE(pname)@ elements of type @GLint@.
-> m ()
glGetShaderiv v1 v2 v3 = liftIO $ dyn348 ptr_glGetShaderiv v1 v2 v3
| 319
|
glGetShaderiv v1 v2 v3 = liftIO $ dyn348 ptr_glGetShaderiv v1 v2 v3
| 67
| true
| true
| 0
| 11
| 74
| 67
| 33
| 34
| null | null |
hvr/jhc
|
src/FrontEnd/Syn/Q.hs
|
mit
|
newVar :: FromName a => Maybe Module -> Q (Name,a)
newVar = newVarN "q"
| 71
|
newVar :: FromName a => Maybe Module -> Q (Name,a)
newVar = newVarN "q"
| 71
|
newVar = newVarN "q"
| 20
| false
| true
| 0
| 9
| 13
| 43
| 19
| 24
| null | null |
m0ar/safe-streaming
|
src/Data/Linear.hs
|
bsd-3-clause
|
(++) :: [a] ⊸ [a] ⊸ [a]
[] ++ as = as
| 37
|
(++) :: [a] ⊸ [a] ⊸ [a]
[] ++ as = as
| 37
|
[] ++ as = as
| 13
| false
| true
| 0
| 7
| 11
| 38
| 21
| 17
| null | null |
hamishmack/haskell-gi
|
lib/Data/GI/GIR/Type.hs
|
lgpl-2.1
|
parseFundamentalType "GLib" "HashTable" = parseHashTable
| 56
|
parseFundamentalType "GLib" "HashTable" = parseHashTable
| 56
|
parseFundamentalType "GLib" "HashTable" = parseHashTable
| 56
| false
| false
| 0
| 4
| 4
| 13
| 5
| 8
| null | null |
cartazio/omega
|
src/DepthFirstSearch.hs
|
bsd-3-clause
|
ertices :: Graph -> [Vertex]
vertices graph = A.indices graph
| 63
|
vertices :: Graph -> [Vertex]
vertices graph = A.indices graph
| 63
|
vertices graph = A.indices graph
| 33
| false
| true
| 0
| 6
| 11
| 26
| 13
| 13
| null | null |
lihlcnkr/codejam
|
src/QR/TidyNumbers.hs
|
apache-2.0
|
intArrToInt:: [Int] -> Int
intArrToInt [] = 0
| 45
|
intArrToInt:: [Int] -> Int
intArrToInt [] = 0
| 45
|
intArrToInt [] = 0
| 18
| false
| true
| 0
| 8
| 7
| 30
| 13
| 17
| null | null |
phischu/fragnix
|
tests/packages/scotty/Data.Text.Array.hs
|
bsd-3-clause
|
-- | Indicate how many bytes would be used for an array of the given
-- size.
bytesInArray :: Int -> Int
bytesInArray n = n `shiftL` 1
| 134
|
bytesInArray :: Int -> Int
bytesInArray n = n `shiftL` 1
| 56
|
bytesInArray n = n `shiftL` 1
| 29
| true
| true
| 0
| 7
| 27
| 34
| 17
| 17
| null | null |
GregorySchwartz/fasta
|
src/Data/Fasta/ByteString/Parse.hs
|
gpl-3.0
|
attoFasta :: B.ByteString -> [FastaSequence]
attoFasta = eToV . A.parseOnly fastaFile'
where
eToV (Right x) = x
eToV (Left x) = error ("Unable to parse fasta file\n" ++ show x)
-- | Parse a CLIP fasta file into text sequences
| 237
|
attoFasta :: B.ByteString -> [FastaSequence]
attoFasta = eToV . A.parseOnly fastaFile'
where
eToV (Right x) = x
eToV (Left x) = error ("Unable to parse fasta file\n" ++ show x)
-- | Parse a CLIP fasta file into text sequences
| 237
|
attoFasta = eToV . A.parseOnly fastaFile'
where
eToV (Right x) = x
eToV (Left x) = error ("Unable to parse fasta file\n" ++ show x)
-- | Parse a CLIP fasta file into text sequences
| 192
| false
| true
| 1
| 8
| 51
| 73
| 37
| 36
| null | null |
intolerable/league-of-legends
|
src/League/Types/Constants.hs
|
bsd-3-clause
|
toMapID 2 = SummonersRiftAutumn
| 31
|
toMapID 2 = SummonersRiftAutumn
| 31
|
toMapID 2 = SummonersRiftAutumn
| 31
| false
| false
| 1
| 5
| 3
| 13
| 4
| 9
| null | null |
johnpmayer/elm-protoc
|
src/Lib.hs
|
agpl-3.0
|
genNativeMarshal :: Text -> Scope -> DescriptorProto -> Text
genNativeMarshal packagename scope descriptor =
let
typename :: Text
typename = toTextE "Didn't find a name for the descriptor" . D.name $ descriptor
fieldDescriptors :: [FieldDescriptorProto]
fieldDescriptors = toList $ D.field descriptor
standaloneFields :: [FieldDescriptorProto]
standaloneFields = filter (\fd -> FE.oneof_index fd == Nothing) fieldDescriptors
standaloneFieldMarshalers :: [(Text, Text -> Text)]
standaloneFieldMarshalers = genNativeFieldMarshal scope <$> standaloneFields
oneofFields :: [(Int32, FieldDescriptorProto)]
oneofFields =
let
accum fd xs =
case FE.oneof_index fd of
Nothing -> xs
Just index -> (index, fd) : xs
in foldr accum [] fieldDescriptors
oneofDescriptors :: [OneofDescriptorProto]
oneofDescriptors = toList $ D.oneof_decl descriptor
oneofTypes :: [(OneofDescriptorProto, [FieldDescriptorProto])]
oneofTypes =
let
groupedOneofFields = map (map snd) $ groupByKey fst oneofFields
in zip oneofDescriptors groupedOneofFields
oneofData :: [(Text, [(Text, Text)])]
oneofData = do
oneofType <- oneofTypes
let oneofRecordFieldName = toTextE "Didn't find name for the oneof" . O.name . fst $ oneofType
let oneofCases =
do
fieldDescriptor <- snd oneofType
let fieldName = toTextE "Didn't find a name for the field descriptor" . FE.name $ fieldDescriptor
typename =
case (FE.type' fieldDescriptor, FE.type_name fieldDescriptor) of
(Just t, _) -> genPrimitiveTypeName t
(_, Just tn) -> toText tn
return (fieldName, typename)
return $ (oneofRecordFieldName, oneofCases)
oneofFieldMarshalers :: Text
oneofFieldMarshalers =
let
marshalers :: [Text]
marshalers = do
oneofData1 <- oneofData
let oneofRecordFieldName = fst oneofData1
let oneofCaseMarshalers = T.concat $
do
(fieldName, fieldTypeName) <- snd oneofData1
let (qualifier, justFieldTypename) = splitTypePath fieldTypeName
let qualifierPrefix :: Text = T.concat (fmap (\s -> T.toTitle s `T.append` (T.pack ".")) qualifier)
return $ nativeOneofCaseMarshal qualifierPrefix typename oneofRecordFieldName fieldName justFieldTypename
return $ nativeOneofMarshal typename oneofRecordFieldName oneofCaseMarshalers
in T.concat marshalers
-- TODO check if the typename has some other qualifier
in nativeRecordMarshal packagename typename standaloneFieldMarshalers oneofFieldMarshalers
| 2,797
|
genNativeMarshal :: Text -> Scope -> DescriptorProto -> Text
genNativeMarshal packagename scope descriptor =
let
typename :: Text
typename = toTextE "Didn't find a name for the descriptor" . D.name $ descriptor
fieldDescriptors :: [FieldDescriptorProto]
fieldDescriptors = toList $ D.field descriptor
standaloneFields :: [FieldDescriptorProto]
standaloneFields = filter (\fd -> FE.oneof_index fd == Nothing) fieldDescriptors
standaloneFieldMarshalers :: [(Text, Text -> Text)]
standaloneFieldMarshalers = genNativeFieldMarshal scope <$> standaloneFields
oneofFields :: [(Int32, FieldDescriptorProto)]
oneofFields =
let
accum fd xs =
case FE.oneof_index fd of
Nothing -> xs
Just index -> (index, fd) : xs
in foldr accum [] fieldDescriptors
oneofDescriptors :: [OneofDescriptorProto]
oneofDescriptors = toList $ D.oneof_decl descriptor
oneofTypes :: [(OneofDescriptorProto, [FieldDescriptorProto])]
oneofTypes =
let
groupedOneofFields = map (map snd) $ groupByKey fst oneofFields
in zip oneofDescriptors groupedOneofFields
oneofData :: [(Text, [(Text, Text)])]
oneofData = do
oneofType <- oneofTypes
let oneofRecordFieldName = toTextE "Didn't find name for the oneof" . O.name . fst $ oneofType
let oneofCases =
do
fieldDescriptor <- snd oneofType
let fieldName = toTextE "Didn't find a name for the field descriptor" . FE.name $ fieldDescriptor
typename =
case (FE.type' fieldDescriptor, FE.type_name fieldDescriptor) of
(Just t, _) -> genPrimitiveTypeName t
(_, Just tn) -> toText tn
return (fieldName, typename)
return $ (oneofRecordFieldName, oneofCases)
oneofFieldMarshalers :: Text
oneofFieldMarshalers =
let
marshalers :: [Text]
marshalers = do
oneofData1 <- oneofData
let oneofRecordFieldName = fst oneofData1
let oneofCaseMarshalers = T.concat $
do
(fieldName, fieldTypeName) <- snd oneofData1
let (qualifier, justFieldTypename) = splitTypePath fieldTypeName
let qualifierPrefix :: Text = T.concat (fmap (\s -> T.toTitle s `T.append` (T.pack ".")) qualifier)
return $ nativeOneofCaseMarshal qualifierPrefix typename oneofRecordFieldName fieldName justFieldTypename
return $ nativeOneofMarshal typename oneofRecordFieldName oneofCaseMarshalers
in T.concat marshalers
-- TODO check if the typename has some other qualifier
in nativeRecordMarshal packagename typename standaloneFieldMarshalers oneofFieldMarshalers
| 2,797
|
genNativeMarshal packagename scope descriptor =
let
typename :: Text
typename = toTextE "Didn't find a name for the descriptor" . D.name $ descriptor
fieldDescriptors :: [FieldDescriptorProto]
fieldDescriptors = toList $ D.field descriptor
standaloneFields :: [FieldDescriptorProto]
standaloneFields = filter (\fd -> FE.oneof_index fd == Nothing) fieldDescriptors
standaloneFieldMarshalers :: [(Text, Text -> Text)]
standaloneFieldMarshalers = genNativeFieldMarshal scope <$> standaloneFields
oneofFields :: [(Int32, FieldDescriptorProto)]
oneofFields =
let
accum fd xs =
case FE.oneof_index fd of
Nothing -> xs
Just index -> (index, fd) : xs
in foldr accum [] fieldDescriptors
oneofDescriptors :: [OneofDescriptorProto]
oneofDescriptors = toList $ D.oneof_decl descriptor
oneofTypes :: [(OneofDescriptorProto, [FieldDescriptorProto])]
oneofTypes =
let
groupedOneofFields = map (map snd) $ groupByKey fst oneofFields
in zip oneofDescriptors groupedOneofFields
oneofData :: [(Text, [(Text, Text)])]
oneofData = do
oneofType <- oneofTypes
let oneofRecordFieldName = toTextE "Didn't find name for the oneof" . O.name . fst $ oneofType
let oneofCases =
do
fieldDescriptor <- snd oneofType
let fieldName = toTextE "Didn't find a name for the field descriptor" . FE.name $ fieldDescriptor
typename =
case (FE.type' fieldDescriptor, FE.type_name fieldDescriptor) of
(Just t, _) -> genPrimitiveTypeName t
(_, Just tn) -> toText tn
return (fieldName, typename)
return $ (oneofRecordFieldName, oneofCases)
oneofFieldMarshalers :: Text
oneofFieldMarshalers =
let
marshalers :: [Text]
marshalers = do
oneofData1 <- oneofData
let oneofRecordFieldName = fst oneofData1
let oneofCaseMarshalers = T.concat $
do
(fieldName, fieldTypeName) <- snd oneofData1
let (qualifier, justFieldTypename) = splitTypePath fieldTypeName
let qualifierPrefix :: Text = T.concat (fmap (\s -> T.toTitle s `T.append` (T.pack ".")) qualifier)
return $ nativeOneofCaseMarshal qualifierPrefix typename oneofRecordFieldName fieldName justFieldTypename
return $ nativeOneofMarshal typename oneofRecordFieldName oneofCaseMarshalers
in T.concat marshalers
-- TODO check if the typename has some other qualifier
in nativeRecordMarshal packagename typename standaloneFieldMarshalers oneofFieldMarshalers
| 2,736
| false
| true
| 1
| 32
| 766
| 685
| 347
| 338
| null | null |
rokob/wai-play
|
Main.hs
|
mit
|
main = run 3000 $ dispatch notFound404 routes
| 45
|
main = run 3000 $ dispatch notFound404 routes
| 45
|
main = run 3000 $ dispatch notFound404 routes
| 45
| false
| false
| 3
| 5
| 7
| 24
| 8
| 16
| null | null |
andyarvanitis/Idris-dev
|
src/Idris/Transforms.hs
|
bsd-3-clause
|
transformPats :: IState -> [Either Term (Term, Term)] ->
[Either Term (Term, Term)]
transformPats ist ps = map tClause ps where
tClause (Left t) = Left t -- not a clause, leave it alone
tClause (Right (lhs, rhs)) -- apply transforms on RHS
= let rhs' = applyTransRules ist rhs in
Right (lhs, rhs')
| 335
|
transformPats :: IState -> [Either Term (Term, Term)] ->
[Either Term (Term, Term)]
transformPats ist ps = map tClause ps where
tClause (Left t) = Left t -- not a clause, leave it alone
tClause (Right (lhs, rhs)) -- apply transforms on RHS
= let rhs' = applyTransRules ist rhs in
Right (lhs, rhs')
| 335
|
transformPats ist ps = map tClause ps where
tClause (Left t) = Left t -- not a clause, leave it alone
tClause (Right (lhs, rhs)) -- apply transforms on RHS
= let rhs' = applyTransRules ist rhs in
Right (lhs, rhs')
| 235
| false
| true
| 0
| 9
| 91
| 122
| 64
| 58
| null | null |
ajnsit/haste-markup
|
src/Util/Sanitize.hs
|
mit
|
keywords :: Set String
keywords = S.fromList
[ "case", "class", "data", "default", "deriving", "do", "else", "if"
, "import", "in", "infix", "infixl", "infixr", "instance" , "let", "module"
, "newtype", "of", "then", "type", "where"
]
| 250
|
keywords :: Set String
keywords = S.fromList
[ "case", "class", "data", "default", "deriving", "do", "else", "if"
, "import", "in", "infix", "infixl", "infixr", "instance" , "let", "module"
, "newtype", "of", "then", "type", "where"
]
| 250
|
keywords = S.fromList
[ "case", "class", "data", "default", "deriving", "do", "else", "if"
, "import", "in", "infix", "infixl", "infixr", "instance" , "let", "module"
, "newtype", "of", "then", "type", "where"
]
| 227
| false
| true
| 1
| 5
| 48
| 85
| 51
| 34
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.