-- |
-- Module      : CAS.Dumb.LaTeX.Symbols
-- Copyright   : (c) Justus Sagemüller 2017
-- License     : GPL v3
-- 
-- Maintainer  : (@) jsag $ hvl.no
-- Stability   : experimental
-- Portability : portable
-- 
-- Orphan instances, allowing to construct CAS syntax trees
-- with LaTeX symbols.

{-# LANGUAGE OverloadedStrings    #-}
{-# LANGUAGE ScopedTypeVariables  #-}
{-# LANGUAGE UnicodeSyntax        #-}
{-# LANGUAGE FlexibleInstances    #-}
{-# LANGUAGE TypeFamilies         #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE PatternSynonyms      #-}
{-# LANGUAGE CPP                  #-}

module CAS.Dumb.LaTeX.Symbols ( fixateLaTeXAlgebraEncaps
                              , LaTeXMathEncapsulation(..) ) where

import CAS.Dumb.Tree
import CAS.Dumb.Symbols hiding (Negation, Reciprocal)

import Text.LaTeX
import Text.LaTeX.Base.Class
import Text.LaTeX.Base.Syntax
import Text.LaTeX.Packages.AMSMath
import Text.LaTeX.Packages.AMSFonts

import qualified Data.Text as Txt
import Data.String (IsString(..))
import Data.Char (isAlpha, isUpper, isLower)
import Data.Tuple (swap)

import Data.Ratio (denominator, numerator)
import Numeric.Literals.Decimal

import qualified Data.HashMap.Strict as Map
import Data.Hashable

import Control.Monad
import Control.Arrow (second)

import qualified Language.Haskell.TH as Hs


data LaTeXMathEncapsulation
       = Negation | Reciprocal | Subscript | Superscript
        | StdMathsFunc StdMathsFunc
 deriving (LaTeXMathEncapsulation -> LaTeXMathEncapsulation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LaTeXMathEncapsulation -> LaTeXMathEncapsulation -> Bool
$c/= :: LaTeXMathEncapsulation -> LaTeXMathEncapsulation -> Bool
== :: LaTeXMathEncapsulation -> LaTeXMathEncapsulation -> Bool
$c== :: LaTeXMathEncapsulation -> LaTeXMathEncapsulation -> Bool
Eq, Int -> LaTeXMathEncapsulation -> ShowS
[LaTeXMathEncapsulation] -> ShowS
LaTeXMathEncapsulation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LaTeXMathEncapsulation] -> ShowS
$cshowList :: [LaTeXMathEncapsulation] -> ShowS
show :: LaTeXMathEncapsulation -> String
$cshow :: LaTeXMathEncapsulation -> String
showsPrec :: Int -> LaTeXMathEncapsulation -> ShowS
$cshowsPrec :: Int -> LaTeXMathEncapsulation -> ShowS
Show)

data StdMathsFunc
   = Abs
   | ConventionalFunction Text
 deriving (StdMathsFunc -> StdMathsFunc -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StdMathsFunc -> StdMathsFunc -> Bool
$c/= :: StdMathsFunc -> StdMathsFunc -> Bool
== :: StdMathsFunc -> StdMathsFunc -> Bool
$c== :: StdMathsFunc -> StdMathsFunc -> Bool
Eq, Int -> StdMathsFunc -> ShowS
[StdMathsFunc] -> ShowS
StdMathsFunc -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StdMathsFunc] -> ShowS
$cshowList :: [StdMathsFunc] -> ShowS
show :: StdMathsFunc -> String
$cshow :: StdMathsFunc -> String
showsPrec :: Int -> StdMathsFunc -> ShowS
$cshowsPrec :: Int -> StdMathsFunc -> ShowS
Show)

type instance SpecialEncapsulation LaTeX = LaTeXMathEncapsulation

instance RenderableEncapsulations LaTeX where
  fixateAlgebraEncaps :: forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateAlgebraEncaps = forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps

showMagic :: Text -> LaTeX
showMagic :: Text -> LaTeX
showMagic Text
s = forall l. LaTeXC l => Text -> l
raw forall a b. (a -> b) -> a -> b
$ Text
"{"forall a. Semigroup a => a -> a -> a
<>Text
sforall a. Semigroup a => a -> a -> a
<>Text
"}"
matchShowMagic :: LaTeX -> Maybe Text
matchShowMagic :: LaTeX -> Maybe Text
matchShowMagic LaTeX
e = case forall a. Render a => a -> Text
render LaTeX
e of
    Text
s' | Text
"{"Text -> Text -> Bool
`Txt.isPrefixOf`Text
s'
       , Text
"}"Text -> Text -> Bool
`Txt.isSuffixOf`Text
s'  -> forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Int -> Text -> Text
Txt.drop Int
1
                                         forall a b. (a -> b) -> a -> b
$ Int -> Text -> Text
Txt.dropEnd Int
1 Text
s'
    Text
_           -> forall a. Maybe a
Nothing

fixateShowAlgebraEncaps ::  σ γ . (SymbolClass σ, SCConstraint σ LaTeX)
         => CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
          -> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps :: forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps (OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x
                         ((Infix LaTeX
o,Function (SpecialEncapsulation SpecialEncapsulation LaTeX
ι) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z):[(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
ys))
     | (Infix (Hs.Fixity Int
6 FixityDirection
Hs.InfixL) LaTeX
addSym', LaTeXMathEncapsulation
Negation) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
addSym' forall a. Eq a => a -> a -> Bool
== LaTeX
addSym
           = case forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps forall a b. (a -> b) -> a -> b
$ forall γ s² s¹ s⁰.
CAS' γ s² s¹ s⁰ -> [(s², CAS' γ s² s¹ s⁰)] -> CAS' γ s² s¹ s⁰
OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x [(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
ys of
               CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' -> forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
6 FixityDirection
Hs.InfixL) LaTeX
"-") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z'
     | (Infix (Hs.Fixity Int
7 FixityDirection
Hs.InfixL) LaTeX
mulSym', LaTeXMathEncapsulation
Reciprocal) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
mulSym' forall a. Eq a => a -> a -> Bool
== LaTeX
mulSym
           = case forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps forall a b. (a -> b) -> a -> b
$ forall γ s² s¹ s⁰.
CAS' γ s² s¹ s⁰ -> [(s², CAS' γ s² s¹ s⁰)] -> CAS' γ s² s¹ s⁰
OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x [(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
ys of
               CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' -> forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
7 FixityDirection
Hs.InfixL) forall a b. (a -> b) -> a -> b
$ Text -> LaTeX
showMagic Text
"/") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z'
   where [LaTeX
addSym, LaTeX
mulSym] = forall σ (p :: * -> *) c.
(SymbolClass σ, Functor p, SCConstraint σ c) =>
p σ -> Char -> c
fromCharSymbol ([]::[σ]) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String
"+*" :: [LaTeX]
         z' :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z' = forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z
fixateShowAlgebraEncaps (OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x []) = forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x
fixateShowAlgebraEncaps (OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x ((o :: Infix LaTeX
o@(Infix (Hs.Fixity Int
_ FixityDirection
Hs.InfixL) LaTeX
_), CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z):[(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
ys))
      = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator Infix LaTeX
o (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps forall a b. (a -> b) -> a -> b
$ forall γ s² s¹ s⁰.
CAS' γ s² s¹ s⁰ -> [(s², CAS' γ s² s¹ s⁰)] -> CAS' γ s² s¹ s⁰
OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x [(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
ys) (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z)
fixateShowAlgebraEncaps (Operator Infix LaTeX
o CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x (Function (SpecialEncapsulation SpecialEncapsulation LaTeX
ι) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y))
     | (Infix (Hs.Fixity Int
6 FixityDirection
Hs.InfixL) LaTeX
addSym', LaTeXMathEncapsulation
Negation) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
addSym' forall a. Eq a => a -> a -> Bool
== LaTeX
addSym
           = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
6 FixityDirection
Hs.InfixL) LaTeX
"-") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y'
     | (Infix (Hs.Fixity Int
7 FixityDirection
Hs.InfixL) LaTeX
mulSym', LaTeXMathEncapsulation
Reciprocal) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
mulSym' forall a. Eq a => a -> a -> Bool
== LaTeX
mulSym
           = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
7 FixityDirection
Hs.InfixL) forall a b. (a -> b) -> a -> b
$ Text -> LaTeX
showMagic Text
"/") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y'
     | (Infix Fixity
fxty LaTeX
catSym', LaTeXMathEncapsulation
Superscript) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
catSym' forall a. Eq a => a -> a -> Bool
== forall a. Monoid a => a
mempty
           = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix Fixity
