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
quchen/stg
src/Stg/Marshal/FromStg.hs
bsd-3-clause
-- | Look up the value of an 'Atom' in a state, given a local environment. atomVal :: FromStg value => StgState -> Locals -> Atom -> Either FromStgError value atomVal stgState locals var = case Env.val locals (stgGlobals stgState) var of Failure notInScope -> Left (NotFound notInScope) Success (Addr addr) -> fromStgAddr stgState addr Success (PrimInt i) -> fromStgPrim i -- | Inspect whether a closure at a certain memory address matches the desired -- criteria.
498
atomVal :: FromStg value => StgState -> Locals -> Atom -> Either FromStgError value atomVal stgState locals var = case Env.val locals (stgGlobals stgState) var of Failure notInScope -> Left (NotFound notInScope) Success (Addr addr) -> fromStgAddr stgState addr Success (PrimInt i) -> fromStgPrim i -- | Inspect whether a closure at a certain memory address matches the desired -- criteria.
423
atomVal stgState locals var = case Env.val locals (stgGlobals stgState) var of Failure notInScope -> Left (NotFound notInScope) Success (Addr addr) -> fromStgAddr stgState addr Success (PrimInt i) -> fromStgPrim i -- | Inspect whether a closure at a certain memory address matches the desired -- criteria.
319
true
true
0
10
110
124
58
66
null
null
elitak/hs-datahand
stm32f10x/hs_src/Data/Accessor/Example.hs
gpl-3.0
{- * Example accesses -} {- | Example of using 'set', 'get', 'modify'. -} plain :: Int plain = Accessor.get second $ Accessor.modify second succ $ Accessor.set first 'a' $ ('b',7)
192
plain :: Int plain = Accessor.get second $ Accessor.modify second succ $ Accessor.set first 'a' $ ('b',7)
117
plain = Accessor.get second $ Accessor.modify second succ $ Accessor.set first 'a' $ ('b',7)
104
true
true
0
9
43
57
27
30
null
null
themoritz/cabal
Cabal/Distribution/Backpack/PreExistingComponent.hs
bsd-3-clause
-- | Convert an 'InstalledPackageInfo' into a 'PreExistingComponent', -- which was brought into scope under the 'PackageName' (important for -- a package qualified reference.) ipiToPreExistingComponent :: InstalledPackageInfo -> PreExistingComponent ipiToPreExistingComponent ipi = PreExistingComponent { pc_pkgname = packageName ipi, pc_compname = libraryComponentName $ Installed.sourceLibName ipi, pc_munged_id = mungedId ipi, pc_uid = Installed.installedUnitId ipi, pc_cid = Installed.installedComponentId ipi, pc_open_uid = IndefFullUnitId (Installed.installedComponentId ipi) (Map.fromList (Installed.instantiatedWith ipi)), pc_shape = shapeInstalledPackage ipi }
777
ipiToPreExistingComponent :: InstalledPackageInfo -> PreExistingComponent ipiToPreExistingComponent ipi = PreExistingComponent { pc_pkgname = packageName ipi, pc_compname = libraryComponentName $ Installed.sourceLibName ipi, pc_munged_id = mungedId ipi, pc_uid = Installed.installedUnitId ipi, pc_cid = Installed.installedComponentId ipi, pc_open_uid = IndefFullUnitId (Installed.installedComponentId ipi) (Map.fromList (Installed.instantiatedWith ipi)), pc_shape = shapeInstalledPackage ipi }
601
ipiToPreExistingComponent ipi = PreExistingComponent { pc_pkgname = packageName ipi, pc_compname = libraryComponentName $ Installed.sourceLibName ipi, pc_munged_id = mungedId ipi, pc_uid = Installed.installedUnitId ipi, pc_cid = Installed.installedComponentId ipi, pc_open_uid = IndefFullUnitId (Installed.installedComponentId ipi) (Map.fromList (Installed.instantiatedWith ipi)), pc_shape = shapeInstalledPackage ipi }
527
true
true
0
12
176
122
66
56
null
null
seereason/process-extras
src/System/Process/Run.hs
mit
strict :: RunM text char m => m () strict = modify (\x -> x { _lazy = False })
78
strict :: RunM text char m => m () strict = modify (\x -> x { _lazy = False })
78
strict = modify (\x -> x { _lazy = False })
43
false
true
0
9
19
52
25
27
null
null
corajr/adventofcode2015
10/Main.hs
mit
main = print partOne
20
main = print partOne
20
main = print partOne
20
false
false
1
5
3
12
4
8
null
null
brendanhay/gogol
gogol-tracing/gen/Network/Google/Tracing/Types/Product.hs
mpl-2.0
-- | One or more key:value pairs. teAnnotation :: Lens' TimeEvent (Maybe Annotation) teAnnotation = lens _teAnnotation (\ s a -> s{_teAnnotation = a})
152
teAnnotation :: Lens' TimeEvent (Maybe Annotation) teAnnotation = lens _teAnnotation (\ s a -> s{_teAnnotation = a})
118
teAnnotation = lens _teAnnotation (\ s a -> s{_teAnnotation = a})
67
true
true
1
9
25
52
25
27
null
null
OS2World/DEV-UTIL-HUGS
demos/GLUT/examples/RedBook/Fog.hs
bsd-3-clause
keyboard _ _ _ _ = return ()
28
keyboard _ _ _ _ = return ()
28
keyboard _ _ _ _ = return ()
28
false
false
0
6
7
20
9
11
null
null
ganeti/htools
Ganeti/HTools/Luxi.hs
gpl-2.0
loadData :: String -- ^ Unix socket to use as source -> IO (Result ClusterData) loadData master = readData master >>= return . parseData
145
loadData :: String -- ^ Unix socket to use as source -> IO (Result ClusterData) loadData master = readData master >>= return . parseData
145
loadData master = readData master >>= return . parseData
56
false
true
0
8
32
39
19
20
null
null
mchinen/cabal-macosx
Distribution/MacOSX/Dependencies.hs
bsd-3-clause
-- | Path to @install_name_tool@ tool. iTool :: FilePath iTool = "/usr/bin/install_name_tool"
93
iTool :: FilePath iTool = "/usr/bin/install_name_tool"
54
iTool = "/usr/bin/install_name_tool"
36
true
true
0
4
11
12
7
5
null
null
Tarrasch/Hong
Fal/Fal.hs
bsd-3-clause
trd3 (a, b, c) = c
18
trd3 (a, b, c) = c
18
trd3 (a, b, c) = c
18
false
false
0
6
5
18
10
8
null
null
giogadi/kdt
lib-src/Data/KdMap/Static.hs
mit
-- | Returns 'True' if the given 'KdMap' is empty. null :: KdMap a p v -> Bool null kdm = _size kdm == 0
104
null :: KdMap a p v -> Bool null kdm = _size kdm == 0
53
null kdm = _size kdm == 0
25
true
true
0
6
24
33
16
17
null
null
hvr/vector
Data/Vector/Generic.hs
bsd-3-clause
foldM_ m z = discard . Bundle.foldM m z . stream
48
foldM_ m z = discard . Bundle.foldM m z . stream
48
foldM_ m z = discard . Bundle.foldM m z . stream
48
false
false
0
8
10
26
12
14
null
null
pheaver/BitVector
Data/BitVector/BitVector1.hs
bsd-3-clause
neg :: Int -> BitVector -> BitVector neg w v = plus w True (bv_not v) 1
73
neg :: Int -> BitVector -> BitVector neg w v = plus w True (bv_not v) 1
73
neg w v = plus w True (bv_not v) 1
36
false
true
0
8
18
47
20
27
null
null
osa1/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
constDocs (BI i) = "An arbitrary-precision integer"
77
constDocs (BI i) = "An arbitrary-precision integer"
77
constDocs (BI i) = "An arbitrary-precision integer"
77
false
false
0
6
32
16
7
9
null
null
AndrewRademacher/hasql-postgres
library/Hasql/Postgres/ErrorCode.hs
mit
-- | Code \"2200C\". invalid_use_of_escape_character :: ErrorCode = "2200C"
96
invalid_use_of_escape_character :: ErrorCode = "2200C"
75
invalid_use_of_escape_character :: ErrorCode = "2200C"
75
true
false
0
5
29
12
6
6
null
null
ghc-android/ghc
compiler/typecheck/TcGenDeriv.hs
bsd-3-clause
ltAddr_RDR = varQual_RDR gHC_PRIM (fsLit "ltAddr#")
56
ltAddr_RDR = varQual_RDR gHC_PRIM (fsLit "ltAddr#")
56
ltAddr_RDR = varQual_RDR gHC_PRIM (fsLit "ltAddr#")
56
false
false
0
7
10
17
8
9
null
null
conal/monomorph
test/Examples.hs
bsd-3-clause
lifta2v8 = liftA2 :: LV N8
26
lifta2v8 = liftA2 :: LV N8
26
lifta2v8 = liftA2 :: LV N8
26
false
false
2
5
5
18
6
12
null
null
input-output-hk/pos-haskell-prototype
core/src/Pos/Core/Common/AddrStakeDistribution.hs
mit
mkMultiKeyDistr :: MonadError MultiKeyDistrError m => Map StakeholderId CoinPortion -> m AddrStakeDistribution mkMultiKeyDistr distrMap = UnsafeMultiKeyDistr distrMap <$ check where check = do when (null distrMap) $ throwError MkdMapIsEmpty when (length distrMap == 1) $ throwError MkdMapIsSingleton unless (all ((> 0) . getCoinPortion) distrMap) $ throwError MkdNegativePortion let distrSum = sum $ map getCoinPortion distrMap unless (distrSum == coinPortionDenominator) $ throwError MkdSumNot1
580
mkMultiKeyDistr :: MonadError MultiKeyDistrError m => Map StakeholderId CoinPortion -> m AddrStakeDistribution mkMultiKeyDistr distrMap = UnsafeMultiKeyDistr distrMap <$ check where check = do when (null distrMap) $ throwError MkdMapIsEmpty when (length distrMap == 1) $ throwError MkdMapIsSingleton unless (all ((> 0) . getCoinPortion) distrMap) $ throwError MkdNegativePortion let distrSum = sum $ map getCoinPortion distrMap unless (distrSum == coinPortionDenominator) $ throwError MkdSumNot1
580
mkMultiKeyDistr distrMap = UnsafeMultiKeyDistr distrMap <$ check where check = do when (null distrMap) $ throwError MkdMapIsEmpty when (length distrMap == 1) $ throwError MkdMapIsSingleton unless (all ((> 0) . getCoinPortion) distrMap) $ throwError MkdNegativePortion let distrSum = sum $ map getCoinPortion distrMap unless (distrSum == coinPortionDenominator) $ throwError MkdSumNot1
454
false
true
0
13
146
163
74
89
null
null
projectorhq/haskell-liquid
src/Text/Liquid/VariableFinder.hs
bsd-3-clause
-- | Find all the variables in a node's children, with a type scope findVariables :: StateT VType [] JsonVarPath -> Expr -> StateT VType [] JsonVarPath findVariables vs e = case e of (Variable v) -> return v `mplus` vs (Equal l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (NotEqual l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (GtEqual l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (LtEqual l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Gt l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Lt l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Or l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (And l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Contains l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Truthy t) -> put VBool >> findVariables vs t (IfClause i) -> findVariables vs i (IfKeyClause i) -> findVariables vs i (ElsIfClause i) -> findVariables vs i (Filter f xs) -> put VString >> findVariables mzero f `mplus` msum (findVariables mzero <$> xs) `mplus` vs (Output o) -> findVariables vs o (TrueStatements xs) -> msum (findVariables mzero <$> xs) `mplus` vs (IfLogic l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (CaseLogic c xts) -> let (ls, rs) = unzip xts in findVariables mzero c `mplus` msum (findVariables mzero <$> ls) `mplus` msum (findVariables mzero <$> rs) `mplus` vs _ -> vs -- | Find all context variables and add a sample filter. -- Designed to simulate required templates for aggregate contexts - see JsonTools
2,764
findVariables :: StateT VType [] JsonVarPath -> Expr -> StateT VType [] JsonVarPath findVariables vs e = case e of (Variable v) -> return v `mplus` vs (Equal l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (NotEqual l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (GtEqual l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (LtEqual l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Gt l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Lt l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Or l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (And l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Contains l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Truthy t) -> put VBool >> findVariables vs t (IfClause i) -> findVariables vs i (IfKeyClause i) -> findVariables vs i (ElsIfClause i) -> findVariables vs i (Filter f xs) -> put VString >> findVariables mzero f `mplus` msum (findVariables mzero <$> xs) `mplus` vs (Output o) -> findVariables vs o (TrueStatements xs) -> msum (findVariables mzero <$> xs) `mplus` vs (IfLogic l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (CaseLogic c xts) -> let (ls, rs) = unzip xts in findVariables mzero c `mplus` msum (findVariables mzero <$> ls) `mplus` msum (findVariables mzero <$> rs) `mplus` vs _ -> vs -- | Find all context variables and add a sample filter. -- Designed to simulate required templates for aggregate contexts - see JsonTools
2,696
findVariables vs e = case e of (Variable v) -> return v `mplus` vs (Equal l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (NotEqual l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (GtEqual l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (LtEqual l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Gt l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Lt l r) -> put VNumber >> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Or l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (And l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Contains l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (Truthy t) -> put VBool >> findVariables vs t (IfClause i) -> findVariables vs i (IfKeyClause i) -> findVariables vs i (ElsIfClause i) -> findVariables vs i (Filter f xs) -> put VString >> findVariables mzero f `mplus` msum (findVariables mzero <$> xs) `mplus` vs (Output o) -> findVariables vs o (TrueStatements xs) -> msum (findVariables mzero <$> xs) `mplus` vs (IfLogic l r) -> findVariables mzero l `mplus` findVariables mzero r `mplus` vs (CaseLogic c xts) -> let (ls, rs) = unzip xts in findVariables mzero c `mplus` msum (findVariables mzero <$> ls) `mplus` msum (findVariables mzero <$> rs) `mplus` vs _ -> vs -- | Find all context variables and add a sample filter. -- Designed to simulate required templates for aggregate contexts - see JsonTools
2,606
true
true
0
16
1,324
727
370
357
null
null
hnakamur/haskell-sandbox
sandbox-css/SandBox/Text/CSS/Parser.hs
bsd-3-clause
pageBreakAfterVal :: Stream s Identity Char => ParsecT s u Identity PageBreakAfterVal pageBreakAfterVal = choice [ try (keywordCase "auto") >> return PBAVAuto , try (keywordCase "always") >> return PBAVAlways , try (keywordCase "avoid") >> return PBAVAvoid , try (keywordCase "left") >> return PBAVLeft , try (keywordCase "right") >> return PBAVRight , try (keywordCase "inherit") >> return PBAVInherit ]
432
pageBreakAfterVal :: Stream s Identity Char => ParsecT s u Identity PageBreakAfterVal pageBreakAfterVal = choice [ try (keywordCase "auto") >> return PBAVAuto , try (keywordCase "always") >> return PBAVAlways , try (keywordCase "avoid") >> return PBAVAvoid , try (keywordCase "left") >> return PBAVLeft , try (keywordCase "right") >> return PBAVRight , try (keywordCase "inherit") >> return PBAVInherit ]
432
pageBreakAfterVal = choice [ try (keywordCase "auto") >> return PBAVAuto , try (keywordCase "always") >> return PBAVAlways , try (keywordCase "avoid") >> return PBAVAvoid , try (keywordCase "left") >> return PBAVLeft , try (keywordCase "right") >> return PBAVRight , try (keywordCase "inherit") >> return PBAVInherit ]
346
false
true
0
9
85
148
70
78
null
null
mzini/TcT
source/Tct/Utils/Xml/Encoding.hs
gpl-3.0
rule :: R.Rule -> Maybe Int -> F.Signature -> V.Variables -> XmlContent rule r mid sig vs = elt "rule" attribs [ elt "lhs" [] [term (R.lhs r) sig vs] , elt "rhs" [] [term (R.rhs r) sig vs]] where attribs = maybe [] (\n -> [ strAttrib "rid" (show n) ]) mid
277
rule :: R.Rule -> Maybe Int -> F.Signature -> V.Variables -> XmlContent rule r mid sig vs = elt "rule" attribs [ elt "lhs" [] [term (R.lhs r) sig vs] , elt "rhs" [] [term (R.rhs r) sig vs]] where attribs = maybe [] (\n -> [ strAttrib "rid" (show n) ]) mid
275
rule r mid sig vs = elt "rule" attribs [ elt "lhs" [] [term (R.lhs r) sig vs] , elt "rhs" [] [term (R.rhs r) sig vs]] where attribs = maybe [] (\n -> [ strAttrib "rid" (show n) ]) mid
203
false
true
0
11
74
152
75
77
null
null
wangbj/leet
150.hs
bsd-2-clause
isOp1 x = x `elem` "+-*/"
25
isOp1 x = x `elem` "+-*/"
25
isOp1 x = x `elem` "+-*/"
25
false
false
1
5
5
21
9
12
null
null
tolysz/prepare-ghcjs
spec-lts8/aeson/benchmarks/AesonCompareAutoInstances.hs
bsd-3-clause
thBigRecordToJSON :: BigRecord -> Value thBigRecordToJSON = $(mkToJSON opts ''BigRecord)
88
thBigRecordToJSON :: BigRecord -> Value thBigRecordToJSON = $(mkToJSON opts ''BigRecord)
88
thBigRecordToJSON = $(mkToJSON opts ''BigRecord)
48
false
true
0
8
9
26
13
13
null
null
senavi/haskell
chp7.hs
gpl-3.0
--all' f xs = filter f . [True | x <- xs, f x] --any' :: (a -> Bool) -> [Bool] -> Bool any' p = or . map p
109
any' p = or . map p
19
any' p = or . map p
19
true
false
2
5
32
23
9
14
null
null
osa1/vindinium
src/Vindinium/Api.hs
mit
startArena :: Vindinium State startArena = do url <- startUrl "arena" let obj = object [] time "start arena request" $ request url obj
147
startArena :: Vindinium State startArena = do url <- startUrl "arena" let obj = object [] time "start arena request" $ request url obj
147
startArena = do url <- startUrl "arena" let obj = object [] time "start arena request" $ request url obj
117
false
true
0
11
36
53
23
30
null
null
konn/gitolist
Handler/Repos.hs
bsd-2-clause
getCompressR :: String -> ObjPiece -> Handler RepTarball getCompressR repon (ObjPiece c path) = withRepo repon $ \git repo -> do tar <- liftIO $ tarGitPath git repo (joinPath $ c:path) setHeader "Content-Disposition" $ T.concat ["attachment; finename=\"", T.pack (repon ++ "-" ++ c), ".tar.gz\""] return $ RepTarball $ ContentSource $ LC.sourceList (LBS.toChunks tar) $= gzip $= LC.map (Chunk . fromByteString)
433
getCompressR :: String -> ObjPiece -> Handler RepTarball getCompressR repon (ObjPiece c path) = withRepo repon $ \git repo -> do tar <- liftIO $ tarGitPath git repo (joinPath $ c:path) setHeader "Content-Disposition" $ T.concat ["attachment; finename=\"", T.pack (repon ++ "-" ++ c), ".tar.gz\""] return $ RepTarball $ ContentSource $ LC.sourceList (LBS.toChunks tar) $= gzip $= LC.map (Chunk . fromByteString)
433
getCompressR repon (ObjPiece c path) = withRepo repon $ \git repo -> do tar <- liftIO $ tarGitPath git repo (joinPath $ c:path) setHeader "Content-Disposition" $ T.concat ["attachment; finename=\"", T.pack (repon ++ "-" ++ c), ".tar.gz\""] return $ RepTarball $ ContentSource $ LC.sourceList (LBS.toChunks tar) $= gzip $= LC.map (Chunk . fromByteString)
376
false
true
0
15
82
166
81
85
null
null
rueshyna/gogol
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
mpl-2.0
-- | Creates a value of 'OrderPromotion' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'opEffectiveDates' -- -- * 'opGenericRedemptionCode' -- -- * 'opRedemptionChannel' -- -- * 'opBenefits' -- -- * 'opLongTitle' -- -- * 'opId' -- -- * 'opProductApplicability' orderPromotion :: OrderPromotion orderPromotion = OrderPromotion' { _opEffectiveDates = Nothing , _opGenericRedemptionCode = Nothing , _opRedemptionChannel = Nothing , _opBenefits = Nothing , _opLongTitle = Nothing , _opId = Nothing , _opProductApplicability = Nothing }
658
orderPromotion :: OrderPromotion orderPromotion = OrderPromotion' { _opEffectiveDates = Nothing , _opGenericRedemptionCode = Nothing , _opRedemptionChannel = Nothing , _opBenefits = Nothing , _opLongTitle = Nothing , _opId = Nothing , _opProductApplicability = Nothing }
310
orderPromotion = OrderPromotion' { _opEffectiveDates = Nothing , _opGenericRedemptionCode = Nothing , _opRedemptionChannel = Nothing , _opBenefits = Nothing , _opLongTitle = Nothing , _opId = Nothing , _opProductApplicability = Nothing }
273
true
true
1
7
132
79
53
26
null
null
arirahikkala/straylight-divergence
src/Util.hs
gpl-3.0
foldM1 :: Monad m => (a -> a -> m a) -> [a] -> m a foldM1 f (x:xs) = foldM f x xs
81
foldM1 :: Monad m => (a -> a -> m a) -> [a] -> m a foldM1 f (x:xs) = foldM f x xs
81
foldM1 f (x:xs) = foldM f x xs
30
false
true
0
10
23
65
32
33
null
null
tamarin-prover/tamarin-prover
lib/term/src/Term/LTerm.hs
gpl-3.0
isPubVar _ = False
42
isPubVar _ = False
42
isPubVar _ = False
42
false
false
0
4
27
10
4
6
null
null
pittsburgh-haskell/haskell-intro-session
answersrc/Tutorial.hs
bsd-3-clause
-- -- Lazy -- -- | Only needs to evaluate the first 5 elements of -- infinite list of odds -- -- prop> sumFiveOdds == 1 + 3 + 5 + 7 + 9 sumFiveOdds :: Integer sumFiveOdds = sum (take 5 [1, 3..])
195
sumFiveOdds :: Integer sumFiveOdds = sum (take 5 [1, 3..])
58
sumFiveOdds = sum (take 5 [1, 3..])
35
true
true
0
8
44
42
23
19
null
null
aristidb/datastorage
src/TypedBinary.hs
bsd-3-clause
typeBuilder (TVariant cs) = fieldsBuilder '[' ']' cs
52
typeBuilder (TVariant cs) = fieldsBuilder '[' ']' cs
52
typeBuilder (TVariant cs) = fieldsBuilder '[' ']' cs
52
false
false
0
7
7
22
10
12
null
null
robstewart57/hdph-rs
src/Control/Parallel/HdpH/FTStrategies.hs
bsd-3-clause
lice :: Int -> [a] -> [[a]] slice n = transpose . chunk n
58
slice :: Int -> [a] -> [[a]] slice n = transpose . chunk n
58
slice n = transpose . chunk n
29
false
true
1
10
14
44
21
23
null
null
capital-match/hdo
src/Network/REST/Commands.hs
mit
waitFor :: (Monad m) => Int -> String -> RESTT m () waitFor delay message = liftF $ WaitFor delay message ()
108
waitFor :: (Monad m) => Int -> String -> RESTT m () waitFor delay message = liftF $ WaitFor delay message ()
108
waitFor delay message = liftF $ WaitFor delay message ()
56
false
true
0
9
21
53
26
27
null
null
mitchellwrosen/reddit-cli
src/Data/List/Zipper.hs
bsd-3-clause
zup z = z
9
zup z = z
9
zup z = z
9
false
false
0
5
3
9
4
5
null
null
contivero/hasmin
src/Hasmin/Types/Stylesheet.hs
bsd-3-clause
minifyRules :: [Rule] -> Reader Config [Rule] minifyRules = handleAdjacentMediaQueries >=> handleEmptyBlocks >=> mergeStyleRules >=> traverse minify -- minify rules individually where handleEmptyBlocks :: [Rule] -> Reader Config [Rule] handleEmptyBlocks rs = do conf <- ask pure $ if shouldRemoveEmptyBlocks conf then filter (not . isEmpty) rs else rs isEmpty :: Rule -> Bool isEmpty (StyleRule _ ds) = null ds isEmpty (AtMedia _ rs) = null rs || all isEmpty rs isEmpty (AtKeyframes _ _ kfbs) = null kfbs isEmpty (AtBlockWithDec _ ds) = null ds isEmpty (AtBlockWithRules _ rs) = null rs || all isEmpty rs isEmpty _ = False handleAdjacentMediaQueries :: [Rule] -> Reader Config [Rule] handleAdjacentMediaQueries rs = pure $ combineAdjacentMediaQueries rs where combineAdjacentMediaQueries :: [Rule] -> [Rule] combineAdjacentMediaQueries (a@(AtMedia mqs es) : b@(AtMedia mqs2 es2) : xs) | mqs == mqs2 = combineAdjacentMediaQueries (AtMedia mqs (es ++ es2) : xs) | otherwise = a : combineAdjacentMediaQueries (b:xs) combineAdjacentMediaQueries (x:xs) = x : combineAdjacentMediaQueries xs combineAdjacentMediaQueries [] = []
1,447
minifyRules :: [Rule] -> Reader Config [Rule] minifyRules = handleAdjacentMediaQueries >=> handleEmptyBlocks >=> mergeStyleRules >=> traverse minify -- minify rules individually where handleEmptyBlocks :: [Rule] -> Reader Config [Rule] handleEmptyBlocks rs = do conf <- ask pure $ if shouldRemoveEmptyBlocks conf then filter (not . isEmpty) rs else rs isEmpty :: Rule -> Bool isEmpty (StyleRule _ ds) = null ds isEmpty (AtMedia _ rs) = null rs || all isEmpty rs isEmpty (AtKeyframes _ _ kfbs) = null kfbs isEmpty (AtBlockWithDec _ ds) = null ds isEmpty (AtBlockWithRules _ rs) = null rs || all isEmpty rs isEmpty _ = False handleAdjacentMediaQueries :: [Rule] -> Reader Config [Rule] handleAdjacentMediaQueries rs = pure $ combineAdjacentMediaQueries rs where combineAdjacentMediaQueries :: [Rule] -> [Rule] combineAdjacentMediaQueries (a@(AtMedia mqs es) : b@(AtMedia mqs2 es2) : xs) | mqs == mqs2 = combineAdjacentMediaQueries (AtMedia mqs (es ++ es2) : xs) | otherwise = a : combineAdjacentMediaQueries (b:xs) combineAdjacentMediaQueries (x:xs) = x : combineAdjacentMediaQueries xs combineAdjacentMediaQueries [] = []
1,447
minifyRules = handleAdjacentMediaQueries >=> handleEmptyBlocks >=> mergeStyleRules >=> traverse minify -- minify rules individually where handleEmptyBlocks :: [Rule] -> Reader Config [Rule] handleEmptyBlocks rs = do conf <- ask pure $ if shouldRemoveEmptyBlocks conf then filter (not . isEmpty) rs else rs isEmpty :: Rule -> Bool isEmpty (StyleRule _ ds) = null ds isEmpty (AtMedia _ rs) = null rs || all isEmpty rs isEmpty (AtKeyframes _ _ kfbs) = null kfbs isEmpty (AtBlockWithDec _ ds) = null ds isEmpty (AtBlockWithRules _ rs) = null rs || all isEmpty rs isEmpty _ = False handleAdjacentMediaQueries :: [Rule] -> Reader Config [Rule] handleAdjacentMediaQueries rs = pure $ combineAdjacentMediaQueries rs where combineAdjacentMediaQueries :: [Rule] -> [Rule] combineAdjacentMediaQueries (a@(AtMedia mqs es) : b@(AtMedia mqs2 es2) : xs) | mqs == mqs2 = combineAdjacentMediaQueries (AtMedia mqs (es ++ es2) : xs) | otherwise = a : combineAdjacentMediaQueries (b:xs) combineAdjacentMediaQueries (x:xs) = x : combineAdjacentMediaQueries xs combineAdjacentMediaQueries [] = []
1,401
false
true
31
11
489
419
215
204
null
null
allanderek/ipclib
Language/Pepa/Probes/Syntax.hs
gpl-2.0
beginsWithLabel (SPzoo r ) = beginsWithLabel r
50
beginsWithLabel (SPzoo r ) = beginsWithLabel r
50
beginsWithLabel (SPzoo r ) = beginsWithLabel r
50
false
false
0
6
10
19
8
11
null
null
uuhan/Idris-dev
src/Idris/Options.hs
bsd-3-clause
getTriple :: Opt -> Maybe String getTriple (TargetTriple x) = Just x
68
getTriple :: Opt -> Maybe String getTriple (TargetTriple x) = Just x
68
getTriple (TargetTriple x) = Just x
35
false
true
0
9
11
34
15
19
null
null
mightybyte/reflex
src/Reflex/Class.hs
bsd-3-clause
traceEventWith :: Reflex t => (a -> String) -> Event t a -> Event t a traceEventWith f = push $ \x -> trace (f x) $ return $ Just x
131
traceEventWith :: Reflex t => (a -> String) -> Event t a -> Event t a traceEventWith f = push $ \x -> trace (f x) $ return $ Just x
131
traceEventWith f = push $ \x -> trace (f x) $ return $ Just x
61
false
true
0
11
30
75
36
39
null
null
kovach/web2
src/Index.hs
mit
indexRule :: Rule -> Index indexRule rule = insertRule rule emptyIndex
70
indexRule :: Rule -> Index indexRule rule = insertRule rule emptyIndex
70
indexRule rule = insertRule rule emptyIndex
43
false
true
0
5
10
23
11
12
null
null
danfran/feed
src/Text/RSS1/Export.hs
bsd-3-clause
xmlContentItems xs = [qualNode (conNS,conPrefix) "items" [Elem $ qualNode (rdfNS,rdfPrefix) "Bag" (map (\ e -> Elem (qualNode (rdfNS,rdfPrefix) "li" [Elem (xmlContentInfo e)])) xs)]]
221
xmlContentItems xs = [qualNode (conNS,conPrefix) "items" [Elem $ qualNode (rdfNS,rdfPrefix) "Bag" (map (\ e -> Elem (qualNode (rdfNS,rdfPrefix) "li" [Elem (xmlContentInfo e)])) xs)]]
221
xmlContentItems xs = [qualNode (conNS,conPrefix) "items" [Elem $ qualNode (rdfNS,rdfPrefix) "Bag" (map (\ e -> Elem (qualNode (rdfNS,rdfPrefix) "li" [Elem (xmlContentInfo e)])) xs)]]
221
false
false
0
20
61
92
49
43
null
null
malie/drolesat
Testing.hs
bsd-3-clause
printModel :: Model -> IO () printModel = print . L.sortBy (comparing abs) . S.toList
85
printModel :: Model -> IO () printModel = print . L.sortBy (comparing abs) . S.toList
85
printModel = print . L.sortBy (comparing abs) . S.toList
56
false
true
1
8
14
48
21
27
null
null
HuwCampbell/grenade
src/Grenade/Layers/Tanh.hs
bsd-2-clause
tanh' :: (Floating a) => a -> a tanh' t = 1 - s ^ (2 :: Int) where s = tanh t
78
tanh' :: (Floating a) => a -> a tanh' t = 1 - s ^ (2 :: Int) where s = tanh t
78
tanh' t = 1 - s ^ (2 :: Int) where s = tanh t
46
false
true
0
7
23
51
27
24
null
null
RobinKrom/fasths
src/Codec/Fast/Encoder.hs
bsd-3-clause
intF2Cop' (FieldInstrContent _ (Just Optional) (Just (Default Nothing))) = cp where cp (Just i) = lift (setPMap True) >> return (encodeP0 i) cp (Nothing) = lift $ setPMap False >> return BU.empty -- pm: Yes, Nullable: Yes
262
intF2Cop' (FieldInstrContent _ (Just Optional) (Just (Default Nothing))) = cp where cp (Just i) = lift (setPMap True) >> return (encodeP0 i) cp (Nothing) = lift $ setPMap False >> return BU.empty -- pm: Yes, Nullable: Yes
262
intF2Cop' (FieldInstrContent _ (Just Optional) (Just (Default Nothing))) = cp where cp (Just i) = lift (setPMap True) >> return (encodeP0 i) cp (Nothing) = lift $ setPMap False >> return BU.empty -- pm: Yes, Nullable: Yes
262
false
false
0
10
77
107
50
57
null
null
Mathnerd314/lamdu
src/Lamdu/CodeEdit/ExpressionEdit/HoleEdit.hs
gpl-3.0
-- TODO: Use this where the hiState is currently used to get the -- search term searchTermProperty :: HoleInfo m -> Property (T m) String searchTermProperty holeInfo = Property.composeLens hsSearchTerm $ hiState holeInfo
222
searchTermProperty :: HoleInfo m -> Property (T m) String searchTermProperty holeInfo = Property.composeLens hsSearchTerm $ hiState holeInfo
142
searchTermProperty holeInfo = Property.composeLens hsSearchTerm $ hiState holeInfo
84
true
true
0
9
34
50
23
27
null
null
ailiev/faerieplay-compiler
Faerieplay/Unroll.hs
bsd-3-clause
unroll s@(SBlock _ _) = genericUnroll unrollBlock s where unrollBlock scope (SBlock locals stms) = -- replace all local variables with Scoped ones, in stms return $ map (scopeVars locals scope) stms
230
unroll s@(SBlock _ _) = genericUnroll unrollBlock s where unrollBlock scope (SBlock locals stms) = -- replace all local variables with Scoped ones, in stms return $ map (scopeVars locals scope) stms
230
unroll s@(SBlock _ _) = genericUnroll unrollBlock s where unrollBlock scope (SBlock locals stms) = -- replace all local variables with Scoped ones, in stms return $ map (scopeVars locals scope) stms
230
false
false
0
10
63
63
31
32
null
null
TomMD/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
c1TyConName = tcQual gHC_GENERICS (fsLit "C1") c1TyConKey
58
c1TyConName = tcQual gHC_GENERICS (fsLit "C1") c1TyConKey
58
c1TyConName = tcQual gHC_GENERICS (fsLit "C1") c1TyConKey
58
false
false
0
7
7
19
9
10
null
null
pepeiborra/narradar
src/Narradar/Types/ArgumentFiltering.hs
bsd-3-clause
predHeuOne strat pred = f where f _ _ [] = mempty f af t pos = maybe mempty Set.singleton $ find (pred af) (strat af t pos)
129
predHeuOne strat pred = f where f _ _ [] = mempty f af t pos = maybe mempty Set.singleton $ find (pred af) (strat af t pos)
129
predHeuOne strat pred = f where f _ _ [] = mempty f af t pos = maybe mempty Set.singleton $ find (pred af) (strat af t pos)
129
false
false
0
10
33
72
34
38
null
null
JacquesCarette/literate-scientific-software
code/drasil-gool/GOOL/Drasil/LanguageRenderer.hs
bsd-2-clause
listDecDocD :: (RenderSym repr) => repr (Variable repr) -> repr (Value repr) -> Doc listDecDocD v n = space <> equals <+> new <+> getTypeDoc (variableType v) <> parens (valueDoc n)
186
listDecDocD :: (RenderSym repr) => repr (Variable repr) -> repr (Value repr) -> Doc listDecDocD v n = space <> equals <+> new <+> getTypeDoc (variableType v) <> parens (valueDoc n)
186
listDecDocD v n = space <> equals <+> new <+> getTypeDoc (variableType v) <> parens (valueDoc n)
99
false
true
2
10
36
86
41
45
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/maximum_5.hs
mit
not MyFalse = MyTrue
20
not MyFalse = MyTrue
20
not MyFalse = MyTrue
20
false
false
0
5
3
9
4
5
null
null
mdietz94/haskellgame
src/Base/InputHandler.hs
mit
initialize :: IO (Bool,KeyboardState) initialize = do SDL.enableKeyRepeat 0 0 update initialKeyboardState
113
initialize :: IO (Bool,KeyboardState) initialize = do SDL.enableKeyRepeat 0 0 update initialKeyboardState
113
initialize = do SDL.enableKeyRepeat 0 0 update initialKeyboardState
75
false
true
0
8
19
36
17
19
null
null
sdiehl/ghc
compiler/nativeGen/BlockLayout.hs
bsd-3-clause
-- the first block is the entry point ==> it must remain at the start. sccBlocks :: Instruction instr => Maybe CFG -> [NatBasicBlock instr] -> [SCC (Node BlockId (NatBasicBlock instr))] sccBlocks edgeWeights blocks = stronglyConnCompFromEdgedVerticesUniqR (map (mkNode edgeWeights) blocks)
326
sccBlocks :: Instruction instr => Maybe CFG -> [NatBasicBlock instr] -> [SCC (Node BlockId (NatBasicBlock instr))] sccBlocks edgeWeights blocks = stronglyConnCompFromEdgedVerticesUniqR (map (mkNode edgeWeights) blocks)
254
sccBlocks edgeWeights blocks = stronglyConnCompFromEdgedVerticesUniqR (map (mkNode edgeWeights) blocks)
115
true
true
0
15
76
84
39
45
null
null
bgamari/criterion
Criterion/Main.hs
bsd-2-clause
-- | Create a function that can tell if a name given on the command -- line matches a benchmark. makeMatcher :: MatchType -> [String] -- ^ Command line arguments. -> Either String (String -> Bool) makeMatcher matchKind args = case matchKind of Prefix -> Right $ \b -> null args || any (`isPrefixOf` b) args Glob -> let compOptions = compDefault { errorRecovery = False } in case mapM (tryCompileWith compOptions) args of Left errMsg -> Left . fromMaybe errMsg . stripPrefix "compile :: " $ errMsg Right ps -> Right $ \b -> null ps || any (`match` b) ps Pattern -> Right $ \b -> null args || any (`isInfixOf` b) args IPattern -> Right $ \b -> null args || any (`isInfixOf` map toLower b) (map (map toLower) args)
825
makeMatcher :: MatchType -> [String] -- ^ Command line arguments. -> Either String (String -> Bool) makeMatcher matchKind args = case matchKind of Prefix -> Right $ \b -> null args || any (`isPrefixOf` b) args Glob -> let compOptions = compDefault { errorRecovery = False } in case mapM (tryCompileWith compOptions) args of Left errMsg -> Left . fromMaybe errMsg . stripPrefix "compile :: " $ errMsg Right ps -> Right $ \b -> null ps || any (`match` b) ps Pattern -> Right $ \b -> null args || any (`isInfixOf` b) args IPattern -> Right $ \b -> null args || any (`isInfixOf` map toLower b) (map (map toLower) args)
728
makeMatcher matchKind args = case matchKind of Prefix -> Right $ \b -> null args || any (`isPrefixOf` b) args Glob -> let compOptions = compDefault { errorRecovery = False } in case mapM (tryCompileWith compOptions) args of Left errMsg -> Left . fromMaybe errMsg . stripPrefix "compile :: " $ errMsg Right ps -> Right $ \b -> null ps || any (`match` b) ps Pattern -> Right $ \b -> null args || any (`isInfixOf` b) args IPattern -> Right $ \b -> null args || any (`isInfixOf` map toLower b) (map (map toLower) args)
592
true
true
4
15
246
274
139
135
null
null
maque/Hate
samples/sample_scheduler.hs
mit
sampleLoad :: LoadFn SampleState sampleLoad = return $ SampleState 0 emptyScheduler True
88
sampleLoad :: LoadFn SampleState sampleLoad = return $ SampleState 0 emptyScheduler True
88
sampleLoad = return $ SampleState 0 emptyScheduler True
55
false
true
0
6
11
25
12
13
null
null
tekul/cryptonite
tests/KAT_TripleDES.hs
bsd-3-clause
tests = localOption (QuickCheckTests 5) $ testBlockCipher kats (undefined :: TripleDES.DES_EEE3)
102
tests = localOption (QuickCheckTests 5) $ testBlockCipher kats (undefined :: TripleDES.DES_EEE3)
102
tests = localOption (QuickCheckTests 5) $ testBlockCipher kats (undefined :: TripleDES.DES_EEE3)
102
false
false
3
8
16
34
15
19
null
null
jfranklin9000/urbit
pkg/hs/urbit-atom/lib/Urbit/Atom/Fast.hs
mit
importBytes :: ByteString -> Natural importBytes = go . stripBytes where go (BS.PS fp 0 sz) = unsafePerformIO $ do let Ptr a = Ptr.unsafeForeignPtrToPtr fp -- TODO Not safe! let W# sz# = fromIntegral sz res <- bigNatNatural <$> G.importBigNatFromAddr a sz# 0# Ptr.touchForeignPtr fp pure res -- TODO Avoid this extra copy when given a slice. Should be able to -- just offset the raw pointer. go bs = importBytes (BS.copy bs)
455
importBytes :: ByteString -> Natural importBytes = go . stripBytes where go (BS.PS fp 0 sz) = unsafePerformIO $ do let Ptr a = Ptr.unsafeForeignPtrToPtr fp -- TODO Not safe! let W# sz# = fromIntegral sz res <- bigNatNatural <$> G.importBigNatFromAddr a sz# 0# Ptr.touchForeignPtr fp pure res -- TODO Avoid this extra copy when given a slice. Should be able to -- just offset the raw pointer. go bs = importBytes (BS.copy bs)
455
importBytes = go . stripBytes where go (BS.PS fp 0 sz) = unsafePerformIO $ do let Ptr a = Ptr.unsafeForeignPtrToPtr fp -- TODO Not safe! let W# sz# = fromIntegral sz res <- bigNatNatural <$> G.importBigNatFromAddr a sz# 0# Ptr.touchForeignPtr fp pure res -- TODO Avoid this extra copy when given a slice. Should be able to -- just offset the raw pointer. go bs = importBytes (BS.copy bs)
418
false
true
0
12
104
136
62
74
null
null
FranklinChen/hugs98-plus-Sep2006
packages/GLUT/examples/RedBook/TessWind.hs
bsd-3-clause
noOpCombiner :: Combiner DontCare noOpCombiner _newVertex _weightedProperties = 0
81
noOpCombiner :: Combiner DontCare noOpCombiner _newVertex _weightedProperties = 0
81
noOpCombiner _newVertex _weightedProperties = 0
47
false
true
0
5
8
19
9
10
null
null
comonoidial/ALFIN
Alfin/CoreLowering.hs
mit
lowerSubExp :: [(String,ShapeType)] -> SCExp -> NameGen ([FunDef], ([TopExp -> TopExp], SimpleExp)) lowerSubExp _ (SCVar n) = return ([], ([], VarExp n))
155
lowerSubExp :: [(String,ShapeType)] -> SCExp -> NameGen ([FunDef], ([TopExp -> TopExp], SimpleExp)) lowerSubExp _ (SCVar n) = return ([], ([], VarExp n))
155
lowerSubExp _ (SCVar n) = return ([], ([], VarExp n))
55
false
true
0
11
23
86
48
38
null
null
pikajude/kevin
src/Kevin/Util/Logger.hs
gpl-3.0
interleave [] ys = ys
21
interleave [] ys = ys
21
interleave [] ys = ys
21
false
false
0
5
4
14
6
8
null
null
iostat/imperator
src/Imperator/Syntax.hs
bsd-3-clause
-- lower a BoolOp from its AST rep into a haskell function lowerBoolOp :: BoolOp -> (Bool -> Bool -> Bool) lowerBoolOp BoolAnd = (&&)
133
lowerBoolOp :: BoolOp -> (Bool -> Bool -> Bool) lowerBoolOp BoolAnd = (&&)
74
lowerBoolOp BoolAnd = (&&)
26
true
true
0
8
24
32
18
14
null
null
Oscarzhao/haskell
functional_program_design/ch01/convert.hs
apache-2.0
convert 13 = "thirteen"
23
convert 13 = "thirteen"
23
convert 13 = "thirteen"
23
false
false
0
5
3
9
4
5
null
null
mattraibert/codetest
src/Person/Parse.hs
gpl-3.0
parseText :: Parse p => Text -> Maybe p parseText = parse . T.unpack
68
parseText :: Parse p => Text -> Maybe p parseText = parse . T.unpack
68
parseText = parse . T.unpack
28
false
true
0
7
13
31
15
16
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/SVGPathSegMovetoRel.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGPathSegMovetoRel.x Mozilla SVGPathSegMovetoRel.x documentation> getX :: (MonadDOM m) => SVGPathSegMovetoRel -> m Float getX self = liftDOM (realToFrac <$> ((self ^. js "x") >>= valToNumber))
251
getX :: (MonadDOM m) => SVGPathSegMovetoRel -> m Float getX self = liftDOM (realToFrac <$> ((self ^. js "x") >>= valToNumber))
128
getX self = liftDOM (realToFrac <$> ((self ^. js "x") >>= valToNumber))
73
true
true
0
12
29
58
30
28
null
null
axman6/HaskellMR
src/Raft/Store/AcidState.hs
mit
runAcidStateStore (Free x) = case x of CS.LogQuery ix cont -> do AcidStateStore st <- get runAcidStateStore . cont =<< query' st (QueryST ix) CS.LogStore ix term xs next -> do AcidStateStore st <- get update' st (AppendST ix term (Fold.toList xs)) runAcidStateStore next CS.LogCommit ix next -> do AcidStateStore st <- get update' st (CommitST ix) runAcidStateStore next CS.LogTruncate ix next -> do AcidStateStore st <- get update' st (TruncateST ix) runAcidStateStore next
586
runAcidStateStore (Free x) = case x of CS.LogQuery ix cont -> do AcidStateStore st <- get runAcidStateStore . cont =<< query' st (QueryST ix) CS.LogStore ix term xs next -> do AcidStateStore st <- get update' st (AppendST ix term (Fold.toList xs)) runAcidStateStore next CS.LogCommit ix next -> do AcidStateStore st <- get update' st (CommitST ix) runAcidStateStore next CS.LogTruncate ix next -> do AcidStateStore st <- get update' st (TruncateST ix) runAcidStateStore next
586
runAcidStateStore (Free x) = case x of CS.LogQuery ix cont -> do AcidStateStore st <- get runAcidStateStore . cont =<< query' st (QueryST ix) CS.LogStore ix term xs next -> do AcidStateStore st <- get update' st (AppendST ix term (Fold.toList xs)) runAcidStateStore next CS.LogCommit ix next -> do AcidStateStore st <- get update' st (CommitST ix) runAcidStateStore next CS.LogTruncate ix next -> do AcidStateStore st <- get update' st (TruncateST ix) runAcidStateStore next
586
false
false
0
15
185
209
91
118
null
null
izgzhen/hadrian
src/Way.hs
mit
-- | Build with profiling. profiling :: Way profiling = wayFromUnits [Profiling]
80
profiling :: Way profiling = wayFromUnits [Profiling]
53
profiling = wayFromUnits [Profiling]
36
true
true
0
6
11
24
11
13
null
null
osa1/chsc
Core/Parser.hs
bsd-3-clause
freshFloatName :: String -> Term -> ParseM (Maybe (Var, Term), Name) freshFloatName _ (Identity (Var x)) = return (Nothing, x)
126
freshFloatName :: String -> Term -> ParseM (Maybe (Var, Term), Name) freshFloatName _ (Identity (Var x)) = return (Nothing, x)
126
freshFloatName _ (Identity (Var x)) = return (Nothing, x)
57
false
true
0
10
19
63
33
30
null
null
romanb/amazonka
amazonka-ec2/gen/Network/AWS/EC2/Types.hs
mpl-2.0
-- | 'RecurringCharge' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'rcAmount' @::@ 'Maybe' 'Double' -- -- * 'rcFrequency' @::@ 'Maybe' 'RecurringChargeFrequency' -- recurringCharge :: RecurringCharge recurringCharge = RecurringCharge { _rcFrequency = Nothing , _rcAmount = Nothing }
336
recurringCharge :: RecurringCharge recurringCharge = RecurringCharge { _rcFrequency = Nothing , _rcAmount = Nothing }
132
recurringCharge = RecurringCharge { _rcFrequency = Nothing , _rcAmount = Nothing }
97
true
true
0
7
57
43
25
18
null
null
mdsteele/pylos
src/Pylos/Game.hs
gpl-3.0
setRemovals :: [Coords] -> Move -> Move setRemovals removals (PlaceMove c _) = PlaceMove c removals
99
setRemovals :: [Coords] -> Move -> Move setRemovals removals (PlaceMove c _) = PlaceMove c removals
99
setRemovals removals (PlaceMove c _) = PlaceMove c removals
59
false
true
0
7
15
40
20
20
null
null
abooij/cubicaltt
Eval.hs
mit
v @@ phi | isNeutral v = case (inferType v,toFormula phi) of (VIdP _ a0 _,Dir 0) -> a0 (VIdP _ _ a1,Dir 1) -> a1 _ -> VAppFormula v (toFormula phi)
178
v @@ phi | isNeutral v = case (inferType v,toFormula phi) of (VIdP _ a0 _,Dir 0) -> a0 (VIdP _ _ a1,Dir 1) -> a1 _ -> VAppFormula v (toFormula phi)
178
v @@ phi | isNeutral v = case (inferType v,toFormula phi) of (VIdP _ a0 _,Dir 0) -> a0 (VIdP _ _ a1,Dir 1) -> a1 _ -> VAppFormula v (toFormula phi)
178
false
false
7
8
62
101
47
54
null
null
gnn/Hets
OWL2/AS.hs
gpl-2.0
abDec :: DecLit -> DecLit abDec dec = dec {truncDec = abInt $ truncDec dec}
75
abDec :: DecLit -> DecLit abDec dec = dec {truncDec = abInt $ truncDec dec}
75
abDec dec = dec {truncDec = abInt $ truncDec dec}
49
false
true
0
9
14
42
19
23
null
null
GaloisInc/HaNS
src/Hans/Buffer/Datagram.hs
bsd-3-clause
emptyBufContents :: Int -> BufContents a emptyBufContents bufAvail = BufContents { bufChunks = Seq.empty, .. }
110
emptyBufContents :: Int -> BufContents a emptyBufContents bufAvail = BufContents { bufChunks = Seq.empty, .. }
110
emptyBufContents bufAvail = BufContents { bufChunks = Seq.empty, .. }
69
false
true
0
7
15
34
18
16
null
null
sixohsix/tak
src/Tak/Buffer/Line.hs
mit
charWidth :: Char -> Int charWidth c | c == '\t' = 8 | ord c < 255 = 1 | otherwise = wcwidthSafe c
108
charWidth :: Char -> Int charWidth c | c == '\t' = 8 | ord c < 255 = 1 | otherwise = wcwidthSafe c
108
charWidth c | c == '\t' = 8 | ord c < 255 = 1 | otherwise = wcwidthSafe c
83
false
true
0
9
34
66
28
38
null
null
naoto-ogawa/h-xproto-mysql
src/DataBase/MySQLX/Statement.hs
mit
-- ----------------------------------------------------------------------------- -- -- ----------------------------------------------------------------------------- -- | Generic Sql execution sendStmtExecuteSql :: (MonadIO m) => String -- ^ SQL statment -> [PA.Any] -- ^ bind parameters -> ReaderT NodeSession m () sendStmtExecuteSql sql args = writeMessageR $ mkStmtExecuteSql sql args
457
sendStmtExecuteSql :: (MonadIO m) => String -- ^ SQL statment -> [PA.Any] -- ^ bind parameters -> ReaderT NodeSession m () sendStmtExecuteSql sql args = writeMessageR $ mkStmtExecuteSql sql args
262
sendStmtExecuteSql sql args = writeMessageR $ mkStmtExecuteSql sql args
72
true
true
0
9
110
62
34
28
null
null
dpieroux/euler
0/0059.hs
mit
decodedMsg = decrypt (map ord "god") theMsg
43
decodedMsg = decrypt (map ord "god") theMsg
43
decodedMsg = decrypt (map ord "god") theMsg
43
false
false
1
7
6
23
9
14
null
null
SRechenberger/grammata
src/Grammata/Machine.hs
gpl-3.0
fLet :: () => [(Ident, CoreLambda m)] -- ^ Identifier ii and expression ei. -> CoreLambda m -- ^ Expression e. -> CoreLambda m -- ^ Letrec expression. fLet = FLet
216
fLet :: () => [(Ident, CoreLambda m)] -- ^ Identifier ii and expression ei. -> CoreLambda m -- ^ Expression e. -> CoreLambda m fLet = FLet
176
fLet = FLet
11
true
true
0
10
84
50
26
24
null
null
mettekou/ghc
compiler/simplCore/CoreMonad.hs
bsd-3-clause
pprTickCts (CaseElim v) = ppr v
47
pprTickCts (CaseElim v) = ppr v
47
pprTickCts (CaseElim v) = ppr v
47
false
false
0
7
21
18
8
10
null
null
qfjp/csce_dfa_project_test
src/ProjectTest.hs
bsd-3-clause
progName :: ProgramOutput -> T.Text progName (x, (_, _, _)) = T.pack x
70
progName :: ProgramOutput -> T.Text progName (x, (_, _, _)) = T.pack x
70
progName (x, (_, _, _)) = T.pack x
34
false
true
0
7
12
40
22
18
null
null
robeverest/accelerate-fft
Data/Array/Accelerate/Math/DFT/Centre.hs
bsd-3-clause
fftShift2D :: Elt e => Acc (Array DIM2 e) -> Acc (Array DIM2 e) fftShift2D arr = A.backpermute (A.shape arr) p arr where p ix = let Z:.y:.x = unlift ix :: Z :. Exp Int :. Exp Int in index2 (y <* mh ? (y + mh, y - mh)) (x <* mw ? (x + mw, x - mw)) Z:.h:.w = unlift (A.shape arr) (mh,mw) = (h `div` 2, w `div` 2) -- | Apply the shifting transform to a 3D array
407
fftShift2D :: Elt e => Acc (Array DIM2 e) -> Acc (Array DIM2 e) fftShift2D arr = A.backpermute (A.shape arr) p arr where p ix = let Z:.y:.x = unlift ix :: Z :. Exp Int :. Exp Int in index2 (y <* mh ? (y + mh, y - mh)) (x <* mw ? (x + mw, x - mw)) Z:.h:.w = unlift (A.shape arr) (mh,mw) = (h `div` 2, w `div` 2) -- | Apply the shifting transform to a 3D array
407
fftShift2D arr = A.backpermute (A.shape arr) p arr where p ix = let Z:.y:.x = unlift ix :: Z :. Exp Int :. Exp Int in index2 (y <* mh ? (y + mh, y - mh)) (x <* mw ? (x + mw, x - mw)) Z:.h:.w = unlift (A.shape arr) (mh,mw) = (h `div` 2, w `div` 2) -- | Apply the shifting transform to a 3D array
343
false
true
3
11
132
232
115
117
null
null
urbanslug/ghc
compiler/prelude/THNames.hs
bsd-3-clause
liftIdKey = mkPreludeMiscIdUnique 203
47
liftIdKey = mkPreludeMiscIdUnique 203
47
liftIdKey = mkPreludeMiscIdUnique 203
47
false
false
1
5
13
12
4
8
null
null
paulbarbu/ePseudocode
src/EPseudocode/Evaluator.hs
bsd-3-clause
-- FIXME: translate evalBinExpr env (BinExpr Lt a b) = do (_, l) <- eval env $ E a (_, r) <- eval env $ E b v <- lt env l r return (env, Bool v)
161
evalBinExpr env (BinExpr Lt a b) = do (_, l) <- eval env $ E a (_, r) <- eval env $ E b v <- lt env l r return (env, Bool v)
140
evalBinExpr env (BinExpr Lt a b) = do (_, l) <- eval env $ E a (_, r) <- eval env $ E b v <- lt env l r return (env, Bool v)
140
true
false
0
9
53
97
46
51
null
null
rimmington/eclogues
eclogues-impl/app/api/Eclogues/State.hs
bsd-3-clause
createContainer :: (TS m, MonadError JobError m) => Job.ContainerId -> UUID -> m () createContainer name uuid = do flip when (throwError NameUsed) . has _Just =<< ES.containerUUID name ES.insertContainer name uuid
221
createContainer :: (TS m, MonadError JobError m) => Job.ContainerId -> UUID -> m () createContainer name uuid = do flip when (throwError NameUsed) . has _Just =<< ES.containerUUID name ES.insertContainer name uuid
221
createContainer name uuid = do flip when (throwError NameUsed) . has _Just =<< ES.containerUUID name ES.insertContainer name uuid
137
false
true
0
12
39
93
42
51
null
null
frontrowed/stratosphere
library-gen/Stratosphere/Resources/ElasticLoadBalancingLoadBalancer.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-elb.html#cfn-ec2-elb-accessloggingpolicy elblbAccessLoggingPolicy :: Lens' ElasticLoadBalancingLoadBalancer (Maybe ElasticLoadBalancingLoadBalancerAccessLoggingPolicy) elblbAccessLoggingPolicy = lens _elasticLoadBalancingLoadBalancerAccessLoggingPolicy (\s a -> s { _elasticLoadBalancingLoadBalancerAccessLoggingPolicy = a })
411
elblbAccessLoggingPolicy :: Lens' ElasticLoadBalancingLoadBalancer (Maybe ElasticLoadBalancingLoadBalancerAccessLoggingPolicy) elblbAccessLoggingPolicy = lens _elasticLoadBalancingLoadBalancerAccessLoggingPolicy (\s a -> s { _elasticLoadBalancingLoadBalancerAccessLoggingPolicy = a })
284
elblbAccessLoggingPolicy = lens _elasticLoadBalancingLoadBalancerAccessLoggingPolicy (\s a -> s { _elasticLoadBalancingLoadBalancerAccessLoggingPolicy = a })
157
true
true
0
9
21
46
25
21
null
null
wavewave/lhc-analysis-collection
exe/evchainRunXQLD_sqsg.hs
gpl-3.0
worksets = [ (mgl,msq,50000,50000, 10000) | mgl <- [100,200..2000], msq <- [100,200..2000] ]
92
worksets = [ (mgl,msq,50000,50000, 10000) | mgl <- [100,200..2000], msq <- [100,200..2000] ]
92
worksets = [ (mgl,msq,50000,50000, 10000) | mgl <- [100,200..2000], msq <- [100,200..2000] ]
92
false
false
0
8
12
56
33
23
null
null
dmjio/miso
src/Miso/Svg/Element.hs
bsd-3-clause
-- | <https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polyline> polyline_ :: [Attribute action] -> [View action] -> View action polyline_ = nodeSvg_ "polyline"
168
polyline_ :: [Attribute action] -> [View action] -> View action polyline_ = nodeSvg_ "polyline"
95
polyline_ = nodeSvg_ "polyline"
31
true
true
0
8
16
38
19
19
null
null
fmthoma/ghc
compiler/coreSyn/CoreUtils.hs
bsd-3-clause
isDivOp DoubleDivOp = True
31
isDivOp DoubleDivOp = True
31
isDivOp DoubleDivOp = True
31
false
false
1
5
8
13
4
9
null
null
spechub/Hets
CSL/AS_BASIC_CSL.hs
gpl-2.0
fromFraction :: Integer -> Integer -> APFloat fromFraction = (%)
64
fromFraction :: Integer -> Integer -> APFloat fromFraction = (%)
64
fromFraction = (%)
18
false
true
0
8
9
28
13
15
null
null
sopvop/cabal
Cabal/Distribution/Simple/HaskellSuite.hs
bsd-3-clause
packageDbOpt UserPackageDB = "--user"
46
packageDbOpt UserPackageDB = "--user"
46
packageDbOpt UserPackageDB = "--user"
46
false
false
0
5
12
9
4
5
null
null
fpco/statistics
Statistics/Quantile.hs
bsd-2-clause
-- | Definition used by the SPSS statistics application, with /a/=0, -- /b/=0 (also known as Weibull's definition). This corresponds to -- method 6 in R and Mathematica. spss :: ContParam spss = ContParam 0 0
209
spss :: ContParam spss = ContParam 0 0
38
spss = ContParam 0 0
20
true
true
0
5
36
19
11
8
null
null
achirkin/qua-view
src/Commons/QuaViewMonad.hs
mit
initQuaViewContext :: ( MonadIO m, MonadFix m, HasJSContext m , MonadHold (SpiderTimeline Global) m , TriggerEvent (SpiderTimeline Global) m , PerformEvent (SpiderTimeline Global) m , MonadIO (Performable m) , Reflex t ) => QuaViewEvents t -> m (QuaViewContext t) initQuaViewContext quaViewEvents = do -- This is when qua-view starts, so we don't have any loggers and etc. set up. -- Following functions are used to log things happening at this initialization step. let initLogErr m = stdOutLogger LevelWarn "initQuaViewContext" m Nothing initLogInfo m = stdOutLogger LevelInfo "initQuaViewContext" m . Just . pToJSVal . toJSON quaViewLoggerFunc = stdOutLogger guessedSettings <- liftIO $ unsafeInterleaveIO guessQuaSettings -- try to get settings url from meta tag in an html page -- <meta property="qua-view:settingsUrl" content="{settingsUrl}"> mRequestedSettingsE <- runMaybeT $ do doc <- MaybeT currentDocument settingsEl <- MaybeT $ querySelector doc ("meta[property='qua-view:settingsUrl']" :: JSString) url <- MaybeT $ getAttribute settingsEl ("content" :: JSString) setsE <- liftIO newEmptyMVar lift . httpGetNow' url $ putMVar setsE MaybeT . liftIO . unsafeInterleaveIO $ takeMVar setsE >>= \e -> case e of Left (JSError err) -> Nothing <$ initLogErr ("Error in httpGet: " <> err) Right sets -> pure $ Just sets -- initial settings: either use the one from settingsUrl, or try to guess some. resolvedSettings <- liftIO $ case mRequestedSettingsE of Nothing -> guessedSettings <$ initLogInfo "Using guessed settings: " guessedSettings Just sets -> sets <$ initLogInfo "Using requested settings: " sets let settingAccumulator oldSettings (Right newSettings) = pure $ newSettings <> oldSettings settingAccumulator oldSettings (Left (JSError errMsg)) = (oldSettings <$) . liftIO $ initLogErr ("Error in httpGet: " <> errMsg) -- for now, we never fire the event of getting new settings, -- but I keep quaViewSettings being a dynamic in case we want to change it in future, -- because reloadable settings are cool! let quaViewSettingsE = never quaViewSettings <- accumM settingAccumulator resolvedSettings quaViewSettingsE -- log settings updates performEvent_ . ffor (updated quaViewSettings) $ liftIO . initLogInfo "Updated settings" quaViewUserMessageHandlers <- liftIO . newIORef $ UserMessageCallback defaultMsgFun quaViewPanicMsgHandler <- liftIO . newIORef $ defaultMsgFun . SingleMsg return QuaViewContext {..}
2,812
initQuaViewContext :: ( MonadIO m, MonadFix m, HasJSContext m , MonadHold (SpiderTimeline Global) m , TriggerEvent (SpiderTimeline Global) m , PerformEvent (SpiderTimeline Global) m , MonadIO (Performable m) , Reflex t ) => QuaViewEvents t -> m (QuaViewContext t) initQuaViewContext quaViewEvents = do -- This is when qua-view starts, so we don't have any loggers and etc. set up. -- Following functions are used to log things happening at this initialization step. let initLogErr m = stdOutLogger LevelWarn "initQuaViewContext" m Nothing initLogInfo m = stdOutLogger LevelInfo "initQuaViewContext" m . Just . pToJSVal . toJSON quaViewLoggerFunc = stdOutLogger guessedSettings <- liftIO $ unsafeInterleaveIO guessQuaSettings -- try to get settings url from meta tag in an html page -- <meta property="qua-view:settingsUrl" content="{settingsUrl}"> mRequestedSettingsE <- runMaybeT $ do doc <- MaybeT currentDocument settingsEl <- MaybeT $ querySelector doc ("meta[property='qua-view:settingsUrl']" :: JSString) url <- MaybeT $ getAttribute settingsEl ("content" :: JSString) setsE <- liftIO newEmptyMVar lift . httpGetNow' url $ putMVar setsE MaybeT . liftIO . unsafeInterleaveIO $ takeMVar setsE >>= \e -> case e of Left (JSError err) -> Nothing <$ initLogErr ("Error in httpGet: " <> err) Right sets -> pure $ Just sets -- initial settings: either use the one from settingsUrl, or try to guess some. resolvedSettings <- liftIO $ case mRequestedSettingsE of Nothing -> guessedSettings <$ initLogInfo "Using guessed settings: " guessedSettings Just sets -> sets <$ initLogInfo "Using requested settings: " sets let settingAccumulator oldSettings (Right newSettings) = pure $ newSettings <> oldSettings settingAccumulator oldSettings (Left (JSError errMsg)) = (oldSettings <$) . liftIO $ initLogErr ("Error in httpGet: " <> errMsg) -- for now, we never fire the event of getting new settings, -- but I keep quaViewSettings being a dynamic in case we want to change it in future, -- because reloadable settings are cool! let quaViewSettingsE = never quaViewSettings <- accumM settingAccumulator resolvedSettings quaViewSettingsE -- log settings updates performEvent_ . ffor (updated quaViewSettings) $ liftIO . initLogInfo "Updated settings" quaViewUserMessageHandlers <- liftIO . newIORef $ UserMessageCallback defaultMsgFun quaViewPanicMsgHandler <- liftIO . newIORef $ defaultMsgFun . SingleMsg return QuaViewContext {..}
2,812
initQuaViewContext quaViewEvents = do -- This is when qua-view starts, so we don't have any loggers and etc. set up. -- Following functions are used to log things happening at this initialization step. let initLogErr m = stdOutLogger LevelWarn "initQuaViewContext" m Nothing initLogInfo m = stdOutLogger LevelInfo "initQuaViewContext" m . Just . pToJSVal . toJSON quaViewLoggerFunc = stdOutLogger guessedSettings <- liftIO $ unsafeInterleaveIO guessQuaSettings -- try to get settings url from meta tag in an html page -- <meta property="qua-view:settingsUrl" content="{settingsUrl}"> mRequestedSettingsE <- runMaybeT $ do doc <- MaybeT currentDocument settingsEl <- MaybeT $ querySelector doc ("meta[property='qua-view:settingsUrl']" :: JSString) url <- MaybeT $ getAttribute settingsEl ("content" :: JSString) setsE <- liftIO newEmptyMVar lift . httpGetNow' url $ putMVar setsE MaybeT . liftIO . unsafeInterleaveIO $ takeMVar setsE >>= \e -> case e of Left (JSError err) -> Nothing <$ initLogErr ("Error in httpGet: " <> err) Right sets -> pure $ Just sets -- initial settings: either use the one from settingsUrl, or try to guess some. resolvedSettings <- liftIO $ case mRequestedSettingsE of Nothing -> guessedSettings <$ initLogInfo "Using guessed settings: " guessedSettings Just sets -> sets <$ initLogInfo "Using requested settings: " sets let settingAccumulator oldSettings (Right newSettings) = pure $ newSettings <> oldSettings settingAccumulator oldSettings (Left (JSError errMsg)) = (oldSettings <$) . liftIO $ initLogErr ("Error in httpGet: " <> errMsg) -- for now, we never fire the event of getting new settings, -- but I keep quaViewSettings being a dynamic in case we want to change it in future, -- because reloadable settings are cool! let quaViewSettingsE = never quaViewSettings <- accumM settingAccumulator resolvedSettings quaViewSettingsE -- log settings updates performEvent_ . ffor (updated quaViewSettings) $ liftIO . initLogInfo "Updated settings" quaViewUserMessageHandlers <- liftIO . newIORef $ UserMessageCallback defaultMsgFun quaViewPanicMsgHandler <- liftIO . newIORef $ defaultMsgFun . SingleMsg return QuaViewContext {..}
2,416
false
true
0
19
732
573
275
298
null
null
yuto-matsum/contest-util-hs
src/Euler/035.hs
mit
cic :: Integral a => a-> [a] cic n = cicHelper n d where d = numOfDgt n cicHelper n 1 = [n] cicHelper n x = n : cicHelper (nxt n) (x-1) nxt x = lst*(10^(d-1))+(exl`div`10) where lst = x `mod` 10 exl = x - lst -- If xs is the subset of ys, return true.
270
cic :: Integral a => a-> [a] cic n = cicHelper n d where d = numOfDgt n cicHelper n 1 = [n] cicHelper n x = n : cicHelper (nxt n) (x-1) nxt x = lst*(10^(d-1))+(exl`div`10) where lst = x `mod` 10 exl = x - lst -- If xs is the subset of ys, return true.
270
cic n = cicHelper n d where d = numOfDgt n cicHelper n 1 = [n] cicHelper n x = n : cicHelper (nxt n) (x-1) nxt x = lst*(10^(d-1))+(exl`div`10) where lst = x `mod` 10 exl = x - lst -- If xs is the subset of ys, return true.
241
false
true
0
12
76
154
81
73
null
null
HIPERFIT/futhark
src/Futhark/Doc/Generator.hs
isc
synopsisOpened (ModParens me _) = do me' <- synopsisOpened me Just $ parens <$> me'
87
synopsisOpened (ModParens me _) = do me' <- synopsisOpened me Just $ parens <$> me'
87
synopsisOpened (ModParens me _) = do me' <- synopsisOpened me Just $ parens <$> me'
87
false
false
0
8
18
39
17
22
null
null
ItsLastDay/academic_university_2016-2018
subjects/Haskell/coursework_tests.hs
gpl-3.0
minus = Lam "k" $ Lam "l" $ l :@ pred' :@ k
43
minus = Lam "k" $ Lam "l" $ l :@ pred' :@ k
43
minus = Lam "k" $ Lam "l" $ l :@ pred' :@ k
43
false
false
1
9
12
32
13
19
null
null
gridaphobe/liquid-fixpoint
src/Language/Fixpoint/Types/Refinements.hs
bsd-3-clause
mkProp = PBexp . EApp (dummyLoc propConName) . (: [])
60
mkProp = PBexp . EApp (dummyLoc propConName) . (: [])
60
mkProp = PBexp . EApp (dummyLoc propConName) . (: [])
60
false
false
1
9
16
33
15
18
null
null
roberth/uu-helium
src/Helium/Main.hs
gpl-3.0
main :: IO () main = do args <- getArgs (options, Just fullName) <- processHeliumArgs args -- Can't fail, because processHeliumArgs checks it. lvmPathFromOptionsOrEnv <- case lvmPathFromOptions options of Nothing -> getLvmPath Just s -> return (explodePath s) baseLibs <- case basePathFromOptions options of Nothing -> getDataFileName $ if overloadingFromOptions options then "lib" else joinPath ["lib","simple"] Just path -> if overloadingFromOptions options then return path else return $ joinPath [path,"simple"] -- The lib will be part of path already. let (filePath, moduleName, _) = splitFilePath fullName filePath' = if null filePath then "." else filePath lvmPath = filter (not.null) . nub $ (filePath' : lvmPathFromOptionsOrEnv) ++ [baseLibs] -- baseLibs always last -- File that is compiled must exist, this test doesn't use the search path fileExists <- doesFileExist fullName newFullName <- if fileExists then return fullName else do let filePlusHS = fullName ++ ".hs" filePlusHSExists <- doesFileExist filePlusHS unless filePlusHSExists $ do putStrLn $ "Can't find file " ++ show fullName ++ " or " ++ show filePlusHS exitWith (ExitFailure 1) return filePlusHS -- Ensure .core libs are compiled to .lvm mapM_ (makeCoreLib baseLibs) coreLibs -- And now deal with Prelude preludeRef <- newIORef [] _ <- make filePath' (joinPath [baseLibs,prelude]) lvmPath [prelude] options preludeRef doneRef <- newIORef [] _ <- make filePath' newFullName lvmPath [moduleName] options doneRef return () -- fullName = file name including path of ".hs" file that is to be compiled -- lvmPath = where to look for files -- chain = chain of imports that led to the current module -- options = the compiler options -- doneRef = an IO ref to a list of already compiled files -- (their names and whether they were recompiled or not) -- returns: recompiled or not? (true = recompiled)
2,300
main :: IO () main = do args <- getArgs (options, Just fullName) <- processHeliumArgs args -- Can't fail, because processHeliumArgs checks it. lvmPathFromOptionsOrEnv <- case lvmPathFromOptions options of Nothing -> getLvmPath Just s -> return (explodePath s) baseLibs <- case basePathFromOptions options of Nothing -> getDataFileName $ if overloadingFromOptions options then "lib" else joinPath ["lib","simple"] Just path -> if overloadingFromOptions options then return path else return $ joinPath [path,"simple"] -- The lib will be part of path already. let (filePath, moduleName, _) = splitFilePath fullName filePath' = if null filePath then "." else filePath lvmPath = filter (not.null) . nub $ (filePath' : lvmPathFromOptionsOrEnv) ++ [baseLibs] -- baseLibs always last -- File that is compiled must exist, this test doesn't use the search path fileExists <- doesFileExist fullName newFullName <- if fileExists then return fullName else do let filePlusHS = fullName ++ ".hs" filePlusHSExists <- doesFileExist filePlusHS unless filePlusHSExists $ do putStrLn $ "Can't find file " ++ show fullName ++ " or " ++ show filePlusHS exitWith (ExitFailure 1) return filePlusHS -- Ensure .core libs are compiled to .lvm mapM_ (makeCoreLib baseLibs) coreLibs -- And now deal with Prelude preludeRef <- newIORef [] _ <- make filePath' (joinPath [baseLibs,prelude]) lvmPath [prelude] options preludeRef doneRef <- newIORef [] _ <- make filePath' newFullName lvmPath [moduleName] options doneRef return () -- fullName = file name including path of ".hs" file that is to be compiled -- lvmPath = where to look for files -- chain = chain of imports that led to the current module -- options = the compiler options -- doneRef = an IO ref to a list of already compiled files -- (their names and whether they were recompiled or not) -- returns: recompiled or not? (true = recompiled)
2,300
main = do args <- getArgs (options, Just fullName) <- processHeliumArgs args -- Can't fail, because processHeliumArgs checks it. lvmPathFromOptionsOrEnv <- case lvmPathFromOptions options of Nothing -> getLvmPath Just s -> return (explodePath s) baseLibs <- case basePathFromOptions options of Nothing -> getDataFileName $ if overloadingFromOptions options then "lib" else joinPath ["lib","simple"] Just path -> if overloadingFromOptions options then return path else return $ joinPath [path,"simple"] -- The lib will be part of path already. let (filePath, moduleName, _) = splitFilePath fullName filePath' = if null filePath then "." else filePath lvmPath = filter (not.null) . nub $ (filePath' : lvmPathFromOptionsOrEnv) ++ [baseLibs] -- baseLibs always last -- File that is compiled must exist, this test doesn't use the search path fileExists <- doesFileExist fullName newFullName <- if fileExists then return fullName else do let filePlusHS = fullName ++ ".hs" filePlusHSExists <- doesFileExist filePlusHS unless filePlusHSExists $ do putStrLn $ "Can't find file " ++ show fullName ++ " or " ++ show filePlusHS exitWith (ExitFailure 1) return filePlusHS -- Ensure .core libs are compiled to .lvm mapM_ (makeCoreLib baseLibs) coreLibs -- And now deal with Prelude preludeRef <- newIORef [] _ <- make filePath' (joinPath [baseLibs,prelude]) lvmPath [prelude] options preludeRef doneRef <- newIORef [] _ <- make filePath' newFullName lvmPath [moduleName] options doneRef return () -- fullName = file name including path of ".hs" file that is to be compiled -- lvmPath = where to look for files -- chain = chain of imports that led to the current module -- options = the compiler options -- doneRef = an IO ref to a list of already compiled files -- (their names and whether they were recompiled or not) -- returns: recompiled or not? (true = recompiled)
2,286
false
true
0
17
721
454
222
232
null
null
ulricha/dsh
src/Database/DSH/VSL/Opt/Properties/VectorType.hs
bsd-3-clause
reqValVectors :: VectorProp VectorType -> VectorProp VectorType -> (Int -> Int -> VectorProp VectorType) -> String -> Either String (VectorProp VectorType) reqValVectors (VProp (VTDataVec w1)) (VProp (VTDataVec w2)) f _ = Right $ f w1 w2
307
reqValVectors :: VectorProp VectorType -> VectorProp VectorType -> (Int -> Int -> VectorProp VectorType) -> String -> Either String (VectorProp VectorType) reqValVectors (VProp (VTDataVec w1)) (VProp (VTDataVec w2)) f _ = Right $ f w1 w2
307
reqValVectors (VProp (VTDataVec w1)) (VProp (VTDataVec w2)) f _ = Right $ f w1 w2
83
false
true
0
11
105
100
48
52
null
null
adnelson/nixfromnpm
src/NixFromNpm/Common.hs
mit
-- | Appends text to URI with a slash. Ex: foo.com // bar == -- foo.com/bar. (//) :: URI -> Text -> URI uri // txt = do let fixedUri = unsafeParseURI $ case T.last (uriToText uri) of '/' -> uriToText uri _ -> uriToText uri <> "/" case parseRelativeReference (unpack txt) of Nothing -> errorC ["Invalid appending URI: ", tshow txt] Just uri' -> uri' `relativeTo` fixedUri
398
(//) :: URI -> Text -> URI uri // txt = do let fixedUri = unsafeParseURI $ case T.last (uriToText uri) of '/' -> uriToText uri _ -> uriToText uri <> "/" case parseRelativeReference (unpack txt) of Nothing -> errorC ["Invalid appending URI: ", tshow txt] Just uri' -> uri' `relativeTo` fixedUri
321
uri // txt = do let fixedUri = unsafeParseURI $ case T.last (uriToText uri) of '/' -> uriToText uri _ -> uriToText uri <> "/" case parseRelativeReference (unpack txt) of Nothing -> errorC ["Invalid appending URI: ", tshow txt] Just uri' -> uri' `relativeTo` fixedUri
294
true
true
0
15
95
128
63
65
null
null
plancalculus/sloth
Test/Sloth/CharSet.hs
bsd-3-clause
-- | Prune a refinement up to a given depth pruneSetUpTo :: Int -> Config -> Ref Identity (Search TestCase) -> Ref Identity (Search TestCase) pruneSetUpTo n config tree = fst (runWriter (pruneSetWriter n config tree))
230
pruneSetUpTo :: Int -> Config -> Ref Identity (Search TestCase) -> Ref Identity (Search TestCase) pruneSetUpTo n config tree = fst (runWriter (pruneSetWriter n config tree))
186
pruneSetUpTo n config tree = fst (runWriter (pruneSetWriter n config tree))
75
true
true
0
10
48
72
35
37
null
null
ozgurakgun/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
-- | Source location with file only fileFC :: String -> FC fileFC s = FileFC s
78
fileFC :: String -> FC fileFC s = FileFC s
42
fileFC s = FileFC s
19
true
true
0
5
16
22
11
11
null
null
joe9/barrelfish
tools/flounder/UMPCommon.hs
mit
connect_handler_params :: UMPParams -> [C.Param] connect_handler_params p = [C.Param (C.Ptr $ C.Void) "st", C.Param (C.Ptr $ C.Struct "monitor_binding") "mb", C.Param (C.TypeName "uintptr_t") "mon_id", C.Param (C.Struct "capref") "frame", C.Param (C.TypeName "size_t") "inchanlen", C.Param (C.TypeName "size_t") "outchanlen", C.Param (C.Struct "capref") "notify_cap"]
413
connect_handler_params :: UMPParams -> [C.Param] connect_handler_params p = [C.Param (C.Ptr $ C.Void) "st", C.Param (C.Ptr $ C.Struct "monitor_binding") "mb", C.Param (C.TypeName "uintptr_t") "mon_id", C.Param (C.Struct "capref") "frame", C.Param (C.TypeName "size_t") "inchanlen", C.Param (C.TypeName "size_t") "outchanlen", C.Param (C.Struct "capref") "notify_cap"]
413
connect_handler_params p = [C.Param (C.Ptr $ C.Void) "st", C.Param (C.Ptr $ C.Struct "monitor_binding") "mb", C.Param (C.TypeName "uintptr_t") "mon_id", C.Param (C.Struct "capref") "frame", C.Param (C.TypeName "size_t") "inchanlen", C.Param (C.TypeName "size_t") "outchanlen", C.Param (C.Struct "capref") "notify_cap"]
364
false
true
0
11
84
164
81
83
null
null
arjantop/gifter
src/Gifter/GiveawayEntry.hs
bsd-3-clause
getEntries :: Int -> IO (Either SomeException [GiveawayEntry]) getEntries n = withSocketsDo . try $ CH.simpleHttp "http://feeds.feedburner.com/steamgifts" >>= \s -> do gs <- runResourceT $ XML.parseLBS XML.def s $$ parseEntries return . take n $ gs
268
getEntries :: Int -> IO (Either SomeException [GiveawayEntry]) getEntries n = withSocketsDo . try $ CH.simpleHttp "http://feeds.feedburner.com/steamgifts" >>= \s -> do gs <- runResourceT $ XML.parseLBS XML.def s $$ parseEntries return . take n $ gs
268
getEntries n = withSocketsDo . try $ CH.simpleHttp "http://feeds.feedburner.com/steamgifts" >>= \s -> do gs <- runResourceT $ XML.parseLBS XML.def s $$ parseEntries return . take n $ gs
205
false
true
0
13
55
92
44
48
null
null
harlanhaskins/Letter
Haskell/src/Letter/Parser.hs
mit
funCall :: Parser Exp funCall = do name <- lexeme identifier args <- expList return $ FunCall name args
115
funCall :: Parser Exp funCall = do name <- lexeme identifier args <- expList return $ FunCall name args
115
funCall = do name <- lexeme identifier args <- expList return $ FunCall name args
93
false
true
0
8
30
43
19
24
null
null