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
tomicm/puh-hash
Hash.hs
gpl-2.0
executeHashRc :: IO VarTable executeHashRc = do homeDir <- getHomeDirectory exists <- doesFileExist (homeDir ++ "/.hashrc") if exists then runScriptWithRet emptyState (homeDir ++ "/.hashrc") else return emptyState
227
executeHashRc :: IO VarTable executeHashRc = do homeDir <- getHomeDirectory exists <- doesFileExist (homeDir ++ "/.hashrc") if exists then runScriptWithRet emptyState (homeDir ++ "/.hashrc") else return emptyState
227
executeHashRc = do homeDir <- getHomeDirectory exists <- doesFileExist (homeDir ++ "/.hashrc") if exists then runScriptWithRet emptyState (homeDir ++ "/.hashrc") else return emptyState
198
false
true
0
10
40
64
31
33
null
null
AaronFriel/graphted
src/Prelude/Graphted.hs
bsd-3-clause
liftA :: (GApplicative f, _) => (a -> b) -> f i1 a -> f (Apply f (Pure f) i1) b liftA f a = pure f <*> a
110
liftA :: (GApplicative f, _) => (a -> b) -> f i1 a -> f (Apply f (Pure f) i1) b liftA f a = pure f <*> a
110
liftA f a = pure f <*> a
24
false
true
3
13
34
85
41
44
null
null
myuon/haste-jQuery
Haste/JQuery.hs
mit
finish :: JQuery -> IO JQuery finish (JQuery q) = JQuery <$> chain "finish" q
77
finish :: JQuery -> IO JQuery finish (JQuery q) = JQuery <$> chain "finish" q
77
finish (JQuery q) = JQuery <$> chain "finish" q
47
false
true
0
7
14
36
17
19
null
null
erantapaa/hprimecount
app/Main.hs
bsd-2-clause
e501b1 n = sum'' $ do ((i,p):ps) <- takeWhile (\((_,p):_) -> p^3 <= n) (tails $ zip [(1::Int)..] primes) let t = div n (p^3) da = PC.pi_deleglise_rivat2(fromIntegral t) d1 = if t >= p then (-1) else 0 db = sum'' $ do (j,q) <- takeWhile (\(_,q) -> p*q*q < n) ps let x = p*q !db = PC.pi_deleglise_rivat2(fromIntegral $ div n x) - fromIntegral j return db !s = da + d1 + db return s
479
e501b1 n = sum'' $ do ((i,p):ps) <- takeWhile (\((_,p):_) -> p^3 <= n) (tails $ zip [(1::Int)..] primes) let t = div n (p^3) da = PC.pi_deleglise_rivat2(fromIntegral t) d1 = if t >= p then (-1) else 0 db = sum'' $ do (j,q) <- takeWhile (\(_,q) -> p*q*q < n) ps let x = p*q !db = PC.pi_deleglise_rivat2(fromIntegral $ div n x) - fromIntegral j return db !s = da + d1 + db return s
479
e501b1 n = sum'' $ do ((i,p):ps) <- takeWhile (\((_,p):_) -> p^3 <= n) (tails $ zip [(1::Int)..] primes) let t = div n (p^3) da = PC.pi_deleglise_rivat2(fromIntegral t) d1 = if t >= p then (-1) else 0 db = sum'' $ do (j,q) <- takeWhile (\(_,q) -> p*q*q < n) ps let x = p*q !db = PC.pi_deleglise_rivat2(fromIntegral $ div n x) - fromIntegral j return db !s = da + d1 + db return s
479
false
false
3
21
177
276
139
137
null
null
SuperDrew/sql-server-gen
src/Database/SqlServer/Definition/Value.hs
bsd-2-clause
arbitrarySQLSmallMoney :: Gen SQLValue arbitrarySQLSmallMoney = liftM SQLSmallMoney arbitrary
93
arbitrarySQLSmallMoney :: Gen SQLValue arbitrarySQLSmallMoney = liftM SQLSmallMoney arbitrary
93
arbitrarySQLSmallMoney = liftM SQLSmallMoney arbitrary
54
false
true
0
6
8
25
10
15
null
null
cocreature/leksah
src/IDE/Workspaces.hs
gpl-2.0
fileOpen :: IDEAction fileOpen = do window <- getMainWindow prefs <- readIDE prefs mbBuf <- maybeActiveBuf mbFileName <- liftIO $ do dialog <- fileChooserDialogNew (Just $ __ "Open File") (Just window) FileChooserActionOpen [("gtk-cancel" ,ResponseCancel) ,("gtk-open" ,ResponseAccept)] case mbBuf >>= fileName of Just fn -> void (fileChooserSetCurrentFolder dialog (dropFileName fn)) Nothing -> return () widgetShow dialog response <- dialogRun dialog case response of ResponseAccept -> do f <- fileChooserGetFilename dialog widgetDestroy dialog return f ResponseCancel -> do widgetDestroy dialog return Nothing ResponseDeleteEvent-> do widgetDestroy dialog return Nothing _ -> return Nothing forM_ mbFileName fileOpen'
1,112
fileOpen :: IDEAction fileOpen = do window <- getMainWindow prefs <- readIDE prefs mbBuf <- maybeActiveBuf mbFileName <- liftIO $ do dialog <- fileChooserDialogNew (Just $ __ "Open File") (Just window) FileChooserActionOpen [("gtk-cancel" ,ResponseCancel) ,("gtk-open" ,ResponseAccept)] case mbBuf >>= fileName of Just fn -> void (fileChooserSetCurrentFolder dialog (dropFileName fn)) Nothing -> return () widgetShow dialog response <- dialogRun dialog case response of ResponseAccept -> do f <- fileChooserGetFilename dialog widgetDestroy dialog return f ResponseCancel -> do widgetDestroy dialog return Nothing ResponseDeleteEvent-> do widgetDestroy dialog return Nothing _ -> return Nothing forM_ mbFileName fileOpen'
1,112
fileOpen = do window <- getMainWindow prefs <- readIDE prefs mbBuf <- maybeActiveBuf mbFileName <- liftIO $ do dialog <- fileChooserDialogNew (Just $ __ "Open File") (Just window) FileChooserActionOpen [("gtk-cancel" ,ResponseCancel) ,("gtk-open" ,ResponseAccept)] case mbBuf >>= fileName of Just fn -> void (fileChooserSetCurrentFolder dialog (dropFileName fn)) Nothing -> return () widgetShow dialog response <- dialogRun dialog case response of ResponseAccept -> do f <- fileChooserGetFilename dialog widgetDestroy dialog return f ResponseCancel -> do widgetDestroy dialog return Nothing ResponseDeleteEvent-> do widgetDestroy dialog return Nothing _ -> return Nothing forM_ mbFileName fileOpen'
1,090
false
true
0
19
484
255
112
143
null
null
leshchevds/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
hvUseLocaltime :: String hvUseLocaltime = "use_localtime"
57
hvUseLocaltime :: String hvUseLocaltime = "use_localtime"
57
hvUseLocaltime = "use_localtime"
32
false
true
0
4
5
11
6
5
null
null
scott-fleischman/greek-grammar
haskell/greek-grammar/src/Text/Greek/IO/Stage.hs
mit
flattenWords :: forall a b c. (Work.IndexSourceTitle -> Word.Word (Word.IndexedP a) b -> c) -> [Work.Indexed [Word.Word (Word.IndexedP a) b]] -> [(Json.Instance, c)] flattenWords f = concatMap getIndexedWorkProps where getIndexedWorkProps :: Work.Indexed [Word.Word (Word.IndexedP a) b] -> [(Json.Instance, c)] getIndexedWorkProps w = fmap (\(i, p) -> (Json.Instance (getWorkIndex w) i Nothing, p)) (getWorkProps w) getWorkProps :: Work.Indexed [Word.Word (Word.IndexedP a) b] -> [(Word.Index, c)] getWorkProps k = fmap (getIndexedWordProp (Work.getInfo k)) . Work.getContent $ k getWorkIndex :: Work.Indexed x -> Work.Index getWorkIndex = Lens.view (Work.info . Lens._1) getIndexedWordProp :: Work.IndexSourceTitle -> Word.Word (Word.IndexedP a) b -> (Word.Index, c) getIndexedWordProp k d = (getWordIndex d, f k d) getWordIndex :: Word.Word (Word.IndexedP a) b -> Word.Index getWordIndex = Lens.view (Word.info . Word.indexLens)
980
flattenWords :: forall a b c. (Work.IndexSourceTitle -> Word.Word (Word.IndexedP a) b -> c) -> [Work.Indexed [Word.Word (Word.IndexedP a) b]] -> [(Json.Instance, c)] flattenWords f = concatMap getIndexedWorkProps where getIndexedWorkProps :: Work.Indexed [Word.Word (Word.IndexedP a) b] -> [(Json.Instance, c)] getIndexedWorkProps w = fmap (\(i, p) -> (Json.Instance (getWorkIndex w) i Nothing, p)) (getWorkProps w) getWorkProps :: Work.Indexed [Word.Word (Word.IndexedP a) b] -> [(Word.Index, c)] getWorkProps k = fmap (getIndexedWordProp (Work.getInfo k)) . Work.getContent $ k getWorkIndex :: Work.Indexed x -> Work.Index getWorkIndex = Lens.view (Work.info . Lens._1) getIndexedWordProp :: Work.IndexSourceTitle -> Word.Word (Word.IndexedP a) b -> (Word.Index, c) getIndexedWordProp k d = (getWordIndex d, f k d) getWordIndex :: Word.Word (Word.IndexedP a) b -> Word.Index getWordIndex = Lens.view (Word.info . Word.indexLens)
980
flattenWords f = concatMap getIndexedWorkProps where getIndexedWorkProps :: Work.Indexed [Word.Word (Word.IndexedP a) b] -> [(Json.Instance, c)] getIndexedWorkProps w = fmap (\(i, p) -> (Json.Instance (getWorkIndex w) i Nothing, p)) (getWorkProps w) getWorkProps :: Work.Indexed [Word.Word (Word.IndexedP a) b] -> [(Word.Index, c)] getWorkProps k = fmap (getIndexedWordProp (Work.getInfo k)) . Work.getContent $ k getWorkIndex :: Work.Indexed x -> Work.Index getWorkIndex = Lens.view (Work.info . Lens._1) getIndexedWordProp :: Work.IndexSourceTitle -> Word.Word (Word.IndexedP a) b -> (Word.Index, c) getIndexedWordProp k d = (getWordIndex d, f k d) getWordIndex :: Word.Word (Word.IndexedP a) b -> Word.Index getWordIndex = Lens.view (Word.info . Word.indexLens)
810
false
true
16
15
170
417
217
200
null
null
abailly/hsgames
game-server/test/GameServer/Builder.hs
apache-2.0
testSeed :: StdGen testSeed = mkStdGen 42
41
testSeed :: StdGen testSeed = mkStdGen 42
41
testSeed = mkStdGen 42
22
false
true
0
5
6
14
7
7
null
null
jfranklin9000/urbit
pkg/hs/urbit-king/lib/Urbit/Noun/TH.hs
mit
typeShape :: Name -> Q ([TyVarBndr], Shape) typeShape tyName = do (vars, cs) <- reify tyName >>= \case TyConI (DataD _ nm vars _ cs _) -> pure (vars, unpackCon <$> cs) TyConI (NewtypeD _ nm vars _ c _) -> pure (vars, [unpackCon c]) TyConI _ -> fail badSynonym _ -> fail "not type" let prefix = getPrefix (nameStr . fst <$> cs) splits = splitFn ([], []) cs splitFn (l, r) = \case [] -> (l, r) (n,[]) : cs -> splitFn (tagName prefix n:l, r) cs conInf : cs -> splitFn (l, tagConInfo prefix conInf:r) cs pure $ (vars,) $ case cs of [] -> Vod [c] -> Tup c cs -> uncurry Sum splits where badSynonym = "deriveFunctor: tyCon may not be a type synonym." tagConInfo :: Int -> ConInfo -> (String, ConInfo) tagConInfo pre ci@(nm, _) = (tagString pre nm, ci) tagName :: Int -> Name -> (String, Name) tagName pre n = (tagString pre n, n) tyStr = nameStr tyName tyAbbrv = filter C.isUpper tyStr typePrefixed = (tyStr `isPrefixOf`) abbrvPrefixed = (tyAbbrv `isPrefixOf`) getPrefix :: [String] -> Int getPrefix cs | all typePrefixed cs = length tyStr getPrefix cs | all abbrvPrefixed cs = length tyAbbrv getPrefix _ = 0 unpackCon :: Con -> ConInfo unpackCon = \case NormalC nm bangTypes -> (nm, snd <$> bangTypes) RecC nm varBangTypes -> (nm, varBangTypes <&> (\(_, _, t) -> t)) InfixC bangType1 nm bangType2 -> error "Infix Cnstrs are not supported" ForallC tyVarBndrs ctx con -> error "Polymorphic tys are not supported" GadtC nm bangTypes ty -> error "GADTs are not supported" RecGadtC nm varBangTypes ty -> error "GADTs are not supported" --------------------------------------------------------------------------------
1,981
typeShape :: Name -> Q ([TyVarBndr], Shape) typeShape tyName = do (vars, cs) <- reify tyName >>= \case TyConI (DataD _ nm vars _ cs _) -> pure (vars, unpackCon <$> cs) TyConI (NewtypeD _ nm vars _ c _) -> pure (vars, [unpackCon c]) TyConI _ -> fail badSynonym _ -> fail "not type" let prefix = getPrefix (nameStr . fst <$> cs) splits = splitFn ([], []) cs splitFn (l, r) = \case [] -> (l, r) (n,[]) : cs -> splitFn (tagName prefix n:l, r) cs conInf : cs -> splitFn (l, tagConInfo prefix conInf:r) cs pure $ (vars,) $ case cs of [] -> Vod [c] -> Tup c cs -> uncurry Sum splits where badSynonym = "deriveFunctor: tyCon may not be a type synonym." tagConInfo :: Int -> ConInfo -> (String, ConInfo) tagConInfo pre ci@(nm, _) = (tagString pre nm, ci) tagName :: Int -> Name -> (String, Name) tagName pre n = (tagString pre n, n) tyStr = nameStr tyName tyAbbrv = filter C.isUpper tyStr typePrefixed = (tyStr `isPrefixOf`) abbrvPrefixed = (tyAbbrv `isPrefixOf`) getPrefix :: [String] -> Int getPrefix cs | all typePrefixed cs = length tyStr getPrefix cs | all abbrvPrefixed cs = length tyAbbrv getPrefix _ = 0 unpackCon :: Con -> ConInfo unpackCon = \case NormalC nm bangTypes -> (nm, snd <$> bangTypes) RecC nm varBangTypes -> (nm, varBangTypes <&> (\(_, _, t) -> t)) InfixC bangType1 nm bangType2 -> error "Infix Cnstrs are not supported" ForallC tyVarBndrs ctx con -> error "Polymorphic tys are not supported" GadtC nm bangTypes ty -> error "GADTs are not supported" RecGadtC nm varBangTypes ty -> error "GADTs are not supported" --------------------------------------------------------------------------------
1,981
typeShape tyName = do (vars, cs) <- reify tyName >>= \case TyConI (DataD _ nm vars _ cs _) -> pure (vars, unpackCon <$> cs) TyConI (NewtypeD _ nm vars _ c _) -> pure (vars, [unpackCon c]) TyConI _ -> fail badSynonym _ -> fail "not type" let prefix = getPrefix (nameStr . fst <$> cs) splits = splitFn ([], []) cs splitFn (l, r) = \case [] -> (l, r) (n,[]) : cs -> splitFn (tagName prefix n:l, r) cs conInf : cs -> splitFn (l, tagConInfo prefix conInf:r) cs pure $ (vars,) $ case cs of [] -> Vod [c] -> Tup c cs -> uncurry Sum splits where badSynonym = "deriveFunctor: tyCon may not be a type synonym." tagConInfo :: Int -> ConInfo -> (String, ConInfo) tagConInfo pre ci@(nm, _) = (tagString pre nm, ci) tagName :: Int -> Name -> (String, Name) tagName pre n = (tagString pre n, n) tyStr = nameStr tyName tyAbbrv = filter C.isUpper tyStr typePrefixed = (tyStr `isPrefixOf`) abbrvPrefixed = (tyAbbrv `isPrefixOf`) getPrefix :: [String] -> Int getPrefix cs | all typePrefixed cs = length tyStr getPrefix cs | all abbrvPrefixed cs = length tyAbbrv getPrefix _ = 0 unpackCon :: Con -> ConInfo unpackCon = \case NormalC nm bangTypes -> (nm, snd <$> bangTypes) RecC nm varBangTypes -> (nm, varBangTypes <&> (\(_, _, t) -> t)) InfixC bangType1 nm bangType2 -> error "Infix Cnstrs are not supported" ForallC tyVarBndrs ctx con -> error "Polymorphic tys are not supported" GadtC nm bangTypes ty -> error "GADTs are not supported" RecGadtC nm varBangTypes ty -> error "GADTs are not supported" --------------------------------------------------------------------------------
1,937
false
true
18
16
651
675
354
321
null
null
mightymoose/liquidhaskell
benchmarks/hmatrix-0.15.0.1/lib/Numeric/GSL/Root.hs
bsd-3-clause
rootGen m f xi epsabs maxit = unsafePerformIO $ do let xiv = fromList xi n = dim xiv fp <- mkVecVecfun (aux_vTov (checkdim1 n . fromList . f . toList)) rawpath <- vec xiv $ \xiv' -> createMIO maxit (2*n+1) (c_multiroot m fp epsabs (fi maxit) // xiv') "multiroot" let it = round (rawpath @@> (maxit-1,0)) path = takeRows it rawpath [sol] = toLists $ dropRows (it-1) path freeHaskellFunPtr fp return (take n $ drop 1 sol, path)
544
rootGen m f xi epsabs maxit = unsafePerformIO $ do let xiv = fromList xi n = dim xiv fp <- mkVecVecfun (aux_vTov (checkdim1 n . fromList . f . toList)) rawpath <- vec xiv $ \xiv' -> createMIO maxit (2*n+1) (c_multiroot m fp epsabs (fi maxit) // xiv') "multiroot" let it = round (rawpath @@> (maxit-1,0)) path = takeRows it rawpath [sol] = toLists $ dropRows (it-1) path freeHaskellFunPtr fp return (take n $ drop 1 sol, path)
544
rootGen m f xi epsabs maxit = unsafePerformIO $ do let xiv = fromList xi n = dim xiv fp <- mkVecVecfun (aux_vTov (checkdim1 n . fromList . f . toList)) rawpath <- vec xiv $ \xiv' -> createMIO maxit (2*n+1) (c_multiroot m fp epsabs (fi maxit) // xiv') "multiroot" let it = round (rawpath @@> (maxit-1,0)) path = takeRows it rawpath [sol] = toLists $ dropRows (it-1) path freeHaskellFunPtr fp return (take n $ drop 1 sol, path)
544
false
false
1
17
197
238
111
127
null
null
elieux/ghc
compiler/hsSyn/HsPat.hs
bsd-3-clause
hsPatNeedsParens (CoPat _ p _) = hsPatNeedsParens p
57
hsPatNeedsParens (CoPat _ p _) = hsPatNeedsParens p
57
hsPatNeedsParens (CoPat _ p _) = hsPatNeedsParens p
57
false
false
0
7
13
22
10
12
null
null
AndreasVoellmy/nettle-openflow
src/Network/Data/OpenFlow/MatchBuilder.hs
bsd-3-clause
eth_dst_ :: EthernetAddress -> MatchBuilder eth_dst_ addr = eth_addr_set addr "eth_dst" updDstEthAddress dstEthAddress
118
eth_dst_ :: EthernetAddress -> MatchBuilder eth_dst_ addr = eth_addr_set addr "eth_dst" updDstEthAddress dstEthAddress
118
eth_dst_ addr = eth_addr_set addr "eth_dst" updDstEthAddress dstEthAddress
74
false
true
0
5
12
27
13
14
null
null
Lainepress/hledger
hledger/Hledger/Cli/Convert.hs
gpl-3.0
currencyfield = do string "currency-field" many1 spacenonewline v <- restofline updateState (\r -> r{currencyField=readMay v})
134
currencyfield = do string "currency-field" many1 spacenonewline v <- restofline updateState (\r -> r{currencyField=readMay v})
134
currencyfield = do string "currency-field" many1 spacenonewline v <- restofline updateState (\r -> r{currencyField=readMay v})
134
false
false
0
12
22
50
23
27
null
null
xkollar/yaml
Text/Libyaml.hs
bsd-2-clause
parserSize :: Int parserSize = 480
34
parserSize :: Int parserSize = 480
34
parserSize = 480
16
false
true
0
4
5
11
6
5
null
null
bitemyapp/hakaru
Language/Hakaru/Parser/Parser.hs
bsd-3-clause
commaSep :: Parser a -> Parser [a] commaSep = Tok.commaSep lexer
64
commaSep :: Parser a -> Parser [a] commaSep = Tok.commaSep lexer
64
commaSep = Tok.commaSep lexer
29
false
true
0
8
10
34
15
19
null
null
apriori/daak
lib/DAAK/Algorithms/Gamo.hs
mit
solutionMergeCrossover pd p parents@(a:b:rs) = do keepSplit <- getRandomR (0.0, 1.0) let extract = L.partition (useSelector . orderChromosome . snd) rawGenes = zip [0..] . extractPackingFullChromoSomes . extractSelectors comp = compare `on` (orderChromosome . snd) determineUsed = genesUsed . packing pd (rawA, rawB) = (rawGenes a, rawGenes b) (packSelectedA, packUnselectedA) = extract rawA (packSelectedB, packUnselectedB) = extract rawB (sortedA, sortedB) = (sortBy comp packSelectedA, sortBy comp packSelectedB) (packedA, packedB) = (determineUsed a, determineUsed b) (packedObjA, packedObjB) = (take packedA sortedA, take packedB sortedB) ((untouchedA, removedA), (untouchedB, removedB)) = ( splitSuffixFactor packedObjA keepSplit , splitSuffixFactor packedObjB keepSplit ) maxKeyA = if L.null untouchedA then 0.0 else maximum $ orderChromosome . snd <$> untouchedA maxKeyB = if L.null untouchedB then 0.0 else maximum $ orderChromosome . snd <$> untouchedB lenRemA = length removedA lenRemB = length removedB minLen = min lenRemA lenRemB crossRands <- getRandomLazy01Genome minLen let cA = selectLimit p crossRands removedB cB = selectLimit p crossRands removedA geneA = offsetReplaceFlatten maxKeyA rawA cA geneB = offsetReplaceFlatten maxKeyB rawB cB uniformCrosses <- doCrossovers parents (uniformCrossover p) return ([geneA, geneB] ++ uniformCrosses, rs)
1,563
solutionMergeCrossover pd p parents@(a:b:rs) = do keepSplit <- getRandomR (0.0, 1.0) let extract = L.partition (useSelector . orderChromosome . snd) rawGenes = zip [0..] . extractPackingFullChromoSomes . extractSelectors comp = compare `on` (orderChromosome . snd) determineUsed = genesUsed . packing pd (rawA, rawB) = (rawGenes a, rawGenes b) (packSelectedA, packUnselectedA) = extract rawA (packSelectedB, packUnselectedB) = extract rawB (sortedA, sortedB) = (sortBy comp packSelectedA, sortBy comp packSelectedB) (packedA, packedB) = (determineUsed a, determineUsed b) (packedObjA, packedObjB) = (take packedA sortedA, take packedB sortedB) ((untouchedA, removedA), (untouchedB, removedB)) = ( splitSuffixFactor packedObjA keepSplit , splitSuffixFactor packedObjB keepSplit ) maxKeyA = if L.null untouchedA then 0.0 else maximum $ orderChromosome . snd <$> untouchedA maxKeyB = if L.null untouchedB then 0.0 else maximum $ orderChromosome . snd <$> untouchedB lenRemA = length removedA lenRemB = length removedB minLen = min lenRemA lenRemB crossRands <- getRandomLazy01Genome minLen let cA = selectLimit p crossRands removedB cB = selectLimit p crossRands removedA geneA = offsetReplaceFlatten maxKeyA rawA cA geneB = offsetReplaceFlatten maxKeyB rawB cB uniformCrosses <- doCrossovers parents (uniformCrossover p) return ([geneA, geneB] ++ uniformCrosses, rs)
1,563
solutionMergeCrossover pd p parents@(a:b:rs) = do keepSplit <- getRandomR (0.0, 1.0) let extract = L.partition (useSelector . orderChromosome . snd) rawGenes = zip [0..] . extractPackingFullChromoSomes . extractSelectors comp = compare `on` (orderChromosome . snd) determineUsed = genesUsed . packing pd (rawA, rawB) = (rawGenes a, rawGenes b) (packSelectedA, packUnselectedA) = extract rawA (packSelectedB, packUnselectedB) = extract rawB (sortedA, sortedB) = (sortBy comp packSelectedA, sortBy comp packSelectedB) (packedA, packedB) = (determineUsed a, determineUsed b) (packedObjA, packedObjB) = (take packedA sortedA, take packedB sortedB) ((untouchedA, removedA), (untouchedB, removedB)) = ( splitSuffixFactor packedObjA keepSplit , splitSuffixFactor packedObjB keepSplit ) maxKeyA = if L.null untouchedA then 0.0 else maximum $ orderChromosome . snd <$> untouchedA maxKeyB = if L.null untouchedB then 0.0 else maximum $ orderChromosome . snd <$> untouchedB lenRemA = length removedA lenRemB = length removedB minLen = min lenRemA lenRemB crossRands <- getRandomLazy01Genome minLen let cA = selectLimit p crossRands removedB cB = selectLimit p crossRands removedA geneA = offsetReplaceFlatten maxKeyA rawA cA geneB = offsetReplaceFlatten maxKeyB rawB cB uniformCrosses <- doCrossovers parents (uniformCrossover p) return ([geneA, geneB] ++ uniformCrosses, rs)
1,563
false
false
0
13
379
479
250
229
null
null
ellej/dawn
src/Dawn/Internal.hs
bsd-3-clause
seqTriple :: Monad m => (m a, m b, m c) -> m (a, b, c) seqTriple = uncurry3 $ liftM3 (,,)
89
seqTriple :: Monad m => (m a, m b, m c) -> m (a, b, c) seqTriple = uncurry3 $ liftM3 (,,)
89
seqTriple = uncurry3 $ liftM3 (,,)
34
false
true
0
8
21
63
33
30
null
null
AndrewRademacher/mailgun
src/Rackspace/MailGun.hs
mit
buildBase :: Message -> [Part] buildBase msg = partText "from" (from msg) ++ partText "to" (to msg) ++ partMaybeText "cc" (cc msg) ++ partMaybeText "bcc" (bcc msg) ++ partMaybeText "subject" (subject msg) ++ buildTail msg
286
buildBase :: Message -> [Part] buildBase msg = partText "from" (from msg) ++ partText "to" (to msg) ++ partMaybeText "cc" (cc msg) ++ partMaybeText "bcc" (bcc msg) ++ partMaybeText "subject" (subject msg) ++ buildTail msg
286
buildBase msg = partText "from" (from msg) ++ partText "to" (to msg) ++ partMaybeText "cc" (cc msg) ++ partMaybeText "bcc" (bcc msg) ++ partMaybeText "subject" (subject msg) ++ buildTail msg
255
false
true
10
8
99
112
48
64
null
null
brendanhay/gogol
gogol-civicinfo/gen/Network/Google/Resource/CivicInfo/Representatives/RepresentativeInfoByDivision.hs
mpl-2.0
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\"). rribdUploadType :: Lens' RepresentativesRepresentativeInfoByDivision (Maybe Text) rribdUploadType = lens _rribdUploadType (\ s a -> s{_rribdUploadType = a})
235
rribdUploadType :: Lens' RepresentativesRepresentativeInfoByDivision (Maybe Text) rribdUploadType = lens _rribdUploadType (\ s a -> s{_rribdUploadType = a})
164
rribdUploadType = lens _rribdUploadType (\ s a -> s{_rribdUploadType = a})
82
true
true
1
9
34
52
25
27
null
null
athanclark/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
constDocs (Fl f) = "A float"
54
constDocs (Fl f) = "A float"
54
constDocs (Fl f) = "A float"
54
false
false
0
6
31
16
7
9
null
null
leshchevds/ganeti
test/hs/Test/Ganeti/Types.hs
bsd-2-clause
prop_Positive_fail :: QuickCheck.NonNegative Int -> Property prop_Positive_fail (QuickCheck.NonNegative i) = case mkPositive (negate i)::Result (Types.Positive Int) of Bad _ -> passTest Ok nn -> failTest $ "Built positive number '" ++ show nn ++ "' from negative or zero value " ++ show i -- | Tests building negative numbers.
350
prop_Positive_fail :: QuickCheck.NonNegative Int -> Property prop_Positive_fail (QuickCheck.NonNegative i) = case mkPositive (negate i)::Result (Types.Positive Int) of Bad _ -> passTest Ok nn -> failTest $ "Built positive number '" ++ show nn ++ "' from negative or zero value " ++ show i -- | Tests building negative numbers.
350
prop_Positive_fail (QuickCheck.NonNegative i) = case mkPositive (negate i)::Result (Types.Positive Int) of Bad _ -> passTest Ok nn -> failTest $ "Built positive number '" ++ show nn ++ "' from negative or zero value " ++ show i -- | Tests building negative numbers.
289
false
true
8
9
73
90
44
46
null
null
CulpaBS/wbBach
src/Futhark/Pass/ExpandAllocations.hs
bsd-3-clause
expandedAllocations :: SubExp -> VName -> HM.HashMap VName (SubExp, Space) -> ExpandM ([Binding], RebaseMap) expandedAllocations num_threads thread_index thread_allocs = do -- We expand the allocations by multiplying their size with the -- number of kernel threads. alloc_bnds <- fmap concat $ forM (HM.toList thread_allocs) $ \(mem,(per_thread_size, space)) -> do total_size <- newVName "total_size" let sizepat = Pattern [] [PatElem total_size BindVar $ Scalar int32] allocpat = Pattern [] [PatElem mem BindVar $ MemMem (Var total_size) space] return [Let sizepat () $ PrimOp $ BinOp (Mul Int32) num_threads per_thread_size, Let allocpat () $ Op $ Alloc (Var total_size) space] -- Fix every reference to the memory blocks to be offset by the -- thread number. let alloc_offsets = RebaseMap { rebaseMap = HM.map (const newBase) thread_allocs , indexVariable = thread_index , kernelWidth = num_threads } return (alloc_bnds, alloc_offsets) where newBase old_shape = let perm = [length old_shape, 0] ++ [1..length old_shape-1] root_ixfun = IxFun.iota (old_shape ++ [SE.intSubExpToScalExp num_threads]) permuted_ixfun = IxFun.permute root_ixfun perm offset_ixfun = IxFun.applyInd permuted_ixfun [SE.Id thread_index int32] in offset_ixfun
1,533
expandedAllocations :: SubExp -> VName -> HM.HashMap VName (SubExp, Space) -> ExpandM ([Binding], RebaseMap) expandedAllocations num_threads thread_index thread_allocs = do -- We expand the allocations by multiplying their size with the -- number of kernel threads. alloc_bnds <- fmap concat $ forM (HM.toList thread_allocs) $ \(mem,(per_thread_size, space)) -> do total_size <- newVName "total_size" let sizepat = Pattern [] [PatElem total_size BindVar $ Scalar int32] allocpat = Pattern [] [PatElem mem BindVar $ MemMem (Var total_size) space] return [Let sizepat () $ PrimOp $ BinOp (Mul Int32) num_threads per_thread_size, Let allocpat () $ Op $ Alloc (Var total_size) space] -- Fix every reference to the memory blocks to be offset by the -- thread number. let alloc_offsets = RebaseMap { rebaseMap = HM.map (const newBase) thread_allocs , indexVariable = thread_index , kernelWidth = num_threads } return (alloc_bnds, alloc_offsets) where newBase old_shape = let perm = [length old_shape, 0] ++ [1..length old_shape-1] root_ixfun = IxFun.iota (old_shape ++ [SE.intSubExpToScalExp num_threads]) permuted_ixfun = IxFun.permute root_ixfun perm offset_ixfun = IxFun.applyInd permuted_ixfun [SE.Id thread_index int32] in offset_ixfun
1,533
expandedAllocations num_threads thread_index thread_allocs = do -- We expand the allocations by multiplying their size with the -- number of kernel threads. alloc_bnds <- fmap concat $ forM (HM.toList thread_allocs) $ \(mem,(per_thread_size, space)) -> do total_size <- newVName "total_size" let sizepat = Pattern [] [PatElem total_size BindVar $ Scalar int32] allocpat = Pattern [] [PatElem mem BindVar $ MemMem (Var total_size) space] return [Let sizepat () $ PrimOp $ BinOp (Mul Int32) num_threads per_thread_size, Let allocpat () $ Op $ Alloc (Var total_size) space] -- Fix every reference to the memory blocks to be offset by the -- thread number. let alloc_offsets = RebaseMap { rebaseMap = HM.map (const newBase) thread_allocs , indexVariable = thread_index , kernelWidth = num_threads } return (alloc_bnds, alloc_offsets) where newBase old_shape = let perm = [length old_shape, 0] ++ [1..length old_shape-1] root_ixfun = IxFun.iota (old_shape ++ [SE.intSubExpToScalExp num_threads]) permuted_ixfun = IxFun.permute root_ixfun perm offset_ixfun = IxFun.applyInd permuted_ixfun [SE.Id thread_index int32] in offset_ixfun
1,364
false
true
0
20
469
406
205
201
null
null
ganeti-github-testing/ganeti-test-1
src/Ganeti/Constants.hs
bsd-2-clause
hvstMemoryNode :: String hvstMemoryNode = "mem_node"
52
hvstMemoryNode :: String hvstMemoryNode = "mem_node"
52
hvstMemoryNode = "mem_node"
27
false
true
0
4
5
11
6
5
null
null
sherwoodwang/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxUSER_COLOURS :: Int wxUSER_COLOURS = 8388608
46
wxUSER_COLOURS :: Int wxUSER_COLOURS = 8388608
46
wxUSER_COLOURS = 8388608
24
false
true
0
6
5
18
7
11
null
null
nvasilakis/pandoc
src/Text/Pandoc/Readers/LaTeX.hs
gpl-2.0
breve 'u' = "ŭ"
15
breve 'u' = "ŭ"
15
breve 'u' = "ŭ"
15
false
false
0
5
3
9
4
5
null
null
TOSPIO/yi
src/library/Yi/Buffer/HighLevel.hs
gpl-2.0
-- | Move cursor to origin topB :: BufferM () topB = moveTo 0
61
topB :: BufferM () topB = moveTo 0
34
topB = moveTo 0
15
true
true
0
6
13
20
10
10
null
null
aelve/json-x
lib/Json/Internal/TH.hs
bsd-3-clause
-- | Generates a lambda expression which encodes the given data type or -- data family instance constructor as a JSON string. mkToEncoding :: Options -- ^ Encoding options. -> Name -- ^ Name of the type to encode. -> ExpQ mkToEncoding opts name = withType name (\_ _ cons _ -> consToEncoding opts cons)
328
mkToEncoding :: Options -- ^ Encoding options. -> Name -- ^ Name of the type to encode. -> ExpQ mkToEncoding opts name = withType name (\_ _ cons _ -> consToEncoding opts cons)
202
mkToEncoding opts name = withType name (\_ _ cons _ -> consToEncoding opts cons)
80
true
true
0
8
80
58
29
29
null
null
basvandijk/string-combinators
Data/String/Combinators.hs
bsd-3-clause
-- | A '}' character. rbrace :: IsString s => s rbrace = char '}'
65
rbrace :: IsString s => s rbrace = char '}'
43
rbrace = char '}'
17
true
true
0
6
14
22
11
11
null
null
leepike/copilot-core
src/Copilot/Compile/Header/C99.hs
bsd-3-clause
ppExternalVariable :: ExtVar -> Doc ppExternalVariable ExtVar { externVarName = name , externVarType = t } = text "extern" <+> text (typeSpec t) <+> text name <> text ";"
188
ppExternalVariable :: ExtVar -> Doc ppExternalVariable ExtVar { externVarName = name , externVarType = t } = text "extern" <+> text (typeSpec t) <+> text name <> text ";"
188
ppExternalVariable ExtVar { externVarName = name , externVarType = t } = text "extern" <+> text (typeSpec t) <+> text name <> text ";"
152
false
true
0
10
46
64
31
33
null
null
tamarin-prover/tamarin-prover
lib/term/src/Term/Builtin/Signature.hs
gpl-3.0
-- | Unary builtin function symbols. pkSym, hashSym, extractMessageSym, getRepSym, reportSym :: NoEqSym pkSym = ("pk",(1, Public))
130
pkSym, hashSym, extractMessageSym, getRepSym, reportSym :: NoEqSym pkSym = ("pk",(1, Public))
93
pkSym = ("pk",(1, Public))
26
true
true
0
6
16
32
23
9
null
null
rueshyna/gogol
gogol-compute/gen/Network/Google/Compute/Types/Product.hs
mpl-2.0
-- | Creates a value of 'Snapshot' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'sStorageBytesStatus' -- -- * 'sStatus' -- -- * 'sDiskSizeGb' -- -- * 'sSourceDiskId' -- -- * 'sKind' -- -- * 'sSourceDiskEncryptionKey' -- -- * 'sStorageBytes' -- -- * 'sSelfLink' -- -- * 'sSnapshotEncryptionKey' -- -- * 'sName' -- -- * 'sCreationTimestamp' -- -- * 'sId' -- -- * 'sLicenses' -- -- * 'sSourceDisk' -- -- * 'sDescription' snapshot :: Snapshot snapshot = Snapshot' { _sStorageBytesStatus = Nothing , _sStatus = Nothing , _sDiskSizeGb = Nothing , _sSourceDiskId = Nothing , _sKind = "compute#snapshot" , _sSourceDiskEncryptionKey = Nothing , _sStorageBytes = Nothing , _sSelfLink = Nothing , _sSnapshotEncryptionKey = Nothing , _sName = Nothing , _sCreationTimestamp = Nothing , _sId = Nothing , _sLicenses = Nothing , _sSourceDisk = Nothing , _sDescription = Nothing }
1,023
snapshot :: Snapshot snapshot = Snapshot' { _sStorageBytesStatus = Nothing , _sStatus = Nothing , _sDiskSizeGb = Nothing , _sSourceDiskId = Nothing , _sKind = "compute#snapshot" , _sSourceDiskEncryptionKey = Nothing , _sStorageBytes = Nothing , _sSelfLink = Nothing , _sSnapshotEncryptionKey = Nothing , _sName = Nothing , _sCreationTimestamp = Nothing , _sId = Nothing , _sLicenses = Nothing , _sSourceDisk = Nothing , _sDescription = Nothing }
517
snapshot = Snapshot' { _sStorageBytesStatus = Nothing , _sStatus = Nothing , _sDiskSizeGb = Nothing , _sSourceDiskId = Nothing , _sKind = "compute#snapshot" , _sSourceDiskEncryptionKey = Nothing , _sStorageBytes = Nothing , _sSelfLink = Nothing , _sSnapshotEncryptionKey = Nothing , _sName = Nothing , _sCreationTimestamp = Nothing , _sId = Nothing , _sLicenses = Nothing , _sSourceDisk = Nothing , _sDescription = Nothing }
492
true
true
0
7
228
146
102
44
null
null
juhp/stack
src/Stack/Package.hs
bsd-3-clause
-- | Get all files referenced by the package. packageDescModulesAndFiles :: PackageDescription -> RIO Ctx (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent [DotCabalPath], Set (Path Abs File), [PackageWarning]) packageDescModulesAndFiles pkg = do (libraryMods,libDotCabalFiles,libWarnings) <- maybe (return (M.empty, M.empty, [])) (asModuleAndFileMap libComponent libraryFiles) (library pkg) (subLibrariesMods,subLibDotCabalFiles,subLibWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap internalLibComponent libraryFiles) (subLibraries pkg)) (executableMods,exeDotCabalFiles,exeWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap exeComponent executableFiles) (executables pkg)) (testMods,testDotCabalFiles,testWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap testComponent testFiles) (testSuites pkg)) (benchModules,benchDotCabalPaths,benchWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap benchComponent benchmarkFiles) (benchmarks pkg)) dfiles <- resolveGlobFiles (specVersion pkg) (extraSrcFiles pkg ++ map (dataDir pkg FilePath.</>) (dataFiles pkg)) let modules = libraryMods <> subLibrariesMods <> executableMods <> testMods <> benchModules files = libDotCabalFiles <> subLibDotCabalFiles <> exeDotCabalFiles <> testDotCabalFiles <> benchDotCabalPaths warnings = libWarnings <> subLibWarnings <> exeWarnings <> testWarnings <> benchWarnings return (modules, files, dfiles, warnings) where libComponent = const CLib internalLibComponent = CInternalLib . T.pack . maybe "" Cabal.unUnqualComponentName . libraryNameString . libName exeComponent = CExe . T.pack . Cabal.unUnqualComponentName . exeName testComponent = CTest . T.pack . Cabal.unUnqualComponentName . testName benchComponent = CBench . T.pack . Cabal.unUnqualComponentName . benchmarkName asModuleAndFileMap label f lib = do (a,b,c) <- f (label lib) lib return (M.singleton (label lib) a, M.singleton (label lib) b, c) foldTuples = foldl' (<>) (M.empty, M.empty, []) -- | Resolve globbing of files (e.g. data files) to absolute paths.
2,490
packageDescModulesAndFiles :: PackageDescription -> RIO Ctx (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent [DotCabalPath], Set (Path Abs File), [PackageWarning]) packageDescModulesAndFiles pkg = do (libraryMods,libDotCabalFiles,libWarnings) <- maybe (return (M.empty, M.empty, [])) (asModuleAndFileMap libComponent libraryFiles) (library pkg) (subLibrariesMods,subLibDotCabalFiles,subLibWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap internalLibComponent libraryFiles) (subLibraries pkg)) (executableMods,exeDotCabalFiles,exeWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap exeComponent executableFiles) (executables pkg)) (testMods,testDotCabalFiles,testWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap testComponent testFiles) (testSuites pkg)) (benchModules,benchDotCabalPaths,benchWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap benchComponent benchmarkFiles) (benchmarks pkg)) dfiles <- resolveGlobFiles (specVersion pkg) (extraSrcFiles pkg ++ map (dataDir pkg FilePath.</>) (dataFiles pkg)) let modules = libraryMods <> subLibrariesMods <> executableMods <> testMods <> benchModules files = libDotCabalFiles <> subLibDotCabalFiles <> exeDotCabalFiles <> testDotCabalFiles <> benchDotCabalPaths warnings = libWarnings <> subLibWarnings <> exeWarnings <> testWarnings <> benchWarnings return (modules, files, dfiles, warnings) where libComponent = const CLib internalLibComponent = CInternalLib . T.pack . maybe "" Cabal.unUnqualComponentName . libraryNameString . libName exeComponent = CExe . T.pack . Cabal.unUnqualComponentName . exeName testComponent = CTest . T.pack . Cabal.unUnqualComponentName . testName benchComponent = CBench . T.pack . Cabal.unUnqualComponentName . benchmarkName asModuleAndFileMap label f lib = do (a,b,c) <- f (label lib) lib return (M.singleton (label lib) a, M.singleton (label lib) b, c) foldTuples = foldl' (<>) (M.empty, M.empty, []) -- | Resolve globbing of files (e.g. data files) to absolute paths.
2,444
packageDescModulesAndFiles pkg = do (libraryMods,libDotCabalFiles,libWarnings) <- maybe (return (M.empty, M.empty, [])) (asModuleAndFileMap libComponent libraryFiles) (library pkg) (subLibrariesMods,subLibDotCabalFiles,subLibWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap internalLibComponent libraryFiles) (subLibraries pkg)) (executableMods,exeDotCabalFiles,exeWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap exeComponent executableFiles) (executables pkg)) (testMods,testDotCabalFiles,testWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap testComponent testFiles) (testSuites pkg)) (benchModules,benchDotCabalPaths,benchWarnings) <- liftM foldTuples (mapM (asModuleAndFileMap benchComponent benchmarkFiles) (benchmarks pkg)) dfiles <- resolveGlobFiles (specVersion pkg) (extraSrcFiles pkg ++ map (dataDir pkg FilePath.</>) (dataFiles pkg)) let modules = libraryMods <> subLibrariesMods <> executableMods <> testMods <> benchModules files = libDotCabalFiles <> subLibDotCabalFiles <> exeDotCabalFiles <> testDotCabalFiles <> benchDotCabalPaths warnings = libWarnings <> subLibWarnings <> exeWarnings <> testWarnings <> benchWarnings return (modules, files, dfiles, warnings) where libComponent = const CLib internalLibComponent = CInternalLib . T.pack . maybe "" Cabal.unUnqualComponentName . libraryNameString . libName exeComponent = CExe . T.pack . Cabal.unUnqualComponentName . exeName testComponent = CTest . T.pack . Cabal.unUnqualComponentName . testName benchComponent = CBench . T.pack . Cabal.unUnqualComponentName . benchmarkName asModuleAndFileMap label f lib = do (a,b,c) <- f (label lib) lib return (M.singleton (label lib) a, M.singleton (label lib) b, c) foldTuples = foldl' (<>) (M.empty, M.empty, []) -- | Resolve globbing of files (e.g. data files) to absolute paths.
2,248
true
true
0
13
669
658
338
320
null
null
slon1024/functional_programming
haskell/Factorial.hs
mit
fact0 0 = 1
11
fact0 0 = 1
11
fact0 0 = 1
11
false
false
1
5
3
13
4
9
null
null
Helkafen/haddock
haddock-api/src/Haddock/Backends/Hoogle.hs
bsd-2-clause
ppExport _ _ = []
17
ppExport _ _ = []
17
ppExport _ _ = []
17
false
false
0
5
4
13
6
7
null
null
facebookincubator/duckling
Duckling/Rules/SK.hs
bsd-3-clause
langRules (Seal Quantity) = []
30
langRules (Seal Quantity) = []
30
langRules (Seal Quantity) = []
30
false
false
0
7
4
17
8
9
null
null
leichunfeng/learnyouahaskell
For-a-Few-Monads-More.hs
mit
finalCountDown' x = do finalCountDown' (x-1) tell [show x] ------------------------------------ -- Reader? Ugh, not this joke again. ------------------------------------
178
finalCountDown' x = do finalCountDown' (x-1) tell [show x] ------------------------------------ -- Reader? Ugh, not this joke again. ------------------------------------
178
finalCountDown' x = do finalCountDown' (x-1) tell [show x] ------------------------------------ -- Reader? Ugh, not this joke again. ------------------------------------
178
false
false
1
10
26
41
18
23
null
null
akc/sym
Sym/Perm/Stat.hs
bsd-3-clause
lds :: Perm -> Int lds = length . Y.recordingTableau . Y.fromPerm
65
lds :: Perm -> Int lds = length . Y.recordingTableau . Y.fromPerm
65
lds = length . Y.recordingTableau . Y.fromPerm
46
false
true
0
7
11
34
15
19
null
null
mightymoose/liquidhaskell
benchmarks/bytestring-0.9.2.1/Data/ByteString.T.hs
bsd-3-clause
-- --------------------------------------------------------------------- -- Special folds -- | /O(n)/ Concatenate a list of ByteStrings. {-@ concat :: bs:[ByteString] -> {v:ByteString | (bLength v) = (bLengths bs)} @-} concat :: [ByteString] -> ByteString concat [] = empty
278
concat :: [ByteString] -> ByteString concat [] = empty
58
concat [] = empty
21
true
true
0
6
39
27
16
11
null
null
athanclark/lucid-foundation
src/Lucid/Foundation/Typography/InlineList.hs
bsd-3-clause
inline_list_ :: T.Text inline_list_ = " inline-list "
53
inline_list_ :: T.Text inline_list_ = " inline-list "
53
inline_list_ = " inline-list "
30
false
true
0
7
7
20
8
12
null
null
agocorona/transient
src/Transient/Indeterminism.hs
mit
hoose' :: [a] -> TransIO a choose' xs = foldl (<|>) empty $ map (async . return) xs
85
choose' :: [a] -> TransIO a choose' xs = foldl (<|>) empty $ map (async . return) xs
84
choose' xs = foldl (<|>) empty $ map (async . return) xs
56
false
true
0
8
19
52
25
27
null
null
ancientlanguage/haskell-analysis
grammar/src/Grammar/Common/Decompose.hs
mit
decomposeChar '\xF94D' = "\x6DDA"
33
decomposeChar '\xF94D' = "\x6DDA"
33
decomposeChar '\xF94D' = "\x6DDA"
33
false
false
0
5
3
9
4
5
null
null
sweirich/tal
src/K.hs
mit
extendTms :: [ValName] -> [Ty] -> Ctx -> Ctx extendTms [] [] ctx = ctx
70
extendTms :: [ValName] -> [Ty] -> Ctx -> Ctx extendTms [] [] ctx = ctx
70
extendTms [] [] ctx = ctx
25
false
true
0
7
14
40
21
19
null
null
TomMD/ghc
compiler/cmm/SMRep.hs
bsd-3-clause
hdrSize :: DynFlags -> SMRep -> ByteOff hdrSize dflags rep = wordsToBytes dflags (hdrSizeW dflags rep)
102
hdrSize :: DynFlags -> SMRep -> ByteOff hdrSize dflags rep = wordsToBytes dflags (hdrSizeW dflags rep)
102
hdrSize dflags rep = wordsToBytes dflags (hdrSizeW dflags rep)
62
false
true
0
7
15
37
18
19
null
null
pparkkin/eta
compiler/ETA/HsSyn/HsExpr.hs
bsd-3-clause
pprMatchContextNoun ThPatQuote = ptext (sLit "Template Haskell pattern quotation")
87
pprMatchContextNoun ThPatQuote = ptext (sLit "Template Haskell pattern quotation")
87
pprMatchContextNoun ThPatQuote = ptext (sLit "Template Haskell pattern quotation")
87
false
false
0
7
13
18
8
10
null
null
spatial-reasoning/homer
HomFinder.hs
bsd-2-clause
isCompat :: [Maybe ((String, String), (String, String))] -> Bool isCompat lst = length (filter (\x -> x == Nothing) lst) == 0
137
isCompat :: [Maybe ((String, String), (String, String))] -> Bool isCompat lst = length (filter (\x -> x == Nothing) lst) == 0
137
isCompat lst = length (filter (\x -> x == Nothing) lst) == 0
60
false
true
0
11
33
69
38
31
null
null
AndreasPK/stack
src/Stack/Types/FlagName.hs
bsd-3-clause
parseFlagName :: MonadThrow m => Text -> m FlagName parseFlagName x = go x where go = either (const (throwM (FlagNameParseFail x))) return . parseOnly (flagNameParser <* endOfInput) -- | Convenience function for parsing from a 'String'
258
parseFlagName :: MonadThrow m => Text -> m FlagName parseFlagName x = go x where go = either (const (throwM (FlagNameParseFail x))) return . parseOnly (flagNameParser <* endOfInput) -- | Convenience function for parsing from a 'String'
258
parseFlagName x = go x where go = either (const (throwM (FlagNameParseFail x))) return . parseOnly (flagNameParser <* endOfInput) -- | Convenience function for parsing from a 'String'
206
false
true
0
12
59
77
37
40
null
null
mattgreen/hython
src/Hython/Statement.hs
gpl-3.0
eval (Del (Subscript expr idxExpr)) = do target <- evalExpr expr index <- evalExpr idxExpr void $ invoke target "__delitem__" [index]
149
eval (Del (Subscript expr idxExpr)) = do target <- evalExpr expr index <- evalExpr idxExpr void $ invoke target "__delitem__" [index]
149
eval (Del (Subscript expr idxExpr)) = do target <- evalExpr expr index <- evalExpr idxExpr void $ invoke target "__delitem__" [index]
149
false
false
0
9
36
60
27
33
null
null
emilaxelsson/open-typerep
src/Data/TypeRep/TH.hs
bsd-3-clause
derivePWitnessAny :: Name -- ^ Type name -> DecsQ derivePWitnessAny ty = do deriveClass [] ty (foldl1 AppT [ConT ''PWitness, ConT ''Any, ConT ty, tVar]) [MatchingMethod 'pwitSym witSymClause []] where witSymClause _ _ con 0 = Clause [WildP, WildP] (NormalB $ AppE (VarE 'return) (ConE 'Dict)) [] -- | Derive @`Witness` (`Typeable` Ty)@ instance for a type representation -- -- > instance (Ty :<: t) => Witness (Typeable t) Ty t where -- > witSym Con1 Nil = Dict -- > witSym Con2 (a :* b :* Nil) = -- > case wit (Proxy :: Proxy (Typeable t)) (TypeRep a) of -- > Dict -> case wit (Proxy :: Proxy (Typeable t)) (TypeRep b) of -- > Dict -> Dict
724
derivePWitnessAny :: Name -- ^ Type name -> DecsQ derivePWitnessAny ty = do deriveClass [] ty (foldl1 AppT [ConT ''PWitness, ConT ''Any, ConT ty, tVar]) [MatchingMethod 'pwitSym witSymClause []] where witSymClause _ _ con 0 = Clause [WildP, WildP] (NormalB $ AppE (VarE 'return) (ConE 'Dict)) [] -- | Derive @`Witness` (`Typeable` Ty)@ instance for a type representation -- -- > instance (Ty :<: t) => Witness (Typeable t) Ty t where -- > witSym Con1 Nil = Dict -- > witSym Con2 (a :* b :* Nil) = -- > case wit (Proxy :: Proxy (Typeable t)) (TypeRep a) of -- > Dict -> case wit (Proxy :: Proxy (Typeable t)) (TypeRep b) of -- > Dict -> Dict
724
derivePWitnessAny ty = do deriveClass [] ty (foldl1 AppT [ConT ''PWitness, ConT ''Any, ConT ty, tVar]) [MatchingMethod 'pwitSym witSymClause []] where witSymClause _ _ con 0 = Clause [WildP, WildP] (NormalB $ AppE (VarE 'return) (ConE 'Dict)) [] -- | Derive @`Witness` (`Typeable` Ty)@ instance for a type representation -- -- > instance (Ty :<: t) => Witness (Typeable t) Ty t where -- > witSym Con1 Nil = Dict -- > witSym Con2 (a :* b :* Nil) = -- > case wit (Proxy :: Proxy (Typeable t)) (TypeRep a) of -- > Dict -> case wit (Proxy :: Proxy (Typeable t)) (TypeRep b) of -- > Dict -> Dict
665
false
true
0
12
203
144
78
66
null
null
fmthoma/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
bindMClassOpKey = mkPreludeMiscIdUnique 171
57
bindMClassOpKey = mkPreludeMiscIdUnique 171
57
bindMClassOpKey = mkPreludeMiscIdUnique 171
57
false
false
0
5
17
9
4
5
null
null
fmapfmapfmap/amazonka
amazonka-redshift/gen/Network/AWS/Redshift/RotateEncryptionKey.hs
mpl-2.0
-- | Creates a value of 'RotateEncryptionKey' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'rekClusterIdentifier' rotateEncryptionKey :: Text -- ^ 'rekClusterIdentifier' -> RotateEncryptionKey rotateEncryptionKey pClusterIdentifier_ = RotateEncryptionKey' { _rekClusterIdentifier = pClusterIdentifier_ }
411
rotateEncryptionKey :: Text -- ^ 'rekClusterIdentifier' -> RotateEncryptionKey rotateEncryptionKey pClusterIdentifier_ = RotateEncryptionKey' { _rekClusterIdentifier = pClusterIdentifier_ }
209
rotateEncryptionKey pClusterIdentifier_ = RotateEncryptionKey' { _rekClusterIdentifier = pClusterIdentifier_ }
122
true
true
0
6
70
32
20
12
null
null
frozencemetery/haskey
src/XOut.hs
gpl-3.0
mapkey '}' = ([xK_Shift_R], xK_bracketright)
44
mapkey '}' = ([xK_Shift_R], xK_bracketright)
44
mapkey '}' = ([xK_Shift_R], xK_bracketright)
44
false
false
1
6
4
21
10
11
null
null
bobatkey/Forvie
benchmarks/parse-foveran/Identifier.hs
bsd-3-clause
bind :: Ident -> NameSupply a -> NameSupply (Ident, a) bind nm (NS f) = NS $ \(used, bound) -> let (used',nm') = freshen used nm in (nm', f (used', nm':bound))
161
bind :: Ident -> NameSupply a -> NameSupply (Ident, a) bind nm (NS f) = NS $ \(used, bound) -> let (used',nm') = freshen used nm in (nm', f (used', nm':bound))
161
bind nm (NS f) = NS $ \(used, bound) -> let (used',nm') = freshen used nm in (nm', f (used', nm':bound))
106
false
true
0
12
32
99
52
47
null
null
dongy7/raytracer
src/Render/Setup.hs
mit
createShadedImage :: IO Image createShadedImage = do clearColor $= Color4 0 0 0 0 shadeModel $= Flat rowAlignment Unpack $= 1 rayTrace sceneImageSize 0x8
253
createShadedImage :: IO Image createShadedImage = do clearColor $= Color4 0 0 0 0 shadeModel $= Flat rowAlignment Unpack $= 1 rayTrace sceneImageSize 0x8
253
createShadedImage = do clearColor $= Color4 0 0 0 0 shadeModel $= Flat rowAlignment Unpack $= 1 rayTrace sceneImageSize 0x8
223
false
true
0
9
123
61
25
36
null
null
KeithKirk/haskell-ciphers
rotor.hs
mit
decodeString (top:bottom) rotors key = (decodeChar rotors top) : (decodeString bottom (rotateRotors rotors key) key)
116
decodeString (top:bottom) rotors key = (decodeChar rotors top) : (decodeString bottom (rotateRotors rotors key) key)
116
decodeString (top:bottom) rotors key = (decodeChar rotors top) : (decodeString bottom (rotateRotors rotors key) key)
116
false
false
0
9
14
50
25
25
null
null
xenog/haskoin
src/Network/Haskoin/Script/Standard.hs
unlicense
decodeInputBS :: ByteString -> Either String ScriptInput decodeInputBS = decodeInput <=< decode
95
decodeInputBS :: ByteString -> Either String ScriptInput decodeInputBS = decodeInput <=< decode
95
decodeInputBS = decodeInput <=< decode
38
false
true
0
6
11
24
12
12
null
null
antarestrader/sapphire
Lexer.hs
gpl-3.0
skip :: Lexer [Token] skip = return []
38
skip :: Lexer [Token] skip = return []
38
skip = return []
16
false
true
0
7
7
28
12
16
null
null
ucsd-progsys/nanomaly
src/NanoML/Classify.hs
bsd-3-clause
exprSize = const 1
18
exprSize = const 1
18
exprSize = const 1
18
false
false
0
5
3
9
4
5
null
null
jmikkola/Athena
src/Interpreter.hs
mit
builtinPrint :: [Value] -> IO Value builtinPrint args = case args of [VString s] -> do putStr s hFlush stdout return VVoid _ -> error "non-string value to print" -- Note: Keep this in sync with the types allowed by Inference.canCast.
251
builtinPrint :: [Value] -> IO Value builtinPrint args = case args of [VString s] -> do putStr s hFlush stdout return VVoid _ -> error "non-string value to print" -- Note: Keep this in sync with the types allowed by Inference.canCast.
251
builtinPrint args = case args of [VString s] -> do putStr s hFlush stdout return VVoid _ -> error "non-string value to print" -- Note: Keep this in sync with the types allowed by Inference.canCast.
215
false
true
0
10
58
72
32
40
null
null
brendanhay/gogol
gogol-admin-directory/gen/Network/Google/Resource/Admin/Customers/Chrome/Printers/ListPrinterModels.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). ccplpmUploadProtocol :: Lens' CustomersChromePrintersListPrinterModels (Maybe Text) ccplpmUploadProtocol = lens _ccplpmUploadProtocol (\ s a -> s{_ccplpmUploadProtocol = a})
243
ccplpmUploadProtocol :: Lens' CustomersChromePrintersListPrinterModels (Maybe Text) ccplpmUploadProtocol = lens _ccplpmUploadProtocol (\ s a -> s{_ccplpmUploadProtocol = a})
181
ccplpmUploadProtocol = lens _ccplpmUploadProtocol (\ s a -> s{_ccplpmUploadProtocol = a})
97
true
true
1
9
33
52
25
27
null
null
MagneticDuck/simpleirc
Network/SimpleIRC/Core.hs
bsd-3-clause
(Notice _) `eqEvent` (Notice _) = True
40
(Notice _) `eqEvent` (Notice _) = True
40
(Notice _) `eqEvent` (Notice _) = True
40
false
false
0
7
8
26
13
13
null
null
copton/bitcoin-script-tools
src/Language/Bitcoin/Parser.hs
gpl-3.0
push :: Parser Command push = pushN checkLength checkValue Direct where checkLength len = when (len /= 1) $ parserFail "OP_PUSHDATA expects a one byte size parameter" checkValue value = when (value > 75) $ parserFail "OP_PUSHDATA only support up to 75 bytes of data"
276
push :: Parser Command push = pushN checkLength checkValue Direct where checkLength len = when (len /= 1) $ parserFail "OP_PUSHDATA expects a one byte size parameter" checkValue value = when (value > 75) $ parserFail "OP_PUSHDATA only support up to 75 bytes of data"
276
push = pushN checkLength checkValue Direct where checkLength len = when (len /= 1) $ parserFail "OP_PUSHDATA expects a one byte size parameter" checkValue value = when (value > 75) $ parserFail "OP_PUSHDATA only support up to 75 bytes of data"
253
false
true
1
8
54
81
36
45
null
null
ganeti/ganeti
src/Ganeti/OpParams.hs
bsd-2-clause
pInstOsParams :: Field pInstOsParams = withDoc "OS parameters for instance" . renameField "InstOsParams" . defaultField [| toJSObject [] |] $ simpleField "osparams" [t| JSObject JSValue |]
196
pInstOsParams :: Field pInstOsParams = withDoc "OS parameters for instance" . renameField "InstOsParams" . defaultField [| toJSObject [] |] $ simpleField "osparams" [t| JSObject JSValue |]
196
pInstOsParams = withDoc "OS parameters for instance" . renameField "InstOsParams" . defaultField [| toJSObject [] |] $ simpleField "osparams" [t| JSObject JSValue |]
173
false
true
1
6
33
53
25
28
null
null
kosmoskatten/traffic-analysis
src/Network/Traffic/Object/Types.hs
mit
maybeRead :: Read a => String -> Maybe a maybeRead xs = case reads xs of [(x, "")] -> Just x _ -> Nothing
123
maybeRead :: Read a => String -> Maybe a maybeRead xs = case reads xs of [(x, "")] -> Just x _ -> Nothing
123
maybeRead xs = case reads xs of [(x, "")] -> Just x _ -> Nothing
82
false
true
0
9
41
59
29
30
null
null
ajnsit/reflex-platform
examples/host.hs
bsd-3-clause
-- | Run a program written in the framework. This will do all the necessary -- work to integrate the Reflex-based guest program with the outside world -- via IO. host :: (forall t m. TypingApp t m) -- ^ By keeping t and m abstract, we ensure that the user (the -- programmer using our framework) can't make any assumptions -- about which Reflex implementation is being used -> IO () host myGuest = -- Use the Spider implementation of Reflex. runSpiderHost $ do -- Create an event to be used as input. -- It will fire wehenver we use eTriggerRef. (e, eTriggerRef) <- newEventWithTriggerRef -- Evaluate our user's program to set up the data flow graph. -- This usually only needs to be done once; the user can change the data -- flow graph arbitrarily in response to events. -- -- runHostFrame is an efficient way of running a computation that -- can build arbitrary data flow graphs using 'hold' and 'sample'. -- -- (The pure combinators in the Reflex class can be used in any context, -- so they don't need any special treatment - but inside runHostFrame is -- as good a place as any to run them.) b <- runHostFrame $ myGuest e -- Begin our event processing loop. forever $ do -- Get an input event and display it. input <- liftIO getChar liftIO $ putStrLn $ "Input Event: " ++ show input -- Retrieve the current event trigger. mETrigger <- liftIO $ readIORef eTriggerRef -- Use the trigger to deliver the event. case mETrigger of Nothing -> -- This means that nobody is subscribed to the input event. -- -- Since this is the only input event in this system, that would -- mean the guest program must be really boring! However, in larger -- programs, there are often many input events, and most programs -- will not care about every single one of them. -- -- Note: The missing trigger does NOT mean we should buffer the -- input and deliver it later - it means that nobody is interested -- in this occurrence, so we should discard it. return () Just eTrigger -> -- We have a trigger, so someone is interested in this input event -- occurrence. -- -- fireEvents will process an event frame to deliver the event to -- anyone in the data flow graph who is interested in it. It can -- also deliver multiple simultaneous events if necessary. However, -- the same event cannot be firing multiple times simultaneously; -- system behavior is undefined if the same trigger is provided more -- than once. fireEvents [eTrigger :=> Identity input] -- Retrieve the current output of the user's program and display it. output <- runHostFrame $ sample b liftIO $ putStrLn $ "Output Behavior: " ++ show output -- | This is a simple guest program written with our framework. It just -- accumulates all the characters that the user has typed. -- Backspace functionality is left as an exercise for the reader.
3,199
host :: (forall t m. TypingApp t m) -- ^ By keeping t and m abstract, we ensure that the user (the -- programmer using our framework) can't make any assumptions -- about which Reflex implementation is being used -> IO () host myGuest = -- Use the Spider implementation of Reflex. runSpiderHost $ do -- Create an event to be used as input. -- It will fire wehenver we use eTriggerRef. (e, eTriggerRef) <- newEventWithTriggerRef -- Evaluate our user's program to set up the data flow graph. -- This usually only needs to be done once; the user can change the data -- flow graph arbitrarily in response to events. -- -- runHostFrame is an efficient way of running a computation that -- can build arbitrary data flow graphs using 'hold' and 'sample'. -- -- (The pure combinators in the Reflex class can be used in any context, -- so they don't need any special treatment - but inside runHostFrame is -- as good a place as any to run them.) b <- runHostFrame $ myGuest e -- Begin our event processing loop. forever $ do -- Get an input event and display it. input <- liftIO getChar liftIO $ putStrLn $ "Input Event: " ++ show input -- Retrieve the current event trigger. mETrigger <- liftIO $ readIORef eTriggerRef -- Use the trigger to deliver the event. case mETrigger of Nothing -> -- This means that nobody is subscribed to the input event. -- -- Since this is the only input event in this system, that would -- mean the guest program must be really boring! However, in larger -- programs, there are often many input events, and most programs -- will not care about every single one of them. -- -- Note: The missing trigger does NOT mean we should buffer the -- input and deliver it later - it means that nobody is interested -- in this occurrence, so we should discard it. return () Just eTrigger -> -- We have a trigger, so someone is interested in this input event -- occurrence. -- -- fireEvents will process an event frame to deliver the event to -- anyone in the data flow graph who is interested in it. It can -- also deliver multiple simultaneous events if necessary. However, -- the same event cannot be firing multiple times simultaneously; -- system behavior is undefined if the same trigger is provided more -- than once. fireEvents [eTrigger :=> Identity input] -- Retrieve the current output of the user's program and display it. output <- runHostFrame $ sample b liftIO $ putStrLn $ "Output Behavior: " ++ show output -- | This is a simple guest program written with our framework. It just -- accumulates all the characters that the user has typed. -- Backspace functionality is left as an exercise for the reader.
3,032
host myGuest = -- Use the Spider implementation of Reflex. runSpiderHost $ do -- Create an event to be used as input. -- It will fire wehenver we use eTriggerRef. (e, eTriggerRef) <- newEventWithTriggerRef -- Evaluate our user's program to set up the data flow graph. -- This usually only needs to be done once; the user can change the data -- flow graph arbitrarily in response to events. -- -- runHostFrame is an efficient way of running a computation that -- can build arbitrary data flow graphs using 'hold' and 'sample'. -- -- (The pure combinators in the Reflex class can be used in any context, -- so they don't need any special treatment - but inside runHostFrame is -- as good a place as any to run them.) b <- runHostFrame $ myGuest e -- Begin our event processing loop. forever $ do -- Get an input event and display it. input <- liftIO getChar liftIO $ putStrLn $ "Input Event: " ++ show input -- Retrieve the current event trigger. mETrigger <- liftIO $ readIORef eTriggerRef -- Use the trigger to deliver the event. case mETrigger of Nothing -> -- This means that nobody is subscribed to the input event. -- -- Since this is the only input event in this system, that would -- mean the guest program must be really boring! However, in larger -- programs, there are often many input events, and most programs -- will not care about every single one of them. -- -- Note: The missing trigger does NOT mean we should buffer the -- input and deliver it later - it means that nobody is interested -- in this occurrence, so we should discard it. return () Just eTrigger -> -- We have a trigger, so someone is interested in this input event -- occurrence. -- -- fireEvents will process an event frame to deliver the event to -- anyone in the data flow graph who is interested in it. It can -- also deliver multiple simultaneous events if necessary. However, -- the same event cannot be firing multiple times simultaneously; -- system behavior is undefined if the same trigger is provided more -- than once. fireEvents [eTrigger :=> Identity input] -- Retrieve the current output of the user's program and display it. output <- runHostFrame $ sample b liftIO $ putStrLn $ "Output Behavior: " ++ show output -- | This is a simple guest program written with our framework. It just -- accumulates all the characters that the user has typed. -- Backspace functionality is left as an exercise for the reader.
2,778
true
true
0
17
914
235
133
102
null
null
dysinger/amazonka
amazonka/src/Network/AWS.hs
mpl-2.0
-- | Poll the API until a predefined condition is fulfilled using the -- supplied 'Wait' specification from the respective service. -- -- The response will be either the first error returned that is not handled -- by the specification, or the successful response from the await request. -- -- /Note:/ You can find any available 'Wait' specifications under then -- @Network.AWS.<ServiceName>.Waiters@ namespace for supported services. await :: (MonadCatch m, MonadResource m, AWSRequest a) => Env -> Wait a -> a -> m (Response a) await e w (request -> rq) = fmap snd <$> waiter e w rq (raw e rq)
618
await :: (MonadCatch m, MonadResource m, AWSRequest a) => Env -> Wait a -> a -> m (Response a) await e w (request -> rq) = fmap snd <$> waiter e w rq (raw e rq)
184
await e w (request -> rq) = fmap snd <$> waiter e w rq (raw e rq)
65
true
true
0
12
125
106
55
51
null
null
deweyvm/starstats
src/StarStats/Parsers/ChatZilla.hs
mit
parseAction :: Parser DataLine parseAction = Message <$> parseTime <*> return 1 <*> (symbol "* " *> parseNick) <*> eatLine
167
parseAction :: Parser DataLine parseAction = Message <$> parseTime <*> return 1 <*> (symbol "* " *> parseNick) <*> eatLine
166
parseAction = Message <$> parseTime <*> return 1 <*> (symbol "* " *> parseNick) <*> eatLine
135
false
true
0
9
64
43
21
22
null
null
thinkpad20/rowling
src/Language/Rowling/Parser.hs
mit
pList :: Parser Expr pList = grab $ between (schar '[') (schar ']') $ pExpr `sepBy` schar ',' where grab = map GHC.fromList -- | Creates a "tuple" (record with integer fields) from an expression list.
203
pList :: Parser Expr pList = grab $ between (schar '[') (schar ']') $ pExpr `sepBy` schar ',' where grab = map GHC.fromList -- | Creates a "tuple" (record with integer fields) from an expression list.
203
pList = grab $ between (schar '[') (schar ']') $ pExpr `sepBy` schar ',' where grab = map GHC.fromList -- | Creates a "tuple" (record with integer fields) from an expression list.
182
false
true
3
9
38
73
32
41
null
null
brendanhay/gogol
gogol-composer/gen/Network/Google/Resource/Composer/Projects/Locations/Environments/Patch.hs
mpl-2.0
-- | JSONP plepCallback :: Lens' ProjectsLocationsEnvironmentsPatch (Maybe Text) plepCallback = lens _plepCallback (\ s a -> s{_plepCallback = a})
148
plepCallback :: Lens' ProjectsLocationsEnvironmentsPatch (Maybe Text) plepCallback = lens _plepCallback (\ s a -> s{_plepCallback = a})
137
plepCallback = lens _plepCallback (\ s a -> s{_plepCallback = a})
67
true
true
0
9
21
49
25
24
null
null
delta4d/codewars
kata/a-star-b-equals-b-star-a-prove-it/TimesComm.hs
mit
plusAssoc NumZ (NumS b) c = EqlS (plusAssoc NumZ b c)
53
plusAssoc NumZ (NumS b) c = EqlS (plusAssoc NumZ b c)
53
plusAssoc NumZ (NumS b) c = EqlS (plusAssoc NumZ b c)
53
false
false
0
7
10
32
15
17
null
null
raventid/coursera_learning
haskell/will_kurt/capstone_mark_to_html.hs
mit
-- MARC parsing leaderLength :: Int leaderLength = 24
53
leaderLength :: Int leaderLength = 24
37
leaderLength = 24
17
true
true
0
4
8
12
7
5
null
null
DougBurke/swish
src/Swish/RDF/ProofContext.hs
lgpl-2.1
------------------------------------------------------------ -- Define RDFD (datatyping) axioms ------------------------------------------------------------ -- scopeRDFD = Namespace "rdfd" "http://id.ninebynine.org/2003/Ruleset/rdfd#" axiomsRDFD :: [RDFFormula] axiomsRDFD = [ ]
289
axiomsRDFD :: [RDFFormula] axiomsRDFD = [ ]
51
axiomsRDFD = [ ]
24
true
true
0
5
30
20
13
7
null
null
mk12/luminosity
src/Luminosity/Trace.hs
mit
lighting :: Material -- ^ The material of the object which the point is on. -> Vector -- ^ The position vector of the point. -> Vector -- ^ The normal vector of the point. -> [Object] -- ^ The objects in the scene (for tracing shadows). -> Light -- ^ The light source. -> Colour -- ^ The colour that the light source contributes. lighting mat p n objs (Light x c) | lambert <= 0 || not (null ints) = mempty | otherwise = (*) <$> lambert *> c <*> mDiffuse mat where shadow = normalize $ x <-> p lambert = shadow <.> n dist = norm $ x <-> p ints = filter ((<= dist) . snd) $ intersections objs (Ray p shadow)
690
lighting :: Material -- ^ The material of the object which the point is on. -> Vector -- ^ The position vector of the point. -> Vector -- ^ The normal vector of the point. -> [Object] -- ^ The objects in the scene (for tracing shadows). -> Light -- ^ The light source. -> Colour lighting mat p n objs (Light x c) | lambert <= 0 || not (null ints) = mempty | otherwise = (*) <$> lambert *> c <*> mDiffuse mat where shadow = normalize $ x <-> p lambert = shadow <.> n dist = norm $ x <-> p ints = filter ((<= dist) . snd) $ intersections objs (Ray p shadow)
636
lighting mat p n objs (Light x c) | lambert <= 0 || not (null ints) = mempty | otherwise = (*) <$> lambert *> c <*> mDiffuse mat where shadow = normalize $ x <-> p lambert = shadow <.> n dist = norm $ x <-> p ints = filter ((<= dist) . snd) $ intersections objs (Ray p shadow)
321
true
true
17
13
210
209
99
110
null
null
blanu/arbre
bin/test.hs
gpl-2.0
testAnd = modul [ Def "main" (Call (env "and") [true, false]) ]
69
testAnd = modul [ Def "main" (Call (env "and") [true, false]) ]
69
testAnd = modul [ Def "main" (Call (env "and") [true, false]) ]
69
false
false
0
11
17
37
19
18
null
null
peterson/lets-tree
tests/BinomialHeap.hs
bsd-3-clause
prop_heap_max_trees :: BinHeap Int -> Bool prop_heap_max_trees ts = count <= limit where count = length ts limit = floor $ lg (fromIntegral $ size ts) + 1 lg = logBase (2 :: Double) -- added :: to squish warning -- a heap with trees of rank 0, 1, 2, .. k contains exactly i=0..k, sum(2^r_i) nodes
314
prop_heap_max_trees :: BinHeap Int -> Bool prop_heap_max_trees ts = count <= limit where count = length ts limit = floor $ lg (fromIntegral $ size ts) + 1 lg = logBase (2 :: Double) -- added :: to squish warning -- a heap with trees of rank 0, 1, 2, .. k contains exactly i=0..k, sum(2^r_i) nodes
314
prop_heap_max_trees ts = count <= limit where count = length ts limit = floor $ lg (fromIntegral $ size ts) + 1 lg = logBase (2 :: Double) -- added :: to squish warning -- a heap with trees of rank 0, 1, 2, .. k contains exactly i=0..k, sum(2^r_i) nodes
271
false
true
0
10
74
78
40
38
null
null
Danten/lejf
src/Evaluate/Eval.hs
bsd-3-clause
unpackPush :: Arg -> Eval Val unpackPush (Push v) = pure v
58
unpackPush :: Arg -> Eval Val unpackPush (Push v) = pure v
58
unpackPush (Push v) = pure v
28
false
true
0
9
11
34
15
19
null
null
rjosephwright/awstemplate
src/Template.hs
mit
getNext :: AddrRange IPv4 -> Set (AddrRange IPv4) -> Int -> AddrRange IPv4 getNext cb ucb netmask = let diff = difference (fromList $ ranges cb netmask) ucb in elemAt 0 diff
177
getNext :: AddrRange IPv4 -> Set (AddrRange IPv4) -> Int -> AddrRange IPv4 getNext cb ucb netmask = let diff = difference (fromList $ ranges cb netmask) ucb in elemAt 0 diff
177
getNext cb ucb netmask = let diff = difference (fromList $ ranges cb netmask) ucb in elemAt 0 diff
102
false
true
0
12
35
84
37
47
null
null
JoshuaGross/haskell-learning-log
code/tpl-haskell/src/MakeClassyConstraints.hs
mit
makeClassyConstraintsForDec :: Dec -> [Name] -> DecsQ makeClassyConstraintsForDec d ns = do decs <- makeClassyForDec d return (makeClassyConstraints' ns decs)
162
makeClassyConstraintsForDec :: Dec -> [Name] -> DecsQ makeClassyConstraintsForDec d ns = do decs <- makeClassyForDec d return (makeClassyConstraints' ns decs)
162
makeClassyConstraintsForDec d ns = do decs <- makeClassyForDec d return (makeClassyConstraints' ns decs)
108
false
true
0
9
23
51
24
27
null
null
laszlopandy/elm-compiler
src/Reporting/Error/Type.hs
bsd-3-clause
doubleRigidError :: String doubleRigidError = "A type annotation is clashing with itself or with a sub-annotation.\ \ This can be particularly tricky, so read more about it. " ++ Help.hintLink "type-annotations"
217
doubleRigidError :: String doubleRigidError = "A type annotation is clashing with itself or with a sub-annotation.\ \ This can be particularly tricky, so read more about it. " ++ Help.hintLink "type-annotations"
217
doubleRigidError = "A type annotation is clashing with itself or with a sub-annotation.\ \ This can be particularly tricky, so read more about it. " ++ Help.hintLink "type-annotations"
190
false
true
2
6
36
28
11
17
null
null
fsharpcorner/99-Problems-in-Haskell
src/Lib.hs
bsd-3-clause
encode_modified l = reverse(encode_modifiedImpl (pack l))
57
encode_modified l = reverse(encode_modifiedImpl (pack l))
57
encode_modified l = reverse(encode_modifiedImpl (pack l))
57
false
false
0
9
5
24
11
13
null
null
bitemyapp/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
hvVncPasswordFile :: String hvVncPasswordFile = "vnc_password_file"
67
hvVncPasswordFile :: String hvVncPasswordFile = "vnc_password_file"
67
hvVncPasswordFile = "vnc_password_file"
39
false
true
0
6
5
18
7
11
null
null
philopon/apiary-benchmark
src/yesod.hs
mit
handleNum46R :: Handler TypedContent; handleNum46R = returnBS "deep"
68
handleNum46R :: Handler TypedContent handleNum46R = returnBS "deep"
67
handleNum46R = returnBS "deep"
30
false
true
1
5
7
21
9
12
null
null
michalkonecny/aern
aern-ivp/demos/simple-ode.hs
bsd-3-clause
runWithArgs :: [String] -> IO () runWithArgs [ivpName, tEndS, maybePlotDimensS, maybePDFfilenameS, wrapTypeS, maxDegS, maxSizeS, maxDepthS, minDepthS] = do _ <- solveVtPrintSteps wrapType maybePlotDimens maybePDFfilename ivpTEnd (maxDeg, maxSize, maxDepth, minDepth) return () where ivpTEnd = ivp { odeivp_tEnd = dblToReal sampleCf tEndD, odeivp_maybeExactValuesAtTEnd = Nothing } ivp = ivpByNameReportError ivpName sampleFn wrapType = read wrapTypeS :: WrapType maybePlotDimens = readIVPPlotArgs maybePlotDimensS :: Maybe IVPPlotArgs maybePDFfilename = readPDFfilename maybePDFfilenameS :: Maybe String maxDeg = read maxDegS :: Int maxSize = read maxSizeS :: Int maxDepth = read maxDepthS :: Int minDepth = read minDepthS :: Int tEndD = read tEndS :: Double readPDFfilename "GUI" = Nothing readPDFfilename pdfilename | ".pdf" `isSuffixOf` pdfilename = Just pdfilename readPDFfilename filename = error $ "Unsupported output file format: " ++ filename
1,100
runWithArgs :: [String] -> IO () runWithArgs [ivpName, tEndS, maybePlotDimensS, maybePDFfilenameS, wrapTypeS, maxDegS, maxSizeS, maxDepthS, minDepthS] = do _ <- solveVtPrintSteps wrapType maybePlotDimens maybePDFfilename ivpTEnd (maxDeg, maxSize, maxDepth, minDepth) return () where ivpTEnd = ivp { odeivp_tEnd = dblToReal sampleCf tEndD, odeivp_maybeExactValuesAtTEnd = Nothing } ivp = ivpByNameReportError ivpName sampleFn wrapType = read wrapTypeS :: WrapType maybePlotDimens = readIVPPlotArgs maybePlotDimensS :: Maybe IVPPlotArgs maybePDFfilename = readPDFfilename maybePDFfilenameS :: Maybe String maxDeg = read maxDegS :: Int maxSize = read maxSizeS :: Int maxDepth = read maxDepthS :: Int minDepth = read minDepthS :: Int tEndD = read tEndS :: Double readPDFfilename "GUI" = Nothing readPDFfilename pdfilename | ".pdf" `isSuffixOf` pdfilename = Just pdfilename readPDFfilename filename = error $ "Unsupported output file format: " ++ filename
1,100
runWithArgs [ivpName, tEndS, maybePlotDimensS, maybePDFfilenameS, wrapTypeS, maxDegS, maxSizeS, maxDepthS, minDepthS] = do _ <- solveVtPrintSteps wrapType maybePlotDimens maybePDFfilename ivpTEnd (maxDeg, maxSize, maxDepth, minDepth) return () where ivpTEnd = ivp { odeivp_tEnd = dblToReal sampleCf tEndD, odeivp_maybeExactValuesAtTEnd = Nothing } ivp = ivpByNameReportError ivpName sampleFn wrapType = read wrapTypeS :: WrapType maybePlotDimens = readIVPPlotArgs maybePlotDimensS :: Maybe IVPPlotArgs maybePDFfilename = readPDFfilename maybePDFfilenameS :: Maybe String maxDeg = read maxDegS :: Int maxSize = read maxSizeS :: Int maxDepth = read maxDepthS :: Int minDepth = read minDepthS :: Int tEndD = read tEndS :: Double readPDFfilename "GUI" = Nothing readPDFfilename pdfilename | ".pdf" `isSuffixOf` pdfilename = Just pdfilename readPDFfilename filename = error $ "Unsupported output file format: " ++ filename
1,067
false
true
0
9
274
269
143
126
null
null
ndmitchell/hlint
src/Hint/NewType.hs
bsd-3-clause
simpleCons _ = Nothing
22
simpleCons _ = Nothing
22
simpleCons _ = Nothing
22
false
false
0
5
3
9
4
5
null
null
AlexeyRaga/eta
compiler/ETA/DeSugar/DsForeign.hs
bsd-3-clause
resultWrapper :: ExtendsInfo -> Type -> DsM (Maybe Type, CoreExpr -> CoreExpr) resultWrapper extendsInfo resultType | isPrimitiveType resultType = return (Just resultType, id) | Just (tc, _) <- maybeTcApp, tc `hasKey` unitTyConKey = return (Nothing, \_ -> Var unitDataConId) | Just (tc, _) <- maybeTcApp, tc `hasKey` boolTyConKey = return ( Just jboolPrimTy , \e -> mkWildCase e jboolPrimTy boolTy [ (DEFAULT, [], Var trueDataConId) , (LitAlt (MachInt 0), [], Var falseDataConId) ] ) | Just (tc, [_]) <- maybeTcApp , tc `hasKey` listTyConKey = do (maybeType, wrapper) <- resultWrapper extendsInfo $ mkTyConApp jstringTyCon [] fromJStringId <- dsLookupGlobalId fromJStringName return (maybeType, \e -> mkCoreApp (Var fromJStringId) (wrapper e)) | Just (tc, [ty]) <- maybeTcApp , tc `hasKey` maybeTyConKey = do (maybeType, wrapper) <- resultWrapper extendsInfo ty let objType = head . snd . expectJust "resultWrapper: splitTyConApp" . splitTyConApp_maybe $ expectJust "resultWrapper: maybeType: Nothing" maybeType return (maybeType, \e -> mkWildCase (mkCoreApps (Var (primOpId IsNullObjectOp)) [Type objType, e]) intPrimTy resultType [ (DEFAULT, [], mkConApp justDataCon [ Type ty , wrapper e]) , (LitAlt (MachInt 1), [], mkConApp nothingDataCon [Type ty])]) | Just (co, repType) <- topNormaliseNewType_maybe resultType = do (maybeType, wrapper) <- resultWrapper extendsInfo repType return (maybeType, \e -> mkCast (wrapper e) (mkSymCo co)) | Just (tyVar, rest) <- splitForAllTy_maybe resultType = do (maybeType, wrapper) <- resultWrapper extendsInfo rest return (maybeType, Lam tyVar . wrapper) | Just (tyCon, tyConArgTys, dataCon, dataConArgTys) <- splitDataProductType_maybe resultType, dataConSourceArity dataCon == 1 = do let (unwrapperResType : _) = dataConArgTys narrowWrapper = maybeNarrow tyCon (maybeType, wrapper) <- resultWrapper extendsInfo unwrapperResType return ( maybeType , \e -> mkApps (Var (dataConWrapId dataCon)) (map Type tyConArgTys ++ [wrapper (narrowWrapper e)])) | Just var <- getTyVar_maybe resultType , Just (dictId, tagType, bound) <- lookupVarEnv extendsInfo var = do (objType, wrapper) <- resultWrapper extendsInfo tagType castId <- getClassCastId (invertBound bound) let typeArgs = map Type $ whenExtends bound [resultType, tagType] return ( objType , \e -> mkApps (Var castId) (typeArgs ++ [Var dictId, wrapper e])) | otherwise = pprPanic "resultWrapper" (ppr resultType) where maybeTcApp = splitTyConApp_maybe resultType
3,025
resultWrapper :: ExtendsInfo -> Type -> DsM (Maybe Type, CoreExpr -> CoreExpr) resultWrapper extendsInfo resultType | isPrimitiveType resultType = return (Just resultType, id) | Just (tc, _) <- maybeTcApp, tc `hasKey` unitTyConKey = return (Nothing, \_ -> Var unitDataConId) | Just (tc, _) <- maybeTcApp, tc `hasKey` boolTyConKey = return ( Just jboolPrimTy , \e -> mkWildCase e jboolPrimTy boolTy [ (DEFAULT, [], Var trueDataConId) , (LitAlt (MachInt 0), [], Var falseDataConId) ] ) | Just (tc, [_]) <- maybeTcApp , tc `hasKey` listTyConKey = do (maybeType, wrapper) <- resultWrapper extendsInfo $ mkTyConApp jstringTyCon [] fromJStringId <- dsLookupGlobalId fromJStringName return (maybeType, \e -> mkCoreApp (Var fromJStringId) (wrapper e)) | Just (tc, [ty]) <- maybeTcApp , tc `hasKey` maybeTyConKey = do (maybeType, wrapper) <- resultWrapper extendsInfo ty let objType = head . snd . expectJust "resultWrapper: splitTyConApp" . splitTyConApp_maybe $ expectJust "resultWrapper: maybeType: Nothing" maybeType return (maybeType, \e -> mkWildCase (mkCoreApps (Var (primOpId IsNullObjectOp)) [Type objType, e]) intPrimTy resultType [ (DEFAULT, [], mkConApp justDataCon [ Type ty , wrapper e]) , (LitAlt (MachInt 1), [], mkConApp nothingDataCon [Type ty])]) | Just (co, repType) <- topNormaliseNewType_maybe resultType = do (maybeType, wrapper) <- resultWrapper extendsInfo repType return (maybeType, \e -> mkCast (wrapper e) (mkSymCo co)) | Just (tyVar, rest) <- splitForAllTy_maybe resultType = do (maybeType, wrapper) <- resultWrapper extendsInfo rest return (maybeType, Lam tyVar . wrapper) | Just (tyCon, tyConArgTys, dataCon, dataConArgTys) <- splitDataProductType_maybe resultType, dataConSourceArity dataCon == 1 = do let (unwrapperResType : _) = dataConArgTys narrowWrapper = maybeNarrow tyCon (maybeType, wrapper) <- resultWrapper extendsInfo unwrapperResType return ( maybeType , \e -> mkApps (Var (dataConWrapId dataCon)) (map Type tyConArgTys ++ [wrapper (narrowWrapper e)])) | Just var <- getTyVar_maybe resultType , Just (dictId, tagType, bound) <- lookupVarEnv extendsInfo var = do (objType, wrapper) <- resultWrapper extendsInfo tagType castId <- getClassCastId (invertBound bound) let typeArgs = map Type $ whenExtends bound [resultType, tagType] return ( objType , \e -> mkApps (Var castId) (typeArgs ++ [Var dictId, wrapper e])) | otherwise = pprPanic "resultWrapper" (ppr resultType) where maybeTcApp = splitTyConApp_maybe resultType
3,025
resultWrapper extendsInfo resultType | isPrimitiveType resultType = return (Just resultType, id) | Just (tc, _) <- maybeTcApp, tc `hasKey` unitTyConKey = return (Nothing, \_ -> Var unitDataConId) | Just (tc, _) <- maybeTcApp, tc `hasKey` boolTyConKey = return ( Just jboolPrimTy , \e -> mkWildCase e jboolPrimTy boolTy [ (DEFAULT, [], Var trueDataConId) , (LitAlt (MachInt 0), [], Var falseDataConId) ] ) | Just (tc, [_]) <- maybeTcApp , tc `hasKey` listTyConKey = do (maybeType, wrapper) <- resultWrapper extendsInfo $ mkTyConApp jstringTyCon [] fromJStringId <- dsLookupGlobalId fromJStringName return (maybeType, \e -> mkCoreApp (Var fromJStringId) (wrapper e)) | Just (tc, [ty]) <- maybeTcApp , tc `hasKey` maybeTyConKey = do (maybeType, wrapper) <- resultWrapper extendsInfo ty let objType = head . snd . expectJust "resultWrapper: splitTyConApp" . splitTyConApp_maybe $ expectJust "resultWrapper: maybeType: Nothing" maybeType return (maybeType, \e -> mkWildCase (mkCoreApps (Var (primOpId IsNullObjectOp)) [Type objType, e]) intPrimTy resultType [ (DEFAULT, [], mkConApp justDataCon [ Type ty , wrapper e]) , (LitAlt (MachInt 1), [], mkConApp nothingDataCon [Type ty])]) | Just (co, repType) <- topNormaliseNewType_maybe resultType = do (maybeType, wrapper) <- resultWrapper extendsInfo repType return (maybeType, \e -> mkCast (wrapper e) (mkSymCo co)) | Just (tyVar, rest) <- splitForAllTy_maybe resultType = do (maybeType, wrapper) <- resultWrapper extendsInfo rest return (maybeType, Lam tyVar . wrapper) | Just (tyCon, tyConArgTys, dataCon, dataConArgTys) <- splitDataProductType_maybe resultType, dataConSourceArity dataCon == 1 = do let (unwrapperResType : _) = dataConArgTys narrowWrapper = maybeNarrow tyCon (maybeType, wrapper) <- resultWrapper extendsInfo unwrapperResType return ( maybeType , \e -> mkApps (Var (dataConWrapId dataCon)) (map Type tyConArgTys ++ [wrapper (narrowWrapper e)])) | Just var <- getTyVar_maybe resultType , Just (dictId, tagType, bound) <- lookupVarEnv extendsInfo var = do (objType, wrapper) <- resultWrapper extendsInfo tagType castId <- getClassCastId (invertBound bound) let typeArgs = map Type $ whenExtends bound [resultType, tagType] return ( objType , \e -> mkApps (Var castId) (typeArgs ++ [Var dictId, wrapper e])) | otherwise = pprPanic "resultWrapper" (ppr resultType) where maybeTcApp = splitTyConApp_maybe resultType
2,946
false
true
0
18
907
1,015
504
511
null
null
mdsteele/fallback
src/Fallback/State/Creature/Monsters.hs
gpl-3.0
getMonsterType TownChildBlue = townsperson { mtImageRow = 10 }
62
getMonsterType TownChildBlue = townsperson { mtImageRow = 10 }
62
getMonsterType TownChildBlue = townsperson { mtImageRow = 10 }
62
false
false
1
7
8
21
9
12
null
null
jwiegley/ghc-release
libraries/base/Control/Monad.hs
gpl-3.0
foldM f a (x:xs) = f a x >>= \fax -> foldM f fax xs
53
foldM f a (x:xs) = f a x >>= \fax -> foldM f fax xs
53
foldM f a (x:xs) = f a x >>= \fax -> foldM f fax xs
53
false
false
0
7
16
43
20
23
null
null
hpacheco/jasminv
src/Utils.hs
gpl-3.0
fconst :: Functor f => b -> f a -> f b fconst b = fmap (const b)
64
fconst :: Functor f => b -> f a -> f b fconst b = fmap (const b)
64
fconst b = fmap (const b)
25
false
true
0
9
17
49
21
28
null
null
yhoshino11/learning_haskell
ch3.hs
mit
badGreeting :: String badGreeting = "Who are you?"
50
badGreeting :: String badGreeting = "Who are you?"
50
badGreeting = "Who are you?"
28
false
true
0
4
7
11
6
5
null
null
bitemyapp/ghc
compiler/hsSyn/HsTypes.hs
bsd-3-clause
ppr_mono_ty _ (HsKindSig ty kind) = parens (ppr_mono_lty TopPrec ty <+> dcolon <+> ppr kind)
95
ppr_mono_ty _ (HsKindSig ty kind) = parens (ppr_mono_lty TopPrec ty <+> dcolon <+> ppr kind)
95
ppr_mono_ty _ (HsKindSig ty kind) = parens (ppr_mono_lty TopPrec ty <+> dcolon <+> ppr kind)
95
false
false
0
9
17
41
19
22
null
null
jaspervdj/patat
lib/Patat/Eval.hs
gpl-2.0
-------------------------------------------------------------------------------- evalCode :: EvalSettings -> T.Text -> IO EvalResult evalCode EvalSettings {..} input = do let proc = (Process.shell $ T.unpack evalCommand) { Process.std_in = Process.CreatePipe , Process.std_out = Process.CreatePipe , Process.std_err = Process.CreatePipe } (Just hIn, Just hOut, Just hErr, hProc) <- Process.createProcess proc Async.withAsync (T.hPutStr hIn input `finally` IO.hClose hIn) $ \_ -> Async.withAsync (T.hGetContents hOut) $ \outAsync -> Async.withAsync (T.hGetContents hErr) $ \errAsync -> Async.withAsync (Process.waitForProcess hProc) $ \exitCodeAsync -> do erExitCode <- Async.wait exitCodeAsync erStdout <- Async.wait outAsync erStderr <- Async.wait errAsync pure $ EvalResult {..}
900
evalCode :: EvalSettings -> T.Text -> IO EvalResult evalCode EvalSettings {..} input = do let proc = (Process.shell $ T.unpack evalCommand) { Process.std_in = Process.CreatePipe , Process.std_out = Process.CreatePipe , Process.std_err = Process.CreatePipe } (Just hIn, Just hOut, Just hErr, hProc) <- Process.createProcess proc Async.withAsync (T.hPutStr hIn input `finally` IO.hClose hIn) $ \_ -> Async.withAsync (T.hGetContents hOut) $ \outAsync -> Async.withAsync (T.hGetContents hErr) $ \errAsync -> Async.withAsync (Process.waitForProcess hProc) $ \exitCodeAsync -> do erExitCode <- Async.wait exitCodeAsync erStdout <- Async.wait outAsync erStderr <- Async.wait errAsync pure $ EvalResult {..}
819
evalCode EvalSettings {..} input = do let proc = (Process.shell $ T.unpack evalCommand) { Process.std_in = Process.CreatePipe , Process.std_out = Process.CreatePipe , Process.std_err = Process.CreatePipe } (Just hIn, Just hOut, Just hErr, hProc) <- Process.createProcess proc Async.withAsync (T.hPutStr hIn input `finally` IO.hClose hIn) $ \_ -> Async.withAsync (T.hGetContents hOut) $ \outAsync -> Async.withAsync (T.hGetContents hErr) $ \errAsync -> Async.withAsync (Process.waitForProcess hProc) $ \exitCodeAsync -> do erExitCode <- Async.wait exitCodeAsync erStdout <- Async.wait outAsync erStderr <- Async.wait errAsync pure $ EvalResult {..}
767
true
true
36
10
209
245
135
110
null
null
haskellGardener/transient
src/Transient/Base.hs
gpl-3.0
-- | run the closure (the 'x' in 'x >>= f') of the current bind operation. runClosure :: EventF -> StateIO (Maybe a) runClosure (EventF x _ _ _ _ _ _ _ _) = unsafeCoerce $ runTrans x
185
runClosure :: EventF -> StateIO (Maybe a) runClosure (EventF x _ _ _ _ _ _ _ _) = unsafeCoerce $ runTrans x
108
runClosure (EventF x _ _ _ _ _ _ _ _) = unsafeCoerce $ runTrans x
66
true
true
0
8
41
57
28
29
null
null
kawu/tagger
src/Text/Linc/Lexer.hs
bsd-3-clause
isQuoted (Quoted q) = Just q
28
isQuoted (Quoted q) = Just q
28
isQuoted (Quoted q) = Just q
28
false
false
0
7
5
18
8
10
null
null
YoshikuniJujo/papillon
test/templateHaskell/Reify.hs
bsd-3-clause
noOthers (VarP _) = return True
31
noOthers (VarP _) = return True
31
noOthers (VarP _) = return True
31
false
false
0
7
5
18
8
10
null
null
ezyang/ghc
compiler/basicTypes/VarEnv.hs
bsd-3-clause
plusDVarEnv_C :: (a -> a -> a) -> DVarEnv a -> DVarEnv a -> DVarEnv a plusDVarEnv_C = plusUDFM_C
96
plusDVarEnv_C :: (a -> a -> a) -> DVarEnv a -> DVarEnv a -> DVarEnv a plusDVarEnv_C = plusUDFM_C
96
plusDVarEnv_C = plusUDFM_C
26
false
true
0
8
18
43
21
22
null
null
wrengr/bytestring-trie
dev/Bench/Foldable.hs
bsd-3-clause
foldMap'_v027_bang f = go mempty where go !m Empty = m go m (Arc _ Nothing t) = go m t go m (Arc _ (Just v) t) = (go $! mappend m (f v)) t go m (Branch _ _ l r) = (go $! go m l) r -- | This really shouldn't matter, but given our experience with 'foldl'_v027_flop_bang'... -- And yet, is slightly better than 'foldMap'_v027_bang', slightly -- worse than 'foldMap'_v027'; identical allocation for all these -- variants. For larger tries, is slightly slower than 'foldMap'_v027_flop'.
522
foldMap'_v027_bang f = go mempty where go !m Empty = m go m (Arc _ Nothing t) = go m t go m (Arc _ (Just v) t) = (go $! mappend m (f v)) t go m (Branch _ _ l r) = (go $! go m l) r -- | This really shouldn't matter, but given our experience with 'foldl'_v027_flop_bang'... -- And yet, is slightly better than 'foldMap'_v027_bang', slightly -- worse than 'foldMap'_v027'; identical allocation for all these -- variants. For larger tries, is slightly slower than 'foldMap'_v027_flop'.
522
foldMap'_v027_bang f = go mempty where go !m Empty = m go m (Arc _ Nothing t) = go m t go m (Arc _ (Just v) t) = (go $! mappend m (f v)) t go m (Branch _ _ l r) = (go $! go m l) r -- | This really shouldn't matter, but given our experience with 'foldl'_v027_flop_bang'... -- And yet, is slightly better than 'foldMap'_v027_bang', slightly -- worse than 'foldMap'_v027'; identical allocation for all these -- variants. For larger tries, is slightly slower than 'foldMap'_v027_flop'.
522
false
false
0
12
130
138
68
70
null
null
foreverbell/project-euler-solutions
src/85.hs
bsd-3-clause
item = takeWhile (\(x,y) -> y < limit) [ (n, (1 + n) * n `div` 2) | n <- [1 .. ] ]
82
item = takeWhile (\(x,y) -> y < limit) [ (n, (1 + n) * n `div` 2) | n <- [1 .. ] ]
82
item = takeWhile (\(x,y) -> y < limit) [ (n, (1 + n) * n `div` 2) | n <- [1 .. ] ]
82
false
false
0
11
23
67
39
28
null
null
msullivan/advent-of-code
2017/A8a.hs
mit
ireadOut :: String -> [Int] ireadOut = readOut
46
ireadOut :: String -> [Int] ireadOut = readOut
46
ireadOut = readOut
18
false
true
0
6
7
18
10
8
null
null
urv/fixhs
src/Data/FIX/Spec/FIX43.hs
lgpl-2.1
tNoDlvyInst :: FIXTag tNoDlvyInst = FIXTag { tName = "NoDlvyInst" , tnum = 85 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
153
tNoDlvyInst :: FIXTag tNoDlvyInst = FIXTag { tName = "NoDlvyInst" , tnum = 85 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
153
tNoDlvyInst = FIXTag { tName = "NoDlvyInst" , tnum = 85 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
131
false
true
0
8
37
45
26
19
null
null
bgold-cosmos/Tidal
src/Sound/Tidal/Params.hs
gpl-3.0
enhancebus :: Pattern Int -> Pattern Double -> ControlPattern enhancebus busid pat = (pF "enhance" pat) # (pI "^enhance" busid)
127
enhancebus :: Pattern Int -> Pattern Double -> ControlPattern enhancebus busid pat = (pF "enhance" pat) # (pI "^enhance" busid)
127
enhancebus busid pat = (pF "enhance" pat) # (pI "^enhance" busid)
65
false
true
2
8
19
57
25
32
null
null