Haskell platform proposal: split package

Brent Yorgey byorgey at seas.upenn.edu
Mon Jul 23 13:55:58 CEST 2012


On Mon, Jul 23, 2012 at 11:11:19AM +0200, Christian Maeder wrote:
> Am 21.07.2012 14:30, schrieb Twan van Laarhoven:
> >Would the following type work?
> >
> >     data Delimiter a
> >         = DelimEltPred (a -> Bool)
> >         | DelimSublistPred [a -> Bool]
> >
> >You can go from the current DelimSublist to DelimSublistPred with just
> >`map (==)`. And is the distinction between the DelimEltPred and
> >DelimSublistPred then still needed at all?
> 
> Does it not make sense then, to reuse the DelimSublistPred variant
> with a singleton list for the DelimEltPred case? (I suppose empty
> lists must be excluded anyway).
> 
>    newtype Delimiter a = Delimiter [a -> Bool]

Yes, in fact, Twan sent another message with some code using this
exact definition of Delimiter, and I have already made this change to
the library.

-Brent



More information about the Libraries mailing list