Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class Inflatable m base where
- data DependencyList a b c :: (* -> *) -> [*] -> [*] -> * where
- NilDeps :: DependencyList a ([] *) ([] *)
- (:&:) :: DependencyList a ((:) * b1 bs) ((:) * f fs)
- class AllSatisfy * bs (Inflatable' * (* -> *) m) => HasDependencies m a bs | a -> bs, bs -> m where
- type family NamedDependency a :: Symbol
- data SideLoad fs :: [*] -> *
Necessary for using SideLoad
deps
.
class Inflatable m base where #
Inflatable represents a type b
which can be expanded inside of a context m
.
type PGMonad = ReaderT Connection (ExceptT QueryError IO) instance Inflatable PGMonad PersonId where type Full PGMonad PersonId = Person inflator = getPersonById
Inflatable Identity base | Anything can be expanded into itself in the trivial context. |
data DependencyList a b c :: (* -> *) -> [*] -> [*] -> * where #
DependencyList
m bs fs
is a type representing a heterogeneous list parameterized
by bs
, which can be transformed into a hetergeneous list of type fs
in the context
provided by m
.
NilDeps :: DependencyList a ([] *) ([] *) | |
(:&:) :: DependencyList a ((:) * b1 bs) ((:) * f fs) infixr 5 |
AllSatisfy * bs (Eq' *) => Eq (DependencyList m bs fs) | |
AllSatisfy * bs (Show' *) => Show (DependencyList m bs fs) | |
class AllSatisfy * bs (Inflatable' * (* -> *) m) => HasDependencies m a bs | a -> bs, bs -> m where #
Indicate that a type has dependencies, and supply the uninflated values.
data Album = Album { albumId :: AlbumId , albumArtist :: PersonId , albumPhotos :: [PhotoId] , albumTitle :: Text } instance HasDependencies PGMonad Album '[Person, [PhotoId]] where getDependencies album = albumArtist album :&: albumPhotos album :&: NilDeps
getDependencies :: a -> DependencyList m bs (Map * * (Full' * (* -> *) m) bs) #
Type family for JSON object keys.
type family NamedDependency a :: Symbol #
Labels for the objects created in the dependency mapping. Necessary for JSON instances.
type instance NamedDependency Person = "person" type instance NamedDependency [Photo] = "photos"