-- |
-- Module      : CAS.Dumb.Symbols.Unicode.MathLatin_RomanGreek__BopomofoGaps
-- Copyright   : (c) Justus Sagemüller 2017
-- License     : GPL v3
-- 
-- Maintainer  : (@) jsag $ hvl.no
-- Stability   : experimental
-- Portability : portable
-- 
-- This module contains a collection of symbols that should be sufficient for usage
-- in most algebra applications. It avoids polluting the namespace with single-letter
-- variables (which are often used as local variables, leading to shadowing issues),
-- by replacing also the Latin letters with less common Unicode symbols. If you're
-- not concerned with this and prefer symbols that can directly be entered on any
-- Western keyboard, use the "CAS.Dumb.Symbols.ASCII" module instead.

{-# LANGUAGE PatternSynonyms       #-}
{-# LANGUAGE FlexibleInstances     #-}
{-# LANGUAGE ScopedTypeVariables   #-}
{-# LANGUAGE TypeFamilies          #-}
{-# LANGUAGE UnicodeSyntax         #-}
{-# LANGUAGE TemplateHaskell       #-}
{-# LANGUAGE CPP                   #-}

module CAS.Dumb.Symbols.Unicode.MathLatin_RomanGreek__BopomofoGaps (
          module CAS.Dumb.Symbols
        , Unicode_MathLatin_RomanGreek__BopomofoGaps, Symbol, Expression, Pattern
        -- * “Constant variable” symbols
        -- ** Lowercase letters
        -- $UnicodeMathSymHelp
        -- *** Italic Latin
        , 𝑎,𝑏,𝑐,𝑑,𝑒,𝑓,𝑔,,𝑖,𝑗,𝑘,𝑙,𝑚,𝑛,𝑜,𝑝,𝑞,𝑟,𝑠,𝑡,𝑢,𝑣,𝑤,𝑥,𝑦,𝑧
        -- *** Bold
        , 𝐚,𝐛,𝐜,𝐝,𝐞,𝐟,𝐠,𝐡,𝐢,𝐣,𝐤,𝐥,𝐦,𝐧,𝐨,𝐩,𝐪,𝐫,𝐬,𝐭,𝐮,𝐯,𝐰,𝐱,𝐲,𝐳
        -- *** Fraktur
        , 𝔞,𝔟,𝔠,𝔡,𝔢,𝔣,𝔤,𝔥,𝔦,𝔧,𝔨,𝔩,𝔪,𝔫,𝔬,𝔭,𝔮,𝔯,𝔰,𝔱,𝔲,𝔳,𝔴,𝔵,𝔶,𝔷
        -- *** Greek
        , α,β,γ,δ,ε,ζ,η,θ,ϑ,ι,κ,λ,μ,ν,ξ,ο,π,ρ,ϱ,σ,ς,τ,υ,ϕ,φ,χ,ψ,ω
        -- ** Uppercase letters
        -- $uppercaseCaveat
#if __GLASGOW_HASKELL__ > 801
        -- *** Italic
        , pattern 𝐴, pattern 𝐵, pattern 𝐶, pattern 𝐷, pattern 𝐸, pattern 𝐹, pattern 𝐺, pattern 𝐻, pattern 𝐼, pattern 𝐽, pattern 𝐾, pattern 𝐿, pattern 𝑀, pattern 𝑁, pattern 𝑂, pattern 𝑃, pattern 𝑄, pattern 𝑅, pattern 𝑆, pattern 𝑇, pattern 𝑈, pattern 𝑉, pattern 𝑊, pattern 𝑋, pattern 𝑌, pattern 𝑍
        -- *** Bold
        , pattern 𝐀, pattern 𝐁, pattern 𝐂, pattern 𝐃, pattern 𝐄, pattern 𝐅, pattern 𝐆, pattern 𝐇, pattern 𝐈, pattern 𝐉, pattern 𝐊, pattern 𝐋, pattern 𝐌, pattern 𝐍, pattern 𝐎, pattern 𝐏, pattern 𝐐, pattern 𝐑, pattern 𝐒, pattern 𝐓, pattern 𝐔, pattern 𝐕, pattern 𝐖, pattern 𝐗, pattern 𝐘, pattern 𝐙
        -- *** Blackboard (LaTeX subset)
        , pattern , pattern , pattern , pattern , pattern , pattern 
        -- *** Blackboard (nonstandard)
        , pattern 𝔸, pattern 𝔹, pattern 𝔻, pattern 𝔼, pattern 𝔽, pattern 𝔾, pattern 𝕀, pattern 𝕁, pattern 𝕂, pattern 𝕃, pattern 𝕄, pattern 𝕆, pattern 𝕊, pattern 𝕋, pattern 𝕌, pattern 𝕍, pattern 𝕎, pattern 𝕏, pattern 𝕐
        -- *** Script
        , pattern 𝒜, pattern , pattern 𝒞, pattern 𝒟, pattern , pattern , pattern 𝒢, pattern , pattern , pattern 𝒥, pattern 𝒦, pattern , pattern , pattern 𝒩, pattern 𝒪, pattern 𝒫, pattern 𝒬, pattern , pattern 𝒮, pattern 𝒯, pattern 𝒰, pattern 𝒱, pattern 𝒲, pattern 𝒳, pattern 𝒴, pattern 𝒵
        -- *** Calligraphic / bold-script
        , pattern 𝓐, pattern 𝓑, pattern 𝓒, pattern 𝓓, pattern 𝓔, pattern 𝓕, pattern 𝓖, pattern 𝓗, pattern 𝓘, pattern 𝓙, pattern 𝓚, pattern 𝓛, pattern 𝓜, pattern 𝓝, pattern 𝓞, pattern 𝓟, pattern 𝓠, pattern 𝓡, pattern 𝓢, pattern 𝓣, pattern 𝓤, pattern 𝓥, pattern 𝓦, pattern 𝓧, pattern 𝓨, pattern 𝓩
        -- *** Fraktur
        , pattern 𝔄, pattern 𝔅, pattern , pattern 𝔇, pattern 𝔈, pattern 𝔉, pattern 𝔊, pattern , pattern , pattern 𝔍, pattern 𝔎, pattern 𝔏, pattern 𝔐, pattern 𝔑, pattern 𝔒, pattern 𝔓, pattern 𝔔, pattern , pattern 𝔖, pattern 𝔗, pattern 𝔘, pattern 𝔙, pattern 𝔚, pattern 𝔛, pattern 𝔜
        -- *** Greek (LaTeX subset)
        -- $greekUppercaseLaTeXInfo
        , pattern Γ, pattern Δ, pattern Θ, pattern Λ, pattern Ξ, pattern Π, pattern Σ, pattern Υ, pattern Φ, pattern Ψ, pattern Ω
        -- *** Greek (Latin-lookalike)
        , pattern Α, pattern Β, pattern Ε, pattern Ζ, pattern Η, pattern Ι, pattern Κ, pattern Μ, pattern Ν, pattern Ο, pattern Ρ, pattern Τ, pattern Χ
#endif
        -- * Pattern-matching variable symbols
        -- $BopomofoHelp
        , ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
        -- * Auxiliary
        , Expression'
        ) where

import CAS.Dumb.Tree
import CAS.Dumb.Symbols hiding ((&~~!), (&~~:), continueExpr)

import CAS.Dumb.Symbols.PatternGenerator

import Data.Void
import Control.Arrow


data Unicode_MathLatin_RomanGreek__BopomofoGaps
instance SymbolClass Unicode_MathLatin_RomanGreek__BopomofoGaps where
  type SCConstraint Unicode_MathLatin_RomanGreek__BopomofoGaps = UnicodeSymbols
  fromCharSymbol :: forall (p :: * -> *) c.
(Functor p,
 SCConstraint Unicode_MathLatin_RomanGreek__BopomofoGaps c) =>
p Unicode_MathLatin_RomanGreek__BopomofoGaps -> Char -> c
fromCharSymbol p Unicode_MathLatin_RomanGreek__BopomofoGaps
_ = forall c. UnicodeSymbols c => Char -> c
fromUnicodeSymbol

instance Unwieldy c => Unwieldy (Symbol c) where
  unwieldiness :: Symbol c -> Unwieldiness
unwieldiness (NatSymbol Integer
i) = Unwieldiness
0.24127 forall a. Num a => a -> a -> a
+ forall a. Num a => Integer -> a
fromInteger (forall a. Num a => a -> a
abs Integer
i)
  unwieldiness (PrimitiveSymbol Char
c)
    | Char
cforall a. Ord a => a -> a -> Bool
>=Char
'a' Bool -> Bool -> Bool
&& Char
cforall a. Ord a => a -> a -> Bool
<=Char
'z'  = Unwieldiness
1.17236 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'z' forall a. Num a => a -> a -> a
- Int
ucp         )forall a. Fractional a => a -> a -> a
/Unwieldiness
49.4530
    | Char
cforall a. Ord a => a -> a -> Bool
>=Char
'𝑎' Bool -> Bool -> Bool
&& Char
cforall a. Ord a => a -> a -> Bool
<=Char
'𝑧'  = Unwieldiness
1.17249 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'𝑧' forall a. Num a => a -> a -> a
- Int
ucp         )forall a. Fractional a => a -> a -> a
/Unwieldiness
49.4564
    | Char
cforall a. Eq a => a -> a -> Bool
==Char
'ℎ'            = Unwieldiness
1.17249 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'z' forall a. Num a => a -> a -> a
- forall a. Enum a => a -> Int
fromEnum Char
'h')forall a. Fractional a => a -> a -> a
/Unwieldiness
49.4564
    | Char
cforall a. Ord a => a -> a -> Bool
>=Char
'A' Bool -> Bool -> Bool
&& Char
cforall a. Ord a => a -> a -> Bool
<=Char
'Z'  = Unwieldiness
1.17211 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'Z' forall a. Num a => a -> a -> a
- Int
ucp         )forall a. Fractional a => a -> a -> a
/Unwieldiness
49.4571
    | Char
cforall a. Ord a => a -> a -> Bool
>=Char
'𝐴' Bool -> Bool -> Bool
&& Char
cforall a. Ord a => a -> a -> Bool
<=Char
'𝑍'  = Unwieldiness
1.17213 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'𝑍' forall a. Num a => a -> a -> a
- Int
ucp         )forall a. Fractional a => a -> a -> a
/Unwieldiness
49.4511
    | Char
cforall a. Ord a => a -> a -> Bool
>=Char
'𝐚' Bool -> Bool -> Bool
&& Char
cforall a. Ord a => a -> a -> Bool
<=Char
'𝐳'  = Unwieldiness
1.17228 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'𝐳' forall a. Num a => a -> a -> a
- Int
ucp         )forall a. Fractional a => a -> a -> a
/Unwieldiness
49.4572
    | Char
cforall a. Ord a => a -> a -> Bool
>=Char
'𝔄' Bool -> Bool -> Bool
&& Char
cforall a. Ord a => a -> a -> Bool
<=Char
'ℨ'  = Unwieldiness
1.18131 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'ℨ' forall a. Num a => a -> a -> a
- Int
ucp         )forall a. Fractional a => a -> a -> a
/Unwieldiness
51.4522
    | Char
