Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ollef committed Mar 20, 2024
1 parent 8f76405 commit b3b8414
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/Core/Evaluation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Plicity
import Protolude hiding (IntMap, Seq, evaluate, force, head, try)
import Query (Query)
import qualified Query
import qualified Query.Mapped as Mapped
import Rock
import Telescope (Telescope)
import qualified Telescope
Expand Down Expand Up @@ -69,8 +70,12 @@ evaluate env term =
result <- try $ fetch $ Query.ElaboratedDefinition name
case result of
Right (Syntax.ConstantDefinition term', _) -> do
recursive <- fetch $ Query.TransitiveDependencies name $ Mapped.Query name
value <- lazyEvaluate Environment.empty term'
pure $ Domain.Stuck (Domain.Global name) mempty value mempty
pure
if isJust recursive
then Domain.Stuck (Domain.Global name) mempty value mempty
else Domain.Glued (Domain.Global name) mempty value
Left (Cyclic (_ :: Some Query)) ->
pure $ Domain.global name
_ ->
Expand Down
8 changes: 7 additions & 1 deletion src/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

module Rules where
Expand All @@ -31,6 +32,7 @@ import Data.HashSet (HashSet)
import qualified Data.HashSet as HashSet
import qualified Data.OrderedHashMap as OrderedHashMap
import qualified Data.OrderedHashSet as OrderedHashSet
import Data.Some (Some)
import qualified Data.Text as Text
import qualified Data.Text.Unsafe as Text
import Data.Text.Utf16.Rope (Rope)
Expand Down Expand Up @@ -336,7 +338,11 @@ rules sourceDirectories files readFile_ (Writer (Writer query)) =
go (dep : todo) done
| dep `HashSet.member` done = go todo done
| otherwise = do
depDeps <- fetch $ TransitiveDependencies dep Mapped.Map
transitiveDeps <- try $ fetch $ TransitiveDependencies dep Mapped.Map
depDeps <- case transitiveDeps of
Left (Cyclic (_ :: Some Query)) -> fetch $ Dependencies dep Mapped.Map
Right depDeps -> pure depDeps

go todo $ HashSet.insert dep done <> HashSet.fromMap depDeps
deps <- fetch $ Dependencies qualifiedName Mapped.Map
HashSet.toMap
Expand Down

0 comments on commit b3b8414

Please sign in to comment.