extensible-0.9.1: Extensible, efficient, optics-friendly data types and effects
Copyright(c) Fumiaki Kinoshita 2018
LicenseBSD3
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Extensible.Wrapper

Description

 
Synopsis

Documentation

class Wrapper (h :: k -> Type) where Source #

The extensible data types should take k -> Type as a parameter. This class allows us to take a shortcut for direct representation.

Minimal complete definition

wrap, unwrap | _Wrapper

Associated Types

type Repr h (v :: k) :: Type Source #

Repr h v is the user-facing representation of h v.

Methods

_Wrapper :: (Functor f, Profunctor p) => Optic' p f (h v) (Repr h v) Source #

This is an isomorphism between h v and Repr h v.

_Wrapper :: Iso' (h v) (Repr h v)

wrap :: Repr h v -> h v Source #

unwrap :: h v -> Repr h v Source #

Instances

Instances details
Wrapper Identity Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr Identity v Source #

Methods

_Wrapper :: forall f p (v :: k). (Functor f, Profunctor p) => Optic' p f (Identity v) (Repr Identity v) Source #

wrap :: forall (v :: k). Repr Identity v -> Identity v Source #

unwrap :: forall (v :: k). Identity v -> Repr Identity v Source #

Wrapper Maybe Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr Maybe v Source #

Methods

_Wrapper :: forall f p (v :: k). (Functor f, Profunctor p) => Optic' p f (Maybe v) (Repr Maybe v) Source #

wrap :: forall (v :: k). Repr Maybe v -> Maybe v Source #

unwrap :: forall (v :: k). Maybe v -> Repr Maybe v Source #

Wrapper List Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr List v Source #

Methods

_Wrapper :: forall f p (v :: k). (Functor f, Profunctor p) => Optic' p f [v] (Repr List v) Source #

wrap :: forall (v :: k). Repr List v -> [v] Source #

unwrap :: forall (v :: k). [v] -> Repr List v Source #

Wrapper (Either e :: Type -> Type) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr (Either e) v Source #

Methods

_Wrapper :: forall f p (v :: k). (Functor f, Profunctor p) => Optic' p f (Either e v) (Repr (Either e) v) Source #

wrap :: forall (v :: k). Repr (Either e) v -> Either e v Source #

unwrap :: forall (v :: k). Either e v -> Repr (Either e) v Source #

Wrapper (Proxy :: k -> Type) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr Proxy v Source #

Methods

_Wrapper :: forall f p (v :: k0). (Functor f, Profunctor p) => Optic' p f (Proxy v) (Repr Proxy v) Source #

wrap :: forall (v :: k0). Repr Proxy v -> Proxy v Source #

unwrap :: forall (v :: k0). Proxy v -> Repr Proxy v Source #

Wrapper (Const a :: k -> Type) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr (Const a) v Source #

Methods

_Wrapper :: forall f p (v :: k0). (Functor f, Profunctor p) => Optic' p f (Const a v) (Repr (Const a) v) Source #

wrap :: forall (v :: k0). Repr (Const a) v -> Const a v Source #

unwrap :: forall (v :: k0). Const a v -> Repr (Const a) v Source #

Wrapper (OptionDescr h :: k -> Type) Source # 
Instance details

Defined in Data.Extensible.GetOpt

Associated Types

type Repr (OptionDescr h) v Source #

Methods

_Wrapper :: forall f p (v :: k0). (Functor f, Profunctor p) => Optic' p f (OptionDescr h v) (Repr (OptionDescr h) v) Source #

wrap :: forall (v :: k0). Repr (OptionDescr h) v -> OptionDescr h v Source #

unwrap :: forall (v :: k0). OptionDescr h v -> Repr (OptionDescr h) v Source #

Wrapper h => Wrapper (Nullable h :: k -> Type) Source # 
Instance details

Defined in Data.Extensible.Nullable

Associated Types

type Repr (Nullable h) v Source #

Methods

