Replies: 1 comment 1 reply
-
declare const defCol: Column
declare const extCol: Option<TTColumn>
const mergeCol = (x: Column) => (y: TTColumn): Column => ({
...x,
field: y.field,
hidden: pipe(y.hidden, O.getOrElse(constant(x.hidden))),
layout: pipe(y.layout, O.getOrElse(constant(x.layout))),
})
const col: Column = pipe(extCol, O.match(constant(defCol), mergeCol(defCol))) Some other, minor notes:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
maljac
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am just starting using fp-ts. So please be kind :)
I am trying to solve the "typical configuration merge" problem that one can find in several tutorials. Starting point is the decoding with a io-ts decoder / type.
The code works fine, but it seems "quite a lot of setup code" to me.
Do I miss something or do I do something wrong here?
More specific questions:
ColumnMonoidStruct
?O.map(...)
)?Beta Was this translation helpful? Give feedback.
All reactions