Control.Applicative.PhantomState: exported symbols usage examples

Symbols

  • changeState See 1 Occurences [+] Collapse [-]
    Found in Data.BinaryList from the package binary-list
      runState $ replicateA n $ StateT $
        \xs -> pure $ case xs of
                        (h:t) -> (h,t )
                        _     -> (e,[])
    
    -- | /O(n)/. Create a list from the elements of a binary list matching a given
    --   condition.
    toListFilter :: (a -> Bool) -> BinList a -> [a]
    {-# INLINE toListFilter #-}
    toListFilter c = foldr (\x -> if c x then (x:) else id) []
    
    -- | /O(n)/. Create a list extracting a sublist of elements from a binary list.
    toListSegment :: Int -> Int -> BinList a -> [a]
    {-# INLINE toListSegment #-}
    toListSegment s e xs = runPhantomState (traverseSegment (changeState . (:)) s e xs) []
    
    -- | Apply an applicative action to every element in a segment of a binary list, from left to right.
    traverseSegment :: Applicative f => (a -> f ()) -> Int -> Int -> BinList a -> f ()
    {-# INLINE traverseSegment #-}
    traverseSegment f s e xs
    

    runPhantomState See 1 Occurences [+] Collapse [-]
    Found in Data.BinaryList from the package binary-list
      runState $ replicateA n $ StateT $
        \xs -> pure $ case xs of
                        (h:t) -> (h,t )
                        _     -> (e,[])
    
    -- | /O(n)/. Create a list from the elements of a binary list matching a given
    --   condition.
    toListFilter :: (a -> Bool) -> BinList a -> [a]
    {-# INLINE toListFilter #-}
    toListFilter c = foldr (\x -> if c x then (x:) else id) []
    
    -- | /O(n)/. Create a list extracting a sublist of elements from a binary list.
    toListSegment :: Int -> Int -> BinList a -> [a]
    {-# INLINE toListSegment #-}
    toListSegment s e xs = runPhantomState (traverseSegment (changeState . (:)) s e xs) []
    
    -- | Apply an applicative action to every element in a segment of a binary list, from left to right.
    traverseSegment :: Applicative f => (a -> f ()) -> Int -> Int -> BinList a -> f ()
    {-# INLINE traverseSegment #-}
    traverseSegment f s e xs
    

    runPhantomStateT No usage example found for this symbol :( Collapse [-]
    useAndChangeState No usage example found for this symbol :( Collapse [-]
    useState No usage example found for this symbol :( Collapse [-]
    PhantomState No usage example found for this symbol :( Collapse [-]
    PhantomStateT No usage example found for this symbol :( Collapse [-]