On 25/09/2011, at 18:20, Chris Smith wrote:

> class Ord a => Range a where
>    rangeFromTo :: a -> a -> [a] -- subsumes Ix.range / Enum.enumFromTo
>    rangeFromThenTo :: a -> a -> a -> [a]
>    inRange   :: (a, a) -> a -> Bool
> -- Does have instances for Float/Double.  List ranges desugar to this.
> -- Also has instances for tuples
> 
> class Range a => InfiniteRange a where -- [1]
>    rangeFrom :: a -> [a]
>    rangeFromThen :: a -> a -> [a]
> -- Has instances for Float/Double
> -- No instances for tuples

I realise I'm slightly late to the discussion but IMO, the rangeFrom* (or 
enumFrom*) functions shouldn't be methods. Rather, a redesign of Enum should 
ensure that they can be defined generically for all types. The rationale is 
that other data structures (like arrays) want to provide similar functions 
without having to go through lists.

Roman



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to