View Source Ark (ark v0.9.0)

Ark is a collection of small utilities useful for prototyping, testing, and working with Elixir common patterns.

utilities

Utilities

ark-drip

Ark.Drip

This module allows to throttle calls to a shared resource with a simple broker process.

ark-error

Ark.Error

This module provides function to work errors as data.

ark-ok

Ark.Ok

This module provides base functions to work with ok/error tuples.

ark-pipein

Ark.PipeIn

This module provides a macro to set a variable from the end of a pipe.

use Ark.PipeIn

:val
|> Atom.to_string()
|> String.upcase()
~> my_value

IO.inspect(my_value, label: "my_value")

# my_value: "VAL"

ark-structaccess

Ark.StructAccess

This module provides a simple way to implement the Access behaviour for any struct.

example

Example

iex> defmodule MyStruct do
...>   defstruct k: nil
...>   use Ark.StructAccess
...> end
iex> s = %MyStruct{k: 1}
iex> put_in(s.k, 2)
%MyStruct{k: 2}