There's this Reddit answer from two years ago, and the subsequent comments https://www.reddit.com/r/haskell/comments/3zc81v/tradeoffs_o...
628 karma · joined December 22, 2012
There's this Reddit answer from two years ago, and the subsequent comments https://www.reddit.com/r/haskell/comments/3zc81v/tradeoffs_o...
(In Haskell, one way of getting into unproductive infinite loops is by mistakenly asking "parse elements until the first failure" to a parser combinator that can always succeed without consuming input.)
The ideal is that the core of the application should be both pure and total, purity and totality being tracked by the type system. In fact, one can often relegate partiality to a single function of the outer shell.
By choosing an unhabited return type, you can express that the stream never stops producing values by itself.
I also feel that it makes sense. Haskell prefers expressions to statements. When needed, statement-like things are constructed from expressions.
For example, to use ripgrep:
set grepprg=rg\ --vimgrep\ --no-headingI create a ".vim\pack\foo\start\" folder and git clone plugins there.
Invoking ":helptags .vim\pack\foo\start\somenewplugin\docs" for a plugin makes the docs available to the :h and :helpgrep commands.
The double asterisk is syntactic sugar for a "dependent pair" http://docs.idris-lang.org/en/latest/tutorial/typesfuns.html... Basically, it is a pair in which the type of the second element depends on the value of the first element.
Here it is being used to pack the result list with a proof that the list satisfies the required properties. The type of the proof must refer to the list, hence the need for dependent types.
The stuff within braces {} are implicit arguments http://docs.idris-lang.org/en/latest/tutorial/typesfuns.html... that are not given explicitly, but are inferred from the type of other arguments.
Type is commonly referred as the kind * in Haskell, the kind of types that have values.
Unlike in vanilla Haskell, the types of data constructors are explicitly stated http://docs.idris-lang.org/en/latest/tutorial/typesfuns.html... In Haskell the "types" of data constructors are kinds, and you need to enable the XKindSignatures extension to give them explicitly. https://downloads.haskell.org/~ghc/latest/docs/html/users_gu...
The API for reactive-banana doesn't seem to have a "value changed" combinator that creates an Event from a Behaviour alone; one must sample the Behaviour with another Event.
(Other FRP libraries somewhat similar in philosophy like reflex—not the JS Reflex—do seem to have Behaviour-like things that can fire events on change: http://hackage.haskell.org/package/reflex-0.4.0.1/docs/Refle... Although reactive-banana seems simpler to understand.)
Since "inverterPowerChange" returns a Behaviour http://hackage.haskell.org/package/reactive-banana-1.2.0.0/d... which is supposed to be "inspectable" at any point in time, shouldn't PowerChange, PowerOff and PowerOn actually be PoweredState, PoweredOff and PoweredOn? The former sound more like event names. Or perhaps should "inverterPowerChange" return an Event instead? http://hackage.haskell.org/package/reactive-banana-1.2.0.0/d...
Returning the stream itself from the "withFile" and trying to run it later still is still a bug.
I like this approach better that conventional Haskell lazy I/O, which I personally find quite confusing.
Not unlike the Streams/Collectors framework in Java.
Something like it can be defined: https://stackoverflow.com/questions/30210547/grouping-by-obj... although the signature is a bit ugly.
Many APL idioms, when translated to Haskell, are related to applicative functors. A smidget of dependent types is needed as well, to express the dimensions of vectors, arrays, and the like.
I suppose computer analogies are cliché, but consider virtual memory: it gives the illusion of a huge contiguous memory space, when in reality the machine has nothing of the sort. Our brains are much more complex than computers and I suspect extrapolating between "abstraction levels" will be even more risky there.
I also don't see why "Integrated Information Theory" with its "formal calculus" is really required for the methodology of studying patterns of neural activity and trying to match them with self-reported states of consciousness.
The relationship between the subjective feeling of consciousness and the measured neural patterns doesn't seem to be of the same nature. When I see the color blue, does that "cause" anything in my brain?
Then there's this:
> The current most promising scientific theory of consciousness [...] is Integrated Information Theory (IIT). [...] IIT emphasizes the differentiated and integrated aspect of any subjective experience and postulates that the mechanism supporting conscious experience in the human brain’s neocortex must likewise incorporate these two attributes.
I don't see any reason why the presumed features of our subjective experience should be "reflected" in the physical working of our brains.
"The abstract is no more than an instrument, an organ, to see the concrete clearly." —José Ortega y Gasset
"Good general theory does not search for the maximum generality, but for the right generality."—Saunders Mac Lane, who knew a thing or two about abstraction
Equations in lambda calculus do seem to have a "preferred direction" specified by the evaluation rules, though referential transparency lets you go "in the other direction" in your head, when reasoning about your program.
Perhaps the programs ~ equations idea would apply even better to logic programming, or term rewriting?