cforall a. Eq a => a -> a -> Bool
==Char
'ℭ'            = Unwieldiness
1.18131 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'Z' forall a. Num a => a -> a -> a
- forall a. Enum a => a -> Int
fromEnum Char
'C')forall a. Fractional a => a -> a -> a
/Unwieldiness
51.4522
    | Char
cforall a. Eq a => a -> a -> Bool
==Char
'ℌ'            = Unwieldiness
1.18131 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'Z' forall a. Num a => a -> a -> a
- forall a. Enum a => a -> Int
fromEnum Char
'H')forall a. Fractional a => a -> a -> a
/Unwieldiness
51.4522
    | Char
cforall a. Eq a => a -> a -> Bool
==Char
'ℑ'            = Unwieldiness
1.18131 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'Z' forall a. Num a => a -> a -> a
- forall a. Enum a => a -> Int
fromEnum Char
'I')forall a. Fractional a => a -> a -> a
/Unwieldiness
51.4522
    | Char
cforall a. Eq a => a -> a -> Bool
==Char
'ℜ'            = Unwieldiness
1.18131 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'Z' forall a. Num a => a -> a -> a
- forall a. Enum a => a -> Int
fromEnum Char
'R')forall a. Fractional a => a -> a -> a
/Unwieldiness
51.4522
    | Char
cforall a. Ord a => a -> a -> Bool
>=Char
'𝔞' Bool -> Bool -> Bool
&& Char
cforall a. Ord a => a -> a -> Bool
<=Char
'𝔷'  = Unwieldiness
1.18134 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'𝔷' forall a. Num a => a -> a -> a
- Int
ucp         )forall a. Fractional a => a -> a -> a
/Unwieldiness
51.4522
    | Char
cforall a. Ord a => a -> a -> Bool
>=Char
'𝐀' Bool -> Bool -> Bool
&& Char
cforall a. Ord a => a -> a -> Bool
<=Char
'𝐙'  = Unwieldiness
1.17210 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'𝐙' forall a. Num a => a -> a -> a
- Int
ucp         )forall a. Fractional a => a -> a -> a
/Unwieldiness
49.4518
    | Char
cforall a. Ord a => a -> a -> Bool
>=Char
'𝓐' Bool -> Bool -> Bool
&& Char
cforall a. Ord a => a -> a -> Bool
<=Char
'𝓩'  = Unwieldiness
1.17212 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'𝓩' forall a. Num a => a -> a -> a
- Int
ucp         )forall a. Fractional a => a -> a -> a
/Unwieldiness
49.4528
    | Char
cforall a. Ord a => a -> a -> Bool
>=Char
'α' Bool -> Bool -> Bool
&& Char
cforall a. Ord a => a -> a -> Bool
<=Char
'ω'  = Unwieldiness
1.03627 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'ω' forall a. Num a => a -> a -> a
- Int
ucp         )forall a. Fractional a => a -> a -> a
/Unwieldiness
342.637
    | Char
