Module

Neon.Class.HasOr

Package
purescript-neon
Repository
tfausak/purescript-neon

#HasOr Source

class HasOr a  where

Represents types that can be disjoined. This is also known as logical disjunction.

true :or false -- true

Some types can't be disjoined per se but it is still useful to be able to use the || operator with them. For example, you can or two arrays together to get their union.

[1, 2, 3] :or [2, 3, 4] -- [1, 2, 3, 4]

For integers, or is bitwise.

5 :or 2 -- 7

The instance for functions is perhaps the hardest to understand. Combining two functions with or returns a new function that calls each function and then ors the results together.

even :or odd -- \ x -> (even x) :or (odd x)
(even :or odd) 3 -- true

Members

  • or :: a -> a -> a

Instances