hkts | A simple encoding of higher-kinded types in TypeScript | Natural Language Processing library

 by   pelotom TypeScript Version: v0.3.1 License: MIT

kandi X-RAY | hkts Summary

kandi X-RAY | hkts Summary

hkts is a TypeScript library typically used in Artificial Intelligence, Natural Language Processing applications. hkts has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

TypeScript doesn't directly support higher-kinded types yet, but various attempts have been made to simulate them (see related work at the bottom). This project presents a new, greatly simplified approach to encoding HKTs using the power of conditional types. The idea is that, although we can't truly abstract over a type constructor type T = ..., we can abstract over the result T<_> of applying it to a special placeholder type _. Then, if we can somehow substitute all instances of _ within a type, we effectively have the ability to "apply" T at arbitrary types. That is, we can abstract over T! And it turns out we can define a substitution operator $ which does just that.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              hkts has a low active ecosystem.
              It has 171 star(s) with 8 fork(s). There are 7 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 4 open issues and 1 have been closed. There are 6 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of hkts is v0.3.1

            kandi-Quality Quality

              hkts has 0 bugs and 0 code smells.

            kandi-Security Security

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

            kandi-License License

              hkts 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

              hkts releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of hkts
            Get all kandi verified functions for this library.

            hkts Key Features

            No Key Features are available at this moment for hkts.

            hkts Examples and Code Snippets

            No Code Snippets are available at this moment for hkts.

            Community Discussions

            Trending Discussions on hkts

            QUESTION

            A partly partial with io-ts
            Asked 2020-Apr-20 at 16:25

            I'm having some issues with using io-ts. I've found that its really lacking documentation, most of the progress I've made is through GitHub issues. And no I don't understand the HKTs so no help there.

            Basically I'm creating a type elsewhere, type which has a certain set of keys:

            ...

            ANSWER

            Answered 2020-Apr-20 at 16:25

            I'm no expert in io-ts, but looking at this more closely, I'm thinking it isn't a straightforward thing to implement. The methods in a Schemable build schemables out of other schemables. The type() method takes a properties object whose keys are the keys of the desired object, and whose properties are schemables for each of the properties. The partial() method takes the same properties object, but builds a schemable where the properties are optional. You can see how these allow you to build the schemable; you have a properties object with all the keys you need to test for.

            But given a schemable for type T, it isn't possible in general to convert it into one for Partial. The properties object that was passed into type() is not accessible in its result. It's been lost; thrown away. If all you have, say, is a type guard function that returns true if and only if it's given a value of type T, you can't use that function to make another one that produces true if and only if it's given a value of type Partial. You need more details of T from some source outside of the guard function, such as that properties object which is gone now.

            So you can't do a straightforward composition of schemables to get this done.

            The only way to do this would be to write your own Schemable that stores enough information about the Schema that calls it so that it can return a new schema where, say, the top-level call to S.type() is replaced with a call to S.partial(). Even that wouldn't be perfect, if you want to see your partial distribute across unions or down into intersections. Essentially it would have to perform surgery on the Schema, unwrap a top-level call to S.type() to get at the lost properties object, and rewrap it with S.partial().

            It's easy enough to make one that turns all calls to S.type() into S.partial() (just replace your old schemable with a new one whose type property is a copy of the partial property), but that would end up making any nested objects partial as well as the top-level one.

            Here's the horrible thing I did that kind of seems to work:

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install hkts

            You can download it from GitHub.

            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
            CLONE
          • HTTPS

            https://github.com/pelotom/hkts.git

          • CLI

            gh repo clone pelotom/hkts

          • sshUrl

            git@github.com:pelotom/hkts.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 Natural Language Processing Libraries

            transformers

            by huggingface

            funNLP

            by fighting41love

            bert

            by google-research

            jieba

            by fxsjy

            Python

            by geekcomputers

            Try Top Libraries by pelotom

            runtypes

            by pelotomTypeScript

            use-methods

            by pelotomTypeScript

            type-zoo

            by pelotomTypeScript

            unionize

            by pelotomTypeScript

            effectful

            by pelotomScala