garden
Maintainergatlin@niltag.net
Safe HaskellSafe-Inferred
LanguageHaskell2010

Nested

Description

Re-implementation of a library by Kenneth Foner. Upgrades were made to make this compile and functional dependencies have been replaced by type families.

This is used in Sheet especially in order to automatically build and inspect multi-dimensional containers out of nested functors.

Synopsis

Nested functors

data Nested fs a Source #

A Nested fs a is the composition of all the layers mentioned in fs, applied to an a. Specifically, the fs parameter is a sort of snoc-list holding type constructors of kind (* -> *). The outermost layer appears as the parameter to Flat; the innermost layer appears as the rightmost argument to the outermost Nest.

Constructors

forall f.fs ~ F f => Flat (f a) 
forall fs' f.fs ~ N fs' f => Nest (Nested fs' (f a)) 

Instances

Instances details
Go Nil (Nested ts :: Type -> Type) Source # 
Instance details

Defined in Sheet

Methods

go :: forall (a :: k). RefList Nil -> Nested ts a -> Nested ts a Source #

(Take Nil (Nested ts), Functor (Nested ts)) => Take Nil (Nested (N ts Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type ListFrom (Nested (N ts Tape)) a Source #

Methods

take :: RefList Nil -> Nested (N ts Tape) a -> ListFrom (Nested (N ts Tape)) a Source #

View Nil (Nested (F Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type StreamFrom (Nested (F Tape)) a Source #

Methods

view :: RefList Nil -> Nested (F Tape) a -> StreamFrom (Nested (F Tape)) a Source #

(View Nil (Nested ts), Functor (Nested ts)) => View Nil (Nested (N ts Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type StreamFrom (Nested (N ts Tape)) a Source #

Methods

view :: RefList Nil -> Nested (N ts Tape) a -> StreamFrom (Nested (N ts Tape)) a Source #

InsertBase l => InsertNested (Nested (F l) :: Type -> Type) (Nested (F Tape)) Source # 
Instance details

Defined in Sheet

Methods

insertNested :: forall (a :: k). Nested (F l) a -> Nested (F Tape) a -> Nested (F Tape) a Source #

(InsertBase l, InsertNested (Nested ls) (Nested ts), Functor (Nested ls), Applicative (Nested ts)) => InsertNested (Nested (N ls l) :: Type -> Type) (Nested (N ts Tape) :: Type -> Type) Source # 
Instance details

Defined in Sheet

Methods

insertNested :: forall (a :: k). Nested (N ls l) a -> Nested (N ts Tape) a -> Nested (N ts Tape) a Source #

(NestedAs x (Nested ts y), AsDimensionalAs x (Nested ts y) ~ AsNestedAs x (Nested ts y)) => DimensionalAs x (Nested ts y) Source # 
Instance details

Defined in Sheet

Associated Types

type AsDimensionalAs x (Nested ts y) Source #

Methods

asDimensionalAs :: x -> Nested ts y -> AsDimensionalAs x (Nested ts y) Source #

Go ('Relative :-: Nil) (Nested (F Tape)) Source # 
Instance details

Defined in Sheet

Methods

go :: forall (a :: k). RefList ('Relative :-: Nil) -> Nested (F Tape) a -> Nested (F Tape) a Source #

(Go rs (Nested ts), Functor (Nested ts)) => Go ('Relative :-: rs) (Nested (N ts Tape) :: Type -> Type) Source # 
Instance details

Defined in Sheet

Methods

go :: forall (a :: k). RefList ('Relative :-: rs) -> Nested (N ts Tape) a -> Nested (N ts Tape) a Source #

Representable f => Representable (Nested (F f)) Source # 
Instance details

Defined in Nested

Associated Types

type Rep (Nested (F f))

Methods

tabulate :: (Rep (Nested (F f)) -> a) -> Nested (F f) a

index :: Nested (F f) a -> Rep (Nested (F f)) -> a

(Representable f, fs ~ NestedNTimes (NestedCount fs) f, Representable (Nested fs), Rep (Nested fs) ~ Counted (NestedCount fs) (Rep f)) => Representable (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Associated Types

type Rep (Nested (N fs f))

Methods

tabulate :: (Rep (Nested (N fs f)) -> a) -> Nested (N fs f) a

index :: Nested (N fs f) a -> Rep (Nested (N fs f)) -> a

Foldable f => Foldable (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

fold :: Monoid m => Nested (F f) m -> m Source #

foldMap :: Monoid m => (a -> m) -> Nested (F f) a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Nested (F f) a -> m Source #

foldr :: (a -> b -> b) -> b -> Nested (F f) a -> b Source #

foldr' :: (a -> b -> b) -> b -> Nested (F f) a -> b Source #

foldl :: (b -> a -> b) -> b -> Nested (F f) a -> b Source #

foldl' :: (b -> a -> b) -> b -> Nested (F f) a -> b Source #

foldr1 :: (a -> a -> a) -> Nested (F f) a -> a Source #

foldl1 :: (a -> a -> a) -> Nested (F f) a -> a Source #

toList :: Nested (F f) a -> [a] Source #

null :: Nested (F f) a -> Bool Source #

length :: Nested (F f) a -> Int Source #

elem :: Eq a => a -> Nested (F f) a -> Bool Source #

maximum :: Ord a => Nested (F f) a -> a Source #

minimum :: Ord a => Nested (F f) a -> a Source #

sum :: Num a => Nested (F f) a -> a Source #

product :: Num a => Nested (F f) a -> a Source #

(Foldable f, Foldable (Nested fs)) => Foldable (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

fold :: Monoid m => Nested (N fs f) m -> m Source #

foldMap :: Monoid m => (a -> m) -> Nested (N fs f) a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Nested (N fs f) a -> m Source #

foldr :: (a -> b -> b) -> b -> Nested (N fs f) a -> b Source #

foldr' :: (a -> b -> b) -> b -> Nested (N fs f) a -> b Source #

foldl :: (b -> a -> b) -> b -> Nested (N fs f) a -> b Source #

foldl' :: (b -> a -> b) -> b -> Nested (N fs f) a -> b Source #

foldr1 :: (a -> a -> a) -> Nested (N fs f) a -> a Source #

foldl1 :: (a -> a -> a) -> Nested (N fs f) a -> a Source #

toList :: Nested (N fs f) a -> [a] Source #

null :: Nested (N fs f) a -> Bool Source #

length :: Nested (N fs f) a -> Int Source #

elem :: Eq a => a -> Nested (N fs f) a -> Bool Source #

maximum :: Ord a => Nested (N fs f) a -> a Source #

minimum :: Ord a => Nested (N fs f) a -> a Source #

sum :: Num a => Nested (N fs f) a -> a Source #

product :: Num a => Nested (N fs f) a -> a Source #

Traversable f => Traversable (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Nested (F f) a -> f0 (Nested (F f) b) Source #

sequenceA :: Applicative f0 => Nested (F f) (f0 a) -> f0 (Nested (F f) a) Source #

mapM :: Monad m => (a -> m b) -> Nested (F f) a -> m (Nested (F f) b) Source #

sequence :: Monad m => Nested (F f) (m a) -> m (Nested (F f) a) Source #

(Traversable f, Traversable (Nested fs)) => Traversable (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Nested (N fs f) a -> f0 (Nested (N fs f) b) Source #

sequenceA :: Applicative f0 => Nested (N fs f) (f0 a) -> f0 (Nested (N fs f) a) Source #

mapM :: Monad m => (a -> m b) -> Nested (N fs f) a -> m (Nested (N fs f) b) Source #

sequence :: Monad m => Nested (N fs f) (m a) -> m (Nested (N fs f) a) Source #

Alternative f => Alternative (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

empty :: Nested (F f) a Source #

(<|>) :: Nested (F f) a -> Nested (F f) a -> Nested (F f) a Source #

some :: Nested (F f) a -> Nested (F f) [a] Source #

many :: Nested (F f) a -> Nested (F f) [a] Source #

(Applicative f, Alternative (Nested fs)) => Alternative (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

empty :: Nested (N fs f) a Source #

(<|>) :: Nested (N fs f) a -> Nested (N fs f) a -> Nested (N fs f) a Source #

some :: Nested (N fs f) a -> Nested (N fs f) [a] Source #

many :: Nested (N fs f) a -> Nested (N fs f) [a] Source #

Applicative f => Applicative (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

pure :: a -> Nested (F f) a Source #

(<*>) :: Nested (F f) (a -> b) -> Nested (F f) a -> Nested (F f) b Source #

liftA2 :: (a -> b -> c) -> Nested (F f) a -> Nested (F f) b -> Nested (F f) c Source #

(*>) :: Nested (F f) a -> Nested (F f) b -> Nested (F f) b Source #

(<*) :: Nested (F f) a -> Nested (F f) b -> Nested (F f) a Source #

(Applicative f, Applicative (Nested fs)) => Applicative (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

pure :: a -> Nested (N fs f) a Source #

(<*>) :: Nested (N fs f) (a -> b) -> Nested (N fs f) a -> Nested (N fs f) b Source #

liftA2 :: (a -> b -> c) -> Nested (N fs f) a -> Nested (N fs f) b -> Nested (N fs f) c Source #

(*>) :: Nested (N fs f) a -> Nested (N fs f) b -> Nested (N fs f) b Source #

(<*) :: Nested (N fs f) a -> Nested (N fs f) b -> Nested (N fs f) a Source #

Functor f => Functor (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

fmap :: (a -> b) -> Nested (F f) a -> Nested (F f) b Source #

(<$) :: a -> Nested (F f) b -> Nested (F f) a Source #

(Functor f, Functor (Nested fs)) => Functor (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

fmap :: (a -> b) -> Nested (N fs f) a -> Nested (N fs f) b Source #

(<$) :: a -> Nested (N fs f) b -> Nested (N fs f) a Source #

Comonad f => Comonad (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

extract :: Nested (F f) a -> a

duplicate :: Nested (F f) a -> Nested (F f) (Nested (F f) a)

extend :: (Nested (F f) a -> b) -> Nested (F f) a -> Nested (F f) b

(Comonad f, Comonad (Nested fs), Functor (Nested (N fs f)), Distributive f) => Comonad (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

extract :: Nested (N fs f) a -> a

duplicate :: Nested (N fs f) a -> Nested (N fs f) (Nested (N fs f) a)

extend :: (Nested (N fs f) a -> b) -> Nested (N fs f) a -> Nested (N fs f) b

ComonadApply f => ComonadApply (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

(<@>) :: Nested (F f) (a -> b) -> Nested (F f) a -> Nested (F f) b

(@>) :: Nested (F f) a -> Nested (F f) b -> Nested (F f) b

(<@) :: Nested (F f) a -> Nested (F f) b -> Nested (F f) a

(ComonadApply f, Distributive f, ComonadApply (Nested fs)) => ComonadApply (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

(<@>) :: Nested (N fs f) (a -> b) -> Nested (N fs f) a -> Nested (N fs f) b

(@>) :: Nested (N fs f) a -> Nested (N fs f) b -> Nested (N fs f) b

(<@) :: Nested (N fs f) a -> Nested (N fs f) b -> Nested (N fs f) a

Distributive f => Distributive (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

distribute :: Functor f0 => f0 (Nested (F f) a) -> Nested (F f) (f0 a)

collect :: Functor f0 => (a -> Nested (F f) b) -> f0 a -> Nested (F f) (f0 b)

distributeM :: Monad m => m (Nested (F f) a) -> Nested (F f) (m a)

collectM :: Monad m => (a -> Nested (F f) b) -> m a -> Nested (F f) (m b)

(Distributive f, Distributive (Nested fs)) => Distributive (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

distribute :: Functor f0 => f0 (Nested (N fs f) a) -> Nested (N fs f) (f0 a)

collect :: Functor f0 => (a -> Nested (N fs f) b) -> f0 a -> Nested (N fs f) (f0 b)

distributeM :: Monad m => m (Nested (N fs f) a) -> Nested (N fs f) (m a)

collectM :: Monad m => (a -> Nested (N fs f) b) -> m a -> Nested (N fs f) (m b)

Take ('Relative :-: Nil) (Nested (F Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type ListFrom (Nested (F Tape)) a Source #

Methods

take :: RefList ('Relative :-: Nil) -> Nested (F Tape) a -> ListFrom (Nested (F Tape)) a Source #

(Functor (Nested ts), Take rs (Nested ts)) => Take ('Relative :-: rs) (Nested (N ts Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type ListFrom (Nested (N ts Tape)) a Source #

Methods

take :: RefList ('Relative :-: rs) -> Nested (N ts Tape) a -> ListFrom (Nested (N ts Tape)) a Source #

View ('Relative :-: Nil) (Nested (F Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type StreamFrom (Nested (F Tape)) a Source #

(Functor (Nested ts), View rs (Nested ts)) => View ('Relative :-: rs) (Nested (N ts Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type StreamFrom (Nested (N ts Tape)) a Source #

Methods

view :: RefList ('Relative :-: rs) -> Nested (N ts Tape) a -> StreamFrom (Nested (N ts Tape)) a Source #

type AsDimensionalAs x (Nested ts y) Source # 
Instance details

Defined in Sheet

type AsDimensionalAs x (Nested ts y) = AsNestedAs x (Nested ts y)
type Rep (Nested (F f)) Source # 
Instance details

Defined in Nested

type Rep (Nested (F f)) = Counted (S Z) (Rep f)
type Rep (Nested (N fs f)) Source # 
Instance details

Defined in Nested

type Rep (Nested (N fs f)) = Counted (S (NestedCount fs)) (Rep f)
type ListFrom (Nested (F Tape)) a Source # 
Instance details

Defined in Sheet

type ListFrom (Nested (F Tape)) a = [a]
type ListFrom (Nested (N ts Tape)) a Source # 
Instance details

Defined in Sheet

type ListFrom (Nested (N ts Tape)) a = ListFrom (Nested ts) [a]
type ListFrom (Nested (N ts Tape)) a Source # 
Instance details

Defined in Sheet

type ListFrom (Nested (N ts Tape)) a = ListFrom (Nested ts) [a]
type StreamFrom (Nested (F Tape)) a Source # 
Instance details

Defined in Sheet

type StreamFrom (Nested (F Tape)) a = Stream a
type StreamFrom (Nested (F Tape)) a Source # 
Instance details

Defined in Sheet

type StreamFrom (Nested (F Tape)) a = Stream a
type StreamFrom (Nested (N ts Tape)) a Source # 
Instance details

Defined in Sheet

type StreamFrom (Nested (N ts Tape)) a = StreamFrom (Nested ts) (Stream a)
type StreamFrom (Nested (N ts Tape)) a Source # 
Instance details

Defined in Sheet

type StreamFrom (Nested (N ts Tape)) a = StreamFrom (Nested ts) (Stream a)

data F (x :: Type -> Type) Source #

Instances

Instances details
NestedCountable (F f :: Type) Source # 
Instance details

Defined in Nested

Associated Types

type NestedCount (F f) Source #

View Nil (Nested (F Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type StreamFrom (Nested (F Tape)) a Source #

Methods

view :: RefList Nil -> Nested (F Tape) a -> StreamFrom (Nested (F Tape)) a Source #

InsertBase l => InsertNested (Nested (F l) :: Type -> Type) (Nested (F Tape)) Source # 
Instance details

Defined in Sheet

Methods

insertNested :: forall (a :: k). Nested (F l) a -> Nested (F Tape) a -> Nested (F Tape) a Source #

Go ('Relative :-: Nil) (Nested (F Tape)) Source # 
Instance details

Defined in Sheet

Methods

go :: forall (a :: k). RefList ('Relative :-: Nil) -> Nested (F Tape) a -> Nested (F Tape) a Source #

Representable f => Representable (Nested (F f)) Source # 
Instance details

Defined in Nested

Associated Types

type Rep (Nested (F f))

Methods

tabulate :: (Rep (Nested (F f)) -> a) -> Nested (F f) a

index :: Nested (F f) a -> Rep (Nested (F f)) -> a

Foldable f => Foldable (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

fold :: Monoid m => Nested (F f) m -> m Source #

foldMap :: Monoid m => (a -> m) -> Nested (F f) a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Nested (F f) a -> m Source #

foldr :: (a -> b -> b) -> b -> Nested (F f) a -> b Source #

foldr' :: (a -> b -> b) -> b -> Nested (F f) a -> b Source #

foldl :: (b -> a -> b) -> b -> Nested (F f) a -> b Source #

foldl' :: (b -> a -> b) -> b -> Nested (F f) a -> b Source #

foldr1 :: (a -> a -> a) -> Nested (F f) a -> a Source #

foldl1 :: (a -> a -> a) -> Nested (F f) a -> a Source #

toList :: Nested (F f) a -> [a] Source #

null :: Nested (F f) a -> Bool Source #

length :: Nested (F f) a -> Int Source #

elem :: Eq a => a -> Nested (F f) a -> Bool Source #

maximum :: Ord a => Nested (F f) a -> a Source #

minimum :: Ord a => Nested (F f) a -> a Source #

sum :: Num a => Nested (F f) a -> a Source #

product :: Num a => Nested (F f) a -> a Source #

Traversable f => Traversable (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Nested (F f) a -> f0 (Nested (F f) b) Source #

sequenceA :: Applicative f0 => Nested (F f) (f0 a) -> f0 (Nested (F f) a) Source #

mapM :: Monad m => (a -> m b) -> Nested (F f) a -> m (Nested (F f) b) Source #

sequence :: Monad m => Nested (F f) (m a) -> m (Nested (F f) a) Source #

Alternative f => Alternative (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

empty :: Nested (F f) a Source #

(<|>) :: Nested (F f) a -> Nested (F f) a -> Nested (F f) a Source #

some :: Nested (F f) a -> Nested (F f) [a] Source #

many :: Nested (F f) a -> Nested (F f) [a] Source #

Applicative f => Applicative (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

pure :: a -> Nested (F f) a Source #

(<*>) :: Nested (F f) (a -> b) -> Nested (F f) a -> Nested (F f) b Source #

liftA2 :: (a -> b -> c) -> Nested (F f) a -> Nested (F f) b -> Nested (F f) c Source #

(*>) :: Nested (F f) a -> Nested (F f) b -> Nested (F f) b Source #

(<*) :: Nested (F f) a -> Nested (F f) b -> Nested (F f) a Source #

Functor f => Functor (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

fmap :: (a -> b) -> Nested (F f) a -> Nested (F f) b Source #

(<$) :: a -> Nested (F f) b -> Nested (F f) a Source #

Comonad f => Comonad (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

extract :: Nested (F f) a -> a

duplicate :: Nested (F f) a -> Nested (F f) (Nested (F f) a)

extend :: (Nested (F f) a -> b) -> Nested (F f) a -> Nested (F f) b

ComonadApply f => ComonadApply (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

(<@>) :: Nested (F f) (a -> b) -> Nested (F f) a -> Nested (F f) b

(@>) :: Nested (F f) a -> Nested (F f) b -> Nested (F f) b

(<@) :: Nested (F f) a -> Nested (F f) b -> Nested (F f) a

Distributive f => Distributive (Nested (F f)) Source # 
Instance details

Defined in Nested

Methods

distribute :: Functor f0 => f0 (Nested (F f) a) -> Nested (F f) (f0 a)

collect :: Functor f0 => (a -> Nested (F f) b) -> f0 a -> Nested (F f) (f0 b)

distributeM :: Monad m => m (Nested (F f) a) -> Nested (F f) (m a)

collectM :: Monad m => (a -> Nested (F f) b) -> m a -> Nested (F f) (m b)

Take ('Relative :-: Nil) (Nested (F Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type ListFrom (Nested (F Tape)) a Source #

Methods

take :: RefList ('Relative :-: Nil) -> Nested (F Tape) a -> ListFrom (Nested (F Tape)) a Source #

View ('Relative :-: Nil) (Nested (F Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type StreamFrom (Nested (F Tape)) a Source #

type NestedCount (F f :: Type) Source # 
Instance details

Defined in Nested

type NestedCount (F f :: Type) = S Z
type Rep (Nested (F f)) Source # 
Instance details

Defined in Nested

type Rep (Nested (F f)) = Counted (S Z) (Rep f)
type ListFrom (Nested (F Tape)) a Source # 
Instance details

Defined in Sheet

type ListFrom (Nested (F Tape)) a = [a]
type StreamFrom (Nested (F Tape)) a Source # 
Instance details

Defined in Sheet

type StreamFrom (Nested (F Tape)) a = Stream a
type StreamFrom (Nested (F Tape)) a Source # 
Instance details

Defined in Sheet

type StreamFrom (Nested (F Tape)) a = Stream a

data N (o :: Type) (i :: Type -> Type) Source #

Instances

Instances details
(Take Nil (Nested ts), Functor (Nested ts)) => Take Nil (Nested (N ts Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type ListFrom (Nested (N ts Tape)) a Source #

Methods

take :: RefList Nil -> Nested (N ts Tape) a -> ListFrom (Nested (N ts Tape)) a Source #

(View Nil (Nested ts), Functor (Nested ts)) => View Nil (Nested (N ts Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type StreamFrom (Nested (N ts Tape)) a Source #

Methods

view :: RefList Nil -> Nested (N ts Tape) a -> StreamFrom (Nested (N ts Tape)) a Source #

(InsertBase l, InsertNested (Nested ls) (Nested ts), Functor (Nested ls), Applicative (Nested ts)) => InsertNested (Nested (N ls l) :: Type -> Type) (Nested (N ts Tape) :: Type -> Type) Source # 
Instance details

Defined in Sheet

Methods

insertNested :: forall (a :: k). Nested (N ls l) a -> Nested (N ts Tape) a -> Nested (N ts Tape) a Source #

NestedCountable (N fs f :: Type) Source # 
Instance details

Defined in Nested

Associated Types

type NestedCount (N fs f) Source #

(Go rs (Nested ts), Functor (Nested ts)) => Go ('Relative :-: rs) (Nested (N ts Tape) :: Type -> Type) Source # 
Instance details

Defined in Sheet

Methods

go :: forall (a :: k). RefList ('Relative :-: rs) -> Nested (N ts Tape) a -> Nested (N ts Tape) a Source #

(Representable f, fs ~ NestedNTimes (NestedCount fs) f, Representable (Nested fs), Rep (Nested fs) ~ Counted (NestedCount fs) (Rep f)) => Representable (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Associated Types

type Rep (Nested (N fs f))

Methods

tabulate :: (Rep (Nested (N fs f)) -> a) -> Nested (N fs f) a

index :: Nested (N fs f) a -> Rep (Nested (N fs f)) -> a

(Foldable f, Foldable (Nested fs)) => Foldable (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

fold :: Monoid m => Nested (N fs f) m -> m Source #

foldMap :: Monoid m => (a -> m) -> Nested (N fs f) a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Nested (N fs f) a -> m Source #

foldr :: (a -> b -> b) -> b -> Nested (N fs f) a -> b Source #

foldr' :: (a -> b -> b) -> b -> Nested (N fs f) a -> b Source #

foldl :: (b -> a -> b) -> b -> Nested (N fs f) a -> b Source #

foldl' :: (b -> a -> b) -> b -> Nested (N fs f) a -> b Source #

foldr1 :: (a -> a -> a) -> Nested (N fs f) a -> a Source #

foldl1 :: (a -> a -> a) -> Nested (N fs f) a -> a Source #

toList :: Nested (N fs f) a -> [a] Source #

null :: Nested (N fs f) a -> Bool Source #

length :: Nested (N fs f) a -> Int Source #

elem :: Eq a => a -> Nested (N fs f) a -> Bool Source #

maximum :: Ord a => Nested (N fs f) a -> a Source #

minimum :: Ord a => Nested (N fs f) a -> a Source #

sum :: Num a => Nested (N fs f) a -> a Source #

product :: Num a => Nested (N fs f) a -> a Source #

(Traversable f, Traversable (Nested fs)) => Traversable (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Nested (N fs f) a -> f0 (Nested (N fs f) b) Source #

sequenceA :: Applicative f0 => Nested (N fs f) (f0 a) -> f0 (Nested (N fs f) a) Source #

mapM :: Monad m => (a -> m b) -> Nested (N fs f) a -> m (Nested (N fs f) b) Source #

sequence :: Monad m => Nested (N fs f) (m a) -> m (Nested (N fs f) a) Source #

(Applicative f, Alternative (Nested fs)) => Alternative (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

empty :: Nested (N fs f) a Source #

(<|>) :: Nested (N fs f) a -> Nested (N fs f) a -> Nested (N fs f) a Source #

some :: Nested (N fs f) a -> Nested (N fs f) [a] Source #

many :: Nested (N fs f) a -> Nested (N fs f) [a] Source #

(Applicative f, Applicative (Nested fs)) => Applicative (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

pure :: a -> Nested (N fs f) a Source #

(<*>) :: Nested (N fs f) (a -> b) -> Nested (N fs f) a -> Nested (N fs f) b Source #

liftA2 :: (a -> b -> c) -> Nested (N fs f) a -> Nested (N fs f) b -> Nested (N fs f) c Source #

(*>) :: Nested (N fs f) a -> Nested (N fs f) b -> Nested (N fs f) b Source #

(<*) :: Nested (N fs f) a -> Nested (N fs f) b -> Nested (N fs f) a Source #

(Functor f, Functor (Nested fs)) => Functor (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

fmap :: (a -> b) -> Nested (N fs f) a -> Nested (N fs f) b Source #

(<$) :: a -> Nested (N fs f) b -> Nested (N fs f) a Source #

(Comonad f, Comonad (Nested fs), Functor (Nested (N fs f)), Distributive f) => Comonad (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

extract :: Nested (N fs f) a -> a

duplicate :: Nested (N fs f) a -> Nested (N fs f) (Nested (N fs f) a)

extend :: (Nested (N fs f) a -> b) -> Nested (N fs f) a -> Nested (N fs f) b

(ComonadApply f, Distributive f, ComonadApply (Nested fs)) => ComonadApply (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

(<@>) :: Nested (N fs f) (a -> b) -> Nested (N fs f) a -> Nested (N fs f) b

(@>) :: Nested (N fs f) a -> Nested (N fs f) b -> Nested (N fs f) b

(<@) :: Nested (N fs f) a -> Nested (N fs f) b -> Nested (N fs f) a

(Distributive f, Distributive (Nested fs)) => Distributive (Nested (N fs f)) Source # 
Instance details

Defined in Nested

Methods

distribute :: Functor f0 => f0 (Nested (N fs f) a) -> Nested (N fs f) (f0 a)

collect :: Functor f0 => (a -> Nested (N fs f) b) -> f0 a -> Nested (N fs f) (f0 b)

distributeM :: Monad m => m (Nested (N fs f) a) -> Nested (N fs f) (m a)

collectM :: Monad m => (a -> Nested (N fs f) b) -> m a -> Nested (N fs f) (m b)

(Functor (Nested ts), Take rs (Nested ts)) => Take ('Relative :-: rs) (Nested (N ts Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type ListFrom (Nested (N ts Tape)) a Source #

Methods

take :: RefList ('Relative :-: rs) -> Nested (N ts Tape) a -> ListFrom (Nested (N ts Tape)) a Source #

(Functor (Nested ts), View rs (Nested ts)) => View ('Relative :-: rs) (Nested (N ts Tape)) Source # 
Instance details

Defined in Sheet

Associated Types

type StreamFrom (Nested (N ts Tape)) a Source #

Methods

view :: RefList ('Relative :-: rs) -> Nested (N ts Tape) a -> StreamFrom (Nested (N ts Tape)) a Source #

type NestedCount (N fs f :: Type) Source # 
Instance details

Defined in Nested

type NestedCount (N fs f :: Type) = S (NestedCount fs)
type Rep (Nested (N fs f)) Source # 
Instance details

Defined in Nested

type Rep (Nested (N fs f)) = Counted (S (NestedCount fs)) (Rep f)
type ListFrom (Nested (N ts Tape)) a Source # 
Instance details

Defined in Sheet

type ListFrom (Nested (N ts Tape)) a = ListFrom (Nested ts) [a]
type ListFrom (Nested (N ts Tape)) a Source # 
Instance details

Defined in Sheet

type ListFrom (Nested (N ts Tape)) a = ListFrom (Nested ts) [a]
type StreamFrom (Nested (N ts Tape)) a Source # 
Instance details

Defined in Sheet

type StreamFrom (Nested (N ts Tape)) a = StreamFrom (Nested ts) (Stream a)
type StreamFrom (Nested (N ts Tape)) a Source # 
Instance details

Defined in Sheet

type StreamFrom (Nested (N ts Tape)) a = StreamFrom (Nested ts) (Stream a)

Deconstructing nested functors

type family UnNest x where ... Source #

Equations

UnNest (Nested (F f) a) = f a 
UnNest (Nested (N fs f) a) = Nested fs (f a) 

unNest :: Nested fs a -> UnNest (Nested fs a) Source #

Manipulating nested functors

class NestedCountable (x :: k) Source #

Associated Types

type NestedCount x :: Type Source #

Instances

Instances details
NestedCountable (F f :: Type) Source # 
Instance details

Defined in Nested

Associated Types

type NestedCount (F f) Source #

NestedCountable (N fs f :: Type) Source # 
Instance details

Defined in Nested

Associated Types

type NestedCount (N fs f) Source #

type family NestedNTimes (n :: Type) (f :: Type -> Type) where ... Source #

Equations

NestedNTimes (S Z) f = F f 
NestedNTimes (S n) f = N (NestedNTimes n f) f