fxty forall a b. (a -> b) -> a -> b
$ Text -> LaTeX
showMagic Text
"◝") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y'
     | (Infix Fixity
fxty LaTeX
catSym', LaTeXMathEncapsulation
Subscript) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
catSym' forall a. Eq a => a -> a -> Bool
== forall a. Monoid a => a
mempty
           = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix Fixity
fxty forall a b. (a -> b) -> a -> b
$ Text -> LaTeX
showMagic Text
"◞") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y'
   where [LaTeX
addSym, LaTeX
mulSym] = forall σ (p :: * -> *) c.
(SymbolClass σ, Functor p, SCConstraint σ c) =>
p σ -> Char -> c
fromCharSymbol ([]::[σ]) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String
"+*" :: [LaTeX]
         [CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x',CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y'] = forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncapsforall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>[CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x,CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y]
fixateShowAlgebraEncaps (Function (SpecialEncapsulation SpecialEncapsulation LaTeX
LaTeXMathEncapsulation
Negation) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
6 FixityDirection
Hs.InfixL) LaTeX
"-")
                (forall γ s² s¹ s⁰. s⁰ -> CAS' γ s² s¹ s⁰
Symbol forall a b. (a -> b) -> a -> b
$ forall σ c. c -> SymbolD σ c
StringSymbol LaTeX
" ") forall a b. (a -> b) -> a -> b
$ forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e
fixateShowAlgebraEncaps (Function (SpecialEncapsulation SpecialEncapsulation LaTeX
LaTeXMathEncapsulation
Reciprocal) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
7 FixityDirection
Hs.InfixL) forall a b. (a -> b) -> a -> b
$ Text -> LaTeX
showMagic Text
"/")
               (forall γ s² s¹ s⁰. s⁰ -> CAS' γ s² s¹ s⁰
Symbol forall a b. (a -> b) -> a -> b
$ forall σ c. Integer -> SymbolD σ c
NatSymbol Integer
1)
               (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
fixateShowAlgebraEncaps (Function (SpecialEncapsulation SpecialEncapsulation LaTeX
LaTeXMathEncapsulation
Superscript) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
7 FixityDirection
Hs.InfixL) forall a b. (a -> b) -> a -> b
$ Text -> LaTeX
showMagic Text
"◝")
               (forall γ s² s¹ s⁰. s⁰ -> CAS' γ s² s¹ s⁰
Symbol forall a b. (a -> b) -> a -> b
$ forall σ c. c -> SymbolD σ c
StringSymbol LaTeX
"\"\"")
               (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
fixateShowAlgebraEncaps (Function (SpecialEncapsulation SpecialEncapsulation LaTeX
LaTeXMathEncapsulation
Subscript) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
7 FixityDirection
Hs.InfixL) forall a b. (a -> b) -> a -> b
$ Text -> LaTeX
showMagic Text
"◞")
               (forall γ s² s¹ s⁰. s⁰ -> CAS' γ s² s¹ s⁰
Symbol forall a b. (a -> b) -> a -> b
$ forall σ c. c -> SymbolD σ c
StringSymbol LaTeX
"\"\"")
               (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
fixateShowAlgebraEncaps (StdMathFn StdMathsFunc
Abs CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall l γ σ.
(l ~ LaTeX) =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
haskellFunction Text
"abs" forall a b. (a -> b) -> a -> b
$ forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e
fixateShowAlgebraEncaps (ConventionalMathFn Text
f CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall l γ σ.
(l ~ LaTeX) =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
haskellFunction Text
f forall a b. (a -> b) -> a -> b
$ forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e
fixateShowAlgebraEncaps (Function Encapsulation LaTeX
f CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e) = forall γ s² s¹ s⁰. s¹ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Function Encapsulation LaTeX
f forall a b. (a -> b) -> a -> b
$ forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e
fixateShowAlgebraEncaps (Operator Infix LaTeX
o CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y)
        = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator Infix LaTeX
o (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x) (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y)
fixateShowAlgebraEncaps (OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x₀ [(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
oys)
        = forall γ s² s¹ s⁰.
CAS' γ s² s¹ s⁰ -> [(s², CAS' γ s² s¹ s⁰)] -> CAS' γ s² s¹ s⁰
OperatorChain (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x₀) (forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (d, b) (d, c)
second forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateShowAlgebraEncaps forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
oys)
fixateShowAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e = CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e

fixateLaTeXAlgebraEncaps ::  σ γ . (SymbolClass σ, SCConstraint σ LaTeX)
         => CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
          -> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps :: forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps (OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x
                         ((Infix LaTeX
o,Function (SpecialEncapsulation SpecialEncapsulation LaTeX
ι) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z):[(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
ys))
     | (Infix (Hs.Fixity Int
6 FixityDirection
Hs.InfixL) LaTeX
addSym', LaTeXMathEncapsulation
Negation) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
addSym' forall a. Eq a => a -> a -> Bool
== LaTeX
addSym
           = case forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps forall a b. (a -> b) -> a -> b
$ forall γ s² s¹ s⁰.
CAS' γ s² s¹ s⁰ -> [(s², CAS' γ s² s¹ s⁰)] -> CAS' γ s² s¹ s⁰
OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x [(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
ys of
               CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' -> forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
6 FixityDirection
Hs.InfixL) LaTeX
"-") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z'
     | (Infix (Hs.Fixity Int
7 FixityDirection
Hs.InfixL) LaTeX
mulSym', LaTeXMathEncapsulation
Reciprocal) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
mulSym' forall a. Eq a => a -> a -> Bool
== LaTeX
mulSym
           = case forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps forall a b. (a -> b) -> a -> b
$ forall γ s² s¹ s⁰.
CAS' γ s² s¹ s⁰ -> [(s², CAS' γ s² s¹ s⁰)] -> CAS' γ s² s¹ s⁰
OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x [(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
ys of
               CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' -> forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
8 FixityDirection
Hs.InfixL) forall a. Monoid a => a
mempty)
                  (forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw Text
"\\frac{") (forall l. LaTeXC l => Text -> l
raw Text
"}") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x')
                  (forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw       Text
"{") (forall l. LaTeXC l => Text -> l
raw Text
"}") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z')
   where [LaTeX
addSym, LaTeX
mulSym] = forall σ (p :: * -> *) c.
(SymbolClass σ, Functor p, SCConstraint σ c) =>
p σ -> Char -> c
fromCharSymbol ([]::[σ]) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String
"+*" :: [LaTeX]
         z' :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z' = forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z
fixateLaTeXAlgebraEncaps (OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x []) = forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x
fixateLaTeXAlgebraEncaps (OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x ((o :: Infix LaTeX
o@(Infix (Hs.Fixity Int
_ FixityDirection
Hs.InfixL) LaTeX
_), CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z):[(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
ys))
      = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator Infix LaTeX
o (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps forall a b. (a -> b) -> a -> b
$ forall γ s² s¹ s⁰.
CAS' γ s² s¹ s⁰ -> [(s², CAS' γ s² s¹ s⁰)] -> CAS' γ s² s¹ s⁰
OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x [(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
ys) (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
z)
fixateLaTeXAlgebraEncaps (Operator Infix LaTeX
o CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x (Function (SpecialEncapsulation SpecialEncapsulation LaTeX
ι) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y))
     | (Infix (Hs.Fixity Int
6 FixityDirection
Hs.InfixL) LaTeX
addSym', LaTeXMathEncapsulation
Negation) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
addSym' forall a. Eq a => a -> a -> Bool
== LaTeX
addSym
           = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
6 FixityDirection
Hs.InfixL) LaTeX
"-") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x' CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y'
     | (Infix (Hs.Fixity Int
7 FixityDirection
Hs.InfixL) LaTeX
mulSym', LaTeXMathEncapsulation
Reciprocal) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
mulSym' forall a. Eq a => a -> a -> Bool
== LaTeX
mulSym
           = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
8 FixityDirection
Hs.InfixL) forall a. Monoid a => a
mempty)
                  (forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw Text
"\\frac{") (forall l. LaTeXC l => Text -> l
raw Text
"}") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x')
                  (forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw       Text
"{") (forall l. LaTeXC l => Text -> l
raw Text
"}") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y')
     | (Infix Fixity
fxty LaTeX
catSym', LaTeXMathEncapsulation
Superscript) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
catSym' forall a. Eq a => a -> a -> Bool
== forall a. Monoid a => a
mempty
           = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix Fixity
