diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | lib/lkn/prelude.ex | 6 | ||||
-rw-r--r-- | lib/lkn/prelude/option.ex | 4 | ||||
-rw-r--r-- | mix.exs | 6 |
4 files changed, 11 insertions, 11 deletions
@@ -7,7 +7,7 @@ use it. ## Guide Every module of this package is in the `Lkn.Prelude` namespace to avoid name -collision. If one want to adopt our opinionated point of view, all she has to do +collision. If one wants to adopt our opinionated point of view, all she has to do is to add the following line to her code: ```elixir @@ -22,7 +22,7 @@ painlessly. ### Opaque data-structures and macro-based pattern matching In Elixir, it is not rare to see the most common data structure defined as -tuples. For instance, a computation that may or may not return a result will +tuples. For instance, a computation that may or may not return a value will effectively return `{ :ok, val } | :error`. As a consequence, the caller will have to match the result: @@ -38,7 +38,7 @@ end From our perspective, it brings several issues. The main one is inconsistency. Some code might return `{:ok, val}` in case of success where other would return `{:some, val}`. Another is that it makes it harder to change -the data structure implementation. For instance, what if one want to return a +the data structure implementation. For instance, what if one wants to return a structure rather than a tuple, in order to implement the `Enumerable` protocol? This package takes another path. The data structure typespecs are opaque and the diff --git a/lib/lkn/prelude.ex b/lib/lkn/prelude.ex index 02665b2..1a448e5 100644 --- a/lib/lkn/prelude.ex +++ b/lib/lkn/prelude.ex @@ -23,7 +23,7 @@ defmodule Lkn.Prelude do ## Guide Every module of this package is in the `Lkn.Prelude` namespace to - avoid name collision. If one want to adopt our opinionated point of + avoid name collision. If one wants to adopt our opinionated point of view, all she has to do is to add the following line to her code: use Lkn.Prelude @@ -37,7 +37,7 @@ defmodule Lkn.Prelude do In Elixir, it is not rare to see the most common data structure defined as tuples. For instance, a computation that may or may not - return a result will effectively return `{ :ok, val } | :error`. As + return a value will effectively return `{ :ok, val } | :error`. As a consequence, the caller will have to match the result: case res do @@ -51,7 +51,7 @@ defmodule Lkn.Prelude do inconsistency. Some code might return `{:ok, val}` in case of success where other would return `{:some, val}`. Another is that it makes it harder to change the data structure implementation. For - instance, what if one want to return a structure rather than a + instance, what if one wants to return a structure rather than a tuple, in order to implement the `Enumerable` protocol? This package takes another path. The data structure typespecs are diff --git a/lib/lkn/prelude/option.ex b/lib/lkn/prelude/option.ex index 17bc334..d3f0ec3 100644 --- a/lib/lkn/prelude/option.ex +++ b/lib/lkn/prelude/option.ex @@ -45,13 +45,13 @@ defmodule Lkn.Prelude.Option do The result of a computation which could have returned something but didn't. """ - @opaque nothing() :: :nothing + @type nothing() :: :nothing @typedoc """ The result of a computation which could have failed to return something but didn't. """ - @opaque some(x) :: {:some, x} + @type some(x) :: {:some, x} @typedoc """ The result of a computation which could have failed or could have @@ -5,14 +5,14 @@ defmodule LknPrelude.Mixfile do [ app: :lkn_prelude, name: "lkn-prelude", - version: "0.1.0", + version: "0.1.1", elixir: "~> 1.4", deps: deps(), build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, deps: deps(), description: description(), - source_url: "https://nest.pijul.com/lthms/lkn-prelude:lkn-prelude-0.1.0", + source_url: "https://nest.pijul.com/lthms/lkn-prelude:lkn-prelude-0.1.1", package: package(), test_coverage: [ tool: ExCoveralls @@ -69,7 +69,7 @@ defmodule LknPrelude.Mixfile do "GPL 3.0" ], links: %{ - "Pijul Nest" => "https://nest.pijul.com/lthms/lkn-prelude:lkn-prelude-0.1.0", + "Pijul Nest" => "https://nest.pijul.com/lthms/lkn-prelude:lkn-prelude-0.1.1", }, ] end |