[Haskell-beginners] Can fields in a record be optional?

David Place d at vidplace.com
Mon Jul 18 22:47:14 CEST 2011


Thanks for the pointer to Data.Default.  I don't see how it applies in this case, though.  The goal is to avoid mentioning the defaulted fields when constructing a record instance.  Example?

____________________
David Place   
Owner, Panpipes Ho! LLC
http://panpipesho.com
d at vidplace.com



On Jul 18, 2011, at 1:45 AM, Christopher Done wrote:

> On 18 July 2011 00:18, David Place <d at vidplace.com> wrote:
>> The way I often do this is to create an "ur" instance where all the fields have default values.  Then to create an instance, I just do a "record update" of this instance.
> 
> For this there is Data.Default in data-default:
> 
> http://hackage.haskell.org/packages/archive/data-default/0.2.0.1/doc/html/Data-Default.html




More information about the Beginners mailing list