Morph
for an elm/core
Char
only : Char -> Morph () Char
Match only the specific given broad input. See Morph.only
code : Morph Char Basics.Int
Character by unicode code point
import Morph
Morph.toNarrow Char.Morph.code 65 --> Ok 'A'
Morph.toNarrow Char.Morph.code 66 --> Ok 'B'
Morph.toNarrow Char.Morph.code 0x6728 --> Ok 'ζ¨'
Morph.toNarrow Char.Morph.code 0x0001D306 --> Ok 'π'
Morph.toNarrow Char.Morph.code 0x0001F603 --> Ok 'π'
Morph.toNarrow Char.Morph.code -1
--> Err (Morph.DeadEnd "unicode code point outside of range 0 to 0x10FFFF")
The full range of unicode is from 0
to 0x10FFFF
. With numbers outside that
range, you'll get an error (unlike Char.fromCode
).
string : Morph Char String
Morph
a String
of length 1 to a Char
Be aware, that special-cased characters as the result of Char.toUpper
are broadened as 2 Char
s in a String
and therefore narrowing to a Char
will fail.
value : Value.Morph.Internal.MorphValue Char
Char
MorphValue
Be aware that special-cased characters as the result of Char.toUpper
are broadened as 2 Char
s in a Value.String
and therefore narrowing to a Char
will fail.
bits : MorphRow Char Bit
Note that a Char
isn't equivalent to a visual unit like π¨πΏ or π¦Έπ½ββοΈ or aΜ΄ΜΜΜ
Μ«ΜΌΜ«
(β see grapheme).
Instead, it's just one UTF-8 code point.