Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
description = "fusion-plugin";

inputs = {
basepkgs.url = "git+ssh://[email protected]/composewell/streamly-packages?rev=5c3c31fa35f9f75a52e2fd68f7d1d47f7622ce33";
nixpkgs.follows = "basepkgs/nixpkgs";
nixpkgs-darwin.follows = "basepkgs/nixpkgs-darwin";
};

outputs = { self, nixpkgs, nixpkgs-darwin, basepkgs }:
basepkgs.nixpack.mkOutputs {
inherit nixpkgs nixpkgs-darwin basepkgs;
name = "fusion-plugin";
sources = basepkgs.nixpack.lib.localSource "fusion-plugin" ./.;
packages = basepkgs.nixpack.lib.devPackage "fusion-plugin";
};
}
25 changes: 15 additions & 10 deletions src/Fusion/Plugin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,10 @@ letBndrsThatAreCases dflags anns bind = goLet [] bind
-- annotated with "Fuse" and traverse the Alt expressions to discover more
-- let bindings.
go parents True (Case _ _ _ alts) =
let binders = alts >>= (\(ALT_CONSTR(_,_,expr1)) -> go parents False expr1)
let result = alts >>= (\(ALT_CONSTR(_,_,expr1)) -> go parents False expr1)
in case needInlineCaseAlt dflags parents anns alts of
Just x -> (parents, x) : binders
Nothing -> binders
Just x -> (parents, x) : result
Nothing -> result

-- Only traverse the Alt expressions of the case to discover new let
-- bindings. Do not match for annotated constructors in the Alts.
Expand Down Expand Up @@ -755,13 +755,18 @@ fusionSimplify _hsc_env dflags =

fusionReport :: String -> ReportMode -> ModGuts -> CoreM ModGuts
fusionReport mesg reportMode guts = do
putMsgS $ "fusion-plugin: " ++ mesg ++ "..."
dflags <- getDynFlags
anns <- FMAP_SND getAnnotations deserializeWithData guts
when (anyUFM (any (== Fuse)) anns) $
mapM_ (transformBind dflags anns) $ mg_binds guts
return guts
where
case reportMode of
ReportSilent -> return guts
_ -> do
putMsgS $ "fusion-plugin: " ++ mesg ++ "..."
dflags <- getDynFlags
anns <- FMAP_SND getAnnotations deserializeWithData guts
when (anyUFM (any (== Fuse)) anns) $
mapM_ (transformBind dflags anns) $ mg_binds guts
return guts

where

transformBind :: DynFlags -> UNIQ_FM -> CoreBind -> CoreM ()
transformBind dflags anns bind@(NonRec b _) = do
let results = containsAnns dflags anns bind
Expand Down
Loading