[Haskell-cafe] Why isn't pattern matching lazy by default?
Dan Doel
dan.doel at gmail.com
Wed Sep 19 15:54:57 EDT 2007
On Wednesday 19 September 2007, C.M.Brown wrote:
> g is strict in its first argument. Declared in a let it would look like:
>
> f x = let g x = case x of
> (Just y) -> y
> Nothing -> error "Nothing" in g x
>
> Again, g must be strict in its first argument.
Actually,
f x = let g (Just x) = x
g Nothing = error "Nothing" in g x
is a valid definition. A let expression can have multiple definitions just
like a where clause.
-- Dan
More information about the Haskell-Cafe
mailing list