
25 Feb
2021
25 Feb
'21
9:08 p.m.
Hi cafe, I'm playing with alex recently and noticed that: newtype Alex a = Alex {unAlex :: AlexState -> Either String (AlexState, a)} which is almost StateT AlexState (Except String), and looks like I can make a MonadError instance out of it. Therefore I'm curious if there's any existing package that has newtype StateT' s m a = StateT' (s -> m (s, a)) -- note the swapped pair here so that I can just deriving (MonadError String) via StateT' AlexState (Except String) to implement MonadError. Thanks! -- Javran (Fang) Cheng