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 little
experiment to see what happens when the irrefutable definition is removed by
calling it with:
a = List [1, 2]
b = lift1 (+ 1) a
Now without it I get an error for a "non-exhaustive pattern". With it, I get
an "irrefutable pattern failed".
Can some one explain to me the advantages and disadvantages of using
irrefutable matching, including how irrefutable matching is used in general?
Why and when it is used, etc.
Thanks,
Mike