wakame-0.1.0.0: Functions to manipulate records

Safe HaskellNone
LanguageHaskell2010

Wakame.Row

Contents

Synopsis

Documentation

type FIELD = (Symbol, Type) Source #

Kind of field

Keyed value type and function

newtype V (p :: FIELD) Source #

>>> V 3 :: V '("x", Int)
(x: 3)

Constructors

V 

Fields

Instances
(IsString s, KnownSymbol key) => Keys' s (S1 (MetaSel (Nothing :: Maybe Symbol) su ss ds) (Rec0 (V ((,) key a))) :: k -> Type) Source # 
Instance details

Defined in Wakame.Keys

Methods

keys' :: S1 (MetaSel Nothing su ss ds) (Rec0 (V (key, a))) a0 -> [s] Source #

IsRow' (S1 (MetaSel (Nothing :: Maybe Symbol) su ss ds) (Rec0 (V ((,) key a))) :: k -> Type) Source # 
Instance details

Defined in Wakame.Generics

Associated Types

type Of' (S1 (MetaSel Nothing su ss ds) (Rec0 (V (key, a)))) :: [FIELD] Source #

Methods

fromRow' :: Row (Of' (S1 (MetaSel Nothing su ss ds) (Rec0 (V (key, a))))) -> S1 (MetaSel Nothing su ss ds) (Rec0 (V (key, a))) a0 Source #

toRow' :: S1 (MetaSel Nothing su ss ds) (Rec0 (V (key, a))) a0 -> Row (Of' (S1 (MetaSel Nothing su ss ds) (Rec0 (V (key, a))))) Source #

(KnownSymbol (Fst p), Eq (Snd p)) => Eq (V p) Source # 
Instance details

Defined in Wakame.Row

Methods

(==) :: V p -> V p -> Bool #

(/=) :: V p -> V p -> Bool #

(KnownSymbol (Fst p), Show (Snd p)) => Show (V p) Source # 
Instance details

Defined in Wakame.Row

Methods

showsPrec :: Int -> V p -> ShowS #

show :: V p -> String #

showList :: [V p] -> ShowS #

Generic (V ((,) k v)) Source # 
Instance details

Defined in Wakame.Row

Associated Types

type Rep (V (k, v)) :: Type -> Type #

Methods

from :: V (k, v) -> Rep (V (k, v)) x #

to :: Rep (V (k, v)) x -> V (k, v) #

type Of' (S1 (MetaSel (Nothing :: Maybe Symbol) su ss ds) (Rec0 (V ((,) key a))) :: k -> Type) Source # 
Instance details

Defined in Wakame.Generics

type Of' (S1 (MetaSel (Nothing :: Maybe Symbol) su ss ds) (Rec0 (V ((,) key a))) :: k -> Type) = (,) key a ': ([] :: [(Symbol, Type)])
type Rep (V ((,) k v)) Source # 
Instance details

Defined in Wakame.Row

type Keyed k v = V '(k, v) Source #

keyed :: KnownSymbol k => v -> Keyed k v Source #

Row type

type Row as = NP V (as :: [FIELD]) Source #

class IsRow (a :: Type) where Source #

Typeclass of converting from/to Row

Associated Types

type Of a :: [FIELD] Source #

Methods

fromRow :: Row (Of a) -> a Source #

toRow :: a -> Row (Of a) Source #

