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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
elginer/Delve | src/VMASTCompiler.hs | gpl-3.0 | -- Assign a bit of code to the variable n, and bind it to the local scope and the current object
remember_whole_scope :: Symbol -> [ Exp ]
remember_whole_scope n =
[ appl [ ast_var "AssignLocal" , Lit $ Int 0 , List [ ], ast_symbol n ]
, appl [ ast_var "RememberLocalLocal" , Lit $ Int 0 , List [ ast_symbol n ] ]
, appl [ ast_var "RememberObjLocal" , Lit $ Int 0 , List [ ast_symbol n ] ] ] | 403 | remember_whole_scope :: Symbol -> [ Exp ]
remember_whole_scope n =
[ appl [ ast_var "AssignLocal" , Lit $ Int 0 , List [ ], ast_symbol n ]
, appl [ ast_var "RememberLocalLocal" , Lit $ Int 0 , List [ ast_symbol n ] ]
, appl [ ast_var "RememberObjLocal" , Lit $ Int 0 , List [ ast_symbol n ] ] ] | 306 | remember_whole_scope n =
[ appl [ ast_var "AssignLocal" , Lit $ Int 0 , List [ ], ast_symbol n ]
, appl [ ast_var "RememberLocalLocal" , Lit $ Int 0 , List [ ast_symbol n ] ]
, appl [ ast_var "RememberObjLocal" , Lit $ Int 0 , List [ ast_symbol n ] ] ] | 264 | true | true | 0 | 10 | 94 | 126 | 64 | 62 | null | null |
alexander-at-github/eta | compiler/ETA/Utils/FiniteMap.hs | bsd-3-clause | deleteList :: Ord key => [key] -> Map key elt -> Map key elt
deleteList ks m = foldl (flip Map.delete) m ks | 107 | deleteList :: Ord key => [key] -> Map key elt -> Map key elt
deleteList ks m = foldl (flip Map.delete) m ks | 107 | deleteList ks m = foldl (flip Map.delete) m ks | 46 | false | true | 0 | 8 | 22 | 59 | 28 | 31 | null | null |
oldmanmike/ghc | compiler/parser/ApiAnnotation.hs | bsd-3-clause | unicodeAnn AnnRarrowtail = AnnRarrowtailU | 41 | unicodeAnn AnnRarrowtail = AnnRarrowtailU | 41 | unicodeAnn AnnRarrowtail = AnnRarrowtailU | 41 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
bb010g/aura | aura/lib/Aura/MakePkg.hs | gpl-3.0 | -- | Given the current user name, build the package of whatever
-- directory we're in.
makepkg :: Settings -> User -> IO (Either Failure (NonEmpty FilePath))
makepkg ss usr = make ss usr (proc cmd $ opts <> overwrite <> colour) >>= g
where
(cmd, opts) =
runStyle usr . map T.unpack . foldMap asFlag . makepkgFlagsOf $ buildConfigOf ss
g :: (ExitCode, LByteString, [a]) -> IO (Either Failure (NonEmpty a))
g (ExitSuccess, _, fs) = pure . note (Failure buildFail_9) $ NEL.nonEmpty fs
g (ExitFailure _, se, _) = do
unless (switch ss DontSuppressMakepkg) $ do
showError <- optionalPrompt ss buildFail_11
when showError $ BL.putStrLn se
pure . Left $ Failure buildFail_8
overwrite :: [String]
overwrite | switch ss ForceBuilding = ["-f"]
| otherwise = []
colour :: [String]
colour | shared ss (Colour Never) = ["--nocolor"]
| shared ss (Colour Always) = []
| isTerminal ss = []
| otherwise = ["--nocolor"]
-- | Actually build the package, guarding on exceptions.
-- Yields the filepaths of the built package tarballs. | 1,134 | makepkg :: Settings -> User -> IO (Either Failure (NonEmpty FilePath))
makepkg ss usr = make ss usr (proc cmd $ opts <> overwrite <> colour) >>= g
where
(cmd, opts) =
runStyle usr . map T.unpack . foldMap asFlag . makepkgFlagsOf $ buildConfigOf ss
g :: (ExitCode, LByteString, [a]) -> IO (Either Failure (NonEmpty a))
g (ExitSuccess, _, fs) = pure . note (Failure buildFail_9) $ NEL.nonEmpty fs
g (ExitFailure _, se, _) = do
unless (switch ss DontSuppressMakepkg) $ do
showError <- optionalPrompt ss buildFail_11
when showError $ BL.putStrLn se
pure . Left $ Failure buildFail_8
overwrite :: [String]
overwrite | switch ss ForceBuilding = ["-f"]
| otherwise = []
colour :: [String]
colour | shared ss (Colour Never) = ["--nocolor"]
| shared ss (Colour Always) = []
| isTerminal ss = []
| otherwise = ["--nocolor"]
-- | Actually build the package, guarding on exceptions.
-- Yields the filepaths of the built package tarballs. | 1,047 | makepkg ss usr = make ss usr (proc cmd $ opts <> overwrite <> colour) >>= g
where
(cmd, opts) =
runStyle usr . map T.unpack . foldMap asFlag . makepkgFlagsOf $ buildConfigOf ss
g :: (ExitCode, LByteString, [a]) -> IO (Either Failure (NonEmpty a))
g (ExitSuccess, _, fs) = pure . note (Failure buildFail_9) $ NEL.nonEmpty fs
g (ExitFailure _, se, _) = do
unless (switch ss DontSuppressMakepkg) $ do
showError <- optionalPrompt ss buildFail_11
when showError $ BL.putStrLn se
pure . Left $ Failure buildFail_8
overwrite :: [String]
overwrite | switch ss ForceBuilding = ["-f"]
| otherwise = []
colour :: [String]
colour | shared ss (Colour Never) = ["--nocolor"]
| shared ss (Colour Always) = []
| isTerminal ss = []
| otherwise = ["--nocolor"]
-- | Actually build the package, guarding on exceptions.
-- Yields the filepaths of the built package tarballs. | 976 | true | true | 2 | 12 | 294 | 425 | 201 | 224 | null | null |
SAdams601/HaRe | old/tools/base/lib/Monads/StateM.hs | bsd-3-clause | setSt_ :: F.HasState m F.Z s => s -> m ()
updSt = F.updSt F.this | 68 | setSt_ :: F.HasState m F.Z s => s -> m ()
updSt = F.updSt F.this | 67 | updSt = F.updSt F.this | 24 | false | true | 0 | 8 | 18 | 42 | 20 | 22 | null | null |
agocorona/RefSerialize | Data/RefSerialize/Parser.hs | bsd-3-clause | colon = symbol ":" | 28 | colon = symbol ":" | 28 | colon = symbol ":" | 28 | false | false | 1 | 5 | 13 | 13 | 4 | 9 | null | null |
mapr/impala | thirdparty/thrift-0.9.0/lib/hs/src/Thrift/Protocol.hs | apache-2.0 | skip :: (Protocol p, Transport t) => p t -> ThriftType -> IO ()
skip _ T_STOP = return () | 89 | skip :: (Protocol p, Transport t) => p t -> ThriftType -> IO ()
skip _ T_STOP = return () | 89 | skip _ T_STOP = return () | 25 | false | true | 0 | 10 | 19 | 57 | 26 | 31 | null | null |
mietek/stack | src/main/Main.hs | bsd-3-clause | updateCmd :: () -> GlobalOpts -> IO ()
updateCmd () go@GlobalOpts{..} = do
(manager,lc) <- loadConfigWithOpts go
runStackLoggingT manager globalLogLevel $
Docker.rerunWithOptionalContainer (lcConfig lc) (lcProjectRoot lc) $
runStackT manager globalLogLevel (lcConfig lc) $
getMinimalEnvOverride >>= Stack.PackageIndex.updateAllIndices
-- | Execute a command | 402 | updateCmd :: () -> GlobalOpts -> IO ()
updateCmd () go@GlobalOpts{..} = do
(manager,lc) <- loadConfigWithOpts go
runStackLoggingT manager globalLogLevel $
Docker.rerunWithOptionalContainer (lcConfig lc) (lcProjectRoot lc) $
runStackT manager globalLogLevel (lcConfig lc) $
getMinimalEnvOverride >>= Stack.PackageIndex.updateAllIndices
-- | Execute a command | 402 | updateCmd () go@GlobalOpts{..} = do
(manager,lc) <- loadConfigWithOpts go
runStackLoggingT manager globalLogLevel $
Docker.rerunWithOptionalContainer (lcConfig lc) (lcProjectRoot lc) $
runStackT manager globalLogLevel (lcConfig lc) $
getMinimalEnvOverride >>= Stack.PackageIndex.updateAllIndices
-- | Execute a command | 363 | false | true | 0 | 13 | 85 | 118 | 58 | 60 | null | null |
jmitchell/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | mapPDeclFC f g (PTransform fc safe l r) =
PTransform (f fc) safe (mapPTermFC f g l) (mapPTermFC f g r) | 106 | mapPDeclFC f g (PTransform fc safe l r) =
PTransform (f fc) safe (mapPTermFC f g l) (mapPTermFC f g r) | 106 | mapPDeclFC f g (PTransform fc safe l r) =
PTransform (f fc) safe (mapPTermFC f g l) (mapPTermFC f g r) | 106 | false | false | 0 | 7 | 24 | 60 | 29 | 31 | null | null |
wavewave/hxournal | lib/Application/HXournal/Type/Canvas.hs | bsd-2-clause | -- |
defaultEraserWCS :: WidthColorStyle
defaultEraserWCS = WidthColorStyle predefined_eraser_medium ColorWhite | 113 | defaultEraserWCS :: WidthColorStyle
defaultEraserWCS = WidthColorStyle predefined_eraser_medium ColorWhite | 106 | defaultEraserWCS = WidthColorStyle predefined_eraser_medium ColorWhite | 70 | true | true | 0 | 6 | 11 | 23 | 10 | 13 | null | null |
ksoda/scheme48 | src/Lib.hs | bsd-3-clause | showError :: LispError -> String
showError (UnboundVar message varname) =
message ++ ": " ++ varname | 102 | showError :: LispError -> String
showError (UnboundVar message varname) =
message ++ ": " ++ varname | 102 | showError (UnboundVar message varname) =
message ++ ": " ++ varname | 69 | false | true | 0 | 7 | 17 | 34 | 17 | 17 | null | null |
GaloisInc/saw-script | saw-core/src/Verifier/SAW/Conversion.hs | bsd-3-clause | asSuccLit :: Matcher Natural
asSuccLit = asCtor "Prelude.Succ" asAnyNatLit | 74 | asSuccLit :: Matcher Natural
asSuccLit = asCtor "Prelude.Succ" asAnyNatLit | 74 | asSuccLit = asCtor "Prelude.Succ" asAnyNatLit | 45 | false | true | 0 | 5 | 8 | 19 | 9 | 10 | null | null |
shinh/ags | be/fetcher/fernando.hs | gpl-2.0 | runCmds _ _ [] = "" | 19 | runCmds _ _ [] = "" | 19 | runCmds _ _ [] = "" | 19 | false | false | 2 | 5 | 5 | 18 | 6 | 12 | null | null |
spacekitteh/smcghc | compiler/cmm/CmmMachOp.hs | bsd-3-clause | comparisonResultRep :: DynFlags -> CmmType
comparisonResultRep = bWord | 70 | comparisonResultRep :: DynFlags -> CmmType
comparisonResultRep = bWord | 70 | comparisonResultRep = bWord | 27 | false | true | 0 | 7 | 7 | 22 | 9 | 13 | null | null |
alexander-at-github/eta | compiler/ETA/TypeCheck/TcRnTypes.hs | bsd-3-clause | pprCts :: Cts -> SDoc
pprCts cts = vcat (map ppr (bagToList cts)) | 65 | pprCts :: Cts -> SDoc
pprCts cts = vcat (map ppr (bagToList cts)) | 65 | pprCts cts = vcat (map ppr (bagToList cts)) | 43 | false | true | 0 | 9 | 12 | 38 | 18 | 20 | null | null |
galenhuntington/etr | Math/SignDet.hs | mit | getVect :: (Ord a, Reducible a) => (Poly a, [Poly a]) -> Ternary -> Int
getVect (ky, pl) r =
sturmQuery ky (deriv ky * product [ p^e | (p, e) <- zip pl (ternary r) ]) | 168 | getVect :: (Ord a, Reducible a) => (Poly a, [Poly a]) -> Ternary -> Int
getVect (ky, pl) r =
sturmQuery ky (deriv ky * product [ p^e | (p, e) <- zip pl (ternary r) ]) | 168 | getVect (ky, pl) r =
sturmQuery ky (deriv ky * product [ p^e | (p, e) <- zip pl (ternary r) ]) | 96 | false | true | 0 | 14 | 38 | 117 | 58 | 59 | null | null |
safrol/bwinf33-5pk | Aufgabe1.hs | gpl-2.0 | unfoldTree :: S.Set ([Bucket], [Bucket]) -> [String] -> ([Bucket], [Bucket]) -> Tree ([String], ([Bucket], [Bucket]))
unfoldTree xs ys b = let bs = decantateAll b
newxs = b `S.insert` xs `S.union` (S.fromList bs)
newys = show b : ys
in Node (newys, b)
(unfoldForest
(filter (`S.notMember` xs) bs)
newys
newxs) | 527 | unfoldTree :: S.Set ([Bucket], [Bucket]) -> [String] -> ([Bucket], [Bucket]) -> Tree ([String], ([Bucket], [Bucket]))
unfoldTree xs ys b = let bs = decantateAll b
newxs = b `S.insert` xs `S.union` (S.fromList bs)
newys = show b : ys
in Node (newys, b)
(unfoldForest
(filter (`S.notMember` xs) bs)
newys
newxs) | 527 | unfoldTree xs ys b = let bs = decantateAll b
newxs = b `S.insert` xs `S.union` (S.fromList bs)
newys = show b : ys
in Node (newys, b)
(unfoldForest
(filter (`S.notMember` xs) bs)
newys
newxs) | 409 | false | true | 0 | 12 | 267 | 178 | 100 | 78 | null | null |
brendanhay/gogol | gogol-androidmanagement/gen/Network/Google/Resource/AndroidManagement/Enterprises/Policies/Patch.hs | mpl-2.0 | -- | Multipart request metadata.
eppPayload :: Lens' EnterprisesPoliciesPatch Policy
eppPayload
= lens _eppPayload (\ s a -> s{_eppPayload = a}) | 146 | eppPayload :: Lens' EnterprisesPoliciesPatch Policy
eppPayload
= lens _eppPayload (\ s a -> s{_eppPayload = a}) | 113 | eppPayload
= lens _eppPayload (\ s a -> s{_eppPayload = a}) | 61 | true | true | 0 | 9 | 22 | 42 | 22 | 20 | null | null |
abakst/symmetry | checker/src/simple-parser/ConfigParser.hs | mit | s_lvarP = LV <$> identifier | 27 | s_lvarP = LV <$> identifier | 27 | s_lvarP = LV <$> identifier | 27 | false | false | 0 | 5 | 4 | 10 | 5 | 5 | null | null |
BartMassey/hgallery | Foundation.hs | agpl-3.0 | addFile :: App -> FileAssoc -> Handler ()
addFile state op = do
faid <- getNextId state
let op' = op { fileAssocId = faid }
liftIO $ atomically $
modifyTVar (appGalleries state) (M.insert faid op') | 207 | addFile :: App -> FileAssoc -> Handler ()
addFile state op = do
faid <- getNextId state
let op' = op { fileAssocId = faid }
liftIO $ atomically $
modifyTVar (appGalleries state) (M.insert faid op') | 207 | addFile state op = do
faid <- getNextId state
let op' = op { fileAssocId = faid }
liftIO $ atomically $
modifyTVar (appGalleries state) (M.insert faid op') | 165 | false | true | 0 | 12 | 45 | 93 | 43 | 50 | null | null |
fluffynukeit/FNIStash | src/FNIStash/File/General.hs | bsd-3-clause | getRecursiveContents :: FilePath -> IO [FilePath]
getRecursiveContents topdir = do
names <- getDirectoryContents topdir
let properNames = filter (`notElem` [".", ".."]) names
paths <- forM properNames $ \name -> do
let path = topdir </> name
isDirectory <- doesDirectoryExist path
if isDirectory
then getRecursiveContents path
else return [path]
return (concat paths) | 399 | getRecursiveContents :: FilePath -> IO [FilePath]
getRecursiveContents topdir = do
names <- getDirectoryContents topdir
let properNames = filter (`notElem` [".", ".."]) names
paths <- forM properNames $ \name -> do
let path = topdir </> name
isDirectory <- doesDirectoryExist path
if isDirectory
then getRecursiveContents path
else return [path]
return (concat paths) | 399 | getRecursiveContents topdir = do
names <- getDirectoryContents topdir
let properNames = filter (`notElem` [".", ".."]) names
paths <- forM properNames $ \name -> do
let path = topdir </> name
isDirectory <- doesDirectoryExist path
if isDirectory
then getRecursiveContents path
else return [path]
return (concat paths) | 349 | false | true | 0 | 15 | 82 | 134 | 65 | 69 | null | null |
brendanhay/gogol | gogol-cloudprivatecatalog/gen/Network/Google/CloudPrivateCatalog/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'GoogleCloudPrivatecatalogV1beta1SearchVersionsResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gcpvsvrNextPageToken'
--
-- * 'gcpvsvrVersions'
googleCloudPrivatecatalogV1beta1SearchVersionsResponse
:: GoogleCloudPrivatecatalogV1beta1SearchVersionsResponse
googleCloudPrivatecatalogV1beta1SearchVersionsResponse =
GoogleCloudPrivatecatalogV1beta1SearchVersionsResponse'
{_gcpvsvrNextPageToken = Nothing, _gcpvsvrVersions = Nothing} | 560 | googleCloudPrivatecatalogV1beta1SearchVersionsResponse
:: GoogleCloudPrivatecatalogV1beta1SearchVersionsResponse
googleCloudPrivatecatalogV1beta1SearchVersionsResponse =
GoogleCloudPrivatecatalogV1beta1SearchVersionsResponse'
{_gcpvsvrNextPageToken = Nothing, _gcpvsvrVersions = Nothing} | 297 | googleCloudPrivatecatalogV1beta1SearchVersionsResponse =
GoogleCloudPrivatecatalogV1beta1SearchVersionsResponse'
{_gcpvsvrNextPageToken = Nothing, _gcpvsvrVersions = Nothing} | 180 | true | true | 0 | 6 | 59 | 32 | 22 | 10 | null | null |
zaxtax/hsbib | Console.hs | gpl-2.0 | complete_string :: [String] -> String -> [String]
complete_string cmp s = filter (isInfixOf s) cmp | 98 | complete_string :: [String] -> String -> [String]
complete_string cmp s = filter (isInfixOf s) cmp | 98 | complete_string cmp s = filter (isInfixOf s) cmp | 48 | false | true | 0 | 7 | 14 | 41 | 21 | 20 | null | null |
Proclivis/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxPAPER_ENV_10 :: Int
wxPAPER_ENV_10 = 23 | 41 | wxPAPER_ENV_10 :: Int
wxPAPER_ENV_10 = 23 | 41 | wxPAPER_ENV_10 = 23 | 19 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ghorn/dynobud | dynobud/examples/EKF.hs | lgpl-3.0 | plotTrajectory :: [(Double, SpringX Double, KFState SpringX)] -> IO ()
plotTrajectory traj = do
let mkStatePlot :: (String, SpringX Double -> Double) -> StackedLayout Double
mkStatePlot (name, f) = StackedLayout layout
where
simulated :: PlotLines Double Double
simulated =
plot_lines_style . line_color .~ opaque blue
$ plot_lines_values .~ [map (\(t, x, _) -> (t, f x)) traj]
$ plot_lines_title .~ "simulated"
$ def
estimated :: PlotLines Double Double
estimated =
plot_lines_style . line_color .~ opaque red
$ plot_lines_values .~ [map (\(t, _, kf) -> (t, f (getState kf))) traj]
$ plot_lines_title .~ "estimated"
$ def
-- estimated' :: PlotPoints Double Double
-- estimated' =
-- plot_points_style .~ filledCircles 1 (opaque red)
-- $ plot_points_values .~ (map (\(t, _, kf) -> (t, f (getState kf))) traj)
-- $ plot_points_title .~ "estimated"
-- $ def
green1 = opaque $ sRGB 0.5 1 0.5
variance =
plot_fillbetween_style .~ solidFillStyle green1
$ plot_fillbetween_values .~ [ (t, (x - v, x + v))
| (t, _, kf) <- traj
, let x = f (getState kf)
v = f (getSigmas kf)
]
$ plot_fillbetween_title .~ "variance"
$ def
layout :: Layout Double Double
layout = layout_title .~ name
$ layout_plots .~ [ toPlot variance
-- , toPlot estimated'
, toPlot simulated
, toPlot estimated
]
$ def
slayouts :: StackedLayouts Double
slayouts = slayouts_compress_legend .~ False
$ slayouts_layouts .~
concat [ map mkStatePlot [("p", xPos), ("v", xVel)]
]
$ def
renderable :: Renderable ()
renderable = toRenderable slayouts
fileOptions :: FileOptions
fileOptions =
fo_format .~ SVG
$ fo_size .~ (600, 600)
$ def
path = "./kalman_filter.svg"
putStrLn $ "writing solution plot to " ++ show path
void $ renderableToFile fileOptions path renderable | 2,539 | plotTrajectory :: [(Double, SpringX Double, KFState SpringX)] -> IO ()
plotTrajectory traj = do
let mkStatePlot :: (String, SpringX Double -> Double) -> StackedLayout Double
mkStatePlot (name, f) = StackedLayout layout
where
simulated :: PlotLines Double Double
simulated =
plot_lines_style . line_color .~ opaque blue
$ plot_lines_values .~ [map (\(t, x, _) -> (t, f x)) traj]
$ plot_lines_title .~ "simulated"
$ def
estimated :: PlotLines Double Double
estimated =
plot_lines_style . line_color .~ opaque red
$ plot_lines_values .~ [map (\(t, _, kf) -> (t, f (getState kf))) traj]
$ plot_lines_title .~ "estimated"
$ def
-- estimated' :: PlotPoints Double Double
-- estimated' =
-- plot_points_style .~ filledCircles 1 (opaque red)
-- $ plot_points_values .~ (map (\(t, _, kf) -> (t, f (getState kf))) traj)
-- $ plot_points_title .~ "estimated"
-- $ def
green1 = opaque $ sRGB 0.5 1 0.5
variance =
plot_fillbetween_style .~ solidFillStyle green1
$ plot_fillbetween_values .~ [ (t, (x - v, x + v))
| (t, _, kf) <- traj
, let x = f (getState kf)
v = f (getSigmas kf)
]
$ plot_fillbetween_title .~ "variance"
$ def
layout :: Layout Double Double
layout = layout_title .~ name
$ layout_plots .~ [ toPlot variance
-- , toPlot estimated'
, toPlot simulated
, toPlot estimated
]
$ def
slayouts :: StackedLayouts Double
slayouts = slayouts_compress_legend .~ False
$ slayouts_layouts .~
concat [ map mkStatePlot [("p", xPos), ("v", xVel)]
]
$ def
renderable :: Renderable ()
renderable = toRenderable slayouts
fileOptions :: FileOptions
fileOptions =
fo_format .~ SVG
$ fo_size .~ (600, 600)
$ def
path = "./kalman_filter.svg"
putStrLn $ "writing solution plot to " ++ show path
void $ renderableToFile fileOptions path renderable | 2,539 | plotTrajectory traj = do
let mkStatePlot :: (String, SpringX Double -> Double) -> StackedLayout Double
mkStatePlot (name, f) = StackedLayout layout
where
simulated :: PlotLines Double Double
simulated =
plot_lines_style . line_color .~ opaque blue
$ plot_lines_values .~ [map (\(t, x, _) -> (t, f x)) traj]
$ plot_lines_title .~ "simulated"
$ def
estimated :: PlotLines Double Double
estimated =
plot_lines_style . line_color .~ opaque red
$ plot_lines_values .~ [map (\(t, _, kf) -> (t, f (getState kf))) traj]
$ plot_lines_title .~ "estimated"
$ def
-- estimated' :: PlotPoints Double Double
-- estimated' =
-- plot_points_style .~ filledCircles 1 (opaque red)
-- $ plot_points_values .~ (map (\(t, _, kf) -> (t, f (getState kf))) traj)
-- $ plot_points_title .~ "estimated"
-- $ def
green1 = opaque $ sRGB 0.5 1 0.5
variance =
plot_fillbetween_style .~ solidFillStyle green1
$ plot_fillbetween_values .~ [ (t, (x - v, x + v))
| (t, _, kf) <- traj
, let x = f (getState kf)
v = f (getSigmas kf)
]
$ plot_fillbetween_title .~ "variance"
$ def
layout :: Layout Double Double
layout = layout_title .~ name
$ layout_plots .~ [ toPlot variance
-- , toPlot estimated'
, toPlot simulated
, toPlot estimated
]
$ def
slayouts :: StackedLayouts Double
slayouts = slayouts_compress_legend .~ False
$ slayouts_layouts .~
concat [ map mkStatePlot [("p", xPos), ("v", xVel)]
]
$ def
renderable :: Renderable ()
renderable = toRenderable slayouts
fileOptions :: FileOptions
fileOptions =
fo_format .~ SVG
$ fo_size .~ (600, 600)
$ def
path = "./kalman_filter.svg"
putStrLn $ "writing solution plot to " ++ show path
void $ renderableToFile fileOptions path renderable | 2,468 | false | true | 0 | 23 | 1,090 | 573 | 304 | 269 | null | null |
kaoskorobase/hsndfile | Sound/File/Sndfile/Buffer.hs | lgpl-2.1 | hGetBuffer :: forall a e . (Sample e, Storable e, Buffer a e) => Handle -> Count -> IO (Maybe (a e))
hGetBuffer h n = do
fp <- mallocForeignPtrArray (nc * n)
n' <- withForeignPtr fp $ flip (hGetBuf h) n
if n' == 0
then return Nothing
else liftM Just $ fromForeignPtr fp 0 (nc * n')
where
nc = channels (hInfo h)
-- | Return the contents of a handle open for reading in a single buffer. | 426 | hGetBuffer :: forall a e . (Sample e, Storable e, Buffer a e) => Handle -> Count -> IO (Maybe (a e))
hGetBuffer h n = do
fp <- mallocForeignPtrArray (nc * n)
n' <- withForeignPtr fp $ flip (hGetBuf h) n
if n' == 0
then return Nothing
else liftM Just $ fromForeignPtr fp 0 (nc * n')
where
nc = channels (hInfo h)
-- | Return the contents of a handle open for reading in a single buffer. | 426 | hGetBuffer h n = do
fp <- mallocForeignPtrArray (nc * n)
n' <- withForeignPtr fp $ flip (hGetBuf h) n
if n' == 0
then return Nothing
else liftM Just $ fromForeignPtr fp 0 (nc * n')
where
nc = channels (hInfo h)
-- | Return the contents of a handle open for reading in a single buffer. | 325 | false | true | 1 | 13 | 120 | 174 | 83 | 91 | null | null |
lukexi/ghc | compiler/main/DynFlags.hs | bsd-3-clause | generateDynamicTooConditional :: MonadIO m
=> DynFlags -> m a -> m a -> m a -> m a
generateDynamicTooConditional dflags canGen cannotGen notTryingToGen
= if gopt Opt_BuildDynamicToo dflags
then do let ref = canGenerateDynamicToo dflags
b <- liftIO $ readIORef ref
if b then canGen else cannotGen
else notTryingToGen | 389 | generateDynamicTooConditional :: MonadIO m
=> DynFlags -> m a -> m a -> m a -> m a
generateDynamicTooConditional dflags canGen cannotGen notTryingToGen
= if gopt Opt_BuildDynamicToo dflags
then do let ref = canGenerateDynamicToo dflags
b <- liftIO $ readIORef ref
if b then canGen else cannotGen
else notTryingToGen | 389 | generateDynamicTooConditional dflags canGen cannotGen notTryingToGen
= if gopt Opt_BuildDynamicToo dflags
then do let ref = canGenerateDynamicToo dflags
b <- liftIO $ readIORef ref
if b then canGen else cannotGen
else notTryingToGen | 276 | false | true | 0 | 11 | 122 | 105 | 49 | 56 | null | null |
fmapfmapfmap/amazonka | gen/src/Gen/AST.hs | mpl-2.0 | renderShapes :: Config
-> Service Identity (RefF ()) (Shape Related) (Waiter Id)
-> Either Error (Service Identity SData SData WData)
renderShapes cfg svc = do
-- Generate unique prefixes for struct (product) members and
-- enum (sum) branches to avoid ambiguity.
(x, y) <- prefixes (svc ^. shapes)
-- Determine the appropriate Haskell AST type, auto deriveable instances,
-- and fully rendered instances.
>>= return . solve cfg
-- Separate the operation input/output shapes from the .Types shapes.
>>= separate (svc ^. operations)
-- Prune anything that is an orphan, or not an exception
let prune = Map.filter $ \s -> not (isOrphan s) || s ^. infoException
-- Convert shape ASTs into a rendered Haskell AST declaration,
xs <- traverse (operationData cfg svc) x
ys <- kvTraverseMaybe (const (shapeData svc)) (prune y)
zs <- Map.traverseWithKey (waiterData svc x) (svc ^. waiters)
return $! svc
{ _operations = xs
, _shapes = ys
, _waiters = zs
} | 1,102 | renderShapes :: Config
-> Service Identity (RefF ()) (Shape Related) (Waiter Id)
-> Either Error (Service Identity SData SData WData)
renderShapes cfg svc = do
-- Generate unique prefixes for struct (product) members and
-- enum (sum) branches to avoid ambiguity.
(x, y) <- prefixes (svc ^. shapes)
-- Determine the appropriate Haskell AST type, auto deriveable instances,
-- and fully rendered instances.
>>= return . solve cfg
-- Separate the operation input/output shapes from the .Types shapes.
>>= separate (svc ^. operations)
-- Prune anything that is an orphan, or not an exception
let prune = Map.filter $ \s -> not (isOrphan s) || s ^. infoException
-- Convert shape ASTs into a rendered Haskell AST declaration,
xs <- traverse (operationData cfg svc) x
ys <- kvTraverseMaybe (const (shapeData svc)) (prune y)
zs <- Map.traverseWithKey (waiterData svc x) (svc ^. waiters)
return $! svc
{ _operations = xs
, _shapes = ys
, _waiters = zs
} | 1,102 | renderShapes cfg svc = do
-- Generate unique prefixes for struct (product) members and
-- enum (sum) branches to avoid ambiguity.
(x, y) <- prefixes (svc ^. shapes)
-- Determine the appropriate Haskell AST type, auto deriveable instances,
-- and fully rendered instances.
>>= return . solve cfg
-- Separate the operation input/output shapes from the .Types shapes.
>>= separate (svc ^. operations)
-- Prune anything that is an orphan, or not an exception
let prune = Map.filter $ \s -> not (isOrphan s) || s ^. infoException
-- Convert shape ASTs into a rendered Haskell AST declaration,
xs <- traverse (operationData cfg svc) x
ys <- kvTraverseMaybe (const (shapeData svc)) (prune y)
zs <- Map.traverseWithKey (waiterData svc x) (svc ^. waiters)
return $! svc
{ _operations = xs
, _shapes = ys
, _waiters = zs
} | 942 | false | true | 0 | 16 | 313 | 268 | 136 | 132 | null | null |
beni55/bayes-stack | SharedTasteTest.hs | bsd-3-clause | -- | Input data to the model
stdata = STData { -- Content-enriched network
stNodes = S.fromList $ map Node [1..5]
, stFriendships = S.fromList $ map Friendship $
[ (Node 1, Node 2)
, (Node 2, Node 4)
, (Node 2, Node 3)
, (Node 4, Node 5)
, (Node 5, Node 1)
]
, stItems = S.fromList $ EM.keys vocabulary
, stNodeItems = setupNodeItems
$ concatMap (\(n,items)->map (\i->(n, revVocabulary M.! i)) items)
$ [ (Node 1, [ "cats", "crafts", "birds"
, "christmas", "flowers"
]
)
, (Node 2, [ "cats", "birds", "animals"
, "angels", "dragons", "horror"
, "vampires"
]
)
, (Node 3, [ "autism", "survival", "dragons"
, "vampires", "angels", "animals"
, "survival"
]
)
, (Node 4, [ "thriller", "historical", "horror"
, "non-fiction", "vampires", "fantasy"
]
)
, (Node 5, [ "vampires", "dragons", "angels"
, "horror", "fantasy", "thriller"
]
)
]
-- Hyper-parameters and such
, stAlphaGammaShared = alphaGammaShared
, stAlphaGammaOwn = 1 - alphaGammaShared
, stAlphaPsi = 0.1
, stAlphaLambda = 0.1
, stAlphaPhi = 0.1
, stAlphaOmega = 0.1
, stTopics = topics
} | 2,685 | stdata = STData { -- Content-enriched network
stNodes = S.fromList $ map Node [1..5]
, stFriendships = S.fromList $ map Friendship $
[ (Node 1, Node 2)
, (Node 2, Node 4)
, (Node 2, Node 3)
, (Node 4, Node 5)
, (Node 5, Node 1)
]
, stItems = S.fromList $ EM.keys vocabulary
, stNodeItems = setupNodeItems
$ concatMap (\(n,items)->map (\i->(n, revVocabulary M.! i)) items)
$ [ (Node 1, [ "cats", "crafts", "birds"
, "christmas", "flowers"
]
)
, (Node 2, [ "cats", "birds", "animals"
, "angels", "dragons", "horror"
, "vampires"
]
)
, (Node 3, [ "autism", "survival", "dragons"
, "vampires", "angels", "animals"
, "survival"
]
)
, (Node 4, [ "thriller", "historical", "horror"
, "non-fiction", "vampires", "fantasy"
]
)
, (Node 5, [ "vampires", "dragons", "angels"
, "horror", "fantasy", "thriller"
]
)
]
-- Hyper-parameters and such
, stAlphaGammaShared = alphaGammaShared
, stAlphaGammaOwn = 1 - alphaGammaShared
, stAlphaPsi = 0.1
, stAlphaLambda = 0.1
, stAlphaPhi = 0.1
, stAlphaOmega = 0.1
, stTopics = topics
} | 2,656 | stdata = STData { -- Content-enriched network
stNodes = S.fromList $ map Node [1..5]
, stFriendships = S.fromList $ map Friendship $
[ (Node 1, Node 2)
, (Node 2, Node 4)
, (Node 2, Node 3)
, (Node 4, Node 5)
, (Node 5, Node 1)
]
, stItems = S.fromList $ EM.keys vocabulary
, stNodeItems = setupNodeItems
$ concatMap (\(n,items)->map (\i->(n, revVocabulary M.! i)) items)
$ [ (Node 1, [ "cats", "crafts", "birds"
, "christmas", "flowers"
]
)
, (Node 2, [ "cats", "birds", "animals"
, "angels", "dragons", "horror"
, "vampires"
]
)
, (Node 3, [ "autism", "survival", "dragons"
, "vampires", "angels", "animals"
, "survival"
]
)
, (Node 4, [ "thriller", "historical", "horror"
, "non-fiction", "vampires", "fantasy"
]
)
, (Node 5, [ "vampires", "dragons", "angels"
, "horror", "fantasy", "thriller"
]
)
]
-- Hyper-parameters and such
, stAlphaGammaShared = alphaGammaShared
, stAlphaGammaOwn = 1 - alphaGammaShared
, stAlphaPsi = 0.1
, stAlphaLambda = 0.1
, stAlphaPhi = 0.1
, stAlphaOmega = 0.1
, stTopics = topics
} | 2,656 | true | false | 0 | 16 | 1,819 | 399 | 237 | 162 | null | null |
nightscape/platform | shared/src/Unison/Paths.hs | mit | modify :: Var v => (Target v -> Target (V v)) -> Path -> Target v -> Maybe (Target v)
modify f path t = focus path t >>= \(at,set,_) -> set (f at) | 146 | modify :: Var v => (Target v -> Target (V v)) -> Path -> Target v -> Maybe (Target v)
modify f path t = focus path t >>= \(at,set,_) -> set (f at) | 146 | modify f path t = focus path t >>= \(at,set,_) -> set (f at) | 60 | false | true | 0 | 11 | 33 | 100 | 49 | 51 | null | null |
djeik/goto | libgoto/Language/X86/HwTranslator.hs | mit | -- Its lifetime must encompass the ip.
-- | Calculates the total offset required for spills, and verifies which safe
-- registers are used throughout the function.
--
-- Returns a new version of the register pairings in which all spills have their
-- proper offset computed.
computeAllocState :: [RegisterPairing] -> HardwareTranslation label [RegisterPairing]
computeAllocState = foldl (\acc (v, h) -> do
acc' <- acc
case h of
Unassigned -> throwError $ InvariantViolation "A hardware location should\
\ have been assigned"
Mem _ -> do
let space = storageSize $ getVRegSize v
off <- gets _currentSpillOffset
modify $ \s -> s { _currentSpillOffset = off - space}
pure $ (v, Mem off):acc'
Reg r _ -> do
when (r `elem` safeRegisters)
$ modify $ \s -> s { _safeRegistersUsed = S.insert r $ _safeRegistersUsed s }
pure $ (v, h):acc'
) (pure []) | 1,023 | computeAllocState :: [RegisterPairing] -> HardwareTranslation label [RegisterPairing]
computeAllocState = foldl (\acc (v, h) -> do
acc' <- acc
case h of
Unassigned -> throwError $ InvariantViolation "A hardware location should\
\ have been assigned"
Mem _ -> do
let space = storageSize $ getVRegSize v
off <- gets _currentSpillOffset
modify $ \s -> s { _currentSpillOffset = off - space}
pure $ (v, Mem off):acc'
Reg r _ -> do
when (r `elem` safeRegisters)
$ modify $ \s -> s { _safeRegistersUsed = S.insert r $ _safeRegistersUsed s }
pure $ (v, h):acc'
) (pure []) | 746 | computeAllocState = foldl (\acc (v, h) -> do
acc' <- acc
case h of
Unassigned -> throwError $ InvariantViolation "A hardware location should\
\ have been assigned"
Mem _ -> do
let space = storageSize $ getVRegSize v
off <- gets _currentSpillOffset
modify $ \s -> s { _currentSpillOffset = off - space}
pure $ (v, Mem off):acc'
Reg r _ -> do
when (r `elem` safeRegisters)
$ modify $ \s -> s { _safeRegistersUsed = S.insert r $ _safeRegistersUsed s }
pure $ (v, h):acc'
) (pure []) | 660 | true | true | 0 | 21 | 325 | 244 | 125 | 119 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/book/2021-05-06-Algebra_Driven_Design-Sandy_Maguire/src/Lib.hs | unlicense | {-
∀ (t :: Tile).
flipH (flipH t) = t
∀ (t :: Tile).
flipH (cw (cw (flipH t)) = cw (cw t)
-}
{-
Exercise
Prove flipH . cw^{2*n} . flipH = cw^{2*n}, where the ^ operation means repeated composition. For example, cw^4 = cw . cw . cw . cw.
Horizontally flipping a clockwise rotation is equivalent to rotating counterclockwise a horizontal flip.
This law that cw to ccw under flipH transformation:
∀ (t :: Tile).
flipH (cw t) = ccw (flipH t)
-}
-- flipV(ertically)
flipV :: Tile -> Tile
flipV = undefined | 515 | flipV :: Tile -> Tile
flipV = undefined | 40 | flipV = undefined | 18 | true | true | 0 | 5 | 110 | 18 | 11 | 7 | null | null |
KaneTW/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | idemodeProcess fn (AddMissing False pos str) = process fn (AddMissing False pos str) | 84 | idemodeProcess fn (AddMissing False pos str) = process fn (AddMissing False pos str) | 84 | idemodeProcess fn (AddMissing False pos str) = process fn (AddMissing False pos str) | 84 | false | false | 0 | 7 | 12 | 36 | 17 | 19 | null | null |
danr/hipspec | examples/HOF.hs | gpl-3.0 | q f g = id . f . g =:= f . g | 28 | q f g = id . f . g =:= f . g | 28 | q f g = id . f . g =:= f . g | 28 | false | false | 4 | 5 | 12 | 34 | 13 | 21 | null | null |
rueshyna/gogol | gogol-youtube/gen/Network/Google/Resource/YouTube/PlayListItems/Update.hs | mpl-2.0 | -- | Note: This parameter is intended exclusively for YouTube content
-- partners. The onBehalfOfContentOwner parameter indicates that the
-- request\'s authorization credentials identify a YouTube CMS user who is
-- acting on behalf of the content owner specified in the parameter value.
-- This parameter is intended for YouTube content partners that own and
-- manage many different YouTube channels. It allows content owners to
-- authenticate once and get access to all their video and channel data,
-- without having to provide authentication credentials for each individual
-- channel. The CMS account that the user authenticates with must be linked
-- to the specified YouTube content owner.
pliuOnBehalfOfContentOwner :: Lens' PlayListItemsUpdate (Maybe Text)
pliuOnBehalfOfContentOwner
= lens _pliuOnBehalfOfContentOwner
(\ s a -> s{_pliuOnBehalfOfContentOwner = a}) | 884 | pliuOnBehalfOfContentOwner :: Lens' PlayListItemsUpdate (Maybe Text)
pliuOnBehalfOfContentOwner
= lens _pliuOnBehalfOfContentOwner
(\ s a -> s{_pliuOnBehalfOfContentOwner = a}) | 184 | pliuOnBehalfOfContentOwner
= lens _pliuOnBehalfOfContentOwner
(\ s a -> s{_pliuOnBehalfOfContentOwner = a}) | 115 | true | true | 0 | 8 | 133 | 58 | 34 | 24 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/course/2017-05-snoyman-applied-haskell-at-lambdaconf/E8ConcurrentFibsTVar.hs | unlicense | main :: IO ()
main = do
v1 <- newTVarIO (1 :: Int)
v2 <- newTVarIO (2 :: Int)
replicateConcurrently_ 7 (doit v1 v2)
readTVarIO v2 >>= print
where
doit v1 v2 = atomically $ do
v1' <- readTVar v1
v2' <- readTVar v2
writeTVar v1 v2'
writeTVar v2 (v1' + v2') | 282 | main :: IO ()
main = do
v1 <- newTVarIO (1 :: Int)
v2 <- newTVarIO (2 :: Int)
replicateConcurrently_ 7 (doit v1 v2)
readTVarIO v2 >>= print
where
doit v1 v2 = atomically $ do
v1' <- readTVar v1
v2' <- readTVar v2
writeTVar v1 v2'
writeTVar v2 (v1' + v2') | 282 | main = do
v1 <- newTVarIO (1 :: Int)
v2 <- newTVarIO (2 :: Int)
replicateConcurrently_ 7 (doit v1 v2)
readTVarIO v2 >>= print
where
doit v1 v2 = atomically $ do
v1' <- readTVar v1
v2' <- readTVar v2
writeTVar v1 v2'
writeTVar v2 (v1' + v2') | 268 | false | true | 3 | 10 | 79 | 145 | 62 | 83 | null | null |
MaxGabriel/yesod | yesod-bin/main.hs | mit | defaultRescan :: Int
defaultRescan = 10 | 39 | defaultRescan :: Int
defaultRescan = 10 | 39 | defaultRescan = 10 | 18 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
input-output-hk/pos-haskell-prototype | chain/test/Test/Pos/Chain/Txp/Bi.hs | mit | --------------------------------------------------------------------------------
-- TxInList
--------------------------------------------------------------------------------
golden_TxInList :: Property
golden_TxInList = goldenTestBi exampleTxInList "test/golden/bi/txp/TxInList" | 279 | golden_TxInList :: Property
golden_TxInList = goldenTestBi exampleTxInList "test/golden/bi/txp/TxInList" | 104 | golden_TxInList = goldenTestBi exampleTxInList "test/golden/bi/txp/TxInList" | 76 | true | true | 0 | 5 | 12 | 19 | 11 | 8 | null | null |
jff/TeLLer | src/CLI.hs | gpl-3.0 | askUserForInt :: (Int->Bool) -> String -> IO Int
askUserForInt validate query = do
_flushStr query
answer <- getLine
let n = reads answer :: [(Int, String)]
case n of
[] -> _flushStrLn "Not a number. Please try again!" >> askUserForInt validate query
(i,_):_ -> if (validate i) then return i
else _flushStrLn "Invalid number. Please try again!" >> askUserForInt validate query | 448 | askUserForInt :: (Int->Bool) -> String -> IO Int
askUserForInt validate query = do
_flushStr query
answer <- getLine
let n = reads answer :: [(Int, String)]
case n of
[] -> _flushStrLn "Not a number. Please try again!" >> askUserForInt validate query
(i,_):_ -> if (validate i) then return i
else _flushStrLn "Invalid number. Please try again!" >> askUserForInt validate query | 448 | askUserForInt validate query = do
_flushStr query
answer <- getLine
let n = reads answer :: [(Int, String)]
case n of
[] -> _flushStrLn "Not a number. Please try again!" >> askUserForInt validate query
(i,_):_ -> if (validate i) then return i
else _flushStrLn "Invalid number. Please try again!" >> askUserForInt validate query | 399 | false | true | 0 | 13 | 132 | 148 | 71 | 77 | null | null |
spechub/Hets | CSL/ReduceInterpreter.hs | gpl-2.0 | redsInit :: IO ReduceInterpreter
redsInit = do
putStr "Connecting CAS.."
reducecmd <- getEnvDef "HETS_REDUCE" "redcsl"
-- check that prog exists
noProg <- missingExecutableInPath reducecmd
if noProg
then error $ "Could not find reduce under " ++ reducecmd
else do
(inpt, out, _, pid) <- connectCAS reducecmd
return ReduceInterpreter
{ inh = inpt, outh = out, ph = pid, varcounter = 1 } | 417 | redsInit :: IO ReduceInterpreter
redsInit = do
putStr "Connecting CAS.."
reducecmd <- getEnvDef "HETS_REDUCE" "redcsl"
-- check that prog exists
noProg <- missingExecutableInPath reducecmd
if noProg
then error $ "Could not find reduce under " ++ reducecmd
else do
(inpt, out, _, pid) <- connectCAS reducecmd
return ReduceInterpreter
{ inh = inpt, outh = out, ph = pid, varcounter = 1 } | 417 | redsInit = do
putStr "Connecting CAS.."
reducecmd <- getEnvDef "HETS_REDUCE" "redcsl"
-- check that prog exists
noProg <- missingExecutableInPath reducecmd
if noProg
then error $ "Could not find reduce under " ++ reducecmd
else do
(inpt, out, _, pid) <- connectCAS reducecmd
return ReduceInterpreter
{ inh = inpt, outh = out, ph = pid, varcounter = 1 } | 384 | false | true | 0 | 12 | 93 | 116 | 60 | 56 | null | null |
allanderek/ipclib | web/interface/IpcWeb.hs | gpl-2.0 | {-|
The title of the start page of the demo.
-}
demoPageTitle :: String
demoPageTitle = "International PEPA Compiler Web Demo" | 128 | demoPageTitle :: String
demoPageTitle = "International PEPA Compiler Web Demo" | 78 | demoPageTitle = "International PEPA Compiler Web Demo" | 54 | true | true | 0 | 4 | 22 | 12 | 7 | 5 | null | null |
bgold-cosmos/Tidal | src/Sound/Tidal/UI.hs | gpl-3.0 | range :: Num a => Pattern a -> Pattern a -> Pattern a -> Pattern a
range fromP toP p = (\from to v -> ((v * (to-from)) + from)) <$> fromP *> toP *> p | 149 | range :: Num a => Pattern a -> Pattern a -> Pattern a -> Pattern a
range fromP toP p = (\from to v -> ((v * (to-from)) + from)) <$> fromP *> toP *> p | 149 | range fromP toP p = (\from to v -> ((v * (to-from)) + from)) <$> fromP *> toP *> p | 82 | false | true | 0 | 15 | 35 | 99 | 48 | 51 | null | null |
markcwhitfield/nunavut | test/Nunavut/Util/Arbitrary.hs | mit | arbSGen2 :: (SizedGen2 a) => Gen a
arbSGen2 = do
rs <- arbitrary
cs <- arbitrary
sizedGen2 rs cs | 102 | arbSGen2 :: (SizedGen2 a) => Gen a
arbSGen2 = do
rs <- arbitrary
cs <- arbitrary
sizedGen2 rs cs | 102 | arbSGen2 = do
rs <- arbitrary
cs <- arbitrary
sizedGen2 rs cs | 67 | false | true | 0 | 7 | 24 | 45 | 21 | 24 | null | null |
sergv/tags-server | test-data/0005import_cycle/A.hs | bsd-3-clause | f :: TB -> TA
f (MkTB x) = MkTA x | 33 | f :: TB -> TA
f (MkTB x) = MkTA x | 33 | f (MkTB x) = MkTA x | 19 | false | true | 0 | 6 | 10 | 31 | 14 | 17 | null | null |
glguy/CookieCalculator | src/CookieClicker.hs | isc | computeMilk :: GameInput -> Double
computeMilk input = fromIntegral n / 25
where
n = lengthOf (achievementsEarned . folded . filtered (views achievementPool (/= "shadow"))) input | 182 | computeMilk :: GameInput -> Double
computeMilk input = fromIntegral n / 25
where
n = lengthOf (achievementsEarned . folded . filtered (views achievementPool (/= "shadow"))) input | 182 | computeMilk input = fromIntegral n / 25
where
n = lengthOf (achievementsEarned . folded . filtered (views achievementPool (/= "shadow"))) input | 147 | false | true | 1 | 11 | 29 | 67 | 32 | 35 | null | null |
kazu-yamamoto/word8 | Data/Word8.hs | bsd-3-clause | _V = 0x56 | 9 | _V = 0x56 | 9 | _V = 0x56 | 9 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
k0001/pipes-http-message | src/Pipes/HTTP/Message/Attoparsec.hs | bsd-3-clause | ------------------------------------------------------------------------------
-- | URL-escapes a string (see
-- <http://tools.ietf.org/html/rfc2396.html#section-2.4>)
urlEncode :: ByteString -> ByteString
urlEncode = toByteString . urlEncodeBuilder | 249 | urlEncode :: ByteString -> ByteString
urlEncode = toByteString . urlEncodeBuilder | 81 | urlEncode = toByteString . urlEncodeBuilder | 43 | true | true | 1 | 7 | 18 | 30 | 14 | 16 | null | null |
mettekou/ghc | compiler/types/TyCoRep.hs | bsd-3-clause | tyCoVarsOfType :: Type -> TyCoVarSet
-- See Note [Free variables of types]
tyCoVarsOfType ty = fvVarSet $ tyCoFVsOfType ty | 122 | tyCoVarsOfType :: Type -> TyCoVarSet
tyCoVarsOfType ty = fvVarSet $ tyCoFVsOfType ty | 84 | tyCoVarsOfType ty = fvVarSet $ tyCoFVsOfType ty | 47 | true | true | 0 | 6 | 18 | 26 | 13 | 13 | null | null |
pqwy/redex | src/Reductions.hs | bsd-3-clause | resolve :: Env -> Ident -> Maybe Term
resolve = flip lookup | 59 | resolve :: Env -> Ident -> Maybe Term
resolve = flip lookup | 59 | resolve = flip lookup | 21 | false | true | 0 | 7 | 11 | 25 | 12 | 13 | null | null |
elbrujohalcon/hPage | src/HPage/Control.hs | bsd-3-clause | typeOfNth = runInExprNthWithLets Hint.typeOf | 44 | typeOfNth = runInExprNthWithLets Hint.typeOf | 44 | typeOfNth = runInExprNthWithLets Hint.typeOf | 44 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
ezyang/ghc | compiler/nativeGen/AsmCodeGen.hs | bsd-3-clause | x86fp_kludge :: NatCmmDecl (Alignment, CmmStatics) X86.Instr.Instr -> NatCmmDecl (Alignment, CmmStatics) X86.Instr.Instr
x86fp_kludge top@(CmmData _ _) = top | 157 | x86fp_kludge :: NatCmmDecl (Alignment, CmmStatics) X86.Instr.Instr -> NatCmmDecl (Alignment, CmmStatics) X86.Instr.Instr
x86fp_kludge top@(CmmData _ _) = top | 157 | x86fp_kludge top@(CmmData _ _) = top | 36 | false | true | 0 | 8 | 16 | 57 | 31 | 26 | null | null |
deech/fltkhs | src/Fluid/Migrate.hs | mit | elementLabel _ = Nothing | 24 | elementLabel _ = Nothing | 24 | elementLabel _ = Nothing | 24 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
merijn/GPU-benchmarks | benchmark-analysis/ingest-src/Commands/Import.hs | gpl-3.0 | importAll :: forall proxy rec . Importable rec => proxy rec -> Text -> SqlM ()
importAll _ db = runImport db . runTransaction . runRegion . runConduit $ do
selectSourceImport ([] :: [Filter rec]) [] .| C.mapM_ (lift . importEntity) | 235 | importAll :: forall proxy rec . Importable rec => proxy rec -> Text -> SqlM ()
importAll _ db = runImport db . runTransaction . runRegion . runConduit $ do
selectSourceImport ([] :: [Filter rec]) [] .| C.mapM_ (lift . importEntity) | 235 | importAll _ db = runImport db . runTransaction . runRegion . runConduit $ do
selectSourceImport ([] :: [Filter rec]) [] .| C.mapM_ (lift . importEntity) | 156 | false | true | 0 | 13 | 44 | 109 | 52 | 57 | null | null |
d0kt0r0/estuary | client/src/Estuary/Help/MiniTidal.hs | gpl-3.0 | -- exampleText "unDegradeBy" =
-- exampleText "degradeOverBy"
exampleText "sometimesBy" = "sometimesBy 0.93 (# speed 2) $ n \"0 1 [~ 2] 3\" # sound \"arpy\"" | 157 | exampleText "sometimesBy" = "sometimesBy 0.93 (# speed 2) $ n \"0 1 [~ 2] 3\" # sound \"arpy\"" | 95 | exampleText "sometimesBy" = "sometimesBy 0.93 (# speed 2) $ n \"0 1 [~ 2] 3\" # sound \"arpy\"" | 95 | true | false | 0 | 5 | 24 | 11 | 6 | 5 | null | null |
jonaprieto/athena | src/Athena/Utils/PrettyPrint.hs | mit | putDoc ∷ Doc → IO ()
putDoc = hPutDoc stdout | 44 | putDoc ∷ Doc → IO ()
putDoc = hPutDoc stdout | 44 | putDoc = hPutDoc stdout | 23 | false | true | 0 | 8 | 9 | 29 | 12 | 17 | null | null |
dylex/range-set | src/Data/RangeSet/Internal.hs | mit | takeWhileRangeAdj x [] = (x, []) | 32 | takeWhileRangeAdj x [] = (x, []) | 32 | takeWhileRangeAdj x [] = (x, []) | 32 | false | false | 0 | 6 | 5 | 22 | 11 | 11 | null | null |
sashabu/libcspm | src/CSPM/Evaluator/AnalyserMonad.hs | bsd-3-clause | maybeTimed ::
AnalyserMonad a ->
(Name -> Name -> AnalyserMonad a) ->
AnalyserMonad a
maybeTimed nonTimedProg timedProg = do
mtn <- gets timedSectionTockName
mfn <- gets timedSectionFunctionName
case (mtn, mfn) of
(Just tn, Just fn) -> timedProg tn fn
_ -> nonTimedProg
-- | A process name template' | 340 | maybeTimed ::
AnalyserMonad a ->
(Name -> Name -> AnalyserMonad a) ->
AnalyserMonad a
maybeTimed nonTimedProg timedProg = do
mtn <- gets timedSectionTockName
mfn <- gets timedSectionFunctionName
case (mtn, mfn) of
(Just tn, Just fn) -> timedProg tn fn
_ -> nonTimedProg
-- | A process name template' | 340 | maybeTimed nonTimedProg timedProg = do
mtn <- gets timedSectionTockName
mfn <- gets timedSectionFunctionName
case (mtn, mfn) of
(Just tn, Just fn) -> timedProg tn fn
_ -> nonTimedProg
-- | A process name template' | 242 | false | true | 0 | 11 | 88 | 107 | 51 | 56 | null | null |
martomi/AI-Reversi | Reversi_AI.hs | mit | -- no more children to examine
negamax (child:children) depth alpha beta (nodes, value)
| alpha >= beta = bestValue
| otherwise = negamax children depth alphaMax beta bestValue
where
(newNodes, newValue) = negate $ alphabeta child (depth-1) (-beta) (-alphaMax)
bestValue = if (newValue) > value then (newNodes, newValue) else (nodes, value)
alphaMax = max alpha value
negate (nodes, value) = (nodes,-value)
-----------------------------------------------
-- Heuristic, evaluation and analysis functions
----------------------------------------------- | 584 | negamax (child:children) depth alpha beta (nodes, value)
| alpha >= beta = bestValue
| otherwise = negamax children depth alphaMax beta bestValue
where
(newNodes, newValue) = negate $ alphabeta child (depth-1) (-beta) (-alphaMax)
bestValue = if (newValue) > value then (newNodes, newValue) else (nodes, value)
alphaMax = max alpha value
negate (nodes, value) = (nodes,-value)
-----------------------------------------------
-- Heuristic, evaluation and analysis functions
----------------------------------------------- | 553 | negamax (child:children) depth alpha beta (nodes, value)
| alpha >= beta = bestValue
| otherwise = negamax children depth alphaMax beta bestValue
where
(newNodes, newValue) = negate $ alphabeta child (depth-1) (-beta) (-alphaMax)
bestValue = if (newValue) > value then (newNodes, newValue) else (nodes, value)
alphaMax = max alpha value
negate (nodes, value) = (nodes,-value)
-----------------------------------------------
-- Heuristic, evaluation and analysis functions
----------------------------------------------- | 553 | true | false | 2 | 8 | 102 | 187 | 96 | 91 | null | null |
ganeti/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | -- | Disk templates that are enabled by default
defaultEnabledDiskTemplates :: [String]
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain] | 164 | defaultEnabledDiskTemplates :: [String]
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain] | 116 | defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain] | 76 | true | true | 0 | 6 | 17 | 28 | 16 | 12 | null | null |
phonohawk/HsOpenSSL | OpenSSL/X509.hs | cc0-1.0 | -- |@'getNotBefore' cert@ returns the time when the certificate begins
-- to be valid.
getNotBefore :: X509 -> IO UTCTime
getNotBefore x509
= withX509Ptr x509 $ \ x509Ptr ->
_get_notBefore x509Ptr
>>= peekASN1Time | 234 | getNotBefore :: X509 -> IO UTCTime
getNotBefore x509
= withX509Ptr x509 $ \ x509Ptr ->
_get_notBefore x509Ptr
>>= peekASN1Time | 147 | getNotBefore x509
= withX509Ptr x509 $ \ x509Ptr ->
_get_notBefore x509Ptr
>>= peekASN1Time | 112 | true | true | 0 | 8 | 53 | 42 | 21 | 21 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F21.hs | bsd-3-clause | ptr_glProgramStringARB :: FunPtr (GLenum -> GLenum -> GLsizei -> Ptr a -> IO ())
ptr_glProgramStringARB = unsafePerformIO $ getCommand "glProgramStringARB" | 155 | ptr_glProgramStringARB :: FunPtr (GLenum -> GLenum -> GLsizei -> Ptr a -> IO ())
ptr_glProgramStringARB = unsafePerformIO $ getCommand "glProgramStringARB" | 155 | ptr_glProgramStringARB = unsafePerformIO $ getCommand "glProgramStringARB" | 74 | false | true | 0 | 12 | 19 | 48 | 23 | 25 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 186093 = 5846 | 33 | getValueFromProduct 186093 = 5846 | 33 | getValueFromProduct 186093 = 5846 | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
hekt/blog-system | src/Web/Kirstie/Server.hs | mit | runServer :: Configure -> Int -> IO ()
runServer conf port = scotty port $ serverApp conf | 89 | runServer :: Configure -> Int -> IO ()
runServer conf port = scotty port $ serverApp conf | 89 | runServer conf port = scotty port $ serverApp conf | 50 | false | true | 0 | 8 | 16 | 39 | 18 | 21 | null | null |
adityagupta1089/Project-Euler-Haskell | src/util/Radical.hs | bsd-3-clause | getRadicalArrayUpto :: Int -> UArray Int Int
getRadicalArrayUpto lim = runSTUArray $ do
radicals <- newArray (1, lim) 1
forM_
(getPrimesUpto lim)
(\i -> forM_
[1 .. lim `div` i]
(\j -> do
val <- readArray radicals (i * j)
writeArray radicals (i * j) (val * i)
)
)
return radicals | 383 | getRadicalArrayUpto :: Int -> UArray Int Int
getRadicalArrayUpto lim = runSTUArray $ do
radicals <- newArray (1, lim) 1
forM_
(getPrimesUpto lim)
(\i -> forM_
[1 .. lim `div` i]
(\j -> do
val <- readArray radicals (i * j)
writeArray radicals (i * j) (val * i)
)
)
return radicals | 383 | getRadicalArrayUpto lim = runSTUArray $ do
radicals <- newArray (1, lim) 1
forM_
(getPrimesUpto lim)
(\i -> forM_
[1 .. lim `div` i]
(\j -> do
val <- readArray radicals (i * j)
writeArray radicals (i * j) (val * i)
)
)
return radicals | 338 | false | true | 0 | 19 | 155 | 141 | 71 | 70 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/readOct_1.hs | mit | psPs :: (List a) -> (List a) -> (List a);
psPs Nil ys = ys | 62 | psPs :: (List a) -> (List a) -> (List a)
psPs Nil ys = ys | 61 | psPs Nil ys = ys | 16 | false | true | 1 | 9 | 18 | 49 | 23 | 26 | null | null |
olsner/ghc | utils/ghctags/Main.hs | bsd-3-clause | --- invariant (not checked): every found thing has a source location in that file?
------------------------------
-------- MAIN PROGRAM --------
main :: IO ()
main = do
progName <- getProgName
let usageString =
"Usage: " ++ progName ++ " [OPTION...] [-- GHC OPTION... --] [files...]"
args <- getArgs
let (ghcArgs', ourArgs, unbalanced) = splitArgs args
let (flags, filenames, errs) = getOpt Permute options ourArgs
let (hsfiles, otherfiles) = List.partition isHaskellSrcFilename filenames
let ghc_topdir = case [ d | FlagTopDir d <- flags ] of
[] -> ""
(x:_) -> x
mapM_ (\n -> putStr $ "Warning: ignoring non-Haskellish file " ++ n ++ "\n")
otherfiles
if unbalanced || errs /= [] || elem FlagHelp flags || hsfiles == []
then do
putStr $ unlines errs
putStr $ usageInfo usageString options
exitWith (ExitFailure 1)
else return ()
ghcArgs <- case [ d | FlagUseCabalConfig d <- flags ] of
[distPref] -> do
cabalOpts <- flagsFromCabal distPref
return (cabalOpts ++ ghcArgs')
[] ->
return ghcArgs'
_ -> error "Too many --use-cabal-config flags"
print ghcArgs
let modes = getMode flags
let openFileMode = if elem FlagAppend flags
then AppendMode
else WriteMode
ctags_hdl <- if CTags `elem` modes
then Just `liftM` openFile "tags" openFileMode
else return Nothing
etags_hdl <- if ETags `elem` modes
then Just `liftM` openFile "TAGS" openFileMode
else return Nothing
GHC.defaultErrorHandler defaultFatalMessager defaultFlushOut $
runGhc (Just ghc_topdir) $ do
--liftIO $ print "starting up session"
dflags <- getSessionDynFlags
(pflags, unrec, warns) <- parseDynamicFlags dflags{ verbosity=1 }
(map noLoc ghcArgs)
unless (null unrec) $
liftIO $ putStrLn $ "Unrecognised options:\n" ++ show (map unLoc unrec)
liftIO $ mapM_ putStrLn (map unLoc warns)
let dflags2 = pflags { hscTarget = HscNothing } -- don't generate anything
-- liftIO $ print ("pkgDB", case (pkgDatabase dflags2) of Nothing -> 0
-- Just m -> sizeUFM m)
_ <- setSessionDynFlags dflags2
--liftIO $ print (length pkgs)
targetsAtOneGo hsfiles (ctags_hdl,etags_hdl)
mapM_ (mapM (liftIO . hClose)) [ctags_hdl, etags_hdl]
----------------------------------------------
---------- ARGUMENT PROCESSING -------------- | 2,704 | main :: IO ()
main = do
progName <- getProgName
let usageString =
"Usage: " ++ progName ++ " [OPTION...] [-- GHC OPTION... --] [files...]"
args <- getArgs
let (ghcArgs', ourArgs, unbalanced) = splitArgs args
let (flags, filenames, errs) = getOpt Permute options ourArgs
let (hsfiles, otherfiles) = List.partition isHaskellSrcFilename filenames
let ghc_topdir = case [ d | FlagTopDir d <- flags ] of
[] -> ""
(x:_) -> x
mapM_ (\n -> putStr $ "Warning: ignoring non-Haskellish file " ++ n ++ "\n")
otherfiles
if unbalanced || errs /= [] || elem FlagHelp flags || hsfiles == []
then do
putStr $ unlines errs
putStr $ usageInfo usageString options
exitWith (ExitFailure 1)
else return ()
ghcArgs <- case [ d | FlagUseCabalConfig d <- flags ] of
[distPref] -> do
cabalOpts <- flagsFromCabal distPref
return (cabalOpts ++ ghcArgs')
[] ->
return ghcArgs'
_ -> error "Too many --use-cabal-config flags"
print ghcArgs
let modes = getMode flags
let openFileMode = if elem FlagAppend flags
then AppendMode
else WriteMode
ctags_hdl <- if CTags `elem` modes
then Just `liftM` openFile "tags" openFileMode
else return Nothing
etags_hdl <- if ETags `elem` modes
then Just `liftM` openFile "TAGS" openFileMode
else return Nothing
GHC.defaultErrorHandler defaultFatalMessager defaultFlushOut $
runGhc (Just ghc_topdir) $ do
--liftIO $ print "starting up session"
dflags <- getSessionDynFlags
(pflags, unrec, warns) <- parseDynamicFlags dflags{ verbosity=1 }
(map noLoc ghcArgs)
unless (null unrec) $
liftIO $ putStrLn $ "Unrecognised options:\n" ++ show (map unLoc unrec)
liftIO $ mapM_ putStrLn (map unLoc warns)
let dflags2 = pflags { hscTarget = HscNothing } -- don't generate anything
-- liftIO $ print ("pkgDB", case (pkgDatabase dflags2) of Nothing -> 0
-- Just m -> sizeUFM m)
_ <- setSessionDynFlags dflags2
--liftIO $ print (length pkgs)
targetsAtOneGo hsfiles (ctags_hdl,etags_hdl)
mapM_ (mapM (liftIO . hClose)) [ctags_hdl, etags_hdl]
----------------------------------------------
---------- ARGUMENT PROCESSING -------------- | 2,556 | main = do
progName <- getProgName
let usageString =
"Usage: " ++ progName ++ " [OPTION...] [-- GHC OPTION... --] [files...]"
args <- getArgs
let (ghcArgs', ourArgs, unbalanced) = splitArgs args
let (flags, filenames, errs) = getOpt Permute options ourArgs
let (hsfiles, otherfiles) = List.partition isHaskellSrcFilename filenames
let ghc_topdir = case [ d | FlagTopDir d <- flags ] of
[] -> ""
(x:_) -> x
mapM_ (\n -> putStr $ "Warning: ignoring non-Haskellish file " ++ n ++ "\n")
otherfiles
if unbalanced || errs /= [] || elem FlagHelp flags || hsfiles == []
then do
putStr $ unlines errs
putStr $ usageInfo usageString options
exitWith (ExitFailure 1)
else return ()
ghcArgs <- case [ d | FlagUseCabalConfig d <- flags ] of
[distPref] -> do
cabalOpts <- flagsFromCabal distPref
return (cabalOpts ++ ghcArgs')
[] ->
return ghcArgs'
_ -> error "Too many --use-cabal-config flags"
print ghcArgs
let modes = getMode flags
let openFileMode = if elem FlagAppend flags
then AppendMode
else WriteMode
ctags_hdl <- if CTags `elem` modes
then Just `liftM` openFile "tags" openFileMode
else return Nothing
etags_hdl <- if ETags `elem` modes
then Just `liftM` openFile "TAGS" openFileMode
else return Nothing
GHC.defaultErrorHandler defaultFatalMessager defaultFlushOut $
runGhc (Just ghc_topdir) $ do
--liftIO $ print "starting up session"
dflags <- getSessionDynFlags
(pflags, unrec, warns) <- parseDynamicFlags dflags{ verbosity=1 }
(map noLoc ghcArgs)
unless (null unrec) $
liftIO $ putStrLn $ "Unrecognised options:\n" ++ show (map unLoc unrec)
liftIO $ mapM_ putStrLn (map unLoc warns)
let dflags2 = pflags { hscTarget = HscNothing } -- don't generate anything
-- liftIO $ print ("pkgDB", case (pkgDatabase dflags2) of Nothing -> 0
-- Just m -> sizeUFM m)
_ <- setSessionDynFlags dflags2
--liftIO $ print (length pkgs)
targetsAtOneGo hsfiles (ctags_hdl,etags_hdl)
mapM_ (mapM (liftIO . hClose)) [ctags_hdl, etags_hdl]
----------------------------------------------
---------- ARGUMENT PROCESSING -------------- | 2,542 | true | true | 0 | 17 | 860 | 674 | 330 | 344 | null | null |
kwibus/myLang | src/Value.hs | bsd-3-clause | pShowVal BuildIn {prettyName = n} = n | 37 | pShowVal BuildIn {prettyName = n} = n | 37 | pShowVal BuildIn {prettyName = n} = n | 37 | false | false | 0 | 8 | 6 | 18 | 9 | 9 | null | null |
sgillespie/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | translateOp dflags WordMulOp = Just (mo_wordMul dflags) | 60 | translateOp dflags WordMulOp = Just (mo_wordMul dflags) | 60 | translateOp dflags WordMulOp = Just (mo_wordMul dflags) | 60 | false | false | 0 | 7 | 11 | 20 | 9 | 11 | null | null |
svenssonjoel/GCDObsidian | Obsidian/GCDObsidian/Kernel.hs | bsd-3-clause | ----------------------------------------------------------------------------
-- Figure out how many threads a piece of Code requires
threadsNeeded :: Program e -> Word32
threadsNeeded = programThreads | 200 | threadsNeeded :: Program e -> Word32
threadsNeeded = programThreads | 67 | threadsNeeded = programThreads | 30 | true | true | 0 | 6 | 20 | 20 | 11 | 9 | null | null |
maruks/haskell-book | src/transformers.hs | gpl-3.0 | lift :: Functor m => m a -> ExceptT e m a
lift x = ExceptT (fmap Right x) | 73 | lift :: Functor m => m a -> ExceptT e m a
lift x = ExceptT (fmap Right x) | 73 | lift x = ExceptT (fmap Right x) | 31 | false | true | 0 | 7 | 18 | 46 | 21 | 25 | null | null |
phischu/fragnix | builtins/ghc-prim/GHC.Prim.hs | bsd-3-clause | xorI# :: Int# -> Int# -> Int#
xorI# = xorI# | 43 | xorI# :: Int# -> Int# -> Int#
xorI# = xorI# | 43 | xorI# = xorI# | 13 | false | true | 0 | 8 | 9 | 26 | 11 | 15 | null | null |
tjakway/ghcjvm | compiler/basicTypes/Id.hs | bsd-3-clause | zapIdDemandInfo :: Id -> Id
zapIdDemandInfo = zapInfo zapDemandInfo | 67 | zapIdDemandInfo :: Id -> Id
zapIdDemandInfo = zapInfo zapDemandInfo | 67 | zapIdDemandInfo = zapInfo zapDemandInfo | 39 | false | true | 0 | 7 | 8 | 25 | 10 | 15 | null | null |
kojiromike/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | irts_c (FArith (ATInt (ITFixed ity))) x
= "GETBITS" ++ show (nativeTyWidth ity) ++ "(" ++ x ++ ")" | 102 | irts_c (FArith (ATInt (ITFixed ity))) x
= "GETBITS" ++ show (nativeTyWidth ity) ++ "(" ++ x ++ ")" | 102 | irts_c (FArith (ATInt (ITFixed ity))) x
= "GETBITS" ++ show (nativeTyWidth ity) ++ "(" ++ x ++ ")" | 102 | false | false | 0 | 11 | 21 | 54 | 26 | 28 | null | null |
ezyang/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | iselExpr64 (CmmMachOp (MO_UU_Conv _ W64) [expr]) = do
fn <- getAnyReg expr
r_dst_lo <- getNewRegNat II32
let r_dst_hi = getHiVRegFromLo r_dst_lo
code = fn r_dst_lo
return (
ChildCode64 (code `snocOL`
MOV II32 (OpImm (ImmInt 0)) (OpReg r_dst_hi))
r_dst_lo
) | 363 | iselExpr64 (CmmMachOp (MO_UU_Conv _ W64) [expr]) = do
fn <- getAnyReg expr
r_dst_lo <- getNewRegNat II32
let r_dst_hi = getHiVRegFromLo r_dst_lo
code = fn r_dst_lo
return (
ChildCode64 (code `snocOL`
MOV II32 (OpImm (ImmInt 0)) (OpReg r_dst_hi))
r_dst_lo
) | 363 | iselExpr64 (CmmMachOp (MO_UU_Conv _ W64) [expr]) = do
fn <- getAnyReg expr
r_dst_lo <- getNewRegNat II32
let r_dst_hi = getHiVRegFromLo r_dst_lo
code = fn r_dst_lo
return (
ChildCode64 (code `snocOL`
MOV II32 (OpImm (ImmInt 0)) (OpReg r_dst_hi))
r_dst_lo
) | 363 | false | false | 0 | 16 | 145 | 116 | 55 | 61 | null | null |
bgamari/pandoc | src/Text/Pandoc/Parsing.hs | gpl-2.0 | -- | Parses material enclosed between start and end parsers.
enclosed :: Stream s m Char => ParserT s st m t -- ^ start parser
-> ParserT s st m end -- ^ end parser
-> ParserT s st m a -- ^ content parser (to be used repeatedly)
-> ParserT s st m [a]
enclosed start end parser = try $
start >> notFollowedBy space >> many1Till parser end | 373 | enclosed :: Stream s m Char => ParserT s st m t -- ^ start parser
-> ParserT s st m end -- ^ end parser
-> ParserT s st m a -- ^ content parser (to be used repeatedly)
-> ParserT s st m [a]
enclosed start end parser = try $
start >> notFollowedBy space >> many1Till parser end | 312 | enclosed start end parser = try $
start >> notFollowedBy space >> many1Till parser end | 88 | true | true | 2 | 11 | 106 | 109 | 52 | 57 | null | null |
unknownloner/calccomp | Asm/InstrSize.hs | mit | instrSize ADD (l:_) = regArgSize l | 34 | instrSize ADD (l:_) = regArgSize l | 34 | instrSize ADD (l:_) = regArgSize l | 34 | false | false | 0 | 6 | 5 | 23 | 10 | 13 | null | null |
google/hs-niche-containers | rle/src/Data/RLE.hs | apache-2.0 | -- | Append two sequences.
(++) :: Eq a => RLE a -> RLE a -> RLE a
(++) (RLE (x0:xs@(_:_))) = \ys -> RLE $ x0 : toRuns (RLE xs ++ ys) | 133 | (++) :: Eq a => RLE a -> RLE a -> RLE a
(++) (RLE (x0:xs@(_:_))) = \ys -> RLE $ x0 : toRuns (RLE xs ++ ys) | 106 | (++) (RLE (x0:xs@(_:_))) = \ys -> RLE $ x0 : toRuns (RLE xs ++ ys) | 66 | true | true | 0 | 12 | 32 | 92 | 48 | 44 | null | null |
TransformingMusicology/tabcode-haskell | src/TabCode/Serialiser/MEIXML/Elements.hs | gpl-3.0 | atSign :: Char -> MEIAttrs
atSign 'O' = [ StringAttr "sign" "O" ] | 65 | atSign :: Char -> MEIAttrs
atSign 'O' = [ StringAttr "sign" "O" ] | 65 | atSign 'O' = [ StringAttr "sign" "O" ] | 38 | false | true | 0 | 7 | 12 | 32 | 14 | 18 | null | null |
brendanhay/gogol | gogol-books/gen/Network/Google/Books/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Layersummaries' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'layTotalItems'
--
-- * 'layKind'
--
-- * 'layItems'
layersummaries
:: Layersummaries
layersummaries =
Layersummaries'
{_layTotalItems = Nothing, _layKind = Nothing, _layItems = Nothing} | 370 | layersummaries
:: Layersummaries
layersummaries =
Layersummaries'
{_layTotalItems = Nothing, _layKind = Nothing, _layItems = Nothing} | 143 | layersummaries =
Layersummaries'
{_layTotalItems = Nothing, _layKind = Nothing, _layItems = Nothing} | 106 | true | true | 1 | 7 | 66 | 47 | 29 | 18 | null | null |
j-a-k/suppr | app/Main.hs | bsd-3-clause | -- | the real main entry point after handling CL args
walkFiles :: FilePath -> FilePath -> FilePath -> IO ()
walkFiles templatePath outputPath sourceDir = do
tree <- readDirectoryWith TIO.readFile sourceDir
testTemplate <- readFile templatePath
temp <- render testTemplate . getResults $ tree
TLIO.writeFile outputPath temp
where
getResults = F.foldr processFile (Tables [] []) . zipPaths . filterAnchoredTree isJavaDirTree
-- | data structures that mainly exist to make rendering the template easy cos of deriving Data, Typeable | 545 | walkFiles :: FilePath -> FilePath -> FilePath -> IO ()
walkFiles templatePath outputPath sourceDir = do
tree <- readDirectoryWith TIO.readFile sourceDir
testTemplate <- readFile templatePath
temp <- render testTemplate . getResults $ tree
TLIO.writeFile outputPath temp
where
getResults = F.foldr processFile (Tables [] []) . zipPaths . filterAnchoredTree isJavaDirTree
-- | data structures that mainly exist to make rendering the template easy cos of deriving Data, Typeable | 491 | walkFiles templatePath outputPath sourceDir = do
tree <- readDirectoryWith TIO.readFile sourceDir
testTemplate <- readFile templatePath
temp <- render testTemplate . getResults $ tree
TLIO.writeFile outputPath temp
where
getResults = F.foldr processFile (Tables [] []) . zipPaths . filterAnchoredTree isJavaDirTree
-- | data structures that mainly exist to make rendering the template easy cos of deriving Data, Typeable | 436 | true | true | 0 | 10 | 93 | 127 | 59 | 68 | null | null |
juhp/stack | src/Stack/Types/Config.hs | bsd-3-clause | globalOptsL :: HasRunner env => Lens' env GlobalOpts
globalOptsL = runnerL.lens runnerGlobalOpts (\x y -> x { runnerGlobalOpts = y }) | 133 | globalOptsL :: HasRunner env => Lens' env GlobalOpts
globalOptsL = runnerL.lens runnerGlobalOpts (\x y -> x { runnerGlobalOpts = y }) | 133 | globalOptsL = runnerL.lens runnerGlobalOpts (\x y -> x { runnerGlobalOpts = y }) | 80 | false | true | 0 | 9 | 20 | 48 | 25 | 23 | null | null |
vincenthz/hs-packer | Data/Packer.hs | bsd-2-clause | -- | Put a Bytestring.
putBytes :: ByteString -> Packing ()
putBytes bs =
packCheckAct len $ \ptr ->
withForeignPtr fptr $ \ptr2 ->
B.memcpy ptr (ptr2 `plusPtr` o) (fromIntegral len)
where (fptr,o,len) = B.toForeignPtr bs
-- | Put an arbitrary type with the Storable class constraint. | 299 | putBytes :: ByteString -> Packing ()
putBytes bs =
packCheckAct len $ \ptr ->
withForeignPtr fptr $ \ptr2 ->
B.memcpy ptr (ptr2 `plusPtr` o) (fromIntegral len)
where (fptr,o,len) = B.toForeignPtr bs
-- | Put an arbitrary type with the Storable class constraint. | 276 | putBytes bs =
packCheckAct len $ \ptr ->
withForeignPtr fptr $ \ptr2 ->
B.memcpy ptr (ptr2 `plusPtr` o) (fromIntegral len)
where (fptr,o,len) = B.toForeignPtr bs
-- | Put an arbitrary type with the Storable class constraint. | 239 | true | true | 0 | 9 | 61 | 101 | 51 | 50 | null | null |
codemac/yi-editor | src/Yi/Snippets.hs | gpl-2.0 | safeMarkRegion m@(SimpleMarkInfo _ _) = withSimpleRegion m return | 65 | safeMarkRegion m@(SimpleMarkInfo _ _) = withSimpleRegion m return | 65 | safeMarkRegion m@(SimpleMarkInfo _ _) = withSimpleRegion m return | 65 | false | false | 0 | 8 | 7 | 25 | 12 | 13 | null | null |
kim/amazonka | amazonka-sns/gen/Network/AWS/SNS/DeleteEndpoint.hs | mpl-2.0 | -- | 'DeleteEndpointResponse' constructor.
deleteEndpointResponse :: DeleteEndpointResponse
deleteEndpointResponse = DeleteEndpointResponse | 139 | deleteEndpointResponse :: DeleteEndpointResponse
deleteEndpointResponse = DeleteEndpointResponse | 96 | deleteEndpointResponse = DeleteEndpointResponse | 47 | true | true | 0 | 4 | 9 | 12 | 7 | 5 | null | null |
grzegorzbalcerek/orgmode | Show.hs | bsd-2-clause | showElements n (e@(Def name subelements):es) =
(take (2*n) $ repeat ' ') ++ show (Def name []) ++ "\n" ++
showElements (n+1) subelements ++
showElements n es | 163 | showElements n (e@(Def name subelements):es) =
(take (2*n) $ repeat ' ') ++ show (Def name []) ++ "\n" ++
showElements (n+1) subelements ++
showElements n es | 163 | showElements n (e@(Def name subelements):es) =
(take (2*n) $ repeat ' ') ++ show (Def name []) ++ "\n" ++
showElements (n+1) subelements ++
showElements n es | 163 | false | false | 0 | 13 | 32 | 95 | 47 | 48 | null | null |
mathhun/stack | src/Stack/Types/StackT.hs | bsd-3-clause | -- | Write a "sticky" line to the terminal. Any subsequent lines will
-- overwrite this one, and that same line will be repeated below
-- again. In other words, the line sticks at the bottom of the output
-- forever. Running this function again will replace the sticky line
-- with a new sticky line. When you want to get rid of the sticky
-- line, run 'logStickyDone'.
--
logSticky :: Q Exp
logSticky =
logOther "sticky" | 425 | logSticky :: Q Exp
logSticky =
logOther "sticky" | 52 | logSticky =
logOther "sticky" | 33 | true | true | 0 | 5 | 81 | 24 | 15 | 9 | null | null |
OpenXT/manager | xenmgr/Vm/Config.hs | gpl-2.0 | vmBootSentinel = property "boot-sentinel" | 41 | vmBootSentinel = property "boot-sentinel" | 41 | vmBootSentinel = property "boot-sentinel" | 41 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ulricha/dsh | src/Database/DSH/Tests/DSHComprehensions.hs | bsd-3-clause | njg6 :: Q [Integer] -> Q [Integer] -> Q [Integer] -> Q [(Integer, [Integer])]
njg6 njgxs njgys njgzs =
[ tup2 x [ y | y <- njgys, x == y ]
| x <- njgxs
, x `elem` njgzs
] | 186 | njg6 :: Q [Integer] -> Q [Integer] -> Q [Integer] -> Q [(Integer, [Integer])]
njg6 njgxs njgys njgzs =
[ tup2 x [ y | y <- njgys, x == y ]
| x <- njgxs
, x `elem` njgzs
] | 186 | njg6 njgxs njgys njgzs =
[ tup2 x [ y | y <- njgys, x == y ]
| x <- njgxs
, x `elem` njgzs
] | 108 | false | true | 0 | 11 | 56 | 108 | 57 | 51 | null | null |
xekoukou/idris-malfunction | src/IRTS/CodegenMalfunction.hs | mit | cgOp (LChInt _) [x] = cgVar x | 29 | cgOp (LChInt _) [x] = cgVar x | 29 | cgOp (LChInt _) [x] = cgVar x | 29 | false | false | 0 | 7 | 6 | 23 | 11 | 12 | null | null |
rodrigogribeiro/typedef | test/Spec.hs | bsd-3-clause | execATest file = do
c <- readFile file
r <- solver c file
assertBool (show r) (isRight r) | 163 | execATest file = do
c <- readFile file
r <- solver c file
assertBool (show r) (isRight r) | 163 | execATest file = do
c <- readFile file
r <- solver c file
assertBool (show r) (isRight r) | 163 | false | false | 1 | 10 | 91 | 55 | 22 | 33 | null | null |
smaccm/capDL-tool | CapDL/PrintDot.hs | bsd-2-clause | initNames :: DotPrinting a => [(ObjID, KernelObject a)] -> NodeMap
initNames = initNamesList Map.empty | 102 | initNames :: DotPrinting a => [(ObjID, KernelObject a)] -> NodeMap
initNames = initNamesList Map.empty | 102 | initNames = initNamesList Map.empty | 35 | false | true | 0 | 9 | 13 | 39 | 20 | 19 | null | null |
BartAdv/hoogle | src/Query.hs | bsd-3-clause | lexer x | Just s <- fmap (bs !!) $ findIndex (`isPrefixOf` x) bs = s : lexer (drop (length s) x)
where bs = zipWith (++) openBrackets shutBrackets ++ openBrackets ++ shutBrackets | 182 | lexer x | Just s <- fmap (bs !!) $ findIndex (`isPrefixOf` x) bs = s : lexer (drop (length s) x)
where bs = zipWith (++) openBrackets shutBrackets ++ openBrackets ++ shutBrackets | 182 | lexer x | Just s <- fmap (bs !!) $ findIndex (`isPrefixOf` x) bs = s : lexer (drop (length s) x)
where bs = zipWith (++) openBrackets shutBrackets ++ openBrackets ++ shutBrackets | 182 | false | false | 0 | 11 | 36 | 90 | 45 | 45 | null | null |
beni55/haste-compiler | libraries/ghc-7.10/ghc-prim/GHC/Prim.hs | bsd-3-clause | -- | Read a vector from specified index of mutable array of scalars; offset is in scalar elements.
readInt8ArrayAsInt8X16# :: MutableByteArray# s -> Int# -> State# s -> (# State# s,Int8X16# #)
readInt8ArrayAsInt8X16# = let x = x in x | 235 | readInt8ArrayAsInt8X16# :: MutableByteArray# s -> Int# -> State# s -> (# State# s,Int8X16# #)
readInt8ArrayAsInt8X16# = let x = x in x | 134 | readInt8ArrayAsInt8X16# = let x = x in x | 40 | true | true | 0 | 11 | 41 | 56 | 25 | 31 | null | null |
shlevy/ghc | compiler/coreSyn/CoreSyn.hs | bsd-3-clause | expandUnfolding_maybe _ = Nothing | 87 | expandUnfolding_maybe _ = Nothing | 87 | expandUnfolding_maybe _ = Nothing | 87 | false | false | 0 | 5 | 57 | 9 | 4 | 5 | null | null |
kmate/HaRe | old/testing/moveDefBtwMods/D5_AstOut.hs | bsd-3-clause | fringe (Branch left right)
= (fringe left) ++ (fringe right) | 65 | fringe (Branch left right)
= (fringe left) ++ (fringe right) | 65 | fringe (Branch left right)
= (fringe left) ++ (fringe right) | 65 | false | false | 2 | 7 | 14 | 36 | 16 | 20 | null | null |
gbataille/pandoc | src/Text/Pandoc/Writers/OpenDocument.hs | gpl-2.0 | tableItemToOpenDocument :: WriterOptions -> String -> (String,[Block])-> State WriterState Doc
tableItemToOpenDocument o tn (n,i) =
let a = [ ("table:style-name" , tn ++ ".A1" )
, ("office:value-type", "string" )
]
in inTags True "table:table-cell" a <$>
withParagraphStyle o n (map plainToPara i) | 332 | tableItemToOpenDocument :: WriterOptions -> String -> (String,[Block])-> State WriterState Doc
tableItemToOpenDocument o tn (n,i) =
let a = [ ("table:style-name" , tn ++ ".A1" )
, ("office:value-type", "string" )
]
in inTags True "table:table-cell" a <$>
withParagraphStyle o n (map plainToPara i) | 332 | tableItemToOpenDocument o tn (n,i) =
let a = [ ("table:style-name" , tn ++ ".A1" )
, ("office:value-type", "string" )
]
in inTags True "table:table-cell" a <$>
withParagraphStyle o n (map plainToPara i) | 237 | false | true | 0 | 11 | 76 | 109 | 58 | 51 | null | null |
forked-upstream-packages-for-ghcjs/ghcjs | ghcjs/src/Compiler/JMacro/Base.hs | mit | defRenderJsS r (UnsatBlock e) = jsToDocR r $ sat_ e | 51 | defRenderJsS r (UnsatBlock e) = jsToDocR r $ sat_ e | 51 | defRenderJsS r (UnsatBlock e) = jsToDocR r $ sat_ e | 51 | false | false | 0 | 7 | 9 | 27 | 12 | 15 | null | null |
nlv/genexpr | src/Generate.hs | gpl-2.0 | -- Понижаем чистату для унарного минуса, чтобы не было много цепочек: -(-(-(-10)))
genop _ = frequency $ (1, return 6) : normal
where normal = zip [10..] (map return [1 .. 5])
-- | Таблица численных кодов бинарных операций (Expr) | 233 | genop _ = frequency $ (1, return 6) : normal
where normal = zip [10..] (map return [1 .. 5])
-- | Таблица численных кодов бинарных операций (Expr) | 150 | genop _ = frequency $ (1, return 6) : normal
where normal = zip [10..] (map return [1 .. 5])
-- | Таблица численных кодов бинарных операций (Expr) | 150 | true | false | 3 | 8 | 43 | 64 | 31 | 33 | null | null |
stu-smith/rendering-in-haskell | src/experiment04/Main.hs | mit | sphere :: Point -> Double -> Material -> Surface
sphere center radius mat =
translate (origin `to` center) $ mkSphere radius mat | 132 | sphere :: Point -> Double -> Material -> Surface
sphere center radius mat =
translate (origin `to` center) $ mkSphere radius mat | 132 | sphere center radius mat =
translate (origin `to` center) $ mkSphere radius mat | 83 | false | true | 0 | 8 | 25 | 51 | 26 | 25 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | wordToIntegerIdKey = mkPreludeMiscIdUnique 97 | 56 | wordToIntegerIdKey = mkPreludeMiscIdUnique 97 | 56 | wordToIntegerIdKey = mkPreludeMiscIdUnique 97 | 56 | false | false | 0 | 5 | 14 | 9 | 4 | 5 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.