vinyl-loeb (empty) → 0.0.1.0
raw patch · 5 files changed
+118/−0 lines, 5 filesdep +basedep +vinyl
Dependencies added: base, vinyl
Files
- ChangeLog.md +5/−0
- LICENSE +30/−0
- README.md +25/−0
- src/Data/Vinyl/Loeb.hs +22/−0
- vinyl-loeb.cabal +36/−0
+ ChangeLog.md view
@@ -0,0 +1,5 @@+# Changelog for vinyl-loeb++## v0.0.1.0++* Add `rloeb`.
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Daniel Firth (c) 2020++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Author name here nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,25 @@+# vinyl-loeb++This package defines a version of loeb's theorem for+[vinyl](https://hackage.haskell.org/package/vinyl).++```{.haskell}+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.++```{.haskell}+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"}+```
+ src/Data/Vinyl/Loeb.hs view
@@ -0,0 +1,22 @@+{-|+Module : Data.Vinyl.Loeb+License : MIT+Maintainer : dan.firth@homotopic.tech+Stability : experimental++Loeb's theorem for vinyl extensible records.+-}+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE TypeOperators #-}+module Data.Vinyl.Loeb (+ rloeb+) where++import Data.Vinyl+import Data.Vinyl.Functor++-- | Version of loeb's theorem for extensible records. Can be+-- used to fill an extensible record lazily using data from+-- the result of the record itself.+rloeb :: RMap xs => Rec ((->) (Rec f xs) :. f) xs -> Rec f xs+rloeb x = go where go = rmap (($ go) . getCompose) x
+ vinyl-loeb.cabal view
@@ -0,0 +1,36 @@+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.34.2.+--+-- see: https://github.com/sol/hpack++name: vinyl-loeb+version: 0.0.1.0+synopsis: Loeb's theorem for extensible records.+category: Vinyl+author: Daniel Firth+maintainer: dan.firth@homotopic.tech+copyright: 2020 Daniel Firth+license: MIT+license-file: LICENSE+build-type: Simple+extra-source-files:+ README.md+ ChangeLog.md++source-repository head+ type: git+ location: https://gitlab.com/homotopic-tech/vinyl-loab++library+ exposed-modules:+ Data.Vinyl.Loeb+ other-modules:+ Paths_vinyl_loeb+ hs-source-dirs:+ src+ ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints+ build-depends:+ base >=4.7 && <5+ , vinyl+ default-language: Haskell2010