xformat
Version 0.1 revision 0 uploaded by SeanLeather.
Package meta
- Synopsis
- Extensible, type-safe formatting with scanf- and printf-like functions
- Description
Warning: This version of the package is very experimental and the interface may change in later versions. I am seeking comments to improve it.
This package is composed of two functions for formatted conversion between strings and typed values. Each is defined as a type-indexed function using a type class with multiple parameters and functional dependencies along with format descriptors.
Text.XFormat.Read allows one to parse values from a formatted string. Its functionality is similar to the C
scanf
function. Unlikescanf
, however, the format descriptor is well-typed, ensuring that the output type is statically known.Text.XFormat.Show allows one to print values to a formatted string. Its functionality is similar to the C
printf
function. Unlikeprintf
, however, the format descriptor is well-typed, ensuring that the variable number arguments are statically known.These functions can be easily extended to support new formats and new types. Extension is simple: define a format descriptor and an instance of the appropriate class.
- Author
- Sean Leather,
- Bug reports
- n/a
- Category
- Text, Generics
- Copyright
- (c) 2009 Sean Leather
- Homepage
- http://github.com/spl/xformat/tree/master
- Maintainer
- leather@cs.uu.nl
- Package URL
- n/a
- Stability
- experimental