tweag / linear-base

Standard library for linear types in Haskell.
MIT License
333 stars 37 forks source link

[Doc question] Definition of linear #443

Closed sidkshatriya closed 1 year ago

sidkshatriya commented 1 year ago

I was a bit confused by some documentation and would be grateful for a clarification.

https://github.com/tweag/linear-base/blob/9f34bfcbfb765255620bc4fe2d46cc38e743d399/examples/Simple/Pure.hs#L151-L161

I am able to understand I. case (a)(i) but I am not able to understand I. case (a)(ii). Can you give me an example of I. case (a)(ii) which obeys the linearity properties?

aspiwack commented 1 year ago

Case (ii), in this sentence, is meant to be the recursive case.

For instance:

g :: A %1 -> B
h :: B %1 -> Int %1 -> D

f x = h (g x) 0
sidkshatriya commented 1 year ago

Thank you !

aspiwack commented 1 year ago

You're welcome :slightly_smiling_face: