module Unison.Merge.Mergeblob5 ( Mergeblob5 (..), makeMergeblob5, ) where import Data.Map.Strict qualified as Map import Unison.FileParsers qualified as FileParsers import Unison.Merge.Mergeblob4 (Mergeblob4 (..)) import Unison.Parser.Ann (Ann) import Unison.Prelude import Unison.Result qualified as Result import Unison.Symbol (Symbol) import Unison.Typechecker qualified as Typechecker import Unison.Typechecker.TypeLookup (TypeLookup) import Unison.UnisonFile (TypecheckedUnisonFile) data Mergeblob5 = Mergeblob5 { Mergeblob5 -> TypecheckedUnisonFile Symbol Ann file :: TypecheckedUnisonFile Symbol Ann } makeMergeblob5 :: Mergeblob4 -> TypeLookup Symbol Ann -> Either (Seq (Result.Note Symbol Ann)) Mergeblob5 makeMergeblob5 :: Mergeblob4 -> TypeLookup Symbol Ann -> Either (Seq (Note Symbol Ann)) Mergeblob5 makeMergeblob5 Mergeblob4 blob TypeLookup Symbol Ann typeLookup = let typecheckingEnv :: Env Symbol Ann typecheckingEnv = Typechecker.Env { $sel:ambientAbilities:Env :: [Type Symbol Ann] ambientAbilities = [], $sel:termsByShortname:Env :: Map Name [Either Name (NamedReference Symbol Ann)] termsByShortname = Map Name [Either Name (NamedReference Symbol Ann)] forall k a. Map k a Map.empty, TypeLookup Symbol Ann typeLookup :: TypeLookup Symbol Ann $sel:typeLookup:Env :: TypeLookup Symbol Ann typeLookup, $sel:topLevelComponents:Env :: Map Name (NamedReference Symbol Ann) topLevelComponents = Map Name (NamedReference Symbol Ann) forall k a. Map k a Map.empty } in case Identity (Maybe (TypecheckedUnisonFile Symbol Ann), Seq (Note Symbol Ann)) -> (Maybe (TypecheckedUnisonFile Symbol Ann), Seq (Note Symbol Ann)) forall a. Identity a -> a runIdentity (ResultT (Seq (Note Symbol Ann)) Identity (TypecheckedUnisonFile Symbol Ann) -> Identity (Maybe (TypecheckedUnisonFile Symbol Ann), Seq (Note Symbol Ann)) forall notes (f :: * -> *) a. ResultT notes f a -> f (Maybe a, notes) Result.runResultT (Env Symbol Ann -> UnisonFile Symbol -> ResultT (Seq (Note Symbol Ann)) Identity (TypecheckedUnisonFile Symbol Ann) forall (m :: * -> *) v. (Monad m, Var v) => Env v Ann -> UnisonFile v -> ResultT (Seq (Note v Ann)) m (TypecheckedUnisonFile v Ann) FileParsers.synthesizeFile Env Symbol Ann typecheckingEnv Mergeblob4 blob.file)) of (Maybe (TypecheckedUnisonFile Symbol Ann) Nothing, Seq (Note Symbol Ann) notes) -> Seq (Note Symbol Ann) -> Either (Seq (Note Symbol Ann)) Mergeblob5 forall a b. a -> Either a b Left Seq (Note Symbol Ann) notes (Just TypecheckedUnisonFile Symbol Ann file, Seq (Note Symbol Ann) _) -> Mergeblob5 -> Either (Seq (Note Symbol Ann)) Mergeblob5 forall a b. b -> Either a b Right Mergeblob5 {TypecheckedUnisonFile Symbol Ann $sel:file:Mergeblob5 :: TypecheckedUnisonFile Symbol Ann file :: TypecheckedUnisonFile Symbol Ann file}