1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-06 06:53:33 +03:00

[concrete] optional universe level in parser and pretty printer

This commit is contained in:
Jan Mas Rovira 2022-01-21 18:01:48 +01:00
parent 4155898883
commit 4d77d8f696
3 changed files with 7 additions and 6 deletions

View File

@ -624,7 +624,9 @@ deriving stock instance
-- Universe expression
--------------------------------------------------------------------------------
newtype Universe = Universe Natural
newtype Universe = Universe {
universeLevel :: Maybe Natural
}
deriving stock (Show, Eq, Ord, Lift)
--------------------------------------------------------------------------------

View File

@ -181,11 +181,10 @@ letBlock = do
-- Universe expression
--------------------------------------------------------------------------------
defaultUniverse :: Universe
defaultUniverse = Universe 0
universe :: MonadParsec e Text m => m Universe
universe = defaultUniverse <$ kwType
universe = do
kwType
Universe <$> optional decimal
-------------------------------------------------------------------------------
-- Type signature declaration

View File

@ -309,7 +309,7 @@ ppFunction Function {..} = do
return $ parens (paramName' <+> ppUsage paramUsage <+> paramType')
ppUniverse :: Members '[Reader Options] r => Universe -> Sem r (Doc Ann)
ppUniverse (Universe n) = return $ kwType <+> pretty n
ppUniverse (Universe n) = return $ kwType <+?> (pretty <$> n)
ppLetBlock :: forall r. Members '[Reader Options] r => LetBlock 'Scoped -> Sem r (Doc Ann)
ppLetBlock LetBlock {..} = do