Code Monkey home page Code Monkey logo

scriptum's People

Contributors

atomrc avatar drmats avatar galnir avatar ivenmarquardt avatar lukejewers avatar meereenee avatar monotykamary avatar poorlydefinedbehaviour avatar sdghbtn 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

scriptum's Issues

Replace typeclasses with multimethods

I think multimethods are a more natural approach to allow function overloading for dynamically typed languages than typeclasses. Provided I've considered all aspects I will probably replace typeclasses.

multimethods must have the following properties:

  • they must be closed
  • they must support dynamic dispatch for one or more arguments
  • methods must be individually addable one at a time
  • dispatch values must be of any type (not just Strings)
  • dispatch value/method tuples must be of type (a, a -> b)/(a, b, a -> b -> c)
  • the dispatcher should always be uncurried for performance reasons
  • multimethods should accept either curried/uncurried methods

As opposed to typeclasses multimethods cannot express return type polymorphism, because without a value you cannot introspect a type.

How to share intermediate results of async computations?

Say there is a Task foo and I want to reuse foo's result several times. The problem with Task is that it is based on continuations (CPS) and thus lazily evaluated. So every time I call foo.runTask(res, rej) the computation is reevaluated instead of simply returning the result.

There seems no way to allow for sharing foo's result, even not with an impure solution. The only way I can think of is to be in the right scope:

const foo = fileRead("utf8") ("./foo.txt");

foo.runTask(s => {
  // in this scope we can reuse s as often we want
}, id);

This is not satisfying, of course. Maybe someone will come up with a better solution.

Add a bunch of useful array combinators

namely...

  • arrDiff/arrDiffBy
  • arrDiffl/arrDiffr
  • arrIntersect/arrIntersectBy
  • arrUnion/arrUnionBy
  • arrMapAccum
  • arrGroupBy
  • arrFindBy/arrFindIndexBy
  • arrCountBy
  • arrFindBy
  • arrFindIndex
  • arrFindIndexBy
  • arrFindLastBy
  • arrFindLastIndex
  • arrFindLastIndexBy
  • arrFindNthBy
  • arrFindNthIndex
  • arrFindNthIndexBy

Obtain foldWhile semantics by additionally passing the current index

By additionally passing the current index we can prematurely break out of a fold of an indexed compisite type::

const strFold = alg => zero => s => {
  let acc = zero;

  for (let i = 0; i < s.length; i++)
    [acc, i] = alg(acc) (s, i);

  return acc;
};

or we can skip certain iterations. I think this approach is superior to indicate the premature break with a special type, as I've done so far.

Lens combinators are broken

lensGet et al. shouldn't leak the information whether they depend on Cont or Id internally. Additionally, these combinators need to be parameterized over the Lens type (objLens, arrLens etc.), so that they are ad-hoc polymorphic in this regard.

What should a file system related function return if it returns no data?

I mean functions like fileCopy or fileUnlink. For the time being they just return None (from Option), They should return someting IO related, though. scriptum uses Task for asynchronous and Effect for synchronous IO. So just Task((res, rej) => res(None)) for the former and Effect(() => None) for the latter? Would that be an improvement?

Add a Lens type for destructive updates

Since local mutations are not harmful but reasonable in a language without native persistent data types and structural sharing this seems to be a useful endeavor.

Left/Right biased Semigroup instances for Either

Consider left-biased (error propagating) and right-biased (error fixing) instances for Either. This would require distinct types. What would be meaningful names for their type and value constructors?

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.