typist: Typelevel printf

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]

Warnings:


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.1
Change log CHANGELOG.md
Dependencies base (>=4.16 && <4.20), text, text-show [details]
License MIT
Author Danil Berestov
Maintainer goosedb@yandex.ru
Category Text
Home page https://github.com/goosedb/typist
Uploaded by goosedb at 2024-04-30T14:12:14Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for typist-0.1.0.1

[back to package description]

Typist

Typist is a library for interpolation. It uses type-level strings (Symbols) for template. It uses UnconsSynbol type family which is added in GHC-9.2, so you need GHC version 9.2 or higher to use it.

Core functionality is in Typist.Internal.Format:

An example of wrapping it (and also ready to use interface) is located in Typist.TextShow:

question = fmt @"Hello, #{name}, do you like #{dish}?" $ 
  (#name #= Unquoted "Mike") .
  (#dish #= Unquoted "pasta")

Performance is comparable with bare concatenation with <>. Benches can be found at test/Bench

O2

Alt text

O1

Alt text

O0

Alt text

To run benchmark use

$ cabal bench --benchmark-options '--svg results_cpu.svg'