Copyright | (c) Justin Le 2021 |
---|---|
License | BSD3 |
Maintainer | [email protected] |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Servant.Validate.Internal
Description
Internal type-level tools.
Documentation
type family MergeMethods err (xs :: [k]) (ys :: [k]) :: [k] where ... Source #
Equations
MergeMethods err '[] '[] = '[] | |
MergeMethods err '[] (y ': ys) = y ': ys | |
MergeMethods err (x ': xs) '[] = x ': xs | |
MergeMethods err (x ': xs) (y ': ys) = Cases (Compare x y) (x ': MergeMethods err xs (y ': ys)) (TypeError ((err :<>: 'Text ": ") :<>: ShowType x)) (y ': MergeMethods err (x ': xs) ys) |
type family MergePaths (base :: [Symbol]) (xs :: [(Symbol, ApiTree)]) (ys :: [(Symbol, ApiTree)]) :: [(Symbol, ApiTree)] where ... Source #
Equations
MergePaths base '[] '[] = '[] | |
MergePaths base '[] ('(b, y) ': bys) = '(b, y) ': bys | |
MergePaths base ('(a, x) ': axs) '[] = '(a, x) ': axs | |
MergePaths base ('(a, x) ': axs) ('(b, y) ': bys) = Cases (Compare a b) ('(a, x) ': MergePaths base axs ('(b, y) ': bys)) ('(a, MergeTree (a ': base) x y) ': MergePaths base axs bys) ('(b, y) ': MergePaths base ('(a, x) ': axs) bys) |
type family MergeTree (base :: [Symbol]) (a :: ApiTree) (b :: ApiTree) :: ApiTree where ... Source #
Equations
MergeTree base ('Branch mA pA) ('Branch mB pB) = 'Branch (MergeMethods ('Text "Duplicate method in API at path " :<>: 'Text ("/" `AppendSymbol` ShowPath base)) mA mB) (MergePaths base pA pB) |
sMergeMethods :: forall err xs ys. Prod SSym xs -> Prod SSym ys -> Prod SSym (MergeMethods err xs ys) Source #
sMergePaths :: forall base xs ys. Prod (Tup SSym SApiTree) xs -> Prod (Tup SSym SApiTree) ys -> Prod (Tup SSym SApiTree) (MergePaths base xs ys) Source #
toSApiTree :: TypeRep api -> SApiTree api Source #
toProd :: forall k (as :: [k]) f. (forall (a :: k). TypeRep a -> f a) -> TypeRep as -> Prod f as Source #
reflectProd :: forall k (as :: [k]) f r. (forall (a :: k). f a -> r) -> Prod f as -> [r] Source #
toTup :: (forall x. TypeRep x -> f x) -> (forall x. TypeRep x -> g x) -> TypeRep xy -> Tup f g xy Source #
reflectTup :: forall j k (xy :: (j, k)) f g a b. (forall (x :: j). f x -> a) -> (forall (y :: k). g y -> b) -> Tup f g xy -> (a, b) Source #
reflectSSym :: forall s. SSym s -> Text Source #