Skip to content

Commit

Permalink
add exprIsType
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Jan 29, 2025
1 parent 5801acb commit 559c2e7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/Juvix/Compiler/Core/Translation/FromInternal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,24 @@ goMutualBlock (Internal.MutualBlock m) = preMutual m >>= goMutual
isTypDef = \case
Internal.StatementInductive {} -> True
Internal.StatementFunction {} -> False
Internal.StatementAxiom a -> isJust (builtinInductive a)
Internal.StatementAxiom a
| isJust (builtinInductive a) -> True
| exprIsType (a ^. Internal.axiomType) -> True
| otherwise -> False
where
exprIsType :: Internal.Expression -> Bool
exprIsType = \case
Internal.ExpressionUniverse {} -> True
Internal.ExpressionFunction (Internal.Function l r) -> exprIsType (l ^. Internal.paramType) && exprIsType r
Internal.ExpressionIden {} -> False
Internal.ExpressionApplication {} -> False
Internal.ExpressionLiteral {} -> False
Internal.ExpressionHole {} -> False
Internal.ExpressionInstanceHole {} -> False
Internal.ExpressionLet {} -> False
Internal.ExpressionSimpleLambda {} -> False
Internal.ExpressionLambda {} -> False
Internal.ExpressionCase {} -> False

step :: Internal.MutualStatement -> Sem (State PreMutual ': r) ()
step = \case
Expand Down

0 comments on commit 559c2e7

Please sign in to comment.