-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | SmallArray-based extensible records for small-scale fast reads
--
-- Please see the README on GitHub at
-- https://github.com/re-xyr/rec-smallarray#readme
@package rec-smallarray
@version 0.1.0.0
-- | This module defines an immutable extensible record type, similar to
-- vinyl and data-diverse. However this implementation
-- focuses on fast reads, hence has very different performance
-- characteristics from other libraries:
--
--
-- - Lookup: Amortized <math>.
-- - Update: <math>.
-- - Shrink: <math>.
-- - Append: <math>.
--
module Data.Rec.SmallArray
-- | Extensible record type supporting efficient <math> reads. The
-- underlying implementation is SmallArray slices, therefore suits
-- small numbers of entries (i.e. less than 128).
data Rec (f :: k -> Type) (es :: [k])
-- | Get the length of the record.
length :: Rec f es -> Int
-- | Create an empty record. <math>.
empty :: Rec f '[]
-- | Create a record with one entry. <math>.
singleton :: f e -> Rec f '[e]
-- | Prepend one entry to the record. <math>.
cons :: f e -> Rec f es -> Rec f (e : es)
-- | Infix version of cons that also supports destructuring.
pattern (:~:) :: f e -> Rec f es -> Rec f (e : es)
infixr 5 :~:
-- | Type level list concatenation.
type family xs ++ ys
infixr 5 ++
-- | Concatenate two records. <math>.
concat :: Rec f es -> Rec f es' -> Rec f (es ++ es')
-- | Infix version of concat that also supports destructuring.
pattern (:++:) :: forall es es' f. KnownList es => Rec f es -> Rec f es' -> Rec f (es ++ es')
infixr 5 :++:
-- | Slice off one entry from the top of the record. <math>.
tail :: Rec f (e : es) -> Rec f es
-- | The list es list is concrete, i.e. is of the form '[a1,
-- a2, ..., an], i.e. is not a type variable.
class KnownList (es :: [k])
-- | Slice off several entries from the top of the record. <math>.
drop :: forall es es' f. KnownList es => Rec f (es ++ es') -> Rec f es'
-- | Get the head of the record. <math>.
head :: Rec f (e : es) -> f e
-- | Take elements from the top of the record. <math>.
take :: forall es es' f. KnownList es => Rec f (es ++ es') -> Rec f es
-- | The element e is present in the list es.
class Elem (e :: k) (es :: [k])
-- | Get an element in the record. Amortized <math>.
index :: forall e es f. Elem e es => Rec f es -> f e
-- | es is a subset of es'.
class KnownList es => Subset (es :: [k]) (es' :: [k])
-- | Get a subset of the record. Amortized <math>.
pick :: forall es es' f. Subset es es' => Rec f es' -> Rec f es
-- | Update an entry in the record. <math>.
update :: forall e es f. Elem e es => f e -> Rec f es -> Rec f es
-- | Infix version of update.
(/~/) :: Elem e es => f e -> Rec f es -> Rec f es
infixl 9 /~/
-- | Modify an entry in the record via a function. <math>.
modify :: forall e es f. Elem e es => (f e -> f e) -> Rec f es -> Rec f es
-- | Merge a subset into the original record, updating several entries at
-- once. <math>.
batch :: forall es es' f. Subset es es' => Rec f es -> Rec f es' -> Rec f es'
-- | Infix version of batch.
(/++/) :: Subset es es' => Rec f es -> Rec f es' -> Rec f es'
infixl 9 /++/
-- | The type of natural transformations from functor f to
-- g.
type f ~> g = forall a. f a -> g a
infixr 0 ~>
-- | Apply a natural transformation to the record. <math>.
natural :: (f ~> g) -> Rec f es -> Rec g es
-- | Infix version of natural.
(<#>) :: (f ~> g) -> Rec f es -> Rec g es
infixl 4 <#>
-- | Zip two records with a natural transformation. <math>.
zipWith :: (forall x. f x -> g x -> h x) -> Rec f es -> Rec g es -> Rec h es
-- | Check if a predicate is true on all elements. <math>.
all :: (forall x. f x -> Bool) -> Rec f es -> Bool
-- | Check if a predicate is true on at least one element. <math>.
any :: (forall x. f x -> Bool) -> Rec f es -> Bool
-- | Convert a record that effectively contains a fixed type into a list of
-- the fixed type. <math>.
degenerate :: Rec (Const a) es -> [a]
-- | Map each element to a fixed type. <math>.
extract :: (forall x. f x -> a) -> Rec f es -> [a]
-- | Test all invariants.
invariant :: Rec f es -> Rec f es
-- | Test the size invariant of Rec.
sizeInvariant :: Rec f es -> Rec f es
-- | Test whether all fields of Rec are really set.
allAccessible :: Rec f es -> Rec f es
instance forall k (es :: [k]). Data.Rec.SmallArray.Subset '[] es
instance forall k (es :: [k]) (es' :: [k]) (e :: k). (Data.Rec.SmallArray.Subset es es', Data.Rec.SmallArray.Elem e es') => Data.Rec.SmallArray.Subset (e : es) es'
instance forall k (e :: k). (TypeError ...) => Data.Rec.SmallArray.Elem e '[]
instance forall a (e :: a) (es :: [a]). Data.Rec.SmallArray.Elem e (e : es)
instance forall a (e :: a) (es :: [a]) (e' :: a). Data.Rec.SmallArray.Elem e es => Data.Rec.SmallArray.Elem e (e' : es)
instance Data.Rec.SmallArray.KnownList '[]
instance forall k (es :: [k]) (e :: k). Data.Rec.SmallArray.KnownList es => Data.Rec.SmallArray.KnownList (e : es)
instance forall k (f :: k -> Type). GHC.Classes.Eq (Data.Rec.SmallArray.Rec f '[])
instance forall a (f :: a -> Type) (xs :: [a]) (x :: a). (GHC.Classes.Eq (Data.Rec.SmallArray.Rec f xs), GHC.Classes.Eq (f x)) => GHC.Classes.Eq (Data.Rec.SmallArray.Rec f (x : xs))
instance forall k (f :: k -> Type) (xs :: [k]). (forall (x :: k). GHC.Classes.Eq (f x)) => GHC.Classes.Eq (Data.Rec.SmallArray.Rec f xs)
instance forall k (f :: k -> Type). GHC.Show.Show (Data.Rec.SmallArray.Rec f '[])
instance forall k (f :: k -> Type). GHC.Read.Read (Data.Rec.SmallArray.Rec f '[])
instance forall a (f :: a -> Type) (x :: a) (xs :: [a]). (GHC.Show.Show (f x), GHC.Show.Show (Data.Rec.SmallArray.Rec f xs)) => GHC.Show.Show (Data.Rec.SmallArray.Rec f (x : xs))
instance forall a (f :: a -> Type) (x :: a) (xs :: [a]). (GHC.Read.Read (f x), GHC.Read.Read (Data.Rec.SmallArray.Rec f xs)) => GHC.Read.Read (Data.Rec.SmallArray.Rec f (x : xs))
instance forall k (f :: k -> Type) (xs :: [k]). (forall (x :: k). GHC.Show.Show (f x)) => GHC.Show.Show (Data.Rec.SmallArray.Rec f xs)
instance forall k (f :: k -> Type). GHC.Base.Semigroup (Data.Rec.SmallArray.Rec f '[])
instance forall a (f :: a -> Type) (x :: a) (xs :: [a]). (GHC.Base.Semigroup (f x), GHC.Base.Semigroup (Data.Rec.SmallArray.Rec f xs)) => GHC.Base.Semigroup (Data.Rec.SmallArray.Rec f (x : xs))
instance forall k (f :: k -> Type) (xs :: [k]). (forall (x :: k). GHC.Base.Semigroup (f x)) => GHC.Base.Semigroup (Data.Rec.SmallArray.Rec f xs)
instance forall k (f :: k -> Type). GHC.Base.Monoid (Data.Rec.SmallArray.Rec f '[])
instance forall a (f :: a -> Type) (x :: a) (xs :: [a]). (GHC.Base.Monoid (f x), GHC.Base.Monoid (Data.Rec.SmallArray.Rec f xs)) => GHC.Base.Monoid (Data.Rec.SmallArray.Rec f (x : xs))