fxty (forall l. LaTeXC l => Text -> l
raw Text
"^"))
                  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x'
                  (forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw       Text
"{") (forall l. LaTeXC l => Text -> l
raw Text
"}") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y')
     | (Infix Fixity
fxty LaTeX
catSym', LaTeXMathEncapsulation
Subscript) <- (Infix LaTeX
o,SpecialEncapsulation LaTeX
ι)
     , LaTeX
catSym' forall a. Eq a => a -> a -> Bool
== forall a. Monoid a => a
mempty
           = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix Fixity
fxty (forall l. LaTeXC l => Text -> l
raw Text
"_"))
                  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x'
                  (forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw       Text
"{") (forall l. LaTeXC l => Text -> l
raw Text
"}") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y')
   where [LaTeX
addSym, LaTeX
mulSym] = forall σ (p :: * -> *) c.
(SymbolClass σ, Functor p, SCConstraint σ c) =>
p σ -> Char -> c
fromCharSymbol ([]::[σ]) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String
"+*" :: [LaTeX]
         [CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x',CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y'] = forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncapsforall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>[CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x,CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y]
fixateLaTeXAlgebraEncaps (Function (SpecialEncapsulation SpecialEncapsulation LaTeX
LaTeXMathEncapsulation
Negation) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
6 FixityDirection
Hs.InfixL) LaTeX
"-")
                (forall γ s² s¹ s⁰. s⁰ -> CAS' γ s² s¹ s⁰
Symbol forall a b. (a -> b) -> a -> b
$ forall σ c. c -> SymbolD σ c
StringSymbol LaTeX
" ") forall a b. (a -> b) -> a -> b
$ forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e
fixateLaTeXAlgebraEncaps (Function (SpecialEncapsulation SpecialEncapsulation LaTeX
LaTeXMathEncapsulation
Reciprocal) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
8 FixityDirection
Hs.InfixL) forall a. Monoid a => a
mempty)
               (forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw Text
"\\frac{") (forall l. LaTeXC l => Text -> l
raw Text
"}") forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall γ s² s¹ s⁰. s⁰ -> CAS' γ s² s¹ s⁰
Symbol forall a b. (a -> b) -> a -> b
$ forall σ c. Integer -> SymbolD σ c
NatSymbol Integer
1)
               (forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw       Text
"{") (forall l. LaTeXC l => Text -> l
raw Text
"}") forall a b. (a -> b) -> a -> b
$ forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
fixateLaTeXAlgebraEncaps (Function (SpecialEncapsulation SpecialEncapsulation LaTeX
LaTeXMathEncapsulation
Superscript) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw Text
"{}^{") (forall l. LaTeXC l => Text -> l
raw Text
"}") forall a b. (a -> b) -> a -> b
$ forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e
fixateLaTeXAlgebraEncaps (Function (SpecialEncapsulation SpecialEncapsulation LaTeX
LaTeXMathEncapsulation
Subscript) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw Text
"{}_{") (forall l. LaTeXC l => Text -> l
raw Text
"}") forall a b. (a -> b) -> a -> b
$ forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e
fixateLaTeXAlgebraEncaps (StdMathFn StdMathsFunc
Abs CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw Text
"\\left|") (forall l. LaTeXC l => Text -> l
raw Text
"\\right|") forall a b. (a -> b) -> a -> b
$ forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e
fixateLaTeXAlgebraEncaps (ConventionalMathFn Text
f CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e)
            = forall l γ σ.
LaTeXC l =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
latexFunction (Text
"\\"forall a. Semigroup a => a -> a -> a
<>Text
f) forall a b. (a -> b) -> a -> b
$ forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e
fixateLaTeXAlgebraEncaps (Function Encapsulation LaTeX
f CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e) = forall γ s² s¹ s⁰. s¹ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Function Encapsulation LaTeX
f forall a b. (a -> b) -> a -> b
$ forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e
fixateLaTeXAlgebraEncaps (Operator Infix LaTeX
o CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y)
        = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator Infix LaTeX
o (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x) (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
y)
fixateLaTeXAlgebraEncaps (OperatorChain CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x₀ [(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
oys)
        = forall γ s² s¹ s⁰.
CAS' γ s² s¹ s⁰ -> [(s², CAS' γ s² s¹ s⁰)] -> CAS' γ s² s¹ s⁰
OperatorChain (forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
x₀) (forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (d, b) (d, c)
second forall σ γ.
(SymbolClass σ, SCConstraint σ LaTeX) =>
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fixateLaTeXAlgebraEncaps forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(Infix LaTeX,
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))]
oys)
fixateLaTeXAlgebraEncaps CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e = CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
e


instance ASCIISymbols LaTeX where
  fromASCIISymbol :: Char -> LaTeX
fromASCIISymbol Char
c
   | Just LaTeX
lc <- forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
Map.lookup Char
c HashMap Char LaTeX
mappingFromASCII  = LaTeX
lc
   | Bool
