[Haskell-cafe] It matters how Type Synonyms are defined?

John Meacham john at repetae.net
Fri Feb 2 22:09:43 EST 2007

On Fri, Feb 02, 2007 at 04:18:19PM -0600, Bryan Burgers wrote:
> Now, I was going to ask something like, "How can I define my type
> synonym so I can do this," but I figured out while writing this email
> that if I define ScopeState a different way:
> >type ScopeState = State (Scope VVar)

this is off-topic, but this is a perfect example of where newtype
deriving is great.

> newtype ScopeState a = ScopeState (State (Scope VVar) a)
>        deriving(Monad,Functor,State (Scope VVar))

I just really like this idiom is all. Using it pervasively pays off


John Meacham - ⑆repetae.net⑆john⑈

More information about the Haskell-Cafe mailing list