@hackage symantic-base0.1.0.20210703

Commonly useful symantics for Embedded Domain-Specific Languages (EDSL)

This is a work-in-progress collection of basic tagless-final combinators, along with some advanced utilities to exploit them.

  • Symantic.Typed is for combinators indexed by a single type.

  • Symantic.Dityped is for combinators indexed by an extensible function type, used for typed formatting, enabling type safe dual interpreters à la printf and scanf. Inspired by Oleg Kiselyov's PrintScanF.hs. For an example, see symantic-http.

  • Symantic.{Typed,Dityped}.Lang gather commonly used tagless-final combinators (the syntax part of symantics).

  • Symantic.Typed.Data is an interpreter enabling to pattern-match on combinators, while keeping their extensibility.

  • Symantic.{Typed,Dityped}.Derive enable to give a default value to combinators which avoids boilerplate code when implementing combinators for an interpreter is factorizable.

  • Symantic.Typed.ObserveSharing enables to observe Haskell let definitions, turning infinite values into finite ones, which is useful to inspect and optimize recursive grammars for example. Inspired by Andy Gill's Type-safe observable sharing in Haskell. For an example, see symantic-parser.

  • Symantic.Typed.Reify enables the lifting to any interpreter of any Haskell functions taking as arguments only polymorphic types (possibly constrained) or functions using such types. Inspired by Oleg Kiselyov's TDPE.hs.

  • Symantic.Typed.View is an interpreter enabling to turn combinators into a human-readable string.

  • Symantic.Dityped.ADT enables to define formats à la printf-scanf using data-constructors instead of Eithers of tuples. For an example, see symantic-atom.

  • Symantic.Dityped.CurryN gather utilities for currying or uncurrying tuples of size greater or equal to 2.

  • Symantic.Typed.Fixity gathers utilities for parsing or viewing infix, prefix and postfix combinators.