composite-dhall: Dhall instances for composite records.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Warnings:

Dhall instances for composite records.


[Skip to Readme]

Properties

Versions 0.0.1.0, 0.0.2.0, 0.0.3.0, 0.0.4.0, 0.0.4.1, 0.0.6.0, 0.1.0.0, 0.1.0.1, 0.1.0.1
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), composite-base (>=0.7.0.0 && <0.9), dhall (>=1.40 && <1.42), text (>=1.0 && <2.1), vinyl (>=0.13.0 && <0.15) [details]
License MIT
Copyright 2021 Daniel Firth
Author Daniel Firth
Maintainer dan.firth@homotopic.tech
Category Composite, Data, Dhall
Source repo head: git clone https://gitlab.homotopic.tech/haskell/composite-dhall
Uploaded by locallycompact at 2022-09-02T14:10:41Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for composite-dhall-0.1.0.1

[back to package description]

composite-dhall

ToDhall and FromDhall instances for composite records.

You lets you use extensible records over any base functor that is representable in dhall.

You can parse normal records:

{ a = "foo"
, b = +5 }

using a Record like:

withLensesAndProxies
  [d|
    type A = "a" :-> Text

    type B = "b" :-> Int
    |]

type MyRec = Record '[A, B]

This also works for Rec Maybe and Rec [].

{ a = Just "foo"
, b = Just +5 }
type MyMaybeRec = Rec Maybe '[A, B]

Similarly you can use a contravariant functor as the base functor to parse a collection of templates for different types.

{ a = \(x : Text) -> "Hello ${x}."
, b = \(y : Integer) -> "You are ${Integer/show y} years old."
}
newtype TextTemplate a = TextTemplate (Op Text a)
  deriving newtype (FromDhall)

newtype TextTemplates = TextTemplates {unTemplates :: Rec TextTemplate '[A, B]}
  deriving (FromDhall) via (Rec (Op Text) '[A, B])