module Data.Record.Context (
ContextStyle,
app
) where
import Data.Record as Record
infixr 0 `app`
data ContextStyle context style
instance (Style style) => Style (ContextStyle context style) where
type K (ContextStyle context style) = K style
type instance Value (ContextStyle context style) sort = context -> Value style sort
app :: (Style style, Record (K style) record)
=> record (ContextStyle context style)
-> context
-> record style
app contextRecord context = Record.map transformer contextRecord where
transformer = encase (TransformerPiece (\valInContext -> valInContext context))