Instances
(Generic a, IsRow' (Rep a)) => IsRow a Source #

Instance of IsRow over generic rep >>> :kind! Of Point Of Point :: [(Symbol, *)] = '[ '("x", Double), '("y", Double)]

>>> toRow' $ from $ Point 1.2 8.3
(x: 1.2) :* (y: 8.3) :* Nil
>>> to @Point $ fromRow' $ keyed @"x" 1.2 :* keyed @"y" 8.3 :* Nil
Point {x = 1.2, y = 8.3}
Instance details

Defined in Wakame.Generics

Associated Types

type Of a :: [FIELD] Source #

Methods

fromRow :: Row (Of a) -> a Source #

toRow :: a -> Row (Of a) Source #

Re-export from Data.SOP.NP

data NP (a :: k -> Type) (b :: [k]) :: forall k. (k -> Type) -> [k] -> Type where #

An n-ary product.

The product is parameterized by a type constructor f and indexed by a type-level list xs. The length of the list determines the number of elements in the product, and if the i-th element of the list is of type x, then the i-th element of the product is of type f x.

The constructor names are chosen to resemble the names of the list constructors.

Two common instantiations of f are the identity functor I and the constant functor K. For I, the product becomes a heterogeneous list, where the type-level list describes the types of its components. For K a, the product becomes a homogeneous list, where the contents of the type-level list are ignored, but its length still specifies the number of elements.

In the context of the SOP approach to generic programming, an n-ary product describes the structure of the arguments of a single data constructor.

Examples:

I 'x'    :* I True  :* Nil  ::  NP I       '[ Char, Bool ]
K 0      :* K 1     :* Nil  ::  NP (K Int) '[ Char, Bool ]
Just 'x' :* Nothing :* Nil  ::  NP Maybe   '[ Char, Bool ]

Constructors

Nil :: forall k (a :: k -> Type) (b :: [k]). NP a ([] :: [k]) 
(:*) :: forall k (a :: k -> Type) (b :: [k]) (x :: k) (xs :: [k]). a x -> NP a xs -> NP a (x ': xs) infixr 5 
Instances
HTrans (NP :: (k1 -> Type) -> [k1] -> Type) (NP :: (k2 -> Type) -> [k2] -> Type) 
Instance details

Defined in Data.SOP.NP

Methods

htrans :: AllZipN (Prod NP) c xs ys => proxy c -> (forall (x :: k10) (y :: k20). c x y => f x -> g y) -> NP f xs -> NP g ys #

hcoerce :: AllZipN (Prod NP) (LiftedCoercible f g) xs ys => NP f xs -> NP g ys #

HPure (NP :: (k -> Type) -> [k] -> Type) 
Instance details

Defined in Data.SOP.NP

Methods

hpure :: SListIN NP xs => (forall (a :: k0). f a) -> NP f xs #

hcpure :: AllN NP c xs => proxy c -> (forall (a :: k0). c a => f a) -> NP f xs #

HAp (NP :: (k -> Type) -> [k] -> Type) 
Instance details

Defined in Data.SOP.NP

Methods

hap :: Prod NP (f -.-> g) xs -> NP f xs -> NP g xs #

HCollapse (NP :: (k -> Type) -> [k] -> Type) 
Instance details

Defined in Data.SOP.NP

Methods

hcollapse :: SListIN NP xs => NP (K a) xs -> CollapseTo NP a #

HTraverse_ (NP :: (k -> Type) -> [k] -> Type) 
Instance details

Defined in Data.SOP.NP

Methods

hctraverse_ :: (AllN NP c xs, Applicative g) => proxy c -> (forall (a :: k0). c a => f a -> g ()) -> NP f xs -> g () #

htraverse_ :: (SListIN NP xs, Applicative g) => (forall (a :: k0). f a -> g ()) -> NP f xs -> g () #

HSequence (NP :: (k -> Type) -> [k] -> Type) 
Instance details

Defined in Data.SOP.NP

Methods

hsequence' :: (SListIN NP xs, Applicative f) => NP (f :.: g) xs -> f (NP g xs) #

hctraverse' :: (AllN NP c xs, Applicative g) => proxy c -> (forall (a :: k0). c a => f a -> g (f' a)) -> NP f xs -> g (NP f' xs) #

htraverse' :: (SListIN NP xs, Applicative g) => (forall (a :: k0). f a -> g (f' a)) -> NP f xs -> g (NP f' xs) #

All (Compose Eq f) xs => Eq (NP f xs) 
Instance details

Defined in Data.SOP.NP

Methods

(==) :: NP f xs -> NP f xs -> Bool #

(/=) :: NP f xs -> NP f xs -> Bool #

(All (Compose Eq f) xs, All (Compose Ord f) xs) => Ord (NP f xs) 
Instance details

Defined in Data.SOP.NP

Methods

compare :: NP f xs -> NP f xs -> Ordering #

(<) :: NP f xs -> NP f xs -> Bool #

(<=) :: NP f xs -> NP f xs -> Bool #

(>) :: NP f xs -> NP f xs -> Bool #

(>=) :: NP f xs -> NP f xs -> Bool #

max :: NP f xs -> NP f xs -> NP f xs #

min :: NP f xs -> NP f xs -> NP f xs #

All (Compose Show f) xs => Show (NP f xs) 
Instance details

Defined in Data.SOP.NP

Methods

showsPrec :: Int -> NP f xs -> ShowS #

show :: NP f xs -> String #

showList :: [NP f xs] -> ShowS #

All (Compose Semigroup f) xs => Semigroup (NP f xs)

Since: sop-core-0.4.0.0

Instance details

Defined in Data.SOP.NP

Methods

(<>) :: NP f xs -> NP f xs -> NP f xs #

sconcat :: NonEmpty (NP f xs) -> NP f xs #

stimes :: Integral b => b -> NP f xs -> NP f xs #

(All (Compose Monoid f) xs, All (Compose Semigroup f) xs) => Monoid (NP f xs)

Since: sop-core-0.4.0.0

Instance details

Defined in Data.SOP.NP

Methods

mempty :: NP f xs #

mappend :: NP f xs -> NP f xs -> NP f xs #

mconcat :: [NP f xs] -> NP f xs #

All (Compose NFData f) xs => NFData (NP f xs)

Since: sop-core-0.2.5.0

Instance details

Defined in Data.SOP.NP

Methods

rnf :: NP f xs -> () #

type Same (NP :: (k1 -> Type) -> [k1] -> Type) 
Instance details

Defined in Data.SOP.NP

type Same (NP :: (k1 -> Type) -> [k1] -> Type) = (NP :: (k2 -> Type) -> [k2] -> Type)
type Prod (NP :: (k -> Type) -> [k] -> Type) 
Instance details

Defined in Data.SOP.NP

type Prod (NP :: (k -> Type) -> [k] -> Type) = (NP :: (k -> Type) -> [k] -> Type)
type CollapseTo (NP :: (k -> Type) -> [k] -> Type) a 
Instance details

Defined in Data.SOP.NP

type CollapseTo (NP :: (k -> Type) -> [k] -> Type) a = [a]
type SListIN (NP :: (k -> Type) -> [k] -> Type) 
Instance details

Defined in Data.SOP.NP

type SListIN (NP :: (k -> Type) -> [k] -> Type) = (SListI :: [k] -> Constraint)
type AllN (NP :: (k -> Type) -> [k] -> Type) (c :: k -> Constraint) 
Instance details

Defined in Data.SOP.NP

type AllN (NP :: (k -> Type) -> [k] -> Type) (c :: k -> Constraint) = All c
type AllZipN (NP :: (k -> Type) -> [k] -> Type) (c :: a -> b -> Constraint) 
Instance details

Defined in Data.SOP.NP

type AllZipN (NP :: (k -> Type) -> [k] -> Type) (c :: a -> b -> Constraint) = AllZip c