diff --git a/src/Grace/Infer.hs b/src/Grace/Infer.hs index df9445a..5db239d 100644 --- a/src/Grace/Infer.hs +++ b/src/Grace/Infer.hs @@ -313,6 +313,16 @@ subtype _A0 _B0 = do -- except with the arguments flipped. Similarly, the <:∃L rule is -- basically the same as the <:∀R rule with the arguments flipped. + -- <:∃L + (Type.Exists{..}, _) -> do + scoped (Context.Variable domain name) do + subtype type_ _B0 + + -- <:∀R + (_, Type.Forall{..}) -> do + scoped (Context.Variable domain name) do + subtype _A0 type_ + -- <:∃R (_, Type.Exists{ domain = Domain.Type, .. }) -> do scopedUnsolvedType nameLocation \a -> @@ -339,16 +349,6 @@ subtype _A0 _B0 = do scopedUnsolvedAlternatives \a -> do subtype (Type.substituteAlternatives name 0 a type_) _B0 - -- <:∃L - (Type.Exists{..}, _) -> do - scoped (Context.Variable domain name) do - subtype type_ _B0 - - -- <:∀R - (_, Type.Forall{..}) -> do - scoped (Context.Variable domain name) do - subtype _A0 type_ - (Type.Scalar{ scalar = s0 }, Type.Scalar{ scalar = s1 }) | s0 == s1 -> do return () diff --git a/tasty/data/complex/preserve-inner-exists-input.ffg b/tasty/data/complex/preserve-inner-exists-input.ffg new file mode 100644 index 0000000..fa0d306 --- /dev/null +++ b/tasty/data/complex/preserve-inner-exists-input.ffg @@ -0,0 +1,4 @@ +let wrappedVal + : { wrapped : exists (a : Type). a } + = { wrapped : 0 } +in wrappedVal : { wrapped: exists (a : Type). a } diff --git a/tasty/data/complex/preserve-inner-exists-output.ffg b/tasty/data/complex/preserve-inner-exists-output.ffg new file mode 100644 index 0000000..4ee0269 --- /dev/null +++ b/tasty/data/complex/preserve-inner-exists-output.ffg @@ -0,0 +1 @@ +{ "wrapped": 0 } diff --git a/tasty/data/complex/preserve-inner-exists-type.ffg b/tasty/data/complex/preserve-inner-exists-type.ffg new file mode 100644 index 0000000..886060b --- /dev/null +++ b/tasty/data/complex/preserve-inner-exists-type.ffg @@ -0,0 +1 @@ +{ wrapped: exists (a : Type) . a } diff --git a/tasty/data/complex/preserve-inner-forall-input.ffg b/tasty/data/complex/preserve-inner-forall-input.ffg new file mode 100644 index 0000000..1d94cd9 --- /dev/null +++ b/tasty/data/complex/preserve-inner-forall-input.ffg @@ -0,0 +1,4 @@ +let wrappedId + : { wrapped : forall (a : Type). a -> a } + = { wrapped : \x -> x } +in wrappedId : { wrapped: forall (a : Type). a -> a } diff --git a/tasty/data/complex/preserve-inner-forall-output.ffg b/tasty/data/complex/preserve-inner-forall-output.ffg new file mode 100644 index 0000000..0719988 --- /dev/null +++ b/tasty/data/complex/preserve-inner-forall-output.ffg @@ -0,0 +1 @@ +{ "wrapped": \x -> x } diff --git a/tasty/data/complex/preserve-inner-forall-type.ffg b/tasty/data/complex/preserve-inner-forall-type.ffg new file mode 100644 index 0000000..3289e9c --- /dev/null +++ b/tasty/data/complex/preserve-inner-forall-type.ffg @@ -0,0 +1 @@ +{ wrapped: forall (a : Type) . a -> a }