Skip to content

Commit

Permalink
make ormolu happy
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Dec 8, 2022
1 parent a3f3810 commit f7c397b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Juvix/Compiler/Core/Transformation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import Juvix.Compiler.Core.Transformation.Base
import Juvix.Compiler.Core.Transformation.Eta
import Juvix.Compiler.Core.Transformation.Identity
import Juvix.Compiler.Core.Transformation.LambdaLifting
import Juvix.Compiler.Core.Transformation.MoveApps
import Juvix.Compiler.Core.Transformation.RemoveTypeArgs
import Juvix.Compiler.Core.Transformation.TopEtaExpand
import Juvix.Compiler.Core.Transformation.MoveApps

applyTransformations :: [TransformationId] -> InfoTable -> InfoTable
applyTransformations ts tbl = foldl' (flip appTrans) tbl ts
Expand Down
32 changes: 17 additions & 15 deletions src/Juvix/Compiler/Core/Transformation/MoveApps.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@ convertNode = dmap go
go node = case node of
NApp {} ->
let (tgt, args) = unfoldApps node
in
case tgt of
NLet lt@(Let {..}) ->
NLet lt{_letBody = mkApps _letBody (map (second (shift 1)) args)}
NCase cs@(Case {..}) ->
NCase cs{
_caseBranches =
map (\br@CaseBranch{..} ->
br{
_caseBranchBody = mkApps _caseBranchBody (map (second (shift _caseBranchBindersNum)) args)
})
_caseBranches,
_caseDefault = fmap (`mkApps` args) _caseDefault
}
_ -> node
in case tgt of
NLet lt@(Let {..}) ->
NLet lt {_letBody = mkApps _letBody (map (second (shift 1)) args)}
NCase cs@(Case {..}) ->
NCase
cs
{ _caseBranches =
map
( \br@CaseBranch {..} ->
br
{ _caseBranchBody = mkApps _caseBranchBody (map (second (shift _caseBranchBindersNum)) args)
}
)
_caseBranches,
_caseDefault = fmap (`mkApps` args) _caseDefault
}
_ -> node
_ -> node

moveApps :: InfoTable -> InfoTable
Expand Down

0 comments on commit f7c397b

Please sign in to comment.