cforall a. Eq a => a -> a -> Bool
==Char
'ϑ'            = Unwieldiness
1.03628 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'ω' forall a. Num a => a -> a -> a
- forall a. Enum a => a -> Int
fromEnum Char
'θ')forall a. Fractional a => a -> a -> a
/Unwieldiness
342.637
    | Char
cforall a. Eq a => a -> a -> Bool
==Char
'ϕ'            = Unwieldiness
1.03628 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'ω' forall a. Num a => a -> a -> a
- forall a. Enum a => a -> Int
fromEnum Char
'φ')forall a. Fractional a => a -> a -> a
/Unwieldiness
342.637
    | Char
cforall a. Ord a => a -> a -> Bool
>=Char
'Α' Bool -> Bool -> Bool
&& Char
cforall a. Ord a => a -> a -> Bool
<=Char
'Ω'  = Unwieldiness
1.03625 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Enum a => a -> Int
fromEnum Char
'Ω' forall a. Num a => a -> a -> a
- Int
ucp         )forall a. Fractional a => a -> a -> a
/Unwieldiness
342.642
    | Bool
otherwise         = Unwieldiness
1.24551 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
ucp forall a. Fractional a => a -> a -> a
/ Unwieldiness
52792.42
                                  forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
ucpforall a. Integral a => a -> a -> a
`mod`Int
136)forall a. Fractional a => a -> a -> a
/Unwieldiness
9722.3
   where ucp :: Int
