sugar.cr

Some syntactic (and maybe API) sugar for Crystal programs.

Sugar for Crystal

Some syntactic (and maybe API) sugar for Crystal programs.

Installation

  1. Add the dependency to your project's shard.yml:

    dependencies:
      sugar:
        github: nogginly/sugar.cr
    
  2. Run shards install

Usage

Lazy variables

require 'sugar'

include Sugar

class Num(T)
  def initialize(@value : T); end

  lazy square : T { @value.abs2 }

  lazy twice : T do
    @value * 2
  end
end

Contributing

Bug reports and sugestions are welcome, please raise an issue if you find a problem or have a question. Otherwise, for now, this project is closed for pull requests. I appreciate your understanding.

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

Contributors

Repository

sugar.cr

Owner
Statistic
  • 1
  • 0
  • 0
  • 0
  • 0
  • 5 months ago
  • December 22, 2023
License

Apache License 2.0

Links
Synced at

Tue, 21 May 2024 16:47:58 GMT

Languages