Frames-0.1.4: Data frames For working with tabular data files

Safe HaskellNone
LanguageHaskell2010

Frames.RecF

Synopsis

Documentation

rappend :: Rec k f as -> Rec k f bs -> Rec k f ((++) k as bs)

Two records may be pasted together.

rtraverse :: Applicative h => (forall x. f x -> h (g x)) -> Rec k f rs -> h (Rec k g rs)

A record may be traversed with respect to its interpretation functor. This can be used to yank (some or all) effects from the fields of the record to the outside of the record.

rdel :: CanDelete r rs => proxy r -> Rec f rs -> Rec f (RDelete r rs) Source

Delete a field from a record

type CanDelete r rs = (RElem r rs (RIndex r rs), RDelete r rs rs) Source

A constraint that a field can be deleted from a record.

frameCons :: Functor f => f a -> Rec f rs -> Rec f ((s :-> a) : rs) Source

Add a column to the head of a row.

frameConsA :: Applicative f => a -> Rec f rs -> Rec f ((s :-> a) : rs) Source

Add a pure column to the head of a row.

frameSnoc :: Rec f rs -> f r -> Rec f (rs ++ `[r]`) Source

Add a column to the tail of a row. Note that the supplied value should be a Col to work with the Frames tooling.

pattern (:&) :: () => Functor f => f r -> Rec * f rs -> Rec * f ((:) * ((:->) s r) rs) Source

pattern Nil :: (~) [*] t ([] *) => Rec * t t Source

type AllCols c ts = LAll c (UnColumn ts) Source

Enforce a constraint on the payload type of each column.

type family UnColumn ts Source

Strip the column information from each element of a list of types.

Equations

UnColumn `[]` = `[]` 
UnColumn ((s :-> t) : ts) = t : UnColumn ts 

class AsVinyl ts where Source

Remove the column name phantom types from a record, leaving you with an unadorned Vinyl Rec.

Methods

toVinyl :: Functor f => Rec f ts -> Rec f (UnColumn ts) Source

fromVinyl :: Functor f => Rec f (UnColumn ts) -> Rec f ts Source

Instances

AsVinyl ([] *) Source 
AsVinyl ts => AsVinyl ((:) * ((:->) s t) ts) Source 

mapMono :: (AllAre a (UnColumn ts), Functor f, AsVinyl ts) => (a -> a) -> Rec f ts -> Rec f ts Source

Map a function across a homogeneous, monomorphic Rec.

mapMethod :: forall f c ts. (Functor f, LAll c (UnColumn ts), AsVinyl ts) => Proxy c -> (forall a. c a => a -> a) -> Rec f ts -> Rec f ts Source

Map a typeclass method across a Rec each of whose fields has an instance of the typeclass.

class Functor f => ShowRec f rs Source

The ability to pretty print a Rec's fields.

Minimal complete definition

showRec'

Instances

Functor f => ShowRec f ([] *) Source 
(KnownSymbol s, Show (f (Col' s a)), ShowRec f rs) => ShowRec f ((:) * ((:->) s a) rs) Source 

showRec :: ShowRec f rs => Rec f rs -> String Source

Pretty printing of Rec values.

type family ColFun f x Source

A type function to convert a Record to a Rec. ColFun f (Rec rs) = Rec f rs.

Equations

ColFun f (Rec Identity rs) = Rec f rs 

class ColumnHeaders cs where Source

Methods

columnHeaders :: proxy (Rec f cs) -> [String] Source

Return the column names for a record.

Instances

reifyDict :: forall c f proxy ts. (LAll c ts, RecApplicative ts) => proxy c -> (forall a. c a => f a) -> Rec f ts Source

Build a record whose elements are derived solely from a constraint satisfied by each.