Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use indexed-traversable for type-checking list literals #2423

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dhall/dhall.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ Common common
half >= 0.2.2.3 && < 0.4 ,
haskeline >= 0.7.2.1 && < 0.9 ,
hashable >= 1.2 && < 1.5 ,
indexed-traversable < 0.2 ,
lens-family-core >= 1.0.0 && < 2.2 ,
-- megaparsec follows SemVer: https://github.com/mrkkrp/megaparsec/issues/469#issuecomment-927918469
megaparsec >= 8 && < 10 ,
Expand Down
8 changes: 3 additions & 5 deletions dhall/src/Dhall/TypeCheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import Control.Monad.Trans.Writer.Strict (execWriterT, tell)
import Data.List.NonEmpty (NonEmpty (..))
import Data.Monoid (Endo (..))
import Data.Semigroup (Max (..))
import Data.Sequence (Seq, ViewL (..))
import Data.Sequence (ViewL (..))
import Data.Set (Set)
import Data.Text (Text)
import Data.Typeable (Typeable)
Expand Down Expand Up @@ -65,6 +65,7 @@ import Dhall.Syntax
)

import qualified Data.Foldable as Foldable
import qualified Data.Foldable.WithIndex as Foldable.WithIndex
import qualified Data.List.NonEmpty as NonEmpty
import qualified Data.Map
import qualified Data.Sequence
Expand Down Expand Up @@ -93,9 +94,6 @@ import qualified Prettyprinter.Render.String as Pretty
type X = Void
{-# DEPRECATED X "Use Data.Void.Void instead" #-}

traverseWithIndex_ :: Applicative f => (Int -> a -> f b) -> Seq a -> f ()
traverseWithIndex_ k xs = Foldable.sequenceA_ (Data.Sequence.mapWithIndex k xs)

axiom :: Const -> Either (TypeError s a) Const
axiom Type = return Kind
axiom Kind = return Sort
Expand Down Expand Up @@ -631,7 +629,7 @@ infer typer = loop

Left (TypeError context t₁ err)

traverseWithIndex_ process ts₁
Foldable.WithIndex.itraverse_ process ts₁

return (VList _T₀')

Expand Down