/purescript-fmt

Format strings, safely.

Primary LanguagePureScript

purescript-fmt

Format strings, safely.

fmt

Installation

spago install fmt

Sample

module Demo where

import Fmt (fmt)

greeting :: String
greeting =
  fmt
    @"""
      Hello, my name is {name}.
      I live in {city}.
      I am {age} years old.
    """
    { name: "Tom"
    , city: "London"
    , age: 42
    }

You can check out more examples here.

There's also a guide about runtime perfomance.

Features

  • Compile-time format string validation
  • Easily extensible with custom formatter type class
  • Configurable placeholder syntax
  • Zero runtime overhead if used with purs-backend-es