Fluture | : butterfly : Fantasy Land compliant | Reactive Programming library

 by   fluture-js JavaScript Version: 8.0.2 License: MIT

kandi X-RAY | Fluture Summary

kandi X-RAY | Fluture Summary

Fluture is a JavaScript library typically used in Programming Style, Reactive Programming applications. Fluture has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i fluture' or download it from GitHub, npm.

Fluture offers a control structure similar to Promises, Tasks, Deferreds, and what-have-you. Let's call them Futures. Much like Promises, Futures represent the value arising from the success or failure of an asynchronous operation (I/O). Though unlike Promises, Futures are lazy and adhere to the monadic interface.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Fluture has a medium active ecosystem.
              It has 2420 star(s) with 92 fork(s). There are 25 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 6 open issues and 162 have been closed. On average issues are closed in 35 days. There are 10 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Fluture is 8.0.2

            kandi-Quality Quality

              Fluture has 0 bugs and 0 code smells.

            kandi-Security Security

              Fluture has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Fluture code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              Fluture is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              Fluture releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed Fluture and discovered the below as its top functions. This is intended to give you an instant insight into Fluture implemented functionality, and help decide if they suit your requirements.
            • Show a message .
            • Creates an Eager instance .
            • Creates a Transform Transform .
            • Run parallel .
            • Consume a resource .
            • Wrap an async handler function
            • Creates a parallel transformation matrix .
            • Draggable drain .
            • Creates an instance of an interpreter
            • Returns an alt transforming function .
            Get all kandi verified functions for this library.

            Fluture Key Features

            No Key Features are available at this moment for Fluture.

            Fluture Examples and Code Snippets

            Taskify,Usage
            JavaScriptdot img1Lines of Code : 44dot img1License : Permissive (MIT)
            copy iconCopy
            const taskify = require('util.taskify')
            const fs = require('fs')
            const Task = require('taskorama')
            // or
            // const Task = require('fluture')
            
            const readFileTask = taskify(Task, fs.readFile)
            
            readFileTask('package.json', 'utf8')
              .fork(
                err =>   
            Example
            TypeScriptdot img2Lines of Code : 14dot img2License : Permissive (MIT)
            copy iconCopy
            import { reject, resolve, fork } from 'fluture'
            import { future } from 'fp-ts-fluture/lib/Future'
            import { array } from 'fp-ts/lib/Array'
            
            array
              .sequence(future)([resolve(1), reject('oops')])
              .pipe(fork(e => console.error('Error:', e))
                (c  
            Fluture retry,Usage,Node
            JavaScriptdot img3Lines of Code : 1dot img3License : Permissive (MIT)
            copy iconCopy
            $ npm install --save fluture fluture-retry
              

            Community Discussions

            QUESTION

            Middleware monad?
            Asked 2021-Oct-04 at 21:20

            I'm newbye experimenting functional programming in Javascript.

            I'm learning and using monads (Reader, State, Fluture ...) to compose my Node apps with pure functions.

            But often I feel the need of a data structure, similar to a Monad but where I can chain functions in the middleware.

            Think of it as a structure of two function

            ...

            ANSWER

            Answered 2021-Aug-10 at 21:30

            If you're wanting to map outputs, that's a covariant functor's map function.

            If you're wanting to map inputs, that's a contravariant functor's contramap function.

            If you're wanting to do a change in the middle, you likely have to roll your own, but that doesn't mean you are forced to specify concrete functions in order. If I wanted to be able to specify h and i from your example at the last minute, I would partially apply a function like:

            Source https://stackoverflow.com/questions/68729960

            QUESTION

            What does it mean that in Fluture fork should be used in one place?
            Asked 2021-Sep-25 at 15:25

            I was reading about Fluture, and one way to consume a Future is to call fork. That is all understandable so far but in documentation it states:
            "Generally, one only needs to call fork in a single place in the entire program".

            What does it mean? What if I'm using Futures to fetch some content from Api request, I would probably want to do this multiple times throughout the code each with different resolve functions. All of these Futures would then require their own forks, right?

            ...

            ANSWER

            Answered 2021-Sep-25 at 15:25

            It is expected that you build your entire program as a big Future, composed of smaller futures (like many Api calls chained to each other), and only in your main entrypoint do call fork().

            Source https://stackoverflow.com/questions/69327473

            QUESTION

            Fluture: converting a future back to a promise for express global error handling
            Asked 2021-Mar-08 at 15:33

            I am trying to find a way to convert a Promise to a future using the fluture library to implement functional programming, transform the data using a functional pipeline, then transform back to a promise so I can utilize await/async functionality. This is for an express app and I am using global error handling and I am not seeing how to take advantage of global error handling for endpoints if I catch errors in the future process flow without converting to a promise after the future processing is complete.

            1. Am I right in thinking this way?
            2. If so, how can I use the promise utility in the code below to translate back to a promise after the encaseP and subsequent pipeline code is called?
            3. Is there a better way to utilize the future pipeline while still getting errors to the global error handler?
            4. Also, if I do convert to a promise will that also give me access to the actual value in the future if I utilize await, I assume so?

            Apologies if this is a bad question, I am a newbie to functional programming and fluture and am trying to get my ducks in the proper alignment.

            ...

            ANSWER

            Answered 2021-Mar-08 at 15:33

            I believe I have answered this question sufficiently in Gitter. I'll summarize my response below for future reference.

            There's a few things I see in your code that I would like to address:

            1. findData: I recommend already wrapping it right there with encaseP - as early on as possible. So you'd get (arrayList) => encaseP (Promise.reject) (arrayList), which can also be written like encaseP (Promise.reject) (because the input argument is simply passed down as-is).
            2. The total1 function can now call findData directly and get back a Future.
            3. .pipe (res => res): This line actually does nothing. Here you transform res, which is a Future of an Array, into res, which is exactly the same thing. It's important to understand that pipe is just function application: https://stackoverflow.com/a/59985017/1001417
            4. .pipe (promise (() => {console.log('do nothing')}) (console.log)): When you consume a Future, the work actually starts and the consumption returns a cancellation function (or a Promise, in the case of promise (future)). You shouldn't do this inside your functions, but outside of them. I recommend reading the introduction to Fluture, especially the part about "not consuming futures". A guiding rule of thumb is that you should only see fork (or promise or any other consumption function) called at the very "edge" of your program. That's at the point where you cannot possibly pass the Future down any further to a party that'll understand it.

            After removing that last line from the total1 function, so that the Future is not consumed, but returned from the function, we can consume the Future where needed. For example, an Express middleware that runs the total1 function and forwards its output to the Response would look something like:

            Source https://stackoverflow.com/questions/66521526

            QUESTION

            Fluture: how should null handling get addressed using Monads
            Asked 2021-Mar-05 at 23:27

            I am new to functional programming and I found the following fluture functional programming example that seems to give a really good example for handling database queries and subsequent data manipulation. The caveat however is that in reading about functional programming concepts, Just/Nothing monads seemed to be the suggested approach for handling null checking. 1) How would that fit into this example and 2) if the findOne rejected, would it stop the subsequent chains from running and immediately go to the fork?

            ...

            ANSWER

            Answered 2021-Mar-05 at 23:27

            Actually, Maybe (Nothing | Just) is often not what you want for handling errors because, although it can help you short-circuit subsequent operations and give you a hook to provide a default value, it won't tell you why the computation could not complete.

            Either (Left | Right) gives you the same features but also lets you access the context that caused your flow to take the error branch because Left holds data too, like an error message, which is useful for recovering from errors, logging or displaying useful messages to the user.

            Fluture gives you an async Either. Because it's async you can't retrieve the value directly (as you are used to with Promises) but apart from that it behaves the same as Maybe/Either: fork is the equivalent of fold. You will get short-circuiting and a lot more (like changing track, mapping over the reject branch, etc.).

            There is a good introduction here https://dev.to/avaq/fluture-a-functional-alternative-to-promises-21b

            Source https://stackoverflow.com/questions/66497031

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Fluture

            You can install using 'npm i fluture' or download it from GitHub, npm.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
            Maven
            Gradle
            CLONE
          • HTTPS

            https://github.com/fluture-js/Fluture.git

          • CLI

            gh repo clone fluture-js/Fluture

          • sshUrl

            git@github.com:fluture-js/Fluture.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Reactive Programming Libraries

            axios

            by axios

            RxJava

            by ReactiveX

            async

            by caolan

            rxjs

            by ReactiveX

            fetch

            by github

            Try Top Libraries by fluture-js

            momi

            by fluture-jsJavaScript

            fluture-express

            by fluture-jsJavaScript

            concurrify

            by fluture-jsJavaScript

            fluture-node

            by fluture-jsJavaScript

            fluture-sanctuary-types

            by fluture-jsJavaScript