Only-0.1: The 1-tuple type or single-value "collection"

Safe Haskell | Safe
Language | Haskell2010

Data.Tuple.Only

Synopsis

- newtype Only a = Only {
  - fromOnly :: a
  }

# Documentation

newtype Only a Source #

The 1-tuple type or single-value "collection".

This type is structurally equivalent to the `Identity` type, but its intent is more about serving as the anonymous 1-tuple type missing from Haskell for attaching typeclass instances.

Parameter usage example:

    encodeSomething (Only (42::Int))

Result usage example:

    xs <- decodeSomething
    forM_ xs $ \(Only id) -> {- ... -}

Constructors

Only |

Fields

- fromOnly :: a

#### Instances

Instances details

Functor Only Source # |
Instance details Defined in Data.Tuple.Only Methods fmap :: (a -> b) -> Only a -> Only b (<$) :: a -> Only b -> Only a
Eq a => Eq (Only a) Source # |
Instance details Defined in Data.Tuple.Only Methods (==) :: Only a -> Only a -> Bool (/=) :: Only a -> Only a -> Bool
Data a => Data (Only a) Source # |

Instance details

Defined in Data.Tuple.Only

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Only a -> c (Only a)

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Only a)

toConstr :: Only a -> Constr

dataTypeOf :: Only a -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Only a))

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Only a))

gmapT :: (forall b. Data b => b -> b) -> Only a -> Only a

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Only a -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Only a -> r

gmapQ :: (forall d. Data d => d -> u) -> Only a -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> Only a -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Only a -> m (Only a)

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Only a -> m (Only a)

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Only a -> m (Only a)

Ord a => Ord (Only a) Source # |
Instance details Defined in Data.Tuple.Only Methods compare :: Only a -> Only a -> Ordering (<) :: Only a -> Only a -> Bool (<=) :: Only a -> Only a -> Bool (>) :: Only a -> Only a -> Bool (>=) :: Only a -> Only a -> Bool max :: Only a -> Only a -> Only a min :: Only a -> Only a -> Only a
Read a => Read (Only a) Source # |
Instance details Defined in Data.Tuple.Only Methods readsPrec :: Int -> ReadS (Only a) readList :: ReadS [Only a] readPrec :: ReadPrec (Only a) readListPrec :: ReadPrec [Only a]
Show a => Show (Only a) Source # |
Instance details Defined in Data.Tuple.Only Methods showsPrec :: Int -> Only a -> ShowS show :: Only a -> String showList :: [Only a] -> ShowS
Generic (Only a) Source # |
Instance details Defined in Data.Tuple.Only Associated Types type Rep (Only a) :: Type -> Type Methods from :: Only a -> Rep (Only a) x to :: Rep (Only a) x -> Only a
NFData a => NFData (Only a) Source # |
Instance details Defined in Data.Tuple.Only Methods rnf :: Only a -> ()
type Rep (Only a) Source # |
Instance details Defined in Data.Tuple.Only type Rep (Only a) = D1 ('MetaData "Only" "Data.Tuple.Only" "Only-0.1-IJIAET7WRoQFFeBfrGSvp2" 'True) (C1 ('MetaCons "Only" 'PrefixI 'True) (S1 ('MetaSel ('Just "fromOnly") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))