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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ku-fpg/kansas-amber | System/Hardware/Haskino/Protocol.hs | bsd-3-clause | parseQueryResult (I2CReadE _ _) (I2CReply ds) = Just (lit ds) | 61 | parseQueryResult (I2CReadE _ _) (I2CReply ds) = Just (lit ds) | 61 | parseQueryResult (I2CReadE _ _) (I2CReply ds) = Just (lit ds) | 61 | false | false | 0 | 7 | 9 | 34 | 16 | 18 | null | null |
dolio/vector | old-testsuite/Testsuite/Vector/AsList.hs | bsd-3-clause | prop_dropWhile = arg_ty (A :-> Bool) $ V.dropWhile ==? dropWhile | 64 | prop_dropWhile = arg_ty (A :-> Bool) $ V.dropWhile ==? dropWhile | 64 | prop_dropWhile = arg_ty (A :-> Bool) $ V.dropWhile ==? dropWhile | 64 | false | false | 0 | 9 | 9 | 26 | 13 | 13 | null | null |
themoritz/cabal | Cabal/Distribution/Simple/Setup.hs | bsd-3-clause | emptyHaddockFlags :: HaddockFlags
emptyHaddockFlags = mempty | 60 | emptyHaddockFlags :: HaddockFlags
emptyHaddockFlags = mempty | 60 | emptyHaddockFlags = mempty | 26 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
piotrm0/planar | Emit.hs | artistic-2.0 | cgen (S.If cond tr fl) = do
ifthen <- addBlock "if.then"
ifelse <- addBlock "if.else"
ifexit <- addBlock "if.exit"
-- %entry
------------------
cond <- cgen cond
test <- fcmp FP.ONE false cond
cbr test ifthen ifelse -- Branch based on the condition
-- if.then
------------------
setBlock ifthen
trval <- cgen tr -- Generate code for the true branch
br ifexit -- Branch to the merge block
ifthen <- getBlock
-- if.else
------------------
setBlock ifelse
flval <- cgen fl -- Generate code for the false branch
br ifexit -- Branch to the merge block
ifelse <- getBlock
-- if.exit
------------------
setBlock ifexit
phi double [(trval, ifthen), (flval, ifelse)] | 747 | cgen (S.If cond tr fl) = do
ifthen <- addBlock "if.then"
ifelse <- addBlock "if.else"
ifexit <- addBlock "if.exit"
-- %entry
------------------
cond <- cgen cond
test <- fcmp FP.ONE false cond
cbr test ifthen ifelse -- Branch based on the condition
-- if.then
------------------
setBlock ifthen
trval <- cgen tr -- Generate code for the true branch
br ifexit -- Branch to the merge block
ifthen <- getBlock
-- if.else
------------------
setBlock ifelse
flval <- cgen fl -- Generate code for the false branch
br ifexit -- Branch to the merge block
ifelse <- getBlock
-- if.exit
------------------
setBlock ifexit
phi double [(trval, ifthen), (flval, ifelse)] | 747 | cgen (S.If cond tr fl) = do
ifthen <- addBlock "if.then"
ifelse <- addBlock "if.else"
ifexit <- addBlock "if.exit"
-- %entry
------------------
cond <- cgen cond
test <- fcmp FP.ONE false cond
cbr test ifthen ifelse -- Branch based on the condition
-- if.then
------------------
setBlock ifthen
trval <- cgen tr -- Generate code for the true branch
br ifexit -- Branch to the merge block
ifthen <- getBlock
-- if.else
------------------
setBlock ifelse
flval <- cgen fl -- Generate code for the false branch
br ifexit -- Branch to the merge block
ifelse <- getBlock
-- if.exit
------------------
setBlock ifexit
phi double [(trval, ifthen), (flval, ifelse)] | 747 | false | false | 0 | 9 | 196 | 190 | 89 | 101 | null | null |
hvr/jhc | src/Name/Internals.hs | mit | nameToBits :: Name -> (Atom,NameType)
nameToBits (Name n) = (unsafeWord32ToAtom (n `unsafeShiftR` 8), toEnum $ fromIntegral (n .&. 0xff)) | 137 | nameToBits :: Name -> (Atom,NameType)
nameToBits (Name n) = (unsafeWord32ToAtom (n `unsafeShiftR` 8), toEnum $ fromIntegral (n .&. 0xff)) | 137 | nameToBits (Name n) = (unsafeWord32ToAtom (n `unsafeShiftR` 8), toEnum $ fromIntegral (n .&. 0xff)) | 99 | false | true | 0 | 9 | 18 | 62 | 34 | 28 | null | null |
thomie/vector | Data/Vector/Primitive.hs | bsd-3-clause | postscanr = G.postscanr | 23 | postscanr = G.postscanr | 23 | postscanr = G.postscanr | 23 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
jaspervdj/what-morphism | src/WhatMorphism/RewriteM.hs | bsd-3-clause | registeredFold :: Type -> RewriteM Id
registeredFold typ = do
register <- registerFor typ
lookupImportedString (registerFold register)
-------------------------------------------------------------------------------- | 225 | registeredFold :: Type -> RewriteM Id
registeredFold typ = do
register <- registerFor typ
lookupImportedString (registerFold register)
-------------------------------------------------------------------------------- | 225 | registeredFold typ = do
register <- registerFor typ
lookupImportedString (registerFold register)
-------------------------------------------------------------------------------- | 187 | false | true | 0 | 9 | 27 | 44 | 20 | 24 | null | null |
tjakway/ghcjvm | compiler/main/HscMain.hs | bsd-3-clause | hscDesugar' :: ModLocation -> TcGblEnv -> Hsc ModGuts
hscDesugar' mod_location tc_result = do
hsc_env <- getHscEnv
r <- ioMsgMaybe $
{-# SCC "deSugar" #-}
deSugar hsc_env mod_location tc_result
-- always check -Werror after desugaring, this is the last opportunity for
-- warnings to arise before the backend.
handleWarnings
return r
-- | Make a 'ModDetails' from the results of typechecking. Used when
-- typechecking only, as opposed to full compilation. | 494 | hscDesugar' :: ModLocation -> TcGblEnv -> Hsc ModGuts
hscDesugar' mod_location tc_result = do
hsc_env <- getHscEnv
r <- ioMsgMaybe $
{-# SCC "deSugar" #-}
deSugar hsc_env mod_location tc_result
-- always check -Werror after desugaring, this is the last opportunity for
-- warnings to arise before the backend.
handleWarnings
return r
-- | Make a 'ModDetails' from the results of typechecking. Used when
-- typechecking only, as opposed to full compilation. | 494 | hscDesugar' mod_location tc_result = do
hsc_env <- getHscEnv
r <- ioMsgMaybe $
{-# SCC "deSugar" #-}
deSugar hsc_env mod_location tc_result
-- always check -Werror after desugaring, this is the last opportunity for
-- warnings to arise before the backend.
handleWarnings
return r
-- | Make a 'ModDetails' from the results of typechecking. Used when
-- typechecking only, as opposed to full compilation. | 440 | false | true | 0 | 9 | 107 | 66 | 32 | 34 | null | null |
tolysz/prepare-ghcjs | spec-lts8/cabal/Cabal/tests/UnitTests/Distribution/Version.hs | bsd-3-clause | -- | The semantics of 'intersectVersionIntervals' is (&&).
--
prop_intersectVersionIntervals :: VersionIntervals -> VersionIntervals
-> Version -> Bool
prop_intersectVersionIntervals is1 is2 v =
withinIntervals v (intersectVersionIntervals is1 is2)
== (withinIntervals v is1 && withinIntervals v is2) | 338 | prop_intersectVersionIntervals :: VersionIntervals -> VersionIntervals
-> Version -> Bool
prop_intersectVersionIntervals is1 is2 v =
withinIntervals v (intersectVersionIntervals is1 is2)
== (withinIntervals v is1 && withinIntervals v is2) | 276 | prop_intersectVersionIntervals is1 is2 v =
withinIntervals v (intersectVersionIntervals is1 is2)
== (withinIntervals v is1 && withinIntervals v is2) | 155 | true | true | 1 | 7 | 73 | 68 | 34 | 34 | null | null |
mcschroeder/ghc | libraries/template-haskell/Language/Haskell/TH/Lib.hs | bsd-3-clause | arrowT :: TypeQ
arrowT = return ArrowT | 38 | arrowT :: TypeQ
arrowT = return ArrowT | 38 | arrowT = return ArrowT | 22 | false | true | 0 | 6 | 6 | 21 | 8 | 13 | null | null |
pmiddend/networkie | src/Networkie/NewListenSocket.hs | gpl-2.0 | newListenSocket :: Int -> IO (Event FrpSocket)
newListenSocket p = do
addrinfos <- getAddrInfo
(Just (defaultHints {addrFlags = [AI_PASSIVE]}))
Nothing
(Just (show p))
case headMay addrinfos of
Just serveraddr -> do
sock <- socket (addrFamily serveraddr) Stream defaultProtocol
bindSocket sock (addrAddress serveraddr)
listen sock myport
printf "Listening on port %d\n" myport
(eventNewSocket,pushNewSocket) <- sync newEvent
_ <- forkAndThen (\_ -> sClose sock) (forever $ do
(clientSocket, addr) <- accept sock
h <- socketToHandle clientSocket ReadWriteMode
printf "Accepted connection from: %s\n" (show addr)
(eventDataReceived,pushDataReceived) <- sync newEvent
(eventError,pushError) <- sync newEvent
_ <- forkAndThen (\(Left e) -> sync $ pushError e)
(forever (BS8.hGetLine h >>= \l -> sync (pushDataReceived l))) -- FIXME: Das macht das ganze zeilenbasiert, man sollte hGetLine durch was geileres ersetzen
sync $ pushNewSocket (FrpSocket eventDataReceived h eventError)
)
return eventNewSocket
Nothing -> error "Couldn't get port addrinfo, exiting" | 1,239 | newListenSocket :: Int -> IO (Event FrpSocket)
newListenSocket p = do
addrinfos <- getAddrInfo
(Just (defaultHints {addrFlags = [AI_PASSIVE]}))
Nothing
(Just (show p))
case headMay addrinfos of
Just serveraddr -> do
sock <- socket (addrFamily serveraddr) Stream defaultProtocol
bindSocket sock (addrAddress serveraddr)
listen sock myport
printf "Listening on port %d\n" myport
(eventNewSocket,pushNewSocket) <- sync newEvent
_ <- forkAndThen (\_ -> sClose sock) (forever $ do
(clientSocket, addr) <- accept sock
h <- socketToHandle clientSocket ReadWriteMode
printf "Accepted connection from: %s\n" (show addr)
(eventDataReceived,pushDataReceived) <- sync newEvent
(eventError,pushError) <- sync newEvent
_ <- forkAndThen (\(Left e) -> sync $ pushError e)
(forever (BS8.hGetLine h >>= \l -> sync (pushDataReceived l))) -- FIXME: Das macht das ganze zeilenbasiert, man sollte hGetLine durch was geileres ersetzen
sync $ pushNewSocket (FrpSocket eventDataReceived h eventError)
)
return eventNewSocket
Nothing -> error "Couldn't get port addrinfo, exiting" | 1,239 | newListenSocket p = do
addrinfos <- getAddrInfo
(Just (defaultHints {addrFlags = [AI_PASSIVE]}))
Nothing
(Just (show p))
case headMay addrinfos of
Just serveraddr -> do
sock <- socket (addrFamily serveraddr) Stream defaultProtocol
bindSocket sock (addrAddress serveraddr)
listen sock myport
printf "Listening on port %d\n" myport
(eventNewSocket,pushNewSocket) <- sync newEvent
_ <- forkAndThen (\_ -> sClose sock) (forever $ do
(clientSocket, addr) <- accept sock
h <- socketToHandle clientSocket ReadWriteMode
printf "Accepted connection from: %s\n" (show addr)
(eventDataReceived,pushDataReceived) <- sync newEvent
(eventError,pushError) <- sync newEvent
_ <- forkAndThen (\(Left e) -> sync $ pushError e)
(forever (BS8.hGetLine h >>= \l -> sync (pushDataReceived l))) -- FIXME: Das macht das ganze zeilenbasiert, man sollte hGetLine durch was geileres ersetzen
sync $ pushNewSocket (FrpSocket eventDataReceived h eventError)
)
return eventNewSocket
Nothing -> error "Couldn't get port addrinfo, exiting" | 1,192 | false | true | 0 | 27 | 325 | 363 | 172 | 191 | null | null |
Hrothen/dorfCAD | src/Config.hs | mit | hexPattern :: String
hexPattern = "^(0x|#)([[:xdigit:]]{2,2})([[:xdigit:]]{2,2})([[:xdigit:]]{2,2})" | 100 | hexPattern :: String
hexPattern = "^(0x|#)([[:xdigit:]]{2,2})([[:xdigit:]]{2,2})([[:xdigit:]]{2,2})" | 100 | hexPattern = "^(0x|#)([[:xdigit:]]{2,2})([[:xdigit:]]{2,2})([[:xdigit:]]{2,2})" | 79 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
noteed/concepted | Concepted/Graphics.hs | bsd-3-clause | pickHandle :: Point -> Handle -> Bool
pickHandle ab (Handle xy) =
containXYWH ab (xy `sub` (10, 10)) 20 20 | 108 | pickHandle :: Point -> Handle -> Bool
pickHandle ab (Handle xy) =
containXYWH ab (xy `sub` (10, 10)) 20 20 | 108 | pickHandle ab (Handle xy) =
containXYWH ab (xy `sub` (10, 10)) 20 20 | 70 | false | true | 0 | 8 | 21 | 54 | 29 | 25 | null | null |
spaceships/garbled-circuits | src/Crypto/GarbledCircuits/Language.hs | apache-2.0 | intern :: Circuit -> Builder (Ref Circuit)
intern circ = do
maybeRef <- lookupCircuit circ
case maybeRef of
Just ref -> return ref
Nothing -> do
ref <- nextRef
insertRef ref circ
return ref
--------------------------------------------------------------------------------
-- smart constructors for the Circuit language
-- |The 'input' function creates an input bit for the 'Garbler' or the 'Evaluator'. | 434 | intern :: Circuit -> Builder (Ref Circuit)
intern circ = do
maybeRef <- lookupCircuit circ
case maybeRef of
Just ref -> return ref
Nothing -> do
ref <- nextRef
insertRef ref circ
return ref
--------------------------------------------------------------------------------
-- smart constructors for the Circuit language
-- |The 'input' function creates an input bit for the 'Garbler' or the 'Evaluator'. | 434 | intern circ = do
maybeRef <- lookupCircuit circ
case maybeRef of
Just ref -> return ref
Nothing -> do
ref <- nextRef
insertRef ref circ
return ref
--------------------------------------------------------------------------------
-- smart constructors for the Circuit language
-- |The 'input' function creates an input bit for the 'Garbler' or the 'Evaluator'. | 391 | false | true | 0 | 14 | 88 | 92 | 40 | 52 | null | null |
GaloisInc/halvm-ghc | compiler/utils/Platform.hs | bsd-3-clause | - I don't know if this is right, but as
-- per comment below it's safe
osElfTarget OSQNXNTO = False
| 135 | osElfTarget OSQNXNTO = False | 31 | osElfTarget OSQNXNTO = False | 31 | true | false | 2 | 5 | 55 | 19 | 10 | 9 | null | null |
betaveros/bcodex | Text/Bcodex.hs | mit | repeatLastToEqualLength :: (Eq a) => [a] -> [a] -> ([a],[a])
repeatLastToEqualLength xs ys = (take n $ repeatLast xs, take n $ repeatLast ys)
where n = max (length xs) (length ys) | 183 | repeatLastToEqualLength :: (Eq a) => [a] -> [a] -> ([a],[a])
repeatLastToEqualLength xs ys = (take n $ repeatLast xs, take n $ repeatLast ys)
where n = max (length xs) (length ys) | 183 | repeatLastToEqualLength xs ys = (take n $ repeatLast xs, take n $ repeatLast ys)
where n = max (length xs) (length ys) | 122 | false | true | 0 | 9 | 35 | 102 | 53 | 49 | null | null |
kyren/hsgb | lib/Gameboy/Assembler.hs | unlicense | and :: Parsec String st Instruction
and = instruction1Arg "AND" regularArg >>= encode
where
encode (RegisterArg r) = return $ AND_R r
encode (I8Arg n) = return $ AND_N n
encode (AddressArg AtHL) = return AND_ATHL
encode _ = fail "Invalid AND instruction" | 272 | and :: Parsec String st Instruction
and = instruction1Arg "AND" regularArg >>= encode
where
encode (RegisterArg r) = return $ AND_R r
encode (I8Arg n) = return $ AND_N n
encode (AddressArg AtHL) = return AND_ATHL
encode _ = fail "Invalid AND instruction" | 272 | and = instruction1Arg "AND" regularArg >>= encode
where
encode (RegisterArg r) = return $ AND_R r
encode (I8Arg n) = return $ AND_N n
encode (AddressArg AtHL) = return AND_ATHL
encode _ = fail "Invalid AND instruction" | 236 | false | true | 3 | 9 | 60 | 97 | 47 | 50 | null | null |
avh4/elm-format | elm-format-lib/src/Box.hs | bsd-3-clause | render :: Box -> T.Text
render box' =
case box' of
SingleLine line' ->
T.snoc (T.stripEnd $ renderLine 0 line') '\n'
Stack l1 l2 rest ->
T.unlines $ map (T.stripEnd . renderLine 0) (l1 : l2 : rest)
MustBreak line' ->
T.snoc (T.stripEnd $ renderLine 0 line') '\n' | 326 | render :: Box -> T.Text
render box' =
case box' of
SingleLine line' ->
T.snoc (T.stripEnd $ renderLine 0 line') '\n'
Stack l1 l2 rest ->
T.unlines $ map (T.stripEnd . renderLine 0) (l1 : l2 : rest)
MustBreak line' ->
T.snoc (T.stripEnd $ renderLine 0 line') '\n' | 326 | render box' =
case box' of
SingleLine line' ->
T.snoc (T.stripEnd $ renderLine 0 line') '\n'
Stack l1 l2 rest ->
T.unlines $ map (T.stripEnd . renderLine 0) (l1 : l2 : rest)
MustBreak line' ->
T.snoc (T.stripEnd $ renderLine 0 line') '\n' | 302 | false | true | 0 | 12 | 111 | 136 | 64 | 72 | null | null |
DanielWaterworth/Idris-dev | src/Idris/ElabTerm.hs | bsd-3-clause | reifyTTBinderApp reif f [t]
| f == reflm "PVTy" = liftM PVTy (reif t) | 91 | reifyTTBinderApp reif f [t]
| f == reflm "PVTy" = liftM PVTy (reif t) | 91 | reifyTTBinderApp reif f [t]
| f == reflm "PVTy" = liftM PVTy (reif t) | 91 | false | false | 0 | 9 | 35 | 43 | 18 | 25 | null | null |
turion/hasched | LP/Raum.hs | gpl-3.0 | raumNotwendigkeiten :: LPSeminarFun
raumNotwendigkeiten seminar = do
-- Ein Raum wird nur belegt, wenn dort etwas stattfindet
raumNichtUnnoetigBelegen seminar
-- Für jedes Thema muss ein Raum gebucht sein
themaMussRaumHaben seminar
-- TODO Raumgrößen, Raumausnahmen und weitere Ausnahmen
-- In einem Raum kann zu einer Zeit höchstens ein Thema stattfinden
raumNichtDoppeltBelegen seminar | 401 | raumNotwendigkeiten :: LPSeminarFun
raumNotwendigkeiten seminar = do
-- Ein Raum wird nur belegt, wenn dort etwas stattfindet
raumNichtUnnoetigBelegen seminar
-- Für jedes Thema muss ein Raum gebucht sein
themaMussRaumHaben seminar
-- TODO Raumgrößen, Raumausnahmen und weitere Ausnahmen
-- In einem Raum kann zu einer Zeit höchstens ein Thema stattfinden
raumNichtDoppeltBelegen seminar | 401 | raumNotwendigkeiten seminar = do
-- Ein Raum wird nur belegt, wenn dort etwas stattfindet
raumNichtUnnoetigBelegen seminar
-- Für jedes Thema muss ein Raum gebucht sein
themaMussRaumHaben seminar
-- TODO Raumgrößen, Raumausnahmen und weitere Ausnahmen
-- In einem Raum kann zu einer Zeit höchstens ein Thema stattfinden
raumNichtDoppeltBelegen seminar | 365 | false | true | 0 | 7 | 64 | 36 | 17 | 19 | null | null |
gcampax/ghc | compiler/prelude/TysPrim.hs | bsd-3-clause | threadIdPrimTyConName = mkPrimTc (fsLit "ThreadId#") threadIdPrimTyConKey threadIdPrimTyCon | 99 | threadIdPrimTyConName = mkPrimTc (fsLit "ThreadId#") threadIdPrimTyConKey threadIdPrimTyCon | 99 | threadIdPrimTyConName = mkPrimTc (fsLit "ThreadId#") threadIdPrimTyConKey threadIdPrimTyCon | 99 | false | false | 0 | 7 | 14 | 19 | 9 | 10 | null | null |
ssaavedra/liquidhaskell | benchmarks/containers-0.5.0.0/Data/Map/Base1.hs | bsd-3-clause | findMin (Bin _ _ _ l _) = findMin l | 39 | findMin (Bin _ _ _ l _) = findMin l | 39 | findMin (Bin _ _ _ l _) = findMin l | 39 | false | false | 0 | 7 | 13 | 26 | 12 | 14 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_READ_FRAMEBUFFER_EXT :: GLenum
gl_READ_FRAMEBUFFER_EXT = 0x8CA8 | 66 | gl_READ_FRAMEBUFFER_EXT :: GLenum
gl_READ_FRAMEBUFFER_EXT = 0x8CA8 | 66 | gl_READ_FRAMEBUFFER_EXT = 0x8CA8 | 32 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
isomorphism/typewriter | Data/Typewriter/Data/Nat.hs | bsd-3-clause | nat5 = X :*: nat2 | 17 | nat5 = X :*: nat2 | 17 | nat5 = X :*: nat2 | 17 | false | false | 4 | 5 | 4 | 17 | 7 | 10 | null | null |
phaazon/quaazar | src/Quaazar/System/Resource.hs | bsd-3-clause | mkResourceManager :: (MonadIO m,MonadScoped IO m,MonadLogger m,MonadError Log m)
=> ((String -> a -> m ()) -> (String -> m (Maybe a)) -> m b)
-> m b
mkResourceManager builder = do
resMap <- getResourceMap
builder (insertRes resMap) (lookupRes resMap)
-- Simple manager with default implementation for simple managed objects. | 365 | mkResourceManager :: (MonadIO m,MonadScoped IO m,MonadLogger m,MonadError Log m)
=> ((String -> a -> m ()) -> (String -> m (Maybe a)) -> m b)
-> m b
mkResourceManager builder = do
resMap <- getResourceMap
builder (insertRes resMap) (lookupRes resMap)
-- Simple manager with default implementation for simple managed objects. | 365 | mkResourceManager builder = do
resMap <- getResourceMap
builder (insertRes resMap) (lookupRes resMap)
-- Simple manager with default implementation for simple managed objects. | 180 | false | true | 0 | 15 | 90 | 131 | 63 | 68 | null | null |
taktoa/hskpipe | src/Parse.hs | gpl-3.0 | sexpParse :: Parser a -> Parser b -> Parser (a, [b])
sexpParse p1 p2 = do
char '('
spaces
f <- p1
spaces1
as <- p2 `sepBy` spaces1
spaces
char ')'
return (f, as)
where
spaces1 = space >> spaces | 215 | sexpParse :: Parser a -> Parser b -> Parser (a, [b])
sexpParse p1 p2 = do
char '('
spaces
f <- p1
spaces1
as <- p2 `sepBy` spaces1
spaces
char ')'
return (f, as)
where
spaces1 = space >> spaces | 215 | sexpParse p1 p2 = do
char '('
spaces
f <- p1
spaces1
as <- p2 `sepBy` spaces1
spaces
char ')'
return (f, as)
where
spaces1 = space >> spaces | 162 | false | true | 0 | 9 | 61 | 107 | 50 | 57 | null | null |
acowley/ghc | compiler/main/DynFlags.hs | bsd-3-clause | supportedLanguageOverlays :: [String]
supportedLanguageOverlays = map flagSpecName safeHaskellFlags | 99 | supportedLanguageOverlays :: [String]
supportedLanguageOverlays = map flagSpecName safeHaskellFlags | 99 | supportedLanguageOverlays = map flagSpecName safeHaskellFlags | 61 | false | true | 0 | 5 | 7 | 19 | 10 | 9 | null | null |
ezyang/ghc | hadrian/src/Settings.hs | bsd-3-clause | programContext :: Stage -> Package -> Action Context
programContext stage pkg = do
profiled <- ghcProfiled <$> flavour
return $ if pkg == ghc && profiled && stage > Stage0
then Context stage pkg profiling
else vanillaContext stage pkg
-- TODO: switch to Set Package as the order of packages should not matter?
-- Otherwise we have to keep remembering to sort packages from time to time. | 421 | programContext :: Stage -> Package -> Action Context
programContext stage pkg = do
profiled <- ghcProfiled <$> flavour
return $ if pkg == ghc && profiled && stage > Stage0
then Context stage pkg profiling
else vanillaContext stage pkg
-- TODO: switch to Set Package as the order of packages should not matter?
-- Otherwise we have to keep remembering to sort packages from time to time. | 421 | programContext stage pkg = do
profiled <- ghcProfiled <$> flavour
return $ if pkg == ghc && profiled && stage > Stage0
then Context stage pkg profiling
else vanillaContext stage pkg
-- TODO: switch to Set Package as the order of packages should not matter?
-- Otherwise we have to keep remembering to sort packages from time to time. | 368 | false | true | 0 | 12 | 101 | 83 | 41 | 42 | null | null |
rueshyna/gogol | gogol-dataflow/gen/Network/Google/Dataflow/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'SourceOperationRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sSplit'
--
-- * 'sGetMetadata'
sourceOperationRequest
:: SourceOperationRequest
sourceOperationRequest =
SourceOperationRequest'
{ _sSplit = Nothing
, _sGetMetadata = Nothing
} | 379 | sourceOperationRequest
:: SourceOperationRequest
sourceOperationRequest =
SourceOperationRequest'
{ _sSplit = Nothing
, _sGetMetadata = Nothing
} | 165 | sourceOperationRequest =
SourceOperationRequest'
{ _sSplit = Nothing
, _sGetMetadata = Nothing
} | 112 | true | true | 0 | 7 | 72 | 42 | 24 | 18 | null | null |
sopvop/cabal | Cabal/Distribution/Simple/Program/Db.hs | bsd-3-clause | -- |User-specify the arguments for this program. Basically override
-- any args information for this program in the configuration. If it's
-- not a known program, ignore it..
userSpecifyArgs :: String -- ^Program name
-> [ProgArg] -- ^user-specified args
-> ProgramDb
-> ProgramDb
userSpecifyArgs name args' =
updateUnconfiguredProgs
(flip Map.update name $
\(prog, path, args) -> Just (prog, path, args ++ args'))
. updateConfiguredProgs
(flip Map.update name $
\prog -> Just prog { programOverrideArgs = programOverrideArgs prog
++ args' }) | 679 | userSpecifyArgs :: String -- ^Program name
-> [ProgArg] -- ^user-specified args
-> ProgramDb
-> ProgramDb
userSpecifyArgs name args' =
updateUnconfiguredProgs
(flip Map.update name $
\(prog, path, args) -> Just (prog, path, args ++ args'))
. updateConfiguredProgs
(flip Map.update name $
\prog -> Just prog { programOverrideArgs = programOverrideArgs prog
++ args' }) | 503 | userSpecifyArgs name args' =
updateUnconfiguredProgs
(flip Map.update name $
\(prog, path, args) -> Just (prog, path, args ++ args'))
. updateConfiguredProgs
(flip Map.update name $
\prog -> Just prog { programOverrideArgs = programOverrideArgs prog
++ args' }) | 346 | true | true | 1 | 13 | 216 | 128 | 69 | 59 | null | null |
rueshyna/gogol | gogol-games-management/gen/Network/Google/Resource/GamesManagement/Scores/ResetForAllPlayers.hs | mpl-2.0 | -- | The ID of the leaderboard.
srfapLeaderboardId :: Lens' ScoresResetForAllPlayers Text
srfapLeaderboardId
= lens _srfapLeaderboardId
(\ s a -> s{_srfapLeaderboardId = a}) | 181 | srfapLeaderboardId :: Lens' ScoresResetForAllPlayers Text
srfapLeaderboardId
= lens _srfapLeaderboardId
(\ s a -> s{_srfapLeaderboardId = a}) | 149 | srfapLeaderboardId
= lens _srfapLeaderboardId
(\ s a -> s{_srfapLeaderboardId = a}) | 91 | true | true | 0 | 9 | 30 | 42 | 22 | 20 | null | null |
bitemyapp/ghc | compiler/main/DynFlags.hs | bsd-3-clause | wayOptP _ WayDyn = [] | 26 | wayOptP _ WayDyn = [] | 26 | wayOptP _ WayDyn = [] | 26 | false | false | 1 | 6 | 9 | 15 | 6 | 9 | null | null |
brendanhay/gogol | gogol-toolresults/gen/Network/Google/ToolResults/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'EncounteredNonAndroidUiWidgetScreen' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'enauwsDistinctScreens'
--
-- * 'enauwsScreenIds'
encounteredNonAndroidUiWidgetScreen
:: EncounteredNonAndroidUiWidgetScreen
encounteredNonAndroidUiWidgetScreen =
EncounteredNonAndroidUiWidgetScreen'
{_enauwsDistinctScreens = Nothing, _enauwsScreenIds = Nothing} | 467 | encounteredNonAndroidUiWidgetScreen
:: EncounteredNonAndroidUiWidgetScreen
encounteredNonAndroidUiWidgetScreen =
EncounteredNonAndroidUiWidgetScreen'
{_enauwsDistinctScreens = Nothing, _enauwsScreenIds = Nothing} | 222 | encounteredNonAndroidUiWidgetScreen =
EncounteredNonAndroidUiWidgetScreen'
{_enauwsDistinctScreens = Nothing, _enauwsScreenIds = Nothing} | 143 | true | true | 1 | 7 | 59 | 39 | 23 | 16 | null | null |
ahmadsalim/micro-dsl-properties | src/MiniIF.hs | gpl-3.0 | interpretScript :: GameDesc -> State -> Script -> Maybe State
interpretScript gdesc ps [] = return ps | 108 | interpretScript :: GameDesc -> State -> Script -> Maybe State
interpretScript gdesc ps [] = return ps | 108 | interpretScript gdesc ps [] = return ps | 46 | false | true | 0 | 8 | 23 | 38 | 18 | 20 | null | null |
osa1/chsc | Utilities.hs | bsd-3-clause | second4 :: (b -> e) -> (a, b, c, d) -> (a, e, c, d)
second4 f (a, b, c, d) = (a, f b, c, d) | 91 | second4 :: (b -> e) -> (a, b, c, d) -> (a, e, c, d)
second4 f (a, b, c, d) = (a, f b, c, d) | 91 | second4 f (a, b, c, d) = (a, f b, c, d) | 39 | false | true | 0 | 9 | 26 | 88 | 50 | 38 | null | null |
andrewpetrovic/pandoc | src/Text/Pandoc/Readers/Org.hs | gpl-2.0 | inlineCodeBlock :: OrgParser (F Inlines)
inlineCodeBlock = try $ do
string "src_"
lang <- many1 orgArgWordChar
opts <- option [] $ enclosedByPair '[' ']' inlineBlockOption
inlineCode <- enclosedByPair '{' '}' (noneOf "\n\r")
let attrClasses = [translateLang lang, rundocBlockClass]
let attrKeyVal = map toRundocAttrib (("language", lang) : opts)
returnF $ B.codeWith ("", attrClasses, attrKeyVal) inlineCode | 422 | inlineCodeBlock :: OrgParser (F Inlines)
inlineCodeBlock = try $ do
string "src_"
lang <- many1 orgArgWordChar
opts <- option [] $ enclosedByPair '[' ']' inlineBlockOption
inlineCode <- enclosedByPair '{' '}' (noneOf "\n\r")
let attrClasses = [translateLang lang, rundocBlockClass]
let attrKeyVal = map toRundocAttrib (("language", lang) : opts)
returnF $ B.codeWith ("", attrClasses, attrKeyVal) inlineCode | 422 | inlineCodeBlock = try $ do
string "src_"
lang <- many1 orgArgWordChar
opts <- option [] $ enclosedByPair '[' ']' inlineBlockOption
inlineCode <- enclosedByPair '{' '}' (noneOf "\n\r")
let attrClasses = [translateLang lang, rundocBlockClass]
let attrKeyVal = map toRundocAttrib (("language", lang) : opts)
returnF $ B.codeWith ("", attrClasses, attrKeyVal) inlineCode | 381 | false | true | 1 | 10 | 68 | 149 | 73 | 76 | null | null |
phonohawk/HsOpenSSL | Test/OpenSSL/Cipher.hs | cc0-1.0 | valueOfHexChar 'a' = 10 | 23 | valueOfHexChar 'a' = 10 | 23 | valueOfHexChar 'a' = 10 | 23 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
spechub/Hets | Comorphisms/Hybrid2CASL.hs | gpl-2.0 | {- | Adds one argument of type World to all preds and ops
definitions in an hybrid signature and passes them to a caslsig -}
addWrldArg :: HSign -> CSign -> CSign
addWrldArg hs cs = let
f (OpType a b c) = OpType a (worldSort : b) c
g (PredType a) = PredType (worldSort : a)
ops = addOpMapSet (rigidOps $ extendedInfo hs) (opMap hs)
preds = addMapSet (rigidPreds $ extendedInfo hs) (predMap hs)
ks = Set.elems $ MapSet.keysSet ops
ks' = Set.elems $ MapSet.keysSet preds
in cs
{ opMap = foldr (MapSet.update (Set.map f)) (opMap cs) ks
, predMap = foldr (MapSet.update (Set.map g)) (predMap cs) ks'
} | 635 | addWrldArg :: HSign -> CSign -> CSign
addWrldArg hs cs = let
f (OpType a b c) = OpType a (worldSort : b) c
g (PredType a) = PredType (worldSort : a)
ops = addOpMapSet (rigidOps $ extendedInfo hs) (opMap hs)
preds = addMapSet (rigidPreds $ extendedInfo hs) (predMap hs)
ks = Set.elems $ MapSet.keysSet ops
ks' = Set.elems $ MapSet.keysSet preds
in cs
{ opMap = foldr (MapSet.update (Set.map f)) (opMap cs) ks
, predMap = foldr (MapSet.update (Set.map g)) (predMap cs) ks'
} | 510 | addWrldArg hs cs = let
f (OpType a b c) = OpType a (worldSort : b) c
g (PredType a) = PredType (worldSort : a)
ops = addOpMapSet (rigidOps $ extendedInfo hs) (opMap hs)
preds = addMapSet (rigidPreds $ extendedInfo hs) (predMap hs)
ks = Set.elems $ MapSet.keysSet ops
ks' = Set.elems $ MapSet.keysSet preds
in cs
{ opMap = foldr (MapSet.update (Set.map f)) (opMap cs) ks
, predMap = foldr (MapSet.update (Set.map g)) (predMap cs) ks'
} | 472 | true | true | 0 | 14 | 147 | 243 | 122 | 121 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/ARB/SeparateShaderObjects.hs | bsd-3-clause | extensionNameString :: String
extensionNameString = "GL_separate_shader_objects" | 80 | extensionNameString :: String
extensionNameString = "GL_separate_shader_objects" | 80 | extensionNameString = "GL_separate_shader_objects" | 50 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ssaavedra/liquidhaskell | tests/pos/LambdaEval.hs | bsd-3-clause | check (Const _) = True | 25 | check (Const _) = True | 25 | check (Const _) = True | 25 | false | false | 0 | 6 | 7 | 16 | 7 | 9 | null | null |
ilyasergey/GHC-XAppFix | compiler/llvmGen/Llvm/Types.hs | bsd-3-clause | -- | Return the 'LlvmType' of a 'LlvmLit'
getLitType :: LlvmLit -> LlvmType
getLitType (LMIntLit _ t) = t | 107 | getLitType :: LlvmLit -> LlvmType
getLitType (LMIntLit _ t) = t | 65 | getLitType (LMIntLit _ t) = t | 31 | true | true | 0 | 7 | 20 | 27 | 14 | 13 | null | null |
mgsloan/airship | src/Airship/Internal/Decision.hs | mit | ------------------------------------------------------------------------------
-- Decision Helpers
------------------------------------------------------------------------------
negotiateContentTypesAccepted :: Monad m => Resource s m -> FlowStateT s m ()
negotiateContentTypesAccepted Resource{..} = do
req <- lift request
accepted <- lift contentTypesAccepted
let reqHeaders = requestHeaders req
result = do
cType <- lookup HTTP.hContentType reqHeaders
mapContentMedia accepted cType
case result of
(Just process) -> lift process
Nothing -> lift $ halt HTTP.status415 | 634 | negotiateContentTypesAccepted :: Monad m => Resource s m -> FlowStateT s m ()
negotiateContentTypesAccepted Resource{..} = do
req <- lift request
accepted <- lift contentTypesAccepted
let reqHeaders = requestHeaders req
result = do
cType <- lookup HTTP.hContentType reqHeaders
mapContentMedia accepted cType
case result of
(Just process) -> lift process
Nothing -> lift $ halt HTTP.status415 | 455 | negotiateContentTypesAccepted Resource{..} = do
req <- lift request
accepted <- lift contentTypesAccepted
let reqHeaders = requestHeaders req
result = do
cType <- lookup HTTP.hContentType reqHeaders
mapContentMedia accepted cType
case result of
(Just process) -> lift process
Nothing -> lift $ halt HTTP.status415 | 377 | true | true | 0 | 14 | 124 | 144 | 66 | 78 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/showSigned_2.hs | mit | showSigned showPos p x = showSigned0 p showPos x (ltFloat x (fromIntFloat (Pos Zero))) | 86 | showSigned showPos p x = showSigned0 p showPos x (ltFloat x (fromIntFloat (Pos Zero))) | 86 | showSigned showPos p x = showSigned0 p showPos x (ltFloat x (fromIntFloat (Pos Zero))) | 86 | false | false | 1 | 11 | 13 | 47 | 20 | 27 | null | null |
roelvandijk/numerals-base | src/Text/Numeral/BigNum.hs | bsd-3-clause | -- ^ Postfix representation.
scaleRepr ∷ (IsString s, Monoid s)
⇒ PostfixRepr i s
→ [(ℤ, Ctx (Exp i) → s)] -- ^ Additional symbol map entries.
→ ScaleRepr i s
scaleRepr pf syms inf _ _ e ctx = (⊕ pf inf ctx) <$> render repr inf e
where
repr = cardinalRepr { reprValue = \_ n → M.lookup n syms' }
syms' = M.fromList syms ∪ symMap | 375 | scaleRepr ∷ (IsString s, Monoid s)
⇒ PostfixRepr i s
→ [(ℤ, Ctx (Exp i) → s)] -- ^ Additional symbol map entries.
→ ScaleRepr i s
scaleRepr pf syms inf _ _ e ctx = (⊕ pf inf ctx) <$> render repr inf e
where
repr = cardinalRepr { reprValue = \_ n → M.lookup n syms' }
syms' = M.fromList syms ∪ symMap | 345 | scaleRepr pf syms inf _ _ e ctx = (⊕ pf inf ctx) <$> render repr inf e
where
repr = cardinalRepr { reprValue = \_ n → M.lookup n syms' }
syms' = M.fromList syms ∪ symMap | 185 | true | true | 2 | 14 | 115 | 157 | 77 | 80 | null | null |
ulyssesp/AoC | src/day14.hs | bsd-3-clause | calcHash input i found = pads ++ calcHash input (i + 1) nextHashes
where
found' = filter (\(_, i') -> i' + 1000 > i && i' `notElem` pads) found
grouped = BC.group . findHash 2017 . BC.append input . BC.pack . show $ i
triplet = take 1 . filter ((>= 3) . BC.length) $ grouped
nextHashes = found' ++ [(BC.head $ head triplet, i) | i <= 22065 && not (null triplet)]
pentlets = map BC.head $ filter ((>= 5) . BC.length) grouped
pads = map snd $ filter (\(c, _) -> elem c pentlets) found | 515 | calcHash input i found = pads ++ calcHash input (i + 1) nextHashes
where
found' = filter (\(_, i') -> i' + 1000 > i && i' `notElem` pads) found
grouped = BC.group . findHash 2017 . BC.append input . BC.pack . show $ i
triplet = take 1 . filter ((>= 3) . BC.length) $ grouped
nextHashes = found' ++ [(BC.head $ head triplet, i) | i <= 22065 && not (null triplet)]
pentlets = map BC.head $ filter ((>= 5) . BC.length) grouped
pads = map snd $ filter (\(c, _) -> elem c pentlets) found | 515 | calcHash input i found = pads ++ calcHash input (i + 1) nextHashes
where
found' = filter (\(_, i') -> i' + 1000 > i && i' `notElem` pads) found
grouped = BC.group . findHash 2017 . BC.append input . BC.pack . show $ i
triplet = take 1 . filter ((>= 3) . BC.length) $ grouped
nextHashes = found' ++ [(BC.head $ head triplet, i) | i <= 22065 && not (null triplet)]
pentlets = map BC.head $ filter ((>= 5) . BC.length) grouped
pads = map snd $ filter (\(c, _) -> elem c pentlets) found | 515 | false | false | 0 | 11 | 130 | 261 | 136 | 125 | null | null |
rahulmutt/ghcvm | compiler/Eta/Main/HscTypes.hs | bsd-3-clause | -- | Look up a ModSummary in the ModuleGraph
mgLookupModule :: ModuleGraph -> Module -> Maybe ModSummary
mgLookupModule ModuleGraph{..} m = lookupModuleEnv mg_non_boot m | 169 | mgLookupModule :: ModuleGraph -> Module -> Maybe ModSummary
mgLookupModule ModuleGraph{..} m = lookupModuleEnv mg_non_boot m | 124 | mgLookupModule ModuleGraph{..} m = lookupModuleEnv mg_non_boot m | 64 | true | true | 1 | 7 | 23 | 43 | 20 | 23 | null | null |
abhean/phffp-examples | src/Lib.hs | bsd-3-clause | wordsAvgLength x = fromIntegral (sumWordsLengths x) / fromIntegral (numWords x)
where sumWordsLengths = sum . map length . words
numWords = length . words
--myAndFold :: [Bool] -> Bool
--myAndFold = foldr (&&) True
--
--myOrFold :: [Bool] -> Bool
--myOrFold = foldr (||) False | 287 | wordsAvgLength x = fromIntegral (sumWordsLengths x) / fromIntegral (numWords x)
where sumWordsLengths = sum . map length . words
numWords = length . words
--myAndFold :: [Bool] -> Bool
--myAndFold = foldr (&&) True
--
--myOrFold :: [Bool] -> Bool
--myOrFold = foldr (||) False | 287 | wordsAvgLength x = fromIntegral (sumWordsLengths x) / fromIntegral (numWords x)
where sumWordsLengths = sum . map length . words
numWords = length . words
--myAndFold :: [Bool] -> Bool
--myAndFold = foldr (&&) True
--
--myOrFold :: [Bool] -> Bool
--myOrFold = foldr (||) False | 287 | false | false | 1 | 8 | 55 | 67 | 33 | 34 | null | null |
noteed/sftp-streams | Network/SFTP/Messages.hs | bsd-3-clause | fxpRealPath :: Int -> Parser Packet
fxpRealPath n = do
i <- requestId
path <- str $ n - 4
let n' = n - 4 - 4 - BC.length path
if (n' > 0)
then do
controlByte <- anyWord8
composes <- strs $ n' - 1
return $ FxpRealPath i (T.decodeUtf8 path) (Just (controlByte, map T.decodeUtf8 composes))
else
return $ FxpRealPath i (T.decodeUtf8 path) Nothing | 382 | fxpRealPath :: Int -> Parser Packet
fxpRealPath n = do
i <- requestId
path <- str $ n - 4
let n' = n - 4 - 4 - BC.length path
if (n' > 0)
then do
controlByte <- anyWord8
composes <- strs $ n' - 1
return $ FxpRealPath i (T.decodeUtf8 path) (Just (controlByte, map T.decodeUtf8 composes))
else
return $ FxpRealPath i (T.decodeUtf8 path) Nothing | 382 | fxpRealPath n = do
i <- requestId
path <- str $ n - 4
let n' = n - 4 - 4 - BC.length path
if (n' > 0)
then do
controlByte <- anyWord8
composes <- strs $ n' - 1
return $ FxpRealPath i (T.decodeUtf8 path) (Just (controlByte, map T.decodeUtf8 composes))
else
return $ FxpRealPath i (T.decodeUtf8 path) Nothing | 346 | false | true | 0 | 16 | 105 | 169 | 81 | 88 | null | null |
Chouffe/hlisp | .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/Paths_hlisp.hs | bsd-3-clause | libexecdir = "/home/chouffe/Documents/Haskell/hlisp/.stack-work/install/x86_64-linux/lts-5.11/7.10.3/libexec" | 109 | libexecdir = "/home/chouffe/Documents/Haskell/hlisp/.stack-work/install/x86_64-linux/lts-5.11/7.10.3/libexec" | 109 | libexecdir = "/home/chouffe/Documents/Haskell/hlisp/.stack-work/install/x86_64-linux/lts-5.11/7.10.3/libexec" | 109 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
alephcloud/hs-aws-lambda | src/Aws/Lambda/Internal/Utils.hs | apache-2.0 | parserWithPrism
∷ Show α
⇒ T.Text -- ^ A label for error messages
→ Prism' α β -- ^ A prism whence to generate a parser
→ α
→ AE.Parser β
parserWithPrism lbl p x =
case x ^? p of
Just v → return v
Nothing → fail $ "Invalid " ⊕ T.unpack lbl ⊕ ": " ⊕ show x | 275 | parserWithPrism
∷ Show α
⇒ T.Text -- ^ A label for error messages
→ Prism' α β -- ^ A prism whence to generate a parser
→ α
→ AE.Parser β
parserWithPrism lbl p x =
case x ^? p of
Just v → return v
Nothing → fail $ "Invalid " ⊕ T.unpack lbl ⊕ ": " ⊕ show x | 275 | parserWithPrism lbl p x =
case x ^? p of
Just v → return v
Nothing → fail $ "Invalid " ⊕ T.unpack lbl ⊕ ": " ⊕ show x | 127 | false | true | 7 | 11 | 80 | 90 | 45 | 45 | null | null |
JacquesCarette/literate-scientific-software | People/Dan/Presentations/CommitteeMeeting4/BodyNew.hs | bsd-2-clause | endScoR = foldl (+:+) EmptyS [S "use the", plural datum `sAnd`
S "predict whether the", phrase glaSlab, S "is safe to use" `sOr`
S "not"] | 141 | endScoR = foldl (+:+) EmptyS [S "use the", plural datum `sAnd`
S "predict whether the", phrase glaSlab, S "is safe to use" `sOr`
S "not"] | 141 | endScoR = foldl (+:+) EmptyS [S "use the", plural datum `sAnd`
S "predict whether the", phrase glaSlab, S "is safe to use" `sOr`
S "not"] | 141 | false | false | 0 | 8 | 28 | 57 | 30 | 27 | null | null |
iliastsi/gac | src/typecheck/TypeCheck.hs | mit | typeCheckStmt ret_type lustmt@(L _ (UStmtReturn m_expr)) = do
case m_expr of
Nothing -> do
when (ret_type /= (AType TTypeProc)) $
tcRetStmtErr lustmt ret_type (AType TTypeProc)
return (True, TStmtReturn Nothing)
Just luexpr -> do
aexpr@(AExpr _ expr_type) <- typeCheckExpr luexpr
when ((AType expr_type) /= ret_type
&& (AType expr_type) /= (AType TTypeUnknown)) $
tcRetStmtErr lustmt ret_type (AType expr_type)
return (True, TStmtReturn (Just aexpr))
-- ---------------------------
-- Type Check compound stmts
-- As first argument (AType) we have the return type of the block | 720 | typeCheckStmt ret_type lustmt@(L _ (UStmtReturn m_expr)) = do
case m_expr of
Nothing -> do
when (ret_type /= (AType TTypeProc)) $
tcRetStmtErr lustmt ret_type (AType TTypeProc)
return (True, TStmtReturn Nothing)
Just luexpr -> do
aexpr@(AExpr _ expr_type) <- typeCheckExpr luexpr
when ((AType expr_type) /= ret_type
&& (AType expr_type) /= (AType TTypeUnknown)) $
tcRetStmtErr lustmt ret_type (AType expr_type)
return (True, TStmtReturn (Just aexpr))
-- ---------------------------
-- Type Check compound stmts
-- As first argument (AType) we have the return type of the block | 720 | typeCheckStmt ret_type lustmt@(L _ (UStmtReturn m_expr)) = do
case m_expr of
Nothing -> do
when (ret_type /= (AType TTypeProc)) $
tcRetStmtErr lustmt ret_type (AType TTypeProc)
return (True, TStmtReturn Nothing)
Just luexpr -> do
aexpr@(AExpr _ expr_type) <- typeCheckExpr luexpr
when ((AType expr_type) /= ret_type
&& (AType expr_type) /= (AType TTypeUnknown)) $
tcRetStmtErr lustmt ret_type (AType expr_type)
return (True, TStmtReturn (Just aexpr))
-- ---------------------------
-- Type Check compound stmts
-- As first argument (AType) we have the return type of the block | 720 | false | false | 0 | 19 | 224 | 202 | 98 | 104 | null | null |
matonix/pfds | src/PFDS/Sec9/Ex13.hs | bsd-3-clause | consTree t1 (Two (t2, t3) : ds) = threes [(t1, t2, t3)] ds | 58 | consTree t1 (Two (t2, t3) : ds) = threes [(t1, t2, t3)] ds | 58 | consTree t1 (Two (t2, t3) : ds) = threes [(t1, t2, t3)] ds | 58 | false | false | 0 | 8 | 12 | 46 | 24 | 22 | null | null |
DATX02-17-26/DATX02-17-26 | Test/TestStrategies.hs | gpl-2.0 | normalizations :: Normalizer CompilationUnit
normalizations = ALL.normalizations | 80 | normalizations :: Normalizer CompilationUnit
normalizations = ALL.normalizations | 80 | normalizations = ALL.normalizations | 35 | false | true | 1 | 6 | 6 | 20 | 8 | 12 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Prolog.hs | gpl-2.0 | parseRules ("Prolog","syntax_error_bq") =
(((pDetect2Chars False '\\' '`' >>= withAttribute ErrorTok) >>~ (popContext))
<|>
((pDetect2Chars False '`' '`' >>= withAttribute ErrorTok) >>~ (popContext))
<|>
((pDetectChar False '`' >>= withAttribute ErrorTok) >>~ (popContext >> popContext >> popContext))
<|>
((parseRules ("Prolog","syntax_error")))
<|>
(currentContext >>= \x -> guard (x == ("Prolog","syntax_error_bq")) >> pDefault >>= withAttribute ErrorTok)) | 485 | parseRules ("Prolog","syntax_error_bq") =
(((pDetect2Chars False '\\' '`' >>= withAttribute ErrorTok) >>~ (popContext))
<|>
((pDetect2Chars False '`' '`' >>= withAttribute ErrorTok) >>~ (popContext))
<|>
((pDetectChar False '`' >>= withAttribute ErrorTok) >>~ (popContext >> popContext >> popContext))
<|>
((parseRules ("Prolog","syntax_error")))
<|>
(currentContext >>= \x -> guard (x == ("Prolog","syntax_error_bq")) >> pDefault >>= withAttribute ErrorTok)) | 485 | parseRules ("Prolog","syntax_error_bq") =
(((pDetect2Chars False '\\' '`' >>= withAttribute ErrorTok) >>~ (popContext))
<|>
((pDetect2Chars False '`' '`' >>= withAttribute ErrorTok) >>~ (popContext))
<|>
((pDetectChar False '`' >>= withAttribute ErrorTok) >>~ (popContext >> popContext >> popContext))
<|>
((parseRules ("Prolog","syntax_error")))
<|>
(currentContext >>= \x -> guard (x == ("Prolog","syntax_error_bq")) >> pDefault >>= withAttribute ErrorTok)) | 485 | false | false | 0 | 15 | 77 | 175 | 93 | 82 | null | null |
kaitanie/irt | src/G4Release.hs | bsd-3-clause | releaseModule :: FilePath -> (String -> IO String) -> G4Module -> IO ()
releaseModule targetRootDir transform g4module = do
createDirectoryIfMissing True targetRootDir
let modDir = g4moduleDir g4module
headers = g4moduleHeaders g4module
sources = g4moduleSources g4module
createDirectoryIfMissing True (targetRootDir </> modDir </> "include")
createDirectoryIfMissing True (targetRootDir </> modDir </> "src")
mapM_ (releaseFile (targetRootDir </> modDir </> "include") transform) headers
mapM_ (releaseFile (targetRootDir </> modDir </> "src") transform) sources
createCMakeSources targetRootDir "inclxx" g4module | 652 | releaseModule :: FilePath -> (String -> IO String) -> G4Module -> IO ()
releaseModule targetRootDir transform g4module = do
createDirectoryIfMissing True targetRootDir
let modDir = g4moduleDir g4module
headers = g4moduleHeaders g4module
sources = g4moduleSources g4module
createDirectoryIfMissing True (targetRootDir </> modDir </> "include")
createDirectoryIfMissing True (targetRootDir </> modDir </> "src")
mapM_ (releaseFile (targetRootDir </> modDir </> "include") transform) headers
mapM_ (releaseFile (targetRootDir </> modDir </> "src") transform) sources
createCMakeSources targetRootDir "inclxx" g4module | 652 | releaseModule targetRootDir transform g4module = do
createDirectoryIfMissing True targetRootDir
let modDir = g4moduleDir g4module
headers = g4moduleHeaders g4module
sources = g4moduleSources g4module
createDirectoryIfMissing True (targetRootDir </> modDir </> "include")
createDirectoryIfMissing True (targetRootDir </> modDir </> "src")
mapM_ (releaseFile (targetRootDir </> modDir </> "include") transform) headers
mapM_ (releaseFile (targetRootDir </> modDir </> "src") transform) sources
createCMakeSources targetRootDir "inclxx" g4module | 580 | false | true | 0 | 12 | 108 | 183 | 86 | 97 | null | null |
ribag/ganeti-experiments | src/Ganeti/Utils.hs | gpl-2.0 | formatOrdinal :: (Integral a, Show a) => a -> String
formatOrdinal num
| num > 10 && num < 20 = suffix "th"
| tens == 1 = suffix "st"
| tens == 2 = suffix "nd"
| tens == 3 = suffix "rd"
| otherwise = suffix "th"
where tens = num `mod` 10
suffix s = show num ++ s
-- | Attempt, in a non-blocking way, to obtain a lock on a given file; report
-- back success.
-- Returns the file descriptor so that the lock can be released by closing | 501 | formatOrdinal :: (Integral a, Show a) => a -> String
formatOrdinal num
| num > 10 && num < 20 = suffix "th"
| tens == 1 = suffix "st"
| tens == 2 = suffix "nd"
| tens == 3 = suffix "rd"
| otherwise = suffix "th"
where tens = num `mod` 10
suffix s = show num ++ s
-- | Attempt, in a non-blocking way, to obtain a lock on a given file; report
-- back success.
-- Returns the file descriptor so that the lock can be released by closing | 501 | formatOrdinal num
| num > 10 && num < 20 = suffix "th"
| tens == 1 = suffix "st"
| tens == 2 = suffix "nd"
| tens == 3 = suffix "rd"
| otherwise = suffix "th"
where tens = num `mod` 10
suffix s = show num ++ s
-- | Attempt, in a non-blocking way, to obtain a lock on a given file; report
-- back success.
-- Returns the file descriptor so that the lock can be released by closing | 448 | false | true | 3 | 10 | 163 | 162 | 74 | 88 | null | null |
5outh/Bang | src/Bang/Interface/Drum.hs | mit | openCuica :: Music PercussionSound
openCuica = qd OpenCuica | 59 | openCuica :: Music PercussionSound
openCuica = qd OpenCuica | 59 | openCuica = qd OpenCuica | 24 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
et4te/zero | server/src/Zero/Account/Reset/Relations.hs | bsd-3-clause | resetRelationVar =
RelationVariable "reset" () | 48 | resetRelationVar =
RelationVariable "reset" () | 48 | resetRelationVar =
RelationVariable "reset" () | 48 | false | false | 0 | 6 | 6 | 13 | 6 | 7 | null | null |
ozgurakgun/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | highestFC (PIfThenElse fc _ _ _) = Just fc | 43 | highestFC (PIfThenElse fc _ _ _) = Just fc | 43 | highestFC (PIfThenElse fc _ _ _) = Just fc | 43 | false | false | 0 | 6 | 9 | 25 | 11 | 14 | null | null |
choener/WordAlignment | Linguistics/WordAlignment/TwoWay/Infix/Simple.hs | gpl-3.0 | alignInfixBacktrack
:: FastChars
-> FastDoubles
-> Int
-> SimpleScoring
-> Vector BTI
-> Vector BTI
-> Z:.F:.F:.F:.F:.F:.F:.F:.F
-> [[B3]]
alignInfixBacktrack fc fd width simpleS i1 i2 (Z:.dd:.ii:.mm:.pu:.ss:.su:.up:.us) = {-# SCC "alignInfixBacktrack" #-} L.map FM.toList . unId $ axiom ss'
where (Z:._:._:._:._:.ss':._:._:._) = gInfix (sScore simpleS <|| sBacktrackBuilder fc fd width simpleS)
(toBacktrack dd (undefined :: Id a -> Id a))
(toBacktrack ii (undefined :: Id a -> Id a))
(toBacktrack mm (undefined :: Id a -> Id a))
(toBacktrack pu (undefined :: Id a -> Id a))
(toBacktrack ss (undefined :: Id a -> Id a))
(toBacktrack su (undefined :: Id a -> Id a))
(toBacktrack up (undefined :: Id a -> Id a))
(toBacktrack us (undefined :: Id a -> Id a))
(chr i1) (chr i2)
:: Z:.B:.B:.B:.B:.B:.B:.B:.B
| 1,241 | alignInfixBacktrack
:: FastChars
-> FastDoubles
-> Int
-> SimpleScoring
-> Vector BTI
-> Vector BTI
-> Z:.F:.F:.F:.F:.F:.F:.F:.F
-> [[B3]]
alignInfixBacktrack fc fd width simpleS i1 i2 (Z:.dd:.ii:.mm:.pu:.ss:.su:.up:.us) = {-# SCC "alignInfixBacktrack" #-} L.map FM.toList . unId $ axiom ss'
where (Z:._:._:._:._:.ss':._:._:._) = gInfix (sScore simpleS <|| sBacktrackBuilder fc fd width simpleS)
(toBacktrack dd (undefined :: Id a -> Id a))
(toBacktrack ii (undefined :: Id a -> Id a))
(toBacktrack mm (undefined :: Id a -> Id a))
(toBacktrack pu (undefined :: Id a -> Id a))
(toBacktrack ss (undefined :: Id a -> Id a))
(toBacktrack su (undefined :: Id a -> Id a))
(toBacktrack up (undefined :: Id a -> Id a))
(toBacktrack us (undefined :: Id a -> Id a))
(chr i1) (chr i2)
:: Z:.B:.B:.B:.B:.B:.B:.B:.B
| 1,241 | alignInfixBacktrack fc fd width simpleS i1 i2 (Z:.dd:.ii:.mm:.pu:.ss:.su:.up:.us) = {-# SCC "alignInfixBacktrack" #-} L.map FM.toList . unId $ axiom ss'
where (Z:._:._:._:._:.ss':._:._:._) = gInfix (sScore simpleS <|| sBacktrackBuilder fc fd width simpleS)
(toBacktrack dd (undefined :: Id a -> Id a))
(toBacktrack ii (undefined :: Id a -> Id a))
(toBacktrack mm (undefined :: Id a -> Id a))
(toBacktrack pu (undefined :: Id a -> Id a))
(toBacktrack ss (undefined :: Id a -> Id a))
(toBacktrack su (undefined :: Id a -> Id a))
(toBacktrack up (undefined :: Id a -> Id a))
(toBacktrack us (undefined :: Id a -> Id a))
(chr i1) (chr i2)
:: Z:.B:.B:.B:.B:.B:.B:.B:.B
| 1,086 | false | true | 0 | 22 | 567 | 481 | 239 | 242 | null | null |
sdiehl/ghc | compiler/types/TyCoFVs.hs | bsd-3-clause | tyCoFVsOfTypes [] fv_cand in_scope acc = emptyFV fv_cand in_scope acc | 75 | tyCoFVsOfTypes [] fv_cand in_scope acc = emptyFV fv_cand in_scope acc | 75 | tyCoFVsOfTypes [] fv_cand in_scope acc = emptyFV fv_cand in_scope acc | 75 | false | false | 0 | 6 | 15 | 24 | 11 | 13 | null | null |
nickgeoca/idris-py | src/IRTS/CodegenPython.hs | bsd-3-clause | cgPrim LStrCons = cgPOp "+" | 30 | cgPrim LStrCons = cgPOp "+" | 30 | cgPrim LStrCons = cgPOp "+" | 30 | false | false | 1 | 5 | 7 | 16 | 5 | 11 | null | null |
locaweb/leela | src/warpdrive/src/Leela/Data/LQL/Read.hs | apache-2.0 | parseQuery :: Parser (Matcher, [(Bool, GUID -> Matcher)])
parseQuery = do
a <- parseGUID
ok <- isSpace
if ok
then do
q <- parseQuery1 False []
f <- safeHead q
return (snd f a, tail q)
else return (ByNode a, []) | 243 | parseQuery :: Parser (Matcher, [(Bool, GUID -> Matcher)])
parseQuery = do
a <- parseGUID
ok <- isSpace
if ok
then do
q <- parseQuery1 False []
f <- safeHead q
return (snd f a, tail q)
else return (ByNode a, []) | 243 | parseQuery = do
a <- parseGUID
ok <- isSpace
if ok
then do
q <- parseQuery1 False []
f <- safeHead q
return (snd f a, tail q)
else return (ByNode a, []) | 185 | false | true | 0 | 12 | 73 | 116 | 57 | 59 | null | null |
Lainepress/hub-src | Hub/Parse.hs | bsd-3-clause | chk_tlbin st0 nd = simple_node False st0 nd "tlbin" chk
where
chk st lc arg =
case tlbinST st of
Nothing -> YUP (st{tlbinST=Just arg})
Just _ -> NOPE $ err lc "<cibin> re-specified" | 288 | chk_tlbin st0 nd = simple_node False st0 nd "tlbin" chk
where
chk st lc arg =
case tlbinST st of
Nothing -> YUP (st{tlbinST=Just arg})
Just _ -> NOPE $ err lc "<cibin> re-specified" | 288 | chk_tlbin st0 nd = simple_node False st0 nd "tlbin" chk
where
chk st lc arg =
case tlbinST st of
Nothing -> YUP (st{tlbinST=Just arg})
Just _ -> NOPE $ err lc "<cibin> re-specified" | 288 | false | false | 1 | 12 | 140 | 89 | 40 | 49 | null | null |
Dridus/embot | src/Embot/Commands/Dice.hs | bsd-3-clause | trigger :: Parser ()
trigger = "roll" *> (skipSpace <|> endOfInput) | 67 | trigger :: Parser ()
trigger = "roll" *> (skipSpace <|> endOfInput) | 67 | trigger = "roll" *> (skipSpace <|> endOfInput) | 46 | false | true | 2 | 7 | 10 | 35 | 16 | 19 | null | null |
nomeata/ghc | compiler/cmm/PprC.hs | bsd-3-clause | pprTop (CmmData _section (Statics lbl [CmmUninitialised size])) =
hcat [
pprLocalness lbl, ptext (sLit "char "), ppr lbl,
brackets (int size), semi
] | 161 | pprTop (CmmData _section (Statics lbl [CmmUninitialised size])) =
hcat [
pprLocalness lbl, ptext (sLit "char "), ppr lbl,
brackets (int size), semi
] | 161 | pprTop (CmmData _section (Statics lbl [CmmUninitialised size])) =
hcat [
pprLocalness lbl, ptext (sLit "char "), ppr lbl,
brackets (int size), semi
] | 161 | false | false | 0 | 10 | 34 | 74 | 36 | 38 | null | null |
0xd34df00d/hencil | src/Main.hs | mit | toFile :: [(PenState, Forces, Double)] -> String
toFile = intercalate "\n" . map (\(PenState _ x φ _ _, _, _) -> show (x - l * sin φ) ++ " " ++ show (l * cos φ)) | 161 | toFile :: [(PenState, Forces, Double)] -> String
toFile = intercalate "\n" . map (\(PenState _ x φ _ _, _, _) -> show (x - l * sin φ) ++ " " ++ show (l * cos φ)) | 161 | toFile = intercalate "\n" . map (\(PenState _ x φ _ _, _, _) -> show (x - l * sin φ) ++ " " ++ show (l * cos φ)) | 112 | false | true | 0 | 14 | 37 | 103 | 54 | 49 | null | null |
notogawa/VideoCore4 | src/VideoCore4/QPU/Instruction/Register.hs | bsd-3-clause | ra12 :: Register
ra12 = Register 12 [AR,AW] | 43 | ra12 :: Register
ra12 = Register 12 [AR,AW] | 43 | ra12 = Register 12 [AR,AW] | 26 | false | true | 0 | 6 | 7 | 22 | 12 | 10 | null | null |
rrnewton/accelerate | Data/Array/Accelerate/Trafo/Vectorise.hs | bsd-3-clause | vectoriseSeqOpenAfun :: Strength
-> Context () aenv () aenv
-> OpenAfun aenv t
-> OpenAfun aenv t
vectoriseSeqOpenAfun strength ctx afun =
case afun of
Abody b -> Abody (vectoriseSeqOpenAcc strength ctx b)
Alam f -> Alam (vectoriseSeqOpenAfun strength (PushAccC ctx) f) | 343 | vectoriseSeqOpenAfun :: Strength
-> Context () aenv () aenv
-> OpenAfun aenv t
-> OpenAfun aenv t
vectoriseSeqOpenAfun strength ctx afun =
case afun of
Abody b -> Abody (vectoriseSeqOpenAcc strength ctx b)
Alam f -> Alam (vectoriseSeqOpenAfun strength (PushAccC ctx) f) | 343 | vectoriseSeqOpenAfun strength ctx afun =
case afun of
Abody b -> Abody (vectoriseSeqOpenAcc strength ctx b)
Alam f -> Alam (vectoriseSeqOpenAfun strength (PushAccC ctx) f) | 182 | false | true | 5 | 11 | 115 | 108 | 50 | 58 | null | null |
lukexi/ghc-7.8-arm64 | compiler/nativeGen/PPC/Regs.hs | bsd-3-clause | argRegs 8 = map regSingle [3..10] | 33 | argRegs 8 = map regSingle [3..10] | 33 | argRegs 8 = map regSingle [3..10] | 33 | false | false | 0 | 6 | 5 | 20 | 9 | 11 | null | null |
selectel/mongoDB-haskell | Database/MongoDB/Query.hs | apache-2.0 | modify :: (MonadIO m) => Selection -> Modifier -> Action m ()
-- ^ Update all documents in selection using given modifier
modify = update [MultiUpdate] | 151 | modify :: (MonadIO m) => Selection -> Modifier -> Action m ()
modify = update [MultiUpdate] | 91 | modify = update [MultiUpdate] | 29 | true | true | 0 | 10 | 25 | 47 | 23 | 24 | null | null |
codeq/language-py | src/Language/Py/LexerUtils.hs | bsd-3-clause | dedentation :: P Token -> Action
dedentation lexToken span _len _str = do
topIndent <- getIndent
-- case compare (endCol span) topIndent of
case compare (startCol span) topIndent of
EQ -> do popStartCode
lexToken
LT -> do popIndent
return dedentToken
GT -> spanError span "indentation error" | 335 | dedentation :: P Token -> Action
dedentation lexToken span _len _str = do
topIndent <- getIndent
-- case compare (endCol span) topIndent of
case compare (startCol span) topIndent of
EQ -> do popStartCode
lexToken
LT -> do popIndent
return dedentToken
GT -> spanError span "indentation error" | 335 | dedentation lexToken span _len _str = do
topIndent <- getIndent
-- case compare (endCol span) topIndent of
case compare (startCol span) topIndent of
EQ -> do popStartCode
lexToken
LT -> do popIndent
return dedentToken
GT -> spanError span "indentation error" | 302 | false | true | 0 | 12 | 89 | 91 | 41 | 50 | null | null |
elliottt/hsirc | tests/Main.hs | bsd-3-clause | properties :: TF.Test
properties = testGroup "QuickCheck Network.IRC"
[ testProperty "encodeDecode" prop_encodeDecode
] | 127 | properties :: TF.Test
properties = testGroup "QuickCheck Network.IRC"
[ testProperty "encodeDecode" prop_encodeDecode
] | 127 | properties = testGroup "QuickCheck Network.IRC"
[ testProperty "encodeDecode" prop_encodeDecode
] | 105 | false | true | 0 | 7 | 20 | 26 | 13 | 13 | null | null |
Icelandjack/lens | src/Control/Lens/Indexed.hs | bsd-3-clause | -- | Compose a non-indexed function with an 'Indexed' function.
--
-- Mnemonically, the @>@ points to the indexing we want to preserve.
--
-- This is the same as @('.')@.
--
-- @f '.' g@ (and @f '.>' g@) gives you the index of @g@ unless @g@ is index-preserving, like a
-- 'Prism', 'Iso' or 'Equality', in which case it'll pass through the index of @f@.
--
-- >>> let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])]
-- >>> nestedMap^..(itraversed.>itraversed).withIndex
-- [(10,"one,ten"),(20,"one,twenty"),(30,"two,thirty"),(40,"two,forty")]
(.>) :: (st -> r) -> (kab -> st) -> kab -> r
(.>) = (.) | 687 | (.>) :: (st -> r) -> (kab -> st) -> kab -> r
(.>) = (.) | 55 | (.>) = (.) | 10 | true | true | 0 | 9 | 106 | 62 | 39 | 23 | null | null |
schell/pusher | src/Pusher/Options.hs | gpl-3.0 | showOperation :: Operation -> String
showOperation OperationUploadFile = "upload-file" | 86 | showOperation :: Operation -> String
showOperation OperationUploadFile = "upload-file" | 86 | showOperation OperationUploadFile = "upload-file" | 49 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
nikita-volkov/ez-couch | src/Util/Logging.hs | mit | initialize = initializeWithFormat "$level $time, $logger: $message" | 67 | initialize = initializeWithFormat "$level $time, $logger: $message" | 67 | initialize = initializeWithFormat "$level $time, $logger: $message" | 67 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
jstolarek/ghc | compiler/main/DynFlags.hs | bsd-3-clause | wayOptc _ WayGran = ["-DGRAN"] | 36 | wayOptc _ WayGran = ["-DGRAN"] | 36 | wayOptc _ WayGran = ["-DGRAN"] | 36 | false | false | 1 | 6 | 10 | 16 | 7 | 9 | null | null |
philopon/arib | src/Data/Arib/PSI/Descriptor/Internal.hs | bsd-3-clause | reduceExtendedEvent :: Monad m => [(Word8, Word8, ExtendedEvent L.ByteString)] -> m [ExtendedEvent TL.Text]
reduceExtendedEvent = go "" [] "" 0 . dropWhile (\(w,_,_) -> w /= 0)
where
go _ _ _ _ [] = return []
go lng is ts m ((n,ln,ExtendedEvent l i t):es)
| m == n && n == ln = do
items <- mapM (\(a,b) -> (a,) `liftM` toText b) . concatItem $ is ++ i
text <- toText $ ts `L.append` t
(ExtendedEvent l items text :) `liftM` go l [] "" 0 es
| m == n = go l (is ++ i) (ts `L.append` t) (succ m) es
| otherwise = go lng is ts m es
concatItem [] = []
concatItem [a] = [a]
concatItem ((at,ab):(bt,bb):is)
| TL.null bt = concatItem $ (at,ab `L.append` bb):is
| otherwise = (at,ab) : concatItem ((bt,bb):is) | 820 | reduceExtendedEvent :: Monad m => [(Word8, Word8, ExtendedEvent L.ByteString)] -> m [ExtendedEvent TL.Text]
reduceExtendedEvent = go "" [] "" 0 . dropWhile (\(w,_,_) -> w /= 0)
where
go _ _ _ _ [] = return []
go lng is ts m ((n,ln,ExtendedEvent l i t):es)
| m == n && n == ln = do
items <- mapM (\(a,b) -> (a,) `liftM` toText b) . concatItem $ is ++ i
text <- toText $ ts `L.append` t
(ExtendedEvent l items text :) `liftM` go l [] "" 0 es
| m == n = go l (is ++ i) (ts `L.append` t) (succ m) es
| otherwise = go lng is ts m es
concatItem [] = []
concatItem [a] = [a]
concatItem ((at,ab):(bt,bb):is)
| TL.null bt = concatItem $ (at,ab `L.append` bb):is
| otherwise = (at,ab) : concatItem ((bt,bb):is) | 820 | reduceExtendedEvent = go "" [] "" 0 . dropWhile (\(w,_,_) -> w /= 0)
where
go _ _ _ _ [] = return []
go lng is ts m ((n,ln,ExtendedEvent l i t):es)
| m == n && n == ln = do
items <- mapM (\(a,b) -> (a,) `liftM` toText b) . concatItem $ is ++ i
text <- toText $ ts `L.append` t
(ExtendedEvent l items text :) `liftM` go l [] "" 0 es
| m == n = go l (is ++ i) (ts `L.append` t) (succ m) es
| otherwise = go lng is ts m es
concatItem [] = []
concatItem [a] = [a]
concatItem ((at,ab):(bt,bb):is)
| TL.null bt = concatItem $ (at,ab `L.append` bb):is
| otherwise = (at,ab) : concatItem ((bt,bb):is) | 712 | false | true | 3 | 17 | 260 | 490 | 247 | 243 | null | null |
sergv/vector | Data/Vector/Fusion/Stream/Monadic.hs | bsd-3-clause | prescanlM f w (Stream step t) = Stream step' (t,w)
where
{-# INLINE_INNER step' #-}
step' (s,x) = do
r <- step s
case r of
Yield y s' -> do
z <- f x y
return $ Yield x (s', z)
Skip s' -> return $ Skip (s', x)
Done -> return Done
-- | Prefix scan with strict accumulator | 471 | prescanlM f w (Stream step t) = Stream step' (t,w)
where
{-# INLINE_INNER step' #-}
step' (s,x) = do
r <- step s
case r of
Yield y s' -> do
z <- f x y
return $ Yield x (s', z)
Skip s' -> return $ Skip (s', x)
Done -> return Done
-- | Prefix scan with strict accumulator | 471 | prescanlM f w (Stream step t) = Stream step' (t,w)
where
{-# INLINE_INNER step' #-}
step' (s,x) = do
r <- step s
case r of
Yield y s' -> do
z <- f x y
return $ Yield x (s', z)
Skip s' -> return $ Skip (s', x)
Done -> return Done
-- | Prefix scan with strict accumulator | 471 | false | false | 0 | 14 | 262 | 144 | 68 | 76 | null | null |
travitch/llvm-analysis | src/LLVM/Analysis/PointsTo/Andersen.hs | bsd-3-clause | freshVariable :: ConstraintGen SetExp
freshVariable = do
s <- get
let vid = freshIdSrc s
v = Fresh vid
put $ s { freshIdSrc = vid + 1 }
return $! setVariable v | 173 | freshVariable :: ConstraintGen SetExp
freshVariable = do
s <- get
let vid = freshIdSrc s
v = Fresh vid
put $ s { freshIdSrc = vid + 1 }
return $! setVariable v | 173 | freshVariable = do
s <- get
let vid = freshIdSrc s
v = Fresh vid
put $ s { freshIdSrc = vid + 1 }
return $! setVariable v | 135 | false | true | 0 | 10 | 46 | 70 | 33 | 37 | null | null |
wrengr/bytestring-trie | src/Data/Trie/Internal.hs | bsd-3-clause | graft p0 t0 p1 t1
| zero p0 m = Branch p m t0 t1
| otherwise = Branch p m t1 t0
where
m = getMask p0 p1
p = applyMask p0 m
-- | Shorthand for prepending a non-null string to a 'graft'. This
-- is mainly useful for when @(p,k0,k1)@ came from 'breakMaximalPrefix'.
--
-- __Preconditions__
-- * The prefix must be non-null.
-- * Each trie must agree with their key (hence must also be non-@Empty@).
-- * The keys must not have matching prefixes. | 464 | graft p0 t0 p1 t1
| zero p0 m = Branch p m t0 t1
| otherwise = Branch p m t1 t0
where
m = getMask p0 p1
p = applyMask p0 m
-- | Shorthand for prepending a non-null string to a 'graft'. This
-- is mainly useful for when @(p,k0,k1)@ came from 'breakMaximalPrefix'.
--
-- __Preconditions__
-- * The prefix must be non-null.
-- * Each trie must agree with their key (hence must also be non-@Empty@).
-- * The keys must not have matching prefixes. | 464 | graft p0 t0 p1 t1
| zero p0 m = Branch p m t0 t1
| otherwise = Branch p m t1 t0
where
m = getMask p0 p1
p = applyMask p0 m
-- | Shorthand for prepending a non-null string to a 'graft'. This
-- is mainly useful for when @(p,k0,k1)@ came from 'breakMaximalPrefix'.
--
-- __Preconditions__
-- * The prefix must be non-null.
-- * Each trie must agree with their key (hence must also be non-@Empty@).
-- * The keys must not have matching prefixes. | 464 | false | false | 2 | 8 | 110 | 84 | 41 | 43 | null | null |
TomMD/cryptol | src/Cryptol/TypeCheck/Infer.hs | bsd-3-clause | smallest [t] = return t | 24 | smallest [t] = return t | 24 | smallest [t] = return t | 24 | false | false | 0 | 6 | 5 | 15 | 7 | 8 | null | null |
Miguel-Fontes/hs-file-watcher | src/Help/Printer.hs | mit | optionsDetail (TwoColumns (a, b)) (Extended xs d) =
formatLines 3 (formatColumn a (unwords xs)) (formatColumn b d) ++ "\n" | 126 | optionsDetail (TwoColumns (a, b)) (Extended xs d) =
formatLines 3 (formatColumn a (unwords xs)) (formatColumn b d) ++ "\n" | 126 | optionsDetail (TwoColumns (a, b)) (Extended xs d) =
formatLines 3 (formatColumn a (unwords xs)) (formatColumn b d) ++ "\n" | 126 | false | false | 0 | 10 | 22 | 64 | 32 | 32 | null | null |
alanz/Blobs | lib/DData/IntMap.hs | lgpl-2.1 | updateLookupWithKey :: (Key -> a -> Maybe a) -> Key -> IntMap a -> (Maybe a,IntMap a)
updateLookupWithKey f k t
= case t of
Bin p m l r
| nomatch k p m -> (Nothing,t)
| zero k m -> let (found,l') = updateLookupWithKey f k l in (found,bin p m l' r)
| otherwise -> let (found,r') = updateLookupWithKey f k r in (found,bin p m l r')
Tip ky y
| k==ky -> case (f k y) of
Just y' -> (Just y,Tip ky y')
Nothing -> (Just y,Nil)
| otherwise -> (Nothing,t)
Nil -> (Nothing,Nil)
{--------------------------------------------------------------------
Union
--------------------------------------------------------------------}
-- | The union of a list of maps. | 793 | updateLookupWithKey :: (Key -> a -> Maybe a) -> Key -> IntMap a -> (Maybe a,IntMap a)
updateLookupWithKey f k t
= case t of
Bin p m l r
| nomatch k p m -> (Nothing,t)
| zero k m -> let (found,l') = updateLookupWithKey f k l in (found,bin p m l' r)
| otherwise -> let (found,r') = updateLookupWithKey f k r in (found,bin p m l r')
Tip ky y
| k==ky -> case (f k y) of
Just y' -> (Just y,Tip ky y')
Nothing -> (Just y,Nil)
| otherwise -> (Nothing,t)
Nil -> (Nothing,Nil)
{--------------------------------------------------------------------
Union
--------------------------------------------------------------------}
-- | The union of a list of maps. | 793 | updateLookupWithKey f k t
= case t of
Bin p m l r
| nomatch k p m -> (Nothing,t)
| zero k m -> let (found,l') = updateLookupWithKey f k l in (found,bin p m l' r)
| otherwise -> let (found,r') = updateLookupWithKey f k r in (found,bin p m l r')
Tip ky y
| k==ky -> case (f k y) of
Just y' -> (Just y,Tip ky y')
Nothing -> (Just y,Nil)
| otherwise -> (Nothing,t)
Nil -> (Nothing,Nil)
{--------------------------------------------------------------------
Union
--------------------------------------------------------------------}
-- | The union of a list of maps. | 706 | false | true | 0 | 13 | 257 | 306 | 149 | 157 | null | null |
sukwon0709/mysql | src/MySQL/ParserInternal.hs | bsd-3-clause | tableFactor :: Parser Syn.TableFactor
tableFactor = try tableFactorTableName
<|> tableFactorTableReferences | 121 | tableFactor :: Parser Syn.TableFactor
tableFactor = try tableFactorTableName
<|> tableFactorTableReferences | 121 | tableFactor = try tableFactorTableName
<|> tableFactorTableReferences | 83 | false | true | 0 | 6 | 23 | 23 | 11 | 12 | null | null |
lambdageek/insomnia | src/Insomnia/Typecheck/ClarifySignature.hs | bsd-3-clause | clarifySubmodule :: Path
-> Field
-> Identifier
-> ModuleType
-> Signature
-> TC Signature
clarifySubmodule pmod f ident subModTy rest = do
subSigNF <- whnfModuleType subModTy
<??@ ("while clarifying submodule " <> formatErr pmod)
clearSubSigNF <- clarifySignatureNF (ProjP pmod f) subSigNF
rest' <- clarifySignature pmod rest
return $ SubmoduleSig f $ U.bind (ident, U.embed (moduleTypeNormalFormEmbed clearSubSigNF)) rest' | 541 | clarifySubmodule :: Path
-> Field
-> Identifier
-> ModuleType
-> Signature
-> TC Signature
clarifySubmodule pmod f ident subModTy rest = do
subSigNF <- whnfModuleType subModTy
<??@ ("while clarifying submodule " <> formatErr pmod)
clearSubSigNF <- clarifySignatureNF (ProjP pmod f) subSigNF
rest' <- clarifySignature pmod rest
return $ SubmoduleSig f $ U.bind (ident, U.embed (moduleTypeNormalFormEmbed clearSubSigNF)) rest' | 541 | clarifySubmodule pmod f ident subModTy rest = do
subSigNF <- whnfModuleType subModTy
<??@ ("while clarifying submodule " <> formatErr pmod)
clearSubSigNF <- clarifySignatureNF (ProjP pmod f) subSigNF
rest' <- clarifySignature pmod rest
return $ SubmoduleSig f $ U.bind (ident, U.embed (moduleTypeNormalFormEmbed clearSubSigNF)) rest' | 355 | false | true | 0 | 13 | 173 | 144 | 66 | 78 | null | null |
kishoredbn/barrelfish | tools/flounder/GHBackend.hs | mit | -- extracts the size of the arguemnts of a message
define_msg_size :: String -> String-> MessageArgument -> C.Unit
define_msg_size ifn fn (Arg tr (Name an)) = C.NoOp | 165 | define_msg_size :: String -> String-> MessageArgument -> C.Unit
define_msg_size ifn fn (Arg tr (Name an)) = C.NoOp | 114 | define_msg_size ifn fn (Arg tr (Name an)) = C.NoOp | 50 | true | true | 0 | 9 | 26 | 49 | 25 | 24 | null | null |
phischu/fragnix | tests/packages/scotty/System.EasyFile.FilePath.hs | bsd-3-clause | replaceDirectory :: FilePath -> String -> FilePath
replaceDirectory x dir = combineAlways dir (takeFileName x) | 110 | replaceDirectory :: FilePath -> String -> FilePath
replaceDirectory x dir = combineAlways dir (takeFileName x) | 110 | replaceDirectory x dir = combineAlways dir (takeFileName x) | 59 | false | true | 0 | 7 | 14 | 35 | 17 | 18 | null | null |
Oscarzhao/haskell | learnyouahaskell/solving_problem/heathrow/road.hs | apache-2.0 | -- heathrowToLondon represents the RoeadSystem to London
heathrowToLondon :: RoadSystem
heathrowToLondon = [Section 50 10 30, Section 5 90 20, Section 40 2 25, Section 10 8 0] | 175 | heathrowToLondon :: RoadSystem
heathrowToLondon = [Section 50 10 30, Section 5 90 20, Section 40 2 25, Section 10 8 0] | 118 | heathrowToLondon = [Section 50 10 30, Section 5 90 20, Section 40 2 25, Section 10 8 0] | 87 | true | true | 0 | 6 | 27 | 52 | 27 | 25 | null | null |
abailly/hevents | src/Hevents/Eff/Store/FileOps.hs | mit | writeStore :: (Versionable e) => FileStorage -> IO (Either a e) -> (Either a (StorageResult e) -> IO r) -> IO (StorageResult r)
writeStore s pre post = push (OpStore pre post) s | 177 | writeStore :: (Versionable e) => FileStorage -> IO (Either a e) -> (Either a (StorageResult e) -> IO r) -> IO (StorageResult r)
writeStore s pre post = push (OpStore pre post) s | 177 | writeStore s pre post = push (OpStore pre post) s | 49 | false | true | 0 | 13 | 32 | 93 | 45 | 48 | null | null |
asakeron/alonzo | src/Lambda/Eval.hs | gpl-3.0 | eval _ _ = Symbol '\0' | 22 | eval _ _ = Symbol '\0' | 22 | eval _ _ = Symbol '\0' | 22 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
ml9951/ghc | compiler/prelude/THNames.hs | bsd-3-clause | -- data TySynEqn = ...
tySynEqnIdKey :: Unique
tySynEqnIdKey = mkPreludeMiscIdUnique 460 | 88 | tySynEqnIdKey :: Unique
tySynEqnIdKey = mkPreludeMiscIdUnique 460 | 65 | tySynEqnIdKey = mkPreludeMiscIdUnique 460 | 41 | true | true | 0 | 5 | 11 | 15 | 8 | 7 | null | null |
shayan-najd/Haskell-Desugar-Generic | Language/Haskell/Exts/Desugar/Generic/Others.hs | bsd-3-clause | desugarBDecls, desugarIPBinds :: Desugaring Binds
desugarBDecls = noDesugaring | 78 | desugarBDecls, desugarIPBinds :: Desugaring Binds
desugarBDecls = noDesugaring | 78 | desugarBDecls = noDesugaring | 28 | false | true | 0 | 5 | 7 | 16 | 9 | 7 | null | null |
zoomhub/zoomhub | vendor/servant/servant-server/test/Servant/ServerSpec.hs | mit | captureApi :: Proxy CaptureApi
captureApi = Proxy | 49 | captureApi :: Proxy CaptureApi
captureApi = Proxy | 49 | captureApi = Proxy | 18 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
harryxp/haskell-things | misc/transpose.hs | mit | transpose (xs:xss) =
let h = head xs
tss = map (\x -> [x]) (tail xs)
yss = transpose xss
in
case yss of
[] -> [h]:tss
(zs:zss) -> (h:zs):map (\(ts, zs') -> (head ts):zs') (zip tss zss) | 222 | transpose (xs:xss) =
let h = head xs
tss = map (\x -> [x]) (tail xs)
yss = transpose xss
in
case yss of
[] -> [h]:tss
(zs:zss) -> (h:zs):map (\(ts, zs') -> (head ts):zs') (zip tss zss) | 222 | transpose (xs:xss) =
let h = head xs
tss = map (\x -> [x]) (tail xs)
yss = transpose xss
in
case yss of
[] -> [h]:tss
(zs:zss) -> (h:zs):map (\(ts, zs') -> (head ts):zs') (zip tss zss) | 222 | false | false | 2 | 12 | 75 | 147 | 76 | 71 | null | null |
damoxc/ganeti | src/Ganeti/HTools/Program/Hbal.hs | gpl-2.0 | handleSigTerm :: IORef Int -> IO ()
handleSigTerm cref = do
-- update the cref to 2, just for consistency
writeIORef cref 2
putStrLn "Double cancel request, exiting now..."
exitImmediately $ ExitFailure 2
-- | Prepares to run a set of jobsets with handling of signals and early
-- termination. | 302 | handleSigTerm :: IORef Int -> IO ()
handleSigTerm cref = do
-- update the cref to 2, just for consistency
writeIORef cref 2
putStrLn "Double cancel request, exiting now..."
exitImmediately $ ExitFailure 2
-- | Prepares to run a set of jobsets with handling of signals and early
-- termination. | 302 | handleSigTerm cref = do
-- update the cref to 2, just for consistency
writeIORef cref 2
putStrLn "Double cancel request, exiting now..."
exitImmediately $ ExitFailure 2
-- | Prepares to run a set of jobsets with handling of signals and early
-- termination. | 266 | false | true | 0 | 8 | 58 | 53 | 24 | 29 | null | null |
urbanslug/ghc | compiler/types/Class.hs | bsd-3-clause | classAllSelIds :: Class -> [Id]
-- Both superclass-dictionary and method selectors
classAllSelIds c@(Class {classSCSels = sc_sels})
= sc_sels ++ classMethods c | 161 | classAllSelIds :: Class -> [Id]
classAllSelIds c@(Class {classSCSels = sc_sels})
= sc_sels ++ classMethods c | 110 | classAllSelIds c@(Class {classSCSels = sc_sels})
= sc_sels ++ classMethods c | 78 | true | true | 0 | 10 | 22 | 44 | 24 | 20 | null | null |
VoQn/tapl-hs | src/Chapter4/Parser.hs | mit | parens :: Parser a -> Parser a
parens p = char '(' *> whitespace p <* whitespace (char ')') | 91 | parens :: Parser a -> Parser a
parens p = char '(' *> whitespace p <* whitespace (char ')') | 91 | parens p = char '(' *> whitespace p <* whitespace (char ')') | 60 | false | true | 0 | 8 | 18 | 51 | 22 | 29 | null | null |
sdiehl/ghc | compiler/main/Settings.hs | bsd-3-clause | sPgm_L :: Settings -> String
sPgm_L = toolSettings_pgm_L . sToolSettings | 72 | sPgm_L :: Settings -> String
sPgm_L = toolSettings_pgm_L . sToolSettings | 72 | sPgm_L = toolSettings_pgm_L . sToolSettings | 43 | false | true | 0 | 5 | 9 | 19 | 10 | 9 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.