vinyl-loeb: Loeb's theorem for extensible records.

[ library, mit, vinyl ] [ Propose Tags ]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.1.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), vinyl [details]
License MIT
Copyright 2020 Daniel Firth
Author Daniel Firth
Maintainer dan.firth@homotopic.tech
Category Vinyl
Source repo head: git clone https://gitlab.com/homotopic-tech/vinyl-loab
Uploaded by locallycompact at 2020-12-07T02:24:01Z
Distributions LTSHaskell:0.0.1.0, NixOS:0.0.1.0, Stackage:0.0.1.0
Downloads 372 total (10 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-12-07 [all 1 reports]

Readme for vinyl-loeb-0.0.1.0

[back to package description]

vinyl-loeb

This package defines a version of loeb's theorem for vinyl.

rloeb :: RMap xs => Rec ((->) (Rec f xs) :. f) xs  -> Rec f xs
rloeb x = go where go = rmap (($ go) . getCompose) x

This can be used to fill up an extensible record lazily using data from the result of the record itself.

type F = [Text, Text]

k :: Rec Thunk F -> Text
k (Thunk f :& _) = f <> "bar"

f :: Rec ((->) (Rec Thunk F) :. Thunk) F
f = (Compose $ const $ Thunk $ "foo") :& Compose (Thunk . k) :& RNil

-- > rloeb f
-- {"foo", "foobar"}