I’m pretty new to functional languages, and I’m taking the time to learn PureScript. And what better way to learn a completely new language and paradigm than starting a new project you’re not even sure you can handle on a technology you’re comfortable with, right?
Anyways, I have some code where I need to pass along some state information, but some of my functions are “purer”, while a couple of them are very effectful. So I share the state information between them using both
StateT Effect. However, I can’t mix them or else I’ll obviously get a type mismatch error.
I tried looking up online and the Haskell community called it a “hoist” operation and suggested this:
state . runState
But I couldn’t find a “state” function in PureScript to make a new StateT.
So I ask:
- Does needing to do this indicate a problem in my design?
- If not, what’s the better way to “hoist” (whatever that is ) from State to StateT in PureScript?