Hoogle Search

Within LTS Haskell 24.38 (ghc-9.10.3)

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

  1. unfoldlRangeMaybeWithBase :: forall (n :: Nat) (v :: Nat) (w :: Nat) s a . Unfoldl n v w => (s -> Maybe (s, a)) -> s -> RangeR n w a -> Maybe (RangeR v w a)

    ranged-list Data.List.Range

    It is like unfoldlRangeMaybe. But it has already prepared values.

    >>> :set -XDataKinds
    
    >>> count n = if n < 3 then Just (n + 1, n * 3) else Nothing
    
    >>> xs = NilR :++ 123 :+ 456 :: RangeR 1 5 Int
    
    >>> unfoldlRangeMaybeWithBase count 1 xs :: Maybe (RangeR 3 5 Int)
    Just ((((NilR :++ 6) :+ 3) :+ 123) :+ 456)
    

  2. unfoldrMRangeMaybe :: forall (w :: Natural) (v :: Nat) m a . (0 <= w, Unfoldr 0 v w, Monad m) => m Bool -> m a -> m (Maybe (RangeL v w a))

    ranged-list Data.List.Range

    It is like unfoldrRangeMaybe. But it use a monad instead of a function. The first argument monad return boolean value. It create values while this boolean value is True. If this boolean value is False before to create enough values or True after to create full values, then unfoldrMRangeMaybe return Nothing.

    >>> :set -XDataKinds
    
    >>> :module + Data.IORef
    
    >>> r <- newIORef 1
    
    >>> check n0 = (< n0) <$> readIORef r
    
    >>> count = readIORef r >>= \n -> n * 3 <$ writeIORef r (n + 1)
    
    >>> unfoldrMRangeMaybe (check 2) count :: IO (Maybe (RangeL 3 5 Integer))
    Nothing
    
    >>> writeIORef r 1
    
    >>> unfoldrMRangeMaybe (check 5) count :: IO (Maybe (RangeL 3 5 Integer))
    Just (3 :. (6 :. (9 :. (12 :.. NilL))))
    
    >>> writeIORef r 1
    
    >>> unfoldrMRangeMaybe (check 10) count :: IO (Maybe (RangeL 3 5 Integer))
    Nothing
    

  3. unfoldrMRangeMaybeWithBase :: (Unfoldr n v w, Monad m) => RangeL n w a -> m Bool -> m a -> m (Maybe (RangeL v w a))

    ranged-list Data.List.Range

    It is like unfoldrMRangeMaybe. But it has already prepared values.

    >>> :set -XDataKinds -fno-warn-tabs
    
    >>> :module + Data.IORef
    
    >>> r <- newIORef 1
    
    >>> check = (< 3) <$> readIORef r
    
    >>> count = readIORef r >>= \n -> n * 3 <$ writeIORef r (n + 1)
    
    >>> xs = 123 :. 456 :.. NilL :: RangeL 1 5 Integer
    
    >>> :{
    unfoldrMRangeMaybeWithBase xs check count
    :: IO (Maybe (RangeL 3 5 Integer))
    :}
    Just (123 :. (456 :. (3 :. (6 :.. NilL))))
    

  4. unfoldrRangeMaybe :: forall (w :: Natural) (v :: Nat) s a . (0 <= w, Unfoldr 0 v w) => (s -> Maybe (a, s)) -> s -> Maybe (RangeL v w a)

    ranged-list Data.List.Range

    To eveluate a function to construct a list. The function recieve a state and return a nothing value or an element and a new state. If number of created elements is less than a minimum number of list elements or greater than a maximum number, then return Nothing.

    >>> :set -XDataKinds
    
    >>> next n0 n = if n < n0 then Just (n * 3, n + 1) else Nothing
    
    >>> unfoldrRangeMaybe (next 2) 1 :: Maybe (RangeL 3 5 Int)
    Nothing
    
    >>> unfoldrRangeMaybe (next 5) 1 :: Maybe (RangeL 3 5 Int)
    Just (3 :. (6 :. (9 :. (12 :.. NilL))))
    
    >>> unfoldrRangeMaybe (next 10) 1 :: Maybe (RangeL 3 5 Int)
    Nothing
    

  5. unfoldrRangeMaybeWithBase :: forall (n :: Nat) (v :: Nat) (w :: Nat) a s . Unfoldr n v w => RangeL n w a -> (s -> Maybe (a, s)) -> s -> Maybe (RangeL v w a)

    ranged-list Data.List.Range

    It is like unfoldrRangeMaybe. But it has already prepared values.

    >>> :set -XDataKinds
    
    >>> xs = 123 :. 456 :.. NilL :: RangeL 1 5 Int
    
    >>> next n = if n < 3 then Just (n * 3, n + 1) else Nothing
    
    >>> unfoldrRangeMaybeWithBase xs next 1 :: Maybe (RangeL 3 5 Int)
    Just (123 :. (456 :. (3 :. (6 :.. NilL))))
    

  6. fromMaybe :: Exception e => e -> Maybe a -> BitGet a

    rattletrap Rattletrap.Type.Attribute

    No documentation available.

  7. whenMaybe :: Applicative m => Bool -> m a -> m (Maybe a)

    rattletrap Rattletrap.Utility.Monad

    No documentation available.

  8. indexMaybe :: ByteString -> Int -> Maybe Word8

    rawfilepath Data.ByteString.RawFilePath

    O(1) ByteString index, starting from 0, that returns Just if:

    0 <= n < length bs
    

  9. decodeMaybeOf :: Typeable a => Typed (Decoder a -> Decoder (Maybe a))

    registry-aeson Data.Registry.Aeson.Decoder

    Add a Maybe (Decoder a) to a registry of decoders usage: decoders = decodeMaybeOf @a <: otherDecoders the list of otherDecoders must contain a Decoder a otherwise there will be a compilation error

  10. encodeMaybeOf :: Typeable a => Typed (Encoder a -> Encoder (Maybe a))

    registry-aeson Data.Registry.Aeson.Encoder

    Create an Encoder for a (Maybe a)

Page 284 of many | Previous | Next