unison/unison-src/transcripts/duplicate-names.md
2024-06-25 11:11:07 -07:00

854 B

Duplicate names in scratch file.

scratch/main> builtins.merge

Term and ability constructor collisions should cause a parse error.

structural ability Stream where
  send : a -> ()

Stream.send : a -> ()
Stream.send _ = ()

Term and type constructor collisions should cause a parse error.

structural type X = x 

X.x : a -> ()
X.x _ = ()

Ability and type constructor collisions should cause a parse error.

structural type X = x 
structural ability X where
  x : ()

Field accessors and terms with the same name should cause a parse error.

structural type X = {x : ()}
X.x.modify = ()
X.x.set = ()
X.x = ()

Types and terms with the same name are allowed.

structural type X = Z

X = ()
scratch/main> add
scratch/main> view X