spacechar-0.0.0.4: src/Data/Char/Space.hs
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
module Data.Char.Space(
-- * Individual space characters
HorizontalTab
, HasHorizontalTab(..)
, AsHorizontalTab(..)
, parseHorizontalTab
, LineFeed
, HasLineFeed(..)
, AsLineFeed(..)
, parseLineFeed
, VerticalTab
, HasVerticalTab(..)
, AsVerticalTab(..)
, parseVerticalTab
, FormFeed
, HasFormFeed(..)
, AsFormFeed(..)
, parseFormFeed
, CarriageReturn
, HasCarriageReturn(..)
, AsCarriageReturn(..)
, parseCarriageReturn
, Whitespace
, HasWhitespace(..)
, AsWhitespace(..)
, parseWhitespace
, NoBreakSpace
, HasNoBreakSpace(..)
, AsNoBreakSpace(..)
, parseNoBreakSpace
, OghamSpaceMark
, HasOghamSpaceMark(..)
, AsOghamSpaceMark(..)
, parseOghamSpaceMark
, EnQuad
, HasEnQuad(..)
, AsEnQuad(..)
, parseEnQuad
, EmQuad
, HasEmQuad(..)
, AsEmQuad(..)
, parseEmQuad
, EnSpace
, HasEnSpace(..)
, AsEnSpace(..)
, parseEnSpace
, EmSpace
, HasEmSpace(..)
, AsEmSpace(..)
, parseEmSpace
, ThreePerEmSpace
, HasThreePerEmSpace(..)
, AsThreePerEmSpace(..)
, parseThreePerEmSpace
, FourPerEmSpace
, HasFourPerEmSpace(..)
, AsFourPerEmSpace(..)
, parseFourPerEmSpace
, SixPerEmSpace
, HasSixPerEmSpace(..)
, AsSixPerEmSpace(..)
, parseSixPerEmSpace
, FigureSpace
, HasFigureSpace(..)
, AsFigureSpace(..)
, parseFigureSpace
, PunctuationSpace
, HasPunctuationSpace(..)
, AsPunctuationSpace(..)
, parsePunctuationSpace
, ThinSpace
, HasThinSpace(..)
, AsThinSpace(..)
, parseThinSpace
, HairSpace
, HasHairSpace(..)
, AsHairSpace(..)
, parseHairSpace
, NarrowNoBreakSpace
, HasNarrowNoBreakSpace(..)
, AsNarrowNoBreakSpace(..)
, parseNarrowNoBreakSpace
, MediumMathematicalSpace
, HasMediumMathematicalSpace(..)
, AsMediumMathematicalSpace(..)
, parseMediumMathematicalSpace
, IdeographicSpace
, HasIdeographicSpace(..)
, AsIdeographicSpace(..)
, parseIdeographicSpace
-- * All space characters
, SpaceChar(..)
, HasSpaceChar(..)
, AsSpaceChar(..)
, parseSpaceChar
-- * ISO Latin-1 space characters /(horizontal tab, line feed, form feed, carriage return, whitespace)/
, IsoLatin1(..)
, HasIsoLatin1(..)
, AsIsoLatin1(..)
, parseIsoLatin1
) where
import Control.Category ( Category(id) )
import Control.Lens ( Prism', prism', (#), Lens' )
import Data.Char ( Char )
import Data.Eq ( Eq((==)) )
import Data.Int ( Int )
import Data.Foldable ( asum )
import Data.Functor ( Functor((<$), fmap) )
import Data.Maybe ( Maybe(Nothing, Just) )
import Data.Monoid ( (<>), Monoid(mempty) )
import Data.Ord ( Ord )
import Data.Semigroup ( Semigroup )
import GHC.Generics ( Generic )
import GHC.Show ( Show )
import Prelude(Integer)
import Text.Parser.Char ( CharParsing(satisfy) )
import Text.Parser.Combinators ( Parsing((<?>)) )
data HorizontalTab = HorizontalTab
deriving (Eq, Ord, Show, Generic)
class HasHorizontalTab a where
horizontalTab :: Lens' a HorizontalTab
instance HasHorizontalTab HorizontalTab where
horizontalTab = id
instance HasHorizontalTab () where
horizontalTab f x =
fmap (\HorizontalTab -> x) (f HorizontalTab)
instance Semigroup HorizontalTab where
HorizontalTab <> HorizontalTab = HorizontalTab
instance Monoid HorizontalTab where
mempty = HorizontalTab
class AsHorizontalTab a where
_HorizontalTab :: Prism' a HorizontalTab
_HorizontalTab' :: a
_HorizontalTab' = _HorizontalTab # HorizontalTab
instance AsHorizontalTab HorizontalTab where
_HorizontalTab = id
instance AsHorizontalTab () where
_HorizontalTab =
prism'
(\HorizontalTab -> ())
(\() -> Just HorizontalTab)
instance AsHorizontalTab Char where
_HorizontalTab =
prism'
(\HorizontalTab -> '\9')
(\case
'\9' -> Just HorizontalTab
_ -> Nothing
)
instance AsHorizontalTab Int where
_HorizontalTab =
prism'
(\HorizontalTab -> 9)
(\case
9 -> Just HorizontalTab
_ -> Nothing
)
instance AsHorizontalTab Integer where
_HorizontalTab =
prism'
(\HorizontalTab -> 9)
(\case
9 -> Just HorizontalTab
_ -> Nothing
)
parseHorizontalTab ::
CharParsing p =>
p HorizontalTab
parseHorizontalTab =
HorizontalTab <$ satisfy (== '\9') <?> "horizontal tab character"
data LineFeed = LineFeed
deriving (Eq, Ord, Show, Generic)
class HasLineFeed a where
lineFeed :: Lens' a LineFeed
instance HasLineFeed LineFeed where
lineFeed = id
instance HasLineFeed () where
lineFeed f x =
fmap (\LineFeed -> x) (f LineFeed)
instance Semigroup LineFeed where
LineFeed <> LineFeed = LineFeed
instance Monoid LineFeed where
mempty = LineFeed
class AsLineFeed a where
_LineFeed :: Prism' a LineFeed
_LineFeed' :: a
_LineFeed' = _LineFeed # LineFeed
instance AsLineFeed LineFeed where
_LineFeed = id
instance AsLineFeed () where
_LineFeed =
prism'
(\LineFeed -> ())
(\() -> Just LineFeed)
instance AsLineFeed Char where
_LineFeed =
prism'
(\LineFeed -> '\10')
(\case
'\10' -> Just LineFeed
_ -> Nothing
)
instance AsLineFeed Int where
_LineFeed =
prism'
(\LineFeed -> 10)
(\case
10 -> Just LineFeed
_ -> Nothing
)
instance AsLineFeed Integer where
_LineFeed =
prism'
(\LineFeed -> 10)
(\case
10 -> Just LineFeed
_ -> Nothing
)
parseLineFeed ::
CharParsing p =>
p LineFeed
parseLineFeed =
LineFeed <$ satisfy (== '\10') <?> "line feed character"
data VerticalTab = VerticalTab
deriving (Eq, Ord, Show, Generic)
class HasVerticalTab a where
verticalTab :: Lens' a VerticalTab
instance HasVerticalTab VerticalTab where
verticalTab = id
instance HasVerticalTab () where
verticalTab f x =
fmap (\VerticalTab -> x) (f VerticalTab)
instance Semigroup VerticalTab where
VerticalTab <> VerticalTab = VerticalTab
instance Monoid VerticalTab where
mempty = VerticalTab
class AsVerticalTab a where
_VerticalTab :: Prism' a VerticalTab
_VerticalTab' :: a
_VerticalTab' = _VerticalTab # VerticalTab
instance AsVerticalTab VerticalTab where
_VerticalTab = id
instance AsVerticalTab () where
_VerticalTab =
prism'
(\VerticalTab -> ())
(\() -> Just VerticalTab)
instance AsVerticalTab Char where
_VerticalTab =
prism'
(\VerticalTab -> '\11')
(\case
'\11' -> Just VerticalTab
_ -> Nothing
)
instance AsVerticalTab Int where
_VerticalTab =
prism'
(\VerticalTab -> 11)
(\case
11 -> Just VerticalTab
_ -> Nothing
)
instance AsVerticalTab Integer where
_VerticalTab =
prism'
(\VerticalTab -> 11)
(\case
11 -> Just VerticalTab
_ -> Nothing
)
parseVerticalTab ::
CharParsing p =>
p VerticalTab
parseVerticalTab =
VerticalTab <$ satisfy (== '\11') <?> "vertical tab character"
data FormFeed = FormFeed
deriving (Eq, Ord, Show, Generic)
class HasFormFeed a where
formFeed :: Lens' a FormFeed
instance HasFormFeed FormFeed where
formFeed = id
instance HasFormFeed () where
formFeed f x =
fmap (\FormFeed -> x) (f FormFeed)
instance Semigroup FormFeed where
FormFeed <> FormFeed = FormFeed
instance Monoid FormFeed where
mempty = FormFeed
class AsFormFeed a where
_FormFeed :: Prism' a FormFeed
_FormFeed' :: a
_FormFeed' = _FormFeed # FormFeed
instance AsFormFeed FormFeed where
_FormFeed = id
instance AsFormFeed () where
_FormFeed =
prism'
(\FormFeed -> ())
(\() -> Just FormFeed)
instance AsFormFeed Char where
_FormFeed =
prism'
(\FormFeed -> '\12')
(\case
'\12' -> Just FormFeed
_ -> Nothing
)
instance AsFormFeed Int where
_FormFeed =
prism'
(\FormFeed -> 12)
(\case
12 -> Just FormFeed
_ -> Nothing
)
instance AsFormFeed Integer where
_FormFeed =
prism'
(\FormFeed -> 12)
(\case
12 -> Just FormFeed
_ -> Nothing
)
parseFormFeed ::
CharParsing p =>
p FormFeed
parseFormFeed =
FormFeed <$ satisfy (== '\12') <?> "form feed character"
data CarriageReturn = CarriageReturn
deriving (Eq, Ord, Show, Generic)
class HasCarriageReturn a where
carriageReturn :: Lens' a CarriageReturn
instance HasCarriageReturn CarriageReturn where
carriageReturn = id
instance HasCarriageReturn () where
carriageReturn f x =
fmap (\CarriageReturn -> x) (f CarriageReturn)
instance Semigroup CarriageReturn where
CarriageReturn <> CarriageReturn = CarriageReturn
instance Monoid CarriageReturn where
mempty = CarriageReturn
class AsCarriageReturn a where
_CarriageReturn :: Prism' a CarriageReturn
_CarriageReturn' :: a
_CarriageReturn' = _CarriageReturn # CarriageReturn
instance AsCarriageReturn CarriageReturn where
_CarriageReturn = id
instance AsCarriageReturn () where
_CarriageReturn =
prism'
(\CarriageReturn -> ())
(\() -> Just CarriageReturn)
instance AsCarriageReturn Char where
_CarriageReturn =
prism'
(\CarriageReturn -> '\13')
(\case
'\13' -> Just CarriageReturn
_ -> Nothing
)
instance AsCarriageReturn Int where
_CarriageReturn =
prism'
(\CarriageReturn -> 13)
(\case
13 -> Just CarriageReturn
_ -> Nothing
)
instance AsCarriageReturn Integer where
_CarriageReturn =
prism'
(\CarriageReturn -> 13)
(\case
13 -> Just CarriageReturn
_ -> Nothing
)
parseCarriageReturn ::
CharParsing p =>
p CarriageReturn
parseCarriageReturn =
CarriageReturn <$ satisfy (== '\13') <?> "carriage return character"
data Whitespace = Whitespace
deriving (Eq, Ord, Show, Generic)
class HasWhitespace a where
whitespace :: Lens' a Whitespace
instance HasWhitespace Whitespace where
whitespace = id
instance HasWhitespace () where
whitespace f x =
fmap (\Whitespace -> x) (f Whitespace)
instance Semigroup Whitespace where
Whitespace <> Whitespace = Whitespace
instance Monoid Whitespace where
mempty = Whitespace
class AsWhitespace a where
_Whitespace :: Prism' a Whitespace
_Whitespace' :: a
_Whitespace' = _Whitespace # Whitespace
instance AsWhitespace Whitespace where
_Whitespace = id
instance AsWhitespace () where
_Whitespace =
prism'
(\Whitespace -> ())
(\() -> Just Whitespace)
instance AsWhitespace Char where
_Whitespace =
prism'
(\Whitespace -> '\32')
(\case
'\32' -> Just Whitespace
_ -> Nothing
)
instance AsWhitespace Int where
_Whitespace =
prism'
(\Whitespace -> 32)
(\case
32 -> Just Whitespace
_ -> Nothing
)
instance AsWhitespace Integer where
_Whitespace =
prism'
(\Whitespace -> 32)
(\case
32 -> Just Whitespace
_ -> Nothing
)
parseWhitespace ::
CharParsing p =>
p Whitespace
parseWhitespace =
Whitespace <$ satisfy (== '\32') <?> "whitespace character"
data NoBreakSpace = NoBreakSpace
deriving (Eq, Ord, Show, Generic)
class HasNoBreakSpace a where
noBreakSpace :: Lens' a NoBreakSpace
instance HasNoBreakSpace NoBreakSpace where
noBreakSpace = id
instance HasNoBreakSpace () where
noBreakSpace f x =
fmap (\NoBreakSpace -> x) (f NoBreakSpace)
instance Semigroup NoBreakSpace where
NoBreakSpace <> NoBreakSpace = NoBreakSpace
instance Monoid NoBreakSpace where
mempty = NoBreakSpace
class AsNoBreakSpace a where
_NoBreakSpace :: Prism' a NoBreakSpace
_NoBreakSpace' :: a
_NoBreakSpace' = _NoBreakSpace # NoBreakSpace
instance AsNoBreakSpace NoBreakSpace where
_NoBreakSpace = id
instance AsNoBreakSpace () where
_NoBreakSpace =
prism'
(\NoBreakSpace -> ())
(\() -> Just NoBreakSpace)
instance AsNoBreakSpace Char where
_NoBreakSpace =
prism'
(\NoBreakSpace -> '\160')
(\case
'\160' -> Just NoBreakSpace
_ -> Nothing
)
instance AsNoBreakSpace Int where
_NoBreakSpace =
prism'
(\NoBreakSpace -> 160)
(\case
160 -> Just NoBreakSpace
_ -> Nothing
)
instance AsNoBreakSpace Integer where
_NoBreakSpace =
prism'
(\NoBreakSpace -> 160)
(\case
160 -> Just NoBreakSpace
_ -> Nothing
)
parseNoBreakSpace ::
CharParsing p =>
p NoBreakSpace
parseNoBreakSpace =
NoBreakSpace <$ satisfy (== '\160') <?> "no break space character"
data OghamSpaceMark = OghamSpaceMark
deriving (Eq, Ord, Show, Generic)
class HasOghamSpaceMark a where
oghamSpaceMark :: Lens' a OghamSpaceMark
instance HasOghamSpaceMark OghamSpaceMark where
oghamSpaceMark = id
instance HasOghamSpaceMark () where
oghamSpaceMark f x =
fmap (\OghamSpaceMark -> x) (f OghamSpaceMark)
instance Semigroup OghamSpaceMark where
OghamSpaceMark <> OghamSpaceMark = OghamSpaceMark
instance Monoid OghamSpaceMark where
mempty = OghamSpaceMark
class AsOghamSpaceMark a where
_OghamSpaceMark :: Prism' a OghamSpaceMark
_OghamSpaceMark' :: a
_OghamSpaceMark' = _OghamSpaceMark # OghamSpaceMark
instance AsOghamSpaceMark OghamSpaceMark where
_OghamSpaceMark = id
instance AsOghamSpaceMark () where
_OghamSpaceMark =
prism'
(\OghamSpaceMark -> ())
(\() -> Just OghamSpaceMark)
instance AsOghamSpaceMark Char where
_OghamSpaceMark =
prism'
(\OghamSpaceMark -> '\5760')
(\case
'\5760' -> Just OghamSpaceMark
_ -> Nothing
)
instance AsOghamSpaceMark Int where
_OghamSpaceMark =
prism'
(\OghamSpaceMark -> 5760)
(\case
5760 -> Just OghamSpaceMark
_ -> Nothing
)
instance AsOghamSpaceMark Integer where
_OghamSpaceMark =
prism'
(\OghamSpaceMark -> 5760)
(\case
5760 -> Just OghamSpaceMark
_ -> Nothing
)
parseOghamSpaceMark ::
CharParsing p =>
p OghamSpaceMark
parseOghamSpaceMark =
OghamSpaceMark <$ satisfy (== '\5760') <?> "ogham space mark character"
data EnQuad = EnQuad
deriving (Eq, Ord, Show, Generic)
class HasEnQuad a where
enQuad :: Lens' a EnQuad
instance HasEnQuad EnQuad where
enQuad = id
instance HasEnQuad () where
enQuad f x =
fmap (\EnQuad -> x) (f EnQuad)
instance Semigroup EnQuad where
EnQuad <> EnQuad = EnQuad
instance Monoid EnQuad where
mempty = EnQuad
class AsEnQuad a where
_EnQuad :: Prism' a EnQuad
_EnQuad' :: a
_EnQuad' = _EnQuad # EnQuad
instance AsEnQuad EnQuad where
_EnQuad = id
instance AsEnQuad () where
_EnQuad =
prism'
(\EnQuad -> ())
(\() -> Just EnQuad)
instance AsEnQuad Char where
_EnQuad =
prism'
(\EnQuad -> '\8192')
(\case
'\8192' -> Just EnQuad
_ -> Nothing
)
instance AsEnQuad Int where
_EnQuad =
prism'
(\EnQuad -> 8192)
(\case
8192 -> Just EnQuad
_ -> Nothing
)
instance AsEnQuad Integer where
_EnQuad =
prism'
(\EnQuad -> 8192)
(\case
8192 -> Just EnQuad
_ -> Nothing
)
parseEnQuad ::
CharParsing p =>
p EnQuad
parseEnQuad =
EnQuad <$ satisfy (== '\8192') <?> "en quad character"
data EmQuad = EmQuad
deriving (Eq, Ord, Show, Generic)
class HasEmQuad a where
emQuad :: Lens' a EmQuad
instance HasEmQuad EmQuad where
emQuad = id
instance HasEmQuad () where
emQuad f x =
fmap (\EmQuad -> x) (f EmQuad)
instance Semigroup EmQuad where
EmQuad <> EmQuad = EmQuad
instance Monoid EmQuad where
mempty = EmQuad
class AsEmQuad a where
_EmQuad :: Prism' a EmQuad
_EmQuad' :: a
_EmQuad' = _EmQuad # EmQuad
instance AsEmQuad EmQuad where
_EmQuad = id
instance AsEmQuad () where
_EmQuad =
prism'
(\EmQuad -> ())
(\() -> Just EmQuad)
instance AsEmQuad Char where
_EmQuad =
prism'
(\EmQuad -> '\8193')
(\case
'\8193' -> Just EmQuad
_ -> Nothing
)
instance AsEmQuad Int where
_EmQuad =
prism'
(\EmQuad -> 8193)
(\case
8193 -> Just EmQuad
_ -> Nothing
)
instance AsEmQuad Integer where
_EmQuad =
prism'
(\EmQuad -> 8193)
(\case
8193 -> Just EmQuad
_ -> Nothing
)
parseEmQuad ::
CharParsing p =>
p EmQuad
parseEmQuad =
EmQuad <$ satisfy (== '\8193') <?> "em quad character"
data EnSpace = EnSpace
deriving (Eq, Ord, Show, Generic)
class HasEnSpace a where
enSpace :: Lens' a EnSpace
instance HasEnSpace EnSpace where
enSpace = id
instance HasEnSpace () where
enSpace f x =
fmap (\EnSpace -> x) (f EnSpace)
instance Semigroup EnSpace where
EnSpace <> EnSpace = EnSpace
instance Monoid EnSpace where
mempty = EnSpace
class AsEnSpace a where
_EnSpace :: Prism' a EnSpace
_EnSpace' :: a
_EnSpace' = _EnSpace # EnSpace
instance AsEnSpace EnSpace where
_EnSpace = id
instance AsEnSpace () where
_EnSpace =
prism'
(\EnSpace -> ())
(\() -> Just EnSpace)
instance AsEnSpace Char where
_EnSpace =
prism'
(\EnSpace -> '\8194')
(\case
'\8194' -> Just EnSpace
_ -> Nothing
)
instance AsEnSpace Int where
_EnSpace =
prism'
(\EnSpace -> 8194)
(\case
8194 -> Just EnSpace
_ -> Nothing
)
instance AsEnSpace Integer where
_EnSpace =
prism'
(\EnSpace -> 8194)
(\case
8194 -> Just EnSpace
_ -> Nothing
)
parseEnSpace ::
CharParsing p =>
p EnSpace
parseEnSpace =
EnSpace <$ satisfy (== '\8194') <?> "en space character"
data EmSpace = EmSpace
deriving (Eq, Ord, Show, Generic)
class HasEmSpace a where
emSpace :: Lens' a EmSpace
instance HasEmSpace EmSpace where
emSpace = id
instance HasEmSpace () where
emSpace f x =
fmap (\EmSpace -> x) (f EmSpace)
instance Semigroup EmSpace where
EmSpace <> EmSpace = EmSpace
instance Monoid EmSpace where
mempty = EmSpace
class AsEmSpace a where
_EmSpace :: Prism' a EmSpace
_EmSpace' :: a
_EmSpace' = _EmSpace # EmSpace
instance AsEmSpace EmSpace where
_EmSpace = id
instance AsEmSpace () where
_EmSpace =
prism'
(\EmSpace -> ())
(\() -> Just EmSpace)
instance AsEmSpace Char where
_EmSpace =
prism'
(\EmSpace -> '\8195')
(\case
'\8195' -> Just EmSpace
_ -> Nothing
)
instance AsEmSpace Int where
_EmSpace =
prism'
(\EmSpace -> 8195)
(\case
8195 -> Just EmSpace
_ -> Nothing
)
instance AsEmSpace Integer where
_EmSpace =
prism'
(\EmSpace -> 8195)
(\case
8195 -> Just EmSpace
_ -> Nothing
)
parseEmSpace ::
CharParsing p =>
p EmSpace
parseEmSpace =
EmSpace <$ satisfy (== '\8195') <?> "em space character"
data ThreePerEmSpace = ThreePerEmSpace
deriving (Eq, Ord, Show, Generic)
class HasThreePerEmSpace a where
threePerEmSpace :: Lens' a ThreePerEmSpace
instance HasThreePerEmSpace ThreePerEmSpace where
threePerEmSpace = id
instance HasThreePerEmSpace () where
threePerEmSpace f x =
fmap (\ThreePerEmSpace -> x) (f ThreePerEmSpace)
instance Semigroup ThreePerEmSpace where
ThreePerEmSpace <> ThreePerEmSpace = ThreePerEmSpace
instance Monoid ThreePerEmSpace where
mempty = ThreePerEmSpace
class AsThreePerEmSpace a where
_ThreePerEmSpace :: Prism' a ThreePerEmSpace
_ThreePerEmSpace' :: a
_ThreePerEmSpace' = _ThreePerEmSpace # ThreePerEmSpace
instance AsThreePerEmSpace ThreePerEmSpace where
_ThreePerEmSpace = id
instance AsThreePerEmSpace () where
_ThreePerEmSpace =
prism'
(\ThreePerEmSpace -> ())
(\() -> Just ThreePerEmSpace)
instance AsThreePerEmSpace Char where
_ThreePerEmSpace =
prism'
(\ThreePerEmSpace -> '\8196')
(\case
'\8196' -> Just ThreePerEmSpace
_ -> Nothing
)
instance AsThreePerEmSpace Int where
_ThreePerEmSpace =
prism'
(\ThreePerEmSpace -> 8196)
(\case
8196 -> Just ThreePerEmSpace
_ -> Nothing
)
instance AsThreePerEmSpace Integer where
_ThreePerEmSpace =
prism'
(\ThreePerEmSpace -> 8196)
(\case
8196 -> Just ThreePerEmSpace
_ -> Nothing
)
parseThreePerEmSpace ::
CharParsing p =>
p ThreePerEmSpace
parseThreePerEmSpace =
ThreePerEmSpace <$ satisfy (== '\8196') <?> "three per em space character"
data FourPerEmSpace = FourPerEmSpace
deriving (Eq, Ord, Show, Generic)
class HasFourPerEmSpace a where
fourPerEmSpace :: Lens' a FourPerEmSpace
instance HasFourPerEmSpace FourPerEmSpace where
fourPerEmSpace = id
instance HasFourPerEmSpace () where
fourPerEmSpace f x =
fmap (\FourPerEmSpace -> x) (f FourPerEmSpace)
instance Semigroup FourPerEmSpace where
FourPerEmSpace <> FourPerEmSpace = FourPerEmSpace
instance Monoid FourPerEmSpace where
mempty = FourPerEmSpace
class AsFourPerEmSpace a where
_FourPerEmSpace :: Prism' a FourPerEmSpace
_FourPerEmSpace' :: a
_FourPerEmSpace' = _FourPerEmSpace # FourPerEmSpace
instance AsFourPerEmSpace FourPerEmSpace where
_FourPerEmSpace = id
instance AsFourPerEmSpace () where
_FourPerEmSpace =
prism'
(\FourPerEmSpace -> ())
(\() -> Just FourPerEmSpace)
instance AsFourPerEmSpace Char where
_FourPerEmSpace =
prism'
(\FourPerEmSpace -> '\8197')
(\case
'\8197' -> Just FourPerEmSpace
_ -> Nothing
)
instance AsFourPerEmSpace Int where
_FourPerEmSpace =
prism'
(\FourPerEmSpace -> 8197)
(\case
8197 -> Just FourPerEmSpace
_ -> Nothing
)
instance AsFourPerEmSpace Integer where
_FourPerEmSpace =
prism'
(\FourPerEmSpace -> 8197)
(\case
8197 -> Just FourPerEmSpace
_ -> Nothing
)
parseFourPerEmSpace ::
CharParsing p =>
p FourPerEmSpace
parseFourPerEmSpace =
FourPerEmSpace <$ satisfy (== '\8197') <?> "four per em space character"
data SixPerEmSpace = SixPerEmSpace
deriving (Eq, Ord, Show, Generic)
class HasSixPerEmSpace a where
sixPerEmSpace :: Lens' a SixPerEmSpace
instance HasSixPerEmSpace SixPerEmSpace where
sixPerEmSpace = id
instance HasSixPerEmSpace () where
sixPerEmSpace f x =
fmap (\SixPerEmSpace -> x) (f SixPerEmSpace)
instance Semigroup SixPerEmSpace where
SixPerEmSpace <> SixPerEmSpace = SixPerEmSpace
instance Monoid SixPerEmSpace where
mempty = SixPerEmSpace
class AsSixPerEmSpace a where
_SixPerEmSpace :: Prism' a SixPerEmSpace
_SixPerEmSpace' :: a
_SixPerEmSpace' = _SixPerEmSpace # SixPerEmSpace
instance AsSixPerEmSpace SixPerEmSpace where
_SixPerEmSpace = id
instance AsSixPerEmSpace () where
_SixPerEmSpace =
prism'
(\SixPerEmSpace -> ())
(\() -> Just SixPerEmSpace)
instance AsSixPerEmSpace Char where
_SixPerEmSpace =
prism'
(\SixPerEmSpace -> '\8198')
(\case
'\8198' -> Just SixPerEmSpace
_ -> Nothing
)
instance AsSixPerEmSpace Int where
_SixPerEmSpace =
prism'
(\SixPerEmSpace -> 8198)
(\case
8198 -> Just SixPerEmSpace
_ -> Nothing
)
instance AsSixPerEmSpace Integer where
_SixPerEmSpace =
prism'
(\SixPerEmSpace -> 8198)
(\case
8198 -> Just SixPerEmSpace
_ -> Nothing
)
parseSixPerEmSpace ::
CharParsing p =>
p SixPerEmSpace
parseSixPerEmSpace =
SixPerEmSpace <$ satisfy (== '\8198') <?> "six per em space character"
data FigureSpace = FigureSpace
deriving (Eq, Ord, Show, Generic)
class HasFigureSpace a where
figureSpace :: Lens' a FigureSpace
instance HasFigureSpace FigureSpace where
figureSpace = id
instance HasFigureSpace () where
figureSpace f x =
fmap (\FigureSpace -> x) (f FigureSpace)
instance Semigroup FigureSpace where
FigureSpace <> FigureSpace = FigureSpace
instance Monoid FigureSpace where
mempty = FigureSpace
class AsFigureSpace a where
_FigureSpace :: Prism' a FigureSpace
_FigureSpace' :: a
_FigureSpace' = _FigureSpace # FigureSpace
instance AsFigureSpace FigureSpace where
_FigureSpace = id
instance AsFigureSpace () where
_FigureSpace =
prism'
(\FigureSpace -> ())
(\() -> Just FigureSpace)
instance AsFigureSpace Char where
_FigureSpace =
prism'
(\FigureSpace -> '\8199')
(\case
'\8199' -> Just FigureSpace
_ -> Nothing
)
instance AsFigureSpace Int where
_FigureSpace =
prism'
(\FigureSpace -> 8199)
(\case
8199 -> Just FigureSpace
_ -> Nothing
)
instance AsFigureSpace Integer where
_FigureSpace =
prism'
(\FigureSpace -> 8199)
(\case
8199 -> Just FigureSpace
_ -> Nothing
)
parseFigureSpace ::
CharParsing p =>
p FigureSpace
parseFigureSpace =
FigureSpace <$ satisfy (== '\8199') <?> "figure space character"
data PunctuationSpace = PunctuationSpace
deriving (Eq, Ord, Show, Generic)
class HasPunctuationSpace a where
punctuationSpace :: Lens' a PunctuationSpace
instance HasPunctuationSpace PunctuationSpace where
punctuationSpace = id
instance HasPunctuationSpace () where
punctuationSpace f x =
fmap (\PunctuationSpace -> x) (f PunctuationSpace)
instance Semigroup PunctuationSpace where
PunctuationSpace <> PunctuationSpace = PunctuationSpace
instance Monoid PunctuationSpace where
mempty = PunctuationSpace
class AsPunctuationSpace a where
_PunctuationSpace :: Prism' a PunctuationSpace
_PunctuationSpace' :: a
_PunctuationSpace' = _PunctuationSpace # PunctuationSpace
instance AsPunctuationSpace PunctuationSpace where
_PunctuationSpace = id
instance AsPunctuationSpace () where
_PunctuationSpace =
prism'
(\PunctuationSpace -> ())
(\() -> Just PunctuationSpace)
instance AsPunctuationSpace Char where
_PunctuationSpace =
prism'
(\PunctuationSpace -> '\8200')
(\case
'\8200' -> Just PunctuationSpace
_ -> Nothing
)
instance AsPunctuationSpace Int where
_PunctuationSpace =
prism'
(\PunctuationSpace -> 8200)
(\case
8200 -> Just PunctuationSpace
_ -> Nothing
)
instance AsPunctuationSpace Integer where
_PunctuationSpace =
prism'
(\PunctuationSpace -> 8200)
(\case
8200 -> Just PunctuationSpace
_ -> Nothing
)
parsePunctuationSpace ::
CharParsing p =>
p PunctuationSpace
parsePunctuationSpace =
PunctuationSpace <$ satisfy (== '\8200') <?> "punctuation space character"
data ThinSpace = ThinSpace
deriving (Eq, Ord, Show, Generic)
class HasThinSpace a where
thinSpace :: Lens' a ThinSpace
instance HasThinSpace ThinSpace where
thinSpace = id
instance HasThinSpace () where
thinSpace f x =
fmap (\ThinSpace -> x) (f ThinSpace)
instance Semigroup ThinSpace where
ThinSpace <> ThinSpace = ThinSpace
instance Monoid ThinSpace where
mempty = ThinSpace
class AsThinSpace a where
_ThinSpace :: Prism' a ThinSpace
_ThinSpace' :: a
_ThinSpace' = _ThinSpace # ThinSpace
instance AsThinSpace ThinSpace where
_ThinSpace = id
instance AsThinSpace () where
_ThinSpace =
prism'
(\ThinSpace -> ())
(\() -> Just ThinSpace)
instance AsThinSpace Char where
_ThinSpace =
prism'
(\ThinSpace -> '\8201')
(\case
'\8201' -> Just ThinSpace
_ -> Nothing
)
instance AsThinSpace Int where
_ThinSpace =
prism'
(\ThinSpace -> 8201)
(\case
8201 -> Just ThinSpace
_ -> Nothing
)
instance AsThinSpace Integer where
_ThinSpace =
prism'
(\ThinSpace -> 8201)
(\case
8201 -> Just ThinSpace
_ -> Nothing
)
parseThinSpace ::
CharParsing p =>
p ThinSpace
parseThinSpace =
ThinSpace <$ satisfy (== '\8201') <?> "thin space character"
data HairSpace = HairSpace
deriving (Eq, Ord, Show, Generic)
class HasHairSpace a where
hairSpace :: Lens' a HairSpace
instance HasHairSpace HairSpace where
hairSpace = id
instance HasHairSpace () where
hairSpace f x =
fmap (\HairSpace -> x) (f HairSpace)
instance Semigroup HairSpace where
HairSpace <> HairSpace = HairSpace
instance Monoid HairSpace where
mempty = HairSpace
class AsHairSpace a where
_HairSpace :: Prism' a HairSpace
_HairSpace' :: a
_HairSpace' = _HairSpace # HairSpace
instance AsHairSpace HairSpace where
_HairSpace = id
instance AsHairSpace () where
_HairSpace =
prism'
(\HairSpace -> ())
(\() -> Just HairSpace)
instance AsHairSpace Char where
_HairSpace =
prism'
(\HairSpace -> '\8202')
(\case
'\8202' -> Just HairSpace
_ -> Nothing
)
instance AsHairSpace Int where
_HairSpace =
prism'
(\HairSpace -> 8202)
(\case
8202 -> Just HairSpace
_ -> Nothing
)
instance AsHairSpace Integer where
_HairSpace =
prism'
(\HairSpace -> 8202)
(\case
8202 -> Just HairSpace
_ -> Nothing
)
parseHairSpace ::
CharParsing p =>
p HairSpace
parseHairSpace =
HairSpace <$ satisfy (== '\8202') <?> "hair space character"
data NarrowNoBreakSpace = NarrowNoBreakSpace
deriving (Eq, Ord, Show, Generic)
class HasNarrowNoBreakSpace a where
narrowNoBreakSpace :: Lens' a NarrowNoBreakSpace
instance HasNarrowNoBreakSpace NarrowNoBreakSpace where
narrowNoBreakSpace = id
instance HasNarrowNoBreakSpace () where
narrowNoBreakSpace f x =
fmap (\NarrowNoBreakSpace -> x) (f NarrowNoBreakSpace)
instance Semigroup NarrowNoBreakSpace where
NarrowNoBreakSpace <> NarrowNoBreakSpace = NarrowNoBreakSpace
instance Monoid NarrowNoBreakSpace where
mempty = NarrowNoBreakSpace
class AsNarrowNoBreakSpace a where
_NarrowNoBreakSpace :: Prism' a NarrowNoBreakSpace
_NarrowNoBreakSpace' :: a
_NarrowNoBreakSpace' = _NarrowNoBreakSpace # NarrowNoBreakSpace
instance AsNarrowNoBreakSpace NarrowNoBreakSpace where
_NarrowNoBreakSpace = id
instance AsNarrowNoBreakSpace () where
_NarrowNoBreakSpace =
prism'
(\NarrowNoBreakSpace -> ())
(\() -> Just NarrowNoBreakSpace)
instance AsNarrowNoBreakSpace Char where
_NarrowNoBreakSpace =
prism'
(\NarrowNoBreakSpace -> '\8239')
(\case
'\8239' -> Just NarrowNoBreakSpace
_ -> Nothing
)
instance AsNarrowNoBreakSpace Int where
_NarrowNoBreakSpace =
prism'
(\NarrowNoBreakSpace -> 8239)
(\case
8239 -> Just NarrowNoBreakSpace
_ -> Nothing
)
instance AsNarrowNoBreakSpace Integer where
_NarrowNoBreakSpace =
prism'
(\NarrowNoBreakSpace -> 8239)
(\case
8239 -> Just NarrowNoBreakSpace
_ -> Nothing
)
parseNarrowNoBreakSpace ::
CharParsing p =>
p NarrowNoBreakSpace
parseNarrowNoBreakSpace =
NarrowNoBreakSpace <$ satisfy (== '\8239') <?> "narrow no break space character"
data MediumMathematicalSpace = MediumMathematicalSpace
deriving (Eq, Ord, Show, Generic)
class HasMediumMathematicalSpace a where
mediumMathematicalSpace :: Lens' a MediumMathematicalSpace
instance HasMediumMathematicalSpace MediumMathematicalSpace where
mediumMathematicalSpace = id
instance HasMediumMathematicalSpace () where
mediumMathematicalSpace f x =
fmap (\MediumMathematicalSpace -> x) (f MediumMathematicalSpace)
instance Semigroup MediumMathematicalSpace where
MediumMathematicalSpace <> MediumMathematicalSpace = MediumMathematicalSpace
instance Monoid MediumMathematicalSpace where
mempty = MediumMathematicalSpace
class AsMediumMathematicalSpace a where
_MediumMathematicalSpace :: Prism' a MediumMathematicalSpace
_MediumMathematicalSpace' :: a
_MediumMathematicalSpace' = _MediumMathematicalSpace # MediumMathematicalSpace
instance AsMediumMathematicalSpace MediumMathematicalSpace where
_MediumMathematicalSpace = id
instance AsMediumMathematicalSpace () where
_MediumMathematicalSpace =
prism'
(\MediumMathematicalSpace -> ())
(\() -> Just MediumMathematicalSpace)
instance AsMediumMathematicalSpace Char where
_MediumMathematicalSpace =
prism'
(\MediumMathematicalSpace -> '\8287')
(\case
'\8287' -> Just MediumMathematicalSpace
_ -> Nothing
)
instance AsMediumMathematicalSpace Int where
_MediumMathematicalSpace =
prism'
(\MediumMathematicalSpace -> 8287)
(\case
8287 -> Just MediumMathematicalSpace
_ -> Nothing
)
instance AsMediumMathematicalSpace Integer where
_MediumMathematicalSpace =
prism'
(\MediumMathematicalSpace -> 8287)
(\case
8287 -> Just MediumMathematicalSpace
_ -> Nothing
)
parseMediumMathematicalSpace ::
CharParsing p =>
p MediumMathematicalSpace
parseMediumMathematicalSpace =
MediumMathematicalSpace <$ satisfy (== '\8287') <?> "medium mathematical space character"
data IdeographicSpace = IdeographicSpace
deriving (Eq, Ord, Show, Generic)
class HasIdeographicSpace a where
ideographicSpace :: Lens' a IdeographicSpace
instance HasIdeographicSpace IdeographicSpace where
ideographicSpace = id
instance HasIdeographicSpace () where
ideographicSpace f x =
fmap (\IdeographicSpace -> x) (f IdeographicSpace)
instance Semigroup IdeographicSpace where
IdeographicSpace <> IdeographicSpace = IdeographicSpace
instance Monoid IdeographicSpace where
mempty = IdeographicSpace
class AsIdeographicSpace a where
_IdeographicSpace :: Prism' a IdeographicSpace
_IdeographicSpace' :: a
_IdeographicSpace' = _IdeographicSpace # IdeographicSpace
instance AsIdeographicSpace IdeographicSpace where
_IdeographicSpace = id
instance AsIdeographicSpace () where
_IdeographicSpace =
prism'
(\IdeographicSpace -> ())
(\() -> Just IdeographicSpace)
instance AsIdeographicSpace Char where
_IdeographicSpace =
prism'
(\IdeographicSpace -> '\12288')
(\case
'\12288' -> Just IdeographicSpace
_ -> Nothing
)
instance AsIdeographicSpace Int where
_IdeographicSpace =
prism'
(\IdeographicSpace -> 12288)
(\case
12288 -> Just IdeographicSpace
_ -> Nothing
)
instance AsIdeographicSpace Integer where
_IdeographicSpace =
prism'
(\IdeographicSpace -> 12288)
(\case
12288 -> Just IdeographicSpace
_ -> Nothing
)
parseIdeographicSpace ::
CharParsing p =>
p IdeographicSpace
parseIdeographicSpace =
IdeographicSpace <$ satisfy (== '\12288') <?> "ideographic space character"
data SpaceChar =
HorizontalTab_
| LineFeed_
| VerticalTab_
| FormFeed_
| CarriageReturn_
| Whitespace_
| NoBreakSpace_
| OghamSpaceMark_
| EnQuad_
| EmQuad_
| EnSpace_
| EmSpace_
| ThreePerEmSpace_
| FourPerEmSpace_
| SixPerEmSpace_
| FigureSpace_
| PunctuationSpace_
| ThinSpace_
| HairSpace_
| NarrowNoBreakSpace_
| MediumMathematicalSpace_
| IdeographicSpace_
deriving (Eq, Ord, Show, Generic)
class HasSpaceChar a where
spaceChar :: Lens' a SpaceChar
instance HasSpaceChar SpaceChar where
spaceChar = id
class AsSpaceChar a where
_SpaceChar :: Prism' a SpaceChar
instance AsSpaceChar SpaceChar where
_SpaceChar = id
instance AsSpaceChar Char where
_SpaceChar =
prism'
(\case
HorizontalTab_ ->
'\9'
LineFeed_ ->
'\10'
VerticalTab_ ->
'\11'
FormFeed_ ->
'\12'
CarriageReturn_ ->
'\13'
Whitespace_ ->
'\32'
NoBreakSpace_ ->
'\160'
OghamSpaceMark_ ->
'\5760'
EnQuad_ ->
'\8192'
EmQuad_ ->
'\8193'
EnSpace_ ->
'\8194'
EmSpace_ ->
'\8195'
ThreePerEmSpace_ ->
'\8196'
FourPerEmSpace_ ->
'\8197'
SixPerEmSpace_ ->
'\8198'
FigureSpace_ ->
'\8199'
PunctuationSpace_ ->
'\8200'
ThinSpace_ ->
'\8201'
HairSpace_ ->
'\8202'
NarrowNoBreakSpace_ ->
'\8239'
MediumMathematicalSpace_ ->
'\8287'
IdeographicSpace_ ->
'\12288'
)
(\case
'\9' ->
Just HorizontalTab_
'\10' ->
Just LineFeed_
'\11' ->
Just VerticalTab_
'\12' ->
Just FormFeed_
'\13' ->
Just CarriageReturn_
'\32' ->
Just Whitespace_
'\160' ->
Just NoBreakSpace_
'\5760' ->
Just OghamSpaceMark_
'\8192' ->
Just EnQuad_
'\8193' ->
Just EmQuad_
'\8194' ->
Just EnSpace_
'\8195' ->
Just EmSpace_
'\8196' ->
Just ThreePerEmSpace_
'\8197' ->
Just FourPerEmSpace_
'\8198' ->
Just SixPerEmSpace_
'\8199' ->
Just FigureSpace_
'\8200' ->
Just PunctuationSpace_
'\8201' ->
Just ThinSpace_
'\8202' ->
Just HairSpace_
'\8239' ->
Just NarrowNoBreakSpace_
'\8287' ->
Just MediumMathematicalSpace_
'\12288' ->
Just IdeographicSpace_
_ ->
Nothing
)
parseSpaceChar ::
CharParsing p =>
p SpaceChar
parseSpaceChar =
asum [
HorizontalTab_ <$ parseHorizontalTab
, LineFeed_ <$ parseLineFeed
, VerticalTab_ <$ parseVerticalTab
, FormFeed_ <$ parseFormFeed
, CarriageReturn_ <$ parseCarriageReturn
, Whitespace_ <$ parseWhitespace
, NoBreakSpace_ <$ parseNoBreakSpace
, OghamSpaceMark_ <$ parseOghamSpaceMark
, EnQuad_ <$ parseEnQuad
, EmQuad_ <$ parseEmQuad
, EnSpace_ <$ parseEnSpace
, EmSpace_ <$ parseEmSpace
, ThreePerEmSpace_ <$ parseThreePerEmSpace
, FourPerEmSpace_ <$ parseFourPerEmSpace
, SixPerEmSpace_ <$ parseSixPerEmSpace
, FigureSpace_ <$ parseFigureSpace
, PunctuationSpace_ <$ parsePunctuationSpace
, ThinSpace_ <$ parseThinSpace
, HairSpace_ <$ parseHairSpace
, NarrowNoBreakSpace_ <$ parseNarrowNoBreakSpace
, MediumMathematicalSpace_ <$ parseMediumMathematicalSpace
, IdeographicSpace_ <$ parseIdeographicSpace
]
instance AsHorizontalTab SpaceChar where
_HorizontalTab =
prism'
(\HorizontalTab -> HorizontalTab_)
(\case
HorizontalTab_ -> Just HorizontalTab
_ -> Nothing
)
instance AsLineFeed SpaceChar where
_LineFeed =
prism'
(\LineFeed -> LineFeed_)
(\case
LineFeed_ -> Just LineFeed
_ -> Nothing
)
instance AsVerticalTab SpaceChar where
_VerticalTab =
prism'
(\VerticalTab -> VerticalTab_)
(\case
VerticalTab_ -> Just VerticalTab
_ -> Nothing
)
instance AsFormFeed SpaceChar where
_FormFeed =
prism'
(\FormFeed -> FormFeed_)
(\case
FormFeed_ -> Just FormFeed
_ -> Nothing
)
instance AsCarriageReturn SpaceChar where
_CarriageReturn =
prism'
(\CarriageReturn -> CarriageReturn_)
(\case
CarriageReturn_ -> Just CarriageReturn
_ -> Nothing
)
instance AsWhitespace SpaceChar where
_Whitespace =
prism'
(\Whitespace -> Whitespace_)
(\case
Whitespace_ -> Just Whitespace
_ -> Nothing
)
instance AsNoBreakSpace SpaceChar where
_NoBreakSpace =
prism'
(\NoBreakSpace -> NoBreakSpace_)
(\case
NoBreakSpace_ -> Just NoBreakSpace
_ -> Nothing
)
instance AsOghamSpaceMark SpaceChar where
_OghamSpaceMark =
prism'
(\OghamSpaceMark -> OghamSpaceMark_)
(\case
OghamSpaceMark_ -> Just OghamSpaceMark
_ -> Nothing
)
instance AsEnQuad SpaceChar where
_EnQuad =
prism'
(\EnQuad -> EnQuad_)
(\case
EnQuad_ -> Just EnQuad
_ -> Nothing
)
instance AsEmQuad SpaceChar where
_EmQuad =
prism'
(\EmQuad -> EmQuad_)
(\case
EmQuad_ -> Just EmQuad
_ -> Nothing
)
instance AsEnSpace SpaceChar where
_EnSpace =
prism'
(\EnSpace -> EnSpace_)
(\case
EnSpace_ -> Just EnSpace
_ -> Nothing
)
instance AsEmSpace SpaceChar where
_EmSpace =
prism'
(\EmSpace -> EmSpace_)
(\case
EmSpace_ -> Just EmSpace
_ -> Nothing
)
instance AsThreePerEmSpace SpaceChar where
_ThreePerEmSpace =
prism'
(\ThreePerEmSpace -> ThreePerEmSpace_)
(\case
ThreePerEmSpace_ -> Just ThreePerEmSpace
_ -> Nothing
)
instance AsFourPerEmSpace SpaceChar where
_FourPerEmSpace =
prism'
(\FourPerEmSpace -> FourPerEmSpace_)
(\case
FourPerEmSpace_ -> Just FourPerEmSpace
_ -> Nothing
)
instance AsSixPerEmSpace SpaceChar where
_SixPerEmSpace =
prism'
(\SixPerEmSpace -> SixPerEmSpace_)
(\case
SixPerEmSpace_ -> Just SixPerEmSpace
_ -> Nothing
)
instance AsFigureSpace SpaceChar where
_FigureSpace =
prism'
(\FigureSpace -> FigureSpace_)
(\case
FigureSpace_ -> Just FigureSpace
_ -> Nothing
)
instance AsPunctuationSpace SpaceChar where
_PunctuationSpace =
prism'
(\PunctuationSpace -> PunctuationSpace_)
(\case
PunctuationSpace_ -> Just PunctuationSpace
_ -> Nothing
)
instance AsThinSpace SpaceChar where
_ThinSpace =
prism'
(\ThinSpace -> ThinSpace_)
(\case
ThinSpace_ -> Just ThinSpace
_ -> Nothing
)
instance AsHairSpace SpaceChar where
_HairSpace =
prism'
(\HairSpace -> HairSpace_)
(\case
HairSpace_ -> Just HairSpace
_ -> Nothing
)
instance AsNarrowNoBreakSpace SpaceChar where
_NarrowNoBreakSpace =
prism'
(\NarrowNoBreakSpace -> NarrowNoBreakSpace_)
(\case
NarrowNoBreakSpace_ -> Just NarrowNoBreakSpace
_ -> Nothing
)
instance AsMediumMathematicalSpace SpaceChar where
_MediumMathematicalSpace =
prism'
(\MediumMathematicalSpace -> MediumMathematicalSpace_)
(\case
MediumMathematicalSpace_ -> Just MediumMathematicalSpace
_ -> Nothing
)
instance AsIdeographicSpace SpaceChar where
_IdeographicSpace =
prism'
(\IdeographicSpace -> IdeographicSpace_)
(\case
IdeographicSpace_ -> Just IdeographicSpace
_ -> Nothing
)
data IsoLatin1 =
HorizontalTab__
| LineFeed__
| FormFeed__
| CarriageReturn__
| Whitespace__
deriving (Eq, Ord, Show, Generic)
class HasIsoLatin1 a where
isoLatin1 :: Lens' a IsoLatin1
instance HasIsoLatin1 IsoLatin1 where
isoLatin1 = id
class AsIsoLatin1 a where
_IsoLatin1 :: Prism' a IsoLatin1
instance AsIsoLatin1 Char where
_IsoLatin1 =
prism'
(\case
HorizontalTab__ ->
'\9'
LineFeed__ ->
'\10'
FormFeed__ ->
'\12'
CarriageReturn__ ->
'\13'
Whitespace__ ->
'\32'
)
(\case
'\9' ->
Just HorizontalTab__
'\10' ->
Just LineFeed__
'\12' ->
Just FormFeed__
'\13' ->
Just CarriageReturn__
'\32' ->
Just Whitespace__
_ ->
Nothing
)
instance AsIsoLatin1 IsoLatin1 where
_IsoLatin1 = id
parseIsoLatin1 ::
CharParsing p =>
p IsoLatin1
parseIsoLatin1 =
asum [
HorizontalTab__ <$ parseHorizontalTab
, LineFeed__ <$ parseLineFeed
, FormFeed__ <$ parseFormFeed
, CarriageReturn__ <$ parseCarriageReturn
, Whitespace__ <$ parseWhitespace
]
instance AsHorizontalTab IsoLatin1 where
_HorizontalTab =
prism'
(\HorizontalTab -> HorizontalTab__)
(\case
HorizontalTab__ -> Just HorizontalTab
_ -> Nothing
)
instance AsLineFeed IsoLatin1 where
_LineFeed =
prism'
(\LineFeed -> LineFeed__)
(\case
LineFeed__ -> Just LineFeed
_ -> Nothing
)
instance AsFormFeed IsoLatin1 where
_FormFeed =
prism'
(\FormFeed -> FormFeed__)
(\case
FormFeed__ -> Just FormFeed
_ -> Nothing
)
instance AsCarriageReturn IsoLatin1 where
_CarriageReturn =
prism'
(\CarriageReturn -> CarriageReturn__)
(\case
CarriageReturn__ -> Just CarriageReturn
_ -> Nothing
)
instance AsWhitespace IsoLatin1 where
_Whitespace =
prism'
(\Whitespace -> Whitespace__)
(\case
Whitespace__ -> Just Whitespace
_ -> Nothing
)