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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lukexi/ghc | testsuite/tests/simplCore/should_compile/spec001.hs | bsd-3-clause | pack :: String -> PackedString
pack str = packLen (Prelude.length str) str | 74 | pack :: String -> PackedString
pack str = packLen (Prelude.length str) str | 74 | pack str = packLen (Prelude.length str) str | 43 | false | true | 0 | 8 | 11 | 31 | 15 | 16 | null | null |
tolysz/prepare-ghcjs | spec-lts8/base/GHC/Enum.hs | bsd-3-clause | efdtInt :: Int# -> Int# -> Int# -> [Int]
-- [x1,x2..y]
efdtInt x1 x2 y
| isTrue# (x2 >=# x1) = efdtIntUp x1 x2 y
| otherwise = efdtIntDn x1 x2 y | 156 | efdtInt :: Int# -> Int# -> Int# -> [Int]
efdtInt x1 x2 y
| isTrue# (x2 >=# x1) = efdtIntUp x1 x2 y
| otherwise = efdtIntDn x1 x2 y | 142 | efdtInt x1 x2 y
| isTrue# (x2 >=# x1) = efdtIntUp x1 x2 y
| otherwise = efdtIntDn x1 x2 y | 101 | true | true | 1 | 10 | 43 | 71 | 35 | 36 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Vector.Unboxed.hs | bsd-3-clause | lastM = G.lastM | 15 | lastM = G.lastM | 15 | lastM = G.lastM | 15 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
aelve/hslibs | src/Guide/Views.hs | bsd-3-clause | {- previous version of the subtitle
-----------------------------------
div_ [class_ "subtitle"] $ do
"alpha version • don't post on Reddit yet"
lift (asks _discussLink) >>= \case
Nothing -> return ()
Just l -> " • " >> mkLink "discuss the site" l
-}
-- | Render the main page (<https://guide.aelve.com>).
renderRoot :: (MonadIO m, MonadReader Config m) => HtmlT m ()
renderRoot = do
wrapPage "Aelve Guide" $ do
h1_ "Aelve Guide"
renderSubtitle
h2_ (mkLink "Haskell" "/haskell")
-- | Render the administration panel (</admin>). | 570 | renderRoot :: (MonadIO m, MonadReader Config m) => HtmlT m ()
renderRoot = do
wrapPage "Aelve Guide" $ do
h1_ "Aelve Guide"
renderSubtitle
h2_ (mkLink "Haskell" "/haskell")
-- | Render the administration panel (</admin>). | 236 | renderRoot = do
wrapPage "Aelve Guide" $ do
h1_ "Aelve Guide"
renderSubtitle
h2_ (mkLink "Haskell" "/haskell")
-- | Render the administration panel (</admin>). | 174 | true | true | 0 | 13 | 125 | 77 | 35 | 42 | null | null |
GaloisInc/halvm-ghc | compiler/nativeGen/PPC/Ppr.hs | bsd-3-clause | pprTypeAndSizeDecl :: CLabel -> SDoc
pprTypeAndSizeDecl lbl
= sdocWithPlatform $ \platform ->
if platformOS platform == OSLinux && externallyVisibleCLabel lbl
then text ".type " <>
ppr lbl <> text ", @object"
else empty | 242 | pprTypeAndSizeDecl :: CLabel -> SDoc
pprTypeAndSizeDecl lbl
= sdocWithPlatform $ \platform ->
if platformOS platform == OSLinux && externallyVisibleCLabel lbl
then text ".type " <>
ppr lbl <> text ", @object"
else empty | 242 | pprTypeAndSizeDecl lbl
= sdocWithPlatform $ \platform ->
if platformOS platform == OSLinux && externallyVisibleCLabel lbl
then text ".type " <>
ppr lbl <> text ", @object"
else empty | 205 | false | true | 0 | 10 | 55 | 66 | 32 | 34 | null | null |
apyrgio/ganeti | test/hs/Test/Ganeti/TestHelper.hs | bsd-2-clause | -- | Builds an arbitrary instance for a regular data type (i.e. not Bounded).
mkRegularArbitrary :: Name -> [Con] -> Q [Dec]
mkRegularArbitrary name cons = do
expr <- case cons of
[] -> fail "Can't make Arbitrary instance for an empty data type"
[x] -> return $ mkConsArbitrary (conInfo x)
xs -> appE (varE 'oneof) $
listE (map (return . mkConsArbitrary . conInfo) xs)
return [InstanceD [] (AppT (ConT ''Arbitrary) (ConT name))
[ValD (VarP 'arbitrary) (NormalB expr) []]]
-- | Builds a default Arbitrary instance for a type. This requires
-- that all members are of types that already have Arbitrary
-- instances, and that the arbitrary instances are well behaved
-- (w.r.t. recursive data structures, or similar concerns). In that
-- sense, this is not appropriate for all data types, just those that
-- are simple but very repetitive or have many simple fields. | 932 | mkRegularArbitrary :: Name -> [Con] -> Q [Dec]
mkRegularArbitrary name cons = do
expr <- case cons of
[] -> fail "Can't make Arbitrary instance for an empty data type"
[x] -> return $ mkConsArbitrary (conInfo x)
xs -> appE (varE 'oneof) $
listE (map (return . mkConsArbitrary . conInfo) xs)
return [InstanceD [] (AppT (ConT ''Arbitrary) (ConT name))
[ValD (VarP 'arbitrary) (NormalB expr) []]]
-- | Builds a default Arbitrary instance for a type. This requires
-- that all members are of types that already have Arbitrary
-- instances, and that the arbitrary instances are well behaved
-- (w.r.t. recursive data structures, or similar concerns). In that
-- sense, this is not appropriate for all data types, just those that
-- are simple but very repetitive or have many simple fields. | 854 | mkRegularArbitrary name cons = do
expr <- case cons of
[] -> fail "Can't make Arbitrary instance for an empty data type"
[x] -> return $ mkConsArbitrary (conInfo x)
xs -> appE (varE 'oneof) $
listE (map (return . mkConsArbitrary . conInfo) xs)
return [InstanceD [] (AppT (ConT ''Arbitrary) (ConT name))
[ValD (VarP 'arbitrary) (NormalB expr) []]]
-- | Builds a default Arbitrary instance for a type. This requires
-- that all members are of types that already have Arbitrary
-- instances, and that the arbitrary instances are well behaved
-- (w.r.t. recursive data structures, or similar concerns). In that
-- sense, this is not appropriate for all data types, just those that
-- are simple but very repetitive or have many simple fields. | 807 | true | true | 0 | 17 | 214 | 191 | 98 | 93 | null | null |
brendanhay/gogol | gogol-firestore/gen/Network/Google/Resource/FireStore/Projects/Databases/Documents/List.hs | mpl-2.0 | -- | Creates a value of 'ProjectsDatabasesDocumentsList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pParent'
--
-- * 'pXgafv'
--
-- * 'pReadTime'
--
-- * 'pUploadProtocol'
--
-- * 'pOrderBy'
--
-- * 'pAccessToken'
--
-- * 'pCollectionId'
--
-- * 'pUploadType'
--
-- * 'pTransaction'
--
-- * 'pShowMissing'
--
-- * 'pPageToken'
--
-- * 'pPageSize'
--
-- * 'pMaskFieldPaths'
--
-- * 'pCallback'
projectsDatabasesDocumentsList
:: Text -- ^ 'pParent'
-> Text -- ^ 'pCollectionId'
-> ProjectsDatabasesDocumentsList
projectsDatabasesDocumentsList pPParent_ pPCollectionId_ =
ProjectsDatabasesDocumentsList'
{ _pParent = pPParent_
, _pXgafv = Nothing
, _pReadTime = Nothing
, _pUploadProtocol = Nothing
, _pOrderBy = Nothing
, _pAccessToken = Nothing
, _pCollectionId = pPCollectionId_
, _pUploadType = Nothing
, _pTransaction = Nothing
, _pShowMissing = Nothing
, _pPageToken = Nothing
, _pPageSize = Nothing
, _pMaskFieldPaths = Nothing
, _pCallback = Nothing
} | 1,121 | projectsDatabasesDocumentsList
:: Text -- ^ 'pParent'
-> Text -- ^ 'pCollectionId'
-> ProjectsDatabasesDocumentsList
projectsDatabasesDocumentsList pPParent_ pPCollectionId_ =
ProjectsDatabasesDocumentsList'
{ _pParent = pPParent_
, _pXgafv = Nothing
, _pReadTime = Nothing
, _pUploadProtocol = Nothing
, _pOrderBy = Nothing
, _pAccessToken = Nothing
, _pCollectionId = pPCollectionId_
, _pUploadType = Nothing
, _pTransaction = Nothing
, _pShowMissing = Nothing
, _pPageToken = Nothing
, _pPageSize = Nothing
, _pMaskFieldPaths = Nothing
, _pCallback = Nothing
} | 637 | projectsDatabasesDocumentsList pPParent_ pPCollectionId_ =
ProjectsDatabasesDocumentsList'
{ _pParent = pPParent_
, _pXgafv = Nothing
, _pReadTime = Nothing
, _pUploadProtocol = Nothing
, _pOrderBy = Nothing
, _pAccessToken = Nothing
, _pCollectionId = pPCollectionId_
, _pUploadType = Nothing
, _pTransaction = Nothing
, _pShowMissing = Nothing
, _pPageToken = Nothing
, _pPageSize = Nothing
, _pMaskFieldPaths = Nothing
, _pCallback = Nothing
} | 508 | true | true | 0 | 6 | 234 | 143 | 102 | 41 | null | null |
urbit/urbit | pkg/hs/urbit-atom/test/Main.hs | mit | prop_fast_atom_export_correct :: Natural -> Bool
prop_fast_atom_export_correct x = F.exportBytes x == S.atomBytes x | 115 | prop_fast_atom_export_correct :: Natural -> Bool
prop_fast_atom_export_correct x = F.exportBytes x == S.atomBytes x | 115 | prop_fast_atom_export_correct x = F.exportBytes x == S.atomBytes x | 66 | false | true | 0 | 7 | 12 | 32 | 15 | 17 | null | null |
NightRa/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | -- | Check whether a PTerm has been delaborated from a Term containing a Hole or Guess
containsHole :: PTerm -> Bool
containsHole pterm = or [isHoleName n | PRef _ _ n <- take 1000 $ universe pterm] | 198 | containsHole :: PTerm -> Bool
containsHole pterm = or [isHoleName n | PRef _ _ n <- take 1000 $ universe pterm] | 111 | containsHole pterm = or [isHoleName n | PRef _ _ n <- take 1000 $ universe pterm] | 81 | true | true | 0 | 10 | 38 | 53 | 25 | 28 | null | null |
AlexanderPankiv/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | charDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "C#") charDataConKey charDataCon | 101 | charDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "C#") charDataConKey charDataCon | 101 | charDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "C#") charDataConKey charDataCon | 101 | false | false | 1 | 7 | 10 | 26 | 11 | 15 | null | null |
qrilka/xmlhdbc | Db.hs | bsd-3-clause | nullableStringOfRS _ = Nothing | 30 | nullableStringOfRS _ = Nothing | 30 | nullableStringOfRS _ = Nothing | 30 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
snowmantw/Frag | src/BSP.hs | gpl-2.0 | readLeafFaces :: Handle -> [BSPLump] -> IO [BSPLeafFace]
readLeafFaces handle lumps = do
(offst,lngth) <- (getLumpData (lumps !! kLeafFaces))
hSeek handle AbsoluteSeek (fromIntegral offst)
buf <- mallocBytes lngth
hGetBuf handle buf lngth
leaffaces <- getInts buf (lngth `div` 4)
free buf
return leaffaces
-- - - - - - - - - - - - - - - - - - -
-- reads the brushes | 398 | readLeafFaces :: Handle -> [BSPLump] -> IO [BSPLeafFace]
readLeafFaces handle lumps = do
(offst,lngth) <- (getLumpData (lumps !! kLeafFaces))
hSeek handle AbsoluteSeek (fromIntegral offst)
buf <- mallocBytes lngth
hGetBuf handle buf lngth
leaffaces <- getInts buf (lngth `div` 4)
free buf
return leaffaces
-- - - - - - - - - - - - - - - - - - -
-- reads the brushes | 397 | readLeafFaces handle lumps = do
(offst,lngth) <- (getLumpData (lumps !! kLeafFaces))
hSeek handle AbsoluteSeek (fromIntegral offst)
buf <- mallocBytes lngth
hGetBuf handle buf lngth
leaffaces <- getInts buf (lngth `div` 4)
free buf
return leaffaces
-- - - - - - - - - - - - - - - - - - -
-- reads the brushes | 340 | false | true | 0 | 11 | 98 | 130 | 63 | 67 | null | null |
Icelandjack/lens | src/Control/Lens/Traversal.hs | bsd-3-clause | -- | This permits the use of 'scanl1' over an arbitrary 'Traversal' or 'Lens'.
--
-- @
-- 'scanl1' ≡ 'scanl1Of' 'traverse'
-- @
--
-- @
-- 'scanl1Of' :: 'Iso' s t a a -> (a -> a -> a) -> s -> t
-- 'scanl1Of' :: 'Lens' s t a a -> (a -> a -> a) -> s -> t
-- 'scanl1Of' :: 'Traversal' s t a a -> (a -> a -> a) -> s -> t
-- @
scanl1Of :: LensLike (State (Maybe a)) s t a a -> (a -> a -> a) -> s -> t
scanl1Of l f = snd . mapAccumLOf l step Nothing where
step Nothing a = (Just a, a)
step (Just s) a = (Just r, r) where r = f s a
| 541 | scanl1Of :: LensLike (State (Maybe a)) s t a a -> (a -> a -> a) -> s -> t
scanl1Of l f = snd . mapAccumLOf l step Nothing where
step Nothing a = (Just a, a)
step (Just s) a = (Just r, r) where r = f s a
| 208 | scanl1Of l f = snd . mapAccumLOf l step Nothing where
step Nothing a = (Just a, a)
step (Just s) a = (Just r, r) where r = f s a
| 134 | true | true | 0 | 10 | 151 | 141 | 77 | 64 | null | null |
ihc/futhark | src/Futhark/Representation/AST/Attributes/Types.hs | isc | -- | As 'staticShapes', but on a single type.
staticShapes1 :: TypeBase Shape u -> TypeBase ExtShape u
staticShapes1 (Prim bt) =
Prim bt | 138 | staticShapes1 :: TypeBase Shape u -> TypeBase ExtShape u
staticShapes1 (Prim bt) =
Prim bt | 92 | staticShapes1 (Prim bt) =
Prim bt | 35 | true | true | 0 | 6 | 25 | 43 | 19 | 24 | null | null |
mpickering/hackage-server | Distribution/Client/UploadLog.hs | bsd-3-clause | collectMaintainerInfo :: [Entry] -> [(PackageName, [UserName])]
collectMaintainerInfo =
map maintainersInfo
. groupBy (equating entryPackageName)
. sortBy (comparing entryPackageName)
where
entryPackageName (Entry _ _ pkgid) = packageName pkgid
maintainersInfo :: [Entry] -> (PackageName, [UserName])
maintainersInfo entries =
(packageName pkgid, maintainers)
where
Entry _ _ pkgid = head entries
maintainers = nub [ uname | Entry _ uname _ <- entries ] | 511 | collectMaintainerInfo :: [Entry] -> [(PackageName, [UserName])]
collectMaintainerInfo =
map maintainersInfo
. groupBy (equating entryPackageName)
. sortBy (comparing entryPackageName)
where
entryPackageName (Entry _ _ pkgid) = packageName pkgid
maintainersInfo :: [Entry] -> (PackageName, [UserName])
maintainersInfo entries =
(packageName pkgid, maintainers)
where
Entry _ _ pkgid = head entries
maintainers = nub [ uname | Entry _ uname _ <- entries ] | 511 | collectMaintainerInfo =
map maintainersInfo
. groupBy (equating entryPackageName)
. sortBy (comparing entryPackageName)
where
entryPackageName (Entry _ _ pkgid) = packageName pkgid
maintainersInfo :: [Entry] -> (PackageName, [UserName])
maintainersInfo entries =
(packageName pkgid, maintainers)
where
Entry _ _ pkgid = head entries
maintainers = nub [ uname | Entry _ uname _ <- entries ] | 447 | false | true | 2 | 11 | 117 | 167 | 85 | 82 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Compiler.hs | bsd-3-clause | compileCommand ScheduleReset = do
_ <- compileShallowPrimitiveError $ "scheduleReset"
return () | 103 | compileCommand ScheduleReset = do
_ <- compileShallowPrimitiveError $ "scheduleReset"
return () | 103 | compileCommand ScheduleReset = do
_ <- compileShallowPrimitiveError $ "scheduleReset"
return () | 103 | false | false | 0 | 8 | 18 | 28 | 12 | 16 | null | null |
sdiehl/ghc | libraries/template-haskell/Language/Haskell/TH/PprLib.hs | bsd-3-clause | -- The primitive Doc values
isEmpty = liftM HPJ.isEmpty | 56 | isEmpty = liftM HPJ.isEmpty | 27 | isEmpty = liftM HPJ.isEmpty | 27 | true | false | 0 | 6 | 9 | 12 | 6 | 6 | null | null |
koengit/turbospec | Insert.hs | mit | prop_Prop1 xs = ordered (sort xs) | 33 | prop_Prop1 xs = ordered (sort xs) | 33 | prop_Prop1 xs = ordered (sort xs) | 33 | false | false | 1 | 7 | 5 | 22 | 8 | 14 | null | null |
NorfairKing/the-notes | src/Macro/LinearAlgebra/Macro.hs | gpl-2.0 | (<+>) :: Note -> Note -> Note
(<+>) = binop laadd | 49 | (<+>) :: Note -> Note -> Note
(<+>) = binop laadd | 49 | (<+>) = binop laadd | 19 | false | true | 0 | 6 | 10 | 26 | 15 | 11 | null | null |
caperren/Archives | OSU Coursework/CS 381 - Programming Language Fundamentals/Homework 4/StackRank.Turkingk.hs | gpl-3.0 | -- | 3. Define the semantic function semStatTC for evaluating stack programs
--
semStatTC :: Prog -> Stack -> Maybe Stack
semStatTC prg stk = if (rankP prg (length stk)) == Nothing then Nothing
else prog prg stk | 231 | semStatTC :: Prog -> Stack -> Maybe Stack
semStatTC prg stk = if (rankP prg (length stk)) == Nothing then Nothing
else prog prg stk | 151 | semStatTC prg stk = if (rankP prg (length stk)) == Nothing then Nothing
else prog prg stk | 109 | true | true | 0 | 10 | 57 | 66 | 32 | 34 | null | null |
kmels/dart-haskell | src/DART/CmdLine.hs | bsd-3-clause | prependStars :: IM ()
prependStars = do
-- n <- gets number_of_reductions -- get the heading number
-- m <- increaseStepPart >> gets number_of_reductions_part -- get the subheading number
ti <- gets tab_indentation
let
stars = replicate (ti) '*' ++ " "
debugMNLNT $ stars
where
increaseStepPart :: IM ()
increaseStepPart = modify increase_reduction_part
-- | When debugging, increases the subheading number by one
increase_reduction_part :: DARTState -> DARTState
increase_reduction_part s = s { number_of_reductions_part =
number_of_reductions_part s + 1}
-- | Prepends a new line | 685 | prependStars :: IM ()
prependStars = do
-- n <- gets number_of_reductions -- get the heading number
-- m <- increaseStepPart >> gets number_of_reductions_part -- get the subheading number
ti <- gets tab_indentation
let
stars = replicate (ti) '*' ++ " "
debugMNLNT $ stars
where
increaseStepPart :: IM ()
increaseStepPart = modify increase_reduction_part
-- | When debugging, increases the subheading number by one
increase_reduction_part :: DARTState -> DARTState
increase_reduction_part s = s { number_of_reductions_part =
number_of_reductions_part s + 1}
-- | Prepends a new line | 684 | prependStars = do
-- n <- gets number_of_reductions -- get the heading number
-- m <- increaseStepPart >> gets number_of_reductions_part -- get the subheading number
ti <- gets tab_indentation
let
stars = replicate (ti) '*' ++ " "
debugMNLNT $ stars
where
increaseStepPart :: IM ()
increaseStepPart = modify increase_reduction_part
-- | When debugging, increases the subheading number by one
increase_reduction_part :: DARTState -> DARTState
increase_reduction_part s = s { number_of_reductions_part =
number_of_reductions_part s + 1}
-- | Prepends a new line | 662 | false | true | 0 | 12 | 189 | 127 | 59 | 68 | null | null |
modeswitch/barrelfish | hake/RuleDefs.hs | mit | libvfs_deps_ramfs = LibDeps $ vfsdeps [VFS_RamFS] | 49 | libvfs_deps_ramfs = LibDeps $ vfsdeps [VFS_RamFS] | 49 | libvfs_deps_ramfs = LibDeps $ vfsdeps [VFS_RamFS] | 49 | false | false | 0 | 7 | 5 | 16 | 8 | 8 | null | null |
fphh/crete | src/Crete/Url/Url.hs | bsd-3-clause | gePage :: String -> Url
gePage = WithLang German . Page . Text.pack | 67 | gePage :: String -> Url
gePage = WithLang German . Page . Text.pack | 67 | gePage = WithLang German . Page . Text.pack | 43 | false | true | 0 | 7 | 12 | 28 | 14 | 14 | null | null |
tjakway/ghcjvm | compiler/llvmGen/Llvm/PpLlvm.hs | bsd-3-clause | ppAssignment :: LlvmVar -> SDoc -> SDoc
ppAssignment var expr = ppName var <+> equals <+> expr | 94 | ppAssignment :: LlvmVar -> SDoc -> SDoc
ppAssignment var expr = ppName var <+> equals <+> expr | 94 | ppAssignment var expr = ppName var <+> equals <+> expr | 54 | false | true | 0 | 7 | 16 | 35 | 17 | 18 | null | null |
mcschroeder/ghc | compiler/iface/IfaceType.hs | bsd-3-clause | pprParendIfaceCoercion = ppr_co TyConPrec | 41 | pprParendIfaceCoercion = ppr_co TyConPrec | 41 | pprParendIfaceCoercion = ppr_co TyConPrec | 41 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
sdiehl/ghc | compiler/GHC/Iface/Ext/Utils.hs | bsd-3-clause | -- | combines and sorts ASTs using a merge sort
mergeSortAsts :: [HieAST Type] -> [HieAST Type]
mergeSortAsts = go . map pure
where
go [] = []
go [xs] = xs
go xss = go (mergePairs xss)
mergePairs [] = []
mergePairs [xs] = [xs]
mergePairs (xs:ys:xss) = mergeAsts xs ys : mergePairs xss | 310 | mergeSortAsts :: [HieAST Type] -> [HieAST Type]
mergeSortAsts = go . map pure
where
go [] = []
go [xs] = xs
go xss = go (mergePairs xss)
mergePairs [] = []
mergePairs [xs] = [xs]
mergePairs (xs:ys:xss) = mergeAsts xs ys : mergePairs xss | 262 | mergeSortAsts = go . map pure
where
go [] = []
go [xs] = xs
go xss = go (mergePairs xss)
mergePairs [] = []
mergePairs [xs] = [xs]
mergePairs (xs:ys:xss) = mergeAsts xs ys : mergePairs xss | 214 | true | true | 5 | 9 | 80 | 133 | 68 | 65 | null | null |
dmbarbour/awelon | hsrc/ABC/Imperative/Operations.hs | bsd-3-clause | sZ = onFst "Z" sZ' | 18 | sZ = onFst "Z" sZ' | 18 | sZ = onFst "Z" sZ' | 18 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
akegalj/snowdrift | View/Comment.hs | agpl-3.0 | commentWidget :: Entity Comment -- ^ Comment.
-> Maybe UserId -- ^ Viewer.
-> CommentRoutes -- ^ Comment routes.
-> CommentActionPermissions -- ^ Permissions for comment actions.
-> [CommentClosing] -- ^ Earlier closures.
-> [CommentRetracting] -- ^ Earlier retracts.
-> User -- ^ Comment poster.
-> Maybe CommentClosing -- ^ Is this closed?
-> Maybe CommentRetracting -- ^ Is this retracted?
-> Maybe (Entity Ticket) -- ^ Is this a ticket?
-> Maybe TicketClaiming -- ^ Is this ticket claimed?
-> Maybe (CommentFlagging, [FlagReason]) -- ^ Is this flagged?
-> Bool -- ^ Is this a preview?
-> Widget -- ^ Inner widget (children comments, 'expand' link, reply box, etc)
-> Widget
commentWidget (Entity comment_id comment)
mviewer_id
CommentRoutes{..}
CommentActionPermissions{..}
earlier_closures
earlier_retracts
user
mclosure
mretract
mticket
mclaim
mflag
is_preview
inner_widget = do
let user_id = commentUser comment
is_unapproved = not . commentIsApproved $ comment
is_top_level = commentIsTopLevel comment
is_even_depth = commentIsEvenDepth comment
is_odd_depth = commentIsOddDepth comment
is_private = commentIsPrivate comment
is_closed = isJust mclosure
-- TODO: Lots of refactoring to lift this database hit up to the
-- controller layer. This currently has horrible performance - a hit *per* comment!
tags <- handlerToWidget $ runDB $
maybe [] sortAnnotTagsByName .
M.lookup comment_id <$>
(fetchCommentCommentTagsDB comment_id >>= buildAnnotatedCommentTagsDB mviewer_id)
user_map <- case mclaim of
Nothing -> return M.empty
Just claim -> do
let claiming_user_id = ticketClaimingUser claim
Just claiming_user <- runDB $ get claiming_user_id
return $ M.singleton claiming_user_id claiming_user
let shpack = T.pack . show
persistValue = toPersistValue . entityKey
ticket_str <- case persistValue <$> mticket of
Just (PersistInt64 tid) -> return $ shpack tid
_ -> do
mrethread_ticket <- fmap join $ runDB $ do
mcomment_rethread <- fetchCommentRethreadLastDB comment_id
Traversable.forM mcomment_rethread $ \comment_rethread ->
getBy $ UniqueTicket comment_rethread
return $ case persistValue <$> mrethread_ticket of
Just (PersistInt64 rtid) -> shpack rtid
_ -> "???"
let prettyTicketLine line =
let pretty title = "<div class='ticket-title'>SD-" <> ticket_str <> ": " <> title <> "</div>"
in return $ maybe line pretty $ T.stripPrefix "ticket: " line
commentTextTransform = prettyTicketLine
$(whamletFile "templates/comment.hamlet") | 3,462 | commentWidget :: Entity Comment -- ^ Comment.
-> Maybe UserId -- ^ Viewer.
-> CommentRoutes -- ^ Comment routes.
-> CommentActionPermissions -- ^ Permissions for comment actions.
-> [CommentClosing] -- ^ Earlier closures.
-> [CommentRetracting] -- ^ Earlier retracts.
-> User -- ^ Comment poster.
-> Maybe CommentClosing -- ^ Is this closed?
-> Maybe CommentRetracting -- ^ Is this retracted?
-> Maybe (Entity Ticket) -- ^ Is this a ticket?
-> Maybe TicketClaiming -- ^ Is this ticket claimed?
-> Maybe (CommentFlagging, [FlagReason]) -- ^ Is this flagged?
-> Bool -- ^ Is this a preview?
-> Widget -- ^ Inner widget (children comments, 'expand' link, reply box, etc)
-> Widget
commentWidget (Entity comment_id comment)
mviewer_id
CommentRoutes{..}
CommentActionPermissions{..}
earlier_closures
earlier_retracts
user
mclosure
mretract
mticket
mclaim
mflag
is_preview
inner_widget = do
let user_id = commentUser comment
is_unapproved = not . commentIsApproved $ comment
is_top_level = commentIsTopLevel comment
is_even_depth = commentIsEvenDepth comment
is_odd_depth = commentIsOddDepth comment
is_private = commentIsPrivate comment
is_closed = isJust mclosure
-- TODO: Lots of refactoring to lift this database hit up to the
-- controller layer. This currently has horrible performance - a hit *per* comment!
tags <- handlerToWidget $ runDB $
maybe [] sortAnnotTagsByName .
M.lookup comment_id <$>
(fetchCommentCommentTagsDB comment_id >>= buildAnnotatedCommentTagsDB mviewer_id)
user_map <- case mclaim of
Nothing -> return M.empty
Just claim -> do
let claiming_user_id = ticketClaimingUser claim
Just claiming_user <- runDB $ get claiming_user_id
return $ M.singleton claiming_user_id claiming_user
let shpack = T.pack . show
persistValue = toPersistValue . entityKey
ticket_str <- case persistValue <$> mticket of
Just (PersistInt64 tid) -> return $ shpack tid
_ -> do
mrethread_ticket <- fmap join $ runDB $ do
mcomment_rethread <- fetchCommentRethreadLastDB comment_id
Traversable.forM mcomment_rethread $ \comment_rethread ->
getBy $ UniqueTicket comment_rethread
return $ case persistValue <$> mrethread_ticket of
Just (PersistInt64 rtid) -> shpack rtid
_ -> "???"
let prettyTicketLine line =
let pretty title = "<div class='ticket-title'>SD-" <> ticket_str <> ": " <> title <> "</div>"
in return $ maybe line pretty $ T.stripPrefix "ticket: " line
commentTextTransform = prettyTicketLine
$(whamletFile "templates/comment.hamlet") | 3,462 | commentWidget (Entity comment_id comment)
mviewer_id
CommentRoutes{..}
CommentActionPermissions{..}
earlier_closures
earlier_retracts
user
mclosure
mretract
mticket
mclaim
mflag
is_preview
inner_widget = do
let user_id = commentUser comment
is_unapproved = not . commentIsApproved $ comment
is_top_level = commentIsTopLevel comment
is_even_depth = commentIsEvenDepth comment
is_odd_depth = commentIsOddDepth comment
is_private = commentIsPrivate comment
is_closed = isJust mclosure
-- TODO: Lots of refactoring to lift this database hit up to the
-- controller layer. This currently has horrible performance - a hit *per* comment!
tags <- handlerToWidget $ runDB $
maybe [] sortAnnotTagsByName .
M.lookup comment_id <$>
(fetchCommentCommentTagsDB comment_id >>= buildAnnotatedCommentTagsDB mviewer_id)
user_map <- case mclaim of
Nothing -> return M.empty
Just claim -> do
let claiming_user_id = ticketClaimingUser claim
Just claiming_user <- runDB $ get claiming_user_id
return $ M.singleton claiming_user_id claiming_user
let shpack = T.pack . show
persistValue = toPersistValue . entityKey
ticket_str <- case persistValue <$> mticket of
Just (PersistInt64 tid) -> return $ shpack tid
_ -> do
mrethread_ticket <- fmap join $ runDB $ do
mcomment_rethread <- fetchCommentRethreadLastDB comment_id
Traversable.forM mcomment_rethread $ \comment_rethread ->
getBy $ UniqueTicket comment_rethread
return $ case persistValue <$> mrethread_ticket of
Just (PersistInt64 rtid) -> shpack rtid
_ -> "???"
let prettyTicketLine line =
let pretty title = "<div class='ticket-title'>SD-" <> ticket_str <> ": " <> title <> "</div>"
in return $ maybe line pretty $ T.stripPrefix "ticket: " line
commentTextTransform = prettyTicketLine
$(whamletFile "templates/comment.hamlet") | 2,303 | false | true | 0 | 20 | 1,362 | 596 | 288 | 308 | null | null |
dillonhuff/Folly | src/Folly/Formula.hs | bsd-3-clause | fvt :: Term -> Set Term
fvt (Constant _) = S.empty | 50 | fvt :: Term -> Set Term
fvt (Constant _) = S.empty | 50 | fvt (Constant _) = S.empty | 26 | false | true | 0 | 7 | 10 | 29 | 14 | 15 | null | null |
rvion/ride | jetpack/src/Network/Wai/Middleware/RequestLogger/AsWai.hs | bsd-3-clause | set_wai_outputFormat x o = o { I.outputFormat = x} | 50 | set_wai_outputFormat x o = o { I.outputFormat = x} | 50 | set_wai_outputFormat x o = o { I.outputFormat = x} | 50 | false | false | 0 | 6 | 8 | 22 | 11 | 11 | null | null |
thomie/cabal | cabal-install/Distribution/Client/ProjectConfig/Legacy.hs | bsd-3-clause | showTokenQ x@('.':[]) = Disp.text (show x) | 45 | showTokenQ x@('.':[]) = Disp.text (show x) | 45 | showTokenQ x@('.':[]) = Disp.text (show x) | 45 | false | false | 0 | 9 | 8 | 32 | 16 | 16 | null | null |
joelburget/sdl2-gfx | Graphics/UI/SDL/Primitives.hs | bsd-3-clause | box :: Renderer -> Rect -> Pixel -> IO Bool
box renderer (Rect x y w h) (Pixel c) = withForeignPtr renderer $ \ptr ->
intToBool (-1) (fmap fromCInt $ gfxBoxColor ptr
(fromIntegral x)
(fromIntegral y)
(fromIntegral w)
(fromIntegral h)
c) | 480 | box :: Renderer -> Rect -> Pixel -> IO Bool
box renderer (Rect x y w h) (Pixel c) = withForeignPtr renderer $ \ptr ->
intToBool (-1) (fmap fromCInt $ gfxBoxColor ptr
(fromIntegral x)
(fromIntegral y)
(fromIntegral w)
(fromIntegral h)
c) | 480 | box renderer (Rect x y w h) (Pixel c) = withForeignPtr renderer $ \ptr ->
intToBool (-1) (fmap fromCInt $ gfxBoxColor ptr
(fromIntegral x)
(fromIntegral y)
(fromIntegral w)
(fromIntegral h)
c) | 436 | false | true | 0 | 12 | 284 | 120 | 59 | 61 | null | null |
rscprof/kalium | src/Kalium/Nucleus/Vector/Template.hs | bsd-3-clause | metaPMatch PWildCard PWildCard = mempty | 39 | metaPMatch PWildCard PWildCard = mempty | 39 | metaPMatch PWildCard PWildCard = mempty | 39 | false | false | 0 | 4 | 4 | 13 | 5 | 8 | null | null |
riwsky/connect4 | Main.hs | gpl-3.0 | addMove :: Board -> Move -> Player -> Board
addMove b (Move c) p = adjust (\s -> let (nothings, justs) = spanl isNothing s in
case S.viewl nothings of
EmptyL -> justs
_ :< rest -> rest >< Just p <| justs) c b | 339 | addMove :: Board -> Move -> Player -> Board
addMove b (Move c) p = adjust (\s -> let (nothings, justs) = spanl isNothing s in
case S.viewl nothings of
EmptyL -> justs
_ :< rest -> rest >< Just p <| justs) c b | 339 | addMove b (Move c) p = adjust (\s -> let (nothings, justs) = spanl isNothing s in
case S.viewl nothings of
EmptyL -> justs
_ :< rest -> rest >< Just p <| justs) c b | 295 | false | true | 0 | 15 | 175 | 110 | 54 | 56 | null | null |
mariefarrell/Hets | Maude/PreComorphism.hs | gpl-2.0 | rewPredCongPremise _ [] = [] | 28 | rewPredCongPremise _ [] = [] | 28 | rewPredCongPremise _ [] = [] | 28 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
sordina/bramble | src/Bramble/RAML.hs | mit | -- About `partedAction`:
-- There should be a partial-parser that works on lists (possibly converted from objects)
-- that has a partitioning predicate that allows the matching items to be parsed as a
-- stand-alone list and the the remaing items to be given to the second parser, or possibly
-- have them returned as a pair... vice-versa
--
partedAction :: Monad m => (a -> Bool) -> ([a] -> m b) -> ([a] -> m c) -> (b -> c -> m d) -> [a] -> m d
partedAction part f g combine l = do
let (xs,ys) = L.partition part l
b <- f xs
c <- g ys
combine b c | 573 | partedAction :: Monad m => (a -> Bool) -> ([a] -> m b) -> ([a] -> m c) -> (b -> c -> m d) -> [a] -> m d
partedAction part f g combine l = do
let (xs,ys) = L.partition part l
b <- f xs
c <- g ys
combine b c | 231 | partedAction part f g combine l = do
let (xs,ys) = L.partition part l
b <- f xs
c <- g ys
combine b c | 127 | true | true | 0 | 13 | 139 | 159 | 80 | 79 | null | null |
gabesoft/kapi | src/Persistence/ElasticSearch.hs | bsd-3-clause | searchDocuments :: Search
-> Text
-> Text
-> Text
-> IO (Either EsError (SearchResult Record))
searchDocuments search mappingName server index = do
body <-
withBH server $
B.searchByType (IndexName index) (MappingName mappingName) search
return $ body >>= toResult
where
toErr msg = mkEsError 500 ("Failed to decode search results " ++ msg)
toResult body = first toErr (A.eitherDecode $ textToBytes body)
-- ^
-- Create a search object for finding records by id | 548 | searchDocuments :: Search
-> Text
-> Text
-> Text
-> IO (Either EsError (SearchResult Record))
searchDocuments search mappingName server index = do
body <-
withBH server $
B.searchByType (IndexName index) (MappingName mappingName) search
return $ body >>= toResult
where
toErr msg = mkEsError 500 ("Failed to decode search results " ++ msg)
toResult body = first toErr (A.eitherDecode $ textToBytes body)
-- ^
-- Create a search object for finding records by id | 548 | searchDocuments search mappingName server index = do
body <-
withBH server $
B.searchByType (IndexName index) (MappingName mappingName) search
return $ body >>= toResult
where
toErr msg = mkEsError 500 ("Failed to decode search results " ++ msg)
toResult body = first toErr (A.eitherDecode $ textToBytes body)
-- ^
-- Create a search object for finding records by id | 389 | false | true | 1 | 13 | 159 | 147 | 72 | 75 | null | null |
ksaveljev/hake-2 | src/Game/Monsters/MGladiator.hs | bsd-3-clause | frameWalk16 :: Int
frameWalk16 = 22 | 35 | frameWalk16 :: Int
frameWalk16 = 22 | 35 | frameWalk16 = 22 | 16 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
paulkoerbitz/hsbci | src/Data/HBCI/Mt94x.hs | agpl-3.0 | readAmt :: BS.ByteString -> Maybe Int
readAmt amtStr = do
commaPos <- BS.elemIndex (c2w ',') amtStr
let eurStr = BS.take commaPos amtStr
centStr = BS.takeWhile isDigit $! BS.drop (commaPos+1) amtStr
(euros, _) <- C8.readInt eurStr
if BS.null centStr
then return $! 100*euros
else do (cents, _) <- C8.readInt centStr
return $! 100*euros + cents | 377 | readAmt :: BS.ByteString -> Maybe Int
readAmt amtStr = do
commaPos <- BS.elemIndex (c2w ',') amtStr
let eurStr = BS.take commaPos amtStr
centStr = BS.takeWhile isDigit $! BS.drop (commaPos+1) amtStr
(euros, _) <- C8.readInt eurStr
if BS.null centStr
then return $! 100*euros
else do (cents, _) <- C8.readInt centStr
return $! 100*euros + cents | 377 | readAmt amtStr = do
commaPos <- BS.elemIndex (c2w ',') amtStr
let eurStr = BS.take commaPos amtStr
centStr = BS.takeWhile isDigit $! BS.drop (commaPos+1) amtStr
(euros, _) <- C8.readInt eurStr
if BS.null centStr
then return $! 100*euros
else do (cents, _) <- C8.readInt centStr
return $! 100*euros + cents | 339 | false | true | 0 | 13 | 87 | 162 | 78 | 84 | null | null |
tamarin-prover/tamarin-prover | lib/theory/src/Theory/Constraint/System/Dot.hs | gpl-3.0 | dotIntraRuleEdge :: D.NodeId -> D.NodeId -> SeDot ()
dotIntraRuleEdge from to = liftDot $ D.edge from to [("color","gray")] | 123 | dotIntraRuleEdge :: D.NodeId -> D.NodeId -> SeDot ()
dotIntraRuleEdge from to = liftDot $ D.edge from to [("color","gray")] | 123 | dotIntraRuleEdge from to = liftDot $ D.edge from to [("color","gray")] | 70 | false | true | 0 | 9 | 17 | 59 | 29 | 30 | null | null |
nevrenato/HetsAlloy | Modal/ModalSystems.hs | gpl-2.0 | transSen :: Bool -> VAR_DECL -> VAR_DECL -> VAR_DECL -> RELPRED
-> Named CASLFORMULA
transSen b v1 v2 v3 relP = let
t1 = toQualVar v1
t2 = toQualVar v2
t3 = toQualVar v3
in makeNamed "Transitive_4"
$ mkForall [v1, v2, v3] $ mkImpl
(conjunct [relP t1 t2, relP (if b then t2 else t1) t3])
$ relP (if b then t1 else t2) t3 | 345 | transSen :: Bool -> VAR_DECL -> VAR_DECL -> VAR_DECL -> RELPRED
-> Named CASLFORMULA
transSen b v1 v2 v3 relP = let
t1 = toQualVar v1
t2 = toQualVar v2
t3 = toQualVar v3
in makeNamed "Transitive_4"
$ mkForall [v1, v2, v3] $ mkImpl
(conjunct [relP t1 t2, relP (if b then t2 else t1) t3])
$ relP (if b then t1 else t2) t3 | 345 | transSen b v1 v2 v3 relP = let
t1 = toQualVar v1
t2 = toQualVar v2
t3 = toQualVar v3
in makeNamed "Transitive_4"
$ mkForall [v1, v2, v3] $ mkImpl
(conjunct [relP t1 t2, relP (if b then t2 else t1) t3])
$ relP (if b then t1 else t2) t3 | 258 | false | true | 4 | 11 | 90 | 161 | 79 | 82 | null | null |
Fuuzetsu/h-booru | src/HBooru/Types.hs | gpl-3.0 | sample_height ∷ Proxy "sample_height"
sample_height = Proxy | 59 | sample_height ∷ Proxy "sample_height"
sample_height = Proxy | 59 | sample_height = Proxy | 21 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
romanb/amazonka | amazonka-ec2/gen/Network/AWS/EC2/RevokeSecurityGroupEgress.hs | mpl-2.0 | -- | The IP protocol name ('tcp', 'udp', 'icmp') or number (see <http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml Protocol Numbers>). Use '-1'
-- to specify all.
rsgeIpProtocol :: Lens' RevokeSecurityGroupEgress (Maybe Text)
rsgeIpProtocol = lens _rsgeIpProtocol (\s a -> s { _rsgeIpProtocol = a }) | 321 | rsgeIpProtocol :: Lens' RevokeSecurityGroupEgress (Maybe Text)
rsgeIpProtocol = lens _rsgeIpProtocol (\s a -> s { _rsgeIpProtocol = a }) | 136 | rsgeIpProtocol = lens _rsgeIpProtocol (\s a -> s { _rsgeIpProtocol = a }) | 73 | true | true | 0 | 9 | 39 | 47 | 26 | 21 | null | null |
synsem/texhs | src/Text/TeX/Lexer/Catcode.hs | gpl-3.0 | showCatcodePP Supscript = "superscript character" | 49 | showCatcodePP Supscript = "superscript character" | 49 | showCatcodePP Supscript = "superscript character" | 49 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
ExNexu/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | highestFC (PCoerced tm) = highestFC tm | 38 | highestFC (PCoerced tm) = highestFC tm | 38 | highestFC (PCoerced tm) = highestFC tm | 38 | false | false | 0 | 6 | 5 | 19 | 8 | 11 | null | null |
guilt/webify | src/Font.hs | mit | parseOS2 :: Map String TableDirectory -> B.ByteString -> OS2
parseOS2 = parseTable "OS/2" (do
os2Version <- getUShort
unless (os2Version `elem` [0..4]) (error $ "unhandled os2 version " ++ show os2Version)
xAvgCharWidth <- getShort
usWeightClass <- getUShort
usWidthClass <- getUShort
fsType <- getUShort
ySubscriptXSize <- getShort
ySubscriptYSize <- getShort
ySubscriptXOffset <- getShort
ySubscriptYOffset <- getShort
ySuperscriptXSize <- getShort
ySuperscriptYSize <- getShort
ySuperscriptXOffset <- getShort
ySuperscriptYOffset <- getShort
yStrikeoutSize <- getShort
yStrikeoutPosition <- getShort
sFamilyClass <- getShort
panose <- replicateM 10 getByte
ulUnicodeRange1 <- getULong
ulUnicodeRange2 <- getULong
ulUnicodeRange3 <- getULong
ulUnicodeRange4 <- getULong
aschVendID <- replicateM 4 getByte
fsSelection <- getUShort
usFirstCharIndex <- getUShort
usLastCharIndex <- getUShort
sTypoAscender <- getUShort
sTypoDescender <- getUShort
sTypoLineGap <- getUShort
usWinAscent <- getUShort
usWinDescent <- getUShort
ulCodePageRange1 <- getULong
ulCodePageRange2 <- getULong
return OS2 {..}) | 1,166 | parseOS2 :: Map String TableDirectory -> B.ByteString -> OS2
parseOS2 = parseTable "OS/2" (do
os2Version <- getUShort
unless (os2Version `elem` [0..4]) (error $ "unhandled os2 version " ++ show os2Version)
xAvgCharWidth <- getShort
usWeightClass <- getUShort
usWidthClass <- getUShort
fsType <- getUShort
ySubscriptXSize <- getShort
ySubscriptYSize <- getShort
ySubscriptXOffset <- getShort
ySubscriptYOffset <- getShort
ySuperscriptXSize <- getShort
ySuperscriptYSize <- getShort
ySuperscriptXOffset <- getShort
ySuperscriptYOffset <- getShort
yStrikeoutSize <- getShort
yStrikeoutPosition <- getShort
sFamilyClass <- getShort
panose <- replicateM 10 getByte
ulUnicodeRange1 <- getULong
ulUnicodeRange2 <- getULong
ulUnicodeRange3 <- getULong
ulUnicodeRange4 <- getULong
aschVendID <- replicateM 4 getByte
fsSelection <- getUShort
usFirstCharIndex <- getUShort
usLastCharIndex <- getUShort
sTypoAscender <- getUShort
sTypoDescender <- getUShort
sTypoLineGap <- getUShort
usWinAscent <- getUShort
usWinDescent <- getUShort
ulCodePageRange1 <- getULong
ulCodePageRange2 <- getULong
return OS2 {..}) | 1,166 | parseOS2 = parseTable "OS/2" (do
os2Version <- getUShort
unless (os2Version `elem` [0..4]) (error $ "unhandled os2 version " ++ show os2Version)
xAvgCharWidth <- getShort
usWeightClass <- getUShort
usWidthClass <- getUShort
fsType <- getUShort
ySubscriptXSize <- getShort
ySubscriptYSize <- getShort
ySubscriptXOffset <- getShort
ySubscriptYOffset <- getShort
ySuperscriptXSize <- getShort
ySuperscriptYSize <- getShort
ySuperscriptXOffset <- getShort
ySuperscriptYOffset <- getShort
yStrikeoutSize <- getShort
yStrikeoutPosition <- getShort
sFamilyClass <- getShort
panose <- replicateM 10 getByte
ulUnicodeRange1 <- getULong
ulUnicodeRange2 <- getULong
ulUnicodeRange3 <- getULong
ulUnicodeRange4 <- getULong
aschVendID <- replicateM 4 getByte
fsSelection <- getUShort
usFirstCharIndex <- getUShort
usLastCharIndex <- getUShort
sTypoAscender <- getUShort
sTypoDescender <- getUShort
sTypoLineGap <- getUShort
usWinAscent <- getUShort
usWinDescent <- getUShort
ulCodePageRange1 <- getULong
ulCodePageRange2 <- getULong
return OS2 {..}) | 1,105 | false | true | 0 | 12 | 198 | 322 | 142 | 180 | null | null |
LambdaHack/LambdaHack | engine-src/Game/LambdaHack/Atomic/HandleAtomicWrite.hs | bsd-3-clause | updQuitFaction :: MonadStateWrite m
=> FactionId -> Maybe Status -> Maybe Status
-> m ()
updQuitFaction fid fromSt toSt = do
let !_A = assert (fromSt /= toSt `blame` (fid, fromSt, toSt)) ()
fact <- getsState $ (EM.! fid) . sfactionD
let !_A = assert (fromSt == gquit fact
`blame` "unexpected actor quit status"
`swith` (fid, fromSt, toSt, fact)) ()
let adj fa = fa {gquit = toSt}
updateFaction fid adj | 481 | updQuitFaction :: MonadStateWrite m
=> FactionId -> Maybe Status -> Maybe Status
-> m ()
updQuitFaction fid fromSt toSt = do
let !_A = assert (fromSt /= toSt `blame` (fid, fromSt, toSt)) ()
fact <- getsState $ (EM.! fid) . sfactionD
let !_A = assert (fromSt == gquit fact
`blame` "unexpected actor quit status"
`swith` (fid, fromSt, toSt, fact)) ()
let adj fa = fa {gquit = toSt}
updateFaction fid adj | 481 | updQuitFaction fid fromSt toSt = do
let !_A = assert (fromSt /= toSt `blame` (fid, fromSt, toSt)) ()
fact <- getsState $ (EM.! fid) . sfactionD
let !_A = assert (fromSt == gquit fact
`blame` "unexpected actor quit status"
`swith` (fid, fromSt, toSt, fact)) ()
let adj fa = fa {gquit = toSt}
updateFaction fid adj | 362 | false | true | 0 | 15 | 150 | 189 | 95 | 94 | null | null |
frodwith/baduk-formats | src/Codec/Baduk/Parser/WBaduk.hs | bsd-3-clause | readRankType 'D' = Dan | 22 | readRankType 'D' = Dan | 22 | readRankType 'D' = Dan | 22 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
sdiehl/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | -- | Cached type and data constructors for sums. The outer array is
-- indexed by the arity of the sum and the inner array is indexed by
-- the alternative.
unboxedSumArr :: Array Int (TyCon, Array Int DataCon)
unboxedSumArr = listArray (2,mAX_SUM_SIZE) [mk_sum i | i <- [2..mAX_SUM_SIZE]] | 289 | unboxedSumArr :: Array Int (TyCon, Array Int DataCon)
unboxedSumArr = listArray (2,mAX_SUM_SIZE) [mk_sum i | i <- [2..mAX_SUM_SIZE]] | 132 | unboxedSumArr = listArray (2,mAX_SUM_SIZE) [mk_sum i | i <- [2..mAX_SUM_SIZE]] | 78 | true | true | 0 | 9 | 48 | 60 | 33 | 27 | null | null |
mcschroeder/ghc | compiler/main/GhcMake.hs | bsd-3-clause | maybeGetIfaceDate :: DynFlags -> ModLocation -> IO (Maybe UTCTime)
maybeGetIfaceDate dflags location
| writeInterfaceOnlyMode dflags
-- Minor optimization: it should be harmless to check the hi file location
-- always, but it's better to avoid hitting the filesystem if possible.
= modificationTimeIfExists (ml_hi_file location)
| otherwise
= return Nothing | 375 | maybeGetIfaceDate :: DynFlags -> ModLocation -> IO (Maybe UTCTime)
maybeGetIfaceDate dflags location
| writeInterfaceOnlyMode dflags
-- Minor optimization: it should be harmless to check the hi file location
-- always, but it's better to avoid hitting the filesystem if possible.
= modificationTimeIfExists (ml_hi_file location)
| otherwise
= return Nothing | 375 | maybeGetIfaceDate dflags location
| writeInterfaceOnlyMode dflags
-- Minor optimization: it should be harmless to check the hi file location
-- always, but it's better to avoid hitting the filesystem if possible.
= modificationTimeIfExists (ml_hi_file location)
| otherwise
= return Nothing | 308 | false | true | 0 | 9 | 66 | 67 | 31 | 36 | null | null |
urbanslug/ghc | testsuite/tests/indexed-types/should_compile/red-black-delete.hs | bsd-3-clause | -- make a node more red (i.e. decreasing its black height)
-- note that the color of the resulting node is not part of the
-- result height because the result of this operation doesn't
-- necessarily satisfy the RBT invariants
redden :: CT (S n) c a -> DT n a
redden (T B a x y) = DT R a x y | 292 | redden :: CT (S n) c a -> DT n a
redden (T B a x y) = DT R a x y | 65 | redden (T B a x y) = DT R a x y | 32 | true | true | 0 | 9 | 64 | 65 | 32 | 33 | null | null |
rfranek/duckling | Duckling/Numeral/TR/Rules.hs | bsd-3-clause | rules :: [Rule]
rules =
[ ruleACoupleOf
, ruleDecimalNumeral
, ruleDecimalWithThousandsSeparator
, ruleDozen
, ruleFew
, ruleGroupOfTens
, ruleHalf
, ruleInteger
, ruleInteger2
, ruleInteger3
, ruleInteger4
, ruleInteger5
, ruleInteger6
, ruleInteger7
, ruleInteger8
, ruleInteger9
, ruleIntegerNumeric
, ruleIntegerWithThousandsSeparator
, ruleIntersect
, ruleNumeralDotNumeral
, ruleNumeralSuffixesHalfSuffix
, ruleNumeralSuffixesHalfsuffixText
, ruleNumeralSuffixesHalfsuffixText2
, ruleNumeralsPrefixWithNegativeOrMinus
, ruleNumeralsSuffixesKMG
, rulePowersOfTen
, ruleQuarter
, ruleTen
, ruleMultiply
] | 668 | rules :: [Rule]
rules =
[ ruleACoupleOf
, ruleDecimalNumeral
, ruleDecimalWithThousandsSeparator
, ruleDozen
, ruleFew
, ruleGroupOfTens
, ruleHalf
, ruleInteger
, ruleInteger2
, ruleInteger3
, ruleInteger4
, ruleInteger5
, ruleInteger6
, ruleInteger7
, ruleInteger8
, ruleInteger9
, ruleIntegerNumeric
, ruleIntegerWithThousandsSeparator
, ruleIntersect
, ruleNumeralDotNumeral
, ruleNumeralSuffixesHalfSuffix
, ruleNumeralSuffixesHalfsuffixText
, ruleNumeralSuffixesHalfsuffixText2
, ruleNumeralsPrefixWithNegativeOrMinus
, ruleNumeralsSuffixesKMG
, rulePowersOfTen
, ruleQuarter
, ruleTen
, ruleMultiply
] | 668 | rules =
[ ruleACoupleOf
, ruleDecimalNumeral
, ruleDecimalWithThousandsSeparator
, ruleDozen
, ruleFew
, ruleGroupOfTens
, ruleHalf
, ruleInteger
, ruleInteger2
, ruleInteger3
, ruleInteger4
, ruleInteger5
, ruleInteger6
, ruleInteger7
, ruleInteger8
, ruleInteger9
, ruleIntegerNumeric
, ruleIntegerWithThousandsSeparator
, ruleIntersect
, ruleNumeralDotNumeral
, ruleNumeralSuffixesHalfSuffix
, ruleNumeralSuffixesHalfsuffixText
, ruleNumeralSuffixesHalfsuffixText2
, ruleNumeralsPrefixWithNegativeOrMinus
, ruleNumeralsSuffixesKMG
, rulePowersOfTen
, ruleQuarter
, ruleTen
, ruleMultiply
] | 652 | false | true | 0 | 7 | 123 | 108 | 67 | 41 | null | null |
ecaustin/haskhol-haskell | src/HaskHOL/Lib/Haskell.hs | bsd-2-clause | tacMonadMaybe :: HaskellCtxt thry => Tactic cls thry
tacMonadMaybe = proveConsClass defMonad inductionMaybe [defJust] | 117 | tacMonadMaybe :: HaskellCtxt thry => Tactic cls thry
tacMonadMaybe = proveConsClass defMonad inductionMaybe [defJust] | 117 | tacMonadMaybe = proveConsClass defMonad inductionMaybe [defJust] | 64 | false | true | 0 | 6 | 13 | 33 | 16 | 17 | null | null |
CindyLinz/Haskell-HVG | src/HVG/Type.hs | bsd-3-clause | runBuilder :: Monoid agingState => Builder info structState agingState a -> structState -> (a, (agingState, [String]))
runBuilder (Builder m) structState =
let
initAgingSegs = L.singleton mempty
initAgingState = AgingBuilder (L.lastIter initAgingSegs) initAgingSegs
in case unBuilderPart (m Nothing structState) initAgingState M.empty M.empty of
BuilderExec maybeName' structState' agingState' namedInfo' suspendedBuilder' a ->
(a, (mconcat (L.toList (agingBuilderSegs agingState')), M.keys suspendedBuilder'))
BuilderWait needName agingState' namedInfo' suspendedBuilder' susp ->
(undefined, (mconcat (L.toList (agingBuilderSegs agingState')), M.keys suspendedBuilder')) | 703 | runBuilder :: Monoid agingState => Builder info structState agingState a -> structState -> (a, (agingState, [String]))
runBuilder (Builder m) structState =
let
initAgingSegs = L.singleton mempty
initAgingState = AgingBuilder (L.lastIter initAgingSegs) initAgingSegs
in case unBuilderPart (m Nothing structState) initAgingState M.empty M.empty of
BuilderExec maybeName' structState' agingState' namedInfo' suspendedBuilder' a ->
(a, (mconcat (L.toList (agingBuilderSegs agingState')), M.keys suspendedBuilder'))
BuilderWait needName agingState' namedInfo' suspendedBuilder' susp ->
(undefined, (mconcat (L.toList (agingBuilderSegs agingState')), M.keys suspendedBuilder')) | 703 | runBuilder (Builder m) structState =
let
initAgingSegs = L.singleton mempty
initAgingState = AgingBuilder (L.lastIter initAgingSegs) initAgingSegs
in case unBuilderPart (m Nothing structState) initAgingState M.empty M.empty of
BuilderExec maybeName' structState' agingState' namedInfo' suspendedBuilder' a ->
(a, (mconcat (L.toList (agingBuilderSegs agingState')), M.keys suspendedBuilder'))
BuilderWait needName agingState' namedInfo' suspendedBuilder' susp ->
(undefined, (mconcat (L.toList (agingBuilderSegs agingState')), M.keys suspendedBuilder')) | 584 | false | true | 3 | 12 | 102 | 222 | 113 | 109 | null | null |
tittoassini/flat | src/Flat/Decoder/Strict.hs | bsd-3-clause | decodeArrayWith :: Get a -> Get [a]
decodeArrayWith dec = DL.toList <$> getAsL_ dec | 83 | decodeArrayWith :: Get a -> Get [a]
decodeArrayWith dec = DL.toList <$> getAsL_ dec | 83 | decodeArrayWith dec = DL.toList <$> getAsL_ dec | 47 | false | true | 0 | 7 | 13 | 36 | 17 | 19 | null | null |
MP2E/XMonadContrib | XMonad/Layout/BinarySpacePartition.hs | bsd-3-clause | goSibling :: Zipper a -> Maybe (Zipper a)
goSibling (_, []) = Nothing | 69 | goSibling :: Zipper a -> Maybe (Zipper a)
goSibling (_, []) = Nothing | 69 | goSibling (_, []) = Nothing | 27 | false | true | 0 | 8 | 12 | 42 | 20 | 22 | null | null |
phischu/fragnix | tests/packages/scotty/Data.IntSet.Internal.hs | bsd-3-clause | showBitMap :: Word -> String
showBitMap w = show $ foldrBits 0 (:) [] w | 71 | showBitMap :: Word -> String
showBitMap w = show $ foldrBits 0 (:) [] w | 71 | showBitMap w = show $ foldrBits 0 (:) [] w | 42 | false | true | 0 | 7 | 14 | 35 | 18 | 17 | null | null |
ozgurakgun/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | fc_fname NoFC = "(no file)" | 27 | fc_fname NoFC = "(no file)" | 27 | fc_fname NoFC = "(no file)" | 27 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
sgillespie/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | legalFIPrimResultTyCon :: DynFlags -> TyCon -> Validity
-- Check result type of 'foreign import prim'. Allow simple unlifted
-- types and also unboxed tuple and sum result types.
legalFIPrimResultTyCon dflags tc
| isUnliftedTyCon tc
, isUnboxedTupleTyCon tc || isUnboxedSumTyCon tc
|| tyConPrimRep tc /= VoidRep -- Note [Marshalling VoidRep]
= validIfUnliftedFFITypes dflags
| otherwise
= NotValid unlifted_only | 429 | legalFIPrimResultTyCon :: DynFlags -> TyCon -> Validity
legalFIPrimResultTyCon dflags tc
| isUnliftedTyCon tc
, isUnboxedTupleTyCon tc || isUnboxedSumTyCon tc
|| tyConPrimRep tc /= VoidRep -- Note [Marshalling VoidRep]
= validIfUnliftedFFITypes dflags
| otherwise
= NotValid unlifted_only | 306 | legalFIPrimResultTyCon dflags tc
| isUnliftedTyCon tc
, isUnboxedTupleTyCon tc || isUnboxedSumTyCon tc
|| tyConPrimRep tc /= VoidRep -- Note [Marshalling VoidRep]
= validIfUnliftedFFITypes dflags
| otherwise
= NotValid unlifted_only | 250 | true | true | 0 | 11 | 74 | 83 | 37 | 46 | null | null |
siddhanathan/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | assertErrorIdKey = mkPreludeMiscIdUnique 105 | 57 | assertErrorIdKey = mkPreludeMiscIdUnique 105 | 57 | assertErrorIdKey = mkPreludeMiscIdUnique 105 | 57 | false | false | 0 | 5 | 16 | 9 | 4 | 5 | null | null |
jyp/MarXup | MarXup/Beamer.hs | gpl-2.0 | uncover :: [Int] -> TeX -> TeX
uncover = frameCmd "uncover" | 59 | uncover :: [Int] -> TeX -> TeX
uncover = frameCmd "uncover" | 59 | uncover = frameCmd "uncover" | 28 | false | true | 0 | 8 | 10 | 32 | 14 | 18 | null | null |
acowley/ghc | compiler/prelude/THNames.hs | bsd-3-clause | -- data Con = ...
normalCName, recCName, infixCName, forallCName :: Name
normalCName = libFun (fsLit "normalC") normalCIdKey | 124 | normalCName, recCName, infixCName, forallCName :: Name
normalCName = libFun (fsLit "normalC") normalCIdKey | 106 | normalCName = libFun (fsLit "normalC") normalCIdKey | 51 | true | true | 0 | 7 | 16 | 29 | 18 | 11 | null | null |
facebookarchive/lex-pass | src/Lang/Php/Ast/Test.hs | bsd-3-clause | testDir :: FilePath
testDir = "src/Lang/Php/Ast/Test" | 53 | testDir :: FilePath
testDir = "src/Lang/Php/Ast/Test" | 53 | testDir = "src/Lang/Php/Ast/Test" | 33 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
yaxu/hstexture | Texture/Interp.hs | gpl-3.0 | start :: (ControlPattern -> IO ()) -> MVar (Maybe (Pattern (Colour Double))) -> IO (MVar Job)
start oscOut colourOut = do input <- newEmptyMVar
forkIO $ loop input
return input
where loop input =
do r <- runInterpreter $ runI input oscOut colourOut
case r of
Left err -> printInterpreterError err
Right () -> putStrLn "Eh?"
loop input | 460 | start :: (ControlPattern -> IO ()) -> MVar (Maybe (Pattern (Colour Double))) -> IO (MVar Job)
start oscOut colourOut = do input <- newEmptyMVar
forkIO $ loop input
return input
where loop input =
do r <- runInterpreter $ runI input oscOut colourOut
case r of
Left err -> printInterpreterError err
Right () -> putStrLn "Eh?"
loop input | 460 | start oscOut colourOut = do input <- newEmptyMVar
forkIO $ loop input
return input
where loop input =
do r <- runInterpreter $ runI input oscOut colourOut
case r of
Left err -> printInterpreterError err
Right () -> putStrLn "Eh?"
loop input | 366 | false | true | 0 | 13 | 183 | 156 | 70 | 86 | null | null |
gabesoft/kapi | src/Persistence/Common.hs | bsd-3-clause | -- ^
-- Create a definition for a required field without a default value
mkReqDef' :: Label -> (Label, FieldDefinition)
mkReqDef' name = mkFieldDef name True False False (Nothing :: Maybe String) | 195 | mkReqDef' :: Label -> (Label, FieldDefinition)
mkReqDef' name = mkFieldDef name True False False (Nothing :: Maybe String) | 122 | mkReqDef' name = mkFieldDef name True False False (Nothing :: Maybe String) | 75 | true | true | 0 | 7 | 31 | 46 | 25 | 21 | null | null |
jean-edouard/manager | upgrade-db/JSONTrees.hs | gpl-2.0 | jsBoxString :: String -> JSValue
jsBoxString = JSString . toJSString | 68 | jsBoxString :: String -> JSValue
jsBoxString = JSString . toJSString | 68 | jsBoxString = JSString . toJSString | 35 | false | true | 1 | 7 | 9 | 27 | 11 | 16 | null | null |
leohahn/scheme-interpreter | src/Lib.hs | bsd-3-clause | isFloat _ = Bool False | 22 | isFloat _ = Bool False | 22 | isFloat _ = Bool False | 22 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
brendanhay/gogol | gogol-androidmanagement/gen/Network/Google/Resource/AndroidManagement/Enterprises/WebApps/Create.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
ewacUploadType :: Lens' EnterprisesWebAppsCreate (Maybe Text)
ewacUploadType
= lens _ewacUploadType
(\ s a -> s{_ewacUploadType = a}) | 212 | ewacUploadType :: Lens' EnterprisesWebAppsCreate (Maybe Text)
ewacUploadType
= lens _ewacUploadType
(\ s a -> s{_ewacUploadType = a}) | 141 | ewacUploadType
= lens _ewacUploadType
(\ s a -> s{_ewacUploadType = a}) | 79 | true | true | 0 | 9 | 34 | 48 | 25 | 23 | null | null |
capitanbatata/sandbox | scrapping-expressions-boilerplate/src/MiniLang.hs | gpl-3.0 | t0 = Fork (Fork (Leaf "foo") (Leaf "bar")) (Leaf "baz") | 55 | t0 = Fork (Fork (Leaf "foo") (Leaf "bar")) (Leaf "baz") | 55 | t0 = Fork (Fork (Leaf "foo") (Leaf "bar")) (Leaf "baz") | 55 | false | false | 0 | 9 | 9 | 37 | 18 | 19 | null | null |
noteed/opengl-api | Text/OpenGL/Checks.hs | bsd-3-clause | params :: F -> Bool
params = all (has isParam) | 46 | params :: F -> Bool
params = all (has isParam) | 46 | params = all (has isParam) | 26 | false | true | 0 | 7 | 9 | 24 | 12 | 12 | null | null |
input-output-hk/pos-haskell-prototype | wallet/test/unit/Golden/WalletError.hs | mit | -------------------------------------------------------------------------------
-- UnsupportedMimeTypeError
-------------------------------------------------------------------------------
golden_UnsupportedMimeTypeError_UnsupportedMimeTypePresent :: Property
golden_UnsupportedMimeTypeError_UnsupportedMimeTypePresent =
goldenTestJSON
(UnsupportedMimeTypePresent "test")
"test/unit/Golden/golden/UnsupportedMimeTypeError_UnsupportedMimeTypePresent" | 472 | golden_UnsupportedMimeTypeError_UnsupportedMimeTypePresent :: Property
golden_UnsupportedMimeTypeError_UnsupportedMimeTypePresent =
goldenTestJSON
(UnsupportedMimeTypePresent "test")
"test/unit/Golden/golden/UnsupportedMimeTypeError_UnsupportedMimeTypePresent" | 284 | golden_UnsupportedMimeTypeError_UnsupportedMimeTypePresent =
goldenTestJSON
(UnsupportedMimeTypePresent "test")
"test/unit/Golden/golden/UnsupportedMimeTypeError_UnsupportedMimeTypePresent" | 213 | true | true | 0 | 6 | 36 | 26 | 14 | 12 | null | null |
nvasilakis/lsh | Types.hs | bsd-3-clause | showHigher (ZipWith) = " zipWith" | 33 | showHigher (ZipWith) = " zipWith" | 33 | showHigher (ZipWith) = " zipWith" | 33 | false | false | 0 | 6 | 4 | 12 | 6 | 6 | null | null |
olorin/amazonka | amazonka-redshift/gen/Network/AWS/Redshift/Types/Product.hs | mpl-2.0 | -- | The specific revision number of the database in the cluster.
cClusterRevisionNumber :: Lens' Cluster (Maybe Text)
cClusterRevisionNumber = lens _cClusterRevisionNumber (\ s a -> s{_cClusterRevisionNumber = a}) | 214 | cClusterRevisionNumber :: Lens' Cluster (Maybe Text)
cClusterRevisionNumber = lens _cClusterRevisionNumber (\ s a -> s{_cClusterRevisionNumber = a}) | 148 | cClusterRevisionNumber = lens _cClusterRevisionNumber (\ s a -> s{_cClusterRevisionNumber = a}) | 95 | true | true | 0 | 9 | 28 | 46 | 25 | 21 | null | null |
liyanchang/scheme-in-haskell | src/chp5.hs | mit | car badArgList = throwError $ NumArgs 1 badArgList | 50 | car badArgList = throwError $ NumArgs 1 badArgList | 50 | car badArgList = throwError $ NumArgs 1 badArgList | 50 | false | false | 1 | 6 | 7 | 21 | 8 | 13 | null | null |
TomMD/ghc | compiler/simplCore/CoreMonad.hs | bsd-3-clause | {-
************************************************************************
* *
Counting and logging
* *
************************************************************************
-}
verboseSimplStats :: Bool
verboseSimplStats = opt_PprStyle_Debug | 397 | verboseSimplStats :: Bool
verboseSimplStats = opt_PprStyle_Debug | 64 | verboseSimplStats = opt_PprStyle_Debug | 38 | true | true | 0 | 6 | 168 | 19 | 8 | 11 | null | null |
visood/bioalgo | test/Test/Examples/Prices.hs | bsd-3-clause | prices11 = filterPrices hourlyPrices (mkDateTime 3 5 2005 02 30)
(mkDateTime 4 5 2005 02 30) | 129 | prices11 = filterPrices hourlyPrices (mkDateTime 3 5 2005 02 30)
(mkDateTime 4 5 2005 02 30) | 129 | prices11 = filterPrices hourlyPrices (mkDateTime 3 5 2005 02 30)
(mkDateTime 4 5 2005 02 30) | 129 | false | false | 0 | 7 | 52 | 41 | 20 | 21 | null | null |
mbakke/ganeti | src/Ganeti/HTools/Cluster.hs | bsd-2-clause | genAllocNodes :: AlgorithmOptions -- ^ algorithmic options to honor
-> Group.List -- ^ Group list
-> Node.List -- ^ The node map
-> Int -- ^ The number of nodes required
-> Bool -- ^ Whether to drop or not
-- unallocable nodes
-> Result AllocNodes -- ^ The (monadic) result
genAllocNodes opts gl nl count drop_unalloc =
let filter_fn = if drop_unalloc
then filter (Group.isAllocable .
flip Container.find gl . Node.group)
else id
restrict_fn = maybe id (\ns -> filter (flip elem ns . Node.name))
$ algRestrictToNodes opts
all_nodes = restrict_fn . filter_fn $ getOnline nl
all_pairs = [(Node.idx p,
[Node.idx s | s <- all_nodes,
Node.idx p /= Node.idx s,
Node.group p == Node.group s]) |
p <- all_nodes]
in case count of
1 -> Ok (Left (map Node.idx all_nodes))
2 -> Ok (Right (filter (not . null . snd) all_pairs))
_ -> Bad "Unsupported number of nodes, only one or two supported"
-- | Try to allocate an instance on the cluster. | 1,332 | genAllocNodes :: AlgorithmOptions -- ^ algorithmic options to honor
-> Group.List -- ^ Group list
-> Node.List -- ^ The node map
-> Int -- ^ The number of nodes required
-> Bool -- ^ Whether to drop or not
-- unallocable nodes
-> Result AllocNodes
genAllocNodes opts gl nl count drop_unalloc =
let filter_fn = if drop_unalloc
then filter (Group.isAllocable .
flip Container.find gl . Node.group)
else id
restrict_fn = maybe id (\ns -> filter (flip elem ns . Node.name))
$ algRestrictToNodes opts
all_nodes = restrict_fn . filter_fn $ getOnline nl
all_pairs = [(Node.idx p,
[Node.idx s | s <- all_nodes,
Node.idx p /= Node.idx s,
Node.group p == Node.group s]) |
p <- all_nodes]
in case count of
1 -> Ok (Left (map Node.idx all_nodes))
2 -> Ok (Right (filter (not . null . snd) all_pairs))
_ -> Bad "Unsupported number of nodes, only one or two supported"
-- | Try to allocate an instance on the cluster. | 1,306 | genAllocNodes opts gl nl count drop_unalloc =
let filter_fn = if drop_unalloc
then filter (Group.isAllocable .
flip Container.find gl . Node.group)
else id
restrict_fn = maybe id (\ns -> filter (flip elem ns . Node.name))
$ algRestrictToNodes opts
all_nodes = restrict_fn . filter_fn $ getOnline nl
all_pairs = [(Node.idx p,
[Node.idx s | s <- all_nodes,
Node.idx p /= Node.idx s,
Node.group p == Node.group s]) |
p <- all_nodes]
in case count of
1 -> Ok (Left (map Node.idx all_nodes))
2 -> Ok (Right (filter (not . null . snd) all_pairs))
_ -> Bad "Unsupported number of nodes, only one or two supported"
-- | Try to allocate an instance on the cluster. | 910 | true | true | 0 | 17 | 567 | 310 | 157 | 153 | null | null |
lenary/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | spanFC NoFC fc = fc | 19 | spanFC NoFC fc = fc | 19 | spanFC NoFC fc = fc | 19 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 4541 = 4540 | 11 | 4541 = 4540 | 11 | 4541 = 4540 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
input-output-hk/pos-haskell-prototype | crypto/Pos/Crypto/Random.hs | mit | -- | Generate a cryptographically random 'ByteString' of specific length.
secureRandomBS :: MonadIO m => Int -> m ByteString
secureRandomBS = liftIO . randBytes | 160 | secureRandomBS :: MonadIO m => Int -> m ByteString
secureRandomBS = liftIO . randBytes | 86 | secureRandomBS = liftIO . randBytes | 35 | true | true | 0 | 7 | 23 | 30 | 15 | 15 | null | null |
AlephAlpha/Samau | OldSamau/Eval.hs | gpl-2.0 | smDiv (SmFloat x1:SmFloat x2:s) = smFloor $ smDivide $SmFloat x1:SmFloat x2:s | 77 | smDiv (SmFloat x1:SmFloat x2:s) = smFloor $ smDivide $SmFloat x1:SmFloat x2:s | 77 | smDiv (SmFloat x1:SmFloat x2:s) = smFloor $ smDivide $SmFloat x1:SmFloat x2:s | 77 | false | false | 0 | 9 | 10 | 48 | 22 | 26 | null | null |
brendanhay/gogol | gogol-container/gen/Network/Google/Resource/Container/Projects/Locations/Clusters/WellKnown/GetOpenidConfiguration.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
plcwkgocUploadType :: Lens' ProjectsLocationsClustersWellKnownGetOpenidConfiguration (Maybe Text)
plcwkgocUploadType
= lens _plcwkgocUploadType
(\ s a -> s{_plcwkgocUploadType = a}) | 260 | plcwkgocUploadType :: Lens' ProjectsLocationsClustersWellKnownGetOpenidConfiguration (Maybe Text)
plcwkgocUploadType
= lens _plcwkgocUploadType
(\ s a -> s{_plcwkgocUploadType = a}) | 189 | plcwkgocUploadType
= lens _plcwkgocUploadType
(\ s a -> s{_plcwkgocUploadType = a}) | 91 | true | true | 0 | 9 | 34 | 48 | 25 | 23 | null | null |
foreverbell/fm-client | exe/UI/Login.hs | bsd-3-clause | loginApp :: UI.App State Event
loginApp = UI.App { UI.appDraw = loginDraw
, UI.appChooseCursor = loginCursor
, UI.appHandleEvent = loginEvent
, UI.appStartEvent = return
, UI.appAttrMap = const UI.defaultAttributeMap
, UI.appLiftVtyEvent = Event
} | 355 | loginApp :: UI.App State Event
loginApp = UI.App { UI.appDraw = loginDraw
, UI.appChooseCursor = loginCursor
, UI.appHandleEvent = loginEvent
, UI.appStartEvent = return
, UI.appAttrMap = const UI.defaultAttributeMap
, UI.appLiftVtyEvent = Event
} | 355 | loginApp = UI.App { UI.appDraw = loginDraw
, UI.appChooseCursor = loginCursor
, UI.appHandleEvent = loginEvent
, UI.appStartEvent = return
, UI.appAttrMap = const UI.defaultAttributeMap
, UI.appLiftVtyEvent = Event
} | 324 | false | true | 1 | 9 | 141 | 83 | 44 | 39 | null | null |
emwap/feldspar-language | src/Feldspar/Core/Frontend/ConditionM.hs | bsd-3-clause | unlessM :: Data Bool -> M () -> M ()
unlessM c = ifM c (return ()) | 66 | unlessM :: Data Bool -> M () -> M ()
unlessM c = ifM c (return ()) | 66 | unlessM c = ifM c (return ()) | 29 | false | true | 0 | 9 | 16 | 54 | 23 | 31 | null | null |
emwap/feldspar-language | src/Feldspar/Core/Frontend/Array.hs | bsd-3-clause | getIx :: Type a => Data [a] -> Data Index -> Data a
getIx = sugarSymF GetIx | 75 | getIx :: Type a => Data [a] -> Data Index -> Data a
getIx = sugarSymF GetIx | 75 | getIx = sugarSymF GetIx | 23 | false | true | 0 | 8 | 16 | 41 | 19 | 22 | null | null |
phischu/fragnix | tests/packages/scotty/Network.Socket.Internal.hs | bsd-3-clause | throwSocketError = throwErrno | 29 | throwSocketError = throwErrno | 29 | throwSocketError = throwErrno | 29 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
sawaken/pure-lisp.hs | src/Parser.hs | mit | parse :: Parser a -> String -> Maybe (a, String)
parse (P p) inp = p inp | 72 | parse :: Parser a -> String -> Maybe (a, String)
parse (P p) inp = p inp | 72 | parse (P p) inp = p inp | 23 | false | true | 0 | 10 | 16 | 49 | 23 | 26 | null | null |
AlephAlpha/Samau | OldSamau/Eval.hs | gpl-2.0 | displayExpression (SmList xs) = "[" ++ (xs >>= displayExpression) ++ "]" | 75 | displayExpression (SmList xs) = "[" ++ (xs >>= displayExpression) ++ "]" | 75 | displayExpression (SmList xs) = "[" ++ (xs >>= displayExpression) ++ "]" | 75 | false | false | 0 | 8 | 13 | 30 | 15 | 15 | null | null |
ivan-m/servant-auth-token | src/Servant/Server/Auth/Token.hs | bsd-3-clause | authSignin :: AuthHandler m
=> Maybe Login -- ^ Login query parameter
-> Maybe Password -- ^ Password query parameter
-> Maybe Seconds -- ^ Expire query parameter, how many seconds the token is valid
-> m (OnlyField "token" SimpleToken) -- ^ If everything is OK, return token
authSignin mlogin mpass mexpire = do
login <- require "login" mlogin
pass <- require "pass" mpass
WithField uid UserImpl{..} <- guardLogin login pass
OnlyField <$> getAuthToken uid mexpire
where
guardLogin login pass = do -- check login and password, return passed user
muser <- getUserImplByLogin login
let err = throw401 "Cannot find user with given combination of login and pass"
case muser of
Nothing -> err
Just user@(WithField _ UserImpl{..}) -> if passToByteString pass `verifyPassword` passToByteString userImplPassword
then return user
else err
-- | Helper to get or generate new token for user | 940 | authSignin :: AuthHandler m
=> Maybe Login -- ^ Login query parameter
-> Maybe Password -- ^ Password query parameter
-> Maybe Seconds -- ^ Expire query parameter, how many seconds the token is valid
-> m (OnlyField "token" SimpleToken)
authSignin mlogin mpass mexpire = do
login <- require "login" mlogin
pass <- require "pass" mpass
WithField uid UserImpl{..} <- guardLogin login pass
OnlyField <$> getAuthToken uid mexpire
where
guardLogin login pass = do -- check login and password, return passed user
muser <- getUserImplByLogin login
let err = throw401 "Cannot find user with given combination of login and pass"
case muser of
Nothing -> err
Just user@(WithField _ UserImpl{..}) -> if passToByteString pass `verifyPassword` passToByteString userImplPassword
then return user
else err
-- | Helper to get or generate new token for user | 901 | authSignin mlogin mpass mexpire = do
login <- require "login" mlogin
pass <- require "pass" mpass
WithField uid UserImpl{..} <- guardLogin login pass
OnlyField <$> getAuthToken uid mexpire
where
guardLogin login pass = do -- check login and password, return passed user
muser <- getUserImplByLogin login
let err = throw401 "Cannot find user with given combination of login and pass"
case muser of
Nothing -> err
Just user@(WithField _ UserImpl{..}) -> if passToByteString pass `verifyPassword` passToByteString userImplPassword
then return user
else err
-- | Helper to get or generate new token for user | 656 | true | true | 1 | 16 | 201 | 229 | 104 | 125 | null | null |
rodrigofegui/UnB | 2017.2/Linguagens de Programação/Trab 2_Ver 2/Tst_F6LAE.hs | gpl-3.0 | ret_30 = BoolV True | 19 | ret_30 = BoolV True | 19 | ret_30 = BoolV True | 19 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
shlevy/ghc | compiler/hsSyn/HsTypes.hs | bsd-3-clause | hsExplicitLTyVarNames :: LHsQTyVars pass -> [IdP pass]
-- Explicit variables only
hsExplicitLTyVarNames qtvs = map hsLTyVarName (hsQTvExplicit qtvs) | 148 | hsExplicitLTyVarNames :: LHsQTyVars pass -> [IdP pass]
hsExplicitLTyVarNames qtvs = map hsLTyVarName (hsQTvExplicit qtvs) | 121 | hsExplicitLTyVarNames qtvs = map hsLTyVarName (hsQTvExplicit qtvs) | 66 | true | true | 0 | 7 | 17 | 39 | 19 | 20 | null | null |
brodyberg/Notes | GADT.hsproj/Main.hs | mit | stackManip3 =
push 3
>>= (\s -> pop)
>>= (\s -> pop) | 67 | stackManip3 =
push 3
>>= (\s -> pop)
>>= (\s -> pop) | 67 | stackManip3 =
push 3
>>= (\s -> pop)
>>= (\s -> pop) | 67 | false | false | 5 | 7 | 26 | 41 | 20 | 21 | null | null |
LukaHorvat/Flow | src/Pong/Main.hs | mit | startServer, startClient :: IO ()
startServer = serveGame config | 64 | startServer, startClient :: IO ()
startServer = serveGame config | 64 | startServer = serveGame config | 30 | false | true | 0 | 6 | 8 | 21 | 11 | 10 | null | null |
AlexanderPankiv/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | unpackCString_RDR = nameRdrName unpackCStringName | 55 | unpackCString_RDR = nameRdrName unpackCStringName | 55 | unpackCString_RDR = nameRdrName unpackCStringName | 55 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
mzero/barley | src/Barley/AltLoad.hs | apache-2.0 | loadObject' :: FilePath -> Key -> String -> IO Module
loadObject' p ky k
| ("HSrts"++sysPkgSuffix) `isSuffixOf` p = return (emptyMod p)
| otherwise
= do alreadyLoaded <- isLoaded k
when (not alreadyLoaded) $ do
r <- withCString p c_loadObj
when (not r) (panic $ "Could not load module `"++p++"'")
addModule k (emptyMod p) -- needs to Z-encode module name
return (emptyMod p)
where emptyMod q = Module q (mkModid q) Vanilla undefined ky
--
-- load a single object. no dependencies. You should know what you're
-- doing.
-- | 598 | loadObject' :: FilePath -> Key -> String -> IO Module
loadObject' p ky k
| ("HSrts"++sysPkgSuffix) `isSuffixOf` p = return (emptyMod p)
| otherwise
= do alreadyLoaded <- isLoaded k
when (not alreadyLoaded) $ do
r <- withCString p c_loadObj
when (not r) (panic $ "Could not load module `"++p++"'")
addModule k (emptyMod p) -- needs to Z-encode module name
return (emptyMod p)
where emptyMod q = Module q (mkModid q) Vanilla undefined ky
--
-- load a single object. no dependencies. You should know what you're
-- doing.
-- | 598 | loadObject' p ky k
| ("HSrts"++sysPkgSuffix) `isSuffixOf` p = return (emptyMod p)
| otherwise
= do alreadyLoaded <- isLoaded k
when (not alreadyLoaded) $ do
r <- withCString p c_loadObj
when (not r) (panic $ "Could not load module `"++p++"'")
addModule k (emptyMod p) -- needs to Z-encode module name
return (emptyMod p)
where emptyMod q = Module q (mkModid q) Vanilla undefined ky
--
-- load a single object. no dependencies. You should know what you're
-- doing.
-- | 544 | false | true | 0 | 15 | 166 | 197 | 94 | 103 | null | null |
michalkonecny/polypaver | src/PolyPaver/Simplify/Args.hs | bsd-3-clause | -- setMaxQLength . setStartDegree
-- where
-- setMaxQLength args =
-- if maxQueueLength args /= -1
-- then args -- maxQueueLength is explicitly set, do no change
-- else
-- case order args of
-- DFS -> args { maxQueueLength = maxQueueLengthDefaultDFS }
-- BFS -> args { maxQueueLength = maxQueueLengthDefaultBFS }
---- DFSthenBFS -> args { maxQueueLength = maxQueueLengthDefaultDFS }
---- BFSFalsifyOnly -> args { maxQueueLength = maxQueueLengthDefaultBFS }
-- setStartDegree args
-- | startDegree args == -1 = args { startDegree = degree args }
-- | otherwise = args
checkArgs :: Args -> [String]
checkArgs _args =
[] | 772 | checkArgs :: Args -> [String]
checkArgs _args =
[] | 54 | checkArgs _args =
[] | 24 | true | true | 0 | 6 | 254 | 37 | 26 | 11 | null | null |
oldmanmike/ghc | compiler/basicTypes/IdInfo.hs | bsd-3-clause | setArityInfo :: IdInfo -> ArityInfo -> IdInfo
setArityInfo info ar = info { arityInfo = ar } | 99 | setArityInfo :: IdInfo -> ArityInfo -> IdInfo
setArityInfo info ar = info { arityInfo = ar } | 99 | setArityInfo info ar = info { arityInfo = ar } | 53 | false | true | 0 | 6 | 23 | 32 | 17 | 15 | null | null |
RobinKrom/fasths | src/Codec/Fast/Encoder.hs | bsd-3-clause | -- pm: No, Nullable: Yes
asciiStrF2Cop (AsciiStringField(FieldInstrContent fname (Just Optional) (Just (Delta oc))))
= cp where cp (Just s) = let baseValue (Assigned p) = assertType p
baseValue (Undefined) = h oc
where h (OpContext _ _ (Just iv)) = ivToPrimitive iv
h (OpContext _ _ Nothing) = defaultBaseValue
baseValue (Empty) = throw $ D6 "previous value in a delta operator can not be empty."
in
do
p <- lift $ prevValue fname oc
lift $ updatePrevValue fname oc (Assigned (witnessType s)) >> return (encodeD0 $ delta_ s (baseValue p))
cp (Nothing) = nulL
-- pm: Yes, Nullable: Yes | 919 | asciiStrF2Cop (AsciiStringField(FieldInstrContent fname (Just Optional) (Just (Delta oc))))
= cp where cp (Just s) = let baseValue (Assigned p) = assertType p
baseValue (Undefined) = h oc
where h (OpContext _ _ (Just iv)) = ivToPrimitive iv
h (OpContext _ _ Nothing) = defaultBaseValue
baseValue (Empty) = throw $ D6 "previous value in a delta operator can not be empty."
in
do
p <- lift $ prevValue fname oc
lift $ updatePrevValue fname oc (Assigned (witnessType s)) >> return (encodeD0 $ delta_ s (baseValue p))
cp (Nothing) = nulL
-- pm: Yes, Nullable: Yes | 894 | asciiStrF2Cop (AsciiStringField(FieldInstrContent fname (Just Optional) (Just (Delta oc))))
= cp where cp (Just s) = let baseValue (Assigned p) = assertType p
baseValue (Undefined) = h oc
where h (OpContext _ _ (Just iv)) = ivToPrimitive iv
h (OpContext _ _ Nothing) = defaultBaseValue
baseValue (Empty) = throw $ D6 "previous value in a delta operator can not be empty."
in
do
p <- lift $ prevValue fname oc
lift $ updatePrevValue fname oc (Assigned (witnessType s)) >> return (encodeD0 $ delta_ s (baseValue p))
cp (Nothing) = nulL
-- pm: Yes, Nullable: Yes | 894 | true | false | 0 | 15 | 433 | 245 | 117 | 128 | null | null |
mettekou/ghc | compiler/simplCore/SimplUtils.hs | bsd-3-clause | mkCase1 dflags scrut bndr alts_ty alts = mkCase2 dflags scrut bndr alts_ty alts | 79 | mkCase1 dflags scrut bndr alts_ty alts = mkCase2 dflags scrut bndr alts_ty alts | 79 | mkCase1 dflags scrut bndr alts_ty alts = mkCase2 dflags scrut bndr alts_ty alts | 79 | false | false | 0 | 5 | 12 | 28 | 13 | 15 | null | null |
google/codeworld | codeworld-api/src/CodeWorld/Parameter.hs | apache-2.0 | bgColor :: Color
bgColor = RGBA 0.8 0.85 0.95 0.8 | 49 | bgColor :: Color
bgColor = RGBA 0.8 0.85 0.95 0.8 | 49 | bgColor = RGBA 0.8 0.85 0.95 0.8 | 32 | false | true | 0 | 5 | 9 | 20 | 10 | 10 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.