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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lally/libmet | src/Ppt/Agent/ElfProtocol.hs | bsd-3-clause | getBuffers :: Int -> E.Elf -> [E.ElfSymbolTableEntry]
getBuffers pid process = symbolsWithPrefix process hmem_pfx | 113 | getBuffers :: Int -> E.Elf -> [E.ElfSymbolTableEntry]
getBuffers pid process = symbolsWithPrefix process hmem_pfx | 113 | getBuffers pid process = symbolsWithPrefix process hmem_pfx | 59 | false | true | 0 | 10 | 13 | 41 | 19 | 22 | null | null |
sdiehl/ghc | testsuite/tests/parser/should_compile/T1087.hs | bsd-3-clause | infix_tilde_2 = let a .!. ~b = False in 1 .!. 2 | 47 | infix_tilde_2 = let a .!. ~b = False in 1 .!. 2 | 47 | infix_tilde_2 = let a .!. ~b = False in 1 .!. 2 | 47 | false | false | 1 | 10 | 11 | 32 | 12 | 20 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | happyReduction_290 _ = notHappyAtAll | 37 | happyReduction_290 _ = notHappyAtAll | 37 | happyReduction_290 _ = notHappyAtAll | 37 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
daewon/til | exercism/haskell/grade-school/src/School.hs | mpl-2.0 | add :: Grade -> String -> School -> School
add n name db = M.unionWith (++) db $ M.fromList [(n, [name])] | 105 | add :: Grade -> String -> School -> School
add n name db = M.unionWith (++) db $ M.fromList [(n, [name])] | 105 | add n name db = M.unionWith (++) db $ M.fromList [(n, [name])] | 62 | false | true | 0 | 9 | 20 | 64 | 33 | 31 | null | null |
pharpend/comarkdown | lib/Text/Comarkdown/Combinators.hs | gpl-3.0 | withStdlib :: DocumentM x -> DocumentM x
withStdlib x = L.stdlib >> x | 69 | withStdlib :: DocumentM x -> DocumentM x
withStdlib x = L.stdlib >> x | 69 | withStdlib x = L.stdlib >> x | 28 | false | true | 2 | 7 | 12 | 36 | 15 | 21 | null | null |
jlamothe/sortable-test | Common.hs | gpl-3.0 | decode :: String -> InputData
decode rawInput = case parseCSV "" rawInput of
Right csv -> build csv
_ -> emptyInputData | 131 | decode :: String -> InputData
decode rawInput = case parseCSV "" rawInput of
Right csv -> build csv
_ -> emptyInputData | 131 | decode rawInput = case parseCSV "" rawInput of
Right csv -> build csv
_ -> emptyInputData | 101 | false | true | 3 | 6 | 32 | 44 | 21 | 23 | null | null |
randen/haddock | haddock-api/src/Haddock/Utils.hs | bsd-2-clause | markup m (DocIdentifierUnchecked x) = markupIdentifierUnchecked m x | 68 | markup m (DocIdentifierUnchecked x) = markupIdentifierUnchecked m x | 68 | markup m (DocIdentifierUnchecked x) = markupIdentifierUnchecked m x | 68 | false | false | 0 | 6 | 8 | 24 | 10 | 14 | null | null |
ribag/ganeti-experiments | src/Ganeti/Storage/Drbd/Parser.hs | gpl-2.0 | timeParser :: Parser Time
timeParser = Time <$> h <*> m <*> s
where h = A.decimal :: Parser Int
m = A.char ':' *> A.decimal :: Parser Int
s = A.char ':' *> A.decimal :: Parser Int
-- | The parser for recognizing time units (only the ones actually
-- found in DRBD files are implemented). | 306 | timeParser :: Parser Time
timeParser = Time <$> h <*> m <*> s
where h = A.decimal :: Parser Int
m = A.char ':' *> A.decimal :: Parser Int
s = A.char ':' *> A.decimal :: Parser Int
-- | The parser for recognizing time units (only the ones actually
-- found in DRBD files are implemented). | 306 | timeParser = Time <$> h <*> m <*> s
where h = A.decimal :: Parser Int
m = A.char ':' *> A.decimal :: Parser Int
s = A.char ':' *> A.decimal :: Parser Int
-- | The parser for recognizing time units (only the ones actually
-- found in DRBD files are implemented). | 280 | false | true | 9 | 7 | 75 | 81 | 43 | 38 | null | null |
nevrenato/Hets_Fork | OWL2/ProfilesAndSublogics.hs | gpl-2.0 | maxS :: ProfSub -> ProfSub -> ProfSub
maxS ps1 ps2 = ProfSub (andProfileList [profiles ps1, profiles ps2])
(slMax (sublogic ps1) (sublogic ps2)) | 148 | maxS :: ProfSub -> ProfSub -> ProfSub
maxS ps1 ps2 = ProfSub (andProfileList [profiles ps1, profiles ps2])
(slMax (sublogic ps1) (sublogic ps2)) | 148 | maxS ps1 ps2 = ProfSub (andProfileList [profiles ps1, profiles ps2])
(slMax (sublogic ps1) (sublogic ps2)) | 110 | false | true | 0 | 9 | 25 | 74 | 34 | 40 | null | null |
d-day/relation | include/pointfree-style/pointfree-1.0.4.3/Plugin/Pl/Optimize.hs | bsd-3-clause | rew r@(Opt {}) e = rewrite r e | 33 | rew r@(Opt {}) e = rewrite r e | 33 | rew r@(Opt {}) e = rewrite r e | 33 | false | false | 1 | 7 | 10 | 26 | 13 | 13 | null | null |
ghorn/dynobud | dynobud-vectorize/src/Dyno/Vectorize.hs | lgpl-3.0 | -- | Make a diagonal "matrix" from a "vector".
-- Off-diagonal elements will be 0, thus the Num constraint.
vdiag :: forall f a . (Vectorize f, Num a) => f a -> f (f a)
vdiag = flip vdiag' 0 | 190 | vdiag :: forall f a . (Vectorize f, Num a) => f a -> f (f a)
vdiag = flip vdiag' 0 | 82 | vdiag = flip vdiag' 0 | 21 | true | true | 0 | 11 | 40 | 60 | 30 | 30 | null | null |
sol/pandoc | src/Text/Pandoc/Writers/LaTeX.hs | gpl-2.0 | inlineToLaTeX (Code (_,classes,_) str) = do
opts <- gets stOptions
case () of
_ | writerListings opts -> listingsCode
| writerHighlight opts && not (null classes) -> highlightCode
| otherwise -> rawCode
where listingsCode = do
inNote <- gets stInNote
when inNote $ modify $ \s -> s{ stVerbInNote = True }
let chr = ((enumFromTo '!' '~') \\ str) !! 0
return $ text $ "\\lstinline" ++ [chr] ++ str ++ [chr]
highlightCode = do
case highlight formatLaTeXInline ("",classes,[]) str of
Nothing -> rawCode
Just h -> modify (\st -> st{ stHighlighting = True }) >>
return (text h)
rawCode = return
$ text $ "\\texttt{" ++ stringToLaTeX False str ++ "}" | 884 | inlineToLaTeX (Code (_,classes,_) str) = do
opts <- gets stOptions
case () of
_ | writerListings opts -> listingsCode
| writerHighlight opts && not (null classes) -> highlightCode
| otherwise -> rawCode
where listingsCode = do
inNote <- gets stInNote
when inNote $ modify $ \s -> s{ stVerbInNote = True }
let chr = ((enumFromTo '!' '~') \\ str) !! 0
return $ text $ "\\lstinline" ++ [chr] ++ str ++ [chr]
highlightCode = do
case highlight formatLaTeXInline ("",classes,[]) str of
Nothing -> rawCode
Just h -> modify (\st -> st{ stHighlighting = True }) >>
return (text h)
rawCode = return
$ text $ "\\texttt{" ++ stringToLaTeX False str ++ "}" | 884 | inlineToLaTeX (Code (_,classes,_) str) = do
opts <- gets stOptions
case () of
_ | writerListings opts -> listingsCode
| writerHighlight opts && not (null classes) -> highlightCode
| otherwise -> rawCode
where listingsCode = do
inNote <- gets stInNote
when inNote $ modify $ \s -> s{ stVerbInNote = True }
let chr = ((enumFromTo '!' '~') \\ str) !! 0
return $ text $ "\\lstinline" ++ [chr] ++ str ++ [chr]
highlightCode = do
case highlight formatLaTeXInline ("",classes,[]) str of
Nothing -> rawCode
Just h -> modify (\st -> st{ stHighlighting = True }) >>
return (text h)
rawCode = return
$ text $ "\\texttt{" ++ stringToLaTeX False str ++ "}" | 884 | false | false | 7 | 16 | 353 | 311 | 147 | 164 | null | null |
elieux/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | -- Class Monad
monadClassName, thenMName, bindMName, returnMName, failMName_preMFP :: Name
monadClassName = clsQual gHC_BASE (fsLit "Monad") monadClassKey | 159 | monadClassName, thenMName, bindMName, returnMName, failMName_preMFP :: Name
monadClassName = clsQual gHC_BASE (fsLit "Monad") monadClassKey | 144 | monadClassName = clsQual gHC_BASE (fsLit "Monad") monadClassKey | 68 | true | true | 0 | 7 | 21 | 33 | 21 | 12 | null | null |
SKA-ScienceDataProcessor/RC | MS2/lib/OskarCfg/generator/OskarCfgGenerator.hs | apache-2.0 | showTn :: TypeName -> String
showTn (TyIntegral TyInt) = "Int" | 62 | showTn :: TypeName -> String
showTn (TyIntegral TyInt) = "Int" | 62 | showTn (TyIntegral TyInt) = "Int" | 33 | false | true | 0 | 7 | 9 | 24 | 12 | 12 | null | null |
spinda/liquidhaskell | src/Language/Haskell/Liquid/PrettyPrint.hs | bsd-3-clause | ppSpine (RHole _) = text "RHole" | 39 | ppSpine (RHole _) = text "RHole" | 39 | ppSpine (RHole _) = text "RHole" | 39 | false | false | 0 | 7 | 12 | 18 | 8 | 10 | null | null |
rcobbe/language-tools | test/Latin/ScannerTest.hs | apache-2.0 | tests = "Latin.ScannerTest" ~:
[punctuationTests,
stringTests,
symbolTests,
blockCommentTests,
numberTests] | 121 | tests = "Latin.ScannerTest" ~:
[punctuationTests,
stringTests,
symbolTests,
blockCommentTests,
numberTests] | 121 | tests = "Latin.ScannerTest" ~:
[punctuationTests,
stringTests,
symbolTests,
blockCommentTests,
numberTests] | 121 | false | false | 0 | 6 | 22 | 25 | 15 | 10 | null | null |
siddhanathan/ghc | libraries/base/Data/Foldable.hs | bsd-3-clause | -- | The concatenation of all the elements of a container of lists.
concat :: Foldable t => t [a] -> [a]
concat xs = build (\c n -> foldr (\x y -> foldr c y x) n xs) | 165 | concat :: Foldable t => t [a] -> [a]
concat xs = build (\c n -> foldr (\x y -> foldr c y x) n xs) | 97 | concat xs = build (\c n -> foldr (\x y -> foldr c y x) n xs) | 60 | true | true | 0 | 11 | 38 | 72 | 37 | 35 | null | null |
jamessanders/easy-http | src/Network/EasyHttp/Server.hs | bsd-3-clause | showbs :: Show a => a -> C.ByteString
showbs = C.pack . show | 60 | showbs :: Show a => a -> C.ByteString
showbs = C.pack . show | 60 | showbs = C.pack . show | 22 | false | true | 0 | 7 | 12 | 30 | 15 | 15 | null | null |
jstolarek/lattice-structure-hs | tests/Signal/Wavelet/List/CommonTest.hs | bsd-3-clause | propIdentityShift2 :: [Double] -> Bool
propIdentityShift2 xs = csr (csl xs) == xs | 81 | propIdentityShift2 :: [Double] -> Bool
propIdentityShift2 xs = csr (csl xs) == xs | 81 | propIdentityShift2 xs = csr (csl xs) == xs | 42 | false | true | 0 | 8 | 12 | 34 | 17 | 17 | null | null |
bos/statistics | Statistics/Sample.hs | bsd-2-clause | -- | Standard deviation. This is simply the square root of the
-- maximum likelihood estimate of the variance.
fastStdDev :: (G.Vector v Double) => v Double -> Double
fastStdDev = sqrt . fastVariance | 200 | fastStdDev :: (G.Vector v Double) => v Double -> Double
fastStdDev = sqrt . fastVariance | 88 | fastStdDev = sqrt . fastVariance | 32 | true | true | 0 | 7 | 34 | 37 | 20 | 17 | null | null |
Saulzar/reflex-animation | src/Reflex/Monad/Time.hs | bsd-3-clause | playOn :: MonadTime t time m => Event t (Clip time a) -> m (Behavior t (Maybe a), Event t ())
playOn e = do
time <- getTime
done <- delay_ (period <$> e)
b <- hold (constant Nothing) $
leftmost [constant Nothing <$ done, fmap Just <$> animateOn (clamped <$> e) time]
return (join b, done)
-- | Helper functions using filter with Eq | 356 | playOn :: MonadTime t time m => Event t (Clip time a) -> m (Behavior t (Maybe a), Event t ())
playOn e = do
time <- getTime
done <- delay_ (period <$> e)
b <- hold (constant Nothing) $
leftmost [constant Nothing <$ done, fmap Just <$> animateOn (clamped <$> e) time]
return (join b, done)
-- | Helper functions using filter with Eq | 356 | playOn e = do
time <- getTime
done <- delay_ (period <$> e)
b <- hold (constant Nothing) $
leftmost [constant Nothing <$ done, fmap Just <$> animateOn (clamped <$> e) time]
return (join b, done)
-- | Helper functions using filter with Eq | 261 | false | true | 0 | 15 | 89 | 169 | 79 | 90 | null | null |
bgamari/text | tests/Tests/Properties.hs | bsd-2-clause | t_reverse = L.reverse `eqP` (unpackS . T.reverse) | 57 | t_reverse = L.reverse `eqP` (unpackS . T.reverse) | 57 | t_reverse = L.reverse `eqP` (unpackS . T.reverse) | 57 | false | false | 0 | 8 | 14 | 23 | 13 | 10 | null | null |
FranklinChen/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | processAccess :: Bool -- ^ Reexporting?
-> IBCPhase
-> Archive -> Idris ()
processAccess reexp phase ar = do
ds <- getEntry [] "ibc_access" ar
mapM_ (\ (n, a_in) -> do
let a = if reexp then a_in else Hidden
logIBC 3 $ "Setting " ++ show (a, n) ++ " to " ++ show a
updateIState (\i -> i { tt_ctxt = setAccess n a (tt_ctxt i) })
if (not reexp)
then do
logIBC 2 $ "Not exporting " ++ show n
setAccessibility n Hidden
else logIBC 2 $ "Exporting " ++ show n
-- Everything should be available at the REPL from
-- things imported publicly
when (phase == IBC_REPL True) $ setAccessibility n Public) ds | 736 | processAccess :: Bool -- ^ Reexporting?
-> IBCPhase
-> Archive -> Idris ()
processAccess reexp phase ar = do
ds <- getEntry [] "ibc_access" ar
mapM_ (\ (n, a_in) -> do
let a = if reexp then a_in else Hidden
logIBC 3 $ "Setting " ++ show (a, n) ++ " to " ++ show a
updateIState (\i -> i { tt_ctxt = setAccess n a (tt_ctxt i) })
if (not reexp)
then do
logIBC 2 $ "Not exporting " ++ show n
setAccessibility n Hidden
else logIBC 2 $ "Exporting " ++ show n
-- Everything should be available at the REPL from
-- things imported publicly
when (phase == IBC_REPL True) $ setAccessibility n Public) ds | 736 | processAccess reexp phase ar = do
ds <- getEntry [] "ibc_access" ar
mapM_ (\ (n, a_in) -> do
let a = if reexp then a_in else Hidden
logIBC 3 $ "Setting " ++ show (a, n) ++ " to " ++ show a
updateIState (\i -> i { tt_ctxt = setAccess n a (tt_ctxt i) })
if (not reexp)
then do
logIBC 2 $ "Not exporting " ++ show n
setAccessibility n Hidden
else logIBC 2 $ "Exporting " ++ show n
-- Everything should be available at the REPL from
-- things imported publicly
when (phase == IBC_REPL True) $ setAccessibility n Public) ds | 639 | false | true | 0 | 19 | 260 | 243 | 118 | 125 | null | null |
UCSD-PL/RefScript | src/Language/Rsc/Liquid/Types.hs | bsd-3-clause | noKVars :: F.Reft -> F.Reft
--------------------------------------------------------------------------------
noKVars (F.Reft (x, p)) = F.Reft (x, dropKs p)
where
dropKs = F.pAnd . filter (not . isK) . F.conjuncts
isK (F.PKVar {}) = True
isK _ = False
--------------------------------------------------------------------------------
-- | Substitutions
-------------------------------------------------------------------------------- | 477 | noKVars :: F.Reft -> F.Reft
noKVars (F.Reft (x, p)) = F.Reft (x, dropKs p)
where
dropKs = F.pAnd . filter (not . isK) . F.conjuncts
isK (F.PKVar {}) = True
isK _ = False
--------------------------------------------------------------------------------
-- | Substitutions
-------------------------------------------------------------------------------- | 396 | noKVars (F.Reft (x, p)) = F.Reft (x, dropKs p)
where
dropKs = F.pAnd . filter (not . isK) . F.conjuncts
isK (F.PKVar {}) = True
isK _ = False
--------------------------------------------------------------------------------
-- | Substitutions
-------------------------------------------------------------------------------- | 368 | true | true | 0 | 9 | 85 | 109 | 58 | 51 | null | null |
forste/haReFork | refactorer/RefacDataNewType.hs | bsd-3-clause | addNewType dataDec (_,_, mod) = do
let newType = createNewType dataDec
-- res <- addDecl mod Nothing ([newType], Nothing) True
res <- update dataDec newType mod
return res | 249 | addNewType dataDec (_,_, mod) = do
let newType = createNewType dataDec
-- res <- addDecl mod Nothing ([newType], Nothing) True
res <- update dataDec newType mod
return res | 249 | addNewType dataDec (_,_, mod) = do
let newType = createNewType dataDec
-- res <- addDecl mod Nothing ([newType], Nothing) True
res <- update dataDec newType mod
return res | 249 | false | false | 0 | 10 | 105 | 54 | 25 | 29 | null | null |
tsurucapital/elerea-network | src/FRP/Elerea/Network/Packet.hs | bsd-3-clause | buildPacketType AckPacket = Builder.fromByteString "ACK " | 62 | buildPacketType AckPacket = Builder.fromByteString "ACK " | 62 | buildPacketType AckPacket = Builder.fromByteString "ACK " | 62 | false | false | 0 | 6 | 10 | 15 | 6 | 9 | null | null |
event/spim | MIMEDir.hs | agpl-3.0 | mimeDirContent2Cls :: MIMEDirContents -> [ContentLine]
mimeDirContent2Cls =
Map.foldWithKey (\k v res ->
let cls = case v of
Left propAndVal -> dirContentEntry2Cls k propAndVal
Right nestedDir -> mimeDir2ContentLines nestedDir
in cls ++ res) [] | 374 | mimeDirContent2Cls :: MIMEDirContents -> [ContentLine]
mimeDirContent2Cls =
Map.foldWithKey (\k v res ->
let cls = case v of
Left propAndVal -> dirContentEntry2Cls k propAndVal
Right nestedDir -> mimeDir2ContentLines nestedDir
in cls ++ res) [] | 374 | mimeDirContent2Cls =
Map.foldWithKey (\k v res ->
let cls = case v of
Left propAndVal -> dirContentEntry2Cls k propAndVal
Right nestedDir -> mimeDir2ContentLines nestedDir
in cls ++ res) [] | 319 | false | true | 0 | 15 | 163 | 91 | 42 | 49 | null | null |
cocreature/leksah | src/IDE/SourceCandy.hs | gpl-2.0 | toReplaceParser :: CharParser () Text
toReplaceParser = lexeme (do
str <- between (char '"')
(char '"' <?> "end of string")
(P.many $noneOf "\"")
return $ T.pack str)
<?> "to replace string" | 261 | toReplaceParser :: CharParser () Text
toReplaceParser = lexeme (do
str <- between (char '"')
(char '"' <?> "end of string")
(P.many $noneOf "\"")
return $ T.pack str)
<?> "to replace string" | 261 | toReplaceParser = lexeme (do
str <- between (char '"')
(char '"' <?> "end of string")
(P.many $noneOf "\"")
return $ T.pack str)
<?> "to replace string" | 223 | false | true | 2 | 13 | 101 | 83 | 38 | 45 | null | null |
mainland/dph | dph-lifted-copy/Data/Array/Parallel/PArray/Scalar.hs | bsd-3-clause | applPRScalar segd xsegd xs ysegd ys
= traceF "applPRScalar"
$ toScalarPData
$ U.append_s segd xsegd (fromScalarPData xs)
ysegd (fromScalarPData ys) | 173 | applPRScalar segd xsegd xs ysegd ys
= traceF "applPRScalar"
$ toScalarPData
$ U.append_s segd xsegd (fromScalarPData xs)
ysegd (fromScalarPData ys) | 173 | applPRScalar segd xsegd xs ysegd ys
= traceF "applPRScalar"
$ toScalarPData
$ U.append_s segd xsegd (fromScalarPData xs)
ysegd (fromScalarPData ys) | 173 | false | false | 4 | 7 | 45 | 55 | 25 | 30 | null | null |
ecaustin/haskhol-deductive | src/HaskHOL/Lib/Itab.hs | bsd-2-clause | tacRIGHT_REVERSIBLE :: BoolCtxt thry => Tactic cls thry
tacRIGHT_REVERSIBLE =
_FIRST [ tacCONJ
, tacGEN
, tacDISCH
, \ gl@(Goal _ w) -> tacCONV (Conv $ \ _ -> ruleIMPLICATE w) gl
, tacEQ
] | 248 | tacRIGHT_REVERSIBLE :: BoolCtxt thry => Tactic cls thry
tacRIGHT_REVERSIBLE =
_FIRST [ tacCONJ
, tacGEN
, tacDISCH
, \ gl@(Goal _ w) -> tacCONV (Conv $ \ _ -> ruleIMPLICATE w) gl
, tacEQ
] | 248 | tacRIGHT_REVERSIBLE =
_FIRST [ tacCONJ
, tacGEN
, tacDISCH
, \ gl@(Goal _ w) -> tacCONV (Conv $ \ _ -> ruleIMPLICATE w) gl
, tacEQ
] | 192 | false | true | 0 | 12 | 94 | 83 | 42 | 41 | null | null |
mightymoose/liquidhaskell | tests/pos/zipper.hs | bsd-3-clause | -- LIQUID deriving (Show, Read, Eq)
-------------------------------------------------------------------------------
----------------------------- Refinements on Lists ---------------------------
-------------------------------------------------------------------------------
-- measures
{-@
measure listDup :: [a] -> (Set a)
listDup([]) = {v | Set_emp v }
listDup(x:xs) = {v | v = if (Set_mem x (listElts xs)) then (Set_cup (Set_sng x) (listDup xs)) else (listDup xs) }
@-}
-- predicates
{-@ predicate EqElts X Y =
((listElts X) = (listElts Y)) @-}
{-@ predicate SubElts X Y =
(Set_sub (listElts X) (listElts Y)) @-}
{-@ predicate UnionElts X Y Z =
((listElts X) = (Set_cup (listElts Y) (listElts Z))) @-}
{-@ predicate ListElt N LS =
(Set_mem N (listElts LS)) @-}
{-@ predicate ListUnique LS =
(Set_emp (listDup LS)) @-}
{-@ predicate ListDisjoint X Y =
(Set_emp (Set_cap (listElts X) (listElts Y))) @-}
-- types
{-@ type UList a = {v:[a] | (ListUnique v)} @-}
{-@ type UListDif a N = {v:[a] | ((not (ListElt N v)) && (ListUnique v))} @-}
-------------------------------------------------------------------------------
----------------------------- Refinements on Stacks ---------------------------
-------------------------------------------------------------------------------
{-@
data Stack a = Stack { focus :: a
, up :: UListDif a focus
, down :: UListDif a focus }
@-}
{-@ type UStack a = {v:Stack a | (ListDisjoint (getUp v) (getDown v))}@-}
{-@ measure getUp :: forall a. (Stack a) -> [a]
getUp (Stack focus up down) = up
@-}
{-@ measure getDown :: forall a. (Stack a) -> [a]
getDown (Stack focus up down) = down
@-}
-------------------------------------------------------------------------------
------------------------------ Functions on Stacks ----------------------------
-------------------------------------------------------------------------------
{-@ differentiate :: UList a -> Maybe (UStack a) @-}
differentiate :: [a] -> Maybe (Stack a)
differentiate [] = Nothing | 2,134 | differentiate :: [a] -> Maybe (Stack a)
differentiate [] = Nothing | 70 | differentiate [] = Nothing | 30 | true | true | 0 | 9 | 411 | 64 | 44 | 20 | null | null |
roelvandijk/numerals-base | src/Text/Numeral/Render.hs | bsd-3-clause | -------------------------------------------------------------------------------
-- Rendering numerals
-------------------------------------------------------------------------------
-- | Renders an expression to a string-like value according to a
-- certain representation and inflection.
render ∷ (Monoid s)
⇒ Repr i s -- ^ Representation.
→ i -- ^ Initial inflection.
→ Exp i -- ^ The expression to render.
→ Maybe s
render (Repr {..}) = go CtxEmpty
where
go _ _ Unknown = reprUnknown
go ctx inf (Lit n) = ($ ctx) <$> reprValue inf n
go ctx inf (Neg x) = do x' ← go (CtxNeg ctx) inf x
rn ← reprNeg
rnc ← reprNegCombine
Just $ rnc (rn x ctx) x' x
go ctx inf (Add x y) = do x' ← go (CtxAdd L y ctx) inf x
y' ← go (CtxAdd R x ctx) inf y
ra ← reprAdd
rac ← reprAddCombine
Just $ rac (ra x y ctx) x' x y' y
go ctx inf (Mul x y) = do x' ← go (CtxMul L y ctx) inf x
y' ← go (CtxMul R x ctx) inf y
rm ← reprMul
rmc ← reprMulCombine
Just $ rmc (rm x y ctx) x' x y' y
go ctx inf (Sub x y) = do x' ← go (CtxSub L y ctx) inf x
y' ← go (CtxSub R x ctx) inf y
rs ← reprSub
rsc ← reprSubCombine
Just $ rsc (rs x y ctx) x' x y' y
go ctx inf (Frac x y) = do x' ← go (CtxFrac L y ctx) inf x
y' ← go (CtxFrac R x ctx) inf y
rf ← reprFrac
rfc ← reprFracCombine
Just $ rfc (rf x y ctx) x' x y' y
go ctx inf (Scale b o r) = reprScale inf b o r ctx
go ctx inf (Dual x) = go (CtxDual ctx) inf x
go ctx inf (Plural x) = go (CtxPlural ctx) inf x
go ctx inf (Inflection f x) = go ctx (f inf) x
--------------------------------------------------------------------------------
-- Representation of numerals
--------------------------------------------------------------------------------
-- | A representation for numerals.
--
-- A 'Repr' contains all the information on how to render an
-- 'Exp'ression to a string-like value. | 2,526 | render ∷ (Monoid s)
⇒ Repr i s -- ^ Representation.
→ i -- ^ Initial inflection.
→ Exp i -- ^ The expression to render.
→ Maybe s
render (Repr {..}) = go CtxEmpty
where
go _ _ Unknown = reprUnknown
go ctx inf (Lit n) = ($ ctx) <$> reprValue inf n
go ctx inf (Neg x) = do x' ← go (CtxNeg ctx) inf x
rn ← reprNeg
rnc ← reprNegCombine
Just $ rnc (rn x ctx) x' x
go ctx inf (Add x y) = do x' ← go (CtxAdd L y ctx) inf x
y' ← go (CtxAdd R x ctx) inf y
ra ← reprAdd
rac ← reprAddCombine
Just $ rac (ra x y ctx) x' x y' y
go ctx inf (Mul x y) = do x' ← go (CtxMul L y ctx) inf x
y' ← go (CtxMul R x ctx) inf y
rm ← reprMul
rmc ← reprMulCombine
Just $ rmc (rm x y ctx) x' x y' y
go ctx inf (Sub x y) = do x' ← go (CtxSub L y ctx) inf x
y' ← go (CtxSub R x ctx) inf y
rs ← reprSub
rsc ← reprSubCombine
Just $ rsc (rs x y ctx) x' x y' y
go ctx inf (Frac x y) = do x' ← go (CtxFrac L y ctx) inf x
y' ← go (CtxFrac R x ctx) inf y
rf ← reprFrac
rfc ← reprFracCombine
Just $ rfc (rf x y ctx) x' x y' y
go ctx inf (Scale b o r) = reprScale inf b o r ctx
go ctx inf (Dual x) = go (CtxDual ctx) inf x
go ctx inf (Plural x) = go (CtxPlural ctx) inf x
go ctx inf (Inflection f x) = go ctx (f inf) x
--------------------------------------------------------------------------------
-- Representation of numerals
--------------------------------------------------------------------------------
-- | A representation for numerals.
--
-- A 'Repr' contains all the information on how to render an
-- 'Exp'ression to a string-like value. | 2,236 | render (Repr {..}) = go CtxEmpty
where
go _ _ Unknown = reprUnknown
go ctx inf (Lit n) = ($ ctx) <$> reprValue inf n
go ctx inf (Neg x) = do x' ← go (CtxNeg ctx) inf x
rn ← reprNeg
rnc ← reprNegCombine
Just $ rnc (rn x ctx) x' x
go ctx inf (Add x y) = do x' ← go (CtxAdd L y ctx) inf x
y' ← go (CtxAdd R x ctx) inf y
ra ← reprAdd
rac ← reprAddCombine
Just $ rac (ra x y ctx) x' x y' y
go ctx inf (Mul x y) = do x' ← go (CtxMul L y ctx) inf x
y' ← go (CtxMul R x ctx) inf y
rm ← reprMul
rmc ← reprMulCombine
Just $ rmc (rm x y ctx) x' x y' y
go ctx inf (Sub x y) = do x' ← go (CtxSub L y ctx) inf x
y' ← go (CtxSub R x ctx) inf y
rs ← reprSub
rsc ← reprSubCombine
Just $ rsc (rs x y ctx) x' x y' y
go ctx inf (Frac x y) = do x' ← go (CtxFrac L y ctx) inf x
y' ← go (CtxFrac R x ctx) inf y
rf ← reprFrac
rfc ← reprFracCombine
Just $ rfc (rf x y ctx) x' x y' y
go ctx inf (Scale b o r) = reprScale inf b o r ctx
go ctx inf (Dual x) = go (CtxDual ctx) inf x
go ctx inf (Plural x) = go (CtxPlural ctx) inf x
go ctx inf (Inflection f x) = go ctx (f inf) x
--------------------------------------------------------------------------------
-- Representation of numerals
--------------------------------------------------------------------------------
-- | A representation for numerals.
--
-- A 'Repr' contains all the information on how to render an
-- 'Exp'ression to a string-like value. | 2,068 | true | true | 4 | 11 | 1,080 | 798 | 366 | 432 | null | null |
peter-fogg/pardoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | breve 'a' = "ă" | 15 | breve 'a' = "ă" | 15 | breve 'a' = "ă" | 15 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ancientlanguage/haskell-analysis | prepare/src/Prepare/Decompose.hs | mit | decomposeChar '\xFA39' = "\x5840" | 33 | decomposeChar '\xFA39' = "\x5840" | 33 | decomposeChar '\xFA39' = "\x5840" | 33 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs | mit | decomposeChar '\x2F913' = "\x7039" | 34 | decomposeChar '\x2F913' = "\x7039" | 34 | decomposeChar '\x2F913' = "\x7039" | 34 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
hguenther/smtlib2 | backends/pipe/test/PipeTest.hs | gpl-3.0 | tests :: IO [Test]
tests = return [testProperty "round-trip"
(roundTripTest emptyContext (createPipe "z3" ["-smt2","-in"]))] | 140 | tests :: IO [Test]
tests = return [testProperty "round-trip"
(roundTripTest emptyContext (createPipe "z3" ["-smt2","-in"]))] | 140 | tests = return [testProperty "round-trip"
(roundTripTest emptyContext (createPipe "z3" ["-smt2","-in"]))] | 121 | false | true | 1 | 12 | 29 | 53 | 26 | 27 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Protocol.hs | bsd-3-clause | parseQueryResult (IfThenElseFloatI8 _ _ _) (IfThenElseI8Reply r) = Just $ ExprRight $ lit r | 91 | parseQueryResult (IfThenElseFloatI8 _ _ _) (IfThenElseI8Reply r) = Just $ ExprRight $ lit r | 91 | parseQueryResult (IfThenElseFloatI8 _ _ _) (IfThenElseI8Reply r) = Just $ ExprRight $ lit r | 91 | false | false | 0 | 7 | 13 | 38 | 18 | 20 | null | null |
Heather/stack | src/Stack/Ghci.hs | bsd-3-clause | getExtraLoadDeps
:: Bool
-> SourceMap
-> [(PackageName, (Path Abs File, SimpleTarget))]
-> [(PackageName, (Path Abs File, SimpleTarget))]
getExtraLoadDeps loadAllDeps sourceMap targets =
M.toList $
(\mp -> foldl' (flip M.delete) mp (map fst targets)) $
M.mapMaybe id $
execState (mapM_ (mapM_ go . getDeps . fst) targets)
(M.fromList (map (\(k, x) -> (k, Just x)) targets))
where
getDeps :: PackageName -> [PackageName]
getDeps name =
case M.lookup name sourceMap of
Just (PSLocal lp) -> M.keys (packageDeps (lpPackage lp))
_ -> []
go :: PackageName -> State (Map PackageName (Maybe (Path Abs File, SimpleTarget))) Bool
go name = do
cache <- get
case (M.lookup name cache, M.lookup name sourceMap) of
(Just (Just _), _) -> return True
(Just Nothing, _) | not loadAllDeps -> return False
(_, Just (PSLocal lp)) -> do
let deps = M.keys (packageDeps (lpPackage lp))
shouldLoad <- liftM or $ mapM go deps
if shouldLoad
then do
modify (M.insert name (Just (lpCabalFile lp, STLocalComps (S.singleton CLib))))
return True
else do
modify (M.insert name Nothing)
return False
(_, Just PSUpstream{}) -> return loadAllDeps
(_, _) -> return False | 1,490 | getExtraLoadDeps
:: Bool
-> SourceMap
-> [(PackageName, (Path Abs File, SimpleTarget))]
-> [(PackageName, (Path Abs File, SimpleTarget))]
getExtraLoadDeps loadAllDeps sourceMap targets =
M.toList $
(\mp -> foldl' (flip M.delete) mp (map fst targets)) $
M.mapMaybe id $
execState (mapM_ (mapM_ go . getDeps . fst) targets)
(M.fromList (map (\(k, x) -> (k, Just x)) targets))
where
getDeps :: PackageName -> [PackageName]
getDeps name =
case M.lookup name sourceMap of
Just (PSLocal lp) -> M.keys (packageDeps (lpPackage lp))
_ -> []
go :: PackageName -> State (Map PackageName (Maybe (Path Abs File, SimpleTarget))) Bool
go name = do
cache <- get
case (M.lookup name cache, M.lookup name sourceMap) of
(Just (Just _), _) -> return True
(Just Nothing, _) | not loadAllDeps -> return False
(_, Just (PSLocal lp)) -> do
let deps = M.keys (packageDeps (lpPackage lp))
shouldLoad <- liftM or $ mapM go deps
if shouldLoad
then do
modify (M.insert name (Just (lpCabalFile lp, STLocalComps (S.singleton CLib))))
return True
else do
modify (M.insert name Nothing)
return False
(_, Just PSUpstream{}) -> return loadAllDeps
(_, _) -> return False | 1,490 | getExtraLoadDeps loadAllDeps sourceMap targets =
M.toList $
(\mp -> foldl' (flip M.delete) mp (map fst targets)) $
M.mapMaybe id $
execState (mapM_ (mapM_ go . getDeps . fst) targets)
(M.fromList (map (\(k, x) -> (k, Just x)) targets))
where
getDeps :: PackageName -> [PackageName]
getDeps name =
case M.lookup name sourceMap of
Just (PSLocal lp) -> M.keys (packageDeps (lpPackage lp))
_ -> []
go :: PackageName -> State (Map PackageName (Maybe (Path Abs File, SimpleTarget))) Bool
go name = do
cache <- get
case (M.lookup name cache, M.lookup name sourceMap) of
(Just (Just _), _) -> return True
(Just Nothing, _) | not loadAllDeps -> return False
(_, Just (PSLocal lp)) -> do
let deps = M.keys (packageDeps (lpPackage lp))
shouldLoad <- liftM or $ mapM go deps
if shouldLoad
then do
modify (M.insert name (Just (lpCabalFile lp, STLocalComps (S.singleton CLib))))
return True
else do
modify (M.insert name Nothing)
return False
(_, Just PSUpstream{}) -> return loadAllDeps
(_, _) -> return False | 1,336 | false | true | 0 | 25 | 534 | 582 | 287 | 295 | null | null |
rueshyna/gogol | gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs | mpl-2.0 | -- | [Optional] A user-friendly description of the dataset.
dsDescription :: Lens' DataSet (Maybe Text)
dsDescription
= lens _dsDescription
(\ s a -> s{_dsDescription = a}) | 180 | dsDescription :: Lens' DataSet (Maybe Text)
dsDescription
= lens _dsDescription
(\ s a -> s{_dsDescription = a}) | 120 | dsDescription
= lens _dsDescription
(\ s a -> s{_dsDescription = a}) | 76 | true | true | 0 | 9 | 33 | 48 | 25 | 23 | null | null |
hdevtools/hdevtools | src/CommandArgs.hs | mit | admin :: Annotate Ann
admin = record dummyAdmin
[ socket := def += typFile += help "socket file to use"
, ghcOpts := def += typ "OPTION" += help "ghc options"
, cabalOpts := def += typ "OPTION" += help "cabal options"
, start_server := def += help "start server"
, noDaemon := def += help "do not daemonize (only if --start-server)"
, status := def += help "show status of server"
, stop_server := def += help "shutdown the server"
, debug := def += help "enable debug output"
, noStack := def += name "S" += help "disable stack integration"
] += help "Interactions with the server" | 707 | admin :: Annotate Ann
admin = record dummyAdmin
[ socket := def += typFile += help "socket file to use"
, ghcOpts := def += typ "OPTION" += help "ghc options"
, cabalOpts := def += typ "OPTION" += help "cabal options"
, start_server := def += help "start server"
, noDaemon := def += help "do not daemonize (only if --start-server)"
, status := def += help "show status of server"
, stop_server := def += help "shutdown the server"
, debug := def += help "enable debug output"
, noStack := def += name "S" += help "disable stack integration"
] += help "Interactions with the server" | 707 | admin = record dummyAdmin
[ socket := def += typFile += help "socket file to use"
, ghcOpts := def += typ "OPTION" += help "ghc options"
, cabalOpts := def += typ "OPTION" += help "cabal options"
, start_server := def += help "start server"
, noDaemon := def += help "do not daemonize (only if --start-server)"
, status := def += help "show status of server"
, stop_server := def += help "shutdown the server"
, debug := def += help "enable debug output"
, noStack := def += name "S" += help "disable stack integration"
] += help "Interactions with the server" | 685 | false | true | 0 | 10 | 233 | 177 | 86 | 91 | null | null |
yiannist/ganeti | src/Ganeti/Utils.hs | bsd-2-clause | -- | Show the first parameter before returning the second one.
debugXy :: Show a => a -> b -> b
debugXy = seq . debug | 117 | debugXy :: Show a => a -> b -> b
debugXy = seq . debug | 54 | debugXy = seq . debug | 21 | true | true | 0 | 9 | 25 | 38 | 17 | 21 | null | null |
yoo-e/weixin-mp-sdk | WeiXin/PublicPlatform/BgWork.hs | mit | refreshAccessTokenIfNeeded' :: ( WxppApiMonad env m, ExcSafe.MonadCatch m
, WxppCacheTokenUpdater c, WxppCacheTokenReader c)
=> c
-> WxppAppID
-> WxppAppSecret
-> NominalDiffTime
-> m ()
refreshAccessTokenIfNeeded' cache app_id secret dt = do
now <- liftIO getCurrentTime
let t = addUTCTime (abs dt) now
expired <- liftM (fromMaybe True . fmap ((<= t) . snd)) $
liftIO $ wxppCacheGetAccessToken cache app_id
when (expired) $ do
wxppAcquireAndSaveAccessToken cache app_id secret
-- | infinite loop to refresh access token
-- Create a backgroup thread to call this, so that access token can be keep fresh. | 825 | refreshAccessTokenIfNeeded' :: ( WxppApiMonad env m, ExcSafe.MonadCatch m
, WxppCacheTokenUpdater c, WxppCacheTokenReader c)
=> c
-> WxppAppID
-> WxppAppSecret
-> NominalDiffTime
-> m ()
refreshAccessTokenIfNeeded' cache app_id secret dt = do
now <- liftIO getCurrentTime
let t = addUTCTime (abs dt) now
expired <- liftM (fromMaybe True . fmap ((<= t) . snd)) $
liftIO $ wxppCacheGetAccessToken cache app_id
when (expired) $ do
wxppAcquireAndSaveAccessToken cache app_id secret
-- | infinite loop to refresh access token
-- Create a backgroup thread to call this, so that access token can be keep fresh. | 825 | refreshAccessTokenIfNeeded' cache app_id secret dt = do
now <- liftIO getCurrentTime
let t = addUTCTime (abs dt) now
expired <- liftM (fromMaybe True . fmap ((<= t) . snd)) $
liftIO $ wxppCacheGetAccessToken cache app_id
when (expired) $ do
wxppAcquireAndSaveAccessToken cache app_id secret
-- | infinite loop to refresh access token
-- Create a backgroup thread to call this, so that access token can be keep fresh. | 466 | false | true | 0 | 16 | 312 | 179 | 85 | 94 | null | null |
jtapolczai/Hephaestos | Control/Concurrent/STM/Utils.hs | apache-2.0 | updateTask :: Ord cat => TaskCategories cat v -> cat -> Int -> (v -> v) -> STM ()
updateTask (TaskCategories t) cat k f =
modifyTVar' t (first $ M.adjust (IM.adjust f k) cat) | 177 | updateTask :: Ord cat => TaskCategories cat v -> cat -> Int -> (v -> v) -> STM ()
updateTask (TaskCategories t) cat k f =
modifyTVar' t (first $ M.adjust (IM.adjust f k) cat) | 177 | updateTask (TaskCategories t) cat k f =
modifyTVar' t (first $ M.adjust (IM.adjust f k) cat) | 95 | false | true | 0 | 13 | 37 | 101 | 47 | 54 | null | null |
wfaler/mywai | src/Web/Mail.hs | bsd-3-clause | subject = "email subject" | 28 | subject = "email subject" | 28 | subject = "email subject" | 28 | false | false | 0 | 4 | 6 | 6 | 3 | 3 | null | null |
christiaanb/ghc | compiler/basicTypes/OccName.hs | bsd-3-clause | mkOccEnv l = A $ listToUFM l | 35 | mkOccEnv l = A $ listToUFM l | 35 | mkOccEnv l = A $ listToUFM l | 35 | false | false | 0 | 6 | 13 | 16 | 7 | 9 | null | null |
jtobin/deprecated-observable | src/Observable/MCMC/MetropolisHastings.hs | bsd-3-clause | sphericalGaussian :: Vector Double -> Vector Double -> Double -> Double
sphericalGaussian xs mu sd = product $ zipWith density normalDists xsAsList
where
xsAsList = V.toList xs
muAsList = V.toList mu
normalDists = map (`normalDistr` sd) muAsList | 265 | sphericalGaussian :: Vector Double -> Vector Double -> Double -> Double
sphericalGaussian xs mu sd = product $ zipWith density normalDists xsAsList
where
xsAsList = V.toList xs
muAsList = V.toList mu
normalDists = map (`normalDistr` sd) muAsList | 265 | sphericalGaussian xs mu sd = product $ zipWith density normalDists xsAsList
where
xsAsList = V.toList xs
muAsList = V.toList mu
normalDists = map (`normalDistr` sd) muAsList | 193 | false | true | 2 | 7 | 56 | 86 | 43 | 43 | null | null |
coghex/abridgefaraway | src/GLUtil/Font.hs | bsd-3-clause | findLetter SMFONT '7' = (73, 12) | 33 | findLetter SMFONT '7' = (73, 12) | 33 | findLetter SMFONT '7' = (73, 12) | 33 | false | false | 0 | 5 | 6 | 19 | 9 | 10 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/Cloud9EnvironmentEC2.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloud9-environmentec2.html#cfn-cloud9-environmentec2-instancetype
ceecInstanceType :: Lens' Cloud9EnvironmentEC2 (Val Text)
ceecInstanceType = lens _cloud9EnvironmentEC2InstanceType (\s a -> s { _cloud9EnvironmentEC2InstanceType = a }) | 315 | ceecInstanceType :: Lens' Cloud9EnvironmentEC2 (Val Text)
ceecInstanceType = lens _cloud9EnvironmentEC2InstanceType (\s a -> s { _cloud9EnvironmentEC2InstanceType = a }) | 169 | ceecInstanceType = lens _cloud9EnvironmentEC2InstanceType (\s a -> s { _cloud9EnvironmentEC2InstanceType = a }) | 111 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
ranjitjhala/gradr | Application.hs | mit | makeLogWare :: App -> IO Middleware
makeLogWare foundation =
mkRequestLogger def
{ outputFormat =
if appDetailedRequestLogging $ appSettings foundation
then Detailed True
else Apache
(if appIpFromHeader $ appSettings foundation
then FromFallback
else FromSocket)
, destination = Logger $ loggerSet $ appLogger foundation
} | 474 | makeLogWare :: App -> IO Middleware
makeLogWare foundation =
mkRequestLogger def
{ outputFormat =
if appDetailedRequestLogging $ appSettings foundation
then Detailed True
else Apache
(if appIpFromHeader $ appSettings foundation
then FromFallback
else FromSocket)
, destination = Logger $ loggerSet $ appLogger foundation
} | 474 | makeLogWare foundation =
mkRequestLogger def
{ outputFormat =
if appDetailedRequestLogging $ appSettings foundation
then Detailed True
else Apache
(if appIpFromHeader $ appSettings foundation
then FromFallback
else FromSocket)
, destination = Logger $ loggerSet $ appLogger foundation
} | 438 | false | true | 0 | 13 | 194 | 96 | 47 | 49 | null | null |
giorgidze/HCodecs | src/Codec/Midi.hs | bsd-3-clause | buildMetaMessage :: Message -> Builder
buildMetaMessage msg = putWord8 0xFF `mappend`
case msg of
SequenceNumber i -> mconcat
[putWord8 0x00, putVarLenBe 2, putWord16be $ fromIntegral $ i]
Text s -> mconcat
[putWord8 0x01, putVarLenBe (fromIntegral $ length s), putString s]
Copyright s -> mconcat
[putWord8 0x02, putVarLenBe (fromIntegral $ length s), putString s]
TrackName s -> mconcat
[putWord8 0x03, putVarLenBe (fromIntegral $ length s), putString s]
InstrumentName s -> mconcat
[putWord8 0x04, putVarLenBe (fromIntegral $ length s), putString s]
Lyrics s -> mconcat
[putWord8 0x05, putVarLenBe (fromIntegral $ length s), putString s]
Marker s -> mconcat
[putWord8 0x06, putVarLenBe (fromIntegral $ length s), putString s]
CuePoint s -> mconcat
[putWord8 0x07, putVarLenBe (fromIntegral $ length s), putString s]
ProgramName s -> mconcat
[putWord8 0x08, putVarLenBe (fromIntegral $ length s), putString s]
DeviceName s -> mconcat
[putWord8 0x09, putVarLenBe (fromIntegral $ length s), putString s]
ChannelPrefix i -> mconcat
[putWord8 0x20, putVarLenBe 1, putWord8 $ fromIntegral $ i]
TrackEnd -> putWord8 0x2F `mappend` putVarLenBe 0
TempoChange i -> mconcat
[putWord8 0x51, putVarLenBe 3, putWord24be $ fromIntegral $ i]
SMPTEOffset i1 i2 i3 i4 i5 -> mconcat [
putWord8 0x54
, putVarLenBe 5
, mconcat $ map (putWord8 . fromIntegral) [i1,i2,i3,i4,i5]]
TimeSignature i1 i2 i3 i4 -> mconcat [
putWord8 0x58
, putVarLenBe 4
, mconcat $ map (putWord8 . fromIntegral) [i1,i2,i3,i4]]
KeySignature i1 i2 -> mconcat [
putWord8 0x59
, putVarLenBe 2
, putInt8 $ fromIntegral $ i1
, putWord8 $ fromIntegral $ i2]
Reserved w bs -> mconcat [
putWord8 (fromIntegral w)
, putVarLenBe (fromIntegral $ L.length bs)
, fromLazyByteString bs]
_ -> mempty | 1,974 | buildMetaMessage :: Message -> Builder
buildMetaMessage msg = putWord8 0xFF `mappend`
case msg of
SequenceNumber i -> mconcat
[putWord8 0x00, putVarLenBe 2, putWord16be $ fromIntegral $ i]
Text s -> mconcat
[putWord8 0x01, putVarLenBe (fromIntegral $ length s), putString s]
Copyright s -> mconcat
[putWord8 0x02, putVarLenBe (fromIntegral $ length s), putString s]
TrackName s -> mconcat
[putWord8 0x03, putVarLenBe (fromIntegral $ length s), putString s]
InstrumentName s -> mconcat
[putWord8 0x04, putVarLenBe (fromIntegral $ length s), putString s]
Lyrics s -> mconcat
[putWord8 0x05, putVarLenBe (fromIntegral $ length s), putString s]
Marker s -> mconcat
[putWord8 0x06, putVarLenBe (fromIntegral $ length s), putString s]
CuePoint s -> mconcat
[putWord8 0x07, putVarLenBe (fromIntegral $ length s), putString s]
ProgramName s -> mconcat
[putWord8 0x08, putVarLenBe (fromIntegral $ length s), putString s]
DeviceName s -> mconcat
[putWord8 0x09, putVarLenBe (fromIntegral $ length s), putString s]
ChannelPrefix i -> mconcat
[putWord8 0x20, putVarLenBe 1, putWord8 $ fromIntegral $ i]
TrackEnd -> putWord8 0x2F `mappend` putVarLenBe 0
TempoChange i -> mconcat
[putWord8 0x51, putVarLenBe 3, putWord24be $ fromIntegral $ i]
SMPTEOffset i1 i2 i3 i4 i5 -> mconcat [
putWord8 0x54
, putVarLenBe 5
, mconcat $ map (putWord8 . fromIntegral) [i1,i2,i3,i4,i5]]
TimeSignature i1 i2 i3 i4 -> mconcat [
putWord8 0x58
, putVarLenBe 4
, mconcat $ map (putWord8 . fromIntegral) [i1,i2,i3,i4]]
KeySignature i1 i2 -> mconcat [
putWord8 0x59
, putVarLenBe 2
, putInt8 $ fromIntegral $ i1
, putWord8 $ fromIntegral $ i2]
Reserved w bs -> mconcat [
putWord8 (fromIntegral w)
, putVarLenBe (fromIntegral $ L.length bs)
, fromLazyByteString bs]
_ -> mempty | 1,974 | buildMetaMessage msg = putWord8 0xFF `mappend`
case msg of
SequenceNumber i -> mconcat
[putWord8 0x00, putVarLenBe 2, putWord16be $ fromIntegral $ i]
Text s -> mconcat
[putWord8 0x01, putVarLenBe (fromIntegral $ length s), putString s]
Copyright s -> mconcat
[putWord8 0x02, putVarLenBe (fromIntegral $ length s), putString s]
TrackName s -> mconcat
[putWord8 0x03, putVarLenBe (fromIntegral $ length s), putString s]
InstrumentName s -> mconcat
[putWord8 0x04, putVarLenBe (fromIntegral $ length s), putString s]
Lyrics s -> mconcat
[putWord8 0x05, putVarLenBe (fromIntegral $ length s), putString s]
Marker s -> mconcat
[putWord8 0x06, putVarLenBe (fromIntegral $ length s), putString s]
CuePoint s -> mconcat
[putWord8 0x07, putVarLenBe (fromIntegral $ length s), putString s]
ProgramName s -> mconcat
[putWord8 0x08, putVarLenBe (fromIntegral $ length s), putString s]
DeviceName s -> mconcat
[putWord8 0x09, putVarLenBe (fromIntegral $ length s), putString s]
ChannelPrefix i -> mconcat
[putWord8 0x20, putVarLenBe 1, putWord8 $ fromIntegral $ i]
TrackEnd -> putWord8 0x2F `mappend` putVarLenBe 0
TempoChange i -> mconcat
[putWord8 0x51, putVarLenBe 3, putWord24be $ fromIntegral $ i]
SMPTEOffset i1 i2 i3 i4 i5 -> mconcat [
putWord8 0x54
, putVarLenBe 5
, mconcat $ map (putWord8 . fromIntegral) [i1,i2,i3,i4,i5]]
TimeSignature i1 i2 i3 i4 -> mconcat [
putWord8 0x58
, putVarLenBe 4
, mconcat $ map (putWord8 . fromIntegral) [i1,i2,i3,i4]]
KeySignature i1 i2 -> mconcat [
putWord8 0x59
, putVarLenBe 2
, putInt8 $ fromIntegral $ i1
, putWord8 $ fromIntegral $ i2]
Reserved w bs -> mconcat [
putWord8 (fromIntegral w)
, putVarLenBe (fromIntegral $ L.length bs)
, fromLazyByteString bs]
_ -> mempty | 1,935 | false | true | 0 | 15 | 496 | 745 | 365 | 380 | null | null |
rwbarton/rw | Crawl/Equipment.hs | bsd-3-clause | baseAC ARM_CRYSTAL_PLATE_ARMOUR = 14 | 36 | baseAC ARM_CRYSTAL_PLATE_ARMOUR = 14 | 36 | baseAC ARM_CRYSTAL_PLATE_ARMOUR = 14 | 36 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
hrsrashid/nummet | src/Main.hs | bsd-3-clause | main :: IO ()
main = do
args <- getArgs
case args of
[algo, input, output] -> do
res <- launch algo input
report output res
_ -> cliHelp | 160 | main :: IO ()
main = do
args <- getArgs
case args of
[algo, input, output] -> do
res <- launch algo input
report output res
_ -> cliHelp | 160 | main = do
args <- getArgs
case args of
[algo, input, output] -> do
res <- launch algo input
report output res
_ -> cliHelp | 146 | false | true | 0 | 13 | 52 | 71 | 34 | 37 | null | null |
BerndSchwarzenbacher/cis194-solutions | 06-lazy/Fibonacci.hs | mit | fib4 :: Integer -> Integer
fib4 0 = 0 | 37 | fib4 :: Integer -> Integer
fib4 0 = 0 | 37 | fib4 0 = 0 | 10 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
evinstk/scheme-by-haskell | Eval.hs | mit | numericBinop op singleVal@[_] = throwError $ NumArgs 2 singleVal | 64 | numericBinop op singleVal@[_] = throwError $ NumArgs 2 singleVal | 64 | numericBinop op singleVal@[_] = throwError $ NumArgs 2 singleVal | 64 | false | false | 0 | 6 | 8 | 28 | 13 | 15 | null | null |
diku-dk/futhark | src/Futhark/Analysis/LastUse.hs | isc | analyseGPUOp _ (lumap, used) (Inner (OtherOp ())) =
return (lumap, used) | 74 | analyseGPUOp _ (lumap, used) (Inner (OtherOp ())) =
return (lumap, used) | 74 | analyseGPUOp _ (lumap, used) (Inner (OtherOp ())) =
return (lumap, used) | 74 | false | false | 0 | 10 | 12 | 42 | 22 | 20 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-printers/Language/Drasil/HTML/Print.hs | bsd-2-clause | compCiteField (Publisher _) _ = LT | 35 | compCiteField (Publisher _) _ = LT | 35 | compCiteField (Publisher _) _ = LT | 35 | false | false | 1 | 6 | 6 | 18 | 8 | 10 | null | null |
yangjueji/hblas | src/Numerical/HBLAS/BLAS/Internal/Level2.hs | bsd-3-clause | hpr2Abstraction :: (SM.Storable el, PrimMonad m)
=> String
-> Hpr2FunFFI scale el
-> Hpr2FunFFI scale el
-> (el -> (scale -> m ())-> m ())
-> forall orient . Hpr2Fun el orient (PrimState m) m
hpr2Abstraction hpr2Name hpr2SafeFFI hpr2UnsafeFFI constHandler = hpr2
where
shouldCallFast :: Int64 -> Bool
shouldCallFast n = flopsThreshold >= (n * n + n)
hpr2 ornt uplo n alpha
(MutableDenseVector _ xdim xstride xbuff)
(MutableDenseVector _ ydim ystride ybuff)
(MutableDenseVector _ adim _ abuff)
| isVectorBadWithNIncrement xdim n xstride = error $! vectorBadInfo hpr2Name "x vector" xdim n xstride
| isVectorBadWithNIncrement ydim n ystride = error $! vectorBadInfo hpr2Name "y vector" ydim n ystride
| adim < (div (n * (n+1)) 2) = error $! hpr2Name ++ ": array must contain at least (n*(n+1)/2) elements with n:" ++ (show n) ++ "."
| SM.overlaps abuff xbuff || SM.overlaps abuff ybuff || SM.overlaps xbuff ybuff =
error $! "The read and write inputs for: " ++ hpr2Name ++ " overlap. This is a programmer error. Please fix."
| otherwise = call
where
call = unsafeWithPrim abuff $ \ap ->
unsafeWithPrim xbuff $ \xp ->
unsafeWithPrim ybuff $ \yp ->
constHandler alpha $ \alphaPtr ->
unsafePrimToPrim $! (if shouldCallFast (fromIntegral n) then hpr2UnsafeFFI else hpr2SafeFFI)
(encodeNiceOrder ornt) (encodeFFIMatrixHalf uplo)
(fromIntegral n) alphaPtr xp (fromIntegral xstride) yp (fromIntegral ystride) ap
| 1,730 | hpr2Abstraction :: (SM.Storable el, PrimMonad m)
=> String
-> Hpr2FunFFI scale el
-> Hpr2FunFFI scale el
-> (el -> (scale -> m ())-> m ())
-> forall orient . Hpr2Fun el orient (PrimState m) m
hpr2Abstraction hpr2Name hpr2SafeFFI hpr2UnsafeFFI constHandler = hpr2
where
shouldCallFast :: Int64 -> Bool
shouldCallFast n = flopsThreshold >= (n * n + n)
hpr2 ornt uplo n alpha
(MutableDenseVector _ xdim xstride xbuff)
(MutableDenseVector _ ydim ystride ybuff)
(MutableDenseVector _ adim _ abuff)
| isVectorBadWithNIncrement xdim n xstride = error $! vectorBadInfo hpr2Name "x vector" xdim n xstride
| isVectorBadWithNIncrement ydim n ystride = error $! vectorBadInfo hpr2Name "y vector" ydim n ystride
| adim < (div (n * (n+1)) 2) = error $! hpr2Name ++ ": array must contain at least (n*(n+1)/2) elements with n:" ++ (show n) ++ "."
| SM.overlaps abuff xbuff || SM.overlaps abuff ybuff || SM.overlaps xbuff ybuff =
error $! "The read and write inputs for: " ++ hpr2Name ++ " overlap. This is a programmer error. Please fix."
| otherwise = call
where
call = unsafeWithPrim abuff $ \ap ->
unsafeWithPrim xbuff $ \xp ->
unsafeWithPrim ybuff $ \yp ->
constHandler alpha $ \alphaPtr ->
unsafePrimToPrim $! (if shouldCallFast (fromIntegral n) then hpr2UnsafeFFI else hpr2SafeFFI)
(encodeNiceOrder ornt) (encodeFFIMatrixHalf uplo)
(fromIntegral n) alphaPtr xp (fromIntegral xstride) yp (fromIntegral ystride) ap
| 1,730 | hpr2Abstraction hpr2Name hpr2SafeFFI hpr2UnsafeFFI constHandler = hpr2
where
shouldCallFast :: Int64 -> Bool
shouldCallFast n = flopsThreshold >= (n * n + n)
hpr2 ornt uplo n alpha
(MutableDenseVector _ xdim xstride xbuff)
(MutableDenseVector _ ydim ystride ybuff)
(MutableDenseVector _ adim _ abuff)
| isVectorBadWithNIncrement xdim n xstride = error $! vectorBadInfo hpr2Name "x vector" xdim n xstride
| isVectorBadWithNIncrement ydim n ystride = error $! vectorBadInfo hpr2Name "y vector" ydim n ystride
| adim < (div (n * (n+1)) 2) = error $! hpr2Name ++ ": array must contain at least (n*(n+1)/2) elements with n:" ++ (show n) ++ "."
| SM.overlaps abuff xbuff || SM.overlaps abuff ybuff || SM.overlaps xbuff ybuff =
error $! "The read and write inputs for: " ++ hpr2Name ++ " overlap. This is a programmer error. Please fix."
| otherwise = call
where
call = unsafeWithPrim abuff $ \ap ->
unsafeWithPrim xbuff $ \xp ->
unsafeWithPrim ybuff $ \yp ->
constHandler alpha $ \alphaPtr ->
unsafePrimToPrim $! (if shouldCallFast (fromIntegral n) then hpr2UnsafeFFI else hpr2SafeFFI)
(encodeNiceOrder ornt) (encodeFFIMatrixHalf uplo)
(fromIntegral n) alphaPtr xp (fromIntegral xstride) yp (fromIntegral ystride) ap
| 1,458 | false | true | 12 | 21 | 548 | 500 | 248 | 252 | null | null |
gridaphobe/target | src/Test/Target/Eval.hs | mit | evalBrel Une = (/=) | 19 | evalBrel Une = (/=) | 19 | evalBrel Une = (/=) | 19 | false | false | 0 | 5 | 3 | 11 | 6 | 5 | null | null |
charlesrosenbauer/Bzo-Compiler | src/Builtins.hs | gpl-3.0 | isBuiltinFunc "#ife" = 40034 | 37 | isBuiltinFunc "#ife" = 40034 | 37 | isBuiltinFunc "#ife" = 40034 | 37 | false | false | 0 | 5 | 12 | 9 | 4 | 5 | null | null |
sashabu/libcspm | src/Data/Graph/Wrapper.hs | bsd-3-clause | -- | Construct a 'Graph' that contains the given vertex data, linked up according to the supplied key extraction
-- function and edge list.
--
-- Unlike 'Data.Graph.graphFromEdges', indexes in the edge list that do not correspond to the index of some item in the
-- input list are reported as an error.
fromListBy :: Ord i => (v -> i) -> [(v, [i])] -> Graph i v
fromListBy f vertices = fromList [(f v, v, is) | (v, is) <- vertices] | 431 | fromListBy :: Ord i => (v -> i) -> [(v, [i])] -> Graph i v
fromListBy f vertices = fromList [(f v, v, is) | (v, is) <- vertices] | 128 | fromListBy f vertices = fromList [(f v, v, is) | (v, is) <- vertices] | 69 | true | true | 0 | 10 | 81 | 92 | 52 | 40 | null | null |
ant0nsc/bond | compiler/src/Language/Bond/Codegen/TypeMapping.hs | mit | allocator :: Builder -> Type -> TypeNameBuilder
allocator alloc element =
"typename " <>> alloc <>> "::rebind<" <>> elementTypeName element <<> ">::other" | 158 | allocator :: Builder -> Type -> TypeNameBuilder
allocator alloc element =
"typename " <>> alloc <>> "::rebind<" <>> elementTypeName element <<> ">::other" | 158 | allocator alloc element =
"typename " <>> alloc <>> "::rebind<" <>> elementTypeName element <<> ">::other" | 110 | false | true | 4 | 8 | 25 | 51 | 22 | 29 | null | null |
yliu120/K3 | src/Language/K3/Utils/Pretty/Syntax.hs | apache-2.0 | exprError :: String -> SyntaxPrinter
exprError msg = throwSP $ "Invalid " ++ msg ++ " expression" | 97 | exprError :: String -> SyntaxPrinter
exprError msg = throwSP $ "Invalid " ++ msg ++ " expression" | 97 | exprError msg = throwSP $ "Invalid " ++ msg ++ " expression" | 60 | false | true | 0 | 7 | 16 | 30 | 15 | 15 | null | null |
trskop/evar | src/Data/EVar/Type/EVar_.hs | bsd-3-clause | newExceptionEVar_
:: (Exception e, Monad m)
=> (Either SomeException a -> m (EVar_ f a))
-> e
-> m (EVar_ f a)
newExceptionEVar_ new = new . Left . toException | 175 | newExceptionEVar_
:: (Exception e, Monad m)
=> (Either SomeException a -> m (EVar_ f a))
-> e
-> m (EVar_ f a)
newExceptionEVar_ new = new . Left . toException | 175 | newExceptionEVar_ new = new . Left . toException | 48 | false | true | 0 | 12 | 45 | 84 | 40 | 44 | null | null |
TK009/CESH | src/EntityManager.hs | mit | removeEntity :: EntityId -> Cesh Bool
removeEntity e = do
entityExists <- use $ entitySet . contains e
--let entityExists = e `S.member` entities
when entityExists $
removeComponents e
-- TODO: add remove for re-usable ids
return entityExists
where
-- remove any components associated to given entity O(t*log(n(t))) (hopefully)
removeComponents :: EntityId -> Cesh ()
removeComponents (EntityId eid) =
compsByType . traverse %= (at eid .~ Nothing) | 502 | removeEntity :: EntityId -> Cesh Bool
removeEntity e = do
entityExists <- use $ entitySet . contains e
--let entityExists = e `S.member` entities
when entityExists $
removeComponents e
-- TODO: add remove for re-usable ids
return entityExists
where
-- remove any components associated to given entity O(t*log(n(t))) (hopefully)
removeComponents :: EntityId -> Cesh ()
removeComponents (EntityId eid) =
compsByType . traverse %= (at eid .~ Nothing) | 502 | removeEntity e = do
entityExists <- use $ entitySet . contains e
--let entityExists = e `S.member` entities
when entityExists $
removeComponents e
-- TODO: add remove for re-usable ids
return entityExists
where
-- remove any components associated to given entity O(t*log(n(t))) (hopefully)
removeComponents :: EntityId -> Cesh ()
removeComponents (EntityId eid) =
compsByType . traverse %= (at eid .~ Nothing) | 464 | false | true | 0 | 9 | 121 | 111 | 52 | 59 | null | null |
keithodulaigh/Hets | CASL/Disambiguate.hs | gpl-2.0 | -- note that op-type keys are always partial!
disambigSigExt :: InducedSign f e m e -> m -> Sign f e -> Morphism f e m
disambigSigExt extInd extEm sig =
let ps = Map.map (Rel.partSet $ leqP sig) $ MapSet.toMap $ predMap sig
os = Map.map (Rel.partSet $ leqF sig) $ MapSet.toMap $ opMap sig
ss = sortSet sig
sMap = Set.fold (`Map.insert` 1) Map.empty ss
om = createOpMorMap $ disambOverloaded sMap mkPartial os
oMap = Map.foldWithKey (\ i ->
Map.insertWith (+) i . length) sMap os
pm = Map.map fst $ disambOverloaded oMap id ps
in (embedMorphism extEm sig $ inducedSignAux extInd Map.empty om pm extEm sig)
{ op_map = om
, pred_map = pm } | 697 | disambigSigExt :: InducedSign f e m e -> m -> Sign f e -> Morphism f e m
disambigSigExt extInd extEm sig =
let ps = Map.map (Rel.partSet $ leqP sig) $ MapSet.toMap $ predMap sig
os = Map.map (Rel.partSet $ leqF sig) $ MapSet.toMap $ opMap sig
ss = sortSet sig
sMap = Set.fold (`Map.insert` 1) Map.empty ss
om = createOpMorMap $ disambOverloaded sMap mkPartial os
oMap = Map.foldWithKey (\ i ->
Map.insertWith (+) i . length) sMap os
pm = Map.map fst $ disambOverloaded oMap id ps
in (embedMorphism extEm sig $ inducedSignAux extInd Map.empty om pm extEm sig)
{ op_map = om
, pred_map = pm } | 651 | disambigSigExt extInd extEm sig =
let ps = Map.map (Rel.partSet $ leqP sig) $ MapSet.toMap $ predMap sig
os = Map.map (Rel.partSet $ leqF sig) $ MapSet.toMap $ opMap sig
ss = sortSet sig
sMap = Set.fold (`Map.insert` 1) Map.empty ss
om = createOpMorMap $ disambOverloaded sMap mkPartial os
oMap = Map.foldWithKey (\ i ->
Map.insertWith (+) i . length) sMap os
pm = Map.map fst $ disambOverloaded oMap id ps
in (embedMorphism extEm sig $ inducedSignAux extInd Map.empty om pm extEm sig)
{ op_map = om
, pred_map = pm } | 578 | true | true | 0 | 14 | 178 | 281 | 140 | 141 | null | null |
spire/spire | src/Spire/Surface/Elaborator.hs | bsd-3-clause | elabC (SInit xs) = CInit <$> elabC xs | 43 | elabC (SInit xs) = CInit <$> elabC xs | 43 | elabC (SInit xs) = CInit <$> elabC xs | 43 | false | false | 0 | 6 | 13 | 23 | 10 | 13 | null | null |
christiaanb/ghc | utils/genprimopcode/Main.hs | bsd-3-clause | ppType (TyApp (TyCon "Int32#") []) = "int32PrimTy" | 55 | ppType (TyApp (TyCon "Int32#") []) = "int32PrimTy" | 55 | ppType (TyApp (TyCon "Int32#") []) = "int32PrimTy" | 55 | false | false | 0 | 8 | 11 | 26 | 12 | 14 | null | null |
kosmoskatten/ghost-lang | ghost-lang/src/GhostLang/Interpreter/WebClient.hs | mit | fromStatus :: Status -> HttpStatus
fromStatus status
| status == status200 = Success
| otherwise = Failure | 124 | fromStatus :: Status -> HttpStatus
fromStatus status
| status == status200 = Success
| otherwise = Failure | 124 | fromStatus status
| status == status200 = Success
| otherwise = Failure | 89 | false | true | 1 | 8 | 34 | 41 | 18 | 23 | null | null |
nicokosi/intro-to-haskell-cis-194 | HW01/HW01.hs | unlicense | luhn :: Integer -> Bool
luhn creditCardNumber = (mod luhnSum 10) == 0
where luhnSum = sumDigits $ doubleEveryOther $ toRevDigits creditCardNumber
-- Exercise 6 -----------------------------------------
-- Towers of Hanoi for three pegs | 239 | luhn :: Integer -> Bool
luhn creditCardNumber = (mod luhnSum 10) == 0
where luhnSum = sumDigits $ doubleEveryOther $ toRevDigits creditCardNumber
-- Exercise 6 -----------------------------------------
-- Towers of Hanoi for three pegs | 239 | luhn creditCardNumber = (mod luhnSum 10) == 0
where luhnSum = sumDigits $ doubleEveryOther $ toRevDigits creditCardNumber
-- Exercise 6 -----------------------------------------
-- Towers of Hanoi for three pegs | 215 | false | true | 0 | 8 | 36 | 50 | 26 | 24 | null | null |
creichert/wai | warp/Network/Wai/Handler/Warp.hs | mit | -- | Setting a log function.
--
-- Since 3.X.X
setLogger :: (Request -> H.Status -> Maybe Integer -> IO ()) -- ^ request, status, maybe file-size
-> Settings
-> Settings
setLogger lgr y = y { settingsLogger = lgr } | 234 | setLogger :: (Request -> H.Status -> Maybe Integer -> IO ()) -- ^ request, status, maybe file-size
-> Settings
-> Settings
setLogger lgr y = y { settingsLogger = lgr } | 187 | setLogger lgr y = y { settingsLogger = lgr } | 44 | true | true | 0 | 11 | 60 | 61 | 33 | 28 | null | null |
nevrenato/Hets_Fork | CSL/Print_AS.hs | gpl-2.0 | printSymbOrMap :: SYMB_OR_MAP -> Doc
printSymbOrMap (Symb sym) = pretty sym | 75 | printSymbOrMap :: SYMB_OR_MAP -> Doc
printSymbOrMap (Symb sym) = pretty sym | 75 | printSymbOrMap (Symb sym) = pretty sym | 38 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
bgold-cosmos/Tidal | src/Sound/Tidal/Params.hs | gpl-3.0 | fadeInTimebus :: Pattern Int -> Pattern Double -> ControlPattern
fadeInTimebus _ _ = error $ "Control parameter 'fadeInTime' can't be sent to a bus." | 149 | fadeInTimebus :: Pattern Int -> Pattern Double -> ControlPattern
fadeInTimebus _ _ = error $ "Control parameter 'fadeInTime' can't be sent to a bus." | 149 | fadeInTimebus _ _ = error $ "Control parameter 'fadeInTime' can't be sent to a bus." | 84 | false | true | 2 | 8 | 23 | 41 | 17 | 24 | null | null |
mhweaver/daynum | src/Lib.hs | bsd-3-clause | datenumOrDate = try (DateNum <$> datenum) <|> (Date <$> date) :: Parser DateNumOrDate | 105 | datenumOrDate = try (DateNum <$> datenum) <|> (Date <$> date) :: Parser DateNumOrDate | 105 | datenumOrDate = try (DateNum <$> datenum) <|> (Date <$> date) :: Parser DateNumOrDate | 105 | false | false | 2 | 7 | 32 | 33 | 16 | 17 | null | null |
aurapm/haskell-versions | Data/Versions.hs | bsd-3-clause | -- | Short-hand for detecting a `Mess`.
isComplex :: Versioning -> Bool
isComplex (Complex _) = True | 100 | isComplex :: Versioning -> Bool
isComplex (Complex _) = True | 60 | isComplex (Complex _) = True | 28 | true | true | 0 | 7 | 16 | 25 | 13 | 12 | null | null |
cocreature/nanovg-hs | src/NanoVG.hs | isc | text :: Context -> CFloat -> CFloat -> T.Text -> IO ()
text c x y t = withCStringLen t $ \(ptr,len) -> Internal.text c x y ptr (ptr `plusPtr` len) | 146 | text :: Context -> CFloat -> CFloat -> T.Text -> IO ()
text c x y t = withCStringLen t $ \(ptr,len) -> Internal.text c x y ptr (ptr `plusPtr` len) | 146 | text c x y t = withCStringLen t $ \(ptr,len) -> Internal.text c x y ptr (ptr `plusPtr` len) | 91 | false | true | 0 | 11 | 30 | 87 | 44 | 43 | null | null |
ilyasergey/GHC-XAppFix | compiler/utils/Interval.hs | bsd-3-clause | adjoins (Interval _ l) (Interval m _) = l == m | 46 | adjoins (Interval _ l) (Interval m _) = l == m | 46 | adjoins (Interval _ l) (Interval m _) = l == m | 46 | false | false | 1 | 7 | 10 | 38 | 17 | 21 | null | null |
Cognimeta/perdure | exe-src/Database/Perdure/TestPersistent.hs | apache-2.0 | propPersistent :: (Show a, Eq a, Persistent a) => a -> Property
propPersistent = propPersister persister | 105 | propPersistent :: (Show a, Eq a, Persistent a) => a -> Property
propPersistent = propPersister persister | 104 | propPersistent = propPersister persister | 40 | false | true | 0 | 6 | 16 | 39 | 20 | 19 | null | null |
adamschoenemann/simple-frp | src/FRP/TypeInference.hs | mit | inferLater :: Term t -> Infer t (Type t)
inferLater expr = do
t <- local laterCtx $ infer expr
return t
-- ctx0 <- ask
-- if (q == QNow)
-- then return (t,q)
-- else typeErr (NotLater expr) ctx0
-- |Infer a term to /stable/ | 240 | inferLater :: Term t -> Infer t (Type t)
inferLater expr = do
t <- local laterCtx $ infer expr
return t
-- ctx0 <- ask
-- if (q == QNow)
-- then return (t,q)
-- else typeErr (NotLater expr) ctx0
-- |Infer a term to /stable/ | 240 | inferLater expr = do
t <- local laterCtx $ infer expr
return t
-- ctx0 <- ask
-- if (q == QNow)
-- then return (t,q)
-- else typeErr (NotLater expr) ctx0
-- |Infer a term to /stable/ | 199 | false | true | 0 | 10 | 63 | 65 | 30 | 35 | null | null |
rueshyna/gogol | gogol-dataproc/gen/Network/Google/Resource/Dataproc/Projects/Regions/Clusters/Delete.hs | mpl-2.0 | -- | Pretty-print response.
prcdPp :: Lens' ProjectsRegionsClustersDelete Bool
prcdPp = lens _prcdPp (\ s a -> s{_prcdPp = a}) | 126 | prcdPp :: Lens' ProjectsRegionsClustersDelete Bool
prcdPp = lens _prcdPp (\ s a -> s{_prcdPp = a}) | 98 | prcdPp = lens _prcdPp (\ s a -> s{_prcdPp = a}) | 47 | true | true | 0 | 9 | 19 | 40 | 22 | 18 | null | null |
RossMeikleham/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | mapPTermFC f g (PInferRef fc fcs n) = PInferRef (g fc) (map g fcs) n | 68 | mapPTermFC f g (PInferRef fc fcs n) = PInferRef (g fc) (map g fcs) n | 68 | mapPTermFC f g (PInferRef fc fcs n) = PInferRef (g fc) (map g fcs) n | 68 | false | false | 0 | 7 | 14 | 44 | 21 | 23 | null | null |
phischu/fragnix | tests/packages/scotty/Web.Scotty.Action.hs | bsd-3-clause | liftAndCatchIO :: (ScottyError e, MonadIO m) => IO a -> ActionT e m a
liftAndCatchIO io = ActionT $ do
r <- liftIO $ liftM Right io `E.catch` (\ e -> return $ Left $ stringError $ show (e :: E.SomeException))
either throwError return r
-- | Redirect to given URL. Like throwing an uncatchable exception. Any code after the call to redirect
-- will not be run.
--
-- > redirect "http://www.google.com"
--
-- OR
--
-- > redirect "/foo/bar" | 446 | liftAndCatchIO :: (ScottyError e, MonadIO m) => IO a -> ActionT e m a
liftAndCatchIO io = ActionT $ do
r <- liftIO $ liftM Right io `E.catch` (\ e -> return $ Left $ stringError $ show (e :: E.SomeException))
either throwError return r
-- | Redirect to given URL. Like throwing an uncatchable exception. Any code after the call to redirect
-- will not be run.
--
-- > redirect "http://www.google.com"
--
-- OR
--
-- > redirect "/foo/bar" | 446 | liftAndCatchIO io = ActionT $ do
r <- liftIO $ liftM Right io `E.catch` (\ e -> return $ Left $ stringError $ show (e :: E.SomeException))
either throwError return r
-- | Redirect to given URL. Like throwing an uncatchable exception. Any code after the call to redirect
-- will not be run.
--
-- > redirect "http://www.google.com"
--
-- OR
--
-- > redirect "/foo/bar" | 376 | false | true | 0 | 16 | 89 | 125 | 65 | 60 | null | null |
MagneticDuck/simpleirc | Network/SimpleIRC/Core.hs | bsd-3-clause | events :: MIrc -> IrcEvent -> IrcMessage -> IO ()
events mServ event msg = do
server <- readMVar mServ
let comp = (`eqEvent` event)
evts = Map.filter comp (sEvents server)
eventCall = (\obj -> (eventFunc $ snd obj) mServ msg)
mapM_ eventCall (Map.toList evts) | 280 | events :: MIrc -> IrcEvent -> IrcMessage -> IO ()
events mServ event msg = do
server <- readMVar mServ
let comp = (`eqEvent` event)
evts = Map.filter comp (sEvents server)
eventCall = (\obj -> (eventFunc $ snd obj) mServ msg)
mapM_ eventCall (Map.toList evts) | 280 | events mServ event msg = do
server <- readMVar mServ
let comp = (`eqEvent` event)
evts = Map.filter comp (sEvents server)
eventCall = (\obj -> (eventFunc $ snd obj) mServ msg)
mapM_ eventCall (Map.toList evts) | 230 | false | true | 0 | 15 | 65 | 122 | 61 | 61 | null | null |
sdiehl/ghc | compiler/basicTypes/Predicate.hs | bsd-3-clause | getClassPredTys :: HasDebugCallStack => PredType -> (Class, [Type])
getClassPredTys ty = case getClassPredTys_maybe ty of
Just (clas, tys) -> (clas, tys)
Nothing -> pprPanic "getClassPredTys" (ppr ty) | 225 | getClassPredTys :: HasDebugCallStack => PredType -> (Class, [Type])
getClassPredTys ty = case getClassPredTys_maybe ty of
Just (clas, tys) -> (clas, tys)
Nothing -> pprPanic "getClassPredTys" (ppr ty) | 225 | getClassPredTys ty = case getClassPredTys_maybe ty of
Just (clas, tys) -> (clas, tys)
Nothing -> pprPanic "getClassPredTys" (ppr ty) | 157 | false | true | 0 | 10 | 51 | 80 | 41 | 39 | null | null |
gree/haskell-prefork | test/Constant.hs | mit | settingRelaunch :: String
settingRelaunch = "relaunchSettings" | 62 | settingRelaunch :: String
settingRelaunch = "relaunchSettings" | 62 | settingRelaunch = "relaunchSettings" | 36 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
liesen/osm-xapi | src/Data/Geo/OSM/Xapi/Xapi.hs | lgpl-3.0 | readXapiFile :: FilePath -> IO [Xapi]
readXapiFile = runX . xunpickleDocument xpickle [withRemoveWS yes, withFileMimeType v_1] | 126 | readXapiFile :: FilePath -> IO [Xapi]
readXapiFile = runX . xunpickleDocument xpickle [withRemoveWS yes, withFileMimeType v_1] | 126 | readXapiFile = runX . xunpickleDocument xpickle [withRemoveWS yes, withFileMimeType v_1] | 88 | false | true | 0 | 8 | 15 | 42 | 21 | 21 | null | null |
typedvar/hLand | hcore/GCompiler.hs | mit | compileE (ENum n) _ = [PushInt n] | 33 | compileE (ENum n) _ = [PushInt n] | 33 | compileE (ENum n) _ = [PushInt n] | 33 | false | false | 0 | 7 | 6 | 23 | 11 | 12 | null | null |
laugh-at-me/recurrence | src/Proofs.hs | gpl-3.0 | weakenProof n k t = assocs (2*n-2*k) (ksize 0 (2*k)) $ commut (2*n-2*k) (ksize 0 (2*k)) $ succsums (4*n-4*k) (2*n-2*k) (ksize 0 (2*k)) $ minusplus (4*n-4*k) (2*n-2*k) (ksize (4*k) (2*k)) $ t | 190 | weakenProof n k t = assocs (2*n-2*k) (ksize 0 (2*k)) $ commut (2*n-2*k) (ksize 0 (2*k)) $ succsums (4*n-4*k) (2*n-2*k) (ksize 0 (2*k)) $ minusplus (4*n-4*k) (2*n-2*k) (ksize (4*k) (2*k)) $ t | 190 | weakenProof n k t = assocs (2*n-2*k) (ksize 0 (2*k)) $ commut (2*n-2*k) (ksize 0 (2*k)) $ succsums (4*n-4*k) (2*n-2*k) (ksize 0 (2*k)) $ minusplus (4*n-4*k) (2*n-2*k) (ksize (4*k) (2*k)) $ t | 190 | false | false | 1 | 13 | 31 | 216 | 108 | 108 | null | null |
acowley/language-c | src/Language/C/Data/Ident.hs | bsd-3-clause | -- | build an identifier from a string.
--
-- * only minimal error checking, e.g., the characters of the identifier are
-- not checked for being alphanumerical only; the correct lexis of the
-- identifier should be ensured by the caller, e.g., the scanner.
--
-- * for reasons of simplicity the complete lexeme is hashed.
mkIdent :: Position -> String -> Name -> Ident
mkIdent pos s name = Ident s (quad s) (mkNodeInfo' pos (pos,length s) name) | 460 | mkIdent :: Position -> String -> Name -> Ident
mkIdent pos s name = Ident s (quad s) (mkNodeInfo' pos (pos,length s) name) | 134 | mkIdent pos s name = Ident s (quad s) (mkNodeInfo' pos (pos,length s) name) | 76 | true | true | 0 | 9 | 95 | 74 | 39 | 35 | null | null |
jbaum98/graphics | src/Data/Picture/Drawing/Shapes.hs | bsd-3-clause | -- | Produces an 'EdgeMatrix' of lines approximating a parametric equation
-- @f(t) = \< x(t), y(t), z(t) \>@ as /t/ ranges from 0 to 1
parametric :: Int -- ^ The number of steps to take between 0 and 1
-> (Double -> Point) -- ^ The function @f(t)@
-> EdgeMatrix
parametric steps f = addPoints $ wrap $ emptyWith (round $ 4 / step)
where
addPoints = appEndo $ foldMap Endo [ addEdge p p'
| t <- [0,step..1]
, let Pair p p' = f <$> Pair t (t + step)
]
step = recip $ fromIntegral steps - 1
-- | Produces a 'PointMatrix' of sampling of a parametric equation of two
-- variables @f(t,p) = < x(t,p), y(t,p), z(t,p) >@ as both /t/ and /p/ range
-- from 0 to 1 | 817 | parametric :: Int -- ^ The number of steps to take between 0 and 1
-> (Double -> Point) -- ^ The function @f(t)@
-> EdgeMatrix
parametric steps f = addPoints $ wrap $ emptyWith (round $ 4 / step)
where
addPoints = appEndo $ foldMap Endo [ addEdge p p'
| t <- [0,step..1]
, let Pair p p' = f <$> Pair t (t + step)
]
step = recip $ fromIntegral steps - 1
-- | Produces a 'PointMatrix' of sampling of a parametric equation of two
-- variables @f(t,p) = < x(t,p), y(t,p), z(t,p) >@ as both /t/ and /p/ range
-- from 0 to 1 | 681 | parametric steps f = addPoints $ wrap $ emptyWith (round $ 4 / step)
where
addPoints = appEndo $ foldMap Endo [ addEdge p p'
| t <- [0,step..1]
, let Pair p p' = f <$> Pair t (t + step)
]
step = recip $ fromIntegral steps - 1
-- | Produces a 'PointMatrix' of sampling of a parametric equation of two
-- variables @f(t,p) = < x(t,p), y(t,p), z(t,p) >@ as both /t/ and /p/ range
-- from 0 to 1 | 519 | true | true | 1 | 17 | 298 | 150 | 78 | 72 | null | null |
c0deaddict/project-euler | src/Part1/Problem3.hs | bsd-3-clause | largestPrimeFactor :: Int -> Int
largestPrimeFactor p = maximum $ trialDivision p | 81 | largestPrimeFactor :: Int -> Int
largestPrimeFactor p = maximum $ trialDivision p | 81 | largestPrimeFactor p = maximum $ trialDivision p | 48 | false | true | 0 | 6 | 11 | 25 | 12 | 13 | null | null |
sdiehl/haskell-warp-rest | warp_rest_example.hs | mit | ------------------------------------------------------------------------------
main :: IO ()
main = do
putStrLn "Loading Database."
database <- openLocalStateFrom "db/" (Database fixtures)
putStrLn "Starting HTTP Server."
scottyOpts config $ do
--middleware logStdoutDev
middleware $ staticPolicy (noDots >-> addBase "static")
get "/" $ file "index.html"
get "/read/" $ do
result <- liftIO $ query database (AllKeys 10)
json result
get "/read/:key" $ do
key <- param "key"
result <- liftIO $ query database (LookupKey key)
case result of
Nothing -> status status404
Just value -> json value
delete "/delete/:key" $ do
key <- param "key"
_ <- liftIO $ update database (DeleteKey key)
status status200
post "/update/" $ do
(key, val) <- jsonData
_ <- liftIO $ update database (InsertKey key val)
status status200
------------------------------------------------------------------------------ | 1,145 | main :: IO ()
main = do
putStrLn "Loading Database."
database <- openLocalStateFrom "db/" (Database fixtures)
putStrLn "Starting HTTP Server."
scottyOpts config $ do
--middleware logStdoutDev
middleware $ staticPolicy (noDots >-> addBase "static")
get "/" $ file "index.html"
get "/read/" $ do
result <- liftIO $ query database (AllKeys 10)
json result
get "/read/:key" $ do
key <- param "key"
result <- liftIO $ query database (LookupKey key)
case result of
Nothing -> status status404
Just value -> json value
delete "/delete/:key" $ do
key <- param "key"
_ <- liftIO $ update database (DeleteKey key)
status status200
post "/update/" $ do
(key, val) <- jsonData
_ <- liftIO $ update database (InsertKey key val)
status status200
------------------------------------------------------------------------------ | 1,065 | main = do
putStrLn "Loading Database."
database <- openLocalStateFrom "db/" (Database fixtures)
putStrLn "Starting HTTP Server."
scottyOpts config $ do
--middleware logStdoutDev
middleware $ staticPolicy (noDots >-> addBase "static")
get "/" $ file "index.html"
get "/read/" $ do
result <- liftIO $ query database (AllKeys 10)
json result
get "/read/:key" $ do
key <- param "key"
result <- liftIO $ query database (LookupKey key)
case result of
Nothing -> status status404
Just value -> json value
delete "/delete/:key" $ do
key <- param "key"
_ <- liftIO $ update database (DeleteKey key)
status status200
post "/update/" $ do
(key, val) <- jsonData
_ <- liftIO $ update database (InsertKey key val)
status status200
------------------------------------------------------------------------------ | 1,051 | true | true | 1 | 18 | 374 | 305 | 131 | 174 | null | null |
three/codeworld | funblocks-client/src/Blocks/Types.hs | apache-2.0 | icon :: T.Text -> Field
icon name = FieldImage ("ims/" `T.append` name) 20 20 | 77 | icon :: T.Text -> Field
icon name = FieldImage ("ims/" `T.append` name) 20 20 | 77 | icon name = FieldImage ("ims/" `T.append` name) 20 20 | 53 | false | true | 0 | 7 | 13 | 41 | 21 | 20 | null | null |
green-haskell/ghc | compiler/basicTypes/SrcLoc.hs | bsd-3-clause | cmpSrcLoc (RealSrcLoc _) (UnhelpfulLoc _) = LT | 50 | cmpSrcLoc (RealSrcLoc _) (UnhelpfulLoc _) = LT | 50 | cmpSrcLoc (RealSrcLoc _) (UnhelpfulLoc _) = LT | 50 | false | false | 0 | 7 | 10 | 27 | 12 | 15 | null | null |
miguelpagano/equ | Equ/Theories/FOL.hs | gpl-3.0 | -- | Discrepancia /≡
folDiscrep :: Operator
folDiscrep = Operator { opRepr = "/≡"
, opName = Discrep
, opTy = folBinOpType
, opAssoc = ALeft
, opNotationTy = NInfix
, opPrec = 1
, opGlyphs = ["/="]
} | 359 | folDiscrep :: Operator
folDiscrep = Operator { opRepr = "/≡"
, opName = Discrep
, opTy = folBinOpType
, opAssoc = ALeft
, opNotationTy = NInfix
, opPrec = 1
, opGlyphs = ["/="]
} | 332 | folDiscrep = Operator { opRepr = "/≡"
, opName = Discrep
, opTy = folBinOpType
, opAssoc = ALeft
, opNotationTy = NInfix
, opPrec = 1
, opGlyphs = ["/="]
} | 309 | true | true | 0 | 7 | 192 | 59 | 38 | 21 | null | null |
kmate/HaRe | src/Language/Haskell/Refact/Refactoring/Renaming.hs | bsd-3-clause | renameTopLevelVarName :: GHC.Name -> String -> GHC.Name -> GHC.ModuleName -> GHC.RenamedSource
-> Bool -> Bool -> RefactGhc GHC.RenamedSource
renameTopLevelVarName oldPN newName newNameGhc modName renamed existChecking exportChecking = do
logm $ "renameTopLevelVarName:(existChecking, exportChecking)=" ++ show (existChecking, exportChecking)
causeAmbiguity <- causeAmbiguityInExports oldPN newNameGhc
-- f' contains names imported from other modules;
-- d' contains the top level names declared in this module;
(f', d') <- hsFDsFromInside renamed
--filter those qualified free variables in f'
-- let (f,d) = ((nub.map pNtoName.filter (not.isQualifiedPN)) f', (nub.map pNtoName) d')
let (f, d) = (map nameToString f', map nameToString d')
logm $ "renameTopLevelVarName:f=" ++ show f
logm $ "renameTopLevelVarName:d=" ++ show d
let newNameStr = nameToString newNameGhc
logm $ "renameTopLevelVarName:(newName,newNameStr)=" ++ show (newName, newNameStr)
scopeClashNames <- inScopeNames newName
logm $ "renameTopLevelVarName:(f')=" ++ showGhc f'
logm $ "renameTopLevelVarName:(scopeClashNames,intersection)=" ++
showGhc (scopeClashNames, scopeClashNames `intersect` f')
logm $ "renameTopLevelVarName:(oldPN,modName)=" ++ showGhc (oldPN,modName)
-- Another implementation option is to add the qualifier to newName automatically.
when (nonEmptyList $ intersect scopeClashNames f') .
error $ mconcat [ "The new name will cause an ambiguous occurrence problem, "
, "please select another new name or qualify the use of '"
, newName ++ "' before renaming!\n"]
when (existChecking && newNameStr `elem` d \\ [nameToString oldPN]) . -- only check the declared names here
--the same name has been declared in this module.
error $ mconcat ["Name '", newName, "' already exists in this module\n"]
when (exportChecking && causeNameClashInExports oldPN newNameGhc modName renamed) $
error "The new name will cause conflicting exports, please select another new name!"
when (exportChecking && causeAmbiguity) . -- causeAmbiguityInExports oldPN newNameGhc {- inscps -} renamed
error $ mconcat ["The new name will cause ambiguity in the exports of module '"
, show modName
, "' , please select another name!"]
-- get all of those declared names visible to oldPN at where oldPN is used.
logm "renameTopLevelVarName:basic tests done"
isInScopeUnqual <- isInScopeAndUnqualifiedGhc newName (Just newNameGhc)
logm "renameTopLevelVarName:after isInScopeUnqual"
logm $ "renameTopLevelVarName:oldPN=" ++ showGhc oldPN
ds <- hsVisibleNames oldPN renamed
logm $ "renameTopLevelVarName:ds computed=" ++ show ds
when (existChecking && newName `elem` nub (ds `union` f) \\ [nameToString oldPN]) .
error $ mconcat [ "Name '", newName, "' already exists, or renaming '", nameToString oldPN, "' to '"
, newName, "' will change the program's semantics!\n"]
logm "renameTopLevelVarName start..:should have qualified"
parsed <- renamePN oldPN newNameGhc (exportChecking && isInScopeUnqual) =<< getRefactParsed
putRefactParsed parsed mempty
logm "renameTopLevelVarName done:should have qualified"
getRefactRenamed
------------------------------------------------------------------------ | 3,498 | renameTopLevelVarName :: GHC.Name -> String -> GHC.Name -> GHC.ModuleName -> GHC.RenamedSource
-> Bool -> Bool -> RefactGhc GHC.RenamedSource
renameTopLevelVarName oldPN newName newNameGhc modName renamed existChecking exportChecking = do
logm $ "renameTopLevelVarName:(existChecking, exportChecking)=" ++ show (existChecking, exportChecking)
causeAmbiguity <- causeAmbiguityInExports oldPN newNameGhc
-- f' contains names imported from other modules;
-- d' contains the top level names declared in this module;
(f', d') <- hsFDsFromInside renamed
--filter those qualified free variables in f'
-- let (f,d) = ((nub.map pNtoName.filter (not.isQualifiedPN)) f', (nub.map pNtoName) d')
let (f, d) = (map nameToString f', map nameToString d')
logm $ "renameTopLevelVarName:f=" ++ show f
logm $ "renameTopLevelVarName:d=" ++ show d
let newNameStr = nameToString newNameGhc
logm $ "renameTopLevelVarName:(newName,newNameStr)=" ++ show (newName, newNameStr)
scopeClashNames <- inScopeNames newName
logm $ "renameTopLevelVarName:(f')=" ++ showGhc f'
logm $ "renameTopLevelVarName:(scopeClashNames,intersection)=" ++
showGhc (scopeClashNames, scopeClashNames `intersect` f')
logm $ "renameTopLevelVarName:(oldPN,modName)=" ++ showGhc (oldPN,modName)
-- Another implementation option is to add the qualifier to newName automatically.
when (nonEmptyList $ intersect scopeClashNames f') .
error $ mconcat [ "The new name will cause an ambiguous occurrence problem, "
, "please select another new name or qualify the use of '"
, newName ++ "' before renaming!\n"]
when (existChecking && newNameStr `elem` d \\ [nameToString oldPN]) . -- only check the declared names here
--the same name has been declared in this module.
error $ mconcat ["Name '", newName, "' already exists in this module\n"]
when (exportChecking && causeNameClashInExports oldPN newNameGhc modName renamed) $
error "The new name will cause conflicting exports, please select another new name!"
when (exportChecking && causeAmbiguity) . -- causeAmbiguityInExports oldPN newNameGhc {- inscps -} renamed
error $ mconcat ["The new name will cause ambiguity in the exports of module '"
, show modName
, "' , please select another name!"]
-- get all of those declared names visible to oldPN at where oldPN is used.
logm "renameTopLevelVarName:basic tests done"
isInScopeUnqual <- isInScopeAndUnqualifiedGhc newName (Just newNameGhc)
logm "renameTopLevelVarName:after isInScopeUnqual"
logm $ "renameTopLevelVarName:oldPN=" ++ showGhc oldPN
ds <- hsVisibleNames oldPN renamed
logm $ "renameTopLevelVarName:ds computed=" ++ show ds
when (existChecking && newName `elem` nub (ds `union` f) \\ [nameToString oldPN]) .
error $ mconcat [ "Name '", newName, "' already exists, or renaming '", nameToString oldPN, "' to '"
, newName, "' will change the program's semantics!\n"]
logm "renameTopLevelVarName start..:should have qualified"
parsed <- renamePN oldPN newNameGhc (exportChecking && isInScopeUnqual) =<< getRefactParsed
putRefactParsed parsed mempty
logm "renameTopLevelVarName done:should have qualified"
getRefactRenamed
------------------------------------------------------------------------ | 3,498 | renameTopLevelVarName oldPN newName newNameGhc modName renamed existChecking exportChecking = do
logm $ "renameTopLevelVarName:(existChecking, exportChecking)=" ++ show (existChecking, exportChecking)
causeAmbiguity <- causeAmbiguityInExports oldPN newNameGhc
-- f' contains names imported from other modules;
-- d' contains the top level names declared in this module;
(f', d') <- hsFDsFromInside renamed
--filter those qualified free variables in f'
-- let (f,d) = ((nub.map pNtoName.filter (not.isQualifiedPN)) f', (nub.map pNtoName) d')
let (f, d) = (map nameToString f', map nameToString d')
logm $ "renameTopLevelVarName:f=" ++ show f
logm $ "renameTopLevelVarName:d=" ++ show d
let newNameStr = nameToString newNameGhc
logm $ "renameTopLevelVarName:(newName,newNameStr)=" ++ show (newName, newNameStr)
scopeClashNames <- inScopeNames newName
logm $ "renameTopLevelVarName:(f')=" ++ showGhc f'
logm $ "renameTopLevelVarName:(scopeClashNames,intersection)=" ++
showGhc (scopeClashNames, scopeClashNames `intersect` f')
logm $ "renameTopLevelVarName:(oldPN,modName)=" ++ showGhc (oldPN,modName)
-- Another implementation option is to add the qualifier to newName automatically.
when (nonEmptyList $ intersect scopeClashNames f') .
error $ mconcat [ "The new name will cause an ambiguous occurrence problem, "
, "please select another new name or qualify the use of '"
, newName ++ "' before renaming!\n"]
when (existChecking && newNameStr `elem` d \\ [nameToString oldPN]) . -- only check the declared names here
--the same name has been declared in this module.
error $ mconcat ["Name '", newName, "' already exists in this module\n"]
when (exportChecking && causeNameClashInExports oldPN newNameGhc modName renamed) $
error "The new name will cause conflicting exports, please select another new name!"
when (exportChecking && causeAmbiguity) . -- causeAmbiguityInExports oldPN newNameGhc {- inscps -} renamed
error $ mconcat ["The new name will cause ambiguity in the exports of module '"
, show modName
, "' , please select another name!"]
-- get all of those declared names visible to oldPN at where oldPN is used.
logm "renameTopLevelVarName:basic tests done"
isInScopeUnqual <- isInScopeAndUnqualifiedGhc newName (Just newNameGhc)
logm "renameTopLevelVarName:after isInScopeUnqual"
logm $ "renameTopLevelVarName:oldPN=" ++ showGhc oldPN
ds <- hsVisibleNames oldPN renamed
logm $ "renameTopLevelVarName:ds computed=" ++ show ds
when (existChecking && newName `elem` nub (ds `union` f) \\ [nameToString oldPN]) .
error $ mconcat [ "Name '", newName, "' already exists, or renaming '", nameToString oldPN, "' to '"
, newName, "' will change the program's semantics!\n"]
logm "renameTopLevelVarName start..:should have qualified"
parsed <- renamePN oldPN newNameGhc (exportChecking && isInScopeUnqual) =<< getRefactParsed
putRefactParsed parsed mempty
logm "renameTopLevelVarName done:should have qualified"
getRefactRenamed
------------------------------------------------------------------------ | 3,334 | false | true | 0 | 15 | 752 | 642 | 313 | 329 | null | null |
jetho/Hclip | System/Hclip.hs | bsd-3-clause | -- | Apply function to clipboard and return its new contents.
modifyClipboard :: (String -> String) -> IO String
modifyClipboard f = do
modified <- f <$> getClipboard
setClipboard modified
return modified
-- | Apply function to clipboard. | 251 | modifyClipboard :: (String -> String) -> IO String
modifyClipboard f = do
modified <- f <$> getClipboard
setClipboard modified
return modified
-- | Apply function to clipboard. | 189 | modifyClipboard f = do
modified <- f <$> getClipboard
setClipboard modified
return modified
-- | Apply function to clipboard. | 138 | true | true | 0 | 8 | 50 | 53 | 25 | 28 | null | null |
sinelaw/infernu | src/Infernu/Parse.hs | gpl-2.0 | addDeclVar :: String -> FuncScope -> FuncScope
addDeclVar name f = f { declVars = Set.insert name $ declVars f } | 112 | addDeclVar :: String -> FuncScope -> FuncScope
addDeclVar name f = f { declVars = Set.insert name $ declVars f } | 112 | addDeclVar name f = f { declVars = Set.insert name $ declVars f } | 65 | false | true | 0 | 9 | 20 | 44 | 22 | 22 | null | null |
hexenroehrling/hs-scheduler | src/RunSetup.hs | gpl-3.0 | setCommand :: FilePath -> RunSetup -> Either String RunSetup
setCommand cmd rs
| rsCmdMaster rs == "" = Right rs { rsCmdMaster = cmd }
| otherwise = Left "command already defined" | 194 | setCommand :: FilePath -> RunSetup -> Either String RunSetup
setCommand cmd rs
| rsCmdMaster rs == "" = Right rs { rsCmdMaster = cmd }
| otherwise = Left "command already defined" | 194 | setCommand cmd rs
| rsCmdMaster rs == "" = Right rs { rsCmdMaster = cmd }
| otherwise = Left "command already defined" | 133 | false | true | 0 | 9 | 46 | 72 | 32 | 40 | null | null |
Crazycolorz5/Haskell-Code | Practice.hs | unlicense | factorial x = if x>0
then x*factorial (x-1)
else 1 | 58 | factorial x = if x>0
then x*factorial (x-1)
else 1 | 58 | factorial x = if x>0
then x*factorial (x-1)
else 1 | 58 | false | false | 0 | 9 | 17 | 35 | 18 | 17 | null | null |
brendanhay/gogol | gogol-speech/gen/Network/Google/Resource/Speech/Projects/Locations/Operations/List.hs | mpl-2.0 | -- | The standard list page token.
plolPageToken :: Lens' ProjectsLocationsOperationsList (Maybe Text)
plolPageToken
= lens _plolPageToken
(\ s a -> s{_plolPageToken = a}) | 179 | plolPageToken :: Lens' ProjectsLocationsOperationsList (Maybe Text)
plolPageToken
= lens _plolPageToken
(\ s a -> s{_plolPageToken = a}) | 144 | plolPageToken
= lens _plolPageToken
(\ s a -> s{_plolPageToken = a}) | 76 | true | true | 0 | 9 | 31 | 48 | 25 | 23 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.