free-foil: Efficient Type-Safe Capture-Avoiding Substitution for Free (Scoped Monads)

[ bsd3, library, parsing ] [ Propose Tags ] [ Report a vulnerability ]
Versions [RSS] 0.0.2, 0.0.3, 0.1.0, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.4.0
Change log ChangeLog.md
Dependencies array (>=0.5.3.0 && <0.6), base (>=4.19 && <5), bifunctors (>=5.5 && <5.7), binary (>=0.8), bytestring (>=0.11), containers (>=0.6.8 && <0.9), deepseq (>=1.4 && <1.6), kind-generics (>=0.5.0 && <0.6), template-haskell (>=2.21.0.0 && <2.24), text (>=1.2.3.1 && <2.2) [details]
License BSD-3-Clause
Copyright 2023–2024 Nikolai Kudasov, Renata Shakirova, Egor Shalagin, Karina Tyulebaeva
Author Nikolai Kudasov
Maintainer nickolay.kudasov@gmail.com
Uploaded by NickolayKudasov at 2026-08-29T08:11:31Z
Category Parsing
Home page https://github.com/fizruk/free-foil#readme
Bug tracker https://github.com/fizruk/free-foil/issues
Source repo head: git clone https://github.com/fizruk/free-foil
Distributions LTSHaskell:0.2.0, Stackage:0.3.2
Reverse Dependencies 1 direct, 1 indirect [details]
Downloads 359 total (21 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-08-29 [all 1 reports]

Readme for free-foil-0.4.0

[back to package description]

free-foil

Efficient Type-Safe Capture-Avoiding Substitution for Free (Scoped Monads).

This package provides a scope-safe representation for syntax with binders. Scopes are tracked in a phantom type index, so that capture-avoidance is a property the type checker enforces rather than a discipline the programmer keeps. It builds on the foil of Maclaurin, Radul, and Paszke, extends it with patterns, and adds free scoped monads, so that substitution, α-equivalence, and conversion to and from a raw syntax are implemented once for every language whose syntax is given as a signature bifunctor.

  • Control.Monad.Foil — names, scopes, binders, and the Sinkable/CoSinkable classes.
  • Control.Monad.Free.Foil — the free foil: AST binder sig n, substitution, α-equivalence, supports, and conversions.
  • Control.Monad.Foil.TH and Control.Monad.Free.Foil.TH — Template Haskell that generates the scope-safe syntax from a raw (BNFC-generated) one.
  • Control.Monad.Foil.Blocks and Control.Monad.Foil.Registry — reserved ranges of names, for units that are checked independently and linked afterwards.
  • Control.Monad.Free.Foil.Binary and Control.Monad.Free.Foil.Artifact — serialisation of a checked unit, and the checks that loading one rests on.

See the repository README for the design and the papers behind it, and the documentation on Hackage for the modules themselves.