unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.81k stars 271 forks source link

TermParser source code has example Unison code that isn't valid #5441

Closed kylegoetz closed 2 weeks ago

kylegoetz commented 2 weeks ago

TermParser.hs indicates a restructuring bind with LHS being a special list form (like [a] ++ [b]) being valid, but docs disagree.

Also contains an example where LHS doesn't have surrounding parens.

-- example:
--   (x, y)   = foo
--   hd +: tl | hd < 10 = [1,2,3]
--   stuff
--
-- desugars to:
--
--   match foo with
--     (x,y) -> match [1,2,3] with
--       hd +: tl | hd < 10 -> stuff

and

-- We have to look ahead as far as the `=` to know if this is a bind or
  -- just an action, for instance:
  --   Some 42
  --   vs
  --   Some 42 = List.head elems

Fix would be remove or correct these examples.