tricu

A lazy functional language based on Tree Calculus
Log | Files | Refs | README | LICENSE

formatter_cases.json (5927B)


      1 [
      2   [
      3     "shape",
      4     "shape t = 0\nshape (t t) = 1\nshape _ = 2\n",
      5     "shape t     = 0\nshape (t t) = 1\nshape _     = 2\n"
      6   ],
      7   [
      8     "whole",
      9     "example a{t x y} bar foo = [(x) (y)]\nexample a bar{t x y} foo = [(x) (y)]\nexample a bar foo{t x y} = [(x) (y)]\n",
     10     "example a{t x y} bar        foo        = [(x) (y)]\nexample a        bar{t x y} foo        = [(x) (y)]\nexample a        bar        foo{t x y} = [(x) (y)]\n"
     11   ],
     12   [
     13     "literal",
     14     "f \"a b\" x = x\nf _ (t y) = y\n",
     15     "f \"a b\" x     = x\nf _     (t y) = y\n"
     16   ],
     17   [
     18     "pin",
     19     "f ^C.name = 1\nf _ = 2",
     20     "f ^C.name = 1\nf _       = 2"
     21   ],
     22   [
     23     "comments",
     24     "f (t x) = x -- = @ spaces  stay\n\n-- between  arms\nf _ = t\n",
     25     "f (t x) = x -- = @ spaces  stay\n\n-- between  arms\nf _     = t\n"
     26   ],
     27   [
     28     "headers",
     29     "!import absent as P\n!export f\nf [x | xs] = x\nf _ = t\n",
     30     "!import absent as P\n!export f\nf [x | xs] = x\nf _        = t\n"
     31   ],
     32   [
     33     "body",
     34     "f (t x)   =   (a : \"=  --  λ\") -- tail\nf _=t\n",
     35     "f (t x) =   (a : \"=  --  λ\") -- tail\nf _     =t\n"
     36   ],
     37   [
     38     "crlf",
     39     "f (t x) = x\r\nf _ = t\r\n",
     40     "f (t x) = x\r\nf _     = t\r\n"
     41   ],
     42   [
     43     "whole-spaces",
     44     "f a {t x y} = x\nf _ = t\n",
     45     "f a {t x y} = x\nf _         = t\n"
     46   ],
     47   [
     48     "lists",
     49     "f [a b c] = a\nf [] = t\nf _ = t\n",
     50     "f [a b c] = a\nf []      = t\nf _       = t\n"
     51   ],
     52   [
     53     "block-comment",
     54     "f (t x) = x\n|- comment\nf fake = ignored\n-|\nf _ = t\n",
     55     "f (t x) = x\n|- comment\nf fake = ignored\n-|\nf _     = t\n"
     56   ],
     57   [
     58     "groups",
     59     "f (t x) = x\nf _ = t\ng [x | xs] = x\ng _ = t",
     60     "f (t x) = x\nf _     = t\ng [x | xs] = x\ng _        = t"
     61   ],
     62   [
     63     "multi-arm",
     64     "f (t x) = x\nf (t x y) = y\nf _ = t\n",
     65     "f (t x)   = x\nf (t x y) = y\nf _       = t\n"
     66   ],
     67   [
     68     "two-arguments",
     69     "f (t x) y = x\nf _ _ = t\n",
     70     "f (t x) y = x\nf _     _ = t\n"
     71   ],
     72   [
     73     "empty",
     74     "",
     75     ""
     76   ],
     77   [
     78     "unchanged-0",
     79     "f x   = x\n",
     80     "f x   = x\n"
     81   ],
     82   [
     83     "adjacent-constants",
     84     "a=1\nb    =2\n",
     85     "a =1\nb =2\n"
     86   ],
     87   [
     88     "unchanged-2",
     89     "f (t x) = (\n x)\nf _ = t\n",
     90     "f (t x) = (\n x)\nf _ = t\n"
     91   ],
     92   [
     93     "unchanged-3",
     94     "f (t x) = x\nf _ = let\n  a = t\n  in a\n",
     95     "f (t x) = x\nf _ = let\n  a = t\n  in a\n"
     96   ],
     97   [
     98     "unchanged-4",
     99     "main = (let\n  f (t x) = x\n  f _ = t\n  in f t)\n",
    100     "main = (let\n  f (t x) = x\n  f _ = t\n  in f t)\n"
    101   ],
    102   [
    103     "unchanged-5",
    104     "f x y = x\nf _ = t\n",
    105     "f x y = x\nf _ = t\n"
    106   ],
    107   [
    108     "unchanged-6",
    109     "f (t x) = x\nf [x |\n xs] = t\nf _ = t\n",
    110     "f (t x) = x\nf [x |\n xs] = t\nf _ = t\n"
    111   ],
    112   [
    113     "unchanged-7",
    114     "f (t x) = x\nf (t y)\nf _ = t\n",
    115     "f (t x) = x\nf (t y)\nf _ = t\n"
    116   ],
    117   [
    118     "unchanged-8",
    119     "f (t x) = x\nf _\t= t\n",
    120     "f (t x) = x\nf _\t= t\n"
    121   ],
    122   [
    123     "unchanged-9",
    124     "f (t x) |- head comment -| = x\nf _ = t\n",
    125     "f (t x) |- head comment -| = x\nf _ = t\n"
    126   ],
    127   [
    128     "unchanged-10",
    129     "f (t x) = x\nf _ =\n",
    130     "f (t x) = x\nf _ =\n"
    131   ],
    132   [
    133     "unchanged-11",
    134     "f (t x) = x\n-- keep the whole group\nf _ = t\nf _ _ = t\n",
    135     "f (t x) = x\n-- keep the whole group\nf _ = t\nf _ _ = t\n"
    136   ],
    137   [
    138     "unchanged-12",
    139     "f \"unterminated\nf _ = t\n",
    140     "f \"unterminated\nf _ = t\n"
    141   ],
    142   [
    143     "unchanged-13",
    144     "f (t x) = \"first\nf _ = t\nlast\"\nf _ = t\n",
    145     "f (t x) = \"first\nf _ = t\nlast\"\nf _ = t\n"
    146   ],
    147   [
    148     "generated-2",
    149     "f [] = t\nf _ = t\n",
    150     "f [] = t\nf _  = t\n"
    151   ],
    152   [
    153     "generated-4",
    154     "f [] = t\nf [x0] = t\nf [x0 x1] = t\nf _ = t\n",
    155     "f []      = t\nf [x0]    = t\nf [x0 x1] = t\nf _       = t\n"
    156   ],
    157   [
    158     "generated-8",
    159     "f [] = t\nf [x0] = t\nf [x0 x1] = t\nf [x0 x1 x2] = t\nf [x0 x1 x2 x3] = t\nf [x0 x1 x2 x3 x4] = t\nf [x0 x1 x2 x3 x4 x5] = t\nf _ = t\n",
    160     "f []                  = t\nf [x0]                = t\nf [x0 x1]             = t\nf [x0 x1 x2]          = t\nf [x0 x1 x2 x3]       = t\nf [x0 x1 x2 x3 x4]    = t\nf [x0 x1 x2 x3 x4 x5] = t\nf _                   = t\n"
    161   ],
    162   [
    163     "local-core",
    164     "io action = B.pair \"tricuIO\" (B.pair 2 action)\npure value = B.pair 0 value\nbind action next = B.pair 1 (B.pair action next)\nfail diagnostic = B.pair 2 diagnostic\nscope body = B.pair 3 body\ncurrentScope = B.pair 4 t\n",
    165     "io    action      = B.pair \"tricuIO\" (B.pair 2 action)\npure  value       = B.pair 0         value\nbind  action next = B.pair 1         (B.pair action next)\nfail  diagnostic  = B.pair 2         diagnostic\nscope body        = B.pair 3         body\ncurrentScope      = B.pair 4         t\n"
    166   ],
    167   [
    168     "local-heads",
    169     "join ticket = B.pair 6 ticket\ndiscard ticket = B.pair 7 ticket\ncancel task reason = B.pair 8 (B.pair task reason)\ncancelled reason = B.pair 9 reason\n",
    170     "join      ticket      = B.pair 6 ticket\ndiscard   ticket      = B.pair 7 ticket\ncancel    task reason = B.pair 8 (B.pair task reason)\ncancelled reason      = B.pair 9 reason\n"
    171   ],
    172   [
    173     "local-barriers",
    174     "a x = x\n\nlonger y = y\n-- group\nz = t\n",
    175     "a x = x\n\nlonger y = y\n-- group\nz = t\n"
    176   ],
    177   [
    178     "local-padding-bound",
    179     "a x = P 1 x\nveryLongUnrelatedName y = P 2 y\n",
    180     "a x = P 1 x\nveryLongUnrelatedName y = P 2 y\n"
    181   ],
    182   [
    183     "local-layout-barrier",
    184     "id x = x\nother value = do f\n  value\n",
    185     "id x = x\nother value = do f\n  value\n"
    186   ],
    187   [
    188     "local-patterns",
    189     "one (t x) = x\ntwo _ = t\n",
    190     "one (t x) = x\ntwo _     = t\n"
    191   ],
    192   [
    193     "local-rhs-comment",
    194     "a x = P 1 -- preserve\nb y = P \"long\" y\n",
    195     "a x = P 1 -- preserve\nb y = P \"long\" y\n"
    196   ],
    197   [
    198     "local-crlf",
    199     "a x = x\r\nlong y = y\r\n",
    200     "a    x = x\r\nlong y = y\r\n"
    201   ],
    202   [
    203     "local-continuation-barrier",
    204     "f x = f\ng argument = g\n  argument\nh z = z\n",
    205     "f x = f\ng argument = g\n  argument\nh z = z\n"
    206   ]
    207 ]