OneTuple-0.2.2: Singleton Tuple

Safe HaskellSafe
LanguageHaskell98

Data.Tuple.OneTuple

Description

OneTuple fills the tuple gap with a singleton tuple.

OneTuple does not support the usual parenthesized tuple syntax.

OneTuple

  • has the expected laziness properties
  • can be pattern-matched
  • ships with instances for several standard type classes, including all those supported by H98-standard tuples
  • requires no language extensions, except for hierarchical modules

Synopsis

Documentation

data OneTuple a Source #

OneTuple is the singleton tuple data type.

Constructors

OneTuple a

singleton tuple constructor

Instances

Monad OneTuple Source # 

Methods

(>>=) :: OneTuple a -> (a -> OneTuple b) -> OneTuple b #

(>>) :: OneTuple a -> OneTuple b -> OneTuple b #

return :: a -> OneTuple a #

fail :: String -> OneTuple a #

Functor OneTuple Source # 

Methods

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

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

MonadFix OneTuple Source # 

Methods

mfix :: (a -> OneTuple a) -> OneTuple a #

Applicative OneTuple Source # 

Methods

pure :: a -> OneTuple a #

(<*>) :: OneTuple (a -> b) -> OneTuple a -> OneTuple b #

liftA2 :: (a -> b -> c) -> OneTuple a -> OneTuple b -> OneTuple c #

(*>) :: OneTuple a -> OneTuple b -> OneTuple b #

(<*) :: OneTuple a -> OneTuple b -> OneTuple a #

Foldable OneTuple Source # 

Methods

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

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

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

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

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

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

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

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

toList :: OneTuple a -> [a] #

null :: OneTuple a -> Bool #

length :: OneTuple a -> Int #

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

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

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

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

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

Traversable OneTuple Source # 

Methods

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

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

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

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

Bounded a => Bounded (OneTuple a) Source # 
Enum a => Enum (OneTuple a) Source # 
Eq a => Eq (OneTuple a) Source # 

Methods

(==) :: OneTuple a -> OneTuple a -> Bool #

(/=) :: OneTuple a -> OneTuple a -> Bool #

Ord a => Ord (OneTuple a) Source # 

Methods

compare :: OneTuple a -> OneTuple a -> Ordering #

(<) :: OneTuple a -> OneTuple a -> Bool #

(<=) :: OneTuple a -> OneTuple a -> Bool #

(>) :: OneTuple a -> OneTuple a -> Bool #

(>=) :: OneTuple a -> OneTuple a -> Bool #

max :: OneTuple a -> OneTuple a -> OneTuple a #

min :: OneTuple a -> OneTuple a -> OneTuple a #

Read a => Read (OneTuple a) Source # 
Show a => Show (OneTuple a) Source # 

Methods

showsPrec :: Int -> OneTuple a -> ShowS #

show :: OneTuple a -> String #

showList :: [OneTuple a] -> ShowS #

Ix a => Ix (OneTuple a) Source # 
Semigroup a => Semigroup (OneTuple a) Source # 

Methods

(<>) :: OneTuple a -> OneTuple a -> OneTuple a #

sconcat :: NonEmpty (OneTuple a) -> OneTuple a #

stimes :: Integral b => b -> OneTuple a -> OneTuple a #

Monoid a => Monoid (OneTuple a) Source # 

Methods

mempty :: OneTuple a #

mappend :: OneTuple a -> OneTuple a -> OneTuple a #

mconcat :: [OneTuple a] -> OneTuple a #

only Source #

Arguments

:: OneTuple a

takes a singleton tuple argument

-> a

returns the only element in the tuple

The only function extracts the OneTuple's only member. (Compare to fst and snd.)