[Haskell-cafe] Re: Type Synonyms

Tom Davies tgdavies at gmail.com
Thu Oct 11 00:26:41 EDT 2007


Andrew Wagner <wagner.andrew <at> gmail.com> writes:

> 
> If you change your type declarations to 'newtype' declarations, I
> believe you would get the effect that you want, depending on what you
> mean by 'equivalent'. In that case, Foo and Bar would essentially be
> strings, but you could not use either of them in a place where the
> other is expected, nor where a String is expected. See
> http://haskell.org/haskellwiki/Newtype for more information. Hope this
> helps!

I wanted to avoid wrapping the string with a constructor.

I suppose what I'm really asking for is for each type to implicitly define a 
'type class with no methods', and to be able to create new instances of
 that type class which simply behave as the underlying
type.



More information about the Haskell-Cafe mailing list