1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 05:42:26 +03:00

lookupInfo naming convention

This commit is contained in:
Jan Mas Rovira 2024-11-21 17:32:49 +01:00
parent 99af0ac732
commit 87aebc9226

View File

@ -153,19 +153,17 @@ anameFromScopedIden s =
_anameVerbatim = s ^. scopedIdenSrcName . nameVerbatim
}
getInfo :: (Members '[InfoTableBuilder, Reader InfoTable] r) => (InfoTable -> Maybe a) -> Sem r a
getInfo f = do
tab1 <- ask
fromMaybe (fromJust (f tab1)) . f <$> getBuilderInfoTable
lookupInfo :: (Members '[InfoTableBuilder, Reader InfoTable] r) => (InfoTable -> Maybe a) -> Sem r a
lookupInfo f = fromJust <$> lookupInfo' f
lookupInfo :: (Members '[InfoTableBuilder, Reader InfoTable] r) => (InfoTable -> Maybe a) -> Sem r (Maybe a)
lookupInfo f = do
lookupInfo' :: (Members '[InfoTableBuilder, Reader InfoTable] r) => (InfoTable -> Maybe a) -> Sem r (Maybe a)
lookupInfo' f = do
tab1 <- ask
tab2 <- getBuilderInfoTable
return (f tab1 <|> f tab2)
lookupFixity :: (Members '[InfoTableBuilder, Reader InfoTable] r) => S.NameId -> Sem r FixityDef
lookupFixity uid = getInfo (^. infoFixities . at uid)
lookupFixity uid = lookupInfo (^. infoFixities . at uid)
getPrecedenceGraph :: (Members '[InfoTableBuilder, Reader InfoTable] r) => Sem r PrecedenceGraph
getPrecedenceGraph = do