interval-patterns-0.8.0: Intervals, and monoids thereof
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.OneOrTwo

Synopsis

Documentation

data OneOrTwo x Source #

Either one of something, or two of it.

Use oneOrTwo to deconstruct.

Constructors

One !x 
Two !x !x 

Instances

Instances details
Foldable OneOrTwo Source # 
Instance details

Defined in Data.OneOrTwo

Methods

fold :: Monoid m => OneOrTwo m -> m #

foldMap :: Monoid m => (a -> m) -> OneOrTwo a -> m #

foldMap' :: Monoid m => (a -> m) -> OneOrTwo a -> m #

foldr :: (a -> b -> b) -> b -> OneOrTwo a -> b #

foldr' :: (a -> b -> b) -> b -> OneOrTwo a -> b #

foldl :: (b -> a -> b) -> b -> OneOrTwo a -> b #

foldl' :: (b -> a -> b) -> b -> OneOrTwo a -> b #

foldr1 :: (a -> a -> a) -> OneOrTwo a -> a #

foldl1 :: (a -> a -> a) -> OneOrTwo a -> a #

toList :: OneOrTwo a -> [a] #

null :: OneOrTwo a -> Bool #

length :: OneOrTwo a -> Int #

elem :: Eq a => a -> OneOrTwo a -> Bool #

maximum :: Ord a => OneOrTwo a -> a #

minimum :: Ord a => OneOrTwo a -> a #

sum :: Num a => OneOrTwo a -> a #

product :: Num a => OneOrTwo a -> a #

Traversable OneOrTwo Source # 
Instance details

Defined in Data.OneOrTwo

Methods

traverse :: Applicative f => (a -> f b) -> OneOrTwo a -> f (OneOrTwo b) #

sequenceA :: Applicative f => OneOrTwo (f a) -> f (OneOrTwo a) #

mapM :: Monad m => (a -> m b) -> OneOrTwo a -> m (OneOrTwo b) #

sequence :: Monad m => OneOrTwo (m a) -> m (OneOrTwo a) #

Functor OneOrTwo Source # 
Instance details

Defined in Data.OneOrTwo

Methods

fmap :: (a -> b) -> OneOrTwo a -> OneOrTwo b #

(<$) :: a -> OneOrTwo b -> OneOrTwo a #

Data x => Data (OneOrTwo x) Source # 
Instance details

Defined in Data.OneOrTwo

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OneOrTwo x -> c (OneOrTwo x) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (OneOrTwo x) #

toConstr :: OneOrTwo x -> Constr #

dataTypeOf :: OneOrTwo x -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (OneOrTwo x)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OneOrTwo x)) #

gmapT :: (forall b. Data b => b -> b) -> OneOrTwo x -> OneOrTwo x #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OneOrTwo x -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OneOrTwo x -> r #

gmapQ :: (forall d. Data d => d -> u) -> OneOrTwo x -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> OneOrTwo x -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> OneOrTwo x -> m (OneOrTwo x) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OneOrTwo x -> m (OneOrTwo x) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OneOrTwo x -> m (OneOrTwo x) #

Generic (OneOrTwo x) Source # 
Instance details

Defined in Data.OneOrTwo

Associated Types

type Rep (OneOrTwo x) :: Type -> Type #

Methods

from :: OneOrTwo x -> Rep (OneOrTwo x) x0 #

to :: Rep (OneOrTwo x) x0 -> OneOrTwo x #

Read x => Read (OneOrTwo x) Source # 
Instance details

Defined in Data.OneOrTwo

Show x => Show (OneOrTwo x) Source # 
Instance details

Defined in Data.OneOrTwo

Methods

showsPrec :: Int -> OneOrTwo x -> ShowS #

show :: OneOrTwo x -> String #

showList :: [OneOrTwo x] -> ShowS #

Eq x => Eq (OneOrTwo x) Source # 
Instance details

Defined in Data.OneOrTwo

Methods

(==) :: OneOrTwo x -> OneOrTwo x -> Bool #

(/=) :: OneOrTwo x -> OneOrTwo x -> Bool #

Ord x => Ord (OneOrTwo x) Source # 
Instance details

Defined in Data.OneOrTwo

Methods

compare :: OneOrTwo x -> OneOrTwo x -> Ordering #

(<) :: OneOrTwo x -> OneOrTwo x -> Bool #

(<=) :: OneOrTwo x -> OneOrTwo x -> Bool #

(>) :: OneOrTwo x -> OneOrTwo x -> Bool #

(>=) :: OneOrTwo x -> OneOrTwo x -> Bool #

max :: OneOrTwo x -> OneOrTwo x -> OneOrTwo x #

min :: OneOrTwo x -> OneOrTwo x -> OneOrTwo x #

type Rep (OneOrTwo x) Source # 
Instance details

Defined in Data.OneOrTwo

type Rep (OneOrTwo x) = D1 ('MetaData "OneOrTwo" "Data.OneOrTwo" "interval-patterns-0.8.0-BzcshY5RLEW8SWgNfdCVP3" 'False) (C1 ('MetaCons "One" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 x)) :+: C1 ('MetaCons "Two" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 x) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 x)))

oneOrTwo :: (x -> a) -> (x -> x -> a) -> OneOrTwo x -> a Source #

Apply a oneOrTwo argument function appropriately.