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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
shepheb/go10c
|
Compiler.hs
|
bsd-3-clause
|
assignable :: Type -> Type -> Compiler Bool
assignable from to
| from == to = return True -- identical types, case 1.
| otherwise = do
uFrom <- underlyingType from
uTo <- underlyingType to
case (uFrom == uTo, from, to) of
(True, TypeName _, TypeName _) -> return False -- at least one must be non-named
(True, _, _) -> return True -- at least one is non-named and their base types are identical.
_ -> case (uFrom, uTo) of
(TypeInt, TypeUint) -> return True
(TypeUint, TypeInt) -> return True
(TypeNil, TypePointer _) -> return True
(TypeString, TypePointer TypeChar) -> return True
(TypePointer TypeChar, TypeString) -> return True
(TypeArray TypeChar, TypeString) -> return True
(TypeString, TypeArray TypeChar) -> return True
_ -> return False
| 944
|
assignable :: Type -> Type -> Compiler Bool
assignable from to
| from == to = return True -- identical types, case 1.
| otherwise = do
uFrom <- underlyingType from
uTo <- underlyingType to
case (uFrom == uTo, from, to) of
(True, TypeName _, TypeName _) -> return False -- at least one must be non-named
(True, _, _) -> return True -- at least one is non-named and their base types are identical.
_ -> case (uFrom, uTo) of
(TypeInt, TypeUint) -> return True
(TypeUint, TypeInt) -> return True
(TypeNil, TypePointer _) -> return True
(TypeString, TypePointer TypeChar) -> return True
(TypePointer TypeChar, TypeString) -> return True
(TypeArray TypeChar, TypeString) -> return True
(TypeString, TypeArray TypeChar) -> return True
_ -> return False
| 944
|
assignable from to
| from == to = return True -- identical types, case 1.
| otherwise = do
uFrom <- underlyingType from
uTo <- underlyingType to
case (uFrom == uTo, from, to) of
(True, TypeName _, TypeName _) -> return False -- at least one must be non-named
(True, _, _) -> return True -- at least one is non-named and their base types are identical.
_ -> case (uFrom, uTo) of
(TypeInt, TypeUint) -> return True
(TypeUint, TypeInt) -> return True
(TypeNil, TypePointer _) -> return True
(TypeString, TypePointer TypeChar) -> return True
(TypePointer TypeChar, TypeString) -> return True
(TypeArray TypeChar, TypeString) -> return True
(TypeString, TypeArray TypeChar) -> return True
_ -> return False
| 900
| false
| true
| 1
| 15
| 323
| 278
| 140
| 138
| null | null |
spechub/Hets
|
Proofs/EdgeUtils.hs
|
gpl-2.0
|
{- | returns all paths of globalDef edges or globalThm edges
between the given source and target node -}
getAllGlobPathsBetween :: DGraph -> Node -> Node -> [[LEdge DGLinkLab]]
getAllGlobPathsBetween dgraph = getAllPathsOfTypeBetween dgraph isGlobalEdge
| 256
|
getAllGlobPathsBetween :: DGraph -> Node -> Node -> [[LEdge DGLinkLab]]
getAllGlobPathsBetween dgraph = getAllPathsOfTypeBetween dgraph isGlobalEdge
| 148
|
getAllGlobPathsBetween dgraph = getAllPathsOfTypeBetween dgraph isGlobalEdge
| 76
| true
| true
| 0
| 10
| 37
| 41
| 21
| 20
| null | null |
bitemyapp/github
|
samples/Users/Followers/ListFollowers.hs
|
bsd-3-clause
|
formatUser = Github.githubOwnerLogin
| 36
|
formatUser = Github.githubOwnerLogin
| 36
|
formatUser = Github.githubOwnerLogin
| 36
| false
| false
| 1
| 6
| 2
| 12
| 4
| 8
| null | null |
JacquesCarette/literate-scientific-software
|
code/drasil-printers/Language/Drasil/Config.hs
|
bsd-2-clause
|
-- | TeX Only - Numbered sections?
numberedSections :: Bool
numberedSections = True
| 83
|
numberedSections :: Bool
numberedSections = True
| 48
|
numberedSections = True
| 23
| true
| true
| 0
| 4
| 12
| 12
| 7
| 5
| null | null |
phadej/generics-sop
|
src/Generics/SOP/NP.hs
|
bsd-3-clause
|
liftA_POP = hliftA
| 18
|
liftA_POP = hliftA
| 18
|
liftA_POP = hliftA
| 18
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
elliottt/dang
|
src/Dang/Utils/PP.hs
|
bsd-3-clause
|
sgrFor AnnLiteral = [Ansi.SetColor Ansi.Foreground Ansi.Vivid Ansi.Magenta]
| 75
|
sgrFor AnnLiteral = [Ansi.SetColor Ansi.Foreground Ansi.Vivid Ansi.Magenta]
| 75
|
sgrFor AnnLiteral = [Ansi.SetColor Ansi.Foreground Ansi.Vivid Ansi.Magenta]
| 75
| false
| false
| 1
| 7
| 6
| 30
| 13
| 17
| null | null |
alexander-at-github/eta
|
compiler/ETA/DeSugar/DsArrows.hs
|
bsd-3-clause
|
collectStmtBinders (TransStmt { trS_stmts = stmts }) = collectLStmtsBinders stmts
| 81
|
collectStmtBinders (TransStmt { trS_stmts = stmts }) = collectLStmtsBinders stmts
| 81
|
collectStmtBinders (TransStmt { trS_stmts = stmts }) = collectLStmtsBinders stmts
| 81
| false
| false
| 0
| 8
| 9
| 25
| 12
| 13
| null | null |
AleXoundOS/mpv-cut
|
src/MPV_Cut.hs
|
gpl-3.0
|
findFileByPatternInDir :: BSL.ByteString -> BSL.ByteString -> IO BSL.ByteString
findFileByPatternInDir pattern dir = do
dirList <- getDirectoryContents (BSL.unpack dir)
let nonNumberCondition :: String -> Bool
nonNumberCondition with
= notElem (BSL.unpack
$ (extFromFilename . nameFromFilename) (BSL.pack with))
[BSL.unpack $ show2d x | x <- [00..99]]
predicate :: String -> Bool
predicate with = isInfixOf (BSL.unpack pattern) with
&& nonNumberCondition with
&& extFromFilename (BSL.pack with) /= "sh"
satisfied :: [FilePath]
satisfied = filter predicate dirList
if (not . null) satisfied
then return $ BSL.pack $ head satisfied
else return BSL.empty
| 807
|
findFileByPatternInDir :: BSL.ByteString -> BSL.ByteString -> IO BSL.ByteString
findFileByPatternInDir pattern dir = do
dirList <- getDirectoryContents (BSL.unpack dir)
let nonNumberCondition :: String -> Bool
nonNumberCondition with
= notElem (BSL.unpack
$ (extFromFilename . nameFromFilename) (BSL.pack with))
[BSL.unpack $ show2d x | x <- [00..99]]
predicate :: String -> Bool
predicate with = isInfixOf (BSL.unpack pattern) with
&& nonNumberCondition with
&& extFromFilename (BSL.pack with) /= "sh"
satisfied :: [FilePath]
satisfied = filter predicate dirList
if (not . null) satisfied
then return $ BSL.pack $ head satisfied
else return BSL.empty
| 807
|
findFileByPatternInDir pattern dir = do
dirList <- getDirectoryContents (BSL.unpack dir)
let nonNumberCondition :: String -> Bool
nonNumberCondition with
= notElem (BSL.unpack
$ (extFromFilename . nameFromFilename) (BSL.pack with))
[BSL.unpack $ show2d x | x <- [00..99]]
predicate :: String -> Bool
predicate with = isInfixOf (BSL.unpack pattern) with
&& nonNumberCondition with
&& extFromFilename (BSL.pack with) /= "sh"
satisfied :: [FilePath]
satisfied = filter predicate dirList
if (not . null) satisfied
then return $ BSL.pack $ head satisfied
else return BSL.empty
| 727
| false
| true
| 0
| 17
| 242
| 247
| 120
| 127
| null | null |
hanshoglund/sox2
|
src/Sound/Sox2.hs
|
bsd-3-clause
|
-- upsample [factor]
upsample :: Audio -> Sox Audio
upsample = error "No upsample"
| 82
|
upsample :: Audio -> Sox Audio
upsample = error "No upsample"
| 61
|
upsample = error "No upsample"
| 30
| true
| true
| 0
| 6
| 13
| 22
| 11
| 11
| null | null |
abakst/liquidhaskell
|
src/Language/Haskell/Liquid/Misc.hs
|
bsd-3-clause
|
mapN 0 f (x:xs) = f x : xs
| 26
|
mapN 0 f (x:xs) = f x : xs
| 26
|
mapN 0 f (x:xs) = f x : xs
| 26
| false
| false
| 0
| 7
| 8
| 27
| 13
| 14
| null | null |
jyp/inox
|
C/Deep.hs
|
gpl-3.0
|
-- | Structure fields
cStruct :: [(String,Type)] -> C
cStruct fields = mconcat [cDecl (f,t) <> ";\n" | (f,t) <- fields]
| 119
|
cStruct :: [(String,Type)] -> C
cStruct fields = mconcat [cDecl (f,t) <> ";\n" | (f,t) <- fields]
| 97
|
cStruct fields = mconcat [cDecl (f,t) <> ";\n" | (f,t) <- fields]
| 65
| true
| true
| 0
| 9
| 20
| 61
| 34
| 27
| null | null |
ezyang/ghc
|
compiler/nativeGen/PPC/CodeGen.hs
|
bsd-3-clause
|
mangleIndexTree :: DynFlags -> CmmExpr -> CmmExpr
mangleIndexTree dflags (CmmRegOff reg off)
= CmmMachOp (MO_Add width) [CmmReg reg, CmmLit (CmmInt (fromIntegral off) width)]
where width = typeWidth (cmmRegType dflags reg)
| 226
|
mangleIndexTree :: DynFlags -> CmmExpr -> CmmExpr
mangleIndexTree dflags (CmmRegOff reg off)
= CmmMachOp (MO_Add width) [CmmReg reg, CmmLit (CmmInt (fromIntegral off) width)]
where width = typeWidth (cmmRegType dflags reg)
| 226
|
mangleIndexTree dflags (CmmRegOff reg off)
= CmmMachOp (MO_Add width) [CmmReg reg, CmmLit (CmmInt (fromIntegral off) width)]
where width = typeWidth (cmmRegType dflags reg)
| 176
| false
| true
| 1
| 11
| 33
| 96
| 44
| 52
| null | null |
sdiehl/ghc
|
testsuite/tests/perf/should_run/T8763.hs
|
bsd-3-clause
|
nop :: Monad m => a -> m ()
nop _ = return ()
| 45
|
nop :: Monad m => a -> m ()
nop _ = return ()
| 45
|
nop _ = return ()
| 17
| false
| true
| 0
| 8
| 13
| 35
| 16
| 19
| null | null |
huggablemonad/smooch
|
app/migrations/Rivet.hs
|
gpl-3.0
|
main :: IO ()
main = do e <- doesFileExist ".env"
when e $ Configuration.Dotenv.loadFile False ".env"
args <- getArgs
let (env, mode) =
case args of
[env', "up"] -> (env', Rivet.MigrateUp)
[env', "down"] -> (env', Rivet.MigrateDown)
[env', "status"] -> (env', Rivet.MigrateStatus)
_ -> error "Usage: [executable] [devel|prod|...] [up|down|status]"
conf <- C.load [C.Required (env <> ".cfg")]
host <- C.require conf "postgresql-simple.host"
port <- C.require conf "postgresql-simple.port"
user <- C.require conf "postgresql-simple.user"
pass <- C.require conf "postgresql-simple.pass"
db <- C.require conf "postgresql-simple.db"
adaptor <- setup id (ConnectInfo host port user pass db)
Rivet.main adaptor mode migrations
| 912
|
main :: IO ()
main = do e <- doesFileExist ".env"
when e $ Configuration.Dotenv.loadFile False ".env"
args <- getArgs
let (env, mode) =
case args of
[env', "up"] -> (env', Rivet.MigrateUp)
[env', "down"] -> (env', Rivet.MigrateDown)
[env', "status"] -> (env', Rivet.MigrateStatus)
_ -> error "Usage: [executable] [devel|prod|...] [up|down|status]"
conf <- C.load [C.Required (env <> ".cfg")]
host <- C.require conf "postgresql-simple.host"
port <- C.require conf "postgresql-simple.port"
user <- C.require conf "postgresql-simple.user"
pass <- C.require conf "postgresql-simple.pass"
db <- C.require conf "postgresql-simple.db"
adaptor <- setup id (ConnectInfo host port user pass db)
Rivet.main adaptor mode migrations
| 912
|
main = do e <- doesFileExist ".env"
when e $ Configuration.Dotenv.loadFile False ".env"
args <- getArgs
let (env, mode) =
case args of
[env', "up"] -> (env', Rivet.MigrateUp)
[env', "down"] -> (env', Rivet.MigrateDown)
[env', "status"] -> (env', Rivet.MigrateStatus)
_ -> error "Usage: [executable] [devel|prod|...] [up|down|status]"
conf <- C.load [C.Required (env <> ".cfg")]
host <- C.require conf "postgresql-simple.host"
port <- C.require conf "postgresql-simple.port"
user <- C.require conf "postgresql-simple.user"
pass <- C.require conf "postgresql-simple.pass"
db <- C.require conf "postgresql-simple.db"
adaptor <- setup id (ConnectInfo host port user pass db)
Rivet.main adaptor mode migrations
| 898
| false
| true
| 0
| 14
| 287
| 275
| 133
| 142
| null | null |
OS2World/DEV-UTIL-HUGS
|
libraries/Graphics/Rendering/OpenGL/GL/PeekPoke.hs
|
bsd-3-clause
|
poke1 :: Storable a => Ptr a -> a -> IO ()
poke1 ptr x =
pokeElemOff ptr 0 x
| 79
|
poke1 :: Storable a => Ptr a -> a -> IO ()
poke1 ptr x =
pokeElemOff ptr 0 x
| 79
|
poke1 ptr x =
pokeElemOff ptr 0 x
| 36
| false
| true
| 0
| 9
| 22
| 46
| 21
| 25
| null | null |
randen/cabal
|
cabal-install/Distribution/Client/Sandbox.hs
|
bsd-3-clause
|
initPackageDBIfNeeded :: Verbosity -> ConfigFlags
-> Compiler -> ProgramConfiguration
-> IO ()
initPackageDBIfNeeded verbosity configFlags comp conf = do
SpecificPackageDB dbPath <- getSandboxPackageDB configFlags
packageDBExists <- doesDirectoryExist dbPath
unless packageDBExists $
Register.initPackageDB verbosity comp conf dbPath
when packageDBExists $
debug verbosity $ "The package database already exists: " ++ dbPath
-- | Entry point for the 'cabal sandbox dump-pkgenv' command.
| 553
|
initPackageDBIfNeeded :: Verbosity -> ConfigFlags
-> Compiler -> ProgramConfiguration
-> IO ()
initPackageDBIfNeeded verbosity configFlags comp conf = do
SpecificPackageDB dbPath <- getSandboxPackageDB configFlags
packageDBExists <- doesDirectoryExist dbPath
unless packageDBExists $
Register.initPackageDB verbosity comp conf dbPath
when packageDBExists $
debug verbosity $ "The package database already exists: " ++ dbPath
-- | Entry point for the 'cabal sandbox dump-pkgenv' command.
| 553
|
initPackageDBIfNeeded verbosity configFlags comp conf = do
SpecificPackageDB dbPath <- getSandboxPackageDB configFlags
packageDBExists <- doesDirectoryExist dbPath
unless packageDBExists $
Register.initPackageDB verbosity comp conf dbPath
when packageDBExists $
debug verbosity $ "The package database already exists: " ++ dbPath
-- | Entry point for the 'cabal sandbox dump-pkgenv' command.
| 408
| false
| true
| 0
| 10
| 126
| 107
| 48
| 59
| null | null |
amremam2004/vxmlizer
|
VXMLTree.hs
|
bsd-3-clause
|
-- Converting a menu to a XMLTree
convertMenu2Tree :: Element -> VXMLTree
convertMenu2Tree elem = Menu (Prompt (ActPrompt (convertPrompts2Str $ findChildren (mkQName "prompt") elem)))
(Options (convertChoices2Options $ findChildren (mkQName "choice") elem))
| 287
|
convertMenu2Tree :: Element -> VXMLTree
convertMenu2Tree elem = Menu (Prompt (ActPrompt (convertPrompts2Str $ findChildren (mkQName "prompt") elem)))
(Options (convertChoices2Options $ findChildren (mkQName "choice") elem))
| 253
|
convertMenu2Tree elem = Menu (Prompt (ActPrompt (convertPrompts2Str $ findChildren (mkQName "prompt") elem)))
(Options (convertChoices2Options $ findChildren (mkQName "choice") elem))
| 213
| true
| true
| 0
| 14
| 60
| 81
| 40
| 41
| null | null |
urbanslug/ghc
|
libraries/template-haskell/Language/Haskell/TH/Ppr.hs
|
bsd-3-clause
|
ppr_dec _ (StandaloneDerivD cxt ty)
= hsep [ text "deriving instance", pprCxt cxt, ppr ty ]
| 93
|
ppr_dec _ (StandaloneDerivD cxt ty)
= hsep [ text "deriving instance", pprCxt cxt, ppr ty ]
| 93
|
ppr_dec _ (StandaloneDerivD cxt ty)
= hsep [ text "deriving instance", pprCxt cxt, ppr ty ]
| 93
| false
| false
| 0
| 7
| 17
| 40
| 19
| 21
| null | null |
trxeste/wrk
|
haskell/myBlog/Application.hs
|
bsd-3-clause
|
shutdownApp :: App -> IO ()
shutdownApp _ = return ()
| 53
|
shutdownApp :: App -> IO ()
shutdownApp _ = return ()
| 53
|
shutdownApp _ = return ()
| 25
| false
| true
| 0
| 7
| 10
| 28
| 13
| 15
| null | null |
haskell-opengl/OpenGLRaw
|
src/Graphics/GL/Functions/F25.hs
|
bsd-3-clause
|
ptr_glTexCoord2fVertex3fvSUN :: FunPtr (Ptr GLfloat -> Ptr GLfloat -> IO ())
ptr_glTexCoord2fVertex3fvSUN = unsafePerformIO $ getCommand "glTexCoord2fVertex3fvSUN"
| 163
|
ptr_glTexCoord2fVertex3fvSUN :: FunPtr (Ptr GLfloat -> Ptr GLfloat -> IO ())
ptr_glTexCoord2fVertex3fvSUN = unsafePerformIO $ getCommand "glTexCoord2fVertex3fvSUN"
| 163
|
ptr_glTexCoord2fVertex3fvSUN = unsafePerformIO $ getCommand "glTexCoord2fVertex3fvSUN"
| 86
| false
| true
| 0
| 10
| 16
| 43
| 20
| 23
| null | null |
keveri/hib
|
src/Hib/Plugins/Piato.hs
|
bsd-3-clause
|
feed :: String
feed = "http://www.sonaatti.fi/rssfeed/"
| 55
|
feed :: String
feed = "http://www.sonaatti.fi/rssfeed/"
| 55
|
feed = "http://www.sonaatti.fi/rssfeed/"
| 40
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
dec9ue/jhc_copygc
|
src/Ho/Library.hs
|
gpl-2.0
|
condenseWhitespace xs = reverse $ dropWhile isSpace (reverse (dropWhile isSpace (cw xs))) where
cw (x:y:zs) | isSpace x && isSpace y = cw (' ':zs)
cw (x:xs) = x:cw xs
cw [] = []
| 190
|
condenseWhitespace xs = reverse $ dropWhile isSpace (reverse (dropWhile isSpace (cw xs))) where
cw (x:y:zs) | isSpace x && isSpace y = cw (' ':zs)
cw (x:xs) = x:cw xs
cw [] = []
| 190
|
condenseWhitespace xs = reverse $ dropWhile isSpace (reverse (dropWhile isSpace (cw xs))) where
cw (x:y:zs) | isSpace x && isSpace y = cw (' ':zs)
cw (x:xs) = x:cw xs
cw [] = []
| 190
| false
| false
| 0
| 12
| 46
| 118
| 57
| 61
| null | null |
kajigor/uKanren_transformations
|
test/resources/Program/L.hs
|
bsd-3-clause
|
-- De Bruijn encoding for L lang
-- data L = Iconst_ Int
-- | Bconst_ Bool
-- | Var_ Int
-- | Plus_ L L
-- | Mult_ L L
-- | Equal_ L L
-- | Less_ L L
-- | If_ L L L
-- | Let_ L L
just x = C "some" [x]
| 258
|
just x = C "some" [x]
| 21
|
just x = C "some" [x]
| 21
| true
| false
| 0
| 6
| 115
| 27
| 18
| 9
| null | null |
benkolera/phb
|
hs/Site/TimeLog.hs
|
mit
|
possibleOwnerSplices :: Splices (PhbRuntimeSplice (Entity Person) -> PhbSplice)
possibleOwnerSplices = mapV (C.pureSplice . C.textSplice) $ do
"userId" ## (^.eKey.to keyToText)
"userName" ## (^.eVal.personName)
| 218
|
possibleOwnerSplices :: Splices (PhbRuntimeSplice (Entity Person) -> PhbSplice)
possibleOwnerSplices = mapV (C.pureSplice . C.textSplice) $ do
"userId" ## (^.eKey.to keyToText)
"userName" ## (^.eVal.personName)
| 218
|
possibleOwnerSplices = mapV (C.pureSplice . C.textSplice) $ do
"userId" ## (^.eKey.to keyToText)
"userName" ## (^.eVal.personName)
| 138
| false
| true
| 0
| 11
| 30
| 77
| 39
| 38
| null | null |
thko/morph
|
Main.hs
|
mit
|
main :: IO ()
main = do
wLen : wFreq : filenames <- getArgs
wordlist <- words <$> readInput filenames
mapM_ print $ morph (read wLen) (read wFreq) wordlist
| 161
|
main :: IO ()
main = do
wLen : wFreq : filenames <- getArgs
wordlist <- words <$> readInput filenames
mapM_ print $ morph (read wLen) (read wFreq) wordlist
| 161
|
main = do
wLen : wFreq : filenames <- getArgs
wordlist <- words <$> readInput filenames
mapM_ print $ morph (read wLen) (read wFreq) wordlist
| 147
| false
| true
| 0
| 10
| 34
| 74
| 34
| 40
| null | null |
gcampax/ghc
|
compiler/types/TyCon.hs
|
bsd-3-clause
|
primRepSizeW _ PtrRep = 1
| 40
|
primRepSizeW _ PtrRep = 1
| 40
|
primRepSizeW _ PtrRep = 1
| 40
| false
| false
| 0
| 5
| 19
| 11
| 5
| 6
| null | null |
loadimpact/http2-test
|
hs-src/Rede/HarFiles/ServedEntry.hs
|
bsd-3-clause
|
harHeadersToUVL :: [Har_Header] -> UnpackedNameValueList
harHeadersToUVL h = UnpackedNameValueList $ map
(\ har_header -> ( lowercaseText (har_header ^. headerName ), (har_header ^. headerValue) )
) h
| 211
|
harHeadersToUVL :: [Har_Header] -> UnpackedNameValueList
harHeadersToUVL h = UnpackedNameValueList $ map
(\ har_header -> ( lowercaseText (har_header ^. headerName ), (har_header ^. headerValue) )
) h
| 211
|
harHeadersToUVL h = UnpackedNameValueList $ map
(\ har_header -> ( lowercaseText (har_header ^. headerName ), (har_header ^. headerValue) )
) h
| 154
| false
| true
| 0
| 10
| 36
| 68
| 34
| 34
| null | null |
allanderek/ipclib
|
Language/Ptrees/Print.hs
|
gpl-2.0
|
pprintAssign :: Doc -> Doc -> Doc
pprintAssign a b =
Pretty.hsep [ a, Pretty.text "=", b ]
| 93
|
pprintAssign :: Doc -> Doc -> Doc
pprintAssign a b =
Pretty.hsep [ a, Pretty.text "=", b ]
| 93
|
pprintAssign a b =
Pretty.hsep [ a, Pretty.text "=", b ]
| 59
| false
| true
| 0
| 8
| 20
| 48
| 23
| 25
| null | null |
karamellpelle/MEnv
|
source/OpenGL/IOS/Values.hs
|
bsd-2-clause
|
gl_TEXTURE_CUBE_MAP_NEGATIVE_X :: GLenum
gl_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516
| 81
|
gl_TEXTURE_CUBE_MAP_NEGATIVE_X :: GLenum
gl_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516
| 81
|
gl_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516
| 40
| false
| true
| 0
| 4
| 6
| 11
| 6
| 5
| null | null |
shlevy/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
lcmIntegerName = varQual gHC_INTEGER_TYPE (fsLit "lcmInteger") lcmIntegerIdKey
| 92
|
lcmIntegerName = varQual gHC_INTEGER_TYPE (fsLit "lcmInteger") lcmIntegerIdKey
| 92
|
lcmIntegerName = varQual gHC_INTEGER_TYPE (fsLit "lcmInteger") lcmIntegerIdKey
| 92
| false
| false
| 0
| 7
| 20
| 19
| 9
| 10
| null | null |
HJvT/hdirect
|
src/Parser.hs
|
bsd-3-clause
|
action_72 x = happyTcHack x happyFail
| 37
|
action_72 x = happyTcHack x happyFail
| 37
|
action_72 x = happyTcHack x happyFail
| 37
| false
| false
| 0
| 5
| 5
| 14
| 6
| 8
| null | null |
nh2/shake
|
Development/Ninja/Parse.hs
|
bsd-3-clause
|
splitColon :: Str -> (Str, Str)
splitColon = splitUnescaped ':'
| 64
|
splitColon :: Str -> (Str, Str)
splitColon = splitUnescaped ':'
| 63
|
splitColon = splitUnescaped ':'
| 31
| false
| true
| 0
| 8
| 10
| 30
| 14
| 16
| null | null |
sanjoy/DietLISP
|
src/Builtins.hs
|
gpl-2.0
|
liftUnary predicate (BottomD string) = BottomD string
| 53
|
liftUnary predicate (BottomD string) = BottomD string
| 53
|
liftUnary predicate (BottomD string) = BottomD string
| 53
| false
| false
| 0
| 7
| 6
| 20
| 9
| 11
| null | null |
benekastah/ebitor
|
src/Ebitor/Language.hs
|
bsd-3-clause
|
bracketed :: Parser a -> Parser a
bracketed = between (char '<') (char '>')
| 75
|
bracketed :: Parser a -> Parser a
bracketed = between (char '<') (char '>')
| 75
|
bracketed = between (char '<') (char '>')
| 41
| false
| true
| 0
| 7
| 13
| 38
| 18
| 20
| null | null |
olsner/ghc
|
compiler/prelude/PrimOp.hs
|
bsd-3-clause
|
primOpSig :: PrimOp -> ([TyVar], [Type], Type, Arity, StrictSig)
primOpSig op
= (tyvars, arg_tys, res_ty, arity, primOpStrictness op arity)
where
arity = length arg_tys
(tyvars, arg_tys, res_ty)
= case (primOpInfo op) of
Monadic _occ ty -> ([], [ty], ty )
Dyadic _occ ty -> ([], [ty,ty], ty )
Compare _occ ty -> ([], [ty,ty], intPrimTy)
GenPrimOp _occ tyvars arg_tys res_ty -> (tyvars, arg_tys, res_ty )
| 546
|
primOpSig :: PrimOp -> ([TyVar], [Type], Type, Arity, StrictSig)
primOpSig op
= (tyvars, arg_tys, res_ty, arity, primOpStrictness op arity)
where
arity = length arg_tys
(tyvars, arg_tys, res_ty)
= case (primOpInfo op) of
Monadic _occ ty -> ([], [ty], ty )
Dyadic _occ ty -> ([], [ty,ty], ty )
Compare _occ ty -> ([], [ty,ty], intPrimTy)
GenPrimOp _occ tyvars arg_tys res_ty -> (tyvars, arg_tys, res_ty )
| 546
|
primOpSig op
= (tyvars, arg_tys, res_ty, arity, primOpStrictness op arity)
where
arity = length arg_tys
(tyvars, arg_tys, res_ty)
= case (primOpInfo op) of
Monadic _occ ty -> ([], [ty], ty )
Dyadic _occ ty -> ([], [ty,ty], ty )
Compare _occ ty -> ([], [ty,ty], intPrimTy)
GenPrimOp _occ tyvars arg_tys res_ty -> (tyvars, arg_tys, res_ty )
| 481
| false
| true
| 1
| 9
| 207
| 209
| 114
| 95
| null | null |
ezyang/ghc
|
compiler/cmm/CmmCallConv.hs
|
bsd-3-clause
|
realDoubleRegs dflags = map DoubleReg $ regList (mAX_Real_Double_REG dflags)
| 79
|
realDoubleRegs dflags = map DoubleReg $ regList (mAX_Real_Double_REG dflags)
| 79
|
realDoubleRegs dflags = map DoubleReg $ regList (mAX_Real_Double_REG dflags)
| 79
| false
| false
| 0
| 8
| 11
| 25
| 11
| 14
| null | null |
alephcloud/hs-aws-general
|
src/Aws/SignatureV4.hs
|
mit
|
signingKeyPrefix :: IsString a => a
signingKeyPrefix = "AWS4"
| 61
|
signingKeyPrefix :: IsString a => a
signingKeyPrefix = "AWS4"
| 61
|
signingKeyPrefix = "AWS4"
| 25
| false
| true
| 0
| 6
| 8
| 18
| 9
| 9
| null | null |
acowley/ghc
|
compiler/basicTypes/Literal.hs
|
bsd-3-clause
|
narrow8WordLit (MachWord w) = MachWord (toInteger (fromInteger w :: Word8))
| 77
|
narrow8WordLit (MachWord w) = MachWord (toInteger (fromInteger w :: Word8))
| 77
|
narrow8WordLit (MachWord w) = MachWord (toInteger (fromInteger w :: Word8))
| 77
| false
| false
| 0
| 9
| 11
| 34
| 16
| 18
| null | null |
abhinav-mehta/CipherSolver
|
src/PlayFair.hs
|
bsd-3-clause
|
bigram :: Key -> Int -> Char -> Char -> String
bigram k dir c1 c2
| y1 == y2 = get (x1 + dir, y1) : [get (x2 + dir, y2)]
| x1 == x2 = get (x1, y1 + dir) : [get (x2, y2 + dir)]
| otherwise = get (x2, y1) : [get (x1, y2)]
where (x1, y1) = head . M.keys $ M.filter (== c1) k
(x2, y2) = head . M.keys $ M.filter (== c2) k
get (x,y) = k M.! (mod x 5, mod y 5)
| 398
|
bigram :: Key -> Int -> Char -> Char -> String
bigram k dir c1 c2
| y1 == y2 = get (x1 + dir, y1) : [get (x2 + dir, y2)]
| x1 == x2 = get (x1, y1 + dir) : [get (x2, y2 + dir)]
| otherwise = get (x2, y1) : [get (x1, y2)]
where (x1, y1) = head . M.keys $ M.filter (== c1) k
(x2, y2) = head . M.keys $ M.filter (== c2) k
get (x,y) = k M.! (mod x 5, mod y 5)
| 398
|
bigram k dir c1 c2
| y1 == y2 = get (x1 + dir, y1) : [get (x2 + dir, y2)]
| x1 == x2 = get (x1, y1 + dir) : [get (x2, y2 + dir)]
| otherwise = get (x2, y1) : [get (x1, y2)]
where (x1, y1) = head . M.keys $ M.filter (== c1) k
(x2, y2) = head . M.keys $ M.filter (== c2) k
get (x,y) = k M.! (mod x 5, mod y 5)
| 351
| false
| true
| 0
| 10
| 135
| 263
| 138
| 125
| null | null |
imeckler/proof
|
Utils.hs
|
mit
|
strip :: String -> String
strip = stripRight . stripLeft
| 56
|
strip :: String -> String
strip = stripRight . stripLeft
| 56
|
strip = stripRight . stripLeft
| 30
| false
| true
| 0
| 7
| 9
| 26
| 11
| 15
| null | null |
ihc/futhark
|
src/Futhark/Pass/ExtractKernels/ISRWIM.hs
|
isc
|
-- | Interchange Reduce With Inner Map. Tries to turn a @reduce(map)@ into a
-- @map(reduce)
irwim :: (MonadBinder m, Lore m ~ SOACS, LocalScope SOACS m) =>
Pattern
-> SubExp
-> Commutativity -> Lambda
-> [(SubExp, VName)]
-> Maybe (m ())
irwim res_pat w comm red_fun red_input
| Just (map_pat, map_cs, map_w, map_fun) <- rwimPossible red_fun = Just $ do
let (accs, arrs) = unzip red_input
arrs' <- transposedArrays arrs
-- FIXME? Can we reasonably assume that the accumulator is a
-- replicate? We also assume that it is non-empty.
let indexAcc (Var v) = do
v_t <- lookupType v
letSubExp "acc" $ BasicOp $ Index v $
fullSlice v_t [DimFix $ intConst Int32 0]
indexAcc Constant{} =
fail "irwim: array accumulator is a constant."
accs' <- mapM indexAcc accs
let (_red_acc_params, red_elem_params) =
splitAt (length arrs) $ lambdaParams red_fun
map_rettype = map rowType $ lambdaReturnType red_fun
map_params = map (setParamOuterDimTo w) red_elem_params
red_params = lambdaParams map_fun
red_body = lambdaBody map_fun
red_rettype = lambdaReturnType map_fun
red_fun' = Lambda red_params red_body red_rettype
red_input' = zip accs' $ map paramName map_params
red_pat = stripPatternOuterDim map_pat
map_body <-
case irwim red_pat w comm red_fun' red_input' of
Nothing ->
return $ mkBody [Let red_pat (defAux ()) $ Op $ Reduce w comm red_fun' red_input'] $
map Var $ patternNames map_pat
Just m -> localScope (scopeOfLParams map_params) $ do
map_body_bnds <- collectStms_ m
return $ mkBody map_body_bnds $ map Var $ patternNames map_pat
let map_fun' = Lambda map_params map_body map_rettype
addStm $ Let res_pat (StmAux map_cs ()) $ Op $ Map map_w map_fun' arrs'
| otherwise = Nothing
| 2,009
|
irwim :: (MonadBinder m, Lore m ~ SOACS, LocalScope SOACS m) =>
Pattern
-> SubExp
-> Commutativity -> Lambda
-> [(SubExp, VName)]
-> Maybe (m ())
irwim res_pat w comm red_fun red_input
| Just (map_pat, map_cs, map_w, map_fun) <- rwimPossible red_fun = Just $ do
let (accs, arrs) = unzip red_input
arrs' <- transposedArrays arrs
-- FIXME? Can we reasonably assume that the accumulator is a
-- replicate? We also assume that it is non-empty.
let indexAcc (Var v) = do
v_t <- lookupType v
letSubExp "acc" $ BasicOp $ Index v $
fullSlice v_t [DimFix $ intConst Int32 0]
indexAcc Constant{} =
fail "irwim: array accumulator is a constant."
accs' <- mapM indexAcc accs
let (_red_acc_params, red_elem_params) =
splitAt (length arrs) $ lambdaParams red_fun
map_rettype = map rowType $ lambdaReturnType red_fun
map_params = map (setParamOuterDimTo w) red_elem_params
red_params = lambdaParams map_fun
red_body = lambdaBody map_fun
red_rettype = lambdaReturnType map_fun
red_fun' = Lambda red_params red_body red_rettype
red_input' = zip accs' $ map paramName map_params
red_pat = stripPatternOuterDim map_pat
map_body <-
case irwim red_pat w comm red_fun' red_input' of
Nothing ->
return $ mkBody [Let red_pat (defAux ()) $ Op $ Reduce w comm red_fun' red_input'] $
map Var $ patternNames map_pat
Just m -> localScope (scopeOfLParams map_params) $ do
map_body_bnds <- collectStms_ m
return $ mkBody map_body_bnds $ map Var $ patternNames map_pat
let map_fun' = Lambda map_params map_body map_rettype
addStm $ Let res_pat (StmAux map_cs ()) $ Op $ Map map_w map_fun' arrs'
| otherwise = Nothing
| 1,916
|
irwim res_pat w comm red_fun red_input
| Just (map_pat, map_cs, map_w, map_fun) <- rwimPossible red_fun = Just $ do
let (accs, arrs) = unzip red_input
arrs' <- transposedArrays arrs
-- FIXME? Can we reasonably assume that the accumulator is a
-- replicate? We also assume that it is non-empty.
let indexAcc (Var v) = do
v_t <- lookupType v
letSubExp "acc" $ BasicOp $ Index v $
fullSlice v_t [DimFix $ intConst Int32 0]
indexAcc Constant{} =
fail "irwim: array accumulator is a constant."
accs' <- mapM indexAcc accs
let (_red_acc_params, red_elem_params) =
splitAt (length arrs) $ lambdaParams red_fun
map_rettype = map rowType $ lambdaReturnType red_fun
map_params = map (setParamOuterDimTo w) red_elem_params
red_params = lambdaParams map_fun
red_body = lambdaBody map_fun
red_rettype = lambdaReturnType map_fun
red_fun' = Lambda red_params red_body red_rettype
red_input' = zip accs' $ map paramName map_params
red_pat = stripPatternOuterDim map_pat
map_body <-
case irwim red_pat w comm red_fun' red_input' of
Nothing ->
return $ mkBody [Let red_pat (defAux ()) $ Op $ Reduce w comm red_fun' red_input'] $
map Var $ patternNames map_pat
Just m -> localScope (scopeOfLParams map_params) $ do
map_body_bnds <- collectStms_ m
return $ mkBody map_body_bnds $ map Var $ patternNames map_pat
let map_fun' = Lambda map_params map_body map_rettype
addStm $ Let res_pat (StmAux map_cs ()) $ Op $ Map map_w map_fun' arrs'
| otherwise = Nothing
| 1,737
| true
| true
| 1
| 24
| 595
| 576
| 271
| 305
| null | null |
athanclark/Idris-dev
|
src/Idris/AbsSyntaxTree.hs
|
bsd-3-clause
|
eqCon = sUN "Refl"
| 18
|
eqCon = sUN "Refl"
| 18
|
eqCon = sUN "Refl"
| 18
| false
| false
| 1
| 5
| 3
| 13
| 4
| 9
| null | null |
ssaavedra/liquidhaskell
|
src/Language/Haskell/Liquid/Parse.hs
|
bsd-3-clause
|
betweenMany leftP rightP p
= do z <- grabUpto leftP
case z of
Just _ -> liftM2 (:) (between leftP rightP p) (betweenMany leftP rightP p)
Nothing -> return []
| 185
|
betweenMany leftP rightP p
= do z <- grabUpto leftP
case z of
Just _ -> liftM2 (:) (between leftP rightP p) (betweenMany leftP rightP p)
Nothing -> return []
| 185
|
betweenMany leftP rightP p
= do z <- grabUpto leftP
case z of
Just _ -> liftM2 (:) (between leftP rightP p) (betweenMany leftP rightP p)
Nothing -> return []
| 185
| false
| false
| 0
| 12
| 57
| 79
| 37
| 42
| null | null |
kosmoskatten/synthetic-web
|
test/TestSuite.hs
|
mit
|
main :: IO ()
main = defaultMain testSuite
| 42
|
main :: IO ()
main = defaultMain testSuite
| 42
|
main = defaultMain testSuite
| 28
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
mzini/hosa
|
src/HoSA/Data/Program/Expression.hs
|
mit
|
mapExpressionM f g (Pair _ t1 t2) = pair <$> mapExpressionM f g t1 <*> mapExpressionM f g t2
| 98
|
mapExpressionM f g (Pair _ t1 t2) = pair <$> mapExpressionM f g t1 <*> mapExpressionM f g t2
| 98
|
mapExpressionM f g (Pair _ t1 t2) = pair <$> mapExpressionM f g t1 <*> mapExpressionM f g t2
| 98
| false
| false
| 0
| 7
| 24
| 45
| 21
| 24
| null | null |
paulrzcz/takusen-oracle
|
Database/Oracle/OCIFunctions.hs
|
bsd-3-clause
|
cTimeToBuffer :: BufferPtr -> UTCTime -> IO ()
utcTimeToBuffer buf utc = do
let (LocalTime ltday time) = utcToLocalTime (hoursToTimeZone 0) utc
let (TimeOfDay hour minute second) = time
let (year, month, day) = toGregorian ltday
setBufferByte buf 0 (makeCentByte (fromIntegral year))
setBufferByte buf 1 (makeYearByte (fromIntegral year))
setBufferByte buf 2 (fromIntegral month)
setBufferByte buf 3 (fromIntegral day)
setBufferByte buf 4 (fromIntegral (hour+1))
setBufferByte buf 5 (fromIntegral (minute+1))
setBufferByte buf 6 (round (second+1))
| 580
|
utcTimeToBuffer :: BufferPtr -> UTCTime -> IO ()
utcTimeToBuffer buf utc = do
let (LocalTime ltday time) = utcToLocalTime (hoursToTimeZone 0) utc
let (TimeOfDay hour minute second) = time
let (year, month, day) = toGregorian ltday
setBufferByte buf 0 (makeCentByte (fromIntegral year))
setBufferByte buf 1 (makeYearByte (fromIntegral year))
setBufferByte buf 2 (fromIntegral month)
setBufferByte buf 3 (fromIntegral day)
setBufferByte buf 4 (fromIntegral (hour+1))
setBufferByte buf 5 (fromIntegral (minute+1))
setBufferByte buf 6 (round (second+1))
| 579
|
utcTimeToBuffer buf utc = do
let (LocalTime ltday time) = utcToLocalTime (hoursToTimeZone 0) utc
let (TimeOfDay hour minute second) = time
let (year, month, day) = toGregorian ltday
setBufferByte buf 0 (makeCentByte (fromIntegral year))
setBufferByte buf 1 (makeYearByte (fromIntegral year))
setBufferByte buf 2 (fromIntegral month)
setBufferByte buf 3 (fromIntegral day)
setBufferByte buf 4 (fromIntegral (hour+1))
setBufferByte buf 5 (fromIntegral (minute+1))
setBufferByte buf 6 (round (second+1))
| 530
| false
| true
| 0
| 12
| 105
| 249
| 115
| 134
| null | null |
trskop/command-wrapper
|
command-wrapper/src/CommandWrapper/Toolset/InternalSubcommand/Config/Dhall.hs
|
bsd-3-clause
|
diff :: AppNames -> Config -> Diff -> IO ()
diff appNames config Diff{..} = handleExceptions appNames config do
Dhall.Diff.Diff{doc} <- Dhall.Diff.diffNormalized
<$> Dhall.inputExpr expr1
<*> Dhall.inputExpr expr2
withOutputHandle InputStdin output (renderDoc config) doc
-- }}} Diff -------------------------------------------------------------------
-- {{{ REPL -------------------------------------------------------------------
| 458
|
diff :: AppNames -> Config -> Diff -> IO ()
diff appNames config Diff{..} = handleExceptions appNames config do
Dhall.Diff.Diff{doc} <- Dhall.Diff.diffNormalized
<$> Dhall.inputExpr expr1
<*> Dhall.inputExpr expr2
withOutputHandle InputStdin output (renderDoc config) doc
-- }}} Diff -------------------------------------------------------------------
-- {{{ REPL -------------------------------------------------------------------
| 458
|
diff appNames config Diff{..} = handleExceptions appNames config do
Dhall.Diff.Diff{doc} <- Dhall.Diff.diffNormalized
<$> Dhall.inputExpr expr1
<*> Dhall.inputExpr expr2
withOutputHandle InputStdin output (renderDoc config) doc
-- }}} Diff -------------------------------------------------------------------
-- {{{ REPL -------------------------------------------------------------------
| 414
| false
| true
| 0
| 12
| 68
| 105
| 51
| 54
| null | null |
snowleopard/shaking-up-ghc
|
src/Packages.hs
|
bsd-3-clause
|
xhtml = lib "xhtml"
| 34
|
xhtml = lib "xhtml"
| 34
|
xhtml = lib "xhtml"
| 34
| false
| false
| 1
| 5
| 18
| 12
| 4
| 8
| null | null |
urbanslug/ghc
|
compiler/simplCore/CoreMonad.hs
|
bsd-3-clause
|
reinitializeGlobals :: CoreM ()
reinitializeGlobals = do
linker_globals <- read cr_globals
hsc_env <- getHscEnv
let dflags = hsc_dflags hsc_env
liftIO $ restoreLinkerGlobals linker_globals
liftIO $ setUnsafeGlobalDynFlags dflags
{-
************************************************************************
* *
Dealing with annotations
* *
************************************************************************
-}
-- | Get all annotations of a given type. This happens lazily, that is
-- no deserialization will take place until the [a] is actually demanded and
-- the [a] can also be empty (the UniqFM is not filtered).
--
-- This should be done once at the start of a Core-to-Core pass that uses
-- annotations.
--
-- See Note [Annotations]
| 915
|
reinitializeGlobals :: CoreM ()
reinitializeGlobals = do
linker_globals <- read cr_globals
hsc_env <- getHscEnv
let dflags = hsc_dflags hsc_env
liftIO $ restoreLinkerGlobals linker_globals
liftIO $ setUnsafeGlobalDynFlags dflags
{-
************************************************************************
* *
Dealing with annotations
* *
************************************************************************
-}
-- | Get all annotations of a given type. This happens lazily, that is
-- no deserialization will take place until the [a] is actually demanded and
-- the [a] can also be empty (the UniqFM is not filtered).
--
-- This should be done once at the start of a Core-to-Core pass that uses
-- annotations.
--
-- See Note [Annotations]
| 915
|
reinitializeGlobals = do
linker_globals <- read cr_globals
hsc_env <- getHscEnv
let dflags = hsc_dflags hsc_env
liftIO $ restoreLinkerGlobals linker_globals
liftIO $ setUnsafeGlobalDynFlags dflags
{-
************************************************************************
* *
Dealing with annotations
* *
************************************************************************
-}
-- | Get all annotations of a given type. This happens lazily, that is
-- no deserialization will take place until the [a] is actually demanded and
-- the [a] can also be empty (the UniqFM is not filtered).
--
-- This should be done once at the start of a Core-to-Core pass that uses
-- annotations.
--
-- See Note [Annotations]
| 883
| false
| true
| 1
| 11
| 272
| 78
| 37
| 41
| null | null |
gcampax/ghc
|
compiler/main/Packages.hs
|
bsd-3-clause
|
-- internal helper
add_package :: PackageConfigMap
-> Map InstalledPackageId PackageKey
-> [PackageKey]
-> (PackageKey,Maybe PackageKey)
-> MaybeErr MsgDoc [PackageKey]
add_package pkg_db ipid_map ps (p, mb_parent)
| p `elem` ps = return ps -- Check if we've already added this package
| otherwise =
case lookupPackage' pkg_db p of
Nothing -> Failed (missingPackageMsg p <>
missingDependencyMsg mb_parent)
Just pkg -> do
-- Add the package's dependents also
ps' <- foldM add_package_ipid ps (depends pkg)
return (p : ps')
where
add_package_ipid ps ipid
| Just pid <- Map.lookup ipid ipid_map
= add_package pkg_db ipid_map ps (pid, Just p)
| otherwise
= Failed (missingPackageMsg ipid
<> missingDependencyMsg mb_parent)
| 960
|
add_package :: PackageConfigMap
-> Map InstalledPackageId PackageKey
-> [PackageKey]
-> (PackageKey,Maybe PackageKey)
-> MaybeErr MsgDoc [PackageKey]
add_package pkg_db ipid_map ps (p, mb_parent)
| p `elem` ps = return ps -- Check if we've already added this package
| otherwise =
case lookupPackage' pkg_db p of
Nothing -> Failed (missingPackageMsg p <>
missingDependencyMsg mb_parent)
Just pkg -> do
-- Add the package's dependents also
ps' <- foldM add_package_ipid ps (depends pkg)
return (p : ps')
where
add_package_ipid ps ipid
| Just pid <- Map.lookup ipid ipid_map
= add_package pkg_db ipid_map ps (pid, Just p)
| otherwise
= Failed (missingPackageMsg ipid
<> missingDependencyMsg mb_parent)
| 941
|
add_package pkg_db ipid_map ps (p, mb_parent)
| p `elem` ps = return ps -- Check if we've already added this package
| otherwise =
case lookupPackage' pkg_db p of
Nothing -> Failed (missingPackageMsg p <>
missingDependencyMsg mb_parent)
Just pkg -> do
-- Add the package's dependents also
ps' <- foldM add_package_ipid ps (depends pkg)
return (p : ps')
where
add_package_ipid ps ipid
| Just pid <- Map.lookup ipid ipid_map
= add_package pkg_db ipid_map ps (pid, Just p)
| otherwise
= Failed (missingPackageMsg ipid
<> missingDependencyMsg mb_parent)
| 743
| true
| true
| 1
| 15
| 346
| 240
| 116
| 124
| null | null |
DanielSchuessler/hstri
|
HomogenousTuples.hs
|
gpl-3.0
|
fromList4 :: [t2] -> (t2, t2, t2, t2)
fromList4 = $(tupleFromList 4)
| 69
|
fromList4 :: [t2] -> (t2, t2, t2, t2)
fromList4 = $(tupleFromList 4)
| 69
|
fromList4 = $(tupleFromList 4)
| 30
| false
| true
| 0
| 7
| 12
| 37
| 21
| 16
| null | null |
brendanhay/gogol
|
gogol-games/gen/Network/Google/Resource/Games/Players/Get.hs
|
mpl-2.0
|
-- | A player ID. A value of \`me\` may be used in place of the authenticated
-- player\'s ID.
pgPlayerId :: Lens' PlayersGet Text
pgPlayerId
= lens _pgPlayerId (\ s a -> s{_pgPlayerId = a})
| 192
|
pgPlayerId :: Lens' PlayersGet Text
pgPlayerId
= lens _pgPlayerId (\ s a -> s{_pgPlayerId = a})
| 97
|
pgPlayerId
= lens _pgPlayerId (\ s a -> s{_pgPlayerId = a})
| 61
| true
| true
| 0
| 9
| 37
| 43
| 23
| 20
| null | null |
mcapodici/haskelllearn
|
ConcurrencyExamples/app/Main.hs
|
mit
|
main :: IO ()
main = exampleMain
| 32
|
main :: IO ()
main = exampleMain
| 32
|
main = exampleMain
| 18
| false
| true
| 0
| 6
| 6
| 16
| 8
| 8
| null | null |
robeverest/accelerate
|
Data/Array/Accelerate/Interpreter.hs
|
bsd-3-clause
|
evalPrim (PrimQuot ty) = evalQuot ty
| 47
|
evalPrim (PrimQuot ty) = evalQuot ty
| 47
|
evalPrim (PrimQuot ty) = evalQuot ty
| 47
| false
| false
| 0
| 7
| 16
| 18
| 8
| 10
| null | null |
carlohamalainen/imagetrove-uploader
|
src/Network/ImageTrove/MainDicom.hs
|
bsd-2-clause
|
uploadDicomAction opts origDir = do
liftIO $ print "uploadDicomAction: entering."
{-
debug <- mytardisDebug <$> ask
cwd <- liftIO getCurrentDirectory
let slashToUnderscore = map (\c -> if c == '/' then '_' else c)
let fp = cwd </> (slashToUnderscore $ "state_" ++ optConfigFile opts)
liftIO $ createDirectoryIfMissing True fp
conf <- ask
acidMVar <- liftIO $ newEmptyMVar
experimentMVar <- liftIO $ newEmptyMVar
datasetMVar <- liftIO $ newEmptyMVar
groupMVar <- liftIO $ newEmptyMVar
-- FIXME Would be nicer if we could avoid the runReaderT stuff here?
asyncAcidWorker <- liftIO $ async $ acidWorker acidMVar
asyncWorkerCreateExperiment <- liftIO $ async $ runReaderT (workerCreateExperiment experimentMVar) conf
asyncWorkerCreateDataset <- liftIO $ async $ runReaderT (workerCreateDataset datasetMVar) conf
asyncWorkerCreateGroup <- liftIO $ async $ runReaderT (workerCreateGroup groupMVar) conf
instrumentConfigs <- liftIO $ readInstrumentConfigs (optConfigFile opts)
tasks <- concat <$> forM instrumentConfigs (makeTasks conf debug fp acidMVar experimentMVar datasetMVar groupMVar)
liftIO $ putStrLn $ "uploadDicomAction: found " ++ show (length tasks) ++ " tasks to process."
-- FIXME Add an ID to the config so that logging has a task ID.
liftIO $ withPool 15 $ \pool -> parallel_ pool tasks
pollExperiment <- liftIO $ poll asyncWorkerCreateExperiment
pollDataset <- liftIO $ poll asyncWorkerCreateDataset
pollGroup <- liftIO $ poll asyncWorkerCreateGroup
pollAcid <- liftIO $ poll asyncAcidWorker
liftIO $ putStrLn $ "poll pollExperiment: " ++ show pollExperiment
liftIO $ putStrLn $ "poll pollDataset: " ++ show pollDataset
liftIO $ putStrLn $ "poll pollGroup: " ++ show (pollGroup :: Maybe (Either SomeException ()))
liftIO $ putStrLn $ "poll pollAcid: " ++ show (pollAcid :: Maybe (Either SomeException ()))
liftIO $ print "uploadDicomAction: exiting."
-}
{-
makeTasks conf debug fp acidMVar experimentMVar datasetMVar groupMVar iconfig = do
let ( instrumentName, instrumentFilters, instrumentFiltersT, instrumentMetadataFields, experimentFields, datasetFields, schemaExperiment, schemaDataset, schemaDicomFile, defaultInstitutionName, defaultInstitutionalDepartmentName, defaultInstitutionalAddress, defaultOperators) = iconfig
liftIO $ putStrLn ""
liftIO $ putStrLn ""
liftIO $ putStrLn $ "Instrument: " ++ instrumentName
liftIO $ putStrLn ""
_ogroups <- getOrthancInstrumentGroups instrumentFiltersT <$> majorOrthancGroups
-- Timezone:
ZonedTime _ tz <- liftIO getZonedTime
case _ogroups of Left err -> undefined
Right ogroups -> do
let -- Times that available *series* have been updated:
updatedTimes = map (\(_, _, s, _, _) -> (getSeriesLastUpdate tz s)) ogroups :: [Maybe ZonedTime]
-- Hash of each:
hashes = map (\(patient, study, series, _, _) -> getHashes (patient, study, series)) ogroups
-- Together:
hashAndLastUpdated = zip hashes updatedTimes
liftIO $ putStrLn $ "|hashAndLastUpdated| = " ++ show (length hashAndLastUpdated)
recentOgroups <- liftIO $ patientsToProcess acidMVar fp ogroups hashAndLastUpdated
liftIO $ putStrLn $ "Experiments that are recent enough for us to process: " ++ show recentOgroups
liftIO $ getZonedTime >>= print
let fn = \og -> runReaderT (blaaah acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields og) conf
return $ map fn recentOgroups
blaaah acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields (patient, study, series, oneInstance, tags) = do
here <- liftIO getZonedTime
liftIO $ print ("blaaah", "entering at time", here, opID patient, ostudyID study, oseriesID series)
-- Before we get the archive, check if the Referring Physician is there so that we can get a project ID.
let projectID = join $ tagValue <$> otagReferringPhysicianName tags
case is5digits <$> projectID of
Nothing -> liftIO $ putStrLn $ "Error: could not read Referring Physician Name from " ++ opID patient ++ " " ++ ostudyID study ++ " " ++ oseriesID series
Just False -> liftIO $ putStrLn $ "Error: invalid project ID: \"" ++ (fromJust projectID) ++ "\" from " ++ opID patient ++ " " ++ ostudyID study ++ " " ++ oseriesID series
Just True -> blaaah' acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields (patient, study, series, oneInstance, tags)
blaaah' acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields (patient, study, series, oneInstance, tags) = do
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "getting series archive.... " ++ oseriesID series
archive <- getSeriesArchive $ oseriesID series
liftIO $ putStrLn $ "finished getting series archive.... " ++ oseriesID series
case archive of
Left e -> liftIO $ putStrLn $ "Error: could not get series archive " ++ oseriesID series ++ "; failed with error: " ++ e
Right (tempDir, zipfile) -> do
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "got series archive."
liftIO $ print (tempDir, zipfile)
tmp <- mytardisTmp <$> ask
linksDir <- liftIO $ unpackArchive tmp tempDir zipfile
case linksDir of
Left linksErr -> liftIO $ putStrLn $ "blaaah: error unpacking archive: " ++ linksErr
Right linksDir' -> do
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "dostuff: linksDir: " ++ linksDir'
createProjectGroup groupMVar linksDir'
rawDicomFiles <- liftIO $ getDicomFilesInDirectory ".dcm" linksDir'
anonymizationResults <- liftIO $ forM rawDicomFiles anonymizeDicomFile
if length (lefts anonymizationResults) > 0
then liftIO $ putStrLn $ "Errors while anonymizing DICOM files: " ++ show (lefts anonymizationResults)
else do files <- liftIO $ rights <$> (getDicomFilesInDirectory ".dcm" linksDir' >>= mapM readDicomMetadata)
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "calling uploadDicomAsMincOneGroup..."
oneGroupResult <- uploadDicomAsMincOneGroup
experimentMVar
datasetMVar
files
instrumentFilters
instrumentMetadataFields
experimentFields
datasetFields
identifyExperiment
identifyDataset
identifyDatasetFile
linksDir'
( schemaExperiment
, schemaDataset
, schemaDicomFile
, defaultInstitutionName
, defaultInstitutionalDepartmentName
, defaultInstitutionalAddress
, defaultOperators)
let schemaFile = schemaDicomFile -- FIXME
case oneGroupResult of
(A.Success (A.Success restExperiment, A.Success restDataset)) -> do
zipfile' <- uploadFileBasic schemaFile identifyDatasetFile restDataset zipfile [] -- FIXME add some metadata
case zipfile' of
A.Success zipfile'' -> liftIO $ do putStrLn $ "Successfully uploaded: " ++ show zipfile''
putStrLn $ "Deleting temporary directory: " ++ tempDir
removeRecursiveSafely tempDir
putStrLn $ "Deleting links directory: " ++ linksDir'
removeRecursiveSafely linksDir'
putStrLn $ "Updating last updated: " ++ show (fp, opID patient, getSeriesLastUpdate tz series)
-- updateLastUpdate fp (getHashes (patient, study, series)) (getSeriesLastUpdate tz series)
_ <- callWorkerIO acidMVar (AcidUpdateMap fp (getHashes (patient, study, series)) (getSeriesLastUpdate tz series))
putStrLn $ "Updated last update."
A.Error e -> liftIO $ do putStrLn $ "Error while uploading series archive: " ++ e
if debug then do putStrLn $ "Not deleting temporary directory: " ++ tempDir
putStrLn $ "Not deleting links directory: " ++ linksDir'
else do putStrLn $ "Deleting temporary directory: " ++ tempDir
removeRecursiveSafely tempDir
putStrLn $ "Deleting links directory: " ++ linksDir'
removeRecursiveSafely linksDir'
liftIO $ print zipfile'
(A.Success (A.Error expError, _ )) -> liftIO $ putStrLn $ "Error when creating experiment: " ++ expError
(A.Success (_, A.Error dsError)) -> liftIO $ putStrLn $ "Error when creating dataset: " ++ dsError
(A.Error e) -> liftIO $ putStrLn $ "Error in uploadDicomAsMincOneGroup: " ++ e
liftIO $ print "blaaah: exiting"
-}
| 13,110
|
uploadDicomAction opts origDir = do
liftIO $ print "uploadDicomAction: entering."
{-
debug <- mytardisDebug <$> ask
cwd <- liftIO getCurrentDirectory
let slashToUnderscore = map (\c -> if c == '/' then '_' else c)
let fp = cwd </> (slashToUnderscore $ "state_" ++ optConfigFile opts)
liftIO $ createDirectoryIfMissing True fp
conf <- ask
acidMVar <- liftIO $ newEmptyMVar
experimentMVar <- liftIO $ newEmptyMVar
datasetMVar <- liftIO $ newEmptyMVar
groupMVar <- liftIO $ newEmptyMVar
-- FIXME Would be nicer if we could avoid the runReaderT stuff here?
asyncAcidWorker <- liftIO $ async $ acidWorker acidMVar
asyncWorkerCreateExperiment <- liftIO $ async $ runReaderT (workerCreateExperiment experimentMVar) conf
asyncWorkerCreateDataset <- liftIO $ async $ runReaderT (workerCreateDataset datasetMVar) conf
asyncWorkerCreateGroup <- liftIO $ async $ runReaderT (workerCreateGroup groupMVar) conf
instrumentConfigs <- liftIO $ readInstrumentConfigs (optConfigFile opts)
tasks <- concat <$> forM instrumentConfigs (makeTasks conf debug fp acidMVar experimentMVar datasetMVar groupMVar)
liftIO $ putStrLn $ "uploadDicomAction: found " ++ show (length tasks) ++ " tasks to process."
-- FIXME Add an ID to the config so that logging has a task ID.
liftIO $ withPool 15 $ \pool -> parallel_ pool tasks
pollExperiment <- liftIO $ poll asyncWorkerCreateExperiment
pollDataset <- liftIO $ poll asyncWorkerCreateDataset
pollGroup <- liftIO $ poll asyncWorkerCreateGroup
pollAcid <- liftIO $ poll asyncAcidWorker
liftIO $ putStrLn $ "poll pollExperiment: " ++ show pollExperiment
liftIO $ putStrLn $ "poll pollDataset: " ++ show pollDataset
liftIO $ putStrLn $ "poll pollGroup: " ++ show (pollGroup :: Maybe (Either SomeException ()))
liftIO $ putStrLn $ "poll pollAcid: " ++ show (pollAcid :: Maybe (Either SomeException ()))
liftIO $ print "uploadDicomAction: exiting."
-}
{-
makeTasks conf debug fp acidMVar experimentMVar datasetMVar groupMVar iconfig = do
let ( instrumentName, instrumentFilters, instrumentFiltersT, instrumentMetadataFields, experimentFields, datasetFields, schemaExperiment, schemaDataset, schemaDicomFile, defaultInstitutionName, defaultInstitutionalDepartmentName, defaultInstitutionalAddress, defaultOperators) = iconfig
liftIO $ putStrLn ""
liftIO $ putStrLn ""
liftIO $ putStrLn $ "Instrument: " ++ instrumentName
liftIO $ putStrLn ""
_ogroups <- getOrthancInstrumentGroups instrumentFiltersT <$> majorOrthancGroups
-- Timezone:
ZonedTime _ tz <- liftIO getZonedTime
case _ogroups of Left err -> undefined
Right ogroups -> do
let -- Times that available *series* have been updated:
updatedTimes = map (\(_, _, s, _, _) -> (getSeriesLastUpdate tz s)) ogroups :: [Maybe ZonedTime]
-- Hash of each:
hashes = map (\(patient, study, series, _, _) -> getHashes (patient, study, series)) ogroups
-- Together:
hashAndLastUpdated = zip hashes updatedTimes
liftIO $ putStrLn $ "|hashAndLastUpdated| = " ++ show (length hashAndLastUpdated)
recentOgroups <- liftIO $ patientsToProcess acidMVar fp ogroups hashAndLastUpdated
liftIO $ putStrLn $ "Experiments that are recent enough for us to process: " ++ show recentOgroups
liftIO $ getZonedTime >>= print
let fn = \og -> runReaderT (blaaah acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields og) conf
return $ map fn recentOgroups
blaaah acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields (patient, study, series, oneInstance, tags) = do
here <- liftIO getZonedTime
liftIO $ print ("blaaah", "entering at time", here, opID patient, ostudyID study, oseriesID series)
-- Before we get the archive, check if the Referring Physician is there so that we can get a project ID.
let projectID = join $ tagValue <$> otagReferringPhysicianName tags
case is5digits <$> projectID of
Nothing -> liftIO $ putStrLn $ "Error: could not read Referring Physician Name from " ++ opID patient ++ " " ++ ostudyID study ++ " " ++ oseriesID series
Just False -> liftIO $ putStrLn $ "Error: invalid project ID: \"" ++ (fromJust projectID) ++ "\" from " ++ opID patient ++ " " ++ ostudyID study ++ " " ++ oseriesID series
Just True -> blaaah' acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields (patient, study, series, oneInstance, tags)
blaaah' acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields (patient, study, series, oneInstance, tags) = do
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "getting series archive.... " ++ oseriesID series
archive <- getSeriesArchive $ oseriesID series
liftIO $ putStrLn $ "finished getting series archive.... " ++ oseriesID series
case archive of
Left e -> liftIO $ putStrLn $ "Error: could not get series archive " ++ oseriesID series ++ "; failed with error: " ++ e
Right (tempDir, zipfile) -> do
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "got series archive."
liftIO $ print (tempDir, zipfile)
tmp <- mytardisTmp <$> ask
linksDir <- liftIO $ unpackArchive tmp tempDir zipfile
case linksDir of
Left linksErr -> liftIO $ putStrLn $ "blaaah: error unpacking archive: " ++ linksErr
Right linksDir' -> do
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "dostuff: linksDir: " ++ linksDir'
createProjectGroup groupMVar linksDir'
rawDicomFiles <- liftIO $ getDicomFilesInDirectory ".dcm" linksDir'
anonymizationResults <- liftIO $ forM rawDicomFiles anonymizeDicomFile
if length (lefts anonymizationResults) > 0
then liftIO $ putStrLn $ "Errors while anonymizing DICOM files: " ++ show (lefts anonymizationResults)
else do files <- liftIO $ rights <$> (getDicomFilesInDirectory ".dcm" linksDir' >>= mapM readDicomMetadata)
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "calling uploadDicomAsMincOneGroup..."
oneGroupResult <- uploadDicomAsMincOneGroup
experimentMVar
datasetMVar
files
instrumentFilters
instrumentMetadataFields
experimentFields
datasetFields
identifyExperiment
identifyDataset
identifyDatasetFile
linksDir'
( schemaExperiment
, schemaDataset
, schemaDicomFile
, defaultInstitutionName
, defaultInstitutionalDepartmentName
, defaultInstitutionalAddress
, defaultOperators)
let schemaFile = schemaDicomFile -- FIXME
case oneGroupResult of
(A.Success (A.Success restExperiment, A.Success restDataset)) -> do
zipfile' <- uploadFileBasic schemaFile identifyDatasetFile restDataset zipfile [] -- FIXME add some metadata
case zipfile' of
A.Success zipfile'' -> liftIO $ do putStrLn $ "Successfully uploaded: " ++ show zipfile''
putStrLn $ "Deleting temporary directory: " ++ tempDir
removeRecursiveSafely tempDir
putStrLn $ "Deleting links directory: " ++ linksDir'
removeRecursiveSafely linksDir'
putStrLn $ "Updating last updated: " ++ show (fp, opID patient, getSeriesLastUpdate tz series)
-- updateLastUpdate fp (getHashes (patient, study, series)) (getSeriesLastUpdate tz series)
_ <- callWorkerIO acidMVar (AcidUpdateMap fp (getHashes (patient, study, series)) (getSeriesLastUpdate tz series))
putStrLn $ "Updated last update."
A.Error e -> liftIO $ do putStrLn $ "Error while uploading series archive: " ++ e
if debug then do putStrLn $ "Not deleting temporary directory: " ++ tempDir
putStrLn $ "Not deleting links directory: " ++ linksDir'
else do putStrLn $ "Deleting temporary directory: " ++ tempDir
removeRecursiveSafely tempDir
putStrLn $ "Deleting links directory: " ++ linksDir'
removeRecursiveSafely linksDir'
liftIO $ print zipfile'
(A.Success (A.Error expError, _ )) -> liftIO $ putStrLn $ "Error when creating experiment: " ++ expError
(A.Success (_, A.Error dsError)) -> liftIO $ putStrLn $ "Error when creating dataset: " ++ dsError
(A.Error e) -> liftIO $ putStrLn $ "Error in uploadDicomAsMincOneGroup: " ++ e
liftIO $ print "blaaah: exiting"
-}
| 13,110
|
uploadDicomAction opts origDir = do
liftIO $ print "uploadDicomAction: entering."
{-
debug <- mytardisDebug <$> ask
cwd <- liftIO getCurrentDirectory
let slashToUnderscore = map (\c -> if c == '/' then '_' else c)
let fp = cwd </> (slashToUnderscore $ "state_" ++ optConfigFile opts)
liftIO $ createDirectoryIfMissing True fp
conf <- ask
acidMVar <- liftIO $ newEmptyMVar
experimentMVar <- liftIO $ newEmptyMVar
datasetMVar <- liftIO $ newEmptyMVar
groupMVar <- liftIO $ newEmptyMVar
-- FIXME Would be nicer if we could avoid the runReaderT stuff here?
asyncAcidWorker <- liftIO $ async $ acidWorker acidMVar
asyncWorkerCreateExperiment <- liftIO $ async $ runReaderT (workerCreateExperiment experimentMVar) conf
asyncWorkerCreateDataset <- liftIO $ async $ runReaderT (workerCreateDataset datasetMVar) conf
asyncWorkerCreateGroup <- liftIO $ async $ runReaderT (workerCreateGroup groupMVar) conf
instrumentConfigs <- liftIO $ readInstrumentConfigs (optConfigFile opts)
tasks <- concat <$> forM instrumentConfigs (makeTasks conf debug fp acidMVar experimentMVar datasetMVar groupMVar)
liftIO $ putStrLn $ "uploadDicomAction: found " ++ show (length tasks) ++ " tasks to process."
-- FIXME Add an ID to the config so that logging has a task ID.
liftIO $ withPool 15 $ \pool -> parallel_ pool tasks
pollExperiment <- liftIO $ poll asyncWorkerCreateExperiment
pollDataset <- liftIO $ poll asyncWorkerCreateDataset
pollGroup <- liftIO $ poll asyncWorkerCreateGroup
pollAcid <- liftIO $ poll asyncAcidWorker
liftIO $ putStrLn $ "poll pollExperiment: " ++ show pollExperiment
liftIO $ putStrLn $ "poll pollDataset: " ++ show pollDataset
liftIO $ putStrLn $ "poll pollGroup: " ++ show (pollGroup :: Maybe (Either SomeException ()))
liftIO $ putStrLn $ "poll pollAcid: " ++ show (pollAcid :: Maybe (Either SomeException ()))
liftIO $ print "uploadDicomAction: exiting."
-}
{-
makeTasks conf debug fp acidMVar experimentMVar datasetMVar groupMVar iconfig = do
let ( instrumentName, instrumentFilters, instrumentFiltersT, instrumentMetadataFields, experimentFields, datasetFields, schemaExperiment, schemaDataset, schemaDicomFile, defaultInstitutionName, defaultInstitutionalDepartmentName, defaultInstitutionalAddress, defaultOperators) = iconfig
liftIO $ putStrLn ""
liftIO $ putStrLn ""
liftIO $ putStrLn $ "Instrument: " ++ instrumentName
liftIO $ putStrLn ""
_ogroups <- getOrthancInstrumentGroups instrumentFiltersT <$> majorOrthancGroups
-- Timezone:
ZonedTime _ tz <- liftIO getZonedTime
case _ogroups of Left err -> undefined
Right ogroups -> do
let -- Times that available *series* have been updated:
updatedTimes = map (\(_, _, s, _, _) -> (getSeriesLastUpdate tz s)) ogroups :: [Maybe ZonedTime]
-- Hash of each:
hashes = map (\(patient, study, series, _, _) -> getHashes (patient, study, series)) ogroups
-- Together:
hashAndLastUpdated = zip hashes updatedTimes
liftIO $ putStrLn $ "|hashAndLastUpdated| = " ++ show (length hashAndLastUpdated)
recentOgroups <- liftIO $ patientsToProcess acidMVar fp ogroups hashAndLastUpdated
liftIO $ putStrLn $ "Experiments that are recent enough for us to process: " ++ show recentOgroups
liftIO $ getZonedTime >>= print
let fn = \og -> runReaderT (blaaah acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields og) conf
return $ map fn recentOgroups
blaaah acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields (patient, study, series, oneInstance, tags) = do
here <- liftIO getZonedTime
liftIO $ print ("blaaah", "entering at time", here, opID patient, ostudyID study, oseriesID series)
-- Before we get the archive, check if the Referring Physician is there so that we can get a project ID.
let projectID = join $ tagValue <$> otagReferringPhysicianName tags
case is5digits <$> projectID of
Nothing -> liftIO $ putStrLn $ "Error: could not read Referring Physician Name from " ++ opID patient ++ " " ++ ostudyID study ++ " " ++ oseriesID series
Just False -> liftIO $ putStrLn $ "Error: invalid project ID: \"" ++ (fromJust projectID) ++ "\" from " ++ opID patient ++ " " ++ ostudyID study ++ " " ++ oseriesID series
Just True -> blaaah' acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields (patient, study, series, oneInstance, tags)
blaaah' acidMVar experimentMVar datasetMVar groupMVar debug tz fp schemaExperiment schemaDataset schemaDicomFile defaultInstitutionName defaultInstitutionalDepartmentName defaultInstitutionalAddress defaultOperators instrumentFilters instrumentMetadataFields experimentFields datasetFields (patient, study, series, oneInstance, tags) = do
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "getting series archive.... " ++ oseriesID series
archive <- getSeriesArchive $ oseriesID series
liftIO $ putStrLn $ "finished getting series archive.... " ++ oseriesID series
case archive of
Left e -> liftIO $ putStrLn $ "Error: could not get series archive " ++ oseriesID series ++ "; failed with error: " ++ e
Right (tempDir, zipfile) -> do
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "got series archive."
liftIO $ print (tempDir, zipfile)
tmp <- mytardisTmp <$> ask
linksDir <- liftIO $ unpackArchive tmp tempDir zipfile
case linksDir of
Left linksErr -> liftIO $ putStrLn $ "blaaah: error unpacking archive: " ++ linksErr
Right linksDir' -> do
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "dostuff: linksDir: " ++ linksDir'
createProjectGroup groupMVar linksDir'
rawDicomFiles <- liftIO $ getDicomFilesInDirectory ".dcm" linksDir'
anonymizationResults <- liftIO $ forM rawDicomFiles anonymizeDicomFile
if length (lefts anonymizationResults) > 0
then liftIO $ putStrLn $ "Errors while anonymizing DICOM files: " ++ show (lefts anonymizationResults)
else do files <- liftIO $ rights <$> (getDicomFilesInDirectory ".dcm" linksDir' >>= mapM readDicomMetadata)
liftIO $ getZonedTime >>= print
liftIO $ putStrLn $ "calling uploadDicomAsMincOneGroup..."
oneGroupResult <- uploadDicomAsMincOneGroup
experimentMVar
datasetMVar
files
instrumentFilters
instrumentMetadataFields
experimentFields
datasetFields
identifyExperiment
identifyDataset
identifyDatasetFile
linksDir'
( schemaExperiment
, schemaDataset
, schemaDicomFile
, defaultInstitutionName
, defaultInstitutionalDepartmentName
, defaultInstitutionalAddress
, defaultOperators)
let schemaFile = schemaDicomFile -- FIXME
case oneGroupResult of
(A.Success (A.Success restExperiment, A.Success restDataset)) -> do
zipfile' <- uploadFileBasic schemaFile identifyDatasetFile restDataset zipfile [] -- FIXME add some metadata
case zipfile' of
A.Success zipfile'' -> liftIO $ do putStrLn $ "Successfully uploaded: " ++ show zipfile''
putStrLn $ "Deleting temporary directory: " ++ tempDir
removeRecursiveSafely tempDir
putStrLn $ "Deleting links directory: " ++ linksDir'
removeRecursiveSafely linksDir'
putStrLn $ "Updating last updated: " ++ show (fp, opID patient, getSeriesLastUpdate tz series)
-- updateLastUpdate fp (getHashes (patient, study, series)) (getSeriesLastUpdate tz series)
_ <- callWorkerIO acidMVar (AcidUpdateMap fp (getHashes (patient, study, series)) (getSeriesLastUpdate tz series))
putStrLn $ "Updated last update."
A.Error e -> liftIO $ do putStrLn $ "Error while uploading series archive: " ++ e
if debug then do putStrLn $ "Not deleting temporary directory: " ++ tempDir
putStrLn $ "Not deleting links directory: " ++ linksDir'
else do putStrLn $ "Deleting temporary directory: " ++ tempDir
removeRecursiveSafely tempDir
putStrLn $ "Deleting links directory: " ++ linksDir'
removeRecursiveSafely linksDir'
liftIO $ print zipfile'
(A.Success (A.Error expError, _ )) -> liftIO $ putStrLn $ "Error when creating experiment: " ++ expError
(A.Success (_, A.Error dsError)) -> liftIO $ putStrLn $ "Error when creating dataset: " ++ dsError
(A.Error e) -> liftIO $ putStrLn $ "Error in uploadDicomAsMincOneGroup: " ++ e
liftIO $ print "blaaah: exiting"
-}
| 13,110
| false
| false
| 0
| 8
| 5,724
| 23
| 11
| 12
| null | null |
ezyang/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
uIntDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UInt")
| 61
|
uIntDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UInt")
| 61
|
uIntDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UInt")
| 61
| false
| false
| 1
| 7
| 8
| 20
| 8
| 12
| null | null |
verement/etamoo
|
src/MOO/Parser.hs
|
bsd-3-clause
|
lexer = T.makeTokenParser mooDef
| 32
|
lexer = T.makeTokenParser mooDef
| 32
|
lexer = T.makeTokenParser mooDef
| 32
| false
| false
| 0
| 6
| 3
| 11
| 5
| 6
| null | null |
cernat-catalin/haskellGame
|
src/GLogger/Client.hs
|
bsd-3-clause
|
logFileName :: String
logFileName = "client.log"
| 48
|
logFileName :: String
logFileName = "client.log"
| 48
|
logFileName = "client.log"
| 26
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
nomeata/list-fusion-lab
|
ListImpls/BaseFrom76.hs
|
bsd-3-clause
|
scanr1 :: (a -> a -> a) -> [a] -> [a]
scanr1 _ [] = []
| 84
|
scanr1 :: (a -> a -> a) -> [a] -> [a]
scanr1 _ [] = []
| 84
|
scanr1 _ [] = []
| 29
| false
| true
| 0
| 9
| 45
| 47
| 24
| 23
| null | null |
MarcusVoelker/Recolang
|
CodeModel/Function.hs
|
mit
|
showStatement _ (IntLiteral l) = show l
| 39
|
showStatement _ (IntLiteral l) = show l
| 39
|
showStatement _ (IntLiteral l) = show l
| 39
| false
| false
| 1
| 6
| 6
| 22
| 9
| 13
| null | null |
seL4/capDL-tool
|
CapDL/PrintXml.hs
|
bsd-2-clause
|
showObjectName IOPT {} = "IOPT"
| 31
|
showObjectName IOPT {} = "IOPT"
| 31
|
showObjectName IOPT {} = "IOPT"
| 31
| false
| false
| 0
| 6
| 4
| 13
| 6
| 7
| null | null |
bennofs/cabal2nix
|
src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs
|
bsd-3-clause
|
sourceFromHackage :: Hash -> String -> IO DerivationSource
sourceFromHackage optHash pkgId = do
cacheFile <- hashCachePath pkgId
cachedHash <-
case optHash of
Certain h -> return . Certain $ h
Guess h -> return . Guess $ h
_ -> fmap (maybe UnknownHash Certain) . readFileMay $ cacheFile
let url = "mirror://hackage/" ++ pkgId ++ ".tar.gz"
-- Use the cached hash (either from cache file or given on cmdline via sha256 opt)
-- if available, otherwise download from hackage to compute hash.
case cachedHash of
Guess hash -> return $ DerivationSource "url" url "" hash
Certain hash ->
-- We need to force the hash here. If we didn't do this, then when reading the
-- hash from the cache file, the cache file will still be open for reading
-- (because lazy io) when writeFile opens the file again for writing. By forcing
-- the hash here, we ensure that the file is closed before opening it again.
seq (length hash) $
DerivationSource "url" url "" hash <$ writeFile cacheFile hash
UnknownHash -> do
maybeHash <- runMaybeT (derivHash . fst <$> fetchWith (False, "url", []) (Source url "" UnknownHash))
case maybeHash of
Just hash ->
seq (length hash) $
DerivationSource "url" url "" hash <$ writeFile cacheFile hash
Nothing -> do
hPutStr stderr $ unlines
[ "*** cannot compute hash. (Not a hackage project?)"
, " If your project is not on hackage, please supply the path to the root directory of"
, " the project, not to the cabal file."
, ""
, " If your project is on hackage but you still want to specify the hash manually, you"
, " can use the --sha256 option."
]
exitFailure
| 1,817
|
sourceFromHackage :: Hash -> String -> IO DerivationSource
sourceFromHackage optHash pkgId = do
cacheFile <- hashCachePath pkgId
cachedHash <-
case optHash of
Certain h -> return . Certain $ h
Guess h -> return . Guess $ h
_ -> fmap (maybe UnknownHash Certain) . readFileMay $ cacheFile
let url = "mirror://hackage/" ++ pkgId ++ ".tar.gz"
-- Use the cached hash (either from cache file or given on cmdline via sha256 opt)
-- if available, otherwise download from hackage to compute hash.
case cachedHash of
Guess hash -> return $ DerivationSource "url" url "" hash
Certain hash ->
-- We need to force the hash here. If we didn't do this, then when reading the
-- hash from the cache file, the cache file will still be open for reading
-- (because lazy io) when writeFile opens the file again for writing. By forcing
-- the hash here, we ensure that the file is closed before opening it again.
seq (length hash) $
DerivationSource "url" url "" hash <$ writeFile cacheFile hash
UnknownHash -> do
maybeHash <- runMaybeT (derivHash . fst <$> fetchWith (False, "url", []) (Source url "" UnknownHash))
case maybeHash of
Just hash ->
seq (length hash) $
DerivationSource "url" url "" hash <$ writeFile cacheFile hash
Nothing -> do
hPutStr stderr $ unlines
[ "*** cannot compute hash. (Not a hackage project?)"
, " If your project is not on hackage, please supply the path to the root directory of"
, " the project, not to the cabal file."
, ""
, " If your project is on hackage but you still want to specify the hash manually, you"
, " can use the --sha256 option."
]
exitFailure
| 1,817
|
sourceFromHackage optHash pkgId = do
cacheFile <- hashCachePath pkgId
cachedHash <-
case optHash of
Certain h -> return . Certain $ h
Guess h -> return . Guess $ h
_ -> fmap (maybe UnknownHash Certain) . readFileMay $ cacheFile
let url = "mirror://hackage/" ++ pkgId ++ ".tar.gz"
-- Use the cached hash (either from cache file or given on cmdline via sha256 opt)
-- if available, otherwise download from hackage to compute hash.
case cachedHash of
Guess hash -> return $ DerivationSource "url" url "" hash
Certain hash ->
-- We need to force the hash here. If we didn't do this, then when reading the
-- hash from the cache file, the cache file will still be open for reading
-- (because lazy io) when writeFile opens the file again for writing. By forcing
-- the hash here, we ensure that the file is closed before opening it again.
seq (length hash) $
DerivationSource "url" url "" hash <$ writeFile cacheFile hash
UnknownHash -> do
maybeHash <- runMaybeT (derivHash . fst <$> fetchWith (False, "url", []) (Source url "" UnknownHash))
case maybeHash of
Just hash ->
seq (length hash) $
DerivationSource "url" url "" hash <$ writeFile cacheFile hash
Nothing -> do
hPutStr stderr $ unlines
[ "*** cannot compute hash. (Not a hackage project?)"
, " If your project is not on hackage, please supply the path to the root directory of"
, " the project, not to the cabal file."
, ""
, " If your project is on hackage but you still want to specify the hash manually, you"
, " can use the --sha256 option."
]
exitFailure
| 1,758
| false
| true
| 0
| 19
| 525
| 344
| 165
| 179
| null | null |
mrakgr/futhark
|
src/Futhark/TypeCheck.hs
|
bsd-3-clause
|
checkCmpOp :: Checkable lore =>
CmpOp -> SubExp -> SubExp
-> TypeM lore ()
checkCmpOp (CmpEq t) x y = do
require [Prim t] x
require [Prim t] y
matchSubExpTypes x y
| 194
|
checkCmpOp :: Checkable lore =>
CmpOp -> SubExp -> SubExp
-> TypeM lore ()
checkCmpOp (CmpEq t) x y = do
require [Prim t] x
require [Prim t] y
matchSubExpTypes x y
| 194
|
checkCmpOp (CmpEq t) x y = do
require [Prim t] x
require [Prim t] y
matchSubExpTypes x y
| 94
| false
| true
| 0
| 10
| 62
| 86
| 39
| 47
| null | null |
alistra/data-structure-inferrer
|
C/Analyzer.hs
|
mit
|
analyzeCExtDecl :: CExtDecl -> TermAnalyzer (Either Output (DSFun CTypeSpec)) --TODO add global variables here
analyzeCExtDecl (CDeclExt decl) = Left `fmap` analyzeCDecl decl
| 183
|
analyzeCExtDecl :: CExtDecl -> TermAnalyzer (Either Output (DSFun CTypeSpec))
analyzeCExtDecl (CDeclExt decl) = Left `fmap` analyzeCDecl decl
| 150
|
analyzeCExtDecl (CDeclExt decl) = Left `fmap` analyzeCDecl decl
| 72
| true
| true
| 0
| 10
| 30
| 51
| 26
| 25
| null | null |
glutamate/probably-base
|
Math/Probably/RandIO.hs
|
bsd-3-clause
|
update :: IORef a -> (a->Prob a) -> RIO ()
update rf sm = do
x <- io $ readIORef rf
newx <- sample $ sm x
io $ writeIORef rf newx
| 135
|
update :: IORef a -> (a->Prob a) -> RIO ()
update rf sm = do
x <- io $ readIORef rf
newx <- sample $ sm x
io $ writeIORef rf newx
| 135
|
update rf sm = do
x <- io $ readIORef rf
newx <- sample $ sm x
io $ writeIORef rf newx
| 92
| false
| true
| 0
| 10
| 37
| 87
| 38
| 49
| null | null |
rrnewton/accelerate
|
Data/Array/Accelerate/Smart.hs
|
bsd-3-clause
|
-- Smart constructor and destructors for scalar tuples
--
tup2 :: (Elt a, Elt b) => (Exp a, Exp b) -> Exp (a, b)
tup2 (a, b) = Exp $ Tuple (NilTup `SnocTup` a `SnocTup` b)
| 171
|
tup2 :: (Elt a, Elt b) => (Exp a, Exp b) -> Exp (a, b)
tup2 (a, b) = Exp $ Tuple (NilTup `SnocTup` a `SnocTup` b)
| 113
|
tup2 (a, b) = Exp $ Tuple (NilTup `SnocTup` a `SnocTup` b)
| 58
| true
| true
| 0
| 9
| 35
| 84
| 47
| 37
| null | null |
ajscholl/primitive-simd
|
Generator.hs
|
bsd-3-clause
|
genPatSynonym :: Bool -> Int -> String
genPatSynonym patSigs n = unlines
["-- | Convenient way to match against and construct " ++ show n ++ "-ary vectors."
,patSigPrefix ++ "pattern Vec" ++ show n ++ " :: (ElemTuple v ~ " ++ tuplT ++ ", SIMDVector v)"
,patSigPrefix ++ " => " ++ targs ++ " v"
,"pattern Vec" ++ show n ++ " " ++ args ++ " <- (unpackVector -> " ++ tuple ++ ") where"
," Vec" ++ show n ++ " " ++ args ++ " = packVector " ++ tuple
]
where
patSigPrefix = if patSigs then "" else "-- "
tuplT, targs, args, tuple :: String
tuplT = tupleType n "a"
targs = concat $ replicate n "a -> "
vars = ['x' : show x | x <- [1..n]]
args = unwords vars
tuple = matchTuple True vars
-- | Generate a function to broadcast a value to all elements of the vector
| 848
|
genPatSynonym :: Bool -> Int -> String
genPatSynonym patSigs n = unlines
["-- | Convenient way to match against and construct " ++ show n ++ "-ary vectors."
,patSigPrefix ++ "pattern Vec" ++ show n ++ " :: (ElemTuple v ~ " ++ tuplT ++ ", SIMDVector v)"
,patSigPrefix ++ " => " ++ targs ++ " v"
,"pattern Vec" ++ show n ++ " " ++ args ++ " <- (unpackVector -> " ++ tuple ++ ") where"
," Vec" ++ show n ++ " " ++ args ++ " = packVector " ++ tuple
]
where
patSigPrefix = if patSigs then "" else "-- "
tuplT, targs, args, tuple :: String
tuplT = tupleType n "a"
targs = concat $ replicate n "a -> "
vars = ['x' : show x | x <- [1..n]]
args = unwords vars
tuple = matchTuple True vars
-- | Generate a function to broadcast a value to all elements of the vector
| 848
|
genPatSynonym patSigs n = unlines
["-- | Convenient way to match against and construct " ++ show n ++ "-ary vectors."
,patSigPrefix ++ "pattern Vec" ++ show n ++ " :: (ElemTuple v ~ " ++ tuplT ++ ", SIMDVector v)"
,patSigPrefix ++ " => " ++ targs ++ " v"
,"pattern Vec" ++ show n ++ " " ++ args ++ " <- (unpackVector -> " ++ tuple ++ ") where"
," Vec" ++ show n ++ " " ++ args ++ " = packVector " ++ tuple
]
where
patSigPrefix = if patSigs then "" else "-- "
tuplT, targs, args, tuple :: String
tuplT = tupleType n "a"
targs = concat $ replicate n "a -> "
vars = ['x' : show x | x <- [1..n]]
args = unwords vars
tuple = matchTuple True vars
-- | Generate a function to broadcast a value to all elements of the vector
| 809
| false
| true
| 0
| 12
| 253
| 236
| 124
| 112
| null | null |
tr00per/roguelike0
|
app/Game/Keymap.hs
|
bsd-2-clause
|
kmap _ = Meta NoAction
| 59
|
kmap _ = Meta NoAction
| 59
|
kmap _ = Meta NoAction
| 59
| false
| false
| 0
| 5
| 41
| 13
| 5
| 8
| null | null |
tjakway/ghcjvm
|
compiler/nativeGen/SPARC/Ppr.hs
|
bsd-3-clause
|
pprInstr (UMUL b reg1 ri reg2) = pprRegRIReg (sLit "umul") b reg1 ri reg2
| 74
|
pprInstr (UMUL b reg1 ri reg2) = pprRegRIReg (sLit "umul") b reg1 ri reg2
| 74
|
pprInstr (UMUL b reg1 ri reg2) = pprRegRIReg (sLit "umul") b reg1 ri reg2
| 74
| false
| false
| 0
| 7
| 14
| 38
| 18
| 20
| null | null |
wolftune/hoogle
|
src/General/Web.hs
|
bsd-3-clause
|
readInput :: String -> Input
readInput (breakOn "?" -> (a,b)) = Input (dropWhile null $ splitOn "/" a) $
map (second (unEscapeString . drop1) . breakOn "=") $ splitOn "&" $ drop1 b
| 184
|
readInput :: String -> Input
readInput (breakOn "?" -> (a,b)) = Input (dropWhile null $ splitOn "/" a) $
map (second (unEscapeString . drop1) . breakOn "=") $ splitOn "&" $ drop1 b
| 184
|
readInput (breakOn "?" -> (a,b)) = Input (dropWhile null $ splitOn "/" a) $
map (second (unEscapeString . drop1) . breakOn "=") $ splitOn "&" $ drop1 b
| 155
| false
| true
| 0
| 11
| 36
| 98
| 46
| 52
| null | null |
acamino/state-codes
|
src/Data/StateCodes/ISO31662US.hs
|
mit
|
toName DC = "District of Columbia"
| 34
|
toName DC = "District of Columbia"
| 34
|
toName DC = "District of Columbia"
| 34
| false
| false
| 0
| 5
| 5
| 9
| 4
| 5
| null | null |
jacekszymanski/wxHaskell
|
wx/src/Graphics/UI/WX/Controls.hs
|
lgpl-2.1
|
-- | Create an image list containing the images in the supplied file name list
-- that will be scaled towards the desired size.
imageListFromFiles :: Size -> [FilePath] -> IO (ImageList ())
imageListFromFiles size files
= do images <- imageListCreate size True (length files)
imageListAddIconsFromFiles images size files
return images
{--------------------------------------------------------------------------------
MediaCtrl
--------------------------------------------------------------------------------}
-- | Optional backend for your MediaCtrl.
-- If you want to know more about backend, you must see wxWidgets' document:
-- <http://docs.wxwidgets.org/trunk/classwx_media_ctrl.html#mediactrl_choosing_backend>
| 739
|
imageListFromFiles :: Size -> [FilePath] -> IO (ImageList ())
imageListFromFiles size files
= do images <- imageListCreate size True (length files)
imageListAddIconsFromFiles images size files
return images
{--------------------------------------------------------------------------------
MediaCtrl
--------------------------------------------------------------------------------}
-- | Optional backend for your MediaCtrl.
-- If you want to know more about backend, you must see wxWidgets' document:
-- <http://docs.wxwidgets.org/trunk/classwx_media_ctrl.html#mediactrl_choosing_backend>
| 611
|
imageListFromFiles size files
= do images <- imageListCreate size True (length files)
imageListAddIconsFromFiles images size files
return images
{--------------------------------------------------------------------------------
MediaCtrl
--------------------------------------------------------------------------------}
-- | Optional backend for your MediaCtrl.
-- If you want to know more about backend, you must see wxWidgets' document:
-- <http://docs.wxwidgets.org/trunk/classwx_media_ctrl.html#mediactrl_choosing_backend>
| 549
| true
| true
| 0
| 10
| 100
| 80
| 40
| 40
| null | null |
kiloecho7/squid
|
parse_data_clean.hs
|
bsd-3-clause
|
encodeCat :: String -> [Int]
encodeCat "Left" = [1, 0, 0]
| 59
|
encodeCat :: String -> [Int]
encodeCat "Left" = [1, 0, 0]
| 59
|
encodeCat "Left" = [1, 0, 0]
| 30
| false
| true
| 0
| 6
| 12
| 30
| 17
| 13
| null | null |
agocorona/MFlow
|
src/MFlow/Forms.hs
|
bsd-3-clause
|
-- | Flatten a binary tree of tuples of Maybe results produced by the \<+> operator
-- into a single tuple with the same elements in the same order.
-- This is useful for easing matching. For example:
--
-- @ res \<- ask $ wlink1 \<+> wlink2 wform \<+> wlink3 \<+> wlink4@
--
-- @res@ has type:
--
-- @Maybe (Maybe (Maybe (Maybe (Maybe a,Maybe b),Maybe c),Maybe d),Maybe e)@
--
-- but @flatten res@ has type:
--
-- @ (Maybe a, Maybe b, Maybe c, Maybe d, Maybe e)@
flatten :: Flatten (Maybe tree) list => tree -> list
flatten res= doflat $ Just res
| 549
|
flatten :: Flatten (Maybe tree) list => tree -> list
flatten res= doflat $ Just res
| 83
|
flatten res= doflat $ Just res
| 30
| true
| true
| 0
| 8
| 107
| 53
| 32
| 21
| null | null |
ghcjs/ghcjs
|
src/Compiler/GhcjsHooks.hs
|
mit
|
runGhcjsPhase _ _ (RealPhase ph) input _dflags
| Just next <- lookup ph skipPhases = do
output <- phaseOutputFilename next
liftIO $ (createDirectoryIfMissing True (takeDirectory output) >>
copyFile input output)
`catchIOError` \_ -> return ()
return (RealPhase next, output)
where
skipPhases = [ (HCc, As False)
, (CmmCpp, Cmm)
, (Cmm, As False)
, (Cmm, As True)
, (As False, StopLn)
, (As True, StopLn)
]
-- otherwise use default
| 583
|
runGhcjsPhase _ _ (RealPhase ph) input _dflags
| Just next <- lookup ph skipPhases = do
output <- phaseOutputFilename next
liftIO $ (createDirectoryIfMissing True (takeDirectory output) >>
copyFile input output)
`catchIOError` \_ -> return ()
return (RealPhase next, output)
where
skipPhases = [ (HCc, As False)
, (CmmCpp, Cmm)
, (Cmm, As False)
, (Cmm, As True)
, (As False, StopLn)
, (As True, StopLn)
]
-- otherwise use default
| 583
|
runGhcjsPhase _ _ (RealPhase ph) input _dflags
| Just next <- lookup ph skipPhases = do
output <- phaseOutputFilename next
liftIO $ (createDirectoryIfMissing True (takeDirectory output) >>
copyFile input output)
`catchIOError` \_ -> return ()
return (RealPhase next, output)
where
skipPhases = [ (HCc, As False)
, (CmmCpp, Cmm)
, (Cmm, As False)
, (Cmm, As True)
, (As False, StopLn)
, (As True, StopLn)
]
-- otherwise use default
| 583
| false
| false
| 0
| 14
| 222
| 190
| 98
| 92
| null | null |
mgsloan/language-typescript
|
src/Language/TypeScript/Pretty.hs
|
mit
|
objectType :: TypeBody -> Doc
objectType = braces . typeBody
| 60
|
objectType :: TypeBody -> Doc
objectType = braces . typeBody
| 60
|
objectType = braces . typeBody
| 30
| false
| true
| 0
| 5
| 9
| 19
| 10
| 9
| null | null |
christiaanb/ghc
|
utils/genprimopcode/Main.hs
|
bsd-3-clause
|
tyconsIn :: Ty -> [TyCon]
tyconsIn (TyF t1 t2) = tyconsIn t1 `union` tyconsIn t2
| 83
|
tyconsIn :: Ty -> [TyCon]
tyconsIn (TyF t1 t2) = tyconsIn t1 `union` tyconsIn t2
| 83
|
tyconsIn (TyF t1 t2) = tyconsIn t1 `union` tyconsIn t2
| 57
| false
| true
| 0
| 7
| 17
| 41
| 21
| 20
| null | null |
mumuki/mulang
|
spec/ExpectationsAnalyzerSpec.hs
|
gpl-3.0
|
run language content expectations = analyse (expectationsAnalysis (CodeSample language content) expectations)
| 109
|
run language content expectations = analyse (expectationsAnalysis (CodeSample language content) expectations)
| 109
|
run language content expectations = analyse (expectationsAnalysis (CodeSample language content) expectations)
| 109
| false
| false
| 0
| 9
| 10
| 32
| 15
| 17
| null | null |
haroldcarr/learn-haskell-coq-ml-etc
|
haskell/topic/general/wiki-haskell-org-99-questions/X99Questions.hs
|
unlicense
|
pack (h:t) = pack' [[h]] t
where pack' acc [] = myReverse acc -- TODO: do version with reverse
pack' acc@(cx@(c:_):t) (x:xs) = if c == x then pack' ((x:cx):t) xs
else pack' ([x]:acc) xs
| 269
|
pack (h:t) = pack' [[h]] t
where pack' acc [] = myReverse acc -- TODO: do version with reverse
pack' acc@(cx@(c:_):t) (x:xs) = if c == x then pack' ((x:cx):t) xs
else pack' ([x]:acc) xs
| 269
|
pack (h:t) = pack' [[h]] t
where pack' acc [] = myReverse acc -- TODO: do version with reverse
pack' acc@(cx@(c:_):t) (x:xs) = if c == x then pack' ((x:cx):t) xs
else pack' ([x]:acc) xs
| 269
| false
| false
| 0
| 11
| 118
| 130
| 69
| 61
| null | null |
phischu/fragnix
|
tests/packages/scotty/System.FilePath.Posix.hs
|
bsd-3-clause
|
hasLeadingPathSeparator :: FilePath -> Bool
hasLeadingPathSeparator "" = False
| 78
|
hasLeadingPathSeparator :: FilePath -> Bool
hasLeadingPathSeparator "" = False
| 78
|
hasLeadingPathSeparator "" = False
| 34
| false
| true
| 0
| 5
| 8
| 18
| 9
| 9
| null | null |
erikd/wai
|
warp/Network/Wai/Handler/Warp/HTTP2/File.hs
|
mit
|
ifUnmodifiedSince :: ValueTable -> Maybe HTTPDate
ifUnmodifiedSince reqtbl = getHeaderValue tokenIfUnmodifiedSince reqtbl >>= parseHTTPDate
| 139
|
ifUnmodifiedSince :: ValueTable -> Maybe HTTPDate
ifUnmodifiedSince reqtbl = getHeaderValue tokenIfUnmodifiedSince reqtbl >>= parseHTTPDate
| 139
|
ifUnmodifiedSince reqtbl = getHeaderValue tokenIfUnmodifiedSince reqtbl >>= parseHTTPDate
| 89
| false
| true
| 0
| 6
| 13
| 30
| 14
| 16
| null | null |
amirci/aoc2016-hs
|
src/Day7.hs
|
bsd-3-clause
|
fromRight (Right s) = s
| 23
|
fromRight (Right s) = s
| 23
|
fromRight (Right s) = s
| 23
| false
| false
| 0
| 6
| 4
| 16
| 7
| 9
| null | null |
infotroph/pandoc
|
src/Text/Pandoc/Readers/Org/Blocks.hs
|
gpl-2.0
|
bulletListStart' (Just n) = do count (n-1) spaceChar
oneOf (bullets $ n == 1)
many1 spaceChar
return n
-- Unindented lists are legal, but they can't use '*' bullets.
-- We return n to maintain compatibility with the generic listItem.
| 327
|
bulletListStart' (Just n) = do count (n-1) spaceChar
oneOf (bullets $ n == 1)
many1 spaceChar
return n
-- Unindented lists are legal, but they can't use '*' bullets.
-- We return n to maintain compatibility with the generic listItem.
| 327
|
bulletListStart' (Just n) = do count (n-1) spaceChar
oneOf (bullets $ n == 1)
many1 spaceChar
return n
-- Unindented lists are legal, but they can't use '*' bullets.
-- We return n to maintain compatibility with the generic listItem.
| 327
| false
| false
| 0
| 10
| 133
| 61
| 28
| 33
| null | null |
hydrogen-tools/hydrogen-parsing
|
src/Hydrogen/Parsing.hs
|
mit
|
(>+>) :: Parser a b -> Parser b c -> Parser a c
p1 >+> p2 = join <$> fmap p2 <$> p1
| 83
|
(>+>) :: Parser a b -> Parser b c -> Parser a c
p1 >+> p2 = join <$> fmap p2 <$> p1
| 83
|
p1 >+> p2 = join <$> fmap p2 <$> p1
| 35
| false
| true
| 2
| 9
| 22
| 58
| 26
| 32
| null | null |
xunilrj/sandbox
|
sources/haskell/papers/4247eaf5-fcf0-483d-adc0-38c29c2cad00.hs
|
apache-2.0
|
-- same thing with the default haskell operator
i5 = 1 & f
| 62
|
i5 = 1 & f
| 10
|
i5 = 1 & f
| 10
| true
| false
| 1
| 5
| 16
| 14
| 6
| 8
| null | null |
bjornars/HaskellGame
|
src/Types.hs
|
bsd-3-clause
|
hurtActor :: (ActorData, Integer) -> ActorP ()
hurtActor = singleton . HurtActor
| 80
|
hurtActor :: (ActorData, Integer) -> ActorP ()
hurtActor = singleton . HurtActor
| 80
|
hurtActor = singleton . HurtActor
| 33
| false
| true
| 0
| 7
| 11
| 30
| 16
| 14
| null | null |
seliopou/webbits
|
src/BrownPLT/JavaScript/Environment.hs
|
bsd-3-clause
|
forInit :: ForInit SourcePos -> Partial
forInit fi = case fi of
NoInit -> empty
VarInit ds -> unions $ map varDecl ds
ExprInit e -> expr e
| 145
|
forInit :: ForInit SourcePos -> Partial
forInit fi = case fi of
NoInit -> empty
VarInit ds -> unions $ map varDecl ds
ExprInit e -> expr e
| 145
|
forInit fi = case fi of
NoInit -> empty
VarInit ds -> unions $ map varDecl ds
ExprInit e -> expr e
| 105
| false
| true
| 4
| 6
| 34
| 49
| 24
| 25
| null | null |
mzini/hosa
|
src/HoSA/SizeType/Infer.hs
|
mit
|
soSubType (SzArr n p) = SzArr <$> soSuperType n <*> soSubType p
| 68
|
soSubType (SzArr n p) = SzArr <$> soSuperType n <*> soSubType p
| 68
|
soSubType (SzArr n p) = SzArr <$> soSuperType n <*> soSubType p
| 68
| false
| false
| 0
| 7
| 16
| 31
| 14
| 17
| null | null |
eklinkhammer/robot-vision
|
src/main.hs
|
mit
|
toIndexList :: (Ord a, Unbox a, Num a) => Image a -> [(a,Int)]
toIndexList img = Prelude.zip (toList img) [1..]
| 111
|
toIndexList :: (Ord a, Unbox a, Num a) => Image a -> [(a,Int)]
toIndexList img = Prelude.zip (toList img) [1..]
| 111
|
toIndexList img = Prelude.zip (toList img) [1..]
| 48
| false
| true
| 0
| 10
| 19
| 72
| 36
| 36
| null | null |
ku-fpg/kansas-amber
|
tests/TransTests/TransFuncTestE.hs
|
bsd-3-clause
|
transTestProg3E :: Arduino (Expr ())
transTestProg3E = do
setPinModeE 13 OUTPUT
setPinModeE 2 INPUT
setPinModeE 3 INPUT
loopE $ do
a <- myRead3E 2
b <- myRead3E 3
myWriteE 13 (a ||* b)
delayMillisE 1000
| 250
|
transTestProg3E :: Arduino (Expr ())
transTestProg3E = do
setPinModeE 13 OUTPUT
setPinModeE 2 INPUT
setPinModeE 3 INPUT
loopE $ do
a <- myRead3E 2
b <- myRead3E 3
myWriteE 13 (a ||* b)
delayMillisE 1000
| 250
|
transTestProg3E = do
setPinModeE 13 OUTPUT
setPinModeE 2 INPUT
setPinModeE 3 INPUT
loopE $ do
a <- myRead3E 2
b <- myRead3E 3
myWriteE 13 (a ||* b)
delayMillisE 1000
| 213
| false
| true
| 0
| 12
| 82
| 94
| 40
| 54
| null | null |
lorenzojlamas/ejercicios
|
6.hs
|
gpl-3.0
|
enIngles 6 = "six"
| 18
|
enIngles 6 = "six"
| 18
|
enIngles 6 = "six"
| 18
| false
| false
| 1
| 5
| 3
| 13
| 4
| 9
| null | null |
mariefarrell/Hets
|
Haskell/test/HOL/Map2.hs
|
gpl-2.0
|
map2 :: (a -> b) -> [a] -> [b]
map2 f l = case l of
[] -> []
x : xs -> f x : map2 f xs
| 114
|
map2 :: (a -> b) -> [a] -> [b]
map2 f l = case l of
[] -> []
x : xs -> f x : map2 f xs
| 114
|
map2 f l = case l of
[] -> []
x : xs -> f x : map2 f xs
| 83
| false
| true
| 0
| 9
| 56
| 77
| 38
| 39
| null | null |
solorab/proof-haskell
|
Control/Proof/Linear.hs
|
mit
|
consumeImplyHypothesis :: (Member Prove r, Member Choose r) => Eff r (Name, (PropS, PropS))
consumeImplyHypothesis = do
(n, p) <- consumeHypothesis
case p of
a `Imply` b -> return (n, (a, b))
_ -> mzero'
| 227
|
consumeImplyHypothesis :: (Member Prove r, Member Choose r) => Eff r (Name, (PropS, PropS))
consumeImplyHypothesis = do
(n, p) <- consumeHypothesis
case p of
a `Imply` b -> return (n, (a, b))
_ -> mzero'
| 227
|
consumeImplyHypothesis = do
(n, p) <- consumeHypothesis
case p of
a `Imply` b -> return (n, (a, b))
_ -> mzero'
| 135
| false
| true
| 0
| 12
| 58
| 100
| 55
| 45
| null | null |
UCSD-PL/RefScript
|
src/Language/Rsc/Visitor.hs
|
bsd-3-clause
|
f <$$> x = T.traverse f x
| 25
|
f <$$> x = T.traverse f x
| 25
|
f <$$> x = T.traverse f x
| 25
| false
| false
| 2
| 6
| 6
| 18
| 8
| 10
| null | null |
mauriciofierrom/cis194-homework
|
homework05/src/Calc.hs
|
mit
|
withVars :: [(String, Integer)]
-> (M.Map String Integer -> Maybe Integer)
-> Maybe Integer
withVars vs exp = exp $ M.fromList vs
| 147
|
withVars :: [(String, Integer)]
-> (M.Map String Integer -> Maybe Integer)
-> Maybe Integer
withVars vs exp = exp $ M.fromList vs
| 147
|
withVars vs exp = exp $ M.fromList vs
| 37
| false
| true
| 0
| 10
| 39
| 62
| 31
| 31
| null | null |
mightymoose/wolunch.com
|
server/dist/build/autogen/Paths_wolunch.hs
|
bsd-3-clause
|
getLibexecDir = catchIO (getEnv "wolunch_libexecdir") (\_ -> return libexecdir)
| 79
|
getLibexecDir = catchIO (getEnv "wolunch_libexecdir") (\_ -> return libexecdir)
| 79
|
getLibexecDir = catchIO (getEnv "wolunch_libexecdir") (\_ -> return libexecdir)
| 79
| false
| false
| 0
| 8
| 8
| 28
| 14
| 14
| null | null |
binesiyu/ifl
|
src/Core/Parser.hs
|
mit
|
pNum :: Parser Int
pNum [] = Left $ ParseError 1 "empty input" "an integer"
| 86
|
pNum :: Parser Int
pNum [] = Left $ ParseError 1 "empty input" "an integer"
| 86
|
pNum [] = Left $ ParseError 1 "empty input" "an integer"
| 67
| false
| true
| 0
| 6
| 25
| 30
| 14
| 16
| null | null |
haroldl/clip
|
Optimize.hs
|
apache-2.0
|
unpackReturn (CondBlock condCases) = [CondBlock $ map handleCondCase condCases]
where handleCondCase (test, block) = (test, returnElimForBlock block)
| 151
|
unpackReturn (CondBlock condCases) = [CondBlock $ map handleCondCase condCases]
where handleCondCase (test, block) = (test, returnElimForBlock block)
| 151
|
unpackReturn (CondBlock condCases) = [CondBlock $ map handleCondCase condCases]
where handleCondCase (test, block) = (test, returnElimForBlock block)
| 151
| false
| false
| 0
| 7
| 18
| 52
| 27
| 25
| null | null |
JustusAdam/schedule-planner
|
src/SchedulePlanner/App.hs
|
lgpl-3.0
|
{-|
Evaluates the transformed json, compiles (useful) error messages, runs the algorithm
and returns a writer of any output created.
-}
reportAndExecute :: MonadWriter Text m => Text -> Bool -> DataFile -> m Text ()
reportAndExecute outputFormat debugMode (DataFile rules lessons)
| isNothing calculated = tell "Calculation failed, no valid schedule possible"
| outputFormat' == "print" = do
tell "\n"
_ <- mapM (printDebug debugMode) rules
tell "\n"
tell "\n"
_ <- mapM (printDebug debugMode) weighted
tell "\n"
tell "Legend:"
_ <- mapM (tell . pack . show . (shortSubject &&& id) ) (Map.keys mlRaw)
tell "\n"
void $ maybe (error "Unexpected missing result") pc calculated
| outputFormat' == "json" =
void $ maybe (error "unexpected missing result") (tell . decodeUtf8 . toStrict . encode . concatMap (Map.elems . unMapSchedule)) calculated
| otherwise = tell "invalid output format"
where
outputFormat' = toLower outputFormat
weighted = weigh rules lessons
mappedLessons@(MappedLessons mlRaw) = mapToSubject weighted
pc = mapM (tell . ("\n\n" ⊕) . formatSchedule)
calculated = calcFromMap mappedLessons
{-|
perform the calculation and print the result to the command line
-}
| 1,302
|
reportAndExecute :: MonadWriter Text m => Text -> Bool -> DataFile -> m Text ()
reportAndExecute outputFormat debugMode (DataFile rules lessons)
| isNothing calculated = tell "Calculation failed, no valid schedule possible"
| outputFormat' == "print" = do
tell "\n"
_ <- mapM (printDebug debugMode) rules
tell "\n"
tell "\n"
_ <- mapM (printDebug debugMode) weighted
tell "\n"
tell "Legend:"
_ <- mapM (tell . pack . show . (shortSubject &&& id) ) (Map.keys mlRaw)
tell "\n"
void $ maybe (error "Unexpected missing result") pc calculated
| outputFormat' == "json" =
void $ maybe (error "unexpected missing result") (tell . decodeUtf8 . toStrict . encode . concatMap (Map.elems . unMapSchedule)) calculated
| otherwise = tell "invalid output format"
where
outputFormat' = toLower outputFormat
weighted = weigh rules lessons
mappedLessons@(MappedLessons mlRaw) = mapToSubject weighted
pc = mapM (tell . ("\n\n" ⊕) . formatSchedule)
calculated = calcFromMap mappedLessons
{-|
perform the calculation and print the result to the command line
-}
| 1,162
|
reportAndExecute outputFormat debugMode (DataFile rules lessons)
| isNothing calculated = tell "Calculation failed, no valid schedule possible"
| outputFormat' == "print" = do
tell "\n"
_ <- mapM (printDebug debugMode) rules
tell "\n"
tell "\n"
_ <- mapM (printDebug debugMode) weighted
tell "\n"
tell "Legend:"
_ <- mapM (tell . pack . show . (shortSubject &&& id) ) (Map.keys mlRaw)
tell "\n"
void $ maybe (error "Unexpected missing result") pc calculated
| outputFormat' == "json" =
void $ maybe (error "unexpected missing result") (tell . decodeUtf8 . toStrict . encode . concatMap (Map.elems . unMapSchedule)) calculated
| otherwise = tell "invalid output format"
where
outputFormat' = toLower outputFormat
weighted = weigh rules lessons
mappedLessons@(MappedLessons mlRaw) = mapToSubject weighted
pc = mapM (tell . ("\n\n" ⊕) . formatSchedule)
calculated = calcFromMap mappedLessons
{-|
perform the calculation and print the result to the command line
-}
| 1,082
| true
| true
| 3
| 13
| 305
| 357
| 167
| 190
| null | null |
izgzhen/hadrian
|
src/Hadrian/Utilities.hs
|
mit
|
-- | Extract a value from a singleton list, or terminate with an error message
-- if the list does not contain exactly one value.
fromSingleton :: String -> [a] -> a
fromSingleton _ [res] = res
| 195
|
fromSingleton :: String -> [a] -> a
fromSingleton _ [res] = res
| 65
|
fromSingleton _ [res] = res
| 29
| true
| true
| 0
| 7
| 38
| 32
| 18
| 14
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.