Skip to content

Instantly share code, notes, and snippets.

@dariooddenino
Created September 13, 2018 09:59
Show Gist options
  • Save dariooddenino/f14241948c96175f93b75d6ae2745b72 to your computer and use it in GitHub Desktop.
Save dariooddenino/f14241948c96175f93b75d6ae2745b72 to your computer and use it in GitHub Desktop.
data PrefixProps sym = PrefixProps (SProxy sym)
instance prefixProps ::
( IsSymbol newsym
, Append presym sym newsym
, Row.Lacks newsym rb
, Row.Cons newsym a rb rc
) =>
FoldingWithIndex
(PrefixProps presym)
(SProxy sym)
(Builder { | ra } { | rb })
a
(Builder { | ra } { | rc })
where
foldingWithIndex (PrefixProps _) _ rin a =
(_ >>> Builder.insert (SProxy :: SProxy newsym) a) rin
prefixRecord ::
forall rin rout pre.
HFoldlWithIndex (PrefixProps pre) (Builder {} {}) { | rin } (Builder {} { | rout }) =>
SProxy pre ->
{ | rin } ->
{ | rout }
prefixRecord pre = flip Builder.build {} <<< hfoldlWithIndex (PrefixProps pre) identity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment