ermine-0.6: Ermine

Copyright(c) Edward Kmett
LicenseBSD3
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Ermine.Syntax.Scope

Description

This module provides extensions to the bound package.

Synopsis

Documentation

hoistScope :: Functor f => (forall x. f x -> g x) -> Scope b f a -> Scope b g a

bitraverseScope :: (Bitraversable t, Applicative f) => (k -> f k') -> (a -> f a') -> Scope b (t k) a -> f (Scope b (t k') a')

transverseScope :: (Applicative f, Monad f, Traversable g) => (forall r. g r -> f (h r)) -> Scope b g a -> f (Scope b h a)

class Monad m => BoundBy tm m | tm -> m where Source

Generalizes Bound to permit binding by another type without taking it as a parameter.

Methods

boundBy :: (a -> m b) -> tm a -> tm b Source

Instances

BoundBy Schema Kind 
BoundBy (Constructor k) (Type k) 
BoundBy (DataType k) (Type k) 
Monad m => BoundBy (Scope b m) m 
Monad f => BoundBy (Alt t f) f 
Monad c => BoundBy (Match t c) c 

instantiateVars :: Monad t => [a] -> Scope Int t a -> t a

serializeScope3 :: MonadPut m => (b -> m ()) -> (forall a. (a -> m ()) -> f a -> m ()) -> (v -> m ()) -> Scope b f v -> m () Source

deserializeScope3 :: MonadGet m => m b -> (forall a. m a -> m (f a)) -> m v -> m (Scope b f v) Source

mergeScope :: Monad c => Scope b1 (Scope b2 c) a -> Scope (Var b1 b2) c a Source

splitScope :: (Applicative c, Monad c) => Scope (Var b1 b2) c a -> Scope b1 (Scope b2 c) a Source

rebind :: Functor f => (b -> Var b' (f a)) -> Scope b f a -> Scope b' f a Source

Enables a partial rebinding and instantiation of the bound variables in a Scope.

inScope :: (Functor f, Monad t) => (t (Var b a) -> f (t (Var b a))) -> Scope b t a -> f (Scope b t a) Source

Helper function for when you wish to run an action on a smashed version of a scope. Transforms traversals for generality.

_Scope :: Iso (Scope b f a) (Scope b' f' a') (f (Var b (f a))) (f' (Var b' (f' a'))) Source