Copyright | (c) 2014 Aleksey Kliger |
---|---|
License | BSD3 (See LICENSE) |
Maintainer | Aleksey Kliger |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Extensions | DeriveGeneric |
Unbound.Generics.LocallyNameless.Rebind
Description
The pattern
binds the names in Rebind
p1 p2p1
and p2
just as (p1, p2)
would,
however it additionally also brings the names of p1
into scope in p2
.
Documentation
is a pattern that binds the names of Rebind
p1 p2p1
and p2
, and additionally
brings the names of p1
into scope over p2
.
This may be used, for example, to faithfully represent Scheme's let*
binding form, defined by:
(let* () body) ≙ body (let* ([v1, e1] binds ...) body) ≙ (let ([v1, e1]) (let* (binds ...) body))
using the following AST:
type Var = Name Expr data Lets = EmptyLs | ConsLs (Rebind (Var, Embed Expr) Lets) data Expr = ... | LetStar (Bind Lets Expr) | ...
Constructors
Rebnd p1 p2 |
Instances
(Subst c p1, Subst c p2) => Subst c (Rebind p1 p2) Source # | |
(Eq p2, Eq p1) => Eq (Rebind p1 p2) Source # | |
(Show p1, Show p2) => Show (Rebind p1 p2) Source # | |
Generic (Rebind p1 p2) Source # | |
(NFData p1, NFData p2) => NFData (Rebind p1 p2) Source # | |
(Alpha p1, Alpha p2) => Alpha (Rebind p1 p2) Source # | |
type Rep (Rebind p1 p2) Source # | |