On Thu, 20 Apr 2000, Koen Claessen wrote:
> Mike Jones wrote:
>
> | lift1 f (List xs) = List $ lazyMap f xs
> | where
> | lazyMap f ~(x:xs) = f x : lazyMap f xs
> :
> | a = List [1, 2]
> | b = lift1 (+ 1) a
> :
> | "non-exhaustive pattern".
> | "irrefutable pattern failed".
>
Let me explore this a bit:
lazyMap ~(x:xs) = f x : lazyMap f xs
Now you tell the compiler that the list you are constructing
is infinite. Moreover, you can inspect the *result* of the
function before it ever evaluates its argument!
What exactly do you mean by inspect the result before the eva
Mike Jones wrote:
| lift1 f (List xs) = List $ lazyMap f xs
| where
| lazyMap f ~(x:xs) = f x : lazyMap f xs
:
| a = List [1, 2]
| b = lift1 (+ 1) a
:
| "non-exhaustive pattern".
| "irrefutable pattern failed".
Hi Mike, let me tell you how irrefutable patterns work in
Haskell