Copyright | (c) Justus Sagemüller 2017 |
---|---|
License | GPL v3 |
Maintainer | (@) jsag $ hvl.no |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data SymbolD σ c
- data Infix s = Infix {
- symbolFixity :: !Fixity
- infixSymbox :: !s
- type family SpecialEncapsulation s
- data Encapsulation s
- = Encapsulation {
- needInnerParens, haveOuterparens :: !Bool
- leftEncaps, rightEncaps :: !s
- | SpecialEncapsulation (SpecialEncapsulation s)
- = Encapsulation {
- type AlgebraExpr σ l = CAS (Infix l) (Encapsulation l) (SymbolD σ l)
- type AlgebraExpr' γ σ l = CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
- type AlgebraPattern σ l = AlgebraExpr' GapId σ l
- don'tParenthesise :: Monoid s¹ => CAS' γ (Infix s²) (Encapsulation s¹) s⁰ -> CAS' γ (Infix s²) (Encapsulation s¹) s⁰
- symbolInfix :: s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
- symbolFunction :: Monoid s¹ => s¹ -> CAS' γ (Infix s²) (Encapsulation s¹) s⁰ -> CAS' γ (Infix s²) (Encapsulation s¹) s⁰
- data AlgebraicInvEncapsulation
- class ASCIISymbols c where
- fromASCIISymbol :: Char -> c
- toASCIISymbols :: c -> String
- class Eq (SpecialEncapsulation c) => RenderableEncapsulations c where
- fixateAlgebraEncaps :: (SymbolClass σ, SCConstraint σ c) => CAS' γ (Infix c) (Encapsulation c) (SymbolD σ c) -> CAS' γ (Infix c) (Encapsulation c) (SymbolD σ c)
- type RenderingCombinator σ c r = Bool -> Maybe r -> SymbolD σ c -> Maybe r -> r
- data ContextFixity
- expressionFixity :: AlgebraExpr σ c -> Maybe Fixity
- renderSymbolExpression :: forall σ c r. (SymbolClass σ, SCConstraint σ c, HasCallStack) => ContextFixity -> RenderingCombinator σ c r -> AlgebraExpr σ c -> r
- showsPrecASCIISymbol :: (ASCIISymbols c, SymbolClass σ, SCConstraint σ c) => Int -> AlgebraExpr σ c -> ShowS
- class UnicodeSymbols c where
- fromUnicodeSymbol :: Char -> c
- toUnicodeSymbols :: c -> String
- showsPrecUnicodeSymbol :: (UnicodeSymbols c, SymbolClass σ, SCConstraint σ c) => Int -> AlgebraExpr σ c -> ShowS
- class SymbolClass σ where
- type SCConstraint σ :: * -> Constraint
- fromCharSymbol :: (Functor p, SCConstraint σ c) => p σ -> Char -> c
- normaliseSymbols :: forall σ c γ s² s¹. (SymbolClass σ, SCConstraint σ c) => CAS' γ s² s¹ (SymbolD σ c) -> CAS' γ s² s¹ (SymbolD σ c)
- (%$>) :: forall σ c c' γ s² s¹. (SymbolClass σ, SCConstraint σ c) => (c -> c') -> CAS' γ s² s¹ (SymbolD σ c) -> CAS' γ s² s¹ (SymbolD σ c')
- continueExpr :: (Eq l, Monoid l) => (AlgebraExpr' γ σ l -> AlgebraExpr' γ σ l -> AlgebraExpr' γ σ l) -> (AlgebraExpr' γ σ l -> AlgebraExpr' γ σ l) -> AlgebraExpr' γ σ l -> AlgebraExpr' γ σ l
- (&~~!) :: (Eq l, Eq (Encapsulation l), SymbolClass σ, SCConstraint σ l, Show (AlgebraExpr σ l), Show (AlgebraPattern σ l)) => AlgebraExpr σ l -> [AlgebraPattern σ l] -> AlgebraExpr σ l
- (&~~:) :: (Eq l, Eq (Encapsulation l), SymbolClass σ, SCConstraint σ l, Show (AlgebraExpr σ l), Show (AlgebraPattern σ l)) => AlgebraExpr σ l -> [AlgebraPattern σ l] -> AlgebraExpr σ l
Documentation
Instances
Infix | |
|
Instances
type family SpecialEncapsulation s Source #
Instances
type SpecialEncapsulation String Source # | |
Defined in CAS.Dumb.Symbols |
data Encapsulation s Source #
Encapsulation | |
| |
SpecialEncapsulation (SpecialEncapsulation s) |
Instances
type AlgebraExpr σ l = CAS (Infix l) (Encapsulation l) (SymbolD σ l) Source #
type AlgebraExpr' γ σ l = CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l) Source #
type AlgebraPattern σ l = AlgebraExpr' GapId σ l Source #
don'tParenthesise :: Monoid s¹ => CAS' γ (Infix s²) (Encapsulation s¹) s⁰ -> CAS' γ (Infix s²) (Encapsulation s¹) s⁰ Source #
symbolFunction :: Monoid s¹ => s¹ -> CAS' γ (Infix s²) (Encapsulation s¹) s⁰ -> CAS' γ (Infix s²) (Encapsulation s¹) s⁰ Source #
data AlgebraicInvEncapsulation Source #
Instances
Show AlgebraicInvEncapsulation Source # | |
Defined in CAS.Dumb.Symbols showsPrec :: Int -> AlgebraicInvEncapsulation -> ShowS # show :: AlgebraicInvEncapsulation -> String # showList :: [AlgebraicInvEncapsulation] -> ShowS # | |
Eq AlgebraicInvEncapsulation Source # | |
Defined in CAS.Dumb.Symbols |
class ASCIISymbols c where Source #
fromASCIISymbol :: Char -> c Source #
toASCIISymbols :: c -> String Source #
Instances
ASCIISymbols String Source # | |
Defined in CAS.Dumb.Symbols fromASCIISymbol :: Char -> String Source # toASCIISymbols :: String -> String Source # |
class Eq (SpecialEncapsulation c) => RenderableEncapsulations c where Source #
fixateAlgebraEncaps :: (SymbolClass σ, SCConstraint σ c) => CAS' γ (Infix c) (Encapsulation c) (SymbolD σ c) -> CAS' γ (Infix c) (Encapsulation c) (SymbolD σ c) Source #
Instances
RenderableEncapsulations String Source # | |
Defined in CAS.Dumb.Symbols fixateAlgebraEncaps :: (SymbolClass σ, SCConstraint σ String) => CAS' γ (Infix String) (Encapsulation String) (SymbolD σ String) -> CAS' γ (Infix String) (Encapsulation String) (SymbolD σ String) Source # |
type RenderingCombinator σ c r Source #
data ContextFixity Source #
Instances
Eq ContextFixity Source # | |
Defined in CAS.Dumb.Symbols (==) :: ContextFixity -> ContextFixity -> Bool # (/=) :: ContextFixity -> ContextFixity -> Bool # |
expressionFixity :: AlgebraExpr σ c -> Maybe Fixity Source #
renderSymbolExpression :: forall σ c r. (SymbolClass σ, SCConstraint σ c, HasCallStack) => ContextFixity -> RenderingCombinator σ c r -> AlgebraExpr σ c -> r Source #
showsPrecASCIISymbol :: (ASCIISymbols c, SymbolClass σ, SCConstraint σ c) => Int -> AlgebraExpr σ c -> ShowS Source #
class UnicodeSymbols c where Source #
fromUnicodeSymbol :: Char -> c Source #
toUnicodeSymbols :: c -> String Source #
Instances
UnicodeSymbols String Source # | |
Defined in CAS.Dumb.Symbols fromUnicodeSymbol :: Char -> String Source # toUnicodeSymbols :: String -> String Source # |
showsPrecUnicodeSymbol :: (UnicodeSymbols c, SymbolClass σ, SCConstraint σ c) => Int -> AlgebraExpr σ c -> ShowS Source #
class SymbolClass σ where Source #
type SCConstraint σ :: * -> Constraint Source #
fromCharSymbol :: (Functor p, SCConstraint σ c) => p σ -> Char -> c Source #
Instances
SymbolClass ASCII Source # | |
Defined in CAS.Dumb.Symbols.ASCII type SCConstraint ASCII :: Type -> Constraint Source # fromCharSymbol :: (Functor p, SCConstraint ASCII c) => p ASCII -> Char -> c Source # | |
SymbolClass Unicode_MathLatin_RomanGreek__BopomofoGaps Source # | |
normaliseSymbols :: forall σ c γ s² s¹. (SymbolClass σ, SCConstraint σ c) => CAS' γ s² s¹ (SymbolD σ c) -> CAS' γ s² s¹ (SymbolD σ c) Source #
(%$>) :: forall σ c c' γ s² s¹. (SymbolClass σ, SCConstraint σ c) => (c -> c') -> CAS' γ s² s¹ (SymbolD σ c) -> CAS' γ s² s¹ (SymbolD σ c') infixl 4 Source #
Transform the symbols of an expression, in their underlying representation.
(map succ%$> 𝑎+𝑝) * 𝑥 ≡ (𝑏+𝑞) * 𝑥
Note that this can not be used with number literals.
:: (Eq l, Monoid l) | |
=> (AlgebraExpr' γ σ l -> AlgebraExpr' γ σ l -> AlgebraExpr' γ σ l) | Combinator to use for chaining the new expression to the old ones |
-> (AlgebraExpr' γ σ l -> AlgebraExpr' γ σ l) | Transformation to apply to the rightmost expression in the previous chain |
-> AlgebraExpr' γ σ l -> AlgebraExpr' γ σ l | Transformation which appends the result. |
(&~~!) :: (Eq l, Eq (Encapsulation l), SymbolClass σ, SCConstraint σ l, Show (AlgebraExpr σ l), Show (AlgebraPattern σ l)) => AlgebraExpr σ l -> [AlgebraPattern σ l] -> AlgebraExpr σ l infixl 1 Source #
Apply a sequence of pattern-transformations and yield the result concatenated to the original via the corresponding chain-operator. Because only the rightmost expression in a chain is processed, this can be iterated, giving a chain of intermediate results.
If one of the patterns does not match, this manipulator will raise an error.
(&~~:) :: (Eq l, Eq (Encapsulation l), SymbolClass σ, SCConstraint σ l, Show (AlgebraExpr σ l), Show (AlgebraPattern σ l)) => AlgebraExpr σ l -> [AlgebraPattern σ l] -> AlgebraExpr σ l infixl 1 Source #
Apply a sequence of pattern-transformations, each in every spot possible, and yield the result concatenated to the original via the corresponding chain-operator. Because only the rightmost expression in a chain is processed, this can be iterated, giving a chain of intermediate results.