data vs. newtype, abstractly

Tom Pledger Tom.Pledger@peace.com
Mon, 10 Mar 2003 12:59:28 +1300


Dean Herington writes:
 :
 | My question came up in the context of describing such an abstract type for
 | users of the type.  Like many others, I like to include actual Haskell
 | code where appropriate in the documentation.  It didn't seem right to
 | commit there to either `data` or `newtype`.  Perhaps I'll use:
 | 
 |     type Foo a  -- abstract
 | 
 | Does that disturb anyone?  Any other ideas?

That's pretty close to Haddock's approach.

For example, see newtype N4 in http://www.haskell.org/haddock/Test.hs :

    "An abstract newtype - we show this one as data rather than
     newtype because the difference isn't visible to the programmer
     for an abstract type."