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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tdox/aircraft-service | src/Api/Aircraft.hs | mit | -- | Returns an aircraft by serialNumber or throws a 404 error.
singleAircraft :: Int64 -> App Aircraft
singleAircraft idInt = do
let (key :: Key Aircraft) = toSqlKey idInt
maybeAircraft <- runDb (get key)
case maybeAircraft of
Nothing -> throwError err404
Just ac -> return ac
-- | Returns an aircraft by serialNumber or throws a 404 error. | 372 | singleAircraft :: Int64 -> App Aircraft
singleAircraft idInt = do
let (key :: Key Aircraft) = toSqlKey idInt
maybeAircraft <- runDb (get key)
case maybeAircraft of
Nothing -> throwError err404
Just ac -> return ac
-- | Returns an aircraft by serialNumber or throws a 404 error. | 308 | singleAircraft idInt = do
let (key :: Key Aircraft) = toSqlKey idInt
maybeAircraft <- runDb (get key)
case maybeAircraft of
Nothing -> throwError err404
Just ac -> return ac
-- | Returns an aircraft by serialNumber or throws a 404 error. | 268 | true | true | 0 | 12 | 89 | 90 | 41 | 49 | null | null |
xkollar/lambda2js | src/Parser.hs | gpl-3.0 | source :: Parser Source
source = do
many newline
x <- ndSepBy1 definition (many1 newline)
many newline
eof
return x | 135 | source :: Parser Source
source = do
many newline
x <- ndSepBy1 definition (many1 newline)
many newline
eof
return x | 135 | source = do
many newline
x <- ndSepBy1 definition (many1 newline)
many newline
eof
return x | 111 | false | true | 0 | 11 | 39 | 59 | 23 | 36 | null | null |
scturtle/fun.hs | validity.hs | unlicense | falsify (Negation p) alist yes no =
satisfy p alist yes no | 60 | falsify (Negation p) alist yes no =
satisfy p alist yes no | 60 | falsify (Negation p) alist yes no =
satisfy p alist yes no | 60 | false | false | 0 | 7 | 13 | 30 | 14 | 16 | null | null |
bitemyapp/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | enforceableTypes :: FrozenSet VType
enforceableTypes = ConstantUtils.mkSet [minBound..] | 87 | enforceableTypes :: FrozenSet VType
enforceableTypes = ConstantUtils.mkSet [minBound..] | 87 | enforceableTypes = ConstantUtils.mkSet [minBound..] | 51 | false | true | 1 | 6 | 7 | 25 | 11 | 14 | null | null |
evolutics/haskell-formatter | testsuite/resources/source/comments/depends_on_displacement/single_annotation/line_pair/after_after/Input.hs | gpl-3.0 | -- ^comment 0
-- ^comment 1
successor :: a
successor = successor | 64 | successor :: a
successor = successor | 36 | successor = successor | 21 | true | true | 0 | 6 | 11 | 20 | 9 | 11 | null | null |
DavidAlphaFox/ghc | libraries/containers/Data/IntMap/Base.hs | bsd-3-clause | -- | /O(n)/. Fold the keys and values in the map using the given right-associative
-- binary operator, such that
-- @'foldrWithKey' f z == 'Prelude.foldr' ('uncurry' f) z . 'toAscList'@.
--
-- For example,
--
-- > keys map = foldrWithKey (\k x ks -> k:ks) [] map
--
-- > let f k a result = result ++ "(" ++ (show k) ++ ":" ++ a ++ ")"
-- > foldrWithKey f "Map: " (fromList [(5,"a"), (3,"b")]) == "Map: (5:a)(3:b)"
foldrWithKey :: (Key -> a -> b -> b) -> b -> IntMap a -> b
foldrWithKey f z = \t -> -- Use lambda t to be inlinable with two arguments only.
case t of Bin _ m l r | m < 0 -> go (go z l) r -- put negative numbers before
| otherwise -> go (go z r) l
_ -> go z t
where
go z' Nil = z'
go z' (Tip kx x) = f kx x z'
go z' (Bin _ _ l r) = go (go z' r) l
| 831 | foldrWithKey :: (Key -> a -> b -> b) -> b -> IntMap a -> b
foldrWithKey f z = \t -> -- Use lambda t to be inlinable with two arguments only.
case t of Bin _ m l r | m < 0 -> go (go z l) r -- put negative numbers before
| otherwise -> go (go z r) l
_ -> go z t
where
go z' Nil = z'
go z' (Tip kx x) = f kx x z'
go z' (Bin _ _ l r) = go (go z' r) l
| 417 | foldrWithKey f z = \t -> -- Use lambda t to be inlinable with two arguments only.
case t of Bin _ m l r | m < 0 -> go (go z l) r -- put negative numbers before
| otherwise -> go (go z r) l
_ -> go z t
where
go z' Nil = z'
go z' (Tip kx x) = f kx x z'
go z' (Bin _ _ l r) = go (go z' r) l
| 358 | true | true | 0 | 12 | 250 | 211 | 107 | 104 | null | null |
w4ngyi/postgrest | test/SpecHelper.hs | mit | resetDb :: IO ()
resetDb = do
pool :: H.Pool P.Postgres
<- H.acquirePool pgSettings testPoolOpts
void . liftIO $ H.session pool $
H.tx Nothing $ do
H.unitEx [H.stmt| drop schema if exists "1" cascade |]
H.unitEx [H.stmt| drop schema if exists private cascade |]
H.unitEx [H.stmt| drop schema if exists postgrest cascade |]
loadFixture "roles"
loadFixture "schema" | 398 | resetDb :: IO ()
resetDb = do
pool :: H.Pool P.Postgres
<- H.acquirePool pgSettings testPoolOpts
void . liftIO $ H.session pool $
H.tx Nothing $ do
H.unitEx [H.stmt| drop schema if exists "1" cascade |]
H.unitEx [H.stmt| drop schema if exists private cascade |]
H.unitEx [H.stmt| drop schema if exists postgrest cascade |]
loadFixture "roles"
loadFixture "schema" | 398 | resetDb = do
pool :: H.Pool P.Postgres
<- H.acquirePool pgSettings testPoolOpts
void . liftIO $ H.session pool $
H.tx Nothing $ do
H.unitEx [H.stmt| drop schema if exists "1" cascade |]
H.unitEx [H.stmt| drop schema if exists private cascade |]
H.unitEx [H.stmt| drop schema if exists postgrest cascade |]
loadFixture "roles"
loadFixture "schema" | 381 | false | true | 0 | 11 | 91 | 124 | 60 | 64 | null | null |
kohabi/rxquiz | src/Terminology/Roots.hs | unlicense | quizByMeaning = [("What is the meaning of " ++ white x ++ "?", y) | (x,y) <- questions] | 87 | quizByMeaning = [("What is the meaning of " ++ white x ++ "?", y) | (x,y) <- questions] | 87 | quizByMeaning = [("What is the meaning of " ++ white x ++ "?", y) | (x,y) <- questions] | 87 | false | false | 0 | 9 | 17 | 40 | 22 | 18 | null | null |
rubenpieters/gre-project | shared/src/Lib.hs | bsd-3-clause | createGameResult :: GameState -> GameResult
createGameResult gs = GameResult (gs ^.. playerState . traverse . winner) (gs ^. turnCount) | 135 | createGameResult :: GameState -> GameResult
createGameResult gs = GameResult (gs ^.. playerState . traverse . winner) (gs ^. turnCount) | 135 | createGameResult gs = GameResult (gs ^.. playerState . traverse . winner) (gs ^. turnCount) | 91 | false | true | 0 | 9 | 18 | 50 | 24 | 26 | null | null |
ke00n/alabno | backend/simple-haskell-marker/samples/macro.hs | mit | split chs (c : cs)
| elem c chs = (c : terms, "" : words)
| otherwise = (terms, (c:w) : ws)
where
(terms, words) = split chs cs
(w : ws) = words | 200 | split chs (c : cs)
| elem c chs = (c : terms, "" : words)
| otherwise = (terms, (c:w) : ws)
where
(terms, words) = split chs cs
(w : ws) = words | 200 | split chs (c : cs)
| elem c chs = (c : terms, "" : words)
| otherwise = (terms, (c:w) : ws)
where
(terms, words) = split chs cs
(w : ws) = words | 200 | false | false | 0 | 9 | 90 | 101 | 52 | 49 | null | null |
thielema/wxhaskell | wxdirect/src/Classes.hs | lgpl-2.1 | parseClasses :: Parser [Class]
parseClasses
= do cs <- pclasses 0
eof
return cs | 95 | parseClasses :: Parser [Class]
parseClasses
= do cs <- pclasses 0
eof
return cs | 95 | parseClasses
= do cs <- pclasses 0
eof
return cs | 64 | false | true | 0 | 8 | 29 | 38 | 16 | 22 | null | null |
xenog/haskoin | test/bitcoin/Network/Haskoin/Transaction/Tests.hs | unlicense | testDetSignTx :: (Tx, [SigInput], [PrvKey]) -> Bool
testDetSignTx (tx, sigis, prv) =
not (verifyStdTx tx verData) &&
not (verifyStdTx txSigP verData) && verifyStdTx txSigC verData
where
txSigP =
fromRight (error "Could not decode transaction") $
signTx tx sigis (tail prv)
txSigC =
fromRight (error "Could not decode transaction") $
signTx txSigP sigis [head prv]
verData = map (\(SigInput s v o _ _) -> (s, v, o)) sigis | 474 | testDetSignTx :: (Tx, [SigInput], [PrvKey]) -> Bool
testDetSignTx (tx, sigis, prv) =
not (verifyStdTx tx verData) &&
not (verifyStdTx txSigP verData) && verifyStdTx txSigC verData
where
txSigP =
fromRight (error "Could not decode transaction") $
signTx tx sigis (tail prv)
txSigC =
fromRight (error "Could not decode transaction") $
signTx txSigP sigis [head prv]
verData = map (\(SigInput s v o _ _) -> (s, v, o)) sigis | 474 | testDetSignTx (tx, sigis, prv) =
not (verifyStdTx tx verData) &&
not (verifyStdTx txSigP verData) && verifyStdTx txSigC verData
where
txSigP =
fromRight (error "Could not decode transaction") $
signTx tx sigis (tail prv)
txSigC =
fromRight (error "Could not decode transaction") $
signTx txSigP sigis [head prv]
verData = map (\(SigInput s v o _ _) -> (s, v, o)) sigis | 422 | false | true | 5 | 9 | 121 | 202 | 96 | 106 | null | null |
naoto-ogawa/h-xproto-mysql | src/DataBase/MySQLX/Model.hs | mit | getProjection :: (MonadThrow m) => B.ByteString -> m PP.Projection
getProjection = getMessage | 168 | getProjection :: (MonadThrow m) => B.ByteString -> m PP.Projection
getProjection = getMessage | 143 | getProjection = getMessage | 51 | false | true | 0 | 8 | 86 | 31 | 16 | 15 | null | null |
headprogrammingczar/cabal | cabal-install/Distribution/Solver/Modular/Message.hs | bsd-3-clause | showFR _ Broken = " (package is broken)" | 66 | showFR _ Broken = " (package is broken)" | 66 | showFR _ Broken = " (package is broken)" | 66 | false | false | 1 | 5 | 33 | 13 | 5 | 8 | null | null |
gleachkr/Carnap | Carnap-Server/Util/Handler.hs | gpl-3.0 | asFile :: Document -> FilePath -> Handler TypedContent
asFile doc path = do addHeader "Content-Disposition" $ concat
[ "attachment;"
, "filename=\"", documentFilename doc, "\""
]
sendFile typeOctet path | 295 | asFile :: Document -> FilePath -> Handler TypedContent
asFile doc path = do addHeader "Content-Disposition" $ concat
[ "attachment;"
, "filename=\"", documentFilename doc, "\""
]
sendFile typeOctet path | 295 | asFile doc path = do addHeader "Content-Disposition" $ concat
[ "attachment;"
, "filename=\"", documentFilename doc, "\""
]
sendFile typeOctet path | 240 | false | true | 0 | 11 | 120 | 68 | 31 | 37 | null | null |
mikeplus64/trifecta | src/Text/Trifecta/Result.hs | bsd-3-clause | failed :: String -> Err
failed m = Err (Just (fillSep (pretty <$> words m))) [] mempty mempty Nothing | 101 | failed :: String -> Err
failed m = Err (Just (fillSep (pretty <$> words m))) [] mempty mempty Nothing | 101 | failed m = Err (Just (fillSep (pretty <$> words m))) [] mempty mempty Nothing | 77 | false | true | 0 | 12 | 18 | 56 | 27 | 29 | null | null |
cimmanon/camellia-splices | Heist/Splices/Camellia/Types.hs | bsd-3-clause | showSplice :: (Monad m, Show a) => a -> Splice m
showSplice = stringSplice . show | 81 | showSplice :: (Monad m, Show a) => a -> Splice m
showSplice = stringSplice . show | 81 | showSplice = stringSplice . show | 32 | false | true | 1 | 8 | 15 | 44 | 20 | 24 | null | null |
beni55/haste-compiler | libraries/ghc-7.8/base/GHC/Event/Manager.hs | bsd-3-clause | step :: EventManager -> TimeoutQueue -> IO (Bool, TimeoutQueue)
step mgr@EventManager{..} tq = do
(timeout, q') <- mkTimeout tq
I.poll emBackend timeout (onFdEvent mgr)
state <- readIORef emState
state `seq` return (state == Running, q')
where
-- | Call all expired timer callbacks and return the time to the
-- next timeout.
mkTimeout :: TimeoutQueue -> IO (Timeout, TimeoutQueue)
mkTimeout q = do
now <- getMonotonicTime
applyEdits <- atomicModifyIORef emTimeouts $ \f -> (id, f)
let (expired, q'') = let q' = applyEdits q in q' `seq` Q.atMost now q'
sequence_ $ map Q.value expired
let timeout = case Q.minView q'' of
Nothing -> Forever
Just (Q.E _ t _, _) ->
-- This value will always be positive since the call
-- to 'atMost' above removed any timeouts <= 'now'
let t' = t - now in t' `seq` Timeout t'
return (timeout, q'')
------------------------------------------------------------------------
-- Registering interest in I/O events
-- | Register interest in the given events, without waking the event
-- manager thread. The 'Bool' return value indicates whether the
-- event manager ought to be woken. | 1,250 | step :: EventManager -> TimeoutQueue -> IO (Bool, TimeoutQueue)
step mgr@EventManager{..} tq = do
(timeout, q') <- mkTimeout tq
I.poll emBackend timeout (onFdEvent mgr)
state <- readIORef emState
state `seq` return (state == Running, q')
where
-- | Call all expired timer callbacks and return the time to the
-- next timeout.
mkTimeout :: TimeoutQueue -> IO (Timeout, TimeoutQueue)
mkTimeout q = do
now <- getMonotonicTime
applyEdits <- atomicModifyIORef emTimeouts $ \f -> (id, f)
let (expired, q'') = let q' = applyEdits q in q' `seq` Q.atMost now q'
sequence_ $ map Q.value expired
let timeout = case Q.minView q'' of
Nothing -> Forever
Just (Q.E _ t _, _) ->
-- This value will always be positive since the call
-- to 'atMost' above removed any timeouts <= 'now'
let t' = t - now in t' `seq` Timeout t'
return (timeout, q'')
------------------------------------------------------------------------
-- Registering interest in I/O events
-- | Register interest in the given events, without waking the event
-- manager thread. The 'Bool' return value indicates whether the
-- event manager ought to be woken. | 1,250 | step mgr@EventManager{..} tq = do
(timeout, q') <- mkTimeout tq
I.poll emBackend timeout (onFdEvent mgr)
state <- readIORef emState
state `seq` return (state == Running, q')
where
-- | Call all expired timer callbacks and return the time to the
-- next timeout.
mkTimeout :: TimeoutQueue -> IO (Timeout, TimeoutQueue)
mkTimeout q = do
now <- getMonotonicTime
applyEdits <- atomicModifyIORef emTimeouts $ \f -> (id, f)
let (expired, q'') = let q' = applyEdits q in q' `seq` Q.atMost now q'
sequence_ $ map Q.value expired
let timeout = case Q.minView q'' of
Nothing -> Forever
Just (Q.E _ t _, _) ->
-- This value will always be positive since the call
-- to 'atMost' above removed any timeouts <= 'now'
let t' = t - now in t' `seq` Timeout t'
return (timeout, q'')
------------------------------------------------------------------------
-- Registering interest in I/O events
-- | Register interest in the given events, without waking the event
-- manager thread. The 'Bool' return value indicates whether the
-- event manager ought to be woken. | 1,186 | false | true | 31 | 8 | 321 | 305 | 169 | 136 | null | null |
umerazad/hlisp | problems/sudoku/Sudoku.hs | cc0-1.0 | cols :: Matrix a -> Matrix a
cols [] = [] | 41 | cols :: Matrix a -> Matrix a
cols [] = [] | 41 | cols [] = [] | 12 | false | true | 0 | 6 | 10 | 28 | 13 | 15 | null | null |
jtobin/deprecated-observable | src/Observable/Types.hs | bsd-3-clause | createTargetWithGradient
:: (Vector a -> Double)
-> (Vector a -> Vector a)
-> Target a
createTargetWithGradient f g = Target f (Just g) | 141 | createTargetWithGradient
:: (Vector a -> Double)
-> (Vector a -> Vector a)
-> Target a
createTargetWithGradient f g = Target f (Just g) | 141 | createTargetWithGradient f g = Target f (Just g) | 48 | false | true | 0 | 10 | 28 | 65 | 30 | 35 | null | null |
cstrahan/nikki | src/Utils.hs | lgpl-3.0 | (>$>) :: Functor m => m a -> (a -> b) -> m b
(>$>) = flip fmap | 62 | (>$>) :: Functor m => m a -> (a -> b) -> m b
(>$>) = flip fmap | 62 | (>$>) = flip fmap | 17 | false | true | 0 | 10 | 17 | 52 | 25 | 27 | null | null |
karshan/language-java | Language/Java/Parser.hs | bsd-3-clause | -- For loops
forInit :: P ForInit
forInit = (do
try (do (m,t,vds) <- localVarDecl
return $ ForLocalVars m t vds)) <|>
(seplist1 stmtExp comma >>= return . ForInitExps) | 188 | forInit :: P ForInit
forInit = (do
try (do (m,t,vds) <- localVarDecl
return $ ForLocalVars m t vds)) <|>
(seplist1 stmtExp comma >>= return . ForInitExps) | 174 | forInit = (do
try (do (m,t,vds) <- localVarDecl
return $ ForLocalVars m t vds)) <|>
(seplist1 stmtExp comma >>= return . ForInitExps) | 153 | true | true | 0 | 14 | 49 | 77 | 39 | 38 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | fL_ALIGN_TOP_PANE :: Int
fL_ALIGN_TOP_PANE = 1 | 46 | fL_ALIGN_TOP_PANE :: Int
fL_ALIGN_TOP_PANE = 1 | 46 | fL_ALIGN_TOP_PANE = 1 | 21 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
brendanhay/gogol | gogol-androiddeviceprovisioning/gen/Network/Google/Resource/AndroidDeviceProvisioning/Partners/Devices/Claim.hs | mpl-2.0 | -- | OAuth access token.
pdcAccessToken :: Lens' PartnersDevicesClaim (Maybe Text)
pdcAccessToken
= lens _pdcAccessToken
(\ s a -> s{_pdcAccessToken = a}) | 162 | pdcAccessToken :: Lens' PartnersDevicesClaim (Maybe Text)
pdcAccessToken
= lens _pdcAccessToken
(\ s a -> s{_pdcAccessToken = a}) | 137 | pdcAccessToken
= lens _pdcAccessToken
(\ s a -> s{_pdcAccessToken = a}) | 79 | true | true | 0 | 9 | 29 | 48 | 25 | 23 | null | null |
jvranish/TheExperiment | src/Control/Monad/GraphT.hs | bsd-3-clause | refElem :: (Monad m, Foldable g) => GraphRef f -> g (GraphRef f) -> GraphT f m Bool
refElem ref t = refElem' $ toList t
where
refElem' [] = return False
refElem' (x:xs) = do
yep <- refEq ref x
case yep of
True -> return True
False -> refElem' xs | 288 | refElem :: (Monad m, Foldable g) => GraphRef f -> g (GraphRef f) -> GraphT f m Bool
refElem ref t = refElem' $ toList t
where
refElem' [] = return False
refElem' (x:xs) = do
yep <- refEq ref x
case yep of
True -> return True
False -> refElem' xs | 288 | refElem ref t = refElem' $ toList t
where
refElem' [] = return False
refElem' (x:xs) = do
yep <- refEq ref x
case yep of
True -> return True
False -> refElem' xs | 204 | false | true | 1 | 11 | 94 | 132 | 62 | 70 | null | null |
dgvncsz0f/nws | src/Jerimum/PostgreSQL/Introspect.hs | bsd-3-clause | filterSchema :: (SchemaInfo -> Bool) -> DatabaseInfo -> DatabaseInfo
filterSchema p (DatabaseInfo schemas) = DatabaseInfo (filter p schemas) | 140 | filterSchema :: (SchemaInfo -> Bool) -> DatabaseInfo -> DatabaseInfo
filterSchema p (DatabaseInfo schemas) = DatabaseInfo (filter p schemas) | 140 | filterSchema p (DatabaseInfo schemas) = DatabaseInfo (filter p schemas) | 71 | false | true | 0 | 7 | 17 | 53 | 25 | 28 | null | null |
mjhopkins/ttfi | src/haskell/HOCCG.hs | apache-2.0 | -- "John tripped and fell"
jtaf2_sem = shsem . runSem $ jtaf2_3 | 64 | jtaf2_sem = shsem . runSem $ jtaf2_3 | 36 | jtaf2_sem = shsem . runSem $ jtaf2_3 | 36 | true | false | 2 | 5 | 12 | 19 | 8 | 11 | null | null |
spechub/Hets | LF/Sign.hs | gpl-2.0 | printSig :: Sign -> Doc
printSig sig = vcat $ map printDef (getDefs sig) | 72 | printSig :: Sign -> Doc
printSig sig = vcat $ map printDef (getDefs sig) | 72 | printSig sig = vcat $ map printDef (getDefs sig) | 48 | false | true | 0 | 8 | 13 | 33 | 16 | 17 | null | null |
gridaphobe/ghc | compiler/nativeGen/X86/Ppr.hs | bsd-3-clause | {-
pprInstr (SPILL reg slot)
= hcat [
text "\tSPILL",
char ' ',
pprUserReg reg,
comma,
text "SLOT" <> parens (int slot)]
pprInstr (RELOAD slot reg)
= hcat [
text "\tRELOAD",
char ' ',
text "SLOT" <> parens (int slot),
comma,
pprUserReg reg]
-}
-- Replace 'mov $0x0,%reg' by 'xor %reg,%reg', which is smaller and cheaper.
-- The code generator catches most of these already, but not all.
pprInstr (MOV format (OpImm (ImmInt 0)) dst@(OpReg _))
= pprInstr (XOR format' dst dst)
where format' = case format of
II64 -> II32 -- 32-bit version is equivalent, and smaller
_ -> format | 699 | pprInstr (MOV format (OpImm (ImmInt 0)) dst@(OpReg _))
= pprInstr (XOR format' dst dst)
where format' = case format of
II64 -> II32 -- 32-bit version is equivalent, and smaller
_ -> format | 224 | pprInstr (MOV format (OpImm (ImmInt 0)) dst@(OpReg _))
= pprInstr (XOR format' dst dst)
where format' = case format of
II64 -> II32 -- 32-bit version is equivalent, and smaller
_ -> format | 224 | true | false | 1 | 10 | 224 | 86 | 42 | 44 | null | null |
ublubu/shapes | shapes/src/Physics/Scenes/Balls.hs | mit | stacks' :: Double
-> (Double, Double)
-> (Double, Double)
-> Double
-> (Int, Int)
-> label
-> [WorldObj label]
stacks' = stacks_ (const True) | 183 | stacks' :: Double
-> (Double, Double)
-> (Double, Double)
-> Double
-> (Int, Int)
-> label
-> [WorldObj label]
stacks' = stacks_ (const True) | 183 | stacks' = stacks_ (const True) | 30 | false | true | 0 | 12 | 65 | 68 | 37 | 31 | null | null |
jmitchell/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | mapPTermFC f g (PMatchApp fc n) = PMatchApp (f fc) n | 66 | mapPTermFC f g (PMatchApp fc n) = PMatchApp (f fc) n | 66 | mapPTermFC f g (PMatchApp fc n) = PMatchApp (f fc) n | 66 | false | false | 0 | 7 | 24 | 32 | 15 | 17 | null | null |
HaliteChallenge/Halite-II | airesources/Haskell/Hlt/Entity.hs | mit | -- | Checks if a Ship is docked.
isDocked :: Ship -> Bool
isDocked s = dockingStatus s == Docked | 96 | isDocked :: Ship -> Bool
isDocked s = dockingStatus s == Docked | 63 | isDocked s = dockingStatus s == Docked | 38 | true | true | 0 | 6 | 19 | 26 | 13 | 13 | null | null |
mainland/dph | dph-prim-par/Data/Array/Parallel/Unlifted/Distributed/Data/USegd/Split.hs | bsd-3-clause | -------------------------------------------------------------------------------
-- | Split a segment descriptor across the gang, segment wise.
-- Whole segments are placed on each thread, and we try to balance out
-- the segments so each thread has the same number of array elements.
--
-- We don't split segments across threads, as this would limit our ability
-- to perform intra-thread fusion of lifted operations. The down side
-- of this is that if we have few segments with an un-even size distribution
-- then large segments can cause the gang to become unbalanced.
--
-- In the following example the segment with size 100 dominates and
-- unbalances the gang. There is no reason to put any segments on the
-- the last thread because we need to wait for the first to finish anyway.
--
-- @ > pprp $ splitSegdOnSegsD theGang
-- $ lengthsToUSegd $ fromList [100, 10, 20, 40, 50 :: Int]
--
-- DUSegd lengths: DVector lengths: [ 1, 3, 1, 0]
-- chunks: [[100],[10,20,40],[50],[]]
--
-- indices: DVector lengths: [1,3,1,0]
-- chunks: [[0], [0,10,30], [0], []]
--
-- elements: DInt [100,70,50,0]
-- @
--
-- NOTE: This splitSegdOnSegsD function isn't currently used.
--
splitSegdOnSegsD :: Gang -> USegd -> Dist USegd
splitSegdOnSegsD g !segd
= traceEvent ("dph-prim-par: USegd.splitSegdOnSegsD")
$ mapD (What "USegd.splitSegdOnSegds/fromLengths") g USegd.fromLengths
$ splitAsD g d lens
where
!d = snd
. mapAccumLD g chunks 0
. splitLenD g
$ USegd.takeElements segd
n = USegd.length segd
lens = USegd.takeLengths segd
chunks !i !k
= let !j = go i k
in (j,j-i)
go !i !k | i >= n = i
| m == 0 = go (i+1) k
| k <= 0 = i
| otherwise = go (i+1) (k-m)
where
m = Seq.index (here "splitSegdOnSegsD") lens i
| 1,988 | splitSegdOnSegsD :: Gang -> USegd -> Dist USegd
splitSegdOnSegsD g !segd
= traceEvent ("dph-prim-par: USegd.splitSegdOnSegsD")
$ mapD (What "USegd.splitSegdOnSegds/fromLengths") g USegd.fromLengths
$ splitAsD g d lens
where
!d = snd
. mapAccumLD g chunks 0
. splitLenD g
$ USegd.takeElements segd
n = USegd.length segd
lens = USegd.takeLengths segd
chunks !i !k
= let !j = go i k
in (j,j-i)
go !i !k | i >= n = i
| m == 0 = go (i+1) k
| k <= 0 = i
| otherwise = go (i+1) (k-m)
where
m = Seq.index (here "splitSegdOnSegsD") lens i
| 672 | splitSegdOnSegsD g !segd
= traceEvent ("dph-prim-par: USegd.splitSegdOnSegsD")
$ mapD (What "USegd.splitSegdOnSegds/fromLengths") g USegd.fromLengths
$ splitAsD g d lens
where
!d = snd
. mapAccumLD g chunks 0
. splitLenD g
$ USegd.takeElements segd
n = USegd.length segd
lens = USegd.takeLengths segd
chunks !i !k
= let !j = go i k
in (j,j-i)
go !i !k | i >= n = i
| m == 0 = go (i+1) k
| k <= 0 = i
| otherwise = go (i+1) (k-m)
where
m = Seq.index (here "splitSegdOnSegsD") lens i
| 624 | true | true | 15 | 16 | 582 | 303 | 158 | 145 | null | null |
EarthCitizen/baskell | test/ExecSpec.hs | bsd-3-clause | printStatement2_1 = PrintStatement $ StringValue "test output 2-1" | 66 | printStatement2_1 = PrintStatement $ StringValue "test output 2-1" | 66 | printStatement2_1 = PrintStatement $ StringValue "test output 2-1" | 66 | false | false | 0 | 6 | 7 | 13 | 6 | 7 | null | null |
flocc-net/flocc | v0.1/Compiler/Types/Solver.hs | apache-2.0 | occursInTm _ _ = False | 31 | occursInTm _ _ = False | 31 | occursInTm _ _ = False | 31 | false | false | 0 | 5 | 13 | 11 | 5 | 6 | null | null |
iquiw/cabal-delete | src/CabalDelete/Types.hs | mit | showsPackageId :: PackageId -> ShowS
showsPackageId (PackageIdentifier (PackageName n) v) =
(n ++) . ("-" ++) . (showVersion v ++) | 134 | showsPackageId :: PackageId -> ShowS
showsPackageId (PackageIdentifier (PackageName n) v) =
(n ++) . ("-" ++) . (showVersion v ++) | 134 | showsPackageId (PackageIdentifier (PackageName n) v) =
(n ++) . ("-" ++) . (showVersion v ++) | 97 | false | true | 0 | 9 | 23 | 55 | 30 | 25 | null | null |
cocreature/leksah | src/IDE/Package.hs | gpl-2.0 | idePackageFromPath' :: FilePath -> IDEM (Maybe IDEPackage)
idePackageFromPath' ipdCabalFile = do
mbPackageD <- reifyIDE (\ideR -> catch (do
pd <- readPackageDescription normal ipdCabalFile
return (Just (flattenPackageDescription pd)))
(\ (e :: SomeException) -> do
reflectIDE (ideMessage Normal (__ "Can't activate package " <> T.pack (show e))) ideR
return Nothing))
case mbPackageD of
Nothing -> return Nothing
Just packageD -> do
let ipdModules = Map.fromList $ myLibModules packageD ++ myExeModules packageD
++ myTestModules packageD ++ myBenchmarkModules packageD
ipdMain = [ (modulePath exe, buildInfo exe, False) | exe <- executables packageD ]
++ [ (f, bi, True) | TestSuite _ (TestSuiteExeV10 _ f) bi _ <- testSuites packageD ]
++ [ (f, bi, True) | Benchmark _ (BenchmarkExeV10 _ f) bi _ <- benchmarks packageD ]
ipdExtraSrcs = Set.fromList $ extraSrcFiles packageD
ipdSrcDirs = case nub $ concatMap hsSourceDirs (allBuildInfo' packageD) of
[] -> [".","src"]
l -> l
ipdExes = [ T.pack $ exeName e | e <- executables packageD
, buildable (buildInfo e) ]
ipdExtensions = nub $ concatMap oldExtensions (allBuildInfo' packageD)
ipdTests = [ T.pack $ testName t | t <- testSuites packageD
, buildable (testBuildInfo t) ]
ipdBenchmarks = [ T.pack $ benchmarkName b | b <- benchmarks packageD
, buildable (benchmarkBuildInfo b) ]
ipdPackageId = package packageD
ipdDepends = buildDepends packageD
ipdHasLibs = hasLibs packageD
ipdConfigFlags = ["--enable-tests"]
ipdBuildFlags = []
ipdTestFlags = []
ipdHaddockFlags = []
ipdExeFlags = []
ipdInstallFlags = []
ipdRegisterFlags = []
ipdUnregisterFlags = []
ipdSdistFlags = []
ipdSandboxSources = []
packp = IDEPackage {..}
pfile = dropExtension ipdCabalFile
pack <- do
flagFileExists <- liftIO $ doesFileExist (pfile ++ leksahFlagFileExtension)
if flagFileExists
then liftIO $ readFlags (pfile ++ leksahFlagFileExtension) packp
else return packp
return (Just pack) | 2,971 | idePackageFromPath' :: FilePath -> IDEM (Maybe IDEPackage)
idePackageFromPath' ipdCabalFile = do
mbPackageD <- reifyIDE (\ideR -> catch (do
pd <- readPackageDescription normal ipdCabalFile
return (Just (flattenPackageDescription pd)))
(\ (e :: SomeException) -> do
reflectIDE (ideMessage Normal (__ "Can't activate package " <> T.pack (show e))) ideR
return Nothing))
case mbPackageD of
Nothing -> return Nothing
Just packageD -> do
let ipdModules = Map.fromList $ myLibModules packageD ++ myExeModules packageD
++ myTestModules packageD ++ myBenchmarkModules packageD
ipdMain = [ (modulePath exe, buildInfo exe, False) | exe <- executables packageD ]
++ [ (f, bi, True) | TestSuite _ (TestSuiteExeV10 _ f) bi _ <- testSuites packageD ]
++ [ (f, bi, True) | Benchmark _ (BenchmarkExeV10 _ f) bi _ <- benchmarks packageD ]
ipdExtraSrcs = Set.fromList $ extraSrcFiles packageD
ipdSrcDirs = case nub $ concatMap hsSourceDirs (allBuildInfo' packageD) of
[] -> [".","src"]
l -> l
ipdExes = [ T.pack $ exeName e | e <- executables packageD
, buildable (buildInfo e) ]
ipdExtensions = nub $ concatMap oldExtensions (allBuildInfo' packageD)
ipdTests = [ T.pack $ testName t | t <- testSuites packageD
, buildable (testBuildInfo t) ]
ipdBenchmarks = [ T.pack $ benchmarkName b | b <- benchmarks packageD
, buildable (benchmarkBuildInfo b) ]
ipdPackageId = package packageD
ipdDepends = buildDepends packageD
ipdHasLibs = hasLibs packageD
ipdConfigFlags = ["--enable-tests"]
ipdBuildFlags = []
ipdTestFlags = []
ipdHaddockFlags = []
ipdExeFlags = []
ipdInstallFlags = []
ipdRegisterFlags = []
ipdUnregisterFlags = []
ipdSdistFlags = []
ipdSandboxSources = []
packp = IDEPackage {..}
pfile = dropExtension ipdCabalFile
pack <- do
flagFileExists <- liftIO $ doesFileExist (pfile ++ leksahFlagFileExtension)
if flagFileExists
then liftIO $ readFlags (pfile ++ leksahFlagFileExtension) packp
else return packp
return (Just pack) | 2,971 | idePackageFromPath' ipdCabalFile = do
mbPackageD <- reifyIDE (\ideR -> catch (do
pd <- readPackageDescription normal ipdCabalFile
return (Just (flattenPackageDescription pd)))
(\ (e :: SomeException) -> do
reflectIDE (ideMessage Normal (__ "Can't activate package " <> T.pack (show e))) ideR
return Nothing))
case mbPackageD of
Nothing -> return Nothing
Just packageD -> do
let ipdModules = Map.fromList $ myLibModules packageD ++ myExeModules packageD
++ myTestModules packageD ++ myBenchmarkModules packageD
ipdMain = [ (modulePath exe, buildInfo exe, False) | exe <- executables packageD ]
++ [ (f, bi, True) | TestSuite _ (TestSuiteExeV10 _ f) bi _ <- testSuites packageD ]
++ [ (f, bi, True) | Benchmark _ (BenchmarkExeV10 _ f) bi _ <- benchmarks packageD ]
ipdExtraSrcs = Set.fromList $ extraSrcFiles packageD
ipdSrcDirs = case nub $ concatMap hsSourceDirs (allBuildInfo' packageD) of
[] -> [".","src"]
l -> l
ipdExes = [ T.pack $ exeName e | e <- executables packageD
, buildable (buildInfo e) ]
ipdExtensions = nub $ concatMap oldExtensions (allBuildInfo' packageD)
ipdTests = [ T.pack $ testName t | t <- testSuites packageD
, buildable (testBuildInfo t) ]
ipdBenchmarks = [ T.pack $ benchmarkName b | b <- benchmarks packageD
, buildable (benchmarkBuildInfo b) ]
ipdPackageId = package packageD
ipdDepends = buildDepends packageD
ipdHasLibs = hasLibs packageD
ipdConfigFlags = ["--enable-tests"]
ipdBuildFlags = []
ipdTestFlags = []
ipdHaddockFlags = []
ipdExeFlags = []
ipdInstallFlags = []
ipdRegisterFlags = []
ipdUnregisterFlags = []
ipdSdistFlags = []
ipdSandboxSources = []
packp = IDEPackage {..}
pfile = dropExtension ipdCabalFile
pack <- do
flagFileExists <- liftIO $ doesFileExist (pfile ++ leksahFlagFileExtension)
if flagFileExists
then liftIO $ readFlags (pfile ++ leksahFlagFileExtension) packp
else return packp
return (Just pack) | 2,912 | false | true | 0 | 24 | 1,337 | 716 | 356 | 360 | null | null |
ezyang/ghc | compiler/hsSyn/HsPat.hs | bsd-3-clause | pprPat (SplicePat splice) = pprSplice splice | 48 | pprPat (SplicePat splice) = pprSplice splice | 48 | pprPat (SplicePat splice) = pprSplice splice | 48 | false | false | 0 | 7 | 9 | 18 | 8 | 10 | null | null |
vikraman/ghc | compiler/basicTypes/Id.hs | bsd-3-clause | ---------------------------------
-- SPECIALISATION
-- See Note [Specialisations and RULES in IdInfo] in IdInfo.hs
idSpecialisation :: Id -> RuleInfo
idSpecialisation id = ruleInfo (idInfo id) | 202 | idSpecialisation :: Id -> RuleInfo
idSpecialisation id = ruleInfo (idInfo id) | 77 | idSpecialisation id = ruleInfo (idInfo id) | 42 | true | true | 0 | 7 | 33 | 30 | 16 | 14 | null | null |
nushio3/ghc | ghc/Main.hs | bsd-3-clause | isShowGhcUsageMode _ = False | 28 | isShowGhcUsageMode _ = False | 28 | isShowGhcUsageMode _ = False | 28 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ezyang/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | pprCtO SectionOrigin = text "an operator section" | 57 | pprCtO SectionOrigin = text "an operator section" | 57 | pprCtO SectionOrigin = text "an operator section" | 57 | false | false | 0 | 5 | 14 | 13 | 5 | 8 | null | null |
blanu/arbre-go | Arbre/Expressions.hs | gpl-2.0 | fl :: String -> Expression
fl s = Failure $ Error s | 51 | fl :: String -> Expression
fl s = Failure $ Error s | 51 | fl s = Failure $ Error s | 24 | false | true | 0 | 6 | 11 | 25 | 12 | 13 | null | null |
abarbu/nondeterminism-haskell | src/Control/Monad/Amb.hs | lgpl-3.0 | -- | Run a nondeterministic computation and return @True@
-- if all possible results are @True@, @False@ otherwise.
isNecessary :: Amb Bool Bool -> Bool
isNecessary = runIdentity . isNecessaryT | 193 | isNecessary :: Amb Bool Bool -> Bool
isNecessary = runIdentity . isNecessaryT | 77 | isNecessary = runIdentity . isNecessaryT | 40 | true | true | 0 | 6 | 29 | 26 | 14 | 12 | null | null |
ThoughtWorksInc/DeepDarkFantasy | DDF/Meta/Util.hs | apache-2.0 | isSquare n = sq * sq == n
where sq = floor $ sqrt (fromIntegral n::Double) | 77 | isSquare n = sq * sq == n
where sq = floor $ sqrt (fromIntegral n::Double) | 77 | isSquare n = sq * sq == n
where sq = floor $ sqrt (fromIntegral n::Double) | 77 | false | false | 0 | 8 | 18 | 41 | 20 | 21 | null | null |
ghorn/quadviz-lol | src/ParseFiles.hs | bsd-3-clause | parseOneLine :: String -> [Double]
parseOneLine strs = read $ "[" ++ (replaceSpaces strs) ++ "]"
where
replaceSpaces :: String -> String
replaceSpaces [] = []
replaceSpaces (' ':xs) = ',':replaceSpaces xs
replaceSpaces (x:xs) = x:replaceSpaces xs | 266 | parseOneLine :: String -> [Double]
parseOneLine strs = read $ "[" ++ (replaceSpaces strs) ++ "]"
where
replaceSpaces :: String -> String
replaceSpaces [] = []
replaceSpaces (' ':xs) = ',':replaceSpaces xs
replaceSpaces (x:xs) = x:replaceSpaces xs | 266 | parseOneLine strs = read $ "[" ++ (replaceSpaces strs) ++ "]"
where
replaceSpaces :: String -> String
replaceSpaces [] = []
replaceSpaces (' ':xs) = ',':replaceSpaces xs
replaceSpaces (x:xs) = x:replaceSpaces xs | 231 | false | true | 2 | 8 | 56 | 120 | 56 | 64 | null | null |
bstamour/wave | src/Data/Wave.hs | bsd-3-clause | reflCoefficient :: Double -> Double -> Double
reflCoefficient z1 z2 = (z2 - z1)^2 / (z2 + z1) | 93 | reflCoefficient :: Double -> Double -> Double
reflCoefficient z1 z2 = (z2 - z1)^2 / (z2 + z1) | 93 | reflCoefficient z1 z2 = (z2 - z1)^2 / (z2 + z1) | 47 | false | true | 0 | 8 | 17 | 46 | 24 | 22 | null | null |
thielema/wxhaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcTypes.hs | lgpl-2.1 | {-----------------------------------------------------------------------------------------
CDouble
-----------------------------------------------------------------------------------------}
withDoubleResult :: IO CDouble -> IO Double
withDoubleResult io
= do x <- io
return (fromCDouble x) | 300 | withDoubleResult :: IO CDouble -> IO Double
withDoubleResult io
= do x <- io
return (fromCDouble x) | 108 | withDoubleResult io
= do x <- io
return (fromCDouble x) | 64 | true | true | 0 | 9 | 30 | 44 | 20 | 24 | null | null |
jailson-dias/Arca | src/Main.hs | bsd-3-clause | funcao :: Int -> Int -> Int -> Int -> Int -> Int -> Int
funcao chao espinho flecha buraco chamas n
| n >= 0 && n <= chao = 0
| n > chao && n <= espinho = 1
| n > espinho && n <= flecha = 2
| n > flecha && n <= buraco = 3
| n > buraco && n <= chamas = 4 | 257 | funcao :: Int -> Int -> Int -> Int -> Int -> Int -> Int
funcao chao espinho flecha buraco chamas n
| n >= 0 && n <= chao = 0
| n > chao && n <= espinho = 1
| n > espinho && n <= flecha = 2
| n > flecha && n <= buraco = 3
| n > buraco && n <= chamas = 4 | 257 | funcao chao espinho flecha buraco chamas n
| n >= 0 && n <= chao = 0
| n > chao && n <= espinho = 1
| n > espinho && n <= flecha = 2
| n > flecha && n <= buraco = 3
| n > buraco && n <= chamas = 4 | 201 | false | true | 0 | 10 | 76 | 159 | 76 | 83 | null | null |
nevrenato/Hets_Fork | HasCASL/Sublogic.hs | gpl-2.0 | -- | generate a list of all sublogics for HasCASL
sublogics_all :: [Sublogic]
sublogics_all = let bools = [False, True] in
[ Sublogic
{ has_sub = sub
, has_part = part
, has_eq = eq
, has_pred = pre
, type_classes = tyCl
, has_polymorphism = poly
, has_type_constructors = tyCon
, which_logic = logic
}
| (tyCl, poly) <- [(NoClasses, False), (NoClasses, True),
(SimpleTypeClasses, True), (ConstructorClasses, True)]
, tyCon <- bools
, sub <- bools
, part <- bools
, eq <- bools
, pre <- bools
, logic <- [Atomic, Horn, GHorn, FOL, HOL]
, pre || logic /= HOL && not sub
] | 669 | sublogics_all :: [Sublogic]
sublogics_all = let bools = [False, True] in
[ Sublogic
{ has_sub = sub
, has_part = part
, has_eq = eq
, has_pred = pre
, type_classes = tyCl
, has_polymorphism = poly
, has_type_constructors = tyCon
, which_logic = logic
}
| (tyCl, poly) <- [(NoClasses, False), (NoClasses, True),
(SimpleTypeClasses, True), (ConstructorClasses, True)]
, tyCon <- bools
, sub <- bools
, part <- bools
, eq <- bools
, pre <- bools
, logic <- [Atomic, Horn, GHorn, FOL, HOL]
, pre || logic /= HOL && not sub
] | 619 | sublogics_all = let bools = [False, True] in
[ Sublogic
{ has_sub = sub
, has_part = part
, has_eq = eq
, has_pred = pre
, type_classes = tyCl
, has_polymorphism = poly
, has_type_constructors = tyCon
, which_logic = logic
}
| (tyCl, poly) <- [(NoClasses, False), (NoClasses, True),
(SimpleTypeClasses, True), (ConstructorClasses, True)]
, tyCon <- bools
, sub <- bools
, part <- bools
, eq <- bools
, pre <- bools
, logic <- [Atomic, Horn, GHorn, FOL, HOL]
, pre || logic /= HOL && not sub
] | 591 | true | true | 0 | 12 | 204 | 224 | 129 | 95 | null | null |
Tener/personal-library-yesod | Handler/AssetGroup.hs | bsd-2-clause | -- asset groups
assetGroupAForm :: (Maybe AssetGroup) -> AForm App App AssetGroup
assetGroupAForm proto = AssetGroup
<$> areq textField "Name" (fmap assetGroupName proto)
<*> areq textareaField "Description" (fmap assetGroupDescription proto) | 249 | assetGroupAForm :: (Maybe AssetGroup) -> AForm App App AssetGroup
assetGroupAForm proto = AssetGroup
<$> areq textField "Name" (fmap assetGroupName proto)
<*> areq textareaField "Description" (fmap assetGroupDescription proto) | 232 | assetGroupAForm proto = AssetGroup
<$> areq textField "Name" (fmap assetGroupName proto)
<*> areq textareaField "Description" (fmap assetGroupDescription proto) | 166 | true | true | 0 | 9 | 36 | 70 | 34 | 36 | null | null |
JamesSullivan1/Minisculus | src/MinisculusAST.hs | mit | fromStmt (R5 Write e) =
A_Write (fromExpr e) | 48 | fromStmt (R5 Write e) =
A_Write (fromExpr e) | 48 | fromStmt (R5 Write e) =
A_Write (fromExpr e) | 48 | false | false | 0 | 7 | 11 | 26 | 12 | 14 | null | null |
msakai/icfpc2013 | src/SMT.hs | bsd-2-clause | encodeExpr :: String -> Expr -> Gen SExp
encodeExpr = encodeExpr' (\id -> return $ SAtom id) | 92 | encodeExpr :: String -> Expr -> Gen SExp
encodeExpr = encodeExpr' (\id -> return $ SAtom id) | 92 | encodeExpr = encodeExpr' (\id -> return $ SAtom id) | 51 | false | true | 0 | 9 | 16 | 45 | 21 | 24 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F26.hs | bsd-3-clause | ptr_glTexEnvxvOES :: FunPtr (GLenum -> GLenum -> Ptr GLfixed -> IO ())
ptr_glTexEnvxvOES = unsafePerformIO $ getCommand "glTexEnvxvOES" | 135 | ptr_glTexEnvxvOES :: FunPtr (GLenum -> GLenum -> Ptr GLfixed -> IO ())
ptr_glTexEnvxvOES = unsafePerformIO $ getCommand "glTexEnvxvOES" | 135 | ptr_glTexEnvxvOES = unsafePerformIO $ getCommand "glTexEnvxvOES" | 64 | false | true | 0 | 11 | 17 | 44 | 21 | 23 | null | null |
edofic/memo-ptr | src/Control/Memo.hs | mit | withCacheIO :: Cache -> (a -> b) -> a -> IO b
withCacheIO (Cache ref) f a = do
cache <- readIORef ref
case Map.lookup (call f a) cache of
Just (Value b) -> return $ unsafeCoerce b
Nothing -> do
let res = f a
modifyIORef' ref $ Map.insert (call f a) (Value res)
return res | 304 | withCacheIO :: Cache -> (a -> b) -> a -> IO b
withCacheIO (Cache ref) f a = do
cache <- readIORef ref
case Map.lookup (call f a) cache of
Just (Value b) -> return $ unsafeCoerce b
Nothing -> do
let res = f a
modifyIORef' ref $ Map.insert (call f a) (Value res)
return res | 304 | withCacheIO (Cache ref) f a = do
cache <- readIORef ref
case Map.lookup (call f a) cache of
Just (Value b) -> return $ unsafeCoerce b
Nothing -> do
let res = f a
modifyIORef' ref $ Map.insert (call f a) (Value res)
return res | 258 | false | true | 0 | 17 | 89 | 161 | 72 | 89 | null | null |
ellej/mire | test/Mire/Test/Autocomplete.hs | bsd-3-clause | simpleTest2 :: Assertion
simpleTest2 = assertEqual ""
(Just "sometest")
(acNewText . acNext <$> tryAutocomplete simpleDb "some" 4) | 136 | simpleTest2 :: Assertion
simpleTest2 = assertEqual ""
(Just "sometest")
(acNewText . acNext <$> tryAutocomplete simpleDb "some" 4) | 136 | simpleTest2 = assertEqual ""
(Just "sometest")
(acNewText . acNext <$> tryAutocomplete simpleDb "some" 4) | 111 | false | true | 0 | 7 | 22 | 44 | 21 | 23 | null | null |
phischu/fragnix | benchmarks/containers/Data.IntSet.Base.hs | bsd-3-clause | lookupLE :: Key -> IntSet -> Maybe Key
lookupLE x t = x `seq` case t of
Bin _ m l r | m < 0 -> if x >= 0 then go r l else go Nil r
_ -> go Nil t
where
go def (Bin p m l r) | nomatch x p m = if x < p then unsafeFindMax def else unsafeFindMax r
| zero x m = go def l
| otherwise = go l r
go def (Tip kx bm) | prefixOf x > kx = Just $ kx + highestBitSet bm
| prefixOf x == kx && maskLE /= 0 = Just $ kx + highestBitSet maskLE
| otherwise = unsafeFindMax def
where maskLE = (((bitmapOf x) `shiftLL` 1) - 1) .&. bm
go def Nil = unsafeFindMax def
-- | /O(log n)/. Find smallest element greater or equal to the given one.
--
-- > lookupGE 3 (fromList [3, 5]) == Just 3
-- > lookupGE 4 (fromList [3, 5]) == Just 5
-- > lookupGE 6 (fromList [3, 5]) == Nothing
-- See Note: Local 'go' functions and capturing. | 944 | lookupLE :: Key -> IntSet -> Maybe Key
lookupLE x t = x `seq` case t of
Bin _ m l r | m < 0 -> if x >= 0 then go r l else go Nil r
_ -> go Nil t
where
go def (Bin p m l r) | nomatch x p m = if x < p then unsafeFindMax def else unsafeFindMax r
| zero x m = go def l
| otherwise = go l r
go def (Tip kx bm) | prefixOf x > kx = Just $ kx + highestBitSet bm
| prefixOf x == kx && maskLE /= 0 = Just $ kx + highestBitSet maskLE
| otherwise = unsafeFindMax def
where maskLE = (((bitmapOf x) `shiftLL` 1) - 1) .&. bm
go def Nil = unsafeFindMax def
-- | /O(log n)/. Find smallest element greater or equal to the given one.
--
-- > lookupGE 3 (fromList [3, 5]) == Just 3
-- > lookupGE 4 (fromList [3, 5]) == Just 5
-- > lookupGE 6 (fromList [3, 5]) == Nothing
-- See Note: Local 'go' functions and capturing. | 944 | lookupLE x t = x `seq` case t of
Bin _ m l r | m < 0 -> if x >= 0 then go r l else go Nil r
_ -> go Nil t
where
go def (Bin p m l r) | nomatch x p m = if x < p then unsafeFindMax def else unsafeFindMax r
| zero x m = go def l
| otherwise = go l r
go def (Tip kx bm) | prefixOf x > kx = Just $ kx + highestBitSet bm
| prefixOf x == kx && maskLE /= 0 = Just $ kx + highestBitSet maskLE
| otherwise = unsafeFindMax def
where maskLE = (((bitmapOf x) `shiftLL` 1) - 1) .&. bm
go def Nil = unsafeFindMax def
-- | /O(log n)/. Find smallest element greater or equal to the given one.
--
-- > lookupGE 3 (fromList [3, 5]) == Just 3
-- > lookupGE 4 (fromList [3, 5]) == Just 5
-- > lookupGE 6 (fromList [3, 5]) == Nothing
-- See Note: Local 'go' functions and capturing. | 905 | false | true | 3 | 13 | 333 | 326 | 157 | 169 | null | null |
pxqr/regex-fuzzy | src/Text/Regex/Fuzzy/Dist.hs | mit | insertMany (x : xs) acc [] = insertMany xs (x `insertLeft` acc) [] | 75 | insertMany (x : xs) acc [] = insertMany xs (x `insertLeft` acc) [] | 75 | insertMany (x : xs) acc [] = insertMany xs (x `insertLeft` acc) [] | 75 | false | false | 1 | 7 | 21 | 45 | 21 | 24 | null | null |
mightymoose/liquidhaskell | tests/pos/gimme.hs | bsd-3-clause | gimme _ _ _ = error "gimme" | 34 | gimme _ _ _ = error "gimme" | 34 | gimme _ _ _ = error "gimme" | 34 | false | false | 1 | 5 | 13 | 16 | 6 | 10 | null | null |
atilaneves/mqtt_hs | src/Mqtt/Stream.hs | bsd-3-clause | -- Takes a packet and returns the next MQTT message and the remaining bytes
nextMessage :: BS.ByteString -> (BS.ByteString, BS.ByteString)
nextMessage pkt = if containsFullMessage pkt
then (pack $ take size (unpack pkt), pack $ drop size (unpack pkt))
else (empty, pkt)
where size = getRemainingLength pkt + 2 -- 2 for header length
-- This returns true if there is at least one full message in the byte stream | 470 | nextMessage :: BS.ByteString -> (BS.ByteString, BS.ByteString)
nextMessage pkt = if containsFullMessage pkt
then (pack $ take size (unpack pkt), pack $ drop size (unpack pkt))
else (empty, pkt)
where size = getRemainingLength pkt + 2 -- 2 for header length
-- This returns true if there is at least one full message in the byte stream | 394 | nextMessage pkt = if containsFullMessage pkt
then (pack $ take size (unpack pkt), pack $ drop size (unpack pkt))
else (empty, pkt)
where size = getRemainingLength pkt + 2 -- 2 for header length
-- This returns true if there is at least one full message in the byte stream | 331 | true | true | 0 | 10 | 129 | 107 | 55 | 52 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/RegionBackendServices/List.hs | mpl-2.0 | -- | Creates a value of 'RegionBackendServicesList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rbslReturnPartialSuccess'
--
-- * 'rbslOrderBy'
--
-- * 'rbslProject'
--
-- * 'rbslFilter'
--
-- * 'rbslRegion'
--
-- * 'rbslPageToken'
--
-- * 'rbslMaxResults'
regionBackendServicesList
:: Text -- ^ 'rbslProject'
-> Text -- ^ 'rbslRegion'
-> RegionBackendServicesList
regionBackendServicesList pRbslProject_ pRbslRegion_ =
RegionBackendServicesList'
{ _rbslReturnPartialSuccess = Nothing
, _rbslOrderBy = Nothing
, _rbslProject = pRbslProject_
, _rbslFilter = Nothing
, _rbslRegion = pRbslRegion_
, _rbslPageToken = Nothing
, _rbslMaxResults = 500
} | 782 | regionBackendServicesList
:: Text -- ^ 'rbslProject'
-> Text -- ^ 'rbslRegion'
-> RegionBackendServicesList
regionBackendServicesList pRbslProject_ pRbslRegion_ =
RegionBackendServicesList'
{ _rbslReturnPartialSuccess = Nothing
, _rbslOrderBy = Nothing
, _rbslProject = pRbslProject_
, _rbslFilter = Nothing
, _rbslRegion = pRbslRegion_
, _rbslPageToken = Nothing
, _rbslMaxResults = 500
} | 435 | regionBackendServicesList pRbslProject_ pRbslRegion_ =
RegionBackendServicesList'
{ _rbslReturnPartialSuccess = Nothing
, _rbslOrderBy = Nothing
, _rbslProject = pRbslProject_
, _rbslFilter = Nothing
, _rbslRegion = pRbslRegion_
, _rbslPageToken = Nothing
, _rbslMaxResults = 500
} | 315 | true | true | 0 | 8 | 150 | 96 | 62 | 34 | null | null |
bitemyapp/haskell-jwt | tests/src/Web/JWTTests.hs | mit | case_intDateDeriveOrd = do
let i1 = intDate 1231231231 -- Tue 6 Jan 2009 19:40:31 AEDT
i2 = intDate 1231232231 -- Tue 6 Jan 2009 19:57:11 AEDT
LT @=? i1 `compare` i2 | 183 | case_intDateDeriveOrd = do
let i1 = intDate 1231231231 -- Tue 6 Jan 2009 19:40:31 AEDT
i2 = intDate 1231232231 -- Tue 6 Jan 2009 19:57:11 AEDT
LT @=? i1 `compare` i2 | 183 | case_intDateDeriveOrd = do
let i1 = intDate 1231231231 -- Tue 6 Jan 2009 19:40:31 AEDT
i2 = intDate 1231232231 -- Tue 6 Jan 2009 19:57:11 AEDT
LT @=? i1 `compare` i2 | 183 | false | false | 0 | 10 | 48 | 41 | 21 | 20 | null | null |
exercism/xhaskell | exercises/practice/palindrome-products/.meta/examples/success-standard/src/Palindromes.hs | mit | combinationsWith :: (a -> a -> b) -> [a] -> [[b]]
combinationsWith f = go
where go [] = []
go xs@(x:xs') = map (f x) xs : go xs'
-- union a list of sorted lists, but assume the heads are presorted.
-- this optimization reduces comparisons and allows for an infinite number of
-- input lists | 301 | combinationsWith :: (a -> a -> b) -> [a] -> [[b]]
combinationsWith f = go
where go [] = []
go xs@(x:xs') = map (f x) xs : go xs'
-- union a list of sorted lists, but assume the heads are presorted.
-- this optimization reduces comparisons and allows for an infinite number of
-- input lists | 301 | combinationsWith f = go
where go [] = []
go xs@(x:xs') = map (f x) xs : go xs'
-- union a list of sorted lists, but assume the heads are presorted.
-- this optimization reduces comparisons and allows for an infinite number of
-- input lists | 251 | false | true | 1 | 9 | 68 | 96 | 51 | 45 | null | null |
paulrzcz/takusen-oracle | Database/Oracle/Enumerator.hs | bsd-3-clause | FIXME stmt should not be closed by these functions,
-- because they don't create it.
-- stmt should be closed in function that creates it.
setPrefetchCount :: Session -> StmtHandle -> Int -> IO ()
setPrefetchCount session stmt count = inSession session
(\_ err _ -> with count $ \countPtr ->
OCI.setHandleAttr err (castPtr stmt) oci_HTYPE_STMT countPtr oci_ATTR_PREFETCH_ROWS
) (closeStmt session stmt)
| 426 | setPrefetchCount :: Session -> StmtHandle -> Int -> IO ()
setPrefetchCount session stmt count = inSession session
(\_ err _ -> with count $ \countPtr ->
OCI.setHandleAttr err (castPtr stmt) oci_HTYPE_STMT countPtr oci_ATTR_PREFETCH_ROWS
) (closeStmt session stmt) | 278 | setPrefetchCount session stmt count = inSession session
(\_ err _ -> with count $ \countPtr ->
OCI.setHandleAttr err (castPtr stmt) oci_HTYPE_STMT countPtr oci_ATTR_PREFETCH_ROWS
) (closeStmt session stmt) | 220 | true | true | 2 | 11 | 84 | 123 | 59 | 64 | null | null |
mstksg/ghcjs-websockets | src/JavaScript/NoGHCJS.hs | mit | newObj :: a
newObj = error "newObj: only available in JavaScript" | 65 | newObj :: a
newObj = error "newObj: only available in JavaScript" | 65 | newObj = error "newObj: only available in JavaScript" | 53 | false | true | 0 | 5 | 10 | 14 | 7 | 7 | null | null |
mpickering/hackage-server | BuildClient.hs | bsd-3-clause | resultsDirectory :: BuildOpts -> FilePath
resultsDirectory bo = bo_stateDir bo </> "results" | 92 | resultsDirectory :: BuildOpts -> FilePath
resultsDirectory bo = bo_stateDir bo </> "results" | 92 | resultsDirectory bo = bo_stateDir bo </> "results" | 50 | false | true | 0 | 6 | 11 | 25 | 12 | 13 | null | null |
silkapp/haskell-opaleye | src/Opaleye/Internal/Values.hs | bsd-3-clause | -- There are two annoyances with creating SQL VALUES statements
--
-- 1. SQL does not allow empty VALUES statements so if we want to
-- create a VALUES statement from an empty list we have to fake it
-- somehow. The current approach is to make a VALUES statement
-- with a single row of NULLs and then restrict it with WHERE
-- FALSE.
-- 2. Postgres's type inference of constants is pretty poor so we will
-- sometimes have to give explicit type signatures. The future
-- ShowConstant class will have the same problem. NB We don't
-- actually currently address this problem.
valuesU :: U.Unpackspec columns columns'
-> Valuesspec columns columns'
-> [columns]
-> ((), T.Tag) -> (columns', PQ.PrimQuery, T.Tag)
valuesU unpack valuesspec rows ((), t) = (newColumns, primQ', T.next t)
where runRow row = valuesRow
where (_, valuesRow) =
PM.run (U.runUnpackspec unpack extractValuesEntry row)
(newColumns, valuesPEs_nulls) =
PM.run (runValuesspec valuesspec (extractValuesField t))
valuesPEs = map fst valuesPEs_nulls
nulls = map snd valuesPEs_nulls
yieldNoRows :: PQ.PrimQuery -> PQ.PrimQuery
yieldNoRows = PQ.restrict (HPQ.ConstExpr (HPQ.BoolLit False))
values' :: [[HPQ.PrimExpr]]
(values', wrap) = if null rows
then ([nulls], yieldNoRows)
else (map runRow rows, id)
primQ' = wrap (PQ.Values valuesPEs values')
-- We don't actually use the return value of this. It might be better
-- to come up with another Applicative instance for specifically doing
-- what we need. | 1,682 | valuesU :: U.Unpackspec columns columns'
-> Valuesspec columns columns'
-> [columns]
-> ((), T.Tag) -> (columns', PQ.PrimQuery, T.Tag)
valuesU unpack valuesspec rows ((), t) = (newColumns, primQ', T.next t)
where runRow row = valuesRow
where (_, valuesRow) =
PM.run (U.runUnpackspec unpack extractValuesEntry row)
(newColumns, valuesPEs_nulls) =
PM.run (runValuesspec valuesspec (extractValuesField t))
valuesPEs = map fst valuesPEs_nulls
nulls = map snd valuesPEs_nulls
yieldNoRows :: PQ.PrimQuery -> PQ.PrimQuery
yieldNoRows = PQ.restrict (HPQ.ConstExpr (HPQ.BoolLit False))
values' :: [[HPQ.PrimExpr]]
(values', wrap) = if null rows
then ([nulls], yieldNoRows)
else (map runRow rows, id)
primQ' = wrap (PQ.Values valuesPEs values')
-- We don't actually use the return value of this. It might be better
-- to come up with another Applicative instance for specifically doing
-- what we need. | 1,081 | valuesU unpack valuesspec rows ((), t) = (newColumns, primQ', T.next t)
where runRow row = valuesRow
where (_, valuesRow) =
PM.run (U.runUnpackspec unpack extractValuesEntry row)
(newColumns, valuesPEs_nulls) =
PM.run (runValuesspec valuesspec (extractValuesField t))
valuesPEs = map fst valuesPEs_nulls
nulls = map snd valuesPEs_nulls
yieldNoRows :: PQ.PrimQuery -> PQ.PrimQuery
yieldNoRows = PQ.restrict (HPQ.ConstExpr (HPQ.BoolLit False))
values' :: [[HPQ.PrimExpr]]
(values', wrap) = if null rows
then ([nulls], yieldNoRows)
else (map runRow rows, id)
primQ' = wrap (PQ.Values valuesPEs values')
-- We don't actually use the return value of this. It might be better
-- to come up with another Applicative instance for specifically doing
-- what we need. | 922 | true | true | 0 | 12 | 443 | 321 | 176 | 145 | null | null |
mniip/zalgo | test/Test.hs | bsd-3-clause | prefixFunBySpec :: (forall a. (a -> a -> Bool) -> [a] -> [Int]) -> SpecWith ()
prefixFunBySpec f = do
context "mimicks prefixFun when applied to (==)" $ do
prefixFunSpec $ f (==)
it "mimicks prefixFun with a forgetful predicate" $
property $ \as -> f ((==) `on` fst) (zip as [1..]) == prefixFun (as :: [Bool])
it "returns increasing numbers with a constantly True predicate" $
f (const $ const True) "asdfasd" `shouldBe` [0, 1, 2, 3, 4, 5, 6] | 480 | prefixFunBySpec :: (forall a. (a -> a -> Bool) -> [a] -> [Int]) -> SpecWith ()
prefixFunBySpec f = do
context "mimicks prefixFun when applied to (==)" $ do
prefixFunSpec $ f (==)
it "mimicks prefixFun with a forgetful predicate" $
property $ \as -> f ((==) `on` fst) (zip as [1..]) == prefixFun (as :: [Bool])
it "returns increasing numbers with a constantly True predicate" $
f (const $ const True) "asdfasd" `shouldBe` [0, 1, 2, 3, 4, 5, 6] | 480 | prefixFunBySpec f = do
context "mimicks prefixFun when applied to (==)" $ do
prefixFunSpec $ f (==)
it "mimicks prefixFun with a forgetful predicate" $
property $ \as -> f ((==) `on` fst) (zip as [1..]) == prefixFun (as :: [Bool])
it "returns increasing numbers with a constantly True predicate" $
f (const $ const True) "asdfasd" `shouldBe` [0, 1, 2, 3, 4, 5, 6] | 401 | false | true | 0 | 13 | 118 | 197 | 104 | 93 | null | null |
intolerable/mpi | Main.hs | bsd-3-clause | -- L
globalL :: Int
globalL = 4 | 31 | globalL :: Int
globalL = 4 | 26 | globalL = 4 | 11 | true | true | 0 | 4 | 7 | 12 | 7 | 5 | null | null |
wuzzeb/yesod | yesod-core/Yesod/Core/Handler.hs | mit | modSession :: (SessionMap -> SessionMap) -> GHState -> GHState
modSession f x = x { ghsSession = f $ ghsSession x } | 115 | modSession :: (SessionMap -> SessionMap) -> GHState -> GHState
modSession f x = x { ghsSession = f $ ghsSession x } | 115 | modSession f x = x { ghsSession = f $ ghsSession x } | 52 | false | true | 0 | 8 | 21 | 46 | 24 | 22 | null | null |
oldmanmike/ghc | compiler/basicTypes/VarSet.hs | bsd-3-clause | mkDVarSet :: [Var] -> DVarSet
mkDVarSet = mkUniqDSet | 52 | mkDVarSet :: [Var] -> DVarSet
mkDVarSet = mkUniqDSet | 52 | mkDVarSet = mkUniqDSet | 22 | false | true | 0 | 6 | 7 | 18 | 10 | 8 | null | null |
ezyang/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | metaSelDataConKey = mkPreludeDataConUnique 70 | 67 | metaSelDataConKey = mkPreludeDataConUnique 70 | 67 | metaSelDataConKey = mkPreludeDataConUnique 70 | 67 | false | false | 0 | 5 | 25 | 9 | 4 | 5 | null | null |
basvandijk/usb-example | example.hs | bsd-3-clause | findMyDevice :: Ctx -> VendorId -> ProductId -> IO Device
findMyDevice ctx vendorId productId = do
devs <- V.toList <$> getDevices ctx
deviceDescs <- mapM getDeviceDesc devs
case fmap fst $ find (match . snd) $ zip devs deviceDescs of
Nothing -> hPutStrLn stderr "Mouse not found" >> exitFailure
Just dev -> return dev
where
match :: DeviceDesc -> Bool
match devDesc = deviceVendorId devDesc == vendorId
&& deviceProductId devDesc == productId | 498 | findMyDevice :: Ctx -> VendorId -> ProductId -> IO Device
findMyDevice ctx vendorId productId = do
devs <- V.toList <$> getDevices ctx
deviceDescs <- mapM getDeviceDesc devs
case fmap fst $ find (match . snd) $ zip devs deviceDescs of
Nothing -> hPutStrLn stderr "Mouse not found" >> exitFailure
Just dev -> return dev
where
match :: DeviceDesc -> Bool
match devDesc = deviceVendorId devDesc == vendorId
&& deviceProductId devDesc == productId | 498 | findMyDevice ctx vendorId productId = do
devs <- V.toList <$> getDevices ctx
deviceDescs <- mapM getDeviceDesc devs
case fmap fst $ find (match . snd) $ zip devs deviceDescs of
Nothing -> hPutStrLn stderr "Mouse not found" >> exitFailure
Just dev -> return dev
where
match :: DeviceDesc -> Bool
match devDesc = deviceVendorId devDesc == vendorId
&& deviceProductId devDesc == productId | 440 | false | true | 0 | 12 | 126 | 159 | 73 | 86 | null | null |
ndmitchell/hoogle | src/Action/Server.hs | bsd-3-clause | showURL True _ (stripPrefix "file:///" -> Just x) = "file/" ++ x | 64 | showURL True _ (stripPrefix "file:///" -> Just x) = "file/" ++ x | 64 | showURL True _ (stripPrefix "file:///" -> Just x) = "file/" ++ x | 64 | false | false | 0 | 8 | 11 | 30 | 14 | 16 | null | null |
google-research/dex-lang | src/Dex/Foreign/Util.hs | bsd-3-clause | putOnHeap :: Storable a => a -> IO (Ptr a)
putOnHeap x = do
ptr <- malloc
poke ptr x
return ptr | 101 | putOnHeap :: Storable a => a -> IO (Ptr a)
putOnHeap x = do
ptr <- malloc
poke ptr x
return ptr | 101 | putOnHeap x = do
ptr <- malloc
poke ptr x
return ptr | 58 | false | true | 0 | 9 | 27 | 55 | 24 | 31 | null | null |
snoyberg/ghc | compiler/llvmGen/Llvm/Types.hs | bsd-3-clause | -- | Add a pointer indirection to the supplied type. 'LMLabel' and 'LMVoid'
-- cannot be lifted.
pLift :: LlvmType -> LlvmType
pLift LMLabel = error "Labels are unliftable" | 175 | pLift :: LlvmType -> LlvmType
pLift LMLabel = error "Labels are unliftable" | 78 | pLift LMLabel = error "Labels are unliftable" | 48 | true | true | 0 | 7 | 31 | 28 | 13 | 15 | null | null |
Michaelt293/Lipid-Haskell | src/Lipid/Parsers/KnownSn/Glycerophospholipid.hs | gpl-3.0 | pip3OmegaP :: Parser (PIP3 OmegaPosition)
pip3OmegaP = pip3P radylOmegaP | 72 | pip3OmegaP :: Parser (PIP3 OmegaPosition)
pip3OmegaP = pip3P radylOmegaP | 72 | pip3OmegaP = pip3P radylOmegaP | 30 | false | true | 2 | 6 | 8 | 30 | 11 | 19 | null | null |
alsonkemp/turbinado-website | App/Controllers/Home.hs | bsd-3-clause | hello :: Controller ()
hello = clearLayout | 42 | hello :: Controller ()
hello = clearLayout | 42 | hello = clearLayout | 19 | false | true | 0 | 6 | 6 | 16 | 8 | 8 | null | null |
albertov/hs-mapnik | bindings/src/Mapnik/Bindings/Raster.hs | bsd-3-clause | withMaybe (Just a) f = with a f | 31 | withMaybe (Just a) f = with a f | 31 | withMaybe (Just a) f = with a f | 31 | false | false | 1 | 6 | 7 | 28 | 10 | 18 | null | null |
fiigii/dataflow | dist/build/autogen/Paths_dataflow.hs | mit | getLibexecDir = catchIO (getEnv "dataflow_libexecdir") (\_ -> return libexecdir) | 80 | getLibexecDir = catchIO (getEnv "dataflow_libexecdir") (\_ -> return libexecdir) | 80 | getLibexecDir = catchIO (getEnv "dataflow_libexecdir") (\_ -> return libexecdir) | 80 | false | false | 0 | 8 | 8 | 28 | 14 | 14 | null | null |
plow-technologies/cobalt-kiosk-data-template | src/Kiosk/Backend/Data/Migrations/CobaltBaseForm.hs | bsd-3-clause | fromCobaltBaseForm :: CobaltBaseFormEntry -> DataTemplateEntry
fromCobaltBaseForm f1e = DataTemplateEntry dtKey dtValue
where dtKey = cobaltBaseKey f1e
dtValue = convertCobaltBaseFormToDataTemplate (cobaltBaseValue f1e) | 259 | fromCobaltBaseForm :: CobaltBaseFormEntry -> DataTemplateEntry
fromCobaltBaseForm f1e = DataTemplateEntry dtKey dtValue
where dtKey = cobaltBaseKey f1e
dtValue = convertCobaltBaseFormToDataTemplate (cobaltBaseValue f1e) | 259 | fromCobaltBaseForm f1e = DataTemplateEntry dtKey dtValue
where dtKey = cobaltBaseKey f1e
dtValue = convertCobaltBaseFormToDataTemplate (cobaltBaseValue f1e) | 196 | false | true | 0 | 7 | 60 | 53 | 24 | 29 | null | null |
tjakway/ghcjvm | utils/genprimopcode/Main.hs | bsd-3-clause | tvsIn (TyUTup tys) = concatMap tvsIn tys | 42 | tvsIn (TyUTup tys) = concatMap tvsIn tys | 42 | tvsIn (TyUTup tys) = concatMap tvsIn tys | 42 | false | false | 0 | 6 | 8 | 22 | 9 | 13 | null | null |
mcschroeder/smc | Formula.hs | mit | or (Lit (Neg 0)) y = Lit (Neg 0) | 44 | or (Lit (Neg 0)) y = Lit (Neg 0) | 44 | or (Lit (Neg 0)) y = Lit (Neg 0) | 44 | false | false | 0 | 8 | 20 | 33 | 15 | 18 | null | null |
emilaxelsson/ag-graph | examples/TypeInfTest.hs | bsd-3-clause | -- Nothing
test4R = typeInfG Map.empty $ rename' exp4 | 53 | test4R = typeInfG Map.empty $ rename' exp4 | 42 | test4R = typeInfG Map.empty $ rename' exp4 | 42 | true | false | 1 | 6 | 8 | 22 | 9 | 13 | null | null |
annenkov/contracts | Haskell/TTest.hs | mit | test3 = allCs [test1,test2] | 27 | test3 = allCs [test1,test2] | 27 | test3 = allCs [test1,test2] | 27 | false | false | 1 | 5 | 3 | 18 | 8 | 10 | null | null |
gcampax/ghc | compiler/simplCore/CallArity.hs | bsd-3-clause | callArityAnal _ _ e@(Coercion _)
= (emptyArityRes, e) | 63 | callArityAnal _ _ e@(Coercion _)
= (emptyArityRes, e) | 63 | callArityAnal _ _ e@(Coercion _)
= (emptyArityRes, e) | 63 | false | false | 1 | 7 | 17 | 29 | 14 | 15 | null | null |
kazu-yamamoto/rpf | Milter/Base.hs | bsd-3-clause | -- removing the last '\0'
----------------------------------------------------------------
getIP :: ByteString -> IP
getIP bs
| fam == '4' = IPv4 . read $ adr
| otherwise = IPv6 . read $ adr
where
ip = BS.split '\0' bs !! 1
fam = BS.head ip
adr = BS.unpack $ BS.drop 3 ip
---------------------------------------------------------------- | 359 | getIP :: ByteString -> IP
getIP bs
| fam == '4' = IPv4 . read $ adr
| otherwise = IPv6 . read $ adr
where
ip = BS.split '\0' bs !! 1
fam = BS.head ip
adr = BS.unpack $ BS.drop 3 ip
---------------------------------------------------------------- | 266 | getIP bs
| fam == '4' = IPv4 . read $ adr
| otherwise = IPv6 . read $ adr
where
ip = BS.split '\0' bs !! 1
fam = BS.head ip
adr = BS.unpack $ BS.drop 3 ip
---------------------------------------------------------------- | 240 | true | true | 5 | 8 | 73 | 121 | 53 | 68 | null | null |
labcoders/gol3d-hs | src/Types.hs | mit | defaultState = State { cellDrawConfig = defaultCellDrawConfig
, cursorDrawConfig = defaultCursorDrawConfig
, camState = CamState { camPos = Vector3 0 0 0
, camAngle = Vector2 0 0
, cursorRadius = 5.0
}
, kbdState = M.empty
, cellMap = toCellMap glider3
, evolveDelta = 50
, lastEvolve = 0
, lastKeyPoll = 0
, keyPollDelta = 17
, moveSpeed = 0.25
, angleSpeed = 0.005
, gameMode = BuildMode
, isPlaying = False
} | 813 | defaultState = State { cellDrawConfig = defaultCellDrawConfig
, cursorDrawConfig = defaultCursorDrawConfig
, camState = CamState { camPos = Vector3 0 0 0
, camAngle = Vector2 0 0
, cursorRadius = 5.0
}
, kbdState = M.empty
, cellMap = toCellMap glider3
, evolveDelta = 50
, lastEvolve = 0
, lastKeyPoll = 0
, keyPollDelta = 17
, moveSpeed = 0.25
, angleSpeed = 0.005
, gameMode = BuildMode
, isPlaying = False
} | 813 | defaultState = State { cellDrawConfig = defaultCellDrawConfig
, cursorDrawConfig = defaultCursorDrawConfig
, camState = CamState { camPos = Vector3 0 0 0
, camAngle = Vector2 0 0
, cursorRadius = 5.0
}
, kbdState = M.empty
, cellMap = toCellMap glider3
, evolveDelta = 50
, lastEvolve = 0
, lastKeyPoll = 0
, keyPollDelta = 17
, moveSpeed = 0.25
, angleSpeed = 0.005
, gameMode = BuildMode
, isPlaying = False
} | 813 | false | false | 0 | 9 | 476 | 123 | 76 | 47 | null | null |
toddmohney/flipper | src/Control/Flipper.hs | bsd-3-clause | enabled :: HasFeatureFlags m
=> FeatureName -> m Bool
enabled fName = do
mFeature <- getFeature fName
case mFeature of
(Just feature) -> return $ isEnabled feature
Nothing -> return False
{- |
The 'enabledFor' function returns a Bool indicating if the queried feature is
active for the given enitty.
If the queried FeatureName does not exists, 'enabledFor' returns False.
-} | 415 | enabled :: HasFeatureFlags m
=> FeatureName -> m Bool
enabled fName = do
mFeature <- getFeature fName
case mFeature of
(Just feature) -> return $ isEnabled feature
Nothing -> return False
{- |
The 'enabledFor' function returns a Bool indicating if the queried feature is
active for the given enitty.
If the queried FeatureName does not exists, 'enabledFor' returns False.
-} | 415 | enabled fName = do
mFeature <- getFeature fName
case mFeature of
(Just feature) -> return $ isEnabled feature
Nothing -> return False
{- |
The 'enabledFor' function returns a Bool indicating if the queried feature is
active for the given enitty.
If the queried FeatureName does not exists, 'enabledFor' returns False.
-} | 353 | false | true | 0 | 11 | 101 | 74 | 34 | 40 | null | null |
tfausak/wuss | source/library/Wuss.hs | mit | writer
:: Connection.Connection -> Maybe.Maybe LazyBytes.ByteString -> IO.IO ()
writer connection maybeBytes = do
case maybeBytes of
Maybe.Nothing -> do
Applicative.pure ()
Maybe.Just bytes -> do
Connection.connectionPut connection (LazyBytes.toStrict bytes) | 282 | writer
:: Connection.Connection -> Maybe.Maybe LazyBytes.ByteString -> IO.IO ()
writer connection maybeBytes = do
case maybeBytes of
Maybe.Nothing -> do
Applicative.pure ()
Maybe.Just bytes -> do
Connection.connectionPut connection (LazyBytes.toStrict bytes) | 282 | writer connection maybeBytes = do
case maybeBytes of
Maybe.Nothing -> do
Applicative.pure ()
Maybe.Just bytes -> do
Connection.connectionPut connection (LazyBytes.toStrict bytes) | 200 | false | true | 0 | 17 | 53 | 99 | 44 | 55 | null | null |
comius/haskell-mpfr | src/Numeric/Rounded/Interval.hs | lgpl-3.0 | bisect (I a b) = (a...coerce m, succUlp m...b) where m = a + (coerce b - a) / 2
| 80 | bisect (I a b) = (a...coerce m, succUlp m...b) where m = a + (coerce b - a) / 2
| 80 | bisect (I a b) = (a...coerce m, succUlp m...b) where m = a + (coerce b - a) / 2
| 80 | false | false | 0 | 11 | 20 | 63 | 31 | 32 | null | null |
Mathnerd314/lamdu | src/Lamdu/Data/Expression/Lens.hs | gpl-3.0 | bodyTag :: Lens.Prism' (Body def expr) Guid
bodyTag = _BodyLeaf . _Tag | 70 | bodyTag :: Lens.Prism' (Body def expr) Guid
bodyTag = _BodyLeaf . _Tag | 70 | bodyTag = _BodyLeaf . _Tag | 26 | false | true | 0 | 7 | 11 | 30 | 15 | 15 | null | null |
vTurbine/ghc | compiler/main/DynFlags.hs | bsd-3-clause | package_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
package_flags_deps = [
------- Packages ----------------------------------------------------
make_ord_flag defFlag "package-db"
(HasArg (addPkgConfRef . PkgConfFile))
, make_ord_flag defFlag "clear-package-db" (NoArg clearPkgConf)
, make_ord_flag defFlag "no-global-package-db" (NoArg removeGlobalPkgConf)
, make_ord_flag defFlag "no-user-package-db" (NoArg removeUserPkgConf)
, make_ord_flag defFlag "global-package-db"
(NoArg (addPkgConfRef GlobalPkgConf))
, make_ord_flag defFlag "user-package-db"
(NoArg (addPkgConfRef UserPkgConf))
-- backwards compat with GHC<=7.4 :
, make_dep_flag defFlag "package-conf"
(HasArg $ addPkgConfRef . PkgConfFile) "Use -package-db instead"
, make_dep_flag defFlag "no-user-package-conf"
(NoArg removeUserPkgConf) "Use -no-user-package-db instead"
, make_ord_flag defGhcFlag "package-name" (HasArg $ \name -> do
upd (setUnitId name))
-- TODO: Since we JUST deprecated
-- -this-package-key, let's keep this
-- undeprecated for another cycle.
-- Deprecate this eventually.
-- deprecate "Use -this-unit-id instead")
, make_dep_flag defGhcFlag "this-package-key" (HasArg $ upd . setUnitId)
"Use -this-unit-id instead"
, make_ord_flag defGhcFlag "this-unit-id" (hasArg setUnitId)
, make_ord_flag defFlag "package" (HasArg exposePackage)
, make_ord_flag defFlag "plugin-package-id" (HasArg exposePluginPackageId)
, make_ord_flag defFlag "plugin-package" (HasArg exposePluginPackage)
, make_ord_flag defFlag "package-id" (HasArg exposePackageId)
, make_ord_flag defFlag "hide-package" (HasArg hidePackage)
, make_ord_flag defFlag "hide-all-packages"
(NoArg (setGeneralFlag Opt_HideAllPackages))
, make_ord_flag defFlag "hide-all-plugin-packages"
(NoArg (setGeneralFlag Opt_HideAllPluginPackages))
, make_ord_flag defFlag "package-env" (HasArg setPackageEnv)
, make_ord_flag defFlag "ignore-package" (HasArg ignorePackage)
, make_dep_flag defFlag "syslib" (HasArg exposePackage) "Use -package instead"
, make_ord_flag defFlag "distrust-all-packages"
(NoArg (setGeneralFlag Opt_DistrustAllPackages))
, make_ord_flag defFlag "trust" (HasArg trustPackage)
, make_ord_flag defFlag "distrust" (HasArg distrustPackage)
]
where
setPackageEnv env = upd $ \s -> s { packageEnv = Just env }
-- | Make a list of flags for shell completion.
-- Filter all available flags into two groups, for interactive GHC vs all other. | 2,925 | package_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
package_flags_deps = [
------- Packages ----------------------------------------------------
make_ord_flag defFlag "package-db"
(HasArg (addPkgConfRef . PkgConfFile))
, make_ord_flag defFlag "clear-package-db" (NoArg clearPkgConf)
, make_ord_flag defFlag "no-global-package-db" (NoArg removeGlobalPkgConf)
, make_ord_flag defFlag "no-user-package-db" (NoArg removeUserPkgConf)
, make_ord_flag defFlag "global-package-db"
(NoArg (addPkgConfRef GlobalPkgConf))
, make_ord_flag defFlag "user-package-db"
(NoArg (addPkgConfRef UserPkgConf))
-- backwards compat with GHC<=7.4 :
, make_dep_flag defFlag "package-conf"
(HasArg $ addPkgConfRef . PkgConfFile) "Use -package-db instead"
, make_dep_flag defFlag "no-user-package-conf"
(NoArg removeUserPkgConf) "Use -no-user-package-db instead"
, make_ord_flag defGhcFlag "package-name" (HasArg $ \name -> do
upd (setUnitId name))
-- TODO: Since we JUST deprecated
-- -this-package-key, let's keep this
-- undeprecated for another cycle.
-- Deprecate this eventually.
-- deprecate "Use -this-unit-id instead")
, make_dep_flag defGhcFlag "this-package-key" (HasArg $ upd . setUnitId)
"Use -this-unit-id instead"
, make_ord_flag defGhcFlag "this-unit-id" (hasArg setUnitId)
, make_ord_flag defFlag "package" (HasArg exposePackage)
, make_ord_flag defFlag "plugin-package-id" (HasArg exposePluginPackageId)
, make_ord_flag defFlag "plugin-package" (HasArg exposePluginPackage)
, make_ord_flag defFlag "package-id" (HasArg exposePackageId)
, make_ord_flag defFlag "hide-package" (HasArg hidePackage)
, make_ord_flag defFlag "hide-all-packages"
(NoArg (setGeneralFlag Opt_HideAllPackages))
, make_ord_flag defFlag "hide-all-plugin-packages"
(NoArg (setGeneralFlag Opt_HideAllPluginPackages))
, make_ord_flag defFlag "package-env" (HasArg setPackageEnv)
, make_ord_flag defFlag "ignore-package" (HasArg ignorePackage)
, make_dep_flag defFlag "syslib" (HasArg exposePackage) "Use -package instead"
, make_ord_flag defFlag "distrust-all-packages"
(NoArg (setGeneralFlag Opt_DistrustAllPackages))
, make_ord_flag defFlag "trust" (HasArg trustPackage)
, make_ord_flag defFlag "distrust" (HasArg distrustPackage)
]
where
setPackageEnv env = upd $ \s -> s { packageEnv = Just env }
-- | Make a list of flags for shell completion.
-- Filter all available flags into two groups, for interactive GHC vs all other. | 2,925 | package_flags_deps = [
------- Packages ----------------------------------------------------
make_ord_flag defFlag "package-db"
(HasArg (addPkgConfRef . PkgConfFile))
, make_ord_flag defFlag "clear-package-db" (NoArg clearPkgConf)
, make_ord_flag defFlag "no-global-package-db" (NoArg removeGlobalPkgConf)
, make_ord_flag defFlag "no-user-package-db" (NoArg removeUserPkgConf)
, make_ord_flag defFlag "global-package-db"
(NoArg (addPkgConfRef GlobalPkgConf))
, make_ord_flag defFlag "user-package-db"
(NoArg (addPkgConfRef UserPkgConf))
-- backwards compat with GHC<=7.4 :
, make_dep_flag defFlag "package-conf"
(HasArg $ addPkgConfRef . PkgConfFile) "Use -package-db instead"
, make_dep_flag defFlag "no-user-package-conf"
(NoArg removeUserPkgConf) "Use -no-user-package-db instead"
, make_ord_flag defGhcFlag "package-name" (HasArg $ \name -> do
upd (setUnitId name))
-- TODO: Since we JUST deprecated
-- -this-package-key, let's keep this
-- undeprecated for another cycle.
-- Deprecate this eventually.
-- deprecate "Use -this-unit-id instead")
, make_dep_flag defGhcFlag "this-package-key" (HasArg $ upd . setUnitId)
"Use -this-unit-id instead"
, make_ord_flag defGhcFlag "this-unit-id" (hasArg setUnitId)
, make_ord_flag defFlag "package" (HasArg exposePackage)
, make_ord_flag defFlag "plugin-package-id" (HasArg exposePluginPackageId)
, make_ord_flag defFlag "plugin-package" (HasArg exposePluginPackage)
, make_ord_flag defFlag "package-id" (HasArg exposePackageId)
, make_ord_flag defFlag "hide-package" (HasArg hidePackage)
, make_ord_flag defFlag "hide-all-packages"
(NoArg (setGeneralFlag Opt_HideAllPackages))
, make_ord_flag defFlag "hide-all-plugin-packages"
(NoArg (setGeneralFlag Opt_HideAllPluginPackages))
, make_ord_flag defFlag "package-env" (HasArg setPackageEnv)
, make_ord_flag defFlag "ignore-package" (HasArg ignorePackage)
, make_dep_flag defFlag "syslib" (HasArg exposePackage) "Use -package instead"
, make_ord_flag defFlag "distrust-all-packages"
(NoArg (setGeneralFlag Opt_DistrustAllPackages))
, make_ord_flag defFlag "trust" (HasArg trustPackage)
, make_ord_flag defFlag "distrust" (HasArg distrustPackage)
]
where
setPackageEnv env = upd $ \s -> s { packageEnv = Just env }
-- | Make a list of flags for shell completion.
-- Filter all available flags into two groups, for interactive GHC vs all other. | 2,861 | false | true | 0 | 14 | 780 | 526 | 271 | 255 | null | null |
ghc-android/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | isTyVarExposed :: TcTyVar -> TcType -> Bool
isTyVarExposed tv (TyVarTy tv') = tv == tv' | 89 | isTyVarExposed :: TcTyVar -> TcType -> Bool
isTyVarExposed tv (TyVarTy tv') = tv == tv' | 89 | isTyVarExposed tv (TyVarTy tv') = tv == tv' | 45 | false | true | 0 | 6 | 16 | 39 | 18 | 21 | null | null |
Pieterjaninfo/PP | FP/block2s4.hs | unlicense | expr5 = "((6+y)*(x+4))" | 23 | expr5 = "((6+y)*(x+4))" | 23 | expr5 = "((6+y)*(x+4))" | 23 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
sol/pandoc | src/Tests/Readers/Markdown.hs | gpl-2.0 | {-
p_markdown_round_trip :: Block -> Bool
p_markdown_round_trip b = matches d' d''
where d' = normalize $ Pandoc (Meta [] [] []) [b]
d'' = normalize
$ readMarkdown defaultParserState{ stateSmart = True }
$ writeMarkdown defaultWriterOptions d'
matches (Pandoc _ [Plain []]) (Pandoc _ []) = True
matches (Pandoc _ [Para []]) (Pandoc _ []) = True
matches (Pandoc _ [Plain xs]) (Pandoc _ [Para xs']) = xs == xs'
matches x y = x == y
-}
tests :: [Test]
tests = [ testGroup "inline code"
[ "with attribute" =:
"`document.write(\"Hello\");`{.javascript}"
=?> para
(codeWith ("",["javascript"],[]) "document.write(\"Hello\");")
, "with attribute space" =:
"`*` {.haskell .special x=\"7\"}"
=?> para (codeWith ("",["haskell","special"],[("x","7")]) "*")
]
, testGroup "backslash escapes"
[ "in URL" =:
"[hi](/there\\))"
=?> para (link "/there)" "" "hi")
, "in title" =:
"[hi](/there \"a\\\"a\")"
=?> para (link "/there" "a\"a" "hi")
, "in reference link title" =:
"[hi]\n\n[hi]: /there (a\\)a)"
=?> para (link "/there" "a)a" "hi")
, "in reference link URL" =:
"[hi]\n\n[hi]: /there\\.0"
=?> para (link "/there.0" "" "hi")
]
, testGroup "smart punctuation"
[ test markdownSmart "quote before ellipses"
("'...hi'"
=?> para (singleQuoted ("…hi")))
, test markdownSmart "apostrophe before emph"
("D'oh! A l'*aide*!"
=?> para ("D’oh! A l’" <> emph "aide" <> "!"))
, test markdownSmart "apostrophe in French"
("À l'arrivée de la guerre, le thème de l'«impossibilité du socialisme»"
=?> para ("À l’arrivée de la guerre, le thème de l’«impossibilité du socialisme»"))
]
, testGroup "mixed emphasis and strong"
[ "emph and strong emph alternating" =:
"*xxx* ***xxx*** xxx\n*xxx* ***xxx*** xxx"
=?> para (emph "xxx" <> space <> strong (emph "xxx") <>
space <> "xxx" <> space <>
emph "xxx" <> space <> strong (emph "xxx") <>
space <> "xxx")
, "emph with spaced strong" =:
"*x **xx** x*"
=?> para (emph ("x" <> space <> strong "xx" <> space <> "x"))
]
, testGroup "footnotes"
[ "indent followed by newline and flush-left text" =:
"[^1]\n\n[^1]: my note\n\n \nnot in note\n"
=?> para (note (para "my note")) <> para "not in note"
, "indent followed by newline and indented text" =:
"[^1]\n\n[^1]: my note\n \n in note\n"
=?> para (note (para "my note" <> para "in note"))
, "recursive note" =:
"[^1]\n\n[^1]: See [^1]\n"
=?> para (note (para "See [^1]"))
]
, testGroup "lhs"
[ test (readMarkdown defaultParserState{stateLiterateHaskell = True})
"inverse bird tracks and html" $
"> a\n\n< b\n\n<div>\n"
=?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a"
<>
codeBlockWith ("",["sourceCode","haskell"],[]) "b"
<>
rawBlock "html" "<div>\n\n"
]
-- the round-trip properties frequently fail
-- , testGroup "round trip"
-- [ property "p_markdown_round_trip" p_markdown_round_trip
-- ]
] | 3,671 | tests :: [Test]
tests = [ testGroup "inline code"
[ "with attribute" =:
"`document.write(\"Hello\");`{.javascript}"
=?> para
(codeWith ("",["javascript"],[]) "document.write(\"Hello\");")
, "with attribute space" =:
"`*` {.haskell .special x=\"7\"}"
=?> para (codeWith ("",["haskell","special"],[("x","7")]) "*")
]
, testGroup "backslash escapes"
[ "in URL" =:
"[hi](/there\\))"
=?> para (link "/there)" "" "hi")
, "in title" =:
"[hi](/there \"a\\\"a\")"
=?> para (link "/there" "a\"a" "hi")
, "in reference link title" =:
"[hi]\n\n[hi]: /there (a\\)a)"
=?> para (link "/there" "a)a" "hi")
, "in reference link URL" =:
"[hi]\n\n[hi]: /there\\.0"
=?> para (link "/there.0" "" "hi")
]
, testGroup "smart punctuation"
[ test markdownSmart "quote before ellipses"
("'...hi'"
=?> para (singleQuoted ("…hi")))
, test markdownSmart "apostrophe before emph"
("D'oh! A l'*aide*!"
=?> para ("D’oh! A l’" <> emph "aide" <> "!"))
, test markdownSmart "apostrophe in French"
("À l'arrivée de la guerre, le thème de l'«impossibilité du socialisme»"
=?> para ("À l’arrivée de la guerre, le thème de l’«impossibilité du socialisme»"))
]
, testGroup "mixed emphasis and strong"
[ "emph and strong emph alternating" =:
"*xxx* ***xxx*** xxx\n*xxx* ***xxx*** xxx"
=?> para (emph "xxx" <> space <> strong (emph "xxx") <>
space <> "xxx" <> space <>
emph "xxx" <> space <> strong (emph "xxx") <>
space <> "xxx")
, "emph with spaced strong" =:
"*x **xx** x*"
=?> para (emph ("x" <> space <> strong "xx" <> space <> "x"))
]
, testGroup "footnotes"
[ "indent followed by newline and flush-left text" =:
"[^1]\n\n[^1]: my note\n\n \nnot in note\n"
=?> para (note (para "my note")) <> para "not in note"
, "indent followed by newline and indented text" =:
"[^1]\n\n[^1]: my note\n \n in note\n"
=?> para (note (para "my note" <> para "in note"))
, "recursive note" =:
"[^1]\n\n[^1]: See [^1]\n"
=?> para (note (para "See [^1]"))
]
, testGroup "lhs"
[ test (readMarkdown defaultParserState{stateLiterateHaskell = True})
"inverse bird tracks and html" $
"> a\n\n< b\n\n<div>\n"
=?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a"
<>
codeBlockWith ("",["sourceCode","haskell"],[]) "b"
<>
rawBlock "html" "<div>\n\n"
]
-- the round-trip properties frequently fail
-- , testGroup "round trip"
-- [ property "p_markdown_round_trip" p_markdown_round_trip
-- ]
] | 3,166 | tests = [ testGroup "inline code"
[ "with attribute" =:
"`document.write(\"Hello\");`{.javascript}"
=?> para
(codeWith ("",["javascript"],[]) "document.write(\"Hello\");")
, "with attribute space" =:
"`*` {.haskell .special x=\"7\"}"
=?> para (codeWith ("",["haskell","special"],[("x","7")]) "*")
]
, testGroup "backslash escapes"
[ "in URL" =:
"[hi](/there\\))"
=?> para (link "/there)" "" "hi")
, "in title" =:
"[hi](/there \"a\\\"a\")"
=?> para (link "/there" "a\"a" "hi")
, "in reference link title" =:
"[hi]\n\n[hi]: /there (a\\)a)"
=?> para (link "/there" "a)a" "hi")
, "in reference link URL" =:
"[hi]\n\n[hi]: /there\\.0"
=?> para (link "/there.0" "" "hi")
]
, testGroup "smart punctuation"
[ test markdownSmart "quote before ellipses"
("'...hi'"
=?> para (singleQuoted ("…hi")))
, test markdownSmart "apostrophe before emph"
("D'oh! A l'*aide*!"
=?> para ("D’oh! A l’" <> emph "aide" <> "!"))
, test markdownSmart "apostrophe in French"
("À l'arrivée de la guerre, le thème de l'«impossibilité du socialisme»"
=?> para ("À l’arrivée de la guerre, le thème de l’«impossibilité du socialisme»"))
]
, testGroup "mixed emphasis and strong"
[ "emph and strong emph alternating" =:
"*xxx* ***xxx*** xxx\n*xxx* ***xxx*** xxx"
=?> para (emph "xxx" <> space <> strong (emph "xxx") <>
space <> "xxx" <> space <>
emph "xxx" <> space <> strong (emph "xxx") <>
space <> "xxx")
, "emph with spaced strong" =:
"*x **xx** x*"
=?> para (emph ("x" <> space <> strong "xx" <> space <> "x"))
]
, testGroup "footnotes"
[ "indent followed by newline and flush-left text" =:
"[^1]\n\n[^1]: my note\n\n \nnot in note\n"
=?> para (note (para "my note")) <> para "not in note"
, "indent followed by newline and indented text" =:
"[^1]\n\n[^1]: my note\n \n in note\n"
=?> para (note (para "my note" <> para "in note"))
, "recursive note" =:
"[^1]\n\n[^1]: See [^1]\n"
=?> para (note (para "See [^1]"))
]
, testGroup "lhs"
[ test (readMarkdown defaultParserState{stateLiterateHaskell = True})
"inverse bird tracks and html" $
"> a\n\n< b\n\n<div>\n"
=?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a"
<>
codeBlockWith ("",["sourceCode","haskell"],[]) "b"
<>
rawBlock "html" "<div>\n\n"
]
-- the round-trip properties frequently fail
-- , testGroup "round trip"
-- [ property "p_markdown_round_trip" p_markdown_round_trip
-- ]
] | 3,150 | true | true | 0 | 22 | 1,319 | 636 | 331 | 305 | null | null |
michaxm/haskell-hdfs-thrift-client | src-gen-thrift/ThriftHadoopFileSystem_Client.hs | bsd-3-clause | createFile (ip,op) arg_path arg_mode arg_overwrite arg_bufferSize arg_block_replication arg_blocksize = do
send_createFile op arg_path arg_mode arg_overwrite arg_bufferSize arg_block_replication arg_blocksize
recv_createFile ip | 231 | createFile (ip,op) arg_path arg_mode arg_overwrite arg_bufferSize arg_block_replication arg_blocksize = do
send_createFile op arg_path arg_mode arg_overwrite arg_bufferSize arg_block_replication arg_blocksize
recv_createFile ip | 231 | createFile (ip,op) arg_path arg_mode arg_overwrite arg_bufferSize arg_block_replication arg_blocksize = do
send_createFile op arg_path arg_mode arg_overwrite arg_bufferSize arg_block_replication arg_blocksize
recv_createFile ip | 231 | false | false | 0 | 7 | 23 | 51 | 24 | 27 | null | null |
enolan/Idris-dev | src/Idris/Core/Unify.hs | bsd-3-clause | recoverable (P (DCon _ _ _) x _) (Constant _) = False | 53 | recoverable (P (DCon _ _ _) x _) (Constant _) = False | 53 | recoverable (P (DCon _ _ _) x _) (Constant _) = False | 53 | false | false | 0 | 9 | 11 | 37 | 18 | 19 | null | null |
anton-k/sharc-timbre | src/Sharc/Instruments/CelloPizzicato.hs | bsd-3-clause | note18 :: Note
note18 = Note
(Pitch 184.997 42 "f#3")
19
(Range
(NoteRange
(NoteRangeAmplitude 7029.88 38 1.0e-2)
(NoteRangeHarmonicFreq 1 184.99))
(NoteRange
(NoteRangeAmplitude 184.99 1 4711.0)
(NoteRangeHarmonicFreq 52 9619.84)))
[Harmonic 1 (-1.741) 4711.0
,Harmonic 2 (-2.317) 154.31
,Harmonic 3 (-2.011) 203.03
,Harmonic 4 0.246 24.45
,Harmonic 5 0.926 114.76
,Harmonic 6 (-0.553) 26.75
,Harmonic 7 0.892 49.75
,Harmonic 8 (-0.863) 30.25
,Harmonic 9 2.088 14.42
,Harmonic 10 1.432 13.21
,Harmonic 11 2.486 1.93
,Harmonic 12 0.696 2.03
,Harmonic 13 (-1.205) 0.81
,Harmonic 14 (-2.482) 0.92
,Harmonic 15 (-2.82) 0.54
,Harmonic 16 (-1.904) 0.22
,Harmonic 17 (-0.497) 8.0e-2
,Harmonic 18 (-1.453) 2.0e-2
,Harmonic 19 (-2.255) 9.0e-2
,Harmonic 20 1.856 0.1
,Harmonic 21 (-1.439) 7.0e-2
,Harmonic 22 2.282 0.24
,Harmonic 23 (-2.199) 0.19
,Harmonic 24 (-1.708) 0.24
,Harmonic 25 2.475 0.35
,Harmonic 26 (-2.5) 0.18
,Harmonic 27 (-2.681) 0.16
,Harmonic 28 2.865 2.0e-2
,Harmonic 29 (-2.771) 0.23
,Harmonic 30 (-0.631) 7.0e-2
,Harmonic 31 (-1.535) 5.0e-2
,Harmonic 32 (-3.075) 0.16
,Harmonic 33 1.062 0.14
,Harmonic 34 (-1.343) 0.27
,Harmonic 35 (-2.285) 9.0e-2
,Harmonic 36 (-2.07) 5.0e-2
,Harmonic 37 1.536 0.19
,Harmonic 38 (-2.276) 1.0e-2
,Harmonic 39 (-1.782) 2.0e-2
,Harmonic 40 (-0.823) 6.0e-2
,Harmonic 41 2.4e-2 0.19
,Harmonic 42 (-2.066) 0.11
,Harmonic 43 (-1.934) 5.0e-2
,Harmonic 44 0.834 0.1
,Harmonic 45 0.182 0.18
,Harmonic 46 (-0.437) 0.14
,Harmonic 47 1.214 0.12
,Harmonic 48 (-0.915) 0.39
,Harmonic 49 (-2.21) 0.18
,Harmonic 50 1.085 6.0e-2
,Harmonic 51 (-2.814) 5.0e-2
,Harmonic 52 1.595 0.2] | 1,892 | note18 :: Note
note18 = Note
(Pitch 184.997 42 "f#3")
19
(Range
(NoteRange
(NoteRangeAmplitude 7029.88 38 1.0e-2)
(NoteRangeHarmonicFreq 1 184.99))
(NoteRange
(NoteRangeAmplitude 184.99 1 4711.0)
(NoteRangeHarmonicFreq 52 9619.84)))
[Harmonic 1 (-1.741) 4711.0
,Harmonic 2 (-2.317) 154.31
,Harmonic 3 (-2.011) 203.03
,Harmonic 4 0.246 24.45
,Harmonic 5 0.926 114.76
,Harmonic 6 (-0.553) 26.75
,Harmonic 7 0.892 49.75
,Harmonic 8 (-0.863) 30.25
,Harmonic 9 2.088 14.42
,Harmonic 10 1.432 13.21
,Harmonic 11 2.486 1.93
,Harmonic 12 0.696 2.03
,Harmonic 13 (-1.205) 0.81
,Harmonic 14 (-2.482) 0.92
,Harmonic 15 (-2.82) 0.54
,Harmonic 16 (-1.904) 0.22
,Harmonic 17 (-0.497) 8.0e-2
,Harmonic 18 (-1.453) 2.0e-2
,Harmonic 19 (-2.255) 9.0e-2
,Harmonic 20 1.856 0.1
,Harmonic 21 (-1.439) 7.0e-2
,Harmonic 22 2.282 0.24
,Harmonic 23 (-2.199) 0.19
,Harmonic 24 (-1.708) 0.24
,Harmonic 25 2.475 0.35
,Harmonic 26 (-2.5) 0.18
,Harmonic 27 (-2.681) 0.16
,Harmonic 28 2.865 2.0e-2
,Harmonic 29 (-2.771) 0.23
,Harmonic 30 (-0.631) 7.0e-2
,Harmonic 31 (-1.535) 5.0e-2
,Harmonic 32 (-3.075) 0.16
,Harmonic 33 1.062 0.14
,Harmonic 34 (-1.343) 0.27
,Harmonic 35 (-2.285) 9.0e-2
,Harmonic 36 (-2.07) 5.0e-2
,Harmonic 37 1.536 0.19
,Harmonic 38 (-2.276) 1.0e-2
,Harmonic 39 (-1.782) 2.0e-2
,Harmonic 40 (-0.823) 6.0e-2
,Harmonic 41 2.4e-2 0.19
,Harmonic 42 (-2.066) 0.11
,Harmonic 43 (-1.934) 5.0e-2
,Harmonic 44 0.834 0.1
,Harmonic 45 0.182 0.18
,Harmonic 46 (-0.437) 0.14
,Harmonic 47 1.214 0.12
,Harmonic 48 (-0.915) 0.39
,Harmonic 49 (-2.21) 0.18
,Harmonic 50 1.085 6.0e-2
,Harmonic 51 (-2.814) 5.0e-2
,Harmonic 52 1.595 0.2] | 1,892 | note18 = Note
(Pitch 184.997 42 "f#3")
19
(Range
(NoteRange
(NoteRangeAmplitude 7029.88 38 1.0e-2)
(NoteRangeHarmonicFreq 1 184.99))
(NoteRange
(NoteRangeAmplitude 184.99 1 4711.0)
(NoteRangeHarmonicFreq 52 9619.84)))
[Harmonic 1 (-1.741) 4711.0
,Harmonic 2 (-2.317) 154.31
,Harmonic 3 (-2.011) 203.03
,Harmonic 4 0.246 24.45
,Harmonic 5 0.926 114.76
,Harmonic 6 (-0.553) 26.75
,Harmonic 7 0.892 49.75
,Harmonic 8 (-0.863) 30.25
,Harmonic 9 2.088 14.42
,Harmonic 10 1.432 13.21
,Harmonic 11 2.486 1.93
,Harmonic 12 0.696 2.03
,Harmonic 13 (-1.205) 0.81
,Harmonic 14 (-2.482) 0.92
,Harmonic 15 (-2.82) 0.54
,Harmonic 16 (-1.904) 0.22
,Harmonic 17 (-0.497) 8.0e-2
,Harmonic 18 (-1.453) 2.0e-2
,Harmonic 19 (-2.255) 9.0e-2
,Harmonic 20 1.856 0.1
,Harmonic 21 (-1.439) 7.0e-2
,Harmonic 22 2.282 0.24
,Harmonic 23 (-2.199) 0.19
,Harmonic 24 (-1.708) 0.24
,Harmonic 25 2.475 0.35
,Harmonic 26 (-2.5) 0.18
,Harmonic 27 (-2.681) 0.16
,Harmonic 28 2.865 2.0e-2
,Harmonic 29 (-2.771) 0.23
,Harmonic 30 (-0.631) 7.0e-2
,Harmonic 31 (-1.535) 5.0e-2
,Harmonic 32 (-3.075) 0.16
,Harmonic 33 1.062 0.14
,Harmonic 34 (-1.343) 0.27
,Harmonic 35 (-2.285) 9.0e-2
,Harmonic 36 (-2.07) 5.0e-2
,Harmonic 37 1.536 0.19
,Harmonic 38 (-2.276) 1.0e-2
,Harmonic 39 (-1.782) 2.0e-2
,Harmonic 40 (-0.823) 6.0e-2
,Harmonic 41 2.4e-2 0.19
,Harmonic 42 (-2.066) 0.11
,Harmonic 43 (-1.934) 5.0e-2
,Harmonic 44 0.834 0.1
,Harmonic 45 0.182 0.18
,Harmonic 46 (-0.437) 0.14
,Harmonic 47 1.214 0.12
,Harmonic 48 (-0.915) 0.39
,Harmonic 49 (-2.21) 0.18
,Harmonic 50 1.085 6.0e-2
,Harmonic 51 (-2.814) 5.0e-2
,Harmonic 52 1.595 0.2] | 1,877 | false | true | 0 | 11 | 519 | 775 | 404 | 371 | null | null |
mainland/dph | dph-examples/examples/spectral/Pluecker/Common.inc.hs | bsd-3-clause | projectPluecker2 :: Pluecker -> Pluecker -> Double
projectPluecker2 (u1,v1) (u2,v2) = (u1 `dot` v2) + (u2 `dot` v1) | 115 | projectPluecker2 :: Pluecker -> Pluecker -> Double
projectPluecker2 (u1,v1) (u2,v2) = (u1 `dot` v2) + (u2 `dot` v1) | 115 | projectPluecker2 (u1,v1) (u2,v2) = (u1 `dot` v2) + (u2 `dot` v1) | 64 | false | true | 0 | 7 | 17 | 58 | 34 | 24 | null | null |
helino/wham | src/Wham/Analyzer.hs | bsd-3-clause | NonPositive `elub` Zero = NonPositive | 44 | NonPositive `elub` Zero = NonPositive | 44 | NonPositive `elub` Zero = NonPositive | 44 | false | false | 0 | 5 | 11 | 14 | 7 | 7 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.