Jonathan Cast wrote:
On Wednesday 11 July 2007, Chaddaï Fouché wrote:
Is there something I misunderstood in the exchange ?
Yeah. The reference to the "lazy natural type", which is:
data Nat
= Zero
| Succ Nat
deriving (Eq, Ord, Read, Show)
instance Num Nat where
fromInteger 0 = Zero
fromInteger (n + 1) = Succ (fromInteger n)
etc.
then genericLength xn > n does exactly what Andrew wants, when n :: Nat.
Wow.
Show me a simple problem, and some Haskeller somewhere will find a
completely unexpected way to solve it... LOL!
OTOH, doesn't that just mean that Nat is itself a degenerate list, and
genericList is just converting one list to another, and the Ord instance
for Nat is doing the short-cut stuff?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe