Giter Club home page Giter Club logo

mangrove's Introduction

Mangrove

Mangrove provides type utility to use with Sorbet.

Mangrove is a Ruby Gem designed to be the definitive toolkit for leveraging Sorbet's type system in Ruby applications. It's designed to offer a robust, statically-typed experience, focusing on solid types, a functional programming style, and an interface-driven approach.

Use rubocop-mangrove to statically check rescuing ControlSignal is done

Features

  • Option Type
  • Result Type
  • Enums with inner types (ADTs)

Installation

bundle add mangrove

Usage

Documentation is available here. For more concrete examples, see spec/**/**_spec.rb.

Mangrove::Result[OkType, ErrType]
Mangrove::Result::Ok[OkType, ErrType]
Mangrove::Result::Err[OkType, ErrType]
Mangrove::Option[InnerType]
Mangrove::Option::Some[InnerType]
Mangrove::Option::None[InnerType]

my_ok = Result::Ok.new("my value")
my_err = Result::Err.new("my err")
my_some = Option::Some.new(1234)
my_none = Option::None.new

Commands for Development

git config core.hooksPath hooks
bundle install
bundle exec tapioca init
bundle exec tapioca gems -w `nproc`
bundle exec tapioca dsl -w `nproc`
bundle exec tapioca check-shims
bundle exec tapioca init
bundle exec rspec -f d
bundle exec rubocop -DESP
bundle exec srb typecheck
bundle exec spoom tc
bundle exec ordinare --check
bundle exec ruboclean
bundle exec yardoc -o docs/ --plugin yard-sorbet
bundle exec yard server --reload --plugin yard-sorbet
rake build
rake release

mangrove's People

Contributors

kazzix14 avatar

Stargazers

Fumiaki MATSUSHIMA avatar Tomoya Chiba avatar

Watchers

 avatar

mangrove's Issues

Validatable

class Form
  extend Validatable
end

class Form
  class Unvalidated
    sig { returns(Validated) }
    def validate
    end
  end

  class Validated
  end
end

Error Types

wrap any errors and provides utility methods to create statically typed errors easily like anyhow.
add rake tasks to keep those types up to date.

add Struct

to do something like this

    class Row
      column :email,
        String,
        display: 'メールアドレス',
        deserialize: ->(value) { parse(value) }, # returns Result
        serialize: ->(value) { value.strip } # returns Result
    end

Add development server

I want a dev server or something that watches files, runs RSpec continuously, and serves coverage and documents.

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.