Skip to content

Commit

Permalink
fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
bristermitten committed Aug 17, 2023
1 parent f12ad51 commit f2543c7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Elara/TypeInfer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions src/Elara/TypeInfer/Infer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ wellFormedType ::
Context SourceRegion ->
Type SourceRegion ->
Sem r ()
wellFormedType _Γ type0 =do
wellFormedType _Γ type0 = do
case type0 of
-- UvarWF
Type.VariableType{..}
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Elara/TypeInfer/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -635,7 +636,6 @@ prettyPrimitiveType Tuple{..} =
<> Pretty.hardline
<> punctuation ")"
)

prettyPrimitiveType other =
Pretty.group (Pretty.flatAlt long short)
where
Expand Down
3 changes: 0 additions & 3 deletions test/Infer/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f2543c7

Please sign in to comment.