otherwise  = forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"ASCII symbol '"forall a. [a] -> [a] -> [a]
++[Char
c]forall a. [a] -> [a] -> [a]
++String
"' not supported in LaTeX expressions."
  toASCIISymbols :: LaTeX -> String
toASCIISymbols LaTeX
lc
   | Just Char
c <- forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
Map.lookup LaTeX
lc HashMap LaTeX Char
mappingToASCII    = [Char
c]
   | LaTeX
lcforall a. Eq a => a -> a -> Bool
==forall a. Monoid a => a
mempty  = String
""
   | Just Text
s' <- LaTeX -> Maybe Text
matchShowMagic LaTeX
lc  = Text -> String
Txt.unpack Text
s'
   | Bool
otherwise   = String
"《"forall a. [a] -> [a] -> [a]
++Text -> String
Txt.unpack(forall a. Render a => a -> Text
render LaTeX
lc)forall a. [a] -> [a] -> [a]
++String
"》"

mappingFromASCII :: Map.HashMap Char LaTeX
mappingToASCII :: Map.HashMap LaTeX Char
InvertibleMap HashMap Char LaTeX
mappingFromASCII HashMap LaTeX Char
mappingToASCII
   = (LaTeX -> LaTeX) -> String -> String -> InvertibleMap Char LaTeX
mapToLaTeXWith forall a. a -> a
id     [Char
'a'..Char
'z']
                           [Char
'a'..Char
'z']
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> (LaTeX -> LaTeX) -> String -> String -> InvertibleMap Char LaTeX
mapToLaTeXWith forall a. a -> a
id     [Char
'A'..Char
'Z']
                           [Char
'A'..Char
'Z']
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
[(a, b)] -> InvertibleMap a b
fromAssocList (forall a b. [a] -> [b] -> [(a, b)]
zip
           [Char
'+', Char
'-', Char
'*']
           [LaTeX
"+", LaTeX
"-", forall l. LaTeXC l => Text -> l
rawText
"{\\cdot}"])

instance UnicodeSymbols LaTeX where
  fromUnicodeSymbol :: Char -> LaTeX
fromUnicodeSymbol Char
c
   | Just LaTeX
lc <- forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
Map.lookup Char
c HashMap Char LaTeX
mappingFromUnicode  = LaTeX
lc
   | Bool
otherwise  = forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Unicode symbol '"forall a. [a] -> [a] -> [a]
++[Char
c]forall a. [a] -> [a] -> [a]
++String
"' not supported in LaTeX expressions."
  toUnicodeSymbols :: LaTeX -> String
toUnicodeSymbols LaTeX
lc
   | Just Char
c <- forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
Map.lookup LaTeX
lc HashMap LaTeX Char
mappingToUnicode    = [Char
c]
   | LaTeX
lcforall a. Eq a => a -> a -> Bool
==forall a. Monoid a => a
mempty  = String
""
   | Just Text
s' <- LaTeX -> Maybe Text
matchShowMagic LaTeX
lc  = Text -> String
Txt.unpack Text
s'
   | Bool
otherwise   = String
"《"forall a. [a] -> [a] -> [a]
++Text -> String
Txt.unpack(forall a. Render a => a -> Text
render LaTeX
lc)forall a. [a] -> [a] -> [a]
++String
"》"
  
mappingFromUnicode :: Map.HashMap Char LaTeX
mappingToUnicode :: Map.HashMap LaTeX Char
InvertibleMap HashMap Char LaTeX
mappingFromUnicode HashMap LaTeX Char
mappingToUnicode
   = (LaTeX -> LaTeX) -> String -> String -> InvertibleMap Char LaTeX
mapToLaTeXWith forall a. a -> a
id     String
"𝑎𝑏𝑐𝑑𝑒𝑓𝑔ℎ𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧"
                           String
"abcdefghijklmnopqrstuvwxyz"
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> (LaTeX -> LaTeX) -> String -> String -> InvertibleMap Char LaTeX
mapToLaTeXWith forall l. LaTeXC l => l -> l
mathbf [Char
'𝐚'..Char
'𝐳']
                           [Char
'a'..Char
'z']
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> (LaTeX -> LaTeX) -> String -> String -> InvertibleMap Char LaTeX
mapToLaTeXWith forall a. a -> a
id     [Char
'𝐴'..Char
'𝑍']
                           [Char
'A'..Char
'Z']
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> (LaTeX -> LaTeX) -> String -> String -> InvertibleMap Char LaTeX
mapToLaTeXWith forall l. LaTeXC l => l -> l
mathbf [Char
'𝐀'..Char
'𝐙']
                           [Char
'A'..Char
'Z']
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> (LaTeX -> LaTeX) -> String -> String -> InvertibleMap Char LaTeX
mapToLaTeXWith forall l. LaTeXC l => l -> l
mathbb String
"ℂℍℚℝℤℕ"
                           String
"CHQRZN"
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> (LaTeX -> LaTeX) -> String -> String -> InvertibleMap Char LaTeX
mapToLaTeXWith forall l. LaTeXC l => l -> l
mathcal [Char
'𝓐'..Char
'𝓩']
                            [Char
'A'..Char
'Z']
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> (LaTeX -> LaTeX) -> String -> String -> InvertibleMap Char LaTeX
mapToLaTeXWith forall l. LaTeXC l => l -> l
mathfrak String
"𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜ℨ"
                             String
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> (LaTeX -> LaTeX) -> String -> String -> InvertibleMap Char LaTeX
mapToLaTeXWith forall l. LaTeXC l => l -> l
mathfrak String
"𝔞𝔟𝔠𝔡𝔢𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪𝔫𝔬𝔭𝔮𝔯𝔰𝔱𝔲𝔳𝔴𝔵𝔶𝔷"
                             String
