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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sdiehl/ghc | compiler/prelude/TysPrim.hs | bsd-3-clause | int32PrimTy :: Type
int32PrimTy = mkTyConTy int32PrimTyCon | 62 | int32PrimTy :: Type
int32PrimTy = mkTyConTy int32PrimTyCon | 62 | int32PrimTy = mkTyConTy int32PrimTyCon | 42 | false | true | 0 | 6 | 10 | 21 | 8 | 13 | null | null |
nakamuray/htig | HTIG/IRCServer/Constants.hs | bsd-3-clause | eRR_NOADMININFO = 423 | 21 | eRR_NOADMININFO = 423 | 21 | eRR_NOADMININFO = 423 | 21 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
formrre/yi | yi-core/src/Yi/Config/Simple.hs | gpl-2.0 | -- | Actions to run after startup or reload. Consider using
-- 'runAfterStartup' or 'runManyAfterStartup' instead.
initialActions :: Field [Action]
initialActions = initialActionsA | 180 | initialActions :: Field [Action]
initialActions = initialActionsA | 65 | initialActions = initialActionsA | 32 | true | true | 1 | 6 | 22 | 23 | 11 | 12 | null | null |
CindyLinz/Haskell.js | trans/src/Desugar/String.hs | mit | deStringTool (YHC) = YHC | 24 | deStringTool (YHC) = YHC | 24 | deStringTool (YHC) = YHC | 24 | false | false | 0 | 6 | 3 | 12 | 6 | 6 | null | null |
neongreen/megaparsec | Text/Megaparsec/Prim.hs | bsd-2-clause | -- | Set tab width. If argument of the function is not positive number,
-- 'defaultTabWidth' will be used.
setTabWidth :: MonadParsec s m t => Int -> m ()
setTabWidth w = updateParserState (\(State s pos _) -> State s pos w) | 225 | setTabWidth :: MonadParsec s m t => Int -> m ()
setTabWidth w = updateParserState (\(State s pos _) -> State s pos w) | 117 | setTabWidth w = updateParserState (\(State s pos _) -> State s pos w) | 69 | true | true | 0 | 9 | 43 | 69 | 33 | 36 | null | null |
rahulmutt/ghcvm | compiler/Eta/DeSugar/DsArrows.hs | bsd-3-clause | trimInput
:: ([Id] -> DsM (CoreExpr, IdSet))
-> DsM (CoreExpr, -- desugared expression
IdSet, -- subset of local vars that occur free
[Id]) -- same local vars as a list, fed back to
-- the inner function to form the tuple of
-- inputs to the arrow.
trimInput build_arrow
= fixDs (\ ~(_,_,env_ids) -> do
(core_cmd, free_vars) <- build_arrow env_ids
return (core_cmd, free_vars, varSetElems free_vars)) | 555 | trimInput
:: ([Id] -> DsM (CoreExpr, IdSet))
-> DsM (CoreExpr, -- desugared expression
IdSet, -- subset of local vars that occur free
[Id])
trimInput build_arrow
= fixDs (\ ~(_,_,env_ids) -> do
(core_cmd, free_vars) <- build_arrow env_ids
return (core_cmd, free_vars, varSetElems free_vars)) | 372 | trimInput build_arrow
= fixDs (\ ~(_,_,env_ids) -> do
(core_cmd, free_vars) <- build_arrow env_ids
return (core_cmd, free_vars, varSetElems free_vars)) | 169 | true | true | 0 | 12 | 219 | 112 | 63 | 49 | null | null |
brendanhay/gogol | gogol-firebasehosting/gen/Network/Google/Resource/FirebaseHosting/Sites/Releases/List.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
srlUploadType :: Lens' SitesReleasesList (Maybe Text)
srlUploadType
= lens _srlUploadType
(\ s a -> s{_srlUploadType = a}) | 201 | srlUploadType :: Lens' SitesReleasesList (Maybe Text)
srlUploadType
= lens _srlUploadType
(\ s a -> s{_srlUploadType = a}) | 130 | srlUploadType
= lens _srlUploadType
(\ s a -> s{_srlUploadType = a}) | 76 | true | true | 1 | 9 | 34 | 51 | 25 | 26 | null | null |
ingemaradahl/bilder | src/Compiler/Simple/Utils.hs | lgpl-3.0 | mapStmExpM f (SExp e) = SExp <$> f e | 36 | mapStmExpM f (SExp e) = SExp <$> f e | 36 | mapStmExpM f (SExp e) = SExp <$> f e | 36 | false | false | 0 | 7 | 8 | 24 | 11 | 13 | null | null |
meiersi/psqueues-old | src/Data/HashPSQ/Internal.hs | bsd-3-clause | lookup :: (Ord k, Hashable k, Ord p) => k -> HashPSQ k p v -> Maybe (p, v)
lookup k (HashPSQ ipsq) = do
(p0, B k0 v0 os) <- IntPSQ.lookup (hash k) ipsq
if k0 == k
then return (p0, v0)
else OrdPSQ.lookup k os | 231 | lookup :: (Ord k, Hashable k, Ord p) => k -> HashPSQ k p v -> Maybe (p, v)
lookup k (HashPSQ ipsq) = do
(p0, B k0 v0 os) <- IntPSQ.lookup (hash k) ipsq
if k0 == k
then return (p0, v0)
else OrdPSQ.lookup k os | 231 | lookup k (HashPSQ ipsq) = do
(p0, B k0 v0 os) <- IntPSQ.lookup (hash k) ipsq
if k0 == k
then return (p0, v0)
else OrdPSQ.lookup k os | 156 | false | true | 0 | 10 | 70 | 131 | 66 | 65 | null | null |
jgm/pandoc-citeproc | src/Text/CSL/Data/Embedded.hs | bsd-3-clause | license :: S.ByteString
license = $(embedFile "LICENSE") | 56 | license :: S.ByteString
license = $(embedFile "LICENSE") | 56 | license = $(embedFile "LICENSE") | 32 | false | true | 0 | 7 | 6 | 20 | 10 | 10 | null | null |
DavidAlphaFox/darcs | src/Darcs/Util/Printer.hs | gpl-2.0 | -- | renders a 'Doc' into a list of 'PackedStrings', one for each line.
renderPSs :: RenderMode -> Doc -> [B.ByteString]
renderPSs = renderPSsWith simplePrinters' | 162 | renderPSs :: RenderMode -> Doc -> [B.ByteString]
renderPSs = renderPSsWith simplePrinters' | 90 | renderPSs = renderPSsWith simplePrinters' | 41 | true | true | 0 | 8 | 24 | 28 | 15 | 13 | null | null |
alphaHeavy/shake-install | Development/Shake/Install/BuildDictionary.hs | bsd-3-clause | findCabalFile
:: FilePath
-> Action FilePath
findCabalFile filePath = do
dict <- requestOf unBuildDict
let packageName = takeBaseName $ takeDirectory filePath
case Map.lookup (PackageName packageName) dict of
Just x -> return x
Nothing -> fail $ "Could not find source mapping for: " ++ filePath | 313 | findCabalFile
:: FilePath
-> Action FilePath
findCabalFile filePath = do
dict <- requestOf unBuildDict
let packageName = takeBaseName $ takeDirectory filePath
case Map.lookup (PackageName packageName) dict of
Just x -> return x
Nothing -> fail $ "Could not find source mapping for: " ++ filePath | 313 | findCabalFile filePath = do
dict <- requestOf unBuildDict
let packageName = takeBaseName $ takeDirectory filePath
case Map.lookup (PackageName packageName) dict of
Just x -> return x
Nothing -> fail $ "Could not find source mapping for: " ++ filePath | 264 | false | true | 0 | 12 | 62 | 99 | 43 | 56 | null | null |
exercism/xhaskell | exercises/practice/pov/.meta/examples/success-standard/src/POV.hs | mit | tracePathBetween :: Eq a => a -> a -> Tree a -> Maybe [a]
tracePathBetween from to g =
fromPOV from g |>= rootZipper >>= findLoc to |>= trail |>= map rootLabel |>= (++ [to]) | 177 | tracePathBetween :: Eq a => a -> a -> Tree a -> Maybe [a]
tracePathBetween from to g =
fromPOV from g |>= rootZipper >>= findLoc to |>= trail |>= map rootLabel |>= (++ [to]) | 177 | tracePathBetween from to g =
fromPOV from g |>= rootZipper >>= findLoc to |>= trail |>= map rootLabel |>= (++ [to]) | 119 | false | true | 0 | 10 | 38 | 84 | 41 | 43 | null | null |
jamshidh/ethereum-data-sql | src/Blockchain/Constants.hs | bsd-3-clause | _Uether = 1000000000 * 1000000000 * 1000000000 * 1000000000 * 1000000000 * 1000000000 | 85 | _Uether = 1000000000 * 1000000000 * 1000000000 * 1000000000 * 1000000000 * 1000000000 | 85 | _Uether = 1000000000 * 1000000000 * 1000000000 * 1000000000 * 1000000000 * 1000000000 | 85 | false | false | 2 | 8 | 12 | 31 | 13 | 18 | null | null |
RefactoringTools/HaRe | app/MainHaRe.hs | bsd-3-clause | runCmd (RenameCmd fileName newname r c) (opt, gOpt)
= runFunc $ rename opt gOpt fileName newname (r,c) | 104 | runCmd (RenameCmd fileName newname r c) (opt, gOpt)
= runFunc $ rename opt gOpt fileName newname (r,c) | 104 | runCmd (RenameCmd fileName newname r c) (opt, gOpt)
= runFunc $ rename opt gOpt fileName newname (r,c) | 104 | false | false | 1 | 7 | 18 | 54 | 26 | 28 | null | null |
shlevy/ghc | compiler/cmm/PprC.hs | bsd-3-clause | pprAssign :: DynFlags -> CmmReg -> CmmExpr -> SDoc
-- dest is a reg, rhs is a reg
pprAssign _ r1 (CmmReg r2)
| isPtrReg r1 && isPtrReg r2
= hcat [ pprAsPtrReg r1, equals, pprAsPtrReg r2, semi ] | 200 | pprAssign :: DynFlags -> CmmReg -> CmmExpr -> SDoc
pprAssign _ r1 (CmmReg r2)
| isPtrReg r1 && isPtrReg r2
= hcat [ pprAsPtrReg r1, equals, pprAsPtrReg r2, semi ] | 168 | pprAssign _ r1 (CmmReg r2)
| isPtrReg r1 && isPtrReg r2
= hcat [ pprAsPtrReg r1, equals, pprAsPtrReg r2, semi ] | 117 | true | true | 0 | 11 | 45 | 80 | 37 | 43 | null | null |
stone-guru/tmmha | src/TMM/Workers.hs | gpl-3.0 | downloadRoute :: Spider -> DL.Downloader -> String -> IO ()
downloadRoute spider dl rn = mapChannel rn (_logger spider)
(_taskQueue spider) (_respQueue spider)
download interVal
where
interVal = _cDownloadInterval $ _config spider
download (TaskData td) = do
let url = T.unpack $ _tdUrl td
i <- atomically $ readTVar (_downloadCount spider)
info spider $ show i ++ ", download.. " ++ show td
-- core action
(response, dt) <- DL.download dl url
let nbytes :: Int = fromIntegral $ LB8.length (responseBody response)
info spider $ lensMsg i nbytes
atomically $ do
modifyTVar (_downloadCount spider) (+1)
modifyTVar (_downloadBytes spider) (+ nbytes)
return [ResponseData td response]
lensMsg i n = show i ++ ", downloaded " ++ show n ++ " bytes" | 894 | downloadRoute :: Spider -> DL.Downloader -> String -> IO ()
downloadRoute spider dl rn = mapChannel rn (_logger spider)
(_taskQueue spider) (_respQueue spider)
download interVal
where
interVal = _cDownloadInterval $ _config spider
download (TaskData td) = do
let url = T.unpack $ _tdUrl td
i <- atomically $ readTVar (_downloadCount spider)
info spider $ show i ++ ", download.. " ++ show td
-- core action
(response, dt) <- DL.download dl url
let nbytes :: Int = fromIntegral $ LB8.length (responseBody response)
info spider $ lensMsg i nbytes
atomically $ do
modifyTVar (_downloadCount spider) (+1)
modifyTVar (_downloadBytes spider) (+ nbytes)
return [ResponseData td response]
lensMsg i n = show i ++ ", downloaded " ++ show n ++ " bytes" | 894 | downloadRoute spider dl rn = mapChannel rn (_logger spider)
(_taskQueue spider) (_respQueue spider)
download interVal
where
interVal = _cDownloadInterval $ _config spider
download (TaskData td) = do
let url = T.unpack $ _tdUrl td
i <- atomically $ readTVar (_downloadCount spider)
info spider $ show i ++ ", download.. " ++ show td
-- core action
(response, dt) <- DL.download dl url
let nbytes :: Int = fromIntegral $ LB8.length (responseBody response)
info spider $ lensMsg i nbytes
atomically $ do
modifyTVar (_downloadCount spider) (+1)
modifyTVar (_downloadBytes spider) (+ nbytes)
return [ResponseData td response]
lensMsg i n = show i ++ ", downloaded " ++ show n ++ " bytes" | 834 | false | true | 2 | 18 | 271 | 308 | 144 | 164 | null | null |
ihc/futhark | src/Futhark/Optimise/Fusion/LoopKernel.hs | isc | tryExposeInputs :: Names -> [VName] -> SOAC -> Names -> FusedKer
-> TryFusion FusedKer
tryExposeInputs unfus_nms outVars soac consumed ker = do
(ker', ots) <- exposeInputs outVars ker
if SOAC.nullTransforms ots
then fuseSOACwithKer unfus_nms outVars soac consumed ker'
else do
(soac', ots') <- pullOutputTransforms soac ots
let outIdents = zipWith Ident outVars $ SOAC.typeOf soac'
ker'' = fixInputTypes outIdents ker'
if SOAC.nullTransforms ots'
then applyFusionRules unfus_nms outVars soac' consumed ker''
else fail "tryExposeInputs could not pull SOAC transforms" | 618 | tryExposeInputs :: Names -> [VName] -> SOAC -> Names -> FusedKer
-> TryFusion FusedKer
tryExposeInputs unfus_nms outVars soac consumed ker = do
(ker', ots) <- exposeInputs outVars ker
if SOAC.nullTransforms ots
then fuseSOACwithKer unfus_nms outVars soac consumed ker'
else do
(soac', ots') <- pullOutputTransforms soac ots
let outIdents = zipWith Ident outVars $ SOAC.typeOf soac'
ker'' = fixInputTypes outIdents ker'
if SOAC.nullTransforms ots'
then applyFusionRules unfus_nms outVars soac' consumed ker''
else fail "tryExposeInputs could not pull SOAC transforms" | 618 | tryExposeInputs unfus_nms outVars soac consumed ker = do
(ker', ots) <- exposeInputs outVars ker
if SOAC.nullTransforms ots
then fuseSOACwithKer unfus_nms outVars soac consumed ker'
else do
(soac', ots') <- pullOutputTransforms soac ots
let outIdents = zipWith Ident outVars $ SOAC.typeOf soac'
ker'' = fixInputTypes outIdents ker'
if SOAC.nullTransforms ots'
then applyFusionRules unfus_nms outVars soac' consumed ker''
else fail "tryExposeInputs could not pull SOAC transforms" | 515 | false | true | 0 | 16 | 129 | 179 | 85 | 94 | null | null |
sdiehl/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | wordTyCon :: TyCon
wordTyCon = pcTyCon wordTyConName
(Just (CType NoSourceText Nothing (NoSourceText, fsLit "HsWord")))
[] [wordDataCon] | 163 | wordTyCon :: TyCon
wordTyCon = pcTyCon wordTyConName
(Just (CType NoSourceText Nothing (NoSourceText, fsLit "HsWord")))
[] [wordDataCon] | 163 | wordTyCon = pcTyCon wordTyConName
(Just (CType NoSourceText Nothing (NoSourceText, fsLit "HsWord")))
[] [wordDataCon] | 144 | false | true | 0 | 11 | 42 | 50 | 26 | 24 | null | null |
hackern/halfs | Halfs/Inode.hs | bsd-3-clause | fileStat :: HalfsCapable b t r l m =>
InodeRef
-> HalfsM b r l m (FileStat t)
fileStat inr =
withLockedInode inr $ fileStat_lckd inr | 155 | fileStat :: HalfsCapable b t r l m =>
InodeRef
-> HalfsM b r l m (FileStat t)
fileStat inr =
withLockedInode inr $ fileStat_lckd inr | 155 | fileStat inr =
withLockedInode inr $ fileStat_lckd inr | 56 | false | true | 0 | 10 | 48 | 64 | 29 | 35 | null | null |
gpahal/hgraph | src/HGraph/Graph.hs | bsd-3-clause | alterAddLabelInstance :: LabelInstances -> LabelIndex -> Node -> GS ()
alterAddLabelInstance lins li n = alterLabelInstances $ M.alter aux li lins
where
i = nodeId n
aux Nothing = Just $ S.singleton i
aux (Just x) = Just $ S.insert i x | 275 | alterAddLabelInstance :: LabelInstances -> LabelIndex -> Node -> GS ()
alterAddLabelInstance lins li n = alterLabelInstances $ M.alter aux li lins
where
i = nodeId n
aux Nothing = Just $ S.singleton i
aux (Just x) = Just $ S.insert i x | 275 | alterAddLabelInstance lins li n = alterLabelInstances $ M.alter aux li lins
where
i = nodeId n
aux Nothing = Just $ S.singleton i
aux (Just x) = Just $ S.insert i x | 204 | false | true | 6 | 10 | 81 | 114 | 49 | 65 | null | null |
sdiehl/ghc | compiler/utils/Outputable.hs | bsd-3-clause | doOrDoes _ = text "do" | 24 | doOrDoes _ = text "do" | 24 | doOrDoes _ = text "do" | 24 | false | false | 0 | 5 | 6 | 12 | 5 | 7 | null | null |
DanielSchuessler/hstri | Blender/Types.hs | gpl-3.0 | defaultFOV :: Double
defaultFOV = 0.8575560591178853 | 52 | defaultFOV :: Double
defaultFOV = 0.8575560591178853 | 52 | defaultFOV = 0.8575560591178853 | 31 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
bermanjosh/bloodhound | src/Database/V1/Bloodhound/Types.hs | bsd-3-clause | showText :: Show a => a -> Text
showText = T.pack . show | 56 | showText :: Show a => a -> Text
showText = T.pack . show | 56 | showText = T.pack . show | 24 | false | true | 0 | 6 | 12 | 28 | 14 | 14 | null | null |
jmct/IterativeCompiler | frontend/CaseLift.hs | mit | abstractExprE (_, ANum n) = ENum n | 46 | abstractExprE (_, ANum n) = ENum n | 46 | abstractExprE (_, ANum n) = ENum n | 46 | false | false | 0 | 7 | 18 | 21 | 10 | 11 | null | null |
tjakway/ghcjvm | compiler/cmm/CmmBuildInfoTables.hs | bsd-3-clause | cafOffset :: TopSRT -> CLabel -> Maybe Int
cafOffset srt lbl = Map.lookup lbl (elt_map srt) | 91 | cafOffset :: TopSRT -> CLabel -> Maybe Int
cafOffset srt lbl = Map.lookup lbl (elt_map srt) | 91 | cafOffset srt lbl = Map.lookup lbl (elt_map srt) | 48 | false | true | 0 | 8 | 15 | 44 | 20 | 24 | null | null |
diogob/pivotal-tracker-api | test/Spec.hs | bsd-3-clause | main :: IO ()
main = hspec $ do
describe "PivotalTrackerApi.getStory" $
it "should return story data" $ do
story <- getStory authentication 1440520 104591424
story ^. S.story_type `shouldBe` "feature"
story ^. S.kind `shouldBe` "story"
story ^. S.url `shouldBe` "https://www.pivotaltracker.com/story/show/104591424"
story ^. S.requested_by_id `shouldBe` 1810650
story ^. S.current_state `shouldBe` "delivered"
story ^. S.name `shouldBe` "Shopper should be able to view contents of shopping cart"
story ^. S.project_id `shouldBe` 1440520
story ^. S.created_at `shouldBe` "2015-09-21T07:00:00Z"
story ^. S.id `shouldBe` 104591424
story ^. S.labels ^?! ix 0 . L.kind `shouldBe` "label"
story ^. S.owner_ids ^?! ix 0 `shouldBe` 1810650
story ^?! S.estimate `shouldBe` Just 2
story ^?! S.description `shouldBe` Just "Cart icon in top right corner, with a number indicating how many items in cart"
describe "PivotalTrackerApi.getProject" $
it "should return project data" $ do
project <- getProject authentication 1440520
project ^. P.name `shouldBe` "My Sample Project"
describe "PivotalTrackerApi.getTask" $
it "should return task data" $ do
task <- getTask authentication 1440520 104591424 37657208
task ^. T.description `shouldBe` "Implement view cart link"
describe "PivotalTrackerApi.getEpic" $
it "should return epic data" $ do
epic <- getEpic authentication 1440520 2106574
epic ^. E.name `shouldBe` "Admin Users"
describe "PivotalTrackerApi.getComment" $
it "should return epic data" $ do
comment <- getComment authentication 1440520 104591424 118080782
comment ^. C.text `shouldBe` "testing comment api."
describe "PivotalTrackerApi.getIterations" $
it "should return epic data" $ do
iterations <- getIterations authentication 1440520
iterations ^?! ix 0 . I.number `shouldBe` 1
where
authentication = withToken "7f3f76bc6ae8c48e7b528369c999c8d8" defaults | 2,054 | main :: IO ()
main = hspec $ do
describe "PivotalTrackerApi.getStory" $
it "should return story data" $ do
story <- getStory authentication 1440520 104591424
story ^. S.story_type `shouldBe` "feature"
story ^. S.kind `shouldBe` "story"
story ^. S.url `shouldBe` "https://www.pivotaltracker.com/story/show/104591424"
story ^. S.requested_by_id `shouldBe` 1810650
story ^. S.current_state `shouldBe` "delivered"
story ^. S.name `shouldBe` "Shopper should be able to view contents of shopping cart"
story ^. S.project_id `shouldBe` 1440520
story ^. S.created_at `shouldBe` "2015-09-21T07:00:00Z"
story ^. S.id `shouldBe` 104591424
story ^. S.labels ^?! ix 0 . L.kind `shouldBe` "label"
story ^. S.owner_ids ^?! ix 0 `shouldBe` 1810650
story ^?! S.estimate `shouldBe` Just 2
story ^?! S.description `shouldBe` Just "Cart icon in top right corner, with a number indicating how many items in cart"
describe "PivotalTrackerApi.getProject" $
it "should return project data" $ do
project <- getProject authentication 1440520
project ^. P.name `shouldBe` "My Sample Project"
describe "PivotalTrackerApi.getTask" $
it "should return task data" $ do
task <- getTask authentication 1440520 104591424 37657208
task ^. T.description `shouldBe` "Implement view cart link"
describe "PivotalTrackerApi.getEpic" $
it "should return epic data" $ do
epic <- getEpic authentication 1440520 2106574
epic ^. E.name `shouldBe` "Admin Users"
describe "PivotalTrackerApi.getComment" $
it "should return epic data" $ do
comment <- getComment authentication 1440520 104591424 118080782
comment ^. C.text `shouldBe` "testing comment api."
describe "PivotalTrackerApi.getIterations" $
it "should return epic data" $ do
iterations <- getIterations authentication 1440520
iterations ^?! ix 0 . I.number `shouldBe` 1
where
authentication = withToken "7f3f76bc6ae8c48e7b528369c999c8d8" defaults | 2,054 | main = hspec $ do
describe "PivotalTrackerApi.getStory" $
it "should return story data" $ do
story <- getStory authentication 1440520 104591424
story ^. S.story_type `shouldBe` "feature"
story ^. S.kind `shouldBe` "story"
story ^. S.url `shouldBe` "https://www.pivotaltracker.com/story/show/104591424"
story ^. S.requested_by_id `shouldBe` 1810650
story ^. S.current_state `shouldBe` "delivered"
story ^. S.name `shouldBe` "Shopper should be able to view contents of shopping cart"
story ^. S.project_id `shouldBe` 1440520
story ^. S.created_at `shouldBe` "2015-09-21T07:00:00Z"
story ^. S.id `shouldBe` 104591424
story ^. S.labels ^?! ix 0 . L.kind `shouldBe` "label"
story ^. S.owner_ids ^?! ix 0 `shouldBe` 1810650
story ^?! S.estimate `shouldBe` Just 2
story ^?! S.description `shouldBe` Just "Cart icon in top right corner, with a number indicating how many items in cart"
describe "PivotalTrackerApi.getProject" $
it "should return project data" $ do
project <- getProject authentication 1440520
project ^. P.name `shouldBe` "My Sample Project"
describe "PivotalTrackerApi.getTask" $
it "should return task data" $ do
task <- getTask authentication 1440520 104591424 37657208
task ^. T.description `shouldBe` "Implement view cart link"
describe "PivotalTrackerApi.getEpic" $
it "should return epic data" $ do
epic <- getEpic authentication 1440520 2106574
epic ^. E.name `shouldBe` "Admin Users"
describe "PivotalTrackerApi.getComment" $
it "should return epic data" $ do
comment <- getComment authentication 1440520 104591424 118080782
comment ^. C.text `shouldBe` "testing comment api."
describe "PivotalTrackerApi.getIterations" $
it "should return epic data" $ do
iterations <- getIterations authentication 1440520
iterations ^?! ix 0 . I.number `shouldBe` 1
where
authentication = withToken "7f3f76bc6ae8c48e7b528369c999c8d8" defaults | 2,040 | false | true | 0 | 15 | 439 | 521 | 252 | 269 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/minimum_4.hs | mit | compareMyInt :: MyInt -> MyInt -> Ordering
compareMyInt = primCmpInt | 72 | compareMyInt :: MyInt -> MyInt -> Ordering
compareMyInt = primCmpInt | 72 | compareMyInt = primCmpInt | 25 | false | true | 0 | 8 | 13 | 26 | 11 | 15 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Array.Base.hs | bsd-3-clause | cmpUArray :: (IArray UArray e, Ix i, Ord e) => UArray i e -> UArray i e -> Ordering
cmpUArray arr1 arr2 = compare (assocs arr1) (assocs arr2) | 141 | cmpUArray :: (IArray UArray e, Ix i, Ord e) => UArray i e -> UArray i e -> Ordering
cmpUArray arr1 arr2 = compare (assocs arr1) (assocs arr2) | 141 | cmpUArray arr1 arr2 = compare (assocs arr1) (assocs arr2) | 57 | false | true | 0 | 8 | 27 | 74 | 36 | 38 | null | null |
ozgurakgun/Idris-dev | src/IRTS/CodegenJavaScript.hs | bsd-3-clause | translateConstant (BI 1) = JSNum (JSInteger JSBigOne) | 71 | translateConstant (BI 1) = JSNum (JSInteger JSBigOne) | 71 | translateConstant (BI 1) = JSNum (JSInteger JSBigOne) | 71 | false | false | 0 | 7 | 24 | 24 | 11 | 13 | null | null |
vpeurala/hmath | src/Leonhard/P98.hs | bsd-3-clause | equalizingBy :: (Eq b) => (a -> b) -> (a -> a -> Bool)
equalizingBy f = (\a1 a2 -> f a1 == f a2) | 96 | equalizingBy :: (Eq b) => (a -> b) -> (a -> a -> Bool)
equalizingBy f = (\a1 a2 -> f a1 == f a2) | 96 | equalizingBy f = (\a1 a2 -> f a1 == f a2) | 41 | false | true | 0 | 9 | 24 | 65 | 34 | 31 | null | null |
brendanhay/gogol | gogol-factchecktools/gen/Network/Google/Resource/FactCheckTools/Pages/Get.hs | mpl-2.0 | -- | OAuth access token.
pgAccessToken :: Lens' PagesGet (Maybe Text)
pgAccessToken
= lens _pgAccessToken
(\ s a -> s{_pgAccessToken = a}) | 146 | pgAccessToken :: Lens' PagesGet (Maybe Text)
pgAccessToken
= lens _pgAccessToken
(\ s a -> s{_pgAccessToken = a}) | 121 | pgAccessToken
= lens _pgAccessToken
(\ s a -> s{_pgAccessToken = a}) | 76 | true | true | 0 | 9 | 29 | 48 | 25 | 23 | null | null |
dsmatter/jira-api | src/Jira/API/Types/Monad.hs | mit | tryHttp :: IO a -> JiraM a
tryHttp m = try' m >>= either handleException return
where
handleException :: Exception e => e -> JiraM a
handleException e = case fromException (toException e) of
Nothing -> throwError $ OtherException e
Just e -> throwError $ parseHttpException e
try' :: IO a -> JiraM (Either SomeException a)
try' = liftIO . try | 373 | tryHttp :: IO a -> JiraM a
tryHttp m = try' m >>= either handleException return
where
handleException :: Exception e => e -> JiraM a
handleException e = case fromException (toException e) of
Nothing -> throwError $ OtherException e
Just e -> throwError $ parseHttpException e
try' :: IO a -> JiraM (Either SomeException a)
try' = liftIO . try | 373 | tryHttp m = try' m >>= either handleException return
where
handleException :: Exception e => e -> JiraM a
handleException e = case fromException (toException e) of
Nothing -> throwError $ OtherException e
Just e -> throwError $ parseHttpException e
try' :: IO a -> JiraM (Either SomeException a)
try' = liftIO . try | 346 | false | true | 7 | 9 | 91 | 138 | 65 | 73 | null | null |
JPMoresmau/leksah-server | src/IDE/StrippedPrefs.hs | gpl-2.0 | prefsDescription :: [FieldDescriptionS Prefs]
prefsDescription = [
mkFieldS
(paraName <<<- ParaName
"Paths under which haskell sources for packages may be found" $ emptyParams)
(PP.text . show)
readParser
sourceDirectories
(\b a -> a{sourceDirectories = b})
, mkFieldS
(paraName <<<- ParaName "Unpack source for cabal packages to" $ emptyParams)
(PP.text . show)
readParser
unpackDirectory
(\b a -> a{unpackDirectory = b})
, mkFieldS
(paraName <<<- ParaName "URL from which to download prebuilt metadata" $ emptyParams)
(PP.text . show)
stringParser
retrieveURL
(\b a -> a{retrieveURL = b})
, mkFieldS
(paraName <<<- ParaName "Strategy for downloading prebuilt metadata" $ emptyParams)
(PP.text . show)
readParser
retrieveStrategy
(\b a -> a{retrieveStrategy = b})
, mkFieldS
(paraName <<<- ParaName "Port number for leksah to comunicate with leksah-server" $ emptyParams)
(PP.text . show)
intParser
serverPort
(\b a -> a{serverPort = b})
, mkFieldS
(paraName <<<- ParaName "Stop the leksah-server process when leksah disconnects" $ emptyParams)
(PP.text . show)
boolParser
endWithLastConn
(\b a -> a{endWithLastConn = b})
] | 1,542 | prefsDescription :: [FieldDescriptionS Prefs]
prefsDescription = [
mkFieldS
(paraName <<<- ParaName
"Paths under which haskell sources for packages may be found" $ emptyParams)
(PP.text . show)
readParser
sourceDirectories
(\b a -> a{sourceDirectories = b})
, mkFieldS
(paraName <<<- ParaName "Unpack source for cabal packages to" $ emptyParams)
(PP.text . show)
readParser
unpackDirectory
(\b a -> a{unpackDirectory = b})
, mkFieldS
(paraName <<<- ParaName "URL from which to download prebuilt metadata" $ emptyParams)
(PP.text . show)
stringParser
retrieveURL
(\b a -> a{retrieveURL = b})
, mkFieldS
(paraName <<<- ParaName "Strategy for downloading prebuilt metadata" $ emptyParams)
(PP.text . show)
readParser
retrieveStrategy
(\b a -> a{retrieveStrategy = b})
, mkFieldS
(paraName <<<- ParaName "Port number for leksah to comunicate with leksah-server" $ emptyParams)
(PP.text . show)
intParser
serverPort
(\b a -> a{serverPort = b})
, mkFieldS
(paraName <<<- ParaName "Stop the leksah-server process when leksah disconnects" $ emptyParams)
(PP.text . show)
boolParser
endWithLastConn
(\b a -> a{endWithLastConn = b})
] | 1,542 | prefsDescription = [
mkFieldS
(paraName <<<- ParaName
"Paths under which haskell sources for packages may be found" $ emptyParams)
(PP.text . show)
readParser
sourceDirectories
(\b a -> a{sourceDirectories = b})
, mkFieldS
(paraName <<<- ParaName "Unpack source for cabal packages to" $ emptyParams)
(PP.text . show)
readParser
unpackDirectory
(\b a -> a{unpackDirectory = b})
, mkFieldS
(paraName <<<- ParaName "URL from which to download prebuilt metadata" $ emptyParams)
(PP.text . show)
stringParser
retrieveURL
(\b a -> a{retrieveURL = b})
, mkFieldS
(paraName <<<- ParaName "Strategy for downloading prebuilt metadata" $ emptyParams)
(PP.text . show)
readParser
retrieveStrategy
(\b a -> a{retrieveStrategy = b})
, mkFieldS
(paraName <<<- ParaName "Port number for leksah to comunicate with leksah-server" $ emptyParams)
(PP.text . show)
intParser
serverPort
(\b a -> a{serverPort = b})
, mkFieldS
(paraName <<<- ParaName "Stop the leksah-server process when leksah disconnects" $ emptyParams)
(PP.text . show)
boolParser
endWithLastConn
(\b a -> a{endWithLastConn = b})
] | 1,496 | false | true | 0 | 11 | 575 | 354 | 190 | 164 | null | null |
kelnage/tamarin-prover | lib/term/src/Term/Substitution/SubstVFree.hs | gpl-3.0 | -- | @range subst@ returns the range of the substitution @substs@.
range :: Subst c v -> [VTerm c v]
range = M.elems . sMap | 123 | range :: Subst c v -> [VTerm c v]
range = M.elems . sMap | 56 | range = M.elems . sMap | 22 | true | true | 0 | 7 | 24 | 35 | 18 | 17 | null | null |
olorin/amazonka | amazonka-ml/gen/Network/AWS/MachineLearning/Types/Product.hs | mpl-2.0 | -- | Undocumented member.
dsRDSMetadata :: Lens' DataSource (Maybe RDSMetadata)
dsRDSMetadata = lens _dsRDSMetadata (\ s a -> s{_dsRDSMetadata = a}) | 148 | dsRDSMetadata :: Lens' DataSource (Maybe RDSMetadata)
dsRDSMetadata = lens _dsRDSMetadata (\ s a -> s{_dsRDSMetadata = a}) | 122 | dsRDSMetadata = lens _dsRDSMetadata (\ s a -> s{_dsRDSMetadata = a}) | 68 | true | true | 0 | 9 | 20 | 46 | 25 | 21 | null | null |
fumieval/jugendstil | src/Jugendstil/Doc.hs | bsd-3-clause | annotation f (Viewport s d) = f s <&> \s' -> Viewport s' d | 58 | annotation f (Viewport s d) = f s <&> \s' -> Viewport s' d | 58 | annotation f (Viewport s d) = f s <&> \s' -> Viewport s' d | 58 | false | false | 2 | 6 | 13 | 39 | 17 | 22 | null | null |
23Skidoo/heist | test/suite/Heist/Compiled/Tests.hs | bsd-3-clause | simpleCompiledTest :: IO ()
simpleCompiledTest = do
res <- runWithStateSplice "templates"
H.assertEqual "compiled state splice" expected res
where
expected =
mappend doctype "\n <html> 3 </html> " | 232 | simpleCompiledTest :: IO ()
simpleCompiledTest = do
res <- runWithStateSplice "templates"
H.assertEqual "compiled state splice" expected res
where
expected =
mappend doctype "\n <html> 3 </html> " | 232 | simpleCompiledTest = do
res <- runWithStateSplice "templates"
H.assertEqual "compiled state splice" expected res
where
expected =
mappend doctype "\n <html> 3 </html> " | 204 | false | true | 0 | 8 | 42 | 51 | 23 | 28 | null | null |
badp/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | -- * File backend driver
fdBlktap :: String
fdBlktap = Types.fileDriverToRaw FileBlktap | 88 | fdBlktap :: String
fdBlktap = Types.fileDriverToRaw FileBlktap | 62 | fdBlktap = Types.fileDriverToRaw FileBlktap | 43 | true | true | 0 | 6 | 12 | 17 | 9 | 8 | null | null |
intolerable/naive-bayes | test/Data/Classifier/NaiveBayesSpec.hs | bsd-3-clause | main :: IO ()
main = hspec spec | 31 | main :: IO ()
main = hspec spec | 31 | main = hspec spec | 17 | false | true | 0 | 7 | 7 | 25 | 10 | 15 | null | null |
snapframework/io-streams | src/System/IO/Streams/Internal.hs | bsd-3-clause | ------------------------------------------------------------------------------
-- $pushback
-- #pushback#
--
-- Users can push a value back into an input stream using the 'unRead'
-- function. Usually this will use the default pushback mechanism which
-- provides a buffer for the stream. Some stream transformers, like
-- 'takeBytes', produce streams that send pushed-back values back to the
-- streams that they wrap. A function like 'System.IO.Streams.Combinators.map'
-- cannot do this because the types don't match up:
--
-- @
-- 'System.IO.Streams.Combinators.map' :: (a -> b) -> 'InputStream' a -> 'IO' ('InputStream' b)
-- @
--
-- A function will usually document if its pushback behaviour differs from the
-- default. No matter what the case, input streams should obey the following
-- law:
--
-- @
-- Streams.'unRead' c stream >> Streams.'read' stream === 'return' ('Just' c)
-- @
--------------------------------------------
-- Typeclass instances for Handle support --
--------------------------------------------
------------------------------------------------------------------------------
bUFSIZ :: Int
bUFSIZ = 32752 | 1,187 | bUFSIZ :: Int
bUFSIZ = 32752 | 28 | bUFSIZ = 32752 | 14 | true | true | 0 | 4 | 204 | 37 | 32 | 5 | null | null |
tyoko-dev/rcore-haskell | src/RCore/Eval.hs | agpl-3.0 | exec ev (SLoop x1 cs x2)
| lookupEnv x1 ev /= Nil = loop ev (x1,cs,x2)
| otherwise = error ("Assertion failed on entry of loop: " ++ show (SLoop x1 cs x2)) | 172 | exec ev (SLoop x1 cs x2)
| lookupEnv x1 ev /= Nil = loop ev (x1,cs,x2)
| otherwise = error ("Assertion failed on entry of loop: " ++ show (SLoop x1 cs x2)) | 172 | exec ev (SLoop x1 cs x2)
| lookupEnv x1 ev /= Nil = loop ev (x1,cs,x2)
| otherwise = error ("Assertion failed on entry of loop: " ++ show (SLoop x1 cs x2)) | 172 | false | false | 1 | 10 | 49 | 82 | 39 | 43 | null | null |
BerndSchwarzenbacher/cis194-solutions | 12-monads/AParser.hs | mit | first :: (a -> b) -> (a,c) -> (b,c)
first f (x,y) = (f x, y) | 60 | first :: (a -> b) -> (a,c) -> (b,c)
first f (x,y) = (f x, y) | 60 | first f (x,y) = (f x, y) | 24 | false | true | 0 | 9 | 15 | 64 | 34 | 30 | null | null |
madjestic/b1 | tests/B1/Data/RangeTest.hs | bsd-3-clause | prop_gradualRange_count :: Float -> Float -> Int -> Property
prop_gradualRange_count start end steps =
steps >= 0 && steps < 1000 ==>
steps + 2 == length (gradualRange start end steps) | 190 | prop_gradualRange_count :: Float -> Float -> Int -> Property
prop_gradualRange_count start end steps =
steps >= 0 && steps < 1000 ==>
steps + 2 == length (gradualRange start end steps) | 190 | prop_gradualRange_count start end steps =
steps >= 0 && steps < 1000 ==>
steps + 2 == length (gradualRange start end steps) | 129 | false | true | 10 | 7 | 36 | 77 | 36 | 41 | null | null |
nevrenato/Hets_Fork | CSL/Keywords.hs | gpl-2.0 | signS :: String
signS = "sign" | 31 | signS :: String
signS = "sign" | 30 | signS = "sign" | 14 | false | true | 0 | 6 | 6 | 18 | 7 | 11 | null | null |
nickbart1980/pandoc-citeproc | src/Text/CSL/Util.hs | bsd-3-clause | tailInline xs = removeEmpty $ tailFirstInlineStr xs
where removeEmpty = dropWhile (== Str "") | 105 | tailInline xs = removeEmpty $ tailFirstInlineStr xs
where removeEmpty = dropWhile (== Str "") | 105 | tailInline xs = removeEmpty $ tailFirstInlineStr xs
where removeEmpty = dropWhile (== Str "") | 105 | false | false | 3 | 7 | 25 | 37 | 16 | 21 | null | null |
m00nlight/99-problems | haskell/p-63.hs | bsd-3-clause | completeBinaryTree 1 = Branch 'x' Empty Empty | 45 | completeBinaryTree 1 = Branch 'x' Empty Empty | 45 | completeBinaryTree 1 = Branch 'x' Empty Empty | 45 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
narurien/ganeti-ceph | test/hs/Test/Ganeti/TestCommon.hs | gpl-2.0 | -- | Max spindles (1024, somewhat random value).
maxSpindles :: Int
maxSpindles = 1024 | 86 | maxSpindles :: Int
maxSpindles = 1024 | 37 | maxSpindles = 1024 | 18 | true | true | 0 | 4 | 13 | 12 | 7 | 5 | null | null |
urbanslug/ghc | testsuite/tests/boxy/SystemF.hs | bsd-3-clause | test0 = apply hr id | 19 | test0 = apply hr id | 19 | test0 = apply hr id | 19 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
facundoq/toys | rsa/number.hs | agpl-3.0 | checkCompositeness s d n seed | x ==1 || x==n-1 = (ProbablyPrime,seed')
| otherwise = (checkCompositeness' s x n , seed')
where (a,seed') = generateRandomNumber (2,n-2) seed
x = (modularPower d n a) | 290 | checkCompositeness s d n seed | x ==1 || x==n-1 = (ProbablyPrime,seed')
| otherwise = (checkCompositeness' s x n , seed')
where (a,seed') = generateRandomNumber (2,n-2) seed
x = (modularPower d n a) | 290 | checkCompositeness s d n seed | x ==1 || x==n-1 = (ProbablyPrime,seed')
| otherwise = (checkCompositeness' s x n , seed')
where (a,seed') = generateRandomNumber (2,n-2) seed
x = (modularPower d n a) | 290 | false | false | 2 | 11 | 124 | 118 | 57 | 61 | null | null |
jamshidh/ethereum-merkle-patricia-db | src/Blockchain/Database/MerklePatricia/Internal.hs | bsd-3-clause | list2Options start x | start > 15 =
error $
"value of 'start' in list2Option is greater than 15, it is: " ++ show start
++ ", second param is " ++ show x | 159 | list2Options start x | start > 15 =
error $
"value of 'start' in list2Option is greater than 15, it is: " ++ show start
++ ", second param is " ++ show x | 159 | list2Options start x | start > 15 =
error $
"value of 'start' in list2Option is greater than 15, it is: " ++ show start
++ ", second param is " ++ show x | 159 | false | false | 2 | 8 | 39 | 44 | 19 | 25 | null | null |
Teaspot-Studio/Urho3D-Haskell | src/Graphics/Urho3D/Graphics/Graphics.hs | mit | -- | Return the API-specific RGB texture format.
getRGBFormat :: Word
getRGBFormat = fromIntegral [C.pure| unsigned int { Graphics::GetRGBFormat() } |] | 151 | getRGBFormat :: Word
getRGBFormat = fromIntegral [C.pure| unsigned int { Graphics::GetRGBFormat() } |] | 102 | getRGBFormat = fromIntegral [C.pure| unsigned int { Graphics::GetRGBFormat() } |] | 81 | true | true | 0 | 6 | 20 | 27 | 14 | 13 | null | null |
dolio/vector | Data/Vector/Generic.hs | bsd-3-clause | (!) v i = BOUNDS_CHECK(checkIndex) "(!)" i (length v)
$ unId (basicUnsafeIndexM v i) | 92 | (!) v i = BOUNDS_CHECK(checkIndex) "(!)" i (length v)
$ unId (basicUnsafeIndexM v i) | 92 | (!) v i = BOUNDS_CHECK(checkIndex) "(!)" i (length v)
$ unId (basicUnsafeIndexM v i) | 92 | false | false | 3 | 7 | 21 | 51 | 23 | 28 | null | null |
siddhanathan/ghc | compiler/coreSyn/CoreUnfold.hs | bsd-3-clause | sizeN :: Int -> ExprSize
sizeZero = SizeIs 0 emptyBag 0 | 56 | sizeN :: Int -> ExprSize
sizeZero = SizeIs 0 emptyBag 0 | 55 | sizeZero = SizeIs 0 emptyBag 0 | 30 | false | true | 0 | 5 | 11 | 22 | 11 | 11 | null | null |
benzrf/cas | src/ProofCas/Rendering/SetDrag.hs | gpl-3.0 | setCurrentDragData k v = do
e <- event
Just dt <- getDataTransfer e
setData dt k v
#else
setCurrentDragData _ _ = return ()
#endif | 136 | setCurrentDragData k v = do
e <- event
Just dt <- getDataTransfer e
setData dt k v
#else
setCurrentDragData _ _ = return ()
#endif | 136 | setCurrentDragData k v = do
e <- event
Just dt <- getDataTransfer e
setData dt k v
#else
setCurrentDragData _ _ = return ()
#endif | 136 | false | false | 1 | 9 | 30 | 47 | 18 | 29 | null | null |
ConferHealth/reflex-stripe | src/Reflex/Stripe/Elements/Types.hs | bsd-3-clause | -- |Retrieve an Event which fires whenever the given Stripe Element becomes ready (mounted, fully rendered, and can be focused)
getStripeElementOnReady :: (IsStripeElement el, MonadJSM m, TriggerEvent t m) => el -> m (Event t ())
getStripeElementOnReady = getStripeElementEvent "ready" (\ _ -> pure ()) | 302 | getStripeElementOnReady :: (IsStripeElement el, MonadJSM m, TriggerEvent t m) => el -> m (Event t ())
getStripeElementOnReady = getStripeElementEvent "ready" (\ _ -> pure ()) | 174 | getStripeElementOnReady = getStripeElementEvent "ready" (\ _ -> pure ()) | 72 | true | true | 0 | 10 | 44 | 70 | 36 | 34 | null | null |
rueshyna/gogol | gogol-customsearch/gen/Network/Google/Resource/Search/CSE/List.hs | mpl-2.0 | -- | Sets the user interface language.
cselHl :: Lens' CSEList (Maybe Text)
cselHl = lens _cselHl (\ s a -> s{_cselHl = a}) | 123 | cselHl :: Lens' CSEList (Maybe Text)
cselHl = lens _cselHl (\ s a -> s{_cselHl = a}) | 84 | cselHl = lens _cselHl (\ s a -> s{_cselHl = a}) | 47 | true | true | 1 | 9 | 23 | 51 | 25 | 26 | null | null |
substack/hsopenid | src/Network/OpenID/Association.hs | bsd-3-clause | -- | Get the mac key from a set of Diffie-Hellman parameters, and the public
-- key of the server.
decodeMacKey :: SessionType -> [Word8] -> [Word8] -> DHParams -> [Word8]
decodeMacKey st mac pubKey dh = zipWith xor key mac
where key = hash st $ btwoc $ computeKey pubKey dh
-- Interface -------------------------------------------------------------------
-- | Associate with a provider.
-- By default, this tries to use DH-SHA256 and HMAC-SHA256, and falls back to
-- whatever the server recommends, if the Bool parameter is True. | 544 | decodeMacKey :: SessionType -> [Word8] -> [Word8] -> DHParams -> [Word8]
decodeMacKey st mac pubKey dh = zipWith xor key mac
where key = hash st $ btwoc $ computeKey pubKey dh
-- Interface -------------------------------------------------------------------
-- | Associate with a provider.
-- By default, this tries to use DH-SHA256 and HMAC-SHA256, and falls back to
-- whatever the server recommends, if the Bool parameter is True. | 443 | decodeMacKey st mac pubKey dh = zipWith xor key mac
where key = hash st $ btwoc $ computeKey pubKey dh
-- Interface -------------------------------------------------------------------
-- | Associate with a provider.
-- By default, this tries to use DH-SHA256 and HMAC-SHA256, and falls back to
-- whatever the server recommends, if the Bool parameter is True. | 370 | true | true | 0 | 9 | 98 | 82 | 44 | 38 | null | null |
ghcjs/ghcjs | src/Gen2/Prim.hs | mit | genPrim _ _ WordSubOp [r] [x,y] = PrimInline $ r |= trunc (x - y) | 73 | genPrim _ _ WordSubOp [r] [x,y] = PrimInline $ r |= trunc (x - y) | 73 | genPrim _ _ WordSubOp [r] [x,y] = PrimInline $ r |= trunc (x - y) | 73 | false | false | 0 | 8 | 22 | 44 | 23 | 21 | null | null |
j5b/ps-pc | ConsoleOutput.hs | gpl-3.0 | conceptToConsole (Or T rc) = topConsole++orConsole++"("++conceptToConsole rc++")" | 81 | conceptToConsole (Or T rc) = topConsole++orConsole++"("++conceptToConsole rc++")" | 81 | conceptToConsole (Or T rc) = topConsole++orConsole++"("++conceptToConsole rc++")" | 81 | false | false | 0 | 8 | 6 | 37 | 17 | 20 | null | null |
heathweiss/Tricad | src/Tests/CornerPointsDebugTest.hs | gpl-2.0 | frontFacePlusFrontFace = TestCase $ assertEqual
"FrontFace +++ FrontFace = CornerPointsError"
(CubeDebug "FrontFaces: illegal FrontFace +++ FrontFace operation")
(
(CubeName "FrontFaces")
++^?
((FrontFace (Point 2 2 2) (Point 2 2 2) (Point 11 11 11) (Point 11 11 11))
+++
(FrontFace (Point 2 2 2) (Point 2 2 2) (Point 11 11 11) (Point 11 11 11)))
) | 374 | frontFacePlusFrontFace = TestCase $ assertEqual
"FrontFace +++ FrontFace = CornerPointsError"
(CubeDebug "FrontFaces: illegal FrontFace +++ FrontFace operation")
(
(CubeName "FrontFaces")
++^?
((FrontFace (Point 2 2 2) (Point 2 2 2) (Point 11 11 11) (Point 11 11 11))
+++
(FrontFace (Point 2 2 2) (Point 2 2 2) (Point 11 11 11) (Point 11 11 11)))
) | 374 | frontFacePlusFrontFace = TestCase $ assertEqual
"FrontFace +++ FrontFace = CornerPointsError"
(CubeDebug "FrontFaces: illegal FrontFace +++ FrontFace operation")
(
(CubeName "FrontFaces")
++^?
((FrontFace (Point 2 2 2) (Point 2 2 2) (Point 11 11 11) (Point 11 11 11))
+++
(FrontFace (Point 2 2 2) (Point 2 2 2) (Point 11 11 11) (Point 11 11 11)))
) | 374 | false | false | 3 | 13 | 82 | 154 | 74 | 80 | null | null |
ladinu/cs457 | src/HW05.hs | mit | add2 :: BinNum -> BinNum -> BinNum
add2 [] ds = ds | 58 | add2 :: BinNum -> BinNum -> BinNum
add2 [] ds = ds | 58 | add2 [] ds = ds | 23 | false | true | 0 | 6 | 19 | 26 | 13 | 13 | null | null |
thlorenz/WebToInk | webtoink-converter/WebToInk/Converter/Images.hs | bsd-2-clause | getImagesTests = TestList $ map TestCase
[ assertEqual "extracting images when one is contained"
["/support/figs/tip.png"] (getImages pageContentsWithOneImage)
, assertEqual "extracting images when two are contained"
["/support/figs/tip.png", "/support/figs/other.png"]
(getImages pageContentsWithTwoImages)
, assertEqual "extracting images when none is contained"
[] (getImages pageContentsWithoutImage)
]
where
pageContentsWithOneImage ="<img alt=\"[Tip]\" src=\"/support/figs/tip.png\">"
pageContentsWithTwoImages = "<img alt=\"[Tip]\" src=\"/support/figs/tip.png\">" ++
"<img alt=\"[Oth]\" src=\"/support/figs/other.png\">"
pageContentsWithoutImage ="<span>see no image</span>" | 806 | getImagesTests = TestList $ map TestCase
[ assertEqual "extracting images when one is contained"
["/support/figs/tip.png"] (getImages pageContentsWithOneImage)
, assertEqual "extracting images when two are contained"
["/support/figs/tip.png", "/support/figs/other.png"]
(getImages pageContentsWithTwoImages)
, assertEqual "extracting images when none is contained"
[] (getImages pageContentsWithoutImage)
]
where
pageContentsWithOneImage ="<img alt=\"[Tip]\" src=\"/support/figs/tip.png\">"
pageContentsWithTwoImages = "<img alt=\"[Tip]\" src=\"/support/figs/tip.png\">" ++
"<img alt=\"[Oth]\" src=\"/support/figs/other.png\">"
pageContentsWithoutImage ="<span>see no image</span>" | 806 | getImagesTests = TestList $ map TestCase
[ assertEqual "extracting images when one is contained"
["/support/figs/tip.png"] (getImages pageContentsWithOneImage)
, assertEqual "extracting images when two are contained"
["/support/figs/tip.png", "/support/figs/other.png"]
(getImages pageContentsWithTwoImages)
, assertEqual "extracting images when none is contained"
[] (getImages pageContentsWithoutImage)
]
where
pageContentsWithOneImage ="<img alt=\"[Tip]\" src=\"/support/figs/tip.png\">"
pageContentsWithTwoImages = "<img alt=\"[Tip]\" src=\"/support/figs/tip.png\">" ++
"<img alt=\"[Oth]\" src=\"/support/figs/other.png\">"
pageContentsWithoutImage ="<span>see no image</span>" | 806 | false | false | 0 | 10 | 183 | 95 | 50 | 45 | null | null |
facebookincubator/duckling | Duckling/Quantity/ES/Corpus.hs | bsd-3-clause | context :: Context
context = testContext { locale = makeLocale ES Nothing } | 75 | context :: Context
context = testContext { locale = makeLocale ES Nothing } | 75 | context = testContext { locale = makeLocale ES Nothing } | 56 | false | true | 0 | 7 | 12 | 24 | 13 | 11 | null | null |
brendanhay/gogol | gogol-dlp/gen/Network/Google/Resource/DLP/Projects/Locations/JobTriggers/Create.hs | mpl-2.0 | -- | Creates a value of 'ProjectsLocationsJobTriggersCreate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pljtcParent'
--
-- * 'pljtcXgafv'
--
-- * 'pljtcUploadProtocol'
--
-- * 'pljtcAccessToken'
--
-- * 'pljtcUploadType'
--
-- * 'pljtcPayload'
--
-- * 'pljtcCallback'
projectsLocationsJobTriggersCreate
:: Text -- ^ 'pljtcParent'
-> GooglePrivacyDlpV2CreateJobTriggerRequest -- ^ 'pljtcPayload'
-> ProjectsLocationsJobTriggersCreate
projectsLocationsJobTriggersCreate pPljtcParent_ pPljtcPayload_ =
ProjectsLocationsJobTriggersCreate'
{ _pljtcParent = pPljtcParent_
, _pljtcXgafv = Nothing
, _pljtcUploadProtocol = Nothing
, _pljtcAccessToken = Nothing
, _pljtcUploadType = Nothing
, _pljtcPayload = pPljtcPayload_
, _pljtcCallback = Nothing
} | 880 | projectsLocationsJobTriggersCreate
:: Text -- ^ 'pljtcParent'
-> GooglePrivacyDlpV2CreateJobTriggerRequest -- ^ 'pljtcPayload'
-> ProjectsLocationsJobTriggersCreate
projectsLocationsJobTriggersCreate pPljtcParent_ pPljtcPayload_ =
ProjectsLocationsJobTriggersCreate'
{ _pljtcParent = pPljtcParent_
, _pljtcXgafv = Nothing
, _pljtcUploadProtocol = Nothing
, _pljtcAccessToken = Nothing
, _pljtcUploadType = Nothing
, _pljtcPayload = pPljtcPayload_
, _pljtcCallback = Nothing
} | 521 | projectsLocationsJobTriggersCreate pPljtcParent_ pPljtcPayload_ =
ProjectsLocationsJobTriggersCreate'
{ _pljtcParent = pPljtcParent_
, _pljtcXgafv = Nothing
, _pljtcUploadProtocol = Nothing
, _pljtcAccessToken = Nothing
, _pljtcUploadType = Nothing
, _pljtcPayload = pPljtcPayload_
, _pljtcCallback = Nothing
} | 344 | true | true | 0 | 8 | 150 | 96 | 62 | 34 | null | null |
TikhonJelvis/Cow | src/Cow/Diff.hs | gpl-3.0 | -- | Produce the dynamic programming array for comparing two parse
-- trees using our modified string edit distance algorithm.
distTable :: Eq a => (Parse' a -> Parse Weight a) -> Parse' a -> Parse' a -> DistTable
distTable weigh input output = ds
where (endIn, endOut) = (Tree.size input, Tree.size output)
bounds = ((0, 0), (endIn, endOut))
(tableIn, tableOut) = (tables weigh input, tables weigh output)
ds = Array.listArray bounds [d i o | (i, o) <- Array.range bounds]
-- Traverses the parts of the structure at indices [a-b).
between a b = traversed . indices (`elem` [a..b - 1])
d i o | i == endIn && o == endOut = Dist 0 []
d i o | i == endIn = Dist (sumOf (weights . between o endOut) tableOut) [Add o]
d i o | o == endOut = Dist (sumOf (weights . between i endIn) tableIn) [Remove i]
d i o = case (in_, out) of
(TypeLeaf in_, TypeLeaf out) | in_ == out ->
ds ! (i + 1, o + 1)
_ ->
minimumBy (comparing _dist) $ inputs ++ outputs
where (in_, out) = (_nodes tableIn ! i, _nodes tableOut ! o)
inputs | TypeLeaf{} <- in_ =
[ ds ! (i + 1, o) & dist +~ _weights tableIn ! i
& edits %~ (Remove i :)
]
| TypeNode <- in_ =
[ ds ! (i + 1, o)
, let next = _jumps tableIn ! i in
ds ! (next, o) & dist +~ _weights tableIn ! i
& edits %~ (Remove i :)
]
outputs | TypeLeaf{} <- out =
[ ds ! (i, o + 1) & dist +~ _weights tableOut ! o
& edits %~ (Add o :)
]
| TypeNode <- out =
[ ds ! (i, o + 1)
, let next = _jumps tableOut ! o in
ds ! (i, next) & dist +~ _weights tableOut ! o
& edits %~ (Add o :)
]
-- | Calculate the distance between two trees using our metric. | 2,294 | distTable :: Eq a => (Parse' a -> Parse Weight a) -> Parse' a -> Parse' a -> DistTable
distTable weigh input output = ds
where (endIn, endOut) = (Tree.size input, Tree.size output)
bounds = ((0, 0), (endIn, endOut))
(tableIn, tableOut) = (tables weigh input, tables weigh output)
ds = Array.listArray bounds [d i o | (i, o) <- Array.range bounds]
-- Traverses the parts of the structure at indices [a-b).
between a b = traversed . indices (`elem` [a..b - 1])
d i o | i == endIn && o == endOut = Dist 0 []
d i o | i == endIn = Dist (sumOf (weights . between o endOut) tableOut) [Add o]
d i o | o == endOut = Dist (sumOf (weights . between i endIn) tableIn) [Remove i]
d i o = case (in_, out) of
(TypeLeaf in_, TypeLeaf out) | in_ == out ->
ds ! (i + 1, o + 1)
_ ->
minimumBy (comparing _dist) $ inputs ++ outputs
where (in_, out) = (_nodes tableIn ! i, _nodes tableOut ! o)
inputs | TypeLeaf{} <- in_ =
[ ds ! (i + 1, o) & dist +~ _weights tableIn ! i
& edits %~ (Remove i :)
]
| TypeNode <- in_ =
[ ds ! (i + 1, o)
, let next = _jumps tableIn ! i in
ds ! (next, o) & dist +~ _weights tableIn ! i
& edits %~ (Remove i :)
]
outputs | TypeLeaf{} <- out =
[ ds ! (i, o + 1) & dist +~ _weights tableOut ! o
& edits %~ (Add o :)
]
| TypeNode <- out =
[ ds ! (i, o + 1)
, let next = _jumps tableOut ! o in
ds ! (i, next) & dist +~ _weights tableOut ! o
& edits %~ (Add o :)
]
-- | Calculate the distance between two trees using our metric. | 2,167 | distTable weigh input output = ds
where (endIn, endOut) = (Tree.size input, Tree.size output)
bounds = ((0, 0), (endIn, endOut))
(tableIn, tableOut) = (tables weigh input, tables weigh output)
ds = Array.listArray bounds [d i o | (i, o) <- Array.range bounds]
-- Traverses the parts of the structure at indices [a-b).
between a b = traversed . indices (`elem` [a..b - 1])
d i o | i == endIn && o == endOut = Dist 0 []
d i o | i == endIn = Dist (sumOf (weights . between o endOut) tableOut) [Add o]
d i o | o == endOut = Dist (sumOf (weights . between i endIn) tableIn) [Remove i]
d i o = case (in_, out) of
(TypeLeaf in_, TypeLeaf out) | in_ == out ->
ds ! (i + 1, o + 1)
_ ->
minimumBy (comparing _dist) $ inputs ++ outputs
where (in_, out) = (_nodes tableIn ! i, _nodes tableOut ! o)
inputs | TypeLeaf{} <- in_ =
[ ds ! (i + 1, o) & dist +~ _weights tableIn ! i
& edits %~ (Remove i :)
]
| TypeNode <- in_ =
[ ds ! (i + 1, o)
, let next = _jumps tableIn ! i in
ds ! (next, o) & dist +~ _weights tableIn ! i
& edits %~ (Remove i :)
]
outputs | TypeLeaf{} <- out =
[ ds ! (i, o + 1) & dist +~ _weights tableOut ! o
& edits %~ (Add o :)
]
| TypeNode <- out =
[ ds ! (i, o + 1)
, let next = _jumps tableOut ! o in
ds ! (i, next) & dist +~ _weights tableOut ! o
& edits %~ (Add o :)
]
-- | Calculate the distance between two trees using our metric. | 2,080 | true | true | 11 | 18 | 1,076 | 785 | 404 | 381 | null | null |
mbakke/ganeti | test/hs/Test/Ganeti/Query/Query.hs | bsd-2-clause | -- * Test cases
-- ** Node queries
-- | Tests that querying any existing fields, via either query or
-- queryFields, will not return unknown fields.
prop_queryNode_noUnknown :: Property
prop_queryNode_noUnknown =
forAll (choose (0, maxNodes) >>= genEmptyCluster) $ \cluster ->
forAll (elements (Map.keys Node.fieldsMap)) $ \field -> monadicIO $ do
QueryResult fdefs fdata <-
run (query cluster False (Query (ItemTypeOpCode QRNode)
[field] EmptyFilter)) >>= resultProp
QueryFieldsResult fdefs' <-
resultProp $ queryFields (QueryFields (ItemTypeOpCode QRNode) [field])
_ <- stop $ conjoin
[ counterexample ("Got unknown fields via query (" ++
show fdefs ++ ")") (hasUnknownFields fdefs)
, counterexample ("Got unknown result status via query (" ++
show fdata ++ ")")
(all (all ((/= RSUnknown) . rentryStatus)) fdata)
, counterexample ("Got unknown fields via query fields (" ++
show fdefs'++ ")") (hasUnknownFields fdefs')
]
return ()
-- | Tests that an unknown field is returned as such. | 1,207 | prop_queryNode_noUnknown :: Property
prop_queryNode_noUnknown =
forAll (choose (0, maxNodes) >>= genEmptyCluster) $ \cluster ->
forAll (elements (Map.keys Node.fieldsMap)) $ \field -> monadicIO $ do
QueryResult fdefs fdata <-
run (query cluster False (Query (ItemTypeOpCode QRNode)
[field] EmptyFilter)) >>= resultProp
QueryFieldsResult fdefs' <-
resultProp $ queryFields (QueryFields (ItemTypeOpCode QRNode) [field])
_ <- stop $ conjoin
[ counterexample ("Got unknown fields via query (" ++
show fdefs ++ ")") (hasUnknownFields fdefs)
, counterexample ("Got unknown result status via query (" ++
show fdata ++ ")")
(all (all ((/= RSUnknown) . rentryStatus)) fdata)
, counterexample ("Got unknown fields via query fields (" ++
show fdefs'++ ")") (hasUnknownFields fdefs')
]
return ()
-- | Tests that an unknown field is returned as such. | 1,056 | prop_queryNode_noUnknown =
forAll (choose (0, maxNodes) >>= genEmptyCluster) $ \cluster ->
forAll (elements (Map.keys Node.fieldsMap)) $ \field -> monadicIO $ do
QueryResult fdefs fdata <-
run (query cluster False (Query (ItemTypeOpCode QRNode)
[field] EmptyFilter)) >>= resultProp
QueryFieldsResult fdefs' <-
resultProp $ queryFields (QueryFields (ItemTypeOpCode QRNode) [field])
_ <- stop $ conjoin
[ counterexample ("Got unknown fields via query (" ++
show fdefs ++ ")") (hasUnknownFields fdefs)
, counterexample ("Got unknown result status via query (" ++
show fdata ++ ")")
(all (all ((/= RSUnknown) . rentryStatus)) fdata)
, counterexample ("Got unknown fields via query fields (" ++
show fdefs'++ ")") (hasUnknownFields fdefs')
]
return ()
-- | Tests that an unknown field is returned as such. | 1,019 | true | true | 0 | 21 | 366 | 283 | 143 | 140 | null | null |
takoeight0821/malgo | src/Malgo/Infer/Unify.hs | bsd-3-clause | equiv (TyVar v1) (TyVar v2) | v1 == v2 = Just mempty | 52 | equiv (TyVar v1) (TyVar v2) | v1 == v2 = Just mempty | 52 | equiv (TyVar v1) (TyVar v2) | v1 == v2 = Just mempty | 52 | false | false | 0 | 8 | 11 | 36 | 16 | 20 | null | null |
yliu120/K3 | src/Language/K3/Metaprogram/Evaluation.hs | apache-2.0 | applyDAnnotation :: AnnotationCtor a -> Identifier -> SpliceEnv -> GeneratorM (Annotation a)
applyDAnnotation aCtor annId sEnv = do
(gEnv, sCtxt) <- get >>= return . (getGeneratorEnv &&& getSpliceContext)
nsEnv <- evalBindings sCtxt sEnv
let postSCtxt = pushSCtxt nsEnv sCtxt
maybe (spliceLookupErr annId)
(expectSpliceAnnotation postSCtxt . ($ nsEnv))
$ lookupDSPGenE annId gEnv
where
expectSpliceAnnotation sctxt (SRDecl p) = do
decl <- p
case tag decl of
DDataAnnotation n _ _ -> do
ndecl <- bindDAnnVars sctxt decl
modifyGDeclsF_ (Right . addDGenDecl annId ndecl) >> return (aCtor n)
_ -> throwG $ boxToString $ ["Invalid data annotation splice"] %+ prettyLines decl
expectSpliceAnnotation _ _ = throwG "Invalid data annotation splice"
spliceLookupErr n = throwG $ unwords ["Could not find data macro", n] | 919 | applyDAnnotation :: AnnotationCtor a -> Identifier -> SpliceEnv -> GeneratorM (Annotation a)
applyDAnnotation aCtor annId sEnv = do
(gEnv, sCtxt) <- get >>= return . (getGeneratorEnv &&& getSpliceContext)
nsEnv <- evalBindings sCtxt sEnv
let postSCtxt = pushSCtxt nsEnv sCtxt
maybe (spliceLookupErr annId)
(expectSpliceAnnotation postSCtxt . ($ nsEnv))
$ lookupDSPGenE annId gEnv
where
expectSpliceAnnotation sctxt (SRDecl p) = do
decl <- p
case tag decl of
DDataAnnotation n _ _ -> do
ndecl <- bindDAnnVars sctxt decl
modifyGDeclsF_ (Right . addDGenDecl annId ndecl) >> return (aCtor n)
_ -> throwG $ boxToString $ ["Invalid data annotation splice"] %+ prettyLines decl
expectSpliceAnnotation _ _ = throwG "Invalid data annotation splice"
spliceLookupErr n = throwG $ unwords ["Could not find data macro", n] | 919 | applyDAnnotation aCtor annId sEnv = do
(gEnv, sCtxt) <- get >>= return . (getGeneratorEnv &&& getSpliceContext)
nsEnv <- evalBindings sCtxt sEnv
let postSCtxt = pushSCtxt nsEnv sCtxt
maybe (spliceLookupErr annId)
(expectSpliceAnnotation postSCtxt . ($ nsEnv))
$ lookupDSPGenE annId gEnv
where
expectSpliceAnnotation sctxt (SRDecl p) = do
decl <- p
case tag decl of
DDataAnnotation n _ _ -> do
ndecl <- bindDAnnVars sctxt decl
modifyGDeclsF_ (Right . addDGenDecl annId ndecl) >> return (aCtor n)
_ -> throwG $ boxToString $ ["Invalid data annotation splice"] %+ prettyLines decl
expectSpliceAnnotation _ _ = throwG "Invalid data annotation splice"
spliceLookupErr n = throwG $ unwords ["Could not find data macro", n] | 826 | false | true | 0 | 16 | 229 | 283 | 134 | 149 | null | null |
chriseidhof/Basil | src/Basil/Data/HList4.hs | bsd-3-clause | lookupHList4 (Suc x) (TCons4 _ ys) = lookupHList4 x ys | 54 | lookupHList4 (Suc x) (TCons4 _ ys) = lookupHList4 x ys | 54 | lookupHList4 (Suc x) (TCons4 _ ys) = lookupHList4 x ys | 54 | false | false | 0 | 7 | 9 | 30 | 14 | 16 | null | null |
d3zd3z/HaskellNet-old | Network/HaskellNet/IMAP.hs | bsd-3-clause | recent (IMAPC _ mbox _) = fmap _recent $ readIORef mbox | 55 | recent (IMAPC _ mbox _) = fmap _recent $ readIORef mbox | 55 | recent (IMAPC _ mbox _) = fmap _recent $ readIORef mbox | 55 | false | false | 0 | 6 | 10 | 30 | 13 | 17 | null | null |
etu-fkti5301-bgu/alt-exam_automated_theorem_proving | src/Prop.hs | bsd-3-clause | impcnf Top = []
| 16 | simpcnf Top = [] | 16 | simpcnf Top = [] | 16 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
eddywestbrook/hobbits | archival/LambdaLiftingDB2.hs | bsd-3-clause | peelLambdasH :: lctx ~ CtxCons lctx0 b =>
LCtx lctx0 -> IsLType b -> Mb (ctx :++: lctx) (Term a) ->
PeelRet ctx (AddArrows lctx a)
peelLambdasH lctx0 isl [nuQQ| Lam b |] =
peelLambdasH (lctx0 :> isl) IsLType (combineMb b) | 257 | peelLambdasH :: lctx ~ CtxCons lctx0 b =>
LCtx lctx0 -> IsLType b -> Mb (ctx :++: lctx) (Term a) ->
PeelRet ctx (AddArrows lctx a)
peelLambdasH lctx0 isl [nuQQ| Lam b |] =
peelLambdasH (lctx0 :> isl) IsLType (combineMb b) | 257 | peelLambdasH lctx0 isl [nuQQ| Lam b |] =
peelLambdasH (lctx0 :> isl) IsLType (combineMb b) | 94 | false | true | 0 | 11 | 76 | 105 | 52 | 53 | null | null |
databrary/databrary | src/Controller/Token.hs | agpl-3.0 | postPasswordToken :: ActionRoute (API, Id LoginToken)
postPasswordToken = action POST (pathAPI </> pathId) $ \(api, ti) -> withoutAuth $ do
tok <- maybeAction =<< lookupLoginToken ti
unless (loginPasswordToken tok) $ result =<< peeks notFoundResponse
let auth :: SiteAuth
auth = view tok
pw <- runForm ((api == HTML) `thenUse` htmlPasswordToken ti) $
passwordForm (siteAccount auth)
changeAccount auth{ accountPasswd = Just pw } -- or should this be withAuth?
_ <- removeLoginToken tok
unless (isNothing $ accountPasswd auth) $
createNotification (blankNotification (siteAccount auth) NoticeAccountChange)
{ notificationParty = Just $ partyRow $ accountParty $ siteAccount auth }
loginAccount api (view tok) False | 749 | postPasswordToken :: ActionRoute (API, Id LoginToken)
postPasswordToken = action POST (pathAPI </> pathId) $ \(api, ti) -> withoutAuth $ do
tok <- maybeAction =<< lookupLoginToken ti
unless (loginPasswordToken tok) $ result =<< peeks notFoundResponse
let auth :: SiteAuth
auth = view tok
pw <- runForm ((api == HTML) `thenUse` htmlPasswordToken ti) $
passwordForm (siteAccount auth)
changeAccount auth{ accountPasswd = Just pw } -- or should this be withAuth?
_ <- removeLoginToken tok
unless (isNothing $ accountPasswd auth) $
createNotification (blankNotification (siteAccount auth) NoticeAccountChange)
{ notificationParty = Just $ partyRow $ accountParty $ siteAccount auth }
loginAccount api (view tok) False | 749 | postPasswordToken = action POST (pathAPI </> pathId) $ \(api, ti) -> withoutAuth $ do
tok <- maybeAction =<< lookupLoginToken ti
unless (loginPasswordToken tok) $ result =<< peeks notFoundResponse
let auth :: SiteAuth
auth = view tok
pw <- runForm ((api == HTML) `thenUse` htmlPasswordToken ti) $
passwordForm (siteAccount auth)
changeAccount auth{ accountPasswd = Just pw } -- or should this be withAuth?
_ <- removeLoginToken tok
unless (isNothing $ accountPasswd auth) $
createNotification (blankNotification (siteAccount auth) NoticeAccountChange)
{ notificationParty = Just $ partyRow $ accountParty $ siteAccount auth }
loginAccount api (view tok) False | 695 | false | true | 0 | 16 | 135 | 254 | 123 | 131 | null | null |
shockkolate/lambdircd | src/IRCD/Env.hs | apache-2.0 | mapEnvTransformers :: ([Transformer] -> [Transformer]) -> Env -> Env
mapEnvTransformers f env = env {envTransformers = f (envTransformers env)} | 143 | mapEnvTransformers :: ([Transformer] -> [Transformer]) -> Env -> Env
mapEnvTransformers f env = env {envTransformers = f (envTransformers env)} | 143 | mapEnvTransformers f env = env {envTransformers = f (envTransformers env)} | 74 | false | true | 0 | 9 | 18 | 54 | 29 | 25 | null | null |
christiaanb/ghc-typelits-extra | src/GHC/TypeLits/Extra/Solver/Operations.hs | bsd-2-clause | reifyEOP defs (Min x y) = mkTyConApp (minTyCon defs) [reifyEOP defs x
,reifyEOP defs y] | 144 | reifyEOP defs (Min x y) = mkTyConApp (minTyCon defs) [reifyEOP defs x
,reifyEOP defs y] | 144 | reifyEOP defs (Min x y) = mkTyConApp (minTyCon defs) [reifyEOP defs x
,reifyEOP defs y] | 144 | false | false | 0 | 7 | 71 | 46 | 22 | 24 | null | null |
coursestitch/coursestitch-api | src/Main.hs | apache-2.0 | main :: IO ()
main = do
connStr <- lookupEnv "DATABASE_URL"
let withPool = case connStr of
Nothing -> withSqlitePool "coursestitch-api.db"
Just cs -> withPostgresqlPool (fromString cs)
runNoLoggingT $ withPool 2 $ \pool -> liftIO $ do
runSqlPool (runMigration migrateAll >> testData) pool
scotty 7000 (app (runDB' pool)) | 372 | main :: IO ()
main = do
connStr <- lookupEnv "DATABASE_URL"
let withPool = case connStr of
Nothing -> withSqlitePool "coursestitch-api.db"
Just cs -> withPostgresqlPool (fromString cs)
runNoLoggingT $ withPool 2 $ \pool -> liftIO $ do
runSqlPool (runMigration migrateAll >> testData) pool
scotty 7000 (app (runDB' pool)) | 372 | main = do
connStr <- lookupEnv "DATABASE_URL"
let withPool = case connStr of
Nothing -> withSqlitePool "coursestitch-api.db"
Just cs -> withPostgresqlPool (fromString cs)
runNoLoggingT $ withPool 2 $ \pool -> liftIO $ do
runSqlPool (runMigration migrateAll >> testData) pool
scotty 7000 (app (runDB' pool)) | 358 | false | true | 0 | 16 | 99 | 127 | 58 | 69 | null | null |
josejuan/Haskell-Spaceship-Meteorite | Math/Space2D.hs | mit | yAxis = vertex3f 0 1 0 | 23 | yAxis = vertex3f 0 1 0 | 23 | yAxis = vertex3f 0 1 0 | 23 | false | false | 0 | 5 | 6 | 13 | 6 | 7 | null | null |
DanielSchuessler/hstri | EqvGraphs.hs | gpl-3.0 | edgeEqvGraph :: Triangulation -> Seed -> DotGraph Int
edgeEqvGraph = graphHelper tCOIEdges inducedEdgeEquivalences | 114 | edgeEqvGraph :: Triangulation -> Seed -> DotGraph Int
edgeEqvGraph = graphHelper tCOIEdges inducedEdgeEquivalences | 114 | edgeEqvGraph = graphHelper tCOIEdges inducedEdgeEquivalences | 60 | false | true | 0 | 7 | 12 | 27 | 13 | 14 | null | null |
achirkin/mooc-images | to-static/main.hs | mit | imageExt :: Key ImagePreview -> Handler String
imageExt ident = do
img <- runDB $ get404 ident >>= get404 . imagePreviewFullVersion
return $ Text.unpack . contentTypeToExt $ imageContentType img | 202 | imageExt :: Key ImagePreview -> Handler String
imageExt ident = do
img <- runDB $ get404 ident >>= get404 . imagePreviewFullVersion
return $ Text.unpack . contentTypeToExt $ imageContentType img | 202 | imageExt ident = do
img <- runDB $ get404 ident >>= get404 . imagePreviewFullVersion
return $ Text.unpack . contentTypeToExt $ imageContentType img | 155 | false | true | 0 | 12 | 36 | 71 | 31 | 40 | null | null |
bananu7/Turnip | src/Turnip/Eval/Eval.hs | mit | opLE (Str a) (Str b) = return [Boolean $ a <= b] | 48 | opLE (Str a) (Str b) = return [Boolean $ a <= b] | 48 | opLE (Str a) (Str b) = return [Boolean $ a <= b] | 48 | false | false | 0 | 8 | 11 | 37 | 18 | 19 | null | null |
wavewave/gnuplot | src/Graphics/Gnuplot/Private/Graph3DType.hs | bsd-3-clause | tupleSize :: (Tuple.C a) => T x y z a -> Tuple.ColumnCount a
tupleSize _ = Tuple.columnCount | 92 | tupleSize :: (Tuple.C a) => T x y z a -> Tuple.ColumnCount a
tupleSize _ = Tuple.columnCount | 92 | tupleSize _ = Tuple.columnCount | 31 | false | true | 0 | 8 | 16 | 45 | 22 | 23 | null | null |
stepcut/plugins | src/System/Plugins/Env.hs | lgpl-2.1 | withMerged :: Env -> (MergeEnv -> IO a) -> IO a
withModEnv (mvar,ref,_,_,_,_) f = withMVar mvar (\_ -> readIORef ref >>= f) | 126 | withMerged :: Env -> (MergeEnv -> IO a) -> IO a
withModEnv (mvar,ref,_,_,_,_) f = withMVar mvar (\_ -> readIORef ref >>= f) | 125 | withModEnv (mvar,ref,_,_,_,_) f = withMVar mvar (\_ -> readIORef ref >>= f) | 76 | false | true | 0 | 10 | 25 | 79 | 41 | 38 | null | null |
pseudonom/persistent | persistent-test/src/RenameTest.hs | mit | specs :: Spec
specs = describe "rename specs" $ do
#ifndef WITH_NOSQL
it "handles lower casing" $ asIO $
runConn $ do
runResourceT $ rawQuery "SELECT full_name from lower_case_table WHERE my_id=5" [] C.$$ CL.sinkNull
runResourceT $ rawQuery "SELECT something_else from ref_table WHERE id=4" [] C.$$ CL.sinkNull
#endif
it "user specified id, insertKey, no default=" $ db $ do
let rec2 = IdTable "Foo2" Nothing
let rec1 = IdTable "Foo1" $ Just rec2
let rec = IdTable "Foo" $ Just rec1
now <- liftIO getCurrentTime
let key = IdTableKey $ utctDay now
insertKey key rec
Just rec' <- get key
rec' @== rec
(Entity key' _):_ <- selectList ([] :: [Filter IdTable]) []
key' @== key
#ifndef WITH_MYSQL
# ifndef WITH_NOSQL
-- this uses default=
it "user specified id, default=" $ db $ do
let rec = IdTable "Foo" Nothing
k <- insert rec
Just rec' <- get k
rec' @== rec
# endif
#endif
it "extra blocks" $
entityExtra (entityDef (Nothing :: Maybe LowerCaseTable)) @?=
Map.fromList
[ ("ExtraBlock", map T.words ["foo bar", "baz", "bin"])
, ("ExtraBlock2", map T.words ["something"])
] | 1,278 | specs :: Spec
specs = describe "rename specs" $ do
#ifndef WITH_NOSQL
it "handles lower casing" $ asIO $
runConn $ do
runResourceT $ rawQuery "SELECT full_name from lower_case_table WHERE my_id=5" [] C.$$ CL.sinkNull
runResourceT $ rawQuery "SELECT something_else from ref_table WHERE id=4" [] C.$$ CL.sinkNull
#endif
it "user specified id, insertKey, no default=" $ db $ do
let rec2 = IdTable "Foo2" Nothing
let rec1 = IdTable "Foo1" $ Just rec2
let rec = IdTable "Foo" $ Just rec1
now <- liftIO getCurrentTime
let key = IdTableKey $ utctDay now
insertKey key rec
Just rec' <- get key
rec' @== rec
(Entity key' _):_ <- selectList ([] :: [Filter IdTable]) []
key' @== key
#ifndef WITH_MYSQL
# ifndef WITH_NOSQL
-- this uses default=
it "user specified id, default=" $ db $ do
let rec = IdTable "Foo" Nothing
k <- insert rec
Just rec' <- get k
rec' @== rec
# endif
#endif
it "extra blocks" $
entityExtra (entityDef (Nothing :: Maybe LowerCaseTable)) @?=
Map.fromList
[ ("ExtraBlock", map T.words ["foo bar", "baz", "bin"])
, ("ExtraBlock2", map T.words ["something"])
] | 1,278 | specs = describe "rename specs" $ do
#ifndef WITH_NOSQL
it "handles lower casing" $ asIO $
runConn $ do
runResourceT $ rawQuery "SELECT full_name from lower_case_table WHERE my_id=5" [] C.$$ CL.sinkNull
runResourceT $ rawQuery "SELECT something_else from ref_table WHERE id=4" [] C.$$ CL.sinkNull
#endif
it "user specified id, insertKey, no default=" $ db $ do
let rec2 = IdTable "Foo2" Nothing
let rec1 = IdTable "Foo1" $ Just rec2
let rec = IdTable "Foo" $ Just rec1
now <- liftIO getCurrentTime
let key = IdTableKey $ utctDay now
insertKey key rec
Just rec' <- get key
rec' @== rec
(Entity key' _):_ <- selectList ([] :: [Filter IdTable]) []
key' @== key
#ifndef WITH_MYSQL
# ifndef WITH_NOSQL
-- this uses default=
it "user specified id, default=" $ db $ do
let rec = IdTable "Foo" Nothing
k <- insert rec
Just rec' <- get k
rec' @== rec
# endif
#endif
it "extra blocks" $
entityExtra (entityDef (Nothing :: Maybe LowerCaseTable)) @?=
Map.fromList
[ ("ExtraBlock", map T.words ["foo bar", "baz", "bin"])
, ("ExtraBlock2", map T.words ["something"])
] | 1,264 | false | true | 0 | 15 | 389 | 393 | 184 | 209 | null | null |
gnn/Hets | PGIP/Query.hs | gpl-2.0 | anaQuery :: [QueryPair] -> [String] -> Either String (Maybe Int, QueryKind)
anaQuery q' globals =
let (atP, q'') = partition ((== "autoproof") . fst) q'
(atC, q) = partition ((== "consistency") . fst) q''
(q1, qm) = partition (\ l -> case l of
(x, Nothing) -> isNat x || elem x
(displayTypes ++ globals
++ ["include", "autoproof"]
++ nodeCommands ++ edgeCommands)
_ -> False) q
(q2, qr) = partition (\ l -> case l of
(x, Just y) ->
elem x (["dg", "id", "session"]
++ edgeCommands)
&& isNat y
|| x == "command" &&
elem y globals
|| x == "format" && elem y displayTypes
|| elem x ("name" : tail proveParams
++ nodeCommands)
-- note: allows illegal timeout values
|| x == "timeout"
-- without timeout, see above
_ -> False) qm
(fs, r1) = partition (`elem` displayTypes) $ map fst q1
(gs, r2) = partition (`elem` globals) r1
(ns, r3) = partition (`elem` nodeCommands) r2
(es, r4) = partition (`elem` edgeCommands) r3
(incls, is) = partition (== "include") r4
(fs2, p1) = partition ((== "format") . fst) q2
(cs2, p2) = partition ((== "command") . fst) p1
(is2, p3) = partition ((`elem` ["dg", "session"]) . fst) p2
(ns2, p4) = partition ((`elem` nodeCommands) . fst) p3
(es2, p5) = partition ((`elem` edgeCommands) . fst) p4
(nns, p6) = partition ((== "name") . fst) p5
(ids, pps) = partition ((== "id") . fst) p6
snds = mapMaybe snd
afs = nubOrd $ fs ++ snds fs2
ags = nubOrd $ gs ++ snds cs2
ans = nubOrd $ ns ++ map fst ns2
aes = nubOrd $ es ++ map fst es2
ais = nubOrd $ is ++ snds is2
aids = nubOrd . snds $ ns2 ++ es2 ++ ids ++ nns
mi = fmap read $ listToMaybe ais
(theorems, qqr) = partition ((== Just "on") . snd) qr
noPP = null pps && null incls && null theorems
-- TODO i kind of abused this functions structure for autoproofs here
in if not $ null atP then Right (mi, GlShowProverWindow GlProofs) else
if not $ null atC then Right (mi, GlShowProverWindow GlConsistency)
else
if null qqr && length ais < 2 then case (afs, ags, ans, aes, aids) of
(_, [], [], [], []) | noPP -> if length afs > 1
then Left $ "non-unique format " ++ show afs
else Right (mi, DisplayQuery $ listToMaybe afs)
(_, c : r, [], [], []) | noPP -> if null r
then Right (mi, GlobCmdQuery c)
else Left $ "non-unique command " ++ show r
(_, [], _, [], [_]) -> fmap (\ qk -> (mi, qk)) $
anaNodeQuery ans (getIdOrName ids nns ns2) (map fst theorems)
incls pps
(_, [], [], e : r, i : s) | noPP ->
if null r && null s && null nns && null ns2
then Right (mi, EdgeQuery (read i) e)
else Left $ "non-unique edge " ++ show (aes ++ aids)
_ -> Left $ "non-unique query " ++ show q
else Left $ if null qqr then "non-unique dg " ++ show q else
"ill-formed query " ++ show qqr | 3,690 | anaQuery :: [QueryPair] -> [String] -> Either String (Maybe Int, QueryKind)
anaQuery q' globals =
let (atP, q'') = partition ((== "autoproof") . fst) q'
(atC, q) = partition ((== "consistency") . fst) q''
(q1, qm) = partition (\ l -> case l of
(x, Nothing) -> isNat x || elem x
(displayTypes ++ globals
++ ["include", "autoproof"]
++ nodeCommands ++ edgeCommands)
_ -> False) q
(q2, qr) = partition (\ l -> case l of
(x, Just y) ->
elem x (["dg", "id", "session"]
++ edgeCommands)
&& isNat y
|| x == "command" &&
elem y globals
|| x == "format" && elem y displayTypes
|| elem x ("name" : tail proveParams
++ nodeCommands)
-- note: allows illegal timeout values
|| x == "timeout"
-- without timeout, see above
_ -> False) qm
(fs, r1) = partition (`elem` displayTypes) $ map fst q1
(gs, r2) = partition (`elem` globals) r1
(ns, r3) = partition (`elem` nodeCommands) r2
(es, r4) = partition (`elem` edgeCommands) r3
(incls, is) = partition (== "include") r4
(fs2, p1) = partition ((== "format") . fst) q2
(cs2, p2) = partition ((== "command") . fst) p1
(is2, p3) = partition ((`elem` ["dg", "session"]) . fst) p2
(ns2, p4) = partition ((`elem` nodeCommands) . fst) p3
(es2, p5) = partition ((`elem` edgeCommands) . fst) p4
(nns, p6) = partition ((== "name") . fst) p5
(ids, pps) = partition ((== "id") . fst) p6
snds = mapMaybe snd
afs = nubOrd $ fs ++ snds fs2
ags = nubOrd $ gs ++ snds cs2
ans = nubOrd $ ns ++ map fst ns2
aes = nubOrd $ es ++ map fst es2
ais = nubOrd $ is ++ snds is2
aids = nubOrd . snds $ ns2 ++ es2 ++ ids ++ nns
mi = fmap read $ listToMaybe ais
(theorems, qqr) = partition ((== Just "on") . snd) qr
noPP = null pps && null incls && null theorems
-- TODO i kind of abused this functions structure for autoproofs here
in if not $ null atP then Right (mi, GlShowProverWindow GlProofs) else
if not $ null atC then Right (mi, GlShowProverWindow GlConsistency)
else
if null qqr && length ais < 2 then case (afs, ags, ans, aes, aids) of
(_, [], [], [], []) | noPP -> if length afs > 1
then Left $ "non-unique format " ++ show afs
else Right (mi, DisplayQuery $ listToMaybe afs)
(_, c : r, [], [], []) | noPP -> if null r
then Right (mi, GlobCmdQuery c)
else Left $ "non-unique command " ++ show r
(_, [], _, [], [_]) -> fmap (\ qk -> (mi, qk)) $
anaNodeQuery ans (getIdOrName ids nns ns2) (map fst theorems)
incls pps
(_, [], [], e : r, i : s) | noPP ->
if null r && null s && null nns && null ns2
then Right (mi, EdgeQuery (read i) e)
else Left $ "non-unique edge " ++ show (aes ++ aids)
_ -> Left $ "non-unique query " ++ show q
else Left $ if null qqr then "non-unique dg " ++ show q else
"ill-formed query " ++ show qqr | 3,690 | anaQuery q' globals =
let (atP, q'') = partition ((== "autoproof") . fst) q'
(atC, q) = partition ((== "consistency") . fst) q''
(q1, qm) = partition (\ l -> case l of
(x, Nothing) -> isNat x || elem x
(displayTypes ++ globals
++ ["include", "autoproof"]
++ nodeCommands ++ edgeCommands)
_ -> False) q
(q2, qr) = partition (\ l -> case l of
(x, Just y) ->
elem x (["dg", "id", "session"]
++ edgeCommands)
&& isNat y
|| x == "command" &&
elem y globals
|| x == "format" && elem y displayTypes
|| elem x ("name" : tail proveParams
++ nodeCommands)
-- note: allows illegal timeout values
|| x == "timeout"
-- without timeout, see above
_ -> False) qm
(fs, r1) = partition (`elem` displayTypes) $ map fst q1
(gs, r2) = partition (`elem` globals) r1
(ns, r3) = partition (`elem` nodeCommands) r2
(es, r4) = partition (`elem` edgeCommands) r3
(incls, is) = partition (== "include") r4
(fs2, p1) = partition ((== "format") . fst) q2
(cs2, p2) = partition ((== "command") . fst) p1
(is2, p3) = partition ((`elem` ["dg", "session"]) . fst) p2
(ns2, p4) = partition ((`elem` nodeCommands) . fst) p3
(es2, p5) = partition ((`elem` edgeCommands) . fst) p4
(nns, p6) = partition ((== "name") . fst) p5
(ids, pps) = partition ((== "id") . fst) p6
snds = mapMaybe snd
afs = nubOrd $ fs ++ snds fs2
ags = nubOrd $ gs ++ snds cs2
ans = nubOrd $ ns ++ map fst ns2
aes = nubOrd $ es ++ map fst es2
ais = nubOrd $ is ++ snds is2
aids = nubOrd . snds $ ns2 ++ es2 ++ ids ++ nns
mi = fmap read $ listToMaybe ais
(theorems, qqr) = partition ((== Just "on") . snd) qr
noPP = null pps && null incls && null theorems
-- TODO i kind of abused this functions structure for autoproofs here
in if not $ null atP then Right (mi, GlShowProverWindow GlProofs) else
if not $ null atC then Right (mi, GlShowProverWindow GlConsistency)
else
if null qqr && length ais < 2 then case (afs, ags, ans, aes, aids) of
(_, [], [], [], []) | noPP -> if length afs > 1
then Left $ "non-unique format " ++ show afs
else Right (mi, DisplayQuery $ listToMaybe afs)
(_, c : r, [], [], []) | noPP -> if null r
then Right (mi, GlobCmdQuery c)
else Left $ "non-unique command " ++ show r
(_, [], _, [], [_]) -> fmap (\ qk -> (mi, qk)) $
anaNodeQuery ans (getIdOrName ids nns ns2) (map fst theorems)
incls pps
(_, [], [], e : r, i : s) | noPP ->
if null r && null s && null nns && null ns2
then Right (mi, EdgeQuery (read i) e)
else Left $ "non-unique edge " ++ show (aes ++ aids)
_ -> Left $ "non-unique query " ++ show q
else Left $ if null qqr then "non-unique dg " ++ show q else
"ill-formed query " ++ show qqr | 3,614 | false | true | 0 | 28 | 1,577 | 1,325 | 712 | 613 | null | null |
trygvis/hledger | hledger/Hledger/Cli/Options.hs | gpl-3.0 | dateSpanFromOpts :: Day -> [Opt] -> DateSpan
dateSpanFromOpts refdate opts
| not (null popts) = case parsePeriodExpr refdate $ last popts of
Right (_, s) -> s
Left e -> parseerror e
| otherwise = DateSpan lastb laste
where
popts = optValuesForConstructor Period opts
bopts = optValuesForConstructor Begin opts
eopts = optValuesForConstructor End opts
lastb = listtomaybeday bopts
laste = listtomaybeday eopts
listtomaybeday vs = if null vs then Nothing else Just $ parse $ last vs
where parse = parsedate . fixSmartDateStr refdate
-- | Figure out the reporting interval, if any, specified by the options.
-- If there is a period option, the others are ignored. | 775 | dateSpanFromOpts :: Day -> [Opt] -> DateSpan
dateSpanFromOpts refdate opts
| not (null popts) = case parsePeriodExpr refdate $ last popts of
Right (_, s) -> s
Left e -> parseerror e
| otherwise = DateSpan lastb laste
where
popts = optValuesForConstructor Period opts
bopts = optValuesForConstructor Begin opts
eopts = optValuesForConstructor End opts
lastb = listtomaybeday bopts
laste = listtomaybeday eopts
listtomaybeday vs = if null vs then Nothing else Just $ parse $ last vs
where parse = parsedate . fixSmartDateStr refdate
-- | Figure out the reporting interval, if any, specified by the options.
-- If there is a period option, the others are ignored. | 775 | dateSpanFromOpts refdate opts
| not (null popts) = case parsePeriodExpr refdate $ last popts of
Right (_, s) -> s
Left e -> parseerror e
| otherwise = DateSpan lastb laste
where
popts = optValuesForConstructor Period opts
bopts = optValuesForConstructor Begin opts
eopts = optValuesForConstructor End opts
lastb = listtomaybeday bopts
laste = listtomaybeday eopts
listtomaybeday vs = if null vs then Nothing else Just $ parse $ last vs
where parse = parsedate . fixSmartDateStr refdate
-- | Figure out the reporting interval, if any, specified by the options.
-- If there is a period option, the others are ignored. | 730 | false | true | 0 | 10 | 222 | 191 | 93 | 98 | null | null |
andrewpetrovic/pandoc | src/Text/Pandoc/Writers/RST.hs | gpl-2.0 | refsToRST :: Refs -> State WriterState Doc
refsToRST refs = mapM keyToRST refs >>= return . vcat | 96 | refsToRST :: Refs -> State WriterState Doc
refsToRST refs = mapM keyToRST refs >>= return . vcat | 96 | refsToRST refs = mapM keyToRST refs >>= return . vcat | 53 | false | true | 0 | 7 | 16 | 36 | 17 | 19 | null | null |
wochinge/CacheSimulator | app/Main.hs | bsd-3-clause | calculateLru :: (String, CacheSize, WriteStrategy) -> IO ()
calculateLru (logPath, sizeOfCache, strategy) = do
let cache = empty sizeOfCache strategy :: Lru.Lru
simulate "LRU" logPath cache | 197 | calculateLru :: (String, CacheSize, WriteStrategy) -> IO ()
calculateLru (logPath, sizeOfCache, strategy) = do
let cache = empty sizeOfCache strategy :: Lru.Lru
simulate "LRU" logPath cache | 197 | calculateLru (logPath, sizeOfCache, strategy) = do
let cache = empty sizeOfCache strategy :: Lru.Lru
simulate "LRU" logPath cache | 137 | false | true | 0 | 10 | 33 | 70 | 36 | 34 | null | null |
dmwit/pi-eta-epsilon | src/Language/PiEtaEpsilon/Examples.hs | bsd-3-clause | introZ = undefined | 18 | introZ = undefined | 18 | introZ = undefined | 18 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
mbezjak/grailsproject | src/Grails/Project.hs | mit | fromApplicationProperties :: String -> Properties -> EIO String
fromApplicationProperties key props =
case lookup key props of
Just x -> return x
Nothing -> throwError ("No key `" ++ key ++ "' in application.properties") | 231 | fromApplicationProperties :: String -> Properties -> EIO String
fromApplicationProperties key props =
case lookup key props of
Just x -> return x
Nothing -> throwError ("No key `" ++ key ++ "' in application.properties") | 231 | fromApplicationProperties key props =
case lookup key props of
Just x -> return x
Nothing -> throwError ("No key `" ++ key ++ "' in application.properties") | 167 | false | true | 0 | 11 | 44 | 68 | 32 | 36 | null | null |
alsonkemp/turbinado | Turbinado/PreProcessor/Parser/HAML.hs | bsd-3-clause | stringLiteral= T.stringLiteral hamlLexer | 40 | stringLiteral= T.stringLiteral hamlLexer | 40 | stringLiteral= T.stringLiteral hamlLexer | 40 | false | false | 0 | 6 | 2 | 11 | 5 | 6 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/ApiGatewayVpcLink.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-vpclink.html#cfn-apigateway-vpclink-description
agvlDescription :: Lens' ApiGatewayVpcLink (Maybe (Val Text))
agvlDescription = lens _apiGatewayVpcLinkDescription (\s a -> s { _apiGatewayVpcLinkDescription = a }) | 303 | agvlDescription :: Lens' ApiGatewayVpcLink (Maybe (Val Text))
agvlDescription = lens _apiGatewayVpcLinkDescription (\s a -> s { _apiGatewayVpcLinkDescription = a }) | 164 | agvlDescription = lens _apiGatewayVpcLinkDescription (\s a -> s { _apiGatewayVpcLinkDescription = a }) | 102 | true | true | 0 | 9 | 22 | 52 | 28 | 24 | null | null |
agrafix/hackage-server | Distribution/Server/Features/Security.hs | bsd-3-clause | securityFeature :: ServerEnv
-> StateComponent AcidState SecurityState
-> SecurityFeature
securityFeature env securityState =
SecurityFeature{..}
where
securityFeatureInterface = (emptyHackageFeature "security") {
featureDesc = "TUF Security"
, featureState = [abstractAcidStateComponent securityState]
, featureReloadFiles = updateRootMirrorsAndKeys env securityState
, featurePostInit = updateRootMirrorsAndKeys env securityState
>> setupResignCronJob env securityState
, featureResources = [
resourceTimestamp
, resourceSnapshot
, resourceRoot
, resourceMirrors
]
}
resourceTimestamp = (secResourceAt Sec.repoLayoutTimestamp) {
resourceDesc = [(GET, "Get TUF timestamp")]
, resourceGet = [("json", serveFromState securityTimestamp)]
}
resourceSnapshot = (secResourceAt Sec.repoLayoutSnapshot) {
resourceDesc = [(GET, "Get TUF snapshot")]
, resourceGet = [("json", serveFromState securitySnapshot)]
}
resourceRoot = (secResourceAt Sec.repoLayoutRoot) {
resourceDesc = [(GET, "Get TUF root")]
, resourceGet = [("json", serveFromState securityRoot)]
}
resourceMirrors = (secResourceAt Sec.repoLayoutMirrors) {
resourceDesc = [(GET, "Get TUF mirrors")]
, resourceGet = [("json", serveFromState securityMirrors)]
}
serveFromState :: (IsTUFFile a, ToMessage a)
=> (SecurityStateFiles -> a)
-> DynamicPath
-> ServerPartE Response
serveFromState file _ = do
msfiles <- queryState securityState GetSecurityFiles
case msfiles of
Nothing -> errNotFound "Security files not available"
[MText $ "The repository is not currently using TUF "
++ "security so the security files are not "
++ "available."]
Just sfiles -> do
let tufFile = file sfiles
eTag = ETag $ show (tufFileHashMD5 tufFile)
-- Higher max-age values result in higher cache hit ratios, but also
-- in higher likelyhood of cache incoherence problems (and of course in
-- higher likelyhood of caches beind out of date with updates to the
-- central server).
cacheControl [Public, NoTransform, maxAgeMinutes 1] eTag
enableRange
return $ toResponse tufFile | 2,549 | securityFeature :: ServerEnv
-> StateComponent AcidState SecurityState
-> SecurityFeature
securityFeature env securityState =
SecurityFeature{..}
where
securityFeatureInterface = (emptyHackageFeature "security") {
featureDesc = "TUF Security"
, featureState = [abstractAcidStateComponent securityState]
, featureReloadFiles = updateRootMirrorsAndKeys env securityState
, featurePostInit = updateRootMirrorsAndKeys env securityState
>> setupResignCronJob env securityState
, featureResources = [
resourceTimestamp
, resourceSnapshot
, resourceRoot
, resourceMirrors
]
}
resourceTimestamp = (secResourceAt Sec.repoLayoutTimestamp) {
resourceDesc = [(GET, "Get TUF timestamp")]
, resourceGet = [("json", serveFromState securityTimestamp)]
}
resourceSnapshot = (secResourceAt Sec.repoLayoutSnapshot) {
resourceDesc = [(GET, "Get TUF snapshot")]
, resourceGet = [("json", serveFromState securitySnapshot)]
}
resourceRoot = (secResourceAt Sec.repoLayoutRoot) {
resourceDesc = [(GET, "Get TUF root")]
, resourceGet = [("json", serveFromState securityRoot)]
}
resourceMirrors = (secResourceAt Sec.repoLayoutMirrors) {
resourceDesc = [(GET, "Get TUF mirrors")]
, resourceGet = [("json", serveFromState securityMirrors)]
}
serveFromState :: (IsTUFFile a, ToMessage a)
=> (SecurityStateFiles -> a)
-> DynamicPath
-> ServerPartE Response
serveFromState file _ = do
msfiles <- queryState securityState GetSecurityFiles
case msfiles of
Nothing -> errNotFound "Security files not available"
[MText $ "The repository is not currently using TUF "
++ "security so the security files are not "
++ "available."]
Just sfiles -> do
let tufFile = file sfiles
eTag = ETag $ show (tufFileHashMD5 tufFile)
-- Higher max-age values result in higher cache hit ratios, but also
-- in higher likelyhood of cache incoherence problems (and of course in
-- higher likelyhood of caches beind out of date with updates to the
-- central server).
cacheControl [Public, NoTransform, maxAgeMinutes 1] eTag
enableRange
return $ toResponse tufFile | 2,549 | securityFeature env securityState =
SecurityFeature{..}
where
securityFeatureInterface = (emptyHackageFeature "security") {
featureDesc = "TUF Security"
, featureState = [abstractAcidStateComponent securityState]
, featureReloadFiles = updateRootMirrorsAndKeys env securityState
, featurePostInit = updateRootMirrorsAndKeys env securityState
>> setupResignCronJob env securityState
, featureResources = [
resourceTimestamp
, resourceSnapshot
, resourceRoot
, resourceMirrors
]
}
resourceTimestamp = (secResourceAt Sec.repoLayoutTimestamp) {
resourceDesc = [(GET, "Get TUF timestamp")]
, resourceGet = [("json", serveFromState securityTimestamp)]
}
resourceSnapshot = (secResourceAt Sec.repoLayoutSnapshot) {
resourceDesc = [(GET, "Get TUF snapshot")]
, resourceGet = [("json", serveFromState securitySnapshot)]
}
resourceRoot = (secResourceAt Sec.repoLayoutRoot) {
resourceDesc = [(GET, "Get TUF root")]
, resourceGet = [("json", serveFromState securityRoot)]
}
resourceMirrors = (secResourceAt Sec.repoLayoutMirrors) {
resourceDesc = [(GET, "Get TUF mirrors")]
, resourceGet = [("json", serveFromState securityMirrors)]
}
serveFromState :: (IsTUFFile a, ToMessage a)
=> (SecurityStateFiles -> a)
-> DynamicPath
-> ServerPartE Response
serveFromState file _ = do
msfiles <- queryState securityState GetSecurityFiles
case msfiles of
Nothing -> errNotFound "Security files not available"
[MText $ "The repository is not currently using TUF "
++ "security so the security files are not "
++ "available."]
Just sfiles -> do
let tufFile = file sfiles
eTag = ETag $ show (tufFileHashMD5 tufFile)
-- Higher max-age values result in higher cache hit ratios, but also
-- in higher likelyhood of cache incoherence problems (and of course in
-- higher likelyhood of caches beind out of date with updates to the
-- central server).
cacheControl [Public, NoTransform, maxAgeMinutes 1] eTag
enableRange
return $ toResponse tufFile | 2,427 | false | true | 0 | 18 | 795 | 478 | 263 | 215 | null | null |
tedkornish/stack | src/Stack/Types/Package.hs | bsd-3-clause | -- | Get the module path.
dotCabalModulePath :: DotCabalPath -> Maybe (Path Abs File)
dotCabalModulePath (DotCabalModulePath fp) = Just fp | 138 | dotCabalModulePath :: DotCabalPath -> Maybe (Path Abs File)
dotCabalModulePath (DotCabalModulePath fp) = Just fp | 112 | dotCabalModulePath (DotCabalModulePath fp) = Just fp | 52 | true | true | 0 | 8 | 19 | 39 | 19 | 20 | null | null |
haskellbr/missingh | missingh-all/src/System/Posix/Consts.hs | mit | regularFileMode :: FileMode
regularFileMode = 0o0100000 | 55 | regularFileMode :: FileMode
regularFileMode = 0o0100000 | 55 | regularFileMode = 0o0100000 | 27 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
sanjoy/hLLVM | src/Llvm/AsmHirConversion/Specialization.hs | bsd-3-clause | tvToAp :: Ucast t Dtype => T t Value -> FunOperand Value
tvToAp (T t v) = FunOperandData (ucast t) [] Nothing v | 111 | tvToAp :: Ucast t Dtype => T t Value -> FunOperand Value
tvToAp (T t v) = FunOperandData (ucast t) [] Nothing v | 111 | tvToAp (T t v) = FunOperandData (ucast t) [] Nothing v | 54 | false | true | 0 | 10 | 22 | 67 | 29 | 38 | null | null |
castaway/pandoc | src/Tests/Writers/HTML.hs | gpl-2.0 | tests :: [Test]
tests = [ testGroup "inline code"
[ "basic" =: code "@&" =?> "<code>@&</code>"
, "haskell" =: codeWith ("",["haskell"],[]) ">>="
=?> if null languages
then "<code class=\"haskell\">>>=</code>"
else "<code class=\"sourceCode haskell\"><span class=\"fu\">>>=</span></code>"
, "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
=?> "<code class=\"nolanguage\">>>=</code>"
]
, testGroup "images"
[ "alt with formatting" =:
image "/url" "title" ("my " <> emph "image")
=?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
]
] | 730 | tests :: [Test]
tests = [ testGroup "inline code"
[ "basic" =: code "@&" =?> "<code>@&</code>"
, "haskell" =: codeWith ("",["haskell"],[]) ">>="
=?> if null languages
then "<code class=\"haskell\">>>=</code>"
else "<code class=\"sourceCode haskell\"><span class=\"fu\">>>=</span></code>"
, "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
=?> "<code class=\"nolanguage\">>>=</code>"
]
, testGroup "images"
[ "alt with formatting" =:
image "/url" "title" ("my " <> emph "image")
=?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
]
] | 730 | tests = [ testGroup "inline code"
[ "basic" =: code "@&" =?> "<code>@&</code>"
, "haskell" =: codeWith ("",["haskell"],[]) ">>="
=?> if null languages
then "<code class=\"haskell\">>>=</code>"
else "<code class=\"sourceCode haskell\"><span class=\"fu\">>>=</span></code>"
, "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
=?> "<code class=\"nolanguage\">>>=</code>"
]
, testGroup "images"
[ "alt with formatting" =:
image "/url" "title" ("my " <> emph "image")
=?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
]
] | 714 | false | true | 0 | 13 | 230 | 143 | 77 | 66 | null | null |
ozataman/snap-extension-session | src/Snap/Extension/Session/Common.hs | bsd-3-clause | checkTimeout (Just x) s =
let t0str = B.unpack `fmap` Map.lookup "_snap_ts" s
t0 = t0str >>= parseTime defaultTimeLocale "%s"
x' = fromIntegral x
in do
t1 <- liftIO getCurrentTime
return $ case t0 of
Nothing -> True -- Timeout not set in cookie, reject immediately
Just (t0') -> t1 > addUTCTime (x' * 60) t0'
------------------------------------------------------------------------------
-- | Generates a random salt. | 464 | checkTimeout (Just x) s =
let t0str = B.unpack `fmap` Map.lookup "_snap_ts" s
t0 = t0str >>= parseTime defaultTimeLocale "%s"
x' = fromIntegral x
in do
t1 <- liftIO getCurrentTime
return $ case t0 of
Nothing -> True -- Timeout not set in cookie, reject immediately
Just (t0') -> t1 > addUTCTime (x' * 60) t0'
------------------------------------------------------------------------------
-- | Generates a random salt. | 464 | checkTimeout (Just x) s =
let t0str = B.unpack `fmap` Map.lookup "_snap_ts" s
t0 = t0str >>= parseTime defaultTimeLocale "%s"
x' = fromIntegral x
in do
t1 <- liftIO getCurrentTime
return $ case t0 of
Nothing -> True -- Timeout not set in cookie, reject immediately
Just (t0') -> t1 > addUTCTime (x' * 60) t0'
------------------------------------------------------------------------------
-- | Generates a random salt. | 464 | false | false | 0 | 16 | 109 | 123 | 61 | 62 | null | null |
atsukotakahashi/wi | src/library/Yi/Keymap/Vim/Tag.hs | gpl-2.0 | visitTagTable :: (TagTable -> YiM a) -> YiM (Maybe a)
visitTagTable act = do
posTagTable <- withEditor getTags
case posTagTable of
Just tagTable -> Just <$> act tagTable
Nothing -> do
f <- tagsFile
case f of
Nothing -> errorEditor "No tags file" >> return Nothing
Just f' -> do
tagTable <- io $ importTagTable f'
withEditor $ setTags tagTable
Just <$> act tagTable | 504 | visitTagTable :: (TagTable -> YiM a) -> YiM (Maybe a)
visitTagTable act = do
posTagTable <- withEditor getTags
case posTagTable of
Just tagTable -> Just <$> act tagTable
Nothing -> do
f <- tagsFile
case f of
Nothing -> errorEditor "No tags file" >> return Nothing
Just f' -> do
tagTable <- io $ importTagTable f'
withEditor $ setTags tagTable
Just <$> act tagTable | 504 | visitTagTable act = do
posTagTable <- withEditor getTags
case posTagTable of
Just tagTable -> Just <$> act tagTable
Nothing -> do
f <- tagsFile
case f of
Nothing -> errorEditor "No tags file" >> return Nothing
Just f' -> do
tagTable <- io $ importTagTable f'
withEditor $ setTags tagTable
Just <$> act tagTable | 450 | false | true | 0 | 19 | 203 | 149 | 66 | 83 | null | null |
kajigor/uKanren_transformations | test/auto/Test/VarNormalization.hs | bsd-3-clause | q3 = V "q.3" | 12 | q3 = V "q.3" | 12 | q3 = V "q.3" | 12 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.