tomjaguarpaw / tilapia

Improving all Haskell's programmer interfaces

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better names for evalState and execState

tomjaguarpaw opened this issue · comments

Yep, I can never tell which one does what.

How about getFinalState and getReturnValue?

By the way, State is a tuple, and a tuple is a non-empty container, and a non-empty container is a comonad. Therefore, should getReturnValue be called extract: State state value → value?

To start with, let's remember this mnemonic device: "evalState is invaluable" because it can be used to replicate execState (but not vice versa).

This is how I have been remembering them:

  • runState is the one from the record (inferrable from prefix run-)
  • evalSatte yields a value – just like regular evaluation
  • execState is the other one