Coder Social home page Coder Social logo

bow-swift / bow Goto Github PK

View Code? Open in Web Editor NEW
642.0 20.0 32.0 743.44 MB

๐Ÿน Bow is a cross-platform library for Typed Functional Programming in Swift

Home Page: https://bow-swift.io

License: Other

Swift 98.23% Ruby 1.77% Shell 0.01%
functional-programming category-theory functor monad swift-library free-monad tagless-final mtl cocoapods carthage

bow's People

Contributors

aballano avatar antoniomateogomez avatar bkase avatar calvellido avatar conradomateu avatar dependabot[bot] avatar devesh-shetty avatar dragna avatar dsabanin avatar ferranpujolcamins avatar gitter-badger avatar iboss-ptk avatar israelperezglez avatar jkmcclellan avatar miguelangel-dev avatar pietrocaselani avatar raulraja avatar truizlop avatar tylos avatar victorg1991 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bow's Issues

Ior API docs

Description

Add API reference for Ior data type.

Operator issues

A few issues with how Bow uses operators:

  • All the custom operators introduced use the same precedence group that ships with Swift (AdditionPrecedence). This prevents them from playing nicely with one another. For example, a Kleisli chain with pure compositions requires parenthesizing when >>> should take precedence over >=>.

    f
      >>> impureG
      >=> pureH
      >>> impureI
      >=> impureJ
  • Data defines infix operator >>=, but Swift already ships with >>= for bitwise shift assignment. Swift libraries tend to define >>- or >>>= instead as a result. In general, >>= seems less useful in Swift because you can define flatMap as an infix method, preserving readability where bind creates nesting.

  • Optics overloads + for composition. It might make more sense to use <<< or introduce a new operator. PureScript's profunctor package once defined .., though they use plain-ole <<< these days.

"ap" is backwards?

Swift can define ap in a much more readable (left-to-right, non-nested) format that matches Haskell. By introducing a generic at function scope we can constrain F's A to be a function between generics:

-public func ap<B>(_ ff: F<(A) -> B>) -> F<B>
+public func ap<A1, B>(_ fa: F<A1>) -> F<B> where A == (A1) -> B

And in practice:

Option.pure(add).ap(one).ap(two)

// vs. the right-to-left, awkwardly nested:
two.ap(one.ap(Option.pure(add)))

FWIW many functional libraries in Swift introduce the <*> operator, as another option. That could be an alternate consideration if the inconsistency with Arrow is an issue, though I assume Bow should be optimized for Swift syntax in general.

Split library to avoid unnecessary dependencies

The current implementation forces users of the library to depend on RxSwift and BrightFutures. We should split it into three:

  • Bow
  • Bow-Rx
  • Bow-BrightFutures

Any other integration with other libraries should as well be kept separately, so that users do not need to depend on unnecessary stuff.

Confusion about Maybe and Option

My iOS friends are about to try Bow but we are a little bit confused about naming of Option/Maybe.
Arrow for Kotlin is using Option, Bow is using Maybe and name Option is used for nullable types T?
Maybe is also in conflict with RxSwift's Maybe.

What are the reasons for using Maybe instead of Option in Bow?

Thanks for any hint!

Optics

Missing things regarding optics:

  • Typeclasses: At, Each, FilterIndex, Index
  • Optics: Fold, Getter, Iso, Lens, Optional, Prism, Setter, Traversal
  • Laws for all optics

Add GA tracker to the site

Hi there folks,

We should add the Google Analytics tracker to our websites to have more information about the visits and the impact of our library (and in the future to all the Gdocs to see how it works and how to improve it).

Here I attach the tracker we have to add it to the head of the site

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-18433785-19"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-18433785-19');
</script>

Cheers!

Fix tests configuration

Currently, the Xcode project only includes BowTests as a test target. We need to add all our tests targets as schemes.

Document classes and methods

If you are documenting one of these classes, create a separate issue and assign it to yourself so that everyone knows what is being done.

We will keep track of what is documented here. For now, I will list all current classes in the library. We should also generate the HTML documents based on this (perhaps using Jazzy or similar). Sorted by priority and with an indicator of difficulty (๐Ÿ“— easy, ๐Ÿ“’ medium, ๐Ÿ“• hard to document):

