From f2543c7bd40427ad91488df1dc959d6df58c8774 Mon Sep 17 00:00:00 2001 From: Alexander Wood Date: Thu, 17 Aug 2023 20:35:45 +0100 Subject: [PATCH] fix doctests --- src/Elara/TypeInfer.hs | 2 +- src/Elara/TypeInfer/Infer.hs | 3 +-- src/Elara/TypeInfer/Type.hs | 4 ++-- test/Infer/Common.hs | 3 --- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Elara/TypeInfer.hs b/src/Elara/TypeInfer.hs index 13ecbda8..f386be74 100644 --- a/src/Elara/TypeInfer.hs +++ b/src/Elara/TypeInfer.hs @@ -7,6 +7,7 @@ import Data.Containers.ListUtils (nubOrdOn) import Data.Generics.Product import Data.Generics.Sum import Data.Generics.Wrapped +import Data.List.NonEmpty qualified as NonEmpty import Data.Traversable (for) import Elara.AST.Generic hiding (Type) import Elara.AST.Generic qualified as Generic @@ -39,7 +40,6 @@ import Polysemy hiding (transform) import Polysemy.Error (Error, mapError, throw) import Polysemy.State import Print -import qualified Data.List.NonEmpty as NonEmpty inferModule :: forall r. diff --git a/src/Elara/TypeInfer/Infer.hs b/src/Elara/TypeInfer/Infer.hs index 1a324b7d..daebb806 100644 --- a/src/Elara/TypeInfer/Infer.hs +++ b/src/Elara/TypeInfer/Infer.hs @@ -155,7 +155,7 @@ wellFormedType :: Context SourceRegion -> Type SourceRegion -> Sem r () -wellFormedType _Γ type0 =do +wellFormedType _Γ type0 = do case type0 of -- UvarWF Type.VariableType{..} @@ -1838,7 +1838,6 @@ check expr@(Expr (Located exprLoc _, _)) t = do -- ∀I check' e Type.Forall{..} = scoped (Context.Variable domain name) do check' e type_ - check' (Syntax.Tuple elements) Type.Tuple{tupleArguments} = do let process (element, type_) = do _Γ <- get diff --git a/src/Elara/TypeInfer/Type.hs b/src/Elara/TypeInfer/Type.hs index a866e9e4..259be864 100644 --- a/src/Elara/TypeInfer/Type.hs +++ b/src/Elara/TypeInfer/Type.hs @@ -42,6 +42,7 @@ import Print (showPrettyUnannotated) >>> import qualified Elara.TypeInfer.Monotype as Monotype >>> import Elara.Data.Pretty (pretty) >>> import qualified Elara.TypeInfer.Domain as Domain + >>> import Data.List.NonEmpty as NE -} -- | A potentially polymorphic type @@ -103,7 +104,7 @@ data Type s Custom {location :: s, name :: Text, typeArguments :: [Type s]} | -- | A tuple -- - -- >>> pretty @(Type ()) (Tuple () ["a", "b"]) + -- >>> pretty @(Type ()) (Tuple () ("a" :| ["b"])) -- (a, b) Tuple {location :: s, tupleArguments :: NonEmpty (Type s)} deriving stock (Eq, Functor, Generic, Show, Data) @@ -635,7 +636,6 @@ prettyPrimitiveType Tuple{..} = <> Pretty.hardline <> punctuation ")" ) - prettyPrimitiveType other = Pretty.group (Pretty.flatAlt long short) where diff --git a/test/Infer/Common.hs b/test/Infer/Common.hs index 27073146..cdf0bbbb 100644 --- a/test/Infer/Common.hs +++ b/test/Infer/Common.hs @@ -47,7 +47,6 @@ pattern Function' a b = Function () a b pattern VariableType' :: Text -> Type () pattern VariableType' name = VariableType () name - pattern Tuple' :: NonEmpty (Type ()) -> Type () pattern Tuple' ts = Type.Tuple () ts @@ -101,8 +100,6 @@ diagShouldSucceed (d, x) = do Just x -> pure x Nothing -> error "Expected successful inference" - - typeOf' :: MonadIO m => Text -> m (Type ()) typeOf' msg = do x <- liftIO $ runInferPipeline msg