OneTuple-0.2.1: 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 #

OneTuple is the singleton tuple data type.

Constructors

OneTuple a

singleton tuple constructor

Instances

Monad OneTuple # 

Methods

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

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

return :: a -> OneTuple a #

fail :: String -> OneTuple a #

Functor OneTuple # 

Methods

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

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

MonadFix OneTuple # 

Methods

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

Applicative OneTuple # 

Methods

pure :: a -> OneTuple a #

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

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

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

Foldable OneTuple # 

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 # 

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) # 
Enum a => Enum (OneTuple a) # 
Eq a => Eq (OneTuple a) # 

Methods

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

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

Ord a => Ord (OneTuple a) # 

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) # 
Show a => Show (OneTuple a) # 

Methods

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

show :: OneTuple a -> String #

showList :: [OneTuple a] -> ShowS #

Ix a => Ix (OneTuple a) # 
Monoid a => Monoid (OneTuple a) # 

Methods

mempty :: OneTuple a #

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

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

only #

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.)