GithubHelp home page GithubHelp logo

bccc's People

Contributors

giuseppemag avatar

Stargazers

 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

Forkers

fuath rtviii

bccc's Issues

Implementation Style

As a programmer interested in adopting more principled methodologies, I absolutely love the ideas you've demonstrated through this library and view it as an extremely valuable resource for learning. Thank you! I really appreciate what you've done here!

I would like to use this as an on-going reference for understanding a subject that tends to allude me (category theory) in terms that I find familiar (mainstream programming languages). As typescript happens to be quite permissive, I can't help but wonder about your decision making process in how you annotated your types. Taking your id function as an example, I can imagine a myriad of ways to annotate it:

  • let id = function<a>() : Fun<a,a> { return fun(x => x) } // from your source
  • let id = <a>():Fun<a,a> => fun(x => x) // same as above but with arrow function syntax
  • let id = <a>() => fun((x:a):a => x) // one variation
  • let id:<a>() => Fun<a,a> = () => fun(x => x) // another variation
  • let id:<a>() => Fun<a,a> = <a>():Fun<a,a> => fun((x:a):a => x) // multiple variations

Another example that has more obvious effects on usage could be the variety of ways to type a function from a to b:

  • type Fun = <a,b>(_:a) => b
  • type Fun<a,b> = (_:a) => b
  • type Fun<a> = <b>(_:a) => b
  • type Fun<b> = <a>(_:a) => b

I can understand that (at least in the first example), the differences may be of trivial importance. At this time, I'm more curious about another, perhaps equally pedantic, decision: is the fun wrapper a necessary implementation detail for achieving current usability?

In terms of typescript, I've always written id as let id = <a>(a:a):a => a. It could be reduced to let id = <a>(a:a) => a, utilizing inference on the return type, or even simply let id = a => a in flow, which utilized flow-based programming. The implications of the fun wrapper reach into other areas, like the semantics of this and ., that are somewhat coupled to the language itself and I'm curious whether your implementation could be further simplified (by removing the fun wrappers) without loss of functionality or if attempting to do so would be a fool's errand.

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.