ucp = forall a. Enum a => a -> Int
fromEnum Char
c
  unwieldiness (StringSymbol c
s) = forall e. Unwieldy e => e -> Unwieldiness
unwieldiness c
s


type Symbol = SymbolD Unicode_MathLatin_RomanGreek__BopomofoGaps
type Expression' γ   c = CAS' γ   (Symbol c)
type Expression c = Expression' Void (Infix c) (Encapsulation c) c
type Pattern c = Expression' GapId (Infix c) (Encapsulation c) c

-- $UnicodeMathSymHelp
-- Unicode mathematical italic letters. Italic is the default way maths symbols appear in
-- e.g. LaTeX-rendered documents, thus it makes sense to use them here.
makeSymbols ''Expression' "𝑎𝑏𝑐𝑑𝑒𝑓𝑔ℎ𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧"

makeSymbols ''Expression' ['𝐚'..'𝐳']

makeSymbols ''Expression' "αβγδεζηθϑικλμνξοπρϱσςτυϕφχψω"

makeSymbols ''Expression' "𝔞𝔟𝔠𝔡𝔢𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪𝔫𝔬𝔭𝔮𝔯𝔰𝔱𝔲𝔳𝔴𝔵𝔶𝔷"

-- $uppercaseCaveat
-- These are only available in GHC>8.2. The ability to use uppercase letters as variables
-- hinges on a hack using GHC's still recent
-- <https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms pattern synonyms> feature.
--
-- You can use the "CAS.Dumb.Symbols.Unicode.MathLatin_RomanGreek.Qualified"
-- module if this causes you any trouble; there, all symbols are prefixed with
-- @sym@ and therefore the uppercase ones are still normal lowercase names
-- in the Haskell code.

#if __GLASGOW_HASKELL__ > 801
makeSymbols ''Expression' ['𝐴'..'𝑍']

makeSymbols ''Expression' ['𝐀'..'𝐙']

makeSymbols ''Expression' "𝔸𝔹ℂ𝔻𝔼𝔽𝔾ℍ𝕀𝕁𝕂𝕃𝕄ℕ𝕆ℚℝ𝕊𝕋𝕌𝕍𝕎𝕏𝕐ℤ"

makeSymbols ''Expression' "𝒜ℬ𝒞𝒟ℰℱ𝒢ℋℐ𝒥𝒦ℒℳ𝒩𝒪𝒫𝒬ℛ𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵"

makeSymbols ''Expression' ['𝓐'..'𝓩']

makeSymbols ''Expression' "𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜"

-- $greekUppercaseLaTeXInfo
-- These are the uppercase greek letters that don't have latin lookalikes. Only these
-- are supported in LaTeX, so for doing maths it's probably best to stick to this subset.

makeSymbols ''Expression' $ ['Α'..'Ρ']++['Σ'..'Ω']
#endif

-- $BopomofoHelp
-- Using a non-European alphabet such as Bopomofo for 'Gap's (which are always only
-- temporary placeholders that, unlike 'Symbol's, should never appear in any program
-- output) has the advantage of keeping the namespace clean and avoiding ambiguities.
-- 
-- Most of these symbols can easily be entered as
-- <http://vimhelp.appspot.com/digraph.txt.html#Digraphs Vim digraphs>,
-- namely by combining a (latin) letter with the number 4. For instance, @ctrl-k e 4@
-- generates the symbol @ㄜ U+311C BOPOMOFO LETTER E@.
,,,,,,,,,,,,,,,,,,,,,,,,,,
  ,,,,,,,,,,,,,:: CAS' GapId   s⁰
[CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰

  ,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
,CAS' Int s² s¹ s⁰
]
    = forall γ s² s¹ s⁰. γ -> CAS' γ s² s¹ s⁰
Gap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => a -> Int
fromEnum forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Char
'ㄅ'..Char
'ㄬ']

instance (UnicodeSymbols c, RenderableEncapsulations c) => Show (Expression c) where
  showsPrec :: Int -> Expression c -> ShowS
showsPrec Int
p = forall c σ.
(UnicodeSymbols c, SymbolClass σ, SCConstraint σ c) =>
Int -> AlgebraExpr σ c -> ShowS
showsPrecUnicodeSymbol Int
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c σ γ.
(RenderableEncapsulations c, SymbolClass σ, SCConstraint σ c) =>
CAS' γ (Infix c) (Encapsulation c) (SymbolD σ c)
-> CAS' γ (Infix c) (Encapsulation c) (SymbolD σ c)
fixateAlgebraEncaps
instance  c . (UnicodeSymbols c, RenderableEncapsulations c)
                   => Show (Pattern c) where
  showsPrec :: Int -> Pattern c -> ShowS
showsPrec Int
p = forall c σ.
(UnicodeSymbols c, SymbolClass σ, SCConstraint σ c) =>
Int -> AlgebraExpr σ c -> ShowS
showsPrecUnicodeSymbol Int
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. Pattern c
-> AlgebraExpr Unicode_MathLatin_RomanGreek__BopomofoGaps c
purgeGaps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c σ γ.
(RenderableEncapsulations c, SymbolClass σ, SCConstraint σ c) =>
CAS' γ (Infix c) (Encapsulation c) (SymbolD σ c)
-> CAS' γ (Infix c) (Encapsulation c) (SymbolD σ c)
fixateAlgebraEncaps
   where purgeGaps :: Pattern c
-> AlgebraExpr Unicode_MathLatin_RomanGreek__BopomofoGaps c
purgeGaps (Symbol Symbol c
s) = forall γ s² s¹ s⁰. s⁰ -> CAS' γ s² s¹ s⁰
Symbol Symbol c
s
         purgeGaps (Function Encapsulation c
f Pattern c
e) = forall γ s² s¹ s⁰. s¹ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Function Encapsulation c
f forall a b. (a -> b) -> a -> b
$ Pattern c
-> AlgebraExpr Unicode_MathLatin_RomanGreek__BopomofoGaps c
purgeGaps Pattern c
e
         purgeGaps (Operator Infix c
o Pattern c
x Pattern c
y) = forall γ s² s¹ s⁰.
s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰
Operator Infix c
o (Pattern c
-> AlgebraExpr Unicode_MathLatin_RomanGreek__BopomofoGaps c
purgeGaps Pattern c
x) (Pattern c
-> AlgebraExpr Unicode_MathLatin_RomanGreek__BopomofoGaps c
purgeGaps Pattern c
y)
         purgeGaps (OperatorChain Pattern c
x [(Infix c, Pattern c)]
ys) = forall γ s² s¹ s⁰.
CAS' γ s² s¹ s⁰ -> [(s², CAS' γ s² s¹ s⁰)] -> CAS' γ s² s¹ s⁰
OperatorChain (Pattern c
-> AlgebraExpr Unicode_MathLatin_RomanGreek__BopomofoGaps c
purgeGaps Pattern c
x) (forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (d, b) (d, c)
second Pattern c
-> AlgebraExpr Unicode_MathLatin_RomanGreek__BopomofoGaps c
purgeGapsforall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>[(Infix c, Pattern c)]
ys)
         purgeGaps (Gap Int
gid) = forall γ s² s¹ s⁰. s⁰ -> CAS' γ s² s¹ s⁰
Symbol (forall σ c. Char -> SymbolD σ c
PrimitiveSymbol (forall a. Enum a => Int -> a
toEnum Int
gid)) :: Expression c