Pass by Reference in Haskell? -


coming c# background, ref keyword useful in situations changes method parameter desired directly influence passed value value types of setting parameter null.

also, out keyword can come in handy when returning multitude of various logically unconnected values.

my question is: possible pass parameter function reference in haskell? if not, direct alternative (if any)?

it depends on context. without context, no, can't (at least not in way mean). context, may able if want. in particular, if you're working in io or st, can use ioref or stref respectively, mutable arrays, vectors, hash tables, weak hash tables (io only, believe), etc. function can take 1 or more of these , produce action (when executed) modify contents of references.

another sort of context, statet, gives illusion of mutable "state" value implemented purely. can use compound state , pass around lenses it, simulating references purposes.


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -