| Maintainer | hapytexeu+gh@gmail.com |
|---|---|
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Data.Char.Domino
Description
A module that defines values for domino pieces, and converts these to unicode characters of the 1F030 unicode block.
Synopsis
- data Domino a
- = Domino {
- leftTop :: a
- rightBottom :: a
- | Back
- = Domino {
- pattern (:|) :: a -> a -> Domino a
- type OrientedDomino a = Oriented (Domino a)
- type SimpleDomino = Domino DieValue
- type ComplexDomino = Domino (Maybe DieValue)
- dominoH :: ComplexDomino -> Char
- dominoH' :: SimpleDomino -> Char
- dominoV :: ComplexDomino -> Char
- dominoV' :: SimpleDomino -> Char
- domino :: OrientedDomino (Maybe DieValue) -> Char
- domino' :: OrientedDomino DieValue -> Char
- fromDomino :: Char -> Maybe (Oriented ComplexDomino)
- fromDomino' :: Char -> Oriented ComplexDomino
Data types to represent domino values
A domino piece, which has two items. Depending on the orientation, the items are located at the top and bottom; or left and right.
Constructors
| Domino | The front side of the domino piece. |
Fields
| |
| Back | The back side of the domino piece. |
Instances
Arguments
| :: a | The item that is located at the left, or the top. |
| -> a | The item that is located at the right, or the bottom. |
| -> Domino a | The domino that is constructed. |
A pattern synonym that makes it more convenient to write expressions that
look like domino's like for example II :| IV.
type OrientedDomino a = Oriented (Domino a) Source #
A type alias that specifies that OrientedDomino is an Oriented type
that wraps a Domino item.
type SimpleDomino = Domino DieValue Source #
A SimpleDomino is a Domino that contains DieValue objects, it thus
can not have an "empty" value.
type ComplexDomino = Domino (Maybe DieValue) Source #
A ComplexDomino is a Domino that contains Maybe values wrapping a
DieValue. In case of a Nothing, that side is considered empty.
Render domino values
Arguments
| :: ComplexDomino | The |
| -> Char | The unicode character that represents the given |
Convert a ComplexDomino value to a unicode character rendering the domino
value horizontally.
Arguments
| :: SimpleDomino | The |
| -> Char | The unicode character that represents the given |
Convert a SimpleDomino value to a unicode character rendering the domino
value horizontally.
Arguments
| :: ComplexDomino | The |
| -> Char | The unicode character that represents the given |
Convert a ComplexDomino value to a unicode character rendering the domino
value vertically.
Arguments
| :: SimpleDomino | The |
| -> Char | The unicode character that represents the given |
Convert a SimpleDomino value to a unicode character rendering the domino
value vertically.
Arguments
| :: OrientedDomino (Maybe DieValue) | The |
| -> Char | The unicode characters that represents the |
Convert an OrientedDomino to its unicode equivalent, where the sides of
the domino can be empty.
Arguments
| :: OrientedDomino DieValue | The |
| -> Char | The unicode characters that represents the |
Convert an OrientedDomino to its unicode equivalent, where the sides of
the domino can not be empty.
Convert from Characters
Arguments
| :: Char | The given |
| -> Maybe (Oriented ComplexDomino) | The equivalent |
Arguments
| :: Char | The given |
| -> Oriented ComplexDomino | The equivalent |
Convert the given Character to an Oriented ComplexDomino object. If
the given Character is not a valid domino character, the result is
unspecified.