"abcdefghijklmnopqrstuvwxyz"
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
[(a, b)] -> InvertibleMap a b
fromAssocList (forall a b. [a] -> [b] -> [(a, b)]
zip
           [Char
'α',  Char
'β', Char
'γ',  Char
'δ',  Char
'ε',       Char
'ζ', Char
'η',Char
'θ',  Char
'ϑ',     Char
'ι', Char
'κ',  Char
'λ'   ]
           [forall l. LaTeXC l => l
alpha,forall l. LaTeXC l => l
beta,forall l. LaTeXC l => l
gamma,forall l. LaTeXC l => l
delta,forall l. LaTeXC l => l
varepsilon,forall l. LaTeXC l => l
zeta,forall l. LaTeXC l => l
eta,forall l. LaTeXC l => l
theta,forall l. LaTeXC l => l
vartheta,forall l. LaTeXC l => l
iota,forall l. LaTeXC l => l
kappa,forall l. LaTeXC l => l
lambda])
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
[(a, b)] -> InvertibleMap a b
fromAssocList (forall a b. [a] -> [b] -> [(a, b)]
zip
           [Char
'μ',Char
'ν',Char
'ξ',Char
'π',Char
'ρ',Char
'ϱ',   Char
'σ',  Char
'ς',     Char
'τ',Char
'υ',    Char
'ϕ',Char
'φ',   Char
'χ',Char
'ψ', Char
'ω' ]
           [forall l. LaTeXC l => l
mu, forall l. LaTeXC l => l
nu, forall l. LaTeXC l => l
xi, forall a. Floating a => a
pi, forall l. LaTeXC l => l
rho,forall l. LaTeXC l => l
varrho,forall l. LaTeXC l => l
sigma,forall l. LaTeXC l => l
varsigma,forall l. LaTeXC l => l
tau,forall l. LaTeXC l => l
upsilon,forall l. LaTeXC l => l
phi,forall l. LaTeXC l => l
varphi,forall l. LaTeXC l => l
chi,forall l. LaTeXC l => l
psi,forall l. LaTeXC l => l
omega])
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
[(a, b)] -> InvertibleMap a b
fromAssocList (forall a b. [a] -> [b] -> [(a, b)]
zip
           [Char
'Γ',   Char
'Δ',   Char
'Θ',   Char
'Λ',    Char
'Ξ',Char
'Π',Char
'Σ',   Char
'Υ',     Char
'Φ', Char
'Ψ', Char
'Ω'   ]
           [forall l. LaTeXC l => l
gammau,forall l. LaTeXC l => l
deltau,forall l. LaTeXC l => l
thetau,forall l. LaTeXC l => l
lambdau,forall l. LaTeXC l => l
xiu,forall l. LaTeXC l => l
piu,forall l. LaTeXC l => l
sigmau,forall l. LaTeXC l => l
upsilonu,forall l. LaTeXC l => l
phiu,forall l. LaTeXC l => l
psiu,forall l. LaTeXC l => l
omegau])
 forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|> forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
[(a, b)] -> InvertibleMap a b
fromAssocList (forall a b. [a] -> [b] -> [(a, b)]
zip
           [Char
'+', Char
'-', Char
'*',           Char
'±',         Char
'∓'        ]
           [LaTeX
"+", LaTeX
"-", forall l. LaTeXC l => Text -> l
rawText
"{\\cdot}", forall l. LaTeXC l => Text -> l
rawText
"{\\pm}", forall l. LaTeXC l => Text -> l
rawText
"{\\mp}"])

remapWith :: (a->b) -> [a] -> [a] -> [(a, b)]
remapWith :: forall a b. (a -> b) -> [a] -> [a] -> [(a, b)]
remapWith a -> b
f = forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith (\a
lc a
rc -> (a
lc, a -> b
f a
rc))

mapToLaTeXWith :: (LaTeX->LaTeX) -> [Char] -> [Char] -> InvertibleMap Char LaTeX
mapToLaTeXWith :: (LaTeX -> LaTeX) -> String -> String -> InvertibleMap Char LaTeX
mapToLaTeXWith LaTeX -> LaTeX
f String
l String
r = forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
[(a, b)] -> InvertibleMap a b
fromAssocList forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [a] -> [(a, b)]
remapWith (LaTeX -> LaTeX
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. IsString a => String -> a
fromString forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a. Applicative f => a -> f a
pure) String
l String
r



data InvertibleMap a b = InvertibleMap {
      forall a b. InvertibleMap a b -> HashMap a b
fwdMapping :: Map.HashMap a b
    , forall a b. InvertibleMap a b -> HashMap b a
revMapping :: Map.HashMap b a
    }

fromAssocList :: (Hashable a, Hashable b, Eq a, Eq b)
                 => [(a,b)] -> InvertibleMap a b
fromAssocList :: forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
[(a, b)] -> InvertibleMap a b
fromAssocList [(a, b)]
assocs = forall a b. HashMap a b -> HashMap b a -> InvertibleMap a b
InvertibleMap (forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
Map.fromList [(a, b)]
assocs) (forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
Map.fromList forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map forall a b. (a, b) -> (b, a)
swap [(a, b)]
assocs)

infixl 3 <|>
(<|>) :: (Hashable a, Hashable b, Eq a, Eq b)
                 => InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
