Skip to content
/ pipe_here Public

An Elixir macro for easily piping arguments at any position.

Notifications You must be signed in to change notification settings

vic/pipe_here

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PipeHere

help maintain this lib

An Elixir macro for easily piping arguments at any position.

Usage

import PipeHere

The pipe_here macro lets you specify the argument position while piping values by using the _ placeholder.

For example:

pipe_here( 2 |> x(1, _, 3) )

# expands to

x(1, 2, 3)

The pipe_here macro can also be used at the end of a pipe:

2 |> x(1, _, 3) |> pipe_here

Note that while you can do stuff like:

a |> b(1, _) |> c |> d.(2, _, 3) |> pipe_here

every member of the pipe can at most have just one _ placeholder.

Installation

Available in Hex, the package can be installed as:

  1. Add pipe_here to your list of dependencies in mix.exs:
def deps do
  [{:pipe_here, "~> 1.0.0"}]
end

Is it any good?

Yes

マクロス Makurosu

[Elixir macros,] The things I do for beautiful code ― George Martin, Game of Thrones

#myelixirstatus #FridayLiterally

About

An Elixir macro for easily piping arguments at any position.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages