Skip to content

Commit 5e0e70e

Browse files
committed
Expose builtin term type references
1 parent c057a76 commit 5e0e70e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

parser-typechecker/src/Unison/Builtin.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module Unison.Builtin
1616
typeOf,
1717
typeLookup,
1818
termRefTypes,
19+
termRefTypeReferences,
1920
)
2021
where
2122

@@ -320,14 +321,17 @@ termNameRefs = Map.mapKeys Name.unsafeParseText $ foldl' go mempty (stripVersion
320321
"tried to alias `" <> r <> "` before it was declared."
321322
Just t -> Map.insert name t m
322323

323-
termRefTypes :: Map R.Reference Type
324+
termRefTypes :: Map R.TermReference Type
324325
termRefTypes = foldl' go mempty builtinsSrc
325326
where
326327
go m = \case
327328
B r t -> Map.insert (R.Builtin r) t m
328329
D r t -> Map.insert (R.Builtin r) t m
329330
_ -> m
330331

332+
termRefTypeReferences :: Map R.TermReference R.TypeReference
333+
termRefTypeReferences = H.typeToReference <$> termRefTypes
334+
331335
typeOf :: a -> (Type -> a) -> R.Reference -> a
332336
typeOf a f r = maybe a f (Map.lookup r termRefTypes)
333337

0 commit comments

Comments
 (0)