symantic: Library for Typed Tagless-Final Higher-Order Composable DSL

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

This is an experimental library for composing, parsing, typing, compiling, transforming and interpreting a custom DSL (Domain-Specific Language) expressing a subset of GHC's Haskell type system.


[Skip to Readme]

Properties

Versions 6.0.0.20170623, 6.2.0.20170702, 6.3.0.20170703, 6.3.0.20170807, 6.3.0.20170807, 6.3.1.20180213, 6.3.2.20180208, 6.3.3.20190614, 6.3.4.20190712
Change log None available
Dependencies base (>=4.6 && <5), containers, mono-traversable, symantic-document, symantic-grammar, text, transformers [details]
License GPL-3.0-only
Author Julien Moutinho <julm+symantic@autogeree.net>
Maintainer Julien Moutinho <julm+symantic@autogeree.net>
Category Language
Bug tracker Julien Moutinho <julm+symantic@autogeree.net>
Source repo head: git clone git://git.autogeree.net/symantic
Uploaded by julm at 2017-08-07T16:35:09Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for symantic-6.3.0.20170807

[back to package description]

symantic

This is an experimental library for composing, parsing, typing, compiling, transforming and interpreting a custom DSL (Domain-Specific Language).

Features

Those custom DSL can express a subset of GHC's Haskell type system:

where "chosen X" means declared in Haskell and selected when composing the DSL.

In particular, this library is currently not able to:

And by itself, the DSL is only able to define new terms to be interpreted, no new types, or other type-level structures.

Warning

Please be aware that despite its using of powerful ideas from clever people, this remains a FUND-LESS SINGLE-PERSON EXPERIMENTAL LIBRARY. Meaning that it IS NOT heavily tested and documented, DOES NOT have a strong commitment to preserving backward compatibility, MAY FAIL to comply with the PVP, and CAN die without notice. You've been warned.

Use cases

The main goal of this library is to enable the runtime interpretation of terms, type-checked according to some types defined at composing-time (ie. GHC's compile-time).

Using a DSL enables to limit expressiveness in order to ease analysis. Here the idea is that the more complex logic shall remain written in Haskell, and then this library used to project an interface into a DSL (using GHC's Haskell as a FFI (Foreign Function Interface)). This in order to give runtime users the flexibility to write programs not requiring a full-blown Haskell compiler, yet enabling enough flexibility to let them express complex needs with a reasonably advanced type-safe way and a controlled environment of primitives.

Typical use cases

Usage

Please pick in symantic-lib a few specific Lib/*.hs files near what you want to do and the corresponding Lib/*/Test.hs file, if any in the Git repository, to learn by examples how to use this library.

Those Lib/*/Test.hs files use megaparsec as parser (see Grammar/Megaparsec.hs) and a default grammar somehow sticking to Haskell's, but staying context-free (so in particular: insensitive to the indentation), and supporting prefix and postfix operators. This grammar — itself written as a symantic embedded DSL with symantic-grammar — can be reused to build other ones, is not bound to a specific parser, and can produce its own EBNF rendition.

Acknowledgements

This library would probably be much worse than it is without the following seminal works:

Main ideas

Main extensions

Bugs

There are some of them hidding in there, and the whole thing is far from being perfect… Your comments, problem reports, or questions, are welcome! You have my email address, so… just send me some emails :]

To do