{-# LANGUAGE FlexibleContexts, TemplateHaskell #-}
module Hyper.Unify.Constraints
( TypeConstraints(..)
, HasTypeConstraints(..)
, WithConstraint(..), wcConstraint, wcBody
) where
import Algebra.PartialOrd (PartialOrd(..))
import Data.Kind (Type)
import Hyper (HyperType, GetHyperType, type (#))
import Hyper.Internal.Prelude
class (PartialOrd c, Monoid c) => TypeConstraints c where
generalizeConstraints :: c -> c
toScopeConstraints :: c -> c
class
TypeConstraints (TypeConstraintsOf ast) =>
HasTypeConstraints (ast :: HyperType) where
type TypeConstraintsOf (ast :: HyperType) :: Type
verifyConstraints ::
TypeConstraintsOf ast ->
ast # h ->
Maybe (ast # WithConstraint h)
data WithConstraint h ast = WithConstraint
{ WithConstraint h ast -> TypeConstraintsOf (GetHyperType ast)
_wcConstraint :: TypeConstraintsOf (GetHyperType ast)
, WithConstraint h ast -> h ast
_wcBody :: h ast
}
makeLenses ''WithConstraint