You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The proc notation introduced by the Arrows language extension desugars in a very inefficient way, adding many irrelevant steps to the computation graph. A simple example, here a is the proc version and b is the point-free variant
{-# LANGUAGE Arrows, OverloadedStrings #-}
importControl.FunflowimportControl.Funflow.PrettyimportPathimportData.Defaulta::SimpleFlow (PathaDir) (String)
a =proc d ->do
stepIO' (def {name =Just"reading file"}) (readFile. toFilePath) -< d
b::SimpleFlow (PathaDir) (String)
b = stepIO' (def {name =Just"reading file"}) (readFile. toFilePath)
print$ ppFlow a
print$ ppFlow b
Which outputs
-- a
(unlabeled step >>> (unlabeled step >>> (unlabeled step >>> (unlabeled step >>> reading file))))
-- b
reading file
There is a library arrowp-qq that provides a quasiquoter version of the proc notation that does a better job of desugaring
{-# LANGUAGE TemplateHaskell, QuasiQuotes #-}
importControl.Arrow.QuasiQuoterc::SimpleFlow (PathaDir) (String)
c = [proc| d -> do
stepIO' (def {name = Just "reading file"}) (readFile . toFilePath) -< d
|]
print$ ppFlow c
(unlabeled step >>> reading file)
unfortunately the package hasn't been actively developed recently, so I had to modify it slightly to get it work.
For rendering workflows as graphs, using something like the quasiquoter proc notation may be useful for generating human readable graphs.
The text was updated successfully, but these errors were encountered:
I'm actually not sure if this issue is addressed now that we are using kernmantle's Rope to represent flows in funflow2, and it is worth investigating.
The
proc
notation introduced by theArrows
language extension desugars in a very inefficient way, adding many irrelevant steps to the computation graph. A simple example, here a is theproc
version and b is the point-free variantWhich outputs
There is a library arrowp-qq that provides a quasiquoter version of the proc notation that does a better job of desugaring
unfortunately the package hasn't been actively developed recently, so I had to modify it slightly to get it work.
For rendering workflows as graphs, using something like the quasiquoter
proc
notation may be useful for generating human readable graphs.The text was updated successfully, but these errors were encountered: