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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Zigazou/HaMinitel | src/Minitel/Generate/Generator.hs | gpl-3.0 | mReverse False = [C0.ESC, PSCFS.NPO] | 36 | mReverse False = [C0.ESC, PSCFS.NPO] | 36 | mReverse False = [C0.ESC, PSCFS.NPO] | 36 | false | false | 0 | 6 | 4 | 19 | 10 | 9 | null | null |
ihc/futhark | src/Futhark/Optimise/Simplifier/Engine.hs | isc | passNeed :: SimpleM lore (a, Need (Wise lore) -> Need (Wise lore)) -> SimpleM lore a
passNeed = pass | 100 | passNeed :: SimpleM lore (a, Need (Wise lore) -> Need (Wise lore)) -> SimpleM lore a
passNeed = pass | 100 | passNeed = pass | 15 | false | true | 0 | 11 | 18 | 53 | 26 | 27 | null | null |
gridaphobe/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | eqResult OrdGE = true_Expr | 31 | eqResult OrdGE = true_Expr | 31 | eqResult OrdGE = true_Expr | 31 | false | false | 0 | 5 | 8 | 9 | 4 | 5 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT46.hs | gpl-3.0 | half (S (S x)) = S (half x) | 27 | half (S (S x)) = S (half x) | 27 | half (S (S x)) = S (half x) | 27 | false | false | 0 | 8 | 7 | 31 | 14 | 17 | null | null |
substack/hsopenid | src/Text/XRDS.hs | bsd-3-clause | - Parsing ---------------------------------------------------------------------
parseXRDS :: String -> Maybe XRDS
parseXRDS str = do
doc <- parseXMLDoc str
let xrds = filterChildren (tag "XRD") doc
return $ map parseXRD xrds
| 233 | parseXRDS :: String -> Maybe XRDS
parseXRDS str = do
doc <- parseXMLDoc str
let xrds = filterChildren (tag "XRD") doc
return $ map parseXRD xrds | 150 | parseXRDS str = do
doc <- parseXMLDoc str
let xrds = filterChildren (tag "XRD") doc
return $ map parseXRD xrds | 116 | true | true | 0 | 12 | 37 | 69 | 31 | 38 | null | null |
typelead/epm | epm/Distribution/Client/Config.hs | bsd-3-clause | deprecatedFieldDescriptions :: [FieldDescr SavedConfig]
deprecatedFieldDescriptions =
[ liftGlobalFlag $
listField "repos"
(Disp.text . showRepo) parseRepo
(fromNubList . globalRemoteRepos)
(\rs cfg -> cfg { globalRemoteRepos = toNubList rs })
, liftGlobalFlag $
simpleField "cachedir"
(Disp.text . fromFlagOrDefault "") (optional parseFilePathQ)
globalCacheDir (\d cfg -> cfg { globalCacheDir = d })
, liftUploadFlag $
simpleField "hackage-username"
(Disp.text . fromFlagOrDefault "" . fmap unUsername)
(optional (fmap Username parseTokenQ))
uploadUsername (\d cfg -> cfg { uploadUsername = d })
, liftUploadFlag $
simpleField "hackage-password"
(Disp.text . fromFlagOrDefault "" . fmap unPassword)
(optional (fmap Password parseTokenQ))
uploadPassword (\d cfg -> cfg { uploadPassword = d })
]
++ map (modifyFieldName ("user-"++) . liftUserInstallDirs) installDirsFields
++ map (modifyFieldName ("global-"++) . liftGlobalInstallDirs) installDirsFields
where
optional = Parse.option mempty . fmap toFlag
modifyFieldName :: (String -> String) -> FieldDescr a -> FieldDescr a
modifyFieldName f d = d { fieldName = f (fieldName d) } | 1,250 | deprecatedFieldDescriptions :: [FieldDescr SavedConfig]
deprecatedFieldDescriptions =
[ liftGlobalFlag $
listField "repos"
(Disp.text . showRepo) parseRepo
(fromNubList . globalRemoteRepos)
(\rs cfg -> cfg { globalRemoteRepos = toNubList rs })
, liftGlobalFlag $
simpleField "cachedir"
(Disp.text . fromFlagOrDefault "") (optional parseFilePathQ)
globalCacheDir (\d cfg -> cfg { globalCacheDir = d })
, liftUploadFlag $
simpleField "hackage-username"
(Disp.text . fromFlagOrDefault "" . fmap unUsername)
(optional (fmap Username parseTokenQ))
uploadUsername (\d cfg -> cfg { uploadUsername = d })
, liftUploadFlag $
simpleField "hackage-password"
(Disp.text . fromFlagOrDefault "" . fmap unPassword)
(optional (fmap Password parseTokenQ))
uploadPassword (\d cfg -> cfg { uploadPassword = d })
]
++ map (modifyFieldName ("user-"++) . liftUserInstallDirs) installDirsFields
++ map (modifyFieldName ("global-"++) . liftGlobalInstallDirs) installDirsFields
where
optional = Parse.option mempty . fmap toFlag
modifyFieldName :: (String -> String) -> FieldDescr a -> FieldDescr a
modifyFieldName f d = d { fieldName = f (fieldName d) } | 1,250 | deprecatedFieldDescriptions =
[ liftGlobalFlag $
listField "repos"
(Disp.text . showRepo) parseRepo
(fromNubList . globalRemoteRepos)
(\rs cfg -> cfg { globalRemoteRepos = toNubList rs })
, liftGlobalFlag $
simpleField "cachedir"
(Disp.text . fromFlagOrDefault "") (optional parseFilePathQ)
globalCacheDir (\d cfg -> cfg { globalCacheDir = d })
, liftUploadFlag $
simpleField "hackage-username"
(Disp.text . fromFlagOrDefault "" . fmap unUsername)
(optional (fmap Username parseTokenQ))
uploadUsername (\d cfg -> cfg { uploadUsername = d })
, liftUploadFlag $
simpleField "hackage-password"
(Disp.text . fromFlagOrDefault "" . fmap unPassword)
(optional (fmap Password parseTokenQ))
uploadPassword (\d cfg -> cfg { uploadPassword = d })
]
++ map (modifyFieldName ("user-"++) . liftUserInstallDirs) installDirsFields
++ map (modifyFieldName ("global-"++) . liftGlobalInstallDirs) installDirsFields
where
optional = Parse.option mempty . fmap toFlag
modifyFieldName :: (String -> String) -> FieldDescr a -> FieldDescr a
modifyFieldName f d = d { fieldName = f (fieldName d) } | 1,194 | false | true | 8 | 12 | 267 | 385 | 200 | 185 | null | null |
bitemyapp/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | isFFILabelTy :: Type -> Validity
-- The type of a foreign label must be Ptr, FunPtr, or a newtype of either.
isFFILabelTy ty = checkRepTyCon ok ty extra
where
ok tc = tc `hasKey` funPtrTyConKey || tc `hasKey` ptrTyConKey
extra = ptext (sLit "A foreign-imported address (via &foo) must have type (Ptr a) or (FunPtr a)") | 328 | isFFILabelTy :: Type -> Validity
isFFILabelTy ty = checkRepTyCon ok ty extra
where
ok tc = tc `hasKey` funPtrTyConKey || tc `hasKey` ptrTyConKey
extra = ptext (sLit "A foreign-imported address (via &foo) must have type (Ptr a) or (FunPtr a)") | 252 | isFFILabelTy ty = checkRepTyCon ok ty extra
where
ok tc = tc `hasKey` funPtrTyConKey || tc `hasKey` ptrTyConKey
extra = ptext (sLit "A foreign-imported address (via &foo) must have type (Ptr a) or (FunPtr a)") | 219 | true | true | 2 | 7 | 65 | 82 | 37 | 45 | null | null |
rolph-recto/liquidhaskell | src/Language/Haskell/Liquid/Parse.hs | bsd-3-clause | remParseError :: SourceName -> String -> String -> ParseError
---------------------------------------------------------------------------
remParseError f s r = newErrorMessage msg $ newPos f line col
where
msg = Message "Leftover while parsing"
(line, col) = remLineCol s r | 305 | remParseError :: SourceName -> String -> String -> ParseError
remParseError f s r = newErrorMessage msg $ newPos f line col
where
msg = Message "Leftover while parsing"
(line, col) = remLineCol s r | 229 | remParseError f s r = newErrorMessage msg $ newPos f line col
where
msg = Message "Leftover while parsing"
(line, col) = remLineCol s r | 161 | true | true | 0 | 7 | 66 | 73 | 36 | 37 | null | null |
hferreiro/replay | compiler/codeGen/StgCmmForeign.hs | bsd-3-clause | closeNursery :: DynFlags -> CmmAGraph
closeNursery dflags = mkStore (nursery_bdescr_free dflags) (cmmOffsetW dflags stgHp 1) | 124 | closeNursery :: DynFlags -> CmmAGraph
closeNursery dflags = mkStore (nursery_bdescr_free dflags) (cmmOffsetW dflags stgHp 1) | 124 | closeNursery dflags = mkStore (nursery_bdescr_free dflags) (cmmOffsetW dflags stgHp 1) | 86 | false | true | 0 | 7 | 14 | 39 | 19 | 20 | null | null |
nishiuramakoto/logiku | Handler/PrologProgram.hs | gpl-3.0 | readInt :: Text -> Maybe Int
readInt s = case reads (T.unpack s) of
[(i, s')] -> if s' == "" then Just i else Nothing
_ -> Nothing | 142 | readInt :: Text -> Maybe Int
readInt s = case reads (T.unpack s) of
[(i, s')] -> if s' == "" then Just i else Nothing
_ -> Nothing | 142 | readInt s = case reads (T.unpack s) of
[(i, s')] -> if s' == "" then Just i else Nothing
_ -> Nothing | 113 | false | true | 0 | 9 | 40 | 77 | 38 | 39 | null | null |
bermanjosh/bloodhound | tests/V1/tests.hs | bsd-3-clause | es14 :: Vers.Version
es14 = Vers.Version [1, 4, 0] [] | 53 | es14 :: Vers.Version
es14 = Vers.Version [1, 4, 0] [] | 53 | es14 = Vers.Version [1, 4, 0] [] | 32 | false | true | 0 | 6 | 9 | 31 | 17 | 14 | null | null |
RaphMad/ZMachine | src/lib/ZMachine/ZTypes.hs | mit | bit9 = BitNumber 9 | 18 | bit9 = BitNumber 9 | 18 | bit9 = BitNumber 9 | 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ComputationWithBoundedResources/tct-trs | src/Tct/Trs/Processor/Matrix/MI.hs | bsd-3-clause | budanConstraint :: Matrix IExpr -> SmtM (KindMatrices IExpr)
budanConstraint m =
let dim = Mat.nrows m
in case dim of
3 -> Smt.assert noRootsGreaterOne >> return (MMatrix m)
where p =
Smt.bigAdd
[ Mat.getEntry (1, 1) m
, Mat.getEntry (2, 2) m
, Mat.getEntry (3, 3) m
]
q =
Smt.bigAdd
[ Smt.IMul (Mat.getEntry (1, 2) m) (Mat.getEntry (2, 1) m)
, Smt.IMul (Mat.getEntry (1, 3) m) (Mat.getEntry (3, 1) m)
, Smt.IMul (Mat.getEntry (2, 3) m) (Mat.getEntry (3, 2) m)
, Smt.INeg
(Smt.IMul (Mat.getEntry (1, 1) m) (Mat.getEntry (2, 2) m))
, Smt.INeg
(Smt.IMul (Mat.getEntry (1, 1) m) (Mat.getEntry (3, 3) m))
, Smt.INeg
(Smt.IMul (Mat.getEntry (2, 2) m) (Mat.getEntry (3, 3) m))
]
r =
Smt.bigAdd
[ Smt.bigMul
[ Mat.getEntry (1, 1) m
, Mat.getEntry (2, 2) m
, Mat.getEntry (3, 3) m
]
, Smt.bigMul
[ Mat.getEntry (1, 2) m
, Mat.getEntry (2, 3) m
, Mat.getEntry (3, 1) m
]
, Smt.bigMul
[ Mat.getEntry (1, 3) m
, Mat.getEntry (2, 1) m
, Mat.getEntry (3, 2) m
]
, Smt.INeg
(Smt.bigMul
[ Mat.getEntry (1, 3) m
, Mat.getEntry (2, 2) m
, Mat.getEntry (3, 1) m
])
, Smt.INeg
(Smt.bigMul
[ Mat.getEntry (1, 2) m
, Mat.getEntry (2, 1) m
, Mat.getEntry (3, 3) m
])
, Smt.INeg
(Smt.bigMul
[ Mat.getEntry (1, 1) m
, Mat.getEntry (2, 3) m
, Mat.getEntry (3, 2) m
])
]
noRootsGreaterOne =
Smt.bigAnd
[ Smt.IAdd p (Smt.INeg $ Smt.IVal 3) .<= Smt.IVal 0
, Smt.bigAdd
[Smt.IMul (Smt.IVal 2) p, q, Smt.INeg $ Smt.IVal 3] .<=
Smt.IVal 0
, Smt.bigAdd [p, q, r, Smt.INeg $ Smt.IVal 1] .<= Smt.IVal 0
]
_ -> error "dimension not supported"
-- maximalMatrix :: (Smt.AAdditive a, Smt.Order a, Smt.Ite a, Smt.Boolean (Smt.B a)) => Int -> Interpretation f (LinearInterpretation v a) -> Matrix a | 2,987 | budanConstraint :: Matrix IExpr -> SmtM (KindMatrices IExpr)
budanConstraint m =
let dim = Mat.nrows m
in case dim of
3 -> Smt.assert noRootsGreaterOne >> return (MMatrix m)
where p =
Smt.bigAdd
[ Mat.getEntry (1, 1) m
, Mat.getEntry (2, 2) m
, Mat.getEntry (3, 3) m
]
q =
Smt.bigAdd
[ Smt.IMul (Mat.getEntry (1, 2) m) (Mat.getEntry (2, 1) m)
, Smt.IMul (Mat.getEntry (1, 3) m) (Mat.getEntry (3, 1) m)
, Smt.IMul (Mat.getEntry (2, 3) m) (Mat.getEntry (3, 2) m)
, Smt.INeg
(Smt.IMul (Mat.getEntry (1, 1) m) (Mat.getEntry (2, 2) m))
, Smt.INeg
(Smt.IMul (Mat.getEntry (1, 1) m) (Mat.getEntry (3, 3) m))
, Smt.INeg
(Smt.IMul (Mat.getEntry (2, 2) m) (Mat.getEntry (3, 3) m))
]
r =
Smt.bigAdd
[ Smt.bigMul
[ Mat.getEntry (1, 1) m
, Mat.getEntry (2, 2) m
, Mat.getEntry (3, 3) m
]
, Smt.bigMul
[ Mat.getEntry (1, 2) m
, Mat.getEntry (2, 3) m
, Mat.getEntry (3, 1) m
]
, Smt.bigMul
[ Mat.getEntry (1, 3) m
, Mat.getEntry (2, 1) m
, Mat.getEntry (3, 2) m
]
, Smt.INeg
(Smt.bigMul
[ Mat.getEntry (1, 3) m
, Mat.getEntry (2, 2) m
, Mat.getEntry (3, 1) m
])
, Smt.INeg
(Smt.bigMul
[ Mat.getEntry (1, 2) m
, Mat.getEntry (2, 1) m
, Mat.getEntry (3, 3) m
])
, Smt.INeg
(Smt.bigMul
[ Mat.getEntry (1, 1) m
, Mat.getEntry (2, 3) m
, Mat.getEntry (3, 2) m
])
]
noRootsGreaterOne =
Smt.bigAnd
[ Smt.IAdd p (Smt.INeg $ Smt.IVal 3) .<= Smt.IVal 0
, Smt.bigAdd
[Smt.IMul (Smt.IVal 2) p, q, Smt.INeg $ Smt.IVal 3] .<=
Smt.IVal 0
, Smt.bigAdd [p, q, r, Smt.INeg $ Smt.IVal 1] .<= Smt.IVal 0
]
_ -> error "dimension not supported"
-- maximalMatrix :: (Smt.AAdditive a, Smt.Order a, Smt.Ite a, Smt.Boolean (Smt.B a)) => Int -> Interpretation f (LinearInterpretation v a) -> Matrix a | 2,987 | budanConstraint m =
let dim = Mat.nrows m
in case dim of
3 -> Smt.assert noRootsGreaterOne >> return (MMatrix m)
where p =
Smt.bigAdd
[ Mat.getEntry (1, 1) m
, Mat.getEntry (2, 2) m
, Mat.getEntry (3, 3) m
]
q =
Smt.bigAdd
[ Smt.IMul (Mat.getEntry (1, 2) m) (Mat.getEntry (2, 1) m)
, Smt.IMul (Mat.getEntry (1, 3) m) (Mat.getEntry (3, 1) m)
, Smt.IMul (Mat.getEntry (2, 3) m) (Mat.getEntry (3, 2) m)
, Smt.INeg
(Smt.IMul (Mat.getEntry (1, 1) m) (Mat.getEntry (2, 2) m))
, Smt.INeg
(Smt.IMul (Mat.getEntry (1, 1) m) (Mat.getEntry (3, 3) m))
, Smt.INeg
(Smt.IMul (Mat.getEntry (2, 2) m) (Mat.getEntry (3, 3) m))
]
r =
Smt.bigAdd
[ Smt.bigMul
[ Mat.getEntry (1, 1) m
, Mat.getEntry (2, 2) m
, Mat.getEntry (3, 3) m
]
, Smt.bigMul
[ Mat.getEntry (1, 2) m
, Mat.getEntry (2, 3) m
, Mat.getEntry (3, 1) m
]
, Smt.bigMul
[ Mat.getEntry (1, 3) m
, Mat.getEntry (2, 1) m
, Mat.getEntry (3, 2) m
]
, Smt.INeg
(Smt.bigMul
[ Mat.getEntry (1, 3) m
, Mat.getEntry (2, 2) m
, Mat.getEntry (3, 1) m
])
, Smt.INeg
(Smt.bigMul
[ Mat.getEntry (1, 2) m
, Mat.getEntry (2, 1) m
, Mat.getEntry (3, 3) m
])
, Smt.INeg
(Smt.bigMul
[ Mat.getEntry (1, 1) m
, Mat.getEntry (2, 3) m
, Mat.getEntry (3, 2) m
])
]
noRootsGreaterOne =
Smt.bigAnd
[ Smt.IAdd p (Smt.INeg $ Smt.IVal 3) .<= Smt.IVal 0
, Smt.bigAdd
[Smt.IMul (Smt.IVal 2) p, q, Smt.INeg $ Smt.IVal 3] .<=
Smt.IVal 0
, Smt.bigAdd [p, q, r, Smt.INeg $ Smt.IVal 1] .<= Smt.IVal 0
]
_ -> error "dimension not supported"
-- maximalMatrix :: (Smt.AAdditive a, Smt.Order a, Smt.Ite a, Smt.Boolean (Smt.B a)) => Int -> Interpretation f (LinearInterpretation v a) -> Matrix a | 2,926 | false | true | 0 | 20 | 1,627 | 935 | 498 | 437 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Core31/Tokens.hs | bsd-3-clause | gl_FRAMEBUFFER_INCOMPLETE_READ_BUFFER :: GLenum
gl_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC | 94 | gl_FRAMEBUFFER_INCOMPLETE_READ_BUFFER :: GLenum
gl_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC | 94 | gl_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC | 46 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
koba-e964/hayashii-mcc | zekamashi/Emit.hs | bsd-3-clause | maybeRegOfString :: (Eq s, IsString s, Show s) => s -> Maybe Reg
maybeRegOfString s = case List.elemIndex s [fromString $ "$" ++ show i | i <- [0..31 :: Int]] of
Just r -> Just (Reg r)
Nothing -> Nothing | 208 | maybeRegOfString :: (Eq s, IsString s, Show s) => s -> Maybe Reg
maybeRegOfString s = case List.elemIndex s [fromString $ "$" ++ show i | i <- [0..31 :: Int]] of
Just r -> Just (Reg r)
Nothing -> Nothing | 208 | maybeRegOfString s = case List.elemIndex s [fromString $ "$" ++ show i | i <- [0..31 :: Int]] of
Just r -> Just (Reg r)
Nothing -> Nothing | 143 | false | true | 0 | 10 | 45 | 107 | 53 | 54 | null | null |
christiaanb/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | inRange_RDR = varQual_RDR gHC_ARR (fsLit "inRange") | 63 | inRange_RDR = varQual_RDR gHC_ARR (fsLit "inRange") | 63 | inRange_RDR = varQual_RDR gHC_ARR (fsLit "inRange") | 63 | false | false | 0 | 7 | 17 | 17 | 8 | 9 | null | null |
lih/Alpha | src/Format.hs | bsd-2-clause | raw entry = F ("raw:"++show entry) entry 0 (const $ return nullPtr) | 67 | raw entry = F ("raw:"++show entry) entry 0 (const $ return nullPtr) | 67 | raw entry = F ("raw:"++show entry) entry 0 (const $ return nullPtr) | 67 | false | false | 0 | 8 | 11 | 38 | 18 | 20 | null | null |
phischu/fragnix | builtins/base/GHC.Stable.hs | bsd-3-clause | -- |
-- Create a stable pointer referring to the given Haskell value.
--
newStablePtr :: a -> IO (StablePtr a)
newStablePtr a = IO $ \ s ->
case makeStablePtr# a s of (# s', sp #) -> (# s', StablePtr sp #)
-- |
-- Obtain the Haskell value referenced by a stable pointer, i.e., the
-- same value that was passed to the corresponding call to
-- 'makeStablePtr'. If the argument to 'deRefStablePtr' has
-- already been freed using 'freeStablePtr', the behaviour of
-- 'deRefStablePtr' is undefined.
-- | 506 | newStablePtr :: a -> IO (StablePtr a)
newStablePtr a = IO $ \ s ->
case makeStablePtr# a s of (# s', sp #) -> (# s', StablePtr sp #)
-- |
-- Obtain the Haskell value referenced by a stable pointer, i.e., the
-- same value that was passed to the corresponding call to
-- 'makeStablePtr'. If the argument to 'deRefStablePtr' has
-- already been freed using 'freeStablePtr', the behaviour of
-- 'deRefStablePtr' is undefined.
-- | 433 | newStablePtr a = IO $ \ s ->
case makeStablePtr# a s of (# s', sp #) -> (# s', StablePtr sp #)
-- |
-- Obtain the Haskell value referenced by a stable pointer, i.e., the
-- same value that was passed to the corresponding call to
-- 'makeStablePtr'. If the argument to 'deRefStablePtr' has
-- already been freed using 'freeStablePtr', the behaviour of
-- 'deRefStablePtr' is undefined.
-- | 393 | true | true | 0 | 11 | 98 | 74 | 42 | 32 | null | null |
kazu-yamamoto/domain-auth | Network/DomainAuth/DK/Verify.hs | bsd-3-clause | canonDkField :: DkCanonAlgo -> Field -> ByteString
canonDkField DK_SIMPLE fld = fieldKey fld +++ ": " +++ fieldValueFolded fld | 126 | canonDkField :: DkCanonAlgo -> Field -> ByteString
canonDkField DK_SIMPLE fld = fieldKey fld +++ ": " +++ fieldValueFolded fld | 126 | canonDkField DK_SIMPLE fld = fieldKey fld +++ ": " +++ fieldValueFolded fld | 75 | false | true | 0 | 7 | 18 | 38 | 18 | 20 | null | null |
EXio4/zyflex | src/Pregu.hs | gpl-3.0 | preguntados :: [Sect]
preguntados =
[Sect
"GEOGRAFÍA"
[Preg
"1. ¿Cuantas sedes tiene la facu?"
[],
Preg
"2. ¿En qué ciudad está la Sede Central?"
[],
Preg
"3. ¿Podes estudiar en Victoria?"
[],
Preg
"4. ¿Cuál es la sede que se encuentra más al norte de la provincia?"
[],
Preg
"5. ¿Dónde se estudia la Licenciatura en Explosivos?"
[]],
Sect
"CIENCIA"
[Preg
"A que se dedica la ciencia criminalísta?"
[Opt "Exhumación de cadáveres",
Opt "Juzgar a los criminales",
Opt "Estudiar los delitos"],
Preg
"Qué estudia Accidentologia Vial?"
[Opt "- El siniestro de tránsito",
Opt "- Accidentes naturales",
Opt "- Construcción de rutas y caminos viales"],
Preg
"3. ¿Cuántos Centros de Investigación tiene la Facultad?"
[],
Preg
"4. ¿Qué licenciatura estudia los ecosistemas?"
[],
Preg
"5. ¿A qué carrera corresponden las materias Inteligencia Artificial\ny Sistemas Operativos?"
[]],
Sect
"ACADÉMICA"
[Preg
"1. ¿Qué carrera se estudia a distancia?"
[],
Preg
"2. ¿Cuántas carreras de grado tiene la Facultad?"
[],
Preg
"3. ¿Cómo se llama la maestría que se dicta en Diamante?"
[],
Preg
"4. ¿Qué diferencia hay entre una carrera de grado y pregrado?"
[Opt "La duración y incumbencia del título",
Opt "Con la tecnicatura se estudia menos",
Opt "El sueldo del licenciado es más alto"]],
Sect
"CIENCIAS\nSOCIALES"
[Preg
"1. ¿Tenés que pagar para estudiar en la Facultad?"
[],
Preg
"2. ¿Qué significa que la universidad es pública?"
[],
Preg
"3. ¿Cómo se llama el colegio histórico que pertenece a la Facultad?"
[],
Preg
"4. ¿De quién depende la UADER?"
[],
Preg
"5. ¿Cuál es la fan page de Facebook de la Facultad?"
[]]] | 1,993 | preguntados :: [Sect]
preguntados =
[Sect
"GEOGRAFÍA"
[Preg
"1. ¿Cuantas sedes tiene la facu?"
[],
Preg
"2. ¿En qué ciudad está la Sede Central?"
[],
Preg
"3. ¿Podes estudiar en Victoria?"
[],
Preg
"4. ¿Cuál es la sede que se encuentra más al norte de la provincia?"
[],
Preg
"5. ¿Dónde se estudia la Licenciatura en Explosivos?"
[]],
Sect
"CIENCIA"
[Preg
"A que se dedica la ciencia criminalísta?"
[Opt "Exhumación de cadáveres",
Opt "Juzgar a los criminales",
Opt "Estudiar los delitos"],
Preg
"Qué estudia Accidentologia Vial?"
[Opt "- El siniestro de tránsito",
Opt "- Accidentes naturales",
Opt "- Construcción de rutas y caminos viales"],
Preg
"3. ¿Cuántos Centros de Investigación tiene la Facultad?"
[],
Preg
"4. ¿Qué licenciatura estudia los ecosistemas?"
[],
Preg
"5. ¿A qué carrera corresponden las materias Inteligencia Artificial\ny Sistemas Operativos?"
[]],
Sect
"ACADÉMICA"
[Preg
"1. ¿Qué carrera se estudia a distancia?"
[],
Preg
"2. ¿Cuántas carreras de grado tiene la Facultad?"
[],
Preg
"3. ¿Cómo se llama la maestría que se dicta en Diamante?"
[],
Preg
"4. ¿Qué diferencia hay entre una carrera de grado y pregrado?"
[Opt "La duración y incumbencia del título",
Opt "Con la tecnicatura se estudia menos",
Opt "El sueldo del licenciado es más alto"]],
Sect
"CIENCIAS\nSOCIALES"
[Preg
"1. ¿Tenés que pagar para estudiar en la Facultad?"
[],
Preg
"2. ¿Qué significa que la universidad es pública?"
[],
Preg
"3. ¿Cómo se llama el colegio histórico que pertenece a la Facultad?"
[],
Preg
"4. ¿De quién depende la UADER?"
[],
Preg
"5. ¿Cuál es la fan page de Facebook de la Facultad?"
[]]] | 1,993 | preguntados =
[Sect
"GEOGRAFÍA"
[Preg
"1. ¿Cuantas sedes tiene la facu?"
[],
Preg
"2. ¿En qué ciudad está la Sede Central?"
[],
Preg
"3. ¿Podes estudiar en Victoria?"
[],
Preg
"4. ¿Cuál es la sede que se encuentra más al norte de la provincia?"
[],
Preg
"5. ¿Dónde se estudia la Licenciatura en Explosivos?"
[]],
Sect
"CIENCIA"
[Preg
"A que se dedica la ciencia criminalísta?"
[Opt "Exhumación de cadáveres",
Opt "Juzgar a los criminales",
Opt "Estudiar los delitos"],
Preg
"Qué estudia Accidentologia Vial?"
[Opt "- El siniestro de tránsito",
Opt "- Accidentes naturales",
Opt "- Construcción de rutas y caminos viales"],
Preg
"3. ¿Cuántos Centros de Investigación tiene la Facultad?"
[],
Preg
"4. ¿Qué licenciatura estudia los ecosistemas?"
[],
Preg
"5. ¿A qué carrera corresponden las materias Inteligencia Artificial\ny Sistemas Operativos?"
[]],
Sect
"ACADÉMICA"
[Preg
"1. ¿Qué carrera se estudia a distancia?"
[],
Preg
"2. ¿Cuántas carreras de grado tiene la Facultad?"
[],
Preg
"3. ¿Cómo se llama la maestría que se dicta en Diamante?"
[],
Preg
"4. ¿Qué diferencia hay entre una carrera de grado y pregrado?"
[Opt "La duración y incumbencia del título",
Opt "Con la tecnicatura se estudia menos",
Opt "El sueldo del licenciado es más alto"]],
Sect
"CIENCIAS\nSOCIALES"
[Preg
"1. ¿Tenés que pagar para estudiar en la Facultad?"
[],
Preg
"2. ¿Qué significa que la universidad es pública?"
[],
Preg
"3. ¿Cómo se llama el colegio histórico que pertenece a la Facultad?"
[],
Preg
"4. ¿De quién depende la UADER?"
[],
Preg
"5. ¿Cuál es la fan page de Facebook de la Facultad?"
[]]] | 1,971 | false | true | 0 | 11 | 649 | 291 | 144 | 147 | null | null |
quchen/stg | src/Stg/Machine/GarbageCollection/TriStateTracing.hs | bsd-3-clause | garbageCollect :: StgState -> (Set MemAddr, StgState)
garbageCollect stgState@StgState
{ stgCode = code
, stgHeap = heap
, stgGlobals = globals
, stgStack = stack }
= let GcState {aliveHeap = alive, oldHeap = Heap dead}
= until everythingCollected gcStep start
start = GcState
{ aliveHeap = mempty
, oldHeap = heap
, staged = (seqToSet . mconcat)
[addrs code, addrs globals, addrs stack] }
stgState' = stgState { stgHeap = alive }
in (M.keysSet dead, stgState') | 571 | garbageCollect :: StgState -> (Set MemAddr, StgState)
garbageCollect stgState@StgState
{ stgCode = code
, stgHeap = heap
, stgGlobals = globals
, stgStack = stack }
= let GcState {aliveHeap = alive, oldHeap = Heap dead}
= until everythingCollected gcStep start
start = GcState
{ aliveHeap = mempty
, oldHeap = heap
, staged = (seqToSet . mconcat)
[addrs code, addrs globals, addrs stack] }
stgState' = stgState { stgHeap = alive }
in (M.keysSet dead, stgState') | 571 | garbageCollect stgState@StgState
{ stgCode = code
, stgHeap = heap
, stgGlobals = globals
, stgStack = stack }
= let GcState {aliveHeap = alive, oldHeap = Heap dead}
= until everythingCollected gcStep start
start = GcState
{ aliveHeap = mempty
, oldHeap = heap
, staged = (seqToSet . mconcat)
[addrs code, addrs globals, addrs stack] }
stgState' = stgState { stgHeap = alive }
in (M.keysSet dead, stgState') | 517 | false | true | 7 | 13 | 186 | 176 | 93 | 83 | null | null |
jff/TeLLer | src/Parser.hs | gpl-3.0 | construct :: Parser b -> (a -> a -> a) -> Parser (a -> a -> a)
construct p c = p >> return c | 92 | construct :: Parser b -> (a -> a -> a) -> Parser (a -> a -> a)
construct p c = p >> return c | 92 | construct p c = p >> return c | 29 | false | true | 0 | 10 | 24 | 59 | 29 | 30 | null | null |
andreashug/ninty-nine-problems | haskell/src/lists.hs | unlicense | lastButOne (_:ys) = lastButOne ys | 33 | lastButOne (_:ys) = lastButOne ys | 33 | lastButOne (_:ys) = lastButOne ys | 33 | false | false | 0 | 6 | 4 | 20 | 9 | 11 | null | null |
allonsy/mailServer | src/EncryptMail.hs | mit | decryptEmail :: EncryptedEmail -> Key -> Key -> (Mail, Bool)
decryptEmail m pub priv = (retMail, verfy) where
header = read $ decryptMessage (encHdr m) priv
cont = read $ decryptMessage (encContents m) priv
retMail = Mail (idEnc m) header cont (encSig m)
verfy = verifySig ((show (changeBCC header [])) ++ cont) (encSig m) pub
--given a message to send, AES key, and handle, it encryptsthe message
--then computes the length of the cipher text, sends the length so the
--receiving end knows when the message is done
--and then sends the ciphertext | 565 | decryptEmail :: EncryptedEmail -> Key -> Key -> (Mail, Bool)
decryptEmail m pub priv = (retMail, verfy) where
header = read $ decryptMessage (encHdr m) priv
cont = read $ decryptMessage (encContents m) priv
retMail = Mail (idEnc m) header cont (encSig m)
verfy = verifySig ((show (changeBCC header [])) ++ cont) (encSig m) pub
--given a message to send, AES key, and handle, it encryptsthe message
--then computes the length of the cipher text, sends the length so the
--receiving end knows when the message is done
--and then sends the ciphertext | 565 | decryptEmail m pub priv = (retMail, verfy) where
header = read $ decryptMessage (encHdr m) priv
cont = read $ decryptMessage (encContents m) priv
retMail = Mail (idEnc m) header cont (encSig m)
verfy = verifySig ((show (changeBCC header [])) ++ cont) (encSig m) pub
--given a message to send, AES key, and handle, it encryptsthe message
--then computes the length of the cipher text, sends the length so the
--receiving end knows when the message is done
--and then sends the ciphertext | 504 | false | true | 0 | 12 | 110 | 154 | 82 | 72 | null | null |
mdsteele/pylos | src/Pylos/Draw.hs | gpl-3.0 | -- needed for unsafePerformIO
fontCache :: HT.HashTable (FilePath, Int) Font
fontCache = unsafePerformIO $ HT.new (==) hash
where hash (str, int) = HT.hashString str `xor` HT.hashInt int | 188 | fontCache :: HT.HashTable (FilePath, Int) Font
fontCache = unsafePerformIO $ HT.new (==) hash
where hash (str, int) = HT.hashString str `xor` HT.hashInt int | 158 | fontCache = unsafePerformIO $ HT.new (==) hash
where hash (str, int) = HT.hashString str `xor` HT.hashInt int | 111 | true | true | 1 | 7 | 28 | 75 | 38 | 37 | null | null |
acowley/ghc | compiler/utils/Outputable.hs | bsd-3-clause | angleBrackets d = char '<' <> d <> char '>' | 43 | angleBrackets d = char '<' <> d <> char '>' | 43 | angleBrackets d = char '<' <> d <> char '>' | 43 | false | false | 0 | 7 | 9 | 23 | 10 | 13 | null | null |
butchhoward/haskel_scheme | Main.hs | mit | parseList :: Parser LispVal
parseList = liftM List $ sepBy parseExpr spaces | 75 | parseList :: Parser LispVal
parseList = liftM List $ sepBy parseExpr spaces | 75 | parseList = liftM List $ sepBy parseExpr spaces | 47 | false | true | 1 | 6 | 11 | 29 | 12 | 17 | null | null |
dmbarbour/haskell-vcache | hsrc_lib/Database/VCache/VTx.hs | bsd-2-clause | -- Track which threads are waiting on a commit signal.
updateSync :: Bool -> MVar () -> [MVar ()] -> [MVar ()]
updateSync bSync v = if bSync then (v:) else id | 158 | updateSync :: Bool -> MVar () -> [MVar ()] -> [MVar ()]
updateSync bSync v = if bSync then (v:) else id | 103 | updateSync bSync v = if bSync then (v:) else id | 47 | true | true | 0 | 10 | 31 | 62 | 33 | 29 | null | null |
adunning/pandoc-citeproc | src/Text/CSL/Eval/Date.hs | bsd-3-clause | formatDate :: EvalMode -> String -> [CslTerm] -> [DatePart] -> [RefDate] -> [Output]
formatDate em k tm dp date
| [d] <- date = concatMap (formatDatePart d) dp
| (a:b:_) <- date = addODate . concat $ doRange a b
| otherwise = []
where
addODate [] = []
addODate xs = [ODate xs]
splitDate a b = case split (onSublist $ diff a b dp) dp of
[x,y,z] -> (x,y,z)
_ -> E.throw ErrorSplittingDate
doRange a b = let (x,y,z) = splitDate a b in
map (formatDatePart a) x ++
withDelim y
(map (formatDatePart a) (rmSuffix y))
(map (formatDatePart b) (rmPrefix y))
++
map (formatDatePart b) z
-- the point of rmPrefix is to remove the blank space that otherwise
-- gets added after the delimiter in a range: 24- 26.
rmPrefix (dp':rest) = dp'{ dpFormatting =
(dpFormatting dp') { prefix = "" } } : rest
rmPrefix [] = []
rmSuffix (dp':rest)
| null rest = [dp'{ dpFormatting =
(dpFormatting dp') { suffix = "" } }]
| otherwise = dp':rmSuffix rest
rmSuffix [] = []
diff (RefDate ya ma sa da _ _)
(RefDate yb mb sb db _ _)
= filter (\x -> dpName x `elem` ns)
where ns =
case () of
_ | ya /= yb -> ["year","month","day"]
| ma /= mb || sa /= sb ->
if isNothing da && isNothing db
then ["month"]
else ["month","day"]
| da /= db -> ["day"]
| otherwise -> ["year","month","day"]
term f t = let f' = if f `elem` ["verb", "short", "verb-short", "symbol"]
then read $ toRead f
else Long
in maybe [] termPlural $ findTerm t f' tm
formatDatePart (RefDate y m e d o _) (DatePart n f _ fm)
| "year" <- n, Just y' <- y = return $ OYear (formatYear f y') k fm
| "month" <- n, Just m' <- m = output fm (formatMonth f fm m')
| "month" <- n, Just e' <- e =
case e' of
RawSeason s -> [OStr s fm]
_ -> output fm $ term f (printf "season-%02d"
$ fromMaybe 0 $ seasonToInt e')
| "day" <- n, Just d' <- d = output fm (formatDay f m d')
| "year" <- n, o /= mempty = output fm (unLiteral o)
| otherwise = []
withDelim xs o1 o2
| null (concat o1 ++ concat o2) = []
| otherwise = o1 ++ (case dpRangeDelim <$> last' xs of
["-"] -> [[OPan [Str "\x2013"]]]
[s] -> [[OPan [Str s]]]
_ -> []) ++ o2
formatYear f y
| "short" <- f = printf "%02d" y
| isSorting em
, y < 0 = printf "-%04d" (abs y)
| isSorting em = printf "%04d" y
| y < 0 = printf "%d" (abs y) ++ term [] "bc"
| y < 1000
, y > 0 = printf "%d" y ++ term [] "ad"
| y == 0 = ""
| otherwise = printf "%d" y
formatMonth f fm m
| "short" <- f = getMonth $ period . termPlural
| "long" <- f = getMonth termPlural
| "numeric" <- f = printf "%d" m
| otherwise = printf "%02d" m
where
period = if stripPeriods fm then filter (/= '.') else id
getMonth g = maybe (show m) g $ findTerm ("month-" ++ printf "%02d" m) (read $ toRead f) tm
formatDay f m d
| "numeric-leading-zeros" <- f = printf "%02d" d
| "ordinal" <- f = ordinal tm ("month-" ++ maybe "0" (printf "%02d") m) d
| otherwise = printf "%d" d | 4,143 | formatDate :: EvalMode -> String -> [CslTerm] -> [DatePart] -> [RefDate] -> [Output]
formatDate em k tm dp date
| [d] <- date = concatMap (formatDatePart d) dp
| (a:b:_) <- date = addODate . concat $ doRange a b
| otherwise = []
where
addODate [] = []
addODate xs = [ODate xs]
splitDate a b = case split (onSublist $ diff a b dp) dp of
[x,y,z] -> (x,y,z)
_ -> E.throw ErrorSplittingDate
doRange a b = let (x,y,z) = splitDate a b in
map (formatDatePart a) x ++
withDelim y
(map (formatDatePart a) (rmSuffix y))
(map (formatDatePart b) (rmPrefix y))
++
map (formatDatePart b) z
-- the point of rmPrefix is to remove the blank space that otherwise
-- gets added after the delimiter in a range: 24- 26.
rmPrefix (dp':rest) = dp'{ dpFormatting =
(dpFormatting dp') { prefix = "" } } : rest
rmPrefix [] = []
rmSuffix (dp':rest)
| null rest = [dp'{ dpFormatting =
(dpFormatting dp') { suffix = "" } }]
| otherwise = dp':rmSuffix rest
rmSuffix [] = []
diff (RefDate ya ma sa da _ _)
(RefDate yb mb sb db _ _)
= filter (\x -> dpName x `elem` ns)
where ns =
case () of
_ | ya /= yb -> ["year","month","day"]
| ma /= mb || sa /= sb ->
if isNothing da && isNothing db
then ["month"]
else ["month","day"]
| da /= db -> ["day"]
| otherwise -> ["year","month","day"]
term f t = let f' = if f `elem` ["verb", "short", "verb-short", "symbol"]
then read $ toRead f
else Long
in maybe [] termPlural $ findTerm t f' tm
formatDatePart (RefDate y m e d o _) (DatePart n f _ fm)
| "year" <- n, Just y' <- y = return $ OYear (formatYear f y') k fm
| "month" <- n, Just m' <- m = output fm (formatMonth f fm m')
| "month" <- n, Just e' <- e =
case e' of
RawSeason s -> [OStr s fm]
_ -> output fm $ term f (printf "season-%02d"
$ fromMaybe 0 $ seasonToInt e')
| "day" <- n, Just d' <- d = output fm (formatDay f m d')
| "year" <- n, o /= mempty = output fm (unLiteral o)
| otherwise = []
withDelim xs o1 o2
| null (concat o1 ++ concat o2) = []
| otherwise = o1 ++ (case dpRangeDelim <$> last' xs of
["-"] -> [[OPan [Str "\x2013"]]]
[s] -> [[OPan [Str s]]]
_ -> []) ++ o2
formatYear f y
| "short" <- f = printf "%02d" y
| isSorting em
, y < 0 = printf "-%04d" (abs y)
| isSorting em = printf "%04d" y
| y < 0 = printf "%d" (abs y) ++ term [] "bc"
| y < 1000
, y > 0 = printf "%d" y ++ term [] "ad"
| y == 0 = ""
| otherwise = printf "%d" y
formatMonth f fm m
| "short" <- f = getMonth $ period . termPlural
| "long" <- f = getMonth termPlural
| "numeric" <- f = printf "%d" m
| otherwise = printf "%02d" m
where
period = if stripPeriods fm then filter (/= '.') else id
getMonth g = maybe (show m) g $ findTerm ("month-" ++ printf "%02d" m) (read $ toRead f) tm
formatDay f m d
| "numeric-leading-zeros" <- f = printf "%02d" d
| "ordinal" <- f = ordinal tm ("month-" ++ maybe "0" (printf "%02d") m) d
| otherwise = printf "%d" d | 4,143 | formatDate em k tm dp date
| [d] <- date = concatMap (formatDatePart d) dp
| (a:b:_) <- date = addODate . concat $ doRange a b
| otherwise = []
where
addODate [] = []
addODate xs = [ODate xs]
splitDate a b = case split (onSublist $ diff a b dp) dp of
[x,y,z] -> (x,y,z)
_ -> E.throw ErrorSplittingDate
doRange a b = let (x,y,z) = splitDate a b in
map (formatDatePart a) x ++
withDelim y
(map (formatDatePart a) (rmSuffix y))
(map (formatDatePart b) (rmPrefix y))
++
map (formatDatePart b) z
-- the point of rmPrefix is to remove the blank space that otherwise
-- gets added after the delimiter in a range: 24- 26.
rmPrefix (dp':rest) = dp'{ dpFormatting =
(dpFormatting dp') { prefix = "" } } : rest
rmPrefix [] = []
rmSuffix (dp':rest)
| null rest = [dp'{ dpFormatting =
(dpFormatting dp') { suffix = "" } }]
| otherwise = dp':rmSuffix rest
rmSuffix [] = []
diff (RefDate ya ma sa da _ _)
(RefDate yb mb sb db _ _)
= filter (\x -> dpName x `elem` ns)
where ns =
case () of
_ | ya /= yb -> ["year","month","day"]
| ma /= mb || sa /= sb ->
if isNothing da && isNothing db
then ["month"]
else ["month","day"]
| da /= db -> ["day"]
| otherwise -> ["year","month","day"]
term f t = let f' = if f `elem` ["verb", "short", "verb-short", "symbol"]
then read $ toRead f
else Long
in maybe [] termPlural $ findTerm t f' tm
formatDatePart (RefDate y m e d o _) (DatePart n f _ fm)
| "year" <- n, Just y' <- y = return $ OYear (formatYear f y') k fm
| "month" <- n, Just m' <- m = output fm (formatMonth f fm m')
| "month" <- n, Just e' <- e =
case e' of
RawSeason s -> [OStr s fm]
_ -> output fm $ term f (printf "season-%02d"
$ fromMaybe 0 $ seasonToInt e')
| "day" <- n, Just d' <- d = output fm (formatDay f m d')
| "year" <- n, o /= mempty = output fm (unLiteral o)
| otherwise = []
withDelim xs o1 o2
| null (concat o1 ++ concat o2) = []
| otherwise = o1 ++ (case dpRangeDelim <$> last' xs of
["-"] -> [[OPan [Str "\x2013"]]]
[s] -> [[OPan [Str s]]]
_ -> []) ++ o2
formatYear f y
| "short" <- f = printf "%02d" y
| isSorting em
, y < 0 = printf "-%04d" (abs y)
| isSorting em = printf "%04d" y
| y < 0 = printf "%d" (abs y) ++ term [] "bc"
| y < 1000
, y > 0 = printf "%d" y ++ term [] "ad"
| y == 0 = ""
| otherwise = printf "%d" y
formatMonth f fm m
| "short" <- f = getMonth $ period . termPlural
| "long" <- f = getMonth termPlural
| "numeric" <- f = printf "%d" m
| otherwise = printf "%02d" m
where
period = if stripPeriods fm then filter (/= '.') else id
getMonth g = maybe (show m) g $ findTerm ("month-" ++ printf "%02d" m) (read $ toRead f) tm
formatDay f m d
| "numeric-leading-zeros" <- f = printf "%02d" d
| "ordinal" <- f = ordinal tm ("month-" ++ maybe "0" (printf "%02d") m) d
| otherwise = printf "%d" d | 4,058 | false | true | 0 | 18 | 1,933 | 1,534 | 751 | 783 | null | null |
typelead/epm | epm/Main.hs | bsd-3-clause | replAction :: (ReplFlags, BuildExFlags) -> [String] -> GlobalFlags -> IO ()
replAction (replFlags, buildExFlags) extraArgs globalFlags = do
cwd <- getCurrentDirectory
pkgDesc <- findPackageDesc cwd
either (const onNoPkgDesc) (const onPkgDesc) pkgDesc
where
verbosity = fromFlagOrDefault normal (replVerbosity replFlags)
-- There is a .cabal file in the current directory: start a REPL and load
-- the project's modules.
onPkgDesc = do
let distPref = fromFlagOrDefault (useDistPref defaultSetupScriptOptions)
(replDistPref replFlags)
noAddSource = case replReload replFlags of
Flag True -> SkipAddSourceDepsCheck
_ -> fromFlagOrDefault DontSkipAddSourceDepsCheck
(buildOnly buildExFlags)
progConf = defaultProgramConfiguration
setupOptions = defaultSetupScriptOptions
{ useCabalVersion = orLaterVersion $ Version [1,18,0] []
, useDistPref = distPref
}
replFlags' = replFlags
{ replVerbosity = toFlag verbosity
, replDistPref = toFlag distPref
}
-- Calls 'configureAction' to do the real work, so nothing special has to
-- be done to support sandboxes.
(useSandbox, _config) <- reconfigure verbosity distPref
mempty [] globalFlags noAddSource NoFlag
(const Nothing)
maybeWithSandboxDirOnSearchPath useSandbox $
setupWrapper verbosity setupOptions Nothing
(Cabal.replCommand progConf) (const replFlags') extraArgs
-- No .cabal file in the current directory: just start the REPL (possibly
-- using the sandbox package DB).
onNoPkgDesc = do
(_useSandbox, config) <- loadConfigOrSandboxConfig verbosity globalFlags
mempty
let configFlags = savedConfigureFlags config
(comp, _platform, programDb) <- configCompilerAux' configFlags
startInterpreter verbosity programDb comp (configPackageDB' configFlags)
-- | Re-configure the package in the current directory if needed. Deciding
-- when to reconfigure and with which options is convoluted:
--
-- If we are reconfiguring, we must always run @configure@ with the
-- verbosity option we are given; however, that a previous configuration
-- uses a different verbosity setting is not reason enough to reconfigure.
--
-- The package should be configured to use the same \"dist\" prefix as
-- given to the @build@ command, otherwise the build will probably
-- fail. Not only does this determine the \"dist\" prefix setting if we
-- need to reconfigure anyway, but an existing configuration should be
-- invalidated if its \"dist\" prefix differs.
--
-- If the package has never been configured (i.e., there is no
-- LocalBuildInfo), we must configure first, using the default options.
--
-- If the package has been configured, there will be a 'LocalBuildInfo'.
-- If there no package description file, we assume that the
-- 'PackageDescription' is up to date, though the configuration may need
-- to be updated for other reasons (see above). If there is a package
-- description file, and it has been modified since the 'LocalBuildInfo'
-- was generated, then we need to reconfigure.
--
-- The caller of this function may also have specific requirements
-- regarding the flags the last configuration used. For example,
-- 'testAction' requires that the package be configured with test suites
-- enabled. The caller may pass the required settings to this function
-- along with a function to check the validity of the saved 'ConfigFlags';
-- these required settings will be checked first upon determining that
-- a previous configuration exists. | 3,794 | replAction :: (ReplFlags, BuildExFlags) -> [String] -> GlobalFlags -> IO ()
replAction (replFlags, buildExFlags) extraArgs globalFlags = do
cwd <- getCurrentDirectory
pkgDesc <- findPackageDesc cwd
either (const onNoPkgDesc) (const onPkgDesc) pkgDesc
where
verbosity = fromFlagOrDefault normal (replVerbosity replFlags)
-- There is a .cabal file in the current directory: start a REPL and load
-- the project's modules.
onPkgDesc = do
let distPref = fromFlagOrDefault (useDistPref defaultSetupScriptOptions)
(replDistPref replFlags)
noAddSource = case replReload replFlags of
Flag True -> SkipAddSourceDepsCheck
_ -> fromFlagOrDefault DontSkipAddSourceDepsCheck
(buildOnly buildExFlags)
progConf = defaultProgramConfiguration
setupOptions = defaultSetupScriptOptions
{ useCabalVersion = orLaterVersion $ Version [1,18,0] []
, useDistPref = distPref
}
replFlags' = replFlags
{ replVerbosity = toFlag verbosity
, replDistPref = toFlag distPref
}
-- Calls 'configureAction' to do the real work, so nothing special has to
-- be done to support sandboxes.
(useSandbox, _config) <- reconfigure verbosity distPref
mempty [] globalFlags noAddSource NoFlag
(const Nothing)
maybeWithSandboxDirOnSearchPath useSandbox $
setupWrapper verbosity setupOptions Nothing
(Cabal.replCommand progConf) (const replFlags') extraArgs
-- No .cabal file in the current directory: just start the REPL (possibly
-- using the sandbox package DB).
onNoPkgDesc = do
(_useSandbox, config) <- loadConfigOrSandboxConfig verbosity globalFlags
mempty
let configFlags = savedConfigureFlags config
(comp, _platform, programDb) <- configCompilerAux' configFlags
startInterpreter verbosity programDb comp (configPackageDB' configFlags)
-- | Re-configure the package in the current directory if needed. Deciding
-- when to reconfigure and with which options is convoluted:
--
-- If we are reconfiguring, we must always run @configure@ with the
-- verbosity option we are given; however, that a previous configuration
-- uses a different verbosity setting is not reason enough to reconfigure.
--
-- The package should be configured to use the same \"dist\" prefix as
-- given to the @build@ command, otherwise the build will probably
-- fail. Not only does this determine the \"dist\" prefix setting if we
-- need to reconfigure anyway, but an existing configuration should be
-- invalidated if its \"dist\" prefix differs.
--
-- If the package has never been configured (i.e., there is no
-- LocalBuildInfo), we must configure first, using the default options.
--
-- If the package has been configured, there will be a 'LocalBuildInfo'.
-- If there no package description file, we assume that the
-- 'PackageDescription' is up to date, though the configuration may need
-- to be updated for other reasons (see above). If there is a package
-- description file, and it has been modified since the 'LocalBuildInfo'
-- was generated, then we need to reconfigure.
--
-- The caller of this function may also have specific requirements
-- regarding the flags the last configuration used. For example,
-- 'testAction' requires that the package be configured with test suites
-- enabled. The caller may pass the required settings to this function
-- along with a function to check the validity of the saved 'ConfigFlags';
-- these required settings will be checked first upon determining that
-- a previous configuration exists. | 3,794 | replAction (replFlags, buildExFlags) extraArgs globalFlags = do
cwd <- getCurrentDirectory
pkgDesc <- findPackageDesc cwd
either (const onNoPkgDesc) (const onPkgDesc) pkgDesc
where
verbosity = fromFlagOrDefault normal (replVerbosity replFlags)
-- There is a .cabal file in the current directory: start a REPL and load
-- the project's modules.
onPkgDesc = do
let distPref = fromFlagOrDefault (useDistPref defaultSetupScriptOptions)
(replDistPref replFlags)
noAddSource = case replReload replFlags of
Flag True -> SkipAddSourceDepsCheck
_ -> fromFlagOrDefault DontSkipAddSourceDepsCheck
(buildOnly buildExFlags)
progConf = defaultProgramConfiguration
setupOptions = defaultSetupScriptOptions
{ useCabalVersion = orLaterVersion $ Version [1,18,0] []
, useDistPref = distPref
}
replFlags' = replFlags
{ replVerbosity = toFlag verbosity
, replDistPref = toFlag distPref
}
-- Calls 'configureAction' to do the real work, so nothing special has to
-- be done to support sandboxes.
(useSandbox, _config) <- reconfigure verbosity distPref
mempty [] globalFlags noAddSource NoFlag
(const Nothing)
maybeWithSandboxDirOnSearchPath useSandbox $
setupWrapper verbosity setupOptions Nothing
(Cabal.replCommand progConf) (const replFlags') extraArgs
-- No .cabal file in the current directory: just start the REPL (possibly
-- using the sandbox package DB).
onNoPkgDesc = do
(_useSandbox, config) <- loadConfigOrSandboxConfig verbosity globalFlags
mempty
let configFlags = savedConfigureFlags config
(comp, _platform, programDb) <- configCompilerAux' configFlags
startInterpreter verbosity programDb comp (configPackageDB' configFlags)
-- | Re-configure the package in the current directory if needed. Deciding
-- when to reconfigure and with which options is convoluted:
--
-- If we are reconfiguring, we must always run @configure@ with the
-- verbosity option we are given; however, that a previous configuration
-- uses a different verbosity setting is not reason enough to reconfigure.
--
-- The package should be configured to use the same \"dist\" prefix as
-- given to the @build@ command, otherwise the build will probably
-- fail. Not only does this determine the \"dist\" prefix setting if we
-- need to reconfigure anyway, but an existing configuration should be
-- invalidated if its \"dist\" prefix differs.
--
-- If the package has never been configured (i.e., there is no
-- LocalBuildInfo), we must configure first, using the default options.
--
-- If the package has been configured, there will be a 'LocalBuildInfo'.
-- If there no package description file, we assume that the
-- 'PackageDescription' is up to date, though the configuration may need
-- to be updated for other reasons (see above). If there is a package
-- description file, and it has been modified since the 'LocalBuildInfo'
-- was generated, then we need to reconfigure.
--
-- The caller of this function may also have specific requirements
-- regarding the flags the last configuration used. For example,
-- 'testAction' requires that the package be configured with test suites
-- enabled. The caller may pass the required settings to this function
-- along with a function to check the validity of the saved 'ConfigFlags';
-- these required settings will be checked first upon determining that
-- a previous configuration exists. | 3,718 | false | true | 0 | 15 | 899 | 431 | 234 | 197 | null | null |
Philonous/pontarius-xmpp-e2e | source/Pontarius/E2E/Monad.hs | apache-2.0 | runRand :: g -> Rand g a -> (a, g)
runRand g = runIdentity . runRandT g | 71 | runRand :: g -> Rand g a -> (a, g)
runRand g = runIdentity . runRandT g | 71 | runRand g = runIdentity . runRandT g | 36 | false | true | 0 | 7 | 16 | 40 | 20 | 20 | null | null |
cdepillabout/highlight | src/Highlight/Common/Color.hs | bsd-3-clause | -----------------------
-- Dull Bold Colors --
-----------------------
colorDullBlackBold :: ByteString
colorDullBlackBold = colorBold `mappend` colorDullBlack | 160 | colorDullBlackBold :: ByteString
colorDullBlackBold = colorBold `mappend` colorDullBlack | 88 | colorDullBlackBold = colorBold `mappend` colorDullBlack | 55 | true | true | 0 | 6 | 15 | 29 | 15 | 14 | null | null |
uduki/hsQt | Qtc/Enums/Gui/QStackedLayout.hs | bsd-2-clause | eStackOne :: StackingMode
eStackOne
= ieStackingMode $ 0 | 58 | eStackOne :: StackingMode
eStackOne
= ieStackingMode $ 0 | 58 | eStackOne
= ieStackingMode $ 0 | 32 | false | true | 0 | 5 | 9 | 15 | 8 | 7 | null | null |
bitemyapp/ghc | libraries/base/GHC/Event/Manager.hs | bsd-3-clause | closeFd_ :: EventManager
-> IntTable [FdData]
-> Fd
-> IO (IO ())
closeFd_ mgr tbl fd = do
prev <- IT.delete (fromIntegral fd) tbl
case prev of
Nothing -> return (return ())
Just fds -> do
let oldEvs = eventsOf fds
when (oldEvs /= mempty) $ do
_ <- I.modifyFd (emBackend mgr) fd oldEvs mempty
wakeManager mgr
return $
forM_ fds $ \(FdData reg ev cb) -> cb reg (ev `mappend` evtClose)
------------------------------------------------------------------------
-- Utilities
-- | Call the callbacks corresponding to the given file descriptor. | 630 | closeFd_ :: EventManager
-> IntTable [FdData]
-> Fd
-> IO (IO ())
closeFd_ mgr tbl fd = do
prev <- IT.delete (fromIntegral fd) tbl
case prev of
Nothing -> return (return ())
Just fds -> do
let oldEvs = eventsOf fds
when (oldEvs /= mempty) $ do
_ <- I.modifyFd (emBackend mgr) fd oldEvs mempty
wakeManager mgr
return $
forM_ fds $ \(FdData reg ev cb) -> cb reg (ev `mappend` evtClose)
------------------------------------------------------------------------
-- Utilities
-- | Call the callbacks corresponding to the given file descriptor. | 630 | closeFd_ mgr tbl fd = do
prev <- IT.delete (fromIntegral fd) tbl
case prev of
Nothing -> return (return ())
Just fds -> do
let oldEvs = eventsOf fds
when (oldEvs /= mempty) $ do
_ <- I.modifyFd (emBackend mgr) fd oldEvs mempty
wakeManager mgr
return $
forM_ fds $ \(FdData reg ev cb) -> cb reg (ev `mappend` evtClose)
------------------------------------------------------------------------
-- Utilities
-- | Call the callbacks corresponding to the given file descriptor. | 528 | false | true | 0 | 18 | 178 | 205 | 98 | 107 | null | null |
mfpi/hsys | src/Input/InputSodium.hs | mit | keyEvent :: GLFW.Key -> Event KeyEvent -> Event KeyEvent
keyEvent key = filterE (\(KeyEvent k _) -> k == key) | 109 | keyEvent :: GLFW.Key -> Event KeyEvent -> Event KeyEvent
keyEvent key = filterE (\(KeyEvent k _) -> k == key) | 109 | keyEvent key = filterE (\(KeyEvent k _) -> k == key) | 52 | false | true | 0 | 9 | 19 | 58 | 27 | 31 | null | null |
ganeti/ganeti | src/Ganeti/HTools/Backend/Luxi.hs | bsd-2-clause | -- | Wrapper over callMethod doing group query.
queryGroups :: L.Client -> IO (Result JSValue)
queryGroups = liftM errToResult . L.callMethod queryGroupsMsg | 156 | queryGroups :: L.Client -> IO (Result JSValue)
queryGroups = liftM errToResult . L.callMethod queryGroupsMsg | 108 | queryGroups = liftM errToResult . L.callMethod queryGroupsMsg | 61 | true | true | 1 | 9 | 21 | 45 | 20 | 25 | null | null |
snowleopard/shaking-up-ghc | src/Hadrian/Package.hs | bsd-3-clause | -- | Is this a library package?
isLibrary :: Package -> Bool
isLibrary (Package Library _ _) = True | 99 | isLibrary :: Package -> Bool
isLibrary (Package Library _ _) = True | 67 | isLibrary (Package Library _ _) = True | 38 | true | true | 0 | 7 | 18 | 29 | 15 | 14 | null | null |
petabricks/petabricks | scripts/oldtuner2/src/Petabricks.hs | mit | -- runs the given PetaBricks progrtam with the --name parameter and returns
-- the results if the run succeeds
programMainName :: Program -> IO (Either String String)
programMainName (Program root name) =
do (exitCode, stdout, stderr) <- readProcessWithExitCode (root ++ "/" ++ name) ["--name"] ""
case exitCode of
ExitSuccess -> return $ Right $ init stdout
ExitFailure _ -> return $ Left stderr | 427 | programMainName :: Program -> IO (Either String String)
programMainName (Program root name) =
do (exitCode, stdout, stderr) <- readProcessWithExitCode (root ++ "/" ++ name) ["--name"] ""
case exitCode of
ExitSuccess -> return $ Right $ init stdout
ExitFailure _ -> return $ Left stderr | 316 | programMainName (Program root name) =
do (exitCode, stdout, stderr) <- readProcessWithExitCode (root ++ "/" ++ name) ["--name"] ""
case exitCode of
ExitSuccess -> return $ Right $ init stdout
ExitFailure _ -> return $ Left stderr | 260 | true | true | 0 | 11 | 93 | 120 | 59 | 61 | null | null |
Reboare/Duchess | src/Identifiers/Infer/Parser.hs | bsd-3-clause | seperators :: String
seperators = ". _[]()" | 43 | seperators :: String
seperators = ". _[]()" | 43 | seperators = ". _[]()" | 22 | false | true | 0 | 4 | 6 | 11 | 6 | 5 | null | null |
romanb/amazonka | amazonka-elastictranscoder/gen/Network/AWS/ElasticTranscoder/Types.hs | mpl-2.0 | -- | The format of album art, if any. Valid formats are '.jpg' and '.png'.
aAlbumArtFormat :: Lens' Artwork (Maybe Text)
aAlbumArtFormat = lens _aAlbumArtFormat (\s a -> s { _aAlbumArtFormat = a }) | 197 | aAlbumArtFormat :: Lens' Artwork (Maybe Text)
aAlbumArtFormat = lens _aAlbumArtFormat (\s a -> s { _aAlbumArtFormat = a }) | 122 | aAlbumArtFormat = lens _aAlbumArtFormat (\s a -> s { _aAlbumArtFormat = a }) | 76 | true | true | 1 | 9 | 33 | 50 | 25 | 25 | null | null |
johnyhlee/baseball-sim | src/Baseball.hs | gpl-2.0 | pctForOutcomeBatter Batter{bPopPct=p} (Contact PopUp) = p | 57 | pctForOutcomeBatter Batter{bPopPct=p} (Contact PopUp) = p | 57 | pctForOutcomeBatter Batter{bPopPct=p} (Contact PopUp) = p | 57 | false | false | 0 | 8 | 5 | 26 | 13 | 13 | null | null |
Hara-Laboratory/subleq-mips | TestRFix2.hs | gpl-3.0 | prop_Srl :: SubleqUWord -> SubleqUWord -> SubleqUWord -> Bool
prop_Srl rd rt sa = [rt', s'] == [rt, s] && rd' == rt `shift` (-(fromIntegral s))
where
s = sa `mod` wordLength
[rd', rt', s'] = map fromIntegral $ executeSubroutine "srl" $ map fromIntegral [rd, rt, s] | 281 | prop_Srl :: SubleqUWord -> SubleqUWord -> SubleqUWord -> Bool
prop_Srl rd rt sa = [rt', s'] == [rt, s] && rd' == rt `shift` (-(fromIntegral s))
where
s = sa `mod` wordLength
[rd', rt', s'] = map fromIntegral $ executeSubroutine "srl" $ map fromIntegral [rd, rt, s] | 281 | prop_Srl rd rt sa = [rt', s'] == [rt, s] && rd' == rt `shift` (-(fromIntegral s))
where
s = sa `mod` wordLength
[rd', rt', s'] = map fromIntegral $ executeSubroutine "srl" $ map fromIntegral [rd, rt, s] | 219 | false | true | 0 | 9 | 63 | 127 | 70 | 57 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F32.hs | bsd-3-clause | ptr_glViewportIndexedfOES :: FunPtr (GLuint -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ())
ptr_glViewportIndexedfOES = unsafePerformIO $ getCommand "glViewportIndexedfOES" | 178 | ptr_glViewportIndexedfOES :: FunPtr (GLuint -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> IO ())
ptr_glViewportIndexedfOES = unsafePerformIO $ getCommand "glViewportIndexedfOES" | 178 | ptr_glViewportIndexedfOES = unsafePerformIO $ getCommand "glViewportIndexedfOES" | 80 | false | true | 0 | 13 | 20 | 49 | 24 | 25 | null | null |
athanclark/sets | src/Data/Set/Unordered/Unique.hs | mit | -- | /O(n)/ - Guaranteed to be disjoint
partition :: (a -> Bool) -> UUSet a -> (UUSet a, UUSet a)
partition p (UUSet xs) = let (l,r) = List.partition p xs in (UUSet l, UUSet r) | 176 | partition :: (a -> Bool) -> UUSet a -> (UUSet a, UUSet a)
partition p (UUSet xs) = let (l,r) = List.partition p xs in (UUSet l, UUSet r) | 136 | partition p (UUSet xs) = let (l,r) = List.partition p xs in (UUSet l, UUSet r) | 78 | true | true | 0 | 10 | 36 | 90 | 45 | 45 | null | null |
jkarni/blog | src/site.hs | mit | -- | Change some of the default configuration variables. This makes our
-- project working directory a little cleaner.
hakyllConfig :: Configuration
hakyllConfig = def { providerDirectory = "preprocessed-site"
, storeDirectory = ".hakyll-cache"
, tmpDirectory = ".hakyll-cache/tmp"
, destinationDirectory = "generated-site"
} | 402 | hakyllConfig :: Configuration
hakyllConfig = def { providerDirectory = "preprocessed-site"
, storeDirectory = ".hakyll-cache"
, tmpDirectory = ".hakyll-cache/tmp"
, destinationDirectory = "generated-site"
} | 282 | hakyllConfig = def { providerDirectory = "preprocessed-site"
, storeDirectory = ".hakyll-cache"
, tmpDirectory = ".hakyll-cache/tmp"
, destinationDirectory = "generated-site"
} | 252 | true | true | 0 | 7 | 118 | 49 | 27 | 22 | null | null |
iemxblog/hpcb | src/Hpcb/Data/Effects.hs | mit | -- | Modifies the size of a font.
-- This function is used by the 'Parameterized' typeclass.
fontSizeE :: (Float, Float) -- ^ New size
-> Effects
-> Effects
fontSizeE si (Effects (Font _ th st) d) = Effects (Font si th st) d | 248 | fontSizeE :: (Float, Float) -- ^ New size
-> Effects
-> Effects
fontSizeE si (Effects (Font _ th st) d) = Effects (Font si th st) d | 155 | fontSizeE si (Effects (Font _ th st) d) = Effects (Font si th st) d | 67 | true | true | 0 | 9 | 67 | 66 | 35 | 31 | null | null |
astynax/enhask | draft.hs | mit | -- [colOrVal val]
-- | sets the value of a form input (text,select,checkbox,etc...)
-- format (at node (setFormInput value))
setFormInput = undefined | 150 | setFormInput = undefined | 24 | setFormInput = undefined | 24 | true | false | 1 | 5 | 22 | 13 | 6 | 7 | null | null |
arcticmatt/happy-site | src/SqlTable.hs | bsd-3-clause | insertItemQ :: Query
insertItemQ = "INSERT INTO items VALUES (?, ?)" | 68 | insertItemQ :: Query
insertItemQ = "INSERT INTO items VALUES (?, ?)" | 68 | insertItemQ = "INSERT INTO items VALUES (?, ?)" | 47 | false | true | 0 | 4 | 10 | 11 | 6 | 5 | null | null |
klarh/hasdy | src/Hasdy/Vectors.hs | apache-2.0 | scale3' s v = pure3' s `times3'` v | 34 | scale3' s v = pure3' s `times3'` v | 34 | scale3' s v = pure3' s `times3'` v | 34 | false | false | 0 | 6 | 7 | 20 | 10 | 10 | null | null |
green-haskell/ghc | libraries/base/Data/OldList.hs | bsd-3-clause | zipWith5 _ _ _ _ _ _ = [] | 28 | zipWith5 _ _ _ _ _ _ = [] | 28 | zipWith5 _ _ _ _ _ _ = [] | 28 | false | false | 0 | 5 | 11 | 21 | 10 | 11 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/NV/TextureShader.hs | bsd-3-clause | gl_DSDT8 :: GLenum
gl_DSDT8 = 0x8709 | 36 | gl_DSDT8 :: GLenum
gl_DSDT8 = 0x8709 | 36 | gl_DSDT8 = 0x8709 | 17 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
ekohl/ganeti | htools/Ganeti/HTools/Node.hs | gpl-2.0 | -- * Initialization functions
-- | Create a new node.
--
-- The index and the peers maps are empty, and will be need to be
-- update later via the 'setIdx' and 'buildPeers' functions.
create :: String -> Double -> Int -> Int -> Double
-> Int -> Double -> Bool -> T.Gdx -> Node
create name_init mem_t_init mem_n_init mem_f_init
dsk_t_init dsk_f_init cpu_t_init offline_init group_init =
Node { name = name_init
, alias = name_init
, tMem = mem_t_init
, nMem = mem_n_init
, fMem = mem_f_init
, tDsk = dsk_t_init
, fDsk = dsk_f_init
, tCpu = cpu_t_init
, uCpu = 0
, pList = []
, sList = []
, failN1 = True
, idx = -1
, peers = P.empty
, rMem = 0
, pMem = fromIntegral mem_f_init / mem_t_init
, pDsk = fromIntegral dsk_f_init / dsk_t_init
, pRem = 0
, pCpu = 0
, offline = offline_init
, xMem = 0
, mDsk = T.defReservedDiskRatio
, mCpu = T.defVcpuRatio
, loDsk = mDskToloDsk T.defReservedDiskRatio dsk_t_init
, hiCpu = mCpuTohiCpu T.defVcpuRatio cpu_t_init
, utilPool = T.baseUtil
, utilLoad = T.zeroUtil
, pTags = Map.empty
, group = group_init
} | 1,323 | create :: String -> Double -> Int -> Int -> Double
-> Int -> Double -> Bool -> T.Gdx -> Node
create name_init mem_t_init mem_n_init mem_f_init
dsk_t_init dsk_f_init cpu_t_init offline_init group_init =
Node { name = name_init
, alias = name_init
, tMem = mem_t_init
, nMem = mem_n_init
, fMem = mem_f_init
, tDsk = dsk_t_init
, fDsk = dsk_f_init
, tCpu = cpu_t_init
, uCpu = 0
, pList = []
, sList = []
, failN1 = True
, idx = -1
, peers = P.empty
, rMem = 0
, pMem = fromIntegral mem_f_init / mem_t_init
, pDsk = fromIntegral dsk_f_init / dsk_t_init
, pRem = 0
, pCpu = 0
, offline = offline_init
, xMem = 0
, mDsk = T.defReservedDiskRatio
, mCpu = T.defVcpuRatio
, loDsk = mDskToloDsk T.defReservedDiskRatio dsk_t_init
, hiCpu = mCpuTohiCpu T.defVcpuRatio cpu_t_init
, utilPool = T.baseUtil
, utilLoad = T.zeroUtil
, pTags = Map.empty
, group = group_init
} | 1,138 | create name_init mem_t_init mem_n_init mem_f_init
dsk_t_init dsk_f_init cpu_t_init offline_init group_init =
Node { name = name_init
, alias = name_init
, tMem = mem_t_init
, nMem = mem_n_init
, fMem = mem_f_init
, tDsk = dsk_t_init
, fDsk = dsk_f_init
, tCpu = cpu_t_init
, uCpu = 0
, pList = []
, sList = []
, failN1 = True
, idx = -1
, peers = P.empty
, rMem = 0
, pMem = fromIntegral mem_f_init / mem_t_init
, pDsk = fromIntegral dsk_f_init / dsk_t_init
, pRem = 0
, pCpu = 0
, offline = offline_init
, xMem = 0
, mDsk = T.defReservedDiskRatio
, mCpu = T.defVcpuRatio
, loDsk = mDskToloDsk T.defReservedDiskRatio dsk_t_init
, hiCpu = mCpuTohiCpu T.defVcpuRatio cpu_t_init
, utilPool = T.baseUtil
, utilLoad = T.zeroUtil
, pTags = Map.empty
, group = group_init
} | 1,038 | true | true | 0 | 15 | 474 | 304 | 179 | 125 | null | null |
treeowl/machines | src/Data/Machine/Type.hs | bsd-3-clause | runT_ :: Monad m => MachineT m k b -> m ()
runT_ m = runMachineT m >>= \v -> case v of
Stop -> return ()
Yield _ k -> runT_ k
Await _ _ e -> runT_ e
-- | Stop feeding input into model and extract an answer | 221 | runT_ :: Monad m => MachineT m k b -> m ()
runT_ m = runMachineT m >>= \v -> case v of
Stop -> return ()
Yield _ k -> runT_ k
Await _ _ e -> runT_ e
-- | Stop feeding input into model and extract an answer | 221 | runT_ m = runMachineT m >>= \v -> case v of
Stop -> return ()
Yield _ k -> runT_ k
Await _ _ e -> runT_ e
-- | Stop feeding input into model and extract an answer | 178 | false | true | 0 | 11 | 66 | 95 | 44 | 51 | null | null |
fmthoma/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | tcSplitFunTysN
:: TcRhoType
-> Arity -- N: Number of desired args
-> ([TcSigmaType], -- Arg types (N or fewer)
TcSigmaType) -- The rest of the type
tcSplitFunTysN ty n_args
| n_args == 0
= ([], ty)
| Just (arg,res) <- tcSplitFunTy_maybe ty
= case tcSplitFunTysN res (n_args - 1) of
(args, res) -> (arg:args, res)
| otherwise
= ([], ty) | 419 | tcSplitFunTysN
:: TcRhoType
-> Arity -- N: Number of desired args
-> ([TcSigmaType], -- Arg types (N or fewer)
TcSigmaType)
tcSplitFunTysN ty n_args
| n_args == 0
= ([], ty)
| Just (arg,res) <- tcSplitFunTy_maybe ty
= case tcSplitFunTysN res (n_args - 1) of
(args, res) -> (arg:args, res)
| otherwise
= ([], ty) | 387 | tcSplitFunTysN ty n_args
| n_args == 0
= ([], ty)
| Just (arg,res) <- tcSplitFunTy_maybe ty
= case tcSplitFunTysN res (n_args - 1) of
(args, res) -> (arg:args, res)
| otherwise
= ([], ty) | 207 | true | true | 0 | 10 | 143 | 145 | 75 | 70 | null | null |
rimmington/cabal | Cabal/Distribution/Simple/Utils.hs | bsd-3-clause | findAllFiles :: (a -> FilePath) -> [a] -> IO [a]
findAllFiles file = filterM (doesFileExist . file) | 99 | findAllFiles :: (a -> FilePath) -> [a] -> IO [a]
findAllFiles file = filterM (doesFileExist . file) | 99 | findAllFiles file = filterM (doesFileExist . file) | 50 | false | true | 0 | 8 | 16 | 48 | 25 | 23 | null | null |
gilith/hol | src/HOL/Const.hs | mit | bit0Name :: Name
bit0Name = Name naturalNamespace "bit0" | 56 | bit0Name :: Name
bit0Name = Name naturalNamespace "bit0" | 56 | bit0Name = Name naturalNamespace "bit0" | 39 | false | true | 0 | 5 | 7 | 16 | 8 | 8 | null | null |
ezrakilty/narc | Database/Narc/TypeInfer.hs | bsd-2-clause | tyCheck env (Singleton m, _) =
do (tySubst, m'@(_, (mTy))) <- tyCheck env m
return (tySubst,
(Singleton m', (TList mTy))) | 147 | tyCheck env (Singleton m, _) =
do (tySubst, m'@(_, (mTy))) <- tyCheck env m
return (tySubst,
(Singleton m', (TList mTy))) | 147 | tyCheck env (Singleton m, _) =
do (tySubst, m'@(_, (mTy))) <- tyCheck env m
return (tySubst,
(Singleton m', (TList mTy))) | 147 | false | false | 0 | 11 | 45 | 77 | 41 | 36 | null | null |
573/leksah | src/IDE/Package.hs | gpl-2.0 | executeDebugCommand :: Text -> (C.Sink ToolOutput IDEM ()) -> DebugAction
executeDebugCommand command handler = do
(_, ghci) <- ask
lift $ do
reifyIDE $ \ideR -> do
liftIO $ postGUIAsync $ reflectIDE (do
triggerEventIDE (StatusbarChanged [CompartmentState command, CompartmentBuild True])
return ()) ideR
executeGhciCommand ghci command $ do
reflectIDEI handler ideR
liftIO $ postGUIAsync $ reflectIDE (do
triggerEventIDE (StatusbarChanged [CompartmentState "", CompartmentBuild False])
return ()) ideR
return ()
-- Includes non buildable | 699 | executeDebugCommand :: Text -> (C.Sink ToolOutput IDEM ()) -> DebugAction
executeDebugCommand command handler = do
(_, ghci) <- ask
lift $ do
reifyIDE $ \ideR -> do
liftIO $ postGUIAsync $ reflectIDE (do
triggerEventIDE (StatusbarChanged [CompartmentState command, CompartmentBuild True])
return ()) ideR
executeGhciCommand ghci command $ do
reflectIDEI handler ideR
liftIO $ postGUIAsync $ reflectIDE (do
triggerEventIDE (StatusbarChanged [CompartmentState "", CompartmentBuild False])
return ()) ideR
return ()
-- Includes non buildable | 699 | executeDebugCommand command handler = do
(_, ghci) <- ask
lift $ do
reifyIDE $ \ideR -> do
liftIO $ postGUIAsync $ reflectIDE (do
triggerEventIDE (StatusbarChanged [CompartmentState command, CompartmentBuild True])
return ()) ideR
executeGhciCommand ghci command $ do
reflectIDEI handler ideR
liftIO $ postGUIAsync $ reflectIDE (do
triggerEventIDE (StatusbarChanged [CompartmentState "", CompartmentBuild False])
return ()) ideR
return ()
-- Includes non buildable | 625 | false | true | 0 | 27 | 231 | 206 | 94 | 112 | null | null |
keithodulaigh/Hets | OWL2/XMLKeywords.hs | gpl-2.0 | objectAllValuesFromK :: String
objectAllValuesFromK = "ObjectAllValuesFrom" | 75 | objectAllValuesFromK :: String
objectAllValuesFromK = "ObjectAllValuesFrom" | 75 | objectAllValuesFromK = "ObjectAllValuesFrom" | 44 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ulricha/dsh | src/Database/DSH/SL/Opt/Properties/VectorType.hs | bsd-3-clause | inferVectorTypeBinOp :: VectorProp VectorType -> VectorProp VectorType -> BinOp -> Either String (VectorProp VectorType)
inferVectorTypeBinOp s1 s2 op =
case op of
Fold _ -> return $ VProp $ VTDataVec 1
ReplicateNest -> do
VTDataVec w1 <- unpack s1
VTDataVec w2 <- unpack s2
return $ VPropPair (VTDataVec $ w1 + w2) VTNA
ReplicateScalar -> do
VTDataVec w1 <- unpack s1
VTDataVec w2 <- unpack s2
return $ VPropPair (VTDataVec $ w1 + w2) VTNA
AppRep -> liftM2 VPropPair (unpack s2) (Right VTNA)
AppSort -> liftM2 VPropPair (unpack s2) (Right VTNA)
AppFilter -> liftM2 VPropPair (unpack s2) (Right VTNA)
AppKey -> liftM2 VPropPair (unpack s2) (Right VTNA)
Append ->
case (s1, s2) of
(VProp (VTDataVec w1), VProp (VTDataVec w2)) | w1 == w2 ->
Right $ VPropTriple (VTDataVec w1) VTNA VTNA
(VProp (VTDataVec w1), VProp (VTDataVec w2)) ->
Left $ "Inputs of Append do not have the same width " ++ (show w1) ++ " " ++ (show w2)
v ->
Left $ "Input of Append is not a VTDataVec " ++ (show v)
Align ->
case (s1, s2) of
(VProp (VTDataVec w1), VProp (VTDataVec w2)) -> Right $ VProp $ VTDataVec $ w1 + w2
_ -> Left "Inputs of Align are not VTDataVecs"
Zip -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "ZipL"
CartProduct -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "CartProductS"
ReplicateVector -> reqValVectors s1 s2 (\w1 _ -> VPropPair (VTDataVec w1 ) VTNA) "ReplicateVector"
UnboxSng -> reqValVectors s1 s2 (\w1 w2 -> VPropPair (VTDataVec $ w1 + w2) VTNA) "UnboxSng"
UnboxDefault _ -> reqValVectors s1 s2 (\w1 w2 -> VProp (VTDataVec $ w1 + w2) VTNA) "UnboxDefault"
ThetaJoin _ -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "ThetaJoinS"
NestJoin _ -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "NestJoinS"
GroupJoin (_, as) -> do
VTDataVec w <- unpack s1
return $ VProp $ VTDataVec (w + length (getNE as))
SemiJoin _ -> liftM2 VPropPair (unpack s1) (Right VTNA)
AntiJoin _ -> liftM2 VPropPair (unpack s1) (Right VTNA) | 2,314 | inferVectorTypeBinOp :: VectorProp VectorType -> VectorProp VectorType -> BinOp -> Either String (VectorProp VectorType)
inferVectorTypeBinOp s1 s2 op =
case op of
Fold _ -> return $ VProp $ VTDataVec 1
ReplicateNest -> do
VTDataVec w1 <- unpack s1
VTDataVec w2 <- unpack s2
return $ VPropPair (VTDataVec $ w1 + w2) VTNA
ReplicateScalar -> do
VTDataVec w1 <- unpack s1
VTDataVec w2 <- unpack s2
return $ VPropPair (VTDataVec $ w1 + w2) VTNA
AppRep -> liftM2 VPropPair (unpack s2) (Right VTNA)
AppSort -> liftM2 VPropPair (unpack s2) (Right VTNA)
AppFilter -> liftM2 VPropPair (unpack s2) (Right VTNA)
AppKey -> liftM2 VPropPair (unpack s2) (Right VTNA)
Append ->
case (s1, s2) of
(VProp (VTDataVec w1), VProp (VTDataVec w2)) | w1 == w2 ->
Right $ VPropTriple (VTDataVec w1) VTNA VTNA
(VProp (VTDataVec w1), VProp (VTDataVec w2)) ->
Left $ "Inputs of Append do not have the same width " ++ (show w1) ++ " " ++ (show w2)
v ->
Left $ "Input of Append is not a VTDataVec " ++ (show v)
Align ->
case (s1, s2) of
(VProp (VTDataVec w1), VProp (VTDataVec w2)) -> Right $ VProp $ VTDataVec $ w1 + w2
_ -> Left "Inputs of Align are not VTDataVecs"
Zip -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "ZipL"
CartProduct -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "CartProductS"
ReplicateVector -> reqValVectors s1 s2 (\w1 _ -> VPropPair (VTDataVec w1 ) VTNA) "ReplicateVector"
UnboxSng -> reqValVectors s1 s2 (\w1 w2 -> VPropPair (VTDataVec $ w1 + w2) VTNA) "UnboxSng"
UnboxDefault _ -> reqValVectors s1 s2 (\w1 w2 -> VProp (VTDataVec $ w1 + w2) VTNA) "UnboxDefault"
ThetaJoin _ -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "ThetaJoinS"
NestJoin _ -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "NestJoinS"
GroupJoin (_, as) -> do
VTDataVec w <- unpack s1
return $ VProp $ VTDataVec (w + length (getNE as))
SemiJoin _ -> liftM2 VPropPair (unpack s1) (Right VTNA)
AntiJoin _ -> liftM2 VPropPair (unpack s1) (Right VTNA) | 2,314 | inferVectorTypeBinOp s1 s2 op =
case op of
Fold _ -> return $ VProp $ VTDataVec 1
ReplicateNest -> do
VTDataVec w1 <- unpack s1
VTDataVec w2 <- unpack s2
return $ VPropPair (VTDataVec $ w1 + w2) VTNA
ReplicateScalar -> do
VTDataVec w1 <- unpack s1
VTDataVec w2 <- unpack s2
return $ VPropPair (VTDataVec $ w1 + w2) VTNA
AppRep -> liftM2 VPropPair (unpack s2) (Right VTNA)
AppSort -> liftM2 VPropPair (unpack s2) (Right VTNA)
AppFilter -> liftM2 VPropPair (unpack s2) (Right VTNA)
AppKey -> liftM2 VPropPair (unpack s2) (Right VTNA)
Append ->
case (s1, s2) of
(VProp (VTDataVec w1), VProp (VTDataVec w2)) | w1 == w2 ->
Right $ VPropTriple (VTDataVec w1) VTNA VTNA
(VProp (VTDataVec w1), VProp (VTDataVec w2)) ->
Left $ "Inputs of Append do not have the same width " ++ (show w1) ++ " " ++ (show w2)
v ->
Left $ "Input of Append is not a VTDataVec " ++ (show v)
Align ->
case (s1, s2) of
(VProp (VTDataVec w1), VProp (VTDataVec w2)) -> Right $ VProp $ VTDataVec $ w1 + w2
_ -> Left "Inputs of Align are not VTDataVecs"
Zip -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "ZipL"
CartProduct -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "CartProductS"
ReplicateVector -> reqValVectors s1 s2 (\w1 _ -> VPropPair (VTDataVec w1 ) VTNA) "ReplicateVector"
UnboxSng -> reqValVectors s1 s2 (\w1 w2 -> VPropPair (VTDataVec $ w1 + w2) VTNA) "UnboxSng"
UnboxDefault _ -> reqValVectors s1 s2 (\w1 w2 -> VProp (VTDataVec $ w1 + w2) VTNA) "UnboxDefault"
ThetaJoin _ -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "ThetaJoinS"
NestJoin _ -> reqValVectors s1 s2 (\w1 w2 -> VPropTriple (VTDataVec $ w1 + w2) VTNA VTNA) "NestJoinS"
GroupJoin (_, as) -> do
VTDataVec w <- unpack s1
return $ VProp $ VTDataVec (w + length (getNE as))
SemiJoin _ -> liftM2 VPropPair (unpack s1) (Right VTNA)
AntiJoin _ -> liftM2 VPropPair (unpack s1) (Right VTNA) | 2,193 | false | true | 27 | 14 | 633 | 907 | 437 | 470 | null | null |
input-output-hk/pos-haskell-prototype | chain/src/Pos/Chain/Ssc/Functions.hs | mit | ----------------------------------------------------------------------------
-- SscPayload Part
----------------------------------------------------------------------------
-- CHECK: @verifySscPayload
-- Verify payload using header containing this payload.
--
-- For each DS datum we check:
--
-- 1. Whether it's stored in the correct block (e.g. commitments have to be
-- in first 2 * blkSecurityParam blocks, etc.)
--
-- 2. Whether the message itself is correct (e.g. commitment signature is
-- valid, etc.)
--
-- We also do some general sanity checks.
verifySscPayload
:: MonadError SscVerifyError m
=> Genesis.Config -> Either EpochIndex (Some IsMainHeader) -> SscPayload -> m ()
verifySscPayload genesisConfig eoh payload = case payload of
CommitmentsPayload comms certs -> do
whenHeader eoh isComm
commChecks comms
certsChecks certs
OpeningsPayload _ certs -> do
whenHeader eoh isOpen
certsChecks certs
SharesPayload _ certs -> do
whenHeader eoh isShare
certsChecks certs
CertificatesPayload certs -> do
whenHeader eoh isOther
certsChecks certs
where
whenHeader (Left _) _ = pass
whenHeader (Right header) f = f $ header ^. headerSlotL
epochId = either identity (view $ headerSlotL . to siEpoch) eoh
pc = configProtocolConstants genesisConfig
k = pcBlkSecurityParam pc
isComm slotId = unless (isCommitmentId k slotId) $ throwError $ NotCommitmentPhase slotId
isOpen slotId = unless (isOpeningId k slotId) $ throwError $ NotOpeningPhase slotId
isShare slotId = unless (isSharesId k slotId) $ throwError $ NotSharesPhase slotId
isOther slotId = unless (all not $
map ($ slotId) [isCommitmentId k, isOpeningId k, isSharesId k]) $
throwError $ NotIntermediatePhase slotId
-- We *forbid* blocks from having commitments/openings/shares in blocks
-- with wrong slotId (instead of merely discarding such commitments/etc)
-- because it's the miner's responsibility not to include them into the
-- block if they're late.
--
-- CHECK: For commitments specifically, we also
--
-- * check there are only commitments in the block
-- * use verifySignedCommitment, which checks commitments themselves,
-- e.g. checks their signatures (which includes checking that the
-- commitment has been generated for this particular epoch)
--
-- #verifySignedCommitment
commChecks commitments = do
let checkComm = isVerSuccess . verifySignedCommitment
(configProtocolMagic genesisConfig)
epochId
verifyEntriesGuardM fst snd CommitmentInvalid
(pure . checkComm)
(HM.toList . getCommitmentsMap $ commitments)
-- CHECK: Vss certificates checker
--
-- * VSS certificates are signed properly
-- * VSS certificates have valid TTLs
--
-- #checkCert
certsChecks certs =
verifyEntriesGuardM identity identity CertificateInvalidTTL
(pure . checkCertTTL pc epochId)
(toList certs)
----------------------------------------------------------------------------
-- Modern
---------------------------------------------------------------------------- | 3,405 | verifySscPayload
:: MonadError SscVerifyError m
=> Genesis.Config -> Either EpochIndex (Some IsMainHeader) -> SscPayload -> m ()
verifySscPayload genesisConfig eoh payload = case payload of
CommitmentsPayload comms certs -> do
whenHeader eoh isComm
commChecks comms
certsChecks certs
OpeningsPayload _ certs -> do
whenHeader eoh isOpen
certsChecks certs
SharesPayload _ certs -> do
whenHeader eoh isShare
certsChecks certs
CertificatesPayload certs -> do
whenHeader eoh isOther
certsChecks certs
where
whenHeader (Left _) _ = pass
whenHeader (Right header) f = f $ header ^. headerSlotL
epochId = either identity (view $ headerSlotL . to siEpoch) eoh
pc = configProtocolConstants genesisConfig
k = pcBlkSecurityParam pc
isComm slotId = unless (isCommitmentId k slotId) $ throwError $ NotCommitmentPhase slotId
isOpen slotId = unless (isOpeningId k slotId) $ throwError $ NotOpeningPhase slotId
isShare slotId = unless (isSharesId k slotId) $ throwError $ NotSharesPhase slotId
isOther slotId = unless (all not $
map ($ slotId) [isCommitmentId k, isOpeningId k, isSharesId k]) $
throwError $ NotIntermediatePhase slotId
-- We *forbid* blocks from having commitments/openings/shares in blocks
-- with wrong slotId (instead of merely discarding such commitments/etc)
-- because it's the miner's responsibility not to include them into the
-- block if they're late.
--
-- CHECK: For commitments specifically, we also
--
-- * check there are only commitments in the block
-- * use verifySignedCommitment, which checks commitments themselves,
-- e.g. checks their signatures (which includes checking that the
-- commitment has been generated for this particular epoch)
--
-- #verifySignedCommitment
commChecks commitments = do
let checkComm = isVerSuccess . verifySignedCommitment
(configProtocolMagic genesisConfig)
epochId
verifyEntriesGuardM fst snd CommitmentInvalid
(pure . checkComm)
(HM.toList . getCommitmentsMap $ commitments)
-- CHECK: Vss certificates checker
--
-- * VSS certificates are signed properly
-- * VSS certificates have valid TTLs
--
-- #checkCert
certsChecks certs =
verifyEntriesGuardM identity identity CertificateInvalidTTL
(pure . checkCertTTL pc epochId)
(toList certs)
----------------------------------------------------------------------------
-- Modern
---------------------------------------------------------------------------- | 2,835 | verifySscPayload genesisConfig eoh payload = case payload of
CommitmentsPayload comms certs -> do
whenHeader eoh isComm
commChecks comms
certsChecks certs
OpeningsPayload _ certs -> do
whenHeader eoh isOpen
certsChecks certs
SharesPayload _ certs -> do
whenHeader eoh isShare
certsChecks certs
CertificatesPayload certs -> do
whenHeader eoh isOther
certsChecks certs
where
whenHeader (Left _) _ = pass
whenHeader (Right header) f = f $ header ^. headerSlotL
epochId = either identity (view $ headerSlotL . to siEpoch) eoh
pc = configProtocolConstants genesisConfig
k = pcBlkSecurityParam pc
isComm slotId = unless (isCommitmentId k slotId) $ throwError $ NotCommitmentPhase slotId
isOpen slotId = unless (isOpeningId k slotId) $ throwError $ NotOpeningPhase slotId
isShare slotId = unless (isSharesId k slotId) $ throwError $ NotSharesPhase slotId
isOther slotId = unless (all not $
map ($ slotId) [isCommitmentId k, isOpeningId k, isSharesId k]) $
throwError $ NotIntermediatePhase slotId
-- We *forbid* blocks from having commitments/openings/shares in blocks
-- with wrong slotId (instead of merely discarding such commitments/etc)
-- because it's the miner's responsibility not to include them into the
-- block if they're late.
--
-- CHECK: For commitments specifically, we also
--
-- * check there are only commitments in the block
-- * use verifySignedCommitment, which checks commitments themselves,
-- e.g. checks their signatures (which includes checking that the
-- commitment has been generated for this particular epoch)
--
-- #verifySignedCommitment
commChecks commitments = do
let checkComm = isVerSuccess . verifySignedCommitment
(configProtocolMagic genesisConfig)
epochId
verifyEntriesGuardM fst snd CommitmentInvalid
(pure . checkComm)
(HM.toList . getCommitmentsMap $ commitments)
-- CHECK: Vss certificates checker
--
-- * VSS certificates are signed properly
-- * VSS certificates have valid TTLs
--
-- #checkCert
certsChecks certs =
verifyEntriesGuardM identity identity CertificateInvalidTTL
(pure . checkCertTTL pc epochId)
(toList certs)
----------------------------------------------------------------------------
-- Modern
---------------------------------------------------------------------------- | 2,698 | true | true | 1 | 13 | 875 | 544 | 271 | 273 | null | null |
eigengrau/stylish-haskell | src/Language/Haskell/Stylish/Config.hs | bsd-3-clause | --------------------------------------------------------------------------------
configFileName :: String
configFileName = ".stylish-haskell.yaml" | 146 | configFileName :: String
configFileName = ".stylish-haskell.yaml" | 65 | configFileName = ".stylish-haskell.yaml" | 40 | true | true | 0 | 6 | 6 | 19 | 8 | 11 | null | null |
ciderpunx/57-exercises-for-programmers | src/P19BMI.hs | gpl-3.0 | toPounds :: Weight -> Weight
toPounds (Kilograms k) = Pounds (k*2.205) | 70 | toPounds :: Weight -> Weight
toPounds (Kilograms k) = Pounds (k*2.205) | 70 | toPounds (Kilograms k) = Pounds (k*2.205) | 41 | false | true | 0 | 7 | 10 | 34 | 17 | 17 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/RegionCommitments/Insert.hs | mpl-2.0 | -- | Name of the region for this request.
rciRegion :: Lens' RegionCommitmentsInsert Text
rciRegion
= lens _rciRegion (\ s a -> s{_rciRegion = a}) | 148 | rciRegion :: Lens' RegionCommitmentsInsert Text
rciRegion
= lens _rciRegion (\ s a -> s{_rciRegion = a}) | 106 | rciRegion
= lens _rciRegion (\ s a -> s{_rciRegion = a}) | 58 | true | true | 1 | 9 | 26 | 46 | 22 | 24 | null | null |
haskellGardener/yusic | src/Yusic.hs | mit | toKeyGuide (C:D:G :[]) = Just KG_CSus2 | 58 | toKeyGuide (C:D:G :[]) = Just KG_CSus2 | 58 | toKeyGuide (C:D:G :[]) = Just KG_CSus2 | 58 | false | false | 0 | 10 | 25 | 29 | 14 | 15 | null | null |
AlexeyRaga/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | rightDataConKey = mkPreludeDataConUnique 26 | 67 | rightDataConKey = mkPreludeDataConUnique 26 | 67 | rightDataConKey = mkPreludeDataConUnique 26 | 67 | false | false | 0 | 5 | 27 | 9 | 4 | 5 | null | null |
mpitid/scheme48 | src/Scheme48/Interpreter.hs | mit | readProc [Port port] = (liftIO $ hGetLine port) >>= liftThrows . readExpr | 73 | readProc [Port port] = (liftIO $ hGetLine port) >>= liftThrows . readExpr | 73 | readProc [Port port] = (liftIO $ hGetLine port) >>= liftThrows . readExpr | 73 | false | false | 0 | 9 | 11 | 33 | 16 | 17 | null | null |
Callidon/toolkit | haskell/main.hs | mit | doubleUs x y = x*2 + y*2 | 24 | doubleUs x y = x*2 + y*2 | 24 | doubleUs x y = x*2 + y*2 | 24 | false | false | 0 | 7 | 6 | 23 | 11 | 12 | null | null |
mvr/at | src/Math/Topology/SGrp/Wbar.hs | bsd-3-clause | normalise g (s : ss) | isUnit g s = degen (normalise g ss) 0 | 60 | normalise g (s : ss) | isUnit g s = degen (normalise g ss) 0 | 60 | normalise g (s : ss) | isUnit g s = degen (normalise g ss) 0 | 60 | false | false | 0 | 8 | 14 | 44 | 19 | 25 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/topic/general/wiki-haskell-org-99-questions/X99Questions.hs | unlicense | flatten (List xs) = flatten (head xs) ++ flatten (List (tail xs)) | 65 | flatten (List xs) = flatten (head xs) ++ flatten (List (tail xs)) | 65 | flatten (List xs) = flatten (head xs) ++ flatten (List (tail xs)) | 65 | false | false | 0 | 10 | 11 | 44 | 20 | 24 | null | null |
mariefarrell/Hets | GMP/GMP-CoLoSS/GMP/Logics/SysS.hs | gpl-2.0 | pretty_c :: (Feature SysS (a (b c))) => ([Int], [(Int, Int)], [Formula (SysS (a (b c)))]) -> String
pretty_c (worlds, rel, seq) = show worlds ++ show rel ++ pretty_list seq | 172 | pretty_c :: (Feature SysS (a (b c))) => ([Int], [(Int, Int)], [Formula (SysS (a (b c)))]) -> String
pretty_c (worlds, rel, seq) = show worlds ++ show rel ++ pretty_list seq | 172 | pretty_c (worlds, rel, seq) = show worlds ++ show rel ++ pretty_list seq | 72 | false | true | 0 | 15 | 30 | 112 | 60 | 52 | null | null |
oahziur/yige-pass | src/View.hs | bsd-3-clause | view :: [String] -> IO ()
view [fileName] = view [fileName, ""] | 63 | view :: [String] -> IO ()
view [fileName] = view [fileName, ""] | 63 | view [fileName] = view [fileName, ""] | 37 | false | true | 0 | 7 | 11 | 42 | 21 | 21 | null | null |
plaprade/haskoin | haskoin-node/test/Network/Haskoin/Node/Units.hs | unlicense | forkNodeSameChain :: App ()
forkNodeSameChain = mockBlockChain >> do
let l = chain3 !! 5
r = chain3 !! 3
height <- nodeBlockHeight <$> splitBlock l r
splitM <- getBlockByHeight r height
liftIO $ assertEqual "Fork node is correct" (Just $ chain3 !! 3) splitM | 281 | forkNodeSameChain :: App ()
forkNodeSameChain = mockBlockChain >> do
let l = chain3 !! 5
r = chain3 !! 3
height <- nodeBlockHeight <$> splitBlock l r
splitM <- getBlockByHeight r height
liftIO $ assertEqual "Fork node is correct" (Just $ chain3 !! 3) splitM | 281 | forkNodeSameChain = mockBlockChain >> do
let l = chain3 !! 5
r = chain3 !! 3
height <- nodeBlockHeight <$> splitBlock l r
splitM <- getBlockByHeight r height
liftIO $ assertEqual "Fork node is correct" (Just $ chain3 !! 3) splitM | 253 | false | true | 1 | 13 | 68 | 99 | 45 | 54 | null | null |
sergv/tags-server | tests/Haskell/Language/Server/Tags/AnalyzeHeaderTests.hs | bsd-3-clause | moduleWithExportsOfSpeciallyNamedOperatorsTest :: Test
moduleWithExportsOfSpeciallyNamedOperatorsTest = TestCase
{ testName = "Export of operators with special names"
, input =
"module ModuleWithExport ((.), (!), (~), (.+.), (Test..||.)) where"
, expectedResult = ModuleHeader
{ mhModName = mkModuleName "ModuleWithExport"
, mhExports = SpecificExports ModuleExports
{ meExportedEntries = KM.fromList
[ EntryWithChildren
{ entryName = (mkSymbolName ".", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName "!", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName "~", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName ".+.", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName "Test..||.", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
]
, meReexports = mempty
, meHasWildcardExports = False
}
, mhImportQualifiers = mempty
, mhImports = mempty
}
} | 1,615 | moduleWithExportsOfSpeciallyNamedOperatorsTest :: Test
moduleWithExportsOfSpeciallyNamedOperatorsTest = TestCase
{ testName = "Export of operators with special names"
, input =
"module ModuleWithExport ((.), (!), (~), (.+.), (Test..||.)) where"
, expectedResult = ModuleHeader
{ mhModName = mkModuleName "ModuleWithExport"
, mhExports = SpecificExports ModuleExports
{ meExportedEntries = KM.fromList
[ EntryWithChildren
{ entryName = (mkSymbolName ".", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName "!", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName "~", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName ".+.", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName "Test..||.", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
]
, meReexports = mempty
, meHasWildcardExports = False
}
, mhImportQualifiers = mempty
, mhImports = mempty
}
} | 1,615 | moduleWithExportsOfSpeciallyNamedOperatorsTest = TestCase
{ testName = "Export of operators with special names"
, input =
"module ModuleWithExport ((.), (!), (~), (.+.), (Test..||.)) where"
, expectedResult = ModuleHeader
{ mhModName = mkModuleName "ModuleWithExport"
, mhExports = SpecificExports ModuleExports
{ meExportedEntries = KM.fromList
[ EntryWithChildren
{ entryName = (mkSymbolName ".", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName "!", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName "~", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName ".+.", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
, EntryWithChildren
{ entryName = (mkSymbolName "Test..||.", pt 1 Operator)
, entryChildrenVisibility = Nothing
}
]
, meReexports = mempty
, meHasWildcardExports = False
}
, mhImportQualifiers = mempty
, mhImports = mempty
}
} | 1,560 | false | true | 0 | 18 | 700 | 247 | 144 | 103 | null | null |
Shimuuar/wai-middleware-static | Network/Wai/Middleware/Static.hs | bsd-3-clause | extensions :: FilePath -> [String]
extensions [] = [] | 53 | extensions :: FilePath -> [String]
extensions [] = [] | 53 | extensions [] = [] | 18 | false | true | 0 | 6 | 8 | 29 | 14 | 15 | null | null |
kawu/earley-facile | src/NLP/EarleyFacile/GrammarParser.hs | bsd-2-clause | -- | Parser a String-based representation of a SCFG grammar.
parseSCFG :: String -> SCFG
parseSCFG input = flip E.execState emptyCFG $ do
mapM_ parseLine (lines input)
-- | Parse a single line of the grammar. | 212 | parseSCFG :: String -> SCFG
parseSCFG input = flip E.execState emptyCFG $ do
mapM_ parseLine (lines input)
-- | Parse a single line of the grammar. | 151 | parseSCFG input = flip E.execState emptyCFG $ do
mapM_ parseLine (lines input)
-- | Parse a single line of the grammar. | 123 | true | true | 0 | 10 | 39 | 45 | 22 | 23 | null | null |
Javran/Project-Euler | src/ProjectEuler/Problem34.hs | mit | problem :: Problem
problem = pureProblem 34 Solved result | 57 | problem :: Problem
problem = pureProblem 34 Solved result | 57 | problem = pureProblem 34 Solved result | 38 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
ezyang/ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | nlHsFunTy a b = noLoc (HsFunTy a b) | 45 | nlHsFunTy a b = noLoc (HsFunTy a b) | 45 | nlHsFunTy a b = noLoc (HsFunTy a b) | 45 | false | false | 0 | 7 | 17 | 22 | 10 | 12 | null | null |
kbiscanic/PUH | hw03/CSVUtils.hs | mit | csv = parseCSV ";" doc | 22 | csv = parseCSV ";" doc | 22 | csv = parseCSV ";" doc | 22 | false | false | 1 | 5 | 4 | 14 | 5 | 9 | null | null |
shlevy/ghc | compiler/typecheck/TcPluginM.hs | bsd-3-clause | -- | Create a fresh coercion hole.
newCoercionHole :: PredType -> TcPluginM CoercionHole
newCoercionHole = unsafeTcPluginTcM . TcM.newCoercionHole | 146 | newCoercionHole :: PredType -> TcPluginM CoercionHole
newCoercionHole = unsafeTcPluginTcM . TcM.newCoercionHole | 111 | newCoercionHole = unsafeTcPluginTcM . TcM.newCoercionHole | 57 | true | true | 0 | 7 | 17 | 31 | 14 | 17 | null | null |
bkoropoff/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | tldeclared (PTy _ _ _ _ _ n _ t) = [n] | 38 | tldeclared (PTy _ _ _ _ _ n _ t) = [n] | 38 | tldeclared (PTy _ _ _ _ _ n _ t) = [n] | 38 | false | false | 0 | 7 | 11 | 32 | 16 | 16 | null | null |
sdiehl/ghc | compiler/GHC/Stg/CSE.hs | bsd-3-clause | -- Top level bindings.
--
-- We do not CSE these, as top-level closures are allocated statically anyways.
-- Also, they might be exported.
-- But we still have to collect the set of in-scope variables, otherwise
-- uniqAway might shadow a top-level closure.
stgCseTopLvl :: InScopeSet -> InStgTopBinding -> (InScopeSet, OutStgTopBinding)
stgCseTopLvl in_scope t@(StgTopStringLit _ _) = (in_scope, t) | 400 | stgCseTopLvl :: InScopeSet -> InStgTopBinding -> (InScopeSet, OutStgTopBinding)
stgCseTopLvl in_scope t@(StgTopStringLit _ _) = (in_scope, t) | 141 | stgCseTopLvl in_scope t@(StgTopStringLit _ _) = (in_scope, t) | 61 | true | true | 1 | 10 | 60 | 60 | 33 | 27 | null | null |
toddmohney/flipper | examples/enable-feature-for-a-specific-user/Main.hs | bsd-3-clause | myOtherUser :: User
myOtherUser = User 2 | 40 | myOtherUser :: User
myOtherUser = User 2 | 40 | myOtherUser = User 2 | 20 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
kearnh/HToyRayTracer | src/Ray.hs | bsd-3-clause | reflectAndTransmitDir :: Double -> Double -> Vector3 -> Vector3 -> (Vector3, Vector3)
reflectAndTransmitDir n1 n2 v norm = (rDir, tDir)
where
vdn' = vdot v norm
norm' = if vdn' > 0 then -norm else norm
n1' = if vdn' > 0 then n2 else n1
n2' = if vdn' > 0 then n1 else n2
n1dn2 = n1' / n2'
cosT1 = -vdn'
cosT22 = 1 - (n1dn2**2) * (1 - cosT1**2)
cosT2 = sqrt cosT22
tDir = vnormalise $ if cosT22 >= 0
then if cosT1 > 0
then (n1dn2 |* v) + ((n1dn2*cosT1 - cosT2) |* norm')
else (n1dn2 |* v) + ((n1dn2*cosT1 + cosT2) |* norm')
else rDir -- Total internal reflection
vdn = abs vdn'
rDir = vnormalise $ v + (2*vdn |* norm') | 866 | reflectAndTransmitDir :: Double -> Double -> Vector3 -> Vector3 -> (Vector3, Vector3)
reflectAndTransmitDir n1 n2 v norm = (rDir, tDir)
where
vdn' = vdot v norm
norm' = if vdn' > 0 then -norm else norm
n1' = if vdn' > 0 then n2 else n1
n2' = if vdn' > 0 then n1 else n2
n1dn2 = n1' / n2'
cosT1 = -vdn'
cosT22 = 1 - (n1dn2**2) * (1 - cosT1**2)
cosT2 = sqrt cosT22
tDir = vnormalise $ if cosT22 >= 0
then if cosT1 > 0
then (n1dn2 |* v) + ((n1dn2*cosT1 - cosT2) |* norm')
else (n1dn2 |* v) + ((n1dn2*cosT1 + cosT2) |* norm')
else rDir -- Total internal reflection
vdn = abs vdn'
rDir = vnormalise $ v + (2*vdn |* norm') | 866 | reflectAndTransmitDir n1 n2 v norm = (rDir, tDir)
where
vdn' = vdot v norm
norm' = if vdn' > 0 then -norm else norm
n1' = if vdn' > 0 then n2 else n1
n2' = if vdn' > 0 then n1 else n2
n1dn2 = n1' / n2'
cosT1 = -vdn'
cosT22 = 1 - (n1dn2**2) * (1 - cosT1**2)
cosT2 = sqrt cosT22
tDir = vnormalise $ if cosT22 >= 0
then if cosT1 > 0
then (n1dn2 |* v) + ((n1dn2*cosT1 - cosT2) |* norm')
else (n1dn2 |* v) + ((n1dn2*cosT1 + cosT2) |* norm')
else rDir -- Total internal reflection
vdn = abs vdn'
rDir = vnormalise $ v + (2*vdn |* norm') | 779 | false | true | 10 | 19 | 378 | 308 | 162 | 146 | null | null |
dbp/snaplet-wordpress | spec/Main.hs | bsd-3-clause | cacheTests :: Spec
cacheTests = do
describe "should grab post from cache if it's there" $ do
it "should render the post even w/o json source" $ do
let (Object a2) = article2
ctxt <- liftIO initNoRequestWithCache
wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2001" "10" "the-post")
(enc (WPResponse mempty (enc [a2])))
("single", ctxt) `shouldRenderAtUrlContaining` ("/2001/10/the-post/", "The post")
it "should allow the legacy format (without headers)" $ do
let (Object a2) = article2
ctxt <- liftIO initNoRequestWithCache
wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2001" "10" "the-post")
(enc [a2])
("single", ctxt) `shouldRenderAtUrlContaining` ("/2001/10/the-post/", "The post")
describe "caching" $ do
it "should find nothing for a non-existent post" $ do
ctxt <- initNoRequestWithCache
p <- wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
p `shouldBe` Nothing
it "should find something if there is a post in cache" $ do
ctxt <- initNoRequestWithCache
void $ wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
(enc article1)
p <- wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
p `shouldBe` (Just $ enc article1)
it "should not find single post after expire handler is called" $ do
ctxt <- initNoRequestWithCache
void $ wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
(enc article1)
void $ wpExpirePost' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
>>= shouldBe Nothing
it "should find post aggregates in cache" $
do ctxt <- initNoRequestWithCache
let key = PostsKey (Set.fromList [NumFilter 20, OffsetFilter 0])
void $ wpCacheSet' (view wordpress ctxt) key ("[" <> enc article1 <> "]")
void $ wpCacheGet' (view wordpress ctxt) key
>>= shouldBe (Just $ "[" <> enc article1 <> "]")
it "should find post aggregates (using search and order by) in cache" $
do ctxt <- initNoRequestWithCache
let key = PostsKey (Set.fromList [SearchFilter "some search terms", OrderByFilter "author"])
void $ wpCacheSet' (view wordpress ctxt) key ("[" <> enc article1 <> "]")
void $ wpCacheGet' (view wordpress ctxt) key
>>= shouldBe (Just $ "[" <> enc article1 <> "]")
it "should not find post aggregates after expire handler is called" $
do ctxt <- initNoRequestWithCache
let key = PostsKey (Set.fromList [NumFilter 20, OffsetFilter 0])
void $ wpCacheSet' (view wordpress ctxt) key ("[" <> enc article1 <> "]")
void $ wpExpirePost' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
wpCacheGet' (view wordpress ctxt) key
>>= shouldBe Nothing
it "should find single post after expiring aggregates" $
do ctxt <- initNoRequestWithCache
void $ wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
(enc article1)
void $ wpExpireAggregates' (view wordpress ctxt)
wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
>>= shouldNotBe Nothing
it "should find a different single post after expiring another" $
do ctxt <- initNoRequestWithCache
let key1 = PostByPermalinkKey "2000" "1" "the-article"
key2 = PostByPermalinkKey "2001" "2" "another-article"
void $ wpCacheSet' (view wordpress ctxt) key1 (enc article1)
void $ wpCacheSet' (view wordpress ctxt) key2 (enc article2)
void $ wpExpirePost' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
wpCacheGet' (view wordpress ctxt) key2 >>= shouldBe (Just (enc article2))
it "should be able to cache and retrieve post" $
do ctxt <- initNoRequestWithCache
let key = PostKey 200
wpCacheSet' (view wordpress ctxt) key (enc article1)
wpCacheGet' (view wordpress ctxt) key >>= shouldBe (Just (enc article1)) | 4,460 | cacheTests :: Spec
cacheTests = do
describe "should grab post from cache if it's there" $ do
it "should render the post even w/o json source" $ do
let (Object a2) = article2
ctxt <- liftIO initNoRequestWithCache
wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2001" "10" "the-post")
(enc (WPResponse mempty (enc [a2])))
("single", ctxt) `shouldRenderAtUrlContaining` ("/2001/10/the-post/", "The post")
it "should allow the legacy format (without headers)" $ do
let (Object a2) = article2
ctxt <- liftIO initNoRequestWithCache
wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2001" "10" "the-post")
(enc [a2])
("single", ctxt) `shouldRenderAtUrlContaining` ("/2001/10/the-post/", "The post")
describe "caching" $ do
it "should find nothing for a non-existent post" $ do
ctxt <- initNoRequestWithCache
p <- wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
p `shouldBe` Nothing
it "should find something if there is a post in cache" $ do
ctxt <- initNoRequestWithCache
void $ wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
(enc article1)
p <- wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
p `shouldBe` (Just $ enc article1)
it "should not find single post after expire handler is called" $ do
ctxt <- initNoRequestWithCache
void $ wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
(enc article1)
void $ wpExpirePost' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
>>= shouldBe Nothing
it "should find post aggregates in cache" $
do ctxt <- initNoRequestWithCache
let key = PostsKey (Set.fromList [NumFilter 20, OffsetFilter 0])
void $ wpCacheSet' (view wordpress ctxt) key ("[" <> enc article1 <> "]")
void $ wpCacheGet' (view wordpress ctxt) key
>>= shouldBe (Just $ "[" <> enc article1 <> "]")
it "should find post aggregates (using search and order by) in cache" $
do ctxt <- initNoRequestWithCache
let key = PostsKey (Set.fromList [SearchFilter "some search terms", OrderByFilter "author"])
void $ wpCacheSet' (view wordpress ctxt) key ("[" <> enc article1 <> "]")
void $ wpCacheGet' (view wordpress ctxt) key
>>= shouldBe (Just $ "[" <> enc article1 <> "]")
it "should not find post aggregates after expire handler is called" $
do ctxt <- initNoRequestWithCache
let key = PostsKey (Set.fromList [NumFilter 20, OffsetFilter 0])
void $ wpCacheSet' (view wordpress ctxt) key ("[" <> enc article1 <> "]")
void $ wpExpirePost' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
wpCacheGet' (view wordpress ctxt) key
>>= shouldBe Nothing
it "should find single post after expiring aggregates" $
do ctxt <- initNoRequestWithCache
void $ wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
(enc article1)
void $ wpExpireAggregates' (view wordpress ctxt)
wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
>>= shouldNotBe Nothing
it "should find a different single post after expiring another" $
do ctxt <- initNoRequestWithCache
let key1 = PostByPermalinkKey "2000" "1" "the-article"
key2 = PostByPermalinkKey "2001" "2" "another-article"
void $ wpCacheSet' (view wordpress ctxt) key1 (enc article1)
void $ wpCacheSet' (view wordpress ctxt) key2 (enc article2)
void $ wpExpirePost' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
wpCacheGet' (view wordpress ctxt) key2 >>= shouldBe (Just (enc article2))
it "should be able to cache and retrieve post" $
do ctxt <- initNoRequestWithCache
let key = PostKey 200
wpCacheSet' (view wordpress ctxt) key (enc article1)
wpCacheGet' (view wordpress ctxt) key >>= shouldBe (Just (enc article1)) | 4,460 | cacheTests = do
describe "should grab post from cache if it's there" $ do
it "should render the post even w/o json source" $ do
let (Object a2) = article2
ctxt <- liftIO initNoRequestWithCache
wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2001" "10" "the-post")
(enc (WPResponse mempty (enc [a2])))
("single", ctxt) `shouldRenderAtUrlContaining` ("/2001/10/the-post/", "The post")
it "should allow the legacy format (without headers)" $ do
let (Object a2) = article2
ctxt <- liftIO initNoRequestWithCache
wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2001" "10" "the-post")
(enc [a2])
("single", ctxt) `shouldRenderAtUrlContaining` ("/2001/10/the-post/", "The post")
describe "caching" $ do
it "should find nothing for a non-existent post" $ do
ctxt <- initNoRequestWithCache
p <- wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
p `shouldBe` Nothing
it "should find something if there is a post in cache" $ do
ctxt <- initNoRequestWithCache
void $ wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
(enc article1)
p <- wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
p `shouldBe` (Just $ enc article1)
it "should not find single post after expire handler is called" $ do
ctxt <- initNoRequestWithCache
void $ wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
(enc article1)
void $ wpExpirePost' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
>>= shouldBe Nothing
it "should find post aggregates in cache" $
do ctxt <- initNoRequestWithCache
let key = PostsKey (Set.fromList [NumFilter 20, OffsetFilter 0])
void $ wpCacheSet' (view wordpress ctxt) key ("[" <> enc article1 <> "]")
void $ wpCacheGet' (view wordpress ctxt) key
>>= shouldBe (Just $ "[" <> enc article1 <> "]")
it "should find post aggregates (using search and order by) in cache" $
do ctxt <- initNoRequestWithCache
let key = PostsKey (Set.fromList [SearchFilter "some search terms", OrderByFilter "author"])
void $ wpCacheSet' (view wordpress ctxt) key ("[" <> enc article1 <> "]")
void $ wpCacheGet' (view wordpress ctxt) key
>>= shouldBe (Just $ "[" <> enc article1 <> "]")
it "should not find post aggregates after expire handler is called" $
do ctxt <- initNoRequestWithCache
let key = PostsKey (Set.fromList [NumFilter 20, OffsetFilter 0])
void $ wpCacheSet' (view wordpress ctxt) key ("[" <> enc article1 <> "]")
void $ wpExpirePost' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
wpCacheGet' (view wordpress ctxt) key
>>= shouldBe Nothing
it "should find single post after expiring aggregates" $
do ctxt <- initNoRequestWithCache
void $ wpCacheSet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
(enc article1)
void $ wpExpireAggregates' (view wordpress ctxt)
wpCacheGet' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
>>= shouldNotBe Nothing
it "should find a different single post after expiring another" $
do ctxt <- initNoRequestWithCache
let key1 = PostByPermalinkKey "2000" "1" "the-article"
key2 = PostByPermalinkKey "2001" "2" "another-article"
void $ wpCacheSet' (view wordpress ctxt) key1 (enc article1)
void $ wpCacheSet' (view wordpress ctxt) key2 (enc article2)
void $ wpExpirePost' (view wordpress ctxt) (PostByPermalinkKey "2000" "1" "the-article")
wpCacheGet' (view wordpress ctxt) key2 >>= shouldBe (Just (enc article2))
it "should be able to cache and retrieve post" $
do ctxt <- initNoRequestWithCache
let key = PostKey 200
wpCacheSet' (view wordpress ctxt) key (enc article1)
wpCacheGet' (view wordpress ctxt) key >>= shouldBe (Just (enc article1)) | 4,441 | false | true | 0 | 20 | 1,218 | 1,269 | 588 | 681 | null | null |
urbit/urbit | pkg/hs/urbit-king/test/DeriveNounTests.hs | mit | barZazBaz :: BarZaz -> Bool
barZazBaz = nounEquiv $ \case BZQueenAlice x y -> QueenAlice x y
BZBob x -> Bob x
BZCharlie -> Charlie | 206 | barZazBaz :: BarZaz -> Bool
barZazBaz = nounEquiv $ \case BZQueenAlice x y -> QueenAlice x y
BZBob x -> Bob x
BZCharlie -> Charlie | 206 | barZazBaz = nounEquiv $ \case BZQueenAlice x y -> QueenAlice x y
BZBob x -> Bob x
BZCharlie -> Charlie | 178 | false | true | 0 | 9 | 100 | 55 | 26 | 29 | null | null |
plclub/cis670-16fa | projects/DynamicLang/src/Parser.hs | mit | mapBinOp :: String -> Maybe BinOp
mapBinOp "+" = Just Plus | 58 | mapBinOp :: String -> Maybe BinOp
mapBinOp "+" = Just Plus | 58 | mapBinOp "+" = Just Plus | 24 | false | true | 0 | 6 | 10 | 24 | 11 | 13 | null | null |
deontologician/orbRPG | Game/OrbRPG/Types.hs | gpl-3.0 | dirToStr SE = "southeast" | 25 | dirToStr SE = "southeast" | 25 | dirToStr SE = "southeast" | 25 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
tibbe/ghc | compiler/utils/Binary.hs | bsd-3-clause | getByteArray :: BinHandle -> Int -> IO ByteArray
getByteArray bh (I# sz) = do
(MBA arr) <- newByteArray sz
let loop n
| n ==# sz = return ()
| otherwise = do
w <- getByte bh
writeByteArray arr n w
loop (n +# 1#)
loop 0#
freezeByteArray arr | 317 | getByteArray :: BinHandle -> Int -> IO ByteArray
getByteArray bh (I# sz) = do
(MBA arr) <- newByteArray sz
let loop n
| n ==# sz = return ()
| otherwise = do
w <- getByte bh
writeByteArray arr n w
loop (n +# 1#)
loop 0#
freezeByteArray arr | 317 | getByteArray bh (I# sz) = do
(MBA arr) <- newByteArray sz
let loop n
| n ==# sz = return ()
| otherwise = do
w <- getByte bh
writeByteArray arr n w
loop (n +# 1#)
loop 0#
freezeByteArray arr | 268 | false | true | 0 | 16 | 126 | 135 | 57 | 78 | null | null |
mwahab1/pandoc | src/Text/Pandoc/Writers/Textile.hs | gpl-2.0 | blockToTextile opts (BlockQuote blocks) = do
contents <- blockListToTextile opts blocks
return $ "<blockquote>\n\n" ++ contents ++ "\n</blockquote>\n" | 154 | blockToTextile opts (BlockQuote blocks) = do
contents <- blockListToTextile opts blocks
return $ "<blockquote>\n\n" ++ contents ++ "\n</blockquote>\n" | 154 | blockToTextile opts (BlockQuote blocks) = do
contents <- blockListToTextile opts blocks
return $ "<blockquote>\n\n" ++ contents ++ "\n</blockquote>\n" | 154 | false | false | 0 | 9 | 21 | 46 | 20 | 26 | null | null |
fsestini/stlc-machine | src/Eval.hs | mit | substitution (NLAbstr t) j s = NLAbstr (substitution t (j+1) (shift 1 s)) | 73 | substitution (NLAbstr t) j s = NLAbstr (substitution t (j+1) (shift 1 s)) | 73 | substitution (NLAbstr t) j s = NLAbstr (substitution t (j+1) (shift 1 s)) | 73 | false | false | 0 | 9 | 12 | 47 | 23 | 24 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_TIMEOUT_IGNORED_APPLE :: GLuint64
gl_TIMEOUT_IGNORED_APPLE = 0xFFFFFFFFFFFFFFFF | 82 | gl_TIMEOUT_IGNORED_APPLE :: GLuint64
gl_TIMEOUT_IGNORED_APPLE = 0xFFFFFFFFFFFFFFFF | 82 | gl_TIMEOUT_IGNORED_APPLE = 0xFFFFFFFFFFFFFFFF | 45 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
urbanslug/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | doCopyMutableByteArrayToAddrOp :: CmmExpr -> CmmExpr -> CmmExpr -> CmmExpr
-> FCode ()
doCopyMutableByteArrayToAddrOp = doCopyByteArrayToAddrOp | 174 | doCopyMutableByteArrayToAddrOp :: CmmExpr -> CmmExpr -> CmmExpr -> CmmExpr
-> FCode ()
doCopyMutableByteArrayToAddrOp = doCopyByteArrayToAddrOp | 174 | doCopyMutableByteArrayToAddrOp = doCopyByteArrayToAddrOp | 56 | false | true | 0 | 10 | 45 | 32 | 16 | 16 | null | null |
toonn/haskell-casestt | koopa.hs | bsd-2-clause | p41 = Posy (Sy(Sy(Sy(Sy Zy)))) (Sy Zy) Gasy Lowy | 48 | p41 = Posy (Sy(Sy(Sy(Sy Zy)))) (Sy Zy) Gasy Lowy | 48 | p41 = Posy (Sy(Sy(Sy(Sy Zy)))) (Sy Zy) Gasy Lowy | 48 | false | false | 0 | 13 | 8 | 45 | 22 | 23 | null | null |
massudaw/mtk | Solver/RungeKutta.hs | bsd-3-clause | core1 cl al bl der_fn h old@(tn,yn) = (tn + h, yn |+| (k_sum h bl (gen_ks der_fn h old [] cl al))) | 98 | core1 cl al bl der_fn h old@(tn,yn) = (tn + h, yn |+| (k_sum h bl (gen_ks der_fn h old [] cl al))) | 98 | core1 cl al bl der_fn h old@(tn,yn) = (tn + h, yn |+| (k_sum h bl (gen_ks der_fn h old [] cl al))) | 98 | false | false | 0 | 11 | 22 | 70 | 37 | 33 | null | null |
marcinmrotek/repa-linear-algebra | src/Numeric/LinearAlgebra/Repa.hs | bsd-3-clause | luPIO :: (Field t, Numeric t) => Array D DIM2 t -> IO (Array F DIM2 t, Array F DIM2 t, Array F DIM2 t, t)
luPIO m = do
(l,u,p,s) <- H.lu <$> repa2hmPIO m
return (hm2repa l, hm2repa u, hm2repa p, s) | 201 | luPIO :: (Field t, Numeric t) => Array D DIM2 t -> IO (Array F DIM2 t, Array F DIM2 t, Array F DIM2 t, t)
luPIO m = do
(l,u,p,s) <- H.lu <$> repa2hmPIO m
return (hm2repa l, hm2repa u, hm2repa p, s) | 201 | luPIO m = do
(l,u,p,s) <- H.lu <$> repa2hmPIO m
return (hm2repa l, hm2repa u, hm2repa p, s) | 95 | false | true | 0 | 10 | 47 | 136 | 67 | 69 | null | null |
jstolarek/ghc | libraries/base/GHC/List.hs | bsd-3-clause | zip3 _ _ _ = [] | 30 | zip3 _ _ _ = [] | 30 | zip3 _ _ _ = [] | 30 | false | false | 1 | 6 | 20 | 16 | 6 | 10 | null | null |
yav/lang | src/AST.hs | mit | addTDecl :: TDecl -> Module -> Module
addTDecl d m = m { modTDecls = d : modTDecls m } | 86 | addTDecl :: TDecl -> Module -> Module
addTDecl d m = m { modTDecls = d : modTDecls m } | 86 | addTDecl d m = m { modTDecls = d : modTDecls m } | 48 | false | true | 0 | 8 | 19 | 39 | 20 | 19 | null | null |
bartfrenk/haskell-transaction | src/Transaction/Database.hs | bsd-3-clause | connectDB :: FilePath -> IO Connection
connectDB path = do
handle <- connectSqlite3 path
prepareDB handle
return handle | 125 | connectDB :: FilePath -> IO Connection
connectDB path = do
handle <- connectSqlite3 path
prepareDB handle
return handle | 125 | connectDB path = do
handle <- connectSqlite3 path
prepareDB handle
return handle | 86 | false | true | 0 | 8 | 23 | 43 | 18 | 25 | null | null |
ezyang/ghc | compiler/cmm/PprC.hs | bsd-3-clause | is_cishCC CApiConv = True | 29 | is_cishCC CApiConv = True | 29 | is_cishCC CApiConv = True | 29 | false | false | 0 | 5 | 7 | 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.