module Unison.Builtin.Terms ( builtinTermsRef, builtinTermsSrc, ) where import Data.Map (Map) import Data.Map qualified as Map import Data.Text (Text) import Unison.Builtin.Decls qualified as Decls import Unison.ConstructorReference (GConstructorReference (..)) import Unison.Hashing.V2.Convert qualified as H import Unison.Reference qualified as Reference import Unison.Symbol (Symbol) import Unison.Term (Term) import Unison.Term qualified as Term import Unison.Type (Type) import Unison.Type qualified as Type import Unison.Var (Var) import Unison.Var qualified as Var builtinTermsSrc :: a -> [(Symbol, a, Term Symbol a, Type Symbol a)] builtinTermsSrc :: forall a. a -> [(Symbol, a, Term Symbol a, Type Symbol a)] builtinTermsSrc a ann = [ ( Text -> Symbol forall v. Var v => Text -> v v Text "metadata.isPropagated", a ann, a -> ConstructorReference -> Term Symbol a forall v a vt at ap. Ord v => a -> ConstructorReference -> Term2 vt at ap v a Term.constructor a ann (TypeReference -> ConstructorId -> ConstructorReference forall r. r -> ConstructorId -> GConstructorReference r ConstructorReference TypeReference Decls.isPropagatedRef ConstructorId Decls.isPropagatedConstructorId), a -> TypeReference -> Type Symbol a forall v a. Ord v => a -> TypeReference -> Type v a Type.ref a ann TypeReference Decls.isPropagatedRef ), ( Text -> Symbol forall v. Var v => Text -> v v Text "metadata.isTest", a ann, a -> ConstructorReference -> Term Symbol a forall v a vt at ap. Ord v => a -> ConstructorReference -> Term2 vt at ap v a Term.constructor a ann (TypeReference -> ConstructorId -> ConstructorReference forall r. r -> ConstructorId -> GConstructorReference r ConstructorReference TypeReference Decls.isTestRef ConstructorId Decls.isTestConstructorId), a -> TypeReference -> Type Symbol a forall v a. Ord v => a -> TypeReference -> Type v a Type.ref a ann TypeReference Decls.isTestRef ) ] v :: (Var v) => Text -> v v :: forall v. Var v => Text -> v v = Text -> v forall v. Var v => Text -> v Var.named builtinTermsRef :: Map Symbol Reference.Id builtinTermsRef :: Map Symbol Id builtinTermsRef = ((Id, Term Symbol (), Type Symbol (), ()) -> Id) -> Map Symbol (Id, Term Symbol (), Type Symbol (), ()) -> Map Symbol Id forall a b. (a -> b) -> Map Symbol a -> Map Symbol b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap (\(Id refId, Term Symbol () _, Type Symbol () _, () _) -> Id refId) (Map Symbol (Id, Term Symbol (), Type Symbol (), ()) -> Map Symbol Id) -> ([(Symbol, (), Term Symbol (), Type Symbol ())] -> Map Symbol (Id, Term Symbol (), Type Symbol (), ())) -> [(Symbol, (), Term Symbol (), Type Symbol ())] -> Map Symbol Id forall b c a. (b -> c) -> (a -> b) -> a -> c . Map Symbol (Term Symbol (), Type Symbol (), ()) -> Map Symbol (Id, Term Symbol (), Type Symbol (), ()) forall v a extra. Var v => Map v (Term v a, Type v a, extra) -> Map v (Id, Term v a, Type v a, extra) H.hashTermComponents (Map Symbol (Term Symbol (), Type Symbol (), ()) -> Map Symbol (Id, Term Symbol (), Type Symbol (), ())) -> ([(Symbol, (), Term Symbol (), Type Symbol ())] -> Map Symbol (Term Symbol (), Type Symbol (), ())) -> [(Symbol, (), Term Symbol (), Type Symbol ())] -> Map Symbol (Id, Term Symbol (), Type Symbol (), ()) forall b c a. (b -> c) -> (a -> b) -> a -> c . [(Symbol, (Term Symbol (), Type Symbol (), ()))] -> Map Symbol (Term Symbol (), Type Symbol (), ()) forall k a. Ord k => [(k, a)] -> Map k a Map.fromList ([(Symbol, (Term Symbol (), Type Symbol (), ()))] -> Map Symbol (Term Symbol (), Type Symbol (), ())) -> ([(Symbol, (), Term Symbol (), Type Symbol ())] -> [(Symbol, (Term Symbol (), Type Symbol (), ()))]) -> [(Symbol, (), Term Symbol (), Type Symbol ())] -> Map Symbol (Term Symbol (), Type Symbol (), ()) forall b c a. (b -> c) -> (a -> b) -> a -> c . ((Symbol, (), Term Symbol (), Type Symbol ()) -> (Symbol, (Term Symbol (), Type Symbol (), ()))) -> [(Symbol, (), Term Symbol (), Type Symbol ())] -> [(Symbol, (Term Symbol (), Type Symbol (), ()))] forall a b. (a -> b) -> [a] -> [b] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b fmap (\(Symbol v, () _a, Term Symbol () tm, Type Symbol () tp) -> (Symbol v, (Term Symbol () tm, Type Symbol () tp, ()))) ([(Symbol, (), Term Symbol (), Type Symbol ())] -> Map Symbol Id) -> [(Symbol, (), Term Symbol (), Type Symbol ())] -> Map Symbol Id forall a b. (a -> b) -> a -> b $ () -> [(Symbol, (), Term Symbol (), Type Symbol ())] forall a. a -> [(Symbol, a, Term Symbol a, Type Symbol a)] builtinTermsSrc ()