All Projects → kcsongor → purescript-record-format

kcsongor / purescript-record-format

Licence: BSD-3-Clause license
Experimental record formatting from type-level format strings

Programming Languages

purescript
368 projects
Nix
1067 projects

purescript-record-format

Record formatting from type-level format strings, based on Justin Woo's idea.

This library uses the 0.12 version of the compiler.

Example

format
  (SProxy :: SProxy "Hi {name}! Your favourite number is {number}")
  {name : "Bill", number : 16}

produces the string

"Hi Bill! Your favourite number is 16"

A missing field results in a type-error:

format
  (SProxy "Hi {name}! Your favourite number is {number}")
  {name : "Bill"}
  Could not match type

    ( number :: t2
    | t3
    )

  with type

    ( name :: String
    )

The only requirement is that all the types in the record have Show instances.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].