InvertibleMap HashMap a b
af HashMap b a
ar<|> :: forall a b.
(Hashable a, Hashable b, Eq a, Eq b) =>
InvertibleMap a b -> InvertibleMap a b -> InvertibleMap a b
<|>InvertibleMap HashMap a b
bf HashMap b a
br
   = forall a b. HashMap a b -> HashMap b a -> InvertibleMap a b
InvertibleMap (forall k v.
(Eq k, Hashable k) =>
HashMap k v -> HashMap k v -> HashMap k v
Map.union HashMap a b
af HashMap a b
bf) (forall k v.
(Eq k, Hashable k) =>
HashMap k v -> HashMap k v -> HashMap k v
Map.union HashMap b a
ar HashMap b a
br)

encapsulation :: l -> l
              -> (CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l))
              -> (CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l))
encapsulation :: forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation l
l l
r = forall γ s² s¹ s⁰. s¹ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Function forall a b. (a -> b) -> a -> b
$ forall s. Bool -> Bool -> s -> s -> Encapsulation s
Encapsulation Bool
False Bool
True l
l l
r

latexFunction :: LaTeXC l
              => Text
              -> (CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l))
              -> (CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l))
latexFunction :: forall l γ σ.
LaTeXC l =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
latexFunction Text
f = forall γ s² s¹ s⁰. s¹ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Function forall a b. (a -> b) -> a -> b
$ forall s. Bool -> Bool -> s -> s -> Encapsulation s
Encapsulation Bool
True Bool
False (forall l. LaTeXC l => Text -> l
raw forall a b. (a -> b) -> a -> b
$ Text
fforall a. Semigroup a => a -> a -> a
<>Text
"{") (forall l. LaTeXC l => Text -> l
raw Text
"}")

haskellFunction :: l ~ LaTeX
              => Text
              -> (CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l))
              -> (CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l))
haskellFunction :: forall l γ σ.
(l ~ LaTeX) =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
haskellFunction Text
f
    = forall γ s² s¹ s⁰. s¹ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Function forall a b. (a -> b) -> a -> b
$ forall s. Bool -> Bool -> s -> s -> Encapsulation s
Encapsulation Bool
True Bool
False (Text -> LaTeX
showMagic forall a b. (a -> b) -> a -> b
$ Text
fforall a. Semigroup a => a -> a -> a
<>Text
" ") forall a. Monoid a => a
mempty

pattern StdMathFn :: 
           StdMathsFunc -> (CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))
                        -> (CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))
pattern $bStdMathFn :: forall γ σ.
StdMathsFunc
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
$mStdMathFn :: forall {r} {γ} {σ}.
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> (StdMathsFunc
    -> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
    -> r)
-> ((# #) -> r)
-> r
StdMathFn f e = Function (SpecialEncapsulation (StdMathsFunc f)) e

pattern ConventionalMathFn :: 
           Text -> (CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))
                        -> (CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX))
pattern $bConventionalMathFn :: forall γ σ.
Text
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
$mConventionalMathFn :: forall {r} {γ} {σ}.
CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> (Text
    -> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
    -> r)
-> ((# #) -> r)
-> r
ConventionalMathFn f e = StdMathFn (ConventionalFunction f) e

instance  σ γ . (SymbolClass σ, SCConstraint σ LaTeX)
          => Num (CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)) where
  fromInteger :: Integer
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fromInteger Integer
n
   | Integer
nforall a. Ord a => a -> a -> Bool
<Integer
0        = forall a. Num a => a -> a
negate forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger forall a b. (a -> b) -> a -> b
$ -Integer
n
   | Bool
otherwise  = forall γ s² s¹ s⁰. s⁰ -> CAS' γ s² s¹ s⁰
Symbol forall a b. (a -> b) -> a -> b
$ forall σ c. Integer -> SymbolD σ c
NatSymbol Integer
n
  + :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
(+) = forall s² γ s¹ s⁰.
(s² -> Bool)
-> s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
chainableInfixL (forall a. Eq a => a -> a -> Bool
==Infix LaTeX
plusOp) Infix LaTeX
plusOp
   where fcs :: Char -> LaTeX
fcs = forall σ (p :: * -> *) c.
(SymbolClass σ, Functor p, SCConstraint σ c) =>
p σ -> Char -> c
fromCharSymbol ([]::[σ])
         plusOp :: Infix LaTeX
plusOp = forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
6 FixityDirection
Hs.InfixL) forall a b. (a -> b) -> a -> b
$ Char -> LaTeX
fcs Char
'+'
  * :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
(*) = forall s² γ s¹ s⁰.
(s² -> Bool)
-> s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
chainableInfixL (forall a. Eq a => a -> a -> Bool
==Infix LaTeX
mulOp) Infix LaTeX
mulOp
   where fcs :: Char -> LaTeX
fcs = forall σ (p :: * -> *) c.
(SymbolClass σ, Functor p, SCConstraint σ c) =>
p σ -> Char -> c
fromCharSymbol ([]::[σ])
         mulOp :: Infix LaTeX
mulOp = forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
7 FixityDirection
Hs.InfixL) forall a b. (a -> b) -> a -> b
$ Char -> LaTeX
fcs Char
'*'
  abs :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
abs = forall γ σ.
StdMathsFunc
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
StdMathFn StdMathsFunc
Abs
  signum :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
signum = forall l γ σ.
LaTeXC l =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
latexFunction Text
"\\signum"
  negate :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
negate = forall γ s² s¹ s⁰. s¹ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Function forall a b. (a -> b) -> a -> b
$ forall s. SpecialEncapsulation s -> Encapsulation s
SpecialEncapsulation LaTeXMathEncapsulation
Negation

