Skip to content

GHC.Utils.Monad.State.{Strict,Lazy} derive (non-one-shot) Functor

I was surprised to see that we seem to manually define Applicative and Monad instances, but not the Functor instance for State:

newtype State s a = State' { runState' :: s -> (# a, s #) }
    deriving (Functor)

The derived instance will not make use of the one-shot State synonym. Maybe it doesn't matter match, because (>>=) is the most commonly used combinator by far, still it seems strange not to define it manually.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information