Hoogle Search

Within LTS Haskell 24.6 (ghc-9.10.2)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. (|$) :: forall t (m :: Type -> Type) a b . (IsStream t, MonadAsync m) => (t m a -> t m b) -> t m a -> t m b

    streamly Streamly.Internal.Data.Stream.IsStream

    Parallel transform application operator; applies a stream transformation function t m a -> t m b to a stream t m a concurrently; the input stream is evaluated asynchronously in an independent thread yielding elements to a buffer and the transformation function runs in another thread consuming the input from the buffer. |$ is just like regular function application operator $ except that it is concurrent. If you read the signature as (t m a -> t m b) -> (t m a -> t m b) you can look at it as a transformation that converts a transform function to a buffered concurrent transform function. The following code prints a value every second even though each stage adds a 1 second delay.

    >>> :{
    Stream.drain $
    Stream.mapM (\x -> threadDelay 1000000 >> print x)
    |$ Stream.replicateM 3 (threadDelay 1000000 >> return 1)
    :}
    1
    1
    1
    
    Concurrent Since: 0.3.0 (Streamly)

  2. (|$.) :: (IsStream t, MonadAsync m) => (t m a -> m b) -> t m a -> m b

    streamly Streamly.Internal.Data.Stream.IsStream

    Parallel fold application operator; applies a fold function t m a -> m b to a stream t m a concurrently; The the input stream is evaluated asynchronously in an independent thread yielding elements to a buffer and the folding action runs in another thread consuming the input from the buffer. If you read the signature as (t m a -> m b) -> (t m a -> m b) you can look at it as a transformation that converts a fold function to a buffered concurrent fold function. The . at the end of the operator is a mnemonic for termination of the stream. In the example below, each stage introduces a delay of 1 sec but output is printed every second because both stages are concurrent.

    >>> import Control.Concurrent (threadDelay)
    
    >>> import Streamly.Prelude ((|$.))
    
    >>> :{
    Stream.foldlM' (\_ a -> threadDelay 1000000 >> print a) (return ())
    |$. Stream.replicateM 3 (threadDelay 1000000 >> return 1)
    :}
    1
    1
    1
    
    Concurrent Since: 0.3.0 (Streamly)

  3. (|$) :: forall t (m :: Type -> Type) a b . (IsStream t, MonadAsync m) => (t m a -> t m b) -> t m a -> t m b

    streamly Streamly.Prelude

    Parallel transform application operator; applies a stream transformation function t m a -> t m b to a stream t m a concurrently; the input stream is evaluated asynchronously in an independent thread yielding elements to a buffer and the transformation function runs in another thread consuming the input from the buffer. |$ is just like regular function application operator $ except that it is concurrent. If you read the signature as (t m a -> t m b) -> (t m a -> t m b) you can look at it as a transformation that converts a transform function to a buffered concurrent transform function. The following code prints a value every second even though each stage adds a 1 second delay.

    >>> :{
    Stream.drain $
    Stream.mapM (\x -> threadDelay 1000000 >> print x)
    |$ Stream.replicateM 3 (threadDelay 1000000 >> return 1)
    :}
    1
    1
    1
    
    Concurrent Since: 0.3.0 (Streamly)

  4. (|$.) :: (IsStream t, MonadAsync m) => (t m a -> m b) -> t m a -> m b

    streamly Streamly.Prelude

    Parallel fold application operator; applies a fold function t m a -> m b to a stream t m a concurrently; The the input stream is evaluated asynchronously in an independent thread yielding elements to a buffer and the folding action runs in another thread consuming the input from the buffer. If you read the signature as (t m a -> m b) -> (t m a -> m b) you can look at it as a transformation that converts a fold function to a buffered concurrent fold function. The . at the end of the operator is a mnemonic for termination of the stream. In the example below, each stage introduces a delay of 1 sec but output is printed every second because both stages are concurrent.

    >>> import Control.Concurrent (threadDelay)
    
    >>> import Streamly.Prelude ((|$.))
    
    >>> :{
    Stream.foldlM' (\_ a -> threadDelay 1000000 >> print a) (return ())
    |$. Stream.replicateM 3 (threadDelay 1000000 >> return 1)
    :}
    1
    1
    1
    
    Concurrent Since: 0.3.0 (Streamly)

  5. type family (f :: r ~> r') :<$>: (p :: PParser s r) :: PParser s r'

    symparsec Symparsec.Parser.Apply

    Apply the given type function to the result. Effectively fmap for parsers.

  6. (:$$:) :: Doc s -> Doc s -> Doc s

    symparsec Symparsec.Parser.Common

    stack docs on top of each other (newline)

  7. (<$) :: Functor f => a -> f b -> f a

    threepenny-gui Graphics.UI.Threepenny.Core

    Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

    Examples

    Perform a computation with Maybe and replace the result with a constant value if it is Just:
    >>> 'a' <$ Just 2
    Just 'a'
    
    >>> 'a' <$ Nothing
    Nothing
    

  8. (<$>) :: Functor f => (a -> b) -> f a -> f b

    threepenny-gui Graphics.UI.Threepenny.Core

    An infix synonym for fmap. The name of this operator is an allusion to $. Note the similarities between their types:

    ($)  ::              (a -> b) ->   a ->   b
    (<$>) :: Functor f => (a -> b) -> f a -> f b
    
    Whereas $ is function application, <$> is function application lifted over a Functor.

    Examples

    Convert from a Maybe Int to a Maybe String using show:
    >>> show <$> Nothing
    Nothing
    
    >>> show <$> Just 3
    Just "3"
    
    Convert from an Either Int Int to an Either Int String using show:
    >>> show <$> Left 17
    Left 17
    
    >>> show <$> Right 17
    Right "17"
    
    Double each element of a list:
    >>> (*2) <$> [1,2,3]
    [2,4,6]
    
    Apply even to the second element of a pair:
    >>> even <$> (2,2)
    (2,True)
    

  9. (:$$:) :: ErrorMessage -> ErrorMessage -> ErrorMessage

    typenums Data.TypeLits

    Stack two pieces of error message on top of each other.

  10. (<<$) :: Arrow a => a c d -> c -> a x d

    arrow-extras Control.Arrow.Extras

    precomposition with a pure value

Page 77 of many | Previous | Next