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".
[snip]
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
Mike Jones writes:
I am looking at the Hawk Signal module, where the following definition
occurs:
lift1 f (List xs) = List $ lazyMap f xs
where
lazyMap f ~(x:xs) = f x : lazyMap f xs
Now setting aside how the function is used in Hawk, I ran a little
experiment to
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
Hi,
I have a rather naive question, being new to Haskell.
I am looking at the Hawk Signal module, where the following definition
occurs:
lift1 f (List xs) = List $ lazyMap f xs
where
lazyMap f ~(x:xs) = f x : lazyMap f xs
Now setting aside how the function is used in Hawk, I ran a