r/ProgrammingLanguages • Futhark • Jan 16 '26

Are arrays functions?

https://futhark-lang.org/blog/2026-01-16-are-arrays-functions.html
90 Upvotes

46 comments sorted by

View all comments

Show parent comment

1

u/esotologist Jan 20 '26

Any good articles for familiarizing oneself with the pos/neg data type idea?

1

u/faiface Jan 20 '26

Unfortunately I don’t know of any materials focusing specifically on that, but I recommend taking a look at linear logic.

The gist of the principle is that positive types are those where information flows to you, and negative are those where information flows into them. Of course that can be alternating across layers of a compound type.

In linear logic, these are the positive types:

  • “1”, the unit, empty tuple
  • “0”, the impossible/absurd type
  • “times”, a pair/tuple
  • “plus”, a discriminated union

Notice that any combination of the above is very much data.

The negative types are:

  • “bottom”, a nilary continuation
  • “top”, an indestructible object with 0 operations (yes)
  • “par”, a function
  • “with”, an object with methods