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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
demhydraz/waffle | src/Backend/Lua/Optimize.hs | bsd-3-clause | foldFunction f@(Function [x] False [Return (Name (Scoped y))]) [e]
| x == y = e
| otherwise = f | 99 | foldFunction f@(Function [x] False [Return (Name (Scoped y))]) [e]
| x == y = e
| otherwise = f | 99 | foldFunction f@(Function [x] False [Return (Name (Scoped y))]) [e]
| x == y = e
| otherwise = f | 99 | false | false | 1 | 14 | 22 | 66 | 33 | 33 | null | null |
rcook/mlutil | ch06-svm/src/Main.hs | mit | main :: IO ()
main = runUtilDemos | 33 | main :: IO ()
main = runUtilDemos | 33 | main = runUtilDemos | 19 | false | true | 0 | 7 | 6 | 22 | 9 | 13 | null | null |
phischu/fragnix | builtins/base/Foreign.C.Error.hs | bsd-3-clause | -- | as 'throwErrnoIf', but retry the 'IO' action when it yields the
-- error code 'eINTR' - this amounts to the standard retry loop for
-- interrupted POSIX system calls.
--
throwErrnoIfRetry :: (a -> Bool) -> String -> IO a -> IO a
throwErrnoIfRetry pred loc f =
do
res <- f
if pred res
then do
err <- getErrno
if err == eINTR
then throwErrnoIfRetry pred loc f
else throwErrno loc
else return res
-- | as 'throwErrnoIfRetry', but additionally if the operation
-- yields the error code 'eAGAIN' or 'eWOULDBLOCK', an alternative
-- action is executed before retrying.
-- | 641 | throwErrnoIfRetry :: (a -> Bool) -> String -> IO a -> IO a
throwErrnoIfRetry pred loc f =
do
res <- f
if pred res
then do
err <- getErrno
if err == eINTR
then throwErrnoIfRetry pred loc f
else throwErrno loc
else return res
-- | as 'throwErrnoIfRetry', but additionally if the operation
-- yields the error code 'eAGAIN' or 'eWOULDBLOCK', an alternative
-- action is executed before retrying.
-- | 466 | throwErrnoIfRetry pred loc f =
do
res <- f
if pred res
then do
err <- getErrno
if err == eINTR
then throwErrnoIfRetry pred loc f
else throwErrno loc
else return res
-- | as 'throwErrnoIfRetry', but additionally if the operation
-- yields the error code 'eAGAIN' or 'eWOULDBLOCK', an alternative
-- action is executed before retrying.
-- | 396 | true | true | 0 | 11 | 173 | 107 | 55 | 52 | null | null |
LeifW/rdf4h | src/Data/RDF/Types.hs | bsd-3-clause | -- Make an absolute URL by returning as is if already an absolute URL and otherwise
-- appending the URL to the given base URL.
mkAbsoluteUrl :: T.Text -> T.Text -> T.Text
mkAbsoluteUrl base url =
if isAbsoluteUri url then url else base `T.append` url | 253 | mkAbsoluteUrl :: T.Text -> T.Text -> T.Text
mkAbsoluteUrl base url =
if isAbsoluteUri url then url else base `T.append` url | 125 | mkAbsoluteUrl base url =
if isAbsoluteUri url then url else base `T.append` url | 81 | true | true | 0 | 7 | 46 | 51 | 28 | 23 | null | null |
yu-i9/HaSC | src/HaSC/Prim/Parser.hs | mit | whiteSpace :: Parser ()
whiteSpace = P.whiteSpace lexer | 55 | whiteSpace :: Parser ()
whiteSpace = P.whiteSpace lexer | 55 | whiteSpace = P.whiteSpace lexer | 31 | false | true | 0 | 6 | 7 | 21 | 10 | 11 | null | null |
mgsloan/ghcjs-jquery | JavaScript/JQuery.hs | mit | setAttr :: Text -> Text -> JQuery -> IO JQuery
setAttr a v = jq_setAttr (toJSString a) (toJSString v) | 101 | setAttr :: Text -> Text -> JQuery -> IO JQuery
setAttr a v = jq_setAttr (toJSString a) (toJSString v) | 101 | setAttr a v = jq_setAttr (toJSString a) (toJSString v) | 54 | false | true | 0 | 8 | 18 | 48 | 23 | 25 | null | null |
akindle/hdlint | Parse/Basics.hs | mit | colon = symbol ":" | 23 | colon = symbol ":" | 23 | colon = symbol ":" | 23 | false | false | 1 | 5 | 8 | 13 | 4 | 9 | null | null |
mzini/qlogic | Qlogic/IntSat.hs | gpl-3.0 | twoComplement :: Eq l => Int -> N.NatFormula l
twoComplement n | n == -1 = [Top]
| n == 0 = [Bot]
| n >= 1 = Bot : N.natToFormula n
| otherwise = Top : (map not $ N.natToFormula $ abs n - 1) | 246 | twoComplement :: Eq l => Int -> N.NatFormula l
twoComplement n | n == -1 = [Top]
| n == 0 = [Bot]
| n >= 1 = Bot : N.natToFormula n
| otherwise = Top : (map not $ N.natToFormula $ abs n - 1) | 246 | twoComplement n | n == -1 = [Top]
| n == 0 = [Bot]
| n >= 1 = Bot : N.natToFormula n
| otherwise = Top : (map not $ N.natToFormula $ abs n - 1) | 199 | false | true | 0 | 11 | 101 | 119 | 56 | 63 | null | null |
rahulmutt/ghcvm | compiler/Eta/BasicTypes/BasicTypes.hs | bsd-3-clause | isDeadOcc :: OccInfo -> Bool
isDeadOcc IAmDead = True | 53 | isDeadOcc :: OccInfo -> Bool
isDeadOcc IAmDead = True | 53 | isDeadOcc IAmDead = True | 24 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
vTurbine/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | pprCLbl (DeadStripPreventer {}) = panic "pprCLbl DeadStripPreventer" | 68 | pprCLbl (DeadStripPreventer {}) = panic "pprCLbl DeadStripPreventer" | 68 | pprCLbl (DeadStripPreventer {}) = panic "pprCLbl DeadStripPreventer" | 68 | false | false | 0 | 6 | 6 | 20 | 9 | 11 | null | null |
chemist/highlighter | src/Text/Highlighter/Lexers/Nasm.hs | bsd-3-clause | preproc' :: TokenMatcher
preproc' =
[ tok "[^;\\n]+" (Arbitrary "Comment" :. Arbitrary "Preproc")
, tokNext ";.*?\\n" (Arbitrary "Comment" :. Arbitrary "Single") Pop
, tokNext "\\n" (Arbitrary "Comment" :. Arbitrary "Preproc") Pop
] | 248 | preproc' :: TokenMatcher
preproc' =
[ tok "[^;\\n]+" (Arbitrary "Comment" :. Arbitrary "Preproc")
, tokNext ";.*?\\n" (Arbitrary "Comment" :. Arbitrary "Single") Pop
, tokNext "\\n" (Arbitrary "Comment" :. Arbitrary "Preproc") Pop
] | 248 | preproc' =
[ tok "[^;\\n]+" (Arbitrary "Comment" :. Arbitrary "Preproc")
, tokNext ";.*?\\n" (Arbitrary "Comment" :. Arbitrary "Single") Pop
, tokNext "\\n" (Arbitrary "Comment" :. Arbitrary "Preproc") Pop
] | 223 | false | true | 0 | 9 | 47 | 78 | 38 | 40 | null | null |
johanneshilden/trombone | Keyman.hs | bsd-3-clause | getConfig :: [Flag] -> FilePath -> String
getConfig [] hd = hd ++ "/.config/trombone/keyman.conf" | 109 | getConfig :: [Flag] -> FilePath -> String
getConfig [] hd = hd ++ "/.config/trombone/keyman.conf" | 109 | getConfig [] hd = hd ++ "/.config/trombone/keyman.conf" | 67 | false | true | 0 | 9 | 25 | 39 | 18 | 21 | null | null |
hemslo/seven-in-seven | haskell/day2/day2.hs | mit | qsortBy f (p:xs) = (qsortBy f [x | x <- xs, f x p == LT]) ++ [p] ++ (qsortBy f [x | x <- xs, f x p /= LT]) | 106 | qsortBy f (p:xs) = (qsortBy f [x | x <- xs, f x p == LT]) ++ [p] ++ (qsortBy f [x | x <- xs, f x p /= LT]) | 106 | qsortBy f (p:xs) = (qsortBy f [x | x <- xs, f x p == LT]) ++ [p] ++ (qsortBy f [x | x <- xs, f x p /= LT]) | 106 | false | false | 0 | 12 | 30 | 93 | 47 | 46 | null | null |
ocramz/sparse-linear-algebra | src/Data/Sparse/Internal/SVector/Mutable.hs | gpl-3.0 | unionWithM_prealloc g z v vm@(SMV nvm vmix vmv) = undefined | 59 | unionWithM_prealloc g z v vm@(SMV nvm vmix vmv) = undefined | 59 | unionWithM_prealloc g z v vm@(SMV nvm vmix vmv) = undefined | 59 | false | false | 0 | 8 | 9 | 28 | 14 | 14 | null | null |
IreneKnapp/qmic | Haskell/Main.hs | mit | accountEmailAddAPIHandler
:: (HTTP.MonadHTTP m) => Map.Map String Dynamic -> m ()
accountEmailAddAPIHandler variables = do
HTTP.httpPutStr $ "Account email add placeholder." | 177 | accountEmailAddAPIHandler
:: (HTTP.MonadHTTP m) => Map.Map String Dynamic -> m ()
accountEmailAddAPIHandler variables = do
HTTP.httpPutStr $ "Account email add placeholder." | 177 | accountEmailAddAPIHandler variables = do
HTTP.httpPutStr $ "Account email add placeholder." | 93 | false | true | 0 | 8 | 24 | 54 | 25 | 29 | null | null |
mprzewie/haspell | src/HspInterpreter.hs | mit | aliasRules :: String -- ^ ID of language - for exaple "pol"
-> IO [AliasRule]
aliasRules lang = do
rlz <- aliasRulesAliased lang
als <- aliases lang
return $ sortRules $ concatMap (unAliasRule als) rlz
-- |Replaces all of occurences of an element of a list with a list of other elements | 347 | aliasRules :: String -- ^ ID of language - for exaple "pol"
-> IO [AliasRule]
aliasRules lang = do
rlz <- aliasRulesAliased lang
als <- aliases lang
return $ sortRules $ concatMap (unAliasRule als) rlz
-- |Replaces all of occurences of an element of a list with a list of other elements | 347 | aliasRules lang = do
rlz <- aliasRulesAliased lang
als <- aliases lang
return $ sortRules $ concatMap (unAliasRule als) rlz
-- |Replaces all of occurences of an element of a list with a list of other elements | 257 | false | true | 0 | 10 | 112 | 68 | 32 | 36 | null | null |
AlbinTheander/oden | src/Oden/Lexer.hs | mit | identifierNoSpace :: Parser String
identifierNoSpace = do
first <- nameFirst
rest <- many nameLetter
return $ first : rest | 128 | identifierNoSpace :: Parser String
identifierNoSpace = do
first <- nameFirst
rest <- many nameLetter
return $ first : rest | 128 | identifierNoSpace = do
first <- nameFirst
rest <- many nameLetter
return $ first : rest | 93 | false | true | 0 | 8 | 24 | 42 | 19 | 23 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 2176 = 2175 | 11 | 2176 = 2175 | 11 | 2176 = 2175 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
mightymoose/liquidhaskell | tests/todo/RedBlack.hs | bsd-3-clause | {-@ insert :: Ord a => a -> RB2Tree a -> RB2Tree a @-}
insert x t = Fork Black d e f
where
Fork _ d e f = ins x t | 131 | insert x t = Fork Black d e f
where
Fork _ d e f = ins x t | 70 | insert x t = Fork Black d e f
where
Fork _ d e f = ins x t | 70 | true | false | 0 | 5 | 50 | 42 | 20 | 22 | null | null |
nadirs/hearts-hs | src/Hearts/Deck.hs | mit | deckInsert :: Ord a => a -> Deck_ a -> Deck_ a
deckInsert c = Deck . S.insert c . unDeck | 88 | deckInsert :: Ord a => a -> Deck_ a -> Deck_ a
deckInsert c = Deck . S.insert c . unDeck | 88 | deckInsert c = Deck . S.insert c . unDeck | 41 | false | true | 0 | 8 | 20 | 48 | 22 | 26 | null | null |
antalsz/hs-to-coq | structural-isomorphism-plugin/src/Text/PrettyPrint/Util.hs | mit | yesNo False = text "No" | 23 | yesNo False = text "No" | 23 | yesNo False = text "No" | 23 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
verement/etamoo | src/MOO/Compiler.hs | bsd-3-clause | fetchVariable :: Id -> MOO Value
fetchVariable var =
maybe (raise E_VARNF) return . HM.lookup var =<< frame variables | 119 | fetchVariable :: Id -> MOO Value
fetchVariable var =
maybe (raise E_VARNF) return . HM.lookup var =<< frame variables | 119 | fetchVariable var =
maybe (raise E_VARNF) return . HM.lookup var =<< frame variables | 86 | false | true | 0 | 9 | 20 | 48 | 22 | 26 | null | null |
pascalpoizat/vecahaskell | test/VecaTests.hs | apache-2.0 | ta3 :: VTA
ta3 = TimedAutomaton
n3
[ Location "_1", Location "_0"
, Location "0", Location "1"]
(Location "0")
[]
[Location "0", Location "1"]
[Clock "0"]
(listDone 2)
[CTReceive a, CTTau]
[
-- regular 0;1(?a)
Edge (Location "0") CTTau [] [] [setDone 2] (Location "_1")
, Edge (Location "_1") (CTReceive a) [] [] [setDone 1] (Location "1")
-- final 1;1
, Edge (Location "1") CTTau [] [] [setDone 2] (Location "_0")
, Edge (Location "_0") CTTau [] [] [setDone 2] (Location "1")
]
[] | 519 | ta3 :: VTA
ta3 = TimedAutomaton
n3
[ Location "_1", Location "_0"
, Location "0", Location "1"]
(Location "0")
[]
[Location "0", Location "1"]
[Clock "0"]
(listDone 2)
[CTReceive a, CTTau]
[
-- regular 0;1(?a)
Edge (Location "0") CTTau [] [] [setDone 2] (Location "_1")
, Edge (Location "_1") (CTReceive a) [] [] [setDone 1] (Location "1")
-- final 1;1
, Edge (Location "1") CTTau [] [] [setDone 2] (Location "_0")
, Edge (Location "_0") CTTau [] [] [setDone 2] (Location "1")
]
[] | 519 | ta3 = TimedAutomaton
n3
[ Location "_1", Location "_0"
, Location "0", Location "1"]
(Location "0")
[]
[Location "0", Location "1"]
[Clock "0"]
(listDone 2)
[CTReceive a, CTTau]
[
-- regular 0;1(?a)
Edge (Location "0") CTTau [] [] [setDone 2] (Location "_1")
, Edge (Location "_1") (CTReceive a) [] [] [setDone 1] (Location "1")
-- final 1;1
, Edge (Location "1") CTTau [] [] [setDone 2] (Location "_0")
, Edge (Location "_0") CTTau [] [] [setDone 2] (Location "1")
]
[] | 508 | false | true | 0 | 8 | 121 | 268 | 131 | 137 | null | null |
rpglover64/lens | src/Language/Haskell/TH/Lens.hs | bsd-3-clause | _LitP :: Prism' Pat Lit
_LitP
= prism remitter reviewer
where
remitter = LitP
reviewer (LitP x) = Right x
reviewer x = Left x | 147 | _LitP :: Prism' Pat Lit
_LitP
= prism remitter reviewer
where
remitter = LitP
reviewer (LitP x) = Right x
reviewer x = Left x | 147 | _LitP
= prism remitter reviewer
where
remitter = LitP
reviewer (LitP x) = Right x
reviewer x = Left x | 123 | false | true | 2 | 7 | 46 | 58 | 27 | 31 | null | null |
sebschrader/programmierung-ss2015 | E01/E01.hs | mit | square (x:xs) = (square1 x) : (square xs) | 41 | square (x:xs) = (square1 x) : (square xs) | 41 | square (x:xs) = (square1 x) : (square xs) | 41 | false | false | 0 | 7 | 7 | 32 | 16 | 16 | null | null |
vincenthz/cryptonite | Crypto/PubKey/EdDSA.hs | bsd-3-clause | -- | Create a public key from a secret key
toPublic :: ( EllipticCurveEdDSA curve
, HashAlgorithm hash
, HashDigestSize hash ~ CurveDigestSize curve
)
=> proxy curve -> hash -> SecretKey curve -> PublicKey curve hash
toPublic prx alg priv =
let p = pointBaseSmul prx (secretScalar prx alg priv)
in pointPublic prx p | 369 | toPublic :: ( EllipticCurveEdDSA curve
, HashAlgorithm hash
, HashDigestSize hash ~ CurveDigestSize curve
)
=> proxy curve -> hash -> SecretKey curve -> PublicKey curve hash
toPublic prx alg priv =
let p = pointBaseSmul prx (secretScalar prx alg priv)
in pointPublic prx p | 326 | toPublic prx alg priv =
let p = pointBaseSmul prx (secretScalar prx alg priv)
in pointPublic prx p | 107 | true | true | 0 | 11 | 108 | 107 | 49 | 58 | null | null |
oldmanmike/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | as_RDRs, bs_RDRs, cs_RDRs :: [RdrName]
as_RDRs = [ mkVarUnqual (mkFastString ("a"++show i)) | i <- [(1::Int) .. ] ] | 123 | as_RDRs, bs_RDRs, cs_RDRs :: [RdrName]
as_RDRs = [ mkVarUnqual (mkFastString ("a"++show i)) | i <- [(1::Int) .. ] ] | 123 | as_RDRs = [ mkVarUnqual (mkFastString ("a"++show i)) | i <- [(1::Int) .. ] ] | 84 | false | true | 2 | 12 | 26 | 63 | 34 | 29 | null | null |
Tener/HaNS | src/Hans/Message/Ip4.hs | bsd-3-clause | getOptions :: Int -> Get [IP4Option]
getOptions len
| len <= 0 = return []
| otherwise = do
o <- get
rest <- getOptions (len - ip4OptionSize o)
return $! (o : rest) | 184 | getOptions :: Int -> Get [IP4Option]
getOptions len
| len <= 0 = return []
| otherwise = do
o <- get
rest <- getOptions (len - ip4OptionSize o)
return $! (o : rest) | 184 | getOptions len
| len <= 0 = return []
| otherwise = do
o <- get
rest <- getOptions (len - ip4OptionSize o)
return $! (o : rest) | 147 | false | true | 1 | 11 | 53 | 88 | 41 | 47 | null | null |
zaxtax/hakaru | haskell/Language/Hakaru/Pretty/Maple.hs | bsd-3-clause | mapleMeasureOp
:: (ABT Term abt, typs ~ UnLCs args, args ~ LCs typs)
=> MeasureOp typs a -> SArgs abt args -> ShowS
mapleMeasureOp Lebesgue = \End -> showString "Lebesgue(-infinity,infinity)" | 216 | mapleMeasureOp
:: (ABT Term abt, typs ~ UnLCs args, args ~ LCs typs)
=> MeasureOp typs a -> SArgs abt args -> ShowS
mapleMeasureOp Lebesgue = \End -> showString "Lebesgue(-infinity,infinity)" | 216 | mapleMeasureOp Lebesgue = \End -> showString "Lebesgue(-infinity,infinity)" | 92 | false | true | 0 | 9 | 54 | 78 | 36 | 42 | null | null |
fizruk/lxc | src/System/LXC/Internal/Container.hs | bsd-3-clause | -- | Thaw a frozen container.
--
-- @True@ on success, else @False@.
unfreeze :: LXC Bool
unfreeze = boolFn p'lxc_container'unfreeze | 132 | unfreeze :: LXC Bool
unfreeze = boolFn p'lxc_container'unfreeze | 63 | unfreeze = boolFn p'lxc_container'unfreeze | 42 | true | true | 0 | 5 | 20 | 20 | 11 | 9 | null | null |
marcellussiegburg/autotool | collection/src/Lambda/Derive2.hs | gpl-2.0 | exampleA0 :: Action
exampleA0 = Rename { from = read "x", to = read "y" } | 73 | exampleA0 :: Action
exampleA0 = Rename { from = read "x", to = read "y" } | 73 | exampleA0 = Rename { from = read "x", to = read "y" } | 53 | false | true | 0 | 8 | 15 | 41 | 19 | 22 | null | null |
winterland1989/stdio | Data/Vector.hs | bsd-3-clause | -- don't dump every literal with this code
bytesFromAddr l addr# = unsafeDupablePerformIO $ do
mba <- newArr l
copyMutablePrimArrayFromPtr mba 0 (Ptr addr#) l
ba <- unsafeFreezePrimArray mba
return (PrimVector ba 0 l) | 233 | bytesFromAddr l addr# = unsafeDupablePerformIO $ do
mba <- newArr l
copyMutablePrimArrayFromPtr mba 0 (Ptr addr#) l
ba <- unsafeFreezePrimArray mba
return (PrimVector ba 0 l) | 190 | bytesFromAddr l addr# = unsafeDupablePerformIO $ do
mba <- newArr l
copyMutablePrimArrayFromPtr mba 0 (Ptr addr#) l
ba <- unsafeFreezePrimArray mba
return (PrimVector ba 0 l) | 190 | true | false | 0 | 10 | 49 | 70 | 31 | 39 | null | null |
adityagupta1089/Project-Euler-Haskell | src/util/Merge.hs | bsd-3-clause | merge :: Ord a => [a] -> [a] -> [a]
merge xs [] = xs | 52 | merge :: Ord a => [a] -> [a] -> [a]
merge xs [] = xs | 52 | merge xs [] = xs | 16 | false | true | 0 | 8 | 14 | 47 | 23 | 24 | null | null |
crackleware/hscolour | Language/Haskell/HsColour/ANSI.hs | gpl-2.0 | cursorUp = "\ESC[A" | 22 | cursorUp = "\ESC[A" | 22 | cursorUp = "\ESC[A" | 22 | false | false | 0 | 4 | 5 | 6 | 3 | 3 | null | null |
adizere/nifty-urb | src/Nifty/URB.hs | mit | iMsgCollectorLimit :: Int
iMsgCollectorLimit = 100 | 50 | iMsgCollectorLimit :: Int
iMsgCollectorLimit = 100 | 50 | iMsgCollectorLimit = 100 | 24 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
agrafix/stack | src/Stack/Setup.hs | bsd-3-clause | installGHCPosix :: (MonadIO m, MonadMask m, MonadLogger m, MonadReader env m, HasConfig env, HasHttpManager env, MonadBaseControl IO m)
=> SetupInfo
-> Path Abs File
-> ArchiveType
-> Path Abs Dir
-> PackageIdentifier
-> m ()
installGHCPosix _ archiveFile archiveType destDir ident = do
platform <- asks getPlatform
menv0 <- getMinimalEnvOverride
menv <- mkEnvOverride platform (removeHaskellEnvVars (unEnvOverride menv0))
$logDebug $ "menv = " <> T.pack (show (unEnvOverride menv))
zipTool' <-
case archiveType of
TarXz -> return "xz"
TarBz2 -> return "bzip2"
SevenZ -> error "Don't know how to deal with .7z files on non-Windows"
(zipTool, makeTool, tarTool) <- checkDependencies $ (,,)
<$> checkDependency zipTool'
<*> (checkDependency "gmake" <|> checkDependency "make")
<*> checkDependency "tar"
$logDebug $ "ziptool: " <> T.pack zipTool
$logDebug $ "make: " <> T.pack makeTool
$logDebug $ "tar: " <> T.pack tarTool
withSystemTempDirectory "stack-setup" $ \root' -> do
root <- parseAbsDir root'
dir <- liftM (root Path.</>) $ parseRelDir $ packageIdentifierString ident
$logSticky $ "Unpacking GHC ..."
$logDebug $ "Unpacking " <> T.pack (toFilePath archiveFile)
readInNull root tarTool menv ["xf", toFilePath archiveFile] Nothing
$logSticky "Configuring GHC ..."
readInNull dir (toFilePath $ dir Path.</> $(mkRelFile "configure"))
menv ["--prefix=" ++ toFilePath destDir] Nothing
$logSticky "Installing GHC ..."
readInNull dir makeTool menv ["install"] Nothing
$logStickyDone $ "Installed GHC."
$logDebug $ "GHC installed to " <> T.pack (toFilePath destDir)
where
-- | Check if given processes appear to be present, throwing an exception if
-- missing.
checkDependencies :: (MonadIO m, MonadThrow m, MonadReader env m, HasConfig env)
=> CheckDependency a -> m a
checkDependencies (CheckDependency f) = do
menv <- getMinimalEnvOverride
liftIO (f menv) >>= either (throwM . MissingDependencies) return | 2,278 | installGHCPosix :: (MonadIO m, MonadMask m, MonadLogger m, MonadReader env m, HasConfig env, HasHttpManager env, MonadBaseControl IO m)
=> SetupInfo
-> Path Abs File
-> ArchiveType
-> Path Abs Dir
-> PackageIdentifier
-> m ()
installGHCPosix _ archiveFile archiveType destDir ident = do
platform <- asks getPlatform
menv0 <- getMinimalEnvOverride
menv <- mkEnvOverride platform (removeHaskellEnvVars (unEnvOverride menv0))
$logDebug $ "menv = " <> T.pack (show (unEnvOverride menv))
zipTool' <-
case archiveType of
TarXz -> return "xz"
TarBz2 -> return "bzip2"
SevenZ -> error "Don't know how to deal with .7z files on non-Windows"
(zipTool, makeTool, tarTool) <- checkDependencies $ (,,)
<$> checkDependency zipTool'
<*> (checkDependency "gmake" <|> checkDependency "make")
<*> checkDependency "tar"
$logDebug $ "ziptool: " <> T.pack zipTool
$logDebug $ "make: " <> T.pack makeTool
$logDebug $ "tar: " <> T.pack tarTool
withSystemTempDirectory "stack-setup" $ \root' -> do
root <- parseAbsDir root'
dir <- liftM (root Path.</>) $ parseRelDir $ packageIdentifierString ident
$logSticky $ "Unpacking GHC ..."
$logDebug $ "Unpacking " <> T.pack (toFilePath archiveFile)
readInNull root tarTool menv ["xf", toFilePath archiveFile] Nothing
$logSticky "Configuring GHC ..."
readInNull dir (toFilePath $ dir Path.</> $(mkRelFile "configure"))
menv ["--prefix=" ++ toFilePath destDir] Nothing
$logSticky "Installing GHC ..."
readInNull dir makeTool menv ["install"] Nothing
$logStickyDone $ "Installed GHC."
$logDebug $ "GHC installed to " <> T.pack (toFilePath destDir)
where
-- | Check if given processes appear to be present, throwing an exception if
-- missing.
checkDependencies :: (MonadIO m, MonadThrow m, MonadReader env m, HasConfig env)
=> CheckDependency a -> m a
checkDependencies (CheckDependency f) = do
menv <- getMinimalEnvOverride
liftIO (f menv) >>= either (throwM . MissingDependencies) return | 2,278 | installGHCPosix _ archiveFile archiveType destDir ident = do
platform <- asks getPlatform
menv0 <- getMinimalEnvOverride
menv <- mkEnvOverride platform (removeHaskellEnvVars (unEnvOverride menv0))
$logDebug $ "menv = " <> T.pack (show (unEnvOverride menv))
zipTool' <-
case archiveType of
TarXz -> return "xz"
TarBz2 -> return "bzip2"
SevenZ -> error "Don't know how to deal with .7z files on non-Windows"
(zipTool, makeTool, tarTool) <- checkDependencies $ (,,)
<$> checkDependency zipTool'
<*> (checkDependency "gmake" <|> checkDependency "make")
<*> checkDependency "tar"
$logDebug $ "ziptool: " <> T.pack zipTool
$logDebug $ "make: " <> T.pack makeTool
$logDebug $ "tar: " <> T.pack tarTool
withSystemTempDirectory "stack-setup" $ \root' -> do
root <- parseAbsDir root'
dir <- liftM (root Path.</>) $ parseRelDir $ packageIdentifierString ident
$logSticky $ "Unpacking GHC ..."
$logDebug $ "Unpacking " <> T.pack (toFilePath archiveFile)
readInNull root tarTool menv ["xf", toFilePath archiveFile] Nothing
$logSticky "Configuring GHC ..."
readInNull dir (toFilePath $ dir Path.</> $(mkRelFile "configure"))
menv ["--prefix=" ++ toFilePath destDir] Nothing
$logSticky "Installing GHC ..."
readInNull dir makeTool menv ["install"] Nothing
$logStickyDone $ "Installed GHC."
$logDebug $ "GHC installed to " <> T.pack (toFilePath destDir)
where
-- | Check if given processes appear to be present, throwing an exception if
-- missing.
checkDependencies :: (MonadIO m, MonadThrow m, MonadReader env m, HasConfig env)
=> CheckDependency a -> m a
checkDependencies (CheckDependency f) = do
menv <- getMinimalEnvOverride
liftIO (f menv) >>= either (throwM . MissingDependencies) return | 1,956 | false | true | 0 | 16 | 639 | 630 | 291 | 339 | null | null |
bos/critbit | Data/CritBit/Set.hs | bsd-2-clause | -- | /O(n)/. Build a set from an ascending list in linear time.
-- /The precondition (input list is ascending) is not checked./
fromDistinctAscList :: (CritBitKey a) => [a] -> Set a
fromDistinctAscList = liftFromList T.fromDistinctAscList | 238 | fromDistinctAscList :: (CritBitKey a) => [a] -> Set a
fromDistinctAscList = liftFromList T.fromDistinctAscList | 110 | fromDistinctAscList = liftFromList T.fromDistinctAscList | 56 | true | true | 0 | 7 | 35 | 37 | 20 | 17 | null | null |
kmate/HaRe | old/testing/moveDefBtwMods/B5_TokOut.hs | bsd-3-clause | myFringe:: Tree a -> [a]
myFringe (Leaf x ) = [x] | 49 | myFringe:: Tree a -> [a]
myFringe (Leaf x ) = [x] | 49 | myFringe (Leaf x ) = [x] | 24 | false | true | 0 | 7 | 10 | 33 | 17 | 16 | null | null |
rasendubi/arachne | src/Network/MQTT/Parser.hs | bsd-3-clause | --------------------------------------------------------------------------------
-- | An attoparsec parser for MQTT 3.1.1 packet.
--
-- The parser is fully compliant with the standard. If the parser
-- fails that means the message is ill-formatted and the connection
-- MUST be closed without sending any packet.
--
-- Note that there are packets that can not be processed but require a
-- response (e.g, wrong protocol level). In that case, parser succeeds
-- and that's a responsibility of the higher-level logic to examine
-- the packet and reply accordingly.
parsePacket :: Parser Packet
parsePacket = do
byte1 <- anyWord8
let packetType = byte1 `shiftR` 4
flags = byte1 .&. 0x0f
assert (packetType > 0 && packetType < 15)
"Packet type should be between 1 and 14"
case packetType of
1 -> CONNECT <$> parseConnect flags
2 -> CONNACK <$> parseConnack flags
3 -> PUBLISH <$> parsePublish flags
4 -> PUBACK <$> parsePuback flags
5 -> PUBREC <$> parsePubrec flags
6 -> PUBREL <$> parsePubrel flags
7 -> PUBCOMP <$> parsePubcomp flags
8 -> SUBSCRIBE <$> parseSubscribe flags
9 -> SUBACK <$> parseSuback flags
10 -> UNSUBSCRIBE <$> parseUnsubscribe flags
11 -> UNSUBACK <$> parseUnsuback flags
12 -> PINGREQ <$> parsePingreq flags
13 -> PINGRESP <$> parsePingresp flags
14 -> DISCONNECT <$> parseDisconnect flags
_ -> error "This could not happen"
-- | Parses remaining length of the packet.
--
-- This function is for internal use only and was exported for proper
-- testing. It may be hidden in the future. | 1,695 | parsePacket :: Parser Packet
parsePacket = do
byte1 <- anyWord8
let packetType = byte1 `shiftR` 4
flags = byte1 .&. 0x0f
assert (packetType > 0 && packetType < 15)
"Packet type should be between 1 and 14"
case packetType of
1 -> CONNECT <$> parseConnect flags
2 -> CONNACK <$> parseConnack flags
3 -> PUBLISH <$> parsePublish flags
4 -> PUBACK <$> parsePuback flags
5 -> PUBREC <$> parsePubrec flags
6 -> PUBREL <$> parsePubrel flags
7 -> PUBCOMP <$> parsePubcomp flags
8 -> SUBSCRIBE <$> parseSubscribe flags
9 -> SUBACK <$> parseSuback flags
10 -> UNSUBSCRIBE <$> parseUnsubscribe flags
11 -> UNSUBACK <$> parseUnsuback flags
12 -> PINGREQ <$> parsePingreq flags
13 -> PINGRESP <$> parsePingresp flags
14 -> DISCONNECT <$> parseDisconnect flags
_ -> error "This could not happen"
-- | Parses remaining length of the packet.
--
-- This function is for internal use only and was exported for proper
-- testing. It may be hidden in the future. | 1,131 | parsePacket = do
byte1 <- anyWord8
let packetType = byte1 `shiftR` 4
flags = byte1 .&. 0x0f
assert (packetType > 0 && packetType < 15)
"Packet type should be between 1 and 14"
case packetType of
1 -> CONNECT <$> parseConnect flags
2 -> CONNACK <$> parseConnack flags
3 -> PUBLISH <$> parsePublish flags
4 -> PUBACK <$> parsePuback flags
5 -> PUBREC <$> parsePubrec flags
6 -> PUBREL <$> parsePubrel flags
7 -> PUBCOMP <$> parsePubcomp flags
8 -> SUBSCRIBE <$> parseSubscribe flags
9 -> SUBACK <$> parseSuback flags
10 -> UNSUBSCRIBE <$> parseUnsubscribe flags
11 -> UNSUBACK <$> parseUnsuback flags
12 -> PINGREQ <$> parsePingreq flags
13 -> PINGRESP <$> parsePingresp flags
14 -> DISCONNECT <$> parseDisconnect flags
_ -> error "This could not happen"
-- | Parses remaining length of the packet.
--
-- This function is for internal use only and was exported for proper
-- testing. It may be hidden in the future. | 1,102 | true | true | 0 | 11 | 436 | 281 | 140 | 141 | null | null |
vito/atomo | src/Atomo/Format/Parser.hs | bsd-3-clause | sChunk :: Parser Segment
sChunk = liftM (SChunk . T.pack) (many1 cont)
where
match '{' = '}'
match '(' = ')'
match '[' = ']'
match x = error ("no matching delimiter for " ++ [x])
cont = do
i <- liftM fpsInsideOf getState
w <- liftM fpsWaitingFor getState
choice $
[ try $ do
char '\\'
oneOf "%{}()[]"
, try charEscape
, try $ do
char '%'
newline
cont
, if not (null w) && not (null i)
then try $ do
c <- char (head w)
if c == snd (head i) -- they opened another; close that one
then do
modifyState $ \ps -> ps { fpsInsideOf = tail i }
return c
else fail "end delim"
else fail "not inside anything"
, do
p <- getPosition
o <- oneOf "{(["
modifyState $ \ps -> ps { fpsInsideOf = (p, match o) : i }
return o
, noneOf ('%':take 1 w)
] | 1,181 | sChunk :: Parser Segment
sChunk = liftM (SChunk . T.pack) (many1 cont)
where
match '{' = '}'
match '(' = ')'
match '[' = ']'
match x = error ("no matching delimiter for " ++ [x])
cont = do
i <- liftM fpsInsideOf getState
w <- liftM fpsWaitingFor getState
choice $
[ try $ do
char '\\'
oneOf "%{}()[]"
, try charEscape
, try $ do
char '%'
newline
cont
, if not (null w) && not (null i)
then try $ do
c <- char (head w)
if c == snd (head i) -- they opened another; close that one
then do
modifyState $ \ps -> ps { fpsInsideOf = tail i }
return c
else fail "end delim"
else fail "not inside anything"
, do
p <- getPosition
o <- oneOf "{(["
modifyState $ \ps -> ps { fpsInsideOf = (p, match o) : i }
return o
, noneOf ('%':take 1 w)
] | 1,181 | sChunk = liftM (SChunk . T.pack) (many1 cont)
where
match '{' = '}'
match '(' = ')'
match '[' = ']'
match x = error ("no matching delimiter for " ++ [x])
cont = do
i <- liftM fpsInsideOf getState
w <- liftM fpsWaitingFor getState
choice $
[ try $ do
char '\\'
oneOf "%{}()[]"
, try charEscape
, try $ do
char '%'
newline
cont
, if not (null w) && not (null i)
then try $ do
c <- char (head w)
if c == snd (head i) -- they opened another; close that one
then do
modifyState $ \ps -> ps { fpsInsideOf = tail i }
return c
else fail "end delim"
else fail "not inside anything"
, do
p <- getPosition
o <- oneOf "{(["
modifyState $ \ps -> ps { fpsInsideOf = (p, match o) : i }
return o
, noneOf ('%':take 1 w)
] | 1,156 | false | true | 0 | 20 | 606 | 352 | 169 | 183 | null | null |
gibiansky/hlint | data/Default.hs | bsd-3-clause | error = foldr (*>) (pure ()) ==> sequenceA_ where _ = noQuickCheck | 66 | error = foldr (*>) (pure ()) ==> sequenceA_ where _ = noQuickCheck | 66 | error = foldr (*>) (pure ()) ==> sequenceA_ where _ = noQuickCheck | 66 | false | false | 2 | 7 | 11 | 39 | 17 | 22 | null | null |
ian-ross/cabal | Cabal/Distribution/PackageDescription/Check.hs | bsd-3-clause | commaSep :: [String] -> String
commaSep = intercalate ", " | 58 | commaSep :: [String] -> String
commaSep = intercalate ", " | 58 | commaSep = intercalate ", " | 27 | false | true | 0 | 6 | 9 | 21 | 11 | 10 | null | null |
Saulzar/reflex | test/RequesterT.hs | bsd-3-clause | unwrapApp :: ( Reflex t, Monad m )
=> (a -> RequesterT t RequestInt Identity m ())
-> a
-> m (Event t [Int])
unwrapApp x appIn = do
((), e) <- runRequesterT (x appIn) never
return $ fmap (map unwrapRequest . requesterDataToList) e | 264 | unwrapApp :: ( Reflex t, Monad m )
=> (a -> RequesterT t RequestInt Identity m ())
-> a
-> m (Event t [Int])
unwrapApp x appIn = do
((), e) <- runRequesterT (x appIn) never
return $ fmap (map unwrapRequest . requesterDataToList) e | 264 | unwrapApp x appIn = do
((), e) <- runRequesterT (x appIn) never
return $ fmap (map unwrapRequest . requesterDataToList) e | 125 | false | true | 0 | 11 | 77 | 121 | 60 | 61 | null | null |
plow-technologies/shakespeare-dynamic | ghcjs-shakespeare-dynamic/src/Shakespeare/Ophelia/Parser/VDOM/Types.hs | mit | -- DOM that can change
addEvent ev (LiveChildren evs vchs) = LiveChildren (evs ++ [ev]) vchs | 92 | addEvent ev (LiveChildren evs vchs) = LiveChildren (evs ++ [ev]) vchs | 69 | addEvent ev (LiveChildren evs vchs) = LiveChildren (evs ++ [ev]) vchs | 69 | true | false | 0 | 8 | 15 | 35 | 18 | 17 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs | mit | decomposeChar '\x30BC' = "\x30BB\x3099" | 39 | decomposeChar '\x30BC' = "\x30BB\x3099" | 39 | decomposeChar '\x30BC' = "\x30BB\x3099" | 39 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
MaxDaten/yage-rendering | src/Yage/Rendering/Resources/Types.hs | mit | tagDirty :: a -> UpdateTag a
tagDirty = Dirty | 45 | tagDirty :: a -> UpdateTag a
tagDirty = Dirty | 45 | tagDirty = Dirty | 16 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
clauderichard/Euclaude | Geo.hs | mit | triangleAngleBisectors :: Triangle -> [Line]
triangleAngleBisectors = cevianLines cgIncenter | 92 | triangleAngleBisectors :: Triangle -> [Line]
triangleAngleBisectors = cevianLines cgIncenter | 92 | triangleAngleBisectors = cevianLines cgIncenter | 47 | false | true | 0 | 6 | 8 | 21 | 11 | 10 | null | null |
JeffHeard/Hieroglyph | Graphics/Rendering/Hieroglyph/Cairo.hs | bsd-2-clause | -- | @renderToSVGWithImageCache filename width height frame@ renders a frame to a SVG file. width and height are in points.
renderToSVGWithImageCache :: Visual t => PangoContext -> ImageCache -> FilePath -> Double -> Double -> t -> IO ()
renderToSVGWithImageCache c images filename width height frame = Cairo.withSVGSurface filename width height $ \s -> renderToSurfaceWithImageCache c images s frame | 403 | renderToSVGWithImageCache :: Visual t => PangoContext -> ImageCache -> FilePath -> Double -> Double -> t -> IO ()
renderToSVGWithImageCache c images filename width height frame = Cairo.withSVGSurface filename width height $ \s -> renderToSurfaceWithImageCache c images s frame | 277 | renderToSVGWithImageCache c images filename width height frame = Cairo.withSVGSurface filename width height $ \s -> renderToSurfaceWithImageCache c images s frame | 162 | true | true | 0 | 13 | 61 | 88 | 43 | 45 | null | null |
UBMLtonGroup/timberc | src/Reduce.hs | bsd-3-clause | unify env ((TAp t u,TAp t' u'):eqs) = unify env ((t,t'):(u,u'):eqs) | 71 | unify env ((TAp t u,TAp t' u'):eqs) = unify env ((t,t'):(u,u'):eqs) | 71 | unify env ((TAp t u,TAp t' u'):eqs) = unify env ((t,t'):(u,u'):eqs) | 71 | false | false | 0 | 9 | 14 | 62 | 33 | 29 | null | null |
michaelficarra/purescript | psci/Completion.hs | mit | getIdentNames :: CompletionM [String]
getIdentNames = mapLoadedModulesAndQualify P.showIdent identNames | 103 | getIdentNames :: CompletionM [String]
getIdentNames = mapLoadedModulesAndQualify P.showIdent identNames | 103 | getIdentNames = mapLoadedModulesAndQualify P.showIdent identNames | 65 | false | true | 0 | 7 | 8 | 29 | 13 | 16 | null | null |
gridaphobe/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | dataConRepFSInstPat = dataConInstPat | 36 | dataConRepFSInstPat = dataConInstPat | 36 | dataConRepFSInstPat = dataConInstPat | 36 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
mohsen3/csv-conduit | src/Data/CSV/Conduit.hs | bsd-3-clause | fromCSVRow :: (Monad m, IsString s, CSV s r)
=> CSVSettings -> Conduit r m s
fromCSVRow set = awaitForever $ \row -> mapM_ yield [rowToStr set row, "\n"] | 164 | fromCSVRow :: (Monad m, IsString s, CSV s r)
=> CSVSettings -> Conduit r m s
fromCSVRow set = awaitForever $ \row -> mapM_ yield [rowToStr set row, "\n"] | 164 | fromCSVRow set = awaitForever $ \row -> mapM_ yield [rowToStr set row, "\n"] | 76 | false | true | 0 | 9 | 39 | 73 | 37 | 36 | null | null |
brownsys/pane | src/Parser.hs | bsd-3-clause | boolean = do reserved "True"
return True
<|> do reserved "False"
return False | 109 | boolean = do reserved "True"
return True
<|> do reserved "False"
return False | 109 | boolean = do reserved "True"
return True
<|> do reserved "False"
return False | 109 | false | false | 0 | 8 | 44 | 34 | 13 | 21 | null | null |
tjakway/ghcjvm | compiler/typecheck/TcGenGenerics.hs | bsd-3-clause | -- | @argTyFold@ implements a generalised and safer variant of the @arg@
-- function from Figure 3 in <http://dreixel.net/research/pdf/gdmh.pdf>. @arg@
-- is conceptually equivalent to:
--
-- > arg t = case t of
-- > _ | isTyVar t -> if (t == argVar) then Par1 else Par0 t
-- > App f [t'] |
-- > representable1 f &&
-- > t' == argVar -> Rec1 f
-- > App f [t'] |
-- > representable1 f &&
-- > t' has tyvars -> f :.: (arg t')
-- > _ -> Rec0 t
--
-- where @argVar@ is the last type variable in the data type declaration we are
-- finding the representation for.
--
-- @argTyFold@ is more general than @arg@ because it uses 'ArgTyAlg' to
-- abstract out the concrete invocations of @Par0@, @Rec0@, @Par1@, @Rec1@, and
-- @:.:@.
--
-- @argTyFold@ is safer than @arg@ because @arg@ would lead to a GHC panic for
-- some data types. The problematic case is when @t@ is an application of a
-- non-representable type @f@ to @argVar@: @App f [argVar]@ is caught by the
-- @_@ pattern, and ends up represented as @Rec0 t@. This type occurs /free/ in
-- the RHS of the eventual @Rep1@ instance, which is therefore ill-formed. Some
-- representable1 checks have been relaxed, and others were moved to
-- @canDoGenerics1@.
argTyFold :: forall a. TyVar -> ArgTyAlg a -> Type -> a
argTyFold argVar (ArgTyAlg {ata_rec0 = mkRec0,
ata_par1 = mkPar1, ata_rec1 = mkRec1,
ata_comp = mkComp}) =
-- mkRec0 is the default; use it if there is no interesting structure
-- (e.g. occurrences of parameters or recursive occurrences)
\t -> maybe (mkRec0 t) id $ go t where
go :: Type -> -- type to fold through
Maybe a -- the result (e.g. representation type), unless it's trivial
go t = isParam `mplus` isApp where
isParam = do -- handles parameters
t' <- getTyVar_maybe t
Just $ if t' == argVar then mkPar1 -- moreover, it is "the" parameter
else mkRec0 t -- NB mkRec0 instead of the conventional mkPar0
isApp = do -- handles applications
(phi, beta) <- tcSplitAppTy_maybe t
let interesting = argVar `elemVarSet` exactTyCoVarsOfType beta
-- Does it have no interesting structure to represent?
if not interesting then Nothing
else -- Is the argument the parameter? Special case for mkRec1.
if Just argVar == getTyVar_maybe beta then Just $ mkRec1 phi
else mkComp phi `fmap` go beta -- It must be a composition. | 2,510 | argTyFold :: forall a. TyVar -> ArgTyAlg a -> Type -> a
argTyFold argVar (ArgTyAlg {ata_rec0 = mkRec0,
ata_par1 = mkPar1, ata_rec1 = mkRec1,
ata_comp = mkComp}) =
-- mkRec0 is the default; use it if there is no interesting structure
-- (e.g. occurrences of parameters or recursive occurrences)
\t -> maybe (mkRec0 t) id $ go t where
go :: Type -> -- type to fold through
Maybe a -- the result (e.g. representation type), unless it's trivial
go t = isParam `mplus` isApp where
isParam = do -- handles parameters
t' <- getTyVar_maybe t
Just $ if t' == argVar then mkPar1 -- moreover, it is "the" parameter
else mkRec0 t -- NB mkRec0 instead of the conventional mkPar0
isApp = do -- handles applications
(phi, beta) <- tcSplitAppTy_maybe t
let interesting = argVar `elemVarSet` exactTyCoVarsOfType beta
-- Does it have no interesting structure to represent?
if not interesting then Nothing
else -- Is the argument the parameter? Special case for mkRec1.
if Just argVar == getTyVar_maybe beta then Just $ mkRec1 phi
else mkComp phi `fmap` go beta -- It must be a composition. | 1,236 | argTyFold argVar (ArgTyAlg {ata_rec0 = mkRec0,
ata_par1 = mkPar1, ata_rec1 = mkRec1,
ata_comp = mkComp}) =
-- mkRec0 is the default; use it if there is no interesting structure
-- (e.g. occurrences of parameters or recursive occurrences)
\t -> maybe (mkRec0 t) id $ go t where
go :: Type -> -- type to fold through
Maybe a -- the result (e.g. representation type), unless it's trivial
go t = isParam `mplus` isApp where
isParam = do -- handles parameters
t' <- getTyVar_maybe t
Just $ if t' == argVar then mkPar1 -- moreover, it is "the" parameter
else mkRec0 t -- NB mkRec0 instead of the conventional mkPar0
isApp = do -- handles applications
(phi, beta) <- tcSplitAppTy_maybe t
let interesting = argVar `elemVarSet` exactTyCoVarsOfType beta
-- Does it have no interesting structure to represent?
if not interesting then Nothing
else -- Is the argument the parameter? Special case for mkRec1.
if Just argVar == getTyVar_maybe beta then Just $ mkRec1 phi
else mkComp phi `fmap` go beta -- It must be a composition. | 1,180 | true | true | 0 | 13 | 645 | 284 | 166 | 118 | null | null |
siddhanathan/ghc | compiler/hsSyn/HsTypes.hs | bsd-3-clause | hsIPNameFS :: HsIPName -> FastString
hsIPNameFS (HsIPName n) = n | 64 | hsIPNameFS :: HsIPName -> FastString
hsIPNameFS (HsIPName n) = n | 64 | hsIPNameFS (HsIPName n) = n | 27 | false | true | 0 | 7 | 9 | 24 | 12 | 12 | null | null |
HairyDude/heal | EveApi/Types.hs | bsd-2-clause | sameArgType (ArgExtended _) (ArgExtended _) = True | 60 | sameArgType (ArgExtended _) (ArgExtended _) = True | 60 | sameArgType (ArgExtended _) (ArgExtended _) = True | 60 | false | false | 0 | 7 | 16 | 27 | 12 | 15 | null | null |
brendanhay/gogol | gogol-discovery/gen/Network/Google/Discovery/Types/Product.hs | mpl-2.0 | -- | The title of this API.
rdTitle :: Lens' RestDescription (Maybe Text)
rdTitle = lens _rdTitle (\ s a -> s{_rdTitle = a}) | 124 | rdTitle :: Lens' RestDescription (Maybe Text)
rdTitle = lens _rdTitle (\ s a -> s{_rdTitle = a}) | 96 | rdTitle = lens _rdTitle (\ s a -> s{_rdTitle = a}) | 50 | true | true | 1 | 9 | 23 | 52 | 25 | 27 | null | null |
brendanhay/gogol | gogol-ml/gen/Network/Google/Resource/Ml/Projects/Jobs/Get.hs | mpl-2.0 | -- | OAuth access token.
pjgAccessToken :: Lens' ProjectsJobsGet (Maybe Text)
pjgAccessToken
= lens _pjgAccessToken
(\ s a -> s{_pjgAccessToken = a}) | 157 | pjgAccessToken :: Lens' ProjectsJobsGet (Maybe Text)
pjgAccessToken
= lens _pjgAccessToken
(\ s a -> s{_pjgAccessToken = a}) | 132 | pjgAccessToken
= lens _pjgAccessToken
(\ s a -> s{_pjgAccessToken = a}) | 79 | true | true | 1 | 9 | 29 | 52 | 25 | 27 | null | null |
johanneshilden/trombone | Trombone/Server.hs | bsd-3-clause | dispatch r (RequestInfo EmptyBody i) = runD r i Null BS.empty | 61 | dispatch r (RequestInfo EmptyBody i) = runD r i Null BS.empty | 61 | dispatch r (RequestInfo EmptyBody i) = runD r i Null BS.empty | 61 | false | false | 0 | 7 | 10 | 30 | 14 | 16 | null | null |
nomeata/ghc | compiler/main/DriverPhases.hs | bsd-3-clause | isHaskellSrcFilename f = isHaskellSrcSuffix (drop 1 $ takeExtension f) | 78 | isHaskellSrcFilename f = isHaskellSrcSuffix (drop 1 $ takeExtension f) | 78 | isHaskellSrcFilename f = isHaskellSrcSuffix (drop 1 $ takeExtension f) | 78 | false | false | 0 | 8 | 16 | 25 | 11 | 14 | null | null |
markflorisson/hpack | testrepo/bytestring-0.10.4.1/Data/ByteString/Lazy.hs | bsd-3-clause | -- | /O(n\/c)/ Append a byte to the end of a 'ByteString'
snoc :: ByteString -> Word8 -> ByteString
snoc cs w = foldrChunks Chunk (singleton w) cs | 146 | snoc :: ByteString -> Word8 -> ByteString
snoc cs w = foldrChunks Chunk (singleton w) cs | 88 | snoc cs w = foldrChunks Chunk (singleton w) cs | 46 | true | true | 0 | 7 | 27 | 42 | 20 | 22 | null | null |
oldmanmike/ghc | compiler/llvmGen/LlvmCodeGen/CodeGen.hs | bsd-3-clause | -- | Word type expected (usual).
wordOption :: EOption
wordOption = EOption False | 81 | wordOption :: EOption
wordOption = EOption False | 48 | wordOption = EOption False | 26 | true | true | 0 | 5 | 12 | 15 | 8 | 7 | null | null |
UBMLtonGroup/timberc | src/Derive.hs | bsd-3-clause | eLam' xs e = do ts <- mapM (\_ -> newTVar Star) xs
return (ELam (zipWith (\x t -> (x,scheme t)) xs ts) e) | 175 | eLam' xs e = do ts <- mapM (\_ -> newTVar Star) xs
return (ELam (zipWith (\x t -> (x,scheme t)) xs ts) e) | 175 | eLam' xs e = do ts <- mapM (\_ -> newTVar Star) xs
return (ELam (zipWith (\x t -> (x,scheme t)) xs ts) e) | 175 | false | false | 0 | 15 | 93 | 77 | 38 | 39 | null | null |
leshchevds/ganeti | src/Ganeti/OpParams.hs | bsd-2-clause | readExportTarget (JSArray arr) = return $ ExportTargetRemote arr | 64 | readExportTarget (JSArray arr) = return $ ExportTargetRemote arr | 64 | readExportTarget (JSArray arr) = return $ ExportTargetRemote arr | 64 | false | false | 0 | 6 | 7 | 23 | 10 | 13 | null | null |
begriffs/hscope | HScope.hs | bsd-3-clause | addInfo :: Lines -> IType -> Name SrcSpanInfo -> WriteCDB IO ()
addInfo vec ity n = case vec V.!? (l - 2) of
Nothing -> warning $ "Bad line: " ++ show n ++ ", " ++ show vec
Just lp -> addBS (B.pack f) $ encode $ Info ity (fileName src) (fst lp) (snd lp)
where l = startLine src
(src, f) = case n of
(Ident src' f') -> (src', f')
(Symbol src' f') -> (src', f') | 405 | addInfo :: Lines -> IType -> Name SrcSpanInfo -> WriteCDB IO ()
addInfo vec ity n = case vec V.!? (l - 2) of
Nothing -> warning $ "Bad line: " ++ show n ++ ", " ++ show vec
Just lp -> addBS (B.pack f) $ encode $ Info ity (fileName src) (fst lp) (snd lp)
where l = startLine src
(src, f) = case n of
(Ident src' f') -> (src', f')
(Symbol src' f') -> (src', f') | 405 | addInfo vec ity n = case vec V.!? (l - 2) of
Nothing -> warning $ "Bad line: " ++ show n ++ ", " ++ show vec
Just lp -> addBS (B.pack f) $ encode $ Info ity (fileName src) (fst lp) (snd lp)
where l = startLine src
(src, f) = case n of
(Ident src' f') -> (src', f')
(Symbol src' f') -> (src', f') | 341 | false | true | 0 | 13 | 125 | 206 | 103 | 103 | null | null |
byorgey/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | process fn (DocStr n) = do i <- getIState
case lookupCtxtName n (idris_docstrings i) of
[] -> iFail $ "No documentation for " ++ show n
ns -> do mapM_ showDoc ns
iResult ""
where showDoc (n, d)
= do doc <- getDocs n
iputStrLn $ show doc | 403 | process fn (DocStr n) = do i <- getIState
case lookupCtxtName n (idris_docstrings i) of
[] -> iFail $ "No documentation for " ++ show n
ns -> do mapM_ showDoc ns
iResult ""
where showDoc (n, d)
= do doc <- getDocs n
iputStrLn $ show doc | 403 | process fn (DocStr n) = do i <- getIState
case lookupCtxtName n (idris_docstrings i) of
[] -> iFail $ "No documentation for " ++ show n
ns -> do mapM_ showDoc ns
iResult ""
where showDoc (n, d)
= do doc <- getDocs n
iputStrLn $ show doc | 403 | false | false | 0 | 12 | 214 | 117 | 53 | 64 | null | null |
dysinger/amazonka | amazonka-s3/gen/Network/AWS/S3/GetObject.hs | mpl-2.0 | -- | Sets the Content-Disposition header of the response
goResponseContentDisposition :: Lens' GetObject (Maybe Text)
goResponseContentDisposition =
lens _goResponseContentDisposition
(\s a -> s { _goResponseContentDisposition = a }) | 245 | goResponseContentDisposition :: Lens' GetObject (Maybe Text)
goResponseContentDisposition =
lens _goResponseContentDisposition
(\s a -> s { _goResponseContentDisposition = a }) | 188 | goResponseContentDisposition =
lens _goResponseContentDisposition
(\s a -> s { _goResponseContentDisposition = a }) | 127 | true | true | 0 | 9 | 39 | 46 | 25 | 21 | null | null |
takagi/SimulationDSL | Examples/CompilerExamples.hs | bsd-3-clause | -- equationsArraySize: array size unspecified
machine1 = do define "x" (constantS 1)
-- equationsArraySize: array size unspecified | 131 | machine1 = do define "x" (constantS 1)
-- equationsArraySize: array size unspecified | 85 | machine1 = do define "x" (constantS 1)
-- equationsArraySize: array size unspecified | 85 | true | false | 0 | 9 | 17 | 22 | 11 | 11 | null | null |
tel/saltine | src/Crypto/Saltine/Core/AEAD/ChaCha20Poly1305.hs | mit | aeadOpen
:: Key
-> Nonce
-> ByteString
-- ^ Ciphertext
-> ByteString
-- ^ AAD
-> Maybe ByteString
-- ^ Message
aeadOpen (Key key) (Nonce nonce) cipher aad = do
let clen = S.length cipher
alen = S.length aad
mlen <- clen `safeSubtract` Bytes.aead_chacha20poly1305_abytes
let (err, vec) = buildUnsafeByteString mlen $ \pm ->
constByteStrings [key, cipher, aad, nonce] $ \
[(pk, _), (pc, _), (pa, _), (pn, _)] ->
c_aead_open pm nullPtr nullPtr pc (fromIntegral clen) pa (fromIntegral alen) pn pk
hush . handleErrno err $ vec
-- | Encrypts a message. It is infeasible for an attacker to decrypt
-- the message so long as the 'Nonce' is never repeated. | 728 | aeadOpen
:: Key
-> Nonce
-> ByteString
-- ^ Ciphertext
-> ByteString
-- ^ AAD
-> Maybe ByteString
aeadOpen (Key key) (Nonce nonce) cipher aad = do
let clen = S.length cipher
alen = S.length aad
mlen <- clen `safeSubtract` Bytes.aead_chacha20poly1305_abytes
let (err, vec) = buildUnsafeByteString mlen $ \pm ->
constByteStrings [key, cipher, aad, nonce] $ \
[(pk, _), (pc, _), (pa, _), (pn, _)] ->
c_aead_open pm nullPtr nullPtr pc (fromIntegral clen) pa (fromIntegral alen) pn pk
hush . handleErrno err $ vec
-- | Encrypts a message. It is infeasible for an attacker to decrypt
-- the message so long as the 'Nonce' is never repeated. | 711 | aeadOpen (Key key) (Nonce nonce) cipher aad = do
let clen = S.length cipher
alen = S.length aad
mlen <- clen `safeSubtract` Bytes.aead_chacha20poly1305_abytes
let (err, vec) = buildUnsafeByteString mlen $ \pm ->
constByteStrings [key, cipher, aad, nonce] $ \
[(pk, _), (pc, _), (pa, _), (pn, _)] ->
c_aead_open pm nullPtr nullPtr pc (fromIntegral clen) pa (fromIntegral alen) pn pk
hush . handleErrno err $ vec
-- | Encrypts a message. It is infeasible for an attacker to decrypt
-- the message so long as the 'Nonce' is never repeated. | 585 | true | true | 0 | 16 | 191 | 233 | 123 | 110 | null | null |
mstksg/tensor-ops | src/TensorOps/Backend/BTensor.hs | bsd-3-clause | genBTensor
:: forall k (b :: BShape k -> Type) v (ns :: [k]). (BLAS b, Vec v)
=> Sing ns
-> (Prod (IndexN k) ns -> ElemB b)
-> BTensor v b ns
genBTensor s f = getI $ genBTensorA s (I . f) | 203 | genBTensor
:: forall k (b :: BShape k -> Type) v (ns :: [k]). (BLAS b, Vec v)
=> Sing ns
-> (Prod (IndexN k) ns -> ElemB b)
-> BTensor v b ns
genBTensor s f = getI $ genBTensorA s (I . f) | 203 | genBTensor s f = getI $ genBTensorA s (I . f) | 45 | false | true | 0 | 14 | 60 | 120 | 62 | 58 | null | null |
nakamuray/htig | HTIG/IRCServer/Constants.hs | bsd-3-clause | rPL_ENDOFBANLIST = 368 | 22 | rPL_ENDOFBANLIST = 368 | 22 | rPL_ENDOFBANLIST = 368 | 22 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
peinguin/erl2048 | bot/src/Visualizer.hs | mit | processGrid :: [[Maybe T.Cell]] -> IO [[Maybe (QML.ObjRef T.Cell)]]
processGrid [] = return [] | 94 | processGrid :: [[Maybe T.Cell]] -> IO [[Maybe (QML.ObjRef T.Cell)]]
processGrid [] = return [] | 94 | processGrid [] = return [] | 26 | false | true | 0 | 12 | 13 | 58 | 29 | 29 | null | null |
ledyba/hs-java | JVM/Builder/Instructions.hs | lgpl-3.0 | istore_ :: Generator e g => Word8 -> g e ()
istore_ x = i0 (ISTORE x) | 69 | istore_ :: Generator e g => Word8 -> g e ()
istore_ x = i0 (ISTORE x) | 69 | istore_ x = i0 (ISTORE x) | 25 | false | true | 0 | 8 | 16 | 43 | 20 | 23 | null | null |
dchagniot/threadscopeRestServer | src/Events/HECs.hs | bsd-3-clause | extractUserMarkers :: HECs -> [(Timestamp, String)]
extractUserMarkers hecs =
[ (ts, mark)
| CapEvent _ (Event ts (UserMarker mark)) <- elems (hecEventArray hecs) ] | 168 | extractUserMarkers :: HECs -> [(Timestamp, String)]
extractUserMarkers hecs =
[ (ts, mark)
| CapEvent _ (Event ts (UserMarker mark)) <- elems (hecEventArray hecs) ] | 168 | extractUserMarkers hecs =
[ (ts, mark)
| CapEvent _ (Event ts (UserMarker mark)) <- elems (hecEventArray hecs) ] | 116 | false | true | 0 | 13 | 27 | 76 | 39 | 37 | null | null |
gridaphobe/ghc | compiler/types/Coercion.hs | bsd-3-clause | coercionSize (NthCo _ co) = 1 + coercionSize co | 54 | coercionSize (NthCo _ co) = 1 + coercionSize co | 54 | coercionSize (NthCo _ co) = 1 + coercionSize co | 54 | false | false | 0 | 7 | 15 | 24 | 11 | 13 | null | null |
headprogrammingczar/cabal | cabal-install/Distribution/Client/ProjectPlanning.hs | bsd-3-clause | -- | Select the bits of a 'ProgramDb' to monitor for value changes.
-- Use 'programsMonitorFiles' for the files to monitor.
--
programsDbSignature :: ProgramDb -> [ConfiguredProgram]
programsDbSignature progdb =
[ prog { programMonitorFiles = []
, programOverrideEnv = filter ((/="PATH") . fst)
(programOverrideEnv prog) }
| prog <- configuredPrograms progdb ] | 422 | programsDbSignature :: ProgramDb -> [ConfiguredProgram]
programsDbSignature progdb =
[ prog { programMonitorFiles = []
, programOverrideEnv = filter ((/="PATH") . fst)
(programOverrideEnv prog) }
| prog <- configuredPrograms progdb ] | 295 | programsDbSignature progdb =
[ prog { programMonitorFiles = []
, programOverrideEnv = filter ((/="PATH") . fst)
(programOverrideEnv prog) }
| prog <- configuredPrograms progdb ] | 239 | true | true | 0 | 11 | 113 | 76 | 43 | 33 | null | null |
psibi/yesod | yesod-auth/Yesod/Auth.hs | mit | -- | Default handler to show the login page.
--
-- This is the default 'loginHandler'. It concatenates plugin widgets and
-- wraps the result in 'authLayout'. See 'loginHandler' for more details.
--
-- @since 1.4.9
defaultLoginHandler :: AuthHandler master Html
defaultLoginHandler = do
tp <- getRouteToParent
authLayout $ do
setTitleI Msg.LoginTitle
master <- getYesod
mapM_ (flip apLogin tp) (authPlugins master) | 448 | defaultLoginHandler :: AuthHandler master Html
defaultLoginHandler = do
tp <- getRouteToParent
authLayout $ do
setTitleI Msg.LoginTitle
master <- getYesod
mapM_ (flip apLogin tp) (authPlugins master) | 231 | defaultLoginHandler = do
tp <- getRouteToParent
authLayout $ do
setTitleI Msg.LoginTitle
master <- getYesod
mapM_ (flip apLogin tp) (authPlugins master) | 184 | true | true | 0 | 12 | 94 | 73 | 36 | 37 | null | null |
DanielWaterworth/Idris-dev | src/Idris/WhoCalls.hs | bsd-3-clause | occursSC :: Name -> SC -> Bool
occursSC n (Case _ alts) = any (occursCaseAlt n) alts | 84 | occursSC :: Name -> SC -> Bool
occursSC n (Case _ alts) = any (occursCaseAlt n) alts | 84 | occursSC n (Case _ alts) = any (occursCaseAlt n) alts | 53 | false | true | 0 | 10 | 16 | 48 | 22 | 26 | null | null |
energyflowanalysis/efa-2.1 | src/EFA/Signal/Signal.hs | bsd-3-clause | fromSample :: TC Sample typ (Data Nil d) -> d
fromSample (TC (Data x)) = x | 74 | fromSample :: TC Sample typ (Data Nil d) -> d
fromSample (TC (Data x)) = x | 74 | fromSample (TC (Data x)) = x | 28 | false | true | 0 | 9 | 15 | 45 | 22 | 23 | null | null |
brendanhay/gogol | gogol-bigtableadmin/gen/Network/Google/Resource/BigtableAdmin/Projects/Locations/Get.hs | mpl-2.0 | -- | JSONP
plgCallback :: Lens' ProjectsLocationsGet (Maybe Text)
plgCallback
= lens _plgCallback (\ s a -> s{_plgCallback = a}) | 130 | plgCallback :: Lens' ProjectsLocationsGet (Maybe Text)
plgCallback
= lens _plgCallback (\ s a -> s{_plgCallback = a}) | 119 | plgCallback
= lens _plgCallback (\ s a -> s{_plgCallback = a}) | 64 | true | true | 0 | 9 | 21 | 48 | 25 | 23 | null | null |
chadbrewbaker/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | checkConditionalAndOrs _ (TC_Or id DoubleBracket "-o" _ _) =
err id 2110 "In [[..]], use || instead of -o." | 111 | checkConditionalAndOrs _ (TC_Or id DoubleBracket "-o" _ _) =
err id 2110 "In [[..]], use || instead of -o." | 111 | checkConditionalAndOrs _ (TC_Or id DoubleBracket "-o" _ _) =
err id 2110 "In [[..]], use || instead of -o." | 111 | false | false | 0 | 7 | 22 | 32 | 15 | 17 | null | null |
amunguia/pipelines | Control/Concurrent/Pipelines/Internal.hs | mit | -- | Runs the function specified by the job on one input. Returns if JobEnd is read
-- from the input channel, otherwise repeats for next item.
exec :: Job a b -> IO ()
exec j = do
a <- readChan $ inchan j
case a of
JobResult a' -> do
b <- (job j) a'
writeChan (outchan j) (JobResult b)
exec j
JobEnd -> do
writeChan (inchan j) JobEnd -- in case multiple readers
writeChan (outchan j) JobEnd -- pass JobEnd signal
return ()
-- | Move values from one channel to another, wrapping in JobResult in the process. | 611 | exec :: Job a b -> IO ()
exec j = do
a <- readChan $ inchan j
case a of
JobResult a' -> do
b <- (job j) a'
writeChan (outchan j) (JobResult b)
exec j
JobEnd -> do
writeChan (inchan j) JobEnd -- in case multiple readers
writeChan (outchan j) JobEnd -- pass JobEnd signal
return ()
-- | Move values from one channel to another, wrapping in JobResult in the process. | 464 | exec j = do
a <- readChan $ inchan j
case a of
JobResult a' -> do
b <- (job j) a'
writeChan (outchan j) (JobResult b)
exec j
JobEnd -> do
writeChan (inchan j) JobEnd -- in case multiple readers
writeChan (outchan j) JobEnd -- pass JobEnd signal
return ()
-- | Move values from one channel to another, wrapping in JobResult in the process. | 439 | true | true | 0 | 16 | 204 | 152 | 68 | 84 | null | null |
TomMD/io-streams | src/System/IO/Streams/Combinators.hs | bsd-3-clause | atEndOfOutput :: IO b -> OutputStream a -> IO (OutputStream a)
atEndOfOutput m os = makeOutputStream f
where
f Nothing = write Nothing os >> void m
f x = write x os | 180 | atEndOfOutput :: IO b -> OutputStream a -> IO (OutputStream a)
atEndOfOutput m os = makeOutputStream f
where
f Nothing = write Nothing os >> void m
f x = write x os | 180 | atEndOfOutput m os = makeOutputStream f
where
f Nothing = write Nothing os >> void m
f x = write x os | 117 | false | true | 0 | 9 | 48 | 78 | 35 | 43 | null | null |
Slava/6.035-decaf-compiler | src/LLIR.hs | mit | getUseInstr2 :: VFunction -> Use -> VInstruction
getUseInstr2 func use = hml (functionInstructions func) (useInstruction use) "getUseInstr2" | 140 | getUseInstr2 :: VFunction -> Use -> VInstruction
getUseInstr2 func use = hml (functionInstructions func) (useInstruction use) "getUseInstr2" | 140 | getUseInstr2 func use = hml (functionInstructions func) (useInstruction use) "getUseInstr2" | 91 | false | true | 0 | 7 | 16 | 43 | 21 | 22 | null | null |
genos/online_problems | advent_of_code_2016/day12/hask_lens/src/Main.hs | mit | interpret (Inc r) = reg r += 1 | 32 | interpret (Inc r) = reg r += 1 | 32 | interpret (Inc r) = reg r += 1 | 32 | false | false | 0 | 6 | 9 | 23 | 10 | 13 | null | null |
Lainepress/easy | Text/RE/PCRE/RE.hs | bsd-3-clause | edMS = edMultilineSensitive | 47 | edMS = edMultilineSensitive | 47 | edMS = edMultilineSensitive | 47 | false | false | 0 | 4 | 22 | 6 | 3 | 3 | null | null |
facebookincubator/duckling | Duckling/Time/SV/Rules.hs | bsd-3-clause | ruleIntersectBy :: Rule
ruleIntersectBy = Rule
{ name = "intersect by \",\""
, pattern =
[ Predicate isNotLatent
, regex ","
, Predicate isNotLatent
]
, prod = \tokens -> case tokens of
(Token Time td1:_:Token Time td2:_) ->
Token Time <$> intersect td1 td2
_ -> Nothing
} | 316 | ruleIntersectBy :: Rule
ruleIntersectBy = Rule
{ name = "intersect by \",\""
, pattern =
[ Predicate isNotLatent
, regex ","
, Predicate isNotLatent
]
, prod = \tokens -> case tokens of
(Token Time td1:_:Token Time td2:_) ->
Token Time <$> intersect td1 td2
_ -> Nothing
} | 316 | ruleIntersectBy = Rule
{ name = "intersect by \",\""
, pattern =
[ Predicate isNotLatent
, regex ","
, Predicate isNotLatent
]
, prod = \tokens -> case tokens of
(Token Time td1:_:Token Time td2:_) ->
Token Time <$> intersect td1 td2
_ -> Nothing
} | 292 | false | true | 0 | 16 | 92 | 111 | 57 | 54 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/Layout.hs | lgpl-2.1 | windowReLayout :: Window a -> IO ()
windowReLayout w
= do _ <- windowLayout w
old <- windowGetClientSize w
szr <- windowGetSizer w
when (not (objectIsNull szr)) (sizerSetSizeHints szr w)
windowFit w
new <- windowGetClientSize w
windowSetClientSize w (sizeMax old new)
-- | Re-invoke layout algorithm to fit a window around its
-- children. It will resize the window to its minimal
-- acceptable size ('windowFit'). | 462 | windowReLayout :: Window a -> IO ()
windowReLayout w
= do _ <- windowLayout w
old <- windowGetClientSize w
szr <- windowGetSizer w
when (not (objectIsNull szr)) (sizerSetSizeHints szr w)
windowFit w
new <- windowGetClientSize w
windowSetClientSize w (sizeMax old new)
-- | Re-invoke layout algorithm to fit a window around its
-- children. It will resize the window to its minimal
-- acceptable size ('windowFit'). | 462 | windowReLayout w
= do _ <- windowLayout w
old <- windowGetClientSize w
szr <- windowGetSizer w
when (not (objectIsNull szr)) (sizerSetSizeHints szr w)
windowFit w
new <- windowGetClientSize w
windowSetClientSize w (sizeMax old new)
-- | Re-invoke layout algorithm to fit a window around its
-- children. It will resize the window to its minimal
-- acceptable size ('windowFit'). | 426 | false | true | 0 | 11 | 113 | 119 | 53 | 66 | null | null |
stgm/prac-testing | week5/Week5.hs | mit | decomp :: Integer -> (Integer,Integer)
decomp n = decomp' (0,n) where
decomp' = while1 (\ (_,m) -> even m)
(\ (k,m) -> (k+1,m `div` 2)) | 156 | decomp :: Integer -> (Integer,Integer)
decomp n = decomp' (0,n) where
decomp' = while1 (\ (_,m) -> even m)
(\ (k,m) -> (k+1,m `div` 2)) | 156 | decomp n = decomp' (0,n) where
decomp' = while1 (\ (_,m) -> even m)
(\ (k,m) -> (k+1,m `div` 2)) | 117 | false | true | 0 | 9 | 45 | 91 | 53 | 38 | null | null |
alexander-at-github/eta | compiler/ETA/Utils/UniqFM.hs | bsd-3-clause | isNullUFM (UFM m) = M.null m | 28 | isNullUFM (UFM m) = M.null m | 28 | isNullUFM (UFM m) = M.null m | 28 | false | false | 0 | 7 | 5 | 20 | 9 | 11 | null | null |
opentower/carnap | Carnap-GHCJS/src/Carnap/GHCJS/Action/SyntaxCheck.hs | gpl-3.0 | activateChecker :: Document -> Maybe (Element, Element, M.Map String String) -> IO ()
activateChecker w (Just (i,o,opts)) =
case M.lookup "matchtype" opts of
(Just "match") -> activateMatchWith (rewriteWith opts . show)
(Just "matchclean") -> activateMatchWith (rewriteWith opts . showClean)
_ -> return ()
where formParser = maybe (purePropFormulaParser standardLetters) id (M.lookup "system" opts >>= (ndParseForm `ofPropSys`))
activateMatchWith :: (PureForm -> String) -> IO ()
activateMatchWith sf =
case M.lookup "goal" opts of
Just g ->
case parse (formParser <* eof) "" g of
(Right f) -> do
bw <- createButtonWrapper w o
ref <- newIORef (f,[(f,0)], T.Node (f,0) [], 0)
let submit = submitSyn opts ref
btStatus <- createSubmitButton w bw submit opts
(Just tree) <- createElement w (Just "div")
appendChild o (Just tree)
setInnerHTML tree (Just $ sf f)
setAttribute tree "class" "tree"
mpar@(Just par) <- getParentNode o
insertBefore par (Just bw) (Just o)
match <- newListener $ tryMatch tree ref w sf opts
(Just w') <- getDefaultView w
doOnce i keyUp False $ liftIO $ btStatus Edited
addListener i keyUp match False
(Left e) -> setInnerHTML o (Just $ show e)
_ -> print "syntax check was missing an option" | 1,826 | activateChecker :: Document -> Maybe (Element, Element, M.Map String String) -> IO ()
activateChecker w (Just (i,o,opts)) =
case M.lookup "matchtype" opts of
(Just "match") -> activateMatchWith (rewriteWith opts . show)
(Just "matchclean") -> activateMatchWith (rewriteWith opts . showClean)
_ -> return ()
where formParser = maybe (purePropFormulaParser standardLetters) id (M.lookup "system" opts >>= (ndParseForm `ofPropSys`))
activateMatchWith :: (PureForm -> String) -> IO ()
activateMatchWith sf =
case M.lookup "goal" opts of
Just g ->
case parse (formParser <* eof) "" g of
(Right f) -> do
bw <- createButtonWrapper w o
ref <- newIORef (f,[(f,0)], T.Node (f,0) [], 0)
let submit = submitSyn opts ref
btStatus <- createSubmitButton w bw submit opts
(Just tree) <- createElement w (Just "div")
appendChild o (Just tree)
setInnerHTML tree (Just $ sf f)
setAttribute tree "class" "tree"
mpar@(Just par) <- getParentNode o
insertBefore par (Just bw) (Just o)
match <- newListener $ tryMatch tree ref w sf opts
(Just w') <- getDefaultView w
doOnce i keyUp False $ liftIO $ btStatus Edited
addListener i keyUp match False
(Left e) -> setInnerHTML o (Just $ show e)
_ -> print "syntax check was missing an option" | 1,826 | activateChecker w (Just (i,o,opts)) =
case M.lookup "matchtype" opts of
(Just "match") -> activateMatchWith (rewriteWith opts . show)
(Just "matchclean") -> activateMatchWith (rewriteWith opts . showClean)
_ -> return ()
where formParser = maybe (purePropFormulaParser standardLetters) id (M.lookup "system" opts >>= (ndParseForm `ofPropSys`))
activateMatchWith :: (PureForm -> String) -> IO ()
activateMatchWith sf =
case M.lookup "goal" opts of
Just g ->
case parse (formParser <* eof) "" g of
(Right f) -> do
bw <- createButtonWrapper w o
ref <- newIORef (f,[(f,0)], T.Node (f,0) [], 0)
let submit = submitSyn opts ref
btStatus <- createSubmitButton w bw submit opts
(Just tree) <- createElement w (Just "div")
appendChild o (Just tree)
setInnerHTML tree (Just $ sf f)
setAttribute tree "class" "tree"
mpar@(Just par) <- getParentNode o
insertBefore par (Just bw) (Just o)
match <- newListener $ tryMatch tree ref w sf opts
(Just w') <- getDefaultView w
doOnce i keyUp False $ liftIO $ btStatus Edited
addListener i keyUp match False
(Left e) -> setInnerHTML o (Just $ show e)
_ -> print "syntax check was missing an option" | 1,740 | false | true | 21 | 11 | 804 | 517 | 267 | 250 | null | null |
Arguggi/Frinfo | app/Main.hs | mit | main' :: Flags -> StaticState -> SystemState -> IO ()
main' flags staticS systemS = do
let songMVar = staticS ^. dbusState
emailMVar = staticS ^. emailState
when (mpd flags) $ void (fork (connectToMPD songMVar))
when (spotify flags) $ void (fork (connectToDbus songMVar))
when (inotify flags) $ void (fork (watchEmailFolder emailMVar))
printLoop staticS systemS | 389 | main' :: Flags -> StaticState -> SystemState -> IO ()
main' flags staticS systemS = do
let songMVar = staticS ^. dbusState
emailMVar = staticS ^. emailState
when (mpd flags) $ void (fork (connectToMPD songMVar))
when (spotify flags) $ void (fork (connectToDbus songMVar))
when (inotify flags) $ void (fork (watchEmailFolder emailMVar))
printLoop staticS systemS | 389 | main' flags staticS systemS = do
let songMVar = staticS ^. dbusState
emailMVar = staticS ^. emailState
when (mpd flags) $ void (fork (connectToMPD songMVar))
when (spotify flags) $ void (fork (connectToDbus songMVar))
when (inotify flags) $ void (fork (watchEmailFolder emailMVar))
printLoop staticS systemS | 335 | false | true | 0 | 12 | 81 | 158 | 73 | 85 | null | null |
randen/haddock | haddock-api/src/Haddock/Utils.hs | bsd-2-clause | escapeURIString :: (Char -> Bool) -> String -> String
escapeURIString = concatMap . escapeURIChar | 97 | escapeURIString :: (Char -> Bool) -> String -> String
escapeURIString = concatMap . escapeURIChar | 97 | escapeURIString = concatMap . escapeURIChar | 43 | false | true | 0 | 8 | 13 | 37 | 17 | 20 | null | null |
binesiyu/ifl | examples/ch12/Barcode.hs | mit | buildMap :: [[Parity Digit]] -> DigitMap
buildMap = M.mapKeys (10 -)
. addFirstDigit
. finalDigits | 116 | buildMap :: [[Parity Digit]] -> DigitMap
buildMap = M.mapKeys (10 -)
. addFirstDigit
. finalDigits | 116 | buildMap = M.mapKeys (10 -)
. addFirstDigit
. finalDigits | 75 | false | true | 0 | 8 | 32 | 41 | 22 | 19 | null | null |
AlexanderPankiv/ghc | compiler/typecheck/TcEvidence.hs | bsd-3-clause | ppr_co p (TcPhantomCo t1 t2) = pprPrefixApp p (ptext (sLit "PhantomCo")) [pprParendType t1, pprParendType t2] | 110 | ppr_co p (TcPhantomCo t1 t2) = pprPrefixApp p (ptext (sLit "PhantomCo")) [pprParendType t1, pprParendType t2] | 110 | ppr_co p (TcPhantomCo t1 t2) = pprPrefixApp p (ptext (sLit "PhantomCo")) [pprParendType t1, pprParendType t2] | 110 | false | false | 0 | 9 | 15 | 50 | 24 | 26 | null | null |
haskell-streaming/streaming | src/Streaming/Prelude.hs | bsd-3-clause | {-| @fst'@ and @snd'@ extract the first and second element of a pair
>>> S.fst' (1:>"hi")
1
>>> S.snd' (1:>"hi")
"hi"
They are contained in the @_first@ and @_second@ lenses,
if any lens library is in scope
>>> import Lens.Micro
>>> (1:>"hi") ^. S._first
1
>>> (1:>"hi") ^. S._second
"hi"
-}
fst' :: Of a b -> a
fst' (a :> _) = a | 346 | fst' :: Of a b -> a
fst' (a :> _) = a | 37 | fst' (a :> _) = a | 17 | true | true | 0 | 9 | 80 | 37 | 17 | 20 | null | null |
eryx67/vk-api | src/VK/API/CommonTypes.hs | bsd-3-clause | ownerIdToInt :: OwnerId -> Int
ownerIdToInt (GroupId v) = -v | 60 | ownerIdToInt :: OwnerId -> Int
ownerIdToInt (GroupId v) = -v | 60 | ownerIdToInt (GroupId v) = -v | 29 | false | true | 0 | 7 | 9 | 26 | 13 | 13 | null | null |
urbanslug/ghc | compiler/hsSyn/HsDecls.hs | bsd-3-clause | -- | type class
isClassDecl :: TyClDecl name -> Bool
isClassDecl (ClassDecl {}) = True | 86 | isClassDecl :: TyClDecl name -> Bool
isClassDecl (ClassDecl {}) = True | 70 | isClassDecl (ClassDecl {}) = True | 33 | true | true | 0 | 7 | 14 | 29 | 15 | 14 | null | null |
sitewisely/zellige | src/Data/Geometry/Clip/Internal/LineNichollLeeNicholl.hs | apache-2.0 | -- Reflect point about the line x = -y
reflectPointXMinusY :: Geospatial.PointXY -> Geospatial.PointXY
reflectPointXMinusY (Geospatial.PointXY x y) =
Geospatial.PointXY (-y) (-x) | 180 | reflectPointXMinusY :: Geospatial.PointXY -> Geospatial.PointXY
reflectPointXMinusY (Geospatial.PointXY x y) =
Geospatial.PointXY (-y) (-x) | 141 | reflectPointXMinusY (Geospatial.PointXY x y) =
Geospatial.PointXY (-y) (-x) | 77 | true | true | 0 | 10 | 23 | 56 | 27 | 29 | null | null |
stackbuilders/octohat | src-demo/Web/GitHub/CLI/Options.hs | mit | listMembers :: Parser TeamCommand
listMembers = ListMembers <$> argument str (metavar "<organization-name>")
<*> argument str (metavar "<team-name>") | 175 | listMembers :: Parser TeamCommand
listMembers = ListMembers <$> argument str (metavar "<organization-name>")
<*> argument str (metavar "<team-name>") | 175 | listMembers = ListMembers <$> argument str (metavar "<organization-name>")
<*> argument str (metavar "<team-name>") | 141 | false | true | 1 | 9 | 42 | 47 | 21 | 26 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.