module Unison.KindInference.Constraint.Context
  ( ConstraintContext (..),
  )
where

import Unison.KindInference.UVar (UVar)
import Unison.Type (Type)

-- | The context in which the constraint was generated. This is useful
-- when generating user-facing error messages.
data ConstraintContext v loc
  = AppAbs !(UVar v loc) !(UVar v loc)
  | AppArg !(UVar v loc) !(UVar v loc) !(UVar v loc)
  | AppArrow loc !(Type v loc) !(Type v loc)
  | Annotation
  | EffectsList
  | ScopeReference
  | TypeAnnotation
  | DeclDefinition
  | Builtin
  | ContextLookup
  deriving stock (Int -> ConstraintContext v loc -> ShowS
[ConstraintContext v loc] -> ShowS
ConstraintContext v loc -> String
(Int -> ConstraintContext v loc -> ShowS)
-> (ConstraintContext v loc -> String)
-> ([ConstraintContext v loc] -> ShowS)
-> Show (ConstraintContext v loc)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall v loc.
(Show v, Show loc) =>
Int -> ConstraintContext v loc -> ShowS
forall v loc.
(Show v, Show loc) =>
[ConstraintContext v loc] -> ShowS
forall v loc.
(Show v, Show loc) =>
ConstraintContext v loc -> String
$cshowsPrec :: forall v loc.
(Show v, Show loc) =>
Int -> ConstraintContext v loc -> ShowS
showsPrec :: Int -> ConstraintContext v loc -> ShowS
$cshow :: forall v loc.
(Show v, Show loc) =>
ConstraintContext v loc -> String
show :: ConstraintContext v loc -> String
$cshowList :: forall v loc.
(Show v, Show loc) =>
[ConstraintContext v loc] -> ShowS
showList :: [ConstraintContext v loc] -> ShowS
Show, ConstraintContext v loc -> ConstraintContext v loc -> Bool
(ConstraintContext v loc -> ConstraintContext v loc -> Bool)
-> (ConstraintContext v loc -> ConstraintContext v loc -> Bool)
-> Eq (ConstraintContext v loc)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall v loc.
(Var v, Eq loc) =>
ConstraintContext v loc -> ConstraintContext v loc -> Bool
$c== :: forall v loc.
(Var v, Eq loc) =>
ConstraintContext v loc -> ConstraintContext v loc -> Bool
== :: ConstraintContext v loc -> ConstraintContext v loc -> Bool
$c/= :: forall v loc.
(Var v, Eq loc) =>
ConstraintContext v loc -> ConstraintContext v loc -> Bool
/= :: ConstraintContext v loc -> ConstraintContext v loc -> Bool
Eq, Eq (ConstraintContext v loc)
Eq (ConstraintContext v loc) =>
(ConstraintContext v loc -> ConstraintContext v loc -> Ordering)
-> (ConstraintContext v loc -> ConstraintContext v loc -> Bool)
-> (ConstraintContext v loc -> ConstraintContext v loc -> Bool)
-> (ConstraintContext v loc -> ConstraintContext v loc -> Bool)
-> (ConstraintContext v loc -> ConstraintContext v loc -> Bool)
-> (ConstraintContext v loc
    -> ConstraintContext v loc -> ConstraintContext v loc)
-> (ConstraintContext v loc
    -> ConstraintContext v loc -> ConstraintContext v loc)
-> Ord (ConstraintContext v loc)
ConstraintContext v loc -> ConstraintContext v loc -> Bool
ConstraintContext v loc -> ConstraintContext v loc -> Ordering
ConstraintContext v loc
-> ConstraintContext v loc -> ConstraintContext v loc
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall v loc. (Var v, Ord loc) => Eq (ConstraintContext v loc)
forall v loc.
(Var v, Ord loc) =>
ConstraintContext v loc -> ConstraintContext v loc -> Bool
forall v loc.
(Var v, Ord loc) =>
ConstraintContext v loc -> ConstraintContext v loc -> Ordering
forall v loc.
(Var v, Ord loc) =>
ConstraintContext v loc
-> ConstraintContext v loc -> ConstraintContext v loc
$ccompare :: forall v loc.
(Var v, Ord loc) =>
ConstraintContext v loc -> ConstraintContext v loc -> Ordering
compare :: ConstraintContext v loc -> ConstraintContext v loc -> Ordering
$c< :: forall v loc.
(Var v, Ord loc) =>
ConstraintContext v loc -> ConstraintContext v loc -> Bool
< :: ConstraintContext v loc -> ConstraintContext v loc -> Bool
$c<= :: forall v loc.
(Var v, Ord loc) =>
ConstraintContext v loc -> ConstraintContext v loc -> Bool
<= :: ConstraintContext v loc -> ConstraintContext v loc -> Bool
$c> :: forall v loc.
(Var v, Ord loc) =>
ConstraintContext v loc -> ConstraintContext v loc -> Bool
> :: ConstraintContext v loc -> ConstraintContext v loc -> Bool
$c>= :: forall v loc.
(Var v, Ord loc) =>
ConstraintContext v loc -> ConstraintContext v loc -> Bool
>= :: ConstraintContext v loc -> ConstraintContext v loc -> Bool
$cmax :: forall v loc.
(Var v, Ord loc) =>
ConstraintContext v loc
-> ConstraintContext v loc -> ConstraintContext v loc
max :: ConstraintContext v loc
-> ConstraintContext v loc -> ConstraintContext v loc
$cmin :: forall v loc.
(Var v, Ord loc) =>
ConstraintContext v loc
-> ConstraintContext v loc -> ConstraintContext v loc
min :: ConstraintContext v loc
-> ConstraintContext v loc -> ConstraintContext v loc
Ord)