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 Source # (<$) :: a -> Only b -> Only a Source #
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) Source #

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

toConstr :: Only a -> Constr Source #

dataTypeOf :: Only a -> DataType Source #

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

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

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

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

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

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

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

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

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

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

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