[Haskell-cafe] Re: Non Empty List?
Tony Morris
tonymorris at gmail.com
Thu Jun 4 19:57:26 EDT 2009
I note that you didn't address the suggestion of a zipper.
Günther Schmidt wrote:
> 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.
>
> Günther
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
--
Tony Morris
http://tmorris.net/
More information about the Haskell-Cafe
mailing list