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
rahulmutt/ghcvm
compiler/Eta/TypeCheck/TcDefaults.hs
bsd-3-clause
tcDefaults decls@(L locn (DefaultDecl _) : _) = setSrcSpan locn $ failWithTc (dupDefaultDeclErr decls)
108
tcDefaults decls@(L locn (DefaultDecl _) : _) = setSrcSpan locn $ failWithTc (dupDefaultDeclErr decls)
108
tcDefaults decls@(L locn (DefaultDecl _) : _) = setSrcSpan locn $ failWithTc (dupDefaultDeclErr decls)
108
false
false
0
11
19
46
22
24
null
null
kenta2/retrograde
Chess.hs
agpl-3.0
pass_permitted :: Bool; pass_permitted = False
46
pass_permitted :: Bool pass_permitted = False
45
pass_permitted = False
22
false
true
2
5
5
19
7
12
null
null
CindyLinz/Haskell.js
trans/src/Desugar/List.hs
mit
deListAsst (EqualP l type1 type2) = EqualP (id l) (deListType type1) (deListType type2)
87
deListAsst (EqualP l type1 type2) = EqualP (id l) (deListType type1) (deListType type2)
87
deListAsst (EqualP l type1 type2) = EqualP (id l) (deListType type1) (deListType type2)
87
false
false
0
7
12
44
21
23
null
null
mbakke/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
htypeGroup :: String htypeGroup = "GROUP"
41
htypeGroup :: String htypeGroup = "GROUP"
41
htypeGroup = "GROUP"
20
false
true
0
4
5
11
6
5
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F13.hs
bsd-3-clause
ptr_glGetTexParameterPointervAPPLE :: FunPtr (GLenum -> GLenum -> Ptr (Ptr a) -> IO ()) ptr_glGetTexParameterPointervAPPLE = unsafePerformIO $ getCommand "glGetTexParameterPointervAPPLE"
186
ptr_glGetTexParameterPointervAPPLE :: FunPtr (GLenum -> GLenum -> Ptr (Ptr a) -> IO ()) ptr_glGetTexParameterPointervAPPLE = unsafePerformIO $ getCommand "glGetTexParameterPointervAPPLE"
186
ptr_glGetTexParameterPointervAPPLE = unsafePerformIO $ getCommand "glGetTexParameterPointervAPPLE"
98
false
true
0
12
18
50
24
26
null
null
kim/amazonka
amazonka-storagegateway/gen/Network/AWS/StorageGateway/Types.hs
mpl-2.0
-- | The port used to communicate with iSCSI VTL device targets. dscsiaNetworkInterfacePort :: Lens' DeviceiSCSIAttributes (Maybe Int) dscsiaNetworkInterfacePort = lens _dscsiaNetworkInterfacePort (\s a -> s { _dscsiaNetworkInterfacePort = a })
256
dscsiaNetworkInterfacePort :: Lens' DeviceiSCSIAttributes (Maybe Int) dscsiaNetworkInterfacePort = lens _dscsiaNetworkInterfacePort (\s a -> s { _dscsiaNetworkInterfacePort = a })
191
dscsiaNetworkInterfacePort = lens _dscsiaNetworkInterfacePort (\s a -> s { _dscsiaNetworkInterfacePort = a })
121
true
true
0
8
42
47
25
22
null
null
tel/saltine
tests/AEAD/ChaCha20Poly1305IETFProperties.hs
mit
-- | Ciphertext cannot be decrypted with a different key cannotDecryptKeyProp :: Key -> Key -> Nonce -> Message -> Message -> Property cannotDecryptKeyProp k1 k2 n (Message bs) (Message aad) = let ct = aead k1 n bs aad in k1 /= k2 ==> Nothing == aeadOpen k2 n ct aad
270
cannotDecryptKeyProp :: Key -> Key -> Nonce -> Message -> Message -> Property cannotDecryptKeyProp k1 k2 n (Message bs) (Message aad) = let ct = aead k1 n bs aad in k1 /= k2 ==> Nothing == aeadOpen k2 n ct aad
213
cannotDecryptKeyProp k1 k2 n (Message bs) (Message aad) = let ct = aead k1 n bs aad in k1 /= k2 ==> Nothing == aeadOpen k2 n ct aad
135
true
true
0
9
55
96
47
49
null
null
chrisdone/scrobble
src/Scrobble/Server.hs
bsd-3-clause
dispatch :: Handlers -> Handle -> MVar [Session] -> URL -> String -> IO () dispatch handlers h clients url body = case parsePost body of Nothing -> error "Unable to parse POST body." Just params -> withSession h clients params $ \sess -> case url_path url of "nowplaying" -> handleNow handlers h sess params "submit" -> handleSubmit handlers h sess params _ -> error $ "Unknown URL: " ++ url_path url -- | Look up the session and do something with it.
506
dispatch :: Handlers -> Handle -> MVar [Session] -> URL -> String -> IO () dispatch handlers h clients url body = case parsePost body of Nothing -> error "Unable to parse POST body." Just params -> withSession h clients params $ \sess -> case url_path url of "nowplaying" -> handleNow handlers h sess params "submit" -> handleSubmit handlers h sess params _ -> error $ "Unknown URL: " ++ url_path url -- | Look up the session and do something with it.
506
dispatch handlers h clients url body = case parsePost body of Nothing -> error "Unable to parse POST body." Just params -> withSession h clients params $ \sess -> case url_path url of "nowplaying" -> handleNow handlers h sess params "submit" -> handleSubmit handlers h sess params _ -> error $ "Unknown URL: " ++ url_path url -- | Look up the session and do something with it.
431
false
true
0
14
137
149
71
78
null
null
aBhallo/AoC2016
Day 1/day1part1.hs
mit
startCoord :: Coord startCoord = (0,0)
38
startCoord :: Coord startCoord = (0,0)
38
startCoord = (0,0)
18
false
true
0
5
5
17
10
7
null
null
bruno-cadorette/IFT630-TP3
ChessPiece.hs
mit
borderMin :: Int -> Int borderMin = max 0
41
borderMin :: Int -> Int borderMin = max 0
41
borderMin = max 0
17
false
true
0
5
8
18
9
9
null
null
duboisf/complementaires
src/Main.hs
gpl-3.0
targetNumberOf :: FullOperation -> Int targetNumberOf (FullOperation answer operation) = case oOperator operation of Plus -> answer Minus -> oLeftOperand operation
173
targetNumberOf :: FullOperation -> Int targetNumberOf (FullOperation answer operation) = case oOperator operation of Plus -> answer Minus -> oLeftOperand operation
173
targetNumberOf (FullOperation answer operation) = case oOperator operation of Plus -> answer Minus -> oLeftOperand operation
134
false
true
0
8
30
48
23
25
null
null
tmcdonell/hfx
src/haskell/Config.hs
bsd-3-clause
getDigestionRule 2 = ((`elem` "FWY") , " 2. Chymotrypsin 1 FWY P")
98
getDigestionRule 2 = ((`elem` "FWY") , " 2. Chymotrypsin 1 FWY P")
98
getDigestionRule 2 = ((`elem` "FWY") , " 2. Chymotrypsin 1 FWY P")
98
false
false
1
7
43
25
13
12
null
null
geekingfrog/advent-of-code
src/Y2018/Day07.hs
bsd-3-clause
parseData :: Parser [(Char, Char)] parseData = Utils.parseLines parseLine
73
parseData :: Parser [(Char, Char)] parseData = Utils.parseLines parseLine
73
parseData = Utils.parseLines parseLine
38
false
true
0
7
8
28
15
13
null
null
apyrgio/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
exportConfFile :: String exportConfFile = "config.ini"
54
exportConfFile :: String exportConfFile = "config.ini"
54
exportConfFile = "config.ini"
29
false
true
0
4
5
11
6
5
null
null
ezyang/ghc
testsuite/tests/warnings/should_compile/T10908.hs
bsd-3-clause
x :: Bool x = intercalate
25
x :: Bool x = intercalate
25
x = intercalate
15
false
true
0
6
5
18
7
11
null
null
wayofthepie/sip
src/Linux/Parser/Lsof.hs
mit
uid :: PIDInfo -> Int uid = _uid
32
uid :: PIDInfo -> Int uid = _uid
32
uid = _uid
10
false
true
0
7
7
22
9
13
null
null
khajavi/pandoc
src/Text/Pandoc/Readers/Markdown.hs
gpl-2.0
singleQuoteEnd :: GenParser Char st Char singleQuoteEnd = try $ do char '\8217' <|> char '\'' notFollowedBy alphaNum return '\''
134
singleQuoteEnd :: GenParser Char st Char singleQuoteEnd = try $ do char '\8217' <|> char '\'' notFollowedBy alphaNum return '\''
134
singleQuoteEnd = try $ do char '\8217' <|> char '\'' notFollowedBy alphaNum return '\''
93
false
true
0
9
25
47
20
27
null
null
bgold-cosmos/Tidal
src/Sound/Tidal/Params.hs
gpl-3.0
lfosyncTake :: String -> [Double] -> ControlPattern lfosyncTake name xs = pStateListF "lfosync" name xs
103
lfosyncTake :: String -> [Double] -> ControlPattern lfosyncTake name xs = pStateListF "lfosync" name xs
103
lfosyncTake name xs = pStateListF "lfosync" name xs
51
false
true
0
8
14
42
18
24
null
null
jacekszymanski/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/Image.hs
lgpl-2.1
-- | Get the size of an image imageGetSize :: Image a -> IO Size imageGetSize image = do h <- imageGetHeight image w <- imageGetWidth image return (Size w h)
175
imageGetSize :: Image a -> IO Size imageGetSize image = do h <- imageGetHeight image w <- imageGetWidth image return (Size w h)
145
imageGetSize image = do h <- imageGetHeight image w <- imageGetWidth image return (Size w h)
110
true
true
0
10
48
64
27
37
null
null
google/ghc-source-gen
src/GHC/SourceGen/Module.hs
bsd-3-clause
-- | Exports all methods and/or constructors. -- -- > A(..) -- > ===== -- > thingAll "A" thingAll :: RdrNameStr -> IE' thingAll = withEpAnnNotUsed IEThingAll . wrappedName
171
thingAll :: RdrNameStr -> IE' thingAll = withEpAnnNotUsed IEThingAll . wrappedName
82
thingAll = withEpAnnNotUsed IEThingAll . wrappedName
52
true
true
0
7
28
34
17
17
null
null
olsner/ghc
compiler/coreSyn/CoreSyn.hs
bsd-3-clause
isStableSource :: UnfoldingSource -> Bool -- Keep the unfolding template isStableSource InlineCompulsory = True
113
isStableSource :: UnfoldingSource -> Bool isStableSource InlineCompulsory = True
82
isStableSource InlineCompulsory = True
40
true
true
0
5
15
19
10
9
null
null
hiratara/hs-rtb-bidder
test/test-rtb-bidder.hs
bsd-3-clause
testOpenRTB24Expandable :: IO () testOpenRTB24Expandable = testOpenRTB' "test/asset/openrtb24-expandable.json"
110
testOpenRTB24Expandable :: IO () testOpenRTB24Expandable = testOpenRTB' "test/asset/openrtb24-expandable.json"
110
testOpenRTB24Expandable = testOpenRTB' "test/asset/openrtb24-expandable.json"
77
false
true
0
6
7
19
9
10
null
null
brendanhay/gogol
gogol-containerbuilder/gen/Network/Google/Resource/Cloudbuild/Projects/Locations/Triggers/Patch.hs
mpl-2.0
-- | Required. ID of the project that owns the trigger. pltpProjectId :: Lens' ProjectsLocationsTriggersPatch (Maybe Text) pltpProjectId = lens _pltpProjectId (\ s a -> s{_pltpProjectId = a})
199
pltpProjectId :: Lens' ProjectsLocationsTriggersPatch (Maybe Text) pltpProjectId = lens _pltpProjectId (\ s a -> s{_pltpProjectId = a})
143
pltpProjectId = lens _pltpProjectId (\ s a -> s{_pltpProjectId = a})
76
true
true
0
9
35
48
25
23
null
null
timjb/frecords
examples/dtypes-optparse-applicative/Main.hs
mit
sample :: OA.Parser Sample sample = fmap dosi $ dsequenceA' $ DSample { dquiet = OA.switch $ mconcat [ OA.long "quiet" , OA.help "Whether to be quiet" ] , dhello = OA.strOption $ mconcat [ OA.long "hello" , OA.metavar "TARGET" , OA.help "Target for the greeting" ] }
342
sample :: OA.Parser Sample sample = fmap dosi $ dsequenceA' $ DSample { dquiet = OA.switch $ mconcat [ OA.long "quiet" , OA.help "Whether to be quiet" ] , dhello = OA.strOption $ mconcat [ OA.long "hello" , OA.metavar "TARGET" , OA.help "Target for the greeting" ] }
342
sample = fmap dosi $ dsequenceA' $ DSample { dquiet = OA.switch $ mconcat [ OA.long "quiet" , OA.help "Whether to be quiet" ] , dhello = OA.strOption $ mconcat [ OA.long "hello" , OA.metavar "TARGET" , OA.help "Target for the greeting" ] }
315
false
true
1
12
123
106
51
55
null
null
tjakway/ghcjvm
compiler/typecheck/TcGenDeriv.hs
bsd-3-clause
bh_RDR = mkVarUnqual (fsLit "b#")
42
bh_RDR = mkVarUnqual (fsLit "b#")
42
bh_RDR = mkVarUnqual (fsLit "b#")
42
false
false
0
7
13
15
7
8
null
null
Fermat/higher-rank
test/MatchingSpec.hs
bsd-3-clause
exp20 = (App (Var "g" dummyPos) (Const "String" dummyPos))
58
exp20 = (App (Var "g" dummyPos) (Const "String" dummyPos))
58
exp20 = (App (Var "g" dummyPos) (Const "String" dummyPos))
58
false
false
0
8
8
30
15
15
null
null
lamdu/lamdu
test/Test/Lamdu/SugarStubs.hs
gpl-3.0
repl :: Annotated a # Sugar.Term v name i Unit -> Sugar.Repl v name i Unit a repl (Ann (Const pl) x) = Sugar.Repl { Sugar._replExpr = Ann (Const pl) (Sugar.Binder Unit (Sugar.BinderTerm x)) , Sugar._replVarInfo = Sugar.VarGeneric , Sugar._replResult = CurAndPrev Nothing Nothing }
308
repl :: Annotated a # Sugar.Term v name i Unit -> Sugar.Repl v name i Unit a repl (Ann (Const pl) x) = Sugar.Repl { Sugar._replExpr = Ann (Const pl) (Sugar.Binder Unit (Sugar.BinderTerm x)) , Sugar._replVarInfo = Sugar.VarGeneric , Sugar._replResult = CurAndPrev Nothing Nothing }
308
repl (Ann (Const pl) x) = Sugar.Repl { Sugar._replExpr = Ann (Const pl) (Sugar.Binder Unit (Sugar.BinderTerm x)) , Sugar._replVarInfo = Sugar.VarGeneric , Sugar._replResult = CurAndPrev Nothing Nothing }
223
false
true
0
13
72
135
66
69
null
null
shnarazk/ttsolver
Timetable/Rules.hs
gpl-3.0
cond10 ss = (-&&&-) [ (q -!- (q `on` sub')) -|- neg s -|- neg s' | sub <- filter atComputerRoom subs , sub' <- filter atComputerRoom subs , sub' /= sub , q <- quarterVars `over` sub , s <- slotVars `over` sub , s' <- slotVars `over` sub' , shareSlot (sub, (sub, s)) (sub', (sub', s')) ] -&- -- 固定科目で演習室を使う科目との整合性検査 (-&&&-) [ anotherQuarterBool sub sub' -|- neg s | sub <- filter atComputerRoom subs , sub' <- filter atComputerRoom fixed , let (Right (_, _', s')) = subjectNumber sub' , s <- slotVars `over` sub , shareSlot (sub, (sub, s)) (sub', s') ] where subs = filter (not . isFixed) ss fixed = filter isFixed ss -- | 第2学年は月火がだめ、第2Qがだめ
972
cond10 ss = (-&&&-) [ (q -!- (q `on` sub')) -|- neg s -|- neg s' | sub <- filter atComputerRoom subs , sub' <- filter atComputerRoom subs , sub' /= sub , q <- quarterVars `over` sub , s <- slotVars `over` sub , s' <- slotVars `over` sub' , shareSlot (sub, (sub, s)) (sub', (sub', s')) ] -&- -- 固定科目で演習室を使う科目との整合性検査 (-&&&-) [ anotherQuarterBool sub sub' -|- neg s | sub <- filter atComputerRoom subs , sub' <- filter atComputerRoom fixed , let (Right (_, _', s')) = subjectNumber sub' , s <- slotVars `over` sub , shareSlot (sub, (sub, s)) (sub', s') ] where subs = filter (not . isFixed) ss fixed = filter isFixed ss -- | 第2学年は月火がだめ、第2Qがだめ
972
cond10 ss = (-&&&-) [ (q -!- (q `on` sub')) -|- neg s -|- neg s' | sub <- filter atComputerRoom subs , sub' <- filter atComputerRoom subs , sub' /= sub , q <- quarterVars `over` sub , s <- slotVars `over` sub , s' <- slotVars `over` sub' , shareSlot (sub, (sub, s)) (sub', (sub', s')) ] -&- -- 固定科目で演習室を使う科目との整合性検査 (-&&&-) [ anotherQuarterBool sub sub' -|- neg s | sub <- filter atComputerRoom subs , sub' <- filter atComputerRoom fixed , let (Right (_, _', s')) = subjectNumber sub' , s <- slotVars `over` sub , shareSlot (sub, (sub, s)) (sub', s') ] where subs = filter (not . isFixed) ss fixed = filter isFixed ss -- | 第2学年は月火がだめ、第2Qがだめ
972
false
false
0
14
453
308
165
143
null
null
clample/lamdabtc
backend/src/BitcoinCore/BloomFilter.hs
bsd-3-clause
numberHashFunctions :: Int -> Int -> Int numberHashFunctions s nElements = min calculatedHashFunctions maxHashFuncs where calculatedHashFunctions = floor $ (fromIntegral s * 8 * (log 2 :: Double)) / fromIntegral nElements
223
numberHashFunctions :: Int -> Int -> Int numberHashFunctions s nElements = min calculatedHashFunctions maxHashFuncs where calculatedHashFunctions = floor $ (fromIntegral s * 8 * (log 2 :: Double)) / fromIntegral nElements
223
numberHashFunctions s nElements = min calculatedHashFunctions maxHashFuncs where calculatedHashFunctions = floor $ (fromIntegral s * 8 * (log 2 :: Double)) / fromIntegral nElements
182
false
true
0
10
32
71
35
36
null
null
geocurnoff/nikki
src/Base/Types.hs
lgpl-3.0
-- | returns, if Nikki is controlled currently isNikkiMode :: Mode -> Bool isNikkiMode NikkiMode{} = True
105
isNikkiMode :: Mode -> Bool isNikkiMode NikkiMode{} = True
58
isNikkiMode NikkiMode{} = True
30
true
true
2
4
16
23
13
10
null
null
MostAwesomeDude/gemstone
Gemstone/Amythest/Parser.hs
mit
idents :: TokenParsing m => IdentifierStyle m idents = emptyIdents & styleReserved .~ HS.fromList ["ani", "cancel", "ms", "s"]
126
idents :: TokenParsing m => IdentifierStyle m idents = emptyIdents & styleReserved .~ HS.fromList ["ani", "cancel", "ms", "s"]
126
idents = emptyIdents & styleReserved .~ HS.fromList ["ani", "cancel", "ms", "s"]
80
false
true
2
7
17
52
25
27
null
null
phipsgabler/mini-lambda
src/MiniLambda/Definitions.hs
unlicense
cons = lambda "x" <.> lambda "y" <.> lambda "f" <.> "f" @@ "x" @@ "y"
69
cons = lambda "x" <.> lambda "y" <.> lambda "f" <.> "f" @@ "x" @@ "y"
69
cons = lambda "x" <.> lambda "y" <.> lambda "f" <.> "f" @@ "x" @@ "y"
69
false
false
0
10
15
35
16
19
null
null
genos/online_problems
advent_of_code_2016/day9/src/Main.hs
mit
aXb :: Parser (Int, Int) aXb = parens $ do a <- natural _ <- char 'x' b <- natural return (fromIntegral a, fromIntegral b)
151
aXb :: Parser (Int, Int) aXb = parens $ do a <- natural _ <- char 'x' b <- natural return (fromIntegral a, fromIntegral b)
151
aXb = parens $ do a <- natural _ <- char 'x' b <- natural return (fromIntegral a, fromIntegral b)
126
false
true
2
10
53
73
32
41
null
null
rpeszek/GraphPlay
src/FreeDSL/BFS/Interpreter.hs
bsd-3-clause
traversalHelper :: forall a g v e t . (AdjacencyIndex g v e t, Hashable v, Eq v) => g -> BSFState v a -> (DSL.VObservation v, BSFState v a) -- v is marked visited when is processed all elements in the queue are visited traversalHelper g (_, Nothing, _, queue, visited, hm) = let (newV, newQ) = Q.dequeue queue neighborVs = HS.fromList . (neighborsOf g) notVisitedVs v0 = HS.toList $ HS.difference (neighborVs v0) visited in case newV of Nothing -> (DSL.NoMore, (DSL.NoMore, Nothing, [], newQ, visited, hm)) Just v0 -> traversalHelper g (DSL.NoMore, newV, notVisitedVs v0, newQ, visited, hm)
659
traversalHelper :: forall a g v e t . (AdjacencyIndex g v e t, Hashable v, Eq v) => g -> BSFState v a -> (DSL.VObservation v, BSFState v a) traversalHelper g (_, Nothing, _, queue, visited, hm) = let (newV, newQ) = Q.dequeue queue neighborVs = HS.fromList . (neighborsOf g) notVisitedVs v0 = HS.toList $ HS.difference (neighborVs v0) visited in case newV of Nothing -> (DSL.NoMore, (DSL.NoMore, Nothing, [], newQ, visited, hm)) Just v0 -> traversalHelper g (DSL.NoMore, newV, notVisitedVs v0, newQ, visited, hm)
580
traversalHelper g (_, Nothing, _, queue, visited, hm) = let (newV, newQ) = Q.dequeue queue neighborVs = HS.fromList . (neighborsOf g) notVisitedVs v0 = HS.toList $ HS.difference (neighborVs v0) visited in case newV of Nothing -> (DSL.NoMore, (DSL.NoMore, Nothing, [], newQ, visited, hm)) Just v0 -> traversalHelper g (DSL.NoMore, newV, notVisitedVs v0, newQ, visited, hm)
423
true
true
0
12
168
244
133
111
null
null
tomahawkins/smt-lib
attic/AutoAST.hs
bsd-3-clause
left :: Expr left = Token "LeftParan" "("
41
left :: Expr left = Token "LeftParan" "("
41
left = Token "LeftParan" "("
28
false
true
0
5
7
16
8
8
null
null
dmw/ApacheLogRev
src/Data/LogRev/Parser.hs
bsd-3-clause
rbrack = satisfy (== ']')
25
rbrack = satisfy (== ']')
25
rbrack = satisfy (== ']')
25
false
false
1
6
4
16
7
9
null
null
capital-match/hdo
src/Network/DO/IP/Commands.hs
mit
createFloatingIP :: FloatingIPTarget -> IPCommands (Result FloatingIP) createFloatingIP target = CreateIP target P.id
117
createFloatingIP :: FloatingIPTarget -> IPCommands (Result FloatingIP) createFloatingIP target = CreateIP target P.id
117
createFloatingIP target = CreateIP target P.id
46
false
true
0
8
12
34
16
18
null
null
bitemyapp/ghc
compiler/deSugar/Coverage.hs
bsd-3-clause
addTickHsExpr (HsSCC nm e) = liftM2 HsSCC (return nm) (addTickLHsExpr e)
112
addTickHsExpr (HsSCC nm e) = liftM2 HsSCC (return nm) (addTickLHsExpr e)
112
addTickHsExpr (HsSCC nm e) = liftM2 HsSCC (return nm) (addTickLHsExpr e)
112
false
false
0
7
50
36
17
19
null
null
bixuanzju/fcore
lib/Mini.hs
bsd-2-clause
join (Forall f) = Forall (\a -> join (f (TVar a)))
51
join (Forall f) = Forall (\a -> join (f (TVar a)))
51
join (Forall f) = Forall (\a -> join (f (TVar a)))
51
false
false
0
12
11
41
20
21
null
null
emwap/feldspar-language
src/Feldspar/Stream.hs
bsd-3-clause
movingAvg :: (Fraction a, RealFloat a) => Data WordN -> Stream (Data a) -> Stream (Data a) movingAvg n str = recurrenceI (replicate1 n 0) str (\input -> (fromZero $ sum input) / i2f n)
214
movingAvg :: (Fraction a, RealFloat a) => Data WordN -> Stream (Data a) -> Stream (Data a) movingAvg n str = recurrenceI (replicate1 n 0) str (\input -> (fromZero $ sum input) / i2f n)
214
movingAvg n str = recurrenceI (replicate1 n 0) str (\input -> (fromZero $ sum input) / i2f n)
113
false
true
0
11
64
100
49
51
null
null
mgsloan/quasi-extras
src/Language/Quasi/Internal/Conversion.hs
bsd-3-clause
patToExp (VarP n) = VarE n
26
patToExp (VarP n) = VarE n
26
patToExp (VarP n) = VarE n
26
false
false
0
7
5
18
8
10
null
null
mbg/monadic-state-hierarchies
examples/Stack.hs
mit
isEmptyStack (Stack _) = False
31
isEmptyStack (Stack _) = False
31
isEmptyStack (Stack _) = False
31
false
false
0
6
5
16
7
9
null
null
spechub/Hets
Comorphisms/test/showKP.hs
gpl-2.0
main :: IO () main = showAllKnownProvers
40
main :: IO () main = showAllKnownProvers
40
main = showAllKnownProvers
26
false
true
0
6
6
16
8
8
null
null
ksaveljev/hake-2
src/Game/GameFunc.hs
bsd-3-clause
stateUp :: Int stateUp = 2
26
stateUp :: Int stateUp = 2
26
stateUp = 2
11
false
true
0
4
5
11
6
5
null
null
romanb/amazonka
amazonka-storagegateway/gen/Network/AWS/StorageGateway/DescribeVTLDevices.hs
mpl-2.0
-- | 'DescribeVTLDevices' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'dvtldGatewayARN' @::@ 'Text' -- -- * 'dvtldLimit' @::@ 'Maybe' 'Natural' -- -- * 'dvtldMarker' @::@ 'Maybe' 'Text' -- -- * 'dvtldVTLDeviceARNs' @::@ ['Text'] -- describeVTLDevices :: Text -- ^ 'dvtldGatewayARN' -> DescribeVTLDevices describeVTLDevices p1 = DescribeVTLDevices { _dvtldGatewayARN = p1 , _dvtldVTLDeviceARNs = mempty , _dvtldMarker = Nothing , _dvtldLimit = Nothing }
548
describeVTLDevices :: Text -- ^ 'dvtldGatewayARN' -> DescribeVTLDevices describeVTLDevices p1 = DescribeVTLDevices { _dvtldGatewayARN = p1 , _dvtldVTLDeviceARNs = mempty , _dvtldMarker = Nothing , _dvtldLimit = Nothing }
277
describeVTLDevices p1 = DescribeVTLDevices { _dvtldGatewayARN = p1 , _dvtldVTLDeviceARNs = mempty , _dvtldMarker = Nothing , _dvtldLimit = Nothing }
186
true
true
0
7
125
66
41
25
null
null
gcampax/ghc
compiler/utils/Outputable.hs
bsd-3-clause
colDataCon :: PprColour colDataCon = PprColour "\27[31m"
56
colDataCon :: PprColour colDataCon = PprColour "\27[31m"
56
colDataCon = PprColour "\27[31m"
32
false
true
0
6
6
20
8
12
null
null
tomjaguarpaw/postgresql-simple
src/Database/PostgreSQL/Simple/Time/Implementation.hs
bsd-3-clause
getTimeOfDay :: A.Parser TimeOfDay getTimeOfDay = TP.timeOfDay
62
getTimeOfDay :: A.Parser TimeOfDay getTimeOfDay = TP.timeOfDay
62
getTimeOfDay = TP.timeOfDay
27
false
true
0
6
6
18
9
9
null
null
michaelgwelch/bacnet
src/BACnet/Tag/Core.hs
mit
tagLength (CharacterStringAP len) = len
39
tagLength (CharacterStringAP len) = len
39
tagLength (CharacterStringAP len) = len
39
false
false
0
7
4
15
7
8
null
null
freizl/hoauth2
hoauth2/src/Network/OAuth/OAuth2/TokenRequest.hs
bsd-3-clause
refreshAccessToken :: -- | HTTP connection manager. Manager -> -- | OAuth context OAuth2 -> -- | refresh token gained after authorization RefreshToken -> ExceptT (OAuth2Error Errors) IO OAuth2Token refreshAccessToken = refreshAccessTokenInternal ClientSecretBasic
277
refreshAccessToken :: -- | HTTP connection manager. Manager -> -- | OAuth context OAuth2 -> -- | refresh token gained after authorization RefreshToken -> ExceptT (OAuth2Error Errors) IO OAuth2Token refreshAccessToken = refreshAccessTokenInternal ClientSecretBasic
277
refreshAccessToken = refreshAccessTokenInternal ClientSecretBasic
65
false
true
0
11
46
47
23
24
null
null
wangbj/haskell
dignum.hs
bsd-2-clause
decode = flip lookup rdict where rdict = zip [105979,87511,104185,104155,89815,106075,106107,103895,106235,106199] [0..9] :: [(Int, Int)] -- zipWith3 da l1 l2 l3
171
decode = flip lookup rdict where rdict = zip [105979,87511,104185,104155,89815,106075,106107,103895,106235,106199] [0..9] :: [(Int, Int)] -- zipWith3 da l1 l2 l3
171
decode = flip lookup rdict where rdict = zip [105979,87511,104185,104155,89815,106075,106107,103895,106235,106199] [0..9] :: [(Int, Int)] -- zipWith3 da l1 l2 l3
171
false
false
0
6
29
72
43
29
null
null
frontrowed/stratosphere
library-gen/Stratosphere/ResourceProperties/CognitoIdentityPoolCognitoIdentityProvider.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypool-cognitoidentityprovider.html#cfn-cognito-identitypool-cognitoidentityprovider-serversidetokencheck cipcipServerSideTokenCheck :: Lens' CognitoIdentityPoolCognitoIdentityProvider (Maybe (Val Bool)) cipcipServerSideTokenCheck = lens _cognitoIdentityPoolCognitoIdentityProviderServerSideTokenCheck (\s a -> s { _cognitoIdentityPoolCognitoIdentityProviderServerSideTokenCheck = a })
481
cipcipServerSideTokenCheck :: Lens' CognitoIdentityPoolCognitoIdentityProvider (Maybe (Val Bool)) cipcipServerSideTokenCheck = lens _cognitoIdentityPoolCognitoIdentityProviderServerSideTokenCheck (\s a -> s { _cognitoIdentityPoolCognitoIdentityProviderServerSideTokenCheck = a })
279
cipcipServerSideTokenCheck = lens _cognitoIdentityPoolCognitoIdentityProviderServerSideTokenCheck (\s a -> s { _cognitoIdentityPoolCognitoIdentityProviderServerSideTokenCheck = a })
181
true
true
1
9
22
55
28
27
null
null
geophf/1HaskellADay
exercises/HAD/Y2017/M11/D10/Solution.hs
mit
{-- >>> connectInfo ConnectInfo {connectHost = "...",...} >>> conn <- connect it >>> kind <- keyphraseKind conn "refinedEr_kw set" >>> kind [Idx 1] --} -- So, we have the keyphrases, their strengths, and an index for kind, let's -- put these together and insert each keyphrase into the keyphrase database, -- linking the keyphrase to the article_id ... which, of course, is linked via -- article_analysis -- so we do need to know what articles are analyzed already, and which articles -- are not ... enter the memoizing table -- first, load article_analysis into the memoizing table by getting its values articlesStmt :: Query articlesStmt = [sql|SELECT id,article_id FROM article_analysis|]
699
articlesStmt :: Query articlesStmt = [sql|SELECT id,article_id FROM article_analysis|]
86
articlesStmt = [sql|SELECT id,article_id FROM article_analysis|]
64
true
true
0
4
117
23
18
5
null
null
aniketd/learn.haskell
RWH/5_json_library/PrettyJSON.hs
unlicense
oneChar :: Char -> Doc oneChar c = case lookup c simpleEscapes of Just r -> text r Nothing | mustEscape c -> hexEscape c | otherwise -> char c where mustEscape c = c < ' ' || c == '\x7f' || c > '\xff'
271
oneChar :: Char -> Doc oneChar c = case lookup c simpleEscapes of Just r -> text r Nothing | mustEscape c -> hexEscape c | otherwise -> char c where mustEscape c = c < ' ' || c == '\x7f' || c > '\xff'
271
oneChar c = case lookup c simpleEscapes of Just r -> text r Nothing | mustEscape c -> hexEscape c | otherwise -> char c where mustEscape c = c < ' ' || c == '\x7f' || c > '\xff'
248
false
true
0
11
116
99
45
54
null
null
gcampax/ghc
compiler/simplCore/SetLevels.hs
bsd-3-clause
isFunction :: CoreExprWithFVs -> Bool -- The idea here is that we want to float *functions* to -- the top level. This saves no work, but -- (a) it can make the host function body a lot smaller, -- and hence inlinable. -- (b) it can also save allocation when the function is recursive: -- h = \x -> letrec f = \y -> ...f...y...x... -- in f x -- becomes -- f = \x y -> ...(f x)...y...x... -- h = \x -> f x x -- No allocation for f now. -- We may only want to do this if there are sufficiently few free -- variables. We certainly only want to do it for values, and not for -- constructors. So the simple thing is just to look for lambdas isFunction (_, AnnLam b e) | isId b = True | otherwise = isFunction e
814
isFunction :: CoreExprWithFVs -> Bool isFunction (_, AnnLam b e) | isId b = True | otherwise = isFunction e
137
isFunction (_, AnnLam b e) | isId b = True | otherwise = isFunction e
99
true
true
0
8
257
64
37
27
null
null
gafiatulin/codewars
src/6 kyu/HSW.hs
mit
high s = maximumBy (comparing (sum . map ((+ (negate . pred . ord $ 'a')) . ord . toLower))) . words $ s
104
high s = maximumBy (comparing (sum . map ((+ (negate . pred . ord $ 'a')) . ord . toLower))) . words $ s
104
high s = maximumBy (comparing (sum . map ((+ (negate . pred . ord $ 'a')) . ord . toLower))) . words $ s
104
false
false
0
20
23
66
34
32
null
null
kadircet/CENG
242/HW2.hs
gpl-3.0
getpath (FS ((a,b):xs)) p@(y:[]) | a==y = Just b | a>y = Nothing | otherwise = getpath (FS xs) p
99
getpath (FS ((a,b):xs)) p@(y:[]) | a==y = Just b | a>y = Nothing | otherwise = getpath (FS xs) p
99
getpath (FS ((a,b):xs)) p@(y:[]) | a==y = Just b | a>y = Nothing | otherwise = getpath (FS xs) p
99
false
false
1
10
22
88
44
44
null
null
aparent/qacg
src/QACG/CircLib.hs
bsd-3-clause
main = do args <- getArgs case getOpt RequireOrder options args of (flags, [], []) -> print flags (_, nonOpts, []) -> error $ "unrecognized arguments: " ++ unwords nonOpts (_, _, msgs) -> error $ concat msgs ++ usageInfo header options
282
main = do args <- getArgs case getOpt RequireOrder options args of (flags, [], []) -> print flags (_, nonOpts, []) -> error $ "unrecognized arguments: " ++ unwords nonOpts (_, _, msgs) -> error $ concat msgs ++ usageInfo header options
282
main = do args <- getArgs case getOpt RequireOrder options args of (flags, [], []) -> print flags (_, nonOpts, []) -> error $ "unrecognized arguments: " ++ unwords nonOpts (_, _, msgs) -> error $ concat msgs ++ usageInfo header options
282
false
false
0
12
88
108
55
53
null
null
guoguo12/haskell-ptable
ptable.hs
apache-2.0
pnum "Os" = 6
13
pnum "Os" = 6
13
pnum "Os" = 6
13
false
false
0
4
3
10
4
6
null
null
dummer/ConnectFour.hs
src/Main.hs
mit
step :: Maybe Int -> State -> State step Nothing state = unblockState state
75
step :: Maybe Int -> State -> State step Nothing state = unblockState state
75
step Nothing state = unblockState state
39
false
true
0
6
13
30
14
16
null
null
bhamrick/RouteNeo
Pokemon/Party.hs
bsd-3-clause
defeatPokemon' :: Species -> Integer -> Bool -> Integer -> PartyPokemon -> PartyPokemon defeatPokemon' enemySpecies enemyLevel isTrainer participants poke = let expGain = ((enemySpecies^.killExp `div` participants) * enemyLevel `div` 7) * 3 `div` (if isTrainer then 2 else 3) in poke & pExperience +~ expGain & pStatExp.hpStatExp +~ enemySpecies^.baseHP & pStatExp.atkStatExp +~ enemySpecies^.baseAtk & pStatExp.defStatExp +~ enemySpecies^.baseDef & pStatExp.spdStatExp +~ enemySpecies^.baseSpd & pStatExp.spcStatExp +~ enemySpecies^.baseSpc & checkLevelUp
628
defeatPokemon' :: Species -> Integer -> Bool -> Integer -> PartyPokemon -> PartyPokemon defeatPokemon' enemySpecies enemyLevel isTrainer participants poke = let expGain = ((enemySpecies^.killExp `div` participants) * enemyLevel `div` 7) * 3 `div` (if isTrainer then 2 else 3) in poke & pExperience +~ expGain & pStatExp.hpStatExp +~ enemySpecies^.baseHP & pStatExp.atkStatExp +~ enemySpecies^.baseAtk & pStatExp.defStatExp +~ enemySpecies^.baseDef & pStatExp.spdStatExp +~ enemySpecies^.baseSpd & pStatExp.spcStatExp +~ enemySpecies^.baseSpc & checkLevelUp
628
defeatPokemon' enemySpecies enemyLevel isTrainer participants poke = let expGain = ((enemySpecies^.killExp `div` participants) * enemyLevel `div` 7) * 3 `div` (if isTrainer then 2 else 3) in poke & pExperience +~ expGain & pStatExp.hpStatExp +~ enemySpecies^.baseHP & pStatExp.atkStatExp +~ enemySpecies^.baseAtk & pStatExp.defStatExp +~ enemySpecies^.baseDef & pStatExp.spdStatExp +~ enemySpecies^.baseSpd & pStatExp.spcStatExp +~ enemySpecies^.baseSpc & checkLevelUp
540
false
true
0
24
138
182
96
86
null
null
seereason/wl-pprint-text
Text/PrettyPrint/Leijen/Text/Monadic.hs
bsd-3-clause
-- | The document @(x \<\/\> y)@ concatenates document @x@ and @y@ -- with a 'softline' in between. This effectively puts @x@ and @y@ -- either next to each other (with a @space@ in between) or -- underneath each other. (infixr 5) (</>) :: (Monad m) => m Doc -> m Doc -> m Doc (</>) = liftM2 (PP.</>)
306
(</>) :: (Monad m) => m Doc -> m Doc -> m Doc (</>) = liftM2 (PP.</>)
69
(</>) = liftM2 (PP.</>)
23
true
true
0
9
64
58
31
27
null
null
smaccm/capDL-tool
CapDL/STCC.hs
bsd-2-clause
leakMatrix :: Model Word -> IO (String, String, Model Word) leakMatrix model@(Model arch objects _ cdt _) = do authMatrix <- newEmptyMatrix $ mSize leaksTos authMatrix objDict tcbDirectCaps warshall authMatrix newcspaces <- saturateCSpaces authMatrix objDict cspaces let cspaceUpdates = zipWith f newcspaces cspaces newModel = updateModel model cspaceUpdates infoMatrix <- newEmptyMatrix $ mSize authSharingFlows authMatrix infoMatrix flowsTos infoMatrix objDict tcbDirectFlows warshall infoMatrix removeReflexive infoMatrix leakDot <- showDotMatrix authMatrix objDict' flowDot <- showDotMatrix infoMatrix objDict' return (leakDot, flowDot, newModel) where f (objID, cspace) (objID', cspace') = (objID, cspace' `Set.difference` cspace) sndUnion (tcbID, set) (tcbID', set') = (tcbID, Set.union set set') tcbIDs = [objID | (objID, (TCB {})) <- Map.toList objects] mSize = length tcbIDs cspaces = [(tcbID, Set.fromList $ getCaps objects tcbID) | tcbID <- tcbIDs] vspaces = [(tcbID, Set.fromList $ getFrames objects tcbID) | tcbID <- tcbIDs] tcbDirectCaps = directTCBConnections cspaces tcbDirectFlows = directTCBFlows (zipWith sndUnion vspaces cspaces) objDict = Map.fromList (zip tcbIDs [0..]) objDict' = Map.fromList (zip [0..] tcbIDs)
1,350
leakMatrix :: Model Word -> IO (String, String, Model Word) leakMatrix model@(Model arch objects _ cdt _) = do authMatrix <- newEmptyMatrix $ mSize leaksTos authMatrix objDict tcbDirectCaps warshall authMatrix newcspaces <- saturateCSpaces authMatrix objDict cspaces let cspaceUpdates = zipWith f newcspaces cspaces newModel = updateModel model cspaceUpdates infoMatrix <- newEmptyMatrix $ mSize authSharingFlows authMatrix infoMatrix flowsTos infoMatrix objDict tcbDirectFlows warshall infoMatrix removeReflexive infoMatrix leakDot <- showDotMatrix authMatrix objDict' flowDot <- showDotMatrix infoMatrix objDict' return (leakDot, flowDot, newModel) where f (objID, cspace) (objID', cspace') = (objID, cspace' `Set.difference` cspace) sndUnion (tcbID, set) (tcbID', set') = (tcbID, Set.union set set') tcbIDs = [objID | (objID, (TCB {})) <- Map.toList objects] mSize = length tcbIDs cspaces = [(tcbID, Set.fromList $ getCaps objects tcbID) | tcbID <- tcbIDs] vspaces = [(tcbID, Set.fromList $ getFrames objects tcbID) | tcbID <- tcbIDs] tcbDirectCaps = directTCBConnections cspaces tcbDirectFlows = directTCBFlows (zipWith sndUnion vspaces cspaces) objDict = Map.fromList (zip tcbIDs [0..]) objDict' = Map.fromList (zip [0..] tcbIDs)
1,350
leakMatrix model@(Model arch objects _ cdt _) = do authMatrix <- newEmptyMatrix $ mSize leaksTos authMatrix objDict tcbDirectCaps warshall authMatrix newcspaces <- saturateCSpaces authMatrix objDict cspaces let cspaceUpdates = zipWith f newcspaces cspaces newModel = updateModel model cspaceUpdates infoMatrix <- newEmptyMatrix $ mSize authSharingFlows authMatrix infoMatrix flowsTos infoMatrix objDict tcbDirectFlows warshall infoMatrix removeReflexive infoMatrix leakDot <- showDotMatrix authMatrix objDict' flowDot <- showDotMatrix infoMatrix objDict' return (leakDot, flowDot, newModel) where f (objID, cspace) (objID', cspace') = (objID, cspace' `Set.difference` cspace) sndUnion (tcbID, set) (tcbID', set') = (tcbID, Set.union set set') tcbIDs = [objID | (objID, (TCB {})) <- Map.toList objects] mSize = length tcbIDs cspaces = [(tcbID, Set.fromList $ getCaps objects tcbID) | tcbID <- tcbIDs] vspaces = [(tcbID, Set.fromList $ getFrames objects tcbID) | tcbID <- tcbIDs] tcbDirectCaps = directTCBConnections cspaces tcbDirectFlows = directTCBFlows (zipWith sndUnion vspaces cspaces) objDict = Map.fromList (zip tcbIDs [0..]) objDict' = Map.fromList (zip [0..] tcbIDs)
1,290
false
true
9
11
275
453
227
226
null
null
vincenthz/hs-foundation
scripts/caseMapping/CaseFolding.hs
bsd-3-clause
parseCF :: FilePath -> IO (Either (P.ParseError String) CaseFolding) parseCF name = P.parseOnly entries . S.fromBytesUnsafe <$> readFile name
141
parseCF :: FilePath -> IO (Either (P.ParseError String) CaseFolding) parseCF name = P.parseOnly entries . S.fromBytesUnsafe <$> readFile name
141
parseCF name = P.parseOnly entries . S.fromBytesUnsafe <$> readFile name
72
false
true
0
12
18
59
27
32
null
null
ejconlon/notate
src/Notate/Real.hs
bsd-3-clause
makeKernel :: NotateM Kernel makeKernel = do kernelSpec <- makeKernelSpec return KernelConfig { kernelLanguageInfo = languageConfig , writeKernelspec = const (return kernelSpec) , displayOutput = displayString , displayResult = displayString , completion = languageCompletion , inspectInfo = languageInspect , run = languageRun , debug = False , kernelBanner = "Notate Haskell Kernel" , kernelProtocolVersion = "5.0" , kernelImplName = "notate" , kernelImplVersion = "0.0" }
530
makeKernel :: NotateM Kernel makeKernel = do kernelSpec <- makeKernelSpec return KernelConfig { kernelLanguageInfo = languageConfig , writeKernelspec = const (return kernelSpec) , displayOutput = displayString , displayResult = displayString , completion = languageCompletion , inspectInfo = languageInspect , run = languageRun , debug = False , kernelBanner = "Notate Haskell Kernel" , kernelProtocolVersion = "5.0" , kernelImplName = "notate" , kernelImplVersion = "0.0" }
530
makeKernel = do kernelSpec <- makeKernelSpec return KernelConfig { kernelLanguageInfo = languageConfig , writeKernelspec = const (return kernelSpec) , displayOutput = displayString , displayResult = displayString , completion = languageCompletion , inspectInfo = languageInspect , run = languageRun , debug = False , kernelBanner = "Notate Haskell Kernel" , kernelProtocolVersion = "5.0" , kernelImplName = "notate" , kernelImplVersion = "0.0" }
501
false
true
0
12
120
110
65
45
null
null
divipp/ActiveHs
QuickCheck.hs
bsd-3-clause
allRight :: [Either a b] -> Either a [b] allRight x = case [s | Left s<-x] of (y:_) -> Left y [] -> Right [s | Right s<-x]
133
allRight :: [Either a b] -> Either a [b] allRight x = case [s | Left s<-x] of (y:_) -> Left y [] -> Right [s | Right s<-x]
133
allRight x = case [s | Left s<-x] of (y:_) -> Left y [] -> Right [s | Right s<-x]
92
false
true
0
12
39
93
46
47
null
null
pascal-knodel/haskell-craft
_/links/E'8''6.hs
mit
reactPattern :: Strategy reactPattern [] = Rock
47
reactPattern :: Strategy reactPattern [] = Rock
47
reactPattern [] = Rock
22
false
true
0
7
6
22
9
13
null
null
orion-42/my-lisp
LispData.hs
mit
formatLispVal (Symbol name) = name
34
formatLispVal (Symbol name) = name
34
formatLispVal (Symbol name) = name
34
false
false
0
6
4
16
7
9
null
null
cheme/nanomsg-hs
test/C.hs
mit
getEr (Left a) = showEr a >> return undefined
45
getEr (Left a) = showEr a >> return undefined
45
getEr (Left a) = showEr a >> return undefined
45
false
false
0
7
8
25
11
14
null
null
twittner/redis-io
src/Database/Redis/IO/Timeouts.hs
mpl-2.0
cancel :: Action -> IO () cancel a = atomically $ writeTVar (state a) Canceled
78
cancel :: Action -> IO () cancel a = atomically $ writeTVar (state a) Canceled
78
cancel a = atomically $ writeTVar (state a) Canceled
52
false
true
0
8
14
42
19
23
null
null
brendanhay/gogol
gogol-containeranalysis/gen/Network/Google/ContainerAnalysis/Types/Product.hs
mpl-2.0
-- | Required. Immutable. The resource for which the occurrence applies. oResource :: Lens' Occurrence (Maybe Resource) oResource = lens _oResource (\ s a -> s{_oResource = a})
178
oResource :: Lens' Occurrence (Maybe Resource) oResource = lens _oResource (\ s a -> s{_oResource = a})
105
oResource = lens _oResource (\ s a -> s{_oResource = a})
58
true
true
0
9
29
48
25
23
null
null
kini/ghc-server
src/Server/Client.hs
bsd-3-clause
handleRequest :: Handle -> Integer -> Cmd -> Server -> ((String -> Log) -> [Char] -> IO a) -> IO () handleRequest handle id cmd Server{..} hostLogger = do hostLogger Debug (show id ++ " -> " ++ show cmd) out <- newChan writeChan serverIn (cmd,out) fix (\loop -> do response <- readChan out case response of Result r -> do reply False response loop EndResult r -> reply True response ErrorResult e -> reply True response) where reply done x = do let direction = if done then " <- " else " .. " hostLogger Debug (show id ++ direction ++ show x) hPutLn handle (L.encode (Response id x)) -- | A way to put a line, for some reason this doesn't exist in the library.
851
handleRequest :: Handle -> Integer -> Cmd -> Server -> ((String -> Log) -> [Char] -> IO a) -> IO () handleRequest handle id cmd Server{..} hostLogger = do hostLogger Debug (show id ++ " -> " ++ show cmd) out <- newChan writeChan serverIn (cmd,out) fix (\loop -> do response <- readChan out case response of Result r -> do reply False response loop EndResult r -> reply True response ErrorResult e -> reply True response) where reply done x = do let direction = if done then " <- " else " .. " hostLogger Debug (show id ++ direction ++ show x) hPutLn handle (L.encode (Response id x)) -- | A way to put a line, for some reason this doesn't exist in the library.
851
handleRequest handle id cmd Server{..} hostLogger = do hostLogger Debug (show id ++ " -> " ++ show cmd) out <- newChan writeChan serverIn (cmd,out) fix (\loop -> do response <- readChan out case response of Result r -> do reply False response loop EndResult r -> reply True response ErrorResult e -> reply True response) where reply done x = do let direction = if done then " <- " else " .. " hostLogger Debug (show id ++ direction ++ show x) hPutLn handle (L.encode (Response id x)) -- | A way to put a line, for some reason this doesn't exist in the library.
737
false
true
0
17
318
281
132
149
null
null
kim/amazonka
amazonka-emr/gen/Network/AWS/EMR/Types.hs
mpl-2.0
-- | A list of additional Amazon EC2 security group IDs for the master node. jficAdditionalMasterSecurityGroups :: Lens' JobFlowInstancesConfig [Text] jficAdditionalMasterSecurityGroups = lens _jficAdditionalMasterSecurityGroups (\s a -> s { _jficAdditionalMasterSecurityGroups = a }) . _List
316
jficAdditionalMasterSecurityGroups :: Lens' JobFlowInstancesConfig [Text] jficAdditionalMasterSecurityGroups = lens _jficAdditionalMasterSecurityGroups (\s a -> s { _jficAdditionalMasterSecurityGroups = a }) . _List
239
jficAdditionalMasterSecurityGroups = lens _jficAdditionalMasterSecurityGroups (\s a -> s { _jficAdditionalMasterSecurityGroups = a }) . _List
165
true
true
0
9
58
48
26
22
null
null
anfelor/EasyMacros
src/Language/Haskell/TH/StandardMacros.hs
bsd-3-clause
split :: Eq a => [a] -> [a] -> [[a]] split sym xs = let strs = map (drop (length sym)) $ filter (isPrefixOf sym) (tails xs) strl = length xs : map length strs ++ [0] in zipWith take (zipWith (-) strl (drop 1 strl)) (xs:strs)
258
split :: Eq a => [a] -> [a] -> [[a]] split sym xs = let strs = map (drop (length sym)) $ filter (isPrefixOf sym) (tails xs) strl = length xs : map length strs ++ [0] in zipWith take (zipWith (-) strl (drop 1 strl)) (xs:strs)
258
split sym xs = let strs = map (drop (length sym)) $ filter (isPrefixOf sym) (tails xs) strl = length xs : map length strs ++ [0] in zipWith take (zipWith (-) strl (drop 1 strl)) (xs:strs)
221
false
true
0
14
80
148
75
73
null
null
limaner2002/EPC-tools
scheduler-ui/src/Scheduler.hs
bsd-3-clause
schedule :: MonadBase IO m => TVar (JobQueue a) -> m () -> m () schedule tScheduledTime action = loop where loop = do mScheduledTime <- liftBase $ atomically $ readTVar tScheduledTime case mScheduledTime ^. qStartTime of Nothing -> do liftBase $ putStrLn "The job has been cancelled." return () Just scheduledTime -> do ct <- liftBase getCurrentTime case ct >= scheduledTime of True -> do liftBase $ putStrLn "Running job now" action liftBase $ atomically $ modifyTVar tScheduledTime (qStartTime .~ Nothing) False -> do liftBase $ threadDelay 1000000 loop -- Utility Functions
749
schedule :: MonadBase IO m => TVar (JobQueue a) -> m () -> m () schedule tScheduledTime action = loop where loop = do mScheduledTime <- liftBase $ atomically $ readTVar tScheduledTime case mScheduledTime ^. qStartTime of Nothing -> do liftBase $ putStrLn "The job has been cancelled." return () Just scheduledTime -> do ct <- liftBase getCurrentTime case ct >= scheduledTime of True -> do liftBase $ putStrLn "Running job now" action liftBase $ atomically $ modifyTVar tScheduledTime (qStartTime .~ Nothing) False -> do liftBase $ threadDelay 1000000 loop -- Utility Functions
749
schedule tScheduledTime action = loop where loop = do mScheduledTime <- liftBase $ atomically $ readTVar tScheduledTime case mScheduledTime ^. qStartTime of Nothing -> do liftBase $ putStrLn "The job has been cancelled." return () Just scheduledTime -> do ct <- liftBase getCurrentTime case ct >= scheduledTime of True -> do liftBase $ putStrLn "Running job now" action liftBase $ atomically $ modifyTVar tScheduledTime (qStartTime .~ Nothing) False -> do liftBase $ threadDelay 1000000 loop -- Utility Functions
685
false
true
0
20
265
205
92
113
null
null
thielema/wxhaskell
wxdirect/src/Types.hs
lgpl-2.1
{----------------------------------------------------------------------------------------- Tracing -----------------------------------------------------------------------------------------} trace s x = seq (unsafePerformIO (putStrLn s)) x
242
trace s x = seq (unsafePerformIO (putStrLn s)) x
50
trace s x = seq (unsafePerformIO (putStrLn s)) x
50
true
false
0
9
15
29
14
15
null
null
eeue56/generic-remote
webserver.hs
bsd-3-clause
getRequest :: [String] -> Request getRequest xs = case head xs of "DELETE" -> Delete "GET" -> Get "HEAD" -> Head "POST" -> Post "PUT" -> Put "OPTIONS" -> Options _ -> Invalid -- returns get arguments from the url as tuples of length 2 -- where !! 0 == key, !! 1 == value -- TODO: refactor
317
getRequest :: [String] -> Request getRequest xs = case head xs of "DELETE" -> Delete "GET" -> Get "HEAD" -> Head "POST" -> Post "PUT" -> Put "OPTIONS" -> Options _ -> Invalid -- returns get arguments from the url as tuples of length 2 -- where !! 0 == key, !! 1 == value -- TODO: refactor
317
getRequest xs = case head xs of "DELETE" -> Delete "GET" -> Get "HEAD" -> Head "POST" -> Post "PUT" -> Put "OPTIONS" -> Options _ -> Invalid -- returns get arguments from the url as tuples of length 2 -- where !! 0 == key, !! 1 == value -- TODO: refactor
283
false
true
2
6
86
54
38
16
null
null
AccelerateHS/accelerate-cuda
Data/Array/Accelerate/CUDA/CodeGen/Base.hs
bsd-3-clause
csize ss = foldr1 (\a b -> [cexp| $exp:a * $exp:b |]) (map rvalue ss)
69
csize ss = foldr1 (\a b -> [cexp| $exp:a * $exp:b |]) (map rvalue ss)
69
csize ss = foldr1 (\a b -> [cexp| $exp:a * $exp:b |]) (map rvalue ss)
69
false
false
0
7
14
36
20
16
null
null
Kinokkory/thorn
Data/Thorn/Internal.hs
bsd-3-clause
applySpecial n tx@(TupleTx _) = return (n,tx)
45
applySpecial n tx@(TupleTx _) = return (n,tx)
45
applySpecial n tx@(TupleTx _) = return (n,tx)
45
false
false
1
8
6
34
15
19
null
null
nushio3/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
pprTcTyVarDetails (SkolemTv False) = text "sk"
46
pprTcTyVarDetails (SkolemTv False) = text "sk"
46
pprTcTyVarDetails (SkolemTv False) = text "sk"
46
false
false
0
7
5
18
8
10
null
null
rueshyna/gogol
gogol-games/gen/Network/Google/Games/Types/Product.hs
mpl-2.0
-- | The amount of time in milliseconds it took for the client to establish a -- connection with the XMPP server. ndRegistrationLatencyMillis :: Lens' NetworkDiagnostics (Maybe Int32) ndRegistrationLatencyMillis = lens _ndRegistrationLatencyMillis (\ s a -> s{_ndRegistrationLatencyMillis = a}) . mapping _Coerce
326
ndRegistrationLatencyMillis :: Lens' NetworkDiagnostics (Maybe Int32) ndRegistrationLatencyMillis = lens _ndRegistrationLatencyMillis (\ s a -> s{_ndRegistrationLatencyMillis = a}) . mapping _Coerce
212
ndRegistrationLatencyMillis = lens _ndRegistrationLatencyMillis (\ s a -> s{_ndRegistrationLatencyMillis = a}) . mapping _Coerce
142
true
true
0
10
55
56
29
27
null
null
nevrenato/Hets_Fork
Common/Doc.hs
gpl-2.0
symbolToLatex :: String -> Pretty.Doc symbolToLatex s = Map.findWithDefault (hc_sty_axiom $ escapeSpecial s) s latexSymbols
127
symbolToLatex :: String -> Pretty.Doc symbolToLatex s = Map.findWithDefault (hc_sty_axiom $ escapeSpecial s) s latexSymbols
127
symbolToLatex s = Map.findWithDefault (hc_sty_axiom $ escapeSpecial s) s latexSymbols
89
false
true
0
8
18
45
20
25
null
null
dylanmc/cryptol
src/Cryptol/Symbolic.hs
bsd-3-clause
parseValues (t : ts) cws = (v : vs, cws'') where (v, cws') = parseValue t cws (vs, cws'') = parseValues ts cws'
121
parseValues (t : ts) cws = (v : vs, cws'') where (v, cws') = parseValue t cws (vs, cws'') = parseValues ts cws'
121
parseValues (t : ts) cws = (v : vs, cws'') where (v, cws') = parseValue t cws (vs, cws'') = parseValues ts cws'
121
false
false
0
6
32
66
34
32
null
null
markus1189/formatting
src/Formatting/ShortFormatters.hs
bsd-3-clause
-- | Pad the left hand side of a string until it reaches @k@ characters -- wide, if necessary filling with character @ch@. l :: Buildable a => Int -> Char -> Format r (a -> r) l i ch = later (T.left i ch)
204
l :: Buildable a => Int -> Char -> Format r (a -> r) l i ch = later (T.left i ch)
81
l i ch = later (T.left i ch)
28
true
true
0
10
44
62
30
32
null
null
denibertovic/haskell
kubernetes/lib/Kubernetes/OpenAPI/ModelLens.hs
bsd-3-clause
-- | 'v1ContainerStateWaitingReason' Lens v1ContainerStateWaitingReasonL :: Lens_' V1ContainerStateWaiting (Maybe Text) v1ContainerStateWaitingReasonL f V1ContainerStateWaiting{..} = (\v1ContainerStateWaitingReason -> V1ContainerStateWaiting { v1ContainerStateWaitingReason, ..} ) <$> f v1ContainerStateWaitingReason
316
v1ContainerStateWaitingReasonL :: Lens_' V1ContainerStateWaiting (Maybe Text) v1ContainerStateWaitingReasonL f V1ContainerStateWaiting{..} = (\v1ContainerStateWaitingReason -> V1ContainerStateWaiting { v1ContainerStateWaitingReason, ..} ) <$> f v1ContainerStateWaitingReason
274
v1ContainerStateWaitingReasonL f V1ContainerStateWaiting{..} = (\v1ContainerStateWaitingReason -> V1ContainerStateWaiting { v1ContainerStateWaitingReason, ..} ) <$> f v1ContainerStateWaitingReason
196
true
true
0
8
23
57
30
27
null
null
hjwylde/werewolf
app/Game/Werewolf/Variant/NoRoleKnowledgeOrReveal/Engine.hs
bsd-3-clause
playerTurnedToStoneText :: Player -> Text playerTurnedToStoneText player = [iFile|variant/no-role-knowledge-or-reveal/engine/sunrise/player-turned-to-stone.txt|]
161
playerTurnedToStoneText :: Player -> Text playerTurnedToStoneText player = [iFile|variant/no-role-knowledge-or-reveal/engine/sunrise/player-turned-to-stone.txt|]
161
playerTurnedToStoneText player = [iFile|variant/no-role-knowledge-or-reveal/engine/sunrise/player-turned-to-stone.txt|]
119
false
true
0
5
8
22
13
9
null
null
izgzhen/hadrian
src/Rules/Libffi.hs
mit
-- | Libffi is considered a Stage1 package. This determines its build directory. libffiContext :: Context libffiContext = vanillaContext Stage1 libffi
150
libffiContext :: Context libffiContext = vanillaContext Stage1 libffi
69
libffiContext = vanillaContext Stage1 libffi
44
true
true
0
5
20
17
9
8
null
null
anton-dessiatov/stack
src/Stack/Constants.hs
bsd-3-clause
-- | Extensions for anything that can be a Haskell module. haskellModuleExts :: [Text] haskellModuleExts = haskellFileExts ++ haskellPreprocessorExts
149
haskellModuleExts :: [Text] haskellModuleExts = haskellFileExts ++ haskellPreprocessorExts
90
haskellModuleExts = haskellFileExts ++ haskellPreprocessorExts
62
true
true
0
7
18
26
12
14
null
null
brendanhay/gogol
gogol-books/gen/Network/Google/Books/Types/Product.hs
mpl-2.0
oiiiiCoverURL :: Lens' OffersItemsItemItemsItem (Maybe Text) oiiiiCoverURL = lens _oiiiiCoverURL (\ s a -> s{_oiiiiCoverURL = a})
137
oiiiiCoverURL :: Lens' OffersItemsItemItemsItem (Maybe Text) oiiiiCoverURL = lens _oiiiiCoverURL (\ s a -> s{_oiiiiCoverURL = a})
137
oiiiiCoverURL = lens _oiiiiCoverURL (\ s a -> s{_oiiiiCoverURL = a})
76
false
true
0
8
24
48
24
24
null
null
tolysz/prepare-ghcjs
spec-lts8/base/Control/Concurrent/Chan.hs
bsd-3-clause
unGetChan :: Chan a -> a -> IO () unGetChan (Chan readVar _) val = do new_read_end <- newEmptyMVar modifyMVar_ readVar $ \read_end -> do putMVar new_read_end (ChItem val read_end) return new_read_end
216
unGetChan :: Chan a -> a -> IO () unGetChan (Chan readVar _) val = do new_read_end <- newEmptyMVar modifyMVar_ readVar $ \read_end -> do putMVar new_read_end (ChItem val read_end) return new_read_end
216
unGetChan (Chan readVar _) val = do new_read_end <- newEmptyMVar modifyMVar_ readVar $ \read_end -> do putMVar new_read_end (ChItem val read_end) return new_read_end
182
false
true
0
13
48
84
38
46
null
null
nkaretnikov/ghc
compiler/utils/Outputable.hs
bsd-3-clause
(<+>) d1 d2 = SDoc $ \sty -> (Pretty.<+>) (runSDoc d1 sty) (runSDoc d2 sty)
75
(<+>) d1 d2 = SDoc $ \sty -> (Pretty.<+>) (runSDoc d1 sty) (runSDoc d2 sty)
75
(<+>) d1 d2 = SDoc $ \sty -> (Pretty.<+>) (runSDoc d1 sty) (runSDoc d2 sty)
75
false
false
0
9
14
47
25
22
null
null
ulricha/dsh
src/Database/DSH/Tests/CombinatorTests.hs
bsd-3-clause
prop_nub_length :: (BackendVector b, VectorLang v) => [Integer] -> DSHProperty (v TExpr TExpr) b prop_nub_length = makePropEq (Q.length . Q.nub) (fromIntegral . length . nub)
174
prop_nub_length :: (BackendVector b, VectorLang v) => [Integer] -> DSHProperty (v TExpr TExpr) b prop_nub_length = makePropEq (Q.length . Q.nub) (fromIntegral . length . nub)
174
prop_nub_length = makePropEq (Q.length . Q.nub) (fromIntegral . length . nub)
77
false
true
0
10
24
78
39
39
null
null
yuvallanger/threepenny-gui
src/Graphics/UI/Threepenny/Attributes.hs
bsd-3-clause
{----------------------------------------------------------------------------- Attributes ------------------------------------------------------------------------------} -- | The @checked@ status of an input element of type checkbox. checked :: Attr Element Bool checked = fromProp "checked" (== JSON.Bool True) JSON.Bool
325
checked :: Attr Element Bool checked = fromProp "checked" (== JSON.Bool True) JSON.Bool
87
checked = fromProp "checked" (== JSON.Bool True) JSON.Bool
58
true
true
1
8
31
41
19
22
null
null
redneb/hxt-css
Text/XML/HXT/CSS/Parser.hs
bsd-3-clause
{-escape :: Parser Char-} {-escape = mzero -- not supported by any major browser-} {-unicode :: Parser Char-} {-unicode = mzero -- not supported by any major browser-} nl :: Parser Char nl = choice [ void $ char '\n' , void $ char '\r' >> optionMaybe (char '\n') , void $ char '\f' ] >> return '\n'
316
nl :: Parser Char nl = choice [ void $ char '\n' , void $ char '\r' >> optionMaybe (char '\n') , void $ char '\f' ] >> return '\n'
146
nl = choice [ void $ char '\n' , void $ char '\r' >> optionMaybe (char '\n') , void $ char '\f' ] >> return '\n'
128
true
true
2
9
75
78
37
41
null
null
FranklinChen/music-score
sketch/old/update/update5.hs
bsd-3-clause
down :: (HasPitch' a, AffineSpace (Pitch a)) => Interval a -> a -> a down a = pitch %~ (.-^ a)
94
down :: (HasPitch' a, AffineSpace (Pitch a)) => Interval a -> a -> a down a = pitch %~ (.-^ a)
94
down a = pitch %~ (.-^ a)
25
false
true
0
8
20
54
28
26
null
null
bobgru/conifer
src/Conifer.hs
bsd-3-clause
projectXZ :: Tree3 -> Tree2 projectXZ = fmap infoXZ
51
projectXZ :: Tree3 -> Tree2 projectXZ = fmap infoXZ
51
projectXZ = fmap infoXZ
23
false
true
0
7
8
25
10
15
null
null
juodaspaulius/clafer
src/Language/Clafer/Intermediate/TypeSystem.hs
mit
getTMaps uidIClaferMap' (TUnion un') = concatMap (getTMaps uidIClaferMap') un'
84
getTMaps uidIClaferMap' (TUnion un') = concatMap (getTMaps uidIClaferMap') un'
84
getTMaps uidIClaferMap' (TUnion un') = concatMap (getTMaps uidIClaferMap') un'
84
false
false
0
7
14
31
13
18
null
null
afcowie/pipes-http
tests/BaselinePoint.hs
bsd-3-clause
series :: ByteString -> IO () series x' = do replicateM_ 1000 (actual x')
77
series :: ByteString -> IO () series x' = do replicateM_ 1000 (actual x')
77
series x' = do replicateM_ 1000 (actual x')
47
false
true
0
10
17
42
18
24
null
null
Acidburn0zzz/haddock
haddock-api/src/Haddock.hs
bsd-2-clause
render :: DynFlags -> [Flag] -> QualOption -> [Interface] -> [InstalledInterface] -> Map Module FilePath -> IO () render dflags flags qual ifaces installedIfaces extSrcMap = do let title = fromMaybe "" (optTitle flags) unicode = Flag_UseUnicode `elem` flags pretty = Flag_PrettyHtml `elem` flags opt_wiki_urls = wikiUrls flags opt_contents_url = optContentsUrl flags opt_index_url = optIndexUrl flags odir = outputDir flags opt_latex_style = optLaTeXStyle flags opt_source_css = optSourceCssFile flags visibleIfaces = [ i | i <- ifaces, OptHide `notElem` ifaceOptions i ] -- /All/ visible interfaces including external package modules. allIfaces = map toInstalledIface ifaces ++ installedIfaces allVisibleIfaces = [ i | i <- allIfaces, OptHide `notElem` instOptions i ] pkgMod = ifaceMod (head ifaces) pkgKey = modulePackageKey pkgMod pkgStr = Just (packageKeyString pkgKey) pkgNameVer = modulePackageInfo dflags flags pkgMod (srcBase, srcModule, srcEntity, srcLEntity) = sourceUrls flags srcModule' | Flag_HyperlinkedSource `elem` flags = Just hypSrcModuleUrlFormat | otherwise = srcModule srcMap = mkSrcMap $ Map.union (Map.map SrcExternal extSrcMap) (Map.fromList [ (ifaceMod iface, SrcLocal) | iface <- ifaces ]) pkgSrcMap = Map.mapKeys modulePackageKey extSrcMap pkgSrcMap' | Flag_HyperlinkedSource `elem` flags = Map.insert pkgKey hypSrcModuleNameUrlFormat pkgSrcMap | Just srcNameUrl <- srcEntity = Map.insert pkgKey srcNameUrl pkgSrcMap | otherwise = pkgSrcMap -- TODO: Get these from the interface files as with srcMap srcLMap' = maybe Map.empty (\path -> Map.singleton pkgKey path) srcLEntity sourceUrls' = (srcBase, srcModule', pkgSrcMap', srcLMap') libDir <- getHaddockLibDir flags prologue <- getPrologue dflags flags themes <- getThemes libDir flags >>= either bye return when (Flag_GenIndex `elem` flags) $ do ppHtmlIndex odir title pkgStr themes opt_contents_url sourceUrls' opt_wiki_urls allVisibleIfaces pretty copyHtmlBits odir libDir themes when (Flag_GenContents `elem` flags) $ do ppHtmlContents dflags odir title pkgStr themes opt_index_url sourceUrls' opt_wiki_urls allVisibleIfaces True prologue pretty (makeContentsQual qual) copyHtmlBits odir libDir themes when (Flag_Html `elem` flags) $ do ppHtml dflags title pkgStr visibleIfaces odir prologue themes sourceUrls' opt_wiki_urls opt_contents_url opt_index_url unicode qual pretty copyHtmlBits odir libDir themes -- TODO: we throw away Meta for both Hoogle and LaTeX right now, -- might want to fix that if/when these two get some work on them when (Flag_Hoogle `elem` flags) $ do case pkgNameVer of Nothing -> putStrLn . unlines $ [ "haddock: Unable to find a package providing module " ++ moduleNameString (moduleName pkgMod) ++ ", skipping Hoogle." , "" , " Perhaps try specifying the desired package explicitly" ++ " using the --package-name" , " and --package-version arguments." ] Just (PackageName pkgNameFS, pkgVer) -> let pkgNameStr | unpackFS pkgNameFS == "main" && title /= [] = title | otherwise = unpackFS pkgNameFS in ppHoogle dflags pkgNameStr pkgVer title (fmap _doc prologue) visibleIfaces odir when (Flag_LaTeX `elem` flags) $ do ppLaTeX title pkgStr visibleIfaces odir (fmap _doc prologue) opt_latex_style libDir when (Flag_HyperlinkedSource `elem` flags) $ do ppHyperlinkedSource odir libDir opt_source_css pretty srcMap ifaces -- | From GHC 7.10, this function has a potential to crash with a -- nasty message such as @expectJust getPackageDetails@ because -- package name and versions can no longer reliably be extracted in -- all cases: if the package is not installed yet then this info is no -- longer available. The @--package-name@ and @--package-version@ -- Haddock flags allow the user to specify this information and it is -- returned here if present: if it is not present, the error will -- occur. Nasty but that's how it is for now. Potential TODO.
4,587
render :: DynFlags -> [Flag] -> QualOption -> [Interface] -> [InstalledInterface] -> Map Module FilePath -> IO () render dflags flags qual ifaces installedIfaces extSrcMap = do let title = fromMaybe "" (optTitle flags) unicode = Flag_UseUnicode `elem` flags pretty = Flag_PrettyHtml `elem` flags opt_wiki_urls = wikiUrls flags opt_contents_url = optContentsUrl flags opt_index_url = optIndexUrl flags odir = outputDir flags opt_latex_style = optLaTeXStyle flags opt_source_css = optSourceCssFile flags visibleIfaces = [ i | i <- ifaces, OptHide `notElem` ifaceOptions i ] -- /All/ visible interfaces including external package modules. allIfaces = map toInstalledIface ifaces ++ installedIfaces allVisibleIfaces = [ i | i <- allIfaces, OptHide `notElem` instOptions i ] pkgMod = ifaceMod (head ifaces) pkgKey = modulePackageKey pkgMod pkgStr = Just (packageKeyString pkgKey) pkgNameVer = modulePackageInfo dflags flags pkgMod (srcBase, srcModule, srcEntity, srcLEntity) = sourceUrls flags srcModule' | Flag_HyperlinkedSource `elem` flags = Just hypSrcModuleUrlFormat | otherwise = srcModule srcMap = mkSrcMap $ Map.union (Map.map SrcExternal extSrcMap) (Map.fromList [ (ifaceMod iface, SrcLocal) | iface <- ifaces ]) pkgSrcMap = Map.mapKeys modulePackageKey extSrcMap pkgSrcMap' | Flag_HyperlinkedSource `elem` flags = Map.insert pkgKey hypSrcModuleNameUrlFormat pkgSrcMap | Just srcNameUrl <- srcEntity = Map.insert pkgKey srcNameUrl pkgSrcMap | otherwise = pkgSrcMap -- TODO: Get these from the interface files as with srcMap srcLMap' = maybe Map.empty (\path -> Map.singleton pkgKey path) srcLEntity sourceUrls' = (srcBase, srcModule', pkgSrcMap', srcLMap') libDir <- getHaddockLibDir flags prologue <- getPrologue dflags flags themes <- getThemes libDir flags >>= either bye return when (Flag_GenIndex `elem` flags) $ do ppHtmlIndex odir title pkgStr themes opt_contents_url sourceUrls' opt_wiki_urls allVisibleIfaces pretty copyHtmlBits odir libDir themes when (Flag_GenContents `elem` flags) $ do ppHtmlContents dflags odir title pkgStr themes opt_index_url sourceUrls' opt_wiki_urls allVisibleIfaces True prologue pretty (makeContentsQual qual) copyHtmlBits odir libDir themes when (Flag_Html `elem` flags) $ do ppHtml dflags title pkgStr visibleIfaces odir prologue themes sourceUrls' opt_wiki_urls opt_contents_url opt_index_url unicode qual pretty copyHtmlBits odir libDir themes -- TODO: we throw away Meta for both Hoogle and LaTeX right now, -- might want to fix that if/when these two get some work on them when (Flag_Hoogle `elem` flags) $ do case pkgNameVer of Nothing -> putStrLn . unlines $ [ "haddock: Unable to find a package providing module " ++ moduleNameString (moduleName pkgMod) ++ ", skipping Hoogle." , "" , " Perhaps try specifying the desired package explicitly" ++ " using the --package-name" , " and --package-version arguments." ] Just (PackageName pkgNameFS, pkgVer) -> let pkgNameStr | unpackFS pkgNameFS == "main" && title /= [] = title | otherwise = unpackFS pkgNameFS in ppHoogle dflags pkgNameStr pkgVer title (fmap _doc prologue) visibleIfaces odir when (Flag_LaTeX `elem` flags) $ do ppLaTeX title pkgStr visibleIfaces odir (fmap _doc prologue) opt_latex_style libDir when (Flag_HyperlinkedSource `elem` flags) $ do ppHyperlinkedSource odir libDir opt_source_css pretty srcMap ifaces -- | From GHC 7.10, this function has a potential to crash with a -- nasty message such as @expectJust getPackageDetails@ because -- package name and versions can no longer reliably be extracted in -- all cases: if the package is not installed yet then this info is no -- longer available. The @--package-name@ and @--package-version@ -- Haddock flags allow the user to specify this information and it is -- returned here if present: if it is not present, the error will -- occur. Nasty but that's how it is for now. Potential TODO.
4,587
render dflags flags qual ifaces installedIfaces extSrcMap = do let title = fromMaybe "" (optTitle flags) unicode = Flag_UseUnicode `elem` flags pretty = Flag_PrettyHtml `elem` flags opt_wiki_urls = wikiUrls flags opt_contents_url = optContentsUrl flags opt_index_url = optIndexUrl flags odir = outputDir flags opt_latex_style = optLaTeXStyle flags opt_source_css = optSourceCssFile flags visibleIfaces = [ i | i <- ifaces, OptHide `notElem` ifaceOptions i ] -- /All/ visible interfaces including external package modules. allIfaces = map toInstalledIface ifaces ++ installedIfaces allVisibleIfaces = [ i | i <- allIfaces, OptHide `notElem` instOptions i ] pkgMod = ifaceMod (head ifaces) pkgKey = modulePackageKey pkgMod pkgStr = Just (packageKeyString pkgKey) pkgNameVer = modulePackageInfo dflags flags pkgMod (srcBase, srcModule, srcEntity, srcLEntity) = sourceUrls flags srcModule' | Flag_HyperlinkedSource `elem` flags = Just hypSrcModuleUrlFormat | otherwise = srcModule srcMap = mkSrcMap $ Map.union (Map.map SrcExternal extSrcMap) (Map.fromList [ (ifaceMod iface, SrcLocal) | iface <- ifaces ]) pkgSrcMap = Map.mapKeys modulePackageKey extSrcMap pkgSrcMap' | Flag_HyperlinkedSource `elem` flags = Map.insert pkgKey hypSrcModuleNameUrlFormat pkgSrcMap | Just srcNameUrl <- srcEntity = Map.insert pkgKey srcNameUrl pkgSrcMap | otherwise = pkgSrcMap -- TODO: Get these from the interface files as with srcMap srcLMap' = maybe Map.empty (\path -> Map.singleton pkgKey path) srcLEntity sourceUrls' = (srcBase, srcModule', pkgSrcMap', srcLMap') libDir <- getHaddockLibDir flags prologue <- getPrologue dflags flags themes <- getThemes libDir flags >>= either bye return when (Flag_GenIndex `elem` flags) $ do ppHtmlIndex odir title pkgStr themes opt_contents_url sourceUrls' opt_wiki_urls allVisibleIfaces pretty copyHtmlBits odir libDir themes when (Flag_GenContents `elem` flags) $ do ppHtmlContents dflags odir title pkgStr themes opt_index_url sourceUrls' opt_wiki_urls allVisibleIfaces True prologue pretty (makeContentsQual qual) copyHtmlBits odir libDir themes when (Flag_Html `elem` flags) $ do ppHtml dflags title pkgStr visibleIfaces odir prologue themes sourceUrls' opt_wiki_urls opt_contents_url opt_index_url unicode qual pretty copyHtmlBits odir libDir themes -- TODO: we throw away Meta for both Hoogle and LaTeX right now, -- might want to fix that if/when these two get some work on them when (Flag_Hoogle `elem` flags) $ do case pkgNameVer of Nothing -> putStrLn . unlines $ [ "haddock: Unable to find a package providing module " ++ moduleNameString (moduleName pkgMod) ++ ", skipping Hoogle." , "" , " Perhaps try specifying the desired package explicitly" ++ " using the --package-name" , " and --package-version arguments." ] Just (PackageName pkgNameFS, pkgVer) -> let pkgNameStr | unpackFS pkgNameFS == "main" && title /= [] = title | otherwise = unpackFS pkgNameFS in ppHoogle dflags pkgNameStr pkgVer title (fmap _doc prologue) visibleIfaces odir when (Flag_LaTeX `elem` flags) $ do ppLaTeX title pkgStr visibleIfaces odir (fmap _doc prologue) opt_latex_style libDir when (Flag_HyperlinkedSource `elem` flags) $ do ppHyperlinkedSource odir libDir opt_source_css pretty srcMap ifaces -- | From GHC 7.10, this function has a potential to crash with a -- nasty message such as @expectJust getPackageDetails@ because -- package name and versions can no longer reliably be extracted in -- all cases: if the package is not installed yet then this info is no -- longer available. The @--package-name@ and @--package-version@ -- Haddock flags allow the user to specify this information and it is -- returned here if present: if it is not present, the error will -- occur. Nasty but that's how it is for now. Potential TODO.
4,473
false
true
0
23
1,278
976
490
486
null
null
glutamate/probably
Math/Probably/LinearPDF.hs
bsd-3-clause
tstb = det sig1
15
tstb = det sig1
15
tstb = det sig1
15
false
false
1
5
3
12
4
8
null
null
stumped2/school
CS381/hw2/Hw2.hs
apache-2.0
semCmd :: Cmd -> D semCmd (LD e) xs = case xs of Just xs -> if e < 0 then Nothing else Just (xs ++ [e])
185
semCmd :: Cmd -> D semCmd (LD e) xs = case xs of Just xs -> if e < 0 then Nothing else Just (xs ++ [e])
185
semCmd (LD e) xs = case xs of Just xs -> if e < 0 then Nothing else Just (xs ++ [e])
166
false
true
0
12
108
69
34
35
null
null