haskell-names-0.7.0: Name resolution library for Haskell

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Names.Open

Synopsis

Documentation

class Typeable a => Resolvable a where Source #

A type that implements Resolvable provides a way to perform a shallow scope-aware traversal.

Minimal complete definition

rtraverse

Methods

rtraverse :: (Applicative f, ?alg :: Alg f) => a -> Scope -> f a Source #

Instances

(Typeable * a, GTraversable Resolvable a) => Resolvable a Source # 

Methods

rtraverse :: (Applicative f, ?alg :: Alg f) => a -> Scope -> f a Source #

newtype Alg w Source #

The algebra for rtraverse. It's newtype-wrapped because an implicit parameter cannot be polymorphic.

Constructors

Alg 

Fields

rmap :: Resolvable a => (forall b. Resolvable b => Scope -> b -> b) -> Scope -> a -> a Source #

Analogous to gmap, but for Resolvable

rfoldMap :: (Monoid r, Resolvable a) => (forall b. Resolvable b => Scope -> b -> r) -> Scope -> a -> r Source #

Analogous to gmap, but for Resolvable

data Scope Source #

Contains information about the node's enclosing scope. Can be accessed through the lenses: gTable, lTable, nameCtx, instanceQualification, wcNames. If we enter an instance with a qualified class name we have to remember the qualification to resolve method names.

data NameContext Source #

Describes how we should treat names in the current context

Constructors

BindingT 
BindingV 
ReferenceT 
ReferenceV 
ReferenceUV

Reference a method in an instance declaration Unqualified names also match qualified names in scope https://www.haskell.org/pipermail/haskell-prime/2008-April/002569.html

ReferenceUT

Reference an associated type in an instance declaration Unqualified names also match qualified names in scope https://www.haskell.org/pipermail/haskell-prime/2008-April/002569.html

SignatureV

A type signature contains an always unqualified Name that always refers to a value bound in the same module.

Other 

initialScope :: ModuleName -> Table -> Scope Source #

Create an initial scope

type WcNames = [WcField] Source #

Information about the names being introduced by a record wildcard

During resolving traversal, we always (lazily) construct this list when we process PRec or RecConstr, even if it doesn't contain a wildcard.

Then, if the pattern or construction actually contains a wildcard, we use the computed value.

data WcField Source #

Information about a field in the wildcard

Constructors

WcField 

Fields