-- | Utility type.
module ParkBench.Named
  ( Named (..),
    name,
    thing,
  )
where

import ParkBench.Prelude

-- | A named thing.
data Named a
  = Named
      {-# UNPACK #-} !Text
      !a
  deriving stock (Named a -> Bool
(a -> m) -> Named a -> m
(a -> b -> b) -> b -> Named a -> b
(forall m. Monoid m => Named m -> m)
-> (forall m a. Monoid m => (a -> m) -> Named a -> m)
-> (forall m a. Monoid m => (a -> m) -> Named a -> m)
-> (forall a b. (a -> b -> b) -> b -> Named a -> b)
-> (forall a b. (a -> b -> b) -> b -> Named a -> b)
-> (forall b a. (b -> a -> b) -> b -> Named a -> b)
-> (forall b a. (b -> a -> b) -> b -> Named a -> b)
-> (forall a. (a -> a -> a) -> Named a -> a)
-> (forall a. (a -> a -> a) -> Named a -> a)
-> (forall a. Named a -> [a])
-> (forall a. Named a -> Bool)
-> (forall a. Named a -> Int)
-> (forall a. Eq a => a -> Named a -> Bool)
-> (forall a. Ord a => Named a -> a)
-> (forall a. Ord a => Named a -> a)
-> (forall a. Num a => Named a -> a)
-> (forall a. Num a => Named a -> a)
-> Foldable Named
forall a. Eq a => a -> Named a -> Bool
forall a. Num a => Named a -> a
forall a. Ord a => Named a -> a
forall m. Monoid m => Named m -> m
forall a. Named a -> Bool
forall a. Named a -> Int
forall a. Named a -> [a]
forall a. (a -> a -> a) -> Named a -> a
forall m a. Monoid m => (a -> m) -> Named a -> m
forall b a. (b -> a -> b) -> b -> Named a -> b
forall a b. (a -> b -> b) -> b -> Named a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Named a -> a
$cproduct :: forall a. Num a => Named a -> a
sum :: Named a -> a
$csum :: forall a. Num a => Named a -> a
minimum :: Named a -> a
$cminimum :: forall a. Ord a => Named a -> a
maximum :: Named a -> a
$cmaximum :: forall a. Ord a => Named a -> a
elem :: a -> Named a -> Bool
$celem :: forall a. Eq a => a -> Named a -> Bool
length :: Named a -> Int
$clength :: forall a. Named a -> Int
null :: Named a -> Bool
$cnull :: forall a. Named a -> Bool
toList :: Named a -> [a]
$ctoList :: forall a. Named a -> [a]
foldl1 :: (a -> a -> a) -> Named a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Named a -> a
foldr1 :: (a -> a -> a) -> Named a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Named a -> a
foldl' :: (b -> a -> b) -> b -> Named a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Named a -> b
foldl :: (b -> a -> b) -> b -> Named a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Named a -> b
foldr' :: (a -> b -> b) -> b -> Named a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Named a -> b
foldr :: (a -> b -> b) -> b -> Named a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Named a -> b
foldMap' :: (a -> m) -> Named a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Named a -> m
foldMap :: (a -> m) -> Named a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Named a -> m
fold :: Named m -> m
$cfold :: forall m. Monoid m => Named m -> m
Foldable, a -> Named b -> Named a
(a -> b) -> Named a -> Named b
(forall a b. (a -> b) -> Named a -> Named b)
-> (forall a b. a -> Named b -> Named a) -> Functor Named
forall a b. a -> Named b -> Named a
forall a b. (a -> b) -> Named a -> Named b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Named b -> Named a
$c<$ :: forall a b. a -> Named b -> Named a
fmap :: (a -> b) -> Named a -> Named b
$cfmap :: forall a b. (a -> b) -> Named a -> Named b
Functor, Functor Named
Foldable Named
Functor Named
-> Foldable Named
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Named a -> f (Named b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Named (f a) -> f (Named a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Named a -> m (Named b))
-> (forall (m :: * -> *) a. Monad m => Named (m a) -> m (Named a))
-> Traversable Named
(a -> f b) -> Named a -> f (Named b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Named (m a) -> m (Named a)
forall (f :: * -> *) a. Applicative f => Named (f a) -> f (Named a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Named a -> m (Named b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Named a -> f (Named b)
sequence :: Named (m a) -> m (Named a)
$csequence :: forall (m :: * -> *) a. Monad m => Named (m a) -> m (Named a)
mapM :: (a -> m b) -> Named a -> m (Named b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Named a -> m (Named b)
sequenceA :: Named (f a) -> f (Named a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Named (f a) -> f (Named a)
traverse :: (a -> f b) -> Named a -> f (Named b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Named a -> f (Named b)
$cp2Traversable :: Foldable Named
$cp1Traversable :: Functor Named
Traversable)

name :: Named a -> Text
name :: Named a -> Text
name (Named Text
n a
_) =
  Text
n

thing :: Named a -> a
thing :: Named a -> a
thing (Named Text
_ a
x) =
  a
x