I am using the react-basic-hooks library and am trying to conditionally return a Render
monad (which uses the IxMonad typeclass). However I can’t figure out how to do this because the different cases have different state shapes.
What I have so far is this:
forall a hooks h . QueryState a -> (a -> React.Render Unit hooks JSX) -> React.Render Unit h JSX
handleState (Loading) fn = pure $ <SOME JSX>
handleState (Error e) fn = pure $ <SOME JSX>
handleState (Data d) fn = fn d
However that type signature is incorrect and so far I can’t find a way to write a function that is pure or some arbitrary render. Any ideas of how to go about this?