简体   繁体   中英

Haskell “(.|.)” syntax

What does this syntax mean? (in the context of module declaration)

Example:

module XMonad (
    module XMonad.Main,
    module XMonad.Core,
    module XMonad.Config,
    module XMonad.Layout,
    module XMonad.ManageHook,
    module XMonad.Operations,
    module Graphics.X11,
    module Graphics.X11.Xlib.Extras,
    (.|.),
    MonadState(..), gets, modify,
    MonadReader(..), asks,
    MonadIO(..)
) where

Can't find anything using search engines.

It means "Bitwise or". It is an operator that the XMonad package re-exports. It is originally defined in Data.Bits .

https://hackage.haskell.org/package/xmonad-0.13/docs/XMonad.html#v:.-124- .

(.|.) :: Bits a => a -> a -> a #

    Bitwise "or"

In Haskell, anything defined between ( ... ) is an operator, which is a function that works by default as infix notation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM