[Haskell] do notation and type synonym

Wolfgang Jeltsch wolfgang at jeltsch.net
Mon Aug 8 10:31:44 EDT 2005


Am Montag, 8. August 2005 11:30 schrieb Bulat Ziganshin:
> [...]

> constructor gives you type-safety! without constructor there is no
> difference between Point and (Float, Float), only constructor give you
> syntax difference between these two types!
>
> newtype Point = Point (Float, Float)
> unPoint (Point p) = p

Or, more simply:

	newtype Point = Point {unPoint :: (Float,Float) }

Best regards,
Wolfgang


More information about the Haskell mailing list