“instance Show State where” doesn't compile
问题 This is the State Monad code I am trying to figure out data State a = State (Int -> (a, Int)) instance Monad State where return x = State (\c -> (x, c)) State m >>= f = State (\c -> case m c of { (a, acount) -> case f a of State b -> b acount}) getState = State (\c -> (c, c)) putState count = State (\_ -> ((), count)) instance Show State where -- doesn't work show (State a) = show a -- doesn't work I am trying to make State as instance of Show so that I can see the action of getState and