[Haskell-cafe] Re: Non Empty List? - Apologies

GüŸnther Schmidt gue.schmidt at web.de
Thu Jun 4 20:16:04 EDT 2009

Hi Jake,


Jake McArthur schrieb:
> GüŸnther Schmidt wrote:
>> data Container a = Single a | Many a [a]      
>> but the problem above is that the data structure would allow to 
>> construct a Many 5 [] :: Container Int.
> I think you meant to do either
>     data Container a = Single a | Many a (Container a)

you're right, the above solution is indeed exactly what I need. It took 
me until Tillmans later elaborate reply to realize.

Sometimes I'm unable to see things even when they bite me in the face, ouch!


> or
>     data Container a = Container a [a]
> - Jake

More information about the Haskell-Cafe mailing list