ChrisK <[EMAIL PROTECTED]> wrote:

> zeroNothing Nothing = Nothing
> zeroNothing (Just n) =
>   if n == 0 then Nothing else (Just n)
> 
> versus
> 
> zeroNothing Nothing = Nothing
> zeroNothing x@(Just n) =
>   if n == 0 then Nothing else x
> 
versus

zeroNothing Nothing = Nothing
zeroNothing x =
    let (Just n) = x
    in if n == 0 then Nothing else x

so, @ is kind of like a let, just with its arguments flipped.



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to