Uptight.Text (Uptight v0.1.0-pre1)
Newtype for textual data.
It does what you expect, except it has one peculiarity:
map
just applies function to the underlying binary string as isright_fold
and other folds from Foldable iterate through UTF-8 characters
This behaviour probably should be unified to work over UTF-8 characters one way or another and a custom class Newtype should be devised to provide naive fmap functionality.
Link to this section Summary
Link to this section Types
Specs
t() :: %Uptight.Text{text: binary()}
Link to this section Functions
Link to this function
new()
Specs
new() :: t()
Default Elixir.Uptight.Text struct
Link to this function
new(field)
Specs
new(binary()) :: t()
new(binary()) :: Uptight.Result.t()
Defensive constructor.
Examples
iex> Uptight.Text.new(<<5555>>) |> Uptight.Result.is_err?()
true
iex> Uptight.Text.new(<<322>>)
%Uptight.Result.Ok{ok: %Uptight.Text{text: "B"}}
iex> Uptight.Text.new(<<228>>) |> Uptight.Result.is_err?()
true
iex> Uptight.Text.new("hello") |> Uptight.Result.from_ok() |> Witchcraft.Foldable.right_fold("", fn x, acc -> x <> acc end)
"olleh"
Link to this function
new!(arg)
Specs
Offensive constructor.
Link to this function