[Haskell-cafe] Re: Non Empty List?

GüŸnther Schmidt gue.schmidt at web.de
Thu Jun 4 19:54:06 EDT 2009

Dan Weston schrieb:
> Unless I'm missing something in your description, why not
>   data Container a = Single a | Many a a [a]

Hi Dan,

the above solution would still allow to construct, for instance,

Many 5 42 [] :: Container Int

The reason why I'm trying to find the design for a data structure in 
which this would not even be possible is to be able to avoid writing 
additional "bookkeeping" code into the functions that operate on the 
structure, ie. the lookups, inserts, delete etc.


More information about the Haskell-Cafe mailing list