[Haskell-cafe] Re: bounded ranges

Chad Scherrer chad.scherrer at gmail.com
Thu Jul 22 18:43:22 EDT 2010


> On Thu, 22 Jul 2010, Chad Scherrer wrote:
> > I thought it might help to put it into a module and do a better job
> > with the type, like this:
> >
> > bdRangeSize :: (Ix i, Bounded i) => i -> Int
> > bdRangeSize _ = rangeSize (minBound, maxBound :: i)
> 

Henning Thielemann <lemming <at> henning-thielemann.de> writes:
> bdRangeSize x = rangeSize (minBound, maxBound `asTypeOf` x)

Perfect, thank you!

Chad



More information about the Haskell-Cafe mailing list