DescriptionUnderstanding arrows mean1 data flow.svg
English: Data flow in the mean1 example of b:en:Haskell/Arrow tutorial. Rectangles are arrows (rounded rectangles are arrows made with arr) and circles are other data flow split/merge points.
Haskell source code being represented:
Haskell/diagrams source code for generating the image:
{-# LANGUAGE NoMonomorphismRestriction #-}importDiagrams.PreludeimportDiagrams.Backend.Cairo.CmdLinemain=mainWith$pad1.05.centerXY$connDiagbaseDiag=hsep0.5.fmapcenterY$[anAmper#named"amp",anArrow"total"#named"sum"#centerX===strutY1===(aFunction"const 1"#named"one"|||strutX1|||anArrow"total"#named"count")#named"path2"#centerX,aFunction"/"#named"divide"]connDiag=baseDiag#connectPerim'baseConnOpts"amp""sum"(1/8@@turn)(1/2@@turn)#connectPerim'baseConnOpts"amp""one"(7/8@@turn)(1/2@@turn)#connectPerim'baseConnOpts"one""count"(0@@turn)(1/2@@turn)#connectPerim'baseConnOpts"sum""divide"(0@@turn)(3/8@@turn)#connectPerim'baseConnOpts"count""divide"(0@@turn)(5/8@@turn)wherebaseConnOpts=with&lengths.~large&shaftStyle%~lcbaseColour.lwveryThick&headStyle%~fc(darken0.2baseColour)aFunction::String->DiagramBaFunctions=roundedRect1.61.20.4#applyStyleinitStyle<>nudgedTexts#fcbaseColouranArrow::String->DiagramBanArrows=rect1.61.2#applyStyleinitStyle<>nudgedTextsanAmper::DiagramBanAmper=circle0.5#applyStyleinitStyle<>nudgedText"&&&"initStyle::StyleV2DoubleinitStyle=mempty#lcbaseColour#lwL0.1baseColour=mediumorchidnudgedText::String->DiagramBnudgedTexts=alignedText0.50.5s#font"monospace"#fontSize(local0.25)#bold#fcbaseColour
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
to share – to copy, distribute and transmit the work
to remix – to adapt the work
Under the following conditions:
attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.