Skip to content

Commit

Permalink
fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Jul 3, 2024
1 parent bfd9e15 commit 19ad4e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/Juvix/Compiler/Concrete/Language.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ type family FieldArgIxType s = res | res -> s where
FieldArgIxType 'Parsed = ()
FieldArgIxType 'Scoped = Int

type SideIfBranchConditionType :: Stage -> IfBranchKind -> GHC.Type
type SideIfBranchConditionType :: Stage -> IfBranchKind -> GHCType
type family SideIfBranchConditionType s k = res where
SideIfBranchConditionType s 'BranchIfBool = ExpressionType s
SideIfBranchConditionType _ 'BranchIfElse = ()

type IfBranchConditionType :: Stage -> IfBranchKind -> GHC.Type
type IfBranchConditionType :: Stage -> IfBranchKind -> GHCType
type family IfBranchConditionType s k = res where
IfBranchConditionType s 'BranchIfBool = ExpressionType s
IfBranchConditionType _ 'BranchIfElse = Irrelevant KeywordRef
Expand Down
32 changes: 10 additions & 22 deletions src/Juvix/Compiler/Internal/Extra/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,41 +104,29 @@ instance HasExpressions Pattern where
PatternConstructorApp a -> PatternConstructorApp <$> directExpressions f a
PatternWildcardConstructor {} -> pure p

leafExpressions f p = case p of
PatternVariable {} -> pure p
PatternConstructorApp a -> PatternConstructorApp <$> leafExpressions f a
PatternWildcardConstructor {} -> pure p

instance HasExpressions SideIfBranch where
leafExpressions f b = do
_sideIfBranchCondition <- leafExpressions f (b ^. sideIfBranchCondition)
_sideIfBranchBody <- leafExpressions f (b ^. sideIfBranchBody)
directExpressions f b = do
_sideIfBranchCondition <- directExpressions f (b ^. sideIfBranchCondition)
_sideIfBranchBody <- directExpressions f (b ^. sideIfBranchBody)
pure SideIfBranch {..}

instance HasExpressions SideIfs where
leafExpressions f b = do
_sideIfBranches <- traverse (leafExpressions f) (b ^. sideIfBranches)
_sideIfElse <- traverse (leafExpressions f) (b ^. sideIfElse)
directExpressions f b = do
_sideIfBranches <- directExpressions f (b ^. sideIfBranches)
_sideIfElse <- directExpressions f (b ^. sideIfElse)
pure SideIfs {..}

instance HasExpressions CaseBranchRhs where
leafExpressions f = \case
CaseBranchRhsExpression e -> CaseBranchRhsExpression <$> leafExpressions f e
CaseBranchRhsIf e -> CaseBranchRhsIf <$> leafExpressions f e
directExpressions f = \case
CaseBranchRhsExpression e -> CaseBranchRhsExpression <$> directExpressions f e
CaseBranchRhsIf e -> CaseBranchRhsIf <$> directExpressions f e

instance HasExpressions CaseBranch where
directExpressions f b = do
_caseBranchPattern <- directExpressions f (b ^. caseBranchPattern)
_caseBranchExpression <- directExpressions f (b ^. caseBranchExpression)
pure CaseBranch {..}

leafExpressions f b = do
_caseBranchPattern <- leafExpressions f (b ^. caseBranchPattern)
_caseBranchRhs <- leafExpressions f (b ^. caseBranchRhs)
_caseBranchRhs <- directExpressions f (b ^. caseBranchRhs)
pure CaseBranch {..}

instance RecHasExpressions Case

instance HasExpressions Case where
directExpressions f l = do
_caseBranches <- directExpressions f (l ^. caseBranches)
Expand Down

0 comments on commit 19ad4e9

Please sign in to comment.