<div dir="ltr"><div><div><div><div><div>This will look like the original definitions [1]<br><br></div>> newtype State s a = State { runState :: s -> (a, s) }<br><br></div><div>before they became type synonyms<br><br></div><div>> type State s = StateT s Identity<br></div><div><br></div>by defining pattern synonyms<br><br></div>> pattern State :: (s -> (a, s)) -> State s a<br></div>> pattern State {runState} <- S.runState -> runState<br></div>>   where State a           = state a<br><br><div><div><div><div><div>Trac ticket #12767 for further information. [2]<br><br><div><div>[1] <a href="http://book.realworldhaskell.org/read/monads.html#id643643">http://book.realworldhaskell.org/read/monads.html#id643643</a><br>[2] <a href="https://ghc.haskell.org/trac/ghc/ticket/12767">https://ghc.haskell.org/trac/ghc/ticket/12767</a><br></div></div></div></div></div></div></div></div>