File: DotTest.hs

package info (click to toggle)
haskell-dotgen 0.4.3-4
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 76 kB
  • sloc: haskell: 203; makefile: 5
file content (100 lines) | stat: -rw-r--r-- 2,436 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
module Main (main) where

import Text.Dot

-- data Animation = Start

src, box, diamond :: String -> Dot NodeId
src     label = node $ [ ("shape","none"),("label",label) ]
box     label = node $ [ ("shape","box"),("style","rounded"),("label",label) ]
diamond label = node $ [("shape","diamond"),("label",label),("fontsize","10")]

main :: IO ()
main = putStrLn $ showDot $ do
        attribute ("size","40,15")
        attribute ("rankdir","LR")
        refSpec <- src "S"
        tarSpec <- src "T"
        same [refSpec,tarSpec]

        c1 <- box "S"
        c2 <- box "C"
        c3 <- box "F"
        same [c1,c2,c3]

        refSpec .->. c1
        tarSpec .->. c2
        tarSpec .->. c3

        m1 <- box "x"
        m2 <- box "y"
        ntm <- box "z"

        same [m1,m2,ntm] 
        c1 .->. m1
        c2 .->. m2

        xilinxSynthesis <- box "x"
        c3 .->. xilinxSynthesis

        gns <- box "G"
        xilinxSynthesis .->. gns

        gns .->. ntm

        ecs <- sequence
                [ diamond "E"
                , diamond "E"
                , diamond "Eq"
                ]
        same ecs

        m1 .->. (ecs !! 0)
        m1 .->. (ecs !! 1)
        m2 .->. (ecs !! 0)
        m2 .->. (ecs !! 2)
        ntm .->. (ecs !! 1)
        ntm .->. (ecs !! 2)

        _ <- sequence [ do evidence <- src "EE"
                           n .->. evidence
                      | n <- ecs 
                      ]


        edge refSpec tarSpec [("label","Engineering\nEffort"),("style","dotted")]

        () <- scope $ do v1 <- box "Hello"
                         v2 <- box "World"
                         v1 .->. v2

        (x,()) <- cluster $
                do v1 <- box "Hello"
                   v2 <- box "World"
                   v1 .->. v2
        
--      x .->. m2
        -- for hpc
        () <- same [x,x]
        v <- box "XYZ"
        v .->. v
        () <- attribute ("rankdir","LR")

        let n1 = userNodeId 1
        let n2 = userNodeId (-1)

        () <- n1 `userNode` [ ("shape","box")]
        n1 .->. n2
        
        _ <- box "XYZ"

        _ <- box "(\n\\n)\"(/\\)"

        netlistGraph (\ a -> [("label","X" ++ show a)])
                     (\ a -> [succ a `mod` 10,pred a `mod` 10])
                     [ (n,n) | n <- [0..9] :: [Int] ]
                     
        _ <- box "touché"
        _ <- box "eight characters: кирилица"
        
        return ()