vinyl-utils-0.0.0.0: Utilities for vinyl

Copyright(c) Marcin Mrotek, 2014
LicenseBSD3
Maintainermarcin.jan.mrotek@gmail.com
Safe HaskellNone
LanguageHaskell2010
Extensions
  • UndecidableInstances
  • MonoLocalBinds
  • ScopedTypeVariables
  • TypeFamilies
  • PolyKinds
  • DataKinds
  • TypeSynonymInstances
  • FlexibleContexts
  • FlexibleInstances
  • MultiParamTypeClasses
  • KindSignatures
  • TypeOperators
  • ExplicitNamespaces
  • ExplicitForAll

Data.Vinyl.Upcast

Description

 

Synopsis

Documentation

class Overwrite xs ys where Source

Overwrite a wider record with a narrower record.

Methods

overwrite :: Rec el f xs -> Rec el f ys -> Rec el f xs Source

Instances

Overwrite k xs ([] k) 
(IElem k y xs, Overwrite k xs ys) => Overwrite k xs ((:) k y ys) 

slice :: (Functor f, Overwrite xs ys, xs <: ys) => (Rec el g ys -> f (Rec el g ys)) -> Rec el g xs -> f (Rec el g xs) Source

A lens from a record to a portion of it.

class (Overwrite ys xs, ys <: xs) => xs :> ys where Source

Upward record casting.

Methods

upcast :: Monoid (AltRec el f ys) => Rec el f xs -> Rec el f ys Source

Instances

(Overwrite k ys xs, (<:) k ys xs) => (:>) k xs ys 

newtype AltRec el f rs Source

Wrapper for Rec with a different Monoid instance. Instead of lifting mappend, it acts on (f (el $ r)) directly, to support temporarily turning records into monoids by changing functors.

Constructors

AltRec 

Fields

getRec :: Rec el f rs
 

Instances

(Monoid (f (($) * k el r)), Monoid (AltRec k el f rs)) => Monoid (AltRec k el f ((:) k r rs)) 
Monoid (AltRec k el f ([] k))