Packages

Collection of useful data types brought to Elixir from other functional languages.

Current section

Files

Jump to
fe lib fe.ex
Raw

lib/fe.ex

defmodule FE do
@moduledoc """
Basic functional programming idioms.
"""
@doc """
Always return the argument unchanged.
"""
@spec id(a) :: a when a: var
def id(a), do: a
@doc """
Create a unary function that always returns the same value, regardless
of what it was called with.
"""
@spec const(a) :: (any -> a) when a: var
def const(a), do: fn _ -> a end
end