r/functionalprogramming • u/ibrahimbensalah • Feb 28 '23
Question Is JSX a hidden monad bind?
Say we have this example
function Component() {
return <Layout><Page /></Layout>
}
And lets assume this is compiled to
where type of jsx is (fn, JSX.Element) => JSX.Element. For simplicity ignore that we can have multiple elements in the second argument.
jsx is not in the form of monadic bind (JSX.Element, (fn) => JSX.Element) => JSX.Element. If we ignore the laws, can we say jsx is a special case of the monadic bind function nevertheless?
15
Upvotes
View all comments
Show parent comment
2
u/ibrahimbensalah Feb 28 '23
Thank you for confirmtion, I based my conclusion solely on intuition, first I though JSX is only a concat operation like array concat, but I am starting to think it could be more.