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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
overminder/YASIR | yasir-nih/Parser.hs | mit | lexer :: P.GenTokenParser String u Identity
lexer = P.makeTokenParser (javaStyle { P.reservedNames = words "if then else let in"
, P.reservedOpNames = words "+ - < = \\ -> :="
}) | 252 | lexer :: P.GenTokenParser String u Identity
lexer = P.makeTokenParser (javaStyle { P.reservedNames = words "if then else let in"
, P.reservedOpNames = words "+ - < = \\ -> :="
}) | 252 | lexer = P.makeTokenParser (javaStyle { P.reservedNames = words "if then else let in"
, P.reservedOpNames = words "+ - < = \\ -> :="
}) | 208 | false | true | 0 | 9 | 104 | 52 | 27 | 25 | null | null |
abuiles/turbinado-blog | tmp/dependencies/hs-plugins-1.3.1/src/System/Plugins/Utils.hs | bsd-3-clause | encode_ch 'Z' = "ZZ" | 21 | encode_ch 'Z' = "ZZ" | 21 | encode_ch 'Z' = "ZZ" | 21 | false | false | 0 | 4 | 4 | 10 | 4 | 6 | null | null |
nushio3/ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickLHsExprRHS :: LHsExpr Id -> TM (LHsExpr Id)
addTickLHsExprRHS e@(L pos e0) = do
d <- getDensity
case d of
TickForBreakPoints | HsLet{} <- e0 -> dont_tick_it
| otherwise -> tick_it
TickForCoverage -> tick_it
TickCallSites | isCallSite e0 -> tick_it
_other -> dont_tick_it
where
tick_it = allocTickBox (ExpBox False) False False pos $ addTickHsExpr e0
dont_tick_it = addTickLHsExprNever e
-- The inner expression of an evaluation context:
-- let binds in [], ( [] )
-- we never tick these if we're doing HPC, but otherwise
-- we treat it like an ordinary expression. | 650 | addTickLHsExprRHS :: LHsExpr Id -> TM (LHsExpr Id)
addTickLHsExprRHS e@(L pos e0) = do
d <- getDensity
case d of
TickForBreakPoints | HsLet{} <- e0 -> dont_tick_it
| otherwise -> tick_it
TickForCoverage -> tick_it
TickCallSites | isCallSite e0 -> tick_it
_other -> dont_tick_it
where
tick_it = allocTickBox (ExpBox False) False False pos $ addTickHsExpr e0
dont_tick_it = addTickLHsExprNever e
-- The inner expression of an evaluation context:
-- let binds in [], ( [] )
-- we never tick these if we're doing HPC, but otherwise
-- we treat it like an ordinary expression. | 650 | addTickLHsExprRHS e@(L pos e0) = do
d <- getDensity
case d of
TickForBreakPoints | HsLet{} <- e0 -> dont_tick_it
| otherwise -> tick_it
TickForCoverage -> tick_it
TickCallSites | isCallSite e0 -> tick_it
_other -> dont_tick_it
where
tick_it = allocTickBox (ExpBox False) False False pos $ addTickHsExpr e0
dont_tick_it = addTickLHsExprNever e
-- The inner expression of an evaluation context:
-- let binds in [], ( [] )
-- we never tick these if we're doing HPC, but otherwise
-- we treat it like an ordinary expression. | 599 | false | true | 3 | 15 | 172 | 167 | 74 | 93 | null | null |
noughtmare/yi | yi-keymap-vim/src/Yi/Keymap/Vim/Digraph.hs | gpl-2.0 | -- BLACK RECTANGLE
switch 'O' 'r' = '\x25AD' | 44 | switch 'O' 'r' = '\x25AD' | 25 | switch 'O' 'r' = '\x25AD' | 25 | true | false | 0 | 5 | 7 | 12 | 6 | 6 | null | null |
haasn/vimus | src/Vimus/Command.hs | mit | metaSorted :: [MPD.Metadata] -> [MPD.Song] -> [MPD.Song]
metaSorted tags = sortBy (foldMap comparingTag tags) | 109 | metaSorted :: [MPD.Metadata] -> [MPD.Song] -> [MPD.Song]
metaSorted tags = sortBy (foldMap comparingTag tags) | 109 | metaSorted tags = sortBy (foldMap comparingTag tags) | 52 | false | true | 0 | 8 | 13 | 48 | 25 | 23 | null | null |
gallais/potpourri | haskell/hsubst/TypeChecking.hs | gpl-3.0 | inferElim _ (TySig s t, ne) ElimPr2 = (t', ne `elimNe` ElimPr2)
where t' = TyAbs s t `appTy` proj1 (NfNeu ne) | 111 | inferElim _ (TySig s t, ne) ElimPr2 = (t', ne `elimNe` ElimPr2)
where t' = TyAbs s t `appTy` proj1 (NfNeu ne) | 111 | inferElim _ (TySig s t, ne) ElimPr2 = (t', ne `elimNe` ElimPr2)
where t' = TyAbs s t `appTy` proj1 (NfNeu ne) | 111 | false | false | 2 | 8 | 23 | 74 | 35 | 39 | null | null |
mmisamore/directed-cubical | Math/Topology/CubeCmplx/DirCubeCmplx.hs | bsd-3-clause | vsCornerVerts :: VertSpan -> S.HashSet Vertex
vsCornerVerts = S.map snd . vsCornerPairs | 87 | vsCornerVerts :: VertSpan -> S.HashSet Vertex
vsCornerVerts = S.map snd . vsCornerPairs | 87 | vsCornerVerts = S.map snd . vsCornerPairs | 41 | false | true | 0 | 7 | 11 | 29 | 14 | 15 | null | null |
fmapfmapfmap/amazonka | amazonka-devicefarm/gen/Network/AWS/DeviceFarm/Types/Product.hs | mpl-2.0 | -- | Information about the associated suite.
pSuite :: Lens' Problem (Maybe ProblemDetail)
pSuite = lens _pSuite (\ s a -> s{_pSuite = a}) | 138 | pSuite :: Lens' Problem (Maybe ProblemDetail)
pSuite = lens _pSuite (\ s a -> s{_pSuite = a}) | 93 | pSuite = lens _pSuite (\ s a -> s{_pSuite = a}) | 47 | true | true | 0 | 9 | 23 | 46 | 25 | 21 | null | null |
rueshyna/gogol | gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs | mpl-2.0 | -- | Etag of this resource.
lbEtag :: Lens' LiveBroadcast (Maybe Text)
lbEtag = lens _lbEtag (\ s a -> s{_lbEtag = a}) | 118 | lbEtag :: Lens' LiveBroadcast (Maybe Text)
lbEtag = lens _lbEtag (\ s a -> s{_lbEtag = a}) | 90 | lbEtag = lens _lbEtag (\ s a -> s{_lbEtag = a}) | 47 | true | true | 0 | 9 | 22 | 46 | 25 | 21 | null | null |
yuroyoro/stashh | src/Stashh/AnsiColor.hs | bsd-3-clause | black, red, green, yellow, blue, magenta, cyan, white :: String -> String
black = inColor Black False Default | 113 | black, red, green, yellow, blue, magenta, cyan, white :: String -> String
black = inColor Black False Default | 113 | black = inColor Black False Default | 39 | false | true | 0 | 5 | 21 | 36 | 25 | 11 | null | null |
rvion/ftgl-haskell | Graphics/Rendering/FTGL.hs | bsd-2-clause | -- | Create a bitmapped version of a TrueType font. Bitmapped versions will not
-- | respond to matrix transformations, but rather must be transformed using the
-- | raster positioning functions in OpenGL
createBitmapFont :: String -> IO Font
createBitmapFont file = withCString file $ \p -> fcreateBitmapFont p | 312 | createBitmapFont :: String -> IO Font
createBitmapFont file = withCString file $ \p -> fcreateBitmapFont p | 106 | createBitmapFont file = withCString file $ \p -> fcreateBitmapFont p | 68 | true | true | 0 | 7 | 50 | 42 | 21 | 21 | null | null |
tjakway/ghcjvm | compiler/codeGen/CgUtils.hs | bsd-3-clause | baseRegOffset dflags (ZmmReg 4) = oFFSET_StgRegTable_rZMM4 dflags | 74 | baseRegOffset dflags (ZmmReg 4) = oFFSET_StgRegTable_rZMM4 dflags | 74 | baseRegOffset dflags (ZmmReg 4) = oFFSET_StgRegTable_rZMM4 dflags | 74 | false | false | 0 | 7 | 15 | 21 | 9 | 12 | null | null |
siddhanathan/ghc | compiler/simplCore/OccurAnal.hs | bsd-3-clause | markInsideLam occ = occ | 45 | markInsideLam occ = occ | 45 | markInsideLam occ = occ | 45 | false | false | 0 | 5 | 25 | 9 | 4 | 5 | null | null |
haskell/haddock | haddock-test/src/Test/Haddock/Config.hs | bsd-2-clause | processFileArgs dcfg args = processFileArgs' dcfg args | 54 | processFileArgs dcfg args = processFileArgs' dcfg args | 54 | processFileArgs dcfg args = processFileArgs' dcfg args | 54 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
talanis85/mudblood | src/Mudblood/Screen/Vty.hs | gpl-3.0 | setStatus :: MB u String -> Screen u ()
setStatus action = modify $ \s -> s { scrStatus = action } | 98 | setStatus :: MB u String -> Screen u ()
setStatus action = modify $ \s -> s { scrStatus = action } | 98 | setStatus action = modify $ \s -> s { scrStatus = action } | 58 | false | true | 0 | 8 | 21 | 47 | 24 | 23 | null | null |
mettekou/ghc | compiler/hsSyn/HsBinds.hs | bsd-3-clause | isDefaultMethod :: TcSpecPrags -> Bool
isDefaultMethod IsDefaultMethod = True | 77 | isDefaultMethod :: TcSpecPrags -> Bool
isDefaultMethod IsDefaultMethod = True | 77 | isDefaultMethod IsDefaultMethod = True | 38 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
henrytill/deviser | src/Deviser/Evaluator.hs | bsd-3-clause | defExpr :: (MonadError LispError m, MonadReader EnvCtx m) => LispVal -> LispVal -> m LispVal
defExpr var expr = do
evaledExpr <- eval expr
extractedVar <- extractVar <$> ensureAtom var
insertMe <- extractedVar
local (Map.insert insertMe evaledExpr) (return var) | 275 | defExpr :: (MonadError LispError m, MonadReader EnvCtx m) => LispVal -> LispVal -> m LispVal
defExpr var expr = do
evaledExpr <- eval expr
extractedVar <- extractVar <$> ensureAtom var
insertMe <- extractedVar
local (Map.insert insertMe evaledExpr) (return var) | 275 | defExpr var expr = do
evaledExpr <- eval expr
extractedVar <- extractVar <$> ensureAtom var
insertMe <- extractedVar
local (Map.insert insertMe evaledExpr) (return var) | 182 | false | true | 0 | 11 | 52 | 106 | 48 | 58 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/ARB/VertexProgram.hs | bsd-3-clause | gl_MATRIX3 :: GLenum
gl_MATRIX3 = 0x88C3 | 40 | gl_MATRIX3 :: GLenum
gl_MATRIX3 = 0x88C3 | 40 | gl_MATRIX3 = 0x88C3 | 19 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
robdockins/edison | edison-core/src/Data/Edison/Coll/Defaults.hs | mit | differenceUsingOrdLists :: OrdSet c a => c -> c -> c
differenceUsingOrdLists as bs = unsafeFromOrdList $ diff (toOrdList as) (toOrdList bs)
where diff a@(x:xs) b@(y:ys) =
case compare x y of
LT -> x : diff xs b
EQ -> diff xs ys
GT -> diff a ys
diff a _ = a | 312 | differenceUsingOrdLists :: OrdSet c a => c -> c -> c
differenceUsingOrdLists as bs = unsafeFromOrdList $ diff (toOrdList as) (toOrdList bs)
where diff a@(x:xs) b@(y:ys) =
case compare x y of
LT -> x : diff xs b
EQ -> diff xs ys
GT -> diff a ys
diff a _ = a | 312 | differenceUsingOrdLists as bs = unsafeFromOrdList $ diff (toOrdList as) (toOrdList bs)
where diff a@(x:xs) b@(y:ys) =
case compare x y of
LT -> x : diff xs b
EQ -> diff xs ys
GT -> diff a ys
diff a _ = a | 259 | false | true | 1 | 9 | 109 | 135 | 67 | 68 | null | null |
pauloborba/plc | src/IntroducaoAProgramacaoFuncionalEHaskell.hs | cc0-1.0 | shift ((x,y),z) = (x,(y,z)) | 27 | shift ((x,y),z) = (x,(y,z)) | 27 | shift ((x,y),z) = (x,(y,z)) | 27 | false | false | 0 | 7 | 3 | 33 | 20 | 13 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2020/M10/D26/Solution.hs | mit | airbaseCypher :: Map Icao AirBase -> [Cypher]
airbaseCypher = map (mkCypher "a" "rel" "b" . loadIt) . Map.toList | 112 | airbaseCypher :: Map Icao AirBase -> [Cypher]
airbaseCypher = map (mkCypher "a" "rel" "b" . loadIt) . Map.toList | 112 | airbaseCypher = map (mkCypher "a" "rel" "b" . loadIt) . Map.toList | 66 | false | true | 0 | 9 | 17 | 46 | 23 | 23 | null | null |
GaloisInc/saw-script | saw-remote-api/src/SAWServer/OK.hs | bsd-3-clause | ok :: Applicative f => f OK
ok = pure OK | 40 | ok :: Applicative f => f OK
ok = pure OK | 40 | ok = pure OK | 12 | false | true | 0 | 7 | 10 | 30 | 12 | 18 | null | null |
alexander-at-github/eta | compiler/ETA/Types/TyCon.hs | bsd-3-clause | isInjectiveTyCon (PromotedDataCon {}) _ = True | 70 | isInjectiveTyCon (PromotedDataCon {}) _ = True | 70 | isInjectiveTyCon (PromotedDataCon {}) _ = True | 70 | false | false | 0 | 7 | 29 | 18 | 9 | 9 | null | null |
robx/puzzle-draw | src/Data/Component.hs | mit | extractSolution :: Bool -> [TaggedComponent a] -> Maybe [PlacedComponent a]
extractSolution code tcs =
if haveSol
then Just . map untag . filter want $ tcs
else Nothing
where
haveSol = not . null . filter (tagged Solution) $ tcs
want c = not (tagged Puzzle c) && (code || not (tagged Code c)) | 312 | extractSolution :: Bool -> [TaggedComponent a] -> Maybe [PlacedComponent a]
extractSolution code tcs =
if haveSol
then Just . map untag . filter want $ tcs
else Nothing
where
haveSol = not . null . filter (tagged Solution) $ tcs
want c = not (tagged Puzzle c) && (code || not (tagged Code c)) | 312 | extractSolution code tcs =
if haveSol
then Just . map untag . filter want $ tcs
else Nothing
where
haveSol = not . null . filter (tagged Solution) $ tcs
want c = not (tagged Puzzle c) && (code || not (tagged Code c)) | 236 | false | true | 6 | 10 | 73 | 149 | 67 | 82 | null | null |
ezyang/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | doIndexByteArrayOpAs _ _ _ _ _
= panic "StgCmmPrim: doIndexByteArrayOpAs" | 76 | doIndexByteArrayOpAs _ _ _ _ _
= panic "StgCmmPrim: doIndexByteArrayOpAs" | 76 | doIndexByteArrayOpAs _ _ _ _ _
= panic "StgCmmPrim: doIndexByteArrayOpAs" | 76 | false | false | 1 | 5 | 12 | 19 | 8 | 11 | null | null |
brendanhay/gogol | gogol-logging/gen/Network/Google/Resource/Logging/Organizations/Sinks/Create.hs | mpl-2.0 | -- | Creates a value of 'OrganizationsSinksCreate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oscParent'
--
-- * 'oscXgafv'
--
-- * 'oscUniqueWriterIdentity'
--
-- * 'oscUploadProtocol'
--
-- * 'oscAccessToken'
--
-- * 'oscUploadType'
--
-- * 'oscPayload'
--
-- * 'oscCallback'
organizationsSinksCreate
:: Text -- ^ 'oscParent'
-> LogSink -- ^ 'oscPayload'
-> OrganizationsSinksCreate
organizationsSinksCreate pOscParent_ pOscPayload_ =
OrganizationsSinksCreate'
{ _oscParent = pOscParent_
, _oscXgafv = Nothing
, _oscUniqueWriterIdentity = Nothing
, _oscUploadProtocol = Nothing
, _oscAccessToken = Nothing
, _oscUploadType = Nothing
, _oscPayload = pOscPayload_
, _oscCallback = Nothing
} | 831 | organizationsSinksCreate
:: Text -- ^ 'oscParent'
-> LogSink -- ^ 'oscPayload'
-> OrganizationsSinksCreate
organizationsSinksCreate pOscParent_ pOscPayload_ =
OrganizationsSinksCreate'
{ _oscParent = pOscParent_
, _oscXgafv = Nothing
, _oscUniqueWriterIdentity = Nothing
, _oscUploadProtocol = Nothing
, _oscAccessToken = Nothing
, _oscUploadType = Nothing
, _oscPayload = pOscPayload_
, _oscCallback = Nothing
} | 462 | organizationsSinksCreate pOscParent_ pOscPayload_ =
OrganizationsSinksCreate'
{ _oscParent = pOscParent_
, _oscXgafv = Nothing
, _oscUniqueWriterIdentity = Nothing
, _oscUploadProtocol = Nothing
, _oscAccessToken = Nothing
, _oscUploadType = Nothing
, _oscPayload = pOscPayload_
, _oscCallback = Nothing
} | 343 | true | true | 0 | 8 | 162 | 104 | 68 | 36 | null | null |
talw/crisp-compiler | src/Lexer.hs | bsd-3-clause | reservedOp = Tok.reservedOp lexer | 36 | reservedOp = Tok.reservedOp lexer | 36 | reservedOp = Tok.reservedOp lexer | 36 | false | false | 1 | 5 | 6 | 15 | 5 | 10 | null | null |
blippy/sifi | src/Types.hs | gpl-3.0 | Pennies a |+| Pennies b = Pennies (a+b) | 39 | Pennies a |+| Pennies b = Pennies (a+b) | 39 | Pennies a |+| Pennies b = Pennies (a+b) | 39 | false | false | 0 | 7 | 7 | 28 | 12 | 16 | null | null |
geekyfox/skulk | src/Skulk/Outcome.hs | mit | toEither (Skip msg) = Left $ "SKIP: " ++ msg | 44 | toEither (Skip msg) = Left $ "SKIP: " ++ msg | 44 | toEither (Skip msg) = Left $ "SKIP: " ++ msg | 44 | false | false | 0 | 7 | 9 | 23 | 11 | 12 | null | null |
elieux/ghc | compiler/main/DynFlags.hs | bsd-3-clause | wayTag WayThreaded = "thr" | 26 | wayTag WayThreaded = "thr" | 26 | wayTag WayThreaded = "thr" | 26 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
holzensp/ghc | libraries/base/Prelude.hs | bsd-3-clause | -- -----------------------------------------------------------------------------
-- Miscellaneous functions
-- | Strict (call-by-value) application, defined in terms of 'seq'.
($!) :: (a -> b) -> a -> b
f $! x = let !vx = x in f vx | 236 | ($!) :: (a -> b) -> a -> b
f $! x = let !vx = x in f vx | 59 | f $! x = let !vx = x in f vx | 29 | true | true | 0 | 9 | 39 | 54 | 27 | 27 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-gool/GOOL/Drasil/State.hs | bsd-2-clause | setVSfromCS :: ((GOOLState, FileState), ClassState) ->
((((GOOLState, FileState), ClassState), MethodState), ValueState) ->
((GOOLState, FileState), ClassState)
setVSfromCS _ ((cs, _), _) = cs | 197 | setVSfromCS :: ((GOOLState, FileState), ClassState) ->
((((GOOLState, FileState), ClassState), MethodState), ValueState) ->
((GOOLState, FileState), ClassState)
setVSfromCS _ ((cs, _), _) = cs | 197 | setVSfromCS _ ((cs, _), _) = cs | 31 | false | true | 0 | 11 | 26 | 90 | 53 | 37 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/ShallowDeepPlugin/BindChangeArgPass.hs | bsd-3-clause | changeAppBind' ((b, e) : bs) = do
let (lbs, e') = collectBinders e
s <- get
put s{args = lbs}
e'' <- changeAppExpr e'
let e''' = mkLams lbs e''
bs' <- changeAppBind' bs
return $ (b, e''') : bs' | 207 | changeAppBind' ((b, e) : bs) = do
let (lbs, e') = collectBinders e
s <- get
put s{args = lbs}
e'' <- changeAppExpr e'
let e''' = mkLams lbs e''
bs' <- changeAppBind' bs
return $ (b, e''') : bs' | 207 | changeAppBind' ((b, e) : bs) = do
let (lbs, e') = collectBinders e
s <- get
put s{args = lbs}
e'' <- changeAppExpr e'
let e''' = mkLams lbs e''
bs' <- changeAppBind' bs
return $ (b, e''') : bs' | 207 | false | false | 0 | 10 | 53 | 114 | 54 | 60 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT25.hs | gpl-3.0 | not False = True | 16 | not False = True | 16 | not False = True | 16 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
brendanhay/gogol | gogol-slides/gen/Network/Google/Slides/Types/Product.hs | mpl-2.0 | -- | Master specific properties. Only set if page_type = MASTER.
pMasterProperties :: Lens' Page (Maybe MasterProperties)
pMasterProperties
= lens _pMasterProperties
(\ s a -> s{_pMasterProperties = a}) | 210 | pMasterProperties :: Lens' Page (Maybe MasterProperties)
pMasterProperties
= lens _pMasterProperties
(\ s a -> s{_pMasterProperties = a}) | 145 | pMasterProperties
= lens _pMasterProperties
(\ s a -> s{_pMasterProperties = a}) | 88 | true | true | 0 | 9 | 35 | 48 | 25 | 23 | null | null |
brendanhay/gogol | gogol-datafusion/gen/Network/Google/DataFusion/Types/Product.hs | mpl-2.0 | -- | Role that is assigned to \`members\`. For example, \`roles\/viewer\`,
-- \`roles\/editor\`, or \`roles\/owner\`.
bRole :: Lens' Binding (Maybe Text)
bRole = lens _bRole (\ s a -> s{_bRole = a}) | 198 | bRole :: Lens' Binding (Maybe Text)
bRole = lens _bRole (\ s a -> s{_bRole = a}) | 80 | bRole = lens _bRole (\ s a -> s{_bRole = a}) | 44 | true | true | 0 | 9 | 31 | 47 | 26 | 21 | null | null |
badp/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | ddpRemoteMinor :: String
ddpRemoteMinor = "remote-minor" | 56 | ddpRemoteMinor :: String
ddpRemoteMinor = "remote-minor" | 56 | ddpRemoteMinor = "remote-minor" | 31 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
vladimir-ipatov/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | tagNode :: String
tagNode = Types.tagKindToRaw TagKindNode | 58 | tagNode :: String
tagNode = Types.tagKindToRaw TagKindNode | 58 | tagNode = Types.tagKindToRaw TagKindNode | 40 | false | true | 0 | 6 | 6 | 23 | 9 | 14 | null | null |
beni55/HaskellNet | src/Network/HaskellNet/IMAP.hs | bsd-3-clause | fetchByStringR :: IMAPConnection -> (UID, UID) -> String
-> IO [(UID, [(String, String)])]
fetchByStringR conn (s, e) command =
fetchCommand conn ("UID FETCH "++show s++":"++show e++" "++command) proc
where proc (n, ps) =
(maybe (toEnum (fromIntegral n)) read (lookup "UID" ps), ps) | 319 | fetchByStringR :: IMAPConnection -> (UID, UID) -> String
-> IO [(UID, [(String, String)])]
fetchByStringR conn (s, e) command =
fetchCommand conn ("UID FETCH "++show s++":"++show e++" "++command) proc
where proc (n, ps) =
(maybe (toEnum (fromIntegral n)) read (lookup "UID" ps), ps) | 319 | fetchByStringR conn (s, e) command =
fetchCommand conn ("UID FETCH "++show s++":"++show e++" "++command) proc
where proc (n, ps) =
(maybe (toEnum (fromIntegral n)) read (lookup "UID" ps), ps) | 213 | false | true | 0 | 12 | 78 | 148 | 79 | 69 | null | null |
jwiegley/ghc-release | utils/haddock/src/Haddock/Parser.hs | gpl-3.0 | parseStringBS :: DynFlags -> BS.ByteString -> Doc RdrName
parseStringBS d = parse p
where
p :: Parser (Doc RdrName)
p = mconcat <$> many (monospace d <|> anchor <|> identifier d
<|> moduleName <|> picture <|> hyperlink <|> autoUrl <|> bold d
<|> emphasis d <|> encodedChar <|> string' <|> skipSpecialChar)
-- | Parses and processes
-- <https://en.wikipedia.org/wiki/Numeric_character_reference Numeric character references>
--
-- >>> parseOnly encodedChar "ABC"
-- Right (DocString "ABC") | 563 | parseStringBS :: DynFlags -> BS.ByteString -> Doc RdrName
parseStringBS d = parse p
where
p :: Parser (Doc RdrName)
p = mconcat <$> many (monospace d <|> anchor <|> identifier d
<|> moduleName <|> picture <|> hyperlink <|> autoUrl <|> bold d
<|> emphasis d <|> encodedChar <|> string' <|> skipSpecialChar)
-- | Parses and processes
-- <https://en.wikipedia.org/wiki/Numeric_character_reference Numeric character references>
--
-- >>> parseOnly encodedChar "ABC"
-- Right (DocString "ABC") | 563 | parseStringBS d = parse p
where
p :: Parser (Doc RdrName)
p = mconcat <$> many (monospace d <|> anchor <|> identifier d
<|> moduleName <|> picture <|> hyperlink <|> autoUrl <|> bold d
<|> emphasis d <|> encodedChar <|> string' <|> skipSpecialChar)
-- | Parses and processes
-- <https://en.wikipedia.org/wiki/Numeric_character_reference Numeric character references>
--
-- >>> parseOnly encodedChar "ABC"
-- Right (DocString "ABC") | 505 | false | true | 1 | 19 | 133 | 123 | 61 | 62 | null | null |
plutonbrb/nero | src/Nero/Request.hs | bsd-3-clause | -- | Smart constructor for 'POST' 'Request's.
post :: Url -> Payload -> Request
post u p = _POST # (defaultPOST & url .~ u & payload .~ p) | 138 | post :: Url -> Payload -> Request
post u p = _POST # (defaultPOST & url .~ u & payload .~ p) | 92 | post u p = _POST # (defaultPOST & url .~ u & payload .~ p) | 58 | true | true | 0 | 10 | 28 | 48 | 25 | 23 | null | null |
didi-FP/tcp-streams | tcp-streams-openssl/test/Main.hs | bsd-3-clause | tcpTests :: [Test]
tcpTests = [ testTCPSocket ] | 47 | tcpTests :: [Test]
tcpTests = [ testTCPSocket ] | 47 | tcpTests = [ testTCPSocket ] | 28 | false | true | 0 | 5 | 7 | 17 | 10 | 7 | null | null |
cdepillabout/subhask | src/SubHask/Algebra/Parallel.hs | bsd-3-clause | parallel ::
( Partitionable domain
, Monoid range
, NFData range
) => (domain -> range) -- ^ sequential monoid homomorphism
-> (domain -> range) -- ^ parallel monoid homomorphism
parallel = parallelBlocked | 227 | parallel ::
( Partitionable domain
, Monoid range
, NFData range
) => (domain -> range) -- ^ sequential monoid homomorphism
-> (domain -> range)
parallel = parallelBlocked | 193 | parallel = parallelBlocked | 26 | true | true | 0 | 10 | 54 | 59 | 30 | 29 | null | null |
ajnsit/vyom | src/Vyom/Term/CondSym.hs | mit | deserialise _ _ (Node "Cond" es) _ = Left $ "Invalid number of arguments, expected 3, found " <> show (length es) | 113 | deserialise _ _ (Node "Cond" es) _ = Left $ "Invalid number of arguments, expected 3, found " <> show (length es) | 113 | deserialise _ _ (Node "Cond" es) _ = Left $ "Invalid number of arguments, expected 3, found " <> show (length es) | 113 | false | false | 2 | 9 | 21 | 42 | 18 | 24 | null | null |
getyourguide/fbthrift | thrift/compiler/test/fixtures/namespace/gen-hs/My/Namespacing/Test/HsTestService.hs | apache-2.0 | to_Init_result :: Types.ThriftVal -> Init_result
to_Init_result (Types.TStruct fields) = Init_result{
init_result_success = maybe (init_result_success default_Init_result) (\(_,_val19) -> (case _val19 of {Types.TI64 _val20 -> _val20; _ -> error "wrong type"})) (Map.lookup (0) fields)
} | 290 | to_Init_result :: Types.ThriftVal -> Init_result
to_Init_result (Types.TStruct fields) = Init_result{
init_result_success = maybe (init_result_success default_Init_result) (\(_,_val19) -> (case _val19 of {Types.TI64 _val20 -> _val20; _ -> error "wrong type"})) (Map.lookup (0) fields)
} | 290 | to_Init_result (Types.TStruct fields) = Init_result{
init_result_success = maybe (init_result_success default_Init_result) (\(_,_val19) -> (case _val19 of {Types.TI64 _val20 -> _val20; _ -> error "wrong type"})) (Map.lookup (0) fields)
} | 241 | false | true | 0 | 15 | 36 | 106 | 57 | 49 | null | null |
dasuxullebt/inflate.hs | inflate.recSlowdown.hs | gpl-3.0 | dynamicBlockHeader :: DeflateParse (Int, Int, Int)
dynamicBlockHeader = do
!hlitBits <- nBits 5
!hdistBits <- nBits 5
!hclenBits <- nBits 4
return ((lsbToInt hlitBits) + 257,
(lsbToInt hdistBits) + 1,
(lsbToInt hclenBits) + 4) | 254 | dynamicBlockHeader :: DeflateParse (Int, Int, Int)
dynamicBlockHeader = do
!hlitBits <- nBits 5
!hdistBits <- nBits 5
!hclenBits <- nBits 4
return ((lsbToInt hlitBits) + 257,
(lsbToInt hdistBits) + 1,
(lsbToInt hclenBits) + 4) | 254 | dynamicBlockHeader = do
!hlitBits <- nBits 5
!hdistBits <- nBits 5
!hclenBits <- nBits 4
return ((lsbToInt hlitBits) + 257,
(lsbToInt hdistBits) + 1,
(lsbToInt hclenBits) + 4) | 203 | false | true | 0 | 12 | 61 | 107 | 49 | 58 | null | null |
brendanhay/gogol | gogol-healthcare/gen/Network/Google/Resource/Healthcare/Projects/Locations/DataSets/DicomStores/SetIAMPolicy.hs | mpl-2.0 | -- | Multipart request metadata.
pldsdssipPayload :: Lens' ProjectsLocationsDataSetsDicomStoresSetIAMPolicy SetIAMPolicyRequest
pldsdssipPayload
= lens _pldsdssipPayload
(\ s a -> s{_pldsdssipPayload = a}) | 213 | pldsdssipPayload :: Lens' ProjectsLocationsDataSetsDicomStoresSetIAMPolicy SetIAMPolicyRequest
pldsdssipPayload
= lens _pldsdssipPayload
(\ s a -> s{_pldsdssipPayload = a}) | 180 | pldsdssipPayload
= lens _pldsdssipPayload
(\ s a -> s{_pldsdssipPayload = a}) | 85 | true | true | 0 | 9 | 28 | 42 | 22 | 20 | null | null |
brendanhay/gogol | gogol-admin-directory/gen/Network/Google/Resource/Directory/Roles/Patch.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
rpUploadType :: Lens' RolesPatch (Maybe Text)
rpUploadType
= lens _rpUploadType (\ s a -> s{_rpUploadType = a}) | 184 | rpUploadType :: Lens' RolesPatch (Maybe Text)
rpUploadType
= lens _rpUploadType (\ s a -> s{_rpUploadType = a}) | 113 | rpUploadType
= lens _rpUploadType (\ s a -> s{_rpUploadType = a}) | 67 | true | true | 0 | 9 | 28 | 48 | 25 | 23 | null | null |
rueshyna/gogol | gogol-slides/gen/Network/Google/Slides/Types.hs | mpl-2.0 | -- | View and manage the files in your Google Drive
driveScope :: Proxy '["https://www.googleapis.com/auth/drive"]
driveScope = Proxy | 133 | driveScope :: Proxy '["https://www.googleapis.com/auth/drive"]
driveScope = Proxy | 81 | driveScope = Proxy | 18 | true | true | 0 | 8 | 17 | 26 | 12 | 14 | null | null |
parapluu/encore | src/types/Typechecker/Capturechecker.hs | bsd-3-clause | captureOrBorrow :: Expr -> Type -> TypecheckM ()
captureOrBorrow e ty
| isStackboundType ty = unless (isFree e) (assertBorrowable e)
| otherwise =
do when (isStackboundType (getType e)) $
tcError $ BorrowedLeakError e
capture e
where
assertBorrowable VarAccess{} = return ()
assertBorrowable e@FieldAccess{target, name} =
whenM (isLinearType (getType e)) $
unlessM (linearAllTheWay target) $
tcError $ NonBorrowableError e
assertBorrowable e@ArrayAccess{target} =
whenM (isLinearType (getType e)) $
unlessM (linearAllTheWay target) $
tcError $ NonBorrowableError e
assertBorrowable e@TypedExpr{body} =
assertBorrowable body
assertBorrowable e = return ()
linearAllTheWay e@FieldAccess{} = linearPath e
linearAllTheWay e@MethodCall{} = linearPath e
linearAllTheWay e@MessageSend{} = linearPath e
linearAllTheWay e@ArrayAccess{} = linearPath e
linearAllTheWay e@Consume{} = linearPath e
linearAllTheWay e@TupleAccess{} = linearPath e
linearAllTheWay e = linearAndNonBorrowed (getType e)
linearPath e =
liftM2 (&&)
(linearAndNonBorrowed (getType e))
(linearAllTheWay (target e))
linearAndNonBorrowed ty =
liftM (&& not (isStackboundType ty)) (isLinearType ty) | 1,428 | captureOrBorrow :: Expr -> Type -> TypecheckM ()
captureOrBorrow e ty
| isStackboundType ty = unless (isFree e) (assertBorrowable e)
| otherwise =
do when (isStackboundType (getType e)) $
tcError $ BorrowedLeakError e
capture e
where
assertBorrowable VarAccess{} = return ()
assertBorrowable e@FieldAccess{target, name} =
whenM (isLinearType (getType e)) $
unlessM (linearAllTheWay target) $
tcError $ NonBorrowableError e
assertBorrowable e@ArrayAccess{target} =
whenM (isLinearType (getType e)) $
unlessM (linearAllTheWay target) $
tcError $ NonBorrowableError e
assertBorrowable e@TypedExpr{body} =
assertBorrowable body
assertBorrowable e = return ()
linearAllTheWay e@FieldAccess{} = linearPath e
linearAllTheWay e@MethodCall{} = linearPath e
linearAllTheWay e@MessageSend{} = linearPath e
linearAllTheWay e@ArrayAccess{} = linearPath e
linearAllTheWay e@Consume{} = linearPath e
linearAllTheWay e@TupleAccess{} = linearPath e
linearAllTheWay e = linearAndNonBorrowed (getType e)
linearPath e =
liftM2 (&&)
(linearAndNonBorrowed (getType e))
(linearAllTheWay (target e))
linearAndNonBorrowed ty =
liftM (&& not (isStackboundType ty)) (isLinearType ty) | 1,428 | captureOrBorrow e ty
| isStackboundType ty = unless (isFree e) (assertBorrowable e)
| otherwise =
do when (isStackboundType (getType e)) $
tcError $ BorrowedLeakError e
capture e
where
assertBorrowable VarAccess{} = return ()
assertBorrowable e@FieldAccess{target, name} =
whenM (isLinearType (getType e)) $
unlessM (linearAllTheWay target) $
tcError $ NonBorrowableError e
assertBorrowable e@ArrayAccess{target} =
whenM (isLinearType (getType e)) $
unlessM (linearAllTheWay target) $
tcError $ NonBorrowableError e
assertBorrowable e@TypedExpr{body} =
assertBorrowable body
assertBorrowable e = return ()
linearAllTheWay e@FieldAccess{} = linearPath e
linearAllTheWay e@MethodCall{} = linearPath e
linearAllTheWay e@MessageSend{} = linearPath e
linearAllTheWay e@ArrayAccess{} = linearPath e
linearAllTheWay e@Consume{} = linearPath e
linearAllTheWay e@TupleAccess{} = linearPath e
linearAllTheWay e = linearAndNonBorrowed (getType e)
linearPath e =
liftM2 (&&)
(linearAndNonBorrowed (getType e))
(linearAllTheWay (target e))
linearAndNonBorrowed ty =
liftM (&& not (isStackboundType ty)) (isLinearType ty) | 1,379 | false | true | 14 | 15 | 412 | 455 | 230 | 225 | null | null |
dmjio/bloodhound | src/Database/Bloodhound/Client.hs | bsd-3-clause | encodeBulkOperations :: V.Vector BulkOperation -> L.ByteString
encodeBulkOperations stream = collapsed where
blobs = fmap encodeBulkOperation stream
mashedTaters = mash (mempty :: Builder) blobs
collapsed = toLazyByteString $ mappend mashedTaters (byteString "\n") | 270 | encodeBulkOperations :: V.Vector BulkOperation -> L.ByteString
encodeBulkOperations stream = collapsed where
blobs = fmap encodeBulkOperation stream
mashedTaters = mash (mempty :: Builder) blobs
collapsed = toLazyByteString $ mappend mashedTaters (byteString "\n") | 270 | encodeBulkOperations stream = collapsed where
blobs = fmap encodeBulkOperation stream
mashedTaters = mash (mempty :: Builder) blobs
collapsed = toLazyByteString $ mappend mashedTaters (byteString "\n") | 207 | false | true | 0 | 8 | 36 | 72 | 37 | 35 | null | null |
lamefun/haddock | haddock-api/src/Haddock/Backends/Hoogle.hs | bsd-2-clause | -- want things like paragraph, pre etc to be handled by blank lines in the source document
-- and things like \n and \t converted away
-- much like blogger in HTML mode
-- everything else wants to be included as tags, neatly nested for some (ul,li,ol)
-- or inlne for others (a,i,tt)
-- entities (&,>,<) should always be appropriately escaped
markupTag :: Outputable o => DynFlags -> DocMarkup o [Tag]
markupTag dflags = Markup {
markupParagraph = box TagP,
markupEmpty = str "",
markupString = str,
markupAppend = (++),
markupIdentifier = box (TagInline "a") . str . out dflags,
markupIdentifierUnchecked = box (TagInline "a") . str . out dflags . snd,
markupModule = box (TagInline "a") . str,
markupWarning = box (TagInline "i"),
markupEmphasis = box (TagInline "i"),
markupBold = box (TagInline "b"),
markupMonospaced = box (TagInline "tt"),
markupPic = const $ str " ",
markupUnorderedList = box (TagL 'u'),
markupOrderedList = box (TagL 'o'),
markupDefList = box (TagL 'u') . map (\(a,b) -> TagInline "i" a : Str " " : b),
markupCodeBlock = box TagPre,
markupHyperlink = \(Hyperlink url mLabel) -> (box (TagInline "a") . str) (fromMaybe url mLabel),
markupAName = const $ str "",
markupProperty = box TagPre . str,
markupExample = box TagPre . str . unlines . map exampleToString,
markupHeader = \(Header l h) -> box (TagInline $ "h" ++ show l) h
} | 1,651 | markupTag :: Outputable o => DynFlags -> DocMarkup o [Tag]
markupTag dflags = Markup {
markupParagraph = box TagP,
markupEmpty = str "",
markupString = str,
markupAppend = (++),
markupIdentifier = box (TagInline "a") . str . out dflags,
markupIdentifierUnchecked = box (TagInline "a") . str . out dflags . snd,
markupModule = box (TagInline "a") . str,
markupWarning = box (TagInline "i"),
markupEmphasis = box (TagInline "i"),
markupBold = box (TagInline "b"),
markupMonospaced = box (TagInline "tt"),
markupPic = const $ str " ",
markupUnorderedList = box (TagL 'u'),
markupOrderedList = box (TagL 'o'),
markupDefList = box (TagL 'u') . map (\(a,b) -> TagInline "i" a : Str " " : b),
markupCodeBlock = box TagPre,
markupHyperlink = \(Hyperlink url mLabel) -> (box (TagInline "a") . str) (fromMaybe url mLabel),
markupAName = const $ str "",
markupProperty = box TagPre . str,
markupExample = box TagPre . str . unlines . map exampleToString,
markupHeader = \(Header l h) -> box (TagInline $ "h" ++ show l) h
} | 1,307 | markupTag dflags = Markup {
markupParagraph = box TagP,
markupEmpty = str "",
markupString = str,
markupAppend = (++),
markupIdentifier = box (TagInline "a") . str . out dflags,
markupIdentifierUnchecked = box (TagInline "a") . str . out dflags . snd,
markupModule = box (TagInline "a") . str,
markupWarning = box (TagInline "i"),
markupEmphasis = box (TagInline "i"),
markupBold = box (TagInline "b"),
markupMonospaced = box (TagInline "tt"),
markupPic = const $ str " ",
markupUnorderedList = box (TagL 'u'),
markupOrderedList = box (TagL 'o'),
markupDefList = box (TagL 'u') . map (\(a,b) -> TagInline "i" a : Str " " : b),
markupCodeBlock = box TagPre,
markupHyperlink = \(Hyperlink url mLabel) -> (box (TagInline "a") . str) (fromMaybe url mLabel),
markupAName = const $ str "",
markupProperty = box TagPre . str,
markupExample = box TagPre . str . unlines . map exampleToString,
markupHeader = \(Header l h) -> box (TagInline $ "h" ++ show l) h
} | 1,248 | true | true | 0 | 13 | 526 | 446 | 238 | 208 | null | null |
VinylRecords/Vinyl | Data/Vinyl/FromTuple.hs | mit | -- | Override a record with fields from a possibly narrower record. A
-- typical use is to supply default values as the first argument, and
-- overrides for those defaults as the second.
withDefaults :: (RMap rs, RApply rs, ss ⊆ rs, RMap ss, RecApplicative rs)
=> Rec f rs -> Rec f ss -> Rec f rs
withDefaults defs = fin . rtraverse getCompose . flip rfirst defs' . rdowncast
where fin = maybe (error "Impossible: withDefaults failed") id
defs' = rmap (Compose . Just) defs
rfirst = rcombine (<>) (onCompose First) (onCompose getFirst) | 566 | withDefaults :: (RMap rs, RApply rs, ss ⊆ rs, RMap ss, RecApplicative rs)
=> Rec f rs -> Rec f ss -> Rec f rs
withDefaults defs = fin . rtraverse getCompose . flip rfirst defs' . rdowncast
where fin = maybe (error "Impossible: withDefaults failed") id
defs' = rmap (Compose . Just) defs
rfirst = rcombine (<>) (onCompose First) (onCompose getFirst) | 379 | withDefaults defs = fin . rtraverse getCompose . flip rfirst defs' . rdowncast
where fin = maybe (error "Impossible: withDefaults failed") id
defs' = rmap (Compose . Just) defs
rfirst = rcombine (<>) (onCompose First) (onCompose getFirst) | 256 | true | true | 2 | 8 | 126 | 157 | 79 | 78 | null | null |
jasonbaker/lang | Lang/Parser.hs | bsd-3-clause | floatExpr :: Parser LangExpr
floatExpr = do{f <- float; return $ FloatExpr f} | 77 | floatExpr :: Parser LangExpr
floatExpr = do{f <- float; return $ FloatExpr f} | 77 | floatExpr = do{f <- float; return $ FloatExpr f} | 48 | false | true | 0 | 8 | 12 | 34 | 17 | 17 | null | null |
hargettp/courier | src/Network/RPC.hs | mit | hearAll :: Endpoint -> Name -> IO (Method,Message,Reply Message)
hearAll endpoint name = do
(caller,rid,method,args) <- selectMessage endpoint selectorForAll
return (method,args,reply caller rid)
where
reply caller rid result =
sendMessage endpoint caller $ encode $ Response rid name result
selectorForAll msg =
case decode msg of
Left _ -> Nothing
Right (Request rid caller method args) -> Just (caller,rid,method,args)
{-|
A variant of 'hearTimeout', except it listens for any incoming RPC request on the specified 'Endpoint'
-} | 604 | hearAll :: Endpoint -> Name -> IO (Method,Message,Reply Message)
hearAll endpoint name = do
(caller,rid,method,args) <- selectMessage endpoint selectorForAll
return (method,args,reply caller rid)
where
reply caller rid result =
sendMessage endpoint caller $ encode $ Response rid name result
selectorForAll msg =
case decode msg of
Left _ -> Nothing
Right (Request rid caller method args) -> Just (caller,rid,method,args)
{-|
A variant of 'hearTimeout', except it listens for any incoming RPC request on the specified 'Endpoint'
-} | 604 | hearAll endpoint name = do
(caller,rid,method,args) <- selectMessage endpoint selectorForAll
return (method,args,reply caller rid)
where
reply caller rid result =
sendMessage endpoint caller $ encode $ Response rid name result
selectorForAll msg =
case decode msg of
Left _ -> Nothing
Right (Request rid caller method args) -> Just (caller,rid,method,args)
{-|
A variant of 'hearTimeout', except it listens for any incoming RPC request on the specified 'Endpoint'
-} | 539 | false | true | 0 | 12 | 149 | 178 | 90 | 88 | null | null |
keithodulaigh/Hets | HasCASL/AsUtils.hs | gpl-2.0 | -- | construct higher order kind from arguments and result kind
mkFunKind :: Range -> [(Variance, AnyKind a)] -> AnyKind a -> AnyKind a
mkFunKind r args res = foldr ( \ (v, a) k -> FunKind v a k r) res args | 206 | mkFunKind :: Range -> [(Variance, AnyKind a)] -> AnyKind a -> AnyKind a
mkFunKind r args res = foldr ( \ (v, a) k -> FunKind v a k r) res args | 142 | mkFunKind r args res = foldr ( \ (v, a) k -> FunKind v a k r) res args | 70 | true | true | 0 | 10 | 42 | 85 | 43 | 42 | null | null |
rubik/stack | src/Stack/Types/Package.hs | bsd-3-clause | -- | Get the installed Version.
installedVersion :: Installed -> Version
installedVersion (Library (PackageIdentifier _ v) _) = v | 129 | installedVersion :: Installed -> Version
installedVersion (Library (PackageIdentifier _ v) _) = v | 97 | installedVersion (Library (PackageIdentifier _ v) _) = v | 56 | true | true | 0 | 9 | 18 | 35 | 18 | 17 | null | null |
mruegenberg/blaze-html-truncate | Text/Blaze/Truncate.hs | bsd-3-clause | truncateChoiceStringPreEscaped i (PreEscaped str) = case truncateChoiceStringPreEscaped i str of
Tagged i' str' -> Tagged (max 0 i') $ PreEscaped str' | 152 | truncateChoiceStringPreEscaped i (PreEscaped str) = case truncateChoiceStringPreEscaped i str of
Tagged i' str' -> Tagged (max 0 i') $ PreEscaped str' | 152 | truncateChoiceStringPreEscaped i (PreEscaped str) = case truncateChoiceStringPreEscaped i str of
Tagged i' str' -> Tagged (max 0 i') $ PreEscaped str' | 152 | false | false | 0 | 11 | 22 | 55 | 25 | 30 | null | null |
beni55/cartel | lib/Cartel/Betsy/Internal.hs | bsd-3-clause | makeFlag
:: Applicative m
=> NonEmptyString
-- ^ Name of flag
-> FlagOpts
-- ^ Options for the flag
-> Betsy m FlagName
-- ^ This operation will fail if there is already a flag with the
-- name you gave.
makeFlag nes opts = Betsy $ \fls -> pure $
case nes of
[] -> Left EmptyFlagName
x:xs ->
let nm = FlagName x xs
in case lookup nm . map (\(Flag n v) -> (n, v)) $ fls of
Nothing ->
let st' = Flag nm opts : fls
in Right (nm, st')
Just _ -> Left (DuplicateFlag nm) | 546 | makeFlag
:: Applicative m
=> NonEmptyString
-- ^ Name of flag
-> FlagOpts
-- ^ Options for the flag
-> Betsy m FlagName
makeFlag nes opts = Betsy $ \fls -> pure $
case nes of
[] -> Left EmptyFlagName
x:xs ->
let nm = FlagName x xs
in case lookup nm . map (\(Flag n v) -> (n, v)) $ fls of
Nothing ->
let st' = Flag nm opts : fls
in Right (nm, st')
Just _ -> Left (DuplicateFlag nm) | 458 | makeFlag nes opts = Betsy $ \fls -> pure $
case nes of
[] -> Left EmptyFlagName
x:xs ->
let nm = FlagName x xs
in case lookup nm . map (\(Flag n v) -> (n, v)) $ fls of
Nothing ->
let st' = Flag nm opts : fls
in Right (nm, st')
Just _ -> Left (DuplicateFlag nm) | 326 | true | true | 0 | 21 | 182 | 191 | 94 | 97 | null | null |
statusfailed/snaplet-job-board | src/Snap/Snaplet/JobBoard/Types.hs | agpl-3.0 | jobTypeText :: JobType -> Text
jobTypeText FullTime = "Full time" | 65 | jobTypeText :: JobType -> Text
jobTypeText FullTime = "Full time" | 65 | jobTypeText FullTime = "Full time" | 34 | false | true | 0 | 5 | 9 | 22 | 10 | 12 | null | null |
sethfowler/pygmalion | tools/Pygmalion.hs | bsd-3-clause | queryCmd _ _ _ _ _ _ _ = usage | 30 | queryCmd _ _ _ _ _ _ _ = usage | 30 | queryCmd _ _ _ _ _ _ _ = usage | 30 | false | false | 0 | 5 | 9 | 21 | 10 | 11 | null | null |
gridaphobe/liquid-fixpoint | Setup.hs | bsd-3-clause | buildFixpoint _ _ pkg lbi = when build $ do
setEnv "Z3MEM" (show z3mem)
executeShellCommand "./configure"
executeShellCommand "./build.sh"
executeShellCommand "chmod a+x external/fixpoint/fixpoint.native"
where
allDirs = absoluteInstallDirs pkg lbi NoCopyDest
binDir = bindir allDirs ++ "/"
flags = configConfigurationsFlags $ configFlags lbi
z3mem = fromMaybe False $ lookup (FlagName "z3mem") flags
build = fromMaybe True $ lookup (FlagName "build-external") flags | 513 | buildFixpoint _ _ pkg lbi = when build $ do
setEnv "Z3MEM" (show z3mem)
executeShellCommand "./configure"
executeShellCommand "./build.sh"
executeShellCommand "chmod a+x external/fixpoint/fixpoint.native"
where
allDirs = absoluteInstallDirs pkg lbi NoCopyDest
binDir = bindir allDirs ++ "/"
flags = configConfigurationsFlags $ configFlags lbi
z3mem = fromMaybe False $ lookup (FlagName "z3mem") flags
build = fromMaybe True $ lookup (FlagName "build-external") flags | 513 | buildFixpoint _ _ pkg lbi = when build $ do
setEnv "Z3MEM" (show z3mem)
executeShellCommand "./configure"
executeShellCommand "./build.sh"
executeShellCommand "chmod a+x external/fixpoint/fixpoint.native"
where
allDirs = absoluteInstallDirs pkg lbi NoCopyDest
binDir = bindir allDirs ++ "/"
flags = configConfigurationsFlags $ configFlags lbi
z3mem = fromMaybe False $ lookup (FlagName "z3mem") flags
build = fromMaybe True $ lookup (FlagName "build-external") flags | 513 | false | false | 10 | 10 | 105 | 146 | 61 | 85 | null | null |
brendanhay/gogol | gogol-cloudiot/gen/Network/Google/CloudIOT/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Expr' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'eLocation'
--
-- * 'eExpression'
--
-- * 'eTitle'
--
-- * 'eDescription'
expr
:: Expr
expr =
Expr'
{ _eLocation = Nothing
, _eExpression = Nothing
, _eTitle = Nothing
, _eDescription = Nothing
} | 385 | expr
:: Expr
expr =
Expr'
{ _eLocation = Nothing
, _eExpression = Nothing
, _eTitle = Nothing
, _eDescription = Nothing
} | 147 | expr =
Expr'
{ _eLocation = Nothing
, _eExpression = Nothing
, _eTitle = Nothing
, _eDescription = Nothing
} | 130 | true | true | 0 | 7 | 94 | 58 | 36 | 22 | null | null |
patperry/lapack | tests/Driver.hs | bsd-3-clause | done :: String -> Int -> [[String]] -> IO ()
done mesg ntest stamps = putStr ( mesg ++ " " ++ show ntest ++ " tests" ++ table )
where
table = display
. map entry
. reverse
. sort
. map pairLength
. group
. sort
. filter (not . null)
$ stamps
display [] = ".\n"
display [x] = " (" ++ x ++ ").\n"
display xs = ".\n" ++ unlines (map (++ ".") xs)
pairLength xss@(xs:_) = (length xss, xs)
entry (n, xs) = percentage n ntest
++ " "
++ concat (intersperse ", " xs)
percentage n m = show ((100 * n) `div` m) ++ "%"
------------------------------------------------------------------------ | 772 | done :: String -> Int -> [[String]] -> IO ()
done mesg ntest stamps = putStr ( mesg ++ " " ++ show ntest ++ " tests" ++ table )
where
table = display
. map entry
. reverse
. sort
. map pairLength
. group
. sort
. filter (not . null)
$ stamps
display [] = ".\n"
display [x] = " (" ++ x ++ ").\n"
display xs = ".\n" ++ unlines (map (++ ".") xs)
pairLength xss@(xs:_) = (length xss, xs)
entry (n, xs) = percentage n ntest
++ " "
++ concat (intersperse ", " xs)
percentage n m = show ((100 * n) `div` m) ++ "%"
------------------------------------------------------------------------ | 772 | done mesg ntest stamps = putStr ( mesg ++ " " ++ show ntest ++ " tests" ++ table )
where
table = display
. map entry
. reverse
. sort
. map pairLength
. group
. sort
. filter (not . null)
$ stamps
display [] = ".\n"
display [x] = " (" ++ x ++ ").\n"
display xs = ".\n" ++ unlines (map (++ ".") xs)
pairLength xss@(xs:_) = (length xss, xs)
entry (n, xs) = percentage n ntest
++ " "
++ concat (intersperse ", " xs)
percentage n m = show ((100 * n) `div` m) ++ "%"
------------------------------------------------------------------------ | 727 | false | true | 24 | 10 | 305 | 315 | 143 | 172 | null | null |
jwbuurlage/category-theory-programmers | examples/catamorphisms/List.hs | mit | (<:>) :: a -> List a -> List a
(<:>) x xs = Fix (Cons x xs) | 59 | (<:>) :: a -> List a -> List a
(<:>) x xs = Fix (Cons x xs) | 59 | (<:>) x xs = Fix (Cons x xs) | 28 | false | true | 0 | 7 | 16 | 45 | 23 | 22 | null | null |
antalsz/hs-to-coq | src/lib/HsToCoq/ConvertHaskell/Expr.hs | mit | -- TODO: Mark converted unboxed tuples specially?
convertExpr_ (ExplicitTuple NOEXTP exprs _boxity) = do
-- TODO A tuple constructor in the Gallina grammar?
(tuple, args) <- runWriterT
. fmap (foldl1 . App2 $ "pair")
. for exprs $ unLoc <&> \case
Present NOEXTP e -> lift $ convertLExpr e
Missing PlaceHolder ->
do arg <- lift (genqid "arg")
Qualid arg <$ tell [arg]
#if __GLASGOW_HASKELL__ >= 806
XTupArg v -> noExtCon v
#endif
pure $ maybe id Fun (nonEmpty $ map (mkBinder Coq.Explicit . Ident) args) tuple | 660 | convertExpr_ (ExplicitTuple NOEXTP exprs _boxity) = do
-- TODO A tuple constructor in the Gallina grammar?
(tuple, args) <- runWriterT
. fmap (foldl1 . App2 $ "pair")
. for exprs $ unLoc <&> \case
Present NOEXTP e -> lift $ convertLExpr e
Missing PlaceHolder ->
do arg <- lift (genqid "arg")
Qualid arg <$ tell [arg]
#if __GLASGOW_HASKELL__ >= 806
XTupArg v -> noExtCon v
#endif
pure $ maybe id Fun (nonEmpty $ map (mkBinder Coq.Explicit . Ident) args) tuple | 610 | convertExpr_ (ExplicitTuple NOEXTP exprs _boxity) = do
-- TODO A tuple constructor in the Gallina grammar?
(tuple, args) <- runWriterT
. fmap (foldl1 . App2 $ "pair")
. for exprs $ unLoc <&> \case
Present NOEXTP e -> lift $ convertLExpr e
Missing PlaceHolder ->
do arg <- lift (genqid "arg")
Qualid arg <$ tell [arg]
#if __GLASGOW_HASKELL__ >= 806
XTupArg v -> noExtCon v
#endif
pure $ maybe id Fun (nonEmpty $ map (mkBinder Coq.Explicit . Ident) args) tuple | 610 | true | false | 0 | 17 | 238 | 183 | 87 | 96 | null | null |
li-zhirui/EoplLangs | src/CheckedLang/Parser.hs | bsd-3-clause | integer :: Parser Integer
integer = lexeme L.integer | 52 | integer :: Parser Integer
integer = lexeme L.integer | 52 | integer = lexeme L.integer | 26 | false | true | 0 | 6 | 7 | 25 | 10 | 15 | null | null |
eiji-a/aya | src/Aya/Scene-balls_in_room.hs | bsd-3-clause | floor3 = Material intensityZero (Color 0.6 0.5 1) colorBlack colorBlack colorBlack 0 0 | 86 | floor3 = Material intensityZero (Color 0.6 0.5 1) colorBlack colorBlack colorBlack 0 0 | 86 | floor3 = Material intensityZero (Color 0.6 0.5 1) colorBlack colorBlack colorBlack 0 0 | 86 | false | false | 0 | 7 | 12 | 31 | 15 | 16 | null | null |
jwaldmann/s | Tab/Bin.hs | gpl-3.0 | third (x,y,z) = z | 17 | third (x,y,z) = z | 17 | third (x,y,z) = z | 17 | false | false | 0 | 6 | 3 | 18 | 10 | 8 | null | null |
dagit/SpreadsheetML | src/Text/XML/SpreadsheetML/Builder.hs | bsd-3-clause | bool :: Bool -> Cell
bool b = emptyCell { cellData = Just (Boolean b) } | 71 | bool :: Bool -> Cell
bool b = emptyCell { cellData = Just (Boolean b) } | 71 | bool b = emptyCell { cellData = Just (Boolean b) } | 50 | false | true | 0 | 10 | 15 | 44 | 20 | 24 | null | null |
wujf/yesod | yesod-bin/main.hs | mit | extraCabalArgs :: Parser [String]
extraCabalArgs = many (strOption ( long "extra-cabal-arg" <> short 'e' <> metavar "ARG"
<> help "pass extra argument ARG to cabal")
) | 224 | extraCabalArgs :: Parser [String]
extraCabalArgs = many (strOption ( long "extra-cabal-arg" <> short 'e' <> metavar "ARG"
<> help "pass extra argument ARG to cabal")
) | 224 | extraCabalArgs = many (strOption ( long "extra-cabal-arg" <> short 'e' <> metavar "ARG"
<> help "pass extra argument ARG to cabal")
) | 190 | false | true | 0 | 12 | 82 | 53 | 25 | 28 | null | null |
k32/zenmaster | Control/Monad/Voretion.hs | unlicense | mhmcVE :: Float -> Sample () b -> [b]
mhmcVE ε x = undefined | 60 | mhmcVE :: Float -> Sample () b -> [b]
mhmcVE ε x = undefined | 60 | mhmcVE ε x = undefined | 22 | false | true | 0 | 8 | 13 | 34 | 17 | 17 | null | null |
DanielWaterworth/Idris-dev | src/Idris/WhoCalls.hs | bsd-3-clause | occursDef :: Name -> Def -> Bool
occursDef n (Function ty tm) = occurs n ty || occurs n tm | 90 | occursDef :: Name -> Def -> Bool
occursDef n (Function ty tm) = occurs n ty || occurs n tm | 90 | occursDef n (Function ty tm) = occurs n ty || occurs n tm | 57 | false | true | 0 | 10 | 19 | 51 | 23 | 28 | null | null |
asilvestre/haskell-neo4j-rest-client | src/Database/Neo4j/Traversal.hs | mit | -- | Generate the query string associated to a paging description
pagingQs :: TraversalPaging -> S.ByteString
pagingQs (TraversalPaging pSize leaseSecs) = "?pageSize=" <> showBs pSize <> "&leaseTime=" <> showBs leaseSecs
where showBs = fromString . show
-- | Perform a paged traversal and get the resulting nodes | 317 | pagingQs :: TraversalPaging -> S.ByteString
pagingQs (TraversalPaging pSize leaseSecs) = "?pageSize=" <> showBs pSize <> "&leaseTime=" <> showBs leaseSecs
where showBs = fromString . show
-- | Perform a paged traversal and get the resulting nodes | 251 | pagingQs (TraversalPaging pSize leaseSecs) = "?pageSize=" <> showBs pSize <> "&leaseTime=" <> showBs leaseSecs
where showBs = fromString . show
-- | Perform a paged traversal and get the resulting nodes | 207 | true | true | 0 | 8 | 51 | 59 | 30 | 29 | null | null |
gcampax/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | index_RDR = varQual_RDR gHC_ARR (fsLit "index") | 61 | index_RDR = varQual_RDR gHC_ARR (fsLit "index") | 61 | index_RDR = varQual_RDR gHC_ARR (fsLit "index") | 61 | false | false | 0 | 7 | 19 | 17 | 8 | 9 | null | null |
shlevy/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | tag2con_RDR dflags tycon = mk_tc_deriv_name dflags tycon mkTag2ConOcc | 69 | tag2con_RDR dflags tycon = mk_tc_deriv_name dflags tycon mkTag2ConOcc | 69 | tag2con_RDR dflags tycon = mk_tc_deriv_name dflags tycon mkTag2ConOcc | 69 | false | false | 0 | 5 | 7 | 18 | 8 | 10 | null | null |
liesen/osm-xapi | examples/Test.hs | lgpl-3.0 | name nwr = do node <- maybeToList $ foldNodeWayRelation nwr Just skip skip
tag <- node ^! tagsL
guard (tag ^! kL == "name")
let v = tag ^! vL
return $ Text.decodeUtf8 (C.pack v)
where
skip = const Nothing | 266 | name nwr = do node <- maybeToList $ foldNodeWayRelation nwr Just skip skip
tag <- node ^! tagsL
guard (tag ^! kL == "name")
let v = tag ^! vL
return $ Text.decodeUtf8 (C.pack v)
where
skip = const Nothing | 266 | name nwr = do node <- maybeToList $ foldNodeWayRelation nwr Just skip skip
tag <- node ^! tagsL
guard (tag ^! kL == "name")
let v = tag ^! vL
return $ Text.decodeUtf8 (C.pack v)
where
skip = const Nothing | 266 | false | false | 0 | 11 | 101 | 101 | 46 | 55 | null | null |
mattyw/forth | forth.hs | gpl-3.0 | lt [x] = error "not enough items" | 33 | lt [x] = error "not enough items" | 33 | lt [x] = error "not enough items" | 33 | false | false | 0 | 6 | 6 | 15 | 7 | 8 | null | null |
EXio4/netza | src/QuoteBot.hs | mit | randomQuote :: Config Loaded -> Channel -> IRC IO ()
randomQuote (database -> db) ch@(Channel (T.toLower -> chT)) = do
(xs :: [(Integer,Text)]) <- liftIO $ do
[DB.Only (cnt :: Integer)] <- DB.queryNamed db "SELECT COUNT(*) AS cnt FROM quotes WHERE channel=:channel"
[":channel" := chT]
n <- Rand.randomRIO (0, cnt-1)
DB.queryNamed db "SELECT quote_id, quote FROM quotes WHERE channel=:channel LIMIT :qid, 1"
[":qid" := n
,":channel" := chT]
privmsg ch . Message $ case xs of
[] -> "No quotes in database"
[(q_id, txt)] -> "#" <> T.pack (show q_id) <> " " <> txt
xs -> "ERR! " <> T.pack (show xs) | 824 | randomQuote :: Config Loaded -> Channel -> IRC IO ()
randomQuote (database -> db) ch@(Channel (T.toLower -> chT)) = do
(xs :: [(Integer,Text)]) <- liftIO $ do
[DB.Only (cnt :: Integer)] <- DB.queryNamed db "SELECT COUNT(*) AS cnt FROM quotes WHERE channel=:channel"
[":channel" := chT]
n <- Rand.randomRIO (0, cnt-1)
DB.queryNamed db "SELECT quote_id, quote FROM quotes WHERE channel=:channel LIMIT :qid, 1"
[":qid" := n
,":channel" := chT]
privmsg ch . Message $ case xs of
[] -> "No quotes in database"
[(q_id, txt)] -> "#" <> T.pack (show q_id) <> " " <> txt
xs -> "ERR! " <> T.pack (show xs) | 824 | randomQuote (database -> db) ch@(Channel (T.toLower -> chT)) = do
(xs :: [(Integer,Text)]) <- liftIO $ do
[DB.Only (cnt :: Integer)] <- DB.queryNamed db "SELECT COUNT(*) AS cnt FROM quotes WHERE channel=:channel"
[":channel" := chT]
n <- Rand.randomRIO (0, cnt-1)
DB.queryNamed db "SELECT quote_id, quote FROM quotes WHERE channel=:channel LIMIT :qid, 1"
[":qid" := n
,":channel" := chT]
privmsg ch . Message $ case xs of
[] -> "No quotes in database"
[(q_id, txt)] -> "#" <> T.pack (show q_id) <> " " <> txt
xs -> "ERR! " <> T.pack (show xs) | 771 | false | true | 22 | 11 | 331 | 237 | 129 | 108 | null | null |
ecaustin/haskhol-math | src/HaskHOL/Lib/Pair/Base.hs | bsd-2-clause | addDefinitions :: [(Text, HOLThm)] -> Update Definitions ()
addDefinitions m =
put (Definitions (mapFromList m)) | 116 | addDefinitions :: [(Text, HOLThm)] -> Update Definitions ()
addDefinitions m =
put (Definitions (mapFromList m)) | 116 | addDefinitions m =
put (Definitions (mapFromList m)) | 56 | false | true | 0 | 9 | 18 | 49 | 25 | 24 | null | null |
jrpotter/lodestar | lodes/Hashing/MD5/MD5.hs | apache-2.0 | pad :: String -> B.ByteString
pad s = let b = B.snoc (toByteString s) 1
l = 8 * B.length b
r = 448 + 512 * (l `quot` 448) - l
m = B.append b (B.take (r `quot` 8) (B.repeat 0))
in B.append m (B.pack . toWord8 $ l - 8) | 260 | pad :: String -> B.ByteString
pad s = let b = B.snoc (toByteString s) 1
l = 8 * B.length b
r = 448 + 512 * (l `quot` 448) - l
m = B.append b (B.take (r `quot` 8) (B.repeat 0))
in B.append m (B.pack . toWord8 $ l - 8) | 260 | pad s = let b = B.snoc (toByteString s) 1
l = 8 * B.length b
r = 448 + 512 * (l `quot` 448) - l
m = B.append b (B.take (r `quot` 8) (B.repeat 0))
in B.append m (B.pack . toWord8 $ l - 8) | 230 | false | true | 0 | 14 | 95 | 150 | 77 | 73 | null | null |
schell/lamdu | Lamdu/Sugar/Convert/Hole.hs | gpl-3.0 | combineLamGuids :: (a -> Guid) -> Expr.Expression def a -> Expr.Expression def a
combineLamGuids getGuid =
go Map.empty
where
go renames (Expr.Expression body a) =
-- TODO: Lens.outside
(`Expr.Expression` a) $
case body of
Expr.BodyLeaf (Expr.GetVariable (Expr.ParameterRef paramGuid))
| Just newParamGuid <- Map.lookup paramGuid renames ->
ExprLens.bodyParameterRef # newParamGuid
Expr.BodyLam (Expr.Lam k paramGuid paramType result) ->
Expr.BodyLam
(Expr.Lam k newParamGuid
(go renames paramType)
(go (Map.insert paramGuid newParamGuid renames) result))
where
newParamGuid = Guid.combine (getGuid a) paramGuid
_ -> go renames <$> body | 750 | combineLamGuids :: (a -> Guid) -> Expr.Expression def a -> Expr.Expression def a
combineLamGuids getGuid =
go Map.empty
where
go renames (Expr.Expression body a) =
-- TODO: Lens.outside
(`Expr.Expression` a) $
case body of
Expr.BodyLeaf (Expr.GetVariable (Expr.ParameterRef paramGuid))
| Just newParamGuid <- Map.lookup paramGuid renames ->
ExprLens.bodyParameterRef # newParamGuid
Expr.BodyLam (Expr.Lam k paramGuid paramType result) ->
Expr.BodyLam
(Expr.Lam k newParamGuid
(go renames paramType)
(go (Map.insert paramGuid newParamGuid renames) result))
where
newParamGuid = Guid.combine (getGuid a) paramGuid
_ -> go renames <$> body | 750 | combineLamGuids getGuid =
go Map.empty
where
go renames (Expr.Expression body a) =
-- TODO: Lens.outside
(`Expr.Expression` a) $
case body of
Expr.BodyLeaf (Expr.GetVariable (Expr.ParameterRef paramGuid))
| Just newParamGuid <- Map.lookup paramGuid renames ->
ExprLens.bodyParameterRef # newParamGuid
Expr.BodyLam (Expr.Lam k paramGuid paramType result) ->
Expr.BodyLam
(Expr.Lam k newParamGuid
(go renames paramType)
(go (Map.insert paramGuid newParamGuid renames) result))
where
newParamGuid = Guid.combine (getGuid a) paramGuid
_ -> go renames <$> body | 669 | false | true | 0 | 16 | 195 | 246 | 120 | 126 | null | null |
endhrk/whois-haskell | Network/Whois.hs | bsd-3-clause | getWhoisServer :: String -> String
getWhoisServer _ = "192.41.192.40" | 69 | getWhoisServer :: String -> String
getWhoisServer _ = "192.41.192.40" | 69 | getWhoisServer _ = "192.41.192.40" | 34 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
tonymorris/language-javascript | src/Language/JavaScript/Parser/AST.hs | bsd-3-clause | showStrippedNode (JSUnary s _x) = "JSUnary " ++ show s | 54 | showStrippedNode (JSUnary s _x) = "JSUnary " ++ show s | 54 | showStrippedNode (JSUnary s _x) = "JSUnary " ++ show s | 54 | false | false | 0 | 7 | 9 | 24 | 11 | 13 | null | null |
expipiplus1/vulkan | generate-new/src/Spec/Parse.hs | bsd-3-clause | parseEnums :: [Content] -> [Content] -> P (Vector Enum')
parseEnums types es = do
flagNameMap <- Map.fromList <$> sequence
[ do
f <- decodeName bits
b <- nameElem "bitmask" n
typeElem <- traverse decode (elemText "type" n)
w <- case typeElem of
Nothing -> throw ("No type found for bitmask: " <> show bits)
Just "VkFlags" -> pure Bitmask32
Just "VkFlags64" -> pure Bitmask64
Just "XrFlags32" -> pure Bitmask32
Just "XrFlags64" -> pure Bitmask64
Just _ -> throw ("Unexpected type for bitmask: " <> show bits)
pure (f, (b, w))
| Element n <- types
, "type" == name n
, not (isAlias n)
, Just bits <- pure $ getAttr "requires" n <|> getAttr "bitvalues" n
, Just "bitmask" <- pure $ getAttr "category" n
]
fromList . catMaybes <$> traverseV
(uncurry
(parseEnum (fmap snd . (`Map.lookup` flagNameMap))
(fmap fst . (`Map.lookup` flagNameMap))
False
)
)
[ (isBitmask, n)
| Element n <- es
, name n == "enums"
, Just t <- pure (getAttr "type" n)
, let isBitmask = t == "bitmask"
isEnum = t == "enum"
, isBitmask || isEnum
]
where
parseEnum
:: (CName -> Maybe BitmaskWidth)
-> (CName -> Maybe CName)
-> Bool
-> Bool
-> Node
-> P (Maybe Enum')
parseEnum getBitmaskWidth getFlagsName evIsExtension isBitmask n = do
eName <- nameAttr "enum" n
if isForbidden eName
then pure Nothing
else Just <$> do
eValues <- fromList <$> traverseV
(context (unCName eName) . parseValue)
[ e | Element e <- contents n, name e == "enum", not (isAlias e) ]
eType <- if isBitmask
-- If we can't find the flags name, use the bits name
then do
width <- note ("No width found for bitmask: " <> unCName eName)
(getBitmaskWidth eName)
pure $ ABitmask (fromMaybe eName (getFlagsName eName)) width
else pure AnEnum
pure Enum { .. }
where
parseValue :: Node -> P EnumValue
parseValue v = do
evName <- nameAttr "enum value" v
evValue <- case getAttr "value" v of
Just b -> readP b
Nothing -> (0x1 `shiftL`) <$> readAttr "bitpos" v
pure EnumValue { .. } | 2,397 | parseEnums :: [Content] -> [Content] -> P (Vector Enum')
parseEnums types es = do
flagNameMap <- Map.fromList <$> sequence
[ do
f <- decodeName bits
b <- nameElem "bitmask" n
typeElem <- traverse decode (elemText "type" n)
w <- case typeElem of
Nothing -> throw ("No type found for bitmask: " <> show bits)
Just "VkFlags" -> pure Bitmask32
Just "VkFlags64" -> pure Bitmask64
Just "XrFlags32" -> pure Bitmask32
Just "XrFlags64" -> pure Bitmask64
Just _ -> throw ("Unexpected type for bitmask: " <> show bits)
pure (f, (b, w))
| Element n <- types
, "type" == name n
, not (isAlias n)
, Just bits <- pure $ getAttr "requires" n <|> getAttr "bitvalues" n
, Just "bitmask" <- pure $ getAttr "category" n
]
fromList . catMaybes <$> traverseV
(uncurry
(parseEnum (fmap snd . (`Map.lookup` flagNameMap))
(fmap fst . (`Map.lookup` flagNameMap))
False
)
)
[ (isBitmask, n)
| Element n <- es
, name n == "enums"
, Just t <- pure (getAttr "type" n)
, let isBitmask = t == "bitmask"
isEnum = t == "enum"
, isBitmask || isEnum
]
where
parseEnum
:: (CName -> Maybe BitmaskWidth)
-> (CName -> Maybe CName)
-> Bool
-> Bool
-> Node
-> P (Maybe Enum')
parseEnum getBitmaskWidth getFlagsName evIsExtension isBitmask n = do
eName <- nameAttr "enum" n
if isForbidden eName
then pure Nothing
else Just <$> do
eValues <- fromList <$> traverseV
(context (unCName eName) . parseValue)
[ e | Element e <- contents n, name e == "enum", not (isAlias e) ]
eType <- if isBitmask
-- If we can't find the flags name, use the bits name
then do
width <- note ("No width found for bitmask: " <> unCName eName)
(getBitmaskWidth eName)
pure $ ABitmask (fromMaybe eName (getFlagsName eName)) width
else pure AnEnum
pure Enum { .. }
where
parseValue :: Node -> P EnumValue
parseValue v = do
evName <- nameAttr "enum value" v
evValue <- case getAttr "value" v of
Just b -> readP b
Nothing -> (0x1 `shiftL`) <$> readAttr "bitpos" v
pure EnumValue { .. } | 2,397 | parseEnums types es = do
flagNameMap <- Map.fromList <$> sequence
[ do
f <- decodeName bits
b <- nameElem "bitmask" n
typeElem <- traverse decode (elemText "type" n)
w <- case typeElem of
Nothing -> throw ("No type found for bitmask: " <> show bits)
Just "VkFlags" -> pure Bitmask32
Just "VkFlags64" -> pure Bitmask64
Just "XrFlags32" -> pure Bitmask32
Just "XrFlags64" -> pure Bitmask64
Just _ -> throw ("Unexpected type for bitmask: " <> show bits)
pure (f, (b, w))
| Element n <- types
, "type" == name n
, not (isAlias n)
, Just bits <- pure $ getAttr "requires" n <|> getAttr "bitvalues" n
, Just "bitmask" <- pure $ getAttr "category" n
]
fromList . catMaybes <$> traverseV
(uncurry
(parseEnum (fmap snd . (`Map.lookup` flagNameMap))
(fmap fst . (`Map.lookup` flagNameMap))
False
)
)
[ (isBitmask, n)
| Element n <- es
, name n == "enums"
, Just t <- pure (getAttr "type" n)
, let isBitmask = t == "bitmask"
isEnum = t == "enum"
, isBitmask || isEnum
]
where
parseEnum
:: (CName -> Maybe BitmaskWidth)
-> (CName -> Maybe CName)
-> Bool
-> Bool
-> Node
-> P (Maybe Enum')
parseEnum getBitmaskWidth getFlagsName evIsExtension isBitmask n = do
eName <- nameAttr "enum" n
if isForbidden eName
then pure Nothing
else Just <$> do
eValues <- fromList <$> traverseV
(context (unCName eName) . parseValue)
[ e | Element e <- contents n, name e == "enum", not (isAlias e) ]
eType <- if isBitmask
-- If we can't find the flags name, use the bits name
then do
width <- note ("No width found for bitmask: " <> unCName eName)
(getBitmaskWidth eName)
pure $ ABitmask (fromMaybe eName (getFlagsName eName)) width
else pure AnEnum
pure Enum { .. }
where
parseValue :: Node -> P EnumValue
parseValue v = do
evName <- nameAttr "enum value" v
evValue <- case getAttr "value" v of
Just b -> readP b
Nothing -> (0x1 `shiftL`) <$> readAttr "bitpos" v
pure EnumValue { .. } | 2,340 | false | true | 0 | 20 | 830 | 811 | 388 | 423 | null | null |
agocorona/Workflow | Control/Workflow/Patterns.hs | bsd-3-clause | -- | spawn a list of workflows and reduces the results according with the 'comp' parameter within a given timeout
--
-- @
-- vote timeout actions comp x=
-- split actions x >>= select timeout (const $ return Select) >>= comp
-- @
vote
:: ( Serialize b
-- , Serialize [b]
, Typeable b
, HasFork io
, CMC.MonadMask io)
=> Integer
-> [a -> Workflow io b]
-> ([b] -> Workflow io c)
-> a
-> Workflow io c
vote timeout actions comp x=
split actions x >>= select timeout (const $ return Continue) >>= comp | 585 | vote
:: ( Serialize b
-- , Serialize [b]
, Typeable b
, HasFork io
, CMC.MonadMask io)
=> Integer
-> [a -> Workflow io b]
-> ([b] -> Workflow io c)
-> a
-> Workflow io c
vote timeout actions comp x=
split actions x >>= select timeout (const $ return Continue) >>= comp | 344 | vote timeout actions comp x=
split actions x >>= select timeout (const $ return Continue) >>= comp | 102 | true | true | 0 | 11 | 185 | 132 | 69 | 63 | null | null |
xnning/fcore | lib/typeCheck/TypeCheck.hs | bsd-2-clause | checkExpr (L loc (Dot e x (Just ([arg], _)))) =
do (t, _) <- checkExpr e
case deThunkOnce t of
JType (JClass _) -> checkExpr (L loc $ JMethod (NonStatic e) x [arg] undefined)
RecordType _ -> checkExpr (L loc $ App (L loc $ RecordProj e x) arg)
And _ _ -> checkExpr (L loc $ App (L loc $ RecordProj e x) arg)
_ -> throwError (NotMember x t `withExpr` e) -- TODO: should be x's loc
-- e.x (a,...) | 458 | checkExpr (L loc (Dot e x (Just ([arg], _)))) =
do (t, _) <- checkExpr e
case deThunkOnce t of
JType (JClass _) -> checkExpr (L loc $ JMethod (NonStatic e) x [arg] undefined)
RecordType _ -> checkExpr (L loc $ App (L loc $ RecordProj e x) arg)
And _ _ -> checkExpr (L loc $ App (L loc $ RecordProj e x) arg)
_ -> throwError (NotMember x t `withExpr` e) -- TODO: should be x's loc
-- e.x (a,...) | 458 | checkExpr (L loc (Dot e x (Just ([arg], _)))) =
do (t, _) <- checkExpr e
case deThunkOnce t of
JType (JClass _) -> checkExpr (L loc $ JMethod (NonStatic e) x [arg] undefined)
RecordType _ -> checkExpr (L loc $ App (L loc $ RecordProj e x) arg)
And _ _ -> checkExpr (L loc $ App (L loc $ RecordProj e x) arg)
_ -> throwError (NotMember x t `withExpr` e) -- TODO: should be x's loc
-- e.x (a,...) | 458 | false | false | 0 | 16 | 145 | 225 | 109 | 116 | null | null |
SKA-ScienceDataProcessor/RC | MS6/programs/imaging.hs | apache-2.0 | -- By default images and grids are always consumed by the caller, as
-- they are large objects with lots of write operations, and we don't
-- want to duplicate them.
imgRepr :: ImageRepr
imgRepr = ImageRepr $ VectorRepr WriteAccess | 231 | imgRepr :: ImageRepr
imgRepr = ImageRepr $ VectorRepr WriteAccess | 65 | imgRepr = ImageRepr $ VectorRepr WriteAccess | 44 | true | true | 2 | 6 | 39 | 29 | 13 | 16 | null | null |
cservenka/ROOPLPPC | src/CodeGenerator.hs | mit | cgStatement Skip = return [] | 28 | cgStatement Skip = return [] | 28 | cgStatement Skip = return [] | 28 | false | false | 0 | 6 | 4 | 14 | 6 | 8 | null | null |
creswick/HaVSA | src/AI/VersionSpaces.hs | bsd-3-clause | hypotheses (Join vs1 vs2) = zipWith (***) (hypotheses vs1) (hypotheses vs2) | 79 | hypotheses (Join vs1 vs2) = zipWith (***) (hypotheses vs1) (hypotheses vs2) | 79 | hypotheses (Join vs1 vs2) = zipWith (***) (hypotheses vs1) (hypotheses vs2) | 79 | false | false | 0 | 7 | 14 | 38 | 19 | 19 | null | null |
tolysz/prepare-ghcjs | spec-lts8/cabal/Cabal/Distribution/Simple/Utils.hs | bsd-3-clause | dropExeExtension :: FilePath -> FilePath
dropExeExtension filepath =
case splitExtension filepath of
(filepath', extension) | extension `elem` exeExtensions -> filepath'
| otherwise -> filepath
-- | List of possible executable file extensions on the current platform. | 322 | dropExeExtension :: FilePath -> FilePath
dropExeExtension filepath =
case splitExtension filepath of
(filepath', extension) | extension `elem` exeExtensions -> filepath'
| otherwise -> filepath
-- | List of possible executable file extensions on the current platform. | 322 | dropExeExtension filepath =
case splitExtension filepath of
(filepath', extension) | extension `elem` exeExtensions -> filepath'
| otherwise -> filepath
-- | List of possible executable file extensions on the current platform. | 281 | false | true | 2 | 8 | 90 | 57 | 29 | 28 | null | null |
green-haskell/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | genCondJump' :: Bool -> BlockId -> CmmExpr -> NatM InstrBlock
-- 64-bit integer comparisons on 32-bit
genCondJump' is32Bit true (CmmMachOp mop [e1,e2])
| is32Bit, Just W64 <- maybeIntComparison mop = do
ChildCode64 code1 r1_lo <- iselExpr64 e1
ChildCode64 code2 r2_lo <- iselExpr64 e2
let r1_hi = getHiVRegFromLo r1_lo
r2_hi = getHiVRegFromLo r2_lo
cond = machOpToCond mop
Just cond' = maybeFlipCond cond
false <- getBlockIdNat
return $ code1 `appOL` code2 `appOL` toOL [
CMP II32 (OpReg r2_hi) (OpReg r1_hi),
JXX cond true,
JXX cond' false,
CMP II32 (OpReg r2_lo) (OpReg r1_lo),
JXX cond true,
NEWBLOCK false ] | 666 | genCondJump' :: Bool -> BlockId -> CmmExpr -> NatM InstrBlock
genCondJump' is32Bit true (CmmMachOp mop [e1,e2])
| is32Bit, Just W64 <- maybeIntComparison mop = do
ChildCode64 code1 r1_lo <- iselExpr64 e1
ChildCode64 code2 r2_lo <- iselExpr64 e2
let r1_hi = getHiVRegFromLo r1_lo
r2_hi = getHiVRegFromLo r2_lo
cond = machOpToCond mop
Just cond' = maybeFlipCond cond
false <- getBlockIdNat
return $ code1 `appOL` code2 `appOL` toOL [
CMP II32 (OpReg r2_hi) (OpReg r1_hi),
JXX cond true,
JXX cond' false,
CMP II32 (OpReg r2_lo) (OpReg r1_lo),
JXX cond true,
NEWBLOCK false ] | 625 | genCondJump' is32Bit true (CmmMachOp mop [e1,e2])
| is32Bit, Just W64 <- maybeIntComparison mop = do
ChildCode64 code1 r1_lo <- iselExpr64 e1
ChildCode64 code2 r2_lo <- iselExpr64 e2
let r1_hi = getHiVRegFromLo r1_lo
r2_hi = getHiVRegFromLo r2_lo
cond = machOpToCond mop
Just cond' = maybeFlipCond cond
false <- getBlockIdNat
return $ code1 `appOL` code2 `appOL` toOL [
CMP II32 (OpReg r2_hi) (OpReg r1_hi),
JXX cond true,
JXX cond' false,
CMP II32 (OpReg r2_lo) (OpReg r1_lo),
JXX cond true,
NEWBLOCK false ] | 563 | true | true | 0 | 14 | 150 | 246 | 116 | 130 | null | null |
stevedonnelly/haskell | code/Prelude/Extensions.hs | mit | cond = \conditions default_value -> let
current = (head conditions)
recurse = (cond (tail conditions) default_value)
in (ifElse (List.null conditions) default_value (ifElse (fst current) (snd current) recurse)) | 222 | cond = \conditions default_value -> let
current = (head conditions)
recurse = (cond (tail conditions) default_value)
in (ifElse (List.null conditions) default_value (ifElse (fst current) (snd current) recurse)) | 222 | cond = \conditions default_value -> let
current = (head conditions)
recurse = (cond (tail conditions) default_value)
in (ifElse (List.null conditions) default_value (ifElse (fst current) (snd current) recurse)) | 222 | false | false | 0 | 13 | 38 | 89 | 45 | 44 | null | null |
michaelficarra/purescript | src/Language/PureScript/TypeChecker/Skolems.hs | mit | skolemEscapeCheck :: (MonadError MultipleErrors m, MonadState CheckState m) => Expr -> m ()
skolemEscapeCheck (TypedValue False _ _) = return () | 144 | skolemEscapeCheck :: (MonadError MultipleErrors m, MonadState CheckState m) => Expr -> m ()
skolemEscapeCheck (TypedValue False _ _) = return () | 144 | skolemEscapeCheck (TypedValue False _ _) = return () | 52 | false | true | 0 | 8 | 20 | 62 | 29 | 33 | null | null |
HaskellAmbiguity/AmbiguityGenerator | src/Ambiguity.hs | mit | toContinuous :: (RealFrac a, Num b, RealFrac b) => (a, a) -> b -> a
toContinuous (lo, hi) x
| lo > hi = toContinuous (hi, lo) x
| otherwise = (realToFrac x) `mod'` (hi - lo + 1) + lo | 186 | toContinuous :: (RealFrac a, Num b, RealFrac b) => (a, a) -> b -> a
toContinuous (lo, hi) x
| lo > hi = toContinuous (hi, lo) x
| otherwise = (realToFrac x) `mod'` (hi - lo + 1) + lo | 186 | toContinuous (lo, hi) x
| lo > hi = toContinuous (hi, lo) x
| otherwise = (realToFrac x) `mod'` (hi - lo + 1) + lo | 118 | false | true | 0 | 10 | 44 | 122 | 62 | 60 | null | null |
riottracker/modfile | examples/testXM.hs | bsd-3-clause | main :: IO ()
main = do
file <- BL.getContents
let xm0 = runGet getModule file
xm1 = runGet getModule $ runPut $ putModule xm0
if xm0 == xm1 then
putStrLn "xm0 and xm1 are identical"
else
putStrLn "xm0 and xm1 differ" | 253 | main :: IO ()
main = do
file <- BL.getContents
let xm0 = runGet getModule file
xm1 = runGet getModule $ runPut $ putModule xm0
if xm0 == xm1 then
putStrLn "xm0 and xm1 are identical"
else
putStrLn "xm0 and xm1 differ" | 253 | main = do
file <- BL.getContents
let xm0 = runGet getModule file
xm1 = runGet getModule $ runPut $ putModule xm0
if xm0 == xm1 then
putStrLn "xm0 and xm1 are identical"
else
putStrLn "xm0 and xm1 differ" | 239 | false | true | 1 | 13 | 77 | 83 | 37 | 46 | null | null |
Bodigrim/katas | src/haskell/4-Roman-Numerals-Decoder.hs | bsd-2-clause | solution ('I':'X':xs) = 9 + solution xs | 39 | solution ('I':'X':xs) = 9 + solution xs | 39 | solution ('I':'X':xs) = 9 + solution xs | 39 | false | false | 0 | 8 | 6 | 27 | 13 | 14 | null | null |
spechub/Hets | LF/Sign.hs | gpl-2.0 | printExp (Pi ds e) = sep [braces $ printContext ds, pretty e] | 61 | printExp (Pi ds e) = sep [braces $ printContext ds, pretty e] | 61 | printExp (Pi ds e) = sep [braces $ printContext ds, pretty e] | 61 | false | false | 0 | 8 | 11 | 36 | 17 | 19 | null | null |
gspia/reflex-dom-htmlea | lib/src/Reflex/Dom/HTML5/Component/Tree/ActNode.hs | bsd-3-clause | listenMyParent ∷ forall t r. Reflex t
⇒ ActiveState t ActNode r
→ ActiveState t ActNode r
listenMyParent me = me & \d → d {_activeStateListen = constDyn ag}
where
pth = getPath (_activeStateElemId me)
ag = ActiveGroup $ Set.fromList elems2listen
elems2listen =
if null pth
then [ActNnone]
else ActNpath <$> [take (length pth - 1) pth, pth]
--------------------------------------------------------------------------------
-- | Internal helper. | 524 | listenMyParent ∷ forall t r. Reflex t
⇒ ActiveState t ActNode r
→ ActiveState t ActNode r
listenMyParent me = me & \d → d {_activeStateListen = constDyn ag}
where
pth = getPath (_activeStateElemId me)
ag = ActiveGroup $ Set.fromList elems2listen
elems2listen =
if null pth
then [ActNnone]
else ActNpath <$> [take (length pth - 1) pth, pth]
--------------------------------------------------------------------------------
-- | Internal helper. | 524 | listenMyParent me = me & \d → d {_activeStateListen = constDyn ag}
where
pth = getPath (_activeStateElemId me)
ag = ActiveGroup $ Set.fromList elems2listen
elems2listen =
if null pth
then [ActNnone]
else ActNpath <$> [take (length pth - 1) pth, pth]
--------------------------------------------------------------------------------
-- | Internal helper. | 400 | false | true | 9 | 10 | 144 | 159 | 75 | 84 | null | null |
alphalambda/k12math | prog/demo/anim01equilateral.hs | mit | myAnimation points frame =
animFromOn frame 1 (drawPointsLabels [a,b] ["A","B"]) &
animFromOn frame 2 (drawSegment (a,b)) &
animFromTo frame 3 7 (drawCircle (a,b)) &
animFromTo frame 4 7 (drawCircle (b,a)) &
animFromOn frame 5 (drawPointLabel c "C") &
animFromOn frame 6 (drawSegment (b,c)) &
animFromOn frame 7 (drawSegment (c,a)) &
animFromTo frame 1 7
(message $ "Animated Equilateral Drawing [" ++ show frame ++ "]") &
animFromOn frame 8 (message "Animated Equilateral Drawing")
where
[a,b] = take 2 points
[c,d] = circle_circle (a,b) (b,a) | 618 | myAnimation points frame =
animFromOn frame 1 (drawPointsLabels [a,b] ["A","B"]) &
animFromOn frame 2 (drawSegment (a,b)) &
animFromTo frame 3 7 (drawCircle (a,b)) &
animFromTo frame 4 7 (drawCircle (b,a)) &
animFromOn frame 5 (drawPointLabel c "C") &
animFromOn frame 6 (drawSegment (b,c)) &
animFromOn frame 7 (drawSegment (c,a)) &
animFromTo frame 1 7
(message $ "Animated Equilateral Drawing [" ++ show frame ++ "]") &
animFromOn frame 8 (message "Animated Equilateral Drawing")
where
[a,b] = take 2 points
[c,d] = circle_circle (a,b) (b,a) | 618 | myAnimation points frame =
animFromOn frame 1 (drawPointsLabels [a,b] ["A","B"]) &
animFromOn frame 2 (drawSegment (a,b)) &
animFromTo frame 3 7 (drawCircle (a,b)) &
animFromTo frame 4 7 (drawCircle (b,a)) &
animFromOn frame 5 (drawPointLabel c "C") &
animFromOn frame 6 (drawSegment (b,c)) &
animFromOn frame 7 (drawSegment (c,a)) &
animFromTo frame 1 7
(message $ "Animated Equilateral Drawing [" ++ show frame ++ "]") &
animFromOn frame 8 (message "Animated Equilateral Drawing")
where
[a,b] = take 2 points
[c,d] = circle_circle (a,b) (b,a) | 618 | false | false | 1 | 9 | 157 | 300 | 141 | 159 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.