extensible-0.5: Extensible, efficient, optics-friendly data types and effects

Copyright(c) Fumiaki Kinoshita 2018
LicenseBSD3
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Data.Extensible.Wrapper

Description

 
Synopsis

Documentation

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

The extensible data types should take k -> * 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) :: * Source #

Repr h v is the actual 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
Wrapper (Proxy :: k -> Type) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr Proxy v :: Type Source #

Methods

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

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

unwrap :: 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 :: Type Source #

Methods

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

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

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

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

Defined in Data.Extensible.Nullable

Associated Types

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

Methods

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

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

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

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

Defined in Data.Extensible.GetOpt

Associated Types

type Repr (OptionDescr h) v :: Type 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 :: Type Source #

Methods

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

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

unwrap :: Prod f g v -> Repr (Prod f g) 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 :: Type Source #

Methods

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

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

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

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

Defined in Data.Extensible.Wrapper

Associated Types

type Repr (Comp f g) v :: Type Source #

Methods

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

wrap :: Repr (Comp f g) v -> Comp f g v Source #

unwrap :: Comp f g v -> Repr (Comp f g) v Source #

Wrapper [] Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr [] v :: Type Source #

Methods

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

wrap :: Repr [] v -> [v] Source #

unwrap :: [v] -> Repr [] v Source #

Wrapper Maybe Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr Maybe v :: Type Source #

Methods

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

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

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

Wrapper Identity Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr Identity v :: Type Source #

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

Defined in Data.Extensible.Wrapper

Associated Types

type Repr (Either e) v :: Type Source #

Methods

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

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

unwrap :: Either e v -> Repr (Either e) 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 :: Type Source #

Methods

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

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

unwrap :: 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.

newtype Comp (f :: j -> *) (g :: i -> j) (a :: i) Source #

Poly-kinded composition

Constructors

Comp 

Fields

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

Defined in Data.Extensible.Wrapper

Associated Types

type Repr (Comp f g) v :: Type Source #

Methods

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

wrap :: Repr (Comp f g) v -> Comp f g v Source #

unwrap :: Comp f g v -> Repr (Comp f g) v Source #

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

Defined in Data.Extensible.Wrapper

Methods

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

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

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

Defined in Data.Extensible.Wrapper

Methods

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

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

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

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

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

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

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

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

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

null :: Comp f g a -> Bool #

length :: Comp f g a -> Int #

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

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

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

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

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

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

Defined in Data.Extensible.Wrapper

Methods

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

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

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

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

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

Defined in Data.Extensible.Wrapper

Methods

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

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

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

Defined in Data.Extensible.Wrapper

Methods

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

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

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

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

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

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

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

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

Defined in Data.Extensible.Wrapper

Methods

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

show :: Comp f g a -> String #

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

Generic (Comp f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

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

Methods

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

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

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

Defined in Data.Extensible.Wrapper

Methods

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

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

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

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

Defined in Data.Extensible.Wrapper

Methods

mempty :: Comp f g a #

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

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

Lift (f (g a)) => Lift (Comp f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

lift :: Comp f g a -> Q Exp #

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

Defined in Data.Extensible.Wrapper

Methods

arbitrary :: Gen (Comp f g a) #

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

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

Defined in Data.Extensible.Wrapper

Methods

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

hash :: Comp f g a -> Int #

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

Defined in Data.Extensible.Wrapper

Methods

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

Pretty (f (g a)) => Pretty (Comp f g a) Source # 
Instance details

Defined in Data.Extensible.Wrapper

Methods

pretty :: Comp f g a -> Doc ann #

prettyList :: [Comp f g a] -> Doc ann #

type Repr (Comp f g :: k -> Type) (x :: k) Source # 
Instance details

Defined in Data.Extensible.Wrapper

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

Defined in Data.Extensible.Wrapper

type Rep (Comp f g a) = D1 (MetaData "Comp" "Data.Extensible.Wrapper" "extensible-0.5-HtYa3fOZlWC7KXWLoStAWc" True) (C1 (MetaCons "Comp" PrefixI True) (S1 (MetaSel (Just "getComp") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (f (g a)))))

comp :: Functor f => (a -> g b) -> f a -> Comp 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
(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 :: Type Source #

Methods

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

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

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

(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 #

(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 #

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

(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 #

(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 #

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 #

(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 #

(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 #

(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] #

(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 #

(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 -> () #

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.5-HtYa3fOZlWC7KXWLoStAWc" 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))))