pure-borrow
Safe HaskellNone
LanguageGHC2021

Control.Monad.Borrow.Pure.Experimental.Loop

Description

This module provides Foldable class, and provides a way to loop through it while reborrowing existing Borrows into sublifetime. The module also introduces Borrows, which is a heterogeneous list of Borrows in the same lifetime.

Synopsis

Documentation

data Borrows (bk :: BorrowKind) (α :: Lifetime) (xs :: [Type]) where Source #

Constructors

BNil :: forall (bk :: BorrowKind) (α :: Lifetime). Borrows bk α ('[] :: [Type]) 
(:-) :: forall (bk :: BorrowKind) (α :: Lifetime) x (xs1 :: [Type]). !(Borrow bk α x) -> !(Borrows bk α xs1) -> Borrows bk α (x ': xs1) infixr 5 

Instances

Instances details
β <= α => (Borrows bk α xs :: Type) <: (Borrows bk' β xs :: Type) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Borrows

Methods

subtype :: SubtypeWitness (Borrows bk α xs) (Borrows bk' β xs) Source #

Reborrowable (Borrows bk :: Lifetime -> [Type] -> Type) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Borrows

Methods

locally' :: forall (α :: Lifetime) (a :: [Type]) (α' :: Lifetime) r. Borrows bk α a %1 -> (forall (β :: Lifetime). Borrows bk (β /\ α) a %1 -> BO/\ α') (After β r)) %1 -> BO α' (r, Borrows bk α a) Source #

Consumable (Borrows bk α xs) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Borrows

Methods

consume :: Borrows bk α xs %1 -> () #

Affine (Borrows bk α xs) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Borrows

Methods

aff :: Borrows bk α xs %1 -> Aff (Borrows bk α xs) Source #

forReborrowing :: forall {k} t bor (α :: Lifetime) (xs :: k) b c. (Traversable t, Reborrowable bor) => bor α xs %1 -> t b %1 -> (forall (β :: Lifetime). bor (β /\ α) xs %1 -> b %1 -> BO/\ α) c) -> BO α (t c, bor α xs) Source #

forReborrowingN iterates over the elements of Traversable t inside the delimited sublifetime, reborrowing the Borrows in bors@ for that sublifetime.

forReborrowingOf_ :: forall {k} bor s a (α :: Lifetime) (xs :: k). Reborrowable bor => Fold s a %1 -> bor α xs %1 -> s %1 -> (forall (β :: Lifetime). bor (β /\ α) xs %1 -> a %1 -> BO/\ α) ()) -> BO α (bor α xs) Source #

forReborrowing_ :: forall {k} t bor (α :: Lifetime) (xs :: k) a. (Foldable t, Reborrowable bor) => bor α xs %1 -> t a %1 -> (forall (β :: Lifetime). bor (β /\ α) xs %1 -> a %1 -> BO/\ α) ()) -> BO α (bor α xs) Source #

iforReborrowingOf_ :: forall {k} bor i s a (α :: Lifetime) (xs :: k). Reborrowable bor => IndexedFold i s a %1 -> bor α xs %1 -> s %1 -> (forall (β :: Lifetime). bor (β /\ α) xs %1 -> i %1 -> a %1 -> BO/\ α) ()) -> BO α (bor α xs) Source #

iforReborrowing_ :: forall {k} i t bor (α :: Lifetime) (xs :: k) a. (FoldableWithIndex i t, Reborrowable bor) => bor α xs %1 -> t a %1 -> (forall (β :: Lifetime). bor (β /\ α) xs %1 -> i %1 -> a %1 -> BO/\ α) ()) -> BO α (bor α xs) Source #

type Fold s a = forall w. Monoid w => (a %1 -> w) -> s %1 -> w Source #

class Foldable (t :: Type -> Type) where Source #

Methods

foldMap :: Monoid w => (a %1 -> w) -> t a %1 -> w Source #

Instances

Instances details
Foldable NonEmpty Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> NonEmpty a %1 -> w Source #

Foldable Vector Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> Vector a %1 -> w Source #

Foldable Maybe Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> Maybe a %1 -> w Source #

Foldable [] Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> [a] %1 -> w Source #

Consumable e => Foldable (Either e) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> Either e a %1 -> w Source #

Foldable (U1 :: Type -> Type) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> U1 a %1 -> w Source #

Foldable (V1 :: Type -> Type) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> V1 a %1 -> w Source #

Foldable (HashMap k) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> HashMap k a %1 -> w Source #

Consumable e => Foldable ((,) e) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> (e, a) %1 -> w Source #

GenericFoldable t => Foldable (Generically1 t) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> Generically1 t a %1 -> w Source #

(Foldable f, Foldable g) => Foldable (f :*: g) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> (f :*: g) a %1 -> w Source #

(Foldable f, Foldable g) => Foldable (f :+: g) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> (f :+: g) a %1 -> w Source #

Foldable f => Foldable (MP1 m f) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> MP1 m f a %1 -> w Source #

Foldable f => Foldable (M1 i c f) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

foldMap :: Monoid w => (a %1 -> w) -> M1 i c f a %1 -> w Source #

type IndexedFold i s a = forall w. Monoid w => (i %1 -> a %1 -> w) -> s %1 -> w Source #

class Foldable t => FoldableWithIndex i (t :: Type -> Type) | t -> i where Source #

Minimal complete definition

Nothing

Methods

ifoldMap :: Monoid w => (i %1 -> a %1 -> w) -> t a %1 -> w Source #

default ifoldMap :: (Foldable t, i ~ Int, Monoid w) => (i %1 -> a %1 -> w) -> t a %1 -> w Source #

Instances

Instances details
FoldableWithIndex () Maybe Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

ifoldMap :: Monoid w => (() %1 -> a %1 -> w) -> Maybe a %1 -> w Source #

FoldableWithIndex Int Vector Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

ifoldMap :: Monoid w => (Int %1 -> a %1 -> w) -> Vector a %1 -> w Source #

FoldableWithIndex Int [] Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

ifoldMap :: Monoid w => (Int %1 -> a %1 -> w) -> [a] %1 -> w Source #

FoldableWithIndex k (HashMap k) Source # 
Instance details

Defined in Control.Monad.Borrow.Pure.Experimental.Loop

Methods

ifoldMap :: Monoid w => (k %1 -> a %1 -> w) -> HashMap k a %1 -> w Source #

traverse_ :: (Foldable t, Applicative m) => (a %1 -> m ()) -> t a %1 -> m () Source #

for_ :: (Foldable t, Applicative m) => t a %1 -> (a %1 -> m ()) -> m () Source #

toListOf :: Fold s a %1 -> s %1 -> [a] Source #

toList :: Foldable t => t a %1 -> [a] Source #

foldBorrow :: forall (t :: Type -> Type) (bk :: BorrowKind) (α :: Lifetime) a. Foldable t => Fold (Borrow bk α (t a)) (Borrow bk α a) Source #

foldBorrowOf :: forall s a (bk :: BorrowKind) (α :: Lifetime). Fold s a %1 -> Fold (Borrow bk α s) (Borrow bk α a) Source #

genericFoldMap :: (GenericFoldable t, Monoid w) => (a %1 -> w) -> t a %1 -> w Source #

ifoldMapDefault :: forall (t :: Type -> Type) a. Foldable t => IndexedFold Int (t a) a Source #