Rebus.Parts
- Package
- purescript-rebus
- Repository
- afcondon/purescript-rebus
Rebus.Parts — a name in two parts: the family, then the member.
When every node of one type wears the same icons the structure of a picture shows, but then the nodes of a type cannot be told apart. A two-part name keeps both: the first icons say what kind of thing it is (dealt or assigned from the type, or declared as a meaning) and the last say which one (from the thing's own name).
The parts come from different sources, and nothing here cares which: a
part is a Glyph, however it was made.
#rebusAppend Source
rebusAppend :: Glyph -> Glyph -> GlyphOne glyph after another, as one glyph: the icons of the first then the icons of the second, with the alias that spells all of them.
Colour is laid again over the joined run rather than carried over, because the rule is a rule about neighbours: the last icon of the first part and the first icon of the second now stand side by side. Every other colour is what it was.
The alias is first.alias <> "-" <> second.alias, and it reads back with
rebusFromAnyAlias while the whole is FIVE icons or fewer. Six or more is
past the width this library reads (a two-part name of three and three, say):
the glyph is drawn and the alias is well formed, but rebusFromAnyAlias
will not take it. Keep the parts to five in all if the alias is to be typed.
Nothing stops the two parts holding the same icon; memberOf is the form
that does.
#memberOf Source
memberOf :: Width -> Deck -> Glyph -> String -> GlyphThe name of a member of a family: the family's glyph, then width icons
dealt for the member's own text.
The member's icons are dealt from the deck WITHOUT the family's, so no icon
stands twice in one name and a member's icon is never the one that said
which family it is. The family need not come from that deck, or from any:
memberOf Two names (glyphOfIcons [ "fire" ]) "boiler" puts a declared
meaning first and two dealt icons after it.
The member part is dealt by hash, so two members of one family can land on
the same icons, as two of anything can; Rebus.Assign.assignTwoPart is the
form for a known set that must not.