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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
iamkingmaker/HLearn
|
src/HLearn/Metrics/String/Levenshtein.hs
|
bsd-3-clause
|
lev :: String -> String -> Int
lev = memoize2 lev'
where
lev' [] [] = 0
lev' xs [] = length xs
lev' [] ys = length ys
lev' (x:xs) (y:ys) = minimum
[ lev xs (y:ys) + 1
, lev (x:xs) ys + 1
, lev xs ys + if (x/=y) then 1 else 0
]
| 311
|
lev :: String -> String -> Int
lev = memoize2 lev'
where
lev' [] [] = 0
lev' xs [] = length xs
lev' [] ys = length ys
lev' (x:xs) (y:ys) = minimum
[ lev xs (y:ys) + 1
, lev (x:xs) ys + 1
, lev xs ys + if (x/=y) then 1 else 0
]
| 311
|
lev = memoize2 lev'
where
lev' [] [] = 0
lev' xs [] = length xs
lev' [] ys = length ys
lev' (x:xs) (y:ys) = minimum
[ lev xs (y:ys) + 1
, lev (x:xs) ys + 1
, lev xs ys + if (x/=y) then 1 else 0
]
| 280
| false
| true
| 0
| 12
| 142
| 160
| 82
| 78
| null | null |
vTurbine/ghc
|
compiler/cmm/CmmExpr.hs
|
bsd-3-clause
|
cmmExprType dflags (CmmStackSlot _ _) = bWord dflags
| 53
|
cmmExprType dflags (CmmStackSlot _ _) = bWord dflags
| 53
|
cmmExprType dflags (CmmStackSlot _ _) = bWord dflags
| 53
| false
| false
| 0
| 7
| 8
| 22
| 10
| 12
| null | null |
sdiehl/ghc
|
compiler/types/Type.hs
|
bsd-3-clause
|
stripCoercionTy :: Type -> Coercion
stripCoercionTy (CoercionTy co) = co
| 72
|
stripCoercionTy :: Type -> Coercion
stripCoercionTy (CoercionTy co) = co
| 72
|
stripCoercionTy (CoercionTy co) = co
| 36
| false
| true
| 0
| 7
| 9
| 24
| 12
| 12
| null | null |
upwawet/vision
|
src/Registry.hs
|
gpl-3.0
|
getEnv :: (WithRegistry, Typeable ix, Typeable r) => Extract ix r -> IO (Maybe (Env ix r))
getEnv spec = atomically $ do
map <- readTVar ?_Registry
case Map.lookup (typeOf $ env spec) map of
Nothing -> return Nothing
Just dv -> return $ fromDynamic dv
where env :: Extract ix a -> Env ix a
env = const undefined
| 333
|
getEnv :: (WithRegistry, Typeable ix, Typeable r) => Extract ix r -> IO (Maybe (Env ix r))
getEnv spec = atomically $ do
map <- readTVar ?_Registry
case Map.lookup (typeOf $ env spec) map of
Nothing -> return Nothing
Just dv -> return $ fromDynamic dv
where env :: Extract ix a -> Env ix a
env = const undefined
| 333
|
getEnv spec = atomically $ do
map <- readTVar ?_Registry
case Map.lookup (typeOf $ env spec) map of
Nothing -> return Nothing
Just dv -> return $ fromDynamic dv
where env :: Extract ix a -> Env ix a
env = const undefined
| 242
| false
| true
| 2
| 12
| 81
| 163
| 73
| 90
| null | null |
ihc/futhark
|
src/Futhark/Optimise/Simplifier/Rules.hs
|
isc
|
simplifyReshapeReshape :: LetTopDownRule lore u
simplifyReshapeReshape defOf _ (Reshape newshape v)
| Just (BasicOp (Reshape oldshape v2), v_cs) <- defOf v =
Just (Reshape (fuseReshape oldshape newshape) v2, v_cs)
| 219
|
simplifyReshapeReshape :: LetTopDownRule lore u
simplifyReshapeReshape defOf _ (Reshape newshape v)
| Just (BasicOp (Reshape oldshape v2), v_cs) <- defOf v =
Just (Reshape (fuseReshape oldshape newshape) v2, v_cs)
| 219
|
simplifyReshapeReshape defOf _ (Reshape newshape v)
| Just (BasicOp (Reshape oldshape v2), v_cs) <- defOf v =
Just (Reshape (fuseReshape oldshape newshape) v2, v_cs)
| 171
| false
| true
| 0
| 13
| 34
| 86
| 41
| 45
| null | null |
ags/haskell-robot
|
src/Robot/Command.hs
|
mit
|
parseCmd "RIGHT" = Just TurnRight
| 33
|
parseCmd "RIGHT" = Just TurnRight
| 33
|
parseCmd "RIGHT" = Just TurnRight
| 33
| false
| false
| 0
| 5
| 4
| 13
| 5
| 8
| null | null |
bamboo/idris-cil
|
src/IRTS/Cil/Builders.hs
|
bsd-3-clause
|
privateSealedClass :: TypeName -> Maybe TypeSpec -> [TypeSpec] -> [FieldDef] -> [MethodDef] -> [TypeDef] -> TypeDef
privateSealedClass = classDef [CaPrivate, CaSealed, CaBeforeFieldInit]
| 186
|
privateSealedClass :: TypeName -> Maybe TypeSpec -> [TypeSpec] -> [FieldDef] -> [MethodDef] -> [TypeDef] -> TypeDef
privateSealedClass = classDef [CaPrivate, CaSealed, CaBeforeFieldInit]
| 186
|
privateSealedClass = classDef [CaPrivate, CaSealed, CaBeforeFieldInit]
| 70
| false
| true
| 0
| 12
| 21
| 68
| 35
| 33
| null | null |
soscpd/bee
|
root/tests/zguide/examples/Haskell/rtdealer.hs
|
mit
|
-- In general, although locks are an antipattern in ZeroMQ, we need a lock
-- for the stdout handle, otherwise we will get jumbled text. We don't
-- use the lock for anything zeroMQ related, just output to screen.
workerThread :: MVar () -> IO ()
workerThread lock =
runZMQ $ do
worker <- socket Dealer
setRandomIdentity worker
connect worker "ipc://routing.ipc"
work worker
where
work = loop 0 where
loop val sock = do
-- Send an empty frame manually
-- Unlike the Request socket, the Dealer does not it automatically
send sock [SendMore] ""
send sock [] "Ready"
-- unlike the Request socket we need to read the empty frame
receive sock
workload <- receive sock
if unpack workload == "Fired!"
then liftIO $ withMVar lock $ \_ -> printf "Completed: %d tasks\n" (val::Int)
else do
rand <- liftIO $ getStdRandom (randomR (500 :: Int, 5000))
liftIO $ threadDelay rand
loop (val+1) sock
| 1,239
|
workerThread :: MVar () -> IO ()
workerThread lock =
runZMQ $ do
worker <- socket Dealer
setRandomIdentity worker
connect worker "ipc://routing.ipc"
work worker
where
work = loop 0 where
loop val sock = do
-- Send an empty frame manually
-- Unlike the Request socket, the Dealer does not it automatically
send sock [SendMore] ""
send sock [] "Ready"
-- unlike the Request socket we need to read the empty frame
receive sock
workload <- receive sock
if unpack workload == "Fired!"
then liftIO $ withMVar lock $ \_ -> printf "Completed: %d tasks\n" (val::Int)
else do
rand <- liftIO $ getStdRandom (randomR (500 :: Int, 5000))
liftIO $ threadDelay rand
loop (val+1) sock
| 1,023
|
workerThread lock =
runZMQ $ do
worker <- socket Dealer
setRandomIdentity worker
connect worker "ipc://routing.ipc"
work worker
where
work = loop 0 where
loop val sock = do
-- Send an empty frame manually
-- Unlike the Request socket, the Dealer does not it automatically
send sock [SendMore] ""
send sock [] "Ready"
-- unlike the Request socket we need to read the empty frame
receive sock
workload <- receive sock
if unpack workload == "Fired!"
then liftIO $ withMVar lock $ \_ -> printf "Completed: %d tasks\n" (val::Int)
else do
rand <- liftIO $ getStdRandom (randomR (500 :: Int, 5000))
liftIO $ threadDelay rand
loop (val+1) sock
| 990
| true
| true
| 0
| 19
| 510
| 230
| 109
| 121
| null | null |
mpickering/hackage-server
|
Distribution/Server/Framework/Auth.hs
|
bsd-3-clause
|
getUserAuth :: UserInfo -> Maybe UserAuth
getUserAuth userInfo =
case Users.userStatus userInfo of
Users.AccountEnabled auth -> Just auth
_ -> Nothing
| 184
|
getUserAuth :: UserInfo -> Maybe UserAuth
getUserAuth userInfo =
case Users.userStatus userInfo of
Users.AccountEnabled auth -> Just auth
_ -> Nothing
| 184
|
getUserAuth userInfo =
case Users.userStatus userInfo of
Users.AccountEnabled auth -> Just auth
_ -> Nothing
| 142
| false
| true
| 0
| 9
| 54
| 50
| 23
| 27
| null | null |
cdxr/haskell-interface
|
module-diff/Program.hs
|
bsd-3-clause
|
verbose :: String -> Program ()
verbose msg = do
f <- getVerbosePrinter
liftIO $ f msg
| 94
|
verbose :: String -> Program ()
verbose msg = do
f <- getVerbosePrinter
liftIO $ f msg
| 94
|
verbose msg = do
f <- getVerbosePrinter
liftIO $ f msg
| 62
| false
| true
| 0
| 8
| 24
| 40
| 18
| 22
| null | null |
bitemyapp/hoq
|
src/TypeChecking/Context.hs
|
gpl-2.0
|
lookupCtx :: (Monad g, Functor f, Eq s) => s -> Ctx s f b a -> Maybe (g a, f a)
lookupCtx _ Nil = Nothing
| 105
|
lookupCtx :: (Monad g, Functor f, Eq s) => s -> Ctx s f b a -> Maybe (g a, f a)
lookupCtx _ Nil = Nothing
| 105
|
lookupCtx _ Nil = Nothing
| 25
| false
| true
| 0
| 11
| 26
| 74
| 35
| 39
| null | null |
prl-tokyo/bigul-configuration-adaptation
|
Transformations/src/Generics/BiGUL/TH.hs
|
mit
|
-- empty
constructorsToSum (sum, v1) tps = foldr1 (\t1 t2 -> (ConT sum `AppT` t1) `AppT` t2) tps
| 96
|
constructorsToSum (sum, v1) tps = foldr1 (\t1 t2 -> (ConT sum `AppT` t1) `AppT` t2) tps
| 87
|
constructorsToSum (sum, v1) tps = foldr1 (\t1 t2 -> (ConT sum `AppT` t1) `AppT` t2) tps
| 87
| true
| false
| 0
| 11
| 17
| 51
| 29
| 22
| null | null |
bitonic/kyotocabinet
|
Database/KyotoCabinet/DB/CacheHash.hs
|
bsd-3-clause
|
className :: String
className = "*"
| 35
|
className :: String
className = "*"
| 35
|
className = "*"
| 15
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
bixuanzju/fcore
|
lib/archive/ClosureFNew.hs
|
bsd-2-clause
|
prettyExpr :: Prec -> Index -> Expr Index -> Doc
prettyExpr _ _ Unit = text "Unit"
| 82
|
prettyExpr :: Prec -> Index -> Expr Index -> Doc
prettyExpr _ _ Unit = text "Unit"
| 82
|
prettyExpr _ _ Unit = text "Unit"
| 33
| false
| true
| 0
| 8
| 16
| 36
| 17
| 19
| null | null |
olsner/ghc
|
compiler/utils/Outputable.hs
|
bsd-3-clause
|
showSDocDebug :: DynFlags -> SDoc -> String
showSDocDebug dflags d = renderWithStyle dflags d PprDebug
| 102
|
showSDocDebug :: DynFlags -> SDoc -> String
showSDocDebug dflags d = renderWithStyle dflags d PprDebug
| 102
|
showSDocDebug dflags d = renderWithStyle dflags d PprDebug
| 58
| false
| true
| 0
| 6
| 14
| 31
| 15
| 16
| null | null |
neilmayhew/DebianAnalytics
|
Color.hs
|
gpl-3.0
|
-- h: [0..360) s: [0..1] l: [0..1]
-- r,g,b: [0..1]
hsl2rgb :: (Double, Double, Double) -> (Double, Double, Double)
hsl2rgb (h, s, l) =
let q = if l <= 0.5 then l*(1+s) else l*(1-s) + s
p = 2*l - q
in (rgbQuant (p, q, h+120),
rgbQuant (p, q, h ),
rgbQuant (p, q, h-120))
where
rgbQuant (p, q, h') =
let h'' = if h' < 0 then h' + 360
else if h' >= 360 then h' - 360
else h'
in if h'' < 60 then p + (q-p)*h''/60
else if h'' < 180 then q
else if h'' < 240 then p + (q-p)*(240-h'')/60
else p
-- h: [0..360) s: [0..1] v: [0..1]
-- r,g,b: [0..1]
| 751
|
hsl2rgb :: (Double, Double, Double) -> (Double, Double, Double)
hsl2rgb (h, s, l) =
let q = if l <= 0.5 then l*(1+s) else l*(1-s) + s
p = 2*l - q
in (rgbQuant (p, q, h+120),
rgbQuant (p, q, h ),
rgbQuant (p, q, h-120))
where
rgbQuant (p, q, h') =
let h'' = if h' < 0 then h' + 360
else if h' >= 360 then h' - 360
else h'
in if h'' < 60 then p + (q-p)*h''/60
else if h'' < 180 then q
else if h'' < 240 then p + (q-p)*(240-h'')/60
else p
-- h: [0..360) s: [0..1] v: [0..1]
-- r,g,b: [0..1]
| 699
|
hsl2rgb (h, s, l) =
let q = if l <= 0.5 then l*(1+s) else l*(1-s) + s
p = 2*l - q
in (rgbQuant (p, q, h+120),
rgbQuant (p, q, h ),
rgbQuant (p, q, h-120))
where
rgbQuant (p, q, h') =
let h'' = if h' < 0 then h' + 360
else if h' >= 360 then h' - 360
else h'
in if h'' < 60 then p + (q-p)*h''/60
else if h'' < 180 then q
else if h'' < 240 then p + (q-p)*(240-h'')/60
else p
-- h: [0..360) s: [0..1] v: [0..1]
-- r,g,b: [0..1]
| 635
| true
| true
| 0
| 14
| 332
| 307
| 174
| 133
| null | null |
fmthoma/ghc
|
compiler/types/OptCoercion.hs
|
bsd-3-clause
|
opt_co2 env sym r co = opt_co3 env sym Nothing r co
| 57
|
opt_co2 env sym r co = opt_co3 env sym Nothing r co
| 57
|
opt_co2 env sym r co = opt_co3 env sym Nothing r co
| 57
| false
| false
| 0
| 5
| 17
| 26
| 12
| 14
| null | null |
flowbox-public/imagemagick
|
examples/text_effects.hs
|
apache-2.0
|
-- Text effect 1 - shadow effect using MagickShadowImage
-- This is derived from Anthony's Soft Shadow effect
-- convert -size 300x100 xc:none -font Candice -pointsize 72 \
-- -fill white -stroke black -annotate +25+65 'Anthony' \
-- \( +clone -background navy -shadow 70x4+5+5 \) +swap \
-- -background lightblue -flatten -trim +repage font_shadow_soft.jpg
-- NOTE - if an image has a transparent background, adding a border of any colour other
-- than "none" will remove all the transparency and replace it with the border's colour
textEffect1 :: (MonadResource m) => PMagickWand -> PDrawingWand -> PPixelWand -> m ()
textEffect1 w dw pw = do
pw `setColor` "none"
-- Create a new transparent image
newImage w 350 100 pw
-- Set up a 72 point white font
pw `setColor` "white"
dw `setFillColor` pw
dw `setFont` font
dw `setFontSize` 72
-- Add a black outline to the text
pw `setColor` "black"
dw `setStrokeColor` pw
-- Turn antialias on - not sure this makes a difference
dw `setTextAntialias` True
-- Now draw the text
drawAnnotation dw 25 65 "Magick"
-- Draw the image on to the magick_wand
drawImage w dw
-- Trim the image down to include only the text
trimImage w 0
-- equivalent to the command line +repage
resetImagePage w Nothing
-- Make a copy of the text image
(_,cloneW) <- cloneMagickWand w
-- Set the background colour to blue for the shadow
pw `setColor` "blue"
w `setImageBackgroundColor` pw
-- Opacity is a real number indicating (apparently) percentage
shadowImage w 70 4 5 5
-- Composite the text on top of the shadow
compositeImage w cloneW overCompositeOp 5 5
(_,w') <- magickWand
-- Create a new image the same size as the text image and put a solid colour
-- as its background
pw `setColor` "rgb(125,215,255)"
width <- getImageWidth w
height <- getImageHeight w
newImage w' width height pw
-- Now composite the shadowed text over the plain background
compositeImage w' w overCompositeOp 0 0
-- and write the result
writeImage w' (Just "text_shadow.png")
-- Given a pattern name (which MUST have a leading #) and a pattern file,
-- set up a pattern URL for later reference in the specified drawing wand
-- Currently only used in Text Effect 2
| 2,287
|
textEffect1 :: (MonadResource m) => PMagickWand -> PDrawingWand -> PPixelWand -> m ()
textEffect1 w dw pw = do
pw `setColor` "none"
-- Create a new transparent image
newImage w 350 100 pw
-- Set up a 72 point white font
pw `setColor` "white"
dw `setFillColor` pw
dw `setFont` font
dw `setFontSize` 72
-- Add a black outline to the text
pw `setColor` "black"
dw `setStrokeColor` pw
-- Turn antialias on - not sure this makes a difference
dw `setTextAntialias` True
-- Now draw the text
drawAnnotation dw 25 65 "Magick"
-- Draw the image on to the magick_wand
drawImage w dw
-- Trim the image down to include only the text
trimImage w 0
-- equivalent to the command line +repage
resetImagePage w Nothing
-- Make a copy of the text image
(_,cloneW) <- cloneMagickWand w
-- Set the background colour to blue for the shadow
pw `setColor` "blue"
w `setImageBackgroundColor` pw
-- Opacity is a real number indicating (apparently) percentage
shadowImage w 70 4 5 5
-- Composite the text on top of the shadow
compositeImage w cloneW overCompositeOp 5 5
(_,w') <- magickWand
-- Create a new image the same size as the text image and put a solid colour
-- as its background
pw `setColor` "rgb(125,215,255)"
width <- getImageWidth w
height <- getImageHeight w
newImage w' width height pw
-- Now composite the shadowed text over the plain background
compositeImage w' w overCompositeOp 0 0
-- and write the result
writeImage w' (Just "text_shadow.png")
-- Given a pattern name (which MUST have a leading #) and a pattern file,
-- set up a pattern URL for later reference in the specified drawing wand
-- Currently only used in Text Effect 2
| 1,717
|
textEffect1 w dw pw = do
pw `setColor` "none"
-- Create a new transparent image
newImage w 350 100 pw
-- Set up a 72 point white font
pw `setColor` "white"
dw `setFillColor` pw
dw `setFont` font
dw `setFontSize` 72
-- Add a black outline to the text
pw `setColor` "black"
dw `setStrokeColor` pw
-- Turn antialias on - not sure this makes a difference
dw `setTextAntialias` True
-- Now draw the text
drawAnnotation dw 25 65 "Magick"
-- Draw the image on to the magick_wand
drawImage w dw
-- Trim the image down to include only the text
trimImage w 0
-- equivalent to the command line +repage
resetImagePage w Nothing
-- Make a copy of the text image
(_,cloneW) <- cloneMagickWand w
-- Set the background colour to blue for the shadow
pw `setColor` "blue"
w `setImageBackgroundColor` pw
-- Opacity is a real number indicating (apparently) percentage
shadowImage w 70 4 5 5
-- Composite the text on top of the shadow
compositeImage w cloneW overCompositeOp 5 5
(_,w') <- magickWand
-- Create a new image the same size as the text image and put a solid colour
-- as its background
pw `setColor` "rgb(125,215,255)"
width <- getImageWidth w
height <- getImageHeight w
newImage w' width height pw
-- Now composite the shadowed text over the plain background
compositeImage w' w overCompositeOp 0 0
-- and write the result
writeImage w' (Just "text_shadow.png")
-- Given a pattern name (which MUST have a leading #) and a pattern file,
-- set up a pattern URL for later reference in the specified drawing wand
-- Currently only used in Text Effect 2
| 1,631
| true
| true
| 0
| 10
| 496
| 335
| 175
| 160
| null | null |
martrik/COMP101
|
Term1/COMP101/Lab2/LabSheet2.hs
|
mit
|
normalise :: String -> String
normalise [] = []
| 47
|
normalise :: String -> String
normalise [] = []
| 47
|
normalise [] = []
| 17
| false
| true
| 0
| 8
| 8
| 28
| 12
| 16
| null | null |
netrium/Netrium
|
src/DecisionTreeSimplify.hs
|
mit
|
decisionStepWithTime :: ProcessState -> (DecisionStep ProcessState, Time)
decisionStepWithTime st@(PSt time _ _) = case decisionStep st of
Done -> (Done, time)
Trade d sf t st1 -> (Trade d sf t st1, time)
Choose p id st1 st2 -> (Choose p id st1 st2, time)
ObserveCond o st1 st2 -> case Obs.eval time o of
Result True -> decisionStepWithTime st1
Result False -> decisionStepWithTime st2
_ -> (ObserveCond o st1 st2, time)
ObserveValue o k -> case Obs.eval time o of
Result v -> decisionStepWithTime (k v)
_ -> (ObserveValue o k, time)
Wait conds opts -> case simplifyWait time conds (not (null opts)) of
Left st' -> decisionStepWithTime st'
Right [] -> (Done, time)
Right conds' -> (Wait conds' opts, time)
-- The Wait action is the complicated one
--
| 1,112
|
decisionStepWithTime :: ProcessState -> (DecisionStep ProcessState, Time)
decisionStepWithTime st@(PSt time _ _) = case decisionStep st of
Done -> (Done, time)
Trade d sf t st1 -> (Trade d sf t st1, time)
Choose p id st1 st2 -> (Choose p id st1 st2, time)
ObserveCond o st1 st2 -> case Obs.eval time o of
Result True -> decisionStepWithTime st1
Result False -> decisionStepWithTime st2
_ -> (ObserveCond o st1 st2, time)
ObserveValue o k -> case Obs.eval time o of
Result v -> decisionStepWithTime (k v)
_ -> (ObserveValue o k, time)
Wait conds opts -> case simplifyWait time conds (not (null opts)) of
Left st' -> decisionStepWithTime st'
Right [] -> (Done, time)
Right conds' -> (Wait conds' opts, time)
-- The Wait action is the complicated one
--
| 1,112
|
decisionStepWithTime st@(PSt time _ _) = case decisionStep st of
Done -> (Done, time)
Trade d sf t st1 -> (Trade d sf t st1, time)
Choose p id st1 st2 -> (Choose p id st1 st2, time)
ObserveCond o st1 st2 -> case Obs.eval time o of
Result True -> decisionStepWithTime st1
Result False -> decisionStepWithTime st2
_ -> (ObserveCond o st1 st2, time)
ObserveValue o k -> case Obs.eval time o of
Result v -> decisionStepWithTime (k v)
_ -> (ObserveValue o k, time)
Wait conds opts -> case simplifyWait time conds (not (null opts)) of
Left st' -> decisionStepWithTime st'
Right [] -> (Done, time)
Right conds' -> (Wait conds' opts, time)
-- The Wait action is the complicated one
--
| 1,038
| false
| true
| 0
| 13
| 492
| 328
| 161
| 167
| null | null |
Peaker/bindings-GLFW
|
Test.hs
|
bsd-2-clause
|
test_window_size :: Ptr C'GLFWwindow -> IO ()
test_window_size p'win = do
let w = 17
h = 37
c'glfwSetWindowSize p'win w h
giveItTime
alloca $ \p'w' ->
alloca $ \p'h' -> do
c'glfwGetWindowSize p'win p'w' p'h'
w' <- fromIntegral `fmap` peek p'w'
h' <- fromIntegral `fmap` peek p'h'
w' @?= w
h' @?= h
| 377
|
test_window_size :: Ptr C'GLFWwindow -> IO ()
test_window_size p'win = do
let w = 17
h = 37
c'glfwSetWindowSize p'win w h
giveItTime
alloca $ \p'w' ->
alloca $ \p'h' -> do
c'glfwGetWindowSize p'win p'w' p'h'
w' <- fromIntegral `fmap` peek p'w'
h' <- fromIntegral `fmap` peek p'h'
w' @?= w
h' @?= h
| 377
|
test_window_size p'win = do
let w = 17
h = 37
c'glfwSetWindowSize p'win w h
giveItTime
alloca $ \p'w' ->
alloca $ \p'h' -> do
c'glfwGetWindowSize p'win p'w' p'h'
w' <- fromIntegral `fmap` peek p'w'
h' <- fromIntegral `fmap` peek p'h'
w' @?= w
h' @?= h
| 331
| false
| true
| 0
| 15
| 133
| 130
| 61
| 69
| null | null |
beni55/haste-compiler
|
libraries/ghc-7.8/base/GHC/Exts.hs
|
bsd-3-clause
|
groupByFB :: ([a] -> lst -> lst) -> lst -> (a -> a -> Bool) -> [a] -> lst
groupByFB c n eq xs0 = groupByFBCore xs0
where groupByFBCore [] = n
groupByFBCore (x:xs) = c (x:ys) (groupByFBCore zs)
where (ys, zs) = span (eq x) xs
-- -----------------------------------------------------------------------------
-- tracing
| 340
|
groupByFB :: ([a] -> lst -> lst) -> lst -> (a -> a -> Bool) -> [a] -> lst
groupByFB c n eq xs0 = groupByFBCore xs0
where groupByFBCore [] = n
groupByFBCore (x:xs) = c (x:ys) (groupByFBCore zs)
where (ys, zs) = span (eq x) xs
-- -----------------------------------------------------------------------------
-- tracing
| 340
|
groupByFB c n eq xs0 = groupByFBCore xs0
where groupByFBCore [] = n
groupByFBCore (x:xs) = c (x:ys) (groupByFBCore zs)
where (ys, zs) = span (eq x) xs
-- -----------------------------------------------------------------------------
-- tracing
| 266
| false
| true
| 1
| 10
| 74
| 139
| 73
| 66
| null | null |
sdiehl/ghc
|
compiler/deSugar/Coverage.hs
|
bsd-3-clause
|
addTickHsExpr e@(HsTcBracketOut {}) = return e
| 47
|
addTickHsExpr e@(HsTcBracketOut {}) = return e
| 47
|
addTickHsExpr e@(HsTcBracketOut {}) = return e
| 47
| false
| false
| 0
| 8
| 6
| 22
| 11
| 11
| null | null |
DM2014/homework2-hs
|
src/Parser.hs
|
mit
|
accumulateProduct :: Table Transaction -> Conduit Product (ResourceT IO) (Table Transaction)
accumulateProduct !table = do
p <- await
case p of
Just (Product userID productID) -> let table' = H.insertWith (\new set -> new `Set.union` set) userID (Set.singleton productID) table
in accumulateProduct table'
Nothing -> yield table
| 396
|
accumulateProduct :: Table Transaction -> Conduit Product (ResourceT IO) (Table Transaction)
accumulateProduct !table = do
p <- await
case p of
Just (Product userID productID) -> let table' = H.insertWith (\new set -> new `Set.union` set) userID (Set.singleton productID) table
in accumulateProduct table'
Nothing -> yield table
| 396
|
accumulateProduct !table = do
p <- await
case p of
Just (Product userID productID) -> let table' = H.insertWith (\new set -> new `Set.union` set) userID (Set.singleton productID) table
in accumulateProduct table'
Nothing -> yield table
| 303
| false
| true
| 0
| 17
| 114
| 132
| 63
| 69
| null | null |
nominolo/murmur-hash
|
Data/Digest/Murmur64.hs
|
bsd-3-clause
|
-- | Combine two hash generators. E.g.,
--
-- @
-- hashFoo (Foo a) = hash64AddInt 1 `combine` hash64Add a
-- @
combine :: (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> (Hash64 -> Hash64)
combine x y = y . x
| 207
|
combine :: (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> (Hash64 -> Hash64)
combine x y = y . x
| 93
|
combine x y = y . x
| 19
| true
| true
| 0
| 8
| 44
| 54
| 31
| 23
| null | null |
brendanhay/gogol
|
gogol-libraryagent/gen/Network/Google/Resource/LibraryAgent/Shelves/Books/Get.hs
|
mpl-2.0
|
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
sbgUploadType :: Lens' ShelvesBooksGet (Maybe Text)
sbgUploadType
= lens _sbgUploadType
(\ s a -> s{_sbgUploadType = a})
| 199
|
sbgUploadType :: Lens' ShelvesBooksGet (Maybe Text)
sbgUploadType
= lens _sbgUploadType
(\ s a -> s{_sbgUploadType = a})
| 128
|
sbgUploadType
= lens _sbgUploadType
(\ s a -> s{_sbgUploadType = a})
| 76
| true
| true
| 0
| 9
| 34
| 48
| 25
| 23
| null | null |
vito/atomo
|
src/Atomo/Pattern.hs
|
bsd-3-clause
|
match ids r x@(PMatch _) (Object { oDelegates = ds }) =
any (match ids r x) ds
| 82
|
match ids r x@(PMatch _) (Object { oDelegates = ds }) =
any (match ids r x) ds
| 82
|
match ids r x@(PMatch _) (Object { oDelegates = ds }) =
any (match ids r x) ds
| 82
| false
| false
| 0
| 9
| 21
| 52
| 26
| 26
| null | null |
frontrowed/stratosphere
|
gen/src/Gen/Specifications.hs
|
mit
|
-- A list of primitives
rawToSpecType' Nothing (Just "List") (Just prim) Nothing = ListType $ textToPrimitiveType prim
| 118
|
rawToSpecType' Nothing (Just "List") (Just prim) Nothing = ListType $ textToPrimitiveType prim
| 94
|
rawToSpecType' Nothing (Just "List") (Just prim) Nothing = ListType $ textToPrimitiveType prim
| 94
| true
| false
| 0
| 7
| 16
| 35
| 17
| 18
| null | null |
iand675/bearcat
|
src/Attributes.hs
|
bsd-3-clause
|
-- | Prevents rendering of given element, while keeping child elements, e.g. script elements, active.
hidden_ :: Attribute e
hidden_ = attribute "hidden" emptyStr
| 162
|
hidden_ :: Attribute e
hidden_ = attribute "hidden" emptyStr
| 60
|
hidden_ = attribute "hidden" emptyStr
| 37
| true
| true
| 0
| 5
| 23
| 20
| 10
| 10
| null | null |
tjakway/ghcjvm
|
compiler/main/HscMain.hs
|
bsd-3-clause
|
-- | Compile a stmt all the way to an HValue, but don't run it
--
-- We return Nothing to indicate an empty statement (or comment only), not a
-- parse error.
hscStmtWithLocation :: HscEnv
-> String -- ^ The statement
-> String -- ^ The source
-> Int -- ^ Starting line
-> IO ( Maybe ([Id]
, ForeignHValue {- IO [HValue] -}
, FixityEnv))
hscStmtWithLocation hsc_env0 stmt source linenumber =
runInteractiveHsc hsc_env0 $ do
maybe_stmt <- hscParseStmtWithLocation source linenumber stmt
case maybe_stmt of
Nothing -> return Nothing
Just parsed_stmt -> do
hsc_env <- getHscEnv
liftIO $ hscParsedStmt hsc_env parsed_stmt
| 791
|
hscStmtWithLocation :: HscEnv
-> String -- ^ The statement
-> String -- ^ The source
-> Int -- ^ Starting line
-> IO ( Maybe ([Id]
, ForeignHValue {- IO [HValue] -}
, FixityEnv))
hscStmtWithLocation hsc_env0 stmt source linenumber =
runInteractiveHsc hsc_env0 $ do
maybe_stmt <- hscParseStmtWithLocation source linenumber stmt
case maybe_stmt of
Nothing -> return Nothing
Just parsed_stmt -> do
hsc_env <- getHscEnv
liftIO $ hscParsedStmt hsc_env parsed_stmt
| 632
|
hscStmtWithLocation hsc_env0 stmt source linenumber =
runInteractiveHsc hsc_env0 $ do
maybe_stmt <- hscParseStmtWithLocation source linenumber stmt
case maybe_stmt of
Nothing -> return Nothing
Just parsed_stmt -> do
hsc_env <- getHscEnv
liftIO $ hscParsedStmt hsc_env parsed_stmt
| 318
| true
| true
| 0
| 14
| 275
| 130
| 66
| 64
| null | null |
GaloisInc/halvm-ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
-- Adds a newline
defaultLogActionHPutStrDoc :: DynFlags -> Handle -> SDoc -> PprStyle -> IO ()
defaultLogActionHPutStrDoc dflags h d sty
= Pretty.printDoc_ Pretty.PageMode (pprCols dflags) h doc
where -- Don't add a newline at the end, so that successive
-- calls to this log-action can output all on the same line
doc = runSDoc d (initSDocContext dflags sty)
| 381
|
defaultLogActionHPutStrDoc :: DynFlags -> Handle -> SDoc -> PprStyle -> IO ()
defaultLogActionHPutStrDoc dflags h d sty
= Pretty.printDoc_ Pretty.PageMode (pprCols dflags) h doc
where -- Don't add a newline at the end, so that successive
-- calls to this log-action can output all on the same line
doc = runSDoc d (initSDocContext dflags sty)
| 362
|
defaultLogActionHPutStrDoc dflags h d sty
= Pretty.printDoc_ Pretty.PageMode (pprCols dflags) h doc
where -- Don't add a newline at the end, so that successive
-- calls to this log-action can output all on the same line
doc = runSDoc d (initSDocContext dflags sty)
| 284
| true
| true
| 0
| 10
| 79
| 84
| 42
| 42
| null | null |
diminishedprime/.org
|
reading-list/cis194/scheme.hs
|
mit
|
showVal (Bool False) = "#f"
| 27
|
showVal (Bool False) = "#f"
| 27
|
showVal (Bool False) = "#f"
| 27
| false
| false
| 0
| 6
| 4
| 16
| 7
| 9
| null | null |
termite2/bv
|
BV/Util.hs
|
bsd-3-clause
|
constNeg :: Const -> Const
constNeg (Const c w) = mkConst ((complement c) `mod2` w) w
| 85
|
constNeg :: Const -> Const
constNeg (Const c w) = mkConst ((complement c) `mod2` w) w
| 85
|
constNeg (Const c w) = mkConst ((complement c) `mod2` w) w
| 58
| false
| true
| 0
| 9
| 15
| 46
| 24
| 22
| null | null |
urbanslug/ghc
|
compiler/utils/Digraph.hs
|
bsd-3-clause
|
verticesG :: Graph node -> [node]
verticesG graph = map (gr_vertex_to_node graph) $ vertices (gr_int_graph graph)
| 113
|
verticesG :: Graph node -> [node]
verticesG graph = map (gr_vertex_to_node graph) $ vertices (gr_int_graph graph)
| 113
|
verticesG graph = map (gr_vertex_to_node graph) $ vertices (gr_int_graph graph)
| 79
| false
| true
| 0
| 8
| 15
| 49
| 23
| 26
| null | null |
ulricha/dsh
|
src/Database/DSH/SL/Construct.hs
|
bsd-3-clause
|
slLit :: (PType, VecSegs) -> Build TSL DVec
slLit i = vec (SL $ NullaryOp $ Lit i) dvec
| 87
|
slLit :: (PType, VecSegs) -> Build TSL DVec
slLit i = vec (SL $ NullaryOp $ Lit i) dvec
| 87
|
slLit i = vec (SL $ NullaryOp $ Lit i) dvec
| 43
| false
| true
| 0
| 8
| 18
| 53
| 25
| 28
| null | null |
noteed/hicks
|
bin/config.hs
|
bsd-3-clause
|
main :: IO ()
main = defaultMain machines
| 41
|
main :: IO ()
main = defaultMain machines
| 41
|
main = defaultMain machines
| 27
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
forsyde/forsyde-atom
|
src/ForSyDe/Atom/MoC/Time.hs
|
bsd-3-clause
|
-- FROM Data.Number.FixedFunctions
-- | 'Time' representation of the number π. Rational
-- representation with a precision of @0.000001@.
pi :: Time
pi = RatF.pi 0.000001
| 177
|
pi :: Time
pi = RatF.pi 0.000001
| 32
|
pi = RatF.pi 0.000001
| 21
| true
| true
| 0
| 6
| 27
| 25
| 12
| 13
| null | null |
zalora/redsift
|
Redsift/DB.hs
|
gpl-3.0
|
allTables :: DbConfig -> IO (Map.Map String [(String, Bool)])
allTables dbConfig = withDB dbConfig $ \db -> foldl' f Map.empty `fmap` query_ db "SELECT table_schema, table_name, table_type = 'VIEW' FROM information_schema.tables ORDER BY table_schema, table_name DESC"
where f tuples (schema, name, type') = Map.insertWith (++) schema [(name, type')] tuples
-- As far as I can tell, postgresql-simple doesn't give us access to
-- the underlying LibPQ result or allow us to access the column names,
-- which is what I need here. I also want to get the results as
-- strings rather than as automatically-type-converted values, so I'm
-- using LibPQ directly here.
--
-- We have to return Aeson values here since there's no way of
-- representing Null (especially in homogenous lists) without them.
-- * issue general Query
| 823
|
allTables :: DbConfig -> IO (Map.Map String [(String, Bool)])
allTables dbConfig = withDB dbConfig $ \db -> foldl' f Map.empty `fmap` query_ db "SELECT table_schema, table_name, table_type = 'VIEW' FROM information_schema.tables ORDER BY table_schema, table_name DESC"
where f tuples (schema, name, type') = Map.insertWith (++) schema [(name, type')] tuples
-- As far as I can tell, postgresql-simple doesn't give us access to
-- the underlying LibPQ result or allow us to access the column names,
-- which is what I need here. I also want to get the results as
-- strings rather than as automatically-type-converted values, so I'm
-- using LibPQ directly here.
--
-- We have to return Aeson values here since there's no way of
-- representing Null (especially in homogenous lists) without them.
-- * issue general Query
| 823
|
allTables dbConfig = withDB dbConfig $ \db -> foldl' f Map.empty `fmap` query_ db "SELECT table_schema, table_name, table_type = 'VIEW' FROM information_schema.tables ORDER BY table_schema, table_name DESC"
where f tuples (schema, name, type') = Map.insertWith (++) schema [(name, type')] tuples
-- As far as I can tell, postgresql-simple doesn't give us access to
-- the underlying LibPQ result or allow us to access the column names,
-- which is what I need here. I also want to get the results as
-- strings rather than as automatically-type-converted values, so I'm
-- using LibPQ directly here.
--
-- We have to return Aeson values here since there's no way of
-- representing Null (especially in homogenous lists) without them.
-- * issue general Query
| 761
| false
| true
| 0
| 10
| 134
| 122
| 70
| 52
| null | null |
brendanhay/gogol
|
gogol-storage/gen/Network/Google/Storage/Types/Product.hs
|
mpl-2.0
|
-- | The condition(s) under which the action will be taken.
blriCondition :: Lens' BucketLifecycleRuleItem (Maybe BucketLifecycleRuleItemCondition)
blriCondition
= lens _blriCondition
(\ s a -> s{_blriCondition = a})
| 224
|
blriCondition :: Lens' BucketLifecycleRuleItem (Maybe BucketLifecycleRuleItemCondition)
blriCondition
= lens _blriCondition
(\ s a -> s{_blriCondition = a})
| 164
|
blriCondition
= lens _blriCondition
(\ s a -> s{_blriCondition = a})
| 76
| true
| true
| 0
| 9
| 35
| 48
| 25
| 23
| null | null |
jwiegley/hnix
|
src/Nix/Parser.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------------
nixExpr :: Parser NExprLoc
nixExpr = makeExprParser nixTerm $ map (map snd) (nixOperators nixSelector)
| 184
|
nixExpr :: Parser NExprLoc
nixExpr = makeExprParser nixTerm $ map (map snd) (nixOperators nixSelector)
| 102
|
nixExpr = makeExprParser nixTerm $ map (map snd) (nixOperators nixSelector)
| 75
| true
| true
| 0
| 8
| 15
| 39
| 19
| 20
| null | null |
utdemir/wai
|
warp/Network/Wai/Handler/Warp.hs
|
mit
|
-- | Get the interface to bind to.
--
-- Since 2.1.1
getHost :: Settings -> HostPreference
getHost = settingsHost
| 113
|
getHost :: Settings -> HostPreference
getHost = settingsHost
| 60
|
getHost = settingsHost
| 22
| true
| true
| 0
| 7
| 19
| 25
| 12
| 13
| null | null |
phischu/fragnix
|
tests/packages/scotty/Data.Primitive.MachDeps.hs
|
bsd-3-clause
|
aLIGNMENT_WORD = 8
| 18
|
aLIGNMENT_WORD = 8
| 18
|
aLIGNMENT_WORD = 8
| 18
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
fffej/HS-Poker
|
LookupPatternMatch.hs
|
bsd-3-clause
|
getValueFromProduct 729399 = 3922
| 33
|
getValueFromProduct 729399 = 3922
| 33
|
getValueFromProduct 729399 = 3922
| 33
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
akc/gfscript
|
HOPS/GF.hs
|
bsd-3-clause
|
cwFracs :: Int -> [Rational]
cwFracs n = take (2*(2^n-1)) (cwStream >>= \x -> [-x,x])
| 85
|
cwFracs :: Int -> [Rational]
cwFracs n = take (2*(2^n-1)) (cwStream >>= \x -> [-x,x])
| 85
|
cwFracs n = take (2*(2^n-1)) (cwStream >>= \x -> [-x,x])
| 56
| false
| true
| 0
| 10
| 14
| 64
| 35
| 29
| null | null |
da-x/ghc
|
compiler/codeGen/StgCmmProf.hs
|
bsd-3-clause
|
costCentreFrom :: DynFlags
-> CmmExpr -- A closure pointer
-> CmmExpr -- The cost centre from that closure
costCentreFrom dflags cl = CmmLoad (cmmOffsetB dflags cl (oFFSET_StgHeader_ccs dflags)) (ccsType dflags)
| 256
|
costCentreFrom :: DynFlags
-> CmmExpr -- A closure pointer
-> CmmExpr
costCentreFrom dflags cl = CmmLoad (cmmOffsetB dflags cl (oFFSET_StgHeader_ccs dflags)) (ccsType dflags)
| 212
|
costCentreFrom dflags cl = CmmLoad (cmmOffsetB dflags cl (oFFSET_StgHeader_ccs dflags)) (ccsType dflags)
| 104
| true
| true
| 0
| 9
| 74
| 53
| 27
| 26
| null | null |
pasberth/binal1
|
Language/Binal/Parser.hs
|
mit
|
digit :: T.Parser Char
digit = T.oneOf "0123456789"
| 51
|
digit :: T.Parser Char
digit = T.oneOf "0123456789"
| 51
|
digit = T.oneOf "0123456789"
| 28
| false
| true
| 1
| 6
| 7
| 25
| 10
| 15
| null | null |
xplat/extls
|
src/Network/EXTLS.hs
|
bsd-3-clause
|
write_buf :: TLS -> Ptr a -> Int -> IO Int
write_buf = wrap_buf raw_write
| 73
|
write_buf :: TLS -> Ptr a -> Int -> IO Int
write_buf = wrap_buf raw_write
| 73
|
write_buf = wrap_buf raw_write
| 30
| false
| true
| 0
| 8
| 14
| 32
| 15
| 17
| null | null |
sfultong/stand-in-language
|
src/SIL.hs
|
apache-2.0
|
i2g :: Int -> IExpr
i2g 0 = Zero
| 32
|
i2g :: Int -> IExpr
i2g 0 = Zero
| 32
|
i2g 0 = Zero
| 12
| false
| true
| 0
| 5
| 8
| 18
| 9
| 9
| null | null |
SAdams601/HaRe
|
old/testing/moveDefBtwMods/B6_TokOut.hs
|
bsd-3-clause
|
sumSquares1 [] =0
| 17
|
sumSquares1 [] =0
| 17
|
sumSquares1 [] =0
| 17
| false
| false
| 1
| 5
| 2
| 15
| 5
| 10
| null | null |
shlevy/ghc
|
compiler/cmm/PprC.hs
|
bsd-3-clause
|
pprDataExterns :: [CmmStatic] -> SDoc
pprDataExterns statics
= vcat (map pprExternDecl (Map.keys lbls))
where (_, lbls) = runTE (mapM_ te_Static statics)
| 157
|
pprDataExterns :: [CmmStatic] -> SDoc
pprDataExterns statics
= vcat (map pprExternDecl (Map.keys lbls))
where (_, lbls) = runTE (mapM_ te_Static statics)
| 157
|
pprDataExterns statics
= vcat (map pprExternDecl (Map.keys lbls))
where (_, lbls) = runTE (mapM_ te_Static statics)
| 119
| false
| true
| 0
| 9
| 24
| 72
| 34
| 38
| null | null |
pparkkin/eta
|
compiler/ETA/BasicTypes/Literal.hs
|
bsd-3-clause
|
litTag (MachNullAddr) = _ILIT(3)
| 37
|
litTag (MachNullAddr) = _ILIT(3)
| 37
|
litTag (MachNullAddr) = _ILIT(3)
| 37
| false
| false
| 0
| 6
| 8
| 18
| 9
| 9
| null | null |
purebred-mua/purebred
|
src/Purebred/UI/App.hs
|
agpl-3.0
|
renderWidget s _ ManageFileBrowserSearchPath = renderFileBrowserSearchPathEditor s
| 82
|
renderWidget s _ ManageFileBrowserSearchPath = renderFileBrowserSearchPathEditor s
| 82
|
renderWidget s _ ManageFileBrowserSearchPath = renderFileBrowserSearchPathEditor s
| 82
| false
| false
| 1
| 5
| 6
| 18
| 7
| 11
| null | null |
elieux/ghc
|
compiler/deSugar/DsUtils.hs
|
bsd-3-clause
|
mkLHsPatTup :: [LPat Id] -> LPat Id
mkLHsPatTup [] = noLoc $ mkVanillaTuplePat [] Boxed
| 91
|
mkLHsPatTup :: [LPat Id] -> LPat Id
mkLHsPatTup [] = noLoc $ mkVanillaTuplePat [] Boxed
| 91
|
mkLHsPatTup [] = noLoc $ mkVanillaTuplePat [] Boxed
| 55
| false
| true
| 2
| 8
| 18
| 45
| 20
| 25
| null | null |
mainland/nikola
|
examples/mandelbrot/Mandelbrot/NikolaV3/Implementation.hs
|
bsd-3-clause
|
mandelbrot :: Exp R
-> Exp R
-> Exp R
-> Exp R
-> Exp Int32
-> Exp Int32
-> Exp Int32
-> MComplexPlane G
-> MStepPlane G
-> P ()
mandelbrot lowx lowy highx highy viewx viewy depth mcs mzs = do
genPlane lowx lowy highx highy viewx viewy mcs
cs <- unsafeFreezeMArray mcs
mkinit cs mzs
stepN depth cs mzs
| 416
|
mandelbrot :: Exp R
-> Exp R
-> Exp R
-> Exp R
-> Exp Int32
-> Exp Int32
-> Exp Int32
-> MComplexPlane G
-> MStepPlane G
-> P ()
mandelbrot lowx lowy highx highy viewx viewy depth mcs mzs = do
genPlane lowx lowy highx highy viewx viewy mcs
cs <- unsafeFreezeMArray mcs
mkinit cs mzs
stepN depth cs mzs
| 416
|
mandelbrot lowx lowy highx highy viewx viewy depth mcs mzs = do
genPlane lowx lowy highx highy viewx viewy mcs
cs <- unsafeFreezeMArray mcs
mkinit cs mzs
stepN depth cs mzs
| 188
| false
| true
| 0
| 15
| 176
| 144
| 63
| 81
| null | null |
Teaspot-Studio/metagraph
|
src/Data/Metagraph/Strict.hs
|
bsd-3-clause
|
-- | Get edge directed flag
edgeDirected :: MetaEdge edge node -> Directed
edgeDirected !v = _edgeDirected v
| 108
|
edgeDirected :: MetaEdge edge node -> Directed
edgeDirected !v = _edgeDirected v
| 80
|
edgeDirected !v = _edgeDirected v
| 33
| true
| true
| 0
| 6
| 17
| 28
| 13
| 15
| null | null |
dillonhuff/GitVisualizer
|
src/Analysis.hs
|
gpl-2.0
|
analyzers =
[modCountsListReport,
modCountsBarChartReport,
filesChangedByCommitReport]
| 94
|
analyzers =
[modCountsListReport,
modCountsBarChartReport,
filesChangedByCommitReport]
| 94
|
analyzers =
[modCountsListReport,
modCountsBarChartReport,
filesChangedByCommitReport]
| 94
| false
| false
| 1
| 5
| 12
| 18
| 9
| 9
| null | null |
brendanhay/gogol
|
gogol-books/gen/Network/Google/Books/Types/Product.hs
|
mpl-2.0
|
-- | The date on which this book is available for sale.
vsiOnSaleDate :: Lens' VolumeSaleInfo (Maybe Text)
vsiOnSaleDate
= lens _vsiOnSaleDate
(\ s a -> s{_vsiOnSaleDate = a})
| 183
|
vsiOnSaleDate :: Lens' VolumeSaleInfo (Maybe Text)
vsiOnSaleDate
= lens _vsiOnSaleDate
(\ s a -> s{_vsiOnSaleDate = a})
| 127
|
vsiOnSaleDate
= lens _vsiOnSaleDate
(\ s a -> s{_vsiOnSaleDate = a})
| 76
| true
| true
| 0
| 8
| 36
| 49
| 25
| 24
| null | null |
rvion/lamdu
|
Lamdu/GUI/ExpressionGui.hs
|
gpl-3.0
|
maybeAddAnnotationWith o ExprGuiT.ShowAnnotationInVerboseMode annotation entityId eg =
maybeAddAnnotationH o ShowNothing annotation entityId eg
| 147
|
maybeAddAnnotationWith o ExprGuiT.ShowAnnotationInVerboseMode annotation entityId eg =
maybeAddAnnotationH o ShowNothing annotation entityId eg
| 147
|
maybeAddAnnotationWith o ExprGuiT.ShowAnnotationInVerboseMode annotation entityId eg =
maybeAddAnnotationH o ShowNothing annotation entityId eg
| 147
| false
| false
| 0
| 6
| 16
| 30
| 14
| 16
| null | null |
PaNaVTEC/Katas
|
bank-kata/haskell/src/BankKata/BankAccount.hs
|
apache-2.0
|
withdraw :: Day -> Nat -> BankAccount -> BankAccount
withdraw date amount account = addTransaction account (Withdraw date amount)
| 129
|
withdraw :: Day -> Nat -> BankAccount -> BankAccount
withdraw date amount account = addTransaction account (Withdraw date amount)
| 129
|
withdraw date amount account = addTransaction account (Withdraw date amount)
| 76
| false
| true
| 0
| 9
| 18
| 48
| 22
| 26
| null | null |
abailly/kontiki
|
test/Network/Kontiki/RaftSpec.hs
|
bsd-3-clause
|
raftSpec :: Spec
raftSpec = describe "Raft Protocol" $ do
it "steps down and grant vote on Request Vote if term is greater" $ do
handleRequestVote
| 153
|
raftSpec :: Spec
raftSpec = describe "Raft Protocol" $ do
it "steps down and grant vote on Request Vote if term is greater" $ do
handleRequestVote
| 153
|
raftSpec = describe "Raft Protocol" $ do
it "steps down and grant vote on Request Vote if term is greater" $ do
handleRequestVote
| 136
| false
| true
| 0
| 10
| 32
| 31
| 14
| 17
| null | null |
brendanhay/gogol
|
gogol-drive/gen/Network/Google/Drive/Types/Product.hs
|
mpl-2.0
|
-- | The distance to the subject of the photo, in meters.
fimmSubjectDistance :: Lens' FileImageMediaMetadata (Maybe Int32)
fimmSubjectDistance
= lens _fimmSubjectDistance
(\ s a -> s{_fimmSubjectDistance = a})
. mapping _Coerce
| 242
|
fimmSubjectDistance :: Lens' FileImageMediaMetadata (Maybe Int32)
fimmSubjectDistance
= lens _fimmSubjectDistance
(\ s a -> s{_fimmSubjectDistance = a})
. mapping _Coerce
| 184
|
fimmSubjectDistance
= lens _fimmSubjectDistance
(\ s a -> s{_fimmSubjectDistance = a})
. mapping _Coerce
| 118
| true
| true
| 0
| 10
| 45
| 55
| 28
| 27
| null | null |
hesiod/OpenGL
|
src/Graphics/Rendering/OpenGL/GL/ColorSum.hs
|
bsd-3-clause
|
--------------------------------------------------------------------------------
colorSum :: StateVar Capability
colorSum = makeCapability CapColorSum
| 151
|
colorSum :: StateVar Capability
colorSum = makeCapability CapColorSum
| 69
|
colorSum = makeCapability CapColorSum
| 37
| true
| true
| 1
| 5
| 9
| 21
| 9
| 12
| null | null |
maximilianhuber/maximilian-huber.de
|
src/Maxhbr/Gallery.hs
|
bsd-3-clause
|
getGalleryPagesInAllGalleries :: Producer Gallery GalleryPage
getGalleryPagesInAllGalleries = Producer $ nub . concatMap getGalleryPagesInGallery . flattenGallery
| 162
|
getGalleryPagesInAllGalleries :: Producer Gallery GalleryPage
getGalleryPagesInAllGalleries = Producer $ nub . concatMap getGalleryPagesInGallery . flattenGallery
| 162
|
getGalleryPagesInAllGalleries = Producer $ nub . concatMap getGalleryPagesInGallery . flattenGallery
| 100
| false
| true
| 1
| 7
| 14
| 35
| 15
| 20
| null | null |
bergmark/clay
|
src/Clay/Transition.hs
|
bsd-3-clause
|
ease, easeIn, easeOut, easeInOut, easeLinear, stepStart, stepStop :: TimingFunction
ease = other "ease"
| 110
|
ease, easeIn, easeOut, easeInOut, easeLinear, stepStart, stepStop :: TimingFunction
ease = other "ease"
| 109
|
ease = other "ease"
| 25
| false
| true
| 0
| 5
| 19
| 26
| 19
| 7
| null | null |
jtapolczai/Hephaestos
|
Crawling/Hephaestos/Fetch.hs
|
apache-2.0
|
saveFile :: forall e i.Show e
=> FetchOptions
-> FilePath -- ^The root of the filename under which to save. Should not contain the extension.
-> FetchResult e i -- ^Contents of the file
-> IO (Maybe FilePath) -- ^The actual filename under which the response was saved.
saveFile opts fn response
| isFailure response && (opts ^. maxFailureNodes) <<= 0 = return Nothing
| otherwise = do
let path = opts ^. savePath
createDirectoryIfMissing True (encodeString path)
-- get a conduit and slam everything into the target file
let fn' = encodeString $ path </> fn <.> ext response
runResourceT $ do
content <- action response
-- we first fuse "toStrict" and "sinkFile" and give that as the finaliser
-- for "content".
content Con.$$ toStrict Con.=$= ConB.sinkFile fn'
return $ Just $ fn <.> ext response
where
toStrict = Con.awaitForever $ Con.yield . BL.toStrict
-- downloads a Blob and gets the contents
action :: FetchResult e i -> ResourceT IO (Con.Source (ResourceT IO) BL.ByteString)
action (Blob _ url reqMod) = withTaskLimit (opts ^. taskLimit) $
download (opts & reqFunc %~ (`mappend` reqMod)) url >$> snd
--gets a ByteString out of a non-Blob leaf
action (PlainText _ p) = return' $ T.encodeUtf8 p
action (XmlResult _ p) = return' $ B.encode p
action (BinaryData _ p) = return' p
action (Info _ k v) = return' $ encode $ object ["key" .= k, "value" .= v]
action f@(Failure _ _) = return' $ encode $ action' f (opts ^. maxFailureNodes) 0
action Inner{} = liftIO (alertM "saveFile" "called saveFile with Inner node!")
>> error "called saveFile with Inner node!"
-- saves a chain of failure nodes, omitting some if the maxFailureNodes
-- limit is reached.
-- we have two "modes": the regular one, in which we create a nested
-- object, and the "limit reached" one, in which we go straight to
-- the root and count the number of omitted nodes along the way.
action' :: Show e => FetchResult e i -> Maybe Int -> Int -> Value
action' (Failure _ (Just (orig, _))) (Just 0) omitted = action' orig (Just 0) $ omitted + 1
action' f@(Failure e (Just (orig, name))) limit omitted =
object' ["error" .= show e, "type" .= ext f,
"child" .= action' orig (limit >$> subtract 1) omitted]
[("filename", name >$> encodeString)]
-- the root of a failure chain
action' f _ n = object' ["type" .= ext f]
[("url", getURL f >$> show >$> toJSON),
("omitted", n' >$> toJSON),
("error", getError f >$> show >$> toJSON)]
where
n' = if n == 0 then Nothing else Just n
-- |Gets the user's Downloads folder. This is assumed to be
-- the directory named \"Dowloads\" (case sensitive)
-- in the user's home directory.
| 3,047
|
saveFile :: forall e i.Show e
=> FetchOptions
-> FilePath -- ^The root of the filename under which to save. Should not contain the extension.
-> FetchResult e i -- ^Contents of the file
-> IO (Maybe FilePath)
saveFile opts fn response
| isFailure response && (opts ^. maxFailureNodes) <<= 0 = return Nothing
| otherwise = do
let path = opts ^. savePath
createDirectoryIfMissing True (encodeString path)
-- get a conduit and slam everything into the target file
let fn' = encodeString $ path </> fn <.> ext response
runResourceT $ do
content <- action response
-- we first fuse "toStrict" and "sinkFile" and give that as the finaliser
-- for "content".
content Con.$$ toStrict Con.=$= ConB.sinkFile fn'
return $ Just $ fn <.> ext response
where
toStrict = Con.awaitForever $ Con.yield . BL.toStrict
-- downloads a Blob and gets the contents
action :: FetchResult e i -> ResourceT IO (Con.Source (ResourceT IO) BL.ByteString)
action (Blob _ url reqMod) = withTaskLimit (opts ^. taskLimit) $
download (opts & reqFunc %~ (`mappend` reqMod)) url >$> snd
--gets a ByteString out of a non-Blob leaf
action (PlainText _ p) = return' $ T.encodeUtf8 p
action (XmlResult _ p) = return' $ B.encode p
action (BinaryData _ p) = return' p
action (Info _ k v) = return' $ encode $ object ["key" .= k, "value" .= v]
action f@(Failure _ _) = return' $ encode $ action' f (opts ^. maxFailureNodes) 0
action Inner{} = liftIO (alertM "saveFile" "called saveFile with Inner node!")
>> error "called saveFile with Inner node!"
-- saves a chain of failure nodes, omitting some if the maxFailureNodes
-- limit is reached.
-- we have two "modes": the regular one, in which we create a nested
-- object, and the "limit reached" one, in which we go straight to
-- the root and count the number of omitted nodes along the way.
action' :: Show e => FetchResult e i -> Maybe Int -> Int -> Value
action' (Failure _ (Just (orig, _))) (Just 0) omitted = action' orig (Just 0) $ omitted + 1
action' f@(Failure e (Just (orig, name))) limit omitted =
object' ["error" .= show e, "type" .= ext f,
"child" .= action' orig (limit >$> subtract 1) omitted]
[("filename", name >$> encodeString)]
-- the root of a failure chain
action' f _ n = object' ["type" .= ext f]
[("url", getURL f >$> show >$> toJSON),
("omitted", n' >$> toJSON),
("error", getError f >$> show >$> toJSON)]
where
n' = if n == 0 then Nothing else Just n
-- |Gets the user's Downloads folder. This is assumed to be
-- the directory named \"Dowloads\" (case sensitive)
-- in the user's home directory.
| 2,987
|
saveFile opts fn response
| isFailure response && (opts ^. maxFailureNodes) <<= 0 = return Nothing
| otherwise = do
let path = opts ^. savePath
createDirectoryIfMissing True (encodeString path)
-- get a conduit and slam everything into the target file
let fn' = encodeString $ path </> fn <.> ext response
runResourceT $ do
content <- action response
-- we first fuse "toStrict" and "sinkFile" and give that as the finaliser
-- for "content".
content Con.$$ toStrict Con.=$= ConB.sinkFile fn'
return $ Just $ fn <.> ext response
where
toStrict = Con.awaitForever $ Con.yield . BL.toStrict
-- downloads a Blob and gets the contents
action :: FetchResult e i -> ResourceT IO (Con.Source (ResourceT IO) BL.ByteString)
action (Blob _ url reqMod) = withTaskLimit (opts ^. taskLimit) $
download (opts & reqFunc %~ (`mappend` reqMod)) url >$> snd
--gets a ByteString out of a non-Blob leaf
action (PlainText _ p) = return' $ T.encodeUtf8 p
action (XmlResult _ p) = return' $ B.encode p
action (BinaryData _ p) = return' p
action (Info _ k v) = return' $ encode $ object ["key" .= k, "value" .= v]
action f@(Failure _ _) = return' $ encode $ action' f (opts ^. maxFailureNodes) 0
action Inner{} = liftIO (alertM "saveFile" "called saveFile with Inner node!")
>> error "called saveFile with Inner node!"
-- saves a chain of failure nodes, omitting some if the maxFailureNodes
-- limit is reached.
-- we have two "modes": the regular one, in which we create a nested
-- object, and the "limit reached" one, in which we go straight to
-- the root and count the number of omitted nodes along the way.
action' :: Show e => FetchResult e i -> Maybe Int -> Int -> Value
action' (Failure _ (Just (orig, _))) (Just 0) omitted = action' orig (Just 0) $ omitted + 1
action' f@(Failure e (Just (orig, name))) limit omitted =
object' ["error" .= show e, "type" .= ext f,
"child" .= action' orig (limit >$> subtract 1) omitted]
[("filename", name >$> encodeString)]
-- the root of a failure chain
action' f _ n = object' ["type" .= ext f]
[("url", getURL f >$> show >$> toJSON),
("omitted", n' >$> toJSON),
("error", getError f >$> show >$> toJSON)]
where
n' = if n == 0 then Nothing else Just n
-- |Gets the user's Downloads folder. This is assumed to be
-- the directory named \"Dowloads\" (case sensitive)
-- in the user's home directory.
| 2,742
| true
| true
| 8
| 15
| 918
| 847
| 412
| 435
| null | null |
rashack/scheme-in-48h
|
src/LispParser.hs
|
bsd-3-clause
|
letters = ['a'..'z'] ++ ['A'..'Z']
| 34
|
letters = ['a'..'z'] ++ ['A'..'Z']
| 34
|
letters = ['a'..'z'] ++ ['A'..'Z']
| 34
| false
| false
| 0
| 6
| 4
| 20
| 11
| 9
| null | null |
phaazon/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
|
bsd-3-clause
|
gl_VIEW_CLASS_S3TC_DXT1_RGBA :: GLenum
gl_VIEW_CLASS_S3TC_DXT1_RGBA = 0x82CD
| 76
|
gl_VIEW_CLASS_S3TC_DXT1_RGBA :: GLenum
gl_VIEW_CLASS_S3TC_DXT1_RGBA = 0x82CD
| 76
|
gl_VIEW_CLASS_S3TC_DXT1_RGBA = 0x82CD
| 37
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
DavidAlphaFox/ghc
|
libraries/transformers/Control/Monad/Trans/Writer/Strict.hs
|
bsd-3-clause
|
listens :: (Monoid w, Monad m) => (w -> b) -> WriterT w m a -> WriterT w m (a, b)
listens f m = WriterT $ do
(a, w) <- runWriterT m
return ((a, f w), w)
-- | @'pass' m@ is an action that executes the action @m@, which returns
-- a value and a function, and returns the value, applying the function
-- to the output.
--
-- * @'runWriterT' ('pass' m) = 'liftM' (\\ ((a, f), w) -> (a, f w)) ('runWriterT' m)@
| 414
|
listens :: (Monoid w, Monad m) => (w -> b) -> WriterT w m a -> WriterT w m (a, b)
listens f m = WriterT $ do
(a, w) <- runWriterT m
return ((a, f w), w)
-- | @'pass' m@ is an action that executes the action @m@, which returns
-- a value and a function, and returns the value, applying the function
-- to the output.
--
-- * @'runWriterT' ('pass' m) = 'liftM' (\\ ((a, f), w) -> (a, f w)) ('runWriterT' m)@
| 414
|
listens f m = WriterT $ do
(a, w) <- runWriterT m
return ((a, f w), w)
-- | @'pass' m@ is an action that executes the action @m@, which returns
-- a value and a function, and returns the value, applying the function
-- to the output.
--
-- * @'runWriterT' ('pass' m) = 'liftM' (\\ ((a, f), w) -> (a, f w)) ('runWriterT' m)@
| 332
| false
| true
| 0
| 11
| 95
| 112
| 60
| 52
| null | null |
OS2World/DEV-UTIL-HUGS
|
oldlib/ParseLib.hs
|
bsd-3-clause
|
sat :: (Char -> Bool) -> Parser Char
sat p = do {x <- item; if p x then return x else mzero}
| 119
|
sat :: (Char -> Bool) -> Parser Char
sat p = do {x <- item; if p x then return x else mzero}
| 119
|
sat p = do {x <- item; if p x then return x else mzero}
| 68
| false
| true
| 0
| 9
| 49
| 60
| 29
| 31
| null | null |
sebastiaanvisser/orchid
|
src/Network/Orchid/Format/Plain.hs
|
bsd-3-clause
|
plain :: FileStore -> FilePath -> FilePath -> String -> IO Output
plain _ _ _ = return . TextOutput
| 99
|
plain :: FileStore -> FilePath -> FilePath -> String -> IO Output
plain _ _ _ = return . TextOutput
| 99
|
plain _ _ _ = return . TextOutput
| 33
| false
| true
| 1
| 10
| 19
| 47
| 21
| 26
| null | null |
dcreager/cabal
|
Distribution/Simple/Program.hs
|
bsd-3-clause
|
lhcProgram :: Program
lhcProgram = (simpleProgram "lhc") {
programFindVersion = findProgramVersion "--version" $ \str ->
-- invoking "lhc --version" gives a string like
-- "lhc 0.3.20080208 (wubgipkamcep-2)
-- compiled by ghc-6.8 on a x86_64 running linux"
case words str of
(_:ver:_) -> ver
_ -> ""
}
| 349
|
lhcProgram :: Program
lhcProgram = (simpleProgram "lhc") {
programFindVersion = findProgramVersion "--version" $ \str ->
-- invoking "lhc --version" gives a string like
-- "lhc 0.3.20080208 (wubgipkamcep-2)
-- compiled by ghc-6.8 on a x86_64 running linux"
case words str of
(_:ver:_) -> ver
_ -> ""
}
| 349
|
lhcProgram = (simpleProgram "lhc") {
programFindVersion = findProgramVersion "--version" $ \str ->
-- invoking "lhc --version" gives a string like
-- "lhc 0.3.20080208 (wubgipkamcep-2)
-- compiled by ghc-6.8 on a x86_64 running linux"
case words str of
(_:ver:_) -> ver
_ -> ""
}
| 327
| false
| true
| 0
| 15
| 94
| 77
| 39
| 38
| null | null |
mettekou/ghc
|
compiler/typecheck/TcGenDeriv.hs
|
bsd-3-clause
|
mkCompareFields :: TyCon -> OrdOp -> [Type] -> LHsExpr RdrName
-- Generates nested comparisons for (a1,a2...) against (b1,b2,...)
-- where the ai,bi have the given types
mkCompareFields tycon op tys
= go tys as_RDRs bs_RDRs
where
go [] _ _ = eqResult op
go [ty] (a:_) (b:_)
| isUnliftedType ty = unliftedOrdOp tycon ty op a b
| otherwise = genOpApp (nlHsVar a) (ordMethRdr op) (nlHsVar b)
go (ty:tys) (a:as) (b:bs) = mk_compare ty a b
(ltResult op)
(go tys as bs)
(gtResult op)
go _ _ _ = panic "mkCompareFields"
-- (mk_compare ty a b) generates
-- (case (compare a b) of { LT -> <lt>; EQ -> <eq>; GT -> <bt> })
-- but with suitable special cases for
mk_compare ty a b lt eq gt
| isUnliftedType ty
= unliftedCompare lt_op eq_op a_expr b_expr lt eq gt
| otherwise
= nlHsCase (nlHsPar (nlHsApp (nlHsApp (nlHsVar compare_RDR) a_expr) b_expr))
[mkHsCaseAlt (nlNullaryConPat ltTag_RDR) lt,
mkHsCaseAlt (nlNullaryConPat eqTag_RDR) eq,
mkHsCaseAlt (nlNullaryConPat gtTag_RDR) gt]
where
a_expr = nlHsVar a
b_expr = nlHsVar b
(lt_op, _, eq_op, _, _) = primOrdOps "Ord" tycon ty
| 1,341
|
mkCompareFields :: TyCon -> OrdOp -> [Type] -> LHsExpr RdrName
mkCompareFields tycon op tys
= go tys as_RDRs bs_RDRs
where
go [] _ _ = eqResult op
go [ty] (a:_) (b:_)
| isUnliftedType ty = unliftedOrdOp tycon ty op a b
| otherwise = genOpApp (nlHsVar a) (ordMethRdr op) (nlHsVar b)
go (ty:tys) (a:as) (b:bs) = mk_compare ty a b
(ltResult op)
(go tys as bs)
(gtResult op)
go _ _ _ = panic "mkCompareFields"
-- (mk_compare ty a b) generates
-- (case (compare a b) of { LT -> <lt>; EQ -> <eq>; GT -> <bt> })
-- but with suitable special cases for
mk_compare ty a b lt eq gt
| isUnliftedType ty
= unliftedCompare lt_op eq_op a_expr b_expr lt eq gt
| otherwise
= nlHsCase (nlHsPar (nlHsApp (nlHsApp (nlHsVar compare_RDR) a_expr) b_expr))
[mkHsCaseAlt (nlNullaryConPat ltTag_RDR) lt,
mkHsCaseAlt (nlNullaryConPat eqTag_RDR) eq,
mkHsCaseAlt (nlNullaryConPat gtTag_RDR) gt]
where
a_expr = nlHsVar a
b_expr = nlHsVar b
(lt_op, _, eq_op, _, _) = primOrdOps "Ord" tycon ty
| 1,234
|
mkCompareFields tycon op tys
= go tys as_RDRs bs_RDRs
where
go [] _ _ = eqResult op
go [ty] (a:_) (b:_)
| isUnliftedType ty = unliftedOrdOp tycon ty op a b
| otherwise = genOpApp (nlHsVar a) (ordMethRdr op) (nlHsVar b)
go (ty:tys) (a:as) (b:bs) = mk_compare ty a b
(ltResult op)
(go tys as bs)
(gtResult op)
go _ _ _ = panic "mkCompareFields"
-- (mk_compare ty a b) generates
-- (case (compare a b) of { LT -> <lt>; EQ -> <eq>; GT -> <bt> })
-- but with suitable special cases for
mk_compare ty a b lt eq gt
| isUnliftedType ty
= unliftedCompare lt_op eq_op a_expr b_expr lt eq gt
| otherwise
= nlHsCase (nlHsPar (nlHsApp (nlHsApp (nlHsVar compare_RDR) a_expr) b_expr))
[mkHsCaseAlt (nlNullaryConPat ltTag_RDR) lt,
mkHsCaseAlt (nlNullaryConPat eqTag_RDR) eq,
mkHsCaseAlt (nlNullaryConPat gtTag_RDR) gt]
where
a_expr = nlHsVar a
b_expr = nlHsVar b
(lt_op, _, eq_op, _, _) = primOrdOps "Ord" tycon ty
| 1,171
| true
| true
| 6
| 14
| 454
| 406
| 202
| 204
| null | null |
tomberek/rulestesting
|
src/Control/Arrow/CCA/AExp.hs
|
bsd-3-clause
|
normalizeA (First (ArrM f)) = ArrM ( f `crossME` [|return|] )
| 61
|
normalizeA (First (ArrM f)) = ArrM ( f `crossME` [|return|] )
| 61
|
normalizeA (First (ArrM f)) = ArrM ( f `crossME` [|return|] )
| 61
| false
| false
| 0
| 8
| 10
| 37
| 20
| 17
| null | null |
janschulz/pandoc
|
src/Text/Pandoc/Readers/TWiki.hs
|
gpl-2.0
|
str :: TWParser B.Inlines
str = (many1 alphaNum <|> count 1 characterReference) >>= return . B.str
| 98
|
str :: TWParser B.Inlines
str = (many1 alphaNum <|> count 1 characterReference) >>= return . B.str
| 98
|
str = (many1 alphaNum <|> count 1 characterReference) >>= return . B.str
| 72
| false
| true
| 0
| 9
| 15
| 47
| 21
| 26
| null | null |
mfaerevaag/systat
|
src/Systat/Module.hs
|
mit
|
_NOC = "\x1b[1;0m"
| 21
|
_NOC = "\x1b[1;0m"
| 21
|
_NOC = "\x1b[1;0m"
| 21
| false
| false
| 0
| 4
| 5
| 6
| 3
| 3
| null | null |
eric-ch/idl
|
rpcgen/Backend/Javascript.hs
|
gpl-2.0
|
safeName s = s
| 14
|
safeName s = s
| 14
|
safeName s = s
| 14
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
lpsmith/json-builder
|
test/bench.hs
|
bsd-3-clause
|
array x = Json.Array (Json.Comma x)
| 35
|
array x = Json.Array (Json.Comma x)
| 35
|
array x = Json.Array (Json.Comma x)
| 35
| false
| false
| 0
| 8
| 5
| 22
| 10
| 12
| null | null |
bravit/Idris-dev
|
src/Idris/AbsSyntaxTree.hs
|
bsd-3-clause
|
mapPDeclFC f g (PData doc argdocs syn fc opts dat) =
PData doc argdocs syn (f fc) opts (mapPDataFC f g dat)
| 111
|
mapPDeclFC f g (PData doc argdocs syn fc opts dat) =
PData doc argdocs syn (f fc) opts (mapPDataFC f g dat)
| 111
|
mapPDeclFC f g (PData doc argdocs syn fc opts dat) =
PData doc argdocs syn (f fc) opts (mapPDataFC f g dat)
| 111
| false
| false
| 0
| 7
| 25
| 64
| 28
| 36
| null | null |
rueshyna/gogol
|
gogol-resourcemanager/gen/Network/Google/Resource/CloudResourceManager/Organizations/TestIAMPermissions.hs
|
mpl-2.0
|
-- | OAuth access token.
otipAccessToken :: Lens' OrganizationsTestIAMPermissions (Maybe Text)
otipAccessToken
= lens _otipAccessToken
(\ s a -> s{_otipAccessToken = a})
| 177
|
otipAccessToken :: Lens' OrganizationsTestIAMPermissions (Maybe Text)
otipAccessToken
= lens _otipAccessToken
(\ s a -> s{_otipAccessToken = a})
| 152
|
otipAccessToken
= lens _otipAccessToken
(\ s a -> s{_otipAccessToken = a})
| 82
| true
| true
| 0
| 9
| 29
| 48
| 25
| 23
| null | null |
hpacheco/HAAP
|
src/HAAP/Utils.hs
|
mit
|
sameJust _ _ = False
| 20
|
sameJust _ _ = False
| 20
|
sameJust _ _ = False
| 20
| false
| false
| 1
| 5
| 4
| 12
| 5
| 7
| null | null |
nushio3/ghc
|
compiler/stranal/DmdAnal.hs
|
bsd-3-clause
|
io_hack_reqd :: CoreExpr -> DataCon -> [Var] -> Bool
-- See Note [IO hack in the demand analyser]
io_hack_reqd scrut con bndrs
| (bndr:_) <- bndrs
, con == tupleDataCon Unboxed 2
, idType bndr `eqType` realWorldStatePrimTy
, (fun, _) <- collectArgs scrut
= case fun of
Var f -> not (isPrimOpId f)
_ -> True
| otherwise
= False
| 356
|
io_hack_reqd :: CoreExpr -> DataCon -> [Var] -> Bool
io_hack_reqd scrut con bndrs
| (bndr:_) <- bndrs
, con == tupleDataCon Unboxed 2
, idType bndr `eqType` realWorldStatePrimTy
, (fun, _) <- collectArgs scrut
= case fun of
Var f -> not (isPrimOpId f)
_ -> True
| otherwise
= False
| 311
|
io_hack_reqd scrut con bndrs
| (bndr:_) <- bndrs
, con == tupleDataCon Unboxed 2
, idType bndr `eqType` realWorldStatePrimTy
, (fun, _) <- collectArgs scrut
= case fun of
Var f -> not (isPrimOpId f)
_ -> True
| otherwise
= False
| 258
| true
| true
| 0
| 11
| 89
| 139
| 67
| 72
| null | null |
jvilar/hrows
|
lib/Col.hs
|
gpl-2.0
|
expressionT _ AllCols = pure AllCols
| 36
|
expressionT _ AllCols = pure AllCols
| 36
|
expressionT _ AllCols = pure AllCols
| 36
| false
| false
| 0
| 5
| 5
| 14
| 6
| 8
| null | null |
LukaHorvat/visibility
|
src/Data/Geometry/Point.hs
|
mit
|
sqrDist :: Point -> Point -> Double
sqrDist (Point x1 y1) (Point x2 y2) = (x2 - x1) ** 2 + (y2 - y1) ** 2
| 105
|
sqrDist :: Point -> Point -> Double
sqrDist (Point x1 y1) (Point x2 y2) = (x2 - x1) ** 2 + (y2 - y1) ** 2
| 105
|
sqrDist (Point x1 y1) (Point x2 y2) = (x2 - x1) ** 2 + (y2 - y1) ** 2
| 69
| false
| true
| 0
| 10
| 25
| 72
| 35
| 37
| null | null |
phischu/fragnix
|
tests/packages/scotty/Network.HPACK.Table.RevIndex.hs
|
bsd-3-clause
|
newOtherRevIndex :: IO OtherRevIdex
newOtherRevIndex = newIORef M.empty
| 71
|
newOtherRevIndex :: IO OtherRevIdex
newOtherRevIndex = newIORef M.empty
| 71
|
newOtherRevIndex = newIORef M.empty
| 35
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
zubeirarhesta/zubeirarhesta.github.io
|
.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/build/autogen/Paths_myblog.hs
|
bsd-3-clause
|
getLibDir = catchIO (getEnv "myblog_libdir") (\_ -> return libdir)
| 66
|
getLibDir = catchIO (getEnv "myblog_libdir") (\_ -> return libdir)
| 66
|
getLibDir = catchIO (getEnv "myblog_libdir") (\_ -> return libdir)
| 66
| false
| false
| 1
| 8
| 8
| 32
| 14
| 18
| null | null |
tismith/tlisp
|
src/Eval.hs
|
mit
|
apply (Func ps varargs b c) args = do
env <- getEnv
evalArgs <- mapM eval args
let remainingArgs = drop (length ps) evalArgs
if num ps /= num evalArgs && isNothing varargs
then throwError $ NumArgs (num ps) evalArgs
else do
--make a new frame for args, on top of the closure
newEnv <- liftIO $ addNewFrame c
putEnv newEnv
bindVars $ zip ps evalArgs
bindVarArgs varargs remainingArgs
r <- evalBody
--restore old env
putEnv env
return r
where num = toInteger . length
evalBody = liftM last $ mapM eval b
bindVarArgs arg remArgs = case arg of
Just argName -> bindVars [(argName, List remArgs)]
Nothing -> return ()
| 765
|
apply (Func ps varargs b c) args = do
env <- getEnv
evalArgs <- mapM eval args
let remainingArgs = drop (length ps) evalArgs
if num ps /= num evalArgs && isNothing varargs
then throwError $ NumArgs (num ps) evalArgs
else do
--make a new frame for args, on top of the closure
newEnv <- liftIO $ addNewFrame c
putEnv newEnv
bindVars $ zip ps evalArgs
bindVarArgs varargs remainingArgs
r <- evalBody
--restore old env
putEnv env
return r
where num = toInteger . length
evalBody = liftM last $ mapM eval b
bindVarArgs arg remArgs = case arg of
Just argName -> bindVars [(argName, List remArgs)]
Nothing -> return ()
| 765
|
apply (Func ps varargs b c) args = do
env <- getEnv
evalArgs <- mapM eval args
let remainingArgs = drop (length ps) evalArgs
if num ps /= num evalArgs && isNothing varargs
then throwError $ NumArgs (num ps) evalArgs
else do
--make a new frame for args, on top of the closure
newEnv <- liftIO $ addNewFrame c
putEnv newEnv
bindVars $ zip ps evalArgs
bindVarArgs varargs remainingArgs
r <- evalBody
--restore old env
putEnv env
return r
where num = toInteger . length
evalBody = liftM last $ mapM eval b
bindVarArgs arg remArgs = case arg of
Just argName -> bindVars [(argName, List remArgs)]
Nothing -> return ()
| 765
| false
| false
| 3
| 13
| 264
| 248
| 111
| 137
| null | null |
alphalambda/codeworld
|
codeworld-api/src/CodeWorld/Picture.hs
|
apache-2.0
|
rectangleVertices :: Double -> Double -> [Point]
rectangleVertices w h = [ (w / 2, h / 2), (w / 2, -h / 2), (-w / 2, -h / 2), (-w / 2, h / 2) ]
| 143
|
rectangleVertices :: Double -> Double -> [Point]
rectangleVertices w h = [ (w / 2, h / 2), (w / 2, -h / 2), (-w / 2, -h / 2), (-w / 2, h / 2) ]
| 143
|
rectangleVertices w h = [ (w / 2, h / 2), (w / 2, -h / 2), (-w / 2, -h / 2), (-w / 2, h / 2) ]
| 94
| false
| true
| 0
| 9
| 36
| 109
| 59
| 50
| null | null |
jdreaver/quantities
|
library/Data/Quantities/ExprParser.hs
|
bsd-3-clause
|
preprocessUnit :: Definitions -> SimpleUnit -> Either (QuantityError Double) SimpleUnit
preprocessUnit d (SimpleUnit s _ p)
| rs `elem` unitsList d = Right $ SimpleUnit ns np p
| otherwise = Left $ UndefinedUnitError s
where (rp, rs) = prefixParser d s
np = prefixSynonyms d M.! rp
ns = synonyms d M.! rs
-- | Try to parse a prefix from a symbol. Otherwise, just return the symbol.
| 429
|
preprocessUnit :: Definitions -> SimpleUnit -> Either (QuantityError Double) SimpleUnit
preprocessUnit d (SimpleUnit s _ p)
| rs `elem` unitsList d = Right $ SimpleUnit ns np p
| otherwise = Left $ UndefinedUnitError s
where (rp, rs) = prefixParser d s
np = prefixSynonyms d M.! rp
ns = synonyms d M.! rs
-- | Try to parse a prefix from a symbol. Otherwise, just return the symbol.
| 429
|
preprocessUnit d (SimpleUnit s _ p)
| rs `elem` unitsList d = Right $ SimpleUnit ns np p
| otherwise = Left $ UndefinedUnitError s
where (rp, rs) = prefixParser d s
np = prefixSynonyms d M.! rp
ns = synonyms d M.! rs
-- | Try to parse a prefix from a symbol. Otherwise, just return the symbol.
| 341
| false
| true
| 4
| 10
| 116
| 150
| 68
| 82
| null | null |
keithodulaigh/Hets
|
Temporal/Ctl.hs
|
gpl-2.0
|
sat m (EG phi) = sat m (Not (AF (Not phi)))
| 43
|
sat m (EG phi) = sat m (Not (AF (Not phi)))
| 43
|
sat m (EG phi) = sat m (Not (AF (Not phi)))
| 43
| false
| false
| 0
| 11
| 10
| 41
| 19
| 22
| null | null |
haskell-opengl/OpenGLRaw
|
src/Graphics/GL/Functions/F15.hs
|
bsd-3-clause
|
glIsPathNV
:: MonadIO m
=> GLuint -- ^ @path@ of type @Path@.
-> m GLboolean -- ^ of type [Boolean](Graphics-GL-Groups.html#Boolean).
glIsPathNV v1 = liftIO $ dyn284 ptr_glIsPathNV v1
| 189
|
glIsPathNV
:: MonadIO m
=> GLuint -- ^ @path@ of type @Path@.
-> m GLboolean
glIsPathNV v1 = liftIO $ dyn284 ptr_glIsPathNV v1
| 132
|
glIsPathNV v1 = liftIO $ dyn284 ptr_glIsPathNV v1
| 49
| true
| true
| 2
| 8
| 33
| 45
| 20
| 25
| null | null |
agentm/project-m36
|
src/bin/ProjectM36/Server/WebSocket.hs
|
unlicense
|
sendPromptInfo :: (HeadName, SchemaName) -> WS.Connection -> IO ()
sendPromptInfo (hName, sName) conn = WS.sendTextData conn (encode (object ["promptInfo" .= object ["headname" .= hName, "schemaname" .= sName]]))
| 212
|
sendPromptInfo :: (HeadName, SchemaName) -> WS.Connection -> IO ()
sendPromptInfo (hName, sName) conn = WS.sendTextData conn (encode (object ["promptInfo" .= object ["headname" .= hName, "schemaname" .= sName]]))
| 212
|
sendPromptInfo (hName, sName) conn = WS.sendTextData conn (encode (object ["promptInfo" .= object ["headname" .= hName, "schemaname" .= sName]]))
| 145
| false
| true
| 0
| 14
| 26
| 86
| 45
| 41
| null | null |
apyrgio/ganeti
|
src/Ganeti/Locking/Locks.hs
|
bsd-2-clause
|
lockFromName "cluster/config" = return ConfigLock
| 49
|
lockFromName "cluster/config" = return ConfigLock
| 49
|
lockFromName "cluster/config" = return ConfigLock
| 49
| false
| false
| 0
| 5
| 4
| 12
| 5
| 7
| null | null |
HackerspaceBielefeld/boostat
|
src/Boostat/SQL.hs
|
bsd-2-clause
|
getData :: String -> ExceptT String IO [Record]
getData db = do
c <- openDb db
hdbcToExcept "can't read from DB: "
$ map convertRecord <$> quickQuery c selQuery []
| 171
|
getData :: String -> ExceptT String IO [Record]
getData db = do
c <- openDb db
hdbcToExcept "can't read from DB: "
$ map convertRecord <$> quickQuery c selQuery []
| 171
|
getData db = do
c <- openDb db
hdbcToExcept "can't read from DB: "
$ map convertRecord <$> quickQuery c selQuery []
| 123
| false
| true
| 0
| 9
| 37
| 64
| 29
| 35
| null | null |
ezyang/ghc
|
compiler/nativeGen/SPARC/Regs.hs
|
bsd-3-clause
|
o0 = RegReal (RealRegSingle (oReg 0))
| 38
|
o0 = RegReal (RealRegSingle (oReg 0))
| 38
|
o0 = RegReal (RealRegSingle (oReg 0))
| 38
| false
| false
| 1
| 9
| 6
| 24
| 10
| 14
| null | null |
GOGEN/kurs
|
dist/build/autogen/Paths_Kurs.hs
|
gpl-3.0
|
libdir = "/home/gogen/.cabal/lib/x86_64-linux-ghc-7.6.3/Kurs-0.1.0.0"
| 73
|
libdir = "/home/gogen/.cabal/lib/x86_64-linux-ghc-7.6.3/Kurs-0.1.0.0"
| 73
|
libdir = "/home/gogen/.cabal/lib/x86_64-linux-ghc-7.6.3/Kurs-0.1.0.0"
| 73
| false
| false
| 0
| 4
| 6
| 6
| 3
| 3
| null | null |
alanz/hroq
|
src/Data/Concurrent/Queue/Roq/Mnesia.hs
|
bsd-3-clause
|
directoryPrefix :: String
directoryPrefix = ".hroqdata/"
| 56
|
directoryPrefix :: String
directoryPrefix = ".hroqdata/"
| 56
|
directoryPrefix = ".hroqdata/"
| 30
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
shlevy/ghc
|
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
|
bsd-3-clause
|
{-
Note [Name lookup]
~~~~~~~~~~~~~~~~~~
-}
{- $namelookup #namelookup#
The functions 'lookupTypeName' and 'lookupValueName' provide
a way to query the current splice's context for what names
are in scope. The function 'lookupTypeName' queries the type
namespace, whereas 'lookupValueName' queries the value namespace,
but the functions are otherwise identical.
A call @lookupValueName s@ will check if there is a value
with name @s@ in scope at the current splice's location. If
there is, the @Name@ of this value is returned;
if not, then @Nothing@ is returned.
The returned name cannot be \"captured\".
For example:
> f = "global"
> g = $( do
> Just nm <- lookupValueName "f"
> [| let f = "local" in $( varE nm ) |]
In this case, @g = \"global\"@; the call to @lookupValueName@
returned the global @f@, and this name was /not/ captured by
the local definition of @f@.
The lookup is performed in the context of the /top-level/ splice
being run. For example:
> f = "global"
> g = $( [| let f = "local" in
> $(do
> Just nm <- lookupValueName "f"
> varE nm
> ) |] )
Again in this example, @g = \"global\"@, because the call to
@lookupValueName@ queries the context of the outer-most @$(...)@.
Operators should be queried without any surrounding parentheses, like so:
> lookupValueName "+"
Qualified names are also supported, like so:
> lookupValueName "Prelude.+"
> lookupValueName "Prelude.map"
-}
{- | 'reify' looks up information about the 'Name'.
It is sometimes useful to construct the argument name using 'lookupTypeName' or 'lookupValueName'
to ensure that we are reifying from the right namespace. For instance, in this context:
> data D = D
which @D@ does @reify (mkName \"D\")@ return information about? (Answer: @D@-the-type, but don't rely on it.)
To ensure we get information about @D@-the-value, use 'lookupValueName':
> do
> Just nm <- lookupValueName "D"
> reify nm
and to get information about @D@-the-type, use 'lookupTypeName'.
-}
reify :: Name -> Q Info
reify v = Q (qReify v)
| 2,089
|
reify :: Name -> Q Info
reify v = Q (qReify v)
| 46
|
reify v = Q (qReify v)
| 22
| true
| true
| 0
| 7
| 428
| 37
| 18
| 19
| null | null |
mapinguari/SC_HS_Proxy
|
src/Proxy/PathFinding/AStarState.hs
|
mit
|
first :: (a -> Bool) -> [a] -> Maybe a
first _ [] = Nothing
| 59
|
first :: (a -> Bool) -> [a] -> Maybe a
first _ [] = Nothing
| 59
|
first _ [] = Nothing
| 20
| false
| true
| 0
| 7
| 14
| 39
| 20
| 19
| null | null |
sleexyz/haskell-fun
|
Defunctionalization.hs
|
bsd-3-clause
|
inject :: Expr a -> State a
inject expr = (expr, [], Done)
| 58
|
inject :: Expr a -> State a
inject expr = (expr, [], Done)
| 58
|
inject expr = (expr, [], Done)
| 30
| false
| true
| 0
| 7
| 12
| 40
| 19
| 21
| null | null |
oldmanmike/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
gHC_STATICPTR :: Module
gHC_STATICPTR = mkBaseModule (fsLit "GHC.StaticPtr")
| 76
|
gHC_STATICPTR :: Module
gHC_STATICPTR = mkBaseModule (fsLit "GHC.StaticPtr")
| 76
|
gHC_STATICPTR = mkBaseModule (fsLit "GHC.StaticPtr")
| 52
| false
| true
| 0
| 7
| 7
| 20
| 10
| 10
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.