[Haskell-cafe] APIs
Jérémy Bobbio
jeremy.bobbio at etu.upmc.fr
Tue May 24 19:45:37 EDT 2005
On Wednesday 25 May 2005 01:09, Daniel Fischer wrote:
> Am Mittwoch, 25. Mai 2005 00:46 schrieb Benjamin Franksen:
> > On Wednesday 25 May 2005 00:11, Jan-Willem Maessen wrote:
> > > On May 24, 2005, at 5:28 PM, John Meacham wrote:
> > > > [various ways of capturing options passed to functions
> > > > discussed...]
> > > >
> > > > data ParentsFlag = DontCreateParents | CreateParents
> > > > deriving(Enum)
> > > >
> [more discussion...]
>
> What about a type synonym? I think
>
> type CreateParents = Bool
The thread started about readability at the call site. Using a type
synonym for Bool needs to figure out what this "True" at call site
means instead of understanding it right away.
What about adding to the Daniel's definition:
don'tCreateParents :: CreateParents
don'tCreateParents = False
createParents :: CreateParents
createParents = True
I'm not finding this fancy as the library user is not required to use
them. Using constructors also emphasis which are options and which are
not.
Cheers,
Jérémy.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20050525/f44e05a7/attachment.bin
More information about the Haskell-Cafe
mailing list