debruijn-safe-0.2: de Bruijn indices and levels
Safe HaskellSafe
LanguageHaskell2010

DeBruijn.Env

Synopsis

Documentation

data Env ctx a where Source #

Environment

>>> EmptyEnv :> 'a' :> 'b'
EmptyEnv :> 'a' :> 'b'

Constructors

EmptyEnv :: Env EmptyCtx a 
(:>) :: Env ctx a -> a -> Env (S ctx) a infixl 5 

Instances

Instances details
Foldable (Env ctx) Source #
>>> toList (tabulateEnv S3 id)
[2,1,0]
Instance details

Defined in DeBruijn.Env

Methods

fold :: Monoid m => Env ctx m -> m #

foldMap :: Monoid m => (a -> m) -> Env ctx a -> m #

foldMap' :: Monoid m => (a -> m) -> Env ctx a -> m #

foldr :: (a -> b -> b) -> b -> Env ctx a -> b #

foldr' :: (a -> b -> b) -> b -> Env ctx a -> b #

foldl :: (b -> a -> b) -> b -> Env ctx a -> b #

foldl' :: (b -> a -> b) -> b -> Env ctx a -> b #

foldr1 :: (a -> a -> a) -> Env ctx a -> a #

foldl1 :: (a -> a -> a) -> Env ctx a -> a #

toList :: Env ctx a -> [a] #

null :: Env ctx a -> Bool #

length :: Env ctx a -> Int #

elem :: Eq a => a -> Env ctx a -> Bool #

maximum :: Ord a => Env ctx a -> a #

minimum :: Ord a => Env ctx a -> a #

sum :: Num a => Env ctx a -> a #

product :: Num a => Env ctx a -> a #

Traversable (Env ctx) Source #
>>> traverse print (tabulateEnv S3 id)
2
1
0
EmptyEnv :> () :> () :> ()
Instance details

Defined in DeBruijn.Env

Methods

traverse :: Applicative f => (a -> f b) -> Env ctx a -> f (Env ctx b) #

sequenceA :: Applicative f => Env ctx (f a) -> f (Env ctx a) #

mapM :: Monad m => (a -> m b) -> Env ctx a -> m (Env ctx b) #

sequence :: Monad m => Env ctx (m a) -> m (Env ctx a) #

Functor (Env ctx) Source # 
Instance details

Defined in DeBruijn.Env

Methods

fmap :: (a -> b) -> Env ctx a -> Env ctx b #

(<$) :: a -> Env ctx b -> Env ctx a #

Show a => Show (Env ctx a) Source # 
Instance details

Defined in DeBruijn.Env

Methods

showsPrec :: Int -> Env ctx a -> ShowS #

show :: Env ctx a -> String #

showList :: [Env ctx a] -> ShowS #

lookupEnv :: Idx ctx -> Env ctx a -> a Source #

Lookup in the context.

>>> lookupEnv IZ (EmptyEnv :> 'a' :> 'b')
'b'

sizeEnv :: Env n a -> Size n Source #

Size of the environment.

>>> sizeEnv (EmptyEnv :> 'a' :> 'b')
2

tabulateEnv :: Size ctx -> (Idx ctx -> a) -> Env ctx a Source #