hkts
sums_up
hkts | sums_up | |
---|---|---|
3 | 4 | |
19 | 40 | |
- | - | |
8.5 | 0.0 | |
about 3 years ago | about 1 year ago | |
TypeScript | Ruby | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
hkts
-
Hey Come Help Out And Learn Some Stuff
We need to be able to parse incoming json/xml/etc into typescript types. This is done or doable with the hkts decoder which is a partial port of io-ts.
-
Higher Kinded Deno
Before diving into the nitty gritty of how hkts implements higher kinded types, how hkts handles type-class constructor lengths, or how one might implement Monad for These, I will begin at the end. This is to say, I will be starting with examples of how to use Option, Either, Task, and more. Then I will endeavor to explain what type classes like Functor, Monad, Traverse, and Monoid mean. Lastly, I'll get into the typescript abstractions that make hkts possible.
sums_up
-
Ruby in FantasyLand: SumsUp
Now with Ruby we have a few different ideas we want to express. Whereas Daggy has tagged and taggedSum we have Struct and SumsUp.define instead. You can find more info on SumsUp here, but we'll be covering the general details in this post.
-
sums_up v1.0.0 - Sum Types for Ruby.
Hello, r/ruby! I wrote a gem, sums_up, for defining and pattern matching against sum types at Ruby. This isn't the first attempt at porting sum types into the language, but the other implementations that I've used either didn't "feel like" traditional Ruby, or didn't "feel like" a native sum type implementation. I tried my best to bridge that gap. Code Sample: require 'sums_up' # Define a sum type for Users; they can either be anonymous or logged in. User = SumsUp.define(:anonymous, logged_in: :email) # => User anon = User.anonymous # => # logged_in = User.logged_in('[email protected]') # => # anon.anonymous? # => true anon.logged_in? # => false logged_in.anonymous? # => false logged_in.logged_in? # => true anon.email # => NoMethodError: undefined method `email' for # logged_in.email # => "[email protected]" def valid_email?(user) user.match do |m| m.anonymous false m.logged_in { |email| URI::MailTo::EMAIL_REGEXP.match?(email) } end end valid_email?(anon) # => false valid_email?(logged_in) # => true valid_email?(User.logged_in('1337h@ck3r')) # => false There are a few more thorough examples in the README. If you're interested, try it out and let me know what you think!
- Sum types for Ruby
- Show HN: Sum Types for Ruby
What are some alternatives?
dropshot - expose REST APIs from a Rust program
daggy - Library for creating tagged constructors.
static-land - Specification for common algebraic structures in JavaScript based on Fantasy Land
fantasy-land - Specification for interoperability of common algebraic structures in JavaScript
mostly-adequate-guide - Mostly adequate guide to FP (in javascript)
sum-types - An attempt to emulate sum types using Go generics.
fp-ts-routing - A type-safe bidirectional routing library for TypeScript
lofty-rs - Audio metadata library
fnts - λ Minimal Functional Programming Utilities for TypeScript & JavaScript
mp4ff - Library and tools for parsing and writing MP4 files including video, audio and subtitles. The focus is on fragmented files. Includes mp4ff-info, mp4ff-encrypt, mp4ff-decrypt and other tools.
jsonschema - Generate JsonSchema and TypeScript types at the same time
ts-belt - 🔧 Fast, modern, and practical utility library for FP in TypeScript.