HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulegrapesy-1.1.1Haskell2010

Network.GRPC.Common.StreamElem

Positioned elements

Intended for qualified import.

import Network.GRPC.Common.StreamElem qualified as StreamElem

Network.GRPC.Common (intended for unqualified import) exports StreamElem(..), but none of the operations on StreamElem.

  • 1 type
  • 6 values
  • Packagegrapesy-1.1.1
  • Exports7
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceStreamElem.hs
datadata StreamElem b a
#

An element positioned in a stream

Constructors

  • StreamElem !a

    Element in the stream

    The final element in a stream may or may not be marked as final; if it is not, we will only discover after receiving the final element that it was in fact final. Moreover, we do not know ahead of time whether or not the final element will be marked.

    When we receive an element and it is not marked final, this might therefore mean one of two things, without being able to tell which:

    • We are dealing with a stream in which the final element is not marked.

    In this case, the element may or may not be the final element; if it is, the next value will be NoMoreElems (but waiting for the next value might mean a blocking call).

    • We are dealing with a stream in which the final element is marked.

    In this case, this element is not final (and the final element, when we receive it, will be tagged as Final).

  • FinalElem !a !b

    We received the final element

    The final element is annotated with some additional information.

  • NoMoreElems !b

    There are no more elements

    This is used in two situations:

    • The stream didn't contain any elements at all.

    • The final element was not marked as final. See StreamElem for detailed additional discussion.

Instances8Bifoldable, Bifunctor, Bitraversable, Functor, Foldable, Traversable, …

Conversion

1 declaration

Iteration

0 declarations

Iteration

5 declarations
valuemapM_ :: Monad m => (StreamElem b a -> m ()) -> [a] -> b -> m ()
#

Invoke the callback for each element

The final element is marked using FinalElem; the callback is only invoked on NoMoreElems if the list is empty.

   mapM_ f ([1,2,3], b)
== do f (StreamElem 1)
      f (StreamElem 2)
      f (FinalElem 3 b)

   mapM_ f ([], b)
== do f (NoMoreElems b)