Data

  • Action ๐Ÿ“•
  • ArrayK ๐Ÿ“—
  • CoT ๐Ÿ“•
  • Const ๐Ÿ“—
  • Coproduct ๐Ÿ“’
  • Coreader ๐Ÿ“’
  • CoSum ๐Ÿ“•
  • Day ๐Ÿ“•
  • DictionaryK ๐Ÿ“—
  • Either ๐Ÿ“—
  • Endo ๐Ÿ“’
  • Eval ๐Ÿ“—
  • Id ๐Ÿ“—
  • Ior ๐Ÿ“—
  • Moore ๐Ÿ“•
  • NonEmptyArray ๐Ÿ“—
  • Option ๐Ÿ“—
  • Pairing ๐Ÿ“•
  • Puller ๐Ÿ“•
  • Reader ๐Ÿ“—
  • SetK ๐Ÿ“—
  • State ๐Ÿ“—
  • Sum ๐Ÿ“•
  • Trampoline ๐Ÿ“’
  • Try ๐Ÿ“—
  • Validated ๐Ÿ“—
  • Zipper ๐Ÿ“•

Instances

  • BoolInstances ๐Ÿ“—
  • OptionInstances ๐Ÿ“—
  • NumberInstances ๐Ÿ“—
  • StringInstances ๐Ÿ“—

Syntax

  • HigherKinds ๐Ÿ“’
  • BooleanFunctions ๐Ÿ“—
  • Curry ๐Ÿ“—
  • Memoization ๐Ÿ“—
  • PartialApplication ๐Ÿ“—
  • Predef ๐Ÿ“—
  • Reverse ๐Ÿ“—

Typeclasses

  • Alternative ๐Ÿ“’
  • Applicative ๐Ÿ“—
  • ApplicativeError ๐Ÿ“—
  • Bimonad ๐Ÿ“’
  • Comonad ๐Ÿ“’
  • ComonadEnv ๐Ÿ“’
  • ComonadStore ๐Ÿ“’
  • ComonadTraced ๐Ÿ“’
  • ComonadTrans ๐Ÿ“’
  • Contravariant ๐Ÿ“—
  • Decidable ๐Ÿ“—
  • Divide ๐Ÿ“—
  • Divisible ๐Ÿ“—
  • EquatableK ๐Ÿ“—
  • Foldable ๐Ÿ“’
  • Functor ๐Ÿ“—
  • FunctorFilter ๐Ÿ“—
  • Invariant ๐Ÿ“—
  • Monad ๐Ÿ“—
  • MonadCombine ๐Ÿ“—
  • MonadError ๐Ÿ“—
  • MonadFilter ๐Ÿ“—
  • MonadReader ๐Ÿ“’
  • MonadState ๐Ÿ“’
  • MonadWriter ๐Ÿ“’
  • Monoid ๐Ÿ“—
  • Monoidal ๐Ÿ“—
  • MonoidK ๐Ÿ“—
  • NonEmptyReducible ๐Ÿ“—
  • Reducible ๐Ÿ“—
  • Selective ๐Ÿ“’
  • Semigroup ๐Ÿ“—
  • SemigroupK ๐Ÿ“—
  • Semiring ๐Ÿ“—
  • Traverse ๐Ÿ“’
  • TraverseFilter ๐Ÿ“’

Transformers

  • EitherT ๐Ÿ“’
  • OptionT ๐Ÿ“’
  • StateT ๐Ÿ“’
  • WriterT ๐Ÿ“’
  • StoreT ๐Ÿ“•
  • TracedT ๐Ÿ“•
  • EnvT ๐Ÿ“•

Effects

  • Atomic ๐Ÿ“’
  • IO ๐Ÿ“’
  • Ref ๐Ÿ“’
  • Resource ๐Ÿ“’

Effects/Foundation

  • ConsoleIO ๐Ÿ“—
  • FileManager
  • URLSession ๐Ÿ“—

Effects/Rx

  • MaybeK ๐Ÿ“’
  • ObservableK ๐Ÿ“’
  • SingleK ๐Ÿ“’

Effects/Typeclasses

  • Async ๐Ÿ“’
  • Bracket ๐Ÿ“’
  • Concurrent ๐Ÿ“’
  • ConcurrentEffect ๐Ÿ“’
  • Effect ๐Ÿ“’
  • MonadDefer ๐Ÿ“’
  • UnsafeRun ๐Ÿ“’
  • EffectComprehensions ๐Ÿ“’

Arrow

  • Cokleisli ๐Ÿ“’
  • Function0 ๐Ÿ“—
  • Function1 ๐Ÿ“—
  • FunctionK ๐Ÿ“’
  • Kleisli ๐Ÿ“’

Optics/Typeclasses

  • At ๐Ÿ“’
  • Cons ๐Ÿ“’
  • Each ๐Ÿ“’
  • FilterIndex ๐Ÿ“’
  • Index ๐Ÿ“’
  • Snoc ๐Ÿ“’

