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
alphaHeavy/cabal
Cabal/Distribution/InstalledPackageInfo.hs
bsd-3-clause
noVersion :: Version noVersion = Version{ versionBranch=[], versionTags=[] }
76
noVersion :: Version noVersion = Version{ versionBranch=[], versionTags=[] }
76
noVersion = Version{ versionBranch=[], versionTags=[] }
55
false
true
0
7
8
29
17
12
null
null
fpco/fay
tests/ExportQualified_Export.hs
bsd-3-clause
main :: Fay () main = return ()
31
main :: Fay () main = return ()
31
main = return ()
16
false
true
0
7
7
27
11
16
null
null
tcsc/ffs
test/Ffs/CommandLineSpec.hs
mit
spec :: Spec spec = it "Needs tests" $ 1 `shouldBe` 1
53
spec :: Spec spec = it "Needs tests" $ 1 `shouldBe` 1
53
spec = it "Needs tests" $ 1 `shouldBe` 1
40
false
true
0
6
11
31
14
17
null
null
mcschroeder/ghc
compiler/main/DynFlags.hs
bsd-3-clause
wayOptc _ WayEventLog = ["-DTRACING"]
39
wayOptc _ WayEventLog = ["-DTRACING"]
39
wayOptc _ WayEventLog = ["-DTRACING"]
39
false
false
1
6
6
16
7
9
null
null
hguenther/smtlib2
extras/emulated-modulus/Language/SMTLib2/ModulusEmulator.hs
gpl-3.0
addEmulation :: Emulation b -> ModulusEmulator b -> ModulusEmulator b addEmulation emul b = b2 where b1 = case addAssertions b of Nothing -> b Just stack -> b { addAssertions = Just $ emul:stack } b2 = b1 { emulations = emul:emulations b1 }
264
addEmulation :: Emulation b -> ModulusEmulator b -> ModulusEmulator b addEmulation emul b = b2 where b1 = case addAssertions b of Nothing -> b Just stack -> b { addAssertions = Just $ emul:stack } b2 = b1 { emulations = emul:emulations b1 }
264
addEmulation emul b = b2 where b1 = case addAssertions b of Nothing -> b Just stack -> b { addAssertions = Just $ emul:stack } b2 = b1 { emulations = emul:emulations b1 }
194
false
true
2
11
68
113
51
62
null
null
thoughtbot/typebot
src/Bot.hs
bsd-3-clause
engine _ = Hoogle
17
engine _ = Hoogle
17
engine _ = Hoogle
17
false
false
0
4
3
10
4
6
null
null
shayan-najd/HsParser
OutputableInstances.hs
gpl-3.0
-- Don't print the type; it's only a place-holder before typechecking -- Exported to HsBinds, which can't see the defn of HsMatchContext pprFunBind :: (OutputableBndr idR, Outputable body) => MatchGroup idR body -> SDoc pprFunBind matches = pprMatches matches
271
pprFunBind :: (OutputableBndr idR, Outputable body) => MatchGroup idR body -> SDoc pprFunBind matches = pprMatches matches
133
pprFunBind matches = pprMatches matches
39
true
true
0
8
50
48
23
25
null
null
AlexanderPankiv/ghc
compiler/ghci/ByteCodeGen.hs
bsd-3-clause
-- treated just like a variable V pushAtom d p (AnnVar v) | UnaryRep rep_ty <- repType (idType v) , V <- typeArgRep rep_ty = return (nilOL, 0) | isFCallId v = pprPanic "pushAtom: shouldn't get an FCallId here" (ppr v) | Just primop <- isPrimOpId_maybe v = return (unitOL (PUSH_PRIMOP primop), 1) | Just d_v <- lookupBCEnv_maybe v p -- v is a local variable = do dflags <- getDynFlags let sz :: Word16 sz = fromIntegral (idSizeW dflags v) l = trunc16 $ d - d_v + fromIntegral sz - 2 return (toOL (genericReplicate sz (PUSH_L l)), sz) -- d - d_v the number of words between the TOS -- and the 1st slot of the object -- -- d - d_v - 1 the offset from the TOS of the 1st slot -- -- d - d_v - 1 + sz - 1 the offset from the TOS of the last slot -- of the object. -- -- Having found the last slot, we proceed to copy the right number of -- slots on to the top of the stack. | otherwise -- v must be a global variable = do dflags <- getDynFlags let sz :: Word16 sz = fromIntegral (idSizeW dflags v) MASSERT(sz == 1) return (unitOL (PUSH_G (getName v)), sz)
1,334
pushAtom d p (AnnVar v) | UnaryRep rep_ty <- repType (idType v) , V <- typeArgRep rep_ty = return (nilOL, 0) | isFCallId v = pprPanic "pushAtom: shouldn't get an FCallId here" (ppr v) | Just primop <- isPrimOpId_maybe v = return (unitOL (PUSH_PRIMOP primop), 1) | Just d_v <- lookupBCEnv_maybe v p -- v is a local variable = do dflags <- getDynFlags let sz :: Word16 sz = fromIntegral (idSizeW dflags v) l = trunc16 $ d - d_v + fromIntegral sz - 2 return (toOL (genericReplicate sz (PUSH_L l)), sz) -- d - d_v the number of words between the TOS -- and the 1st slot of the object -- -- d - d_v - 1 the offset from the TOS of the 1st slot -- -- d - d_v - 1 + sz - 1 the offset from the TOS of the last slot -- of the object. -- -- Having found the last slot, we proceed to copy the right number of -- slots on to the top of the stack. | otherwise -- v must be a global variable = do dflags <- getDynFlags let sz :: Word16 sz = fromIntegral (idSizeW dflags v) MASSERT(sz == 1) return (unitOL (PUSH_G (getName v)), sz)
1,299
pushAtom d p (AnnVar v) | UnaryRep rep_ty <- repType (idType v) , V <- typeArgRep rep_ty = return (nilOL, 0) | isFCallId v = pprPanic "pushAtom: shouldn't get an FCallId here" (ppr v) | Just primop <- isPrimOpId_maybe v = return (unitOL (PUSH_PRIMOP primop), 1) | Just d_v <- lookupBCEnv_maybe v p -- v is a local variable = do dflags <- getDynFlags let sz :: Word16 sz = fromIntegral (idSizeW dflags v) l = trunc16 $ d - d_v + fromIntegral sz - 2 return (toOL (genericReplicate sz (PUSH_L l)), sz) -- d - d_v the number of words between the TOS -- and the 1st slot of the object -- -- d - d_v - 1 the offset from the TOS of the 1st slot -- -- d - d_v - 1 + sz - 1 the offset from the TOS of the last slot -- of the object. -- -- Having found the last slot, we proceed to copy the right number of -- slots on to the top of the stack. | otherwise -- v must be a global variable = do dflags <- getDynFlags let sz :: Word16 sz = fromIntegral (idSizeW dflags v) MASSERT(sz == 1) return (unitOL (PUSH_G (getName v)), sz)
1,299
true
false
1
15
500
328
159
169
null
null
SKA-ScienceDataProcessor/RC
MS4/lib/DNA/Run.hs
apache-2.0
runReadP :: ReadP a -> String -> a runReadP p s = case readP_to_S p s of [(a,"")] -> a _ -> error $ "Cannot parse string: '" ++ s ++ "'" ---------------------------------------------------------------- -- UNIX start ---------------------------------------------------------------- -- Startup of program
321
runReadP :: ReadP a -> String -> a runReadP p s = case readP_to_S p s of [(a,"")] -> a _ -> error $ "Cannot parse string: '" ++ s ++ "'" ---------------------------------------------------------------- -- UNIX start ---------------------------------------------------------------- -- Startup of program
321
runReadP p s = case readP_to_S p s of [(a,"")] -> a _ -> error $ "Cannot parse string: '" ++ s ++ "'" ---------------------------------------------------------------- -- UNIX start ---------------------------------------------------------------- -- Startup of program
286
false
true
0
10
59
73
39
34
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_TANGENT_ARRAY_EXT :: GLenum gl_TANGENT_ARRAY_EXT = 0x8439
60
gl_TANGENT_ARRAY_EXT :: GLenum gl_TANGENT_ARRAY_EXT = 0x8439
60
gl_TANGENT_ARRAY_EXT = 0x8439
29
false
true
0
4
5
11
6
5
null
null
siddhanathan/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
nlConVarPatName :: Name -> [Name] -> LPat Name nlConVarPatName con vars = nlConPatName con (map nlVarPat vars)
110
nlConVarPatName :: Name -> [Name] -> LPat Name nlConVarPatName con vars = nlConPatName con (map nlVarPat vars)
110
nlConVarPatName con vars = nlConPatName con (map nlVarPat vars)
63
false
true
0
7
16
43
21
22
null
null
lfritz/python-type-inference
python-type-inference/src/Language/Python/TypeInference/Analysis/Analysis.hs
bsd-3-clause
pow (a, b) | isNum a && isNum b = case commonArithmeticType a b of IntType -> oneType IntType `join` oneType FloatType t -> oneType t | otherwise = bot
297
pow (a, b) | isNum a && isNum b = case commonArithmeticType a b of IntType -> oneType IntType `join` oneType FloatType t -> oneType t | otherwise = bot
297
pow (a, b) | isNum a && isNum b = case commonArithmeticType a b of IntType -> oneType IntType `join` oneType FloatType t -> oneType t | otherwise = bot
297
false
false
0
10
175
77
35
42
null
null
A1-Triard/solid
src/Solid/Gui.hs
apache-2.0
queueFrame :: UI -> System -> IO () queueFrame ui s = do Rectangle _ _ w h <- widgetGetAllocation $ canvas ui let y0 = fromIntegral h - 30.0 draw_id <- on (canvas ui) draw $ do drawSystem (V2 (fromIntegral w / 2.0) (50.0 + (fromIntegral h - 300.0) / 2.0)) s setLineWidth 1.0 setSourceRGB 0.8 0.8 0.8 moveTo 20.0 y0 lineTo 1040.0 y0 stroke moveTo 30.0 (y0 + 10.0) lineTo 30.0 (y0 - 200.0) stroke drawDiagram (V2 25.0 y0) (V3 0.3 0.6 0.6) (keDiagram ui) drawDiagram (V2 25.0 y0) (V3 0.6 0.6 0.3) (peDiagram ui) void $ timeoutAdd (frame ui s draw_id) $ round (1000.0 / fps)
622
queueFrame :: UI -> System -> IO () queueFrame ui s = do Rectangle _ _ w h <- widgetGetAllocation $ canvas ui let y0 = fromIntegral h - 30.0 draw_id <- on (canvas ui) draw $ do drawSystem (V2 (fromIntegral w / 2.0) (50.0 + (fromIntegral h - 300.0) / 2.0)) s setLineWidth 1.0 setSourceRGB 0.8 0.8 0.8 moveTo 20.0 y0 lineTo 1040.0 y0 stroke moveTo 30.0 (y0 + 10.0) lineTo 30.0 (y0 - 200.0) stroke drawDiagram (V2 25.0 y0) (V3 0.3 0.6 0.6) (keDiagram ui) drawDiagram (V2 25.0 y0) (V3 0.6 0.6 0.3) (peDiagram ui) void $ timeoutAdd (frame ui s draw_id) $ round (1000.0 / fps)
622
queueFrame ui s = do Rectangle _ _ w h <- widgetGetAllocation $ canvas ui let y0 = fromIntegral h - 30.0 draw_id <- on (canvas ui) draw $ do drawSystem (V2 (fromIntegral w / 2.0) (50.0 + (fromIntegral h - 300.0) / 2.0)) s setLineWidth 1.0 setSourceRGB 0.8 0.8 0.8 moveTo 20.0 y0 lineTo 1040.0 y0 stroke moveTo 30.0 (y0 + 10.0) lineTo 30.0 (y0 - 200.0) stroke drawDiagram (V2 25.0 y0) (V3 0.3 0.6 0.6) (keDiagram ui) drawDiagram (V2 25.0 y0) (V3 0.6 0.6 0.3) (peDiagram ui) void $ timeoutAdd (frame ui s draw_id) $ round (1000.0 / fps)
586
false
true
0
20
160
312
141
171
null
null
anton-k/language-css
src/Language/Css/Build/Idents.hs
bsd-3-clause
-- | table-row-group tableRowGroup :: Idents a => a tableRowGroup = ident "table-row-group"
91
tableRowGroup :: Idents a => a tableRowGroup = ident "table-row-group"
70
tableRowGroup = ident "table-row-group"
39
true
true
0
6
12
22
11
11
null
null
DamienCassou/HYahtzee
Game/HYahtzee/Engine/Logic.hs
bsd-3-clause
changeTable :: YTable -> YData -> YData changeTable newTable ydata = case splitAt (ydCurPlayer ydata) (ydTables ydata) of (before, _:after) -> ydata {ydTables = before ++ [newTable] ++ after} _ -> ydata
231
changeTable :: YTable -> YData -> YData changeTable newTable ydata = case splitAt (ydCurPlayer ydata) (ydTables ydata) of (before, _:after) -> ydata {ydTables = before ++ [newTable] ++ after} _ -> ydata
231
changeTable newTable ydata = case splitAt (ydCurPlayer ydata) (ydTables ydata) of (before, _:after) -> ydata {ydTables = before ++ [newTable] ++ after} _ -> ydata
191
false
true
0
12
60
91
46
45
null
null
isomorphism/webgl
src/Graphics/Rendering/WebGL/Constants.hs
mit
gl_TEXTURE12 :: GLenum gl_TEXTURE12 = 0x84CC
44
gl_TEXTURE12 :: GLenum gl_TEXTURE12 = 0x84CC
44
gl_TEXTURE12 = 0x84CC
21
false
true
0
4
5
11
6
5
null
null
xmonad/xmonad-contrib
XMonad/Hooks/Place.hs
bsd-3-clause
r2rr :: Rectangle -> Rectangle -> S.RationalRect r2rr (Rectangle x0 y0 w0 h0) (Rectangle x y w h) = S.RationalRect ((fi x-fi x0) % fi w0) ((fi y-fi y0) % fi h0) (fi w % fi w0) (fi h % fi h0)
249
r2rr :: Rectangle -> Rectangle -> S.RationalRect r2rr (Rectangle x0 y0 w0 h0) (Rectangle x y w h) = S.RationalRect ((fi x-fi x0) % fi w0) ((fi y-fi y0) % fi h0) (fi w % fi w0) (fi h % fi h0)
249
r2rr (Rectangle x0 y0 w0 h0) (Rectangle x y w h) = S.RationalRect ((fi x-fi x0) % fi w0) ((fi y-fi y0) % fi h0) (fi w % fi w0) (fi h % fi h0)
200
false
true
0
10
100
142
65
77
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/HTMLIFrameElement.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement.allowFullscreen Mozilla HTMLIFrameElement.allowFullscreen documentation> setAllowFullscreen :: (MonadDOM m) => HTMLIFrameElement -> Bool -> m () setAllowFullscreen self val = liftDOM (self ^. jss "allowFullscreen" (toJSVal val))
323
setAllowFullscreen :: (MonadDOM m) => HTMLIFrameElement -> Bool -> m () setAllowFullscreen self val = liftDOM (self ^. jss "allowFullscreen" (toJSVal val))
176
setAllowFullscreen self val = liftDOM (self ^. jss "allowFullscreen" (toJSVal val))
85
true
true
0
10
49
60
30
30
null
null
dvolk/hoodie
Main.hs
gpl-3.0
runGame1 :: GameState -> Game a -> Curses GameState runGame1 s (GameT f) = execStateT f s
89
runGame1 :: GameState -> Game a -> Curses GameState runGame1 s (GameT f) = execStateT f s
89
runGame1 s (GameT f) = execStateT f s
37
false
true
0
7
16
46
20
26
null
null
frontrowed/stratosphere
library-gen/Stratosphere/Resources/S3Bucket.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-analyticsconfigurations sbAnalyticsConfigurations :: Lens' S3Bucket (Maybe [S3BucketAnalyticsConfiguration]) sbAnalyticsConfigurations = lens _s3BucketAnalyticsConfigurations (\s a -> s { _s3BucketAnalyticsConfigurations = a })
338
sbAnalyticsConfigurations :: Lens' S3Bucket (Maybe [S3BucketAnalyticsConfiguration]) sbAnalyticsConfigurations = lens _s3BucketAnalyticsConfigurations (\s a -> s { _s3BucketAnalyticsConfigurations = a })
203
sbAnalyticsConfigurations = lens _s3BucketAnalyticsConfigurations (\s a -> s { _s3BucketAnalyticsConfigurations = a })
118
true
true
0
9
21
49
27
22
null
null
SASinestro/lil-render
src/LilRender/Color/Named.hs
isc
royalBlue = RGBColor { _red=65, _green=105, _blue=225 }
55
royalBlue = RGBColor { _red=65, _green=105, _blue=225 }
55
royalBlue = RGBColor { _red=65, _green=105, _blue=225 }
55
false
false
0
6
7
26
16
10
null
null
kajigor/uKanren_transformations
test/resources/Program/Prop.hs
bsd-3-clause
query2 = Program evalo $ fresh ["st"] (call "evalo" [V "st", fm1, trueo])
73
query2 = Program evalo $ fresh ["st"] (call "evalo" [V "st", fm1, trueo])
73
query2 = Program evalo $ fresh ["st"] (call "evalo" [V "st", fm1, trueo])
73
false
false
0
10
12
41
21
20
null
null
beni55/pandoc
src/Text/Pandoc/Readers/LaTeX.hs
gpl-2.0
grave 'E' = 'È'
15
grave 'E' = 'È'
15
grave 'E' = 'È'
15
false
false
0
5
3
9
4
5
null
null
mightymoose/liquidhaskell
tests/pos/OrdList.hs
bsd-3-clause
a `appOL` b = Two a b
29
a `appOL` b = Two a b
29
a `appOL` b = Two a b
29
false
false
0
5
14
22
10
12
null
null
savannidgerinel/health
src/LuminescentDreams/Text/TimeParsers.hs
bsd-3-clause
parseZonedTime :: MonadError TimeParseError m => Text -> m UTCTime parseZonedTime t = case words t of date:time:tz:_ -> localTimeToUTC <$> parseTimeZone tz <*> (LocalTime <$> parseDate date <*> parseTime time) date:time:_ -> localTimeToUTC utc <$> (LocalTime <$> parseDate date <*> parseTime time) date:_ -> localTimeToUTC utc <$> (LocalTime <$> parseDate date <*> pure midnight) [] -> throwError $ TimeParseError "parse failed" {- | Parse a time zone using either the -0600 format or the CDT format -}
671
parseZonedTime :: MonadError TimeParseError m => Text -> m UTCTime parseZonedTime t = case words t of date:time:tz:_ -> localTimeToUTC <$> parseTimeZone tz <*> (LocalTime <$> parseDate date <*> parseTime time) date:time:_ -> localTimeToUTC utc <$> (LocalTime <$> parseDate date <*> parseTime time) date:_ -> localTimeToUTC utc <$> (LocalTime <$> parseDate date <*> pure midnight) [] -> throwError $ TimeParseError "parse failed" {- | Parse a time zone using either the -0600 format or the CDT format -}
671
parseZonedTime t = case words t of date:time:tz:_ -> localTimeToUTC <$> parseTimeZone tz <*> (LocalTime <$> parseDate date <*> parseTime time) date:time:_ -> localTimeToUTC utc <$> (LocalTime <$> parseDate date <*> parseTime time) date:_ -> localTimeToUTC utc <$> (LocalTime <$> parseDate date <*> pure midnight) [] -> throwError $ TimeParseError "parse failed" {- | Parse a time zone using either the -0600 format or the CDT format -}
604
false
true
0
12
246
175
82
93
null
null
ndaniels/strain-assay-minimization
Barcode.hs
mit
-- if cost of all the chosen is 1.0, then we just return them -- else, choose the best one from CANDIDATES, removing it from candidates, -- and recurse. -- if candidates is empty, return chosen -- take a list of Barcodes and a list of Snp indices. -- return the set of Snp indices to use chooseSnps :: [Barcode] -> [Int] -> [Int] chooseSnps bs is = chooseSnps' bs is []
370
chooseSnps :: [Barcode] -> [Int] -> [Int] chooseSnps bs is = chooseSnps' bs is []
81
chooseSnps bs is = chooseSnps' bs is []
39
true
true
0
7
72
48
28
20
null
null
teleshoes/taffybar
src/System/Taffybar/Information/SafeX11.hs
bsd-3-clause
requestQueue :: Chan IORequest requestQueue = unsafePerformIO newChan
69
requestQueue :: Chan IORequest requestQueue = unsafePerformIO newChan
69
requestQueue = unsafePerformIO newChan
38
false
true
1
5
7
20
8
12
null
null
raphway/json-xml-translator
translator.hs
apache-2.0
{-| This function encodes a ResultData data type into XML. -} encodeResultData :: ResultData -> Int -> String encodeResultData resultData tabs = (addTabs tabs) ++ "<resultsData>\n" ++ (addXMLElements [ ("updateDate", (updatedDate resultData)), ("totalItems", (show (totalItems resultData))), ("startIndex", (show (startIndex resultData))), ("itemsPerPage", (show (itemsPerPage resultData))) ] (tabs + 1)) ++ "\n" ++ (encodeItemArray (items resultData) (tabs + 1)) ++ "\n" ++ (addTabs tabs) ++ "</resultsData>"
537
encodeResultData :: ResultData -> Int -> String encodeResultData resultData tabs = (addTabs tabs) ++ "<resultsData>\n" ++ (addXMLElements [ ("updateDate", (updatedDate resultData)), ("totalItems", (show (totalItems resultData))), ("startIndex", (show (startIndex resultData))), ("itemsPerPage", (show (itemsPerPage resultData))) ] (tabs + 1)) ++ "\n" ++ (encodeItemArray (items resultData) (tabs + 1)) ++ "\n" ++ (addTabs tabs) ++ "</resultsData>"
473
encodeResultData resultData tabs = (addTabs tabs) ++ "<resultsData>\n" ++ (addXMLElements [ ("updateDate", (updatedDate resultData)), ("totalItems", (show (totalItems resultData))), ("startIndex", (show (startIndex resultData))), ("itemsPerPage", (show (itemsPerPage resultData))) ] (tabs + 1)) ++ "\n" ++ (encodeItemArray (items resultData) (tabs + 1)) ++ "\n" ++ (addTabs tabs) ++ "</resultsData>"
425
true
true
8
13
91
188
98
90
null
null
vTurbine/ghc
compiler/hsSyn/HsDecls.hs
bsd-3-clause
getConNames ConDeclGADT {con_names = names} = names
51
getConNames ConDeclGADT {con_names = names} = names
51
getConNames ConDeclGADT {con_names = names} = names
51
false
false
0
8
6
18
9
9
null
null
mgmeier/extra
src/Control/Exception/Extra.hs
bsd-3-clause
-- | Catch an exception if the predicate passes, then call the handler with the original exception. -- As an example: -- -- @ -- readFileExists x == catchBool isDoesNotExistError (readFile \"myfile\") (const $ return \"\") -- @ catchBool :: Exception e => (e -> Bool) -> IO a -> (e -> IO a) -> IO a catchBool f a b = catchJust (bool f) a b
341
catchBool :: Exception e => (e -> Bool) -> IO a -> (e -> IO a) -> IO a catchBool f a b = catchJust (bool f) a b
111
catchBool f a b = catchJust (bool f) a b
40
true
true
0
11
68
79
41
38
null
null
Daniel-Diaz/processing
Graphics/Web/Processing/Core/Primal.hs
bsd-3-clause
(Sequence xs) >>. p = if Seq.null xs then p else Sequence $ xs Seq.|> p
122
(Sequence xs) >>. p = if Seq.null xs then p else Sequence $ xs Seq.|> p
122
(Sequence xs) >>. p = if Seq.null xs then p else Sequence $ xs Seq.|> p
122
false
false
0
7
66
41
20
21
null
null
dmcclean/dimensional-dk-linalg
src/Numeric/LinearAlgebra/Dimensional/DK/QuasiQuotes.hs
bsd-3-clause
makeVectorExp :: [Q Exp] -> Q Exp makeVectorExp [] = fail "Empty vectors not permitted."
88
makeVectorExp :: [Q Exp] -> Q Exp makeVectorExp [] = fail "Empty vectors not permitted."
88
makeVectorExp [] = fail "Empty vectors not permitted."
54
false
true
0
8
14
36
16
20
null
null
mainland/dph
icebox/examples/runbench.hs
bsd-3-clause
systemWithCheck :: String -> IO () systemWithCheck cmd = do -- printf "Invoking '%s'\n" cmd ec <- system cmd case ec of ExitSuccess -> return () ExitFailure c -> printf "execution failed (exit %d)\n" c -- Main script -- -----------
271
systemWithCheck :: String -> IO () systemWithCheck cmd = do -- printf "Invoking '%s'\n" cmd ec <- system cmd case ec of ExitSuccess -> return () ExitFailure c -> printf "execution failed (exit %d)\n" c -- Main script -- -----------
271
systemWithCheck cmd = do -- printf "Invoking '%s'\n" cmd ec <- system cmd case ec of ExitSuccess -> return () ExitFailure c -> printf "execution failed (exit %d)\n" c -- Main script -- -----------
236
false
true
0
11
79
68
32
36
null
null
jd823592/puppeteer
src/Puppet/Master/Colour.hs
mit
tokencls Keyglyph = "hs-keyglyph"
35
tokencls Keyglyph = "hs-keyglyph"
35
tokencls Keyglyph = "hs-keyglyph"
35
false
false
0
4
5
10
4
6
null
null
redfish64/IrcScanner
src/IrcScanner/KeywordRulesParser.hs
bsd-3-clause
parseKwFile :: [T.Text] -> Either [T.Text] [Index] parseKwFile lns = listEitherToEitherLists (fmap (evalState $ runEitherT kwLine) lns ) ""
139
parseKwFile :: [T.Text] -> Either [T.Text] [Index] parseKwFile lns = listEitherToEitherLists (fmap (evalState $ runEitherT kwLine) lns ) ""
139
parseKwFile lns = listEitherToEitherLists (fmap (evalState $ runEitherT kwLine) lns ) ""
88
false
true
0
10
18
59
30
29
null
null
shlevy/ghc
libraries/base/tests/T13525.hs
bsd-3-clause
main :: IO () main = do createNamedPipe "test" accessModes h <- openFile "test" ReadMode hWaitForInput h (5 * 1000) return ()
141
main :: IO () main = do createNamedPipe "test" accessModes h <- openFile "test" ReadMode hWaitForInput h (5 * 1000) return ()
141
main = do createNamedPipe "test" accessModes h <- openFile "test" ReadMode hWaitForInput h (5 * 1000) return ()
127
false
true
0
10
37
65
27
38
null
null
spinda/liquidhaskell
src/Language/Haskell/Liquid/GhcMisc.hs
bsd-3-clause
unTickExpr (Lam b e) = Lam b (unTickExpr e)
52
unTickExpr (Lam b e) = Lam b (unTickExpr e)
52
unTickExpr (Lam b e) = Lam b (unTickExpr e)
52
false
false
0
7
17
29
13
16
null
null
meiersi-11ce/stack
src/Stack/Setup.hs
bsd-3-clause
sanityCheck :: (MonadIO m, MonadMask m, MonadLogger m, MonadBaseControl IO m) => EnvOverride -> WhichCompiler -> m () sanityCheck menv wc = withCanonicalizedSystemTempDirectory "stack-sanity-check" $ \dir -> do let fp = toFilePath $ dir </> $(mkRelFile "Main.hs") liftIO $ writeFile fp $ unlines [ "import Distribution.Simple" -- ensure Cabal library is present , "main = putStrLn \"Hello World\"" ] let exeName = compilerExeName wc ghc <- join $ findExecutable menv exeName $logDebug $ "Performing a sanity check on: " <> T.pack (toFilePath ghc) eres <- tryProcessStdout (Just dir) menv exeName [ fp , "-no-user-package-db" ] case eres of Left e -> throwM $ GHCSanityCheckCompileFailed e ghc Right _ -> return () -- TODO check that the output of running the command is correct
905
sanityCheck :: (MonadIO m, MonadMask m, MonadLogger m, MonadBaseControl IO m) => EnvOverride -> WhichCompiler -> m () sanityCheck menv wc = withCanonicalizedSystemTempDirectory "stack-sanity-check" $ \dir -> do let fp = toFilePath $ dir </> $(mkRelFile "Main.hs") liftIO $ writeFile fp $ unlines [ "import Distribution.Simple" -- ensure Cabal library is present , "main = putStrLn \"Hello World\"" ] let exeName = compilerExeName wc ghc <- join $ findExecutable menv exeName $logDebug $ "Performing a sanity check on: " <> T.pack (toFilePath ghc) eres <- tryProcessStdout (Just dir) menv exeName [ fp , "-no-user-package-db" ] case eres of Left e -> throwM $ GHCSanityCheckCompileFailed e ghc Right _ -> return () -- TODO check that the output of running the command is correct
905
sanityCheck menv wc = withCanonicalizedSystemTempDirectory "stack-sanity-check" $ \dir -> do let fp = toFilePath $ dir </> $(mkRelFile "Main.hs") liftIO $ writeFile fp $ unlines [ "import Distribution.Simple" -- ensure Cabal library is present , "main = putStrLn \"Hello World\"" ] let exeName = compilerExeName wc ghc <- join $ findExecutable menv exeName $logDebug $ "Performing a sanity check on: " <> T.pack (toFilePath ghc) eres <- tryProcessStdout (Just dir) menv exeName [ fp , "-no-user-package-db" ] case eres of Left e -> throwM $ GHCSanityCheckCompileFailed e ghc Right _ -> return () -- TODO check that the output of running the command is correct
751
false
true
0
15
250
237
112
125
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/GT_2.hs
mit
esEsOrdering GT GT = MyTrue
27
esEsOrdering GT GT = MyTrue
27
esEsOrdering GT GT = MyTrue
27
false
false
1
5
4
16
5
11
null
null
uvNikita/SyntacticAnalyzer
src/Main.hs
mit
writeText = scale 12 . pad 2.1 . centerXY . text
48
writeText = scale 12 . pad 2.1 . centerXY . text
48
writeText = scale 12 . pad 2.1 . centerXY . text
48
false
false
0
8
10
24
11
13
null
null
wfleming/advent-of-code-2016
2016/src/D22Lib.hs
bsd-3-clause
sourceNode (n0:n1:t) = case pos n0 of (x0, 0) -> let (x1, y1) = pos n1 in if 0 == y1 && x1 > x0 then sourceNode (n1:t) else sourceNode (n0:t) _ -> sourceNode (n1:t)
186
sourceNode (n0:n1:t) = case pos n0 of (x0, 0) -> let (x1, y1) = pos n1 in if 0 == y1 && x1 > x0 then sourceNode (n1:t) else sourceNode (n0:t) _ -> sourceNode (n1:t)
186
sourceNode (n0:n1:t) = case pos n0 of (x0, 0) -> let (x1, y1) = pos n1 in if 0 == y1 && x1 > x0 then sourceNode (n1:t) else sourceNode (n0:t) _ -> sourceNode (n1:t)
186
false
false
2
10
56
117
59
58
null
null
ghc-android/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
narrowOp Narrow8WordOp = Just (MO_UU_Conv, W8)
47
narrowOp Narrow8WordOp = Just (MO_UU_Conv, W8)
47
narrowOp Narrow8WordOp = Just (MO_UU_Conv, W8)
47
false
false
0
6
6
18
9
9
null
null
michaelt/pipes-bytestring-mmap
tests/pressure.hs
bsd-3-clause
time :: IO t -> IO t time a = do start <- getCPUTime v <- a v `seq` return () end <- getCPUTime let diff = (fromIntegral (end - start)) / (10^12) printf "Computation time: %0.3f sec\n" (diff :: Double) return v
240
time :: IO t -> IO t time a = do start <- getCPUTime v <- a v `seq` return () end <- getCPUTime let diff = (fromIntegral (end - start)) / (10^12) printf "Computation time: %0.3f sec\n" (diff :: Double) return v
240
time a = do start <- getCPUTime v <- a v `seq` return () end <- getCPUTime let diff = (fromIntegral (end - start)) / (10^12) printf "Computation time: %0.3f sec\n" (diff :: Double) return v
219
false
true
0
15
72
116
54
62
null
null
laszlopandy/elm-package
src/Elm/Package/Constraint.hs
bsd-3-clause
-- CREATE CONSTRAINTS untilNextMajor :: Package.Version -> Constraint untilNextMajor version = Range version LessOrEqual Less (Package.bumpMajor version)
156
untilNextMajor :: Package.Version -> Constraint untilNextMajor version = Range version LessOrEqual Less (Package.bumpMajor version)
133
untilNextMajor version = Range version LessOrEqual Less (Package.bumpMajor version)
85
true
true
0
8
19
47
20
27
null
null
grnet/snf-ganeti
src/Ganeti/Constants.hs
bsd-2-clause
-- * Exclusive storage -- | Error margin used to compare physical disks partMargin :: Double partMargin = 0.01
111
partMargin :: Double partMargin = 0.01
38
partMargin = 0.01
17
true
true
0
6
19
20
9
11
null
null
arnizamani/aiw
Instances.hs
gpl-2.0
varConstBinding (Binary (OVar op1) p1 p2) (Binary (Oper op2) e1 e2) = let result1 = varConstBinding p1 e1 result2 = varConstBinding p2 e2 in if (isNothing result1 || isNothing result2) then Just $ (Map.singleton op1 op2) else let result = mergeSubstitutions (fromJust result1) (fromJust result2) in if isNothing result then Just $ (Map.singleton op1 op2) else mergeSubstitutions (Map.singleton op1 op2) (fromJust result)
530
varConstBinding (Binary (OVar op1) p1 p2) (Binary (Oper op2) e1 e2) = let result1 = varConstBinding p1 e1 result2 = varConstBinding p2 e2 in if (isNothing result1 || isNothing result2) then Just $ (Map.singleton op1 op2) else let result = mergeSubstitutions (fromJust result1) (fromJust result2) in if isNothing result then Just $ (Map.singleton op1 op2) else mergeSubstitutions (Map.singleton op1 op2) (fromJust result)
530
varConstBinding (Binary (OVar op1) p1 p2) (Binary (Oper op2) e1 e2) = let result1 = varConstBinding p1 e1 result2 = varConstBinding p2 e2 in if (isNothing result1 || isNothing result2) then Just $ (Map.singleton op1 op2) else let result = mergeSubstitutions (fromJust result1) (fromJust result2) in if isNothing result then Just $ (Map.singleton op1 op2) else mergeSubstitutions (Map.singleton op1 op2) (fromJust result)
530
false
false
1
14
171
182
87
95
null
null
AlexanderPankiv/ghc
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprInstr (CMPL fmt reg ri) = hcat [ char '\t', op, char '\t', pprReg reg, ptext (sLit ", "), pprRI ri ] where op = hcat [ ptext (sLit "cmpl"), pprFormat fmt, case ri of RIReg _ -> empty RIImm _ -> char 'i' ]
371
pprInstr (CMPL fmt reg ri) = hcat [ char '\t', op, char '\t', pprReg reg, ptext (sLit ", "), pprRI ri ] where op = hcat [ ptext (sLit "cmpl"), pprFormat fmt, case ri of RIReg _ -> empty RIImm _ -> char 'i' ]
371
pprInstr (CMPL fmt reg ri) = hcat [ char '\t', op, char '\t', pprReg reg, ptext (sLit ", "), pprRI ri ] where op = hcat [ ptext (sLit "cmpl"), pprFormat fmt, case ri of RIReg _ -> empty RIImm _ -> char 'i' ]
371
false
false
1
10
208
122
57
65
null
null
ethanpailes/bbc
src/GenC2.hs
bsd-3-clause
uniqueId :: [String] -> GenM IId uniqueId base = do st <- get put $ st { counter = (counter st) + 1 } return $ IId base (Just (counter st)) -- makes a nekked id. beware of name capture
197
uniqueId :: [String] -> GenM IId uniqueId base = do st <- get put $ st { counter = (counter st) + 1 } return $ IId base (Just (counter st)) -- makes a nekked id. beware of name capture
197
uniqueId base = do st <- get put $ st { counter = (counter st) + 1 } return $ IId base (Just (counter st)) -- makes a nekked id. beware of name capture
164
false
true
0
12
52
81
40
41
null
null
naushadh/persistent
persistent-template/Database/Persist/TH.hs
mit
foreignReference :: FieldDef -> Maybe HaskellName foreignReference field = case fieldReference field of ForeignRef ref _ -> Just ref _ -> Nothing -- fieldSqlType at parse time can be an Exp -- This helps delay setting fieldSqlType until lift time
269
foreignReference :: FieldDef -> Maybe HaskellName foreignReference field = case fieldReference field of ForeignRef ref _ -> Just ref _ -> Nothing -- fieldSqlType at parse time can be an Exp -- This helps delay setting fieldSqlType until lift time
269
foreignReference field = case fieldReference field of ForeignRef ref _ -> Just ref _ -> Nothing -- fieldSqlType at parse time can be an Exp -- This helps delay setting fieldSqlType until lift time
219
false
true
0
8
62
54
25
29
null
null
Forkk/ChatCore
ChatCore/State.hs
mit
-- | Executes `UpdateEvent`s from the given FRP event stream. execAcidUpdates :: (UpdateEvent evt, EventResult evt ~ ()) => AcidState (EventState evt) -> Event evt -> Reactive (IO ()) execAcidUpdates acid eUpdate = listen eUpdate $ update' acid
302
execAcidUpdates :: (UpdateEvent evt, EventResult evt ~ ()) => AcidState (EventState evt) -> Event evt -> Reactive (IO ()) execAcidUpdates acid eUpdate = listen eUpdate $ update' acid
240
execAcidUpdates acid eUpdate = listen eUpdate $ update' acid
64
true
true
0
11
95
80
38
42
null
null
jaalonso/I1M-Cod-Temas
src/Tema_20/MonticuloPropiedades.hs
gpl-2.0
-- Comprobación. -- λ> quickCheck prop_resto_es_valida -- +++ OK, passed 100 tests. -- Propiedad. El resto de (inserta x m) es m si m es el montículo vacío -- o x es menor o igual que el menor elemento de m o (inserta x (resto m)), -- en caso contrario. prop_resto_inserta :: Int -> Monticulo Int -> Bool prop_resto_inserta x m = resto (inserta x m) == if esVacio m || x <= menor m then m else inserta x (resto m)
434
prop_resto_inserta :: Int -> Monticulo Int -> Bool prop_resto_inserta x m = resto (inserta x m) == if esVacio m || x <= menor m then m else inserta x (resto m)
173
prop_resto_inserta x m = resto (inserta x m) == if esVacio m || x <= menor m then m else inserta x (resto m)
122
true
true
2
7
102
80
42
38
null
null
olsner/ghc
compiler/coreSyn/CoreTidy.hs
bsd-3-clause
tidyExpr env (Type ty) = Type (tidyType env ty)
51
tidyExpr env (Type ty) = Type (tidyType env ty)
51
tidyExpr env (Type ty) = Type (tidyType env ty)
51
false
false
0
7
12
30
13
17
null
null
blanu/arbre
Arbre/NewPrint.hs
gpl-2.0
printMapping :: Environment -> Mapping -> String printMapping env (Mapping mapping) = if length (M.toList mapping) == 0 then printEnvironment env ++ "None" else L.intercalate "," $ map (printBinding (printEnvironment env)) (M.toList mapping)
251
printMapping :: Environment -> Mapping -> String printMapping env (Mapping mapping) = if length (M.toList mapping) == 0 then printEnvironment env ++ "None" else L.intercalate "," $ map (printBinding (printEnvironment env)) (M.toList mapping)
251
printMapping env (Mapping mapping) = if length (M.toList mapping) == 0 then printEnvironment env ++ "None" else L.intercalate "," $ map (printBinding (printEnvironment env)) (M.toList mapping)
202
false
true
0
11
42
94
46
48
null
null
unhammer/Dawg.hs
Test.hs
gpl-3.0
testmin3 = let root = finish $ insert "bb" $ insert "aa" emptyView in do a <- Map.lookup 'a' (edges root) b <- Map.lookup 'b' (edges root) return (not (a===b))
179
testmin3 = let root = finish $ insert "bb" $ insert "aa" emptyView in do a <- Map.lookup 'a' (edges root) b <- Map.lookup 'b' (edges root) return (not (a===b))
179
testmin3 = let root = finish $ insert "bb" $ insert "aa" emptyView in do a <- Map.lookup 'a' (edges root) b <- Map.lookup 'b' (edges root) return (not (a===b))
179
false
false
0
13
49
92
42
50
null
null
stevedonnelly/haskell
code/Physics/RigidBody2d.hs
mit
setOrientation = setThird4
26
setOrientation = setThird4
26
setOrientation = setThird4
26
false
false
1
5
2
10
3
7
null
null
jinankjain/Programming-Problems
20 - ExpandList/expand_list.hs
gpl-2.0
expandList (x:xs) = r x x ++ expandList xs
42
expandList (x:xs) = r x x ++ expandList xs
42
expandList (x:xs) = r x x ++ expandList xs
42
false
false
2
6
8
31
13
18
null
null
int-index/singletons
src/Data/Singletons/CustomStar.hs
bsd-3-clause
-- | Produce a representation and singleton for the collection of types given. -- -- A datatype @Rep@ is created, with one constructor per type in the declared -- universe. When this type is promoted by the singletons library, the -- constructors become full types in @*@, not just promoted data constructors. -- -- For example, -- -- > $(singletonStar [''Nat, ''Bool, ''Maybe]) -- -- generates the following: -- -- > data Rep = Nat | Bool | Maybe Rep deriving (Eq, Show, Read) -- -- and its singleton. However, because @Rep@ is promoted to @*@, the singleton -- is perhaps slightly unexpected: -- -- > data instance Sing (a :: *) where -- > SNat :: Sing Nat -- > SBool :: Sing Bool -- > SMaybe :: SingRep a => Sing a -> Sing (Maybe a) -- -- The unexpected part is that @Nat@, @Bool@, and @Maybe@ above are the real @Nat@, -- @Bool@, and @Maybe@, not just promoted data constructors. -- -- Please note that this function is /very/ experimental. Use at your own risk. singletonStar :: DsMonad q => [Name] -- ^ A list of Template Haskell @Name@s for types -> q [Dec] singletonStar names = do kinds <- mapM getKind names ctors <- zipWithM (mkCtor True) names kinds let repDecl = DDataD Data [] repName [] ctors [DConPr ''Eq, DConPr ''Show, DConPr ''Read] fakeCtors <- zipWithM (mkCtor False) names kinds let dataDecl = DataDecl Data repName [] fakeCtors [DConPr ''Show, DConPr ''Read , DConPr ''Eq] ordInst <- mkOrdInstance (DConT repName) fakeCtors (pOrdInst, promDecls) <- promoteM [] $ do promoteDataDec dataDecl promoteInstanceDec mempty ordInst singletonDecls <- singDecsM [] $ do decs1 <- singDataD dataDecl dec2 <- singInstD pOrdInst return (dec2 : decs1) return $ decsToTH $ repDecl : promDecls ++ singletonDecls where -- get the kinds of the arguments to the tycon with the given name getKind :: DsMonad q => Name -> q [DKind] getKind name = do info <- reifyWithWarning name dinfo <- dsInfo info case dinfo of DTyConI (DDataD _ (_:_) _ _ _ _) _ -> fail "Cannot make a representation of a constrainted data type" DTyConI (DDataD _ [] _ tvbs _ _) _ -> return $ map (fromMaybe DStarT . extractTvbKind) tvbs DTyConI (DTySynD _ tvbs _) _ -> return $ map (fromMaybe DStarT . extractTvbKind) tvbs DPrimTyConI _ n _ -> return $ replicate n DStarT _ -> fail $ "Invalid thing for representation: " ++ (show name) -- first parameter is whether this is a real ctor (with a fresh name) -- or a fake ctor (when the name is actually a Haskell type) mkCtor :: DsMonad q => Bool -> Name -> [DKind] -> q DCon mkCtor real name args = do (types, vars) <- evalForPair $ mapM (kindToType []) args dataName <- if real then mkDataName (nameBase name) else return name return $ DCon (map DPlainTV vars) [] dataName (DNormalC (map (\ty -> (noBang, ty)) types)) Nothing where noBang = Bang NoSourceUnpackedness NoSourceStrictness -- demote a kind back to a type, accumulating any unbound parameters kindToType :: DsMonad q => [DType] -> DKind -> QWithAux [Name] q DType kindToType _ (DForallT _ _ _) = fail "Explicit forall encountered in kind" kindToType args (DAppT f a) = do a' <- kindToType [] a kindToType (a' : args) f kindToType args (DSigT t k) = do t' <- kindToType [] t k' <- kindToType [] k return $ DSigT t' k' `foldType` args kindToType args (DVarT n) = do addElement n return $ DVarT n `foldType` args kindToType args (DConT n) = return $ DConT n `foldType` args kindToType args DArrowT = return $ DArrowT `foldType` args kindToType args k@(DLitT {}) = return $ k `foldType` args kindToType args DWildCardT = return $ DWildCardT `foldType` args kindToType args DStarT = return $ DConT repName `foldType` args
4,384
singletonStar :: DsMonad q => [Name] -- ^ A list of Template Haskell @Name@s for types -> q [Dec] singletonStar names = do kinds <- mapM getKind names ctors <- zipWithM (mkCtor True) names kinds let repDecl = DDataD Data [] repName [] ctors [DConPr ''Eq, DConPr ''Show, DConPr ''Read] fakeCtors <- zipWithM (mkCtor False) names kinds let dataDecl = DataDecl Data repName [] fakeCtors [DConPr ''Show, DConPr ''Read , DConPr ''Eq] ordInst <- mkOrdInstance (DConT repName) fakeCtors (pOrdInst, promDecls) <- promoteM [] $ do promoteDataDec dataDecl promoteInstanceDec mempty ordInst singletonDecls <- singDecsM [] $ do decs1 <- singDataD dataDecl dec2 <- singInstD pOrdInst return (dec2 : decs1) return $ decsToTH $ repDecl : promDecls ++ singletonDecls where -- get the kinds of the arguments to the tycon with the given name getKind :: DsMonad q => Name -> q [DKind] getKind name = do info <- reifyWithWarning name dinfo <- dsInfo info case dinfo of DTyConI (DDataD _ (_:_) _ _ _ _) _ -> fail "Cannot make a representation of a constrainted data type" DTyConI (DDataD _ [] _ tvbs _ _) _ -> return $ map (fromMaybe DStarT . extractTvbKind) tvbs DTyConI (DTySynD _ tvbs _) _ -> return $ map (fromMaybe DStarT . extractTvbKind) tvbs DPrimTyConI _ n _ -> return $ replicate n DStarT _ -> fail $ "Invalid thing for representation: " ++ (show name) -- first parameter is whether this is a real ctor (with a fresh name) -- or a fake ctor (when the name is actually a Haskell type) mkCtor :: DsMonad q => Bool -> Name -> [DKind] -> q DCon mkCtor real name args = do (types, vars) <- evalForPair $ mapM (kindToType []) args dataName <- if real then mkDataName (nameBase name) else return name return $ DCon (map DPlainTV vars) [] dataName (DNormalC (map (\ty -> (noBang, ty)) types)) Nothing where noBang = Bang NoSourceUnpackedness NoSourceStrictness -- demote a kind back to a type, accumulating any unbound parameters kindToType :: DsMonad q => [DType] -> DKind -> QWithAux [Name] q DType kindToType _ (DForallT _ _ _) = fail "Explicit forall encountered in kind" kindToType args (DAppT f a) = do a' <- kindToType [] a kindToType (a' : args) f kindToType args (DSigT t k) = do t' <- kindToType [] t k' <- kindToType [] k return $ DSigT t' k' `foldType` args kindToType args (DVarT n) = do addElement n return $ DVarT n `foldType` args kindToType args (DConT n) = return $ DConT n `foldType` args kindToType args DArrowT = return $ DArrowT `foldType` args kindToType args k@(DLitT {}) = return $ k `foldType` args kindToType args DWildCardT = return $ DWildCardT `foldType` args kindToType args DStarT = return $ DConT repName `foldType` args
3,411
singletonStar names = do kinds <- mapM getKind names ctors <- zipWithM (mkCtor True) names kinds let repDecl = DDataD Data [] repName [] ctors [DConPr ''Eq, DConPr ''Show, DConPr ''Read] fakeCtors <- zipWithM (mkCtor False) names kinds let dataDecl = DataDecl Data repName [] fakeCtors [DConPr ''Show, DConPr ''Read , DConPr ''Eq] ordInst <- mkOrdInstance (DConT repName) fakeCtors (pOrdInst, promDecls) <- promoteM [] $ do promoteDataDec dataDecl promoteInstanceDec mempty ordInst singletonDecls <- singDecsM [] $ do decs1 <- singDataD dataDecl dec2 <- singInstD pOrdInst return (dec2 : decs1) return $ decsToTH $ repDecl : promDecls ++ singletonDecls where -- get the kinds of the arguments to the tycon with the given name getKind :: DsMonad q => Name -> q [DKind] getKind name = do info <- reifyWithWarning name dinfo <- dsInfo info case dinfo of DTyConI (DDataD _ (_:_) _ _ _ _) _ -> fail "Cannot make a representation of a constrainted data type" DTyConI (DDataD _ [] _ tvbs _ _) _ -> return $ map (fromMaybe DStarT . extractTvbKind) tvbs DTyConI (DTySynD _ tvbs _) _ -> return $ map (fromMaybe DStarT . extractTvbKind) tvbs DPrimTyConI _ n _ -> return $ replicate n DStarT _ -> fail $ "Invalid thing for representation: " ++ (show name) -- first parameter is whether this is a real ctor (with a fresh name) -- or a fake ctor (when the name is actually a Haskell type) mkCtor :: DsMonad q => Bool -> Name -> [DKind] -> q DCon mkCtor real name args = do (types, vars) <- evalForPair $ mapM (kindToType []) args dataName <- if real then mkDataName (nameBase name) else return name return $ DCon (map DPlainTV vars) [] dataName (DNormalC (map (\ty -> (noBang, ty)) types)) Nothing where noBang = Bang NoSourceUnpackedness NoSourceStrictness -- demote a kind back to a type, accumulating any unbound parameters kindToType :: DsMonad q => [DType] -> DKind -> QWithAux [Name] q DType kindToType _ (DForallT _ _ _) = fail "Explicit forall encountered in kind" kindToType args (DAppT f a) = do a' <- kindToType [] a kindToType (a' : args) f kindToType args (DSigT t k) = do t' <- kindToType [] t k' <- kindToType [] k return $ DSigT t' k' `foldType` args kindToType args (DVarT n) = do addElement n return $ DVarT n `foldType` args kindToType args (DConT n) = return $ DConT n `foldType` args kindToType args DArrowT = return $ DArrowT `foldType` args kindToType args k@(DLitT {}) = return $ k `foldType` args kindToType args DWildCardT = return $ DWildCardT `foldType` args kindToType args DStarT = return $ DConT repName `foldType` args
3,278
true
true
57
14
1,421
1,036
526
510
null
null
rueshyna/gogol
gogol-compute/gen/Network/Google/Resource/Compute/Autoscalers/Update.hs
mpl-2.0
-- | Project ID for this request. auProject :: Lens' AutoscalersUpdate Text auProject = lens _auProject (\ s a -> s{_auProject = a})
134
auProject :: Lens' AutoscalersUpdate Text auProject = lens _auProject (\ s a -> s{_auProject = a})
100
auProject = lens _auProject (\ s a -> s{_auProject = a})
58
true
true
0
9
24
42
22
20
null
null
dcreager/cabal
Distribution/System.hs
bsd-3-clause
osAliases Permissive Solaris = ["solaris2"]
43
osAliases Permissive Solaris = ["solaris2"]
43
osAliases Permissive Solaris = ["solaris2"]
43
false
false
0
5
4
14
7
7
null
null
foreverbell/project-euler-solutions
src/511.hs
bsd-3-clause
solve = poly ! (n `mod` k) where d = map (\x -> k - (x `mod` k)) divisor base = V.fromList $ map (\x -> count x d) [0 .. k - 1] where count x xs = length $ filter (== x) xs poly = power base n
212
solve = poly ! (n `mod` k) where d = map (\x -> k - (x `mod` k)) divisor base = V.fromList $ map (\x -> count x d) [0 .. k - 1] where count x xs = length $ filter (== x) xs poly = power base n
212
solve = poly ! (n `mod` k) where d = map (\x -> k - (x `mod` k)) divisor base = V.fromList $ map (\x -> count x d) [0 .. k - 1] where count x xs = length $ filter (== x) xs poly = power base n
212
false
false
0
12
69
126
69
57
null
null
uriba/dwarf
src/Data/Dwarf.hs
bsd-3-clause
stepLineMachine :: Bool -> Word8 -> DW_LNE -> [DW_LNI] -> [DW_LNE] stepLineMachine _ _ _ [] = []
96
stepLineMachine :: Bool -> Word8 -> DW_LNE -> [DW_LNI] -> [DW_LNE] stepLineMachine _ _ _ [] = []
96
stepLineMachine _ _ _ [] = []
29
false
true
0
9
17
46
24
22
null
null
jqyu/bustle-chi
src/Rad/QL/Define/Field.hs
bsd-3-clause
-- filler token resolve :: () resolve = ()
42
resolve :: () resolve = ()
26
resolve = ()
12
true
true
0
5
8
16
9
7
null
null
green-haskell/ghc
compiler/main/DriverPipeline.hs
bsd-3-clause
haveRtsOptsFlags :: DynFlags -> Bool haveRtsOptsFlags dflags = isJust (rtsOpts dflags) || case rtsOptsEnabled dflags of RtsOptsSafeOnly -> False _ -> True -- | Find out path to @ghcversion.h@ file
286
haveRtsOptsFlags :: DynFlags -> Bool haveRtsOptsFlags dflags = isJust (rtsOpts dflags) || case rtsOptsEnabled dflags of RtsOptsSafeOnly -> False _ -> True -- | Find out path to @ghcversion.h@ file
286
haveRtsOptsFlags dflags = isJust (rtsOpts dflags) || case rtsOptsEnabled dflags of RtsOptsSafeOnly -> False _ -> True -- | Find out path to @ghcversion.h@ file
249
false
true
0
8
119
51
25
26
null
null
CulpaBS/wbBach
src/Futhark/Optimise/InliningDeadFun.hs
bsd-3-clause
doInlineInCaller :: FunDef -> [FunDef] -> FunDef doInlineInCaller (FunDef entry name rtp args body) inlcallees = let body' = inlineInBody inlcallees body in FunDef entry name rtp args body'
194
doInlineInCaller :: FunDef -> [FunDef] -> FunDef doInlineInCaller (FunDef entry name rtp args body) inlcallees = let body' = inlineInBody inlcallees body in FunDef entry name rtp args body'
194
doInlineInCaller (FunDef entry name rtp args body) inlcallees = let body' = inlineInBody inlcallees body in FunDef entry name rtp args body'
144
false
true
0
9
33
69
33
36
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/SVGMatrix.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGMatrix.flipX Mozilla SVGMatrix.flipX documentation> flipX :: (MonadDOM m) => SVGMatrix -> m SVGMatrix flipX self = liftDOM ((self ^. jsf "flipX" ()) >>= fromJSValUnchecked)
233
flipX :: (MonadDOM m) => SVGMatrix -> m SVGMatrix flipX self = liftDOM ((self ^. jsf "flipX" ()) >>= fromJSValUnchecked)
122
flipX self = liftDOM ((self ^. jsf "flipX" ()) >>= fromJSValUnchecked)
72
true
true
0
11
28
60
29
31
null
null
nevrenato/Hets_Fork
Syntax/Parse_AS_Structured.hs
gpl-2.0
fitArgs :: LogicGraph -> AParser st ([Annoted FIT_ARG], Range) fitArgs l = do fas <- many (fitArg l) let (fas1, ps) = unzip fas return (fas1, concatMapRange id ps)
169
fitArgs :: LogicGraph -> AParser st ([Annoted FIT_ARG], Range) fitArgs l = do fas <- many (fitArg l) let (fas1, ps) = unzip fas return (fas1, concatMapRange id ps)
169
fitArgs l = do fas <- many (fitArg l) let (fas1, ps) = unzip fas return (fas1, concatMapRange id ps)
106
false
true
0
10
34
87
42
45
null
null
ksaveljev/hake-2
src/Game/Monsters/MBerserk.hs
bsd-3-clause
framePainC1 :: Int framePainC1 = 199
36
framePainC1 :: Int framePainC1 = 199
36
framePainC1 = 199
17
false
true
0
4
5
11
6
5
null
null
dmitmel/goiteens-hw-in-haskell
Utils/Math/MoreMath/BigInt.hs
apache-2.0
bigIntLength :: BigInt -> Int bigIntLength (BigInt bs) = length bs
66
bigIntLength :: BigInt -> Int bigIntLength (BigInt bs) = length bs
66
bigIntLength (BigInt bs) = length bs
36
false
true
0
7
10
27
13
14
null
null
pairyo/elm-compiler
src/Parse/Helpers.hs
bsd-3-clause
escaped :: Char -> IParser String escaped delim = try $ do char '\\' c <- char '\\' <|> char delim return ['\\', c]
129
escaped :: Char -> IParser String escaped delim = try $ do char '\\' c <- char '\\' <|> char delim return ['\\', c]
129
escaped delim = try $ do char '\\' c <- char '\\' <|> char delim return ['\\', c]
95
false
true
2
10
37
66
28
38
null
null
YuichiroSato/Scheme
src/Parser/SchemeParser.hs
bsd-3-clause
createPlainAST (ValExp (DoubleVal d)) = ValAST $ DoubleAST d
60
createPlainAST (ValExp (DoubleVal d)) = ValAST $ DoubleAST d
60
createPlainAST (ValExp (DoubleVal d)) = ValAST $ DoubleAST d
60
false
false
0
9
8
28
13
15
null
null
IreneKnapp/Faction
libfaction/Distribution/Simple/Utils.hs
bsd-3-clause
-- | Writes a Unicode String as a UTF8 encoded text file. -- -- Uses 'writeFileAtomic', so provides the same guarantees. -- writeUTF8File :: FilePath -> String -> IO () writeUTF8File path = writeFileAtomic path . toUTF8
219
writeUTF8File :: FilePath -> String -> IO () writeUTF8File path = writeFileAtomic path . toUTF8
95
writeUTF8File path = writeFileAtomic path . toUTF8
50
true
true
0
8
36
38
20
18
null
null
mdsteele/fallback
src/Fallback/Scenario/Triggers/FrozenPass.hs
gpl-3.0
------------------------------------------------------------------------------- compileFrozenPass :: Globals -> CompileScenario () compileFrozenPass globals = compileArea FrozenPass Nothing $ do makeExit Holmgare ["ToHolmgare"] "FromHolmgare" onStartDaily 028371 $ do addUnlockedDoors globals uniqueDevice 981323 "Signpost" signRadius $ \_ _ -> do narrate "This signpost looks like it has seen better days, but you can\ \ still read it clearly. It says:\n\n\ \ {c}Holmgare: 2 mi. E{_}" onStartOnce 113461 $ do wait 40 narrate "Ough, ow, you're going to feel that one in the morning. Except,\ \ it looks like it already is morning. Wherever you are.\n\n\ \You look around, trying to ignore your newly acquired splitting\ \ headache. The ground is covered in snow. You appear to be in some\ \ kind of mountain pass, but looking behind you, you see that the way\ \ through the pass has been blocked by a solid wall of ice. It doesn't\ \ look natural--it must have been magically created. There is no way to\ \ go but forward.\n\n\ \Where is this? You've never been here before. This can't be your\ \ past, can it?" -- TODO add Jessica ghost wait 20 forcedConversationLoop "Jessica's ghostly form appears in front of you. \ \ \"Hello there,\" she chimes, \"and welcome back to your past! This is\ \ the pass through the Kovola mountain range that leads into Svengaard. \ \ That is where your last and greatest quest took place: to find the\ \ Sunrod, and to destroy the Great Ur-Lich Vhaegyst.\"\n\n\ \You check your persons. Three of the four Astral Weapons are still\ \ with you: the Lifeblade, the Moonbow, and the Starspear. Sure enough,\ \ the Sunrod is nowhere to be found. You've never been anywhere called\ \ \"Svengaard\" before, but it sounds vaguely like something you\ \ might've seen marked on a map once, and you've certainly heard of the\ \ Kovola mountains--they're in the northern reaches of the continent. \ \ So at least you're in a real place." [("\"How are we supposed to find the Sunrod?\"", ContinueConv "\"Figuring that out is part of the quest, silly!\" she\ \ answers. \"What do you think 'find' means? You're supposed to\ \ {i}look{_} for it.\"\n\ \\n\"I'll give you a big hint, though. Vhaegyst has it.\"\n\n\ \Great." []), ("\"Vhaegyst? We've never even heard of him.\"", ContinueConv "Jessica looks mildly uncomfortable, as though you had\ \ just made a minor faux pas. \"I...wouldn't call it a 'him,'\ \ exactly. Anyway, don't worry about having forgotten all about\ \ Vhaegyst. I'm sure you'll learn more, very soon.\"\n\n\ \Somehow, that doesn't feel very reassuring." []), ("\"And just how do you expect us to defeat some kind of super-lich? \ \ We are going to get stomped, hard.\"", ContinueConv "\"With the other three Astral weapons that you've\ \ already gathered, of course.\" she replies, like it was obvious. \ \ \"There's a reason you did this quest last, you know. It was the\ \ hardest one, and certainly the most dangerous. Vhaegyst is a\ \ serious force to be reckoned with. I mean, yikes.\"\n\ \\n\"I'll think you'll be fine, though. You're all pros by now,\ \ right?\"" []), ("\"But we never went on this quest! We've never even been here\ \ before!\"", StopConv ())] -- TODO fade away Jessica narrate "\"Nonsense!\" she cheerfully declares. \"You came straight to\ \ Corenglen from here after defeating Vhaegyst. Now run along, and go\ \ do it again. I'll meet up with you after you are victorious.\" And\ \ with that, she fades away.\n\n\ \Well, this does {i}not{_} look good for the good guys. But you seem to\ \ be sealed in this region by that giant ice wall behind you, so you\ \ have little choice but to press on forward. Maybe, just maybe, you\ \ really can defeat this Vhaegyst lich, and maybe then you'll get some\ \ answers." simpleEnemy_ 398273 "WolfA1" Wolf ChaseAI simpleEnemy_ 142118 "WolfA2" Wolf ChaseAI simpleEnemy_ 293554 "WolfA3" Wolf ChaseAI simpleEnemy_ 828135 "WolfA4" Wolf MindlessAI once 830701 (walkIn "NearZombies") $ do narrate "{b}The undead!{_}\n\n\ \Well, you're apparently on a quest to defeat an evil lich, so you\ \ probably shouldn't be surprised to run into a group of zombies\ \ shambling around. Get used to it--there's likely to be more in the\ \ near future.\n\n\ \Zombies are pretty stupid, but they're dangerous. All undead are. \ \ They don't feel fear, they don't feel pain, and they {i}always{_} feel\ \ hunger for mortal flesh. Even a smallish pack of zombies would be\ \ perilous foes for warriors as inexperienced as yourselves, but with\ \ three out of the four Astral Weapons still in your hands, you should\ \ be able to get through this." simpleEnemy_ 547952 "ZomB1" Zombie MindlessAI simpleEnemy_ 453147 "ZomB2" Zombie MindlessAI simpleEnemy_ 448374 "ZomB3" Zombie MindlessAI simpleEnemy_ 475373 "ZomB4" Zombie MindlessAI simpleEnemy_ 972911 "ZomC1" Zombie MindlessAI simpleEnemy_ 080213 "ZomC2" Zombie MindlessAI simpleEnemy_ 420917 "ZomC3" Zombie MindlessAI once 385861 (walkIn "NearShack") $ do narrate "This old, cracked building looks like it has seen better days. \ \ Well, assuming this area has {i}ever{_} had better days; so far this\ \ place is depressing and cold and not somewhere you'd ever much want to\ \ go on vacation. But the flat roof seems to be sagging under the\ \ weight of the snow piled up, and the look of the walls doesn't give\ \ you a lot of confidence. If you're planning to step inside, you think\ \ you might not want to linger very long." simpleEnemy_ 233177 "SkelD1" Skeleton MindlessAI simpleEnemy_ 571346 "SkelD2" Skeleton MindlessAI simpleEnemy_ 035978 "SkelD3" Skeleton MindlessAI simpleEnemy_ 697145 "GhoulD1" Ghoul MindlessAI simpleEnemy_ 296464 "GhoulD2" Ghoul MindlessAI simpleEnemy_ 080509 "WraithD" Wraith MindlessAI uniqueDevice 044279 "TornBook" 1 $ \_ _ -> do narrate "Aha! This book probably holds all sorts of interesting\ \ information, clues about what's going on around here, and powerful\ \ magical arcana that will be a great boon to you in your\ \ adventures.\n\n\ \At least, it probably {i}did{_}. But it looks like the ghouls in here\ \ went and chewed it to pieces long before you arrived. Not a single\ \ legible page remains." once 232166 (walkOn "SecretDoor") $ do narrate "Now that's interesting...what first looked like another crack in\ \ the wall turns out to be a secret panel leading to a narrow passage\ \ behind the building. Why would someone hide a secret passage behind a\ \ building that's probably going to fall over any day now?" once 434118 (walkIn "ColdPassage") $ do narrate "Brrrrr...it is {i}freezing{_} back here. Evidentally not a\ \ lot of sunlight makes it down into this tiny opening.\n\n\ \You take a moment to examine the walls of the passage. Now that you\ \ look more closely, the rock walls don't look natural, which means\ \ that someone must have dug it out on purpose. But they don't really\ \ look like they were dug out with tools, or animal claws, or anything\ \ else you can think of either. Which means...magic? Pretty powerful\ \ magic, if whoever it was was boring through solid rock.\n\n\ \Odd. Powerful magic tends to be in short supply, and is not usually\ \ wasted on digging pointless tunnels." ironDoorAttempted <- newPersistentVar 126701 False ironDoorUnlocked <- newPersistentVar 477117 False let tryOpenIronDoor _ _ = do unlocked <- readVar ironDoorUnlocked if unlocked then return True else do firstAttempt <- not <$> readVar ironDoorAttempted writeVar ironDoorAttempted True hasKey <- doesPartyHaveItem (InertItemTag IronKey) if firstAttempt || hasKey then do narrate ((if firstAttempt then "There's a heavy wrought iron door\ \ mounted in a wall at the end of the tunnel here. What with the\ \ winter weather here, the metal is very cold to the touch; you\ \ find you have to cover your hands before gripping the door\ \ handle. Carefully, you pull on the handle, but the door is\ \ locked.\n\n" else "") ++ (if hasKey then "The metal of the door looks very similar to the\ \ metal of the iron key that you won from that Dactylid demon. \ \ You try the key in the keyhole, and it fits. You have to\ \ struggle a bit to move the frozen lock, but with a creaking\ \ noise the latch finally gives way, and the door swings open." else "Lacking any key to open it, you examine the door more\ \ carefully, trying to get any clue of what might lie behind\ \ it, or who made this passage and put a door there. You find\ \ nothing that provides any answers.")) else do setMessage "The iron door is still locked. You still don't have the\ \ key." if not hasKey then return False else do playDoorUnlockSound writeVar ironDoorUnlocked True return True ironDoorDevice <- newDoorDevice 202933 tryOpenIronDoor (const $ const $ return True) onStartDaily 093423 $ do addDevice_ ironDoorDevice =<< demandOneTerrainMark "IronDoor" once 328351 (walkOn "IronDoor") $ do narrate "A huge, solid crystal of ice dominates the center of this tiny\ \ room. You can almost feel it sucking the heat out of your bodies,\ \ even from here. It is almost certainly magical, whatever it's for." uniqueDevice 623179 "IceCrystal" 1 $ \_ charNum -> do mbTouch <- forcedChoice "The faces of the giant ice crystal are almost\ \ flawless. From up close, you can definitely feel the aura of magic\ \ around this thing; if nothing else, it's somehow making the room a\ \ whole lot colder than it would be naturally. It sure isn't just for\ \ decoration, or it wouldn't be stowed away back here, behind a door\ \ locked by a key that was held by an infernal daemon. Logically, this\ \ block of ice must {i}do{_} something. And you can't help feeling that\ \ it's probably something bad.\n\n\ \Okay. So that means you're standing in front of an evil magical ice\ \ crystal. What's the next step?" [("Touch it.", Just True), ("Smash it.", Just False), ("Leave it alone.", Nothing)] case mbTouch of Just True -> do narrate "You reach out a hand hesitantly, and then, slowly, place your\ \ fingertips on the ice. It is colder than you thought possible. \ \ For a fraction of a moment, nothing happens. And then..." wait 6 pos <- areaGet (arsCharacterPosition charNum) playSound SndFreeze addBoomDoodadAtPosition IceBoom 1 pos dealDamage [(HitCharacter charNum, ColdDamage, 150)] wait 10 narrate "Augh, bloody hell, that hurt! Okay, new rule: touching an\ \ evil magical ice crystal is a Bad Plan." Just False -> narrate "Have you ever tried to shatter a giant, solid\ \ block of ice? Even normal ice? It doesn't work very well; ice is\ \ actually pretty strong. Your weapon just bounces off, doing hardly\ \ any damage at all beyond loosing a few chips of frost." Nothing -> return () uniqueDevice 477627 "Runes" signRadius $ \_ _ -> do narrate "There is some kind of inscription on the wall. Peering closely\ \ at it, it appears to be written in a language you can't understand,\ \ using symbols you don't even recognize. A foreign tongue? Magical\ \ runes? Meaningless shapes? You can't tell for sure." -------------------------------------------------------------------------------
12,430
compileFrozenPass :: Globals -> CompileScenario () compileFrozenPass globals = compileArea FrozenPass Nothing $ do makeExit Holmgare ["ToHolmgare"] "FromHolmgare" onStartDaily 028371 $ do addUnlockedDoors globals uniqueDevice 981323 "Signpost" signRadius $ \_ _ -> do narrate "This signpost looks like it has seen better days, but you can\ \ still read it clearly. It says:\n\n\ \ {c}Holmgare: 2 mi. E{_}" onStartOnce 113461 $ do wait 40 narrate "Ough, ow, you're going to feel that one in the morning. Except,\ \ it looks like it already is morning. Wherever you are.\n\n\ \You look around, trying to ignore your newly acquired splitting\ \ headache. The ground is covered in snow. You appear to be in some\ \ kind of mountain pass, but looking behind you, you see that the way\ \ through the pass has been blocked by a solid wall of ice. It doesn't\ \ look natural--it must have been magically created. There is no way to\ \ go but forward.\n\n\ \Where is this? You've never been here before. This can't be your\ \ past, can it?" -- TODO add Jessica ghost wait 20 forcedConversationLoop "Jessica's ghostly form appears in front of you. \ \ \"Hello there,\" she chimes, \"and welcome back to your past! This is\ \ the pass through the Kovola mountain range that leads into Svengaard. \ \ That is where your last and greatest quest took place: to find the\ \ Sunrod, and to destroy the Great Ur-Lich Vhaegyst.\"\n\n\ \You check your persons. Three of the four Astral Weapons are still\ \ with you: the Lifeblade, the Moonbow, and the Starspear. Sure enough,\ \ the Sunrod is nowhere to be found. You've never been anywhere called\ \ \"Svengaard\" before, but it sounds vaguely like something you\ \ might've seen marked on a map once, and you've certainly heard of the\ \ Kovola mountains--they're in the northern reaches of the continent. \ \ So at least you're in a real place." [("\"How are we supposed to find the Sunrod?\"", ContinueConv "\"Figuring that out is part of the quest, silly!\" she\ \ answers. \"What do you think 'find' means? You're supposed to\ \ {i}look{_} for it.\"\n\ \\n\"I'll give you a big hint, though. Vhaegyst has it.\"\n\n\ \Great." []), ("\"Vhaegyst? We've never even heard of him.\"", ContinueConv "Jessica looks mildly uncomfortable, as though you had\ \ just made a minor faux pas. \"I...wouldn't call it a 'him,'\ \ exactly. Anyway, don't worry about having forgotten all about\ \ Vhaegyst. I'm sure you'll learn more, very soon.\"\n\n\ \Somehow, that doesn't feel very reassuring." []), ("\"And just how do you expect us to defeat some kind of super-lich? \ \ We are going to get stomped, hard.\"", ContinueConv "\"With the other three Astral weapons that you've\ \ already gathered, of course.\" she replies, like it was obvious. \ \ \"There's a reason you did this quest last, you know. It was the\ \ hardest one, and certainly the most dangerous. Vhaegyst is a\ \ serious force to be reckoned with. I mean, yikes.\"\n\ \\n\"I'll think you'll be fine, though. You're all pros by now,\ \ right?\"" []), ("\"But we never went on this quest! We've never even been here\ \ before!\"", StopConv ())] -- TODO fade away Jessica narrate "\"Nonsense!\" she cheerfully declares. \"You came straight to\ \ Corenglen from here after defeating Vhaegyst. Now run along, and go\ \ do it again. I'll meet up with you after you are victorious.\" And\ \ with that, she fades away.\n\n\ \Well, this does {i}not{_} look good for the good guys. But you seem to\ \ be sealed in this region by that giant ice wall behind you, so you\ \ have little choice but to press on forward. Maybe, just maybe, you\ \ really can defeat this Vhaegyst lich, and maybe then you'll get some\ \ answers." simpleEnemy_ 398273 "WolfA1" Wolf ChaseAI simpleEnemy_ 142118 "WolfA2" Wolf ChaseAI simpleEnemy_ 293554 "WolfA3" Wolf ChaseAI simpleEnemy_ 828135 "WolfA4" Wolf MindlessAI once 830701 (walkIn "NearZombies") $ do narrate "{b}The undead!{_}\n\n\ \Well, you're apparently on a quest to defeat an evil lich, so you\ \ probably shouldn't be surprised to run into a group of zombies\ \ shambling around. Get used to it--there's likely to be more in the\ \ near future.\n\n\ \Zombies are pretty stupid, but they're dangerous. All undead are. \ \ They don't feel fear, they don't feel pain, and they {i}always{_} feel\ \ hunger for mortal flesh. Even a smallish pack of zombies would be\ \ perilous foes for warriors as inexperienced as yourselves, but with\ \ three out of the four Astral Weapons still in your hands, you should\ \ be able to get through this." simpleEnemy_ 547952 "ZomB1" Zombie MindlessAI simpleEnemy_ 453147 "ZomB2" Zombie MindlessAI simpleEnemy_ 448374 "ZomB3" Zombie MindlessAI simpleEnemy_ 475373 "ZomB4" Zombie MindlessAI simpleEnemy_ 972911 "ZomC1" Zombie MindlessAI simpleEnemy_ 080213 "ZomC2" Zombie MindlessAI simpleEnemy_ 420917 "ZomC3" Zombie MindlessAI once 385861 (walkIn "NearShack") $ do narrate "This old, cracked building looks like it has seen better days. \ \ Well, assuming this area has {i}ever{_} had better days; so far this\ \ place is depressing and cold and not somewhere you'd ever much want to\ \ go on vacation. But the flat roof seems to be sagging under the\ \ weight of the snow piled up, and the look of the walls doesn't give\ \ you a lot of confidence. If you're planning to step inside, you think\ \ you might not want to linger very long." simpleEnemy_ 233177 "SkelD1" Skeleton MindlessAI simpleEnemy_ 571346 "SkelD2" Skeleton MindlessAI simpleEnemy_ 035978 "SkelD3" Skeleton MindlessAI simpleEnemy_ 697145 "GhoulD1" Ghoul MindlessAI simpleEnemy_ 296464 "GhoulD2" Ghoul MindlessAI simpleEnemy_ 080509 "WraithD" Wraith MindlessAI uniqueDevice 044279 "TornBook" 1 $ \_ _ -> do narrate "Aha! This book probably holds all sorts of interesting\ \ information, clues about what's going on around here, and powerful\ \ magical arcana that will be a great boon to you in your\ \ adventures.\n\n\ \At least, it probably {i}did{_}. But it looks like the ghouls in here\ \ went and chewed it to pieces long before you arrived. Not a single\ \ legible page remains." once 232166 (walkOn "SecretDoor") $ do narrate "Now that's interesting...what first looked like another crack in\ \ the wall turns out to be a secret panel leading to a narrow passage\ \ behind the building. Why would someone hide a secret passage behind a\ \ building that's probably going to fall over any day now?" once 434118 (walkIn "ColdPassage") $ do narrate "Brrrrr...it is {i}freezing{_} back here. Evidentally not a\ \ lot of sunlight makes it down into this tiny opening.\n\n\ \You take a moment to examine the walls of the passage. Now that you\ \ look more closely, the rock walls don't look natural, which means\ \ that someone must have dug it out on purpose. But they don't really\ \ look like they were dug out with tools, or animal claws, or anything\ \ else you can think of either. Which means...magic? Pretty powerful\ \ magic, if whoever it was was boring through solid rock.\n\n\ \Odd. Powerful magic tends to be in short supply, and is not usually\ \ wasted on digging pointless tunnels." ironDoorAttempted <- newPersistentVar 126701 False ironDoorUnlocked <- newPersistentVar 477117 False let tryOpenIronDoor _ _ = do unlocked <- readVar ironDoorUnlocked if unlocked then return True else do firstAttempt <- not <$> readVar ironDoorAttempted writeVar ironDoorAttempted True hasKey <- doesPartyHaveItem (InertItemTag IronKey) if firstAttempt || hasKey then do narrate ((if firstAttempt then "There's a heavy wrought iron door\ \ mounted in a wall at the end of the tunnel here. What with the\ \ winter weather here, the metal is very cold to the touch; you\ \ find you have to cover your hands before gripping the door\ \ handle. Carefully, you pull on the handle, but the door is\ \ locked.\n\n" else "") ++ (if hasKey then "The metal of the door looks very similar to the\ \ metal of the iron key that you won from that Dactylid demon. \ \ You try the key in the keyhole, and it fits. You have to\ \ struggle a bit to move the frozen lock, but with a creaking\ \ noise the latch finally gives way, and the door swings open." else "Lacking any key to open it, you examine the door more\ \ carefully, trying to get any clue of what might lie behind\ \ it, or who made this passage and put a door there. You find\ \ nothing that provides any answers.")) else do setMessage "The iron door is still locked. You still don't have the\ \ key." if not hasKey then return False else do playDoorUnlockSound writeVar ironDoorUnlocked True return True ironDoorDevice <- newDoorDevice 202933 tryOpenIronDoor (const $ const $ return True) onStartDaily 093423 $ do addDevice_ ironDoorDevice =<< demandOneTerrainMark "IronDoor" once 328351 (walkOn "IronDoor") $ do narrate "A huge, solid crystal of ice dominates the center of this tiny\ \ room. You can almost feel it sucking the heat out of your bodies,\ \ even from here. It is almost certainly magical, whatever it's for." uniqueDevice 623179 "IceCrystal" 1 $ \_ charNum -> do mbTouch <- forcedChoice "The faces of the giant ice crystal are almost\ \ flawless. From up close, you can definitely feel the aura of magic\ \ around this thing; if nothing else, it's somehow making the room a\ \ whole lot colder than it would be naturally. It sure isn't just for\ \ decoration, or it wouldn't be stowed away back here, behind a door\ \ locked by a key that was held by an infernal daemon. Logically, this\ \ block of ice must {i}do{_} something. And you can't help feeling that\ \ it's probably something bad.\n\n\ \Okay. So that means you're standing in front of an evil magical ice\ \ crystal. What's the next step?" [("Touch it.", Just True), ("Smash it.", Just False), ("Leave it alone.", Nothing)] case mbTouch of Just True -> do narrate "You reach out a hand hesitantly, and then, slowly, place your\ \ fingertips on the ice. It is colder than you thought possible. \ \ For a fraction of a moment, nothing happens. And then..." wait 6 pos <- areaGet (arsCharacterPosition charNum) playSound SndFreeze addBoomDoodadAtPosition IceBoom 1 pos dealDamage [(HitCharacter charNum, ColdDamage, 150)] wait 10 narrate "Augh, bloody hell, that hurt! Okay, new rule: touching an\ \ evil magical ice crystal is a Bad Plan." Just False -> narrate "Have you ever tried to shatter a giant, solid\ \ block of ice? Even normal ice? It doesn't work very well; ice is\ \ actually pretty strong. Your weapon just bounces off, doing hardly\ \ any damage at all beyond loosing a few chips of frost." Nothing -> return () uniqueDevice 477627 "Runes" signRadius $ \_ _ -> do narrate "There is some kind of inscription on the wall. Peering closely\ \ at it, it appears to be written in a language you can't understand,\ \ using symbols you don't even recognize. A foreign tongue? Magical\ \ runes? Meaningless shapes? You can't tell for sure." -------------------------------------------------------------------------------
12,349
compileFrozenPass globals = compileArea FrozenPass Nothing $ do makeExit Holmgare ["ToHolmgare"] "FromHolmgare" onStartDaily 028371 $ do addUnlockedDoors globals uniqueDevice 981323 "Signpost" signRadius $ \_ _ -> do narrate "This signpost looks like it has seen better days, but you can\ \ still read it clearly. It says:\n\n\ \ {c}Holmgare: 2 mi. E{_}" onStartOnce 113461 $ do wait 40 narrate "Ough, ow, you're going to feel that one in the morning. Except,\ \ it looks like it already is morning. Wherever you are.\n\n\ \You look around, trying to ignore your newly acquired splitting\ \ headache. The ground is covered in snow. You appear to be in some\ \ kind of mountain pass, but looking behind you, you see that the way\ \ through the pass has been blocked by a solid wall of ice. It doesn't\ \ look natural--it must have been magically created. There is no way to\ \ go but forward.\n\n\ \Where is this? You've never been here before. This can't be your\ \ past, can it?" -- TODO add Jessica ghost wait 20 forcedConversationLoop "Jessica's ghostly form appears in front of you. \ \ \"Hello there,\" she chimes, \"and welcome back to your past! This is\ \ the pass through the Kovola mountain range that leads into Svengaard. \ \ That is where your last and greatest quest took place: to find the\ \ Sunrod, and to destroy the Great Ur-Lich Vhaegyst.\"\n\n\ \You check your persons. Three of the four Astral Weapons are still\ \ with you: the Lifeblade, the Moonbow, and the Starspear. Sure enough,\ \ the Sunrod is nowhere to be found. You've never been anywhere called\ \ \"Svengaard\" before, but it sounds vaguely like something you\ \ might've seen marked on a map once, and you've certainly heard of the\ \ Kovola mountains--they're in the northern reaches of the continent. \ \ So at least you're in a real place." [("\"How are we supposed to find the Sunrod?\"", ContinueConv "\"Figuring that out is part of the quest, silly!\" she\ \ answers. \"What do you think 'find' means? You're supposed to\ \ {i}look{_} for it.\"\n\ \\n\"I'll give you a big hint, though. Vhaegyst has it.\"\n\n\ \Great." []), ("\"Vhaegyst? We've never even heard of him.\"", ContinueConv "Jessica looks mildly uncomfortable, as though you had\ \ just made a minor faux pas. \"I...wouldn't call it a 'him,'\ \ exactly. Anyway, don't worry about having forgotten all about\ \ Vhaegyst. I'm sure you'll learn more, very soon.\"\n\n\ \Somehow, that doesn't feel very reassuring." []), ("\"And just how do you expect us to defeat some kind of super-lich? \ \ We are going to get stomped, hard.\"", ContinueConv "\"With the other three Astral weapons that you've\ \ already gathered, of course.\" she replies, like it was obvious. \ \ \"There's a reason you did this quest last, you know. It was the\ \ hardest one, and certainly the most dangerous. Vhaegyst is a\ \ serious force to be reckoned with. I mean, yikes.\"\n\ \\n\"I'll think you'll be fine, though. You're all pros by now,\ \ right?\"" []), ("\"But we never went on this quest! We've never even been here\ \ before!\"", StopConv ())] -- TODO fade away Jessica narrate "\"Nonsense!\" she cheerfully declares. \"You came straight to\ \ Corenglen from here after defeating Vhaegyst. Now run along, and go\ \ do it again. I'll meet up with you after you are victorious.\" And\ \ with that, she fades away.\n\n\ \Well, this does {i}not{_} look good for the good guys. But you seem to\ \ be sealed in this region by that giant ice wall behind you, so you\ \ have little choice but to press on forward. Maybe, just maybe, you\ \ really can defeat this Vhaegyst lich, and maybe then you'll get some\ \ answers." simpleEnemy_ 398273 "WolfA1" Wolf ChaseAI simpleEnemy_ 142118 "WolfA2" Wolf ChaseAI simpleEnemy_ 293554 "WolfA3" Wolf ChaseAI simpleEnemy_ 828135 "WolfA4" Wolf MindlessAI once 830701 (walkIn "NearZombies") $ do narrate "{b}The undead!{_}\n\n\ \Well, you're apparently on a quest to defeat an evil lich, so you\ \ probably shouldn't be surprised to run into a group of zombies\ \ shambling around. Get used to it--there's likely to be more in the\ \ near future.\n\n\ \Zombies are pretty stupid, but they're dangerous. All undead are. \ \ They don't feel fear, they don't feel pain, and they {i}always{_} feel\ \ hunger for mortal flesh. Even a smallish pack of zombies would be\ \ perilous foes for warriors as inexperienced as yourselves, but with\ \ three out of the four Astral Weapons still in your hands, you should\ \ be able to get through this." simpleEnemy_ 547952 "ZomB1" Zombie MindlessAI simpleEnemy_ 453147 "ZomB2" Zombie MindlessAI simpleEnemy_ 448374 "ZomB3" Zombie MindlessAI simpleEnemy_ 475373 "ZomB4" Zombie MindlessAI simpleEnemy_ 972911 "ZomC1" Zombie MindlessAI simpleEnemy_ 080213 "ZomC2" Zombie MindlessAI simpleEnemy_ 420917 "ZomC3" Zombie MindlessAI once 385861 (walkIn "NearShack") $ do narrate "This old, cracked building looks like it has seen better days. \ \ Well, assuming this area has {i}ever{_} had better days; so far this\ \ place is depressing and cold and not somewhere you'd ever much want to\ \ go on vacation. But the flat roof seems to be sagging under the\ \ weight of the snow piled up, and the look of the walls doesn't give\ \ you a lot of confidence. If you're planning to step inside, you think\ \ you might not want to linger very long." simpleEnemy_ 233177 "SkelD1" Skeleton MindlessAI simpleEnemy_ 571346 "SkelD2" Skeleton MindlessAI simpleEnemy_ 035978 "SkelD3" Skeleton MindlessAI simpleEnemy_ 697145 "GhoulD1" Ghoul MindlessAI simpleEnemy_ 296464 "GhoulD2" Ghoul MindlessAI simpleEnemy_ 080509 "WraithD" Wraith MindlessAI uniqueDevice 044279 "TornBook" 1 $ \_ _ -> do narrate "Aha! This book probably holds all sorts of interesting\ \ information, clues about what's going on around here, and powerful\ \ magical arcana that will be a great boon to you in your\ \ adventures.\n\n\ \At least, it probably {i}did{_}. But it looks like the ghouls in here\ \ went and chewed it to pieces long before you arrived. Not a single\ \ legible page remains." once 232166 (walkOn "SecretDoor") $ do narrate "Now that's interesting...what first looked like another crack in\ \ the wall turns out to be a secret panel leading to a narrow passage\ \ behind the building. Why would someone hide a secret passage behind a\ \ building that's probably going to fall over any day now?" once 434118 (walkIn "ColdPassage") $ do narrate "Brrrrr...it is {i}freezing{_} back here. Evidentally not a\ \ lot of sunlight makes it down into this tiny opening.\n\n\ \You take a moment to examine the walls of the passage. Now that you\ \ look more closely, the rock walls don't look natural, which means\ \ that someone must have dug it out on purpose. But they don't really\ \ look like they were dug out with tools, or animal claws, or anything\ \ else you can think of either. Which means...magic? Pretty powerful\ \ magic, if whoever it was was boring through solid rock.\n\n\ \Odd. Powerful magic tends to be in short supply, and is not usually\ \ wasted on digging pointless tunnels." ironDoorAttempted <- newPersistentVar 126701 False ironDoorUnlocked <- newPersistentVar 477117 False let tryOpenIronDoor _ _ = do unlocked <- readVar ironDoorUnlocked if unlocked then return True else do firstAttempt <- not <$> readVar ironDoorAttempted writeVar ironDoorAttempted True hasKey <- doesPartyHaveItem (InertItemTag IronKey) if firstAttempt || hasKey then do narrate ((if firstAttempt then "There's a heavy wrought iron door\ \ mounted in a wall at the end of the tunnel here. What with the\ \ winter weather here, the metal is very cold to the touch; you\ \ find you have to cover your hands before gripping the door\ \ handle. Carefully, you pull on the handle, but the door is\ \ locked.\n\n" else "") ++ (if hasKey then "The metal of the door looks very similar to the\ \ metal of the iron key that you won from that Dactylid demon. \ \ You try the key in the keyhole, and it fits. You have to\ \ struggle a bit to move the frozen lock, but with a creaking\ \ noise the latch finally gives way, and the door swings open." else "Lacking any key to open it, you examine the door more\ \ carefully, trying to get any clue of what might lie behind\ \ it, or who made this passage and put a door there. You find\ \ nothing that provides any answers.")) else do setMessage "The iron door is still locked. You still don't have the\ \ key." if not hasKey then return False else do playDoorUnlockSound writeVar ironDoorUnlocked True return True ironDoorDevice <- newDoorDevice 202933 tryOpenIronDoor (const $ const $ return True) onStartDaily 093423 $ do addDevice_ ironDoorDevice =<< demandOneTerrainMark "IronDoor" once 328351 (walkOn "IronDoor") $ do narrate "A huge, solid crystal of ice dominates the center of this tiny\ \ room. You can almost feel it sucking the heat out of your bodies,\ \ even from here. It is almost certainly magical, whatever it's for." uniqueDevice 623179 "IceCrystal" 1 $ \_ charNum -> do mbTouch <- forcedChoice "The faces of the giant ice crystal are almost\ \ flawless. From up close, you can definitely feel the aura of magic\ \ around this thing; if nothing else, it's somehow making the room a\ \ whole lot colder than it would be naturally. It sure isn't just for\ \ decoration, or it wouldn't be stowed away back here, behind a door\ \ locked by a key that was held by an infernal daemon. Logically, this\ \ block of ice must {i}do{_} something. And you can't help feeling that\ \ it's probably something bad.\n\n\ \Okay. So that means you're standing in front of an evil magical ice\ \ crystal. What's the next step?" [("Touch it.", Just True), ("Smash it.", Just False), ("Leave it alone.", Nothing)] case mbTouch of Just True -> do narrate "You reach out a hand hesitantly, and then, slowly, place your\ \ fingertips on the ice. It is colder than you thought possible. \ \ For a fraction of a moment, nothing happens. And then..." wait 6 pos <- areaGet (arsCharacterPosition charNum) playSound SndFreeze addBoomDoodadAtPosition IceBoom 1 pos dealDamage [(HitCharacter charNum, ColdDamage, 150)] wait 10 narrate "Augh, bloody hell, that hurt! Okay, new rule: touching an\ \ evil magical ice crystal is a Bad Plan." Just False -> narrate "Have you ever tried to shatter a giant, solid\ \ block of ice? Even normal ice? It doesn't work very well; ice is\ \ actually pretty strong. Your weapon just bounces off, doing hardly\ \ any damage at all beyond loosing a few chips of frost." Nothing -> return () uniqueDevice 477627 "Runes" signRadius $ \_ _ -> do narrate "There is some kind of inscription on the wall. Peering closely\ \ at it, it appears to be written in a language you can't understand,\ \ using symbols you don't even recognize. A foreign tongue? Magical\ \ runes? Meaningless shapes? You can't tell for sure." -------------------------------------------------------------------------------
12,298
true
true
0
23
3,217
1,001
446
555
null
null
haskell-distributed/distributed-process-platform
src/Control/Distributed/Process/Platform/Execution/Mailbox.hs
bsd-3-clause
-- | A /do-nothing/ filter that accepts all messages (i.e., returns @Keep@ -- for any input). acceptEverything :: Closure (Message -> Process FilterResult) acceptEverything = $(mkStaticClosure 'everything)
205
acceptEverything :: Closure (Message -> Process FilterResult) acceptEverything = $(mkStaticClosure 'everything)
111
acceptEverything = $(mkStaticClosure 'everything)
49
true
true
0
8
26
34
18
16
null
null
michael-j-clark/hjs99
src/46to50/BinPred.hs
bsd-3-clause
nor :: BinPredSig nor False False = True
40
nor :: BinPredSig nor False False = True
40
nor False False = True
22
false
true
0
6
7
22
9
13
null
null
nevrenato/HetsAlloy
Maude/Maude2DG.hs
gpl-2.0
-- | extracts the types of the terms while they are variables getTypes :: [Term] -> Symbols getTypes (Var _ (TypeSort s) : ts) = Sort (HasName.getName s) : getTypes ts
167
getTypes :: [Term] -> Symbols getTypes (Var _ (TypeSort s) : ts) = Sort (HasName.getName s) : getTypes ts
105
getTypes (Var _ (TypeSort s) : ts) = Sort (HasName.getName s) : getTypes ts
75
true
true
0
12
30
63
30
33
null
null
samscott89/tamarin-prover
lib/term/src/Term/LTerm.hs
gpl-3.0
-- | @s `renameAvoiding` t@ replaces all free variables in @s@ by -- fresh variables avoiding variables in @t@. renameAvoidingIgnoring :: (HasFrees s, HasFrees t) => s -> t -> [LVar] -> s renameAvoidingIgnoring s t vars = renameIgnoring vars s `evalFreshAvoiding` t
267
renameAvoidingIgnoring :: (HasFrees s, HasFrees t) => s -> t -> [LVar] -> s renameAvoidingIgnoring s t vars = renameIgnoring vars s `evalFreshAvoiding` t
153
renameAvoidingIgnoring s t vars = renameIgnoring vars s `evalFreshAvoiding` t
77
true
true
0
9
44
61
33
28
null
null
bacchanalia/KitchenSink
KitchenSink/Qualified.hs
gpl-3.0
-- |'IntMapS.unionsWith' ims_unionsWith = IntMapS.unionsWith
60
ims_unionsWith = IntMapS.unionsWith
35
ims_unionsWith = IntMapS.unionsWith
35
true
false
0
5
4
9
5
4
null
null
Operational-Transformation/ot.hs
src/Control/OperationalTransformation/Properties.hs
mit
-- | @b' ∘ a = a' ∘ b@ where /a/ and /b/ are random operations and -- @(a', b') = transform(a, b)@. Note that this is a stronger property than -- 'prop_transform_apply_comm', because 'prop_transform_comm' and -- 'prop_apply_functorial' imply 'prop_transform_apply_comm'. prop_transform_comm :: TestableOTSystem doc op => ConcurrentDocHistories doc op One One -> Result prop_transform_comm (CDH (SS _ a _) (SS _ b _)) = eitherResult (transform a b) $ \(a', b') -> eitherResult (compose a b') $ \ab' -> eitherResult (compose b a') $ \ba' -> ab' ==? ba'
564
prop_transform_comm :: TestableOTSystem doc op => ConcurrentDocHistories doc op One One -> Result prop_transform_comm (CDH (SS _ a _) (SS _ b _)) = eitherResult (transform a b) $ \(a', b') -> eitherResult (compose a b') $ \ab' -> eitherResult (compose b a') $ \ba' -> ab' ==? ba'
293
prop_transform_comm (CDH (SS _ a _) (SS _ b _)) = eitherResult (transform a b) $ \(a', b') -> eitherResult (compose a b') $ \ab' -> eitherResult (compose b a') $ \ba' -> ab' ==? ba'
189
true
true
1
12
102
147
73
74
null
null
qmenoret/gitlab-report-generator
src/json-parser/User.hs
bsd-3-clause
getColumnValue :: String -> User -> String getColumnValue "name" = User.name
83
getColumnValue :: String -> User -> String getColumnValue "name" = User.name
83
getColumnValue "name" = User.name
40
false
true
0
6
17
24
12
12
null
null
andorp/grin
grin/src/Test/Test.hs
bsd-3-clause
select xs = do n <- gen $ choose (0, length xs - 1) case (splitAt n xs) of ([] , []) -> mzero ((a:as), []) -> pure (a, as) ([] , (b:bs)) -> pure (b, bs) (as , (b:bs)) -> pure (b, as ++ bs)
226
select xs = do n <- gen $ choose (0, length xs - 1) case (splitAt n xs) of ([] , []) -> mzero ((a:as), []) -> pure (a, as) ([] , (b:bs)) -> pure (b, bs) (as , (b:bs)) -> pure (b, as ++ bs)
226
select xs = do n <- gen $ choose (0, length xs - 1) case (splitAt n xs) of ([] , []) -> mzero ((a:as), []) -> pure (a, as) ([] , (b:bs)) -> pure (b, bs) (as , (b:bs)) -> pure (b, as ++ bs)
226
false
false
0
12
83
159
85
74
null
null
ice1000/OI-codes
codewars/301-400/checking-groups.hs
agpl-3.0
begins :: Eq a => [a] -> [a] -> Maybe [a] begins haystack [] = Just haystack
91
begins :: Eq a => [a] -> [a] -> Maybe [a] begins haystack [] = Just haystack
91
begins haystack [] = Just haystack
49
false
true
0
10
31
52
25
27
null
null
dosenfrucht/tlc
src/Highlevel/Indent.hs
gpl-2.0
beforeTok :: Token -> LocSpan beforeTok t = LocSpan l l where l = start . getLoc $ t
89
beforeTok :: Token -> LocSpan beforeTok t = LocSpan l l where l = start . getLoc $ t
89
beforeTok t = LocSpan l l where l = start . getLoc $ t
59
false
true
0
8
23
38
19
19
null
null
brendanhay/gogol
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/Sizes/List.hs
mpl-2.0
-- | Select only sizes with this height. slHeight :: Lens' SizesList (Maybe Int32) slHeight = lens _slHeight (\ s a -> s{_slHeight = a}) . mapping _Coerce
162
slHeight :: Lens' SizesList (Maybe Int32) slHeight = lens _slHeight (\ s a -> s{_slHeight = a}) . mapping _Coerce
121
slHeight = lens _slHeight (\ s a -> s{_slHeight = a}) . mapping _Coerce
79
true
true
1
10
35
59
28
31
null
null
timthelion/archivemount-hs
src/System/Directory/Archivemount.hs
gpl-3.0
optToArg :: Option -> String optToArg ReadOnly = "readonly"
59
optToArg :: Option -> String optToArg ReadOnly = "readonly"
59
optToArg ReadOnly = "readonly"
30
false
true
0
5
8
18
9
9
null
null
copumpkin/charm
src/Architecture/ARM/Pretty.hs
bsd-3-clause
showInstruction (SMLAWT rd rn rm ra) = printf "SMLAWT%%s %s, %s, %s, %s" (showRegister rd) (showRegister rn) (showRegister rm) (showRegister ra)
146
showInstruction (SMLAWT rd rn rm ra) = printf "SMLAWT%%s %s, %s, %s, %s" (showRegister rd) (showRegister rn) (showRegister rm) (showRegister ra)
146
showInstruction (SMLAWT rd rn rm ra) = printf "SMLAWT%%s %s, %s, %s, %s" (showRegister rd) (showRegister rn) (showRegister rm) (showRegister ra)
146
false
false
0
7
22
56
27
29
null
null
Am3ra/CS
CS4/languages/HW10.hs
mit
getImaginary :: Complex -> Int getImaginary (Complex _ b) = b
61
getImaginary :: Complex -> Int getImaginary (Complex _ b) = b
61
getImaginary (Complex _ b) = b
30
false
true
0
7
10
26
13
13
null
null
yliu120/K3
src/Language/K3/Analysis/Provenance/Inference.hs
apache-2.0
chaseLambda env path (tnc -> (PProject _, [_,r])) = chaseLambda env path r
76
chaseLambda env path (tnc -> (PProject _, [_,r])) = chaseLambda env path r
76
chaseLambda env path (tnc -> (PProject _, [_,r])) = chaseLambda env path r
76
false
false
0
8
14
45
22
23
null
null
monky-hs/monky
Monky/Blkid.hs
lgpl-3.0
evaluateTag :: String -> String -> IO (Maybe String) evaluateTag t v = withLibBlkid $ evaluateTag' t v
102
evaluateTag :: String -> String -> IO (Maybe String) evaluateTag t v = withLibBlkid $ evaluateTag' t v
102
evaluateTag t v = withLibBlkid $ evaluateTag' t v
49
false
true
0
9
17
42
20
22
null
null
orbitgray/ProjectEuler
haskell/common/Factors.hs
lgpl-3.0
all_dividers :: Int -> [Int] -> [Int] all_dividers a (s:xs) | a == 1 = [] | res_mod == 0 = s:all_dividers res_div (s:xs) | otherwise = all_dividers a xs where (res_div, res_mod) = a `divMod` s -- Returns all deviders for a number -- It uses function above that does most of the work
299
all_dividers :: Int -> [Int] -> [Int] all_dividers a (s:xs) | a == 1 = [] | res_mod == 0 = s:all_dividers res_div (s:xs) | otherwise = all_dividers a xs where (res_div, res_mod) = a `divMod` s -- Returns all deviders for a number -- It uses function above that does most of the work
299
all_dividers a (s:xs) | a == 1 = [] | res_mod == 0 = s:all_dividers res_div (s:xs) | otherwise = all_dividers a xs where (res_div, res_mod) = a `divMod` s -- Returns all deviders for a number -- It uses function above that does most of the work
261
false
true
0
9
71
125
62
63
null
null
josiah14/hackerrank
Algorithms/GraphTheory/Matrix/Haskell/Main.hs
mit
numRoads :: CityCount Int -> Int numRoads numCities = fromCityCount numCities - 1
81
numRoads :: CityCount Int -> Int numRoads numCities = fromCityCount numCities - 1
81
numRoads numCities = fromCityCount numCities - 1
48
false
true
0
6
12
28
13
15
null
null
eklavya/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
mapPTermFC f g (PAlternative ns ty ts) = PAlternative ns ty (map (mapPTermFC f g) ts)
92
mapPTermFC f g (PAlternative ns ty ts) = PAlternative ns ty (map (mapPTermFC f g) ts)
92
mapPTermFC f g (PAlternative ns ty ts) = PAlternative ns ty (map (mapPTermFC f g) ts)
92
false
false
0
9
22
46
22
24
null
null
chip2n/tin172-project
haskell/src/Shrdlite/Planner.hs
gpl-3.0
idHeight' :: Id -> [Id] -> Maybe Int idHeight' i ws = case L.elemIndex i ws of Nothing -> Nothing Just index -> return $ (length ws - 1) - index -- | Returns an objects height in a column where 0 is the bottom.
218
idHeight' :: Id -> [Id] -> Maybe Int idHeight' i ws = case L.elemIndex i ws of Nothing -> Nothing Just index -> return $ (length ws - 1) - index -- | Returns an objects height in a column where 0 is the bottom.
218
idHeight' i ws = case L.elemIndex i ws of Nothing -> Nothing Just index -> return $ (length ws - 1) - index -- | Returns an objects height in a column where 0 is the bottom.
181
false
true
4
7
52
77
37
40
null
null
ComputationWithBoundedResources/tct-config-mischel
RC.hs
bsd-3-clause
mxCP dim deg = matrixCP' dim deg Algebraic ?ua ?ur
50
mxCP dim deg = matrixCP' dim deg Algebraic ?ua ?ur
50
mxCP dim deg = matrixCP' dim deg Algebraic ?ua ?ur
50
false
false
1
5
9
26
10
16
null
null
aisamanra/matterhorn
src/Draw/Main.hs
bsd-3-clause
doHighlightMisspellings :: HighlightSet -> S.Set Text -> [Text] -> Widget Name doHighlightMisspellings hSet misspellings contents = -- Traverse the input, gathering non-whitespace into tokens and -- checking if they appear in the misspelling collection let whitelist = S.union (hUserSet hSet) (hChannelSet hSet) handleLine t | t == "" = txt " " handleLine t = -- For annotated tokens, coallesce tokens of the same type -- and add attributes for misspellings. let mkW (Left tok) = let s = getTokenText tok in if T.null s then emptyWidget else withDefAttr misspellingAttr $ txt $ getTokenText tok mkW (Right tok) = let s = getTokenText tok in if T.null s then emptyWidget else txt s go :: Either Token Token -> [Either Token Token] -> [Either Token Token] go lst [] = [lst] go lst (tok:toks) = case (lst, tok) of (Left a, Left b) -> go (Left $ combineTokens a b) toks (Right a, Right b) -> go (Right $ combineTokens a b) toks _ -> lst : go tok toks in hBox $ mkW <$> (go (Right $ Ignore "") $ annotatedTokens t) combineTokens (Ignore a) (Ignore b) = Ignore $ a <> b combineTokens (Check a) (Check b) = Check $ a <> b combineTokens (Ignore a) (Check b) = Check $ a <> b combineTokens (Check a) (Ignore b) = Check $ a <> b getTokenText (Ignore a) = a getTokenText (Check a) = a annotatedTokens t = -- For every token, check on whether it is a misspelling. -- The result is Either Token Token where the Left is a -- misspelling and the Right is not. checkMisspelling <$> tokenize t (Ignore "") checkMisspelling t@(Ignore _) = Right t checkMisspelling t@(Check s) = if s `S.member` whitelist then Right t else if s `S.member` misspellings then Left t else Right t ignoreChar c = isSpace c || isPunctuation c || c == '`' tokenize t curTok | T.null t = [curTok] | ignoreChar $ T.head t = case curTok of Ignore s -> tokenize (T.tail t) (Ignore $ s <> (T.singleton $ T.head t)) Check s -> Check s : tokenize (T.tail t) (Ignore $ T.singleton $ T.head t) | otherwise = case curTok of Ignore s -> Ignore s : tokenize (T.tail t) (Check $ T.singleton $ T.head t) Check s -> tokenize (T.tail t) (Check $ s <> (T.singleton $ T.head t)) in vBox $ handleLine <$> contents
2,943
doHighlightMisspellings :: HighlightSet -> S.Set Text -> [Text] -> Widget Name doHighlightMisspellings hSet misspellings contents = -- Traverse the input, gathering non-whitespace into tokens and -- checking if they appear in the misspelling collection let whitelist = S.union (hUserSet hSet) (hChannelSet hSet) handleLine t | t == "" = txt " " handleLine t = -- For annotated tokens, coallesce tokens of the same type -- and add attributes for misspellings. let mkW (Left tok) = let s = getTokenText tok in if T.null s then emptyWidget else withDefAttr misspellingAttr $ txt $ getTokenText tok mkW (Right tok) = let s = getTokenText tok in if T.null s then emptyWidget else txt s go :: Either Token Token -> [Either Token Token] -> [Either Token Token] go lst [] = [lst] go lst (tok:toks) = case (lst, tok) of (Left a, Left b) -> go (Left $ combineTokens a b) toks (Right a, Right b) -> go (Right $ combineTokens a b) toks _ -> lst : go tok toks in hBox $ mkW <$> (go (Right $ Ignore "") $ annotatedTokens t) combineTokens (Ignore a) (Ignore b) = Ignore $ a <> b combineTokens (Check a) (Check b) = Check $ a <> b combineTokens (Ignore a) (Check b) = Check $ a <> b combineTokens (Check a) (Ignore b) = Check $ a <> b getTokenText (Ignore a) = a getTokenText (Check a) = a annotatedTokens t = -- For every token, check on whether it is a misspelling. -- The result is Either Token Token where the Left is a -- misspelling and the Right is not. checkMisspelling <$> tokenize t (Ignore "") checkMisspelling t@(Ignore _) = Right t checkMisspelling t@(Check s) = if s `S.member` whitelist then Right t else if s `S.member` misspellings then Left t else Right t ignoreChar c = isSpace c || isPunctuation c || c == '`' tokenize t curTok | T.null t = [curTok] | ignoreChar $ T.head t = case curTok of Ignore s -> tokenize (T.tail t) (Ignore $ s <> (T.singleton $ T.head t)) Check s -> Check s : tokenize (T.tail t) (Ignore $ T.singleton $ T.head t) | otherwise = case curTok of Ignore s -> Ignore s : tokenize (T.tail t) (Check $ T.singleton $ T.head t) Check s -> tokenize (T.tail t) (Check $ s <> (T.singleton $ T.head t)) in vBox $ handleLine <$> contents
2,943
doHighlightMisspellings hSet misspellings contents = -- Traverse the input, gathering non-whitespace into tokens and -- checking if they appear in the misspelling collection let whitelist = S.union (hUserSet hSet) (hChannelSet hSet) handleLine t | t == "" = txt " " handleLine t = -- For annotated tokens, coallesce tokens of the same type -- and add attributes for misspellings. let mkW (Left tok) = let s = getTokenText tok in if T.null s then emptyWidget else withDefAttr misspellingAttr $ txt $ getTokenText tok mkW (Right tok) = let s = getTokenText tok in if T.null s then emptyWidget else txt s go :: Either Token Token -> [Either Token Token] -> [Either Token Token] go lst [] = [lst] go lst (tok:toks) = case (lst, tok) of (Left a, Left b) -> go (Left $ combineTokens a b) toks (Right a, Right b) -> go (Right $ combineTokens a b) toks _ -> lst : go tok toks in hBox $ mkW <$> (go (Right $ Ignore "") $ annotatedTokens t) combineTokens (Ignore a) (Ignore b) = Ignore $ a <> b combineTokens (Check a) (Check b) = Check $ a <> b combineTokens (Ignore a) (Check b) = Check $ a <> b combineTokens (Check a) (Ignore b) = Check $ a <> b getTokenText (Ignore a) = a getTokenText (Check a) = a annotatedTokens t = -- For every token, check on whether it is a misspelling. -- The result is Either Token Token where the Left is a -- misspelling and the Right is not. checkMisspelling <$> tokenize t (Ignore "") checkMisspelling t@(Ignore _) = Right t checkMisspelling t@(Check s) = if s `S.member` whitelist then Right t else if s `S.member` misspellings then Left t else Right t ignoreChar c = isSpace c || isPunctuation c || c == '`' tokenize t curTok | T.null t = [curTok] | ignoreChar $ T.head t = case curTok of Ignore s -> tokenize (T.tail t) (Ignore $ s <> (T.singleton $ T.head t)) Check s -> Check s : tokenize (T.tail t) (Ignore $ T.singleton $ T.head t) | otherwise = case curTok of Ignore s -> Ignore s : tokenize (T.tail t) (Check $ T.singleton $ T.head t) Check s -> tokenize (T.tail t) (Check $ s <> (T.singleton $ T.head t)) in vBox $ handleLine <$> contents
2,864
false
true
4
19
1,193
941
460
481
null
null
fmthoma/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
tcIsTyVarTy :: Type -> Bool tcIsTyVarTy ty = isJust (tcGetTyVar_maybe ty)
73
tcIsTyVarTy :: Type -> Bool tcIsTyVarTy ty = isJust (tcGetTyVar_maybe ty)
73
tcIsTyVarTy ty = isJust (tcGetTyVar_maybe ty)
45
false
true
0
7
10
33
14
19
null
null
alemedeiros/musicdb
src/MusicBrainz.hs
bsd-3-clause
searchArtist :: String -> Int -> IO [(String, String)] searchArtist art lim = do srch <- uriDownload $ uriSearchArtist art lim return $ getSearchResult srch -- |Download a given uri and return its content as a String -- TODO: return error in a better way (i.e Either or Maybe)
293
searchArtist :: String -> Int -> IO [(String, String)] searchArtist art lim = do srch <- uriDownload $ uriSearchArtist art lim return $ getSearchResult srch -- |Download a given uri and return its content as a String -- TODO: return error in a better way (i.e Either or Maybe)
293
searchArtist art lim = do srch <- uriDownload $ uriSearchArtist art lim return $ getSearchResult srch -- |Download a given uri and return its content as a String -- TODO: return error in a better way (i.e Either or Maybe)
238
false
true
0
9
65
64
32
32
null
null
frosch03/arrowVHDL
src/System/ArrowVHDL/Circuit/Show/VHDL.hs
cc0-1.0
vhdl_architecture :: CircuitDescriptor -> String vhdl_architecture g = "ARCHITECTURE " ++ (label.nodeDesc $ g) ++ "Struct OF " ++ (label.nodeDesc $ g) ++ " IS"
164
vhdl_architecture :: CircuitDescriptor -> String vhdl_architecture g = "ARCHITECTURE " ++ (label.nodeDesc $ g) ++ "Struct OF " ++ (label.nodeDesc $ g) ++ " IS"
164
vhdl_architecture g = "ARCHITECTURE " ++ (label.nodeDesc $ g) ++ "Struct OF " ++ (label.nodeDesc $ g) ++ " IS"
115
false
true
0
11
29
52
27
25
null
null
matkli/hscheme
Types.hs
gpl-3.0
showError (ParseError err) = "Parse error " ++ show err
55
showError (ParseError err) = "Parse error " ++ show err
55
showError (ParseError err) = "Parse error " ++ show err
55
false
false
0
7
9
22
10
12
null
null
antalsz/hs-to-coq
src/lib/HsToCoq/Coq/Pretty.hs
mit
-- Module-local render_args_ty :: (Functor f, Foldable f, Gallina a) => Orientation -> f a -> Term -> Doc render_args_ty o args t = group $ render_args o args <$$> render_type t
177
render_args_ty :: (Functor f, Foldable f, Gallina a) => Orientation -> f a -> Term -> Doc render_args_ty o args t = group $ render_args o args <$$> render_type t
161
render_args_ty o args t = group $ render_args o args <$$> render_type t
71
true
true
0
8
31
71
35
36
null
null
mokus0/s-expression
sexpr-compat/src/Codec/Sexpr.hs
bsd-3-clause
-- |Extract the sub-S-expressions of a List. If all you intend to do -- is traverse or map over that list, the Functor instance of -- S-expressions may work just fine. unList :: Sexpr s -> [Sexpr s] unList = fmap Sexpr . S.unList . unSexpr
240
unList :: Sexpr s -> [Sexpr s] unList = fmap Sexpr . S.unList . unSexpr
71
unList = fmap Sexpr . S.unList . unSexpr
40
true
true
1
9
46
48
22
26
null
null