Morph for an elm/core Char
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).
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 Chars in a String
and therefore narrowing to a Char will fail.
Char MorphValue
Be aware that special-cased characters as the result of Char.toUpper
are broadened as 2 Chars in a Value.String
and therefore narrowing to a Char will fail.
Match only the specific given broad input. See
Morph.only