How can I make a counter without Monad?

Tony Finch dot at dotat.at
Fri Mar 18 09:27:31 EST 2005


On Wed, 16 Mar 2005, Peter Davis wrote:
> On 2005-03-16 02:52:39 -0800, Nicolas Oury <Nicolas.Oury at lri.fr> said:
>
> > instance Splittable Integer where
> >    split n = (2*n,2*n+1)
>
> I haven't played much with the Splittable class yet, but what would be wrong
> with
>
> instance Splittable Integer where
>   split n = (n,n+1)

If you recursively split the left-hand result then that overlaps with the
right-hand result.

Tony.
-- 
f.a.n.finch  <dot at dotat.at>  http://dotat.at/
HUMBER THAMES DOVER: WEST OR SOUTHWEST 4 OR 5, OCCASIONALLY 6 IN HUMBER,
BECOMING VARIABLE 3. OCCASIONAL RAIN OR DRIZZLE. MODERATE OR POOR WITH FOG
BANKS.


More information about the Glasgow-haskell-users mailing list