_Wrapper :: forall f p (v :: k0). (Functor f, Profunctor p) => Optic' p f (Nullable h v) (Repr (Nullable h) v) Source #

wrap :: forall (v :: k0). Repr (Nullable h) v -> Nullable h v Source #

unwrap :: forall (v :: k0). Nullable h v -> Repr (Nullable h) v Source #

Wrapper h => Wrapper (Match h r :: k -> Type) Source # 
Instance details

Defined in Data.Extensible.Match

Associated Types

type Repr (Match h r) v Source #

Methods

_Wrapper :: forall f p (v :: k0). (Functor f, Profunctor p) => Optic' p f (Match h r v) (Repr (Match h r) v) Source #

wrap :: forall (v :: k0). Repr (Match h r) v -> Match h r v Source #

unwrap :: forall (v :: k0). Match h r v -> Repr (Match h r) v Source #

(Wrapper f, Wrapper g) => Wrapper (Prod f g :: k -> Type) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr (Prod f g) v Source #

Methods

_Wrapper :: forall f0 p (v :: k0). (Functor f0, Profunctor p) => Optic' p f0 (Prod f g v) (Repr (Prod f g) v) Source #

wrap :: forall (v :: k0). Repr (Prod f g) v -> Prod f g v Source #

unwrap :: forall (v :: k0). Prod f g v -> Repr (Prod f g) v Source #

(Functor f, Wrapper g) => Wrapper (Compose f g :: k -> Type) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr (Compose f g) v Source #

Methods

_Wrapper :: forall f0 p (v :: k0). (Functor f0, Profunctor p) => Optic' p f0 (Compose f g v) (Repr (Compose f g) v) Source #

wrap :: forall (v :: k0). Repr (Compose f g) v -> Compose f g v Source #

unwrap :: forall (v :: k0). Compose f g v -> Repr (Compose f g) v Source #

Wrapper h => Wrapper (Field h :: Assoc k v -> Type) Source # 
Instance details

Defined in Data.Extensible.Field

Associated Types

type Repr (Field h) v Source #

Methods

_Wrapper :: forall f p (v0 :: k0). (Functor f, Profunctor p) => Optic' p f (Field h v0) (Repr (Field h) v0) Source #

wrap :: forall (v0 :: k0). Repr (Field h) v0 -> Field h v0 Source #

unwrap :: forall (v0 :: k0). Field h v0 -> Repr (Field h) v0 Source #

_WrapperAs :: (Functor f, Profunctor p, Wrapper h) => proxy v -> Optic' p f (h v) (Repr h v) Source #

Restricted version of _Wrapper. It is useful for eliminating ambiguousness.

type Comp = Compose Source #

Deprecated: Use Compose instead

pattern Comp :: f (g a) -> Compose f g a Source #

Deprecated: Use Compose instead

getComp :: Compose f g a -> f (g a) Source #

Deprecated: Use getCompose instead

comp :: Functor f => (a -> g b) -> f a -> Compose f g b Source #

Wrap a result of fmap

data Prod f g a Source #

Poly-kinded product

Constructors

Prod (f a) (g a) 

Instances

Instances details
(Wrapper f, Wrapper g) => Wrapper (Prod f g :: k -> Type) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr (Prod f g) v Source #

Methods

_Wrapper :: forall f0 p (v :: k0). (Functor f0, Profunctor p) => Optic' p f0 (Prod f g v) (Repr (Prod f g) v) Source #

wrap :: forall (v :: k0). Repr (Prod f g) v -> Prod f g v Source #

unwrap :: forall (v :: k0). Prod f g v -> Repr (Prod f g) v Source #

(Foldable f, Foldable g) => Foldable (Prod f g) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

fold :: Monoid m => Prod f g m -> m #

foldMap :: Monoid m => (a -> m) -> Prod f g a -> m #

foldMap' :: Monoid m => (a -> m) -> Prod f g a -> m #

foldr :: (a -> b -> b) -> b -> Prod f g a -> b #

foldr' :: (a -> b -> b) -> b -> Prod f g a -> b #

