[ new ] constructor plus trivial impl for Interpolation (#2871)

* [ new ] constructor plus trivial impl for Interpolation

* [ doc ] update CHANGELOG

* [ test ] adjust expected test output
This commit is contained in:
Stefan Höck 2023-02-04 14:47:28 +01:00 committed by GitHub
parent ad12f8335c
commit f6a731695d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -63,6 +63,8 @@
* Improved performance of functions `isNL`, `isSpace`, and `isHexDigit`.
* Implements `Foldable` and `Traversable` for pairs, right-biased as `Functor`.
* Added a constructor (`MkInterpolation`) to `Interpolation`.
* Added an `Interpolation` implementation for `Void`.
#### Base

View File

@ -1,5 +1,7 @@
module Prelude.Interpolation
import Builtin
||| Interpolated strings are of the form `"xxxx \{ expr } yyyy"`.
||| In this example the string `"xxxx "` is concatenated with `expr` and
||| `" yyyy"`, since `expr` is not necessarily a string, the generated
@ -11,9 +13,14 @@ module Prelude.Interpolation
||| an instance of `Interpolation` for a type.
public export
interface Interpolation a where
constructor MkInterpolation
interpolate : a -> String
||| The interpolation instance for Strings is the identity
export
Interpolation String where
interpolate x = x
export
Interpolation Void where
interpolate _ impossible

View File

@ -12,6 +12,6 @@ LOG declare.record.parameters:50: Decided to bind the following extra parameters
LOG declare.record.parameters:60: We elaborated Main.EtaProof in a non-empty local context.
Dropped: [b, a]
Remaining type: (p : ($resolved2700 a[1] b[0])) -> Type
Remaining type: (p : ($resolved2702 a[1] b[0])) -> Type
LOG declare.record.parameters:30: Unelaborated type: (%pi RigW Explicit Nothing Main.Product %type)