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

[ library, mit, vinyl ] [ Propose Tags ]


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS]
Change log
Dependencies base (>=4.7 && <5), vinyl [details]
License MIT
Copyright 2020 Daniel Firth
Author Daniel Firth
Category Vinyl
Source repo head: git clone
Uploaded by locallycompact at 2020-12-07T02:24:01Z
Distributions LTSHaskell:, NixOS:, Stackage:
Downloads 371 total (11 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-

[back to package description]


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"}