Giter VIP home page Giter VIP logo

hyogwa's People

Contributors

environmentset 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

Watchers

 avatar  avatar

Forkers

bglgwyng

hyogwa's Issues

Warning multiple evaluation of a single effectful computation at the development mode

All the functions of hyogwa assume that given generators representing effectful computation are 'fresh' (i.e. never executed after the creation). Therefore, passing around effectful computation that was already evaluated have high possibility to cause unsound results. For this problem, we can help the users not to make invariants by adding invariant checkers that work at development mode.

function* foo() {
  const bar = baz()

  yield* bar
  yield* bar // this can be problemetic
}

Compatibility with es module implementations

As hyogwa intended to be used with bundlers, hyogwa works well with them. However, I've reported and saw some problems of using hyogwa directly in the node/browser environment after compiling the program with tsc. In this issue, I'm going to investigate environments/settings where using hyogwa is hard or impossible and try to find best solution.

Add a test facility

The bigger the project expands, the higher needs to test facility grows. It's time to add test facility. which one should we choose?

P.S. we also need to setup simple CI

Having compatibility with fp-ts

To provide better functional programming experience, It is important to be compatible with fp-ts (widely used functional programming library armed with de-facto type class and HKT design). Let's investigate what is needed.

Curried/Data-last version of API

To cover use cases where functional programming libraries or pipeline style coding involves, curried version and data-last version of api is needed.

Simpler effect representations creation

currently, effect representations are created like following:

interface IO extends Spec<'IO'> {
  read(): string
  write(text: string): void
}
const IO = createEffect<IO>('IO')

Here, name of effect is repeated 5 times. this makes look of API verbose and makes users be tired of writing name of effects.
Using interface, adding discrimination tag to spec type, having effect representation in variable, mentioning name of spec when creating effect representation seems to be inevitable. But giving name of effect we want to create as string literal seems to be avoidable and I really hope so. let's find a way.

Using async functions as handle functions in `unsafeRunAsync`

I think it would be convenient if we can use async functions when writing handle functions for unsafeRunAsync.

unsafeRunAsync(main(), {
  API: {
    async getUserName({ resume }) {
      const res = await fetch(/** some api endpoint */)
      const { data: name } = await res.json()
      
      resume(name)
    }
  }
})

Shift to bun

While solving #4, I found using Bun is the most simple solution. It has built-in jest-compatible test runner for both javascript and typescript. There is no need to struggle to learn unfamiliar api and no need to setup cumbersome addons for test runners to have compatibility with typescript.

I want to move further, however, I want not only to adapt Bun's test runner but also to adapt whole Bun utilities. Bun is more performant and typescript-friendly than Node.js and npm. With Bun, we can keep things simple and even make things simpler.

Few weeks ago, alpha version of Bun was finally released. It seems to be stabilized. I think now is the best time to adapt Bun in this project. Any opinions?

Stricter `handle` function

Currently, there's nothing at compile time preventing users from not calling handle tactics. I think we can add more restriction by forcing users to return special values which only produced by handle tactics. But I'm also concerning that this would make writing handlers little more complicated. Any thoughts?

type TacticIsCalled = unique symbol // some special type

interface HandleTactics<in ER, in R> {
  resume(value: ER): TacticIsCalled
  abort(value: R): TacticIsCalled
}

type Handlers<E extends Effects, R = never>
  = Simplify<
      UnionToIntersection<
        E extends Code<`${infer S}.${infer C}`, infer P, infer ER> ?
          Eq<P, never> extends false ?
            { [K in S]: { [K in C]: (...parameters: [...P, HandleTactics<ER, R>]) => TacticIsCalled | Generator<Effects, TacticIsCalled > } }
            : { [K in S]: { [K in C]: ER | Generator<Effects, ER> } }
          : never
      >
    >

Implementing platform-specific effects

For practical use of hyogwa, It's really inevitable to implement platform specific effects such as reading/writing DOM, reading/writing file system, fetching remote resources and etc. Let's discuss about this in here.

Should we rename `createCodeConstructors`?

I think createCodeConstructors is not good name because:

  • Code is internally used data type. We should not mention them in front of users.
  • Hard to understand the purpose of calling it without understanding the internal design.
  • It's too long.

I wonder how other people think about this. Should we rename this function?

Adding built in effects

What effects are there which we can add as built-in?

I'm thinking of Exception, State, Env(Reader), Logger(Writer), Pure(total of koka) and Partial. I hope to add non-determinism too but it seems not possible to create smooth/natural interface for it now.

Pipeline compatible API

Although hyogwa prefers to use statements when constructing complex program, It's still useful for users to provide api that is compatible with pipeline style api. And sometimes, it's better to use pipelines when composition of abstraction is simple.

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.