foldl :: (b -> a -> b) -> b -> Prod f g a -> b #

foldl' :: (b -> a -> b) -> b -> Prod f g a -> b #

foldr1 :: (a -> a -> a) -> Prod f g a -> a #

foldl1 :: (a -> a -> a) -> Prod f g a -> a #

toList :: Prod f g a -> [a] #

null :: Prod f g a -> Bool #

length :: Prod f g a -> Int #

elem :: Eq a => a -> Prod f g a -> Bool #

maximum :: Ord a => Prod f g a -> a #

minimum :: Ord a => Prod f g a -> a #

sum :: Num a => Prod f g a -> a #

product :: Num a => Prod f g a -> a #

(Traversable f, Traversable g) => Traversable (Prod f g) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Prod f g a -> f0 (Prod f g b) #

sequenceA :: Applicative f0 => Prod f g (f0 a) -> f0 (Prod f g a) #

mapM :: Monad m => (a -> m b) -> Prod f g a -> m (Prod f g b) #

sequence :: Monad m => Prod f g (m a) -> m (Prod f g a) #

(Functor f, Functor g) => Functor (Prod f g) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

fmap :: (a -> b) -> Prod f g a -> Prod f g b #

(<$) :: a -> Prod f g b -> Prod f g a #

(Arbitrary (f a), Arbitrary (g a)) => Arbitrary (Prod f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

arbitrary :: Gen (Prod f g a) #

shrink :: Prod f g a -> [Prod f g a] #

(Monoid (f a), Monoid (g a)) => Monoid (Prod f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

mempty :: Prod f g a #

mappend :: Prod f g a -> Prod f g a -> Prod f g a #

mconcat :: [Prod f g a] -> Prod f g a #

(Semigroup (f a), Semigroup (g a)) => Semigroup (Prod f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

(<>) :: Prod f g a -> Prod f g a -> Prod f g a #

sconcat :: NonEmpty (Prod f g a) -> Prod f g a #

stimes :: Integral b => b -> Prod f g a -> Prod f g a #

Generic (Prod f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Rep (Prod f g a) :: Type -> Type #

Methods

from :: Prod f g a -> Rep (Prod f g a) x #

to :: Rep (Prod f g a) x -> Prod f g a #

(Show (f a), Show (g a)) => Show (Prod f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

showsPrec :: Int -> Prod f g a -> ShowS #

show :: Prod f g a -> String #

showList :: [Prod f g a] -> ShowS #

(NFData (f a), NFData (g a)) => NFData (Prod f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

rnf :: Prod f g a -> () #

(Eq (f a), Eq (g a)) => Eq (Prod f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

(==) :: Prod f g a -> Prod f g a -> Bool #

(/=) :: Prod f g a -> Prod f g a -> Bool #

(Ord (f a), Ord (g a)) => Ord (Prod f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

compare :: Prod f g a -> Prod f g a -> Ordering #

(<) :: Prod f g a -> Prod f g a -> Bool #

(<=) :: Prod f g a -> Prod f g a -> Bool #

(>) :: Prod f g a -> Prod f g a -> Bool #

(>=) :: Prod f g a -> Prod f g a -> Bool #

max :: Prod f g a -> Prod f g a -> Prod f g a #

min :: Prod f g a -> Prod f g a -> Prod f g a #

(Hashable (f a), Hashable (g a)) => Hashable (Prod f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

hashWithSalt :: Int -> Prod f g a -> Int #

hash :: Prod f g a -> Int #

type Repr (Prod f g :: k -> Type) (a :: k) Source # 
Instance details

Defined in Data.Extensible.Wrapper

type Repr (Prod f g :: k -> Type) (a :: k) = (Repr f a, Repr g a)
type Rep (Prod f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

type Rep (Prod f g a) = D1 ('MetaData "Prod" "Data.Extensible.Wrapper" "extensible-0.9.1-FlXPM1oMU0CaPk6p1u6nG" 'False) (C1 ('MetaCons "Prod" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (g a))))