Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type WithSpecificDomain dom r = (HasSpecificDomain dom r, dom ~ GetDomain dom r)
- type WithSingleDomain dom r = (HasSingleDomain r, dom ~ GetDomain r)
- type family HasDomain (dom :: Domain) (n :: Type) :: HasDomainWrapperResult
- type family TryDomain (orig :: Type) (n :: Type) :: TryDomainResult
- data TryDomainResult
- type DomEq (n :: Domain) (m :: Domain) = IfStuck (DomEqWorker n m) 'NotFound (Pure (DomEqWorker n m))
Documentation
type WithSpecificDomain dom r = (HasSpecificDomain dom r, dom ~ GetDomain dom r) Source #
Type that forces dom to be present in r at least once. Will resolve to a type error if it doesn't. It will always fail if given dom is completely polymorphic and can't be tied to r in any way.
type WithSingleDomain dom r = (HasSingleDomain r, dom ~ GetDomain r) Source #
Type that forces dom to be the same in all subtypes of r that might contain a domain. If given a polymorphic domain not tied to r, GHC will be allowed to infer that that domain is equal to the one in r on the condition that r contains just a single domain.
type family HasDomain (dom :: Domain) (n :: Type) :: HasDomainWrapperResult Source #
Type family that searches a type and checks whether a specific domain is present. Will result in either "domain not found, and no others either", "domain not found, but found another", or "found domain".
Instances
type family TryDomain (orig :: Type) (n :: Type) :: TryDomainResult Source #
Instances
type DomEq (n :: Domain) (m :: Domain) = IfStuck (DomEqWorker n m) 'NotFound (Pure (DomEqWorker n m)) Source #
Check domain for equality. Return 'Found
if so, return 'NotFound
if not.
The reason d'etre for this type family is that _open_ type families don't
allow overlapping types. We therefore defer equality checking to a closed
type family.