-- |
-- Module      : OAlg.Data.Symbol
-- Description : character symbols
-- Copyright   : (c) Erich Gut
-- License     : BSD3
-- Maintainer  : zerich.gut@gmail.com
--
-- symbols from 'A' to 'Z'. They are mainly used to validate the
-- algebraic structure of 'OAlg.Structure.Multiplicative.Orientation'.
module OAlg.Data.Symbol
  ( Symbol(..), xSymbol
  )
  where

import Control.DeepSeq(NFData(..))

import OAlg.Data.X
import OAlg.Data.Validable

--------------------------------------------------------------------------------
-- Symbol -

-- | symbols from 'A' to 'Z'.
data Symbol
  = A | B | C | D | E | F | G | H | I | J | K | L | M
  | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
  deriving (Int -> Symbol -> ShowS
[Symbol] -> ShowS
Symbol -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Symbol] -> ShowS
$cshowList :: [Symbol] -> ShowS
show :: Symbol -> String
$cshow :: Symbol -> String
showsPrec :: Int -> Symbol -> ShowS
$cshowsPrec :: Int -> Symbol -> ShowS
Show,ReadPrec [Symbol]
ReadPrec Symbol
Int -> ReadS Symbol
ReadS [Symbol]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Symbol]
$creadListPrec :: ReadPrec [Symbol]
readPrec :: ReadPrec Symbol
$creadPrec :: ReadPrec Symbol
readList :: ReadS [Symbol]
$creadList :: ReadS [Symbol]
readsPrec :: Int -> ReadS Symbol
$creadsPrec :: Int -> ReadS Symbol
Read,Symbol -> Symbol -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Symbol -> Symbol -> Bool
$c/= :: Symbol -> Symbol -> Bool
== :: Symbol -> Symbol -> Bool
$c== :: Symbol -> Symbol -> Bool
Eq,Eq Symbol
Symbol -> Symbol -> Bool
Symbol -> Symbol -> Ordering
Symbol -> Symbol -> Symbol
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Symbol -> Symbol -> Symbol
$cmin :: Symbol -> Symbol -> Symbol
max :: Symbol -> Symbol -> Symbol
$cmax :: Symbol -> Symbol -> Symbol
>= :: Symbol -> Symbol -> Bool
$c>= :: Symbol -> Symbol -> Bool
> :: Symbol -> Symbol -> Bool
$c> :: Symbol -> Symbol -> Bool
<= :: Symbol -> Symbol -> Bool
$c<= :: Symbol -> Symbol -> Bool
< :: Symbol -> Symbol -> Bool
$c< :: Symbol -> Symbol -> Bool
compare :: Symbol -> Symbol -> Ordering
$ccompare :: Symbol -> Symbol -> Ordering
Ord,Int -> Symbol
Symbol -> Int
Symbol -> [Symbol]
Symbol -> Symbol
Symbol -> Symbol -> [Symbol]
Symbol -> Symbol -> Symbol -> [Symbol]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Symbol -> Symbol -> Symbol -> [Symbol]
$cenumFromThenTo :: Symbol -> Symbol -> Symbol -> [Symbol]
enumFromTo :: Symbol -> Symbol -> [Symbol]
$cenumFromTo :: Symbol -> Symbol -> [Symbol]
enumFromThen :: Symbol -> Symbol -> [Symbol]
$cenumFromThen :: Symbol -> Symbol -> [Symbol]
enumFrom :: Symbol -> [Symbol]
$cenumFrom :: Symbol -> [Symbol]
fromEnum :: Symbol -> Int
$cfromEnum :: Symbol -> Int
toEnum :: Int -> Symbol
$ctoEnum :: Int -> Symbol
pred :: Symbol -> Symbol
$cpred :: Symbol -> Symbol
succ :: Symbol -> Symbol
$csucc :: Symbol -> Symbol
Enum,Symbol
forall a. a -> a -> Bounded a
maxBound :: Symbol
$cmaxBound :: Symbol
minBound :: Symbol
$cminBound :: Symbol
Bounded)

instance NFData Symbol where
  rnf :: Symbol -> ()
rnf Symbol
A = ()
  rnf Symbol
_ = ()

instance Validable Symbol where
  valid :: Symbol -> Statement
valid = forall x. NFData x => x -> Statement
rnfValid

instance XStandard Symbol where
  xStandard :: X Symbol
xStandard = X Symbol
xSymbol
  
--------------------------------------------------------------------------------
-- xSymbol -

-- | uniformly distributed random variable of 'Symbol'.
xSymbol :: X Symbol
xSymbol :: X Symbol
xSymbol = forall a. (Enum a, Bounded a) => X a
xEnum