1
1
mirror of https://github.com/github/semantic.git synced 2024-11-23 16:37:50 +03:00

Correct ordering.

This commit is contained in:
Rob Rix 2022-02-01 14:33:43 -05:00
parent 0b5562c0fa
commit a88972cf32
No known key found for this signature in database
GPG Key ID: 2BE643E01DC032AE

View File

@ -41,7 +41,6 @@ import qualified Data.Aeson.Internal as A
import qualified Data.Aeson.Parser as A
import qualified Data.Aeson.Types as A
import qualified Data.ByteString.Lazy as B
import Data.Foldable (foldl')
import Data.Function (fix)
import qualified Data.IntMap as IntMap
import Data.Text (Text, pack, unpack)
@ -161,7 +160,7 @@ parseNode o = do
"false" -> pure (const (bool False))
"throw" -> fmap throw <$> resolve (head edges)
"if" -> liftA3 iff <$> findEdge (edgeNamed "condition") <*> findEdge (edgeNamed "consequence") <*> findEdge (edgeNamed "alternative") <|> pure (const noop)
"block" -> fmap (foldl' (\ r (i, v) -> let_ (nameI i) v (const r)) noop . zip [0..]) . sequenceA <$> traverse resolve edges
"block" -> fmap (foldr (\ (i, v) r -> let_ (nameI i) v (const r)) noop . zip [0..]) . sequenceA <$> traverse resolve edges
t -> A.parseFail ("unrecognized type: " <> t)
edge :: (IntMap.Key -> A.Object -> A.Parser a) -> A.Value -> A.Parser a
edge f = A.withObject "edge" (\ edge -> do