[Haskell-cafe] How to understand `|` in this code snippet ?

Lee Duhem lee.duhem at gmail.com
Sat Feb 27 04:26:59 EST 2010


On Sat, Feb 27, 2010 at 5:07 PM, zaxis <z_axis at 163.com> wrote:
>
> xxxMain = do
>    timeout <- getEnv "xxx_TIMEOUT"
>    case timeout of
>        Just str | [(t, _)] <- reads str -> do
>            addTimeout t (hPutStrLn stderr "*** TIMEOUT" >> _exit 1)
>            return ()
>        _ -> return ()
> .......
>
> What does the `|` mean in "Just str | [(t, _)] <- reads str" ?
> Is it a logical `or` ?

It's part of a case expression, see
http://www.haskell.org/onlinereport/exps.html#sect3.13

lee


More information about the Haskell-Cafe mailing list