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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
scolobb/fgl | Data/Graph/Inductive/Internal/Thread.hs | bsd-3-clause | splitPar :: Split t i r -> Split u j s -> Split (t,u) (i,j) (r,s)
splitPar split split' (i,j) (t,u) = ((r,s),(t',u'))
where (r,t') = split i t
(s,u') = split' j u | 240 | splitPar :: Split t i r -> Split u j s -> Split (t,u) (i,j) (r,s)
splitPar split split' (i,j) (t,u) = ((r,s),(t',u'))
where (r,t') = split i t
(s,u') = split' j u | 240 | splitPar split split' (i,j) (t,u) = ((r,s),(t',u'))
where (r,t') = split i t
(s,u') = split' j u | 174 | false | true | 0 | 9 | 111 | 137 | 75 | 62 | null | null |
sbergot/ArgParser | src/System/Console/ArgParser/Params.hs | bsd-3-clause | fullFlagformat :: FlagFormat -> String -> String
fullFlagformat fmt key = case fmt of
Short -> shortfmt ++ ", " ++ longfmt
Long -> longfmt
where
shortfmt = shortflagformat key
longfmt = longflagformat key | 220 | fullFlagformat :: FlagFormat -> String -> String
fullFlagformat fmt key = case fmt of
Short -> shortfmt ++ ", " ++ longfmt
Long -> longfmt
where
shortfmt = shortflagformat key
longfmt = longflagformat key | 219 | fullFlagformat fmt key = case fmt of
Short -> shortfmt ++ ", " ++ longfmt
Long -> longfmt
where
shortfmt = shortflagformat key
longfmt = longflagformat key | 170 | false | true | 2 | 7 | 49 | 70 | 33 | 37 | null | null |
fmapfmapfmap/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | The ID of the prefix.
pliPrefixListId :: Lens' PrefixListId (Maybe Text)
pliPrefixListId = lens _pliPrefixListId (\ s a -> s{_pliPrefixListId = a}) | 152 | pliPrefixListId :: Lens' PrefixListId (Maybe Text)
pliPrefixListId = lens _pliPrefixListId (\ s a -> s{_pliPrefixListId = a}) | 125 | pliPrefixListId = lens _pliPrefixListId (\ s a -> s{_pliPrefixListId = a}) | 74 | true | true | 0 | 9 | 23 | 46 | 25 | 21 | null | null |
valderman/dpress | DissociatedPress/Text.hs | mit | insertText :: T.Text -> Dictionary Word -> Dictionary Word
insertText s d =
foldl' (\dict str -> updateDict (words' $ T.map toLower str) dict) d ls
where
ls = map addFullStop $ filter (not . T.null) $ T.lines s
addFullStop l
| T.last l `elem` (".!?" :: String) = l
| otherwise = T.snoc l '.' | 341 | insertText :: T.Text -> Dictionary Word -> Dictionary Word
insertText s d =
foldl' (\dict str -> updateDict (words' $ T.map toLower str) dict) d ls
where
ls = map addFullStop $ filter (not . T.null) $ T.lines s
addFullStop l
| T.last l `elem` (".!?" :: String) = l
| otherwise = T.snoc l '.' | 341 | insertText s d =
foldl' (\dict str -> updateDict (words' $ T.map toLower str) dict) d ls
where
ls = map addFullStop $ filter (not . T.null) $ T.lines s
addFullStop l
| T.last l `elem` (".!?" :: String) = l
| otherwise = T.snoc l '.' | 282 | false | true | 3 | 12 | 105 | 150 | 73 | 77 | null | null |
michalkonecny/aern2 | aern2-mfun/src/AERN2/BoxFunMinMax/Expressions/Translators/FPTaylor.hs | bsd-3-clause | testOutput :: String
testOutput =
"Loading configuration file: /home/junaid/Research/git/FPTaylor/default.cfg \
\FPTaylor, version 0.9.2+dev \
\Loading: heronInit1PlusXDiv1 copy.txt \
\Processing: Expression 1 \
\************************************* \
\Taylor form for: rnd32((1 + rnd32((X / 1)))) \
\Conservative bound: [1.500000, 3.000000] \
\Simplified rounding: rnd[32,ne,1.00,-24,0]((1 + rnd32((X / 1)))) \
\Building Taylor forms... \
\Simplifying Taylor forms... \
\success \
\v0 = (1 + (X * (1 / 1))) \
\-1 (9): exp = -24: (1/5070602400912917605986812821504) \
\1 (3): exp = -24: floor_power2(((X * (1 / 1)) + 0)) \
\2 (5): exp = -24: floor_power2(((1 + (X * (1 / 1))) + interval(-5.96046447753906382349e-08, 5.96046447753906382349e-08))) \
\Corresponding original subexpressions: \
\1: rnd32((X / 1)) \
\2: rnd[32,ne,1.00,-24,0]((1 + rnd32((X / 1)))) \
\bounds: [1.500000e+00, 3.000000e+00] \
\Computing absolute errors \
\-1: exp = -24: 1.972152e-31 (low = 1.972152e-31, subopt = 0.0%) \
\Solving the exact optimization problem \
\exact bound (exp = -24): 3.000000e+00 (low = 3.000000e+00, subopt = 0.0%) \
\total2: 1.175494e-38 (low = 1.175494e-38, subopt = 0.0%) \
\exact total: 1.788139e-07 (low = 1.788139e-07, subopt = 0.0%) \
\Elapsed time: 0.36412 \
\************************************* \
\------------------------------------------------------------------------------- \
\Problem: Expression 1 \
\Optimization lower bounds for error models: \
\The absolute error model (exact): 1.788139e-07 (suboptimality = 0.0%) \
\Bounds (without rounding): [1.500000e+00, 3.000000e+00] \
\Bounds (floating-point): [1.49999982118606545178e+00, 3.00000017881393477026e+00] \
\Absolute error (exact): 1.788139e-07 \
\Elapsed time: 0.36 \
\" | 1,841 | testOutput :: String
testOutput =
"Loading configuration file: /home/junaid/Research/git/FPTaylor/default.cfg \
\FPTaylor, version 0.9.2+dev \
\Loading: heronInit1PlusXDiv1 copy.txt \
\Processing: Expression 1 \
\************************************* \
\Taylor form for: rnd32((1 + rnd32((X / 1)))) \
\Conservative bound: [1.500000, 3.000000] \
\Simplified rounding: rnd[32,ne,1.00,-24,0]((1 + rnd32((X / 1)))) \
\Building Taylor forms... \
\Simplifying Taylor forms... \
\success \
\v0 = (1 + (X * (1 / 1))) \
\-1 (9): exp = -24: (1/5070602400912917605986812821504) \
\1 (3): exp = -24: floor_power2(((X * (1 / 1)) + 0)) \
\2 (5): exp = -24: floor_power2(((1 + (X * (1 / 1))) + interval(-5.96046447753906382349e-08, 5.96046447753906382349e-08))) \
\Corresponding original subexpressions: \
\1: rnd32((X / 1)) \
\2: rnd[32,ne,1.00,-24,0]((1 + rnd32((X / 1)))) \
\bounds: [1.500000e+00, 3.000000e+00] \
\Computing absolute errors \
\-1: exp = -24: 1.972152e-31 (low = 1.972152e-31, subopt = 0.0%) \
\Solving the exact optimization problem \
\exact bound (exp = -24): 3.000000e+00 (low = 3.000000e+00, subopt = 0.0%) \
\total2: 1.175494e-38 (low = 1.175494e-38, subopt = 0.0%) \
\exact total: 1.788139e-07 (low = 1.788139e-07, subopt = 0.0%) \
\Elapsed time: 0.36412 \
\************************************* \
\------------------------------------------------------------------------------- \
\Problem: Expression 1 \
\Optimization lower bounds for error models: \
\The absolute error model (exact): 1.788139e-07 (suboptimality = 0.0%) \
\Bounds (without rounding): [1.500000e+00, 3.000000e+00] \
\Bounds (floating-point): [1.49999982118606545178e+00, 3.00000017881393477026e+00] \
\Absolute error (exact): 1.788139e-07 \
\Elapsed time: 0.36 \
\" | 1,840 | testOutput =
"Loading configuration file: /home/junaid/Research/git/FPTaylor/default.cfg \
\FPTaylor, version 0.9.2+dev \
\Loading: heronInit1PlusXDiv1 copy.txt \
\Processing: Expression 1 \
\************************************* \
\Taylor form for: rnd32((1 + rnd32((X / 1)))) \
\Conservative bound: [1.500000, 3.000000] \
\Simplified rounding: rnd[32,ne,1.00,-24,0]((1 + rnd32((X / 1)))) \
\Building Taylor forms... \
\Simplifying Taylor forms... \
\success \
\v0 = (1 + (X * (1 / 1))) \
\-1 (9): exp = -24: (1/5070602400912917605986812821504) \
\1 (3): exp = -24: floor_power2(((X * (1 / 1)) + 0)) \
\2 (5): exp = -24: floor_power2(((1 + (X * (1 / 1))) + interval(-5.96046447753906382349e-08, 5.96046447753906382349e-08))) \
\Corresponding original subexpressions: \
\1: rnd32((X / 1)) \
\2: rnd[32,ne,1.00,-24,0]((1 + rnd32((X / 1)))) \
\bounds: [1.500000e+00, 3.000000e+00] \
\Computing absolute errors \
\-1: exp = -24: 1.972152e-31 (low = 1.972152e-31, subopt = 0.0%) \
\Solving the exact optimization problem \
\exact bound (exp = -24): 3.000000e+00 (low = 3.000000e+00, subopt = 0.0%) \
\total2: 1.175494e-38 (low = 1.175494e-38, subopt = 0.0%) \
\exact total: 1.788139e-07 (low = 1.788139e-07, subopt = 0.0%) \
\Elapsed time: 0.36412 \
\************************************* \
\------------------------------------------------------------------------------- \
\Problem: Expression 1 \
\Optimization lower bounds for error models: \
\The absolute error model (exact): 1.788139e-07 (suboptimality = 0.0%) \
\Bounds (without rounding): [1.500000e+00, 3.000000e+00] \
\Bounds (floating-point): [1.49999982118606545178e+00, 3.00000017881393477026e+00] \
\Absolute error (exact): 1.788139e-07 \
\Elapsed time: 0.36 \
\" | 1,819 | false | true | 0 | 6 | 322 | 18 | 7 | 11 | null | null |
ashnikel/haskellbook | ch11/ch11.6_ex.hs | mit | -- 1 - :type myCar :: Vehicle
-- 2
isCar :: Vehicle -> Bool
isCar (Car _ _) = True | 82 | isCar :: Vehicle -> Bool
isCar (Car _ _) = True | 47 | isCar (Car _ _) = True | 22 | true | true | 0 | 7 | 19 | 28 | 15 | 13 | null | null |
gcampax/ghc | compiler/prelude/PrimOp.hs | bsd-3-clause | -- Output stuff:
pprPrimOp :: PrimOp -> SDoc
pprPrimOp other_op = pprOccName (primOpOcc other_op) | 99 | pprPrimOp :: PrimOp -> SDoc
pprPrimOp other_op = pprOccName (primOpOcc other_op) | 81 | pprPrimOp other_op = pprOccName (primOpOcc other_op) | 52 | true | true | 0 | 7 | 15 | 33 | 15 | 18 | null | null |
anton-dessiatov/stack | src/Stack/Constants/Config.hs | bsd-3-clause | -- | The filename used for modification check of .cabal
configCabalMod :: (MonadThrow m, MonadReader env m, HasEnvConfig env)
=> Path Abs Dir -- ^ Package directory.
-> m (Path Abs File)
configCabalMod dir =
liftM
(</> $(mkRelFile "stack-cabal-mod"))
(distDirFromDir dir) | 326 | configCabalMod :: (MonadThrow m, MonadReader env m, HasEnvConfig env)
=> Path Abs Dir -- ^ Package directory.
-> m (Path Abs File)
configCabalMod dir =
liftM
(</> $(mkRelFile "stack-cabal-mod"))
(distDirFromDir dir) | 270 | configCabalMod dir =
liftM
(</> $(mkRelFile "stack-cabal-mod"))
(distDirFromDir dir) | 104 | true | true | 0 | 9 | 95 | 81 | 41 | 40 | null | null |
gibiansky/IHaskell | src/IHaskell/Convert/Args.hs | mit | mergeArg unexpectedArg _ = error $ "IHaskell.Convert.mergeArg: impossible argument: "
++ show unexpectedArg | 142 | mergeArg unexpectedArg _ = error $ "IHaskell.Convert.mergeArg: impossible argument: "
++ show unexpectedArg | 142 | mergeArg unexpectedArg _ = error $ "IHaskell.Convert.mergeArg: impossible argument: "
++ show unexpectedArg | 142 | false | false | 4 | 5 | 47 | 27 | 10 | 17 | null | null |
vladfi1/hs-misc | Utils.hs | mit | liftA2_FNS :: forall f g h a bs. (forall b. f b a -> g b a -> h b a) -> FlipNP f bs a -> FlipNS g bs a -> FlipNS h bs a
liftA2_FNS f (FlipNP xs) (FlipNS ys) = FlipNS $ liftA2_NS' f' xs ys
where
f' :: forall b. Flip f a b -> Flip g a b -> Flip h a b
f' (Flip x) (Flip y) = Flip $ f x y | 294 | liftA2_FNS :: forall f g h a bs. (forall b. f b a -> g b a -> h b a) -> FlipNP f bs a -> FlipNS g bs a -> FlipNS h bs a
liftA2_FNS f (FlipNP xs) (FlipNS ys) = FlipNS $ liftA2_NS' f' xs ys
where
f' :: forall b. Flip f a b -> Flip g a b -> Flip h a b
f' (Flip x) (Flip y) = Flip $ f x y | 294 | liftA2_FNS f (FlipNP xs) (FlipNS ys) = FlipNS $ liftA2_NS' f' xs ys
where
f' :: forall b. Flip f a b -> Flip g a b -> Flip h a b
f' (Flip x) (Flip y) = Flip $ f x y | 174 | false | true | 0 | 11 | 88 | 191 | 93 | 98 | null | null |
yiannist/lambda-lifting | LLifter/Internal.hs | gpl-3.0 | incrTurn :: Game ()
incrTurn = do
gs@(GS{turn = trn}) <- get
put gs{turn = succ trn} | 92 | incrTurn :: Game ()
incrTurn = do
gs@(GS{turn = trn}) <- get
put gs{turn = succ trn} | 92 | incrTurn = do
gs@(GS{turn = trn}) <- get
put gs{turn = succ trn} | 72 | false | true | 0 | 12 | 24 | 55 | 28 | 27 | null | null |
rockdragon/julia-programming | code/haskell/SimpleJSON.hs | mit | getInt :: JValue -> Maybe Int
getInt (JNumber d) = Just (truncate(d)) | 69 | getInt :: JValue -> Maybe Int
getInt (JNumber d) = Just (truncate(d)) | 69 | getInt (JNumber d) = Just (truncate(d)) | 39 | false | true | 0 | 8 | 11 | 43 | 20 | 23 | null | null |
SAdams601/HaRe | old/testing/refacFunDef/Test1_TokOut.hs | bsd-3-clause | g = f 1 | 7 | g = f 1 | 7 | g = f 1 | 7 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
gwright83/Wheeler | src/Math/Symbolic/Wheeler/Basic.hs | bsd-3-clause | fractionParts e = (e, Const 1) | 30 | fractionParts e = (e, Const 1) | 30 | fractionParts e = (e, Const 1) | 30 | false | false | 1 | 6 | 5 | 21 | 9 | 12 | null | null |
jamesdarcy/Hastur | src/Hastur.hs | bsd-3-clause | onOpenFile :: HasturContext -> IO ()
onOpenFile HasturContext {guiWidgets=hxw} = do
maybePath <- fileOpenDialog (guiFrame hxw) True True "Open Image" [("Dicom files",["*.dcm"]),("All files",["*.*"])] "" ""
case maybePath of
Nothing -> return ()
Just path -> importDicomFile (guiText hxw) path
-- | 310 | onOpenFile :: HasturContext -> IO ()
onOpenFile HasturContext {guiWidgets=hxw} = do
maybePath <- fileOpenDialog (guiFrame hxw) True True "Open Image" [("Dicom files",["*.dcm"]),("All files",["*.*"])] "" ""
case maybePath of
Nothing -> return ()
Just path -> importDicomFile (guiText hxw) path
-- | 310 | onOpenFile HasturContext {guiWidgets=hxw} = do
maybePath <- fileOpenDialog (guiFrame hxw) True True "Open Image" [("Dicom files",["*.dcm"]),("All files",["*.*"])] "" ""
case maybePath of
Nothing -> return ()
Just path -> importDicomFile (guiText hxw) path
-- | 273 | false | true | 3 | 13 | 54 | 128 | 64 | 64 | null | null |
rsasse/tamarin-prover | lib/theory/src/Theory.hs | gpl-3.0 | -- | Adds the RHS lemma attribute.
addRightLemma :: Lemma p -> Lemma p
addRightLemma lem =
L.set lAttributes (RHSLemma:(L.get lAttributes lem)) lem | 152 | addRightLemma :: Lemma p -> Lemma p
addRightLemma lem =
L.set lAttributes (RHSLemma:(L.get lAttributes lem)) lem | 117 | addRightLemma lem =
L.set lAttributes (RHSLemma:(L.get lAttributes lem)) lem | 81 | true | true | 0 | 10 | 27 | 51 | 25 | 26 | null | null |
fpco/cabal | Cabal/Distribution/Simple/UHC.hs | bsd-3-clause | buildExe :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Executable -> ComponentLocalBuildInfo -> IO ()
buildExe verbosity _pkg_descr lbi exe clbi = do
systemPkgDir <- rawSystemProgramStdoutConf verbosity uhcProgram (withPrograms lbi) ["--meta-pkgdir-system"]
userPkgDir <- getUserPackageDir
let runUhcProg = rawSystemProgramConf verbosity uhcProgram (withPrograms lbi)
let uhcArgs = -- common flags lib/exe
constructUHCCmdLine userPkgDir systemPkgDir
lbi (buildInfo exe) clbi
(buildDir lbi) verbosity
-- output file
++ ["--output", buildDir lbi </> exeName exe]
-- main source module
++ [modulePath exe]
runUhcProg uhcArgs | 843 | buildExe :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Executable -> ComponentLocalBuildInfo -> IO ()
buildExe verbosity _pkg_descr lbi exe clbi = do
systemPkgDir <- rawSystemProgramStdoutConf verbosity uhcProgram (withPrograms lbi) ["--meta-pkgdir-system"]
userPkgDir <- getUserPackageDir
let runUhcProg = rawSystemProgramConf verbosity uhcProgram (withPrograms lbi)
let uhcArgs = -- common flags lib/exe
constructUHCCmdLine userPkgDir systemPkgDir
lbi (buildInfo exe) clbi
(buildDir lbi) verbosity
-- output file
++ ["--output", buildDir lbi </> exeName exe]
-- main source module
++ [modulePath exe]
runUhcProg uhcArgs | 843 | buildExe verbosity _pkg_descr lbi exe clbi = do
systemPkgDir <- rawSystemProgramStdoutConf verbosity uhcProgram (withPrograms lbi) ["--meta-pkgdir-system"]
userPkgDir <- getUserPackageDir
let runUhcProg = rawSystemProgramConf verbosity uhcProgram (withPrograms lbi)
let uhcArgs = -- common flags lib/exe
constructUHCCmdLine userPkgDir systemPkgDir
lbi (buildInfo exe) clbi
(buildDir lbi) verbosity
-- output file
++ ["--output", buildDir lbi </> exeName exe]
-- main source module
++ [modulePath exe]
runUhcProg uhcArgs | 701 | false | true | 0 | 14 | 288 | 176 | 85 | 91 | null | null |
exbb2/text-locale-encoding | Data/Text/Lazy/Encoding/Locale.hs | bsd-3-clause | decodeLocale :: L.ByteString -> IO TL.Text
decodeLocale = chooseDecoder Nothing Nothing | 87 | decodeLocale :: L.ByteString -> IO TL.Text
decodeLocale = chooseDecoder Nothing Nothing | 87 | decodeLocale = chooseDecoder Nothing Nothing | 44 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
keithodulaigh/Hets | Common/Lib/RelCheck.hs | gpl-2.0 | tr = transClosure test1 | 23 | tr = transClosure test1 | 23 | tr = transClosure test1 | 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
tonyday567/chart-svg | src/Chart/Surface.hs | bsd-3-clause | -- | Creation of the classical heatmap glyph within a legend context.
surfaceLegendChart :: Range Double -> SurfaceLegendOptions -> ChartTree
surfaceLegendChart dataRange l =
legendFrame (view #sloLegendOptions l) hs
where
a = makeSurfaceTick l (named "pchart" pchart)
pchart
| l ^. #sloLegendOptions % #place == PlaceBottom
|| l ^. #sloLegendOptions % #place == PlaceTop =
vertGlyph
| otherwise = horiGlyph
t = TextChart (l ^. #sloLegendOptions % #textStyle & #anchor .~ AnchorStart) [(l ^. #sloTitle, zero)]
hs = vert (l ^. #sloLegendOptions % #vgap) [a, unnamed [t]]
vertGlyph :: [Chart]
vertGlyph =
zipWith
(\r c -> RectChart (blob c) [r])
( (\xr -> Ranges xr (Range 0 (l ^. #sloWidth)))
<$> gridSpace
dataRange
(l ^. #sloResolution)
)
( (\x -> mixes x (toList $ l ^. #sloStyle % #surfaceColors))
<$> grid MidPos (Range 0 1) (l ^. #sloResolution)
)
horiGlyph :: [Chart]
horiGlyph =
zipWith
(\r c -> RectChart (blob c) [r])
( (\yr -> Ranges (Range 0 (l ^. #sloWidth)) yr)
<$> gridSpace
dataRange
(l ^. #sloResolution)
)
( (\x -> mixes x (toList $ l ^. #sloStyle % #surfaceColors))
<$> grid MidPos (Range 0 1) (l ^. #sloResolution)
) | 1,397 | surfaceLegendChart :: Range Double -> SurfaceLegendOptions -> ChartTree
surfaceLegendChart dataRange l =
legendFrame (view #sloLegendOptions l) hs
where
a = makeSurfaceTick l (named "pchart" pchart)
pchart
| l ^. #sloLegendOptions % #place == PlaceBottom
|| l ^. #sloLegendOptions % #place == PlaceTop =
vertGlyph
| otherwise = horiGlyph
t = TextChart (l ^. #sloLegendOptions % #textStyle & #anchor .~ AnchorStart) [(l ^. #sloTitle, zero)]
hs = vert (l ^. #sloLegendOptions % #vgap) [a, unnamed [t]]
vertGlyph :: [Chart]
vertGlyph =
zipWith
(\r c -> RectChart (blob c) [r])
( (\xr -> Ranges xr (Range 0 (l ^. #sloWidth)))
<$> gridSpace
dataRange
(l ^. #sloResolution)
)
( (\x -> mixes x (toList $ l ^. #sloStyle % #surfaceColors))
<$> grid MidPos (Range 0 1) (l ^. #sloResolution)
)
horiGlyph :: [Chart]
horiGlyph =
zipWith
(\r c -> RectChart (blob c) [r])
( (\yr -> Ranges (Range 0 (l ^. #sloWidth)) yr)
<$> gridSpace
dataRange
(l ^. #sloResolution)
)
( (\x -> mixes x (toList $ l ^. #sloStyle % #surfaceColors))
<$> grid MidPos (Range 0 1) (l ^. #sloResolution)
) | 1,327 | surfaceLegendChart dataRange l =
legendFrame (view #sloLegendOptions l) hs
where
a = makeSurfaceTick l (named "pchart" pchart)
pchart
| l ^. #sloLegendOptions % #place == PlaceBottom
|| l ^. #sloLegendOptions % #place == PlaceTop =
vertGlyph
| otherwise = horiGlyph
t = TextChart (l ^. #sloLegendOptions % #textStyle & #anchor .~ AnchorStart) [(l ^. #sloTitle, zero)]
hs = vert (l ^. #sloLegendOptions % #vgap) [a, unnamed [t]]
vertGlyph :: [Chart]
vertGlyph =
zipWith
(\r c -> RectChart (blob c) [r])
( (\xr -> Ranges xr (Range 0 (l ^. #sloWidth)))
<$> gridSpace
dataRange
(l ^. #sloResolution)
)
( (\x -> mixes x (toList $ l ^. #sloStyle % #surfaceColors))
<$> grid MidPos (Range 0 1) (l ^. #sloResolution)
)
horiGlyph :: [Chart]
horiGlyph =
zipWith
(\r c -> RectChart (blob c) [r])
( (\yr -> Ranges (Range 0 (l ^. #sloWidth)) yr)
<$> gridSpace
dataRange
(l ^. #sloResolution)
)
( (\x -> mixes x (toList $ l ^. #sloStyle % #surfaceColors))
<$> grid MidPos (Range 0 1) (l ^. #sloResolution)
) | 1,255 | true | true | 22 | 15 | 452 | 481 | 252 | 229 | null | null |
grafi-tt/Maizul | fpu-misc/original/fadd-grafi/Test.hs | bsd-2-clause | fakeAdder24 :: Bool -> Bits24 -> Bits24 -> (Bool, Bits24)
fakeAdder24 cin (Bits24 xs) (Bits24 ys) = (id *** Bits24) $ fakeAdder 24 cin xs ys | 140 | fakeAdder24 :: Bool -> Bits24 -> Bits24 -> (Bool, Bits24)
fakeAdder24 cin (Bits24 xs) (Bits24 ys) = (id *** Bits24) $ fakeAdder 24 cin xs ys | 140 | fakeAdder24 cin (Bits24 xs) (Bits24 ys) = (id *** Bits24) $ fakeAdder 24 cin xs ys | 82 | false | true | 0 | 11 | 25 | 73 | 36 | 37 | null | null |
pharaun/alldice | src/Scheme/Primitives.hs | apache-2.0 | unpackStr :: LispVal s -> ThrowsError T.Text
unpackStr (String s) = return s | 76 | unpackStr :: LispVal s -> ThrowsError T.Text
unpackStr (String s) = return s | 76 | unpackStr (String s) = return s | 31 | false | true | 0 | 9 | 12 | 39 | 17 | 22 | null | null |
TransformingMusicology/libaudioDB-haskell | src/Sound/Audio/Database/Ingest.hs | gpl-3.0 | insertMaybeFeaturesPtr :: (Ptr ADB) -> Maybe ADBDatumPtr -> IO Bool
insertMaybeFeaturesPtr adb (Just datumPtr) = insertFeaturesPtr adb datumPtr | 143 | insertMaybeFeaturesPtr :: (Ptr ADB) -> Maybe ADBDatumPtr -> IO Bool
insertMaybeFeaturesPtr adb (Just datumPtr) = insertFeaturesPtr adb datumPtr | 143 | insertMaybeFeaturesPtr adb (Just datumPtr) = insertFeaturesPtr adb datumPtr | 75 | false | true | 0 | 7 | 17 | 47 | 22 | 25 | null | null |
prowdsponsor/country-codes | src/Data/CountryCodes/ISO31661.hs | bsd-3-clause | toName PE = "Peru" | 18 | toName PE = "Peru" | 18 | toName PE = "Peru" | 18 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
wavewave/weblogger-type | lib/Application/WebLogger/Type.hs | bsd-2-clause | addLog :: WebLoggerInfo
-> Update WebLoggerRepo WebLoggerInfo
addLog minfo = do
modify (|> minfo)
return minfo
{-
-- |
queryWebLogger :: UUID -> Query WebLoggerInfoRepository (Maybe WebLoggerInfo)
queryWebLogger uuid = do
m <- ask
return (M.lookup uuid m)
-}
-- | | 294 | addLog :: WebLoggerInfo
-> Update WebLoggerRepo WebLoggerInfo
addLog minfo = do
modify (|> minfo)
return minfo
{-
-- |
queryWebLogger :: UUID -> Query WebLoggerInfoRepository (Maybe WebLoggerInfo)
queryWebLogger uuid = do
m <- ask
return (M.lookup uuid m)
-}
-- | | 293 | addLog minfo = do
modify (|> minfo)
return minfo
{-
-- |
queryWebLogger :: UUID -> Query WebLoggerInfoRepository (Maybe WebLoggerInfo)
queryWebLogger uuid = do
m <- ask
return (M.lookup uuid m)
-}
-- | | 217 | false | true | 0 | 9 | 71 | 46 | 21 | 25 | null | null |
nomicflux/threals | src/Threal/Impartial.hs | gpl-2.0 | rotateWinnerTree (WNode trees) = WNode (nub $ map rotateWinnerTree trees) | 73 | rotateWinnerTree (WNode trees) = WNode (nub $ map rotateWinnerTree trees) | 73 | rotateWinnerTree (WNode trees) = WNode (nub $ map rotateWinnerTree trees) | 73 | false | false | 0 | 8 | 9 | 30 | 14 | 16 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Unit.hs | mit | maxHitPoints ZergEvolutionChamber = 238 | 39 | maxHitPoints ZergEvolutionChamber = 238 | 39 | maxHitPoints ZergEvolutionChamber = 238 | 39 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Xandaros/MinecraftCLI | app/Main.hs | bsd-2-clause | minecraftThread :: TChan CBPacket -> TChan [SBPacket] -> IORef Bool -> Profile -> Server -> (String -> IO ()) -> IO ()
minecraftThread inbound outbound shutdown profile server printfunc = do
let addr = takeWhile (/= ':') . T.unpack $ server ^. serverAddress
port = readMay $ drop 1 . dropWhile (/= ':') . T.unpack $ server ^. serverAddress
void $ connect addr port $ do
liftIO $ printfunc "Sending handshake"
handshake
liftIO $ printfunc "Handshake sent"
loginSucc <- login (profile ^. profileUsername) (profile ^. profileUuid) (profile ^. profileToken)
case loginSucc of
Left err -> liftIO $ putStrLn err
Right _ -> liftIO $ do
printfunc "Logged in"
sendPacket $ SBClientSettingsPayload "en_GB" 1 0 True 0x7F 1
sendPacket $ SBClientStatusPayload 0
sendPacket $ SBChatMessage $ SBChatMessagePayload ("Beep. Boop. I'm a bot. Type \"" <> profile ^. profileUsername . network <> ": help\" for more information")
sendPacket $ SBChatMessagePayload "/afk"
whileM (liftIO $ not <$> readIORef shutdown) $ do
packetAvailable <- hasPacket
when packetAvailable $ do
packet' <- receivePacket
case packet' of
Just packet -> case packet of
CBKeepAlive keepAlive -> do
let response = SBKeepAlivePayload $ keepAlive ^. keepAliveId
sendPacket response
CBPlayerPositionAndLook positionAndLook -> do
liftIO $ printfunc "Position and look"
sendPacket $ SBTeleportConfirmPayload $ positionAndLook ^. posLookID
sendPacket $ SBPlayerPositionAndLookPayload (positionAndLook^.x) (positionAndLook^.y) (positionAndLook^.z) (positionAndLook^.yaw) (positionAndLook^.pitch) True
liftIO . atomically $ writeTChan inbound packet
CBDisconnectPlay dc -> do
liftIO $ printfunc $ "Disconnected: " ++ T.unpack (dc ^. reason . from network)
_ -> liftIO . atomically $ writeTChan inbound packet
Nothing -> liftIO $ do
writeIORef shutdown True
printfunc "Connection closed" >> exitSuccess
dataToSend <- liftIO . atomically $ tryReadTChan outbound
case dataToSend of
Just dataToSend -> sequence_ $ sendPacket <$> dataToSend
Nothing -> pure ()
liftIO $ when (not packetAvailable) $ do
threadDelay (floor $ ((1/21) :: Double) * 1000000) | 2,714 | minecraftThread :: TChan CBPacket -> TChan [SBPacket] -> IORef Bool -> Profile -> Server -> (String -> IO ()) -> IO ()
minecraftThread inbound outbound shutdown profile server printfunc = do
let addr = takeWhile (/= ':') . T.unpack $ server ^. serverAddress
port = readMay $ drop 1 . dropWhile (/= ':') . T.unpack $ server ^. serverAddress
void $ connect addr port $ do
liftIO $ printfunc "Sending handshake"
handshake
liftIO $ printfunc "Handshake sent"
loginSucc <- login (profile ^. profileUsername) (profile ^. profileUuid) (profile ^. profileToken)
case loginSucc of
Left err -> liftIO $ putStrLn err
Right _ -> liftIO $ do
printfunc "Logged in"
sendPacket $ SBClientSettingsPayload "en_GB" 1 0 True 0x7F 1
sendPacket $ SBClientStatusPayload 0
sendPacket $ SBChatMessage $ SBChatMessagePayload ("Beep. Boop. I'm a bot. Type \"" <> profile ^. profileUsername . network <> ": help\" for more information")
sendPacket $ SBChatMessagePayload "/afk"
whileM (liftIO $ not <$> readIORef shutdown) $ do
packetAvailable <- hasPacket
when packetAvailable $ do
packet' <- receivePacket
case packet' of
Just packet -> case packet of
CBKeepAlive keepAlive -> do
let response = SBKeepAlivePayload $ keepAlive ^. keepAliveId
sendPacket response
CBPlayerPositionAndLook positionAndLook -> do
liftIO $ printfunc "Position and look"
sendPacket $ SBTeleportConfirmPayload $ positionAndLook ^. posLookID
sendPacket $ SBPlayerPositionAndLookPayload (positionAndLook^.x) (positionAndLook^.y) (positionAndLook^.z) (positionAndLook^.yaw) (positionAndLook^.pitch) True
liftIO . atomically $ writeTChan inbound packet
CBDisconnectPlay dc -> do
liftIO $ printfunc $ "Disconnected: " ++ T.unpack (dc ^. reason . from network)
_ -> liftIO . atomically $ writeTChan inbound packet
Nothing -> liftIO $ do
writeIORef shutdown True
printfunc "Connection closed" >> exitSuccess
dataToSend <- liftIO . atomically $ tryReadTChan outbound
case dataToSend of
Just dataToSend -> sequence_ $ sendPacket <$> dataToSend
Nothing -> pure ()
liftIO $ when (not packetAvailable) $ do
threadDelay (floor $ ((1/21) :: Double) * 1000000) | 2,714 | minecraftThread inbound outbound shutdown profile server printfunc = do
let addr = takeWhile (/= ':') . T.unpack $ server ^. serverAddress
port = readMay $ drop 1 . dropWhile (/= ':') . T.unpack $ server ^. serverAddress
void $ connect addr port $ do
liftIO $ printfunc "Sending handshake"
handshake
liftIO $ printfunc "Handshake sent"
loginSucc <- login (profile ^. profileUsername) (profile ^. profileUuid) (profile ^. profileToken)
case loginSucc of
Left err -> liftIO $ putStrLn err
Right _ -> liftIO $ do
printfunc "Logged in"
sendPacket $ SBClientSettingsPayload "en_GB" 1 0 True 0x7F 1
sendPacket $ SBClientStatusPayload 0
sendPacket $ SBChatMessage $ SBChatMessagePayload ("Beep. Boop. I'm a bot. Type \"" <> profile ^. profileUsername . network <> ": help\" for more information")
sendPacket $ SBChatMessagePayload "/afk"
whileM (liftIO $ not <$> readIORef shutdown) $ do
packetAvailable <- hasPacket
when packetAvailable $ do
packet' <- receivePacket
case packet' of
Just packet -> case packet of
CBKeepAlive keepAlive -> do
let response = SBKeepAlivePayload $ keepAlive ^. keepAliveId
sendPacket response
CBPlayerPositionAndLook positionAndLook -> do
liftIO $ printfunc "Position and look"
sendPacket $ SBTeleportConfirmPayload $ positionAndLook ^. posLookID
sendPacket $ SBPlayerPositionAndLookPayload (positionAndLook^.x) (positionAndLook^.y) (positionAndLook^.z) (positionAndLook^.yaw) (positionAndLook^.pitch) True
liftIO . atomically $ writeTChan inbound packet
CBDisconnectPlay dc -> do
liftIO $ printfunc $ "Disconnected: " ++ T.unpack (dc ^. reason . from network)
_ -> liftIO . atomically $ writeTChan inbound packet
Nothing -> liftIO $ do
writeIORef shutdown True
printfunc "Connection closed" >> exitSuccess
dataToSend <- liftIO . atomically $ tryReadTChan outbound
case dataToSend of
Just dataToSend -> sequence_ $ sendPacket <$> dataToSend
Nothing -> pure ()
liftIO $ when (not packetAvailable) $ do
threadDelay (floor $ ((1/21) :: Double) * 1000000) | 2,595 | false | true | 0 | 32 | 922 | 733 | 341 | 392 | null | null |
ksaveljev/hake-2 | src/Game/GameWeapon.hs | bsd-3-clause | bfgTouch :: EntTouch
bfgTouch =
GenericEntTouch "bfg_touch" $ \_ _ _ _ -> do
io (putStrLn "GameWeapon.bfgTouch") >> undefined -- TODO | 139 | bfgTouch :: EntTouch
bfgTouch =
GenericEntTouch "bfg_touch" $ \_ _ _ _ -> do
io (putStrLn "GameWeapon.bfgTouch") >> undefined -- TODO | 139 | bfgTouch =
GenericEntTouch "bfg_touch" $ \_ _ _ _ -> do
io (putStrLn "GameWeapon.bfgTouch") >> undefined -- TODO | 118 | false | true | 2 | 11 | 26 | 54 | 24 | 30 | null | null |
brendanhay/gogol | gogol-doubleclick-search/gen/Network/Google/DoubleClickSearch/Types/Product.hs | mpl-2.0 | -- | DS campaign ID.
cCampaignId :: Lens' Conversion (Maybe Int64)
cCampaignId
= lens _cCampaignId (\ s a -> s{_cCampaignId = a}) .
mapping _Coerce | 155 | cCampaignId :: Lens' Conversion (Maybe Int64)
cCampaignId
= lens _cCampaignId (\ s a -> s{_cCampaignId = a}) .
mapping _Coerce | 134 | cCampaignId
= lens _cCampaignId (\ s a -> s{_cCampaignId = a}) .
mapping _Coerce | 88 | true | true | 0 | 10 | 32 | 55 | 28 | 27 | null | null |
joshcough/L5-Haskell | src/L/Registers.hs | mit | low8 R8 = "r8b" | 16 | low8 R8 = "r8b" | 16 | low8 R8 = "r8b" | 16 | false | false | 1 | 5 | 4 | 13 | 4 | 9 | null | null |
romanb/amazonka | amazonka-rds/gen/Network/AWS/RDS/DescribeOptionGroupOptions.hs | mpl-2.0 | -- | An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the marker,
-- up to the value specified by 'MaxRecords'.
dogoMarker :: Lens' DescribeOptionGroupOptions (Maybe Text)
dogoMarker = lens _dogoMarker (\s a -> s { _dogoMarker = a }) | 322 | dogoMarker :: Lens' DescribeOptionGroupOptions (Maybe Text)
dogoMarker = lens _dogoMarker (\s a -> s { _dogoMarker = a }) | 121 | dogoMarker = lens _dogoMarker (\s a -> s { _dogoMarker = a }) | 61 | true | true | 0 | 9 | 51 | 48 | 27 | 21 | null | null |
romanb/amazonka | amazonka-elasticbeanstalk/gen/Network/AWS/ElasticBeanstalk/DeleteEnvironmentConfiguration.hs | mpl-2.0 | -- | 'DeleteEnvironmentConfiguration' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'decApplicationName' @::@ 'Text'
--
-- * 'decEnvironmentName' @::@ 'Text'
--
deleteEnvironmentConfiguration :: Text -- ^ 'decApplicationName'
-> Text -- ^ 'decEnvironmentName'
-> DeleteEnvironmentConfiguration
deleteEnvironmentConfiguration p1 p2 = DeleteEnvironmentConfiguration
{ _decApplicationName = p1
, _decEnvironmentName = p2
} | 530 | deleteEnvironmentConfiguration :: Text -- ^ 'decApplicationName'
-> Text -- ^ 'decEnvironmentName'
-> DeleteEnvironmentConfiguration
deleteEnvironmentConfiguration p1 p2 = DeleteEnvironmentConfiguration
{ _decApplicationName = p1
, _decEnvironmentName = p2
} | 332 | deleteEnvironmentConfiguration p1 p2 = DeleteEnvironmentConfiguration
{ _decApplicationName = p1
, _decEnvironmentName = p2
} | 137 | true | true | 0 | 7 | 126 | 52 | 32 | 20 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-lang/Language/Drasil/Symbol.hs | bsd-2-clause | compsy (Special _) _ = LT | 26 | compsy (Special _) _ = LT | 26 | compsy (Special _) _ = LT | 26 | false | false | 0 | 7 | 6 | 17 | 8 | 9 | null | null |
haslab/SecreC | src/Language/SecreC/Prover/Expression.hs | gpl-3.0 | stmt2Prover (ExpressionStatement l e) = expr2ProverMb e >> return () | 68 | stmt2Prover (ExpressionStatement l e) = expr2ProverMb e >> return () | 68 | stmt2Prover (ExpressionStatement l e) = expr2ProverMb e >> return () | 68 | false | false | 0 | 7 | 9 | 29 | 13 | 16 | null | null |
sdiehl/ghc | testsuite/tests/th/TH_Lift.hs | bsd-3-clause | g1 :: Natural
g1 = $( (\x -> [| x |]) (5 :: Natural) ) | 54 | g1 :: Natural
g1 = $( (\x -> [| x |]) (5 :: Natural) ) | 54 | g1 = $( (\x -> [| x |]) (5 :: Natural) ) | 40 | false | true | 0 | 10 | 14 | 42 | 22 | 20 | null | null |
vshatskyi/i3wm-config-haskell | app/DSL.hs | bsd-3-clause | toBindingList :: Free BindingF a -> [Binding]
toBindingList = reverse . toList' []
where toList' accumulator (Pure _) = accumulator
toList' accumulator (Free (BindingF i3 next)) = toList' (i3:accumulator) next | 219 | toBindingList :: Free BindingF a -> [Binding]
toBindingList = reverse . toList' []
where toList' accumulator (Pure _) = accumulator
toList' accumulator (Free (BindingF i3 next)) = toList' (i3:accumulator) next | 219 | toBindingList = reverse . toList' []
where toList' accumulator (Pure _) = accumulator
toList' accumulator (Free (BindingF i3 next)) = toList' (i3:accumulator) next | 173 | false | true | 1 | 9 | 39 | 86 | 43 | 43 | null | null |
castaway/pandoc | src/Text/Pandoc/XML.hs | gpl-2.0 | -- | Escape one character as needed for XML.
escapeCharForXML :: Char -> String
escapeCharForXML x = case x of
'&' -> "&"
'<' -> "<"
'>' -> ">"
'"' -> """
c -> [c]
-- | Escape string as needed for XML. Entity references are not preserved. | 387 | escapeCharForXML :: Char -> String
escapeCharForXML x = case x of
'&' -> "&"
'<' -> "<"
'>' -> ">"
'"' -> """
c -> [c]
-- | Escape string as needed for XML. Entity references are not preserved. | 342 | escapeCharForXML x = case x of
'&' -> "&"
'<' -> "<"
'>' -> ">"
'"' -> """
c -> [c]
-- | Escape string as needed for XML. Entity references are not preserved. | 307 | true | true | 0 | 9 | 181 | 63 | 31 | 32 | null | null |
cgorski/general-games | src/Game/Game/Poker.hs | mit | isHand ThreeOfAKind cards = if isThreeOfAKind cards then True else False | 72 | isHand ThreeOfAKind cards = if isThreeOfAKind cards then True else False | 72 | isHand ThreeOfAKind cards = if isThreeOfAKind cards then True else False | 72 | false | false | 0 | 6 | 10 | 22 | 11 | 11 | null | null |
pranjaltale16/codeworld | codeworld-api/src/CodeWorld/App.hs | apache-2.0 | pictureRule :: (state -> Picture) -> Rule state
pictureRule = PictureRule . const | 81 | pictureRule :: (state -> Picture) -> Rule state
pictureRule = PictureRule . const | 81 | pictureRule = PictureRule . const | 33 | false | true | 1 | 8 | 12 | 36 | 16 | 20 | null | null |
Elastifile/git-sling | server/src/Sling/Options.hs | gpl-2.0 | prefixOption :: Mod OptionFields String -> Parser Prefix
prefixOption args = prefixFromText . verify . T.pack <$> strOption args
where
verify t = if T.null t then error "Prefix can't be empty" else t | 211 | prefixOption :: Mod OptionFields String -> Parser Prefix
prefixOption args = prefixFromText . verify . T.pack <$> strOption args
where
verify t = if T.null t then error "Prefix can't be empty" else t | 211 | prefixOption args = prefixFromText . verify . T.pack <$> strOption args
where
verify t = if T.null t then error "Prefix can't be empty" else t | 154 | false | true | 0 | 7 | 45 | 69 | 33 | 36 | null | null |
hmemcpy/milewski-ctfp-pdf | src/content/3.9/code/haskell/snippet05.hs | gpl-3.0 | h = join . fmap g . f | 21 | h = join . fmap g . f | 21 | h = join . fmap g . f | 21 | false | false | 3 | 5 | 7 | 23 | 8 | 15 | null | null |
kowey/pandoc-old | src/Text/Pandoc/Writers/HTML.hs | gpl-2.0 | blockToHtml _ (RawHtml str) = return $ primHtml str | 51 | blockToHtml _ (RawHtml str) = return $ primHtml str | 51 | blockToHtml _ (RawHtml str) = return $ primHtml str | 51 | false | false | 0 | 7 | 8 | 24 | 11 | 13 | null | null |
catseye/ZOWIE | impl/zowie-hs/src/Language/ZOWIE/Parser.hs | unlicense | comment = do
spaces
string ";"
many $ satisfy (\x -> x /= '\n') | 75 | comment = do
spaces
string ";"
many $ satisfy (\x -> x /= '\n') | 75 | comment = do
spaces
string ";"
many $ satisfy (\x -> x /= '\n') | 75 | false | false | 1 | 12 | 25 | 41 | 17 | 24 | null | null |
matonix/pfds | src/PFDS/Sec3/Ex4b.hs | bsd-3-clause | -- 演習問題 3.3
fromList :: Ord e => [e] -> WLHeap e
fromList = loop . map (\x -> T 1 x E E) | 90 | fromList :: Ord e => [e] -> WLHeap e
fromList = loop . map (\x -> T 1 x E E) | 76 | fromList = loop . map (\x -> T 1 x E E) | 39 | true | true | 0 | 9 | 25 | 53 | 27 | 26 | null | null |
ml9951/ThreadScope | GUI/BookmarkView.hs | bsd-3-clause | bookmarkViewSetLabel :: BookmarkView -> Int -> String -> IO ()
bookmarkViewSetLabel BookmarkView{bookmarkStore} n label = do
(ts,_) <- listStoreGetValue bookmarkStore n
listStoreSetValue bookmarkStore n (ts, label)
--------------------------------------------------------------------------- | 295 | bookmarkViewSetLabel :: BookmarkView -> Int -> String -> IO ()
bookmarkViewSetLabel BookmarkView{bookmarkStore} n label = do
(ts,_) <- listStoreGetValue bookmarkStore n
listStoreSetValue bookmarkStore n (ts, label)
--------------------------------------------------------------------------- | 295 | bookmarkViewSetLabel BookmarkView{bookmarkStore} n label = do
(ts,_) <- listStoreGetValue bookmarkStore n
listStoreSetValue bookmarkStore n (ts, label)
--------------------------------------------------------------------------- | 232 | false | true | 0 | 9 | 31 | 76 | 38 | 38 | null | null |
telser/numerals | src-test/Text/Numeral/Language/LLD/TestData.hs | bsd-3-clause | --------------------------------------------------------------------------------
-- Test data
--------------------------------------------------------------------------------
-- Sources:
-- http://www.languagesandnumbers.com/how-to-count-in-ladin/en/lld/
cardinals ∷ (Integral i) ⇒ TestData i
cardinals =
[ ( "masculine"
, masculine defaultInflection
, [ (0, "zero")
, (1, "un")
, (2, "doi")
, (3, "trei")
, (4, "cater")
, (5, "cinch")
, (6, "sies")
, (7, "set")
, (8, "ot")
, (9, "nuef")
, (10, "diesc")
, (11, "undesc")
, (12, "dodesc")
, (13, "tredesc")
, (14, "catordesc")
, (15, "chindesc")
, (16, "seidesc")
, (17, "dejesset")
, (18, "dejedot")
, (19, "dejenuef")
, (20, "vint")
, (21, "vintun")
, (22, "vintedoi")
, (23, "vintetrei")
, (24, "vintecater")
, (25, "vintecinch")
, (26, "vintesies")
, (27, "vinteset")
, (28, "vintot")
, (29, "vintenuef")
, (30, "trenta")
, (31, "trentun")
, (32, "trentedoi")
, (33, "trentetrei")
, (34, "trentecater")
, (35, "trentecinch")
, (36, "trentesies")
, (37, "trenteset")
, (38, "trenteot")
, (39, "trentenuef")
, (40, "caranta")
, (41, "carantun")
, (42, "carantedoi")
, (43, "carantetrei")
, (44, "carantecater")
, (45, "carantecinch")
, (46, "carantesies")
, (47, "caranteset")
, (48, "carantot")
, (49, "carantenuef")
, (50, "cincanta")
, (51, "cincantun")
, (52, "cincantedoi")
, (53, "cincantetrei")
, (54, "cincantecater")
, (55, "cincantecinch")
, (56, "cincantesies")
, (57, "cincanteset")
, (58, "cincantot")
, (59, "cincantenuef")
, (60, "sessanta")
, (70, "setanta")
, (80, "otanta")
, (90, "nonanta")
, (100, "cent")
, (101, "centeun")
, (102, "centedoi")
, (103, "centetrei")
, (200, "doicent")
, (300, "treicent")
, (400, "catercent")
, (401, "catercenteun")
, (402, "catercentedoi")
, (403, "catercentetrei")
, (500, "cinchcent")
, (600, "siesçent")
, (700, "setcent")
, (800, "otcent")
, (900, "nuefcent")
, (999, "nuefcentenonantenuef")
, (1000, "mile")
, (1001, "mileun")
, (1100, "milecent")
, (1110, "milecentediesc")
, (1234, "miledoicentetrentecater")
, (2000, "doimile")
, (3000, "treimile")
, (4000, "catermile")
, (5000, "cinchmile")
, (5678, "cinchmilesiesçentesetantot")
, (6000, "siesmile")
, (7000, "setmile")
, (8000, "otmile")
, (9000, "nuefmile")
, (12345, "dodescmiletreicentecarantecinch")
, (dec 6, "un milion")
, (dec 6 + 1, "un milioneun")
, (2 ⋅ dec 6, "doi milion")
, (123456789, "centevintetrei milionecatercentecincantesiesmilesetcenteotantenuef")
, (dec 9, "un miliard")
, (2 ⋅ dec 9, "doi miliard")
, (9876543210, "nuef miliardeotcentesetantesies milionecinchcentecarantetreimiledoicentediesc")
, (9999999999, "nuef miliardenuefcentenonantenuef milionenuefcentenonantenuefmilenuefcentenonantenuef")
]
)
, ( "feminine"
, feminine defaultInflection
, [ (1, "una")
, (2, "does")
]
)
] | 3,436 | cardinals ∷ (Integral i) ⇒ TestData i
cardinals =
[ ( "masculine"
, masculine defaultInflection
, [ (0, "zero")
, (1, "un")
, (2, "doi")
, (3, "trei")
, (4, "cater")
, (5, "cinch")
, (6, "sies")
, (7, "set")
, (8, "ot")
, (9, "nuef")
, (10, "diesc")
, (11, "undesc")
, (12, "dodesc")
, (13, "tredesc")
, (14, "catordesc")
, (15, "chindesc")
, (16, "seidesc")
, (17, "dejesset")
, (18, "dejedot")
, (19, "dejenuef")
, (20, "vint")
, (21, "vintun")
, (22, "vintedoi")
, (23, "vintetrei")
, (24, "vintecater")
, (25, "vintecinch")
, (26, "vintesies")
, (27, "vinteset")
, (28, "vintot")
, (29, "vintenuef")
, (30, "trenta")
, (31, "trentun")
, (32, "trentedoi")
, (33, "trentetrei")
, (34, "trentecater")
, (35, "trentecinch")
, (36, "trentesies")
, (37, "trenteset")
, (38, "trenteot")
, (39, "trentenuef")
, (40, "caranta")
, (41, "carantun")
, (42, "carantedoi")
, (43, "carantetrei")
, (44, "carantecater")
, (45, "carantecinch")
, (46, "carantesies")
, (47, "caranteset")
, (48, "carantot")
, (49, "carantenuef")
, (50, "cincanta")
, (51, "cincantun")
, (52, "cincantedoi")
, (53, "cincantetrei")
, (54, "cincantecater")
, (55, "cincantecinch")
, (56, "cincantesies")
, (57, "cincanteset")
, (58, "cincantot")
, (59, "cincantenuef")
, (60, "sessanta")
, (70, "setanta")
, (80, "otanta")
, (90, "nonanta")
, (100, "cent")
, (101, "centeun")
, (102, "centedoi")
, (103, "centetrei")
, (200, "doicent")
, (300, "treicent")
, (400, "catercent")
, (401, "catercenteun")
, (402, "catercentedoi")
, (403, "catercentetrei")
, (500, "cinchcent")
, (600, "siesçent")
, (700, "setcent")
, (800, "otcent")
, (900, "nuefcent")
, (999, "nuefcentenonantenuef")
, (1000, "mile")
, (1001, "mileun")
, (1100, "milecent")
, (1110, "milecentediesc")
, (1234, "miledoicentetrentecater")
, (2000, "doimile")
, (3000, "treimile")
, (4000, "catermile")
, (5000, "cinchmile")
, (5678, "cinchmilesiesçentesetantot")
, (6000, "siesmile")
, (7000, "setmile")
, (8000, "otmile")
, (9000, "nuefmile")
, (12345, "dodescmiletreicentecarantecinch")
, (dec 6, "un milion")
, (dec 6 + 1, "un milioneun")
, (2 ⋅ dec 6, "doi milion")
, (123456789, "centevintetrei milionecatercentecincantesiesmilesetcenteotantenuef")
, (dec 9, "un miliard")
, (2 ⋅ dec 9, "doi miliard")
, (9876543210, "nuef miliardeotcentesetantesies milionecinchcentecarantetreimiledoicentediesc")
, (9999999999, "nuef miliardenuefcentenonantenuef milionenuefcentenonantenuefmilenuefcentenonantenuef")
]
)
, ( "feminine"
, feminine defaultInflection
, [ (1, "una")
, (2, "does")
]
)
] | 3,178 | cardinals =
[ ( "masculine"
, masculine defaultInflection
, [ (0, "zero")
, (1, "un")
, (2, "doi")
, (3, "trei")
, (4, "cater")
, (5, "cinch")
, (6, "sies")
, (7, "set")
, (8, "ot")
, (9, "nuef")
, (10, "diesc")
, (11, "undesc")
, (12, "dodesc")
, (13, "tredesc")
, (14, "catordesc")
, (15, "chindesc")
, (16, "seidesc")
, (17, "dejesset")
, (18, "dejedot")
, (19, "dejenuef")
, (20, "vint")
, (21, "vintun")
, (22, "vintedoi")
, (23, "vintetrei")
, (24, "vintecater")
, (25, "vintecinch")
, (26, "vintesies")
, (27, "vinteset")
, (28, "vintot")
, (29, "vintenuef")
, (30, "trenta")
, (31, "trentun")
, (32, "trentedoi")
, (33, "trentetrei")
, (34, "trentecater")
, (35, "trentecinch")
, (36, "trentesies")
, (37, "trenteset")
, (38, "trenteot")
, (39, "trentenuef")
, (40, "caranta")
, (41, "carantun")
, (42, "carantedoi")
, (43, "carantetrei")
, (44, "carantecater")
, (45, "carantecinch")
, (46, "carantesies")
, (47, "caranteset")
, (48, "carantot")
, (49, "carantenuef")
, (50, "cincanta")
, (51, "cincantun")
, (52, "cincantedoi")
, (53, "cincantetrei")
, (54, "cincantecater")
, (55, "cincantecinch")
, (56, "cincantesies")
, (57, "cincanteset")
, (58, "cincantot")
, (59, "cincantenuef")
, (60, "sessanta")
, (70, "setanta")
, (80, "otanta")
, (90, "nonanta")
, (100, "cent")
, (101, "centeun")
, (102, "centedoi")
, (103, "centetrei")
, (200, "doicent")
, (300, "treicent")
, (400, "catercent")
, (401, "catercenteun")
, (402, "catercentedoi")
, (403, "catercentetrei")
, (500, "cinchcent")
, (600, "siesçent")
, (700, "setcent")
, (800, "otcent")
, (900, "nuefcent")
, (999, "nuefcentenonantenuef")
, (1000, "mile")
, (1001, "mileun")
, (1100, "milecent")
, (1110, "milecentediesc")
, (1234, "miledoicentetrentecater")
, (2000, "doimile")
, (3000, "treimile")
, (4000, "catermile")
, (5000, "cinchmile")
, (5678, "cinchmilesiesçentesetantot")
, (6000, "siesmile")
, (7000, "setmile")
, (8000, "otmile")
, (9000, "nuefmile")
, (12345, "dodescmiletreicentecarantecinch")
, (dec 6, "un milion")
, (dec 6 + 1, "un milioneun")
, (2 ⋅ dec 6, "doi milion")
, (123456789, "centevintetrei milionecatercentecincantesiesmilesetcenteotantenuef")
, (dec 9, "un miliard")
, (2 ⋅ dec 9, "doi miliard")
, (9876543210, "nuef miliardeotcentesetantesies milionecinchcentecarantetreimiledoicentediesc")
, (9999999999, "nuef miliardenuefcentenonantenuef milionenuefcentenonantenuefmilenuefcentenonantenuef")
]
)
, ( "feminine"
, feminine defaultInflection
, [ (1, "una")
, (2, "does")
]
)
] | 3,140 | true | true | 0 | 11 | 1,035 | 1,036 | 677 | 359 | null | null |
MaxGabriel/yesod | yesod-core/Yesod/Core/Internal/Run.hs | mit | safeEh :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ())
-> ErrorResponse
-> YesodApp
safeEh log' er req = do
liftIO $ log' $(qLocation >>= liftLoc) "yesod-core" LevelError
$ toLogStr $ "Error handler errored out: " ++ show er
return $ YRPlain
H.status500
[]
typePlain
(toContent ("Internal Server Error" :: S.ByteString))
(reqSession req)
-- | Run a 'HandlerT' completely outside of Yesod. This
-- function comes with many caveats and you shouldn't use it
-- unless you fully understand what it's doing and how it works.
--
-- As of now, there's only one reason to use this function at
-- all: in order to run unit tests of functions inside 'HandlerT'
-- but that aren't easily testable with a full HTTP request.
-- Even so, it's better to use @wai-test@ or @yesod-test@ instead
-- of using this function.
--
-- This function will create a fake HTTP request (both @wai@'s
-- 'Request' and @yesod@'s 'Request') and feed it to the
-- @HandlerT@. The only useful information the @HandlerT@ may
-- get from the request is the session map, which you must supply
-- as argument to @runFakeHandler@. All other fields contain
-- fake information, which means that they can be accessed but
-- won't have any useful information. The response of the
-- @HandlerT@ is completely ignored, including changes to the
-- session, cookies or headers. We only return you the
-- @HandlerT@'s return value. | 1,468 | safeEh :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ())
-> ErrorResponse
-> YesodApp
safeEh log' er req = do
liftIO $ log' $(qLocation >>= liftLoc) "yesod-core" LevelError
$ toLogStr $ "Error handler errored out: " ++ show er
return $ YRPlain
H.status500
[]
typePlain
(toContent ("Internal Server Error" :: S.ByteString))
(reqSession req)
-- | Run a 'HandlerT' completely outside of Yesod. This
-- function comes with many caveats and you shouldn't use it
-- unless you fully understand what it's doing and how it works.
--
-- As of now, there's only one reason to use this function at
-- all: in order to run unit tests of functions inside 'HandlerT'
-- but that aren't easily testable with a full HTTP request.
-- Even so, it's better to use @wai-test@ or @yesod-test@ instead
-- of using this function.
--
-- This function will create a fake HTTP request (both @wai@'s
-- 'Request' and @yesod@'s 'Request') and feed it to the
-- @HandlerT@. The only useful information the @HandlerT@ may
-- get from the request is the session map, which you must supply
-- as argument to @runFakeHandler@. All other fields contain
-- fake information, which means that they can be accessed but
-- won't have any useful information. The response of the
-- @HandlerT@ is completely ignored, including changes to the
-- session, cookies or headers. We only return you the
-- @HandlerT@'s return value. | 1,468 | safeEh log' er req = do
liftIO $ log' $(qLocation >>= liftLoc) "yesod-core" LevelError
$ toLogStr $ "Error handler errored out: " ++ show er
return $ YRPlain
H.status500
[]
typePlain
(toContent ("Internal Server Error" :: S.ByteString))
(reqSession req)
-- | Run a 'HandlerT' completely outside of Yesod. This
-- function comes with many caveats and you shouldn't use it
-- unless you fully understand what it's doing and how it works.
--
-- As of now, there's only one reason to use this function at
-- all: in order to run unit tests of functions inside 'HandlerT'
-- but that aren't easily testable with a full HTTP request.
-- Even so, it's better to use @wai-test@ or @yesod-test@ instead
-- of using this function.
--
-- This function will create a fake HTTP request (both @wai@'s
-- 'Request' and @yesod@'s 'Request') and feed it to the
-- @HandlerT@. The only useful information the @HandlerT@ may
-- get from the request is the session map, which you must supply
-- as argument to @runFakeHandler@. All other fields contain
-- fake information, which means that they can be accessed but
-- won't have any useful information. The response of the
-- @HandlerT@ is completely ignored, including changes to the
-- session, cookies or headers. We only return you the
-- @HandlerT@'s return value. | 1,365 | false | true | 0 | 15 | 316 | 155 | 84 | 71 | null | null |
travitch/dalvik | src/Dalvik/AccessFlags.hs | bsd-3-clause | codeFlag AClass 0x00400 = ACC_ABSTRACT | 39 | codeFlag AClass 0x00400 = ACC_ABSTRACT | 39 | codeFlag AClass 0x00400 = ACC_ABSTRACT | 39 | false | false | 0 | 5 | 5 | 11 | 5 | 6 | null | null |
limdauto/learning-haskell | snippets/MonadTransformers.hs | mit | liftEither :: Either e a -> ExceptIO e a
liftEither x = ExceptIO (return x) | 75 | liftEither :: Either e a -> ExceptIO e a
liftEither x = ExceptIO (return x) | 75 | liftEither x = ExceptIO (return x) | 34 | false | true | 0 | 7 | 14 | 37 | 17 | 20 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 701 = 700 | 9 | 701 = 700 | 9 | 701 = 700 | 9 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
haskell-pkg-janitors/feed | Text/Feed/Constructor.hs | bsd-3-clause | feedFromXML :: XML.Element -> Feed.Types.Feed
feedFromXML f = XMLFeed f | 72 | feedFromXML :: XML.Element -> Feed.Types.Feed
feedFromXML f = XMLFeed f | 71 | feedFromXML f = XMLFeed f | 25 | false | true | 0 | 6 | 10 | 26 | 13 | 13 | null | null |
lubomir/dot-race | fay/DotRace/FFI.hs | bsd-3-clause | showCrashDialog :: Fay ()
showCrashDialog = showDialog "crash-dialog" | 69 | showCrashDialog :: Fay ()
showCrashDialog = showDialog "crash-dialog" | 69 | showCrashDialog = showDialog "crash-dialog" | 43 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
DougBurke/swish | tests/RDFGraphTest.hs | lgpl-2.1 | toNS :: T.Text -> String -> Namespace
toNS p = makeNamespace (Just p) . toURI | 77 | toNS :: T.Text -> String -> Namespace
toNS p = makeNamespace (Just p) . toURI | 77 | toNS p = makeNamespace (Just p) . toURI | 39 | false | true | 0 | 8 | 14 | 37 | 18 | 19 | null | null |
Erdwolf/autotool-bonn | server/gen/Package.hs | gpl-2.0 | base :: String
base = "de.htwk.autolat.Connector" | 49 | base :: String
base = "de.htwk.autolat.Connector" | 49 | base = "de.htwk.autolat.Connector" | 34 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
Tomoaki-Hashizaki/pesca | src/PrSequent.hs | gpl-2.0 | prArgList tt =
case tt of
[] -> ""
_ -> "(" ++ prTList "," tt ++ ")" | 78 | prArgList tt =
case tt of
[] -> ""
_ -> "(" ++ prTList "," tt ++ ")" | 78 | prArgList tt =
case tt of
[] -> ""
_ -> "(" ++ prTList "," tt ++ ")" | 78 | false | false | 0 | 10 | 27 | 40 | 19 | 21 | null | null |
tomahawkins/mecha | attic/Viewer.hs | bsd-3-clause | initState = State
{ leftButton = False
, middleButton = False
, rightButton = False
, theta = 45 * pi / 180
, phi = 30 * pi / 180
, scale' = 0.4
, theta' = 0
, phi' = 0
, x' = 0
, y' = 0
, i = 0
, j = 0
, i' = 0
, j' = 0
, running = True
} | 304 | initState = State
{ leftButton = False
, middleButton = False
, rightButton = False
, theta = 45 * pi / 180
, phi = 30 * pi / 180
, scale' = 0.4
, theta' = 0
, phi' = 0
, x' = 0
, y' = 0
, i = 0
, j = 0
, i' = 0
, j' = 0
, running = True
} | 304 | initState = State
{ leftButton = False
, middleButton = False
, rightButton = False
, theta = 45 * pi / 180
, phi = 30 * pi / 180
, scale' = 0.4
, theta' = 0
, phi' = 0
, x' = 0
, y' = 0
, i = 0
, j = 0
, i' = 0
, j' = 0
, running = True
} | 304 | false | false | 0 | 9 | 136 | 118 | 73 | 45 | null | null |
teuffy/interactive-brokers | library/API/IB/Monadic.hs | bsd-3-clause | -----------------------------------------------------------------------------
send :: ServiceIn -> IB Bool
send msg = do
req <- asks request -- use lens when Service updated
sent <- liftIO $ atomically $ M.send req msg
case msg of
IBRequest msg' -> do
when (sent && updateRequestId msg') $ ibsNextRequestId %= (+1)
return True
_ ->
return sent | 378 | send :: ServiceIn -> IB Bool
send msg = do
req <- asks request -- use lens when Service updated
sent <- liftIO $ atomically $ M.send req msg
case msg of
IBRequest msg' -> do
when (sent && updateRequestId msg') $ ibsNextRequestId %= (+1)
return True
_ ->
return sent | 299 | send msg = do
req <- asks request -- use lens when Service updated
sent <- liftIO $ atomically $ M.send req msg
case msg of
IBRequest msg' -> do
when (sent && updateRequestId msg') $ ibsNextRequestId %= (+1)
return True
_ ->
return sent | 270 | true | true | 0 | 17 | 86 | 114 | 53 | 61 | null | null |
bj4rtmar/sdl2 | src/SDL/Video/Renderer.hs | bsd-3-clause | getWindowSurface :: (Functor m, MonadIO m) => Window -> m Surface
getWindowSurface (Window w) =
fmap unmanagedSurface $
throwIfNull "SDL.Video.getWindowSurface" "SDL_GetWindowSurface" $
Raw.getWindowSurface w | 214 | getWindowSurface :: (Functor m, MonadIO m) => Window -> m Surface
getWindowSurface (Window w) =
fmap unmanagedSurface $
throwIfNull "SDL.Video.getWindowSurface" "SDL_GetWindowSurface" $
Raw.getWindowSurface w | 214 | getWindowSurface (Window w) =
fmap unmanagedSurface $
throwIfNull "SDL.Video.getWindowSurface" "SDL_GetWindowSurface" $
Raw.getWindowSurface w | 148 | false | true | 0 | 7 | 29 | 69 | 31 | 38 | null | null |
fpco/cabal | cabal-install/Distribution/Client/Config.hs | bsd-3-clause | initialSavedConfig :: IO SavedConfig
initialSavedConfig = do
cacheDir <- defaultCacheDir
logsDir <- defaultLogsDir
worldFile <- defaultWorldFile
extraPath <- defaultExtraPath
return mempty {
savedGlobalFlags = mempty {
globalCacheDir = toFlag cacheDir,
globalRemoteRepos = [defaultRemoteRepo],
globalWorldFile = toFlag worldFile
},
savedConfigureFlags = mempty {
configProgramPathExtra = extraPath
},
savedInstallFlags = mempty {
installSummaryFile = [toPathTemplate (logsDir </> "build.log")],
installBuildReports= toFlag AnonymousReports,
installNumJobs = toFlag Nothing
}
}
--TODO: misleading, there's no way to override this default
-- either make it possible or rename to simply getCabalDir. | 807 | initialSavedConfig :: IO SavedConfig
initialSavedConfig = do
cacheDir <- defaultCacheDir
logsDir <- defaultLogsDir
worldFile <- defaultWorldFile
extraPath <- defaultExtraPath
return mempty {
savedGlobalFlags = mempty {
globalCacheDir = toFlag cacheDir,
globalRemoteRepos = [defaultRemoteRepo],
globalWorldFile = toFlag worldFile
},
savedConfigureFlags = mempty {
configProgramPathExtra = extraPath
},
savedInstallFlags = mempty {
installSummaryFile = [toPathTemplate (logsDir </> "build.log")],
installBuildReports= toFlag AnonymousReports,
installNumJobs = toFlag Nothing
}
}
--TODO: misleading, there's no way to override this default
-- either make it possible or rename to simply getCabalDir. | 807 | initialSavedConfig = do
cacheDir <- defaultCacheDir
logsDir <- defaultLogsDir
worldFile <- defaultWorldFile
extraPath <- defaultExtraPath
return mempty {
savedGlobalFlags = mempty {
globalCacheDir = toFlag cacheDir,
globalRemoteRepos = [defaultRemoteRepo],
globalWorldFile = toFlag worldFile
},
savedConfigureFlags = mempty {
configProgramPathExtra = extraPath
},
savedInstallFlags = mempty {
installSummaryFile = [toPathTemplate (logsDir </> "build.log")],
installBuildReports= toFlag AnonymousReports,
installNumJobs = toFlag Nothing
}
}
--TODO: misleading, there's no way to override this default
-- either make it possible or rename to simply getCabalDir. | 770 | false | true | 0 | 15 | 194 | 146 | 80 | 66 | null | null |
mzini/qlogic | Qlogic/SatSolver.hs | gpl-3.0 | addNegatively' (p,_) fm@(Maj a b c) = do aneg <- addNegatively a >>= negateELit
bneg <- addNegatively b >>= negateELit
cneg <- addNegatively c >>= negateELit
addLitClause $ Clause [p, aneg, bneg]
addLitClause $ Clause [p, aneg, cneg]
addLitClause $ Clause [p, bneg, cneg]
return p | 526 | addNegatively' (p,_) fm@(Maj a b c) = do aneg <- addNegatively a >>= negateELit
bneg <- addNegatively b >>= negateELit
cneg <- addNegatively c >>= negateELit
addLitClause $ Clause [p, aneg, bneg]
addLitClause $ Clause [p, aneg, cneg]
addLitClause $ Clause [p, bneg, cneg]
return p | 526 | addNegatively' (p,_) fm@(Maj a b c) = do aneg <- addNegatively a >>= negateELit
bneg <- addNegatively b >>= negateELit
cneg <- addNegatively c >>= negateELit
addLitClause $ Clause [p, aneg, bneg]
addLitClause $ Clause [p, aneg, cneg]
addLitClause $ Clause [p, bneg, cneg]
return p | 526 | false | false | 0 | 9 | 291 | 135 | 66 | 69 | null | null |
ardumont/haskell-lab | src/Tree/BinarySearchTree.hs | gpl-2.0 | deleteMax (Node x _ Empty) = (Just x, Empty) | 44 | deleteMax (Node x _ Empty) = (Just x, Empty) | 44 | deleteMax (Node x _ Empty) = (Just x, Empty) | 44 | false | false | 0 | 6 | 8 | 29 | 14 | 15 | null | null |
ribag/ganeti-experiments | src/Ganeti/HTools/Program/Hscan.hs | gpl-2.0 | main :: Options -> [String] -> IO ()
main opts clusters = do
let local = "LOCAL"
let nlen = if null clusters
then length local
else maximum . map length $ clusters
unless (optNoHeaders opts) $
printf "%-*s %5s %5s %5s %5s %6s %6s %6s %6s %10s\n" nlen
"Name" "Nodes" "Inst" "BNode" "BInst" "t_mem" "f_mem"
"t_disk" "f_disk" "Score"
when (null clusters) $ do
def_socket <- Path.defaultQuerySocket
let lsock = fromMaybe def_socket (optLuxi opts)
let name = local
input_data <- Luxi.loadData lsock
result <- writeData nlen name opts input_data
unless result . exitWith $ ExitFailure 2
results <- mapM (\name -> Rapi.loadData name >>= writeData nlen name opts)
clusters
unless (and results) $ exitWith (ExitFailure 2) | 862 | main :: Options -> [String] -> IO ()
main opts clusters = do
let local = "LOCAL"
let nlen = if null clusters
then length local
else maximum . map length $ clusters
unless (optNoHeaders opts) $
printf "%-*s %5s %5s %5s %5s %6s %6s %6s %6s %10s\n" nlen
"Name" "Nodes" "Inst" "BNode" "BInst" "t_mem" "f_mem"
"t_disk" "f_disk" "Score"
when (null clusters) $ do
def_socket <- Path.defaultQuerySocket
let lsock = fromMaybe def_socket (optLuxi opts)
let name = local
input_data <- Luxi.loadData lsock
result <- writeData nlen name opts input_data
unless result . exitWith $ ExitFailure 2
results <- mapM (\name -> Rapi.loadData name >>= writeData nlen name opts)
clusters
unless (and results) $ exitWith (ExitFailure 2) | 862 | main opts clusters = do
let local = "LOCAL"
let nlen = if null clusters
then length local
else maximum . map length $ clusters
unless (optNoHeaders opts) $
printf "%-*s %5s %5s %5s %5s %6s %6s %6s %6s %10s\n" nlen
"Name" "Nodes" "Inst" "BNode" "BInst" "t_mem" "f_mem"
"t_disk" "f_disk" "Score"
when (null clusters) $ do
def_socket <- Path.defaultQuerySocket
let lsock = fromMaybe def_socket (optLuxi opts)
let name = local
input_data <- Luxi.loadData lsock
result <- writeData nlen name opts input_data
unless result . exitWith $ ExitFailure 2
results <- mapM (\name -> Rapi.loadData name >>= writeData nlen name opts)
clusters
unless (and results) $ exitWith (ExitFailure 2) | 825 | false | true | 10 | 11 | 265 | 256 | 126 | 130 | null | null |
iand675/disruptor | src/Data/CheckedException.hs | mit | -- | Use this in places where all the @Union@ed options have been exhausted.
typesExhausted :: Union '[] -> a
typesExhausted = error "Union types exhausted - empty Union" | 170 | typesExhausted :: Union '[] -> a
typesExhausted = error "Union types exhausted - empty Union" | 93 | typesExhausted = error "Union types exhausted - empty Union" | 60 | true | true | 0 | 9 | 28 | 32 | 14 | 18 | null | null |
andrew-m-h/libmu-HS | src/LibMu/MuPrelude.hs | bsd-3-clause | uptr_void = UvmTypeDef "uptr.void" (UPtr void) | 46 | uptr_void = UvmTypeDef "uptr.void" (UPtr void) | 46 | uptr_void = UvmTypeDef "uptr.void" (UPtr void) | 46 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
gdetrez/gf-predictability | src/GF/Predictability/Experiments.hs | gpl-3.0 | m2 = sum . take 2 . distribution | 32 | m2 = sum . take 2 . distribution | 32 | m2 = sum . take 2 . distribution | 32 | false | false | 1 | 7 | 7 | 21 | 8 | 13 | null | null |
open-etcs/openetcs-dmi | src/ETCS/DMI/Windows/MainWindow.hs | bsd-3-clause | fromButtonI _ 8 = ButtonMaintainShunting | 40 | fromButtonI _ 8 = ButtonMaintainShunting | 40 | fromButtonI _ 8 = ButtonMaintainShunting | 40 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
mdsteele/fallback | src/Fallback/Scenario/Compile.hs | gpl-3.0 | getMonsterScript :: ScenarioTriggers -> AreaTag -> MonsterScriptId
-> Grid.Entry Monster -> Script TownEffect ()
getMonsterScript scenario tag scriptId =
fromMaybe (fail ("no such monster script: " ++ show scriptId)) $
Map.lookup scriptId $ aspecMonsterScripts $ TM.get tag $
scenarioAreas scenario | 321 | getMonsterScript :: ScenarioTriggers -> AreaTag -> MonsterScriptId
-> Grid.Entry Monster -> Script TownEffect ()
getMonsterScript scenario tag scriptId =
fromMaybe (fail ("no such monster script: " ++ show scriptId)) $
Map.lookup scriptId $ aspecMonsterScripts $ TM.get tag $
scenarioAreas scenario | 321 | getMonsterScript scenario tag scriptId =
fromMaybe (fail ("no such monster script: " ++ show scriptId)) $
Map.lookup scriptId $ aspecMonsterScripts $ TM.get tag $
scenarioAreas scenario | 191 | false | true | 0 | 14 | 62 | 94 | 44 | 50 | null | null |
elliottt/hsopenid | src/Network/OpenID/Authentication.hs | bsd-3-clause | verifyWithAssociation :: Monad m
=> Params -> Association -> ExceptionT Error m ()
verifyWithAssociation ps a = do
mode <- lookupParam "openid.mode" ps
unless (mode == "id_res") $ raise $ Error $ "unexpected openid.mode: " ++ mode
sigParams <- breaks (',' ==) `fmap` lookupParam "openid.signed" ps
sig <- decode `fmap` lookupParam "openid.sig" ps
sps <- getSignedFields sigParams ps
let h = macHash (assocType a)
msg = map (toEnum . fromEnum) (formatDirectParams sps)
mc = HMAC.unsafeHMAC h (BS.pack (assocMacKey a)) (BS.pack msg)
sig' = case readHex mc of
[(x,"")] -> unroll x
_ -> []
unless (sig' == sig) $ raise $ Error "invalid signature" | 725 | verifyWithAssociation :: Monad m
=> Params -> Association -> ExceptionT Error m ()
verifyWithAssociation ps a = do
mode <- lookupParam "openid.mode" ps
unless (mode == "id_res") $ raise $ Error $ "unexpected openid.mode: " ++ mode
sigParams <- breaks (',' ==) `fmap` lookupParam "openid.signed" ps
sig <- decode `fmap` lookupParam "openid.sig" ps
sps <- getSignedFields sigParams ps
let h = macHash (assocType a)
msg = map (toEnum . fromEnum) (formatDirectParams sps)
mc = HMAC.unsafeHMAC h (BS.pack (assocMacKey a)) (BS.pack msg)
sig' = case readHex mc of
[(x,"")] -> unroll x
_ -> []
unless (sig' == sig) $ raise $ Error "invalid signature" | 725 | verifyWithAssociation ps a = do
mode <- lookupParam "openid.mode" ps
unless (mode == "id_res") $ raise $ Error $ "unexpected openid.mode: " ++ mode
sigParams <- breaks (',' ==) `fmap` lookupParam "openid.signed" ps
sig <- decode `fmap` lookupParam "openid.sig" ps
sps <- getSignedFields sigParams ps
let h = macHash (assocType a)
msg = map (toEnum . fromEnum) (formatDirectParams sps)
mc = HMAC.unsafeHMAC h (BS.pack (assocMacKey a)) (BS.pack msg)
sig' = case readHex mc of
[(x,"")] -> unroll x
_ -> []
unless (sig' == sig) $ raise $ Error "invalid signature" | 620 | false | true | 0 | 14 | 186 | 275 | 134 | 141 | null | null |
esmolanka/simple-pi | src/Language/SimplePi/Token.hs | bsd-3-clause | position :: LocatedBy p a -> p
position (L p _) = p | 51 | position :: LocatedBy p a -> p
position (L p _) = p | 51 | position (L p _) = p | 20 | false | true | 0 | 6 | 12 | 35 | 16 | 19 | null | null |
DougBurke/swish | src/Swish/RDF/Formatter/NTriples.hs | lgpl-2.1 | quoteT '\r' = "\\r" | 19 | quoteT '\r' = "\\r" | 19 | quoteT '\r' = "\\r" | 19 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
lukexi/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | getRegister' :: DynFlags -> Bool -> CmmExpr -> NatM Register
getRegister' dflags is32Bit (CmmReg reg)
= case reg of
CmmGlobal PicBaseReg
| is32Bit ->
-- on x86_64, we have %rip for PicBaseReg, but it's not
-- a full-featured register, it can only be used for
-- rip-relative addressing.
do reg' <- getPicBaseNat (archWordSize is32Bit)
return (Fixed (archWordSize is32Bit) reg' nilOL)
_ ->
do use_sse2 <- sse2Enabled
let
sz = cmmTypeSize (cmmRegType dflags reg)
size | not use_sse2 && isFloatSize sz = FF80
| otherwise = sz
--
let platform = targetPlatform dflags
return (Fixed size (getRegisterReg platform use_sse2 reg) nilOL) | 867 | getRegister' :: DynFlags -> Bool -> CmmExpr -> NatM Register
getRegister' dflags is32Bit (CmmReg reg)
= case reg of
CmmGlobal PicBaseReg
| is32Bit ->
-- on x86_64, we have %rip for PicBaseReg, but it's not
-- a full-featured register, it can only be used for
-- rip-relative addressing.
do reg' <- getPicBaseNat (archWordSize is32Bit)
return (Fixed (archWordSize is32Bit) reg' nilOL)
_ ->
do use_sse2 <- sse2Enabled
let
sz = cmmTypeSize (cmmRegType dflags reg)
size | not use_sse2 && isFloatSize sz = FF80
| otherwise = sz
--
let platform = targetPlatform dflags
return (Fixed size (getRegisterReg platform use_sse2 reg) nilOL) | 866 | getRegister' dflags is32Bit (CmmReg reg)
= case reg of
CmmGlobal PicBaseReg
| is32Bit ->
-- on x86_64, we have %rip for PicBaseReg, but it's not
-- a full-featured register, it can only be used for
-- rip-relative addressing.
do reg' <- getPicBaseNat (archWordSize is32Bit)
return (Fixed (archWordSize is32Bit) reg' nilOL)
_ ->
do use_sse2 <- sse2Enabled
let
sz = cmmTypeSize (cmmRegType dflags reg)
size | not use_sse2 && isFloatSize sz = FF80
| otherwise = sz
--
let platform = targetPlatform dflags
return (Fixed size (getRegisterReg platform use_sse2 reg) nilOL) | 805 | false | true | 0 | 18 | 339 | 206 | 94 | 112 | null | null |
avieth/diplomacy | Diplomacy/OrderResolution.hs | bsd-3-clause | typicalResolution
:: M.Map Zone (Aligned Unit, SomeOrderObject Typical)
-> Resolution Typical
typicalResolution = dropAssumptionTags . typicalResolutionAssuming . noAssumptions | 184 | typicalResolution
:: M.Map Zone (Aligned Unit, SomeOrderObject Typical)
-> Resolution Typical
typicalResolution = dropAssumptionTags . typicalResolutionAssuming . noAssumptions | 184 | typicalResolution = dropAssumptionTags . typicalResolutionAssuming . noAssumptions | 82 | false | true | 0 | 9 | 25 | 51 | 23 | 28 | null | null |
nakamuray/htig | HTIG/Core.hs | bsd-3-clause | runHook :: StatusHook -> MessageContext -> Status -> HTIG (Maybe Status)
runHook h ctx st = do
f <- runQuery h ctx
appEndo f (return $ Just st) | 151 | runHook :: StatusHook -> MessageContext -> Status -> HTIG (Maybe Status)
runHook h ctx st = do
f <- runQuery h ctx
appEndo f (return $ Just st) | 151 | runHook h ctx st = do
f <- runQuery h ctx
appEndo f (return $ Just st) | 78 | false | true | 0 | 10 | 35 | 69 | 32 | 37 | null | null |
tdammers/ginger | test/Text/Ginger/PropertyTests.hs | mit | roundTripGValExP :: (ToGVal Identity a, FromGVal Identity a)
=> (a -> a -> Bool)
-> a
-> Bool
roundTripGValExP cmp orig =
let g :: GVal Identity
g = toGVal orig
in case fromGVal g of
Nothing -> False
Just final -> cmp orig final | 305 | roundTripGValExP :: (ToGVal Identity a, FromGVal Identity a)
=> (a -> a -> Bool)
-> a
-> Bool
roundTripGValExP cmp orig =
let g :: GVal Identity
g = toGVal orig
in case fromGVal g of
Nothing -> False
Just final -> cmp orig final | 305 | roundTripGValExP cmp orig =
let g :: GVal Identity
g = toGVal orig
in case fromGVal g of
Nothing -> False
Just final -> cmp orig final | 166 | false | true | 0 | 10 | 121 | 103 | 50 | 53 | null | null |
johnbcoughlin/locus | src/SnapUtil.hs | mit | finishWithError :: MonadSnap m => (Response -> Response) -> m a
finishWithError error = modifyResponse error >> (getResponse >>= finishWith) | 140 | finishWithError :: MonadSnap m => (Response -> Response) -> m a
finishWithError error = modifyResponse error >> (getResponse >>= finishWith) | 140 | finishWithError error = modifyResponse error >> (getResponse >>= finishWith) | 76 | false | true | 0 | 8 | 19 | 49 | 24 | 25 | null | null |
urbanslug/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | isVecExpr (CmmMachOp (MO_VF_Insert {}) _) = True | 49 | isVecExpr (CmmMachOp (MO_VF_Insert {}) _) = True | 49 | isVecExpr (CmmMachOp (MO_VF_Insert {}) _) = True | 49 | false | false | 0 | 9 | 7 | 24 | 12 | 12 | null | null |
josefs/MiniDSL | Feldspar/Core.hs | bsd-3-clause | newVar (Var v) = 0 | 27 | newVar (Var v) = 0 | 27 | newVar (Var v) = 0 | 27 | false | false | 0 | 6 | 13 | 16 | 7 | 9 | null | null |
hvr/containers | Data/Set/Base.hs | bsd-3-clause | isSubsetOfX (Bin _ x l r) t
= found && isSubsetOfX l lt && isSubsetOfX r gt
where
(lt,found,gt) = splitMember x t
#if __GLASGOW_HASKELL__ >= 700
| 153 | isSubsetOfX (Bin _ x l r) t
= found && isSubsetOfX l lt && isSubsetOfX r gt
where
(lt,found,gt) = splitMember x t
#if __GLASGOW_HASKELL__ >= 700
| 153 | isSubsetOfX (Bin _ x l r) t
= found && isSubsetOfX l lt && isSubsetOfX r gt
where
(lt,found,gt) = splitMember x t
#if __GLASGOW_HASKELL__ >= 700
| 153 | false | false | 0 | 7 | 35 | 65 | 32 | 33 | null | null |
eigengrau/haskell-ircbot | Network/IRC/Bot/Part/Dice.hs | bsd-3-clause | diceCommand :: (BotMonad m) => ParsecT ByteString () m ()
diceCommand =
do try $ botPrefix >> string "dice"
logM Debug "dicePart"
target <- maybeZero =<< replyTo
(numDice, numSides, modifier) <- (do
skipMany1 space
nd <- nat <|> return 1
if nd > 100
then fail "You can not roll more than 100 dice."
else do
char 'd'
ns <- (do n <- nat
if n > 0
then return n
else fail "The dice must have at least 1 side"
)
mod <- (do char '+' >> nat) <|> return 0
return (nd, ns, mod)) <?> "dice <num-dice>d<num-sides>[+<modifier>]"
rolls <- liftIO $ replicateM (fromIntegral numDice) $ randomRIO (1, numSides)
let results = "You rolled " ++ show numDice ++ " " ++ show numSides ++ "-sided dice with a +" ++ show modifier ++ " modifier: " ++ show rolls ++ " => " ++ show (sum (modifier : rolls))
sendCommand (PrivMsg Nothing [target] (pack results))
<|> return () | 1,098 | diceCommand :: (BotMonad m) => ParsecT ByteString () m ()
diceCommand =
do try $ botPrefix >> string "dice"
logM Debug "dicePart"
target <- maybeZero =<< replyTo
(numDice, numSides, modifier) <- (do
skipMany1 space
nd <- nat <|> return 1
if nd > 100
then fail "You can not roll more than 100 dice."
else do
char 'd'
ns <- (do n <- nat
if n > 0
then return n
else fail "The dice must have at least 1 side"
)
mod <- (do char '+' >> nat) <|> return 0
return (nd, ns, mod)) <?> "dice <num-dice>d<num-sides>[+<modifier>]"
rolls <- liftIO $ replicateM (fromIntegral numDice) $ randomRIO (1, numSides)
let results = "You rolled " ++ show numDice ++ " " ++ show numSides ++ "-sided dice with a +" ++ show modifier ++ " modifier: " ++ show rolls ++ " => " ++ show (sum (modifier : rolls))
sendCommand (PrivMsg Nothing [target] (pack results))
<|> return () | 1,098 | diceCommand =
do try $ botPrefix >> string "dice"
logM Debug "dicePart"
target <- maybeZero =<< replyTo
(numDice, numSides, modifier) <- (do
skipMany1 space
nd <- nat <|> return 1
if nd > 100
then fail "You can not roll more than 100 dice."
else do
char 'd'
ns <- (do n <- nat
if n > 0
then return n
else fail "The dice must have at least 1 side"
)
mod <- (do char '+' >> nat) <|> return 0
return (nd, ns, mod)) <?> "dice <num-dice>d<num-sides>[+<modifier>]"
rolls <- liftIO $ replicateM (fromIntegral numDice) $ randomRIO (1, numSides)
let results = "You rolled " ++ show numDice ++ " " ++ show numSides ++ "-sided dice with a +" ++ show modifier ++ " modifier: " ++ show rolls ++ " => " ++ show (sum (modifier : rolls))
sendCommand (PrivMsg Nothing [target] (pack results))
<|> return () | 1,040 | false | true | 3 | 21 | 410 | 362 | 170 | 192 | null | null |
utky/openflow | src/Network/OpenFlow/Encode.hs | bsd-3-clause | encode :: OfpMessage -> B.ByteString
encode = undefined | 55 | encode :: OfpMessage -> B.ByteString
encode = undefined | 55 | encode = undefined | 18 | false | true | 0 | 6 | 7 | 17 | 9 | 8 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/playpen/interview/zalora/src/Interview.hs | unlicense | uhb :: IO Bool
uhb = sendUpdate u
where
u = do
dc <- prefix "dc" (iriRef "http://purl.org/dc/elements/1.1/")
ex <- prefix "ex" (iriRef "http://example/")
ut1 <- updateTriple (ex .:. "book1") (dc .:. "title") (T.pack "A HASKELL book")
ut2 <- updateTriple (ex .:. "book1") (dc .:. "title") (T.pack "Another HASKELL book")
ut3 <- updateTriple (ex .:. "book1") (dc .:. "title") (T.pack "Yet another HASKELL book")
return UpdateQuery { queryUpdate = [ut1,ut2,ut3] }
-- End of file. | 534 | uhb :: IO Bool
uhb = sendUpdate u
where
u = do
dc <- prefix "dc" (iriRef "http://purl.org/dc/elements/1.1/")
ex <- prefix "ex" (iriRef "http://example/")
ut1 <- updateTriple (ex .:. "book1") (dc .:. "title") (T.pack "A HASKELL book")
ut2 <- updateTriple (ex .:. "book1") (dc .:. "title") (T.pack "Another HASKELL book")
ut3 <- updateTriple (ex .:. "book1") (dc .:. "title") (T.pack "Yet another HASKELL book")
return UpdateQuery { queryUpdate = [ut1,ut2,ut3] }
-- End of file. | 534 | uhb = sendUpdate u
where
u = do
dc <- prefix "dc" (iriRef "http://purl.org/dc/elements/1.1/")
ex <- prefix "ex" (iriRef "http://example/")
ut1 <- updateTriple (ex .:. "book1") (dc .:. "title") (T.pack "A HASKELL book")
ut2 <- updateTriple (ex .:. "book1") (dc .:. "title") (T.pack "Another HASKELL book")
ut3 <- updateTriple (ex .:. "book1") (dc .:. "title") (T.pack "Yet another HASKELL book")
return UpdateQuery { queryUpdate = [ut1,ut2,ut3] }
-- End of file. | 519 | false | true | 1 | 12 | 132 | 197 | 96 | 101 | null | null |
limaner2002/EPC-tools | USACScripts/src/Scripts/AdminReview.hs | bsd-3-clause | form486ReviewConf = FullReviewConf form486Initial2017 form486Final2017 form486Solix2017 form486Usac2017 | 103 | form486ReviewConf = FullReviewConf form486Initial2017 form486Final2017 form486Solix2017 form486Usac2017 | 103 | form486ReviewConf = FullReviewConf form486Initial2017 form486Final2017 form486Solix2017 form486Usac2017 | 103 | false | false | 1 | 5 | 6 | 18 | 7 | 11 | null | null |
input-output-hk/cardano-sl-explorer | src/Pos/Explorer/Socket/App.hs | mit | notifierServer
:: (MonadIO m, WithLogger m, MonadCatch m, WithLogger m)
=> NotifierSettings
-> ConnectionsVar
-> m ()
notifierServer notifierSettings connVar = do
loggerName <- getLoggerName
let settings :: Settings
settings = toConfig notifierSettings loggerName
liftIO $ do
handler <- initialize waiAPI $ notifierHandler connVar loggerName
runSettings settings (addRequestCORSHeaders . app $ handler)
where
addRequestCORSHeaders :: Middleware
addRequestCORSHeaders = cors addCORSHeader
where
addCORSHeader :: Request -> Maybe CorsResourcePolicy
addCORSHeader _ = Just $ simpleCorsResourcePolicy
-- HTTP origins that are allowed in CORS requests.
-- Add more resources to the following list if needed.
{ corsOrigins = Just ([ "https://cardanoexplorer.com"
, "https://explorer.iohkdev.io"
, "http://localhost:3100"
], True)
}
app :: WaiMonad () -> Application
app sHandle req respond
| (elem "socket.io" $ pathInfo req) = toWaiApplication sHandle req respond
| otherwise = respond notFound
-- A simple response when the socket.io route isn't matched. This is on a separate
-- port then the main application.
notFound :: Response
notFound = responseLBS
status404
[("Content-Type", "text/plain")]
"404 - Not Found" | 1,684 | notifierServer
:: (MonadIO m, WithLogger m, MonadCatch m, WithLogger m)
=> NotifierSettings
-> ConnectionsVar
-> m ()
notifierServer notifierSettings connVar = do
loggerName <- getLoggerName
let settings :: Settings
settings = toConfig notifierSettings loggerName
liftIO $ do
handler <- initialize waiAPI $ notifierHandler connVar loggerName
runSettings settings (addRequestCORSHeaders . app $ handler)
where
addRequestCORSHeaders :: Middleware
addRequestCORSHeaders = cors addCORSHeader
where
addCORSHeader :: Request -> Maybe CorsResourcePolicy
addCORSHeader _ = Just $ simpleCorsResourcePolicy
-- HTTP origins that are allowed in CORS requests.
-- Add more resources to the following list if needed.
{ corsOrigins = Just ([ "https://cardanoexplorer.com"
, "https://explorer.iohkdev.io"
, "http://localhost:3100"
], True)
}
app :: WaiMonad () -> Application
app sHandle req respond
| (elem "socket.io" $ pathInfo req) = toWaiApplication sHandle req respond
| otherwise = respond notFound
-- A simple response when the socket.io route isn't matched. This is on a separate
-- port then the main application.
notFound :: Response
notFound = responseLBS
status404
[("Content-Type", "text/plain")]
"404 - Not Found" | 1,684 | notifierServer notifierSettings connVar = do
loggerName <- getLoggerName
let settings :: Settings
settings = toConfig notifierSettings loggerName
liftIO $ do
handler <- initialize waiAPI $ notifierHandler connVar loggerName
runSettings settings (addRequestCORSHeaders . app $ handler)
where
addRequestCORSHeaders :: Middleware
addRequestCORSHeaders = cors addCORSHeader
where
addCORSHeader :: Request -> Maybe CorsResourcePolicy
addCORSHeader _ = Just $ simpleCorsResourcePolicy
-- HTTP origins that are allowed in CORS requests.
-- Add more resources to the following list if needed.
{ corsOrigins = Just ([ "https://cardanoexplorer.com"
, "https://explorer.iohkdev.io"
, "http://localhost:3100"
], True)
}
app :: WaiMonad () -> Application
app sHandle req respond
| (elem "socket.io" $ pathInfo req) = toWaiApplication sHandle req respond
| otherwise = respond notFound
-- A simple response when the socket.io route isn't matched. This is on a separate
-- port then the main application.
notFound :: Response
notFound = responseLBS
status404
[("Content-Type", "text/plain")]
"404 - Not Found" | 1,550 | false | true | 4 | 16 | 636 | 296 | 146 | 150 | null | null |
mpickering/ghc-exactprint | tests/examples/ghc8/TH_repE3.hs | bsd-3-clause | consExpr :: ExpQ
consExpr = [| 4:5:6:[] |] | 42 | consExpr :: ExpQ
consExpr = [| 4:5:6:[] |] | 42 | consExpr = [| 4:5:6:[] |] | 25 | false | true | 0 | 4 | 7 | 14 | 9 | 5 | null | null |
EchoTeam/harlson | TelnetHandler.hs | bsd-2-clause | handleTelnet' :: (String -> IO String) -> SockAddr -> Handle -> IO ()
handleTelnet' runCmd sa h = do
hPutStrLn h "Ctrl-D to quit"
hPutStr h "> "
hFlush h
c <- hLookAhead h
unless (c == chr 4) $
do
cmd <- fmap strip $ hGetLine h
unless (cmd == ":q" || cmd == [chr 4]) $
do
out <- runCmd cmd
hPutStrLn h out
hPutStrLn h ""
handleTelnet' runCmd sa h | 496 | handleTelnet' :: (String -> IO String) -> SockAddr -> Handle -> IO ()
handleTelnet' runCmd sa h = do
hPutStrLn h "Ctrl-D to quit"
hPutStr h "> "
hFlush h
c <- hLookAhead h
unless (c == chr 4) $
do
cmd <- fmap strip $ hGetLine h
unless (cmd == ":q" || cmd == [chr 4]) $
do
out <- runCmd cmd
hPutStrLn h out
hPutStrLn h ""
handleTelnet' runCmd sa h | 496 | handleTelnet' runCmd sa h = do
hPutStrLn h "Ctrl-D to quit"
hPutStr h "> "
hFlush h
c <- hLookAhead h
unless (c == chr 4) $
do
cmd <- fmap strip $ hGetLine h
unless (cmd == ":q" || cmd == [chr 4]) $
do
out <- runCmd cmd
hPutStrLn h out
hPutStrLn h ""
handleTelnet' runCmd sa h | 426 | false | true | 0 | 15 | 222 | 181 | 79 | 102 | null | null |
weiningl/dataStructure | BinomialHeap.hs | bsd-3-clause | insert :: Ord a => a -> Heap a -> Heap a
insert x ts = insertTree t ts
where t = Node 1 x empty | 109 | insert :: Ord a => a -> Heap a -> Heap a
insert x ts = insertTree t ts
where t = Node 1 x empty | 109 | insert x ts = insertTree t ts
where t = Node 1 x empty | 68 | false | true | 0 | 8 | 39 | 56 | 26 | 30 | null | null |
rodrigo-machado/verigraph | src/library/Rewriting/DPO/TypedGraph.hs | gpl-3.0 | -- | Return the nodes deleted by a rule
deletedNodes :: TypedGraphRule a b -> [G.NodeId]
deletedNodes r = TGM.orphanTypedNodeIds (leftMorphism r) | 145 | deletedNodes :: TypedGraphRule a b -> [G.NodeId]
deletedNodes r = TGM.orphanTypedNodeIds (leftMorphism r) | 105 | deletedNodes r = TGM.orphanTypedNodeIds (leftMorphism r) | 56 | true | true | 0 | 7 | 21 | 40 | 20 | 20 | null | null |
ekmett/speculation | src/Control/Concurrent/Speculation/Foldable.hs | bsd-2-clause | or :: Foldable t => (Int -> Bool) -> t Bool -> Bool
or g = getAny . foldMap (Any . g) Any | 89 | or :: Foldable t => (Int -> Bool) -> t Bool -> Bool
or g = getAny . foldMap (Any . g) Any | 89 | or g = getAny . foldMap (Any . g) Any | 37 | false | true | 0 | 8 | 22 | 55 | 27 | 28 | null | null |
exercism/xhaskell | exercises/practice/linked-list/src/Deque.hs | mit | unshift :: Deque a -> a -> IO ()
unshift deque x = error "You need to implement this function." | 95 | unshift :: Deque a -> a -> IO ()
unshift deque x = error "You need to implement this function." | 95 | unshift deque x = error "You need to implement this function." | 62 | false | true | 0 | 8 | 19 | 35 | 16 | 19 | null | null |
GaloisInc/feed | Text/Feed/Constructor.hs | bsd-3-clause | filterChildren :: (XML.Element -> Bool) -> XML.Element -> XML.Element
filterChildren pre e =
case elContent e of
[] -> e
cs -> e { elContent = mapMaybe filterElt cs }
where
filterElt xe@(XML.Elem el)
| pre el = Just xe
| otherwise = Nothing
filterElt xe = Just xe | 305 | filterChildren :: (XML.Element -> Bool) -> XML.Element -> XML.Element
filterChildren pre e =
case elContent e of
[] -> e
cs -> e { elContent = mapMaybe filterElt cs }
where
filterElt xe@(XML.Elem el)
| pre el = Just xe
| otherwise = Nothing
filterElt xe = Just xe | 304 | filterChildren pre e =
case elContent e of
[] -> e
cs -> e { elContent = mapMaybe filterElt cs }
where
filterElt xe@(XML.Elem el)
| pre el = Just xe
| otherwise = Nothing
filterElt xe = Just xe | 234 | false | true | 2 | 9 | 90 | 128 | 60 | 68 | null | null |
projedi/type-inference-rank2 | src/ASUP.hs | bsd-3-clause | polyVarName :: String -> Int -> String
polyVarName x i = x ++ "_type_" ++ show i | 80 | polyVarName :: String -> Int -> String
polyVarName x i = x ++ "_type_" ++ show i | 80 | polyVarName x i = x ++ "_type_" ++ show i | 41 | false | true | 0 | 6 | 16 | 35 | 17 | 18 | null | null |
ancientlanguage/haskell-analysis | greek-script/app/ScriptQueries.hs | mit | queryWordExtraAccent :: ctx :* Word -> [[ExtraAccents]]
queryWordExtraAccent (_, w) = [toListOf (_wordAccent . _Just . _accentExtra) w] | 135 | queryWordExtraAccent :: ctx :* Word -> [[ExtraAccents]]
queryWordExtraAccent (_, w) = [toListOf (_wordAccent . _Just . _accentExtra) w] | 135 | queryWordExtraAccent (_, w) = [toListOf (_wordAccent . _Just . _accentExtra) w] | 79 | false | true | 0 | 9 | 17 | 53 | 29 | 24 | null | null |
sukwon0709/z3-haskell | src/Z3/Monad.hs | bsd-3-clause | -- | Rotate bits of /t1/ to the left /t2/ times.
--
-- Reference: <http://research.microsoft.com/en-us/um/redmond/projects/z3/group__capi.html#gaf46f1cb80e5a56044591a76e7c89e5e7>
mkExtRotateLeft :: MonadZ3 z3 => AST -> AST -> z3 AST
mkExtRotateLeft = liftFun2 Base.mkExtRotateLeft | 280 | mkExtRotateLeft :: MonadZ3 z3 => AST -> AST -> z3 AST
mkExtRotateLeft = liftFun2 Base.mkExtRotateLeft | 101 | mkExtRotateLeft = liftFun2 Base.mkExtRotateLeft | 47 | true | true | 0 | 8 | 29 | 37 | 19 | 18 | null | null |
ekmett/order-statistics | Statistics/Order.hs | bsd-3-clause | permille :: Fractional r => Rational -> L r
permille n = quantile (n/1000) | 74 | permille :: Fractional r => Rational -> L r
permille n = quantile (n/1000) | 74 | permille n = quantile (n/1000) | 30 | false | true | 0 | 7 | 13 | 38 | 18 | 20 | null | null |
alphalambda/hsmath | src/Learn/Geometry/Drawing.hs | gpl-2.0 | plot_resolution = 0.1 | 21 | plot_resolution = 0.1 | 21 | plot_resolution = 0.1 | 21 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
fpco/serial-bench | binary-0.4.3.1/src/Data/Binary/Builder.hs | bsd-3-clause | ------------------------------------------------------------------------
--
-- copied from Data.ByteString.Lazy
--
defaultSize :: Int
defaultSize = 32 * k - overhead
where k = 1024
overhead = 2 * sizeOf (undefined :: Int)
------------------------------------------------------------------------
-- | Sequence an IO operation on the buffer | 355 | defaultSize :: Int
defaultSize = 32 * k - overhead
where k = 1024
overhead = 2 * sizeOf (undefined :: Int)
------------------------------------------------------------------------
-- | Sequence an IO operation on the buffer | 239 | defaultSize = 32 * k - overhead
where k = 1024
overhead = 2 * sizeOf (undefined :: Int)
------------------------------------------------------------------------
-- | Sequence an IO operation on the buffer | 220 | true | true | 4 | 6 | 55 | 66 | 31 | 35 | null | null |
yav/parsimony | src/Parsimony/UserState.hs | bsd-2-clause | -- | Set the user state.
setUserState :: u -> ParserU u s ()
setUserState u = updateInput (\i -> i { userState = u }) | 130 | setUserState :: u -> ParserU u s ()
setUserState u = updateInput (\i -> i { userState = u }) | 103 | setUserState u = updateInput (\i -> i { userState = u }) | 61 | true | true | 0 | 9 | 38 | 47 | 25 | 22 | null | null |
AaronFriel/Iota | Data/Iota/Stateful/Text.hs | bsd-3-clause | -- Additional combinators
feedInnerS :: (IotaS a' b') => IotaResultS a' b' -> (IotaResultS a' b' -> a) -> Text -> Writer Builder a
feedInnerS s' s i = tell o >> return (s (flush, a, b, t))
where (o, a, b, t) = feedIotaS s' i
| 228 | feedInnerS :: (IotaS a' b') => IotaResultS a' b' -> (IotaResultS a' b' -> a) -> Text -> Writer Builder a
feedInnerS s' s i = tell o >> return (s (flush, a, b, t))
where (o, a, b, t) = feedIotaS s' i
| 201 | feedInnerS s' s i = tell o >> return (s (flush, a, b, t))
where (o, a, b, t) = feedIotaS s' i
| 96 | true | true | 0 | 10 | 50 | 117 | 61 | 56 | null | null |
stevedonnelly/haskell | code/Data/Tuple/Extensions.hs | mit | getters2 = (first2, second2) | 28 | getters2 = (first2, second2) | 28 | getters2 = (first2, second2) | 28 | false | false | 1 | 5 | 3 | 15 | 7 | 8 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.