instance  σ γ . (SymbolClass σ, SCConstraint σ LaTeX)
     => Fractional (CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)) where
  fromRational :: Rational
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
fromRational Rational
n = case forall a. Fractional a => Rational -> a
fromRational Rational
n of
     Integer
n:%Integer
d -> forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
n forall a. Fractional a => a -> a -> a
/ forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
d
     Scientific Int
pc [B₁₀Digit]
acs Int
e -> let m :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
m = forall γ s² s¹ s⁰. s⁰ -> CAS' γ s² s¹ s⁰
Symbol (forall σ c. c -> SymbolD σ c
StringSymbol forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. IsString a => String -> a
fromString
                                     forall a b. (a -> b) -> a -> b
$ forall a. Show a => a -> String
show Int
pcforall a. [a] -> [a] -> [a]
++
                                       if forall (t :: * -> *) a. Foldable t => t a -> Bool
null [B₁₀Digit]
acs then String
""
                                                   else String
"."forall a. [a] -> [a] -> [a]
++(forall a. Show a => a -> String
showforall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<<[B₁₀Digit]
acs))
                            in if Int
eforall a. Eq a => a -> a -> Bool
==Int
0 then CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
m
                                       else CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
m forall a. Num a => a -> a -> a
* CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
10forall a. Floating a => a -> a -> a
**forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
e
  recip :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
recip = forall γ s² s¹ s⁰. s¹ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Function forall a b. (a -> b) -> a -> b
$ forall s. SpecialEncapsulation s -> Encapsulation s
SpecialEncapsulation LaTeXMathEncapsulation
Reciprocal


instance  σ γ . (SymbolClass σ, SCConstraint σ LaTeX)
     => Floating (CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)) where
  pi :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
pi = forall γ s² s¹ s⁰. s⁰ -> CAS' γ s² s¹ s⁰
Symbol forall a b. (a -> b) -> a -> b
$ forall σ c. c -> SymbolD σ c
StringSymbol forall l. LaTeXC l => l
pi_
  sqrt :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
sqrt = forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw Text
"\\sqrt{") (forall l. LaTeXC l => Text -> l
raw Text
"}")
  CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
a ** :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
** CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
b = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
8 FixityDirection
Hs.InfixR) forall a. Monoid a => a
mempty)
             CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
a (forall γ s² s¹ s⁰. s¹ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Function (forall s. SpecialEncapsulation s -> Encapsulation s
SpecialEncapsulation LaTeXMathEncapsulation
Superscript) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
b)
  logBase :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
logBase CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
b CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
a = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator (forall s. Fixity -> s -> Infix s
Infix (Int -> FixityDirection -> Fixity
Hs.Fixity Int
10 FixityDirection
Hs.InfixL) forall a. Monoid a => a
mempty)
                  (forall l γ σ.
l
-> l
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
encapsulation (forall l. LaTeXC l => Text -> l
raw Text
"\\log_{") (forall l. LaTeXC l => Text -> l
raw Text
"}") CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
b) CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
a
  exp :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
exp = forall γ σ.
Text
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
ConventionalMathFn Text
"exp"
  log :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
log = forall γ σ.
Text
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
ConventionalMathFn Text
"log"
  sin :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
sin = forall γ σ.
Text
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
ConventionalMathFn Text
"sin"
  cos :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
cos = forall γ σ.
Text
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
ConventionalMathFn Text
"cos"
  tan :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
tan = forall γ σ.
Text
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
ConventionalMathFn Text
"tan"
  asin :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
asin = forall l γ σ.
LaTeXC l =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
latexFunction Text
"\\arcsin"
  acos :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
acos = forall l γ σ.
LaTeXC l =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
latexFunction Text
"\\arccos"
  atan :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
atan = forall l γ σ.
LaTeXC l =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
latexFunction Text
"\\arctan"
  sinh :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
sinh = forall γ σ.
Text
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
ConventionalMathFn Text
"sinh"
  cosh :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
cosh = forall γ σ.
Text
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
ConventionalMathFn Text
"cosh"
  tanh :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
tanh = forall γ σ.
Text
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
ConventionalMathFn Text
"tanh"
  asinh :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
asinh = forall l γ σ.
LaTeXC l =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
latexFunction Text
"\\operatorname{arsinh}"
  acosh :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
acosh = forall l γ σ.
LaTeXC l =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
latexFunction Text
"\\operatorname{arcosh}"
  atanh :: CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
-> CAS' γ (Infix LaTeX) (Encapsulation LaTeX) (SymbolD σ LaTeX)
atanh = forall l γ σ.
LaTeXC l =>
Text
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
-> CAS' γ (Infix l) (Encapsulation l) (SymbolD σ l)
latexFunction Text
"\\operatorname{artanh}"



instance Eq (Encapsulation LaTeX) where
  Encapsulation Bool
_ Bool
_ LaTeX
l LaTeX
r == :: Encapsulation LaTeX -> Encapsulation LaTeX -> Bool
== Encapsulation Bool
_ Bool
_ LaTeX
l' LaTeX
r'
         = LaTeX
lforall a. Eq a => a -> a -> Bool
==LaTeX
l' Bool -> Bool -> Bool
&& LaTeX
rforall a. Eq a => a -> a -> Bool
==LaTeX
r'
  SpecialEncapsulation SpecialEncapsulation LaTeX
e == SpecialEncapsulation SpecialEncapsulation LaTeX
e' = SpecialEncapsulation LaTeX
eforall a. Eq a => a -> a -> Bool
==SpecialEncapsulation LaTeX
e'
  Encapsulation LaTeX
_ == Encapsulation LaTeX
_ = Bool
False