[Haskell] do notation and type synonym

Wolfgang Jeltsch wolfgang at jeltsch.net
Sun Aug 7 16:25:24 EDT 2005

Am Sonntag, 7. August 2005 20:40 schrieb Lemmih:
> [...]

> > second one:
> > is it possible to write something like
> > type Point = (Float, Float)
> > type Vector = (Float, Float)
> > and still have type safety (i.e. not be able to mix Point and Vector)
> > (and still have (*,*) without constructor)?
> No, that's not possible.

Note that while newtype declared types use some kind of data constructor, 
internally the newtype declared type is normally represented the same way as 
the "encapsulated" type.  So newtype normally doesn't introduce any overhead 
concerning execution time and space but, of course, it introduces overhead 
concerning typing. :-)

Best regards,

More information about the Haskell mailing list