in Education by
In Haskell, Iteratee based I/O seems very attractive. Iteratees are a composable, safe, fast ways of doing I/O inspired by the 'fold' a.k.a. 'reduce' function in functional languages. Basically, if you have a traversal the idea is to encapsulate the traversal state into a so-called "enumerator" who calls the "iteratee" which is in turn a function either returning a value or a request for more data along with a continuation for the enumerator to call. So only the enumerator knows the state of the traversal while the iteratee knows what to do with the data and builds values out of it. The nice thing about it is that iteratees are automatically composable, where output of one iteratee is fed to another to make a bigger one. So, two questions: Does the concept even make sence in other languages, like plain object oriented languages or is it only useful for overcoming the shortcomings of Haskell's lazy I/O? Are there any actual implementations for other languages, especially C# (as that is what my company uses)? (A google search turns up one mention of iteratees in Scala; well, I'm not that interested in Scala right now). JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
First of all, realize that Haskell's "Lazy IO" is kind of a hack that breaks purity in a limited way to allow I/O to occur on demand as data is consumed lazily. This is business as usual in an impure language, and lazy sequences can create the same problem anywhere. So if you're doing something like, say, exposing an IEnumerable interface to a file and reading it incrementally as the sequence is enumerated, this isn't really any different. Second, iteratees and enumerators can also be composed into what are called (in somewhat clumsy fashion) enumeratees. At this point you have something being fed sequential data, producing incremental results as they're ready, and feeding those results to something else. This is basically a variety of stream processor, a concept which probably predates both Haskell and C# by a considerable margin. Third, iteratees are an encapsulation of abstracted behavior, with their internal workings hidden. This is arguably more in keeping with OO principles than with ML-style functional programming, at least in the sense of "OO principles" that are espoused by the people who yell at you for using getters and setters and think control flow should be implemented via polymorphism. Given the above, I'd say that the iteratee concept would fit just fine in C#, and would be most naturally implemented as a sort of inverted equivalent of IEnumerable, with compositional data-flow objects and a "push" interface rather than the standard LINQ's "pull" style.

Related questions

0 votes
    I'm a bit surprised I'm having trouble finding this online, but I can't seem to find an example ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I'm a bit surprised I'm having trouble finding this online, but I can't seem to find an example ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I'm a bit surprised I'm having trouble finding this online, but I can't seem to find an example ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    Which documents are used to capture non-functional requirements?...
asked Nov 11, 2020 in Education by Editorial Staff
0 votes
    Difference Between Functional and Non-Functional Testing...
asked Oct 17, 2020 in Technology by JackTerrance
0 votes
    What are the types of non-functional?...
asked Oct 17, 2020 in Technology by JackTerrance
0 votes
    What is Non-Functional Testing?...
asked Oct 17, 2020 in Technology by JackTerrance
0 votes
    Difference Between Functional Testing Vs Non-Functional Testing with Examples?...
asked Oct 17, 2020 in Technology by JackTerrance
0 votes
    Could someone tell me how a non-IT person can make a career in the AWS cloud platform? Select the correct answer from above options...
asked Jan 6, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me what languages do I need to know to be a full-stack developer? Select the correct answer from above options...
asked Jan 8, 2022 in Education by JackTerrance
0 votes
    The process by which you become aware of messages through your sense is called ____________ (a) Organization (b) ... -Evaluation (d) Perception Please answer the above question....
asked Oct 22, 2022 in Education by JackTerrance
0 votes
    The primary method that people use to sense their environment is ____________ (a) reading (b) writing (c) speaking (d) seeing Please answer the above question....
asked Sep 21, 2022 in Education by JackTerrance
0 votes
    South Asia stands for diversity in every sense and yet constitutes one geo-political space. Do you agree with the ... for your answer. Select the correct answer from above options...
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    Ants locate sucrose by (a) using a strong sense of smell (b) using a keen sense of vision (c) ... emitted/reflected by sucrose Select the correct answer from above options...
asked Nov 9, 2021 in Education by JackTerrance
0 votes
    As you sense your device has been infected with spyware, you should run a scan with your existing security ... for-Cyber Security:,Cyber Security-Jobs:,Cyber Security Applications...
asked Oct 31, 2021 in Education by JackTerrance
...