Optics

  • BoundSetter ๐Ÿ“’
  • Fold ๐Ÿ“’
  • Getter ๐Ÿ“’
  • Iso ๐Ÿ“’
  • Lens ๐Ÿ“’
  • Optional ๐Ÿ“’
  • Prism ๐Ÿ“’
  • Setter ๐Ÿ“’
  • Traversal ๐Ÿ“’

Optics/DSL

  • At+Optics ๐Ÿ“’
  • Each+Optics ๐Ÿ“’
  • Index+Optics ๐Ÿ“’
  • Kind+Optics ๐Ÿ“’

Optics/Instances

  • ArrayKOpticsInstances ๐Ÿ“’
  • ArrayOpticsInstances ๐Ÿ“’
  • ConstOpticsInstances ๐Ÿ“’
  • EitherKOpticsInstances ๐Ÿ“’
  • EitherOpticsInstances ๐Ÿ“’
  • IdOpticsInstances ๐Ÿ“’
  • IorOpticsInstances ๐Ÿ“’
  • OptionOpticsInstances ๐Ÿ“’
  • NonEmptyArrayOpticsInstances ๐Ÿ“’
  • StringOpticsInstances ๐Ÿ“’
  • TryOpticsInstances ๐Ÿ“’
  • ValidatedOpticsInstances ๐Ÿ“’

Optics/STD

  • Either+Optics ๐Ÿ“—
  • Id+Optics ๐Ÿ“—
  • Ior+Optics ๐Ÿ“—
  • ArrayK+Optics ๐Ÿ“—
  • Option+Optics ๐Ÿ“—
  • NonEmptyArray+Optics ๐Ÿ“—
  • Result+Optics ๐Ÿ“—
  • String+Optics ๐Ÿ“—
  • Try+Optics ๐Ÿ“—
  • Validated+Optics ๐Ÿ“—

Optics/Tuple

  • Tuple2 ๐Ÿ“—
  • Tuple3 ๐Ÿ“—
  • Tuple4 ๐Ÿ“—
  • Tuple5 ๐Ÿ“—
  • Tuple6 ๐Ÿ“—
  • Tuple7 ๐Ÿ“—
  • Tuple8 ๐Ÿ“—
  • Tuple9 ๐Ÿ“—
  • Tuple10 ๐Ÿ“—

Optics/Auto

  • AutoFold ๐Ÿ“—
  • AutoGetter ๐Ÿ“—
  • AutoLens ๐Ÿ“—
  • AutoOptics ๐Ÿ“—
  • AutoOptional ๐Ÿ“—
  • AutoPrism ๐Ÿ“—
  • AutoSetter ๐Ÿ“—
  • AutoTraversal ๐Ÿ“—

Free

  • Cofree ๐Ÿ“•
  • Coyoneda ๐Ÿ“•
  • Free ๐Ÿ“•
  • Yoneda ๐Ÿ“•

RecursionSchemes

  • Recursion ๐Ÿ“•

RecursionSchemes/Data

  • Fix ๐Ÿ“•
  • Mu ๐Ÿ“•
  • Nu ๐Ÿ“•

RecursionSchemes/Typeclasses

  • Birecursive ๐Ÿ“•
  • Corecursive ๐Ÿ“•
  • Recursive ๐Ÿ“•

Generic

  • Generic ๐Ÿ“•
  • HList ๐Ÿ“•
  • Product ๐Ÿ“•
  • Coproduct2 ๐Ÿ“•
  • Coproduct3 ๐Ÿ“•
  • Coproduct4 ๐Ÿ“•
  • Coproduct5 ๐Ÿ“•
  • Coproduct6 ๐Ÿ“•
  • Coproduct7 ๐Ÿ“•
  • Coproduct8 ๐Ÿ“•
  • Coproduct9 ๐Ÿ“•
  • Coproduct10 ๐Ÿ“•

Logo and Micro site

@truizlop Maybe Israel and Calvellido can help with this but this is largely influenced by the options and choices you have on Swift.

Missing things comparing with Arrow

I've made a first pass review of the library to see what is missing and I've found some things

Optics

  • basically everything

Data

  • Sequence

Free

  • FreeApplicative
  • Trampoline

Effects

  • Rx

I didn't check in depth to see if there are methods missing yet
@raulraja

Clean up frameworks

Adding some frameworks through Carthage has polluted a little bit the project and it needs to be cleaned.

Rename to match Swift Foundation names

Description

There are some data types that match names in Arrow but are not aligned with how they are called in Swift. The following data types should be renamed to:

  • ListK -> ArrayK
  • MapK -> DictionaryK
  • NonEmptyList -> NonEmptyArray

Delete deprecated operators.

Operators >=> and >>= were marked as deprecated in the previous release. We are deleting them for next version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.