Package

purescript-substitute

Repository
ursi/purescript-substitute
License
BSD-3-Clause
Uploaded by
ursi
Published on
2021-05-15T23:19:41Z

Pursuit

Substitute is an advanced string interpolation library that allows you to customize the behaviour of your interpolation function. It includes features such as removing whitespace from multi-line strings so they can be indented like the rest of your code, and preserving indentation levels when inserting multi-line strings. Here is an example showing both of these features.

-- str1 = str2

str1 =
  substitute
    """
    ${name} :: Int -> Int -> ${type}
    ${name} a b =
      let
        ${lets}
      in
        c - d
    """
    { name: "myFunction"
    , "type": "Int"
    , lets:
        """
        c = a + b

        d = a * b
        """
    }

str2 =
  """myFunction :: Int -> Int -> Int
myFunction a b =
  let
    c = a + b

    d = a * b
  in
    c - d
"""
Modules
Substitute
Dependencies