Maintainer | hapytexeu+gh@gmail.com |
---|---|
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
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.
Domino | The front side of the domino piece. |
| |
Back | The back side of the domino piece. |
Instances
Functor Domino Source # | |
Applicative Domino Source # | |
Foldable Domino Source # | |
Defined in Data.Char.Domino fold :: Monoid m => Domino m -> m # foldMap :: Monoid m => (a -> m) -> Domino a -> m # foldMap' :: Monoid m => (a -> m) -> Domino a -> m # foldr :: (a -> b -> b) -> b -> Domino a -> b # foldr' :: (a -> b -> b) -> b -> Domino a -> b # foldl :: (b -> a -> b) -> b -> Domino a -> b # foldl' :: (b -> a -> b) -> b -> Domino a -> b # foldr1 :: (a -> a -> a) -> Domino a -> a # foldl1 :: (a -> a -> a) -> Domino a -> a # elem :: Eq a => a -> Domino a -> Bool # maximum :: Ord a => Domino a -> a # minimum :: Ord a => Domino a -> a # | |
Traversable Domino Source # | |
Arbitrary1 Domino Source # | |
Defined in Data.Char.Domino liftArbitrary :: Gen a -> Gen (Domino a) # liftShrink :: (a -> [a]) -> Domino a -> [Domino a] # | |
Eq1 Domino Source # | |
Ord1 Domino Source # | |
Defined in Data.Char.Domino | |
Hashable1 Domino Source # | |
Defined in Data.Char.Domino | |
Bounded a => Bounded (Domino a) Source # | |
Eq a => Eq (Domino a) Source # | |
Data a => Data (Domino a) Source # | |
Defined in Data.Char.Domino gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Domino a -> c (Domino a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Domino a) # toConstr :: Domino a -> Constr # dataTypeOf :: Domino a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Domino a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Domino a)) # gmapT :: (forall b. Data b => b -> b) -> Domino a -> Domino a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Domino a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Domino a -> r # gmapQ :: (forall d. Data d => d -> u) -> Domino a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Domino a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Domino a -> m (Domino a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Domino a -> m (Domino a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Domino a -> m (Domino a) # | |
Ord a => Ord (Domino a) Source # | |
Defined in Data.Char.Domino | |
Read a => Read (Domino a) Source # | |
Show a => Show (Domino a) Source # | |
Generic (Domino a) Source # | |
Arbitrary a => Arbitrary (Domino a) Source # | |
Hashable a => Hashable (Domino a) Source # | |
Defined in Data.Char.Domino | |
UnicodeText (Oriented (Domino (Maybe DieValue))) Source # | |
UnicodeText (Oriented (Domino DieValue)) Source # | |
UnicodeCharacter (Oriented (Domino (Maybe DieValue))) Source # | |
UnicodeCharacter (Oriented (Domino DieValue)) Source # | |
Generic1 Domino Source # | |
type Rep (Domino a) Source # | |
Defined in Data.Char.Domino type Rep (Domino a) = D1 ('MetaData "Domino" "Data.Char.Domino" "unicode-tricks-0.10.1.0-1eO85eaCVOABc5OwDafRfB" 'False) (C1 ('MetaCons "Domino" 'PrefixI 'True) (S1 ('MetaSel ('Just "leftTop") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "rightBottom") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "Back" 'PrefixI 'False) (U1 :: Type -> Type)) | |
type Rep1 Domino Source # | |
Defined in Data.Char.Domino type Rep1 Domino = D1 ('MetaData "Domino" "Data.Char.Domino" "unicode-tricks-0.10.1.0-1eO85eaCVOABc5OwDafRfB" 'False) (C1 ('MetaCons "Domino" 'PrefixI 'True) (S1 ('MetaSel ('Just "leftTop") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Just "rightBottom") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1) :+: C1 ('MetaCons "Back" 'PrefixI 'False) (U1 :: Type -> Type)) |
:: 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
:: ComplexDomino | The |
-> Char | The unicode character that represents the given |
Convert a ComplexDomino
value to a unicode character rendering the domino
value horizontally.
:: SimpleDomino | The |
-> Char | The unicode character that represents the given |
Convert a SimpleDomino
value to a unicode character rendering the domino
value horizontally.
:: ComplexDomino | The |
-> Char | The unicode character that represents the given |
Convert a ComplexDomino
value to a unicode character rendering the domino
value vertically.
:: SimpleDomino | The |
-> Char | The unicode character that represents the given |
Convert a SimpleDomino
value to a unicode character rendering the domino
value vertically.
:: 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.
:: 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 Char
acters
:: Char | The given |
-> Maybe (Oriented ComplexDomino) | The equivalent |
:: Char | The given |
-> Oriented ComplexDomino | The equivalent |
Convert the given Char
acter to an Oriented
ComplexDomino
object. If
the given Char
acter is not a valid domino character, the result is
unspecified.